diff --git a/sys/arch/sparc64/conf/GENERIC b/sys/arch/sparc64/conf/GENERIC index e34359cc68c2..daee6e705238 100644 --- a/sys/arch/sparc64/conf/GENERIC +++ b/sys/arch/sparc64/conf/GENERIC @@ -1,4 +1,4 @@ -# $NetBSD: GENERIC,v 1.11 1999/01/23 19:09:00 eeh Exp $ +# $NetBSD: GENERIC,v 1.12 1999/03/26 04:29:20 eeh Exp $ include "arch/sparc64/conf/std.sparc64" @@ -124,7 +124,7 @@ options COMPAT_10 # NetBSD 1.0 binary compatibility options COMPAT_11 # NetBSD 1.1 binary compatibility options COMPAT_12 # NetBSD 1.2 binary compatibility options COMPAT_13 # NetBSD 1.3 binary compatibility -#options COMPAT_SPARC32 # NetBSD/sparc binary compatibility -- 64-bit only +#options COMPAT_NETBSD32 # NetBSD/sparc binary compatibility -- 64-bit only options COMPAT_SUNOS # SunOS 4.x binary compatibility options COMPAT_SVR4 # SunOS 5.x binary compatibility options EXEC_ELF32 # Exec module for SunOS 5.x binaries. diff --git a/sys/arch/sparc64/conf/GENERIC64 b/sys/arch/sparc64/conf/GENERIC64 index 278c0111ffe8..f8b0a6460438 100644 --- a/sys/arch/sparc64/conf/GENERIC64 +++ b/sys/arch/sparc64/conf/GENERIC64 @@ -1,4 +1,4 @@ -# $NetBSD: GENERIC64,v 1.1 1999/01/23 19:13:16 eeh Exp $ +# $NetBSD: GENERIC64,v 1.2 1999/03/26 04:29:20 eeh Exp $ include "arch/sparc64/conf/std.sparc64" @@ -124,7 +124,7 @@ options COMPAT_10 # NetBSD 1.0 binary compatibility options COMPAT_11 # NetBSD 1.1 binary compatibility options COMPAT_12 # NetBSD 1.2 binary compatibility options COMPAT_13 # NetBSD 1.3 binary compatibility -options COMPAT_SPARC32 # NetBSD/sparc binary compatibility +options COMPAT_NETBSD32 # NetBSD/sparc binary compatibility options COMPAT_SUNOS # SunOS 4.x binary compatibility options COMPAT_SVR4 # SunOS 5.x binary compatibility options EXEC_ELF32 # Exec module for SunOS 5.x binaries. diff --git a/sys/arch/sparc64/conf/NONPLUS64 b/sys/arch/sparc64/conf/NONPLUS64 index 593671e96af8..ca1b8086b567 100644 --- a/sys/arch/sparc64/conf/NONPLUS64 +++ b/sys/arch/sparc64/conf/NONPLUS64 @@ -1,4 +1,4 @@ -# $NetBSD: NONPLUS64,v 1.4 1999/01/23 19:12:19 eeh Exp $ +# $NetBSD: NONPLUS64,v 1.5 1999/03/26 04:29:20 eeh Exp $ include "arch/sparc64/conf/std.sparc64" @@ -126,7 +126,7 @@ options COMPAT_10 # NetBSD 1.0 binary compatibility options COMPAT_11 # NetBSD 1.1 binary compatibility options COMPAT_12 # NetBSD 1.2 binary compatibility options COMPAT_13 # NetBSD 1.3 binary compatibility -options COMPAT_SPARC32 # NetBSD/sparc binary compatibility +options COMPAT_NETBSD32 # NetBSD/sparc binary compatibility options COMPAT_SUNOS # SunOS 4.x binary compatibility options COMPAT_SVR4 # SunOS 5.x binary compatibility options EXEC_ELF32 # Exec module for SunOS 5.x binaries. diff --git a/sys/arch/sparc64/include/netbsd32_machdep.h b/sys/arch/sparc64/include/netbsd32_machdep.h index 78ff7b61829d..f993038812a1 100644 --- a/sys/arch/sparc64/include/netbsd32_machdep.h +++ b/sys/arch/sparc64/include/netbsd32_machdep.h @@ -1,4 +1,4 @@ -/* $NetBSD: netbsd32_machdep.h,v 1.2 1999/03/25 17:49:43 mrg Exp $ */ +/* $NetBSD: netbsd32_machdep.h,v 1.3 1999/03/26 04:29:21 eeh Exp $ */ /* * Copyright (c) 1998 Matthew R. Green @@ -47,4 +47,11 @@ struct netbsd32_sigcontext { int sc_o0; /* %o0 to restore */ }; +void netbsd32_setregs __P((struct proc *p, struct exec_package *pack, u_long stack)); +int compat_netbsd32_sigreturn __P((struct proc *p, void *v, register_t *retval)); +void netbsd32_sendsig __P((sig_t catcher, int sig, int mask, u_long code)); + +extern char netbsd32_esigcode[], netbsd32_sigcode[]; + + #endif /* _MACHINE_NETBSD32_H_ */ diff --git a/sys/arch/sparc64/include/psl.h b/sys/arch/sparc64/include/psl.h index 83306d2bd9a1..2a81de9f413c 100644 --- a/sys/arch/sparc64/include/psl.h +++ b/sys/arch/sparc64/include/psl.h @@ -1,4 +1,4 @@ -/* $NetBSD: psl.h,v 1.6 1999/01/31 09:21:20 mrg Exp $ */ +/* $NetBSD: psl.h,v 1.7 1999/03/26 04:29:21 eeh Exp $ */ /* * Copyright (c) 1992, 1993 @@ -378,6 +378,7 @@ SPLHOLD(splfd, PIL_FD) /* zs hardware interrupts are at level 12 */ SPLHOLD(splzs, PIL_SER) +SPLHOLD(splserial, PIL_SER) /* audio hardware interrupts are at level 13 */ SPLHOLD(splaudio, PIL_AUD) @@ -414,6 +415,7 @@ static __inline void splx(newpil) #define splclock() splclockX(__FILE__, __LINE__) #define splfd() splfdX(__FILE__, __LINE__) #define splzs() splzsX(__FILE__, __LINE__) +#define splserial() splzerialX(__FILE__, __LINE__) #define splaudio() splaudioX(__FILE__, __LINE__) #define splstatclock() splstatclockX(__FILE__, __LINE__) #define splhigh() splhighX(__FILE__, __LINE__) diff --git a/sys/arch/sparc64/include/signal.h b/sys/arch/sparc64/include/signal.h index 1cffd5b8c0d0..d3e69b1a12a6 100644 --- a/sys/arch/sparc64/include/signal.h +++ b/sys/arch/sparc64/include/signal.h @@ -1,4 +1,4 @@ -/* $NetBSD: signal.h,v 1.7 1999/01/31 09:21:20 mrg Exp $ */ +/* $NetBSD: signal.h,v 1.8 1999/03/26 04:29:21 eeh Exp $ */ /* * Copyright (c) 1992, 1993 @@ -94,6 +94,7 @@ struct sigcontext { sigset_t sc_mask; /* signal mask to restore (new style) */ }; #else /* _LOCORE */ +/* XXXXX These values don't work for _LP64 */ #define SC_SP_OFFSET 8 #define SC_PC_OFFSET 12 #define SC_NPC_OFFSET 16 diff --git a/sys/arch/sparc64/sparc64/compat_13_machdep.c b/sys/arch/sparc64/sparc64/compat_13_machdep.c index 80a65021105f..e87cdb6e72ec 100644 --- a/sys/arch/sparc64/sparc64/compat_13_machdep.c +++ b/sys/arch/sparc64/sparc64/compat_13_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: compat_13_machdep.c,v 1.4 1999/01/31 09:21:18 mrg Exp $ */ +/* $NetBSD: compat_13_machdep.c,v 1.5 1999/03/26 04:29:21 eeh Exp $ */ /*- * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc. @@ -47,6 +47,7 @@ #include #include +#include /* * System call to cleanup state after a signal @@ -77,12 +78,33 @@ compat_13_sys_sigreturn(p, v, retval) /* Make sure our D$ is not polluted w/bad data */ blast_vcache(); #endif - if (rwindow_save(p)) + if (rwindow_save(p)) { +#ifdef DEBUG + printf("compat_13_sys_sigreturn: rwindow_save(%p) failed, sending SIGILL\n", p); + Debugger(); +#endif sigexit(p, SIGILL); + } +#ifdef DEBUG + if (sigdebug & SDB_FOLLOW) { + printf("compat_13_sys_sigreturn: %s[%d], sigcntxp %p\n", + p->p_comm, p->p_pid, SCARG(uap, sigcntxp)); + if (sigdebug & SDB_DDB) Debugger(); + } +#endif scp = SCARG(uap, sigcntxp); if ((vaddr_t)scp & 3 || (copyin((caddr_t)scp, &sc, sizeof sc) != 0)) +#ifdef DEBUG + { + printf("compat_13_sys_sigreturn: copyin failed: scp=%p\n", scp); + Debugger(); return (EFAULT); + } +#else + return (EFAULT); +#endif + scp = ≻ tf = p->p_md.md_tf; @@ -94,7 +116,7 @@ compat_13_sys_sigreturn(p, v, retval) if (((scp->sc_pc | scp->sc_npc) & 3) != 0 || scp->sc_pc == 0 || scp->sc_npc == 0) #ifdef DEBUG { - printf("sigreturn13: pc %p or npc %p invalid\n", scp->sc_pc, scp->sc_npc); + printf("compat_13_sys_sigreturn: pc %p or npc %p invalid\n", scp->sc_pc, scp->sc_npc); Debugger(); return (EINVAL); } @@ -111,6 +133,13 @@ compat_13_sys_sigreturn(p, v, retval) tf->tf_global[1] = scp->sc_g1; tf->tf_out[0] = scp->sc_o0; tf->tf_out[6] = scp->sc_sp; +#ifdef DEBUG + if (sigdebug & SDB_FOLLOW) { + printf("compat_13_sys_sigreturn: return trapframe pc=%p sp=%p tstate=%llx\n", + (vaddr_t)tf->tf_pc, (vaddr_t)tf->tf_out[6], tf->tf_tstate); + if (sigdebug & SDB_DDB) Debugger(); + } +#endif if (scp->sc_onstack & SS_ONSTACK) p->p_sigacts->ps_sigstk.ss_flags |= SS_ONSTACK; diff --git a/sys/arch/sparc64/sparc64/genassym.cf b/sys/arch/sparc64/sparc64/genassym.cf index ad5e0851ac21..4dbd3060df6c 100644 --- a/sys/arch/sparc64/sparc64/genassym.cf +++ b/sys/arch/sparc64/sparc64/genassym.cf @@ -1,4 +1,4 @@ -# $NetBSD: genassym.cf,v 1.10 1999/03/22 06:45:15 eeh Exp $ +# $NetBSD: genassym.cf,v 1.11 1999/03/26 04:29:22 eeh Exp $ # # Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -140,15 +140,9 @@ define PM_PHYS offsetof(struct pmap, pm_physaddr) # interrupt/fault metering -ifdef UVM define V_SWTCH offsetof(struct uvmexp, swtch) define V_INTR offsetof(struct uvmexp, intrs) define V_FAULTS offsetof(struct uvmexp, faults) -else -define V_SWTCH offsetof(struct vmmeter, v_swtch) -define V_INTR offsetof(struct vmmeter, v_intr) -define V_FAULTS offsetof(struct vmmeter, v_faults) -endif # CPU info structure #define CPUINFO_FAULTSTATUS offsetof(struct cpu_softc, get_faultstatus) diff --git a/sys/arch/sparc64/sparc64/locore.s b/sys/arch/sparc64/sparc64/locore.s index 691b2bb2c0af..a0f42f092554 100644 --- a/sys/arch/sparc64/sparc64/locore.s +++ b/sys/arch/sparc64/sparc64/locore.s @@ -1,4 +1,4 @@ -/* $NetBSD: locore.s,v 1.35 1999/03/25 17:49:43 mrg Exp $ */ +/* $NetBSD: locore.s,v 1.36 1999/03/26 04:29:22 eeh Exp $ */ /* * Copyright (c) 1996, 1997, 1998 Eduardo Horvath * Copyright (c) 1996 Paul Kranenburg @@ -5577,7 +5577,7 @@ _C_LABEL(sigcode): _C_LABEL(esigcode): #endif -#if defined(COMPAT_SPARC32) || ! defined(_LP64) +#if defined(COMPAT_NETBSD32) || ! defined(_LP64) /* * The following code is copied to the top of the user stack when each * process is exec'ed, and signals are `trampolined' off it. diff --git a/sys/arch/sparc64/sparc64/pmap.c b/sys/arch/sparc64/sparc64/pmap.c index c764437c6d52..740048921cab 100644 --- a/sys/arch/sparc64/sparc64/pmap.c +++ b/sys/arch/sparc64/sparc64/pmap.c @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.27 1999/03/24 05:51:13 mrg Exp $ */ +/* $NetBSD: pmap.c,v 1.28 1999/03/26 04:29:23 eeh Exp $ */ /* #define NO_VCACHE */ /* Don't forget the locked TLB in dostart */ #define HWREF /* #define BOOT_DEBUG */ @@ -2251,8 +2251,8 @@ pmap_dumpmmu(dump, blkno) register daddr_t blkno; register int (*dump) __P((dev_t, daddr_t, caddr_t, size_t)); { - kcore_seg_t *ksegp; - cpu_kcore_hdr_t *kcpup; + kcore_seg_t *kseg; + cpu_kcore_hdr_t *kcpu; phys_ram_seg_t memseg; register int error = 0; register int i, memsegoffset, segmapoffset; @@ -2281,26 +2281,26 @@ pmap_dumpmmu(dump, blkno) ep = &buffer[sizeof(buffer) / sizeof(buffer[0])]; /* Fill in MI segment header */ - ksegp = (kcore_seg_t *)bp; - CORE_SETMAGIC(*ksegp, KCORE_MAGIC, MID_MACHINE, CORE_CPU); - ksegp->c_size = dbtob(pmap_dumpsize()) - ALIGN(sizeof(kcore_seg_t)); + kseg = (kcore_seg_t *)bp; + CORE_SETMAGIC(*kseg, KCORE_MAGIC, MID_MACHINE, CORE_CPU); + kseg->c_size = dbtob(pmap_dumpsize()) - ALIGN(sizeof(kcore_seg_t)); /* Fill in MD segment header (interpreted by MD part of libkvm) */ - kcpup = (cpu_kcore_hdr_t *)((long)bp + ALIGN(sizeof(kcore_seg_t))); - kcpup->cputype = CPU_SUN4U; - kcpup->kernbase = KERNBASE; - kcpup->kphys = (paddr_t)ksegp; - kcpup->nmemseg = memsize; - kcpup->memsegoffset = memsegoffset = ALIGN(sizeof(cpu_kcore_hdr_t)); - kcpup->nsegmap = STSZ; - kcpup->segmapoffset = segmapoffset = + kcpu = (cpu_kcore_hdr_t *)((long)bp + ALIGN(sizeof(kcore_seg_t))); + kcpu->cputype = CPU_SUN4U; + kcpu->kernbase = KERNBASE; + kcpu->kphys = (paddr_t)ksegp; + kcpu->nmemseg = memsize; + kcpu->memsegoffset = memsegoffset = ALIGN(sizeof(cpu_kcore_hdr_t)); + kcpu->nsegmap = STSZ; + kcpu->segmapoffset = segmapoffset = memsegoffset + memsize * sizeof(phys_ram_seg_t); - kcpup->npmeg = 0; - kcpup->pmegoffset = 0; /* We don't do this. */ + kcpu->npmeg = 0; + kcpu->pmegoffset = 0; /* We don't do this. */ /* Note: we have assumed everything fits in buffer[] so far... */ - bp = (int *)((long)kcpup + ALIGN(sizeof(cpu_kcore_hdr_t))); + bp = (int *)((long)kcpu + ALIGN(sizeof(cpu_kcore_hdr_t))); for (i = 0; i < memsize; i++) { memseg.start = mem[i].start; diff --git a/sys/arch/sparc64/sparc64/sunos_machdep.c b/sys/arch/sparc64/sparc64/sunos_machdep.c index b7c320f1a83f..28ff4a0a887b 100644 --- a/sys/arch/sparc64/sparc64/sunos_machdep.c +++ b/sys/arch/sparc64/sparc64/sunos_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: sunos_machdep.c,v 1.5 1998/11/16 06:51:36 eeh Exp $ */ +/* $NetBSD: sunos_machdep.c,v 1.6 1999/03/26 04:29:23 eeh Exp $ */ /* * Copyright (c) 1995 Matthew R. Green @@ -56,12 +56,7 @@ #include #ifdef DEBUG -extern int sigdebug; -extern int sigpid; -#define SDB_FOLLOW 0x01 -#define SDB_KSTACK 0x02 -#define SDB_FPSTATE 0x04 -#define SDB_DDB 0x08 +#include #endif struct sunos_sigcontext { @@ -225,6 +220,13 @@ sunos_sys_sigreturn(p, v, retval) #endif if (rwindow_save(p)) sigexit(p, SIGILL); +#ifdef DEBUG + if (sigdebug & SDB_FOLLOW) { + printf("sunos_sigreturn: %s[%d], sigcntxp %p\n", + p->p_comm, p->p_pid, SCARG(uap, sigcntxp)); + if (sigdebug & SDB_DDB) Debugger(); + } +#endif scp = (struct sunos_sigcontext *)SCARG(uap, sigcntxp); if ((vaddr_t)scp & 3 || (copyin((caddr_t)scp, &sc, sizeof sc) != 0)) @@ -240,7 +242,7 @@ sunos_sys_sigreturn(p, v, retval) if (((scp->sc_pc | scp->sc_npc) & 3) != 0 || scp->sc_pc == 0 || scp->sc_npc == 0) #ifdef DEBUG { - printf("sigreturn13: pc %p or npc %p invalid\n", scp->sc_pc, scp->sc_npc); + printf("sunos_sigreturn: pc %p or npc %p invalid\n", scp->sc_pc, scp->sc_npc); Debugger(); return (EINVAL); } @@ -253,6 +255,13 @@ sunos_sys_sigreturn(p, v, retval) tf->tf_global[1] = scp->sc_g1; tf->tf_out[0] = scp->sc_o0; tf->tf_out[6] = scp->sc_sp; +#ifdef DEBUG + if (sigdebug & SDB_FOLLOW) { + printf("sunos_sigreturn: return trapframe pc=%p sp=%p tstate=%llx\n", + (vaddr_t)tf->tf_pc, (vaddr_t)tf->tf_out[6], tf->tf_tstate); + if (sigdebug & SDB_DDB) Debugger(); + } +#endif if (scp->sc_onstack & SS_ONSTACK) p->p_sigacts->ps_sigstk.ss_flags |= SS_ONSTACK; diff --git a/sys/arch/sparc64/sparc64/svr4_machdep.c b/sys/arch/sparc64/sparc64/svr4_machdep.c index 03f7d4847ea6..a5e47b9fb277 100644 --- a/sys/arch/sparc64/sparc64/svr4_machdep.c +++ b/sys/arch/sparc64/sparc64/svr4_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: svr4_machdep.c,v 1.6 1999/01/21 23:03:10 christos Exp $ */ +/* $NetBSD: svr4_machdep.c,v 1.7 1999/03/26 04:29:26 eeh Exp $ */ /*- * Copyright (c) 1994 The NetBSD Foundation, Inc. @@ -78,12 +78,7 @@ svr4_setregs(p, epp, stack) } #ifdef DEBUG -extern int sigdebug; -extern int sigpid; -#define SDB_FOLLOW 0x01 /* XXX: dup from machdep.c */ -#define SDB_KSTACK 0x02 -#define SDB_FPSTATE 0x04 -#define SDB_DDB 0x08 +#include #endif #ifdef DEBUG_SVR4 @@ -480,7 +475,7 @@ svr4_sendsig(catcher, sig, mask, code) psp->ps_sigstk.ss_size); else fp = (struct svr4_sigframe *)oldsp; - fp = (struct svr4_sigframe *) ((int) (fp - 1) & ~7); + fp = (struct svr4_sigframe *) ((long) (fp - 1) & ~7); #ifdef DEBUG sigpid = p->p_pid; diff --git a/sys/arch/sparc64/stand/bootblk/Makefile b/sys/arch/sparc64/stand/bootblk/Makefile index dca610c62504..e9f5a00a1226 100644 --- a/sys/arch/sparc64/stand/bootblk/Makefile +++ b/sys/arch/sparc64/stand/bootblk/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.3 1999/02/13 02:54:49 lukem Exp $ +# $NetBSD: Makefile,v 1.4 1999/03/26 04:29:26 eeh Exp $ CURDIR= ${.CURDIR} S= ${CURDIR}/../../../.. @@ -6,13 +6,10 @@ S= ${CURDIR}/../../../.. # # Override normal settings # -CC=cc -LORDER=lorder -TSORT=tsort -NM=nm -PROG= bootblk bootblk.text +SCRIPTS= bootblk bootblk.text SRCS= bootblk.fth +CLEANFILES= assym.fth.h machine bootblk bootblk.text MKMAN= no @@ -56,4 +53,4 @@ fake: bootblk bootblk.text ../fakeboot/fakeboot -elf32 /bootblk ../fakeboot/fakeboot -elf32 /bootblk.text - +#.include diff --git a/sys/compat/netbsd32/netbsd32_exec.c b/sys/compat/netbsd32/netbsd32_exec.c index 6c058d296e0f..5ddbf1315e57 100644 --- a/sys/compat/netbsd32/netbsd32_exec.c +++ b/sys/compat/netbsd32/netbsd32_exec.c @@ -1,4 +1,4 @@ -/* $NetBSD: netbsd32_exec.c,v 1.14 1999/03/25 17:57:22 mrg Exp $ */ +/* $NetBSD: netbsd32_exec.c,v 1.15 1999/03/26 04:29:26 eeh Exp $ */ /* from: NetBSD: exec_aout.c,v 1.15 1996/09/26 23:34:46 cgd Exp */ /* @@ -51,7 +51,7 @@ #include #include -#include +#include const char netbsd32_emul_path[] = "/emul/netbsd32"; extern char netbsd32_sigcode[], netbsd32_esigcode[]; diff --git a/sys/kern/exec_conf.c b/sys/kern/exec_conf.c index 0977fd040dcd..1b749066a9a1 100644 --- a/sys/kern/exec_conf.c +++ b/sys/kern/exec_conf.c @@ -1,4 +1,4 @@ -/* $NetBSD: exec_conf.c,v 1.35 1999/03/09 21:02:38 kleink Exp $ */ +/* $NetBSD: exec_conf.c,v 1.36 1999/03/26 04:29:27 eeh Exp $ */ /* * Copyright (c) 1993, 1994 Christopher G. Demetriou @@ -38,7 +38,7 @@ #include "opt_compat_hpux.h" #include "opt_compat_m68k4k.h" #include "opt_compat_svr4.h" -#include "opt_compat_sparc32.h" +#include "opt_compat_netbsd32.h" #include "opt_compat_aout.h" #include @@ -88,8 +88,8 @@ #include #endif -#ifdef COMPAT_SPARC32 -#include +#ifdef COMPAT_NETBSD32 +#include #endif #ifdef COMPAT_VAX1K @@ -146,8 +146,8 @@ struct execsw execsw[] = { #ifdef COMPAT_M68K4K { sizeof(struct exec), exec_m68k4k_makecmds, }, /* m68k4k a.out */ #endif -#ifdef COMPAT_SPARC32 - { sizeof(struct sparc32_exec), exec_sparc32_makecmds, }, /* sparc 32 bit */ +#ifdef COMPAT_NETBSD32 + { sizeof(struct netbsd32_exec), exec_netbsd32_makecmds, }, /* sparc 32 bit */ #endif #ifdef COMPAT_VAX1K { sizeof(struct exec), exec_vax1k_makecmds, }, /* vax1k a.out */