kernel: implement cpu IDs and per-cpu variables

This commit is contained in:
2023-03-18 19:35:00 +00:00
parent 56bc47f570
commit 57eaf4e01c
14 changed files with 232 additions and 18 deletions

View File

@@ -6,3 +6,35 @@ ml_halt_cpu:
1: cli
hlt
jmp 1b
.global ml_this_cpu
.type ml_this_cpu, @function
ml_this_cpu:
movq %gs:0, %rax
ret
.global rdmsr
.type rdmsr, @function
rdmsr:
mov %rdi, %rcx
rdmsr
shl $32, %rdx
orq %rax, %rdx
ret
.global wrmsr
.type wrmsr, @function
wrmsr:
mov %rdi, %rcx
mov %rsi, %rax
mov %rsi, %rdx
shr $32, %rdx
wrmsr
ret