NetBSD/sys/arch
kamil 266caf90fb Add accessors for available x86 Debug Registers
There are 8 Debug Registers on i386 (available at least since 80386) and 16
on AMD64. Currently DR4 and DR5 are reserved on both cpu-families and
DR9-DR15 are still reserved on AMD64. Therefore add accessors for DR0-DR3,
DR6-DR7 for all ports.

Debug Registers x86:
 * DR0-DR3  Debug Address Registers
 * DR4-DR5  Reserved
 * DR6      Debug Status Register
 * DR7      Debug Control Register
 * DR8-DR15 Reserved

Access the registers is available only from a kernel (ring 0) as there is
needed top protected access. For this reason there is need to use special
XEN functions to get and set the registers in the XEN3 kernels.

XEN specific functions as defined in NetBSD:
 - HYPERVISOR_get_debugreg()
 - HYPERVISOR_set_debugreg()

This code extends the existing rdr6() and ldr6() accessor for additional:
 - rdr0() & ldr0()
 - rdr1() & ldr1()
 - rdr2() & ldr2()
 - rdr3() & ldr3()
 - rdr7() & ldr7()

Traditionally accessors for DR6 were passing vaddr_t argument, while it's
appropriate type for DR0-DR3, DR6-DR7 should be using u_long, however it's
not a big deal. The resulting functionality should be equivalent so stick
to this convention and use the vaddr_t type for all DR accessors.

There was already a function defined for rdr6() in XEN, but it had a nit on
AMD64 as it was casting HYPERVISOR_get_debugreg() to u_int (32-bit on
AMD64), truncating result. It still works for DR6, but for the sake of
simplicity always return full 64-bit value.

New accessors duplicate functionality of the dr0() function available on
i386 within the KSTACK_CHECK_DR0 option. dr0() is a specialized layer with
logic to set appropriate types of interrupts, now accessors are designed to
pass verbatim values from user-land (with simple sanity checks in the
kernel). At the moment there are no plans to make possible to coexist
KSTACK_CHECK_DR0 with debug registers for user applications (debuggers).

     options KSTACK_CHECK_DR0
     Detect kernel stack overflow using DR0 register.  This option uses DR0
     register exclusively so you can't use DR0 register for other purpose
     (e.g., hardware breakpoint) if you turn this on.

The KSTACK_CHECK_DR0 functionality was designed for i386 and never ported
to amd64.

Code tested on i386 and amd64 with kernels: GENERIC, XEN3_DOMU, XEN3_DOM0.

