1*eb6cc752Sjoerg /* $NetBSD: loadfile_machdep.h,v 1.5 2014/08/06 21:57:50 joerg Exp $ */ 237eb9eebSnonaka 337eb9eebSnonaka /*- 437eb9eebSnonaka * Copyright (c) 1999 The NetBSD Foundation, Inc. 537eb9eebSnonaka * All rights reserved. 637eb9eebSnonaka * 737eb9eebSnonaka * This code is derived from software contributed to The NetBSD Foundation 837eb9eebSnonaka * by Christos Zoulas. 937eb9eebSnonaka * 1037eb9eebSnonaka * Redistribution and use in source and binary forms, with or without 1137eb9eebSnonaka * modification, are permitted provided that the following conditions 1237eb9eebSnonaka * are met: 1337eb9eebSnonaka * 1. Redistributions of source code must retain the above copyright 1437eb9eebSnonaka * notice, this list of conditions and the following disclaimer. 1537eb9eebSnonaka * 2. Redistributions in binary form must reproduce the above copyright 1637eb9eebSnonaka * notice, this list of conditions and the following disclaimer in the 1737eb9eebSnonaka * documentation and/or other materials provided with the distribution. 1837eb9eebSnonaka * 1937eb9eebSnonaka * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 2037eb9eebSnonaka * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 2137eb9eebSnonaka * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 2237eb9eebSnonaka * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 2337eb9eebSnonaka * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 2437eb9eebSnonaka * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 2537eb9eebSnonaka * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 2637eb9eebSnonaka * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 2737eb9eebSnonaka * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 2837eb9eebSnonaka * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 2937eb9eebSnonaka * POSSIBILITY OF SUCH DAMAGE. 3037eb9eebSnonaka */ 3137eb9eebSnonaka 32e727e3f1Sthorpej #define BOOT_ELF32 3337eb9eebSnonaka 3437eb9eebSnonaka #define LOAD_KERNEL (LOAD_ALL & ~LOAD_TEXTA) 3537eb9eebSnonaka #define COUNT_KERNEL (COUNT_ALL & ~COUNT_TEXTA) 3637eb9eebSnonaka 3737eb9eebSnonaka #define LOADADDR(a) (((u_long)(a)) + offset) 3837eb9eebSnonaka #define ALIGNENTRY(a) ((u_long)(a)) 3937eb9eebSnonaka #define READ(f, b, c) read((f), (void *)LOADADDR(b), (c)) 4037eb9eebSnonaka #define BCOPY(s, d, c) memcpy((void *)LOADADDR(d), (void *)(s), (c)) 4137eb9eebSnonaka #define BZERO(d, c) memset((void *)LOADADDR(d), 0, (c)) 42*eb6cc752Sjoerg #define WARN(a) do { \ 43*eb6cc752Sjoerg (void)printf a; \ 44*eb6cc752Sjoerg if (errno) \ 45*eb6cc752Sjoerg (void)printf(": %s\n", \ 46*eb6cc752Sjoerg strerror(errno)); \ 47*eb6cc752Sjoerg else \ 48*eb6cc752Sjoerg (void)printf("\n"); \ 49*eb6cc752Sjoerg } while(/* CONSTCOND */0) 5037eb9eebSnonaka #define PROGRESS(a) (void) printf a 5137eb9eebSnonaka #define ALLOC(a) alloc(a) 52606bb2caSchristos #define DEALLOC(a, b) dealloc(a, b) 53