linux0.12系统调用

系统调用是一个软中断,中断号是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

你可能感兴趣的:(linux)