1
0
Fork 0
mirror of https://git.stationery.faith/corn/corn.git synced 2025-04-11 17:47:26 +00:00
corn/src/arch/amd64/fpu.c
2024-02-04 14:19:54 -05:00

14 lines
292 B
C

#include <stddef.h>
#include <stdint.h>
#include <lib.h>
#include "fpu.h"
void fpu_enable(void) {
size_t cr4;
uint16_t cw = 0x37F;
__asm__ volatile ("mov %%cr4, %0" : "=r"(cr4));
cr4 |= 0x200;
__asm__ volatile ("mov %0, %%cr4" :: "r"(cr4));
__asm__ volatile("fldcw %0" :: "m"(cw));
}