freebsd-dev/sys/kern
Konstantin Belousov afe1a68827 Reorganize syscall entry and leave handling.
Extend struct sysvec with three new elements:
sv_fetch_syscall_args - the method to fetch syscall arguments from
  usermode into struct syscall_args. The structure is machine-depended
  (this might be reconsidered after all architectures are converted).
sv_set_syscall_retval - the method to set a return value for usermode
  from the syscall. It is a generalization of
  cpu_set_syscall_retval(9) to allow ABIs to override the way to set a
  return value.
sv_syscallnames - the table of syscall names.

Use sv_set_syscall_retval in kern_sigsuspend() instead of hardcoding
the call to cpu_set_syscall_retval().

The new functions syscallenter(9) and syscallret(9) are provided that
use sv_*syscall* pointers and contain the common repeated code from
the syscall() implementations for the architecture-specific syscall
trap handlers.

Syscallenter() fetches arguments, calls syscall implementation from
ABI sysent table, and set up return frame. The end of syscall
bookkeeping is done by syscallret().

Take advantage of single place for MI syscall handling code and
implement ptrace_lwpinfo pl_flags PL_FLAG_SCE, PL_FLAG_SCX and
PL_FLAG_EXEC. The SCE and SCX flags notify the debugger that the
thread is stopped at syscall entry or return point respectively.  The
EXEC flag augments SCX and notifies debugger that the process address
space was changed by one of exec(2)-family syscalls.

The i386, amd64, sparc64, sun4v, powerpc and ia64 syscall()s are
changed to use syscallenter()/syscallret(). MIPS and arm are not
converted and use the mostly unchanged syscall() implementation.

Reviewed by:	jhb, marcel, marius, nwhitehorn, stas
Tested by:	marcel (ia64), marius (sparc64), nwhitehorn (powerpc),
	stas (mips)
