1 #ifndef THREADS_LOADER_H
2 #define THREADS_LOADER_H
4 /* Constants fixed by the PC BIOS. */
5 #define LOADER_BASE 0x7c00 /* Physical address of loader's base. */
6 #define LOADER_END 0x7e00 /* Physical address of end of loader. */
8 /* Physical address of kernel base. */
9 #define LOADER_KERN_BASE 0x100000 /* 1 MB. */
11 /* Kernel virtual address at which all physical memory is mapped.
13 The loader maps the 4 MB at the bottom of physical memory to
14 this virtual base address. Later, paging_init() adds the rest
15 of physical memory to the mapping.
17 This must be aligned on a 4 MB boundary. */
18 #define LOADER_PHYS_BASE 0xc0000000 /* 3 GB. */
20 /* Important loader physical addresses. */
21 #define LOADER_SIG (LOADER_END - LOADER_SIG_LEN) /* 0xaa55 BIOS signature. */
22 #define LOADER_ARGS (LOADER_SIG - LOADER_ARGS_LEN) /* Command-line args. */
23 #define LOADER_ARG_CNT (LOADER_ARGS - LOADER_ARG_CNT_LEN) /* Number of args. */
24 #define LOADER_RAM_PGS (LOADER_ARG_CNT - LOADER_RAM_PGS_LEN) /* # RAM pages. */
26 /* Sizes of loader data structures. */
27 #define LOADER_SIG_LEN 2
28 #define LOADER_ARGS_LEN 128
29 #define LOADER_ARG_CNT_LEN 4
30 #define LOADER_RAM_PGS_LEN 4
32 /* GDT selectors defined by loader.
33 More selectors are defined by userprog/gdt.h. */
34 #define SEL_NULL 0x00 /* Null selector. */
35 #define SEL_KCSEG 0x08 /* Kernel code selector. */
36 #define SEL_KDSEG 0x10 /* Kernel data selector. */
38 #endif /* threads/loader.h */