Merge branch 'master' of github.com:Minep/lunaix-os
[lunaix-os.git] / lunaix-os / kernel / asm / x86 / syscall.S
index 5ecfd0121f2aa14ae8e46a3f9c7249cb2233a0c9..0922a96a334060046d0d4983a8b784cbd56d7af2 100644 (file)
@@ -8,14 +8,20 @@
     syscall_table:
         1:
         .long 0
-        .long __lxsys_fork
+        .long __lxsys_fork          /* 1 */
         .long __lxsys_yield
         .long __lxsys_sbrk
         .long __lxsys_brk
-        .long __lxsys_getpid
+        .long __lxsys_getpid        /* 5 */
         .long __lxsys_getppid
         .long __lxsys_sleep
         .long __lxsys_exit
+        .long __lxsys_wait          
+        .long __lxsys_waitpid       /* 10 */
+        .long __lxsys_sigreturn
+        .long __lxsys_sigprocmask
+        .long __lxsys_signal
+        .long __lxsys_pause
         2:
         .rept __SYSCALL_MAX - (2b - 1b)/4
             .long 0
 .section .text
     syscall_hndlr:
         pushl %ebp
-        movl %esp, %ebp
-        addl $0x8, %ebp
-        movl (%ebp), %ebp
+        movl 8(%esp), %ebp
 
-        movl  (%ebp), %eax
+        movl  (%ebp), %eax          /* eax: call code as well as the return value from syscall */
         cmpl  $__SYSCALL_MAX, %eax
         jae 2f
 
         popl  %ebp
         ret
     1:
-        pushl 24(%ebp)    /* esi - #6 arg */
-        pushl 20(%ebp)    /* ebp - #5 arg */
-        pushl 16(%ebp)    /* edi - #4 arg */
-        pushl 12(%ebp)    /* edx - #3 arg */
-        pushl 8(%ebp)    /* ecx - #2 arg */
-        pushl 4(%ebp)    /* ebx - #1 arg */
+        pushl 24(%ebp)      /* esi - #6 arg */
+        pushl 20(%ebp)      /* ebp - #5 arg */
+        pushl 16(%ebp)      /* edi - #4 arg */
+        pushl 12(%ebp)      /* edx - #3 arg */
+        pushl 8(%ebp)       /* ecx - #2 arg */
+        pushl 4(%ebp)       /* ebx - #1 arg */
         
         call (%eax)
 
-        addl $24, %esp
+        movl %eax, (%ebp)    /* save the return value */
+
+        addl $24, %esp      /* remove the parameters from stack */
 
         popl %ebp
         
-        ret
-
-
+        ret
\ No newline at end of file