http://web.archive.org/web/20210423124630/https://github.com/jdah/tetris-os/blob/master/README.md
16 lines
289 B
C
16 lines
289 B
C
#include "fpu.h"
|
|
|
|
void fpu_init() {
|
|
size_t t;
|
|
|
|
asm("clts");
|
|
asm("mov %%cr0, %0" : "=r"(t));
|
|
t &= ~(1 << 2);
|
|
t |= (1 << 1);
|
|
asm("mov %0, %%cr0" :: "r"(t));
|
|
asm("mov %%cr4, %0" : "=r"(t));
|
|
t |= 3 << 9;
|
|
asm("mov %0, %%cr4" :: "r"(t));
|
|
asm("fninit");
|
|
}
|