|
From: Kenn H. <ke...@us...> - 2001-01-26 00:26:37
|
Update of /cvsroot/linux-vax/kernel-2.4/arch/vax/mm
In directory usw-pr-cvs1:/tmp/cvs-serv25353/arch/vax/mm
Modified Files:
init.c ioremap.c pgtable.c
Log Message:
Bring forward all 2.2 work from before new year. This should give us
all a (somewhat) bootable kernel.
Index: init.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/arch/vax/mm/init.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- init.c 2001/01/17 16:13:57 1.1
+++ init.c 2001/01/26 00:27:00 1.2
@@ -1,18 +1,31 @@
-/* vax/mm/init.c
+/* $Id$
* initialise the VM system.
* Copyright atp Nov 1998
* GNU GPL
*/
+#include <linux/kernel.h>
#include <linux/mm.h>
#include <linux/swap.h>
+#include <linux/bootmem.h>
+#include <linux/init.h>
-#include <asm/init.h>
-#include <asm/page.h>
-#include <asm/bitops.h>
+#include <asm/pgtable.h>
+#include <asm/rpb.h>
-extern unsigned long free_area_init(unsigned long, unsigned long);
+static unsigned long totalram_pages;
+static unsigned long totalhigh_pages;
+unsigned long empty_zero_page[PAGE_SIZE/sizeof(unsigned long)] __attribute__ ((__aligned__ (PAGE_SIZE)));
+
+
+/* This is task 0's PGD structure. Entries 4 and 5 will be filled with
+ the system page table base and size by head.S. The remaining
+ entries (0 to 3) will be left at zero as there is no valid user
+ context in task 0. */
+
+pgd_t swapper_pg_dir[PTRS_PER_PGD];
+
/*
* In other architectures, paging_init sets up the kernel's page tables.
* In Linux/VAX, this is already done by the early boot code, so all we
@@ -20,24 +33,13 @@
*
* The start_mem and end_mem addresses are virtual addresses
*/
-__init unsigned long
-paging_init(unsigned long start_mem, unsigned long end_mem)
+void __init
+paging_init()
{
- unsigned long pfn;
-
- /* initialize mem_map[] */
- start_mem = free_area_init(start_mem, end_mem);
-
- /* free_area_init() has marked all pages as reserved.
- We now unreserve all pages except the stack. The
- pages actually used by the kernel will be reserved
- my mem_init() later. */
-
- for (pfn=MAP_NR(0x80005a00); pfn<MAP_NR(end_mem); pfn++) {
- clear_bit(PG_reserved, &mem_map[pfn].flags);
- }
+ unsigned long zones_size[MAX_NR_ZONES] = { 0, 0, 0};
- return start_mem;
+ zones_size[ZONE_DMA] = max_pfn;
+ free_area_init(zones_size);
}
#if DEBUG_POISON
@@ -64,45 +66,23 @@
#endif
void
-mem_init(unsigned long start_mem, unsigned long end_mem)
+mem_init(void)
{
- unsigned long tmp;
-
- end_mem &= PAGE_MASK;
- max_mapnr = num_physpages = MAP_NR(end_mem);
- high_memory = (void *) end_mem;
- start_mem = PAGE_ALIGN(start_mem);
-
- /*
- * Mark the pages used by the kernel as reserved.
- */
- tmp = 0x80000000; /* Reserve everything below kernel start
- to protect stack */
-
- while (tmp < start_mem) {
- set_bit(PG_reserved, &mem_map[MAP_NR(tmp)].flags);
- tmp += PAGE_SIZE;
+ if (!mem_map) {
+ BUG();
}
- printk("Reserved as far as %08lx\n", tmp);
- printk("Freeing remaining memory\n");
+ max_mapnr = num_physpages = max_pfn;
+ high_memory = (void *) __va(max_pfn * PAGE_SIZE);
- for (tmp = PAGE_OFFSET ; tmp < end_mem ; tmp += PAGE_SIZE) {
- if (PageReserved(mem_map+MAP_NR(tmp)))
- continue;
-
- atomic_set(&mem_map[MAP_NR(tmp)].count, 1);
-#ifdef CONFIG_BLK_DEV_INITRD
- if (initrd_start && tmp >= initrd_start && tmp < initrd_end)
- continue;
-#endif
- kill_page(tmp);
- free_page(tmp);
- }
- printk("Scanned as far as %08lx\n", tmp);
+ /* this will put all low memory onto the freelists */
+ totalram_pages += free_all_bootmem();
+
+ printk("Memory: %luk/%luk available\n",
+ (unsigned long) nr_free_pages() * 2,
+ max_mapnr * 2
+ );
- tmp = nr_free_pages << PAGE_SHIFT;
- printk("Memory: %luk available\n", tmp >> 10);
return;
}
@@ -123,25 +103,14 @@
(&__init_end - &__init_begin) >> 10);
}
-void
-si_meminfo(struct sysinfo *val)
+void si_meminfo(struct sysinfo *val)
{
- int i;
-
- i = max_mapnr;
- val->totalram = 0;
- val->sharedram = 0;
- val->freeram = nr_free_pages << PAGE_SHIFT;
- val->bufferram = buffermem;
- while (i-- > 0) {
- if (PageReserved(mem_map+i))
- continue;
- val->totalram++;
- if (!atomic_read(&mem_map[i].count))
- continue;
- val->sharedram += atomic_read(&mem_map[i].count) - 1;
- }
- val->totalram <<= PAGE_SHIFT;
- val->sharedram <<= PAGE_SHIFT;
- return;
+ val->totalram = totalram_pages;
+ val->sharedram = 0;
+ val->freeram = nr_free_pages();
+ val->bufferram = atomic_read(&buffermem_pages);
+ val->totalhigh = totalhigh_pages;
+ val->freehigh = nr_free_highpages();
+ val->mem_unit = PAGE_SIZE;
+ return;
}
Index: ioremap.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/arch/vax/mm/ioremap.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ioremap.c 2001/01/17 16:13:57 1.1
+++ ioremap.c 2001/01/26 00:27:00 1.2
@@ -48,6 +48,7 @@
#include <asm/io.h>
#include <asm/page.h>
#include <asm/pgtable.h>
+#include <asm/pgalloc.h>
/* Defined in head.S */
extern pte_t *iomap_base;
@@ -103,6 +104,7 @@
if ((p - start_pte) != num_ptes) {
/* Unable to find contiguous chunk of IOMAP PTEs */
+ printk("ioremap: cannot find 0x%04x available PTEs\n", num_ptes);
return NULL;
}
Index: pgtable.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/arch/vax/mm/pgtable.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- pgtable.c 2001/01/17 16:13:57 1.1
+++ pgtable.c 2001/01/26 00:27:00 1.2
@@ -1,39 +1,37 @@
-/* arch/vax/mm/pgtable.c copyright atp 1999 */
-/* handle bits of VAX memory management */
+/*
+ * $Id$
+ *
+ * handle bits of VAX memory management
+ */
-#include <asm/page.h>
-#include <asm/system.h>
-#include <asm/ptrace.h>
+#include <linux/sched.h>
+#include <linux/mm.h>
-#if 0
+#include <asm/pgalloc.h>
+
void set_page_dir(struct task_struct * tsk, pgd_t * pgdir)
{
- /* these are all virtual addresses */
- unsigned int flags;
-
- (tsk)->pcb.p0br = (pgdir)->p0br;
- (tsk)->pcb.p0lr = (pgdir)->p0lr;
- (tsk)->pcb.p1br = (pgdir)->p1br;
- (tsk)->pcb.p1lr = (pgdir)->p1lr;
+ /* P0BR and P1BR are virtual addresses */
+ tsk->thread.pcb.p0br = pgd_val(pgdir[0]);
+ tsk->thread.pcb.p0lr = pgd_val(pgdir[1]);
+ tsk->thread.pcb.p1br = pgd_val(pgdir[2]);
+ tsk->thread.pcb.p1lr = pgd_val(pgdir[3]);
/* now if this is the currently running task, up date the registers */
/* This doesnt sound like a great idea... perhaps setipl(31) would
be a good idea here */
- if ((tsk) == current) {
- __save_flags(flags);
- __mtpr( (tsk)->pcb.p0br, PR_P0BR );
- __mtpr( (tsk)->pcb.p0lr, PR_P0LR );
- __mtpr( (tsk)->pcb.p1br, PR_P1BR );
- __mtpr( (tsk)->pcb.p1lr, PR_P1LR );
- __restore_flags(flags);
+ if (tsk == current) {
+ __mtpr(tsk->thread.pcb.p0br, PR_P0BR );
+ __mtpr(tsk->thread.pcb.p0lr, PR_P0LR );
+ __mtpr(tsk->thread.pcb.p1br, PR_P1BR );
+ __mtpr(tsk->thread.pcb.p1lr, PR_P1LR );
+ flush_tlb_all();
}
- /* FIXME: flush TLB? */
}
-#endif
-void set_page_dir(struct task_struct * tsk, pgd_t * pgdir)
+int do_check_pgt_cache(int low_water, int high_water)
{
- printk("Panic: set_page_dir() not yet implemented\n");
- HALT;
+ /* FIXME: implement this */
+ return 0;
}
|