From 5e083578278e340e0661f2dede68676432269f49 Mon Sep 17 00:00:00 2001 From: Robert Morris Date: Tue, 30 Aug 2011 20:50:19 -0400 Subject: [PATCH] enterpgdir -> entrypgdir --- entry.S | 4 ++-- main.c | 10 +++++----- usertests.c | 21 +++++++++++++++++---- 3 files changed, 24 insertions(+), 11 deletions(-) diff --git a/entry.S b/entry.S index cf45bf3..d228e88 100644 --- a/entry.S +++ b/entry.S @@ -44,11 +44,11 @@ entry: orl $(CR4_PSE), %eax movl %eax, %cr4 # Set page directory - movl $(V2P_WO(enterpgdir)), %eax + movl $(V2P_WO(entrypgdir)), %eax movl %eax, %cr3 # Turn on paging. movl %cr0, %eax - orl $(CR0_PE|CR0_PG|CR0_WP), %eax + orl $(CR0_PG|CR0_WP), %eax movl %eax, %cr0 # now switch to using addresses above KERNBASE diff --git a/main.c b/main.c index 9ebd7c8..23e0316 100644 --- a/main.c +++ b/main.c @@ -60,7 +60,7 @@ mpmain(void) scheduler(); // start running processes } -pde_t enterpgdir[]; // For entry.S +pde_t entrypgdir[]; // For entry.S // Start the non-boot (AP) processors. static void @@ -83,15 +83,15 @@ startothers(void) // Tell entryother.S what stack to use, the address of mpenter and pgdir; // We cannot use kpgdir yet, because the AP processor is running in low - // memory, so we use enterpgdir for the APs too. kalloc can return addresses + // memory, so we use entrypgdir for the APs too. kalloc can return addresses // above 4Mbyte (the machine may have much more physical memory than 4Mbyte), which - // aren't mapped by enterpgdir, so we must allocate a stack using enter_alloc(); + // aren't mapped by entrypgdir, so we must allocate a stack using enter_alloc(); // This introduces the constraint that xv6 cannot use kalloc until after these // last enter_alloc invocations. stack = enter_alloc(); *(void**)(code-4) = stack + KSTACKSIZE; *(void**)(code-8) = mpenter; - *(int**)(code-12) = (void *) v2p(enterpgdir); + *(int**)(code-12) = (void *) v2p(entrypgdir); lapicstartap(c->id, v2p(code)); @@ -106,7 +106,7 @@ startothers(void) // hence the "__aligned__" attribute. // Use PTE_PS in page directory entry to enable 4Mbyte pages. __attribute__((__aligned__(PGSIZE))) -pde_t enterpgdir[NPDENTRIES] = { +pde_t entrypgdir[NPDENTRIES] = { // Map VA's [0, 4MB) to PA's [0, 4MB) [0] = (0) + PTE_P + PTE_W + PTE_PS, // Map VA's [KERNBASE, KERNBASE+4MB) to PA's [0, 4MB) diff --git a/usertests.c b/usertests.c index 455e68a..655610c 100644 --- a/usertests.c +++ b/usertests.c @@ -1,3 +1,4 @@ +#include "param.h" #include "types.h" #include "stat.h" #include "user.h" @@ -240,8 +241,10 @@ pipe1(void) if(cc > sizeof(buf)) cc = sizeof(buf); } - if(total != 5 * 1033) + if(total != 5 * 1033){ printf(1, "pipe1 oops 3 total %d\n", total); + exit(); + } close(fds[0]); wait(); } else { @@ -401,10 +404,12 @@ sharedfd(void) } close(fd); unlink("sharedfd"); - if(nc == 10000 && np == 10000) + if(nc == 10000 && np == 10000){ printf(1, "sharedfd ok\n"); - else + } else { printf(1, "sharedfd oops %d %d\n", nc, np); + exit(); + } } // two processes write two different files at the same @@ -423,7 +428,7 @@ twofiles(void) pid = fork(); if(pid < 0){ printf(1, "fork failed\n"); - return; + exit(); } fname = pid ? "f1" : "f2"; @@ -1582,6 +1587,14 @@ fsfull() printf(1, "fsfull test finished\n"); } +unsigned long randstate = 1; +unsigned int +rand() +{ + randstate = randstate * 1664525 + 1013904223; + return randstate; +} + int main(int argc, char *argv[]) {