Skip to content

Commit 93fe10b

Browse files
Isaku Yamahataaegl
authored andcommitted
[IA64] ia64/pv_ops/pv_cpu_ops: fix _IA64_REG_IP case.
pv_cpu_ops.getreg(_IA64_REG_IP) returned constant. But the returned ip valued should be the one in the caller, not of the callee. This patch fixes that. Signed-off-by: Isaku Yamahata <[email protected]> Signed-off-by: Tony Luck <[email protected]>
1 parent d596410 commit 93fe10b

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

arch/ia64/include/asm/intrinsics.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ extern long ia64_cmpxchg_called_with_bad_pointer (void);
226226
/************************************************/
227227
#define ia64_ssm IA64_INTRINSIC_MACRO(ssm)
228228
#define ia64_rsm IA64_INTRINSIC_MACRO(rsm)
229-
#define ia64_getreg IA64_INTRINSIC_API(getreg)
229+
#define ia64_getreg IA64_INTRINSIC_MACRO(getreg)
230230
#define ia64_setreg IA64_INTRINSIC_API(setreg)
231231
#define ia64_set_rr IA64_INTRINSIC_API(set_rr)
232232
#define ia64_get_rr IA64_INTRINSIC_API(get_rr)

arch/ia64/include/asm/paravirt_privop.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,19 @@ extern unsigned long ia64_native_getreg_func(int regnum);
7878
ia64_native_rsm(mask); \
7979
} while (0)
8080

81+
/* returned ip value should be the one in the caller,
82+
* not in __paravirt_getreg() */
83+
#define paravirt_getreg(reg) \
84+
({ \
85+
unsigned long res; \
86+
BUILD_BUG_ON(!__builtin_constant_p(reg)); \
87+
if ((reg) == _IA64_REG_IP) \
88+
res = ia64_native_getreg(_IA64_REG_IP); \
89+
else \
90+
res = pv_cpu_ops.getreg(reg); \
91+
res; \
92+
})
93+
8194
/******************************************************************************
8295
* replacement of hand written assembly codes.
8396
*/

arch/ia64/kernel/paravirt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ ia64_native_getreg_func(int regnum)
130130
unsigned long res = -1;
131131
switch (regnum) {
132132
CASE_GET_REG(GP);
133-
CASE_GET_REG(IP);
133+
/*CASE_GET_REG(IP);*/ /* returned ip value shouldn't be constant */
134134
CASE_GET_REG(PSR);
135135
CASE_GET_REG(TP);
136136
CASE_GET_REG(SP);

0 commit comments

Comments
 (0)