On 18/04/2023 17:46, folkert wrote:
The 2 calls it does are:

print_char:
     movb (%esi), %al
     movb %al, buffer
     movl $4, %eax
     movl $1, %ebx
     movl $buffer, %ecx
     movl $1, %edx
     int  $0x80
     ret

exit:
     movl $1, %eax
     movl $0, %ebx
     int  $0x80

Valgrind can't run just any executable binary. It has quite a lot of hard coded limitations that correspont (mostly) to what compilers and link editors will produce. So if you use assembler and use opcodes not normally generated by compilers then it won't work.

The code that handles this is

   case 0xCD: /* INT imm8 */
      d64 = getUChar(delta); delta++;

      /* Handle int $0xD2 (Solaris fasttrap syscalls). */
      if (d64 == 0xD2) {
         jmp_lit(dres, Ijk_Sys_int210, guest_RIP_bbstart + delta);
         vassert(dres->whatNext == Dis_StopHere);
         DIP("int $0xD2\n");
         return delta;
      }
      goto decode_failure;

So int 0x80 results in a decode error.

Can you use syscall?


A+

Paul





_______________________________________________
Valgrind-users mailing list
Valgrind-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to