Subject: Re: Linux compatibility?
To: John Klos <john@ziaspace.com>
From: Christopher SEKIYA <wileyc@rezrov.net>
List: port-sgimips
Date: 01/19/2004 17:06:13
On Sun, Jan 18, 2004 at 06:11:25PM -0500, John Klos wrote:
> Does anyone know the status? It doesn't compile, which is why it's
> commented out of the kernel config, I suppose...
It doesn't compile because it wasn't being used, so it was left behind when
the ksiginfo changes went in.
Below is a quick diff that addresses the register naming change and the
sig -> (ksi->ksi_signo) evolution. I have only compile-tested this -- I have
no linux MIPS binaries.
If there's no objection, I'll commit it tomorrow or the day after.
-- Chris
GPG key FEB9DE7F (91AF 4534 4529 4BCC 31A5 938E 023E EEFB FEB9 DE7F)
Index: linux_machdep.c
===================================================================
RCS file: /cvsroot/src/sys/compat/linux/arch/mips/linux_machdep.c,v
retrieving revision 1.20
diff -u -r1.20 linux_machdep.c
--- linux_machdep.c 4 Dec 2003 19:38:22 -0000 1.20
+++ linux_machdep.c 19 Jan 2004 08:05:32 -0000
@@ -121,17 +121,16 @@
*/
void
-linux_sendsig(sig, mask, code) /* XXX Check me */
- int sig;
+linux_sendsig(ksi, mask) /* XXX Check me */
+ const ksiginfo_t *ksi;
const sigset_t *mask;
- u_long code;
{
struct lwp *l = curlwp;
struct proc *p = l->l_proc;
struct linux_sigframe *fp;
struct frame *f;
int i,onstack;
- sig_t catcher = SIGACTION(p, sig).sa_handler;
+ sig_t catcher = SIGACTION(p, ksi->ksi_signo).sa_handler;
struct linux_sigframe sf;
#ifdef DEBUG_LINUX
@@ -144,7 +143,7 @@
*/
onstack =
(p->p_sigctx.ps_sigstk.ss_flags & (SS_DISABLE | SS_ONSTACK)) == 0 &&
- (SIGACTION(p, sig).sa_flags & SA_ONSTACK) != 0;
+ (SIGACTION(p, ksi->ksi_signo).sa_flags & SA_ONSTACK) != 0;
/*
* Signal stack is broken (see at the end of linux_sigreturn), so we do
@@ -161,7 +160,7 @@
+ p->p_sigctx.ps_sigstk.ss_size);
else
/* cast for _MIPS_BSD_API == _MIPS_BSD_API_LP32_64CLEAN case */
- fp = (struct linux_sigframe *)(u_int32_t)f->f_regs[SP];
+ fp = (struct linux_sigframe *)(u_int32_t)f->f_regs[_R_SP];
/*
* Build stack frame for signal trampoline.
@@ -179,12 +178,12 @@
for (i=0; i<32; i++) {
sf.lsf_sc.lsc_regs[i] = f->f_regs[i];
}
- sf.lsf_sc.lsc_mdhi = f->f_regs[MULHI];
- sf.lsf_sc.lsc_mdlo = f->f_regs[MULLO];
- sf.lsf_sc.lsc_pc = f->f_regs[PC];
- sf.lsf_sc.lsc_status = f->f_regs[SR];
- sf.lsf_sc.lsc_cause = f->f_regs[CAUSE];
- sf.lsf_sc.lsc_badvaddr = f->f_regs[BADVADDR];
+ sf.lsf_sc.lsc_mdhi = f->f_regs[_R_MULHI];
+ sf.lsf_sc.lsc_mdlo = f->f_regs[_R_MULLO];
+ sf.lsf_sc.lsc_pc = f->f_regs[_R_PC];
+ sf.lsf_sc.lsc_status = f->f_regs[_R_SR];
+ sf.lsf_sc.lsc_cause = f->f_regs[_R_CAUSE];
+ sf.lsf_sc.lsc_badvaddr = f->f_regs[_R_BADVADDR];
/*
* Save signal stack. XXX broken
@@ -208,19 +207,19 @@
}
/* Set up the registers to return to sigcode. */
- f->f_regs[A0] = native_to_linux_signo[sig];
- f->f_regs[A1] = 0;
- f->f_regs[A2] = (unsigned long)&fp->lsf_sc;
+ f->f_regs[_R_A0] = native_to_linux_signo[ksi->ksi_signo];
+ f->f_regs[_R_A1] = 0;
+ f->f_regs[_R_A2] = (unsigned long)&fp->lsf_sc;
#ifdef DEBUG_LINUX
printf("sigcontext is at %p\n", &fp->lsf_sc);
#endif /* DEBUG_LINUX */
- f->f_regs[SP] = (unsigned long)fp;
+ f->f_regs[_R_SP] = (unsigned long)fp;
/* Signal trampoline code is at base of user stack. */
- f->f_regs[RA] = (unsigned long)p->p_sigctx.ps_sigcode;
- f->f_regs[T9] = (unsigned long)catcher;
- f->f_regs[PC] = (unsigned long)catcher;
+ f->f_regs[_R_RA] = (unsigned long)p->p_sigctx.ps_sigcode;
+ f->f_regs[_R_T9] = (unsigned long)catcher;
+ f->f_regs[_R_PC] = (unsigned long)catcher;
/* Remember that we're now on the signal stack. */
if (onstack)
@@ -267,11 +266,11 @@
f = (struct frame *)l->l_md.md_regs;
for (i=0; i<32; i++)
f->f_regs[i] = ksf.lsf_sc.lsc_regs[i];
- f->f_regs[MULLO] = ksf.lsf_sc.lsc_mdlo;
- f->f_regs[MULHI] = ksf.lsf_sc.lsc_mdhi;
- f->f_regs[PC] = ksf.lsf_sc.lsc_pc;
- f->f_regs[BADVADDR] = ksf.lsf_sc.lsc_badvaddr;
- f->f_regs[CAUSE] = ksf.lsf_sc.lsc_cause;
+ f->f_regs[_R_MULLO] = ksf.lsf_sc.lsc_mdlo;
+ f->f_regs[_R_MULHI] = ksf.lsf_sc.lsc_mdhi;
+ f->f_regs[_R_PC] = ksf.lsf_sc.lsc_pc;
+ f->f_regs[_R_BADVADDR] = ksf.lsf_sc.lsc_badvaddr;
+ f->f_regs[_R_CAUSE] = ksf.lsf_sc.lsc_cause;
/* Restore signal stack. */
p->p_sigctx.ps_sigstk.ss_flags &= ~SS_ONSTACK;