Now works with current tree, as opposed to the july 8th tree in which it was

written.
Requires magnum infrastructure now, particularly the clock stuff.
Fails to exec init because the /sbin/init binary
is a sunos binary.  Next step is to integrate sunos compatibility code
from /sys/compat/sunos, and the amiga port.
Does not yet implement MACHINE_NOCONTIG support.

[from glass Mon Nov 22 21:22:45 PST 1993  home tag: home2]
This commit is contained in:
glass 1993-11-23 05:28:35 +00:00
parent 9e078d7394
commit 06932ce0f8
22 changed files with 563 additions and 301 deletions

View File

@ -1,4 +1,4 @@
# $Id: Makefile.sun3,v 1.11 1993/11/10 07:42:12 deraadt Exp $
# $Id: Makefile.sun3,v 1.12 1993/11/23 05:28:35 glass Exp $
# Makefile for 4.4 BSD
#
# This makefile is constructed from a machine description:
@ -75,9 +75,9 @@ SYSTEM_OBJ= locore.o ${OBJS} param.o ioconf.o
#SYSTEM_DEP= Makefile symbols.sort ${SYSTEM_OBJ}
SYSTEM_DEP= Makefile ${SYSTEM_OBJ}
SYSTEM_LD_HEAD= @echo loading $@; rm -f $@
SYSTEM_LD= -@echo ${LD} ${LDX} -p -N -e start -T 0E004000 -o $@ \
SYSTEM_LD= -@echo ${LD} ${LDX} -n -N -e start -T 0E004000 -o $@ \
'$${SYSTEM_OBJ}' vers.o ${LIBKERN}; \
${LD} ${LDX} -p -N -e start -T 0E004000 -o $@ \
${LD} ${LDX} -n -N -e start -T 0E004000 -o $@ \
${SYSTEM_OBJ} vers.o ${LIBKERN}
#SYSTEM_LD_TAIL= @echo rearranging symbols;\
# symorder symbols.sort $@;\
@ -107,12 +107,12 @@ symbols.sort: ${SUN3}/sun3/symbols.raw
grep -v '^#' ${SUN3}/sun3/symbols.raw \
| sed 's/^ //' | sort -u > symbols.sort
locore.o: assym.s ${SUN3}/sun3/locore.s
locore.o: ${SUN3}/include/trap.h ${SUN3}/include/psl.h
locore.o: ${SUN3}/include/cpu.h ${SUN3}/include/control.h
#locore.o: assym.s ${SUN3}/sun3/vectors.s ${SUN3}/sun3/locore.s
#locore.o: ${SUN3}/include/trap.h ${SUN3}/include/psl.h ${SUN3}/sun3/pte.h
#locore.o: ${SUN3}/include/cpu.h
locore.o: assym.s ${SUN3}/sun3/locore.s ${SUN3}/include/asm.h \
${S}/sys/syscall.h ${SUN3}/sun3/lib.s \
${SUN3}/sun3/copy.s ${SUN3}/sun3/m68k.s \
${SUN3}/sun3/signal.s ${SUN3}/sun3/process.s \
${SUN3}/sun3/softint.s ${SUN3}/sun3/interrupt.s \
${SUN3}/sun3/trap.s
${CPP} -DLOCORE ${COPTS} ${SUN3}/sun3/locore.s > plocore.s
echo "" >>plocore.s
${AS} -o locore.o plocore.s

View File

@ -19,9 +19,14 @@ options "TCP_COMPAT_42"
options SWAPPAGER, VNODEPAGER, DEVPAGER
options KTRACE
options INET
options FFS
options NFSSERVER
options NFSCLIENT
# sun3 debug options
options CONTEXT_DEBUG
options VMFAULT_TRACE
include "TIMESINK.nfsdiskless" #mega sad
config netbsd swap nfs

View File

