summaryrefslogtreecommitdiff
path: root/src/arch/amd64/fpu.c
blob: 5a8aa926ec0276a0147771d8dd4254c7c0994d8c (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(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));
}