remove uvm_map_protect from cpu_startup of several ports.

- they shouldn't be needed with the current fault handler.
- they causes assertion failure with the recent vm_map implementation.

discussed on tech-kern@.  reviewed by Chuck Silvers.
PR/29179 from Julio M. Merino Vidal.
This commit is contained in:
yamt 2005-02-11 15:03:55 +00:00
parent e392f6d248
commit 18acc63fc4
8 changed files with 16 additions and 157 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.134 2004/03/24 15:34:47 atatat Exp $ */
/* $NetBSD: machdep.c,v 1.135 2005/02/11 15:03:55 yamt Exp $ */
/*
* Copyright (c) 1982, 1986, 1990 The Regents of the University of California.
@ -77,7 +77,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.134 2004/03/24 15:34:47 atatat Exp $");
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.135 2005/02/11 15:03:55 yamt Exp $");
#include "opt_ddb.h"
#include "opt_compat_netbsd.h"
@ -228,7 +228,6 @@ consinit()
void
cpu_startup()
{
extern void etext __P((void));
extern int iomem_malloc_safe;
char pbuf[9];
@ -277,26 +276,6 @@ cpu_startup()
nmbclusters * mclbytes, VM_MAP_INTRSAFE,
FALSE, NULL);
/*
* Tell the VM system that page 0 isn't mapped.
*
* XXX This is bogus; should just fix KERNBASE and
* XXX VM_MIN_KERNEL_ADDRESS, but not right now.
*/
if (uvm_map_protect(kernel_map, 0, PAGE_SIZE, UVM_PROT_NONE, TRUE) != 0)
panic("can't mark page 0 off-limits");
/*
* Tell the VM system that writing to kernel text isn't allowed.
* If we don't, we might end up COW'ing the text segment!
*
* XXX Should be m68k_trunc_page(&kernel_text) instead
* XXX of PAGE_SIZE.
*/
if (uvm_map_protect(kernel_map, PAGE_SIZE, m68k_round_page(&etext),
UVM_PROT_READ|UVM_PROT_EXEC, TRUE) != 0)
panic("can't protect kernel text");
#ifdef DEBUG
pmapdebug = opmapdebug;
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.28 2004/03/24 15:34:48 atatat Exp $ */
/* $NetBSD: machdep.c,v 1.29 2005/02/11 15:03:55 yamt Exp $ */
/*
* Copyright (c) 1982, 1986, 1990, 1993
@ -77,7 +77,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.28 2004/03/24 15:34:48 atatat Exp $");
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.29 2005/02/11 15:03:55 yamt Exp $");
#include "opt_bufcache.h"
#include "opt_ddb.h"
@ -293,7 +293,6 @@ consinit()
void
cpu_startup()
{
extern char *etext;
vaddr_t minaddr, maxaddr;
#ifdef DEBUG
extern int pmapdebug;
@ -337,14 +336,6 @@ cpu_startup()
pmapdebug = opmapdebug;
#endif
printf("avail mem = %ld\n", ptoa(uvmexp.free));
/*
* Tell the VM system that writing to kernel text isn't allowed.
* If we don't, we might end up COW'ing the text segment!
*/
if (uvm_map_protect(kernel_map, KERNBASE, m68k_round_page(&etext),
UVM_PROT_READ|UVM_PROT_EXEC, TRUE) != 0)
panic("can't protect kernel text");
}
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.38 2004/03/24 15:34:49 atatat Exp $ */
/* $NetBSD: machdep.c,v 1.39 2005/02/11 15:03:55 yamt Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@ -38,7 +38,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.38 2004/03/24 15:34:49 atatat Exp $");
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.39 2005/02/11 15:03:55 yamt Exp $");
#include "opt_ddb.h"
#include "opt_kgdb.h"
@ -102,9 +102,6 @@ char cpu_model[60];
/* Our exported CPU info; we can have only one. */
struct cpu_info cpu_info_store;
extern char kernel_text[];
extern char etext[];
struct vm_map *exec_map = NULL;
struct vm_map *mb_map = NULL;
struct vm_map *phys_map = NULL;
@ -292,26 +289,6 @@ cpu_startup()
format_bytes(pbuf, sizeof(pbuf), ptoa(uvmexp.free));
printf("avail memory = %s\n", pbuf);
/*
* Tell the VM system that the area before the text segment
* is invalid.
*
* XXX Should just change KERNBASE and VM_MIN_KERNEL_ADDRESS,
* XXX but not right now.
*/
if (uvm_map_protect(kernel_map, 0, round_page((vaddr_t)&kernel_text),
UVM_PROT_NONE, TRUE) != 0)
panic("can't mark pre-text pages off-limits");
/*
* Tell the VM system that writing to kernel text isn't allowed.
* If we don't, we might end up COW'ing the text segment!
*/
if (uvm_map_protect(kernel_map, trunc_page((vaddr_t)&kernel_text),
trunc_page((vaddr_t)&etext), UVM_PROT_READ|UVM_PROT_EXEC, TRUE)
!= 0)
panic("can't protect kernel text");
/*
* Say "Hi" to the world
*/

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.301 2005/01/15 16:00:59 chs Exp $ */
/* $NetBSD: machdep.c,v 1.302 2005/02/11 15:03:56 yamt Exp $ */
/*
* Copyright (c) 1982, 1990 The Regents of the University of California.
@ -107,7 +107,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.301 2005/01/15 16:00:59 chs Exp $");
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.302 2005/02/11 15:03:56 yamt Exp $");
#include "opt_adb.h"
#include "opt_ddb.h"
@ -421,8 +421,6 @@ consinit(void)
void
cpu_startup(void)
{
extern char *start;
extern char *etext;
int vers;
vaddr_t minaddr, maxaddr;
int delay;
@ -478,19 +476,6 @@ cpu_startup(void)
format_bytes(pbuf, sizeof(pbuf), ptoa(uvmexp.free));
printf("avail memory = %s\n", pbuf);
/*
* Tell the VM system that writing to kernel text isn't allowed.
* If we don't, we might end up COW'ing the text segment!
*
* XXX I'd like this to be m68k_trunc_page(&kernel_text) instead
* XXX of the reference to &start, but we have to keep the
* XXX interrupt vectors and such writable for the Mac toolbox.
*/
if (uvm_map_protect(kernel_map,
m68k_trunc_page(&start + (PAGE_SIZE - 1)), m68k_round_page(&etext),
(UVM_PROT_READ | UVM_PROT_EXEC), TRUE) != 0)
panic("can't protect kernel text");
/*
* Set up CPU-specific registers, cache, etc.
*/

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.110 2004/03/24 15:34:50 atatat Exp $ */
/* $NetBSD: machdep.c,v 1.111 2005/02/11 15:03:56 yamt Exp $ */
/*
* Copyright (c) 1982, 1986, 1990, 1993
@ -77,7 +77,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.110 2004/03/24 15:34:50 atatat Exp $");
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.111 2005/02/11 15:03:56 yamt Exp $");
#include "opt_ddb.h"
#include "opt_compat_hpux.h"
@ -468,7 +468,6 @@ consinit()
void
cpu_startup()
{
extern char *kernel_text, *etext;
u_quad_t vmememsize;
vaddr_t minaddr, maxaddr;
char pbuf[9];
@ -536,26 +535,6 @@ cpu_startup()
format_bytes(pbuf, sizeof(pbuf), ptoa(uvmexp.free));
printf("avail memory = %s\n", pbuf);
/*
* Tell the VM system that the area before the text segment
* is invalid.
*
* XXX Should just change KERNBASE and VM_MIN_KERNEL_ADDRESS,
* XXX but not right now.
*/
if (uvm_map_protect(kernel_map, 0, round_page((vaddr_t)&kernel_text),
UVM_PROT_NONE, TRUE) != 0)
panic("can't mark pre-text pages off-limits");
/*
* Tell the VM system that writing to the kernel text isn't allowed.
* If we don't, we might end up COW'ing the text segment!
*/
if (uvm_map_protect(kernel_map, trunc_page((vaddr_t)&kernel_text),
round_page((vaddr_t)&etext), UVM_PROT_READ|UVM_PROT_EXEC, TRUE)
!= 0)
panic("can't protect kernel text");
/*
* Set up CPU-specific registers, cache, etc.
*/

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.54 2005/01/01 04:54:29 tsutsui Exp $ */
/* $NetBSD: machdep.c,v 1.55 2005/02/11 15:03:56 yamt Exp $ */
/*
* Copyright (c) 1982, 1986, 1990, 1993
@ -77,7 +77,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.54 2005/01/01 04:54:29 tsutsui Exp $");
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.55 2005/02/11 15:03:56 yamt Exp $");
#include "opt_ddb.h"
#include "opt_compat_netbsd.h"
@ -154,7 +154,6 @@ int physmem = MAXMEM; /* max supported memory, changes to actual */
int safepri = PSL_LOWIPL;
extern paddr_t avail_start, avail_end;
extern char *kernel_text, *etext;
extern int end, *esym;
extern u_int lowram;
@ -294,25 +293,6 @@ cpu_startup(void)
format_bytes(pbuf, sizeof(pbuf), ptoa(uvmexp.free));
printf("avail memory = %s\n", pbuf);
/*
* Tell the VM system that the area before the text segment
* is invalid.
*
* XXX This is bogus; should just fix KERNBASE and
* XXX VM_MIN_KERNEL_ADDRESS, but not right now.
*/
if (uvm_map_protect(kernel_map, 0, m68k_round_page(&kernel_text),
UVM_PROT_NONE, TRUE) != 0)
panic("can't mark pre-text pages off-limits");
/*
* Tell the VM system that writing to the kernel text isn't allowed.
* If we don't, we might end up COW'ing the text segment!
*/
if (uvm_map_protect(kernel_map, m68k_trunc_page(&kernel_text),
m68k_round_page(&etext), UVM_PROT_READ|UVM_PROT_EXEC, TRUE) != 0)
panic("can't protect kernel text");
/*
* Set up CPU-specific registers, cache, etc.
*/

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.70 2005/01/19 01:58:21 chs Exp $ */
/* $NetBSD: machdep.c,v 1.71 2005/02/11 15:03:56 yamt Exp $ */
/*
* Copyright (c) 1998 Darrin B. Jewell
@ -79,7 +79,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.70 2005/01/19 01:58:21 chs Exp $");
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.71 2005/02/11 15:03:56 yamt Exp $");
#include "opt_ddb.h"
#include "opt_kgdb.h"
@ -321,7 +321,6 @@ consinit(void)
void
cpu_startup(void)
{
extern char *kernel_text, *etext;
vaddr_t minaddr, maxaddr;
char pbuf[9];
#ifdef DEBUG
@ -373,26 +372,6 @@ cpu_startup(void)
format_bytes(pbuf, sizeof(pbuf), ptoa(uvmexp.free));
printf("avail memory = %s\n", pbuf);
/*
* Tell the VM system that the area before the text segment
* is invalid.
*
* XXX Should just change KERNBASE and VM_MIN_KERNEL_ADDRESS,
* XXX but not right now.
*/
if (uvm_map_protect(kernel_map, 0, round_page((vaddr_t)&kernel_text),
UVM_PROT_NONE, TRUE) != 0)
panic("can't mark pre-text pages off-limits");
/*
* Tell the VM system that writing to the kernel text isn't allowed.
* If we don't, we might end up COW'ing the text segment!
*/
if (uvm_map_protect(kernel_map, trunc_page((vaddr_t)&kernel_text),
round_page((vaddr_t)&etext), UVM_PROT_READ|UVM_PROT_EXEC, TRUE)
!= 0)
panic("can't protect kernel text");
/*
* Set up CPU-specific registers, cache, etc.
*/

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.158 2004/03/24 15:34:51 atatat Exp $ */
/* $NetBSD: machdep.c,v 1.159 2005/02/11 15:03:56 yamt Exp $ */
/*-
* Copyright (c) 1982, 1987, 1990 The Regents of the University of California.
@ -75,7 +75,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.158 2004/03/24 15:34:51 atatat Exp $");
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.159 2005/02/11 15:03:56 yamt Exp $");
#include "opt_ddb.h"
#include "opt_kgdb.h"
@ -186,7 +186,6 @@ static void map __P((pd_entry_t *, vaddr_t, paddr_t, int, int));
void
cpu_startup()
{
extern char kernel_text[];
char pbuf[9];
vaddr_t minaddr, maxaddr;
int i;
@ -230,16 +229,6 @@ cpu_startup()
mb_map = uvm_km_suballoc(kernel_map, &minaddr, &maxaddr,
nmbclusters * mclbytes, VM_MAP_INTRSAFE, FALSE, NULL);
/*
* Tell the VM system that writing to kernel text isn't allowed.
* If we don't, we might end up COW'ing the text segment!
*/
if (uvm_map_protect(kernel_map,
ns532_round_page(&kernel_text),
ns532_round_page(&etext),
UVM_PROT_READ|UVM_PROT_EXEC, TRUE) != 0)
panic("can't protect kernel text");
format_bytes(pbuf, sizeof(pbuf), ptoa(uvmexp.free));
printf("avail memory = %s\n", pbuf);
}