1 : /*
2 : * Copyright (c) 2011 The Native Client Authors. All rights reserved.
3 : * Use of this source code is governed by a BSD-style license that can be
4 : * found in the LICENSE file.
5 : */
6 :
7 : /*
8 : * x86_insts.h - Holds inline routines for commonly used (simple)
9 : * functions in x86_insts.h. Used to speed up code. Inlined routines
10 : * correspond to the following functions in x86_insts.h, but with an
11 : * 'Inline' suffix:
12 : *
13 : * modrm_mod
14 : * modrm_rm
15 : * modrm_reg
16 : * modrm_opcode
17 : */
18 :
19 : #ifndef NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_X86_X86_INSTS_INL_H__
20 : #define NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_X86_X86_INSTS_INL_H__
21 :
22 : #include "native_client/src/trusted/validator/x86/x86_insts.h"
23 :
24 : /* Accessors for the ModRm byte. */
25 6 : static INLINE uint8_t modrm_modInline(uint8_t modrm) {
26 6 : return ((modrm >> 6) & 0x03);
27 6 : }
28 :
29 6 : static INLINE uint8_t modrm_rmInline(uint8_t modrm) {
30 6 : return (modrm & 0x07);
31 6 : }
32 :
33 6 : static INLINE uint8_t modrm_regInline(uint8_t modrm) {
34 6 : return ((modrm >> 3) & 0x07);
35 6 : }
36 :
37 3 : static INLINE uint8_t modrm_opcodeInline(uint8_t modrm) {
38 3 : return modrm_regInline(modrm);
39 3 : }
40 :
41 : #endif /* NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_X86_X86_INSTS_INL_H__ */
|