Start work on kernel start-up code.
[pintos-anon] / src / threads / loader.h
index 8bd603fdfd899cceb8ae4cbe22ddf06791993d24..7b317f3989f449d62640e1d814dc95aeba77ccd0 100644 (file)
@@ -1,12 +1,10 @@
-#ifndef HEADER_LOADER_H
-#define HEADER_LOADER_H
+#ifndef THREADS_LOADER_H
+#define THREADS_LOADER_H
 
-/* Constants fixed by the PC BIOS. */
-#define LOADER_BASE 0x7c00      /* Physical address of loader's base. */
-#define LOADER_SIZE 0x200       /* Loader size in bytes (one disk sector). */
-
-/* Physical address of kernel base. */
-#define LOADER_KERN_BASE 0x100000       /* 1 MB. */
+/* Physical addresses of important kernel components. */
+#define LOADER_PD_BASE   0x0f000 /* Page directory: 4 kB starting at 60 kB. */
+#define LOADER_PT_BASE   0x10000 /* Page tables: 64 kB starting at 64 kB. */
+#define LOADER_KERN_BASE 0x20000 /* Kernel: up to 512 kB starting at 128 kB. */
 
 /* Kernel virtual address at which all physical memory is mapped.
 
    This must be aligned on a 4 MB boundary. */
 #define LOADER_PHYS_BASE 0xc0000000     /* 3 GB. */
 
-/* Offsets within the loader. */
-#define LOADER_BIOS_SIG (LOADER_SIZE - 2)        /* aa55 BIOS signature. */
-#define LOADER_CMD_LINE (LOADER_BIOS_SIG - 0x80) /* Kernel command line. */
-#define LOADER_RAM_PAGES (LOADER_CMD_LINE - 4)   /* # of pages of RAM. */
+/* GDT selectors defined by loader.
+   More selectors are defined by userprog/gdt.h. */
+#define SEL_NULL        0x00    /* Null selector. */
+#define SEL_KCSEG       0x08    /* Kernel code selector. */
+#define SEL_KDSEG       0x10    /* Kernel data selector. */
 
-#endif /* loader.h */
+#endif /* threads/loader.h */