X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fthreads%2Floader.h;h=5bd981384202504e528fa968edd25814679228a0;hb=c9667cc796f96017951f8ac90978846918c184d7;hp=8bd603fdfd899cceb8ae4cbe22ddf06791993d24;hpb=b0fe71a5ccef1c166bc3aefd6ea2cef5f4b2fe46;p=pintos-anon diff --git a/src/threads/loader.h b/src/threads/loader.h index 8bd603f..5bd9813 100644 --- a/src/threads/loader.h +++ b/src/threads/loader.h @@ -1,9 +1,9 @@ -#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). */ +#define LOADER_END 0x7e00 /* Physical address of end of loader. */ /* Physical address of kernel base. */ #define LOADER_KERN_BASE 0x100000 /* 1 MB. */ @@ -17,9 +17,22 @@ 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. */ +/* Important loader physical addresses. */ +#define LOADER_SIG (LOADER_END - LOADER_SIG_LEN) /* 0xaa55 BIOS signature. */ +#define LOADER_ARGS (LOADER_SIG - LOADER_ARGS_LEN) /* Command-line args. */ +#define LOADER_ARG_CNT (LOADER_ARGS - LOADER_ARG_CNT_LEN) /* Number of args. */ +#define LOADER_RAM_PGS (LOADER_ARG_CNT - LOADER_RAM_PGS_LEN) /* # RAM pages. */ -#endif /* loader.h */ +/* Sizes of loader data structures. */ +#define LOADER_SIG_LEN 2 +#define LOADER_ARGS_LEN 128 +#define LOADER_ARG_CNT_LEN 4 +#define LOADER_RAM_PGS_LEN 4 + +/* 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 /* threads/loader.h */