<commit_before>/*---------------------------------------------------------------------------+
 |  fpu_emu.h                                                                |
 |  $Id: fpu_emu.h,v 1.22 2004/02/11 19:40:25 sshwarts Exp $
 |                                                                           |
 | Copyright (C) 1992,1993,1994,1997                                         |
 |                       <NAME>, 22 Parker St, Ormond, Vic 3163,      |
 |                       Australia.  E-mail   <EMAIL>             |
 |                                                                           |
 +---------------------------------------------------------------------------*/


#ifndef _FPU_EMU_H_
#define _FPU_EMU_H_

#include <linux/linkage.h>

/*
 * Define PECULIAR_486 to get a closer approximation to 80486 behaviour,
 * rather than behaviour which appears to be cleaner.
 * This is a matter of opinion: for all I know, the 80486 may simply
 * be complying with the IEEE spec. Maybe one day I'll get to see the
 * spec...
 */
#define PECULIAR_486

#define EXP_BIAS	(0)
#define EXP_OVER	(0x4000)    /* smallest invalid large exponent */
#define	EXP_UNDER	(-0x3fff)   /* largest invalid small exponent */
#define EXP_WAY_UNDER   (-0x6000)   /* Below the smallest denormal, but still a 16 bit nr */

#define EXP_Infinity    EXP_OVER
#define EXP_NaN         EXP_OVER

#define EXTENDED_Ebias (0x3fff)
#define EXTENDED_Emin (-0x3ffe)  /* smallest valid exponent */

#define SIGN_POS	(0)
#define SIGN_NEG	(0x80)

#define SIGN_Positive	(0)
#define SIGN_Negative	(0x8000)

/* Keep the order TAG_Valid, TAG_Zero, TW_Denormal */
/* The following fold to 2 (Special) in the Tag Word */
#define TW_Denormal      4      /* De-normal */
#define TW_Infinity	 5 	/* + or - infinity */
#define	TW_NaN		 6      /* Not a Number */
#define	TW_Unsupported	 7 	/* Not supported by an 80486 */

#define TAG_Valid	 0 	/* valid */
#define TAG_Zero	 1 	/* zero */
#define TAG_Special	 2 	/* De-normal, + or - infinity, or NaN */
#define TAG_Empty	 3 	/* empty */

/* Special st() number to identify loaded data (not on stack). */
#define LOADED_DATA	(10101)	

/* A few flags (must be >= 0x10). */
#define REV             0x10
#define DEST_RM         0x20
#define LOADED          0x40

#define FPU_Exception   (0x80000000)   /* Added to tag returns. */

#include "fpu_system.h"

#define FWAIT_OPCODE 0x9b
#define OP_SIZE_PREFIX 0x66
#define ADDR_SIZE_PREFIX 0x67

#if defined(__MWERKS__) && defined(macintosh)
#pragma options align=packed
#endif
struct address {
  bx_address offset;
#ifdef EMU_BIG_ENDIAN
  u32 empty:5;
  u32 opcode:11;
  u32 selector:16;
#else
  u32 selector:16;
  u32 opcode:11;
  u32 empty:5;
#endif
} GCC_ATTRIBUTE((packed));

typedef void (*FUNC)(void);
typedef void (*FUNC_ST0)(FPU_REG *st0_ptr, u_char st0_tag);

typedef struct { u_char address_size, operand_size, segment; }
        GCC_ATTRIBUTE((packed)) overrides;
/* This structure is 32 bits: */
typedef struct { overrides override;
		 u_char default_mode; } 
    GCC_ATTRIBUTE((packed)) fpu_addr_modes;
#if defined(__MWERKS__) && defined(macintosh)
#pragma options align=reset
#endif

/* PROTECTED has a restricted meaning in the emulator; it is used
   to signal that the emulator needs to do special things to ensure
   that protection is respected in a segmented model. */
#define PROTECTED 4
#define SIXTEEN   1         /* We rely upon this being 1 (true) */
#define VM86      SIXTEEN
#define PM16      (SIXTEEN | PROTECTED)
#define SEG32     PROTECTED

#define fpu_register(x)  ( *((FPU_REG *)(FPU_register_base + sizeof(FPU_REG) * (x & 7) )))
#define	st(x)      ( *((FPU_REG *)(FPU_register_base + sizeof(FPU_REG) * ((FPU_tos+x) & 7) )))

#define	NOT_EMPTY(i)	(!FPU_empty_i(i))
#define	NOT_EMPTY_ST0	(st0_tag ^ TAG_Empty)

/* FPU_push() does not affect the tags */
#define FPU_push()	{ FPU_tos--; }
<commit_msg>Allow compiling with gcc 2.95.2<commit_after>/*---------------------------------------------------------------------------+
 |  fpu_emu.h                                                                |
 |  $Id: fpu_emu.h,v 1.23 2004/02/20 00:54:22 danielg4 Exp $
 |                                                                           |
 | Copyright (C) 1992,1993,1994,1997                                         |
 |                       <NAME>, 22 Parker St, Ormond, Vic 3163,      |
 |                       Australia.  E-mail   <EMAIL>             |
 |                                                                           |
 +---------------------------------------------------------------------------*/


#ifndef _FPU_EMU_H_
#define _FPU_EMU_H_

#include <linux/linkage.h>

/*
 * Define PECULIAR_486 to get a closer approximation to 80486 behaviour,
 * rather than behaviour which appears to be cleaner.
 * This is a matter of opinion: for all I know, the 80486 may simply
 * be complying with the IEEE spec. Maybe one day I'll get to see the
 * spec...
 */
#define PECULIAR_486

#define EXP_BIAS	(0)
#define EXP_OVER	(0x4000)    /* smallest invalid large exponent */
#define	EXP_UNDER	(-0x3fff)   /* largest invalid small exponent */
#define EXP_WAY_UNDER   (-0x6000)   /* Below the smallest denormal, but still a 16 bit nr */

#define EXP_Infinity    EXP_OVER
#define EXP_NaN         EXP_OVER

#define EXTENDED_Ebias (0x3fff)
#define EXTENDED_Emin (-0x3ffe)  /* smallest valid exponent */

#define SIGN_POS	(0)
#define SIGN_NEG	(0x80)

#define SIGN_Positive	(0)
#define SIGN_Negative	(0x8000)

/* Keep the order TAG_Valid, TAG_Zero, TW_Denormal */
/* The following fold to 2 (Special) in the Tag Word */
#define TW_Denormal      4      /* De-normal */
#define TW_Infinity	 5 	/* + or - infinity */
#define	TW_NaN		 6      /* Not a Number */
#define	TW_Unsupported	 7 	/* Not supported by an 80486 */

#define TAG_Valid	 0 	/* valid */
#define TAG_Zero	 1 	/* zero */
#define TAG_Special	 2 	/* De-normal, + or - infinity, or NaN */
#define TAG_Empty	 3 	/* empty */

/* Special st() number to identify loaded data (not on stack). */
#define LOADED_DATA	(10101)	

/* A few flags (must be >= 0x10). */
#define REV             0x10
#define DEST_RM         0x20
#define LOADED          0x40

#define FPU_Exception   (0x80000000)   /* Added to tag returns. */

#include "fpu_system.h"

#define FWAIT_OPCODE 0x9b
#define OP_SIZE_PREFIX 0x66
#define ADDR_SIZE_PREFIX 0x67

#if defined(__MWERKS__) && defined(macintosh)
#pragma options align=packed
#endif
struct address {
  bx_address offset;
#ifdef EMU_BIG_ENDIAN
  u32 empty:5;
  u32 opcode:11;
  u32 selector:16;
#else
  u32 selector:16;
  u32 opcode:11;
  u32 empty:5;
#endif
} GCC_ATTRIBUTE((packed));

typedef void (*FUNC)(void);
typedef void (*FUNC_ST0)(FPU_REG *st0_ptr, u_char st0_tag);

typedef struct { u_char address_size, operand_size, segment; }
        overrides GCC_ATTRIBUTE((packed));
/* This structure is 32 bits: */
typedef struct { overrides override;
		 u_char default_mode; } 
    fpu_addr_modes GCC_ATTRIBUTE((packed));
#if defined(__MWERKS__) && defined(macintosh)
#pragma options align=reset
#endif

/* PROTECTED has a restricted meaning in the emulator; it is used
   to signal that the emulator needs to do special things to ensure
   that protection is respected in a segmented model. */
#define PROTECTED 4
#define SIXTEEN   1         /* We rely upon this being 1 (true) */
#define VM86      SIXTEEN
#define PM16      (SIXTEEN | PROTECTED)
#define SEG32     PROTECTED

#define fpu_register(x)  ( *((FPU_REG *)(FPU_register_base + sizeof(FPU_REG) * (x & 7) )))
#define	st(x)      ( *((FPU_REG *)(FPU_register_base + sizeof(FPU_REG) * ((FPU_tos+x) & 7) )))

#define	NOT_EMPTY(i)	(!FPU_empty_i(i))
#define	NOT_EMPTY_ST0	(st0_tag ^ TAG_Empty)

/* FPU_push() does not affect the tags */
#define FPU_push()	{ FPU_tos--; }

{'fraction_non_alphanumeric': 0.14, 'fraction_numerical': 0.044743589743589746, 'mean_word_length': 2.2222222222222223, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, 'word_list_counts': {'cursed_substrings.json': 18, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1592265', 'n_tokens_mistral': 2865, 'n_tokens_neox': 2580, 'n_words': 780}