1c2c66affSColin Finck /*
2c2c66affSColin Finck * PROJECT: ReactOS Kernel
3c2c66affSColin Finck * LICENSE: GPL - See COPYING in the top level directory
4c2c66affSColin Finck * FILE: ntoskrnl/ex/xipdisp.c
5c2c66affSColin Finck * PURPOSE: eXecute In Place (XIP) Support.
6c2c66affSColin Finck * PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org)
7c2c66affSColin Finck */
8c2c66affSColin Finck
9c2c66affSColin Finck /* INCLUDES ******************************************************************/
10c2c66affSColin Finck
11c2c66affSColin Finck #include <ntoskrnl.h>
12c2c66affSColin Finck #include <debug.h>
13c2c66affSColin Finck
14c2c66affSColin Finck /* GLOBALS *******************************************************************/
15c2c66affSColin Finck
16c2c66affSColin Finck /* FUNCTIONS *****************************************************************/
17c2c66affSColin Finck
18c2c66affSColin Finck NTSTATUS
19c2c66affSColin Finck NTAPI
XIPDispatch(IN ULONG DispatchCode,OUT PVOID Buffer,IN ULONG BufferSize)20c2c66affSColin Finck XIPDispatch(IN ULONG DispatchCode,
21c2c66affSColin Finck OUT PVOID Buffer,
22c2c66affSColin Finck IN ULONG BufferSize)
23c2c66affSColin Finck {
24c2c66affSColin Finck UNIMPLEMENTED;
25c2c66affSColin Finck return STATUS_NOT_IMPLEMENTED;
26c2c66affSColin Finck }
27c2c66affSColin Finck
28*5c7ce447SVictor Perevertkin CODE_SEG("INIT")
29c2c66affSColin Finck PMEMORY_ALLOCATION_DESCRIPTOR
30c2c66affSColin Finck NTAPI
XIPpFindMemoryDescriptor(IN PLOADER_PARAMETER_BLOCK LoaderBlock)31c2c66affSColin Finck XIPpFindMemoryDescriptor(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
32c2c66affSColin Finck {
33c2c66affSColin Finck PLIST_ENTRY NextEntry;
34c2c66affSColin Finck PMEMORY_ALLOCATION_DESCRIPTOR Descriptor = NULL;
35c2c66affSColin Finck
36c2c66affSColin Finck /* Loop the memory descriptors */
37c2c66affSColin Finck for (NextEntry = LoaderBlock->MemoryDescriptorListHead.Flink;
38c2c66affSColin Finck NextEntry != &LoaderBlock->MemoryDescriptorListHead;
39c2c66affSColin Finck NextEntry = NextEntry->Flink)
40c2c66affSColin Finck {
41c2c66affSColin Finck /* Get the current descriptor and check if it's the XIP ROM */
42c2c66affSColin Finck Descriptor = CONTAINING_RECORD(NextEntry,
43c2c66affSColin Finck MEMORY_ALLOCATION_DESCRIPTOR,
44c2c66affSColin Finck ListEntry);
45c2c66affSColin Finck if (Descriptor->MemoryType == LoaderXIPRom) return Descriptor;
46c2c66affSColin Finck }
47c2c66affSColin Finck
48c2c66affSColin Finck /* Nothing found if we got here */
49c2c66affSColin Finck return NULL;
50c2c66affSColin Finck }
51c2c66affSColin Finck
52*5c7ce447SVictor Perevertkin CODE_SEG("INIT")
53c2c66affSColin Finck VOID
54c2c66affSColin Finck NTAPI
XIPInit(IN PLOADER_PARAMETER_BLOCK LoaderBlock)55c2c66affSColin Finck XIPInit(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
56c2c66affSColin Finck {
57c2c66affSColin Finck PCHAR CommandLine, XipBoot, XipRom, XipMegs, XipVerbose, XipRam;
58c2c66affSColin Finck PMEMORY_ALLOCATION_DESCRIPTOR XipDescriptor;
59c2c66affSColin Finck
60c2c66affSColin Finck /* Get the command line */
61c2c66affSColin Finck CommandLine = LoaderBlock->LoadOptions;
62c2c66affSColin Finck if (!CommandLine) return;
63c2c66affSColin Finck
64c2c66affSColin Finck /* Get XIP settings */
65c2c66affSColin Finck XipBoot = strstr(CommandLine, "XIPBOOT");
66c2c66affSColin Finck XipRam = strstr(CommandLine, "XIPRAM=");
67c2c66affSColin Finck XipRom = strstr(CommandLine, "XIPROM=");
68c2c66affSColin Finck XipMegs = strstr(CommandLine, "XIPMEGS=");
69c2c66affSColin Finck XipVerbose = strstr(CommandLine, "XIPVERBOSE");
70c2c66affSColin Finck
71c2c66affSColin Finck /* Check if this is a verbose boot */
72c2c66affSColin Finck if (XipVerbose)
73c2c66affSColin Finck {
74c2c66affSColin Finck /* Print out our header */
75c2c66affSColin Finck DbgPrint("\n\nXIP: debug timestamp at line %d in %s: <<<%s %s>>>\n\n",
76c2c66affSColin Finck __LINE__,
77c2c66affSColin Finck __FILE__,
78c2c66affSColin Finck __DATE__,
79c2c66affSColin Finck __TIME__);
80c2c66affSColin Finck }
81c2c66affSColin Finck
82c2c66affSColin Finck /* Find the XIP memory descriptor */
83c2c66affSColin Finck XipDescriptor = XIPpFindMemoryDescriptor(LoaderBlock);
84c2c66affSColin Finck if (!XipDescriptor) return;
85c2c66affSColin Finck
86c2c66affSColin Finck //
87c2c66affSColin Finck // Make sure this is really XIP, and not RAM Disk -- also validate XIP
88c2c66affSColin Finck // Basically, either this is a ROM boot or a RAM boot, but not both nor none
89c2c66affSColin Finck //
90c2c66affSColin Finck if (!((ULONG_PTR)XipRom ^ (ULONG_PTR)XipRam)) return;
91c2c66affSColin Finck
92c2c66affSColin Finck /* FIXME: TODO */
93c2c66affSColin Finck DPRINT1("ReactOS does not yet support eXecute In Place boot technology\n");
94c2c66affSColin Finck DPRINT("%s MB requested (XIP = %s)\n", XipMegs, XipBoot);
95c2c66affSColin Finck }
96c2c66affSColin Finck
97c2c66affSColin Finck /* EOF */
98