X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fuserprog%2Fgdt.c;h=bed5d582fc45daf8df0f9212d4ec1674327eda5c;hb=94e3568f3303b757f9e4133524b647163792662d;hp=4e338f7604df43a264499b1e95827b68e307825e;hpb=f6580e9ad405b519dbe85027691bf3c66074b0a4;p=pintos-anon diff --git a/src/userprog/gdt.c b/src/userprog/gdt.c index 4e338f7..bed5d58 100644 --- a/src/userprog/gdt.c +++ b/src/userprog/gdt.c @@ -1,8 +1,8 @@ -#include "gdt.h" -#include "tss.h" -#include "lib/debug.h" -#include "threads/mmu.h" +#include "userprog/gdt.h" +#include +#include "userprog/tss.h" #include "threads/palloc.h" +#include "threads/vaddr.h" /* The Global Descriptor Table (GDT). @@ -20,7 +20,8 @@ stack switching on interrupts. For more information on the GDT as used here, refer to - [IA32-v3] sections 3.2 through 3.5. */ + [IA32-v3a] 3.2 "Using Segments" through 3.5 "System Descriptor + Types". */ static uint64_t gdt[SEL_CNT]; /* GDT helpers. */ @@ -44,7 +45,9 @@ gdt_init (void) gdt[SEL_UDSEG / sizeof *gdt] = make_data_desc (3); gdt[SEL_TSS / sizeof *gdt] = make_tss_desc (tss_get ()); - /* Load GDTR, TR. See [IA32-v3] 2.4.1, 2.4.4, 6.2.3. */ + /* Load GDTR, TR. See [IA32-v3a] 2.4.1 "Global Descriptor + Table Register (GDTR)", 2.4.4 "Task Register (TR)", and + 6.2.4 "Task Register". */ gdtr_operand = make_gdtr_operand (sizeof gdt - 1, gdt); asm volatile ("lgdt %0" :: "m" (gdtr_operand)); asm volatile ("ltr %w0" :: "r" (SEL_TSS)); @@ -74,7 +77,7 @@ enum seg_granularity it can be used in rings numbered DPL or lower. In practice, DPL==3 means that user processes can use the segment and DPL==0 means that only the kernel can use the segment. See - [IA32-v3] section 4.5 for further discussion. */ + [IA32-v3a] 4.5 "Privilege Levels" for further discussion. */ static uint64_t make_seg_desc (uint32_t base, uint32_t limit, @@ -126,7 +129,7 @@ make_data_desc (int dpl) /* Returns a descriptor for an "available" 32-bit Task-State Segment with its base at the given linear address, a limit of 0x67 bytes (the size of a 32-bit TSS), and a DPL of 0. - See [IA32-v3] 6.2.2. */ + See [IA32-v3a] 6.2.2 "TSS Descriptor". */ static uint64_t make_tss_desc (void *laddr) {