xref: /netbsd-src/sys/arch/riscv/include/loadfile_machdep.h (revision 82d56013d7b633d116a93943de88e08335357a7c)
1 /*	$NetBSD: loadfile_machdep.h,v 1.1 2021/05/05 12:47:02 jmcneill Exp $	*/
2 
3 #ifdef _LP64
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 #define LOADADDR(a)		(((u_long)(a)))
13 #define ALIGNENTRY(a)		((u_long)(a))
14 #define READ(f, b, c)		read((f), (void*)LOADADDR(b), (c))
15 #define BCOPY(s, d, c)		memmove((void*)LOADADDR(d), (void*)(s), (c))
16 #define BZERO(d, c)		memset((void*)LOADADDR(d), 0, (c))
17 #define	WARN(a)			do { \
18 					(void)printf a; \
19 					if (errno) \
20 						(void)printf(": %s\n", \
21 						             strerror(errno)); \
22 					else \
23 						(void)printf("\n"); \
24 				} while(/* CONSTCOND */0)
25 #ifdef PROGRESS_FN
26 void PROGRESS_FN(const char *, ...) __printflike(1, 2);
27 #define PROGRESS(a)		PROGRESS_FN a
28 #else
29 #define PROGRESS(a)		(void)printf a
30 #endif
31 #define ALLOC(a)		alloc(a)
32 #define DEALLOC(a, b)		dealloc(a, b)
33 #define OKMAGIC(a)		((a) == ZMAGIC)
34