Changeset View
Changeset View
Standalone View
Standalone View
sys/amd64/amd64/mpboot.S
Show First 20 Lines • Show All 254 Lines • ▼ Show 20 Lines | bootMP_size: | ||||
/* | /* | ||||
* From here on down is executed in the kernel .text section. | * From here on down is executed in the kernel .text section. | ||||
*/ | */ | ||||
.text | .text | ||||
.code64 | .code64 | ||||
.p2align 4,0 | .p2align 4,0 | ||||
entry_64: | entry_64: | ||||
movq bootSTK, %rsp | movq bootSTK, %rsp | ||||
/* | |||||
kib: I prefer to not put the conditional code there. I do not see a harm from doing this wrmsr… | |||||
Done Inline ActionsOk, but the wrmsr in init_secondary() cannot be removed. It seems that loading a selector into %gs causes the base register to be cleared, so we must write MSR_GSBASE again after calling lgdt(). markj: Ok, but the wrmsr in init_secondary() cannot be removed. It seems that loading a selector into… | |||||
Not Done Inline ActionsOk, perhaps expand this comment to say what you noted above. kib: Ok, perhaps expand this comment to say what you noted above. | |||||
* Initialize the segment register used for the PCPU area. The PCPU | |||||
* area will be initialized by init_secondary(), but it should be | |||||
* accessible before that to support sanitizer instrumentation which | |||||
* accesses per-CPU variables. | |||||
* | |||||
* Note that GS.base is loaded again in init_secondary(). This is not | |||||
* redundant: lgdt() loads a selector into %gs and this has the side | |||||
* effect of clearing GS.base. | |||||
*/ | |||||
movl $MSR_GSBASE, %ecx | |||||
movq bootpcpu, %rax | |||||
movq %rax, %rdx | |||||
shrq $32, %rdx | |||||
wrmsr | |||||
jmp init_secondary | jmp init_secondary |
I prefer to not put the conditional code there. I do not see a harm from doing this wrmsr unconditionally, and removing corresponding wrmsr from init_secondary().