]>
Commit | Line | Data |
---|---|---|
2aa62f2b | 1 | /* $NetBSD: loadfile_machdep.h,v 1.1 2006/04/07 14:21:18 cherry Exp $ */\r |
2 | \r | |
3 | /*-\r | |
4 | * Copyright (c) 1998 The NetBSD Foundation, Inc.\r | |
5 | * All rights reserved.\r | |
6 | *\r | |
7 | * This code is derived from software contributed to The NetBSD Foundation\r | |
8 | * by Christos Zoulas and Ross Harvey.\r | |
9 | *\r | |
10 | * Redistribution and use in source and binary forms, with or without\r | |
11 | * modification, are permitted provided that the following conditions\r | |
12 | * are met:\r | |
13 | * 1. Redistributions of source code must retain the above copyright\r | |
14 | * notice, this list of conditions and the following disclaimer.\r | |
15 | * 2. Redistributions in binary form must reproduce the above copyright\r | |
16 | * notice, this list of conditions and the following disclaimer in the\r | |
17 | * documentation and/or other materials provided with the distribution.\r | |
18 | * 3. All advertising materials mentioning features or use of this software\r | |
19 | * must display the following acknowledgement:\r | |
20 | * This product includes software developed by the NetBSD\r | |
21 | * Foundation, Inc. and its contributors.\r | |
22 | * 4. Neither the name of The NetBSD Foundation nor the names of its\r | |
23 | * contributors may be used to endorse or promote products derived\r | |
24 | * from this software without specific prior written permission.\r | |
25 | *\r | |
26 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS\r | |
27 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED\r | |
28 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\r | |
29 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS\r | |
30 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r | |
31 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r | |
32 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r | |
33 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r | |
34 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r | |
35 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r | |
36 | * POSSIBILITY OF SUCH DAMAGE.\r | |
37 | */\r | |
38 | \r | |
39 | #define BOOT_ELF64\r | |
40 | \r | |
41 | #define LOAD_KERNEL (LOAD_ALL & ~LOAD_TEXTA)\r | |
42 | #define COUNT_KERNEL (COUNT_ALL & ~COUNT_TEXTA)\r | |
43 | \r | |
44 | #ifndef MD_LOADSEG\r | |
45 | /* XXX: Multiple unwind sections are ignored, and the last one found returned... Fixme! */\r | |
46 | extern vaddr_t ia64_unwindtab;\r | |
47 | extern vsize_t ia64_unwindtablen;\r | |
48 | #define MD_LOADSEG(phdr) ((phdr)->p_type == PT_IA_64_UNWIND ? ia64_unwindtab = (phdr)->p_vaddr, ia64_unwindtablen = (phdr)->p_filesz, 1 : 0)\r | |
49 | #endif\r | |
50 | \r | |
51 | #ifdef _STANDALONE\r | |
52 | \r | |
53 | /* XXX: cherry: This whole thing is glue between the NetBSD pread/vpbcopy etc. etc\r | |
54 | * and the FreeBSD kern_pread/bzero etc. etc. Needs to be cleaned up \r | |
55 | * after discussion.\r | |
56 | */\r | |
57 | \r | |
58 | #include "bootstrap.h"\r | |
59 | \r | |
60 | #define LOADADDR(a) ((a) + offset)\r | |
61 | #define ALIGNENTRY(a) Error! alpha supports ECOFF and ELF only! /* Fixme: for ia64 */\r | |
62 | #define READ(f, b, c) pread((f), LOADADDR(b), (c))\r | |
63 | #define BCOPY(s, d, c) vpbcopy((s), LOADADDR(d), (c))\r | |
64 | #define BZERO(d, c) pbzero(LOADADDR(d), (c))\r | |
65 | #define WARN(a) (void)(printf a, \\r | |
66 | printf((errno ? ": %s\n" : "\n"), \\r | |
67 | strerror(errno)))\r | |
68 | #define PROGRESS(a) (void) printf a\r | |
69 | #define ALLOC(a) alloc(a)\r | |
70 | #define DEALLOC(a, b) dealloc(a, b)\r | |
71 | #define OKMAGIC(a) Error! ia64 supports ELF only!\r | |
72 | \r | |
73 | \r | |
74 | /* XXX: defines below glues NetBSD conventions with bootstrap.h. */\r | |
75 | \r | |
76 | #define vpbcopy archsw.arch_copyin\r | |
77 | #define pbzero kern_bzero\r | |
78 | #define pread archsw.arch_readin\r | |
79 | \r | |
80 | #else\r | |
81 | \r | |
82 | #define LOADADDR(a) (((u_long)(a)) + offset)\r | |
83 | #define ALIGNENTRY(a) ((u_long)(a))\r | |
84 | #define READ(f, b, c) read((f), (void *)LOADADDR(b), (c))\r | |
85 | #define BCOPY(s, d, c) memcpy((void *)LOADADDR(d), (void *)(s), (c))\r | |
86 | #define BZERO(d, c) memset((void *)LOADADDR(d), 0, (c))\r | |
87 | #define WARN(a) warn a\r | |
88 | #define PROGRESS(a) /* nothing */\r | |
89 | #define ALLOC(a) malloc(a)\r | |
90 | #define DEALLOC(a, b) free(a)\r | |
91 | #define OKMAGIC(a) ((a) == OMAGIC)\r | |
92 | \r | |
93 | ssize_t vread(int, u_long, u_long *, size_t);\r | |
94 | void vcopy(u_long, u_long, u_long *, size_t);\r | |
95 | void vzero(u_long, u_long *, size_t);\r | |
96 | \r | |
97 | #endif\r |