summaryrefslogtreecommitdiff
path: root/sys/arch/mac68k
diff options
context:
space:
mode:
authorbriggs <briggs@cvs.openbsd.org>1997-02-21 05:49:31 +0000
committerbriggs <briggs@cvs.openbsd.org>1997-02-21 05:49:31 +0000
commitd5773a2c94c9d2dfdd32261015b497e6b4e700dc (patch)
tree0b3c1cde8ce2d3fba21a802e7a72c9c1944b9da3 /sys/arch/mac68k
parent2cc3914e2ef13e6b0dfc4075cde57e736f8981fd (diff)
Bring in siginfo changes from mvme68k port & Theo. Compiles.
Diffstat (limited to 'sys/arch/mac68k')
-rw-r--r--sys/arch/mac68k/mac68k/locore.s5
-rw-r--r--sys/arch/mac68k/mac68k/machdep.c24
-rw-r--r--sys/arch/mac68k/mac68k/trap.c61
3 files changed, 74 insertions, 16 deletions
diff --git a/sys/arch/mac68k/mac68k/locore.s b/sys/arch/mac68k/mac68k/locore.s
index ac74bedde32..cd096a8d69f 100644
--- a/sys/arch/mac68k/mac68k/locore.s
+++ b/sys/arch/mac68k/mac68k/locore.s
@@ -1,4 +1,4 @@
-/* $OpenBSD: locore.s,v 1.17 1997/02/10 12:01:45 downsj Exp $ */
+/* $OpenBSD: locore.s,v 1.18 1997/02/21 05:49:28 briggs Exp $ */
/* $NetBSD: locore.s,v 1.73 1997/01/09 07:28:12 scottr Exp $ */
/*
@@ -1086,7 +1086,7 @@ _szicode:
* Stack looks like:
*
* sp+0 -> signal number
- * sp+4 signal specific code
+ * sp+4 pointer to siginfo (sip)
* sp+8 pointer to signal context frame (scp)
* sp+12 address of handler
* sp+16 saved hardware state
@@ -1107,6 +1107,7 @@ _sigcode:
trap #0 | exit(errno) (2 bytes)
.align 2
_esigcode:
+ .text
/*
* Primitives
diff --git a/sys/arch/mac68k/mac68k/machdep.c b/sys/arch/mac68k/mac68k/machdep.c
index aa2bfa8e886..d3542a5be7a 100644
--- a/sys/arch/mac68k/mac68k/machdep.c
+++ b/sys/arch/mac68k/mac68k/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.27 1997/01/24 01:35:48 briggs Exp $ */
+/* $OpenBSD: machdep.c,v 1.28 1997/02/21 05:49:29 briggs Exp $ */
/* $NetBSD: machdep.c,v 1.129 1997/01/09 07:20:46 scottr Exp $ */
/*
@@ -507,11 +507,12 @@ struct sigstate {
*/
struct sigframe {
int sf_signum; /* signo for handler */
- int sf_code; /* additional info for handler */
+ siginfo_t *sf_sip;
struct sigcontext *sf_scp; /* context ptr for handler */
sig_t sf_handler; /* handler addr for u_sigc */
struct sigstate sf_state; /* state of the hardware */
struct sigcontext sf_sc;/* actual context */
+ siginfo_t sf_si;
};
#ifdef DEBUG
int sigdebug = 0x0;
@@ -525,10 +526,12 @@ int sigpid = 0;
* Send an interrupt to process.
*/
void
-sendsig(catcher, sig, mask, code)
+sendsig(catcher, sig, mask, code, type, val)
sig_t catcher;
int sig, mask;
u_long code;
+ int type;
+ union sigval val;
{
extern short exframesize[];
extern char sigcode[], esigcode[];
@@ -585,9 +588,10 @@ sendsig(catcher, sig, mask, code)
kfp = malloc(sizeof(struct sigframe), M_TEMP, M_WAITOK);
/* Build the argument list for the signal handler. */
kfp->sf_signum = sig;
- kfp->sf_code = code;
+ kfp->sf_sip = NULL;
kfp->sf_scp = &fp->sf_sc;
kfp->sf_handler = catcher;
+
/*
* Save necessary hardware state. Currently this includes:
* - general registers
@@ -646,6 +650,13 @@ sendsig(catcher, sig, mask, code)
kfp->sf_sc.sc_ap = (int) &fp->sf_state;
kfp->sf_sc.sc_pc = frame->f_pc;
kfp->sf_sc.sc_ps = frame->f_sr;
+
+ if (psp->ps_siginfo & sigmask(sig)) {
+ kfp->sf_sip = &fp->sf_si;
+ initsiginfo(&kfp->sf_si, sig, code, type, val);
+ }
+
+ /* XXX For perf., do not copy out siginfo if not needed */
(void) copyout((caddr_t) kfp, (caddr_t) fp, sizeof(struct sigframe));
frame->f_regs[SP] = (int) fp;
#ifdef DEBUG
@@ -847,6 +858,11 @@ boot(howto)
if (howto & RB_HALT) {
printf("halted\n\n");
via_shutdown();
+#ifdef HWDIRECT /* adb_poweroff is available only when
+ * the HWDIRECT ADB method is used. */
+ adb_poweroff(); /* Shut down machines whose power functions
+ * are accessed via modified ADB calls. */
+#endif
} else {
if (howto & RB_DUMP) {
savectx(&dumppcb);
diff --git a/sys/arch/mac68k/mac68k/trap.c b/sys/arch/mac68k/mac68k/trap.c
index 745c798c7e5..cfd20ddfa4b 100644
--- a/sys/arch/mac68k/mac68k/trap.c
+++ b/sys/arch/mac68k/mac68k/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.7 1997/01/24 01:35:53 briggs Exp $ */
+/* $OpenBSD: trap.c,v 1.8 1997/02/21 05:49:30 briggs Exp $ */
/* $NetBSD: trap.c,v 1.45 1997/01/20 04:30:05 scottr Exp $ */
/*
@@ -216,7 +216,8 @@ again:
} else if ((sig = writeback(fp, fromtrap))) {
beenhere = 1;
oticks = p->p_sticks;
- trapsignal(p, sig, faultaddr);
+ trapsignal(p, sig, VM_PROT_WRITE, SEGV_MAPERR,
+ (caddr_t)faultaddr);
goto again;
}
}
@@ -244,6 +245,7 @@ trap(type, code, v, frame)
register struct proc *p;
register int i;
u_int ucode;
+ int typ = 0;
u_quad_t sticks;
cnt.v_trap++;
@@ -296,30 +298,58 @@ copyfault:
return;
case T_BUSERR|T_USER: /* Bus error */
+ typ = BUS_OBJERR;
+ ucode = code & ~T_USER;
+ i = SIGBUS;
+ break;
case T_ADDRERR|T_USER: /* Address error */
- ucode = v;
+ typ = BUS_ADRALN;
+ ucode = code & ~T_USER;
i = SIGBUS;
break;
case T_ILLINST|T_USER: /* Illegal instruction fault */
+ ucode = frame.f_format; /* XXX was ILL_PRIVIN_FAULT */
+ typ = ILL_ILLOPC;
+ i = SIGILL;
+ v = frame.f_pc;
+ break;
+
case T_PRIVINST|T_USER: /* Privileged instruction fault */
ucode = frame.f_format; /* XXX was ILL_PRIVIN_FAULT */
+ typ = ILL_PRVOPC;
i = SIGILL;
+ v = frame.f_pc;
break;
/*
* divde by zero, CHK/TRAPV inst
*/
case T_ZERODIV|T_USER: /* Divide by zero trap */
+ ucode = frame.f_format;
+ type = FPE_INTDIV;
+ i = SIGFPE;
+ v = frame.f_pc;
+ break;
+
case T_CHKINST|T_USER: /* CHK instruction trap */
- case T_TRAPVINST|T_USER: /* TRAPV instruction trap */
ucode = frame.f_format;
+ type = FPE_FLTSUB;
i = SIGFPE;
+ v = frame.f_pc;
+ break;
+
+ case T_TRAPVINST|T_USER: /* TRAPV instruction trap */
+ ucode = frame.f_format;
+ type = ILL_ILLTRP;
+ i = SIGILL;
+ v = frame.f_pc;
break;
/*
* User coprocessor violation
*/
case T_COPERR|T_USER:
+ typ = FPE_FLTINV;
ucode = 0;
i = SIGFPE; /* XXX What is a proper response here? */
break;
@@ -337,8 +367,10 @@ copyfault:
* 3 bits of the status register are defined as 0 so
* there is no clash.
*/
+ typ = FPE_FLTRES;
ucode = code;
i = SIGFPE;
+ v = frame.f_pc;
break;
/*
@@ -371,6 +403,8 @@ copyfault:
p->p_pid);
i = SIGILL;
#endif
+ typ = FPE_FLTINV;
+ v = frame.f_pc;
break;
case T_COPERR: /* Kernel coprocessor violation */
@@ -390,6 +424,8 @@ copyfault:
p->p_sigmask &= ~i;
i = SIGILL;
ucode = frame.f_format; /* XXX was ILL_RESAD_FAULT */
+ typ = ILL_COPROC;
+ v = frame.f_pc;
break;
/*
@@ -419,6 +455,7 @@ copyfault:
#endif
frame.f_sr &= ~PSL_T;
i = SIGTRAP;
+ typ = TRAP_TRACE;
break;
case T_TRACE|T_USER: /* user trace trap */
@@ -435,6 +472,7 @@ copyfault:
#endif
frame.f_sr &= ~PSL_T;
i = SIGTRAP;
+ typ = TRAP_TRACE;
break;
case T_ASTFLT: /* System async trap, cannot happen */
@@ -503,7 +541,7 @@ copyfault:
register struct vmspace *vm = p->p_vmspace;
register vm_map_t map;
int rv;
- vm_prot_t ftype;
+ vm_prot_t ftype, vftype;
extern vm_map_t kernel_map;
#ifdef DEBUG
@@ -524,10 +562,11 @@ copyfault:
map = kernel_map;
else
map = vm ? &vm->vm_map : kernel_map;
- if (WRFAULT(code))
+ if (WRFAULT(code)) {
+ vftype = VM_PROT_WRITE;
ftype = VM_PROT_READ | VM_PROT_WRITE;
- else
- ftype = VM_PROT_READ;
+ } else
+ vftype = ftype = VM_PROT_READ;
va = trunc_page((vm_offset_t) v);
#ifdef DEBUG
if (map == kernel_map && va == 0) {
@@ -578,13 +617,15 @@ copyfault:
type, code);
goto dopanic;
}
- ucode = v;
+ frame.f_pad = code & 0xffff;
+ ucode = vftype;
+ typ = SEGV_MAPERR;
i = SIGSEGV;
break;
}
}
if (i)
- trapsignal(p, i, ucode);
+ trapsignal(p, i, ucode, typ, (caddr_t) v);
if ((type & T_USER) == 0)
return;
out: