1*eb6cc752Sjoerg /* $NetBSD: loadfile_machdep.h,v 1.9 2014/08/06 21:57:50 joerg Exp $ */ 249a60feeSchristos 349a60feeSchristos /*- 449a60feeSchristos * Copyright (c) 1999 The NetBSD Foundation, Inc. 549a60feeSchristos * All rights reserved. 649a60feeSchristos * 749a60feeSchristos * This code is derived from software contributed to The NetBSD Foundation 849a60feeSchristos * by Christos Zoulas. 949a60feeSchristos * 1049a60feeSchristos * Redistribution and use in source and binary forms, with or without 1149a60feeSchristos * modification, are permitted provided that the following conditions 1249a60feeSchristos * are met: 1349a60feeSchristos * 1. Redistributions of source code must retain the above copyright 1449a60feeSchristos * notice, this list of conditions and the following disclaimer. 1549a60feeSchristos * 2. Redistributions in binary form must reproduce the above copyright 1649a60feeSchristos * notice, this list of conditions and the following disclaimer in the 1749a60feeSchristos * documentation and/or other materials provided with the distribution. 1849a60feeSchristos * 1949a60feeSchristos * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 2049a60feeSchristos * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 2149a60feeSchristos * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 2249a60feeSchristos * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 2349a60feeSchristos * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 2449a60feeSchristos * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 2549a60feeSchristos * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 2649a60feeSchristos * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 2749a60feeSchristos * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 2849a60feeSchristos * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 2949a60feeSchristos * POSSIBILITY OF SUCH DAMAGE. 3049a60feeSchristos */ 3149a60feeSchristos 32838b5e08Sad #ifndef _PMAX_LOADFILE_MACHDEP_H_ 33838b5e08Sad #define _PMAX_LOADFILE_MACHDEP_H_ 34838b5e08Sad 3549a60feeSchristos #define BOOT_ECOFF 36e727e3f1Sthorpej #define BOOT_ELF32 37290a34a0Smatt #define BOOT_ELF64 3849a60feeSchristos 3949a60feeSchristos #define LOAD_KERNEL (LOAD_ALL & ~LOAD_TEXTA) 4049a60feeSchristos #define COUNT_KERNEL (COUNT_ALL & ~COUNT_TEXTA) 4149a60feeSchristos 4249a60feeSchristos #define LOADADDR(a) (((u_long)(a)) + offset) 4349a60feeSchristos #define ALIGNENTRY(a) ((u_long)(a)) 4449a60feeSchristos #define READ(f, b, c) read((f), (void *)LOADADDR(b), (c)) 4549a60feeSchristos #define BCOPY(s, d, c) memcpy((void *)LOADADDR(d), (void *)(s), (c)) 4649a60feeSchristos #define BZERO(d, c) memset((void *)LOADADDR(d), 0, (c)) 47*eb6cc752Sjoerg #define WARN(a) do { \ 48*eb6cc752Sjoerg (void)printf a; \ 49*eb6cc752Sjoerg if (errno) \ 50*eb6cc752Sjoerg (void)printf(": %s\n", \ 51*eb6cc752Sjoerg strerror(errno)); \ 52*eb6cc752Sjoerg else \ 53*eb6cc752Sjoerg (void)printf("\n"); \ 54*eb6cc752Sjoerg } while(/* CONSTCOND */0) 5549a60feeSchristos #define PROGRESS(a) (void) printf a 5649a60feeSchristos #define ALLOC(a) alloc(a) 57606bb2caSchristos #define DEALLOC(a, b) dealloc(a, b) 5849a60feeSchristos #define OKMAGIC(a) ((a) == OMAGIC) 59838b5e08Sad 60838b5e08Sad #endif /* !_PMAX_LOADFILE_MACHDEP_H_ */ 61