kernel: implement cpu IDs and per-cpu variables
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user