| History log of /src/sys/arch/i386/include/reg.h |
| Revision | | Date | Author | Comments |
| 1.22 |
| 18-May-2019 |
christos | lint gets the wrong size.
|
| 1.21 |
| 10-May-2019 |
mgorny | Fill 'struct fpreg' & 'struct xmmregs' in
The 'struct fpreg' data type used by PT_GETFPREGS, and 'struct xmmregs' used by PT_GETXMMREGS are currently opaque. Define them to contain correct data structs instead, the same way they are defined for amd64. For 'struct fpreg' this means 'struct save87', and for 'struct xmmregs' this means 'struct fxsave'. This makes it more transparent for consumers how the data is formatted, and allows using it without need for explicit casts.
Reviewed by <kamil>.
|
| 1.20 |
| 23-Feb-2017 |
kamil | branches: 1.20.14; Introduce PT_GETDBREGS and PT_SETDBREGS in ptrace(2) on i386 and amd64
This interface is modeled after FreeBSD API with the usage.
This replaced previous watchpoint API. The previous one was introduced recently in NetBSD-current and remove its spurs without any backward-compatibility.
Design choices for Debug Register accessors: - exec() (TRAP_EXEC event) must remove debug registers from LWP - debug registers are only per-LWP, not per-process globally - debug registers must not be inherited after (v)forking a process - debug registers must not be inherited after forking a thread - a debugger is responsible to set global watchpoints/breakpoints with the debug registers, to achieve this PTRACE_LWP_CREATE/PTRACE_LWP_EXIT event monitoring function is designed to be used - debug register traps must generate SIGTRAP with si_code TRAP_DBREG - debugger is responsible to retrieve debug register state to distinguish the exact debug register trap (DR6 is Status Register on x86) - kernel must not remove debug register traps after triggering a trap event a debugger is responsible to detach this trap with appropriate PT_SETDBREGS call (DR7 is Control Register on x86) - debug registers must not be exposed in mcontext - userland must not be allowed to set a trap on the kernel
Implementation notes on i386 and amd64: - the initial state of debug register is retrieved on boot and this value is stored in a local copy (initdbregs), this value is used to initialize dbreg context after PT_GETDBREGS - struct dbregs is stored in pcb as a pointer and by default not initialized - reserved registers (DR4-DR5, DR9-DR15) are ignored
Further ideas: - restrict this interface with securelevel
Tested on real hardware i386 (Intel Pentium IV) and amd64 (Intel i7).
This commit enables 390 debug register ATF tests in kernel/arch/x86. All tests are passing.
This commit does not cover netbsd32 compat code. Currently other interface PT_GET_SIGINFO/PT_SET_SIGINFO is required in netbsd32 compat code in order to validate reliably PT_GETDBREGS/PT_SETDBREGS.
This implementation does not cover FreeBSD specific defines in their <x86/reg.h>: DBREG_DR7_LOCAL_ENABLE, DBREG_DR7_GLOBAL_ENABLE, DBREG_DR7_LEN_1 etc. These values tend to be reinvented by each tracer on its own. GNU Debugger (GDB) works with NetBSD debug registers after adding this patch:
--- gdb/amd64bsd-nat.c.orig 2016-02-10 03:19:39.000000000 +0000 +++ gdb/amd64bsd-nat.c @@ -167,6 +167,10 @@ amd64bsd_target (void)
#ifdef HAVE_PT_GETDBREGS
+#ifndef DBREG_DRX +#define DBREG_DRX(d,x) ((d)->dr[(x)]) +#endif + static unsigned long amd64bsd_dr_get (ptid_t ptid, int regnum) {
Another reason to stop introducing unpopular defines covering machine specific register macros is that these value varies across generations of the same CPU family.
GDB demo: (gdb) c Continuing.
Watchpoint 2: traceme
Old value = 0 New value = 16 main (argc=1, argv=0x7f7fff79fe30) at test.c:8 8 printf("traceme=%d\n", traceme);
(Currently the GDB interface is not reliable due to NetBSD support bugs)
Sponsored by <The NetBSD Foundation>
|
| 1.19 |
| 16-Jan-2008 |
ad | branches: 1.19.54; 1.19.74; 1.19.78; 1.19.82; Remove options MATH_EMULATE.
|
| 1.18 |
| 07-Aug-2003 |
agc | branches: 1.18.16; 1.18.78; 1.18.84; 1.18.92; Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22364, verified by myself.
|
| 1.17 |
| 05-Dec-2001 |
thorpej | branches: 1.17.2; 1.17.18; * Allow machine-dependent code to specify hooks for ptrace(2) (__HAVE_PTRACE_MACHDEP) and procfs (__HAVE_PROCFS_MACHDEP). These changes will allow platforms like x86 (XMM) and PowerPC (AltiVec) to export extended register sets in a sane manner.
* Use __HAVE_PTRACE_MACHDEP to export x86 XMM registers (standard FP + SSE/SSE2) using PT_{GET,SET}XMMREGS (in the machdep ptrace request space). * Use __HAVE_PROCFS_MACHDEP to export x86 XMM registers via /proc/N/xmmregs in procfs.
|
| 1.16 |
| 17-Jul-2001 |
fvdl | Redefine evil tXXX register offset defines into the trapframe structure to use offsetof. These should be completely nuked.
Fixes math_emulate lossage.
|
| 1.15 |
| 16-Oct-1997 |
mycroft | branches: 1.15.28; 1.15.30; 1.15.32; Update a comment dating from 4.3/VAX.
|
| 1.14 |
| 11-Oct-1995 |
mycroft | Various changes from John Kohl and me: Map kernel stacks only at unique addresses. Use one TSS per process. Add sysarch calls for modifying IOPL and the I/O permission bitmap. Add a compacting GDT entry allocator, for TSS and LDT selectors. Enable modifying %fs and %gs with PT_SETREGS. Sanitize various bits of code.
|
| 1.13 |
| 06-Aug-1995 |
mycroft | Move the `used fpu' flag into mdproc, so it can be referenced when a process is swapped out. Implement process_{read,write}_fpregs.
|
| 1.12 |
| 26-Jan-1995 |
mycroft | Rearrange struct reg to match what the rest of the world expects.
|
| 1.11 |
| 27-Oct-1994 |
cgd | new RCS ID format.
|
| 1.10 |
| 09-Oct-1994 |
mycroft | Make reg, frame, and sigcontext more similar.
|
| 1.9 |
| 09-Oct-1994 |
mycroft | Eliminate tf_isp.
|
| 1.8 |
| 22-Dec-1993 |
cgd | branches: 1.8.2; 1.8.4; should be 'struct reg' not 'struct regs' -- it's in reg.h, after all! also, delete r_fs and r_gs; looking at the code and comments describing/using this struct, they don't belong here (though if support for them is ever put in here, they should be, but for i486-en only... how do you do that 'reasonably,' though? interface issues...)
|
| 1.7 |
| 20-Dec-1993 |
mycroft | Cleanup and garbage collection; nothing significant. From magnum branch.
|
| 1.6 |
| 19-Sep-1993 |
brezak | Add tISP offset
|
| 1.5 |
| 16-Sep-1993 |
brezak | Changes to use a trap frame for syscalls.
|
| 1.4 |
| 05-Sep-1993 |
sef | branches: 1.4.2; Yet more of the ptrace() reorg; now ptrace_setregs() and ptrace_getregs() are present, along with PT_GETREGS and PT_SETREGS ptrace commands.
|
| 1.3 |
| 24-May-1993 |
cgd | move sipcreg into i386/include/reg.h where it belongs, right next to ipcreg.
|
| 1.2 |
| 22-May-1993 |
cgd | add rcsids to everything and clean up headers
|
| 1.1 |
| 21-Mar-1993 |
cgd | branches: 1.1.1; Initial revision
|
| 1.1.1.1 |
| 21-Mar-1993 |
cgd | initial import of 386bsd-0.1 sources
|
| 1.4.2.3 |
| 14-Nov-1993 |
mycroft | Eliminate tEDI, tESI, etc.
|
| 1.4.2.2 |
| 14-Nov-1993 |
mycroft | Do the multiple-inclusion thang.
|
| 1.4.2.1 |
| 24-Sep-1993 |
mycroft | Changes from trunk. cpu.h: Add dummy (for now) CLKF_INTR(). #include psl.h. endian.h: Add multiple-inclusion protection. #define _QUAD_{LOW,HIGH}WORD. #include sys/cdefs for __P(). Don't define byte order stuff if _POSIX_SOURCE. Remove big endian shit. limits.h: Add {,U}QUAD_{MIN,MAX}. psl.h: Get PSL_MB[ZO] right. Make cpl volatile just in case. Add alias for spl0(). splnone() and splx() return int for now.
|
| 1.8.4.1 |
| 11-Oct-1994 |
mycroft | Update from trunk.
|
| 1.8.2.2 |
| 22-Dec-1993 |
cgd | should be 'struct reg' not 'struct regs' -- it's in reg.h, after all! also, delete r_fs and r_gs; looking at the code and comments describing/using this struct, they don't belong here (though if support for them is ever put in here, they should be, but for i486-en only... how do you do that 'reasonably,' though? interface issues...)
|
| 1.8.2.1 |
| 22-Dec-1993 |
cgd | file reg.h was added on branch magnum on 1993-12-22 12:57:25 +0000
|
| 1.15.32.2 |
| 10-Jan-2002 |
thorpej | Sync kqueue branch with -current.
|
| 1.15.32.1 |
| 03-Aug-2001 |
lukem | update to -current
|
| 1.15.30.2 |
| 08-Jan-2002 |
nathanw | Catch up to -current.
|
| 1.15.30.1 |
| 24-Aug-2001 |
nathanw | Catch up with -current.
|
| 1.15.28.1 |
| 29-Jul-2001 |
he | Pull up revision 1.16 (requested by fvdl): Redefine register offsets using offsetof(). Fixes math emulation lossage.
|
| 1.17.18.3 |
| 21-Sep-2004 |
skrll | Fix the sync with head I botched.
|
| 1.17.18.2 |
| 18-Sep-2004 |
skrll | Sync with HEAD.
|
| 1.17.18.1 |
| 03-Aug-2004 |
skrll | Sync with HEAD
|
| 1.17.2.2 |
| 05-Dec-2001 |
thorpej | * Allow machine-dependent code to specify hooks for ptrace(2) (__HAVE_PTRACE_MACHDEP) and procfs (__HAVE_PROCFS_MACHDEP). These changes will allow platforms like x86 (XMM) and PowerPC (AltiVec) to export extended register sets in a sane manner.
* Use __HAVE_PTRACE_MACHDEP to export x86 XMM registers (standard FP + SSE/SSE2) using PT_{GET,SET}XMMREGS (in the machdep ptrace request space). * Use __HAVE_PROCFS_MACHDEP to export x86 XMM registers via /proc/N/xmmregs in procfs.
|
| 1.17.2.1 |
| 05-Dec-2001 |
thorpej | file reg.h was added on branch sommerfeld_i386mp_1 on 2001-12-05 00:58:07 +0000
|
| 1.18.92.1 |
| 19-Jan-2008 |
bouyer | Sync with HEAD
|
| 1.18.84.1 |
| 18-Feb-2008 |
mjf | Sync with HEAD.
|
| 1.18.78.1 |
| 23-Mar-2008 |
matt | sync with HEAD
|
| 1.18.16.1 |
| 21-Jan-2008 |
yamt | sync with head
|
| 1.19.82.1 |
| 21-Apr-2017 |
bouyer | Sync with HEAD
|
| 1.19.78.1 |
| 20-Mar-2017 |
pgoyette | Sync with HEAD
|
| 1.19.74.1 |
| 28-Aug-2017 |
skrll | Sync with HEAD
|
| 1.19.54.1 |
| 03-Dec-2017 |
jdolecek | update from HEAD
|
| 1.20.14.1 |
| 10-Jun-2019 |
christos | Sync with HEAD
|