int.hh revision 9921
14166SN/A/* 24166SN/A * Copyright (c) 2007 The Hewlett-Packard Development Company 34166SN/A * All rights reserved. 44166SN/A * 57087SN/A * The license below extends only to copyright in the software and shall 67087SN/A * not be construed as granting a license to any other intellectual 77087SN/A * property including but not limited to intellectual property relating 87087SN/A * to a hardware implementation of the functionality of the software 97087SN/A * licensed hereunder. You may use the software subject to the license 107087SN/A * terms below provided that you ensure that this notice is replicated 117087SN/A * unmodified and in its entirety in all distributions of the software, 127087SN/A * modified or unmodified, in source code or in binary form. 134166SN/A * 147087SN/A * Redistribution and use in source and binary forms, with or without 157087SN/A * modification, are permitted provided that the following conditions are 167087SN/A * met: redistributions of source code must retain the above copyright 177087SN/A * notice, this list of conditions and the following disclaimer; 187087SN/A * redistributions in binary form must reproduce the above copyright 197087SN/A * notice, this list of conditions and the following disclaimer in the 207087SN/A * documentation and/or other materials provided with the distribution; 217087SN/A * neither the name of the copyright holders nor the names of its 224166SN/A * contributors may be used to endorse or promote products derived from 237087SN/A * this software without specific prior written permission. 244166SN/A * 254166SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 264166SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 274166SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 284166SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 294166SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 304166SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 314166SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 324166SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 334166SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 344166SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 354166SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 364166SN/A * 374166SN/A * Authors: Gabe Black 384166SN/A */ 394166SN/A 404166SN/A#ifndef __ARCH_X86_INTREGS_HH__ 414166SN/A#define __ARCH_X86_INTREGS_HH__ 424166SN/A 435063SN/A#include "arch/x86/x86_traits.hh" 444680SN/A#include "base/bitunion.hh" 456359SN/A#include "base/misc.hh" 466359SN/A#include "sim/core.hh" 474679SN/A 484166SN/Anamespace X86ISA 494166SN/A{ 504679SN/A BitUnion64(X86IntReg) 514679SN/A Bitfield<63,0> R; 525061SN/A SignedBitfield<63,0> SR; 534679SN/A Bitfield<31,0> E; 545061SN/A SignedBitfield<31,0> SE; 554679SN/A Bitfield<15,0> X; 565061SN/A SignedBitfield<15,0> SX; 574679SN/A Bitfield<15,8> H; 585061SN/A SignedBitfield<15,8> SH; 594679SN/A Bitfield<7, 0> L; 605061SN/A SignedBitfield<7, 0> SL; 614679SN/A EndBitUnion(X86IntReg) 624679SN/A 634166SN/A enum IntRegIndex 644166SN/A { 654166SN/A INTREG_RAX, 664333SN/A INTREG_EAX = INTREG_RAX, 674333SN/A INTREG_AX = INTREG_RAX, 684333SN/A INTREG_AL = INTREG_RAX, 694333SN/A 704166SN/A INTREG_RCX, 714333SN/A INTREG_ECX = INTREG_RCX, 724333SN/A INTREG_CX = INTREG_RCX, 734333SN/A INTREG_CL = INTREG_RCX, 744333SN/A 754166SN/A INTREG_RDX, 764333SN/A INTREG_EDX = INTREG_RDX, 774333SN/A INTREG_DX = INTREG_RDX, 784333SN/A INTREG_DL = INTREG_RDX, 794333SN/A 804166SN/A INTREG_RBX, 814333SN/A INTREG_EBX = INTREG_RBX, 824333SN/A INTREG_BX = INTREG_RBX, 834333SN/A INTREG_BL = INTREG_RBX, 844333SN/A 854166SN/A INTREG_RSP, 864333SN/A INTREG_ESP = INTREG_RSP, 874333SN/A INTREG_SP = INTREG_RSP, 884333SN/A INTREG_SPL = INTREG_RSP, 894574SN/A INTREG_AH = INTREG_RSP, 904333SN/A 914166SN/A INTREG_RBP, 924333SN/A INTREG_EBP = INTREG_RBP, 934333SN/A INTREG_BP = INTREG_RBP, 944333SN/A INTREG_BPL = INTREG_RBP, 954574SN/A INTREG_CH = INTREG_RBP, 964333SN/A 974166SN/A INTREG_RSI, 984333SN/A INTREG_ESI = INTREG_RSI, 994333SN/A INTREG_SI = INTREG_RSI, 1004333SN/A INTREG_SIL = INTREG_RSI, 1014574SN/A INTREG_DH = INTREG_RSI, 1024333SN/A 1034166SN/A INTREG_RDI, 1044333SN/A INTREG_EDI = INTREG_RDI, 1054333SN/A INTREG_DI = INTREG_RDI, 1064333SN/A INTREG_DIL = INTREG_RDI, 1074574SN/A INTREG_BH = INTREG_RDI, 1084333SN/A 1094333SN/A INTREG_R8, 1104333SN/A INTREG_R8D = INTREG_R8, 1114333SN/A INTREG_R8W = INTREG_R8, 1124333SN/A INTREG_R8B = INTREG_R8, 1134333SN/A 1144333SN/A INTREG_R9, 1154333SN/A INTREG_R9D = INTREG_R9, 1164333SN/A INTREG_R9W = INTREG_R9, 1174333SN/A INTREG_R9B = INTREG_R9, 1184333SN/A 1194333SN/A INTREG_R10, 1204333SN/A INTREG_R10D = INTREG_R10, 1214333SN/A INTREG_R10W = INTREG_R10, 1224333SN/A INTREG_R10B = INTREG_R10, 1234333SN/A 1244333SN/A INTREG_R11, 1254333SN/A INTREG_R11D = INTREG_R11, 1264333SN/A INTREG_R11W = INTREG_R11, 1274333SN/A INTREG_R11B = INTREG_R11, 1284333SN/A 1294333SN/A INTREG_R12, 1304333SN/A INTREG_R12D = INTREG_R12, 1314333SN/A INTREG_R12W = INTREG_R12, 1324333SN/A INTREG_R12B = INTREG_R12, 1334333SN/A 1344333SN/A INTREG_R13, 1354333SN/A INTREG_R13D = INTREG_R13, 1364333SN/A INTREG_R13W = INTREG_R13, 1374333SN/A INTREG_R13B = INTREG_R13, 1384333SN/A 1394333SN/A INTREG_R14, 1404333SN/A INTREG_R14D = INTREG_R14, 1414333SN/A INTREG_R14W = INTREG_R14, 1424333SN/A INTREG_R14B = INTREG_R14, 1434333SN/A 1444333SN/A INTREG_R15, 1454333SN/A INTREG_R15D = INTREG_R15, 1464333SN/A INTREG_R15W = INTREG_R15, 1474333SN/A INTREG_R15B = INTREG_R15, 1484333SN/A 1494277SN/A NUM_INTREGS 1504166SN/A }; 1515063SN/A 1526361SN/A // This needs to be large enough to miss all the other bits of an index. 1536361SN/A static const IntRegIndex IntFoldBit = (IntRegIndex)(1 << 6); 1546361SN/A 1555063SN/A inline static IntRegIndex 1565063SN/A INTREG_MICRO(int index) 1575063SN/A { 1585063SN/A return (IntRegIndex)(NUM_INTREGS + index); 1595063SN/A } 1605063SN/A 1615063SN/A inline static IntRegIndex 1629921Syasuko.eckert@amd.com INTREG_IMPLICIT(int index) 1635063SN/A { 1645063SN/A return (IntRegIndex)(NUM_INTREGS + NumMicroIntRegs + index); 1655063SN/A } 1665063SN/A 1675063SN/A inline static IntRegIndex 1685063SN/A INTREG_FOLDED(int index, int foldBit) 1695063SN/A { 1706359SN/A if ((index & 0x1C) == 4 && foldBit) 1716359SN/A index = (index - 4) | foldBit; 1726359SN/A return (IntRegIndex)index; 1735063SN/A } 1748902Sandreas.hansson@arm.com} 1754166SN/A 1764614SN/A#endif // __ARCH_X86_INTREGS_HH__ 177