@ -91,7 +91,8 @@
int ledebug = 1; /* console error messages */
int leintr(), leinit(), leioctl(), lestart(), ether_output();
int leintr(), leioctl(), ether_output();
void lestart(), leinit();
struct mbuf *leget();
extern struct ifnet loif;
@ -172,7 +173,6 @@ void leattach(parent, self, args)
ifp->if_unit = unit;
ifp->if_name = "le";
ifp->if_mtu = ETHERMTU;
ifp->if_init = leinit;
ifp->if_ioctl = leioctl;
ifp->if_output = ether_output;
ifp->if_start = lestart;
@ -268,7 +268,7 @@ lereset(unit)
/*
* Initialization of interface
*/
leinit(unit)
void leinit(unit)
int unit;
{
struct le_softc *le = lecd.cd_devs[unit];
@ -295,7 +295,7 @@ leinit(unit)
* off of the interface queue, and copy it to the interface
* before starting the output.
*/
lestart(ifp)
void lestart(ifp)
struct ifnet *ifp;
{
register struct le_softc *le = lecd.cd_devs[ifp->if_unit];
@ -304,10 +304,10 @@ lestart(ifp)
int len;
if ((le->sc_if.if_flags & IFF_RUNNING) == 0)
return (0);
return;
IF_DEQUEUE(&le->sc_if.if_snd, m);
if (m == 0)
return (0);
return;
len = leput(le->sc_r2->ler2_tbuf[0], m);
#if NBPFILTER > 0
/*
@ -322,7 +322,6 @@ lestart(ifp)
tmd->tmd2 = -len;
tmd->tmd1_bits = LE_OWN | LE_STP | LE_ENP;
le->sc_if.if_flags |= IFF_OACTIVE;
return (0);
}
leintr(unit)

View File

@ -17,9 +17,10 @@
void promattach __P((struct device *, struct device *, void *));
struct prom_softc {
int flags;
int nopen;
struct tty t;
struct device prom_dev;
int prom_flags;
int prom_nopen;
struct tty *prom_t;
};
struct cfdriver promcd =
@ -36,15 +37,12 @@ void promattach(parent, self, args)
struct device *self;
void *args;
{
struct prom_softc *prom;
struct prom_softc *promp = (struct prom_softc *) self;
prom = (struct prom_softc *) self;
prom->flags = 0;
prom->nopen = 0;
printf("\n");
}
int promstart __P((struct tty *));
void promstart __P((struct tty *));
int promopen(dev, flag, mode, p)
dev_t dev;
@ -52,15 +50,17 @@ int promopen(dev, flag, mode, p)
struct proc *p;
{
struct tty *tp;
struct prom_softc *prom;
struct prom_softc *promp;
int unit;
int s,error=0;
unit = minor(dev);
PROM_CHECK(unit);
prom = UNIT_TO_PROMP(unit);
bzero(&prom->t, sizeof(struct tty));
tp = &prom->t;
promp = UNIT_TO_PROMP(unit);
if (!promp->prom_t)
tp = promp->prom_t = ttymalloc();
else
tp = promp->prom_t;
tp->t_oproc = promstart;
tp->t_dev = dev;
if ((tp->t_state & TS_ISOPEN) == 0) {
@ -74,14 +74,15 @@ int promopen(dev, flag, mode, p)
tp->t_ispeed = tp->t_ospeed = TTYDEF_SPEED;
}
ttsetwater(tp);
}
else if (tp->t_state&TS_XCLUDE && p->p_ucred->cr_uid != 0)
}
else if (tp->t_state & TS_XCLUDE && p->p_ucred->cr_uid != 0)
return (EBUSY);
s = spltty();
while ((flag&O_NONBLOCK) == 0 && (tp->t_cflag&CLOCAL) == 0 &&
while ((flag & O_NONBLOCK) == 0 && (tp->t_cflag &CLOCAL) == 0 &&
(tp->t_state & TS_CARR_ON) == 0) {
tp->t_state |= TS_WOPEN;
if (error = ttysleep(tp, (caddr_t)&tp->t_raw, TTIPRI | PCATCH,
if (error = ttysleep(tp, (caddr_t)&tp->t_rawq, TTIPRI | PCATCH,
ttopen, 0))
break;
}
@ -98,12 +99,12 @@ promclose(dev, flag, mode, p)
{
struct tty *tp;
int unit;
struct prom_softc *prom;
struct prom_softc *promp;
unit = minor(dev);
PROM_CHECK(unit);
prom = UNIT_TO_PROMP(unit);
tp = &prom->t;
promp = UNIT_TO_PROMP(unit);
tp = promp->prom_t;
(*linesw[tp->t_line].l_close)(tp, flag);
ttyclose(tp);
return 0;
@ -115,12 +116,12 @@ promread(dev, uio, flag)
{
int unit;
register struct tty *tp;
struct prom_softc *prom;
struct prom_softc *promp;
unit = minor(dev);
PROM_CHECK(unit);
prom = UNIT_TO_PROMP(unit);
tp = &prom->t;
promp = UNIT_TO_PROMP(unit);
tp = promp->prom_t;
return ((*linesw[tp->t_line].l_read)(tp, uio, flag));
}
promwrite(dev, uio, flag)
@ -129,39 +130,68 @@ promwrite(dev, uio, flag)
{
int unit;
register struct tty *tp;
struct prom_softc *prom;
struct prom_softc *promp;
unit = minor(dev);
PROM_CHECK(unit);
prom = UNIT_TO_PROMP(unit);
tp = &prom->t;
promp = UNIT_TO_PROMP(unit);
tp = promp->prom_t;
return ((*linesw[tp->t_line].l_write)(tp, uio, flag));
}
int promstart(tp)
int promioctl(dev, cmd, data, flag)
dev_t dev;
int cmd;
caddr_t data;
int flag;
{
int unit;
register struct tty *tp;
struct prom_softc *promp;
int error;
unit = minor(dev);
PROM_CHECK(unit);
promp = UNIT_TO_PROMP(unit);
tp = promp->prom_t;
error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag);
if (error >= 0)
return error;
error = ttioctl(tp, cmd, data, flag);
if (error >= 0)
return error;
switch (cmd) {
default:
return ENOTTY;
}
return 0;
}
void promstart(tp)
struct tty *tp;
{
int s;
int c;
s = spltty();
if (tp->t_state & (TS_TIMEOUT | TS_TTSTOP)) goto out;
if (RB_LEN(&tp->t_out) <= tp->t_lowat) {
if (tp->t_state&TS_ASLEEP) {
tp->t_state &= ~TS_ASLEEP;
wakeup((caddr_t)&tp->t_out);
if (tp->t_state & (TS_BUSY | TS_TTSTOP)) goto out;
if (tp->t_outq.c_cc <= tp->t_lowat) {
if (tp->t_state & TS_ASLEEP) {
tp->t_state &=~ TS_ASLEEP;
wakeup((caddr_t)&tp->t_outq);
}
selwakeup(&tp->t_wsel);
}
if (RB_LEN(&tp->t_out) == 0)
if (tp->t_outq.c_cc == 0)
goto out;
c = rbgetc(&tp->t_out);
tp->t_state |= TS_BUSY;
c = getc(&tp->t_outq);
mon_putchar(c);
out:
splx(s);
return 0;
}
/*

View File

@ -36,14 +36,14 @@
* The standard executable formats are taken care of automatically;
* machine-specific ones can be defined using this function.
*/
#define cpu_exec_makecmds(p,epp) ENOEXEC
/*#define cpu_exec_makecmds(p,epp) ENOEXEC*/
/*
* the following function/macro checks to see if a given machine
* type (a_mid) field is valid for this architecture
* a non-zero return value indicates that the machine type is correct.
*/
#define cpu_exec_checkmid(mid) (mid == MID_SUN3)
/*#define cpu_exec_checkmid(mid) (mid == MID_SUN3)*/
#define __LDPGSZ 8192

View File

@ -41,6 +41,8 @@
* cpu.h,v 1.2 1993/05/22 07:58:17 cgd Exp
*/
#ifdef KERNEL
/*
* Exported definitions unique to sun3/68k cpu support.
*/
@ -70,14 +72,15 @@
* clockframe; for hp300, use just what the hardware
* leaves on the stack.
*/
typedef struct intrframe {
struct clockframe {
int pc;
int ps;
} clockframe;
};
#define CLKF_USERMODE(framep) (((framep)->ps & PSL_S) == 0)
#define CLKF_BASEPRI(framep) (((framep)->ps & PSL_IPL7) == 0)
#define CLKF_PC(framep) ((framep)->pc)
#define CLKF_INTR(framep) (0) /* XXX laziness */
/*
* Preempt the current process if in interrupt from user mode,
@ -90,7 +93,7 @@ typedef struct intrframe {
* interrupt. On hp300, request an ast to send us through trap(),
* marking the proc as needing a profiling tick.
*/
#define profile_tick(p, framep) { (p)->p_flag |= SOWEUPC; aston(); }
#define need_proftick(p) ((p)->p_flag |= SOWEUPC, aston())
/*
* Notify the current process (p) that it has a signal pending,
@ -100,8 +103,11 @@ typedef struct intrframe {
#define aston() (astpending++)
int astpending; /* need to trap before returning to user mode */
int want_resched; /* resched() was called */
int astpending; /* need to trap before returning to user mode */
int want_resched; /* resched() was called */
#define fuswintr(x) (-1)
#define suswintr(x,y) (-1)
#include <machine/mtpr.h>
@ -117,12 +123,9 @@ int want_resched; /* resched() was called */
#define SUN3_MACH_60 0x07
#define SUN3_MACH_E 0x08
#ifdef KERNEL
extern int machineid, mmutype, ectype;
extern char *intiobase, *intiolimit;
#endif
/* 680X0 function codes */
#define FC_USERD 1 /* user data space */
#define FC_USERP 2 /* user program space */
@ -137,4 +140,4 @@ extern char *intiobase, *intiolimit;
#define IC_CE 0x0004 /* clear instruction cache entry */
#define IC_CLR 0x0008 /* clear entire instruction cache */
#endif

View File

@ -44,9 +44,7 @@
#define BYTE_ORDER BIG_ENDIAN
#ifndef KERNEL
#include <sys/cdefs.h>
#endif
__BEGIN_DECLS
unsigned long htonl __P((unsigned long));

View File

@ -36,14 +36,14 @@
* The standard executable formats are taken care of automatically;
* machine-specific ones can be defined using this function.
*/
#define cpu_exec_makecmds(p,epp) ENOEXEC
/*#define cpu_exec_makecmds(p,epp) ENOEXEC*/
/*
* the following function/macro checks to see if a given machine
* type (a_mid) field is valid for this architecture
* a non-zero return value indicates that the machine type is correct.
*/
#define cpu_exec_checkmid(mid) (mid == MID_SUN3)
/*#define cpu_exec_checkmid(mid) (mid == MID_SUN3)*/
#define __LDPGSZ 8192

View File

@ -46,7 +46,7 @@
* Machine dependent constants for HP9000 series 300.
*/
#define MACHINE "sun3"
#define MID_MACHINE MID_SUN020
#define MID_MACHINE MID_M68K
/*
* Round p (pointer or byte index) up to a correctly-aligned value
* for all data types (int, long, ...). The result is u_int and
@ -175,6 +175,7 @@
#define splimp() spl6()
#define spltty() spl6()
#define splclock() spl5()
#define splstatclock() splclock()
#define splvm() spl2()
#define splhigh() spl7()
#define splsched() spl7()

View File

@ -46,7 +46,7 @@
* Machine dependent constants for HP9000 series 300.
*/
#define MACHINE "sun3"
#define MID_MACHINE MID_SUN020
#define MID_MACHINE MID_M68K
/*
* Round p (pointer or byte index) up to a correctly-aligned value
* for all data types (int, long, ...). The result is u_int and
@ -175,6 +175,7 @@
#define splimp() spl6()
#define spltty() spl6()
#define splclock() spl5()
#define splstatclock() splclock()
#define splvm() spl2()
#define splhigh() spl7()
#define splsched() spl7()

View File

@ -45,7 +45,7 @@
#include <machine/frame.h>
/*
* HP300 process control block
* Sun3 (close to but not exactly the same as the hp300) process control block
*/
struct pcb
{
@ -53,7 +53,7 @@ struct pcb
short pcb_ps; /* processor status word (+2) */
int pcb_ustp; /* user segment table pointer (+4) (not used)*/
int pcb_usp; /* user stack pointer (+8) */
int pcb_regs[12]; /* D0-D7, A0-A7 (+C) */
int pcb_regs[12]; /* D2-D7, A2-A7 (+C) */
vm_offset_t pcb_upte[3]; /* ptes for u-area */
caddr_t pcb_onfault; /* for copyin/out faults */
struct fpframe pcb_fpregs; /* 68881/2 context save area */

View File

@ -0,0 +1,64 @@
/*
* Copyright (c) 1982, 1986, 1989, 1991 Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: @(#)signal.h 7.16 (Berkeley) 3/17/91
* $Id: signal.h,v 1.1 1993/11/23 05:28:59 glass Exp $
*/
#ifndef _MACHINE_SIGNAL_H_
#define _MACHINE_SIGNAL_H_
typedef int sig_atomic_t;
/*
* Get the "code" values
*/
#include <machine/trap.h>
/*
* Information pushed on stack when a signal is delivered.
* This is used by the kernel to restore state following
* execution of the signal handler. It is also made available
* to the handler to allow it to restore state properly if
* a non-standard exit is performed.
*/
struct sigcontext {
int sc_onstack; /* sigstack state to restore */
int sc_mask; /* signal mask to restore */
int sc_sp; /* sp to restore */
int sc_fp; /* fp to restore */
int sc_ap; /* ap to restore */
int sc_pc; /* pc to restore */
int sc_ps; /* psl to restore */
};
#endif /* _MACHINE_SIGNAL_H_ */

View File

@ -28,12 +28,15 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Header: /cvsroot/src/sys/arch/sun3/sun3/clock.c,v 1.10 1993/10/12 05:25:13 glass Exp $
* $Header: /cvsroot/src/sys/arch/sun3/sun3/clock.c,v 1.11 1993/11/23 05:29:06 glass Exp $
*/
/*
* machine-dependent clock routines; intersil7170
* by Adam Glass
*
* [this code suffered terribly when we were pursuing the fast clock interrupt
* problem. in particular, the level switching code is not legitimate]
*
*/
#include "systm.h"
@ -44,8 +47,10 @@
#include <machine/autoconf.h>
#include <machine/psl.h>
#include <machine/cpu.h>
#include <machine/mon.h>
#include <machine/obio.h>
#include <machine/control.h>
#include "intersil7170.h"
#include "interreg.h"
@ -198,7 +203,7 @@ void clockattach(parent, self, args)
void level5intr_clock();
vm_offset_t pte;
clock_addr = OBIO_CLOCK;
clock_addr = (caddr_t) OBIO_CLOCK;
clock->clock_level = OBIO_DEFAULT_PARAM(int, obio_loc->obio_level, 5);
clock->clock_va = (caddr_t) CLOCK_VA;
if (!clock->clock_va) {
@ -218,20 +223,54 @@ void clockattach(parent, self, args)
printf("\n");
}
/*
* Set up the real-time clock. Leave stathz 0 since there is no secondary
* clock available.
*/
void
cpu_initclocks(void)
{
struct timer_softc *clock;
unsigned char dummy;
if (clockcd.cd_ndevs < 1 ||
!(clock = clockcd.cd_devs[0]))
panic("cpu_initclocks: no timer");
/* make sure irq5/7 stuff is resolved :) */
dummy = intersil_clear();
dummy++;
intersil_clock->interrupt_reg = INTERSIL_INTER_CSECONDS;
intersil_clock->command_reg = intersil_command(INTERSIL_CMD_RUN,
INTERSIL_CMD_IENABLE);
}
/*
* This doesn't need to do anything, as we have only one timer and
* profhz==stathz==hz.
*/
void
setstatclockrate(newhz)
int newhz;
{
/* nothing */
}
int clock_count = 0;
void clock_intr(frame)
clockframe frame;
struct clockframe frame;
{
if ((clock_count % 1000) == 0) {
#if 0
printf("clock_intr: total of %d interrupts received\n",
clock_count);
printf("clock_intr: frame pc %x sr %x\n", frame.pc, frame.ps);
#endif
}
static unsigned char led_pattern = 0;
clock_count++;
hardclock(frame);
if ((clock_count%20) == 0) {
set_control_byte((char *) DIAG_REG, led_pattern);
led_pattern = ~led_pattern;
}
hardclock(&frame);
}
@ -249,33 +288,6 @@ void clock_intr(frame)
* also microtime support
*/
/*
* Start the real-time clock.
*/
void startrtclock()
{
char dummy;
if (!intersil_softc)
panic("clock: not initialized");
intersil_clock->interrupt_reg = INTERSIL_INTER_CSECONDS;
intersil_clock->command_reg = intersil_command(INTERSIL_CMD_RUN,
INTERSIL_CMD_IDISABLE);
dummy = intersil_clear();
}
void enablertclock()
{
unsigned char dummy;
/* make sure irq5/7 stuff is resolved :) */
dummy = intersil_clear();
dummy++;
intersil_clock->interrupt_reg = INTERSIL_INTER_CSECONDS;
intersil_clock->command_reg = intersil_command(INTERSIL_CMD_RUN,
INTERSIL_CMD_IENABLE);
}
void intersil_counter_state(map)
struct intersil_map *map;
@ -421,7 +433,7 @@ void resettodr()
void microtime(tvp)
register struct timeval *tvp;
{
int s;
int s = splhigh();
static struct timeval lasttime;
/* as yet...... this makes little sense*/

View File

@ -1 +1 @@
revision 1.6 intentionally removed
revision 1.7 intentionally removed

View File

@ -37,24 +37,25 @@
#define KERNEL
#include "types.h"
#include "param.h"
#include "cdefs.h"
#include "errno.h"
#include "proc.h"
#include "vmmeter.h"
#include <cdefs.h>
#include <types.h>
#include <param.h>
#include <cdefs.h>
#include <errno.h>
#include <proc.h>
#include <vmmeter.h>
#include "vm/vm.h"
#include <vm/vm.h>
#include "machine/pcb.h"
#include "machine/psl.h"
#include "machine/pte.h"
#include "machine/control.h"
#include "machine/mon.h"
#include "machine/param.h"
#include "machine/memmap.h"
#include "machine/cpu.h"
#include "machine/trap.h"
#include <machine/pcb.h>
#include <machine/psl.h>
#include <machine/pte.h>
#include <machine/control.h>
#include <machine/mon.h>
#include <machine/param.h>
#include <machine/memmap.h>
#include <machine/cpu.h>
#include <machine/trap.h>
#include "intersil7170.h"
#include "interreg.h"

View File

@ -28,7 +28,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Header: /cvsroot/src/sys/arch/sun3/sun3/locore2.c,v 1.13 1993/10/12 05:27:33 glass Exp $
* $Header: /cvsroot/src/sys/arch/sun3/sun3/locore2.c,v 1.14 1993/11/23 05:29:18 glass Exp $
*/
#include "systm.h"
@ -82,8 +82,9 @@ static void initialize_vector_table()
if (vector_table[i] == COPY_ENTRY)
set_vector_entry(i, old_vector_table[i]);
}
setvbr(vector_table);
setvbr((unsigned int *) vector_table);
orig_nmi_vector = get_vector_entry(VEC_LEVEL_7_INT);
mon_printf("initializing vector table (finished)\n");
}
vm_offset_t high_segment_alloc(npages)
@ -111,7 +112,7 @@ void sun3_stop()
mon_printf("sun3_stop: clock(0,0)\n");
setvbr(old_vector_table);
new_vect = getvbr();
printf("post: nmi vec %x\n", new_vect[VEC_LEVEL_7_INT]);
mon_printf("post: nmi vec %x\n", new_vect[VEC_LEVEL_7_INT]);
/* set_clk_mode(IREG_CLOCK_ENAB_7,0);*/
mon_printf("interrupt_reg_value: %x\n", *interrupt_reg);
mon_printf("sun3_stop: clock(7,1)\n");
@ -347,15 +348,15 @@ void sun3_vm_init()
load_u_area(&proc0paddr->u_pcb);
curpcb = &proc0paddr->u_pcb;
clock_va = obio_alloc((caddr_t) OBIO_CLOCK,
OBIO_CLOCK_SIZE, OBIO_WRITE);
clock_va = (vm_offset_t) obio_alloc((caddr_t) OBIO_CLOCK,
OBIO_CLOCK_SIZE, OBIO_WRITE);
if (clock_va != CLOCK_VA)
mon_printf("clock is not at CLOCK_VA, %x vs. %x\n", clock_va,
CLOCK_VA);
interrupt_reg = obio_alloc((caddr_t) OBIO_INTERREG,
OBIO_INTERREG_SIZE, OBIO_WRITE);
if (interrupt_reg != INTERREG_VA)
if ((unsigned int) interrupt_reg != INTERREG_VA)
mon_printf("interrupt_reg is not at INTERREG_VA, %x vs. %x\n",
interrupt_reg, INTERREG_VA);
sun3_context_equiv();
@ -586,6 +587,8 @@ void sun3_bootstrap()
mon_printf("%s\n", hello);
mon_printf("\nPROM Version: %x\n", romp->romvecVersion);
sun3_monitor_hooks();
sun3_verify_hardware();
initialize_vector_table(); /* point interrupts/exceptions to our table */
@ -593,8 +596,6 @@ void sun3_bootstrap()
sun3_vm_init(); /* handle kernel mapping problems, etc */
printf("sun3 vm initialization complete\n");
sun3_monitor_hooks();
pmap_bootstrap(); /* */
printf("pmap module bootstrapped\n");

View File

@ -102,6 +102,7 @@ int bufpages = 0;
int *nofault;
extern vm_offset_t u_area_va;
caddr_t allocsys();
void identifycpu()
{
@ -136,89 +137,80 @@ void load_u_area(pcbp)
void cpu_startup()
{
caddr_t v;
int firstaddr, i;
int sz, i;
vm_size_t size;
int base, residual;
vm_offset_t minaddr, maxaddr, uarea_pages;
/* msgbuf mapped earlier, should figure out why? */
printf(version);
identifycpu();
/* compute physmem? */
printf("real mem = %d\n", ctob(physmem));
/*
* Allocate space for system data structures.
* The first available real memory address is in "firstaddr".
* The first available kernel virtual address is in "v".
* As pages of kernel virtual memory are allocated, "v" is incremented.
* As pages of memory are allocated and cleared,
* "firstaddr" is incremented.
* An index into the kernel page table corresponding to the
* virtual memory address maintained in "v" is kept in "mapaddr".
*/
/*
* Make two passes. The first pass calculates how much memory is
* needed and allocates it. The second pass assigns virtual
* addresses to the various data structures.
*/
firstaddr = 0;
again:
v = (caddr_t)firstaddr;
#define valloc(name, type, num) \
(name) = (type *)v; v = (caddr_t)((name)+(num))
#define valloclim(name, type, num, lim) \
(name) = (type *)v; v = (caddr_t)((lim) = ((name)+(num)))
/* valloc(cfree, struct cblock, nclist); no clists any more!!! - cgd */
valloc(callout, struct callout, ncallout);
valloc(swapmap, struct map, nswapmap = maxproc * 2);
#ifdef SYSVSHM
valloc(shmsegs, struct shmid_ds, shminfo.shmmni);
#endif
if (bufpages == 0)
if (physmem < (2 * 1024 * 1024))
bufpages = physmem / 10 / CLSIZE;
else
bufpages = ((2 * 1024 * 1024 + physmem) / 20) / CLSIZE;
if (nswbuf == 0) {
nswbuf = (nbuf / 2) &~ 1; /* force even */
if (nswbuf > 256)
nswbuf = 256; /* sanity */
}
valloc(swbuf, struct buf, nswbuf);
valloc(buf, struct buf, nbuf);
/*
* End of first pass, size has been calculated so allocate memory
* Find out how much space we need, allocate it,
* and then give everything true virtual addresses.
*/
if (firstaddr == 0) {
size = (vm_size_t)(v - firstaddr);
firstaddr = (int) kmem_alloc(kernel_map, round_page(size));
if (firstaddr == 0)
panic("cpu_startup: no room for tables");
goto again;
}
sz = (int)allocsys((caddr_t)0);
if ((v = (caddr_t)kmem_alloc(kernel_map, round_page(sz))) == 0)
panic("startup: no room for tables");
if (allocsys(v) - v != sz)
panic("startup: table size inconsistency");
/*
* End of second pass, addresses have been assigned
* Now allocate buffers proper. They are different than the above
* in that they usually occupy more virtual memory than physical.
*/
if ((vm_size_t)(v - firstaddr) != size)
panic("cpu_startup: table size inconsistency");
/* buffer_map stuff but not used */
size = MAXBSIZE * nbuf;
buffer_map = kmem_suballoc(kernel_map, (vm_offset_t)&buffers,
&maxaddr, size, FALSE);
minaddr = (vm_offset_t)buffers;
if (vm_map_find(buffer_map, vm_object_allocate(size), (vm_offset_t)0,
&minaddr, size, FALSE) != KERN_SUCCESS)
panic("startup: cannot allocate buffers");
if ((bufpages / nbuf) >= btoc(MAXBSIZE)) {
/* don't want to alloc more physical mem than needed */
bufpages = btoc(MAXBSIZE) * nbuf;
}
base = bufpages / nbuf;
residual = bufpages % nbuf;
for (i = 0; i < nbuf; i++) {
vm_size_t curbufsize;
vm_offset_t curbuf;
/*
* First <residual> buffers get (base+1) physical pages
* allocated for them. The rest get (base) physical pages.
*
* The rest of each buffer occupies virtual space,
* but has no physical memory allocated for it.
*/
curbuf = (vm_offset_t)buffers + i * MAXBSIZE;
curbufsize = CLBYTES * (i < residual ? base+1 : base);
vm_map_pageable(buffer_map, curbuf, curbuf+curbufsize, FALSE);
vm_map_simplify(buffer_map, curbuf);
}
/*
* Allocate a submap for exec arguments. This map effectively
* limits the number of processes exec'ing at any time.
*/
/* exec_map = kmem_suballoc(kernel_map, &minaddr, &maxaddr,
* 16*NCARGS, TRUE);
* NOT CURRENTLY USED -- cgd
#if 0 /* XXX not currently used */
exec_map = kmem_suballoc(kernel_map, &minaddr, &maxaddr,
16*NCARGS, TRUE);
#endif
/*
* Allocate a submap for physio
*/
/*
* Allocate a map for physio and DVMA
*/
phys_map = vm_map_create(kernel_pmap, DVMA_SPACE_START, DVMA_SPACE_END, 0);
if (!phys_map)
if (phys_map == NULL)
panic("cpu_startup: unable to create physmap");
/*
* Finally, allocate mbuf pool. Since mclrefcnt is an off-size
* we use the more space efficient malloc in place of kmem_alloc.
@ -228,15 +220,22 @@ void cpu_startup()
bzero(mclrefcnt, NMBCLUSTERS+CLBYTES/MCLBYTES);
mb_map = kmem_suballoc(kernel_map, (vm_offset_t)&mbutl, &maxaddr,
VM_MBUF_SIZE, FALSE);
/*
* Initialize callouts
*/
callfree = callout;
for (i = 1; i < ncallout; i++)
callout[i-1].c_next = &callout[i];
printf("avail mem = %d\n", ptoa(vm_page_free_count));
printf("using %d buffers containing %d bytes of memory\n",
nbuf, bufpages * CLBYTES);
printf("avail mem = %d\n", ptoa(vm_page_free_count));
/* initcpu();*/
/* initcpu();*/
/*
* Set up buffers, so they can be used to read disk labels.
*/
@ -250,6 +249,56 @@ void cpu_startup()
cold = 0;
}
/*
* Allocate space for system data structures. We are given
* a starting virtual address and we return a final virtual
* address; along the way we set each data structure pointer.
*
* We call allocsys() with 0 to find out how much space we want,
* allocate that much and fill it with zeroes, and then call
* allocsys() again with the correct base virtual address.
*/
caddr_t
allocsys(v)
register caddr_t v;
{
#define valloc(name, type, num) \
v = (caddr_t)(((name) = (type *)v) + (num))
#ifdef REAL_CLISTS
valloc(cfree, struct cblock, nclist);
#endif
valloc(callout, struct callout, ncallout);
valloc(swapmap, struct map, nswapmap = maxproc * 2);
#ifdef SYSVSHM
valloc(shmsegs, struct shmid_ds, shminfo.shmmni);
#endif
/*
* Determine how many buffers to allocate (enough to
* hold 5% of total physical memory, but at least 16).
* Allocate 1/2 as many swap buffer headers as file i/o buffers.
*/
if (bufpages == 0)
if (physmem < btoc(2 * 1024 * 1024))
bufpages = (physmem / 10) / CLSIZE;
else
bufpages = (physmem / 20) / CLSIZE;
if (nbuf == 0) {
nbuf = bufpages;
if (nbuf < 16)
nbuf = 16;
}
if (nswbuf == 0) {
nswbuf = (nbuf / 2) &~ 1; /* force even */
if (nswbuf > 256)
nswbuf = 256; /* sanity */
}
valloc(swbuf, struct buf, nswbuf);
valloc(buf, struct buf, nbuf);
return v;
}
void internal_configure()
{
obio_internal_configure();
@ -822,7 +871,10 @@ regdump(rp, sbytes)
return;
s = splhigh();
doingdump = 1;
printf("pid = %d, pc = %s, ", curproc->p_pid, hexstr(rp[PC], 8));
if (curproc)
printf("pid = %d, pc = %s, ", curproc->p_pid, hexstr(rp[PC], 8));
else
printf("curproc == NULL, pc = %s, ", hexstr(rp[PC], 8));
printf("ps = %s, ", hexstr(rp[PS], 4));
printf("sfc = %s, ", hexstr(getsfc(), 4));
printf("dfc = %s\n", hexstr(getdfc(), 4));
@ -905,3 +957,78 @@ straytrap(pc, evec)
printf("unexpected trap (vector offset %x) from %x\n",
evec & 0xFFF, pc);
}
/*
* cpu_exec_aout_makecmds():
* cpu-dependent a.out format hook for execve().
*
* Determine of the given exec package refers to something which we
* understand and, if so, set up the vmcmds for it.
*
*/
cpu_exec_aout_makecmds(p, epp)
struct proc *p;
struct exec_package *epp;
{
return ENOEXEC;
}
struct sysarch_args {
int op;
char *parms;
};
int
sysarch(p, uap, retval)
struct proc *p;
register struct sysarch_args *uap;
int *retval;
{
return EINVAL;
}
/*
* The registers are in the frame; the frame is in the user area of
* the process in question; when the process is active, the registers
* are in "the kernel stack"; when it's not, they're still there, but
* things get flipped around. So, since p->p_regs is the whole address
* of the register set, take its offset from the kernel stack, and
* index into the user block. Don't you just *love* virtual memory?
* (I'm starting to think seymour is right...)
*/
int
ptrace_set_pc (struct proc *p, unsigned int addr)
{
p->p_regs[PC] = addr;
return 0;
}
int
ptrace_single_step (struct proc *p)
{
struct pcb *pcb;
void *regs = (char*)p->p_addr +
((char*) p->p_regs - (char*) USRSTACK);
pcb = &p->p_addr->u_pcb;
pcb->pcb_ps |= PSL_T;
return 0;
}
/*
* Copy the registers to user-space. This is tedious because
* we essentially duplicate code for trapframe and syscframe. *sigh*
*/
int
ptrace_getregs (struct proc *p, unsigned int *addr)
{
return 0;
}
int
ptrace_setregs (struct proc *p, unsigned int *addr)
{
return 0;
}

View File

@ -28,7 +28,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Header: /cvsroot/src/sys/arch/sun3/sun3/pmap.c,v 1.14 1993/10/12 05:27:12 glass Exp $
* $Header: /cvsroot/src/sys/arch/sun3/sun3/pmap.c,v 1.15 1993/11/23 05:29:14 glass Exp $
*/
#include "systm.h"
#include "param.h"
@ -344,6 +344,7 @@ void set_pte_val(pmap, va,pte)
outta_here:
PMAP_UNLOCK();
}
void context_allocate(pmap)
pmap_t pmap;
{
@ -351,6 +352,9 @@ void context_allocate(pmap)
int s;
PMAP_LOCK();
#ifdef CONTEXT_DEBUG
printf("context_allocate: for pmap %x\n", pmap);
#endif
if (pmap->pm_context)
panic("pmap: pmap already has context allocated to it");
if (queue_empty(&context_free_queue)) { /* steal one from active*/
@ -358,6 +362,10 @@ void context_allocate(pmap)
panic("pmap: no contexts to be found");
dequeue_first(context, context_t, &context_active_queue);
context_free(context->context_upmap);
#ifdef CONTEXT_DEBUG
printf("context_allocate: pmap %x, stealing context %x num %d\n",
pmap, context, context->context_num);
#endif
} else
dequeue_first(context, context_t, &context_free_queue);
enqueue_tail(&context_active_queue,context);
@ -365,6 +373,10 @@ void context_allocate(pmap)
panic("pmap: context in use???");
pmap->pm_context = context;
context->context_upmap = pmap;
#ifdef CONTEXT_DEBUG
printf("context_allocate: pmap %x associated with context %x num %d\n",
pmap, context, context->context_num);
#endif
PMAP_UNLOCK();
}
void context_free(pmap) /* :) */
@ -376,6 +388,10 @@ void context_free(pmap) /* :) */
vm_offset_t va;
PMAP_LOCK();
#ifdef CONTEXT_DEBUG
printf("context_free: freeing pmap %x of context %x num %d\n",
pmap, pmap->pm_context, pmap->pm_context->context_num);
#endif
saved_context = get_context();
if (!pmap->pm_context)
panic("pmap: can't free a non-existent context");
@ -386,10 +402,14 @@ void context_free(pmap) /* :) */
set_segmap(va, SEGINV);
if (pmap->pm_segmap[i] != SEGINV)
pmeg_release(pmeg_p(pmap->pm_segmap[i]));
va += NBSG;
}
set_context(saved_context);
enqueue_tail(&context_free_queue, context);
pmap->pm_context = NULL;
#ifdef CONTEXT_DEBUG
printf("context_free: pmap %x context removed\n", pmap);
#endif
PMAP_UNLOCK();
}
@ -404,6 +424,9 @@ void context_init()
context_array[i].context_num = i;
context_array[i].context_upmap = NULL;
enqueue_tail(&context_free_queue, (queue_entry_t) &context_array[i]);
#ifdef CONTEXT_DEBUG
printf("context_init: context num %d is %x\n", i, &context_array[i]);
#endif
}
}
@ -649,7 +672,7 @@ void pv_remove_all(pa)
{
pv_entry_t npv,head,last;
if (!pv_initialized) return 0;
if (!pv_initialized) return;
head = pa_to_pvp(pa);
for (npv = head ; npv != NULL; last= npv, npv = npv->pv_next ) {
if (npv->pv_pmap == NULL) continue; /* empty */
@ -936,7 +959,7 @@ pmap_create(size)
pmap_t pmap;
if (size)
panic("pmap: asked for a software map????");
return NULL;
pmap = (pmap_t) malloc(sizeof(struct pmap), M_VMPMAP, M_WAITOK);
pmap_common_init(pmap);
pmap_user_pmap_init(pmap);
@ -1037,7 +1060,7 @@ void pmap_remove_range_mmu(pmap, sva, eva)
vm_offset_t va,pte;
saved_context = get_context();
if (pmap != kernel_pmap)
if (pmap != kernel_pmap)
set_context(pmap->pm_context->context_num);
sme = get_segmap(sva);
@ -1156,6 +1179,9 @@ void pmap_remove(pmap, sva, eva)
int s;
/* some form of locking?, when where. */
if (pmap == NULL)
return;
/* do something about contexts */
if (pmap == kernel_pmap) {
if (sva < VM_MIN_KERNEL_ADDRESS)

View File

@ -59,7 +59,7 @@
/*
* Setrq(p)
*
* Call should be made at spl6(), and p->p_stat should be SRUN
* Call should be made at splclock(), and p->p_stat should be SRUN
*/
ENTRY(setrq)
movl sp@(4),a0
@ -91,7 +91,7 @@ Lset2:
/*
* Remrq(p)
*
* Call should be made at spl6().
* Call should be made at splclock().
*/
ENTRY(remrq)
movl sp@(4),a0
@ -178,11 +178,11 @@ Lbadsw:
.globl _load_u_area;
/*
* Swtch()
* cpu_swtch()
*
* Hacked for sun3
*/
ENTRY(swtch)
ENTRY(cpu_swtch)
movl _curpcb,a0 | current pcb
movw sr,a0@(PCB_PS) | save sr before changing ipl
#ifdef notyet
@ -251,7 +251,6 @@ Lsw2:
moveml #0xFCFC,a1@(PCB_REGS) | save non-scratch registers
movl usp,a2 | grab USP (a2 has been saved)
movl a2,a1@(PCB_USP) | and save it
/* movl _CMAP2,a1@(PCB_CMAP2) | save temporary map PTE no-cmap shit*/
#ifdef FPCOPROC
lea a1@(PCB_FPCTX),a2 | pointer to FP save area
fsave a2@ | save FP state

View File

@ -28,7 +28,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Header: /cvsroot/src/sys/arch/sun3/sun3/Attic/sun3_startup.c,v 1.13 1993/10/12 05:27:33 glass Exp $
* $Header: /cvsroot/src/sys/arch/sun3/sun3/Attic/sun3_startup.c,v 1.14 1993/11/23 05:29:18 glass Exp $
*/
#include "systm.h"
@ -82,8 +82,9 @@ static void initialize_vector_table()
if (vector_table[i] == COPY_ENTRY)
set_vector_entry(i, old_vector_table[i]);
}
setvbr(vector_table);
setvbr((unsigned int *) vector_table);
orig_nmi_vector = get_vector_entry(VEC_LEVEL_7_INT);
mon_printf("initializing vector table (finished)\n");
}
vm_offset_t high_segment_alloc(npages)
@ -111,7 +112,7 @@ void sun3_stop()
mon_printf("sun3_stop: clock(0,0)\n");
setvbr(old_vector_table);
new_vect = getvbr();
printf("post: nmi vec %x\n", new_vect[VEC_LEVEL_7_INT]);
mon_printf("post: nmi vec %x\n", new_vect[VEC_LEVEL_7_INT]);
/* set_clk_mode(IREG_CLOCK_ENAB_7,0);*/
mon_printf("interrupt_reg_value: %x\n", *interrupt_reg);
mon_printf("sun3_stop: clock(7,1)\n");
@ -347,15 +348,15 @@ void sun3_vm_init()
load_u_area(&proc0paddr->u_pcb);
curpcb = &proc0paddr->u_pcb;
clock_va = obio_alloc((caddr_t) OBIO_CLOCK,
OBIO_CLOCK_SIZE, OBIO_WRITE);
clock_va = (vm_offset_t) obio_alloc((caddr_t) OBIO_CLOCK,
OBIO_CLOCK_SIZE, OBIO_WRITE);
if (clock_va != CLOCK_VA)
mon_printf("clock is not at CLOCK_VA, %x vs. %x\n", clock_va,
CLOCK_VA);
interrupt_reg = obio_alloc((caddr_t) OBIO_INTERREG,
OBIO_INTERREG_SIZE, OBIO_WRITE);
if (interrupt_reg != INTERREG_VA)
if ((unsigned int) interrupt_reg != INTERREG_VA)
mon_printf("interrupt_reg is not at INTERREG_VA, %x vs. %x\n",
interrupt_reg, INTERREG_VA);
sun3_context_equiv();
@ -586,6 +587,8 @@ void sun3_bootstrap()
mon_printf("%s\n", hello);
mon_printf("\nPROM Version: %x\n", romp->romvecVersion);
sun3_monitor_hooks();
sun3_verify_hardware();
initialize_vector_table(); /* point interrupts/exceptions to our table */
@ -593,8 +596,6 @@ void sun3_bootstrap()
sun3_vm_init(); /* handle kernel mapping problems, etc */
printf("sun3 vm initialization complete\n");
sun3_monitor_hooks();
pmap_bootstrap(); /* */
printf("pmap module bootstrapped\n");

View File

@ -111,6 +111,45 @@ short exframesize[] = {
int mmudebug = 0;
#endif
/*
* Define the code needed before returning to user mode, for
* trap, and syscall.
*/
void userret(p, pc, oticks)
struct proc *p;
int pc;
u_quad_t oticks;
{
int sig;
while ((sig = CURSIG(p)) !=0)
psig(sig);
p->p_pri = p->p_usrpri;
if (want_resched) {
/*
* Since we are curproc, clock will normally just change
* our priority without moving us from one queue to another
* (since the running process is not on a queue.)
* If that happened after we setrq ourselves but before we
* swtch()'ed, we might not be on the queue indicated by
* our priority.
*/
(void) splstatclock();
setrq(p);
p->p_stats->p_ru.ru_nivcsw++;
swtch();
spl0();
while ((sig = CURSIG(p)) != 0)
psig(sig);
}
/*
* If profiling, charge recent system time to the trapped pc.
*/
if (p->p_flag & SPROFIL)
addupc_task(p, pc, (int)(p->p_sticks - oticks));
curpri = p->p_pri;
}
/*
* Trap is called from locore to handle most types of processor traps,
* including events such as simulated software interrupts/AST's.
@ -123,23 +162,22 @@ trap(type, code, v, frame)
register unsigned v;
struct frame frame;
{
register int i;
register int i = 0;
unsigned ucode = 0;
register struct proc *p = curproc;
struct timeval syst;
u_quad_t sticks;
unsigned ncode;
int s;
cnt.v_trap++;
if (!p)
p = &proc0;
syst = p->p_stime;
if ((p = curproc) == NULL)
p = &proc0;
sticks = p->p_sticks;
if (USERMODE(frame.f_sr)) {
type |= T_USER;
p->p_regs = frame.f_regs;
}
switch (type) {
default:
dopanic:
printf("trap type %d, code = %x, v = %x\n", type, code, v);
@ -374,9 +412,10 @@ copyfault:
}
#endif
rv = vm_fault(map, va, ftype, FALSE);
#if VMFAULT_TRACE
printf("vm_fault(%x, %x, %x, 0) -> %x in context %d\n",
map, va, ftype, rv, get_context());
#ifdef VMFAULT_TRACE
printf("vm_fault(%x, %x, %x, 0) -> %x in context %d at %x\n",
map, va, ftype, rv, get_context(),
((int *) frame.f_regs)[PC]);
printf(" type %x, code [mmu,,ssw]: %x\n",
type, code);
#endif
@ -399,7 +438,7 @@ copyfault:
}
if (rv == KERN_SUCCESS) {
if (type == T_MMUFLT) {
#if VMFAULT_TRACE
#ifdef VMFAULT_TRACE
printf("vm_fault resolved access to map %x va %x type ftype %d\n",
map, va, ftype);
#endif
@ -410,10 +449,12 @@ copyfault:
if (type == T_MMUFLT) {
if (p->p_addr->u_pcb.pcb_onfault)
goto copyfault;
printf("vm_fault(%x, %x, %x, 0) -> %x\n",
map, va, ftype, rv);
printf("vm_fault(%x, %x, %x, 0) at %x -> %x\n",
map, va, ftype,
((int *) frame.f_regs)[PC], rv);
printf(" type %x, code [mmu,,ssw]: %x\n",
type, code);
goto dopanic;
}
ucode = v;
@ -421,51 +462,16 @@ copyfault:
break;
}
}
trapsignal(p, i, ucode);
if ((type & T_USER) == 0)
return;
if (i)
trapsignal(p, i, ucode);
out:
while (i = CURSIG(p))
psig(i);
p->p_pri = p->p_usrpri;
if (want_resched) {
/*
* Since we are curproc, clock will normally just change
* our priority without moving us from one queue to another
* (since the running process is not on a queue.)
* If that happened after we setrq ourselves but before we
* swtch()'ed, we might not be on the queue indicated by
* our priority.
*/
s = splclock();
setrq(p);
p->p_stats->p_ru.ru_nivcsw++;
swtch();
splx(s);
while (i = CURSIG(p))
psig(i);
}
if (p->p_stats->p_prof.pr_scale) {
int ticks;
struct timeval *tv = &p->p_stime;
ticks = ((tv->tv_sec - syst.tv_sec) * 1000 +
(tv->tv_usec - syst.tv_usec) / 1000) / (tick / 1000);
if (ticks) {
#ifdef PROFTIMER
extern int profscale;
addupc(frame.f_pc, &p->p_stats->p_prof,
ticks * profscale);
#else
addupc(frame.f_pc, &p->p_stats->p_prof, ticks);
#endif
}
}
curpri = p->p_pri;
userret(p, frame.f_pc, sticks);
}
/*
* Proces a system call.
* Process a system call.
*/
syscall(code, frame)
volatile int code;
@ -476,6 +482,7 @@ syscall(code, frame)
register struct sysent *callp;
register struct proc *p = curproc;
int error, opc, numsys, s;
u_quad_t sticks;
struct args {
int i[8];
} args;
@ -489,7 +496,7 @@ syscall(code, frame)
printf("entered syscall()\n");
cnt.v_syscall++;
syst = p->p_stime;
sticks = p->p_sticks;
if (!USERMODE(frame.f_sr))
panic("syscall");
p->p_regs = frame.f_regs;
@ -563,43 +570,7 @@ done:
* if this is a child returning from fork syscall.
*/
p = curproc;
while (i = CURSIG(p))
psig(i);
p->p_pri = p->p_usrpri;
if (want_resched) {
/*
* Since we are curproc, clock will normally just change
* our priority without moving us from one queue to another
* (since the running process is not on a queue.)
* If that happened after we setrq ourselves but before we
* swtch()'ed, we might not be on the queue indicated by
* our priority.
*/
s = splclock();
setrq(p);
p->p_stats->p_ru.ru_nivcsw++;
swtch();
splx(s);
while (i = CURSIG(p))
psig(i);
}
if (p->p_stats->p_prof.pr_scale) {
int ticks;
struct timeval *tv = &p->p_stime;
ticks = ((tv->tv_sec - syst.tv_sec) * 1000 +
(tv->tv_usec - syst.tv_usec) / 1000) / (tick / 1000);
if (ticks) {
#ifdef PROFTIMER
extern int profscale;
addupc(frame.f_pc, &p->p_stats->p_prof,
ticks * profscale);
#else
addupc(frame.f_pc, &p->p_stats->p_prof, ticks);
#endif
}
}
curpri = p->p_pri;
userret(p, opc, sticks);
#ifdef KTRACE
if (KTRPOINT(p, KTR_SYSRET))
ktrsysret(p->p_tracep, code, error, rval[0]);

View File

@ -234,3 +234,26 @@ caddr_t obio_vm_alloc(npages)
vm_map_unlock(phys_map);
return (caddr_t) addr;
}
/*
* Move pages from one kernel virtual address to another.
* Both addresses are assumed to reside in the Sysmap,
* and size must be a multiple of CLSIZE.
*/
void pagemove(from, to, size)
caddr_t from, to;
int size;
{
vm_offset_t fpte;
if (size % CLBYTES)
panic("pagemove");
while (size > 0) {
fpte = get_pte(from);
set_pte(to, fpte);
set_pte(from, PG_INVAL);
from += NBPG;
to += NBPG;
size -= NBPG;
}
}