summaryrefslogtreecommitdiffstats
path: root/pintos-progos/threads/loader.h
diff options
context:
space:
mode:
Diffstat (limited to 'pintos-progos/threads/loader.h')
-rw-r--r--pintos-progos/threads/loader.h40
1 files changed, 40 insertions, 0 deletions
diff --git a/pintos-progos/threads/loader.h b/pintos-progos/threads/loader.h
new file mode 100644
index 0000000..1bfe111
--- /dev/null
+++ b/pintos-progos/threads/loader.h
@@ -0,0 +1,40 @@
1#ifndef THREADS_LOADER_H
2#define THREADS_LOADER_H
3
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. */
7
8/* Physical address of kernel base. */
9#define LOADER_KERN_BASE 0x20000 /* 128 kB. */
10
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. */
14
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. */
20
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
26
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. */
32
33#ifndef __ASSEMBLER__
34#include <stdint.h>
35
36/* Amount of physical memory, in 4 kB pages. */
37extern uint32_t init_ram_pages;
38#endif
39
40#endif /* threads/loader.h */