diff options
author | Freya Murphy <freya@freyacat.org> | 2024-02-02 16:41:19 -0500 |
---|---|---|
committer | Freya Murphy <freya@freyacat.org> | 2024-02-02 16:41:19 -0500 |
commit | 72df91d99ba7e9a032d6cb171571e075d0f6ce53 (patch) | |
tree | 5ccba5a02821a54f953d85a092429939e6c577f0 /src/arch/amd64/fpu.c | |
parent | check for bochs (diff) | |
download | corn-72df91d99ba7e9a032d6cb171571e075d0f6ce53.tar.gz corn-72df91d99ba7e9a032d6cb171571e075d0f6ce53.tar.bz2 corn-72df91d99ba7e9a032d6cb171571e075d0f6ce53.zip |
pretty colors
Diffstat (limited to 'src/arch/amd64/fpu.c')
-rw-r--r-- | src/arch/amd64/fpu.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/arch/amd64/fpu.c b/src/arch/amd64/fpu.c new file mode 100644 index 0000000..551485e --- /dev/null +++ b/src/arch/amd64/fpu.c @@ -0,0 +1,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)); +} |