diff --git a/reactos/lib/fast486/common.c b/reactos/lib/fast486/common.c index 52f2fc75ca8..a6d24590973 100644 --- a/reactos/lib/fast486/common.c +++ b/reactos/lib/fast486/common.c @@ -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; } diff --git a/reactos/lib/fast486/common.h b/reactos/lib/fast486/common.h index d934f20c78f..d0394c00cc2 100644 --- a/reactos/lib/fast486/common.h +++ b/reactos/lib/fast486/common.h @@ -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)) diff --git a/reactos/lib/fast486/common.inl b/reactos/lib/fast486/common.inl index 34c1a78b7c7..b000a301b69 100644 --- a/reactos/lib/fast486/common.inl +++ b/reactos/lib/fast486/common.inl @@ -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; diff --git a/reactos/lib/fast486/extraops.c b/reactos/lib/fast486/extraops.c index 48e25f4ada9..93fcbae19a6 100644 --- a/reactos/lib/fast486/extraops.c +++ b/reactos/lib/fast486/extraops.c @@ -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; diff --git a/reactos/lib/fast486/fpu.c b/reactos/lib/fast486/fpu.c index 493a42b0cff..0c76a5304e5 100644 --- a/reactos/lib/fast486/fpu.c +++ b/reactos/lib/fast486/fpu.c @@ -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; } diff --git a/reactos/lib/fast486/opcodes.c b/reactos/lib/fast486/opcodes.c index 40b1001f9e6..abca6cb8645 100644 --- a/reactos/lib/fast486/opcodes.c +++ b/reactos/lib/fast486/opcodes.c @@ -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; } } diff --git a/reactos/lib/fast486/opgroups.c b/reactos/lib/fast486/opgroups.c index d812fcf11ec..d4217eeffa5 100644 --- a/reactos/lib/fast486/opgroups.c +++ b/reactos/lib/fast486/opgroups.c @@ -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 */