Sponsored by <The NetBSD Foundation>
2016-11-27 14:49:21 +00:00
..
aarch64
acorn26
acorn32
algor
alpha mention PAX_SEGVGUARD dependency on FILEASSOC 2016-11-26 13:59:45 +00:00
amd64 Add accessors for available x86 Debug Registers 2016-11-27 14:49:21 +00:00
amiga wscons and Xorg support for Tseng ET4000/W32 based boards (grf6). 2016-11-04 18:06:08 +00:00
amigappc
arc add isa_intr_establish_xname() to MD isa headers so that it can be used 2016-10-18 22:04:33 +00:00
arm * Fix compile error. 2016-11-25 05:03:36 +00:00
atari add isa_intr_establish_xname() to MD isa headers so that it can be used 2016-10-18 22:04:33 +00:00
bebox mention PAX_SEGVGUARD dependency on FILEASSOC 2016-11-26 13:59:45 +00:00
cats
cesfic
cobalt s/COMPAT_NETBSD64/COMPAT_NETBSD32/ so userland works 2016-11-22 09:21:51 +00:00
dreamcast
emips One more move of bufq_free() to outside of critical section. 2016-11-20 03:30:11 +00:00
epoc32
evbarm mention PAX_SEGVGUARD dependency on FILEASSOC 2016-11-26 13:59:45 +00:00
evbarm64 mention PAX_SEGVGUARD dependency on FILEASSOC 2016-11-26 13:59:45 +00:00
evbcf
evbmips Rin Okuyama in PR port-evbmips/51563: wait for console input after halting 2016-10-20 07:26:03 +00:00
evbppc Give the ramdisk a bit more space, evbppc64 for clang is running out. 2016-11-13 22:14:44 +00:00
evbsh3
evbsh5
ews4800mips
hp300
hpc
hpcarm
hpcmips add isa_intr_establish_xname() to MD isa headers so that it can be used 2016-10-18 22:04:33 +00:00
hpcsh
hppa fix register names 2016-11-25 02:27:43 +00:00
i386 Add accessors for available x86 Debug Registers 2016-11-27 14:49:21 +00:00
ia64 For ski, break into debugger instead of exiting 2016-11-22 22:50:32 +00:00
ibmnws Added MSI/MSI-X and interrupt_distribute(9) support for powerpc. 2016-10-19 00:08:41 +00:00
iyonix mention PAX_SEGVGUARD dependency on FILEASSOC 2016-11-26 13:59:45 +00:00
landisk mention PAX_SEGVGUARD dependency on FILEASSOC 2016-11-26 13:59:45 +00:00
luna68k Add a missing newline in help message. 2016-11-25 17:37:04 +00:00
m68k
mac68k
macppc add driver for Permedia 3 based graphics devices 2016-11-20 16:55:18 +00:00
mips 1TB is enough UVA for anyone... plus not all cpus can support more. 2016-11-22 11:01:50 +00:00
mipsco actually correct tyop now... 2016-11-14 19:24:23 +00:00
mmeye
mvme68k
mvmeppc Added MSI/MSI-X and interrupt_distribute(9) support for powerpc. 2016-10-19 00:08:41 +00:00
netwinder
news68k
newsmips actually correct tyop now... 2016-11-14 19:24:23 +00:00
next68k
ofppc Added MSI/MSI-X and interrupt_distribute(9) support for powerpc. 2016-10-19 00:08:41 +00:00
or1k
playstation2
pmax mention PAX_SEGVGUARD dependency on FILEASSOC 2016-11-26 13:59:45 +00:00
powerpc Added MSI/MSI-X and interrupt_distribute(9) support for powerpc. 2016-10-19 00:08:41 +00:00
prep mention PAX_SEGVGUARD dependency on FILEASSOC 2016-11-26 13:59:45 +00:00
riscv
rs6000
sandpoint PCI MSI/MSI-X manipulation stub functions are not provided as weak alias. 2016-11-26 15:03:23 +00:00
sbmips
sgimips KASSERT that MIPS_SR_KX is set when entering interrupt handler in !o32 2016-11-17 23:46:52 +00:00
sh3 * Split sys/kern/sys_process.c into three parts: 2016-11-02 00:11:59 +00:00
sh5
shark Fix regisers typo 2016-10-20 09:53:07 +00:00
sparc mention PAX_SEGVGUARD dependency on FILEASSOC 2016-11-26 13:59:45 +00:00
sparc64 mention PAX_SEGVGUARD dependency on FILEASSOC 2016-11-26 13:59:45 +00:00
sun2
sun3
sun68k
usermode
vax
x68k
x86 Add accessors for available x86 Debug Registers 2016-11-27 14:49:21 +00:00
xen Add accessors for available x86 Debug Registers 2016-11-27 14:49:21 +00:00
zaurus
Makefile
README

$NetBSD: README,v 1.62 2014/03/31 11:25:48 martin Exp $

