Back to index

cell-binutils  2.17cvs20070401
os9k.h
Go to the documentation of this file.
00001 /* os9k.h  -  OS-9000 i386 module header definitions
00002    Copyright 2000 Free Software Foundation, Inc.
00003 
00004 This file is part of GNU CC.
00005    
00006 GNU CC is free software; you can redistribute it and/or modify
00007 it under the terms of the GNU General Public License as published by
00008 the Free Software Foundation; either version 2, or (at your option)
00009 any later version.
00010 
00011 GNU CC is distributed in the hope that it will be useful,
00012 but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 GNU General Public License for more details.
00015 
00016 You should have received a copy of the GNU General Public License
00017 along with GNU CC; see the file COPYING.  If not, write to
00018 the Free Software Foundation, 51 Franklin Street - Fifth Floor,
00019 Boston, MA 02110-1301, USA.  */
00020 
00021 #if !defined(_MODULE_H)
00022 #define _MODULE_H
00023 
00024 #define _MPF386
00025 
00026 /* Size of common header less parity field.  */
00027 #define N_M_PARITY  (sizeof(mh_com)-sizeof(unisgned short))
00028 #define OLD_M_PARITY 46
00029 #define M_PARITY N_M_PARITY
00030 
00031 #ifdef _MPF68K
00032 #define MODSYNC 0x4afc             /* Module header sync code for 680x0 processors.  */
00033 #endif
00034 
00035 #ifdef _MPF386
00036 #define MODSYNC 0x4afc             /* Module header sync code for 80386 processors.  */
00037 #endif
00038 
00039 #define MODREV       1             /* Module format revision 1.  */
00040 #define CRCCON       0x800063      /* CRC polynomial constant.  */
00041 
00042 /* Module access permission values.  */
00043 #define MP_OWNER_READ       0x0001
00044 #define MP_OWNER_WRITE      0x0002
00045 #define MP_OWNER_EXEC       0x0004
00046 #define MP_GROUP_READ       0x0010
00047 #define MP_GROUP_WRITE      0x0020
00048 #define MP_GROUP_EXEC       0x0040
00049 #define MP_WORLD_READ       0x0100
00050 #define MP_WORLD_WRITE      0x0200
00051 #define MP_WORLD_EXEC       0x0400
00052 #define MP_WORLD_ACCESS     0x0777
00053 #define MP_OWNER_MASK       0x000f
00054 #define MP_GROUP_MASK       0x00f0
00055 #define MP_WORLD_MASK       0x0f00
00056 #define MP_SYSTM_MASK       0xf000
00057 
00058 /* Module Type/Language values.  */
00059 #define MT_ANY              0
00060 #define MT_PROGRAM   0x0001
00061 #define MT_SUBROUT   0x0002
00062 #define MT_MULTI     0x0003
00063 #define MT_DATA             0x0004
00064 #define MT_TRAPLIB   0x000b
00065 #define MT_SYSTEM    0x000c
00066 #define MT_FILEMAN   0x000d
00067 #define MT_DEVDRVR   0x000e 
00068 #define MT_DEVDESC   0x000f
00069 #define MT_MASK             0xff00
00070 
00071 #define ML_ANY              0
00072 #define ML_OBJECT    1
00073 #define ML_ICODE     2
00074 #define ML_PCODE     3
00075 #define ML_CCODE     4
00076 #define ML_CBLCODE   5
00077 #define ML_FRTNCODE  6
00078 #define ML_MASK             0x00ff
00079 
00080 #define mktypelang(type, lang)     (((type) << 8) | (lang))
00081 
00082 /* Module Attribute values.  */
00083 #define MA_REENT     0x80
00084 #define MA_GHOST     0x40
00085 #define MA_SUPER     0x20
00086 #define MA_MASK             0xff00
00087 #define MR_MASK             0x00ff
00088 
00089 #define mkattrevs(attr, revs)      (((attr) << 8) | (revs))
00090 
00091 #define m_user              m_owner.grp_usr.usr
00092 #define m_group      m_owner.grp_usr.grp
00093 #define m_group_user m_owner.group_user
00094 
00095 /* Macro definitions for accessing module header fields.  */
00096 #define MODNAME(mod) ((u_char*)((u_char*)mod + ((Mh_com)mod)->m_name))
00097 #if 0
00098 /* Appears not to be used, and the u_int32 typedef is gone (because it
00099    conflicted with a Mach header.  */
00100 #define MODSIZE(mod) ((u_int32)((Mh_com)mod)->m_size)
00101 #endif /* 0 */
00102 #define MHCOM_BYTES_SIZE 80
00103 #define N_BADMAG(a) (((a).a_info) != MODSYNC)
00104 
00105 typedef struct mh_com
00106 {
00107   /* Sync bytes ($4afc).  */
00108   unsigned char m_sync[2];
00109   unsigned char m_sysrev[2];       /* System revision check value.  */
00110   unsigned char m_size[4];  /* Module size.  */
00111   unsigned char m_owner[4]; /* Group/user id.  */
00112   unsigned char m_name[4];  /* Offset to module name.  */
00113   unsigned char m_access[2];       /* Access permissions.  */
00114   unsigned char m_tylan[2]; /* Type/lang.  */
00115   unsigned char m_attrev[2];       /* Rev/attr.  */
00116   unsigned char m_edit[2];  /* Edition.  */
00117   unsigned char m_needs[4]; /* Module hardware requirements flags. (reserved).  */
00118   unsigned char m_usage[4]; /* Comment string offset.  */
00119   unsigned char m_symbol[4];       /* Symbol table offset.  */
00120   unsigned char m_exec[4];  /* Offset to execution entry point.  */
00121   unsigned char m_excpt[4]; /* Offset to exception entry point.  */
00122   unsigned char m_data[4];  /* Data storage requirement.  */
00123   unsigned char m_stack[4]; /* Stack size.  */
00124   unsigned char m_idata[4]; /* Offset to initialized data.  */
00125   unsigned char m_idref[4]; /* Offset to data reference lists.  */
00126   unsigned char m_init[4];  /* Initialization routine offset.  */
00127   unsigned char m_term[4];  /* Termination routine offset.  */
00128   unsigned char m_ident[2]; /* Ident code for ident program.  */
00129   char          m_spare[8]; /* Reserved bytes.  */
00130   unsigned char m_parity[2];       /* Header parity.  */
00131 } mh_com,*Mh_com;
00132 
00133 /* Executable memory module.  */
00134 typedef mh_com *Mh_exec,mh_exec;
00135 
00136 /* Data memory module.  */
00137 typedef mh_com *Mh_data,mh_data;
00138 
00139 /* File manager memory module.  */
00140 typedef mh_com *Mh_fman,mh_fman;
00141 
00142 /* Device driver module.  */
00143 typedef mh_com *Mh_drvr,mh_drvr;
00144 
00145 /* Trap handler module.  */
00146 typedef       mh_com mh_trap, *Mh_trap;
00147 
00148 /* Device descriptor module.  */
00149 typedef       mh_com *Mh_dev,mh_dev;
00150 
00151 /* Configuration module.  */
00152 typedef mh_com *Mh_config, mh_config;
00153 
00154 #if 0 
00155 
00156 #if !defined(_MODDIR_H)
00157 /* Go get _os_fmod (and others).  */
00158 #include <moddir.h>
00159 #endif
00160 
00161 error_code _os_crc (void *, u_int32, int *);
00162 error_code _os_datmod (char *, u_int32, u_int16 *, u_int16 *, u_int32, void **, mh_data **);
00163 error_code _os_get_moddir (void *, u_int32 *);
00164 error_code _os_initdata (mh_com *, void *);
00165 error_code _os_link (char **, mh_com **, void **, u_int16 *, u_int16 *);
00166 error_code _os_linkm (mh_com *, void **, u_int16 *, u_int16 *);
00167 error_code _os_load (char *, mh_com **, void **, u_int32, u_int16 *, u_int16 *, u_int32);
00168 error_code _os_mkmodule (char *, u_int32, u_int16 *, u_int16 *, u_int32, void **, mh_com **, u_int32);
00169 error_code _os_modaddr (void *, mh_com **);
00170 error_code _os_setcrc (mh_com *);
00171 error_code _os_slink (u_int32, char *, void **, void **, mh_com **);
00172 error_code _os_slinkm (u_int32, mh_com *, void **, void **);
00173 error_code _os_unlink (mh_com *);
00174 error_code _os_unload (char *, u_int32);
00175 error_code _os_tlink (u_int32, char *, void **, mh_trap **, void *, u_int32);
00176 error_code _os_tlinkm (u_int32, mh_com *, void **, void *, u_int32);
00177 error_code _os_iodel (mh_com *);
00178 error_code _os_vmodul (mh_com *, mh_com *, u_int32);
00179 #endif /* 0 */
00180 
00181 #endif