diff options
| author | 2014-04-08 20:38:33 -0400 | |
|---|---|---|
| committer | 2014-04-08 20:38:33 -0400 | |
| commit | d0674cc98bfa5729168274cde62a4e69343f8524 (patch) | |
| tree | 78f40a0cf1afa17bbd3aac9e19e33557ea7444da /src | |
| parent | fixed license headers in citra project (diff) | |
| download | yuzu-d0674cc98bfa5729168274cde62a4e69343f8524.tar.gz yuzu-d0674cc98bfa5729168274cde62a4e69343f8524.tar.xz yuzu-d0674cc98bfa5729168274cde62a4e69343f8524.zip | |
fixed licensing and updated code style naming for arm_interface/arm_interpreter frontend module
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/arm/arm_interface.h | 20 | ||||
| -rw-r--r-- | src/core/arm/interpreter/arm_interpreter.cpp | 93 | ||||
| -rw-r--r-- | src/core/arm/interpreter/arm_interpreter.h | 38 |
3 files changed, 57 insertions, 94 deletions
diff --git a/src/core/arm/arm_interface.h b/src/core/arm/arm_interface.h index e5df2d971..dafde8368 100644 --- a/src/core/arm/arm_interface.h +++ b/src/core/arm/arm_interface.h | |||
| @@ -11,7 +11,7 @@ | |||
| 11 | class ARM_Interface { | 11 | class ARM_Interface { |
| 12 | public: | 12 | public: |
| 13 | ARM_Interface() { | 13 | ARM_Interface() { |
| 14 | num_instructions_ = 0; | 14 | m_num_instructions = 0; |
| 15 | } | 15 | } |
| 16 | 16 | ||
| 17 | ~ARM_Interface() { | 17 | ~ARM_Interface() { |
| @@ -20,7 +20,7 @@ public: | |||
| 20 | /// Step CPU by one instruction | 20 | /// Step CPU by one instruction |
| 21 | void Step() { | 21 | void Step() { |
| 22 | ExecuteInstruction(); | 22 | ExecuteInstruction(); |
| 23 | num_instructions_++; | 23 | m_num_instructions++; |
| 24 | } | 24 | } |
| 25 | 25 | ||
| 26 | /** | 26 | /** |
| @@ -33,36 +33,38 @@ public: | |||
| 33 | * Get the current Program Counter | 33 | * Get the current Program Counter |
| 34 | * @return Returns current PC | 34 | * @return Returns current PC |
| 35 | */ | 35 | */ |
| 36 | virtual u32 PC() = 0; | 36 | virtual u32 GetPC() const = 0; |
| 37 | 37 | ||
| 38 | /** | 38 | /** |
| 39 | * Get an ARM register | 39 | * Get an ARM register |
| 40 | * @param index Register index (0-15) | 40 | * @param index Register index (0-15) |
| 41 | * @return Returns the value in the register | 41 | * @return Returns the value in the register |
| 42 | */ | 42 | */ |
| 43 | virtual u32 Reg(int index) = 0; | 43 | virtual u32 GetReg(int index) const = 0; |
| 44 | 44 | ||
| 45 | /** | 45 | /** |
| 46 | * Get the current CPSR register | 46 | * Get the current CPSR register |
| 47 | * @return Returns the value of the CPSR register | 47 | * @return Returns the value of the CPSR register |
| 48 | */ | 48 | */ |
| 49 | virtual u32 CPSR() = 0; | 49 | virtual u32 GetCPSR() const = 0; |
| 50 | 50 | ||
| 51 | /** | 51 | /** |
| 52 | * Returns the number of clock ticks since the last rese | 52 | * Returns the number of clock ticks since the last rese |
| 53 | * @return Returns number of clock ticks | 53 | * @return Returns number of clock ticks |
| 54 | */ | 54 | */ |
| 55 | virtual u64 GetTicks() = 0; | 55 | virtual u64 GetTicks() const = 0; |
| 56 | 56 | ||
| 57 | /// Getter for num_instructions_ | 57 | /// Getter for m_num_instructions |
| 58 | u64 num_instructions() { return num_instructions_; } | 58 | u64 GetNumInstructions() { |
| 59 | return m_num_instructions; | ||
| 60 | } | ||
| 59 | 61 | ||
| 60 | private: | 62 | private: |
| 61 | 63 | ||
| 62 | /// Execture next instruction | 64 | /// Execture next instruction |
| 63 | virtual void ExecuteInstruction() = 0; | 65 | virtual void ExecuteInstruction() = 0; |
| 64 | 66 | ||
| 65 | u64 num_instructions_; ///< Number of instructions executed | 67 | u64 m_num_instructions; ///< Number of instructions executed |
| 66 | 68 | ||
| 67 | DISALLOW_COPY_AND_ASSIGN(ARM_Interface); | 69 | DISALLOW_COPY_AND_ASSIGN(ARM_Interface); |
| 68 | }; | 70 | }; |
diff --git a/src/core/arm/interpreter/arm_interpreter.cpp b/src/core/arm/interpreter/arm_interpreter.cpp index a74aa26cc..81f38f016 100644 --- a/src/core/arm/interpreter/arm_interpreter.cpp +++ b/src/core/arm/interpreter/arm_interpreter.cpp | |||
| @@ -1,26 +1,6 @@ | |||
| 1 | /** | 1 | // Copyright 2014 Citra Emulator Project |
| 2 | * Copyright (C) 2013 Citrus Emulator | 2 | // Licensed under GPLv2 |
| 3 | * | 3 | // Refer to the license.txt file included. |
| 4 | * @file arm_interpreter.h | ||
| 5 | * @author bunnei | ||
| 6 | * @date 2014-04-04 | ||
| 7 | * @brief ARM interface instance for SkyEye interprerer | ||
| 8 | * | ||
| 9 | * @section LICENSE | ||
| 10 | * This program is free software; you can redistribute it and/or | ||
| 11 | * modify it under the terms of the GNU General Public License as | ||
| 12 | * published by the Free Software Foundation; either version 2 of | ||
| 13 | * the License, or (at your option) any later version. | ||
| 14 | * | ||
| 15 | * This program is distributed in the hope that it will be useful, but | ||
| 16 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 18 | * General Public License for more details at | ||
| 19 | * http://www.gnu.org/copyleft/gpl.html | ||
| 20 | * | ||
| 21 | * Official project repository can be found at: | ||
| 22 | * http://code.google.com/p/gekko-gc-emu/ | ||
| 23 | */ | ||
| 24 | 4 | ||
| 25 | #include "arm_interpreter.h" | 5 | #include "arm_interpreter.h" |
| 26 | 6 | ||
| @@ -29,58 +9,61 @@ const static cpu_config_t s_arm11_cpu_info = { | |||
| 29 | }; | 9 | }; |
| 30 | 10 | ||
| 31 | ARM_Interpreter::ARM_Interpreter() { | 11 | ARM_Interpreter::ARM_Interpreter() { |
| 32 | 12 | m_state = new ARMul_State; | |
| 33 | state = new ARMul_State; | ||
| 34 | 13 | ||
| 35 | ARMul_EmulateInit(); | 14 | ARMul_EmulateInit(); |
| 36 | ARMul_NewState(state); | 15 | ARMul_NewState(m_state); |
| 37 | 16 | ||
| 38 | state->abort_model = 0; | 17 | m_state->abort_model = 0; |
| 39 | state->cpu = (cpu_config_t*)&s_arm11_cpu_info; | 18 | m_state->cpu = (cpu_config_t*)&s_arm11_cpu_info; |
| 40 | state->bigendSig = LOW; | 19 | m_state->bigendSig = LOW; |
| 41 | 20 | ||
| 42 | ARMul_SelectProcessor(state, ARM_v6_Prop | ARM_v5_Prop | ARM_v5e_Prop); | 21 | ARMul_SelectProcessor(m_state, ARM_v6_Prop | ARM_v5_Prop | ARM_v5e_Prop); |
| 43 | state->lateabtSig = LOW; | 22 | m_state->lateabtSig = LOW; |
| 44 | mmu_init(state); | 23 | mmu_init(m_state); |
| 45 | 24 | ||
| 46 | // Reset the core to initial state | 25 | // Reset the core to initial state |
| 47 | ARMul_Reset(state); | 26 | ARMul_Reset(m_state); |
| 48 | state->NextInstr = 0; | 27 | m_state->NextInstr = 0; |
| 49 | state->Emulate = 3; | 28 | m_state->Emulate = 3; |
| 50 | 29 | ||
| 51 | state->pc = state->Reg[15] = 0x00000000; | 30 | m_state->pc = m_state->Reg[15] = 0x00000000; |
| 52 | state->Reg[13] = 0x10000000; // Set stack pointer to the top of the stack | 31 | m_state->Reg[13] = 0x10000000; // Set stack pointer to the top of the stack |
| 53 | } | 32 | } |
| 54 | 33 | ||
| 55 | void ARM_Interpreter::SetPC(u32 pc) { | 34 | void ARM_Interpreter::SetPC(u32 pc) { |
| 56 | state->pc = state->Reg[15] = pc; | 35 | m_state->pc = m_state->Reg[15] = pc; |
| 36 | } | ||
| 37 | |||
| 38 | u32 ARM_Interpreter::GetPC() const { | ||
| 39 | return m_state->pc; | ||
| 57 | } | 40 | } |
| 58 | 41 | ||
| 59 | u32 ARM_Interpreter::PC() { | 42 | u32 ARM_Interpreter::GetReg(int index) const { |
| 60 | return state->pc; | 43 | return m_state->Reg[index]; |
| 61 | } | 44 | } |
| 62 | 45 | ||
| 63 | u32 ARM_Interpreter::Reg(int index){ | 46 | u32 ARM_Interpreter::GetCPSR() const { |
| 64 | return state->Reg[index]; | 47 | return m_state->Cpsr; |
| 65 | } | 48 | } |
| 66 | 49 | ||
| 67 | u32 ARM_Interpreter::CPSR() { | 50 | u64 ARM_Interpreter::GetTicks() const { |
| 68 | return state->Cpsr; | 51 | return ARMul_Time(m_state); |
| 69 | } | 52 | } |
| 70 | 53 | ||
| 71 | ARM_Interpreter::~ARM_Interpreter() { | 54 | ARM_Interpreter::~ARM_Interpreter() { |
| 72 | delete state; | 55 | delete m_state; |
| 73 | } | 56 | } |
| 74 | 57 | ||
| 75 | void ARM_Interpreter::ExecuteInstruction() { | 58 | void ARM_Interpreter::ExecuteInstruction() { |
| 76 | state->step++; | 59 | m_state->step++; |
| 77 | state->cycle++; | 60 | m_state->cycle++; |
| 78 | state->EndCondition = 0; | 61 | m_state->EndCondition = 0; |
| 79 | state->stop_simulator = 0; | 62 | m_state->stop_simulator = 0; |
| 80 | state->NextInstr = RESUME; | 63 | m_state->NextInstr = RESUME; |
| 81 | state->last_pc = state->Reg[15]; | 64 | m_state->last_pc = m_state->Reg[15]; |
| 82 | state->Reg[15] = ARMul_DoInstr(state); | 65 | m_state->Reg[15] = ARMul_DoInstr(m_state); |
| 83 | state->Cpsr = ((state->Cpsr & 0x0fffffdf) | (state->NFlag << 31) | (state->ZFlag << 30) | | 66 | m_state->Cpsr = ((m_state->Cpsr & 0x0fffffdf) | (m_state->NFlag << 31) | (m_state->ZFlag << 30) | |
| 84 | (state->CFlag << 29) | (state->VFlag << 28) | (state->TFlag << 5)); | 67 | (m_state->CFlag << 29) | (m_state->VFlag << 28) | (m_state->TFlag << 5)); |
| 85 | FLUSHPIPE; | 68 | m_state->NextInstr |= PRIMEPIPE; // Flush pipe |
| 86 | } | 69 | } |
diff --git a/src/core/arm/interpreter/arm_interpreter.h b/src/core/arm/interpreter/arm_interpreter.h index 03b781c6d..932046d9a 100644 --- a/src/core/arm/interpreter/arm_interpreter.h +++ b/src/core/arm/interpreter/arm_interpreter.h | |||
| @@ -1,26 +1,6 @@ | |||
| 1 | /** | 1 | // Copyright 2014 Citra Emulator Project |
| 2 | * Copyright (C) 2013 Citrus Emulator | 2 | // Licensed under GPLv2 |
| 3 | * | 3 | // Refer to the license.txt file included. |
| 4 | * @file arm_interpreter.h | ||
| 5 | * @author bunnei | ||
| 6 | * @date 2014-04-04 | ||
| 7 | * @brief ARM interface instance for SkyEye interprerer | ||
| 8 | * | ||
| 9 | * @section LICENSE | ||
| 10 | * This program is free software; you can redistribute it and/or | ||
| 11 | * modify it under the terms of the GNU General Public License as | ||
| 12 | * published by the Free Software Foundation; either version 2 of | ||
| 13 | * the License, or (at your option) any later version. | ||
| 14 | * | ||
| 15 | * This program is distributed in the hope that it will be useful, but | ||
| 16 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 18 | * General Public License for more details at | ||
| 19 | * http://www.gnu.org/copyleft/gpl.html | ||
| 20 | * | ||
| 21 | * Official project repository can be found at: | ||
| 22 | * http://code.google.com/p/gekko-gc-emu/ | ||
| 23 | */ | ||
| 24 | 4 | ||
| 25 | #pragma once | 5 | #pragma once |
| 26 | 6 | ||
| @@ -39,18 +19,16 @@ public: | |||
| 39 | 19 | ||
| 40 | void SetPC(u32 pc); | 20 | void SetPC(u32 pc); |
| 41 | 21 | ||
| 42 | u32 PC(); | 22 | u32 GetPC() const; |
| 43 | 23 | ||
| 44 | u32 Reg(int index); | 24 | u32 GetReg(int index) const; |
| 45 | 25 | ||
| 46 | u32 CPSR(); | 26 | u32 GetCPSR() const; |
| 47 | 27 | ||
| 48 | u64 GetTicks() { | 28 | u64 GetTicks() const; |
| 49 | return ARMul_Time(state); | ||
| 50 | } | ||
| 51 | 29 | ||
| 52 | private: | 30 | private: |
| 53 | ARMul_State* state; | 31 | ARMul_State* m_state; |
| 54 | 32 | ||
| 55 | DISALLOW_COPY_AND_ASSIGN(ARM_Interpreter); | 33 | DISALLOW_COPY_AND_ASSIGN(ARM_Interpreter); |
| 56 | }; | 34 | }; |