[FAST486]
authorTimo Kreuzer <timo.kreuzer@reactos.org>
Fri, 10 Apr 2015 22:36:13 +0000 (22:36 +0000)
committerTimo Kreuzer <timo.kreuzer@reactos.org>
Fri, 10 Apr 2015 22:36:13 +0000 (22:36 +0000)
Fix MSVC warnings

svn path=/trunk/; revision=67146

reactos/lib/fast486/common.c
reactos/lib/fast486/common.h
reactos/lib/fast486/common.inl
reactos/lib/fast486/extraops.c
reactos/lib/fast486/fpu.c
reactos/lib/fast486/opcodes.c
reactos/lib/fast486/opgroups.c

index 52f2fc7..a6d2459 100644 (file)
@@ -287,7 +287,7 @@ Fast486InterruptInternal(PFAST486_STATE State,
             /* Task call */
             return Fast486TaskSwitch(State, FAST486_TASK_CALL, IdtEntry->Selector);
         }
-        
+
         if (GateSize != (State->SegmentRegs[FAST486_REG_CS].Size))
         {
             /* 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!) */
     if ((GET_SEGMENT_INDEX(Selector) == 0)
         || (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);
         return FALSE;
@@ -598,7 +598,7 @@ Fast486TaskSwitch(PFAST486_STATE State, FAST486_TASK_SWITCH_TYPE Type, USHORT Se
         && ((NewTssDescriptor.Signature != FAST486_BUSY_TSS_SIGNATURE)
         || (Type != FAST486_TASK_RETURN)))
     {
-        Fast486ExceptionWithErrorCode(State, FAST486_EXCEPTION_GP, Selector); 
+        Fast486ExceptionWithErrorCode(State, FAST486_EXCEPTION_GP, Selector);
         return FALSE;
     }
 
index d934f20..d0394c0 100644 (file)
@@ -35,8 +35,8 @@
 /* Block size for string operations */
 #define STRING_BLOCK_SIZE 4096
 
-#define GET_SEGMENT_RPL(s)          ((s) & 3)
-#define GET_SEGMENT_INDEX(s)        ((s) & 0xFFF8)
+#define GET_SEGMENT_RPL(s)          ((s) & 3u)
+#define GET_SEGMENT_INDEX(s)        ((s) & 0xFFF8u)
 #define SEGMENT_TABLE_INDICATOR     (1 << 2)
 #define EXCEPTION_HAS_ERROR_CODE(x) (((x) == 8) || ((x) >= 10 && (x) <= 14))
 
index 34c1a78..b000a30 100644 (file)
@@ -52,7 +52,7 @@
 #endif
 
 FORCEINLINE
-INT
+UINT
 FASTCALL
 Fast486GetCurrentPrivLevel(PFAST486_STATE State)
 {
@@ -447,7 +447,7 @@ Fast486ReadDescriptorEntry(PFAST486_STATE State,
     if (!(Selector & SEGMENT_TABLE_INDICATOR))
     {
         /* 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;
             return TRUE;
@@ -468,7 +468,7 @@ Fast486ReadDescriptorEntry(PFAST486_STATE State,
     else
     {
         /* 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;
             return TRUE;
@@ -1512,7 +1512,7 @@ Fast486FpuException(PFAST486_STATE State)
     if (State->ControlRegisters[FAST486_REG_CR0] & FAST486_CR0_NE)
     {
         /* Call the #MF handler */
-        Fast486Exception(State, FAST486_EXCEPTION_MF); 
+        Fast486Exception(State, FAST486_EXCEPTION_MF);
     }
     else
     {
@@ -1593,7 +1593,7 @@ Fast486FpuPush(PFAST486_STATE State,
     {
         /* Raise the stack fault and invalid operation exception */
         State->FpuStatus.Sf = State->FpuStatus.Ie = TRUE;
-        
+
         /* Set the C1 condition code bit (stack overflow) */
         State->FpuStatus.Code1 = TRUE;
 
index 48e25f4..93fcbae 100644 (file)
@@ -356,7 +356,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeLar)
             /* Exception occurred */
             return;
         }
-    
+
         Selector = LOWORD(Value);
     }
     else
@@ -440,7 +440,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeLsl)
             /* Exception occurred */
             return;
         }
-    
+
         Selector = LOWORD(Value);
     }
     else
@@ -1642,7 +1642,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeBtc)
 
 FAST486_OPCODE_HANDLER(Fast486ExtOpcodeBsf)
 {
-    INT i;
+    UINT i;
     ULONG Value = 0;
     BOOLEAN OperandSize, AddressSize;
     FAST486_MOD_REG_RM ModRegRm;
index 493a42b..0c76a53 100644 (file)
@@ -65,7 +65,7 @@ UnsignedMult128(ULONGLONG Multiplicand,
     ULONG MultiplicandLow, MultiplicandHigh, MultiplierLow, MultiplierHigh;
     ULONG IntermediateLow, IntermediateHigh;
     ULONGLONG LowProduct, Intermediate, Intermediate1, Intermediate2;
-    
+
     MultiplicandLow = (ULONG)(Multiplicand & 0xFFFFFFFFULL);
     MultiplicandHigh = (ULONG)(Multiplicand >> 32);
     MultiplierLow = (ULONG)(Multiplier & 0xFFFFFFFFULL);
@@ -229,7 +229,7 @@ Fast486FpuFromInteger(PFAST486_STATE State,
 
     Result->Mantissa = (ULONGLONG)Value;
     ZeroCount = CountLeadingZeros64(Result->Mantissa);
-    
+
     Result->Mantissa <<= ZeroCount;
     Result->Exponent = FPU_REAL10_BIAS + 63 - ZeroCount;
 }
@@ -248,7 +248,7 @@ Fast486FpuToInteger(PFAST486_STATE State,
         *Result = 0LL;
         return TRUE;
     }
-    
+
     if (FPU_IS_NAN(Value) || !FPU_IS_NORMALIZED(Value)
         || (UnbiasedExp < 0) || (UnbiasedExp > 63))
     {
@@ -580,8 +580,8 @@ Fast486FpuAdd(PFAST486_STATE State,
         else TempResult.Sign = FALSE;
 
         /* Invert the negative mantissa */
-        if (FirstAdjusted.Sign) FirstAdjusted.Mantissa = -FirstAdjusted.Mantissa;
-        if (SecondAdjusted.Sign) SecondAdjusted.Mantissa = -SecondAdjusted.Mantissa;
+        if (FirstAdjusted.Sign) FirstAdjusted.Mantissa = -(LONGLONG)FirstAdjusted.Mantissa;
+        if (SecondAdjusted.Sign) SecondAdjusted.Mantissa = -(LONGLONG)SecondAdjusted.Mantissa;
 
         /* Calculate the mantissa of the result */
         TempResult.Mantissa = FirstAdjusted.Mantissa + SecondAdjusted.Mantissa;
@@ -615,7 +615,7 @@ Fast486FpuAdd(PFAST486_STATE State,
             TempResult.Exponent++;
         }
     }
-    
+
     /* Normalize the result and return it */
     Fast486FpuNormalize(State, &TempResult);
     *Result = TempResult;
@@ -720,7 +720,7 @@ Fast486FpuMultiply(PFAST486_STATE State,
     }
 
     if (FPU_IS_INFINITY(FirstOperand) || FPU_IS_INFINITY(SecondOperand))
-    {   
+    {
         /* The result will be infinity */
         Result->Sign = FirstOperand->Sign ^ SecondOperand->Sign;
         Result->Exponent = FPU_MAX_EXPONENT + 1;
@@ -755,7 +755,7 @@ Fast486FpuMultiply(PFAST486_STATE State,
     {
         /* Raise the underflow exception */
         State->FpuStatus.Ue = TRUE;
-        
+
         if (!State->FpuControl.Um)
         {
             Fast486FpuException(State);
@@ -811,7 +811,7 @@ Fast486FpuDivide(PFAST486_STATE State,
 
         if (State->FpuControl.Im)
         {
-            /* Return the indefinite NaN */ 
+            /* Return the indefinite NaN */
             Result->Sign = TRUE;
             Result->Exponent = FPU_MAX_EXPONENT + 1;
             Result->Mantissa = FPU_INDEFINITE_MANTISSA;
@@ -856,7 +856,7 @@ Fast486FpuDivide(PFAST486_STATE State,
     /* Divide the two mantissas */
     Remainder = UnsignedDivMod128(0ULL,
                                   /* Notice the 64 above - this is the high part */
-                                  FirstOperand->Mantissa, 
+                                  FirstOperand->Mantissa,
                                   SecondOperand->Mantissa,
                                   &QuotientLow,
                                   &QuotientHigh);
@@ -1774,7 +1774,7 @@ FAST486_OPCODE_HANDLER(Fast486FpuOpcodeDA)
     SourceOperand = &MemoryData;
 
     /* Perform the requested operation */
-    Fast486FpuArithmeticOperation(State, ModRegRm.Register, SourceOperand, DestOperand); 
+    Fast486FpuArithmeticOperation(State, ModRegRm.Register, SourceOperand, DestOperand);
 
 #endif
 }
@@ -1896,7 +1896,7 @@ FAST486_OPCODE_HANDLER(Fast486FpuOpcodeDB)
                 Value.Exponent = *((PUSHORT)&Buffer[8]) & (FPU_MAX_EXPONENT + 1);
                 Value.Sign = *((PUCHAR)&Buffer[9]) >> 7;
 
-                Fast486FpuPush(State, &Value); 
+                Fast486FpuPush(State, &Value);
                 break;
             }
 
@@ -1939,7 +1939,7 @@ FAST486_OPCODE_HANDLER(Fast486FpuOpcodeDB)
                     return;
                 }
 
-                Fast486FpuPop(State); 
+                Fast486FpuPop(State);
                 break;
             }
 
@@ -2469,7 +2469,7 @@ FAST486_OPCODE_HANDLER(Fast486FpuOpcodeDE)
     }
 
     /* Perform the requested operation */
-    Fast486FpuArithmeticOperation(State, ModRegRm.Register, SourceOperand, DestOperand);  
+    Fast486FpuArithmeticOperation(State, ModRegRm.Register, SourceOperand, DestOperand);
     if (!ModRegRm.Memory) Fast486FpuPop(State);
 
 #endif
@@ -2653,7 +2653,7 @@ FAST486_OPCODE_HANDLER(Fast486FpuOpcodeDF)
                     return;
                 }
 
-                Fast486FpuPop(State); 
+                Fast486FpuPop(State);
                 break;
             }
 
index 40b1001..abca6cb 100644 (file)
@@ -4154,7 +4154,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodePushFlags)
 FAST486_OPCODE_HANDLER(Fast486OpcodePopFlags)
 {
     BOOLEAN Size = State->SegmentRegs[FAST486_REG_CS].Size;
-    INT Cpl = Fast486GetCurrentPrivLevel(State);
+    UINT Cpl = Fast486GetCurrentPrivLevel(State);
     FAST486_FLAGS_REG NewFlags;
 
     NO_LOCK_PREFIX();
@@ -4487,11 +4487,11 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeRetFar)
 
     if ((State->ControlRegisters[FAST486_REG_CR0] & FAST486_CR0_PE) && !State->Flags.Vm)
     {
-        INT i;
-        INT OldCpl = Fast486GetCurrentPrivLevel(State);
+        UINT i;
+        UINT OldCpl = Fast486GetCurrentPrivLevel(State);
         ULONG StackPtr;
         ULONG StackSel;
-        
+
         if (GET_SEGMENT_RPL(Segment) > OldCpl)
         {
             /* Pop ESP */
@@ -4658,7 +4658,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeIret)
     /* Check for protected mode */
     if (State->ControlRegisters[FAST486_REG_CR0] & FAST486_CR0_PE)
     {
-        INT OldCpl = Fast486GetCurrentPrivLevel(State);
+        UINT OldCpl = Fast486GetCurrentPrivLevel(State);
 
         if (State->Flags.Vm)
         {
@@ -5291,7 +5291,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeMovOffsetAl)
 FAST486_OPCODE_HANDLER(Fast486OpcodeMovOffsetEax)
 {
     BOOLEAN OperandSize, AddressSize;
-    
+
     OperandSize = AddressSize = State->SegmentRegs[FAST486_REG_CS].Size;
 
     /* Make sure this is the right instruction */
@@ -5864,7 +5864,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeScas)
             || (!AddressSize && (State->GeneralRegs[FAST486_REG_ECX].LowWord == 0)))
         {
             /* Do nothing */
-            return; 
+            return;
         }
     }
 
index d812fcf..d4217ee 100644 (file)
@@ -209,7 +209,7 @@ Fast486RotateOperation(PFAST486_STATE State,
         case 2:
         {
             Result = (Value << Count) | (State->Flags.Cf << (Count - 1));
-            
+
             /* Complete the calculation, but make sure we don't shift by too much */
             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;
             Remainder = State->GeneralRegs[FAST486_REG_EAX].LowWord % Value;
 
-            if (Quotient > 0xFF) 
+            if (Quotient > 0xFF)
             {
                 /* Divide error */
                 Fast486Exception(State, FAST486_EXCEPTION_DE);
@@ -1023,7 +1023,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeGroupF6)
             Quotient = (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 */
                 Fast486Exception(State, FAST486_EXCEPTION_DE);
@@ -1142,7 +1142,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeGroupF7)
         case 3:
         {
             /* Calculate the result */
-            ULONG Result = -Value;
+            ULONG Result = -(LONG)Value;
             if (!OperandSize) Result &= 0xFFFF;
 
             /* Update the flags */