Little style changes

Elliminated i387_t alimit field (not used in FPU)
This commit is contained in:
Stanislav Shwartsman 2003-04-16 18:38:53 +00:00
parent aa9152129c
commit 40bd4f138b
11 changed files with 35 additions and 44 deletions

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: fetchdecode.cc,v 1.47 2003-04-06 19:08:24 sshwarts Exp $
// $Id: fetchdecode.cc,v 1.48 2003-04-16 18:38:50 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -1713,8 +1713,8 @@ static BxOpcodeInfo_t BxOpcodeInfo[512*2] = {
/* 0F 7B */ { 0, &BX_CPU_C::BxError },
/* 0F 7C */ { 0, &BX_CPU_C::BxError },
/* 0F 7D */ { 0, &BX_CPU_C::BxError },
/* 0F 7E */ { BxAnother | BxPrefixSSE, NULL, BxOpcodeGroupSSE_0f7e },
/* 0F 7F */ { BxAnother | BxPrefixSSE, NULL, BxOpcodeGroupSSE_0f7f },
/* 0F 7E */ { BxAnother | BxPrefixSSE, NULL, BxOpcodeGroupSSE_0f7e },
/* 0F 7F */ { BxAnother | BxPrefixSSE, NULL, BxOpcodeGroupSSE_0f7f },
/* 0F 80 */ { BxImmediate_BrOff16, &BX_CPU_C::JCC_Jw },
/* 0F 81 */ { BxImmediate_BrOff16, &BX_CPU_C::JCC_Jw },
/* 0F 82 */ { BxImmediate_BrOff16, &BX_CPU_C::JCC_Jw },
@ -2040,7 +2040,7 @@ static BxOpcodeInfo_t BxOpcodeInfo[512*2] = {
/* C0 */ { BxAnother | BxGroup2 | BxImmediate_Ib, NULL, BxOpcodeInfoG2Eb },
/* C1 */ { BxAnother | BxGroup2 | BxImmediate_Ib, NULL, BxOpcodeInfoG2Ed },
/* C2 */ { BxImmediate_Iw, &BX_CPU_C::RETnear32_Iw },
/* C3 */ { 0, &BX_CPU_C::RETnear32 },
/* C3 */ { 0, &BX_CPU_C::RETnear32 },
/* C4 */ { BxAnother, &BX_CPU_C::LES_GvMp },
/* C5 */ { BxAnother, &BX_CPU_C::LDS_GvMp },
/* C6 */ { BxAnother | BxImmediate_Ib, &BX_CPU_C::MOV_EbIb },
@ -2236,8 +2236,8 @@ static BxOpcodeInfo_t BxOpcodeInfo[512*2] = {
/* 0F 7B */ { 0, &BX_CPU_C::BxError },
/* 0F 7C */ { 0, &BX_CPU_C::BxError },
/* 0F 7D */ { 0, &BX_CPU_C::BxError },
/* 0F 7E */ { BxAnother | BxPrefixSSE, NULL, BxOpcodeGroupSSE_0f7e },
/* 0F 7F */ { BxAnother | BxPrefixSSE, NULL, BxOpcodeGroupSSE_0f7f },
/* 0F 7E */ { BxAnother | BxPrefixSSE, NULL, BxOpcodeGroupSSE_0f7e },
/* 0F 7F */ { BxAnother | BxPrefixSSE, NULL, BxOpcodeGroupSSE_0f7f },
/* 0F 80 */ { BxImmediate_BrOff32, &BX_CPU_C::JCC_Jd },
/* 0F 81 */ { BxImmediate_BrOff32, &BX_CPU_C::JCC_Jd },
/* 0F 82 */ { BxImmediate_BrOff32, &BX_CPU_C::JCC_Jd },

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: fetchdecode64.cc,v 1.45 2003-04-09 19:20:05 sshwarts Exp $
// $Id: fetchdecode64.cc,v 1.46 2003-04-16 18:38:50 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -2645,7 +2645,7 @@ static BxOpcodeInfo_t BxOpcodeInfo64[512*3] = {
/* C0 */ { BxAnother | BxGroup2 | BxImmediate_Ib, NULL, BxOpcodeInfo64G2Eb },
/* C1 */ { BxAnother | BxGroup2 | BxImmediate_Ib, NULL, BxOpcodeInfo64G2Eq },
/* C2 */ { BxImmediate_Iw, &BX_CPU_C::RETnear64_Iw },
/* C3 */ { 0, &BX_CPU_C::RETnear64 },
/* C3 */ { 0, &BX_CPU_C::RETnear64 },
/* C4 */ { 0, &BX_CPU_C::BxError },
/* C5 */ { 0, &BX_CPU_C::BxError },
/* C6 */ { BxAnother | BxImmediate_Ib, &BX_CPU_C::MOV_EbIb },

View File

@ -14,12 +14,12 @@ struct i387_t {
Bit32s fcs;
Bit32s foo;
Bit32s fos;
Bit32s aligment;
Bit32s align32;
Bit64u st_space[16]; // 8*16 bytes per FP-reg (aligned) = 128 bytes
unsigned char tos;
unsigned char no_update;
unsigned char rm;
unsigned char alimit;
unsigned align8;
};
// Endian Host byte order Guest (x86) byte order
@ -29,11 +29,11 @@ struct i387_t {
//
// Legend: F - fraction/mmx
// E - exponent
// A - aligment
// A - alignment
#ifdef BX_BIG_ENDIAN
struct BxFpuRegister {
Bit16u aligment1, aligment2, aligment3;
Bit16u alignment1, alignment2, alignment3;
Bit16s exp; /* Signed quantity used in internal arithmetic. */
Bit32u sigh;
Bit32u sigl;
@ -43,7 +43,7 @@ struct BxFpuRegister {
Bit32u sigl;
Bit32u sigh;
Bit16s exp; /* Signed quantity used in internal arithmetic. */
Bit16u aligment1, aligment2, aligment3;
Bit16u alignment1, alignment2, alignment3;
} GCC_ATTRIBUTE((aligned(16), packed));
#endif
@ -148,11 +148,11 @@ typedef union {
//
// Legend: F - fraction/mmx
// E - exponent
// A - aligment
// A - alignment
#ifdef BX_BIG_ENDIAN
struct bx_mmx_reg_t {
Bit16u aligment1, aligment2, aligment3;
Bit16u alignment1, alignment2, alignment3;
Bit16u exp; /* 2 byte FP-reg exponent */
BxPackedMmxRegister packed_mmx_register;
} GCC_ATTRIBUTE((aligned(16), packed));
@ -160,7 +160,7 @@ struct bx_mmx_reg_t {
struct bx_mmx_reg_t {
BxPackedMmxRegister packed_mmx_register;
Bit16u exp; /* 2 byte FP reg exponent */
Bit16u aligment1, aligment2, aligment3;
Bit16u alignment1, alignment2, alignment3;
} GCC_ATTRIBUTE((aligned(16), packed));
#endif

View File

@ -103,12 +103,12 @@ void BX_CPU_C::prepareMMX(void)
exception(BX_UD_EXCEPTION, 0, 0);
/* check SW_Summary bit for a pending FPU exceptions */
if(FPU_PARTIAL_STATUS & 0x0080)
#define FPU_SW_SUMMARY 0x0080
if(FPU_PARTIAL_STATUS & FPU_SW_SUMMARY)
exception(BX_MF_EXCEPTION, 0, 0);
FPU_TWD = 0;
FPU_TOS = 0; /* reset FPU Top-Of-Stack */
//FPU_PARTIAL_STATUS &= 0xc7ff;
}
#endif

View File

@ -853,7 +853,6 @@ void BX_CPU_C::MOVDQ2Q_PqVRq(bxInstruction_c *i)
FPU_TWD = 0;
FPU_TOS = 0;
//FPU_PARTIAL_STATUS &= 0xc7ff;
BX_WRITE_MMX_REG(i->rm(), mm);
#else
@ -875,7 +874,6 @@ void BX_CPU_C::MOVQ2DQ_VdqQq(bxInstruction_c *i)
FPU_TWD = 0;
FPU_TOS = 0;
//FPU_PARTIAL_STATUS &= 0xc7ff;
BX_WRITE_XMM_REG(i->rm(), op);
#else

View File

@ -1,6 +1,6 @@
/*---------------------------------------------------------------------------+
| fpu_entry.c |
| $Id: fpu_entry.c,v 1.6 2003-04-12 21:02:07 sshwarts Exp $
| $Id: fpu_entry.c,v 1.7 2003-04-16 18:38:52 sshwarts Exp $
| |
| The entry functions for wm-FPU-emu |
| |
@ -197,13 +197,16 @@ do_the_FPU_interrupt:
/* Stack underflow has priority */
if ( NOT_EMPTY_ST0 ) {
#ifndef USE_WITH_CPU_SIM
/* memory access limits checked in FPU_verify_area */
if ( addr_modes.default_mode & PROTECTED )
{
/* This table works for 16 and 32 bit protected mode */
if ( access_limit < data_sizes_16[(byte1 >> 1) & 3] )
math_abort(FPU_info, SIGSEGV);
}
#endif
unmasked = 0; /* Do this here to stop compiler warnings. */
switch ( (byte1 >> 1) & 3 )
{

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: fpu_proto.h,v 1.5 2003-03-02 23:59:09 cbothamy Exp $
// $Id: fpu_proto.h,v 1.6 2003-04-16 18:38:52 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -110,11 +110,6 @@ extern void FPU_copy_to_reg0(FPU_REG const *r, u_char tag) BX_CPP_AttrRegparmN(2
/* fpu_trig.c */
extern void FPU_triga(void);
extern void FPU_trigb(void);
/* get_address.c */
extern void *FPU_get_address(u_char FPU_modrm, u32 *fpu_eip,
struct address *addr, fpu_addr_modes addr_modes);
extern void *FPU_get_address_16(u_char FPU_modrm, u32 *fpu_eip,
struct address *addr, fpu_addr_modes addr_modes);
/* load_store.c */
extern int FPU_load_store(u_char type, fpu_addr_modes addr_modes,
void *data_address);

View File

@ -1,6 +1,6 @@
/*---------------------------------------------------------------------------+
| fpu_system.h |
| $Id: fpu_system.h,v 1.7 2003-04-12 21:02:07 sshwarts Exp $
| $Id: fpu_system.h,v 1.8 2003-04-16 18:38:52 sshwarts Exp $
| |
| Copyright (C) 1992,1994,1997 |
| W. Metzenthen, 22 Parker St, Ormond, Vic 3163, |
@ -78,11 +78,6 @@ extern struct i387_t *current_i387;
#define no_ip_update (*(u_char *)&(i387.no_update))
#define FPU_rm (*(u_char *)&(i387.rm))
/* Number of bytes of data which can be legally accessed by the current
instruction. This only needs to hold a number <= 108, so a byte will do. */
#define access_limit (*(u_char *)&(i387.alimit))
#define partial_status (i387.swd)
#define control_word (i387.cwd)
#define fpu_tag_word (i387.twd)
@ -92,7 +87,7 @@ extern struct i387_t *current_i387;
#define instruction_address (*(struct address *)&i387.fip)
#define operand_address (*(struct address *)&i387.foo)
#define FPU_verify_area(x,y,z) fpu_verify_area(x,y,z)
#define FPU_verify_area(x,y,z) fpu_verify_area((x),(y),(z))
#define FPU_get_user(x,y) ((x) = fpu_get_user((y), sizeof(*(y))))
#define FPU_put_user(val,ptr) fpu_put_user((val),(ptr),sizeof(*(ptr)))

View File

@ -1,6 +1,6 @@
/*---------------------------------------------------------------------------+
| get_address.c |
| $Id: get_address.c,v 1.3 2001-10-06 03:53:46 bdenney Exp $
| $Id: get_address.c,v 1.4 2003-04-16 18:38:53 sshwarts Exp $
| |
| Get the effective address from an FPU instruction. |
| |
@ -18,6 +18,7 @@
| other processes using the emulator while swapping is in progress. |
+---------------------------------------------------------------------------*/
#ifndef USE_WITH_CPU_SIM
#include <linux/stddef.h>
@ -444,3 +445,5 @@ void *FPU_get_address_16(u_char FPU_modrm, u32 *fpu_eip,
return (void *)address ;
}
#endif

View File

@ -1,6 +1,6 @@
/*---------------------------------------------------------------------------+
| load_store.c |
| $Id: load_store.c,v 1.5 2003-04-12 21:02:07 sshwarts Exp $
| $Id: load_store.c,v 1.6 2003-04-16 18:38:53 sshwarts Exp $
| |
| This file contains most of the code to interpret the FPU instructions |
| which load and store from user memory. |
@ -67,8 +67,10 @@ int FPU_load_store(u_char type, fpu_addr_modes addr_modes,
u_char st0_tag = TAG_Empty; /* This is just to stop a gcc warning. */
u_char loaded_tag;
st0_ptr = (FPU_REG*) NULL; /* Initialized just to stop compiler warnings. */
st0_ptr = (FPU_REG*) NULL; /* Initialized just to stop compiler warnings. */
#ifndef USE_WITH_CPU_SIM
/* memory access limits checked in FPU_verify_area */
if ( addr_modes.default_mode & PROTECTED )
{
if ( addr_modes.default_mode == SEG32 )
@ -86,6 +88,7 @@ int FPU_load_store(u_char type, fpu_addr_modes addr_modes,
EXCEPTION(EX_INTERNAL|0x140);
#endif /* PARANOID */
}
#endif
switch ( type_table[type] )
{

View File

@ -119,12 +119,6 @@ BX_CPU_C::fpu_execute(bxInstruction_c *i)
else
addr_modes.override.operand_size = OP_SIZE_PREFIX;
// For now set access_limit to max. It seems to be
// a number from 0..255 denoting how many bytes the
// current instruction can access according to its
// memory operand. 255 means >= 255.
access_limit = 0xff;
// fill in orig eip here in offset
// fill in CS in selector
entry_sel_off.offset = BX_CPU_THIS_PTR prev_eip;