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"
3211793Sbrandon.potter@amd.com
337624Sgblack@eecs.umich.edu#include "sim/serialize.hh"
344120SN/A
357624Sgblack@eecs.umich.eduusing namespace X86ISA;
367624Sgblack@eecs.umich.eduusing namespace std;
374147SN/A
387624Sgblack@eecs.umich.edutemplate <>
397624Sgblack@eecs.umich.eduvoid
4010905Sandreas.sandberg@arm.comparamOut(CheckpointOut &cp, const string &name, ExtMachInst const &machInst)
417624Sgblack@eecs.umich.edu{
427624Sgblack@eecs.umich.edu    // Prefixes
4310905Sandreas.sandberg@arm.com    paramOut(cp, name + ".legacy", (uint8_t)machInst.legacy);
4410905Sandreas.sandberg@arm.com    paramOut(cp, name + ".rex", (uint8_t)machInst.rex);
4510924Snilay@cs.wisc.edu    paramOut(cp, name + ".vex", (uint32_t)machInst.vex);
464276SN/A
477624Sgblack@eecs.umich.edu    // Opcode
4810905Sandreas.sandberg@arm.com    paramOut(cp, name + ".opcode.type", (uint8_t)machInst.opcode.type);
4910905Sandreas.sandberg@arm.com    paramOut(cp, name + ".opcode.op", (uint8_t)machInst.opcode.op);
507624Sgblack@eecs.umich.edu
517624Sgblack@eecs.umich.edu    // Modifier bytes
5210905Sandreas.sandberg@arm.com    paramOut(cp, name + ".modRM", (uint8_t)machInst.modRM);
5310905Sandreas.sandberg@arm.com    paramOut(cp, name + ".sib", (uint8_t)machInst.sib);
547624Sgblack@eecs.umich.edu
557624Sgblack@eecs.umich.edu    // Immediate fields
5610905Sandreas.sandberg@arm.com    paramOut(cp, name + ".immediate", machInst.immediate);
5710905Sandreas.sandberg@arm.com    paramOut(cp, name + ".displacement", machInst.displacement);
587624Sgblack@eecs.umich.edu
597624Sgblack@eecs.umich.edu    // Sizes
6010905Sandreas.sandberg@arm.com    paramOut(cp, name + ".opSize", machInst.opSize);
6110905Sandreas.sandberg@arm.com    paramOut(cp, name + ".addrSize", machInst.addrSize);
6210905Sandreas.sandberg@arm.com    paramOut(cp, name + ".stackSize", machInst.stackSize);
6310905Sandreas.sandberg@arm.com    paramOut(cp, name + ".dispSize", machInst.dispSize);
647624Sgblack@eecs.umich.edu
657624Sgblack@eecs.umich.edu    // Mode
6610905Sandreas.sandberg@arm.com    paramOut(cp, name + ".mode", (uint8_t)machInst.mode);
677624Sgblack@eecs.umich.edu}
687624Sgblack@eecs.umich.edu
697624Sgblack@eecs.umich.edutemplate <>
707624Sgblack@eecs.umich.eduvoid
7110905Sandreas.sandberg@arm.comparamIn(CheckpointIn &cp, const string &name, ExtMachInst &machInst)
724120SN/A{
737624Sgblack@eecs.umich.edu    uint8_t temp8;
747624Sgblack@eecs.umich.edu    // Prefixes
7510905Sandreas.sandberg@arm.com    paramIn(cp, name + ".legacy", temp8);
767624Sgblack@eecs.umich.edu    machInst.legacy = temp8;
7710905Sandreas.sandberg@arm.com    paramIn(cp, name + ".rex", temp8);
787624Sgblack@eecs.umich.edu    machInst.rex = temp8;
794182SN/A
8010924Snilay@cs.wisc.edu    uint32_t temp32;
8110924Snilay@cs.wisc.edu    paramIn(cp, name + ".vex", temp32);
8210924Snilay@cs.wisc.edu    machInst.vex = temp32;
8310924Snilay@cs.wisc.edu
847624Sgblack@eecs.umich.edu    // Opcode
8510905Sandreas.sandberg@arm.com    paramIn(cp, name + ".opcode.type", temp8);
8610593Sgabeblack@google.com    machInst.opcode.type = (OpcodeType)temp8;
8710905Sandreas.sandberg@arm.com    paramIn(cp, name + ".opcode.op", temp8);
887624Sgblack@eecs.umich.edu    machInst.opcode.op = temp8;
894342SN/A
907624Sgblack@eecs.umich.edu    // Modifier bytes
9110905Sandreas.sandberg@arm.com    paramIn(cp, name + ".modRM", temp8);
927624Sgblack@eecs.umich.edu    machInst.modRM = temp8;
9310905Sandreas.sandberg@arm.com    paramIn(cp, name + ".sib", temp8);
947624Sgblack@eecs.umich.edu    machInst.sib = temp8;;
954182SN/A
967624Sgblack@eecs.umich.edu    // Immediate fields
9710905Sandreas.sandberg@arm.com    paramIn(cp, name + ".immediate", machInst.immediate);
9810905Sandreas.sandberg@arm.com    paramIn(cp, name + ".displacement", machInst.displacement);
994276SN/A
1007624Sgblack@eecs.umich.edu    // Sizes
10110905Sandreas.sandberg@arm.com    paramIn(cp, name + ".opSize", machInst.opSize);
10210905Sandreas.sandberg@arm.com    paramIn(cp, name + ".addrSize", machInst.addrSize);
10310905Sandreas.sandberg@arm.com    paramIn(cp, name + ".stackSize", machInst.stackSize);
10410905Sandreas.sandberg@arm.com    paramIn(cp, name + ".dispSize", machInst.dispSize);
1054276SN/A
1067624Sgblack@eecs.umich.edu    // Mode
10710905Sandreas.sandberg@arm.com    paramIn(cp, name + ".mode", temp8);
1087624Sgblack@eecs.umich.edu    machInst.mode = temp8;
1097624Sgblack@eecs.umich.edu}
110