projects
/
pintos-anon
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix two bugs:
[pintos-anon]
/
src
/
threads
/
thread.c
diff --git
a/src/threads/thread.c
b/src/threads/thread.c
index 5229aef34d013b5bfd8bcd9c09a2983637018dc9..8d9f33558bb5313b1e137250479b5103a88db689 100644
(file)
--- a/
src/threads/thread.c
+++ b/
src/threads/thread.c
@@
-7,10
+7,10
@@
#include "threads/flags.h"
#include "threads/interrupt.h"
#include "threads/intr-stubs.h"
#include "threads/flags.h"
#include "threads/interrupt.h"
#include "threads/intr-stubs.h"
-#include "threads/mmu.h"
#include "threads/palloc.h"
#include "threads/switch.h"
#include "threads/synch.h"
#include "threads/palloc.h"
#include "threads/switch.h"
#include "threads/synch.h"
+#include "threads/vaddr.h"
#ifdef USERPROG
#include "userprog/process.h"
#endif
#ifdef USERPROG
#include "userprog/process.h"
#endif
@@
-92,7
+92,7
@@
thread_init (void)
void
thread_start (void)
{
void
thread_start (void)
{
- thread_create ("idle", PRI_M
AX
, idle, NULL);
+ thread_create ("idle", PRI_M
IN
, idle, NULL);
intr_enable ();
}
intr_enable ();
}
@@
-365,7
+365,8
@@
idle (void *aux UNUSED)
one to occur, wasting as much as one clock tick worth of
time.
one to occur, wasting as much as one clock tick worth of
time.
- See [IA32-v2a] "HLT", [IA32-v2b] "STI", and [IA32-v3] 7.7. */
+ See [IA32-v2a] "HLT", [IA32-v2b] "STI", and [IA32-v3a]
+ 7.11.1 "HLT Instruction". */
asm ("sti; hlt");
}
}
asm ("sti; hlt");
}
}
@@
-482,12
+483,13
@@
schedule_tail (struct thread *prev)
/* If the thread we switched from is dying, destroy its struct
thread. This must happen late so that thread_exit() doesn't
/* If the thread we switched from is dying, destroy its struct
thread. This must happen late so that thread_exit() doesn't
- pull out the rug under itself. */
- if (prev != NULL && prev->status == THREAD_DYING)
+ pull out the rug under itself. (We don't free
+ initial_thread because its memory was not obtained via
+ palloc().) */
+ if (prev != NULL && prev->status == THREAD_DYING && prev != initial_thread)
{
ASSERT (prev != cur);
{
ASSERT (prev != cur);
- if (prev != initial_thread)
- palloc_free_page (prev);
+ palloc_free_page (prev);
}
}
}
}