Commit bf306055 authored by Anton Blanchard's avatar Anton Blanchard

ppc64: remove old code for stacking signals, its not used any more

parent c0a8b2ab
......@@ -246,7 +246,6 @@ int sys_rt_sigreturn(unsigned long r3, unsigned long r4, unsigned long r5,
struct rt_sigframe *rt_sf;
struct sigcontext_struct sigctx;
struct sigregs *sr;
int ret;
elf_gregset_t saved_regs; /* an array of ELF_NGREG unsigned longs */
sigset_t set;
stack_t st;
......@@ -263,52 +262,29 @@ int sys_rt_sigreturn(unsigned long r3, unsigned long r4, unsigned long r5,
recalc_sigpending();
spin_unlock_irq(&current->sigmask_lock);
rt_sf++; /* Look at next rt_sigframe */
if (rt_sf == (struct rt_sigframe *)(sigctx.regs)) {
/* Last stacked signal - restore registers -
* sigctx is initialized to point to the
* preamble frame (where registers are stored)
* see handle_signal()
*/
sr = (struct sigregs *) sigctx.regs;
if (regs->msr & MSR_FP )
giveup_fpu(current);
if (copy_from_user(saved_regs, &sr->gp_regs,
sizeof(sr->gp_regs)))
goto badframe;
saved_regs[PT_MSR] = (regs->msr & ~MSR_USERCHANGE)
| (saved_regs[PT_MSR] & MSR_USERCHANGE);
saved_regs[PT_SOFTE] = regs->softe;
memcpy(regs, saved_regs, GP_REGS_SIZE);
if (copy_from_user(current->thread.fpr, &sr->fp_regs,
sizeof(sr->fp_regs)))
goto badframe;
/* This function sets back the stack flags into
the current task structure. */
sys_sigaltstack(&st, NULL);
/* restore registers -
* sigctx is initialized to point to the
* preamble frame (where registers are stored)
* see handle_signal()
*/
sr = (struct sigregs *) sigctx.regs;
if (regs->msr & MSR_FP )
giveup_fpu(current);
if (copy_from_user(saved_regs, &sr->gp_regs,
sizeof(sr->gp_regs)))
goto badframe;
saved_regs[PT_MSR] = (regs->msr & ~MSR_USERCHANGE)
| (saved_regs[PT_MSR] & MSR_USERCHANGE);
saved_regs[PT_SOFTE] = regs->softe;
memcpy(regs, saved_regs, GP_REGS_SIZE);
if (copy_from_user(current->thread.fpr, &sr->fp_regs,
sizeof(sr->fp_regs)))
goto badframe;
/* This function sets back the stack flags into
the current task structure. */
sys_sigaltstack(&st, NULL);
ret = regs->result;
} else {
/* More signals to go */
/* Set up registers for next signal handler */
regs->gpr[1] = (unsigned long)rt_sf - __SIGNAL_FRAMESIZE;
if (copy_from_user(&sigctx, &rt_sf->uc.uc_mcontext, sizeof(sigctx)))
goto badframe;
sr = (struct sigregs *) sigctx.regs;
regs->gpr[3] = ret = sigctx.signal;
/* Get the siginfo */
get_user(regs->gpr[4], (unsigned long *)&rt_sf->pinfo);
/* Get the ucontext */
get_user(regs->gpr[5], (unsigned long *)&rt_sf->puc);
regs->gpr[6] = (unsigned long) rt_sf;
regs->link = (unsigned long) &sr->tramp;
regs->nip = sigctx.handler;
if (get_user(prevsp, &sr->gp_regs[PT_R1])
|| put_user(prevsp, (unsigned long *) regs->gpr[1]))
goto badframe;
}
return ret;
return regs->result;
badframe:
do_exit(SIGSEGV);
......@@ -388,7 +364,6 @@ long sys_sigreturn(unsigned long r3, unsigned long r4, unsigned long r5,
{
struct sigcontext_struct *sc, sigctx;
struct sigregs *sr;
long ret;
elf_gregset_t saved_regs; /* an array of ELF_NGREG unsigned longs */
sigset_t set;
unsigned long prevsp;
......@@ -407,42 +382,23 @@ long sys_sigreturn(unsigned long r3, unsigned long r4, unsigned long r5,
recalc_sigpending();
spin_unlock_irq(&current->sigmask_lock);
sc++; /* Look at next sigcontext */
if (sc == (struct sigcontext_struct *)(sigctx.regs)) {
/* Last stacked signal - restore registers */
sr = (struct sigregs *) sigctx.regs;
if (regs->msr & MSR_FP )
giveup_fpu(current);
if (copy_from_user(saved_regs, &sr->gp_regs,
sizeof(sr->gp_regs)))
goto badframe;
saved_regs[PT_MSR] = (regs->msr & ~MSR_USERCHANGE)
| (saved_regs[PT_MSR] & MSR_USERCHANGE);
saved_regs[PT_SOFTE] = regs->softe;
memcpy(regs, saved_regs, GP_REGS_SIZE);
if (copy_from_user(current->thread.fpr, &sr->fp_regs,
sizeof(sr->fp_regs)))
goto badframe;
/* restore registers */
sr = (struct sigregs *) sigctx.regs;
if (regs->msr & MSR_FP )
giveup_fpu(current);
if (copy_from_user(saved_regs, &sr->gp_regs,
sizeof(sr->gp_regs)))
goto badframe;
saved_regs[PT_MSR] = (regs->msr & ~MSR_USERCHANGE)
| (saved_regs[PT_MSR] & MSR_USERCHANGE);
saved_regs[PT_SOFTE] = regs->softe;
memcpy(regs, saved_regs, GP_REGS_SIZE);
ret = regs->result;
if (copy_from_user(current->thread.fpr, &sr->fp_regs,
sizeof(sr->fp_regs)))
goto badframe;
} else {
/* More signals to go */
regs->gpr[1] = (unsigned long)sc - __SIGNAL_FRAMESIZE;
if (copy_from_user(&sigctx, sc, sizeof(sigctx)))
goto badframe;
sr = (struct sigregs *) sigctx.regs;
regs->gpr[3] = ret = sigctx.signal;
regs->gpr[4] = (unsigned long) sc;
regs->link = (unsigned long) &sr->tramp;
regs->nip = sigctx.handler;
if (get_user(prevsp, &sr->gp_regs[PT_R1])
|| put_user(prevsp, (unsigned long *) regs->gpr[1]))
goto badframe;
}
return ret;
return regs->result;
badframe:
do_exit(SIGSEGV);
......@@ -552,7 +508,7 @@ handle_signal(unsigned long sig, struct k_sigaction *ka,
|| __put_user(sig, &rt_sf->uc.uc_mcontext.signal))
goto badframe;
} else {
/* Put another sigcontext on the stack */
/* Put a sigcontext on the stack */
*newspp -= sizeof(*sc);
sc = (struct sigcontext_struct *) *newspp;
if (verify_area(VERIFY_WRITE, sc, sizeof(*sc)))
......
......@@ -254,116 +254,96 @@ long sys32_sigreturn(unsigned long r3, unsigned long r4, unsigned long r5,
recalc_sigpending();
spin_unlock_irq(&current->sigmask_lock);
sc++; /* Look at next sigcontext */
/* If the next sigcontext is actually the sigregs (frame) */
/* - then no more sigcontexts on the user stack */
if (sc == (struct sigcontext32_struct*)(u64)sigctx.regs)
{
/* Last stacked signal - restore registers */
sr = (struct sigregs32*)(u64)sigctx.regs;
if (regs->msr & MSR_FP )
giveup_fpu(current);
/* copy the 32 bit register values off the user stack */
/* into the 32 bit register area */
if (copy_from_user(saved_regs, &sr->gp_regs,sizeof(sr->gp_regs)))
goto badframe;
/**********************************************************************/
/* The saved reg structure in the frame is an elf_grepset_t32, it is */
/* a 32 bit register save of the registers in the pt_regs structure */
/* that was stored on the kernel stack during the system call */
/* when the system call was interrupted for the signal. Only 32 bits*/
/* are saved because the sigcontext contains a pointer to the regs */
/* and the sig context address is passed as a pointer to the signal */
/* handler. */
/* */
/* The entries in the elf_grepset have the same index as the elements */
/* in the pt_regs structure. */
/* */
/**********************************************************************/
saved_regs[PT_MSR] = (regs->msr & ~MSR_USERCHANGE)
| (saved_regs[PT_MSR] & MSR_USERCHANGE);
regs->gpr[0] = (u64)(saved_regs[0]) & 0xFFFFFFFF;
regs->gpr[1] = (u64)(saved_regs[1]) & 0xFFFFFFFF;
/**********************************************************************/
/* Register 2 is the kernel toc - should be reset on any calls into */
/* the kernel */
/**********************************************************************/
regs->gpr[2] = (u64)(saved_regs[2]) & 0xFFFFFFFF;
regs->gpr[3] = (u64)(saved_regs[3]) & 0xFFFFFFFF;
regs->gpr[4] = (u64)(saved_regs[4]) & 0xFFFFFFFF;
regs->gpr[5] = (u64)(saved_regs[5]) & 0xFFFFFFFF;
regs->gpr[6] = (u64)(saved_regs[6]) & 0xFFFFFFFF;
regs->gpr[7] = (u64)(saved_regs[7]) & 0xFFFFFFFF;
regs->gpr[8] = (u64)(saved_regs[8]) & 0xFFFFFFFF;
regs->gpr[9] = (u64)(saved_regs[9]) & 0xFFFFFFFF;
regs->gpr[10] = (u64)(saved_regs[10]) & 0xFFFFFFFF;
regs->gpr[11] = (u64)(saved_regs[11]) & 0xFFFFFFFF;
regs->gpr[12] = (u64)(saved_regs[12]) & 0xFFFFFFFF;
regs->gpr[13] = (u64)(saved_regs[13]) & 0xFFFFFFFF;
regs->gpr[14] = (u64)(saved_regs[14]) & 0xFFFFFFFF;
regs->gpr[15] = (u64)(saved_regs[15]) & 0xFFFFFFFF;
regs->gpr[16] = (u64)(saved_regs[16]) & 0xFFFFFFFF;
regs->gpr[17] = (u64)(saved_regs[17]) & 0xFFFFFFFF;
regs->gpr[18] = (u64)(saved_regs[18]) & 0xFFFFFFFF;
regs->gpr[19] = (u64)(saved_regs[19]) & 0xFFFFFFFF;
regs->gpr[20] = (u64)(saved_regs[20]) & 0xFFFFFFFF;
regs->gpr[21] = (u64)(saved_regs[21]) & 0xFFFFFFFF;
regs->gpr[22] = (u64)(saved_regs[22]) & 0xFFFFFFFF;
regs->gpr[23] = (u64)(saved_regs[23]) & 0xFFFFFFFF;
regs->gpr[24] = (u64)(saved_regs[24]) & 0xFFFFFFFF;
regs->gpr[25] = (u64)(saved_regs[25]) & 0xFFFFFFFF;
regs->gpr[26] = (u64)(saved_regs[26]) & 0xFFFFFFFF;
regs->gpr[27] = (u64)(saved_regs[27]) & 0xFFFFFFFF;
regs->gpr[28] = (u64)(saved_regs[28]) & 0xFFFFFFFF;
regs->gpr[29] = (u64)(saved_regs[29]) & 0xFFFFFFFF;
regs->gpr[30] = (u64)(saved_regs[30]) & 0xFFFFFFFF;
regs->gpr[31] = (u64)(saved_regs[31]) & 0xFFFFFFFF;
/****************************************************/
/* restore the non gpr registers */
/****************************************************/
regs->msr = (u64)(saved_regs[PT_MSR]) & 0xFFFFFFFF;
/* Insure that the interrupt mode is 64 bit, during 32 bit execution.
* (This is necessary because we only saved lower 32 bits of msr.)
*/
regs->msr = regs->msr | MSR_ISF; /* When this thread is interrupted it should run in 64 bit mode. */
regs->nip = (u64)(saved_regs[PT_NIP]) & 0xFFFFFFFF;
regs->orig_gpr3 = (u64)(saved_regs[PT_ORIG_R3]) & 0xFFFFFFFF;
regs->ctr = (u64)(saved_regs[PT_CTR]) & 0xFFFFFFFF;
regs->link = (u64)(saved_regs[PT_LNK]) & 0xFFFFFFFF;
regs->xer = (u64)(saved_regs[PT_XER]) & 0xFFFFFFFF;
regs->ccr = (u64)(saved_regs[PT_CCR]) & 0xFFFFFFFF;
/* regs->softe is left unchanged (like the MSR.EE bit) */
/******************************************************/
/* the DAR and the DSISR are only relevant during a */
/* data or instruction storage interrupt. The value */
/* will be set to zero. */
/******************************************************/
regs->dar = 0;
regs->dsisr = 0;
regs->result = (u64)(saved_regs[PT_RESULT]) & 0xFFFFFFFF;
if (copy_from_user(current->thread.fpr, &sr->fp_regs, sizeof(sr->fp_regs)))
goto badframe;
/* Last stacked signal - restore registers */
sr = (struct sigregs32*)(u64)sigctx.regs;
if (regs->msr & MSR_FP )
giveup_fpu(current);
/* copy the 32 bit register values off the user stack */
/* into the 32 bit register area */
if (copy_from_user(saved_regs, &sr->gp_regs,sizeof(sr->gp_regs)))
goto badframe;
/**********************************************************************/
/* The saved reg structure in the frame is an elf_grepset_t32, it is */
/* a 32 bit register save of the registers in the pt_regs structure */
/* that was stored on the kernel stack during the system call */
/* when the system call was interrupted for the signal. Only 32 bits*/
/* are saved because the sigcontext contains a pointer to the regs */
/* and the sig context address is passed as a pointer to the signal */
/* handler. */
/* */
/* The entries in the elf_grepset have the same index as the elements */
/* in the pt_regs structure. */
/* */
/**********************************************************************/
saved_regs[PT_MSR] = (regs->msr & ~MSR_USERCHANGE)
| (saved_regs[PT_MSR] & MSR_USERCHANGE);
regs->gpr[0] = (u64)(saved_regs[0]) & 0xFFFFFFFF;
regs->gpr[1] = (u64)(saved_regs[1]) & 0xFFFFFFFF;
/**********************************************************************/
/* Register 2 is the kernel toc - should be reset on any calls into */
/* the kernel */
/**********************************************************************/
regs->gpr[2] = (u64)(saved_regs[2]) & 0xFFFFFFFF;
regs->gpr[3] = (u64)(saved_regs[3]) & 0xFFFFFFFF;
regs->gpr[4] = (u64)(saved_regs[4]) & 0xFFFFFFFF;
regs->gpr[5] = (u64)(saved_regs[5]) & 0xFFFFFFFF;
regs->gpr[6] = (u64)(saved_regs[6]) & 0xFFFFFFFF;
regs->gpr[7] = (u64)(saved_regs[7]) & 0xFFFFFFFF;
regs->gpr[8] = (u64)(saved_regs[8]) & 0xFFFFFFFF;
regs->gpr[9] = (u64)(saved_regs[9]) & 0xFFFFFFFF;
regs->gpr[10] = (u64)(saved_regs[10]) & 0xFFFFFFFF;
regs->gpr[11] = (u64)(saved_regs[11]) & 0xFFFFFFFF;
regs->gpr[12] = (u64)(saved_regs[12]) & 0xFFFFFFFF;
regs->gpr[13] = (u64)(saved_regs[13]) & 0xFFFFFFFF;
regs->gpr[14] = (u64)(saved_regs[14]) & 0xFFFFFFFF;
regs->gpr[15] = (u64)(saved_regs[15]) & 0xFFFFFFFF;
regs->gpr[16] = (u64)(saved_regs[16]) & 0xFFFFFFFF;
regs->gpr[17] = (u64)(saved_regs[17]) & 0xFFFFFFFF;
regs->gpr[18] = (u64)(saved_regs[18]) & 0xFFFFFFFF;
regs->gpr[19] = (u64)(saved_regs[19]) & 0xFFFFFFFF;
regs->gpr[20] = (u64)(saved_regs[20]) & 0xFFFFFFFF;
regs->gpr[21] = (u64)(saved_regs[21]) & 0xFFFFFFFF;
regs->gpr[22] = (u64)(saved_regs[22]) & 0xFFFFFFFF;
regs->gpr[23] = (u64)(saved_regs[23]) & 0xFFFFFFFF;
regs->gpr[24] = (u64)(saved_regs[24]) & 0xFFFFFFFF;
regs->gpr[25] = (u64)(saved_regs[25]) & 0xFFFFFFFF;
regs->gpr[26] = (u64)(saved_regs[26]) & 0xFFFFFFFF;
regs->gpr[27] = (u64)(saved_regs[27]) & 0xFFFFFFFF;
regs->gpr[28] = (u64)(saved_regs[28]) & 0xFFFFFFFF;
regs->gpr[29] = (u64)(saved_regs[29]) & 0xFFFFFFFF;
regs->gpr[30] = (u64)(saved_regs[30]) & 0xFFFFFFFF;
regs->gpr[31] = (u64)(saved_regs[31]) & 0xFFFFFFFF;
/****************************************************/
/* restore the non gpr registers */
/****************************************************/
regs->msr = (u64)(saved_regs[PT_MSR]) & 0xFFFFFFFF;
/* Insure that the interrupt mode is 64 bit, during 32 bit execution.
* (This is necessary because we only saved lower 32 bits of msr.)
*/
regs->msr = regs->msr | MSR_ISF; /* When this thread is interrupted it should run in 64 bit mode. */
regs->nip = (u64)(saved_regs[PT_NIP]) & 0xFFFFFFFF;
regs->orig_gpr3 = (u64)(saved_regs[PT_ORIG_R3]) & 0xFFFFFFFF;
regs->ctr = (u64)(saved_regs[PT_CTR]) & 0xFFFFFFFF;
regs->link = (u64)(saved_regs[PT_LNK]) & 0xFFFFFFFF;
regs->xer = (u64)(saved_regs[PT_XER]) & 0xFFFFFFFF;
regs->ccr = (u64)(saved_regs[PT_CCR]) & 0xFFFFFFFF;
/* regs->softe is left unchanged (like the MSR.EE bit) */
/******************************************************/
/* the DAR and the DSISR are only relevant during a */
/* data or instruction storage interrupt. The value */
/* will be set to zero. */
/******************************************************/
regs->dar = 0;
regs->dsisr = 0;
regs->result = (u64)(saved_regs[PT_RESULT]) & 0xFFFFFFFF;
if (copy_from_user(current->thread.fpr, &sr->fp_regs, sizeof(sr->fp_regs)))
goto badframe;
ret = regs->result;
} else {
/* More signals to go */
regs->gpr[1] = (unsigned long)sc - __SIGNAL_FRAMESIZE32;
if (copy_from_user(&sigctx, sc, sizeof(sigctx)))
goto badframe;
sr = (struct sigregs32*)(u64)sigctx.regs;
regs->gpr[3] = ret = sigctx.signal;
regs->gpr[4] = (unsigned long) sc;
regs->link = (unsigned long) &sr->tramp;
regs->nip = sigctx.handler;
if (get_user(prevsp, &sr->gp_regs[PT_R1])
|| put_user(prevsp, (unsigned int*) regs->gpr[1]))
goto badframe;
}
ret = regs->result;
return ret;
badframe:
......@@ -561,125 +541,90 @@ long sys32_rt_sigreturn(unsigned long r3, unsigned long r4, unsigned long r5,
/* Set to point to the next rt_sigframe - this is used to determine whether this
* is the last signal to process
*/
rt_stack_frame ++;
if (rt_stack_frame == (struct rt_sigframe_32 *)(u64)(sigctx.regs))
signalregs = (struct sigregs32 *) (u64)sigctx.regs;
/* If currently owning the floating point - give them up */
if (regs->msr & MSR_FP)
{
signalregs = (struct sigregs32 *) (u64)sigctx.regs;
/* If currently owning the floating point - give them up */
if (regs->msr & MSR_FP)
{
giveup_fpu(current);
}
if (copy_from_user(saved_regs,&signalregs->gp_regs,sizeof(signalregs->gp_regs)))
{
goto badframe;
}
/**********************************************************************/
/* The saved reg structure in the frame is an elf_grepset_t32, it is */
/* a 32 bit register save of the registers in the pt_regs structure */
/* that was stored on the kernel stack during the system call */
/* when the system call was interrupted for the signal. Only 32 bits*/
/* are saved because the sigcontext contains a pointer to the regs */
/* and the sig context address is passed as a pointer to the signal */
/* handler. */
/* */
/* The entries in the elf_grepset have the same index as the elements */
/* in the pt_regs structure. */
/* */
/**********************************************************************/
saved_regs[PT_MSR] = (regs->msr & ~MSR_USERCHANGE)
| (saved_regs[PT_MSR] & MSR_USERCHANGE);
regs->gpr[0] = (u64)(saved_regs[0]) & 0xFFFFFFFF;
regs->gpr[1] = (u64)(saved_regs[1]) & 0xFFFFFFFF;
/**********************************************************************/
/* Register 2 is the kernel toc - should be reset on any calls into */
/* the kernel */
/**********************************************************************/
regs->gpr[2] = (u64)(saved_regs[2]) & 0xFFFFFFFF;
regs->gpr[3] = (u64)(saved_regs[3]) & 0xFFFFFFFF;
regs->gpr[4] = (u64)(saved_regs[4]) & 0xFFFFFFFF;
regs->gpr[5] = (u64)(saved_regs[5]) & 0xFFFFFFFF;
regs->gpr[6] = (u64)(saved_regs[6]) & 0xFFFFFFFF;
regs->gpr[7] = (u64)(saved_regs[7]) & 0xFFFFFFFF;
regs->gpr[8] = (u64)(saved_regs[8]) & 0xFFFFFFFF;
regs->gpr[9] = (u64)(saved_regs[9]) & 0xFFFFFFFF;
regs->gpr[10] = (u64)(saved_regs[10]) & 0xFFFFFFFF;
regs->gpr[11] = (u64)(saved_regs[11]) & 0xFFFFFFFF;
regs->gpr[12] = (u64)(saved_regs[12]) & 0xFFFFFFFF;
regs->gpr[13] = (u64)(saved_regs[13]) & 0xFFFFFFFF;
regs->gpr[14] = (u64)(saved_regs[14]) & 0xFFFFFFFF;
regs->gpr[15] = (u64)(saved_regs[15]) & 0xFFFFFFFF;
regs->gpr[16] = (u64)(saved_regs[16]) & 0xFFFFFFFF;
regs->gpr[17] = (u64)(saved_regs[17]) & 0xFFFFFFFF;
regs->gpr[18] = (u64)(saved_regs[18]) & 0xFFFFFFFF;
regs->gpr[19] = (u64)(saved_regs[19]) & 0xFFFFFFFF;
regs->gpr[20] = (u64)(saved_regs[20]) & 0xFFFFFFFF;
regs->gpr[21] = (u64)(saved_regs[21]) & 0xFFFFFFFF;
regs->gpr[22] = (u64)(saved_regs[22]) & 0xFFFFFFFF;
regs->gpr[23] = (u64)(saved_regs[23]) & 0xFFFFFFFF;
regs->gpr[24] = (u64)(saved_regs[24]) & 0xFFFFFFFF;
regs->gpr[25] = (u64)(saved_regs[25]) & 0xFFFFFFFF;
regs->gpr[26] = (u64)(saved_regs[26]) & 0xFFFFFFFF;
regs->gpr[27] = (u64)(saved_regs[27]) & 0xFFFFFFFF;
regs->gpr[28] = (u64)(saved_regs[28]) & 0xFFFFFFFF;
regs->gpr[29] = (u64)(saved_regs[29]) & 0xFFFFFFFF;
regs->gpr[30] = (u64)(saved_regs[30]) & 0xFFFFFFFF;
regs->gpr[31] = (u64)(saved_regs[31]) & 0xFFFFFFFF;
/****************************************************/
/* restore the non gpr registers */
/****************************************************/
regs->msr = (u64)(saved_regs[PT_MSR]) & 0xFFFFFFFF;
regs->nip = (u64)(saved_regs[PT_NIP]) & 0xFFFFFFFF;
regs->orig_gpr3 = (u64)(saved_regs[PT_ORIG_R3]) & 0xFFFFFFFF;
regs->ctr = (u64)(saved_regs[PT_CTR]) & 0xFFFFFFFF;
regs->link = (u64)(saved_regs[PT_LNK]) & 0xFFFFFFFF;
regs->xer = (u64)(saved_regs[PT_XER]) & 0xFFFFFFFF;
regs->ccr = (u64)(saved_regs[PT_CCR]) & 0xFFFFFFFF;
/* regs->softe is left unchanged (like MSR.EE) */
/******************************************************/
/* the DAR and the DSISR are only relevant during a */
/* data or instruction storage interrupt. The value */
/* will be set to zero. */
/******************************************************/
regs->dar = 0;
regs->dsisr = 0;
regs->result = (u64)(saved_regs[PT_RESULT]) & 0xFFFFFFFF;
ret = regs->result;
giveup_fpu(current);
}
else /* more signals to go */
if (copy_from_user(saved_regs,&signalregs->gp_regs,sizeof(signalregs->gp_regs)))
{
udbg_printf("hey should not occur\n");
regs->gpr[1] = (u64)rt_stack_frame - __SIGNAL_FRAMESIZE32;
if (copy_from_user(&sigctx, &rt_stack_frame->uc.uc_mcontext,sizeof(sigctx)))
{
goto badframe;
}
signalregs = (struct sigregs32 *) (u64)sigctx.regs;
/* first parm to signal handler is the signal number */
regs->gpr[3] = ret = sigctx.signal;
/* second parm is a pointer to sig info */
get_user(regs->gpr[4], &rt_stack_frame->pinfo);
/* third parm is a pointer to the ucontext */
get_user(regs->gpr[5], &rt_stack_frame->puc);
/* fourth parm is the stack frame */
regs->gpr[6] = (u64)rt_stack_frame;
/* Set up link register to return to sigreturn when the */
/* signal handler completes */
regs->link = (u64)&signalregs->tramp;
/* Set next instruction to the start fo the signal handler */
regs->nip = sigctx.handler;
/* Set the reg1 to look like a call to the signal handler */
if (get_user(previous_stack,&signalregs->gp_regs[PT_R1])
|| put_user(previous_stack, (unsigned long *)regs->gpr[1]))
{
goto badframe;
}
goto badframe;
}
/**********************************************************************/
/* The saved reg structure in the frame is an elf_grepset_t32, it is */
/* a 32 bit register save of the registers in the pt_regs structure */
/* that was stored on the kernel stack during the system call */
/* when the system call was interrupted for the signal. Only 32 bits*/
/* are saved because the sigcontext contains a pointer to the regs */
/* and the sig context address is passed as a pointer to the signal */
/* handler. */
/* */
/* The entries in the elf_grepset have the same index as the elements */
/* in the pt_regs structure. */
/* */
/**********************************************************************/
saved_regs[PT_MSR] = (regs->msr & ~MSR_USERCHANGE)
| (saved_regs[PT_MSR] & MSR_USERCHANGE);
regs->gpr[0] = (u64)(saved_regs[0]) & 0xFFFFFFFF;
regs->gpr[1] = (u64)(saved_regs[1]) & 0xFFFFFFFF;
/**********************************************************************/
/* Register 2 is the kernel toc - should be reset on any calls into */
/* the kernel */
/**********************************************************************/
regs->gpr[2] = (u64)(saved_regs[2]) & 0xFFFFFFFF;
regs->gpr[3] = (u64)(saved_regs[3]) & 0xFFFFFFFF;
regs->gpr[4] = (u64)(saved_regs[4]) & 0xFFFFFFFF;
regs->gpr[5] = (u64)(saved_regs[5]) & 0xFFFFFFFF;
regs->gpr[6] = (u64)(saved_regs[6]) & 0xFFFFFFFF;
regs->gpr[7] = (u64)(saved_regs[7]) & 0xFFFFFFFF;
regs->gpr[8] = (u64)(saved_regs[8]) & 0xFFFFFFFF;
regs->gpr[9] = (u64)(saved_regs[9]) & 0xFFFFFFFF;
regs->gpr[10] = (u64)(saved_regs[10]) & 0xFFFFFFFF;
regs->gpr[11] = (u64)(saved_regs[11]) & 0xFFFFFFFF;
regs->gpr[12] = (u64)(saved_regs[12]) & 0xFFFFFFFF;
regs->gpr[13] = (u64)(saved_regs[13]) & 0xFFFFFFFF;
regs->gpr[14] = (u64)(saved_regs[14]) & 0xFFFFFFFF;
regs->gpr[15] = (u64)(saved_regs[15]) & 0xFFFFFFFF;
regs->gpr[16] = (u64)(saved_regs[16]) & 0xFFFFFFFF;
regs->gpr[17] = (u64)(saved_regs[17]) & 0xFFFFFFFF;
regs->gpr[18] = (u64)(saved_regs[18]) & 0xFFFFFFFF;
regs->gpr[19] = (u64)(saved_regs[19]) & 0xFFFFFFFF;
regs->gpr[20] = (u64)(saved_regs[20]) & 0xFFFFFFFF;
regs->gpr[21] = (u64)(saved_regs[21]) & 0xFFFFFFFF;
regs->gpr[22] = (u64)(saved_regs[22]) & 0xFFFFFFFF;
regs->gpr[23] = (u64)(saved_regs[23]) & 0xFFFFFFFF;
regs->gpr[24] = (u64)(saved_regs[24]) & 0xFFFFFFFF;
regs->gpr[25] = (u64)(saved_regs[25]) & 0xFFFFFFFF;
regs->gpr[26] = (u64)(saved_regs[26]) & 0xFFFFFFFF;
regs->gpr[27] = (u64)(saved_regs[27]) & 0xFFFFFFFF;
regs->gpr[28] = (u64)(saved_regs[28]) & 0xFFFFFFFF;
regs->gpr[29] = (u64)(saved_regs[29]) & 0xFFFFFFFF;
regs->gpr[30] = (u64)(saved_regs[30]) & 0xFFFFFFFF;
regs->gpr[31] = (u64)(saved_regs[31]) & 0xFFFFFFFF;
/****************************************************/
/* restore the non gpr registers */
/****************************************************/
regs->msr = (u64)(saved_regs[PT_MSR]) & 0xFFFFFFFF;
regs->nip = (u64)(saved_regs[PT_NIP]) & 0xFFFFFFFF;
regs->orig_gpr3 = (u64)(saved_regs[PT_ORIG_R3]) & 0xFFFFFFFF;
regs->ctr = (u64)(saved_regs[PT_CTR]) & 0xFFFFFFFF;
regs->link = (u64)(saved_regs[PT_LNK]) & 0xFFFFFFFF;
regs->xer = (u64)(saved_regs[PT_XER]) & 0xFFFFFFFF;
regs->ccr = (u64)(saved_regs[PT_CCR]) & 0xFFFFFFFF;
/* regs->softe is left unchanged (like MSR.EE) */
/******************************************************/
/* the DAR and the DSISR are only relevant during a */
/* data or instruction storage interrupt. The value */
/* will be set to zero. */
/******************************************************/
regs->dar = 0;
regs->dsisr = 0;
regs->result = (u64)(saved_regs[PT_RESULT]) & 0xFFFFFFFF;
ret = regs->result;
return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment