From f3fe3e5ba2e5966bb08f51c9e78716ee07651058 Mon Sep 17 00:00:00 2001 From: notaz Date: Mon, 29 Jul 2013 02:52:11 +0300 Subject: [PATCH] svp: convert asm to ual / apple gas --- Makefile.libretro | 6 ++-- pico/carthw/svp/compiler.c | 2 +- pico/carthw/svp/compiler.h | 2 +- pico/carthw/svp/stub_arm.S | 67 ++++++++++++++++++-------------------- 4 files changed, 37 insertions(+), 40 deletions(-) diff --git a/Makefile.libretro b/Makefile.libretro index 1c7207c3..bc677352 100644 --- a/Makefile.libretro +++ b/Makefile.libretro @@ -50,11 +50,11 @@ else ifeq ($(platform), ios) HAVE_NEON = 0 USE_DYNAREC = 0 - use_fame = 1 - use_cz80 = 1 - use_sh2mame = 1 use_cyclone = 0 + use_fame = 1 use_drz80 = 0 + use_cz80 = 1 + use_sh2mame = 0 use_sh2drc = 1 use_svpdrc = 1 diff --git a/pico/carthw/svp/compiler.c b/pico/carthw/svp/compiler.c index 758d9261..ce9f42a2 100644 --- a/pico/carthw/svp/compiler.c +++ b/pico/carthw/svp/compiler.c @@ -1880,7 +1880,7 @@ void ssp1601_dyn_run(int cycles) ssp_translate_block(DUMP_BLOCK >> 1); #endif #ifdef __arm__ - ssp_drc_entry(cycles); + ssp_drc_entry(ssp, cycles); #endif } diff --git a/pico/carthw/svp/compiler.h b/pico/carthw/svp/compiler.h index abd23946..f237a8ef 100644 --- a/pico/carthw/svp/compiler.h +++ b/pico/carthw/svp/compiler.h @@ -1,4 +1,4 @@ -int ssp_drc_entry(int cycles); +int ssp_drc_entry(ssp1601_t *ssp, int cycles); void ssp_drc_next(void); void ssp_drc_next_patch(void); void ssp_drc_end(void); diff --git a/pico/carthw/svp/stub_arm.S b/pico/carthw/svp/stub_arm.S index c65a2357..d5c01bf4 100644 --- a/pico/carthw/svp/stub_arm.S +++ b/pico/carthw/svp/stub_arm.S @@ -6,22 +6,20 @@ @* See COPYING file in the top-level directory. @* -.global ssp_drc_entry -.global ssp_drc_next -.global ssp_drc_next_patch -.global ssp_drc_end -.global ssp_hle_800 -.global ssp_hle_902 -.global ssp_hle_07_030 -.global ssp_hle_07_036 -.global ssp_hle_07_6d6 -.global ssp_hle_11_12c -.global ssp_hle_11_384 -.global ssp_hle_11_38a +#include "../../arm_features.h" +.syntax unified .text .align 2 +@ externals +#define cache_flush_d_inval_i ESYM(cache_flush_d_inval_i) +#define ssp_get_iram_context ESYM(ssp_get_iram_context) +#define ssp_pm_read ESYM(ssp_pm_read) +#define ssp_pm_write ESYM(ssp_pm_write) +#define ssp_translate_block ESYM(ssp_translate_block) +#define tr_unhandled ESYM(tr_unhandled) + @ SSP_GR0, SSP_X, SSP_Y, SSP_A, @ SSP_ST, SSP_STACK, SSP_PC, SSP_P, @ SSP_PM0, SSP_PM1, SSP_PM2, SSP_XST, @@ -125,12 +123,11 @@ .endm @ ssp_drc_do_next -ssp_drc_entry: +FUNCTION(ssp_drc_entry): stmfd sp!, {r4-r11, lr} - mov r11, r0 + mov r7, r0 @ ssp + mov r11, r1 ssp_regfile_load: - ldr r7, =ssp - ldr r7, [r7] add r2, r7, #0x400 add r2, r2, #4 ldmia r2, {r3,r4,r5,r6,r8} @@ -155,11 +152,11 @@ ssp_regfile_load: mov r0, r0, lsr #16 -ssp_drc_next: +FUNCTION(ssp_drc_next): ssp_drc_do_next 0 -ssp_drc_next_patch: +FUNCTION(ssp_drc_next_patch): ssp_drc_do_next 1 ssp_drc_do_patch: @@ -197,7 +194,7 @@ ssp_drc_dp_end: bx r2 -ssp_drc_end: +FUNCTION(ssp_drc_end): mov r0, r0, lsl #16 str r0, [r7, #(SSP_OFFS_GR+SSP_PC*4)] @@ -209,7 +206,7 @@ ssp_regfile_store: mov r9, r6, lsr #13 and r9, r9, #(7<<16) @ STACK mov r3, r6, lsl #28 - msr cpsr_flg, r3 @ to to ARM PSR + msr cpsr_f, r3 @ to to ARM PSR and r6, r6, #0x670 mov r6, r6, lsl #12 orrmi r6, r6, #0x80000000 @ N @@ -231,7 +228,7 @@ ssp_regfile_store: @ ld A, PM0 @ andi 2 @ bra z=1, gloc_0800 -ssp_hle_800: +FUNCTION(ssp_hle_800): ldr r0, [r7, #(SSP_OFFS_GR+SSP_PM0*4)] ldr r1, [r7, #SSP_OFFS_EMUSTAT] tst r0, #0x20000 @@ -258,7 +255,7 @@ ssp_hle_800: ldrh r0, [r1] .endm -ssp_hle_902: +FUNCTION(ssp_hle_902): cmp r11, #0 ble ssp_drc_end @@ -292,8 +289,8 @@ ssp_hle_902_loop: bgt ssp_hle_902_loop tst r12, #1 - ldrneh r0, [r2], #2 - strneh r0, [r3], #2 + ldrhne r0, [r2], #2 + strhne r0, [r3], #2 ldr r0, [r7, #SSP_OFFS_IRAM_ROM] add r1, r7, #0x200 @@ -331,7 +328,7 @@ ssp_hle_902_loop: add r8, r8, #(1<<24) .endm -ssp_hle_11_12c: +FUNCTION(ssp_hle_11_12c): cmp r11, #0 ble ssp_drc_end @@ -368,11 +365,11 @@ ssp_hle_11_12c: b ssp_drc_next -ssp_hle_11_384: +FUNCTION(ssp_hle_11_384): mov r3, #2 b ssp_hle_11_38x -ssp_hle_11_38a: +FUNCTION(ssp_hle_11_38a): mov r3, #3 @ r5 ssp_hle_11_38x: @@ -420,7 +417,7 @@ ssp_hle_11_38x_loop: b ssp_drc_next -ssp_hle_07_6d6: +FUNCTION(ssp_hle_07_6d6): cmp r11, #0 ble ssp_drc_end @@ -456,14 +453,14 @@ ssp_hle_07_6d6_end: b ssp_drc_next -ssp_hle_07_030: +FUNCTION(ssp_hle_07_030): ldrh r0, [r7] mov r0, r0, lsl #4 orr r0, r0, r0, lsr #16 strh r0, [r7] sub r11,r11,#3 -ssp_hle_07_036: +FUNCTION(ssp_hle_07_036): ldr r1, [r7, #0x1e0] @ F1h F0h rsb r5, r1, r1, lsr #16 mov r5, r5, lsl #16 @ AL not needed @@ -512,7 +509,7 @@ ssp_hle_07_036: mov r12, #0x4000 orr r12,r12,#0x0018 subs r12,r3, r12 - subnes r12,r12,#0x0400 + subsne r12,r12,#0x0400 blne tr_unhandled orr r2, r2, r2, lsl #16 @@ -521,7 +518,7 @@ ssp_hle_07_036: hle_07_036_no_ovrwr: tst r1, #2 - strneh r2, [r1], #0x3e @ align + strhne r2, [r1], #0x3e @ align subne r0, r0, #1 subs r0, r0, #4 blt hle_07_036_l2 @@ -536,7 +533,7 @@ hle_07_036_l2: tst r0, #2 strne r2, [r1], #0x40 tst r0, #1 - strneh r2, [r1], #2 + strhne r2, [r1], #2 b hle_07_036_end_copy hle_07_036_ovrwr: @@ -573,10 +570,10 @@ hle_07_036_ol1: hle_07_036_ol2: tst r0, #1 - ldrneh r3, [r1] + ldrhne r3, [r1] andne r3, r3, r12 orrne r3, r3, r2 - strneh r3, [r1], #2 + strhne r3, [r1], #2 hle_07_036_end_copy: ldr r2, [r7, #SSP_OFFS_DRAM] -- 2.39.5