
System Calls and Dual Mode
Dual-mode operation with a hardware mode bit, privileged instructions and what happens when user code tries one; traps, exceptions and interrupts as the only ways into the kernel; the step-by-step path of a system call through the libc wrapper, the trap, the system-call table and return-from-trap; how parameters are passed; the classes of system calls with POSIX examples; library calls that may or may not reach the kernel; and the difference between a mode switch and a context switch.
![System call path: program calls read(); the libc wrapper loads the call number k; a trap sets the mode bit to 0 and saves registers; the handler runs table[k]; return-from-trap restores and sets the mode bit to 1; read() returns the byte count or -1.](https://bywjbbkinjqiyalvzqfd.supabase.co/storage/v1/object/public/sheet-media/OS/OS-02/diagrams/OS-02.d01.webp)




