14158Sgblack@eecs.umich.edu// Copyright (c) 2007 The Hewlett-Packard Development Company
24158Sgblack@eecs.umich.edu// All rights reserved.
34158Sgblack@eecs.umich.edu//
47087Snate@binkert.org// The license below extends only to copyright in the software and shall
57087Snate@binkert.org// not be construed as granting a license to any other intellectual
67087Snate@binkert.org// property including but not limited to intellectual property relating
77087Snate@binkert.org// to a hardware implementation of the functionality of the software
87087Snate@binkert.org// licensed hereunder.  You may use the software subject to the license
97087Snate@binkert.org// terms below provided that you ensure that this notice is replicated
107087Snate@binkert.org// unmodified and in its entirety in all distributions of the software,
117087Snate@binkert.org// modified or unmodified, in source code or in binary form.
124158Sgblack@eecs.umich.edu//
137087Snate@binkert.org// Redistribution and use in source and binary forms, with or without
147087Snate@binkert.org// modification, are permitted provided that the following conditions are
157087Snate@binkert.org// met: redistributions of source code must retain the above copyright
167087Snate@binkert.org// notice, this list of conditions and the following disclaimer;
177087Snate@binkert.org// redistributions in binary form must reproduce the above copyright
187087Snate@binkert.org// notice, this list of conditions and the following disclaimer in the
197087Snate@binkert.org// documentation and/or other materials provided with the distribution;
207087Snate@binkert.org// neither the name of the copyright holders nor the names of its
214158Sgblack@eecs.umich.edu// contributors may be used to endorse or promote products derived from
227087Snate@binkert.org// this software without specific prior written permission.
234158Sgblack@eecs.umich.edu//
244158Sgblack@eecs.umich.edu// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
254158Sgblack@eecs.umich.edu// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
264158Sgblack@eecs.umich.edu// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
274158Sgblack@eecs.umich.edu// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
284158Sgblack@eecs.umich.edu// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
294158Sgblack@eecs.umich.edu// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
304158Sgblack@eecs.umich.edu// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
314158Sgblack@eecs.umich.edu// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
324158Sgblack@eecs.umich.edu// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
334158Sgblack@eecs.umich.edu// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
344158Sgblack@eecs.umich.edu// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
354158Sgblack@eecs.umich.edu//
364158Sgblack@eecs.umich.edu// Authors: Gabe Black
374158Sgblack@eecs.umich.edu
384158Sgblack@eecs.umich.edu////////////////////////////////////////////////////////////////////
394158Sgblack@eecs.umich.edu//
404158Sgblack@eecs.umich.edu// Bitfield definitions.
414158Sgblack@eecs.umich.edu//
424158Sgblack@eecs.umich.edu
434546Sgblack@eecs.umich.edu//REX prefix
444276Sgblack@eecs.umich.edudef bitfield REX rex;
454801Sgblack@eecs.umich.edudef bitfield REX_PRESENT rex.present;
464546Sgblack@eecs.umich.edudef bitfield REX_W rex.w;
474546Sgblack@eecs.umich.edudef bitfield REX_R rex.r;
484546Sgblack@eecs.umich.edudef bitfield REX_X rex.x;
494546Sgblack@eecs.umich.edudef bitfield REX_B rex.b;
504546Sgblack@eecs.umich.edu
514546Sgblack@eecs.umich.edu//Legacy prefixes
524276Sgblack@eecs.umich.edudef bitfield LEGACY legacy;
534717Sgblack@eecs.umich.edudef bitfield LEGACY_DECODEVAL legacy.decodeVal;
544546Sgblack@eecs.umich.edudef bitfield LEGACY_REPNE legacy.repne;
554546Sgblack@eecs.umich.edudef bitfield LEGACY_REP legacy.rep;
564546Sgblack@eecs.umich.edudef bitfield LEGACY_LOCK legacy.lock;
574717Sgblack@eecs.umich.edudef bitfield LEGACY_OP legacy.op;
584546Sgblack@eecs.umich.edudef bitfield LEGACY_ADDR legacy.addr;
594546Sgblack@eecs.umich.edudef bitfield LEGACY_SEG legacy.seg;
604158Sgblack@eecs.umich.edu
614276Sgblack@eecs.umich.edu// Pieces of the opcode
6210593Sgabeblack@google.comdef bitfield OPCODE_TYPE opcode.type;
634276Sgblack@eecs.umich.edudef bitfield OPCODE_OP opcode.op;
644276Sgblack@eecs.umich.edu//The top 5 bits of the opcode tend to split the instructions into groups
654276Sgblack@eecs.umich.edudef bitfield OPCODE_OP_TOP5 opcode.op.top5;
664276Sgblack@eecs.umich.edudef bitfield OPCODE_OP_BOTTOM3 opcode.op.bottom3;
674276Sgblack@eecs.umich.edu
684276Sgblack@eecs.umich.edu// Immediate fields
694276Sgblack@eecs.umich.edudef bitfield IMMEDIATE immediate;
704276Sgblack@eecs.umich.edudef bitfield DISPLACEMENT displacement;
714276Sgblack@eecs.umich.edu
724276Sgblack@eecs.umich.edu//Modifier bytes
734276Sgblack@eecs.umich.edudef bitfield MODRM modRM;
744276Sgblack@eecs.umich.edudef bitfield MODRM_MOD modRM.mod;
754276Sgblack@eecs.umich.edudef bitfield MODRM_REG modRM.reg;
764276Sgblack@eecs.umich.edudef bitfield MODRM_RM modRM.rm;
774276Sgblack@eecs.umich.edu
784276Sgblack@eecs.umich.edudef bitfield SIB sib;
794276Sgblack@eecs.umich.edudef bitfield SIB_SCALE sib.scale;
804276Sgblack@eecs.umich.edudef bitfield SIB_INDEX sib.index;
814276Sgblack@eecs.umich.edudef bitfield SIB_BASE sib.base;
824526Sgblack@eecs.umich.edu
834526Sgblack@eecs.umich.edudef bitfield OPSIZE opSize;
844541Sgblack@eecs.umich.edudef bitfield ADDRSIZE addrSize;
854586Sgblack@eecs.umich.edudef bitfield STACKSIZE stackSize;
864586Sgblack@eecs.umich.edu
874586Sgblack@eecs.umich.edudef bitfield MODE mode;
884586Sgblack@eecs.umich.edudef bitfield MODE_MODE mode.mode;
894586Sgblack@eecs.umich.edudef bitfield MODE_SUBMODE mode.submode;
9010924Snilay@cs.wisc.edu
9112045Sgabeblack@google.comdef bitfield VEX_V vex.v;
9212045Sgabeblack@google.comdef bitfield VEX_L vex.l;
93