summaryrefslogtreecommitdiff
path: root/src/arch/arm/isa.hh
diff options
context:
space:
mode:
authorGabe Black <gblack@eecs.umich.edu>2010-06-02 12:58:11 -0500
committerGabe Black <gblack@eecs.umich.edu>2010-06-02 12:58:11 -0500
commita5ea52bb456951a7c8bdecfe251ca8a093bcfb2f (patch)
treea09d91744c7ab8a5a390bca082a3ed5e8e9744dd /src/arch/arm/isa.hh
parent698ee26c6b5b3691069024c43088d4c1efc34656 (diff)
downloadgem5-a5ea52bb456951a7c8bdecfe251ca8a093bcfb2f.tar.xz
ARM: Allow flattening into any mode.
Diffstat (limited to 'src/arch/arm/isa.hh')
-rw-r--r--src/arch/arm/isa.hh24
1 files changed, 21 insertions, 3 deletions
diff --git a/src/arch/arm/isa.hh b/src/arch/arm/isa.hh
index a9c404351..a7bb1cc3e 100644
--- a/src/arch/arm/isa.hh
+++ b/src/arch/arm/isa.hh
@@ -270,9 +270,27 @@ namespace ArmISA
} else if (reg < NUM_INTREGS) {
return reg;
} else {
- reg -= NUM_INTREGS;
- assert(reg < NUM_ARCH_INTREGS);
- return reg;
+ int mode = reg / intRegsPerMode;
+ reg = reg % intRegsPerMode;
+ switch (mode) {
+ case MODE_USER:
+ case MODE_SYSTEM:
+ return INTREG_USR(reg);
+ case MODE_FIQ:
+ return INTREG_FIQ(reg);
+ case MODE_IRQ:
+ return INTREG_IRQ(reg);
+ case MODE_SVC:
+ return INTREG_SVC(reg);
+ case MODE_MON:
+ return INTREG_MON(reg);
+ case MODE_ABORT:
+ return INTREG_ABT(reg);
+ case MODE_UNDEFINED:
+ return INTREG_UND(reg);
+ default:
+ panic("Flattening into an unknown mode.\n");
+ }
}
}