Skip to content

Commit bee5c28

Browse files
heicarstMartin Schwidefsky
authored andcommitted
s390/switch_to: fix save_access_regs() / restore_access_regs()
Fix broken contraints for both save_access_regs() and restore_access_regs(). The constraints are incorrect since they tell the compiler that the inline assemblies only access the first element of an array of 16 elements. Therefore the compiler could generate incorrect code. Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
1 parent 02aff3a commit bee5c28

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

‎arch/s390/include/asm/switch_to.h‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#define __ASM_SWITCH_TO_H
99

1010
#include <linux/thread_info.h>
11+
#include <asm/ptrace.h>
1112

1213
extern struct task_struct *__switch_to(void *, void *);
1314
extern void update_cr_regs(struct task_struct *task);
@@ -68,12 +69,16 @@ static inline void restore_fp_regs(s390_fp_regs *fpregs)
6869

6970
static inline void save_access_regs(unsigned int *acrs)
7071
{
71-
asm volatile("stam 0,15,%0" : "=Q" (*acrs));
72+
typedef struct { int _[NUM_ACRS]; } acrstype;
73+
74+
asm volatile("stam 0,15,%0" : "=Q" (*(acrstype *)acrs));
7275
}
7376

7477
static inline void restore_access_regs(unsigned int *acrs)
7578
{
76-
asm volatile("lam 0,15,%0" : : "Q" (*acrs));
79+
typedef struct { int _[NUM_ACRS]; } acrstype;
80+
81+
asm volatile("lam 0,15,%0" : : "Q" (*(acrstype *)acrs));
7782
}
7883

7984
#define switch_to(prev,next,last) do { \

0 commit comments

Comments
 (0)