arm_interface: Support retrieval/storage to CP15 registers

This commit is contained in:
Lioncash 2015-04-06 12:57:49 -04:00
parent b7b8b67620
commit c3ffe8f9c3
3 changed files with 25 additions and 0 deletions

View file

@ -6,6 +6,7 @@
#include "common/common.h" #include "common/common.h"
#include "common/common_types.h" #include "common/common_types.h"
#include "core/arm/skyeye_common/arm_regformat.h"
namespace Core { namespace Core {
struct ThreadContext; struct ThreadContext;
@ -73,6 +74,20 @@ public:
*/ */
virtual void SetCPSR(u32 cpsr) = 0; virtual void SetCPSR(u32 cpsr) = 0;
/**
* Gets the value stored in a CP15 register.
* @param reg The CP15 register to retrieve the value from.
* @return the value stored in the given CP15 register.
*/
virtual u32 GetCP15Register(CP15Register reg) = 0;
/**
* Stores the given value into the indicated CP15 register.
* @param reg The CP15 register to store the value into.
* @param value The value to store into the CP15 register.
*/
virtual void SetCP15Register(CP15Register reg, u32 value) = 0;
/** /**
* Advance the CPU core by the specified number of ticks (e.g. to simulate CPU execution time) * Advance the CPU core by the specified number of ticks (e.g. to simulate CPU execution time)
* @param ticks Number of ticks to advance the CPU core * @param ticks Number of ticks to advance the CPU core

View file

@ -68,6 +68,14 @@ void ARM_DynCom::SetCPSR(u32 cpsr) {
state->Cpsr = cpsr; state->Cpsr = cpsr;
} }
u32 ARM_DynCom::GetCP15Register(CP15Register reg) {
return state->CP15[reg];
}
void ARM_DynCom::SetCP15Register(CP15Register reg, u32 value) {
state->CP15[reg] = value;
}
void ARM_DynCom::AddTicks(u64 ticks) { void ARM_DynCom::AddTicks(u64 ticks) {
down_count -= ticks; down_count -= ticks;
if (down_count < 0) if (down_count < 0)

View file

@ -22,6 +22,8 @@ public:
void SetReg(int index, u32 value) override; void SetReg(int index, u32 value) override;
u32 GetCPSR() const override; u32 GetCPSR() const override;
void SetCPSR(u32 cpsr) override; void SetCPSR(u32 cpsr) override;
u32 GetCP15Register(CP15Register reg) override;
void SetCP15Register(CP15Register reg, u32 value) override;
void AddTicks(u64 ticks) override; void AddTicks(u64 ticks) override;