summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorDale Rahn <drahn@cvs.openbsd.org>2004-06-24 22:35:57 +0000
committerDale Rahn <drahn@cvs.openbsd.org>2004-06-24 22:35:57 +0000
commitf02777d3423dc56f57ca38be206942d1a6012150 (patch)
tree63c6eeab224da9f1a47b6f772e0acd219574c4dd /sys
parent956816507b79c80359f676418f22524f980c68fe (diff)
Do a better job at containing powerpc specific #defines to PPC_...
ok deraadt@
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/macppc/include/vmparam.h6
-rw-r--r--sys/arch/macppc/macppc/genassym.cf6
-rw-r--r--sys/arch/macppc/macppc/locore.S28
-rw-r--r--sys/arch/macppc/macppc/machdep.c6
-rw-r--r--sys/arch/macppc/macppc/ofw_machdep.c4
-rw-r--r--sys/arch/mvmeppc/include/vmparam.h6
-rw-r--r--sys/arch/mvmeppc/mvmeppc/genassym.cf6
-rw-r--r--sys/arch/mvmeppc/mvmeppc/locore.S28
-rw-r--r--sys/arch/mvmeppc/mvmeppc/machdep.c6
-rw-r--r--sys/arch/powerpc/include/param.h16
-rw-r--r--sys/arch/powerpc/powerpc/pmap.c53
-rw-r--r--sys/arch/powerpc/powerpc/trap.c6
-rw-r--r--sys/arch/powerpc/powerpc/vm_machdep.c10
13 files changed, 94 insertions, 87 deletions
diff --git a/sys/arch/macppc/include/vmparam.h b/sys/arch/macppc/include/vmparam.h
index e54a04e3a10..24a886db06a 100644
--- a/sys/arch/macppc/include/vmparam.h
+++ b/sys/arch/macppc/include/vmparam.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: vmparam.h,v 1.12 2004/01/23 21:20:54 millert Exp $ */
+/* $OpenBSD: vmparam.h,v 1.13 2004/06/24 22:35:56 drahn Exp $ */
/* $NetBSD: vmparam.h,v 1.1 1996/09/30 16:34:38 ws Exp $ */
/*-
@@ -87,13 +87,13 @@
#define VM_MIN_ADDRESS ((vm_offset_t)0)
#define VM_MAXUSER_ADDRESS ((vm_offset_t)0xfffff000)
#define VM_MAX_ADDRESS VM_MAXUSER_ADDRESS
-#define VM_MIN_KERNEL_ADDRESS ((vm_offset_t)(KERNEL_SR << ADDR_SR_SHIFT))
+#define VM_MIN_KERNEL_ADDRESS ((vm_offset_t)(PPC_KERNEL_SR << ADDR_SR_SHIFT))
/* ppc_kvm_stolen is so that vm space can be stolen before vm is fully
* initialized.
*/
extern vm_offset_t ppc_kvm_stolen;
-#define VM_KERN_ADDRESS_SIZE (SEGMENT_LENGTH - (32 * 1024 * 1024))
+#define VM_KERN_ADDRESS_SIZE (PPC_SEGMENT_LENGTH - (32 * 1024 * 1024))
#define VM_MAX_KERNEL_ADDRESS (VM_MIN_KERNEL_ADDRESS + VM_KERN_ADDRESS_SIZE)
#define VM_PHYS_SIZE (USRIOSIZE * PAGE_SIZE)
diff --git a/sys/arch/macppc/macppc/genassym.cf b/sys/arch/macppc/macppc/genassym.cf
index a8bce6e5b4f..ff0301788d1 100644
--- a/sys/arch/macppc/macppc/genassym.cf
+++ b/sys/arch/macppc/macppc/genassym.cf
@@ -1,4 +1,4 @@
-# $OpenBSD: genassym.cf,v 1.10 2004/06/13 21:49:18 niklas Exp $
+# $OpenBSD: genassym.cf,v 1.11 2004/06/24 22:35:56 drahn Exp $
#
# Copyright (c) 1982, 1990 The Regents of the University of California.
# All rights reserved.
@@ -64,8 +64,8 @@ member PCB_FAULT pcb_onfault
struct pmap
member PM_SR pm_sr[0]
-member PM_USRSR pm_sr[USER_SR]
-member PM_KERNELSR pm_sr[KERNEL_SR]
+member PM_USRSR pm_sr[PPC_USER_SR]
+member PM_KERNELSR pm_sr[PPC_KERNEL_SR]
struct proc
member p_forw
diff --git a/sys/arch/macppc/macppc/locore.S b/sys/arch/macppc/macppc/locore.S
index 4536ffd14d6..3e8247f1a61 100644
--- a/sys/arch/macppc/macppc/locore.S
+++ b/sys/arch/macppc/macppc/locore.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: locore.S,v 1.16 2004/06/13 21:49:18 niklas Exp $ */
+/* $OpenBSD: locore.S,v 1.17 2004/06/24 22:35:56 drahn Exp $ */
/* $NetBSD: locore.S,v 1.2 1996/10/16 19:33:09 ws Exp $ */
/*
@@ -260,7 +260,7 @@ _C_LABEL(sw1):
or. %r30,%r30,%r30 /* old process was exiting? */
beq switch_exited
- mfsr %r10,USER_SR /* save USER_SR for copyin/copyout */
+ mfsr %r10,PPC_USER_SR /* save PPC_USER_SR for copyin/copyout*/
mfcr %r11 /* save cr */
mr %r12,%r2 /* save r2 */
stwu %r1,-SFRAMELEN(%r1) /* still running on old stack */
@@ -287,14 +287,14 @@ switch_exited:
addic. %r5,%r5,64
li %r6,0
- mfsr %r8,KERNEL_SR /* save kernel SR */
+ mfsr %r8,PPC_KERNEL_SR /* save kernel SR */
1:
addis %r6,%r6,-0x10000000@ha /* set new procs segment registers */
or. %r6,%r6,%r6 /* This is done from the real address pmap */
lwzu %r7,-4(%r5) /* so we don't have to worry */
mtsrin %r7,%r6 /* about accessibility */
bne 1b
- mtsr KERNEL_SR,%r8 /* restore kernel SR */
+ mtsr PPC_KERNEL_SR,%r8 /* restore kernel SR */
isync
lwz %r1,PCB_SP(%r4) /* get new procs SP */
@@ -307,7 +307,7 @@ switch_exited:
mr %r2,%r12 /* get saved r2 */
mtcr %r11 /* get saved cr */
isync
- mtsr USER_SR,%r10 /* get saved USER_SR */
+ mtsr PPC_USER_SR,%r10 /* get saved PPC_USER_SR */
isync
switch_return:
@@ -810,9 +810,9 @@ _C_LABEL(ddbsize) = .-_C_LABEL(ddblow)
lis %r2,_C_LABEL(curpm)@ha; /* get real address of pmap */ \
lwz %r2,_C_LABEL(curpm)@l(2); \
lwz %r3,PM_USRSR(%r2); \
- mtsr USER_SR,%r3; \
+ mtsr PPC_USER_SR,%r3; \
lwz %r3,PM_KERNELSR(%r2); \
- mtsr KERNEL_SR,%r3; \
+ mtsr PPC_KERNEL_SR,%r3; \
1: mfsprg %r2,1; /* restore cr */ \
mtcr %r2; \
lwz %r2,savearea(0); \
@@ -848,9 +848,9 @@ realtrap:
*/
s_trap:
/* First have to enable KERNEL mapping */
- lis %r31,KERNEL_SEGMENT@ha
- addi %r31,%r31,KERNEL_SEGMENT@l
- mtsr KERNEL_SR,%r31
+ lis %r31,PPC_KERNEL_SEGMENT@ha
+ addi %r31,%r31,PPC_KERNEL_SEGMENT@l
+ mtsr PPC_KERNEL_SR,%r31
FRAME_SETUP(tempsave)
/* Now we can recover interrupts again: */
mfmsr %r7
@@ -1018,9 +1018,9 @@ s_isitrap:
stw %r4,12(%r1); \
stw %r3,8(%r1); \
/* interrupts are recoverable here, and enable translation */ \
- lis %r3,(KERNEL_SEGMENT|SR_SUKEY|SR_PRKEY)@ha; \
- addi %r3,%r3,(KERNEL_SEGMENT|SR_SUKEY|SR_PRKEY)@l; \
- mtsr KERNEL_SR,%r3; \
+ lis %r3,(PPC_KERNEL_SEGMENT|SR_SUKEY|SR_PRKEY)@ha; \
+ addi %r3,%r3,(PPC_KERNEL_SEGMENT|SR_SUKEY|SR_PRKEY)@l; \
+ mtsr PPC_KERNEL_SR,%r3; \
mfmsr %r5; \
ori %r5,%r5,(PSL_IR|PSL_DR|PSL_RI); \
mtmsr %r5; \
@@ -1059,7 +1059,7 @@ intr_exit:
lis %r3,_C_LABEL(curpm)@ha /* get current pmap real address */
lwz %r3,_C_LABEL(curpm)@l(%r3)
lwz %r3,PM_KERNELSR(%r3)
- mtsr KERNEL_SR,%r3 /* Restore kernel SR */
+ mtsr PPC_KERNEL_SR,%r3 /* Restore kernel SR */
lis %r3,_C_LABEL(astpending)@ha /* Test AST pending */
lwz %r4,_C_LABEL(astpending)@l(%r3)
andi. %r4,%r4,1
diff --git a/sys/arch/macppc/macppc/machdep.c b/sys/arch/macppc/macppc/machdep.c
index af8a25ffbaa..645685b1387 100644
--- a/sys/arch/macppc/macppc/machdep.c
+++ b/sys/arch/macppc/macppc/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.66 2004/01/03 00:57:06 pvalchev Exp $ */
+/* $OpenBSD: machdep.c,v 1.67 2004/06/24 22:35:56 drahn Exp $ */
/* $NetBSD: machdep.c,v 1.4 1996/10/16 19:33:11 ws Exp $ */
/*
@@ -1121,7 +1121,7 @@ bus_mem_add_mapping(bus_addr_t bpa, bus_size_t size, int cacheable,
vaddr = VM_MIN_KERNEL_ADDRESS + ppc_kvm_stolen;
ppc_kvm_stolen += alloc_size;
- if (ppc_kvm_stolen > SEGMENT_LENGTH) {
+ if (ppc_kvm_stolen > PPC_SEGMENT_LENGTH) {
panic("ppc_kvm_stolen, out of space");
}
} else {
@@ -1181,7 +1181,7 @@ mapiodev(paddr_t pa, psize_t len)
/* need to steal vm space before kernel vm is initialized */
va = VM_MIN_KERNEL_ADDRESS + ppc_kvm_stolen;
ppc_kvm_stolen += size;
- if (ppc_kvm_stolen > SEGMENT_LENGTH) {
+ if (ppc_kvm_stolen > PPC_SEGMENT_LENGTH) {
panic("ppc_kvm_stolen, out of space");
}
} else {
diff --git a/sys/arch/macppc/macppc/ofw_machdep.c b/sys/arch/macppc/macppc/ofw_machdep.c
index bd2aceb1852..2741b8a1602 100644
--- a/sys/arch/macppc/macppc/ofw_machdep.c
+++ b/sys/arch/macppc/macppc/ofw_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ofw_machdep.c,v 1.24 2004/03/17 15:47:59 drahn Exp $ */
+/* $OpenBSD: ofw_machdep.c,v 1.25 2004/06/24 22:35:56 drahn Exp $ */
/* $NetBSD: ofw_machdep.c,v 1.1 1996/09/30 16:34:50 ws Exp $ */
/*
@@ -186,7 +186,7 @@ restore_ofw_mapping()
pmap_pinit(&ofw_pmap);
- ofw_pmap.pm_sr[KERNEL_SR] = KERNEL_SEGMENT;
+ ofw_pmap.pm_sr[PPC_KERNEL_SR] = PPC_KERNEL_SEGMENT;
for (i = 0; i < N_mapping; i++) {
vm_offset_t pa = ofw_mapping[i].pa;
diff --git a/sys/arch/mvmeppc/include/vmparam.h b/sys/arch/mvmeppc/include/vmparam.h
index 24c037f6ba6..0be296321eb 100644
--- a/sys/arch/mvmeppc/include/vmparam.h
+++ b/sys/arch/mvmeppc/include/vmparam.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: vmparam.h,v 1.11 2004/01/22 23:29:29 miod Exp $ */
+/* $OpenBSD: vmparam.h,v 1.12 2004/06/24 22:35:56 drahn Exp $ */
/* $NetBSD: vmparam.h,v 1.1 1996/09/30 16:34:38 ws Exp $ */
/*-
@@ -87,13 +87,13 @@
#define VM_MIN_ADDRESS ((vm_offset_t)0)
#define VM_MAXUSER_ADDRESS ((vm_offset_t)0xfffff000)
#define VM_MAX_ADDRESS VM_MAXUSER_ADDRESS
-#define VM_MIN_KERNEL_ADDRESS ((vm_offset_t)(KERNEL_SR << ADDR_SR_SHIFT))
+#define VM_MIN_KERNEL_ADDRESS ((vm_offset_t)(PPC_KERNEL_SR << ADDR_SR_SHIFT))
/* ppc_kvm_size is so that vm space can be stolen before vm is fully
* initialized.
*/
extern vm_offset_t ppc_kvm_stolen;
-#define VM_KERN_ADDRESS_SIZE (SEGMENT_LENGTH - (32 * 1024 * 1024))
+#define VM_KERN_ADDRESS_SIZE (PPC_SEGMENT_LENGTH - (32 * 1024 * 1024))
#define VM_MAX_KERNEL_ADDRESS (VM_MIN_KERNEL_ADDRESS + VM_KERN_ADDRESS_SIZE)
#define VM_PHYS_SIZE (USRIOSIZE * PAGE_SIZE)
diff --git a/sys/arch/mvmeppc/mvmeppc/genassym.cf b/sys/arch/mvmeppc/mvmeppc/genassym.cf
index 0a05248311b..e70bf0f2e95 100644
--- a/sys/arch/mvmeppc/mvmeppc/genassym.cf
+++ b/sys/arch/mvmeppc/mvmeppc/genassym.cf
@@ -1,4 +1,4 @@
-# $OpenBSD: genassym.cf,v 1.6 2004/05/08 20:10:24 miod Exp $
+# $OpenBSD: genassym.cf,v 1.7 2004/06/24 22:35:56 drahn Exp $
#
# Copyright (c) 1982, 1990 The Regents of the University of California.
# All rights reserved.
@@ -63,8 +63,8 @@ member pcb_spl
member PCB_FAULT pcb_onfault
struct pmap
-member PM_USRSR pm_sr[USER_SR]
-member PM_KERNELSR pm_sr[KERNEL_SR]
+member PM_USRSR pm_sr[PPC_USER_SR]
+member PM_KERNELSR pm_sr[PPC_KERNEL_SR]
struct proc
member p_forw
diff --git a/sys/arch/mvmeppc/mvmeppc/locore.S b/sys/arch/mvmeppc/mvmeppc/locore.S
index b1c70ae3f9b..f18f41cb978 100644
--- a/sys/arch/mvmeppc/mvmeppc/locore.S
+++ b/sys/arch/mvmeppc/mvmeppc/locore.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: locore.S,v 1.6 2004/01/29 21:30:02 miod Exp $ */
+/* $OpenBSD: locore.S,v 1.7 2004/06/24 22:35:56 drahn Exp $ */
/* $NetBSD: locore.S,v 1.2 1996/10/16 19:33:09 ws Exp $ */
/*
@@ -238,7 +238,7 @@ _C_LABEL(sw1):
or. 30,30,30 /* old process was exiting? */
beq switch_exited
- mfsr 10,USER_SR /* save USER_SR for copyin/copyout */
+ mfsr 10,PPC_USER_SR /* save USER_SR for copyin/copyout */
mfcr 11 /* save cr */
mr 12,2 /* save r2 */
stwu 1,-SFRAMELEN(1) /* still running on old stack */
@@ -265,14 +265,14 @@ switch_exited:
addic. 5,5,64
li 6,0
- mfsr 8,KERNEL_SR /* save kernel SR */
+ mfsr 8,PPC_KERNEL_SR /* save kernel SR */
1:
addis 6,6,-0x10000000@ha /* set new procs segment registers */
or. 6,6,6 /* This is done from the real address pmap */
lwzu 7,-4(5) /* so we don't have to worry */
mtsrin 7,6 /* about accessibility */
bne 1b
- mtsr KERNEL_SR,8 /* restore kernel SR */
+ mtsr PPC_KERNEL_SR,8 /* restore kernel SR */
isync
lwz 1,PCB_SP(4) /* get new procs SP */
@@ -285,7 +285,7 @@ switch_exited:
mr 2,12 /* get saved r2 */
mtcr 11 /* get saved cr */
isync
- mtsr USER_SR,10 /* get saved USER_SR */
+ mtsr PPC_USER_SR,10 /* get saved USER_SR */
isync
switch_return:
@@ -788,9 +788,9 @@ _C_LABEL(ddbsize) = .-_C_LABEL(ddblow)
lis 2,_C_LABEL(curpm)@ha; /* get real address of pmap */ \
lwz 2,_C_LABEL(curpm)@l(2); \
lwz 3,PM_USRSR(2); \
- mtsr USER_SR,3; \
+ mtsr PPC_USER_SR,3; \
lwz 3,PM_KERNELSR(2); \
- mtsr KERNEL_SR,3; \
+ mtsr PPC_KERNEL_SR,3; \
1: mfsprg 2,1; /* restore cr */ \
mtcr 2; \
lwz 2,savearea(0); \
@@ -826,9 +826,9 @@ realtrap:
*/
s_trap:
/* First have to enable KERNEL mapping */
- lis 31,KERNEL_SEGMENT@ha
- addi 31,31,KERNEL_SEGMENT@l
- mtsr KERNEL_SR,31
+ lis 31,PPC_KERNEL_SEGMENT@ha
+ addi 31,31,PPC_KERNEL_SEGMENT@l
+ mtsr PPC_KERNEL_SR,31
FRAME_SETUP(tempsave)
/* Now we can recover interrupts again: */
mfmsr 7
@@ -996,9 +996,9 @@ s_isitrap:
stw 4,12(1); \
stw 3,8(1); \
/* interrupts are recoverable here, and enable translation */ \
- lis 3,(KERNEL_SEGMENT|SR_SUKEY|SR_PRKEY)@ha; \
- addi 3,3,(KERNEL_SEGMENT|SR_SUKEY|SR_PRKEY)@l; \
- mtsr KERNEL_SR,3; \
+ lis 3,(PPC_KERNEL_SEGMENT|SR_SUKEY|SR_PRKEY)@ha; \
+ addi 3,3,(PPC_KERNEL_SEGMENT|SR_SUKEY|SR_PRKEY)@l; \
+ mtsr PPC_KERNEL_SR,3; \
mfmsr 5; \
ori 5,5,(PSL_IR|PSL_DR|PSL_RI); \
mtmsr 5; \
@@ -1037,7 +1037,7 @@ intr_exit:
lis 3,_C_LABEL(curpm)@ha /* get current pmap real address */
lwz 3,_C_LABEL(curpm)@l(3)
lwz 3,PM_KERNELSR(3)
- mtsr KERNEL_SR,3 /* Restore kernel SR */
+ mtsr PPC_KERNEL_SR,3 /* Restore kernel SR */
lis 3,_C_LABEL(astpending)@ha /* Test AST pending */
lwz 4,_C_LABEL(astpending)@l(3)
andi. 4,4,1
diff --git a/sys/arch/mvmeppc/mvmeppc/machdep.c b/sys/arch/mvmeppc/mvmeppc/machdep.c
index 347d2fe8ee9..1e921d512fa 100644
--- a/sys/arch/mvmeppc/mvmeppc/machdep.c
+++ b/sys/arch/mvmeppc/mvmeppc/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.45 2004/05/06 20:15:08 miod Exp $ */
+/* $OpenBSD: machdep.c,v 1.46 2004/06/24 22:35:56 drahn Exp $ */
/* $NetBSD: machdep.c,v 1.4 1996/10/16 19:33:11 ws Exp $ */
/*
@@ -970,7 +970,7 @@ bus_mem_add_mapping(bpa, size, cacheable, bshp)
vaddr = VM_MIN_KERNEL_ADDRESS + ppc_kvm_stolen;
ppc_kvm_stolen -= alloc_size;
- if (ppc_kvm_stolen > SEGMENT_LENGTH) {
+ if (ppc_kvm_stolen > PPC_SEGMENT_LENGTH) {
panic("ppc_kvm_stolen, out of space");
}
} else {
@@ -1011,7 +1011,7 @@ mapiodev(pa, len)
/* need to steal vm space before kernel vm is initialized */
va = VM_MIN_KERNEL_ADDRESS + ppc_kvm_stolen;
ppc_kvm_stolen += size;
- if (ppc_kvm_stolen > SEGMENT_LENGTH) {
+ if (ppc_kvm_stolen > PPC_SEGMENT_LENGTH) {
panic("ppc_kvm_stolen: out of space");
}
} else {
diff --git a/sys/arch/powerpc/include/param.h b/sys/arch/powerpc/include/param.h
index dcde0032c8e..30f2d7edd40 100644
--- a/sys/arch/powerpc/include/param.h
+++ b/sys/arch/powerpc/include/param.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: param.h,v 1.23 2004/04/19 22:55:50 deraadt Exp $ */
+/* $OpenBSD: param.h,v 1.24 2004/06/24 22:35:56 drahn Exp $ */
/* $NetBSD: param.h,v 1.1 1996/09/30 16:34:28 ws Exp $ */
/*-
@@ -107,17 +107,17 @@
/*
* Segment handling stuff
*/
-#define SEGMENT_LENGTH 0x10000000
-#define SEGMENT_MASK 0xf0000000
+#define PPC_SEGMENT_LENGTH 0x10000000
+#define PPC_SEGMENT_MASK 0xf0000000
/*
* Fixed segments
*/
-#define USER_SR 13
-#define KERNEL_SR 14
-#define KERNEL_SEG0 0xfffff0
-#define KERNEL_SEGMENT (KERNEL_SEG0 + KERNEL_SR)
-#define USER_ADDR ((void *)(USER_SR << ADDR_SR_SHIFT))
+#define PPC_USER_SR 13
+#define PPC_KERNEL_SR 14
+#define PPC_KERNEL_SEG0 0xfffff0
+#define PPC_KERNEL_SEGMENT (PPC_KERNEL_SEG0 + PPC_KERNEL_SR)
+#define PPC_USER_ADDR ((void *)(PPC_USER_SR << ADDR_SR_SHIFT))
/*
* Some system constants
diff --git a/sys/arch/powerpc/powerpc/pmap.c b/sys/arch/powerpc/powerpc/pmap.c
index c216e298831..a15792397a1 100644
--- a/sys/arch/powerpc/powerpc/pmap.c
+++ b/sys/arch/powerpc/powerpc/pmap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap.c,v 1.87 2004/05/20 09:20:42 kettenis Exp $ */
+/* $OpenBSD: pmap.c,v 1.88 2004/06/24 22:35:56 drahn Exp $ */
/*
* Copyright (c) 2001, 2002 Dale Rahn.
@@ -526,7 +526,8 @@ pmap_enter(pm, va, pa, prot, flags)
/* set the current sr if not kernel used segments
* and this pmap is the currently active pmap
*/
- if (sn != USER_SR && sn != KERNEL_SR && curpm == pm)
+ if (sn != PPC_USER_SR && sn != PPC_KERNEL_SR &&
+ curpm == pm)
ppc_mtsrin(pm->pm_sr[sn],
sn << ADDR_SR_SHIFT);
}
@@ -654,7 +655,8 @@ pmap_remove_pg(pmap_t pm, vaddr_t va)
/* set the current sr if not kernel used segments
* and this pmap is the currently active pmap
*/
- if (sn != USER_SR && sn != KERNEL_SR && curpm == pm)
+ if (sn != PPC_USER_SR && sn != PPC_KERNEL_SR &&
+ curpm == pm)
ppc_mtsrin(pm->pm_sr[sn],
sn << ADDR_SR_SHIFT);
}
@@ -738,7 +740,8 @@ _pmap_kenter_pa(vaddr_t va, paddr_t pa, vm_prot_t prot, int flags, int cache)
/* set the current sr if not kernel used segments
* and this pmap is the currently active pmap
*/
- if (sn != USER_SR && sn != KERNEL_SR && curpm == pm)
+ if (sn != PPC_USER_SR && sn != PPC_KERNEL_SR &&
+ curpm == pm)
ppc_mtsrin(pm->pm_sr[sn],
sn << ADDR_SR_SHIFT);
}
@@ -801,7 +804,8 @@ pmap_kremove_pg(vaddr_t va)
/* set the current sr if not kernel used segments
* and this pmap is the currently active pmap
*/
- if (sn != USER_SR && sn != KERNEL_SR && curpm == pm)
+ if (sn != PPC_USER_SR && sn != PPC_KERNEL_SR &&
+ curpm == pm)
ppc_mtsrin(pm->pm_sr[sn],
sn << ADDR_SR_SHIFT);
}
@@ -1430,7 +1434,7 @@ pmap_bootstrap(u_int kernelstart, u_int kernelend)
}
vp1 = pmap_steal_avail(sizeof (struct pmapvp), 4);
bzero (vp1, sizeof(struct pmapvp));
- pmap_kernel()->pm_vp[KERNEL_SR] = vp1;
+ pmap_kernel()->pm_vp[PPC_KERNEL_SR] = vp1;
for (i = 0; i < VP_IDX1_SIZE; i++) {
vp2 = vp1->vp[i] = pmap_steal_avail(sizeof (struct pmapvp), 4);
@@ -1454,13 +1458,13 @@ pmap_bootstrap(u_int kernelstart, u_int kernelend)
/*
* Initialize kernel pmap and hardware.
*/
-#if NPMAPS >= KERNEL_SEGMENT / 16
- usedsr[KERNEL_SEGMENT / 16 / (sizeof usedsr[0] * 8)]
- |= 1 << ((KERNEL_SEGMENT / 16) % (sizeof usedsr[0] * 8));
+#if NPMAPS >= PPC_KERNEL_SEGMENT / 16
+ usedsr[PPC_KERNEL_SEGMENT / 16 / (sizeof usedsr[0] * 8)]
+ |= 1 << ((PPC_KERNEL_SEGMENT / 16) % (sizeof usedsr[0] * 8));
#endif
for (i = 0; i < 16; i++) {
- pmap_kernel()->pm_sr[i] = (KERNEL_SEG0 + i) | SR_NOEXEC;
- ppc_mtsrin(KERNEL_SEG0 + i, i << ADDR_SR_SHIFT);
+ pmap_kernel()->pm_sr[i] = (PPC_KERNEL_SEG0 + i) | SR_NOEXEC;
+ ppc_mtsrin(PPC_KERNEL_SEG0 + i, i << ADDR_SR_SHIFT);
}
asm volatile ("sync; mtsdr1 %0; isync"
:: "r"((u_int)pmap_ptable | (pmap_ptab_mask >> 10)));
@@ -1538,9 +1542,9 @@ pmap_setusr(pmap_t pm, vaddr_t va)
/* user address range lock?? */
asm volatile ("mfsr %0,%1"
- : "=r" (oldsr): "n"(USER_SR));
+ : "=r" (oldsr): "n"(PPC_USER_SR));
asm volatile ("isync; mtsr %0,%1; isync"
- :: "n"(USER_SR), "r"(sr));
+ :: "n"(PPC_USER_SR), "r"(sr));
return oldsr;
}
@@ -1548,7 +1552,7 @@ void
pmap_popusr(u_int32_t sr)
{
asm volatile ("isync; mtsr %0,%1; isync"
- :: "n"(USER_SR), "r"(sr));
+ :: "n"(PPC_USER_SR), "r"(sr));
}
int
@@ -1564,8 +1568,8 @@ copyin(udaddr, kaddr, len)
void *oldh = curpcb->pcb_onfault;
while (len > 0) {
- p = USER_ADDR + ((u_int)udaddr & ~SEGMENT_MASK);
- l = (USER_ADDR + SEGMENT_LENGTH) - p;
+ p = PPC_USER_ADDR + ((u_int)udaddr & ~PPC_SEGMENT_MASK);
+ l = (PPC_USER_ADDR + PPC_SEGMENT_LENGTH) - p;
if (l > len)
l = len;
oldsr = pmap_setusr(curpcb->pcb_pm, (vaddr_t)udaddr);
@@ -1597,8 +1601,8 @@ copyout(kaddr, udaddr, len)
void *oldh = curpcb->pcb_onfault;
while (len > 0) {
- p = USER_ADDR + ((u_int)udaddr & ~SEGMENT_MASK);
- l = (USER_ADDR + SEGMENT_LENGTH) - p;
+ p = PPC_USER_ADDR + ((u_int)udaddr & ~PPC_SEGMENT_MASK);
+ l = (PPC_USER_ADDR + PPC_SEGMENT_LENGTH) - p;
if (l > len)
l = len;
oldsr = pmap_setusr(curpcb->pcb_pm, (vaddr_t)udaddr);
@@ -1633,8 +1637,8 @@ copyinstr(const void *udaddr, void *kaddr, size_t len, size_t *done)
void *oldh = curpcb->pcb_onfault;
while (len > 0) {
- p = USER_ADDR + ((u_int)uaddr & ~SEGMENT_MASK);
- l = (USER_ADDR + SEGMENT_LENGTH) - p;
+ p = PPC_USER_ADDR + ((u_int)uaddr & ~PPC_SEGMENT_MASK);
+ l = (PPC_USER_ADDR + PPC_SEGMENT_LENGTH) - p;
up = p;
if (l > len)
l = len;
@@ -1689,8 +1693,8 @@ copyoutstr(const void *kaddr, void *udaddr, size_t len, size_t *done)
void *oldh = curpcb->pcb_onfault;
while (len > 0) {
- p = USER_ADDR + ((u_int)uaddr & ~SEGMENT_MASK);
- l = (USER_ADDR + SEGMENT_LENGTH) - p;
+ p = PPC_USER_ADDR + ((u_int)uaddr & ~PPC_SEGMENT_MASK);
+ l = (PPC_USER_ADDR + PPC_SEGMENT_LENGTH) - p;
up = p;
if (l > len)
l = len;
@@ -1743,7 +1747,8 @@ pmap_syncicache_user_virt(pmap_t pm, vaddr_t va)
int l;
if (pm != pmap_kernel()) {
- start = ((u_int)USER_ADDR + ((u_int)va & ~SEGMENT_MASK));
+ start = ((u_int)PPC_USER_ADDR + ((u_int)va &
+ ~PPC_SEGMENT_MASK));
/* will only ever be page size, will not cross segments */
/* USER SEGMENT LOCK - MPXXX */
@@ -1980,7 +1985,7 @@ pte_spill_r(u_int32_t va, u_int32_t msr, u_int32_t dsisr, int exec_fault)
*/
if (!(msr & PSL_PR)) {
/* lookup is done physical to prevent faults */
- if (VP_SR(va) == USER_SR) {
+ if (VP_SR(va) == PPC_USER_SR) {
return 0;
} else {
pm = pmap_kernel();
diff --git a/sys/arch/powerpc/powerpc/trap.c b/sys/arch/powerpc/powerpc/trap.c
index 848abe7413c..63c627e3d93 100644
--- a/sys/arch/powerpc/powerpc/trap.c
+++ b/sys/arch/powerpc/powerpc/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.62 2003/12/21 15:17:32 miod Exp $ */
+/* $OpenBSD: trap.c,v 1.63 2004/06/24 22:35:56 drahn Exp $ */
/* $NetBSD: trap.c,v 1.3 1996/10/13 03:31:37 christos Exp $ */
/*
@@ -318,11 +318,11 @@ trap(struct trapframe *frame)
map = kernel_map;
va = frame->dar;
- if ((va >> ADDR_SR_SHIFT) == USER_SR) {
+ if ((va >> ADDR_SR_SHIFT) == PPC_USER_SR) {
sr_t user_sr;
asm ("mfsr %0, %1"
- : "=r"(user_sr) : "K"(USER_SR));
+ : "=r"(user_sr) : "K"(PPC_USER_SR));
va &= ADDR_PIDX | ADDR_POFF;
va |= user_sr << ADDR_SR_SHIFT;
map = &p->p_vmspace->vm_map;
diff --git a/sys/arch/powerpc/powerpc/vm_machdep.c b/sys/arch/powerpc/powerpc/vm_machdep.c
index 72dcf816a01..dfc77a82d2f 100644
--- a/sys/arch/powerpc/powerpc/vm_machdep.c
+++ b/sys/arch/powerpc/powerpc/vm_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vm_machdep.c,v 1.37 2003/10/15 02:43:09 drahn Exp $ */
+/* $OpenBSD: vm_machdep.c,v 1.38 2004/06/24 22:35:56 drahn Exp $ */
/* $NetBSD: vm_machdep.c,v 1.1 1996/09/30 16:34:57 ws Exp $ */
/*
@@ -114,11 +114,13 @@ cpu_fork(struct proc *p1, struct proc *p2, void *stack, size_t stacksize,
/*
* Below that, we allocate the switch frame:
*/
- stktop2 -= roundup(sizeof *sf, 16); /* must match SFRAMELEN in genassym */
+ /* must match SFRAMELEN in genassym */
+ stktop2 -= roundup(sizeof *sf, 16);
+
sf = (struct switchframe *)stktop2;
bzero((void *)sf, sizeof *sf); /* just in case */
sf->sp = (int)cf;
- sf->user_sr = pmap_kernel()->pm_sr[USER_SR]; /* again, just in case */
+ sf->user_sr = pmap_kernel()->pm_sr[PPC_USER_SR]; /* just in case */
pcb->pcb_sp = (int)stktop2;
pcb->pcb_spl = 0;
}
@@ -129,7 +131,7 @@ cpu_swapin(struct proc *p)
struct pcb *pcb = &p->p_addr->u_pcb;
pmap_extract(pmap_kernel(),
- (vm_offset_t)pcb->pcb_pm, (paddr_t *)&pcb->pcb_pmreal);
+ (vm_offset_t)pcb->pcb_pm, (paddr_t *)&pcb->pcb_pmreal);
}
/*