Merge freeldr from amd64 branch:
[reactos.git] / reactos / boot / freeldr / freeldr / include / freeldr.h
index ccf5daf..2fe98bb 100644 (file)
 #define __FREELDR_H
 
 #define UINT64_C(val) val##ULL
+#define RVA(m, b) ((PVOID)((ULONG_PTR)(b) + (ULONG_PTR)(m)))
+
+#define ROUND_DOWN(n, align) \
+    (((ULONG)n) & ~((align) - 1l))
+
+#define ROUND_UP(n, align) \
+    ROUND_DOWN(((ULONG)n) + (align) - 1, (align))
 
-#include <stdlib.h>
-#include <stdio.h>
-#include <ctype.h>
 #define NTOSAPI
 #define printf TuiPrintf
 #include <ntddk.h>
 #include <arc/arc.h>
 #include <ketypes.h>
 #include <mmtypes.h>
+#include <ndk/asm.h>
+#include <ndk/rtlfuncs.h>
+#include <ndk/ldrtypes.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <ctype.h>
 #include <rosldr.h>
 #include <arch.h>
 #include <rtl.h>
@@ -46,9 +56,6 @@
 #include <inffile.h>
 #include <video.h>
 #include <ramdisk.h>
-/* NDK, needed for ReactOS/Windows loaders */
-#include <ndk/rtlfuncs.h>
-#include <ndk/ldrtypes.h>
 #include <reactos.h>
 #include <registry.h>
 #include <winldr.h>
@@ -86,6 +93,7 @@
 #include <ver.h>
 #include <cmdline.h>
 #include <bget.h>
+#include <winerror.h>
 /* Needed by boot manager */
 #include <bootmgr.h>
 #include <oslist.h>
 /* Externals */
 #include <reactos/rossym.h>
 #include <reactos/buildno.h>
-#include <reactos/helper.h>
 /* Needed if debuging is enabled */
 #include <comm.h>
 /* Swap */
 #define Ke386EraseFlags(x)     __asm__ __volatile__("pushl $0 ; popfl\n")
 #endif
 
+#ifdef _M_AMD64
+#define KeAmd64EraseFlags(x)     __asm__ __volatile__("pushq $0 ; popfq\n")
+#endif
+
 VOID BootMain(LPSTR CmdLine);
 VOID RunLoader(VOID);
 
+/* Special hack for ReactOS setup OS type */
+VOID LoadReactOSSetup(VOID);
+
 #endif  // defined __FREELDR_H