diff options
| author | ptitSeb <sebastien.chev@gmail.com> | 2021-03-03 17:32:24 +0100 |
|---|---|---|
| committer | ptitSeb <sebastien.chev@gmail.com> | 2021-03-03 17:32:24 +0100 |
| commit | be17349a5d8e2ea323a793384b43653e3e9c22a6 (patch) | |
| tree | 4b856b728da01c04f6d822887a2ce1e602730b1f /src/emu | |
| parent | 9aabe9c97fecb77f70361e0e0df8380f1489fc81 (diff) | |
| download | box64-be17349a5d8e2ea323a793384b43653e3e9c22a6.tar.gz box64-be17349a5d8e2ea323a793384b43653e3e9c22a6.zip | |
Added some X86_64 RelocA and a few wrapped function (wrapper still not correct anyway)
Diffstat (limited to 'src/emu')
| -rwxr-xr-x | src/emu/x64emu.c | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/src/emu/x64emu.c b/src/emu/x64emu.c index ea3cc138..b501334d 100755 --- a/src/emu/x64emu.c +++ b/src/emu/x64emu.c @@ -143,32 +143,32 @@ void AddCleanup1Arg(x64emu_t *emu, void *p, void* a) my_context->cleanups[my_context->clean_sz++].f = p; } -//void CallCleanup(x64emu_t *emu, void* p) -//{ -// printf_log(LOG_DEBUG, "Calling atexit registered functions for %p mask\n", p); -// for(int i=my_context->clean_sz-1; i>=0; --i) { -// if(p==my_context->cleanups[i].f) { -// printf_log(LOG_DEBUG, "Call cleanup #%d\n", i); -// RunFunctionWithEmu(emu, 0, (uintptr_t)(my_context->cleanups[i].f), my_context->cleanups[i].arg, my_context->cleanups[i].a ); -// // now remove the cleanup -// if(i!=my_context->clean_sz-1) -// memmove(my_context->cleanups+i, my_context->cleanups+i+1, (my_context->clean_sz-i-1)*sizeof(cleanup_t)); -// --my_context->clean_sz; -// } -// } -//} +void CallCleanup(x64emu_t *emu, void* p) +{ + printf_log(LOG_DEBUG, "Calling atexit registered functions for %p mask\n", p); + for(int i=my_context->clean_sz-1; i>=0; --i) { + if(p==my_context->cleanups[i].f) { + printf_log(LOG_DEBUG, "Call cleanup #%d\n", i); + RunFunctionWithEmu(emu, 0, (uintptr_t)(my_context->cleanups[i].f), my_context->cleanups[i].arg, my_context->cleanups[i].a ); + // now remove the cleanup + if(i!=my_context->clean_sz-1) + memmove(my_context->cleanups+i, my_context->cleanups+i+1, (my_context->clean_sz-i-1)*sizeof(cleanup_t)); + --my_context->clean_sz; + } + } +} -//void CallAllCleanup(x64emu_t *emu) -//{ -// printf_log(LOG_DEBUG, "Calling atexit registered functions\n"); -// for(int i=my_context->clean_sz-1; i>=0; --i) { -// printf_log(LOG_DEBUG, "Call cleanup #%d\n", i); -// RunFunctionWithEmu(emu, 0, (uintptr_t)(my_context->cleanups[i].f), my_context->cleanups[i].arg, my_context->cleanups[i].a ); -// } -// my_context->clean_sz = 0; -// free(my_context->cleanups); -// my_context->cleanups = NULL; -//} +void CallAllCleanup(x64emu_t *emu) +{ + printf_log(LOG_DEBUG, "Calling atexit registered functions\n"); + for(int i=my_context->clean_sz-1; i>=0; --i) { + printf_log(LOG_DEBUG, "Call cleanup #%d\n", i); + RunFunctionWithEmu(emu, 0, (uintptr_t)(my_context->cleanups[i].f), my_context->cleanups[i].arg, my_context->cleanups[i].a ); + } + my_context->clean_sz = 0; + free(my_context->cleanups); + my_context->cleanups = NULL; +} static void internalFreeX64(x64emu_t* emu) { |