intregs.hh revision 10037
16717Sgblack@eecs.umich.edu/*
210037SARM gem5 Developers * Copyright (c) 2010-2013 ARM Limited
37310Sgblack@eecs.umich.edu * All rights reserved
47310Sgblack@eecs.umich.edu *
57310Sgblack@eecs.umich.edu * The license below extends only to copyright in the software and shall
67310Sgblack@eecs.umich.edu * not be construed as granting a license to any other intellectual
77310Sgblack@eecs.umich.edu * property including but not limited to intellectual property relating
87310Sgblack@eecs.umich.edu * to a hardware implementation of the functionality of the software
97310Sgblack@eecs.umich.edu * licensed hereunder.  You may use the software subject to the license
107310Sgblack@eecs.umich.edu * terms below provided that you ensure that this notice is replicated
117310Sgblack@eecs.umich.edu * unmodified and in its entirety in all distributions of the software,
127310Sgblack@eecs.umich.edu * modified or unmodified, in source code or in binary form.
137310Sgblack@eecs.umich.edu *
146717Sgblack@eecs.umich.edu * Copyright (c) 2009 The Regents of The University of Michigan
156717Sgblack@eecs.umich.edu * All rights reserved.
166717Sgblack@eecs.umich.edu *
176717Sgblack@eecs.umich.edu * Redistribution and use in source and binary forms, with or without
186717Sgblack@eecs.umich.edu * modification, are permitted provided that the following conditions are
196717Sgblack@eecs.umich.edu * met: redistributions of source code must retain the above copyright
206717Sgblack@eecs.umich.edu * notice, this list of conditions and the following disclaimer;
216717Sgblack@eecs.umich.edu * redistributions in binary form must reproduce the above copyright
226717Sgblack@eecs.umich.edu * notice, this list of conditions and the following disclaimer in the
236717Sgblack@eecs.umich.edu * documentation and/or other materials provided with the distribution;
246717Sgblack@eecs.umich.edu * neither the name of the copyright holders nor the names of its
256717Sgblack@eecs.umich.edu * contributors may be used to endorse or promote products derived from
266717Sgblack@eecs.umich.edu * this software without specific prior written permission.
276717Sgblack@eecs.umich.edu *
286717Sgblack@eecs.umich.edu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
296717Sgblack@eecs.umich.edu * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
306717Sgblack@eecs.umich.edu * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
316717Sgblack@eecs.umich.edu * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
326717Sgblack@eecs.umich.edu * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
336717Sgblack@eecs.umich.edu * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
346717Sgblack@eecs.umich.edu * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
356717Sgblack@eecs.umich.edu * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
366717Sgblack@eecs.umich.edu * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
376717Sgblack@eecs.umich.edu * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
386717Sgblack@eecs.umich.edu * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
396717Sgblack@eecs.umich.edu *
406717Sgblack@eecs.umich.edu * Authors: Gabe Black
416717Sgblack@eecs.umich.edu */
426717Sgblack@eecs.umich.edu
438229Snate@binkert.org#include <cassert>
446717Sgblack@eecs.umich.edu
456717Sgblack@eecs.umich.edu#ifndef __ARCH_ARM_INTREGS_HH__
466717Sgblack@eecs.umich.edu#define __ARCH_ARM_INTREGS_HH__
476717Sgblack@eecs.umich.edu
487310Sgblack@eecs.umich.edu#include "arch/arm/types.hh"
497310Sgblack@eecs.umich.edu
506717Sgblack@eecs.umich.edunamespace ArmISA
516717Sgblack@eecs.umich.edu{
526717Sgblack@eecs.umich.edu
536717Sgblack@eecs.umich.eduenum IntRegIndex
546717Sgblack@eecs.umich.edu{
556717Sgblack@eecs.umich.edu    /* All the unique register indices. */
566717Sgblack@eecs.umich.edu    INTREG_R0,
576717Sgblack@eecs.umich.edu    INTREG_R1,
586717Sgblack@eecs.umich.edu    INTREG_R2,
596717Sgblack@eecs.umich.edu    INTREG_R3,
606717Sgblack@eecs.umich.edu    INTREG_R4,
616717Sgblack@eecs.umich.edu    INTREG_R5,
626717Sgblack@eecs.umich.edu    INTREG_R6,
636717Sgblack@eecs.umich.edu    INTREG_R7,
646717Sgblack@eecs.umich.edu    INTREG_R8,
656717Sgblack@eecs.umich.edu    INTREG_R9,
666717Sgblack@eecs.umich.edu    INTREG_R10,
676717Sgblack@eecs.umich.edu    INTREG_R11,
686717Sgblack@eecs.umich.edu    INTREG_R12,
696717Sgblack@eecs.umich.edu    INTREG_R13,
706717Sgblack@eecs.umich.edu    INTREG_SP = INTREG_R13,
716717Sgblack@eecs.umich.edu    INTREG_R14,
726717Sgblack@eecs.umich.edu    INTREG_LR = INTREG_R14,
736717Sgblack@eecs.umich.edu    INTREG_R15,
746717Sgblack@eecs.umich.edu    INTREG_PC = INTREG_R15,
756717Sgblack@eecs.umich.edu
766717Sgblack@eecs.umich.edu    INTREG_R13_SVC,
776717Sgblack@eecs.umich.edu    INTREG_SP_SVC = INTREG_R13_SVC,
786717Sgblack@eecs.umich.edu    INTREG_R14_SVC,
796717Sgblack@eecs.umich.edu    INTREG_LR_SVC = INTREG_R14_SVC,
806717Sgblack@eecs.umich.edu
816717Sgblack@eecs.umich.edu    INTREG_R13_MON,
826717Sgblack@eecs.umich.edu    INTREG_SP_MON = INTREG_R13_MON,
836717Sgblack@eecs.umich.edu    INTREG_R14_MON,
846717Sgblack@eecs.umich.edu    INTREG_LR_MON = INTREG_R14_MON,
856717Sgblack@eecs.umich.edu
8610037SARM gem5 Developers    INTREG_R13_HYP,
8710037SARM gem5 Developers    INTREG_SP_HYP = INTREG_R13_HYP,
8810037SARM gem5 Developers
896717Sgblack@eecs.umich.edu    INTREG_R13_ABT,
906717Sgblack@eecs.umich.edu    INTREG_SP_ABT = INTREG_R13_ABT,
916717Sgblack@eecs.umich.edu    INTREG_R14_ABT,
926717Sgblack@eecs.umich.edu    INTREG_LR_ABT = INTREG_R14_ABT,
936717Sgblack@eecs.umich.edu
946717Sgblack@eecs.umich.edu    INTREG_R13_UND,
956717Sgblack@eecs.umich.edu    INTREG_SP_UND = INTREG_R13_UND,
966717Sgblack@eecs.umich.edu    INTREG_R14_UND,
976717Sgblack@eecs.umich.edu    INTREG_LR_UND = INTREG_R14_UND,
986717Sgblack@eecs.umich.edu
996717Sgblack@eecs.umich.edu    INTREG_R13_IRQ,
1006717Sgblack@eecs.umich.edu    INTREG_SP_IRQ = INTREG_R13_IRQ,
1016717Sgblack@eecs.umich.edu    INTREG_R14_IRQ,
1026717Sgblack@eecs.umich.edu    INTREG_LR_IRQ = INTREG_R14_IRQ,
1036717Sgblack@eecs.umich.edu
1046717Sgblack@eecs.umich.edu    INTREG_R8_FIQ,
1056717Sgblack@eecs.umich.edu    INTREG_R9_FIQ,
1066717Sgblack@eecs.umich.edu    INTREG_R10_FIQ,
1076717Sgblack@eecs.umich.edu    INTREG_R11_FIQ,
1086717Sgblack@eecs.umich.edu    INTREG_R12_FIQ,
1096717Sgblack@eecs.umich.edu    INTREG_R13_FIQ,
1106717Sgblack@eecs.umich.edu    INTREG_SP_FIQ = INTREG_R13_FIQ,
1116717Sgblack@eecs.umich.edu    INTREG_R14_FIQ,
1126717Sgblack@eecs.umich.edu    INTREG_LR_FIQ = INTREG_R14_FIQ,
1136717Sgblack@eecs.umich.edu
11410037SARM gem5 Developers    INTREG_ZERO,
1156717Sgblack@eecs.umich.edu    INTREG_UREG0,
1168140SMatt.Horsnell@arm.com    INTREG_UREG1,
1178140SMatt.Horsnell@arm.com    INTREG_UREG2,
1188303SAli.Saidi@ARM.com    INTREG_CONDCODES_NZ,
1198303SAli.Saidi@ARM.com    INTREG_CONDCODES_C,
1208303SAli.Saidi@ARM.com    INTREG_CONDCODES_V,
1218301SAli.Saidi@ARM.com    INTREG_CONDCODES_GE,
1227643Sgblack@eecs.umich.edu    INTREG_FPCONDCODES,
12310037SARM gem5 Developers    INTREG_DUMMY, // Dummy reg used to throw away int reg results
12410037SARM gem5 Developers
12510037SARM gem5 Developers    INTREG_SP0,
12610037SARM gem5 Developers    INTREG_SP1,
12710037SARM gem5 Developers    INTREG_SP2,
12810037SARM gem5 Developers    INTREG_SP3,
1296717Sgblack@eecs.umich.edu
1306717Sgblack@eecs.umich.edu    NUM_INTREGS,
13110037SARM gem5 Developers    NUM_ARCH_INTREGS = 32,
13210037SARM gem5 Developers
13310037SARM gem5 Developers    /* AArch64 registers */
13410037SARM gem5 Developers    INTREG_X0 = 0,
13510037SARM gem5 Developers    INTREG_X1,
13610037SARM gem5 Developers    INTREG_X2,
13710037SARM gem5 Developers    INTREG_X3,
13810037SARM gem5 Developers    INTREG_X4,
13910037SARM gem5 Developers    INTREG_X5,
14010037SARM gem5 Developers    INTREG_X6,
14110037SARM gem5 Developers    INTREG_X7,
14210037SARM gem5 Developers    INTREG_X8,
14310037SARM gem5 Developers    INTREG_X9,
14410037SARM gem5 Developers    INTREG_X10,
14510037SARM gem5 Developers    INTREG_X11,
14610037SARM gem5 Developers    INTREG_X12,
14710037SARM gem5 Developers    INTREG_X13,
14810037SARM gem5 Developers    INTREG_X14,
14910037SARM gem5 Developers    INTREG_X15,
15010037SARM gem5 Developers    INTREG_X16,
15110037SARM gem5 Developers    INTREG_X17,
15210037SARM gem5 Developers    INTREG_X18,
15310037SARM gem5 Developers    INTREG_X19,
15410037SARM gem5 Developers    INTREG_X20,
15510037SARM gem5 Developers    INTREG_X21,
15610037SARM gem5 Developers    INTREG_X22,
15710037SARM gem5 Developers    INTREG_X23,
15810037SARM gem5 Developers    INTREG_X24,
15910037SARM gem5 Developers    INTREG_X25,
16010037SARM gem5 Developers    INTREG_X26,
16110037SARM gem5 Developers    INTREG_X27,
16210037SARM gem5 Developers    INTREG_X28,
16310037SARM gem5 Developers    INTREG_X29,
16410037SARM gem5 Developers    INTREG_X30,
16510037SARM gem5 Developers    INTREG_X31,
16610037SARM gem5 Developers
16710037SARM gem5 Developers    INTREG_SPX = NUM_INTREGS,
1686717Sgblack@eecs.umich.edu
1696717Sgblack@eecs.umich.edu    /* All the aliased indexes. */
17010037SARM gem5 Developers
1716717Sgblack@eecs.umich.edu    /* USR mode */
1726717Sgblack@eecs.umich.edu    INTREG_R0_USR = INTREG_R0,
1736717Sgblack@eecs.umich.edu    INTREG_R1_USR = INTREG_R1,
1746717Sgblack@eecs.umich.edu    INTREG_R2_USR = INTREG_R2,
1756717Sgblack@eecs.umich.edu    INTREG_R3_USR = INTREG_R3,
1766717Sgblack@eecs.umich.edu    INTREG_R4_USR = INTREG_R4,
1776717Sgblack@eecs.umich.edu    INTREG_R5_USR = INTREG_R5,
1786717Sgblack@eecs.umich.edu    INTREG_R6_USR = INTREG_R6,
1796717Sgblack@eecs.umich.edu    INTREG_R7_USR = INTREG_R7,
1806717Sgblack@eecs.umich.edu    INTREG_R8_USR = INTREG_R8,
1816717Sgblack@eecs.umich.edu    INTREG_R9_USR = INTREG_R9,
1826717Sgblack@eecs.umich.edu    INTREG_R10_USR = INTREG_R10,
1836717Sgblack@eecs.umich.edu    INTREG_R11_USR = INTREG_R11,
1846717Sgblack@eecs.umich.edu    INTREG_R12_USR = INTREG_R12,
1856717Sgblack@eecs.umich.edu    INTREG_R13_USR = INTREG_R13,
1866717Sgblack@eecs.umich.edu    INTREG_SP_USR = INTREG_SP,
1876717Sgblack@eecs.umich.edu    INTREG_R14_USR = INTREG_R14,
1886717Sgblack@eecs.umich.edu    INTREG_LR_USR = INTREG_LR,
1896717Sgblack@eecs.umich.edu    INTREG_R15_USR = INTREG_R15,
1906717Sgblack@eecs.umich.edu    INTREG_PC_USR = INTREG_PC,
1916717Sgblack@eecs.umich.edu
1926717Sgblack@eecs.umich.edu    /* SVC mode */
1936717Sgblack@eecs.umich.edu    INTREG_R0_SVC = INTREG_R0,
1946717Sgblack@eecs.umich.edu    INTREG_R1_SVC = INTREG_R1,
1956717Sgblack@eecs.umich.edu    INTREG_R2_SVC = INTREG_R2,
1966717Sgblack@eecs.umich.edu    INTREG_R3_SVC = INTREG_R3,
1976717Sgblack@eecs.umich.edu    INTREG_R4_SVC = INTREG_R4,
1986717Sgblack@eecs.umich.edu    INTREG_R5_SVC = INTREG_R5,
1996717Sgblack@eecs.umich.edu    INTREG_R6_SVC = INTREG_R6,
2006717Sgblack@eecs.umich.edu    INTREG_R7_SVC = INTREG_R7,
2016717Sgblack@eecs.umich.edu    INTREG_R8_SVC = INTREG_R8,
2026717Sgblack@eecs.umich.edu    INTREG_R9_SVC = INTREG_R9,
2036717Sgblack@eecs.umich.edu    INTREG_R10_SVC = INTREG_R10,
2046717Sgblack@eecs.umich.edu    INTREG_R11_SVC = INTREG_R11,
2056717Sgblack@eecs.umich.edu    INTREG_R12_SVC = INTREG_R12,
2066717Sgblack@eecs.umich.edu    INTREG_PC_SVC = INTREG_PC,
2076734Sgblack@eecs.umich.edu    INTREG_R15_SVC = INTREG_R15,
2086717Sgblack@eecs.umich.edu
2096717Sgblack@eecs.umich.edu    /* MON mode */
2106717Sgblack@eecs.umich.edu    INTREG_R0_MON = INTREG_R0,
2116717Sgblack@eecs.umich.edu    INTREG_R1_MON = INTREG_R1,
2126717Sgblack@eecs.umich.edu    INTREG_R2_MON = INTREG_R2,
2136717Sgblack@eecs.umich.edu    INTREG_R3_MON = INTREG_R3,
2146717Sgblack@eecs.umich.edu    INTREG_R4_MON = INTREG_R4,
2156717Sgblack@eecs.umich.edu    INTREG_R5_MON = INTREG_R5,
2166717Sgblack@eecs.umich.edu    INTREG_R6_MON = INTREG_R6,
2176717Sgblack@eecs.umich.edu    INTREG_R7_MON = INTREG_R7,
2186717Sgblack@eecs.umich.edu    INTREG_R8_MON = INTREG_R8,
2196717Sgblack@eecs.umich.edu    INTREG_R9_MON = INTREG_R9,
2206717Sgblack@eecs.umich.edu    INTREG_R10_MON = INTREG_R10,
2216717Sgblack@eecs.umich.edu    INTREG_R11_MON = INTREG_R11,
2226717Sgblack@eecs.umich.edu    INTREG_R12_MON = INTREG_R12,
2236717Sgblack@eecs.umich.edu    INTREG_PC_MON = INTREG_PC,
2246734Sgblack@eecs.umich.edu    INTREG_R15_MON = INTREG_R15,
2256717Sgblack@eecs.umich.edu
2266717Sgblack@eecs.umich.edu    /* ABT mode */
2276717Sgblack@eecs.umich.edu    INTREG_R0_ABT = INTREG_R0,
2286717Sgblack@eecs.umich.edu    INTREG_R1_ABT = INTREG_R1,
2296717Sgblack@eecs.umich.edu    INTREG_R2_ABT = INTREG_R2,
2306717Sgblack@eecs.umich.edu    INTREG_R3_ABT = INTREG_R3,
2316717Sgblack@eecs.umich.edu    INTREG_R4_ABT = INTREG_R4,
2326717Sgblack@eecs.umich.edu    INTREG_R5_ABT = INTREG_R5,
2336717Sgblack@eecs.umich.edu    INTREG_R6_ABT = INTREG_R6,
2346717Sgblack@eecs.umich.edu    INTREG_R7_ABT = INTREG_R7,
2356717Sgblack@eecs.umich.edu    INTREG_R8_ABT = INTREG_R8,
2366717Sgblack@eecs.umich.edu    INTREG_R9_ABT = INTREG_R9,
2376717Sgblack@eecs.umich.edu    INTREG_R10_ABT = INTREG_R10,
2386717Sgblack@eecs.umich.edu    INTREG_R11_ABT = INTREG_R11,
2396717Sgblack@eecs.umich.edu    INTREG_R12_ABT = INTREG_R12,
2406717Sgblack@eecs.umich.edu    INTREG_PC_ABT = INTREG_PC,
2416734Sgblack@eecs.umich.edu    INTREG_R15_ABT = INTREG_R15,
2426717Sgblack@eecs.umich.edu
24310037SARM gem5 Developers    /* HYP mode */
24410037SARM gem5 Developers    INTREG_R0_HYP = INTREG_R0,
24510037SARM gem5 Developers    INTREG_R1_HYP = INTREG_R1,
24610037SARM gem5 Developers    INTREG_R2_HYP = INTREG_R2,
24710037SARM gem5 Developers    INTREG_R3_HYP = INTREG_R3,
24810037SARM gem5 Developers    INTREG_R4_HYP = INTREG_R4,
24910037SARM gem5 Developers    INTREG_R5_HYP = INTREG_R5,
25010037SARM gem5 Developers    INTREG_R6_HYP = INTREG_R6,
25110037SARM gem5 Developers    INTREG_R7_HYP = INTREG_R7,
25210037SARM gem5 Developers    INTREG_R8_HYP = INTREG_R8,
25310037SARM gem5 Developers    INTREG_R9_HYP = INTREG_R9,
25410037SARM gem5 Developers    INTREG_R10_HYP = INTREG_R10,
25510037SARM gem5 Developers    INTREG_R11_HYP = INTREG_R11,
25610037SARM gem5 Developers    INTREG_R12_HYP = INTREG_R12,
25710037SARM gem5 Developers    INTREG_LR_HYP = INTREG_LR,
25810037SARM gem5 Developers    INTREG_R14_HYP = INTREG_R14,
25910037SARM gem5 Developers    INTREG_PC_HYP = INTREG_PC,
26010037SARM gem5 Developers    INTREG_R15_HYP = INTREG_R15,
26110037SARM gem5 Developers
2626717Sgblack@eecs.umich.edu    /* UND mode */
2636717Sgblack@eecs.umich.edu    INTREG_R0_UND = INTREG_R0,
2646717Sgblack@eecs.umich.edu    INTREG_R1_UND = INTREG_R1,
2656717Sgblack@eecs.umich.edu    INTREG_R2_UND = INTREG_R2,
2666717Sgblack@eecs.umich.edu    INTREG_R3_UND = INTREG_R3,
2676717Sgblack@eecs.umich.edu    INTREG_R4_UND = INTREG_R4,
2686717Sgblack@eecs.umich.edu    INTREG_R5_UND = INTREG_R5,
2696717Sgblack@eecs.umich.edu    INTREG_R6_UND = INTREG_R6,
2706717Sgblack@eecs.umich.edu    INTREG_R7_UND = INTREG_R7,
2716717Sgblack@eecs.umich.edu    INTREG_R8_UND = INTREG_R8,
2726717Sgblack@eecs.umich.edu    INTREG_R9_UND = INTREG_R9,
2736717Sgblack@eecs.umich.edu    INTREG_R10_UND = INTREG_R10,
2746717Sgblack@eecs.umich.edu    INTREG_R11_UND = INTREG_R11,
2756717Sgblack@eecs.umich.edu    INTREG_R12_UND = INTREG_R12,
2766717Sgblack@eecs.umich.edu    INTREG_PC_UND = INTREG_PC,
2776734Sgblack@eecs.umich.edu    INTREG_R15_UND = INTREG_R15,
2786717Sgblack@eecs.umich.edu
2796717Sgblack@eecs.umich.edu    /* IRQ mode */
2806717Sgblack@eecs.umich.edu    INTREG_R0_IRQ = INTREG_R0,
2816717Sgblack@eecs.umich.edu    INTREG_R1_IRQ = INTREG_R1,
2826717Sgblack@eecs.umich.edu    INTREG_R2_IRQ = INTREG_R2,
2836717Sgblack@eecs.umich.edu    INTREG_R3_IRQ = INTREG_R3,
2846717Sgblack@eecs.umich.edu    INTREG_R4_IRQ = INTREG_R4,
2856717Sgblack@eecs.umich.edu    INTREG_R5_IRQ = INTREG_R5,
2866717Sgblack@eecs.umich.edu    INTREG_R6_IRQ = INTREG_R6,
2876717Sgblack@eecs.umich.edu    INTREG_R7_IRQ = INTREG_R7,
2886717Sgblack@eecs.umich.edu    INTREG_R8_IRQ = INTREG_R8,
2896717Sgblack@eecs.umich.edu    INTREG_R9_IRQ = INTREG_R9,
2906717Sgblack@eecs.umich.edu    INTREG_R10_IRQ = INTREG_R10,
2916717Sgblack@eecs.umich.edu    INTREG_R11_IRQ = INTREG_R11,
2926717Sgblack@eecs.umich.edu    INTREG_R12_IRQ = INTREG_R12,
2936717Sgblack@eecs.umich.edu    INTREG_PC_IRQ = INTREG_PC,
2946734Sgblack@eecs.umich.edu    INTREG_R15_IRQ = INTREG_R15,
2956717Sgblack@eecs.umich.edu
2966717Sgblack@eecs.umich.edu    /* FIQ mode */
2976717Sgblack@eecs.umich.edu    INTREG_R0_FIQ = INTREG_R0,
2986717Sgblack@eecs.umich.edu    INTREG_R1_FIQ = INTREG_R1,
2996717Sgblack@eecs.umich.edu    INTREG_R2_FIQ = INTREG_R2,
3006717Sgblack@eecs.umich.edu    INTREG_R3_FIQ = INTREG_R3,
3016717Sgblack@eecs.umich.edu    INTREG_R4_FIQ = INTREG_R4,
3026717Sgblack@eecs.umich.edu    INTREG_R5_FIQ = INTREG_R5,
3036717Sgblack@eecs.umich.edu    INTREG_R6_FIQ = INTREG_R6,
3046717Sgblack@eecs.umich.edu    INTREG_R7_FIQ = INTREG_R7,
3056717Sgblack@eecs.umich.edu    INTREG_PC_FIQ = INTREG_PC,
3068902Sandreas.hansson@arm.com    INTREG_R15_FIQ = INTREG_R15
3076717Sgblack@eecs.umich.edu};
3086717Sgblack@eecs.umich.edu
3096717Sgblack@eecs.umich.edutypedef IntRegIndex IntRegMap[NUM_ARCH_INTREGS];
3106717Sgblack@eecs.umich.edu
31110037SARM gem5 Developersconst IntRegMap IntReg64Map = {
31210037SARM gem5 Developers    INTREG_R0,      INTREG_R1,      INTREG_R2,      INTREG_R3,
31310037SARM gem5 Developers    INTREG_R4,      INTREG_R5,      INTREG_R6,      INTREG_R7,
31410037SARM gem5 Developers    INTREG_R8_USR,  INTREG_R9_USR,  INTREG_R10_USR, INTREG_R11_USR,
31510037SARM gem5 Developers    INTREG_R12_USR, INTREG_R13_USR, INTREG_R14_USR, INTREG_R13_HYP,
31610037SARM gem5 Developers    INTREG_R14_IRQ, INTREG_R13_IRQ, INTREG_R14_SVC, INTREG_R13_SVC,
31710037SARM gem5 Developers    INTREG_R14_ABT, INTREG_R13_ABT, INTREG_R14_UND, INTREG_R13_UND,
31810037SARM gem5 Developers    INTREG_R8_FIQ,  INTREG_R9_FIQ,  INTREG_R10_FIQ, INTREG_R11_FIQ,
31910037SARM gem5 Developers    INTREG_R12_FIQ, INTREG_R13_FIQ, INTREG_R14_FIQ, INTREG_ZERO
32010037SARM gem5 Developers};
32110037SARM gem5 Developers
3226717Sgblack@eecs.umich.educonst IntRegMap IntRegUsrMap = {
3236717Sgblack@eecs.umich.edu    INTREG_R0_USR,  INTREG_R1_USR,  INTREG_R2_USR,  INTREG_R3_USR,
3246717Sgblack@eecs.umich.edu    INTREG_R4_USR,  INTREG_R5_USR,  INTREG_R6_USR,  INTREG_R7_USR,
3256717Sgblack@eecs.umich.edu    INTREG_R8_USR,  INTREG_R9_USR,  INTREG_R10_USR, INTREG_R11_USR,
32610037SARM gem5 Developers    INTREG_R12_USR, INTREG_R13_USR, INTREG_R14_USR, INTREG_R15_USR,
32710037SARM gem5 Developers    INTREG_ZERO,    INTREG_ZERO,    INTREG_ZERO,    INTREG_ZERO,
32810037SARM gem5 Developers    INTREG_ZERO,    INTREG_ZERO,    INTREG_ZERO,    INTREG_ZERO,
32910037SARM gem5 Developers    INTREG_ZERO,    INTREG_ZERO,    INTREG_ZERO,    INTREG_ZERO,
33010037SARM gem5 Developers    INTREG_ZERO,    INTREG_ZERO,    INTREG_ZERO,    INTREG_ZERO
3316717Sgblack@eecs.umich.edu};
3326717Sgblack@eecs.umich.edu
3336717Sgblack@eecs.umich.edustatic inline IntRegIndex
3346717Sgblack@eecs.umich.eduINTREG_USR(unsigned index)
3356717Sgblack@eecs.umich.edu{
3366717Sgblack@eecs.umich.edu    assert(index < NUM_ARCH_INTREGS);
3376717Sgblack@eecs.umich.edu    return IntRegUsrMap[index];
3386717Sgblack@eecs.umich.edu}
3396717Sgblack@eecs.umich.edu
34010037SARM gem5 Developersconst IntRegMap IntRegHypMap = {
34110037SARM gem5 Developers    INTREG_R0_HYP,  INTREG_R1_HYP,  INTREG_R2_HYP,  INTREG_R3_HYP,
34210037SARM gem5 Developers    INTREG_R4_HYP,  INTREG_R5_HYP,  INTREG_R6_HYP,  INTREG_R7_HYP,
34310037SARM gem5 Developers    INTREG_R8_HYP,  INTREG_R9_HYP,  INTREG_R10_HYP, INTREG_R11_HYP,
34410037SARM gem5 Developers    INTREG_R12_HYP, INTREG_R13_HYP, INTREG_R14_HYP, INTREG_R15_HYP,
34510037SARM gem5 Developers    INTREG_ZERO,    INTREG_ZERO,    INTREG_ZERO,    INTREG_ZERO,
34610037SARM gem5 Developers    INTREG_ZERO,    INTREG_ZERO,    INTREG_ZERO,    INTREG_ZERO,
34710037SARM gem5 Developers    INTREG_ZERO,    INTREG_ZERO,    INTREG_ZERO,    INTREG_ZERO,
34810037SARM gem5 Developers    INTREG_ZERO,    INTREG_ZERO,    INTREG_ZERO,    INTREG_ZERO
34910037SARM gem5 Developers};
35010037SARM gem5 Developers
35110037SARM gem5 Developersstatic inline IntRegIndex
35210037SARM gem5 DevelopersINTREG_HYP(unsigned index)
35310037SARM gem5 Developers{
35410037SARM gem5 Developers    assert(index < NUM_ARCH_INTREGS);
35510037SARM gem5 Developers    return IntRegHypMap[index];
35610037SARM gem5 Developers}
35710037SARM gem5 Developers
3586717Sgblack@eecs.umich.educonst IntRegMap IntRegSvcMap = {
3596717Sgblack@eecs.umich.edu    INTREG_R0_SVC,  INTREG_R1_SVC,  INTREG_R2_SVC,  INTREG_R3_SVC,
3606717Sgblack@eecs.umich.edu    INTREG_R4_SVC,  INTREG_R5_SVC,  INTREG_R6_SVC,  INTREG_R7_SVC,
3616717Sgblack@eecs.umich.edu    INTREG_R8_SVC,  INTREG_R9_SVC,  INTREG_R10_SVC, INTREG_R11_SVC,
36210037SARM gem5 Developers    INTREG_R12_SVC, INTREG_R13_SVC, INTREG_R14_SVC, INTREG_R15_SVC,
36310037SARM gem5 Developers    INTREG_ZERO,    INTREG_ZERO,    INTREG_ZERO,    INTREG_ZERO,
36410037SARM gem5 Developers    INTREG_ZERO,    INTREG_ZERO,    INTREG_ZERO,    INTREG_ZERO,
36510037SARM gem5 Developers    INTREG_ZERO,    INTREG_ZERO,    INTREG_ZERO,    INTREG_ZERO,
36610037SARM gem5 Developers    INTREG_ZERO,    INTREG_ZERO,    INTREG_ZERO,    INTREG_ZERO
3676717Sgblack@eecs.umich.edu};
3686717Sgblack@eecs.umich.edu
3696717Sgblack@eecs.umich.edustatic inline IntRegIndex
3706717Sgblack@eecs.umich.eduINTREG_SVC(unsigned index)
3716717Sgblack@eecs.umich.edu{
3726717Sgblack@eecs.umich.edu    assert(index < NUM_ARCH_INTREGS);
3736717Sgblack@eecs.umich.edu    return IntRegSvcMap[index];
3746717Sgblack@eecs.umich.edu}
3756717Sgblack@eecs.umich.edu
3766717Sgblack@eecs.umich.educonst IntRegMap IntRegMonMap = {
3776717Sgblack@eecs.umich.edu    INTREG_R0_MON,  INTREG_R1_MON,  INTREG_R2_MON,  INTREG_R3_MON,
3786717Sgblack@eecs.umich.edu    INTREG_R4_MON,  INTREG_R5_MON,  INTREG_R6_MON,  INTREG_R7_MON,
3796717Sgblack@eecs.umich.edu    INTREG_R8_MON,  INTREG_R9_MON,  INTREG_R10_MON, INTREG_R11_MON,
38010037SARM gem5 Developers    INTREG_R12_MON, INTREG_R13_MON, INTREG_R14_MON, INTREG_R15_MON,
38110037SARM gem5 Developers    INTREG_ZERO,    INTREG_ZERO,    INTREG_ZERO,    INTREG_ZERO,
38210037SARM gem5 Developers    INTREG_ZERO,    INTREG_ZERO,    INTREG_ZERO,    INTREG_ZERO,
38310037SARM gem5 Developers    INTREG_ZERO,    INTREG_ZERO,    INTREG_ZERO,    INTREG_ZERO,
38410037SARM gem5 Developers    INTREG_ZERO,    INTREG_ZERO,    INTREG_ZERO,    INTREG_ZERO
3856717Sgblack@eecs.umich.edu};
3866717Sgblack@eecs.umich.edu
3876717Sgblack@eecs.umich.edustatic inline IntRegIndex
3886717Sgblack@eecs.umich.eduINTREG_MON(unsigned index)
3896717Sgblack@eecs.umich.edu{
3906717Sgblack@eecs.umich.edu    assert(index < NUM_ARCH_INTREGS);
3916717Sgblack@eecs.umich.edu    return IntRegMonMap[index];
3926717Sgblack@eecs.umich.edu}
3936717Sgblack@eecs.umich.edu
3946717Sgblack@eecs.umich.educonst IntRegMap IntRegAbtMap = {
3956717Sgblack@eecs.umich.edu    INTREG_R0_ABT,  INTREG_R1_ABT,  INTREG_R2_ABT,  INTREG_R3_ABT,
3966717Sgblack@eecs.umich.edu    INTREG_R4_ABT,  INTREG_R5_ABT,  INTREG_R6_ABT,  INTREG_R7_ABT,
3976717Sgblack@eecs.umich.edu    INTREG_R8_ABT,  INTREG_R9_ABT,  INTREG_R10_ABT, INTREG_R11_ABT,
39810037SARM gem5 Developers    INTREG_R12_ABT, INTREG_R13_ABT, INTREG_R14_ABT, INTREG_R15_ABT,
39910037SARM gem5 Developers    INTREG_ZERO,    INTREG_ZERO,    INTREG_ZERO,    INTREG_ZERO,
40010037SARM gem5 Developers    INTREG_ZERO,    INTREG_ZERO,    INTREG_ZERO,    INTREG_ZERO,
40110037SARM gem5 Developers    INTREG_ZERO,    INTREG_ZERO,    INTREG_ZERO,    INTREG_ZERO,
40210037SARM gem5 Developers    INTREG_ZERO,    INTREG_ZERO,    INTREG_ZERO,    INTREG_ZERO
4036717Sgblack@eecs.umich.edu};
4046717Sgblack@eecs.umich.edu
4056717Sgblack@eecs.umich.edustatic inline IntRegIndex
4066717Sgblack@eecs.umich.eduINTREG_ABT(unsigned index)
4076717Sgblack@eecs.umich.edu{
4086717Sgblack@eecs.umich.edu    assert(index < NUM_ARCH_INTREGS);
4096717Sgblack@eecs.umich.edu    return IntRegAbtMap[index];
4106717Sgblack@eecs.umich.edu}
4116717Sgblack@eecs.umich.edu
4126717Sgblack@eecs.umich.educonst IntRegMap IntRegUndMap = {
4136717Sgblack@eecs.umich.edu    INTREG_R0_UND,  INTREG_R1_UND,  INTREG_R2_UND,  INTREG_R3_UND,
4146717Sgblack@eecs.umich.edu    INTREG_R4_UND,  INTREG_R5_UND,  INTREG_R6_UND,  INTREG_R7_UND,
4156717Sgblack@eecs.umich.edu    INTREG_R8_UND,  INTREG_R9_UND,  INTREG_R10_UND, INTREG_R11_UND,
41610037SARM gem5 Developers    INTREG_R12_UND, INTREG_R13_UND, INTREG_R14_UND, INTREG_R15_UND,
41710037SARM gem5 Developers    INTREG_ZERO,    INTREG_ZERO,    INTREG_ZERO,    INTREG_ZERO,
41810037SARM gem5 Developers    INTREG_ZERO,    INTREG_ZERO,    INTREG_ZERO,    INTREG_ZERO,
41910037SARM gem5 Developers    INTREG_ZERO,    INTREG_ZERO,    INTREG_ZERO,    INTREG_ZERO,
42010037SARM gem5 Developers    INTREG_ZERO,    INTREG_ZERO,    INTREG_ZERO,    INTREG_ZERO
4216717Sgblack@eecs.umich.edu};
4226717Sgblack@eecs.umich.edu
4236717Sgblack@eecs.umich.edustatic inline IntRegIndex
4246717Sgblack@eecs.umich.eduINTREG_UND(unsigned index)
4256717Sgblack@eecs.umich.edu{
4266717Sgblack@eecs.umich.edu    assert(index < NUM_ARCH_INTREGS);
4276717Sgblack@eecs.umich.edu    return IntRegUndMap[index];
4286717Sgblack@eecs.umich.edu}
4296717Sgblack@eecs.umich.edu
4306717Sgblack@eecs.umich.educonst IntRegMap IntRegIrqMap = {
4316717Sgblack@eecs.umich.edu    INTREG_R0_IRQ,  INTREG_R1_IRQ,  INTREG_R2_IRQ,  INTREG_R3_IRQ,
4326717Sgblack@eecs.umich.edu    INTREG_R4_IRQ,  INTREG_R5_IRQ,  INTREG_R6_IRQ,  INTREG_R7_IRQ,
4336717Sgblack@eecs.umich.edu    INTREG_R8_IRQ,  INTREG_R9_IRQ,  INTREG_R10_IRQ, INTREG_R11_IRQ,
43410037SARM gem5 Developers    INTREG_R12_IRQ, INTREG_R13_IRQ, INTREG_R14_IRQ, INTREG_R15_IRQ,
43510037SARM gem5 Developers    INTREG_ZERO,    INTREG_ZERO,    INTREG_ZERO,    INTREG_ZERO,
43610037SARM gem5 Developers    INTREG_ZERO,    INTREG_ZERO,    INTREG_ZERO,    INTREG_ZERO,
43710037SARM gem5 Developers    INTREG_ZERO,    INTREG_ZERO,    INTREG_ZERO,    INTREG_ZERO,
43810037SARM gem5 Developers    INTREG_ZERO,    INTREG_ZERO,    INTREG_ZERO,    INTREG_ZERO
4396717Sgblack@eecs.umich.edu};
4406717Sgblack@eecs.umich.edu
4416717Sgblack@eecs.umich.edustatic inline IntRegIndex
4426717Sgblack@eecs.umich.eduINTREG_IRQ(unsigned index)
4436717Sgblack@eecs.umich.edu{
4446717Sgblack@eecs.umich.edu    assert(index < NUM_ARCH_INTREGS);
4456717Sgblack@eecs.umich.edu    return IntRegIrqMap[index];
4466717Sgblack@eecs.umich.edu}
4476717Sgblack@eecs.umich.edu
4486717Sgblack@eecs.umich.educonst IntRegMap IntRegFiqMap = {
4496717Sgblack@eecs.umich.edu    INTREG_R0_FIQ,  INTREG_R1_FIQ,  INTREG_R2_FIQ,  INTREG_R3_FIQ,
4506717Sgblack@eecs.umich.edu    INTREG_R4_FIQ,  INTREG_R5_FIQ,  INTREG_R6_FIQ,  INTREG_R7_FIQ,
4516717Sgblack@eecs.umich.edu    INTREG_R8_FIQ,  INTREG_R9_FIQ,  INTREG_R10_FIQ, INTREG_R11_FIQ,
45210037SARM gem5 Developers    INTREG_R12_FIQ, INTREG_R13_FIQ, INTREG_R14_FIQ, INTREG_R15_FIQ,
45310037SARM gem5 Developers    INTREG_ZERO,    INTREG_ZERO,    INTREG_ZERO,    INTREG_ZERO,
45410037SARM gem5 Developers    INTREG_ZERO,    INTREG_ZERO,    INTREG_ZERO,    INTREG_ZERO,
45510037SARM gem5 Developers    INTREG_ZERO,    INTREG_ZERO,    INTREG_ZERO,    INTREG_ZERO,
45610037SARM gem5 Developers    INTREG_ZERO,    INTREG_ZERO,    INTREG_ZERO,    INTREG_ZERO
4576717Sgblack@eecs.umich.edu};
4586717Sgblack@eecs.umich.edu
4596717Sgblack@eecs.umich.edustatic inline IntRegIndex
4606717Sgblack@eecs.umich.eduINTREG_FIQ(unsigned index)
4616717Sgblack@eecs.umich.edu{
4626717Sgblack@eecs.umich.edu    assert(index < NUM_ARCH_INTREGS);
4636717Sgblack@eecs.umich.edu    return IntRegFiqMap[index];
4646717Sgblack@eecs.umich.edu}
4656717Sgblack@eecs.umich.edu
4667310Sgblack@eecs.umich.edustatic const unsigned intRegsPerMode = NUM_INTREGS;
4677310Sgblack@eecs.umich.edu
4687310Sgblack@eecs.umich.edustatic inline int
4697310Sgblack@eecs.umich.eduintRegInMode(OperatingMode mode, int reg)
4706726Sgblack@eecs.umich.edu{
4717310Sgblack@eecs.umich.edu    assert(reg < NUM_ARCH_INTREGS);
4727310Sgblack@eecs.umich.edu    return mode * intRegsPerMode + reg;
4736726Sgblack@eecs.umich.edu}
4746726Sgblack@eecs.umich.edu
47510037SARM gem5 Developersstatic inline int
47610037SARM gem5 DevelopersflattenIntRegModeIndex(int reg)
47710037SARM gem5 Developers{
47810037SARM gem5 Developers    int mode = reg / intRegsPerMode;
47910037SARM gem5 Developers    reg = reg % intRegsPerMode;
48010037SARM gem5 Developers    switch (mode) {
48110037SARM gem5 Developers      case MODE_USER:
48210037SARM gem5 Developers      case MODE_SYSTEM:
48310037SARM gem5 Developers        return INTREG_USR(reg);
48410037SARM gem5 Developers      case MODE_FIQ:
48510037SARM gem5 Developers        return INTREG_FIQ(reg);
48610037SARM gem5 Developers      case MODE_IRQ:
48710037SARM gem5 Developers        return INTREG_IRQ(reg);
48810037SARM gem5 Developers      case MODE_SVC:
48910037SARM gem5 Developers        return INTREG_SVC(reg);
49010037SARM gem5 Developers      case MODE_MON:
49110037SARM gem5 Developers        return INTREG_MON(reg);
49210037SARM gem5 Developers      case MODE_ABORT:
49310037SARM gem5 Developers        return INTREG_ABT(reg);
49410037SARM gem5 Developers      case MODE_HYP:
49510037SARM gem5 Developers        return INTREG_HYP(reg);
49610037SARM gem5 Developers      case MODE_UNDEFINED:
49710037SARM gem5 Developers        return INTREG_UND(reg);
49810037SARM gem5 Developers      default:
49910037SARM gem5 Developers        panic("%d: Flattening into an unknown mode: reg:%#x mode:%#x\n",
50010037SARM gem5 Developers                curTick(), reg, mode);
50110037SARM gem5 Developers    }
50210037SARM gem5 Developers}
50310037SARM gem5 Developers
50410037SARM gem5 Developers
50510037SARM gem5 Developersstatic inline IntRegIndex
50610037SARM gem5 DevelopersmakeSP(IntRegIndex reg)
50710037SARM gem5 Developers{
50810037SARM gem5 Developers    if (reg == INTREG_X31)
50910037SARM gem5 Developers        reg = INTREG_SPX;
51010037SARM gem5 Developers    return reg;
51110037SARM gem5 Developers}
51210037SARM gem5 Developers
51310037SARM gem5 Developers
51410037SARM gem5 Developersstatic inline bool
51510037SARM gem5 DevelopersisSP(IntRegIndex reg)
51610037SARM gem5 Developers{
51710037SARM gem5 Developers    return reg == INTREG_SPX;
51810037SARM gem5 Developers}
51910037SARM gem5 Developers
5206717Sgblack@eecs.umich.edu}
5216717Sgblack@eecs.umich.edu
5226717Sgblack@eecs.umich.edu#endif
523