summaryrefslogtreecommitdiff
path: root/asm
diff options
context:
space:
mode:
authorMichal Idziorek <m.i@gmx.at>2014-12-02 01:02:49 +0100
committerMichal Idziorek <m.i@gmx.at>2014-12-02 01:02:49 +0100
commitc2c03f41e078481921bad82487eded0fc51ebb59 (patch)
tree1e310556c9a809aea112728bae9e0a6807ee0ba2 /asm
parentf20db37ca17245d5d20302a1ac1da347de5c3607 (diff)
further work on fork and friends
Diffstat (limited to 'asm')
-rw-r--r--asm/int_clock_handler.asm2
-rw-r--r--asm/int_syscall_handler.asm30
2 files changed, 29 insertions, 3 deletions
diff --git a/asm/int_clock_handler.asm b/asm/int_clock_handler.asm
index 6301dc6..5e48658 100644
--- a/asm/int_clock_handler.asm
+++ b/asm/int_clock_handler.asm
@@ -9,7 +9,7 @@ cli
pusha ;Push all standard registers
mov eax, esp ;save current stack pointer in esp
-mov esp, 0x1000 ;now put the stack outside of virtual memory in kernel space!
+mov esp, 0x7000 ;now put the stack outside of virtual memory in kernel space!
push eax ;Push pointer to all the stuff we just pushed
call task_switch_next ;Call C code
diff --git a/asm/int_syscall_handler.asm b/asm/int_syscall_handler.asm
index 504d3e8..70090f0 100644
--- a/asm/int_syscall_handler.asm
+++ b/asm/int_syscall_handler.asm
@@ -1,6 +1,7 @@
global int_syscall_handler
[extern task_fork]
[extern task_exit]
+[extern task_wait]
[extern syscall_exit]
@@ -25,13 +26,15 @@ pid: dd 0x0
int_syscall_handler:
-
cmp eax, 72
je call_fork
cmp eax, 60
je call_exit
+cmp eax, 77
+je call_wait
+
cli
push ebx
@@ -96,12 +99,35 @@ done_blocking:
iret ;Interrupt-Return
+call_wait:
+
+ 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 ebx ;Push pointer to all the stuff we just pushed
+
+ call task_wait ;Call C code
+
+ mov esp, eax ;Replace the stack with what the C code gave us
+
+ popa ;Put the standard registers back
+
+ sti
+
+ iretd ;Interrupt-Return
+ ;;;;
+
call_exit:
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 ebx ;Push pointer to all the stuff we just pushed
@@ -126,7 +152,7 @@ call_fork:
mov ebx, esp ;save current stack pointer in esp
mov esp, 0x7000 ;now put the stack outside of virtual memory in kernel space!
- push ebx ;Push pointer to all the stuff we just pushed
+ push ebx
call task_fork ;Call C code
mov [pid],eax