2009-10-12 03:35:35 +00:00
|
|
|
/*
|
|
|
|
* PROJECT: ReactOS Kernel
|
|
|
|
* LICENSE: GPL - See COPYING in the top level directory
|
|
|
|
* FILE: ntoskrnl/ex/xipdisp.c
|
|
|
|
* PURPOSE: eXecute In Place (XIP) Support.
|
|
|
|
* PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org)
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* INCLUDES ******************************************************************/
|
|
|
|
|
|
|
|
#include <ntoskrnl.h>
|
|
|
|
#include <debug.h>
|
|
|
|
|
|
|
|
/* GLOBALS *******************************************************************/
|
|
|
|
|
|
|
|
/* FUNCTIONS *****************************************************************/
|
|
|
|
|
2015-09-08 20:14:39 +00:00
|
|
|
NTSTATUS
|
|
|
|
NTAPI
|
|
|
|
XIPDispatch(IN ULONG DispatchCode,
|
|
|
|
OUT PVOID Buffer,
|
|
|
|
IN ULONG BufferSize)
|
|
|
|
{
|
|
|
|
UNIMPLEMENTED;
|
|
|
|
return STATUS_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
2018-12-30 11:19:11 +00:00
|
|
|
INIT_FUNCTION
|
2009-10-12 03:35:35 +00:00
|
|
|
PMEMORY_ALLOCATION_DESCRIPTOR
|
|
|
|
NTAPI
|
|
|
|
XIPpFindMemoryDescriptor(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
|
|
|
|
{
|
|
|
|
PLIST_ENTRY NextEntry;
|
|
|
|
PMEMORY_ALLOCATION_DESCRIPTOR Descriptor = NULL;
|
|
|
|
|
|
|
|
/* Loop the memory descriptors */
|
|
|
|
for (NextEntry = LoaderBlock->MemoryDescriptorListHead.Flink;
|
|
|
|
NextEntry != &LoaderBlock->MemoryDescriptorListHead;
|
|
|
|
NextEntry = NextEntry->Flink)
|
|
|
|
{
|
|
|
|
/* Get the current descriptor and check if it's the XIP ROM */
|
|
|
|
Descriptor = CONTAINING_RECORD(NextEntry,
|
|
|
|
MEMORY_ALLOCATION_DESCRIPTOR,
|
|
|
|
ListEntry);
|
|
|
|
if (Descriptor->MemoryType == LoaderXIPRom) return Descriptor;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Nothing found if we got here */
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2018-12-30 11:19:11 +00:00
|
|
|
INIT_FUNCTION
|
2009-10-12 03:35:35 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
XIPInit(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
|
|
|
|
{
|
|
|
|
PCHAR CommandLine, XipBoot, XipRom, XipMegs, XipVerbose, XipRam;
|
|
|
|
PMEMORY_ALLOCATION_DESCRIPTOR XipDescriptor;
|
|
|
|
|
|
|
|
/* Get the command line */
|
|
|
|
CommandLine = LoaderBlock->LoadOptions;
|
|
|
|
if (!CommandLine) return;
|
|
|
|
|
|
|
|
/* Get XIP settings */
|
|
|
|
XipBoot = strstr(CommandLine, "XIPBOOT");
|
|
|
|
XipRam = strstr(CommandLine, "XIPRAM=");
|
|
|
|
XipRom = strstr(CommandLine, "XIPROM=");
|
|
|
|
XipMegs = strstr(CommandLine, "XIPMEGS=");
|
|
|
|
XipVerbose = strstr(CommandLine, "XIPVERBOSE");
|
|
|
|
|
|
|
|
/* Check if this is a verbose boot */
|
|
|
|
if (XipVerbose)
|
|
|
|
{
|
|
|
|
/* Print out our header */
|
|
|
|
DbgPrint("\n\nXIP: debug timestamp at line %d in %s: <<<%s %s>>>\n\n",
|
|
|
|
__LINE__,
|
|
|
|
__FILE__,
|
|
|
|
__DATE__,
|
|
|
|
__TIME__);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Find the XIP memory descriptor */
|
|
|
|
XipDescriptor = XIPpFindMemoryDescriptor(LoaderBlock);
|
|
|
|
if (!XipDescriptor) return;
|
|
|
|
|
|
|
|
//
|
|
|
|
// Make sure this is really XIP, and not RAM Disk -- also validate XIP
|
|
|
|
// Basically, either this is a ROM boot or a RAM boot, but not both nor none
|
|
|
|
//
|
|
|
|
if (!((ULONG_PTR)XipRom ^ (ULONG_PTR)XipRam)) return;
|
|
|
|
|
|
|
|
/* FIXME: TODO */
|
|
|
|
DPRINT1("ReactOS does not yet support eXecute In Place boot technology\n");
|
[NTOS]: Remove useless variables in kernel code that were set, but never actually used (dead code, tests, copy/pasters). If a variable was set but not used because of missing/#if'ed out code, a note was added instead.
[NTOS]: In the process, fix bugs in the Event dispatcher code that used Win32 EVENT_TYPE instead of NT KOBJECTS enumeration.
[NTOS]: Fix a bug in ObpInsertHandleCount, where the object access check was being done with the previous mode, instead of honoring the probe mode, which is defined by OBJ_FORCE_ACCESS_CHECK.
[NTOS]: Fix a bug in a section function which was always returning STATUS_SUCCESS, now it returns the result of the previous Status = function assignment. If this isn't desired, then don't check for the Status anymore.
[NTOS]: Note that MDL code does not support SkipBytes argument. If it is used, MDL could be invalid.
[NTOS]: Add checks for VerifierAllocation and set it when needed (WIP).
[NTOS]: Clarify what _WORKING_LINKER_ is, and the legal risks in continuing to use a linker that builds non-Microsoft drivers when used with headers whose EULA specify that they can only be used for Microsoft drivers.
svn path=/trunk/; revision=48692
2010-09-04 08:17:17 +00:00
|
|
|
DPRINT("%s MB requested (XIP = %s)\n", XipMegs, XipBoot);
|
2009-10-12 03:35:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* EOF */
|