1 #if !defined(_MODULE_H)
4 /* OS-9000 i386 module header definitions */
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];
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
20 #define MODSYNC 0x4afd /* module header sync code for 680x0 processors */
24 #define MODSYNC 0x4afc /* module header sync code for 80386 processors */
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 */
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
66 #define ML_MASK 0x00ff
68 #define mktypelang(type,lang) (((type)<<8)|(lang))
70 /* Module Attribute values */
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)
90 /* These don't appear to be used. */
91 typedef struct mh_com
{
93 m_sync
, /* sync bytes ($4afc) */
94 m_sysrev
; /* system revision check value */
96 m_size
; /* module size */
98 m_owner
; /* group/user id */
100 m_name
; /* offset to module name */
102 m_access
, /* access permissions */
103 m_tylan
, /* type/lang */
104 m_attrev
, /* rev/attr */
105 m_edit
; /* edition */
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 */
119 m_ident
; /* ident code for ident program */
121 m_spare
[8]; /* reserved bytes */
123 m_parity
; /* header parity */
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
;
151 #if !defined(_MODDIR_H)
152 /* go get _os_fmod (and others) */
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
);