summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFreya Murphy <freya@freyacat.org>2024-01-27 03:33:01 -0500
committerFreya Murphy <freya@freyacat.org>2024-01-27 03:33:01 -0500
commit59050bbca0b7525fb9054fe57946a4a3917d50e8 (patch)
treee3c028aa36ed93c7a0ac9cf926ae2674242c9ba7
parentImplemented and fixed paging (diff)
downloadcorn-59050bbca0b7525fb9054fe57946a4a3917d50e8.tar.gz
corn-59050bbca0b7525fb9054fe57946a4a3917d50e8.tar.bz2
corn-59050bbca0b7525fb9054fe57946a4a3917d50e8.zip
joe biden
-rw-r--r--Makefile3
-rw-r--r--src/arch/amd64/shim.c26
2 files changed, 12 insertions, 17 deletions
diff --git a/Makefile b/Makefile
index 3d0f04c..78d922a 100644
--- a/Makefile
+++ b/Makefile
@@ -45,3 +45,6 @@ $(BUILD_DIR)/$(ISO_NAME): $(BUILD_DIR)/$(K_BIN_NAME) grub.cfg
cp grub.cfg $(BUILD_DIR)/iso/boot/grub
cp $(BUILD_DIR)/$(K_BIN_NAME) $(BUILD_DIR)/iso/boot
grub-mkrescue -o $(BUILD_DIR)/$(ISO_NAME) $(BUILD_DIR)/iso
+
+run:
+ qemu-system-x86_64 $(BUILD_DIR)/$(ISO_NAME) -serial stdio
diff --git a/src/arch/amd64/shim.c b/src/arch/amd64/shim.c
index 8a9d146..1e73525 100644
--- a/src/arch/amd64/shim.c
+++ b/src/arch/amd64/shim.c
@@ -1,23 +1,15 @@
#include <stdint.h>
#include <cpuid.h>
-#define PG_PRESENT 0x0000'0000'0000'0001
-#define PG_READ_WRITE 0x0000'0000'0000'0002
-#define PG_USER_SUPERVISE 0x0000'0000'0000'0004
-#define PG_WRITE_THROUGH 0x0000'0000'0000'0008
-#define PG_CACHE_DISABLE 0x0000'0000'0000'0010
-#define PG_ACCESSED 0x0000'0000'0000'0020
-#define PG_EXECUTE_DISABLE 0x8000'0000'0000'0000
-
-#define F_PRESENT 0b1
-#define F_WRITEABLE 0b10
-#define F_UNPRIVILEGED 0b100
-#define F_WRITETHROUGH 0b1000
-#define F_CACHEDISABLE 0b10000
-#define F_ACCESSED 0b100000
-#define F_DIRTY 0b1000000
-#define F_MEGABYTE 0b10000000
-#define F_GLOBAL 0b100000000
+#define F_PRESENT 0x001
+#define F_WRITEABLE 0x002
+#define F_UNPRIVILEGED 0x004
+#define F_WRITETHROUGH 0x008
+#define F_CACHEDISABLE 0x010
+#define F_ACCESSED 0x020
+#define F_DIRTY 0x040
+#define F_MEGABYTE 0x080
+#define F_GLOBAL 0x100
// PAGE MAP LEVEL 4 ENTRY
struct pml4e {