Skip to contentSkip to conversation

x86: fix GET_STACK_END

PATCH In review Wei Liu 3 participants 3 messages Jan 24, 2018 – Jan 25, 2018

lore
Share & tools
lore

Wei Liu

author
#0 lore raw

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
index d2d91ca1fa..6a2b833db6 100644
@@ -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
#1 lore raw

________________________________________
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
index d2d91ca1fa..6a2b833db6 100644
@@ -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

#2 lore raw
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:26

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]≥

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