Commit 84dcd0d7 by malcolm

just some cleanup and minor changes fremma help idk which of your vars to use

parent 99c55ce5
...@@ -32,7 +32,7 @@ void schedule() ...@@ -32,7 +32,7 @@ void schedule()
curproc=(curproc<NUM_PROCS-1)?curproc+1:0; curproc=(curproc<NUM_PROCS-1)?curproc+1:0;
} }
serial_writestring("about to switch\n"); serial_writestring("about to switch\n");
context_switch(&procs[old]->ctxt, procs[curproc]->ctxt); //context_switch(&procs[old]->ctxt, procs[curproc]->ctxt);
serial_writestring("switched\n"); serial_writestring("switched\n");
//procs[old]->state=RUNNABLE; //procs[old]->state=RUNNABLE;
procs[curproc]->state=RUNNING; procs[curproc]->state=RUNNING;
......
...@@ -47,6 +47,7 @@ typedef struct//all regs in proc ...@@ -47,6 +47,7 @@ typedef struct//all regs in proc
typedef struct//regs needed for context typedef struct//regs needed for context
{ {
uint3t_t cr3;
uint32_t edi; uint32_t edi;
uint32_t esi; uint32_t esi;
uint32_t ebx; uint32_t ebx;
......
;; compile with nasm -felf32 hello.asm
Section .text
global main
main:
mov eax, 4
int 0x80
mov eax, 5
int 0x80
...@@ -5,10 +5,10 @@ extern kstack ...@@ -5,10 +5,10 @@ extern kstack
%macro error_interrupt 1 %macro error_interrupt 1
global interrupt_handler_%1 global interrupt_handler_%1
interrupt_handler_%1: interrupt_handler_%1:
push ebp ;push ebp
push esp ;push esp
mov ebp, kstack ;mov ebp, kstack
mov esp, kstack ;mov esp, kstack
push dword %1 push dword %1
jmp common_handler jmp common_handler
%endmacro %endmacro
...@@ -17,10 +17,10 @@ interrupt_handler_%1: ...@@ -17,10 +17,10 @@ interrupt_handler_%1:
global interrupt_handler_%1 global interrupt_handler_%1
interrupt_handler_%1: interrupt_handler_%1:
push dword 0 push dword 0
push ebp ;push ebp
push esp ;push esp
mov ebp, kstack ;mov ebp, kstack
mov esp, kstack ;mov esp, kstack
push dword %1 push dword %1
jmp common_handler jmp common_handler
%endmacro %endmacro
...@@ -39,8 +39,8 @@ common_handler: ...@@ -39,8 +39,8 @@ common_handler:
pop dword ds pop dword ds
add esp, 4 add esp, 4
pop esp ;pop esp
pop ebp ;pop ebp
add esp, 4 add esp, 4
iret iret
......
...@@ -7,10 +7,12 @@ context_switch: ...@@ -7,10 +7,12 @@ context_switch:
push ebx push ebx
push esi push esi
push edi push edi
push cr3
mov [eax], esp mov [eax], esp
mov esp, edx mov esp, edx
pop cr3
pop edi pop edi
pop esi pop esi
pop ebx pop ebx
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment