X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?p=pintos-anon;a=blobdiff_plain;f=src%2Fuserprog%2Ftss.c;h=569e8d183336657aa82e04f882cd9ebd80c65b0d;hp=f103823bb869d765b9fb5e28e1a5bd4d8090f29f;hb=9a602e952252dbfb1332f5137dd7c33a21b6fc6d;hpb=e48bfc15bb4241e1df3b32d8e4aca6a34efea6c3 diff --git a/src/userprog/tss.c b/src/userprog/tss.c index f103823..569e8d1 100644 --- a/src/userprog/tss.c +++ b/src/userprog/tss.c @@ -82,9 +82,9 @@ tss_init (void) few fields of it are ever referenced, and those are the only ones we initialize. */ tss = palloc_get_page (PAL_ASSERT | PAL_ZERO); - tss->esp0 = ptov(0x20000); tss->ss0 = SEL_KDSEG; tss->bitmap = 0xdfff; + tss_update (); } /* Returns the kernel TSS. */ @@ -95,10 +95,11 @@ tss_get (void) return tss; } -/* Sets the ring 0 stack pointer in the TSS to ESP0. */ +/* Sets the ring 0 stack pointer in the TSS to point to the end + of the thread stack. */ void -tss_set_esp0 (uint8_t *esp0) +tss_update (void) { ASSERT (tss != NULL); - tss->esp0 = esp0; + tss->esp0 = (uint8_t *) thread_current () + PGSIZE; }