Skip to content

Commit

Permalink
[BOX32] Fixed scanf type function when grabing long/ptr type of data
Browse files Browse the repository at this point in the history
  • Loading branch information
ptitSeb committed Oct 3, 2024
1 parent c5e894a commit 0e91ad3
Show file tree
Hide file tree
Showing 4 changed files with 323 additions and 21 deletions.
4 changes: 3 additions & 1 deletion src/emu/x64emu_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ typedef struct emu_flags_s {
#define JUMPBUFF struct __jmp_buf_tag
#endif

#define N_SCRATCH 200

typedef struct x64emu_s {
// cpu
reg64_t regs[16];
Expand Down Expand Up @@ -119,7 +121,7 @@ typedef struct x64emu_s {
#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[200];
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)
Expand Down
6 changes: 4 additions & 2 deletions src/include/myalign32.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,11 @@ typedef struct va_list {
#define PREPARE_VALIST_32_(A) CREATE_SYSV_VALIST_32(A)

void myStackAlign32(const char* fmt, uint32_t* st, uint64_t* mystack);
void myStackAlignScanf32(const char* fmt, uint32_t* st, uint64_t* mystack);
size_t myStackAlignScanf32(const char* fmt, uint32_t* st, uint64_t* mystack, size_t nb_elem); // return the number of long/ptr_t conversion pending
void myStackAlignScanf32_final(const char* fmt, uint32_t* st, uint64_t* mystack, size_t nb_elem, int n); // convert the long/ptr_t scanf results
void myStackAlignGVariantNew32(const char* fmt, uint32_t* st, uint64_t* mystack);
void myStackAlignScanfW32(const char* fmt, uint32_t* st, uint64_t* mystack);
size_t myStackAlignScanfW32(const char* fmt, uint32_t* st, uint64_t* mystack, size_t nb_elem);
void myStackAlignScanfW32_final(const char* fmt, uint32_t* st, uint64_t* mystack, size_t nb_elem, int n);
void myStackAlignW32(const char* fmt, uint32_t* st, uint64_t* mystack);

void UnalignStat64_32(const void* source, void* dest);
Expand Down
Loading

0 comments on commit 0e91ad3

Please sign in to comment.