* Fix for endianness bugs in tx39 sio sim.
[binutils-gdb.git] / include / os9k.h
blobe3ea8ff8f6c2119fb980103fd6da3d57e9f1c83b
1 #if !defined(_MODULE_H)
2 #define _MODULE_H
4 /* OS-9000 i386 module header definitions */
5 #define _MPF386
7 #if 0
8 /* These have name conflicts with Mach and don't appear to be used. */
9 typedef unsigned char u_int16[2];
10 typedef unsigned char u_int32[4];
11 typedef unsigned char owner_id[4];
12 #endif
14 /* sizeof common header less parity field */
15 #define N_M_PARITY (sizeof(mh_com)-sizeof(unisgned short))
16 #define OLD_M_PARITY 46
17 #define M_PARITY N_M_PARITY
19 #ifdef _MPF68K
20 #define MODSYNC 0x4afd /* module header sync code for 680x0 processors */
21 #endif
23 #ifdef _MPF386
24 #define MODSYNC 0x4afc /* module header sync code for 80386 processors */
25 #endif
27 #define MODREV 1 /* module format revision 1 */
28 #define CRCCON 0x800fe3 /* crc polynomial constant */
30 /* Module access permission values */
31 #define MP_OWNER_READ 0x0001
32 #define MP_OWNER_WRITE 0x0002
33 #define MP_OWNER_EXEC 0x0004
34 #define MP_GROUP_READ 0x0010
35 #define MP_GROUP_WRITE 0x0020
36 #define MP_GROUP_EXEC 0x0040
37 #define MP_WORLD_READ 0x0100
38 #define MP_WORLD_WRITE 0x0200
39 #define MP_WORLD_EXEC 0x0400
40 #define MP_WORLD_ACCESS 0x0777
41 #define MP_OWNER_MASK 0x000f
42 #define MP_GROUP_MASK 0x00f0
43 #define MP_WORLD_MASK 0x0f00
44 #define MP_SYSTM_MASK 0xf000
46 /* Module Type/Language values */
47 #define MT_ANY 0
48 #define MT_PROGRAM 0x0001
49 #define MT_SUBROUT 0x0002
50 #define MT_MULTI 0x0003
51 #define MT_DATA 0x0004
52 #define MT_TRAPLIB 0x000b
53 #define MT_SYSTEM 0x000c
54 #define MT_FILEMAN 0x000d
55 #define MT_DEVDRVR 0x000e
56 #define MT_DEVDESC 0x000f
57 #define MT_MASK 0xff00
59 #define ML_ANY 0
60 #define ML_OBJECT 1
61 #define ML_ICODE 2
62 #define ML_PCODE 3
63 #define ML_CCODE 4
64 #define ML_CBLCODE 5
65 #define ML_FRTNCODE 6
66 #define ML_MASK 0x00ff
68 #define mktypelang(type,lang) (((type)<<8)|(lang))
70 /* Module Attribute values */
71 #define MA_REENT 0x80
72 #define MA_GHOST 0x40
73 #define MA_SUPER 0x20
74 #define MA_MASK 0xff00
75 #define MR_MASK 0x00ff
77 #define mkattrevs(attr, revs) (((attr)<<8)|(revs))
79 #define m_user m_owner.grp_usr.usr
80 #define m_group m_owner.grp_usr.grp
81 #define m_group_user m_owner.group_user
83 /* macro definitions for accessing module header fields */
84 #define MODNAME(mod) ((u_char*)((u_char*)mod + ((Mh_com)mod)->m_name))
85 #define MODSIZE(mod) ((u_int32)((Mh_com)mod)->m_size)
86 #define MHCOM_BYTES_SIZE 80
87 #define N_BADMAG(a) (((a).a_info) != MODSYNC)
89 #if 0
90 /* These don't appear to be used. */
91 typedef struct mh_com {
92 u_int16
93 m_sync, /* sync bytes ($4afc) */
94 m_sysrev; /* system revision check value */
95 u_int32
96 m_size; /* module size */
97 owner_id
98 m_owner; /* group/user id */
99 u_int32
100 m_name; /* offset to module name */
101 u_int16
102 m_access, /* access permissions */
103 m_tylan, /* type/lang */
104 m_attrev, /* rev/attr */
105 m_edit; /* edition */
106 u_int32
107 m_needs, /* module hardware requirements flags. (reserved) */
108 m_usage, /* comment string offset */
109 m_symbol, /* symbol table offset */
110 m_exec, /* offset to execution entry point */
111 m_excpt, /* offset to exception entry point */
112 m_data, /* data storage requirement */
113 m_stack, /* stack size */
114 m_idata, /* offset to initialized data */
115 m_idref, /* offset to data reference lists */
116 m_init, /* initialization routine offset */
117 m_term; /* termination routine offset */
118 u_int16
119 m_ident; /* ident code for ident program */
120 char
121 m_spare[8]; /* reserved bytes */
122 u_int16
123 m_parity; /* header parity */
124 } mh_com,*Mh_com;
126 /* Executable memory module */
127 typedef mh_com *Mh_exec,mh_exec;
129 /* Data memory module */
130 typedef mh_com *Mh_data,mh_data;
132 /* File manager memory module */
133 typedef mh_com *Mh_fman,mh_fman;
135 /* device driver module */
136 typedef mh_com *Mh_drvr,mh_drvr;
138 /* trap handler module */
139 typedef mh_com mh_trap, *Mh_trap;
141 /* Device descriptor module */
142 typedef mh_com *Mh_dev,mh_dev;
144 /* Configuration module */
145 typedef mh_com *Mh_config, mh_config;
147 #endif
149 #if 0
151 #if !defined(_MODDIR_H)
152 /* go get _os_fmod (and others) */
153 #include <moddir.h>
154 #endif
156 error_code _os_crc(void *, u_int32, int *);
157 error_code _os_datmod(char *, u_int32, u_int16 *, u_int16 *, u_int32, void **, mh_data **);
158 error_code _os_get_moddir(void *, u_int32 *);
159 error_code _os_initdata(mh_com *, void *);
160 error_code _os_link(char **, mh_com **, void **, u_int16 *, u_int16 *);
161 error_code _os_linkm(mh_com *, void **, u_int16 *, u_int16 *);
162 error_code _os_load(char *, mh_com **, void **, u_int32, u_int16 *, u_int16 *, u_int32);
163 error_code _os_mkmodule(char *, u_int32, u_int16 *, u_int16 *, u_int32, void **, mh_com **, u_int32);
164 error_code _os_modaddr(void *, mh_com **);
165 error_code _os_setcrc(mh_com *);
166 error_code _os_slink(u_int32, char *, void **, void **, mh_com **);
167 error_code _os_slinkm(u_int32, mh_com *, void **, void **);
168 error_code _os_unlink(mh_com *);
169 error_code _os_unload(char *, u_int32);
170 error_code _os_tlink(u_int32, char *, void **, mh_trap **, void *, u_int32);
171 error_code _os_tlinkm(u_int32, mh_com *, void **, void *, u_int32);
172 error_code _os_iodel(mh_com *);
173 error_code _os_vmodul(mh_com *, mh_com *, u_int32);
174 #endif /* 0 */
176 #endif