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 0x20000 /* 128 kB. */
11 /* Kernel virtual address at which all physical memory is mapped.
12 Must be aligned on a 4 MB boundary. */
13 #define LOADER_PHYS_BASE 0xc0000000 /* 3 GB. */
15 /* Important loader physical addresses. */
16 #define LOADER_SIG (LOADER_END - LOADER_SIG_LEN) /* 0xaa55 BIOS signature. */
17 #define LOADER_PARTS (LOADER_SIG - LOADER_PARTS_LEN) /* Partition table. */
18 #define LOADER_ARGS (LOADER_PARTS - LOADER_ARGS_LEN) /* Command-line args. */
19 #define LOADER_ARG_CNT (LOADER_ARGS - LOADER_ARG_CNT_LEN) /* Number of args. */
21 /* Sizes of loader data structures. */
22 #define LOADER_SIG_LEN 2
23 #define LOADER_PARTS_LEN 64
24 #define LOADER_ARGS_LEN 128
25 #define LOADER_ARG_CNT_LEN 4
27 /* GDT selectors defined by loader.
28 More selectors are defined by userprog/gdt.h. */
29 #define SEL_NULL 0x00 /* Null selector. */
30 #define SEL_KCSEG 0x08 /* Kernel code selector. */
31 #define SEL_KDSEG 0x10 /* Kernel data selector. */
36 /* Amount of physical memory, in 4 kB pages. */
37 extern uint32_t init_ram_pages;
40 #endif /* threads/loader.h */