loadfile_machdep.h revision 1.8 1 /* $NetBSD: loadfile_machdep.h,v 1.8 2020/09/26 14:18:06 skrll Exp $ */
2
3 #if defined(__aarch64__)
4 #define BOOT_ELF64
5 #else
6 #define BOOT_ELF32
7 #endif
8
9 #define LOAD_KERNEL (LOAD_ALL & ~LOAD_TEXTA)
10 #define COUNT_KERNEL (COUNT_ALL & ~COUNT_TEXTA)
11
12 #if defined(__aarch64__)
13 extern u_long load_offset;
14 #define LOADADDR(a) (((((u_long)(a)) + offset) & 0x3fffffffff) + load_offset)
15 #elif defined(EFIBOOT)
16 extern u_long load_offset;
17 #define LOADADDR(a) (((((u_long)(a)) + offset) & 0x7fffffff) + load_offset)
18 #else
19 #define LOADADDR(a) (((u_long)(a)))
20 #endif
21 #define ALIGNENTRY(a) ((u_long)(a))
22 #define READ(f, b, c) read((f), (void*)LOADADDR(b), (c))
23 #define BCOPY(s, d, c) memmove((void*)LOADADDR(d), (void*)(s), (c))
24 #define BZERO(d, c) memset((void*)LOADADDR(d), 0, (c))
25 #define WARN(a) do { \
26 (void)printf a; \
27 if (errno) \
28 (void)printf(": %s\n", \
29 strerror(errno)); \
30 else \
31 (void)printf("\n"); \
32 } while(/* CONSTCOND */0)
33 #ifdef PROGRESS_FN
34 void PROGRESS_FN(const char *, ...) __printflike(1, 2);
35 #define PROGRESS(a) PROGRESS_FN a
36 #else
37 #define PROGRESS(a) (void)printf a
38 #endif
39 #define ALLOC(a) alloc(a)
40 #define DEALLOC(a, b) dealloc(a, b)
41 #define OKMAGIC(a) ((a) == ZMAGIC)
42