Commit 2476c09f authored by Anshuman Khandual's avatar Anshuman Khandual Committed by Michael Ellerman

powerpc/signal: Add helper function to fetch quad word aligned pointer

This patch adds one helper function 'sigcontext_vmx_regs' which computes
quad word aligned pointer for 'vmx_reserve' array element in sigcontext
structure making the code more readable.
Signed-off-by: default avatarAnshuman Khandual <khandual@linux.vnet.ibm.com>
[mpe: Reword comment and fix build for CONFIG_ALTIVEC=n]
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
parent 4c576229
...@@ -73,6 +73,19 @@ static const char fmt32[] = KERN_INFO \ ...@@ -73,6 +73,19 @@ static const char fmt32[] = KERN_INFO \
static const char fmt64[] = KERN_INFO \ static const char fmt64[] = KERN_INFO \
"%s[%d]: bad frame in %s: %016lx nip %016lx lr %016lx\n"; "%s[%d]: bad frame in %s: %016lx nip %016lx lr %016lx\n";
/*
* This computes a quad word aligned pointer inside the vmx_reserve array
* element. For historical reasons sigcontext might not be quad word aligned,
* but the location we write the VMX regs to must be. See the comment in
* sigcontext for more detail.
*/
#ifdef CONFIG_ALTIVEC
static elf_vrreg_t __user *sigcontext_vmx_regs(struct sigcontext __user *sc)
{
return (elf_vrreg_t __user *) (((unsigned long)sc->vmx_reserve + 15) & ~0xful);
}
#endif
/* /*
* Set up the sigcontext for the signal frame. * Set up the sigcontext for the signal frame.
*/ */
...@@ -90,7 +103,7 @@ static long setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs, ...@@ -90,7 +103,7 @@ static long setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs,
* v_regs pointer or not * v_regs pointer or not
*/ */
#ifdef CONFIG_ALTIVEC #ifdef CONFIG_ALTIVEC
elf_vrreg_t __user *v_regs = (elf_vrreg_t __user *)(((unsigned long)sc->vmx_reserve + 15) & ~0xful); elf_vrreg_t __user *v_regs = sigcontext_vmx_regs(sc);
#endif #endif
unsigned long msr = regs->msr; unsigned long msr = regs->msr;
long err = 0; long err = 0;
...@@ -181,10 +194,8 @@ static long setup_tm_sigcontexts(struct sigcontext __user *sc, ...@@ -181,10 +194,8 @@ static long setup_tm_sigcontexts(struct sigcontext __user *sc,
* v_regs pointer or not. * v_regs pointer or not.
*/ */
#ifdef CONFIG_ALTIVEC #ifdef CONFIG_ALTIVEC
elf_vrreg_t __user *v_regs = (elf_vrreg_t __user *) elf_vrreg_t __user *v_regs = sigcontext_vmx_regs(sc);
(((unsigned long)sc->vmx_reserve + 15) & ~0xful); elf_vrreg_t __user *tm_v_regs = sigcontext_vmx_regs(tm_sc);
elf_vrreg_t __user *tm_v_regs = (elf_vrreg_t __user *)
(((unsigned long)tm_sc->vmx_reserve + 15) & ~0xful);
#endif #endif
unsigned long msr = regs->msr; unsigned long msr = regs->msr;
long err = 0; long err = 0;
......
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