系統調用是一個軟中斷,中斷號是0x80,它是上層應用程序與Linux系統內核進行交互通信的唯一接口。
這個中斷的設置在kernel/sched.c中443行函數中
1 void sched_init( void ) 2 { 3 int i; 4 struct desc_struct * p; 5 6 if ( sizeof ( struct sigaction) != 16 ) 7 panic( " Struct sigaction MUST be 16 bytes " ); 8 set_tss_desc(gdt+FIRST_TSS_ENTRY,& (init_task.task.tss)); 9 set_ldt_desc(gdt+FIRST_LDT_ENTRY,& (init_task.task.ldt)); 10 p = gdt+ 2 + FIRST_TSS_ENTRY; 11 for (i= 1 ;i<NR_TASKS;i++ ) { 12 task[i] = NULL; 13 p->a=p->b= 0 ; 14 p++ ; 15 p->a=p->b= 0 ; 16 p++ ; 17 } 18 /* Clear NT, so that we won't have troubles with that later on */ 19 __asm__( " pushfl ; andl $0xffffbfff,(%esp) ; popfl " ); 20 ltr( 0 ); 21 lldt( 0 ); 22 outb_p( 0x36 , 0x43 ); /* binary, mode 3, LSB/MSB, ch 0 */ 23 outb_p(LATCH & 0xff , 0x40 ); /* LSB */ 24 outb(LATCH >> 8 , 0x40 ); /* MSB */ 25 set_intr_gate( 0x20 ,& timer_interrupt); 26 outb(inb_p( 0x21 )&~ 0x01 , 0x21 ); 27 set_system_gate( 0x80 ,& system_call); 28 }
http://blog.csdn.net/yming0221/article/details/6398414
更多文章、技術交流、商務合作、聯系博主
微信掃碼或搜索:z360901061

微信掃一掃加我為好友
QQ號聯系: 360901061
您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。
【本文對您有幫助就好】元
