diff options
author | Pekka Enberg <penberg@cs.helsinki.fi> | 2009-02-26 04:23:52 -0500 |
---|---|---|
committer | Vegard Nossum <vegard.nossum@gmail.com> | 2009-06-15 06:39:59 -0400 |
commit | 6d9609c13250631c1d0c55a29a64d5687fd91293 (patch) | |
tree | f925b5dfb2c250e6de98b3e1f880149324bb99a1 /arch | |
parent | 0c33cacd8672ef034ba414510f71ea2bd9370111 (diff) |
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: Pekka Enberg <penberg@cs.helsinki.fi>
Signed-off-by: Vegard Nossum <vegard.nossum@gmail.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/mm/kmemcheck/opcode.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/arch/x86/mm/kmemcheck/opcode.c b/arch/x86/mm/kmemcheck/opcode.c index a4100b6e783a..63c19e27aa6f 100644 --- a/arch/x86/mm/kmemcheck/opcode.c +++ b/arch/x86/mm/kmemcheck/opcode.c | |||
@@ -16,10 +16,17 @@ static bool opcode_is_prefix(uint8_t b) | |||
16 | || b == 0x67; | 16 | || b == 0x67; |
17 | } | 17 | } |
18 | 18 | ||
19 | #ifdef CONFIG_X86_64 | ||
19 | static bool opcode_is_rex_prefix(uint8_t b) | 20 | static bool opcode_is_rex_prefix(uint8_t b) |
20 | { | 21 | { |
21 | return (b & 0xf0) == 0x40; | 22 | return (b & 0xf0) == 0x40; |
22 | } | 23 | } |
24 | #else | ||
25 | static bool opcode_is_rex_prefix(uint8_t b) | ||
26 | { | ||
27 | return false; | ||
28 | } | ||
29 | #endif | ||
23 | 30 | ||
24 | #define REX_W (1 << 3) | 31 | #define REX_W (1 << 3) |
25 | 32 | ||
@@ -40,7 +47,6 @@ void kmemcheck_opcode_decode(const uint8_t *op, unsigned int *size) | |||
40 | operand_size_override = 2; | 47 | operand_size_override = 2; |
41 | } | 48 | } |
42 | 49 | ||
43 | #ifdef CONFIG_X86_64 | ||
44 | /* REX prefix */ | 50 | /* REX prefix */ |
45 | if (opcode_is_rex_prefix(*op)) { | 51 | if (opcode_is_rex_prefix(*op)) { |
46 | uint8_t rex = *op; | 52 | uint8_t rex = *op; |
@@ -72,7 +78,6 @@ void kmemcheck_opcode_decode(const uint8_t *op, unsigned int *size) | |||
72 | return; | 78 | return; |
73 | } | 79 | } |
74 | } | 80 | } |
75 | #endif | ||
76 | 81 | ||
77 | /* escape opcode */ | 82 | /* escape opcode */ |
78 | if (*op == 0x0f) { | 83 | if (*op == 0x0f) { |