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