summaryrefslogtreecommitdiff
path: root/src/arch/amd64/fpu.c
blob: 551485ea56c4053c5a4da2865bfea81a4f7ed2e8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
#include <fpu.h>
#include <stddef.h>
#include <stdint.h>

void enable_fpu() {
	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));
}