opnsense-src/sys/sys
Marcel Moolenaar f2c49dd248 Revamp of the syscall path, exception and context handling. The
prime objectives are:
o  Implement a syscall path based on the epc inststruction (see
   sys/ia64/ia64/syscall.s).
o  Revisit the places were we need to save and restore registers
   and define those contexts in terms of the register sets (see
   sys/ia64/include/_regset.h).

Secundairy objectives:
o  Remove the requirement to use contigmalloc for kernel stacks.
o  Better handling of the high FP registers for SMP systems.
o  Switch to the new cpu_switch() and cpu_throw() semantics.
o  Add a good unwinder to reconstruct contexts for the rare
   cases we need to (see sys/contrib/ia64/libuwx)

Many files are affected by this change. Functionally it boils
down to:
o  The EPC syscall doesn't preserve registers it does not need
   to preserve and places the arguments differently on the stack.
   This affects libc and truss.
o  The address of the kernel page directory (kptdir) had to
   be unstaticized for use by the nested TLB fault handler.
   The name has been changed to ia64_kptdir to avoid conflicts.
   The renaming affects libkvm.
o  The trapframe only contains the special registers and the
   scratch registers. For syscalls using the EPC syscall path
   no scratch registers are saved. This affects all places where
   the trapframe is accessed. Most notably the unaligned access
   handler, the signal delivery code and the debugger.
o  Context switching only partly saves the special registers
   and the preserved registers. This affects cpu_switch() and
   triggered the move to the new semantics, which additionally
   affects cpu_throw().
o  The high FP registers are either in the PCB or on some
   CPU. context switching for them is done lazily. This affects
   trap().
o  The mcontext has room for all registers, but not all of them
   have to be defined in all cases. This mostly affects signal
   delivery code now. The *context syscalls are as of yet still
   unimplemented.

Many details went into the removal of the requirement to use
contigmalloc for kernel stacks. The details are mostly CPU
specific and limited to exception_save() and exception_restore().
The few places where we create, destroy or switch stacks were
mostly simplified by not having to construct physical addresses
and additionally saving the virtual addresses for later use.

Besides more efficient context saving and restoring, which of
course yields a noticable speedup, this also fixes the dreaded
SMP bootup problem as a side-effect. The details of which are
still not fully understood.

This change includes all the necessary backward compatibility
code to have it handle older userland binaries that use the
break instruction for syscalls. Support for break-based syscalls
has been pessimized in favor of a clean implementation. Due to
the overall better performance of the kernel, this will still
be notived as an improvement if it's noticed at all.

