Fix Bug in thread.c: Only initialise and destroy mmap files table if VM is defined
This commit is contained in:
@@ -15,11 +15,13 @@
|
|||||||
#include "threads/switch.h"
|
#include "threads/switch.h"
|
||||||
#include "threads/synch.h"
|
#include "threads/synch.h"
|
||||||
#include "threads/vaddr.h"
|
#include "threads/vaddr.h"
|
||||||
#include "vm/page.h"
|
|
||||||
#include "vm/mmap.h"
|
|
||||||
#ifdef USERPROG
|
#ifdef USERPROG
|
||||||
#include "userprog/process.h"
|
#include "userprog/process.h"
|
||||||
#include "userprog/syscall.h"
|
#include "userprog/syscall.h"
|
||||||
|
#include "vm/page.h"
|
||||||
|
#endif
|
||||||
|
#ifdef VM
|
||||||
|
#include "vm/mmap.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Random value for struct thread's `magic' member.
|
/* Random value for struct thread's `magic' member.
|
||||||
@@ -275,7 +277,9 @@ thread_create (const char *name, int priority,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef VM
|
||||||
mmap_init ();
|
mmap_init ();
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Prepare thread for first run by initializing its stack.
|
/* Prepare thread for first run by initializing its stack.
|
||||||
Do this atomically so intermediate values for the 'stack'
|
Do this atomically so intermediate values for the 'stack'
|
||||||
@@ -397,7 +401,9 @@ thread_exit (void)
|
|||||||
process_exit ();
|
process_exit ();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef VM
|
||||||
mmap_destroy ();
|
mmap_destroy ();
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Remove thread from all threads list, set our status to dying,
|
/* Remove thread from all threads list, set our status to dying,
|
||||||
and schedule another process. That process will destroy us
|
and schedule another process. That process will destroy us
|
||||||
|
|||||||
Reference in New Issue
Block a user