All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86: fix GET_STACK_END
@ 2018-01-24 20:26 Wei Liu
  2018-01-24 20:48 ` Andrew Cooper
  0 siblings, 1 reply; 3+ messages in thread
From: Wei Liu @ 2018-01-24 20:26 UTC (permalink / raw)
  To: Xen-devel; +Cc: Andrew Cooper, Wei Liu, Jan Beulich

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.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
---
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/include/asm-x86/asm_defns.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/include/asm-x86/asm_defns.h b/xen/include/asm-x86/asm_defns.h
index d2d91ca1fa..6a2b833db6 100644
--- a/xen/include/asm-x86/asm_defns.h
+++ b/xen/include/asm-x86/asm_defns.h
@@ -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
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] x86: fix GET_STACK_END
  2018-01-24 20:26 [PATCH] x86: fix GET_STACK_END Wei Liu
@ 2018-01-24 20:48 ` Andrew Cooper
  2018-01-25 10:55   ` Jan Beulich
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Cooper @ 2018-01-24 20:48 UTC (permalink / raw)
  To: Xen-devel; +Cc: Wei Liu, Jan Beulich


________________________________________
From: Wei Liu [wei.liu2@citrix.com]
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.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>

Oops.  Acked-by: Andrew Cooper ≤andrew.cooper3@citrix.com≥

---
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/include/asm-x86/asm_defns.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/include/asm-x86/asm_defns.h b/xen/include/asm-x86/asm_defns.h
index d2d91ca1fa..6a2b833db6 100644
--- a/xen/include/asm-x86/asm_defns.h
+++ b/xen/include/asm-x86/asm_defns.h
@@ -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
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] x86: fix GET_STACK_END
  2018-01-24 20:48 ` Andrew Cooper
@ 2018-01-25 10:55   ` Jan Beulich
  0 siblings, 0 replies; 3+ messages in thread
From: Jan Beulich @ 2018-01-25 10:55 UTC (permalink / raw)
  To: Andrew Cooper; +Cc: Xen-devel, Wei Liu

>>> On 24.01.18 at 21:48, <Andrew.Cooper3@citrix.com> wrote:
> From: Wei Liu [wei.liu2@citrix.com]
> 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.
> 
> Signed-off-by: Wei Liu <wei.liu2@citrix.com>
> 
> Oops.  Acked-by: Andrew Cooper ≤andrew.cooper3@citrix.com≥

Oops indeed - luckily the build would have failed in such a case,
rather than producing a broken binary.

Jan

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-01-25 10:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-24 20:26 [PATCH] x86: fix GET_STACK_END Wei Liu
2018-01-24 20:48 ` Andrew Cooper
2018-01-25 10:55   ` Jan Beulich

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.