diff --git a/src/hulk/cpu.d b/src/hulk/cpu.d index 00906d1..809e777 100644 --- a/src/hulk/cpu.d +++ b/src/hulk/cpu.d @@ -73,6 +73,19 @@ void wrmsr(uint msr, ulong value) __asm(`wrmsr`, "{ecx},{edx},{eax}", msr, value >> 32u, value); } +ulong xgetbv(uint xcr) +{ + return __asm!ulong(` + xgetbv + shl $$32, %rdx + or %rdx, %rax`, "={rax},{ecx},~{rdx}", xcr); +} + +void xsetbv(uint xcr, ulong value) +{ + __asm(`xsetbv`, "{ecx},{edx},{eax}", xcr, value >> 32u, value); +} + ubyte in8(ushort ioaddr) { return __asm!ubyte("inb %dx, %al", "={al},{dx}", ioaddr);