SA_SIGINFO support for m68k
This commit is contained in:
parent
20dfd3bdde
commit
9289d63920
@ -1,4 +1,4 @@
|
||||
# $NetBSD: files.m68k,v 1.35 2003/06/24 19:55:22 martin Exp $
|
||||
# $NetBSD: files.m68k,v 1.36 2003/09/22 14:18:33 cl Exp $
|
||||
#
|
||||
|
||||
defflag opt_fpsp.h FPSP
|
||||
@ -29,6 +29,7 @@ file arch/m68k/m68k/svr4_syscall.c compat_svr4
|
||||
file arch/m68k/m68k/linux_syscall.c compat_linux
|
||||
|
||||
file arch/m68k/m68k/compat_13_machdep.c compat_13
|
||||
file arch/m68k/m68k/compat_16_machdep.c compat_16
|
||||
|
||||
|
||||
file arch/m68k/m68k/svr4_machdep.c compat_svr4
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: fpu_emulate.c,v 1.24 2003/07/15 02:43:09 lukem Exp $ */
|
||||
/* $NetBSD: fpu_emulate.c,v 1.25 2003/09/22 14:18:34 cl Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995 Gordon W. Ross
|
||||
@ -37,7 +37,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: fpu_emulate.c,v 1.24 2003/07/15 02:43:09 lukem Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: fpu_emulate.c,v 1.25 2003/09/22 14:18:34 cl Exp $");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/signal.h>
|
||||
@ -50,6 +50,14 @@ __KERNEL_RCSID(0, "$NetBSD: fpu_emulate.c,v 1.24 2003/07/15 02:43:09 lukem Exp $
|
||||
|
||||
#include "fpu_emulate.h"
|
||||
|
||||
#define fpe_abort(tfp, ksi, signo, code) \
|
||||
do { \
|
||||
(ksi)->ksi_signo = (signo); \
|
||||
(ksi)->ksi_code = (code); \
|
||||
(ksi)->ksi_addr = (void *)(frame)->f_pc; \
|
||||
return -1; \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
static int fpu_emul_fmovmcr __P((struct fpemu *fe, struct instruction *insn));
|
||||
static int fpu_emul_fmovm __P((struct fpemu *fe, struct instruction *insn));
|
||||
static int fpu_emul_arith __P((struct fpemu *fe, struct instruction *insn));
|
||||
@ -73,9 +81,10 @@ static struct fpn *fpu_cmp __P((struct fpemu *fe));
|
||||
* (Typically: zero, SIGFPE, SIGILL, SIGSEGV)
|
||||
*/
|
||||
int
|
||||
fpu_emulate(frame, fpf)
|
||||
fpu_emulate(frame, fpf, ksi)
|
||||
struct frame *frame;
|
||||
struct fpframe *fpf;
|
||||
ksiginfo_t *ksi;
|
||||
{
|
||||
static struct instruction insn;
|
||||
static struct fpemu fe;
|
||||
@ -121,21 +130,21 @@ fpu_emulate(frame, fpf)
|
||||
#ifdef DEBUG
|
||||
printf("fpu_emulate: fault reading opcode\n");
|
||||
#endif
|
||||
return SIGSEGV;
|
||||
fpe_abort(frame, ksi, SIGSEGV, SEGV_ACCERR);
|
||||
}
|
||||
|
||||
if ((word & 0xf000) != 0xf000) {
|
||||
#ifdef DEBUG
|
||||
printf("fpu_emulate: not coproc. insn.: opcode=0x%x\n", word);
|
||||
#endif
|
||||
return SIGILL;
|
||||
fpe_abort(frame, ksi, SIGILL, ILL_ILLOPC);
|
||||
}
|
||||
|
||||
if ((word & 0x0E00) != 0x0200) {
|
||||
#ifdef DEBUG
|
||||
printf("fpu_emulate: bad coproc. id: opcode=0x%x\n", word);
|
||||
#endif
|
||||
return SIGILL;
|
||||
fpe_abort(frame, ksi, SIGILL, ILL_ILLOPC);
|
||||
}
|
||||
|
||||
insn.is_opcode = word;
|
||||
@ -146,7 +155,7 @@ fpu_emulate(frame, fpf)
|
||||
#ifdef DEBUG
|
||||
printf("fpu_emulate: fault reading word1\n");
|
||||
#endif
|
||||
return SIGSEGV;
|
||||
fpe_abort(frame, ksi, SIGSEGV, SEGV_ACCERR);
|
||||
}
|
||||
insn.is_word1 = word;
|
||||
/* all FPU instructions are at least 4-byte long */
|
||||
@ -255,6 +264,8 @@ fpu_emulate(frame, fpf)
|
||||
fe.fe_fpsr, fe.fe_fpcr);
|
||||
#endif
|
||||
|
||||
if (sig)
|
||||
fpe_abort(frame, ksi, sig, 0);
|
||||
return (sig);
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: fpu_emulate.h,v 1.9 2001/07/05 08:38:25 toshii Exp $ */
|
||||
/* $NetBSD: fpu_emulate.h,v 1.10 2003/09/22 14:18:35 cl Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995 Gordon Ross
|
||||
@ -35,6 +35,9 @@
|
||||
#define _FPU_EMULATE_H_
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/signal.h>
|
||||
#include <sys/signalvar.h>
|
||||
#include <sys/siginfo.h>
|
||||
|
||||
/*
|
||||
* Floating point emulator (tailored for SPARC/modified for m68k, but
|
||||
@ -289,7 +292,7 @@ int fpu_emul_fscale __P((struct fpemu *fe, struct instruction *insn));
|
||||
*/
|
||||
#include "fpu_arith_proto.h"
|
||||
|
||||
int fpu_emulate __P((struct frame *frame, struct fpframe *fpf));
|
||||
int fpu_emulate __P((struct frame *frame, struct fpframe *fpf, ksiginfo_t *ksi));
|
||||
|
||||
/*
|
||||
* "helper" functions
|
||||
|
@ -1,11 +1,11 @@
|
||||
# $NetBSD: Makefile,v 1.20 2003/01/17 23:18:28 thorpej Exp $
|
||||
# $NetBSD: Makefile,v 1.21 2003/09/22 14:18:36 cl Exp $
|
||||
|
||||
INCSDIR= /usr/include/m68k
|
||||
|
||||
INCS= ansi.h aout_machdep.h asm.h asm_single.h \
|
||||
bswap.h bus_dma.h byte_swap.h \
|
||||
cacheops.h cacheops_20.h cacheops_30.h cacheops_40.h cacheops_60.h \
|
||||
cdefs.h cpu.h \
|
||||
cdefs.h cpu.h cpuframe.h \
|
||||
db_machdep.h \
|
||||
elf_machdep.h endian.h endian_machdep.h \
|
||||
float.h frame.h \
|
||||
|
372
sys/arch/m68k/include/cpuframe.h
Normal file
372
sys/arch/m68k/include/cpuframe.h
Normal file
@ -0,0 +1,372 @@
|
||||
/* $NetBSD: cpuframe.h,v 1.1 2003/09/22 14:18:37 cl Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1990, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* the Systems Programming Group of the University of Utah Computer
|
||||
* Science Department.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: Utah $Hdr: frame.h 1.8 92/12/20$
|
||||
*
|
||||
* @(#)frame.h 8.1 (Berkeley) 6/10/93
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 1988 University of Utah.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* the Systems Programming Group of the University of Utah Computer
|
||||
* Science Department.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: Utah $Hdr: frame.h 1.8 92/12/20$
|
||||
*
|
||||
* @(#)frame.h 8.1 (Berkeley) 6/10/93
|
||||
*/
|
||||
|
||||
#ifndef _M68K_CPUFRAME_H_
|
||||
#define _M68K_CPUFRAME_H_
|
||||
|
||||
struct frame {
|
||||
struct trapframe {
|
||||
int tf_regs[16];
|
||||
short tf_pad;
|
||||
short tf_stackadj;
|
||||
u_short tf_sr;
|
||||
u_int tf_pc;
|
||||
u_short tf_format:4,
|
||||
tf_vector:12;
|
||||
} __attribute__((packed)) F_t;
|
||||
union F_u {
|
||||
struct fmt2 {
|
||||
u_int f_iaddr;
|
||||
} F_fmt2;
|
||||
|
||||
struct fmt3 {
|
||||
u_int f_ea;
|
||||
} F_fmt3;
|
||||
|
||||
struct fmt4 {
|
||||
u_int f_fa;
|
||||
u_int f_fslw;
|
||||
/* for 060FP type 4 FP disabled frames: */
|
||||
#define f_fea f_fa
|
||||
#define f_pcfi f_fslw
|
||||
} F_fmt4;
|
||||
|
||||
struct fmt7 {
|
||||
u_int f_ea;
|
||||
u_short f_ssw;
|
||||
u_short f_wb3s, f_wb2s, f_wb1s;
|
||||
u_int f_fa;
|
||||
u_int f_wb3a, f_wb3d;
|
||||
u_int f_wb2a, f_wb2d;
|
||||
u_int f_wb1a, f_wb1d;
|
||||
#define f_pd0 f_wb1d
|
||||
u_int f_pd1, f_pd2, f_pd3;
|
||||
} F_fmt7;
|
||||
|
||||
struct fmt8 {
|
||||
u_short f_ssw;
|
||||
u_int f_accaddr;
|
||||
u_short f_ir0;
|
||||
u_short f_dob;
|
||||
u_short f_ir1;
|
||||
u_short f_dib;
|
||||
u_short f_ir2;
|
||||
u_short f_irc;
|
||||
u_short f_maskpc;
|
||||
u_short f_iregs[15];
|
||||
} __attribute__((packed)) F_fmt8;
|
||||
|
||||
struct fmt9 {
|
||||
u_int f_iaddr;
|
||||
u_short f_iregs[4];
|
||||
} F_fmt9;
|
||||
|
||||
struct fmtA {
|
||||
u_short f_ir0;
|
||||
u_short f_ssw;
|
||||
u_short f_ipsc;
|
||||
u_short f_ipsb;
|
||||
u_int f_dcfa;
|
||||
u_short f_ir1, f_ir2;
|
||||
u_int f_dob;
|
||||
u_short f_ir3, f_ir4;
|
||||
} F_fmtA;
|
||||
|
||||
struct fmtB {
|
||||
u_short f_ir0;
|
||||
u_short f_ssw;
|
||||
u_short f_ipsc;
|
||||
u_short f_ipsb;
|
||||
u_int f_dcfa;
|
||||
u_short f_ir1, f_ir2;
|
||||
u_int f_dob;
|
||||
u_short f_ir3, f_ir4;
|
||||
u_short f_ir5, f_ir6;
|
||||
u_int f_sba;
|
||||
u_short f_ir7, f_ir8;
|
||||
u_int f_dib;
|
||||
u_short f_iregs[22];
|
||||
} F_fmtB;
|
||||
} F_u;
|
||||
};
|
||||
|
||||
#define f_regs F_t.tf_regs
|
||||
#define f_pad F_t.tf_pad
|
||||
#define f_stackadj F_t.tf_stackadj
|
||||
#define f_sr F_t.tf_sr
|
||||
#define f_pc F_t.tf_pc
|
||||
#define f_format F_t.tf_format
|
||||
#define f_vector F_t.tf_vector
|
||||
#define f_fmt2 F_u.F_fmt2
|
||||
#define f_fmt3 F_u.F_fmt3
|
||||
#define f_fmt4 F_u.F_fmt4
|
||||
#define f_fmt7 F_u.F_fmt7
|
||||
#define f_fmt8 F_u.F_fmt8
|
||||
#define f_fmt9 F_u.F_fmt9
|
||||
#define f_fmtA F_u.F_fmtA
|
||||
#define f_fmtB F_u.F_fmtB
|
||||
|
||||
struct switchframe {
|
||||
u_int sf_pc;
|
||||
};
|
||||
|
||||
/* common frame size */
|
||||
#define CFSIZE (sizeof(struct frame) - sizeof(union F_u))
|
||||
#define NFMTSIZE 9
|
||||
|
||||
#define FMT0 0x0
|
||||
#define FMT1 0x1
|
||||
#define FMT2 0x2
|
||||
#define FMT3 0x3
|
||||
#define FMT4 0x4
|
||||
#define FMT7 0x7
|
||||
#define FMT8 0x8
|
||||
#define FMT9 0x9
|
||||
#define FMTA 0xA
|
||||
#define FMTB 0xB
|
||||
|
||||
/* frame specific info sizes */
|
||||
#define FMT0SIZE 0
|
||||
#define FMT1SIZE 0
|
||||
#define FMT2SIZE sizeof(struct fmt2)
|
||||
#define FMT3SIZE sizeof(struct fmt3)
|
||||
#define FMT4SIZE sizeof(struct fmt4)
|
||||
#define FMT7SIZE sizeof(struct fmt7)
|
||||
#define FMT8SIZE sizeof(struct fmt8)
|
||||
#define FMT9SIZE sizeof(struct fmt9)
|
||||
#define FMTASIZE sizeof(struct fmtA)
|
||||
#define FMTBSIZE sizeof(struct fmtB)
|
||||
|
||||
#define V_BUSERR 0x008
|
||||
#define V_ADDRERR 0x00C
|
||||
#define V_TRAP1 0x084
|
||||
|
||||
/* 68010 SSW bits */
|
||||
#define SSW1_RR 0x8000
|
||||
#define SSW1_IF 0x2000
|
||||
#define SSW1_DF 0x1000
|
||||
#define SSW1_RM 0x0800
|
||||
#define SSW1_HI 0x0400
|
||||
#define SSW1_BX 0x0200
|
||||
#define SSW1_RW 0x0100
|
||||
#define SSW1_FCMASK 0x000F
|
||||
|
||||
/* 68020/68030 SSW bits */
|
||||
#define SSW_RC 0x2000
|
||||
#define SSW_RB 0x1000
|
||||
#define SSW_DF 0x0100
|
||||
#define SSW_RM 0x0080
|
||||
#define SSW_RW 0x0040
|
||||
#define SSW_FCMASK 0x0007
|
||||
|
||||
/* 68040 SSW bits */
|
||||
#define SSW4_CP 0x8000
|
||||
#define SSW4_CU 0x4000
|
||||
#define SSW4_CT 0x2000
|
||||
#define SSW4_CM 0x1000
|
||||
#define SSW4_MA 0x0800
|
||||
#define SSW4_ATC 0x0400
|
||||
#define SSW4_LK 0x0200
|
||||
#define SSW4_RW 0x0100
|
||||
#define SSW4_WBSV 0x0080 /* really in WB status, not SSW */
|
||||
#define SSW4_SZMASK 0x0060
|
||||
#define SSW4_SZLW 0x0000
|
||||
#define SSW4_SZB 0x0020
|
||||
#define SSW4_SZW 0x0040
|
||||
#define SSW4_SZLN 0x0060
|
||||
#define SSW4_TTMASK 0x0018
|
||||
#define SSW4_TTNOR 0x0000
|
||||
#define SSW4_TTM16 0x0008
|
||||
#define SSW4_TMMASK 0x0007
|
||||
#define SSW4_TMDCP 0x0000
|
||||
#define SSW4_TMUD 0x0001
|
||||
#define SSW4_TMUC 0x0002
|
||||
#define SSW4_TMKD 0x0005
|
||||
#define SSW4_TMKC 0x0006
|
||||
|
||||
/* 060 Fault Status Long Word (FPSP) */
|
||||
|
||||
#define FSLW_MA 0x08000000
|
||||
#define FSLW_LK 0x02000000
|
||||
#define FSLW_RW 0x01800000
|
||||
|
||||
#define FSLW_RW_R 0x01000000
|
||||
#define FSLW_RW_W 0x00800000
|
||||
|
||||
#define FSLW_SIZE 0x00600000
|
||||
/*
|
||||
* We better define the FSLW_SIZE values here, as the table given in the
|
||||
* MC68060UM/AD rev. 0/1 p. 8-23 is wrong, and was corrected in the errata
|
||||
* document.
|
||||
*/
|
||||
#define FSLW_SIZE_LONG 0x00000000
|
||||
#define FSLW_SIZE_BYTE 0x00200000
|
||||
#define FSLW_SIZE_WORD 0x00400000
|
||||
#define FSLW_SIZE_MV16 0x00600000
|
||||
|
||||
#define FLSW_TT 0x00180000
|
||||
#define FSLW_TM 0x00070000
|
||||
#define FSLW_TM_SV 0x00040000
|
||||
|
||||
|
||||
|
||||
#define FSLW_IO 0x00008000
|
||||
#define FSLW_PBE 0x00004000
|
||||
#define FSLW_SBE 0x00002000
|
||||
#define FSLW_PTA 0x00001000
|
||||
#define FSLW_PTB 0x00000800
|
||||
#define FSLW_IL 0x00000400
|
||||
#define FSLW_PF 0x00000200
|
||||
#define FSLW_SP 0x00000100
|
||||
#define FSLW_WP 0x00000080
|
||||
#define FSLW_TWE 0x00000040
|
||||
#define FSLW_RE 0x00000020
|
||||
#define FSLW_WE 0x00000010
|
||||
#define FSLW_TTR 0x00000008
|
||||
#define FSLW_BPE 0x00000004
|
||||
#define FSLW_SEE 0x00000001
|
||||
|
||||
struct fpframe {
|
||||
union FPF_u1 {
|
||||
u_int FPF_null;
|
||||
struct {
|
||||
u_char FPF_version;
|
||||
u_char FPF_fsize;
|
||||
u_short FPF_res1;
|
||||
} FPF_nonnull;
|
||||
} FPF_u1;
|
||||
union FPF_u2 {
|
||||
struct fpidle {
|
||||
u_short fpf_ccr;
|
||||
u_short fpf_res2;
|
||||
u_int fpf_iregs1[8];
|
||||
u_int fpf_xops[3];
|
||||
u_int fpf_opreg;
|
||||
u_int fpf_biu;
|
||||
} FPF_idle;
|
||||
|
||||
struct fpbusy {
|
||||
u_int fpf_iregs[53];
|
||||
} FPF_busy;
|
||||
|
||||
struct fpunimp {
|
||||
u_int fpf_state[10];
|
||||
} FPF_unimp;
|
||||
} FPF_u2;
|
||||
u_int fpf_regs[8*3];
|
||||
u_int fpf_fpcr;
|
||||
u_int fpf_fpsr;
|
||||
u_int fpf_fpiar;
|
||||
};
|
||||
|
||||
#define fpf_null FPF_u1.FPF_null
|
||||
#define fpf_version FPF_u1.FPF_nonnull.FPF_version
|
||||
#define fpf_fsize FPF_u1.FPF_nonnull.FPF_fsize
|
||||
#define fpf_res1 FPF_u1.FPF_nonnull.FPF_res1
|
||||
#define fpf_idle FPF_u2.FPF_idle
|
||||
#define fpf_busy FPF_u2.FPF_busy
|
||||
#define fpf_unimp FPF_u2.FPF_unimp
|
||||
|
||||
/*
|
||||
* This is incompatible with the earlier one; expecially, an earlier frame
|
||||
* must not be FRESTOREd on a 060 or vv, because a frame error exception is
|
||||
* not guaranteed.
|
||||
*/
|
||||
|
||||
|
||||
struct fpframe060 {
|
||||
u_short fpf6_excp_exp;
|
||||
u_char fpf6_frmfmt;
|
||||
#define FPF6_FMT_NULL 0x00
|
||||
#define FPF6_FMT_IDLE 0x60
|
||||
#define FPF6_FMT_EXCP 0xe0
|
||||
|
||||
u_char fpf6_v;
|
||||
#define FPF6_V_BSUN 0
|
||||
#define FPF6_V_INEX12 1
|
||||
#define FPF6_V_DZ 2
|
||||
#define FPF6_V_UNFL 3
|
||||
#define FPF6_V_OPERR 4
|
||||
#define FPF6_V_OVFL 5
|
||||
#define FPF6_V_SNAN 6
|
||||
#define FPF6_V_UNSUP 7
|
||||
|
||||
u_long fpf6_upper, fpf6_lower;
|
||||
};
|
||||
|
||||
#endif /* _M68K_CPUFRAME_H_ */
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: frame.h,v 1.20 2003/08/07 16:28:13 agc Exp $ */
|
||||
/* $NetBSD: frame.h,v 1.21 2003/09/22 14:18:37 cl Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1990, 1993
|
||||
@ -79,294 +79,30 @@
|
||||
#ifndef _M68K_FRAME_H_
|
||||
#define _M68K_FRAME_H_
|
||||
|
||||
struct frame {
|
||||
struct trapframe {
|
||||
int tf_regs[16];
|
||||
short tf_pad;
|
||||
short tf_stackadj;
|
||||
u_short tf_sr;
|
||||
u_int tf_pc;
|
||||
u_short tf_format:4,
|
||||
tf_vector:12;
|
||||
} __attribute__((packed)) F_t;
|
||||
union F_u {
|
||||
struct fmt2 {
|
||||
u_int f_iaddr;
|
||||
} F_fmt2;
|
||||
#include <m68k/cpuframe.h>
|
||||
#include <m68k/signal.h>
|
||||
|
||||
struct fmt3 {
|
||||
u_int f_ea;
|
||||
} F_fmt3;
|
||||
|
||||
struct fmt4 {
|
||||
u_int f_fa;
|
||||
u_int f_fslw;
|
||||
/* for 060FP type 4 FP disabled frames: */
|
||||
#define f_fea f_fa
|
||||
#define f_pcfi f_fslw
|
||||
} F_fmt4;
|
||||
|
||||
struct fmt7 {
|
||||
u_int f_ea;
|
||||
u_short f_ssw;
|
||||
u_short f_wb3s, f_wb2s, f_wb1s;
|
||||
u_int f_fa;
|
||||
u_int f_wb3a, f_wb3d;
|
||||
u_int f_wb2a, f_wb2d;
|
||||
u_int f_wb1a, f_wb1d;
|
||||
#define f_pd0 f_wb1d
|
||||
u_int f_pd1, f_pd2, f_pd3;
|
||||
} F_fmt7;
|
||||
|
||||
struct fmt8 {
|
||||
u_short f_ssw;
|
||||
u_int f_accaddr;
|
||||
u_short f_ir0;
|
||||
u_short f_dob;
|
||||
u_short f_ir1;
|
||||
u_short f_dib;
|
||||
u_short f_ir2;
|
||||
u_short f_irc;
|
||||
u_short f_maskpc;
|
||||
u_short f_iregs[15];
|
||||
} __attribute__((packed)) F_fmt8;
|
||||
|
||||
struct fmt9 {
|
||||
u_int f_iaddr;
|
||||
u_short f_iregs[4];
|
||||
} F_fmt9;
|
||||
|
||||
struct fmtA {
|
||||
u_short f_ir0;
|
||||
u_short f_ssw;
|
||||
u_short f_ipsc;
|
||||
u_short f_ipsb;
|
||||
u_int f_dcfa;
|
||||
u_short f_ir1, f_ir2;
|
||||
u_int f_dob;
|
||||
u_short f_ir3, f_ir4;
|
||||
} F_fmtA;
|
||||
|
||||
struct fmtB {
|
||||
u_short f_ir0;
|
||||
u_short f_ssw;
|
||||
u_short f_ipsc;
|
||||
u_short f_ipsb;
|
||||
u_int f_dcfa;
|
||||
u_short f_ir1, f_ir2;
|
||||
u_int f_dob;
|
||||
u_short f_ir3, f_ir4;
|
||||
u_short f_ir5, f_ir6;
|
||||
u_int f_sba;
|
||||
u_short f_ir7, f_ir8;
|
||||
u_int f_dib;
|
||||
u_short f_iregs[22];
|
||||
} F_fmtB;
|
||||
} F_u;
|
||||
};
|
||||
|
||||
#define f_regs F_t.tf_regs
|
||||
#define f_pad F_t.tf_pad
|
||||
#define f_stackadj F_t.tf_stackadj
|
||||
#define f_sr F_t.tf_sr
|
||||
#define f_pc F_t.tf_pc
|
||||
#define f_format F_t.tf_format
|
||||
#define f_vector F_t.tf_vector
|
||||
#define f_fmt2 F_u.F_fmt2
|
||||
#define f_fmt3 F_u.F_fmt3
|
||||
#define f_fmt4 F_u.F_fmt4
|
||||
#define f_fmt7 F_u.F_fmt7
|
||||
#define f_fmt8 F_u.F_fmt8
|
||||
#define f_fmt9 F_u.F_fmt9
|
||||
#define f_fmtA F_u.F_fmtA
|
||||
#define f_fmtB F_u.F_fmtB
|
||||
|
||||
struct switchframe {
|
||||
u_int sf_pc;
|
||||
};
|
||||
|
||||
/* common frame size */
|
||||
#define CFSIZE (sizeof(struct frame) - sizeof(union F_u))
|
||||
#define NFMTSIZE 9
|
||||
|
||||
#define FMT0 0x0
|
||||
#define FMT1 0x1
|
||||
#define FMT2 0x2
|
||||
#define FMT3 0x3
|
||||
#define FMT4 0x4
|
||||
#define FMT7 0x7
|
||||
#define FMT8 0x8
|
||||
#define FMT9 0x9
|
||||
#define FMTA 0xA
|
||||
#define FMTB 0xB
|
||||
|
||||
/* frame specific info sizes */
|
||||
#define FMT0SIZE 0
|
||||
#define FMT1SIZE 0
|
||||
#define FMT2SIZE sizeof(struct fmt2)
|
||||
#define FMT3SIZE sizeof(struct fmt3)
|
||||
#define FMT4SIZE sizeof(struct fmt4)
|
||||
#define FMT7SIZE sizeof(struct fmt7)
|
||||
#define FMT8SIZE sizeof(struct fmt8)
|
||||
#define FMT9SIZE sizeof(struct fmt9)
|
||||
#define FMTASIZE sizeof(struct fmtA)
|
||||
#define FMTBSIZE sizeof(struct fmtB)
|
||||
|
||||
#define V_BUSERR 0x008
|
||||
#define V_ADDRERR 0x00C
|
||||
#define V_TRAP1 0x084
|
||||
|
||||
/* 68010 SSW bits */
|
||||
#define SSW1_RR 0x8000
|
||||
#define SSW1_IF 0x2000
|
||||
#define SSW1_DF 0x1000
|
||||
#define SSW1_RM 0x0800
|
||||
#define SSW1_HI 0x0400
|
||||
#define SSW1_BX 0x0200
|
||||
#define SSW1_RW 0x0100
|
||||
#define SSW1_FCMASK 0x000F
|
||||
|
||||
/* 68020/68030 SSW bits */
|
||||
#define SSW_RC 0x2000
|
||||
#define SSW_RB 0x1000
|
||||
#define SSW_DF 0x0100
|
||||
#define SSW_RM 0x0080
|
||||
#define SSW_RW 0x0040
|
||||
#define SSW_FCMASK 0x0007
|
||||
|
||||
/* 68040 SSW bits */
|
||||
#define SSW4_CP 0x8000
|
||||
#define SSW4_CU 0x4000
|
||||
#define SSW4_CT 0x2000
|
||||
#define SSW4_CM 0x1000
|
||||
#define SSW4_MA 0x0800
|
||||
#define SSW4_ATC 0x0400
|
||||
#define SSW4_LK 0x0200
|
||||
#define SSW4_RW 0x0100
|
||||
#define SSW4_WBSV 0x0080 /* really in WB status, not SSW */
|
||||
#define SSW4_SZMASK 0x0060
|
||||
#define SSW4_SZLW 0x0000
|
||||
#define SSW4_SZB 0x0020
|
||||
#define SSW4_SZW 0x0040
|
||||
#define SSW4_SZLN 0x0060
|
||||
#define SSW4_TTMASK 0x0018
|
||||
#define SSW4_TTNOR 0x0000
|
||||
#define SSW4_TTM16 0x0008
|
||||
#define SSW4_TMMASK 0x0007
|
||||
#define SSW4_TMDCP 0x0000
|
||||
#define SSW4_TMUD 0x0001
|
||||
#define SSW4_TMUC 0x0002
|
||||
#define SSW4_TMKD 0x0005
|
||||
#define SSW4_TMKC 0x0006
|
||||
|
||||
/* 060 Fault Status Long Word (FPSP) */
|
||||
|
||||
#define FSLW_MA 0x08000000
|
||||
#define FSLW_LK 0x02000000
|
||||
#define FSLW_RW 0x01800000
|
||||
|
||||
#define FSLW_RW_R 0x01000000
|
||||
#define FSLW_RW_W 0x00800000
|
||||
|
||||
#define FSLW_SIZE 0x00600000
|
||||
#if defined(COMPAT_16) || !defined(_KERNEL)
|
||||
/*
|
||||
* We better define the FSLW_SIZE values here, as the table given in the
|
||||
* MC68060UM/AD rev. 0/1 p. 8-23 is wrong, and was corrected in the errata
|
||||
* document.
|
||||
* Stack frame layout when delivering a signal.
|
||||
*/
|
||||
#define FSLW_SIZE_LONG 0x00000000
|
||||
#define FSLW_SIZE_BYTE 0x00200000
|
||||
#define FSLW_SIZE_WORD 0x00400000
|
||||
#define FSLW_SIZE_MV16 0x00600000
|
||||
|
||||
#define FLSW_TT 0x00180000
|
||||
#define FSLW_TM 0x00070000
|
||||
#define FSLW_TM_SV 0x00040000
|
||||
|
||||
|
||||
|
||||
#define FSLW_IO 0x00008000
|
||||
#define FSLW_PBE 0x00004000
|
||||
#define FSLW_SBE 0x00002000
|
||||
#define FSLW_PTA 0x00001000
|
||||
#define FSLW_PTB 0x00000800
|
||||
#define FSLW_IL 0x00000400
|
||||
#define FSLW_PF 0x00000200
|
||||
#define FSLW_SP 0x00000100
|
||||
#define FSLW_WP 0x00000080
|
||||
#define FSLW_TWE 0x00000040
|
||||
#define FSLW_RE 0x00000020
|
||||
#define FSLW_WE 0x00000010
|
||||
#define FSLW_TTR 0x00000008
|
||||
#define FSLW_BPE 0x00000004
|
||||
#define FSLW_SEE 0x00000001
|
||||
|
||||
struct fpframe {
|
||||
union FPF_u1 {
|
||||
u_int FPF_null;
|
||||
struct {
|
||||
u_char FPF_version;
|
||||
u_char FPF_fsize;
|
||||
u_short FPF_res1;
|
||||
} FPF_nonnull;
|
||||
} FPF_u1;
|
||||
union FPF_u2 {
|
||||
struct fpidle {
|
||||
u_short fpf_ccr;
|
||||
u_short fpf_res2;
|
||||
u_int fpf_iregs1[8];
|
||||
u_int fpf_xops[3];
|
||||
u_int fpf_opreg;
|
||||
u_int fpf_biu;
|
||||
} FPF_idle;
|
||||
|
||||
struct fpbusy {
|
||||
u_int fpf_iregs[53];
|
||||
} FPF_busy;
|
||||
|
||||
struct fpunimp {
|
||||
u_int fpf_state[10];
|
||||
} FPF_unimp;
|
||||
} FPF_u2;
|
||||
u_int fpf_regs[8*3];
|
||||
u_int fpf_fpcr;
|
||||
u_int fpf_fpsr;
|
||||
u_int fpf_fpiar;
|
||||
struct sigframe_sigcontext {
|
||||
int sf_ra; /* handler return address */
|
||||
int sf_signum; /* signal number for handler */
|
||||
int sf_code; /* additional info for handler */
|
||||
struct sigcontext *sf_scp; /* context pointer for handler */
|
||||
struct sigcontext sf_sc; /* actual context */
|
||||
struct sigstate sf_state; /* state of the hardware */
|
||||
};
|
||||
#endif
|
||||
|
||||
#define fpf_null FPF_u1.FPF_null
|
||||
#define fpf_version FPF_u1.FPF_nonnull.FPF_version
|
||||
#define fpf_fsize FPF_u1.FPF_nonnull.FPF_fsize
|
||||
#define fpf_res1 FPF_u1.FPF_nonnull.FPF_res1
|
||||
#define fpf_idle FPF_u2.FPF_idle
|
||||
#define fpf_busy FPF_u2.FPF_busy
|
||||
#define fpf_unimp FPF_u2.FPF_unimp
|
||||
|
||||
/*
|
||||
* This is incompatible with the earlier one; expecially, an earlier frame
|
||||
* must not be FRESTOREd on a 060 or vv, because a frame error exception is
|
||||
* not guaranteed.
|
||||
*/
|
||||
|
||||
|
||||
struct fpframe060 {
|
||||
u_short fpf6_excp_exp;
|
||||
u_char fpf6_frmfmt;
|
||||
#define FPF6_FMT_NULL 0x00
|
||||
#define FPF6_FMT_IDLE 0x60
|
||||
#define FPF6_FMT_EXCP 0xe0
|
||||
|
||||
u_char fpf6_v;
|
||||
#define FPF6_V_BSUN 0
|
||||
#define FPF6_V_INEX12 1
|
||||
#define FPF6_V_DZ 2
|
||||
#define FPF6_V_UNFL 3
|
||||
#define FPF6_V_OPERR 4
|
||||
#define FPF6_V_OVFL 5
|
||||
#define FPF6_V_SNAN 6
|
||||
#define FPF6_V_UNSUP 7
|
||||
|
||||
u_long fpf6_upper, fpf6_lower;
|
||||
struct sigframe_siginfo {
|
||||
int sf_ra; /* return address for handler */
|
||||
int sf_signum; /* "signum" argument for handler */
|
||||
siginfo_t *sf_sip; /* "sip" argument for handler */
|
||||
ucontext_t *sf_ucp; /* "ucp" argument for handler */
|
||||
siginfo_t sf_si; /* actual saved siginfo */
|
||||
ucontext_t sf_uc; /* actual saved ucontext */
|
||||
};
|
||||
|
||||
#if defined(_KERNEL)
|
||||
@ -381,6 +117,13 @@ void reenter_syscall __P((struct frame *, int)) __attribute__((__noreturn__));
|
||||
*/
|
||||
extern void m68k_make_fpu_idle_frame(void);
|
||||
extern struct fpframe m68k_cached_fpu_idle_frame;
|
||||
|
||||
void *getframe(struct lwp *, int, int *);
|
||||
void buildcontext(struct lwp *, void *, void *);
|
||||
#ifdef COMPAT_16
|
||||
void sendsig_sigcontext(ksiginfo_t *, sigset_t *);
|
||||
#endif
|
||||
|
||||
#endif /* _KERNEL */
|
||||
|
||||
#endif /* _M68K_FRAME_H_ */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: mcontext.h,v 1.2 2003/01/17 23:18:28 thorpej Exp $ */
|
||||
/* $NetBSD: mcontext.h,v 1.3 2003/09/22 14:18:38 cl Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
@ -40,9 +40,15 @@
|
||||
#define _M68K_MCONTEXT_H_
|
||||
|
||||
#ifdef _KERNEL
|
||||
#include <machine/frame.h>
|
||||
#include <m68k/cpuframe.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* mcontext extensions to handle signal delivery.
|
||||
*/
|
||||
#define _UC_SETSTACK 0x00010000
|
||||
#define _UC_CLRSTACK 0x00020000
|
||||
|
||||
/*
|
||||
* General register state
|
||||
*/
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: signal.h,v 1.13 2003/08/07 16:28:15 agc Exp $ */
|
||||
/* $NetBSD: signal.h,v 1.14 2003/09/22 14:18:38 cl Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 1989, 1991 Regents of the University of California.
|
||||
@ -38,6 +38,8 @@
|
||||
|
||||
typedef int sig_atomic_t;
|
||||
|
||||
#define __HAVE_SIGINFO
|
||||
|
||||
#if defined(_NETBSD_SOURCE)
|
||||
/*
|
||||
* Get the "code" values
|
||||
@ -99,8 +101,9 @@ do { \
|
||||
(uc)->uc_mcontext.__gregs[_REG_PS] = (sc)->sc_ps; \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#if defined(__M68K_SIGNAL_PRIVATE)
|
||||
#include <m68k/frame.h>
|
||||
|
||||
|
||||
#include <m68k/cpuframe.h>
|
||||
|
||||
/*
|
||||
* Register state saved while kernel delivers a signal.
|
||||
@ -115,6 +118,8 @@ struct sigstate {
|
||||
#define SS_FPSTATE 0x02
|
||||
#define SS_USERREGS 0x04
|
||||
|
||||
#if defined(__M68K_SIGNAL_PRIVATE)
|
||||
|
||||
#ifdef _KERNEL
|
||||
#define _SIGSTATE_EXFRAMESIZE(fmt) exframesize[(fmt)]
|
||||
#endif
|
||||
@ -192,18 +197,7 @@ do { \
|
||||
(uc)->uc_flags &= ~_UC_FPU; \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
/*
|
||||
* Stack frame layout when delivering a signal.
|
||||
*/
|
||||
struct sigframe {
|
||||
int sf_ra; /* handler return address */
|
||||
int sf_signum; /* signal number for handler */
|
||||
int sf_code; /* additional info for handler */
|
||||
struct sigcontext *sf_scp; /* context pointer for handler */
|
||||
struct sigcontext sf_sc; /* actual context */
|
||||
struct sigstate sf_state; /* state of the hardware */
|
||||
};
|
||||
#endif /* _KERNEL && __M68K_SIGNAL_PRIVATE */
|
||||
#endif /* __M68K_SIGNAL_PRIVATE */
|
||||
|
||||
#endif /* _NETBSD_SOURCE */
|
||||
#endif /* !_M68K_SIGNAL_H_ */
|
||||
|
418
sys/arch/m68k/m68k/compat_16_machdep.c
Normal file
418
sys/arch/m68k/m68k/compat_16_machdep.c
Normal file
@ -0,0 +1,418 @@
|
||||
/* $NetBSD: compat_16_machdep.c,v 1.1 2003/09/22 14:18:39 cl Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 1990, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* the Systems Programming Group of the University of Utah Computer
|
||||
* Science Department.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: Utah Hdr: machdep.c 1.74 92/12/20
|
||||
* from: @(#)machdep.c 8.10 (Berkeley) 4/20/94
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 1988 University of Utah.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* the Systems Programming Group of the University of Utah Computer
|
||||
* Science Department.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: Utah Hdr: machdep.c 1.74 92/12/20
|
||||
* from: @(#)machdep.c 8.10 (Berkeley) 4/20/94
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: compat_16_machdep.c,v 1.1 2003/09/22 14:18:39 cl Exp $");
|
||||
|
||||
#include "opt_compat_netbsd.h"
|
||||
|
||||
#define __M68K_SIGNAL_PRIVATE
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/user.h>
|
||||
#include <sys/ras.h>
|
||||
#include <sys/sa.h>
|
||||
#include <sys/savar.h>
|
||||
#include <sys/signal.h>
|
||||
#include <sys/signalvar.h>
|
||||
#include <sys/ucontext.h>
|
||||
|
||||
#include <sys/mount.h>
|
||||
#include <sys/syscallargs.h>
|
||||
|
||||
#include <machine/cpu.h>
|
||||
#include <machine/reg.h>
|
||||
#include <machine/frame.h>
|
||||
|
||||
extern short exframesize[];
|
||||
int compat_16_sys___sigreturn14(struct lwp *, void *, register_t *);
|
||||
void m68881_save __P((struct fpframe *));
|
||||
void m68881_restore __P((struct fpframe *));
|
||||
|
||||
#ifdef DEBUG
|
||||
extern int sigdebug;
|
||||
extern int sigpid;
|
||||
#define SDB_FOLLOW 0x01
|
||||
#define SDB_KSTACK 0x02
|
||||
#define SDB_FPSTATE 0x04
|
||||
#endif
|
||||
|
||||
#ifdef COMPAT_16
|
||||
/*
|
||||
* Send an interrupt to process.
|
||||
*/
|
||||
void
|
||||
sendsig_sigcontext(ksiginfo_t *ksi, sigset_t *mask)
|
||||
{
|
||||
struct lwp *l = curlwp;
|
||||
struct proc *p = l->l_proc;
|
||||
struct sigacts *ps = p->p_sigacts;
|
||||
struct frame *frame = (struct frame *)l->l_md.md_regs;
|
||||
int onstack;
|
||||
int sig = ksi->ksi_signo;
|
||||
u_long code = ksi->ksi_trap;
|
||||
struct sigframe_sigcontext *fp = getframe(l, sig, &onstack), kf;
|
||||
sig_t catcher = SIGACTION(p, sig).sa_handler;
|
||||
short ft = frame->f_format;
|
||||
|
||||
fp--;
|
||||
|
||||
#ifdef DEBUG
|
||||
if ((sigdebug & SDB_KSTACK) && p->p_pid == sigpid)
|
||||
printf("sendsig(%d): sig %d ssp %p usp %p scp %p ft %d\n",
|
||||
p->p_pid, sig, &onstack, fp, &fp->sf_sc, ft);
|
||||
#endif
|
||||
|
||||
/* Build stack frame for signal trampoline. */
|
||||
switch (ps->sa_sigdesc[sig].sd_vers) {
|
||||
case 0: /* legacy on-stack sigtramp */
|
||||
kf.sf_ra = (int)p->p_sigctx.ps_sigcode;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
kf.sf_ra = (int)ps->sa_sigdesc[sig].sd_tramp;
|
||||
break;
|
||||
|
||||
default:
|
||||
/* Don't know what trampoline version; kill it. */
|
||||
sigexit(l, SIGILL);
|
||||
}
|
||||
|
||||
kf.sf_signum = sig;
|
||||
kf.sf_code = code;
|
||||
kf.sf_scp = &fp->sf_sc;
|
||||
|
||||
/*
|
||||
* Save necessary hardware state. Currently this includes:
|
||||
* - general registers
|
||||
* - original exception frame (if not a "normal" frame)
|
||||
* - FP coprocessor state
|
||||
*/
|
||||
kf.sf_state.ss_flags = SS_USERREGS;
|
||||
memcpy(kf.sf_state.ss_frame.f_regs, frame->f_regs,
|
||||
sizeof(frame->f_regs));
|
||||
if (ft >= FMT4) {
|
||||
#ifdef DEBUG
|
||||
if (ft > 15 || exframesize[ft] < 0)
|
||||
panic("sendsig: bogus frame type");
|
||||
#endif
|
||||
kf.sf_state.ss_flags |= SS_RTEFRAME;
|
||||
kf.sf_state.ss_frame.f_format = frame->f_format;
|
||||
kf.sf_state.ss_frame.f_vector = frame->f_vector;
|
||||
memcpy(&kf.sf_state.ss_frame.F_u, &frame->F_u,
|
||||
(size_t) exframesize[ft]);
|
||||
/*
|
||||
* Leave an indicator that we need to clean up the kernel
|
||||
* stack. We do this by setting the "pad word" above the
|
||||
* hardware stack frame to the amount the stack must be
|
||||
* adjusted by.
|
||||
*
|
||||
* N.B. we increment rather than just set f_stackadj in
|
||||
* case we are called from syscall when processing a
|
||||
* sigreturn. In that case, f_stackadj may be non-zero.
|
||||
*/
|
||||
frame->f_stackadj += exframesize[ft];
|
||||
frame->f_format = frame->f_vector = 0;
|
||||
#ifdef DEBUG
|
||||
if (sigdebug & SDB_FOLLOW)
|
||||
printf("sendsig(%d): copy out %d of frame %d\n",
|
||||
p->p_pid, exframesize[ft], ft);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (fputype) {
|
||||
kf.sf_state.ss_flags |= SS_FPSTATE;
|
||||
m68881_save(&kf.sf_state.ss_fpstate);
|
||||
}
|
||||
#ifdef DEBUG
|
||||
if ((sigdebug & SDB_FPSTATE) && *(char *)&kf.sf_state.ss_fpstate)
|
||||
printf("sendsig(%d): copy out FP state (%x) to %p\n",
|
||||
p->p_pid, *(u_int *)&kf.sf_state.ss_fpstate,
|
||||
&kf.sf_state.ss_fpstate);
|
||||
#endif
|
||||
|
||||
/* Build the signal context to be used by sigreturn. */
|
||||
kf.sf_sc.sc_sp = frame->f_regs[SP];
|
||||
kf.sf_sc.sc_fp = frame->f_regs[A6];
|
||||
kf.sf_sc.sc_ap = (int)&fp->sf_state;
|
||||
kf.sf_sc.sc_pc = frame->f_pc;
|
||||
kf.sf_sc.sc_ps = frame->f_sr;
|
||||
|
||||
/* Save signal stack. */
|
||||
kf.sf_sc.sc_onstack = p->p_sigctx.ps_sigstk.ss_flags & SS_ONSTACK;
|
||||
|
||||
/* Save signal mask. */
|
||||
kf.sf_sc.sc_mask = *mask;
|
||||
|
||||
#ifdef COMPAT_13
|
||||
/*
|
||||
* XXX We always have to save an old style signal mask because
|
||||
* XXX we might be delivering a signal to a process which will
|
||||
* XXX escape from the signal in a non-standard way and invoke
|
||||
* XXX sigreturn() directly.
|
||||
*/
|
||||
native_sigset_to_sigset13(mask, &kf.sf_sc.__sc_mask13);
|
||||
#endif
|
||||
|
||||
if (copyout(&kf, fp, sizeof(kf)) != 0) {
|
||||
#ifdef DEBUG
|
||||
if ((sigdebug & SDB_KSTACK) && p->p_pid == sigpid)
|
||||
printf("sendsig(%d): copyout failed on sig %d\n",
|
||||
p->p_pid, sig);
|
||||
#endif
|
||||
/*
|
||||
* Process has trashed its stack; give it an illegal
|
||||
* instruction to halt it in its tracks.
|
||||
*/
|
||||
sigexit(l, SIGILL);
|
||||
/* NOTREACHED */
|
||||
}
|
||||
#ifdef DEBUG
|
||||
if (sigdebug & SDB_FOLLOW)
|
||||
printf("sendsig(%d): sig %d scp %p fp %p sc_sp %x sc_ap %x\n",
|
||||
p->p_pid, sig, kf.sf_scp, fp,
|
||||
kf.sf_sc.sc_sp, kf.sf_sc.sc_ap);
|
||||
#endif
|
||||
|
||||
buildcontext(l, catcher, fp);
|
||||
|
||||
/* Remember that we're now on the signal stack. */
|
||||
if (onstack)
|
||||
p->p_sigctx.ps_sigstk.ss_flags |= SS_ONSTACK;
|
||||
|
||||
#ifdef DEBUG
|
||||
if ((sigdebug & SDB_KSTACK) && p->p_pid == sigpid)
|
||||
printf("sendsig(%d): sig %d returns\n",
|
||||
p->p_pid, sig);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef COMPAT_16
|
||||
/*
|
||||
* System call to cleanup state after a signal
|
||||
* has been taken. Reset signal mask and
|
||||
* stack state from context left by sendsig (above).
|
||||
* Return to previous pc and psl as specified by
|
||||
* context left by sendsig. Check carefully to
|
||||
* make sure that the user has not modified the
|
||||
* psl to gain improper privileges or to cause
|
||||
* a machine fault.
|
||||
*/
|
||||
int
|
||||
compat_16_sys___sigreturn14(l, v, retval)
|
||||
struct lwp *l;
|
||||
void *v;
|
||||
register_t *retval;
|
||||
{
|
||||
struct compat_16_sys___sigreturn14_args /* {
|
||||
syscallarg(struct sigcontext *) sigcntxp;
|
||||
} */ *uap = v;
|
||||
struct proc *p = l->l_proc;
|
||||
struct sigcontext *scp;
|
||||
struct frame *frame;
|
||||
struct sigcontext tsigc;
|
||||
struct sigstate tstate;
|
||||
int rf, flags;
|
||||
|
||||
/*
|
||||
* The trampoline code hands us the context.
|
||||
* It is unsafe to keep track of it ourselves, in the event that a
|
||||
* program jumps out of a signal handler.
|
||||
*/
|
||||
scp = SCARG(uap, sigcntxp);
|
||||
#ifdef DEBUG
|
||||
if (sigdebug & SDB_FOLLOW)
|
||||
printf("sigreturn: pid %d, scp %p\n", p->p_pid, scp);
|
||||
#endif
|
||||
if ((int)scp & 1)
|
||||
return (EINVAL);
|
||||
|
||||
if (copyin(scp, &tsigc, sizeof(tsigc)) != 0)
|
||||
return (EFAULT);
|
||||
scp = &tsigc;
|
||||
|
||||
/* Make sure the user isn't pulling a fast one on us! */
|
||||
if ((scp->sc_ps & (PSL_MBZ|PSL_IPL|PSL_S)) != 0)
|
||||
return (EINVAL);
|
||||
|
||||
/* Restore register context. */
|
||||
frame = (struct frame *) l->l_md.md_regs;
|
||||
|
||||
/*
|
||||
* Grab pointer to hardware state information.
|
||||
* If zero, the user is probably doing a longjmp.
|
||||
*/
|
||||
if ((rf = scp->sc_ap) == 0)
|
||||
goto restore;
|
||||
|
||||
/*
|
||||
* See if there is anything to do before we go to the
|
||||
* expense of copying in close to 1/2K of data
|
||||
*/
|
||||
flags = fuword((caddr_t)rf);
|
||||
#ifdef DEBUG
|
||||
if (sigdebug & SDB_FOLLOW)
|
||||
printf("sigreturn(%d): sc_ap %x flags %x\n",
|
||||
p->p_pid, rf, flags);
|
||||
#endif
|
||||
/* fuword failed (bogus sc_ap value). */
|
||||
if (flags == -1)
|
||||
return (EINVAL);
|
||||
|
||||
if (flags == 0 || copyin((caddr_t)rf, &tstate, sizeof(tstate)) != 0)
|
||||
goto restore;
|
||||
#ifdef DEBUG
|
||||
if ((sigdebug & SDB_KSTACK) && p->p_pid == sigpid)
|
||||
printf("sigreturn(%d): ssp %p usp %x scp %p ft %d\n",
|
||||
p->p_pid, &flags, scp->sc_sp, SCARG(uap, sigcntxp),
|
||||
(flags & SS_RTEFRAME) ? tstate.ss_frame.f_format : -1);
|
||||
#endif
|
||||
/*
|
||||
* Restore long stack frames. Note that we do not copy
|
||||
* back the saved SR or PC, they were picked up above from
|
||||
* the sigcontext structure.
|
||||
*/
|
||||
if (flags & SS_RTEFRAME) {
|
||||
register int sz;
|
||||
|
||||
/* grab frame type and validate */
|
||||
sz = tstate.ss_frame.f_format;
|
||||
if (sz > 15 || (sz = exframesize[sz]) < 0
|
||||
|| frame->f_stackadj < sz)
|
||||
return (EINVAL);
|
||||
frame->f_stackadj -= sz;
|
||||
frame->f_format = tstate.ss_frame.f_format;
|
||||
frame->f_vector = tstate.ss_frame.f_vector;
|
||||
memcpy(&frame->F_u, &tstate.ss_frame.F_u, sz);
|
||||
#ifdef DEBUG
|
||||
if (sigdebug & SDB_FOLLOW)
|
||||
printf("sigreturn(%d): copy in %d of frame type %d\n",
|
||||
p->p_pid, sz, tstate.ss_frame.f_format);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* Restore most of the users registers except for A6 and SP
|
||||
* which will be handled below.
|
||||
*/
|
||||
if (flags & SS_USERREGS)
|
||||
memcpy(frame->f_regs, tstate.ss_frame.f_regs,
|
||||
sizeof(frame->f_regs) - (2 * NBPW));
|
||||
|
||||
/*
|
||||
* Restore the original FP context
|
||||
*/
|
||||
if (fputype && (flags & SS_FPSTATE))
|
||||
m68881_restore(&tstate.ss_fpstate);
|
||||
|
||||
restore:
|
||||
/*
|
||||
* Restore the user supplied information.
|
||||
* This should be at the last so that the error (EINVAL)
|
||||
* is reported to the sigreturn caller, not to the
|
||||
* jump destination.
|
||||
*/
|
||||
|
||||
frame->f_regs[SP] = scp->sc_sp;
|
||||
frame->f_regs[A6] = scp->sc_fp;
|
||||
frame->f_pc = scp->sc_pc;
|
||||
frame->f_sr = scp->sc_ps;
|
||||
|
||||
/* Restore signal stack. */
|
||||
if (scp->sc_onstack & SS_ONSTACK)
|
||||
p->p_sigctx.ps_sigstk.ss_flags |= SS_ONSTACK;
|
||||
else
|
||||
p->p_sigctx.ps_sigstk.ss_flags &= ~SS_ONSTACK;
|
||||
|
||||
/* Restore signal mask. */
|
||||
(void) sigprocmask1(p, SIG_SETMASK, &scp->sc_mask, 0);
|
||||
|
||||
#ifdef DEBUG
|
||||
if ((sigdebug & SDB_FPSTATE) && *(char *)&tstate.ss_fpstate)
|
||||
printf("sigreturn(%d): copied in FP state (%x) at %p\n",
|
||||
p->p_pid, *(u_int *)&tstate.ss_fpstate,
|
||||
&tstate.ss_fpstate);
|
||||
if ((sigdebug & SDB_FOLLOW) ||
|
||||
((sigdebug & SDB_KSTACK) && p->p_pid == sigpid))
|
||||
printf("sigreturn(%d): returns\n", p->p_pid);
|
||||
#endif
|
||||
return (EJUSTRETURN);
|
||||
}
|
||||
#endif
|
118
sys/arch/m68k/m68k/compat_16_sigreturn14.s
Normal file
118
sys/arch/m68k/m68k/compat_16_sigreturn14.s
Normal file
@ -0,0 +1,118 @@
|
||||
/* $NetBSD: compat_16_sigreturn14.s,v 1.1 2003/09/22 14:18:41 cl Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1990, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* the Systems Programming Group of the University of Utah Computer
|
||||
* Science Department.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: Utah $Hdr: locore.s 1.66 92/12/22$
|
||||
*
|
||||
* @(#)locore.s 8.6 (Berkeley) 5/27/94
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 1988 University of Utah.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* the Systems Programming Group of the University of Utah Computer
|
||||
* Science Department.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: Utah $Hdr: locore.s 1.66 92/12/22$
|
||||
*
|
||||
* @(#)locore.s 8.6 (Berkeley) 5/27/94
|
||||
*/
|
||||
|
||||
/*
|
||||
* NOTICE: This file is included by <m68k/m68k/sigreturn.s>.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The compat_16_sigreturn14() syscall comes here. It requires special
|
||||
* handling because we must open a hole in the stack to fill in the
|
||||
* (possibly much larger) original stack frame.
|
||||
*/
|
||||
ENTRY_NOPROFILE(m68k_compat_16_sigreturn14_stub)
|
||||
lea %sp@(-84),%sp | leave enough space for largest frame
|
||||
movl %sp@(84),%sp@ | move up current 8 byte frame
|
||||
movl %sp@(88),%sp@(4)
|
||||
movl #84,%sp@- | default: adjust by 84 bytes
|
||||
moveml #0xFFFF,%sp@- | save user registers
|
||||
movl %usp,%a0 | save the user SP
|
||||
movl %a0,%sp@(FR_SP) | in the savearea
|
||||
movl #SYS_compat_16___sigreturn14,%sp@- | push syscall number
|
||||
jbsr _C_LABEL(syscall) | handle it
|
||||
addql #4,%sp | pop syscall#
|
||||
movl %sp@(FR_SP),%a0 | grab and restore
|
||||
movl %a0,%usp | user SP
|
||||
lea %sp@(FR_HW),%a1 | pointer to HW frame
|
||||
movw %sp@(FR_ADJ),%d0 | do we need to adjust the stack?
|
||||
jeq Lsigr1 | no, just continue
|
||||
moveq #92,%d1 | total size
|
||||
subw %d0,%d1 | - hole size = frame size
|
||||
lea %a1@(92),%a0 | destination
|
||||
addw %d1,%a1 | source
|
||||
lsrw #1,%d1 | convert to word count
|
||||
subqw #1,%d1 | minus 1 for dbf
|
||||
Lsigrlp:
|
||||
movw %a1@-,%a0@- | copy a word
|
||||
dbf %d1,Lsigrlp | continue
|
||||
movl %a0,%a1 | new HW frame base
|
||||
Lsigr1:
|
||||
movl %a1,%sp@(FR_SP) | new SP value
|
||||
moveml %sp@+,#0x7FFF | restore user registers
|
||||
movl %sp@,%sp | and our SP
|
||||
jra _ASM_LABEL(rei) | all done
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: m68k_syscall.c,v 1.11 2003/08/07 16:28:17 agc Exp $ */
|
||||
/* $NetBSD: m68k_syscall.c,v 1.12 2003/09/22 14:18:42 cl Exp $ */
|
||||
|
||||
/*-
|
||||
* Portions Copyright (c) 2000 The NetBSD Foundation, Inc.
|
||||
@ -110,7 +110,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: m68k_syscall.c,v 1.11 2003/08/07 16:28:17 agc Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: m68k_syscall.c,v 1.12 2003/09/22 14:18:42 cl Exp $");
|
||||
|
||||
#include "opt_syscall_debug.h"
|
||||
#include "opt_execfmt.h"
|
||||
@ -246,6 +246,7 @@ syscall_plain(register_t code, struct lwp *l, struct frame *frame)
|
||||
*/
|
||||
code = fuword(params);
|
||||
params += sizeof(int);
|
||||
#if defined(COMPAT_13) || defined(COMPAT_16)
|
||||
/*
|
||||
* XXX sigreturn requires special stack manipulation
|
||||
* that is only done if entered via the sigreturn
|
||||
@ -255,10 +256,13 @@ syscall_plain(register_t code, struct lwp *l, struct frame *frame)
|
||||
#ifdef COMPAT_13
|
||||
case SYS_compat_13_sigreturn13:
|
||||
#endif
|
||||
case SYS___sigreturn14:
|
||||
#ifdef COMPAT_16
|
||||
case SYS_compat_16___sigreturn14:
|
||||
#endif
|
||||
code = nsys;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
case SYS___syscall:
|
||||
/*
|
||||
@ -367,6 +371,7 @@ syscall_fancy(register_t code, struct lwp *l, struct frame *frame)
|
||||
*/
|
||||
code = fuword(params);
|
||||
params += sizeof(int);
|
||||
#if defined(COMPAT_13) || defined(COMPAT_16)
|
||||
/*
|
||||
* XXX sigreturn requires special stack manipulation
|
||||
* that is only done if entered via the sigreturn
|
||||
@ -376,10 +381,13 @@ syscall_fancy(register_t code, struct lwp *l, struct frame *frame)
|
||||
#ifdef COMPAT_13
|
||||
case SYS_compat_13_sigreturn13:
|
||||
#endif
|
||||
case SYS___sigreturn14:
|
||||
#ifdef COMPAT_16
|
||||
case SYS_compat_16___sigreturn14:
|
||||
#endif
|
||||
code = nsys;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
case SYS___syscall:
|
||||
/*
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: sig_machdep.c,v 1.21 2003/08/07 16:28:18 agc Exp $ */
|
||||
/* $NetBSD: sig_machdep.c,v 1.22 2003/09/22 14:18:42 cl Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 1990, 1993
|
||||
@ -75,7 +75,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: sig_machdep.c,v 1.21 2003/08/07 16:28:18 agc Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: sig_machdep.c,v 1.22 2003/09/22 14:18:42 cl Exp $");
|
||||
|
||||
#include "opt_compat_netbsd.h"
|
||||
|
||||
@ -137,146 +137,80 @@ int sigpid = 0;
|
||||
(((struct fpframe060 *)(fp))->fpf6_frmfmt == FPF6_FMT_NULL)
|
||||
#endif
|
||||
|
||||
void *
|
||||
getframe(struct lwp *l, int sig, int *onstack)
|
||||
{
|
||||
struct proc *p = l->l_proc;
|
||||
struct sigctx *ctx = &p->p_sigctx;
|
||||
struct frame *tf = (struct frame *)l->l_md.md_regs;
|
||||
|
||||
/* Do we need to jump onto the signal stack? */
|
||||
*onstack =(ctx->ps_sigstk.ss_flags & (SS_DISABLE | SS_ONSTACK)) == 0
|
||||
&& (SIGACTION(p, sig).sa_flags & SA_ONSTACK) != 0;
|
||||
|
||||
if (*onstack)
|
||||
return (char *)ctx->ps_sigstk.ss_sp + ctx->ps_sigstk.ss_size;
|
||||
else
|
||||
return (void *)tf->f_regs[SP];
|
||||
}
|
||||
|
||||
/*
|
||||
* Send an interrupt to process.
|
||||
* Build context to run handler in. We invoke the handler
|
||||
* directly, only returning via the trampoline. Note the
|
||||
* trampoline version numbers are coordinated with machine-
|
||||
* dependent code in libc.
|
||||
*/
|
||||
void
|
||||
sendsig(sig, mask, code)
|
||||
int sig;
|
||||
sigset_t *mask;
|
||||
u_long code;
|
||||
buildcontext(struct lwp *l, void *catcher, void *fp)
|
||||
{
|
||||
struct frame *frame = (struct frame *)l->l_md.md_regs;
|
||||
/*
|
||||
* Set up the registers to return to the signal handler. The
|
||||
* handler will then return to the signal trampoline.
|
||||
*/
|
||||
frame->f_regs[SP] = (int)fp;
|
||||
frame->f_pc = (int)catcher;
|
||||
}
|
||||
|
||||
static void
|
||||
sendsig_siginfo(ksiginfo_t *ksi, sigset_t *mask)
|
||||
{
|
||||
struct lwp *l = curlwp;
|
||||
struct proc *p = l->l_proc;
|
||||
struct sigacts *ps = p->p_sigacts;
|
||||
struct sigframe *fp, kf;
|
||||
struct frame *frame;
|
||||
short ft;
|
||||
int onstack, fsize;
|
||||
int onstack;
|
||||
int sig = ksi->ksi_signo;
|
||||
struct sigframe_siginfo *fp = getframe(l, sig, &onstack), kf;
|
||||
sig_t catcher = SIGACTION(p, sig).sa_handler;
|
||||
|
||||
frame = (struct frame *)l->l_md.md_regs;
|
||||
ft = frame->f_format;
|
||||
|
||||
/* Do we need to jump onto the signal stack? */
|
||||
onstack =
|
||||
(p->p_sigctx.ps_sigstk.ss_flags & (SS_DISABLE | SS_ONSTACK)) == 0 &&
|
||||
(SIGACTION(p, sig).sa_flags & SA_ONSTACK) != 0;
|
||||
|
||||
/* Allocate space for the signal handler context. */
|
||||
fsize = sizeof(struct sigframe);
|
||||
if (onstack)
|
||||
fp = (struct sigframe *)((caddr_t)p->p_sigctx.ps_sigstk.ss_sp +
|
||||
p->p_sigctx.ps_sigstk.ss_size);
|
||||
else
|
||||
fp = (struct sigframe *)(frame->f_regs[SP]);
|
||||
fp--;
|
||||
|
||||
#ifdef DEBUG
|
||||
if ((sigdebug & SDB_KSTACK) && p->p_pid == sigpid)
|
||||
printf("sendsig(%d): sig %d ssp %p usp %p scp %p ft %d\n",
|
||||
p->p_pid, sig, &onstack, fp, &fp->sf_sc, ft);
|
||||
#endif
|
||||
|
||||
/* Build stack frame for signal trampoline. */
|
||||
switch (ps->sa_sigdesc[sig].sd_vers) {
|
||||
#if 1 /* COMPAT_16 */
|
||||
case 0: /* legacy on-stack sigtramp */
|
||||
kf.sf_ra = (int)p->p_sigctx.ps_sigcode;
|
||||
break;
|
||||
#endif /* COMPAT_16 */
|
||||
|
||||
case 1:
|
||||
kf.sf_ra = (int)ps->sa_sigdesc[sig].sd_tramp;
|
||||
break;
|
||||
|
||||
default:
|
||||
/* Don't know what trampoline version; kill it. */
|
||||
case 0: /* handled by sendsig_sigcontext */
|
||||
case 1: /* handled by sendsig_sigcontext */
|
||||
default: /* unknown version */
|
||||
printf("nsendsig: bad version %d\n",
|
||||
ps->sa_sigdesc[sig].sd_vers);
|
||||
sigexit(l, SIGILL);
|
||||
case 2:
|
||||
break;
|
||||
}
|
||||
|
||||
kf.sf_ra = (int)ps->sa_sigdesc[sig].sd_tramp;
|
||||
kf.sf_signum = sig;
|
||||
kf.sf_code = code;
|
||||
kf.sf_scp = &fp->sf_sc;
|
||||
kf.sf_sip = &fp->sf_si;
|
||||
kf.sf_ucp = &fp->sf_uc;
|
||||
kf.sf_si._info = *ksi;
|
||||
kf.sf_uc.uc_flags = _UC_SIGMASK;
|
||||
kf.sf_uc.uc_sigmask = *mask;
|
||||
kf.sf_uc.uc_link = NULL;
|
||||
kf.sf_uc.uc_flags |= (p->p_sigctx.ps_sigstk.ss_flags & SS_ONSTACK)
|
||||
? _UC_SETSTACK : _UC_CLRSTACK;
|
||||
memset(&kf.sf_uc.uc_stack, 0, sizeof(kf.sf_uc.uc_stack));
|
||||
cpu_getmcontext(l, &kf.sf_uc.uc_mcontext, &kf.sf_uc.uc_flags);
|
||||
|
||||
/*
|
||||
* Save necessary hardware state. Currently this includes:
|
||||
* - general registers
|
||||
* - original exception frame (if not a "normal" frame)
|
||||
* - FP coprocessor state
|
||||
*/
|
||||
kf.sf_state.ss_flags = SS_USERREGS;
|
||||
memcpy(kf.sf_state.ss_frame.f_regs, frame->f_regs,
|
||||
sizeof(frame->f_regs));
|
||||
if (ft >= FMT4) {
|
||||
#ifdef DEBUG
|
||||
if (ft > 15 || exframesize[ft] < 0)
|
||||
panic("sendsig: bogus frame type");
|
||||
#endif
|
||||
kf.sf_state.ss_flags |= SS_RTEFRAME;
|
||||
kf.sf_state.ss_frame.f_format = frame->f_format;
|
||||
kf.sf_state.ss_frame.f_vector = frame->f_vector;
|
||||
memcpy(&kf.sf_state.ss_frame.F_u, &frame->F_u,
|
||||
(size_t) exframesize[ft]);
|
||||
/*
|
||||
* Leave an indicator that we need to clean up the kernel
|
||||
* stack. We do this by setting the "pad word" above the
|
||||
* hardware stack frame to the amount the stack must be
|
||||
* adjusted by.
|
||||
*
|
||||
* N.B. we increment rather than just set f_stackadj in
|
||||
* case we are called from syscall when processing a
|
||||
* sigreturn. In that case, f_stackadj may be non-zero.
|
||||
*/
|
||||
frame->f_stackadj += exframesize[ft];
|
||||
frame->f_format = frame->f_vector = 0;
|
||||
#ifdef DEBUG
|
||||
if (sigdebug & SDB_FOLLOW)
|
||||
printf("sendsig(%d): copy out %d of frame %d\n",
|
||||
p->p_pid, exframesize[ft], ft);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (fputype) {
|
||||
kf.sf_state.ss_flags |= SS_FPSTATE;
|
||||
m68881_save(&kf.sf_state.ss_fpstate);
|
||||
}
|
||||
#ifdef DEBUG
|
||||
if ((sigdebug & SDB_FPSTATE) && *(char *)&kf.sf_state.ss_fpstate)
|
||||
printf("sendsig(%d): copy out FP state (%x) to %p\n",
|
||||
p->p_pid, *(u_int *)&kf.sf_state.ss_fpstate,
|
||||
&kf.sf_state.ss_fpstate);
|
||||
#endif
|
||||
|
||||
/* Build the signal context to be used by sigreturn. */
|
||||
kf.sf_sc.sc_sp = frame->f_regs[SP];
|
||||
kf.sf_sc.sc_fp = frame->f_regs[A6];
|
||||
kf.sf_sc.sc_ap = (int)&fp->sf_state;
|
||||
kf.sf_sc.sc_pc = frame->f_pc;
|
||||
kf.sf_sc.sc_ps = frame->f_sr;
|
||||
|
||||
/* Save signal stack. */
|
||||
kf.sf_sc.sc_onstack = p->p_sigctx.ps_sigstk.ss_flags & SS_ONSTACK;
|
||||
|
||||
/* Save signal mask. */
|
||||
kf.sf_sc.sc_mask = *mask;
|
||||
|
||||
#ifdef COMPAT_13
|
||||
/*
|
||||
* XXX We always have to save an old style signal mask because
|
||||
* XXX we might be delivering a signal to a process which will
|
||||
* XXX escape from the signal in a non-standard way and invoke
|
||||
* XXX sigreturn() directly.
|
||||
*/
|
||||
native_sigset_to_sigset13(mask, &kf.sf_sc.__sc_mask13);
|
||||
#endif
|
||||
|
||||
if (copyout(&kf, fp, fsize)) {
|
||||
#ifdef DEBUG
|
||||
if ((sigdebug & SDB_KSTACK) && p->p_pid == sigpid)
|
||||
printf("sendsig(%d): copyout failed on sig %d\n",
|
||||
p->p_pid, sig);
|
||||
#endif
|
||||
if (copyout(&kf, fp, sizeof(kf)) != 0) {
|
||||
/*
|
||||
* Process has trashed its stack; give it an illegal
|
||||
* instruction to halt it in its tracks.
|
||||
@ -284,29 +218,23 @@ sendsig(sig, mask, code)
|
||||
sigexit(l, SIGILL);
|
||||
/* NOTREACHED */
|
||||
}
|
||||
#ifdef DEBUG
|
||||
if (sigdebug & SDB_FOLLOW)
|
||||
printf("sendsig(%d): sig %d scp %p fp %p sc_sp %x sc_ap %x\n",
|
||||
p->p_pid, sig, kf.sf_scp, fp,
|
||||
kf.sf_sc.sc_sp, kf.sf_sc.sc_ap);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Set up the registers to return to the signal handler. The
|
||||
* handler will then return to the signal trampoline.
|
||||
*/
|
||||
frame->f_regs[SP] = (int)fp;
|
||||
frame->f_pc = (int)catcher;
|
||||
buildcontext(l, catcher, fp);
|
||||
|
||||
/* Remember that we're now on the signal stack. */
|
||||
if (onstack)
|
||||
p->p_sigctx.ps_sigstk.ss_flags |= SS_ONSTACK;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
if ((sigdebug & SDB_KSTACK) && p->p_pid == sigpid)
|
||||
printf("sendsig(%d): sig %d returns\n",
|
||||
p->p_pid, sig);
|
||||
void
|
||||
sendsig(ksiginfo_t *ksi, sigset_t *mask)
|
||||
{
|
||||
#ifdef COMPAT_16
|
||||
if (curproc->p_sigacts->sa_sigdesc[ksi->ksi_signo].sd_vers < 2)
|
||||
sendsig_sigcontext(ksi, mask);
|
||||
else
|
||||
#endif
|
||||
sendsig_siginfo(ksi, mask);
|
||||
}
|
||||
|
||||
void
|
||||
@ -342,157 +270,6 @@ cpu_upcall(l, type, nevents, ninterrupted, sas, ap, sp, upcall)
|
||||
frame->f_sr &= ~PSL_T;
|
||||
}
|
||||
|
||||
/*
|
||||
* System call to cleanup state after a signal
|
||||
* has been taken. Reset signal mask and
|
||||
* stack state from context left by sendsig (above).
|
||||
* Return to previous pc and psl as specified by
|
||||
* context left by sendsig. Check carefully to
|
||||
* make sure that the user has not modified the
|
||||
* psl to gain improper privileges or to cause
|
||||
* a machine fault.
|
||||
*/
|
||||
int
|
||||
sys___sigreturn14(l, v, retval)
|
||||
struct lwp *l;
|
||||
void *v;
|
||||
register_t *retval;
|
||||
{
|
||||
struct sys___sigreturn14_args /* {
|
||||
syscallarg(struct sigcontext *) sigcntxp;
|
||||
} */ *uap = v;
|
||||
struct proc *p = l->l_proc;
|
||||
struct sigcontext *scp;
|
||||
struct frame *frame;
|
||||
struct sigcontext tsigc;
|
||||
struct sigstate tstate;
|
||||
int rf, flags;
|
||||
|
||||
/*
|
||||
* The trampoline code hands us the context.
|
||||
* It is unsafe to keep track of it ourselves, in the event that a
|
||||
* program jumps out of a signal handler.
|
||||
*/
|
||||
scp = SCARG(uap, sigcntxp);
|
||||
#ifdef DEBUG
|
||||
if (sigdebug & SDB_FOLLOW)
|
||||
printf("sigreturn: pid %d, scp %p\n", p->p_pid, scp);
|
||||
#endif
|
||||
if ((int)scp & 1)
|
||||
return (EINVAL);
|
||||
|
||||
if (copyin(scp, &tsigc, sizeof(tsigc)) != 0)
|
||||
return (EFAULT);
|
||||
scp = &tsigc;
|
||||
|
||||
/* Make sure the user isn't pulling a fast one on us! */
|
||||
if ((scp->sc_ps & (PSL_MBZ|PSL_IPL|PSL_S)) != 0)
|
||||
return (EINVAL);
|
||||
|
||||
/* Restore register context. */
|
||||
frame = (struct frame *) l->l_md.md_regs;
|
||||
|
||||
/*
|
||||
* Grab pointer to hardware state information.
|
||||
* If zero, the user is probably doing a longjmp.
|
||||
*/
|
||||
if ((rf = scp->sc_ap) == 0)
|
||||
goto restore;
|
||||
|
||||
/*
|
||||
* See if there is anything to do before we go to the
|
||||
* expense of copying in close to 1/2K of data
|
||||
*/
|
||||
flags = fuword((caddr_t)rf);
|
||||
#ifdef DEBUG
|
||||
if (sigdebug & SDB_FOLLOW)
|
||||
printf("sigreturn(%d): sc_ap %x flags %x\n",
|
||||
p->p_pid, rf, flags);
|
||||
#endif
|
||||
/* fuword failed (bogus sc_ap value). */
|
||||
if (flags == -1)
|
||||
return (EINVAL);
|
||||
|
||||
if (flags == 0 || copyin((caddr_t)rf, &tstate, sizeof(tstate)) != 0)
|
||||
goto restore;
|
||||
#ifdef DEBUG
|
||||
if ((sigdebug & SDB_KSTACK) && p->p_pid == sigpid)
|
||||
printf("sigreturn(%d): ssp %p usp %x scp %p ft %d\n",
|
||||
p->p_pid, &flags, scp->sc_sp, SCARG(uap, sigcntxp),
|
||||
(flags & SS_RTEFRAME) ? tstate.ss_frame.f_format : -1);
|
||||
#endif
|
||||
/*
|
||||
* Restore long stack frames. Note that we do not copy
|
||||
* back the saved SR or PC, they were picked up above from
|
||||
* the sigcontext structure.
|
||||
*/
|
||||
if (flags & SS_RTEFRAME) {
|
||||
register int sz;
|
||||
|
||||
/* grab frame type and validate */
|
||||
sz = tstate.ss_frame.f_format;
|
||||
if (sz > 15 || (sz = exframesize[sz]) < 0
|
||||
|| frame->f_stackadj < sz)
|
||||
return (EINVAL);
|
||||
frame->f_stackadj -= sz;
|
||||
frame->f_format = tstate.ss_frame.f_format;
|
||||
frame->f_vector = tstate.ss_frame.f_vector;
|
||||
memcpy(&frame->F_u, &tstate.ss_frame.F_u, sz);
|
||||
#ifdef DEBUG
|
||||
if (sigdebug & SDB_FOLLOW)
|
||||
printf("sigreturn(%d): copy in %d of frame type %d\n",
|
||||
p->p_pid, sz, tstate.ss_frame.f_format);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* Restore most of the users registers except for A6 and SP
|
||||
* which will be handled below.
|
||||
*/
|
||||
if (flags & SS_USERREGS)
|
||||
memcpy(frame->f_regs, tstate.ss_frame.f_regs,
|
||||
sizeof(frame->f_regs) - (2 * NBPW));
|
||||
|
||||
/*
|
||||
* Restore the original FP context
|
||||
*/
|
||||
if (fputype && (flags & SS_FPSTATE))
|
||||
m68881_restore(&tstate.ss_fpstate);
|
||||
|
||||
restore:
|
||||
/*
|
||||
* Restore the user supplied information.
|
||||
* This should be at the last so that the error (EINVAL)
|
||||
* is reported to the sigreturn caller, not to the
|
||||
* jump destination.
|
||||
*/
|
||||
|
||||
frame->f_regs[SP] = scp->sc_sp;
|
||||
frame->f_regs[A6] = scp->sc_fp;
|
||||
frame->f_pc = scp->sc_pc;
|
||||
frame->f_sr = scp->sc_ps;
|
||||
|
||||
/* Restore signal stack. */
|
||||
if (scp->sc_onstack & SS_ONSTACK)
|
||||
p->p_sigctx.ps_sigstk.ss_flags |= SS_ONSTACK;
|
||||
else
|
||||
p->p_sigctx.ps_sigstk.ss_flags &= ~SS_ONSTACK;
|
||||
|
||||
/* Restore signal mask. */
|
||||
(void) sigprocmask1(p, SIG_SETMASK, &scp->sc_mask, 0);
|
||||
|
||||
#ifdef DEBUG
|
||||
if ((sigdebug & SDB_FPSTATE) && *(char *)&tstate.ss_fpstate)
|
||||
printf("sigreturn(%d): copied in FP state (%x) at %p\n",
|
||||
p->p_pid, *(u_int *)&tstate.ss_fpstate,
|
||||
&tstate.ss_fpstate);
|
||||
if ((sigdebug & SDB_FOLLOW) ||
|
||||
((sigdebug & SDB_KSTACK) && p->p_pid == sigpid))
|
||||
printf("sigreturn(%d): returns\n", p->p_pid);
|
||||
#endif
|
||||
return (EJUSTRETURN);
|
||||
}
|
||||
|
||||
void
|
||||
cpu_getmcontext(l, mcp, flags)
|
||||
struct lwp *l;
|
||||
@ -687,5 +464,10 @@ cpu_setmcontext(l, mcp, flags)
|
||||
m68881_restore(fpf);
|
||||
}
|
||||
|
||||
if (flags & _UC_SETSTACK)
|
||||
l->l_proc->p_sigctx.ps_sigstk.ss_flags |= SS_ONSTACK;
|
||||
if (flags & _UC_CLRSTACK)
|
||||
l->l_proc->p_sigctx.ps_sigstk.ss_flags &= ~SS_ONSTACK;
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: sigreturn.s,v 1.8 2003/08/07 16:28:19 agc Exp $ */
|
||||
/* $NetBSD: sigreturn.s,v 1.9 2003/09/22 14:18:43 cl Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1990, 1993
|
||||
@ -85,42 +85,12 @@
|
||||
* #include <m68k/m68k/sigreturn.s>
|
||||
*/
|
||||
|
||||
#if defined(COMPAT_16)
|
||||
/*
|
||||
* The sigreturn() syscall comes here. It requires special handling
|
||||
* because we must open a hole in the stack to fill in the (possibly much
|
||||
* larger) original stack frame.
|
||||
* Pull in the NetBSD 1.6 sigreturn stub.
|
||||
*/
|
||||
ENTRY_NOPROFILE(m68k_sigreturn_stub)
|
||||
lea %sp@(-84),%sp | leave enough space for largest frame
|
||||
movl %sp@(84),%sp@ | move up current 8 byte frame
|
||||
movl %sp@(88),%sp@(4)
|
||||
movl #84,%sp@- | default: adjust by 84 bytes
|
||||
moveml #0xFFFF,%sp@- | save user registers
|
||||
movl %usp,%a0 | save the user SP
|
||||
movl %a0,%sp@(FR_SP) | in the savearea
|
||||
movl #SYS___sigreturn14,%sp@- | push syscall number
|
||||
jbsr _C_LABEL(syscall) | handle it
|
||||
addql #4,%sp | pop syscall#
|
||||
movl %sp@(FR_SP),%a0 | grab and restore
|
||||
movl %a0,%usp | user SP
|
||||
lea %sp@(FR_HW),%a1 | pointer to HW frame
|
||||
movw %sp@(FR_ADJ),%d0 | do we need to adjust the stack?
|
||||
jeq Lsigr1 | no, just continue
|
||||
moveq #92,%d1 | total size
|
||||
subw %d0,%d1 | - hole size = frame size
|
||||
lea %a1@(92),%a0 | destination
|
||||
addw %d1,%a1 | source
|
||||
lsrw #1,%d1 | convert to word count
|
||||
subqw #1,%d1 | minus 1 for dbf
|
||||
Lsigrlp:
|
||||
movw %a1@-,%a0@- | copy a word
|
||||
dbf %d1,Lsigrlp | continue
|
||||
movl %a0,%a1 | new HW frame base
|
||||
Lsigr1:
|
||||
movl %a1,%sp@(FR_SP) | new SP value
|
||||
moveml %sp@+,#0x7FFF | restore user registers
|
||||
movl %sp@,%sp | and our SP
|
||||
jra _ASM_LABEL(rei) | all done
|
||||
#include <m68k/m68k/compat_16_sigreturn14.s>
|
||||
#endif
|
||||
|
||||
#if defined(COMPAT_13) || defined(COMPAT_SUNOS)
|
||||
/*
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: trap_subr.s,v 1.9 2003/08/07 16:28:19 agc Exp $ */
|
||||
/* $NetBSD: trap_subr.s,v 1.10 2003/09/22 14:18:44 cl Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1990, 1993
|
||||
@ -152,11 +152,13 @@ ENTRY_NOPROFILE(trap1)
|
||||
ENTRY_NOPROFILE(trap2)
|
||||
jra _C_LABEL(trace)
|
||||
|
||||
#if defined(COMPAT_16)
|
||||
/*
|
||||
* Trap 3 - sigreturn system call
|
||||
*/
|
||||
ENTRY_NOPROFILE(trap3)
|
||||
jra _C_LABEL(m68k_sigreturn_stub)
|
||||
jra _C_LABEL(m68k_compat_16_sigreturn14_stub)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The following exceptions only cause four and six word stack frames
|
||||
|
Loading…
Reference in New Issue
Block a user