x86: fix GET_STACK_END
PATCH 1/1 x86: fix GET_STACK_END
AIUI the purpose of having the .if directive is to make GET_STACK_END work with any general purpose registers. The code as-is would produce the wrong result for r8. Fix it.
---
Cc: Jan Beulich <[email protected]>
Cc: Andrew Cooper <[email protected]>
--- xen/include/asm-x86/asm_defns.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
xen/include/asm-x86/asm_defns.h +1 -1
@@ -120,7 +120,7 @@ void ret_from_intr(void);#define STACK_CPUINFO_FIELD (field) (1 - CPUINFO_sizeof + CPUINFO_##field)#define GET_STACK_END (reg) \ - .if .Lr##reg > 8; \ + .if .Lr##reg >= 8; \ movq $STACK_SIZE-1, %r##reg; \ .else; \ movl $STACK_SIZE-1, %e##reg; \
Signature · 7 lines
2.11.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
________________________________________
From: Wei Liu [[email protected]]
Sent: 24 January 2018 20:26
To: Xen-devel
Cc: Wei Liu; Jan Beulich; Andrew Cooper
Subject: [PATCH] x86: fix GET_STACK_END
AIUI the purpose of having the .if directive is to make GET_STACK_END work with any general purpose registers. The code as-is would produce the wrong result for r8. Fix it.
Oops. Acked-by: Andrew Cooper ≤[email protected]≥
---
Cc: Jan Beulich <[email protected]>
Cc: Andrew Cooper <[email protected]>
--- xen/include/asm-x86/asm_defns.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
xen/include/asm-x86/asm_defns.h +1 -1
@@ -120,7 +120,7 @@ void ret_from_intr(void);#define STACK_CPUINFO_FIELD (field) (1 - CPUINFO_sizeof + CPUINFO_##field)#define GET_STACK_END (reg) \ - .if .Lr##reg > 8; \ + .if .Lr##reg >= 8; \ movq $STACK_SIZE-1, %r##reg; \ .else; \ movl $STACK_SIZE-1, %e##reg; \
--
2.11.0
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 11 lines
Quoted 1 line
Quoted 1 line · On 24.01.18 at 21:48, <[email protected]> wrote:
From: Wei Liu [[email protected]]
Sent: 24 January 2018 20:26AIUI the purpose of having the .if directive is to make
GET_STACK_ENDwork with any general purpose registers. The code as-is would produce the wrong result for r8. Fix it.Signed-off-by Wei Liu <[email protected]>Oops. Acked-by: Andrew Cooper ≤[email protected]≥
Oops indeed - luckily the build would have failed in such a case, rather than producing a broken binary.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel