267269 Commits

Author SHA1 Message Date
macallan
e16f314b27 moar registers
to the right branch this time (hopefully)
2019-05-04 00:45:18 +00:00
kamil
efd4138069 Register KTR events for debugger related signals
Register signals for:

 - crashes (FPE, SEGV, FPE, ILL, BUS)
 - LWP events
 - CHLD (FORK/VFORK/VFORK_DONE) events -- temporarily disabled
 - EXEC events

While there refactor related functions in order to simplify the code.

Add missing comment documentation for recently added kernel functions.
2019-05-03 22:34:21 +00:00
kamil
51245743fe Improve comment in the GDB NetBSD code 2019-05-03 19:06:50 +00:00
kamil
1c9d9aa474 Overwrite waiton_ptid in nbsd-nat, rather than generic core
This avoids compatibility issues with remote access to !NetBSD platform.
2019-05-03 19:03:57 +00:00
mlelstv
422da90206 Avoid null pointer deref in printing xfer mode when no target driver
is attached. Fixes kern/54157.
2019-05-03 16:06:56 +00:00
sevan
b59b1793d5 sup.NetBSD.org is no longer around. 2019-05-03 11:29:06 +00:00
kamil
a26629aac4 Quick clean up the NetBSD support in GDB
Changes:

 - always perform polling on inferior_ptid, never -1
   -1 can cause catching fork/vfork events in random order
   polling on pid will guarantee to report events in expected order

 - assume availability of KERN_PROC_PATHNAME

 - drop dead code for KERN_PROC_AUXV (FreeBSD-specific sysctl)
   AUXV on NetBSD is handled with PIOD_READ_AUXV

 - drop unused nbsd_fetch_kinfo_proc

 - drop unneeded hacks for fork/vfork code

 - drop support for FreeBSD specific flags returned for PT_LWPINFO
   NetBSD uses PT_GET_SIGINFO / PT_GET_PROCESS_STATE for most pieces of
   information

 - port nbsd_thread_name to NetBSD

 - enable LWP and FORK events in nbsd_enable_proc_events

 - use NetBSD new batteries for distinguishing event type in to_wait
   map most events into GDB types
   breakpoint, single step, hw breakpoint/watchpoint ones are still not
   used with the full power here

 - add support for EXEC events

 - clean up

This change makes GDB functional with threaded code and it is good enough
to pass t_regress / threads test.

It's possible to execute and step processes with multiple threads, use
scheduler-lock, follow-fork etc features.


What does not work:

 - the LWP EXIT event and wait() are not synchronized and can deadlock
   this has been observed with exiting go applications

 - GDB VFORK code is still disabled and awaits kernel fixing

Short term goal is to correct LWP EXIT and follow up with VFORK fixes.

Long term goal is to rewrite NetBSD GDB support and write new support in
the remote process plugin (gdb-server) framework.

PR kern/53120
PR port-arm/51677
PR bin/54060
PR bin/49662
PR kern/52548
2019-05-03 07:05:28 +00:00
mrg
de381fca12 the standard sun8i-a83t-cubietruck-plus.dts is missing temp sensor
support that is in sun8i-a83t.dtsi.  this one includes both.
2019-05-03 02:36:17 +00:00
pgoyette
6f326fadc5 Only initialize the NET_MPSAFE stuff once, for the non-compat version
of route_init().
2019-05-03 02:10:58 +00:00
tsutsui
0ded34ef61 Make sure interrupts are disabled during cpu_configure(9).
Fixes 'panic: kernel diagnostic assertion "cv_is_valid(cv)" failed'
during fdcisa(4) probe on Milan's DIAGNOSTIC kernel, caused by
a stray interrupt from the FDC right after isa_intr_establish().
No visible bad side effect on TT030 with this change.

Should be pulled up to netbsd-8.
2019-05-03 01:08:28 +00:00
jmcneill
e2c990a1b0 Fix definition of GICD_IROUTER; the input to this macro is the INTID,
which can be a value between 32 and 1019.
2019-05-02 23:07:40 +00:00
kamil
e6d350579a Adapt t_ptrace_wait* tests for recent kernel changes
Adapt AUXV reading loop to handle io.piod_len == 0 as EOF.

