@@ -776,6 +776,22 @@ do{ asm volatile ( \
#define __emulate_1op_8byte(_op, _dst, _eflags)
#endif /* __i386__ */
+#if defined(NDEBUG) && defined(CONFIG_LIVEPATCH)
+#define invoke_stub_exception(trapnr, ec) \
+ do { \
+ gprintk(XENLOG_WARNING, \
+ "exception %u (ec=%04x) in emulation stub (address %pS)\n", \
+ trapnr, ec, current_text_addr()); \
+ } while (0)
+#else
+#define invoke_stub_exception(trapnr, ec) \
+ do { \
+ gprintk(XENLOG_WARNING, \
+ "exception %u (ec=%04x) in emulation stub (line %u)\n", \
+ trapnr, ec, __LINE__); \
+ } while (0)
+#endif
+
#ifdef __XEN__
# define invoke_stub(pre, post, constraints...) do { \
union stub_exception_token res_ = { .raw = ~0 }; \
@@ -791,9 +807,7 @@ do{ asm volatile ( \
[stub] "rm" (stub.func) ); \
if ( unlikely(~res_.raw) ) \
{ \
- gprintk(XENLOG_WARNING, \
- "exception %u (ec=%04x) in emulation stub (line %u)\n", \
- res_.fields.trapnr, res_.fields.ec, __LINE__); \
+ invoke_stub_exception(res_.fields.trapnr, res_.fields.ec); \
gprintk(XENLOG_INFO, "stub: %"__stringify(MAX_INST_LEN)"ph\n", \
stub.func); \
generate_exception_if(res_.fields.trapnr == EXC_UD, EXC_UD); \
When using LivePatch, use of __LINE__ can generate spurious changes in functions due to embedded line numbers. For release builds with LivePatch enabled, remove the use of these line numbers and print the current text address instead. Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com> --- xen/arch/x86/x86_emulate/x86_emulate.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-)