loadfile_machdep.h revision 1.1
11.1Suwe/*	$NetBSD: loadfile_machdep.h,v 1.1 2006/09/01 21:26:18 uwe Exp $	*/
21.1Suwe
31.1Suwe/*-
41.1Suwe * Copyright (c) 1999 The NetBSD Foundation, Inc.
51.1Suwe * All rights reserved.
61.1Suwe *
71.1Suwe * This code is derived from software contributed to The NetBSD Foundation
81.1Suwe * by Christos Zoulas.
91.1Suwe *
101.1Suwe * Redistribution and use in source and binary forms, with or without
111.1Suwe * modification, are permitted provided that the following conditions
121.1Suwe * are met:
131.1Suwe * 1. Redistributions of source code must retain the above copyright
141.1Suwe *    notice, this list of conditions and the following disclaimer.
151.1Suwe * 2. Redistributions in binary form must reproduce the above copyright
161.1Suwe *    notice, this list of conditions and the following disclaimer in the
171.1Suwe *    documentation and/or other materials provided with the distribution.
181.1Suwe * 3. All advertising materials mentioning features or use of this software
191.1Suwe *    must display the following acknowledgement:
201.1Suwe *        This product includes software developed by the NetBSD
211.1Suwe *        Foundation, Inc. and its contributors.
221.1Suwe * 4. Neither the name of The NetBSD Foundation nor the names of its
231.1Suwe *    contributors may be used to endorse or promote products derived
241.1Suwe *    from this software without specific prior written permission.
251.1Suwe *
261.1Suwe * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
271.1Suwe * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
281.1Suwe * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
291.1Suwe * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
301.1Suwe * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
311.1Suwe * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
321.1Suwe * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
331.1Suwe * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
341.1Suwe * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
351.1Suwe * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
361.1Suwe * POSSIBILITY OF SUCH DAMAGE.
371.1Suwe */
381.1Suwe
391.1Suwe#define BOOT_ELF32
401.1Suwe
411.1Suwe#define LOAD_KERNEL	(LOAD_ALL & ~LOAD_TEXTA)
421.1Suwe#define COUNT_KERNEL	(COUNT_ALL & ~COUNT_TEXTA)
431.1Suwe
441.1Suwe#define LOADADDR(a)		(((u_long)(a)) + offset)
451.1Suwe#define ALIGNENTRY(a)		((u_long)(a))
461.1Suwe#define READ(f, b, c)		read((f), (void *)LOADADDR(b), (c))
471.1Suwe#define BCOPY(s, d, c)		memcpy((void *)LOADADDR(d), (void *)(s), (c))
481.1Suwe#define BZERO(d, c)		memset((void *)LOADADDR(d), 0, (c))
491.1Suwe#define	WARN(a)			(void)(printf a, \
501.1Suwe				    printf((errno ? ": %s\n" : "\n"), \
511.1Suwe				    strerror(errno)))
521.1Suwe#define PROGRESS(a)		(void) printf a
531.1Suwe
541.1Suwe#ifdef _STANDALONE
551.1Suwe#define ALLOC(a)		alloc(a)
561.1Suwe#define DEALLOC(a, b)		dealloc(a, b)
571.1Suwe#else
581.1Suwe#define ALLOC(a)		alloc(a)
591.1Suwe#define DEALLOC(a, b)		free(a, b)
601.1Suwe#endif
61