Re: Unhandled instruction bytes: 0xD9 0xD0 (fnop)

Alexandra Petlanova Hajkova via Valgrind-users <[email protected]> Thu, 15 Jan 2026 15:15:01 +0100
Newsgroups gmane.comp.debugging.valgrind
Message-ID <CAJVr-EPuRsBm6xMH7Kgusb6osTzgdGfj8e_7TybGjKYXa9f4_A@mail.gmail.com>
--===============8573534287065523817==
Content-Type: multipart/alternative; boundary="0000000000006906b806486ddc55"

--0000000000006906b806486ddc55
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Thu, Jan 15, 2026 at 12:10=E2=80=AFPM Mark <[email protected]> wrote:

> I am trying to port a legacy windows 32-bit delphi application (a 3d
> fractal image generator) to free pascal on linux. The application loads
> fractal formulas as machine code at runtime into memory for execution. Th=
e
> origin of the machine code is unclear, it may be written by hand or
> generated by unknown compilers, so I can't easily change it. When testing
> the ported application with valgrind I often encounter this message when
> the external code is loaded:
>
> vex x86->IR: unhandled instruction bytes: 0xD9 0xD0 0xE9 0xAA
> =3D=3D00:00:00:01.399 55074=3D=3D valgrind: Unrecognised instruction at a=
ddress
> 0x405e01a.
>
> The sequence 0xd9 0xd0 is fnop in intel x86. Checking bugzilla I found tw=
o
> related bugs:
>
>    https://bugs.kde.org/show_bug.cgi?id=3D126256
>    https://bugs.kde.org/show_bug.cgi?id=3D253446
>
> There is also a reference to fnop in the valgrind git repo in
> docs/internals/3_1_BUGSTATUS.txt (the bug number mentioned there is 12526=
5
> but that is perhaps just a typo because it refers to a kmail bug).
>
> I can reproduce the issue within valgrind (git master@758b0f55e) with the
> following test:
>
> diff --git a/none/tests/x86/insn_fpu.def b/none/tests/x86/insn_fpu.def
> index 590f5844c..f5a8d61c4 100644
> --- a/none/tests/x86/insn_fpu.def
> +++ b/none/tests/x86/insn_fpu.def
> @@ -1,3 +1,4 @@
> +fnop
>   fabs st0.ps[1234.5678] : =3D> st0.ps[1234.5678]
>   fabs st0.ps[-1234.5678] : =3D> st0.ps[1234.5678]
>   fabs st0.pd[12345678.87654321] : =3D> st0.pd[12345678.87654321]
> diff --git a/none/tests/x86/insn_fpu.stdout.exp
> b/none/tests/x86/insn_fpu.stdout.exp
> index 67128c13b..f5f4a161f 100644
> --- a/none/tests/x86/insn_fpu.stdout.exp
> +++ b/none/tests/x86/insn_fpu.stdout.exp
> @@ -1,3 +1,4 @@
> +fnop_1 ... ok
>   fabs_1 ... ok
>   fabs_2 ... ok
>   fabs_3 ... ok
>
> This patch fixes the issue and lets the test pass (both in valgrind and m=
y
> application):
>
> diff --git a/VEX/priv/guest_x86_toIR.c b/VEX/priv/guest_x86_toIR.c
> index bd4ccd54b..710905ad1 100644
> --- a/VEX/priv/guest_x86_toIR.c
> +++ b/VEX/priv/guest_x86_toIR.c
> @@ -4204,6 +4204,10 @@ UInt dis_FPU ( Bool* decode_ok, UChar sorb, Int
> delta )
>                  put_ST_UNCHECKED(r_src, mkexpr(t1));
>                  break;
>
> +            case 0xD0: /* FNOP */
> +               DIP("fnop\n");
> +               break;
> +
>               case 0xE0: /* FCHS */
>                  DIP("fchs\n");
>                  put_ST_UNCHECKED(0, unop(Iop_NegF64, get_ST(0)));
>
> The complete patch is included at the end of this mail including the same
> fix and regression test also for amd64 and a fix for the documentation
> typo. Would that be a proper solution or am I missing something?
>
> Thanks,
> Mark
>
> Hi Mark,


Thank you for your contribution, this looks like a correct fix. I would
suggest attaching it to one of the bugs you have mentioned.

Thank you,
Alexandra

--0000000000006906b806486ddc55
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"ltr"><br></div><br><div class=3D"gmail_quote g=
mail_quote_container"><div dir=3D"ltr" class=3D"gmail_attr">On Thu, Jan 15,=
 2026 at 12:10=E2=80=AFPM Mark &lt;<a href=3D"mailto:[email protected]">mark@=
zbuffer.de</a>&gt; wrote:<br></div><blockquote class=3D"gmail_quote" style=
=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding=
-left:1ex"><div>I am trying to port a legacy windows 32-bit delphi applicat=
ion (a 3d fractal image generator) to free pascal on linux. The application=
 loads fractal formulas as machine code at runtime into memory for executio=
