summaryrefslogtreecommitdiff
path: root/kernel/cpu/fpu.c
diff options
context:
space:
mode:
authorFreya Murphy <freya@freyacat.org>2025-04-03 21:32:00 -0400
committerFreya Murphy <freya@freyacat.org>2025-04-03 21:32:00 -0400
commit16b7b4c2c008c976ee5948c97a8337d6224c3be9 (patch)
tree70f8402c3a2650d72fb174a43f8893a6f415546b /kernel/cpu/fpu.c
parentfix printf (diff)
downloadcomus-16b7b4c2c008c976ee5948c97a8337d6224c3be9.tar.gz
comus-16b7b4c2c008c976ee5948c97a8337d6224c3be9.tar.bz2
comus-16b7b4c2c008c976ee5948c97a8337d6224c3be9.zip
add 64-bit idt/pic and fix paging
Diffstat (limited to 'kernel/cpu/fpu.c')
-rw-r--r--kernel/cpu/fpu.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/kernel/cpu/fpu.c b/kernel/cpu/fpu.c
new file mode 100644
index 0000000..f2674a7
--- /dev/null
+++ b/kernel/cpu/fpu.c
@@ -0,0 +1,12 @@
+#include <lib.h>
+
+#include "fpu.h"
+
+void fpu_init(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));
+}