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