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