revision 956:4c1ed9e03985
summary |
tree |
shortlog |
changelog |
graph |
changeset |
raw | bz2 | zip | gz changeset | 956:4c1ed9e03985 |
parent | 955:e289b49c28f1 |
child | 957:0f6131f6cc3a |
author | nkeynes |
date | Wed Jan 14 00:09:44 2009 +0000 (15 years ago) |
Exit immediately on an unconditional exception - makes those blocks a little simpler and shorter
src/sh4/ia32abi.h | view | annotate | diff | log | ||
src/sh4/sh4x86.in | view | annotate | diff | log |
1.1 --- a/src/sh4/ia32abi.h Tue Jan 13 23:58:36 2009 +00001.2 +++ b/src/sh4/ia32abi.h Wed Jan 14 00:09:44 2009 +00001.3 @@ -266,6 +266,28 @@1.4 }1.6 /**1.7 + * Exit unconditionally with a general exception1.8 + */1.9 +void exit_block_exc( int code, sh4addr_t pc )1.10 +{1.11 + load_imm32( R_ECX, pc - sh4_x86.block_start_pc ); // 51.12 + ADD_r32_sh4r( R_ECX, R_PC );1.13 + load_imm32( R_ECX, ((pc - sh4_x86.block_start_pc)>>1)*sh4_cpu_period ); // 51.14 + ADD_r32_sh4r( R_ECX, REG_OFFSET(slice_cycle) ); // 61.15 + load_imm32( R_EAX, code );1.16 + call_func1( sh4_raise_exception, R_EAX );1.17 +1.18 + load_spreg( R_EAX, R_PC );1.19 + if( sh4_x86.tlb_on ) {1.20 + call_func1(xlat_get_code_by_vma,R_EAX);1.21 + } else {1.22 + call_func1(xlat_get_code,R_EAX);1.23 + }1.24 +1.25 + exit_block();1.26 +}1.27 +1.28 +/**1.29 * Write the block trailer (exception handling block)1.30 */1.31 void sh4_translate_end_block( sh4addr_t pc ) {
2.1 --- a/src/sh4/sh4x86.in Tue Jan 13 23:58:36 2009 +00002.2 +++ b/src/sh4/sh4x86.in Wed Jan 14 00:09:44 2009 +00002.3 @@ -241,10 +241,11 @@2.4 #define check_priv( ) \2.5 if( (sh4r.xlat_sh4_mode & SR_MD) == 0 ) { \2.6 if( sh4_x86.in_delay_slot ) { \2.7 - JMP_exc(EXC_SLOT_ILLEGAL); \2.8 + exit_block_exc(EXC_SLOT_ILLEGAL, (pc-2) ); \2.9 } else { \2.10 - JMP_exc(EXC_ILLEGAL ); \2.11 + exit_block_exc(EXC_ILLEGAL, pc); \2.12 } \2.13 + sh4_x86.branch_taken = TRUE; \2.14 sh4_x86.in_delay_slot = DELAY_NONE; \2.15 return 2; \2.16 }2.17 @@ -313,7 +314,7 @@2.18 #define MEM_WRITE_LONG( addr_reg, value_reg ) decode_address(addr_reg); _CALL_WRITE(addr_reg, value_reg, write_long)2.19 #define MEM_PREFETCH( addr_reg ) decode_address(addr_reg); _CALL_READ(addr_reg, prefetch)2.21 -#define SLOTILLEGAL() JMP_exc(EXC_SLOT_ILLEGAL); sh4_x86.in_delay_slot = DELAY_NONE; return 2;2.22 +#define SLOTILLEGAL() exit_block_exc(EXC_SLOT_ILLEGAL, pc-2); sh4_x86.in_delay_slot = DELAY_NONE; return 2;2.24 /****** Import appropriate calling conventions ******/2.25 #if SIZEOF_VOID_P == 82.26 @@ -1743,9 +1744,9 @@2.27 UNDEF {:2.28 COUNT_INST(I_UNDEF);2.29 if( sh4_x86.in_delay_slot ) {2.30 - SLOTILLEGAL();2.31 + exit_block_exc(EXC_SLOT_ILLEGAL, pc-2);2.32 } else {2.33 - JMP_exc(EXC_ILLEGAL);2.34 + exit_block_exc(EXC_ILLEGAL, pc);2.35 return 2;2.36 }2.37 :}
.