| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The Native Client Authors. All rights reserved. | 2 * Copyright (c) 2012 The Native Client Authors. All rights reserved. |
| 3 * Use of this source code is governed by a BSD-style license that can be | 3 * Use of this source code is governed by a BSD-style license that can be |
| 4 * found in the LICENSE file. | 4 * found in the LICENSE file. |
| 5 */ | 5 */ |
| 6 | 6 |
| 7 #ifndef _VALIDATOR_X86_64_H_ | 7 #ifndef _VALIDATOR_X86_64_H_ |
| 8 #define _VALIDATOR_X86_64_H_ | 8 #define _VALIDATOR_X86_64_H_ |
| 9 | 9 |
| 10 #include <inttypes.h> | 10 #if NACL_WINDOWS |
| 11 #include <windows.h> |
| 12 #include "native_client/src/include/portability.h" |
| 13 |
| 14 /* |
| 15 * Microsoft C/C++ version 14.00.50727.762, which comes with Visual C++ 2005, |
| 16 * and version 15.00.30729.01, which comes with Visual C++ 2008, do not. |
| 17 * define _Bool. |
| 18 */ |
| 19 #if defined(_MSC_VER) && _MSC_VER <= 1500 |
| 20 typedef int _Bool; |
| 21 #endif |
| 22 #else |
| 23 #include <stdint.h> |
| 11 #include <stdbool.h> | 24 #include <stdbool.h> |
| 25 #endif |
| 12 | 26 |
| 13 #ifdef __cplusplus | 27 #ifdef __cplusplus |
| 14 extern "C" { | 28 extern "C" { |
| 15 #endif | 29 #endif |
| 16 | 30 |
| 17 enum operand_type { | 31 enum operand_type { |
| 18 /* | 32 /* |
| 19 * OperandSize8bit and OperandSize16bit don't affect sandboxing state of the | 33 * OperandSize8bit and OperandSize16bit don't affect sandboxing state of the |
| 20 * register: it may become different, but top half does not change it's value. | 34 * register: it may become different, but top half does not change it's value. |
| 21 * R15 can not be used even with these operands. | 35 * R15 can not be used even with these operands. |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 REG_R15, | 99 REG_R15, |
| 86 REG_RM, /* Address in memory via rm field. */ | 100 REG_RM, /* Address in memory via rm field. */ |
| 87 REG_RIP, /* RIP - used as base in x86-64 mode. */ | 101 REG_RIP, /* RIP - used as base in x86-64 mode. */ |
| 88 REG_RIZ, /* EIZ/RIZ - used as "always zero index" register. */ | 102 REG_RIZ, /* EIZ/RIZ - used as "always zero index" register. */ |
| 89 REG_IMM, /* Fixed value in imm field. */ | 103 REG_IMM, /* Fixed value in imm field. */ |
| 90 REG_IMM2, /* Fixed value in second imm field. */ | 104 REG_IMM2, /* Fixed value in second imm field. */ |
| 91 REG_DS_RBX, /* Fox xlat: %ds(%rbx). */ | 105 REG_DS_RBX, /* Fox xlat: %ds(%rbx). */ |
| 92 REG_ES_RDI, /* For string instructions: %es:(%rsi). */ | 106 REG_ES_RDI, /* For string instructions: %es:(%rsi). */ |
| 93 REG_DS_RSI, /* For string instructions: %ds:(%rdi). */ | 107 REG_DS_RSI, /* For string instructions: %ds:(%rdi). */ |
| 94 REG_PORT_DX, /* 16-bit DX: for in/out instructions. */ | 108 REG_PORT_DX, /* 16-bit DX: for in/out instructions. */ |
| 95 REG_NONE, /* For modrm: both index and base can be absent. */ | 109 NO_REG, /* For modrm: both index and base can be absent. */ |
| 96 REG_ST, /* For x87 instructions: implicit %st. */ | 110 REG_ST, /* For x87 instructions: implicit %st. */ |
| 97 JMP_TO /* Operand is jump target address: usually %rip+offset. */ | 111 JMP_TO /* Operand is jump target address: usually %rip+offset. */ |
| 98 }; | 112 }; |
| 99 | 113 |
| 100 typedef void (*process_error_func) (const uint8_t *ptr, void *userdata); | 114 typedef void (*process_error_func) (const uint8_t *ptr, void *userdata); |
| 101 | 115 |
| 102 int ValidateChunkAMD64(const uint8_t *data, size_t size, | 116 int ValidateChunkAMD64(const uint8_t *data, size_t size, |
| 103 process_error_func process_error, void *userdata); | 117 process_error_func process_error, void *userdata); |
| 104 | 118 |
| 105 int ValidateChunkIA32(const uint8_t *data, size_t size, | 119 int ValidateChunkIA32(const uint8_t *data, size_t size, |
| 106 process_error_func process_error, void *userdata); | 120 process_error_func process_error, void *userdata); |
| 107 | 121 |
| 108 #ifdef __cplusplus | 122 #ifdef __cplusplus |
| 109 } | 123 } |
| 110 #endif | 124 #endif |
| 111 | 125 |
| 112 #endif | 126 #endif |
| OLD | NEW |