Skip to content

Commit 39b5f16

Browse files
committed
Let compiler select registers when enabling protected mode
1 parent 2215d00 commit 39b5f16

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

bios/stage-2/src/protected_mode.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -125,19 +125,20 @@ pub fn enter_protected_mode_and_jump_to_stage_3(entry_point: *const u8, info: &m
125125
".code32",
126126

127127
// reload segment registers
128-
"mov bx, 0x10",
129-
"mov ds, bx",
130-
"mov es, bx",
131-
"mov ss, bx",
128+
"mov {0}, 0x10",
129+
"mov ds, {0}",
130+
"mov es, {0}",
131+
"mov ss, {0}",
132132

133133
// jump to third stage
134-
"pop eax",
135-
"call eax",
134+
"pop {1}",
135+
"call {1}",
136136

137137
// enter endless loop in case third stage returns
138138
"2:",
139139
"jmp 2b",
140-
out("eax") _
140+
out(reg) _,
141+
out(reg) _,
141142
);
142143
}
143144
}

0 commit comments

Comments
 (0)