From fa2bd920bd2b80900de2958bed87af5a70796a54 Mon Sep 17 00:00:00 2001 From: Yang Liu Date: Tue, 14 Jan 2025 19:47:23 +0800 Subject: [RV64_DYNAREC] Fixed offsetof(x64emu_t, scratch) usage overflow ([LA64_DYNAREC] too) (#2262) --- src/emu/x64emu_private.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/emu/x64emu_private.h b/src/emu/x64emu_private.h index ff2d6af5..a9d73937 100644 --- a/src/emu/x64emu_private.h +++ b/src/emu/x64emu_private.h @@ -110,15 +110,17 @@ typedef struct x64emu_s { forkpty_t* forkpty_info; emu_flags_t flags; x64test_t test; // used for dynarec testing + // scratch stack, used for alignment of double and 64bits ints on arm. 200 elements should be enough + __int128_t dummy_align; // here to have scratch 128bits aligned + uint64_t scratch[N_SCRATCH]; + + // Warning, offsetof(x64emu_t, xxx) will be too big for fields below. #ifdef HAVE_TRACE sse_regs_t old_xmm[16]; sse_regs_t old_ymm[16]; reg64_t oldregs[16]; uintptr_t prev2_ip; #endif - // scratch stack, used for alignment of double and 64bits ints on arm. 200 elements should be enough - __int128_t dummy_align; // here to have scratch 128bits aligned - uint64_t scratch[N_SCRATCH]; // local stack, do be deleted when emu is freed void* stack2free; // this is the stack to free (can be NULL) void* init_stack; // initial stack (owned or not) -- cgit 1.4.1