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