Finalize the C++ 16->64 bit transition

This commit is contained in:
Baptiste Wicht 2013-12-15 21:28:27 +01:00
parent 0263dceb1f
commit 9873c153ef
3 changed files with 6 additions and 7 deletions

View File

@ -71,7 +71,7 @@ second_step:
;Run the kernel
jmp dword KERNEL_BASE:0x0
jmp dword 0x500:0x0
.continue:
mov cl, [sector]

View File

@ -118,7 +118,7 @@ constexpr uint16_t code_32_selector(){
constexpr uint16_t code_64_selector(){
return
SEG_DESCTYPE(1) | SEG_PRES(1) | SEG_SAVL(0) |
SEG_LONG(1) | SEG_SIZE(1) | SEG_GRAN(1) |
SEG_LONG(1) | SEG_SIZE(0) | SEG_GRAN(1) |
SEG_PRIV(0) | SEG_CODE_EXRD;
}
@ -136,10 +136,6 @@ void setup_gdt(){
gdt_entry(0, 0xFFFFF, code_32_selector()),
gdt_entry(0, 0xFFFFF, data_selector()),
gdt_entry(0, 0xFFFFF, code_64_selector())
//GDT_ENTRY(B_10011010, B_11001111), //32-bit Code Selector (ring 0)
//GDT_ENTRY(, ), //Data Selector (ring 0)
//GDT_ENTRY(, ) //64-bit Code Selector (ring 0)
};
static gdt_ptr gdtr;

View File

@ -96,7 +96,10 @@ void enable_paging(){
}
void __attribute__((noreturn)) lm_jump(){
asm volatile(".byte 0x66, 0xea; .long kernel_main; .word 0x18;");
asm volatile("jmp 0x18:fake_label; fake_label:");
kernel_main();
__builtin_unreachable();
}