@@ -2582,7 +2582,7 @@ set_pioinfo_extra(void)
2582
2582
char * p = (char * )get_proc_address (UCRTBASE , "_isatty" , NULL );
2583
2583
/* _osfile(fh) & FDEV */
2584
2584
2585
- #ifdef _M_ARM64
2585
+ #if defined( _M_ARM64 ) || defined( __aarch64__ )
2586
2586
#define IS_INSN (pc , name ) ((*(pc) & name##_mask) == name##_id)
2587
2587
const int max_num_inst = 500 ;
2588
2588
uint32_t * start = (uint32_t * )p ;
@@ -2664,15 +2664,21 @@ set_pioinfo_extra(void)
2664
2664
# else /* x86 */
2665
2665
/* pop ebp */
2666
2666
# define FUNCTION_BEFORE_RET_MARK "\x5d"
2667
+ /* leave */
2668
+ # define FUNCTION_BEFORE_RET_MARK_2 "\xc9"
2667
2669
# define FUNCTION_SKIP_BYTES 0
2668
2670
/* mov eax,dword ptr [eax*4+100EB430h] */
2669
2671
# define PIOINFO_MARK "\x8B\x04\x85"
2670
2672
# endif
2671
2673
if (p ) {
2672
- for (pend += 10 ; pend < p + 300 ; pend ++ ) {
2674
+ for (pend += 10 ; pend < p + 500 ; pend ++ ) {
2673
2675
// find end of function
2674
- if (memcmp (pend , FUNCTION_BEFORE_RET_MARK , sizeof (FUNCTION_BEFORE_RET_MARK ) - 1 ) == 0 &&
2675
- (* (pend + (sizeof (FUNCTION_BEFORE_RET_MARK ) - 1 ) + FUNCTION_SKIP_BYTES ) & FUNCTION_RET ) == FUNCTION_RET ) {
2676
+ if ((memcmp (pend , FUNCTION_BEFORE_RET_MARK , sizeof (FUNCTION_BEFORE_RET_MARK ) - 1 ) == 0
2677
+ # ifdef FUNCTION_BEFORE_RET_MARK_2
2678
+ || memcmp (pend , FUNCTION_BEFORE_RET_MARK_2 , sizeof (FUNCTION_BEFORE_RET_MARK_2 ) - 1 ) == 0
2679
+ # endif
2680
+ ) &&
2681
+ * (pend + (sizeof (FUNCTION_BEFORE_RET_MARK ) - 1 ) + FUNCTION_SKIP_BYTES ) == (char )FUNCTION_RET ) {
2676
2682
// search backwards from end of function
2677
2683
for (pend -= (sizeof (PIOINFO_MARK ) - 1 ); pend > p ; pend -- ) {
2678
2684
if (memcmp (pend , PIOINFO_MARK , sizeof (PIOINFO_MARK ) - 1 ) == 0 ) {
0 commit comments