Author: weiden
Date: Mon Oct 9 20:37:27 2006
New Revision: 24473
URL:
http://svn.reactos.org/svn/reactos?rev=24473&view=rev
Log:
Make sure the compiler doesn't optimize away writes to video memory
Modified:
trunk/reactos/drivers/base/bootvid/vid_vgatext.c
Modified: trunk/reactos/drivers/base/bootvid/vid_vgatext.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/base/bootvid/vid_v…
==============================================================================
--- trunk/reactos/drivers/base/bootvid/vid_vgatext.c (original)
+++ trunk/reactos/drivers/base/bootvid/vid_vgatext.c Mon Oct 9 20:37:27 2006
@@ -61,7 +61,7 @@
static VOID NTAPI
VidpVgaTextClearDisplay(VOID)
{
- WORD *ptr = (WORD*)VidpMemory;
+ volatile WORD *ptr = (volatile WORD*)VidpMemory;
ULONG i;
for (i = 0; i < SizeX * SizeY; i++, ptr++)
@@ -166,13 +166,12 @@
static VOID NTAPI
VidpVgaTextScrollDisplay(VOID)
{
- PUSHORT ptr;
+ volatile USHORT *ptr;
int i;
- ptr = (PUSHORT)VidpMemory + SizeX;
- RtlMoveMemory(VidpMemory, ptr, SizeX * (SizeY - 1) * 2);
-
- ptr = (PUSHORT)VidpMemory + (SizeX * (SizeY - 1));
+ RtlMoveMemory(VidpMemory, (PUSHORT)VidpMemory + SizeX, SizeX * (SizeY - 1) * 2);
+
+ ptr = (volatile USHORT *)VidpMemory + (SizeX * (SizeY - 1));
for (i = 0; i < (int)SizeX; i++, ptr++)
*ptr = (CHAR_ATTRIBUTE << 8) + ' ';
}
@@ -210,9 +209,9 @@
}
else if (*pch != '\r')
{
- PUSHORT ptr;
-
- ptr = (PUSHORT)VidpMemory + ((CursorY * SizeX) + CursorX);
+ volatile USHORT *ptr;
+
+ ptr = (volatile USHORT *)VidpMemory + ((CursorY * SizeX) + CursorX);
*ptr = (CHAR_ATTRIBUTE << 8) + *pch;
CursorX++;