From e8961bb65dd44031fccfb1f649bdf0e9c2e4c84f Mon Sep 17 00:00:00 2001 From: Stanislav Shwartsman Date: Sat, 1 Nov 2003 18:45:16 +0000 Subject: [PATCH] dos2unix fpu_compare update changes file --- bochs/CHANGES | 1 + bochs/fpu/fpu_compare.c | 368 ++++++++++++++++++++-------------------- 2 files changed, 185 insertions(+), 184 deletions(-) diff --git a/bochs/CHANGES b/bochs/CHANGES index 3b48be51f..2e0e77a44 100644 --- a/bochs/CHANGES +++ b/bochs/CHANGES @@ -30,6 +30,7 @@ Changes in 2.1 (October 2, 2003): - floatx80_add, floatx80_sub, - floatx80_mul, floatx80_div - 64-bit addressing support for x86-64 mode (Christophe Bothamy) + - implemented FCMOVcc instructions More Details: diff --git a/bochs/fpu/fpu_compare.c b/bochs/fpu/fpu_compare.c index dd61db11c..5f81dc695 100755 --- a/bochs/fpu/fpu_compare.c +++ b/bochs/fpu/fpu_compare.c @@ -1,184 +1,184 @@ -/*---------------------------------------------------------------------------+ - | fpu_compare.c | - | $Id: fpu_compare.c,v 1.1 2003-11-01 18:36:19 sshwarts Exp $ - | | - | Code to implement FMOVcc and other P6 FPU instructions. | - | | - +---------------------------------------------------------------------------*/ - -#include "fpu_system.h" -#include "exception.h" -#include "fpu_emu.h" -#include "status_w.h" - - /* EFLAGS: */ - - /* 31|30|29|28|27|26|25|24|23|22|21|20|19|18|17|16 - * ==|==|=====|==|==|==|==|==|==|==|==|==|==|==|== - * 0| 0| 0| 0| 0| 0| 0| 0| 0| 0|ID|VP|VF|AC|VM|RF - * - * 15|14|13|12|11|10| 9| 8| 7| 6| 5| 4| 3| 2| 1| 0 - * ==|==|=====|==|==|==|==|==|==|==|==|==|==|==|== - * 0|NT| IOPL|OF|DF|IF|TF|SF|ZF| 0|AF| 0|PF| 1|CF - */ - -#define EFLAGS_CF 0x01 -#define EFLAGS_PF 0x04 -#define EFLAGS_AF 0x10 -#define EFLAGS_ZF 0x40 - -void FPU_fcmovb() -{ - int i = FPU_rm; - FPU_REG *st0_ptr = &st(0), *sti_ptr = &st(i); - u_char st0_tag = FPU_gettagi(0); - u_char sti_tag = FPU_gettagi(i); - u32 eflags = fpu_get_eflags(); - - if (st0_tag == TAG_Empty || sti_tag == TAG_Empty) { - clear_C1(); - FPU_stack_underflow(); - } - - if (eflags & EFLAGS_CF) - FPU_copy_to_reg0(sti_ptr, sti_tag); -} - -void FPU_fcmove() -{ - int i = FPU_rm; - FPU_REG *st0_ptr = &st(0), *sti_ptr = &st(i); - u_char st0_tag = FPU_gettagi(0); - u_char sti_tag = FPU_gettagi(i); - u32 eflags = fpu_get_eflags(); - - if (st0_tag == TAG_Empty || sti_tag == TAG_Empty) { - clear_C1(); - FPU_stack_underflow(); - } - - if (eflags & EFLAGS_ZF) - FPU_copy_to_reg0(sti_ptr, sti_tag); -} - -void FPU_fcmovbe() -{ - int i = FPU_rm; - FPU_REG *st0_ptr = &st(0), *sti_ptr = &st(i); - u_char st0_tag = FPU_gettagi(0); - u_char sti_tag = FPU_gettagi(i); - u32 eflags = fpu_get_eflags(); - - if (st0_tag == TAG_Empty || sti_tag == TAG_Empty) { - clear_C1(); - FPU_stack_underflow(); - } - - if (eflags & (EFLAGS_ZF | EFLAGS_CF)) - FPU_copy_to_reg0(sti_ptr, sti_tag); -} - -void FPU_fcmovu() -{ - int i = FPU_rm; - FPU_REG *st0_ptr = &st(0), *sti_ptr = &st(i); - u_char st0_tag = FPU_gettagi(0); - u_char sti_tag = FPU_gettagi(i); - u32 eflags = fpu_get_eflags(); - - if (st0_tag == TAG_Empty || sti_tag == TAG_Empty) { - clear_C1(); - FPU_stack_underflow(); - } - - if (eflags & EFLAGS_PF) - FPU_copy_to_reg0(sti_ptr, sti_tag); -} - -void FPU_fcmovnb() -{ - int i = FPU_rm; - FPU_REG *st0_ptr = &st(0), *sti_ptr = &st(i); - u_char st0_tag = FPU_gettagi(0); - u_char sti_tag = FPU_gettagi(i); - u32 eflags = fpu_get_eflags(); - - if (st0_tag == TAG_Empty || sti_tag == TAG_Empty) { - clear_C1(); - FPU_stack_underflow(); - } - - if (!(eflags & EFLAGS_CF)) - FPU_copy_to_reg0(sti_ptr, sti_tag); -} - -void FPU_fcmovne() -{ - int i = FPU_rm; - FPU_REG *st0_ptr = &st(0), *sti_ptr = &st(i); - u_char st0_tag = FPU_gettagi(0); - u_char sti_tag = FPU_gettagi(i); - u32 eflags = fpu_get_eflags(); - - if (st0_tag == TAG_Empty || sti_tag == TAG_Empty) { - clear_C1(); - FPU_stack_underflow(); - } - - if (!(eflags & EFLAGS_ZF)) - FPU_copy_to_reg0(sti_ptr, sti_tag); -} - -void FPU_fcmovnbe() -{ - int i = FPU_rm; - FPU_REG *st0_ptr = &st(0), *sti_ptr = &st(i); - u_char st0_tag = FPU_gettagi(0); - u_char sti_tag = FPU_gettagi(i); - u32 eflags = fpu_get_eflags(); - - if (st0_tag == TAG_Empty || sti_tag == TAG_Empty) { - clear_C1(); - FPU_stack_underflow(); - } - - if (!(eflags & EFLAGS_CF) && !(eflags & EFLAGS_ZF)) - FPU_copy_to_reg0(sti_ptr, sti_tag); -} - -void FPU_fcmovnu() -{ - int i = FPU_rm; - FPU_REG *st0_ptr = &st(0), *sti_ptr = &st(i); - u_char st0_tag = FPU_gettagi(0); - u_char sti_tag = FPU_gettagi(i); - u32 eflags = fpu_get_eflags(); - - if (st0_tag == TAG_Empty || sti_tag == TAG_Empty) { - clear_C1(); - FPU_stack_underflow(); - } - - if (!(eflags & EFLAGS_PF)) - FPU_copy_to_reg0(sti_ptr, sti_tag); -} - -void FPU_fucomip() -{ - printk("WARNING: FUCOMIP instruction still not implemented"); -} - -void FPU_fcomip() -{ - printk("WARNING: FCOMIP instruction still not implemented"); -} - -void FPU_fucomi() -{ - printk("WARNING: FUCOMI instruction still not implemented"); -} - -void FPU_fcomi() -{ - printk("WARNING: FCOMI instruction still not implemented"); -} +/*---------------------------------------------------------------------------+ + | fpu_compare.c | + | $Id: fpu_compare.c,v 1.2 2003-11-01 18:45:16 sshwarts Exp $ + | | + | Code to implement FMOVcc and other P6 FPU instructions. | + | | + +---------------------------------------------------------------------------*/ + +#include "fpu_system.h" +#include "exception.h" +#include "fpu_emu.h" +#include "status_w.h" + + /* EFLAGS: */ + + /* 31|30|29|28|27|26|25|24|23|22|21|20|19|18|17|16 + * ==|==|=====|==|==|==|==|==|==|==|==|==|==|==|== + * 0| 0| 0| 0| 0| 0| 0| 0| 0| 0|ID|VP|VF|AC|VM|RF + * + * 15|14|13|12|11|10| 9| 8| 7| 6| 5| 4| 3| 2| 1| 0 + * ==|==|=====|==|==|==|==|==|==|==|==|==|==|==|== + * 0|NT| IOPL|OF|DF|IF|TF|SF|ZF| 0|AF| 0|PF| 1|CF + */ + +#define EFLAGS_CF 0x01 +#define EFLAGS_PF 0x04 +#define EFLAGS_AF 0x10 +#define EFLAGS_ZF 0x40 + +void FPU_fcmovb() +{ + int i = FPU_rm; + FPU_REG *st0_ptr = &st(0), *sti_ptr = &st(i); + u_char st0_tag = FPU_gettagi(0); + u_char sti_tag = FPU_gettagi(i); + u32 eflags = fpu_get_eflags(); + + if (st0_tag == TAG_Empty || sti_tag == TAG_Empty) { + clear_C1(); + FPU_stack_underflow(); + } + + if (eflags & EFLAGS_CF) + FPU_copy_to_reg0(sti_ptr, sti_tag); +} + +void FPU_fcmove() +{ + int i = FPU_rm; + FPU_REG *st0_ptr = &st(0), *sti_ptr = &st(i); + u_char st0_tag = FPU_gettagi(0); + u_char sti_tag = FPU_gettagi(i); + u32 eflags = fpu_get_eflags(); + + if (st0_tag == TAG_Empty || sti_tag == TAG_Empty) { + clear_C1(); + FPU_stack_underflow(); + } + + if (eflags & EFLAGS_ZF) + FPU_copy_to_reg0(sti_ptr, sti_tag); +} + +void FPU_fcmovbe() +{ + int i = FPU_rm; + FPU_REG *st0_ptr = &st(0), *sti_ptr = &st(i); + u_char st0_tag = FPU_gettagi(0); + u_char sti_tag = FPU_gettagi(i); + u32 eflags = fpu_get_eflags(); + + if (st0_tag == TAG_Empty || sti_tag == TAG_Empty) { + clear_C1(); + FPU_stack_underflow(); + } + + if (eflags & (EFLAGS_ZF | EFLAGS_CF)) + FPU_copy_to_reg0(sti_ptr, sti_tag); +} + +void FPU_fcmovu() +{ + int i = FPU_rm; + FPU_REG *st0_ptr = &st(0), *sti_ptr = &st(i); + u_char st0_tag = FPU_gettagi(0); + u_char sti_tag = FPU_gettagi(i); + u32 eflags = fpu_get_eflags(); + + if (st0_tag == TAG_Empty || sti_tag == TAG_Empty) { + clear_C1(); + FPU_stack_underflow(); + } + + if (eflags & EFLAGS_PF) + FPU_copy_to_reg0(sti_ptr, sti_tag); +} + +void FPU_fcmovnb() +{ + int i = FPU_rm; + FPU_REG *st0_ptr = &st(0), *sti_ptr = &st(i); + u_char st0_tag = FPU_gettagi(0); + u_char sti_tag = FPU_gettagi(i); + u32 eflags = fpu_get_eflags(); + + if (st0_tag == TAG_Empty || sti_tag == TAG_Empty) { + clear_C1(); + FPU_stack_underflow(); + } + + if (!(eflags & EFLAGS_CF)) + FPU_copy_to_reg0(sti_ptr, sti_tag); +} + +void FPU_fcmovne() +{ + int i = FPU_rm; + FPU_REG *st0_ptr = &st(0), *sti_ptr = &st(i); + u_char st0_tag = FPU_gettagi(0); + u_char sti_tag = FPU_gettagi(i); + u32 eflags = fpu_get_eflags(); + + if (st0_tag == TAG_Empty || sti_tag == TAG_Empty) { + clear_C1(); + FPU_stack_underflow(); + } + + if (!(eflags & EFLAGS_ZF)) + FPU_copy_to_reg0(sti_ptr, sti_tag); +} + +void FPU_fcmovnbe() +{ + int i = FPU_rm; + FPU_REG *st0_ptr = &st(0), *sti_ptr = &st(i); + u_char st0_tag = FPU_gettagi(0); + u_char sti_tag = FPU_gettagi(i); + u32 eflags = fpu_get_eflags(); + + if (st0_tag == TAG_Empty || sti_tag == TAG_Empty) { + clear_C1(); + FPU_stack_underflow(); + } + + if (!(eflags & EFLAGS_CF) && !(eflags & EFLAGS_ZF)) + FPU_copy_to_reg0(sti_ptr, sti_tag); +} + +void FPU_fcmovnu() +{ + int i = FPU_rm; + FPU_REG *st0_ptr = &st(0), *sti_ptr = &st(i); + u_char st0_tag = FPU_gettagi(0); + u_char sti_tag = FPU_gettagi(i); + u32 eflags = fpu_get_eflags(); + + if (st0_tag == TAG_Empty || sti_tag == TAG_Empty) { + clear_C1(); + FPU_stack_underflow(); + } + + if (!(eflags & EFLAGS_PF)) + FPU_copy_to_reg0(sti_ptr, sti_tag); +} + +void FPU_fucomip() +{ + printk("WARNING: FUCOMIP instruction still not implemented"); +} + +void FPU_fcomip() +{ + printk("WARNING: FCOMIP instruction still not implemented"); +} + +void FPU_fucomi() +{ + printk("WARNING: FUCOMI instruction still not implemented"); +} + +void FPU_fcomi() +{ + printk("WARNING: FCOMI instruction still not implemented"); +}