diff options
| -rwxr-xr-x | COMPILE.md | 19 | ||||
| -rwxr-xr-x | src/dynarec/dynarec_arm64_helper.c | 2 | ||||
| -rwxr-xr-x | src/elfs/elfloader.c | 14 | ||||
| -rwxr-xr-x | src/emu/x64int3.c | 12 | ||||
| -rw-r--r-- | src/emu/x64run670f.c | 19 | ||||
| -rwxr-xr-x | src/librarian/library_private.h | 2 | ||||
| -rwxr-xr-x | src/main.c | 4 | ||||
| -rwxr-xr-x | src/wrapped/wrappedlib_init.h | 4 |
8 files changed, 40 insertions, 36 deletions
diff --git a/COMPILE.md b/COMPILE.md index 0bb2a309..37014651 100755 --- a/COMPILE.md +++ b/COMPILE.md @@ -39,29 +39,31 @@ sudo systemctl restart systemd-binfmt `mkdir build; cd build; cmake .. -DLD80BITS=1 -DNOALIGN=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo; make -j$(nproc)` -#### use ccmake +If you encounter some linking errors, try activating `NOLOADADDR` (`cmake -DNOLOADADDR=ON; make -j$(nproc)`). -Alternatively, you can use the curses-bases ccmake (or any other gui frontend for cmake) to select wich platform to use interactively. +### use ccmake -#### Customize your build +Alternatively, you can **use the curses-bases ccmake (or any other gui frontend for cmake)** to select wich platform to use interactively. -*use ccache if you have it* +### Customize your build + +*Use ccache if you have it* Add `-DUSE_CCACHE=1` if you have ccache (it's better if you plan to touch the sources) -*have some debug info* +*To have some debug info* The `-DCMAKE_BUILD_TYPE=RelWithDebInfo` argument makes a build that is both optimized for speed, and has debug information embedded. That way, if you have a crash or try to analyse performance, you'll have some symbols. -*to have a Trace Enabled build* +*To have a Trace Enabled build* To have a trace enabled build ( ***it will be slower***), add `-DHAVE_TRACE=1` but you will need, at runtime, to have the [Zydis library](https://github.com/zyantific/zydis) library in your `LD_LIBRARY_PATH` or in the system library folders. -*to have ARM Dynarec* +*To have ARM Dynarec* The Dynarec is only available on the ARM architecture(Right now, anyways.). Notes also that VFPv3 and NEON are required for the Dynarec. Activate it by using `-DARM_DYNAREC=1`. Also, be sure to use `-marm` in compilation flags (because many compileur use Thumb as default, and the dynarec will not work in this mode). -*not building from a git clone* +*Not building from a git clone* If you are not building from a git clone (for example, downloading a release source zipped from github), you need to activate `-DNOGIT=1` from cmake to be able to build (normal process include git sha1 of HEAD in the version that box64 print). @@ -72,4 +74,3 @@ Testing A few tests are included. They can be launched with `ctest` They are very basic and don't test much for now. - diff --git a/src/dynarec/dynarec_arm64_helper.c b/src/dynarec/dynarec_arm64_helper.c index 6d7beccd..6fe90924 100755 --- a/src/dynarec/dynarec_arm64_helper.c +++ b/src/dynarec/dynarec_arm64_helper.c @@ -732,7 +732,7 @@ static void x87_reflectcache(dynarec_arm_t* dyn, int ninst, int s1, int s2, int int x87_get_cache(dynarec_arm_t* dyn, int ninst, int s1, int s2, int st) { (void)ninst; -#if STEP > 1 +#if STEP > 1 MAYUSE(s1); MAYUSE(s2); // search in cache first for (int i=0; i<8; ++i) diff --git a/src/elfs/elfloader.c b/src/elfs/elfloader.c index 072d780c..dd7ab1d1 100755 --- a/src/elfs/elfloader.c +++ b/src/elfs/elfloader.c @@ -460,10 +460,12 @@ int RelocateElfREL(lib_t *maplib, lib_t *local_maplib, elfheader_t* head, int cn } printf_log(LOG_DUMP, "Apply %s R_X86_64_COPY @%p with sym=%s, @%p size=%ld (", (bind==STB_LOCAL)?"Local":"Global", p, symname, (void*)offs, sym->st_size); memmove(p, (void*)offs, sym->st_size); - uint32_t *k = (uint32_t*)p; - for (unsigned j=0; j<((sym->st_size>128u)?128u:sym->st_size); j+=4, ++k) - printf_log(LOG_DUMP, "%s0x%08X", j?" ":"", *k); - printf_log(LOG_DUMP, "%s)\n", (sym->st_size>128u)?" ...":""); + if(box64_log >= LOG_DUMP) { + uint64_t *k = (uint64_t*)p; + for (unsigned j=0; j<((sym->st_size>128u)?128u:sym->st_size); j+=8, ++k) + printf_log(LOG_DUMP, "%s0x%016lX", j?" ":"", *k); + printf_log(LOG_DUMP, "%s)\n", (sym->st_size>128u)?" ...":""); + } } else { printf_log(LOG_NONE, "Error: Symbol %s not found, cannot apply R_X86_64_COPY @%p (%p) in %s\n", symname, p, *(void**)p, head->name); } @@ -1112,7 +1114,7 @@ const char* FindNearestSymbolName(elfheader_t* h, void* p, uintptr_t* start, uin if(!h || h->fini_done) return ret; - for (size_t i=0; i<h->numSymTab && distance!=0; ++i) { + for (size_t i=0; i<h->numSymTab && distance!=0; ++i) { const char * symname = h->StrTab+h->SymTab[i].st_name; uintptr_t offs = h->SymTab[i].st_value + h->delta; @@ -1125,7 +1127,7 @@ const char* FindNearestSymbolName(elfheader_t* h, void* p, uintptr_t* start, uin } } } - for (size_t i=0; i<h->numDynSym && distance!=0; ++i) { + for (size_t i=0; i<h->numDynSym && distance!=0; ++i) { const char * symname = h->DynStr+h->DynSym[i].st_name; uintptr_t offs = h->DynSym[i].st_value + h->delta; diff --git a/src/emu/x64int3.c b/src/emu/x64int3.c index 4c9ceb3d..36f7a7fa 100755 --- a/src/emu/x64int3.c +++ b/src/emu/x64int3.c @@ -92,7 +92,7 @@ void x64Int3(x64emu_t* emu) char *tmp; int post = 0; int perr = 0; - uint32_t *pu32 = NULL; + uint64_t *pu64 = NULL; const char *s = NULL; s = GetNativeName((void*)addr); if(addr==(uintptr_t)PltResolver) { @@ -160,19 +160,19 @@ void x64Int3(x64emu_t* emu) w(emu, addr); // some function never come back, so unlock the mutex first! pthread_mutex_lock(&emu->context->mutex_trace); if(post) - switch(post) { - case 1: snprintf(buff2, 63, " [%d sec %d nsec]", pu32?pu32[0]:~0u, pu32?pu32[1]:~0u); + switch(post) { // Only ever 2 for now... + case 1: snprintf(buff2, 63, " [%llu sec %llu nsec]", pu64?pu64[0]:~0ull, pu64?pu64[1]:~0ull); break; case 2: snprintf(buff2, 63, "(%s)", R_RAX?((char*)R_RAX):"nil"); break; - case 3: snprintf(buff2, 63, "(%s)", pu32?((char*)pu32):"nil"); + case 3: snprintf(buff2, 63, "(%s)", pu64?((char*)pu64):"nil"); break; case 4: snprintf(buff2, 63, " (%f)", ST0.d); break; case 5: { - uint32_t* p = (uint32_t*)R_RAX; + uint32_t* p = (uint32_t*)R_RAX; // uint64_t? (case never used) if(p) - snprintf(buff2, 63, " size=%dx%d, pitch=%d, pixels=%p", p[2], p[3], p[4], p+5); + snprintf(buff2, 63, " size=%ux%u, pitch=%u, pixels=%p", p[2], p[3], p[4], p+5); else snprintf(buff2, 63, "NULL Surface"); } diff --git a/src/emu/x64run670f.c b/src/emu/x64run670f.c index 749dfde8..1a504ac3 100644 --- a/src/emu/x64run670f.c +++ b/src/emu/x64run670f.c @@ -27,16 +27,17 @@ int Run670F(x64emu_t *emu, rex_t rex, int rep) { + (void)rep; uint8_t opcode; uint8_t nextop; - uint8_t tmp8u; - int8_t tmp8s; - int32_t tmp32s, tmp32s2; - uint32_t tmp32u, tmp32u2; - uint64_t tmp64u, tmp64u2; - reg64_t *oped, *opgd; - sse_regs_t *opex, *opgx, eax1; - mmx87_regs_t *opem, *opgm, eam1; + uint8_t tmp8u; (void)tmp8u; + int8_t tmp8s; (void)tmp8s; + int32_t tmp32s, tmp32s2; (void)tmp32s; (void)tmp32s2; + uint32_t tmp32u, tmp32u2; (void)tmp32u; (void)tmp32u2; + uint64_t tmp64u, tmp64u2; (void)tmp64u; (void)tmp64u2; + reg64_t *oped, *opgd; (void)oped; (void)opgd; + sse_regs_t *opex, *opgx, eax1; (void)eax1; + mmx87_regs_t *opem, *opgm, eam1; (void)opem; (void)opgm; (void)eam1; opcode = F8; @@ -65,4 +66,4 @@ int Run670F(x64emu_t *emu, rex_t rex, int rep) return 1; } return 0; -} \ No newline at end of file +} diff --git a/src/librarian/library_private.h b/src/librarian/library_private.h index e2d86ee7..7e8aa4d4 100755 --- a/src/librarian/library_private.h +++ b/src/librarian/library_private.h @@ -23,7 +23,7 @@ typedef struct symbol2_s { KHASH_MAP_DECLARE_STR(symbolmap, wrapper_t) KHASH_MAP_DECLARE_STR(symbol2map, symbol2_t) -KHASH_MAP_DECLARE_STR(datamap, uintptr_t) +KHASH_MAP_DECLARE_STR(datamap, uint64_t) #ifndef MAX_PATH diff --git a/src/main.c b/src/main.c index 7350f293..e50b43c8 100755 --- a/src/main.c +++ b/src/main.c @@ -539,7 +539,7 @@ void setupTraceInit() SetTraceEmu(s_trace_start, s_trace_end); printf_log(LOG_INFO, "TRACE on %s only (%p-%p)\n", p, (void*)s_trace_start, (void*)s_trace_end); } else { - printf_log(LOG_NONE, "Warning, symbol to Traced (\"%s\") not found, disabling trace\n", p); + printf_log(LOG_NONE, "Warning, symbol to trace (\"%s\") not found, disabling trace\n", p); SetTraceEmu(0, 100); // disabling trace, mostly } } @@ -583,7 +583,7 @@ void setupTrace() SetTraceEmu(s_trace_start, s_trace_end); printf_log(LOG_INFO, "TRACE on %s only (%p-%p)\n", p, (void*)s_trace_start, (void*)s_trace_end); } else { - printf_log(LOG_NONE, "Warning, symbol to Traced (\"%s\") not found, trying to set trace later\n", p); + printf_log(LOG_NONE, "Warning, symbol to trace (\"%s\") not found, trying to set trace later\n", p); SetTraceEmu(0, 1); // disabling trace, mostly trace_func = strdup(p); } diff --git a/src/wrapped/wrappedlib_init.h b/src/wrapped/wrappedlib_init.h index c9fe03a9..a3a2049c 100755 --- a/src/wrapped/wrappedlib_init.h +++ b/src/wrapped/wrappedlib_init.h @@ -85,7 +85,7 @@ static const map_onedata_t MAPNAME(mydatamap)[] = { int FUNC(_init)(library_t* lib, box64context_t* box64) { (void)box64; - + // Init first free(lib->path); lib->path=NULL; #ifdef PRE_INIT @@ -171,7 +171,7 @@ int FUNC(_init)(library_t* lib, box64context_t* box64) #ifdef CUSTOM_INIT CUSTOM_INIT #endif - + return 0; } |