11.6Sjoerg/*	$NetBSD: loadfile_machdep.h,v 1.6 2014/08/06 21:57:49 joerg Exp $	*/
21.1Smhitch
31.1Smhitch/*-
41.1Smhitch * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
51.1Smhitch * All rights reserved.
61.1Smhitch *
71.1Smhitch * This code is derived from software contributed to The NetBSD Foundation
81.1Smhitch * by Christos Zoulas and Jason R. Thorpe.
91.1Smhitch *
101.1Smhitch * Redistribution and use in source and binary forms, with or without
111.1Smhitch * modification, are permitted provided that the following conditions
121.1Smhitch * are met:
131.1Smhitch * 1. Redistributions of source code must retain the above copyright
141.1Smhitch *    notice, this list of conditions and the following disclaimer.
151.1Smhitch * 2. Redistributions in binary form must reproduce the above copyright
161.1Smhitch *    notice, this list of conditions and the following disclaimer in the
171.1Smhitch *    documentation and/or other materials provided with the distribution.
181.1Smhitch *
191.1Smhitch * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
201.1Smhitch * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
211.1Smhitch * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
221.1Smhitch * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
231.1Smhitch * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
241.1Smhitch * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
251.1Smhitch * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
261.1Smhitch * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
271.1Smhitch * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
281.1Smhitch * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
291.1Smhitch * POSSIBILITY OF SUCH DAMAGE.
301.1Smhitch */
311.1Smhitch
321.1Smhitch#ifndef _AMIGA_LOADFILE_MACHDEP_H_
331.1Smhitch#define	_AMIGA_LOADFILE_MACHDEP_H_
341.1Smhitch
351.1Smhitch#define	BOOT_AOUT
361.2Sthorpej#define	BOOT_ELF32
371.1Smhitch
381.1Smhitch#define	LOAD_KERNEL		LOAD_ALL
391.1Smhitch#define	COUNT_KERNEL		COUNT_ALL
401.1Smhitch
411.1Smhitch#ifdef _STANDALONE
421.1Smhitch
431.1Smhitch#define LOADADDR(a)		((a) + offset)
441.1Smhitch#define ALIGNENTRY(a)		0
451.1Smhitch#define READ(f, b, c)		pread((f), (void *)LOADADDR(b), (c))
461.1Smhitch#define BCOPY(s, d, c)		vpbcopy((s), (void *)LOADADDR(d), (c))
471.1Smhitch#define BZERO(d, c)		pbzero((void *)LOADADDR(d), (c))
481.6Sjoerg#define	WARN(a)			do { \
491.6Sjoerg					(void)printf a; \
501.6Sjoerg					if (errno) \
511.6Sjoerg						(void)printf(": %s\n", \
521.6Sjoerg						             strerror(errno)); \
531.6Sjoerg					else \
541.6Sjoerg						(void)printf("\n"); \
551.6Sjoerg				} while(/* CONSTCOND */0)
561.1Smhitch#define PROGRESS(a)		(void) printf a
571.1Smhitch#define ALLOC(a)		alloc(a)
581.3Schristos#define DEALLOC(a, b)		dealloc(a, b)
591.1Smhitch#define OKMAGIC(a)		((a) == OMAGIC || (a) == NMAGIC ||	\
601.1Smhitch				 (a) == ZMAGIC)
611.1Smhitch
621.1Smhitch#define	vpbcopy bcopy
631.1Smhitch#define	pbzero  bzero
641.1Smhitch#define pread   read
651.1Smhitch
661.1Smhitch#else
671.1Smhitch
681.1Smhitch#define LOADADDR(a)		(((u_long)(a)) + offset)
691.1Smhitch#define ALIGNENTRY(a)		((u_long)(a))
701.1Smhitch#define READ(f, b, c)		read((f), (void *)LOADADDR(b), (c))
711.1Smhitch#define BCOPY(s, d, c)		memcpy((void *)LOADADDR(d), (void *)(s), (c))
721.1Smhitch#define BZERO(d, c)		memset((void *)LOADADDR(d), 0, (c))
731.1Smhitch#define WARN(a)			warn a
741.1Smhitch#define PROGRESS(a)		/* nothing */
751.1Smhitch#define ALLOC(a)		malloc(a)
761.3Schristos#define DEALLOC(a, b)		free(a)
771.1Smhitch#define OKMAGIC(a)		((a) == OMAGIC)
781.1Smhitch
791.5Sdslssize_t vread(int, u_long, u_long *, size_t);
801.5Sdslvoid vcopy(u_long, u_long, u_long *, size_t);
811.5Sdslvoid vzero(u_long, u_long *, size_t);
821.1Smhitch
831.1Smhitch#endif
841.1Smhitch#endif /* ! _AMIGA_LOADFILE_MACHDEP_H_ */
85