merge from gcc
[binutils.git] / include / os9k.h
blobe8baee17f1f587a839f3d7df8262257a0d552210
1 /* os9k.h - OS-9000 i386 module header definitions
2 Copyright 2000 Free Software Foundation, Inc.
4 This file is part of GNU CC.
6 GNU CC is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
11 GNU CC is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU CC; see the file COPYING. If not, write to
18 the Free Software Foundation, 51 Franklin Street - Fifth Floor,
19 Boston, MA 02110-1301, USA. */
21 #if !defined(_MODULE_H)
22 #define _MODULE_H
24 #define _MPF386
26 /* Size of common header less parity field. */
27 #define N_M_PARITY (sizeof(mh_com)-sizeof(unisgned short))
28 #define OLD_M_PARITY 46
29 #define M_PARITY N_M_PARITY
31 #ifdef _MPF68K
32 #define MODSYNC 0x4afc /* Module header sync code for 680x0 processors. */
33 #endif
35 #ifdef _MPF386
36 #define MODSYNC 0x4afc /* Module header sync code for 80386 processors. */
37 #endif
39 #define MODREV 1 /* Module format revision 1. */
40 #define CRCCON 0x800063 /* CRC polynomial constant. */
42 /* Module access permission values. */
43 #define MP_OWNER_READ 0x0001
44 #define MP_OWNER_WRITE 0x0002
45 #define MP_OWNER_EXEC 0x0004
46 #define MP_GROUP_READ 0x0010
47 #define MP_GROUP_WRITE 0x0020
48 #define MP_GROUP_EXEC 0x0040
49 #define MP_WORLD_READ 0x0100
50 #define MP_WORLD_WRITE 0x0200
51 #define MP_WORLD_EXEC 0x0400
52 #define MP_WORLD_ACCESS 0x0777
53 #define MP_OWNER_MASK 0x000f
54 #define MP_GROUP_MASK 0x00f0
55 #define MP_WORLD_MASK 0x0f00
56 #define MP_SYSTM_MASK 0xf000
58 /* Module Type/Language values. */
59 #define MT_ANY 0
60 #define MT_PROGRAM 0x0001
61 #define MT_SUBROUT 0x0002
62 #define MT_MULTI 0x0003
63 #define MT_DATA 0x0004
64 #define MT_TRAPLIB 0x000b
65 #define MT_SYSTEM 0x000c
66 #define MT_FILEMAN 0x000d
67 #define MT_DEVDRVR 0x000e
68 #define MT_DEVDESC 0x000f
69 #define MT_MASK 0xff00
71 #define ML_ANY 0
72 #define ML_OBJECT 1
73 #define ML_ICODE 2
74 #define ML_PCODE 3
75 #define ML_CCODE 4
76 #define ML_CBLCODE 5
77 #define ML_FRTNCODE 6
78 #define ML_MASK 0x00ff
80 #define mktypelang(type, lang) (((type) << 8) | (lang))
82 /* Module Attribute values. */
83 #define MA_REENT 0x80
84 #define MA_GHOST 0x40
85 #define MA_SUPER 0x20
86 #define MA_MASK 0xff00
87 #define MR_MASK 0x00ff
89 #define mkattrevs(attr, revs) (((attr) << 8) | (revs))
91 #define m_user m_owner.grp_usr.usr
92 #define m_group m_owner.grp_usr.grp
93 #define m_group_user m_owner.group_user
95 /* Macro definitions for accessing module header fields. */
96 #define MODNAME(mod) ((u_char*)((u_char*)mod + ((Mh_com)mod)->m_name))
97 #if 0
98 /* Appears not to be used, and the u_int32 typedef is gone (because it
99 conflicted with a Mach header. */
100 #define MODSIZE(mod) ((u_int32)((Mh_com)mod)->m_size)
101 #endif /* 0 */
102 #define MHCOM_BYTES_SIZE 80
103 #define N_BADMAG(a) (((a).a_info) != MODSYNC)
105 typedef struct mh_com
107 /* Sync bytes ($4afc). */
108 unsigned char m_sync[2];
109 unsigned char m_sysrev[2]; /* System revision check value. */
110 unsigned char m_size[4]; /* Module size. */
111 unsigned char m_owner[4]; /* Group/user id. */
112 unsigned char m_name[4]; /* Offset to module name. */
113 unsigned char m_access[2]; /* Access permissions. */
114 unsigned char m_tylan[2]; /* Type/lang. */
115 unsigned char m_attrev[2]; /* Rev/attr. */
116 unsigned char m_edit[2]; /* Edition. */
117 unsigned char m_needs[4]; /* Module hardware requirements flags. (reserved). */
118 unsigned char m_usage[4]; /* Comment string offset. */
119 unsigned char m_symbol[4]; /* Symbol table offset. */
120 unsigned char m_exec[4]; /* Offset to execution entry point. */
121 unsigned char m_excpt[4]; /* Offset to exception entry point. */
122 unsigned char m_data[4]; /* Data storage requirement. */
123 unsigned char m_stack[4]; /* Stack size. */
124 unsigned char m_idata[4]; /* Offset to initialized data. */
125 unsigned char m_idref[4]; /* Offset to data reference lists. */
126 unsigned char m_init[4]; /* Initialization routine offset. */
127 unsigned char m_term[4]; /* Termination routine offset. */
128 unsigned char m_ident[2]; /* Ident code for ident program. */
129 char m_spare[8]; /* Reserved bytes. */
130 unsigned char m_parity[2]; /* Header parity. */
131 } mh_com,*Mh_com;
133 /* Executable memory module. */
134 typedef mh_com *Mh_exec,mh_exec;
136 /* Data memory module. */
137 typedef mh_com *Mh_data,mh_data;
139 /* File manager memory module. */
140 typedef mh_com *Mh_fman,mh_fman;
142 /* Device driver module. */
143 typedef mh_com *Mh_drvr,mh_drvr;
145 /* Trap handler module. */
146 typedef mh_com mh_trap, *Mh_trap;
148 /* Device descriptor module. */
149 typedef mh_com *Mh_dev,mh_dev;
151 /* Configuration module. */
152 typedef mh_com *Mh_config, mh_config;
154 #if 0
156 #if !defined(_MODDIR_H)
157 /* Go get _os_fmod (and others). */
158 #include <moddir.h>
159 #endif
161 error_code _os_crc (void *, u_int32, int *);
162 error_code _os_datmod (char *, u_int32, u_int16 *, u_int16 *, u_int32, void **, mh_data **);
163 error_code _os_get_moddir (void *, u_int32 *);
164 error_code _os_initdata (mh_com *, void *);
165 error_code _os_link (char **, mh_com **, void **, u_int16 *, u_int16 *);
166 error_code _os_linkm (mh_com *, void **, u_int16 *, u_int16 *);
167 error_code _os_load (char *, mh_com **, void **, u_int32, u_int16 *, u_int16 *, u_int32);
168 error_code _os_mkmodule (char *, u_int32, u_int16 *, u_int16 *, u_int32, void **, mh_com **, u_int32);
169 error_code _os_modaddr (void *, mh_com **);
170 error_code _os_setcrc (mh_com *);
171 error_code _os_slink (u_int32, char *, void **, void **, mh_com **);
172 error_code _os_slinkm (u_int32, mh_com *, void **, void **);
173 error_code _os_unlink (mh_com *);
174 error_code _os_unload (char *, u_int32);
175 error_code _os_tlink (u_int32, char *, void **, mh_trap **, void *, u_int32);
176 error_code _os_tlinkm (u_int32, mh_com *, void **, void *, u_int32);
177 error_code _os_iodel (mh_com *);
178 error_code _os_vmodul (mh_com *, mh_com *, u_int32);
179 #endif /* 0 */
181 #endif