1*eb6cc752Sjoerg /* $NetBSD: loadfile_machdep.h,v 1.5 2014/08/06 21:57:50 joerg Exp $ */ 2b4de6615Schs 3b4de6615Schs /*- 4b4de6615Schs * Copyright (c) 1998 The NetBSD Foundation, Inc. 5b4de6615Schs * All rights reserved. 6b4de6615Schs * 7b4de6615Schs * This code is derived from software contributed to The NetBSD Foundation 8b4de6615Schs * by Christos Zoulas and Steve C. Woodford. 9b4de6615Schs * 10b4de6615Schs * Redistribution and use in source and binary forms, with or without 11b4de6615Schs * modification, are permitted provided that the following conditions 12b4de6615Schs * are met: 13b4de6615Schs * 1. Redistributions of source code must retain the above copyright 14b4de6615Schs * notice, this list of conditions and the following disclaimer. 15b4de6615Schs * 2. Redistributions in binary form must reproduce the above copyright 16b4de6615Schs * notice, this list of conditions and the following disclaimer in the 17b4de6615Schs * documentation and/or other materials provided with the distribution. 18b4de6615Schs * 19b4de6615Schs * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 20b4de6615Schs * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 21b4de6615Schs * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 22b4de6615Schs * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 23b4de6615Schs * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24b4de6615Schs * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25b4de6615Schs * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26b4de6615Schs * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27b4de6615Schs * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28b4de6615Schs * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29b4de6615Schs * POSSIBILITY OF SUCH DAMAGE. 30b4de6615Schs */ 31b4de6615Schs 32b4de6615Schs #ifndef __MACHINE_LOADFILE_MACHDEP_H 33b4de6615Schs #define __MACHINE_LOADFILE_MACHDEP_H 34b4de6615Schs 35b4de6615Schs #define BOOT_AOUT 36e727e3f1Sthorpej #define BOOT_ELF32 37b4de6615Schs 38b4de6615Schs #define LOAD_KERNEL LOAD_ALL 39b4de6615Schs #define COUNT_KERNEL COUNT_ALL 40b4de6615Schs 41b4de6615Schs #define LOADADDR(a) (((u_long)(a) & 0xffffff) + offset) 42b4de6615Schs #define ALIGNENTRY(a) 0 43b4de6615Schs #define READ(f, b, c) read((f), (void *)LOADADDR(b), (c)) 44b4de6615Schs #define BCOPY(s, d, c) memcpy((void *)LOADADDR(d), (void *)(s), (c)) 45b4de6615Schs #define BZERO(d, c) memset((void *)LOADADDR(d), 0, (c)) 46b4de6615Schs 47b4de6615Schs #ifdef _STANDALONE 48b4de6615Schs 49*eb6cc752Sjoerg #define WARN(a) do { \ 50*eb6cc752Sjoerg (void)printf a; \ 51*eb6cc752Sjoerg if (errno) \ 52*eb6cc752Sjoerg (void)printf(": %s\n", \ 53*eb6cc752Sjoerg strerror(errno)); \ 54*eb6cc752Sjoerg else \ 55*eb6cc752Sjoerg (void)printf("\n"); \ 56*eb6cc752Sjoerg } while(/* CONSTCOND */0) 57b4de6615Schs #define PROGRESS(a) (void) printf a 58b4de6615Schs #define ALLOC(a) alloc(a) 59606bb2caSchristos #define DEALLOC(a, b) dealloc(a, b) 60b4de6615Schs #define OKMAGIC(a) ((a) == NMAGIC) 61b4de6615Schs 62b4de6615Schs #else 63b4de6615Schs 64b4de6615Schs #define WARN(a) warn a 65b4de6615Schs #define PROGRESS(a) /* nothing */ 66b4de6615Schs #define ALLOC(a) malloc(a) 67606bb2caSchristos #define DEALLOC(a, b) free(a) 68b4de6615Schs #define OKMAGIC(a) ((a) == NMAGIC) 69b4de6615Schs 70b4de6615Schs #endif 71b4de6615Schs 72b4de6615Schs 73b4de6615Schs #endif /* __MACHINE_LOADFILE_MACHDEP_H */ 74