xref: /reactos/boot/freeldr/freeldr/include/freeldr.h (revision cadfdc55)
1 /*
2  *  FreeLoader
3  *  Copyright (C) 1998-2003  Brian Palmer  <brianp@sginet.com>
4  *
5  *  This program is free software; you can redistribute it and/or modify
6  *  it under the terms of the GNU General Public License as published by
7  *  the Free Software Foundation; either version 2 of the License, or
8  *  (at your option) any later version.
9  *
10  *  This program is distributed in the hope that it will be useful,
11  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  *  GNU General Public License for more details.
14  *
15  *  You should have received a copy of the GNU General Public License along
16  *  with this program; if not, write to the Free Software Foundation, Inc.,
17  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  */
19 
20 #ifndef __FREELDR_H
21 #define __FREELDR_H
22 
23 /* Enabled for supporting the deprecated boot options
24  * that will be removed in a future FreeLdr version */
25 #define HAS_DEPRECATED_OPTIONS
26 
27 #define UINT64_C(val) val##ULL
28 #define RVA(m, b) ((PVOID)((ULONG_PTR)(b) + (ULONG_PTR)(m)))
29 
30 #define ROUND_DOWN(n, align) \
31     (((ULONG)n) & ~((align) - 1l))
32 
33 #define ROUND_UP(n, align) \
34     ROUND_DOWN(((ULONG)n) + (align) - 1, (align))
35 
36 /* Public headers */
37 #ifdef __REACTOS__
38 #include <ntddk.h>
39 #include <ntifs.h>
40 #include <ioaccess.h>
41 #include <arc/arc.h>
42 #include <ketypes.h>
43 #include <mmtypes.h>
44 #include <ndk/asm.h>
45 #include <ndk/rtlfuncs.h>
46 #include <ndk/ldrtypes.h>
47 #include <ndk/halfuncs.h>
48 #include <stdlib.h>
49 #include <stdio.h>
50 #include <ctype.h>
51 #include <ntdddisk.h>
52 #include <internal/hal.h>
53 #include <drivers/pci/pci.h>
54 #include <winerror.h>
55 #include <ntstrsafe.h>
56 #else
57 #include <ntsup.h>
58 #endif
59 
60 /* Internal headers */
61 // #include <arcemul.h>
62 #include <arcname.h>
63 #include <arcsupp.h>
64 #include <bytesex.h>
65 #include <cache.h>
66 #include <comm.h>
67 #include <disk.h>
68 #include <fs.h>
69 #include <inifile.h>
70 #include <keycodes.h>
71 #include <linux.h>
72 #include <custom.h>
73 #include <miscboot.h>
74 #include <machine.h>
75 #include <mm.h>
76 #include <multiboot.h>
77 #include <options.h>
78 #include <oslist.h>
79 #include <ramdisk.h>
80 #include <settings.h>
81 #include <ver.h>
82 
83 /* NTOS loader */
84 #include <include/ntldr/winldr.h>
85 #include <conversion.h> // More-or-less related to MM also...
86 #include <peloader.h>
87 
88 /* File system headers */
89 #include <fs/ext2.h>
90 #include <fs/fat.h>
91 #include <fs/ntfs.h>
92 #include <fs/iso.h>
93 #include <fs/pxe.h>
94 #include <fs/btrfs.h>
95 
96 /* UI support */
97 #define printf TuiPrintf
98 #include <ui.h>
99 #include <ui/video.h>
100 
101 /* Arch specific includes */
102 #include <arch/archwsup.h>
103 #if defined(_M_IX86) || defined(_M_AMD64)
104 #include <arch/pc/hardware.h>
105 #include <arch/pc/pcbios.h>
106 #include <arch/pc/x86common.h>
107 #include <arch/pc/pxe.h>
108 #include <arch/i386/drivemap.h>
109 #endif
110 #if defined(_M_IX86)
111 #if defined(SARCH_PC98)
112 #include <arch/i386/machpc98.h>
113 #elif defined(SARCH_XBOX)
114 #include <arch/pc/machpc.h>
115 #include <arch/i386/machxbox.h>
116 #else
117 #include <arch/pc/machpc.h>
118 #endif
119 #include <arch/i386/i386.h>
120 #elif defined(_M_AMD64)
121 #include <arch/pc/machpc.h>
122 #include <arch/amd64/amd64.h>
123 #elif defined(_M_PPC)
124 #include <arch/powerpc/hardware.h>
125 #elif defined(_M_ARM)
126 #include <arch/arm/hardware.h>
127 #elif defined(_M_MIPS)
128 #include <arch/mips/arcbios.h>
129 #endif
130 
131 VOID __cdecl BootMain(IN PCCH CmdLine);
132 
133 #ifdef HAS_DEPRECATED_OPTIONS
134 VOID
135 WarnDeprecated(
136     _In_ PCSTR MsgFmt,
137     ...);
138 #endif
139 
140 VOID
141 LoadOperatingSystem(
142     _In_ OperatingSystemItem* OperatingSystem);
143 
144 #ifdef HAS_OPTION_MENU_EDIT_CMDLINE
145 VOID
146 EditOperatingSystemEntry(
147     _Inout_ OperatingSystemItem* OperatingSystem);
148 #endif
149 
150 VOID RunLoader(VOID);
151 VOID FrLdrCheckCpuCompatibility(VOID);
152 
153 #endif  /* __FREELDR_H */
154