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