summaryrefslogtreecommitdiff
path: root/src/arch/amd64/fpu.c
blob: 292264c659deb5536244a668c8f7f48e28306b6a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#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));
}