Author: sginsberg
Date: Fri Sep 18 22:56:49 2009
New Revision: 43074
URL:
http://svn.reactos.org/svn/reactos?rev=43074&view=rev
Log:
- Use msvc intrinsics in HAL instead of Ke386*
Modified:
trunk/reactos/hal/halx86/generic/bios.c
trunk/reactos/hal/halx86/generic/timer.c
trunk/reactos/hal/halx86/mp/apic.c
trunk/reactos/hal/halx86/mp/mpsirql.c
Modified: trunk/reactos/hal/halx86/generic/bios.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/generic/bios.c?…
==============================================================================
--- trunk/reactos/hal/halx86/generic/bios.c [iso-8859-1] (original)
+++ trunk/reactos/hal/halx86/generic/bios.c [iso-8859-1] Fri Sep 18 22:56:49 2009
@@ -213,10 +213,10 @@
NTAPI
HalpBiosDisplayReset(VOID)
{
- ULONG Flags = 0;
+ ULONG Flags;
/* Disable interrupts */
- Ke386SaveFlags(Flags);
+ Flags = __readeflags();
_disable();
/* Map memory available to the V8086 real-mode code */
@@ -241,7 +241,7 @@
HalpUnmapRealModeMemory();
/* Restore interrupts if they were previously enabled */
- Ke386RestoreFlags(Flags);
+ __writeeflags(Flags);
return TRUE;
}
Modified: trunk/reactos/hal/halx86/generic/timer.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/generic/timer.c…
==============================================================================
--- trunk/reactos/hal/halx86/generic/timer.c [iso-8859-1] (original)
+++ trunk/reactos/hal/halx86/generic/timer.c [iso-8859-1] Fri Sep 18 22:56:49 2009
@@ -48,7 +48,7 @@
PKPRCB Prcb = KeGetCurrentPrcb();
ULONG Increment;
USHORT RollOver;
- ULONG Flags = 0;
+ ULONG Flags;
/* Check the CPU Type */
if (Prcb->CpuType <= 4)
@@ -67,7 +67,7 @@
KeSetTimeIncrement(Increment, HalpRolloverTable[0].HighPart);
/* Disable interrupts */
- Ke386SaveFlags(Flags);
+ Flags = __readeflags();
_disable();
/* Set the rollover */
@@ -76,7 +76,7 @@
__outbyte(TIMER_DATA_PORT0, RollOver >> 8);
/* Restore interrupts if they were previously enabled */
- Ke386RestoreFlags(Flags);
+ __writeeflags(Flags);
/* Save rollover and return */
HalpCurrentRollOver = RollOver;
@@ -92,10 +92,10 @@
HalCalibratePerformanceCounter(IN volatile PLONG Count,
IN ULONGLONG NewCount)
{
- ULONG Flags = 0;
+ ULONG Flags;
/* Disable interrupts */
- Ke386SaveFlags(Flags);
+ Flags = __readeflags();
_disable();
/* Do a decrement for this CPU */
@@ -105,7 +105,7 @@
while (*Count);
/* Restore interrupts if they were previously enabled */
- Ke386RestoreFlags(Flags);
+ __writeeflags(Flags);
}
/*
Modified: trunk/reactos/hal/halx86/mp/apic.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/mp/apic.c?rev=4…
==============================================================================
--- trunk/reactos/hal/halx86/mp/apic.c [iso-8859-1] (original)
+++ trunk/reactos/hal/halx86/mp/apic.c [iso-8859-1] Fri Sep 18 22:56:49 2009
@@ -351,7 +351,8 @@
BOOLEAN VerifyLocalAPIC(VOID)
{
SIZE_T reg0, reg1;
- ULONG l = 0, h = 0;
+ LARGE_INTEGER MsrValue;
+
/* The version register is read-only in a real APIC */
reg0 = APICRead(APIC_VER);
DPRINT1("Getting VERSION: %x\n", reg0);
@@ -398,14 +399,14 @@
return FALSE;
}
- Ke386Rdmsr(0x1b /*MSR_IA32_APICBASE*/, l, h);
-
- if (!(l & /*MSR_IA32_APICBASE_ENABLE*/(1<<11)))
+ MsrValue.QuadPart = __readmsr(0x1B /*MSR_IA32_APICBASE*/);
+
+ if (!(MsrValue.LowPart & /*MSR_IA32_APICBASE_ENABLE*/(1<<11)))
{
DPRINT1("Local APIC disabled by BIOS -- reenabling.\n");
- l &= ~/*MSR_IA32_APICBASE_BASE*/(1<<11);
- l |= /*MSR_IA32_APICBASE_ENABLE |
APIC_DEFAULT_PHYS_BASE*/(1<<11)|0xfee00000;
- Ke386Wrmsr(0x1b/*MSR_IA32_APICBASE*/, l, h);
+ MsrValue.LowPart &= ~/*MSR_IA32_APICBASE_BASE*/(1<<11);
+ MsrValue.LowPart |= /*MSR_IA32_APICBASE_ENABLE |
APIC_DEFAULT_PHYS_BASE*/(1<<11)|0xfee00000;
+ __writemsr(0x1B /*MSR_IA32_APICBASE*/, MsrValue.HighPart);
}
@@ -416,10 +417,10 @@
#ifdef CONFIG_SMP
VOID APICSendIPI(ULONG Target, ULONG Mode)
{
- ULONG tmp, i, flags = 0;
+ ULONG tmp, i, flags;
/* save flags and disable interrupts */
- Ke386SaveFlags(flags);
+ flags = __readeflags();
_disable();
/* Wait up to 100ms for the APIC to become ready */
@@ -475,7 +476,7 @@
{
DPRINT1("CPU(%d) Current IPI was not delivered after 100ms.\n",
ThisCPU());
}
- Ke386RestoreFlags(flags);
+ __writeeflags(flags);
}
#endif
Modified: trunk/reactos/hal/halx86/mp/mpsirql.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/mp/mpsirql.c?re…
==============================================================================
--- trunk/reactos/hal/halx86/mp/mpsirql.c [iso-8859-1] (original)
+++ trunk/reactos/hal/halx86/mp/mpsirql.c [iso-8859-1] Fri Sep 18 22:56:49 2009
@@ -28,9 +28,9 @@
*/
{
KIRQL irql;
- ULONG Flags = 0;
-
- Ke386SaveFlags(Flags);
+ ULONG Flags;
+
+ Flags = __readeflags();
_disable();
irql = __readfsbyte(FIELD_OFFSET(KPCR, Irql));
@@ -53,13 +53,13 @@
* PURPOSE: Sets the current irq level without taking any action
*/
{
- ULONG Flags = 0;
+ ULONG Flags;
if (NewIrql > HIGH_LEVEL)
{
DPRINT1 ("NewIrql %x\n", NewIrql);
ASSERT(FALSE);
}
- Ke386SaveFlags(Flags);
+ Flags = __readeflags();
_disable();
__writefsbyte(FIELD_OFFSET(KPCR, Irql), NewIrql);
if (Flags & EFLAGS_INTERRUPT_MASK)
@@ -71,7 +71,7 @@
VOID
HalpLowerIrql(KIRQL NewIrql, BOOLEAN FromHalEndSystemInterrupt)
{
- ULONG Flags = 0;
+ ULONG Flags;
UCHAR DpcRequested;
if (NewIrql >= DISPATCH_LEVEL)
{
@@ -79,7 +79,7 @@
APICWrite(APIC_TPR, IRQL2TPR (NewIrql) & APIC_TPR_PRI);
return;
}
- Ke386SaveFlags(Flags);
+ Flags = __readeflags();
if (KeGetCurrentIrql() > APC_LEVEL)
{
KeSetCurrentIrql (DISPATCH_LEVEL);
@@ -188,9 +188,9 @@
KfRaiseIrql (KIRQL NewIrql)
{
KIRQL OldIrql;
- ULONG Flags = 0;
+ ULONG Flags;
- Ke386SaveFlags(Flags);
+ Flags = __readeflags();
_disable();
OldIrql = KeGetCurrentIrql ();
@@ -295,7 +295,7 @@
ULONG Vector,
PKIRQL OldIrql)
{
- ULONG Flags = 0;
+ ULONG Flags;
DPRINT("Vector (0x%X) Irql (0x%X)\n", Vector, Irql);
if (KeGetCurrentIrql () >= Irql)
@@ -304,7 +304,7 @@
ASSERT(FALSE);
}
- Ke386SaveFlags(Flags);
+ Flags = __readeflags();
if (Flags & EFLAGS_INTERRUPT_MASK)
{
DPRINT1("HalBeginSystemInterrupt was called with interrupt's
enabled\n");
@@ -324,8 +324,8 @@
* FUNCTION: Finish a system interrupt and restore the specified irq level.
*/
{
- ULONG Flags = 0;
- Ke386SaveFlags(Flags);
+ ULONG Flags;
+ Flags = __readeflags();
if (Flags & EFLAGS_INTERRUPT_MASK)
{