n. The origin of the machine code is unclear, it may be written by hand or =
generated by unknown compilers, so I can&#39;t easily change it. When testi=
ng the ported application with valgrind I often encounter this message when=
 the external code is loaded:<br>
<br>
vex x86-&gt;IR: unhandled instruction bytes: 0xD9 0xD0 0xE9 0xAA<br>
=3D=3D00:00:00:01.399 55074=3D=3D valgrind: Unrecognised instruction at add=
ress 0x405e01a.<br>
<br>
The sequence 0xd9 0xd0 is fnop in intel x86. Checking bugzilla I found two =
related bugs:<br>
<br>
=C2=A0 =C2=A0<a href=3D"https://bugs.kde.org/show_bug.cgi?id=3D126256" rel=
=3D"noreferrer" target=3D"_blank">https://bugs.kde.org/show_bug.cgi?id=3D12=
6256</a><br>
=C2=A0 =C2=A0<a href=3D"https://bugs.kde.org/show_bug.cgi?id=3D253446" rel=
=3D"noreferrer" target=3D"_blank">https://bugs.kde.org/show_bug.cgi?id=3D25=
3446</a><br>
<br>
There is also a reference to fnop in the valgrind git repo in docs/internal=
s/3_1_BUGSTATUS.txt (the bug number mentioned there is 125265 but that is p=
erhaps just a typo because it refers to a kmail bug).<br>
<br>
I can reproduce the issue within valgrind (git master@758b0f55e) with the f=
ollowing test:<br>
<br>
diff --git a/none/tests/x86/insn_fpu.def b/none/tests/x86/insn_fpu.def<br>
index 590f5844c..f5a8d61c4 100644<br>
--- a/none/tests/x86/insn_fpu.def<br>
+++ b/none/tests/x86/insn_fpu.def<br>
@@ -1,3 +1,4 @@<br>
+fnop<br>
=C2=A0 fabs <a href=3D"http://st0.ps" rel=3D"noreferrer" target=3D"_blank">=
st0.ps</a>[1234.5678] : =3D&gt; <a href=3D"http://st0.ps" rel=3D"noreferrer=
" target=3D"_blank">st0.ps</a>[1234.5678]<br>
=C2=A0 fabs <a href=3D"http://st0.ps" rel=3D"noreferrer" target=3D"_blank">=
st0.ps</a>[-1234.5678] : =3D&gt; <a href=3D"http://st0.ps" rel=3D"noreferre=
r" target=3D"_blank">st0.ps</a>[1234.5678]<br>
=C2=A0 fabs st0.pd[12345678.87654321] : =3D&gt; st0.pd[12345678.87654321]<b=
r>
diff --git a/none/tests/x86/insn_fpu.stdout.exp b/none/tests/x86/insn_fpu.s=
tdout.exp<br>
index 67128c13b..f5f4a161f 100644<br>
--- a/none/tests/x86/insn_fpu.stdout.exp<br>
+++ b/none/tests/x86/insn_fpu.stdout.exp<br>
@@ -1,3 +1,4 @@<br>
+fnop_1 ... ok<br>
=C2=A0 fabs_1 ... ok<br>
=C2=A0 fabs_2 ... ok<br>
=C2=A0 fabs_3 ... ok<br>
<br>
This patch fixes the issue and lets the test pass (both in valgrind and my =
application):<br>
<br>
diff --git a/VEX/priv/guest_x86_toIR.c b/VEX/priv/guest_x86_toIR.c<br>
index bd4ccd54b..710905ad1 100644<br>
--- a/VEX/priv/guest_x86_toIR.c<br>
+++ b/VEX/priv/guest_x86_toIR.c<br>
@@ -4204,6 +4204,10 @@ UInt dis_FPU ( Bool* decode_ok, UChar sorb, Int delt=
a )<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0put_ST_UNCHEC=
KED(r_src, mkexpr(t1));<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0break;<br>
<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 case 0xD0: /* FNOP */<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0DIP(&quot;fnop\n&qu=
ot;);<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0break;<br>
+<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 case 0xE0: /* FCHS */<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0DIP(&quot;fch=
s\n&quot;);<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0put_ST_UNCHEC=
KED(0, unop(Iop_NegF64, get_ST(0)));<br>
<br>
The complete patch is included at the end of this mail including the same f=
ix and regression test also for amd64 and a fix for the documentation typo.=
 Would that be a proper solution or am I missing something?<br>
<br>
Thanks,<br>
Mark<br><br></div>Hi Mark,</blockquote><div><br></div><div>Thank you for yo=
ur contribution,=C2=A0this looks like a correct=C2=A0fix. I would suggest a=
ttaching it to one of the bugs you have mentioned.=C2=A0</div><div><br></di=
v><div>Thank you,</div><div>Alexandra</div></div></div>

--0000000000006906b806486ddc55--



--===============8573534287065523817==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline


--===============8573534287065523817==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Valgrind-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/valgrind-users

--===============8573534287065523817==--