ia64/xen-unstable

changeset 17180:771c7124bf38

x86_emulate: Emit emulated forms of most FPU instructions as '.byte
xx,yy'. This is arguably clearer than using the mnemonic opcode, since
it is more clearly the instruction we have just decoded. Furthermore,
gas likes to reverse FPU operands on some two-operand FPU instructions
for historical reasons. Finally, 'byte xx,yy' is potentially more
amenable to further macro-isation down the road.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Tue Mar 04 10:32:13 2008 +0000 (2008-03-04)
parents f76f151a7431
children 017927162815
files xen/arch/x86/x86_emulate.c
line diff
     1.1 --- a/xen/arch/x86/x86_emulate.c	Tue Mar 04 09:35:08 2008 +0000
     1.2 +++ b/xen/arch/x86/x86_emulate.c	Tue Mar 04 10:32:13 2008 +0000
     1.3 @@ -2703,17 +2703,17 @@ x86_emulate(
     1.4          ops->load_fpu_ctxt(ctxt);
     1.5          switch ( modrm )
     1.6          {
     1.7 -        case 0xc0: __emulate_fpu_insn("fld %%st(0)"); break;
     1.8 -        case 0xc1: __emulate_fpu_insn("fld %%st(1)"); break;
     1.9 -        case 0xc2: __emulate_fpu_insn("fld %%st(2)"); break;
    1.10 -        case 0xc3: __emulate_fpu_insn("fld %%st(3)"); break;
    1.11 -        case 0xc4: __emulate_fpu_insn("fld %%st(4)"); break;
    1.12 -        case 0xc5: __emulate_fpu_insn("fld %%st(5)"); break;
    1.13 -        case 0xc6: __emulate_fpu_insn("fld %%st(6)"); break;
    1.14 -        case 0xc7: __emulate_fpu_insn("fld %%st(7)"); break;
    1.15 -        case 0xe0: __emulate_fpu_insn("fchs"); break;
    1.16 -        case 0xe8: __emulate_fpu_insn("fld1"); break;
    1.17 -        case 0xee: __emulate_fpu_insn("fldz"); break;
    1.18 +        case 0xc0: __emulate_fpu_insn(".byte 0xd9,0xc0"); break;
    1.19 +        case 0xc1: __emulate_fpu_insn(".byte 0xd9,0xc1"); break;
    1.20 +        case 0xc2: __emulate_fpu_insn(".byte 0xd9,0xc2"); break;
    1.21 +        case 0xc3: __emulate_fpu_insn(".byte 0xd9,0xc3"); break;
    1.22 +        case 0xc4: __emulate_fpu_insn(".byte 0xd9,0xc4"); break;
    1.23 +        case 0xc5: __emulate_fpu_insn(".byte 0xd9,0xc5"); break;
    1.24 +        case 0xc6: __emulate_fpu_insn(".byte 0xd9,0xc6"); break;
    1.25 +        case 0xc7: __emulate_fpu_insn(".byte 0xd9,0xc7"); break;
    1.26 +        case 0xe0: __emulate_fpu_insn(".byte 0xd9,0xe0"); break;
    1.27 +        case 0xe8: __emulate_fpu_insn(".byte 0xd9,0xe8"); break;
    1.28 +        case 0xee: __emulate_fpu_insn(".byte 0xd9,0xee"); break;
    1.29          default:
    1.30              fail_if((modrm_reg & 7) != 7);
    1.31              fail_if(modrm >= 0xc0);
    1.32 @@ -2748,15 +2748,15 @@ x86_emulate(
    1.33          ops->load_fpu_ctxt(ctxt);
    1.34          switch ( modrm )
    1.35          {
    1.36 -        case 0xd9: __emulate_fpu_insn("fcompp"); break;
    1.37 -        case 0xf8: __emulate_fpu_insn("fdivp %%st(0),%%st(0)"); break;
    1.38 -        case 0xf9: __emulate_fpu_insn("fdivp %%st(1),%%st(0)"); break;
    1.39 -        case 0xfa: __emulate_fpu_insn("fdivp %%st(2),%%st(0)"); break;
    1.40 -        case 0xfb: __emulate_fpu_insn("fdivp %%st(3),%%st(0)"); break;
    1.41 -        case 0xfc: __emulate_fpu_insn("fdivp %%st(4),%%st(0)"); break;
    1.42 -        case 0xfd: __emulate_fpu_insn("fdivp %%st(5),%%st(0)"); break;
    1.43 -        case 0xfe: __emulate_fpu_insn("fdivp %%st(6),%%st(0)"); break;
    1.44 -        case 0xff: __emulate_fpu_insn("fdivp %%st(7),%%st(0)"); break;
    1.45 +        case 0xd9: __emulate_fpu_insn(".byte 0xde,0xd9"); break;
    1.46 +        case 0xf8: __emulate_fpu_insn(".byte 0xde,0xf8"); break;
    1.47 +        case 0xf9: __emulate_fpu_insn(".byte 0xde,0xf9"); break;
    1.48 +        case 0xfa: __emulate_fpu_insn(".byte 0xde,0xfa"); break;
    1.49 +        case 0xfb: __emulate_fpu_insn(".byte 0xde,0xfb"); break;
    1.50 +        case 0xfc: __emulate_fpu_insn(".byte 0xde,0xfc"); break;
    1.51 +        case 0xfd: __emulate_fpu_insn(".byte 0xde,0xfd"); break;
    1.52 +        case 0xfe: __emulate_fpu_insn(".byte 0xde,0xfe"); break;
    1.53 +        case 0xff: __emulate_fpu_insn(".byte 0xde,0xff"); break;
    1.54          default: goto cannot_emulate;
    1.55          }
    1.56          break;