diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2020-11-17 23:18:08 +0100 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2020-11-17 23:18:08 +0100 |
commit | 8cb33f2f18d8383fd78368110b3a78c7732da6f9 (patch) | |
tree | 6e9f2379488e92b1d7e6caff2b0b7d8248b4a440 | |
parent | e8111e517d0129f33594c4718691e41ced0b2018 (diff) |
pc/l.s: load virtual gdt pointer after mmu switch
before removing the double map at 0, load our
initial gdt pointer with its new KZERO based
virtual address.
this is prerequisite for handling traps early during
bootup before mmuinit() loads the final gdt.
-rw-r--r-- | sys/src/9/pc/l.s | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/sys/src/9/pc/l.s b/sys/src/9/pc/l.s index 5f40295ef..d9ee95597 100644 --- a/sys/src/9/pc/l.s +++ b/sys/src/9/pc/l.s @@ -71,8 +71,7 @@ TEXT _multibootentry(SB), $0 STD REP; MOVSB MOVL BX, multibootptr-KZERO(SB) - MOVL $_startPADDR(SB), AX - ANDL $~KZERO, AX + MOVL $_startPADDR-KZERO(SB), AX JMP* AX /* multiboot structure pointer (physical address) */ @@ -98,8 +97,7 @@ TEXT _startPADDR(SB), $0 CLI /* make sure interrupts are off */ /* set up the gdt so we have sane plan 9 style gdts. */ - MOVL $tgdtptr(SB), AX - ANDL $~KZERO, AX + MOVL $tgdtptr-KZERO(SB), AX MOVL (AX), GDTR MOVW $1, AX MOVW AX, MSW @@ -158,9 +156,11 @@ TEXT m0idtptr(SB), $0 WORD $(256*8-1) LONG $IDTADDR -TEXT mode32bit(SB), $0 - /* At this point, the GDT setup is done. */ +TEXT vtgdtptr(SB), $0 + WORD $(3*8) + LONG $tgdt(SB) +TEXT mode32bit(SB), $0 MOVL $((CPU0END-CPU0PDB)>>2), CX MOVL $PADDR(CPU0PDB), DI XORL AX, AX @@ -231,6 +231,9 @@ _setpte: * be initialised here. */ TEXT _startpg(SB), $0 + MOVL $vtgdtptr(SB), AX + MOVL (AX), GDTR + MOVL $0, (PDO(0))(CX) /* undo double-map of KZERO at 0 */ MOVL CX, CR3 /* load and flush the mmu */ |