mirror of
https://github.com/wichtounet/thor-os.git
synced 2025-09-11 05:24:44 -04:00
Finalize the C++ 16->64 bit transition
This commit is contained in:
parent
0263dceb1f
commit
9873c153ef
@ -71,7 +71,7 @@ second_step:
|
|||||||
|
|
||||||
;Run the kernel
|
;Run the kernel
|
||||||
|
|
||||||
jmp dword KERNEL_BASE:0x0
|
jmp dword 0x500:0x0
|
||||||
|
|
||||||
.continue:
|
.continue:
|
||||||
mov cl, [sector]
|
mov cl, [sector]
|
||||||
|
@ -118,7 +118,7 @@ constexpr uint16_t code_32_selector(){
|
|||||||
constexpr uint16_t code_64_selector(){
|
constexpr uint16_t code_64_selector(){
|
||||||
return
|
return
|
||||||
SEG_DESCTYPE(1) | SEG_PRES(1) | SEG_SAVL(0) |
|
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;
|
SEG_PRIV(0) | SEG_CODE_EXRD;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -136,10 +136,6 @@ void setup_gdt(){
|
|||||||
gdt_entry(0, 0xFFFFF, code_32_selector()),
|
gdt_entry(0, 0xFFFFF, code_32_selector()),
|
||||||
gdt_entry(0, 0xFFFFF, data_selector()),
|
gdt_entry(0, 0xFFFFF, data_selector()),
|
||||||
gdt_entry(0, 0xFFFFF, code_64_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;
|
static gdt_ptr gdtr;
|
||||||
|
@ -96,7 +96,10 @@ void enable_paging(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void __attribute__((noreturn)) lm_jump(){
|
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();
|
__builtin_unreachable();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user