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