about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorrajdakin <rajdakin@gmail.com>2021-04-14 14:16:21 +0200
committerrajdakin <rajdakin@gmail.com>2021-04-14 14:25:02 +0200
commitcdf71c4cbc8c07510708cb7396cd1035300f587f (patch)
tree8d790b143339b5b910594dd919754622b0885d40 /src
parente93a280d2c94476df79f586ed352cb68f3a28867 (diff)
downloadbox64-cdf71c4cbc8c07510708cb7396cd1035300f587f.tar.gz
box64-cdf71c4cbc8c07510708cb7396cd1035300f587f.zip
Oops-es
Diffstat (limited to 'src')
-rwxr-xr-xsrc/dynarec/dynarec_arm64_helper.c2
-rwxr-xr-xsrc/elfs/elfloader.c14
-rwxr-xr-xsrc/emu/x64int3.c12
-rw-r--r--src/emu/x64run670f.c19
-rwxr-xr-xsrc/librarian/library_private.h2
-rwxr-xr-xsrc/main.c4
-rwxr-xr-xsrc/wrapped/wrappedlib_init.h4
7 files changed, 30 insertions, 27 deletions
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;
 }