Changeset View
Changeset View
Standalone View
Standalone View
sys/amd64/amd64/mpboot.S
Show First 20 Lines • Show All 215 Lines • ▼ Show 20 Lines | lgdt_desc: | ||||
.word gdtend-gdt /* Length */ | .word gdtend-gdt /* Length */ | ||||
.long gdt-mptramp_start /* Offset plus %ds << 4 */ | .long gdt-mptramp_start /* Offset plus %ds << 4 */ | ||||
.globl mptramp_end | .globl mptramp_end | ||||
mptramp_end: | mptramp_end: | ||||
/* | /* | ||||
* From here on down is executed in the kernel .text section. | * From here on down is executed in the kernel .text section. | ||||
* | |||||
* Load a real %cr3 that has all the direct map stuff and switches | |||||
* off the 1GB replicated mirror. Load a stack pointer and jump | |||||
* into AP startup code in C. | |||||
*/ | */ | ||||
.text | .text | ||||
.code64 | .code64 | ||||
.p2align 4,0 | .p2align 4,0 | ||||
entry_64: | entry_64: | ||||
/* | |||||
* If the BSP reported NXE support, enable EFER.NXE for all APs | |||||
* prior to loading %cr3. This avoids page faults if the AP | |||||
* encounters memory marked with the NX bit prior to detecting and | |||||
* enabling NXE support. | |||||
*/ | |||||
movq pg_nx, %rbx | |||||
kib: I do not think that you need a new variable for this. Compare pg_nx with 0 and set EFER_NXE… | |||||
Done Inline ActionsGood point! I'll change it. jtl: Good point! I'll change it. | |||||
testq %rbx, %rbx | |||||
je 1f | |||||
movl $MSR_EFER, %ecx | |||||
rdmsr | |||||
orl $EFER_NXE, %eax | |||||
wrmsr | |||||
1: | |||||
/* | |||||
* Load a real %cr3 that has all the direct map stuff and switches | |||||
* off the 1GB replicated mirror. Load a stack pointer and jump | |||||
* into AP startup code in C. | |||||
*/ | |||||
movq KPML4phys, %rax | movq KPML4phys, %rax | ||||
movq %rax, %cr3 | movq %rax, %cr3 | ||||
movq bootSTK, %rsp | movq bootSTK, %rsp | ||||
jmp init_secondary | jmp init_secondary |
I do not think that you need a new variable for this. Compare pg_nx with 0 and set EFER_NXE bit if not zero.