2 * PROJECT: ReactOS Kernel
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: ntoskrnl/ex/xipdisp.c
5 * PURPOSE: eXecute In Place (XIP) Support.
6 * PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org)
9 /* INCLUDES ******************************************************************/
14 /* GLOBALS *******************************************************************/
16 /* FUNCTIONS *****************************************************************/
18 PMEMORY_ALLOCATION_DESCRIPTOR
20 XIPpFindMemoryDescriptor(IN PLOADER_PARAMETER_BLOCK LoaderBlock
)
22 PLIST_ENTRY NextEntry
;
23 PMEMORY_ALLOCATION_DESCRIPTOR Descriptor
= NULL
;
25 /* Loop the memory descriptors */
26 for (NextEntry
= LoaderBlock
->MemoryDescriptorListHead
.Flink
;
27 NextEntry
!= &LoaderBlock
->MemoryDescriptorListHead
;
28 NextEntry
= NextEntry
->Flink
)
30 /* Get the current descriptor and check if it's the XIP ROM */
31 Descriptor
= CONTAINING_RECORD(NextEntry
,
32 MEMORY_ALLOCATION_DESCRIPTOR
,
34 if (Descriptor
->MemoryType
== LoaderXIPRom
) return Descriptor
;
37 /* Nothing found if we got here */
43 XIPInit(IN PLOADER_PARAMETER_BLOCK LoaderBlock
)
45 PCHAR CommandLine
, XipBoot
, XipRom
, XipMegs
, XipVerbose
, XipRam
;
46 PMEMORY_ALLOCATION_DESCRIPTOR XipDescriptor
;
48 /* Get the command line */
49 CommandLine
= LoaderBlock
->LoadOptions
;
50 if (!CommandLine
) return;
52 /* Get XIP settings */
53 XipBoot
= strstr(CommandLine
, "XIPBOOT");
54 XipRam
= strstr(CommandLine
, "XIPRAM=");
55 XipRom
= strstr(CommandLine
, "XIPROM=");
56 XipMegs
= strstr(CommandLine
, "XIPMEGS=");
57 XipVerbose
= strstr(CommandLine
, "XIPVERBOSE");
59 /* Check if this is a verbose boot */
62 /* Print out our header */
63 DbgPrint("\n\nXIP: debug timestamp at line %d in %s: <<<%s %s>>>\n\n",
70 /* Find the XIP memory descriptor */
71 XipDescriptor
= XIPpFindMemoryDescriptor(LoaderBlock
);
72 if (!XipDescriptor
) return;
75 // Make sure this is really XIP, and not RAM Disk -- also validate XIP
76 // Basically, either this is a ROM boot or a RAM boot, but not both nor none
78 if (!((ULONG_PTR
)XipRom
^ (ULONG_PTR
)XipRam
)) return;
81 DPRINT1("ReactOS does not yet support eXecute In Place boot technology\n");