Skip to content

Commit

Permalink
new_dynarec: fix invalid CPU instruction generation in emit_writeword()
Browse files Browse the repository at this point in the history
  • Loading branch information
Rosalie241 committed May 8, 2024
1 parent 80e4faf commit 4eb7ab0
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2040,6 +2040,7 @@ static void emit_writebyte_indexed_tlb(int rt, int addr, int rs, int map)
}
static void emit_writeword(int rt, int addr)
{
if(rt<0) return;
u_int offset = addr-(u_int)&g_dev.r4300.new_dynarec_hot_state;
assert(offset<4096);
assem_debug("str %s,fp+%d",regname[rt],offset);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2393,6 +2393,7 @@ static void emit_writebyte_indexed_tlb(int rt, int addr, int rs, int map)

static void emit_writeword(int rt, intptr_t addr)
{
if(rt<0) return;
intptr_t offset = addr-(intptr_t)&g_dev.r4300.new_dynarec_hot_state;
assert(offset<16380LL);
assert(offset%4 == 0); /* 4 bytes aligned */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2309,6 +2309,7 @@ static void emit_xchg64(int rs, int rt)
}
static void emit_writeword(int rt, intptr_t addr)
{
if(rt<0) return;
assert((intptr_t)addr-(intptr_t)out>=-2147483648LL&&(intptr_t)addr-(intptr_t)out<2147483647LL);
assem_debug("movl %%%s,%llx",regname[rt],addr);
output_byte(0x89);
Expand Down

0 comments on commit 4eb7ab0

Please sign in to comment.