xref: /netbsd-src/sys/arch/cobalt/include/loadfile_machdep.h (revision eb6cc7528a5a7cb93a1d37aa9d3b5a814f13bc58)
1*eb6cc752Sjoerg /*	$NetBSD: loadfile_machdep.h,v 1.4 2014/08/06 21:57:49 joerg Exp $	 */
22b74542aScdi 
32b74542aScdi /*-
42b74542aScdi  * Copyright (c) 1999 The NetBSD Foundation, Inc.
52b74542aScdi  * All rights reserved.
62b74542aScdi  *
72b74542aScdi  * This code is derived from software contributed to The NetBSD Foundation
82b74542aScdi  * by Christos Zoulas.
92b74542aScdi  *
102b74542aScdi  * Redistribution and use in source and binary forms, with or without
112b74542aScdi  * modification, are permitted provided that the following conditions
122b74542aScdi  * are met:
132b74542aScdi  * 1. Redistributions of source code must retain the above copyright
142b74542aScdi  *    notice, this list of conditions and the following disclaimer.
152b74542aScdi  * 2. Redistributions in binary form must reproduce the above copyright
162b74542aScdi  *    notice, this list of conditions and the following disclaimer in the
172b74542aScdi  *    documentation and/or other materials provided with the distribution.
182b74542aScdi  *
192b74542aScdi  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
202b74542aScdi  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
212b74542aScdi  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
222b74542aScdi  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
232b74542aScdi  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
242b74542aScdi  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
252b74542aScdi  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
262b74542aScdi  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
272b74542aScdi  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
282b74542aScdi  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
292b74542aScdi  * POSSIBILITY OF SUCH DAMAGE.
302b74542aScdi  */
312b74542aScdi 
322b74542aScdi #ifndef _COBALT_LOADFILE_MACHDEP_H_
332b74542aScdi #define _COBALT_LOADFILE_MACHDEP_H_
342b74542aScdi 
352b74542aScdi #define BOOT_ECOFF
362b74542aScdi #define BOOT_ELF32
372b74542aScdi 
382b74542aScdi #define LOAD_KERNEL	(LOAD_ALL & ~LOAD_TEXTA)
392b74542aScdi #define COUNT_KERNEL	(COUNT_ALL & ~COUNT_TEXTA)
402b74542aScdi 
412b74542aScdi #define LOADADDR(a)		(((u_long)(a)) + offset)
422b74542aScdi #define ALIGNENTRY(a)		((u_long)(a))
432b74542aScdi #define READ(f, b, c)		read((f), (void *)LOADADDR(b), (c))
442b74542aScdi #define BCOPY(s, d, c)		memcpy((void *)LOADADDR(d), (void *)(s), (c))
452b74542aScdi #define BZERO(d, c)		memset((void *)LOADADDR(d), 0, (c))
46*eb6cc752Sjoerg #define	WARN(a)			do { \
47*eb6cc752Sjoerg 					(void)printf a; \
48*eb6cc752Sjoerg 					if (errno) \
49*eb6cc752Sjoerg 						(void)printf(": %s\n", \
50*eb6cc752Sjoerg 						             strerror(errno)); \
51*eb6cc752Sjoerg 					else \
52*eb6cc752Sjoerg 						(void)printf("\n"); \
53*eb6cc752Sjoerg 				} while(/* CONSTCOND */0)
542b74542aScdi #define PROGRESS(a)		(void) printf a
552b74542aScdi #define ALLOC(a)		alloc(a)
56606bb2caSchristos #define DEALLOC(a, b)		dealloc(a, b)
572b74542aScdi #define OKMAGIC(a)		((a) == OMAGIC)
582b74542aScdi 
592b74542aScdi #endif	/* !_COBALT_LOADFILE_MACHDEP_H_ */
60