From 0d16cda294b8f4655dda849a526b336a5b46aa16 Mon Sep 17 00:00:00 2001 From: notaz Date: Sun, 23 Jan 2011 21:29:29 +0200 Subject: [PATCH] fix some alignment issues --- libpcsxcore/new_dynarec/linkage_arm.s | 48 +++++++++++++++++---------- plugins/dfxvideo/gpu.c | 6 ++-- plugins/dfxvideo/gpu.h | 11 ++++-- 3 files changed, 42 insertions(+), 23 deletions(-) diff --git a/libpcsxcore/new_dynarec/linkage_arm.s b/libpcsxcore/new_dynarec/linkage_arm.s index 70836df8..7b76aec3 100644 --- a/libpcsxcore/new_dynarec/linkage_arm.s +++ b/libpcsxcore/new_dynarec/linkage_arm.s @@ -703,11 +703,23 @@ jump_hlecall: ldr r2, [fp, #last_count-dynarec_local] str r0, [fp, #pcaddr-dynarec_local] add r2, r2, r10 - str r2, [fp, #cycle-dynarec_local] /* PCSX cycle counter */ adr lr, pcsx_return + str r2, [fp, #cycle-dynarec_local] /* PCSX cycle counter */ bx r1 .size jump_hlecall, .-jump_hlecall + .align 2 + .global jump_intcall + .type jump_intcall, %function +jump_intcall: + ldr r2, [fp, #last_count-dynarec_local] + str r0, [fp, #pcaddr-dynarec_local] + add r2, r2, r10 + adr lr, pcsx_return + str r2, [fp, #cycle-dynarec_local] /* PCSX cycle counter */ + b execI + .size jump_hlecall, .-jump_hlecall + new_dyna_leave: .align 2 .global new_dyna_leave @@ -822,34 +834,34 @@ ari_read_ram_mirror32: ari_read_ram_mirror (3<<11), ldr /* invalidation is already taken care of by the caller */ -.macro ari_write_ram bic_const var op +.macro ari_write_ram bic_const var pf ldr r0, [fp, #address-dynarec_local] - ldr r1, [fp, #\var-dynarec_local] + ldr\pf r1, [fp, #\var-dynarec_local] .if \bic_const bic r0, r0, #\bic_const .endif - \op r1, [r0] + str\pf r1, [r0] mov pc, lr .endm ari_write_ram8: - ari_write_ram 0, byte, strb + ari_write_ram 0, byte, b ari_write_ram16: - ari_write_ram 1, hword, strh + ari_write_ram 1, hword, h ari_write_ram32: - ari_write_ram 3, word, str + ari_write_ram 3, word, -.macro ari_write_ram_mirror mvn_const var op +.macro ari_write_ram_mirror mvn_const var pf ldr r0, [fp, #address-dynarec_local] mvn r3, #\mvn_const - ldr r1, [fp, #\var-dynarec_local] + ldr\pf r1, [fp, #\var-dynarec_local] and r0, r3, lsr #11 ldr r2, [fp, #invc_ptr-dynarec_local] orr r0, r0, #1<<31 ldrb r2, [r2, r0, lsr #12] - \op r1, [r0] + str\pf r1, [r0] tst r2, r2 movne pc, lr lsr r0, r0, #12 @@ -857,13 +869,13 @@ ari_write_ram32: .endm ari_write_ram_mirror8: - ari_write_ram_mirror 0, byte, strb + ari_write_ram_mirror 0, byte, b ari_write_ram_mirror16: - ari_write_ram_mirror (1<<11), hword, strh + ari_write_ram_mirror (1<<11), hword, h ari_write_ram_mirror32: - ari_write_ram_mirror (3<<11), word, str + ari_write_ram_mirror (3<<11), word, .macro ari_read_bios_mirror bic_const op @@ -963,9 +975,9 @@ ari_read_io32: .endif .endm -.macro ari_write_io opvl opst var mem_tab tab_shift +.macro ari_write_io pf var mem_tab tab_shift ldr r0, [fp, #address-dynarec_local] - \opvl r1, [fp, #\var-dynarec_local] + ldr\pf r1, [fp, #\var-dynarec_local] .if \tab_shift == 0 bic r0, r0, #3 .endif @@ -985,7 +997,7 @@ ari_read_io32: bxne r12 0: ldr r3, [fp, #psxH_ptr-dynarec_local] - \opst r1, [r2, r3] + str\pf r1, [r2, r3] mov pc, lr 1: .if \tab_shift == 1 @ write16 @@ -1018,9 +1030,9 @@ ari_write_io8: mov pc, lr ari_write_io16: - ari_write_io ldrh, strh, hword, tab_write16, 1 + ari_write_io h, hword, tab_write16, 1 ari_write_io32: - ari_write_io ldr, str, word, tab_write32, 0 + ari_write_io , word, tab_write32, 0 @ vim:filetype=armasm diff --git a/plugins/dfxvideo/gpu.c b/plugins/dfxvideo/gpu.c index 200913ce..7372ba4a 100644 --- a/plugins/dfxvideo/gpu.c +++ b/plugins/dfxvideo/gpu.c @@ -946,14 +946,14 @@ ENDVRAM: { gpuDataC = primTableCX[command]; gpuCommand = command; - PUTLE32(&gpuDataM[0], gdata); + PUTLE32_(&gpuDataM[0], gdata); gpuDataP = 1; } else continue; } else { - PUTLE32(&gpuDataM[gpuDataP], gdata); + PUTLE32_(&gpuDataM[gpuDataP], gdata); if(gpuDataC>128) { if((gpuDataC==254 && gpuDataP>=3) || @@ -986,7 +986,7 @@ ENDVRAM: void CALLBACK GPUwriteData(uint32_t gdata) { - PUTLE32(&gdata, gdata); + PUTLE32_(&gdata, gdata); GPUwriteDataMem(&gdata,1); } diff --git a/plugins/dfxvideo/gpu.h b/plugins/dfxvideo/gpu.h index 740add59..b7b171e1 100644 --- a/plugins/dfxvideo/gpu.h +++ b/plugins/dfxvideo/gpu.h @@ -104,10 +104,17 @@ #define GETLEs32(X) ((int16_t)GETLE32((uint16_t *)X)) #define GETLE16(X) LE2HOST16(*(uint16_t *)X) -#define GETLE32(X) LE2HOST32(*(uint32_t *)X) +#define GETLE32_(X) LE2HOST32(*(uint32_t *)X) #define GETLE16D(X) ({uint32_t val = GETLE32(X); (val<<16 | val >> 16);}) #define PUTLE16(X, Y) do{*((uint16_t *)X)=HOST2LE16((uint16_t)Y);}while(0) -#define PUTLE32(X, Y) do{*((uint32_t *)X)=HOST2LE16((uint32_t)Y);}while(0) +#define PUTLE32_(X, Y) do{*((uint32_t *)X)=HOST2LE16((uint32_t)Y);}while(0) +#ifdef __arm__ +#define GETLE32(X) (*(uint16_t *)X|(((uint16_t *)X)[1]<<16)) +#define PUTLE32(X, Y) do{*((uint16_t *)X)=(uint32_t)Y;((uint16_t *)X)[1]=(uint32_t)(Y)>>16;}while(0) +#else +#define GETLE32 GETLE32_ +#define PUTLE32 PUTLE32_ +#endif ///////////////////////////////////////////////////////////////////////////// -- 2.39.5