Home | History | Annotate | Line # | Download | only in include
      1 /*	$NetBSD: loadfile_machdep.h,v 1.2 2023/05/07 12:41:48 skrll 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 #if defined(_LP64)
     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 
     22 #define ALIGNENTRY(a)		((u_long)(a))
     23 #define READ(f, b, c)		read((f), (void*)LOADADDR(b), (c))
     24 #define BCOPY(s, d, c)		memmove((void*)LOADADDR(d), (void*)(s), (c))
     25 #define BZERO(d, c)		memset((void*)LOADADDR(d), 0, (c))
     26 #define	WARN(a)			do { \
     27 					(void)printf a; \
     28 					if (errno) \
     29 						(void)printf(": %s\n", \
     30 						             strerror(errno)); \
     31 					else \
     32 						(void)printf("\n"); \
     33 				} while(/* CONSTCOND */0)
     34 #ifdef PROGRESS_FN
     35 void PROGRESS_FN(const char *, ...) __printflike(1, 2);
     36 #define PROGRESS(a)		PROGRESS_FN a
     37 #else
     38 #define PROGRESS(a)		(void)printf a
     39 #endif
     40 #define ALLOC(a)		alloc(a)
     41 #define DEALLOC(a, b)		dealloc(a, b)
     42 #define OKMAGIC(a)		((a) == ZMAGIC)
     43