There isn't a plausible reason to insert nops into code in this manner.
The sole use is in do_debug_key(), and exists to prevent the compiler
optimising the tail of the function with 'jmp debugger_trap_fatal'
In practice, a compiler barrier suffices just as well to prevent the tailcall,
and doesn't involve inserting unnecessary instructions.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Julien Grall <julien.grall@arm.com>
{
printk("'%c' pressed -> trapping into debugger\n", key);
(void)debugger_trap_fatal(0xf001, regs);
- nop(); /* Prevent the compiler doing tail call
- optimisation, as that confuses xendbg a
- bit. */
+
+ /* Prevent tail call optimisation, which confuses xendbg. */
+ barrier();
}
static void do_toggle_alt_key(unsigned char key, struct cpu_user_regs *regs)
#include <xen/lib.h>
#include <public/arch-arm.h>
-#define nop() \
- asm volatile ( "nop" )
-
#define sev() asm volatile("sev" : : : "memory")
#define wfe() asm volatile("wfe" : : : "memory")
#define wfi() asm volatile("wfi" : : : "memory")
#define clflush(a) \
asm volatile ( "clflush (%0)" : : "r"(a) )
-#define nop() \
- asm volatile ( "nop" )
-
#define xchg(ptr,v) \
((__typeof__(*(ptr)))__xchg((unsigned long)(v),(ptr),sizeof(*(ptr))))