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