ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
February 2017
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
13 participants
353 discussions
Start a n
N
ew thread
[tfaber] 73696: [TOOLS] - Add /EHsc for all C++ sources under MSVC instead of doing it per-file
by tfaber@svn.reactos.org
Author: tfaber Date: Sun Feb 5 09:51:33 2017 New Revision: 73696 URL:
http://svn.reactos.org/svn/reactos?rev=73696&view=rev
Log: [TOOLS] - Add /EHsc for all C++ sources under MSVC instead of doing it per-file Modified: trunk/reactos/sdk/tools/CMakeLists.txt trunk/reactos/sdk/tools/hhpcomp/CMakeLists.txt trunk/reactos/sdk/tools/xml2sdb/CMakeLists.txt Modified: trunk/reactos/sdk/tools/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/tools/CMakeLists.txt?r…
============================================================================== --- trunk/reactos/sdk/tools/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/sdk/tools/CMakeLists.txt [iso-8859-1] Sun Feb 5 09:51:33 2017 @@ -10,6 +10,7 @@ if(MSVC) add_definitions(-D_CRT_SECURE_NO_WARNINGS) + add_compile_flags_language("/EHsc" "CXX") endif() add_host_tool(bin2c bin2c.c) @@ -19,9 +20,6 @@ add_host_tool(obj2bin obj2bin/obj2bin.c) add_host_tool(spec2def spec2def/spec2def.c) -if(MSVC) - set_property(SOURCE utf16le/utf16le.cpp APPEND_STRING PROPERTY COMPILE_FLAGS " /EHsc") -endif() add_host_tool(utf16le utf16le/utf16le.cpp) add_subdirectory(cabman) Modified: trunk/reactos/sdk/tools/hhpcomp/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/tools/hhpcomp/CMakeLis…
============================================================================== --- trunk/reactos/sdk/tools/hhpcomp/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/sdk/tools/hhpcomp/CMakeLists.txt [iso-8859-1] Sun Feb 5 09:51:33 2017 @@ -12,13 +12,5 @@ # used by lzx_compress add_definitions(-DNONSLIDE) -if(MSVC) - set_property(SOURCE - hhpcomp.cpp - hhp_reader.cpp - utils.cpp - APPEND_STRING PROPERTY COMPILE_FLAGS " /EHsc") -endif() - add_executable(hhpcomp ${SOURCE}) target_link_libraries(hhpcomp) Modified: trunk/reactos/sdk/tools/xml2sdb/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/tools/xml2sdb/CMakeLis…
============================================================================== --- trunk/reactos/sdk/tools/xml2sdb/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/sdk/tools/xml2sdb/CMakeLists.txt [iso-8859-1] Sun Feb 5 09:51:33 2017 @@ -11,8 +11,6 @@ include_directories(${REACTOS_SOURCE_DIR}/dll/appcompat/apphelp) add_host_tool(xml2sdb ${SOURCE}) -if(MSVC) - set_source_files_properties(${SOURCE} PROPERTIES COMPILE_FLAGS " /EHsc") -else() +if(NOT MSVC) add_target_compile_flags(xml2sdb "-fshort-wchar") endif()
7 years, 10 months
1
0
0
0
[tfaber] 73695: [ZLIBHOST] - We only need the minimal Z_SOLO functionality. Avoids some compiler warnings.
by tfaber@svn.reactos.org
Author: tfaber Date: Sun Feb 5 09:42:43 2017 New Revision: 73695 URL:
http://svn.reactos.org/svn/reactos?rev=73695&view=rev
Log: [ZLIBHOST] - We only need the minimal Z_SOLO functionality. Avoids some compiler warnings. Modified: trunk/reactos/sdk/lib/3rdparty/zlib/CMakeLists.txt Modified: trunk/reactos/sdk/lib/3rdparty/zlib/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/lib/3rdparty/zlib/CMak…
============================================================================== --- trunk/reactos/sdk/lib/3rdparty/zlib/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/sdk/lib/3rdparty/zlib/CMakeLists.txt [iso-8859-1] Sun Feb 5 09:42:43 2017 @@ -26,5 +26,6 @@ add_library(zlib_solo ${SOLO_SOURCE}) add_target_compile_definitions(zlib_solo Z_SOLO) else() - add_library(zlibhost ${SOURCE} ${SOLO_SOURCE}) + add_library(zlibhost ${SOLO_SOURCE}) + add_target_compile_definitions(zlibhost Z_SOLO) endif()
7 years, 10 months
1
0
0
0
[tfaber] 73694: [BOOTLIB] - Remove an unused variable aka fix GCC build
by tfaber@svn.reactos.org
Author: tfaber Date: Sun Feb 5 08:50:40 2017 New Revision: 73694 URL:
http://svn.reactos.org/svn/reactos?rev=73694&view=rev
Log: [BOOTLIB] - Remove an unused variable aka fix GCC build Modified: trunk/reactos/boot/environ/lib/mm/descriptor.c Modified: trunk/reactos/boot/environ/lib/mm/descriptor.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/environ/lib/mm/descri…
============================================================================== --- trunk/reactos/boot/environ/lib/mm/descriptor.c [iso-8859-1] (original) +++ trunk/reactos/boot/environ/lib/mm/descriptor.c [iso-8859-1] Sun Feb 5 08:50:40 2017 @@ -253,7 +253,6 @@ { NTSTATUS Status; PULONG Used; - BOOLEAN Finished; PLIST_ENTRY First, NextEntry; PBL_MEMORY_DESCRIPTOR Descriptor;
7 years, 10 months
1
0
0
0
[ion] 73693: [ROSLOAD]: Implement most of OslMain, which will try to initialize BootLib in Virtual Protected Mode (mostly unimplemented). [BOOTLIB]: Fix GCC build. Bootmgr now correctly switches ex...
by ion@svn.reactos.org
Author: ion Date: Sun Feb 5 06:02:11 2017 New Revision: 73693 URL:
http://svn.reactos.org/svn/reactos?rev=73693&view=rev
Log: [ROSLOAD]: Implement most of OslMain, which will try to initialize BootLib in Virtual Protected Mode (mostly unimplemented). [BOOTLIB]: Fix GCC build. Bootmgr now correctly switches execution into rosload, which must now be implemented. Modified: trunk/reactos/boot/environ/app/rosload/rosload.c trunk/reactos/boot/environ/lib/firmware/efi/firmware.c trunk/reactos/boot/environ/lib/misc/image.c Modified: trunk/reactos/boot/environ/app/rosload/rosload.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/environ/app/rosload/r…
============================================================================== --- trunk/reactos/boot/environ/app/rosload/rosload.c [iso-8859-1] (original) +++ trunk/reactos/boot/environ/app/rosload/rosload.c [iso-8859-1] Sun Feb 5 06:02:11 2017 @@ -33,7 +33,22 @@ _In_ PBOOT_APPLICATION_PARAMETER_BLOCK BootParameters ) { - EfiPrintf(L"ReactOS UEFI OS Loader Initializing...\r\n"); - return STATUS_NOT_IMPLEMENTED; + BL_LIBRARY_PARAMETERS LibraryParameters; + NTSTATUS Status; + + /* Setup the boot library parameters for this application */ + BlSetupDefaultParameters(&LibraryParameters); + LibraryParameters.TranslationType = BlVirtual; + LibraryParameters.LibraryFlags = BL_LIBRARY_FLAG_INITIALIZATION_COMPLETED; + LibraryParameters.MinimumAllocationCount = 1024; + LibraryParameters.MinimumHeapSize = 2 * 1024 * 1024; + LibraryParameters.HeapAllocationAttributes = 0x20000; + LibraryParameters.FontBaseDirectory = L"\\Reactos\\Boot\\Fonts"; + LibraryParameters.DescriptorCount = 512; + Status = BlInitializeLibrary(BootParameters, &LibraryParameters); + + //EfiPrintf(L"ReactOS UEFI OS Loader Initializing...\r\n"); + EfiConOut->OutputString(EfiConOut, L"ReactOS UEFI OS Loader Initializing...\r\n"); + return Status; } Modified: trunk/reactos/boot/environ/lib/firmware/efi/firmware.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/environ/lib/firmware/…
============================================================================== --- trunk/reactos/boot/environ/lib/firmware/efi/firmware.c [iso-8859-1] (original) +++ trunk/reactos/boot/environ/lib/firmware/efi/firmware.c [iso-8859-1] Sun Feb 5 06:02:11 2017 @@ -1758,7 +1758,7 @@ /* FIXME: Not supported */ Status = STATUS_NOT_SUPPORTED; } - else if (FirmwareData->Version >= 2) + else if (FirmwareData->Version >= BL_FIRMWARE_DESCRIPTOR_VERSION) { /* Version 2 -- save the data */ EfiFirmwareData = *FirmwareData; Modified: trunk/reactos/boot/environ/lib/misc/image.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/environ/lib/misc/imag…
============================================================================== --- trunk/reactos/boot/environ/lib/misc/image.c [iso-8859-1] (original) +++ trunk/reactos/boot/environ/lib/misc/image.c [iso-8859-1] Sun Feb 5 06:02:11 2017 @@ -22,7 +22,7 @@ KDESCRIPTOR BootAppGdtRegister; KDESCRIPTOR BootAppIdtRegister; PVOID BootApp32EntryRoutine; -PVOID BootApp32Parameters; +PBOOT_APPLICATION_PARAMETER_BLOCK BootApp32Parameters; PVOID BootApp32Stack; /* FUNCTIONS *****************************************************************/ @@ -1710,7 +1710,7 @@ ParameterBlock->Signature[1] = BOOT_APPLICATION_SIGNATURE_2; ParameterBlock->MemoryTranslationType = MmTranslationType; ParameterBlock->ImageType = IMAGE_FILE_MACHINE_I386; - ParameterBlock->ImageBase = (ULONGLONG)ImageBase; + ParameterBlock->ImageBase = (ULONG_PTR)ImageBase; ParameterBlock->ImageSize = NtHeaders->OptionalHeader.SizeOfImage; /* Get the offset to the memory data */ @@ -1870,9 +1870,6 @@ /* Disable the kernel debugger */ BlBdStop(); #endif - /* Not yet implemented. This is the last step! */ - EfiPrintf(L"EFI APPLICATION START!!!\r\n"); - /* Make it so */ Archx86TransferTo32BitApplicationAsm();
7 years, 10 months
1
0
0
0
[ion] 73692: [BOOTLIB]: Implement BlFwGetParameters. [BOOTLIB]: Implement ImgpCopyApplicationBootDevice except for partition devices; [BOOTLIB]: Implement ImgpInitializeBootApplicationParameters. [...
by ion@svn.reactos.org
Author: ion Date: Sun Feb 5 05:35:44 2017 New Revision: 73692 URL:
http://svn.reactos.org/svn/reactos?rev=73692&view=rev
Log: [BOOTLIB]: Implement BlFwGetParameters. [BOOTLIB]: Implement ImgpCopyApplicationBootDevice except for partition devices; [BOOTLIB]: Implement ImgpInitializeBootApplicationParameters. [BOOTLIB]: Fix bug in BlMmGetMemoryMap. [BOOTLIB]: Simplify MmMdCopyList. Modified: trunk/reactos/boot/environ/include/bl.h trunk/reactos/boot/environ/lib/firmware/efi/firmware.c trunk/reactos/boot/environ/lib/misc/image.c trunk/reactos/boot/environ/lib/mm/descriptor.c trunk/reactos/boot/environ/lib/mm/pagealloc.c Modified: trunk/reactos/boot/environ/include/bl.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/environ/include/bl.h?…
============================================================================== --- trunk/reactos/boot/environ/include/bl.h [iso-8859-1] (original) +++ trunk/reactos/boot/environ/include/bl.h [iso-8859-1] Sun Feb 5 05:35:44 2017 @@ -183,7 +183,6 @@ #define BL_LOAD_PE_IMG_CHECK_FORCED_INTEGRITY 0x200 #define BL_LOAD_PE_IMG_IGNORE_CHECKSUM_MISMATCH 0x10000 #define BL_LOAD_PE_IMG_VALIDATE_ORIGINAL_FILENAME 0x400000 - #define BL_UTL_CHECKSUM_COMPLEMENT 0x10000 #define BL_UTL_CHECKSUM_ROTATE 0x20000 @@ -1402,6 +1401,11 @@ EfiPrintf ( _In_ PWCHAR Format, ... + ); + +NTSTATUS +BlFwGetParameters( + _In_ PBL_FIRMWARE_DESCRIPTOR Parameters ); NTSTATUS Modified: trunk/reactos/boot/environ/lib/firmware/efi/firmware.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/environ/lib/firmware/…
============================================================================== --- trunk/reactos/boot/environ/lib/firmware/efi/firmware.c [iso-8859-1] (original) +++ trunk/reactos/boot/environ/lib/firmware/efi/firmware.c [iso-8859-1] Sun Feb 5 05:35:44 2017 @@ -1782,6 +1782,22 @@ /* Return the initialization state */ return Status; +} + +NTSTATUS +BlFwGetParameters ( + _In_ PBL_FIRMWARE_DESCRIPTOR Parameters + ) +{ + /* Make sure we got an argument */ + if (!Parameters) + { + return STATUS_INVALID_PARAMETER; + } + + /* Copy the static data */ + *Parameters = *EfiFirmwareParameters; + return STATUS_SUCCESS; } NTSTATUS Modified: trunk/reactos/boot/environ/lib/misc/image.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/environ/lib/misc/imag…
============================================================================== --- trunk/reactos/boot/environ/lib/misc/image.c [iso-8859-1] (original) +++ trunk/reactos/boot/environ/lib/misc/image.c [iso-8859-1] Sun Feb 5 05:35:44 2017 @@ -1605,6 +1605,26 @@ } NTSTATUS +ImgpCopyApplicationBootDevice ( + __in PBL_DEVICE_DESCRIPTOR DestinationDevice, + __in PBL_DEVICE_DESCRIPTOR SourceDevice + ) +{ + /* Is this a partition device? */ + if (SourceDevice->DeviceType != PartitionDevice) + { + /* It's not -- a simple copy will do */ + RtlCopyMemory(DestinationDevice, SourceDevice, SourceDevice->Size); + return STATUS_SUCCESS; + } + + /* TODO */ + EfiPrintf(L"Partition copy not supported\r\n"); + return STATUS_NOT_IMPLEMENTED; + +} + +NTSTATUS ImgpInitializeBootApplicationParameters ( _In_ PBL_IMAGE_PARAMETERS ImageParameters, _In_ PBL_APPLICATION_ENTRY AppEntry, @@ -1616,6 +1636,13 @@ PIMAGE_NT_HEADERS NtHeaders; BL_IMAGE_PARAMETERS MemoryParameters; LIST_ENTRY MemoryList; + PBL_FIRMWARE_DESCRIPTOR FirmwareParameters; + PBL_DEVICE_DESCRIPTOR BootDevice; + PBL_MEMORY_DATA MemoryData; + PBL_APPLICATION_ENTRY BootAppEntry; + PBL_RETURN_ARGUMENTS ReturnArguments; + PBOOT_APPLICATION_PARAMETER_BLOCK ParameterBlock; + ULONG EntrySize, BufferSize; /* Get the image headers and validate it */ Status = RtlImageNtHeaderEx(0, ImageBase, ImageSize, &NtHeaders); @@ -1636,10 +1663,138 @@ 0); if ((Status != STATUS_BUFFER_TOO_SMALL) && (Status != STATUS_SUCCESS)) { + /* We failed due to an unknown reason -- bail out */ return Status; } - EfiPrintf(L"Memory map needs %lx bytes\n", MemoryParameters.BufferSize); + /* Compute the list of the BCD plus the application entry */ + EntrySize = BlGetBootOptionListSize(&AppEntry->BcdData) + + FIELD_OFFSET(BL_APPLICATION_ENTRY, BcdData); + + /* Compute the total size required for the entire structure */ + BufferSize = EntrySize + + BlpBootDevice->Size + + MemoryParameters.BufferSize + + sizeof(*ReturnArguments) + + sizeof(*MemoryData) + + sizeof(*FirmwareParameters) + + sizeof(*ParameterBlock); + + /* Check if this gives us enough space */ + if (ImageParameters->BufferSize < BufferSize) + { + /* It does not -- free the existing buffer */ + if (ImageParameters->BufferSize) + { + BlMmFreeHeap(ImageParameters->Buffer); + } + + /* Allocate a new buffer of sufficient size */ + ImageParameters->BufferSize = BufferSize; + ImageParameters->Buffer = BlMmAllocateHeap(BufferSize); + if (!ImageParameters->Buffer) + { + /* Bail out if we couldn't allocate it */ + return STATUS_NO_MEMORY; + } + } + + /* Zero out the parameter block */ + ParameterBlock = (PBOOT_APPLICATION_PARAMETER_BLOCK)ImageParameters->Buffer; + RtlZeroMemory(ParameterBlock, BufferSize); + + /* Initialize it */ + ParameterBlock->Version = BOOT_APPLICATION_VERSION; + ParameterBlock->Size = BufferSize; + ParameterBlock->Signature[0] = BOOT_APPLICATION_SIGNATURE_1; + ParameterBlock->Signature[1] = BOOT_APPLICATION_SIGNATURE_2; + ParameterBlock->MemoryTranslationType = MmTranslationType; + ParameterBlock->ImageType = IMAGE_FILE_MACHINE_I386; + ParameterBlock->ImageBase = (ULONGLONG)ImageBase; + ParameterBlock->ImageSize = NtHeaders->OptionalHeader.SizeOfImage; + + /* Get the offset to the memory data */ + ParameterBlock->MemoryDataOffset = sizeof(*ParameterBlock); + + /* Fill it out */ + MemoryData = (PBL_MEMORY_DATA)((ULONG_PTR)ParameterBlock + + ParameterBlock->MemoryDataOffset); + MemoryData->Version = BL_MEMORY_DATA_VERSION; + MemoryData->MdListOffset = sizeof(*MemoryData); + MemoryData->DescriptorSize = sizeof(BL_MEMORY_DESCRIPTOR); + MemoryData->DescriptorOffset = FIELD_OFFSET(BL_MEMORY_DESCRIPTOR, BasePage); + + /* And populate the memory map */ + MemoryParameters.Buffer = MemoryData + 1; + Status = BlMmGetMemoryMap(&MemoryList, + &MemoryParameters, + BL_MM_INCLUDE_PERSISTENT_MEMORY | + BL_MM_INCLUDE_MAPPED_ALLOCATED | + BL_MM_INCLUDE_MAPPED_UNALLOCATED | + BL_MM_INCLUDE_UNMAPPED_ALLOCATED | + BL_MM_INCLUDE_RESERVED_ALLOCATED, + 0); + if (!NT_SUCCESS(Status)) + { + return Status; + } + + /* Now that we have the map, indicate the number of descriptors */ + MemoryData->DescriptorCount = MemoryParameters.ActualSize / + MemoryData->DescriptorSize; + + /* Get the offset to the application entry */ + ParameterBlock->AppEntryOffset = ParameterBlock->MemoryDataOffset + + MemoryData->MdListOffset + + MemoryParameters.BufferSize; + + /* Fill it out */ + BootAppEntry = (PBL_APPLICATION_ENTRY)((ULONG_PTR)ParameterBlock + + ParameterBlock->AppEntryOffset); + RtlCopyMemory(BootAppEntry, AppEntry, EntrySize); + + /* Get the offset to the boot device */ + ParameterBlock->BootDeviceOffset = ParameterBlock->AppEntryOffset + + EntrySize; + + /* Fill it out */ + BootDevice = (PBL_DEVICE_DESCRIPTOR)((ULONG_PTR)ParameterBlock + + ParameterBlock->BootDeviceOffset); + Status = ImgpCopyApplicationBootDevice(BootDevice, BlpBootDevice); + if (!NT_SUCCESS(Status)) + { + return Status; + } + + /* Get the offset to the firmware data */ + ParameterBlock->FirmwareParametersOffset = ParameterBlock->BootDeviceOffset + + BootDevice->Size; + + /* Fill it out */ + FirmwareParameters = (PBL_FIRMWARE_DESCRIPTOR)((ULONG_PTR)ParameterBlock + + ParameterBlock-> + FirmwareParametersOffset); + Status = BlFwGetParameters(FirmwareParameters); + if (!NT_SUCCESS(Status)) + { + return Status; + } + + /* Get the offset to the return arguments */ + ParameterBlock->ReturnArgumentsOffset = ParameterBlock->FirmwareParametersOffset + + sizeof(BL_FIRMWARE_DESCRIPTOR); + + /* Fill them out */ + ReturnArguments = (PBL_RETURN_ARGUMENTS)((ULONG_PTR)ParameterBlock + + ParameterBlock-> + ReturnArgumentsOffset); + ReturnArguments->Version = BL_RETURN_ARGUMENTS_VERSION; + ReturnArguments->DataPage = 0; + ReturnArguments->DataSize = 0; + + /* Structure complete */ + ImageParameters->ActualSize = ParameterBlock->ReturnArgumentsOffset + + sizeof(*ReturnArguments); return STATUS_SUCCESS; } Modified: trunk/reactos/boot/environ/lib/mm/descriptor.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/environ/lib/mm/descri…
============================================================================== --- trunk/reactos/boot/environ/lib/mm/descriptor.c [iso-8859-1] (original) +++ trunk/reactos/boot/environ/lib/mm/descriptor.c [iso-8859-1] Sun Feb 5 05:35:44 2017 @@ -290,45 +290,33 @@ /* Iterate through the list */ First = SourceList->First; NextEntry = First->Flink; - if (First->Flink != First) - { - /* As long as we have success */ - while (NT_SUCCESS(Status)) - { - /* Check if there's still space */ - if (Count <= *Used) - { - Status = STATUS_NO_MEMORY; - break; - } - - /* Get the current descriptor */ - Descriptor = CONTAINING_RECORD(NextEntry, - BL_MEMORY_DESCRIPTOR, - ListEntry); - - /* Copy it into one of the descriptors we have */ - RtlCopyMemory(&ListDescriptor[*Used], - Descriptor, - sizeof(*Descriptor)); - - /* Add it to the list we have */ - Status = MmMdAddDescriptorToList(DestinationList, - &ListDescriptor[*Used], - Flags); - ++*Used; - - /* Before moving on, check if we're done */ - Finished = NextEntry->Flink == SourceList->First; - - /* Move to the next entry */ - NextEntry = NextEntry->Flink; - - if (Finished) - { - break; - } - } + while ((NextEntry != First) && (NT_SUCCESS(Status))) + { + /* Make sure there's still space */ + if (Count <= *Used) + { + Status = STATUS_NO_MEMORY; + break; + } + + /* Get the current descriptor */ + Descriptor = CONTAINING_RECORD(NextEntry, + BL_MEMORY_DESCRIPTOR, + ListEntry); + + /* Copy it into one of the descriptors we have */ + RtlCopyMemory(&ListDescriptor[*Used], + Descriptor, + sizeof(*Descriptor)); + + /* Add it to the list we have */ + Status = MmMdAddDescriptorToList(DestinationList, + &ListDescriptor[*Used], + Flags); + ++*Used; + + /* Move to the next entry */ + NextEntry = NextEntry->Flink; } /* Check if the global descriptors were used */ Modified: trunk/reactos/boot/environ/lib/mm/pagealloc.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/environ/lib/mm/pageal…
============================================================================== --- trunk/reactos/boot/environ/lib/mm/pagealloc.c [iso-8859-1] (original) +++ trunk/reactos/boot/environ/lib/mm/pagealloc.c [iso-8859-1] Sun Feb 5 05:35:44 2017 @@ -660,6 +660,9 @@ return STATUS_INVALID_PARAMETER; } + /* Initialize the memory map list */ + InitializeListHead(MemoryMap); + /* Check which types of memory to dump */ DoFirmware = WhichTypes & BL_MM_INCLUDE_FIRMWARE_MEMORY; DoPersistent = WhichTypes & BL_MM_INCLUDE_PERSISTENT_MEMORY;
7 years, 10 months
1
0
0
0
[ion] 73691: [BOOTLIB]: Implement BlMmGetMemoryMap. [BOOTLIB]: Implement MmMdCountList, MmMdInitializeList, MmMdCopyList [BOOTLIB]: Bugfixes.
by ion@svn.reactos.org
Author: ion Date: Sun Feb 5 01:54:52 2017 New Revision: 73691 URL:
http://svn.reactos.org/svn/reactos?rev=73691&view=rev
Log: [BOOTLIB]: Implement BlMmGetMemoryMap. [BOOTLIB]: Implement MmMdCountList, MmMdInitializeList, MmMdCopyList [BOOTLIB]: Bugfixes. Modified: trunk/reactos/boot/environ/include/bl.h trunk/reactos/boot/environ/lib/misc/image.c trunk/reactos/boot/environ/lib/mm/descriptor.c trunk/reactos/boot/environ/lib/mm/pagealloc.c Modified: trunk/reactos/boot/environ/include/bl.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/environ/include/bl.h?…
============================================================================== --- trunk/reactos/boot/environ/include/bl.h [iso-8859-1] (original) +++ trunk/reactos/boot/environ/include/bl.h [iso-8859-1] Sun Feb 5 01:54:52 2017 @@ -91,6 +91,7 @@ #define BL_MM_ADD_DESCRIPTOR_TRUNCATE_FLAG 0x02 #define BL_MM_ADD_DESCRIPTOR_NEVER_COALESCE_FLAG 0x10 #define BL_MM_ADD_DESCRIPTOR_NEVER_TRUNCATE_FLAG 0x20 +#define BL_MM_ADD_DESCRIPTOR_ALLOCATE_FLAG 0x1000 #define BL_MM_ADD_DESCRIPTOR_UPDATE_LIST_POINTER_FLAG 0x2000 #define BL_MM_INCLUDE_MAPPED_ALLOCATED 0x01 @@ -101,7 +102,22 @@ #define BL_MM_INCLUDE_BAD_MEMORY 0x20 #define BL_MM_INCLUDE_FIRMWARE_MEMORY 0x40 #define BL_MM_INCLUDE_TRUNCATED_MEMORY 0x80 -#define BL_MM_INCLUDE_PERSISTEND_MEMORY 0x100 +#define BL_MM_INCLUDE_PERSISTENT_MEMORY 0x100 +#define BL_MM_INCLUDE_FIRMWARE_MEMORY_2 0x200 + +#define BL_MM_INCLUDE_NO_FIRMWARE_MEMORY (BL_MM_INCLUDE_PERSISTENT_MEMORY | \ + BL_MM_INCLUDE_TRUNCATED_MEMORY | \ + BL_MM_INCLUDE_BAD_MEMORY | \ + BL_MM_INCLUDE_RESERVED_ALLOCATED | \ + BL_MM_INCLUDE_UNMAPPED_UNALLOCATED | \ + BL_MM_INCLUDE_UNMAPPED_ALLOCATED | \ + BL_MM_INCLUDE_MAPPED_UNALLOCATED | \ + BL_MM_INCLUDE_MAPPED_ALLOCATED) +C_ASSERT(BL_MM_INCLUDE_NO_FIRMWARE_MEMORY == 0x1BF); + +#define BL_MM_INCLUDE_ONLY_FIRMWARE_MEMORY (BL_MM_INCLUDE_FIRMWARE_MEMORY_2 | \ + BL_MM_INCLUDE_FIRMWARE_MEMORY) +C_ASSERT(BL_MM_INCLUDE_ONLY_FIRMWARE_MEMORY == 0x240); #define BL_MM_REQUEST_DEFAULT_TYPE 1 #define BL_MM_REQUEST_TOP_DOWN_TYPE 2 @@ -1285,6 +1301,7 @@ InitializeListHead(&List->ListHead); List->First = &List->ListHead; List->This = NULL; + List->Type = 0; } /* INITIALIZATION ROUTINES ***************************************************/ @@ -1961,6 +1978,28 @@ ); /* MEMORY DESCRIPTOR ROUTINES ************************************************/ + +VOID +MmMdInitializeList ( + _In_ PBL_MEMORY_DESCRIPTOR_LIST DescriptorList, + _In_ ULONG Type, + _In_ PLIST_ENTRY ListHead + ); + +NTSTATUS +MmMdCopyList ( + _In_ PBL_MEMORY_DESCRIPTOR_LIST DestinationList, + _In_ PBL_MEMORY_DESCRIPTOR_LIST SourceList, + _In_opt_ PBL_MEMORY_DESCRIPTOR ListDescriptor, + _Out_ PULONG ActualCount, + _In_ ULONG Count, + _In_ ULONG Flags + ); + +ULONG +MmMdCountList ( + _In_ PBL_MEMORY_DESCRIPTOR_LIST MdList + ); VOID MmMdFreeList( @@ -2074,6 +2113,14 @@ NTSTATUS BlMmRemoveBadMemory ( VOID + ); + +NTSTATUS +BlMmGetMemoryMap ( + _In_ PLIST_ENTRY MemoryMap, + _In_ PBL_IMAGE_PARAMETERS MemoryParameters, + _In_ ULONG WhichTypes, + _In_ ULONG Flags ); /* VIRTUAL MEMORY ROUTINES ***************************************************/ @@ -2558,7 +2605,18 @@ extern PVOID DspRemoteInputConsole; extern PVOID DspLocalInputConsole; extern WCHAR BlScratchBuffer[8192]; +extern BL_MEMORY_DESCRIPTOR_LIST MmMdlMappedAllocated; +extern BL_MEMORY_DESCRIPTOR_LIST MmMdlMappedUnallocated; +extern BL_MEMORY_DESCRIPTOR_LIST MmMdlFwAllocationTracker; extern BL_MEMORY_DESCRIPTOR_LIST MmMdlUnmappedAllocated; +extern BL_MEMORY_DESCRIPTOR_LIST MmMdlUnmappedUnallocated; +extern BL_MEMORY_DESCRIPTOR_LIST MmMdlReservedAllocated; +extern BL_MEMORY_DESCRIPTOR_LIST MmMdlBadMemory; +extern BL_MEMORY_DESCRIPTOR_LIST MmMdlTruncatedMemory; +extern BL_MEMORY_DESCRIPTOR_LIST MmMdlPersistentMemory; +extern BL_MEMORY_DESCRIPTOR_LIST MmMdlCompleteBadMemory; +extern BL_MEMORY_DESCRIPTOR_LIST MmMdlFreeVirtual; +extern BL_MEMORY_DESCRIPTOR_LIST MmMdlMappingTrackers; extern ULONGLONG BlpTimePerformanceFrequency; extern LIST_ENTRY RegisteredFileSystems; Modified: trunk/reactos/boot/environ/lib/misc/image.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/environ/lib/misc/imag…
============================================================================== --- trunk/reactos/boot/environ/lib/misc/image.c [iso-8859-1] (original) +++ trunk/reactos/boot/environ/lib/misc/image.c [iso-8859-1] Sun Feb 5 01:54:52 2017 @@ -1605,17 +1605,6 @@ } NTSTATUS -BlMmGetMemoryMap ( - _In_ PLIST_ENTRY MemoryMap, - _In_ PBL_IMAGE_PARAMETERS ImageParameters, - _In_ ULONG WhichTypes, - _In_ ULONG Flags - ) -{ - return STATUS_SUCCESS; -} - -NTSTATUS ImgpInitializeBootApplicationParameters ( _In_ PBL_IMAGE_PARAMETERS ImageParameters, _In_ PBL_APPLICATION_ENTRY AppEntry, @@ -1628,17 +1617,18 @@ BL_IMAGE_PARAMETERS MemoryParameters; LIST_ENTRY MemoryList; + /* Get the image headers and validate it */ Status = RtlImageNtHeaderEx(0, ImageBase, ImageSize, &NtHeaders); if (!NT_SUCCESS(Status)) { return Status; } + /* Get the size of the entire non-firmware, allocated, memory map */ MemoryParameters.BufferSize = 0; - Status = BlMmGetMemoryMap(&MemoryList, &MemoryParameters, - BL_MM_INCLUDE_FIRMWARE_MEMORY | + BL_MM_INCLUDE_PERSISTENT_MEMORY | BL_MM_INCLUDE_MAPPED_ALLOCATED | BL_MM_INCLUDE_MAPPED_UNALLOCATED | BL_MM_INCLUDE_UNMAPPED_ALLOCATED | @@ -1649,6 +1639,7 @@ return Status; } + EfiPrintf(L"Memory map needs %lx bytes\n", MemoryParameters.BufferSize); return STATUS_SUCCESS; } Modified: trunk/reactos/boot/environ/lib/mm/descriptor.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/environ/lib/mm/descri…
============================================================================== --- trunk/reactos/boot/environ/lib/mm/descriptor.c [iso-8859-1] (original) +++ trunk/reactos/boot/environ/lib/mm/descriptor.c [iso-8859-1] Sun Feb 5 01:54:52 2017 @@ -15,7 +15,7 @@ BL_MEMORY_DESCRIPTOR MmStaticMemoryDescriptors[512]; ULONG MmGlobalMemoryDescriptorCount; PBL_MEMORY_DESCRIPTOR MmGlobalMemoryDescriptors; -BOOLEAN MmGlobalMemoryDescriptorsUsed; +ULONG MmGlobalMemoryDescriptorsUsed; PBL_MEMORY_DESCRIPTOR MmDynamicMemoryDescriptors; ULONG MmDynamicMemoryDescriptorCount; @@ -197,6 +197,152 @@ } } +ULONG +MmMdCountList ( + _In_ PBL_MEMORY_DESCRIPTOR_LIST MdList + ) +{ + PLIST_ENTRY First, NextEntry; + ULONG Count; + + /* Iterate the list */ + for (Count = 0, First = MdList->First, NextEntry = First->Flink; + NextEntry != First; + NextEntry = NextEntry->Flink, Count++); + + /* Return the count */ + return Count; +} + +VOID +MmMdInitializeList ( + _In_ PBL_MEMORY_DESCRIPTOR_LIST MdList, + _In_ ULONG Type, + _In_ PLIST_ENTRY ListHead + ) +{ + /* Check if a list was specified */ + if (ListHead) + { + /* Use it */ + MdList->First = ListHead; + } + else + { + /* Otherwise, use the internal, built-in list */ + InitializeListHead(&MdList->ListHead); + MdList->First = &MdList->ListHead; + } + + /* Set the type */ + MdList->Type = Type; + + /* Initialize current iterator to nothing */ + MdList->This = NULL; +} + +NTSTATUS +MmMdCopyList ( + _In_ PBL_MEMORY_DESCRIPTOR_LIST DestinationList, + _In_ PBL_MEMORY_DESCRIPTOR_LIST SourceList, + _In_opt_ PBL_MEMORY_DESCRIPTOR ListDescriptor, + _Out_ PULONG ActualCount, + _In_ ULONG Count, + _In_ ULONG Flags + ) +{ + NTSTATUS Status; + PULONG Used; + BOOLEAN Finished; + PLIST_ENTRY First, NextEntry; + PBL_MEMORY_DESCRIPTOR Descriptor; + + /* Both parameters must be present */ + if (!(DestinationList) || !(SourceList)) + { + return STATUS_INVALID_PARAMETER; + } + + /* Assume success */ + Status = STATUS_SUCCESS; + + /* Check if a descriptor is being used to store the list */ + if (ListDescriptor) + { + /* See how big it is */ + Flags |= BL_MM_ADD_DESCRIPTOR_NEVER_COALESCE_FLAG; + Used = ActualCount; + } + else + { + /* We are using our internal descriptors instead */ + Used = &MmGlobalMemoryDescriptorsUsed; + ++MmDescriptorCallTreeCount; + + /* Use as many as are available */ + Count = MmGlobalMemoryDescriptorCount; + ListDescriptor = MmGlobalMemoryDescriptors; + } + + /* Never truncate descriptors during a list copy */ + Flags |= BL_MM_ADD_DESCRIPTOR_NEVER_TRUNCATE_FLAG; + + /* Iterate through the list */ + First = SourceList->First; + NextEntry = First->Flink; + if (First->Flink != First) + { + /* As long as we have success */ + while (NT_SUCCESS(Status)) + { + /* Check if there's still space */ + if (Count <= *Used) + { + Status = STATUS_NO_MEMORY; + break; + } + + /* Get the current descriptor */ + Descriptor = CONTAINING_RECORD(NextEntry, + BL_MEMORY_DESCRIPTOR, + ListEntry); + + /* Copy it into one of the descriptors we have */ + RtlCopyMemory(&ListDescriptor[*Used], + Descriptor, + sizeof(*Descriptor)); + + /* Add it to the list we have */ + Status = MmMdAddDescriptorToList(DestinationList, + &ListDescriptor[*Used], + Flags); + ++*Used; + + /* Before moving on, check if we're done */ + Finished = NextEntry->Flink == SourceList->First; + + /* Move to the next entry */ + NextEntry = NextEntry->Flink; + + if (Finished) + { + break; + } + } + } + + /* Check if the global descriptors were used */ + if (ListDescriptor == MmGlobalMemoryDescriptors) + { + /* Unwind our usage */ + MmMdFreeGlobalDescriptors(); + --MmDescriptorCallTreeCount; + } + + /* Return back to caller */ + return Status; +} + VOID MmMdRemoveDescriptorFromList ( _In_ PBL_MEMORY_DESCRIPTOR_LIST MdList, @@ -206,7 +352,7 @@ /* Remove the entry */ RemoveEntryList(&Entry->ListEntry); - /* Check if this was the current link */ + /* Check if this was the current link */ if (MdList->This == &Entry->ListEntry) { /* Remove the current link and set the next one */ @@ -838,6 +984,6 @@ MmGlobalMemoryDescriptorCount = RTL_NUMBER_OF(MmStaticMemoryDescriptors); MmGlobalMemoryDescriptors = MmStaticMemoryDescriptors; RtlZeroMemory(MmStaticMemoryDescriptors, sizeof(MmStaticMemoryDescriptors)); - MmGlobalMemoryDescriptorsUsed = FALSE; - } -} + MmGlobalMemoryDescriptorsUsed = 0; + } +} Modified: trunk/reactos/boot/environ/lib/mm/pagealloc.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/environ/lib/mm/pageal…
============================================================================== --- trunk/reactos/boot/environ/lib/mm/pagealloc.c [iso-8859-1] (original) +++ trunk/reactos/boot/environ/lib/mm/pagealloc.c [iso-8859-1] Sun Feb 5 01:54:52 2017 @@ -621,3 +621,282 @@ return STATUS_SUCCESS; //return MmPapFreePhysicalPages(4, 0, Address); } + +NTSTATUS +BlMmGetMemoryMap ( + _In_ PLIST_ENTRY MemoryMap, + _In_ PBL_IMAGE_PARAMETERS MemoryParameters, + _In_ ULONG WhichTypes, + _In_ ULONG Flags + ) +{ + BL_MEMORY_DESCRIPTOR_LIST FirmwareMdList, FullMdList; + BOOLEAN DoFirmware, DoPersistent, DoTruncated, DoBad; + BOOLEAN DoReserved, DoUnmapUnalloc, DoUnmapAlloc; + BOOLEAN DoMapAlloc, DoMapUnalloc, DoFirmware2; + ULONG LoopCount, MdListCount, MdListSize, Used; + NTSTATUS Status; + + /* Initialize the firmware list if we use it */ + MmMdInitializeListHead(&FirmwareMdList); + + /* Make sure we got our input parameters */ + if (!(MemoryMap) || !(MemoryParameters)) + { + return STATUS_INVALID_PARAMETER; + } + + /* Either ask for firmware memory, or don't. Not neither */ + if ((WhichTypes & ~BL_MM_INCLUDE_NO_FIRMWARE_MEMORY) && + (WhichTypes & ~BL_MM_INCLUDE_ONLY_FIRMWARE_MEMORY)) + { + return STATUS_INVALID_PARAMETER; + } + + /* Either ask for firmware memory, or don't. Not both */ + if ((WhichTypes & BL_MM_INCLUDE_NO_FIRMWARE_MEMORY) && + (WhichTypes & BL_MM_INCLUDE_ONLY_FIRMWARE_MEMORY)) + { + return STATUS_INVALID_PARAMETER; + } + + /* Check which types of memory to dump */ + DoFirmware = WhichTypes & BL_MM_INCLUDE_FIRMWARE_MEMORY; + DoPersistent = WhichTypes & BL_MM_INCLUDE_PERSISTENT_MEMORY; + DoTruncated = WhichTypes & BL_MM_INCLUDE_TRUNCATED_MEMORY; + DoBad = WhichTypes & BL_MM_INCLUDE_BAD_MEMORY; + DoReserved = WhichTypes & BL_MM_INCLUDE_RESERVED_ALLOCATED; + DoUnmapUnalloc = WhichTypes & BL_MM_INCLUDE_UNMAPPED_UNALLOCATED; + DoUnmapAlloc = WhichTypes & BL_MM_INCLUDE_UNMAPPED_ALLOCATED; + DoMapAlloc = WhichTypes & BL_MM_INCLUDE_MAPPED_ALLOCATED; + DoMapUnalloc = WhichTypes & BL_MM_INCLUDE_MAPPED_UNALLOCATED; + DoFirmware2 = WhichTypes & BL_MM_INCLUDE_FIRMWARE_MEMORY_2; + + /* Begin the attempt loop */ + LoopCount = 0; + while (TRUE) + { + /* Count how many entries we will need */ + MdListCount = 0; + if (DoMapAlloc) MdListCount = MmMdCountList(&MmMdlMappedAllocated); + if (DoMapUnalloc) MdListCount += MmMdCountList(&MmMdlMappedUnallocated); + if (DoUnmapAlloc) MdListCount += MmMdCountList(&MmMdlUnmappedAllocated); + if (DoUnmapUnalloc) MdListCount += MmMdCountList(&MmMdlUnmappedUnallocated); + if (DoReserved) MdListCount += MmMdCountList(&MmMdlReservedAllocated); + if (DoBad) MdListCount += MmMdCountList(&MmMdlBadMemory); + if (DoTruncated) MdListCount += MmMdCountList(&MmMdlTruncatedMemory); + if (DoPersistent) MdListCount += MmMdCountList(&MmMdlPersistentMemory); + + /* Plus firmware entries */ + if (DoFirmware) + { + /* Free the previous entries, if any */ + MmMdFreeList(&FirmwareMdList); + + /* Get the firmware map */ + Status = MmFwGetMemoryMap(&FirmwareMdList, 2); + if (!NT_SUCCESS(Status)) + { + goto Quickie; + } + + /* We overwrite, since this type is exclusive */ + MdListCount = MmMdCountList(&FirmwareMdList); + } + + /* Plus firmware entries-2 */ + if (DoFirmware2) + { + /* Free the previous entries, if any */ + MmMdFreeList(&FirmwareMdList); + + /* Get the firmware map */ + Status = MmFwGetMemoryMap(&FirmwareMdList, 0); + if (!NT_SUCCESS(Status)) + { + goto Quickie; + } + + /* We overwrite, since this type is exclusive */ + MdListCount = MmMdCountList(&FirmwareMdList); + } + + /* If there's no descriptors, we're done */ + if (!MdListCount) + { + Status = STATUS_SUCCESS; + goto Quickie; + } + + /* Check if the buffer we have is big enough */ + if (MemoryParameters->BufferSize >= + (sizeof(BL_MEMORY_DESCRIPTOR) * MdListCount)) + { + break; + } + + /* It's not, allocate it, with a slack of 4 extra descriptors */ + MdListSize = sizeof(BL_MEMORY_DESCRIPTOR) * (MdListCount + 4); + + /* Except if we weren't asked to */ + if (!(Flags & BL_MM_ADD_DESCRIPTOR_ALLOCATE_FLAG)) + { + MemoryParameters->BufferSize = MdListSize; + Status = STATUS_BUFFER_TOO_SMALL; + goto Quickie; + } + + /* Has it been less than 4 times we've tried this? */ + if (++LoopCount <= 4) + { + /* Free the previous attempt, if any */ + if (MemoryParameters->BufferSize) + { + BlMmFreeHeap(MemoryParameters->Buffer); + } + + /* Allocate a new buffer */ + MemoryParameters->BufferSize = MdListSize; + MemoryParameters->Buffer = BlMmAllocateHeap(MdListSize); + if (MemoryParameters->Buffer) + { + /* Try again */ + continue; + } + } + + /* If we got here, we're out of memory after 4 attempts */ + Status = STATUS_NO_MEMORY; + goto Quickie; + } + + /* We should have a buffer by now... */ + if (MemoryParameters->Buffer) + { + /* Zero it out */ + RtlZeroMemory(MemoryParameters->Buffer, + MdListCount * sizeof(BL_MEMORY_DESCRIPTOR)); + } + + /* Initialize our list of descriptors */ + MmMdInitializeList(&FullMdList, 0, MemoryMap); + Used = 0; + + /* Handle mapped, allocated */ + if (DoMapAlloc) + { + Status = MmMdCopyList(&FullMdList, + &MmMdlMappedAllocated, + MemoryParameters->Buffer, + &Used, + MdListCount, + Flags); + } + + /* Handle mapped, unallocated */ + if (DoMapUnalloc) + { + Status = MmMdCopyList(&FullMdList, + &MmMdlMappedUnallocated, + MemoryParameters->Buffer, + &Used, + MdListCount, + Flags); + } + + /* Handle unmapped, allocated */ + if (DoUnmapAlloc) + { + Status = MmMdCopyList(&FullMdList, + &MmMdlUnmappedAllocated, + MemoryParameters->Buffer, + &Used, + MdListCount, + Flags); + } + + /* Handle unmapped, unallocated */ + if (DoUnmapUnalloc) + { + Status = MmMdCopyList(&FullMdList, + &MmMdlUnmappedUnallocated, + MemoryParameters->Buffer, + &Used, + MdListCount, + Flags); + } + + /* Handle reserved, allocated */ + if (DoReserved) + { + Status = MmMdCopyList(&FullMdList, + &MmMdlReservedAllocated, + MemoryParameters->Buffer, + &Used, + MdListCount, + Flags); + } + + /* Handle bad */ + if (DoBad) + { + Status = MmMdCopyList(&FullMdList, + &MmMdlBadMemory, + MemoryParameters->Buffer, + &Used, + MdListCount, + Flags); + } + + /* Handle truncated */ + if (DoTruncated) + { + Status = MmMdCopyList(&FullMdList, + &MmMdlTruncatedMemory, + MemoryParameters->Buffer, + &Used, + MdListCount, + Flags); + } + + /* Handle persistent */ + if (DoPersistent) + { + Status = MmMdCopyList(&FullMdList, + &MmMdlPersistentMemory, + MemoryParameters->Buffer, + &Used, + MdListCount, + Flags); + } + + /* Handle firmware */ + if (DoFirmware) + { + Status = MmMdCopyList(&FullMdList, + &FirmwareMdList, + MemoryParameters->Buffer, + &Used, + MdListCount, + Flags); + } + + /* Handle firmware2 */ + if (DoFirmware2) + { + Status = MmMdCopyList(&FullMdList, + &FirmwareMdList, + MemoryParameters->Buffer, + &Used, + MdListCount, + Flags); + } + + /* Add up the final size */ + Status = RtlULongLongToULong(Used * sizeof(BL_MEMORY_DESCRIPTOR), + &MemoryParameters->ActualSize); + +Quickie: + MmMdFreeList(&FirmwareMdList); + return Status; +}
7 years, 10 months
1
0
0
0
[spetreolle] 73690: fix reactos_support_code MSVC build.
by spetreolle@svn.reactos.org
Author: spetreolle Date: Sun Feb 5 01:03:45 2017 New Revision: 73690 URL:
http://svn.reactos.org/svn/reactos?rev=73690&view=rev
Log: fix reactos_support_code MSVC build. Modified: trunk/reactos/sdk/tools/isohybrid/reactos_support_code.c Modified: trunk/reactos/sdk/tools/isohybrid/reactos_support_code.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/tools/isohybrid/reacto…
============================================================================== --- trunk/reactos/sdk/tools/isohybrid/reactos_support_code.c [iso-8859-1] (original) +++ trunk/reactos/sdk/tools/isohybrid/reactos_support_code.c [iso-8859-1] Sun Feb 5 01:03:45 2017 @@ -3,10 +3,9 @@ void isohybrid_error(int eval, const char* fmt, ...) { - fprintf(stderr, "isohybrid: "); - va_list ap; va_start(ap, fmt); + fprintf(stderr, "isohybrid: "); vfprintf(stderr, fmt, ap); va_end(ap); exit(eval); @@ -15,10 +14,9 @@ void isohybrid_warning(const char *fmt, ...) { - fprintf(stderr, "isohybrid: "); - va_list ap; va_start(ap, fmt); + fprintf(stderr, "isohybrid: "); vfprintf(stderr, fmt, ap); va_end(ap); }
7 years, 10 months
1
0
0
0
[ion] 73689: [BOOTLIB]: Fix from hermes for BlReplaceBootOptions [BOOTLIB]: More WIP transfer code.
by ion@svn.reactos.org
Author: ion Date: Sun Feb 5 00:05:19 2017 New Revision: 73689 URL:
http://svn.reactos.org/svn/reactos?rev=73689&view=rev
Log: [BOOTLIB]: Fix from hermes for BlReplaceBootOptions [BOOTLIB]: More WIP transfer code. Modified: trunk/reactos/boot/environ/include/bl.h trunk/reactos/boot/environ/lib/misc/bcdopt.c trunk/reactos/boot/environ/lib/misc/image.c trunk/reactos/boot/environ/lib/misc/util.c Modified: trunk/reactos/boot/environ/include/bl.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/environ/include/bl.h?…
============================================================================== --- trunk/reactos/boot/environ/include/bl.h [iso-8859-1] (original) +++ trunk/reactos/boot/environ/include/bl.h [iso-8859-1] Sun Feb 5 00:05:19 2017 @@ -92,6 +92,16 @@ #define BL_MM_ADD_DESCRIPTOR_NEVER_COALESCE_FLAG 0x10 #define BL_MM_ADD_DESCRIPTOR_NEVER_TRUNCATE_FLAG 0x20 #define BL_MM_ADD_DESCRIPTOR_UPDATE_LIST_POINTER_FLAG 0x2000 + +#define BL_MM_INCLUDE_MAPPED_ALLOCATED 0x01 +#define BL_MM_INCLUDE_MAPPED_UNALLOCATED 0x02 +#define BL_MM_INCLUDE_UNMAPPED_ALLOCATED 0x04 +#define BL_MM_INCLUDE_UNMAPPED_UNALLOCATED 0x08 +#define BL_MM_INCLUDE_RESERVED_ALLOCATED 0x10 +#define BL_MM_INCLUDE_BAD_MEMORY 0x20 +#define BL_MM_INCLUDE_FIRMWARE_MEMORY 0x40 +#define BL_MM_INCLUDE_TRUNCATED_MEMORY 0x80 +#define BL_MM_INCLUDE_PERSISTEND_MEMORY 0x100 #define BL_MM_REQUEST_DEFAULT_TYPE 1 #define BL_MM_REQUEST_TOP_DOWN_TYPE 2 Modified: trunk/reactos/boot/environ/lib/misc/bcdopt.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/environ/lib/misc/bcdo…
============================================================================== --- trunk/reactos/boot/environ/lib/misc/bcdopt.c [iso-8859-1] (original) +++ trunk/reactos/boot/environ/lib/misc/bcdopt.c [iso-8859-1] Sun Feb 5 00:05:19 2017 @@ -821,14 +821,15 @@ NTSTATUS BlReplaceBootOptions ( _In_ PBL_LOADED_APPLICATION_ENTRY AppEntry, - _In_ PBL_BCD_OPTION NewOptions - ) -{ - NTSTATUS Status; - ULONG Size; + _In_ PBL_BCD_OPTION OldOptions + ) +{ + NTSTATUS Status; + ULONG OptionSize; + PBL_BCD_OPTION NewOptions; /* Make sure there's something to replace with */ - if (!NewOptions) + if (!OldOptions) { return STATUS_INVALID_PARAMETER; } @@ -849,17 +850,17 @@ AppEntry->BcdData = NULL; /* Get the size of the new list of options */ - Size = BlGetBootOptionListSize(NewOptions); + OptionSize = BlGetBootOptionListSize(OldOptions); /* Allocate a copy of the new list */ - NewOptions = BlMmAllocateHeap(Size); + NewOptions = BlMmAllocateHeap(OptionSize); if (!NewOptions) { return STATUS_NO_MEMORY; } /* Copy it in */ - RtlCopyMemory(NewOptions, NewOptions, Size); + RtlCopyMemory(NewOptions, OldOptions, OptionSize); /* Set it as the new set of options and return */ AppEntry->Flags |= BL_APPLICATION_ENTRY_BCD_OPTIONS_INTERNAL; Modified: trunk/reactos/boot/environ/lib/misc/image.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/environ/lib/misc/imag…
============================================================================== --- trunk/reactos/boot/environ/lib/misc/image.c [iso-8859-1] (original) +++ trunk/reactos/boot/environ/lib/misc/image.c [iso-8859-1] Sun Feb 5 00:05:19 2017 @@ -1605,6 +1605,17 @@ } NTSTATUS +BlMmGetMemoryMap ( + _In_ PLIST_ENTRY MemoryMap, + _In_ PBL_IMAGE_PARAMETERS ImageParameters, + _In_ ULONG WhichTypes, + _In_ ULONG Flags + ) +{ + return STATUS_SUCCESS; +} + +NTSTATUS ImgpInitializeBootApplicationParameters ( _In_ PBL_IMAGE_PARAMETERS ImageParameters, _In_ PBL_APPLICATION_ENTRY AppEntry, @@ -1612,6 +1623,32 @@ _In_ ULONG ImageSize ) { + NTSTATUS Status; + PIMAGE_NT_HEADERS NtHeaders; + BL_IMAGE_PARAMETERS MemoryParameters; + LIST_ENTRY MemoryList; + + Status = RtlImageNtHeaderEx(0, ImageBase, ImageSize, &NtHeaders); + if (!NT_SUCCESS(Status)) + { + return Status; + } + + MemoryParameters.BufferSize = 0; + + Status = BlMmGetMemoryMap(&MemoryList, + &MemoryParameters, + BL_MM_INCLUDE_FIRMWARE_MEMORY | + BL_MM_INCLUDE_MAPPED_ALLOCATED | + BL_MM_INCLUDE_MAPPED_UNALLOCATED | + BL_MM_INCLUDE_UNMAPPED_ALLOCATED | + BL_MM_INCLUDE_RESERVED_ALLOCATED, + 0); + if ((Status != STATUS_BUFFER_TOO_SMALL) && (Status != STATUS_SUCCESS)) + { + return Status; + } + return STATUS_SUCCESS; } @@ -1649,28 +1686,34 @@ goto Quickie; } + /* Zero the boot data */ RtlZeroMemory(BootData, BootSizeNeeded); + /* Set the new stack, GDT and IDT */ NewStack = (PVOID)((ULONG_PTR)BootData + (24 * PAGE_SIZE) - 8); NewGdt = (PVOID)((ULONG_PTR)BootData + (24 * PAGE_SIZE)); NewIdt = (PVOID)((ULONG_PTR)BootData + (24 * PAGE_SIZE) + Gdt.Limit + 1); + /* Copy the current (firmware) GDT and IDT */ RtlCopyMemory(NewGdt, (PVOID)Gdt.Base, Gdt.Limit + 1); RtlCopyMemory(NewIdt, (PVOID)Idt.Base, Idt.Limit + 1); + /* Read the NT headers so that we can get the entrypoint later on */ RtlImageNtHeaderEx(0, ImageBase, ImageSize, &NtHeaders); + /* Prepare the application parameters */ RtlZeroMemory(&Parameters, sizeof(Parameters)); - Status = ImgpInitializeBootApplicationParameters(&Parameters, AppEntry, ImageBase, ImageSize); if (NT_SUCCESS(Status)) { + /* Set the firmware GDT/IDT as the one the application will use */ BootAppGdtRegister = Gdt; BootAppIdtRegister = Idt; + /* Set the entrypoint, parameters, and stack */ BootApp32EntryRoutine = (PVOID)((ULONG_PTR)ImageBase + NtHeaders->OptionalHeader. AddressOfEntryPoint); @@ -1678,11 +1721,11 @@ BootApp32Stack = NewStack; #if BL_KD_SUPPORT + /* Disable the kernel debugger */ BlBdStop(); #endif /* Not yet implemented. This is the last step! */ EfiPrintf(L"EFI APPLICATION START!!!\r\n"); - EfiStall(100000000); /* Make it so */ Archx86TransferTo32BitApplicationAsm(); @@ -1690,17 +1733,22 @@ /* Not yet implemented. This is the last step! */ EfiPrintf(L"EFI APPLICATION RETURNED!!!\r\n"); EfiStall(100000000); + #if BL_KD_SUPPORT + /* Re-enable the kernel debugger */ BlBdStart(); #endif } Quickie: + /* Check if we had boot data allocated */ if (BootData) { + /* Free it */ //MmPapFreePages(bootData, TRUE); } + /* All done */ return STATUS_NOT_IMPLEMENTED; } Modified: trunk/reactos/boot/environ/lib/misc/util.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/environ/lib/misc/util…
============================================================================== --- trunk/reactos/boot/environ/lib/misc/util.c [iso-8859-1] (original) +++ trunk/reactos/boot/environ/lib/misc/util.c [iso-8859-1] Sun Feb 5 00:05:19 2017 @@ -27,8 +27,6 @@ ULONG UtlNextUpdatePercentage; BOOLEAN UtlProgressNeedsInfoUpdate; PVOID UtlProgressInfo; - - /* FUNCTIONS *****************************************************************/
7 years, 10 months
1
0
0
0
[tfaber] 73688: [BOOTLIB][CRT] - Fix GCC build
by tfaber@svn.reactos.org
Author: tfaber Date: Sat Feb 4 23:50:32 2017 New Revision: 73688 URL:
http://svn.reactos.org/svn/reactos?rev=73688&view=rev
Log: [BOOTLIB][CRT] - Fix GCC build Modified: trunk/reactos/boot/environ/lib/arch/i386/transfer.s trunk/reactos/sdk/include/crt/mingw32/intrin_x86.h trunk/reactos/sdk/include/crt/msc/intrin.h Modified: trunk/reactos/boot/environ/lib/arch/i386/transfer.s URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/environ/lib/arch/i386…
============================================================================== --- trunk/reactos/boot/environ/lib/arch/i386/transfer.s [iso-8859-1] (original) +++ trunk/reactos/boot/environ/lib/arch/i386/transfer.s [iso-8859-1] Sat Feb 4 23:50:32 2017 @@ -11,10 +11,10 @@ #include <asm.inc> #include <ks386.inc> -EXTERN _GdtRegister:DWORD -EXTERN _IdtRegister:DWORD -EXTERN _BootAppGdtRegister:DWORD -EXTERN _BootAppIdtRegister:DWORD +EXTERN _GdtRegister:FWORD +EXTERN _IdtRegister:FWORD +EXTERN _BootAppGdtRegister:FWORD +EXTERN _BootAppIdtRegister:FWORD EXTERN _BootApp32Stack:DWORD EXTERN _BootApp32EntryRoutine:DWORD EXTERN _BootApp32Parameters:DWORD @@ -39,10 +39,10 @@ mov ebx, esp /* Save current GDT/IDT, then load new one */ - sgdt fword ptr _GdtRegister - sidt fword ptr _IdtRegister - lgdt fword ptr _BootAppGdtRegister - lidt fword ptr _BootAppIdtRegister + sgdt _GdtRegister + sidt _IdtRegister + lgdt _BootAppGdtRegister + lidt _BootAppIdtRegister /* Load the new stack */ xor ebp, ebp @@ -62,8 +62,8 @@ mov esp, ebx /* Restore old GDT/IDT */ - lgdt fword ptr _GdtRegister - lidt fword ptr _IdtRegister + lgdt _GdtRegister + lidt _IdtRegister /* Retore old segments */ pop ds @@ -76,6 +76,6 @@ pop ebp /* All done */ - retn + ret END Modified: trunk/reactos/sdk/include/crt/mingw32/intrin_x86.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/include/crt/mingw32/in…
============================================================================== --- trunk/reactos/sdk/include/crt/mingw32/intrin_x86.h [iso-8859-1] (original) +++ trunk/reactos/sdk/include/crt/mingw32/intrin_x86.h [iso-8859-1] Sat Feb 4 23:50:32 2017 @@ -1815,6 +1815,11 @@ __asm__ __volatile__("sidt %0" : : "m"(*(short*)Destination) : "memory"); } +__INTRIN_INLINE void _sgdt(void *Destination) +{ + __asm__ __volatile__("sgdt %0" : : "m"(*(short*)Destination) : "memory"); +} + /*** Misc operations ***/ __INTRIN_INLINE void _mm_pause(void) Modified: trunk/reactos/sdk/include/crt/msc/intrin.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/include/crt/msc/intrin…
============================================================================== --- trunk/reactos/sdk/include/crt/msc/intrin.h [iso-8859-1] (original) +++ trunk/reactos/sdk/include/crt/msc/intrin.h [iso-8859-1] Sat Feb 4 23:50:32 2017 @@ -342,6 +342,19 @@ #pragma intrinsic(__wbinvd) #pragma intrinsic(__lidt) #pragma intrinsic(__sidt) +#if (_MSC_VER >= 1800) +#pragma intrinsic(_sgdt) +#else +__forceinline +void _sgdt(void *Destination) +{ + __asm + { + mov eax, Destination + sgdt [eax] + } +} +#endif #pragma intrinsic(_mm_pause) #endif #if defined(_M_ARM)
7 years, 10 months
1
0
0
0
[ion] 73687: [BOOTLIB]: Begin adding support for transferring to newly loaded i386 image.
by ion@svn.reactos.org
Author: ion Date: Sat Feb 4 21:59:52 2017 New Revision: 73687 URL:
http://svn.reactos.org/svn/reactos?rev=73687&view=rev
Log: [BOOTLIB]: Begin adding support for transferring to newly loaded i386 image. Added: trunk/reactos/boot/environ/lib/arch/i386/transfer.s (with props) Modified: trunk/reactos/boot/environ/CMakeLists.txt trunk/reactos/boot/environ/include/bl.h trunk/reactos/boot/environ/lib/misc/image.c Modified: trunk/reactos/boot/environ/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/environ/CMakeLists.tx…
============================================================================== --- trunk/reactos/boot/environ/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/boot/environ/CMakeLists.txt [iso-8859-1] Sat Feb 4 21:59:52 2017 @@ -45,7 +45,7 @@ if(ARCH STREQUAL "i386") list(APPEND BOOTLIB_ASM_SOURCE - #lib/arch/i386/foo.asm + lib/arch/i386/transfer.s ) list(APPEND BOOTLIB_SOURCE lib/arch/i386/arch.c Modified: trunk/reactos/boot/environ/include/bl.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/environ/include/bl.h?…
============================================================================== --- trunk/reactos/boot/environ/include/bl.h [iso-8859-1] (original) +++ trunk/reactos/boot/environ/include/bl.h [iso-8859-1] Sat Feb 4 21:59:52 2017 @@ -283,6 +283,7 @@ BlLoaderPageDirectory = 0xD0000006, BlLoaderReferencePage = 0xD0000007, BlLoaderRamDisk = 0xD0000008, + BlLoaderArchData = 0xD0000009, BlLoaderData = 0xD000000A, BlLoaderRegistry = 0xD000000B, BlLoaderBlockMemory = 0xD000000C, @@ -1180,6 +1181,13 @@ ULONG ImageSize; } BL_IMAGE_APPLICATION_ENTRY, *PBL_IMAGE_APPLICATION_ENTRY; +typedef struct _BL_IMAGE_PARAMETERS +{ + PVOID Buffer; + ULONG ActualSize; + ULONG BufferSize; +} BL_IMAGE_PARAMETERS, *PBL_IMAGE_PARAMETERS; + typedef struct _BL_DEFERRED_FONT_FILE { LIST_ENTRY ListEntry; @@ -1935,6 +1943,11 @@ VOID BlpArchSwitchContext ( _In_ BL_ARCH_MODE NewMode + ); + +VOID +Archx86TransferTo32BitApplicationAsm ( + VOID ); /* MEMORY DESCRIPTOR ROUTINES ************************************************/ Added: trunk/reactos/boot/environ/lib/arch/i386/transfer.s URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/environ/lib/arch/i386…
============================================================================== --- trunk/reactos/boot/environ/lib/arch/i386/transfer.s (added) +++ trunk/reactos/boot/environ/lib/arch/i386/transfer.s [iso-8859-1] Sat Feb 4 21:59:52 2017 @@ -0,0 +1,81 @@ +/* + * COPYRIGHT: See COPYING.ARM in the top level directory + * PROJECT: ReactOS UEFI Boot Library + * FILE: boot/environ/lib/arch/transfer.asm + * PURPOSE: Boot Library i386 Transfer Functions + * PROGRAMMER: Alex Ionescu (alex.ionescu(a)reactos.org) + */ + +/* INCLUDES ******************************************************************/ + +#include <asm.inc> +#include <ks386.inc> + +EXTERN _GdtRegister:DWORD +EXTERN _IdtRegister:DWORD +EXTERN _BootAppGdtRegister:DWORD +EXTERN _BootAppIdtRegister:DWORD +EXTERN _BootApp32Stack:DWORD +EXTERN _BootApp32EntryRoutine:DWORD +EXTERN _BootApp32Parameters:DWORD + +/* FUNCTIONS ****************************************************************/ +.code + +PUBLIC _Archx86TransferTo32BitApplicationAsm +_Archx86TransferTo32BitApplicationAsm: + + /* Save non-volatile registers */ + push ebp + push esi + push edi + push ebx + + /* Save data segments */ + push es + push ds + + /* Save the old stack */ + mov ebx, esp + + /* Save current GDT/IDT, then load new one */ + sgdt fword ptr _GdtRegister + sidt fword ptr _IdtRegister + lgdt fword ptr _BootAppGdtRegister + lidt fword ptr _BootAppIdtRegister + + /* Load the new stack */ + xor ebp, ebp + mov esp, _BootApp32Stack + + /* Push old stack onto new stack */ + push ebx + + /* Call the entry routine, passing the parameters */ + mov eax, _BootApp32Parameters + push eax + mov eax, _BootApp32EntryRoutine + call eax + + /* Retore old stack */ + pop ebx + mov esp, ebx + + /* Restore old GDT/IDT */ + lgdt fword ptr _GdtRegister + lidt fword ptr _IdtRegister + + /* Retore old segments */ + pop ds + pop es + + /* Retore non-volatiles */ + pop ebx + pop edi + pop esi + pop ebp + + /* All done */ + retn + +END Propchange: trunk/reactos/boot/environ/lib/arch/i386/transfer.s ------------------------------------------------------------------------------ svn:eol-style = native Modified: trunk/reactos/boot/environ/lib/misc/image.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/environ/lib/misc/imag…
============================================================================== --- trunk/reactos/boot/environ/lib/misc/image.c [iso-8859-1] (original) +++ trunk/reactos/boot/environ/lib/misc/image.c [iso-8859-1] Sat Feb 4 21:59:52 2017 @@ -16,6 +16,14 @@ ULONG IapAllocatedTableEntries; ULONG IapTableEntries; PVOID* IapImageTable; + +KDESCRIPTOR GdtRegister; +KDESCRIPTOR IdtRegister; +KDESCRIPTOR BootAppGdtRegister; +KDESCRIPTOR BootAppIdtRegister; +PVOID BootApp32EntryRoutine; +PVOID BootApp32Parameters; +PVOID BootApp32Stack; /* FUNCTIONS *****************************************************************/ @@ -1597,6 +1605,17 @@ } NTSTATUS +ImgpInitializeBootApplicationParameters ( + _In_ PBL_IMAGE_PARAMETERS ImageParameters, + _In_ PBL_APPLICATION_ENTRY AppEntry, + _In_ PVOID ImageBase, + _In_ ULONG ImageSize + ) +{ + return STATUS_SUCCESS; +} + +NTSTATUS ImgArchEfiStartBootApplication ( _In_ PBL_APPLICATION_ENTRY AppEntry, _In_ PVOID ImageBase, @@ -1604,9 +1623,84 @@ _In_ PBL_RETURN_ARGUMENTS ReturnArguments ) { - /* Not yet implemented. This is the last step! */ - EfiPrintf(L"EFI APPLICATION START!!!\r\n"); - EfiStall(100000000); + KDESCRIPTOR Gdt, Idt; + ULONG BootSizeNeeded; + NTSTATUS Status; + PVOID BootData; + PIMAGE_NT_HEADERS NtHeaders; + PVOID NewStack, NewGdt, NewIdt; + BL_IMAGE_PARAMETERS Parameters; + + /* Read the current IDT and GDT */ + _sgdt(&Gdt.Limit); + __sidt(&Idt.Limit); + + /* Allocate space for the IDT, GDT, and 24 pages of stack */ + BootSizeNeeded = (ULONG)PAGE_ALIGN(Idt.Limit + Gdt.Limit + 1 + 25 * PAGE_SIZE); + Status = MmPapAllocatePagesInRange(&BootData, + BlLoaderArchData, + BootSizeNeeded >> PAGE_SHIFT, + 0, + 0, + NULL, + 0); + if (!NT_SUCCESS(Status)) + { + goto Quickie; + } + + RtlZeroMemory(BootData, BootSizeNeeded); + + NewStack = (PVOID)((ULONG_PTR)BootData + (24 * PAGE_SIZE) - 8); + NewGdt = (PVOID)((ULONG_PTR)BootData + (24 * PAGE_SIZE)); + NewIdt = (PVOID)((ULONG_PTR)BootData + (24 * PAGE_SIZE) + Gdt.Limit + 1); + + RtlCopyMemory(NewGdt, (PVOID)Gdt.Base, Gdt.Limit + 1); + RtlCopyMemory(NewIdt, (PVOID)Idt.Base, Idt.Limit + 1); + + RtlImageNtHeaderEx(0, ImageBase, ImageSize, &NtHeaders); + + RtlZeroMemory(&Parameters, sizeof(Parameters)); + + Status = ImgpInitializeBootApplicationParameters(&Parameters, + AppEntry, + ImageBase, + ImageSize); + if (NT_SUCCESS(Status)) + { + BootAppGdtRegister = Gdt; + BootAppIdtRegister = Idt; + + BootApp32EntryRoutine = (PVOID)((ULONG_PTR)ImageBase + + NtHeaders->OptionalHeader. + AddressOfEntryPoint); + BootApp32Parameters = Parameters.Buffer; + BootApp32Stack = NewStack; + +#if BL_KD_SUPPORT + BlBdStop(); +#endif + /* Not yet implemented. This is the last step! */ + EfiPrintf(L"EFI APPLICATION START!!!\r\n"); + EfiStall(100000000); + + /* Make it so */ + Archx86TransferTo32BitApplicationAsm(); + + /* Not yet implemented. This is the last step! */ + EfiPrintf(L"EFI APPLICATION RETURNED!!!\r\n"); + EfiStall(100000000); +#if BL_KD_SUPPORT + BlBdStart(); +#endif + } + +Quickie: + if (BootData) + { + //MmPapFreePages(bootData, TRUE); + } + return STATUS_NOT_IMPLEMENTED; }
7 years, 10 months
1
0
0
0
← Newer
1
...
29
30
31
32
33
34
35
36
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
Results per page:
10
25
50
100
200