Temporarily disable trace_thread_lwpcreate until it will be verified that
it is stable.
2019-05-02 22:52:21 +00:00
kamil
ac37cdce0c Introduce fixes for ptrace(2)
Stop disabling LWP create and exit events for PT_SYSCALL tracing.
PT_SYSCALL disabled EXEC reporting for legacy reasons, there is no need
to repeat it for LWP and CHLD events.

Pass full siginfo from trapsignal events (SEGV, BUS, ILL, TRAP, FPE).
This adds missing information about signals like fault address.

Set ps_lwp always.

Before passing siginfo to userland through p_sigctx.ps_info, make sure
that it was zeroed for unused bytes. LWP and CHLD events do not set si_addr
and si_trap, these pieces of information are passed for crashes (like
software breakpoint).

LLDB crash reporting works now correctly:

(lldb) r
Process 552 launched: '/tmp/a.out' (x86_64)
Process 552 stopped
* thread #1, stop reason = signal SIGSEGV: invalid address (fault address: 0x123456)
2019-05-02 22:23:49 +00:00
jdolecek
143ea479d8 add NetMos NM9912 entries
PR kern/54149 by Mouse
2019-05-02 21:33:12 +00:00
scole
dcd41d7b30 Add more code from FreeBSD, still needs work 2019-05-02 17:34:01 +00:00
scole
b3d1df9240 Restore UC_MCONTEXT, UC_MCONTEXT, and clean up some whitespace 2019-05-02 17:31:56 +00:00
scole
3855018b91 Remove some unused assembly and other variables to reduce compile warnings 2019-05-02 16:55:50 +00:00
skrll
8e4f441b5a It's the Normal Memory Remap Register (not Normal Region Remap Register) 2019-05-02 15:37:10 +00:00
mgorny
c1c809ed5e Explicitly indicate that nexttowardl() is identical to nextafterl().
Requested by kamil.
2019-05-02 15:08:35 +00:00
taca
274c875736 Fix one more writable directory check to "directory" in options seciton
when named is reloaded case.
2019-05-02 14:57:01 +00:00
skrll
570e2487f4 Fix Normal Region Remap Register bitmask names 2019-05-02 11:49:04 +00:00
mlelstv
4daa4021a7 take interrupt lock when closing backend. 2019-05-02 09:19:28 +00:00
mrg
5426352fee on netbsd when defaulting to the native system, also derived MACHINE_ARCH
from the uname -p value already fetched.

this means eg, build.sh on evbarm will build the native platform rather
than "earm" (armv5) -- which was the default even on arm64 hosts.
2019-05-02 02:51:01 +00:00
kamil
a2a627f040 Rename and partially enable trace_thread ATF ptrace(2) tests
Rename trace_thrad[1234] to more meaningful names:

 - trace_thread_nolwpevents
 - trace_thread_lwpexit
 - trace_thread_lwpcreate
 - trace_thread_lwpcreate_and_exit

In my local tests LWP CREATE events work as expected.
LWP EXIT ones are still racy and keep them disabled racy.

PR kern/51995
2019-05-02 00:34:06 +00:00
kamil
bdd3966cbf Allow cancelled byte transfer in ptrace(2) again
Current GDB depends on it on NetBSD (which is probably a GDB support bug).

In future GDB will be examined for this and this code revisited.
2019-05-02 00:23:01 +00:00
kamil
f33e5cf82e ATF ptrace(2) tests suspend1 and resume1 now pass
Verified on bare metal and in qemu.

PR kern/51995
2019-05-01 23:44:16 +00:00
kamil
5b66da1dba Call MD code in mi_startlwp() before MI check for debugger
This allows to get initialized mcontext.
2019-05-01 22:55:55 +00:00
kamil
786ec9cc85 ATF ptrace(2) tests signal9 and signal10 now pass
PR kern/51918
2019-05-01 21:59:32 +00:00
kamil
d1fa1f15ea Correct passing debugger related events for LWP create and exit
Add MI toplevel startlwp function.

Switch all userland LWPs to go through lwp_create using a shared
mi_startlwp() function between all MD ABIs.

Add debugger related event handling in mi_startlwp() and continue with
standard p->p_emul->e_startlwp at the end of this routine.

Use eventswitch() to notify the event of LWP exit in lwp_exit().

