Skip to content

Commit a02d584

Browse files
committed
s390/vx: use simple assignments to access __vector128 members
Use simple assignments to access __vector128 members instead of hard to read casts. Signed-off-by: Heiko Carstens <[email protected]>
1 parent b0b7b43 commit a02d584

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

arch/s390/include/asm/fpu/internal.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@ static inline void convert_vx_to_fp(freg_t *fprs, __vector128 *vxrs)
2727
int i;
2828

2929
for (i = 0; i < __NUM_FPRS; i++)
30-
fprs[i] = *(freg_t *)(vxrs + i);
30+
fprs[i].ui = vxrs[i].high;
3131
}
3232

3333
static inline void convert_fp_to_vx(__vector128 *vxrs, freg_t *fprs)
3434
{
3535
int i;
3636

3737
for (i = 0; i < __NUM_FPRS; i++)
38-
*(freg_t *)(vxrs + i) = fprs[i];
38+
vxrs[i].high = fprs[i].ui;
3939
}
4040

4141
static inline void fpregs_store(_s390_fp_regs *fpregs, struct fpu *fpu)

arch/s390/kernel/compat_signal.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ static int save_sigregs_ext32(struct pt_regs *regs,
139139
/* Save vector registers to signal stack */
140140
if (MACHINE_HAS_VX) {
141141
for (i = 0; i < __NUM_VXRS_LOW; i++)
142-
vxrs[i] = *((__u64 *)(current->thread.fpu.vxrs + i) + 1);
142+
vxrs[i] = current->thread.fpu.vxrs[i].low;
143143
if (__copy_to_user(&sregs_ext->vxrs_low, vxrs,
144144
sizeof(sregs_ext->vxrs_low)) ||
145145
__copy_to_user(&sregs_ext->vxrs_high,
@@ -173,7 +173,7 @@ static int restore_sigregs_ext32(struct pt_regs *regs,
173173
sizeof(sregs_ext->vxrs_high)))
174174
return -EFAULT;
175175
for (i = 0; i < __NUM_VXRS_LOW; i++)
176-
*((__u64 *)(current->thread.fpu.vxrs + i) + 1) = vxrs[i];
176+
current->thread.fpu.vxrs[i].low = vxrs[i];
177177
}
178178
return 0;
179179
}

arch/s390/kernel/crash_dump.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ void __init save_area_add_vxrs(struct save_area *sa, __vector128 *vxrs)
110110

111111
/* Copy lower halves of vector registers 0-15 */
112112
for (i = 0; i < 16; i++)
113-
memcpy(&sa->vxrs_low[i], &vxrs[i].u[2], 8);
113+
sa->vxrs_low[i] = vxrs[i].low;
114114
/* Copy vector registers 16-31 */
115115
memcpy(sa->vxrs_high, vxrs + 16, 16 * sizeof(__vector128));
116116
}

arch/s390/kernel/ptrace.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -990,7 +990,7 @@ static int s390_vxrs_low_get(struct task_struct *target,
990990
if (target == current)
991991
save_fpu_regs();
992992
for (i = 0; i < __NUM_VXRS_LOW; i++)
993-
vxrs[i] = *((__u64 *)(target->thread.fpu.vxrs + i) + 1);
993+
vxrs[i] = target->thread.fpu.vxrs[i].low;
994994
return membuf_write(&to, vxrs, sizeof(vxrs));
995995
}
996996

@@ -1008,12 +1008,12 @@ static int s390_vxrs_low_set(struct task_struct *target,
10081008
save_fpu_regs();
10091009

10101010
for (i = 0; i < __NUM_VXRS_LOW; i++)
1011-
vxrs[i] = *((__u64 *)(target->thread.fpu.vxrs + i) + 1);
1011+
vxrs[i] = target->thread.fpu.vxrs[i].low;
10121012

10131013
rc = user_regset_copyin(&pos, &count, &kbuf, &ubuf, vxrs, 0, -1);
10141014
if (rc == 0)
10151015
for (i = 0; i < __NUM_VXRS_LOW; i++)
1016-
*((__u64 *)(target->thread.fpu.vxrs + i) + 1) = vxrs[i];
1016+
target->thread.fpu.vxrs[i].low = vxrs[i];
10171017

10181018
return rc;
10191019
}

arch/s390/kernel/signal.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ static int save_sigregs_ext(struct pt_regs *regs,
184184
/* Save vector registers to signal stack */
185185
if (MACHINE_HAS_VX) {
186186
for (i = 0; i < __NUM_VXRS_LOW; i++)
187-
vxrs[i] = *((__u64 *)(current->thread.fpu.vxrs + i) + 1);
187+
vxrs[i] = current->thread.fpu.vxrs[i].low;
188188
if (__copy_to_user(&sregs_ext->vxrs_low, vxrs,
189189
sizeof(sregs_ext->vxrs_low)) ||
190190
__copy_to_user(&sregs_ext->vxrs_high,
@@ -210,7 +210,7 @@ static int restore_sigregs_ext(struct pt_regs *regs,
210210
sizeof(sregs_ext->vxrs_high)))
211211
return -EFAULT;
212212
for (i = 0; i < __NUM_VXRS_LOW; i++)
213-
*((__u64 *)(current->thread.fpu.vxrs + i) + 1) = vxrs[i];
213+
current->thread.fpu.vxrs[i].low = vxrs[i];
214214
}
215215
return 0;
216216
}

0 commit comments

Comments
 (0)