Search
lxdream.org :: lxdream/src/sh4/ia32abi.h :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/sh4/ia32abi.h
changeset 559:06714bc64271
prev539:75f3e594d4a7
next561:533f6b478071
author nkeynes
date Tue Jan 01 04:58:57 2008 +0000 (12 years ago)
branchlxdream-mmu
permissions -rw-r--r--
last change Commit first pass at full TLB support - still needs a lot more work
file annotate diff log raw
1.1 --- a/src/sh4/ia32abi.h Wed Nov 21 11:40:15 2007 +0000
1.2 +++ b/src/sh4/ia32abi.h Tue Jan 01 04:58:57 2008 +0000
1.3 @@ -153,26 +153,9 @@
1.4 exit_block( pc, pc );
1.5 }
1.6 if( sh4_x86.backpatch_posn != 0 ) {
1.7 + unsigned int i;
1.8 + // Raise exception
1.9 uint8_t *end_ptr = xlat_output;
1.10 - // Exception termination. Jump block for various exception codes:
1.11 - PUSH_imm32( EXC_DATA_ADDR_READ );
1.12 - JMP_rel8( 33, target1 );
1.13 - PUSH_imm32( EXC_DATA_ADDR_WRITE );
1.14 - JMP_rel8( 26, target2 );
1.15 - PUSH_imm32( EXC_ILLEGAL );
1.16 - JMP_rel8( 19, target3 );
1.17 - PUSH_imm32( EXC_SLOT_ILLEGAL );
1.18 - JMP_rel8( 12, target4 );
1.19 - PUSH_imm32( EXC_FPU_DISABLED );
1.20 - JMP_rel8( 5, target5 );
1.21 - PUSH_imm32( EXC_SLOT_FPU_DISABLED );
1.22 - // target
1.23 - JMP_TARGET(target1);
1.24 - JMP_TARGET(target2);
1.25 - JMP_TARGET(target3);
1.26 - JMP_TARGET(target4);
1.27 - JMP_TARGET(target5);
1.28 - // Raise exception
1.29 load_spreg( R_ECX, REG_OFFSET(pc) );
1.30 ADD_r32_r32( R_EDX, R_ECX );
1.31 ADD_r32_r32( R_EDX, R_ECX );
1.32 @@ -188,7 +171,34 @@
1.33 POP_r32(R_EBP);
1.34 RET();
1.35
1.36 - sh4_x86_do_backpatch( end_ptr );
1.37 + // Exception already raised - just cleanup
1.38 + uint8_t *preexc_ptr = xlat_output;
1.39 + load_imm32( R_ECX, sh4_x86.block_start_pc );
1.40 + ADD_r32_r32( R_EDX, R_ECX );
1.41 + ADD_r32_r32( R_EDX, R_ECX );
1.42 + store_spreg( R_ECX, REG_OFFSET(spc) );
1.43 + MOV_moff32_EAX( &sh4_cpu_period );
1.44 + MUL_r32( R_EDX );
1.45 + ADD_r32_sh4r( R_EAX, REG_OFFSET(slice_cycle) );
1.46 + load_spreg( R_EAX, REG_OFFSET(pc) );
1.47 + call_func1(xlat_get_code,R_EAX);
1.48 + POP_r32(R_EBP);
1.49 + RET();
1.50 +
1.51 + for( i=0; i< sh4_x86.backpatch_posn; i++ ) {
1.52 + *sh4_x86.backpatch_list[i].fixup_addr =
1.53 + xlat_output - ((uint8_t *)sh4_x86.backpatch_list[i].fixup_addr) - 4;
1.54 + if( sh4_x86.backpatch_list[i].exc_code == -1 ) {
1.55 + load_imm32( R_EDX, sh4_x86.backpatch_list[i].fixup_icount );
1.56 + int rel = preexc_ptr - xlat_output;
1.57 + JMP_rel(rel);
1.58 + } else {
1.59 + PUSH_imm32( sh4_x86.backpatch_list[i].exc_code );
1.60 + load_imm32( R_EDX, sh4_x86.backpatch_list[i].fixup_icount );
1.61 + int rel = end_ptr - xlat_output;
1.62 + JMP_rel(rel);
1.63 + }
1.64 + }
1.65 }
1.66 }
1.67
.