diff options
| author | 2014-04-08 20:38:33 -0400 | |
|---|---|---|
| committer | 2014-04-08 20:38:33 -0400 | |
| commit | d0674cc98bfa5729168274cde62a4e69343f8524 (patch) | |
| tree | 78f40a0cf1afa17bbd3aac9e19e33557ea7444da /src/core/arm/interpreter | |
| 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/core/arm/interpreter')
| -rw-r--r-- | src/core/arm/interpreter/arm_interpreter.cpp | 93 | ||||
| -rw-r--r-- | src/core/arm/interpreter/arm_interpreter.h | 38 |
2 files changed, 46 insertions, 85 deletions
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 | }; |