source: trunk/libs/newlib/src/include/os9k.h @ 478

Last change on this file since 478 was 444, checked in by satin@…, 6 years ago

add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc

File size: 5.9 KB
Line 
1/* os9k.h  -  OS-9000 i386 module header definitions
2   Copyright 2000 Free Software Foundation, Inc.
3
4This file is part of GNU CC.
5   
6GNU CC is free software; you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation; either version 2, or (at your option)
9any later version.
10
11GNU CC is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with GNU CC; see the file COPYING.  If not, write to
18the Free Software Foundation, 51 Franklin Street - Fifth Floor,
19Boston, MA 02110-1301, USA.  */
20
21#if !defined(_MODULE_H)
22#define _MODULE_H
23
24#define _MPF386
25
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
30
31#ifdef _MPF68K
32#define MODSYNC 0x4afc          /* Module header sync code for 680x0 processors.  */
33#endif
34
35#ifdef _MPF386
36#define MODSYNC 0x4afc          /* Module header sync code for 80386 processors.  */
37#endif
38
39#define MODREV  1               /* Module format revision 1.  */
40#define CRCCON  0x800063        /* CRC polynomial constant.  */
41
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
57
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
70
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
79
80#define mktypelang(type, lang)  (((type) << 8) | (lang))
81
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
88
89#define mkattrevs(attr, revs)   (((attr) << 8) | (revs))
90
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
94
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)
104
105typedef struct mh_com
106{
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;
132
133/* Executable memory module.  */
134typedef mh_com *Mh_exec,mh_exec;
135
136/* Data memory module.  */
137typedef mh_com *Mh_data,mh_data;
138
139/* File manager memory module.  */
140typedef mh_com *Mh_fman,mh_fman;
141
142/* Device driver module.  */
143typedef mh_com *Mh_drvr,mh_drvr;
144
145/* Trap handler module.  */
146typedef mh_com mh_trap, *Mh_trap;
147
148/* Device descriptor module.  */
149typedef mh_com *Mh_dev,mh_dev;
150
151/* Configuration module.  */
152typedef mh_com *Mh_config, mh_config;
153
154#if 0 
155
156#if !defined(_MODDIR_H)
157/* Go get _os_fmod (and others).  */
158#include <moddir.h>
159#endif
160
161error_code _os_crc (void *, u_int32, int *);
162error_code _os_datmod (char *, u_int32, u_int16 *, u_int16 *, u_int32, void **, mh_data **);
163error_code _os_get_moddir (void *, u_int32 *);
164error_code _os_initdata (mh_com *, void *);
165error_code _os_link (char **, mh_com **, void **, u_int16 *, u_int16 *);
166error_code _os_linkm (mh_com *, void **, u_int16 *, u_int16 *);
167error_code _os_load (char *, mh_com **, void **, u_int32, u_int16 *, u_int16 *, u_int32);
168error_code _os_mkmodule (char *, u_int32, u_int16 *, u_int16 *, u_int32, void **, mh_com **, u_int32);
169error_code _os_modaddr (void *, mh_com **);
170error_code _os_setcrc (mh_com *);
171error_code _os_slink (u_int32, char *, void **, void **, mh_com **);
172error_code _os_slinkm (u_int32, mh_com *, void **, void **);
173error_code _os_unlink (mh_com *);
174error_code _os_unload (char *, u_int32);
175error_code _os_tlink (u_int32, char *, void **, mh_trap **, void *, u_int32);
176error_code _os_tlinkm (u_int32, mh_com *, void **, void *, u_int32);
177error_code _os_iodel (mh_com *);
178error_code _os_vmodul (mh_com *, mh_com *, u_int32);
179#endif /* 0 */
180
181#endif
Note: See TracBrowser for help on using the repository browser.