[FAST486]

Fix MSVC warnings

svn path=/trunk/; revision=67146
This commit is contained in:
Timo Kreuzer 2015-04-10 22:36:13 +00:00
parent 02da43250f
commit 7410f3a036
7 changed files with 39 additions and 39 deletions

View file

@ -287,7 +287,7 @@ Fast486InterruptInternal(PFAST486_STATE State,
/* Task call */ /* Task call */
return Fast486TaskSwitch(State, FAST486_TASK_CALL, IdtEntry->Selector); return Fast486TaskSwitch(State, FAST486_TASK_CALL, IdtEntry->Selector);
} }
if (GateSize != (State->SegmentRegs[FAST486_REG_CS].Size)) if (GateSize != (State->SegmentRegs[FAST486_REG_CS].Size))
{ {
/* The gate size doesn't match the current operand size, so set the OPSIZE flag. */ /* The gate size doesn't match the current operand size, so set the OPSIZE flag. */
@ -545,7 +545,7 @@ Fast486TaskSwitch(PFAST486_STATE State, FAST486_TASK_SWITCH_TYPE Type, USHORT Se
/* Make sure the entry exists in the GDT (not LDT!) */ /* Make sure the entry exists in the GDT (not LDT!) */
if ((GET_SEGMENT_INDEX(Selector) == 0) if ((GET_SEGMENT_INDEX(Selector) == 0)
|| (Selector & SEGMENT_TABLE_INDICATOR) || (Selector & SEGMENT_TABLE_INDICATOR)
|| GET_SEGMENT_INDEX(Selector) >= (State->Gdtr.Size + 1)) || GET_SEGMENT_INDEX(Selector) >= (State->Gdtr.Size + 1u))
{ {
Fast486ExceptionWithErrorCode(State, FAST486_EXCEPTION_TS, Selector); Fast486ExceptionWithErrorCode(State, FAST486_EXCEPTION_TS, Selector);
return FALSE; return FALSE;
@ -598,7 +598,7 @@ Fast486TaskSwitch(PFAST486_STATE State, FAST486_TASK_SWITCH_TYPE Type, USHORT Se
&& ((NewTssDescriptor.Signature != FAST486_BUSY_TSS_SIGNATURE) && ((NewTssDescriptor.Signature != FAST486_BUSY_TSS_SIGNATURE)
|| (Type != FAST486_TASK_RETURN))) || (Type != FAST486_TASK_RETURN)))
{ {
Fast486ExceptionWithErrorCode(State, FAST486_EXCEPTION_GP, Selector); Fast486ExceptionWithErrorCode(State, FAST486_EXCEPTION_GP, Selector);
return FALSE; return FALSE;
} }

View file

@ -35,8 +35,8 @@
/* Block size for string operations */ /* Block size for string operations */
#define STRING_BLOCK_SIZE 4096 #define STRING_BLOCK_SIZE 4096
#define GET_SEGMENT_RPL(s) ((s) & 3) #define GET_SEGMENT_RPL(s) ((s) & 3u)
#define GET_SEGMENT_INDEX(s) ((s) & 0xFFF8) #define GET_SEGMENT_INDEX(s) ((s) & 0xFFF8u)
#define SEGMENT_TABLE_INDICATOR (1 << 2) #define SEGMENT_TABLE_INDICATOR (1 << 2)
#define EXCEPTION_HAS_ERROR_CODE(x) (((x) == 8) || ((x) >= 10 && (x) <= 14)) #define EXCEPTION_HAS_ERROR_CODE(x) (((x) == 8) || ((x) >= 10 && (x) <= 14))

View file

@ -52,7 +52,7 @@
#endif #endif
FORCEINLINE FORCEINLINE
INT UINT
FASTCALL FASTCALL
Fast486GetCurrentPrivLevel(PFAST486_STATE State) Fast486GetCurrentPrivLevel(PFAST486_STATE State)
{ {
@ -447,7 +447,7 @@ Fast486ReadDescriptorEntry(PFAST486_STATE State,
if (!(Selector & SEGMENT_TABLE_INDICATOR)) if (!(Selector & SEGMENT_TABLE_INDICATOR))
{ {
/* Make sure the GDT contains the entry */ /* Make sure the GDT contains the entry */
if (GET_SEGMENT_INDEX(Selector) >= (State->Gdtr.Size + 1)) if (GET_SEGMENT_INDEX(Selector) >= (State->Gdtr.Size + 1u))
{ {
*EntryValid = FALSE; *EntryValid = FALSE;
return TRUE; return TRUE;
@ -468,7 +468,7 @@ Fast486ReadDescriptorEntry(PFAST486_STATE State,
else else
{ {
/* Make sure the LDT contains the entry */ /* Make sure the LDT contains the entry */
if (GET_SEGMENT_INDEX(Selector) >= (State->Ldtr.Limit + 1)) if (GET_SEGMENT_INDEX(Selector) >= (State->Ldtr.Limit + 1u))
{ {
*EntryValid = FALSE; *EntryValid = FALSE;
return TRUE; return TRUE;
@ -1512,7 +1512,7 @@ Fast486FpuException(PFAST486_STATE State)
if (State->ControlRegisters[FAST486_REG_CR0] & FAST486_CR0_NE) if (State->ControlRegisters[FAST486_REG_CR0] & FAST486_CR0_NE)
{ {
/* Call the #MF handler */ /* Call the #MF handler */
Fast486Exception(State, FAST486_EXCEPTION_MF); Fast486Exception(State, FAST486_EXCEPTION_MF);
} }
else else
{ {
@ -1593,7 +1593,7 @@ Fast486FpuPush(PFAST486_STATE State,
{ {
/* Raise the stack fault and invalid operation exception */ /* Raise the stack fault and invalid operation exception */
State->FpuStatus.Sf = State->FpuStatus.Ie = TRUE; State->FpuStatus.Sf = State->FpuStatus.Ie = TRUE;
/* Set the C1 condition code bit (stack overflow) */ /* Set the C1 condition code bit (stack overflow) */
State->FpuStatus.Code1 = TRUE; State->FpuStatus.Code1 = TRUE;

View file

@ -356,7 +356,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeLar)
/* Exception occurred */ /* Exception occurred */
return; return;
} }
Selector = LOWORD(Value); Selector = LOWORD(Value);
} }
else else
@ -440,7 +440,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeLsl)
/* Exception occurred */ /* Exception occurred */
return; return;
} }
Selector = LOWORD(Value); Selector = LOWORD(Value);
} }
else else
@ -1642,7 +1642,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeBtc)
FAST486_OPCODE_HANDLER(Fast486ExtOpcodeBsf) FAST486_OPCODE_HANDLER(Fast486ExtOpcodeBsf)
{ {
INT i; UINT i;
ULONG Value = 0; ULONG Value = 0;
BOOLEAN OperandSize, AddressSize; BOOLEAN OperandSize, AddressSize;
FAST486_MOD_REG_RM ModRegRm; FAST486_MOD_REG_RM ModRegRm;

View file

@ -65,7 +65,7 @@ UnsignedMult128(ULONGLONG Multiplicand,
ULONG MultiplicandLow, MultiplicandHigh, MultiplierLow, MultiplierHigh; ULONG MultiplicandLow, MultiplicandHigh, MultiplierLow, MultiplierHigh;
ULONG IntermediateLow, IntermediateHigh; ULONG IntermediateLow, IntermediateHigh;
ULONGLONG LowProduct, Intermediate, Intermediate1, Intermediate2; ULONGLONG LowProduct, Intermediate, Intermediate1, Intermediate2;
MultiplicandLow = (ULONG)(Multiplicand & 0xFFFFFFFFULL); MultiplicandLow = (ULONG)(Multiplicand & 0xFFFFFFFFULL);
MultiplicandHigh = (ULONG)(Multiplicand >> 32); MultiplicandHigh = (ULONG)(Multiplicand >> 32);
MultiplierLow = (ULONG)(Multiplier & 0xFFFFFFFFULL); MultiplierLow = (ULONG)(Multiplier & 0xFFFFFFFFULL);
@ -229,7 +229,7 @@ Fast486FpuFromInteger(PFAST486_STATE State,
Result->Mantissa = (ULONGLONG)Value; Result->Mantissa = (ULONGLONG)Value;
ZeroCount = CountLeadingZeros64(Result->Mantissa); ZeroCount = CountLeadingZeros64(Result->Mantissa);
Result->Mantissa <<= ZeroCount; Result->Mantissa <<= ZeroCount;
Result->Exponent = FPU_REAL10_BIAS + 63 - ZeroCount; Result->Exponent = FPU_REAL10_BIAS + 63 - ZeroCount;
} }
@ -248,7 +248,7 @@ Fast486FpuToInteger(PFAST486_STATE State,
*Result = 0LL; *Result = 0LL;
return TRUE; return TRUE;
} }
if (FPU_IS_NAN(Value) || !FPU_IS_NORMALIZED(Value) if (FPU_IS_NAN(Value) || !FPU_IS_NORMALIZED(Value)
|| (UnbiasedExp < 0) || (UnbiasedExp > 63)) || (UnbiasedExp < 0) || (UnbiasedExp > 63))
{ {
@ -580,8 +580,8 @@ Fast486FpuAdd(PFAST486_STATE State,
else TempResult.Sign = FALSE; else TempResult.Sign = FALSE;
/* Invert the negative mantissa */ /* Invert the negative mantissa */
if (FirstAdjusted.Sign) FirstAdjusted.Mantissa = -FirstAdjusted.Mantissa; if (FirstAdjusted.Sign) FirstAdjusted.Mantissa = -(LONGLONG)FirstAdjusted.Mantissa;
if (SecondAdjusted.Sign) SecondAdjusted.Mantissa = -SecondAdjusted.Mantissa; if (SecondAdjusted.Sign) SecondAdjusted.Mantissa = -(LONGLONG)SecondAdjusted.Mantissa;
/* Calculate the mantissa of the result */ /* Calculate the mantissa of the result */
TempResult.Mantissa = FirstAdjusted.Mantissa + SecondAdjusted.Mantissa; TempResult.Mantissa = FirstAdjusted.Mantissa + SecondAdjusted.Mantissa;
@ -615,7 +615,7 @@ Fast486FpuAdd(PFAST486_STATE State,
TempResult.Exponent++; TempResult.Exponent++;
} }
} }
/* Normalize the result and return it */ /* Normalize the result and return it */
Fast486FpuNormalize(State, &TempResult); Fast486FpuNormalize(State, &TempResult);
*Result = TempResult; *Result = TempResult;
@ -720,7 +720,7 @@ Fast486FpuMultiply(PFAST486_STATE State,
} }
if (FPU_IS_INFINITY(FirstOperand) || FPU_IS_INFINITY(SecondOperand)) if (FPU_IS_INFINITY(FirstOperand) || FPU_IS_INFINITY(SecondOperand))
{ {
/* The result will be infinity */ /* The result will be infinity */
Result->Sign = FirstOperand->Sign ^ SecondOperand->Sign; Result->Sign = FirstOperand->Sign ^ SecondOperand->Sign;
Result->Exponent = FPU_MAX_EXPONENT + 1; Result->Exponent = FPU_MAX_EXPONENT + 1;
@ -755,7 +755,7 @@ Fast486FpuMultiply(PFAST486_STATE State,
{ {
/* Raise the underflow exception */ /* Raise the underflow exception */
State->FpuStatus.Ue = TRUE; State->FpuStatus.Ue = TRUE;
if (!State->FpuControl.Um) if (!State->FpuControl.Um)
{ {
Fast486FpuException(State); Fast486FpuException(State);
@ -811,7 +811,7 @@ Fast486FpuDivide(PFAST486_STATE State,
if (State->FpuControl.Im) if (State->FpuControl.Im)
{ {
/* Return the indefinite NaN */ /* Return the indefinite NaN */
Result->Sign = TRUE; Result->Sign = TRUE;
Result->Exponent = FPU_MAX_EXPONENT + 1; Result->Exponent = FPU_MAX_EXPONENT + 1;
Result->Mantissa = FPU_INDEFINITE_MANTISSA; Result->Mantissa = FPU_INDEFINITE_MANTISSA;
@ -856,7 +856,7 @@ Fast486FpuDivide(PFAST486_STATE State,
/* Divide the two mantissas */ /* Divide the two mantissas */
Remainder = UnsignedDivMod128(0ULL, Remainder = UnsignedDivMod128(0ULL,
/* Notice the 64 above - this is the high part */ /* Notice the 64 above - this is the high part */
FirstOperand->Mantissa, FirstOperand->Mantissa,
SecondOperand->Mantissa, SecondOperand->Mantissa,
&QuotientLow, &QuotientLow,
&QuotientHigh); &QuotientHigh);
@ -1774,7 +1774,7 @@ FAST486_OPCODE_HANDLER(Fast486FpuOpcodeDA)
SourceOperand = &MemoryData; SourceOperand = &MemoryData;
/* Perform the requested operation */ /* Perform the requested operation */
Fast486FpuArithmeticOperation(State, ModRegRm.Register, SourceOperand, DestOperand); Fast486FpuArithmeticOperation(State, ModRegRm.Register, SourceOperand, DestOperand);
#endif #endif
} }
@ -1896,7 +1896,7 @@ FAST486_OPCODE_HANDLER(Fast486FpuOpcodeDB)
Value.Exponent = *((PUSHORT)&Buffer[8]) & (FPU_MAX_EXPONENT + 1); Value.Exponent = *((PUSHORT)&Buffer[8]) & (FPU_MAX_EXPONENT + 1);
Value.Sign = *((PUCHAR)&Buffer[9]) >> 7; Value.Sign = *((PUCHAR)&Buffer[9]) >> 7;
Fast486FpuPush(State, &Value); Fast486FpuPush(State, &Value);
break; break;
} }
@ -1939,7 +1939,7 @@ FAST486_OPCODE_HANDLER(Fast486FpuOpcodeDB)
return; return;
} }
Fast486FpuPop(State); Fast486FpuPop(State);
break; break;
} }
@ -2469,7 +2469,7 @@ FAST486_OPCODE_HANDLER(Fast486FpuOpcodeDE)
} }
/* Perform the requested operation */ /* Perform the requested operation */
Fast486FpuArithmeticOperation(State, ModRegRm.Register, SourceOperand, DestOperand); Fast486FpuArithmeticOperation(State, ModRegRm.Register, SourceOperand, DestOperand);
if (!ModRegRm.Memory) Fast486FpuPop(State); if (!ModRegRm.Memory) Fast486FpuPop(State);
#endif #endif
@ -2653,7 +2653,7 @@ FAST486_OPCODE_HANDLER(Fast486FpuOpcodeDF)
return; return;
} }
Fast486FpuPop(State); Fast486FpuPop(State);
break; break;
} }

View file

@ -4154,7 +4154,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodePushFlags)
FAST486_OPCODE_HANDLER(Fast486OpcodePopFlags) FAST486_OPCODE_HANDLER(Fast486OpcodePopFlags)
{ {
BOOLEAN Size = State->SegmentRegs[FAST486_REG_CS].Size; BOOLEAN Size = State->SegmentRegs[FAST486_REG_CS].Size;
INT Cpl = Fast486GetCurrentPrivLevel(State); UINT Cpl = Fast486GetCurrentPrivLevel(State);
FAST486_FLAGS_REG NewFlags; FAST486_FLAGS_REG NewFlags;
NO_LOCK_PREFIX(); NO_LOCK_PREFIX();
@ -4487,11 +4487,11 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeRetFar)
if ((State->ControlRegisters[FAST486_REG_CR0] & FAST486_CR0_PE) && !State->Flags.Vm) if ((State->ControlRegisters[FAST486_REG_CR0] & FAST486_CR0_PE) && !State->Flags.Vm)
{ {
INT i; UINT i;
INT OldCpl = Fast486GetCurrentPrivLevel(State); UINT OldCpl = Fast486GetCurrentPrivLevel(State);
ULONG StackPtr; ULONG StackPtr;
ULONG StackSel; ULONG StackSel;
if (GET_SEGMENT_RPL(Segment) > OldCpl) if (GET_SEGMENT_RPL(Segment) > OldCpl)
{ {
/* Pop ESP */ /* Pop ESP */
@ -4658,7 +4658,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeIret)
/* Check for protected mode */ /* Check for protected mode */
if (State->ControlRegisters[FAST486_REG_CR0] & FAST486_CR0_PE) if (State->ControlRegisters[FAST486_REG_CR0] & FAST486_CR0_PE)
{ {
INT OldCpl = Fast486GetCurrentPrivLevel(State); UINT OldCpl = Fast486GetCurrentPrivLevel(State);
if (State->Flags.Vm) if (State->Flags.Vm)
{ {
@ -5291,7 +5291,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeMovOffsetAl)
FAST486_OPCODE_HANDLER(Fast486OpcodeMovOffsetEax) FAST486_OPCODE_HANDLER(Fast486OpcodeMovOffsetEax)
{ {
BOOLEAN OperandSize, AddressSize; BOOLEAN OperandSize, AddressSize;
OperandSize = AddressSize = State->SegmentRegs[FAST486_REG_CS].Size; OperandSize = AddressSize = State->SegmentRegs[FAST486_REG_CS].Size;
/* Make sure this is the right instruction */ /* Make sure this is the right instruction */
@ -5864,7 +5864,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeScas)
|| (!AddressSize && (State->GeneralRegs[FAST486_REG_ECX].LowWord == 0))) || (!AddressSize && (State->GeneralRegs[FAST486_REG_ECX].LowWord == 0)))
{ {
/* Do nothing */ /* Do nothing */
return; return;
} }
} }

View file

@ -209,7 +209,7 @@ Fast486RotateOperation(PFAST486_STATE State,
case 2: case 2:
{ {
Result = (Value << Count) | (State->Flags.Cf << (Count - 1)); Result = (Value << Count) | (State->Flags.Cf << (Count - 1));
/* Complete the calculation, but make sure we don't shift by too much */ /* Complete the calculation, but make sure we don't shift by too much */
if ((Bits - Count) < 31) Result |= Value >> (Bits - Count + 1); if ((Bits - Count) < 31) Result |= Value >> (Bits - Count + 1);
@ -993,7 +993,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeGroupF6)
Quotient = State->GeneralRegs[FAST486_REG_EAX].LowWord / Value; Quotient = State->GeneralRegs[FAST486_REG_EAX].LowWord / Value;
Remainder = State->GeneralRegs[FAST486_REG_EAX].LowWord % Value; Remainder = State->GeneralRegs[FAST486_REG_EAX].LowWord % Value;
if (Quotient > 0xFF) if (Quotient > 0xFF)
{ {
/* Divide error */ /* Divide error */
Fast486Exception(State, FAST486_EXCEPTION_DE); Fast486Exception(State, FAST486_EXCEPTION_DE);
@ -1023,7 +1023,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeGroupF6)
Quotient = (SHORT)State->GeneralRegs[FAST486_REG_EAX].LowWord / (CHAR)Value; Quotient = (SHORT)State->GeneralRegs[FAST486_REG_EAX].LowWord / (CHAR)Value;
Remainder = (SHORT)State->GeneralRegs[FAST486_REG_EAX].LowWord % (CHAR)Value; Remainder = (SHORT)State->GeneralRegs[FAST486_REG_EAX].LowWord % (CHAR)Value;
if (Quotient > 127 || Quotient < -128) if (Quotient > 127 || Quotient < -128)
{ {
/* Divide error */ /* Divide error */
Fast486Exception(State, FAST486_EXCEPTION_DE); Fast486Exception(State, FAST486_EXCEPTION_DE);
@ -1142,7 +1142,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeGroupF7)
case 3: case 3:
{ {
/* Calculate the result */ /* Calculate the result */
ULONG Result = -Value; ULONG Result = -(LONG)Value;
if (!OperandSize) Result &= 0xFFFF; if (!OperandSize) Result &= 0xFFFF;
/* Update the flags */ /* Update the flags */