1*eb6cc752Sjoerg /* $NetBSD: loadfile_machdep.h,v 1.3 2014/08/06 21:57:50 joerg Exp $ */ 268fe5b6fSgarbled 368fe5b6fSgarbled /*- 468fe5b6fSgarbled * Copyright (c) 1999 The NetBSD Foundation, Inc. 568fe5b6fSgarbled * All rights reserved. 668fe5b6fSgarbled * 768fe5b6fSgarbled * This code is derived from software contributed to The NetBSD Foundation 868fe5b6fSgarbled * by Christos Zoulas. 968fe5b6fSgarbled * 1068fe5b6fSgarbled * Redistribution and use in source and binary forms, with or without 1168fe5b6fSgarbled * modification, are permitted provided that the following conditions 1268fe5b6fSgarbled * are met: 1368fe5b6fSgarbled * 1. Redistributions of source code must retain the above copyright 1468fe5b6fSgarbled * notice, this list of conditions and the following disclaimer. 1568fe5b6fSgarbled * 2. Redistributions in binary form must reproduce the above copyright 1668fe5b6fSgarbled * notice, this list of conditions and the following disclaimer in the 1768fe5b6fSgarbled * documentation and/or other materials provided with the distribution. 1868fe5b6fSgarbled * 1968fe5b6fSgarbled * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 2068fe5b6fSgarbled * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 2168fe5b6fSgarbled * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 2268fe5b6fSgarbled * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 2368fe5b6fSgarbled * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 2468fe5b6fSgarbled * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 2568fe5b6fSgarbled * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 2668fe5b6fSgarbled * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 2768fe5b6fSgarbled * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 2868fe5b6fSgarbled * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 2968fe5b6fSgarbled * POSSIBILITY OF SUCH DAMAGE. 3068fe5b6fSgarbled */ 3168fe5b6fSgarbled 3268fe5b6fSgarbled #define BOOT_ELF32 3368fe5b6fSgarbled 3468fe5b6fSgarbled #define LOAD_KERNEL (LOAD_ALL & ~LOAD_TEXTA) 3568fe5b6fSgarbled #define COUNT_KERNEL (COUNT_ALL & ~COUNT_TEXTA) 3668fe5b6fSgarbled 3768fe5b6fSgarbled #define LOADADDR(a) (((u_long)(a)) + offset) 3868fe5b6fSgarbled #define ALIGNENTRY(a) ((u_long)(a)) 3968fe5b6fSgarbled #define READ(f, b, c) read((f), (void *)LOADADDR(b), (c)) 4068fe5b6fSgarbled #define BCOPY(s, d, c) memcpy((void *)LOADADDR(d), (void *)(s), (c)) 4168fe5b6fSgarbled #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) 5068fe5b6fSgarbled #define PROGRESS(a) (void) printf a 5168fe5b6fSgarbled #define ALLOC(a) alloc(a) 5268fe5b6fSgarbled #define DEALLOC(a, b) dealloc(a, b) 53