| 1 | /* $Id: probkrnl.h,v 1.22 2001-07-10 05:22:15 bird Exp $ | 
|---|
| 2 | * | 
|---|
| 3 | * Include file for ProbKrnl. | 
|---|
| 4 | * | 
|---|
| 5 | * Copyright (c) 1998-2000 knut st. osmundsen (knut.stange.osmundsen@mynd.no) | 
|---|
| 6 | * | 
|---|
| 7 | * Project Odin Software License can be found in LICENSE.TXT | 
|---|
| 8 | * | 
|---|
| 9 | */ | 
|---|
| 10 |  | 
|---|
| 11 |  | 
|---|
| 12 | #ifndef _ProbKrnl_h_ | 
|---|
| 13 | #define _ProbKrnl_h_ | 
|---|
| 14 |  | 
|---|
| 15 | /******************************************************************************* | 
|---|
| 16 | *   Defined Constants And Macros                                               * | 
|---|
| 17 | *******************************************************************************/ | 
|---|
| 18 | #define NBR_OF_KRNLIMPORTS      91      /* When this is changed make sure to   */ | 
|---|
| 19 | /* update the aImportTab in probkrnl.c */ | 
|---|
| 20 | /* and make test faker in test.h and   */ | 
|---|
| 21 | /* the appropriate fake.c or fakea.asm.*/ | 
|---|
| 22 | #define MAX_LENGTH_NAME         32      /* Max length for the function. */ | 
|---|
| 23 |  | 
|---|
| 24 | /* Entry-Point Type flag */ | 
|---|
| 25 | #define EPT_PROC                0x00    /* procedure - overload procedure*/ | 
|---|
| 26 | #define EPT_PROCIMPORT          0x01    /* procedure - import only */ | 
|---|
| 27 | #define EPT_PROCIMPORTH         0x02    /* procedure hybrid - import only */ | 
|---|
| 28 | #define EPT_VARIMPORT           0x04    /* variable/non-procedure 32bit */ | 
|---|
| 29 | #define EPT_NOT_REQ             0x08    /* Not required flag. */ | 
|---|
| 30 | #define EPTNotReq(a)            (((a).fType & (EPT_NOT_REQ)) == EPT_NOT_REQ) | 
|---|
| 31 | #define EPT_WRAPPED             0x40    /* Wrapped due - differs between builds */ | 
|---|
| 32 | #define EPTWrapped(a)           (((a).fType & (EPT_WRAPPED)) == EPT_WRAPPED) | 
|---|
| 33 | #define EPT_32BIT               0x00    /* 32 bit entry-point  */ | 
|---|
| 34 | #define EPT_16BIT               0x80    /* 16 bit entry-point */ | 
|---|
| 35 | #define EPT_BIT_MASK            0x80    /* Mask bit entry-point */ | 
|---|
| 36 | #define EPT16BitEntry(a)        (((a).fType & EPT_BIT_MASK) == EPT_16BIT) | 
|---|
| 37 | #define EPT32BitEntry(a)        (((a).fType & EPT_BIT_MASK) == EPT_32BIT) | 
|---|
| 38 | #define EPTProcImportHybrid(a)  (((a).fType & ~(EPT_BIT_MASK | EPT_WRAPPED | EPT_NOT_REQ)) == EPT_PROCIMPORTH) | 
|---|
| 39 |  | 
|---|
| 40 | /* 32bit types */ | 
|---|
| 41 | #define EPT_PROC32              (EPT_PROC | EPT_32BIT) | 
|---|
| 42 | #define EPT_PROCIMPORT32        (EPT_PROCIMPORT | EPT_32BIT) | 
|---|
| 43 | #define EPT_PROCIMPORTNR32      (EPT_PROCIMPORT | EPT_32BIT | EPT_NOT_REQ) | 
|---|
| 44 | #define EPT_VARIMPORT32         (EPT_VARIMPORT | EPT_32BIT) | 
|---|
| 45 | #define EPT_VARIMPORTNR32       (EPT_VARIMPORT | EPT_32BIT | EPT_NOT_REQ) | 
|---|
| 46 | #define EPT32Proc(a)            (((a).fType & ~(EPT_WRAPPED)) == EPT_PROC32) | 
|---|
| 47 | #define EPT32ProcImport(a)      (((a).fType & ~(EPT_WRAPPED)) == EPT_PROCIMPORT32) | 
|---|
| 48 | #define EPT32ProcImportNR(a)    (((a).fType & ~(EPT_WRAPPED)) == EPT_PROCIMPORTNR32) | 
|---|
| 49 | #define EPT32VarImport(a)       (((a).fType & ~(EPT_WRAPPED)) == EPT_VARIMPORT32) | 
|---|
| 50 | #define EPT32VarImportNR(a)     (((a).fType & ~(EPT_WRAPPED)) == EPT_VARIMPORTNR32) | 
|---|
| 51 |  | 
|---|
| 52 | /* 16bit types */ | 
|---|
| 53 | #define EPT_PROC16              (EPT_PROC | EPT_16BIT) | 
|---|
| 54 | #define EPT_PROCIMPORT16        (EPT_PROCIMPORT | EPT_16BIT)  /* far proc in calltab with a far jmp. */ | 
|---|
| 55 | #define EPT_PROCIMPORTNR16      (EPT_PROCIMPORT | EPT_16BIT | EPT_NOT_REQ) | 
|---|
| 56 | #define EPT_PROCIMPORTH16       (EPT_PROCIMPORTH | EPT_16BIT)  /* far proc in 16-bit calltab with a far jmp. */ | 
|---|
| 57 | #define EPT_PROCIMPORTHNR16     (EPT_PROCIMPORTH | EPT_16BIT | EPT_NOT_REQ) | 
|---|
| 58 | #define EPT_VARIMPORT16         (EPT_VARIMPORT | EPT_16BIT) | 
|---|
| 59 | #define EPT_VARIMPORTNR16       (EPT_VARIMPORT | EPT_16BIT | EPT_NOT_REQ) | 
|---|
| 60 | #define EPT16Proc(a)            (((a).fType & ~(EPT_WRAPPED)) == EPT_PROC16) | 
|---|
| 61 | #define EPT16ProcImport(a)      (((a).fType & ~(EPT_WRAPPED)) == EPT_PROCIMPORT16) | 
|---|
| 62 | #define EPT16ProcImportNR(a)    (((a).fType & ~(EPT_WRAPPED)) == EPT_PROCIMPORTNR16) | 
|---|
| 63 | #define EPT16ProcImportH(a)     (((a).fType & ~(EPT_WRAPPED)) == EPT_PROCIMPORTH16) | 
|---|
| 64 | #define EPT16ProcImportHNR(a)   (((a).fType & ~(EPT_WRAPPED)) == EPT_PROCIMPORTHNR16) | 
|---|
| 65 | #define EPT16VarImport(a)       (((a).fType & ~(EPT_WRAPPED)) == EPT_VARIMPORT16) | 
|---|
| 66 | #define EPT16VarImportNR(a)     (((a).fType & ~(EPT_WRAPPED)) == EPT_VARIMPORTNR16) | 
|---|
| 67 |  | 
|---|
| 68 |  | 
|---|
| 69 | /* Kernel type: SMP/UNI/W4 (flags matches KF_* in options.h)  */ | 
|---|
| 70 | #if 0 | 
|---|
| 71 | #define TYPE_UNI                0x00     /* Any UNI processor kernel except Warp 4 fp13 and above. */ | 
|---|
| 72 | #define TYPE_SMP                0x01     /* SMP Warp3 Adv. or Warp 4.5 SMP */ | 
|---|
| 73 | #define TYPE_W4                 0x02     /* Warp4 fp13 and above. */ | 
|---|
| 74 | #endif | 
|---|
| 75 |  | 
|---|
| 76 |  | 
|---|
| 77 | /******************************************************************************* | 
|---|
| 78 | *   Structures and Typedefs                                                    * | 
|---|
| 79 | *******************************************************************************/ | 
|---|
| 80 | #pragma pack(1) | 
|---|
| 81 | typedef struct tagIMPORTKRNLSYM | 
|---|
| 82 | { | 
|---|
| 83 | unsigned char       fFound;          /* This is set when name is found */ | 
|---|
| 84 | unsigned char       iObject;         /* Object number the name was found in*/ | 
|---|
| 85 | unsigned short int  cchName;         /* Length of the name (optmize search) (INPUT) */ | 
|---|
| 86 | unsigned char       achName[MAX_LENGTH_NAME]; /* Name (INPUT) */ | 
|---|
| 87 | unsigned char       achExtra[4];     /* Parameter extra. */ | 
|---|
| 88 | unsigned long  int  offObject;       /* Offset into the object */ | 
|---|
| 89 | unsigned long  int  ulAddress;       /* 32-bit flat address */ | 
|---|
| 90 | unsigned short int  usSel;           /* Select of the object */ | 
|---|
| 91 | unsigned char       cbProlog;        /* Size of the prolog needing to be exchanged */ | 
|---|
| 92 | unsigned char       fType;           /* Entry-Point Type Flags */ | 
|---|
| 93 | } IMPORTKRNLSYM; | 
|---|
| 94 | #pragma pack() | 
|---|
| 95 |  | 
|---|
| 96 |  | 
|---|
| 97 | /* | 
|---|
| 98 | * Database of kernel symbols. | 
|---|
| 99 | */ | 
|---|
| 100 | #pragma pack(1) | 
|---|
| 101 | typedef struct | 
|---|
| 102 | { | 
|---|
| 103 | unsigned short usBuild;             /* Build number */ | 
|---|
| 104 | unsigned short fKernel;             /* Kernel flag (KF_* defines in options.h). */ | 
|---|
| 105 | unsigned char  cObjects;            /* Count of objects */ | 
|---|
| 106 | struct | 
|---|
| 107 | { | 
|---|
| 108 | unsigned char iObject;          /* Object number.  */ | 
|---|
| 109 | unsigned long offObject;        /* offset into object of the symbol. */ | 
|---|
| 110 | } aSyms[NBR_OF_KRNLIMPORTS]; | 
|---|
| 111 |  | 
|---|
| 112 | } KRNLDBENTRY, *PKRNLDBENTRY; | 
|---|
| 113 | #pragma pack() | 
|---|
| 114 |  | 
|---|
| 115 |  | 
|---|
| 116 |  | 
|---|
| 117 | /******************************************************************************* | 
|---|
| 118 | *   Global Variables                                                           * | 
|---|
| 119 | *   NOTE! These are only available at init time!                               * | 
|---|
| 120 | *******************************************************************************/ | 
|---|
| 121 | extern IMPORTKRNLSYM DATA16_GLOBAL  aImportTab[NBR_OF_KRNLIMPORTS]; /* Defined in ProbKrnl.c */ | 
|---|
| 122 | extern char          DATA16_GLOBAL  szSymbolFile[60];               /* Defined in ProbKrnl.c */ | 
|---|
| 123 | extern KRNLDBENTRY   DATA16_INIT    aKrnlSymDB[];                   /* Defined in symdb.c (for 16-bit usage) */ | 
|---|
| 124 |  | 
|---|
| 125 | #if defined(__IBMC__) || defined(__IBMCPP__) | 
|---|
| 126 | #pragma map( aImportTab , "_aImportTab"  ) | 
|---|
| 127 | #pragma map( szSymbolFile,"_szSymbolFile") | 
|---|
| 128 | #pragma map( aKrnlSymDB , "_aKrnlSymDB"  ) | 
|---|
| 129 | #endif | 
|---|
| 130 |  | 
|---|
| 131 | /* | 
|---|
| 132 | * 16-bit init time functions. | 
|---|
| 133 | */ | 
|---|
| 134 | #if defined(INCL_16) && defined(MAX_DISKDD_CMD) /* 16-bit only */ | 
|---|
| 135 | int ProbeKernel(PRPINITIN pReqPack); | 
|---|
| 136 | const char *    GetErrorMsg(short sErr); | 
|---|
| 137 | #endif | 
|---|
| 138 |  | 
|---|
| 139 | #endif | 
|---|
| 140 |  | 
|---|