summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorSteve Murphree <smurph@cvs.openbsd.org>2001-01-13 05:19:02 +0000
committerSteve Murphree <smurph@cvs.openbsd.org>2001-01-13 05:19:02 +0000
commitb2fc93362574ae97a3d3d367a3f18f9df09ebdec (patch)
treee3ebfa043bcdf243dc7894f0f6187d022dca0628 /sys/arch
parent2c2cdb496b2db4e6759169e9d396fbb519037c56 (diff)
Booting kernel with MACHINE_NEW_NONCONTIG. UVM code added but not working.
New stand config. Lots of header fixes. Can now cross-compile i386->m88k.
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/mvme88k/conf/M18728
-rw-r--r--sys/arch/mvme88k/conf/Makefile.mvme88k8
-rw-r--r--sys/arch/mvme88k/dev/siop.c5
-rw-r--r--sys/arch/mvme88k/dev/siopdma.c5
-rw-r--r--sys/arch/mvme88k/include/mmu.h9
-rw-r--r--sys/arch/mvme88k/include/pmap.h36
-rw-r--r--sys/arch/mvme88k/include/vmparam.h5
-rw-r--r--sys/arch/mvme88k/mvme88k/autoconf.c19
-rw-r--r--sys/arch/mvme88k/mvme88k/locore_asm_routines.S27
-rw-r--r--sys/arch/mvme88k/mvme88k/machdep.c240
-rw-r--r--sys/arch/mvme88k/mvme88k/mem.c33
-rw-r--r--sys/arch/mvme88k/mvme88k/pmap.c31
-rw-r--r--sys/arch/mvme88k/mvme88k/trap.c63
-rw-r--r--sys/arch/mvme88k/mvme88k/vm_machdep.c28
-rw-r--r--sys/arch/mvme88k/stand/Makefile.inc8
-rw-r--r--sys/arch/mvme88k/stand/bootsd/Makefile10
-rw-r--r--sys/arch/mvme88k/stand/bootsd/boot.c16
-rw-r--r--sys/arch/mvme88k/stand/bootst/Makefile10
-rw-r--r--sys/arch/mvme88k/stand/bootxx/Makefile10
-rw-r--r--sys/arch/mvme88k/stand/bootxx/bootxx.c6
-rw-r--r--sys/arch/mvme88k/stand/bugcrt/Makefile25
-rw-r--r--sys/arch/mvme88k/stand/bugcrt/Makefile.inc23
-rw-r--r--sys/arch/mvme88k/stand/bugcrt/bugcrt.c93
-rw-r--r--sys/arch/mvme88k/stand/bugcrt/crt.c125
-rw-r--r--sys/arch/mvme88k/stand/bugcrt/sdcrt.c12
-rw-r--r--sys/arch/mvme88k/stand/libsa/SRT1.c3
-rw-r--r--sys/arch/mvme88k/stand/libsa/exec_mvme.c46
-rw-r--r--sys/arch/mvme88k/stand/netboot/Makefile11
28 files changed, 678 insertions, 257 deletions
diff --git a/sys/arch/mvme88k/conf/M187 b/sys/arch/mvme88k/conf/M187
index 720d7313ba8..293875c4905 100644
--- a/sys/arch/mvme88k/conf/M187
+++ b/sys/arch/mvme88k/conf/M187
@@ -1,4 +1,4 @@
-# $OpenBSD: M187,v 1.4 1999/09/27 21:21:15 smurph Exp $
+# $OpenBSD: M187,v 1.5 2001/01/13 05:18:57 smurph Exp $
machine mvme88k
@@ -95,19 +95,19 @@ vmes0 at vme0
vmel0 at vme0
# ------------------------------ vmes0 devices -------------------------
-vx0 at vmes0 addr 0xff780000 ipl 3 vec 0x70 len 0x10000
-vx1 at vmes0 addr 0xff790000 ipl 3 vec 0x71 len 0x10000
-vx2 at vmes0 addr 0xff7a0000 ipl 3 vec 0x72 len 0x10000
-vx3 at vmes0 addr 0xff7b0000 ipl 3 vec 0x73 len 0x10000
-ve0 at vmes0 addr 0xffff1200 ipl 1 vec 0x74 len 0x100
-ve1 at vmes0 addr 0xffff1400 ipl 1 vec 0x75 len 0x100
-ve2 at vmes0 addr 0xffff1600 ipl 1 vec 0x76 len 0x100
-vs0 at vmes0 addr 0xffff9000 ipl 2 vec 0x80 len 0x800
-vs1 at vmes0 addr 0xffff9800 ipl 2 vec 0x82 len 0x800
-vs2 at vmes0 addr 0xffff4800 ipl 2 vec 0x84 len 0x800
-vs3 at vmes0 addr 0xffff5800 ipl 2 vec 0x86 len 0x800
-vs4 at vmes0 addr 0xffff7000 ipl 2 vec 0x88 len 0x800
-vs5 at vmes0 addr 0xffff7800 ipl 2 vec 0x8a len 0x800
+vx0 at vmes0 addr 0xff780000 ipl 3 len 0x10000
+vx1 at vmes0 addr 0xff790000 ipl 3 len 0x10000
+vx2 at vmes0 addr 0xff7a0000 ipl 3 len 0x10000
+vx3 at vmes0 addr 0xff7b0000 ipl 3 len 0x10000
+ve0 at vmes0 addr 0xffff1200 ipl 1 len 0x100
+ve1 at vmes0 addr 0xffff1400 ipl 1 len 0x100
+ve2 at vmes0 addr 0xffff1600 ipl 1 len 0x100
+vs0 at vmes0 addr 0xffff9000 ipl 2 len 0x800
+vs1 at vmes0 addr 0xffff9800 ipl 2 len 0x800
+vs2 at vmes0 addr 0xffff4800 ipl 2 len 0x800
+vs3 at vmes0 addr 0xffff5800 ipl 2 len 0x800
+vs4 at vmes0 addr 0xffff7000 ipl 2 len 0x800
+vs5 at vmes0 addr 0xffff7800 ipl 2 len 0x800
# ------------------------------ svme0 devices -------------------------
scsibus* at vs?
diff --git a/sys/arch/mvme88k/conf/Makefile.mvme88k b/sys/arch/mvme88k/conf/Makefile.mvme88k
index 53d8caaeae8..04b91a7a0f7 100644
--- a/sys/arch/mvme88k/conf/Makefile.mvme88k
+++ b/sys/arch/mvme88k/conf/Makefile.mvme88k
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile.mvme88k,v 1.8 2000/03/03 00:54:52 todd Exp $
+# $OpenBSD: Makefile.mvme88k,v 1.9 2001/01/13 05:18:58 smurph Exp $
# @(#)Makefile.hp300 7.10 (Berkeley) 6/27/91
#
# Makefile for OpenBSD
@@ -102,7 +102,7 @@ SYSTEM_LD= -@if [ X${DEBUG} = X-g ]; \
fi; \
echo ${LD} $$strip -Ttext 0x10000 -o $@ '$${SYSTEM_OBJ}' vers.o; \
${LD} $$strip -Ttext 0x10000 -e start ${LINKFLAGS} -o $@ \
- ${SYSTEM_OBJ} vers.o -lgcc -lgcc
+ ${SYSTEM_OBJ} vers.o -L. -lgcc -lgcc
SYSTEM_LD_TAIL= @${SIZE} $@; chmod 755 $@; \
[ X${DEBUG} = X-g ] && { \
@@ -130,6 +130,10 @@ newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
clean::
+ rm -f eddep *bsd bsd.gdb tags *.o locore.i \
+ [a-z]*.s [Ee]rrs errs linterrs makelinks
+
+realclean::
rm -f eddep *bsd bsd.gdb tags *.o locore.i .depend \
[a-z]*.s [Ee]rrs errs linterrs makelinks
diff --git a/sys/arch/mvme88k/dev/siop.c b/sys/arch/mvme88k/dev/siop.c
index 4fbb54c51e3..fe0c95e5a43 100644
--- a/sys/arch/mvme88k/dev/siop.c
+++ b/sys/arch/mvme88k/dev/siop.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: siop.c,v 1.3 1999/05/29 04:41:44 smurph Exp $ */
+/* $OpenBSD: siop.c,v 1.4 2001/01/13 05:18:58 smurph Exp $ */
/*
* Copyright (c) 1994 Michael L. Hitch
@@ -113,6 +113,9 @@ int siop_cmd_wait = SCSI_CMD_WAIT;
int siop_data_wait = SCSI_DATA_WAIT;
int siop_init_wait = SCSI_INIT_WAIT;
+extern struct pmap kernel_pmap_store;
+#define pmap_kernel() (&kernel_pmap_store)
+
#ifdef DEBUG_SYNC
/*
* sync period transfer lookup - only valid for 66Mhz clock
diff --git a/sys/arch/mvme88k/dev/siopdma.c b/sys/arch/mvme88k/dev/siopdma.c
index 177f49669a0..698793e0af8 100644
--- a/sys/arch/mvme88k/dev/siopdma.c
+++ b/sys/arch/mvme88k/dev/siopdma.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: siopdma.c,v 1.2 1998/12/15 05:52:31 smurph Exp $ */
+/* $OpenBSD: siopdma.c,v 1.3 2001/01/13 05:18:58 smurph Exp $ */
/*
* Copyright (c) 1996 Nivas Madhur
@@ -77,6 +77,9 @@
#include "machine/mmu.h"
#endif /* defined(MVME187) */
+extern struct pmap kernel_pmap_store;
+#define pmap_kernel() (&kernel_pmap_store)
+
int afscmatch __P((struct device *, void *, void *));
void afscattach __P((struct device *, struct device *, void *));
diff --git a/sys/arch/mvme88k/include/mmu.h b/sys/arch/mvme88k/include/mmu.h
index 5cbfd35facf..ae9f453dc20 100644
--- a/sys/arch/mvme88k/include/mmu.h
+++ b/sys/arch/mvme88k/include/mmu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: mmu.h,v 1.4 1999/02/09 06:36:27 smurph Exp $ */
+/* $OpenBSD: mmu.h,v 1.5 2001/01/13 05:18:59 smurph Exp $ */
/*
* Ashura Project
*/
@@ -206,7 +206,12 @@ typedef union batc_template {
#define LOG2_PDT_SIZE (PDT_BITS + 2)
#define LOG2_PDT_TABLE_GROUP_SIZE (PAGE_SHIFT - LOG2_PDT_SIZE)
#define PDT_TABLE_GROUP_SIZE (1 << LOG2_PDT_TABLE_GROUP_SIZE)
-#define PT_FREE(tbl) kmem_free(kernel_map, (vm_offset_t)tbl, PAGE_SIZE)
+#if defined(UVM)
+#define PT_FREE(tbl) uvm_km_free(kernel_map, (vaddr_t)tbl, PAGE_SIZE)
+#else
+#define PT_FREE(tbl) kmem_free(kernel_map, (vm_offset_t)tbl, PAGE_SIZE)
+#endif
+
/*
* Va spaces mapped by tables and PDT table group.
diff --git a/sys/arch/mvme88k/include/pmap.h b/sys/arch/mvme88k/include/pmap.h
index 66d70af13b1..5d7676c26f0 100644
--- a/sys/arch/mvme88k/include/pmap.h
+++ b/sys/arch/mvme88k/include/pmap.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap.h,v 1.10 2001/01/12 07:29:27 smurph Exp $ */
+/* $OpenBSD: pmap.h,v 1.11 2001/01/13 05:18:59 smurph Exp $ */
/*
* Mach Operating System
* Copyright (c) 1991 Carnegie Mellon University
@@ -67,29 +67,20 @@ typedef struct pv_entry {
vm_offset_t va; /* virtual address for mapping */
} *pv_entry_t;
-#include <vm/vm.h>
+#ifdef _KERNEL
-#define PMAP_ACTIVATE(pmap, th, my_cpu) _pmap_activate(pmap, th, my_cpu)
-#define PMAP_DEACTIVATE(pmap, th, my_cpu) _pmap_deactivate(pmap, th, my_cpu)
-
-#define PMAP_CONTEXT(pmap, thread)
+extern struct pmap kernel_pmap_store;
+#define pmap_kernel() (&kernel_pmap_store)
#define pmap_resident_count(pmap) ((pmap)->stats.resident_count)
-
/* Used in builtin/device_pager.c */
#define pmap_phys_address(frame) ((vm_offset_t) (M88K_PTOB(frame)))
-
/* Used in kern/mach_timedev.c */
#define pmap_phys_to_frame(phys) ((int) (M88K_BTOP(phys)))
-/*
- * Since Our PCB has no infomation about the mapping,
- * we have nothing to do in PMAP_PCB_INITIALIZE.
- * XXX
- */
-/* Used in machine/pcb.c */
-#define PMAP_PCB_INITIALIZE(x)
-
+#define PMAP_ACTIVATE(proc) pmap_activate(proc)
+#define PMAP_DEACTIVATE(proc) pmap_deactivate(proc)
+#define PMAP_CONTEXT(pmap, thread)
/*
* Modes used when calling pmap_cache_fulsh().
*/
@@ -104,8 +95,6 @@ typedef struct pv_entry {
/*** Prototypes for public functions defined in pmap.c ********************/
/**************************************************************************/
-void _pmap_activate(pmap_t pmap, pcb_t, int my_cpu);
-void _pmap_deactivate(pmap_t pmap, pcb_t, int my_cpu);
void pmap_activate(struct proc *p);
void pmap_deactivate(struct proc *p);
int pmap_check_transaction(pmap_t pmap, vm_offset_t va, vm_prot_t type);
@@ -123,15 +112,6 @@ vm_offset_t pmap_map_batc(
vm_prot_t prot,
unsigned cmode);
-#ifdef JUNK
-int pmap_attribute(
- pmap_t pmap,
- vm_offset_t address,
- vm_size_t size,
- vm_machine_attribute_t attribute,
- vm_machine_attribute_val_t* value); /* IN/OUT */
-#endif /* JUNK */
-
void pmap_bootstrap(
vm_offset_t load_start, /* IN */
vm_offset_t *phys_start, /* IN/OUT */
@@ -144,7 +124,6 @@ void pmap_cache_ctrl(pmap_t pmap, vm_offset_t s, vm_offset_t e, unsigned mode);
void pmap_zero_page(vm_offset_t phys);
void pmap_remove_all(vm_offset_t phys);
vm_offset_t pmap_extract_unlocked(pmap_t pmap, vm_offset_t va);
-pmap_t pmap_kernel(void);
void copy_to_phys(vm_offset_t srcva, vm_offset_t dstpa, int bytecount);
void copy_from_phys(vm_offset_t srcpa, vm_offset_t dstva, int bytecount);
void pmap_redzone(pmap_t pmap, vm_offset_t va);
@@ -185,5 +164,6 @@ void pmap_print_trace (pmap_t pmap, vm_offset_t va, boolean_t long_format);
boolean_t v); /* is valid ? */
#endif
#endif /* 0 */
+#endif /* _KERNEL */
#endif /* endif _MACHINE_PMAP_H_ */
diff --git a/sys/arch/mvme88k/include/vmparam.h b/sys/arch/mvme88k/include/vmparam.h
index 1e10d3be943..baa95477c0d 100644
--- a/sys/arch/mvme88k/include/vmparam.h
+++ b/sys/arch/mvme88k/include/vmparam.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: vmparam.h,v 1.7 2001/01/12 07:29:27 smurph Exp $ */
+/* $OpenBSD: vmparam.h,v 1.8 2001/01/13 05:18:59 smurph Exp $ */
/*
* Mach Operating System
* Copyright (c) 1992 Carnegie Mellon University
@@ -201,6 +201,7 @@
#define VM_NFREELIST 1
#define VM_FREELIST_DEFAULT 0
+#ifndef ASSEMBLER
/*
* pmap-specific data stored in the vm_physmem[] array.
*/
@@ -209,6 +210,8 @@ struct pmap_physseg {
char *attrs; /* page modify list for this seg */
struct simplelock *plock; /* page lock for this seg */
};
+#endif /* ASSEMBLER */
+
#endif /* MACHINE_NEW_NONCONTIG */
diff --git a/sys/arch/mvme88k/mvme88k/autoconf.c b/sys/arch/mvme88k/mvme88k/autoconf.c
index 8455273da8b..675953275c8 100644
--- a/sys/arch/mvme88k/mvme88k/autoconf.c
+++ b/sys/arch/mvme88k/mvme88k/autoconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: autoconf.c,v 1.7 2000/03/03 00:54:53 todd Exp $ */
+/* $OpenBSD: autoconf.c,v 1.8 2001/01/13 05:18:59 smurph Exp $ */
/*
* Copyright (c) 1998 Steve Murphree, Jr.
* Copyright (c) 1996 Nivas Madhur
@@ -492,20 +492,3 @@ int size;
}
}
}
-
-/*
- * Slave CPU pre-main routine.
- * Determine CPU number and set it.
- *
- * Running on an interrupt stack here; do nothing fancy.
- *
- * Called from "mvme88k/locore.S"
- */
-void slave_pre_main(void)
-{
- set_cpu_number(cmmu_cpu_number()); /* Determine cpu number by CMMU */
- splhigh();
- enable_interrupt();
-}
-
-
diff --git a/sys/arch/mvme88k/mvme88k/locore_asm_routines.S b/sys/arch/mvme88k/mvme88k/locore_asm_routines.S
index 316011a63b3..2a5df3f23d4 100644
--- a/sys/arch/mvme88k/mvme88k/locore_asm_routines.S
+++ b/sys/arch/mvme88k/mvme88k/locore_asm_routines.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: locore_asm_routines.S,v 1.7 1999/09/27 19:13:22 smurph Exp $ */
+/* $OpenBSD: locore_asm_routines.S,v 1.8 2001/01/13 05:18:59 smurph Exp $ */
/*
* Mach Operating System
* Copyright (c) 1993-1992 Carnegie Mellon University
@@ -1228,6 +1228,31 @@ ENTRY(copyoutstr)
/*word 0 */ /* to separate from routine below */
/*######################################################################*/
+#if defined(UVM)
+/*
+ * kcopy(const void *src, void *dst, size_t len);
+ *
+ * Copy len bytes from src to dst, aborting if we encounter a page fault.
+ */
+ENTRY(kcopy)
+ or.u r5, r0, hi16(_curpcb)
+ ld r6, r5, lo16(_curpcb)
+ or.u r5, r0, hi16(kcfault)
+ or r5, r5, lo16(kcfault)
+ bsr.n _ovbcopy /* call ovbcopy */
+ st r5, r6, PCB_ONFAULT /* pcb_onfault = kcfault */
+ or r2, r0, 0 /* return success */
+ br kcdone
+kcdone:
+ or.u r5,r0,hi16(_curpcb)
+ ld r6,r5,lo16(_curpcb)
+ st r0,r6,PCB_ONFAULT /* clear the handler */
+ jmp r1 /* return */
+kcfault:
+ or r2, r0, EFAULT /* return fault */
+ br kcdone
+#endif /* UVM */
+
/*
* Gcc 2 generates calls to memcpy for bcopies of unknown size. memcpy
* can simply be implemented as ovbcopy but the src (r2, r3) and dst args need to
diff --git a/sys/arch/mvme88k/mvme88k/machdep.c b/sys/arch/mvme88k/mvme88k/machdep.c
index 11558c41313..5c195ae114a 100644
--- a/sys/arch/mvme88k/mvme88k/machdep.c
+++ b/sys/arch/mvme88k/mvme88k/machdep.c
@@ -1,6 +1,6 @@
-/* $OpenBSD: machdep.c,v 1.22 2001/01/12 07:29:26 smurph Exp $ */
+/* $OpenBSD: machdep.c,v 1.23 2001/01/13 05:18:59 smurph Exp $ */
/*
- * Copyright (c) 1998, 1999 Steve Murphree, Jr.
+ * Copyright (c) 1998, 1999, 2000, 2001 Steve Murphree, Jr.
* Copyright (c) 1996 Nivas Madhur
* All rights reserved.
*
@@ -92,6 +92,11 @@
#include <vm/vm_map.h>
#include <vm/vm_kern.h>
#include <vm/vm_page.h>
+
+#if defined(UVM)
+#include <uvm/uvm_extern.h>
+#endif
+
#define __IS_MACHDEP_C__
#include <assym.s> /* EF_EPSR, etc. */
#include <machine/m88100.h> /* DMT_VALID */
@@ -180,7 +185,13 @@ vm_map_t buffer_map;
* VMEbus drivers use this at this now. Only on-board IO devices' addresses
* are mapped so that pa == va. XXX smurph.
*/
-void *iomapbase;
+
+#if defined(UVM)
+vaddr_t iomapbase;
+#else
+vm_offset_t iomapbase;
+#endif
+
struct map *iomap;
vm_map_t iomap_map;
int niomap;
@@ -461,7 +472,11 @@ cpu_startup()
int sz, i;
vm_size_t size;
int base, residual;
+#if defined(UVM)
+ vaddr_t minaddr, maxaddr, uarea_pages;
+#else
vm_offset_t minaddr, maxaddr, uarea_pages;
+#endif
extern vm_offset_t miniroot;
/*
* Initialize error message buffer (at end of core).
@@ -481,7 +496,12 @@ cpu_startup()
* and then give everything true virtual addresses.
*/
sz = (int)allocsys((caddr_t)0);
- if ((v = (caddr_t)kmem_alloc(kernel_map, round_page(sz))) == 0)
+
+#if defined(UVM)
+ if ((v = (caddr_t)uvm_km_zalloc(kernel_map, m88k_round_page(sz))) == 0)
+#else
+ if ((v = (caddr_t)kmem_alloc(kernel_map, m88k_round_page(sz))) == 0)
+#endif
panic("startup: no room for tables");
if (allocsys(v) - v != sz)
panic("startup: table size inconsistency");
@@ -489,12 +509,17 @@ cpu_startup()
/*
* Grab UADDR virtual address
*/
-
uarea_pages = UADDR;
-
+#if defined(UVM)
+ uvm_map(kernel_map, (vaddr_t *)&uarea_pages, USPACE,
+ NULL, UVM_UNKNOWN_OFFSET,UVM_MAPFLAG(UVM_PROT_NONE,
+ UVM_PROT_NONE,
+ UVM_INH_NONE,
+ UVM_ADV_NORMAL, 0));
+#else
vm_map_find(kernel_map, vm_object_allocate(USPACE), 0,
(vm_offset_t *)&uarea_pages, USPACE, TRUE);
-
+#endif
if (uarea_pages != UADDR) {
printf("uarea_pages %x: UADDR not free\n", uarea_pages);
panic("bad UADDR");
@@ -513,9 +538,16 @@ cpu_startup()
*/
bugromva = BUGROM_START;
+#if defined(UVM)
+ uvm_map(kernel_map, (vaddr_t *)&bugromva, BUGROM_SIZE,
+ NULL, UVM_UNKNOWN_OFFSET,UVM_MAPFLAG(UVM_PROT_NONE,
+ UVM_PROT_NONE,
+ UVM_INH_NONE,
+ UVM_ADV_NORMAL, 0));
+#else
vm_map_find(kernel_map, vm_object_allocate(BUGROM_SIZE), 0,
(vm_offset_t *)&bugromva, BUGROM_SIZE, TRUE);
-
+#endif
if (bugromva != BUGROM_START) {
printf("bugromva %x: BUGROM not free\n", bugromva);
panic("bad bugromva");
@@ -525,9 +557,16 @@ cpu_startup()
* Grab the SRAM space that we hardwired in pmap_bootstrap
*/
sramva = SRAM_START;
-
+#if defined(UVM)
+ uvm_map(kernel_map, (vaddr_t *)&sramva, SRAM_SIZE,
+ NULL, UVM_UNKNOWN_OFFSET,UVM_MAPFLAG(UVM_PROT_NONE,
+ UVM_PROT_NONE,
+ UVM_INH_NONE,
+ UVM_ADV_NORMAL, 0));
+#else
vm_map_find(kernel_map, vm_object_allocate(SRAM_SIZE), 0,
(vm_offset_t *)&sramva, SRAM_SIZE, TRUE);
+#endif
if (sramva != SRAM_START) {
printf("sramva %x: SRAM not free\n", sramva);
@@ -538,10 +577,16 @@ cpu_startup()
* Grab the OBIO space that we hardwired in pmap_bootstrap
*/
obiova = OBIO_START;
-
+#if defined(UVM)
+ uvm_map(kernel_map, (vaddr_t *)&obiova, OBIO_SIZE,
+ NULL, UVM_UNKNOWN_OFFSET,UVM_MAPFLAG(UVM_PROT_NONE,
+ UVM_PROT_NONE,
+ UVM_INH_NONE,
+ UVM_ADV_NORMAL, 0));
+#else
vm_map_find(kernel_map, vm_object_allocate(OBIO_SIZE), 0,
(vm_offset_t *)&obiova, OBIO_SIZE, TRUE);
-
+#endif
if (obiova != OBIO_START) {
printf("obiova %x: OBIO not free\n", obiova);
panic("bad OBIO");
@@ -554,10 +599,16 @@ cpu_startup()
* Grab the UTIL space that we hardwired in pmap_bootstrap
*/
utilva = MVME188_UTILITY;
-
+#if defined(UVM)
+ uvm_map(kernel_map, (vaddr_t *)&utilva, MVME188_UTILITY_SIZE,
+ NULL, UVM_UNKNOWN_OFFSET,UVM_MAPFLAG(UVM_PROT_NONE,
+ UVM_PROT_NONE,
+ UVM_INH_NONE,
+ UVM_ADV_NORMAL, 0));
+#else
vm_map_find(kernel_map, vm_object_allocate(MVME188_UTILITY_SIZE), 0,
(vm_offset_t *)&utilva, MVME188_UTILITY_SIZE, TRUE);
-
+#endif
if (utilva != MVME188_UTILITY) {
printf("utilva %x: UTILITY area not free\n", utilva);
panic("bad utilva");
@@ -572,15 +623,23 @@ cpu_startup()
* Now allocate buffers proper. They are different than the above
* in that they usually occupy more virtual memory than physical.
*/
-
size = MAXBSIZE * nbuf;
+#if defined(UVM)
+ if (uvm_map(kernel_map, (vaddr_t *) &buffers, m88k_round_page(size),
+ NULL, UVM_UNKNOWN_OFFSET,
+ UVM_MAPFLAG(UVM_PROT_NONE, UVM_PROT_NONE, UVM_INH_NONE,
+ UVM_ADV_NORMAL, 0)) != KERN_SUCCESS)
+ panic("cpu_startup: cannot allocate VM for buffers");
+ minaddr = (vaddr_t)buffers;
+#else
buffer_map = kmem_suballoc(kernel_map, (vm_offset_t *)&buffers,
&maxaddr, size, TRUE);
minaddr = (vm_offset_t)buffers;
if (vm_map_find(buffer_map, vm_object_allocate(size), (vm_offset_t)0,
- (vm_offset_t *)&minaddr, size, FALSE) != KERN_SUCCESS) {
+ (vm_offset_t *)&minaddr, size, FALSE) != KERN_SUCCESS)
panic("startup: cannot allocate buffers");
- }
+#endif
+
if ((bufpages / nbuf) >= btoc(MAXBSIZE)) {
/* don't want to alloc more physical mem than needed */
bufpages = btoc(MAXBSIZE) * nbuf;
@@ -589,6 +648,32 @@ cpu_startup()
residual = bufpages % nbuf;
for (i = 0; i < nbuf; i++) {
+#if defined(UVM)
+ vsize_t curbufsize;
+ vaddr_t curbuf;
+ struct vm_page *pg;
+
+ /*
+ * Each buffer has MAXBSIZE bytes of VM space allocated. Of
+ * that MAXBSIZE space, we allocate and map (base+1) pages
+ * for the first "residual" buffers, and then we allocate
+ * "base" pages for the rest.
+ */
+ curbuf = (vm_offset_t) buffers + (i * MAXBSIZE);
+ curbufsize = CLBYTES * ((i < residual) ? (base+1) : base);
+
+ while (curbufsize) {
+ pg = uvm_pagealloc(NULL, 0, NULL, 0);
+ if (pg == NULL)
+ panic("cpu_startup: not enough memory for "
+ "buffer cache");
+ pmap_enter(kernel_map->pmap, curbuf,
+ VM_PAGE_TO_PHYS(pg), VM_PROT_ALL, TRUE,
+ VM_PROT_READ|VM_PROT_WRITE);
+ curbuf += PAGE_SIZE;
+ curbufsize -= PAGE_SIZE;
+ }
+#else
vm_size_t curbufsize;
vm_offset_t curbuf;
@@ -601,28 +686,38 @@ cpu_startup()
*/
curbuf = (vm_offset_t)buffers + i * MAXBSIZE;
curbufsize = CLBYTES * (i < residual ? base+1 : base);
-
/* this faults in the required physical pages */
vm_map_pageable(buffer_map, curbuf, curbuf+curbufsize, FALSE);
-
vm_map_simplify(buffer_map, curbuf);
+#endif
}
/*
* Allocate a submap for exec arguments. This map effectively
* limits the number of processes exec'ing at any time.
*/
+#if defined(UVM)
+ exec_map = uvm_km_suballoc(kernel_map, &minaddr, &maxaddr,
+ 16*NCARGS, VM_MAP_PAGEABLE, FALSE, NULL);
+#else
exec_map = kmem_suballoc(kernel_map, &minaddr, &maxaddr,
16*NCARGS, TRUE);
+#endif
+
#ifdef DEBUG
printf("exe_map from 0x%x to 0x%x\n", (unsigned)minaddr, (unsigned)maxaddr);
#endif
/*
* Allocate map for physio.
*/
- phys_map = kmem_suballoc(kernel_map, &minaddr, &maxaddr, VM_PHYS_SIZE,
- TRUE);
-
+
+#if defined(UVM)
+ phys_map = uvm_km_suballoc(kernel_map, &minaddr, &maxaddr,
+ VM_PHYS_SIZE, 0, FALSE, NULL);
+#else
+ phys_map = kmem_suballoc(kernel_map, &minaddr, &maxaddr,
+ VM_PHYS_SIZE, TRUE);
+#endif
if (phys_map == NULL) {
panic("cpu_startup: unable to create phys_map");
}
@@ -637,14 +732,16 @@ cpu_startup()
* defined, as it checks (long)addr < 0. So as a workaround, I use
* 0x10000000 as a base address. XXX smurph
*/
- iomap_map = kmem_suballoc(kernel_map, &minaddr, &maxaddr, IOMAP_SIZE,
- TRUE);
-
+#if defined(UVM)
+ iomap_map = uvm_km_suballoc(kernel_map, &iomapbase, &maxaddr,
+ IOMAP_SIZE, 0, FALSE, NULL);
+#else
+ iomap_map = kmem_suballoc(kernel_map, &iomapbase, &maxaddr,
+ IOMAP_SIZE, TRUE);
+#endif
if (iomap_map == NULL) {
panic("cpu_startup: unable to create iomap_map");
}
-
- iomapbase = (void *)kmem_alloc_wait(iomap_map, IOMAP_SIZE);
rminit(iomap, IOMAP_SIZE, (u_long)iomapbase, "iomap", NIOPMAP);
/*
@@ -654,17 +751,26 @@ cpu_startup()
mclrefcnt = (char *)malloc(NMBCLUSTERS+CLBYTES/MCLBYTES,
M_MBUF, M_NOWAIT);
bzero(mclrefcnt, NMBCLUSTERS+CLBYTES/MCLBYTES);
+#if defined(UVM)
+ mb_map = uvm_km_suballoc(kernel_map, (vaddr_t *)&mbutl, &maxaddr,
+ VM_MBUF_SIZE, VM_MAP_INTRSAFE, FALSE, NULL);
+#else
mb_map = kmem_suballoc(kernel_map, (vm_offset_t *)&mbutl, &maxaddr,
VM_MBUF_SIZE, FALSE);
-
+#endif
/*
* Initialize timeouts
*/
timeout_init();
- printf("avail mem = %d\n", ptoa(cnt.v_free_count));
- printf("using %d buffers containing %d bytes of memory\n",
- nbuf, bufpages * CLBYTES);
+#if defined(UVM)
+ printf("avail mem = %ld (%ld pages)\n", ptoa(uvmexp.free), uvmexp.free);
+#else
+ printf("avail mem = %ld (%ld pages)\n", ptoa(cnt.v_free_count),
+ ptoa(cnt.v_free_count)/NBPG);
+#endif
+ printf("using %d buffers containing %d bytes of memory\n", nbuf,
+ bufpages * CLBYTES);
#if 0 /* #ifdef MFS */
/*
@@ -759,7 +865,9 @@ register caddr_t v;
if (nswbuf > 256)
nswbuf = 256; /* sanity */
}
+#if !defined(UVM)
valloc(swbuf, struct buf, nswbuf);
+#endif
valloc(buf, struct buf, nbuf);
#if 1 /*XXX_FUTURE*/
@@ -904,8 +1012,14 @@ union sigval val;
psp->ps_sigstk.ss_flags |= SA_ONSTACK;
} else
fp = (struct sigframe *)(tf->r[31] - fsize);
+#if defined(UVM)
+ if ((unsigned)fp <= USRSTACK - ctob(p->p_vmspace->vm_ssize))
+ (void)uvm_grow(p, (unsigned)fp);
+#else
if ((unsigned)fp <= USRSTACK - ctob(p->p_vmspace->vm_ssize))
(void)grow(p, (unsigned)fp);
+#endif
+
#ifdef DEBUG
if ((sigdebug & SDB_FOLLOW) ||
(sigdebug & SDB_KSTACK) && p->p_pid == sigpid)
@@ -926,7 +1040,6 @@ union sigval val;
initsiginfo(&sf.sf_si, sig, code, type, val);
}
-
/*
* Copy the whole user context into signal context that we
* are building.
@@ -1019,9 +1132,15 @@ register_t *retval;
if (sigdebug & SDB_FOLLOW)
printf("sigreturn: pid %d, scp %x\n", p->p_pid, scp);
#endif
+#if defined(UVM)
+ if ((int)scp & 3 || uvm_useracc((caddr_t)scp, sizeof *scp, B_WRITE) == 0 ||
+ copyin((caddr_t)scp, (caddr_t)&ksc, sizeof(struct sigcontext)))
+ return (EINVAL);
+#else
if ((int)scp & 3 || useracc((caddr_t)scp, sizeof *scp, B_WRITE) == 0 ||
copyin((caddr_t)scp, (caddr_t)&ksc, sizeof(struct sigcontext)))
return (EINVAL);
+#endif
tf = p->p_md.md_tf;
scp = &ksc;
@@ -1033,10 +1152,13 @@ register_t *retval;
if (((scp->sc_xip | scp->sc_nip | scp->sc_fip) & 3) != 0)
return (EINVAL);
#endif /* 0 */
- if (((scp->sc_xip | scp->sc_nip | scp->sc_fip) & 3) != 0)
+#if DIAGNOSTIC
+ if (((scp->sc_xip | scp->sc_nip | scp->sc_fip) & 3) != 0){
printf("xip %x nip %x fip %x\n",
scp->sc_xip, scp->sc_nip, scp->sc_fip);
-
+ return (EINVAL);
+ }
+#endif
/*
* this can be improved by doing
* bcopy(sc_reg to tf, sizeof sigcontext - 2 words)
@@ -1095,8 +1217,8 @@ register int howto;
{
/* take a snap shot before clobbering any registers */
#if 0
- if (curproc)
- savectx(curproc->p_addr->u_pcb);
+ if (curproc && curproc->p_addr)
+ savectx(curpcb);
#endif
boothowto = howto;
if ((howto & RB_NOSYNC) == 0 && waittime < 0) {
@@ -1278,8 +1400,11 @@ vm_offset_t
get_slave_stack(void)
{
vm_offset_t addr = 0;
-
+#if defined(UVM)
+ addr = (vm_offset_t)uvm_km_zalloc(kernel_map, INTSTACK_SIZE + 4096);
+#else
addr = (vm_offset_t)kmem_alloc(kernel_map, INTSTACK_SIZE + 4096);
+#endif
if (addr == NULL)
panic("Cannot allocate slave stack");
@@ -1290,6 +1415,21 @@ get_slave_stack(void)
return addr;
}
+/*
+ * Slave CPU pre-main routine.
+ * Determine CPU number and set it.
+ *
+ * Running on an interrupt stack here; do nothing fancy.
+ *
+ * Called from "mvme88k/locore.S"
+ */
+void slave_pre_main(void)
+{
+ set_cpu_number(cmmu_cpu_number()); /* Determine cpu number by CMMU */
+ splhigh();
+ enable_interrupt();
+}
+
/* dummy main routine for slave processors */
int
slave_main(void)
@@ -1300,12 +1440,8 @@ slave_main(void)
}
/*
- * find a useable interrupt vector in the range start, end. It starts at
- * the end of the range, and searches backwards (to increase the chances
- * of not conflicting with more normal users)
- *
- * XXX This is not used yet. It will provide a facility to 'autovector'
- * VME boards. smurph
+ * Search for the first avilable interrupt vector in the range start, end.
+ * This should really only be used by VME devices.
*/
int
intr_findvec(start, end)
@@ -1314,9 +1450,10 @@ int start, end;
register struct intrhand *intr;
int vec;
+ /* Sanity check! */
if (start < 0 || end > 255 || start > end)
return (-1);
- for (vec = end; vec > start; --vec)
+ for (vec = start; vec < end; --vec)
if (intr_handlers[vec] == (struct intrhand *)0)
return (vec);
return (-1);
@@ -1899,13 +2036,21 @@ dosoftint()
{
if (ssir & SIR_NET) {
siroff(SIR_NET);
+#if defined(UVM)
+ uvmexp.softs++;
+#else
cnt.v_soft++;
+#endif
netintr();
}
if (ssir & SIR_CLOCK) {
siroff(SIR_CLOCK);
+#if defined(UVM)
+ uvmexp.softs++;
+#else
cnt.v_soft++;
+#endif
softclock();
}
@@ -2129,7 +2274,12 @@ mvme_bootstrap(void)
/* startup fake console driver. It will be replaced by consinit() */
cn_tab = &bootcons;
+#if defined(UVM)
+ uvmexp.pagesize = NBPG;
+ uvm_setpagesize();
+#else
vm_set_page_size();
+#endif
first_addr = m88k_round_page(first_addr);
@@ -2161,9 +2311,9 @@ mvme_bootstrap(void)
printf("MVME%x boot: memory from 0x%x to 0x%x\n", cputyp, avail_start, avail_end);
#endif
/*
- * Steal one page at the top of physical memory for msgbuf
+ * Steal MSGBUFSIZE at the top of physical memory for msgbuf
*/
- avail_end -= PAGE_SIZE;
+ avail_end -= m88k_round_page(MSGBUFSIZE);
pmap_bootstrap((vm_offset_t)M88K_TRUNC_PAGE((unsigned)&kernelstart) /* = loadpt */,
&avail_start, &avail_end, &virtual_avail,
&virtual_end);
diff --git a/sys/arch/mvme88k/mvme88k/mem.c b/sys/arch/mvme88k/mvme88k/mem.c
index dc2cfb6a88a..c33772cc6d0 100644
--- a/sys/arch/mvme88k/mvme88k/mem.c
+++ b/sys/arch/mvme88k/mvme88k/mem.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mem.c,v 1.5 1999/11/22 19:22:00 matthieu Exp $ */
+/* $OpenBSD: mem.c,v 1.6 2001/01/13 05:18:59 smurph Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -54,6 +54,9 @@
#include <machine/board.h>
#include <vm/vm.h>
+#if defined(UVM)
+#include <uvm/uvm_extern.h>
+#endif
caddr_t zeropage;
@@ -143,6 +146,34 @@ mmrw(dev, uio, flags)
case 1:
v = uio->uio_offset;
c = min(iov->iov_len, MAXPHYS);
+#if defined(UVM)
+ if (!uvm_kernacc((caddr_t)v, c,
+ uio->uio_rw == UIO_READ ? B_READ : B_WRITE))
+ return (EFAULT);
+#else
+ if (!kernacc((caddr_t)v, c,
+ uio->uio_rw == UIO_READ ? B_READ : B_WRITE))
+ return (EFAULT);
+#endif
+ if (v < NBPG) {
+#ifdef DEBUG
+ /*
+ * For now, return zeros on read of page 0
+ * and EFAULT for writes.
+ */
+ if (uio->uio_rw == UIO_READ) {
+ if (zeropage == NULL) {
+ zeropage = (caddr_t)
+ malloc(CLBYTES, M_TEMP,
+ M_WAITOK);
+ bzero(zeropage, CLBYTES);
+ }
+ c = min(c, NBPG - (int)v);
+ v = (vm_offset_t)zeropage;
+ } else
+#endif
+ return (EFAULT);
+ }
error = uiomove((caddr_t)v, c, uio);
continue;
diff --git a/sys/arch/mvme88k/mvme88k/pmap.c b/sys/arch/mvme88k/mvme88k/pmap.c
index 1b824ce0c0d..e5a1a274607 100644
--- a/sys/arch/mvme88k/mvme88k/pmap.c
+++ b/sys/arch/mvme88k/mvme88k/pmap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap.c,v 1.16 2001/01/12 07:29:26 smurph Exp $ */
+/* $OpenBSD: pmap.c,v 1.17 2001/01/13 05:18:59 smurph Exp $ */
/*
* Copyright (c) 1996 Nivas Madhur
* All rights reserved.
@@ -56,6 +56,9 @@
#include <machine/m882xx.h> /* CMMU stuff */
#include <vm/vm.h>
#include <vm/vm_kern.h> /* vm/vm_kern.h */
+#if defined(UVM)
+#include <uvm/uvm.h>
+#endif
#include <sys/simplelock.h>
#include <sys/proc.h>
@@ -140,7 +143,7 @@ int pmap_con_dbg = CD_NORM;*/
caddr_t vmmap;
pt_entry_t *vmpte, *msgbufmap;
-STATIC struct pmap kernel_pmap_store;
+struct pmap kernel_pmap_store;
pmap_t kernel_pmap = &kernel_pmap_store;
typedef struct kpdt_entry *kpdt_entry_t;
@@ -363,9 +366,6 @@ int batc_used;
*/
batc_entry_t batc_entry[BATC_MAX];
-int maxcmmu_pb = 4; /* max number of CMMUs per processors pbus */
-int n_cmmus_pb = 1; /* number of CMMUs per processors pbus */
-
vm_offset_t kmapva = 0;
extern vm_offset_t bugromva;
extern vm_offset_t sramva;
@@ -1826,7 +1826,11 @@ pmap_pinit(pmap_t p)
/*
* Allocate memory for *actual* segment table and *shadow* table.
*/
+#if defined(UVM)
+ segdt = (sdt_entry_t *)uvm_km_zalloc(kernel_map, 2 * SDT_SIZE);
+#else
segdt = (sdt_entry_t *)kmem_alloc(kernel_map, 2 * SDT_SIZE);
+#endif
if (segdt == NULL)
panic("pmap_create: kmem_alloc failure");
@@ -1977,7 +1981,11 @@ pmap_free_tables(pmap_t pmap)
/*
* Freeing both *actual* and *shadow* segment tables
*/
+#if defined(UVM)
+ uvm_km_free(kernel_map, (vm_offset_t)sdttbl, 2*SDT_SIZE);
+#else
kmem_free(kernel_map, (vm_offset_t)sdttbl, 2*SDT_SIZE);
+#endif
} /* pmap_free_tables() */
@@ -2832,8 +2840,12 @@ pmap_expand(pmap_t map, vm_offset_t v)
panic("pmap_enter: kmem_alloc failure");
pmap_zero_page(pmap_extract(kernel_pmap, pdt_vaddr));
#else
+#if defined(UVM)
+ pdt_vaddr = uvm_km_zalloc(kernel_map, PAGE_SIZE);
+#else
pdt_vaddr = kmem_alloc (kernel_map, PAGE_SIZE);
#endif
+#endif
pdt_paddr = pmap_extract(kernel_pmap, pdt_vaddr);
@@ -2853,7 +2865,12 @@ pmap_expand(pmap_t map, vm_offset_t v)
*/
PMAP_UNLOCK(map, spl);
/* XXX */
+#if defined(UVM)
+ uvm_km_free(kernel_map, pdt_vaddr, PAGE_SIZE);
+#else
kmem_free (kernel_map, pdt_vaddr, PAGE_SIZE);
+#endif
+
#ifdef DEBUG
if (pmap_con_dbg & CD_EXP)
printf("(pmap_expand :%x) table has already allocated\n", curproc);
@@ -3703,19 +3720,19 @@ pmap_deactivate(struct proc *p)
} /* pmap_deactivate() */
-
/*
* Routine: PMAP_KERNEL
*
* Function:
* Retruns a pointer to the kernel pmap.
*/
+#if 0 /* Now a macro XXX smurph */
pmap_t
pmap_kernel(void)
{
return (kernel_pmap);
}/* pmap_kernel() */
-
+#endif
/*
* Routine: PMAP_COPY_PAGE
diff --git a/sys/arch/mvme88k/mvme88k/trap.c b/sys/arch/mvme88k/mvme88k/trap.c
index 439e67200e0..d2d43a3b00e 100644
--- a/sys/arch/mvme88k/mvme88k/trap.c
+++ b/sys/arch/mvme88k/mvme88k/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.10 2000/11/10 18:15:40 art Exp $ */
+/* $OpenBSD: trap.c,v 1.11 2001/01/13 05:19:00 smurph Exp $ */
/*
* Copyright (c) 1998 Steve Murphree, Jr.
* Copyright (c) 1996 Nivas Madhur
@@ -48,7 +48,9 @@
#include <sys/param.h>
#include <vm/vm.h>
#include <vm/vm_kern.h> /* kernel_map */
-
+#if defined(UVM)
+#include <uvm/uvm_extern.h>
+#endif
#include <sys/proc.h>
#include <sys/signalvar.h>
#include <sys/user.h>
@@ -104,7 +106,7 @@ char *trap_type[] = {
"Data Access Exception",
"Misaligned Access",
"Unimplemented Opcode",
- "Privileg Violation",
+ "Privilege Violation"
"Bounds Check Violation",
"Illegal Integer Divide",
"Integer Overflow",
@@ -226,7 +228,11 @@ trap(unsigned type, struct m88100_saved_state *frame)
last_trap[2] = last_trap[3];
last_trap[3] = type;
}
+#if defined(UVM)
+ uvmexp.traps++;
+#else
cnt.v_trap++;
+#endif
if ((p = curproc) == NULL)
p = &proc0;
@@ -375,7 +381,13 @@ trap(unsigned type, struct m88100_saved_state *frame)
*/
if ((frame->dpfsr >> 16 & 0x7) == 0x4 /* seg fault */
|| (frame->dpfsr >> 16 & 0x7) == 0x5) { /* page fault */
+#if defined(UVM)
+ result = uvm_fault(map, va, 0, ftype);
+#else
result = vm_fault(map, va, ftype, FALSE);
+#endif
+
+
/*
printf("vm_fault(map 0x%x, va 0x%x, ftype 0x%x, FALSE) -> %d (%s)\n",
map, va, ftype, result,
@@ -451,8 +463,11 @@ trap(unsigned type, struct m88100_saved_state *frame)
/* Call vm_fault() to resolve non-bus error faults */
if ((frame->ipfsr >> 16 & 0x7) != 0x3 &&
(frame->dpfsr >> 16 & 0x7) != 0x3) {
-
+#if defined(UVM)
+ result = uvm_fault(map, va, 0, ftype);
+#else
result = vm_fault(map, va, ftype, FALSE);
+#endif
frame->ipfsr = frame->dpfsr = 0;
/*
printf("vm_fault(map 0x%x, va 0x%x, ftype 0x%x, FALSE) -> %d (%s)\n",
@@ -628,6 +643,11 @@ trap(unsigned type, struct m88100_saved_state *frame)
break;
case T_ASTFLT+T_USER:
+#if defined(UVM)
+ uvmexp.softs++;
+#else
+ cnt.v_soft++;
+#endif
want_ast = 0;
if (p->p_flag & P_OWEUPC) {
p->p_flag &= ~P_OWEUPC;
@@ -683,7 +703,12 @@ trap2(unsigned type, struct m88100_saved_state *frame)
extern unsigned guarded_access_end;
extern unsigned guarded_access_bad;
+#if defined(UVM)
+ uvmexp.traps++;
+#else
cnt.v_trap++;
+#endif
+
if ((p = curproc) == NULL)
p = &proc0;
@@ -851,6 +876,7 @@ trap2(unsigned type, struct m88100_saved_state *frame)
DEBUG_MSG("test trap "
"page fault @ 0x%08x\n", frame->sxip);
panictrap(frame->vector, frame);
+ break;
case T_MISALGNFLT:
DEBUG_MSG("kernel misalgined "
@@ -945,7 +971,11 @@ m197_data_fault:
if (type == T_DATAFLT) {
if ((frame->dsr & CMMU_DSR_SI) /* seg fault */
|| (frame->dsr & CMMU_DSR_PI)) { /* page fault */
+#if defined(UVM)
+ result = uvm_fault(map, va, 0, ftype);
+#else
result = vm_fault(map, va, ftype, FALSE);
+#endif
if (result == KERN_SUCCESS) {
return;
}
@@ -953,7 +983,11 @@ m197_data_fault:
} else {
if ((frame->isr & CMMU_ISR_SI) /* seg fault */
|| (frame->isr & CMMU_ISR_PI)) { /* page fault */
+#if defined(UVM)
+ result = uvm_fault(map, va, 0, ftype);
+#else
result = vm_fault(map, va, ftype, FALSE);
+#endif
if (result == KERN_SUCCESS) {
return;
}
@@ -1007,7 +1041,11 @@ m197_user_fault:
if (type == T_DATAFLT+T_USER) {
if ((frame->dsr & CMMU_DSR_SI) /* seg fault */
|| (frame->dsr & CMMU_DSR_PI)) { /* page fault */
+#if defined(UVM)
+ result = uvm_fault(map, va, 0, ftype);
+#else
result = vm_fault(map, va, ftype, FALSE);
+#endif
if (result == KERN_SUCCESS) {
return;
}
@@ -1015,7 +1053,11 @@ m197_user_fault:
} else {
if ((frame->isr & CMMU_ISR_SI) /* seg fault */
|| (frame->isr & CMMU_ISR_PI)) { /* page fault */
+#if defined(UVM)
+ result = uvm_fault(map, va, 0, ftype);
+#else
result = vm_fault(map, va, ftype, FALSE);
+#endif
if (result == KERN_SUCCESS) {
return;
}
@@ -1158,6 +1200,11 @@ m197_user_fault:
break;
case T_ASTFLT+T_USER:
+#if defined(UVM)
+ uvmexp.softs++;
+#else
+ cnt.v_soft++;
+#endif
want_ast = 0;
if (p->p_flag & P_OWEUPC) {
p->p_flag &= ~P_OWEUPC;
@@ -1240,7 +1287,11 @@ syscall(register_t code, struct m88100_saved_state *tf)
u_quad_t sticks;
extern struct pcb *curpcb;
+#if defined(UVM)
+ uvmexp.syscalls++;
+#else
cnt.v_syscall++;
+#endif
p = curproc;
@@ -1396,7 +1447,11 @@ m197_syscall(register_t code, struct m88100_saved_state *tf)
u_quad_t sticks;
extern struct pcb *curpcb;
+#if defined(UVM)
+ uvmexp.syscalls++;
+#else
cnt.v_syscall++;
+#endif
p = curproc;
diff --git a/sys/arch/mvme88k/mvme88k/vm_machdep.c b/sys/arch/mvme88k/mvme88k/vm_machdep.c
index bcf30882ccb..f398c86d117 100644
--- a/sys/arch/mvme88k/mvme88k/vm_machdep.c
+++ b/sys/arch/mvme88k/mvme88k/vm_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vm_machdep.c,v 1.16 2001/01/12 07:29:26 smurph Exp $ */
+/* $OpenBSD: vm_machdep.c,v 1.17 2001/01/13 05:19:00 smurph Exp $ */
/*
* Copyright (c) 1998 Steve Murphree, Jr.
@@ -59,6 +59,10 @@
#include <vm/vm_kern.h>
#include <vm/vm_map.h>
+#if defined(UVM)
+#include <uvm/uvm_extern.h>
+#endif
+
#include <machine/cpu.h>
#include <machine/cpu_number.h>
#include <machine/pte.h>
@@ -105,7 +109,7 @@ cpu_fork(struct proc *p1, struct proc *p2, void *stack, size_t stacksize)
/*XXX these may not be necessary nivas */
save_u_area(p2, p2->p_addr);
#ifdef notneeded
- PMAP_ACTIVATE(p2->p_vmspace->vm_map.pmap, &p2->p_addr->u_pcb, cpu);
+ pmap_activate(p2);
#endif /* notneeded */
/*
@@ -250,7 +254,11 @@ vmapbuf(struct buf *bp, vm_size_t len)
* when the address gets a new mapping.
*/
+#if defined(UVM)
+ kva = uvm_km_valloc_wait(phys_map, len);
+#else
kva = kmem_alloc_wait(phys_map, len);
+#endif
/*
* Flush the TLB for the range [kva, kva + off]. Strictly speaking,
@@ -289,7 +297,11 @@ vunmapbuf(struct buf *bp, vm_size_t len)
addr = trunc_page(bp->b_data);
off = (vm_offset_t)bp->b_data & PGOFSET;
len = round_page(off + len);
+#if defined(UVM)
+ uvm_km_free_wakeup(phys_map, addr, len);
+#else
kmem_free_wakeup(phys_map, addr, len);
+#endif
bp->b_data = bp->b_saveaddr;
bp->b_saveaddr = 0;
}
@@ -314,7 +326,7 @@ iomap_mapin(vm_offset_t pa, vm_size_t len, boolean_t canwait)
return NULL;
ppa = pa;
- off = (u_long)ppa & PGOFSET;
+ off = (u_long)ppa & PGOFSET;
len = round_page(off + len);
@@ -332,19 +344,19 @@ iomap_mapin(vm_offset_t pa, vm_size_t len, boolean_t canwait)
}
splx(s);
- cmmu_flush_tlb(1, iova, len);
+ cmmu_flush_tlb(1, iova, len);
- ppa = trunc_page(ppa);
+ ppa = trunc_page(ppa);
#ifndef NEW_MAPPING
tva = iova;
#else
- tva = ppa;
+ tva = ppa;
#endif
- while (len>0) {
+ while (len>0) {
pmap_enter(vm_map_pmap(iomap_map), tva, ppa,
- VM_PROT_WRITE|VM_PROT_READ|(CACHE_INH << 16), 1, 0);
+ VM_PROT_WRITE|VM_PROT_READ|(CACHE_INH << 16), 1, 0);
len -= PAGE_SIZE;
tva += PAGE_SIZE;
ppa += PAGE_SIZE;
diff --git a/sys/arch/mvme88k/stand/Makefile.inc b/sys/arch/mvme88k/stand/Makefile.inc
index cba87098009..998c69f16a4 100644
--- a/sys/arch/mvme88k/stand/Makefile.inc
+++ b/sys/arch/mvme88k/stand/Makefile.inc
@@ -1,3 +1,9 @@
-# $OpenBSD: Makefile.inc,v 1.2 1998/08/22 08:57:28 smurph Exp $
+# $OpenBSD: Makefile.inc,v 1.3 2001/01/13 05:19:00 smurph Exp $
MDEC_DIR?=/usr/mdec
+
+# Load addresses for first and second stage bootstraps
+STAGE1_RELOC=0x001F0000
+STAGE2_RELOC=0x00AF0000
+
+
diff --git a/sys/arch/mvme88k/stand/bootsd/Makefile b/sys/arch/mvme88k/stand/bootsd/Makefile
index 2750dd421f3..693a192ed57 100644
--- a/sys/arch/mvme88k/stand/bootsd/Makefile
+++ b/sys/arch/mvme88k/stand/bootsd/Makefile
@@ -1,15 +1,13 @@
# from: @(#)Makefile 8.1 (Berkeley) 6/10/93
-# $OpenBSD: Makefile,v 1.6 1999/09/27 19:29:58 smurph Exp $
+# $OpenBSD: Makefile,v 1.7 2001/01/13 05:19:00 smurph Exp $
-# 8Meg - 64K
-RELOC=0x7F0000
S= ${.CURDIR}/../../../..
DEFS=
INCPATH=-I${.CURDIR} -I${.CURDIR}/../libsa -I${.CURDIR}/../libbug \
-I${.CURDIR}/../../include -I${S} -I${S}/lib/libsa
CFLAGS=-O0 ${INCPATH} ${DEFS} ${COPTS}
-LDFLAGS=-N -T ${RELOC}
+LDFLAGS=-N -T ${STAGE2_RELOC}
CLEANFILES+=bootsd
.include "${S}/arch/mvme88k/stand/bugcrt/Makefile.inc"
@@ -28,9 +26,9 @@ ALL= ${BOOTS}
all: ${ALL}
-bootsd: ${OBJS} ${SDCRT} ${LIBS}
+bootsd: ${OBJS} ${STAGE2} ${LIBS}
${LD} ${LDFLAGS} -o $@ \
- ${SDCRT} ${OBJS} ${LIBS}
+ ${STAGE2} ${OBJS} ${LIBS}
install:
install -c -m 555 -g bin -o bin ${BOOTS} ${DESTDIR}${MDEC_DIR}
diff --git a/sys/arch/mvme88k/stand/bootsd/boot.c b/sys/arch/mvme88k/stand/bootsd/boot.c
index c1c12c2ecab..cd23d6fafd2 100644
--- a/sys/arch/mvme88k/stand/bootsd/boot.c
+++ b/sys/arch/mvme88k/stand/bootsd/boot.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: boot.c,v 1.4 1999/09/27 19:29:59 smurph Exp $ */
+/* $OpenBSD: boot.c,v 1.5 2001/01/13 05:19:00 smurph Exp $ */
/* $NetBSD: boot.c,v 1.2 1995/09/23 03:42:52 gwr Exp $ */
/*-
@@ -52,21 +52,21 @@
int debug;
int errno;
extern char *version;
-char line[80];
+char line[80];
int
main()
{
char *cp, *file;
- int io, flag, ret;
- int ask = 0;
+ int io, flag, ret;
+ int ask = 0;
printf("\n>> OpenBSD/mvme88k bootsd [%s]\n", version);
ret = parse_args(&file, &flag);
- if (flag & RB_ASKKERN) {
- ask = 1;
- }
+ if (flag & RB_ASKKERN) {
+ ask = 1;
+ }
for (;;) {
if (ask) {
printf("boot: ");
@@ -88,5 +88,5 @@ main()
printf("boot: %s: %s\n", file, strerror(errno));
ask = 1;
}
- return(0);
+ return (0);
}
diff --git a/sys/arch/mvme88k/stand/bootst/Makefile b/sys/arch/mvme88k/stand/bootst/Makefile
index 165b38d8321..82f0a38f81a 100644
--- a/sys/arch/mvme88k/stand/bootst/Makefile
+++ b/sys/arch/mvme88k/stand/bootst/Makefile
@@ -1,8 +1,6 @@
# from: @(#)Makefile 8.1 (Berkeley) 6/10/93
-# $OpenBSD: Makefile,v 1.6 1999/09/27 19:29:59 smurph Exp $
+# $OpenBSD: Makefile,v 1.7 2001/01/13 05:19:00 smurph Exp $
-# 8Meg - 64K
-RELOC=0x7F0000
SIZE?= size
S= ${.CURDIR}/../../../..
@@ -10,7 +8,7 @@ DEFS= -DSTANDALONE -DCOMPAT_NOLABEL
INCPATH=-I${.CURDIR} -I${.CURDIR}/../libsa -I${.CURDIR}/../libbug \
-I${.CURDIR}/../../include -I${S} -I${S}/lib/libsa
CFLAGS=-O0 ${INCPATH} ${DEFS} ${COPTS}
-LDFLAGS=-s -N -T ${RELOC}
+LDFLAGS=-s -N -T ${STAGE2_RELOC}
CLEANFILES+=stboot bootst bootst.bug
.include "${S}/arch/mvme88k/stand/wrtvid/Makefile.inc"
@@ -30,8 +28,8 @@ ALL= ${BOOTS}
all: ${ALL}
-bootst.bug: ${OBJS} ${BUGCRT} ${LIBS}
- ${LD} ${LDFLAGS} ${BUGCRT} ${OBJS} ${LIBS} -o $@
+bootst.bug: ${OBJS} ${SINGLE} ${LIBS}
+ ${LD} ${LDFLAGS} ${SINGLE} ${OBJS} ${LIBS} -o $@
@${SIZE} bootst.bug
bootst stboot: bootst.bug ${WRTVID}
diff --git a/sys/arch/mvme88k/stand/bootxx/Makefile b/sys/arch/mvme88k/stand/bootxx/Makefile
index 7a944c54b8f..70d139447f2 100644
--- a/sys/arch/mvme88k/stand/bootxx/Makefile
+++ b/sys/arch/mvme88k/stand/bootxx/Makefile
@@ -1,10 +1,8 @@
# from: @(#)Makefile 8.1 (Berkeley) 6/10/93
-# $OpenBSD: Makefile,v 1.5 1999/09/27 19:29:59 smurph Exp $
-
-RELOC=0x1F0000
+# $OpenBSD: Makefile,v 1.6 2001/01/13 05:19:01 smurph Exp $
S= ${.CURDIR}/../../../..
-DEFS=
+DEFS=-DSTAGE2_RELOC=${STAGE2_RELOC}
INCPATH=-I${.CURDIR} -I${.CURDIR}/../libsa -I${.CURDIR}/../libbug \
-I${.CURDIR}/../../include -I${S} -I${S}/lib/libsa
CFLAGS=-O0 ${INCPATH} ${DEFS} ${COPTS}
@@ -26,8 +24,8 @@ ALL= ${BOOTS}
all: ${ALL}
-bootxx: ${OBJS} ${BUGCRT} ${LIBS}
- ${LD} -N -T ${RELOC} ${BUGCRT} ${OBJS} ${LIBS} -o $@
+bootxx: ${OBJS} ${STAGE1} ${LIBS}
+ ${LD} -N -T ${STAGE1_RELOC} ${STAGE1} ${OBJS} ${LIBS} -o $@
install:
install -c -m 555 -g bin -o bin ${BOOTS} ${DESTDIR}${MDEC_DIR}
diff --git a/sys/arch/mvme88k/stand/bootxx/bootxx.c b/sys/arch/mvme88k/stand/bootxx/bootxx.c
index 313fa9d32a5..f7ac21944cf 100644
--- a/sys/arch/mvme88k/stand/bootxx/bootxx.c
+++ b/sys/arch/mvme88k/stand/bootxx/bootxx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bootxx.c,v 1.3 1999/09/27 19:29:59 smurph Exp $ */
+/* $OpenBSD: bootxx.c,v 1.4 2001/01/13 05:19:01 smurph Exp $ */
/*
* Copyright (c) 1994 Paul Kranenburg
@@ -51,8 +51,6 @@
/*
* Boot device is derived from ROM provided information.
*/
-#define LOADADDR 0x7F0000 /* where to load level 2 bootstrap */
- /* (l2 must relocate itself) */
/* This determines the largest boot program we can load. */
#define MAXBLOCKNUM 64
@@ -86,7 +84,7 @@ main()
_rtt();
}
- addr = (char*)LOADADDR;
+ addr = (char*)STAGE2_RELOC;
error = copyboot(&f, addr);
f.f_dev->dv_close(&f);
if (!error) {
diff --git a/sys/arch/mvme88k/stand/bugcrt/Makefile b/sys/arch/mvme88k/stand/bugcrt/Makefile
index 05e4338be31..581ee9ab1fd 100644
--- a/sys/arch/mvme88k/stand/bugcrt/Makefile
+++ b/sys/arch/mvme88k/stand/bugcrt/Makefile
@@ -1,24 +1,33 @@
-# $OpenBSD: Makefile,v 1.6 1999/09/27 19:30:00 smurph Exp $
+# $OpenBSD: Makefile,v 1.7 2001/01/13 05:19:01 smurph Exp $
#
# DO NOT OPTMIZE bugcrt (i.e. no "-O2")
#
S=${.CURDIR}/../../../..
+
CFLAGS=-I${.CURDIR}/../../include -I${.CURDIR}/../libbug -I${S}/lib/libsa \
-fomit-frame-pointer -save-temps
+STAGE1_CFLAGS=-DSTACK_ASM_OP="\".long ${STAGE1_RELOC}\"" -DSTAGE1
+STAGE2_CFLAGS=-DSTACK_ASM_OP="\".long ${STAGE2_RELOC}\""
+SINGLE_CFLAGS=-DSTACK_ASM_OP="\".long ${STAGE2_RELOC}\"" -DSTAGE1
+SRCS=crt.c
+OBJS=stage1crt.o stage2crt.o singlecrt.o
-OBJS=bugcrt.o sdcrt.o
-
-CLEANFILES+=a.out ${OBJS}
+CLEANFILES+=a.out ${OBJS} *.i *.s
all: ${OBJS}
-bugcrt.o: bugcrt.c
- ${COMPILE.c} -c $<
+stage1crt.o: crt.c
+ ${CC} ${CFLAGS} ${STAGE1_CFLAGS} -c ${.CURDIR}/crt.c -o ${.TARGET}
+ ${LD} -x -r ${.TARGET}
+ mv a.out ${.TARGET}
+
+stage2crt.o: crt.c
+ ${CC} ${CFLAGS} ${STAGE1_CFLAGS} -c ${.CURDIR}/crt.c -o ${.TARGET}
${LD} -x -r ${.TARGET}
mv a.out ${.TARGET}
-sdcrt.o: sdcrt.c
- ${COMPILE.c} -c $<
+singlecrt.o: crt.c
+ ${CC} ${CFLAGS} ${SINGLE_CFLAGS} -c ${.CURDIR}/crt.c -o ${.TARGET}
${LD} -x -r ${.TARGET}
mv a.out ${.TARGET}
diff --git a/sys/arch/mvme88k/stand/bugcrt/Makefile.inc b/sys/arch/mvme88k/stand/bugcrt/Makefile.inc
index 2a793d527a7..52a7b8cc7b1 100644
--- a/sys/arch/mvme88k/stand/bugcrt/Makefile.inc
+++ b/sys/arch/mvme88k/stand/bugcrt/Makefile.inc
@@ -1,19 +1,24 @@
-# $OpenBSD: Makefile.inc,v 1.3 1998/12/15 06:12:50 smurph Exp $
+# $OpenBSD: Makefile.inc,v 1.4 2001/01/13 05:19:01 smurph Exp $
BUG_CRT_DIR=${S}/arch/mvme88k/stand/bugcrt
BUGCRT_DIR!= cd ${BUG_CRT_DIR}; \
printf "xxx:\n\techo \$${.OBJDIR}\n" | ${MAKE} -r -s -f - xxx
-BUGCRT=${BUGCRT_DIR}/bugcrt.o
-SDCRT=${BUGCRT_DIR}/sdcrt.o
+STAGE1=${BUGCRT_DIR}/stage1crt.o
+STAGE2=${BUGCRT_DIR}/stage2crt.o
+SINGLE=${BUGCRT_DIR}/singlecrt.o
-$(BUGCRT): .NOTMAIN __always_make_bugcrt
- @echo making sure the bugcrt is up to date...
- @(cd ${BUG_CRT_DIR}; ${MAKE})
+$(STAGE1): .NOTMAIN __always_make_bugcrt
+ @echo making sure the stage1crt.o is up to date...
+ @(cd ${BUG_CRT_DIR}; ${MAKE} stage1crt.o)
-$(SDCRT): .NOTMAIN __always_make_bugcrt
- @echo making sure the sdcrt is up to date...
- @(cd ${BUG_CRT_DIR}; ${MAKE})
+$(STAGE2): .NOTMAIN __always_make_bugcrt
+ @echo making sure the stage2crt.o is up to date...
+ @(cd ${BUG_CRT_DIR}; ${MAKE} stage2crt.o)
+
+$(SINGLE): .NOTMAIN __always_make_bugcrt
+ @echo making sure the singlecrt.o is up to date...
+ @(cd ${BUG_CRT_DIR}; ${MAKE} singlecrt.o)
__always_make_bugcrt: .NOTMAIN
diff --git a/sys/arch/mvme88k/stand/bugcrt/bugcrt.c b/sys/arch/mvme88k/stand/bugcrt/bugcrt.c
index c0db590ca37..667ae0596d1 100644
--- a/sys/arch/mvme88k/stand/bugcrt/bugcrt.c
+++ b/sys/arch/mvme88k/stand/bugcrt/bugcrt.c
@@ -1,13 +1,20 @@
-/* $OpenBSD: bugcrt.c,v 1.5 1999/09/27 19:30:00 smurph Exp $ */
+/* $OpenBSD: bugcrt.c,v 1.6 2001/01/13 05:19:01 smurph Exp $ */
+
+/*
+ * This is the startup file for single stage bootstraps or the first
+ * stage of a two stage bootstrap. It includes code to enable the
+ * SFU1.
+ */
+
#include <sys/types.h>
#include <machine/prom.h>
-struct mvmeprom_args bugargs = { 1 }; /* not BSS */
+struct mvmeprom_args bugargs = { 1}; /* not BSS */
asm (".text");
/* pseudo reset vector */
- asm (".long 0x00Af0000"); /* initial sp value */
- asm (".long _start"); /* initial ip value */
+ asm (STACK_ASM_OP); /* initial sp value */
+ asm (".long _start"); /* initial ip value */
start()
{
register int dev_lun asm (MVMEPROM_REG_DEVLUN);
@@ -23,12 +30,14 @@ start()
extern int edata, end;
struct mvmeprom_brdid *id, *mvmeprom_brdid();
+#ifdef STAGE1
/* Do not use r10 to enable the SFU1. This wipes out
the netboot args. Not cool at all... r25 seems free. */
- asm("| enable SFU1");
- asm(" ldcr r25,cr1");
- asm(" xor r25,r25,0x8");
- asm(" stcr r25,cr1");
+ asm("| enable SFU1");
+ asm(" ldcr r25,cr1");
+ asm(" xor r25,r25,0x8");
+ asm(" stcr r25,cr1");
+#endif
bugargs.dev_lun = dev_lun;
bugargs.ctrl_lun = ctrl_lun;
@@ -40,42 +49,42 @@ start()
bugargs.arg_end = arg_end;
bugargs.nbarg_start = nbarg_start;
bugargs.nbarg_end = nbarg_end;
- *bugargs.arg_end = 0;
-/*
+ *bugargs.arg_end = 0;
+
id = mvmeprom_brdid();
bugargs.cputyp = id->model;
-*/
- /*
- * Initialize PSR and CMMU to a known, stable state.
- * This has to be done early for MVME197.
- * Per EB162 mc88110 engineering bulletin.
- */
- /*
- if (bugargs.cputyp == 0x197) {
- asm("| init MVME197");
- asm("| 1. PSR");
- asm("or.u r2,r0,0xA200");
- asm("or r2,r2,0x03E2");
- asm("stcr r2,cr1");
- asm("| 2. ICTL");
- asm("or r2,r0,r0");
- asm("or r2,r2,0x8000");
- asm("or r2,r2,0x0040");
- asm("stcr r2,cr26");
- asm("| 3. DCTL");
- asm("or r2,r0,r0");
- asm("or r2,r2,0x2000");
- asm("or r2,r2,0x0040");
- asm("stcr r2,cr41");
- asm("| 4. init cache");
- asm("or r2,r0,0x01");
- asm("stcr r2,cr25");
- asm("stcr r2,cr40");
- }
- */
- memset(&edata, 0, ((int)&end - (int)&edata));
-
- asm ("| main()");
+
+ /*
+ * Initialize PSR and CMMU to a known, stable state.
+ * This has to be done early for MVME197.
+ * Per EB162 mc88110 engineering bulletin.
+ */
+ /*
+ if (bugargs.cputyp == 0x197) {
+ asm("| init MVME197");
+ asm("| 1. PSR");
+ asm("or.u r2,r0,0xA200");
+ asm("or r2,r2,0x03E2");
+ asm("stcr r2,cr1");
+ asm("| 2. ICTL");
+ asm("or r2,r0,r0");
+ asm("or r2,r2,0x8000");
+ asm("or r2,r2,0x0040");
+ asm("stcr r2,cr26");
+ asm("| 3. DCTL");
+ asm("or r2,r0,r0");
+ asm("or r2,r2,0x2000");
+ asm("or r2,r2,0x0040");
+ asm("stcr r2,cr41");
+ asm("| 4. init cache");
+ asm("or r2,r0,0x01");
+ asm("stcr r2,cr25");
+ asm("stcr r2,cr40");
+ }
+ */
+ memset(&edata, 0, ((int)&end - (int)&edata));
+
+ asm ("| main()");
main();
mvmeprom_return();
/* NOTREACHED */
diff --git a/sys/arch/mvme88k/stand/bugcrt/crt.c b/sys/arch/mvme88k/stand/bugcrt/crt.c
new file mode 100644
index 00000000000..9b5c1debce4
--- /dev/null
+++ b/sys/arch/mvme88k/stand/bugcrt/crt.c
@@ -0,0 +1,125 @@
+/* $OpenBSD: crt.c,v 1.1 2001/01/13 05:19:01 smurph Exp $ */
+
+#include <sys/types.h>
+#include <machine/prom.h>
+
+struct mvmeprom_args bugargs = { 1}; /* not BSS */
+
+asm (".text");
+/* pseudo reset vector */
+asm (STACK_ASM_OP); /* initial sp value */
+asm (".long _start"); /* initial ip value */
+start()
+{
+ register int dev_lun asm (MVMEPROM_REG_DEVLUN);
+ register int ctrl_lun asm (MVMEPROM_REG_CTRLLUN);
+ register int flags asm (MVMEPROM_REG_FLAGS);
+ register int ctrl_addr asm (MVMEPROM_REG_CTRLADDR);
+ register int entry asm (MVMEPROM_REG_ENTRY);
+ register int conf_blk asm (MVMEPROM_REG_CONFBLK);
+ register char *arg_start asm (MVMEPROM_REG_ARGSTART);
+ register char *arg_end asm (MVMEPROM_REG_ARGEND);
+ register char *nbarg_start asm (MVMEPROM_REG_NBARGSTART);
+ register char *nbarg_end asm (MVMEPROM_REG_NBARGEND);
+ extern int edata, end;
+ struct mvmeprom_brdid *id, *mvmeprom_brdid();
+
+#ifdef STAGE1
+ /*
+ * This code enables the SFU1 and is used for single stage
+ * bootstraps or the first stage of a two stage bootstrap.
+ * Do not use r10 to enable the SFU1. This wipes out
+ * the netboot args. Not cool at all... r25 seems free.
+ */
+ asm("| enable SFU1");
+ asm(" ldcr r25,cr1");
+ asm(" xor r25,r25,0x8");
+ asm(" stcr r25,cr1");
+#endif
+
+ bugargs.dev_lun = dev_lun;
+ bugargs.ctrl_lun = ctrl_lun;
+ bugargs.flags = flags;
+ bugargs.ctrl_addr = ctrl_addr;
+ bugargs.entry = entry;
+ bugargs.conf_blk = conf_blk;
+ bugargs.arg_start = arg_start;
+ bugargs.arg_end = arg_end;
+ bugargs.nbarg_start = nbarg_start;
+ bugargs.nbarg_end = nbarg_end;
+ *bugargs.arg_end = 0;
+
+ id = mvmeprom_brdid();
+ bugargs.cputyp = id->model;
+
+#ifdef notyet /* STAGE1 */
+ /*
+ * Initialize PSR and CMMU to a known, stable state.
+ * This has to be done early for MVME197.
+ * Per EB162 mc88110 engineering bulletin.
+ */
+ if (bugargs.cputyp == 0x197) {
+ asm("| init MVME197");
+ asm("| 1. PSR");
+ asm("or.u r2,r0,0xA200");
+ asm("or r2,r2,0x03E2");
+ asm("stcr r2,cr1");
+ asm("| 2. ICTL");
+ asm("or r2,r0,r0");
+ asm("or r2,r2,0x8000");
+ asm("or r2,r2,0x0040");
+ asm("stcr r2,cr26");
+ asm("| 3. DCTL");
+ asm("or r2,r0,r0");
+ asm("or r2,r2,0x2000");
+ asm("or r2,r2,0x0040");
+ asm("stcr r2,cr41");
+ asm("| 4. init cache");
+ asm("or r2,r0,0x01");
+ asm("stcr r2,cr25");
+ asm("stcr r2,cr40");
+ }
+#endif
+
+ memset(&edata, 0, ((int)&end - (int)&edata));
+
+ asm ("| main()");
+ main();
+ mvmeprom_return();
+ /* NOTREACHED */
+}
+
+__main()
+{
+}
+
+void
+bugexec(addr)
+
+void (*addr)();
+
+{
+ register int dev_lun asm (MVMEPROM_REG_DEVLUN);
+ register int ctrl_lun asm (MVMEPROM_REG_CTRLLUN);
+ register int flags asm (MVMEPROM_REG_FLAGS);
+ register int ctrl_addr asm (MVMEPROM_REG_CTRLADDR);
+ register int entry asm (MVMEPROM_REG_ENTRY);
+ register int conf_blk asm (MVMEPROM_REG_CONFBLK);
+ register char *arg_start asm (MVMEPROM_REG_ARGSTART);
+ register char *arg_end asm (MVMEPROM_REG_ARGEND);
+
+ dev_lun = bugargs.dev_lun;
+ ctrl_lun = bugargs.ctrl_lun;
+ flags = bugargs.flags;
+ ctrl_addr = bugargs.ctrl_addr;
+ entry = bugargs.entry;
+ conf_blk = bugargs.conf_blk;
+ arg_start = bugargs.arg_start;
+ arg_end = bugargs.arg_end;
+
+ (*addr)();
+ printf("bugexec: 0x%x returned!\n", addr);
+
+ _rtt();
+}
+
diff --git a/sys/arch/mvme88k/stand/bugcrt/sdcrt.c b/sys/arch/mvme88k/stand/bugcrt/sdcrt.c
index 74d8a5e6d7d..70e3d237401 100644
--- a/sys/arch/mvme88k/stand/bugcrt/sdcrt.c
+++ b/sys/arch/mvme88k/stand/bugcrt/sdcrt.c
@@ -1,4 +1,10 @@
-/* $OpenBSD: sdcrt.c,v 1.1 1998/12/15 06:12:50 smurph Exp $ */
+/* $OpenBSD: sdcrt.c,v 1.2 2001/01/13 05:19:01 smurph Exp $ */
+
+/*
+ * This is the startup file for the second stage bootstrap. (bootsd)
+ * It does *not* includes code to enable the SFU1.
+ */
+
#include <sys/types.h>
#include <machine/prom.h>
@@ -6,8 +12,8 @@ struct mvmeprom_args bugargs = { 1 }; /* not BSS */
asm (".text");
/* pseudo reset vector */
- asm (".long 0x003f0000"); /* initial sp value */
- asm (".long _start"); /* initial ip value */
+ asm (STACK_ASM_OP); /* initial sp value */
+ asm (".long _start"); /* initial ip value */
start()
{
register int dev_lun asm (MVMEPROM_REG_DEVLUN);
diff --git a/sys/arch/mvme88k/stand/libsa/SRT1.c b/sys/arch/mvme88k/stand/libsa/SRT1.c
index 56b6c44b1f1..0594446a88b 100644
--- a/sys/arch/mvme88k/stand/libsa/SRT1.c
+++ b/sys/arch/mvme88k/stand/libsa/SRT1.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: SRT1.c,v 1.2 2000/03/03 00:54:54 todd Exp $ */
+/* $OpenBSD: SRT1.c,v 1.3 2001/01/13 05:19:01 smurph Exp $ */
/*
* Copyright (c) 1996 Nivas Madhur
@@ -88,6 +88,7 @@ exit()
asm volatile ("or r9, r0, 0x63; tb0 0, r0, 496");
/* NOTREACHED */
+ for(;;); /* keep compiler happy */
}
struct brdid brdid;
diff --git a/sys/arch/mvme88k/stand/libsa/exec_mvme.c b/sys/arch/mvme88k/stand/libsa/exec_mvme.c
index 474e679ea45..031e3a02004 100644
--- a/sys/arch/mvme88k/stand/libsa/exec_mvme.c
+++ b/sys/arch/mvme88k/stand/libsa/exec_mvme.c
@@ -43,15 +43,15 @@
#include "libsa.h"
struct kernel {
- void *entry;
- void *symtab;
- void *esym;
- int bflags;
- int bdev;
- char *kname;
- void *smini;
- void *emini;
- u_int end_loaded;
+ void *entry;
+ void *symtab;
+ void *esym;
+ int bflags;
+ int bdev;
+ char *kname;
+ void *smini;
+ void *emini;
+ u_int end_loaded;
} kernel;
#define RB_NOSYM 0x400
@@ -62,8 +62,8 @@ struct kernel {
/*ARGSUSED*/
void
exec_mvme(file, flag)
- char *file;
- int flag;
+char *file;
+int flag;
{
char *loadaddr;
register int io;
@@ -73,11 +73,11 @@ exec_mvme(file, flag)
register char *cp;
register int *ip;
int n;
- int bootdev;
+ int bootdev;
- if (flag & RB_EXTRA) {
- printf("exec_mvme: file=%s flag=0x%x cputyp=%x\n", file, flag, bugargs.cputyp);
- }
+ if (flag & RB_EXTRA) {
+ printf("exec_mvme: file=%s flag=0x%x cputyp=%x\n", file, flag, bugargs.cputyp);
+ }
io = open(file, 0);
if (io < 0)
@@ -107,13 +107,13 @@ exec_mvme(file, flag)
*/
loadaddr = (void *)(x.a_entry & ~sizeof(x));
n = x.a_text + x.a_data + x.a_bss + x.a_syms + sizeof(int);
-
+
/* debugging stuff for netboot
printf("hex load address range 0x%x to 0x%x\n", loadaddr, loadaddr+n);
printf("dec load address range %ld to %ld\n", loadaddr, loadaddr+n);
bzero((void *)loadaddr, n);
*/
-
+
cp = loadaddr;
magic = N_GETMAGIC(x);
if (magic == ZMAGIC)
@@ -132,7 +132,7 @@ exec_mvme(file, flag)
*/
printf("%d", x.a_text);
cc = x.a_text;
- if (magic == ZMAGIC)
+ if (magic == ZMAGIC)
cc = cc - sizeof(x); /* a.out header part of text in zmagic */
if (read(io, cp, cc) != cc)
goto shread;
@@ -186,7 +186,7 @@ exec_mvme(file, flag)
if (read(io, cp, cc) != cc)
goto shread;
cp += x.a_syms;
- ip = (int*)cp; /* points to strtab length */
+ ip = (int*)cp; /* points to strtab length */
cp += sizeof(int);
/* String table. Length word includes itself. */
@@ -205,17 +205,17 @@ exec_mvme(file, flag)
printf("Start @ 0x%x ...\n", (int)entry);
printf("Controler Address @ %x ...\n", bugargs.ctrl_addr);
if (flag & RB_HALT) mvmeprom_return();
-
+
bootdev = (bugargs.ctrl_lun << 8) | (bugargs.dev_lun & 0xFF);
- (*entry)(flag, bugargs.ctrl_addr, cp, kernel.smini, kernel.emini, bootdev, bugargs.cputyp);
+ (*entry)(flag, bugargs.ctrl_addr, cp, kernel.smini, kernel.emini, bootdev, bugargs.cputyp);
printf("exec: kernel returned!\n");
return;
-shread:
+ shread:
printf("exec: short read\n");
errno = EIO;
-closeout:
+ closeout:
close(io);
return;
}
diff --git a/sys/arch/mvme88k/stand/netboot/Makefile b/sys/arch/mvme88k/stand/netboot/Makefile
index b52c0ff2858..948abdb142c 100644
--- a/sys/arch/mvme88k/stand/netboot/Makefile
+++ b/sys/arch/mvme88k/stand/netboot/Makefile
@@ -1,8 +1,5 @@
+# $OpenBSD: Makefile,v 1.8 2001/01/13 05:19:01 smurph Exp $
-# $OpenBSD: Makefile,v 1.7 1999/09/27 19:30:01 smurph Exp $
-
-# 8Meg - 64K
-RELOC=0x7F0000
SIZE?= size
STRIP?= strip
@@ -24,14 +21,14 @@ SRCS+= if_ie.c
#SRCS+= if_le.c
OBJS= ${SRCS:S/.c/.o/g}
LIBS= ${LIBSA} ${LIBBUG} ${LIBZ} ${LIBGCC}
-LDFLAGS+= -s -N -T ${RELOC}
+LDFLAGS+= -s -N -T ${STAGE2_RELOC}
#LDFLAGS+= -nostdlib -s -N -Ttext ${RELOC}
all: netboot.bin
-netboot: ${OBJS} ${BUGCRT} ${LIBS}
+netboot: ${OBJS} ${SINGLE} ${LIBS}
${LD} ${LDFLAGS} \
- ${BUGCRT} ${OBJS} ${LIBS} -o $@
+ ${SINGLE} ${OBJS} ${LIBS} -o $@
# @${SIZE} $@
netboot.bin: netboot