[984] | 1 | /* Copyright 2006-2009, BeatriX
|
---|
| 2 | * File coded by BeatriX
|
---|
| 3 | *
|
---|
| 4 | * This file is part of BeaEngine.
|
---|
| 5 | *
|
---|
| 6 | * BeaEngine is free software: you can redistribute it and/or modify
|
---|
| 7 | * it under the terms of the GNU Lesser General Public License as published by
|
---|
| 8 | * the Free Software Foundation, either version 3 of the License, or
|
---|
| 9 | * (at your option) any later version.
|
---|
| 10 | *
|
---|
| 11 | * BeaEngine is distributed in the hope that it will be useful,
|
---|
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 14 | * GNU Lesser General Public License for more details.
|
---|
| 15 | *
|
---|
| 16 | * You should have received a copy of the GNU Lesser General Public License
|
---|
| 17 | * along with BeaEngine. If not, see <http://www.gnu.org/licenses/>. */
|
---|
| 18 |
|
---|
| 19 | /* ====================================================================
|
---|
| 20 | * 0f01h
|
---|
| 21 | * ==================================================================== */
|
---|
| 22 | void __bea_callspec__ G7_(PDISASM pMyDisasm)
|
---|
| 23 | {
|
---|
| 24 | (*pMyDisasm).Instruction.Category = SYSTEM_INSTRUCTION;
|
---|
| 25 | GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7;
|
---|
| 26 | GV.MOD_= ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 6) & 0x3;
|
---|
| 27 | GV.RM_ = (*((UInt8*)(UIntPtr) (GV.EIP_+1))) & 0x7;
|
---|
| 28 | if (GV.REGOPCODE == 0) {
|
---|
| 29 | if (GV.MOD_== 0x3) {
|
---|
| 30 | if (GV.RM_ == 0x1) {
|
---|
| 31 | (*pMyDisasm).Instruction.Category = VM_INSTRUCTION;
|
---|
| 32 | #ifndef BEA_LIGHT_DISASSEMBLY
|
---|
| 33 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "vmcall ");
|
---|
| 34 | #endif
|
---|
| 35 | GV.EIP_+= GV.DECALAGE_EIP+2;
|
---|
| 36 | }
|
---|
| 37 | else if (GV.RM_ == 0x2) {
|
---|
| 38 | (*pMyDisasm).Instruction.Category = VM_INSTRUCTION;
|
---|
| 39 | #ifndef BEA_LIGHT_DISASSEMBLY
|
---|
| 40 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "vmlaunch ");
|
---|
| 41 | #endif
|
---|
| 42 | GV.EIP_+= GV.DECALAGE_EIP+2;
|
---|
| 43 | }
|
---|
| 44 | else if (GV.RM_ == 0x3) {
|
---|
| 45 | (*pMyDisasm).Instruction.Category = VM_INSTRUCTION;
|
---|
| 46 | #ifndef BEA_LIGHT_DISASSEMBLY
|
---|
| 47 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "vmresume ");
|
---|
| 48 | #endif
|
---|
| 49 | GV.EIP_+= GV.DECALAGE_EIP+2;
|
---|
| 50 | }
|
---|
| 51 | else if (GV.RM_ == 0x4) {
|
---|
| 52 | (*pMyDisasm).Instruction.Category = VM_INSTRUCTION;
|
---|
| 53 | #ifndef BEA_LIGHT_DISASSEMBLY
|
---|
| 54 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "vmxoff ");
|
---|
| 55 | #endif
|
---|
| 56 | GV.EIP_+= GV.DECALAGE_EIP+2;
|
---|
| 57 | }
|
---|
| 58 | else {
|
---|
| 59 | FailDecode(pMyDisasm);
|
---|
| 60 | }
|
---|
| 61 | }
|
---|
| 62 | else {
|
---|
| 63 | GV.MemDecoration = Arg1fword;
|
---|
| 64 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm);
|
---|
| 65 | #ifndef BEA_LIGHT_DISASSEMBLY
|
---|
| 66 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sgdt ");
|
---|
| 67 | #endif
|
---|
| 68 | (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+MEMORY_MANAGEMENT_REG+REG0;
|
---|
| 69 | (*pMyDisasm).Argument2.ArgSize = 48;
|
---|
| 70 | GV.EIP_+= GV.DECALAGE_EIP+2;
|
---|
| 71 | }
|
---|
| 72 | }
|
---|
| 73 | else if (GV.REGOPCODE == 1) {
|
---|
| 74 | if (GV.MOD_== 0x3) {
|
---|
| 75 | if (GV.RM_ == 0x00) {
|
---|
| 76 | (*pMyDisasm).Instruction.Category = SSE3_INSTRUCTION+AGENT_SYNCHRONISATION;
|
---|
| 77 | #ifndef BEA_LIGHT_DISASSEMBLY
|
---|
| 78 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "monitor ");
|
---|
| 79 | #endif
|
---|
| 80 | GV.EIP_+= GV.DECALAGE_EIP+2;
|
---|
| 81 | }
|
---|
| 82 | else if (GV.RM_ == 0x01) {
|
---|
| 83 | (*pMyDisasm).Instruction.Category = SSE3_INSTRUCTION+AGENT_SYNCHRONISATION;
|
---|
| 84 | #ifndef BEA_LIGHT_DISASSEMBLY
|
---|
| 85 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "mwait ");
|
---|
| 86 | #endif
|
---|
| 87 | GV.EIP_+= GV.DECALAGE_EIP+2;
|
---|
| 88 | }
|
---|
| 89 | else {
|
---|
| 90 | FailDecode(pMyDisasm);
|
---|
| 91 | }
|
---|
| 92 | }
|
---|
| 93 | else {
|
---|
| 94 | GV.MemDecoration = Arg1fword;
|
---|
| 95 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm);
|
---|
| 96 | (*pMyDisasm).Instruction.Category = SYSTEM_INSTRUCTION;
|
---|
| 97 | #ifndef BEA_LIGHT_DISASSEMBLY
|
---|
| 98 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sidt ");
|
---|
| 99 | #endif
|
---|
| 100 | (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+MEMORY_MANAGEMENT_REG+REG2;
|
---|
| 101 | (*pMyDisasm).Argument2.ArgSize = 48;
|
---|
| 102 | GV.EIP_+= GV.DECALAGE_EIP+2;
|
---|
| 103 | }
|
---|
| 104 | }
|
---|
| 105 | else if (GV.REGOPCODE == 2) {
|
---|
| 106 | if (GV.MOD_== 0x3) {
|
---|
| 107 | if (GV.RM_ == 0x0) {
|
---|
| 108 | (*pMyDisasm).Instruction.Category = VM_INSTRUCTION;
|
---|
| 109 | #ifndef BEA_LIGHT_DISASSEMBLY
|
---|
| 110 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "xgetbv ");
|
---|
| 111 | #endif
|
---|
| 112 | GV.EIP_+= GV.DECALAGE_EIP+2;
|
---|
| 113 | }
|
---|
| 114 | else if (GV.RM_ == 0x1) {
|
---|
| 115 | (*pMyDisasm).Instruction.Category = VM_INSTRUCTION;
|
---|
| 116 | #ifndef BEA_LIGHT_DISASSEMBLY
|
---|
| 117 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "xsetbv ");
|
---|
| 118 | #endif
|
---|
| 119 | GV.EIP_+= GV.DECALAGE_EIP+2;
|
---|
| 120 | }
|
---|
| 121 | else {
|
---|
| 122 | FailDecode(pMyDisasm);
|
---|
| 123 | }
|
---|
| 124 | }
|
---|
| 125 | else {
|
---|
| 126 | GV.MemDecoration = Arg2fword;
|
---|
| 127 | MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm);
|
---|
| 128 | (*pMyDisasm).Instruction.Category = SYSTEM_INSTRUCTION;
|
---|
| 129 | #ifndef BEA_LIGHT_DISASSEMBLY
|
---|
| 130 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "lgdt ");
|
---|
| 131 | #endif
|
---|
| 132 | (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+MEMORY_MANAGEMENT_REG+REG0;
|
---|
| 133 | (*pMyDisasm).Argument1.ArgSize = 48;
|
---|
| 134 | GV.EIP_+= GV.DECALAGE_EIP+2;
|
---|
| 135 | }
|
---|
| 136 | }
|
---|
| 137 | else if (GV.REGOPCODE == 3) {
|
---|
| 138 | if (GV.MOD_== 0x3) {
|
---|
| 139 | if (GV.RM_ == 0x0) {
|
---|
| 140 | (*pMyDisasm).Instruction.Category = VM_INSTRUCTION;
|
---|
| 141 | #ifndef BEA_LIGHT_DISASSEMBLY
|
---|
| 142 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "vmrun ");
|
---|
| 143 | #endif
|
---|
| 144 | GV.EIP_+= GV.DECALAGE_EIP+2;
|
---|
| 145 | }
|
---|
| 146 | else if (GV.RM_ == 0x1) {
|
---|
| 147 | (*pMyDisasm).Instruction.Category = VM_INSTRUCTION;
|
---|
| 148 | #ifndef BEA_LIGHT_DISASSEMBLY
|
---|
| 149 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "vmmcall ");
|
---|
| 150 | #endif
|
---|
| 151 | GV.EIP_+= GV.DECALAGE_EIP+2;
|
---|
| 152 | }
|
---|
| 153 | else if (GV.RM_ == 0x2) {
|
---|
| 154 | (*pMyDisasm).Instruction.Category = VM_INSTRUCTION;
|
---|
| 155 | #ifndef BEA_LIGHT_DISASSEMBLY
|
---|
| 156 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "vmload ");
|
---|
| 157 | #endif
|
---|
| 158 | GV.EIP_+= GV.DECALAGE_EIP+2;
|
---|
| 159 | }
|
---|
| 160 | else if (GV.RM_ == 0x3) {
|
---|
| 161 | (*pMyDisasm).Instruction.Category = VM_INSTRUCTION;
|
---|
| 162 | #ifndef BEA_LIGHT_DISASSEMBLY
|
---|
| 163 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "vmsave ");
|
---|
| 164 | #endif
|
---|
| 165 | GV.EIP_+= GV.DECALAGE_EIP+2;
|
---|
| 166 | }
|
---|
| 167 | else if (GV.RM_ == 0x4) {
|
---|
| 168 | (*pMyDisasm).Instruction.Category = VM_INSTRUCTION;
|
---|
| 169 | #ifndef BEA_LIGHT_DISASSEMBLY
|
---|
| 170 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "stgi ");
|
---|
| 171 | #endif
|
---|
| 172 | GV.EIP_+= GV.DECALAGE_EIP+2;
|
---|
| 173 | }
|
---|
| 174 | else if (GV.RM_ == 0x5) {
|
---|
| 175 | (*pMyDisasm).Instruction.Category = VM_INSTRUCTION;
|
---|
| 176 | #ifndef BEA_LIGHT_DISASSEMBLY
|
---|
| 177 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "clgi ");
|
---|
| 178 | #endif
|
---|
| 179 | GV.EIP_+= GV.DECALAGE_EIP+2;
|
---|
| 180 | }
|
---|
| 181 | else if (GV.RM_ == 0x6) {
|
---|
| 182 | (*pMyDisasm).Instruction.Category = VM_INSTRUCTION;
|
---|
| 183 | #ifndef BEA_LIGHT_DISASSEMBLY
|
---|
| 184 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "skinit ");
|
---|
| 185 | #endif
|
---|
| 186 | GV.EIP_+= GV.DECALAGE_EIP+2;
|
---|
| 187 | }
|
---|
| 188 | else if (GV.RM_ == 0x7) {
|
---|
| 189 | (*pMyDisasm).Instruction.Category = VM_INSTRUCTION;
|
---|
| 190 | #ifndef BEA_LIGHT_DISASSEMBLY
|
---|
| 191 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "invlpga ");
|
---|
| 192 | #endif
|
---|
| 193 | GV.EIP_+= GV.DECALAGE_EIP+2;
|
---|
| 194 | }
|
---|
| 195 | else {
|
---|
| 196 | FailDecode(pMyDisasm);
|
---|
| 197 | }
|
---|
| 198 | }
|
---|
| 199 | else {
|
---|
| 200 | GV.MemDecoration = Arg2fword;
|
---|
| 201 | MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm);
|
---|
| 202 | (*pMyDisasm).Instruction.Category = SYSTEM_INSTRUCTION;
|
---|
| 203 | #ifndef BEA_LIGHT_DISASSEMBLY
|
---|
| 204 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "lidt ");
|
---|
| 205 | #endif
|
---|
| 206 | (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+MEMORY_MANAGEMENT_REG+REG2;
|
---|
| 207 | (*pMyDisasm).Argument1.ArgSize = 48;
|
---|
| 208 | GV.EIP_+= GV.DECALAGE_EIP+2;
|
---|
| 209 | }
|
---|
| 210 | }
|
---|
| 211 |
|
---|
| 212 | else if (GV.REGOPCODE == 4) {
|
---|
| 213 | GV.MemDecoration = Arg2word;
|
---|
| 214 | MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm);
|
---|
| 215 | (*pMyDisasm).Instruction.Category = SYSTEM_INSTRUCTION;
|
---|
| 216 | #ifndef BEA_LIGHT_DISASSEMBLY
|
---|
| 217 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "smsw ");
|
---|
| 218 | #endif
|
---|
| 219 | (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+CR_REG+REG0;
|
---|
| 220 | (*pMyDisasm).Argument1.ArgSize = 16;
|
---|
| 221 | GV.EIP_+= GV.DECALAGE_EIP+2;
|
---|
| 222 | }
|
---|
| 223 |
|
---|
| 224 | else if (GV.REGOPCODE == 6) {
|
---|
| 225 | GV.MemDecoration = Arg1word;
|
---|
| 226 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm);
|
---|
| 227 | (*pMyDisasm).Instruction.Category = SYSTEM_INSTRUCTION;
|
---|
| 228 | #ifndef BEA_LIGHT_DISASSEMBLY
|
---|
| 229 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "lmsw ");
|
---|
| 230 | #endif
|
---|
| 231 | (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+CR_REG+REG0;
|
---|
| 232 | (*pMyDisasm).Argument2.ArgSize = 16;
|
---|
| 233 | GV.EIP_+= GV.DECALAGE_EIP+2;
|
---|
| 234 | }
|
---|
| 235 | else if (GV.REGOPCODE == 7) {
|
---|
| 236 | if (GV.MOD_== 0x3) {
|
---|
| 237 | if (GV.Architecture == 64) {
|
---|
| 238 | if (GV.RM_ == 0x0) {
|
---|
| 239 | (*pMyDisasm).Instruction.Category = SYSTEM_INSTRUCTION;
|
---|
| 240 | #ifndef BEA_LIGHT_DISASSEMBLY
|
---|
| 241 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "swapgs ");
|
---|
| 242 | #endif
|
---|
| 243 | GV.EIP_+= GV.DECALAGE_EIP+2;
|
---|
| 244 | }
|
---|
| 245 | else {
|
---|
| 246 | FailDecode(pMyDisasm);
|
---|
| 247 | }
|
---|
| 248 | }
|
---|
| 249 | else {
|
---|
| 250 | if (GV.RM_ == 0x1) {
|
---|
| 251 | (*pMyDisasm).Instruction.Category = SYSTEM_INSTRUCTION;
|
---|
| 252 | #ifndef BEA_LIGHT_DISASSEMBLY
|
---|
| 253 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "rdtscp ");
|
---|
| 254 | #endif
|
---|
| 255 | GV.EIP_+= GV.DECALAGE_EIP+2;
|
---|
| 256 | }
|
---|
| 257 | else {
|
---|
| 258 | FailDecode(pMyDisasm);
|
---|
| 259 | }
|
---|
| 260 | }
|
---|
| 261 | }
|
---|
| 262 | else {
|
---|
| 263 | GV.MemDecoration = Arg2byte;
|
---|
| 264 | MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm);
|
---|
| 265 | (*pMyDisasm).Instruction.Category = SYSTEM_INSTRUCTION;
|
---|
| 266 | #ifndef BEA_LIGHT_DISASSEMBLY
|
---|
| 267 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "invlpg ");
|
---|
| 268 | #endif
|
---|
| 269 | GV.EIP_+= GV.DECALAGE_EIP+2;
|
---|
| 270 | }
|
---|
| 271 | }
|
---|
| 272 | else {
|
---|
| 273 | FailDecode(pMyDisasm);
|
---|
| 274 | }
|
---|
| 275 |
|
---|
| 276 |
|
---|
| 277 | }
|
---|
| 278 |
|
---|