From: Ben Pfaff Date: Sun, 9 Nov 2008 23:56:05 +0000 (-0800) Subject: Rename ram_pages to init_ram_pages. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=94d17ee9287aec1c4c9ee37ca02615e8293a5f3a;p=pintos-anon Rename ram_pages to init_ram_pages. This makes it conform to the Pintos convention that a global symbol name begin with its module's name. --- diff --git a/doc/reference.texi b/doc/reference.texi index bfa0760..d442610 100644 --- a/doc/reference.texi +++ b/doc/reference.texi @@ -133,7 +133,7 @@ initializer, that variable goes into the BSS. Because it's all zeros, the BSS isn't stored in the image that the loader brought into memory. We just use @func{memset} to zero it out. The other task of @func{ram_init} is to read out the machine's memory size from where -the loader stored it and put it into the @code{ram_pages} variable for +the loader stored it and put it into the @code{init_ram_pages} variable for later use. Next, @func{main} calls @func{read_command_line} to break the kernel command diff --git a/src/threads/init.c b/src/threads/init.c index f804b86..d2d3e08 100644 --- a/src/threads/init.c +++ b/src/threads/init.c @@ -38,7 +38,7 @@ #endif /* Amount of physical memory, in 4 kB pages. */ -size_t ram_pages; +size_t init_ram_pages; /* Page directory with kernel mappings only. */ uint32_t *init_page_dir; @@ -80,7 +80,8 @@ main (void) console_init (); /* Greet user. */ - printf ("Pintos booting with %'zu kB RAM...\n", ram_pages * PGSIZE / 1024); + printf ("Pintos booting with %'zu kB RAM...\n", + init_ram_pages * PGSIZE / 1024); /* Initialize memory system. */ palloc_init (user_page_limit); @@ -138,7 +139,7 @@ ram_init (void) memset (&_start_bss, 0, &_end_bss - &_start_bss); /* Get RAM size from loader. See loader.S. */ - ram_pages = *(uint32_t *) ptov (LOADER_RAM_PGS); + init_ram_pages = *(uint32_t *) ptov (LOADER_RAM_PGS); } /* Populates the base page directory and page table with the @@ -159,7 +160,7 @@ paging_init (void) pd = init_page_dir = palloc_get_page (PAL_ASSERT | PAL_ZERO); pt = NULL; - for (page = 0; page < ram_pages; page++) + for (page = 0; page < init_ram_pages; page++) { uintptr_t paddr = page * PGSIZE; char *vaddr = ptov (paddr); diff --git a/src/threads/init.h b/src/threads/init.h index a5c7500..da6cc04 100644 --- a/src/threads/init.h +++ b/src/threads/init.h @@ -7,7 +7,7 @@ #include /* Physical memory size, in 4 kB pages. */ -extern size_t ram_pages; +extern size_t init_ram_pages; /* Page directory with kernel mappings only. */ extern uint32_t *init_page_dir; diff --git a/src/threads/palloc.c b/src/threads/palloc.c index b2fcafe..177001f 100644 --- a/src/threads/palloc.c +++ b/src/threads/palloc.c @@ -52,7 +52,7 @@ palloc_init (size_t user_page_limit) /* Free memory. */ uint8_t *free_start = pg_round_up (&_end); - uint8_t *free_end = ptov (ram_pages * PGSIZE); + uint8_t *free_end = ptov (init_ram_pages * PGSIZE); size_t free_pages = (free_end - free_start) / PGSIZE; size_t user_pages = free_pages / 2; size_t kernel_pages; diff --git a/src/userprog/pagedir.c b/src/userprog/pagedir.c index 1442d40..a6a87b8 100644 --- a/src/userprog/pagedir.c +++ b/src/userprog/pagedir.c @@ -103,7 +103,7 @@ pagedir_set_page (uint32_t *pd, void *upage, void *kpage, bool writable) ASSERT (pg_ofs (upage) == 0); ASSERT (pg_ofs (kpage) == 0); ASSERT (is_user_vaddr (upage)); - ASSERT (vtop (kpage) >> PTSHIFT < ram_pages); + ASSERT (vtop (kpage) >> PTSHIFT < init_ram_pages); ASSERT (pd != init_page_dir); pte = lookup_page (pd, upage, true);