Add MSR_EFER and rdmsr()
This commit is contained in:
parent
707d42bec4
commit
ba7c2996d5
@ -5,6 +5,8 @@ module hulk.cpu;
|
||||
|
||||
import ldc.llvmasm;
|
||||
|
||||
enum uint MSR_EFER = 0xC000_0080u;
|
||||
|
||||
void cli()
|
||||
{
|
||||
__asm("cli", "");
|
||||
@ -45,6 +47,14 @@ ulong read_cr4()
|
||||
return __asm!ulong("mov %cr4, %rax", "={rax}");
|
||||
}
|
||||
|
||||
ulong rdmsr(uint msr)
|
||||
{
|
||||
return __asm!ulong(`
|
||||
rdmsr
|
||||
shl $$32, %rdx
|
||||
or %rdx, %rax`, "={rax},{ecx},~{rdx}", msr);
|
||||
}
|
||||
|
||||
ubyte in8(ushort ioaddr)
|
||||
{
|
||||
return __asm!ubyte("inb %dx, %al", "={al},{dx}", ioaddr);
|
||||
|
Loading…
x
Reference in New Issue
Block a user