sparc runs in current today
This commit is contained in:
parent
917ce28c48
commit
e9fee9d6d3
|
@ -1,4 +1,4 @@
|
|||
# $Id: TDR,v 1.4 1993/12/02 11:10:39 deraadt Exp $
|
||||
# $Id: TDR,v 1.5 1994/02/01 06:01:19 deraadt Exp $
|
||||
# SPARCstation 1, 1+, 2, etc.
|
||||
|
||||
include "std.sparc"
|
||||
|
@ -9,11 +9,12 @@ options TIMEZONE=480, DST=1
|
|||
# Standard system options
|
||||
options SWAPPAGER, VNODEPAGER, DEVPAGER # paging
|
||||
options DEBUG, DIAGNOSTIC # extra kernel debugging
|
||||
#options KTRACE # system call tracing support
|
||||
options KTRACE # system call tracing support
|
||||
#options KGDB # support for kernel gdb
|
||||
options GDB # support for normal gdb
|
||||
options KGDBDEV=0xc01, KGDBRATE=38400 # device & baud rate
|
||||
options RCONSOLE # fast rasterop console
|
||||
options MAXFDESCS=1024
|
||||
|
||||
# Filesystem options
|
||||
#options FIFO # POSIX fifo support (in all filesystems)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# @(#)files.sparc 8.1 (Berkeley) 7/19/93
|
||||
# $Id: files.sparc.newconf,v 1.8 1993/11/28 18:09:43 deraadt Exp $
|
||||
# $Id: files.sparc.newconf,v 1.9 1994/02/01 06:01:21 deraadt Exp $
|
||||
# sparc-specific configuration info
|
||||
|
||||
maxusers 2 8 64
|
||||
|
@ -95,6 +95,7 @@ file arch/sparc/sparc/kgdb_stub.c
|
|||
# because it must come first in the "ld" command line.
|
||||
file arch/sparc/sparc/locore2.c
|
||||
file arch/sparc/sparc/machdep.c
|
||||
file arch/sparc/sparc/process_machdep.c
|
||||
file arch/sparc/sparc/mem.c
|
||||
file arch/sparc/sparc/openprom.c
|
||||
file arch/sparc/sparc/pmap.c compile-with "${NOOPT_C}"
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
* @(#)cpu.h 8.1 (Berkeley) 6/11/93
|
||||
*
|
||||
* from: Header: cpu.h,v 1.12 93/05/25 10:36:34 torek Exp (LBL)
|
||||
* $Id: cpu.h,v 1.2 1993/10/11 02:28:25 deraadt Exp $
|
||||
* $Id: cpu.h,v 1.3 1994/02/01 06:01:25 deraadt Exp $
|
||||
*/
|
||||
|
||||
#ifndef _CPU_H_
|
||||
|
@ -87,6 +87,7 @@ struct clockframe {
|
|||
u_int ipl; /* actual interrupt priority level */
|
||||
u_int fp; /* %fp at interrupt */
|
||||
};
|
||||
typedef struct clockframe clockframe;
|
||||
|
||||
extern int eintstack[];
|
||||
#define enablertclock() /* TDR: delete this soon */
|
||||
|
@ -125,7 +126,7 @@ int want_resched; /* resched() was called */
|
|||
* buffer pages are invalid. On the sparc, request an ast to send us
|
||||
* through trap(), marking the proc as needing a profiling tick.
|
||||
*/
|
||||
#define need_proftick(p) ((p)->p_flag |= SOWEUPC, want_ast = 1)
|
||||
#define profile_tick(p, framep) ((p)->p_flag |= SOWEUPC, want_ast = 1)
|
||||
|
||||
/*
|
||||
* Notify the current process (p) that it has a signal pending,
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
* @(#)ptrace.h 8.1 (Berkeley) 6/11/93
|
||||
*
|
||||
* from: Header: ptrace.h,v 1.6 92/11/26 02:04:43 torek Exp (LBL)
|
||||
* $Id: ptrace.h,v 1.1 1993/10/02 10:23:23 deraadt Exp $
|
||||
* $Id: ptrace.h,v 1.2 1994/02/01 06:01:26 deraadt Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
|
@ -50,6 +50,5 @@
|
|||
*/
|
||||
#define PT_GETREGS (PT_FIRSTMACH + 0)
|
||||
#define PT_SETREGS (PT_FIRSTMACH + 1)
|
||||
#define PT_GETFPREGS (PT_FIRSTMACH + 2)
|
||||
#define PT_SETFPREGS (PT_FIRSTMACH + 3)
|
||||
|
||||
/*#define PT_GETFPREGS (PT_FIRSTMACH + 2)*/
|
||||
/*#define PT_SETFPREGS (PT_FIRSTMACH + 3)*/
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
* @(#)reg.h 8.1 (Berkeley) 6/11/93
|
||||
*
|
||||
* from: Header: reg.h,v 1.8 92/11/26 02:04:44 torek Exp
|
||||
* $Id: reg.h,v 1.1 1993/10/02 10:23:24 deraadt Exp $
|
||||
* $Id: reg.h,v 1.2 1994/02/01 06:01:27 deraadt Exp $
|
||||
*/
|
||||
|
||||
#ifndef _MACHINE_REG_H_
|
||||
|
@ -77,6 +77,11 @@ struct rwindow {
|
|||
int rw_in[8]; /* %i0..%i7 */
|
||||
};
|
||||
|
||||
struct reg {
|
||||
int rw_local[8]; /* %l0..%l7 */
|
||||
int rw_in[8]; /* %i0..%i7 */
|
||||
};
|
||||
|
||||
#include <machine/fsr.h>
|
||||
|
||||
/*
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* %W% (Berkeley) %G%
|
||||
*
|
||||
* from: Header: sd.c,v 1.27 93/04/29 01:22:19 torek Exp
|
||||
* $Id: sd.c,v 1.4 1993/11/29 08:31:22 deraadt Exp $
|
||||
* $Id: sd.c,v 1.5 1994/02/01 06:01:30 deraadt Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
|
@ -64,8 +64,7 @@
|
|||
* scsi disks. Note that our blocks are in terms of DEV_BSIZE blocks.
|
||||
*/
|
||||
struct sd_softc {
|
||||
struct device sc_dev; /* base device, must be first */
|
||||
struct dkdevice sc_dk;
|
||||
struct dkdevice sc_dk; /* base disk device, must be first */
|
||||
struct unit sc_unit; /* scsi unit */
|
||||
pid_t sc_format_pid; /* process using "format" mode */
|
||||
u_char sc_type; /* drive type */
|
||||
|
@ -223,8 +222,7 @@ sdattach(parent, self, aux)
|
|||
* Declare our existence.
|
||||
*/
|
||||
sc->sc_unit.u_driver = &sdunitdriver;
|
||||
scsi_establish(&sc->sc_unit, &sc->sc_dev, sa->sa_unit);
|
||||
dk_establish(&sc->sc_dk, &sc->sc_dev);
|
||||
scsi_establish(&sc->sc_unit, &sc->sc_dk.dk_dev, sa->sa_unit);
|
||||
|
||||
/*
|
||||
* Figure out what kind of disk this is.
|
||||
|
@ -274,7 +272,7 @@ sdattach(parent, self, aux)
|
|||
++sc->sc_bshift;
|
||||
if (i != DEV_BSIZE) {
|
||||
printf("%s: blksize not multiple of %d: cannot use\n",
|
||||
sc->sc_dev.dv_xname, DEV_BSIZE);
|
||||
sc->sc_dk.dk_dev.dv_xname, DEV_BSIZE);
|
||||
return;
|
||||
}
|
||||
sc->sc_blks <<= sc->sc_bshift;
|
||||
|
@ -295,16 +293,16 @@ sdattach(parent, self, aux)
|
|||
i = (*sc->sc_unit.u_hbd->hd_icmd)(sc->sc_unit.u_hba,
|
||||
sc->sc_unit.u_targ, &rd0, sector, sc->sc_blksize, B_READ);
|
||||
if (i == STS_GOOD) {
|
||||
printf("%s: <%s>\n", sc->sc_dev.dv_xname,
|
||||
printf("%s: <%s>\n", sc->sc_dk.dk_dev.dv_xname,
|
||||
((struct sun_disklabel *)sector)->sl_text);
|
||||
if (sun_disklabel(sector, &sc->sc_dk.dk_label))
|
||||
sc->sc_flags |= SDF_ALIVE;
|
||||
else
|
||||
printf("%s: sun_disklabel fails\n",
|
||||
sc->sc_dev.dv_xname);
|
||||
sc->sc_dk.dk_dev.dv_xname);
|
||||
} else
|
||||
printf("%s: could not read sector 0 for disk label\n",
|
||||
sc->sc_dev.dv_xname);
|
||||
sc->sc_dk.dk_dev.dv_xname);
|
||||
free(sector, M_DEVBUF);
|
||||
#endif
|
||||
#endif /* notyet */
|
||||
|
@ -321,7 +319,7 @@ sdreset(u)
|
|||
{
|
||||
register struct sd_softc *sc = (struct sd_softc *)u->u_dev;
|
||||
|
||||
printf(" %s", sc->sc_dev.dv_xname);
|
||||
printf(" %s", sc->sc_dk.dk_dev.dv_xname);
|
||||
sc->sc_resets++;
|
||||
}
|
||||
|
||||
|
@ -457,10 +455,10 @@ done:
|
|||
if ((sc)->sc_format_pid && legal_cmds[(sc)->sc_cmd.cdb_bytes[0]] > 0) \
|
||||
(*(sc)->sc_unit.u_start)((sc)->sc_unit.u_updev, \
|
||||
&(sc)->sc_unit.u_forw, (struct buf *)NULL, \
|
||||
sdigo, &(sc)->sc_dev); \
|
||||
sdigo, &(sc)->sc_dk.dk_dev); \
|
||||
else \
|
||||
(*(sc)->sc_unit.u_start)((sc)->sc_unit.u_updev, \
|
||||
&(sc)->sc_unit.u_forw, bp, sdgo, &(sc)->sc_dev); \
|
||||
&(sc)->sc_unit.u_forw, bp, sdgo, &(sc)->sc_dk.dk_dev); \
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -549,11 +547,11 @@ sderror(sc, stat)
|
|||
sc->sc_sense.status = stat; /* ??? */
|
||||
if ((stat & STS_MASK) != STS_GOOD) {
|
||||
printf("%s: sense failed, status %x\n",
|
||||
sc->sc_dev.dv_xname, stat);
|
||||
sc->sc_dk.dk_dev.dv_xname, stat);
|
||||
return (0);
|
||||
}
|
||||
printf("%s: scsi sense class %d, code %d",
|
||||
sc->sc_dev.dv_xname,
|
||||
sc->sc_dk.dk_dev.dv_xname,
|
||||
SENSE_ECLASS(sn), SENSE_ECODE(sn));
|
||||
if (SENSE_ISXSENSE(sn) && XSENSE_ISSTD(sn)) {
|
||||
int key;
|
||||
|
@ -648,7 +646,7 @@ sdgo(sc0, cdb)
|
|||
#ifdef DEBUG
|
||||
if (n)
|
||||
printf("%s: partial block xfer -- %x bytes\n",
|
||||
sc->sc_dev.dv_xname, bp->b_bcount);
|
||||
sc->sc_dk.dk_dev.dv_xname, bp->b_bcount);
|
||||
#endif
|
||||
sc->sc_transfers++;
|
||||
}
|
||||
|
@ -670,7 +668,7 @@ sdgo(sc0, cdb)
|
|||
#ifdef DEBUG
|
||||
if (sddebug & SDB_ERROR)
|
||||
printf("%s: sdgo: %s adr %d blk %d len %d ecnt %d\n",
|
||||
sc->sc_dev.dv_xname,
|
||||
sc->sc_dk.dk_dev.dv_xname,
|
||||
bp->b_flags & B_READ? "read" : "write",
|
||||
bp->b_un.b_addr, bp->b_cylin, bp->b_bcount,
|
||||
sc->sc_tab.b_errcnt);
|
||||
|
@ -711,12 +709,12 @@ sdintr(sc0, stat, resid)
|
|||
#ifdef DEBUG
|
||||
if (sddebug & SDB_ERROR)
|
||||
printf("%s: sdintr scsi status 0x%x resid %d\n",
|
||||
sc->sc_dev.dv_xname, stat, resid);
|
||||
sc->sc_dk.dk_dev.dv_xname, stat, resid);
|
||||
#endif
|
||||
retry = sderror(sc, stat);
|
||||
if (retry && ++sc->sc_tab.b_errcnt <= SDRETRY) {
|
||||
printf("%s: retry %d\n",
|
||||
sc->sc_dev.dv_xname, sc->sc_tab.b_errcnt);
|
||||
sc->sc_dk.dk_dev.dv_xname, sc->sc_tab.b_errcnt);
|
||||
goto restart;
|
||||
}
|
||||
bp->b_flags |= B_ERROR;
|
||||
|
@ -852,7 +850,7 @@ sddump(dev_t dev, daddr_t blkoff, caddr_t addr, int len)
|
|||
hba = sc->sc_unit.u_hba;
|
||||
if (hba->hba_head) {
|
||||
(*hba->hba_driver->hd_reset)(hba, 0);
|
||||
printf("[reset %s] ", sc->sc_dev.dv_xname);
|
||||
printf("[reset %s] ", sc->sc_dk.dk_dev.dv_xname);
|
||||
}
|
||||
|
||||
CDB10(&cdb)->cdb_cmd = CMD_WRITE10;
|
||||
|
@ -875,7 +873,7 @@ sddump(dev_t dev, daddr_t blkoff, caddr_t addr, int len)
|
|||
&cdb, addr, n);
|
||||
if ((stat & STS_MASK) != STS_GOOD) {
|
||||
printf("%s: scsi write error 0x%x\ndump ",
|
||||
sc->sc_dev.dv_xname, stat);
|
||||
sc->sc_dk.dk_dev.dv_xname, stat);
|
||||
return (EIO);
|
||||
}
|
||||
if ((len -= n) == 0)
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
* @(#)autoconf.c 8.1 (Berkeley) 6/11/93
|
||||
*
|
||||
* from: Header: autoconf.c,v 1.32 93/05/28 03:55:59 torek Exp (LBL)
|
||||
* $Id: autoconf.c,v 1.5 1993/11/25 00:14:19 deraadt Exp $
|
||||
* $Id: autoconf.c,v 1.6 1994/02/01 06:01:34 deraadt Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
|
@ -951,6 +951,8 @@ gotswap:
|
|||
return;
|
||||
}
|
||||
|
||||
printf("boothowto = %8x, bootdv = %8x\n", boothowto, bootdv);
|
||||
|
||||
/* XXX currently there's no way to set RB_DFLTROOT... */
|
||||
if (boothowto & RB_DFLTROOT || bootdv == NULL)
|
||||
return;
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
* @(#)clock.c 8.1 (Berkeley) 6/11/93
|
||||
*
|
||||
* from: Header: clock.c,v 1.17 92/11/26 03:04:47 torek Exp (LBL)
|
||||
* $Id: clock.c,v 1.5 1993/12/09 20:27:53 pk Exp $
|
||||
* $Id: clock.c,v 1.6 1994/02/01 06:01:35 deraadt Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
|
@ -226,13 +226,17 @@ delay(n)
|
|||
}
|
||||
}
|
||||
|
||||
#if 1
|
||||
int stathz, profhz;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Set up the real-time and statistics clocks. Leave stathz 0 only if
|
||||
* no alternative timer is available.
|
||||
*
|
||||
* The frequencies of these clocks must be an even number of microseconds.
|
||||
*/
|
||||
cpu_initclocks()
|
||||
startrtclock()
|
||||
{
|
||||
register int statint, minint;
|
||||
|
||||
|
@ -241,6 +245,7 @@ cpu_initclocks()
|
|||
hz = 100;
|
||||
tick = 1000000 / hz;
|
||||
}
|
||||
#if 0
|
||||
if (stathz == 0)
|
||||
stathz = hz;
|
||||
if (1000000 % stathz) {
|
||||
|
@ -257,6 +262,9 @@ cpu_initclocks()
|
|||
TIMERREG->t_c14.t_limit = tmr_ustolim(statint);
|
||||
statmin = statint - (statvar >> 1);
|
||||
ienab_bis(IE_L14 | IE_L10);
|
||||
#endif
|
||||
TIMERREG->t_c10.t_limit = tmr_ustolim(tick);
|
||||
ienab_bis(IE_L10);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -277,14 +285,14 @@ setstatclockrate(newhz)
|
|||
*/
|
||||
int
|
||||
clockintr(cap)
|
||||
void *cap;
|
||||
clockframe *cap;
|
||||
{
|
||||
volatile register int discard;
|
||||
extern int rom_console_input;
|
||||
|
||||
/* read the limit register to clear the interrupt */
|
||||
discard = TIMERREG->t_c10.t_limit;
|
||||
hardclock((struct clockframe *)cap);
|
||||
hardclock(cap);
|
||||
if (rom_console_input && cnrom())
|
||||
setsoftint();
|
||||
|
||||
|
@ -298,6 +306,7 @@ int
|
|||
statintr(cap)
|
||||
void *cap;
|
||||
{
|
||||
#if 0
|
||||
volatile register int discard;
|
||||
register u_long newint, r, var;
|
||||
|
||||
|
@ -317,6 +326,9 @@ statintr(cap)
|
|||
newint = statmin + r;
|
||||
|
||||
TIMERREG->t_c14.t_limit = tmr_ustolim(newint);
|
||||
#else
|
||||
TIMERREG->t_c14.t_limit = 0;
|
||||
#endif
|
||||
return (1);
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
* @(#)conf.c 8.1 (Berkeley) 6/11/93
|
||||
*
|
||||
* from: Header: conf.c,v 1.15 93/05/05 09:43:29 torek Exp (LBL)
|
||||
* $Id: conf.c,v 1.6 1993/11/11 23:17:47 deraadt Exp $
|
||||
* $Id: conf.c,v 1.7 1994/02/01 06:01:37 deraadt Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
|
@ -52,7 +52,6 @@
|
|||
#include <sys/vnode.h>
|
||||
#include <sys/tty.h>
|
||||
#include <sys/conf.h>
|
||||
#include <sys/systm.h>
|
||||
|
||||
int rawread __P((dev_t, struct uio *, int));
|
||||
int rawwrite __P((dev_t, struct uio *, int));
|
||||
|
@ -67,7 +66,7 @@ int ttselect __P((dev_t, int, struct proc *));
|
|||
#define dev_type_stop(n) int n __P((struct tty *, int))
|
||||
|
||||
/* bdevsw-specific types */
|
||||
#define dev_type_dump(n) int n __P((dev_t, daddr_t, caddr_t, int))
|
||||
#define dev_type_dump(n) int n __P((dev_t))
|
||||
#define dev_type_size(n) int n __P((dev_t))
|
||||
|
||||
/* error/nullop functions */
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
* @(#)genassym.c 8.1 (Berkeley) 6/11/93
|
||||
*
|
||||
* from: Header: genassym.c,v 1.15 93/04/21 06:09:30 torek Exp (LBL)
|
||||
* $Id: genassym.c,v 1.3 1993/11/26 11:43:29 deraadt Exp $
|
||||
* $Id: genassym.c,v 1.4 1994/02/01 06:01:38 deraadt Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
|
@ -108,7 +108,6 @@ main()
|
|||
off("P_STAT", struct proc, p_stat);
|
||||
off("P_WCHAN", struct proc, p_wchan);
|
||||
off("P_VMSPACE", struct proc, p_vmspace);
|
||||
off("P_RTIME", struct proc, p_rtime);
|
||||
def("SRUN", SRUN);
|
||||
|
||||
/* VM structure fields */
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
* @(#)intr.c 8.1 (Berkeley) 6/11/93
|
||||
*
|
||||
* from: Header: intr.c,v 1.20 92/11/26 03:04:53 torek Exp (LBL)
|
||||
* $Id: intr.c,v 1.2 1993/10/11 02:16:18 deraadt Exp $
|
||||
* $Id: intr.c,v 1.3 1994/02/01 06:01:39 deraadt Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
|
@ -138,7 +138,7 @@ soft01intr(fp)
|
|||
}
|
||||
if (sir.sir_which[SIR_CLOCK]) {
|
||||
sir.sir_which[SIR_CLOCK] = 0;
|
||||
softclock();
|
||||
softclock(fp);
|
||||
}
|
||||
}
|
||||
return (1);
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
* @(#)locore.s 8.2 (Berkeley) 8/12/93
|
||||
*
|
||||
* from: Header: locore.s,v 1.51 93/04/21 06:19:37 torek Exp
|
||||
* $Id: locore.s,v 1.4 1993/11/24 02:39:31 deraadt Exp $
|
||||
* $Id: locore.s,v 1.5 1994/02/01 06:01:43 deraadt Exp $
|
||||
*/
|
||||
|
||||
#define LOCORE
|
||||
|
@ -2565,6 +2565,53 @@ _esigcode:
|
|||
#endif
|
||||
#define ALTENTRY(x) .globl _##x; _##x:
|
||||
|
||||
/*
|
||||
* update profiling information for the user
|
||||
* addupc(pc, &u.u_prof, ticks)
|
||||
*/
|
||||
.globl _addupc
|
||||
_addupc:
|
||||
save %sp, -CCFSZ, %sp
|
||||
|
||||
! %i0 = pc, %i1 = profp, %i2 = ticks
|
||||
ld [%i1 + 8], %l2 ! get pr->pr_off
|
||||
sub %i0, %l2, %l0
|
||||
bneg,a Lauexit ! if(pc<pr_off) skip out
|
||||
nop
|
||||
ld [%i1 + 12], %l3 ! scale = pr->pr_scale
|
||||
sll %i0, 1, %o0 ! pc /= 2
|
||||
sll %l3, 1, %o1 ! scale /= 2
|
||||
call .umul ! praddr = pc * scale
|
||||
nop
|
||||
ld [%i1 + 4], %l3 ! get pr->pr_size
|
||||
sll %o0, 15, %l5 ! praddr <<= 15
|
||||
andn %l5, 1, %l5 ! praddr &= ~1
|
||||
cmp %l5, %l3 ! if(praddr > pr_size) skip out
|
||||
bge,a Lauexit
|
||||
nop
|
||||
ld [%i1], %o0 ! get pr->pr_base
|
||||
add %l5, %o0, %l5 ! praddr += pr_base
|
||||
mov %l5, %o0
|
||||
call _fusword ! count = fusword(praddr)
|
||||
nop
|
||||
cmp %o0, -1 ! error, fail.
|
||||
beq,a Lauerror
|
||||
nop
|
||||
add %o0, 1, %o1 ! count++
|
||||
mov %l5, %o0 ! reload praddr
|
||||
call _susword ! susword(praddr, count)
|
||||
nop
|
||||
cmp %o0, -1
|
||||
beq,a Lauerror
|
||||
nop
|
||||
Lauexit:
|
||||
ret
|
||||
restore
|
||||
Lauerror:
|
||||
st %g0, [%i1 + 12] ! turn off profiling
|
||||
ret
|
||||
restore
|
||||
|
||||
/*
|
||||
* copyinstr(fromaddr, toaddr, maxlength, &lencopied)
|
||||
*
|
||||
|
@ -2932,21 +2979,20 @@ Lsw_panic_srun:
|
|||
ALIGN
|
||||
|
||||
/*
|
||||
* cpu_swtch() picks a process to run and runs it, saving the current
|
||||
* swtch() picks a process to run and runs it, saving the current
|
||||
* one away. On the assumption that (since most workstations are
|
||||
* single user machines) the chances are quite good that the new
|
||||
* process will turn out to be the current process, we defer saving
|
||||
* it here until we have found someone to load. If that someone
|
||||
* is the current process we avoid both store and load.
|
||||
*
|
||||
* cpu_swtch() is always entered at splstatclock or splhigh.
|
||||
* swtch() is always entered at splstatclock or splhigh.
|
||||
*
|
||||
* IT MIGHT BE WORTH SAVING BEFORE ENTERING idle TO AVOID HAVING TO
|
||||
* SAVE LATER WHEN SOMEONE ELSE IS READY ... MUST MEASURE!
|
||||
*/
|
||||
.globl _runtime
|
||||
.globl _time
|
||||
ENTRY(cpu_swtch)
|
||||
ENTRY(swtch)
|
||||
INCR(_cnt+V_SWTCH) ! cnt.v_switch++;
|
||||
/*
|
||||
* REGISTER USAGE AT THIS POINT:
|
||||
* %g1 = oldpsr (excluding ipl bits)
|
||||
|
@ -2973,28 +3019,10 @@ ENTRY(cpu_swtch)
|
|||
st %g1, [%o0 + PCB_PSR] ! cpcb->pcb_psr = oldpsr;
|
||||
andn %g1, PSR_PIL, %g1 ! oldpsr &= ~PSR_PIL;
|
||||
|
||||
/*
|
||||
* In all the fiddling we did to get this far, the thing we are
|
||||
* waiting for might have come ready, so let interrupts in briefly
|
||||
* before checking for other processes. Note that we still have
|
||||
* curproc set---we have to fix this or we can get in trouble with
|
||||
* the run queues below.
|
||||
*/
|
||||
st %g0, [%g7 + %lo(_curproc)] ! curproc = NULL;
|
||||
wr %g1, 0, %psr ! (void) spl0();
|
||||
nop; nop; nop ! paranoia
|
||||
wr %g1, PIL_CLOCK <<8 , %psr ! (void) splclock();
|
||||
|
||||
Lsw_scan:
|
||||
nop; nop; nop ! paranoia
|
||||
/*
|
||||
* We're about to run a (possibly) new process. Set runtime
|
||||
* to indicate its start time.
|
||||
*/
|
||||
sethi %hi(_time), %o0
|
||||
ldd [%o0 + %lo(_time)], %o2
|
||||
sethi %hi(_runtime), %o0
|
||||
std %o2, [%o0 + %lo(_runtime)]
|
||||
|
||||
ld [%g2 + %lo(_whichqs)], %o3
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
* @(#)machdep.c 8.1 (Berkeley) 6/11/93
|
||||
*
|
||||
* from: Header: machdep.c,v 1.41 93/05/27 04:39:05 torek Exp
|
||||
* $Id: machdep.c,v 1.15 1994/01/27 19:00:13 pk Exp $
|
||||
* $Id: machdep.c,v 1.16 1994/02/01 06:01:47 deraadt Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
|
@ -186,14 +186,12 @@ cpu_startup()
|
|||
vm_map_simplify(buffer_map, curbuf);
|
||||
}
|
||||
|
||||
#ifdef notdef
|
||||
/*
|
||||
* 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);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Allocate a map for physio. Others use a submap of the kernel
|
||||
|
@ -871,58 +869,3 @@ cpu_exec_aout_makecmds(p, epp)
|
|||
#endif
|
||||
return error;
|
||||
}
|
||||
|
||||
int
|
||||
ptrace_set_pc(p, addr)
|
||||
struct proc *p;
|
||||
u_long addr;
|
||||
{
|
||||
/* TDR: IMPLIMENT! */
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
int
|
||||
ptrace_getregs(p, addr)
|
||||
struct proc *p;
|
||||
u_long *addr;
|
||||
{
|
||||
return copyout(p->p_md.md_tf, addr, sizeof(struct trapframe));
|
||||
}
|
||||
|
||||
int
|
||||
ptrace_setregs(p, addr)
|
||||
struct proc *p;
|
||||
u_long *addr;
|
||||
{
|
||||
int error;
|
||||
|
||||
if (error = copyin(addr, p->p_md.md_tf, sizeof(struct trapframe)))
|
||||
return error;
|
||||
}
|
||||
|
||||
int
|
||||
ptrace_single_step(p)
|
||||
struct proc *p;
|
||||
{
|
||||
/* TDR: IMPLIMENT! */
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
int
|
||||
ptrace_getfpregs(p, addr)
|
||||
struct proc *p;
|
||||
u_long *addr;
|
||||
{
|
||||
return copyout(p->p_md.md_fpstate, addr, sizeof(struct fpstate));
|
||||
}
|
||||
|
||||
int
|
||||
ptrace_setfpregs(p, addr)
|
||||
struct proc *p;
|
||||
u_long *addr;
|
||||
{
|
||||
int error;
|
||||
|
||||
if (error = copyin(addr, p->p_md.md_fpstate, sizeof(struct fpstate)))
|
||||
return error;
|
||||
}
|
||||
|
|
|
@ -2,12 +2,15 @@
|
|||
* fake swapgeneric.c -- should do this differently.
|
||||
*
|
||||
* @(#)swapgeneric.c 8.1 (Berkeley) 7/19/93
|
||||
* $Id: swapgeneric.c,v 1.3 1993/10/16 07:23:12 deraadt Exp $
|
||||
* $Id: swapgeneric.c,v 1.4 1994/02/01 06:01:50 deraadt Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/conf.h>
|
||||
|
||||
extern int ufs_mountroot();
|
||||
int (*mountroot)() = ufs_mountroot;
|
||||
|
||||
dev_t rootdev = NODEV;
|
||||
dev_t dumpdev = NODEV;
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
* @(#)trap.c 8.1 (Berkeley) 6/16/93
|
||||
*
|
||||
* from: Header: trap.c,v 1.34 93/05/28 04:34:50 torek Exp
|
||||
* $Id: trap.c,v 1.8 1993/12/01 20:59:59 pk Exp $
|
||||
* $Id: trap.c,v 1.9 1994/02/01 06:01:51 deraadt Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
|
@ -158,7 +158,7 @@ const char *trap_type[] = {
|
|||
* trap, mem_access_fault, and syscall.
|
||||
*/
|
||||
static inline void
|
||||
userret(struct proc *p, int pc, u_quad_t oticks)
|
||||
userret(struct proc *p, int pc, struct timeval oticks)
|
||||
{
|
||||
int sig;
|
||||
|
||||
|
@ -169,8 +169,18 @@ userret(struct proc *p, int pc, u_quad_t oticks)
|
|||
if (want_ast) {
|
||||
want_ast = 0;
|
||||
if (p->p_flag & SOWEUPC) {
|
||||
int ticks;
|
||||
extern int profscale;
|
||||
struct timeval *tv = &p->p_stime;
|
||||
|
||||
ticks = ((tv->tv_sec - oticks.tv_sec) * 1000 +
|
||||
(tv->tv_usec - oticks.tv_usec) / 1000) / (tick / 1000);
|
||||
#ifdef PROFTIMER
|
||||
addupc(pc, &p->p_stats->p_prof, ticks * profscale);
|
||||
#else
|
||||
addupc(pc, &p->p_stats->p_prof, ticks);
|
||||
#endif
|
||||
p->p_flag &= ~SOWEUPC;
|
||||
ADDUPROF(p);
|
||||
}
|
||||
}
|
||||
if (want_resched) {
|
||||
|
@ -182,7 +192,7 @@ userret(struct proc *p, int pc, u_quad_t oticks)
|
|||
* before we swtch()'ed, we might not be on the queue
|
||||
* indicated by our priority.
|
||||
*/
|
||||
(void) splstatclock();
|
||||
(void) splclock();
|
||||
setrq(p);
|
||||
p->p_stats->p_ru.ru_nivcsw++;
|
||||
swtch();
|
||||
|
@ -194,8 +204,21 @@ userret(struct proc *p, int pc, u_quad_t oticks)
|
|||
/*
|
||||
* If profiling, charge recent system time to the trapped pc.
|
||||
*/
|
||||
if (p->p_flag & SPROFIL)
|
||||
addupc_task(p, pc, (int)(p->p_sticks - oticks));
|
||||
if (p->p_stats->p_prof.pr_scale) {
|
||||
int ticks;
|
||||
struct timeval *tv = &p->p_stime;
|
||||
|
||||
ticks = ((tv->tv_sec - oticks.tv_sec) * 1000 +
|
||||
(tv->tv_usec - oticks.tv_usec) / 1000) / (tick / 1000);
|
||||
if (ticks) {
|
||||
#ifdef PROFTIMER
|
||||
extern int profscale;
|
||||
addupc(pc, &p->p_stats->p_prof, ticks * profscale);
|
||||
#else
|
||||
addupc(pc, &p->p_stats->p_prof, ticks);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
curpri = p->p_pri;
|
||||
}
|
||||
|
@ -223,7 +246,7 @@ trap(type, psr, pc, tf)
|
|||
register struct proc *p;
|
||||
register struct pcb *pcb;
|
||||
register int n;
|
||||
u_quad_t sticks;
|
||||
struct timeval stime;
|
||||
|
||||
/* This steps the PC over the trap. */
|
||||
#define ADVANCE (n = tf->tf_npc, tf->tf_pc = n, tf->tf_npc = n + 4)
|
||||
|
@ -247,7 +270,7 @@ trap(type, psr, pc, tf)
|
|||
}
|
||||
if ((p = curproc) == NULL)
|
||||
p = &proc0;
|
||||
sticks = p->p_sticks;
|
||||
stime = p->p_stime;
|
||||
pcb = &p->p_addr->u_pcb;
|
||||
p->p_md.md_tf = tf; /* for ptrace/signals */
|
||||
|
||||
|
@ -443,7 +466,7 @@ if (pcb->pcb_nsaved) panic("trap T_WINUF");
|
|||
trapsignal(p, SIGFPE, FPE_INTOVF_TRAP);
|
||||
break;
|
||||
}
|
||||
userret(p, pc, sticks);
|
||||
userret(p, pc, stime);
|
||||
share_fpu(p, tf);
|
||||
#undef ADVANCE
|
||||
}
|
||||
|
@ -525,12 +548,12 @@ mem_access_fault(type, ser, v, pc, psr, tf)
|
|||
register int i, rv, sig = SIGBUS;
|
||||
vm_prot_t ftype;
|
||||
int onfault, mmucode;
|
||||
u_quad_t sticks;
|
||||
struct timeval stime;
|
||||
|
||||
cnt.v_trap++;
|
||||
if ((p = curproc) == NULL) /* safety check */
|
||||
p = &proc0;
|
||||
sticks = p->p_sticks;
|
||||
stime = p->p_stime;
|
||||
|
||||
/*
|
||||
* Figure out what to pass the VM code, and ignore the sva register
|
||||
|
@ -644,7 +667,7 @@ kfault:
|
|||
}
|
||||
out:
|
||||
if ((psr & PSR_PS) == 0) {
|
||||
userret(p, pc, sticks);
|
||||
userret(p, pc, stime);
|
||||
share_fpu(p, tf);
|
||||
}
|
||||
}
|
||||
|
@ -670,7 +693,7 @@ syscall(code, tf, pc)
|
|||
int i[8];
|
||||
} args;
|
||||
int rval[2];
|
||||
u_quad_t sticks;
|
||||
struct timeval stime;
|
||||
extern int nsysent;
|
||||
extern struct pcb *cpcb;
|
||||
#ifdef COMPAT_SUNOS
|
||||
|
@ -688,7 +711,7 @@ syscall(code, tf, pc)
|
|||
if (tf != (struct trapframe *)((caddr_t)cpcb + UPAGES * NBPG) - 1)
|
||||
panic("syscall trapframe");
|
||||
#endif
|
||||
sticks = p->p_sticks;
|
||||
stime = p->p_stime;
|
||||
p->p_md.md_tf = tf;
|
||||
#ifdef DEBUG_SCALL
|
||||
printf("sc[%d] %s%d/X%x(", p->p_pid, p->p_emul ? "netbsd" : "sunos",
|
||||
|
@ -815,7 +838,7 @@ printf("errno %d", error);
|
|||
}
|
||||
/* else if (error == ERESTART || error == EJUSTRETURN) */
|
||||
/* nothing to do */
|
||||
userret(p, pc, sticks);
|
||||
userret(p, pc, stime);
|
||||
#ifdef KTRACE
|
||||
if (KTRPOINT(p, KTR_SYSRET))
|
||||
ktrsysret(p->p_tracep, code, error, rval[0]);
|
||||
|
|
Loading…
Reference in New Issue