MFC after:	1 month
2010-05-23 18:32:02 +00:00
..
bus_if.m Add a facility for associating optional descriptions with active interrupt 2009-10-15 14:54:35 +00:00
clock_if.m
cpufreq_if.m
device_if.m
genassym.sh
imgact_aout.c Reorganize syscall entry and leave handling. 2010-05-23 18:32:02 +00:00
imgact_elf32.c
imgact_elf64.c
imgact_elf.c Don't leak core_buf or gzfile if doing a compressed core file and we 2010-04-30 03:13:24 +00:00
imgact_gzip.c
imgact_shell.c Decontextualize the couplet VOP_GETATTR / VOP_SETATTR as the passed thread 2008-08-28 15:23:18 +00:00
inflate.c
init_main.c Reorganize syscall entry and leave handling. 2010-05-23 18:32:02 +00:00
init_sysent.c Regenerate 2009-10-27 11:01:15 +00:00
kern_acct.c Do not use casts (int *)0 and (struct thread *)0 for the arguments of 2009-06-16 15:13:45 +00:00
kern_alq.c - Rework the underlying ALQ storage to be a circular buffer, which amongst other 2010-04-26 13:48:22 +00:00
kern_clock.c getblk lockmgr is mostly used as a msleep() and may lead too easilly to 2010-04-19 23:40:46 +00:00
kern_condvar.c Remove unused variables p' and unneeded assignments of rval'. 2009-02-26 13:00:13 +00:00
kern_conf.c Add MAKEDEV_NOWAIT flag to make_dev_credf(9), to create a device node 2010-05-06 19:22:50 +00:00
kern_cons.c Allow multiple console devices per driver without insane code duplication. 2009-08-24 10:53:30 +00:00
kern_context.c In r197963, a race with thread being selected for signal delivery 2009-10-27 10:47:58 +00:00
kern_cpu.c Free allocated sbufs before returning ENOMEM. 2010-01-08 22:58:50 +00:00
kern_cpuset.c Another nit that both I and ispell missed. 2009-10-26 18:32:06 +00:00
kern_ctf.c Add the CTF source file which gets shared with link_elf.c and link_elf_obj.c. 2008-05-23 03:04:27 +00:00
kern_descrip.c Remove one zero from the double-0. 2010-04-23 14:32:58 +00:00
kern_dtrace.c Remove code that isn't required. It actually breaks the case where KDTRACE_HOOKS 2008-06-16 04:44:29 +00:00
kern_environment.c Merge change r198561 from projects/mips to head: 2010-01-10 22:34:18 +00:00
kern_event.c Defer freeing a kevent list until after dropping kqueue locks. 2010-03-30 18:31:55 +00:00
kern_exec.c Reorganize syscall entry and leave handling. 2010-05-23 18:32:02 +00:00
kern_exit.c Let access overriding to TTYs depend on the cdev_priv, not the vnode. 2009-12-19 18:42:12 +00:00
kern_fail.c Remove extraneous semicolons, no functional changes. 2010-01-07 21:01:37 +00:00
kern_fork.c Reintroduce the r196640, after fixing the problem with my testing. 2009-09-01 11:41:51 +00:00
kern_gzio.c Do not set IO_NODELOCKED while writing to vnodes as our consumers 2010-04-30 03:10:53 +00:00
kern_idle.c Split P_NOLOAD into a per-thread flag (TDF_NOLOAD). 2009-11-03 16:46:52 +00:00
kern_intr.c KASSERT that return value of interrupt filter complies with contract 2010-01-27 09:59:08 +00:00
kern_jail.c Provide groundwork for 32-bit binary compatibility on non-x86 platforms, 2010-03-11 14:49:06 +00:00
kern_kthread.c Allow a const char * to be passed as the process name to kproc_kthread_add() 2010-05-21 17:14:36 +00:00
kern_ktr.c Change the semantics of the debug.ktr.alq_enable control so that when you 2010-04-14 21:42:29 +00:00
kern_ktrace.c - Fix several off-by-one errors when using MAXCOMLEN. The p_comm[] and 2009-10-23 15:14:54 +00:00
kern_linker.c - Unbreak build with KLD_DEBUG defined 2009-11-17 21:56:12 +00:00
kern_lock.c Fix typos. 2010-01-07 01:24:09 +00:00
kern_lockf.c In lf_iteratelocks_vnode, increment state->ls_threads around iterating 2009-06-25 18:54:56 +00:00
kern_lockstat.c Add the OpenSolaris dtrace lockstat provider. The lockstat provider 2009-05-26 20:28:22 +00:00
kern_malloc.c If we're passed garbage in malloc_init(), panic() rather than expecting 2009-06-05 09:16:52 +00:00
kern_mbuf.c Add support to the virtual memory system for configuring machine- 2009-07-12 23:31:20 +00:00
kern_mib.c Declare the kern.ngroups sysctl to be read-only, but tunable at boot for 2010-01-12 18:20:20 +00:00
kern_module.c Provide groundwork for 32-bit binary compatibility on non-x86 platforms, 2010-03-11 14:49:06 +00:00
kern_mtxpool.c Fix a number of style issues in the MALLOC / FREE commit. I've tried to 2008-10-23 20:26:15 +00:00
kern_mutex.c Right now, WITNESS just blindly pipes all the output to the 2010-05-11 18:24:22 +00:00
kern_ntptime.c kern_ntptime: drop a comment that became stale after r207359 2010-04-29 09:18:36 +00:00
kern_osd.c Make the rmlock(9) interface a bit more like the rwlock(9) interface: 2009-05-29 10:52:37 +00:00
kern_physio.c
kern_pmc.c Support sparsely numbered CPUs. 2008-09-22 10:37:02 +00:00
kern_poll.c Rather than fix questionable ifnet list locking in the implementation of 2009-08-15 23:07:43 +00:00
kern_priv.c Move "options MAC" from opt_mac.h to opt_global.h, as it's now in GENERIC 2009-06-05 14:55:22 +00:00
kern_proc.c Fix a mistake in r207603. td_rux.rux_runtime still needs conversion. 2010-05-05 16:05:51 +00:00
kern_prot.c Only allocate the space we need before calling kern_getgroups instead 2010-01-15 07:18:46 +00:00
kern_resource.c Implement RUSAGE_THREAD. Add td_rux to keep extended runtime and ticks 2010-05-04 05:55:37 +00:00
kern_rmlock.c Remove extra spaces (no functional change). 2009-12-25 21:14:05 +00:00
kern_rwlock.c Print the pointer to the lock with the panic message. The previous 2010-03-24 19:21:26 +00:00
kern_sdt.c Add kernel support for the Statically Defined Trace provider. 2008-05-18 19:32:36 +00:00
kern_sema.c
kern_shutdown.c Fix compilation in the !SMP case. 2010-04-20 12:22:06 +00:00
kern_sig.c Reorganize syscall entry and leave handling. 2010-05-23 18:32:02 +00:00
kern_switch.c - Use DPCPU for SCHED_STATS. This is somewhat awkward because the 2009-06-25 01:33:51 +00:00
kern_sx.c In current code, threads performing an interruptible sleep (on both 2009-12-12 21:31:07 +00:00
kern_synch.c Add new msleep(9) flag PBDY that shall be specified together with 2009-07-14 22:52:46 +00:00
kern_syscalls.c Introduce SYSCALL_INIT_HELPER and SYSCALL32_INIT_HELPER macros and 2010-03-19 10:56:30 +00:00
kern_sysctl.c Make it possible to change the vnet sysctl variables on jails 2009-08-13 10:26:34 +00:00
kern_tc.c Remove conditionally compiled time counter statistics; tools like 2009-04-11 22:01:40 +00:00
kern_thr.c Provide groundwork for 32-bit binary compatibility on non-x86 platforms, 2010-03-11 14:49:06 +00:00
kern_thread.c Fix typo in comment. 2010-05-04 06:06:01 +00:00
kern_time.c Remove VOP_LEASE and supporting functions. This hasn't been used since 2009-04-10 10:52:19 +00:00
kern_timeout.c Properly fix callout handling by putting all the per-cpu info in 2009-12-14 12:23:46 +00:00
kern_umtx.c Provide groundwork for 32-bit binary compatibility on non-x86 platforms, 2010-03-11 14:49:06 +00:00
kern_uuid.c Rework global locks for interface list and index management, correcting 2009-08-23 20:40:19 +00:00
kern_xxx.c Place hostnames and similar information fully under the prison system. 2009-05-29 21:27:12 +00:00
ksched.c sched_getparam was just plain broke for time-share 2010-03-03 21:46:51 +00:00
link_elf_obj.c Kernel module support for mips. 2010-02-18 05:49:52 +00:00
link_elf.c Build on Jeff Roberson's linker-set based dynamic per-CPU allocator 2009-07-14 22:48:30 +00:00
linker_if.m strict kobj signatures: linker_if fixes 2009-06-11 17:05:45 +00:00
Make.tags.inc Catch up with the disappearance of sys/dev/hfa. 2008-12-01 14:34:42 +00:00
Makefile
makesyscalls.sh Remove unused LIBCOMPAT keyword from syscalls.master. 2010-02-08 10:02:01 +00:00
md4c.c
md5c.c
p1003_1b.c Remove kernel support for M:N threading. 2008-03-12 10:12:01 +00:00
posix4_mib.c
sched_4bsd.c Assert that the thread passed to sched_bind() and sched_unbind() is 2010-05-21 17:15:56 +00:00
sched_ule.c Assert that the thread passed to sched_bind() and sched_unbind() is 2010-05-21 17:15:56 +00:00
serdev_if.m
stack_protector.c Random number generator initialization cleanup: 2009-10-20 16:36:51 +00:00
subr_acl_nfs4.c Fix comments. 2010-01-04 12:39:42 +00:00
subr_acl_posix1e.c Now that all the callers seem to be fixed, add KASSERTs to make sure VAPPEND 2009-12-26 11:36:10 +00:00
subr_autoconf.c Prefer ANSI function definitions to K&R ones. 2009-02-03 07:52:07 +00:00
subr_blist.c Retire the MALLOC and FREE macros. They are an abomination unto style(9). 2008-10-23 15:53:51 +00:00
subr_bufring.c Switch to our preferred 2-clause BSD license. 2010-05-05 20:39:02 +00:00
subr_bus.c Make sure that we free the passed in data message if we don't actually 2010-04-20 20:39:42 +00:00
subr_clock.c Now that all platforms use genclock, shuffle things around slightly 2008-04-22 19:38:30 +00:00
subr_devstat.c Update d_mmap() to accept vm_ooffset_t and vm_memattr_t. 2009-12-29 21:51:28 +00:00
subr_disk.c Clarify and reimplement the bioq API so that bioq_disksort() has 2009-02-13 11:36:32 +00:00
subr_eventhandler.c Split eventhandler_register() into an internal part and a wrapper function 2010-03-19 19:51:03 +00:00
subr_fattime.c
subr_firmware.c Bump up the firmware_table from 30 to 50. bwn needs more than 30, it 2010-03-07 22:37:35 +00:00
subr_hash.c Decompose the most lousy named file in sys/kern; kern_subr.c. 2010-02-21 19:53:33 +00:00
subr_hints.c
subr_kdb.c * Completely Remove the option STOP_NMI from the kernel. This option 2009-08-13 17:09:45 +00:00
subr_kobj.c Use NULL in preference to 0 in pointer contexts. 2009-02-03 07:54:42 +00:00
subr_lock.c - Implement a new mechanism for resetting lock profiling. We now 2009-03-15 06:41:47 +00:00
subr_log.c Make /dev/klog and kern.msgbuf* MPSAFE. 2009-11-03 21:06:19 +00:00
subr_mbpool.c
subr_mchain.c Replaced the misleading uses of a historical artefact M_TRYWAIT with M_WAIT. 2008-03-25 09:39:02 +00:00
subr_module.c
subr_msgbuf.c
subr_param.c Document the VM detection type and sysctl a bit better. 2010-03-02 23:57:42 +00:00
subr_pcpu.c - Adjust the whitespace for the lines that output fields in 'show pcpu' in 2010-05-21 17:17:56 +00:00
subr_power.c
subr_prf.c Make /dev/klog and kern.msgbuf* MPSAFE. 2009-11-03 21:06:19 +00:00
subr_prof.c Use ANSI function definition for profil. 2009-02-03 07:52:36 +00:00
subr_rman.c sysctl_rman: report shared resources to devinfo 2009-05-19 14:08:21 +00:00
subr_rtc.c Clean up MI inittodr(9) and kill noop code. 2009-03-23 21:16:21 +00:00
subr_sbuf.c Switch to simplified BSD license (with phk's approval), plus whitespace 2008-08-09 10:26:21 +00:00
subr_scanf.c
subr_sglist.c This patch fixes two bugs in sglist(9) and improves robustness of the API via 2009-08-21 02:59:07 +00:00
subr_sleepqueue.c Introduce the new kernel thread called "deadlock resolver". 2010-01-09 01:46:38 +00:00
subr_smp.c This pushes all of JC's patches that I have in place. I 2010-05-16 19:43:48 +00:00
subr_stack.c Add stack_print_short() and stack_print_short_ddb() interfaces to 2009-06-24 12:06:15 +00:00
subr_taskqueue.c Handle taskqueue_drain(9) correctly on a threaded taskqueue: 2010-04-30 16:29:05 +00:00
subr_trap.c Reorganize syscall entry and leave handling. 2010-05-23 18:32:02 +00:00
subr_turnstile.c Introduce the new kernel thread called "deadlock resolver". 2010-01-09 01:46:38 +00:00
subr_uio.c Push down the page queues into vm_page_cache(), vm_page_try_to_cache(), and 2010-05-08 20:34:01 +00:00
subr_unit.c
subr_witness.c Right now, WITNESS just blindly pipes all the output to the 2010-05-11 18:24:22 +00:00
sys_generic.c Remove PIOLLHUP from the flags used to test for to set exceptfsd 2010-05-21 10:36:29 +00:00
sys_pipe.c Update a comment: It no longer makes sense to talk about the page queues 2010-05-08 23:01:47 +00:00
sys_process.c Reorganize syscall entry and leave handling. 2010-05-23 18:32:02 +00:00
sys_socket.c Merge the remainder of kern_vimage.c and vimage.h into vnet.c and 2009-08-01 19:26:27 +00:00
syscalls.c Regenerate 2009-10-27 11:01:15 +00:00
syscalls.master Remove unused LIBCOMPAT keyword from syscalls.master. 2010-02-08 10:02:01 +00:00
systrace_args.c Regenerate 2009-10-27 11:01:15 +00:00
sysv_ipc.c Move SysV IPC freebsd32 compat shims helpers from freebsd32_misc.c to 2010-03-19 11:01:51 +00:00
sysv_msg.c Move SysV IPC freebsd32 compat shims from freebsd32_misc.c to corresponding 2010-03-19 11:04:42 +00:00
sysv_sem.c Move SysV IPC freebsd32 compat shims from freebsd32_misc.c to corresponding 2010-03-19 11:04:42 +00:00
sysv_shm.c Move SysV IPC freebsd32 compat shims from freebsd32_misc.c to corresponding 2010-03-19 11:04:42 +00:00
tty_compat.c Make TIOCSTI work again. 2010-01-04 20:59:52 +00:00
tty_info.c Print an extra newline when not at the first column already. 2009-05-17 16:17:48 +00:00
tty_inq.c Remove statistics from the TTY queues. 2010-02-07 15:42:15 +00:00
tty_outq.c Remove statistics from the TTY queues. 2010-02-07 15:42:15 +00:00
tty_pts.c Do not leak master pty or ptmx vnode. 2010-04-08 08:58:18 +00:00
tty_tty.c Remove unneeded Giant locking of /dev/tty. 2008-06-03 12:38:00 +00:00
tty_ttydisc.c Print backspaces after echoing an EOF. 2009-10-17 08:59:41 +00:00
tty.c Make TIOCSTI work again. 2010-01-04 20:59:52 +00:00
uipc_accf.c (S)LIST_HEAD_INITIALIZER takes a (S)LIST_HEAD as an argument. 2009-12-28 22:56:30 +00:00
uipc_cow.c Remove page queues locking from all sf_buf_mext()-like functions. The page 2010-05-06 17:43:41 +00:00
uipc_debug.c Add missing socket options. 2009-05-26 09:19:21 +00:00
uipc_domain.c When registering a protocol to an existing protocol domain via 2009-08-24 10:03:41 +00:00
uipc_mbuf2.c Move "options MAC" from opt_mac.h to opt_global.h, as it's now in GENERIC 2009-06-05 14:55:22 +00:00
uipc_mbuf.c Remove a redundant variable assignment. 2010-05-01 18:34:50 +00:00
uipc_mqueue.c Rename st_*timespec fields to st_*tim for POSIX 2008 compliance. 2010-03-28 13:13:22 +00:00
uipc_sem.c Rename st_*timespec fields to st_*tim for POSIX 2008 compliance. 2010-03-28 13:13:22 +00:00
uipc_shm.c Rename st_*timespec fields to st_*tim for POSIX 2008 compliance. 2010-03-28 13:13:22 +00:00
uipc_sockbuf.c In sbappendstream_locked() demote all incoming packet mbufs (and 2009-06-22 21:46:40 +00:00
uipc_socket.c Provide groundwork for 32-bit binary compatibility on non-x86 platforms, 2010-03-11 14:49:06 +00:00
uipc_syscalls.c Remove page queues locking from all sf_buf_mext()-like functions. The page 2010-05-06 17:43:41 +00:00
uipc_usrreq.c Fix build on amd64, where sysctl arg1 is a pointer. 2009-10-05 22:23:12 +00:00
vfs_acl.c Add change that was somehow missed in r192586. It could manifest by 2009-12-03 13:29:24 +00:00
vfs_aio.c Convert aio syscall registration to SYSCALL_INIT_HELPER. 2010-03-19 11:11:34 +00:00
vfs_bio.c The page queues lock is no longer required by vm_page_set_invalid(), so 2010-05-18 16:40:29 +00:00
vfs_cache.c The cache_enter(9) function shall not be called for doomed dvp. 2010-04-20 10:19:27 +00:00
vfs_cluster.c Remove a stale comment. The very same revision (r85511) that introduced 2009-06-30 19:39:17 +00:00
vfs_default.c Add VOP_ADVLOCKPURGE so that the file system is called when purging 2010-05-12 21:24:46 +00:00
vfs_export.c Set the prison in NFS anon and GSS SVC creds. 2009-09-28 18:07:16 +00:00
vfs_extattr.c Replace AUDIT_ARG() with variable argument macros with a set more more 2009-06-27 13:58:44 +00:00
vfs_hash.c In keeping with style(9)'s recommendations on macros, use a ';' 2008-03-16 10:58:09 +00:00
vfs_init.c Expand the scope of the sysctllock sx lock to protect the sysctl tree itself. 2009-02-06 14:51:32 +00:00
vfs_lookup.c Support only LOOKUP operation for "/" in relookup() because lookup() 2010-03-26 11:33:12 +00:00
vfs_mount.c - Reduce scope of vnode lock. vfs_mount_alloc() doesn't need vnode to be 2010-02-18 22:22:45 +00:00
vfs_subr.c Add VOP_ADVLOCKPURGE so that the file system is called when purging 2010-05-12 21:24:46 +00:00
vfs_syscalls.c Handle a case in kern_openat() when vn_open() change file type from 2010-04-13 08:52:20 +00:00
vfs_vnops.c Avoid overflow. 2010-05-06 18:52:41 +00:00
vnode_if.src Add VOP_ADVLOCKPURGE so that the file system is called when purging 2010-05-12 21:24:46 +00:00