types.cc revision 10593
14120SN/A/* 27660Sgblack@eecs.umich.edu * Copyright (c) 2010 Advanced Micro Devices, Inc. 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 4610593Sgabeblack@google.com paramOut(os, name + ".opcode.type", (uint8_t)machInst.opcode.type); 477624Sgblack@eecs.umich.edu paramOut(os, name + ".opcode.op", (uint8_t)machInst.opcode.op); 487624Sgblack@eecs.umich.edu 497624Sgblack@eecs.umich.edu // Modifier bytes 507624Sgblack@eecs.umich.edu paramOut(os, name + ".modRM", (uint8_t)machInst.modRM); 517624Sgblack@eecs.umich.edu paramOut(os, name + ".sib", (uint8_t)machInst.sib); 527624Sgblack@eecs.umich.edu 537624Sgblack@eecs.umich.edu // Immediate fields 547624Sgblack@eecs.umich.edu paramOut(os, name + ".immediate", machInst.immediate); 557624Sgblack@eecs.umich.edu paramOut(os, name + ".displacement", machInst.displacement); 567624Sgblack@eecs.umich.edu 577624Sgblack@eecs.umich.edu // Sizes 587624Sgblack@eecs.umich.edu paramOut(os, name + ".opSize", machInst.opSize); 597624Sgblack@eecs.umich.edu paramOut(os, name + ".addrSize", machInst.addrSize); 607624Sgblack@eecs.umich.edu paramOut(os, name + ".stackSize", machInst.stackSize); 617624Sgblack@eecs.umich.edu paramOut(os, name + ".dispSize", machInst.dispSize); 627624Sgblack@eecs.umich.edu 637624Sgblack@eecs.umich.edu // Mode 647624Sgblack@eecs.umich.edu paramOut(os, name + ".mode", (uint8_t)machInst.mode); 657624Sgblack@eecs.umich.edu} 667624Sgblack@eecs.umich.edu 677624Sgblack@eecs.umich.edutemplate <> 687624Sgblack@eecs.umich.eduvoid 697624Sgblack@eecs.umich.eduparamIn(Checkpoint *cp, const string §ion, 707624Sgblack@eecs.umich.edu const string &name, ExtMachInst &machInst) 714120SN/A{ 727624Sgblack@eecs.umich.edu uint8_t temp8; 737624Sgblack@eecs.umich.edu // Prefixes 747624Sgblack@eecs.umich.edu paramIn(cp, section, name + ".legacy", temp8); 757624Sgblack@eecs.umich.edu machInst.legacy = temp8; 767624Sgblack@eecs.umich.edu paramIn(cp, section, name + ".rex", temp8); 777624Sgblack@eecs.umich.edu machInst.rex = temp8; 784182SN/A 797624Sgblack@eecs.umich.edu // Opcode 8010593Sgabeblack@google.com paramIn(cp, section, name + ".opcode.type", temp8); 8110593Sgabeblack@google.com machInst.opcode.type = (OpcodeType)temp8; 827624Sgblack@eecs.umich.edu paramIn(cp, section, name + ".opcode.op", temp8); 837624Sgblack@eecs.umich.edu machInst.opcode.op = temp8; 844342SN/A 857624Sgblack@eecs.umich.edu // Modifier bytes 867624Sgblack@eecs.umich.edu paramIn(cp, section, name + ".modRM", temp8); 877624Sgblack@eecs.umich.edu machInst.modRM = temp8; 887624Sgblack@eecs.umich.edu paramIn(cp, section, name + ".sib", temp8); 897624Sgblack@eecs.umich.edu machInst.sib = temp8;; 904182SN/A 917624Sgblack@eecs.umich.edu // Immediate fields 927624Sgblack@eecs.umich.edu paramIn(cp, section, name + ".immediate", machInst.immediate); 937624Sgblack@eecs.umich.edu paramIn(cp, section, name + ".displacement", machInst.displacement); 944276SN/A 957624Sgblack@eecs.umich.edu // Sizes 967624Sgblack@eecs.umich.edu paramIn(cp, section, name + ".opSize", machInst.opSize); 977624Sgblack@eecs.umich.edu paramIn(cp, section, name + ".addrSize", machInst.addrSize); 987624Sgblack@eecs.umich.edu paramIn(cp, section, name + ".stackSize", machInst.stackSize); 997624Sgblack@eecs.umich.edu paramIn(cp, section, name + ".dispSize", machInst.dispSize); 1004276SN/A 1017624Sgblack@eecs.umich.edu // Mode 1027624Sgblack@eecs.umich.edu paramIn(cp, section, name + ".mode", temp8); 1037624Sgblack@eecs.umich.edu machInst.mode = temp8; 1047624Sgblack@eecs.umich.edu} 105