Author: ion Date: Mon Sep 7 18:45:09 2015 New Revision: 69097
URL: http://svn.reactos.org/svn/reactos?rev=69097&view=rev Log: [BOOTMGFW] - Last round of display fixes. GOP works now -- fill out the frame buffer with gray as a test (tested in VirtualBox). - Now to fix the heap.
Modified: trunk/reactos/boot/environ/lib/mm/descriptor.c trunk/reactos/boot/environ/lib/mm/mm.c trunk/reactos/boot/environ/lib/platform/display.c
Modified: trunk/reactos/boot/environ/lib/mm/descriptor.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/environ/lib/mm/descrip... ============================================================================== --- trunk/reactos/boot/environ/lib/mm/descriptor.c [iso-8859-1] (original) +++ trunk/reactos/boot/environ/lib/mm/descriptor.c [iso-8859-1] Mon Sep 7 18:45:09 2015 @@ -770,18 +770,46 @@ VOID ) { + PBL_MEMORY_DESCRIPTOR Descriptor, OldDescriptor; ULONG Index = 0; + PLIST_ENTRY OldFlink, OldBlink;
/* Make sure we're not int middle of a call using a descriptor */ + EarlyPrint(L"Call depth is %d\n", MmDescriptorCallTreeCount); if (MmDescriptorCallTreeCount != 1) { return; }
/* Loop every current global descriptor */ + EarlyPrint(L"MmGlobalMemoryDescriptorsUsed: %d\n", MmGlobalMemoryDescriptorsUsed); while (Index < MmGlobalMemoryDescriptorsUsed) { - EarlyPrint(L"Global descriptors not yet supported\n"); + /* Does it have any valid pageS? */ + OldDescriptor = &MmGlobalMemoryDescriptors[Index]; + if (OldDescriptor->PageCount) + { + /* Allocate a copy of it */ + Descriptor = BlMmAllocateHeap(sizeof(*Descriptor)); + if (!Descriptor) + { + return; + } + + /* Save the links */ + OldFlink = OldDescriptor->ListEntry.Blink; + OldBlink = OldDescriptor->ListEntry.Flink; + + /* Make the copy */ + *Descriptor = *OldDescriptor; + + /* Fix the links */ + OldBlink->Flink = &Descriptor->ListEntry; + OldFlink->Blink = &Descriptor->ListEntry; + + /* Zero the descriptor */ + RtlZeroMemory(OldDescriptor, sizeof(*OldDescriptor)); + }
/* Keep going */ Index++;
Modified: trunk/reactos/boot/environ/lib/mm/mm.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/environ/lib/mm/mm.c?re... ============================================================================== --- trunk/reactos/boot/environ/lib/mm/mm.c [iso-8859-1] (original) +++ trunk/reactos/boot/environ/lib/mm/mm.c [iso-8859-1] Mon Sep 7 18:45:09 2015 @@ -304,7 +304,7 @@ /* Go back to static descriptors and kill the heap */ //MmMdpSwitchToStaticDescriptors(); //HapInitializationStatus = 0; - ++MmDescriptorCallTreeCount; + //++MmDescriptorCallTreeCount;
/* Destroy the Phase 1 initialization */ //MmPaDestroy(0); @@ -315,7 +315,7 @@
Quickie: /* Free the memory descriptors and return the initialization state */ - //MmMdFreeGlobalDescriptors(); + MmMdFreeGlobalDescriptors(); --MmDescriptorCallTreeCount; return Status; }
Modified: trunk/reactos/boot/environ/lib/platform/display.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/environ/lib/platform/d... ============================================================================== --- trunk/reactos/boot/environ/lib/platform/display.c [iso-8859-1] (original) +++ trunk/reactos/boot/environ/lib/platform/display.c [iso-8859-1] Mon Sep 7 18:45:09 2015 @@ -146,17 +146,12 @@ typedef struct _BL_GRAPHICS_CONSOLE { BL_TEXT_CONSOLE TextConsole; - BL_DISPLAY_MODE DisplayMode; - ULONG PixelDepth; - ULONG FgColor; ULONG BgColor; - BL_DISPLAY_MODE OldDisplayMode; ULONG OldPixelDepth; - EFI_HANDLE Handle; BL_GRAPHICS_CONSOLE_TYPE Type; EFI_GRAPHICS_OUTPUT_PROTOCOL* Protocol; @@ -166,6 +161,11 @@ ULONG Mode; ULONG OldMode; } BL_GRAPHICS_CONSOLE, *PBL_GRAPHICS_CONSOLE; + +typedef struct _BL_REMOTE_CONSOLE +{ + BL_TEXT_CONSOLE TextConsole; +} BL_REMOTE_CONSOLE, *PBL_REMOTE_CONSOLE;
PVOID BfiCachedStrikeData; LIST_ENTRY BfiDeferredListHead; @@ -1343,6 +1343,49 @@ }
NTSTATUS +ConsoleRemoteConstruct ( + _In_ PBL_REMOTE_CONSOLE RemoteConsole + ) +{ +#ifdef BL_EMS_SUPPORT +#error Implement me +#else + /* We don't support EMS for now */ + return STATUS_NOT_IMPLEMENTED; +#endif +} + +NTSTATUS +ConsoleCreateRemoteConsole ( + _In_ PBL_TEXT_CONSOLE* TextConsole + ) +{ + PBL_REMOTE_CONSOLE RemoteConsole; + NTSTATUS Status; + + /* Allocate the remote console */ + RemoteConsole = BlMmAllocateHeap(sizeof(*RemoteConsole)); + if (!RemoteConsole) + { + return STATUS_INSUFFICIENT_RESOURCES; + } + + /* Construct it */ + Status = ConsoleRemoteConstruct(RemoteConsole); + if (Status < 0) + { + /* Failed to construct it, delete it */ + BlMmFreeHeap(RemoteConsole); + return Status; + } + + /* Save the global pointer and return a pointer to the text console */ + DspRemoteInputConsole = RemoteConsole; + *TextConsole = &RemoteConsole->TextConsole; + return STATUS_SUCCESS; +} + +NTSTATUS DsppInitialize ( _In_ ULONG Flags ) @@ -1353,8 +1396,7 @@ PBL_DISPLAY_MODE DisplayMode; //ULONG GraphicsResolution; PBL_GRAPHICS_CONSOLE GraphicsConsole; - // PVOID RemoteConsole; - PBL_TEXT_CONSOLE TextConsole; + PBL_TEXT_CONSOLE TextConsole, RemoteConsole;
/* Initialize font data */ BfiCachedStrikeData = 0; @@ -1362,11 +1404,11 @@ InitializeListHead(&BfiFontFileListHead);
/* Allocate the font rectangle */ - // BfiGraphicsRectangle = BlMmAllocateHeap(0x5A); - //if (!BfiGraphicsRectangle) - //{ - //return STATUS_NO_MEMORY; - //} + BfiGraphicsRectangle = BlMmAllocateHeap(0x5A); + if (!BfiGraphicsRectangle) + { + return STATUS_NO_MEMORY; + }
/* Display re-initialization not yet handled */ if (LibraryParameters.LibraryFlags & BL_LIBRARY_FLAG_REINITIALIZE_ALL) @@ -1406,6 +1448,7 @@ #endif if (NT_SUCCESS(Status)) { + ConsoleGraphicalResolutionListFlags |= BL_DISPLAY_GRAPHICS_FORCED_VIDEO_MODE_FLAG; EarlyPrint(L"Display selection not yet handled\n"); return STATUS_NOT_IMPLEMENTED; } @@ -1421,7 +1464,9 @@ #endif if (NT_SUCCESS(Status)) { - ConsoleGraphicalResolutionListFlags |= 2; + ConsoleGraphicalResolutionListFlags |= BL_DISPLAY_GRAPHICS_FORCED_HIGH_RES_MODE_FLAG; + EarlyPrint(L"High res mode not yet handled\n"); + return STATUS_NOT_IMPLEMENTED; }
/* Do we need graphics mode after all? */ @@ -1433,12 +1478,17 @@ { /* Construct it */ Status = ConsoleGraphicalConstruct(GraphicsConsole); - EarlyPrint(L"GFX FAILED: %lx\n", Status); if (!NT_SUCCESS(Status)) { + EarlyPrint(L"GFX FAILED: %lx\n", Status); BlMmFreeHeap(GraphicsConsole); GraphicsConsole = NULL; } + else + { + /* TEST */ + RtlFillMemory(GraphicsConsole->FrameBuffer, GraphicsConsole->FrameBufferSize, 0x55); + } } }
@@ -1450,7 +1500,8 @@ }
/* Mask out all the flags now */ - ConsoleGraphicalResolutionListFlags &= ~3; + ConsoleGraphicalResolutionListFlags &= ~(BL_DISPLAY_GRAPHICS_FORCED_VIDEO_MODE_FLAG | + BL_DISPLAY_GRAPHICS_FORCED_HIGH_RES_MODE_FLAG); }
/* Do we have a graphics console? */ @@ -1477,15 +1528,14 @@ DspGraphicalConsole = NULL;
/* If we don't have a text console, go get a remote console */ - //RemoteConsole = NULL; + RemoteConsole = NULL; if (!TextConsole) { - EarlyPrint(L"Display path not handled\n"); - return STATUS_NOT_SUPPORTED; + ConsoleCreateRemoteConsole(&RemoteConsole); }
/* Do we have a remote console? */ - if (!DspRemoteInputConsole) + if (!RemoteConsole) { /* Nope -- what about a graphical one? */ if (GraphicsConsole)