bitfields.isa revision 4801
14158Sgblack@eecs.umich.edu// Copyright (c) 2007 The Hewlett-Packard Development Company
24158Sgblack@eecs.umich.edu// All rights reserved.
34158Sgblack@eecs.umich.edu//
44158Sgblack@eecs.umich.edu// Redistribution and use of this software in source and binary forms,
54158Sgblack@eecs.umich.edu// with or without modification, are permitted provided that the
64158Sgblack@eecs.umich.edu// following conditions are met:
74158Sgblack@eecs.umich.edu//
84158Sgblack@eecs.umich.edu// The software must be used only for Non-Commercial Use which means any
94158Sgblack@eecs.umich.edu// use which is NOT directed to receiving any direct monetary
104158Sgblack@eecs.umich.edu// compensation for, or commercial advantage from such use.  Illustrative
114158Sgblack@eecs.umich.edu// examples of non-commercial use are academic research, personal study,
124158Sgblack@eecs.umich.edu// teaching, education and corporate research & development.
134158Sgblack@eecs.umich.edu// Illustrative examples of commercial use are distributing products for
144158Sgblack@eecs.umich.edu// commercial advantage and providing services using the software for
154158Sgblack@eecs.umich.edu// commercial advantage.
164158Sgblack@eecs.umich.edu//
174158Sgblack@eecs.umich.edu// If you wish to use this software or functionality therein that may be
184158Sgblack@eecs.umich.edu// covered by patents for commercial use, please contact:
194158Sgblack@eecs.umich.edu//     Director of Intellectual Property Licensing
204158Sgblack@eecs.umich.edu//     Office of Strategy and Technology
214158Sgblack@eecs.umich.edu//     Hewlett-Packard Company
224158Sgblack@eecs.umich.edu//     1501 Page Mill Road
234158Sgblack@eecs.umich.edu//     Palo Alto, California  94304
244158Sgblack@eecs.umich.edu//
254158Sgblack@eecs.umich.edu// Redistributions of source code must retain the above copyright notice,
264158Sgblack@eecs.umich.edu// this list of conditions and the following disclaimer.  Redistributions
274158Sgblack@eecs.umich.edu// in binary form must reproduce the above copyright notice, this list of
284158Sgblack@eecs.umich.edu// conditions and the following disclaimer in the documentation and/or
294158Sgblack@eecs.umich.edu// other materials provided with the distribution.  Neither the name of
304158Sgblack@eecs.umich.edu// the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its
314158Sgblack@eecs.umich.edu// contributors may be used to endorse or promote products derived from
324158Sgblack@eecs.umich.edu// this software without specific prior written permission.  No right of
334158Sgblack@eecs.umich.edu// sublicense is granted herewith.  Derivatives of the software and
344158Sgblack@eecs.umich.edu// output created using the software may be prepared, but only for
354158Sgblack@eecs.umich.edu// Non-Commercial Uses.  Derivatives of the software may be shared with
364158Sgblack@eecs.umich.edu// others provided: (i) the others agree to abide by the list of
374158Sgblack@eecs.umich.edu// conditions herein which includes the Non-Commercial Use restrictions;
384158Sgblack@eecs.umich.edu// and (ii) such Derivatives of the software include the above copyright
394158Sgblack@eecs.umich.edu// notice to acknowledge the contribution from this software where
404158Sgblack@eecs.umich.edu// applicable, this list of conditions and the disclaimer below.
414158Sgblack@eecs.umich.edu//
424158Sgblack@eecs.umich.edu// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
434158Sgblack@eecs.umich.edu// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
444158Sgblack@eecs.umich.edu// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
454158Sgblack@eecs.umich.edu// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
464158Sgblack@eecs.umich.edu// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
474158Sgblack@eecs.umich.edu// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
484158Sgblack@eecs.umich.edu// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
494158Sgblack@eecs.umich.edu// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
504158Sgblack@eecs.umich.edu// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
514158Sgblack@eecs.umich.edu// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
524158Sgblack@eecs.umich.edu// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
534158Sgblack@eecs.umich.edu//
544158Sgblack@eecs.umich.edu// Authors: Gabe Black
554158Sgblack@eecs.umich.edu
564158Sgblack@eecs.umich.edu////////////////////////////////////////////////////////////////////
574158Sgblack@eecs.umich.edu//
584158Sgblack@eecs.umich.edu// Bitfield definitions.
594158Sgblack@eecs.umich.edu//
604158Sgblack@eecs.umich.edu
614546Sgblack@eecs.umich.edu//REX prefix
624276Sgblack@eecs.umich.edudef bitfield REX rex;
634801Sgblack@eecs.umich.edudef bitfield REX_PRESENT rex.present;
644546Sgblack@eecs.umich.edudef bitfield REX_W rex.w;
654546Sgblack@eecs.umich.edudef bitfield REX_R rex.r;
664546Sgblack@eecs.umich.edudef bitfield REX_X rex.x;
674546Sgblack@eecs.umich.edudef bitfield REX_B rex.b;
684546Sgblack@eecs.umich.edu
694546Sgblack@eecs.umich.edu//Legacy prefixes
704276Sgblack@eecs.umich.edudef bitfield LEGACY legacy;
714717Sgblack@eecs.umich.edudef bitfield LEGACY_DECODEVAL legacy.decodeVal;
724546Sgblack@eecs.umich.edudef bitfield LEGACY_REPNE legacy.repne;
734546Sgblack@eecs.umich.edudef bitfield LEGACY_REP legacy.rep;
744546Sgblack@eecs.umich.edudef bitfield LEGACY_LOCK legacy.lock;
754717Sgblack@eecs.umich.edudef bitfield LEGACY_OP legacy.op;
764546Sgblack@eecs.umich.edudef bitfield LEGACY_ADDR legacy.addr;
774546Sgblack@eecs.umich.edudef bitfield LEGACY_SEG legacy.seg;
784158Sgblack@eecs.umich.edu
794276Sgblack@eecs.umich.edu// Pieces of the opcode
804276Sgblack@eecs.umich.edudef bitfield OPCODE_NUM opcode.num;
814276Sgblack@eecs.umich.edudef bitfield OPCODE_PREFIXA opcode.prefixA;
824276Sgblack@eecs.umich.edudef bitfield OPCODE_PREFIXB opcode.prefixB;
834276Sgblack@eecs.umich.edudef bitfield OPCODE_OP opcode.op;
844276Sgblack@eecs.umich.edu//The top 5 bits of the opcode tend to split the instructions into groups
854276Sgblack@eecs.umich.edudef bitfield OPCODE_OP_TOP5 opcode.op.top5;
864276Sgblack@eecs.umich.edudef bitfield OPCODE_OP_BOTTOM3 opcode.op.bottom3;
874276Sgblack@eecs.umich.edu
884276Sgblack@eecs.umich.edu// Immediate fields
894276Sgblack@eecs.umich.edudef bitfield IMMEDIATE immediate;
904276Sgblack@eecs.umich.edudef bitfield DISPLACEMENT displacement;
914276Sgblack@eecs.umich.edu
924276Sgblack@eecs.umich.edu//Modifier bytes
934276Sgblack@eecs.umich.edudef bitfield MODRM modRM;
944276Sgblack@eecs.umich.edudef bitfield MODRM_MOD modRM.mod;
954276Sgblack@eecs.umich.edudef bitfield MODRM_REG modRM.reg;
964276Sgblack@eecs.umich.edudef bitfield MODRM_RM modRM.rm;
974276Sgblack@eecs.umich.edu
984276Sgblack@eecs.umich.edudef bitfield SIB sib;
994276Sgblack@eecs.umich.edudef bitfield SIB_SCALE sib.scale;
1004276Sgblack@eecs.umich.edudef bitfield SIB_INDEX sib.index;
1014276Sgblack@eecs.umich.edudef bitfield SIB_BASE sib.base;
1024526Sgblack@eecs.umich.edu
1034526Sgblack@eecs.umich.edudef bitfield OPSIZE opSize;
1044541Sgblack@eecs.umich.edudef bitfield ADDRSIZE addrSize;
1054586Sgblack@eecs.umich.edudef bitfield STACKSIZE stackSize;
1064586Sgblack@eecs.umich.edu
1074586Sgblack@eecs.umich.edudef bitfield MODE mode;
1084586Sgblack@eecs.umich.edudef bitfield MODE_MODE mode.mode;
1094586Sgblack@eecs.umich.edudef bitfield MODE_SUBMODE mode.submode;
110