summaryrefslogtreecommitdiff
path: root/kernel/vmem.h
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/vmem.h')
-rw-r--r--kernel/vmem.h49
1 files changed, 49 insertions, 0 deletions
diff --git a/kernel/vmem.h b/kernel/vmem.h
index b7e9cd3..8e538bb 100644
--- a/kernel/vmem.h
+++ b/kernel/vmem.h
@@ -1,3 +1,52 @@
+/**
+ * @file
+ * http://www.brokenthorn.com/Resources/OSDev18.html
+ * https://wiki.osdev.org/Memory_Map_(x86)
+ *
+ * Paging
+ * ======
+ *
+ * The Smallest Managable Unit is a Page containing 4096 (0x1000) bytes.
+ *
+ * A Page Directory holds 1024 tables each mapping 1024 pages, totaling
+ * in 0x100000000 bytes of addressable space (4gigs).
+ *
+ * The first 32megs will get ALWAYS identity mapped (hold kernel code/kernel stack etc)
+ * This are the first 8 page-tables
+ *
+ * Layout
+ * ======
+ *
+ * We are aiming for the following layout:
+ *
+ * 0xFFFFFFFF
+ * 0xC0000000 RESERVED
+ *
+ * 0xB0000000 User Stack TOP (Grows down) |
+ * env, argc, argv ... |
+ * | alltogether ~2.5gigs
+ * .......... User Heap (brk()) |
+ * 0x08000000 User Code |
+ * |
+ * | almost 100 megs (in kernel alloc/free?)
+ * |
+ * 0x02000000 FoolOS TSS Stack TOP (max ~8mb) GROWS DOWN
+ * leave few empty pages under stack as guard.
+ *
+ * 0x01800000 FoolOS Stack TOP (max ~8mb) GROWS DOWN
+ * leave few empty pages under stack as guard.
+ *
+ * 0x01000000
+ * 0x00EFFFFF RESERVED
+ * 0x00100000 FoolOS Kernel (max ~14mb)
+ * 0x00007BFF RESERVED
+ * 0x00007000 16-bit SMP entry (max ~3kb)
+ * 0x00000500
+ * 0x00000000 RESERVED
+ *
+ */
+
+
//! i86 architecture defines 1024 entries per table--do not change
#define PAGES_PER_TABLE 1024
#define PAGES_PER_DIR 1024