Commit 6d9609c1 authored by Pekka Enberg's avatar Pekka Enberg Committed by Vegard Nossum

kmemcheck: move 64-bit ifdef out of kmemcheck_opcode_decode()

This patch moves the CONFIG_X86_64 ifdef out of kmemcheck_opcode_decode() by
introducing a version of the function that always returns false for
CONFIG_X86_32.
Signed-off-by: default avatarPekka Enberg <penberg@cs.helsinki.fi>
Signed-off-by: default avatarVegard Nossum <vegard.nossum@gmail.com>
parent 0c33cacd
...@@ -16,10 +16,17 @@ static bool opcode_is_prefix(uint8_t b) ...@@ -16,10 +16,17 @@ static bool opcode_is_prefix(uint8_t b)
|| b == 0x67; || b == 0x67;
} }
#ifdef CONFIG_X86_64
static bool opcode_is_rex_prefix(uint8_t b) static bool opcode_is_rex_prefix(uint8_t b)
{ {
return (b & 0xf0) == 0x40; return (b & 0xf0) == 0x40;
} }
#else
static bool opcode_is_rex_prefix(uint8_t b)
{
return false;
}
#endif
#define REX_W (1 << 3) #define REX_W (1 << 3)
...@@ -40,7 +47,6 @@ void kmemcheck_opcode_decode(const uint8_t *op, unsigned int *size) ...@@ -40,7 +47,6 @@ void kmemcheck_opcode_decode(const uint8_t *op, unsigned int *size)
operand_size_override = 2; operand_size_override = 2;
} }
#ifdef CONFIG_X86_64
/* REX prefix */ /* REX prefix */
if (opcode_is_rex_prefix(*op)) { if (opcode_is_rex_prefix(*op)) {
uint8_t rex = *op; uint8_t rex = *op;
...@@ -72,7 +78,6 @@ void kmemcheck_opcode_decode(const uint8_t *op, unsigned int *size) ...@@ -72,7 +78,6 @@ void kmemcheck_opcode_decode(const uint8_t *op, unsigned int *size)
return; return;
} }
} }
#endif
/* escape opcode */ /* escape opcode */
if (*op == 0x0f) { if (*op == 0x0f) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment