Author: tkreuzer
Date: Wed Jul 6 18:23:04 2011
New Revision: 52548
URL:
http://svn.reactos.org/svn/reactos?rev=52548&view=rev
Log:
[NTOSKRNL]
- Fix completely broken code to detect invalid MSR access in KiTrap0DHandler
- Fix MSVC warnings
Modified:
trunk/reactos/ntoskrnl/ke/i386/traphdlr.c
trunk/reactos/ntoskrnl/mm/ARM3/expool.c
Modified: trunk/reactos/ntoskrnl/ke/i386/traphdlr.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/i386/traphdlr.…
==============================================================================
--- trunk/reactos/ntoskrnl/ke/i386/traphdlr.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ke/i386/traphdlr.c [iso-8859-1] Wed Jul 6 18:23:04 2011
@@ -42,7 +42,7 @@
0xEE, /* OUT */
0xEF, /* OUT */
0x6E, /* OUTS */
- 0x6F, /* OUTS */
+ 0x6F, /* OUTS */
};
PFAST_SYSTEM_CALL_EXIT KiFastCallExitHandler;
@@ -143,7 +143,7 @@
KiCommonExit(TrapFrame, 0);
/* Restore previous mode */
- KeGetCurrentThread()->PreviousMode = TrapFrame->PreviousPreviousMode;
+ KeGetCurrentThread()->PreviousMode = (CCHAR)TrapFrame->PreviousPreviousMode;
/* Check for user mode exit */
if (TrapFrame->SegCs & MODE_MASK)
@@ -174,7 +174,7 @@
KiCommonExit(TrapFrame, 0);
/* Restore previous mode */
- KeGetCurrentThread()->PreviousMode = TrapFrame->PreviousPreviousMode;
+ KeGetCurrentThread()->PreviousMode = (CCHAR)TrapFrame->PreviousPreviousMode;
/* Check if this was a V8086 trap */
if (TrapFrame->EFlags & EFLAGS_V86_MASK) KiTrapReturnNoSegments(TrapFrame);
@@ -213,7 +213,7 @@
Parameter1,
Parameter2,
Parameter3,
- TrapFrame);
+ TrapFrame);
}
DECLSPEC_NORETURN
@@ -463,7 +463,7 @@
//
// Note that in reality, we are already on the NMI tss -- we just need to
// update the PCR to reflect this
- //
+ //
PCR->TSS = NmiTss;
__writeeflags(__readeflags() &~ EFLAGS_NESTED_TASK);
TssGdt->HighWord.Bits.Dpl = 0;
@@ -527,7 +527,7 @@
// Although the CPU disabled NMIs, we just did a BIOS Call, which could've
// totally changed things.
//
- // We have to make sure we're still in our original NMI -- a nested NMI
+ // We have to make sure we're still in our original NMI -- a nested NMI
// will point back to the NMI TSS, and in that case we're hosed.
//
if (PCR->TSS->Backlink != KGDT_NMI_TSS)
@@ -652,7 +652,7 @@
{
/* Should only happen in VDM mode */
UNIMPLEMENTED;
- while (TRUE);
+ while (TRUE);
}
/* Bring IRQL back */
@@ -910,7 +910,7 @@
{
/* Should only happen in VDM mode */
UNIMPLEMENTED;
- while (TRUE);
+ while (TRUE);
}
/* Bring IRQL back */
@@ -933,7 +933,7 @@
/* Enable interrupts and check error code */
_enable();
if (!TrapFrame->ErrCode)
- {
+ {
/* FIXME: Use SEH */
Instructions = (PUCHAR)TrapFrame->Eip;
@@ -1047,7 +1047,7 @@
TrapFrame);
}
- /*
+ /*
* Check for a fault during checking of the user instruction.
*
* Note that the SEH handler will catch invalid EIP, but we could be dealing
@@ -1059,7 +1059,7 @@
{
/* Not implemented */
UNIMPLEMENTED;
- while (TRUE);
+ while (TRUE);
}
/*
@@ -1100,7 +1100,7 @@
if (Instructions[0] == 0xCF)
{
/*
- * Some evil shit is going on here -- this is not the SS:ESP you're
+ * Some evil shit is going on here -- this is not the SS:ESP you're
* looking for! Instead, this is actually CS:EIP you're looking at!
* Why? Because part of the trap frame actually corresponds to the IRET
* stack during the trap exit!
@@ -1121,8 +1121,8 @@
/* So since we're not dealing with the above case, check for RDMSR/WRMSR */
if ((Instructions[0] == 0xF) && // 2-byte opcode
- (((Instructions[1] >> 8) == 0x30) || // RDMSR
- ((Instructions[2] >> 8) == 0x32))) // WRMSR
+ ((Instructions[1] == 0x32) || // RDMSR
+ (Instructions[1] == 0x30))) // WRMSR
{
/* Unknown CPU MSR, so raise an access violation */
KiDispatchException0Args(STATUS_ACCESS_VIOLATION,
@@ -1211,7 +1211,7 @@
{
/* Not yet implemented */
UNIMPLEMENTED;
- while (TRUE);
+ while (TRUE);
}
/* Check for syscall fault */
@@ -1496,7 +1496,7 @@
/* Save previous mode */
TrapFrame->PreviousPreviousMode = Thread->PreviousMode;
- /* Save the SEH chain and terminate it for now */
+ /* Save the SEH chain and terminate it for now */
TrapFrame->ExceptionList = KeGetPcr()->NtTib.ExceptionList;
KeGetPcr()->NtTib.ExceptionList = EXCEPTION_CHAIN_END;
@@ -1533,7 +1533,7 @@
goto ExitCall;
}
- /* Convert us to a GUI thread -- must wrap in ASM to get new EBP */
+ /* Convert us to a GUI thread -- must wrap in ASM to get new EBP */
Result = KiConvertToGuiThread();
if (!NT_SUCCESS(Result))
{
@@ -1541,7 +1541,7 @@
//SetLastWin32Error(RtlNtStatusToDosError(Result));
goto ExitCall;
}
-
+
/* Reload trap frame and descriptor table pointer from new stack */
TrapFrame = *(volatile PVOID*)&Thread->TrapFrame;
DescriptorTable = (PVOID)(*(volatile ULONG_PTR*)&Thread->ServiceTable +
Offset);
Modified: trunk/reactos/ntoskrnl/mm/ARM3/expool.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/expool.c?…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/ARM3/expool.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/ARM3/expool.c [iso-8859-1] Wed Jul 6 18:23:04 2011
@@ -452,7 +452,7 @@
PLIST_ENTRY ListHead;
PPOOL_HEADER Entry, NextEntry, FragmentEntry;
KIRQL OldIrql;
- ULONG BlockSize, i;
+ USHORT BlockSize, i;
//
// Some sanity checks
@@ -495,7 +495,8 @@
// request would've been treated as a POOL_MAX_ALLOC earlier and resulted in
// the direct allocation of pages.
//
- i = (NumberOfBytes + sizeof(POOL_HEADER) + (POOL_BLOCK_SIZE - 1)) / POOL_BLOCK_SIZE;
+ i = (USHORT)((NumberOfBytes + sizeof(POOL_HEADER) + (POOL_BLOCK_SIZE - 1))
+ / POOL_BLOCK_SIZE);
//
// Loop in the free lists looking for a block if this size. Start with the
@@ -748,7 +749,7 @@
IN ULONG TagToFree)
{
PPOOL_HEADER Entry, NextEntry;
- ULONG BlockSize;
+ USHORT BlockSize;
KIRQL OldIrql;
POOL_TYPE PoolType;
PPOOL_DESCRIPTOR PoolDesc;