Author: sginsberg
Date: Sun Nov 8 22:42:28 2009
New Revision: 44032
URL: http://svn.reactos.org/svn/reactos?rev=44032&view=rev
Log:
- Fix work around for the cmpxchg8b lock errata work around -- don't set write protection if the kernel hasn't set it yet. Move the code out to HalpBiosDisplayReset so we can keep track of this. Also set the correct bit on SMP systems.
Modified:
trunk/reactos/hal/halx86/generic/bios.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] Sun Nov 8 22:42:28 2009
@@ -26,6 +26,14 @@
#define GetPdeAddress(x) (PHARDWARE_PTE)(((((ULONG_PTR)(x)) >> 22) << 2) + 0xC0300000)
#define GetPteAddress(x) (PHARDWARE_PTE)(((((ULONG_PTR)(x)) >> 12) << 2) + 0xC0000000)
+#if !defined(CONFIG_SMP)
+#define GetPteWriteBit(PTE) ((PTE)->Write)
+#define SetPteWriteBit(PTE, x) ((PTE)->Write = (x))
+#else
+#define GetPteWriteBit(PTE) ((PTE)->Writable)
+#define SetPteWriteBit(PTE, x) ((PTE)->Writable = (x))
+#endif
+
/* FUNCTIONS ******************************************************************/
VOID
@@ -107,21 +115,6 @@
HalpSwitchToRealModeTrapHandlers(VOID)
{
ULONG Handler;
- PHARDWARE_PTE IdtPte;
-
- /*
- * On P5, the first 7 entries of the IDT are write protected to work around
- * the cmpxchg8b lock errata. Unprotect them here so we can set our custom
- * invalid op-code handler.
- */
- if (KeGetCurrentPrcb()->CpuType == 5)
- {
- IdtPte = GetPteAddress(((PKIPCR)KeGetPcr())->IDT);
- IdtPte->Write = 1;
-
- /* Flush the TLB by resetting CR3 */
- __writecr3(__readcr3());
- }
/* Save the current Invalid Opcode and General Protection Fault Handlers */
HalpGpfHandler = ((((PKIPCR)KeGetPcr())->IDT[13].ExtendedOffset << 16) &
@@ -164,8 +157,6 @@
NTAPI
HalpRestoreTrapHandlers(VOID)
{
- PHARDWARE_PTE IdtPte;
-
/* We're back, restore the handlers we over-wrote */
((PKIPCR)KeGetPcr())->IDT[13].ExtendedOffset =
(USHORT)((HalpGpfHandler >> 16) & 0xFFFF);
@@ -173,16 +164,6 @@
((PKIPCR)KeGetPcr())->IDT[6].ExtendedOffset =
(USHORT)((HalpBopHandler >> 16) & 0xFFFF);
((PKIPCR)KeGetPcr())->IDT[6].Offset = (USHORT)HalpBopHandler;
-
- /* On P5, restore the write protection for the first 7 IDT entries */
- if (KeGetCurrentPrcb()->CpuType == 5)
- {
- IdtPte = GetPteAddress(((PKIPCR)KeGetPcr())->IDT);
- IdtPte->Write = 0;
-
- /* Flush the TLB by resetting CR3 */
- __writecr3(__readcr3());
- }
}
VOID
@@ -231,6 +212,8 @@
HalpBiosDisplayReset(VOID)
{
ULONG Flags;
+ PHARDWARE_PTE IdtPte;
+ BOOLEAN RestoreWriteProtection = FALSE;
/* Disable interrupts */
Flags = __readeflags();
@@ -239,6 +222,24 @@
/* Map memory available to the V8086 real-mode code */
HalpMapRealModeMemory();
+ /*
+ * On P5, the first 7 entries of the IDT are write protected to work around
+ * the cmpxchg8b lock errata. Unprotect them here so we can set our custom
+ * invalid op-code handler.
+ */
+ if (KeGetCurrentPrcb()->CpuType == 5)
+ {
+ /* Get the PTE and check if it is has been write protected yet */
+ IdtPte = GetPteAddress(((PKIPCR)KeGetPcr())->IDT);
+ if (GetPteWriteBit(IdtPte) == 0)
+ {
+ /* Remove the protection and flush the TLB */
+ SetPteWriteBit(IdtPte, 1);
+ __writecr3(__readcr3());
+ RestoreWriteProtection = TRUE;
+ }
+ }
+
/* Use special invalid opcode and GPF trap handlers */
HalpSwitchToRealModeTrapHandlers();
@@ -250,6 +251,15 @@
/* Restore kernel trap handlers */
HalpRestoreTrapHandlers();
+
+ /* Check if we removed the write protection before */
+ if (RestoreWriteProtection)
+ {
+ /* Get the PTE, restore the write protection and flush the TLB */
+ IdtPte = GetPteAddress(((PKIPCR)KeGetPcr())->IDT);
+ SetPteWriteBit(IdtPte, 0);
+ __writecr3(__readcr3());
+ }
/* Restore TSS and IOPM */
HalpRestoreIoPermissionsAndTask();
Author: fireball
Date: Sun Nov 8 21:14:15 2009
New Revision: 44029
URL: http://svn.reactos.org/svn/reactos?rev=44029&view=rev
Log:
- Check if pBitsLock is NULL in SURFACE_Cleanup before freeing it. This may happen only in a low-memory condition failure branch in create surface code. Spotted by Kamil Hornicek.
Modified:
branches/arwinss/reactos/subsystems/win32/win32k/gre/surfobj.c
Modified: branches/arwinss/reactos/subsystems/win32/win32k/gre/surfobj.c
URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
==============================================================================
--- branches/arwinss/reactos/subsystems/win32/win32k/gre/surfobj.c [iso-8859-1] (original)
+++ branches/arwinss/reactos/subsystems/win32/win32k/gre/surfobj.c [iso-8859-1] Sun Nov 8 21:14:15 2009
@@ -247,7 +247,8 @@
GDIOBJ_FreeObjByHandle(pSurf->hDIBPalette, GDI_OBJECT_TYPE_PALETTE);
/* Free bitslock storage */
- ExFreePoolWithTag(pSurf->pBitsLock, TAG_SURFOBJ);
+ if (pSurf->pBitsLock)
+ ExFreePoolWithTag(pSurf->pBitsLock, TAG_SURFOBJ);
return TRUE;
}
Author: sginsberg
Date: Sun Nov 8 12:52:23 2009
New Revision: 44027
URL: http://svn.reactos.org/svn/reactos?rev=44027&view=rev
Log:
- Make WinLdr's loading screen display the boot method (NT) instead of operating system name (Windows).
Modified:
trunk/reactos/boot/freeldr/freeldr/windows/winldr.c
Modified: trunk/reactos/boot/freeldr/freeldr/windows/winldr.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/windo…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/windows/winldr.c [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/windows/winldr.c [iso-8859-1] Sun Nov 8 12:52:23 2009
@@ -432,7 +432,7 @@
UiDrawBackdrop();
UiDrawStatusText("Detecting Hardware...");
- UiDrawProgressBarCenter(1, 100, "Loading Windows...");
+ UiDrawProgressBarCenter(1, 100, "Loading NT...");
/* Read the system path is set in the .ini file */
if (!HasSection || !IniReadSettingByName(SectionId, "SystemPath", FullPath, sizeof(FullPath)))