Module Name: src Committed By: tsutsui Date: Wed Dec 2 15:47:45 UTC 2009
Modified Files: src/sys/arch/m68k/include: pcb.h pmap_motorola.h src/sys/arch/m68k/m68k: pmap_motorola.c Log Message: Add a common pmap_bootstrap_finalize() function which initializes lwp0 uarea, curlwp, and curpcb after MMU is turned on, using lwp0uarea variable saved during pmap_bootstrap() (or equivalent functions) for pmap_motorola based ports. Discussed with rm...@. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sys/arch/m68k/include/pcb.h cvs rdiff -u -r1.21 -r1.22 src/sys/arch/m68k/include/pmap_motorola.h cvs rdiff -u -r1.51 -r1.52 src/sys/arch/m68k/m68k/pmap_motorola.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/m68k/include/pcb.h diff -u src/sys/arch/m68k/include/pcb.h:1.7 src/sys/arch/m68k/include/pcb.h:1.8 --- src/sys/arch/m68k/include/pcb.h:1.7 Sun Mar 4 06:00:04 2007 +++ src/sys/arch/m68k/include/pcb.h Wed Dec 2 15:47:45 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: pcb.h,v 1.7 2007/03/04 06:00:04 christos Exp $ */ +/* $NetBSD: pcb.h,v 1.8 2009/12/02 15:47:45 tsutsui Exp $ */ /* * Copyright (c) 1982, 1986, 1990, 1993 @@ -105,4 +105,7 @@ struct md_coredump { int md_exec[16]; /* exec structure for HP-UX core dumps */ }; + +extern struct pcb *curpcb; + #endif /* _M68K_PCB_H_ */ Index: src/sys/arch/m68k/include/pmap_motorola.h diff -u src/sys/arch/m68k/include/pmap_motorola.h:1.21 src/sys/arch/m68k/include/pmap_motorola.h:1.22 --- src/sys/arch/m68k/include/pmap_motorola.h:1.21 Wed Aug 26 00:30:02 2009 +++ src/sys/arch/m68k/include/pmap_motorola.h Wed Dec 2 15:47:45 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap_motorola.h,v 1.21 2009/08/26 00:30:02 thorpej Exp $ */ +/* $NetBSD: pmap_motorola.h,v 1.22 2009/12/02 15:47:45 tsutsui Exp $ */ /* * Copyright (c) 1991, 1993 @@ -191,6 +191,10 @@ extern void *CADDR1, *CADDR2; extern void *msgbufaddr; +/* for lwp0 uarea initialization after MMU enabled */ +extern vaddr_t lwp0uarea; +void pmap_bootstrap_finalize(void); + vaddr_t pmap_map(vaddr_t, paddr_t, paddr_t, int); void pmap_procwr(struct proc *, vaddr_t, size_t); #define PMAP_NEED_PROCWR Index: src/sys/arch/m68k/m68k/pmap_motorola.c diff -u src/sys/arch/m68k/m68k/pmap_motorola.c:1.51 src/sys/arch/m68k/m68k/pmap_motorola.c:1.52 --- src/sys/arch/m68k/m68k/pmap_motorola.c:1.51 Mon Nov 23 00:11:44 2009 +++ src/sys/arch/m68k/m68k/pmap_motorola.c Wed Dec 2 15:47:45 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap_motorola.c,v 1.51 2009/11/23 00:11:44 rmind Exp $ */ +/* $NetBSD: pmap_motorola.c,v 1.52 2009/12/02 15:47:45 tsutsui Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -117,7 +117,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: pmap_motorola.c,v 1.51 2009/11/23 00:11:44 rmind Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap_motorola.c,v 1.52 2009/12/02 15:47:45 tsutsui Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -240,6 +240,8 @@ struct vm_map *st_map, *pt_map; struct vm_map_kernel st_map_store, pt_map_store; +vaddr_t lwp0uarea; /* lwp0 u-area VA, initialized in bootstrap */ + paddr_t avail_start; /* PA of first available physical page */ paddr_t avail_end; /* PA of last available physical page */ vsize_t mem_size; /* memory size in bytes */ @@ -314,6 +316,22 @@ #define PRM_KEEPPTPAGE 0x04 /* + * pmap_bootstrap_finalize: [ INTERFACE ] + * + * Initialize lwp0 uarea, curlwp, and curpcb after MMU is turned on, + * using lwp0uarea variable saved during pmap_bootstrap(). + */ +void +pmap_bootstrap_finalize(void) +{ + + memset((void *)lwp0uarea, 0, USPACE); + uvm_lwp_setuarea(&lwp0, lwp0uarea); + curlwp = &lwp0; + curpcb = lwp_getpcb(&lwp0); +} + +/* * pmap_virtual_space: [ INTERFACE ] * * Report the range of available kernel virtual address