• POSIX API's and System Calls
    • API may not necessarily be correspond witht the system call name.  malloc => brk
    • -1 to signal kernel did not handle request =>  errno
  • System Call Handler and  Service Routine.
    • Parameters pushed on stack by libc
    • System call number => eax
    • int $0x80
    • glibc macro
    • arch/i386/kernel/entry.S:
      • SAVE_ALL
      • Handle Service Routine
      • ret_from_sys_call
    • NR_syscalls, make up sys_call_table,  with special call sys_ni_syscall for unimplemented calls.
  • Inititalizing System Calls.
    • trap_init() calls set_system_gate(0x80, &system_call)
    • uses __KERNEL_CS segment
    • type: system trap, does not disable maskable interrupts.
    • Descriptor level set to 3, so user mode can execute it.
  • the system_call function:
  • Parameters:
    • 6 maximum, limited by the number of registers of the i386 architecture.
    • eax contains system call.
    • 32 bit parameters
    • Large parameter calls store in memory and pass a pointer to it.

 
  • Taking over sys_kill. stat.c
  • Generic Takeover.  stat.c   handler   handler.S