| 1 | /* $Id: krnlImportTable.h,v 1.2 2002-12-16 02:25:07 bird Exp $
|
|---|
| 2 | *
|
|---|
| 3 | * krnlImportTable definitions.
|
|---|
| 4 | *
|
|---|
| 5 | * Copyright (c) 1998-2003 knut st. osmundsen <bird@anduin.net>
|
|---|
| 6 | *
|
|---|
| 7 | *
|
|---|
| 8 | * This file is part of kKrnlLib.
|
|---|
| 9 | *
|
|---|
| 10 | * kKrnlLib is free software; you can redistribute it and/or modify
|
|---|
| 11 | * it under the terms of the GNU General Public License as published by
|
|---|
| 12 | * the Free Software Foundation; either version 2 of the License, or
|
|---|
| 13 | * (at your option) any later version.
|
|---|
| 14 | *
|
|---|
| 15 | * kKrnlLib is distributed in the hope that it will be useful,
|
|---|
| 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|---|
| 18 | * GNU General Public License for more details.
|
|---|
| 19 | *
|
|---|
| 20 | * You should have received a copy of the GNU General Public License
|
|---|
| 21 | * along with kKrnlLib; if not, write to the Free Software
|
|---|
| 22 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|---|
| 23 | *
|
|---|
| 24 | */
|
|---|
| 25 |
|
|---|
| 26 | #ifndef __krnlImportTable_h__
|
|---|
| 27 | #define __krnlImportTable_h__
|
|---|
| 28 |
|
|---|
| 29 | /*******************************************************************************
|
|---|
| 30 | * Defined Constants And Macros *
|
|---|
| 31 | *******************************************************************************/
|
|---|
| 32 | #define NBR_OF_KRNLIMPORTS 114 /* When this is changed make sure to */
|
|---|
| 33 | /* update the aImportTab in probkrnl.c */
|
|---|
| 34 | /* and make test faker in test.h and */
|
|---|
| 35 | /* the appropriate fake.c or fakea.asm.*/
|
|---|
| 36 | #define MAX_LENGTH_NAME 32 /* Max length for the function. */
|
|---|
| 37 |
|
|---|
| 38 | /* Entry-Point Type flag */
|
|---|
| 39 | #define EPT_PROC 0x00 /* procedure - overload procedure */
|
|---|
| 40 | #define EPT_PROCH 0x01 /* procedure hybrid (import only) */
|
|---|
| 41 | #define EPT_VAR 0x02 /* variable/non-procedure */
|
|---|
| 42 | #define EPT_NOT_REQ 0x08 /* Not required flag. */
|
|---|
| 43 | #define EPTNotReq(a) (((a).fType & (EPT_NOT_REQ)) == EPT_NOT_REQ)
|
|---|
| 44 | #define EPT_WRAPPED 0x40 /* Wrapped due - differs between builds */
|
|---|
| 45 | #define EPTWrapped(a) (((a).fType & (EPT_WRAPPED)) == EPT_WRAPPED)
|
|---|
| 46 | #define EPT_32BIT 0x00 /* 32 bit entry-point */
|
|---|
| 47 | #define EPT_16BIT 0x80 /* 16 bit entry-point */
|
|---|
| 48 | #define EPT_BIT_MASK 0x80 /* Mask bit entry-point */
|
|---|
| 49 | #define EPT16BitEntry(a) (((a).fType & EPT_BIT_MASK) == EPT_16BIT)
|
|---|
| 50 | #define EPT32BitEntry(a) (((a).fType & EPT_BIT_MASK) == EPT_32BIT)
|
|---|
| 51 | #define EPTProc(a) (((a).fType & ~(EPT_BIT_MASK | EPT_WRAPPED | EPT_NOT_REQ)) == EPT_PROC)
|
|---|
| 52 | #define EPTProcHybrid(a) (((a).fType & ~(EPT_BIT_MASK | EPT_WRAPPED | EPT_NOT_REQ)) == EPT_PROCH)
|
|---|
| 53 | #define EPTVar(a) (((a).fType & ~(EPT_BIT_MASK | EPT_NOT_REQ)) == EPT_VAR)
|
|---|
| 54 |
|
|---|
| 55 | /* 32bit types */
|
|---|
| 56 | #define EPT_PROC32 (EPT_PROC | EPT_32BIT)
|
|---|
| 57 | #define EPT_PROCNR32 (EPT_PROC | EPT_32BIT | EPT_NOT_REQ)
|
|---|
| 58 | #define EPT_VAR32 (EPT_VAR | EPT_32BIT)
|
|---|
| 59 | #define EPT_VARNR32 (EPT_VAR | EPT_32BIT | EPT_NOT_REQ)
|
|---|
| 60 | #define EPT32Proc(a) (((a).fType & ~(EPT_WRAPPED)) == EPT_PROC32)
|
|---|
| 61 | #define EPT32ProcNR(a) (((a).fType & ~(EPT_WRAPPED)) == EPT_PROCNR32)
|
|---|
| 62 | #define EPT32Var(a) (((a).fType & ~(EPT_WRAPPED)) == EPT_VAR32)
|
|---|
| 63 | #define EPT32VarNR(a) (((a).fType & ~(EPT_WRAPPED)) == EPT_VARNR32)
|
|---|
| 64 |
|
|---|
| 65 | /* 16bit types */
|
|---|
| 66 | #define EPT_PROC16 (EPT_PROC | EPT_16BIT)
|
|---|
| 67 | #define EPT_PROCNR16 (EPT_PROC | EPT_16BIT | EPT_NOT_REQ)
|
|---|
| 68 | #define EPT_PROCH16 (EPT_PROCH | EPT_16BIT) /* far proc in 16-bit calltab with a far jmp. */
|
|---|
| 69 | #define EPT_PROCHNR16 (EPT_PROCH | EPT_16BIT | EPT_NOT_REQ)
|
|---|
| 70 | #define EPT_VAR16 (EPT_VAR | EPT_16BIT)
|
|---|
| 71 | #define EPT_VARNR16 (EPT_VAR | EPT_16BIT | EPT_NOT_REQ)
|
|---|
| 72 | #define EPT16Proc(a) (((a).fType & ~(EPT_WRAPPED)) == EPT_PROC16)
|
|---|
| 73 | #define EPT16ProcNR(a) (((a).fType & ~(EPT_WRAPPED)) == EPT_PROCNR16)
|
|---|
| 74 | #define EPT16ProcH(a) (((a).fType & ~(EPT_WRAPPED)) == EPT_PROCH16)
|
|---|
| 75 | #define EPT16ProcHNR(a) (((a).fType & ~(EPT_WRAPPED)) == EPT_PROCHNR16)
|
|---|
| 76 | #define EPT16Var(a) (((a).fType & ~(EPT_WRAPPED)) == EPT_VAR16)
|
|---|
| 77 | #define EPT16VarNR(a) (((a).fType & ~(EPT_WRAPPED)) == EPT_VARNR16)
|
|---|
| 78 |
|
|---|
| 79 |
|
|---|
| 80 | /* Kernel type: SMP/UNI/W4 (flags matches KF_* in options.h) */
|
|---|
| 81 | #if 0
|
|---|
| 82 | #define TYPE_UNI 0x00 /* Any UNI processor kernel except Warp 4 fp13 and above. */
|
|---|
| 83 | #define TYPE_SMP 0x01 /* SMP Warp3 Adv. or Warp 4.5 SMP */
|
|---|
| 84 | #define TYPE_W4 0x02 /* Warp4 fp13 and above. */
|
|---|
| 85 | #endif
|
|---|
| 86 |
|
|---|
| 87 |
|
|---|
| 88 | /*
|
|---|
| 89 | * Calltab entry sizes.
|
|---|
| 90 | */
|
|---|
| 91 | #define OVERLOAD16_ENTRY 0x18 /* This is intentionally 4 bytes larger than the one defined in calltaba.asm. */
|
|---|
| 92 | #define OVERLOAD32_ENTRY 0x14
|
|---|
| 93 | #define IMPORTH16_ENTRY 0x08
|
|---|
| 94 | #define VARIMPORT_ENTRY 0x10
|
|---|
| 95 |
|
|---|
| 96 |
|
|---|
| 97 | /*
|
|---|
| 98 | * Opcode.
|
|---|
| 99 | */
|
|---|
| 100 | #define OPCODE_IGNORE 0 /* chOpcode value. */
|
|---|
| 101 |
|
|---|
| 102 |
|
|---|
| 103 | /*
|
|---|
| 104 | * Fixup stuff.
|
|---|
| 105 | */
|
|---|
| 106 | /* entry tab types*/
|
|---|
| 107 | #define EXP_ABSOLUTE16 1
|
|---|
| 108 | #define EXP_ABSOLUTE32 2
|
|---|
| 109 | #define EXP_32 3
|
|---|
| 110 | #define EXP_16 4
|
|---|
| 111 | /* import tab types */
|
|---|
| 112 | #define EXP_IMPORT_FIRST EXP_PROC32
|
|---|
| 113 | #define EXP_PROC32 5
|
|---|
| 114 | #define EXP_VAR32 6
|
|---|
| 115 | #define EXP_VAR16 7
|
|---|
| 116 | #define EXP_PROC16 8
|
|---|
| 117 | #define EXP_ORGPROC32 9
|
|---|
| 118 | #define EXP_ORGPROC16 10
|
|---|
| 119 |
|
|---|
| 120 |
|
|---|
| 121 | /*******************************************************************************
|
|---|
| 122 | * Structures and Typedefs *
|
|---|
| 123 | *******************************************************************************/
|
|---|
| 124 | #pragma pack(1)
|
|---|
| 125 | typedef struct _IMPORTKRNLSYM
|
|---|
| 126 | {
|
|---|
| 127 | signed short int iOrdinal; /* The ordinal for this entry. (Count two ordinals for proc imports.) */
|
|---|
| 128 | unsigned char fFound; /* This is set when name is found */
|
|---|
| 129 | unsigned char iObject; /* Object number the name was found in */
|
|---|
| 130 | unsigned short int cchName; /* Length of the name (optmize search) (INPUT) */
|
|---|
| 131 | unsigned char achName[MAX_LENGTH_NAME]; /* Name (INPUT) */
|
|---|
| 132 | unsigned char achExtra[4]; /* Parameter extra. */
|
|---|
| 133 | unsigned long int offObject; /* Offset into the object */
|
|---|
| 134 | unsigned long int ulAddress; /* 32-bit flat address */
|
|---|
| 135 | unsigned short int usSel; /* Select of the object */
|
|---|
| 136 | unsigned char cbProlog; /* Size of the prolog needing to be exchanged */
|
|---|
| 137 | unsigned char chOpcode; /* The opcode of the function. 0 if not known. */
|
|---|
| 138 | unsigned char fType; /* Entry-Point Type Flags */
|
|---|
| 139 | } IMPORTKRNLSYM, *PIMPORTKRNLSYM;
|
|---|
| 140 | #pragma pack()
|
|---|
| 141 |
|
|---|
| 142 |
|
|---|
| 143 | /*
|
|---|
| 144 | * Database of kernel symbols.
|
|---|
| 145 | */
|
|---|
| 146 | #pragma pack(1)
|
|---|
| 147 | typedef struct _KRNLDBENTRY
|
|---|
| 148 | {
|
|---|
| 149 | unsigned short usBuild; /* Build number */
|
|---|
| 150 | unsigned short fKernel; /* Kernel flag (KF_* defines in options.h). */
|
|---|
| 151 | unsigned char cObjects; /* Count of objects */
|
|---|
| 152 | struct
|
|---|
| 153 | {
|
|---|
| 154 | unsigned char iObject; /* Object number. */
|
|---|
| 155 | unsigned char chOpcode; /* The opcode of the function. 0 if not known. */
|
|---|
| 156 | unsigned long offObject; /* offset into object of the symbol. */
|
|---|
| 157 | } aSyms[NBR_OF_KRNLIMPORTS];
|
|---|
| 158 |
|
|---|
| 159 | } KRNLDBENTRY, *PKRNLDBENTRY;
|
|---|
| 160 | #pragma pack()
|
|---|
| 161 |
|
|---|
| 162 |
|
|---|
| 163 |
|
|---|
| 164 | /*******************************************************************************
|
|---|
| 165 | * Global Variables *
|
|---|
| 166 | * NOTE! These are only available at init time! *
|
|---|
| 167 | *******************************************************************************/
|
|---|
| 168 | extern IMPORTKRNLSYM aImportTab[NBR_OF_KRNLIMPORTS]; /* Defined in krnlImportTable.c */
|
|---|
| 169 | extern const KRNLDBENTRY aKrnlSymDB32[]; /* Defined in symdb32.c */
|
|---|
| 170 |
|
|---|
| 171 | #if defined(__IBMC__) || defined(__IBMCPP__)
|
|---|
| 172 | #pragma map( aImportTab , "_aImportTab" )
|
|---|
| 173 | #endif
|
|---|
| 174 |
|
|---|
| 175 | #endif
|
|---|
| 176 |
|
|---|