mirror of
https://github.com/reactos/reactos.git
synced 2024-06-27 16:31:30 +00:00
[FREELDR]
- move wlmemory.c into arch specific folder - add elmemory.c and ntsetup.c for amd64 (stubbed) svn path=/branches/ros-amd64-bringup/; revision=43566
This commit is contained in:
parent
3405cb4728
commit
5fb8f749c4
|
@ -105,6 +105,13 @@
|
||||||
<if property="ARCH" value="i386">
|
<if property="ARCH" value="i386">
|
||||||
<directory name="i386">
|
<directory name="i386">
|
||||||
<file>ntsetup.c</file>
|
<file>ntsetup.c</file>
|
||||||
|
<file>wlmemory.c</file>
|
||||||
|
</directory>
|
||||||
|
</if>
|
||||||
|
<if property="ARCH" value="amd64">
|
||||||
|
<directory name="amd64">
|
||||||
|
<file>ntsetup.c</file>
|
||||||
|
<file>wlmemory.c</file>
|
||||||
</directory>
|
</directory>
|
||||||
</if>
|
</if>
|
||||||
</directory>
|
</directory>
|
||||||
|
|
|
@ -73,7 +73,14 @@
|
||||||
<file>conversion.c</file>
|
<file>conversion.c</file>
|
||||||
<file>peloader.c</file>
|
<file>peloader.c</file>
|
||||||
<file>winldr.c</file>
|
<file>winldr.c</file>
|
||||||
<file>wlmemory.c</file>
|
<file>wlregistry.c</file>
|
||||||
|
</directory>
|
||||||
|
</if>
|
||||||
|
<if property="ARCH" value="amd64">
|
||||||
|
<directory name="windows">
|
||||||
|
<file>conversion.c</file>
|
||||||
|
<file>peloader.c</file>
|
||||||
|
<file>winldr.c</file>
|
||||||
<file>wlregistry.c</file>
|
<file>wlregistry.c</file>
|
||||||
</directory>
|
</directory>
|
||||||
</if>
|
</if>
|
||||||
|
|
44
reactos/boot/freeldr/freeldr/windows/amd64/ntsetup.c
Normal file
44
reactos/boot/freeldr/freeldr/windows/amd64/ntsetup.c
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
/*
|
||||||
|
* PROJECT: EFI Windows Loader
|
||||||
|
* LICENSE: GPL - See COPYING in the top level directory
|
||||||
|
* FILE: freeldr/windows/i386/ntsetup.c
|
||||||
|
* PURPOSE: i386-specific setup for Windows boot
|
||||||
|
* PROGRAMMERS: Aleksey Bragin (aleksey@reactos.org)
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* INCLUDES ***************************************************************/
|
||||||
|
|
||||||
|
#include <freeldr.h>
|
||||||
|
#include <debug.h>
|
||||||
|
|
||||||
|
// this is needed for new IDT filling
|
||||||
|
#if 0
|
||||||
|
extern ULONG_PTR i386DivideByZero;
|
||||||
|
extern ULONG_PTR i386DebugException;
|
||||||
|
extern ULONG_PTR i386NMIException;
|
||||||
|
extern ULONG_PTR i386Breakpoint;
|
||||||
|
extern ULONG_PTR i386Overflow;
|
||||||
|
extern ULONG_PTR i386BoundException;
|
||||||
|
extern ULONG_PTR i386InvalidOpcode;
|
||||||
|
extern ULONG_PTR i386FPUNotAvailable;
|
||||||
|
extern ULONG_PTR i386DoubleFault;
|
||||||
|
extern ULONG_PTR i386CoprocessorSegment;
|
||||||
|
extern ULONG_PTR i386InvalidTSS;
|
||||||
|
extern ULONG_PTR i386SegmentNotPresent;
|
||||||
|
extern ULONG_PTR i386StackException;
|
||||||
|
extern ULONG_PTR i386GeneralProtectionFault;
|
||||||
|
extern ULONG_PTR i386PageFault; // exc 14
|
||||||
|
extern ULONG_PTR i386CoprocessorError; // exc 16
|
||||||
|
extern ULONG_PTR i386AlignmentCheck; // exc 17
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* FUNCTIONS **************************************************************/
|
||||||
|
|
||||||
|
// Last step before going virtual
|
||||||
|
void WinLdrSetupForNt(PLOADER_PARAMETER_BLOCK LoaderBlock,
|
||||||
|
PVOID *GdtIdt,
|
||||||
|
ULONG *PcrBasePage,
|
||||||
|
ULONG *TssBasePage)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
169
reactos/boot/freeldr/freeldr/windows/amd64/wlmemory.c
Normal file
169
reactos/boot/freeldr/freeldr/windows/amd64/wlmemory.c
Normal file
|
@ -0,0 +1,169 @@
|
||||||
|
/*
|
||||||
|
* PROJECT: EFI Windows Loader
|
||||||
|
* LICENSE: GPL - See COPYING in the top level directory
|
||||||
|
* FILE: freeldr/winldr/wlmemory.c
|
||||||
|
* PURPOSE: Memory related routines
|
||||||
|
* PROGRAMMERS: Aleksey Bragin (aleksey@reactos.org)
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* INCLUDES ***************************************************************/
|
||||||
|
|
||||||
|
#include <freeldr.h>
|
||||||
|
|
||||||
|
#include <ndk/asm.h>
|
||||||
|
#include <debug.h>
|
||||||
|
|
||||||
|
extern ULONG TotalNLSSize;
|
||||||
|
extern ULONG LoaderPagesSpanned;
|
||||||
|
|
||||||
|
// This is needed because headers define wrong one for ReactOS
|
||||||
|
#undef KIP0PCRADDRESS
|
||||||
|
#define KIP0PCRADDRESS 0xffdff000
|
||||||
|
|
||||||
|
#define HYPER_SPACE_ENTRY 0x300
|
||||||
|
|
||||||
|
PCHAR MemTypeDesc[] = {
|
||||||
|
"ExceptionBlock ", // ?
|
||||||
|
"SystemBlock ", // ?
|
||||||
|
"Free ",
|
||||||
|
"Bad ", // used
|
||||||
|
"LoadedProgram ", // == Free
|
||||||
|
"FirmwareTemporary ", // == Free
|
||||||
|
"FirmwarePermanent ", // == Bad
|
||||||
|
"OsloaderHeap ", // used
|
||||||
|
"OsloaderStack ", // == Free
|
||||||
|
"SystemCode ",
|
||||||
|
"HalCode ",
|
||||||
|
"BootDriver ", // not used
|
||||||
|
"ConsoleInDriver ", // ?
|
||||||
|
"ConsoleOutDriver ", // ?
|
||||||
|
"StartupDpcStack ", // ?
|
||||||
|
"StartupKernelStack", // ?
|
||||||
|
"StartupPanicStack ", // ?
|
||||||
|
"StartupPcrPage ", // ?
|
||||||
|
"StartupPdrPage ", // ?
|
||||||
|
"RegistryData ", // used
|
||||||
|
"MemoryData ", // not used
|
||||||
|
"NlsData ", // used
|
||||||
|
"SpecialMemory ", // == Bad
|
||||||
|
"BBTMemory " // == Bad
|
||||||
|
};
|
||||||
|
|
||||||
|
VOID
|
||||||
|
WinLdrpDumpMemoryDescriptors(PLOADER_PARAMETER_BLOCK LoaderBlock);
|
||||||
|
|
||||||
|
|
||||||
|
VOID
|
||||||
|
MempAddMemoryBlock(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
|
||||||
|
ULONG BasePage,
|
||||||
|
ULONG PageCount,
|
||||||
|
ULONG Type);
|
||||||
|
VOID
|
||||||
|
WinLdrInsertDescriptor(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
|
||||||
|
IN PMEMORY_ALLOCATION_DESCRIPTOR NewDescriptor);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
WinLdrRemoveDescriptor(IN PMEMORY_ALLOCATION_DESCRIPTOR Descriptor);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
WinLdrSetProcessorContext(PVOID GdtIdt, IN ULONG Pcr, IN ULONG Tss);
|
||||||
|
|
||||||
|
// This is needed only for SetProcessorContext routine
|
||||||
|
#pragma pack(2)
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
USHORT Limit;
|
||||||
|
ULONG Base;
|
||||||
|
} GDTIDT;
|
||||||
|
#pragma pack(4)
|
||||||
|
|
||||||
|
/* GLOBALS ***************************************************************/
|
||||||
|
|
||||||
|
PHARDWARE_PTE PDE;
|
||||||
|
PHARDWARE_PTE HalPageTable;
|
||||||
|
|
||||||
|
PUCHAR PhysicalPageTablesBuffer;
|
||||||
|
PUCHAR KernelPageTablesBuffer;
|
||||||
|
ULONG PhysicalPageTables;
|
||||||
|
ULONG KernelPageTables;
|
||||||
|
|
||||||
|
MEMORY_ALLOCATION_DESCRIPTOR *Mad;
|
||||||
|
ULONG MadCount = 0;
|
||||||
|
|
||||||
|
|
||||||
|
/* FUNCTIONS **************************************************************/
|
||||||
|
|
||||||
|
BOOLEAN
|
||||||
|
MempAllocatePageTables()
|
||||||
|
{
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
MempAllocatePTE(ULONG Entry, PHARDWARE_PTE *PhysicalPT, PHARDWARE_PTE *KernelPT)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOLEAN
|
||||||
|
MempSetupPaging(IN ULONG StartPage,
|
||||||
|
IN ULONG NumberOfPages)
|
||||||
|
{
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
MempDisablePages()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
MempAddMemoryBlock(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
|
||||||
|
ULONG BasePage,
|
||||||
|
ULONG PageCount,
|
||||||
|
ULONG Type)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef _M_IX86
|
||||||
|
VOID
|
||||||
|
WinLdrpMapApic()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
VOID
|
||||||
|
WinLdrpMapApic()
|
||||||
|
{
|
||||||
|
/* Implement it for another arch */
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
BOOLEAN
|
||||||
|
WinLdrTurnOnPaging(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
|
||||||
|
ULONG PcrBasePage,
|
||||||
|
ULONG TssBasePage,
|
||||||
|
PVOID GdtIdt)
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Two special things this func does: it sorts descriptors,
|
||||||
|
// and it merges free ones
|
||||||
|
VOID
|
||||||
|
WinLdrInsertDescriptor(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
|
||||||
|
IN PMEMORY_ALLOCATION_DESCRIPTOR NewDescriptor)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
WinLdrSetProcessorContext(PVOID GdtIdt, IN ULONG Pcr, IN ULONG Tss)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue