Some more 64-bit cleanup. Now everything compiles.

This commit is contained in:
eeh 1998-08-30 15:32:16 +00:00
parent 3af18e2765
commit 26d2d906c7
25 changed files with 482 additions and 277 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: sbus.c,v 1.3 1998/08/13 02:10:42 eeh Exp $ */
/* $NetBSD: sbus.c,v 1.4 1998/08/30 15:32:16 eeh Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -672,11 +672,11 @@ sbus_remove(sc, va, len)
}
#ifdef DEBUG
if (sbusdebug & SDB_DVMA)
printf("sbus_remove: flushed va %p TSB[%x]@%p=%x:%x\n",
(int)va, (int)IOTSBSLOT(va,sc->sc_tsbsize),
(int)&sc->sc_tsb[IOTSBSLOT(va,sc->sc_tsbsize)],
(int)((sc->sc_tsb[IOTSBSLOT(va,sc->sc_tsbsize)])>>32),
(int)(sc->sc_tsb[IOTSBSLOT(va,sc->sc_tsbsize)]));
printf("sbus_remove: flushed va %p TSB[%x]@%p=%lx:%lx\n",
(long)va, (int)IOTSBSLOT(va,sc->sc_tsbsize),
(long)&sc->sc_tsb[IOTSBSLOT(va,sc->sc_tsbsize)],
(long)((sc->sc_tsb[IOTSBSLOT(va,sc->sc_tsbsize)])>>32),
(long)(sc->sc_tsb[IOTSBSLOT(va,sc->sc_tsbsize)]));
#endif
sc->sc_tsb[IOTSBSLOT(va,sc->sc_tsbsize)] = 0;
#if 0
@ -722,7 +722,7 @@ sbus_flush(sc)
while( !sc->sc_flush && flushtimeout > tick()) membar_sync();
#ifdef DIAGNOSTIC
if( !sc->sc_flush )
printf("sbus_remove: flush timeout %x at %x:%x\n", (int)sc->sc_flush,
printf("sbus_remove: flush timeout %p at %x:%x\n", (long)sc->sc_flush,
(int)(sc->sc_flushpa>>32), (int)sc->sc_flushpa); /* panic? */
#endif
return (sc->sc_flush);

View File

@ -1,4 +1,4 @@
/* $NetBSD: bus.h,v 1.3 1998/08/13 02:10:44 eeh Exp $ */
/* $NetBSD: bus.h,v 1.4 1998/08/30 15:32:17 eeh Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@ -73,6 +73,7 @@
#include <machine/types.h>
#include <machine/ctlreg.h>
#include <sparc64/asm.h>
/*
* UPA and SBUS spaces are non-cached and big endian

View File

@ -1,4 +1,4 @@
/* $NetBSD: db_machdep.h,v 1.2 1998/08/13 02:10:44 eeh Exp $ */
/* $NetBSD: db_machdep.h,v 1.3 1998/08/30 15:32:17 eeh Exp $ */
/*
* Mach Operating System
@ -48,7 +48,7 @@ typedef long db_expr_t; /* expression - signed */
#if 1
typedef struct {
struct trapframe ddb_tf;
struct frame ddb_fr;
struct frame64 ddb_fr;
} db_regs_t;
#else
struct trapregs {

View File

@ -1,4 +1,4 @@
/* $NetBSD: frame.h,v 1.1.1.1 1998/06/20 04:58:51 eeh Exp $ */
/* $NetBSD: frame.h,v 1.2 1998/08/30 15:32:17 eeh Exp $ */
/*
* Copyright (c) 1992, 1993
@ -53,7 +53,7 @@
* windows to the stack.
*/
#ifndef _LOCORE
struct frame {
struct frame32 {
int fr_local[8]; /* space to save locals (%l0..%l7) */
int fr_arg[6]; /* space to save arguments (%i0..%i5) */
struct frame *fr_fp; /* space to save frame pointer (%i6) */

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap.h,v 1.4 1998/08/27 06:23:31 eeh Exp $ */
/* $NetBSD: pmap.h,v 1.5 1998/08/30 15:32:17 eeh Exp $ */
/*-
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
@ -154,7 +154,7 @@ int pmap_count_res __P((pmap_t pmap));
#define pmap_resident_count(pm) pmap_count_res((pm))
#define pmap_phys_address(x) ((((paddr_t)(x))<<PGSHIFT)|PMAP_NC)
void pmap_bootstrap __P((u_int kernelstart, u_int kernelend, u_int numctx));
void pmap_bootstrap __P((u_long kernelstart, u_long kernelend, u_int numctx));
/* This needs to be implemented when we get a kernel map */
void pmap_changeprot __P((pmap_t pmap, vaddr_t start, vm_prot_t prot, int size));

View File

@ -1,4 +1,4 @@
/* $NetBSD: psl.h,v 1.3 1998/07/28 04:44:52 eeh Exp $ */
/* $NetBSD: psl.h,v 1.4 1998/08/30 15:32:17 eeh Exp $ */
/*
* Copyright (c) 1992, 1993
@ -135,13 +135,19 @@
#define PSTATE_BITS "\20\14IG\13MG\12CLE\11TLE\10\7MM\6RED\5PEF\4AM\3PRIV\2IE\1AG"
#ifdef _LP64
#define PSTATE_PROM (PSTATE_MM_TSO|PSTATE_PRIV)
#define PSTATE_NUCLEUS (PSTATE_MM_TSO|PSTATE_PRIV|PSTATE_AG)
#define PSTATE_KERN (PSTATE_MM_TSO|PSTATE_PRIV)
#define PSTATE_INTR (PSTATE_KERN|PSTATE_IE)
#define PSTATE_USER32 (PSTATE_MM_TSO|PSTATE_AM|PSTATE_IE) /* It's easier to debug */
#define PSTATE_USER (PSTATE_MM_RMO|PSTATE_AM|PSTATE_IE)
#else
#define PSTATE_PROM (PSTATE_MM_TSO|PSTATE_PRIV)
#define PSTATE_NUCLEUS (PSTATE_MM_TSO|PSTATE_AM|PSTATE_PRIV|PSTATE_AG)
#define PSTATE_KERN (PSTATE_MM_TSO|PSTATE_AM|PSTATE_PRIV)
#define PSTATE_INTR (PSTATE_KERN|PSTATE_IE)
#ifdef DEBUG
#define PSTATE_USER (PSTATE_MM_TSO|PSTATE_AM|PSTATE_IE) /* It's easier to debug */
#else
#define PSTATE_USER32 (PSTATE_MM_TSO|PSTATE_AM|PSTATE_IE) /* It's easier to debug */
#define PSTATE_USER (PSTATE_MM_RMO|PSTATE_AM|PSTATE_IE)
#endif
@ -216,6 +222,11 @@
#define KERN_MM PSTATE_MM_TSO
#define USER_MM PSTATE_MM_RMO
/*
* Register window handlers. These point to generic routines that check the
* stack pointer and then vector to the real handler. We could optimize this
* if we could guarantee only 32-bit or 64-bit stacks.
*/
#define WSTATE_KERN 026
#define WSTATE_USER 022

View File

@ -1,4 +1,4 @@
/* $NetBSD: types.h,v 1.5 1998/08/22 22:45:19 eeh Exp $ */
/* $NetBSD: types.h,v 1.6 1998/08/30 15:32:17 eeh Exp $ */
/*
* Copyright (c) 1992, 1993
@ -79,7 +79,9 @@ typedef unsigned long u_int64_t;
typedef long long int64_t;
typedef unsigned long long u_int64_t;
#endif
typedef int32_t register_t;
typedef long register_t;
typedef int32_t register32_t;
typedef int64_t register64_t;
/* NB: This should probably be if defined(_KERNEL) */
#if !defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)

View File

@ -1,4 +1,4 @@
/* $NetBSD: asm.h,v 1.2 1998/07/07 03:05:04 eeh Exp $ */
/* $NetBSD: asm.h,v 1.3 1998/08/30 15:32:17 eeh Exp $ */
/*
* Copyright (c) 1992, 1993
@ -123,7 +123,7 @@
"r" ((long long)(value)), "r" ((int)(loc)), "r" (asi)); \
})
#ifdef notyet
#ifdef _LP64
/* native load 64-bit int from alternate address space w/64-bit compiler*/
#define ldxa(loc, asi) ({ \
register long _lda_v; \
@ -143,7 +143,7 @@
})
#endif
#ifdef notyet
#ifdef _LP64
/* native store 64-bit int to alternate address space w/64-bit compiler*/
#define stxa(loc, asi, value) ({ \
__asm __volatile("wr %2,%%g0,%%asi; stxa %0,[%1]%%asi; membar #Sync" : : \
@ -168,12 +168,12 @@
#define membar_sync() __asm __volatile("membar #Sync" : :)
#ifdef notyet
#ifdef _LP64
/* read 64-bit %tick register */
#define tick() ({ \
register long _lda_v; \
__asm __volatile("rdpr %%tick, %0" : "=r" (_lda_) :); \
_lda_v; \
register long _tick_tmp; \
__asm __volatile("rdpr %%tick, %0" : "=r" (_tick_tmp) :); \
_tick_tmp; \
})
#else
/* native load 64-bit int from alternate address space w/32-bit compiler*/

View File

@ -1,4 +1,4 @@
/* $NetBSD: autoconf.c,v 1.3 1998/08/13 02:10:45 eeh Exp $ */
/* $NetBSD: autoconf.c,v 1.4 1998/08/30 15:32:17 eeh Exp $ */
/*
* Copyright (c) 1996
@ -854,7 +854,8 @@ void *
findzs(zs)
int zs;
{
register int node, addr, n;
int node, n;
unsigned long addr;
node = firstchild(findroot());
/* Ultras have zs on the sbus */

View File

@ -1,4 +1,4 @@
/* $NetBSD: clock.c,v 1.2 1998/08/13 02:10:45 eeh Exp $ */
/* $NetBSD: clock.c,v 1.3 1998/08/30 15:32:18 eeh Exp $ */
/*
* Copyright (c) 1992, 1993
@ -177,7 +177,7 @@ clock_map(bh, model)
struct clockreg *cl;
pmap_changeprot(pmap_kernel(), (vaddr_t)bh, VM_PROT_READ, 1);
cl = (struct clockreg *)((int)bh + CLK_MK48T08_OFF);
cl = (struct clockreg *)((long)bh + CLK_MK48T08_OFF);
return (cl);
}
@ -297,9 +297,9 @@ timerattach(parent, self, aux)
/* Get address property */
if (getpropA(ma->ma_node, "address", sizeof(*va),
&nreg, (void **)&va) == 0) {
timerreg_4u.t_timer = (struct timer_4u *)(int)va[0];
timerreg_4u.t_clrintr = (int64_t *)(int)va[1];
timerreg_4u.t_mapintr = (int64_t *)(int)va[2];
timerreg_4u.t_timer = (struct timer_4u *)(long)va[0];
timerreg_4u.t_clrintr = (int64_t *)(long)va[1];
timerreg_4u.t_mapintr = (int64_t *)(long)va[2];
} else {
/* Map the system timer -- Not an SBUS device */
if (bus_space_map2(ma->ma_bustag, 0,
@ -312,11 +312,11 @@ timerattach(parent, self, aux)
}
timerreg_4u.t_timer = (struct timer_4u *)
(TIMERREG_VA + (((int)ur[0].ur_paddr)&PGOFSET));
(TIMERREG_VA + (((long)ur[0].ur_paddr)&PGOFSET));
timerreg_4u.t_clrintr = (int64_t *)
(TIMERREG_VA + (((int)ur[1].ur_paddr)&PGOFSET));
(TIMERREG_VA + (((long)ur[1].ur_paddr)&PGOFSET));
timerreg_4u.t_mapintr = (int64_t *)
(TIMERREG_VA + (((int)ur[2].ur_paddr)&PGOFSET));
(TIMERREG_VA + (((long)ur[2].ur_paddr)&PGOFSET));
}
cnt = &(timerreg_4u.t_timer[0].t_count);

View File

@ -1,4 +1,4 @@
/* $NetBSD: db_interface.c,v 1.4 1998/08/27 06:23:31 eeh Exp $ */
/* $NetBSD: db_interface.c,v 1.5 1998/08/30 15:32:18 eeh Exp $ */
/*
* Mach Operating System
@ -187,10 +187,27 @@ kdb_trap(type, tf)
ddb_regs.ddb_tf = *tf;
/* We should do a proper copyin and xlate 64-bit stack frames, but... */
/* if (tf->tf_tstate & TSTATE_PRIV) { */
if ((unsigned)tf->tf_out[6] > (unsigned)KERNBASE) {
ddb_regs.ddb_fr = *(struct frame *)tf->tf_out[6];
if (tf->tf_out[6] & 1) {
if ((unsigned)(tf->tf_out[6] + BIAS) > (unsigned)KERNBASE)
ddb_regs.ddb_fr = *(struct frame64 *)(tf->tf_out[6] + BIAS);
else
copyin((caddr_t)(tf->tf_out[6] + BIAS), &ddb_regs.ddb_fr, sizeof(struct frame64));
} else {
copyin(tf->tf_out[6], &ddb_regs.ddb_fr, sizeof(struct frame));
struct frame32 tfr;
/* First get a local copy of the frame32 */
if ((unsigned)(tf->tf_out[6]) > (unsigned)KERNBASE)
tfr = *(struct frame32 *)tf->tf_out[6];
else
copyin((caddr_t)(tf->tf_out[6]), &tfr, sizeof(struct frame32));
/* Now copy each field from the 32-bit value to the 64-bit value */
for (i=0; i<8; i++)
ddb_regs.ddb_fr.fr_local[i] = tfr.fr_local[i];
for (i=0; i<6; i++)
ddb_regs.ddb_fr.fr_arg[i] = tfr.fr_arg[i];
ddb_regs.ddb_fr.fr_fp = (long)tfr.fr_fp;
ddb_regs.ddb_fr.fr_pc = tfr.fr_pc;
}
db_active++;
@ -252,7 +269,6 @@ db_write_bytes(addr, size, data)
register size_t size;
register char *data;
{
extern char etext[];
register char *dst;
dst = (char *)addr;
@ -331,22 +347,22 @@ db_dump_pmap(pm)
struct pmap* pm;
{
/* print all valid pages in the kernel pmap */
int i, j, k, n;
long i, j, k, n;
paddr_t *pdir, *ptbl;
/* Almost the same as pmap_collect() */
n = 0;
for (i=0; i<STSZ; i++) {
if((pdir = (paddr_t *)ldda(&pm->pm_segs[i], ASI_PHYS_CACHED))) {
if((pdir = (paddr_t *)ldxa(&pm->pm_segs[i], ASI_PHYS_CACHED))) {
db_printf("pdir %d at %x:\n", i, (long)pdir);
for (k=0; k<PDSZ; k++) {
if (ptbl = (paddr_t)ldda(&pdir[k], ASI_PHYS_CACHED)) {
if (ptbl = (paddr_t *)ldxa(&pdir[k], ASI_PHYS_CACHED)) {
db_printf("ptable %d:%d at %x:\n", i, k, (long)ptbl);
for (j=0; j<PTSZ; j++) {
int64_t data0, data1;
data0 = ldda(&ptbl[j], ASI_PHYS_CACHED);
data0 = ldxa(&ptbl[j], ASI_PHYS_CACHED);
j++;
data1 = ldda(&ptbl[j], ASI_PHYS_CACHED);
data1 = ldxa(&ptbl[j], ASI_PHYS_CACHED);
if (data0 || data1) {
db_printf("%p: %x:%x\t",
(i<<STSHIFT)|(k<<PDSHIFT)|((j-1)<<PTSHIFT),
@ -402,7 +418,7 @@ db_pmap_kernel(addr, have_addr, count, modif)
db_dump_pmap(&kernel_pmap_);
} else {
for (j=i=0; i<STSZ; i++) {
long seg = ldda(&kernel_pmap_.pm_segs[i], ASI_PHYS_CACHED);
long seg = (long)ldxa(&kernel_pmap_.pm_segs[i], ASI_PHYS_CACHED);
if (seg)
db_printf("seg %ld => %p%c", i, seg, (j++%4)?'\t':'\n');
}
@ -440,7 +456,7 @@ db_pmap_cmd(addr, have_addr, count, modif)
db_dump_pmap(pm);
} else {
for (i=0; i<STSZ; i++) {
long seg = ldda(&kernel_pmap_.pm_segs[i], ASI_PHYS_CACHED);
long seg = (long)ldxa(&kernel_pmap_.pm_segs[i], ASI_PHYS_CACHED);
if (seg)
db_printf("seg %ld => %p%c", i, seg, (j++%4)?'\t':'\n');
}
@ -611,7 +627,6 @@ db_setpcb(addr, have_addr, count, modif)
struct proc *p, *pp;
extern struct pcb *cpcb;
int i;
if (!have_addr) {
db_printf("What PID do you want to map in?\n");
@ -650,7 +665,6 @@ db_traptrace(addr, have_addr, count, modif)
int tsp;
int tpc;
} trap_trace[], trap_trace_end[];
extern int trap_trace_ptr;
int i, j;
if (have_addr) {
@ -692,7 +706,6 @@ db_dump_buf(addr, have_addr, count, modif)
char *modif;
{
struct buf *buf;
int i;
char * flagnames = "\20\034VFLUSH\033XXX\032WRITEINPROG\031WRITE\030WANTED"
"\027UAREA\026TAPE\025READ\024RAW\023PHYS\022PAGIN\021PAGET"
"\020NOCACHE\017LOCKED\016INVAL\015GATHERED\014ERROR\013EINTR"
@ -712,7 +725,7 @@ db_dump_buf(addr, have_addr, count, modif)
buf->b_dev, buf->b_un.b_addr);
db_printf("saveaddr:%p lblkno:%x blkno:%x iodone:%x",
buf->b_saveaddr, buf->b_lblkno, buf->b_blkno, buf->b_iodone);
db_printsym((int)buf->b_iodone, DB_STGY_PROC);
db_printsym((long)buf->b_iodone, DB_STGY_PROC);
db_printf("\nvp:%p dirtyoff:%x dirtyend:%x\n", buf->b_vp, buf->b_dirtyoff, buf->b_dirtyend);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: db_trace.c,v 1.2 1998/08/13 02:10:46 eeh Exp $ */
/* $NetBSD: db_trace.c,v 1.3 1998/08/30 15:32:18 eeh Exp $ */
/*
* Mach Operating System
@ -28,6 +28,7 @@
#include <sys/param.h>
#include <sys/proc.h>
#include <sys/systm.h>
#include <machine/db_machdep.h>
#include <ddb/db_access.h>
@ -49,7 +50,7 @@ db_stack_trace_cmd(addr, have_addr, count, modif)
db_expr_t count;
char *modif;
{
struct frame *frame;
vaddr_t frame;
boolean_t kernel_only = TRUE;
{
@ -63,44 +64,70 @@ db_stack_trace_cmd(addr, have_addr, count, modif)
count = 65535;
if (!have_addr)
frame = (struct frame *)DDB_TF->tf_out[6];
frame = (vaddr_t)DDB_TF->tf_out[6];
else
frame = (struct frame *)addr;
frame = (vaddr_t)addr;
while (count--) {
int i;
db_expr_t offset;
char *name;
db_addr_t pc;
int i;
db_expr_t offset;
char *name;
db_addr_t pc;
struct frame64 *f64;
struct frame32 *f32;
pc = frame->fr_pc;
if (!INKERNEL(pc))
break;
/*
* Switch to frame that contains arguments
*/
frame = frame->fr_fp;
if (!INKERNEL(frame))
break;
db_find_sym_and_offset(pc, &name, &offset);
if (name == NULL)
name = "?";
db_printf("%s(", name);
/*
* Print %i0..%i5, hope these still reflect the
* actual arguments somewhat...
*/
for (i=0; i < 5; i++)
db_printf("%x, ", frame->fr_arg[i]);
db_printf("%x) at ", frame->fr_arg[i]);
db_printsym(pc, DB_STGY_PROC);
db_printf("\n");
}
if (frame & 1) {
f64 = (struct frame64 *)(frame + BIAS);
pc = f64->fr_pc;
if (!INKERNEL(pc))
break;
/*
* Switch to frame that contains arguments
*/
frame = f64->fr_fp;
} else {
f32 = (struct frame32 *)(frame);
pc = f32->fr_pc;
if (!INKERNEL(pc))
break;
/*
* Switch to frame that contains arguments
*/
frame = (long)f32->fr_fp;
}
if (!INKERNEL(frame))
break;
db_find_sym_and_offset(pc, &name, &offset);
if (name == NULL)
name = "?";
db_printf("%s(", name);
if (frame & 1) {
f64 = (struct frame64 *)(frame + BIAS);
/*
* Print %i0..%i5, hope these still reflect the
* actual arguments somewhat...
*/
for (i=0; i < 5; i++)
db_printf("%lx, ", (long)f64->fr_arg[i]);
db_printf("%lx) at ", (long)f64->fr_arg[i]);
} else {
f32 = (struct frame32 *)(frame);
/*
* Print %i0..%i5, hope these still reflect the
* actual arguments somewhat...
*/
for (i=0; i < 5; i++)
db_printf("%x, ", f32->fr_arg[i]);
db_printf("%x) at ", f32->fr_arg[i]);
}
db_printsym(pc, DB_STGY_PROC);
db_printf("\n");
}
}
@ -121,8 +148,8 @@ db_dump_window(addr, have_addr, count, modif)
/* Traverse window stack */
for (i=0; i<addr && frame; i++) {
if (frame & 1)
frame = ((struct frame64 *)(frame + BIAS))->fr_fp;
else frame = ((struct frame *)frame)->fr_fp;
frame = (u_int64_t)((struct frame64 *)(frame + BIAS))->fr_fp;
else frame = (u_int64_t)((struct frame32 *)frame)->fr_fp;
}
db_printf("Window %x ", addr);
@ -152,7 +179,7 @@ u_int64_t frame;
db_printf("frame64 in user space not supported\n");
} else {
struct frame* f = (struct frame*)frame;
struct frame32* f = (struct frame32*)frame;
db_printf("frame %x locals, ins:\n", f);
if (INKERNEL(f)) {
@ -201,9 +228,9 @@ db_dump_stack(addr, have_addr, count, modif)
count = 65535;
if (!have_addr)
frame = (struct frame *)DDB_TF->tf_out[6];
frame = DDB_TF->tf_out[6];
else
frame = (struct frame *)addr;
frame = addr;
/* Traverse window stack */
oldframe = 0;
@ -220,18 +247,18 @@ db_dump_stack(addr, have_addr, count, modif)
db_printf("Window %x ", i);
db_print_window(frame - BIAS);
if (!INKERNEL(((struct frame64 *)(frame))))
frame = fuword(((vaddr_t)&((struct frame64 *)frame)->fr_fp)+4);
frame = fuword(((caddr_t)&((struct frame64 *)frame)->fr_fp)+4);
else
frame = ((struct frame64 *)frame)->fr_fp;
} else {
if (!INKERNEL(((struct frame *)frame))
if (!INKERNEL(((struct frame32 *)frame))
&& kernel_only) break;
db_printf("Window %x ", i);
db_print_window(frame);
if (!INKERNEL(((struct frame *)frame)))
frame = fuword(&((struct frame *)frame)->fr_fp);
if (!INKERNEL(((struct frame32 *)frame)))
frame = (u_int64_t)fuword(&((struct frame32 *)frame)->fr_fp);
else
frame = ((struct frame *)frame)->fr_fp;
frame = (u_int64_t)((struct frame32 *)frame)->fr_fp;
}
}
@ -245,7 +272,6 @@ db_dump_trap(addr, have_addr, count, modif)
db_expr_t count;
char *modif;
{
int i;
struct trapframe *tf;
/* Use our last trapframe? */

View File

@ -1,4 +1,4 @@
/* $NetBSD: disksubr.c,v 1.2 1998/06/20 05:58:05 mrg Exp $ */
/* $NetBSD: disksubr.c,v 1.3 1998/08/30 15:32:18 eeh Exp $ */
/*
* Copyright (c) 1994, 1995 Gordon W. Ross
@ -183,7 +183,7 @@ setdisklabel(olp, nlp, openmask, clp)
u_long openmask;
struct cpu_disklabel *clp;
{
register i;
register int i;
register struct partition *opp, *npp;
/* sanity clause */

View File

@ -1,4 +1,4 @@
/* $NetBSD: intr.c,v 1.7 1998/08/13 02:10:46 eeh Exp $ */
/* $NetBSD: intr.c,v 1.8 1998/08/30 15:32:18 eeh Exp $ */
/*
* Copyright (c) 1992, 1993
@ -111,7 +111,7 @@ strayintr(fp)
{
static int straytime, nstray;
int timesince;
int swallow_zsintrs;
static int swallow_zsintrs;
/* If we're in polled mode ignore spurious interrupts */
if (swallow_zsintrs) return;
@ -237,31 +237,9 @@ intr_establish(level, ih)
struct intrhand *ih;
{
register struct intrhand **p, *q;
#ifdef DIAGNOSTIC
register struct trapvec *tv;
register int displ;
#endif
int s;
s = splhigh();
#if 0
#ifdef DIAGNOSTIC
/* double check for legal hardware interrupt */
if ((level != 1 && level != 4 && level != 6) || CPU_ISSUN4M ) {
tv = &trapbase[T_L1INT - 1 + level];
displ = &sparc_interrupt[0] - &tv->tv_instr[1];
/* has to be `mov level,%l3; ba _sparc_interrupt; rdpsr %l0' */
if (tv->tv_instr[0] != I_MOVi(I_L3, level) ||
tv->tv_instr[1] != I_BA(0, displ) ||
tv->tv_instr[2] != I_RDPSR(I_L0))
panic("intr_establish(%d, %p)\n%x %x %x != %x %x %x",
level, ih,
tv->tv_instr[0], tv->tv_instr[1], tv->tv_instr[2],
I_MOVi(I_L3, level), I_BA(0, displ), I_RDPSR(I_L0));
}
#endif
#endif
/*
* This is O(N^2) for long chains, but chains are never long
* and we do want to preserve order.

View File

@ -2717,6 +2717,10 @@ datafault:
_ALIGN
2:
#endif
!! In the medium anywhere model %g4 points to the start of the data segment.
!! In our case we need to clear it before calling any C-code
clr %g4
/* Use trap type to see what handler to call */
cmp %o0, T_FIMMU_MISS
st %g4, [%sp + CC64FSZ + STKB + TF_Y] ! set tf.tf_y
@ -3017,6 +3021,10 @@ textfault:
brnz,pt %g7, 1b
dec 8, %g7
!! In the medium anywhere model %g4 points to the start of the data segment.
!! In our case we need to clear it before calling any C-code
clr %g4
/* Use trap type to see what handler to call */
flushw ! Get rid of any user windows so we don't deadlock
cmp %o0, T_FIMMU_MISS
@ -3119,6 +3127,10 @@ Lslowtrap_reenter:
CHKPT(%g2,%g3,0x24)
wrpr %g0, %g1, %tl ! Revert to kernel mode
#endif
!! In the medium anywhere model %g4 points to the start of the data segment.
!! In our case we need to clear it before calling any C-code
clr %g4
! flushw ! DEBUG
call _C_LABEL(trap) ! trap(type, pstate, pc, &tf)
wrpr %g0, PSTATE_INTR, %pstate ! traps on again
@ -3500,6 +3512,10 @@ syscall_setup:
stb %g5, [%sp + CC64FSZ + STKB + TF_PIL]
stb %g5, [%sp + CC64FSZ + STKB + TF_OLDPIL]
!! In the medium anywhere model %g4 points to the start of the data segment.
!! In our case we need to clear it before calling any C-code
clr %g4
! flushw ! DEBUG
! ldx [%sp + CC64FSZ + STKB + TF_G + ( 1*8)], %o0 ! (code)
call _C_LABEL(syscall) ! syscall(code, &tf, pc, suncompat)
@ -3689,7 +3705,7 @@ iv_halt:
*
* IRQ# = %tt - 0x40
*/
.comm _C_LABEL(intrhand), 15 * 4 ! intrhand[0..14]; 0 => error
.comm _C_LABEL(intrhand), 15 * PTRSZ ! intrhand[0..14]; 0 => error
.globl _C_LABEL(sparc_interrupt) ! This is for interrupt debugging
_C_LABEL(sparc_interrupt):
#ifdef TRAPS_USE_IG
@ -3730,6 +3746,10 @@ _C_LABEL(sparc_interrupt):
stx %g6, [%sp + CC64FSZ + STKB + TF_G + ( 6*8)]
stx %g7, [%sp + CC64FSZ + STKB + TF_G + ( 7*8)]
!! In the medium anywhere model %g4 points to the start of the data segment.
!! In our case we need to clear it before calling any C-code
clr %g4
flushw ! DEBUG
rd %y, %l6
#if defined(UVM)
@ -4749,20 +4769,15 @@ dostart:
SAVE; SAVE; SAVE; SAVE; SAVE; SAVE; SAVE; SAVE; SAVE; SAVE
restore;restore;restore;restore;restore;restore;restore;restore;restore;restore
set estack0 - CC64FSZ - 80, %l0 ! via syscall(boot_me_up) or somesuch
#ifdef _LP64
andn %l0, 0x0f, %l0 ! Needs to be 16-byte aligned
sub %l0, BIAS, %l0 ! and biased
#endif
save %g0, %l0, %sp
!!! Make sure our stack's OK.
SAVE; SAVE; SAVE; SAVE; SAVE; SAVE; SAVE; SAVE; SAVE; SAVE
restore;restore;restore;restore;restore;restore;restore;restore;restore;restore
#ifdef _LP64
/*
* This code sets up a proper v9 stack. We won't need it till we get a
* 64-bit kernel.
*/
set SA64(USRSTACK-CC64FSZ)-BIAS, %fp
set SA64(estack0-CC64FSZ)-BIAS, %sp
#endif
/*
* Step 3: clear BSS. This may just be paranoia; the boot
* loader might already do it for us; but what the hell.
@ -4782,7 +4797,7 @@ dostart:
sethi %hi(_C_LABEL(nwindows)), %o1 ! may as well tell everyone
st %o0, [%o1 + %lo(_C_LABEL(nwindows))]
#ifdef DEBUG
#if 0
/*
* Step 5: save prom configuration so we can panic properly.
*/
@ -4806,7 +4821,7 @@ dostart:
* Ready to run C code; finish bootstrap.
*/
set CTX_SECONDARY, %o1 ! Store -1 in the context register
set -1, %o2
sub %g0, 1, %o2
stxa %o2, [%o1] ASI_DMMU
membar #Sync
ldxa [%o1] ASI_DMMU, %o0 ! then read it back
@ -5628,6 +5643,7 @@ _C_LABEL(sigcode):
t ST_SYSCALL
_C_LABEL(esigcode):
#endif
#endif
#ifdef COMPAT_SVR4
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.6 1998/08/29 18:16:56 eeh Exp $ */
/* $NetBSD: machdep.c,v 1.7 1998/08/30 15:32:19 eeh Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@ -587,7 +587,7 @@ sendsig(catcher, sig, mask, code)
register struct sigacts *psp = p->p_sigacts;
register struct sigframe *fp;
register struct trapframe *tf;
register int addr, oonstack;
vaddr_t addr, oonstack;
struct rwindow32 *kwin, *oldsp, *newsp, /* DEBUG */tmpwin;
struct sigframe sf;
extern char sigcode[], esigcode[];
@ -599,7 +599,7 @@ sendsig(catcher, sig, mask, code)
#endif
tf = p->p_md.md_tf;
oldsp = (struct rwindow32 *)(int)tf->tf_out[6];
oldsp = (struct rwindow32 *)tf->tf_out[6];
oonstack = psp->ps_sigstk.ss_flags & SS_ONSTACK;
/*
* Compute new user stack addresses, subtract off
@ -612,7 +612,7 @@ sendsig(catcher, sig, mask, code)
psp->ps_sigstk.ss_flags |= SS_ONSTACK;
} else
fp = (struct sigframe *)oldsp;
fp = (struct sigframe *)((int)(fp - 1) & ~7);
fp = (struct sigframe *)((long)(fp - 1) & ~7);
#ifdef DEBUG
sigpid = p->p_pid;
@ -639,7 +639,7 @@ sendsig(catcher, sig, mask, code)
*/
sf.sf_sc.sc_onstack = oonstack;
sf.sf_sc.sc_mask = mask;
sf.sf_sc.sc_sp = (int)oldsp;
sf.sf_sc.sc_sp = (long)oldsp;
sf.sf_sc.sc_pc = tf->tf_pc;
sf.sf_sc.sc_npc = tf->tf_npc;
sf.sf_sc.sc_psr = TSTATECCR_TO_PSR(tf->tf_tstate); /* XXX */
@ -655,7 +655,7 @@ sendsig(catcher, sig, mask, code)
* joins seamlessly with the frame it was in when the signal occurred,
* so that the debugger and _longjmp code can back up through it.
*/
newsp = (struct rwindow32 *)((int)fp - sizeof(struct rwindow32));
newsp = (struct rwindow32 *)((vaddr_t)fp - sizeof(struct rwindow32));
write_user_windows();
#ifdef DEBUG
if ((sigdebug & SDB_KSTACK))
@ -678,7 +678,7 @@ sendsig(catcher, sig, mask, code)
#ifdef DEBUG
copyin(oldsp, &tmpwin, sizeof(tmpwin)) || copyout(&tmpwin, newsp, sizeof(tmpwin)) ||
#endif
suword(&(((union rwindow *)newsp)->v8.rw_in[6]), (u_int)oldsp)) {
suword(&(((union rwindow *)newsp)->v8.rw_in[6]), (vaddr_t)oldsp)) {
/*
* Process has trashed its stack; give it an illegal
* instruction to halt it in its tracks.
@ -710,16 +710,16 @@ sendsig(catcher, sig, mask, code)
*/
#ifdef COMPAT_SUNOS
if (psp->ps_usertramp & sigmask(sig)) {
addr = (int)catcher; /* user does his own trampolining */
addr = (vaddr_t)catcher; /* user does his own trampolining */
} else
#endif
{
addr = (int)PS_STRINGS - szsigcode;
tf->tf_global[1] = (int)catcher;
addr = (vaddr_t)PS_STRINGS - szsigcode;
tf->tf_global[1] = (vaddr_t)catcher;
}
tf->tf_pc = addr;
tf->tf_npc = addr + 4;
tf->tf_out[6] = (u_int64_t)(int)newsp;
tf->tf_out[6] = (register64_t)newsp;
#ifdef DEBUG
if ((sigdebug & SDB_KSTACK) && p->p_pid == sigpid) {
printf("sendsig: about to return to catcher %p thru %p\n",
@ -777,7 +777,7 @@ sys_sigreturn(p, v, retval)
}
#endif
scp = SCARG(uap, sigcntxp);
if ((int)scp & 3 || (copyin((caddr_t)scp, &sc, sizeof sc) != 0))
if ((vaddr_t)scp & 3 || (copyin((caddr_t)scp, &sc, sizeof sc) != 0))
#ifdef DEBUG
{
printf("sigreturn: copyin failed\n");
@ -1043,8 +1043,8 @@ dumpsys()
blkno += pmap_dumpsize();
#endif
for (mp = mem; mp->size; mp++) {
register unsigned i = 0, n;
register maddr = mp->start;
unsigned i = 0, n;
paddr_t maddr = mp->start;
if (maddr == 0) {
/* Skip first page at physical address 0 */
@ -1127,7 +1127,7 @@ trapdump(tf)
void
stackdump()
{
struct frame *fp = getfp(), *sfp;
struct frame32 *fp = (struct frame32 *)getfp(), *sfp;
struct frame64 *fp64;
sfp = fp;
@ -1141,14 +1141,14 @@ stackdump()
(long)fp64->fr_pc, fp64->fr_arg[0], fp64->fr_arg[1], fp64->fr_arg[2],
fp64->fr_arg[3], fp64->fr_arg[4], fp64->fr_arg[5], fp64->fr_arg[6],
(long)fp64->fr_fp);
fp = (struct frame*)fp64->fr_fp;
fp = (struct frame32*)fp64->fr_fp;
} else {
/* 32-bit frame */
printf(" pc = %x args = (%x, %x, %x, %x, %x, %x, %x) fp = %p\n",
fp->fr_pc, fp->fr_arg[0], fp->fr_arg[1], fp->fr_arg[2],
fp->fr_arg[3], fp->fr_arg[4], fp->fr_arg[5], fp->fr_arg[6],
fp->fr_fp);
fp = fp->fr_fp;
fp = (struct frame32*)fp->fr_fp;
}
}
}
@ -1707,7 +1707,10 @@ _bus_dmamem_map(t, segs, nsegs, size, kvap, flags)
int r, cbit;
size_t oversize;
u_long align;
#if 0
/* This went away with dvma_mapin. We may need it later */
extern u_long dvma_cachealign;
#endif
if (nsegs != 1)
panic("_bus_dmamem_map: nsegs = %d", nsegs);

View File

@ -1,4 +1,4 @@
/* $NetBSD: process_machdep.c,v 1.1.1.1 1998/06/20 04:58:52 eeh Exp $ */
/* $NetBSD: process_machdep.c,v 1.2 1998/08/30 15:32:19 eeh Exp $ */
/*
* Copyright (c) 1993 The Regents of the University of California.
@ -139,8 +139,8 @@ process_set_pc(p, addr)
struct proc *p;
caddr_t addr;
{
p->p_md.md_tf->tf_pc = (u_int)addr;
p->p_md.md_tf->tf_npc = (u_int)addr + 4;
p->p_md.md_tf->tf_pc = addr;
p->p_md.md_tf->tf_npc = addr + 4;
return (0);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: trap.c,v 1.8 1998/08/27 06:23:32 eeh Exp $ */
/* $NetBSD: trap.c,v 1.9 1998/08/30 15:32:19 eeh Exp $ */
/*
* Copyright (c) 1996
@ -353,14 +353,14 @@ const char *trap_type[] = {
#define N_TRAP_TYPES (sizeof trap_type / sizeof *trap_type)
static __inline void userret __P((struct proc *, int, u_quad_t));
void trap __P((unsigned, int, int, struct trapframe *));
void trap __P((unsigned, long, long, struct trapframe *));
static __inline void share_fpu __P((struct proc *, struct trapframe *));
static int fixalign __P((struct proc *, struct trapframe *));
void mem_access_fault __P((unsigned, int, u_int, int, int, struct trapframe *));
void data_access_fault __P((unsigned type, u_int va, u_int pc, struct trapframe *));
void data_access_error __P((unsigned, u_int, u_int, u_int, u_int, struct trapframe *));
void text_access_fault __P((unsigned, u_int, struct trapframe *));
void text_access_error __P((unsigned, u_int, u_int, u_int, u_int, struct trapframe *));
void mem_access_fault __P((unsigned, int, u_long, int, int, struct trapframe *));
void data_access_fault __P((unsigned type, u_long va, u_long pc, struct trapframe *));
void data_access_error __P((unsigned, u_long, u_long, u_long, u_long, struct trapframe *));
void text_access_fault __P((unsigned, u_long, struct trapframe *));
void text_access_error __P((unsigned, u_long, u_long, u_long, u_long, struct trapframe *));
void syscall __P((register_t, struct trapframe *, register_t));
#ifdef DEBUG
@ -471,7 +471,7 @@ static __inline void share_fpu(p, tf)
void
trap(type, tstate, pc, tf)
register unsigned type;
register int tstate, pc;
register long tstate, pc;
register struct trapframe *tf;
{
register struct proc *p;
@ -675,6 +675,7 @@ badtrap:
break;
}
#if 0
#define read_rw(src, dst) \
((src&1)?copyin((caddr_t)(src), (caddr_t)(dst), sizeof(struct rwindow32))\
:copyin((caddr_t)(src+BIAS), (caddr_t)(dst), sizeof(struct rwindow64)))
@ -695,6 +696,8 @@ badtrap:
printf("%s[%d]: rwindow: pcb<-stack: %x\n",
p->p_comm, p->p_pid, tf->tf_out[6]);
printf("trap: T_RWRET sent!?!\n");
/* I don't think this is ever used */
Debugger();
#endif
if (read_rw(tf->tf_out[6], &pcb->pcb_rw[0]))
sigexit(p, SIGILL);
@ -702,7 +705,7 @@ badtrap:
panic("trap T_RWRET 2");
pcb->pcb_nsaved = -1; /* mark success */
break;
#endif
case T_ALIGN:
case T_LDDF_ALIGN:
case T_STDF_ALIGN:
@ -872,12 +875,12 @@ rwindow_save(p)
#endif
#ifdef DEBUG
if (rwindow_debug&RW_64) {
printf("rwindow_save: 64-bit tf to %p-BIAS or %p\n",
rwdest, rwdest-BIAS);
printf("rwindow_save: 64-bit tf to %p+BIAS or %p\n",
rwdest, rwdest+BIAS);
Debugger();
}
#endif
rwdest -= BIAS;
rwdest += BIAS;
if (copyout((caddr_t)rw, (caddr_t)rwdest,
sizeof(*rw))) {
#ifdef DEBUG
@ -963,10 +966,10 @@ extern struct proc *masterpaddr;
void
data_access_fault(type, addr, pc, tf)
register unsigned type;
register u_int addr;
register u_int pc;
register struct trapframe *tf;
unsigned type;
u_long addr;
u_long pc;
struct trapframe *tf;
{
register u_int64_t tstate;
register struct proc *p;
@ -974,7 +977,7 @@ data_access_fault(type, addr, pc, tf)
register vaddr_t va;
register int rv;
vm_prot_t ftype;
int onfault;
vaddr_t onfault;
u_quad_t sticks;
#if DEBUG
static int lastdouble;
@ -1131,7 +1134,7 @@ data_access_fault(type, addr, pc, tf)
if (tstate & (PSTATE_PRIV<<TSTATE_PSTATE_SHIFT)) {
kfault:
onfault = p->p_addr ?
(int)p->p_addr->u_pcb.pcb_onfault : 0;
(long)p->p_addr->u_pcb.pcb_onfault : 0;
if (!onfault) {
(void) splhigh();
printf("data fault: pc=%x addr=%x\n",
@ -1158,7 +1161,7 @@ kfault:
Debugger();
}
#endif
trapsignal(p, SIGSEGV, (u_int)addr);
trapsignal(p, SIGSEGV, (u_long)addr);
}
if ((tstate & TSTATE_PRIV) == 0) {
userret(p, pc, sticks);
@ -1182,10 +1185,10 @@ kfault:
void
data_access_error(type, sfva, sfsr, afva, afsr, tf)
register unsigned type;
register u_int sfva;
register u_int sfsr;
register u_int afva;
register u_int afsr;
register u_long sfva;
register u_long sfsr;
register u_long afva;
register u_long afsr;
register struct trapframe *tf;
{
register int pc;
@ -1195,7 +1198,7 @@ data_access_error(type, sfva, sfsr, afva, afsr, tf)
register vaddr_t va;
register int rv;
vm_prot_t ftype;
int onfault;
vaddr_t onfault;
u_quad_t sticks;
#ifdef DEBUG
static int lastdouble;
@ -1264,7 +1267,7 @@ data_access_error(type, sfva, sfsr, afva, afsr, tf)
type, sfsr, sfva, afsr, afva, tf);
if (tstate & (PSTATE_PRIV<<TSTATE_PSTATE_SHIFT)) {
/* User fault -- Berr */
trapsignal(p, SIGBUS, (u_int)sfva);
trapsignal(p, SIGBUS, (u_long)sfva);
} else {
DEBUGGER(type, tf);
panic("trap: memory error");
@ -1389,7 +1392,7 @@ fault:
if (tstate & (PSTATE_PRIV<<TSTATE_PSTATE_SHIFT)) {
kfault:
onfault = p->p_addr ?
(int)p->p_addr->u_pcb.pcb_onfault : 0;
(long)p->p_addr->u_pcb.pcb_onfault : 0;
if (!onfault) {
(void) splhigh();
printf("data fault: pc=%x addr=%x sfsr=%b\n",
@ -1414,7 +1417,7 @@ kfault:
Debugger();
}
#endif
trapsignal(p, SIGSEGV, (u_int)sfva);
trapsignal(p, SIGSEGV, (u_long)sfva);
}
out:
if ((tstate & TSTATE_PRIV) == 0) {
@ -1433,7 +1436,7 @@ out:
void
text_access_fault(type, pc, tf)
register unsigned type;
register u_int pc;
register u_long pc;
register struct trapframe *tf;
{
register u_int64_t tstate;
@ -1540,7 +1543,7 @@ text_access_fault(type, pc, tf)
Debugger();
}
#endif
trapsignal(p, SIGSEGV, (u_int)pc);
trapsignal(p, SIGSEGV, (u_long)pc);
}
if ((tstate & TSTATE_PRIV) == 0) {
userret(p, pc, sticks);
@ -1561,10 +1564,10 @@ text_access_fault(type, pc, tf)
void
text_access_error(type, pc, sfsr, afva, afsr, tf)
register unsigned type;
register u_int pc;
register u_int sfsr;
register u_int afva;
register u_int afsr;
register u_long pc;
register u_long sfsr;
register u_long afva;
register u_long afsr;
register struct trapframe *tf;
{
register int64_t tstate;
@ -1707,7 +1710,7 @@ text_access_error(type, pc, sfsr, afva, afsr, tf)
Debugger();
}
#endif
trapsignal(p, SIGSEGV, (u_int)pc);
trapsignal(p, SIGSEGV, (u_long)pc);
}
out:
if ((tstate & TSTATE_PRIV) == 0) {
@ -1828,19 +1831,22 @@ syscall(code, tf, pc)
#endif
if (code < 0 || code >= nsys)
callp += p->p_emul->e_nosys;
else {
else if (tf->tf_out[6] & 1) {
/* 64-bit stack -- not really supported on 32-bit kernels */
callp += code;
i = callp->sy_argsize / sizeof(register_t);
i = callp->sy_argsize / sizeof(register64_t);
if (i > nap) { /* usually false */
register64_t temp;
#ifdef DEBUG
if (trapdebug&(TDB_SYSCALL|TDB_FOLLOW))
printf("Args %d>%d -- need to copyin\n", i , nap);
#endif
if (i > 8)
panic("syscall nargs");
error = copyin((caddr_t)tf->tf_out[6] +
offsetof(struct frame, fr_argx),
(caddr_t)&args.i[nap], (i - nap) * sizeof(register_t));
error = copyin((caddr_t)tf->tf_out[6] + BIAS +
offsetof(struct frame64, fr_argx),
(caddr_t)&temp, (i - nap) * sizeof(register64_t));
args.i[nap] = temp;
if (error) {
#ifdef KTRACE
if (KTRPOINT(p, KTR_SYSCALL))
@ -1851,13 +1857,49 @@ syscall(code, tf, pc)
}
i = nap;
}
#if 0
copywords(ap, args.i, i * sizeof(register_t));
#else
/* Need to convert from int64 to int32 or we lose */
for (argp = &args.i[0]; i--;)
*argp++ = *ap++;
#ifdef DEBUG
if (trapdebug&(TDB_SYSCALL|TDB_FOLLOW)) {
for (i=0; i < callp->sy_argsize / sizeof(register_t); i++)
printf("arg[%d]=%x ", i, (long)(args.i[i]));
printf("\n");
}
if (trapdebug&(TDB_STOPCALL|TDB_SYSTOP)) {
printf("stop precall\n");
Debugger();
}
#endif
} else {
/* 32-bit stack */
callp += code;
i = callp->sy_argsize / sizeof(register32_t);
if (i > nap) { /* usually false */
register32_t temp;
#ifdef DEBUG
if (trapdebug&(TDB_SYSCALL|TDB_FOLLOW))
printf("Args %d>%d -- need to copyin\n", i , nap);
#endif
if (i > 8)
panic("syscall nargs");
error = copyin((caddr_t)tf->tf_out[6] +
offsetof(struct frame32, fr_argx),
(caddr_t)&temp, (i - nap) * sizeof(register32_t));
args.i[nap] = temp;
if (error) {
#ifdef KTRACE
if (KTRPOINT(p, KTR_SYSCALL))
ktrsyscall(p->p_tracep, code,
callp->sy_argsize, args.i);
#endif
goto bad;
}
i = nap;
}
/* Need to convert from int64 to int32 or we lose */
for (argp = &args.i[0]; i--;)
*argp++ = *ap++;
#ifdef DEBUG
if (trapdebug&(TDB_SYSCALL|TDB_FOLLOW)) {
for (i=0; i < callp->sy_argsize / sizeof(register_t); i++)
@ -1983,8 +2025,12 @@ child_return(p)
/*
* Code to handle alignment faults on the sparc. This is enabled by sending
* a fixalign trap. * Such code is generated by compiling with cc -misalign
* a fixalign trap.
*
* Such code is generated by compiling with cc -misalign
* on SunOS, but we don't have such a feature yet on our gcc.
*
* We don't do any funny ASIs, so don't expect endianess-inversion to work.
*/
#ifdef DEBUG_ALIGN
# define DPRINTF(a) uprintf a
@ -1992,8 +2038,8 @@ child_return(p)
# define DPRINTF(a)
#endif
#define GPR(tf, i) ((int32_t *) &tf->tf_global)[i]
#define IPR(tf, i) ((int32_t *) tf->tf_out[6])[i - 16]
#define GPR(tf, i) ((int64_t *) &tf->tf_global)[i]
#define IPR(tf, i) ((int64_t *) tf->tf_out[6])[i - 16]
#define FPR(p, i) ((int32_t) p->p_md.md_fpstate->fs_regs[i])
static __inline int readgpreg __P((struct trapframe *, int, void *));
@ -2010,11 +2056,11 @@ readgpreg(tf, i, val)
{
int error = 0;
if (i == 0)
*(int32_t *) val = 0;
*(int64_t *) val = 0;
else if (i < 16)
*(int32_t *) val = GPR(tf, i);
*(int64_t *) val = GPR(tf, i);
else
error = copyin(&IPR(tf, i), val, sizeof(int32_t));
error = copyin(&IPR(tf, i), val, sizeof(int64_t));
return error;
}
@ -2031,10 +2077,10 @@ writegpreg(tf, i, val)
if (i == 0)
return error;
else if (i < 16)
GPR(tf, i) = *(int32_t *) val;
GPR(tf, i) = *(int64_t *) val;
else
/* XXX: Fix copyout prototype */
error = copyout((caddr_t) val, &IPR(tf, i), sizeof(int32_t));
error = copyout((caddr_t) val, &IPR(tf, i), sizeof(int64_t));
return error;
}
@ -2092,13 +2138,14 @@ fixalign(p, tf)
union {
double d;
int64_t l;
int32_t i[2];
int16_t s[4];
int8_t c[8];
} data;
size_t size;
int32_t offs, addr;
int64_t offs, addr;
int error;
/* fetch and check the instruction that caused the fault */
@ -2175,12 +2222,17 @@ fixalign(p, tf)
}
}
else {
error = readgpreg(tf, code.bits.rd, &data.i[0]);
error = readgpreg(tf, code.bits.rd, &data.l);
if (error)
return error;
if (size == 8) {
error = readgpreg(tf, code.bits.rd + 1,
&data.i[1]);
if (size == 8 && !code.bits.sgn) {
int64_t temp;
/* std or stda -- get things in the right regs. */
temp = data.l;
data.i[0] = temp;
error = readgpreg(tf, code.bits.rd + 1, &temp);
data.i[1] = temp;
if (error)
return error;
}
@ -2222,12 +2274,16 @@ fixalign(p, tf)
loadfpstate(p->p_md.md_fpstate);
}
else {
error = writegpreg(tf, code.bits.rd, &data.i[0]);
if (error)
return error;
if (size == 8)
error = writegpreg(tf, code.bits.rd + 1,
&data.i[1]);
if (size == 8 && !code.bits.sgn) {
u_int64_t temp;
/* ldd or ldda -- get things in the right regs. */
temp = (unsigned int)data.i[0]; /* Do not sign extend */
error = writegpreg(tf, code.bits.rd, &temp);
temp = (unsigned int)data.i[1]; /* Do not sign extend */
if (!error)
error = writegpreg(tf, code.bits.rd + 1, &temp);
} else error = writegpreg(tf, code.bits.rd, &data.i[0]);
}
}
return error;

View File

@ -1,4 +1,4 @@
/* $NetBSD: vm_machdep.c,v 1.5 1998/08/23 15:49:02 eeh Exp $ */
/* $NetBSD: vm_machdep.c,v 1.6 1998/08/30 15:32:19 eeh Exp $ */
/*
* Copyright (c) 1996
@ -86,7 +86,7 @@ pagemove(from, to, size)
{
register paddr_t pa;
if (size & CLOFSET || (int)from & CLOFSET || (int)to & CLOFSET)
if (size & CLOFSET || (long)from & CLOFSET || (long)to & CLOFSET)
panic("pagemove 1");
#if 1
cache_flush((caddr_t)from, size);
@ -201,7 +201,11 @@ vunmapbuf(bp, len)
/*
* The offset of the topmost frame in the kernel stack.
*/
#define TOPFRAMEOFF (USPACE-sizeof(struct trapframe)-sizeof(struct frame))
#ifdef _LP64
#define TOPFRAMEOFF (USPACE-sizeof(struct trapframe)-sizeof(struct frame64))
#else
#define TOPFRAMEOFF (USPACE-sizeof(struct trapframe)-sizeof(struct frame32))
#endif
#ifdef DEBUG
char cpu_forkname[] = "cpu_fork()";
@ -275,10 +279,10 @@ cpu_fork(p1, p2)
* the tippity-top of the u. area.)
*/
tf2 = p2->p_md.md_tf = (struct trapframe *)
((int)npcb + USPACE - sizeof(*tf2));
((long)npcb + USPACE - sizeof(*tf2));
/* Copy parent's trapframe */
*tf2 = *(struct trapframe *)((int)opcb + USPACE - sizeof(*tf2));
*tf2 = *(struct trapframe *)((long)opcb + USPACE - sizeof(*tf2));
/* Duplicate efforts of syscall(), but slightly differently */
if (tf2->tf_global[1] & SYSCALL_G2RFLAG) {
@ -310,13 +314,13 @@ cpu_fork(p1, p2)
}
#endif
/* Construct kernel frame to return to in cpu_switch() */
rp = (struct rwindow32 *)((u_int)npcb + TOPFRAMEOFF);
*rp = *(struct rwindow32 *)((u_int)opcb + TOPFRAMEOFF);
rp->rw_local[0] = (int)child_return; /* Function to call */
rp->rw_local[1] = (int)p2; /* and its argument */
rp = (struct rwindow32 *)((u_long)npcb + TOPFRAMEOFF);
*rp = *(struct rwindow32 *)((u_long)opcb + TOPFRAMEOFF);
rp->rw_local[0] = (long)child_return; /* Function to call */
rp->rw_local[1] = (long)p2; /* and its argument */
npcb->pcb_pc = (int)proc_trampoline - 8;
npcb->pcb_sp = (int)rp;
npcb->pcb_pc = (long)proc_trampoline - 8;
npcb->pcb_sp = (long)rp;
#ifdef NOTDEF_DEBUG
printf("cpu_fork: Copying over trapframe: otf=%p ntf=%p sp=%p opcb=%p npcb=%p\n",
@ -357,9 +361,9 @@ cpu_set_kpc(p, pc)
pcb = &p->p_addr->u_pcb;
rp = (struct rwindow32 *)((u_int)pcb + TOPFRAMEOFF);
rp->rw_local[0] = (int)pc; /* Function to call */
rp->rw_local[1] = (int)p; /* and its argument */
rp = (struct rwindow32 *)((u_long)pcb + TOPFRAMEOFF);
rp->rw_local[0] = (long)pc; /* Function to call */
rp->rw_local[1] = (long)p; /* and its argument */
#ifdef NOTDEF_DEBUG
/* Let's see if this is ever called */
@ -377,8 +381,8 @@ cpu_set_kpc(p, pc)
* - point it at the stack frame constructed above
* - make it run in a clear set of register windows
*/
pcb->pcb_pc = (int)proc_trampoline - 8 ;
pcb->pcb_sp = (int)rp;
pcb->pcb_pc = (long)proc_trampoline - 8 ;
pcb->pcb_sp = (long)rp;
}
/*
@ -439,8 +443,6 @@ cpu_coredump(p, vp, cred, chdr)
md_core.md_tf.tf_npc = p->p_md.md_tf->tf_npc;
md_core.md_tf.tf_y = p->p_md.md_tf->tf_y;
for (i=0; i<8; i++) {
struct rwindow32 *rw = (struct rwindow32 *)p->p_md.md_tf->tf_out[6];
md_core.md_tf.tf_global[i] = p->p_md.md_tf->tf_global[i];
md_core.md_tf.tf_out[i] = p->p_md.md_tf->tf_out[i];
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: netbsd32_exec.c,v 1.3 1998/08/29 18:16:57 eeh Exp $ */
/* $NetBSD: netbsd32_exec.c,v 1.4 1998/08/30 15:32:19 eeh Exp $ */
/* from: NetBSD: exec_aout.c,v 1.15 1996/09/26 23:34:46 cgd Exp */
/*
@ -40,6 +40,8 @@
#include <sys/vnode.h>
#include <sys/exec.h>
#include <sys/resourcevar.h>
#include <sys/signal.h>
#include <sys/signalvar.h>
#include <vm/vm.h>
@ -47,6 +49,8 @@
#include <compat/sparc32/sparc32_exec.h>
#include <compat/sparc32/sparc32_syscall.h>
#include <machine/frame.h>
extern struct sysent sparc32_sysent[];
#ifdef SYSCALL_DEBUG
extern char *sparc32_syscallnames[];
@ -55,6 +59,9 @@ extern char sigcode[], esigcode[];
const char sparc32_emul_path[] = "/emul/sparc32";
void sparc32_sendsig __P((sig_t, int, int, u_long));
void sparc32_setregs __P((struct proc *, struct exec_package *, u_long));
static int sparc32_exec_aout_prep_zmagic __P((struct proc *, struct exec_package *));
static int sparc32_exec_aout_prep_nmagic __P((struct proc *, struct exec_package *));
static int sparc32_exec_aout_prep_omagic __P((struct proc *, struct exec_package *));
struct emul emul_sparc32 = {
"sparc32",
@ -116,6 +123,11 @@ exec_sparc32_makecmds(p, epp)
break;
case (MID_MACHINE << 16) | OMAGIC:
error = sparc32_exec_aout_prep_omagic(p, epp);
break;
default:
/* Invalid magic */
error = EINVAL;
break;
}
if (error)
@ -346,13 +358,14 @@ sparc32_sendsig(catcher, sig, mask, code)
register struct sparc32_sigframe *fp;
register struct trapframe *tf;
register int addr, oonstack;
struct rwindow32 *kwin, *oldsp, *newsp, /* DEBUG */tmpwin;
struct rwindow32 *kwin, *oldsp, *newsp;
struct sparc32_sigframe sf;
extern char sigcode[], esigcode[];
#define szsigcode (esigcode - sigcode)
tf = p->p_md.md_tf;
oldsp = (struct rwindow32 *)(int)tf->tf_out[6];
/* Need to attempt to zero extend this 32-bit pointer */
oldsp = (struct rwindow32 *)(u_long)(u_int)tf->tf_out[6];
oonstack = psp->ps_sigstk.ss_flags & SS_ONSTACK;
/*
* Compute new user stack addresses, subtract off
@ -365,7 +378,7 @@ sparc32_sendsig(catcher, sig, mask, code)
psp->ps_sigstk.ss_flags |= SS_ONSTACK;
} else
fp = (struct sparc32_sigframe *)oldsp;
fp = (struct sparc32_sigframe *)((int)(fp - 1) & ~7);
fp = (struct sparc32_sigframe *)((long)(fp - 1) & ~7);
#ifdef DEBUG
sigpid = p->p_pid;
@ -383,7 +396,7 @@ sparc32_sendsig(catcher, sig, mask, code)
sf.sf_signo = sig;
sf.sf_code = code;
#ifdef COMPAT_SUNOS
sf.sf_scp = (u_int)&fp->sf_sc;
sf.sf_scp = (u_long)&fp->sf_sc;
#endif
sf.sf_addr = 0; /* XXX */
@ -392,7 +405,7 @@ sparc32_sendsig(catcher, sig, mask, code)
*/
sf.sf_sc.sc_onstack = oonstack;
sf.sf_sc.sc_mask = mask;
sf.sf_sc.sc_sp = (int)oldsp;
sf.sf_sc.sc_sp = (long)oldsp;
sf.sf_sc.sc_pc = tf->tf_pc;
sf.sf_sc.sc_npc = tf->tf_npc;
sf.sf_sc.sc_psr = TSTATECCR_TO_PSR(tf->tf_tstate); /* XXX */
@ -408,7 +421,7 @@ sparc32_sendsig(catcher, sig, mask, code)
* joins seamlessly with the frame it was in when the signal occurred,
* so that the debugger and _longjmp code can back up through it.
*/
newsp = (struct rwindow32 *)((int)fp - sizeof(struct rwindow32));
newsp = (struct rwindow32 *)((long)fp - sizeof(struct rwindow32));
write_user_windows();
#ifdef DEBUG
if ((sigdebug & SDB_KSTACK))
@ -426,7 +439,7 @@ sparc32_sendsig(catcher, sig, mask, code)
suword(&oldsp->rw_local[4], (int)tf->tf_local[4]) || suword(&oldsp->rw_local[5], (int)tf->tf_local[5]) ||
suword(&oldsp->rw_local[6], (int)tf->tf_local[6]) || suword(&oldsp->rw_local[7], (int)tf->tf_local[7]) ||
copyout((caddr_t)&sf, (caddr_t)fp, sizeof sf) ||
suword(&(((union rwindow *)newsp)->v8.rw_in[6]), (u_int)oldsp)) {
suword(&(((union rwindow *)newsp)->v8.rw_in[6]), (u_long)oldsp)) {
/*
* Process has trashed its stack; give it an illegal
* instruction to halt it in its tracks.
@ -453,16 +466,16 @@ sparc32_sendsig(catcher, sig, mask, code)
*/
#ifdef COMPAT_SUNOS
if (psp->ps_usertramp & sigmask(sig)) {
addr = (int)catcher; /* user does his own trampolining */
addr = (long)catcher; /* user does his own trampolining */
} else
#endif
{
addr = (int)PS_STRINGS - szsigcode;
tf->tf_global[1] = (int)catcher;
addr = (long)PS_STRINGS - szsigcode;
tf->tf_global[1] = (long)catcher;
}
tf->tf_pc = addr;
tf->tf_npc = addr + 4;
tf->tf_out[6] = (u_int64_t)(int)newsp;
tf->tf_out[6] = (u_int64_t)(u_int)(u_long)newsp;
#ifdef DEBUG
if ((sigdebug & SDB_KSTACK) && p->p_pid == sigpid) {
printf("sendsig: about to return to catcher %p thru %p\n",

View File

@ -1,4 +1,4 @@
/* $NetBSD: netbsd32_netbsd.c,v 1.3 1998/08/29 18:16:57 eeh Exp $ */
/* $NetBSD: netbsd32_netbsd.c,v 1.4 1998/08/30 15:32:20 eeh Exp $ */
/*
* Copyright (c) 1998 Matthew R. Green
@ -28,6 +28,8 @@
* SUCH DAMAGE.
*/
#include "opt_ktrace.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/ipc.h>
@ -41,6 +43,7 @@
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/timex.h>
#include <sys/signalvar.h>
#include <vm/vm.h>
#include <sys/syscallargs.h>
@ -50,6 +53,33 @@
#include <compat/sparc32/sparc32.h>
#include <compat/sparc32/sparc32_syscallargs.h>
#include <machine/frame.h>
static __inline void sparc32_from_timeval __P((struct timeval *, struct sparc32_timeval *));
static __inline void sparc32_to_timeval __P((struct sparc32_timeval *, struct timeval *));
static __inline void sparc32_from_itimerval __P((struct itimerval *, struct sparc32_itimerval *));
static __inline void sparc32_to_itimerval __P((struct sparc32_itimerval *, struct itimerval *));
static __inline void sparc32_to_timespec __P((struct sparc32_timespec *, struct timespec *));
static __inline void sparc32_from_timespec __P((struct timespec *, struct sparc32_timespec *));
static __inline void sparc32_from_rusage __P((struct rusage *, struct sparc32_rusage *));
static __inline void sparc32_to_rusage __P((struct sparc32_rusage *, struct rusage *));
static __inline void sparc32_to_iovec __P((struct sparc32_iovec *, struct iovec *, int));
static __inline void sparc32_to_msghdr __P((struct sparc32_msghdr *, struct msghdr *));
static __inline void sparc32_from_statfs __P((struct statfs *, struct sparc32_statfs *));
static __inline void sparc32_from_timex __P((struct timex *, struct sparc32_timex *));
static __inline void sparc32_to_timex __P((struct sparc32_timex *, struct timex *));
static __inline void sparc32_from___stat13 __P((struct stat *, struct sparc32_stat *));
static __inline void sparc32_to_ipc_perm __P((struct sparc32_ipc_perm *, struct ipc_perm *));
static __inline void sparc32_from_ipc_perm __P((struct ipc_perm *, struct sparc32_ipc_perm *));
static __inline void sparc32_to_msg __P((struct sparc32_msg *, struct msg *));
static __inline void sparc32_from_msg __P((struct msg *, struct sparc32_msg *));
static __inline void sparc32_to_msqid_ds __P((struct sparc32_msqid_ds *, struct msqid_ds *));
static __inline void sparc32_from_msqid_ds __P((struct msqid_ds *, struct sparc32_msqid_ds *));
static __inline void sparc32_to_shmid_ds __P((struct sparc32_shmid_ds *, struct shmid_ds *));
static __inline void sparc32_from_shmid_ds __P((struct shmid_ds *, struct sparc32_shmid_ds *));
static __inline void sparc32_to_semid_ds __P((struct sparc32_semid_ds *, struct semid_ds *));
static __inline void sparc32_from_semid_ds __P((struct semid_ds *, struct sparc32_semid_ds *));
/* converters for structures that we need */
static __inline void
sparc32_from_timeval(tv, tv32)
@ -1527,6 +1557,7 @@ compat_sparc32_sigreturn(p, v, retval)
struct sparc32_sigcontext sc;
register struct trapframe *tf;
struct rwindow32 *rwstack, *kstack;
int i;
/* First ensure consistent stack state (see sendsig). */
write_user_windows();

View File

@ -1,4 +1,4 @@
/* $NetBSD: sparc32_exec.c,v 1.3 1998/08/29 18:16:57 eeh Exp $ */
/* $NetBSD: sparc32_exec.c,v 1.4 1998/08/30 15:32:19 eeh Exp $ */
/* from: NetBSD: exec_aout.c,v 1.15 1996/09/26 23:34:46 cgd Exp */
/*
@ -40,6 +40,8 @@
#include <sys/vnode.h>
#include <sys/exec.h>
#include <sys/resourcevar.h>
#include <sys/signal.h>
#include <sys/signalvar.h>
#include <vm/vm.h>
@ -47,6 +49,8 @@
#include <compat/sparc32/sparc32_exec.h>
#include <compat/sparc32/sparc32_syscall.h>
#include <machine/frame.h>
extern struct sysent sparc32_sysent[];
#ifdef SYSCALL_DEBUG
extern char *sparc32_syscallnames[];
@ -55,6 +59,9 @@ extern char sigcode[], esigcode[];
const char sparc32_emul_path[] = "/emul/sparc32";
void sparc32_sendsig __P((sig_t, int, int, u_long));
void sparc32_setregs __P((struct proc *, struct exec_package *, u_long));
static int sparc32_exec_aout_prep_zmagic __P((struct proc *, struct exec_package *));
static int sparc32_exec_aout_prep_nmagic __P((struct proc *, struct exec_package *));
static int sparc32_exec_aout_prep_omagic __P((struct proc *, struct exec_package *));
struct emul emul_sparc32 = {
"sparc32",
@ -116,6 +123,11 @@ exec_sparc32_makecmds(p, epp)
break;
case (MID_MACHINE << 16) | OMAGIC:
error = sparc32_exec_aout_prep_omagic(p, epp);
break;
default:
/* Invalid magic */
error = EINVAL;
break;
}
if (error)
@ -346,13 +358,14 @@ sparc32_sendsig(catcher, sig, mask, code)
register struct sparc32_sigframe *fp;
register struct trapframe *tf;
register int addr, oonstack;
struct rwindow32 *kwin, *oldsp, *newsp, /* DEBUG */tmpwin;
struct rwindow32 *kwin, *oldsp, *newsp;
struct sparc32_sigframe sf;
extern char sigcode[], esigcode[];
#define szsigcode (esigcode - sigcode)
tf = p->p_md.md_tf;
oldsp = (struct rwindow32 *)(int)tf->tf_out[6];
/* Need to attempt to zero extend this 32-bit pointer */
oldsp = (struct rwindow32 *)(u_long)(u_int)tf->tf_out[6];
oonstack = psp->ps_sigstk.ss_flags & SS_ONSTACK;
/*
* Compute new user stack addresses, subtract off
@ -365,7 +378,7 @@ sparc32_sendsig(catcher, sig, mask, code)
psp->ps_sigstk.ss_flags |= SS_ONSTACK;
} else
fp = (struct sparc32_sigframe *)oldsp;
fp = (struct sparc32_sigframe *)((int)(fp - 1) & ~7);
fp = (struct sparc32_sigframe *)((long)(fp - 1) & ~7);
#ifdef DEBUG
sigpid = p->p_pid;
@ -383,7 +396,7 @@ sparc32_sendsig(catcher, sig, mask, code)
sf.sf_signo = sig;
sf.sf_code = code;
#ifdef COMPAT_SUNOS
sf.sf_scp = (u_int)&fp->sf_sc;
sf.sf_scp = (u_long)&fp->sf_sc;
#endif
sf.sf_addr = 0; /* XXX */
@ -392,7 +405,7 @@ sparc32_sendsig(catcher, sig, mask, code)
*/
sf.sf_sc.sc_onstack = oonstack;
sf.sf_sc.sc_mask = mask;
sf.sf_sc.sc_sp = (int)oldsp;
sf.sf_sc.sc_sp = (long)oldsp;
sf.sf_sc.sc_pc = tf->tf_pc;
sf.sf_sc.sc_npc = tf->tf_npc;
sf.sf_sc.sc_psr = TSTATECCR_TO_PSR(tf->tf_tstate); /* XXX */
@ -408,7 +421,7 @@ sparc32_sendsig(catcher, sig, mask, code)
* joins seamlessly with the frame it was in when the signal occurred,
* so that the debugger and _longjmp code can back up through it.
*/
newsp = (struct rwindow32 *)((int)fp - sizeof(struct rwindow32));
newsp = (struct rwindow32 *)((long)fp - sizeof(struct rwindow32));
write_user_windows();
#ifdef DEBUG
if ((sigdebug & SDB_KSTACK))
@ -426,7 +439,7 @@ sparc32_sendsig(catcher, sig, mask, code)
suword(&oldsp->rw_local[4], (int)tf->tf_local[4]) || suword(&oldsp->rw_local[5], (int)tf->tf_local[5]) ||
suword(&oldsp->rw_local[6], (int)tf->tf_local[6]) || suword(&oldsp->rw_local[7], (int)tf->tf_local[7]) ||
copyout((caddr_t)&sf, (caddr_t)fp, sizeof sf) ||
suword(&(((union rwindow *)newsp)->v8.rw_in[6]), (u_int)oldsp)) {
suword(&(((union rwindow *)newsp)->v8.rw_in[6]), (u_long)oldsp)) {
/*
* Process has trashed its stack; give it an illegal
* instruction to halt it in its tracks.
@ -453,16 +466,16 @@ sparc32_sendsig(catcher, sig, mask, code)
*/
#ifdef COMPAT_SUNOS
if (psp->ps_usertramp & sigmask(sig)) {
addr = (int)catcher; /* user does his own trampolining */
addr = (long)catcher; /* user does his own trampolining */
} else
#endif
{
addr = (int)PS_STRINGS - szsigcode;
tf->tf_global[1] = (int)catcher;
addr = (long)PS_STRINGS - szsigcode;
tf->tf_global[1] = (long)catcher;
}
tf->tf_pc = addr;
tf->tf_npc = addr + 4;
tf->tf_out[6] = (u_int64_t)(int)newsp;
tf->tf_out[6] = (u_int64_t)(u_int)(u_long)newsp;
#ifdef DEBUG
if ((sigdebug & SDB_KSTACK) && p->p_pid == sigpid) {
printf("sendsig: about to return to catcher %p thru %p\n",

View File

@ -1,4 +1,4 @@
/* $NetBSD: sparc32_netbsd.c,v 1.3 1998/08/29 18:16:57 eeh Exp $ */
/* $NetBSD: sparc32_netbsd.c,v 1.4 1998/08/30 15:32:20 eeh Exp $ */
/*
* Copyright (c) 1998 Matthew R. Green
@ -28,6 +28,8 @@
* SUCH DAMAGE.
*/
#include "opt_ktrace.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/ipc.h>
@ -41,6 +43,7 @@
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/timex.h>
#include <sys/signalvar.h>
#include <vm/vm.h>
#include <sys/syscallargs.h>
@ -50,6 +53,33 @@
#include <compat/sparc32/sparc32.h>
#include <compat/sparc32/sparc32_syscallargs.h>
#include <machine/frame.h>
static __inline void sparc32_from_timeval __P((struct timeval *, struct sparc32_timeval *));
static __inline void sparc32_to_timeval __P((struct sparc32_timeval *, struct timeval *));
static __inline void sparc32_from_itimerval __P((struct itimerval *, struct sparc32_itimerval *));
static __inline void sparc32_to_itimerval __P((struct sparc32_itimerval *, struct itimerval *));
static __inline void sparc32_to_timespec __P((struct sparc32_timespec *, struct timespec *));
static __inline void sparc32_from_timespec __P((struct timespec *, struct sparc32_timespec *));
static __inline void sparc32_from_rusage __P((struct rusage *, struct sparc32_rusage *));
static __inline void sparc32_to_rusage __P((struct sparc32_rusage *, struct rusage *));
static __inline void sparc32_to_iovec __P((struct sparc32_iovec *, struct iovec *, int));
static __inline void sparc32_to_msghdr __P((struct sparc32_msghdr *, struct msghdr *));
static __inline void sparc32_from_statfs __P((struct statfs *, struct sparc32_statfs *));
static __inline void sparc32_from_timex __P((struct timex *, struct sparc32_timex *));
static __inline void sparc32_to_timex __P((struct sparc32_timex *, struct timex *));
static __inline void sparc32_from___stat13 __P((struct stat *, struct sparc32_stat *));
static __inline void sparc32_to_ipc_perm __P((struct sparc32_ipc_perm *, struct ipc_perm *));
static __inline void sparc32_from_ipc_perm __P((struct ipc_perm *, struct sparc32_ipc_perm *));
static __inline void sparc32_to_msg __P((struct sparc32_msg *, struct msg *));
static __inline void sparc32_from_msg __P((struct msg *, struct sparc32_msg *));
static __inline void sparc32_to_msqid_ds __P((struct sparc32_msqid_ds *, struct msqid_ds *));
static __inline void sparc32_from_msqid_ds __P((struct msqid_ds *, struct sparc32_msqid_ds *));
static __inline void sparc32_to_shmid_ds __P((struct sparc32_shmid_ds *, struct shmid_ds *));
static __inline void sparc32_from_shmid_ds __P((struct shmid_ds *, struct sparc32_shmid_ds *));
static __inline void sparc32_to_semid_ds __P((struct sparc32_semid_ds *, struct semid_ds *));
static __inline void sparc32_from_semid_ds __P((struct semid_ds *, struct sparc32_semid_ds *));
/* converters for structures that we need */
static __inline void
sparc32_from_timeval(tv, tv32)
@ -1527,6 +1557,7 @@ compat_sparc32_sigreturn(p, v, retval)
struct sparc32_sigcontext sc;
register struct trapframe *tf;
struct rwindow32 *rwstack, *kstack;
int i;
/* First ensure consistent stack state (see sendsig). */
write_user_windows();

View File

@ -1,4 +1,4 @@
/* $NetBSD: mul.S,v 1.2 1998/08/29 18:16:58 eeh Exp $ */
/* $NetBSD: mul.S,v 1.3 1998/08/30 15:32:20 eeh Exp $ */
/*
* Copyright (c) 1992, 1993
@ -43,9 +43,27 @@
#ifdef notdef
.asciz "@(#)mul.s 8.1 (Berkeley) 6/4/93"
#endif
.asciz "$NetBSD: mul.S,v 1.2 1998/08/29 18:16:58 eeh Exp $"
.asciz "$NetBSD: mul.S,v 1.3 1998/08/30 15:32:20 eeh Exp $"
#endif /* LIBC_SCCS and not lint */
/*
* This doesn't really belong here and should be handled by toolchain
* magic.
*/
.globl __mul64, __div64, __udiv64, __rem64, __urem64
__mul64:
ba,a,pt %icc,__muldi3
__div64:
ba,a,pt %icc,__divdi3
__udiv64:
ba,a,pt %icc,__udivdi3
__rem64:
ba,a,pt %icc,__moddi3
__urem64:
ba,a,pt %icc,__umoddi3
/*
* Signed multiply, from Appendix E of the Sparc Version 8
* Architecture Manual.
@ -166,4 +184,4 @@ Lmul_shortway:
or %o5, %o0, %o0 ! construct low part of result
retl
sra %o4, 20, %o1 ! ... and extract high part of result
#endif
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: quad.h,v 1.10 1998/08/30 05:29:39 enami Exp $ */
/* $NetBSD: quad.h,v 1.11 1998/08/30 15:32:20 eeh Exp $ */
/*-
* Copyright (c) 1992, 1993
@ -113,16 +113,6 @@ typedef unsigned int qshift_t;
typedef u_quad_t qshift_t;
#endif
/* Breakage for egcs-solaris2.x */
#if !defined(__NetBSD__) && defined(sun) && defined(__svr4__) /* XXX */
#define __muldi3 __mul64
#define __divdi3 __div64
#define __udivdi3 __udiv64
#define __moddi3 __rem64
#define __umoddi3 __urem64
#endif
__BEGIN_DECLS
int __cmpdi2 __P((quad_t, quad_t));
quad_t __adddi3 __P((quad_t, quad_t));