summaryrefslogtreecommitdiff
path: root/src/arch/amd64/fpu.c
blob: 43fc653ca740129f2f43e83d1f681f1a03cd176d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
#include <fpu.h>
#include <stddef.h>
#include <stdint.h>
#include <lib.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));
}