ATF ptrace(2) tests signal9 and signal10 now pass.
2019-05-01 21:57:34 +00:00
kamil
6386bed56f Assert that debugger event is triggered only for userland LWP
All passing ATF ptrace(2) tests still pass.
2019-05-01 21:52:35 +00:00
kamil
9cd3398aac Add new fork/vfork ATF trests in t_ptrace_wait*
Add new tests:

 - fork_detach_forker
 - vfork_detach_vforker
 - vfork_detach_vforkerdone
 - fork_kill_forker
 - vfork_kill_vforker
 - vfork_kill_vforkerdone

All tests pass with recent kernel changes.
2019-05-01 18:20:23 +00:00
kamil
f93c604b79 Correct handling of corner cases in fork1(9) code under a debugger
Correct detaching and SIGKILLing forker and vforker in the middle of its
operation.
2019-05-01 18:01:54 +00:00
kamil
d55073af77 Add eventswitch() in signal code
Route all crash and debugger related signal through eventswitch(), that
calls sigswitch() with preprocessed arguments.

This code avoids code duplication and allows to introduce changes that
will affect all callers of sigswitch() in debugger-related events.

No functional change intended.
2019-05-01 17:21:55 +00:00
kamil
ff3a41b31a Disallow resuming program with PC=0x0 in ptrace(2)
If the address parameter is 0, report error.
It's a popular mistake to set Program Counter to 0x0.
In certain kernels this is allowable parameter and causes
portability issue.

Disallow explicitly zeroed PC, instead of triggering
a harder to debug crash later.
2019-05-01 17:02:40 +00:00
maxv
81f3a3ee90 Start converting the x86 CPU functions to inlined ASM. Matters for NVMM,
where some are invoked millions of times.
2019-05-01 15:17:49 +00:00
maxv
dd84cbca6c Remove unused functions and reorder a little. 2019-05-01 14:29:15 +00:00
msaitoh
9bd76f1388 Add ether_ioctl() call for SIOCSIFADDR and SIOCSIFFLAGS to make behavior
the same as before.

XXX need cleanup.
2019-05-01 14:10:26 +00:00
msaitoh
a35676e482 Fix a wrong and extra ether_ioctl() call in alc_ioctl(). _IOWR types call
broke ifreq by the first ether_ioct() and the second ether_ioctl() caused
unexpected behavior. One of bug example is that SIOCGIFMEDIA always failed.
This bug was added in if_alc.c rev. 1.16.

XXX pullup-8
2019-05-01 12:31:51 +00:00
jmcneill
f2b3d1e5ba Enable pwm1 and add a pwm-fan node to enable the +FAN- header on ROCKPro64 2019-05-01 10:43:55 +00:00
jmcneill
e4f94805ca Add rkpwm and pwmfan 2019-05-01 10:41:54 +00:00
jmcneill
84c2953177 Add support for RK3399 PWM controller. 2019-05-01 10:41:33 +00:00
maxv
0d954de6fa Use the comm page to inject events, rather than ioctls, and commit them in
vcpu_run. This saves a few syscalls and copyins.

For example on Windows 10, moving the mouse from the left to right sides of
the screen generates ~500 events, which now don't result in syscalls.

The error handling is done in vcpu_run and it is less precise, but this
doesn't matter a lot, and will be solved with future NVMM error codes.
2019-05-01 09:20:21 +00:00
pgoyette
e3dbb03f52 No need to define COMPAT_50 any longer. All the compat decisions are
made with HOOKs.
2019-05-01 08:53:00 +00:00
wiz
0db71669ab Fix casing in Dt. Fix typo. 2019-05-01 07:40:52 +00:00
wiz
6d6a3bf1ef Fix casing in Dt. Fix SYNOPSIS. Fix typo. 2019-05-01 07:40:39 +00:00
wiz
343407e084 Fix casing in Dt. 2019-05-01 07:40:20 +00:00
mlelstv
908230ecbc Handle ISA/EISA interrupts like isa_machdep.c. 2019-05-01 07:26:28 +00:00
mlelstv
168f208f5b slotdata might not be attached, don't use it then. 2019-05-01 07:23:22 +00:00
mlelstv
58874e35a7 allow NONE build 2019-05-01 07:17:18 +00:00
mlelstv
e0c8918e3e Add man pages for Amiga clock chips 2019-05-01 06:47:45 +00:00