diff options
| author | ptitSeb <sebastien.chev@gmail.com> | 2024-10-04 13:12:37 +0200 |
|---|---|---|
| committer | ptitSeb <sebastien.chev@gmail.com> | 2024-10-04 13:12:37 +0200 |
| commit | 681c6f4e5ea62728590d82b3876978c76bff4c5f (patch) | |
| tree | d6404c24c19cfd378a70aadfa902751a2fcac3f5 /src | |
| parent | 11f1c3c4ff30ddf97de052668e42f10185d47e31 (diff) | |
| download | box64-681c6f4e5ea62728590d82b3876978c76bff4c5f.tar.gz box64-681c6f4e5ea62728590d82b3876978c76bff4c5f.zip | |
[TRACE] Btter trace for ioctl
Diffstat (limited to 'src')
| -rw-r--r-- | src/emu/x64int3.c | 15 | ||||
| -rwxr-xr-x | src/emu/x86int3.c | 4 | ||||
| -rw-r--r-- | src/wrapped32/generated/functions_list.txt | 1 | ||||
| -rw-r--r-- | src/wrapped32/generated/wrapper32.c | 2 | ||||
| -rw-r--r-- | src/wrapped32/generated/wrapper32.h | 1 | ||||
| -rwxr-xr-x | src/wrapped32/wrappedlibc_private.h | 2 |
6 files changed, 12 insertions, 13 deletions
diff --git a/src/emu/x64int3.c b/src/emu/x64int3.c index 2f2ce756..697fe19f 100644 --- a/src/emu/x64int3.c +++ b/src/emu/x64int3.c @@ -157,7 +157,7 @@ void x64Int3(x64emu_t* emu, uintptr_t* addr) perr = 2; } else if (!strcmp(s, "__openat64") || !strcmp(s, "openat64") || !strcmp(s, "__openat64_2")) { tmp = (char*)(R_RSI); - snprintf(buff, 256, "%04d|%p: Calling %s(%d, \"%s\", %d (,%d))", tid, *(void**)(R_RSP), s, (int)R_EDI, (tmp)?tmp:"(nil)", (int)(R_EDX), (int)(R_ECX)); + snprintf(buff, 256, "%04d|%p: Calling %s(%d, \"%s\", %d (,%d))", tid, *(void**)(R_RSP), s, S_EDI, (tmp)?tmp:"(nil)", (int)(R_EDX), (int)(R_ECX)); perr = 1; } else if (!strcmp(s, "readlink")) { tmp = (char*)(R_RDI); @@ -195,11 +195,14 @@ void x64Int3(x64emu_t* emu, uintptr_t* addr) snprintf(buff, 256, "%04d|%p: Calling %s(%d, %p, %d)", tid, *(void**)(R_RSP), s, R_EDI, pu32, R_EDX); perr = 1; post = 6; + } else if (!strcmp(s, "ioctl")) { + snprintf(buff, 256, "%04d|%p: Calling %s(%d, 0x%x, %p)", tid, *(void**)(R_RSP), s, S_EDI, R_ESI, (void*)R_RDX); + perr = 1; } else if (!strcmp(s, "lseek64")) { - snprintf(buff, 256, "%04d|%p: Calling %s(%d, %ld, %d)", tid, *(void**)(R_RSP), s, (int)R_EDI, (int64_t)R_RSI, (int)R_EDX); + snprintf(buff, 256, "%04d|%p: Calling %s(%d, %ld, %d)", tid, *(void**)(R_RSP), s, S_EDI, (int64_t)R_RSI, S_EDX); perr = 1; } else if (!strcmp(s, "lseek")) { - snprintf(buff, 256, "%04d|%p: Calling %s(%d, %ld, %d)", tid, *(void**)(R_RSP), s, (int)R_EDI, (int64_t)R_RSI, (int)R_EDX); + snprintf(buff, 256, "%04d|%p: Calling %s(%d, %ld, %d)", tid, *(void**)(R_RSP), s, S_EDI, (int64_t)R_RSI, S_EDX); perr = 1; } else if (!strcmp(s, "recvmsg")) { snprintf(buff, 256, "%04d|%p: Calling %s(%d, %p, 0x%x)", tid, *(void**)(R_RSP), s, R_EDI, (void*)R_RSI, R_EDX); @@ -214,7 +217,7 @@ void x64Int3(x64emu_t* emu, uintptr_t* addr) tmp = (char*)(R_RDI); snprintf(buff, 256, "%04d|%p: Calling %s(\"%s\")", tid, *(void**)(R_RSP), s, (tmp)?tmp:"(nil)"); } else if (!strcmp(s, "syscall")) { - snprintf(buff, 256, "%04d|%p: Calling %s(%d, %p, %p....)", tid, *(void**)(R_RSP), s, (int)R_EDI, (void*)R_RSI, (void*)R_RDX); + snprintf(buff, 256, "%04d|%p: Calling %s(%d, %p, %p....)", tid, *(void**)(R_RSP), s, S_EDI, (void*)R_RSI, (void*)R_RDX); perr = 1; } else if (strstr(s, "strlen")==s) { tmp = (char*)(R_RDI); @@ -295,7 +298,7 @@ void x64Int3(x64emu_t* emu, uintptr_t* addr) snprintf(buff, 256, "%04d|%p: Calling %s(%p, %p, %d, %d, %d, %d, %p)", tid, *(void**)(R_RSP), s, (void*)R_RDI, (void*)R_RSI, R_EDX, R_ECX, R_R8d, R_R9d, *(void**)(R_RSP+8)); } else if (!strcmp(s, "mmap64") || !strcmp(s, "mmap")) { snprintf(buff, 256, "%04d|%p: Calling %s(%p, 0x%lx, 0x%x, 0x%x, %d, %ld)", tid, *(void**)(R_RSP), s, - (void*)R_RDI, R_RSI, (int)(R_RDX), (int)R_RCX, (int)R_R8, R_R9); + (void*)R_RDI, R_RSI, (int)(R_RDX), S_RCX, S_R8, R_R9); perr = 3; } else if (!strcmp(s, "sscanf")) { tmp = (char*)(R_RSI); @@ -306,7 +309,7 @@ void x64Int3(x64emu_t* emu, uintptr_t* addr) } else if (!strcmp(s, "XCreateWindow")) { tmp = (char*)(R_RSI); snprintf(buff, 256, "%04d|%p: Calling %s(%p, %p, %d, %d, %u, %u, %u, %d, %u, %p, 0x%lx, %p)", tid, *(void**)(R_RSP), s, - (void*)R_RDI, (void*)R_RSI, (int)R_EDX, (int)R_ECX, R_R8d, R_R9d, + (void*)R_RDI, (void*)R_RSI, S_EDX, S_ECX, R_R8d, R_R9d, (uint32_t)*(uint64_t*)(R_RSP+8), (int)*(uint64_t*)(R_RSP+16), (uint32_t)*(uint64_t*)(R_RSP+24), (void*)*(uint64_t*)(R_RSP+32), (unsigned long)*(uint64_t*)(R_RSP+40), (void*)*(uint64_t*)(R_RSP+48)); diff --git a/src/emu/x86int3.c b/src/emu/x86int3.c index 3455eda1..f2055f1d 100755 --- a/src/emu/x86int3.c +++ b/src/emu/x86int3.c @@ -428,11 +428,11 @@ void x86Int3(x64emu_t* emu, uintptr_t* addr) snprintf(buff2, 63, "%s", "here"); break; } - if(perr==1 && ((int)R_EAX)<0) + if(perr==1 && (S_EAX)<0) snprintf(buff3, 63, " (errno=%d:\"%s\")", errno, strerror(errno)); else if(perr==2 && R_EAX==0) snprintf(buff3, 63, " (errno=%d:\"%s\")", errno, strerror(errno)); - else if(perr==3 && ((int)R_EAX)==-1) + else if(perr==3 && (S_EAX)==-1) snprintf(buff3, 63, " (errno=%d:\"%s\")", errno, strerror(errno)); if(cycle_log) { if(ret_fmt==1) diff --git a/src/wrapped32/generated/functions_list.txt b/src/wrapped32/generated/functions_list.txt index e6e8a22d..6c46f0ff 100644 --- a/src/wrapped32/generated/functions_list.txt +++ b/src/wrapped32/generated/functions_list.txt @@ -332,7 +332,6 @@ #() iFiup -> iFiup #() iFill -> iFill #() iFiLi -> iFiLi -#() iFiLN -> iFiLN #() iFipi -> iFipi #() iFipu -> iFipu #() iFipL -> iFipL diff --git a/src/wrapped32/generated/wrapper32.c b/src/wrapped32/generated/wrapper32.c index f7dd7f82..100c9125 100644 --- a/src/wrapped32/generated/wrapper32.c +++ b/src/wrapped32/generated/wrapper32.c @@ -422,7 +422,6 @@ typedef int32_t (*iFiuu_t)(int32_t, uint32_t, uint32_t); typedef int32_t (*iFiup_t)(int32_t, uint32_t, void*); typedef int32_t (*iFill_t)(int32_t, intptr_t, intptr_t); typedef int32_t (*iFiLi_t)(int32_t, uintptr_t, int32_t); -typedef int32_t (*iFiLN_t)(int32_t, uintptr_t, ...); typedef int32_t (*iFipi_t)(int32_t, void*, int32_t); typedef int32_t (*iFipu_t)(int32_t, void*, uint32_t); typedef int32_t (*iFipL_t)(int32_t, void*, uintptr_t); @@ -1544,7 +1543,6 @@ void iFiuu_32(x64emu_t *emu, uintptr_t fcn) { iFiuu_t fn = (iFiuu_t)fcn; R_EAX = void iFiup_32(x64emu_t *emu, uintptr_t fcn) { iFiup_t fn = (iFiup_t)fcn; R_EAX = fn(from_ptri(int32_t, R_ESP + 4), from_ptri(uint32_t, R_ESP + 8), from_ptriv(R_ESP + 12)); } void iFill_32(x64emu_t *emu, uintptr_t fcn) { iFill_t fn = (iFill_t)fcn; R_EAX = fn(from_ptri(int32_t, R_ESP + 4), from_long(from_ptri(long_t, R_ESP + 8)), from_long(from_ptri(long_t, R_ESP + 12))); } void iFiLi_32(x64emu_t *emu, uintptr_t fcn) { iFiLi_t fn = (iFiLi_t)fcn; R_EAX = fn(from_ptri(int32_t, R_ESP + 4), from_ulong(from_ptri(ulong_t, R_ESP + 8)), from_ptri(int32_t, R_ESP + 12)); } -void iFiLN_32(x64emu_t *emu, uintptr_t fcn) { iFiLN_t fn = (iFiLN_t)fcn; R_EAX = fn(from_ptri(int32_t, R_ESP + 4), from_ulong(from_ptri(ulong_t, R_ESP + 8)), from_ptriv(R_ESP + 12)); } void iFipi_32(x64emu_t *emu, uintptr_t fcn) { iFipi_t fn = (iFipi_t)fcn; R_EAX = fn(from_ptri(int32_t, R_ESP + 4), from_ptriv(R_ESP + 8), from_ptri(int32_t, R_ESP + 12)); } void iFipu_32(x64emu_t *emu, uintptr_t fcn) { iFipu_t fn = (iFipu_t)fcn; R_EAX = fn(from_ptri(int32_t, R_ESP + 4), from_ptriv(R_ESP + 8), from_ptri(uint32_t, R_ESP + 12)); } void iFipL_32(x64emu_t *emu, uintptr_t fcn) { iFipL_t fn = (iFipL_t)fcn; R_EAX = fn(from_ptri(int32_t, R_ESP + 4), from_ptriv(R_ESP + 8), from_ulong(from_ptri(ulong_t, R_ESP + 12))); } diff --git a/src/wrapped32/generated/wrapper32.h b/src/wrapped32/generated/wrapper32.h index 5824e2cb..74f03656 100644 --- a/src/wrapped32/generated/wrapper32.h +++ b/src/wrapped32/generated/wrapper32.h @@ -373,7 +373,6 @@ void iFiuu_32(x64emu_t *emu, uintptr_t fnc); void iFiup_32(x64emu_t *emu, uintptr_t fnc); void iFill_32(x64emu_t *emu, uintptr_t fnc); void iFiLi_32(x64emu_t *emu, uintptr_t fnc); -void iFiLN_32(x64emu_t *emu, uintptr_t fnc); void iFipi_32(x64emu_t *emu, uintptr_t fnc); void iFipu_32(x64emu_t *emu, uintptr_t fnc); void iFipL_32(x64emu_t *emu, uintptr_t fnc); diff --git a/src/wrapped32/wrappedlibc_private.h b/src/wrapped32/wrappedlibc_private.h index 25aaa4c4..ee4f43da 100755 --- a/src/wrapped32/wrappedlibc_private.h +++ b/src/wrapped32/wrappedlibc_private.h @@ -718,7 +718,7 @@ GO(inotify_rm_watch, iFii) //DATA(_IO_2_1_stdout_, 152) //GO(_IO_adjust_column, uFupi) // _IO_adjust_wcolumn -GO(ioctl, iFiLN) //the vararg is just to have optional arg of various type, but only 1 arg +GO(ioctl, iFiip) //the vararg is just to have optional arg of various type, but only 1 arg //GO(_IO_default_doallocate, iFS) //GO(_IO_default_finish, vFSi) //GO(_IO_default_pbackfail, iFSi) |