summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main.ha8
-rw-r--r--rt/+x86_64/realcall.S11
2 files changed, 15 insertions, 4 deletions
diff --git a/main.ha b/main.ha
index e5b2e7c..75ccb98 100644
--- a/main.ha
+++ b/main.ha
@@ -20,4 +20,12 @@ export fn main() void = {
bios::regs.ecx = 0;
bios::regs.edx = 5 << 8 | 5;
bios::call(0x10);
+ bios::regs.eax = 0x2 << 8;
+ bios::regs.ebx = 0;
+ bios::regs.edx = 0 << 8 | 0;
+ bios::call(0x10);
+ bios::regs.eax = 0x9 << 8 | 'A': u16;
+ bios::regs.ebx = 0 << 8 | 0xd;
+ bios::regs.ecx = 8;
+ bios::call(0x10);
};
diff --git a/rt/+x86_64/realcall.S b/rt/+x86_64/realcall.S
index ffbc0a9..1c51f99 100644
--- a/rt/+x86_64/realcall.S
+++ b/rt/+x86_64/realcall.S
@@ -21,6 +21,8 @@ prev_idt:
.quad 0x0
prev_gdt:
.quad 0x0
+ .short 0x0
+ # :The 64 bits sidt stores on 8+2 bytes
# :real_call
# This function is intended to be called from long mode
@@ -55,7 +57,7 @@ bios.call:
cli
- sidt (prev_idt)
+ #sidt (prev_idt)
sgdt (prev_gdt)
lgdt (gdtr32)
@@ -122,6 +124,7 @@ real_call_int:
cli
+ xchg %bx, %bx
mov %es, (res)
mov %eax, (reax)
mov %ebx, (rebx)
@@ -155,14 +158,13 @@ real_call_to_pmode_up:
or $1 << 31, %eax
mov %eax, %cr0
- lgdt (prev_gdt)
-
# :At this point %ds is latest in stack
pop %ax
# :At this point %cs is latest in stack
# Do a long jump
push $real_call_to_longmode_up
+ lgdt (prev_gdt)
retf
.code64
real_call_to_longmode_up:
@@ -174,7 +176,7 @@ real_call_to_longmode_up:
# :Avoid doing this until the bootloader loads a 64 bits IDT
# XXX
- #idt (prev_idt)
+ # lidt (prev_idt)
real_call_end:
popf
@@ -183,4 +185,5 @@ real_call_end:
pop %r13
pop %r12
pop %rbx
+ cli
ret