From bb8cf3fa77e63f7c6a02d23bbfe3426beff26358 Mon Sep 17 00:00:00 2001 From: Jin Kyu Song Date: Fri, 29 Nov 2013 00:38:29 -0800 Subject: bnd: Show warning when bnd prefix is dropped When bnd prefix is dropped as jmp is encoded as jmp short, nasm shows a warning message, which can be suppressed with a new command line option, -w-bnd. Signed-off-by: Jin Kyu Song --- assemble.c | 2 ++ nasm.c | 1 + nasmlib.h | 3 ++- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/assemble.c b/assemble.c index bf1490d..f06cee8 100644 --- a/assemble.c +++ b/assemble.c @@ -385,6 +385,8 @@ static bool jmp_match(int32_t segment, int64_t offset, int bits, if (is_byte && c == 0371 && ins->prefixes[PPS_REP] == P_BND) { /* jmp short (opcode eb) cannot be used with bnd prefix. */ ins->prefixes[PPS_REP] = P_none; + errfunc(ERR_WARNING | ERR_WARN_BND | ERR_PASS2 , + "jmp short does not init bnd regs - bnd prefix dropped."); } return is_byte; diff --git a/nasm.c b/nasm.c index b83810d..d10ddbc 100644 --- a/nasm.c +++ b/nasm.c @@ -166,6 +166,7 @@ static const struct warning { {"user", "%warning directives", true}, {"lock", "lock prefix on unlockable instructions", true}, {"hle", "invalid hle prefixes", true}, + {"bnd", "invalid bnd prefixes", true}, }; static bool want_usage; diff --git a/nasmlib.h b/nasmlib.h index 2210748..d11e6e0 100644 --- a/nasmlib.h +++ b/nasmlib.h @@ -134,7 +134,8 @@ void nasm_set_verror(vefunc); #define ERR_WARN_USER WARN(11) /* %warning directives */ #define ERR_WARN_LOCK WARN(12) /* bad LOCK prefixes */ #define ERR_WARN_HLE WARN(13) /* bad HLE prefixes */ -#define ERR_WARN_MAX 13 /* the highest numbered one */ +#define ERR_WARN_BND WARN(14) /* bad BND prefixes */ +#define ERR_WARN_MAX 14 /* the highest numbered one */ /* * Wrappers around malloc, realloc and free. nasm_malloc will -- cgit v1.2.3