global int_syscall_handler [extern syscall_exit] [extern syscall_write] [extern syscall_read] [extern syscall_readdir] [extern syscall_execve] [extern syscall_open] [extern syscall_close] [extern syscall_fstat] [extern syscall_isatty] [extern syscall_lseek] [extern syscall_sbrk] [extern syscall_unhandled] [bits 32] int_syscall_handler: cli push ebx push ecx push edx cmp eax, 60 je call_exit cmp eax, 61 je call_write cmp eax, 62 je call_read cmp eax, 63 je call_readdir cmp eax, 64 je call_execve cmp eax, 65 je call_open cmp eax, 66 je call_close cmp eax, 67 je call_fstat cmp eax, 68 je call_isatty cmp eax, 69 je call_lseek cmp eax, 70 je call_sbrk push eax jmp call_unhandled done: mov ebx,eax mov al, 0x20 ;Port number AND command number to Acknowledge IRQ out 0x20, al ;Acknowledge IRQ, so we keep getting interrupts mov eax,ebx done_blocking: pop ebx pop ecx pop edx mov ebx,eax sti iret ;Interrupt-Return call_write: call syscall_write jmp done call_open: call syscall_open jmp done call_readdir: call syscall_readdir jmp done call_close: call syscall_close jmp done call_fstat: call syscall_fstat jmp done call_isatty: call syscall_isatty jmp done call_lseek: call syscall_lseek jmp done call_sbrk: call syscall_sbrk jmp done call_exit: call syscall_exit jmp done call_unhandled: call syscall_unhandled jmp done ;this should never be called, since unhandled causes kernel panic ;;; THIS CALLS NEED REENABLE INTERRUPTS BEFORE calling workers call_read: mov al, 0x20 ;Port number AND command number to Acknowledge IRQ out 0x20, al ;Acknowledge IRQ, so we keep getting interrupts sti call syscall_read jmp done_blocking call_execve: mov al, 0x20 ;Port number AND command number to Acknowledge IRQ out 0x20, al ;Acknowledge IRQ, so we keep getting interrupts sti call syscall_execve jmp $ ; this should never return TODO: pop stack!?