mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-11-19 08:05:27 +08:00
[ARM] iwmmxt thread state alignment
This patch removes the reliance of iwmmxt on hand coded alignments. Since thread_info is always 8K aligned, specifying that fpstate is 8-byte aligned achieves the same effect without needing to resort to hand coded alignments. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
This commit is contained in:
parent
04916c0ef4
commit
cdaabbd74b
@ -57,7 +57,9 @@ int main(void)
|
|||||||
DEFINE(TI_TP_VALUE, offsetof(struct thread_info, tp_value));
|
DEFINE(TI_TP_VALUE, offsetof(struct thread_info, tp_value));
|
||||||
DEFINE(TI_FPSTATE, offsetof(struct thread_info, fpstate));
|
DEFINE(TI_FPSTATE, offsetof(struct thread_info, fpstate));
|
||||||
DEFINE(TI_VFPSTATE, offsetof(struct thread_info, vfpstate));
|
DEFINE(TI_VFPSTATE, offsetof(struct thread_info, vfpstate));
|
||||||
DEFINE(TI_IWMMXT_STATE, (offsetof(struct thread_info, fpstate)+4)&~7);
|
#ifdef CONFIG_IWMMXT
|
||||||
|
DEFINE(TI_IWMMXT_STATE, offsetof(struct thread_info, fpstate.iwmmxt));
|
||||||
|
#endif
|
||||||
BLANK();
|
BLANK();
|
||||||
DEFINE(S_R0, offsetof(struct pt_regs, ARM_r0));
|
DEFINE(S_R0, offsetof(struct pt_regs, ARM_r0));
|
||||||
DEFINE(S_R1, offsetof(struct pt_regs, ARM_r1));
|
DEFINE(S_R1, offsetof(struct pt_regs, ARM_r1));
|
||||||
|
@ -610,15 +610,12 @@ static int ptrace_setfpregs(struct task_struct *tsk, void __user *ufp)
|
|||||||
static int ptrace_getwmmxregs(struct task_struct *tsk, void __user *ufp)
|
static int ptrace_getwmmxregs(struct task_struct *tsk, void __user *ufp)
|
||||||
{
|
{
|
||||||
struct thread_info *thread = task_thread_info(tsk);
|
struct thread_info *thread = task_thread_info(tsk);
|
||||||
void *ptr = &thread->fpstate;
|
|
||||||
|
|
||||||
if (!test_ti_thread_flag(thread, TIF_USING_IWMMXT))
|
if (!test_ti_thread_flag(thread, TIF_USING_IWMMXT))
|
||||||
return -ENODATA;
|
return -ENODATA;
|
||||||
iwmmxt_task_disable(thread); /* force it to ram */
|
iwmmxt_task_disable(thread); /* force it to ram */
|
||||||
/* The iWMMXt state is stored doubleword-aligned. */
|
return copy_to_user(ufp, &thread->fpstate.iwmmxt, IWMMXT_SIZE)
|
||||||
if (((long) ptr) & 4)
|
? -EFAULT : 0;
|
||||||
ptr += 4;
|
|
||||||
return copy_to_user(ufp, ptr, 0x98) ? -EFAULT : 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -627,15 +624,12 @@ static int ptrace_getwmmxregs(struct task_struct *tsk, void __user *ufp)
|
|||||||
static int ptrace_setwmmxregs(struct task_struct *tsk, void __user *ufp)
|
static int ptrace_setwmmxregs(struct task_struct *tsk, void __user *ufp)
|
||||||
{
|
{
|
||||||
struct thread_info *thread = task_thread_info(tsk);
|
struct thread_info *thread = task_thread_info(tsk);
|
||||||
void *ptr = &thread->fpstate;
|
|
||||||
|
|
||||||
if (!test_ti_thread_flag(thread, TIF_USING_IWMMXT))
|
if (!test_ti_thread_flag(thread, TIF_USING_IWMMXT))
|
||||||
return -EACCES;
|
return -EACCES;
|
||||||
iwmmxt_task_release(thread); /* force a reload */
|
iwmmxt_task_release(thread); /* force a reload */
|
||||||
/* The iWMMXt state is stored doubleword-aligned. */
|
return copy_from_user(&thead->fpstate.iwmmxt, ufp, IWMMXT_SIZE)
|
||||||
if (((long) ptr) & 4)
|
? -EFAULT : 0;
|
||||||
ptr += 4;
|
|
||||||
return copy_from_user(ptr, ufp, 0x98) ? -EFAULT : 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -55,8 +55,10 @@ struct fp_soft_struct {
|
|||||||
unsigned int save[FP_SOFT_SIZE]; /* undefined information */
|
unsigned int save[FP_SOFT_SIZE]; /* undefined information */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define IWMMXT_SIZE 0x98
|
||||||
|
|
||||||
struct iwmmxt_struct {
|
struct iwmmxt_struct {
|
||||||
unsigned int save[0x98/sizeof(int) + 1];
|
unsigned int save[IWMMXT_SIZE / sizeof(unsigned int)];
|
||||||
};
|
};
|
||||||
|
|
||||||
union fp_state {
|
union fp_state {
|
||||||
|
@ -59,7 +59,7 @@ struct thread_info {
|
|||||||
struct cpu_context_save cpu_context; /* cpu context */
|
struct cpu_context_save cpu_context; /* cpu context */
|
||||||
__u8 used_cp[16]; /* thread used copro */
|
__u8 used_cp[16]; /* thread used copro */
|
||||||
unsigned long tp_value;
|
unsigned long tp_value;
|
||||||
union fp_state fpstate;
|
union fp_state fpstate __attribute__((aligned(8)));
|
||||||
union vfp_state vfpstate;
|
union vfp_state vfpstate;
|
||||||
struct restart_block restart_block;
|
struct restart_block restart_block;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user