acorn26	arm	20000509	Acorn ARM2- and ARM3-based machines
acorn32	arm	20011118	Acorn computers Ltd. ARM 6/7/SA based machines
algor	mipsel,mips64el	20010528	Algorithmics, Ltd. MIPS evaluation boards
alpha	alpha	19950213	Compaq (formerly Digital Equipment Corp.) Alpha
amd64	x86_64	20010619	AMD's x86 64 bit architecture
amiga	m68k	19930902	Commodore et al. Amiga
amigappc	powerpc	20000525	Phase 5 Amiga
arc	mipsel,mips64el	20000123	MIPS Advanced Risc Computing spec machines
atari	m68k	19950326	Atari TT30, Falcon, and Hades
bebox	powerpc	19971014	Be Inc. BeBox
cats	arm	19981005	Chalice Technologies, CATS motherboard
cesfic	m68k	20010514	FIC8234 VME processor board
cobalt	mipsel,mips64el	20000319	Cobalt Networks Microservers
dreamcast	sh3el	20010107	SEGA Dreamcast
emips	mipseb	20110126	Machines based on Extensible MIPS
epoc32	arm	20130502	32bit EPOC OS machines
evbarm	armeb	20010905	ARM-based eval boards
evbmips	mipseb,mipsel,mips64eb,mips64el	20020307	MIPS-based eval boards
evbppc	powerpc,powerpc64	20021209	PowerPC-based eval boards
evbsh3	sh3eb,sh3el	20010206	Hitachi SuperH(TM) sh3 and sh4 eval boards
ews4800mips	mipseb	20051229	NEC's MIPS based EWS4800 workstations
hp300	m68k	19930512	Hewlett Packard 300- and 400-series machines
hppa	hppa	20020606	Hewlett Packard 700-series machines
hpcarm	arm	20010220	ARM based handheld PCs
hpcmips	mipsel	19990925	MIPS based handheld PCs
hpcsh	sh3el	20010117	Hitachi SuperH(TM) based handheld PCs
i386	i386	19930321	Intel/AMD etc. x86 processor line
ia64	ia64	00000000	Intel Itanium/Itanium2 processor based workstations
ibmnws	powerpc	00000000	IBM Network Station Thin Clients
iyonix	arm	20040713	Castle Technology xscale based workstations
landisk	sh3el	20060901	SH4 processor based NAS appliances by I-O DATA
luna68k	m68k	20000105	LUNA product line of OMRON Tateisi Electronics
mac68k	m68k	19930929	Apple Macintosh
macppc	powerpc,powerpc64	19980515	Apple Power Macintosh and clones
mipsco	mipseb	20000812	MIPS Corp Magnum 3000 computers
mmeye	sh3eb	19990913	Hitachi SuperH(TM) computer controlled camera
mvme68k	m68k	19950725	Motorola's VMEbus 68K based single board computers
mvmeppc	powerpc	20020227	Motorola's PowerPC machines running older PPCBUG
netwinder	arm	20010609	StrongARM based Netwinder machines
news68k	m68k	19991209	Sony's m68k based NET WORK STATION
newsmips	mipseb	19980218	Sony's MIPS based NET WORK STATION
next68k	m68k	19980609	NeXT Computer's cubes and slabs
ofppc	powerpc,powerpc64	19980528	Open Firmware based PowerPC machines
playstation2	mipsel	20011016	Sony PlayStation 2
pmax	mipsel,mips64el	19931012	Digital Equipment Corp. MIPS based machines
prep	powerpc	20000229	PowerPC Reference Platform machines
rs6000	powerpc	20071217	MCA-based IBM RS/6000 wokstations
sandpoint	powerpc	20010211	Motorola Sandpoint based NAS systems
sbmips	mipseb,mipsel,mips64eb,mips64el	20020306	Broadcom's SiByte processor evaluation boards
sgimips	mipseb,mips64eb	20000614	MIPS based Silicon Graphics machines
shark	arm	19960131	Digital Network Appliance Reference Design ("Shark")
sparc	sparc	19931002	Sun Microsystems SPARC (sun4, sun4c, sun4m) 32 bit machines
sparc64	sparc64/sparc	19980620	Sun Microsystems UltraSPARC 64 bit machines
sun2	m68000	20010328	Sun m68010 based machines
sun3	m68k	19930625	Sun m680[23]0 based machines
vax	vax	19940802	Digital Equipment Corp. VAX machines
x68k	m68k	19960505	Sharp X68000, X68030
xen	xen	20040311	Xen virtual machine monitor
zaurus	arm	20061217	Sharp Zaurus C7x0/860/1000/3x00 PDAs

Generic cpu features shared among multiple ports
arm:		ARM CPU based platform files
hppa:		Hewlett Packard PA-RISC CPU based platform files
m68k:		Motorola 680x0 CPU based platform files
mips:		MIPS CPU based platform files
powerpc:	PowerPC CPU based platform files
sh3:		Hitachi SuperH(TM) sh3 and sh4 CPU based platform files
sparc:		Sun Microsystems SPARC(TM) CPU based platform files
x86:		Intel x86 based platform files.

Generic architectural features shared among multiple ports
hpc:		Handheld PC reference platform files
sun68k:		Sun Microsystems Motorola 680x0 CPU based platform files

Single port cpu families
alpha:		Digital Equipment Alpha processor
ia64:		Intel Itanium/Itanium2 processor