From 8966312785e30272de6f7453e7662a7bb05bc331 Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Wed, 2 Mar 2011 00:41:38 -0800 Subject: [PATCH] X86: Decode the mysterious and elusive ffreep x87 instruction. The internet says this instruction was created by accident when an Intel CPU failed to decode x87 instructions properly. It's been documented on a few rare occasions and has generally worked to ensure backwards compatability. One source claims that the gcc toolchain is basically the only thing that emits it, and that emulators/binary translators like qemu and bochs implement it. We won't actually implement it here since we're hardly implementing any other x87 instructions either. If we were to implement it, it would behave the same as ffree but then also pop the register stack. http://www.pagetable.com/?p=16 --- src/arch/x86/isa/decoder/x87.isa | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/arch/x86/isa/decoder/x87.isa b/src/arch/x86/isa/decoder/x87.isa index e44a18f65..ace96fbf6 100644 --- a/src/arch/x86/isa/decoder/x87.isa +++ b/src/arch/x86/isa/decoder/x87.isa @@ -291,7 +291,9 @@ format WarnUnimpl { //0x7: esc7(); 0x7: decode MODRM_REG { 0x0: decode MODRM_MOD { - 0x3: Inst::UD2(); + // The ffreep instruction isn't entirely real. It should work + // the same as ffree but then also pop the register stack. + 0x3: ffreep(); default: fild(); } 0x1: decode MODRM_MOD { -- 2.30.2