diff options
author | Alex Auvolat <alex@adnab.me> | 2016-07-15 20:51:05 +0200 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2016-07-15 20:51:05 +0200 |
commit | d415aca695956c79110c88fa58c12bf55c0e2163 (patch) | |
tree | 61c9589fe1cf1a78f7f582eff410e047eada604e /src/kernel/core/context_switch.s | |
parent | 327d62f7d56f79999cac6407bdfdcc0b90510aef (diff) | |
download | kogata-d415aca695956c79110c88fa58c12bf55c0e2163.tar.gz kogata-d415aca695956c79110c88fa58c12bf55c0e2163.zip |
Fix nasty task switching bu
Diffstat (limited to 'src/kernel/core/context_switch.s')
-rw-r--r-- | src/kernel/core/context_switch.s | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/kernel/core/context_switch.s b/src/kernel/core/context_switch.s index b8f6bb8..e81fa56 100644 --- a/src/kernel/core/context_switch.s +++ b/src/kernel/core/context_switch.s @@ -4,13 +4,15 @@ [GLOBAL save_context_and_enter_scheduler] ; void save_context_and_enter_scheduler(struct saved_context *ctx); save_context_and_enter_scheduler: + push ebp ; save stack frame for debugging + mov ebp, esp pushf ; push flags cli pusha ; push general registers mov eax, cr3 ; push CR3 push eax - mov eax, [esp+44] ; get address of saved_context structure + mov eax, [ebp+8] ; get address of saved_context structure mov [eax], esp ; save esp mov dword [eax+4], resume_saved_context ; save eip @@ -22,12 +24,15 @@ resume_saved_context: mov cr3, eax popa ; restore general registers popf ; restore flags + pop ebp ret [GLOBAL resume_context] resume_context: - mov eax, [esp+4] ; get address of saved context + push ebp + mov ebp, esp + mov eax, [ebp+8] ; get address of saved context mov esp, [eax] ; resume esp mov ecx, [eax+4] ; jump to specified eip jmp ecx |