- Timestamp:
- Aug 20, 2007, 12:46:14 AM (18 years ago)
- Location:
- trunk/kProfile
- Files:
-
- 1 added
- 7 edited
- 3 copied
- 4 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/kProfile/Makefile.kmk
r3524 r3526 25 25 # 26 26 27 28 DEPTH = ../../../.. 27 DEPTH = .. 29 28 include $(PATH_KBUILD)/header.kmk 30 29 31 30 #LIBRARIES = kPrf2GC kPrf2R0 32 31 DLLS = kPrf2 33 PROGRAMS = kPrf2Read tst32 PROGRAMS = kPrf2Read 34 33 35 34 … … 40 39 TEMPLATE_kPrf2_TOOL = GCC3 41 40 TEMPLATE_kPrf2_TOOL.os2 = GCC3OMF 42 TEMPLATE_kPrf2_TOOL.win32 = VCC70 43 TEMPLATE_kPrf2_ASTOOL = NASM 41 TEMPLATE_kPrf2_TOOL.win.x86 = VCC70 42 TEMPLATE_kPrf2_TOOL.win.amd64 = VCC80AMD64 43 TEMPLATE_kPrf2_ASTOOL = YASM 44 TEMPLATE_kPrf2_ASTOOL.os2 = NASM 44 45 45 TEMPLATE_kPrf2_ DEFS.freebsd = __FREEBSD__46 TEMPLATE_kPrf2_DEFS.l4 = __L4__ 47 TEMPLATE_kPrf2_DEFS. linux = __LINUX__48 TEMPLATE_kPrf2_DEFS. os2 = __OS2__49 TEMPLATE_kPrf2_DEFS. win32 = __WIN32__50 TEMPLATE_kPrf2_DEFS.win 64 = __WIN64__46 TEMPLATE_kPrf2_SDKS.win = WINPSDK 47 48 TEMPLATE_kPrf2_DEFS.freebsd = KPRF_OS_FREEBSD 49 TEMPLATE_kPrf2_DEFS.linux = KPRF_OS_LINUX 50 TEMPLATE_kPrf2_DEFS.os2 = KPRF_OS_OS2 51 TEMPLATE_kPrf2_DEFS.win = KPRF_OS_WINDOWS 51 52 52 53 TEMPLATE_kPrf2_CXXFLAGS.freebsd = -g 53 TEMPLATE_kPrf2_CXXFLAGS.l4 = -g54 54 TEMPLATE_kPrf2_CXXFLAGS.linux = -g 55 55 TEMPLATE_kPrf2_CXXFLAGS.os2 = -g 56 TEMPLATE_kPrf2_CXXFLAGS.win 32= -Zi -Zl -MD -W3 -GF -GR-56 TEMPLATE_kPrf2_CXXFLAGS.win = -Zi -Zl -MD -W3 -GF -GR- 57 57 ifneq ($(BUILD_TYPE),debug) 58 58 TEMPLATE_kPrf2_CXXFLAGS.freebsd+= -O3 59 TEMPLATE_kPrf2_CXXFLAGS.l4 += -O360 59 TEMPLATE_kPrf2_CXXFLAGS.linux += -O3 61 60 TEMPLATE_kPrf2_CXXFLAGS.os2 += -O3 62 TEMPLATE_kPrf2_CXXFLAGS.win 32+= -O2xtg -Oi -Ob261 TEMPLATE_kPrf2_CXXFLAGS.win += -O2xtg -Oi -Ob2 63 62 endif 64 TEMPLATE_kPrf2_CXXFLAGS.win64 = $(TEMPLATE_kPrf2_CXXFLAGS.win32)65 63 66 TEMPLATE_kPrf2_ASFLAGS.freebsd = -f elf32 -g 67 TEMPLATE_kPrf2_ASFLAGS.l4 = -f elf32 -g 68 TEMPLATE_kPrf2_ASFLAGS.linux = -f elf32 -g 64 TEMPLATE_kPrf2_ASFLAGS.freebsd = -f elf 65 TEMPLATE_kPrf2_ASFLAGS.linux = -f elf 69 66 TEMPLATE_kPrf2_ASFLAGS.os2 = -f omf 70 TEMPLATE_kPrf2_ASFLAGS.win32 = -f win32 -g 67 TEMPLATE_kPrf2_ASFLAGS.win.x86 = -f win32 -g cv8 68 TEMPLATE_kPrf2_ASFLAGS.win.amd64 = -f win64 -g cv8 71 69 72 TEMPLATE_kPrf2_INCS.win32= \73 $(PATH_DEV)/x86.win32/vcc70/include \74 $(PATH_DEV)/x86.win32/sdk200209/include70 #TEMPLATE_kPrf2_INCS.win = \ 71 # $(PATH_DEV)/x86.win32/vcc70/include \ 72 # $(PATH_DEV)/x86.win32/sdk200209/include 75 73 76 74 TEMPLATE_kPrf2_LDFLAGS.freebsd = -g 77 TEMPLATE_kPrf2_LDFLAGS.l4 = -g78 75 TEMPLATE_kPrf2_LDFLAGS.linux = -g 79 76 TEMPLATE_kPrf2_LDFLAGS.os2 = -g 80 TEMPLATE_kPrf2_LDFLAGS.win32 = /DEBUG 81 TEMPLATE_kPrf2_LDFLAGS.win64 = /DEBUG 77 TEMPLATE_kPrf2_LDFLAGS.win = /DEBUG 82 78 83 79 TEMPLATE_kPrf2_LIBS.freebsd = 84 TEMPLATE_kPrf2_LIBS.l4 =85 80 TEMPLATE_kPrf2_LIBS.linux = 86 81 TEMPLATE_kPrf2_LIBS.os2 = 87 TEMPLATE_kPrf2_LIBS.win32 = \ 82 TEMPLATE_kPrf2_LIBS.win = \ 83 $(PATH_SDK_WINPSDK_LIB)/psapi.Lib 84 TEMPLATE_kPrf2_LIBS.win.x86 = \ 88 85 $(PATH_TOOL_VCC70_LIB)/msvcrt.lib \ 89 86 $(PATH_TOOL_VCC70_LIB)/msvcprt.lib \ 90 $(PATH_TOOL_VCC70_LIB)/oldnames.lib \ 91 $(PATH_DEV)/x86.win32/sdk200209/lib/Kernel32.Lib \ 92 $(PATH_DEV)/x86.win32/sdk200209/lib/psapi.Lib 87 $(PATH_TOOL_VCC70_LIB)/oldnames.lib 93 88 94 89 … … 105 100 # kProfileR0.cpp 106 101 107 kPrf2_SOURCES.win 32= \108 dllmain-win 32.cpp \109 kPrf2-win32.def\110 prfx86msc.asm111 prfx86msc.asm_DEFS.win 32= \102 kPrf2_SOURCES.win = \ 103 dllmain-win.cpp \ 104 prf$(BUILD_TARGET_ARCH)msc.asm \ 105 kPrf2-win-$(BUILD_TARGET_ARCH).def 106 prfx86msc.asm_DEFS.win.x86 = \ 112 107 KPRF_ENTER=_KPrfEnter \ 113 108 KPRF_LEAVE=_KPrfLeave … … 119 114 # 120 115 kPrf2Read_TEMPLATE = kPrf2 121 kPrf2Read_INCS = \122 $(PATH_CURRENT)/../include \123 $(PATH_ROOT)/include124 kPrf2Read_DEFS = IN_RING3 IN_RT_R3125 116 kPrf2Read_SOURCES = \ 126 kPrf2Read.cpp \ 117 kPrf2Read.cpp 118 119 # kDbg stuff 120 KDBG_ROOT ?= $(PATH_CURRENT)/../kProfile 121 kPrf2Read_INCS += $(KDBG_ROOT) 122 kPrf2Read_SOURCES += \ 127 123 dbgmodule.cpp \ 128 124 dbgline.cpp \ 129 125 dbgsymbol.cpp 130 ifeq ($( filter-out win32 win64,$(BUILD_TARGET)),)131 kPrf2Read_SOURCES += dbgModPE-win32.cpp126 ifeq ($(BUILD_TARGET),win) 127 kPrf2Read_SOURCES.win += dbgModPE-win.cpp 132 128 else 133 129 kPrf2Read_SOURCES += dbgModPE-generic.cpp 134 130 endif 135 kPrf2Read_LIBS = \ 136 $(LIB_RUNTIME) 137 kPrf2Read_LIBS.win32 = \ 138 $(PATH_DEV)/x86.win32/sdk200209/lib/uuid.Lib \ 139 $(PATH_DEV)/x86.win32/sdk200209/lib/Version.Lib 131 132 # kLdr stuff 133 KLDR_ROOT ?= $(PATH_CURRENT)/../kLdr 134 kPrf2Read_INCS += $(KLDR_ROOT) 135 136 # IPRT stuff 137 VBOX_ROOT ?= y:/coding/vbox/svn/trunk 138 kPrf2Read_INCS += $(VBOX_ROOT)/include 139 kPrf2Read_DEFS += IN_RING3 IN_RT_R3 KDBG_USE_IPRT KCOMMON_ALREADY_INCLUDED_STD_TYPES 140 ifeq ($(BUILD_TARGET),win) 141 kPrf2Read_LIBS = \ 142 $(VBOX_ROOT)/out/$(BUILD_TARGET).$(BUILD_TARGET_ARCH)/$(BUILD_TYPE)/lib/VBoxRT$(SUFF_LIB) 143 else 144 kPrf2Read_LIBS = \ 145 $(VBOX_ROOT)/out/$(BUILD_TARGET).$(BUILD_TARGET_ARCH)/$(BUILD_TYPE)/bin/VBoxRT$(SUFF_DLL) 146 endif 140 147 141 148 142 149 # 150 # A simple testcase. 151 # 152 PROGRAMS.win.x86 += tst 143 153 tst_TOOL = VCC70 154 tst_SDKS = WINPSDK 144 155 tst_CFLAGS = -GH -Gh -Zi -Zl -GR- -GX- -GF- -MD -W3 -wd4244 145 156 tst_SOURCES = tst.c … … 150 161 $(PATH_TOOL_VCC70_LIB)/msvcprt.lib \ 151 162 $(PATH_TOOL_VCC70_LIB)/oldnames.lib \ 152 $(PATH_DEV)/x86.win32/sdk200209/lib/Kernel32.Lib \153 163 $(PATH_kPrf2)/kPrf2.lib 154 164 -
trunk/kProfile/dbgModPE-generic.cpp
r3524 r3526 37 37 #include <iprt/thread.h> 38 38 #include <iprt/alloca.h> 39 #include "kDbgBase.h" 39 40 #include "DBGInternal.h" 40 #include " internal/ldrPE.h"41 #include "kLdrModPE.h" 41 42 42 43 … … 276 277 */ 277 278 IMAGE_FILE_HEADER FHdr; 278 int rc = RTFileReadAt(File, offHdr + OFFSETOF(IMAGE_NT_HEADERS32, FileHeader), &FHdr, sizeof(FHdr), NULL);279 int rc = RTFileReadAt(File, offHdr + KDBG_OFFSETOF(IMAGE_NT_HEADERS32, FileHeader), &FHdr, sizeof(FHdr), NULL); 279 280 AssertRCReturn(rc, rc); 280 281 281 282 uint32_t cbImage; 282 283 if (FHdr.SizeOfOptionalHeader == sizeof(IMAGE_OPTIONAL_HEADER32)) 283 rc = RTFileReadAt(File, offHdr + OFFSETOF(IMAGE_NT_HEADERS32, OptionalHeader.SizeOfImage),284 rc = RTFileReadAt(File, offHdr + KDBG_OFFSETOF(IMAGE_NT_HEADERS32, OptionalHeader.SizeOfImage), 284 285 &cbImage, sizeof(cbImage), NULL); 285 286 else if (FHdr.SizeOfOptionalHeader == sizeof(IMAGE_OPTIONAL_HEADER64)) 286 rc = RTFileReadAt(File, offHdr + OFFSETOF(IMAGE_NT_HEADERS64, OptionalHeader.SizeOfImage),287 rc = RTFileReadAt(File, offHdr + KDBG_OFFSETOF(IMAGE_NT_HEADERS64, OptionalHeader.SizeOfImage), 287 288 &cbImage, sizeof(cbImage), NULL); 288 289 else … … 293 294 * Allocate the module and read/construct the section headers. 294 295 */ 295 PRTDBGMODPE pModPe = (PRTDBGMODPE)RTMemAlloc( OFFSETOF(RTDBGMODPE, aSections[FHdr.NumberOfSections + 2]));296 PRTDBGMODPE pModPe = (PRTDBGMODPE)RTMemAlloc(KDBG_OFFSETOF(RTDBGMODPE, aSections[FHdr.NumberOfSections + 2])); 296 297 AssertReturn(pModPe, VERR_NO_MEMORY); 297 298 pModPe->Core.u32Magic = RTDBGMOD_MAGIC; … … 300 301 pModPe->cbImage = cbImage; 301 302 pModPe->cSections = 1 + FHdr.NumberOfSections; 302 rc = RTFileReadAt(File, offHdr + OFFSETOF(IMAGE_NT_HEADERS32, OptionalHeader) + FHdr.SizeOfOptionalHeader,303 rc = RTFileReadAt(File, offHdr + KDBG_OFFSETOF(IMAGE_NT_HEADERS32, OptionalHeader) + FHdr.SizeOfOptionalHeader, 303 304 &pModPe->aSections[1], sizeof(pModPe->aSections[0]) * FHdr.NumberOfSections, NULL); 304 305 if (RT_SUCCESS(rc)) -
trunk/kProfile/dbgModPE-win.cpp
r3524 r3526 41 41 #include <iprt/thread.h> 42 42 #include <iprt/alloca.h> 43 #include "kDbgBase.h" 43 44 #include "DBGInternal.h" 44 45 … … 561 562 */ 562 563 IMAGE_FILE_HEADER FHdr; 563 int rc = RTFileReadAt(File, offHdr + OFFSETOF(IMAGE_NT_HEADERS32, FileHeader), &FHdr, sizeof(FHdr), NULL);564 int rc = RTFileReadAt(File, offHdr + KDBG_OFFSETOF(IMAGE_NT_HEADERS32, FileHeader), &FHdr, sizeof(FHdr), NULL); 564 565 AssertRCReturn(rc, rc); 565 566 566 567 uint32_t cbImage; 567 568 if (FHdr.SizeOfOptionalHeader == sizeof(IMAGE_OPTIONAL_HEADER32)) 568 rc = RTFileReadAt(File, offHdr + OFFSETOF(IMAGE_NT_HEADERS32, OptionalHeader.SizeOfImage),569 rc = RTFileReadAt(File, offHdr + KDBG_OFFSETOF(IMAGE_NT_HEADERS32, OptionalHeader.SizeOfImage), 569 570 &cbImage, sizeof(cbImage), NULL); 570 571 else if (FHdr.SizeOfOptionalHeader == sizeof(IMAGE_OPTIONAL_HEADER64)) 571 rc = RTFileReadAt(File, offHdr + OFFSETOF(IMAGE_NT_HEADERS64, OptionalHeader.SizeOfImage),572 rc = RTFileReadAt(File, offHdr + KDBG_OFFSETOF(IMAGE_NT_HEADERS64, OptionalHeader.SizeOfImage), 572 573 &cbImage, sizeof(cbImage), NULL); 573 574 else … … 585 586 * Allocate the module and read/construct the section headers. 586 587 */ 587 PRTDBGMODPE pModPe = (PRTDBGMODPE)RTMemAlloc( OFFSETOF(RTDBGMODPE, aSections[FHdr.NumberOfSections + 2]));588 PRTDBGMODPE pModPe = (PRTDBGMODPE)RTMemAlloc(KDBG_OFFSETOF(RTDBGMODPE, aSections[FHdr.NumberOfSections + 2])); 588 589 AssertReturn(pModPe, VERR_NO_MEMORY); 589 590 pModPe->Core.u32Magic = RTDBGMOD_MAGIC; … … 592 593 pModPe->cbImage = cbImage; 593 594 pModPe->cSections = 1 + FHdr.NumberOfSections; 594 rc = RTFileReadAt(File, offHdr + OFFSETOF(IMAGE_NT_HEADERS32, OptionalHeader) + FHdr.SizeOfOptionalHeader,595 rc = RTFileReadAt(File, offHdr + KDBG_OFFSETOF(IMAGE_NT_HEADERS32, OptionalHeader) + FHdr.SizeOfOptionalHeader, 595 596 &pModPe->aSections[1], sizeof(pModPe->aSections[0]) * FHdr.NumberOfSections, NULL); 596 597 if (RT_SUCCESS(rc)) -
trunk/kProfile/dbgline.cpp
r3524 r3526 34 34 35 35 #include "dbg.h" 36 #include "kDbgBase.h" 36 37 37 38 … … 50 51 { 51 52 AssertMsgReturn(VALID_PTR(pLine), ("%p\n", pLine), NULL); 52 size_t cb = OFFSETOF(RTDBGLINE, szFile[pLine->cchFile + 1]);53 size_t cb = KDBG_OFFSETOF(RTDBGLINE, szFile[pLine->cchFile + 1]); 53 54 return (PRTDBGLINE)RTMemDup(pLine, cb); 54 55 } -
trunk/kProfile/dbgmodule.cpp
r3524 r3526 29 29 * Header Files * 30 30 *******************************************************************************/ 31 #include <iprt/file.h> 32 #include <iprt/string.h> 33 #include <iprt/err.h> 34 #include <iprt/assert.h> 35 #include <iprt/alloc.h> 36 31 #ifdef KDBG_USE_IPRT 32 # include <iprt/file.h> 33 # include <iprt/string.h> 34 # include <iprt/err.h> 35 # include <iprt/assert.h> 36 # include <iprt/alloc.h> 37 #else 38 #endif 39 40 #include "kDbgBase.h" 37 41 #include "DBGInternal.h" 38 #include "internal/ldrMZ.h"39 #include "internal/ldrPE.h"42 #include <kLdrModMZ.h> 43 #include <kLdrModPE.h> 40 44 41 45 … … 79 83 /* new header? */ 80 84 uint32_t offNewHeader; 81 rc = RTFileReadAt(File, OFFSETOF(IMAGE_DOS_HEADER, e_lfanew), &offNewHeader, sizeof(offNewHeader), NULL);85 rc = RTFileReadAt(File, KDBG_OFFSETOF(IMAGE_DOS_HEADER, e_lfanew), &offNewHeader, sizeof(offNewHeader), NULL); 82 86 if (RT_SUCCESS(rc) && offNewHeader) 83 87 { -
trunk/kProfile/dbgsymbol.cpp
r3524 r3526 33 33 #include <iprt/alloc.h> 34 34 35 #include "kDbgBase.h" 35 36 #include "dbg.h" 36 37 … … 50 51 { 51 52 AssertMsgReturn(VALID_PTR(pSymbol), ("%p\n", pSymbol), NULL); 52 size_t cb = OFFSETOF(RTDBGSYMBOL, szName[pSymbol->cchName + 1]);53 size_t cb = KDBG_OFFSETOF(RTDBGSYMBOL, szName[pSymbol->cchName + 1]); 53 54 return (PRTDBGSYMBOL)RTMemDup(pSymbol, cb); 54 55 } -
trunk/kProfile/kDbgBase.h
r3525 r3526 2 2 /** @file 3 3 * 4 * k Ldr - The Dynamic Loader, Base Definitions and Typedefs.4 * kDbg - The Debug Info Reader, Base Definitions and Typedefs. 5 5 * 6 6 * Copyright (c) 2006-2007 knut st. osmundsen <bird@anduin.net> 7 7 * 8 8 * 9 * This file is part of k Ldr.9 * This file is part of kDbg. 10 10 * 11 * k Ldris free software; you can redistribute it and/or modify11 * kDbg is free software; you can redistribute it and/or modify 12 12 * it under the terms of the GNU General Public License as published by 13 13 * the Free Software Foundation; either version 2 of the License, or 14 14 * (at your option) any later version. 15 15 * 16 * k Ldris distributed in the hope that it will be useful,16 * kDbg is distributed in the hope that it will be useful, 17 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the … … 20 20 * 21 21 * You should have received a copy of the GNU General Public License 22 * along with k Ldr; if not, write to the Free Software22 * along with kDbg; if not, write to the Free Software 23 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 24 * 25 25 */ 26 26 27 #ifndef ___k LdrBase_h___28 #define ___k LdrBase_h___27 #ifndef ___kDbgBase_h___ 28 #define ___kDbgBase_h___ 29 29 30 30 31 /** @defgroup grp_k LdrBase kLdrBase - Base Definitions And Typedefs31 /** @defgroup grp_kDbgBase kDbgBase - Base Definitions And Typedefs 32 32 * @{ */ 33 33 34 34 /* 35 * kLdr depend on size_t, [u]intNN_t, [u]intptr_t and some related constants. 36 * If KLDR_ALREADY_INCLUDED_STD_TYPES is defined, these has already been defined. 35 * kDbg depend on size_t, [u]intNN_t, [u]intptr_t and some related constants. 36 * If KDBG_ALREADY_INCLUDED_STD_TYPES or KCOMMON_ALREADY_INCLUDED_STD_TYPES 37 * is defined, these has already been defined. 37 38 */ 38 #ifndef KLDR_ALREADY_INCLUDED_STD_TYPES 39 #if !defined(KDBG_ALREADY_INCLUDED_STD_TYPES) && !defined(KCOMMON_ALREADY_INCLUDED_STD_TYPES) 40 # define KCOMMON_ALREADY_INCLUDED_STD_TYPES 1 39 41 # include <sys/types.h> 40 42 # include <stddef.h> … … 73 75 # include <stdint.h> 74 76 # endif 75 #endif /* !K LDR_ALREADY_INCLUDED_STD_TYPES */77 #endif /* !KDBG_ALREADY_INCLUDED_STD_TYPES && !KCOMMON_ALREADY_INCLUDED_STD_TYPES */ 76 78 77 79 78 80 /** Get the minimum of two values. */ 79 #define K LDR_MIN(a, b) ((a) <= (b) ? (a) : (b))81 #define KDBG_MIN(a, b) ((a) <= (b) ? (a) : (b)) 80 82 /** Get the maximum of two values. */ 81 #define K LDR_MAX(a, b) ((a) >= (b) ? (a) : (b))83 #define KDBG_MAX(a, b) ((a) >= (b) ? (a) : (b)) 82 84 /** Calculate the offset of a structure member. */ 83 #define K LDR_OFFSETOF(strct, memb) ( (size_t)( &((strct *)0)->memb ) )85 #define KDBG_OFFSETOF(strct, memb) ( (size_t)( &((strct *)0)->memb ) ) 84 86 /** Align a size_t value. */ 85 #define K LDR_ALIGN_Z(val, align) ( ((val) + ((align) - 1)) & ~(size_t)((align) - 1) )87 #define KDBG_ALIGN_Z(val, align) ( ((val) + ((align) - 1)) & ~(size_t)((align) - 1) ) 86 88 /** Align a void * value. */ 87 #define K LDR_ALIGN_P(pv, align) ( (void *)( ((uintptr_t)(pv) + ((align) - 1)) & ~(uintptr_t)((align) - 1) ) )89 #define KDBG_ALIGN_P(pv, align) ( (void *)( ((uintptr_t)(pv) + ((align) - 1)) & ~(uintptr_t)((align) - 1) ) ) 88 90 /** Align a size_t value. */ 89 #define K LDR_ALIGN_ADDR(val, align) ( ((val) + ((align) - 1)) & ~(KLDRADDR)((align) - 1) )91 #define KDBG_ALIGN_ADDR(val, align) ( ((val) + ((align) - 1)) & ~(KLDRADDR)((align) - 1) ) 90 92 /** Number of elements in an array. */ 91 #define K LDR_ELEMENTS(a) ( sizeof(a) / sizeof((a)[0]) )93 #define KDBG_ELEMENTS(a) ( sizeof(a) / sizeof((a)[0]) ) 92 94 93 95 94 /** @def K LDR_LITTLE_ENDIAN95 * The k Ldrbuild is for a little endian target. */96 /** @def K LDR_BIG_ENDIAN97 * The k Ldrbuild is for a big endian target. */98 #if !defined(K LDR_LITTLE_ENDIAN) && !defined(KLDR_BIG_ENDIAN)99 # define K LDR_LITTLE_ENDIAN96 /** @def KDBG_LITTLE_ENDIAN 97 * The kDbg build is for a little endian target. */ 98 /** @def KDBG_BIG_ENDIAN 99 * The kDbg build is for a big endian target. */ 100 #if !defined(KDBG_LITTLE_ENDIAN) && !defined(KDBG_BIG_ENDIAN) 101 # define KDBG_LITTLE_ENDIAN 100 102 #endif 101 103 #ifdef __DOXYGEN__ 102 # define K LDR_BIG_ENDIAN104 # define KDBG_BIG_ENDIAN 103 105 #endif 104 106 … … 107 109 * @{ */ 108 110 109 /** @def K LDR_E2E_U16111 /** @def KDBG_E2E_U16 110 112 * Convert the endian of an unsigned 16-bit value. */ 111 # define K LDR_E2E_U16(u16) ( (uint16_t) (((u16) >> 8) | ((u16) << 8)) )112 /** @def K LDR_E2E_U32113 # define KDBG_E2E_U16(u16) ( (uint16_t) (((u16) >> 8) | ((u16) << 8)) ) 114 /** @def KDBG_E2E_U32 113 115 * Convert the endian of an unsigned 32-bit value. */ 114 # define K LDR_E2E_U32(u32) ( ( ((u32) & UINT32_C(0xff000000)) >> 24 ) \116 # define KDBG_E2E_U32(u32) ( ( ((u32) & UINT32_C(0xff000000)) >> 24 ) \ 115 117 | ( ((u32) & UINT32_C(0x00ff0000)) >> 8 ) \ 116 118 | ( ((u32) & UINT32_C(0x0000ff00)) << 8 ) \ 117 119 | ( ((u32) & UINT32_C(0x000000ff)) << 24 ) \ 118 120 ) 119 /** @def K LDR_E2E_U64121 /** @def KDBG_E2E_U64 120 122 * Convert the endian of an unsigned 64-bit value. */ 121 # define K LDR_E2E_U64(u64) ( ( ((u64) & UINT64_C(0xff00000000000000)) >> 56 ) \123 # define KDBG_E2E_U64(u64) ( ( ((u64) & UINT64_C(0xff00000000000000)) >> 56 ) \ 122 124 | ( ((u64) & UINT64_C(0x00ff000000000000)) >> 40 ) \ 123 125 | ( ((u64) & UINT64_C(0x0000ff0000000000)) >> 24 ) \ … … 129 131 ) 130 132 131 /** @def K LDR_LE2H_U16133 /** @def KDBG_LE2H_U16 132 134 * Unsigned 16-bit little-endian to host endian. */ 133 /** @def K LDR_LE2H_U32135 /** @def KDBG_LE2H_U32 134 136 * Unsigned 32-bit little-endian to host endian. */ 135 /** @def K LDR_LE2H_U64137 /** @def KDBG_LE2H_U64 136 138 * Unsigned 64-bit little-endian to host endian. */ 137 /** @def K LDR_BE2H_U16139 /** @def KDBG_BE2H_U16 138 140 * Unsigned 16-bit big-endian to host endian. */ 139 /** @def K LDR_BE2H_U32141 /** @def KDBG_BE2H_U32 140 142 * Unsigned 32-bit big-endian to host endian. */ 141 /** @def K LDR_BE2H_U64143 /** @def KDBG_BE2H_U64 142 144 * Unsigned 64-bit big-endian to host endian. */ 143 #ifdef K LDR_LITTLE_ENDIAN144 # define K LDR_LE2H_U16(u16) ((uint16_t)(u16))145 # define K LDR_LE2H_U32(u32) ((uint32_t)(u32))146 # define K LDR_LE2H_U64(u64) ((uint32_t)(u32))147 # define K LDR_BE2H_U16(u16) KLDR_E2E_U16(u16)148 # define K LDR_BE2H_U32(u32) KLDR_E2E_U32(u32)149 # define K LDR_BE2H_U64(u64) KLDR_E2E_U64(u64)150 #elif defined(K LDR_BIG_ENDIAN)151 # define K LDR_LE2H_U16(u16) KLDR_E2E_U16(u16)152 # define K LDR_LE2H_U32(u32) KLDR_E2E_U32(u32)153 # define K LDR_LE2H_U32(u64) KLDR_E2E_U64(u64)154 # define K LDR_BE2H_U16(u16) ((uint16_t)(u16))155 # define K LDR_BE2H_U32(u32) ((uint32_t)(u32))156 # define K LDR_BE2H_U64(u64) ((uint32_t)(u32))145 #ifdef KDBG_LITTLE_ENDIAN 146 # define KDBG_LE2H_U16(u16) ((uint16_t)(u16)) 147 # define KDBG_LE2H_U32(u32) ((uint32_t)(u32)) 148 # define KDBG_LE2H_U64(u64) ((uint32_t)(u32)) 149 # define KDBG_BE2H_U16(u16) KDBG_E2E_U16(u16) 150 # define KDBG_BE2H_U32(u32) KDBG_E2E_U32(u32) 151 # define KDBG_BE2H_U64(u64) KDBG_E2E_U64(u64) 152 #elif defined(KDBG_BIG_ENDIAN) 153 # define KDBG_LE2H_U16(u16) KDBG_E2E_U16(u16) 154 # define KDBG_LE2H_U32(u32) KDBG_E2E_U32(u32) 155 # define KDBG_LE2H_U32(u64) KDBG_E2E_U64(u64) 156 # define KDBG_BE2H_U16(u16) ((uint16_t)(u16)) 157 # define KDBG_BE2H_U32(u32) ((uint32_t)(u32)) 158 # define KDBG_BE2H_U64(u64) ((uint32_t)(u32)) 157 159 #else 158 # error "K LDR_BIG_ENDIAN or KLDR_LITTLE_ENDIAN is supposed to be defined."160 # error "KDBG_BIG_ENDIAN or KDBG_LITTLE_ENDIAN is supposed to be defined." 159 161 #endif 160 162 -
trunk/kProfile/kPrf2Read.cpp
r3524 r3526 34 34 #include <string.h> 35 35 #include <stdarg.h> 36 37 /* iprt dependencies */ 36 #if 0 37 # ifdef KPRF_OS_WINDOWS 38 # include <malloc.h> 39 typedef unsigned char uint8_t; 40 typedef signed char int8_t; 41 typedef unsigned short uint16_t; 42 typedef signed short int16_t; 43 typedef unsigned int uint32_t; 44 typedef signed int int32_t; 45 typedef unsigned _int64 uint64_t; 46 typedef signed _int64 int64_t; 47 typedef size_t uintptr_t; 48 # else 49 # include <stdint.h> 50 # endif 51 #else 52 /* iprt mode */ 38 53 #include <iprt/types.h> 39 54 #include <iprt/err.h> 40 55 #include <iprt/avl.h> 41 #include "dbg.h"42 56 #if 1 43 57 # include <iprt/alloc.h> … … 45 59 # define free(pv) RTMemFree(pv) 46 60 #endif 61 #endif 62 63 #include "dbg.h" 47 64 48 65 -
trunk/kProfile/kProfileR3.cpp
r3524 r3526 4 4 * Header Files * 5 5 *******************************************************************************/ 6 #if defined( __WIN32__) || defined(__WIN64__)6 #if defined(KPRF_OS_WINDOWS) 7 7 # include <windows.h> 8 8 # include <psapi.h> 9 9 # include <malloc.h> 10 # define IN_RING3 11 # include <iprt/stdint.h> /* Temporary IPRT convenience */ 10 typedef unsigned char uint8_t; 11 typedef signed char int8_t; 12 typedef unsigned short uint16_t; 13 typedef signed short int16_t; 14 typedef unsigned int uint32_t; 15 typedef signed int int32_t; 16 typedef unsigned _int64 uint64_t; 17 typedef signed _int64 int64_t; 18 typedef size_t uintptr_t; 12 19 # if _MSC_VER >= 1400 13 20 # include <intrin.h> … … 15 22 # endif 16 23 17 #elif defined( __LINUX__) || defined(__FREEBSD__)24 #elif defined(KPRF_OS_LINUX) || defined(KPRF_OS_FREEBSD) 18 25 # define KPRF_USE_PTHREAD 19 26 # include <pthread.h> … … 28 35 # endif 29 36 30 #elif defined( __OS2__)37 #elif defined(KPRF_OS_OS2) 31 38 # define INCL_BASE 32 # include <os2 s.h>39 # include <os2.h> 33 40 # include <stdint.h> 34 41 # include <sys/fmutex.h> … … 44 51 #define KPRF_NAME(Suffix) KPrf##Suffix 45 52 #define KPRF_TYPE(Prefix,Suffix) Prefix##KPRF##Suffix 46 #if defined( __WIN32__) || defined(__WIN64__) || defined(__OS2__)53 #if defined(KPRF_OS_WINDOWS) || defined(KPRF_OS_OS2) 47 54 # define KPRF_DECL_FUNC(type, name) extern "C" __declspec(dllexport) type __cdecl KPRF_NAME(name) 48 55 #else … … 53 60 # define KPRF_ASSERT(expr) do { if (!(expr)) { __asm__ __volatile__("int3\n\tnop\n\t");} } while (0) 54 61 # else 55 # define KPRF_ASSERT(expr) do { if (!(expr)) { __asm int 3 \ 56 } } while (0) 62 # define KPRF_ASSERT(expr) do { if (!(expr)) { __debugbreak(); } } while (0) 57 63 # endif 58 64 #else … … 70 76 #if defined(KPRF_USE_PTHREAD) 71 77 typedef pthread_mutex_t KPRF_TYPE(,MUTEX); 72 #elif defined( __WIN32__) || defined(__WIN64__)78 #elif defined(KPRF_OS_WINDOWS) 73 79 typedef CRITICAL_SECTION KPRF_TYPE(,MUTEX); 74 #elif defined( __OS2__)80 #elif defined(KPRF_OS_OS2) 75 81 typedef struct _fmutex KPRF_TYPE(,MUTEX); 76 82 #endif … … 82 88 /** Read/Write lock type. */ 83 89 typedef pthread_rwlock_t KPRF_TYPE(,RWLOCK); 84 #elif defined( __WIN32__) || defined(__WIN64__) || defined(__OS2__)90 #elif defined(KPRF_OS_WINDOWS) || defined(KPRF_OS_OS2) 85 91 /** Read/Write lock state. */ 86 92 typedef enum KPRF_TYPE(,RWLOCKSTATE) … … 108 114 /** The current number of waiting writers. */ 109 115 uint32_t cWritersWaiting; 110 # if defined( __WIN32__) || defined(__WIN64__)116 # if defined(KPRF_OS_WINDOWS) 111 117 /** The handle of the event object on which the waiting readers block. (manual reset). */ 112 118 HANDLE hevReaders; 113 119 /** The handle of the event object on which the waiting writers block. (manual reset). */ 114 120 HANDLE hevWriters; 115 # elif defined( __OS2__)121 # elif defined(KPRF_OS_OS2) 116 122 /** The handle of the event semaphore on which the waiting readers block. */ 117 123 HEV hevReaders; … … 132 138 *******************************************************************************/ 133 139 /** The TLS index / key. */ 134 #if defined( __WIN32__) || defined(__WIN64__)140 #if defined(KPRF_OS_WINDOWS) 135 141 static DWORD g_dwThreadTLS = TLS_OUT_OF_INDEXES; 136 142 … … 138 144 static pthread_key_t g_ThreadKey = (pthread_key_t)-1; 139 145 140 #elif defined( __OS2__)146 #elif defined(KPRF_OS_OS2) 141 147 static KPRF_TYPE(P,THREAD) *g_ppThread = NULL; 142 148 … … 187 193 188 194 /* Win32/64 */ 189 #if defined( __WIN32__) || defined(__WIN64__)195 #if defined(KPRF_OS_WINDOWS) 190 196 pThread = (KPRF_TYPE(P,THREAD))TlsGetValue(g_dwThreadTLS); 191 197 … … 194 200 pThread = (KPRF_TYPE(P,THREAD))pthread_getspecific(g_ThreadKey); 195 201 196 #elif defined( __OS2__)202 #elif defined(KPRF_OS_OS2) 197 203 pThread = *g_ppThread; 198 204 … … 215 221 { 216 222 /* Win32/64 */ 217 #if defined( __WIN32__) || defined(__WIN64__)223 #if defined(KPRF_OS_WINDOWS) 218 224 uintptr_t ThreadId = (uintptr_t)GetCurrentThreadId(); 219 225 … … 222 228 uintptr_t ThreadId = (uintptr_t)pthread_self(); 223 229 224 #elif defined( __OS2__)230 #elif defined(KPRF_OS_OS2) 225 231 PTIB pTib; 226 232 PPIB pPib; … … 245 251 { 246 252 /* Win32/64 */ 247 #if defined( __WIN32__) || defined(__WIN64__)253 #if defined(KPRF_OS_WINDOWS) 248 254 uintptr_t ThreadId = (uintptr_t)GetProcessId(GetCurrentProcess()); 249 255 250 #elif defined( __OS2__)256 #elif defined(KPRF_OS_OS2) 251 257 PTIB pTib; 252 258 PPIB pPib; … … 275 281 { 276 282 /* Win32/64 */ 277 #if defined( __WIN32__) || defined(__WIN64__)283 #if defined(KPRF_OS_WINDOWS) 278 284 BOOL fRc = TlsSetValue(g_dwThreadTLS, pThread); 279 285 … … 282 288 int rc = pthread_setspecific(g_ThreadKey, pThread); 283 289 284 #elif defined( __OS2__)290 #elif defined(KPRF_OS_OS2) 285 291 *g_ppThread = pThread; 286 292 … … 333 339 { 334 340 #if defined(HAVE_INTRIN) 335 _InterlockedExchange(( int32_t *)pu32, (const int32_t)u32);341 _InterlockedExchange((long volatile *)pu32, (const long)u32); 336 342 337 343 #elif defined(__GNUC__) … … 404 410 { 405 411 #if defined(HAVE_INTRIN) 406 _InterlockedExchangeAdd 32((volatile int32_t *)pu32, (const int32_t)u32);412 _InterlockedExchangeAdd((volatile long *)pu32, (const long)u32); 407 413 408 414 #elif defined(__GNUC__) … … 482 488 return -1; 483 489 484 #elif defined( __WIN32__) || defined(__WIN64__)490 #elif defined(KPRF_OS_WINDOWS) 485 491 InitializeCriticalSection(pMutex); 486 492 return 0; 487 493 488 #elif defined( __OS2__)494 #elif defined(KPRF_OS_OS2) 489 495 if (!_fmutex_create(pMutex, 0)) 490 496 return 0; … … 503 509 pthread_mutex_destroy(pMutex); 504 510 505 #elif defined( __WIN32__) || defined(__WIN64__)511 #elif defined(KPRF_OS_WINDOWS) 506 512 DeleteCriticalSection(pMutex); 507 513 508 #elif defined( __OS2__)514 #elif defined(KPRF_OS_OS2) 509 515 _fmutex_close(pMutex); 510 516 #endif … … 517 523 static inline void kPrfMutexAcquire(KPRF_TYPE(P,MUTEX) pMutex) 518 524 { 519 #if defined( __WIN32__) || defined(__WIN64__)525 #if defined(KPRF_OS_WINDOWS) 520 526 EnterCriticalSection(pMutex); 521 527 … … 523 529 pthread_mutex_lock(pMutex); 524 530 525 #elif defined( __OS2__)531 #elif defined(KPRF_OS_OS2) 526 532 fmutex_request(pMutex); 527 533 #endif … … 535 541 static inline void kPrfMutexRelease(KPRF_TYPE(P,MUTEX) pMutex) 536 542 { 537 #if defined( __WIN32__) || defined(__WIN64__)543 #if defined(KPRF_OS_WINDOWS) 538 544 LeaveCriticalSection(pMutex); 539 545 … … 541 547 pthread_mutex_lock(pMutex); 542 548 543 #elif defined( __OS2__)549 #elif defined(KPRF_OS_OS2) 544 550 fmutex_request(pMutex); 545 551 #endif … … 568 574 return -1; 569 575 570 #elif defined( __WIN32__) || defined(__WIN64__) || defined(__OS2__)576 #elif defined(KPRF_OS_WINDOWS) || defined(KPRF_OS_OS2) 571 577 if (kPrfMutexInit(&pRWLock->Mutex)) 572 578 return -1; … … 575 581 pRWLock->cWritersWaiting = 0; 576 582 pRWLock->enmState = RWLOCK_STATE_SHARED; 577 # if defined( __WIN32__) || defined(__WIN64__)583 # if defined(KPRF_OS_WINDOWS) 578 584 pRWLock->hevReaders = CreateEvent(NULL, TRUE, TRUE, NULL); 579 585 pRWLock->hevWriters = CreateEvent(NULL, FALSE, FALSE, NULL); … … 584 590 CloseHandle(pRWLock->hevWriters); 585 591 586 # elif defined( __OS2__)592 # elif defined(KPRF_OS_OS2) 587 593 APIRET rc = DosCreateEventSem(NULL, &pRWLock->hevReaders, 0, TRUE); 588 594 if (!rc) … … 614 620 pthread_rwlock_destroy(pRWLock); 615 621 616 #elif defined( __WIN32__) || defined(__WIN64__) || defined(__OS2__)622 #elif defined(KPRF_OS_WINDOWS) || defined(KPRF_OS_OS2) 617 623 if (pRWLock->enmState == RWLOCK_STATE_UNINITIALIZED) 618 624 return; … … 623 629 pRWLock->cReadersWaiting = 0; 624 630 pRWLock->cWritersWaiting = 0; 625 # if defined( __WIN32__) || defined(__WIN64__)631 # if defined(KPRF_OS_WINDOWS) 626 632 CloseHandle(pRWLock->hevReaders); 627 633 pRWLock->hevReaders = INVALID_HANDLE_VALUE; … … 629 635 pRWLock->hevWriters = INVALID_HANDLE_VALUE; 630 636 631 # elif defined( __OS2__)637 # elif defined(KPRF_OS_OS2) 632 638 DosCloseEventSem(pRWLock->hevReaders); 633 639 pRWLock->hevReaders = NULLHANDLE; … … 648 654 pthread_rwlock_rdlock(pRWLock); 649 655 650 #elif defined( __WIN32__) || defined(__WIN64__) || defined(__OS2__)656 #elif defined(KPRF_OS_WINDOWS) || defined(KPRF_OS_OS2) 651 657 if (pRWLock->enmState == RWLOCK_STATE_UNINITIALIZED) 652 658 return; … … 664 670 /* have to wait */ 665 671 KPRF_ATOMIC_INC32(&pRWLock->cReadersWaiting); 666 # if defined( __WIN32__) || defined(__WIN64__)672 # if defined(KPRF_OS_WINDOWS) 667 673 HANDLE hev = pRWLock->hevReaders; 668 674 ResetEvent(hev); 669 675 670 # elif defined( __OS2__)676 # elif defined(KPRF_OS_OS2) 671 677 HEV hev = pRWLock->hevReaders; 672 678 ULONG cIgnored; … … 676 682 kPrfMutexRelease(&pRWLock->Mutex); 677 683 678 # if defined( __WIN32__) || defined(__WIN64__)684 # if defined(KPRF_OS_WINDOWS) 679 685 switch (WaitForSingleObject(hev, INFINITE)) 680 686 { … … 688 694 } 689 695 690 # elif defined( __OS2__)696 # elif defined(KPRF_OS_OS2) 691 697 switch (DosWaitEventSem(hev, SEM_INDEFINITE_WAIT)) 692 698 { … … 723 729 pthread_rwlock_unlock(pRWLock); 724 730 725 #elif defined( __WIN32__) || defined(__WIN64__) || defined(__OS2__)731 #elif defined(KPRF_OS_WINDOWS) || defined(KPRF_OS_OS2) 726 732 if (pRWLock->enmState == RWLOCK_STATE_UNINITIALIZED) 727 733 return; … … 747 753 * Wake up one (or more on OS/2) waiting writers. 748 754 */ 749 # if defined( __WIN32__) || defined(__WIN64__)755 # if defined(KPRF_OS_WINDOWS) 750 756 SetEvent(pRWLock->hevWriters); 751 # elif defined( __OS2__)757 # elif defined(KPRF_OS_OS2) 752 758 DosPostEvent(pRWLock->hevwriters); 753 759 # endif … … 767 773 pthread_rwlock_wrlock(pRWLock); 768 774 769 #elif defined( __WIN32__) || defined(__WIN64__) || defined(__OS2__)775 #elif defined(KPRF_OS_WINDOWS) || defined(KPRF_OS_OS2) 770 776 if (pRWLock->enmState == RWLOCK_STATE_UNINITIALIZED) 771 777 return; … … 790 796 for (;;) 791 797 { 792 # if defined( __WIN32__) || defined(__WIN64__)798 # if defined(KPRF_OS_WINDOWS) 793 799 HANDLE hev = pRWLock->hevWriters; 794 # elif defined( __OS2__)800 # elif defined(KPRF_OS_OS2) 795 801 HEV hev = pRWLock->hevWriters; 796 802 # endif 797 803 kPrfMutexRelease(&pRWLock->Mutex); 798 # if defined( __WIN32__) || defined(__WIN64__)804 # if defined(KPRF_OS_WINDOWS) 799 805 switch (WaitForSingleObject(hev, INFINITE)) 800 806 { … … 809 815 } 810 816 811 # elif defined( __OS2__)817 # elif defined(KPRF_OS_OS2) 812 818 switch (DosWaitEventSem(hev, SEM_INDEFINITE_WAIT)) 813 819 { … … 853 859 pthread_rwlock_unlock(pRWLock); 854 860 855 #elif defined( __WIN32__) || defined(__WIN64__) || defined(__OS2__)861 #elif defined(KPRF_OS_WINDOWS) || defined(KPRF_OS_OS2) 856 862 if (pRWLock->enmState == RWLOCK_STATE_UNINITIALIZED) 857 863 return; … … 878 884 * Someone is waiting, wake them up as we change the state. 879 885 */ 880 # if defined( __WIN32__) || defined(__WIN64__)886 # if defined(KPRF_OS_WINDOWS) 881 887 HANDLE hev = INVALID_HANDLE_VALUE; 882 # elif defined( __OS2__)888 # elif defined(KPRF_OS_OS2) 883 889 HEV hev = NULLHANDLE; 884 890 # endif … … 894 900 hev = pRWLock->hevReaders; 895 901 } 896 # if defined( __WIN32__) || defined(__WIN64__)902 # if defined(KPRF_OS_WINDOWS) 897 903 SetEvent(hev); 898 # elif defined( __OS2__)904 # elif defined(KPRF_OS_OS2) 899 905 DosPostEvent(pRWLock->hevwriters); 900 906 # endif … … 919 925 KPRF_TYPE(P,UPTR) puBasePtr, KPRF_TYPE(P,UPTR) pcbSegmentMinusOne) 920 926 { 921 #if defined( __WIN32__) || defined(__WIN64__)927 #if defined(KPRF_OS_WINDOWS) 922 928 /* 923 929 * Enumerate the module handles. … … 1037 1043 } 1038 1044 1039 #elif defined( __OS2__)1045 #elif defined(KPRF_OS_OS2) 1040 1046 /* 1041 1047 * Just ask the loader. … … 1118 1124 * Some limit stuff in posix / ansi also comes to mind... */ 1119 1125 1120 #elif defined( __OS2__)1126 #elif defined(KPRF_OS_OS2) 1121 1127 PTIB pTib; 1122 1128 PPIB pPib; … … 1148 1154 static char *kPrfGetEnvString(const char *pszVar, char *pszValue, uint32_t cchValue, const char *pszDefault) 1149 1155 { 1150 #if defined( __WIN32__) || defined(__WIN64__)1156 #if defined(KPRF_OS_WINDOWS) 1151 1157 if (GetEnvironmentVariable(pszVar, pszValue, cchValue)) 1152 1158 return pszValue; 1153 1159 1154 #elif defined( __OS2__)1160 #elif defined(KPRF_OS_OS2) 1155 1161 PSZ pszValue; 1156 1162 if ( !DosScanEnv((PCSZ)pszVar, &pszValue) … … 1187 1193 static uint32_t kPrfGetEnvValue(const char *pszVar, uint32_t uDefault) 1188 1194 { 1189 #if defined( __WIN32__) || defined(__WIN64__)1195 #if defined(KPRF_OS_WINDOWS) 1190 1196 char szBuf[128]; 1191 1197 const char *pszValue = szBuf; … … 1193 1199 pszValue = NULL; 1194 1200 1195 #elif defined( __OS2__)1201 #elif defined(KPRF_OS_OS2) 1196 1202 PSZ pszValue; 1197 1203 if (DosScanEnv((PCSZ)pszVar, &pszValue)) … … 1275 1281 static void *kPrfAllocMem(uint32_t cb) 1276 1282 { 1277 #if defined( __WIN32__) || defined(__WIN64__)1283 #if defined(KPRF_OS_WINDOWS) 1278 1284 void *pv = VirtualAlloc(NULL, cb, MEM_COMMIT, PAGE_EXECUTE_READWRITE); 1279 1285 … … 1281 1287 void *pv = mmap(NULL, cb, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); 1282 1288 1283 #elif defined( __OS2__)1289 #elif defined(KPRF_OS_OS2) 1284 1290 void *pv; 1285 1291 # ifdef INCL_DOSEXAPIS … … 1304 1310 static void kPrfFreeMem(void *pv) 1305 1311 { 1306 #if defined( __WIN32__) || defined(__WIN64__)1312 #if defined(KPRF_OS_WINDOWS) 1307 1313 VirtualFree(pv, 0, MEM_RELEASE); 1308 1314 … … 1310 1316 munmap(pv, 0); /** @todo check if 0 is allowed here.. */ 1311 1317 1312 #elif defined( __OS2__)1318 #elif defined(KPRF_OS_OS2) 1313 1319 # ifdef INCL_DOSEXAPIS 1314 1320 DosFreeMemEx(&pv); … … 1338 1344 static int kPrfWriteFile(const char *pszName, const void *pvData, uint32_t cbData) 1339 1345 { 1340 #if defined( __WIN32__) || defined(__WIN64__)1346 #if defined(KPRF_OS_WINDOWS) 1341 1347 int rc = -1; 1342 1348 HANDLE hFile = CreateFile(pszName,GENERIC_WRITE, FILE_SHARE_READ, NULL, … … 1352 1358 return rc; 1353 1359 1354 #elif defined( __OS2__)1360 #elif defined(KPRF_OS_OS2) 1355 1361 HFILE hFile; 1356 1362 ULONG ulAction = 0; … … 1436 1442 * Allocate the TLS entry. 1437 1443 */ 1438 #if defined( __WIN32__) || defined(__WIN64__)1444 #if defined(KPRF_OS_WINDOWS) 1439 1445 g_dwThreadTLS = TlsAlloc(); 1440 1446 if (g_dwThreadTLS != TLS_OUT_OF_INDEXES) … … 1444 1450 if (!rc) 1445 1451 1446 #elif defined( __OS2__)1452 #elif defined(KPRF_OS_OS2) 1447 1453 int rc = DosAllocThreadLocalMemory(sizeof(void *), (PULONG*)&g_ppThread); /** @todo check if this is a count or a size. */ 1448 1454 if (!rc) … … 1489 1495 return -1; 1490 1496 1491 #if defined( __WIN32__) || defined(__WIN64__)1497 #if defined(KPRF_OS_WINDOWS) 1492 1498 Sleep(10); 1493 #elif defined( __OS2__)1499 #elif defined(KPRF_OS_OS2) 1494 1500 DosSleep(10); 1495 1501 #else … … 1505 1511 * Use the stack space to fill in process details. 1506 1512 */ 1507 #if defined( __WIN32__) || defined(__WIN64__)1513 #if defined(KPRF_OS_WINDOWS) 1508 1514 /* all is one single string */ 1509 1515 const char *pszCommandLine = GetCommandLine(); … … 1511 1517 KPRF_NAME(SetCommandLine)(pHdr, 1, &pszCommandLine); 1512 1518 1513 #elif defined( __OS2__) || defined(__OS2__)1519 #elif defined(KPRF_OS_OS2) || defined(KPRF_OS_OS2) 1514 1520 PTIB pTib; 1515 1521 PPIB pPib; … … 1575 1581 */ 1576 1582 kPrfFreeMem(pHdr); 1577 #if defined( __WIN32__) || defined(__WIN64__)1583 #if defined(KPRF_OS_WINDOWS) 1578 1584 TlsFree(g_dwThreadTLS); 1579 1585 g_dwThreadTLS = TLS_OUT_OF_INDEXES; … … 1583 1589 g_ThreadKey = (pthread_key_t)-1; 1584 1590 1585 #elif defined( __OS2__)1591 #elif defined(KPRF_OS_OS2) 1586 1592 DosFreeThreadLocalMemory((PULONG)g_ppThread); 1587 1593 g_ppThread = NULL; -
trunk/kProfile/prfamd64msc.asm
r3524 r3526 2 2 ;; @file 3 3 ; 4 ; kProfiler MK2 - Microsoft C/C++ Compiler Interaction .4 ; kProfiler MK2 - Microsoft C/C++ Compiler Interaction, AMD64. 5 5 ; 6 6 ; … … 38 38 extern KPRF_LEAVE 39 39 40 global _ _penter41 global _ _pexit40 global _penter 41 global _pexit 42 42 43 43 ;ifdef UNDEFINED … … 46 46 global common_no_overhead 47 47 global calibrate 48 global outer_calibration_loop49 global inner_calibration_loop50 48 global calib_inner_update_minimum 51 49 global calib_inner_next … … 75 73 ; 76 74 align 16 77 _ _penter:75 _penter: 78 76 ; save volatile register and get the time stamp. 79 77 push eax … … 116 114 ; 117 115 align 16 118 _ _pexit:116 _pexit: 119 117 ; save volatile register and get the time stamp. 120 118 push eax … … 280 278 281 279 ;; 282 ; The calibration _ _penter - this must be identical to the real thing except for the KPRF call.280 ; The calibration _penter - this must be identical to the real thing except for the KPRF call. 283 281 align 16 284 282 calib_penter: … … 305 303 306 304 ;; 307 ; The calibration _ _pexit - this must be identical to the real thing except for the KPRF call.305 ; The calibration _pexit - this must be identical to the real thing except for the KPRF call. 308 306 align 16 309 307 calib_pexit: -
trunk/kProfile/prfx86msc.asm
r3524 r3526 46 46 global common_no_overhead 47 47 global calibrate 48 global outer_calibration_loop49 global inner_calibration_loop50 48 global calib_inner_update_minimum 51 49 global calib_inner_next
Note:
See TracChangeset
for help on using the changeset viewer.