Skip to content

Commit 361420f

Browse files
bors[bot]phil-opp
andcommitted
40: Fix context_switch spin jump r=phil-opp a=phil-opp Fixes a small problem of rust-osdev#39: The problem is that inline Assembly has no special support for `.` labels, so `.spin` is just a global label with the name ".spin". But `jmp spin` jumps to the completely different "spin" label, which is defined somewhere in the assembly code. This PR fixes that problem by reintroducing the `context_switch_spin` label that was used in the assembly code before. Co-authored-by: Philipp Oppermann <[email protected]>
2 parents 81cb282 + 8873806 commit 361420f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ global_asm!(include_str!("video_mode/vga_320x200.s"));
3737
global_asm!(include_str!("video_mode/vga_text_80x25.s"));
3838

3939
unsafe fn context_switch(boot_info: VirtAddr, entry_point: VirtAddr, stack_pointer: VirtAddr) -> ! {
40-
asm!("jmp $1; .spin: jmp spin" :: "{rsp}"(stack_pointer), "r"(entry_point), "{rdi}"(boot_info) :: "intel");
40+
asm!("jmp $1; context_switch_spin: jmp context_switch_spin" :: "{rsp}"(stack_pointer), "r"(entry_point), "{rdi}"(boot_info) :: "intel");
4141
::core::hint::unreachable_unchecked()
4242
}
4343

0 commit comments

Comments
 (0)