x87.isa revision 4825
1// Copyright (c) 2007 The Hewlett-Packard Development Company 2// All rights reserved. 3// 4// Redistribution and use of this software in source and binary forms, 5// with or without modification, are permitted provided that the 6// following conditions are met: 7// 8// The software must be used only for Non-Commercial Use which means any 9// use which is NOT directed to receiving any direct monetary 10// compensation for, or commercial advantage from such use. Illustrative 11// examples of non-commercial use are academic research, personal study, 12// teaching, education and corporate research & development. 13// Illustrative examples of commercial use are distributing products for 14// commercial advantage and providing services using the software for 15// commercial advantage. 16// 17// If you wish to use this software or functionality therein that may be 18// covered by patents for commercial use, please contact: 19// Director of Intellectual Property Licensing 20// Office of Strategy and Technology 21// Hewlett-Packard Company 22// 1501 Page Mill Road 23// Palo Alto, California 94304 24// 25// Redistributions of source code must retain the above copyright notice, 26// this list of conditions and the following disclaimer. Redistributions 27// in binary form must reproduce the above copyright notice, this list of 28// conditions and the following disclaimer in the documentation and/or 29// other materials provided with the distribution. Neither the name of 30// the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its 31// contributors may be used to endorse or promote products derived from 32// this software without specific prior written permission. No right of 33// sublicense is granted herewith. Derivatives of the software and 34// output created using the software may be prepared, but only for 35// Non-Commercial Uses. Derivatives of the software may be shared with 36// others provided: (i) the others agree to abide by the list of 37// conditions herein which includes the Non-Commercial Use restrictions; 38// and (ii) such Derivatives of the software include the above copyright 39// notice to acknowledge the contribution from this software where 40// applicable, this list of conditions and the disclaimer below. 41// 42// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 43// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 44// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 45// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 46// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 47// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 48// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 49// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 50// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 51// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 52// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 53// 54// Authors: Gabe Black 55 560x1B: decode OPCODE_OP_BOTTOM3 { 57 //0x0: esc0(); 58 0x0: decode MODRM_REG { 59 0x0: fadd(); 60 0x1: fmul(); 61 0x2: fcom(); 62 0x3: fcomp(); 63 0x4: fsub(); 64 0x5: fsubr(); 65 0x6: fdiv(); 66 0x7: fdivr(); 67 } 68 //0x1: esc1(); 69 0x1: decode MODRM_REG { 70 0x0: fld(); 71 0x1: decode MODRM_MOD { 72 0x3: fxch(); 73 default: Inst::UD2(); 74 } 75 0x2: decode MODRM_MOD { 76 0x3: decode MODRM_RM { 77 0x0: fnop(); 78 default: Inst::UD2(); 79 } 80 default: fst(); 81 } 82 0x3: decode MODRM_MOD { 83 0x3: Inst::UD2(); 84 default: fstp(); 85 } 86 0x4: decode MODRM_MOD { 87 0x3: decode MODRM_RM { 88 0x0: fchs(); 89 0x1: fabs(); 90 0x4: ftst(); 91 0x5: fxam(); 92 default: Inst::UD2(); 93 } 94 default: fldenv(); 95 } 96 0x5: decode MODRM_MOD { 97 0x3: decode MODRM_RM { 98 0x0: fld1(); 99 0x1: fldl2t(); 100 0x2: fldl2e(); 101 0x3: fldpi(); 102 0x4: fldlg2(); 103 0x5: fldln2(); 104 0x6: fldz(); 105 } 106 default: fldcw(); 107 } 108 0x6: decode MODRM_MOD { 109 0x3: decode MODRM_RM { 110 0x0: f2xm1(); 111 0x1: fyl2x(); 112 0x2: fptan(); 113 0x3: fpatan(); 114 0x4: fxtract(); 115 0x5: fprem1(); 116 0x6: fdecstp(); 117 0x7: fincstp(); 118 } 119 default: fnstenv(); 120 } 121 0x7: decode MODRM_MOD { 122 0x3: decode MODRM_RM { 123 0x0: fprem(); 124 0x1: fyl2xp1(); 125 0x2: fsqrt(); 126 0x3: fsincos(); 127 0x4: frndint(); 128 0x5: fscale(); 129 0x6: fsin(); 130 0x7: fcos(); 131 } 132 default: fnstcw(); 133 } 134 } 135 //0x2: esc2(); 136 0x2: decode MODRM_REG { 137 0x0: decode MODRM_MOD { 138 0x3: fcmovb(); 139 default: fiadd(); 140 } 141 0x1: decode MODRM_MOD { 142 0x3: fcmove(); 143 default: fimul(); 144 } 145 0x2: decode MODRM_MOD { 146 0x3: fcmovbe(); 147 default: ficom(); 148 } 149 0x3: decode MODRM_MOD { 150 0x3: fcmovu(); 151 default: ficomp(); 152 } 153 0x4: decode MODRM_MOD { 154 0x3: Inst::UD2(); 155 default: fisub(); 156 } 157 0x5: decode MODRM_MOD { 158 0x3: decode MODRM_RM { 159 0x1: fucompp(); 160 default: Inst::UD2(); 161 } 162 default: fisubr(); 163 } 164 0x6: decode MODRM_MOD { 165 0x3: Inst::UD2(); 166 default: fidiv(); 167 } 168 0x7: decode MODRM_MOD { 169 0x3: Inst::UD2(); 170 default: fidivr(); 171 } 172 } 173 //0x3: esc3(); 174 0x3: decode MODRM_REG { 175 0x0: decode MODRM_MOD { 176 0x3: fcmovnb(); 177 default: fild(); 178 } 179 0x1: decode MODRM_MOD { 180 0x3: fcmovne(); 181 default: fisttp(); 182 } 183 0x2: decode MODRM_MOD { 184 0x3: fcmovnbe(); 185 default: fist(); 186 } 187 0x3: decode MODRM_MOD { 188 0x3: fcmovnu(); 189 default: fistp(); 190 } 191 0x4: decode MODRM_MOD { 192 0x3: decode MODRM_RM { 193 0x2: fnclex(); 194 0x3: fninit(); 195 default: Inst::UD2(); 196 } 197 default: Inst::UD2(); 198 } 199 0x5: decode MODRM_MOD { 200 0x3: fucomi(); 201 default: fld(); 202 } 203 0x6: decode MODRM_MOD { 204 0x3: fcomi(); 205 default: Inst::UD2(); 206 } 207 0x7: decode MODRM_MOD { 208 0x3: Inst::UD2(); 209 default: fstp(); 210 } 211 } 212 //0x4: esc4(); 213 0x4: decode MODRM_REG { 214 0x0: fadd(); 215 0x1: fmul(); 216 0x2: decode MODRM_MOD { 217 0x3: Inst::UD2(); 218 default: fcom(); 219 } 220 0x3: decode MODRM_MOD { 221 0x3: Inst::UD2(); 222 default: fcomp(); 223 } 224 0x4: decode MODRM_MOD { 225 0x3: fsubr(); 226 default: fsub(); 227 } 228 0x5: decode MODRM_MOD { 229 0x3: fsub(); 230 default: fsubr(); 231 } 232 0x6: decode MODRM_MOD { 233 0x3: fdivr(); 234 default: fdiv(); 235 } 236 0x7: decode MODRM_MOD { 237 0x3: fdiv(); 238 default: fdivr(); 239 } 240 } 241 //0x5: esc5(); 242 0x5: decode MODRM_REG { 243 0x0: decode MODRM_MOD { 244 0x3: ffree(); 245 default: fld(); 246 } 247 0x1: decode MODRM_MOD { 248 0x3: Inst::UD2(); 249 default: fisttp(); 250 } 251 0x2: fst(); 252 0x3: fstp(); 253 0x4: decode MODRM_MOD { 254 0x3: fucom(); 255 default: frstor(); 256 } 257 0x5: decode MODRM_MOD { 258 0x3: fucomp(); 259 default: Inst::UD2(); 260 } 261 0x6: decode MODRM_MOD { 262 0x3: Inst::UD2(); 263 default: fnsave(); 264 } 265 0x7: decode MODRM_MOD { 266 0x3: Inst::UD2(); 267 default: fnstsw(); 268 } 269 } 270 //0x6: esc6(); 271 0x6: decode MODRM_REG { 272 0x0: decode MODRM_MOD { 273 0x3: faddp(); 274 default: fiadd(); 275 } 276 0x1: decode MODRM_MOD { 277 0x3: fmulp(); 278 default: fimul(); 279 } 280 0x2: decode MODRM_MOD { 281 0x3: Inst::UD2(); 282 default: ficom(); 283 } 284 0x3: decode MODRM_MOD { 285 0x3: decode MODRM_RM { 286 0x1: fcompp(); 287 default: Inst::UD2(); 288 } 289 default: ficomp(); 290 } 291 0x4: decode MODRM_MOD { 292 0x3: fsubrp(); 293 default: fisub(); 294 } 295 0x5: decode MODRM_MOD { 296 0x3: fsubp(); 297 default: fisubr(); 298 } 299 0x6: decode MODRM_MOD { 300 0x3: fdivrp(); 301 default: fidiv(); 302 } 303 0x7: decode MODRM_MOD { 304 0x3: fdivp(); 305 default: fidivr(); 306 } 307 } 308 //0x7: esc7(); 309 0x7: decode MODRM_REG { 310 0x0: decode MODRM_MOD { 311 0x3: Inst::UD2(); 312 default: fild(); 313 } 314 0x1: decode MODRM_MOD { 315 0x3: Inst::UD2(); 316 default: fisttp(); 317 } 318 0x2: decode MODRM_MOD { 319 0x3: Inst::UD2(); 320 default: fist(); 321 } 322 0x3: decode MODRM_MOD { 323 0x3: Inst::UD2(); 324 default: fistp(); 325 } 326 0x4: decode MODRM_MOD { 327 0x3: decode MODRM_RM { 328 0x0: fnstsw(); 329 default: Inst::UD2(); 330 } 331 default: fbld(); 332 } 333 0x5: decode MODRM_MOD { 334 0x3: fucomip(); 335 default: fild(); 336 } 337 0x6: decode MODRM_MOD { 338 0x3: fcomip(); 339 default: fbstp(); 340 } 341 0x7: decode MODRM_MOD { 342 0x3: Inst::UD2(); 343 default: fistp(); 344 } 345 } 346} 347