types.cc revision 10905
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 3910905Sandreas.sandberg@arm.comparamOut(CheckpointOut &cp, const string &name, ExtMachInst const &machInst) 407624Sgblack@eecs.umich.edu{ 417624Sgblack@eecs.umich.edu // Prefixes 4210905Sandreas.sandberg@arm.com paramOut(cp, name + ".legacy", (uint8_t)machInst.legacy); 4310905Sandreas.sandberg@arm.com paramOut(cp, name + ".rex", (uint8_t)machInst.rex); 444276SN/A 457624Sgblack@eecs.umich.edu // Opcode 4610905Sandreas.sandberg@arm.com paramOut(cp, name + ".opcode.type", (uint8_t)machInst.opcode.type); 4710905Sandreas.sandberg@arm.com paramOut(cp, name + ".opcode.op", (uint8_t)machInst.opcode.op); 487624Sgblack@eecs.umich.edu 497624Sgblack@eecs.umich.edu // Modifier bytes 5010905Sandreas.sandberg@arm.com paramOut(cp, name + ".modRM", (uint8_t)machInst.modRM); 5110905Sandreas.sandberg@arm.com paramOut(cp, name + ".sib", (uint8_t)machInst.sib); 527624Sgblack@eecs.umich.edu 537624Sgblack@eecs.umich.edu // Immediate fields 5410905Sandreas.sandberg@arm.com paramOut(cp, name + ".immediate", machInst.immediate); 5510905Sandreas.sandberg@arm.com paramOut(cp, name + ".displacement", machInst.displacement); 567624Sgblack@eecs.umich.edu 577624Sgblack@eecs.umich.edu // Sizes 5810905Sandreas.sandberg@arm.com paramOut(cp, name + ".opSize", machInst.opSize); 5910905Sandreas.sandberg@arm.com paramOut(cp, name + ".addrSize", machInst.addrSize); 6010905Sandreas.sandberg@arm.com paramOut(cp, name + ".stackSize", machInst.stackSize); 6110905Sandreas.sandberg@arm.com paramOut(cp, name + ".dispSize", machInst.dispSize); 627624Sgblack@eecs.umich.edu 637624Sgblack@eecs.umich.edu // Mode 6410905Sandreas.sandberg@arm.com paramOut(cp, name + ".mode", (uint8_t)machInst.mode); 657624Sgblack@eecs.umich.edu} 667624Sgblack@eecs.umich.edu 677624Sgblack@eecs.umich.edutemplate <> 687624Sgblack@eecs.umich.eduvoid 6910905Sandreas.sandberg@arm.comparamIn(CheckpointIn &cp, const string &name, ExtMachInst &machInst) 704120SN/A{ 717624Sgblack@eecs.umich.edu uint8_t temp8; 727624Sgblack@eecs.umich.edu // Prefixes 7310905Sandreas.sandberg@arm.com paramIn(cp, name + ".legacy", temp8); 747624Sgblack@eecs.umich.edu machInst.legacy = temp8; 7510905Sandreas.sandberg@arm.com paramIn(cp, name + ".rex", temp8); 767624Sgblack@eecs.umich.edu machInst.rex = temp8; 774182SN/A 787624Sgblack@eecs.umich.edu // Opcode 7910905Sandreas.sandberg@arm.com paramIn(cp, name + ".opcode.type", temp8); 8010593Sgabeblack@google.com machInst.opcode.type = (OpcodeType)temp8; 8110905Sandreas.sandberg@arm.com paramIn(cp, name + ".opcode.op", temp8); 827624Sgblack@eecs.umich.edu machInst.opcode.op = temp8; 834342SN/A 847624Sgblack@eecs.umich.edu // Modifier bytes 8510905Sandreas.sandberg@arm.com paramIn(cp, name + ".modRM", temp8); 867624Sgblack@eecs.umich.edu machInst.modRM = temp8; 8710905Sandreas.sandberg@arm.com paramIn(cp, name + ".sib", temp8); 887624Sgblack@eecs.umich.edu machInst.sib = temp8;; 894182SN/A 907624Sgblack@eecs.umich.edu // Immediate fields 9110905Sandreas.sandberg@arm.com paramIn(cp, name + ".immediate", machInst.immediate); 9210905Sandreas.sandberg@arm.com paramIn(cp, name + ".displacement", machInst.displacement); 934276SN/A 947624Sgblack@eecs.umich.edu // Sizes 9510905Sandreas.sandberg@arm.com paramIn(cp, name + ".opSize", machInst.opSize); 9610905Sandreas.sandberg@arm.com paramIn(cp, name + ".addrSize", machInst.addrSize); 9710905Sandreas.sandberg@arm.com paramIn(cp, name + ".stackSize", machInst.stackSize); 9810905Sandreas.sandberg@arm.com paramIn(cp, name + ".dispSize", machInst.dispSize); 994276SN/A 1007624Sgblack@eecs.umich.edu // Mode 10110905Sandreas.sandberg@arm.com paramIn(cp, name + ".mode", temp8); 1027624Sgblack@eecs.umich.edu machInst.mode = temp8; 1037624Sgblack@eecs.umich.edu} 104