diff options
| author | Fabian Imhof <fabian.imhof@ost.ch> | 2025-04-10 09:32:20 +0000 |
|---|---|---|
| committer | Fabian Imhof <fabian.imhof@ost.ch> | 2025-04-10 09:32:20 +0000 |
| commit | 295f1bc9a29267b72504fffb582a08c2467b1a7f (patch) | |
| tree | 9e0a60fd53ee34887b4afacc069ac4daa882ee01 /arch/x86_64/src/boot | |
| parent | 8a23a47425162894141f4eac488fb1f1bb3f7dae (diff) | |
| download | teachos-295f1bc9a29267b72504fffb582a08c2467b1a7f.tar.xz teachos-295f1bc9a29267b72504fffb582a08c2467b1a7f.zip | |
fix context_switch function
Diffstat (limited to 'arch/x86_64/src/boot')
| -rw-r--r-- | arch/x86_64/src/boot/boot.s | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/arch/x86_64/src/boot/boot.s b/arch/x86_64/src/boot/boot.s index 85ae1a1..139fd1a 100644 --- a/arch/x86_64/src/boot/boot.s +++ b/arch/x86_64/src/boot/boot.s @@ -352,6 +352,10 @@ prepare_page_maps: .section .boot_text, "ax", @progbits .code64 +test_function: + cli + ret + .global context_switch context_switch: // ring 3 data with bottom 2 bits set for ring 3 @@ -366,20 +370,17 @@ context_switch: mov %rsp, %rax // user data selector push $((4 * 16) | 3) - // current exp + // current rsp push %rax // push eflags pushf // push code selector (ring 3 code with bottom 2 bits set for ring 3) push $((3 * 16) | 3) - // instruction address to return to - push test_function - - iret + // push instruction address to return to + lea [test_function], %rax + push %rax -test_function: - cli - ret + iretq _transition_to_long_mode: xor %rax, %rax |
