From 5d1a6ed11fee1efccec0b7d8cb30bdc42a52c584 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Thu, 26 May 2005 20:21:35 +0000 Subject: [PATCH] Get rid of unnecessary barrier. Improve comment. --- src/userprog/process.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/userprog/process.c b/src/userprog/process.c index b1e11d1..31629c7 100644 --- a/src/userprog/process.c +++ b/src/userprog/process.c @@ -103,13 +103,12 @@ process_exit (void) if (pd != NULL) { /* We must set cur->pagedir to NULL before switching page - directories, or a timer interrupt might switch back to - the process page directory. The asm statement prevents - GCC from reordering the assignment and the function - calls. */ + directories, so that a timer interrupt can't switch back + to the process page directory. We must activate the + base page directory before destroying the process's page + directory, or our active page directory will be one + that's been freed (and cleared). */ cur->pagedir = NULL; - asm volatile (""); - pagedir_activate (NULL); pagedir_destroy (pd); } @@ -351,10 +350,10 @@ load_segment (struct file *file, const struct Elf32_Phdr *phdr) /* Validate virtual memory region to be mapped. The region must both start and end within the user address space range starting at 0 and ending at PHYS_BASE (typically - 3 GB == 0xc0000000). */ + 3 GB == 0xc0000000). We don't allow mapping page 0 .*/ start = pg_round_down ((void *) phdr->p_vaddr); end = pg_round_up ((void *) (phdr->p_vaddr + phdr->p_memsz)); - if (start >= PHYS_BASE || end >= PHYS_BASE || end < start) + if (start == 0 || start >= PHYS_BASE || end >= PHYS_BASE || end < start) { printf ("bad virtual region %08lx...%08lx\n", (unsigned long) start, (unsigned long) end); -- 2.30.2