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