Skip to content
Advertisement

In a system call are hardware and software context saved?

Who saves the hardware and software context before the system call routine? Is it the processor itself or the software handler?

Thanks.

Advertisement

Answer

Each system call has a wrapper function as already mentioned, each wrapper function triggers interrupt 128, int 0x80, which automatically saves on kernel stack the registers eip, esp, cs, ss, eflags. In the handling function a SAVE_ALL macro is invoked and it will push the rest of the registers on stack, when the system call is served, the values are poped to restore previous state. A iret command is invoked and the CPU pops the 5 registers it saved previously.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement