--- linux/kernel/system_call.s 2018/04/24 18:00:13 1.1.1.1 +++ linux/kernel/system_call.s 2018/04/24 18:02:17 1.1.1.3 @@ -45,9 +45,9 @@ signal = 12 restorer = 16 # address of info-restorer sig_fn = 20 # table of 32 signal addresses -nr_system_calls = 67 +nr_system_calls = 319 -.globl _system_call,_sys_fork,_timer_interrupt,_hd_interrupt,_sys_execve +.globl system_call,sys_fork,timer_interrupt,hd_interrupt,sys_execve .align 2 bad_sys_call: @@ -56,9 +56,9 @@ bad_sys_call: .align 2 reschedule: pushl $ret_from_sys_call - jmp _schedule + jmp schedule .align 2 -_system_call: +system_call: cmpl $nr_system_calls-1,%eax ja bad_sys_call push %ds @@ -72,16 +72,24 @@ _system_call: mov %dx,%es movl $0x17,%edx # fs points to local data space mov %dx,%fs - call _sys_call_table(,%eax,4) + + movl sys_call_table(,%eax,4),%edx # if sys_null + cmpl $sys_null,%edx # then the syscall is not + jne 1f # implemented. + popl %edx # 1st argument is syscall nr + pushl %eax +1: + + call *sys_call_table(,%eax,4) pushl %eax - movl _current,%eax + movl current,%eax cmpl $0,state(%eax) # state jne reschedule cmpl $0,counter(%eax) # counter je reschedule ret_from_sys_call: - movl _current,%eax # task[0] cannot have signals - cmpl _task,%eax + movl current,%eax # task[0] cannot have signals + cmpl task,%eax je 3f movl CS(%esp),%ebx # was old code segment supervisor testl $3,%ebx # mode? If so - don't check signals @@ -106,7 +114,7 @@ ret_from_sys_call: pushl %ecx pushl $28 pushl %edx - call _verify_area + call verify_area popl %edx addl $4,%esp popl %ecx @@ -137,12 +145,12 @@ default_signal: cmpl $SIG_CHLD,%ecx je 2b pushl %ecx - call _do_exit # remember to set bit 7 when dumping core + call do_exit # remember to set bit 7 when dumping core addl $4,%esp jmp 3b .align 2 -_timer_interrupt: +timer_interrupt: push %ds # save ds,es and put kernel data space push %es # into them. %fs is used by _system_call push %fs @@ -155,27 +163,27 @@ _timer_interrupt: mov %ax,%es movl $0x17,%eax mov %ax,%fs - incl _jiffies + incl jiffies movb $0x20,%al # EOI to interrupt controller #1 outb %al,$0x20 movl CS(%esp),%eax andl $3,%eax # %eax is CPL (0 or 3, 0=supervisor) pushl %eax - call _do_timer # 'do_timer(long CPL)' does everything from + call do_timer # 'do_timer(long CPL)' does everything from addl $4,%esp # task switching to accounting ... jmp ret_from_sys_call .align 2 -_sys_execve: +sys_execve: lea EIP(%esp),%eax pushl %eax - call _do_execve + call do_execve addl $4,%esp ret .align 2 -_sys_fork: - call _find_empty_process +sys_fork: + call find_empty_process testl %eax,%eax js 1f push %gs @@ -183,11 +191,11 @@ _sys_fork: pushl %edi pushl %ebp pushl %eax - call _copy_process + call copy_process addl $20,%esp 1: ret -_hd_interrupt: +hd_interrupt: pushl %eax pushl %ecx pushl %edx @@ -204,10 +212,10 @@ _hd_interrupt: jmp 1f # give port chance to breathe 1: jmp 1f 1: outb %al,$0xA0 # same to controller #2 - movl _do_hd,%eax + movl do_hd,%eax testl %eax,%eax jne 1f - movl $_unexpected_hd_interrupt,%eax + movl $unexpected_hd_interrupt,%eax 1: call *%eax # "interesting" way of handling intr. pop %fs pop %es