xref: /netbsd/sys/arch/hppa/include/som.h (revision c4a72b64)
1 /*	$NetBSD: som.h,v 1.1 2002/06/05 01:04:23 fredette Exp $	*/
2 
3 /*	$OpenBSD: som.h,v 1.3 1999/12/23 04:09:44 mickey Exp $	*/
4 
5 /*
6  * Copyright (c) 1998 Michael Shalayeff
7  * All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions
11  * are met:
12  * 1. Redistributions of source code must retain the above copyright
13  *    notice, this list of conditions and the following disclaimer.
14  * 2. Redistributions in binary form must reproduce the above copyright
15  *    notice, this list of conditions and the following disclaimer in the
16  *    documentation and/or other materials provided with the distribution.
17  * 3. All advertising materials mentioning features or use of this software
18  *    must display the following acknowledgement:
19  *	This product includes software developed by Michael Shalayeff.
20  * 4. The name of the author may not be used to endorse or promote products
21  *    derived from this software without specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
24  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
25  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
26  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
27  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
28  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
32  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33  */
34 
35 #ifndef	_HPPA_SOM_H_
36 #define	_HPPA_SOM_H_
37 
38 /* system_id */
39 #define	SOM_BSD		800
40 #define	SOM_PA10	0x20b
41 #define	SOM_PA11	0x210
42 #define	SOM_PA12	0x211
43 #define	SOM_PA20	0x214
44 
45 /* a_magic */
46 #define	SOM_MAGIC	0x107
47 #define	SOM_SHARED	0x108
48 #define	SOM_DEMAND	0x10B
49 
50 #define	SOM_BADMAGIC(fh) \
51 	((fh)->system_id != SOM_PA10 && \
52 	 (fh)->system_id != SOM_PA11 && \
53 	 (fh)->system_id != SOM_PA12 && \
54 	 (fh)->system_id != SOM_PA20)
55 
56 struct som_filehdr {
57 	u_short system_id;
58 	u_short a_magic;
59 	u_int   version_id;
60 	u_int	time_secs;		/* sys time (zero if unused) */
61 	u_int	time_nsecs;
62 	u_int	ep_space;		/* ep space */
63 	u_int	ep_subspace;
64 	u_int	entry;			/* how is it different from a_entry? */
65 	u_int	aux_loc;		/* aux header location */
66 	u_int	aux_size;
67 	u_int	som_length;		/* entire image length */
68 	u_int	dp;			/* dp presumed at compilation time */
69 	u_int	space_loc;		/* space dictionary location */
70 	u_int	space_total;		/* N of entries in the space dict */
71 	u_int	subspace_loc;		/* subspace dict location */
72 	u_int	subspace_total;		/* N of entries in the subspace dict */
73 	u_int	ld_fixup_loc;		/* space ref array (relocs?) */
74 	u_int	ld_fixup_total;		/* N of space ref records */
75 	u_int	space_str_loc;		/* {,sub}space string table location */
76 	u_int	space_str_size;		/* size of the above */
77 	u_int	init_loc;		/* init ptrs location */
78 	u_int	init_total;		/* N of entries in the above */
79 	u_int	dict_loc;		/* module dictionary location */
80 	u_int	dict_total;		/* number of modules */
81 	u_int	sym_loc;		/* symbol table location */
82 	u_int	sym_total;		/* N of symbols */
83 	u_int	fixup_loc;		/* fixpup reqs location */
84 	u_int	fixup_total;		/* N of the fixup reqs */
85 	u_int	strings_loc;		/* string table location */
86 	u_int	strings_size;		/* size of the strings table */
87 	u_int	unloadable_loc;		/* unloadable spaces location */
88 	u_int	unloadable_size;	/* size of the unloadable spaces */
89 	u_int	checksum;		/* header checksum? */
90 };
91 
92 struct som_exec_aux {
93 	u_int	mandatory : 1;
94 	u_int	copy : 1;
95 	u_int	append : 1;
96 	u_int	ignore : 1;
97 	u_int	reserved : 12;
98 	u_int	type : 16;
99 	u_int	length;
100 	long	a_tsize;
101 	long	a_tmem;
102 	long	a_tfile;
103 	long	a_dsize;
104 	long	a_dmem;
105 	long	a_dfile;
106 	long	a_bsize;
107 	long	a_entry;
108 	long	a_flags;
109 	long	a_bfill;
110 };
111 
112 struct som_sym {
113 	u_int	sym_type : 8;
114 	u_int	sym_scope : 4;
115 	u_int	sym_chklevel : 3;
116 	u_int	sym_qualify : 1;
117 	u_int	sym_ifrozen : 1;
118 	u_int	sym_resident : 1;
119 	u_int	sym_is_common : 1;
120 	u_int	sym_dup_common : 1;
121 	u_int	sym_xleast : 2;
122 	u_int	sym_arg_reloc : 10;
123 	union {
124 		char *n_name;
125 		u_int n_strx;
126 	} sym_name, sym_qualifier_name;
127 	u_int	sym_info;
128 	u_int	sym_value;
129 
130 };
131 
132 /* sym_type */
133 #define	SOM_ST_NULL		0
134 #define	SOM_ST_ABS		1
135 #define	SOM_ST_DATA		2
136 #define	SOM_ST_CODE		3
137 #define	SOM_ST_PRI_PROG		4
138 #define	SOM_ST_SEC_PROG		5
139 #define	SOM_ST_ENTRY		6
140 #define	SOM_ST_STORAGE		7
141 #define	SOM_ST_STUB		8
142 #define	SOM_ST_MODULE		9
143 #define	SOM_ST_SYM_EXT		10
144 #define	SOM_ST_ARG_EXT		11
145 #define	SOM_ST_MILLICODE	12
146 #define	SOM_ST_PLABEL		13
147 
148 /* sym_scope */
149 #define	SOM_SS_UNSAT		0
150 #define	SOM_SS_EXTERNAL		1
151 #define	SOM_SS_GLOBAL		2
152 #define	SOM_SS_UNIVERSAL	3
153 
154 #endif /* _HPPA_SOM_H_ */
155