Generally it is not a good idea to use BUG() in emulator code. Even for
internal flaws we're better off returning errors to callers, rather than
crashing the system. Replace the sole remaining use and remove the
test / fuzzing harness surrogate. Put in place a declaration pleasing
the compiler when finding uses in Xen headers, while at the same time
breaking the build (at linking time) in case an active reference would
newly appear.
Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
#include <xen-tools/common-macros.h>
-#define BUG() abort()
#define ASSERT assert
#define ASSERT_UNREACHABLE() assert(!__LINE__)
switch ( def_ad_bytes )
{
default:
- BUG(); /* Shouldn't be possible. */
+ ASSERT_UNREACHABLE(); /* Shouldn't be possible. */
+ return X86EMUL_UNHANDLEABLE;
+
case 2:
if ( ctxt->regs->eflags & X86_EFLAGS_VM )
break;
# include <asm/x86-vendors.h>
# include <asm/x86_emulate.h>
+# undef BUG /* Make sure it's not used anywhere here. */
+void BUG(void);
+
# ifndef CONFIG_HVM
# define X86EMUL_NO_FPU
# define X86EMUL_NO_MMX