summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2005-10-12 19:05:45 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2005-10-12 19:05:45 +0000
commitb48d6934c3ae42b1d0c118e7d128242f119249c6 (patch)
tree3d2658a2bfd7328e6728be8b928df6e3c6774ba4 /sys
parent1cbe376d5cfe8937a275b18544f674b001dc8931 (diff)
Stop mapping the u area at fixed UADDR in addition to its actual va.
While there, attempt to clean and comment stack usage in the kernel. No functional change. From the m88k SMP tree; help&test martin@
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/luna88k/luna88k/locore.S52
-rw-r--r--sys/arch/luna88k/luna88k/machdep.c31
-rw-r--r--sys/arch/m88k/include/cpu.h11
-rw-r--r--sys/arch/m88k/include/param.h4
-rw-r--r--sys/arch/m88k/include/proc.h3
-rw-r--r--sys/arch/m88k/m88k/eh_common.S38
-rw-r--r--sys/arch/m88k/m88k/m88k_machdep.c34
-rw-r--r--sys/arch/m88k/m88k/pmap.c16
-rw-r--r--sys/arch/m88k/m88k/process.S11
-rw-r--r--sys/arch/m88k/m88k/vm_machdep.c20
-rw-r--r--sys/arch/mvme88k/mvme88k/locore.S53
-rw-r--r--sys/arch/mvme88k/mvme88k/machdep.c29
12 files changed, 92 insertions, 210 deletions
diff --git a/sys/arch/luna88k/luna88k/locore.S b/sys/arch/luna88k/luna88k/locore.S
index c4d9a9aebcf..b4da0dcc803 100644
--- a/sys/arch/luna88k/luna88k/locore.S
+++ b/sys/arch/luna88k/luna88k/locore.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: locore.S,v 1.7 2004/12/24 22:50:30 miod Exp $ */
+/* $OpenBSD: locore.S,v 1.8 2005/10/12 19:05:39 miod Exp $ */
/*
* Copyright (c) 1998 Steve Murphree, Jr.
* Copyright (c) 1996 Nivas Madhur
@@ -260,7 +260,6 @@ GLOBAL(start_text)
ASLOCAL(master_start)
/*
* Switch to interrupt stack
- * Use idle_u's stack instead?
*/
or.u r31, r0, hi16(_ASM_LABEL(intstack_end))
or r31, r31, lo16(_ASM_LABEL(intstack_end))
@@ -311,34 +310,32 @@ ASLOCAL(master_start)
or.u r2, r0, hi16(0x41000000)
st r0, r2, lo16(0x41000000)
- /* still on int stack */
+ /*
+ * luna88k_bootstrap(), among other things, clears proc0's u area.
+ * We are still using the interrupt stack here, thus we are not
+ * affected...
+ */
bsr _C_LABEL(luna88k_bootstrap)
/*
- * we now know our cpu number, so we
- * can set interrupt_stack[cpu_number()] = intstack
+ * ...and we can switch to the u area stack now.
*/
- ldcr r10, SR1
- extu r10, r10, FLAG_CPU_FIELD_WIDTH<0> /* r10 <-- CPU# */
-
- /* figure interrupt_stack[cpu_number()] */
- or.u r11, r0, hi16(_C_LABEL(interrupt_stack))
- or r11, r11, lo16(_C_LABEL(interrupt_stack))
- or.u r12, r0, hi16(_C_LABEL(intstack))
- or r12, r12, lo16(_C_LABEL(intstack))
- st r12, r11 [r10]
-
- /* switch to proc0 uarea */
- or.u r10, r0, hi16(UADDR)
- or r31, r10,lo16(UADDR)
- addu r31, r31, USIZE - 8
-
- /* make the call: main() */
- or.u r2, r0, hi16(UADDR)
- or r2, r2,lo16(UADDR)
- bsr.n _C_LABEL(main)
- addu r2, r2, USIZE - 8
- bsr _C_LABEL(panic)
+ or.u r10, r0, hi16(_C_LABEL(curpcb))
+ ld r31, r10, lo16(_C_LABEL(curpcb))
+ addu r31, r31, USIZE
+
+ /* call main() - no arguments although main() still defines one */
+ bsr _C_LABEL(main)
+ or.u r2, r0, hi16(_ASM_LABEL(main_panic))
+ bsr.n _C_LABEL(panic)
+ or r2, r2, lo16(_ASM_LABEL(main_panic))
+
+ data
+ .align 4
+ASLOCAL(main_panic)
+ string "main() returned\0"
+ text
+ .align 8
/*
* slave CPUs starts here
@@ -443,9 +440,6 @@ GLOBAL(idle_u)
ASLOCAL(u0)
space UPAGES * NBPG
-/* UPAGES get mapped to kstack */
-ASGLOBAL(kstack)
- word UADDR
GLOBAL(ret_addr)
word 0
/* XMEM spin lock -- to count CPUs */
diff --git a/sys/arch/luna88k/luna88k/machdep.c b/sys/arch/luna88k/luna88k/machdep.c
index fae882a9d6b..162d826f7d2 100644
--- a/sys/arch/luna88k/luna88k/machdep.c
+++ b/sys/arch/luna88k/luna88k/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.22 2005/09/25 20:30:03 miod Exp $ */
+/* $OpenBSD: machdep.c,v 1.23 2005/10/12 19:05:39 miod Exp $ */
/*
* Copyright (c) 1998, 1999, 2000, 2001 Steve Murphree, Jr.
* Copyright (c) 1996 Nivas Madhur
@@ -127,9 +127,6 @@ void slave_pre_main(void);
int slave_main(void);
void vector_init(m88k_exception_vector_area *, unsigned *);
-extern void load_u_area(struct proc *);
-extern void save_u_area(struct proc *, vaddr_t);
-
vaddr_t size_memory(void);
void powerdown(void);
void get_fuse_rom_data(void);
@@ -138,8 +135,6 @@ char *nvram_by_symbol(char *);
void get_autoboot_device(void); /* in disksubr.c */
int clockintr(void *); /* in clock.c */
-vaddr_t interrupt_stack[MAX_CPUS];
-
/*
* *int_mask_reg[CPU]
* Points to the hardware interrupt status register for each CPU.
@@ -397,7 +392,7 @@ cpu_startup()
int sz, i;
vsize_t size;
int base, residual;
- vaddr_t minaddr, maxaddr, uarea_pages;
+ vaddr_t minaddr, maxaddr;
/*
* Initialize error message buffer (at end of core).
@@ -491,17 +486,6 @@ cpu_startup()
panic("startup: table size inconsistency");
/*
- * Grab UADDR virtual address
- */
- uarea_pages = UADDR;
- uvm_map(kernel_map, (vaddr_t *)&uarea_pages, USPACE,
- NULL, UVM_UNKNOWN_OFFSET, 0,
- UVM_MAPFLAG(UVM_PROT_NONE, UVM_PROT_NONE, UVM_INH_NONE,
- UVM_ADV_NORMAL, 0));
- if (uarea_pages != UADDR)
- panic("uarea_pages %lx: UADDR not free", uarea_pages);
-
- /*
* Grab the OBIO space that we hardwired in pmap_bootstrap
*/
obiova = OBIO_START;
@@ -891,7 +875,6 @@ get_slave_stack()
panic("Cannot allocate slave stack for cpu %d",
cpu_number());
- interrupt_stack[cpu_number()] = addr;
return addr;
}
@@ -1196,16 +1179,8 @@ luna88k_bootstrap()
uvm_page_physload(atop(avail_start), atop(avail_end),
atop(avail_start), atop(avail_end),VM_FREELIST_DEFAULT);
- /* Initialize cached PTEs for u-area mapping. */
- save_u_area(&proc0, (vaddr_t)proc0paddr);
-
- /*
- * Map proc0's u-area at the standard address (UADDR).
- */
- load_u_area(&proc0);
-
/* Initialize the "u-area" pages. */
- bzero((caddr_t)UADDR, UPAGES * PAGE_SIZE);
+ bzero((caddr_t)curpcb, USPACE);
#ifdef DEBUG
printf("leaving luna88k_bootstrap()\n");
#endif
diff --git a/sys/arch/m88k/include/cpu.h b/sys/arch/m88k/include/cpu.h
index b1a00496a60..bb5a253b778 100644
--- a/sys/arch/m88k/include/cpu.h
+++ b/sys/arch/m88k/include/cpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.h,v 1.5 2004/11/08 16:39:31 miod Exp $ */
+/* $OpenBSD: cpu.h,v 1.6 2005/10/12 19:05:43 miod Exp $ */
/*
* Copyright (c) 1996 Nivas Madhur
* Copyright (c) 1992, 1993
@@ -65,9 +65,10 @@
* definitions of cpu-dependent requirements
* referenced in generic code
*/
-#define cpu_exec(p) /* nothing */
-#define cpu_wait(p) /* nothing */
-#define cpu_swapout(p) /* nothing */
+#define cpu_exec(p) do { /* nothing */ } while (0)
+#define cpu_wait(p) do { /* nothing */ } while (0)
+#define cpu_swapin(p) do { /* nothing */ } while (0)
+#define cpu_swapout(p) do { /* nothing */ } while (0)
/*
* Arguments to hardclock and gatherstats encapsulate the previous
@@ -82,7 +83,7 @@ struct clockframe {
#define CLKF_USERMODE(framep) ((((struct trapframe *)(framep))->tf_epsr & PSR_MODE) == 0)
#define CLKF_PC(framep) (((struct trapframe *)(framep))->tf_sxip & XIP_ADDR)
-#define CLKF_INTR(framep) (((struct trapframe *)(framep))->tf_r[31] >= UADDR)
+#define CLKF_INTR(framep) (0) /* XXX temporary */
/*
* Get interrupt glue.
diff --git a/sys/arch/m88k/include/param.h b/sys/arch/m88k/include/param.h
index c86f46cbc6e..6a41569f6a3 100644
--- a/sys/arch/m88k/include/param.h
+++ b/sys/arch/m88k/include/param.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: param.h,v 1.6 2005/09/12 23:05:05 miod Exp $ */
+/* $OpenBSD: param.h,v 1.7 2005/10/12 19:05:43 miod Exp $ */
/*
* Copyright (c) 1999 Steve Murphree, Jr.
* Copyright (c) 1988 University of Utah.
@@ -81,8 +81,6 @@
#define USPACE (UPAGES * NBPG)
#define USPACE_ALIGN (0) /* u-area alignment 0-none */
-#define UADDR 0xeee00000 /* address of u */
-
/*
* Constants related to network buffer management.
* MCLBYTES must be no larger than the software page size, and,
diff --git a/sys/arch/m88k/include/proc.h b/sys/arch/m88k/include/proc.h
index c658452b17a..cd51bdb3fee 100644
--- a/sys/arch/m88k/include/proc.h
+++ b/sys/arch/m88k/include/proc.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: proc.h,v 1.2 2005/05/18 16:44:37 miod Exp $ */
+/* $OpenBSD: proc.h,v 1.3 2005/10/12 19:05:43 miod Exp $ */
/*
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
@@ -51,7 +51,6 @@ struct trapframe;
*/
struct mdproc {
struct trapframe *md_tf; /* trap/syscall registers */
- int md_upte[UPAGES]; /* ptes for mapping u page */
/*
* Single stepping is done by moving two breakpoints in the
diff --git a/sys/arch/m88k/m88k/eh_common.S b/sys/arch/m88k/m88k/eh_common.S
index c3a2e104d97..e9d69126496 100644
--- a/sys/arch/m88k/m88k/eh_common.S
+++ b/sys/arch/m88k/m88k/eh_common.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: eh_common.S,v 1.11 2005/09/25 20:30:03 miod Exp $ */
+/* $OpenBSD: eh_common.S,v 1.12 2005/10/12 19:05:44 miod Exp $ */
/*
* Mach Operating System
* Copyright (c) 1993-1991 Carnegie Mellon University
@@ -1010,9 +1010,9 @@ ASLOCAL(m88100_use_SR3_pcb)
* Consequently, we never picked up a stack. Do so now.
* R1 is currently free (saved in the exception frame pointed at by
* r30) */
- or.u r1, r0, hi16(_ASM_LABEL(kstack))
- ld r1, r1, lo16(_ASM_LABEL(kstack))
- addu r1, r1, USIZE-SIZEOF_EF
+ or.u r1, r0, hi16(_C_LABEL(curpcb))
+ ld r1, r1, lo16(_C_LABEL(curpcb))
+ addu r1, r1, USIZE - SIZEOF_EF
st FLAGS,r1, REG_OFF(EF_FLAGS) /* store flags */
st r31, r1, GENREG_OFF(31) /* store r31 - now free */
st r30, r1, REG_OFF(EF_SR3) /* store old SR3 (pcb) */
@@ -1041,6 +1041,14 @@ ASLOCAL(m88100_pickup_stack)
or.u r31, r0, hi16(_C_LABEL(curpcb))
ld r31, r31, lo16(_C_LABEL(curpcb))
addu r31, r31, PCB_USER_STATE /* point to user save area */
+
+ /*
+ * WARNING! Using pcb->user_state as the exception frame
+ * AND stack pointer, means we can not afford using the stack
+ * until we have saved enough and can go back to the top of the u area,
+ * after the FPU is enabled.
+ */
+
st FLAGS,r31, REG_OFF(EF_FLAGS) /* save flags */
st r1, r31, GENREG_OFF(1) /* save prev. r1 (now free) */
ldcr r1, SR3 /* save previous r31 */
@@ -1523,8 +1531,8 @@ ASLOCAL(m88100_fpu_enable)
ld r2, r31, REG_OFF(EF_EPSR)
bb1 PSR_SUPERVISOR_MODE_BIT, r2, 1f /* if in kernel mode */
- or.u r31, r0, hi16(_ASM_LABEL(kstack))
- ld r31, r31, lo16(_ASM_LABEL(kstack))
+ or.u r31, r0, hi16(_C_LABEL(curpcb))
+ ld r31, r31, lo16(_C_LABEL(curpcb))
addu r31, r31, USIZE /* point at proper end */
1:
@@ -2262,9 +2270,9 @@ ASLOCAL(m88110_use_SR3_pcb)
* R1 is currently free (saved in the exception frame pointed at by
* r30)
*/
- or.u r1, r0, hi16(_ASM_LABEL(kstack))
- ld r1, r1, lo16(_ASM_LABEL(kstack))
- addu r1, r1, USIZE-SIZEOF_EF
+ or.u r1, r0, hi16(_C_LABEL(curpcb))
+ ld r1, r1, lo16(_C_LABEL(curpcb))
+ addu r1, r1, USIZE - SIZEOF_EF
st FLAGS,r1, REG_OFF(EF_FLAGS) /* store flags */
st r31, r1, GENREG_OFF(31) /* store r31 - now free */
st r30, r1, REG_OFF(EF_SR3) /* store old SR3 (pcb) */
@@ -2294,6 +2302,14 @@ ASLOCAL(m88110_pickup_stack)
or.u r31, r0, hi16(_C_LABEL(curpcb))
ld r31, r31, lo16(_C_LABEL(curpcb))
addu r31, r31, PCB_USER_STATE /* point to user save area */
+
+ /*
+ * WARNING! Using pcb->user_state as the exception frame
+ * AND stack pointer, means we can not afford using the stack
+ * until we have saved enough and can go back to the top of the u area,
+ * after the FPU is enabled.
+ */
+
st FLAGS,r31, REG_OFF(EF_FLAGS) /* save flags */
st r1, r31, GENREG_OFF(1) /* save prev. r1 (now free)*/
ldcr r1, SR3 /* save previous r31 */
@@ -2518,8 +2534,8 @@ ASLOCAL(m88110_fpu_enable)
ld r2, r31, REG_OFF(EF_EPSR)
bb1 PSR_SUPERVISOR_MODE_BIT, r2, 1f /* if in kernel mode */
- or.u r31, r0, hi16(_ASM_LABEL(kstack))
- ld r31, r31, lo16(_ASM_LABEL(kstack))
+ or.u r31, r0, hi16(_C_LABEL(curpcb))
+ ld r31, r31, lo16(_C_LABEL(curpcb))
addu r31, r31, USIZE /* point at proper end */
1:
diff --git a/sys/arch/m88k/m88k/m88k_machdep.c b/sys/arch/m88k/m88k/m88k_machdep.c
index bb177893c5d..baa23a75a2e 100644
--- a/sys/arch/m88k/m88k/m88k_machdep.c
+++ b/sys/arch/m88k/m88k/m88k_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: m88k_machdep.c,v 1.4 2005/09/25 20:55:14 miod Exp $ */
+/* $OpenBSD: m88k_machdep.c,v 1.5 2005/10/12 19:05:44 miod Exp $ */
/*
* Copyright (c) 1998, 1999, 2000, 2001 Steve Murphree, Jr.
* Copyright (c) 1996 Nivas Madhur
@@ -75,8 +75,6 @@
/* prototypes */
void regdump(struct trapframe *f);
void dumpsys(void);
-void save_u_area(struct proc *, vaddr_t);
-void load_u_area(struct proc *);
void dumpconf(void);
int longformat = 1; /* for regdump() */
@@ -88,36 +86,6 @@ int longformat = 1; /* for regdump() */
int safepri = IPL_NONE;
/*
- * Setup u area ptes for u area double mapping.
- */
-
-void
-save_u_area(struct proc *p, vaddr_t va)
-{
- int i;
-
- for (i = 0; i < UPAGES; i++) {
- p->p_md.md_upte[i] = *((pt_entry_t *)kvtopte(va));
- va += PAGE_SIZE;
- }
-}
-
-void
-load_u_area(struct proc *p)
-{
- int i;
- vaddr_t va;
- pt_entry_t *t;
-
- for (i = 0, va = UADDR; i < UPAGES; i++) {
- t = kvtopte(va);
- *t = p->p_md.md_upte[i];
- va += PAGE_SIZE;
- }
- cmmu_flush_tlb(cpu_number(), 1, UADDR, UPAGES);
-}
-
-/*
* Set registers on exec.
* Clear all except sp and pc.
*/
diff --git a/sys/arch/m88k/m88k/pmap.c b/sys/arch/m88k/m88k/pmap.c
index 6c985e948f9..4f7ebb6adb2 100644
--- a/sys/arch/m88k/m88k/pmap.c
+++ b/sys/arch/m88k/m88k/pmap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap.c,v 1.12 2005/09/25 20:55:14 miod Exp $ */
+/* $OpenBSD: pmap.c,v 1.13 2005/10/12 19:05:44 miod Exp $ */
/*
* Copyright (c) 2001-2004, Miodrag Vallat
* Copyright (c) 1998-2001 Steve Murphree, Jr.
@@ -545,7 +545,6 @@ pmap_bootstrap(vaddr_t load_start)
sdt_entry_t *kmap;
vaddr_t vaddr, virt;
paddr_t s_text, e_text, kpdt_phys;
- pt_entry_t *pte;
unsigned int kernel_pmap_size, pdt_size;
int i;
pmap_table_t ptable;
@@ -722,19 +721,6 @@ pmap_bootstrap(vaddr_t load_start)
virtual_avail = virt;
/*
- * Set translation for UPAGES at UADDR. The idea is we want to
- * have translations set up for UADDR. Later on, the ptes for
- * for this address will be set so that kstack will refer
- * to the u area. Make sure pmap knows about this virtual
- * address by doing vm_findspace on kernel_map.
- */
-
- for (i = 0, virt = UADDR; i < UPAGES; i++, virt += PAGE_SIZE) {
- if ((pte = pmap_pte(kernel_pmap, virt)) == PT_ENTRY_NULL)
- pmap_expand_kmap(virt, VM_PROT_READ | VM_PROT_WRITE, 0);
- }
-
- /*
* Switch to using new page tables
*/
diff --git a/sys/arch/m88k/m88k/process.S b/sys/arch/m88k/m88k/process.S
index 86309aa5bfe..f171ea433b1 100644
--- a/sys/arch/m88k/m88k/process.S
+++ b/sys/arch/m88k/m88k/process.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: process.S,v 1.8 2005/10/12 19:00:21 miod Exp $ */
+/* $OpenBSD: process.S,v 1.9 2005/10/12 19:05:44 miod Exp $ */
/*
* Copyright (c) 1996 Nivas Madhur
* All rights reserved.
@@ -225,15 +225,6 @@ ASLOCAL(cpu_switch_found)
or r2, r0, r9
or r9, r0, r14 /* restore p saved in r14 */
- /*
- * Since we are about to replace the u area mapping, we need to
- * switch to a neutral stack now.
- */
- or.u r31, r0, hi16(_ASM_LABEL(intstack_end))
- or r31,r31, lo16(_ASM_LABEL(intstack_end))
-
- bsr.n _C_LABEL(load_u_area)
- or r2, r0, r9
#if defined(MULTIPROCESSOR) || defined(LOCKDEBUG)
bsr _C_LABEL(sched_unlock_idle)
diff --git a/sys/arch/m88k/m88k/vm_machdep.c b/sys/arch/m88k/m88k/vm_machdep.c
index 493f33d110d..5a0603657b5 100644
--- a/sys/arch/m88k/m88k/vm_machdep.c
+++ b/sys/arch/m88k/m88k/vm_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vm_machdep.c,v 1.5 2005/09/25 20:55:14 miod Exp $ */
+/* $OpenBSD: vm_machdep.c,v 1.6 2005/10/12 19:05:44 miod Exp $ */
/*
* Copyright (c) 1998 Steve Murphree, Jr.
@@ -91,7 +91,6 @@ cpu_fork(p1, p2, stack, stacksize, func, arg)
} *ksfp;
extern struct pcb *curpcb;
extern void proc_trampoline(void);
- extern void save_u_area(struct proc *, vaddr_t);
/* Copy pcb from p1 to p2. */
if (p1 == curproc) {
@@ -107,9 +106,6 @@ cpu_fork(p1, p2, stack, stacksize, func, arg)
p2->p_addr->u_pcb.kernel_state.pcb_ipl = IPL_NONE; /* XXX */
p2->p_md.md_tf = (struct trapframe *)USER_REGS(p2);
- /*XXX these may not be necessary nivas */
- save_u_area(p2, (vaddr_t)p2->p_addr);
-
/*
* Create a switch frame for proc 2
*/
@@ -207,20 +203,6 @@ cpu_coredump(p, vp, cred, chdr)
}
/*
- * Finish a swapin operation.
- * We neded to update the cached PTEs for the user area in the
- * machine dependent part of the proc structure.
- */
-
-void
-cpu_swapin(struct proc *p)
-{
- extern void save_u_area(struct proc *, vaddr_t);
-
- save_u_area(p, (vaddr_t)p->p_addr);
-}
-
-/*
* Map an IO request into kernel virtual address space. Requests fall into
* one of five catagories:
*
diff --git a/sys/arch/mvme88k/mvme88k/locore.S b/sys/arch/mvme88k/mvme88k/locore.S
index 1ea081bf111..793fe7169ea 100644
--- a/sys/arch/mvme88k/mvme88k/locore.S
+++ b/sys/arch/mvme88k/mvme88k/locore.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: locore.S,v 1.41 2004/12/24 22:50:30 miod Exp $ */
+/* $OpenBSD: locore.S,v 1.42 2005/10/12 19:05:44 miod Exp $ */
/*
* Copyright (c) 1998 Steve Murphree, Jr.
* Copyright (c) 1996 Nivas Madhur
@@ -316,7 +316,6 @@ GLOBAL(start_text)
ASLOCAL(master_start)
/*
* Switch to interrupt stack
- * Use idle_u's stack instead?
*/
or.u r31, r0, hi16(_ASM_LABEL(intstack_end))
or r31, r31, lo16(_ASM_LABEL(intstack_end))
@@ -340,34 +339,33 @@ ASLOCAL(master_start)
bsr.n _C_LABEL(vector_init)
ldcr r2, VBR
- /* still on int stack */
+ /*
+ * mvme_bootstrap(), among other things, clears proc0's u area.
+ * We are still using the interrupt stack here, thus we are not
+ * affected...
+ */
bsr _C_LABEL(mvme_bootstrap)
/*
- * we now know our cpu number, so we
- * can set interrupt_stack[cpu_number()] = intstack
+ * ...and we can switch to the u area stack now.
*/
- ldcr r10, SR1
- extu r10, r10, FLAG_CPU_FIELD_WIDTH<0> /* r10 <-- CPU# */
-
- /* figure interrupt_stack[cpu_number()] */
- or.u r11, r0, hi16(_C_LABEL(interrupt_stack))
- or r11, r11, lo16(_C_LABEL(interrupt_stack))
- or.u r12, r0, hi16(_C_LABEL(intstack))
- or r12, r12, lo16(_C_LABEL(intstack))
- st r12, r11 [r10]
-
- /* switch to proc0 uarea */
- or.u r10, r0, hi16(UADDR)
- or r31, r10,lo16(UADDR)
- addu r31, r31, USIZE - 8
-
- /* make the call: main() */
- or.u r2, r0, hi16(UADDR)
- or r2, r2,lo16(UADDR)
- bsr.n _C_LABEL(main)
- addu r2, r2, USIZE - 8
- bsr _C_LABEL(panic)
+ or.u r10, r0, hi16(_C_LABEL(curpcb))
+ ld r31, r10,lo16(_C_LABEL(curpcb))
+ addu r31, r31, USIZE
+
+ /* call main() - no arguments although main() still defines one */
+ bsr _C_LABEL(main)
+
+ or.u r2, r0, hi16(_ASM_LABEL(main_panic))
+ bsr.n _C_LABEL(panic)
+ or r2, r2, lo16(_ASM_LABEL(main_panic))
+
+ data
+ .align 4
+ASLOCAL(main_panic)
+ string "main() returned\0"
+ text
+ .align 8
/*
* slave CPUs starts here
@@ -477,9 +475,6 @@ GLOBAL(idle_u)
ASLOCAL(u0)
space UPAGES * NBPG
-/* UPAGES get mapped to kstack */
-ASGLOBAL(kstack)
- word UADDR
GLOBAL(ret_addr)
word 0
/* XMEM spin lock -- to count CPUs */
diff --git a/sys/arch/mvme88k/mvme88k/machdep.c b/sys/arch/mvme88k/mvme88k/machdep.c
index 51f969e82a9..16e38ca0e01 100644
--- a/sys/arch/mvme88k/mvme88k/machdep.c
+++ b/sys/arch/mvme88k/mvme88k/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.167 2005/09/25 20:30:03 miod Exp $ */
+/* $OpenBSD: machdep.c,v 1.168 2005/10/12 19:05:44 miod Exp $ */
/*
* Copyright (c) 1998, 1999, 2000, 2001 Steve Murphree, Jr.
* Copyright (c) 1996 Nivas Madhur
@@ -111,8 +111,6 @@ int slave_main(void);
void vector_init(m88k_exception_vector_area *, unsigned *);
void _doboot(void);
-extern void load_u_area(struct proc *);
-extern void save_u_area(struct proc *, vaddr_t);
extern void setlevel(unsigned int);
extern void m187_bootstrap(void);
@@ -129,7 +127,6 @@ extern void m197_setupiackvectors(void);
extern void m197_startup(void);
intrhand_t intr_handlers[NVMEINTR];
-vaddr_t interrupt_stack[MAX_CPUS];
/* board dependent pointers */
void (*md_interrupt_func_ptr)(u_int, struct trapframe *);
@@ -363,7 +360,7 @@ cpu_startup()
int sz, i;
vsize_t size;
int base, residual;
- vaddr_t minaddr, maxaddr, uarea_pages;
+ vaddr_t minaddr, maxaddr;
/*
* Initialize error message buffer (at end of core).
@@ -394,17 +391,6 @@ cpu_startup()
panic("startup: table size inconsistency");
/*
- * Grab UADDR virtual address
- */
- uarea_pages = UADDR;
- uvm_map(kernel_map, (vaddr_t *)&uarea_pages, USPACE,
- NULL, UVM_UNKNOWN_OFFSET, 0,
- UVM_MAPFLAG(UVM_PROT_NONE, UVM_PROT_NONE, UVM_INH_NONE,
- UVM_ADV_NORMAL, 0));
- if (uarea_pages != UADDR)
- panic("uarea_pages %lx: UADDR not free", uarea_pages);
-
- /*
* Grab machine dependent memory spaces
*/
switch (brdtyp) {
@@ -840,7 +826,6 @@ get_slave_stack()
panic("Cannot allocate slave stack for cpu %d",
cpu_number());
- interrupt_stack[cpu_number()] = addr;
return addr;
}
@@ -1184,16 +1169,8 @@ mvme_bootstrap()
uvm_page_physload(atop(avail_start), atop(avail_end),
atop(avail_start), atop(avail_end), VM_FREELIST_DEFAULT);
- /* Initialize cached PTEs for u-area mapping. */
- save_u_area(&proc0, (vaddr_t)proc0paddr);
-
- /*
- * Map proc0's u-area at the standard address (UADDR).
- */
- load_u_area(&proc0);
-
/* Initialize the "u-area" pages. */
- bzero((caddr_t)UADDR, UPAGES * PAGE_SIZE);
+ bzero((caddr_t)curpcb, USPACE);
#ifdef DEBUG
printf("leaving mvme_bootstrap()\n");
#endif