types.cc revision 7624
14120SN/A/* 27624Sgblack@eecs.umich.edu * Copyright (c) 2010 Gabe Black 34120SN/A * All rights reserved. 44120SN/A * 57087SN/A * Redistribution and use in source and binary forms, with or without 67087SN/A * modification, are permitted provided that the following conditions are 77087SN/A * met: redistributions of source code must retain the above copyright 87087SN/A * notice, this list of conditions and the following disclaimer; 97087SN/A * redistributions in binary form must reproduce the above copyright 107087SN/A * notice, this list of conditions and the following disclaimer in the 117087SN/A * documentation and/or other materials provided with the distribution; 127087SN/A * neither the name of the copyright holders nor the names of its 134120SN/A * contributors may be used to endorse or promote products derived from 147087SN/A * this software without specific prior written permission. 154120SN/A * 164120SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 174120SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 184120SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 194120SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 204120SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 214120SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 224120SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 234120SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 244120SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 254120SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 264120SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 274120SN/A * 284120SN/A * Authors: Gabe Black 294120SN/A */ 304120SN/A 317624Sgblack@eecs.umich.edu#include "arch/x86/types.hh" 327624Sgblack@eecs.umich.edu#include "sim/serialize.hh" 334120SN/A 347624Sgblack@eecs.umich.eduusing namespace X86ISA; 357624Sgblack@eecs.umich.eduusing namespace std; 364147SN/A 377624Sgblack@eecs.umich.edutemplate <> 387624Sgblack@eecs.umich.eduvoid 397624Sgblack@eecs.umich.eduparamOut(ostream &os, const string &name, ExtMachInst const &machInst) 407624Sgblack@eecs.umich.edu{ 417624Sgblack@eecs.umich.edu // Prefixes 427624Sgblack@eecs.umich.edu paramOut(os, name + ".legacy", (uint8_t)machInst.legacy); 437624Sgblack@eecs.umich.edu paramOut(os, name + ".rex", (uint8_t)machInst.rex); 444276SN/A 457624Sgblack@eecs.umich.edu // Opcode 467624Sgblack@eecs.umich.edu paramOut(os, name + ".opcode.num", machInst.opcode.num); 477624Sgblack@eecs.umich.edu paramOut(os, name + ".opcode.prefixA", machInst.opcode.prefixA); 487624Sgblack@eecs.umich.edu paramOut(os, name + ".opcode.prefixB", machInst.opcode.prefixB); 497624Sgblack@eecs.umich.edu paramOut(os, name + ".opcode.op", (uint8_t)machInst.opcode.op); 507624Sgblack@eecs.umich.edu 517624Sgblack@eecs.umich.edu // Modifier bytes 527624Sgblack@eecs.umich.edu paramOut(os, name + ".modRM", (uint8_t)machInst.modRM); 537624Sgblack@eecs.umich.edu paramOut(os, name + ".sib", (uint8_t)machInst.sib); 547624Sgblack@eecs.umich.edu 557624Sgblack@eecs.umich.edu // Immediate fields 567624Sgblack@eecs.umich.edu paramOut(os, name + ".immediate", machInst.immediate); 577624Sgblack@eecs.umich.edu paramOut(os, name + ".displacement", machInst.displacement); 587624Sgblack@eecs.umich.edu 597624Sgblack@eecs.umich.edu // Sizes 607624Sgblack@eecs.umich.edu paramOut(os, name + ".opSize", machInst.opSize); 617624Sgblack@eecs.umich.edu paramOut(os, name + ".addrSize", machInst.addrSize); 627624Sgblack@eecs.umich.edu paramOut(os, name + ".stackSize", machInst.stackSize); 637624Sgblack@eecs.umich.edu paramOut(os, name + ".dispSize", machInst.dispSize); 647624Sgblack@eecs.umich.edu 657624Sgblack@eecs.umich.edu // Mode 667624Sgblack@eecs.umich.edu paramOut(os, name + ".mode", (uint8_t)machInst.mode); 677624Sgblack@eecs.umich.edu} 687624Sgblack@eecs.umich.edu 697624Sgblack@eecs.umich.edutemplate <> 707624Sgblack@eecs.umich.eduvoid 717624Sgblack@eecs.umich.eduparamIn(Checkpoint *cp, const string §ion, 727624Sgblack@eecs.umich.edu const string &name, ExtMachInst &machInst) 734120SN/A{ 747624Sgblack@eecs.umich.edu uint8_t temp8; 757624Sgblack@eecs.umich.edu // Prefixes 767624Sgblack@eecs.umich.edu paramIn(cp, section, name + ".legacy", temp8); 777624Sgblack@eecs.umich.edu machInst.legacy = temp8; 787624Sgblack@eecs.umich.edu paramIn(cp, section, name + ".rex", temp8); 797624Sgblack@eecs.umich.edu machInst.rex = temp8; 804182SN/A 817624Sgblack@eecs.umich.edu // Opcode 827624Sgblack@eecs.umich.edu paramIn(cp, section, name + ".opcode.num", machInst.opcode.num); 837624Sgblack@eecs.umich.edu paramIn(cp, section, name + ".opcode.prefixA", machInst.opcode.prefixA); 847624Sgblack@eecs.umich.edu paramIn(cp, section, name + ".opcode.prefixB", machInst.opcode.prefixB); 857624Sgblack@eecs.umich.edu paramIn(cp, section, name + ".opcode.op", temp8); 867624Sgblack@eecs.umich.edu machInst.opcode.op = temp8; 874342SN/A 887624Sgblack@eecs.umich.edu // Modifier bytes 897624Sgblack@eecs.umich.edu paramIn(cp, section, name + ".modRM", temp8); 907624Sgblack@eecs.umich.edu machInst.modRM = temp8; 917624Sgblack@eecs.umich.edu paramIn(cp, section, name + ".sib", temp8); 927624Sgblack@eecs.umich.edu machInst.sib = temp8;; 934182SN/A 947624Sgblack@eecs.umich.edu // Immediate fields 957624Sgblack@eecs.umich.edu paramIn(cp, section, name + ".immediate", machInst.immediate); 967624Sgblack@eecs.umich.edu paramIn(cp, section, name + ".displacement", machInst.displacement); 974276SN/A 987624Sgblack@eecs.umich.edu // Sizes 997624Sgblack@eecs.umich.edu paramIn(cp, section, name + ".opSize", machInst.opSize); 1007624Sgblack@eecs.umich.edu paramIn(cp, section, name + ".addrSize", machInst.addrSize); 1017624Sgblack@eecs.umich.edu paramIn(cp, section, name + ".stackSize", machInst.stackSize); 1027624Sgblack@eecs.umich.edu paramIn(cp, section, name + ".dispSize", machInst.dispSize); 1034276SN/A 1047624Sgblack@eecs.umich.edu // Mode 1057624Sgblack@eecs.umich.edu paramIn(cp, section, name + ".mode", temp8); 1067624Sgblack@eecs.umich.edu machInst.mode = temp8; 1077624Sgblack@eecs.umich.edu} 108