diff options
Diffstat (limited to 'sys/arch/mac68k')
-rw-r--r-- | sys/arch/mac68k/conf/TIGER | 3 | ||||
-rw-r--r-- | sys/arch/mac68k/conf/files.mac68k | 3 | ||||
-rw-r--r-- | sys/arch/mac68k/mac68k/locore.s | 42 | ||||
-rw-r--r-- | sys/arch/mac68k/mac68k/machdep.c | 319 |
4 files changed, 7 insertions, 360 deletions
diff --git a/sys/arch/mac68k/conf/TIGER b/sys/arch/mac68k/conf/TIGER index 81778126258..c201661e1b5 100644 --- a/sys/arch/mac68k/conf/TIGER +++ b/sys/arch/mac68k/conf/TIGER @@ -1,4 +1,4 @@ -# $OpenBSD: TIGER,v 1.4 1997/03/12 15:59:02 briggs Exp $ +# $OpenBSD: TIGER,v 1.5 1997/03/28 12:38:56 briggs Exp $ # $NetBSD: GENERIC,v 1.43 1996/09/22 06:49:09 scottr Exp $ # # Allen's Q700 @@ -81,4 +81,5 @@ pseudo-device bpfilter 12 pseudo-device vnd 2 pseudo-device ccd 2 pseudo-device ppp 2 +pseudo-device random 1 pseudo-device loop diff --git a/sys/arch/mac68k/conf/files.mac68k b/sys/arch/mac68k/conf/files.mac68k index 3726f9a5b8c..e072f7c143c 100644 --- a/sys/arch/mac68k/conf/files.mac68k +++ b/sys/arch/mac68k/conf/files.mac68k @@ -1,4 +1,4 @@ -# $OpenBSD: files.mac68k,v 1.14 1997/03/12 13:24:16 briggs Exp $ +# $OpenBSD: files.mac68k,v 1.15 1997/03/28 12:38:57 briggs Exp $ # $NetBSD: files.mac68k,v 1.61 1997/03/01 20:22:16 scottr Exp $ # mac68k-specific configuration info @@ -97,7 +97,6 @@ device fpu attach fpu at mainbus file arch/mac68k/mac68k/fpu.c fpu -file arch/m68k/m68k/copy.s file arch/m68k/m68k/db_memrw.c ddb include "../../../arch/m68k/fpe/files.fpe" diff --git a/sys/arch/mac68k/mac68k/locore.s b/sys/arch/mac68k/mac68k/locore.s index 2b096b24e57..f1df0427a99 100644 --- a/sys/arch/mac68k/mac68k/locore.s +++ b/sys/arch/mac68k/mac68k/locore.s @@ -1,4 +1,4 @@ -/* $OpenBSD: locore.s,v 1.20 1997/03/12 13:34:23 briggs Exp $ */ +/* $OpenBSD: locore.s,v 1.21 1997/03/28 12:38:58 briggs Exp $ */ /* $NetBSD: locore.s,v 1.74 1997/02/02 08:17:46 thorpej Exp $ */ /* @@ -1116,21 +1116,9 @@ _esigcode: #include <m68k/asm.h> /* - * non-local gotos + * Use common m68k support routines. */ -ENTRY(setjmp) - movl sp@(4),a0 | savearea pointer - moveml #0xFCFC,a0@ | save d2-d7/a2-a7 - movl sp@,a0@(48) | and return address - moveq #0,d0 | return 0 - rts - -ENTRY(longjmp) - movl sp@(4),a0 - moveml a0@+,#0xFCFC - movl a0@,sp@ - moveq #1,d0 - rts +#include <m68k/m68k/support.s> /* * The following primitives manipulate the run queues. @@ -1765,30 +1753,6 @@ ENTRY(spl0) Lspldone: rts -ENTRY(_insque) - movw sr,d0 - movw #PSL_HIGHIPL,sr | atomic - movl sp@(8),a0 | where to insert (after) - movl sp@(4),a1 | element to insert (e) - movl a0@,a1@ | e->next = after->next - movl a0,a1@(4) | e->prev = after - movl a1,a0@ | after->next = e - movl a1@,a0 - movl a1,a0@(4) | e->next->prev = e - movw d0,sr - rts - -ENTRY(_remque) - movw sr,d0 - movw #PSL_HIGHIPL,sr | atomic - movl sp@(4),a0 | element to remove (e) - movl a0@,a1 - movl a0@(4),a0 - movl a0,a1@(4) | e->next->prev = e->prev - movl a1,a0@ | e->prev->next = e->next - movw d0,sr - rts - /* * Save and restore 68881 state. * Pretty awful looking since our assembler does not diff --git a/sys/arch/mac68k/mac68k/machdep.c b/sys/arch/mac68k/mac68k/machdep.c index 981b42959f2..25530b37c22 100644 --- a/sys/arch/mac68k/mac68k/machdep.c +++ b/sys/arch/mac68k/mac68k/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.33 1997/03/15 05:51:15 briggs Exp $ */ +/* $OpenBSD: machdep.c,v 1.34 1997/03/28 12:38:59 briggs Exp $ */ /* $NetBSD: machdep.c,v 1.134 1997/02/14 06:15:30 scottr Exp $ */ /* @@ -538,323 +538,6 @@ setregs(p, pack, sp, retval) #endif } -#define SS_RTEFRAME 1 -#define SS_FPSTATE 2 -#define SS_USERREGS 4 - -struct sigstate { - int ss_flags; /* which of the following are valid */ - struct frame ss_frame; /* original exception frame */ - struct fpframe ss_fpstate; /* 68881/68882 state info */ -}; -/* - * WARNING: code in locore.s assumes the layout shown for sf_signum - * thru sf_handler so... don't screw with them! - */ -struct sigframe { - int sf_signum; /* signo 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; -int sigpid = 0; -#define SDB_FOLLOW 0x01 -#define SDB_KSTACK 0x02 -#define SDB_FPSTATE 0x04 -#endif - -/* - * Send an interrupt to process. - */ -void -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[]; - register struct proc *p = curproc; - register struct sigframe *fp, *kfp; - register struct frame *frame; - register struct sigacts *psp = p->p_sigacts; - register short ft; - int oonstack; - - frame = (struct frame *) p->p_md.md_regs; - ft = frame->f_format; - oonstack = psp->ps_sigstk.ss_flags & SS_ONSTACK; - - /* - * Allocate and validate space for the signal handler - * context. Note that if the stack is in P0 space, the - * call to grow() is a nop, and the useracc() check - * will fail if the process has not already allocated - * the space with a `brk'. - */ - if ((psp->ps_flags & SAS_ALTSTACK) && oonstack == 0 && - (psp->ps_sigonstack & sigmask(sig))) { - fp = (struct sigframe *) (psp->ps_sigstk.ss_sp + - psp->ps_sigstk.ss_size - sizeof(struct sigframe)); - psp->ps_sigstk.ss_flags |= SS_ONSTACK; - } else - fp = (struct sigframe *) frame->f_regs[SP] - 1; - if ((unsigned) fp <= USRSTACK - ctob(p->p_vmspace->vm_ssize)) - (void) grow(p, (unsigned) 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, &oonstack, fp, &fp->sf_sc, ft); -#endif - if (useracc((caddr_t) fp, sizeof(struct sigframe), B_WRITE) == 0) { -#ifdef DEBUG - if ((sigdebug & SDB_KSTACK) && p->p_pid == sigpid) - printf("sendsig(%d): useracc 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. - */ - SIGACTION(p, SIGILL) = SIG_DFL; - sig = sigmask(SIGILL); - p->p_sigignore &= ~sig; - p->p_sigcatch &= ~sig; - p->p_sigmask &= ~sig; - psignal(p, SIGILL); - return; - } - kfp = malloc(sizeof(struct sigframe), M_TEMP, M_WAITOK); - /* Build the argument list for the signal handler. */ - kfp->sf_signum = sig; - kfp->sf_sip = NULL; - kfp->sf_scp = &fp->sf_sc; - kfp->sf_handler = catcher; - - /* - * Save necessary hardware state. Currently this includes: - * - general registers - * - original exception frame (if not a "normal" frame) - * - FP coprocessor state - */ - kfp->sf_state.ss_flags = SS_USERREGS; - bcopy((caddr_t) frame->f_regs, - (caddr_t) kfp->sf_state.ss_frame.f_regs, sizeof frame->f_regs); - if (ft >= FMT9) { -#ifdef DEBUG - if (ft != FMT9 && ft != FMTA && ft != FMTB) - panic("sendsig: bogus frame type"); -#endif - kfp->sf_state.ss_flags |= SS_RTEFRAME; - kfp->sf_state.ss_frame.f_format = frame->f_format; - kfp->sf_state.ss_frame.f_vector = frame->f_vector; - bcopy((caddr_t) & frame->F_u, - (caddr_t) & kfp->sf_state.ss_frame.F_u, 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) { - kfp->sf_state.ss_flags |= SS_FPSTATE; - m68881_save(&kfp->sf_state.ss_fpstate); - } -#ifdef DEBUG - if ((sigdebug & SDB_FPSTATE) && *(char *) &kfp->sf_state.ss_fpstate) - printf("sendsig(%d): copy out FP state (%x) to %p\n", - p->p_pid, *(u_int *) & kfp->sf_state.ss_fpstate, - &kfp->sf_state.ss_fpstate); -#endif - - /* - * Build the signal context to be used by sigreturn. - */ - kfp->sf_sc.sc_onstack = oonstack; - kfp->sf_sc.sc_mask = mask; - kfp->sf_sc.sc_sp = frame->f_regs[SP]; - kfp->sf_sc.sc_fp = frame->f_regs[A6]; - 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 - if (sigdebug & SDB_FOLLOW) - printf("sendsig(%d): sig %d scp %p fp %p sc_sp %x sc_ap %x\n", - p->p_pid, sig, kfp->sf_scp, fp, - kfp->sf_sc.sc_sp, kfp->sf_sc.sc_ap); -#endif - /* - * Signal trampoline code is at base of user stack. - */ - frame->f_pc = (int) (((char *) PS_STRINGS) - (esigcode - sigcode)); -#ifdef DEBUG - if ((sigdebug & SDB_KSTACK) && p->p_pid == sigpid) - printf("sendsig(%d): sig %d returns\n", - p->p_pid, sig); -#endif - free((caddr_t) kfp, M_TEMP); -} - -/* - * 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 priviledges or to cause - * a machine fault. - */ -/* ARGSUSED */ -int -sys_sigreturn(p, v, retval) - struct proc *p; - void *v; - register_t *retval; -{ - struct sys_sigreturn_args /* { - syscallarg(struct sigcontext *) sigcntxp; - } */ *uap = v; - extern short exframesize[]; - struct sigcontext *scp, context; - struct frame *frame; - struct sigstate tstate; - int rf, flags; - - 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); - /* - * Test and fetch the context structure. - * We grab it all at once for speed. - */ - if (useracc((caddr_t) scp, sizeof(*scp), B_WRITE) == 0 || - copyin(scp, &context, sizeof(context))) - return (EINVAL); - scp = &context; - if ((scp->sc_ps & (PSL_MBZ | PSL_IPL | PSL_S)) != 0) - return (EINVAL); - /* - * Restore the user supplied information - */ - if (scp->sc_onstack & 1) - p->p_sigacts->ps_sigstk.ss_flags |= SS_ONSTACK; - else - p->p_sigacts->ps_sigstk.ss_flags &= ~SS_ONSTACK; - p->p_sigmask = scp->sc_mask & ~sigcantmask; - frame = (struct frame *) p->p_md.md_regs; - 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; - - /* - * Grab pointer to hardware state information. - * If zero, the user is probably doing a longjmp. - */ - if ((rf = scp->sc_ap) == 0) - return (EJUSTRETURN); - /* - * 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, (caddr_t) & tstate, sizeof tstate)) - return (EJUSTRETURN); -#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 most of the users registers except for A6 and SP - * which were handled above. - */ - if (flags & SS_USERREGS) - bcopy((caddr_t) tstate.ss_frame.f_regs, - (caddr_t) frame->f_regs, sizeof(frame->f_regs) - 2 * NBPW); - /* - * 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) - return (EINVAL); - frame->f_stackadj -= sz; - frame->f_format = tstate.ss_frame.f_format; - frame->f_vector = tstate.ss_frame.f_vector; - bcopy((caddr_t) & tstate.ss_frame.F_u, (caddr_t) & 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 - } - /* - * Finally we restore the original FP context - */ - if (flags & SS_FPSTATE) - m68881_restore(&tstate.ss_fpstate); -#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); -} - int waittime = -1; struct pcb dumppcb; |