Fix more syscall32 and signal breakage.
This commit is contained in:
parent
aba7891e3d
commit
b6fd7187e0
@ -1,4 +1,4 @@
|
||||
# $NetBSD: Makefile,v 1.5 1998/09/22 02:48:42 eeh Exp $
|
||||
# $NetBSD: Makefile,v 1.6 1998/10/08 02:31:39 eeh Exp $
|
||||
|
||||
# Makefile for sparc64 tags file and boot blocks
|
||||
|
||||
@ -6,6 +6,7 @@ TSPARC64= ../sparc64/tags
|
||||
SSPARC64= ../sparc64/dev/*.[ch] ../sparc64/fpu/*.[ch] \
|
||||
../sparc64/include/*.[ch] ../sparc64/sparc64/*.[ch]
|
||||
ASPARC64= ../sparc64/sparc64/*.s
|
||||
CSPARC64= ../../compat/*/*.[ch]
|
||||
|
||||
# Directories in which to place tags links
|
||||
DSPARC64= conf dev fpu include sparc64
|
||||
@ -20,7 +21,7 @@ tags:
|
||||
sort -o ${TSPARC64} ${TSPARC64}
|
||||
|
||||
TAGS:
|
||||
etags ${SSPARC64} ${COMM} "--regex=/ENTRY(.*)/" \
|
||||
etags ${SSPARC64} ${COMM} ${CSPARC64} "--regex=/ENTRY(.*)/" \
|
||||
"--regex=/FUNC(.*)/" "--regex=/SYSCALL(.*)/" ${ASPARC64}
|
||||
|
||||
links:
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $NetBSD: NONPLUS64,v 1.2 1998/09/13 16:02:47 eeh Exp $
|
||||
# $NetBSD: NONPLUS64,v 1.3 1998/10/08 02:31:39 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_SPARC32 # 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.
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: db_machdep.h,v 1.5 1998/09/05 23:57:26 eeh Exp $ */
|
||||
/* $NetBSD: db_machdep.h,v 1.6 1998/10/08 02:31:39 eeh Exp $ */
|
||||
|
||||
/*
|
||||
* Mach Operating System
|
||||
@ -42,7 +42,7 @@
|
||||
|
||||
/* end of mangling */
|
||||
|
||||
typedef vaddr_t db_addr_t; /* address - unsigned */
|
||||
typedef vaddr_t db_addr_t; /* address - unsigned */
|
||||
typedef long db_expr_t; /* expression - signed */
|
||||
|
||||
#if 1
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: limits.h,v 1.3 1998/09/11 00:05:57 eeh Exp $ */
|
||||
/* $NetBSD: limits.h,v 1.4 1998/10/08 02:31:40 eeh Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988 The Regents of the University of California.
|
||||
@ -53,7 +53,14 @@
|
||||
#define INT_MAX 0x7fffffff /* max value for an int */
|
||||
#define INT_MIN (-0x7fffffff-1) /* min value for an int */
|
||||
|
||||
/* Make sure _LP64 is defined if we have a 64-bit compiler */
|
||||
#if __arch64__||__sparcv9__
|
||||
#ifndef _LP64
|
||||
#define _LP64
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef _LP64
|
||||
#define ULONG_MAX 0xffffffffffffffffUL /* max value for an unsigned long */
|
||||
#define LONG_MAX 0x7fffffffffffffffL /* max value for a long */
|
||||
#define LONG_MIN (-0x7fffffffffffffffL-1) /* min value for a long */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: profile.h,v 1.2 1998/07/07 03:05:03 eeh Exp $ */
|
||||
/* $NetBSD: profile.h,v 1.3 1998/10/08 02:31:40 eeh Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
@ -44,7 +44,7 @@
|
||||
* @(#)profile.h 8.1 (Berkeley) 6/11/93
|
||||
*/
|
||||
|
||||
#ifdef ELF
|
||||
#if defined(ELF)||defined(__ELF__)
|
||||
#define _MCOUNT_SYM "_mcount"
|
||||
#else
|
||||
#define _MCOUNT_SYM "__mcount"
|
||||
@ -56,8 +56,8 @@
|
||||
__asm__(".global mcount");\
|
||||
__asm__("mcount:");\
|
||||
__asm__("add %o7, 8, %o1");\
|
||||
__asm__("1: call 2f; nop; 2:");\
|
||||
__asm__("add %o7," _MCOUNT_SYM "-1b, %o2");\
|
||||
__asm__("1: rd %pc, %o2");\
|
||||
__asm__("add %o2," _MCOUNT_SYM "-1b, %o2");\
|
||||
__asm__("ld [%o2], %o2");\
|
||||
__asm__("jmpl %o2, %g0");\
|
||||
__asm__("add %i7, 8, %o0");
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: signal.h,v 1.5 1998/09/22 02:48:43 eeh Exp $ */
|
||||
/* $NetBSD: signal.h,v 1.6 1998/10/08 02:31:40 eeh Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
@ -65,17 +65,20 @@ typedef int sig_atomic_t;
|
||||
* All machines must have an sc_onstack and sc_mask.
|
||||
*/
|
||||
#if defined(__LIBC12_SOURCE__) || defined(_KERNEL)
|
||||
/* Since we didn't start at 1.3, this is only for sparc32 code */
|
||||
struct sigcontext13 {
|
||||
int sc_onstack; /* sigstack state to restore */
|
||||
int sc_mask; /* signal mask to restore (old style) */
|
||||
/* begin machine dependent portion */
|
||||
int sc_sp; /* %sp to restore */
|
||||
int sc_pc; /* pc to restore */
|
||||
int sc_npc; /* npc to restore */
|
||||
int sc_psr; /* pstate to restore */
|
||||
int sc_g1; /* %g1 to restore */
|
||||
int sc_o0; /* %o0 to restore */
|
||||
long sc_sp; /* %sp to restore */
|
||||
long sc_pc; /* pc to restore */
|
||||
long sc_npc; /* npc to restore */
|
||||
#ifdef _LP64
|
||||
long sc_tstate; /* tstate to restore */
|
||||
#else
|
||||
long sc_psr; /* pstate to restore */
|
||||
#endif
|
||||
long sc_g1; /* %g1 to restore */
|
||||
long sc_o0; /* %o0 to restore */
|
||||
};
|
||||
#endif /* __LIBC12_SOURCE__ || _KERNEL */
|
||||
struct sigcontext {
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: compat_13_machdep.c,v 1.1 1998/09/17 04:52:17 thorpej Exp $ */
|
||||
/* $NetBSD: compat_13_machdep.c,v 1.2 1998/10/08 02:31:40 eeh Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
|
||||
@ -64,9 +64,6 @@ compat_13_sys_sigreturn(p, v, retval)
|
||||
void *v;
|
||||
register_t *retval;
|
||||
{
|
||||
#ifdef _LP64
|
||||
panic("compat_13_sys_sigreturn");
|
||||
#else
|
||||
struct compat_13_sys_sigreturn_args /* {
|
||||
syscallarg(struct sigcontext13 *) sigcntxp;
|
||||
} */ *uap = v;
|
||||
@ -84,7 +81,7 @@ compat_13_sys_sigreturn(p, v, retval)
|
||||
sigexit(p, SIGILL);
|
||||
|
||||
scp = SCARG(uap, sigcntxp);
|
||||
f ((vaddr_t)scp & 3 || (copyin((caddr_t)scp, &sc, sizeof sc) != 0))
|
||||
if ((vaddr_t)scp & 3 || (copyin((caddr_t)scp, &sc, sizeof sc) != 0))
|
||||
return (EFAULT);
|
||||
scp = ≻
|
||||
|
||||
@ -97,7 +94,11 @@ compat_13_sys_sigreturn(p, v, retval)
|
||||
if (((scp->sc_pc | scp->sc_npc) & 3) != 0)
|
||||
return (EINVAL);
|
||||
/* take only psr ICC field */
|
||||
#ifdef _LP64
|
||||
tf->tf_tstate = (int64_t)(tf->tf_tstate & ~TSTATE_CCR) | scp->sc_tstate;
|
||||
#else
|
||||
tf->tf_tstate = (int64_t)(tf->tf_tstate & ~TSTATE_CCR) | PSRCC_TO_TSTATE(scp->sc_psr);
|
||||
#endif
|
||||
tf->tf_pc = scp->sc_pc;
|
||||
tf->tf_npc = scp->sc_npc;
|
||||
tf->tf_global[1] = scp->sc_g1;
|
||||
@ -114,5 +115,4 @@ compat_13_sys_sigreturn(p, v, retval)
|
||||
(void) sigprocmask1(p, SIG_SETMASK, &mask, 0);
|
||||
|
||||
return (EJUSTRETURN);
|
||||
#endif /* _LP64 */
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: db_interface.c,v 1.9 1998/09/22 02:48:43 eeh Exp $ */
|
||||
/* $NetBSD: db_interface.c,v 1.10 1998/10/08 02:31:40 eeh Exp $ */
|
||||
|
||||
/*
|
||||
* Mach Operating System
|
||||
@ -258,6 +258,7 @@ db_read_bytes(addr, size, data)
|
||||
{
|
||||
register char *src;
|
||||
|
||||
addr = addr & 0x0ffffffffL; /* XXXXX */
|
||||
src = (char *)addr;
|
||||
while (size-- > 0) {
|
||||
if (src >= (char *)VM_MIN_KERNEL_ADDRESS)
|
||||
@ -544,11 +545,14 @@ db_proc_cmd(addr, have_addr, count, modif)
|
||||
p->p_pid, p->p_vmspace, p->p_vmspace->vm_map.pmap,
|
||||
p->p_vmspace->vm_map.pmap->pm_ctx,
|
||||
p->p_wchan, p->p_priority, p->p_usrpri);
|
||||
db_printf("thread @ %p = %p tf:%p\n", &p->p_thread, p->p_thread,
|
||||
db_printf("thread @ %p = %p tf:%p ", &p->p_thread, p->p_thread,
|
||||
p->p_md.md_tf);
|
||||
db_printf("maxsaddr:%p ssiz:%dpg or %pB\n",
|
||||
p->p_vmspace->vm_maxsaddr, p->p_vmspace->vm_ssize,
|
||||
ctob(p->p_vmspace->vm_ssize));
|
||||
db_printf("profile timer: %ld sec %ld usec\n",
|
||||
p->p_stats->p_timer[ITIMER_PROF].it_value.tv_sec,
|
||||
p->p_stats->p_timer[ITIMER_PROF].it_value.tv_usec);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: db_trace.c,v 1.6 1998/09/22 02:48:44 eeh Exp $ */
|
||||
/* $NetBSD: db_trace.c,v 1.7 1998/10/08 02:31:40 eeh Exp $ */
|
||||
|
||||
/*
|
||||
* Mach Operating System
|
||||
@ -172,8 +172,11 @@ u_int64_t frame;
|
||||
db_printf("%llx %llx %llx %llx ",
|
||||
f->fr_arg[0], f->fr_arg[1], f->fr_arg[2], f->fr_arg[3]);
|
||||
db_printf("%llx %llx %llxsp %llxpc=",
|
||||
f->fr_arg[0], f->fr_arg[1], f->fr_fp, f->fr_pc);
|
||||
f->fr_arg[4], f->fr_arg[5], f->fr_fp, f->fr_pc);
|
||||
#if 0
|
||||
/* Sometimes this don't work. Dunno why. */
|
||||
db_printsym(f->fr_pc, DB_STGY_PROC);
|
||||
#endif
|
||||
db_printf("\n");
|
||||
} else {
|
||||
struct frame64 fr;
|
||||
@ -187,7 +190,7 @@ u_int64_t frame;
|
||||
db_printf("%llx %llx %llx %llx ",
|
||||
f->fr_arg[0], f->fr_arg[1], f->fr_arg[2], f->fr_arg[3]);
|
||||
db_printf("%llx %llx %llxsp %llxpc=",
|
||||
f->fr_arg[0], f->fr_arg[1], f->fr_fp, f->fr_pc);
|
||||
f->fr_arg[4], f->fr_arg[5], f->fr_fp, f->fr_pc);
|
||||
db_printf("\n");
|
||||
}
|
||||
} else {
|
||||
@ -200,7 +203,7 @@ u_int64_t frame;
|
||||
f->fr_local[4], f->fr_local[5], f->fr_local[6], f->fr_local[7]);
|
||||
db_printf("%8x %8x %8x %8x %8x %8x %8x=sp %8x=pc:",
|
||||
f->fr_arg[0], f->fr_arg[1], f->fr_arg[2], f->fr_arg[3],
|
||||
f->fr_arg[0], f->fr_arg[1], f->fr_fp, f->fr_pc);
|
||||
f->fr_arg[4], f->fr_arg[5], f->fr_fp, f->fr_pc);
|
||||
db_printsym(f->fr_pc, DB_STGY_PROC);
|
||||
db_printf("\n");
|
||||
} else {
|
||||
@ -216,7 +219,7 @@ u_int64_t frame;
|
||||
db_printf("%8x %8x %8x %8x %8x %8x %8x=sp %8x=pc\n",
|
||||
f->fr_arg[0], f->fr_arg[1],
|
||||
f->fr_arg[2], f->fr_arg[3],
|
||||
f->fr_arg[0], f->fr_arg[1],
|
||||
f->fr_arg[4], f->fr_arg[5],
|
||||
f->fr_fp, f->fr_pc);
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: genassym.c,v 1.7 1998/09/17 04:41:06 thorpej Exp $ */
|
||||
/* $NetBSD: genassym.c,v 1.8 1998/10/08 02:31:40 eeh Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
@ -125,6 +125,9 @@ main()
|
||||
off("P_PID", struct proc, p_pid);
|
||||
def("SRUN", SRUN);
|
||||
|
||||
/* user struct stuff */
|
||||
siz("USIZ", struct user); /* Needed for redzone calculations */
|
||||
|
||||
/* VM structure fields */
|
||||
off("VM_PMAP", struct vmspace, vm_map.pmap);
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $NetBSD: genassym.cf,v 1.7 1998/09/17 04:41:06 thorpej Exp $
|
||||
# $NetBSD: genassym.cf,v 1.8 1998/10/08 02:31:40 eeh Exp $
|
||||
|
||||
#
|
||||
# Copyright (c) 1997 The NetBSD Foundation, Inc.
|
||||
@ -126,6 +126,9 @@ define P_VMSPACE offsetof(struct proc, p_vmspace)
|
||||
define P_PID offsetof(struct proc, p_pid)
|
||||
define SRUN SRUN
|
||||
|
||||
# user structure fields
|
||||
define USIZ sizeof(struct user)
|
||||
|
||||
# VM structure fields
|
||||
define VM_PMAP offsetof(struct vmspace, vm_map.pmap)
|
||||
#define VM_PMAP_CTX offsetof(struct vmspace, vm_map.pmap.pm_ctx)
|
||||
|
@ -80,6 +80,9 @@
|
||||
#ifdef COMPAT_SVR4
|
||||
#include <compat/svr4/svr4_syscall.h>
|
||||
#endif
|
||||
#ifdef COMPAT_SPARC32
|
||||
#include <compat/sparc32/sparc32_syscall.h>
|
||||
#endif
|
||||
#include <machine/asm.h>
|
||||
|
||||
/* Let us use same syntax as C code */
|
||||
@ -644,9 +647,17 @@ _C_LABEL(trapbase):
|
||||
|
||||
mov %l0,%l5
|
||||
#ifdef NOT_DEBUG
|
||||
set u0, %o7 ! Check for kernel stack overflow
|
||||
cmp %fp, %o7
|
||||
bl trap_enter
|
||||
!!
|
||||
!! Check the sp redzone
|
||||
!!
|
||||
sethi KERNBASE, t1
|
||||
cmp %sp, t1
|
||||
blu,pt %xcc, 7f
|
||||
sethi %hi(_C_LABEL(redzone)), t1
|
||||
ldx [t1 + %lo(_C_LABEL(redzone))], t2
|
||||
cmp %sp, t2 ! if sp >= t2, not in red zone
|
||||
blu panic_red ! and can continue normally
|
||||
7:
|
||||
#endif
|
||||
mov %l0, %l6; mov %l0, %l7; mov %l0, %o0; mov %l0, %o1
|
||||
|
||||
@ -898,7 +909,19 @@ ktextfault:
|
||||
rdpr %cleanwin, %o7 ! This handler is in-lined and cannot fault
|
||||
inc %o7; mov %l0, %l3; mov %l0, %l4 ! Nucleus (trap&IRQ) code does not need clean windows
|
||||
wrpr %g0, %o7, %cleanwin ! Clear out %l0-%l8 and %o0-%o8 and inc %cleanwin and done
|
||||
|
||||
#ifdef NOT_DEBUG
|
||||
!!
|
||||
!! Check the sp redzone
|
||||
!!
|
||||
sethi KERNBASE, t1
|
||||
cmp %sp, t1
|
||||
blu,pt %xcc, 7f
|
||||
sethi %hi(_C_LABEL(redzone)), t1
|
||||
ldx [t1 + %lo(_C_LABEL(redzone))], t2
|
||||
cmp %sp, t2 ! if sp >= t2, not in red zone
|
||||
blu panic_red ! and can continue normally
|
||||
7:
|
||||
#endif
|
||||
mov %l0, %l5; mov %l0, %l6; mov %l0, %l7
|
||||
mov %l0, %o0; mov %l0, %o1; mov %l0, %o2; mov %l0, %o3
|
||||
|
||||
@ -1222,50 +1245,57 @@ pmap_screwup:
|
||||
* keeping a `red zone' pointer; if %sp becomes less than this, we panic.
|
||||
* This is expensive and is only enabled when debugging.
|
||||
*/
|
||||
#define REDSIZE (8*96) /* some room for bouncing */
|
||||
#define REDSIZE (USIZ) /* Mark used portion of user structure out of bounds */
|
||||
#define REDSTACK 2048 /* size of `panic: stack overflow' region */
|
||||
.data
|
||||
_C_LABEL(redzone):
|
||||
.word _C_LABEL(idle_u) + REDSIZE
|
||||
_C_LABEL(redstack):
|
||||
_ALIGN
|
||||
redzone:
|
||||
.xword _C_LABEL(idle_u) + REDSIZE
|
||||
redstack:
|
||||
.space REDSTACK
|
||||
eredstack:
|
||||
.text
|
||||
Lpanic_red:
|
||||
.asciz "stack overflow"
|
||||
.asciz "kernel stack overflow"
|
||||
_ALIGN
|
||||
|
||||
/* set stack pointer redzone to base+minstack; alters base */
|
||||
#define SET_SP_REDZONE(base, tmp) \
|
||||
add base, REDSIZE, base; \
|
||||
sethi %hi(_C_LABEL(redzone)), tmp; \
|
||||
st base, [tmp + %lo(_C_LABEL(redzone))]
|
||||
stx base, [tmp + %lo(_C_LABEL(redzone))]
|
||||
|
||||
/* variant with a constant */
|
||||
#define SET_SP_REDZONE_CONST(const, tmp1, tmp2) \
|
||||
set (const) + REDSIZE, tmp1; \
|
||||
sethi %hi(_C_LABEL(redzone)), tmp2; \
|
||||
st tmp1, [tmp2 + %lo(_C_LABEL(redzone))]
|
||||
stx tmp1, [tmp2 + %lo(_C_LABEL(redzone))]
|
||||
|
||||
/* check stack pointer against redzone (uses two temps) */
|
||||
#define CHECK_SP_REDZONE(t1, t2) \
|
||||
sethi %hi(_C_LABEL(redzone)), t1; \
|
||||
ld [t1 + %lo(_C_LABEL(redzone))], t2; \
|
||||
sethi KERNBASE, t1; \
|
||||
cmp %sp, t1; \
|
||||
blu,pt %xcc, 7f; \
|
||||
sethi %hi(_C_LABEL(redzone)), t1; \
|
||||
ldx [t1 + %lo(_C_LABEL(redzone))], t2; \
|
||||
cmp %sp, t2; /* if sp >= t2, not in red zone */ \
|
||||
bgeu 7f; nop; /* and can continue normally */ \
|
||||
/* move to panic stack */ \
|
||||
st %g0, [t1 + %lo(_C_LABEL(redzone))]; \
|
||||
set _C_LABEL(redstack) + REDSTACK - 96, %sp; \
|
||||
/* prevent panic() from lowering ipl */ \
|
||||
sethi %hi(_C_LABEL(panicstr)), t2; \
|
||||
set Lpanic_red, t2; \
|
||||
st t2, [t1 + %lo(_C_LABEL(panicstr))]; \
|
||||
rdpr %pil, t1; /* t1 = splhigh() */ \
|
||||
or t1, PSR_PIL, t2; \
|
||||
wrpr t2, 0, %pil; \
|
||||
save %sp, -CCFSZ, %sp; /* preserve current window */ \
|
||||
sethi %hi(Lpanic_red), %o0; \
|
||||
call _C_LABEL(panic); or %o0, %lo(Lpanic_red), %o0; \
|
||||
7:
|
||||
blu panic_red; nop; /* and can continue normally */ \
|
||||
7:
|
||||
|
||||
panic_red:
|
||||
/* move to panic stack */
|
||||
stx %g0, [t1 + %lo(_C_LABEL(redzone))];
|
||||
set eredstack - BIAS, %sp;
|
||||
/* prevent panic() from lowering ipl */
|
||||
sethi %hi(_C_LABEL(panicstr)), t2;
|
||||
set Lpanic_red, t2;
|
||||
st t2, [t1 + %lo(_C_LABEL(panicstr))];
|
||||
wrpr g0, 15, %pil /* t1 = splhigh() */
|
||||
save %sp, -CCF64SZ, %sp; /* preserve current window */
|
||||
sethi %hi(Lpanic_red), %o0;
|
||||
call _C_LABEL(panic);
|
||||
or %o0, %lo(Lpanic_red), %o0;
|
||||
|
||||
|
||||
#else
|
||||
|
||||
@ -5505,11 +5535,11 @@ _C_LABEL(sigcode):
|
||||
mov %l7, %g7
|
||||
|
||||
#ifdef _LP64
|
||||
restore %g0, sparc32_SYS_sigreturn, %g1 ! get registers back & set syscall #
|
||||
restore %g0, sparc32_SYS_compat_sparc32_sigreturn, %g1 ! get registers back & set syscall #
|
||||
add %sp, 64 + 16, %o0 ! compute scp
|
||||
t ST_SYSCALL ! sigreturn(scp)
|
||||
! sigreturn does not return unless it fails
|
||||
mov sparc32_SYS_exit, %g1 ! exit(errno)
|
||||
mov sparc32_SYS_compat_sparc32_exit, %g1 ! exit(errno)
|
||||
t ST_SYSCALL
|
||||
_C_LABEL(sparc32_esigcode):
|
||||
#else
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ofw_machdep.c,v 1.4 1998/08/27 06:23:32 eeh Exp $ */
|
||||
/* $NetBSD: ofw_machdep.c,v 1.5 1998/10/08 02:31:41 eeh Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1996 Wolfgang Solfrank.
|
||||
@ -591,124 +591,3 @@ prom_printf(fmt, va_alist)
|
||||
|
||||
OF_write(OF_stdout(), buf, len);
|
||||
}
|
||||
|
||||
static char *ksprintn __P((u_long, int, int *));
|
||||
|
||||
/*
|
||||
* Scaled down version of sprintf(3) modified to deal w/va_args.
|
||||
*/
|
||||
int
|
||||
vsprintf(buf, cfmt, ap)
|
||||
char *buf;
|
||||
const char *cfmt;
|
||||
va_list ap;
|
||||
{
|
||||
register const char *fmt = cfmt;
|
||||
register char *p, *bp;
|
||||
register int ch, base;
|
||||
u_long ul;
|
||||
int lflag, tmp, width;
|
||||
char padc;
|
||||
|
||||
for (bp = buf; ; ) {
|
||||
padc = ' ';
|
||||
width = 0;
|
||||
while ((ch = *(u_char *)fmt++) != '%')
|
||||
if ((*bp++ = ch) == '\0')
|
||||
return ((bp - buf) - 1);
|
||||
|
||||
lflag = 0;
|
||||
reswitch: switch (ch = *(u_char *)fmt++) {
|
||||
case '0':
|
||||
padc = '0';
|
||||
goto reswitch;
|
||||
case '1': case '2': case '3': case '4':
|
||||
case '5': case '6': case '7': case '8': case '9':
|
||||
for (width = 0;; ++fmt) {
|
||||
width = width * 10 + ch - '0';
|
||||
ch = *fmt;
|
||||
if (ch < '0' || ch > '9')
|
||||
break;
|
||||
}
|
||||
goto reswitch;
|
||||
case 'l':
|
||||
lflag = 1;
|
||||
goto reswitch;
|
||||
/* case 'b': ... break; XXX */
|
||||
case 'c':
|
||||
*bp++ = va_arg(ap, int);
|
||||
break;
|
||||
/* case 'r': ... break; XXX */
|
||||
case 's':
|
||||
p = va_arg(ap, char *);
|
||||
while ((*bp++ = *p++) != 0)
|
||||
continue;
|
||||
--bp;
|
||||
break;
|
||||
case 'd':
|
||||
ul = lflag ? va_arg(ap, long) : va_arg(ap, int);
|
||||
if ((long)ul < 0) {
|
||||
*bp++ = '-';
|
||||
ul = -(long)ul;
|
||||
}
|
||||
base = 10;
|
||||
goto number;
|
||||
break;
|
||||
case 'o':
|
||||
ul = lflag ? va_arg(ap, u_long) : va_arg(ap, u_int);
|
||||
base = 8;
|
||||
goto number;
|
||||
break;
|
||||
case 'u':
|
||||
ul = lflag ? va_arg(ap, u_long) : va_arg(ap, u_int);
|
||||
base = 10;
|
||||
goto number;
|
||||
break;
|
||||
case 'p':
|
||||
*bp++ = '0';
|
||||
*bp++ = 'x';
|
||||
ul = (u_long)va_arg(ap, void *);
|
||||
base = 16;
|
||||
goto number;
|
||||
case 'x':
|
||||
ul = lflag ? va_arg(ap, u_long) : va_arg(ap, u_int);
|
||||
base = 16;
|
||||
number: p = ksprintn(ul, base, &tmp);
|
||||
if (width && (width -= tmp) > 0)
|
||||
while (width--)
|
||||
*bp++ = padc;
|
||||
while ((ch = *p--) != 0)
|
||||
*bp++ = ch;
|
||||
break;
|
||||
default:
|
||||
*bp++ = '%';
|
||||
if (lflag)
|
||||
*bp++ = 'l';
|
||||
/* FALLTHROUGH */
|
||||
case '%':
|
||||
*bp++ = ch;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Put a number (base <= 16) in a buffer in reverse order; return an
|
||||
* optional length and a pointer to the NULL terminated (preceded?)
|
||||
* buffer.
|
||||
*/
|
||||
static char *
|
||||
ksprintn(ul, base, lenp)
|
||||
register u_long ul;
|
||||
register int base, *lenp;
|
||||
{ /* A long in base 8, plus NULL. */
|
||||
static char buf[sizeof(long) * NBBY / 3 + 2];
|
||||
register char *p;
|
||||
|
||||
p = buf;
|
||||
do {
|
||||
*++p = "0123456789abcdef"[ul % base];
|
||||
} while (ul /= base);
|
||||
if (lenp)
|
||||
*lenp = p - buf;
|
||||
return (p);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: sunos_machdep.c,v 1.3 1998/09/22 02:48:45 eeh Exp $ */
|
||||
/* $NetBSD: sunos_machdep.c,v 1.4 1998/10/08 02:31:41 eeh Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995 Matthew R. Green
|
||||
@ -56,20 +56,32 @@
|
||||
#include <machine/cpu.h>
|
||||
|
||||
#ifdef DEBUG
|
||||
int sunos_sigdebug = 0;
|
||||
int sunos_sigpid = 0;
|
||||
extern int sigdebug;
|
||||
extern int sigpid;
|
||||
#define SDB_FOLLOW 0x01
|
||||
#define SDB_KSTACK 0x02
|
||||
#define SDB_FPSTATE 0x04
|
||||
#define SDB_DDB 0x08
|
||||
#endif
|
||||
|
||||
struct sunos_sigcontext {
|
||||
int sc_onstack; /* sigstack state to restore */
|
||||
int sc_mask; /* signal mask to restore (old style) */
|
||||
/* begin machine dependent portion */
|
||||
int sc_sp; /* %sp to restore */
|
||||
int sc_pc; /* pc to restore */
|
||||
int sc_npc; /* npc to restore */
|
||||
int sc_psr; /* pstate to restore */
|
||||
int sc_g1; /* %g1 to restore */
|
||||
int sc_o0; /* %o0 to restore */
|
||||
};
|
||||
|
||||
struct sunos_sigframe {
|
||||
int sf_signo; /* signal number */
|
||||
int sf_code; /* code */
|
||||
struct sigcontext13 *sf_scp; /* SunOS user addr of sigcontext */
|
||||
u_int32_t sf_scp; /* SunOS user addr of sigcontext */
|
||||
int sf_addr; /* SunOS compat, always 0 for now */
|
||||
struct sigcontext13 sf_sc; /* actual sigcontext */
|
||||
struct sunos_sigcontext sf_sc; /* actual sigcontext */
|
||||
};
|
||||
|
||||
void
|
||||
@ -86,8 +98,6 @@ sunos_sendsig(catcher, sig, mask, code)
|
||||
register int addr, onstack;
|
||||
struct rwindow32 *kwin, *oldsp, *newsp;
|
||||
struct sunos_sigframe sf;
|
||||
extern char sigcode[], esigcode[];
|
||||
#define szsigcode (esigcode - sigcode)
|
||||
|
||||
tf = p->p_md.md_tf;
|
||||
/* Need to attempt to zero extend this 32-bit pointer */
|
||||
@ -108,11 +118,11 @@ sunos_sendsig(catcher, sig, mask, code)
|
||||
fp = (struct sunos_sigframe *)((long)(fp - 1) & ~7);
|
||||
|
||||
#ifdef DEBUG
|
||||
sunos_sigpid = p->p_pid;
|
||||
if ((sunos_sigdebug & SDB_KSTACK) && p->p_pid == sunos_sigpid) {
|
||||
printf("sendsig: %s[%d] sig %d newusp %p scp %p oldsp %p\n",
|
||||
sigpid = p->p_pid;
|
||||
if ((sigdebug & SDB_KSTACK) && p->p_pid == sigpid) {
|
||||
printf("sunos_sendsig: %s[%d] sig %d newusp %p scp %p oldsp %p\n",
|
||||
p->p_comm, p->p_pid, sig, fp, &fp->sf_sc, oldsp);
|
||||
if (sunos_sigdebug & SDB_DDB) Debugger();
|
||||
if (sigdebug & SDB_DDB) Debugger();
|
||||
}
|
||||
#endif
|
||||
/*
|
||||
@ -149,8 +159,8 @@ sunos_sendsig(catcher, sig, mask, code)
|
||||
newsp = (struct rwindow32 *)((long)fp - sizeof(struct rwindow32));
|
||||
write_user_windows();
|
||||
#ifdef DEBUG
|
||||
if ((sunos_sigdebug & SDB_KSTACK))
|
||||
printf("sendsig: saving sf to %p, setting stack pointer %p to %p\n",
|
||||
if ((sigdebug & SDB_KSTACK))
|
||||
printf("sunos_sendsig: saving sf to %p, setting stack pointer %p to %p\n",
|
||||
fp, &(((union rwindow *)newsp)->v8.rw_in[6]), oldsp);
|
||||
#endif
|
||||
kwin = (struct rwindow32 *)(((caddr_t)tf)-CCFSZ);
|
||||
@ -162,18 +172,18 @@ sunos_sendsig(catcher, sig, mask, code)
|
||||
* instruction to halt it in its tracks.
|
||||
*/
|
||||
#ifdef DEBUG
|
||||
if ((sunos_sigdebug & SDB_KSTACK) && p->p_pid == sunos_sigpid)
|
||||
printf("sendsig: window save or copyout error\n");
|
||||
printf("sendsig: stack was trashed trying to send sig %d, sending SIGILL\n", sig);
|
||||
if (sunos_sigdebug & SDB_DDB) Debugger();
|
||||
if ((sigdebug & SDB_KSTACK) && p->p_pid == sigpid)
|
||||
printf("sunos_sendsig: window save or copyout error\n");
|
||||
printf("sunos_sendsig: stack was trashed trying to send sig %d, sending SIGILL\n", sig);
|
||||
if (sigdebug & SDB_DDB) Debugger();
|
||||
#endif
|
||||
sigexit(p, SIGILL);
|
||||
/* NOTREACHED */
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
if (sunos_sigdebug & SDB_FOLLOW) {
|
||||
printf("sendsig: %s[%d] sig %d scp %p\n",
|
||||
if (sigdebug & SDB_FOLLOW) {
|
||||
printf("sunos_sendsig: %s[%d] sig %d scp %p\n",
|
||||
p->p_comm, p->p_pid, sig, &fp->sf_sc);
|
||||
}
|
||||
#endif
|
||||
@ -186,10 +196,10 @@ sunos_sendsig(catcher, sig, mask, code)
|
||||
tf->tf_npc = addr + 4;
|
||||
tf->tf_out[6] = (u_int64_t)(u_int)(u_long)newsp;
|
||||
#ifdef DEBUG
|
||||
if ((sunos_sigdebug & SDB_KSTACK) && p->p_pid == sunos_sigpid) {
|
||||
printf("sendsig: about to return to catcher %p thru %p\n",
|
||||
if ((sigdebug & SDB_KSTACK) && p->p_pid == sigpid) {
|
||||
printf("sunos_sendsig: about to return to catcher %p thru %p\n",
|
||||
catcher, addr);
|
||||
if (sunos_sigdebug & SDB_DDB) Debugger();
|
||||
if (sigdebug & SDB_DDB) Debugger();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@ -200,7 +210,51 @@ sunos_sys_sigreturn(p, v, retval)
|
||||
void *v;
|
||||
register_t *retval;
|
||||
{
|
||||
struct sunos_sys_sigreturn_args *uap = v;
|
||||
struct sunos_sys_sigreturn_args /*
|
||||
syscallarg(struct sigcontext13 *) sigcntxp;
|
||||
} */ *uap = v;
|
||||
struct sunos_sigcontext sc, *scp;
|
||||
sigset_t mask;
|
||||
struct trapframe *tf;
|
||||
|
||||
return (sys___sigreturn14(p, (struct sys_sigreturn_args *)uap, retval));
|
||||
/* First ensure consistent stack state (see sendsig). */
|
||||
write_user_windows();
|
||||
#if 0
|
||||
/* Make sure our D$ is not polluted w/bad data */
|
||||
blast_vcache();
|
||||
#endif
|
||||
if (rwindow_save(p))
|
||||
sigexit(p, SIGILL);
|
||||
|
||||
scp = (struct sunos_sigcontext *)SCARG(uap, sigcntxp);
|
||||
if ((vaddr_t)scp & 3 || (copyin((caddr_t)scp, &sc, sizeof sc) != 0))
|
||||
return (EFAULT);
|
||||
scp = ≻
|
||||
|
||||
tf = p->p_md.md_tf;
|
||||
/*
|
||||
* Only the icc bits in the psr are used, so it need not be
|
||||
* verified. pc and npc must be multiples of 4. This is all
|
||||
* that is required; if it holds, just do it.
|
||||
*/
|
||||
if (((scp->sc_pc | scp->sc_npc) & 3) != 0)
|
||||
return (EINVAL);
|
||||
/* take only psr ICC field */
|
||||
tf->tf_tstate = (int64_t)(tf->tf_tstate & ~TSTATE_CCR) | PSRCC_TO_TSTATE(scp->sc_psr);
|
||||
tf->tf_pc = scp->sc_pc;
|
||||
tf->tf_npc = scp->sc_npc;
|
||||
tf->tf_global[1] = scp->sc_g1;
|
||||
tf->tf_out[0] = scp->sc_o0;
|
||||
tf->tf_out[6] = scp->sc_sp;
|
||||
|
||||
if (scp->sc_onstack & SS_ONSTACK)
|
||||
p->p_sigacts->ps_sigstk.ss_flags |= SS_ONSTACK;
|
||||
else
|
||||
p->p_sigacts->ps_sigstk.ss_flags &= ~SS_ONSTACK;
|
||||
|
||||
/* Restore signal mask */
|
||||
native_sigset13_to_sigset(&scp->sc_mask, &mask);
|
||||
(void) sigprocmask1(p, SIG_SETMASK, &mask, 0);
|
||||
|
||||
return (EJUSTRETURN);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: svr4_machdep.c,v 1.4 1998/09/11 13:31:40 mycroft Exp $ */
|
||||
/* $NetBSD: svr4_machdep.c,v 1.5 1998/10/08 02:31:41 eeh Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1994 The NetBSD Foundation, Inc.
|
||||
@ -83,6 +83,7 @@ extern int sigpid;
|
||||
#define SDB_FOLLOW 0x01 /* XXX: dup from machdep.c */
|
||||
#define SDB_KSTACK 0x02
|
||||
#define SDB_FPSTATE 0x04
|
||||
#define SDB_DDB 0x08
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_SVR4
|
||||
@ -491,7 +492,8 @@ svr4_sendsig(catcher, sig, mask, code)
|
||||
register struct trapframe *tf;
|
||||
struct svr4_sigframe *fp, frame;
|
||||
struct sigacts *psp = p->p_sigacts;
|
||||
int onstack, oldsp, newsp, addr;
|
||||
int onstack;
|
||||
vaddr_t oldsp, newsp, addr;
|
||||
|
||||
tf = (struct trapframe *)p->p_md.md_tf;
|
||||
oldsp = tf->tf_out[6];
|
||||
@ -511,6 +513,14 @@ svr4_sendsig(catcher, sig, mask, code)
|
||||
fp = (struct svr4_sigframe *)oldsp;
|
||||
fp = (struct svr4_sigframe *) ((int) (fp - 1) & ~7);
|
||||
|
||||
#ifdef DEBUG
|
||||
sigpid = p->p_pid;
|
||||
if ((sigdebug & SDB_KSTACK) && p->p_pid == sigpid) {
|
||||
printf("svr4_sendsig: %s[%d] sig %d newusp %p scp %p oldsp %p\n",
|
||||
p->p_comm, p->p_pid, sig, fp, &fp->sf_uc, oldsp);
|
||||
if (sigdebug & SDB_DDB) Debugger();
|
||||
}
|
||||
#endif
|
||||
/*
|
||||
* Build the argument list for the signal handler.
|
||||
*/
|
||||
@ -531,9 +541,14 @@ svr4_sendsig(catcher, sig, mask, code)
|
||||
*/
|
||||
frame.sf_uc.uc_mcontext.greg[SVR4_SPARC_SP] = oldsp;
|
||||
|
||||
newsp = (int)fp - sizeof(struct rwindow32);
|
||||
newsp = (u_long)fp - sizeof(struct rwindow32);
|
||||
write_user_windows();
|
||||
|
||||
#ifdef DEBUG
|
||||
if ((sigdebug & SDB_KSTACK))
|
||||
printf("svr4_sendsig: saving sf to %p, setting stack pointer %p to %p\n",
|
||||
fp, &(((union rwindow *)newsp)->v8.rw_in[6]), oldsp);
|
||||
#endif
|
||||
if (rwindow_save(p) || copyout(&frame, fp, sizeof(frame)) != 0 ||
|
||||
copyout(&oldsp, &((struct rwindow32 *)newsp)->rw_in[6], sizeof(oldsp))) {
|
||||
/*
|
||||
@ -550,18 +565,31 @@ svr4_sendsig(catcher, sig, mask, code)
|
||||
/* NOTREACHED */
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
if (sigdebug & SDB_FOLLOW) {
|
||||
printf("svr4_sendsig: %s[%d] sig %d scp %p\n",
|
||||
p->p_comm, p->p_pid, sig, &fp->sf_uc);
|
||||
}
|
||||
#endif
|
||||
/*
|
||||
* Build context to run handler in.
|
||||
*/
|
||||
addr = (int)psp->ps_sigcode;
|
||||
addr = (vaddr_t)psp->ps_sigcode;
|
||||
tf->tf_pc = addr;
|
||||
tf->tf_npc = addr + 4;
|
||||
tf->tf_global[1] = (int)catcher;
|
||||
tf->tf_global[1] = (vaddr_t)catcher;
|
||||
tf->tf_out[6] = newsp;
|
||||
|
||||
/* Remember that we're now on the signal stack. */
|
||||
if (onstack)
|
||||
psp->ps_sigstk.ss_flags |= SS_ONSTACK;
|
||||
#ifdef DEBUG
|
||||
if ((sigdebug & SDB_KSTACK) && p->p_pid == sigpid) {
|
||||
printf("svr4_sendsig: about to return to catcher %p thru %p\n",
|
||||
catcher, addr);
|
||||
if (sigdebug & SDB_DDB) Debugger();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: trap.c,v 1.17 1998/09/22 02:48:45 eeh Exp $ */
|
||||
/* $NetBSD: trap.c,v 1.18 1998/10/08 02:31:41 eeh Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996
|
||||
@ -52,6 +52,7 @@
|
||||
#include "opt_ktrace.h"
|
||||
#include "opt_uvm.h"
|
||||
#include "opt_compat_svr4.h"
|
||||
#include "opt_compat_sparc32.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -541,7 +542,7 @@ trap(type, tstate, pc, tf)
|
||||
cnt.v_trap++;
|
||||
#endif
|
||||
#ifdef DEBUG
|
||||
if ((trapdebug & TDB_TL) && tl()) {
|
||||
if ((trapdebug&(TDB_FOLLOW|TDB_TRAP)) || ((trapdebug & TDB_TL) && tl())) {
|
||||
extern int trap_trace_dis;
|
||||
trap_trace_dis = 1;
|
||||
printf("trap: type 0x%x: lvl=%d pc=%lx &tf=%lx",
|
||||
@ -1855,7 +1856,7 @@ syscall(code, tf, pc)
|
||||
#ifdef DEBUG
|
||||
/* printf("code=%x, nsys=%x\n", code, nsys);*/
|
||||
if (trapdebug&(TDB_SYSCALL|TDB_FOLLOW))
|
||||
printf("%d syscall(%x): tstate=%x:%x %s\n", curproc?curproc->p_pid:-1, code,
|
||||
printf("%d syscall(%d[%x]): tstate=%x:%x %s\n", curproc?curproc->p_pid:-1, code, code,
|
||||
(int)(tf->tf_tstate>>32), (int)(tf->tf_tstate),
|
||||
(code < 0 || code >= nsys)? "illegal syscall" : p->p_emul->e_syscallnames[code]);
|
||||
p->p_addr->u_pcb.lastcall = ((code < 0 || code >= nsys)? "illegal syscall" : p->p_emul->e_syscallnames[code]);
|
||||
@ -1932,18 +1933,15 @@ syscall(code, tf, pc)
|
||||
register32_t *argp;
|
||||
/* 32-bit stack */
|
||||
callp += code;
|
||||
#ifdef _LP64
|
||||
|
||||
#if defined(_LP64) && COMPAT_SPARC32 != 1
|
||||
#ifdef DEBUG
|
||||
printf("syscall(): 32-bit stack on a 64-bit kernel????\n");
|
||||
Debugger();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if 1
|
||||
i = (long)callp->sy_argsize / sizeof(register32_t);
|
||||
#else
|
||||
i = callp->sy_narg; /* Why divide? */
|
||||
#endif
|
||||
if (i > nap) { /* usually false */
|
||||
register32_t temp[6];
|
||||
int j = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user