X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?p=pintos-anon;a=blobdiff_plain;f=src%2Fthreads%2Floader.h;h=1bfe111185d0f777f5cadf83824d5abe03b64b00;hp=f5d7a9ba794bf2e045789deea123ef37541f122d;hb=a03618133f7df0954802a470a4bee7674f7aed45;hpb=6c5c6fdfe80bad40c90c19b67f00226610d59a38 diff --git a/src/threads/loader.h b/src/threads/loader.h index f5d7a9b..1bfe111 100644 --- a/src/threads/loader.h +++ b/src/threads/loader.h @@ -1,28 +1,28 @@ -#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_END 0x7e00 /* Physical address of end of loader. */ /* Physical address of kernel base. */ -#define LOADER_KERN_BASE 0x100000 /* 1 MB. */ +#define LOADER_KERN_BASE 0x20000 /* 128 kB. */ /* Kernel virtual address at which all physical memory is mapped. - - The loader maps the 4 MB at the bottom of physical memory to - this virtual base address. Later, paging_init() adds the rest - of physical memory to the mapping. - - This must be aligned on a 4 MB boundary. */ + Must be aligned on a 4 MB boundary. */ #define LOADER_PHYS_BASE 0xc0000000 /* 3 GB. */ -/* Offsets within the loader. */ -#define LOADER_BIOS_SIG (LOADER_END - 2) /* 0xaa55 BIOS signature. */ -#define LOADER_CMD_LINE_LEN 0x80 /* Command line length. */ -#define LOADER_CMD_LINE (LOADER_BIOS_SIG - LOADER_CMD_LINE_LEN) - /* Kernel command line. */ -#define LOADER_RAM_PAGES (LOADER_CMD_LINE - 4) /* # of pages of RAM. */ +/* Important loader physical addresses. */ +#define LOADER_SIG (LOADER_END - LOADER_SIG_LEN) /* 0xaa55 BIOS signature. */ +#define LOADER_PARTS (LOADER_SIG - LOADER_PARTS_LEN) /* Partition table. */ +#define LOADER_ARGS (LOADER_PARTS - LOADER_ARGS_LEN) /* Command-line args. */ +#define LOADER_ARG_CNT (LOADER_ARGS - LOADER_ARG_CNT_LEN) /* Number of args. */ + +/* Sizes of loader data structures. */ +#define LOADER_SIG_LEN 2 +#define LOADER_PARTS_LEN 64 +#define LOADER_ARGS_LEN 128 +#define LOADER_ARG_CNT_LEN 4 /* GDT selectors defined by loader. More selectors are defined by userprog/gdt.h. */ @@ -30,4 +30,11 @@ #define SEL_KCSEG 0x08 /* Kernel code selector. */ #define SEL_KDSEG 0x10 /* Kernel data selector. */ -#endif /* loader.h */ +#ifndef __ASSEMBLER__ +#include + +/* Amount of physical memory, in 4 kB pages. */ +extern uint32_t init_ram_pages; +#endif + +#endif /* threads/loader.h */