loadfile_machdep.h revision 1.4
11.4Sthorpej/*	$NetBSD: loadfile_machdep.h,v 1.4 2004/08/28 19:46:41 thorpej Exp $	*/
21.1Sthorpej
31.1Sthorpej/*-
41.1Sthorpej * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
51.1Sthorpej * All rights reserved.
61.1Sthorpej *
71.1Sthorpej * This code is derived from software contributed to The NetBSD Foundation
81.1Sthorpej * by Christos Zoulas and Jason R. Thorpe.
91.1Sthorpej *
101.1Sthorpej * Redistribution and use in source and binary forms, with or without
111.1Sthorpej * modification, are permitted provided that the following conditions
121.1Sthorpej * are met:
131.1Sthorpej * 1. Redistributions of source code must retain the above copyright
141.1Sthorpej *    notice, this list of conditions and the following disclaimer.
151.1Sthorpej * 2. Redistributions in binary form must reproduce the above copyright
161.1Sthorpej *    notice, this list of conditions and the following disclaimer in the
171.1Sthorpej *    documentation and/or other materials provided with the distribution.
181.1Sthorpej * 3. All advertising materials mentioning features or use of this software
191.1Sthorpej *    must display the following acknowledgement:
201.1Sthorpej *        This product includes software developed by the NetBSD
211.1Sthorpej *        Foundation, Inc. and its contributors.
221.1Sthorpej * 4. Neither the name of The NetBSD Foundation nor the names of its
231.1Sthorpej *    contributors may be used to endorse or promote products derived
241.1Sthorpej *    from this software without specific prior written permission.
251.1Sthorpej *
261.1Sthorpej * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
271.1Sthorpej * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
281.1Sthorpej * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
291.1Sthorpej * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
301.1Sthorpej * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
311.1Sthorpej * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
321.1Sthorpej * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
331.1Sthorpej * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
341.1Sthorpej * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
351.1Sthorpej * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
361.1Sthorpej * POSSIBILITY OF SUCH DAMAGE.
371.1Sthorpej */
381.1Sthorpej
391.2Ssimonb#ifndef _HP300_LOADFILE_MACHDEP_H_
401.2Ssimonb#define	_HP300_LOADFILE_MACHDEP_H_
411.1Sthorpej
421.2Ssimonb#define	BOOT_AOUT
431.3Sthorpej#define	BOOT_ELF32
441.1Sthorpej
451.2Ssimonb#define	LOAD_KERNEL	LOAD_ALL
461.2Ssimonb#define	COUNT_KERNEL	COUNT_ALL
471.1Sthorpej
481.1Sthorpej#ifdef _STANDALONE
491.1Sthorpej
501.2Ssimonb#define	LOADADDR(a)		((a) + offset)
511.2Ssimonb#define	ALIGNENTRY(a)		0
521.2Ssimonb#define	READ(f, b, c)		pread((f), (void *)LOADADDR(b), (c))
531.2Ssimonb#define	BCOPY(s, d, c)		vpbcopy((s), (void *)LOADADDR(d), (c))
541.2Ssimonb#define	BZERO(d, c)		pbzero((void *)LOADADDR(d), (c))
551.1Sthorpej#define	WARN(a)			(void)(printf a, \
561.1Sthorpej				    printf((errno ? ": %s\n" : "\n"), \
571.1Sthorpej				    strerror(errno)))
581.2Ssimonb#define	PROGRESS(a)		(void) printf a
591.2Ssimonb#define	ALLOC(a)		alloc(a)
601.2Ssimonb#define	FREE(a, b)		free(a, b)
611.2Ssimonb#define	OKMAGIC(a)		((a) == OMAGIC || (a) == NMAGIC ||	\
621.1Sthorpej				 (a) == ZMAGIC)
631.1Sthorpej
641.1Sthorpej#define	vpbcopy bcopy
651.1Sthorpej#define	pbzero  bzero
661.2Ssimonb#define	pread   read
671.1Sthorpej
681.1Sthorpej#else
691.1Sthorpej
701.2Ssimonb#define	LOADADDR(a)		(((u_long)(a)) + offset)
711.2Ssimonb#define	ALIGNENTRY(a)		((u_long)(a))
721.2Ssimonb#define	READ(f, b, c)		read((f), (void *)LOADADDR(b), (c))
731.2Ssimonb#define	BCOPY(s, d, c)		memcpy((void *)LOADADDR(d), (void *)(s), (c))
741.2Ssimonb#define	BZERO(d, c)		memset((void *)LOADADDR(d), 0, (c))
751.2Ssimonb#define	WARN(a)			warn a
761.2Ssimonb#define	PROGRESS(a)		/* nothing */
771.2Ssimonb#define	ALLOC(a)		malloc(a)
781.2Ssimonb#define	FREE(a, b)		free(a)
791.2Ssimonb#define	OKMAGIC(a)		((a) == OMAGIC)
801.1Sthorpej
811.4Sthorpejssize_t	vread(int, u_long, u_long *, size_t);
821.4Sthorpejvoid	vcopy(u_long, u_long, u_long *, size_t);
831.4Sthorpejvoid	vzero(u_long, u_long *, size_t);
841.1Sthorpej
851.1Sthorpej#endif
861.2Ssimonb#endif /* ! _HP300_LOADFILE_MACHDEP_H_ */
87