]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
This file contains the code that implements the syscall path based
authormarcel <marcel@FreeBSD.org>
Thu, 15 May 2003 07:51:22 +0000 (07:51 +0000)
committermarcel <marcel@FreeBSD.org>
Thu, 15 May 2003 07:51:22 +0000 (07:51 +0000)
commit606bf22520352a067014aa945164b40a958e4f53
treee3829c55432b0b31cdf9fa3f735d0b2322be7dea
parentefcc32885e4d7671f700b94536886860e7e4c029
This file contains the code that implements the syscall path based
on the epc instruction. The epc instruction, given the permissions
of the page in which the epc is located, allows the privilege level
to be increased with little or no overhead. The previous privilege
level is recorded in the current frame marker and is restored by
a regular (function) return.
Since the epc instruction has to live in a page with non-standard
properties, we hardwire a "gateway" page in the address space. The
address of the gateway page is exported to userland in ar.k7. This
allows us to rewire the page without breaking the ABI.
The syscall stubs in libc are regular function calls that slightly
differ from the normal runtime. The difference is mostly to simplify
the stubs themselves by by moving some of the logic to the kernel.
The libc stubs call into the gateway page (offset 0), from where the
kernel trampolines to the code that sets up a minimal trapframe and
arranges to execute from the kernel stack.
The way back is basicly the same. The kernel returns to the gateway
page, whereby privilege is dropped, and jumps back to the syscall
stub.
Only the special registers are saved in the trapframe. None of the
scratch registers are preserved and since the kernel follows the
same runtime model, none of the preserved registers are saved.
Future enhancements can include the implementation of lightweight
syscalls, where kernel functions are performed without setting up
a trapframe. Good candidates are the *context syscalls for example.

Now that there's a gateway page from which code can be executed in
a non-privileged context, we also have the ideal place to put the
signal trampolines. By moving the signal trampolines from the user
stack to the gateway page, we open up the doors to unexecutable
stacks. The gateway page contains signal trampolines for both the
"legacy" break-based syscall code and the new and improved epc-
based syscall code.

Approved: re@ (blanket)
sys/ia64/ia64/syscall.S [new file with mode: 0644]
sys/ia64/ia64/syscall.s [new file with mode: 0644]