diff options
Diffstat (limited to 'asm')
| -rw-r--r-- | asm/int_syscall_handler.asm | 26 | ||||
| -rw-r--r-- | asm/multiboot.s | 6 | ||||
| -rw-r--r-- | asm/task.s | 1 | ||||
| -rw-r--r-- | asm/usermode.s | 4 |
4 files changed, 23 insertions, 14 deletions
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 diff --git a/asm/multiboot.s b/asm/multiboot.s index a35423c..c26b647 100644 --- a/asm/multiboot.s +++ b/asm/multiboot.s @@ -13,6 +13,11 @@ .set MAGIC, 0x1BADB002 # 'magic number' lets bootloader find the header .set CHECKSUM, -(MAGIC + FLAGS) # checksum of above, to prove we are multiboot + +.section .smp +.code16 +jmp . + # Declare a header as in the Multiboot Standard. We put this into a special # section so we can force the header to be in the start of the final program. # You don't need to understand all these details as it is just magic values that @@ -20,6 +25,7 @@ # magic sequence and recognize us as a multiboot kernel. .section .multiboot +.code32 .align 4 .long MAGIC .long FLAGS @@ -1,4 +1,5 @@ .global task_pusha + task_pusha: pushf diff --git a/asm/usermode.s b/asm/usermode.s index 67eca04..99cee49 100644 --- a/asm/usermode.s +++ b/asm/usermode.s @@ -20,14 +20,14 @@ usermode: mov %esp, %eax pushl $0x23 // user data segment - pushl %eax // current stack + pushl $0x8fff000-3*32 //%eax // current stack pushf // // http://x86.renejeschke.de/html/file_module_x86_id_145.html //mov $0x200, %eax //push %eax // eflags image pushl $0x1B // return code segment selector - push %edx // return instruction pointer + push %edx // return instruction pointer iret |
