* * * * *

             I don't think anybody actually uses this instruction

Odd.

The runtime code for DynASM [1] looks a bit … odd, and I was curious what
Valgrind [2] had to say about it.

> [spc]lucy:~/source/jit>valgrind ./calc
> ==15664== Memcheck, a memory error detector.
> ==15664== Copyright (C) 2002-2005, and GNU GPL'd, by Julian Seward et al.
> ==15664== Using LibVEX rev 1575, a library for dynamic binary translation.
> ==15664== Copyright (C) 2004-2005, and GNU GPL'd, by OpenWorks LLP.
> ==15664== Using valgrind-3.1.1, a dynamic binary instrumentation framework.
> ==15664== Copyright (C) 2000-2005, and GNU GPL'd, by Julian Seward et al.
> ==15664== For more details, rerun with: -v
> ==15664==
> x = 1 - 0
> vex x86->IR: unhandled instruction bytes: 0xCE 0x66 0xA3 0xCE
> ==15664== Your program just tried to execute an instruction that Valgrind
> ==15664== did not recognise.  There are two possible reasons for this.
> ==15664== 1. Your program has a bug and erroneously jumped to a non-code
> ==15664==    location.  If you are running Memcheck and you just saw a
> ==15664==    warning about a bad jump, it's probably your program's fault.
> ==15664== 2. The instruction is legitimate but Valgrind doesn't handle it,
> ==15664==    i.e. it's Valgrind's fault.  If you think this is the case or
> ==15664==    you are not sure, please let us know.
> ==15664== Either way, Valgrind will now raise a SIGILL signal which will
> ==15664== probably kill your program.
> ==15664== Use of uninitialised value of size 4
> ==15664==    at 0xBC945C: _itoa_word (in /lib/tls/libc-2.3.4.so)
> ==15664==    by 0xBCCA09: vfprintf (in /lib/tls/libc-2.3.4.so)
> ==15664==    by 0xBE5ACA: vsprintf (in /lib/tls/libc-2.3.4.so)
> ==15664==    by 0xBD2DEA: sprintf (in /lib/tls/libc-2.3.4.so)
> ==15664==    by 0x804ACA3: crashreport_hexdump (crashreport.c:154)
> ==15664==    by 0x804B2BD: crashreport_handler (crashreport.c:388)
> ==15664==    by 0xBB79AF: (within /lib/tls/libc-2.3.4.so)
> ==15664==    by 0x804A9DD: main (calc.dasc:472)
> ==15664==
> ==15664== Conditional jump or move depends on uninitialised value(s)
> ==15664==    at 0xBC9462: _itoa_word (in /lib/tls/libc-2.3.4.so)
> ==15664==    by 0xBCCA09: vfprintf (in /lib/tls/libc-2.3.4.so)
> ==15664==    by 0xBE5ACA: vsprintf (in /lib/tls/libc-2.3.4.so)
> ==15664==    by 0xBD2DEA: sprintf (in /lib/tls/libc-2.3.4.so)
> ==15664==    by 0x804ACA3: crashreport_hexdump (crashreport.c:154)
> ==15664==    by 0x804B2BD: crashreport_handler (crashreport.c:388)
> ==15664==    by 0xBB79AF: (within /lib/tls/libc-2.3.4.so)
> ==15664==    by 0x804A9DD: main (calc.dasc:472)
> ==15664==
> ==15664== Use of uninitialised value of size 4
> ==15664==    at 0xBC9474: _itoa_word (in /lib/tls/libc-2.3.4.so)
> ==15664==    by 0xBCCA09: vfprintf (in /lib/tls/libc-2.3.4.so)
> ==15664==    by 0xBE5ACA: vsprintf (in /lib/tls/libc-2.3.4.so)
> ==15664==    by 0xBD2DEA: sprintf (in /lib/tls/libc-2.3.4.so)
> ==15664==    by 0x804ACA3: crashreport_hexdump (crashreport.c:154)
> ==15664==    by 0x804B2BD: crashreport_handler (crashreport.c:388)
> ==15664==    by 0xBB79AF: (within /lib/tls/libc-2.3.4.so)
> ==15664==    by 0x804A9DD: main (calc.dasc:472)
> ==15664==
> ==15664== Use of uninitialised value of size 4
> ==15664==    at 0x804ACC0: crashreport_hexdump (crashreport.c:155)
> ==15664==    by 0x804B2BD: crashreport_handler (crashreport.c:388)
> ==15664==    by 0xBB79AF: (within /lib/tls/libc-2.3.4.so)
> ==15664==    by 0x804A9DD: main (calc.dasc:472)
>   not in syscall (0xB0044ADC - 0xB0044B31)
>
> valgrind: m_syswrap/syswrap-main.c:606 (vgPlain_client_syscall): Assertion 'sci->status.what == SsIdle' failed.
> ==15664==    at 0xB000E029: report_and_quit (m_libcassert.c:122)
> ==15664==    by 0xB000E1C2: vgPlain_assert_fail (m_libcassert.c:185)
> ==15664==    by 0xB003AEA6: vgPlain_client_syscall (syswrap-main.c:606)
> ==15664==    by 0xB002C826: handle_syscall (scheduler.c:623)
> ==15664==    by 0xB002CAED: vgPlain_scheduler (scheduler.c:726)
> ==15664==    by 0xB0014568: final_tidyup (m_main.c:2716)
> ==15664==    by 0xB00141C9: shutdown_actions_NORETURN (m_main.c:2578)
> ==15664==    by 0xB003C2D5: run_a_thread_NORETURN (syswrap-linux.c:139)
>
> sched status:
>   running_tid=1
>
> Thread 1: status = VgTs_Runnable
> ==15664==    at 0xD080B5: pthread_once (in /lib/tls/libpthread-2.3.4.so)
> ==15664==    by 0xC9BB76: free_mem (in /lib/tls/libc-2.3.4.so)
> ==15664==    by 0xC9B811: __libc_freeres (in /lib/tls/libc-2.3.4.so)
> ==15664==    by 0x4000336: _vgw_freeres (vg_preloaded.c:62)
> ==15664==    by 0xBB78C4: raise (in /lib/tls/libc-2.3.4.so)
> ==15664==    by 0x804B3E7: crashreport_handler (crashreport.c:495)
> ==15664==    by 0xBB79AF: (within /lib/tls/libc-2.3.4.so)
> ==15664==    by 0x804A9DD: main (calc.dasc:472)
>
>
> Note: see also the FAQ.txt in the source distribution.
> It contains workarounds to several common problems.
>
> If that doesn't help, please report this bug to: www.valgrind.org
>
> In the bug report, send all the above text, the valgrind
> version, and what Linux distro you are using.  Thanks.
>
> [spc]lucy:~/source/jit>
>

Really Valgrind? You don't support the INTO opcode? Wow …

[1] http://luajit.org/dynasm.html
[2] http://valgrind.org/

Email author at [email protected]