| 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 #include "native_client/src/include/portability.h" |
| 11 #include <stdbool.h> | |
| 12 | 11 |
| 13 #ifdef __cplusplus | 12 #ifdef __cplusplus |
| 14 extern "C" { | 13 extern "C" { |
| 15 #endif | 14 #endif |
| 16 | 15 |
| 17 enum operand_type { | 16 enum operand_type { |
| 18 /* | 17 /* |
| 19 * OperandSize8bit and OperandSize16bit don't affect sandboxing state of the | 18 * 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. | 19 * register: it may become different, but top half does not change it's value. |
| 21 * R15 can not be used even with these operands. | 20 * 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, | 84 REG_R15, |
| 86 REG_RM, /* Address in memory via rm field. */ | 85 REG_RM, /* Address in memory via rm field. */ |
| 87 REG_RIP, /* RIP - used as base in x86-64 mode. */ | 86 REG_RIP, /* RIP - used as base in x86-64 mode. */ |
| 88 REG_RIZ, /* EIZ/RIZ - used as "always zero index" register. */ | 87 REG_RIZ, /* EIZ/RIZ - used as "always zero index" register. */ |
| 89 REG_IMM, /* Fixed value in imm field. */ | 88 REG_IMM, /* Fixed value in imm field. */ |
| 90 REG_IMM2, /* Fixed value in second imm field. */ | 89 REG_IMM2, /* Fixed value in second imm field. */ |
| 91 REG_DS_RBX, /* Fox xlat: %ds(%rbx). */ | 90 REG_DS_RBX, /* Fox xlat: %ds(%rbx). */ |
| 92 REG_ES_RDI, /* For string instructions: %es:(%rsi). */ | 91 REG_ES_RDI, /* For string instructions: %es:(%rsi). */ |
| 93 REG_DS_RSI, /* For string instructions: %ds:(%rdi). */ | 92 REG_DS_RSI, /* For string instructions: %ds:(%rdi). */ |
| 94 REG_PORT_DX, /* 16-bit DX: for in/out instructions. */ | 93 REG_PORT_DX, /* 16-bit DX: for in/out instructions. */ |
| 95 REG_NONE, /* For modrm: both index and base can be absent. */ | 94 NO_REG, /* For modrm: both index and base can be absent. */ |
| 96 REG_ST, /* For x87 instructions: implicit %st. */ | 95 REG_ST, /* For x87 instructions: implicit %st. */ |
| 97 JMP_TO /* Operand is jump target address: usually %rip+offset. */ | 96 JMP_TO /* Operand is jump target address: usually %rip+offset. */ |
| 98 }; | 97 }; |
| 99 | 98 |
| 100 typedef void (*process_error_func) (const uint8_t *ptr, void *userdata); | 99 typedef void (*process_error_func) (const uint8_t *ptr, void *userdata); |
| 101 | 100 |
| 102 int ValidateChunkAMD64(const uint8_t *data, size_t size, | 101 int ValidateChunkAMD64(const uint8_t *data, size_t size, |
| 103 process_error_func process_error, void *userdata); | 102 process_error_func process_error, void *userdata); |
| 104 | 103 |
| 105 int ValidateChunkIA32(const uint8_t *data, size_t size, | 104 int ValidateChunkIA32(const uint8_t *data, size_t size, |
| 106 process_error_func process_error, void *userdata); | 105 process_error_func process_error, void *userdata); |
| 107 | 106 |
| 108 #ifdef __cplusplus | 107 #ifdef __cplusplus |
| 109 } | 108 } |
| 110 #endif | 109 #endif |
| 111 | 110 |
| 112 #endif | 111 #endif |
| OLD | NEW |