Deleted Added
full compact
2a3,4
> * Copyright (c) 1992 Terrence R. Lambert.
> * Copyright (c) 1982, 1987, 1990 The Regents of the University of California.
4a7,9
> * This code is derived from software contributed to Berkeley by
> * William Jolitz.
> *
12a18,24
> * 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.
14c26
< * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
---
> * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17c29
< * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
---
> * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26c38,40
< * $FreeBSD: head/sys/sparc64/sparc64/machdep.c 82016 2001-08-21 00:07:37Z jake $
---
> * from: @(#)machdep.c 7.4 (Berkeley) 6/3/91
> * from: FreeBSD: src/sys/i386/i386/machdep.c,v 1.477 2001/08/27
> * $FreeBSD: head/sys/sparc64/sparc64/machdep.c 82902 2001-09-03 22:41:40Z jake $
43a58
> #include <sys/sysent.h>
46a62
> #include <sys/exec.h>
63c79
< #include <machine/frame.h>
---
> #include <machine/cpu.h>
68a85
> #include <machine/sigframe.h>
70a88
> #include <machine/ver.h>
82a101,102
> u_long debug_mask;
>
87,88d106
< #define GLOBALSTACK_SZ 128
< u_long __globalstack[GLOBALSTACK_SZ];
97,98c115
< vm_offset_t clean_sva;
< vm_offset_t clean_eva;
---
> struct kva_md_info kmi;
103,107d119
< static vm_offset_t buffer_sva;
< static vm_offset_t buffer_eva;
< static vm_offset_t pager_sva;
< static vm_offset_t pager_eva;
<
119,121d130
< vm_offset_t physmem_est;
< vm_offset_t minaddr;
< vm_offset_t maxaddr;
124,126d132
< vm_offset_t va;
< vm_size_t size;
< char name[32];
129,131d134
< int factor;
< caddr_t p;
< int i;
141d143
< OF_getprop(child, "name", name, sizeof(name));
162a165,166
> vm_ksubmap_init(&kmi);
> #if 0
247a252
> #endif
253c258
<
---
> #if 0
254a260
> #endif
345a352,353
> __asm __volatile("mov %0, %%g6" : : "r"
> (&__globaldata.gd_alt_stack[ALT_STACK_SIZE - 1]));
347,348d354
< __asm __volatile("mov %0, %%g6" : :
< "r" (&__globalstack[GLOBALSTACK_SZ - 1]));
380c386,495
< TODO;
---
> struct trapframe *tf;
> struct sigframe *sfp;
> struct sigacts *psp;
> struct sigframe sf;
> struct proc *p;
> u_long sp;
> int oonstack;
>
> oonstack = 0;
> p = curproc;
> PROC_LOCK(p);
> psp = p->p_sigacts;
> tf = p->p_frame;
> sp = tf->tf_sp + SPOFF;
> oonstack = sigonstack(sp);
>
> CTR4(KTR_SIG, "sendsig: p=%p (%s) catcher=%p sig=%d", p, p->p_comm,
> catcher, sig);
>
> /* Save user context. */
> bzero(&sf, sizeof(sf));
> sf.sf_uc.uc_sigmask = *mask;
> sf.sf_uc.uc_stack = p->p_sigstk;
> sf.sf_uc.uc_stack.ss_flags = (p->p_flag & P_ALTSTACK)
> ? ((oonstack) ? SS_ONSTACK : 0) : SS_DISABLE;
> sf.sf_uc.uc_mcontext.mc_onstack = (oonstack) ? 1 : 0;
> bcopy(tf->tf_global, sf.sf_uc.uc_mcontext.mc_global,
> sizeof (tf->tf_global));
> bcopy(tf->tf_out, sf.sf_uc.uc_mcontext.mc_out, sizeof (tf->tf_out));
> sf.sf_uc.uc_mcontext.mc_sp = tf->tf_sp;
> sf.sf_uc.uc_mcontext.mc_tpc = tf->tf_tpc;
> sf.sf_uc.uc_mcontext.mc_tnpc = tf->tf_tnpc;
> sf.sf_uc.uc_mcontext.mc_tstate = tf->tf_tstate;
>
> /* Allocate and validate space for the signal handler context. */
> if ((p->p_flag & P_ALTSTACK) != 0 && !oonstack &&
> SIGISMEMBER(psp->ps_sigonstack, sig)) {
> sfp = (struct sigframe *)(p->p_sigstk.ss_sp +
> p->p_sigstk.ss_size - sizeof(struct sigframe));
> #if defined(COMPAT_43) || defined(COMPAT_SUNOS)
> p->p_sigstk.ss_flags |= SS_ONSTACK;
> #endif
> } else
> sfp = (struct sigframe *)sp - 1;
> PROC_UNLOCK(p);
>
> /*
> * grow_stack() will return 0 if *sfp does not fit inside the stack
> * and the stack can not be grown.
> * useracc() will return FALSE if access is denied.
> */
> if (vm_map_growstack(p, (u_long)sfp) != KERN_SUCCESS ||
> !useracc((caddr_t)sfp, sizeof(*sfp), VM_PROT_WRITE)) {
> /*
> * Process has trashed its stack; give it an illegal
> * instruction to halt it in its tracks.
> */
> CTR2(KTR_SIG, "sendsig: trashed stack p=%p sfp=%p", p, sfp);
> PROC_LOCK(p);
> SIGACTION(p, SIGILL) = SIG_DFL;
> SIGDELSET(p->p_sigignore, SIGILL);
> SIGDELSET(p->p_sigcatch, SIGILL);
> SIGDELSET(p->p_sigmask, SIGILL);
> psignal(p, SIGILL);
> PROC_UNLOCK(p);
> return;
> }
>
> /* Translate the signal if appropriate. */
> if (p->p_sysent->sv_sigtbl && sig <= p->p_sysent->sv_sigsize)
> sig = p->p_sysent->sv_sigtbl[_SIG_IDX(sig)];
>
> /* Build the argument list for the signal handler. */
> tf->tf_out[0] = sig;
> tf->tf_out[2] = (register_t)&sfp->sf_uc;
> tf->tf_out[3] = tf->tf_type;
> tf->tf_out[4] = (register_t)catcher;
> PROC_LOCK(p);
> if (SIGISMEMBER(p->p_sigacts->ps_siginfo, sig)) {
> /* Signal handler installed with SA_SIGINFO. */
> tf->tf_out[1] = (register_t)&sfp->sf_si;
>
> /* Fill siginfo structure. */
> sf.sf_si.si_signo = sig;
> sf.sf_si.si_code = code;
> sf.sf_si.si_addr = (void *)tf->tf_type;
> } else {
> /* Old FreeBSD-style arguments. */
> tf->tf_out[1] = code;
> }
> PROC_UNLOCK(p);
>
> /* Copy the sigframe out to the user's stack. */
> if (rwindow_save(p) != 0 || copyout(&sf, sfp, sizeof(*sfp)) != 0) {
> /*
> * Something is wrong with the stack pointer.
> * ...Kill the process.
> */
> CTR2(KTR_SIG, "sendsig: sigexit p=%p sfp=%p", p, sfp);
> PROC_LOCK(p);
> sigexit(p, SIGILL);
> /* NOTREACHED */
> }
>
> tf->tf_tpc = PS_STRINGS - *(p->p_sysent->sv_szsigcode);
> tf->tf_tnpc = tf->tf_tpc + 4;
> tf->tf_sp = (u_long)sfp - SPOFF;
>
> CTR3(KTR_SIG, "sendsig: return p=%p pc=%#lx sp=%#lx", p, tf->tf_tpc,
> tf->tf_sp);
392,393c507,545
< TODO;
< return (0);
---
> struct trapframe *tf;
> ucontext_t uc;
>
> if (rwindow_save(p)) {
> PROC_LOCK(p);
> sigexit(p, SIGILL);
> }
>
> CTR2(KTR_SIG, "sigreturn: p=%p ucp=%p", p, uap->sigcntxp);
> if (copyin(uap->sigcntxp, &uc, sizeof(uc)) != 0) {
> CTR1(KTR_SIG, "sigreturn: efault p=%p", p);
> return (EFAULT);
> }
>
> if (((uc.uc_mcontext.mc_tpc | uc.uc_mcontext.mc_tnpc) & 3) != 0)
> return (EINVAL);
>
> tf = p->p_frame;
> bcopy(uc.uc_mcontext.mc_global, tf->tf_global,
> sizeof(tf->tf_global));
> bcopy(uc.uc_mcontext.mc_out, tf->tf_out, sizeof(tf->tf_out));
> tf->tf_sp = uc.uc_mcontext.mc_sp;
> tf->tf_tpc = uc.uc_mcontext.mc_tpc;
> tf->tf_tnpc = uc.uc_mcontext.mc_tnpc;
> tf->tf_tstate = uc.uc_mcontext.mc_tstate;
> PROC_LOCK(p);
> #if defined(COMPAT_43) || defined(COMPAT_SUNOS)
> if (uc.uc_mcontext.mc_onstack & 1)
> p->p_sigstk.ss_flags |= SS_ONSTACK;
> else
> p->p_sigstk.ss_flags &= ~SS_ONSTACK;
> #endif
>
> p->p_sigmask = uc.uc_sigmask;
> SIG_CANTMASK(p->p_sigmask);
> PROC_UNLOCK(p);
> CTR4(KTR_SIG, "sigreturn: return p=%p pc=%#lx sp=%#lx tstate=%#lx",
> p, tf->tf_tpc, tf->tf_sp, tf->tf_tstate);
> return (EJUSTRETURN);
422c574
< struct wsframe *fp;
---
> struct frame *fp;
428c580
< bzero(pcb->pcb_wscratch, sizeof(pcb->pcb_wscratch));
---
> bzero(pcb->pcb_rw, sizeof(pcb->pcb_rw));
430,433c582
< fp = &pcb->pcb_wscratch[0];
< pcb->pcb_cwp = 1;
< pcb->pcb_ws_inuse = 1;
< pcb->pcb_inwinop = 0;
---
> fp = (struct frame *)((caddr_t)p->p_addr + UPAGES * PAGE_SIZE) - 1;
453a603,604
> /* Set up user stack. */
> fp->f_fp = stack - SPOFF;
456,458d606
< /* shouldn't be needed */
< fp->wsf_sp = stack - SPOFF - sizeof(struct frame);
< fp->wsf_inuse = 1;