Operating System: Three Easy Pieces --- LDE (Note)

ASIDE: Why System Calls Look Like Procedure Calls?

You may wonder why a call to a system call, such as open() or read() looks exactly like

a typical procedure call in C; that is, if it looks just like a procedure call, how does the

system know it is a sytem call, and do all the right stuff? The simple reason: it is a procedure

call, but hidden inside that procedure call is the famous trap instruction. More specifically,

when you call open() (for example), you are executing a procedure call into the C library.

Therein, whether for open() or any of the other syscall calls provided, the library uses an

agreed-upon calling convention with the kernel to put the arguments to open in well-known

locations.

 

posted on 2015-10-27 12:30  Persistence  阅读(232)  评论(0编辑  收藏  举报

导航