@@ -10,7 +10,7 @@ BITS 16
1010
1111init_smp_ap:
1212
13- ; Enable the A20 gate
13+ ; Enable the A20 gate
1414set_A20_ap:
1515 in al , 0x64
1616 test al , 0x02
@@ -24,10 +24,10 @@ check_A20_ap:
2424 mov al , 0xDF
2525 out 0x60 , al
2626
27- ; At this point we are done with real mode and BIOS interrupts. Jump to 32-bit mode.
28- lgdt [ cs :GDTR32 ] ; load GDT register
27+ ; At this point we are done with real mode and BIOS interrupts. Jump to 32-bit mode.
28+ lgdt [ cs :GDTR32 ] ; Load GDT register
2929
30- mov eax , cr0 ; switch to 32-bit protected mode
30+ mov eax , cr0 ; Switch to 32-bit protected mode
3131 or al , 1
3232 mov cr0 , eax
3333
@@ -41,7 +41,7 @@ align 16
4141BITS 32
4242
4343startap32:
44- mov eax , 16 ; load 4 GB data descriptor
44+ mov eax , 16 ; Load 4 GB data descriptor
4545 mov ds , ax ; to all data segment registers
4646 mov es , ax
4747 mov fs , ax
@@ -56,30 +56,30 @@ startap32:
5656 xor ebp , ebp
5757 mov esp , 0x7000 ; Set a known free location for the temporary stack (shared by all APs)
5858
59- ; Load the GDT
59+ ; Load the GDT
6060 lgdt [ GDTR64 ]
6161
62- ; Enable extended properties
62+ ; Enable extended properties
6363 mov eax , cr4
6464 or eax , 0x0000000B0 ; PGE (Bit 7), PAE (Bit 5), and PSE (Bit 4)
6565 mov cr4 , eax
6666
67- ; Point cr3 at PML4
67+ ; Point cr3 at PML4
6868 mov eax , 0x00002008 ; Write-thru (Bit 3)
6969 mov cr3 , eax
7070
71- ; Enable long mode and SYSCALL/SYSRET
71+ ; Enable long mode and SYSCALL/SYSRET
7272 mov ecx , 0xC0000080 ; EFER MSR number
7373 rdmsr ; Read EFER
7474 or eax , 0x00000101 ; LME (Bit 8)
7575 wrmsr ; Write EFER
7676
77- ; Enable paging to activate long mode
77+ ; Enable paging to activate long mode
7878 mov eax , cr0
7979 or eax , 0x80000000 ; PG (Bit 31)
8080 mov cr0 , eax
8181
82- ; Make the jump directly from 16-bit real mode to 64-bit long mode
82+ ; Make the jump directly from 16-bit real mode to 64-bit long mode
8383 jmp SYS64_CODE_SEL:startap64
8484
8585align 16
@@ -124,22 +124,13 @@ startap64:
124124 mov rsp , rax ; Pure64 leaves 0x50000-0x9FFFF free so we use that
125125
126126 lgdt [ GDTR64 ] ; Load the GDT
127- lidt [ IDTR64 ] ; load IDT register
128-
129- ; Enable Local APIC on AP
130- ; mov rsi, [p_LocalAPICAddress]
131- ; add rsi, 0x00f0 ; Offset to Spurious Interrupt Register
132- ; mov rdi, rsi
133- ; lodsd
134- ; or eax, 0000000100000000b
135- ; stosd
127+ lidt [ IDTR64 ] ; Load the IDT
136128
137129 call init_ cpu ; Setup CPU
138130
139131 sti ; Activate interrupts for SMP
140132 jmp ap_sleep
141133
142-
143134align 16
144135
145136ap_sleep:
0 commit comments