cvs commit: src/sys/ia64/ia64 syscall.s

Marcel Moolenaar marcel at FreeBSD.org
Thu May 15 00:51:25 PDT 2003


marcel      2003/05/15 00:51:22 PDT

  FreeBSD src repository

  Added files:
    sys/ia64/ia64        syscall.s 
  Log:
  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)
  
  Revision  Changes    Path
  1.1       +565 -0    src/sys/ia64/ia64/syscall.s (new)


More information about the cvs-all mailing list