update for LWPs, and some lite cleanup.

This commit is contained in:
chs 2003-08-31 01:26:31 +00:00
parent fc388bdc8b
commit cc0b88792e
29 changed files with 504 additions and 410 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: autoconf.c,v 1.9 2003/08/07 16:27:44 agc Exp $ */
/* $NetBSD: autoconf.c,v 1.10 2003/08/31 01:26:31 chs Exp $ */
/* $OpenBSD: autoconf.c,v 1.15 2001/06/25 00:43:10 mickey Exp $ */
@ -86,7 +86,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.9 2003/08/07 16:27:44 agc Exp $");
__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.10 2003/08/31 01:26:31 chs Exp $");
#include "opt_kgdb.h"
#include "opt_useleds.h"
@ -197,7 +197,7 @@ hp700_led_ctl(int off, int on, int toggle)
else {
#define HP700_LED_DATA 0x01
#define HP700_LED_STROBE 0x02
register int b;
int b;
for (b = 0x80; b; b >>= 1) {
*machine_ledaddr = (r & b)? HP700_LED_DATA : 0;
DELAY(1);
@ -458,7 +458,7 @@ pdc_scanbus(self, bus, maxmod, callback)
{
struct pdc_memmap pdc_memmap;
struct device_path dp;
register int i;
int i;
for (i = maxmod; i--; ) {
struct confargs nca;
@ -496,7 +496,7 @@ const char *
hppa_mod_info(type, sv)
int type, sv;
{
register const struct hppa_mod_info *mi;
const struct hppa_mod_info *mi;
static char fakeid[32];
for (mi = hppa_knownmods; mi->mi_type >= 0 &&

View File

@ -1,4 +1,4 @@
# $NetBSD: genassym.cf,v 1.4 2002/09/26 18:56:33 thorpej Exp $
# $NetBSD: genassym.cf,v 1.5 2003/08/31 01:26:31 chs Exp $
# $OpenBSD: genassym.cf,v 1.18 2001/09/20 18:31:14 mickey Exp $
@ -62,7 +62,6 @@ include <hp700/hp700/intr.h>
include <hppa/hppa/hpt.h>
# general constants
export NBPG
export PGSHIFT
export USRSTACK
export HPPA_PID_KERNEL
@ -178,18 +177,20 @@ member TF_CR30 tf_cr30
# proc fields and values
struct proc
member P_FORW p_forw
member P_BACK p_back
member P_ADDR p_addr
member P_PRIORITY p_priority
member P_STAT p_stat
member P_WCHAN p_wchan
member P_MD p_md
member P_MD_FLAGS p_md.md_flags
member P_MD_REGS p_md.md_regs
export SRUN
export SONPROC
struct lwp
member L_FORW l_forw
member L_BACK l_back
member L_ADDR l_addr
member L_PRIORITY l_priority
member L_STAT l_stat
member L_WCHAN l_wchan
member L_MD l_md
member L_MD_REGS l_md.md_regs
export LSRUN
export LSONPROC
struct pcb
member PCB_FPREGS pcb_fpregs

View File

@ -1,4 +1,4 @@
/* $NetBSD: locore.S,v 1.3 2002/08/14 16:18:12 fredette Exp $ */
/* $NetBSD: locore.S,v 1.4 2003/08/31 01:26:32 chs Exp $ */
/* $OpenBSD: locore.S,v 1.46 2001/09/20 18:33:03 mickey Exp $ */
@ -130,10 +130,10 @@
.import boothowto, data
.import bootdev, data
.import esym, data
.import curproc, data
.import curlwp, data
.import want_resched, data
.import virtual_avail, data
.import proc0, data
.import lwp0, data
.import proc0paddr, data
.import kpsw, data
.import panic, code
@ -204,8 +204,8 @@ ENTRY(start,0)
ldil L%$global$,dp
ldo R%$global$(dp),dp
/* zero fake trapframe and proc0 u-area */
/* XXX - we should create a real trapframe for proc0 */
/* zero fake trapframe and lwp0 u-area */
/* XXX - we should create a real trapframe for lwp0 */
copy arg3, t2
ldi NBPG+TRAPFRAME_SIZEOF, t1
$start_zero_tf
@ -227,10 +227,10 @@ $start_zero_tf
add arg3, arg0, arg0
ldil L%proc0paddr, t1
stw arg3, R%proc0paddr(t1)
ldil L%proc0, t2
stw arg3, R%proc0+P_ADDR(t2)
ldil L%lwp0, t2
stw arg3, R%lwp0+L_ADDR(t2)
ldo NBPG(arg3), t1
stw t1, R%proc0+P_MD_REGS(t2)
stw t1, R%lwp0+L_MD_REGS(t2)
ldil L%TFF_LAST, t1
stw t1, TF_FLAGS-TRAPFRAME_SIZEOF(sp)
@ -729,25 +729,29 @@ EXIT(microtime)
/* Include the support functions. */
#include <hppa/hppa/support.S>
.align 32
ENTRY(cpu_switchto,128)
EXIT(cpu_switchto)
/*
* cpu_switch()
* Find the highest priority process and resume it.
* Find the highest priority LWP and resume it.
*/
.align 32
ENTRY(cpu_switch,128)
/*
* Clear curproc so that we don't accumulate system time while idle.
* Clear curlwp so that we don't accumulate system time while idle.
*/
ldil L%curproc, t1
ldw R%curproc(t1), arg2
stw r0, R%curproc(t1)
/* remain on the old (curproc)'s stack until we have a better choice */
ldil L%curlwp, t1
ldw R%curlwp(t1), arg2
stw r0, R%curlwp(t1)
/* remain on the old (curlwp)'s stack until we have a better choice */
/*
* arg3: spl
* t1: &sched_whichqs
* t2: old curproc
* t2: old curlwp
*
*/
@ -758,7 +762,7 @@ switch_search
copy %sp, %r3
stw,ma %r1, HPPA_FRAME_SIZE(%sp)
/* save cpl and old curproc */
/* save cpl and old curlwp */
ldil L%cpl, %arg0
ldw R%cpl(%arg0), %arg0
stw %arg0, HPPA_FRAME_ARG(0)(%r3)
@ -806,15 +810,15 @@ idle_loop
nop
gotprocs
/* recover old curproc */
/* recover old curlwp */
ldw HPPA_FRAME_ARG(1)(%r3), %arg2
#if 0
/* XXX debugging - break if old curproc is NULL */
comb,<>,n %arg2, %r0, curprocok
/* XXX debugging - break if old curlwp is NULL */
comb,<>,n %arg2, %r0, curlwpok
nop
break 0, 5
curprocok
curlwpok
#endif
/* end stack calling convention */
@ -832,7 +836,7 @@ getbit
ldo R%sched_qs(t2), t2
sh3add t4, t2, t2
ldw P_FORW(t2), arg1
ldw L_FORW(t2), arg1
#ifdef DIAGNOSTIC
comb,<> t2, arg1, link_ok
nop
@ -852,10 +856,10 @@ Lcspstr
.align 8
link_ok
#endif
ldw P_FORW(arg1), arg0
stw arg0, P_FORW(t2)
stw t2, P_BACK(arg0)
stw r0, P_BACK(arg1)
ldw L_FORW(arg1), arg0
stw arg0, L_FORW(t2)
stw t2, L_BACK(arg0)
stw r0, L_BACK(arg1)
comb,<> arg0, t2, sw_qnempty
nop
@ -869,21 +873,21 @@ sw_qnempty
stw r0, R%want_resched(t3)
#ifdef DIAGNOSTIC
/* The new process must have no wait channel. */
ldw P_WCHAN(arg1), t1
/* The new LWP must have no wait channel. */
ldw L_WCHAN(arg1), t1
comb,<>,n r0, t1, switch_error
copy arg1, t2
/* The new process' state must be SRUN. */
ldb P_STAT(arg1), t1
comib,<>,n SRUN, t1, switch_error
/* The new LWP's state must be LSRUN. */
ldw L_STAT(arg1), t1
comib,<>,n LSRUN, t1, switch_error
copy arg1, t2
/*
* Either we must be switching to the same process, or
* the the new process' kernel stack must be reasonable.
* Either we must be switching to the same LWP, or
* the the new LWP's kernel stack must be reasonable.
*/
comb,=,n arg1, arg2, kstack_ok
ldw P_MD_REGS(arg1), t1
ldw P_ADDR(arg1), arg0
ldw L_MD_REGS(arg1), t1
ldw L_ADDR(arg1), arg0
ldw TF_R30(t1), t1
ldo NBPG(arg0), arg0
comb,>>,n arg0, t1, switch_error
@ -895,21 +899,21 @@ sw_qnempty
copy arg1, t2
kstack_ok
#endif
ldi SONPROC, t1
stb t1, P_STAT(arg1)
ldil L%curproc, t1
ldi LSONPROC, t1
stw t1, L_STAT(arg1)
ldil L%curlwp, t1
/*
* Disable interrupts while we're doing the real
* switch. Is this just being paranoid?
*/
mfctl eiem, arg3
mtctl r0, eiem
stw arg1, R%curproc(t1)
stw arg1, R%curlwp(t1)
/* Skip context switch if same process. */
/* Skip context switch if same LWP. */
comb,=,n arg1, arg2, switch_return
/* If old process exited, don't bother. */
/* If old LWP exited, don't bother. */
comb,=,n r0, arg2, switch_exited
/*
@ -917,7 +921,7 @@ kstack_ok
*
* arg2: old proc
*/
ldw P_MD(arg2), t1
ldw L_MD(arg2), t1
copy sp, t2
ldo HPPA_FRAME_SIZE+16*4(sp), sp
ldw TF_R30(t1), t3
@ -944,14 +948,14 @@ kstack_ok
stw r17, 14*4(t2)
stw r18, 15*4(t2)
/* don't need old curproc (arg2) starting from here */
/* don't need old curlwp (arg2) starting from here */
switch_exited
/*
* 3. restore new proc context
*
* arg1: new proc
*/
ldw P_MD(arg1), t1
ldw L_MD(arg1), t1
ldw TF_CR30(t1), t2
ldw TF_R30(t1), sp
ldw TF_CR9(t1), t3
@ -991,10 +995,10 @@ ALTENTRY(hppa_fpu_nop1)
b,n switch_return
/*
* We do have a hardware FPU. If the process
* We do have a hardware FPU. If the LWP
* that we just switched to has its state in the
* FPU, enable the FPU, else disable it, so if
* the process does try to use the coprocessor
* the LWP does try to use the coprocessor
* we'll get an assist emulation trap to swap
* states.
*/
@ -1015,8 +1019,8 @@ EXIT(cpu_switch)
/*
* switch_exit(struct proc *p)
* restore proc0 context and go into cpu_switch to select the next runable
* process.
* restore lwp0 context and go into cpu_switch to select the next runable
* LWP.
*/
.import kernel_map, data
.import uvmspace_free, code
@ -1071,7 +1075,7 @@ ENTRY(switch_exit,0)
EXIT(switch_exit)
/*
* This is the first code run in a new process after
* This is the first code run in a new LWP after
* cpu_switch() has switched to it for the first time.
* This happens courtesy of the setup in cpu_fork(),
* which also makes sure that %t3 is the address of
@ -1115,14 +1119,14 @@ ENTRY(switch_trampoline,64)
/*
* Since the first kernel function returned,
* this process was created by the fork()
* this LWP was created by the fork()
* syscall, which we now return from.
*/
ldil L%curproc, t1
ldw R%curproc(t1), t2
ldil L%curlwp, t1
ldw R%curlwp(t1), t2
.call
b $syscall_return
ldw P_MD(t2), t3
ldw L_MD(t2), t3
EXIT(switch_trampoline)
/* Include the signal code. */

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.12 2003/07/15 02:29:26 lukem Exp $ */
/* $NetBSD: machdep.c,v 1.13 2003/08/31 01:26:32 chs Exp $ */
/*-
* Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@ -70,8 +70,9 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.12 2003/07/15 02:29:26 lukem Exp $");
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.13 2003/08/31 01:26:32 chs Exp $");
#include "opt_cputype.h"
#include "opt_ddb.h"
#include "opt_kgdb.h"
#include "opt_compat_hpux.h"
@ -102,6 +103,7 @@ __KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.12 2003/07/15 02:29:26 lukem Exp $");
#include <sys/ksyms.h>
#include <sys/mount.h>
#include <sys/sa.h>
#include <sys/syscallargs.h>
#include <uvm/uvm_page.h>
@ -420,7 +422,7 @@ hppa_init(start)
paddr_t start;
{
vaddr_t vstart, vend;
register int error;
int error;
int hptsize; /* size of HPT table if supported */
int sz;
u_int *p, *q;
@ -952,7 +954,7 @@ cpu_startup()
void
delay_init(void)
{
register u_int num, denom, delta, mdelta;
u_int num, denom, delta, mdelta;
mdelta = UINT_MAX;
for (denom = 1; denom < 1000; denom++) {
@ -973,7 +975,7 @@ void
delay(us)
u_int us;
{
register u_int start, end, n;
u_int start, end, n;
mfctl(CR_ITMR, start);
while (us) {
@ -999,7 +1001,7 @@ static __inline void
fall(c_base, c_count, c_loop, c_stride, data)
int c_base, c_count, c_loop, c_stride, data;
{
register int loop;
int loop;
for (; c_count--; c_base += c_stride)
for (loop = c_loop; loop--; )
@ -1026,13 +1028,13 @@ fcacheall()
void
ptlball()
{
register pa_space_t sp;
register int i, j, k;
pa_space_t sp;
int i, j, k;
/* instruction TLB */
sp = pdc_cache.it_sp_base;
for (i = 0; i < pdc_cache.it_sp_count; i++) {
register vaddr_t off = pdc_cache.it_off_base;
vaddr_t off = pdc_cache.it_off_base;
for (j = 0; j < pdc_cache.it_off_count; j++) {
for (k = 0; k < pdc_cache.it_loop; k++)
pitlbe(sp, off);
@ -1044,7 +1046,7 @@ ptlball()
/* data TLB */
sp = pdc_cache.dt_sp_base;
for (i = 0; i < pdc_cache.dt_sp_count; i++) {
register vaddr_t off = pdc_cache.dt_off_base;
vaddr_t off = pdc_cache.dt_off_base;
for (j = 0; j < pdc_cache.dt_off_count; j++) {
for (k = 0; k < pdc_cache.dt_loop; k++)
pdtlbe(sp, off);
@ -1630,10 +1632,10 @@ dumpsys()
{
const struct bdevsw *bdev;
int psize, bytes, i, n;
register caddr_t maddr;
register daddr_t blkno;
register int (*dump) __P((dev_t, daddr_t, caddr_t, size_t));
register int error;
caddr_t maddr;
daddr_t blkno;
int (*dump) __P((dev_t, daddr_t, caddr_t, size_t));
int error;
if (dumpdev == NODEV)
return;
@ -1704,11 +1706,11 @@ kcopy(from, to, size)
void *to;
size_t size;
{
register u_int oldh = curproc->p_addr->u_pcb.pcb_onfault;
u_int oldh = curlwp->l_addr->u_pcb.pcb_onfault;
curproc->p_addr->u_pcb.pcb_onfault = (u_int)&copy_on_fault;
curlwp->l_addr->u_pcb.pcb_onfault = (u_int)&copy_on_fault;
bcopy(from, to, size);
curproc->p_addr->u_pcb.pcb_onfault = oldh;
curlwp->l_addr->u_pcb.pcb_onfault = oldh;
return 0;
}
@ -1717,19 +1719,20 @@ kcopy(from, to, size)
* Set registers on exec.
*/
void
setregs(p, pack, stack)
register struct proc *p;
setregs(l, pack, stack)
struct lwp *l;
struct exec_package *pack;
u_long stack;
{
register struct trapframe *tf = p->p_md.md_regs;
/* register struct pcb *pcb = &p->p_addr->u_pcb; */
struct proc *p = l->l_proc;
struct trapframe *tf = l->l_md.md_regs;
/* struct pcb *pcb = &l->l_addr->u_pcb; */
#ifdef PMAPDEBUG
extern int pmapdebug;
pmapdebug = 0x180d;
pmapdebug = -1;
printf("setregs(%p, %p, %x), ep=%x, cr30=%x\n",
p, pack, (u_int)stack, (u_int)pack->ep_entry, tf->tf_cr30);
l, pack, (u_int)stack, (u_int)pack->ep_entry, tf->tf_cr30);
#endif
tf->tf_iioq_tail = 4 +

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.h,v 1.2 2002/08/11 19:53:42 fredette Exp $ */
/* $NetBSD: machdep.h,v 1.3 2003/08/31 01:26:32 chs Exp $ */
/* $OpenBSD: cpufunc.h,v 1.17 2000/05/15 17:22:40 mickey Exp $ */
@ -75,6 +75,10 @@
#ifdef _KERNEL
#ifdef _KERNEL_OPT
#include "opt_useleds.h"
#endif
#include <hppa/hppa/machdep.h>
/* The LEDs. */

View File

@ -1,4 +1,4 @@
/* $NetBSD: mainbus.c,v 1.12 2003/07/15 02:29:26 lukem Exp $ */
/* $NetBSD: mainbus.c,v 1.13 2003/08/31 01:26:32 chs Exp $ */
/*-
* Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@ -70,7 +70,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.12 2003/07/15 02:29:26 lukem Exp $");
__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.13 2003/08/31 01:26:32 chs Exp $");
#undef BTLBDEBUG
@ -1263,7 +1263,7 @@ mbattach(parent, self, aux)
struct device *self;
void *aux;
{
register struct mainbus_softc *sc = (struct mainbus_softc *)self;
struct mainbus_softc *sc = (struct mainbus_softc *)self;
struct pdc_hpa pdc_hpa PDC_ALIGNMENT;
struct confargs nca;
bus_space_handle_t ioh;
@ -1312,7 +1312,7 @@ hppa_hpa_t
cpu_gethpa(n)
int n;
{
register struct mainbus_softc *sc;
struct mainbus_softc *sc;
sc = mainbus_cd.cd_devs[0];
@ -1348,8 +1348,8 @@ mbsubmatch(parent, cf, aux)
struct cfdata *cf;
void *aux;
{
register struct confargs *ca = aux;
register int ret;
struct confargs *ca = aux;
int ret;
int saved_irq;
saved_irq = ca->ca_irq;

View File

@ -1,20 +1,21 @@
/* $NetBSD: sys_machdep.c,v 1.2 2003/07/15 02:29:26 lukem Exp $ */
/* $NetBSD: sys_machdep.c,v 1.3 2003/08/31 01:26:33 chs Exp $ */
/* $OpenBSD: sys_machdep.c,v 1.1 1998/12/29 18:06:48 mickey Exp $ */
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: sys_machdep.c,v 1.2 2003/07/15 02:29:26 lukem Exp $");
__KERNEL_RCSID(0, "$NetBSD: sys_machdep.c,v 1.3 2003/08/31 01:26:33 chs Exp $");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/mount.h>
#include <sys/sa.h>
#include <sys/syscallargs.h>
int
sys_sysarch(p, v, retval)
struct proc *p;
sys_sysarch(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{

View File

@ -1,4 +1,4 @@
/* $NetBSD: cpu.h,v 1.6 2003/06/23 11:01:15 martin Exp $ */
/* $NetBSD: cpu.h,v 1.7 2003/08/31 01:26:33 chs Exp $ */
/* $OpenBSD: cpu.h,v 1.20 2001/01/29 00:01:58 mickey Exp $ */
@ -187,6 +187,8 @@ extern struct cpu_info cpu_info_store;
#define cpu_wait(p) /* nothing */
#define cpu_number() 0
#define cpu_proc_fork(p1, p2)
#define MD_CACHE_FLUSH 0
#define MD_CACHE_PURGE 1
#define HPPA_SID_KERNEL 0
@ -207,17 +209,17 @@ kvtop (const caddr_t va)
extern int (*cpu_desidhash) __P((void));
void delay __P((u_int us));
void hppa_init __P((paddr_t start));
void trap __P((int type, struct trapframe *frame));
int dma_cachectl __P((caddr_t p, int size));
int spcopy __P((pa_space_t ssp, const void *src,
pa_space_t dsp, void *dst, size_t size));
int spstrcpy __P((pa_space_t ssp, const void *src,
pa_space_t dsp, void *dst, size_t size, size_t *rsize));
void delay __P((u_int));
void hppa_init __P((paddr_t));
void trap __P((int, struct trapframe *));
int dma_cachectl __P((caddr_t, int));
int spcopy __P((pa_space_t, const void *,
pa_space_t, void *, size_t));
int spstrcpy __P((pa_space_t, const void *,
pa_space_t, void *, size_t, size_t *));
int copy_on_fault __P((void));
void switch_trampoline __P((void));
void switch_exit __P((struct proc *p));
void switch_exit __P((struct lwp *, void (*)(struct lwp *)));
int cpu_dumpsize __P((void));
int cpu_dump __P((void));
#endif

View File

@ -1,9 +1,14 @@
# $NetBSD: files.hppa,v 1.2 2002/06/06 19:50:20 fredette Exp $
# $NetBSD: files.hppa,v 1.3 2003/08/31 01:26:34 chs Exp $
#
# $OpenBSD: files.hppa,v 1.31 2001/06/26 02:41:25 mickey Exp $
#
# hppa-specific configuration info
# Processor type options.
defflag opt_cputype.h HP7000_CPU HP7100_CPU HP7150_CPU HP7100LC_CPU
HP7200_CPU HP7250_CPU HP7300LC_CPU
HP8000_CPU HP8200_CPU HP8500_CPU HP8600_CPU
file arch/hppa/hppa/db_interface.c ddb
file arch/hppa/hppa/db_disasm.c ddb
file arch/hppa/hppa/db_memrw.c ddb | kgdb

View File

@ -1,4 +1,4 @@
/* $NetBSD: copy.S,v 1.1 2002/06/05 01:04:19 fredette Exp $ */
/* $NetBSD: copy.S,v 1.2 2003/08/31 01:26:34 chs Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@ -110,9 +110,9 @@
LEAF_ENTRY(name) ! \
ldil L%VM_MAXUSER_ADDRESS, t1 ! \
comb,>>= arg0, t1, fusubadaddr ! \
ldil L%curproc, t1 ! \
ldw R%curproc(t1), t1 ! \
ldw P_ADDR(t1), t1 ! \
ldil L%curlwp, t1 ! \
ldw R%curlwp(t1), t1 ! \
ldw L_ADDR(t1), t1 ! \
ldil L%fusufault, t2 ! \
ldo R%fusufault(t2), t2 ! \
ldw U_PCB+PCB_ONFAULT(t1), t3 ! \
@ -167,9 +167,9 @@ EXIT(_copy_on_fault)
*/
LEAF_ENTRY(spstrcpy)
/* setup fault handler */
ldil L%curproc, r31
ldw R%curproc(r31), r31
ldw P_ADDR(r31), r31
ldil L%curlwp, r31
ldw R%curlwp(r31), r31
ldw L_ADDR(r31), r31
ldil L%_copy_on_fault, t2
ldo R%_copy_on_fault(t2), t2
stw t2, PCB_ONFAULT+U_PCB(r31)
@ -238,9 +238,9 @@ EXIT(name)
/* This loads curproc's space into the given register. */
#define SPACE_CURPROC(reg) \
ldil L%curproc, reg ! \
ldw R%curproc(reg), reg ! \
ldw P_ADDR(reg), reg ! \
ldil L%curlwp, reg ! \
ldw R%curlwp(reg), reg ! \
ldw L_ADDR(reg), reg ! \
ldw U_PCB+PCB_SPACE(reg), reg
/* This loads the kernel's space into the given register. */

View File

@ -1,4 +1,4 @@
/* $NetBSD: db_disasm.c,v 1.2 2003/07/15 02:29:39 lukem Exp $ */
/* $NetBSD: db_disasm.c,v 1.3 2003/08/31 01:26:34 chs Exp $ */
/* $OpenBSD: db_disasm.c,v 1.9 2000/04/18 20:02:45 mickey Exp $ */
@ -51,7 +51,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.2 2003/07/15 02:29:39 lukem Exp $");
__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.3 2003/08/31 01:26:34 chs Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -1248,8 +1248,8 @@ static int
iExInit(void)
{
static int unasm_initted = 0;
register const struct inst *i;
register struct majoropcode *m;
const struct inst *i;
struct majoropcode *m;
u_int shft, mask;
if (unasm_initted)
@ -1554,7 +1554,7 @@ ldDasm(i, ofs, w)
OFS ofs;
int w;
{
register int d = Disp(w);
int d = Disp(w);
char s[2];
s[1] = '\0';
@ -1583,7 +1583,7 @@ stDasm(i, ofs, w)
OFS ofs;
int w;
{
register int d = Disp(w);
int d = Disp(w);
char s[2];
db_printf("\t%%r%d,",Rta(w));
@ -1611,7 +1611,7 @@ ldxDasm(i, ofs, w)
OFS ofs;
int w;
{
register const char *p;
const char *p;
if (ShortDisp(w)) {
db_printf("s");
@ -1647,7 +1647,7 @@ stsDasm(i, ofs, w)
OFS ofs;
int w;
{
register const char *p;
const char *p;
if (Modify(w))
db_printf(",m%s", ModBefore(w)? "b":"a");
@ -1672,7 +1672,7 @@ stbysDasm(i, ofs, w)
OFS ofs;
int w;
{
register const char *p;
const char *p;
db_printf(ModBefore(w)? ",e":",b");
if (Modify(w))
db_printf(",m");
@ -1709,8 +1709,8 @@ blDasm(i, ofs, w)
OFS ofs;
int w;
{
register OFS tgtofs = ofs + 8 + Bdisp(w);
register u_int link = Rtb(w);
OFS tgtofs = ofs + 8 + Bdisp(w);
u_int link = Rtb(w);
if (link && !Match("gate"))
db_printf("l");
@ -1755,8 +1755,8 @@ beDasm(i, ofs, w)
OFS ofs;
int w;
{
register int d = Bdisp(w);
register const char *p;
int d = Bdisp(w);
const char *p;
char s[2];
s[1] = '\0';
@ -1780,7 +1780,7 @@ cbDasm(i, ofs, w)
OFS ofs;
int w;
{
register OFS tgtofs = ofs + 8 + Cbdisp(w);
OFS tgtofs = ofs + 8 + Cbdisp(w);
if (Match("movb"))
db_printf(edDCond(Cond(w)));
@ -1800,7 +1800,7 @@ cbiDasm(i, ofs, w)
OFS ofs;
int w;
{
register OFS tgtofs = ofs + 8 + Cbdisp(w);
OFS tgtofs = ofs + 8 + Cbdisp(w);
if (Match("movib"))
db_printf(edDCond(Cond(w)));
@ -1820,8 +1820,8 @@ bbDasm(i, ofs, w)
OFS ofs;
int w;
{
register OFS tgtofs = ofs + 8 + Cbdisp(w);
register const char *p;
OFS tgtofs = ofs + 8 + Cbdisp(w);
const char *p;
db_printf(edDCond(Cond(w)));
p = Nu(w)? ",n":"";
@ -1962,7 +1962,7 @@ floatDasm(i, ofs, w)
OFS ofs;
int w;
{
register u_int op1, r1, fmt, t;
u_int op1, r1, fmt, t;
u_int op2, r2, dfmt;
char *p;
@ -2065,8 +2065,8 @@ fcoprDasm(w, op1, op2)
int w;
u_int op1, op2;
{
register u_int r1, r2, t, fmt, dfmt;
register char *p;
u_int r1, r2, t, fmt, dfmt;
char *p;
if (AstNu(w) && op1 == ((1<<4) | 2)) {
if (op2 == 0 || op2 == 1 || op2 == 2) {
@ -2148,10 +2148,10 @@ coprDasm(i, ofs, w)
OFS ofs;
int w;
{
register u_int uid = Uid(w);
register int load = 0;
register char *pfx = uid > 1 ? "c" : "f";
register int dreg;
u_int uid = Uid(w);
int load = 0;
char *pfx = uid > 1 ? "c" : "f";
int dreg;
if (Match("copr")) {
if (uid) {
@ -2197,7 +2197,7 @@ coprDasm(i, ofs, w)
case PREFETCH: db_printf(",p"); break;
}
if (load) {
register const char *p;
const char *p;
if (dreg)
p = fdreg[(Rtc(w)<<1)+(uid&1)];
@ -2213,7 +2213,7 @@ coprDasm(i, ofs, w)
else
db_printf("(%%r%d),%%f%s",Rsb(w), p);
} else {
register const char *p;
const char *p;
if (dreg)
p = fdreg[(Rsc(w)<<1)+(uid&1)];
@ -2313,7 +2313,7 @@ fmpyaddDasm(i, ofs, w)
OFS ofs;
int w;
{
register const char
const char
*ms1 = SinglePrec(w) ? fsreg[Ms1(w)] : fdreg[Ms1(w)],
*ms2 = SinglePrec(w) ? fsreg[Ms2(w)] : fdreg[Ms2(w)],
*mt = SinglePrec(w) ? fsreg[Mt(w)] : fdreg[Mt(w)],
@ -2335,9 +2335,9 @@ db_disasm(loc, flag)
vaddr_t loc;
boolean_t flag;
{
register const struct inst *i;
register const struct majoropcode *m;
register u_int ext;
const struct inst *i;
const struct majoropcode *m;
u_int ext;
int instruct;
OFS ofs = 0;

View File

@ -1,4 +1,4 @@
/* $NetBSD: db_memrw.c,v 1.2 2003/07/15 02:29:39 lukem Exp $ */
/* $NetBSD: db_memrw.c,v 1.3 2003/08/31 01:26:34 chs Exp $ */
/* $OpenBSD: db_interface.c,v 1.16 2001/03/22 23:31:45 mickey Exp $ */
@ -33,7 +33,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: db_memrw.c,v 1.2 2003/07/15 02:29:39 lukem Exp $");
__KERNEL_RCSID(0, "$NetBSD: db_memrw.c,v 1.3 2003/08/31 01:26:34 chs Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -52,7 +52,7 @@ db_read_bytes(addr, size, data)
size_t size;
char *data;
{
register char *src = (char*)addr;
char *src = (char *)addr;
while (size--)
*data++ = *src++;
@ -64,7 +64,7 @@ db_write_bytes(addr, size, data)
size_t size;
char *data;
{
register char *dst = (char *)addr;
char *dst = (char *)addr;
extern int etext;
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: fpu.c,v 1.1 2002/06/05 01:04:20 fredette Exp $ */
/* $NetBSD: fpu.c,v 1.2 2003/08/31 01:26:34 chs Exp $ */
/*
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@ -41,7 +41,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.1 2002/06/05 01:04:20 fredette Exp $");
__KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.2 2003/08/31 01:26:34 chs Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -215,22 +215,23 @@ hppa_fpu_bootstrap(u_int ccr_enable)
}
/*
* If the given process has its state in the FPU,
* flush that state out into the process' PCB.
* If the given LWP has its state in the FPU,
* flush that state out into the LWP's PCB.
*/
void
hppa_fpu_flush(struct proc *p)
hppa_fpu_flush(struct lwp *l)
{
struct trapframe *tf = p->p_md.md_regs;
struct trapframe *tf = l->l_md.md_regs;
/*
* If we have a hardware FPU, and this process'
* state is currently in it, swap it out.
*/
* If we have a hardware FPU, and this process'
* state is currently in it, swap it out.
*/
if (fpu_present &&
fpu_cur_uspace != NULL &&
fpu_cur_uspace == tf->tf_cr30)
hppa_fpu_swap(p->p_addr, NULL);
hppa_fpu_swap(l->l_addr, NULL);
}
#ifdef FPEMUL
@ -238,9 +239,9 @@ hppa_fpu_flush(struct proc *p)
/*
* This emulates a coprocessor load/store instruction.
*/
static int hppa_fpu_ls __P((struct trapframe *, struct proc *));
static int hppa_fpu_ls __P((struct trapframe *, struct lwp *));
static int
hppa_fpu_ls(struct trapframe *frame, struct proc *p)
hppa_fpu_ls(struct trapframe *frame, struct lwp *l)
{
u_int inst, inst_b, inst_x, inst_s, inst_t;
int log2size;
@ -270,14 +271,14 @@ hppa_fpu_ls(struct trapframe *frame, struct proc *p)
* The space must be the user's space, else we
* segfault.
*/
if (inst_s != p->p_addr->u_pcb.pcb_space)
if (inst_s != l->l_addr->u_pcb.pcb_space)
return (EFAULT);
/* See whether or not this is a doubleword load/store. */
log2size = (inst & OPCODE_DOUBLE) ? 3 : 2;
/* Get the floating point register. */
fpreg = ((caddr_t) p->p_addr->u_pcb.pcb_fpregs) + (inst_t << log2size);
fpreg = ((caddr_t)l->l_addr->u_pcb.pcb_fpregs) + (inst_t << log2size);
/* Get the base register. */
base = FRAME_REG(frame, inst_b, r0);
@ -344,7 +345,7 @@ hppa_fpu_ls(struct trapframe *frame, struct proc *p)
* This is called to emulate an instruction.
*/
void
hppa_fpu_emulate(struct trapframe *frame, struct proc *p)
hppa_fpu_emulate(struct trapframe *frame, struct lwp *l)
{
u_int inst, opcode, class, sub;
u_int *fpregs;
@ -354,7 +355,7 @@ hppa_fpu_emulate(struct trapframe *frame, struct proc *p)
* If the process' state is in any hardware FPU,
* flush it out - we need to operate on it.
*/
hppa_fpu_flush(p);
hppa_fpu_flush(l);
/*
* Get the instruction that we're emulating,
@ -375,15 +376,15 @@ hppa_fpu_emulate(struct trapframe *frame, struct proc *p)
: "=r" (opcode), "=r" (class), "=r" (sub)
: "r" (inst));
/* Get this process' FPU registers. */
fpregs = (u_int *) p->p_addr->u_pcb.pcb_fpregs;
/* Get this LWP's FPU registers. */
fpregs = (u_int *) l->l_addr->u_pcb.pcb_fpregs;
/* Dispatch on the opcode. */
switch (opcode) {
case 0x09:
case 0x0b:
if (hppa_fpu_ls(frame, p) != 0)
trapsignal(p, SIGSEGV, frame->tf_iioq_head);
if (hppa_fpu_ls(frame, l) != 0)
trapsignal(l, SIGSEGV, frame->tf_iioq_head);
return;
case 0x0c:
exception = decode_0c(inst, class, sub, fpregs);
@ -403,7 +404,7 @@ hppa_fpu_emulate(struct trapframe *frame, struct proc *p)
}
if (exception)
trapsignal(p, (exception & UNIMPLEMENTEDEXCEPTION) ?
trapsignal(l, (exception & UNIMPLEMENTEDEXCEPTION) ?
SIGILL : SIGFPE, frame->tf_iioq_head);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: hppa_machdep.c,v 1.2 2003/07/15 02:29:39 lukem Exp $ */
/* $NetBSD: hppa_machdep.c,v 1.3 2003/08/31 01:26:35 chs Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@ -34,9 +34,12 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: hppa_machdep.c,v 1.2 2003/07/15 02:29:39 lukem Exp $");
__KERNEL_RCSID(0, "$NetBSD: hppa_machdep.c,v 1.3 2003/08/31 01:26:35 chs Exp $");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/sa.h>
#include <sys/savar.h>
/* the following is used externally (sysctl_hw) */
char machine_arch[] = MACHINE_ARCH; /* from <machine/param.h> */
@ -46,3 +49,29 @@ char machine_arch[] = MACHINE_ARCH; /* from <machine/param.h> */
* probably be moved here from hp700/hp700/machdep.c, seeing
* that there's related code already in hppa/hppa/trap.S.
*/
/*
* cpu_upcall:
*
* Send an an upcall to userland.
*/
void
cpu_upcall(struct lwp *l, int type, int nevents, int ninterrupted,
void *sas, void *ap, void *sp, sa_upcall_t upcall)
{
printf("cpu_upcall not implemented\n");
}
void
cpu_getmcontext(struct lwp *l, mcontext_t *mcp, unsigned int *flags)
{
printf("cpu_getmcontext not implemented\n");
}
int
cpu_setmcontext(struct lwp *l, const mcontext_t *mcp, unsigned int flags)
{
printf("cpu_setmcontext not implemented\n");
return 0;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: in_cksum.c,v 1.2 2003/07/15 02:29:39 lukem Exp $ */
/* $NetBSD: in_cksum.c,v 1.3 2003/08/31 01:26:35 chs Exp $ */
/* $OpenBSD: in_cksum.c,v 1.1 2001/01/13 00:00:20 mickey Exp $ */
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: in_cksum.c,v 1.2 2003/07/15 02:29:39 lukem Exp $");
__KERNEL_RCSID(0, "$NetBSD: in_cksum.c,v 1.3 2003/08/31 01:26:35 chs Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -81,15 +81,15 @@ __KERNEL_RCSID(0, "$NetBSD: in_cksum.c,v 1.2 2003/07/15 02:29:39 lukem Exp $");
int
in_cksum(m, len)
register struct mbuf *m;
register int len;
struct mbuf *m;
int len;
{
register u_int sum = 0;
register u_int bins = 0;
u_int sum = 0;
u_int bins = 0;
for (; m && len; m = m->m_next) {
register int mlen = m->m_len;
register u_char *w;
int mlen = m->m_len;
u_char *w;
if (!mlen)
continue;

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.h,v 1.4 2002/08/25 20:19:59 fredette Exp $ */
/* $NetBSD: machdep.h,v 1.5 2003/08/31 01:26:35 chs Exp $ */
/*
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@ -78,8 +78,8 @@ extern u_int fpu_version;
extern u_int fpu_csw;
extern paddr_t fpu_cur_uspace;
void hppa_fpu_bootstrap __P((u_int));
void hppa_fpu_flush __P((struct proc *));
void hppa_fpu_emulate __P((struct trapframe *, struct proc *));
void hppa_fpu_flush __P((struct lwp *));
void hppa_fpu_emulate __P((struct trapframe *, struct lwp *));
/* Interrupt dispatching. */
extern u_int hppa_intr_depth;

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap.c,v 1.9 2003/07/15 02:29:39 lukem Exp $ */
/* $NetBSD: pmap.c,v 1.10 2003/08/31 01:26:35 chs Exp $ */
/*-
* Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@ -171,7 +171,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.9 2003/07/15 02:29:39 lukem Exp $");
__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.10 2003/08/31 01:26:35 chs Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -869,8 +869,8 @@ pmap_bootstrap(vstart, vend)
mtctl(addr, CR_VTOP);
hpt_base = addr;
hpt_mask = size;
proc0.p_md.md_regs->tf_hptm = size;
proc0.p_md.md_regs->tf_vtop = addr;
lwp0.l_md.md_regs->tf_hptm = size;
lwp0.l_md.md_regs->tf_vtop = addr;
addr += size + 1;
/* Allocate the struct pv_head array. */
@ -1196,7 +1196,7 @@ static void
pmap_pinit(pmap)
pmap_t pmap;
{
register u_int pid;
u_int pid;
int s;
PMAP_PRINTF(PDB_PMAP, ("(%p), pid=%x\n", pmap, pmap->pmap_pid));
@ -1239,7 +1239,7 @@ pmap_pinit(pmap)
pmap_t
pmap_create()
{
register pmap_t pmap;
pmap_t pmap;
int s;
PMAP_PRINTF(PDB_PMAP, ("()"));
@ -1303,19 +1303,20 @@ pmap_destroy(pmap)
}
/*
* pmap_activate(proc)
* Activates the vmspace for the given process. This
* pmap_activate(lwp)
* Activates the vmspace for the given LWP. This
* isn't necessarily the current process.
*/
void
pmap_activate(struct proc *p)
pmap_activate(struct lwp *l)
{
struct proc *p = l->l_proc;
pmap_t pmap = p->p_vmspace->vm_map.pmap;
pa_space_t space = pmap->pmap_space;
struct trapframe *tf = p->p_md.md_regs;
struct trapframe *tf = l->l_md.md_regs;
/* space is cached for the copy{in,out}'s pleasure */
p->p_addr->u_pcb.pcb_space = space;
l->l_addr->u_pcb.pcb_space = space;
/* Load all of the user's space registers. */
tf->tf_sr0 = tf->tf_sr1 = tf->tf_sr2 = tf->tf_sr3 =
@ -1349,7 +1350,7 @@ pmap_enter(pmap, va, pa, prot, flags)
vm_prot_t prot;
int flags;
{
register struct pv_entry *pv;
struct pv_entry *pv;
u_int tlbpage, tlbprot;
pa_space_t space;
boolean_t waswired;
@ -1434,12 +1435,12 @@ pmap_enter(pmap, va, pa, prot, flags)
*/
void
pmap_remove(pmap, sva, eva)
register pmap_t pmap;
register vaddr_t sva;
register vaddr_t eva;
pmap_t pmap;
vaddr_t sva;
vaddr_t eva;
{
register struct pv_entry *pv;
register pa_space_t space;
struct pv_entry *pv;
pa_space_t space;
int s;
PMAP_PRINTF(PDB_REMOVE, ("(%p, %p, %p)\n",
@ -1480,9 +1481,9 @@ pmap_page_protect(pg, prot)
struct vm_page *pg;
vm_prot_t prot;
{
register struct pv_entry *pv, *pv_next;
register pmap_t pmap;
register u_int tlbprot;
struct pv_entry *pv, *pv_next;
pmap_t pmap;
u_int tlbprot;
paddr_t pa = VM_PAGE_TO_PHYS(pg);
int s;
@ -1555,7 +1556,7 @@ pmap_protect(pmap, sva, eva, prot)
vaddr_t eva;
vm_prot_t prot;
{
register struct pv_entry *pv;
struct pv_entry *pv;
u_int tlbprot;
pa_space_t space;
int s;
@ -1669,7 +1670,7 @@ pmap_extract(pmap, va, pap)
*/
void
pmap_zero_page(pa)
register paddr_t pa;
paddr_t pa;
{
struct pv_entry *pv;
int s;
@ -1801,7 +1802,7 @@ boolean_t
pmap_clear_modify(pg)
struct vm_page *pg;
{
register paddr_t pa = VM_PAGE_TO_PHYS(pg);
paddr_t pa = VM_PAGE_TO_PHYS(pg);
boolean_t ret = pmap_clear_bit(pa, TLB_DIRTY);
PMAP_PRINTF(PDB_BITS, ("(%p) = %d\n", (caddr_t)pa, ret));
return ret;
@ -1816,7 +1817,7 @@ boolean_t
pmap_is_modified(pg)
struct vm_page *pg;
{
register paddr_t pa = VM_PAGE_TO_PHYS(pg);
paddr_t pa = VM_PAGE_TO_PHYS(pg);
boolean_t ret = pmap_test_bit(pa, TLB_DIRTY);
PMAP_PRINTF(PDB_BITS, ("(%p) = %d\n", (caddr_t)pa, ret));
return ret;
@ -1834,7 +1835,7 @@ boolean_t
pmap_clear_reference(pg)
struct vm_page *pg;
{
register paddr_t pa = VM_PAGE_TO_PHYS(pg);
paddr_t pa = VM_PAGE_TO_PHYS(pg);
boolean_t ret = pmap_clear_bit(pa, TLB_REF);
PMAP_PRINTF(PDB_BITS, ("(%p) = %d\n", (caddr_t)pa, ret));
return ret;
@ -1849,7 +1850,7 @@ boolean_t
pmap_is_referenced(pg)
struct vm_page *pg;
{
register paddr_t pa = VM_PAGE_TO_PHYS(pg);
paddr_t pa = VM_PAGE_TO_PHYS(pg);
boolean_t ret = pmap_test_bit(pa, TLB_REF);
PMAP_PRINTF(PDB_BITS, ("(%p) = %d\n", (caddr_t)pa, ret));
return ret;
@ -1894,7 +1895,7 @@ pmap_kremove(va, size)
vaddr_t va;
vsize_t size;
{
register struct pv_entry *pv;
struct pv_entry *pv;
int s;
#ifdef PMAPDEBUG
int opmapdebug = pmapdebug;
@ -1970,8 +1971,8 @@ pmap_redzone(vaddr_t sva, vaddr_t eva, int create)
void
pmap_hptdump()
{
register struct hpt_entry *hpt, *ehpt;
register struct pv_entry *pv;
struct hpt_entry *hpt, *ehpt;
struct pv_entry *pv;
mfctl(CR_HPTMASK, ehpt);
mfctl(CR_VTOP, hpt);

View File

@ -1,4 +1,4 @@
/* $NetBSD: proc_subr.S,v 1.1 2002/06/05 01:04:20 fredette Exp $ */
/* $NetBSD: proc_subr.S,v 1.2 2003/08/31 01:26:35 chs Exp $ */
/* $OpenBSD: locore.S,v 1.46 2001/09/20 18:33:03 mickey Exp $ */
@ -77,18 +77,22 @@
.import sched_whichqs, data
.import sched_qs, data
/*
* setrunqueue(struct proc *p);
* setrunqueue(struct lwp *l);
* Insert a process on the appropriate queue. Should be called at splclock().
*/
.align 32
ENTRY(setrunqueue,0)
#ifdef DIAGNOSTIC
ldw P_BACK(arg0), t1
ldi 0x1f01, arg2
ldw L_BACK(arg0), t1
comb,<>,n r0, t1, $setrunqueue_panic
ldw P_WCHAN(arg0), t1
ldi 0x1f02, arg2
ldw L_WCHAN(arg0), t1
comb,<>,n r0, t1, $setrunqueue_panic
ldb P_STAT(arg0), t1
comib,=,n SRUN, t1, $setrunqueue_ok
ldi 0x1f03, arg2
ldw L_STAT(arg0), t1
copy t1, arg3
comib,=,n LSRUN, t1, $setrunqueue_ok
$setrunqueue_panic
copy arg0, arg1
ldil L%panic, r1
@ -100,12 +104,12 @@ $setrunqueue_panic
bv,n %r0(r1)
nop
Lsrqpstr
.asciz "setrunqueue(%p)"
.asciz "setrunqueue(%p) case 0x%x 0x%x"
.align 8
$setrunqueue_ok
#endif
ldb P_PRIORITY(arg0), t2
ldb L_PRIORITY(arg0), t2
ldil L%sched_qs, t4
extru t2, 29, 5, t1 /* t1 = (priority / 4); (queue #) */
ldo R%sched_qs(t4), t4
@ -129,24 +133,24 @@ $setrunqueue_ok
bv,n %r0(r1)
nop
#endif
ldw P_BACK(t4), t2
stw t4, P_FORW(arg0)
stw arg0, P_BACK(t4)
stw arg0, P_FORW(t2)
ldw L_BACK(t4), t2
stw t4, L_FORW(arg0)
stw arg0, L_BACK(t4)
stw arg0, L_FORW(t2)
bv 0(rp)
stw t2, P_BACK(arg0)
stw t2, L_BACK(arg0)
Lsrqfmt
.asciz "setrunqueue: bit=%x, sched_qs=%p\n"
.align 8
EXIT(setrunqueue)
/*
* remrunqueue(struct proc *p);
* remrunqueue(struct lwp *l);
* Remove a process from its queue. Should be called at splclock().
*/
.align 32
ENTRY(remrunqueue,0)
ldb P_PRIORITY(arg0), t2
ldb L_PRIORITY(arg0), t2
extru t2, 29, 5, t1 /* t1 = (priority / 4); (queue #) */
mtsar t1
ldil L%sched_whichqs, t2
@ -171,11 +175,11 @@ Lrrqpstr
.align 8
remrunqueue_ok
#endif
ldw P_BACK(arg0), t4
stw r0, P_BACK(arg0)
ldw P_FORW(arg0), arg0
stw arg0, P_FORW(t4)
stw t4, P_BACK(arg0)
ldw L_BACK(arg0), t4
stw r0, L_BACK(arg0)
ldw L_FORW(arg0), arg0
stw arg0, L_FORW(t4)
stw t4, L_BACK(arg0)
comb,<> t4, arg0, Lqnempty
nop

View File

@ -1,4 +1,4 @@
/* $NetBSD: process_machdep.c,v 1.2 2003/07/15 02:29:41 lukem Exp $ */
/* $NetBSD: process_machdep.c,v 1.3 2003/08/31 01:26:35 chs Exp $ */
/* $OpenBSD: process_machdep.c,v 1.3 1999/06/18 05:19:52 mickey Exp $ */
@ -33,7 +33,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: process_machdep.c,v 1.2 2003/07/15 02:29:41 lukem Exp $");
__KERNEL_RCSID(0, "$NetBSD: process_machdep.c,v 1.3 2003/08/31 01:26:35 chs Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -42,59 +42,48 @@ __KERNEL_RCSID(0, "$NetBSD: process_machdep.c,v 1.2 2003/07/15 02:29:41 lukem Ex
#include <sys/user.h>
int
process_read_regs(p, regs)
struct proc *p;
struct reg *regs;
process_read_regs(struct lwp *l, struct reg *regs)
{
bcopy (p->p_md.md_regs, regs, sizeof(*regs));
bcopy(l->l_md.md_regs, regs, sizeof(*regs));
regs->r_regs[0] = 0;
return 0;
}
int
process_write_regs(p, regs)
struct proc *p;
struct reg *regs;
process_write_regs(struct lwp *l, struct reg *regs)
{
bcopy (&regs[1], &p->p_md.md_regs->tf_r1, sizeof(*regs) - sizeof(*regs));
bcopy(&regs[1], &l->l_md.md_regs->tf_r1,
sizeof(*regs) - sizeof(*regs));
return 0;
}
int
process_read_fpregs(p, fpregs)
struct proc *p;
struct fpreg *fpregs;
process_read_fpregs(struct lwp *l, struct fpreg *fpregs)
{
bcopy (p->p_addr->u_pcb.pcb_fpregs, fpregs, sizeof(*fpregs));
bcopy(l->l_addr->u_pcb.pcb_fpregs, fpregs, sizeof(*fpregs));
return 0;
}
int
process_write_fpregs(p, fpregs)
struct proc *p;
struct fpreg *fpregs;
process_write_fpregs(struct lwp *l, struct fpreg *fpregs)
{
bcopy (fpregs, p->p_addr->u_pcb.pcb_fpregs, sizeof(*fpregs));
bcopy(fpregs, l->l_addr->u_pcb.pcb_fpregs, sizeof(*fpregs));
return 0;
}
int
process_sstep(p, sstep)
struct proc *p;
int sstep;
process_sstep(struct lwp *l, int sstep)
{
/* TODO */
return EINVAL;
}
int
process_set_pc(p, addr)
struct proc *p;
caddr_t addr;
process_set_pc(struct lwp *l, caddr_t addr)
{
if (!USERMODE(addr)) /* XXX */
return EINVAL;
p->p_md.md_regs->tf_iioq_head = (register_t)addr;
l->l_md.md_regs->tf_iioq_head = (register_t)addr;
return 0;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: sig_machdep.c,v 1.4 2003/08/07 16:27:51 agc Exp $ */
/* $NetBSD: sig_machdep.c,v 1.5 2003/08/31 01:26:36 chs Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@ -111,7 +111,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: sig_machdep.c,v 1.4 2003/08/07 16:27:51 agc Exp $");
__KERNEL_RCSID(0, "$NetBSD: sig_machdep.c,v 1.5 2003/08/31 01:26:36 chs Exp $");
#include "opt_compat_netbsd.h"
@ -126,6 +126,7 @@ __KERNEL_RCSID(0, "$NetBSD: sig_machdep.c,v 1.4 2003/08/07 16:27:51 agc Exp $");
#include <sys/signalvar.h>
#include <sys/mount.h>
#include <sys/sa.h>
#include <sys/syscallargs.h>
#include <machine/cpu.h>
@ -148,7 +149,8 @@ sendsig(sig, mask, code)
sigset_t *mask;
u_long code;
{
struct proc *p = curproc;
struct lwp *l = curlwp;
struct proc *p = l->l_proc;
struct sigacts *ps = p->p_sigacts;
struct sigframe *fp, kf;
caddr_t sp;
@ -156,7 +158,7 @@ sendsig(sig, mask, code)
int onstack, fsize;
sig_t catcher = SIGACTION(p, sig).sa_handler;
tf = (struct trapframe *)p->p_md.md_regs;
tf = (struct trapframe *)l->l_md.md_regs;
/* Do we need to jump onto the signal stack? */
onstack =
@ -224,7 +226,7 @@ sendsig(sig, mask, code)
* Process has trashed its stack; give it an illegal
* instruction to halt it in its tracks.
*/
sigexit(p, SIGILL);
sigexit(l, SIGILL);
/* NOTREACHED */
}
#ifdef DEBUG
@ -252,7 +254,7 @@ sendsig(sig, mask, code)
default:
/* Don't know what trampoline version; kill it. */
sigexit(p, SIGILL);
sigexit(l, SIGILL);
}
tf->tf_sp = (int)sp;
@ -274,14 +276,15 @@ sendsig(sig, mask, code)
}
int
sys___sigreturn14(p, v, retval)
struct proc *p;
sys___sigreturn14(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
struct sys___sigreturn14_args /* {
syscallarg(struct sigcontext *) sigcntxp;
} */ *uap = v;
struct proc *p = l->l_proc;
struct sigcontext *scp;
struct trapframe *tf;
struct sigcontext tsigc;
@ -314,7 +317,7 @@ sys___sigreturn14(p, v, retval)
return (EINVAL);
/* Restore register context. */
tf = (struct trapframe *) p->p_md.md_regs;
tf = (struct trapframe *)l->l_md.md_regs;
/*
* Grab pointer to hardware state information.

View File

@ -1,4 +1,4 @@
/* $NetBSD: trap.S,v 1.6 2003/06/23 11:01:16 martin Exp $ */
/* $NetBSD: trap.S,v 1.7 2003/08/31 01:26:36 chs Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@ -100,6 +100,7 @@
*/
#include "opt_compat_osf1.h"
#include "opt_cputype.h"
/*
* NOTICE: This is not a standalone file. To use it, #include it in
@ -200,7 +201,7 @@ gateway_page_end
$syscall
/*
*
* t1: curproc
* t1: curlwp
* t2: user
* t3: args
* t4: user stack
@ -211,9 +212,9 @@ $syscall
* the whole context later on return anyway.
* XXXXXX this is very bad. everything must be saved
*/
ldil L%curproc, t3
ldw R%curproc(sr1, t3), t3
ldw P_ADDR(sr1, t3), t2 /* XXX can use ,sl */
ldil L%curlwp, t3
ldw R%curlwp(sr1, t3), t3
ldw L_ADDR(sr1, t3), t2 /* XXX can use ,sl */
/* calculate kernel sp, load, create kernel stack frame */
/*
@ -386,9 +387,9 @@ $syscall
bv,n 0(r1)
nop
ldil L%curproc, r1
ldw R%curproc(r1), r1
ldw P_MD(r1), t3
ldil L%curlwp, r1
ldw R%curlwp(r1), r1
ldw L_MD(r1), t3
.exit
.procend
@ -1904,7 +1905,7 @@ ENTRY(TLABEL(all),0)
* Set up the kernel stack pointer. If the trap happened
* while we were in unprivileged code, or in privileged
* code in the SYSCALLGATE page, move to the kernel stack
* in curproc's PCB; otherwise, start a new stack frame
* in curlwp's PCB; otherwise, start a new stack frame
* on whatever kernel stack we're already on.
*
* This used to check only for a trap while we were in
@ -2161,18 +2162,18 @@ $trapnowvirt
nop
ldw -HPPA_FRAME_SIZE+4(sp), t3
/* see if curproc have changed */
/* see if curlwp has changed */
ldw TF_FLAGS(t3), arg0
bb,>=,n arg0, TFF_LAST_POS, $trap_return
nop
/* see if curproc have really changed */
ldil L%curproc, t1
ldw R%curproc(t1), t2
/* see if curlwp has really changed */
ldil L%curlwp, t1
ldw R%curlwp(t1), t2
comb,=,n r0, t2, $trap_return
/* means curproc have actually changed */
ldw P_MD(t2), t3
/* means curlwp has actually changed */
ldw L_MD(t2), t3
$trap_return
ldil L%$syscall_return, t1

View File

@ -1,4 +1,4 @@
/* $NetBSD: trap.c,v 1.8 2003/07/15 02:29:41 lukem Exp $ */
/* $NetBSD: trap.c,v 1.9 2003/08/31 01:26:36 chs Exp $ */
/*-
* Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@ -69,7 +69,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.8 2003/07/15 02:29:41 lukem Exp $");
__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.9 2003/08/31 01:26:36 chs Exp $");
/* #define INTRDEBUG */
/* #define TRAPDEBUG */
@ -96,6 +96,7 @@ __KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.8 2003/07/15 02:29:41 lukem Exp $");
#include <sys/acct.h>
#include <sys/signal.h>
#include <sys/device.h>
#include <sys/pool.h>
#include <net/netisr.h>
@ -185,34 +186,35 @@ u_int rctr_next_iioq;
#endif
static __inline void
userret (struct proc *p, register_t pc, u_quad_t oticks)
userret (struct lwp *l, register_t pc, u_quad_t oticks)
{
struct proc *p = l->l_proc;
int sig;
/* take pending signals */
while ((sig = CURSIG(p)) != 0)
while ((sig = CURSIG(l)) != 0)
postsig(sig);
p->p_priority = p->p_usrpri;
l->l_priority = l->l_usrpri;
if (want_resched) {
/*
* We're being preempted.
*/
preempt(NULL);
while ((sig = CURSIG(p)) != 0)
while ((sig = CURSIG(l)) != 0)
postsig(sig);
}
/*
* If profiling, charge recent system time to the trapped pc.
*/
if (p->p_flag & P_PROFIL) {
if (l->l_flag & P_PROFIL) {
extern int psratio;
addupc_task(p, pc, (int)(p->p_sticks - oticks) * psratio);
}
curcpu()->ci_schedstate.spc_curpriority = p->p_priority;
curcpu()->ci_schedstate.spc_curpriority = l->l_priority;
}
/*
@ -344,10 +346,11 @@ user_backtrace_raw(u_int pc, u_int fp)
printf(" backtrace stopped with pc %08x fp 0x%08x\n", pc, fp);
}
static void user_backtrace __P((struct trapframe *, struct proc *, int));
static void user_backtrace __P((struct trapframe *, struct lwp *, int));
static void
user_backtrace(struct trapframe *tf, struct proc *p, int type)
user_backtrace(struct trapframe *tf, struct lwp *l, int type)
{
struct proc *p = l->l_proc;
u_int pc, fp, inst;
/*
@ -401,11 +404,11 @@ user_backtrace(struct trapframe *tf, struct proc *p, int type)
* with some documented elsewhere, some not.
*/
struct trapframe *sanity_frame;
struct proc *sanity_proc;
struct lwp *sanity_lwp;
int sanity_checked = 0;
void frame_sanity_check __P((struct trapframe *, struct proc *));
void frame_sanity_check __P((struct trapframe *, struct lwp *));
void
frame_sanity_check(struct trapframe *tf, struct proc *p)
frame_sanity_check(struct trapframe *tf, struct lwp *l)
{
extern int kernel_text;
extern int etext;
@ -417,7 +420,7 @@ frame_sanity_check(struct trapframe *tf, struct proc *p)
do { \
if (sanity_frame == NULL && !(e)) { \
sanity_frame = tf; \
sanity_proc = p; \
sanity_lwp = l; \
sanity_checked = __LINE__; \
} \
} while (/* CONSTCOND */ 0)
@ -443,20 +446,20 @@ do { \
#else
uspace_size = USPACE;
#endif
SANITY(p == NULL ||
((tf->tf_sp >= (u_int)(p->p_addr) + PAGE_SIZE &&
tf->tf_sp < (u_int)(p->p_addr) + uspace_size)));
SANITY(l == NULL ||
((tf->tf_sp >= (u_int)(l->l_addr) + PAGE_SIZE &&
tf->tf_sp < (u_int)(l->l_addr) + uspace_size)));
}
} else {
SANITY(USERMODE(tf->tf_iioq_head));
SANITY(USERMODE(tf->tf_iioq_tail));
SANITY(p != NULL && tf->tf_cr30 == kvtop((caddr_t)p->p_addr));
SANITY(l != NULL && tf->tf_cr30 == kvtop((caddr_t)l->l_addr));
}
#undef SANITY
if (sanity_frame == tf) {
(void) trap_kdebug(T_IBREAK, 0, tf);
sanity_frame = NULL;
sanity_proc = NULL;
sanity_lwp = NULL;
sanity_checked = 0;
}
}
@ -467,13 +470,14 @@ trap(type, frame)
int type;
struct trapframe *frame;
{
struct proc *p = curproc;
struct lwp *l = curlwp;
struct proc *p = l->l_proc;
struct pcb *pcbp;
register vaddr_t va;
register struct vm_map *map;
vaddr_t va;
struct vm_map *map;
struct vmspace *vm;
register vm_prot_t vftype;
register pa_space_t space;
vm_prot_t vftype;
pa_space_t space;
u_int opcode;
int ret;
const char *tts;
@ -528,7 +532,7 @@ trap(type, frame)
#endif /* DIAGNOSTIC */
#ifdef DEBUG
frame_sanity_check(frame, p);
frame_sanity_check(frame, l);
#endif /* DEBUG */
/* If this is a trap, not an interrupt, reenable interrupts. */
@ -536,7 +540,7 @@ trap(type, frame)
mtctl(frame->tf_eiem, CR_EIEM);
if (frame->tf_flags & TFF_LAST)
p->p_md.md_regs = frame;
l->l_md.md_regs = frame;
if ((type & ~T_USER) > trap_types)
tts = "reserved";
@ -604,13 +608,13 @@ trap(type, frame)
case T_EMULATION | T_USER:
#ifdef FPEMUL
hppa_fpu_emulate(frame, p);
hppa_fpu_emulate(frame, l);
#else /* !FPEMUL */
/*
* We don't have FPU emulation, so signal the
* process with a SIGFPE.
*/
trapsignal(p, SIGFPE, frame->tf_iioq_head);
trapsignal(l, SIGFPE, frame->tf_iioq_head);
#endif /* !FPEMUL */
break;
@ -631,9 +635,9 @@ trap(type, frame)
dead_end:
if (type & T_USER) {
#ifdef DEBUG
user_backtrace(frame, p, type);
user_backtrace(frame, l, type);
#endif
trapsignal(p, SIGILL, frame->tf_iioq_head);
trapsignal(l, SIGILL, frame->tf_iioq_head);
break;
}
if (trap_kdebug(type, va, frame))
@ -650,11 +654,11 @@ trap(type, frame)
break;
case T_EXCEPTION | T_USER: /* co-proc assist trap */
trapsignal(p, SIGFPE, va);
trapsignal(l, SIGFPE, va);
break;
case T_OVERFLOW | T_USER:
trapsignal(p, SIGFPE, va);
trapsignal(l, SIGFPE, va);
break;
case T_CONDITION | T_USER:
@ -662,34 +666,34 @@ trap(type, frame)
case T_ILLEGAL | T_USER:
#ifdef DEBUG
user_backtrace(frame, p, type);
user_backtrace(frame, l, type);
#endif
trapsignal(p, SIGILL, va);
trapsignal(l, SIGILL, va);
break;
case T_PRIV_OP | T_USER:
#ifdef DEBUG
user_backtrace(frame, p, type);
user_backtrace(frame, l, type);
#endif
trapsignal(p, SIGILL, va);
trapsignal(l, SIGILL, va);
break;
case T_PRIV_REG | T_USER:
#ifdef DEBUG
user_backtrace(frame, p, type);
user_backtrace(frame, l, type);
#endif
trapsignal(p, SIGILL, va);
trapsignal(l, SIGILL, va);
break;
/* these should never got here */
case T_HIGHERPL | T_USER:
case T_LOWERPL | T_USER:
trapsignal(p, SIGSEGV, va);
trapsignal(l, SIGSEGV, va);
break;
case T_IPROT | T_USER:
case T_DPROT | T_USER:
trapsignal(p, SIGSEGV, va);
trapsignal(l, SIGSEGV, va);
break;
case T_DATACC: case T_USER | T_DATACC:
@ -756,15 +760,15 @@ trap(type, frame)
printf("trapsignal: uvm_fault(%p, %x, %d, %d)=%d\n",
map, (u_int)va, 0, vftype, ret);
#ifdef DEBUG
user_backtrace(frame, p, type);
user_backtrace(frame, l, type);
#endif
trapsignal(p, SIGSEGV, frame->tf_ior);
trapsignal(l, SIGSEGV, frame->tf_ior);
} else {
if (p && p->p_addr->u_pcb.pcb_onfault) {
if (l && l->l_addr->u_pcb.pcb_onfault) {
#ifdef PMAPDEBUG
printf("trap: copyin/out %d\n",ret);
#endif
pcbp = &p->p_addr->u_pcb;
pcbp = &l->l_addr->u_pcb;
frame->tf_iioq_tail = 4 +
(frame->tf_iioq_head =
pcbp->pcb_onfault);
@ -784,9 +788,9 @@ if (trap_kdebug (type, va, frame))
case T_DATALIGN | T_USER:
#ifdef DEBUG
user_backtrace(frame, p, type);
user_backtrace(frame, l, type);
#endif
trapsignal(p, SIGBUS, va);
trapsignal(l, SIGBUS, va);
break;
case T_INTERRUPT:
@ -823,12 +827,12 @@ if (trap_kdebug (type, va, frame))
}
if (type & T_USER)
userret(p, p->p_md.md_regs->tf_iioq_head, 0);
userret(l, l->l_md.md_regs->tf_iioq_head, 0);
#ifdef DEBUG
frame_sanity_check(frame, p);
if (frame->tf_flags & TFF_LAST && curproc != NULL)
frame_sanity_check(curproc->p_md.md_regs, curproc);
frame_sanity_check(frame, l);
if (frame->tf_flags & TFF_LAST && curlwp != NULL)
frame_sanity_check(curlwp->l_md.md_regs, curlwp);
#endif /* DEBUG */
}
@ -836,15 +840,16 @@ void
child_return(arg)
void *arg;
{
struct proc *p = arg;
struct lwp *l = arg;
struct proc *p = l->l_proc;
userret(p, p->p_md.md_regs->tf_iioq_head, 0);
userret(l, l->l_md.md_regs->tf_iioq_head, 0);
#ifdef KTRACE
if (KTRPOINT(p, KTR_SYSRET))
ktrsysret(p, SYS_fork, 0, 0);
#endif
#ifdef DEBUG
frame_sanity_check(p->p_md.md_regs, p);
frame_sanity_check(l->l_md.md_regs, l);
#endif /* DEBUG */
}
@ -860,8 +865,9 @@ syscall(frame, args)
struct trapframe *frame;
int *args;
{
register struct proc *p;
register const struct sysent *callp;
struct lwp *l;
struct proc *p;
const struct sysent *callp;
int nsys, code, argsize, error;
int tmp;
int rval[2];
@ -869,14 +875,15 @@ syscall(frame, args)
uvmexp.syscalls++;
#ifdef DEBUG
frame_sanity_check(frame, curproc);
frame_sanity_check(frame, curlwp);
#endif /* DEBUG */
if (!USERMODE(frame->tf_iioq_head))
panic("syscall");
p = curproc;
p->p_md.md_regs = frame;
l = curlwp;
p = l->l_proc;
l->l_md.md_regs = frame;
nsys = p->p_emul->e_nsysent;
callp = p->p_emul->e_sysent;
code = frame->tf_t1;
@ -1068,15 +1075,15 @@ syscall(frame, args)
callp += code;
argsize = callp->sy_argsize;
if ((error = trace_enter(p, code, code, NULL, args, rval)) != 0)
if ((error = trace_enter(l, code, code, NULL, args, rval)) != 0)
goto bad;
rval[0] = 0;
rval[1] = 0;
switch (error = (*callp->sy_call)(p, args, rval)) {
switch (error = (*callp->sy_call)(l, args, rval)) {
case 0:
p = curproc; /* changes on exec() */
frame = p->p_md.md_regs;
l = curlwp; /* changes on exec() */
frame = l->l_md.md_regs;
frame->tf_ret0 = rval[0];
frame->tf_ret1 = rval[1];
frame->tf_t1 = 0;
@ -1114,10 +1121,41 @@ syscall(frame, args)
break;
}
trace_exit(p, code, args, rval, error);
trace_exit(l, code, args, rval, error);
userret(p, frame->tf_iioq_head, 0);
userret(l, frame->tf_iioq_head, 0);
#ifdef DEBUG
frame_sanity_check(frame, p);
frame_sanity_check(frame, l);
#endif /* DEBUG */
}
/*
* Start a new LWP
*/
void
startlwp(arg)
void *arg;
{
int err;
ucontext_t *uc = arg;
struct lwp *l = curlwp;
err = cpu_setmcontext(l, &uc->uc_mcontext, uc->uc_flags);
#if DIAGNOSTIC
if (err) {
printf("Error %d from cpu_setmcontext.", err);
}
#endif
pool_put(&lwp_uc_pool, uc);
userret(l, l->l_md.md_regs->tf_iioq_head, 0);
}
/*
* XXX This is a terrible name.
*/
void
upcallret(struct lwp *l)
{
userret(l, l->l_md.md_regs->tf_iioq_head, 0);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: vm_machdep.c,v 1.4 2003/07/15 02:29:41 lukem Exp $ */
/* $NetBSD: vm_machdep.c,v 1.5 2003/08/31 01:26:36 chs Exp $ */
/* $OpenBSD: vm_machdep.c,v 1.25 2001/09/19 20:50:56 mickey Exp $ */
@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.4 2003/07/15 02:29:41 lukem Exp $");
__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.5 2003/08/31 01:26:36 chs Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -60,12 +60,13 @@ __KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.4 2003/07/15 02:29:41 lukem Exp $")
* Dump the machine specific header information at the start of a core dump.
*/
int
cpu_coredump(p, vp, cred, core)
struct proc *p;
cpu_coredump(l, vp, cred, core)
struct lwp *l;
struct vnode *vp;
struct ucred *cred;
struct core *core;
{
struct proc *p = l->l_proc;
struct md_coredump md_core;
struct coreseg cseg;
off_t off;
@ -76,7 +77,7 @@ cpu_coredump(p, vp, cred, core)
core->c_seghdrsize = ALIGN(sizeof(cseg));
core->c_cpusize = sizeof(md_core);
process_read_regs(p, &md_core.md_reg);
process_read_regs(l, &md_core.md_reg);
CORE_SETMAGIC(cseg, CORESEGMAGIC, MID_ZERO, CORE_CPU);
cseg.c_addr = 0;
@ -104,7 +105,7 @@ cpu_coredump(p, vp, cred, core)
*/
void
pagemove(from, to, size)
register caddr_t from, to;
caddr_t from, to;
size_t size;
{
paddr_t pa;
@ -127,44 +128,44 @@ pagemove(from, to, size)
}
void
cpu_swapin(p)
struct proc *p;
cpu_swapin(l)
struct lwp *l;
{
struct trapframe *tf = p->p_md.md_regs;
struct trapframe *tf = l->l_md.md_regs;
/*
* Stash the physical for the pcb of U for later perusal
*/
p->p_addr->u_pcb.pcb_uva = (vaddr_t)p->p_addr;
tf->tf_cr30 = kvtop((caddr_t)p->p_addr);
fdcache(HPPA_SID_KERNEL, (vaddr_t)p->p_addr, sizeof(p->p_addr->u_pcb));
l->l_addr->u_pcb.pcb_uva = (vaddr_t)l->l_addr;
tf->tf_cr30 = kvtop((caddr_t)l->l_addr);
fdcache(HPPA_SID_KERNEL, (vaddr_t)l->l_addr, sizeof(l->l_addr->u_pcb));
#ifdef HPPA_REDZONE
/* Create the kernel stack red zone. */
pmap_redzone((vaddr_t)p->p_addr + HPPA_REDZONE,
(vaddr_t)p->p_addr + USPACE, 1);
pmap_redzone((vaddr_t)l->l_addr + HPPA_REDZONE,
(vaddr_t)l->l_addr + USPACE, 1);
#endif
}
void
cpu_swapout(p)
struct proc *p;
cpu_swapout(l)
struct lwp *l;
{
/* Flush this process out of the FPU. */
hppa_fpu_flush(p);
/* Flush this LWP out of the FPU. */
hppa_fpu_flush(l);
}
void
cpu_fork(p1, p2, stack, stacksize, func, arg)
struct proc *p1, *p2;
cpu_lwp_fork(l1, l2, stack, stacksize, func, arg)
struct lwp *l1, *l2;
void *stack;
size_t stacksize;
void (*func) __P((void *));
void *arg;
{
register struct pcb *pcbp;
register struct trapframe *tf;
struct pcb *pcbp;
struct trapframe *tf;
register_t sp, osp;
#ifdef DIAGNOSTIC
@ -173,25 +174,25 @@ cpu_fork(p1, p2, stack, stacksize, func, arg)
#endif
/* Flush the parent process out of the FPU. */
hppa_fpu_flush(p1);
hppa_fpu_flush(l1);
/* Now copy the parent PCB into the child. */
pcbp = &p2->p_addr->u_pcb;
bcopy(&p1->p_addr->u_pcb, pcbp, sizeof(*pcbp));
pcbp = &l2->l_addr->u_pcb;
bcopy(&l1->l_addr->u_pcb, pcbp, sizeof(*pcbp));
sp = (register_t)p2->p_addr + PAGE_SIZE;
p2->p_md.md_regs = tf = (struct trapframe *)sp;
sp = (register_t)l2->l_addr + PAGE_SIZE;
l2->l_md.md_regs = tf = (struct trapframe *)sp;
sp += sizeof(struct trapframe);
bcopy(p1->p_md.md_regs, tf, sizeof(*tf));
bcopy(l1->l_md.md_regs, tf, sizeof(*tf));
/*
* cpu_swapin() is supposed to fill out all the PAs
* we gonna need in locore
*/
cpu_swapin(p2);
cpu_swapin(l2);
/* Activate this process' pmap. */
pmap_activate(p2);
pmap_activate(l2);
/*
* theoretically these could be inherited from the father,
@ -205,7 +206,7 @@ cpu_fork(p1, p2, stack, stacksize, func, arg)
/*
* Set up return value registers as libc:fork() expects
*/
tf->tf_ret0 = p1->p_pid;
tf->tf_ret0 = l1->l_proc->p_pid;
tf->tf_ret1 = 1; /* ischild */
tf->tf_t1 = 0; /* errno */
@ -227,7 +228,13 @@ cpu_fork(p1, p2, stack, stacksize, func, arg)
*(register_t*)(sp + HPPA_FRAME_CRP) =
(register_t)switch_trampoline;
tf->tf_sp = sp;
fdcache(HPPA_SID_KERNEL, (vaddr_t)p2->p_addr, sp - (vaddr_t)p2->p_addr);
fdcache(HPPA_SID_KERNEL, (vaddr_t)l2->l_addr, sp - (vaddr_t)l2->l_addr);
}
void
cpu_setfunc(struct lwp *l, void (*func)(void *), void *arg)
{
printf("cpu_setfunc not implemented\n");
}
#if 0
@ -250,16 +257,16 @@ cpu_set_kpc(p, pc, arg)
#endif
void
cpu_exit(p)
struct proc *p;
cpu_exit(l, proc)
struct lwp *l;
int proc;
{
(void) splsched();
uvmexp.swtch++;
/* Flush the process out of the FPU. */
hppa_fpu_flush(p);
curproc = NULL;
switch_exit(p);
/* Flush the LWP out of the FPU. */
hppa_fpu_flush(l);
switch_exit(l, proc ? exit2 : lwp_exit2);
}
#if 0

View File

@ -1,10 +1,10 @@
/* $NetBSD: float.h,v 1.2 2003/04/19 23:05:30 christos Exp $ */
/* $NetBSD: float.h,v 1.3 2003/08/31 01:26:37 chs Exp $ */
#ifndef _HPPA_FLOAT_H_
#define _HPPA_FLOAT_H_
#define FLT_ROUNDS 1
#define LDBL_MANT_DIG 113
#include <sys/math_ieee.h>
#include <sys/float_ieee754.h>
#endif /* _HPPA_FLOAT_H_ */

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap.h,v 1.3 2002/09/22 07:53:42 chs Exp $ */
/* $NetBSD: pmap.h,v 1.4 2003/08/31 01:26:37 chs Exp $ */
/* $OpenBSD: pmap.h,v 1.14 2001/05/09 15:31:24 art Exp $ */
@ -129,7 +129,7 @@ do { if (pmap) { \
#define pmap_release(pmap)
#define pmap_copy(dpmap,spmap,da,len,sa)
#define pmap_update(p)
void pmap_activate __P((struct proc *));
void pmap_activate __P((struct lwp *));
#define pmap_deactivate(p)
#define pmap_phys_address(x) ((x) << PGSHIFT)

View File

@ -1,4 +1,4 @@
/* $NetBSD: proc.h,v 1.2 2003/08/07 16:27:52 agc Exp $ */
/* $NetBSD: proc.h,v 1.3 2003/08/31 01:26:37 chs Exp $ */
/* $OpenBSD: proc.h,v 1.1 1998/07/07 21:32:44 mickey Exp $ */
@ -33,13 +33,20 @@
* @(#)proc.h 7.1 (Berkeley) 5/15/91
*/
#ifndef _HPPA_PROC_H_
#define _HPPA_PROC_H_
/*
* Machine-dependent part of the proc structure for hppa.
*/
struct mdproc {
struct mdlwp {
struct trapframe *md_regs; /* registers on current frame */
int md_flags; /* machine-dependent flags */
};
struct mdproc {
};
/* md_flags */
#endif /* _HPPA_PROC_H_ */

View File

@ -1,4 +1,4 @@
/* $NetBSD: psl.h,v 1.1 2002/06/05 01:04:23 fredette Exp $ */
/* $NetBSD: psl.h,v 1.2 2003/08/31 01:26:37 chs Exp $ */
/* $OpenBSD: psl.h,v 1.6 1999/11/25 18:29:01 mickey Exp $ */
@ -95,7 +95,7 @@
#define PSW_R (1 << (31-PSW_R_POS)) /* Recover Counter Enable */
#define PSW_Q (1 << (31-PSW_Q_POS)) /* Interrupt State Collection Enable */
#define PSW_P (1 << (31-PSW_P_POS)) /* Protection Identifier Validation Enable */
#define PSW_D (1 << (31-PSW_D_POS)) /* Data Adress Translation Enable */
#define PSW_D (1 << (31-PSW_D_POS)) /* Data Address Translation Enable */
#define PSW_I (1 << (31-PSW_I_POS)) /* External Interrupt, Power Failure
Interrupt, and Low-Priority Machine
Check Interrupt unmask */

View File

@ -1,4 +1,4 @@
/* $NetBSD: float.h,v 1.1 2002/06/05 01:04:25 fredette Exp $ */
/* $NetBSD: float.h,v 1.2 2003/08/31 01:26:38 chs Exp $ */
/* $OpenBSD: float.h,v 1.4 2001/03/29 03:58:18 mickey Exp $ */
@ -40,6 +40,7 @@
* suitability of this software for any purpose.
*/
#include <sys/types.h>
#include <machine/float.h>
#include "../spmath/fpbits.h"
@ -354,8 +355,6 @@ typedef struct dint dbl_integer;
#define QUAD_P 113
/* Boolean Values etc. */
#define FALSE 0
#define TRUE (!FALSE)
#define NOT !
#define XOR ^

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.h,v 1.1 2002/06/05 01:04:26 fredette Exp $ */
/* $NetBSD: md.h,v 1.2 2003/08/31 01:26:38 chs Exp $ */
/* $OpenBSD: md.h,v 1.4 2001/03/29 03:58:18 mickey Exp $ */
@ -42,6 +42,7 @@
*/
#include <sys/cdefs.h>
#include <sys/types.h>
/*****************************************************************
* Muliply/Divide SFU Internal State *
@ -60,12 +61,6 @@ struct mdsfu_register {
* Constants
*/
#undef FALSE
#define FALSE 0
#undef TRUE
#define TRUE (!FALSE)
#undef NIL
#define NIL 0