- Add EFLAGS_IOPL to asm.h and make use of it in assembly

- Fix a potential 64-bit warning in handle.c
- Comment fixes

svn path=/trunk/; revision=35529
This commit is contained in:
Stefan Ginsberg 2008-08-22 14:29:01 +00:00
parent f1fe2984b3
commit 16ab5c9a07
9 changed files with 18 additions and 17 deletions

View file

@ -450,6 +450,7 @@ Author:
#ifdef __ASM__ #ifdef __ASM__
#define EFLAGS_TF 0x100 #define EFLAGS_TF 0x100
#define EFLAGS_INTERRUPT_MASK 0x200 #define EFLAGS_INTERRUPT_MASK 0x200
#define EFLAGS_IOPL 0x3000
#define EFLAGS_NESTED_TASK 0x4000 #define EFLAGS_NESTED_TASK 0x4000
#define EFLAGS_V86_MASK 0x20000 #define EFLAGS_V86_MASK 0x20000
#define EFLAGS_ALIGN_CHECK 0x40000 #define EFLAGS_ALIGN_CHECK 0x40000

View file

@ -59,7 +59,7 @@ ExpLookupHandleTableEntry(IN PHANDLE_TABLE HandleTable,
/* Direct index */ /* Direct index */
case 0: case 0:
/* Use level 1 and just get the entry directlry */ /* Use level 1 and just get the entry directly */
Level1 = (PUCHAR)TableBase; Level1 = (PUCHAR)TableBase;
Entry = (PVOID)&Level1[Handle.Value * Entry = (PVOID)&Level1[Handle.Value *
(sizeof(HANDLE_TABLE_ENTRY) / (sizeof(HANDLE_TABLE_ENTRY) /
@ -210,8 +210,8 @@ ExpFreeHandleTable(IN PHANDLE_TABLE HandleTable)
PEPROCESS Process = HandleTable->QuotaProcess; PEPROCESS Process = HandleTable->QuotaProcess;
ULONG i, j; ULONG i, j;
ULONG_PTR TableCode = HandleTable->TableCode; ULONG_PTR TableCode = HandleTable->TableCode;
ULONG TableLevel = TableCode & 3;
ULONG_PTR TableBase = TableCode & ~3; ULONG_PTR TableBase = TableCode & ~3;
ULONG TableLevel = (ULONG)(TableCode & 3);
PHANDLE_TABLE_ENTRY Level1, *Level2, **Level3; PHANDLE_TABLE_ENTRY Level1, *Level2, **Level3;
PAGED_CODE(); PAGED_CODE();

View file

@ -74,7 +74,7 @@ ExpGetCurrentUserUILanguage(IN PWSTR MuiName,
/* Success, is the value the right type? */ /* Success, is the value the right type? */
if (ValueInfo->Type == REG_SZ) if (ValueInfo->Type == REG_SZ)
{ {
/* It is. Initailize the data and convert it */ /* It is. Initialize the data and convert it */
RtlInitUnicodeString(&ValueString, (PWSTR)ValueInfo->Data); RtlInitUnicodeString(&ValueString, (PWSTR)ValueInfo->Data);
Status = RtlUnicodeStringToInteger(&ValueString, 16, &Value); Status = RtlUnicodeStringToInteger(&ValueString, 16, &Value);
if (NT_SUCCESS(Status)) if (NT_SUCCESS(Status))

View file

@ -36,7 +36,7 @@ _KiSystemStartup:
test dword ptr [esp+4], 0x80000000 test dword ptr [esp+4], 0x80000000
jnz _KiSystemStartupReal@4 jnz _KiSystemStartupReal@4
/* FREELDR Boot: Cal the FreeLDR wrapper */ /* FREELDR Boot: Call the FreeLDR wrapper */
jmp @KiRosPrepareForSystemStartup@8 jmp @KiRosPrepareForSystemStartup@8
.endfunc .endfunc

View file

@ -113,7 +113,7 @@ KiRecordDr7(OUT PULONG Dr7Ptr,
/* Check if the caller gave us a mask */ /* Check if the caller gave us a mask */
if (!DrMask) if (!DrMask)
{ {
/* He didn't use the one from the thread */ /* He didn't, use the one from the thread */
Mask = KeGetCurrentThread()->DispatcherHeader.DebugActive; Mask = KeGetCurrentThread()->DispatcherHeader.DebugActive;
} }
else else
@ -266,7 +266,7 @@ ULONG
NTAPI NTAPI
KiSsFromTrapFrame(IN PKTRAP_FRAME TrapFrame) KiSsFromTrapFrame(IN PKTRAP_FRAME TrapFrame)
{ {
/* If this was V86 Mode */ /* Check if this was V86 Mode */
if (TrapFrame->EFlags & EFLAGS_V86_MASK) if (TrapFrame->EFlags & EFLAGS_V86_MASK)
{ {
/* Just return it */ /* Just return it */
@ -599,7 +599,7 @@ KeContextToTrapFrame(IN PCONTEXT Context,
} }
/* Check if thread has IOPL and force it enabled if so */ /* Check if thread has IOPL and force it enabled if so */
if (KeGetCurrentThread()->Iopl) TrapFrame->EFlags |= 0x3000; if (KeGetCurrentThread()->Iopl) TrapFrame->EFlags |= EFLAGS_IOPL;
/* Restore IRQL */ /* Restore IRQL */
if (OldIrql < APC_LEVEL) KeLowerIrql(OldIrql); if (OldIrql < APC_LEVEL) KeLowerIrql(OldIrql);

View file

@ -132,7 +132,7 @@ Ke386InitThreadWithContext(IN PKTHREAD Thread,
Thread->NpxState = NPX_STATE_NOT_LOADED &~ CR0_MP; Thread->NpxState = NPX_STATE_NOT_LOADED &~ CR0_MP;
} }
/* Disable any debug regiseters */ /* Disable any debug registers */
Context->ContextFlags &= ~CONTEXT_DEBUG_REGISTERS; Context->ContextFlags &= ~CONTEXT_DEBUG_REGISTERS;
/* Setup the Trap Frame */ /* Setup the Trap Frame */

View file

@ -1836,7 +1836,7 @@ NotGdt:
CheckRing3Io: CheckRing3Io:
/* Get EFLAGS and IOPL */ /* Get EFLAGS and IOPL */
mov ebx, [ebp+KTRAP_FRAME_EFLAGS] mov ebx, [ebp+KTRAP_FRAME_EFLAGS]
and ebx, 0x3000 and ebx, EFLAGS_IOPL
shr ebx, 12 shr ebx, 12
/* Check the CS's RPL mask */ /* Check the CS's RPL mask */

View file

@ -215,7 +215,7 @@ _OpcodePUSHFV86:
or eax, edx or eax, edx
/* Add IOPL Mask */ /* Add IOPL Mask */
or eax, 0x3000 or eax, EFLAGS_IOPL
/* Get flat ESP */ /* Get flat ESP */
movzx ecx, word ptr [ebp+KTRAP_FRAME_SS] movzx ecx, word ptr [ebp+KTRAP_FRAME_SS]
@ -277,7 +277,7 @@ NoPrefix:
mov [ebp+KTRAP_FRAME_ESP], edx mov [ebp+KTRAP_FRAME_ESP], edx
/* Mask out EFLAGS */ /* Mask out EFLAGS */
and eax, ~0x3000 and eax, ~EFLAGS_IOPL
mov ebx, ebx mov ebx, ebx
and ebx, ~0x4000 and ebx, ~0x4000
and ecx, EFLAGS_ALIGN_CHECK + 0x4000 + EFLAGS_INTERRUPT_MASK and ecx, EFLAGS_ALIGN_CHECK + 0x4000 + EFLAGS_INTERRUPT_MASK
@ -353,7 +353,7 @@ _OpcodeINTnnV86:
mov [ebp+KTRAP_FRAME_EFLAGS], edx mov [ebp+KTRAP_FRAME_EFLAGS], edx
/* Set the IOPL Mask */ /* Set the IOPL Mask */
or eax, 0x3000 or eax, EFLAGS_IOPL
/* Get stack flat address */ /* Get stack flat address */
movzx ecx, word ptr [ebp+KTRAP_FRAME_SS] movzx ecx, word ptr [ebp+KTRAP_FRAME_SS]
@ -450,7 +450,7 @@ _OpcodeIRETV86:
MaskEFlags: MaskEFlags:
/* Mask out EFLAGS */ /* Mask out EFLAGS */
and ebx, ~(0x3000 + EFLAGS_VIF + 0x4000 + EFLAGS_VIP) and ebx, ~(EFLAGS_IOPL + EFLAGS_VIF + 0x4000 + EFLAGS_VIP)
mov ecx, ebx mov ecx, ebx
/* FIXME: Check for VME support */ /* FIXME: Check for VME support */

View file

@ -1142,7 +1142,7 @@ NtTerminateProcess(IN HANDLE ProcessHandle OPTIONAL,
/* Lock the Process */ /* Lock the Process */
if (!ExAcquireRundownProtection(&Process->RundownProtect)) if (!ExAcquireRundownProtection(&Process->RundownProtect))
{ {
/* Failed to lock, fal */ /* Failed to lock, fail */
ObDereferenceObject (Process); ObDereferenceObject (Process);
return STATUS_PROCESS_IS_TERMINATING; return STATUS_PROCESS_IS_TERMINATING;
} }
@ -1182,7 +1182,7 @@ NtTerminateProcess(IN HANDLE ProcessHandle OPTIONAL,
/* Also make sure the caller gave us our handle */ /* Also make sure the caller gave us our handle */
if (KillByHandle) if (KillByHandle)
{ {
/* Dereference the project */ /* Dereference the process */
ObDereferenceObject(Process); ObDereferenceObject(Process);
/* Terminate ourselves */ /* Terminate ourselves */