Debian Codegraph @

extra/gperftools/gperftools-2.15/src/windows/ia32_modrm_map.cc

raw
1 // -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*-
2 /* Copyright (c) 2007, Google Inc.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met:
8 *
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * * Redistributions in binary form must reproduce the above
12 * copyright notice, this list of conditions and the following disclaimer
13 * in the documentation and/or other materials provided with the
14 * distribution.
15 * * Neither the name of Google Inc. nor the names of its
16 * contributors may be used to endorse or promote products derived from
17 * this software without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 *
31 * ---
32 * Author: Joi Sigurdsson
33 *
34 * Table of relevant information about how to decode the ModR/M byte.
35 * Based on information in the IA-32 IntelĀ® Architecture
36 * Software Developer's Manual Volume 2: Instruction Set Reference.
37 */
38
39 #include "mini_disassembler.h"
40 #include "mini_disassembler_types.h"
41
42 namespace sidestep {
43
44 const ModrmEntry MiniDisassembler::s_ia16_modrm_map_[] = {
45 // mod == 00
46 /* r/m == 000 */ { false, false, OS_ZERO },
47 /* r/m == 001 */ { false, false, OS_ZERO },
48 /* r/m == 010 */ { false, false, OS_ZERO },
49 /* r/m == 011 */ { false, false, OS_ZERO },
50 /* r/m == 100 */ { false, false, OS_ZERO },
51 /* r/m == 101 */ { false, false, OS_ZERO },
52 /* r/m == 110 */ { true, false, OS_WORD },
53 /* r/m == 111 */ { false, false, OS_ZERO },
54 // mod == 01
55 /* r/m == 000 */ { true, false, OS_BYTE },
56 /* r/m == 001 */ { true, false, OS_BYTE },
57 /* r/m == 010 */ { true, false, OS_BYTE },
58 /* r/m == 011 */ { true, false, OS_BYTE },
59 /* r/m == 100 */ { true, false, OS_BYTE },
60 /* r/m == 101 */ { true, false, OS_BYTE },
61 /* r/m == 110 */ { true, false, OS_BYTE },
62 /* r/m == 111 */ { true, false, OS_BYTE },
63 // mod == 10
64 /* r/m == 000 */ { true, false, OS_WORD },
65 /* r/m == 001 */ { true, false, OS_WORD },
66 /* r/m == 010 */ { true, false, OS_WORD },
67 /* r/m == 011 */ { true, false, OS_WORD },
68 /* r/m == 100 */ { true, false, OS_WORD },
69 /* r/m == 101 */ { true, false, OS_WORD },
70 /* r/m == 110 */ { true, false, OS_WORD },
71 /* r/m == 111 */ { true, false, OS_WORD },
72 // mod == 11
73 /* r/m == 000 */ { false, false, OS_ZERO },
74 /* r/m == 001 */ { false, false, OS_ZERO },
75 /* r/m == 010 */ { false, false, OS_ZERO },
76 /* r/m == 011 */ { false, false, OS_ZERO },
77 /* r/m == 100 */ { false, false, OS_ZERO },
78 /* r/m == 101 */ { false, false, OS_ZERO },
79 /* r/m == 110 */ { false, false, OS_ZERO },
80 /* r/m == 111 */ { false, false, OS_ZERO }
81 };
82
83 const ModrmEntry MiniDisassembler::s_ia32_modrm_map_[] = {
84 // mod == 00
85 /* r/m == 000 */ { false, false, OS_ZERO },
86 /* r/m == 001 */ { false, false, OS_ZERO },
87 /* r/m == 010 */ { false, false, OS_ZERO },
88 /* r/m == 011 */ { false, false, OS_ZERO },
89 /* r/m == 100 */ { false, true, OS_ZERO },
90 /* r/m == 101 */ { true, false, OS_DOUBLE_WORD },
91 /* r/m == 110 */ { false, false, OS_ZERO },
92 /* r/m == 111 */ { false, false, OS_ZERO },
93 // mod == 01
94 /* r/m == 000 */ { true, false, OS_BYTE },
95 /* r/m == 001 */ { true, false, OS_BYTE },
96 /* r/m == 010 */ { true, false, OS_BYTE },
97 /* r/m == 011 */ { true, false, OS_BYTE },
98 /* r/m == 100 */ { true, true, OS_BYTE },
99 /* r/m == 101 */ { true, false, OS_BYTE },
100 /* r/m == 110 */ { true, false, OS_BYTE },
101 /* r/m == 111 */ { true, false, OS_BYTE },
102 // mod == 10
103 /* r/m == 000 */ { true, false, OS_DOUBLE_WORD },
104 /* r/m == 001 */ { true, false, OS_DOUBLE_WORD },
105 /* r/m == 010 */ { true, false, OS_DOUBLE_WORD },
106 /* r/m == 011 */ { true, false, OS_DOUBLE_WORD },
107 /* r/m == 100 */ { true, true, OS_DOUBLE_WORD },
108 /* r/m == 101 */ { true, false, OS_DOUBLE_WORD },
109 /* r/m == 110 */ { true, false, OS_DOUBLE_WORD },
110 /* r/m == 111 */ { true, false, OS_DOUBLE_WORD },
111 // mod == 11
112 /* r/m == 000 */ { false, false, OS_ZERO },
113 /* r/m == 001 */ { false, false, OS_ZERO },
114 /* r/m == 010 */ { false, false, OS_ZERO },
115 /* r/m == 011 */ { false, false, OS_ZERO },
116 /* r/m == 100 */ { false, false, OS_ZERO },
117 /* r/m == 101 */ { false, false, OS_ZERO },
118 /* r/m == 110 */ { false, false, OS_ZERO },
119 /* r/m == 111 */ { false, false, OS_ZERO },
120 };
121
122 }; // namespace sidestep