переменная stat_loc в функции waitpid c - PullRequest
0 голосов
/ 20 мая 2018

У меня есть код, и я не понимаю переменную stat_loc сравнить 127 (0x7f), затем сравнить 5. Можете ли вы объяснить мне ???Большое спасибо !!

int __fastcall m_loop(__int64 Input)
{
      int result;
      int stat_loc; 
      void *v3;
      __pid_t pid_child; 
      void *nanomites_addr;
      stat_loc = 0;
      nanomites_addr = mmap(0LL, 0x141, 7, 34, -1, 0);
      pid_child = fork();
      if ( !pid_child )`// This is the child process`
      {                                             
            if ( ptrace(0, 0LL, 0LL, 0LL) == -1 )
              {   puts("So you want to trace me?!");
                  exit(42);
              }
            v3 = nanomites_addr;
            ((void (__fastcall *)(__int64))nanomites_addr)(Input);
                                       /* Call the first nanomite,
                                          xor rax, rax
                                          xor rcx, rcx
                                          xor rbx, rbx
                                          mov al, byte ptr[rdi]
                                          int 3 */
            exit(0);
      }
      while ( waitpid(pid_child, &stat_loc, 0) != -1 ) // This is in the parent
      {
       if ( (stat_loc == 127 )
           {
               if ( BYTE1(stat_loc) == 5 )
                   parent_read_regs(nanomites_addr, pid_child);
               ptrace(PTRACE_CONT, pid_child, 0, 0);
           }
      }
if ( BYTE1(stat_loc) )
   result = puts("You lost !");
else
   result = puts("You win! ");

Это файл изображения для функции parent_read_regs ()

...