Skip to content

Commit 22346d4

Browse files
committed
drc: restore scratch_buf_ptr
me from 2013 outsmarted myself from 2024 with this one
1 parent ea5c2d7 commit 22346d4

File tree

5 files changed

+21
-13
lines changed

5 files changed

+21
-13
lines changed

libpcsxcore/new_dynarec/emu_if.c

+2
Original file line numberDiff line numberDiff line change
@@ -526,6 +526,7 @@ static int ari64_thread_check_range(unsigned int start, unsigned int end) { retu
526526

527527
static int ari64_init()
528528
{
529+
static u32 scratch_buf[8*8*2] __attribute__((aligned(64)));
529530
size_t i;
530531

531532
new_dynarec_init();
@@ -553,6 +554,7 @@ static int ari64_init()
553554
#endif
554555
psxH_ptr = psxH;
555556
zeromem_ptr = zero_mem;
557+
scratch_buf_ptr = scratch_buf; // for gte_neon.S
556558

557559
ari64_thread_init();
558560

libpcsxcore/new_dynarec/linkage_arm.S

+7-1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@
3434
#define gteCheckStallRaw ESYM(gteCheckStallRaw)
3535
#define psxException ESYM(psxException)
3636
#define execI ESYM(execI)
37+
#endif
38+
39+
/* make mini_ht reachable with a single armv4 insn */
40+
#if (LO_mini_ht & ~0xff0)
41+
#error misligned mini_ht
3742
#endif
3843

3944
.bss
@@ -79,8 +84,9 @@ DRC_VAR(mem_wtab, 4)
7984
DRC_VAR(psxH_ptr, 4)
8085
DRC_VAR(zeromem_ptr, 4)
8186
DRC_VAR(invc_ptr, 4)
82-
DRC_VAR(hash_table_ptr, 4)
87+
DRC_VAR(scratch_buf_ptr, 4)
8388
DRC_VAR(ram_offset, 4)
89+
DRC_VAR(hash_table_ptr, 4)
8490
DRC_VAR(mini_ht, 256)
8591

8692

libpcsxcore/new_dynarec/linkage_arm64.S

+2-1
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,9 @@ DRC_VAR(mem_wtab, 8)
8181
DRC_VAR(psxH_ptr, 8)
8282
DRC_VAR(invc_ptr, 8)
8383
DRC_VAR(zeromem_ptr, 8)
84-
DRC_VAR(hash_table_ptr, 8)
84+
DRC_VAR(scratch_buf_ptr, 8)
8585
DRC_VAR(ram_offset, 8)
86+
DRC_VAR(hash_table_ptr, 8)
8687
DRC_VAR(mini_ht, 256)
8788

8889

+9-11
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11

22
#define PTRSZ __SIZEOF_POINTER__
33

4-
#define LO_unused0 64
5-
#define LO_unused1 (LO_unused0 + 4)
6-
#define LO_unused2 (LO_unused1 + 4)
7-
#define LO_unused3 (LO_unused2 + 4)
8-
#define LO_cycle_count (LO_unused3 + 4)
4+
#define LO_cycle_count 64
95
#define LO_last_count (LO_cycle_count + 4)
106
#define LO_address (LO_last_count + 4)
117
#define LO_hack_addr (LO_address + 4)
@@ -22,13 +18,13 @@
2218
#define LO_interrupt (LO_cycle + 4)
2319
#define LO_intCycle (LO_interrupt + 4)
2420
#define LO_next_interupt (LO_intCycle + 4*2*31)
25-
#define LO_unused4 (LO_next_interupt + 4)
26-
#define LO_gteBusyCycle (LO_unused4 + 4)
21+
#define LO_unused (LO_next_interupt + 4)
22+
#define LO_gteBusyCycle (LO_unused + 4)
2723
#define LO_muldivBusyCycle (LO_gteBusyCycle + 4)
2824
#define LO_psxRegs_subCycle (LO_muldivBusyCycle + 4)
2925
#define LO_psxRegs_biuReg (LO_psxRegs_subCycle + 4*2)
3026
#define LO_stop (LO_psxRegs_biuReg + 4)
31-
#define LO_psxRegs_end (LO_stop + 4*7)
27+
#define LO_psxRegs_end (LO_stop + 4*9)
3228
#define LO_rcnts (LO_psxRegs_end)
3329
#define LO_rcnts_end (LO_rcnts + 7*4*4)
3430
#define LO_inv_code_start (LO_rcnts_end)
@@ -38,10 +34,12 @@
3834
#define LO_psxH_ptr (LO_mem_wtab + PTRSZ)
3935
#define LO_zeromem_ptr (LO_psxH_ptr + PTRSZ)
4036
#define LO_invc_ptr (LO_zeromem_ptr + PTRSZ)
41-
#define LO_hash_table_ptr (LO_invc_ptr + PTRSZ)
42-
#define LO_saved_lr (LO_hash_table_ptr + PTRSZ)
37+
#define LO_scratch_buf_ptr (LO_invc_ptr + PTRSZ) // for gte_neon.S
38+
#define LO_saved_lr (LO_scratch_buf_ptr + PTRSZ)
4339
#define LO_ram_offset (LO_saved_lr + PTRSZ)
44-
#define LO_mini_ht (LO_ram_offset + PTRSZ)
40+
#define LO_hash_table_ptr (LO_ram_offset + PTRSZ)
41+
#define LO_unused2 (LO_hash_table_ptr + PTRSZ)
42+
#define LO_mini_ht (LO_unused2 + PTRSZ)
4543
#define LO_dynarec_local_size (LO_mini_ht + PTRSZ*32*2)
4644

4745
#define LO_cop2_to_scratch_buf (LO_scratch_buf_ptr - LO_reg_cop2d)

libpcsxcore/r3000a.h

+1
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ typedef struct psxRegisters {
214214
u32 biosBranchCheck;
215215
u32 cpuInRecursion;
216216
u32 gpuIdleAfter;
217+
u32 unused3[2];
217218
// warning: changing anything in psxRegisters requires update of all
218219
// asm in libpcsxcore/new_dynarec/ and may break savestates
219220
} psxRegisters;

0 commit comments

Comments
 (0)