From 4404fa9b3d98646f942e32146722a9d0a68edc13 Mon Sep 17 00:00:00 2001 From: Miguel Date: Thu, 23 Aug 2018 03:20:56 +0200 Subject: never ending struggle with forking --- asm/int_syscall_handler.asm | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'asm/int_syscall_handler.asm') diff --git a/asm/int_syscall_handler.asm b/asm/int_syscall_handler.asm index a26592f..4031f3d 100644 --- a/asm/int_syscall_handler.asm +++ b/asm/int_syscall_handler.asm @@ -148,29 +148,31 @@ call_exit: ;;;; call_fork: + + pusha ;Push all standard registers - cli - - pusha ;Push all standard registers - - mov ebx, esp ;save current stack pointer in esp - mov esp, 0x7000 ;now put the stack outside of virtual memory in kernel space! + push ds + push es + push fs + push gs + mov ebx, esp ; pass it in push ebx call task_fork ;Call C code - mov [pid],eax + pop ebx - mov esp, ebx ;Replace the stack with what the C code gave us - + pop ds + pop es + pop fs + pop gs + + mov [pid],eax ; save return val, so it survives popa popa ;Put the standard registers back mov ebx,[pid] - sti - iretd ;Interrupt-Return - ;;;; call_timeofday: call syscall_gettimeofday -- cgit v1.2.3