Changeset View
Changeset View
Standalone View
Standalone View
sys/amd64/amd64/support.S
Show First 20 Lines • Show All 796 Lines • ▼ Show 20 Lines | |||||
* MSR operations fault handler | * MSR operations fault handler | ||||
*/ | */ | ||||
ALIGN_TEXT | ALIGN_TEXT | ||||
msr_onfault: | msr_onfault: | ||||
movq $0,PCB_ONFAULT(%r8) | movq $0,PCB_ONFAULT(%r8) | ||||
movl $EFAULT,%eax | movl $EFAULT,%eax | ||||
POP_FRAME_POINTER | POP_FRAME_POINTER | ||||
ret | ret | ||||
ALIGN_TEXT | |||||
ENTRY(pmap_pti_pcid_invalidate) | |||||
markj: Can't these routines be implemented in C? | |||||
Not Done Inline ActionsThis is quite risky. We are temporary swapping address spaces there, in particular, we enter the AS where the C stack is not mapped. I absolutely need to ensure that the routines do not access anything outside the explicitly allowed addresses while on user page table. kib: This is quite risky. We are temporary swapping address spaces there, in particular, we enter… | |||||
Done Inline ActionsCould you please add prototypes like in the functions above and in cpu_switch.S? markj: Could you please add prototypes like in the functions above and in cpu_switch.S? | |||||
Not Done Inline ActionsHm, so isn't this unsafe wrt NMIs? markj: Hm, so isn't this unsafe wrt NMIs? | |||||
Not Done Inline ActionsNever mind, sorry. I forgot that the NMI handler reloads from KCR3. markj: Never mind, sorry. I forgot that the NMI handler reloads from KCR3. | |||||
Not Done Inline ActionsYes, there are many more places where kernel is executing with UCR3, and NMI/MCE handlers already handle that. kib: Yes, there are many more places where kernel is executing with UCR3, and NMI/MCE handlers… | |||||
pushfq | |||||
cli | |||||
movq %rdi,%cr3 /* to user page table */ | |||||
movq %rsi,%cr3 /* back to kernel */ | |||||
popfq | |||||
retq | |||||
ALIGN_TEXT | |||||
ENTRY(pmap_pti_pcid_invlpg) | |||||
pushfq | |||||
cli | |||||
movq %rdi,%cr3 /* to user page table */ | |||||
invlpg (%rdx) | |||||
movq %rsi,%cr3 /* back to kernel */ | |||||
popfq | |||||
retq | |||||
ALIGN_TEXT | |||||
ENTRY(pmap_pti_pcid_invlrng) | |||||
pushfq | |||||
cli | |||||
movq %rdi,%cr3 /* to user page table */ | |||||
1: invlpg (%rdx) | |||||
addq $PAGE_SIZE,%rdx | |||||
cmpq %rdx,%rcx | |||||
ja 1b | |||||
movq %rsi,%cr3 /* back to kernel */ | |||||
popfq | |||||
retq |
Can't these routines be implemented in C?