diff options
author | Andreas Sandberg <Andreas.Sandberg@ARM.com> | 2013-01-07 13:05:44 -0500 |
---|---|---|
committer | Andreas Sandberg <Andreas.Sandberg@ARM.com> | 2013-01-07 13:05:44 -0500 |
commit | 38925ff62126e43ea3d44ace39d908ba38dfc1af (patch) | |
tree | 8c0b37285a3751181aa69f470eb09421f6fc8c5d /src/arch/arm/utility.cc | |
parent | a7e0cbeb36394eec3960dc0e2fb15377880e9e98 (diff) | |
download | gem5-38925ff62126e43ea3d44ace39d908ba38dfc1af.tar.xz |
arm: Remove the register mapping hack used when copying TCs
In order to see all registers independent of the current CPU mode, the
ARM architecture model uses the magic MISCREG_CPSR_MODE register to
change the register mappings without actually updating the CPU
mode. This hack is no longer needed since the thread context now
provides a flat interface to the register file. This patch replaces
the CPSR_MODE hack with the flat register interface.
Diffstat (limited to 'src/arch/arm/utility.cc')
-rw-r--r-- | src/arch/arm/utility.cc | 24 |
1 files changed, 6 insertions, 18 deletions
diff --git a/src/arch/arm/utility.cc b/src/arch/arm/utility.cc index 71ad21e1e..776c1ae82 100644 --- a/src/arch/arm/utility.cc +++ b/src/arch/arm/utility.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2010 ARM Limited + * Copyright (c) 2009-2012 ARM Limited * All rights reserved. * * The license below extends only to copyright in the software and shall @@ -127,25 +127,13 @@ skipFunction(ThreadContext *tc) void copyRegs(ThreadContext *src, ThreadContext *dest) { - int i; + for (int i = 0; i < TheISA::NumIntRegs; i++) + dest->setIntRegFlat(i, src->readIntRegFlat(i)); - int saved_mode = ((CPSR)src->readMiscReg(MISCREG_CPSR)).mode; + for (int i = 0; i < TheISA::NumFloatRegs; i++) + dest->setFloatRegFlat(i, src->readFloatRegFlat(i)); - // Make sure we're in user mode, so we can easily see all the registers - // in the copy loop - src->setMiscReg(MISCREG_CPSR_MODE, MODE_USER); - dest->setMiscReg(MISCREG_CPSR_MODE, MODE_USER); - - for(i = 0; i < TheISA::NumIntRegs; i++) - dest->setIntReg(i, src->readIntReg(i)); - - // Restore us back to the old mode - src->setMiscReg(MISCREG_CPSR_MODE, saved_mode); - dest->setMiscReg(MISCREG_CPSR_MODE, saved_mode); - - for(i = 0; i < TheISA::NumFloatRegs; i++) - dest->setFloatReg(i, src->readFloatReg(i)); - for(i = 0; i < TheISA::NumMiscRegs; i++) + for (int i = 0; i < TheISA::NumMiscRegs; i++) dest->setMiscRegNoEffect(i, src->readMiscRegNoEffect(i)); // setMiscReg "with effect" will set the misc register mapping correctly. |