summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar archshift2016-06-10 18:50:47 -0700
committerGravatar archshift2016-06-12 00:31:52 -0700
commit54b5178f6cabaac8d7dd890391d06df0990eeea2 (patch)
tree723ab1deddf9d9d47ba64a03d7169eb593b49e37
parentarm_dyncom_interpreter: Add specialized GetAddressingOpLoadStoreT func (diff)
downloadyuzu-54b5178f6cabaac8d7dd890391d06df0990eeea2.tar.gz
yuzu-54b5178f6cabaac8d7dd890391d06df0990eeea2.tar.xz
yuzu-54b5178f6cabaac8d7dd890391d06df0990eeea2.zip
arm_dyncom_interpreter: slightly change AllocBuffer to be intuitive
Diffstat (limited to '')
-rw-r--r--src/core/arm/dyncom/arm_dyncom_interpreter.cpp30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/core/arm/dyncom/arm_dyncom_interpreter.cpp b/src/core/arm/dyncom/arm_dyncom_interpreter.cpp
index 7f6cf6e29..68d6572aa 100644
--- a/src/core/arm/dyncom/arm_dyncom_interpreter.cpp
+++ b/src/core/arm/dyncom/arm_dyncom_interpreter.cpp
@@ -7,6 +7,7 @@
7#include <algorithm> 7#include <algorithm>
8#include <cstdio> 8#include <cstdio>
9 9
10#include "common/assert.h"
10#include "common/common_types.h" 11#include "common/common_types.h"
11#include "common/logging/log.h" 12#include "common/logging/log.h"
12#include "common/microprofile.h" 13#include "common/microprofile.h"
@@ -672,19 +673,18 @@ static void LnSWoUB(ScaledRegisterOffset)(ARMul_State* cpu, unsigned int inst, u
672 673
673typedef arm_inst * ARM_INST_PTR; 674typedef arm_inst * ARM_INST_PTR;
674 675
675#define CACHE_BUFFER_SIZE (64 * 1024 * 2000) 676#define TRANS_CACHE_SIZE (64 * 1024 * 2000)
676static char inst_buf[CACHE_BUFFER_SIZE]; 677static char trans_cache_buf[TRANS_CACHE_SIZE];
677static int top = 0; 678static size_t trans_cache_buf_top = 0;
678static inline void *AllocBuffer(unsigned int size) { 679
679 int start = top; 680static void* AllocBuffer(size_t size) {
680 top += size; 681 size_t start = trans_cache_buf_top;
681 if (top > CACHE_BUFFER_SIZE) { 682 trans_cache_buf_top += size;
682 LOG_ERROR(Core_ARM11, "inst_buf is full"); 683 ASSERT_MSG(trans_cache_buf_top <= TRANS_CACHE_SIZE, "Translation cache is full!");
683 CITRA_IGNORE_EXIT(-1); 684 return static_cast<void*>(&trans_cache_buf[start]);
684 }
685 return (void *)&inst_buf[start];
686} 685}
687 686
687
688static shtop_fp_t GetShifterOp(unsigned int inst) { 688static shtop_fp_t GetShifterOp(unsigned int inst) {
689 if (BIT(inst, 25)) { 689 if (BIT(inst, 25)) {
690 return DPO(Immediate); 690 return DPO(Immediate);
@@ -870,7 +870,7 @@ static int InterpreterTranslateBlock(ARMul_State* cpu, int& bb_start, u32 addr)
870 ARM_INST_PTR inst_base = nullptr; 870 ARM_INST_PTR inst_base = nullptr;
871 TransExtData ret = TransExtData::NON_BRANCH; 871 TransExtData ret = TransExtData::NON_BRANCH;
872 int size = 0; // instruction size of basic block 872 int size = 0; // instruction size of basic block
873 bb_start = top; 873 bb_start = trans_cache_buf_top;
874 874
875 u32 phys_addr = addr; 875 u32 phys_addr = addr;
876 u32 pc_start = cpu->Reg[15]; 876 u32 pc_start = cpu->Reg[15];
@@ -897,7 +897,7 @@ static int InterpreterTranslateSingle(ARMul_State* cpu, int& bb_start, u32 addr)
897 MICROPROFILE_SCOPE(DynCom_Decode); 897 MICROPROFILE_SCOPE(DynCom_Decode);
898 898
899 ARM_INST_PTR inst_base = nullptr; 899 ARM_INST_PTR inst_base = nullptr;
900 bb_start = top; 900 bb_start = trans_cache_buf_top;
901 901
902 u32 phys_addr = addr; 902 u32 phys_addr = addr;
903 u32 pc_start = cpu->Reg[15]; 903 u32 pc_start = cpu->Reg[15];
@@ -951,7 +951,7 @@ unsigned InterpreterMainLoop(ARMul_State* cpu) {
951 #define SHIFTER_OPERAND inst_cream->shtop_func(cpu, inst_cream->shifter_operand) 951 #define SHIFTER_OPERAND inst_cream->shtop_func(cpu, inst_cream->shifter_operand)
952 952
953 #define FETCH_INST if (inst_base->br != TransExtData::NON_BRANCH) goto DISPATCH; \ 953 #define FETCH_INST if (inst_base->br != TransExtData::NON_BRANCH) goto DISPATCH; \
954 inst_base = (arm_inst *)&inst_buf[ptr] 954 inst_base = (arm_inst *)&trans_cache_buf[ptr]
955 955
956 #define INC_PC(l) ptr += sizeof(arm_inst) + l 956 #define INC_PC(l) ptr += sizeof(arm_inst) + l
957 #define INC_PC_STUB ptr += sizeof(arm_inst) 957 #define INC_PC_STUB ptr += sizeof(arm_inst)
@@ -1274,7 +1274,7 @@ unsigned InterpreterMainLoop(ARMul_State* cpu) {
1274 breakpoint_data = GDBStub::GetNextBreakpointFromAddress(cpu->Reg[15], GDBStub::BreakpointType::Execute); 1274 breakpoint_data = GDBStub::GetNextBreakpointFromAddress(cpu->Reg[15], GDBStub::BreakpointType::Execute);
1275 } 1275 }
1276 1276
1277 inst_base = (arm_inst *)&inst_buf[ptr]; 1277 inst_base = (arm_inst *)&trans_cache_buf[ptr];
1278 GOTO_NEXT_INST; 1278 GOTO_NEXT_INST;
1279 } 1279 }
1280 ADC_INST: 1280 ADC_INST: