Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3d0d14f9 authored by Ingo Molnar's avatar Ingo Molnar
Browse files

x86: lindent arch/i386/math-emu



lindent these files:
                                       errors   lines of code   errors/KLOC
 arch/x86/math-emu/                      2236            9424         237.2
 arch/x86/math-emu/                       128            8706          14.7

no other changes. No code changed:

   text    data     bss     dec     hex filename
   5589802  612739 3833856 10036397         9924ad vmlinux.before
   5589802  612739 3833856 10036397         9924ad vmlinux.after

the intent of this patch is to ease the automated tracking of kernel
code quality - it's just much easier for us to maintain it if every file
in arch/x86 is supposed to be clean.

NOTE: it is a known problem of lindent that it causes some style damage
of its own, but it's a safe tool (well, except for the gcc array range
initializers extension), so we did the bulk of the changes via lindent,
and did the manual fixups in a followup patch.

the resulting math-emu code has been tested by Thomas Gleixner on a real
386 DX CPU as well, and it works fine.

Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent a4ec1eff
Loading
Loading
Loading
Loading
+419 −469
Original line number Diff line number Diff line
@@ -33,7 +33,6 @@
#undef PRINT_MESSAGES
/* */


#if 0
void Un_impl(void)
{
@@ -43,12 +42,11 @@ void Un_impl(void)
	RE_ENTRANT_CHECK_OFF;
	/* No need to check access_ok(), we have previously fetched these bytes. */
	printk("Unimplemented FPU Opcode at eip=%p : ", (void __user *)address);
  if ( FPU_CS == __USER_CS )
    {
      while ( 1 )
	{
	if (FPU_CS == __USER_CS) {
		while (1) {
			FPU_get_user(byte1, (u_char __user *) address);
	  if ( (byte1 & 0xf8) == 0xd8 ) break;
			if ((byte1 & 0xf8) == 0xd8)
				break;
			printk("[%02x]", byte1);
			address++;
		}
@@ -56,12 +54,11 @@ void Un_impl(void)
		FPU_get_user(FPU_modrm, 1 + (u_char __user *) address);

		if (FPU_modrm >= 0300)
	printk("%02x (%02x+%d)\n", FPU_modrm, FPU_modrm & 0xf8, FPU_modrm & 7);
			printk("%02x (%02x+%d)\n", FPU_modrm, FPU_modrm & 0xf8,
			       FPU_modrm & 7);
		else
			printk("/%d\n", (FPU_modrm >> 3) & 7);
    }
  else
    {
	} else {
		printk("cs selector = %04x\n", FPU_CS);
	}

@@ -72,7 +69,6 @@ void Un_impl(void)
}
#endif /*  0  */


/*
   Called for opcodes which are illegal and which are known to result in a
   SIGILL with a real 80486.
@@ -82,27 +78,23 @@ void FPU_illegal(void)
	math_abort(FPU_info, SIGILL);
}



void FPU_printall(void)
{
	int i;
	static const char *tag_desc[] = { "Valid", "Zero", "ERROR", "Empty",
                              "DeNorm", "Inf", "NaN" };
		"DeNorm", "Inf", "NaN"
	};
	u_char byte1, FPU_modrm;
	unsigned long address = FPU_ORIG_EIP;

	RE_ENTRANT_CHECK_OFF;
	/* No need to check access_ok(), we have previously fetched these bytes. */
	printk("At %p:", (void *)address);
  if ( FPU_CS == __USER_CS )
    {
	if (FPU_CS == __USER_CS) {
#define MAX_PRINTED_BYTES 20
      for ( i = 0; i < MAX_PRINTED_BYTES; i++ )
	{
		for (i = 0; i < MAX_PRINTED_BYTES; i++) {
			FPU_get_user(byte1, (u_char __user *) address);
	  if ( (byte1 & 0xf8) == 0xd8 )
	    {
			if ((byte1 & 0xf8) == 0xd8) {
				printk(" %02x", byte1);
				break;
			}
@@ -111,66 +103,81 @@ void FPU_printall(void)
		}
		if (i == MAX_PRINTED_BYTES)
			printk(" [more..]\n");
      else
	{
		else {
			FPU_get_user(FPU_modrm, 1 + (u_char __user *) address);

			if (FPU_modrm >= 0300)
	    printk(" %02x (%02x+%d)\n", FPU_modrm, FPU_modrm & 0xf8, FPU_modrm & 7);
				printk(" %02x (%02x+%d)\n", FPU_modrm,
				       FPU_modrm & 0xf8, FPU_modrm & 7);
			else
				printk(" /%d, mod=%d rm=%d\n",
		   (FPU_modrm >> 3) & 7, (FPU_modrm >> 6) & 3, FPU_modrm & 7);
	}
				       (FPU_modrm >> 3) & 7,
				       (FPU_modrm >> 6) & 3, FPU_modrm & 7);
		}
  else
    {
	} else {
		printk("%04x\n", FPU_CS);
	}

	partial_status = status_word();

#ifdef DEBUGGING
if ( partial_status & SW_Backward )    printk("SW: backward compatibility\n");
if ( partial_status & SW_C3 )          printk("SW: condition bit 3\n");
if ( partial_status & SW_C2 )          printk("SW: condition bit 2\n");
if ( partial_status & SW_C1 )          printk("SW: condition bit 1\n");
if ( partial_status & SW_C0 )          printk("SW: condition bit 0\n");
if ( partial_status & SW_Summary )     printk("SW: exception summary\n");
if ( partial_status & SW_Stack_Fault ) printk("SW: stack fault\n");
if ( partial_status & SW_Precision )   printk("SW: loss of precision\n");
if ( partial_status & SW_Underflow )   printk("SW: underflow\n");
if ( partial_status & SW_Overflow )    printk("SW: overflow\n");
if ( partial_status & SW_Zero_Div )    printk("SW: divide by zero\n");
if ( partial_status & SW_Denorm_Op )   printk("SW: denormalized operand\n");
if ( partial_status & SW_Invalid )     printk("SW: invalid operation\n");
	if (partial_status & SW_Backward)
		printk("SW: backward compatibility\n");
	if (partial_status & SW_C3)
		printk("SW: condition bit 3\n");
	if (partial_status & SW_C2)
		printk("SW: condition bit 2\n");
	if (partial_status & SW_C1)
		printk("SW: condition bit 1\n");
	if (partial_status & SW_C0)
		printk("SW: condition bit 0\n");
	if (partial_status & SW_Summary)
		printk("SW: exception summary\n");
	if (partial_status & SW_Stack_Fault)
		printk("SW: stack fault\n");
	if (partial_status & SW_Precision)
		printk("SW: loss of precision\n");
	if (partial_status & SW_Underflow)
		printk("SW: underflow\n");
	if (partial_status & SW_Overflow)
		printk("SW: overflow\n");
	if (partial_status & SW_Zero_Div)
		printk("SW: divide by zero\n");
	if (partial_status & SW_Denorm_Op)
		printk("SW: denormalized operand\n");
	if (partial_status & SW_Invalid)
		printk("SW: invalid operation\n");
#endif /* DEBUGGING */

  printk(" SW: b=%d st=%ld es=%d sf=%d cc=%d%d%d%d ef=%d%d%d%d%d%d\n",
	 partial_status & 0x8000 ? 1 : 0,   /* busy */
	printk(" SW: b=%d st=%ld es=%d sf=%d cc=%d%d%d%d ef=%d%d%d%d%d%d\n", partial_status & 0x8000 ? 1 : 0,	/* busy */
	       (partial_status & 0x3800) >> 11,	/* stack top pointer */
	       partial_status & 0x80 ? 1 : 0,	/* Error summary status */
	       partial_status & 0x40 ? 1 : 0,	/* Stack flag */
	       partial_status & SW_C3 ? 1 : 0, partial_status & SW_C2 ? 1 : 0,	/* cc */
	       partial_status & SW_C1 ? 1 : 0, partial_status & SW_C0 ? 1 : 0,	/* cc */
	 partial_status & SW_Precision?1:0, partial_status & SW_Underflow?1:0,
	 partial_status & SW_Overflow?1:0, partial_status & SW_Zero_Div?1:0,
	 partial_status & SW_Denorm_Op?1:0, partial_status & SW_Invalid?1:0);
	       partial_status & SW_Precision ? 1 : 0,
	       partial_status & SW_Underflow ? 1 : 0,
	       partial_status & SW_Overflow ? 1 : 0,
	       partial_status & SW_Zero_Div ? 1 : 0,
	       partial_status & SW_Denorm_Op ? 1 : 0,
	       partial_status & SW_Invalid ? 1 : 0);

	printk(" CW: ic=%d rc=%ld%ld pc=%ld%ld iem=%d     ef=%d%d%d%d%d%d\n",
	       control_word & 0x1000 ? 1 : 0,
	       (control_word & 0x800) >> 11, (control_word & 0x400) >> 10,
	       (control_word & 0x200) >> 9, (control_word & 0x100) >> 8,
	       control_word & 0x80 ? 1 : 0,
	 control_word & SW_Precision?1:0, control_word & SW_Underflow?1:0,
	 control_word & SW_Overflow?1:0, control_word & SW_Zero_Div?1:0,
	 control_word & SW_Denorm_Op?1:0, control_word & SW_Invalid?1:0);

  for ( i = 0; i < 8; i++ )
    {
	       control_word & SW_Precision ? 1 : 0,
	       control_word & SW_Underflow ? 1 : 0,
	       control_word & SW_Overflow ? 1 : 0,
	       control_word & SW_Zero_Div ? 1 : 0,
	       control_word & SW_Denorm_Op ? 1 : 0,
	       control_word & SW_Invalid ? 1 : 0);

	for (i = 0; i < 8; i++) {
		FPU_REG *r = &st(i);
		u_char tagi = FPU_gettagi(i);
      switch (tagi)
	{
		switch (tagi) {
		case TAG_Empty:
			continue;
			break;
@@ -187,7 +194,8 @@ printk(" CW: ic=%d rc=%ld%ld pc=%ld%ld iem=%d ef=%d%d%d%d%d%d\n",
			       exponent(r) - EXP_BIAS + 1);
			break;
		default:
	  printk("Whoops! Error in errors.c: tag%d is %d ", i, tagi);
			printk("Whoops! Error in errors.c: tag%d is %d ", i,
			       tagi);
			continue;
			break;
		}
@@ -202,16 +210,17 @@ static struct {
	int type;
	const char *name;
} exception_names[] = {
  { EX_StackOver, "stack overflow" },
  { EX_StackUnder, "stack underflow" },
  { EX_Precision, "loss of precision" },
  { EX_Underflow, "underflow" },
  { EX_Overflow, "overflow" },
  { EX_ZeroDiv, "divide by zero" },
  { EX_Denormal, "denormalized operand" },
  { EX_Invalid, "invalid operation" },
  { EX_INTERNAL, "INTERNAL BUG in "FPU_VERSION },
  { 0, NULL }
	{
	EX_StackOver, "stack overflow"}, {
	EX_StackUnder, "stack underflow"}, {
	EX_Precision, "loss of precision"}, {
	EX_Underflow, "underflow"}, {
	EX_Overflow, "overflow"}, {
	EX_ZeroDiv, "divide by zero"}, {
	EX_Denormal, "denormalized operand"}, {
	EX_Invalid, "invalid operation"}, {
	EX_INTERNAL, "INTERNAL BUG in " FPU_VERSION}, {
	0, NULL}
};

/*
@@ -298,15 +307,12 @@ asmlinkage void FPU_exception(int n)
	int i, int_type;

	int_type = 0;		/* Needed only to stop compiler warnings */
  if ( n & EX_INTERNAL )
    {
	if (n & EX_INTERNAL) {
		int_type = n - EX_INTERNAL;
		n = EX_INTERNAL;
		/* Set lots of exception bits! */
		partial_status |= (SW_Exc_Mask | SW_Summary | SW_Backward);
    }
  else
    {
	} else {
		/* Extract only the bits which we use to set the status word */
		n &= (SW_Exc_Mask);
		/* Set the corresponding exception bit */
@@ -314,8 +320,7 @@ asmlinkage void FPU_exception(int n)
		/* Set summary bits iff exception isn't masked */
		if (partial_status & ~control_word & CW_Exceptions)
			partial_status |= (SW_Summary | SW_Backward);
      if ( n & (SW_Stack_Fault | EX_Precision) )
	{
		if (n & (SW_Stack_Fault | EX_Precision)) {
			if (!(n & SW_C1))
				/* This bit distinguishes over- from underflow for a stack fault,
				   and roundup from round-down for precision loss. */
@@ -324,8 +329,7 @@ asmlinkage void FPU_exception(int n)
	}

	RE_ENTRANT_CHECK_OFF;
  if ( (~control_word & n & CW_Exceptions) || (n == EX_INTERNAL) )
    {
	if ((~control_word & n & CW_Exceptions) || (n == EX_INTERNAL)) {
#ifdef PRINT_MESSAGES
		/* My message from the sponsor */
		printk(FPU_VERSION " " __DATE__ " (C) W. Metzenthen.\n");
@@ -333,21 +337,20 @@ asmlinkage void FPU_exception(int n)

		/* Get a name string for error reporting */
		for (i = 0; exception_names[i].type; i++)
	if ( (exception_names[i].type & n) == exception_names[i].type )
			if ((exception_names[i].type & n) ==
			    exception_names[i].type)
				break;

      if (exception_names[i].type)
	{
		if (exception_names[i].type) {
#ifdef PRINT_MESSAGES
			printk("FP Exception: %s!\n", exception_names[i].name);
#endif /* PRINT_MESSAGES */
	}
      else
		} else
			printk("FPU emulator: Unknown Exception: 0x%04x!\n", n);

      if ( n == EX_INTERNAL )
	{
	  printk("FPU emulator: Internal error type 0x%04x\n", int_type);
		if (n == EX_INTERNAL) {
			printk("FPU emulator: Internal error type 0x%04x\n",
			       int_type);
			FPU_printall();
		}
#ifdef PRINT_MESSAGES
@@ -369,7 +372,6 @@ asmlinkage void FPU_exception(int n)

}


/* Real operation attempted on a NaN. */
/* Returns < 0 if the exception is unmasked */
int real_1op_NaN(FPU_REG * a)
@@ -382,26 +384,22 @@ int real_1op_NaN(FPU_REG *a)
	   differ) is chosen to reproduce 80486 behaviour */
	signalling = isNaN && !(a->sigh & 0x40000000);

  if ( !signalling )
    {
      if ( !isNaN )  /* pseudo-NaN, or other unsupported? */
	{
	  if ( control_word & CW_Invalid )
	    {
	if (!signalling) {
		if (!isNaN) {	/* pseudo-NaN, or other unsupported? */
			if (control_word & CW_Invalid) {
				/* Masked response */
				reg_copy(&CONST_QNaN, a);
			}
			EXCEPTION(EX_Invalid);
	  return (!(control_word & CW_Invalid) ? FPU_Exception : 0) | TAG_Special;
			return (!(control_word & CW_Invalid) ? FPU_Exception :
				0) | TAG_Special;
		}
		return TAG_Special;
	}

  if ( control_word & CW_Invalid )
    {
	if (control_word & CW_Invalid) {
		/* The masked response */
      if ( !(a->sigh & 0x80000000) )  /* pseudo-NaN ? */
	{
		if (!(a->sigh & 0x80000000)) {	/* pseudo-NaN ? */
			reg_copy(&CONST_QNaN, a);
		}
		/* ensure a Quiet NaN */
@@ -413,12 +411,10 @@ int real_1op_NaN(FPU_REG *a)
	return (!(control_word & CW_Invalid) ? FPU_Exception : 0) | TAG_Special;
}


/* Real operation attempted on two operands, one a NaN. */
/* Returns < 0 if the exception is unmasked */
int real_2op_NaN(FPU_REG const *b, u_char tagb,
		 int deststnr,
		 FPU_REG const *defaultNaN)
		 int deststnr, FPU_REG const *defaultNaN)
{
	FPU_REG *dest = &st(deststnr);
	FPU_REG const *a = dest;
@@ -433,42 +429,36 @@ int real_2op_NaN(FPU_REG const *b, u_char tagb,

	/* TW_NaN is also used for unsupported data types. */
	unsupported = ((taga == TW_NaN)
		 && !((exponent(a) == EXP_OVER) && (a->sigh & 0x80000000)))
		       && !((exponent(a) == EXP_OVER)
			    && (a->sigh & 0x80000000)))
	    || ((tagb == TW_NaN)
		&& !((exponent(b) == EXP_OVER) && (b->sigh & 0x80000000)));
  if ( unsupported )
    {
      if ( control_word & CW_Invalid )
	{
	if (unsupported) {
		if (control_word & CW_Invalid) {
			/* Masked response */
			FPU_copy_to_regi(&CONST_QNaN, TAG_Special, deststnr);
		}
		EXCEPTION(EX_Invalid);
      return (!(control_word & CW_Invalid) ? FPU_Exception : 0) | TAG_Special;
		return (!(control_word & CW_Invalid) ? FPU_Exception : 0) |
		    TAG_Special;
	}

  if (taga == TW_NaN)
    {
	if (taga == TW_NaN) {
		x = a;
      if (tagb == TW_NaN)
	{
		if (tagb == TW_NaN) {
			signalling = !(a->sigh & b->sigh & 0x40000000);
			if (significand(b) > significand(a))
				x = b;
	  else if ( significand(b) == significand(a) )
	    {
			else if (significand(b) == significand(a)) {
				/* The default result for the case of two "equal" NaNs (signs may
				   differ) is chosen to reproduce 80486 behaviour */
				x = defaultNaN;
			}
	}
      else
	{
		} else {
			/* return the quiet version of the NaN in a */
			signalling = !(a->sigh & 0x40000000);
		}
    }
  else
	} else
#ifdef PARANOID
	if (tagb == TW_NaN)
#endif /* PARANOID */
@@ -477,16 +467,14 @@ int real_2op_NaN(FPU_REG const *b, u_char tagb,
		x = b;
	}
#ifdef PARANOID
  else
    {
	else {
		signalling = 0;
		EXCEPTION(EX_INTERNAL | 0x113);
		x = &CONST_QNaN;
	}
#endif /* PARANOID */

  if ( (!signalling) || (control_word & CW_Invalid) )
    {
	if ((!signalling) || (control_word & CW_Invalid)) {
		if (!x)
			x = b;

@@ -507,7 +495,6 @@ int real_2op_NaN(FPU_REG const *b, u_char tagb,
	return (!(control_word & CW_Invalid) ? FPU_Exception : 0) | TAG_Special;
}


/* Invalid arith operation on Valid registers */
/* Returns < 0 if the exception is unmasked */
asmlinkage int arith_invalid(int deststnr)
@@ -515,8 +502,7 @@ asmlinkage int arith_invalid(int deststnr)

	EXCEPTION(EX_Invalid);

  if ( control_word & CW_Invalid )
    {
	if (control_word & CW_Invalid) {
		/* The masked response */
		FPU_copy_to_regi(&CONST_QNaN, TAG_Special, deststnr);
	}
@@ -525,15 +511,13 @@ asmlinkage int arith_invalid(int deststnr)

}


/* Divide a finite number by zero */
asmlinkage int FPU_divide_by_zero(int deststnr, u_char sign)
{
	FPU_REG *dest = &st(deststnr);
	int tag = TAG_Valid;

  if ( control_word & CW_ZeroDiv )
    {
	if (control_word & CW_ZeroDiv) {
		/* The masked response */
		FPU_copy_to_regi(&CONST_INF, TAG_Special, deststnr);
		setsign(dest, sign);
@@ -546,24 +530,19 @@ asmlinkage int FPU_divide_by_zero(int deststnr, u_char sign)

}


/* This may be called often, so keep it lean */
int set_precision_flag(int flags)
{
  if ( control_word & CW_Precision )
    {
	if (control_word & CW_Precision) {
		partial_status &= ~(SW_C1 & flags);
		partial_status |= flags;	/* The masked response */
		return 0;
    }
  else
    {
	} else {
		EXCEPTION(flags);
		return 1;
	}
}


/* This may be called often, so keep it lean */
asmlinkage void set_precision_flag_up(void)
{
@@ -573,55 +552,43 @@ asmlinkage void set_precision_flag_up(void)
		EXCEPTION(EX_Precision | SW_C1);
}


/* This may be called often, so keep it lean */
asmlinkage void set_precision_flag_down(void)
{
  if ( control_word & CW_Precision )
    {   /* The masked response */
	if (control_word & CW_Precision) {	/* The masked response */
		partial_status &= ~SW_C1;
		partial_status |= SW_Precision;
    }
  else
	} else
		EXCEPTION(EX_Precision);
}


asmlinkage int denormal_operand(void)
{
  if ( control_word & CW_Denormal )
    {   /* The masked response */
	if (control_word & CW_Denormal) {	/* The masked response */
		partial_status |= SW_Denorm_Op;
		return TAG_Special;
    }
  else
    {
	} else {
		EXCEPTION(EX_Denormal);
		return TAG_Special | FPU_Exception;
	}
}


asmlinkage int arith_overflow(FPU_REG * dest)
{
	int tag = TAG_Valid;

  if ( control_word & CW_Overflow )
    {
	if (control_word & CW_Overflow) {
		/* The masked response */
/* ###### The response here depends upon the rounding mode */
		reg_copy(&CONST_INF, dest);
		tag = TAG_Special;
    }
  else
    {
	} else {
		/* Subtract the magic number from the exponent */
		addexponent(dest, (-3 * (1 << 13)));
	}

	EXCEPTION(EX_Overflow);
  if ( control_word & CW_Overflow )
    {
	if (control_word & CW_Overflow) {
		/* The overflow exception is masked. */
		/* By definition, precision is lost.
		   The roundup bit (C1) is also set because we have
@@ -634,34 +601,26 @@ asmlinkage int arith_overflow(FPU_REG *dest)

}


asmlinkage int arith_underflow(FPU_REG * dest)
{
	int tag = TAG_Valid;

  if ( control_word & CW_Underflow )
    {
	if (control_word & CW_Underflow) {
		/* The masked response */
      if ( exponent16(dest) <= EXP_UNDER - 63 )
	{
		if (exponent16(dest) <= EXP_UNDER - 63) {
			reg_copy(&CONST_Z, dest);
			partial_status &= ~SW_C1;	/* Round down. */
			tag = TAG_Zero;
	}
      else
	{
		} else {
			stdexp(dest);
		}
    }
  else
    {
	} else {
		/* Add the magic number to the exponent. */
		addexponent(dest, (3 * (1 << 13)) + EXTENDED_Ebias);
	}

	EXCEPTION(EX_Underflow);
  if ( control_word & CW_Underflow )
    {
	if (control_word & CW_Underflow) {
		/* The underflow exception is masked. */
		EXCEPTION(EX_Precision);
		return tag;
@@ -671,12 +630,10 @@ asmlinkage int arith_underflow(FPU_REG *dest)

}


void FPU_stack_overflow(void)
{

 if ( control_word & CW_Invalid )
    {
	if (control_word & CW_Invalid) {
		/* The masked response */
		top--;
		FPU_copy_to_reg0(&CONST_QNaN, TAG_Special);
@@ -688,12 +645,10 @@ void FPU_stack_overflow(void)

}


void FPU_stack_underflow(void)
{

 if ( control_word & CW_Invalid )
    {
	if (control_word & CW_Invalid) {
		/* The masked response */
		FPU_copy_to_reg0(&CONST_QNaN, TAG_Special);
	}
@@ -704,12 +659,10 @@ void FPU_stack_underflow(void)

}


void FPU_stack_underflow_i(int i)
{

 if ( control_word & CW_Invalid )
    {
	if (control_word & CW_Invalid) {
		/* The masked response */
		FPU_copy_to_regi(&CONST_QNaN, TAG_Special, i);
	}
@@ -720,12 +673,10 @@ void FPU_stack_underflow_i(int i)

}


void FPU_stack_underflow_pop(int i)
{

 if ( control_word & CW_Invalid )
    {
	if (control_word & CW_Invalid) {
		/* The masked response */
		FPU_copy_to_regi(&CONST_QNaN, TAG_Special, i);
		FPU_pop();
@@ -736,4 +687,3 @@ void FPU_stack_underflow_pop(int i)
	return;

}
+3 −6
Original line number Diff line number Diff line
@@ -9,7 +9,6 @@
#ifndef _EXCEPTION_H_
#define _EXCEPTION_H_


#ifdef __ASSEMBLY__
#define	Const_(x)	$##x
#else
@@ -34,11 +33,9 @@
#define EX_Denormal	Const_(0x0002)	/* denormalized operand */
#define EX_Invalid	Const_(0x0001)	/* invalid operation */


#define PRECISION_LOST_UP    Const_((EX_Precision | SW_C1))
#define PRECISION_LOST_DOWN  Const_(EX_Precision)


#ifndef __ASSEMBLY__

#ifdef DEBUG
+64 −86
Original line number Diff line number Diff line
@@ -15,7 +15,6 @@
#include "control_w.h"
#include "status_w.h"


void fadd__(void)
{
	/* fadd st,st(i) */
@@ -24,7 +23,6 @@ void fadd__(void)
	FPU_add(&st(i), FPU_gettagi(i), 0, control_word);
}


void fmul__(void)
{
	/* fmul st,st(i) */
@@ -33,8 +31,6 @@ void fmul__(void)
	FPU_mul(&st(i), FPU_gettagi(i), 0, control_word);
}



void fsub__(void)
{
	/* fsub st,st(i) */
@@ -42,7 +38,6 @@ void fsub__(void)
	FPU_sub(0, FPU_rm, control_word);
}


void fsubr_(void)
{
	/* fsubr st,st(i) */
@@ -50,7 +45,6 @@ void fsubr_(void)
	FPU_sub(REV, FPU_rm, control_word);
}


void fdiv__(void)
{
	/* fdiv st,st(i) */
@@ -58,7 +52,6 @@ void fdiv__(void)
	FPU_div(0, FPU_rm, control_word);
}


void fdivr_(void)
{
	/* fdivr st,st(i) */
@@ -66,8 +59,6 @@ void fdivr_(void)
	FPU_div(REV, FPU_rm, control_word);
}



void fadd_i(void)
{
	/* fadd st(i),st */
@@ -76,7 +67,6 @@ void fadd_i(void)
	FPU_add(&st(i), FPU_gettagi(i), i, control_word);
}


void fmul_i(void)
{
	/* fmul st(i),st */
@@ -84,7 +74,6 @@ void fmul_i(void)
	FPU_mul(&st(0), FPU_gettag0(), FPU_rm, control_word);
}


void fsubri(void)
{
	/* fsubr st(i),st */
@@ -92,7 +81,6 @@ void fsubri(void)
	FPU_sub(DEST_RM, FPU_rm, control_word);
}


void fsub_i(void)
{
	/* fsub st(i),st */
@@ -100,7 +88,6 @@ void fsub_i(void)
	FPU_sub(REV | DEST_RM, FPU_rm, control_word);
}


void fdivri(void)
{
	/* fdivr st(i),st */
@@ -108,7 +95,6 @@ void fdivri(void)
	FPU_div(DEST_RM, FPU_rm, control_word);
}


void fdiv_i(void)
{
	/* fdiv st(i),st */
@@ -116,8 +102,6 @@ void fdiv_i(void)
	FPU_div(REV | DEST_RM, FPU_rm, control_word);
}



void faddp_(void)
{
	/* faddp st(i),st */
@@ -127,7 +111,6 @@ void faddp_(void)
		FPU_pop();
}


void fmulp_(void)
{
	/* fmulp st(i),st */
@@ -136,8 +119,6 @@ void fmulp_(void)
		FPU_pop();
}



void fsubrp(void)
{
	/* fsubrp st(i),st */
@@ -146,7 +127,6 @@ void fsubrp(void)
		FPU_pop();
}


void fsubp_(void)
{
	/* fsubp st(i),st */
@@ -155,7 +135,6 @@ void fsubp_(void)
		FPU_pop();
}


void fdivrp(void)
{
	/* fdivrp st(i),st */
@@ -164,7 +143,6 @@ void fdivrp(void)
		FPU_pop();
}


void fdivp_(void)
{
	/* fdivp st(i),st */
+0 −1
Original line number Diff line number Diff line
@@ -14,7 +14,6 @@

#define	EXCEPTION	FPU_exception


#define PARAM1	8(%ebp)
#define	PARAM2	12(%ebp)
#define	PARAM3	16(%ebp)
+97 −114
Original line number Diff line number Diff line
@@ -16,14 +16,14 @@
#include "status_w.h"
#include "control_w.h"


static void fnop(void)
{
}

static void fclex(void)
{
  partial_status &= ~(SW_Backward|SW_Summary|SW_Stack_Fault|SW_Precision|
	partial_status &=
	    ~(SW_Backward | SW_Summary | SW_Stack_Fault | SW_Precision |
	      SW_Underflow | SW_Overflow | SW_Zero_Div | SW_Denorm_Op |
	      SW_Invalid);
	no_ip_update = 1;
@@ -63,7 +63,6 @@ void finit_(void)
	(finit_table[FPU_rm]) ();
}


static void fstsw_ax(void)
{
	*(short *)&FPU_EAX = status_word();
@@ -80,7 +79,6 @@ void fstsw_(void)
	(fstsw_table[FPU_rm]) ();
}


static FUNC const fp_nop_table[] = {
	fnop, FPU_illegal, FPU_illegal, FPU_illegal,
	FPU_illegal, FPU_illegal, FPU_illegal, FPU_illegal
@@ -91,39 +89,34 @@ void fp_nop(void)
	(fp_nop_table[FPU_rm]) ();
}


void fld_i_(void)
{
	FPU_REG *st_new_ptr;
	int i;
	u_char tag;

  if ( STACK_OVERFLOW )
    { FPU_stack_overflow(); return; }
	if (STACK_OVERFLOW) {
		FPU_stack_overflow();
		return;
	}

	/* fld st(i) */
	i = FPU_rm;
  if ( NOT_EMPTY(i) )
    {
	if (NOT_EMPTY(i)) {
		reg_copy(&st(i), st_new_ptr);
		tag = FPU_gettagi(i);
		push();
		FPU_settag0(tag);
    }
  else
    {
      if ( control_word & CW_Invalid )
	{
	} else {
		if (control_word & CW_Invalid) {
			/* The masked response */
			FPU_stack_underflow();
	}
      else
		} else
			EXCEPTION(EX_StackUnder);
	}

}


void fxch_i(void)
{
	/* fxch st(i) */
@@ -135,26 +128,21 @@ void fxch_i(void)
	u_char st0_tag = (tag_word >> (regnr * 2)) & 3;
	u_char sti_tag = (tag_word >> (regnri * 2)) & 3;

  if ( st0_tag == TAG_Empty )
    {
      if ( sti_tag == TAG_Empty )
	{
	if (st0_tag == TAG_Empty) {
		if (sti_tag == TAG_Empty) {
			FPU_stack_underflow();
			FPU_stack_underflow_i(i);
			return;
		}
      if ( control_word & CW_Invalid )
	{
		if (control_word & CW_Invalid) {
			/* Masked response */
			FPU_copy_to_reg0(sti_ptr, sti_tag);
		}
		FPU_stack_underflow_i(i);
		return;
	}
  if ( sti_tag == TAG_Empty )
    {
      if ( control_word & CW_Invalid )
	{
	if (sti_tag == TAG_Empty) {
		if (control_word & CW_Invalid) {
			/* Masked response */
			FPU_copy_to_regi(st0_ptr, st0_tag, i);
		}
@@ -172,14 +160,12 @@ void fxch_i(void)
	fpu_tag_word = tag_word;
}


void ffree_(void)
{
	/* ffree st(i) */
	FPU_settagi(FPU_rm, TAG_Empty);
}


void ffreep(void)
{
	/* ffree st(i) + pop - unofficial code */
@@ -187,18 +173,15 @@ void ffreep(void)
	FPU_pop();
}


void fst_i_(void)
{
	/* fst st(i) */
	FPU_copy_to_regi(&st(0), FPU_gettag0(), FPU_rm);
}


void fstp_i(void)
{
	/* fstp st(i) */
	FPU_copy_to_regi(&st(0), FPU_gettag0(), FPU_rm);
	FPU_pop();
}
Loading