From 973bbe530e3d9d2233b3d613d396402a07ec7a79 Mon Sep 17 00:00:00 2001 From: gocha Date: Tue, 8 Sep 2009 04:29:22 +0000 Subject: [PATCH] 0.9.4+: port r2844 from trunk --- src/armcpu.cpp | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/armcpu.cpp b/src/armcpu.cpp index 757024471..674f450ec 100644 --- a/src/armcpu.cpp +++ b/src/armcpu.cpp @@ -499,7 +499,8 @@ bool fixCycleCount = false; template u32 armcpu_exec() { - u32 c = fixCycleCount ? 0 : 1; + u32 cFetch = fixCycleCount ? 0 : 1; + u32 cExecute = 0; //this assert is annoying. but sometimes it is handy. //assert(ARMPROC.instruct_adr!=0x00000000); @@ -513,10 +514,10 @@ u32 armcpu_exec() armcpu_irqException( &ARMPROC); } - c += armcpu_prefetch(&ARMPROC); + cFetch += armcpu_prefetch(&ARMPROC); if ( ARMPROC.stalled) { - return c; + return cFetch; //std::max(cFetch, cExecute); } #endif @@ -530,29 +531,28 @@ u32 armcpu_exec() des_arm_instructions_set[INSTRUCTION_INDEX(ARMPROC.instruction)](ARMPROC.instruct_adr,ARMPROC.instruction,txt); printf("%X: %X - %s\n", ARMPROC.instruct_adr,ARMPROC.instruction, txt); #endif - c += arm_instructions_set_0[INSTRUCTION_INDEX(ARMPROC.instruction)](); + cExecute += arm_instructions_set_0[INSTRUCTION_INDEX(ARMPROC.instruction)](); } else - c += arm_instructions_set_1[INSTRUCTION_INDEX(ARMPROC.instruction)](); + cExecute += arm_instructions_set_1[INSTRUCTION_INDEX(ARMPROC.instruction)](); } else if (fixCycleCount) - c++; + cExecute++; // If condition=false: 1S cycle #ifdef GDB_STUB - if ( ARMPROC.post_ex_fn != NULL) { - /* call the external post execute function */ - ARMPROC.post_ex_fn( ARMPROC.post_ex_fn_data, - ARMPROC.instruct_adr, 0); - } + if ( ARMPROC.post_ex_fn != NULL) { + /* call the external post execute function */ + ARMPROC.post_ex_fn(ARMPROC.post_ex_fn_data, ARMPROC.instruct_adr, 0); + } #else - c += armcpu_prefetch(); + cFetch += armcpu_prefetch(); #endif - return c; + return fixCycleCount ? std::max(cFetch, cExecute) : (cFetch + cExecute); } if(PROCNUM==0) - c += thumb_instructions_set_0[ARMPROC.instruction>>6](); + cExecute += thumb_instructions_set_0[ARMPROC.instruction>>6](); else - c += thumb_instructions_set_1[ARMPROC.instruction>>6](); + cExecute += thumb_instructions_set_1[ARMPROC.instruction>>6](); #ifdef GDB_STUB if ( ARMPROC.post_ex_fn != NULL) { @@ -560,9 +560,9 @@ u32 armcpu_exec() ARMPROC.post_ex_fn( ARMPROC.post_ex_fn_data, ARMPROC.instruct_adr, 1); } #else - c += armcpu_prefetch(); + cFetch += armcpu_prefetch(); #endif - return c; + return fixCycleCount ? std::max(cFetch, cExecute) : (cFetch + cExecute); } //these templates needed to be instantiated manually