STANDARD C LIBRARY EXAMPLE o C program invoking printfO library call,which calls write0 system call #include <stdio.h> int main() -printf("Greetings"); return 0; user mode standard C library kernel mode write ( write() system call
STANDARD C LIBRARY EXAMPLE C program invoking printf() library call, which calls write() system call
SYSTEM CALL PARAMETER PASSING o Often,more information is required than simply identity of desired system call Exact type and amount of information vary according to OS and call o Three general methods used to pass parameters to the OS Simplest:pass the parameters in registers o In some cases,may be more parameters than registers Parameters stored in a block,or table,in memory,and address of block passed as a parameter in a register o This approach taken by Linux and Solaris Parameters placed,or pushed,onto the stack by the program and popped off the stack by the operating system Block and stack methods do not limit the number or length of parameters being passed
SYSTEM CALL PARAMETER PASSING Often, more information is required than simply identity of desired system call Exact type and amount of information vary according to OS and call Three general methods used to pass parameters to the OS Simplest: pass the parameters in registers In some cases, may be more parameters than registers Parameters stored in a block, or table, in memory, and address of block passed as a parameter in a register This approach taken by Linux and Solaris Parameters placed, or pushed, onto the stack by the program and popped off the stack by the operating system Block and stack methods do not limit the number or length of parameters being passed