- Timestamp:
- Dec 16, 2002, 3:25:07 AM (23 years ago)
- Location:
- trunk/src/win32k/kKrnlLib
- Files:
-
- 23 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/win32k/kKrnlLib/include/OS2KSEM.h
r7383 r9514 1 /* $Id: OS2KSEM.h,v 1. 4 2001-11-19 03:04:52bird Exp $1 /* $Id: OS2KSEM.h,v 1.5 2002-12-16 02:25:05 bird Exp $ 2 2 * 3 3 * OS/2 kernel Semaphore functions. … … 157 157 extern ULONG KRNLCALL KSEMRequestMutex(HKSEMMTX hkmtx, ULONG ulTimeout); 158 158 extern ULONG KRNLCALL OrgKSEMRequestMutex(HKSEMMTX hkmtx, ULONG ulTimeout); 159 extern VOIDKRNLCALL KSEMReleaseMutex(HKSEMMTX hkmtx);160 extern VOIDKRNLCALL OrgKSEMReleaseMutex(HKSEMMTX hkmtx);159 extern void KRNLCALL KSEMReleaseMutex(HKSEMMTX hkmtx); 160 extern void KRNLCALL OrgKSEMReleaseMutex(HKSEMMTX hkmtx); 161 161 extern ULONG KRNLCALL KSEMQueryMutex(HKSEMMTX hkmtx, PUSHORT pcusNest); 162 162 extern ULONG KRNLCALL OrgKSEMQueryMutex(HKSEMMTX hkmtx, PUSHORT pcusNest); … … 166 166 * Event semaphores. 167 167 */ 168 extern VOIDKRNLCALL KSEMResetEvent(HKSEMEVT hkev);169 extern VOIDKRNLCALL OrgKSEMResetEvent(HKSEMEVT hkev);170 extern VOIDKRNLCALL KSEMPostEvent(HKSEMEVT hkev);171 extern VOIDKRNLCALL OrgKSEMPostEvent(HKSEMEVT hkev);168 extern void KRNLCALL KSEMResetEvent(HKSEMEVT hkev); 169 extern void KRNLCALL OrgKSEMResetEvent(HKSEMEVT hkev); 170 extern void KRNLCALL KSEMPostEvent(HKSEMEVT hkev); 171 extern void KRNLCALL OrgKSEMPostEvent(HKSEMEVT hkev); 172 172 extern ULONG KRNLCALL KSEMWaitEvent(HKSEMEVT hkev, ULONG ulTimeout); 173 173 extern ULONG KRNLCALL OrgKSEMWaitEvent(HKSEMEVT hkev, ULONG ulTimeout); … … 189 189 extern ULONG KRNLCALL KSEMAlloc(PHKSEM phksem, ULONG p1, ULONG p2); 190 190 extern ULONG KRNLCALL KSEMCreate(PHKSEM phksem, ULONG type); 191 extern VOIDKRNLCALL KSEMDestroy(HKSEM hksem);191 extern void KRNLCALL KSEMDestroy(HKSEM hksem); 192 192 #endif 193 extern VOIDKRNLCALL KSEMInit(PKSEM pksem, ULONG fulType, ULONG fulFlags);194 extern VOIDKRNLCALL OrgKSEMInit(PKSEM pksem, ULONG fulType, ULONG fulFlags);195 extern VOIDKRNLCALL KSEMRelease(HKSEM hksem);196 extern VOIDKRNLCALL OrgKSEMRelease(HKSEM hksem);197 extern VOIDKRNLCALL KSEMQuery(HKSEM hksem, PULONG pul);198 extern VOIDKRNLCALL OrgKSEMQuery(HKSEM hksem, PULONG pul);193 extern void KRNLCALL KSEMInit(PKSEM pksem, ULONG fulType, ULONG fulFlags); 194 extern void KRNLCALL OrgKSEMInit(PKSEM pksem, ULONG fulType, ULONG fulFlags); 195 extern void KRNLCALL KSEMRelease(HKSEM hksem); 196 extern void KRNLCALL OrgKSEMRelease(HKSEM hksem); 197 extern void KRNLCALL KSEMQuery(HKSEM hksem, PULONG pul); 198 extern void KRNLCALL OrgKSEMQuery(HKSEM hksem, PULONG pul); 199 199 200 200 #endif -
trunk/src/win32k/kKrnlLib/include/OS2Krnl.h
r6815 r9514 1 /* $Id: OS2Krnl.h,v 1. 3 2001-09-26 03:52:36 bird Exp $1 /* $Id: OS2Krnl.h,v 1.4 2002-12-16 02:25:06 bird Exp $ 2 2 * 3 3 * OS/2 kernel structures, typedefs and macros. 4 *5 4 * Top-level include file. 6 5 * 7 * Project Odin Software License can be found in LICENSE.TXT 6 * Copyright (c) 1999-2003 knut st. osmundsen <bird@anduin.net> 7 * 8 * 9 * This file is part of kKrnlLib. 10 * 11 * kKrnlLib is free software; you can redistribute it and/or modify 12 * it under the terms of the GNU General Public License as published by 13 * the Free Software Foundation; either version 2 of the License, or 14 * (at your option) any later version. 15 * 16 * kKrnlLib is distributed in the hope that it will be useful, 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 * GNU General Public License for more details. 20 * 21 * You should have received a copy of the GNU General Public License 22 * along with kKrnlLib; if not, write to the Free Software 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 8 24 * 9 25 */ … … 98 114 99 115 #ifdef INCL_OS2KRNL_IO 100 #include <OS2KIO.h>116 #include "OS2KIO.h" 101 117 #endif 102 118 103 119 #ifdef INCL_OS2KRNL_VM 104 #include <OS2KVM.h>120 #include "OS2KVM.h" 105 121 #endif 106 122 107 123 #ifdef INCL_OS2KRNL_VMOWNER 108 #include <OS2KOwn.h>124 #include "OS2KOwn.h" 109 125 #endif 110 126 111 127 #ifdef INCL_OS2KRNL_SM 112 #include <OS2KSM.h>128 #include "OS2KSM.h" 113 129 #endif 114 130 115 131 #ifdef INCL_OS2KRNL_SEM 116 #include <OS2KSEM.h>132 #include "OS2KSEM.h" 117 133 #endif 118 134 119 135 #ifdef INCL_OS2KRNL_PTDA 120 #include <OS2KPTDA.h>136 #include "OS2KPTDA.h" 121 137 #endif 122 138 123 139 #ifdef INCL_OS2KRNL_TCB 124 #include <OS2KTCB.h>140 #include "OS2KTCB.h" 125 141 #endif 126 142 127 143 #ifdef INCL_OS2KRNL_PG 128 #include <OS2KPG.h>144 #include "OS2KPG.h" 129 145 #endif 130 146 131 147 #ifdef INCL_OS2KRNL_SEL 132 #include <OS2KSEL.h>148 #include "OS2KSEL.h" 133 149 #endif 134 150 135 151 #ifdef INCL_OS2KRNL_TK 136 #include <OS2KTK.h>152 #include "OS2KTK.h" 137 153 #endif 138 154 139 155 #ifdef INCL_OS2KRNL_LDR 140 #include <OS2KLDR.h>156 #include "OS2KLDR.h" 141 157 #endif 142 158 143 159 #ifdef INCL_OS2KRNL_SEC 144 #include <OS2KSEC.h>160 #include "OS2KSEC.h" 145 161 #endif 146 162 -
trunk/src/win32k/kKrnlLib/include/dev16.h
r7400 r9514 1 /* $Id: dev16.h,v 1.4 2001-11-20 03:43:51 bird Exp $ 2 * dev16 - 16-bit specific. Should not be used in 32-bit C/C++. 1 /* $Id: dev16.h,v 1.5 2002-12-16 02:25:06 bird Exp $ 3 2 * 4 * Copyright (c) 1999 knut st. osmundsen3 * 16 bit device stuff. 5 4 * 6 * Project Odin Software License can be found in LICENSE.TXT 5 * Copyright (c) 2002 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 7 23 * 8 24 */ 25 9 26 #ifndef _d16_h_ 10 27 #define _d16_h_ … … 104 121 extern DDHDR aDevHdrs[2]; 105 122 extern PFN Device_Help; 106 extern ULONG TKSSBase16;123 extern ULONG pulTKSSBase32; 107 124 extern USHORT R0FlatCS16; 108 125 extern USHORT R0FlatDS16; … … 127 144 extern char PASCAL DATA16_BSSSTART ; 128 145 extern char PASCAL DATA16_CONSTSTART; 129 extern char PASCAL DATA16_INITSTART ;130 extern char PASCAL DATA16_INIT_BSSSTART ;131 extern char PASCAL DATA16_INIT_CONSTSTART;132 146 extern char PASCAL CODE16START ; 133 extern char PASCAL CODE16_INITSTART ;134 147 extern char PASCAL CODE32START ; 135 148 extern char PASCAL DATA32START ; … … 143 156 extern char PASCAL DATA16_BSSEND ; 144 157 extern char PASCAL DATA16_CONSTEND; 145 extern char PASCAL DATA16_INITEND ; 146 extern char PASCAL DATA16_INIT_BSSEND ; 147 extern char PASCAL DATA16_INIT_CONSTEND; 158 extern char PASCAL DATA16_ENDEND ; 148 159 extern char PASCAL CODE16END ; 149 extern char PASCAL CODE16_ INITEND ;160 extern char PASCAL CODE16_ENDEND ; 150 161 extern char PASCAL CODE32END ; 151 162 extern char PASCAL DATA32END ; … … 156 167 157 168 158 159 169 #endif -
trunk/src/win32k/kKrnlLib/include/dev1632.h
r7387 r9514 1 /* $Id: dev1632.h,v 1. 2 2001-11-19 03:07:59bird Exp $1 /* $Id: dev1632.h,v 1.3 2002-12-16 02:25:06 bird Exp $ 2 2 * dev1632.h - Common header file for 16-bit and 32-bit C 3 3 * … … 81 81 * Global data... 82 82 */ 83 extern CHAR DATA16_GLOBALszBuildDate[];84 extern CHAR DATA16_GLOBALszBuildTime[];83 extern CHAR szBuildDate[]; 84 extern CHAR szBuildTime[]; 85 85 #if defined(__IBMC__) || defined(__IBMCPP__) 86 86 #pragma map( szBuildDate , "_szBuildDate" ) -
trunk/src/win32k/kKrnlLib/include/dev32.h
r7388 r9514 1 /* $Id: dev32.h,v 1. 8 2001-11-19 03:08:35bird Exp $1 /* $Id: dev32.h,v 1.9 2002-12-16 02:25:06 bird Exp $ 2 2 * 3 3 * dev32 - header file for 32-bit part of the driver. … … 84 84 extern PSMTE pKrnlSMTE; /* d32init.c */ 85 85 #endif 86 extern PULONG TKSSBase16; 86 87 extern ULONG Device_Help; 87 88 #if defined(__IBMC__) || defined(__IBMCPP__) 88 #pragma map( TKSSBase16 , "_TKSSBase16" )89 #pragma map( Device_Help , "_Device_Help" ) 89 90 #endif 90 #ifndef SSToDS 91 extern PULONG pulTKSSBase32; 91 92 extern PULONG pulTKSSBase32; 93 #if defined(__IBMC__) || defined(__IBMCPP__) 94 #pragma map( pulTKSSBase32 , "_pulTKSSBase32" ) 95 #endif 92 96 extern USHORT CallGateGDT; 93 97 98 #ifndef SSToDS 94 99 /* 95 100 * SSToDS( stack pointer ) -
trunk/src/win32k/kKrnlLib/include/kKLFunc.h
r6730 r9514 1 /* $Id: kKLFunc.h,v 1. 2 2001-09-17 00:11:09bird Exp $1 /* $Id: kKLFunc.h,v 1.3 2002-12-16 02:25:06 bird Exp $ 2 2 * 3 3 * Function overloading functions. 4 4 * 5 * Copyright (c) 2001 knut st. osmundsen (kosmunds@csc.com)5 * Copyright (c) 2001-2003 knut st. osmundsen <bird@anduin.net> 6 6 * 7 * Project Odin Software License can be found in LICENSE.TXT 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 8 23 * 9 24 */ … … 16 31 * Functions * 17 32 *******************************************************************************/ 18 BOOL kKLOverload32(ULONG ulFuncAddr, ULONGulOverloaderAddr);19 BOOL kKLRestore32(ULONG ulFuncAddr, ULONGulOverloaderAddr);20 BOOL kKLOverload16(ULONG ulFuncFarAddr, ULONGulOverloaderFarAddr);21 BOOL kKLRestore16(ULONG ulFuncFarAddr, ULONGulOverloaderFarAddr);22 BOOL kKLOverload16H(ULONG ulFuncFarAddr, ULONGulOverloaderFarAddr);23 BOOL kKLRestore16H(ULONG ulFuncFarAddr, ULONGulOverloaderFarAddr);33 KBOOL kKLOverload32( unsigned long ulFuncAddr, unsigned long ulOverloaderAddr); 34 KBOOL kKLRestore32( unsigned long ulFuncAddr, unsigned long ulOverloaderAddr); 35 KBOOL kKLOverload16( unsigned long ulFuncFarAddr, unsigned long ulOverloaderFarAddr); 36 KBOOL kKLRestore16( unsigned long ulFuncFarAddr, unsigned long ulOverloaderFarAddr); 37 KBOOL kKLOverload16H(unsigned long ulFuncFarAddr, unsigned long ulOverloaderFarAddr); 38 KBOOL kKLRestore16H( unsigned long ulFuncFarAddr, unsigned long ulOverloaderFarAddr); 24 39 25 40 -
trunk/src/win32k/kKrnlLib/include/kKLkernel.h
r8188 r9514 1 /* $Id: kKLkernel.h,v 1.2 2002-04-01 13:51:16 bird Exp $ 1 /* $Id: kKLkernel.h,v 1.3 2002-12-16 02:25:06 bird Exp $ 2 * 3 * OS2 Kernel Info. 4 * 5 * Copyright (c) 2002 knut st. osmundsen <bird@anduin.net> 2 6 * 3 7 * 8 * This file is part of kKrnlLib. 4 9 * 5 * Copyright (c) 2002 knut st. osmundsen (bird@anduin.net) 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. 6 14 * 7 * Project Odin Software License can be found in LICENSE.TXT 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 8 23 * 9 24 */ 10 25 #ifndef _kKLkernel_h_ 26 #define _kKLkernel_h_ 11 27 12 28 /******************************************************************************* … … 62 78 * Global Variables * 63 79 *******************************************************************************/ 64 #ifndef DATA16_GLOBAL 65 extern unsigned long fKernel; 66 extern unsigned long ulKernelBuild; 67 #else 68 extern unsigned long DATA16_GLOBAL fKernel; 69 extern unsigned long DATA16_GLOBAL ulKernelBuild; 70 #endif 80 extern unsigned long fKernel; 81 extern unsigned long ulKernelBuild; 71 82 72 83 #if defined(KKRNLLIB) && defined(RING0) … … 78 89 79 90 #endif 91 -
trunk/src/win32k/kKrnlLib/include/kKrnlLib.h
r8188 r9514 1 /* $Id: kKrnlLib.h,v 1. 7 2002-04-01 13:51:16bird Exp $1 /* $Id: kKrnlLib.h,v 1.8 2002-12-16 02:25:07 bird Exp $ 2 2 * 3 3 * Top level header file for kKrnlLib exports. … … 6 6 * Everything goes thru this header file. 7 7 * 8 * Copyright (c) 2002 knut st. osmundsen (bird@anduin.net)8 * Copyright (c) 2002-2003 knut st. osmundsen <bird@anduin.net> 9 9 * 10 * GPL 10 * 11 * This file is part of kKrnlLib. 12 * 13 * kKrnlLib is free software; you can redistribute it and/or modify 14 * it under the terms of the GNU General Public License as published by 15 * the Free Software Foundation; either version 2 of the License, or 16 * (at your option) any later version. 17 * 18 * kKrnlLib is distributed in the hope that it will be useful, 19 * but WITHOUT ANY WARRANTY; without even the implied warranty of 20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21 * GNU General Public License for more details. 22 * 23 * You should have received a copy of the GNU General Public License 24 * along with kKrnlLib; if not, write to the Free Software 25 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 11 26 * 12 27 */ 28 13 29 #ifndef _kKrnlLib_h_ 14 30 #define _kKrnlLib_h_ … … 41 57 */ 42 58 #ifndef NO_KKL_KERNEL 43 #include <kKLkernel.h>59 #include "kKLkernel.h" 44 60 #endif 45 61 … … 49 65 */ 50 66 #ifndef NO_KKL_STDARG 51 #include "kKLstdarg.h"67 #include <kLib/kStdArg.h> 52 68 #endif 53 69 … … 70 86 */ 71 87 #ifdef INCL_KKL_SPRINTF 72 #include "kKLsprintf.h" 88 #include <kLib/kString.h> 89 #define sprintf kStrFormat 90 #define vsprintf kStrVFormat 73 91 #endif 74 #ifdef INCL_KKL_PRINTF 75 #include "kKLprintf.h" 76 #endif 92 // replaced by kLib/kLog.h 93 //#ifdef INCL_KKL_PRINTF 94 // #include "kKLprintf.h" 95 //#endif 77 96 78 97 … … 108 127 #endif 109 128 110 111 112 129 #endif 113 130 -
trunk/src/win32k/kKrnlLib/include/krnlImportTable.h
r9501 r9514 1 /* $Id: krnlImportTable.h,v 1. 1 2002-12-16 00:28:03bird Exp $1 /* $Id: krnlImportTable.h,v 1.2 2002-12-16 02:25:07 bird Exp $ 2 2 * 3 3 * krnlImportTable definitions. … … 166 166 * NOTE! These are only available at init time! * 167 167 *******************************************************************************/ 168 extern IMPORTKRNLSYM aImportTab[NBR_OF_KRNLIMPORTS]; /* Defined in ProbKrnl.c */ 169 extern char szSymbolFile[60]; /* Defined in ProbKrnl.c */ 168 extern IMPORTKRNLSYM aImportTab[NBR_OF_KRNLIMPORTS]; /* Defined in krnlImportTable.c */ 170 169 extern const KRNLDBENTRY aKrnlSymDB32[]; /* Defined in symdb32.c */ 171 170 172 171 #if defined(__IBMC__) || defined(__IBMCPP__) 173 172 #pragma map( aImportTab , "_aImportTab" ) 174 #pragma map( szSymbolFile,"_szSymbolFile")175 #endif176 177 /*178 * 16-bit init time functions.179 */180 #if defined(INCL_16) && defined(MAX_DISKDD_CMD) /* 16-bit only */181 int ProbeKernel(PRPINITIN pReqPack);182 const char * GetErrorMsg(short sErr);183 #ifdef _kKLInitHlp_h_184 int DoDevIOCtl(KKLR0INITPARAM *pParam, KKLR0INITDATA *pData);185 #endif186 173 #endif 187 174 -
trunk/src/win32k/kKrnlLib/include/krnlPrivate.h
r6821 r9514 1 /* $Id: krnlPrivate.h,v 1. 3 2001-09-26 04:01:36bird Exp $1 /* $Id: krnlPrivate.h,v 1.4 2002-12-16 02:25:07 bird Exp $ 2 2 * 3 3 * Private header file for the krnl*.c* files. … … 22 22 * Global Variables * 23 23 *******************************************************************************/ 24 #ifdef _OS2KSEM_h_ 24 25 extern KSEMMTX kmtxImports; 26 #endif 25 27 26 28 extern char KKL_EntryTab[1]; /* calltaba.asm */ 27 29 extern char KKL_EntryTabEND[1]; /* calltaba.asm */ 28 extern char DATA16_INITKKL_EntryTabFixups[1]; /* calltaba.asm */30 extern char KKL_EntryTabFixups[1]; /* calltaba.asm */ 29 31 #ifdef _OS2KLDR_H_ 30 32 extern MTE kKrnlLibMTE; /* calltaba.asm */ … … 45 47 * Functions * 46 48 *******************************************************************************/ 47 extern void _Optlink LockedWrite(unsigned long ulAddr, unsigned char chOpcode, unsigned long ulDword); 48 extern int _Optlink MakeCalltab16CodeSegment(void); 49 extern void _Optlink LockedWrite(unsigned long ulAddr, unsigned char chOpcode, unsigned long ulDword); 50 extern int _Optlink MakeCalltab16CodeSegment(void); 51 extern int krnlLoadKernelSym(void); 52 extern int krnlLoadKernelSymFile(const char *pszFilename); 49 53 50 54 #endif -
trunk/src/win32k/kKrnlLib/include/options.h
r9507 r9514 1 /* $Id: options.h,v 1. 4 2002-12-16 01:37:07 bird Exp $1 /* $Id: options.h,v 1.5 2002-12-16 02:25:07 bird Exp $ 2 2 * 3 3 * Options. … … 52 52 { 53 53 /** @cat misc */ 54 ULONG fQuiet;/* Quiet initialization. */54 unsigned long fQuiet; /* Quiet initialization. */ 55 55 56 56 /** @cat logging options */ 57 USHORT usCom;/* Output port no. */58 USHORT fLogging;/* Logging. */57 unsigned short usCom; /* Output port no. */ 58 unsigned short fLogging; /* Logging. */ 59 59 60 60 /** @cat Options affecting the heap. */ 61 ULONG cbSwpHeapInit;/* Initial heapsize. */62 ULONG cbSwpHeapMax;/* Maximum heapsize. */63 ULONG cbResHeapInit;/* Initial residentheapsize. */64 ULONG cbResHeapMax;/* Maxiumem residentheapsize. */61 unsigned long cbSwpHeapInit; /* Initial heapsize. */ 62 unsigned long cbSwpHeapMax; /* Maximum heapsize. */ 63 unsigned long cbResHeapInit; /* Initial residentheapsize. */ 64 unsigned long cbResHeapMax; /* Maxiumem residentheapsize. */ 65 65 }; 66 66 #pragma pack() … … 71 71 /* NOINC */ 72 72 extern struct kKLOptions options; /* defined in d16Globl.c */ 73 extern USHORT usVerMajor;74 extern USHORT usVerMinor;73 extern unsigned short usVerMajor; /* obsolete? */ 74 extern unsigned short usVerMinor; /* obsolete? */ 75 75 extern char szSymbolFile[128]; 76 76 -
trunk/src/win32k/kKrnlLib/src/Extract.mak
r9124 r9514 1 # $Id: Extract.mak,v 1.1 0 2002-08-24 22:07:40bird Exp $1 # $Id: Extract.mak,v 1.11 2002-12-16 02:24:27 bird Exp $ 2 2 3 3 # 4 4 # kKrnlLib/krnl makefile. 5 5 # 6 # Copyright (c) 1999-200 2knut st. osmundsen (bird@anduin.net)6 # Copyright (c) 1999-2003 knut st. osmundsen (bird@anduin.net) 7 7 # 8 8 # GPL … … 12 12 # Setup config 13 13 # 14 #!include ..\..\makefile.inc15 14 ALL_INCLUDES = -I../include -I../kLib/include 16 15 ALL_DEFINES = -DEXTRACT -DLOGGING_DISABLED … … 25 24 TARGET_MODE = EXE 26 25 TARGET_PUB_DIR = $(PATH_TOOLS) 27 TARGET_STACKSIZE= 0x200028 26 MAKEFILE = $(TARGET_NAME).mak 29 PREMAKEFILES_LIB= Extract16.mak30 27 31 28 TARGET_OBJS =\ 32 $(PATH_ROOT)\obj\$(SHT_TRGPLTFRM)$(SHT_BLDMD)mscv6-16\Extract16.$(EXT_LIB)\Extract16.$(EXT_LIB)\33 29 $(PATH_TARGET)\Extract32.$(EXT_OBJ)\ 34 30 $(PATH_TARGET)\krnlPrologs.$(EXT_OBJ)\ 31 $(PATH_TARGET)\krnlImportTable.$(EXT_OBJ)\ 35 32 36 33 TARGET_LIBS =\ 37 $(PATH_TOOLKIT)\lib\os2286.$(EXT_LIB)\38 $(PATH_MSC)\lib\clibcep.$(EXT_LIB)\39 34 $(LIB_OS)\ 40 35 $(LIB_C_NRE)\ -
trunk/src/win32k/kKrnlLib/src/Makefile
r9124 r9514 1 # $Id: Makefile,v 1.1 1 2002-08-24 22:07:40bird Exp $1 # $Id: Makefile,v 1.12 2002-12-16 02:24:27 bird Exp $ 2 2 3 3 # … … 28 28 29 29 PREMAKEFILES_LIB =\ 30 newdbg.mak \31 newrel.mak \30 # newdbg.mak \ 31 # newrel.mak \ 32 32 Dev16.mak \ 33 33 … … 61 61 $(PATH_TARGET)\vprintf.$(EXT_OBJ)\ 62 62 $(PATH_TARGET)\vsprintf.$(EXT_OBJ)\ 63 $(PATH_OBJ)\$(TARGET_SUB)\newdbg.$(EXT_LIB)\newdbg.$(EXT_LIB)\64 $(PATH_OBJ)\$(TARGET_SUB)\newrel.$(EXT_LIB)\newrel.$(EXT_LIB)\63 #$(PATH_OBJ)\$(TARGET_SUB)\newdbg.$(EXT_LIB)\newdbg.$(EXT_LIB)\ 64 #$(PATH_OBJ)\$(TARGET_SUB)\newrel.$(EXT_LIB)\newrel.$(EXT_LIB)\ 65 65 \ 66 $(PATH_ROOT)\obj\$(SHT_TRGPLTFRM)$(SHT_BLDMD)mscv6 -16\$(TARGET_SUB)\dev16.$(EXT_LIB)\dev16.$(EXT_LIB)\66 $(PATH_ROOT)\obj\$(SHT_TRGPLTFRM)$(SHT_BLDMD)mscv6_16\$(TARGET_SUB)\dev16.$(EXT_LIB)\dev16.$(EXT_LIB)\ 67 67 \ 68 68 $(PATH_TARGET)\SymDB32.$(EXT_OBJ)\ -
trunk/src/win32k/kKrnlLib/src/MkCallTab.mak
r9504 r9514 1 # $Id: MkCallTab.mak,v 1.1 3 2002-12-16 00:48:05bird Exp $1 # $Id: MkCallTab.mak,v 1.14 2002-12-16 02:24:27 bird Exp $ 2 2 3 3 # … … 49 49 # kKrnlLib Import library definition file. 50 50 ..\kKrnlLibimplib.$(EXT_DEF): $(TARGET_PUBNAME) 51 $(TARGET _PUBNAME) deffile > $@51 $(TARGET) deffile > $@ 52 52 53 53 # Generate calltaba.asm 54 54 calltaba.asm: $(TARGET_PUBNAME) 55 $(TARGET _PUBNAME) calltab > $@55 $(TARGET) calltab > $@ 56 56 57 57 # Generate TstFakers.c 58 58 TstFakers.c: $(TARGET_PUBNAME) 59 $(TARGET _PUBNAME) tstfakers > $@59 $(TARGET) tstfakers > $@ 60 60 61 61 !endif # !BUILD_FORWARDING -
trunk/src/win32k/kKrnlLib/src/abort.c
r8140 r9514 1 /* $Id: abort.c,v 1. 2 2002-03-31 19:01:12bird Exp $1 /* $Id: abort.c,v 1.3 2002-12-16 02:24:27 bird Exp $ 2 2 * 3 3 * Abort replacement. 4 4 * 5 * Copyright (c) 2000 knut st. osmundsen (knut.stange.osmundsen@mynd.no)5 * Copyright (c) 1998-2003 knut st. osmundsen <bird@anduin.net> 6 6 * 7 * Project Odin Software License can be found in LICENSE.TXT 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 8 23 * 9 24 */ 10 25 #ifndef NOFILEID 11 static const char szFileId[] = "$Id: abort.c,v 1. 2 2002-03-31 19:01:12bird Exp $";26 static const char szFileId[] = "$Id: abort.c,v 1.3 2002-12-16 02:24:27 bird Exp $"; 12 27 #endif 13 28 … … 16 31 * Internal Functions * 17 32 *******************************************************************************/ 18 #include <os2.h>19 #include "devSegDf.h" /* Win32k segment definitions. */20 #include "dev32.h"21 33 #include <kLib/kTypes.h> 22 34 #include <kLib/kLog.h> 23 24 #include <builtin.h> 35 #include <kLib/kDevHlp.h> 25 36 26 37 … … 34 45 KLOGENTRY0("void"); 35 46 kprintf(("!Internal Processing Error! should not be here! - abort!\n")); 36 INT3();47 kBreakPoint(); 37 48 KLOGEXITVOID(); 38 49 } 50 -
trunk/src/win32k/kKrnlLib/src/d16ProbeKrnl.c
r8188 r9514 1 /* $Id: d16ProbeKrnl.c,v 1. 3 2002-04-01 13:51:17 bird Exp $1 /* $Id: d16ProbeKrnl.c,v 1.4 2002-12-16 02:24:27 bird Exp $ 2 2 * 3 3 * Description: Autoprobes the os2krnl file and os2krnl[*].sym files. … … 137 137 138 138 /* 139 *140 */141 static struct142 {143 short sErr;144 const char *pszMsg;145 } DATA16_INIT aErrorMsgs[] =146 {147 {ERROR_PROB_KRNL_OPEN_FAILED, "(Krnl) Failed to open kernel file."},148 {ERROR_PROB_KRNL_SEEK_SIZE, "(Krnl) Failed to seek to end to of file."},149 {ERROR_PROB_KRNL_SEEK_FIRST, "(Krnl) Failed to start of file."},150 {ERROR_PROB_KRNL_READ_FIRST, "(Krnl) Failed to read (first)."},151 {ERROR_PROB_KRNL_READ_NEXT, "(Krnl) Failed to read."},152 {ERROR_PROB_KRNL_TAG_NOT_FOUND, "(Krnl) Build level tag was not found."},153 {ERROR_PROB_KRNL_INV_SIGANTURE, "(Krnl) Invalid build level signature."},154 {ERROR_PROB_KRNL_INV_BUILD_NBR, "(Krnl) Invalid build level number."},155 {ERROR_PROB_KRNL_BUILD_VERSION, "(Krnl) Invalid build level version."},156 {ERROR_PROB_KRNL_MZ_SEEK, "(Krnl) Failed to seek to start of file. (MZ)"},157 {ERROR_PROB_KRNL_MZ_READ, "(Krnl) Failed to read MZ header."},158 {ERROR_PROB_KRNL_NEOFF_INVALID, "(Krnl) Invalid new-header offset in MZ header."},159 {ERROR_PROB_KRNL_NEOFF_SEEK, "(Krnl) Failed to seek to new-header offset."},160 {ERROR_PROB_KRNL_LX_READ, "(Krnl) Failed to read LX header."},161 {ERROR_PROB_KRNL_LX_SIGNATURE, "(Krnl) Invalid LX header signature."},162 {ERROR_PROB_KRNL_OBJECT_CNT, "(Krnl) Object count don't match the running kernel."},163 {ERROR_PROB_KRNL_OBJECT_CNR_10, "(Krnl) Less than 10 objects - not a valid kernel file!"},164 {ERROR_PROB_KRNL_OTE_SEEK, "(Krnl) Failed to seek to OTEs."},165 {ERROR_PROB_KRNL_OTE_READ, "(Krnl) Failed to read OTEs."},166 {ERROR_PROB_KRNL_OTE_SIZE_MIS, "(Krnl) Size of a OTE didn't match the running kernel."},167 168 /*169 * ProbeSymFile error messages + some extra ones.170 */171 {ERROR_D16_THUNKING_FAILED, "(Init) Request packed thunking failed."},172 {ERROR_D16_OPEN_DEV_FAILED, "(Init) Failed to open helper driver ($KrnlHlp)."},173 {ERROR_D16_IOCTL_FAILED, "(Init) IOCtl call to helper driver ($KrnlHlp) failed."},174 175 {ERROR_PROB_SYM_FILE_NOT_FOUND, "(Sym) Symbol file was not found."},176 {ERROR_PROB_SYM_READERROR, "(Sym) Read failed."},177 {ERROR_PROB_SYM_INVALID_MOD_NAME, "(Sym) Invalid module name (not OS2KRNL)."},178 {ERROR_PROB_SYM_SEGS_NE_OBJS, "(Sym) Number of segments don't match the object count of the kernel."},179 {ERROR_PROB_SYM_SEG_DEF_SEEK, "(Sym) Failed to seek to a segment definition."},180 {ERROR_PROB_SYM_SEG_DEF_READ, "(Sym) Failed to read a segment definition."},181 {ERROR_PROB_SYM_IMPORTS_NOTFOUND, "(Sym) Some of the imports wasn't found."},182 183 {ERROR_D32_GETOS2KRNL_FAILED , "(KrnlInfo) Failed to get the kernel MTE."},184 {ERROR_D32_NO_SWAPMTE , "(KrnlInfo) No swap MTE pointer in kernel MTE."},185 {ERROR_D32_TOO_MANY_OBJECTS , "(KrnlInfo) Too many kernel objects."},186 {ERROR_D32_NO_OBJECT_TABLE , "(KrnlInfo) No object table pointer.."},187 {ERROR_D32_BUILD_INFO_NOT_FOUND, "(KrnlInfo) Didn't find build info."},188 {ERROR_D32_INVALID_BUILD , "(KrnlInfo) Invalid build info."},189 190 {ERROR_D32_VERIFY_FAILED , "(InitR0) Reverify of kernel entrypoints failed."},191 {ERROR_D32_IPE , "(InitR0) Internal Processing Error."},192 {ERROR_D32_HEAPINIT_FAILED, "(InitR0) Heap Init failed."},193 {ERROR_D32_LDR_INIT_FAILED, "(InitR0) Loader init failed."},194 195 {ERROR_D32_PROC_NOT_FOUND , "(Verify32) Procedure not found."},196 {ERROR_D32_INVALID_OBJ_OR_ADDR, "(Verify32) Invalid object or address."},197 {ERROR_D32_INVALID_ADDRESS , "(Verify32) Invalid address."},198 {ERROR_D32_TOO_INVALID_PROLOG , "(Verify32) Invalid procedure prolog."},199 {ERROR_D32_NOT_IMPLEMENTED , "(Verify32) Entrytype is not implemented."},200 201 #ifdef DB_16BIT202 {ERROR_PROB_SYMDB_KRNL_NOT_FOUND, "(SymDB) Kernel was not found."}203 #else204 {ERROR_D32_SYMDB_NOT_FOUND, "(SymDB32) Not found."},205 #endif206 };207 208 /*209 139 * Fake data for Ring-3 testing. 210 140 */ … … 247 177 * Implementation of Internal Helper Functions * 248 178 *******************************************************************************/ 249 /**250 * Get the message text for an error message.251 * @returns Pointer to error text. NULL if not found.252 * @param sErr Error code id.253 * @status completely implemented.254 * @author knut st. osmundsen (kosmunds@csc.com)255 */256 const char * GetErrorMsg(short sErr)257 {258 int i;259 for (i = 0; i < sizeof(aErrorMsgs) / sizeof(aErrorMsgs[0]); i++)260 {261 if (aErrorMsgs[i].sErr == sErr)262 return aErrorMsgs[i].pszMsg;263 }264 return NULL;265 }266 267 268 /**269 * Does the dev ioctl call to the helper driver for calling270 * a 32-bit Ring-0 worker.271 * @returns error code from DosOpen or DosDevIOCtl.272 * @param pParam Pointer to parameter buffer.273 * @param pData Pointer to data buffer.274 * @author knut st. osmundsen (kosmunds@csc.com)275 */276 int DoDevIOCtl(KKLR0INITPARAM *pParam, KKLR0INITDATA *pData)277 {278 APIRET rc;279 HFILE hDev0 = 0;280 USHORT usAction = 0;281 282 /* Open the kKrnlHlp device driver. */283 rc = DosOpen(KKL_DEVICE_NAME, &hDev0, &usAction, 0UL, FILE_NORMAL,284 OPEN_ACTION_FAIL_IF_NEW | OPEN_ACTION_OPEN_IF_EXISTS,285 OPEN_SHARE_DENYNONE | OPEN_ACCESS_READONLY,286 0UL);287 if (rc == NO_ERROR)288 {289 pData->ulRc = 0;290 rc = DosDevIOCtl(pData, pParam, KKL_IOCTL_RING0INIT, KKL_IOCTL_CAT, hDev0);291 DosClose(hDev0);292 if (rc != NO_ERROR)293 {294 dprintf(("DosDevIOCtl failed with rc=%d\n", rc));295 rc = ERROR_D16_IOCTL_FAILED;296 }297 }298 else299 {300 dprintf(("DosOpen Failed with rc=%d\n", rc));301 rc = ERROR_D16_OPEN_DEV_FAILED;302 }303 304 return rc;305 }306 179 307 180 -
trunk/src/win32k/kKrnlLib/src/d16Strat.c
r8140 r9514 1 /* $Id: d16Strat.c,v 1. 2 2002-03-31 19:01:15bird Exp $1 /* $Id: d16Strat.c,v 1.3 2002-12-16 02:24:28 bird Exp $ 2 2 * 3 3 * d16strat.c - 16-bit strategy routine, device headers, device_helper (ptr) … … 36 36 37 37 /******************************************************************************* 38 * Global Variables *39 *******************************************************************************/40 #if 0 /* moved to devfirst.asm */41 extern DDHDR _far aDevHdrs[2];42 DDHDR aDevHdrs[2] = /* This is the first piece data in the driver!!!!!!! */43 {44 {45 &aDevHdrs[1], /* NextHeader */46 DEVLEV_3 | DEV_30 | DEV_CHAR_DEV, /* SDevAtt */47 (unsigned short)(void _near *)strategyAsm0, /* StrategyEP */48 0, /* InterruptEP */49 "$KrnlHlp", /* DevName */50 0, /* SDevProtCS */51 0, /* SDevProtDS */52 0, /* SDevRealCS */53 0, /* SDevRealDS */54 DEV_16MB | DEV_IOCTL2 /* SDevCaps */55 },56 {57 ~0UL, /* NextHeader */58 DEVLEV_3 | DEV_30 | DEV_CHAR_DEV, /* SDevAtt */59 (unsigned short)(void _near *)strategyAsm1, /* StrategyEP */60 0, /* InterruptEP */61 "$KrnlLib", /* DevName */62 0, /* SDevProtCS */63 0, /* SDevProtDS */64 0, /* SDevRealCS */65 0, /* SDevRealDS */66 DEV_16MB | DEV_IOCTL2 /* SDevCaps */67 }68 };69 #endif70 71 72 /*******************************************************************************73 38 * Internal Functions * 74 39 *******************************************************************************/ … … 88 53 { 89 54 case CMDInit: /* INIT command */ 90 if (fInitTime) 91 { 92 if (usDev == 0) 93 return dev0Init((PRPINITIN)pRpH, (PRPINITOUT)pRpH); 94 return dev1Init((PRPINITIN)pRpH, (PRPINITOUT)pRpH); 95 } 96 break; 55 if (usDev == 0) 56 return dev0Init((PRPINITIN)pRpH, (PRPINITOUT)pRpH); 57 return dev1Init((PRPINITIN)pRpH, (PRPINITOUT)pRpH); 97 58 98 59 case CMDGenIOCTL: /* Generic IOCTL */ 99 if (fInitTime) 100 return devGenIOCtl((PRP_GENIOCTL)pRpH); 101 break; 60 return devGenIOCtl((PRP_GENIOCTL)pRpH); 102 61 103 62 case CMDOpen: /* device open */ … … 110 69 111 70 case CMDInitBase: 112 { 113 MSGTABLE msg = { 1178, 1, "kKrnlLib.sys is not yet capable of being a BASEDEV." }; 114 DevHelp_Save_Message( &msg ); 115 break; 116 } 71 if (usDev == 0) 72 return dev0Init((PRPINITIN)pRpH, (PRPINITOUT)pRpH); 73 return dev1Init((PRPINITIN)pRpH, (PRPINITOUT)pRpH); 117 74 } 118 75 … … 144 101 */ 145 102 case KKL_IOCTL_RING0INIT: 146 if ( TKSSBase16== 0)103 if (pulTKSSBase32 == 0) 147 104 initGetDosTableData(); 148 105 /* -
trunk/src/win32k/kKrnlLib/src/d16crt.c
r8140 r9514 1 /* $Id: d16crt.c,v 1. 1 2002-03-31 19:01:15bird Exp $1 /* $Id: d16crt.c,v 1.2 2002-12-16 02:24:28 bird Exp $ 2 2 * 3 3 * Moved all the crt replacements used by the 16-bit part into one file. 4 4 * 5 * Copyright (c) 1998-2002 knut st. osmundsen (bird@anduin.net) 6 * 7 * Project Odin Software License can be found in LICENSE.TXT 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 8 23 * 9 24 */ -
trunk/src/win32k/kKrnlLib/src/devFirst.asm
r8140 r9514 1 ; $Id: devFirst.asm,v 1.2 2002-03-31 19:01:15 bird Exp $ 2 ; 3 ; DevFirst - entrypoint and segment definitions 4 ; 5 ; Copyright (c) 1999 knut st. osmundsen 6 ; 7 ; Project Odin Software License can be found in LICENSE.TXT 1 ; $Id: devFirst.asm,v 1.3 2002-12-16 02:24:28 bird Exp $ 2 ; 3 ; DevFirst - entrypoint, helper code, and segment definitions. 4 ; 5 ; 6 ; Copyright (c) 1998-2003 knut st. osmundsen <bird@anduin.net> 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 ; 8 24 ; 9 25 .386p … … 20 36 ; 21 37 public CODE16START 22 public CODE16_INITSTART23 public DATA16START24 38 public DATA16START 25 39 public DATA16_BSSSTART 26 40 public DATA16_CONSTSTART 27 41 public DATA16_GLOBALSTART 28 public DATA16_INITSTART29 42 public CODE16START 30 43 public CODE32START … … 54 67 ; Externs 55 68 ; 56 DATA16 segment57 extrn _TKSSBase16:dword58 DATA16 ends59 69 DATA32 segment 60 extrn pulTKSSBase32:dword70 extrn _pulTKSSBase32:dword 61 71 DATA32 ends 62 72 extrn R0Init:near … … 121 131 _SSToDS_16a proc NEAR 122 132 assume CS:CODE16, DS:DATA16, ES:NOTHING 123 mov edx, ds:_ TKSSBase16 ; get pointer held by _TKSSBase16(pointer to stack base)133 mov edx, ds:_pulTKSSBase32 ; get pointer held by _pulTKSSBase32 (pointer to stack base) 124 134 call far ptr FLAT:far_getCS ; get flat selector. 125 135 push es … … 244 254 mov fs, cx ;? 245 255 ASSUME ds:FLAT, es:FLAT, fs:NOTHING 246 247 ; make sure pulTKSSBase32 is ok.248 cmp pulTKSSBase32, 0249 jnz pulTKSSBase32_OK250 mov ecx, _TKSSBase16251 mov pulTKSSBase32, ecx252 xor ecx, ecx253 254 pulTKSSBase32_OK:255 256 256 257 ; do the call. (_System or _Optlink) … … 445 446 446 447 447 CODE16_INIT segment448 CODE16_INITSTART db 'CODE16_INITSTART',0449 CODE16_INIT ends450 451 448 DATA16 segment 452 449 DATA16START label byte ; Note. no start string here! … … 496 493 DATA16_GLOBAL ends 497 494 498 DATA16_INIT segment499 DATA16_INITSTART db 'DATA16_INITSTART',0500 DATA16_INIT ends501 502 495 BSS32 segment 503 496 BSS32START db 'BSS32START',0 -
trunk/src/win32k/kKrnlLib/src/devLast.asm
r8056 r9514 1 ; $Id: devLast.asm,v 1. 1 2002-03-10 02:45:54bird Exp $1 ; $Id: devLast.asm,v 1.2 2002-12-16 02:24:28 bird Exp $ 2 2 ; 3 ; DevLast - the object file termintating the resident part of the objects. 4 ; Code after the ???END labes and object files and which are linked in 5 ; after this file is discarded after init. 3 ; Segment endmarkers. 6 4 ; 7 ; Copyright (c) 1999 knut st. osmundsen5 ; NOTE: This file must be put into an library to get be linked in last. 8 6 ; 9 ; Project Odin Software License can be found in LICENSE.TXT 7 ; Copyright (c) 1999-2002 knut st. osmundsen <bird@anduin.net> 8 ; 9 ; 10 ; This file is part of kLib. 11 ; 12 ; kLib is free software; you can redistribute it and/or modify 13 ; it under the terms of the GNU General Public License as published by 14 ; the Free Software Foundation; either version 2 of the License, or 15 ; (at your option) any later version. 16 ; 17 ; kLib is distributed in the hope that it will be useful, 18 ; but WITHOUT ANY WARRANTY; without even the implied warranty of 19 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 ; GNU General Public License for more details. 21 ; 22 ; You should have received a copy of the GNU General Public License 23 ; along with kLib; if not, write to the Free Software 24 ; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 25 ; 10 26 ; 11 27 .model flat … … 25 41 public DATA16_CONSTEND 26 42 public DATA16_GLOBALEND 27 public DATA16_INITEND 28 public DATA16_INIT_BSSEND 29 public DATA16_INIT_CONSTEND 43 public DATA16_ENDEND 30 44 public CODE16END 31 public CODE16_ INITEND45 public CODE16_ENDEND 32 46 public CODE32END 33 47 public DATA32END … … 62 76 DATA16_GLOBAL ends 63 77 64 DATA16_ INITsegment65 db 'DATA16_ INITEND'66 DATA16_ INITEND db 067 DATA16_ INITends78 DATA16_END segment 79 db 'DATA16_ENDEND' 80 DATA16_ENDEND db 0 81 DATA16_END ends 68 82 69 DATA16_INIT_BSS segment70 db 'DATA16_INIT_BSSEND'71 DATA16_INIT_BSSEND db 072 DATA16_INIT_BSS ends73 74 DATA16_INIT_CONST segment75 db 'DATA16_CONSTEND'76 DATA16_INIT_CONSTEND db 077 DATA16_INIT_CONST ends78 83 79 84 CODE16 segment … … 82 87 CODE16 ends 83 88 84 CODE16_INIT segment 85 db 'CODE16_INITEND' 86 CODE16_INITEND db 0 87 CODE16_INIT ends 88 89 CODE16_END segment 90 db 'CODE16_ENDEND' 91 CODE16_ENDEND db 0 92 CODE16_END ends 89 93 90 94 CODE32 segment -
trunk/src/win32k/kKrnlLib/src/extract.c
r9084 r9514 1 /* $Id: extract.c,v 1.3 2002-08-22 02:55:26 bird Exp $ 2 * 3 * Description: SymDB entry generator. 4 * Builds SymDB entry from one or more symbol files. 5 * 6 * WARNING: For some stupid reason we usually crash when not redirecting STDOUT. 7 * 8 * Copyright (c) 2000-2001 knut st. osmundsen (knut.stange.osmundsen@mynd.no) 9 * 10 * Project Odin Software License can be found in LICENSE.TXT 1 /* $Id: extract.c,v 1.4 2002-12-16 02:24:28 bird Exp $ 2 * 3 * SymDB32 entry generator. 4 * Buils SymDB32 entries from one ofr more symbol files. 5 * 6 * Copyright (c) 1999-2003 knut st. osmundsen <bird@anduin.net> 7 * 8 * 9 * This file is part of kKrnlLib. 10 * 11 * kKrnlLib is free software; you can redistribute it and/or modify 12 * it under the terms of the GNU General Public License as published by 13 * the Free Software Foundation; either version 2 of the License, or 14 * (at your option) any later version. 15 * 16 * kKrnlLib is distributed in the hope that it will be useful, 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 * GNU General Public License for more details. 20 * 21 * You should have received a copy of the GNU General Public License 22 * along with kKrnlLib; if not, write to the Free Software 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 11 24 * 12 25 */ 26 13 27 14 28 /******************************************************************************* … … 19 33 20 34 #define DB_ASM 21 22 #define fclose(a) DosClose(a)23 #define SEEK_SET FILE_BEGIN24 #define SEEK_END FILE_END25 26 #define WORD unsigned short int27 #define DWORD unsigned long int28 35 29 36 #define INCL_BASE … … 37 44 #include <os2.h> 38 45 39 #include <strat2.h>40 #include <reqpkt.h>41 42 #include "devSegDf.h"43 #undef DATA16_INIT44 #define DATA16_INIT45 #undef CODE16_INIT46 #define CODE16_INIT47 46 #include "os2Krnl.h" /* must be included before dev1632.h! */ 48 #include " probkrnl.h"47 #include "krnlImportTable.h" 49 48 #include "dev1632.h" 50 49 #include "options.h" 51 #include "d16vprintf.h"52 #include "d16crt.h"53 50 54 51 #include <kKLkernel.h> 52 53 #include <string.h> 54 #include <stdio.h> 55 #include <stdlib.h> 55 56 56 57 … … 65 66 66 67 /* dummy replacement for SymDB.c */ 67 KRNLDBENTRY DATA16_INITaKrnlSymDB[] = {{0}};68 KRNLDBENTRY aKrnlSymDB[] = {{0}}; 68 69 69 70 /******************************************************************************* … … 77 78 *******************************************************************************/ 78 79 /* Workers */ 79 extern int ProbeSymFile(const char *pszFilename); 80 81 /* 32-bit functions */ 82 extern USHORT cdecl far GetOpcodes(const char far * pszKrnlFile, unsigned short cSymObjects); 83 extern void cdecl far Init32bitCrt(void); 80 extern int ProbeSymFile(const char *pszFilename); 81 extern int GetOpcodes(const char *pszKrnlFile, unsigned int cSymObjects); 84 82 85 83 … … 101 99 static int processFile(const char *pszFilename) 102 100 { 103 APIRETrc;104 int 105 int 106 const char *psz = pszFilename + kstrlen(pszFilename);101 int rc; 102 int cch; 103 int cchNum; 104 const char *psz = pszFilename + strlen(pszFilename); 107 105 108 106 /* find filename */ … … 114 112 115 113 /* Progress information */ 116 DosWrite(2, (char*)pszFilename, cch, &rc); 117 DosWrite(2, "\r\n", 2, &rc); 114 fprintf(stderr, "%s\n", pszFilename); 118 115 119 116 /* Filename check */ … … 130 127 ) 131 128 { 132 printf16("invalid filename: %s\n", pszFilename);129 fprintf(stderr, "invalid filename: %s\n", pszFilename); 133 130 return 2; 134 131 } … … 161 158 * Call 32-bit helper to check if there is a kernel. 162 159 */ 163 kstrcpy(szKrnlFile, pszFilename);164 szKrnlFile[ kstrlen(szKrnlFile) - 4] = '\0';160 strcpy(szKrnlFile, pszFilename); 161 szKrnlFile[strlen(szKrnlFile) - 4] = '\0'; 165 162 if (GetOpcodes(szKrnlFile, cObjects)) 166 163 { 167 printf16("GetOpcodes failed: %s\n", szKrnlFile);164 fprintf(stderr, "GetOpcodes failed: %s\n", szKrnlFile); 168 165 return 3; 169 166 } … … 175 172 * is enclaved within an "#ifdef ALLKERNELS ... #endif". 176 173 */ 177 #ifndef DB_ASM 178 if (psz[cchNum] != 'R') 179 printf16("#ifdef ALLKERNELS\n"); 180 181 printf16(" { /* %s */\n" 182 " %.*s, ", 183 psz, 184 cchNum, &psz[0] /* build number */ 185 ); 186 187 switch (psz[cchNum + 1]) 188 { 189 case 'S': printf16("KF_SMP"); break; 190 case '4': printf16("KF_UNI | KF_W4"); break; 191 case 'U': printf16("KF_UNI"); break; 192 } 193 switch (psz[cchNum]) 194 { 195 case 'A': printf16(" | KF_ALLSTRICT"); break; 196 case 'H': printf16(" | KF_HALFSTRICT"); break; 197 } 198 if (psz[cchNum + 2] >= 'A' && psz[cchNum + 2] <= 'Z') 199 printf16(" | KF_REV_%c", psz[cchNum + 2]); 200 201 printf16(", %d,\n" 202 " {\n", 203 cObjects); 204 205 for (i = 0; i < NBR_OF_KRNLIMPORTS; i++) 206 { 207 char *psz = aImportTab[i].achName; 208 printf16(" {%-2d, 0x%08lx, 0x%02x}, /* %s */\n", 209 aImportTab[i].fFound ? aImportTab[i].iObject : 0, 210 aImportTab[i].fFound ? aImportTab[i].offObject : 0xFFFFFFFFUL, 211 aImportTab[i].fFound ? aImportTab[i].chOpcode : OPCODE_IGNORE, 212 (char *)&aImportTab[i].achName[0] 213 ); 214 } 215 printf16(" }\n" 216 " },\n"); 217 218 /** @remark 219 * We generate #ifdef ALLKERNELS for debug kernels since we usually 220 * don't include symbol info in the database. 221 * OLD: 222 * Currently information for retail kernels are usable, but we'll 223 * generate it for the debug kernels too, but this information 224 * is enclaved within an "#ifdef ALLKERNELS ... #endif". 225 */ 226 if (psz[cchNum] != 'R') 227 printf16("#endif\n"); 228 #else 229 if (psz[cchNum] != 'R') 230 printf16("ifdef ALLKERNELS\n"); 231 232 printf16(";/* %s */\n" 233 " dw %.*s %*s; build no.\n", 234 psz, 235 cchNum, &psz[0], 4-cchNum, "" 236 ); 237 238 i = 0; /* flags */ 239 switch (psz[cchNum + 1]) 240 { 241 case 'S': i |= KF_SMP; break; 242 case '4': i |= KF_UNI | KF_W4; break; 243 case 'U': i |= KF_UNI; break; 244 } 245 switch (psz[cchNum]) 246 { 247 case 'A': i |= KF_ALLSTRICT; break; 248 case 'H': i |= KF_HALFSTRICT; break; 249 } 250 if (psz[cchNum + 2] >= 'A' && psz[cchNum + 2] <= 'Z') 251 i |= (psz[cchNum + 2] - 'A' + (KF_REV_A >> KF_REV_SHIFT)) << KF_REV_SHIFT; 252 253 printf16(" dw 0%04xh ; fKernel\n" 254 " db 0%2xh ; cObjects\n", 255 i, 256 cObjects); 257 258 for (i = 0; i < NBR_OF_KRNLIMPORTS; i++) 259 { 260 PIMPORTKRNLSYM pEntry = &aImportTab[i]; 261 printf16(" db 0%02xh ; %s\n" 262 " db 0%02xh\n" 263 " dd 0%08lxh\n", 264 pEntry->fFound ? pEntry->iObject : 0, 265 pEntry->achName, 266 pEntry->fFound ? pEntry->chOpcode : OPCODE_IGNORE, 267 pEntry->fFound ? pEntry->offObject : 0xFFFFFFFFUL 268 ); 269 } 270 271 /** @remark 272 * We generate #ifdef ALLKERNELS for debug kernels since we usually 273 * don't include symbol info in the database. 274 * OLD: 275 * Currently information for retail kernels are usable, but we'll 276 * generate it for the debug kernels too, but this information 277 * is enclaved within an "#ifdef ALLKERNELS ... #endif". 278 */ 279 if (psz[cchNum] != 'R') 280 printf16("endif\n"); 281 #endif 174 if (psz[cchNum] != 'R') 175 printf("ifdef ALLKERNELS\n"); 176 177 printf(";/* %s */\n" 178 " dw %.*s %*s; build no.\n", 179 psz, 180 cchNum, &psz[0], 4-cchNum, "" 181 ); 182 183 i = 0; /* flags */ 184 switch (psz[cchNum + 1]) 185 { 186 case 'S': i |= KF_SMP; break; 187 case '4': i |= KF_UNI | KF_W4; break; 188 case 'U': i |= KF_UNI; break; 189 } 190 switch (psz[cchNum]) 191 { 192 case 'A': i |= KF_ALLSTRICT; break; 193 case 'H': i |= KF_HALFSTRICT; break; 194 } 195 if (psz[cchNum + 2] >= 'A' && psz[cchNum + 2] <= 'Z') 196 i |= (psz[cchNum + 2] - 'A' + (KF_REV_A >> KF_REV_SHIFT)) << KF_REV_SHIFT; 197 198 printf(" dw 0%04xh ; fKernel\n" 199 " db 0%2xh ; cObjects\n", 200 i, 201 cObjects); 202 203 for (i = 0; i < NBR_OF_KRNLIMPORTS; i++) 204 { 205 PIMPORTKRNLSYM pEntry = &aImportTab[i]; 206 printf(" db 0%02xh ; %s\n" 207 " db 0%02xh\n" 208 " dd 0%08lxh\n", 209 pEntry->fFound ? pEntry->iObject : 0, 210 pEntry->achName, 211 pEntry->fFound ? pEntry->chOpcode : OPCODE_IGNORE, 212 pEntry->fFound ? pEntry->offObject : 0xFFFFFFFFUL 213 ); 214 } 215 216 /** @remark 217 * We generate #ifdef ALLKERNELS for debug kernels since we usually 218 * don't include symbol info in the database. 219 * OLD: 220 * Currently information for retail kernels are usable, but we'll 221 * generate it for the debug kernels too, but this information 222 * is enclaved within an "#ifdef ALLKERNELS ... #endif". 223 */ 224 if (psz[cchNum] != 'R') 225 printf("endif\n"); 282 226 283 227 /* update size */ … … 287 231 } 288 232 else 289 printf16("ProbeSymFile failed with rc=%d\n", rc);233 fprintf(stderr, "ProbeSymFile failed with rc=%d\n", rc); 290 234 291 235 return rc; … … 311 255 * Set paKrnlOTEs to point to an zeroed array of OTEs. 312 256 */ 313 static KRNLINFO DATA16_INITKrnlInfo = {0};257 static KRNLINFO KrnlInfo = {0}; 314 258 paKrnlOTEs = &KrnlInfo.aObjects[0]; 315 259 cbAllSize = cbSize = 0; 316 260 317 /*318 * Init 32-bit CRT.319 */320 Init32bitCrt();321 261 322 262 /* … … 325 265 for (i = 0; i < NBR_OF_KRNLIMPORTS; i++) 326 266 { 327 if (kstrlen(aImportTab[i].achName) != (int)aImportTab[i].cchName) 328 { 329 printf16("internal error - bad length of entry %d - %s. %d should be %d.\n", 330 i, aImportTab[i].achName, aImportTab[i].cchName, kstrlen(aImportTab[i].achName)); 267 if (strlen(aImportTab[i].achName) != (int)aImportTab[i].cchName) 268 { 269 fprintf(stderr, 270 "internal error - bad length of entry %d - %s. %d should be %d.\n", 271 i, aImportTab[i].achName, aImportTab[i].cchName, strlen(aImportTab[i].achName)); 331 272 return -1; 332 273 } … … 347 288 if (rc != NO_ERROR) 348 289 { 349 printf16("processFile failed with rc=%d for file %s\n",350 351 if (psz = GetErrorMsg(rc))352 printf16("%s\n", psz);290 fprintf(stderr, "processFile failed with rc=%d for file %s\n", 291 rc, argv[i]); 292 //if (psz = GetErrorMsg(rc)) 293 // fprintf(stderr, "%s\n", psz); 353 294 return rc; 354 295 } … … 363 304 * 364 305 */ 365 USHORT usSearch = 1; 366 HDIR hDir = HDIR_CREATE; 367 FILEFINDBUF ffb; 368 int i; 369 370 #ifndef DB_ASM 371 printf16("/* $Id: extract.c,v 1.3 2002-08-22 02:55:26 bird Exp $\n" 372 "*\n" 373 "* Autogenerated kernel symbol database.\n" 374 "*\n" 375 "* Copyright (c) 2000-2001 knut st. osmundsen (kosmunds@csc.com)\n" 376 "*\n" 377 "* Project Odin Software License can be found in LICENSE.TXT\n" 378 "*\n" 379 "*/\n"); 380 381 printf16("\n" 382 "#define INCL_NOPMAPI\n" 383 "#define INCL_NOBASEAPI\n" 384 "#include <os2.h>\n" 385 "#include \"DevSegDf.h\"\n" 386 "#include \"probkrnl.h\"\n" 387 "#include \"options.h\"\n" 388 "\n"); 389 390 #ifdef DB_16BIT 391 printf16("const KRNLDBENTRY DATA16_INIT aKrnlSymDB[] = \n" 392 "{\n"); 393 #else /* 32-bit */ 394 printf16("#pragma data_seg(SYMBOLDB32)\n" 395 "const KRNLDBENTRY aKrnlSymDB32[] = \n" 396 "{\n"); 397 #endif 398 #else 399 printf16(";/* $Id: extract.c,v 1.3 2002-08-22 02:55:26 bird Exp $\n" 400 ";*\n" 401 ";* Autogenerated kernel symbol database.\n" 402 ";*\n" 403 ";* Copyright (c) 2000-2001 knut st. osmundsen (kosmunds@csc.com)\n" 404 ";*\n" 405 ";* Project Odin Software License can be found in LICENSE.TXT\n" 406 ";*\n" 407 ";*/\n"); 408 409 printf16(" .386p\n" 410 "\n" 411 ";\n" 412 "; Include files\n" 413 ";\n" 414 " include devsegdf.inc\n" 415 "\n" 416 "\n" 417 ";\n" 418 "; Exported symbols\n" 419 ";\n" 420 #ifdef DB_16BIT 421 " public _aKrnlSymDB\n" 422 #else /* 32-bit */ 423 " public aKrnlSymDB32\n" 424 #endif 425 "\n" 426 "\n"); 427 428 #ifdef DB_16BIT 429 printf16("DATA16_INIT segment\n" 430 "_aKrnlSymDB:\n"); 431 #else /* 32-bit */ 432 printf16("SYMBOLDB32 segment\n" 433 "aKrnlSymDB32:\n"); 434 #endif 435 #endif 436 437 rc = DosFindFirst("*.sym", &hDir, FILE_NORMAL, 438 &ffb, sizeof(ffb), 439 &usSearch, 0UL); 440 while (rc == NO_ERROR & usSearch > 0) 306 ULONG cFiles = 1; 307 HDIR hDir = HDIR_CREATE; 308 FILEFINDBUF3 ffb; 309 int i; 310 311 printf(";/* $Id: extract.c,v 1.4 2002-12-16 02:24:28 bird Exp $\n" 312 ";*\n" 313 ";* Autogenerated kernel symbol database.\n" 314 ";*\n" 315 ";* Copyright (c) 2000-2001 knut st. osmundsen (kosmunds@csc.com)\n" 316 ";*\n" 317 ";* Project Odin Software License can be found in LICENSE.TXT\n" 318 ";*\n" 319 ";*/\n"); 320 321 printf(" .386p\n" 322 "\n" 323 ";\n" 324 "; Include files\n" 325 ";\n" 326 " include devsegdf.inc\n" 327 "\n" 328 "\n" 329 ";\n" 330 "; Exported symbols\n" 331 ";\n" 332 " public aKrnlSymDB32\n" 333 "\n" 334 "\n"); 335 336 printf("SYMBOLDB32 segment\n" 337 "aKrnlSymDB32:\n"); 338 339 rc = DosFindFirst("*.sym", &hDir, FILE_NORMAL, &ffb, sizeof(ffb), &cFiles, 0UL); 340 while (rc == NO_ERROR & cFiles > 0) 441 341 { 442 342 rc = processFile(&ffb.achName[0]); 443 343 if (rc != NO_ERROR) 444 344 { 445 printf16("processFile failed with rc=%d for file %s\n",446 447 if (psz = GetErrorMsg(rc))448 printf16("%s\n", psz);345 fprintf(stderr, "processFile failed with rc=%d for file %s\n", 346 rc, &ffb.achName[0]); 347 //if (psz = GetErrorMsg(rc)) 348 // printf("%s\n", psz); 449 349 return rc; 450 350 } 451 351 452 352 /* next file */ 453 rc = DosFindNext(hDir, &ffb, sizeof(ffb), & usSearch);353 rc = DosFindNext(hDir, &ffb, sizeof(ffb), &cFiles); 454 354 } 455 355 DosFindClose(hDir); 456 356 457 #ifndef DB_ASM 458 printf16(" { /* Terminating entry */\n" 459 " 0,0,0,\n" 460 " {\n"); 461 for (i = 0; i < NBR_OF_KRNLIMPORTS; i++) 462 printf16(" {0,0,0},\n"); 463 printf16(" }\n" 464 " }\n" 465 #ifdef DB_16BIT 466 "}; /* end of aKrnlSymDB[] */\n" 467 #else 468 "}; /* end of aKrnlSymDB32[] */\n" 469 #endif 470 ); 471 #else 472 printf16(";/* Terminating entry */\n" 473 " db %d dup(0)\n", 474 sizeof(KRNLDBENTRY)); 475 i = i; 476 #endif 357 printf(";/* Terminating entry */\n" 358 " db %d dup(0)\n", 359 sizeof(KRNLDBENTRY)); 360 i = i; 477 361 478 362 cbSize += sizeof(KRNLDBENTRY); … … 480 364 } 481 365 482 #ifndef DB_ASM 483 printf16("\n" 484 "/* cbAllSize = %ld %ld\n" 485 " * cbSize = %ld %ld\n" 486 " */\n", 487 cbAllSize, cbAllSize / sizeof(KRNLDBENTRY), 488 cbSize, cbSize / sizeof(KRNLDBENTRY)); 489 #else 490 printf16("\n" 491 ";/* cbAllSize = %ld %ld\n" 492 "; * cbSize = %ld %ld\n" 493 "; */\n" 494 #ifdef DB_16BIT 495 "DATA16_INIT ends\n" 496 #else /* 32-bit */ 497 "SYMBOLDB32 ends\n" 498 #endif 499 "end\n", 500 cbAllSize, cbAllSize / sizeof(KRNLDBENTRY), 501 cbSize, cbSize / sizeof(KRNLDBENTRY)); 502 #endif 366 printf("\n" 367 ";/* cbAllSize = %ld %ld\n" 368 "; * cbSize = %ld %ld\n" 369 "; */\n" 370 "SYMBOLDB32 ends\n" 371 "end\n", 372 cbAllSize, cbAllSize / sizeof(KRNLDBENTRY), 373 cbSize, cbSize / sizeof(KRNLDBENTRY)); 503 374 504 375 return rc; -
trunk/src/win32k/kKrnlLib/src/krnlInit.c
r8140 r9514 1 /* $Id: krnlInit.c,v 1.2 2002-03-31 19:01:16 bird Exp $ 2 * 3 * krnlInit - Initiates the 4 * 5 * Copyright (c) 1998-1999 knut st. osmundsen 6 * 7 * Project Odin Software License can be found in LICENSE.TXT 1 /* $Id: krnlInit.c,v 1.3 2002-12-16 02:24:29 bird Exp $ 2 * 3 * Init the OS2 Kernel facilities; identify it, find symbols, import table. 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 8 23 * 9 24 */ 25 10 26 #ifndef NOFILEID 11 static const char szFileId[] = "$Id: krnlInit.c,v 1. 2 2002-03-31 19:01:16bird Exp $";27 static const char szFileId[] = "$Id: krnlInit.c,v 1.3 2002-12-16 02:24:29 bird Exp $"; 12 28 #endif 13 29 … … 22 38 #endif 23 39 24 #define DWORD ULONG /* exe386.h fixes */25 #define WORD USHORT26 27 40 /******************************************************************************* 28 41 * Header Files * 29 42 *******************************************************************************/ 43 #include <kLib/format/LXexe.h> 44 #include <kLib/kTypes.h> 45 #include <kLib/kDevHlp.h> 46 30 47 #define INCL_DOSERRORS 31 48 #define INCL_NOPMAPI 32 49 #include <os2.h> 33 #include <exe386.h>34 50 #include <string.h> 35 51 … … 43 59 #include "kKrnlLib.h" 44 60 45 #include "devSegDf.h"46 61 #include "dev1632.h" 47 62 #include "dev32.h" 48 #include "dev32Hlp.h"49 63 #include "ProbKrnl.h" 50 64 #include "ProbKrnlErrors.h" … … 63 77 KSEMMTX kmtxImports; 64 78 79 PMTE pKrnlMTE = NULL; /* Initiated by krnlGetKernelInfo */ 80 PSMTE pKrnlSMTE = NULL; /* Initiated by krnlGetKernelInfo */ 81 POTE pKrnlOTE = NULL; /* Initiated by krnlGetKernelInfo */ 82 ULONG cKernelObjects = 0; /* Initiated by krnlGetKernelInfo */ 83 84 extern char callTab[1]; 85 65 86 66 87 /******************************************************************************* 67 88 * Internal Functions * 68 89 *******************************************************************************/ 69 int krnlInitImports(void); 70 int krnlInitExports(void); 90 int krnlGetKernelInfo(void); 91 int krnlLookupKernel(void); 92 int krnlVerifyImportTab(void); 93 94 int krnlInitImports(void); 95 int krnlInitExports(void); 71 96 72 97 #ifdef R3TST 73 void R3TstFixImportTab(void); 98 PMTE GetOS2KrnlMTETst(void) 99 void R3TstFixImportTab(void); 74 100 #endif 101 102 /** 103 * Initiates the imported functions. 104 * @returns 0 on success. 105 * -1 on failure. 106 */ 107 int krnlInit(void) 108 { 109 KLOGENTRY0("int"); 110 int rc; 111 112 /* 113 * Identify the kernel. 114 */ 115 rc = krnlGetKernelInfo(); 116 if (rc) 117 return rc; 118 119 /* 120 * Lookup the kernel in the Database 121 */ 122 rc = krnlLookupKernel(); 123 if (rc) 124 { 125 #if 0 /* FIXME */ 126 int rc2 = krnlLoadKernelSym(); 127 if (rc2) 128 { 129 kDH_SaveMessage(); 130 return rc; 131 } 132 #else 133 return rc; 134 #endif 135 } 136 137 /* 138 * Init imports. 139 */ 140 rc = krnlInitImports(); 141 142 /* 143 * Init the import semaphore. 144 */ 145 KSEMInit((PKSEM)(void*)&kmtxImports, KSEM_MUTEX, 0); 146 147 KLOGEXIT(rc); 148 return rc; 149 } 150 151 152 /** 153 * Get kernel OTEs 154 * This function set pKrnlMTE, pKrnlSMTE and pKrnlOTE, fKernel, ulKernelBuild and cKernelObjects. 155 * 156 * @returns Strategy return code: 157 * STATUS_DONE on success. 158 * STATUS_DONE | STERR | errorcode on failure. 159 * @status completely implemented and tested. 160 * @author knut st. osmundsen 161 */ 162 int krnlGetKernelInfo(void) 163 { 164 KLOGENTRY0("int"); 165 int i; 166 ULONG rc; 167 168 /* Find the kernel OTE table */ 169 #ifndef R3TST 170 pKrnlMTE = GetOS2KrnlMTE(); 171 #else 172 pKrnlMTE = GetOS2KrnlMTETst(); 173 #endif 174 if (pKrnlMTE != NULL) 175 { 176 pKrnlSMTE = pKrnlMTE->mte_swapmte; 177 if (pKrnlSMTE != NULL) 178 { 179 if (pKrnlSMTE->smte_objcnt <= MAXKRNLOBJECTS) 180 { 181 pKrnlOTE = pKrnlSMTE->smte_objtab; 182 if (pKrnlOTE != NULL) 183 { 184 BOOL fKrnlTypeOk; 185 186 cKernelObjects = (unsigned char)pKrnlSMTE->smte_objcnt; 187 rc = 0; 188 189 /* 190 * Search for internal revision stuff AND 'SAB KNL?' signature in the two first objects. 191 */ 192 fKrnlTypeOk = FALSE; 193 fKernel = 0; 194 ulKernelBuild = 0; 195 for (i = 0; i < 2 && ulKernelBuild == 0; i++) 196 { 197 const char *psz = (const char*)pKrnlOTE[i].ote_base; 198 const char *pszEnd = psz + pKrnlOTE[i].ote_size - 50; /* Last possible search position. */ 199 200 while (psz < pszEnd) 201 { 202 if (strncmp(psz, "Internal revision ", 18) == 0 && (psz[18] >= '0' && psz[18] <= '9')) 203 { 204 int j; 205 kprintf2(("krnlGetKernelInfo: found internal revision: '%s'\n", psz)); 206 207 /* skip to end of "Internal revision " string. */ 208 psz += 18; 209 210 /* Read number*/ 211 while ((*psz >= '0' && *psz <= '9') || *psz == '.') 212 { 213 if (*psz != '.') 214 ulKernelBuild = (unsigned short)(ulKernelBuild * 10 + (*psz - '0')); 215 psz++; 216 } 217 218 /* Check if build number seems valid. */ 219 if ( !(ulKernelBuild >= 8254 && ulKernelBuild < 8383) /* Warp 3 fp 32 -> fp 60 */ 220 && !(ulKernelBuild >= 9023 && ulKernelBuild <= 9036) /* Warp 4 GA -> fp 12 */ 221 && !(ulKernelBuild >= 14039 && ulKernelBuild < 14150) /* Warp 4.5 GA -> ?? */ 222 && !(ulKernelBuild >= 6600 && ulKernelBuild <= 6678) /* Warp 2.1x fix?? (just for fun!) */ 223 ) 224 { 225 kprintf(("krnlGetKernelInfo: info summary: Build %d is invalid - invalid fixpack?\n", ulKernelBuild)); 226 rc = ERROR_D32_INVALID_BUILD; 227 break; 228 } 229 230 /* Check for any revision flag */ 231 if ((*psz >= 'A' && *psz <= 'Z') || (*psz >= 'a' && *psz <= 'z')) 232 { 233 fKernel |= (USHORT)((*psz - (*psz >= 'a' ? 'a'-1 : 'A'-1)) << KF_REV_SHIFT); 234 psz++; 235 } 236 if (*psz == ',') /* This is ignored! */ 237 *psz++; 238 239 /* If this is an Aurora/Warp 4.5 or Warp 3 kernel there is more info! */ 240 if (psz[0] == '_' && (psz[1] == 'S' || psz[1] == 's')) /* _SMP */ 241 fKernel |= KF_SMP; 242 else 243 if (*psz != ',' 244 && ( (psz[0] == '_' && psz[1] == 'W' && psz[2] == '4') /* _W4 */ 245 || (psz[0] == '_' && psz[1] == 'U' && psz[2] == 'N' && psz[3] == 'I' && psz[4] == '4') /* _UNI4 */ 246 ) 247 ) 248 fKernel |= KF_W4 | KF_UNI; 249 else 250 fKernel |= KF_UNI; 251 252 253 /* Check if its a debug kernel (look for DEBUG at start of object 3-5) */ 254 if (!fKrnlTypeOk) 255 { 256 j = 3; 257 while (j < 5) 258 { 259 /* There should be no iopl object preceding the debugger data object. */ 260 if ((pKrnlOTE[j].ote_flags & OBJIOPL) != 0) 261 break; 262 /* Is this is? */ 263 if ((pKrnlOTE[j].ote_flags & OBJINVALID) == 0 264 && (pKrnlOTE[j].ote_flags & (OBJREAD | OBJWRITE)) == (OBJREAD | OBJWRITE) 265 && strncmp((char*)pKrnlOTE[j].ote_base, "DEBUG", 5) == 0) 266 { 267 fKernel |= KF_DEBUG; 268 break; 269 } 270 j++; 271 } 272 } 273 274 /* Display info */ 275 kprintf(("krnlGetKernelInfo: info summary: Build %d, fKernel=0x%x\n", 276 ulKernelBuild, fKernel)); 277 278 /* Break out */ 279 break; 280 } 281 282 /* 283 * Look for the SAB KNL? signature to check which kernel type we're 284 * dealing with. This could also be reached thru the selector found 285 * in the first element for the SAS_tables_area array. 286 */ 287 if (!fKrnlTypeOk && strncmp(psz, "SAB KNL", 7) == 0) 288 { 289 fKrnlTypeOk = TRUE; 290 if (psz[7] == 'D') 291 fKernel |= KF_ALLSTRICT; 292 else if (psz[7] == 'B') 293 fKernel |= KF_HALFSTRICT; 294 else if (psz[7] != 'R') 295 fKrnlTypeOk = FALSE; 296 } 297 298 /* next */ 299 psz++; 300 } /* while loop searching for "Internal revision " */ 301 } /* for loop on objects 0-1. */ 302 303 /* Set error code if not found */ 304 if (ulKernelBuild == 0) 305 { 306 rc = ERROR_D32_BUILD_INFO_NOT_FOUND; 307 kprintf(("krnlGetKernelInfo: Internal revision was not found!\n")); 308 } 309 } 310 else 311 rc = ERROR_D32_NO_OBJECT_TABLE; 312 } 313 else 314 rc = ERROR_D32_TOO_MANY_OBJECTS; 315 } 316 else 317 rc = ERROR_D32_NO_SWAPMTE; 318 } 319 else 320 rc = ERROR_D32_GETOS2KRNL_FAILED; 321 322 if (rc != NO_ERROR) 323 kprintf(("krnlGetKernelInfo: failed. rc = %d\n", rc)); 324 325 KLOGEXIT(rc); 326 return (rc); 327 } 328 329 #ifdef R3TST 330 /** 331 * Creates a fake kernel MTE, SMTE and OTE for use while testing in Ring3. 332 * @returns Pointer to the fake kernel MTE. 333 * @status completely implemented. 334 * @author knut st. osmundsen (knut.stange.osmundsen@mynd.no) 335 */ 336 PMTE GetOS2KrnlMTETst(void) 337 { 338 KLOGENTRY0("PMTE"); 339 static MTE KrnlMTE; 340 static SMTE KrnlSMTE; 341 342 KrnlMTE.mte_swapmte = &KrnlSMTE; 343 KrnlSMTE.smte_objtab = &aKrnlOTE[0]; 344 KrnlSMTE.smte_objcnt = cObjectsFake; 345 346 KLOGEXIT(&KrnlMTE); 347 return &KrnlMTE; 348 } 349 350 #endif 351 352 353 /** 354 * Lookups a kernel in the 32-bit symbol database. 355 * 356 * @returns NO_ERROR on success. 357 * @returns ERROR_PROB_SYMDB_KRNL_NOT_FOUND if not found. 358 * @returns Low word: error code. High word: function number. Other errors. 359 * 360 * @remark Supports multiple kernels with same build, type and object count. 361 * Hence all kernels are searched. 362 * @remark Uses ulKernelBuild, fKernel, cKernelObjects. 363 */ 364 int krnlLookupKernel(void) 365 { 366 KLOGENTRY0("int"); 367 int i; 368 ULONG rc = ERROR_PROB_SYMDB_KRNL_NOT_FOUND; 369 370 371 /* 372 * Loop tru the DB entries until a NULL pointer is found. 373 */ 374 for (i = 0; aKrnlSymDB32[i].usBuild != 0; i++) 375 { 376 if ( aKrnlSymDB32[i].usBuild == (USHORT)ulKernelBuild 377 && aKrnlSymDB32[i].fKernel == fKernel 378 && aKrnlSymDB32[i].cObjects == (char)cKernelObjects) 379 { /* found matching entry! */ 380 int j; 381 const KRNLDBENTRY * pEntry = &aKrnlSymDB32[i]; 382 383 kprintf(("Found entry for this kernel!\n")); 384 385 /* 386 * Copy symbol data from the DB to aImportTab. 387 */ 388 for (j = 0; j < NBR_OF_KRNLIMPORTS; j++) 389 { 390 aImportTab[j].offObject = pEntry->aSyms[j].offObject; 391 aImportTab[j].iObject = pEntry->aSyms[j].iObject; 392 aImportTab[j].chOpcode = pEntry->aSyms[j].chOpcode; 393 aImportTab[j].ulAddress = pKrnlOTE[pEntry->aSyms[j].iObject].ote_base 394 + pEntry->aSyms[j].offObject; 395 aImportTab[j].usSel = pKrnlOTE[pEntry->aSyms[j].iObject].ote_sel; 396 aImportTab[j].fFound = (char)((aImportTab[j].offObject != 0xFFFFFFFFUL) ? 1 : 0); 397 398 kprintf2((" %-3d addr=0x%08lx off=0x%08lx %s\n", 399 j, aImportTab[j].ulAddress, aImportTab[j].offObject, 400 aImportTab[j].achName)); 401 } 402 403 /* 404 * Verify prologs and return if successful. 405 */ 406 rc = krnlVerifyImportTab(); 407 if (!rc) 408 { 409 KLOGEXIT(rc); 410 return rc; 411 } 412 } 413 } 414 415 KLOGEXIT(rc); 416 return rc; 417 } 75 418 76 419 77 420 /** 78 421 * Verifies the aImportTab. 422 * 79 423 * @returns 16-bit errorcode where the high byte is the procedure number which 80 424 * the error occured on and the low byte the error code. … … 82 426 * WARNING! This function is called before the initroutine (R0INIT)! 83 427 */ 84 ULONG VerifyImportTab32(void)428 int krnlVerifyImportTab(void) 85 429 { 86 KLOGENTRY0("ULONG"); 87 ULONG rc; 430 KLOGENTRY0("int"); 88 431 int i; 89 432 int cb; 90 433 int cbmax; 91 92 /* VerifyImporTab32 is called before the initroutine! */93 pulTKSSBase32 = TKSSBase16;94 95 /* Check that pKrnlOTE is set */96 rc = GetKernelInfo32(NULL);97 if (rc != NO_ERROR)98 {99 KLOGEXIT(rc);100 return rc;101 }102 434 103 435 /* … … 203 535 204 536 205 /** 206 * Lookups a kernel in the 32-bit symbol database. 207 * @returns NO_ERROR on success. 208 * ERROR_PROB_SYMDB_KRNL_NOT_FOUND if not found. 209 * Low word: error code. High word: function number. Other errors. 210 * 211 * @param plke32Param Pointer to parameters (in resident memory please). 212 * @author knut st. osmundsen (kosmunds@csc.com) 213 * @remark Supports multiple kernels with same build, type and object count. 214 * Hence all kernels are searched. 215 * @remark - Why don't we simply ask for the kernel data from the 32-bit work our self? 216 * * Maybe because this allows the caller to pass in other data... 217 * - Which will not happen... 218 */ 219 ULONG LookupKrnlEntry32(PLKE32PARAM plke32Param) 220 { 221 #ifndef DB_16BIT 222 KLOGENTRY1("ULONG","PLKE32PARAM plke32Param", plke32Param); 223 int i; 224 ULONG rc = ERROR_PROB_SYMDB_KRNL_NOT_FOUND; 225 USHORT usBuild = plke32Param->usBuild; 226 USHORT fKernel = plke32Param->fKernel; 227 CHAR cObjects = plke32Param->cObjects; 228 229 230 /* 231 * Loop tru the DB entries until a NULL pointer is found. 232 */ 233 for (i = 0; aKrnlSymDB32[i].usBuild != 0; i++) 234 { 235 if ( aKrnlSymDB32[i].usBuild == usBuild 236 && aKrnlSymDB32[i].fKernel == fKernel 237 && aKrnlSymDB32[i].cObjects == cObjects) 238 { /* found matching entry! */ 239 int j; 240 const KRNLDBENTRY * pEntry = &aKrnlSymDB32[i]; 241 242 kprintf(("Found entry for this kernel!\n")); 243 244 /* 245 * Copy symbol data from the DB to aImportTab. 246 */ 247 for (j = 0; j < NBR_OF_KRNLIMPORTS; j++) 248 { 249 aImportTab[j].offObject = pEntry->aSyms[j].offObject; 250 aImportTab[j].iObject = pEntry->aSyms[j].iObject; 251 aImportTab[j].chOpcode = pEntry->aSyms[j].chOpcode; 252 aImportTab[j].ulAddress = pKrnlOTE[pEntry->aSyms[j].iObject].ote_base 253 + pEntry->aSyms[j].offObject; 254 aImportTab[j].usSel = pKrnlOTE[pEntry->aSyms[j].iObject].ote_sel; 255 aImportTab[j].fFound = (char)((aImportTab[j].offObject != 0xFFFFFFFFUL) ? 1 : 0); 256 257 kprintf2((" %-3d addr=0x%08lx off=0x%08lx %s\n", 258 j, aImportTab[j].ulAddress, aImportTab[j].offObject, 259 aImportTab[j].achName)); 260 } 261 262 /* 263 * Verify prologs and return if successful. 264 */ 265 rc = VerifyImportTab32(); 266 if (!rc) 267 { 268 KLOGEXIT(rc); 269 return rc; 270 } 271 } 272 } 273 274 KLOGEXIT(rc); 275 return rc; 276 #else 277 return -1; 278 #endif 279 } 280 281 282 /** 283 * Initiates the imported functions. 284 * @returns 0 on success. 285 * -1 on failure. 286 */ 287 int krnlInit(void) 288 { 289 KLOGENTRY0("int"); 290 int rc; 291 292 /* 293 * Init imports. 294 */ 295 rc = krnlInitImports(); 296 297 /* 298 * Init the import semaphore. 299 */ 300 KSEMInit((PKSEM)(void*)&kmtxImports, KSEM_MUTEX, 0); 301 302 KLOGEXIT(rc); 303 return rc; 304 } 537 538 305 539 306 540 … … 333 567 char * pchCTEntry; /* Pointer to current 32-bit calltab entry. */ 334 568 char * pchCTEntry16; /* Pointer to current 16-bit calltab entry. */ 335 LOCKHANDLElhCT16; /* Lock handle for the 16-bit calltable */569 KDHVMLOCK lhCT16; /* Lock handle for the 16-bit calltable */ 336 570 337 571 … … 339 573 * verify aImportTab 340 574 */ 341 rc = VerifyImportTab32();575 rc = krnlVerifyImportTab(); 342 576 if (rc) 343 577 { 344 kprintf((" VerifyImportTab32 failed with rc=%d\n", rc));578 kprintf(("krnlVerifyImportTab failed with rc=0x%x\n", rc)); 345 579 INT3(); 346 580 KLOGEXIT(rc); … … 352 586 * Lock the 16-bit calltab segment. 353 587 */ 354 rc = D32Hlp_VMLock2(&callTab16[0], &callTab16END[0] - &callTab16[0], VMDHL_WRITE | VMDHL_LONG, SSToDS(&lhCT16));588 rc = kDH_VMLock2(&callTab16[0], &callTab16END[0] - &callTab16[0], VMDHL_WRITE | VMDHL_LONG, SSToDS(&lhCT16)); 355 589 if (rc) 356 590 { -
trunk/src/win32k/kKrnlLib/src/krnlPrologs.c
r8056 r9514 1 /* $Id: krnlPrologs.c,v 1. 1 2002-03-10 02:45:56bird Exp $1 /* $Id: krnlPrologs.c,v 1.2 2002-12-16 02:24:29 bird Exp $ 2 2 * 3 3 * krnlPrologs - Kernel Prolog Recognizer. 4 4 * 5 * Copyright (c) 1998-2001 knut st. osmundsen 6 * 7 * Project Odin Software License can be found in LICENSE.TXT 5 * Copyright (c) 1999-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 8 23 * 9 24 */ 25 10 26 #ifndef NOFILEID 11 static const char szFileId[] = "$Id: krnlPrologs.c,v 1. 1 2002-03-10 02:45:56bird Exp $";27 static const char szFileId[] = "$Id: krnlPrologs.c,v 1.2 2002-12-16 02:24:29 bird Exp $"; 12 28 #endif 13 29 … … 26 42 * Header Files * 27 43 *******************************************************************************/ 28 #define INCL_DOSERRORS29 #define INCL_NOPMAPI30 #include <os2.h>31 #include <string.h>32 33 44 #define INCL_KKL_LOG 34 45 #include "kKrnlLib.h" … … 39 50 * Internal Functions * 40 51 *******************************************************************************/ 41 _Inline intModR_M_32bit(char bModRM);42 _Inline intModR_M_16bit(char bModRM);43 int 44 int 52 INLINE int ModR_M_32bit(char bModRM); 53 INLINE int ModR_M_16bit(char bModRM); 54 int interpretFunctionProlog32(char *pach); 55 int interpretFunctionProlog16(char *pach); 45 56 46 57 … … 228 239 ) 229 240 { 230 BOOL fForce = FALSE;241 KBOOL fForce = FALSE; 231 242 int cbWord = 4; 232 243 cb = 0; … … 455 466 ) 456 467 { 457 BOOL fForce;468 KBOOL fForce; 458 469 int cOpPrefix = 0; 459 470 cb = 0;
Note:
See TracChangeset
for help on using the changeset viewer.