aboutsummaryrefslogtreecommitdiff
path: root/libpcsxcore/new_dynarec
diff options
context:
space:
mode:
authorneonloop2021-07-02 22:23:41 +0000
committerneonloop2021-07-02 22:23:41 +0000
commitf5c6b3357ecbbc35cefa011dc4a8d9f1d23c87ee (patch)
treec97ba4ac1bae1f213a30aaca159450a00f77ce9e /libpcsxcore/new_dynarec
parent56f91f2f4a3888d0613ef8f4f2b313c2c76431fd (diff)
downloadpcsx_rearmed-f5c6b3357ecbbc35cefa011dc4a8d9f1d23c87ee.tar.gz
pcsx_rearmed-f5c6b3357ecbbc35cefa011dc4a8d9f1d23c87ee.tar.bz2
pcsx_rearmed-f5c6b3357ecbbc35cefa011dc4a8d9f1d23c87ee.zip
Always look up verify_dirty literals from offsetsHEADtrimui-s
Literals are deduplicated, so there's no guarantee they will be stored next to each other, even if they're written sequentially. verify_dirty and get_bounds must use the offsets on each instruction, instead of assuming values are stored sequentially.
Diffstat (limited to 'libpcsxcore/new_dynarec')
-rw-r--r--libpcsxcore/new_dynarec/arm/assem_arm.c38
1 files changed, 26 insertions, 12 deletions
diff --git a/libpcsxcore/new_dynarec/arm/assem_arm.c b/libpcsxcore/new_dynarec/arm/assem_arm.c
index db1d2af..a373bd3 100644
--- a/libpcsxcore/new_dynarec/arm/assem_arm.c
+++ b/libpcsxcore/new_dynarec/arm/assem_arm.c
@@ -241,14 +241,21 @@ static u_int get_clean_addr(int addr)
static int verify_dirty(u_int *ptr)
{
#ifndef HAVE_ARMV7
+ u_int offset;
// get from literal pool
assert((*ptr&0xFFFF0000)==0xe59f0000);
- u_int offset=*ptr&0xfff;
- u_int *l_ptr=(void *)ptr+offset+8;
- u_int source=l_ptr[0];
- u_int copy=l_ptr[1];
- u_int len=l_ptr[2];
- ptr+=4;
+ offset=*ptr&0xfff;
+ u_int source=*(u_int*)((void *)ptr+offset+8);
+ ptr++;
+ assert((*ptr&0xFFFF0000)==0xe59f0000);
+ offset=*ptr&0xfff;
+ u_int copy=*(u_int*)((void *)ptr+offset+8);
+ ptr++;
+ assert((*ptr&0xFFFF0000)==0xe59f0000);
+ offset=*ptr&0xfff;
+ u_int len=*(u_int*)((void *)ptr+offset+8);
+ ptr++;
+ ptr++;
#else
// ARMv7 movw/movt
assert((*ptr&0xFFF00000)==0xe3000000);
@@ -285,14 +292,21 @@ static void get_bounds(int addr,u_int *start,u_int *end)
{
u_int *ptr=(u_int *)addr;
#ifndef HAVE_ARMV7
+ u_int offset;
// get from literal pool
assert((*ptr&0xFFFF0000)==0xe59f0000);
- u_int offset=*ptr&0xfff;
- u_int *l_ptr=(void *)ptr+offset+8;
- u_int source=l_ptr[0];
- //u_int copy=l_ptr[1];
- u_int len=l_ptr[2];
- ptr+=4;
+ offset=*ptr&0xfff;
+ u_int source=*(u_int*)((void *)ptr+offset+8);
+ ptr++;
+ //assert((*ptr&0xFFFF0000)==0xe59f0000);
+ //offset=*ptr&0xfff;
+ //u_int copy=*(u_int*)((void *)ptr+offset+8);
+ ptr++;
+ assert((*ptr&0xFFFF0000)==0xe59f0000);
+ offset=*ptr&0xfff;
+ u_int len=*(u_int*)((void *)ptr+offset+8);
+ ptr++;
+ ptr++;
#else
// ARMv7 movw/movt
assert((*ptr&0xFFF00000)==0xe3000000);