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
21 XIPpFindMemoryDescriptor(IN PLOADER_PARAMETER_BLOCK LoaderBlock
)
23 PLIST_ENTRY NextEntry
;
24 PMEMORY_ALLOCATION_DESCRIPTOR Descriptor
= NULL
;
26 /* Loop the memory descriptors */
27 for (NextEntry
= LoaderBlock
->MemoryDescriptorListHead
.Flink
;
28 NextEntry
!= &LoaderBlock
->MemoryDescriptorListHead
;
29 NextEntry
= NextEntry
->Flink
)
31 /* Get the current descriptor and check if it's the XIP ROM */
32 Descriptor
= CONTAINING_RECORD(NextEntry
,
33 MEMORY_ALLOCATION_DESCRIPTOR
,
35 if (Descriptor
->MemoryType
== LoaderXIPRom
) return Descriptor
;
38 /* Nothing found if we got here */
45 XIPInit(IN PLOADER_PARAMETER_BLOCK LoaderBlock
)
47 PCHAR CommandLine
, XipBoot
, XipRom
, XipMegs
, XipVerbose
, XipRam
;
48 PMEMORY_ALLOCATION_DESCRIPTOR XipDescriptor
;
50 /* Get the command line */
51 CommandLine
= LoaderBlock
->LoadOptions
;
52 if (!CommandLine
) return;
54 /* Get XIP settings */
55 XipBoot
= strstr(CommandLine
, "XIPBOOT");
56 XipRam
= strstr(CommandLine
, "XIPRAM=");
57 XipRom
= strstr(CommandLine
, "XIPROM=");
58 XipMegs
= strstr(CommandLine
, "XIPMEGS=");
59 XipVerbose
= strstr(CommandLine
, "XIPVERBOSE");
61 /* Check if this is a verbose boot */
64 /* Print out our header */
65 DbgPrint("\n\nXIP: debug timestamp at line %d in %s: <<<%s %s>>>\n\n",
72 /* Find the XIP memory descriptor */
73 XipDescriptor
= XIPpFindMemoryDescriptor(LoaderBlock
);
74 if (!XipDescriptor
) return;
77 // Make sure this is really XIP, and not RAM Disk -- also validate XIP
78 // Basically, either this is a ROM boot or a RAM boot, but not both nor none
80 if (!((ULONG_PTR
)XipRom
^ (ULONG_PTR
)XipRam
)) return;
83 DPRINT1("ReactOS does not yet support eXecute In Place boot technology\n");
84 DPRINT("%s MB requested (XIP = %s)\n", XipMegs
, XipBoot
);