diff options
Diffstat (limited to 'kernel/asm.s')
| -rw-r--r-- | kernel/asm.s | 38 |
1 files changed, 34 insertions, 4 deletions
diff --git a/kernel/asm.s b/kernel/asm.s index 8b5c231..655dcfc 100644 --- a/kernel/asm.s +++ b/kernel/asm.s @@ -1,12 +1,13 @@ global clear_tss -global switch_to +global invlpg global set_tss +global switch_to extern ctask extern ctaskn extern gdt extern save_state -; void switch_to(int n, struct task_struct *task); +; void switch_to(int n, struct task_struct *task) switch_to: push ebp mov ebp, esp @@ -36,7 +37,36 @@ switch_to: .tmp: dq 0 -; void set_tss(unsigned int n, void *tss); +; void invlpg(void *page) +invlpg: + push ebp + mov ebp, esp + ; test if we're running on a i386 and abort if so (only i486+ have caches) + pushf + pop eax + and eax, 0xFFFBFFFF + push eax + popf + pushf + pop eax + test eax, 0x40000 + jnz .skip + pushf + pop eax + or eax, 0x40000 + push eax + popf + pushf + pop eax + test eax, 0x40000 + jz .skip + mov eax, [ebp+8] + invlpg [eax] +.skip: + pop ebp + ret + +; void set_tss(unsigned int n, void *tss) set_tss: push ebp mov ebp, esp @@ -59,7 +89,7 @@ set_tss: pop ebp ret -; void clear_tss(unsigned int n); +; void clear_tss(unsigned int n) clear_tss: push ebp mov ebp, esp |