Approved by: re@ (jhb)
2003-05-16 21:26:42 +00:00
..
_iovec.h Move the typedef for size_t into _iovec.h, so that size_t is available 2003-02-26 20:16:58 +00:00
_label.h Rename MAC_MAX_POLICIES to MAC_MAX_SLOTS, since the variables and 2003-05-08 19:49:42 +00:00
_lock.h Renamed the idempotency identifier to match the file name. 2002-06-07 14:37:09 +00:00
_mutex.h Save 16 bytes per mutex if MUTEX_PROFILING is not defined. 2002-12-29 11:14:41 +00:00
_semaphore.h Add the rest of the kernel support for the sem_ API in kern/uipc_sem.c. 2002-09-19 00:43:32 +00:00
_sigset.h Split 4.x and 5.x signal handling so that we can keep 4.x signal 2002-10-25 19:10:58 +00:00
_timespec.h Simplify struct __timespec, fix style bugs, add an XXX comment. 2003-02-26 16:50:01 +00:00
_timeval.h Move struct timeval to its own header so that it can be shared between 2002-12-31 04:08:41 +00:00
_types.h Move details of dev_t (and udev_t) to <sys/_types.h>. 2003-03-28 15:27:30 +00:00
aac_ioctl.h Bring the aac driver *much* closer to style(9). 2001-09-05 20:43:02 +00:00
acct.h Move details of dev_t (and udev_t) to <sys/_types.h>. 2003-03-28 15:27:30 +00:00
acl.h Provide prototypes for new ACL system calls to manipulate ACLs "by 2002-12-29 20:30:00 +00:00
agpio.h Document a few acronyms. 2003-02-08 20:42:26 +00:00
aio.h o Add missing synchronization (splnet()/splx()) in aio_free_entry(). 2002-01-06 21:03:39 +00:00
alq.h - Export the alq daemon thread pointer. 2002-09-26 07:38:56 +00:00
assym.h
ata.h Add function to add spare disk to raid. 2003-05-02 12:39:34 +00:00
bio.h Retire the experimental bio_taskqueue(), it was not quite as usable as 2003-04-12 09:13:01 +00:00
bitstring.h
blist.h Remove all use of the LOG2() macro/inline, undoing some non-optimal cruft 2003-01-11 01:09:51 +00:00
buf.h - Add a lock for protecting against msleep(bp, ...) wakeup(bp) races. 2003-03-13 07:31:45 +00:00
bus.h Create a new function, device_is_attached(), that is like 2003-04-21 18:19:08 +00:00
bus_dma.h Change the operation parameter of bus_dmamap_sync() from an 2003-04-10 23:03:33 +00:00
callout.h Remove __P 2002-03-19 20:18:42 +00:00
ccdvar.h Centralize the devstat handling for all GEOM disk device drivers 2003-03-08 08:01:31 +00:00
cdefs.h Backed out rev.1.57. This restores format checking functions like 2003-04-18 18:59:34 +00:00
cdio.h Make bitfields plain old u_int. u_int16_t makes no sense. 2003-04-30 12:07:32 +00:00
cdrio.h * Add CDRIOC{READ,WRITE}SPEED ioctls to cd(4). Units are in KB/sec. 2002-10-18 22:03:39 +00:00
chio.h
clist.h
clock.h Add a generic implementation of inittodr() and resettodr(), as well as 2002-04-04 23:39:10 +00:00
condvar.h Part 1 of KSE-III 2002-06-29 17:26:22 +00:00
conf.h - Add vm_paddr_t, a physical address type. This is required for systems 2003-03-25 00:07:06 +00:00
cons.h Change the console interface to pass a "struct consdev *" instead of a 2003-02-20 20:54:45 +00:00
consio.h 1. Allow information about current history size be retrieved using ioctl(2); 2002-08-19 16:32:09 +00:00
copyright.h We've had something like this file since 1992, so therefore this file 2003-01-07 04:37:40 +00:00
ctype.h Resolve conflicts arising from the ACPI CA 20021118 import. 2002-11-27 18:09:20 +00:00
dataacq.h
device_port.h
devicestat.h Make devstat_new_entry() take a const void * rather than const char * 2003-03-18 07:52:59 +00:00
digiio.h Add DIGIIO_SETALTPIN and DIGIIO_GETALTPIN ioctl values 2001-06-20 14:51:58 +00:00
dir.h
dirent.h Fix namespace issues by using the relatively new visibility 2002-09-10 18:12:16 +00:00
disk.h I think the divorce successed, so stop #including <geom/geom_disk.h> 2003-04-01 18:55:04 +00:00
disklabel.h Make bsd_disklabel_le_enc calculate the checksum and fill it in. 2003-05-02 22:46:13 +00:00
diskmbr.h Add definitions for location of the magic sequence and the length 2003-04-13 21:52:22 +00:00
diskpc98.h Remove DIOCGPC98 ioctl. 2003-05-01 14:40:16 +00:00
dkstat.h #include <sys/resource.h> to limit ports damage. 2003-05-07 15:26:43 +00:00
domain.h Remove __P 2002-03-19 20:18:42 +00:00
dvdio.h Update header. 2002-03-04 21:08:35 +00:00
elf32.h Move the definition of ElfN_Hashelt to common headers. The only platform 2002-05-30 08:32:18 +00:00
elf64.h Move the definition of ElfN_Hashelt to common headers. The only platform 2002-05-30 08:32:18 +00:00
elf_common.h - Call a SHT_REL 'relocation section' rather than 2002-08-11 21:07:50 +00:00
elf_generic.h Infrastructure tweaks to allow having both an Elf32 and an Elf64 executable 2002-07-20 02:56:12 +00:00
endian.h Pointy hat commit: 2003-04-03 11:32:01 +00:00
errno.h Copyin and copyout are only possible from a process-native thread, 2002-10-07 06:25:26 +00:00
event.h Tweak the definition of the EV_SET macro so that it evaluates each 2003-02-02 19:39:51 +00:00
eventhandler.h Oops, SHUTDOWN_PRI_LAST should be EVENTHANDLER_PRI_LAST, not 2003-03-24 21:24:37 +00:00
eventvar.h
exec.h Use __CONCAT and __XSTRING when concatenating or stringifying arguments to 2003-01-04 08:17:27 +00:00
extattr.h Prototypes for new link extended attribute calls. Sync to MAC tree. 2002-10-09 21:48:57 +00:00
fbio.h Turn on TGA support. 2002-04-13 22:34:16 +00:00
fcntl.h o Add typedefs for mode_t, off_t, pid_t rather than including 2002-09-17 22:22:50 +00:00
fdcio.h Long promised major enhancement set for the floppy disk driver: 2001-12-15 19:09:04 +00:00
file.h Do not allow kqueues to be passed via unix domain sockets. 2003-02-15 06:04:55 +00:00
filedesc.h Fix LOR with PROC/filedesc. Introduce fdesc_mtx that will be used as a 2003-02-15 05:52:56 +00:00
filio.h
fnv_hash.h
gmon.h Reserved one of the spare fields in struct gmon to record the history 2002-02-21 05:52:49 +00:00
gpt.h o Include <sys/uuid.h>. This avoids that applications such as 2002-11-10 20:13:58 +00:00
iconv.h Convert GNU variadic macros to the ISO 9X variety. 2002-07-15 13:34:50 +00:00
imgact.h Bring in two sets of changes: 2002-11-05 17:51:56 +00:00
imgact_aout.h Forward declare struct vnode so that <sys/vnode.h> or some other header 2002-09-05 07:54:03 +00:00
imgact_elf.h - Provide backwards compatibility for kern.fallback_elf_brand. 2003-01-05 03:48:14 +00:00
inflate.h Forgot one more instance of my old email address. 2002-03-26 08:29:40 +00:00
interrupt.h Introduce a new taskqueue that runs completely free of Giant, and in 2003-02-26 03:15:42 +00:00
ioccom.h I've fixed the X11 port, so I can remove the (ioctl) hack. 2002-04-10 04:53:37 +00:00
ioctl.h Hide GCCisms in the non-GCC case. 2002-02-26 07:44:03 +00:00
ioctl_bt848.h
ioctl_compat.h
ioctl_meteor.h
ipc.h It is possible for an active aio to prevent shared memory from being 2003-01-13 23:04:32 +00:00
jail.h o In struct prison, add an allprison linked list of prisons (protected 2003-04-09 02:55:18 +00:00
joystick.h Fix typo in the BSD copyright: s/withough/without/ 2002-06-02 20:05:59 +00:00
jumbo.h Fix 2 vm_offset_t -> vm_paddr_t missed in previous commit. 2003-03-25 01:47:29 +00:00
kbio.h
kenv.h Rework the kernel environment subsystem. We now convert the static 2002-04-17 13:06:36 +00:00
kernel.h Split the global timezone structure into two integer fields to 2003-02-03 19:49:35 +00:00
kerneldump.h Add kernel dump support, based on the ia64 version (which was committed 2002-10-20 17:03:15 +00:00
kobj.h Convert hit and miss counters to unsigned values. Surely negative values 2002-06-10 22:40:26 +00:00
kse.h Introduce two flags to control upcall behaviour: 2003-04-21 07:27:59 +00:00
kthread.h Some kernel threads try to do significant work, and the default KSTACK_PAGES 2002-10-02 07:44:29 +00:00
ktr.h Retire the KTR_LOCKMGR bit and use it to log eventhandler messages 2003-03-11 20:07:22 +00:00
ktrace.h Add a new userland-visible ktrace flag KTR_DROP and an internal ktrace flag 2003-03-13 18:31:15 +00:00
libkern.h Pass a malloc type into the libkern strdup() implementation explicitly, 2003-02-25 22:11:39 +00:00
limits.h Style fixes. 2003-05-04 22:13:04 +00:00
linedisc.h - Add vm_paddr_t, a physical address type. This is required for systems 2003-03-25 00:07:06 +00:00
link_aout.h Repo copy link.h to sys/link_elf.h and sys/link_aout.h since they are 2002-08-22 20:35:23 +00:00
link_elf.h Implement dlinfo() function. 2003-02-13 17:47:44 +00:00
linker.h Slight reorg and added AMD64 support. A couple of the MODINFOMD_* values 2003-05-01 03:31:18 +00:00
linker_set.h Add a __section(x) macro as well. Use this in linker_set.h. ie: 2002-09-23 06:11:29 +00:00
lock.h A small overhaul of witness: 2003-03-04 20:56:39 +00:00
lockf.h Remove __P 2002-03-19 20:18:42 +00:00
lockmgr.h - Add an interlock argument to BUF_LOCK and BUF_TIMELOCK. 2003-02-25 03:37:48 +00:00
mac.h Update NAI copyright to 2003, missed in earlier commits and merges. 2003-04-18 19:57:37 +00:00
mac_policy.h Update NAI copyright to 2003, missed in earlier commits and merges. 2003-04-18 19:57:37 +00:00
malloc.h - Add vm_paddr_t, a physical address type. This is required for systems 2003-03-25 00:07:06 +00:00
mbuf.h Redefine M_FREELIST to be 0x8000; 0x4000 conflicted with two other 2003-05-09 02:15:52 +00:00
mchain.h Some style fixes. 2003-02-21 16:24:49 +00:00
md4.h
md5.h Oops, this should have been part of my previous commit. 2002-06-24 14:18:39 +00:00
mdioctl.h Add a couple of undocumented test options to MD(4) to aid in regression 2003-04-09 11:59:29 +00:00
memrange.h Some BIOSs are using MTRR values that are only documented under NDA 2002-09-15 15:07:55 +00:00
mman.h Add a facility allowing processes to inform the VM subsystem they are 2003-03-31 21:09:57 +00:00
module.h - Lock down the ``module'' structure by adding an SX lock that is used by 2002-03-18 07:45:30 +00:00
mount.h Adjust the number of vnodes scanned by vlrureclaim() according to the 2003-03-26 22:15:58 +00:00
mouse.h Minor changes: 2002-03-24 03:07:07 +00:00
msg.h Add const qualifier to data argument for msgsnd. 2003-01-26 20:09:34 +00:00
msgbuf.h Add a checksum to the kernel message buffer, and update it every 2003-03-28 02:50:10 +00:00
mtio.h Make the mtio data structures explicitly sized. 2002-05-14 07:30:13 +00:00
mutex.h Remove unused mtx_lock_giant(), mtx_unlock_giant(), related globals 2003-03-23 11:26:11 +00:00
namei.h Remove four members of struct nameidata which have been commented 2003-01-13 08:49:36 +00:00
nlist_aout.h Pad after "char *n_name;" in the !_AOUT_INCLUDE_ case so that struct nlist 2002-09-05 08:03:02 +00:00
param.h Per previous announcement, remove the old version of the rc system. 2003-05-02 05:27:35 +00:00
pciio.h style(9) the structure definitions. 2001-09-05 01:22:14 +00:00
pcpu.h Unbreak the KSE code. Keep track of zobie threads using the Per-CPU storage 2002-12-10 02:33:45 +00:00
pioctl.h Kernel modifications necessary to allow to follow fork()ed children. 2002-08-04 01:07:02 +00:00
pipe.h Move to a nested include of _label.h instead of mac.h in sys/sys/*.h 2002-08-14 01:04:43 +00:00
poll.h Reconnect a comment with its code. 2002-07-10 04:47:25 +00:00
posix4.h Back out M_* changes, per decision of the TRB. 2003-02-19 05:47:46 +00:00
power.h Very minor warns fix. Add a declaration for an unused parameter. 2002-07-15 14:06:03 +00:00
priority.h style(9) the structure definitions. 2001-09-05 01:22:14 +00:00
proc.h Revamp of the syscall path, exception and context handling. The 2003-05-16 21:26:42 +00:00
procfs.h Use explicit sizes for the prpsinfo command length string so that 2001-08-16 08:35:51 +00:00
protosw.h Correct typos, mostly s/ a / an / where appropriate. Some whitespace cleanup, 2003-01-01 18:49:04 +00:00
ptio.h
ptrace.h Implement PT_IO (read / write arbitrary amounts of data or text). 2002-03-16 02:40:02 +00:00
queue.h Add a macro for SLIST traversal 'SLIST_FOREACH_PREVPTR', 2002-08-05 05:18:43 +00:00
random.h add RANDOM_PURE for use by crypto drivers that harvest data from h/w RNG's 2002-10-04 20:34:08 +00:00
reboot.h Libdisk does not need to include <sys/diskslice.h> any more. 2003-04-04 16:35:16 +00:00
regression.h Remove __P 2002-03-19 20:18:42 +00:00
resource.h Move cp_time[CPUSTATES] and related #defines to <sys/resource.h> 2003-02-16 13:30:29 +00:00
resourcevar.h Use u_int for the struct uidinfo reference count rather than u_short; 2003-04-20 13:54:04 +00:00
rman.h Implement rman_get_device 2003-02-12 07:00:59 +00:00
rtprio.h Remove __P 2002-03-19 20:18:42 +00:00
runq.h Make the run queue parameters machine dependent. Optimize 64 bit 2002-05-25 01:12:23 +00:00
sbuf.h Add the new function "sbuf_done()" which returns non-zero if the sbuf is 2002-10-04 09:58:17 +00:00
sched.h - Adjust sched hooks for fork and exec to take processes as arguments instead 2003-04-11 03:39:07 +00:00
select.h Add complete struct timeval by including <sys/_timeval.h>. 2002-12-31 04:13:50 +00:00
selinfo.h Remove __P 2002-03-19 20:18:42 +00:00
sem.h Bring semop() closer the the opengroup standards. 2003-01-25 21:27:37 +00:00
sema.h Added used includes. <sys/_lock.h> is a prerequisite for <sys/_mutex.h>, 2001-10-10 10:26:07 +00:00
semaphore.h o Adjust the SEM_VALUE_MAX macro so that <machine/limits.h> isn't 2002-10-04 21:31:33 +00:00
shm.h Bring shm functions closer the the opengroup standards. 2003-01-25 21:33:05 +00:00
sigio.h When compiling the kernel do not implicitly include filedesc.h from proc.h, 2003-01-01 01:56:19 +00:00
signal.h - According to mike@FreeBSD.org SIGTHR should be hiden by 2003-03-31 23:31:50 +00:00
signalvar.h Add <sys/queue.h> to unbreak world. 2003-05-14 15:00:24 +00:00
smp.h Forward declare struct thread. 2002-05-20 16:11:38 +00:00
snoop.h Declare the snp ioctl()s to work on udev_t, since that is what they 2002-11-11 10:45:31 +00:00
socket.h Finish driving a stake through the heart of netns and the associated 2003-03-05 19:24:24 +00:00
socketvar.h Pass the vm_page's address to sf_buf_alloc(); map the vm_page as part 2003-03-29 06:14:14 +00:00
sockio.h Style consistency fix for MAC ioctls added previously. 2002-02-10 16:55:35 +00:00
soundcard.h My previous commit broke builds for restricted namespaces. Add 2003-05-04 05:57:50 +00:00
stat.h Move details of dev_t (and udev_t) to <sys/_types.h>. 2003-03-28 15:27:30 +00:00
statvfs.h o Merge <machine/ansi.h> and <machine/types.h> into a new header 2002-08-21 16:20:02 +00:00
stddef.h Add the sys/stddef.h header, so that we can have ptrdiff_t 2002-11-13 15:14:57 +00:00
stdint.h o Merge <machine/ansi.h> and <machine/types.h> into a new header 2002-08-21 16:20:02 +00:00
sun_disklabel.h Introduce a #define for the length of the bootloader code. 2003-04-23 08:04:30 +00:00
sx.h - Make this compile if INVARIANTS support is not enabled. 2002-04-02 18:18:56 +00:00
syscall.h Regen. 2003-04-09 02:57:29 +00:00
syscall.mk Regen. 2003-04-09 02:57:29 +00:00
syscallsubr.h Split sendit into two parts. The first part, still called sendit, that 2003-05-05 20:33:38 +00:00
sysctl.h Sysctl treats long' and unsigned long' differently - fix a comment. 2003-03-28 14:17:17 +00:00
sysent.h SCARGS removal take II. 2002-12-14 01:56:26 +00:00
syslimits.h Add the POSIX sanctioned "LOGIN_NAME_MAX" -- Maximum length of a login name. 2003-01-06 04:33:47 +00:00
syslog.h o Merge <machine/ansi.h> and <machine/types.h> into a new header 2002-08-21 16:20:02 +00:00
sysproto.h Regen. 2003-04-09 02:57:29 +00:00
systm.h Define ovbcopy() as a macro which expands to the equivalent bcopy() call, 2003-04-04 17:29:55 +00:00
taskqueue.h Introduce a new taskqueue that runs completely free of Giant, and in 2003-02-26 03:15:42 +00:00
termios.h Remove __P 2002-03-19 20:18:42 +00:00
thr.h - Add two files to support the thr threading interface. 2003-04-01 00:30:30 +00:00
tiio.h At long last, commit the zero copy sockets code. 2002-06-26 03:37:47 +00:00
time.h Implement CLOCK_MONOTONIC. 2003-02-23 10:18:31 +00:00
timeb.h Remove __P 2002-03-19 20:18:42 +00:00
timepps.h Brucifixion ? Yes, out that door, row on the left, one patch each. 2002-04-30 19:48:45 +00:00
timers.h
times.h o Merge <machine/ansi.h> and <machine/types.h> into a new header 2002-08-21 16:20:02 +00:00
timespec.h o Merge <machine/ansi.h> and <machine/types.h> into a new header 2002-08-21 16:20:02 +00:00
timetc.h Convert the SMP_TSC kernel option into a loader tunable. Also enable 2003-04-10 23:07:24 +00:00
timex.h Removed unused forward struct declaration. 2002-04-28 09:51:45 +00:00
tree.h Import OpenBSD's <sys/tree.h>, needed by OpenSSH. 2002-06-23 14:38:51 +00:00
tty.h Raise the default value of TTYHOG from 1 kB to 8 kB. Since TTYHOG is 2003-03-05 08:17:10 +00:00
ttychars.h
ttycom.h
ttydefaults.h
ttydev.h Add B921600 (yes, some serial ports can do this, but generic sio not support 2001-06-20 03:26:41 +00:00
types.h Move details of dev_t (and udev_t) to <sys/_types.h>. 2003-03-28 15:27:30 +00:00
ucontext.h Add an argument to get_mcontext() which specified whether the 2003-04-25 01:50:30 +00:00
ucred.h o Fix a comment. 2003-03-27 11:35:45 +00:00
uio.h Remove ENABLE_VFS_IOOPT. It is a long unfinished work-in-progress. 2003-03-06 03:41:02 +00:00
umtx.h - Add an api for doing smp safe locks in userland. 2003-04-01 01:10:42 +00:00
un.h o Merge <machine/ansi.h> and <machine/types.h> into a new header 2002-08-21 16:20:02 +00:00
unistd.h Update limits and configuration parameters for 1003.1/TC1/D6. 2002-10-27 18:03:02 +00:00
unpcb.h Remove vestiges of no longer needed unp_rvnode field. 2003-02-06 01:34:43 +00:00
user.h - Merge struct procsig with struct sigacts. 2003-05-13 20:36:02 +00:00
utsname.h
uuid.h Wrap function prototype declarations in __BEGIN_DECLS to do the right thing 2002-11-05 10:57:53 +00:00
vmmeter.h - It's more accurate to say that vm_paging_needed() returns TRUE 2003-02-02 07:16:40 +00:00
vnode.h Remove an unused declaration. 2003-04-26 08:36:06 +00:00
wait.h Remove the deprecated 4.2/4.3BSD wait union. 2002-06-05 02:21:01 +00:00
watchdog.h Add header file defining a simple, yet expressive watchdog interface 2003-02-27 21:07:36 +00:00
xrpuio.h