summaryrefslogtreecommitdiffstats
path: root/setup.S
diff options
context:
space:
mode:
Diffstat (limited to 'setup.S')
-rw-r--r--setup.S21
1 files changed, 9 insertions, 12 deletions
diff --git a/setup.S b/setup.S
index f80875b..2fe3d2d 100644
--- a/setup.S
+++ b/setup.S
@@ -22,18 +22,11 @@ start:
outb %al, $0x70
# The system will move itself to its rightful place.
-# reload the segment registers and the stack since the
-# APs also execute this code
-#ljmp $INITSEG, $(reload - start + 0x200)
-reload:
- movw $INITSEG, %ax
+ xorl %eax, %eax
+ movw %cs, %ax
movw %ax, %ds
- movw %ax, %es
- movw %ax, %fs
- movw %ax, %ss # reset the stack to INITSEG:0x4000-12.
- movw %dx, %sp
- push %cs
- pop %ds
+ shll $4, %eax
+ addl %eax, gdt_48 - start + 2
lidt idt_48 - start # load idt with 0,0
lgdt gdt_48 - start # load gdt with whatever appropriate
@@ -80,6 +73,9 @@ alt_a20_done:
* Note that the short jump isn't strictly needed, althought there are
* reasons why it might be a good idea. It won't hurt in any case.
*/
+ xorl %ebx, %ebx
+ movw %ss, %bx
+ shll $4, %ebx
movw $0x0001, %ax # protected mode (PE) bit
lmsw %ax # This is it#
jmp flush_instr
@@ -88,6 +84,7 @@ flush_instr:
movw %ax, %ds
movw %ax, %es
movw %ax, %ss
+ addl %ebx, %esp
movw %ax, %fs
movw %ax, %gs
@@ -144,7 +141,7 @@ idt_48:
gdt_48:
.word 0x800 # gdt limit=2048, 256 GDT entries
- .word 512+gdt - start,0x9 # gdt base = 0X9xxxx
+ .long gdt - start # gdt base
msg1:
.asciz "Setup.S\r\n"