X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=libpcsxcore%2Fnew_dynarec%2Flinkage_arm64.S;h=39e95a834fd4eebe068dc71b49e98cc05e9ef5e9;hb=d1150cd66676ce43b8451c65818c2dc3e2f8a1d6;hp=444545ca379f1eb1bb5457dc1b964dc892a4cd93;hpb=3968e69e7fa8f9cb0d44ac79477d5929b9649271;p=pcsx_rearmed.git diff --git a/libpcsxcore/new_dynarec/linkage_arm64.S b/libpcsxcore/new_dynarec/linkage_arm64.S index 444545ca..39e95a83 100644 --- a/libpcsxcore/new_dynarec/linkage_arm64.S +++ b/libpcsxcore/new_dynarec/linkage_arm64.S @@ -24,6 +24,10 @@ #include "assem_arm64.h" #include "linkage_offsets.h" +#if (LO_mem_wtab & 7) +#error misligned pointers +#endif + .bss .align 4 .global dynarec_local @@ -48,7 +52,7 @@ DRC_VAR(pending_exception, 4) DRC_VAR(stop, 4) DRC_VAR(branch_target, 4) DRC_VAR(address, 4) -#DRC_VAR(align0, 16) /* unused/alignment */ +DRC_VAR(hack_addr, 4) DRC_VAR(psxRegs, LO_psxRegs_end - LO_psxRegs) /* psxRegs */ @@ -73,7 +77,7 @@ DRC_VAR(psxH_ptr, 8) DRC_VAR(invc_ptr, 8) DRC_VAR(zeromem_ptr, 8) DRC_VAR(scratch_buf_ptr, 8) -#DRC_VAR(align1, 16) /* unused/alignment */ +DRC_VAR(ram_offset, 8) DRC_VAR(mini_ht, 256) DRC_VAR(restore_candidate, 512) @@ -160,13 +164,13 @@ FUNCTION(cc_interrupt): FUNCTION(fp_exception): mov w2, #0x10000000 0: - ldr w1, [fp, #LO_reg_cop0+48] /* Status */ + ldr w1, [rFP, #LO_reg_cop0+48] /* Status */ mov w3, #0x80000000 - str w0, [fp, #LO_reg_cop0+56] /* EPC */ + str w0, [rFP, #LO_reg_cop0+56] /* EPC */ orr w1, w1, #2 add w2, w2, #0x2c - str w1, [fp, #LO_reg_cop0+48] /* Status */ - str w2, [fp, #LO_reg_cop0+52] /* Cause */ + str w1, [rFP, #LO_reg_cop0+48] /* Status */ + str w2, [rFP, #LO_reg_cop0+52] /* Cause */ add w0, w3, #0x80 bl get_addr_ht br x0 @@ -178,28 +182,37 @@ FUNCTION(fp_exception_ds): .size fp_exception_ds, .-fp_exception_ds .align 2 +FUNCTION(jump_break_ds): + mov w0, #0x24 + mov w1, #1 + b call_psxException +FUNCTION(jump_break): + mov w0, #0x24 + mov w1, #0 + b call_psxException +FUNCTION(jump_syscall_ds): + mov w0, #0x20 + mov w1, #1 + b call_psxException FUNCTION(jump_syscall): - ldr w1, [fp, #LO_reg_cop0+48] /* Status */ - mov w3, #0x80000000 - str w0, [fp, #LO_reg_cop0+56] /* EPC */ - orr w1, w1, #2 - mov w2, #0x20 - str w1, [fp, #LO_reg_cop0+48] /* Status */ - str w2, [fp, #LO_reg_cop0+52] /* Cause */ - add w0, w3, #0x80 - bl get_addr_ht - br x0 - .size jump_syscall, .-jump_syscall - .align 2 + mov w0, #0x20 + mov w1, #0 + +call_psxException: + ldr w3, [rFP, #LO_last_count] + str w2, [rFP, #LO_pcaddr] + add rCC, w3, rCC + str rCC, [rFP, #LO_cycle] /* PCSX cycles */ + bl psxException /* note: psxException might do recursive recompiler call from it's HLE code, * so be ready for this */ FUNCTION(jump_to_new_pc): - ldr w1, [fp, #LO_next_interupt] - ldr rCC, [fp, #LO_cycle] - ldr w0, [fp, #LO_pcaddr] + ldr w1, [rFP, #LO_next_interupt] + ldr rCC, [rFP, #LO_cycle] + ldr w0, [rFP, #LO_pcaddr] sub rCC, rCC, w1 - str w1, [fp, #LO_last_count] + str w1, [rFP, #LO_last_count] bl get_addr_ht br x0 .size jump_to_new_pc, .-jump_to_new_pc @@ -249,10 +262,10 @@ FUNCTION(new_dyna_leave): .endm .macro memhandler_post - ldr w2, [rFP, #LO_next_interupt] - ldr w1, [rFP, #LO_cycle] - sub w0, w1, w2 - str w2, [rFP, #LO_last_count] + ldr w0, [rFP, #LO_next_interupt] + ldr w2, [rFP, #LO_cycle] // memhandlers can modify cc, like dma + str w0, [rFP, #LO_last_count] + sub w0, w2, w0 .endm FUNCTION(do_memhandler_pre): @@ -331,8 +344,8 @@ handler_write_end: FUNCTION(jump_handle_swl): /* w0 = address, w1 = data, w2 = cycles */ - ldr x3, [fp, #LO_mem_wtab] - mov w4, w0, lsr #12 + ldr x3, [rFP, #LO_mem_wtab] + orr w4, wzr, w0, lsr #12 ldr x3, [x3, w4, uxtw #3] adds x3, x3, x3 bcs 4f @@ -366,8 +379,8 @@ FUNCTION(jump_handle_swl): FUNCTION(jump_handle_swr): /* w0 = address, w1 = data, w2 = cycles */ - ldr x3, [fp, #LO_mem_wtab] - mov w4, w0, lsr #12 + ldr x3, [rFP, #LO_mem_wtab] + orr w4, wzr, w0, lsr #12 ldr x3, [x3, w4, uxtw #3] adds x3, x3, x3 bcs 4f @@ -396,3 +409,15 @@ FUNCTION(jump_handle_swr): bl abort ret +FUNCTION(call_gteStall): + /* w0 = op_cycles, w1 = cycles */ + ldr w2, [rFP, #LO_last_count] + str lr, [rFP, #LO_saved_lr] + add w1, w1, w2 + str w1, [rFP, #LO_cycle] + add x1, rFP, #LO_psxRegs + bl gteCheckStallRaw + ldr lr, [rFP, #LO_saved_lr] + add rCC, rCC, w0 + ret +