diff options
author | Lorry Tar Creator <lorry-tar-importer@baserock.org> | 2014-03-26 19:21:20 +0000 |
---|---|---|
committer | <> | 2014-05-08 15:03:54 +0000 |
commit | fb123f93f9f5ce42c8e5785d2f8e0edaf951740e (patch) | |
tree | c2103d76aec5f1f10892cd1d3a38e24f665ae5db /src/VBox/Runtime/include | |
parent | 58ed4748338f9466599adfc8a9171280ed99e23f (diff) | |
download | VirtualBox-master.tar.gz |
Imported from /home/lorry/working-area/delta_VirtualBox/VirtualBox-4.3.10.tar.bz2.HEADVirtualBox-4.3.10master
Diffstat (limited to 'src/VBox/Runtime/include')
28 files changed, 825 insertions, 781 deletions
diff --git a/src/VBox/Runtime/include/internal/alignmentchecks.h b/src/VBox/Runtime/include/internal/alignmentchecks.h index 96e96e88..38f69153 100644 --- a/src/VBox/Runtime/include/internal/alignmentchecks.h +++ b/src/VBox/Runtime/include/internal/alignmentchecks.h @@ -4,7 +4,7 @@ */ /* - * Copyright (C) 2009 Oracle Corporation + * Copyright (C) 2009-2010 Oracle Corporation * * This file is part of VirtualBox Open Source Edition (OSE), as * available from http://www.virtualbox.org. This file is free software; diff --git a/src/VBox/Runtime/include/internal/assert.h b/src/VBox/Runtime/include/internal/assert.h index ef6334a6..0db64e04 100644 --- a/src/VBox/Runtime/include/internal/assert.h +++ b/src/VBox/Runtime/include/internal/assert.h @@ -4,7 +4,7 @@ */ /* - * Copyright (C) 2009 Oracle Corporation + * Copyright (C) 2009-2011 Oracle Corporation * * This file is part of VirtualBox Open Source Edition (OSE), as * available from http://www.virtualbox.org. This file is free software; diff --git a/src/VBox/Runtime/include/internal/dbgmod.h b/src/VBox/Runtime/include/internal/dbgmod.h index 577da5c0..2d06044d 100644 --- a/src/VBox/Runtime/include/internal/dbgmod.h +++ b/src/VBox/Runtime/include/internal/dbgmod.h @@ -4,7 +4,7 @@ */ /* - * Copyright (C) 2008-2011 Oracle Corporation + * Copyright (C) 2008-2012 Oracle Corporation * * This file is part of VirtualBox Open Source Edition (OSE), as * available from http://www.virtualbox.org. This file is free software; @@ -74,8 +74,9 @@ typedef struct RTDBGMODVTIMG * * Upon successful return the method is expected to * initialize pImgOps and pvImgPriv. + * @param enmArch The desired architecture. */ - DECLCALLBACKMEMBER(int, pfnTryOpen)(PRTDBGMODINT pMod); + DECLCALLBACKMEMBER(int, pfnTryOpen)(PRTDBGMODINT pMod, RTLDRARCH enmArch); /** * Close the interpreter, freeing all associated resources. @@ -116,6 +117,21 @@ typedef struct RTDBGMODVTIMG DECLCALLBACKMEMBER(int, pfnEnumSegments)(PRTDBGMODINT pMod, PFNRTLDRENUMSEGS pfnCallback, void *pvUser); /** + * Enumerates the symbols exported by the module. + * + * @returns iprt status code, which might have been returned by pfnCallback. + * @param pMod Pointer to the module structure. + * @param fFlags Flags indicating what to return and such. + * @param BaseAddress The image base addressto use when calculating the + * symbol values. + * @param pfnCallback The callback function which each symbol is to be fed + * to. + * @param pvUser User argument to pass to the enumerator. + */ + DECLCALLBACKMEMBER(int, pfnEnumSymbols)(PRTDBGMODINT pMod, uint32_t fFlags, RTLDRADDR BaseAddress, + PFNRTLDRENUMSYMS pfnCallback, void *pvUser); + + /** * Gets the size of the loaded image. * * Identical to RTLdrSize. @@ -140,16 +156,33 @@ typedef struct RTDBGMODVTIMG PRTDBGSEGIDX piSeg, PRTLDRADDR poffSeg); /** + * Converts an image relative virtual address to a segment:offset. + * + * @returns IPRT status code. + * + * @param pMod Pointer to the loader module structure. + * @param Rva The RVA to convert. + * @param piSeg The segment index. + * @param poffSeg Where to return the segment offset. + */ + DECLCALLBACKMEMBER(int, pfnRvaToSegOffset)(PRTDBGMODINT pMod, RTLDRADDR Rva, uint32_t *piSeg, PRTLDRADDR poffSeg); + + /** * Creates a read-only mapping of a part of the image file. * * @returns IPRT status code and *ppvMap set on success. * * @param pMod Pointer to the module structure. + * @param iDbgInfo The debug info ordinal number if the request + * corresponds exactly to a debug info part from + * pfnEnumDbgInfo. Otherwise, pass UINT32_MAX. * @param off The offset into the image file. * @param cb The number of bytes to map. * @param ppvMap Where to return the mapping address on success. + * + * @remarks Fixups will only be applied if @a iDbgInfo is specified. */ - DECLCALLBACKMEMBER(int, pfnMapPart)(PRTDBGMODINT pMod, RTFOFF off, size_t cb, void const **ppvMap); + DECLCALLBACKMEMBER(int, pfnMapPart)(PRTDBGMODINT pMod, uint32_t iDbgInfo, RTFOFF off, size_t cb, void const **ppvMap); /** * Unmaps memory previously mapped by pfnMapPart. @@ -163,6 +196,36 @@ typedef struct RTDBGMODVTIMG */ DECLCALLBACKMEMBER(int, pfnUnmapPart)(PRTDBGMODINT pMod, size_t cb, void const **ppvMap); + /** + * Reads data from the image file. + * + * @returns IPRT status code, *ppvMap set to NULL on success. + * + * @param pMod Pointer to the module structure. + * @param iDbgInfoHint The debug info ordinal number hint, pass UINT32_MAX + * if not know or sure. + * @param off The offset into the image file. + * @param pvBuf The buffer to read into. + * @param cb The number of bytes to read. + */ + DECLCALLBACKMEMBER(int, pfnReadAt)(PRTDBGMODINT pMod, uint32_t iDbgInfoHint, RTFOFF off, void *pvBuf, size_t cb); + + /** + * Gets the image format. + * + * @returns Valid image format on success, RTLDRFMT_INVALID if not supported. + * @param pMod Pointer to the module structure. + */ + DECLCALLBACKMEMBER(RTLDRFMT, pfnGetFormat)(PRTDBGMODINT pMod); + + /** + * Gets the image architecture. + * + * @returns Valid image architecutre on success, RTLDRARCH_WHATEVER if not + * supported. + * @param pMod Pointer to the module structure. + */ + DECLCALLBACKMEMBER(RTLDRARCH, pfnGetArch)(PRTDBGMODINT pMod); /** For catching initialization errors (RTDBGMODVTIMG_MAGIC). */ uint32_t u32EndMagic; @@ -203,8 +266,9 @@ typedef struct RTDBGMODVTDBG * * Upon successful return the method is expected to * initialize pDbgOps and pvDbgPriv. + * @param enmArch The desired architecture. */ - DECLCALLBACKMEMBER(int, pfnTryOpen)(PRTDBGMODINT pMod); + DECLCALLBACKMEMBER(int, pfnTryOpen)(PRTDBGMODINT pMod, RTLDRARCH enmArch); /** * Close the interpreter, freeing all associated resources. @@ -443,6 +507,64 @@ typedef RTDBGMODVTDBG const *PCRTDBGMODVTDBG; /** + * Deferred loading callback. + * + * @returns IPRT status code. On success the necessary method tables should be + * installed in @a pMod. + * @param pMod Pointer to the debug module structure. + * @param pDeferred The deferred load data. + */ +typedef DECLCALLBACK(int) FNRTDBGMODDEFERRED(PRTDBGMODINT pMod, struct RTDBGMODDEFERRED *pDeferred); +/** Pointer to a deferred loading callback. */ +typedef FNRTDBGMODDEFERRED *PFNRTDBGMODDEFERRED; + + +/** + * Structure pointed to by pvDbgPriv and/or pvImgPriv when + * g_rtDbgModVtDbgDeferred and/or g_rtDbgModVtImgDeferred are being used. + */ +typedef struct RTDBGMODDEFERRED +{ + /** The image size. + * Deferred loading is almost pointless without knowing the module size, as + * it cannot be mapped (correctly) without it. */ + RTUINTPTR cbImage; + /** Reference counter. */ + uint32_t volatile cRefs; + /** The configuration instance (referenced), can be NIL. */ + RTDBGCFG hDbgCfg; + /** Performs deferred loading of the module. */ + PFNRTDBGMODDEFERRED pfnDeferred; + /** Callback specific data. */ + union + { + struct + { + /** The time/date stamp of the executable image and codeview file. */ + uint32_t uTimestamp; + } PeImage, + OldCodeView; + + struct + { + /** The PDB uuid. */ + RTUUID Uuid; + /** The PDB age. */ + uint32_t uAge; + } NewCodeview; + + struct + { + /** The CRC-32 value found in the .gnu_debuglink section. */ + uint32_t uCrc32; + } GnuDebugLink; + } u; +} RTDBGMODDEFERRED; +/** Pointer to the deferred loading data. */ +typedef RTDBGMODDEFERRED *PRTDBGMODDEFERRED; + + +/** * Debug module structure. */ typedef struct RTDBGMODINT @@ -454,16 +576,29 @@ typedef struct RTDBGMODINT uint32_t volatile cRefs; /** The module tag. */ uint64_t uTag; + + /** When set, the loading of the image and debug info (including locating any + * external files), will not have taken place yet. */ + uint32_t fDeferred : 1; + /** Set if deferred loading failed. */ + uint32_t fDeferredFailed : 1; + /** Set if the debug info is based on image exports and segments. */ + uint32_t fExports : 1; + /** Alignment padding. */ + uint32_t fPadding1 : 29; +#if ARCH_BITS == 64 + uint32_t u32Padding2; +#endif + /** The module name (short). */ char const *pszName; + /** The image file specified by the user. Can be NULL. */ + char const *pszImgFileSpecified; /** The module filename. Can be NULL. */ char const *pszImgFile; /** The debug info file (if external). Can be NULL. */ char const *pszDbgFile; - /** Critical section serializing access to the module. */ - RTCRITSECT CritSect; - /** The method table for the executable image interpreter. */ PCRTDBGMODVTIMG pImgVt; /** Pointer to the private data of the executable image interpreter. */ @@ -474,17 +609,36 @@ typedef struct RTDBGMODINT /** Pointer to the private data of the debug info interpreter. */ void *pvDbgPriv; + /** Critical section serializing access to the module. */ + RTCRITSECT CritSect; } RTDBGMODINT; /** Pointer to an debug module structure. */ typedef RTDBGMODINT *PRTDBGMODINT; extern DECLHIDDEN(RTSTRCACHE) g_hDbgModStrCache; +extern DECLHIDDEN(RTDBGMODVTDBG const) g_rtDbgModVtDbgCodeView; extern DECLHIDDEN(RTDBGMODVTDBG const) g_rtDbgModVtDbgDwarf; extern DECLHIDDEN(RTDBGMODVTDBG const) g_rtDbgModVtDbgNm; +#ifdef RT_OS_WINDOWS +extern DECLHIDDEN(RTDBGMODVTDBG const) g_rtDbgModVtDbgDbgHelp; +#endif +extern DECLHIDDEN(RTDBGMODVTDBG const) g_rtDbgModVtDbgDeferred; +extern DECLHIDDEN(RTDBGMODVTDBG const) g_rtDbgModVtDbgContainer; + extern DECLHIDDEN(RTDBGMODVTIMG const) g_rtDbgModVtImgLdr; +extern DECLHIDDEN(RTDBGMODVTIMG const) g_rtDbgModVtImgDeferred; + +DECLHIDDEN(int) rtDbgModContainerCreate(PRTDBGMODINT pMod, RTUINTPTR cbSeg); +DECLHIDDEN(int) rtDbgModContainer_SymbolRemoveAll(PRTDBGMODINT pMod); +DECLHIDDEN(int) rtDbgModContainer_LineRemoveAll(PRTDBGMODINT pMod); +DECLHIDDEN(int) rtDbgModContainer_RemoveAll(PRTDBGMODINT pMod); + +DECLHIDDEN(int) rtDbgModCreateForExports(PRTDBGMODINT pDbgMod); +DECLHIDDEN(int) rtDbgModDeferredCreate(PRTDBGMODINT pDbgMod, PFNRTDBGMODDEFERRED pfnDeferred, RTUINTPTR cbImage, + RTDBGCFG hDbgCfg, PRTDBGMODDEFERRED *ppDeferred); -int rtDbgModContainerCreate(PRTDBGMODINT pMod, RTUINTPTR cbSeg); +DECLHIDDEN(int) rtDbgModLdrOpenFromHandle(PRTDBGMODINT pDbgMod, RTLDRMOD hLdrMod); /** @} */ diff --git a/src/VBox/Runtime/include/internal/dir.h b/src/VBox/Runtime/include/internal/dir.h index 987fe32a..8a85a1e6 100644 --- a/src/VBox/Runtime/include/internal/dir.h +++ b/src/VBox/Runtime/include/internal/dir.h @@ -4,7 +4,7 @@ */ /* - * Copyright (C) 2006-2007 Oracle Corporation + * Copyright (C) 2006-2011 Oracle Corporation * * This file is part of VirtualBox Open Source Edition (OSE), as * available from http://www.virtualbox.org. This file is free software; @@ -83,23 +83,55 @@ typedef struct RTDIR #endif /** The length of the converted filename. */ size_t cchName; + /** The size of this structure. */ + size_t cbSelf; -#ifdef RT_OS_WINDOWS +#ifndef RTDIR_AGNOSTIC +# ifdef RT_OS_WINDOWS /** Handle to the opened directory search. */ HANDLE hDir; +# ifndef RT_USE_NATIVE_NT /** Find data buffer. * fDataUnread indicates valid data. */ WIN32_FIND_DATAW Data; - -#else /* 'POSIX': */ +# else + /** The size of the name buffer pszName points to. */ + size_t cbNameAlloc; + /** NT filter string. */ + UNICODE_STRING NtFilterStr; + /** Pointer to NtFilterStr if applicable, otherwise NULL. */ + PUNICODE_STRING pNtFilterStr; + /** The information class we're using. */ + FILE_INFORMATION_CLASS enmInfoClass; + /** Object directory context data. */ + ULONG uObjDirCtx; + /** Pointer to the current data entry in the buffer. */ + union + { + /** Both file names, no file ID. */ + PFILE_BOTH_DIR_INFORMATION pBoth; + /** Both file names with file ID. */ + PFILE_ID_BOTH_DIR_INFORMATION pBothId; + /** Object directory info. */ + POBJECT_DIRECTORY_INFORMATION pObjDir; + /** Unsigned view. */ + uintptr_t u; + } uCurData; + /** The amount of valid data in the buffer. */ + uint32_t cbBuffer; + /** The allocate buffer size. */ + uint32_t cbBufferAlloc; + /** Find data buffer containing multiple directory entries. + * fDataUnread indicates valid data. */ + uint8_t *pabBuffer; +# endif +# else /* 'POSIX': */ /** What opendir() returned. */ DIR *pDir; - /** The max size of the d_name member. - * This includes the 0 terminator of course.*/ - size_t cbMaxName; /** Find data buffer. * fDataUnread indicates valid data. */ struct dirent Data; +# endif #endif } RTDIR; @@ -130,4 +162,12 @@ DECLINLINE(bool) rtDirValidHandle(PRTDIR pDir) */ int rtDirNativeOpen(PRTDIR pDir, char *pszPathBuf); +/** + * Returns the size of the directory structure. + * + * @returns The size in bytes. + * @param pszPath The path to the directory we're about to open. + */ +size_t rtDirNativeGetStructSize(const char *pszPath); + #endif diff --git a/src/VBox/Runtime/include/internal/dvm.h b/src/VBox/Runtime/include/internal/dvm.h index 0970900b..1064a128 100644 --- a/src/VBox/Runtime/include/internal/dvm.h +++ b/src/VBox/Runtime/include/internal/dvm.h @@ -4,7 +4,7 @@ */ /* - * Copyright (C) 2006-2007 Oracle Corporation + * Copyright (C) 2006-2012 Oracle Corporation * * This file is part of VirtualBox Open Source Edition (OSE), as * available from http://www.virtualbox.org. This file is free software; diff --git a/src/VBox/Runtime/include/internal/file.h b/src/VBox/Runtime/include/internal/file.h index c8efe1b7..c6e0e15c 100644 --- a/src/VBox/Runtime/include/internal/file.h +++ b/src/VBox/Runtime/include/internal/file.h @@ -4,7 +4,7 @@ */ /* - * Copyright (C) 2006-2007 Oracle Corporation + * Copyright (C) 2006-2011 Oracle Corporation * * This file is part of VirtualBox Open Source Edition (OSE), as * available from http://www.virtualbox.org. This file is free software; diff --git a/src/VBox/Runtime/include/internal/fileaio.h b/src/VBox/Runtime/include/internal/fileaio.h index 81172acc..b5beb86d 100644 --- a/src/VBox/Runtime/include/internal/fileaio.h +++ b/src/VBox/Runtime/include/internal/fileaio.h @@ -4,7 +4,7 @@ */ /* - * Copyright (C) 2009 Oracle Corporation + * Copyright (C) 2009-2010 Oracle Corporation * * This file is part of VirtualBox Open Source Edition (OSE), as * available from http://www.virtualbox.org. This file is free software; diff --git a/src/VBox/Runtime/include/internal/fs.h b/src/VBox/Runtime/include/internal/fs.h index f5ba0429..00af45a4 100644 --- a/src/VBox/Runtime/include/internal/fs.h +++ b/src/VBox/Runtime/include/internal/fs.h @@ -4,7 +4,7 @@ */ /* - * Copyright (C) 2006-2007 Oracle Corporation + * Copyright (C) 2006-2010 Oracle Corporation * * This file is part of VirtualBox Open Source Edition (OSE), as * available from http://www.virtualbox.org. This file is free software; diff --git a/src/VBox/Runtime/include/internal/initterm.h b/src/VBox/Runtime/include/internal/initterm.h index 04472903..a7eebd6f 100644 --- a/src/VBox/Runtime/include/internal/initterm.h +++ b/src/VBox/Runtime/include/internal/initterm.h @@ -4,7 +4,7 @@ */ /* - * Copyright (C) 2006-2007 Oracle Corporation + * Copyright (C) 2006-2011 Oracle Corporation * * This file is part of VirtualBox Open Source Edition (OSE), as * available from http://www.virtualbox.org. This file is free software; diff --git a/src/VBox/Runtime/include/internal/iprt.h b/src/VBox/Runtime/include/internal/iprt.h index e408958e..3cadf9de 100644 --- a/src/VBox/Runtime/include/internal/iprt.h +++ b/src/VBox/Runtime/include/internal/iprt.h @@ -4,7 +4,7 @@ */ /* - * Copyright (C) 2009 Oracle Corporation + * Copyright (C) 2009-2012 Oracle Corporation * * This file is part of VirtualBox Open Source Edition (OSE), as * available from http://www.virtualbox.org. This file is free software; diff --git a/src/VBox/Runtime/include/internal/ldr.h b/src/VBox/Runtime/include/internal/ldr.h index f0c17eaa..9999827d 100644 --- a/src/VBox/Runtime/include/internal/ldr.h +++ b/src/VBox/Runtime/include/internal/ldr.h @@ -4,7 +4,7 @@ */ /* - * Copyright (C) 2006-2007 Oracle Corporation + * Copyright (C) 2006-2011 Oracle Corporation * * This file is part of VirtualBox Open Source Edition (OSE), as * available from http://www.virtualbox.org. This file is free software; @@ -296,13 +296,31 @@ typedef struct RTLDROPS * @returns IPRT status code. * * @param pMod Pointer to the loader module structure. - * @param iSeg The segment index. - * @param offSeg The segment offset. - * @param pRva Where to return the RVA. + * @param Rva The RVA to convert. + * @param piSeg Where to return the segment index. + * @param poffSeg Where to return the segment offset. * @remark This is an optional entry point that can be NULL. */ DECLCALLBACKMEMBER(int, pfnRvaToSegOffset)(PRTLDRMODINTERNAL pMod, RTLDRADDR Rva, uint32_t *piSeg, PRTLDRADDR poffSeg); + /** + * Reads a debug info part (section) from the image. + * + * This is primarily needed for getting DWARF sections in ELF image with fixups + * applied and won't be required by most other loader backends. + * + * @returns IPRT status code. + * + * @param pvBuf The buffer to read into. + * @param iDbgInfo The debug info ordinal number if the request + * corresponds exactly to a debug info part from + * pfnEnumDbgInfo. Otherwise, pass UINT32_MAX. + * @param off The offset into the image file. + * @param cb The number of bytes to read. + * @param pMod Pointer to the loader module structure. + */ + DECLCALLBACKMEMBER(int, pfnReadDbgInfo)(PRTLDRMODINTERNAL pMod, uint32_t iDbgInfo, RTFOFF off, size_t cb, void *pvBuf); + /** Dummy entry to make sure we've initialized it all. */ RTUINT uDummy; } RTLDROPS; @@ -402,6 +420,16 @@ typedef struct RTLDRMODINTERNAL RTLDRSTATE eState; /** Loader ops. */ PCRTLDROPS pOps; + /** Pointer to the reader instance. This is NULL for native image. */ + PRTLDRREADER pReader; + /** Image format. */ + RTLDRFMT enmFormat; + /** Image type. */ + RTLDRTYPE enmType; + /** Image endianness. */ + RTLDRENDIAN enmEndian; + /** Image target architecture. */ + RTLDRARCH enmArch; } RTLDRMODINTERNAL; @@ -430,7 +458,11 @@ typedef struct RTLDRMODNATIVE RTLDRMODINTERNAL Core; /** The native handle. */ uintptr_t hNative; -} RTLDRMODNATIVE, *PRTLDRMODNATIVE; + /** The load flags (RTLDRLOAD_FLAGS_XXX). */ + uint32_t fFlags; +} RTLDRMODNATIVE; +/** Pointer to a native module. */ +typedef RTLDRMODNATIVE *PRTLDRMODNATIVE; /** @copydoc RTLDROPS::pfnGetSymbol */ DECLCALLBACK(int) rtldrNativeGetSymbol(PRTLDRMODINTERNAL pMod, const char *pszSymbol, void **ppvValue); @@ -443,11 +475,22 @@ DECLCALLBACK(int) rtldrNativeClose(PRTLDRMODINTERNAL pMod); * @returns iprt status code. * @param pszFilename The image filename. * @param phHandle Where to store the module handle on success. - * @param fFlags See RTLDRFLAGS_. + * @param fFlags RTLDRLOAD_FLAGS_XXX. * @param pErrInfo Where to return extended error information. Optional. */ int rtldrNativeLoad(const char *pszFilename, uintptr_t *phHandle, uint32_t fFlags, PRTERRINFO pErrInfo); +/** + * Load a system library. + * + * @returns iprt status code. + * @param pszFilename The image filename. + * @param pszExt Extension to add. NULL if none. + * @param fFlags RTLDRLOAD_FLAGS_XXX. + * @param phLdrMod Where to return the module handle on success. + */ +int rtldrNativeLoadSystem(const char *pszFilename, const char *pszExt, uint32_t fFlags, PRTLDRMOD phLdrMod); + int rtldrPEOpen(PRTLDRREADER pReader, uint32_t fFlags, RTLDRARCH enmArch, RTFOFF offNtHdrs, PRTLDRMOD phLdrMod); int rtldrELFOpen(PRTLDRREADER pReader, uint32_t fFlags, RTLDRARCH enmArch, PRTLDRMOD phLdrMod); int rtldrkLdrOpen(PRTLDRREADER pReader, uint32_t fFlags, RTLDRARCH enmArch, PRTLDRMOD phLdrMod); @@ -455,6 +498,8 @@ int rtldrkLdrOpen(PRTLDRREADER pReader, uint32_t fFlags, RTLDRARCH enmArch, PRTL int rtldrMachoOpen(PRTLDRREADER pReader, uint32_t fFlags, RTLDRARCH enmArch, RTFOFF offSomething, PRTLDRMOD phLdrMod);*/ +DECLHIDDEN(int) rtLdrReadAt(RTLDRMOD hLdrMod, void *pvBuf, uint32_t iDbgInfo, RTFOFF off, size_t cb); + RT_C_DECLS_END #endif diff --git a/src/VBox/Runtime/include/internal/ldrELF.h b/src/VBox/Runtime/include/internal/ldrELF.h index c52cd816..ecb354bd 100644 --- a/src/VBox/Runtime/include/internal/ldrELF.h +++ b/src/VBox/Runtime/include/internal/ldrELF.h @@ -4,7 +4,7 @@ */ /* - * Copyright (C) 2010 Oracle Corporation + * Copyright (C) 2010-2011 Oracle Corporation * * This file is part of VirtualBox Open Source Edition (OSE), as * available from http://www.virtualbox.org. This file is free software; diff --git a/src/VBox/Runtime/include/internal/ldrELF32.h b/src/VBox/Runtime/include/internal/ldrELF32.h index 0873357e..a6f789e8 100644 --- a/src/VBox/Runtime/include/internal/ldrELF32.h +++ b/src/VBox/Runtime/include/internal/ldrELF32.h @@ -4,7 +4,7 @@ */ /* - * Copyright (C) 2010 Oracle Corporation + * Copyright (C) 2010-2011 Oracle Corporation * * This file is part of VirtualBox Open Source Edition (OSE), as * available from http://www.virtualbox.org. This file is free software; diff --git a/src/VBox/Runtime/include/internal/ldrELF64.h b/src/VBox/Runtime/include/internal/ldrELF64.h index 8a60fd9c..30e1b555 100644 --- a/src/VBox/Runtime/include/internal/ldrELF64.h +++ b/src/VBox/Runtime/include/internal/ldrELF64.h @@ -4,7 +4,7 @@ */ /* - * Copyright (C) 2010 Oracle Corporation + * Copyright (C) 2010-2011 Oracle Corporation * * This file is part of VirtualBox Open Source Edition (OSE), as * available from http://www.virtualbox.org. This file is free software; diff --git a/src/VBox/Runtime/include/internal/ldrMZ.h b/src/VBox/Runtime/include/internal/ldrMZ.h index c6c15c16..2feab758 100644 --- a/src/VBox/Runtime/include/internal/ldrMZ.h +++ b/src/VBox/Runtime/include/internal/ldrMZ.h @@ -4,7 +4,7 @@ */ /* - * Copyright (C) 2006-2007 Oracle Corporation + * Copyright (C) 2006-2010 Oracle Corporation * * This file is part of VirtualBox Open Source Edition (OSE), as * available from http://www.virtualbox.org. This file is free software; diff --git a/src/VBox/Runtime/include/internal/ldrMach-O.h b/src/VBox/Runtime/include/internal/ldrMach-O.h deleted file mode 100644 index 502f931e..00000000 --- a/src/VBox/Runtime/include/internal/ldrMach-O.h +++ /dev/null @@ -1,625 +0,0 @@ -/* $Id: ldrMach-O.h $ */ -/** @file - * IPRT - Mach-O Structures and Constants. - */ - -/* - * Copyright (C) 2011-2012 Oracle Corporation - * - * This file is part of VirtualBox Open Source Edition (OSE), as - * available from http://www.virtualbox.org. This file is free software; - * you can redistribute it and/or modify it under the terms of the GNU - * General Public License (GPL) as published by the Free Software - * Foundation, in version 2 as it comes in the "COPYING" file of the - * VirtualBox OSE distribution. VirtualBox OSE is distributed in the - * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. - * - * The contents of this file may alternatively be used under the terms - * of the Common Development and Distribution License Version 1.0 - * (CDDL) only, as it comes in the "COPYING.CDDL" file of the - * VirtualBox OSE distribution, in which case the provisions of the - * CDDL are applicable instead of those of the GPL. - * - * You may elect to license modified versions of this file under the - * terms and conditions of either the GPL or the CDDL or both. - */ - -#ifndef ___internal_ldrMach_O_h -#define ___internal_ldrMach_O_h - -#include <iprt/types.h> - -#ifndef CPU_ARCH_MASK - -/* cputype */ -#define CPU_ARCH_MASK INT32_C(0xff000000) -#define CPU_ARCH_ABI64 INT32_C(0x01000000) -#define CPU_TYPE_ANY INT32_C(-1) -#define CPU_TYPE_VAX INT32_C(1) -#define CPU_TYPE_MC680x0 INT32_C(6) -#define CPU_TYPE_X86 INT32_C(7) -#define CPU_TYPE_I386 CPU_TYPE_X86 -#define CPU_TYPE_X86_64 (CPU_TYPE_X86 | CPU_ARCH_ABI64) -#define CPU_TYPE_MC98000 INT32_C(10) -#define CPU_TYPE_HPPA INT32_C(11) -#define CPU_TYPE_MC88000 INT32_C(13) -#define CPU_TYPE_SPARC INT32_C(14) -#define CPU_TYPE_I860 INT32_C(15) -#define CPU_TYPE_POWERPC INT32_C(18) -#define CPU_TYPE_POWERPC64 (CPU_TYPE_POWERPC | CPU_ARCH_ABI64) - -/* cpusubtype */ -#define CPU_SUBTYPE_MULTIPLE INT32_C(-1) -#define CPU_SUBTYPE_LITTLE_ENDIAN INT32_C(0) -#define CPU_SUBTYPE_BIG_ENDIAN INT32_C(1) - -#define CPU_SUBTYPE_VAX_ALL INT32_C(0) -#define CPU_SUBTYPE_VAX780 INT32_C(1) -#define CPU_SUBTYPE_VAX785 INT32_C(2) -#define CPU_SUBTYPE_VAX750 INT32_C(3) -#define CPU_SUBTYPE_VAX730 INT32_C(4) -#define CPU_SUBTYPE_UVAXI INT32_C(5) -#define CPU_SUBTYPE_UVAXII INT32_C(6) -#define CPU_SUBTYPE_VAX8200 INT32_C(7) -#define CPU_SUBTYPE_VAX8500 INT32_C(8) -#define CPU_SUBTYPE_VAX8600 INT32_C(9) -#define CPU_SUBTYPE_VAX8650 INT32_C(10) -#define CPU_SUBTYPE_VAX8800 INT32_C(11) -#define CPU_SUBTYPE_UVAXIII INT32_C(12) - -#define CPU_SUBTYPE_MC680x0_ALL INT32_C(1) -#define CPU_SUBTYPE_MC68030 INT32_C(1) -#define CPU_SUBTYPE_MC68040 INT32_C(2) -#define CPU_SUBTYPE_MC68030_ONLY INT32_C(3) - -#define CPU_SUBTYPE_INTEL(fam, model) ( (int32_t )(((model) << 4) | (fam)) ) -#define CPU_SUBTYPE_INTEL_FAMILY(subtype) ( (subtype) & 0xf ) -#define CPU_SUBTYPE_INTEL_MODEL(subtype) ( (subtype) >> 4 ) -#define CPU_SUBTYPE_INTEL_FAMILY_MAX 0xf -#define CPU_SUBTYPE_INTEL_MODEL_ALL 0 - -#define CPU_SUBTYPE_I386_ALL CPU_SUBTYPE_INTEL(3, 0) -#define CPU_SUBTYPE_386 CPU_SUBTYPE_INTEL(3, 0) -#define CPU_SUBTYPE_486 CPU_SUBTYPE_INTEL(4, 0) -#define CPU_SUBTYPE_486SX CPU_SUBTYPE_INTEL(4, 8) -#define CPU_SUBTYPE_586 CPU_SUBTYPE_INTEL(5, 0) -#define CPU_SUBTYPE_PENT CPU_SUBTYPE_INTEL(5, 0) -#define CPU_SUBTYPE_PENTPRO CPU_SUBTYPE_INTEL(6, 1) -#define CPU_SUBTYPE_PENTII_M3 CPU_SUBTYPE_INTEL(6, 3) -#define CPU_SUBTYPE_PENTII_M5 CPU_SUBTYPE_INTEL(6, 5) -#define CPU_SUBTYPE_CELERON CPU_SUBTYPE_INTEL(7, 6) -#define CPU_SUBTYPE_CELERON_MOBILE CPU_SUBTYPE_INTEL(7, 7) -#define CPU_SUBTYPE_PENTIUM_3 CPU_SUBTYPE_INTEL(8, 0) -#define CPU_SUBTYPE_PENTIUM_3_M CPU_SUBTYPE_INTEL(8, 1) -#define CPU_SUBTYPE_PENTIUM_3_XEON CPU_SUBTYPE_INTEL(8, 2) -#define CPU_SUBTYPE_PENTIUM_M CPU_SUBTYPE_INTEL(9, 0) -#define CPU_SUBTYPE_PENTIUM_4 CPU_SUBTYPE_INTEL(10, 0) -#define CPU_SUBTYPE_PENTIUM_4_M CPU_SUBTYPE_INTEL(10, 1) -#define CPU_SUBTYPE_ITANIUM CPU_SUBTYPE_INTEL(11, 0) -#define CPU_SUBTYPE_ITANIUM_2 CPU_SUBTYPE_INTEL(11, 1) -#define CPU_SUBTYPE_XEON CPU_SUBTYPE_INTEL(12, 0) -#define CPU_SUBTYPE_XEON_MP CPU_SUBTYPE_INTEL(12, 1) - -#define CPU_SUBTYPE_X86_ALL INT32_C(3) -#define CPU_SUBTYPE_X86_64_ALL INT32_C(3) -#define CPU_SUBTYPE_X86_ARCH1 INT32_C(4) - -#define CPU_SUBTYPE_MIPS_ALL INT32_C(0) -#define CPU_SUBTYPE_MIPS_R2300 INT32_C(1) -#define CPU_SUBTYPE_MIPS_R2600 INT32_C(2) -#define CPU_SUBTYPE_MIPS_R2800 INT32_C(3) -#define CPU_SUBTYPE_MIPS_R2000a INT32_C(4) -#define CPU_SUBTYPE_MIPS_R2000 INT32_C(5) -#define CPU_SUBTYPE_MIPS_R3000a INT32_C(6) -#define CPU_SUBTYPE_MIPS_R3000 INT32_C(7) - -#define CPU_SUBTYPE_MC98000_ALL INT32_C(0) -#define CPU_SUBTYPE_MC98601 INT32_C(1) - -#define CPU_SUBTYPE_HPPA_ALL INT32_C(0) -#define CPU_SUBTYPE_HPPA_7100 INT32_C(0) -#define CPU_SUBTYPE_HPPA_7100LC INT32_C(1) - -#define CPU_SUBTYPE_MC88000_ALL INT32_C(0) -#define CPU_SUBTYPE_MC88100 INT32_C(1) -#define CPU_SUBTYPE_MC88110 INT32_C(2) - -#define CPU_SUBTYPE_SPARC_ALL INT32_C(0) - -#define CPU_SUBTYPE_I860_ALL INT32_C(0) -#define CPU_SUBTYPE_I860_860 INT32_C(1) - -#define CPU_SUBTYPE_POWERPC_ALL INT32_C(0) -#define CPU_SUBTYPE_POWERPC_601 INT32_C(1) -#define CPU_SUBTYPE_POWERPC_602 INT32_C(2) -#define CPU_SUBTYPE_POWERPC_603 INT32_C(3) -#define CPU_SUBTYPE_POWERPC_603e INT32_C(4) -#define CPU_SUBTYPE_POWERPC_603ev INT32_C(5) -#define CPU_SUBTYPE_POWERPC_604 INT32_C(6) -#define CPU_SUBTYPE_POWERPC_604e INT32_C(7) -#define CPU_SUBTYPE_POWERPC_620 INT32_C(8) -#define CPU_SUBTYPE_POWERPC_750 INT32_C(9) -#define CPU_SUBTYPE_POWERPC_7400 INT32_C(10) -#define CPU_SUBTYPE_POWERPC_7450 INT32_C(11) -#define CPU_SUBTYPE_POWERPC_Max INT32_C(10) -#define CPU_SUBTYPE_POWERPC_SCVger INT32_C(11) -#define CPU_SUBTYPE_POWERPC_970 INT32_C(100) - -#define CPU_SUBTYPE_MASK UINT32_C(0xff000000) -#define CPU_SUBTYPE_LIB64 UINT32_C(0x80000000) - -#endif /* !CPU_ARCH_MASK */ - - -typedef struct fat_header -{ - uint32_t magic; - uint32_t nfat_arch; -} fat_header_t; - -#ifndef IMAGE_FAT_SIGNATURE -# define IMAGE_FAT_SIGNATURE UINT32_C(0xcafebabe) -#endif -#ifndef IMAGE_FAT_SIGNATURE_OE -# define IMAGE_FAT_SIGNATURE_OE UINT32_C(0xbebafeca) -#endif - -typedef struct fat_arch -{ - int32_t cputype; - int32_t cpusubtype; - uint32_t offset; - uint32_t size; - uint32_t align; -} fat_arch_t; - -typedef struct mach_header_32 -{ - uint32_t magic; - int32_t cputype; - int32_t cpusubtype; - uint32_t filetype; - uint32_t ncmds; - uint32_t sizeofcmds; - uint32_t flags; -} mach_header_32_t; - -/* magic */ -#ifndef IMAGE_MACHO32_SIGNATURE -# define IMAGE_MACHO32_SIGNATURE UINT32_C(0xfeedface) -#endif -#ifndef IMAGE_MACHO32_SIGNATURE_OE -# define IMAGE_MACHO32_SIGNATURE_OE UINT32_C(0xcefaedfe) -#endif -#define MH_MAGIC IMAGE_MACHO32_SIGNATURE -#define MH_CIGAM IMAGE_MACHO32_SIGNATURE_OE - -typedef struct mach_header_64 -{ - uint32_t magic; - int32_t cputype; - int32_t cpusubtype; - uint32_t filetype; - uint32_t ncmds; - uint32_t sizeofcmds; - uint32_t flags; - uint32_t reserved; -} mach_header_64_t; - -/* magic */ -#ifndef IMAGE_MACHO64_SIGNATURE -# define IMAGE_MACHO64_SIGNATURE UINT32_C(0xfeedfacf) -#endif -#ifndef IMAGE_MACHO64_SIGNATURE_OE -# define IMAGE_MACHO64_SIGNATURE_OE UINT32_C(0xfefaedfe) -#endif -#define MH_MAGIC_64 IMAGE_MACHO64_SIGNATURE -#define MH_CIGAM_64 IMAGE_MACHO64_SIGNATURE_OE - -/* mach_header_* filetype */ -#define MH_OBJECT UINT32_C(1) -#define MH_EXECUTE UINT32_C(2) -#define MH_FVMLIB UINT32_C(3) -#define MH_CORE UINT32_C(4) -#define MH_PRELOAD UINT32_C(5) -#define MH_DYLIB UINT32_C(6) -#define MH_DYLINKER UINT32_C(7) -#define MH_BUNDLE UINT32_C(8) -#define MH_DYLIB_STUB UINT32_C(9) -#define MH_DSYM UINT32_C(10) - -/* mach_header_* flags */ -#define MH_NOUNDEFS UINT32_C(0x00000001) -#define MH_INCRLINK UINT32_C(0x00000002) -#define MH_DYLDLINK UINT32_C(0x00000004) -#define MH_BINDATLOAD UINT32_C(0x00000008) -#define MH_PREBOUND UINT32_C(0x00000010) -#define MH_SPLIT_SEGS UINT32_C(0x00000020) -#define MH_LAZY_INIT UINT32_C(0x00000040) -#define MH_TWOLEVEL UINT32_C(0x00000080) -#define MH_FORCE_FLAT UINT32_C(0x00000100) -#define MH_NOMULTIDEFS UINT32_C(0x00000200) -#define MH_NOFIXPREBINDING UINT32_C(0x00000400) -#define MH_PREBINDABLE UINT32_C(0x00000800) -#define MH_ALLMODSBOUND UINT32_C(0x00001000) -#define MH_SUBSECTIONS_VIA_SYMBOLS UINT32_C(0x00002000) -#define MH_CANONICAL UINT32_C(0x00004000) -#define MH_WEAK_DEFINES UINT32_C(0x00008000) -#define MH_BINDS_TO_WEAK UINT32_C(0x00010000) -#define MH_ALLOW_STACK_EXECUTION UINT32_C(0x00020000) -#define MH_ROOT_SAFE UINT32_C(0x00040000) -#define MH_SETUID_SAFE UINT32_C(0x00080000) -#define MH_NO_REEXPORTED_DYLIBS UINT32_C(0x00100000) -#define MH_PIE UINT32_C(0x00200000) -#define MH_DEAD_STRIPPABLE_DYLIB UINT32_C(0x00400000) -#define MH_HAS_TLV_DESCRIPTORS UINT32_C(0x00800000) -#define MH_NO_HEAP_EXECUTION UINT32_C(0x01000000) -#define MH_VALID_FLAGS UINT32_C(0x01ffffff) - - -typedef struct load_command -{ - uint32_t cmd; - uint32_t cmdsize; -} load_command_t; - -/* load cmd */ -#define LC_REQ_DYLD UINT32_C(0x80000000) -#define LC_SEGMENT_32 UINT32_C(0x01) -#define LC_SYMTAB UINT32_C(0x02) -#define LC_SYMSEG UINT32_C(0x03) -#define LC_THREAD UINT32_C(0x04) -#define LC_UNIXTHREAD UINT32_C(0x05) -#define LC_LOADFVMLIB UINT32_C(0x06) -#define LC_IDFVMLIB UINT32_C(0x07) -#define LC_IDENT UINT32_C(0x08) -#define LC_FVMFILE UINT32_C(0x09) -#define LC_PREPAGE UINT32_C(0x0a) -#define LC_DYSYMTAB UINT32_C(0x0b) -#define LC_LOAD_DYLIB UINT32_C(0x0c) -#define LC_ID_DYLIB UINT32_C(0x0d) -#define LC_LOAD_DYLINKER UINT32_C(0x0e) -#define LC_ID_DYLINKER UINT32_C(0x0f) -#define LC_PREBOUND_DYLIB UINT32_C(0x10) -#define LC_ROUTINES UINT32_C(0x11) -#define LC_SUB_FRAMEWORK UINT32_C(0x12) -#define LC_SUB_UMBRELLA UINT32_C(0x13) -#define LC_SUB_CLIENT UINT32_C(0x14) -#define LC_SUB_LIBRARY UINT32_C(0x15) -#define LC_TWOLEVEL_HINTS UINT32_C(0x16) -#define LC_PREBIND_CKSUM UINT32_C(0x17) -#define LC_LOAD_WEAK_DYLIB (UINT32_C(0x18) | LC_REQ_DYLD) -#define LC_SEGMENT_64 UINT32_C(0x19) -#define LC_ROUTINES_64 UINT32_C(0x1a) -#define LC_UUID UINT32_C(0x1b) -#define LC_RPATH (UINT32_C(0x1c) | LC_REQ_DYLD) -#define LC_CODE_SIGNATURE UINT32_C(0x1d) -#define LC_SEGMENT_SPLIT_INFO UINT32_C(0x1e) -#define LC_REEXPORT_DYLIB (UINT32_C(0x1f) | LC_REQ_DYLD) -#define LC_LAZY_LOAD_DYLIB UINT32_C(0x20) -#define LC_ENCRYPTION_INFO UINT32_C(0x21) -#define LC_DYLD_INFO UINT32_C(0x22) -#define LC_DYLD_INFO_ONLY (UINT32_C(0x22) | LC_REQ_DYLD) -#define LC_LOAD_UPWARD_DYLIB (UINT32_C(0x23) | LC_REQ_DYLD) -#define LC_VERSION_MIN_MACOSX UINT32_C(0x24) -#define LC_VERSION_MIN_IPHONEOS UINT32_C(0x25) -#define LC_FUNCTION_STARTS UINT32_C(0x26) -#define LC_DYLD_ENVIRONMENT UINT32_C(0x27) -#define LC_MAIN (UINT32_C(0x28) | LC_REQ_DYLD) -#define LC_DATA_IN_CODE UINT32_C(0x29) -#define LC_SOURCE_VERSION UINT32_C(0x2a) -#define LC_DYLIB_CODE_SIGN_DRS UINT32_C(0x2b) - - -typedef struct lc_str -{ - uint32_t offset; -} lc_str_t; - -typedef struct segment_command_32 -{ - uint32_t cmd; - uint32_t cmdsize; - char segname[16]; - uint32_t vmaddr; - uint32_t vmsize; - uint32_t fileoff; - uint32_t filesize; - uint32_t maxprot; - uint32_t initprot; - uint32_t nsects; - uint32_t flags; -} segment_command_32_t; - -typedef struct segment_command_64 -{ - uint32_t cmd; - uint32_t cmdsize; - char segname[16]; - uint64_t vmaddr; - uint64_t vmsize; - uint64_t fileoff; - uint64_t filesize; - uint32_t maxprot; - uint32_t initprot; - uint32_t nsects; - uint32_t flags; -} segment_command_64_t; - -/* segment flags */ -#define SG_HIGHVM UINT32_C(0x00000001) -#define SG_FVMLIB UINT32_C(0x00000002) -#define SG_NORELOC UINT32_C(0x00000004) -#define SG_PROTECTED_VERSION_1 UINT32_C(0x00000008) - -/* maxprot/initprot */ -#ifndef VM_PROT_NONE -# define VM_PROT_NONE UINT32_C(0x00000000) -# define VM_PROT_READ UINT32_C(0x00000001) -# define VM_PROT_WRITE UINT32_C(0x00000002) -# define VM_PROT_EXECUTE UINT32_C(0x00000004) -# define VM_PROT_ALL UINT32_C(0x00000007) -#endif - -typedef struct section_32 -{ - char sectname[16]; - char segname[16]; - uint32_t addr; - uint32_t size; - uint32_t offset; - uint32_t align; - uint32_t reloff; - uint32_t nreloc; - uint32_t flags; - uint32_t reserved1; - uint32_t reserved2; -} section_32_t; - -typedef struct section_64 -{ - char sectname[16]; - char segname[16]; - uint64_t addr; - uint64_t size; - uint32_t offset; - uint32_t align; - uint32_t reloff; - uint32_t nreloc; - uint32_t flags; - uint32_t reserved1; - uint32_t reserved2; - uint32_t reserved3; -} section_64_t; - -/* section flags */ -#define SECTION_TYPE UINT32_C(0x000000ff) -#define S_REGULAR 0x0 -#define S_ZEROFILL 0x1 -#define S_CSTRING_LITERALS 0x2 -#define S_4BYTE_LITERALS 0x3 -#define S_8BYTE_LITERALS 0x4 -#define S_LITERAL_POINTERS 0x5 -#define S_NON_LAZY_SYMBOL_POINTERS 0x6 -#define S_LAZY_SYMBOL_POINTERS 0x7 -#define S_SYMBOL_STUBS 0x8 -#define S_MOD_INIT_FUNC_POINTERS 0x9 -#define S_MOD_TERM_FUNC_POINTERS 0xa -#define S_COALESCED 0xb -#define S_GB_ZEROFILL 0xc -#define S_INTERPOSING 0xd -#define S_16BYTE_LITERALS 0xe -#define S_DTRACE_DOF 0xf -#define S_LAZY_DYLIB_SYMBOL_POINTERS 0x10 - -#define SECTION_ATTRIBUTES UINT32_C(0xffffff00) -#define SECTION_ATTRIBUTES_USR UINT32_C(0xff000000) -#define S_ATTR_PURE_INSTRUCTIONS UINT32_C(0x80000000) -#define S_ATTR_NO_TOC UINT32_C(0x40000000) -#define S_ATTR_STRIP_STATIC_SYMS UINT32_C(0x20000000) -#define S_ATTR_NO_DEAD_STRIP UINT32_C(0x10000000) -#define S_ATTR_LIVE_SUPPORT UINT32_C(0x08000000) -#define S_ATTR_SELF_MODIFYING_CODE UINT32_C(0x04000000) -#define S_ATTR_DEBUG UINT32_C(0x02000000) -#define SECTION_ATTRIBUTES_SYS UINT32_C(0x00ffff00) -#define S_ATTR_SOME_INSTRUCTIONS UINT32_C(0x00000400) -#define S_ATTR_EXT_RELOC UINT32_C(0x00000200) -#define S_ATTR_LOC_RELOC UINT32_C(0x00000100) - -/* standard section names */ -#define SEG_PAGEZERO "__PAGEZERO" -#define SEG_TEXT "__TEXT" -#define SECT_TEXT "__text" -#define SECT_FVMLIB_INIT0 "__fvmlib_init0" -#define SECT_FVMLIB_INIT1 "__fvmlib_init1" -#define SEG_DATA "__DATA" -#define SECT_DATA "__data" -#define SECT_BSS "__bss" -#define SECT_COMMON "__common" -#define SEG_OBJC "__OBJC" -#define SECT_OBJC_SYMBOLS "__symbol_table" -#define SECT_OBJC_MODULES "__module_info" -#define SECT_OBJC_STRINGS "__selector_strs" -#define SECT_OBJC_REFS "__selector_refs" -#define SEG_ICON "__ICON" -#define SECT_ICON_HEADER "__header" -#define SECT_ICON_TIFF "__tiff" -#define SEG_LINKEDIT "__LINKEDIT" -#define SEG_UNIXSTACK "__UNIXSTACK" -#define SEG_IMPORT "__IMPORT" - -typedef struct thread_command -{ - uint32_t cmd; - uint32_t cmdsize; -} thread_command_t; - -typedef struct symtab_command -{ - uint32_t cmd; - uint32_t cmdsize; - uint32_t symoff; - uint32_t nsyms; - uint32_t stroff; - uint32_t strsize; -} symtab_command_t; - -typedef struct uuid_command -{ - uint32_t cmd; - uint32_t cmdsize; - uint8_t uuid[16]; -} uuid_command_t; - -typedef struct macho_nlist_32 -{ - union - { - int32_t n_strx; - } n_un; - uint8_t n_type; - uint8_t n_sect; - int16_t n_desc; - uint32_t n_value; -} macho_nlist_32_t; - - -typedef struct macho_nlist_64 -{ - union - { - uint32_t n_strx; - } n_un; - uint8_t n_type; - uint8_t n_sect; - int16_t n_desc; - uint64_t n_value; -} macho_nlist_64_t; - -#define MACHO_N_EXT UINT8_C(0x01) -#define MACHO_N_PEXT UINT8_C(0x10) - -#define MACHO_N_TYPE UINT8_C(0x0e) -#define MACHO_N_UNDF UINT8_C(0x00) -#define MACHO_N_ABS UINT8_C(0x02) -#define MACHO_N_INDR UINT8_C(0x0a) -#define MACHO_N_PBUD UINT8_C(0x0c) -#define MACHO_N_SECT UINT8_C(0x0e) - -#define MACHO_N_STAB UINT8_C(0xe0) -#define MACHO_N_GSYM UINT8_C(0x20) -#define MACHO_N_FNAME UINT8_C(0x22) -#define MACHO_N_FUN UINT8_C(0x24) -#define MACHO_N_STSYM UINT8_C(0x26) -#define MACHO_N_LCSYM UINT8_C(0x28) -#define MACHO_N_BNSYM UINT8_C(0x2e) -#define MACHO_N_PC UINT8_C(0x30) -#define MACHO_N_OPT UINT8_C(0x3c) -#define MACHO_N_RSYM UINT8_C(0x40) -#define MACHO_N_SLINE UINT8_C(0x44) -#define MACHO_N_ENSYM UINT8_C(0x4e) -#define MACHO_N_SSYM UINT8_C(0x60) -#define MACHO_N_SO UINT8_C(0x64) -#define MACHO_N_OSO UINT8_C(0x66) -#define MACHO_N_LSYM UINT8_C(0x80) -#define MACHO_N_BINCL UINT8_C(0x82) -#define MACHO_N_SOL UINT8_C(0x84) -#define MACHO_N_PARAMS UINT8_C(0x86) -#define MACHO_N_VERSION UINT8_C(0x88) -#define MACHO_N_OLEVEL UINT8_C(0x8A) -#define MACHO_N_PSYM UINT8_C(0xa0) -#define MACHO_N_EINCL UINT8_C(0xa2) -#define MACHO_N_ENTRY UINT8_C(0xa4) -#define MACHO_N_LBRAC UINT8_C(0xc0) -#define MACHO_N_EXCL UINT8_C(0xc2) -#define MACHO_N_RBRAC UINT8_C(0xe0) -#define MACHO_N_BCOMM UINT8_C(0xe2) -#define MACHO_N_ECOMM UINT8_C(0xe4) -#define MACHO_N_ECOML UINT8_C(0xe8) -#define MACHO_N_LENG UINT8_C(0xfe) - -#define MACHO_NO_SECT UINT8_C(0x00) -#define MACHO_MAX_SECT UINT8_C(0xff) - -#define REFERENCE_TYPE UINT16_C(0x000f) -#define REFERENCE_FLAG_UNDEFINED_NON_LAZY 0 -#define REFERENCE_FLAG_UNDEFINED_LAZY 1 -#define REFERENCE_FLAG_DEFINED 2 -#define REFERENCE_FLAG_PRIVATE_DEFINED 3 -#define REFERENCE_FLAG_PRIVATE_UNDEFINED_NON_LAZY 4 -#define REFERENCE_FLAG_PRIVATE_UNDEFINED_LAZY 5 -#define REFERENCED_DYNAMICALLY UINT16_C(0x0010) - -#define GET_LIBRARY_ORDINAL(a_n_desc) \ - RT_BYTE2(a_n_desc) -#define SET_LIBRARY_ORDINAL(a_n_desc, a_ordinal) \ - do { (a_n_desc) = RT_MAKE_U16(RT_BYTE1(a_n_desc), a_ordinal); } while (0) - -#define SELF_LIBRARY_ORDINAL 0x00 -#define MAX_LIBRARY_ORDINAL 0xfd -#define DYNAMIC_LOOKUP_ORDINAL 0xfe -#define EXECUTABLE_ORDINAL 0xff - -#define N_NO_DEAD_STRIP UINT16_C(0x0020) -#define N_DESC_DISCARDED UINT16_C(0x0020) -#define N_WEAK_REF UINT16_C(0x0040) -#define N_WEAK_DEF UINT16_C(0x0080) -#define N_REF_TO_WEAK UINT16_C(0x0080) - -typedef struct macho_relocation_info -{ - int32_t r_address; - uint32_t r_symbolnum : 24; - uint32_t r_pcrel : 1; - uint32_t r_length : 2; - uint32_t r_extern : 1; - uint32_t r_type : 4; -} macho_relocation_info_t; - -#define R_ABS 0 -#define R_SCATTERED UINT32_C(0x80000000) - -typedef struct scattered_relocation_info -{ -#ifdef RT_LITTLE_ENDIAN - uint32_t r_address : 24; - uint32_t r_type : 4; - uint32_t r_length : 2; - uint32_t r_pcrel : 1; - uint32_t r_scattered : 1; -#elif defined(RT_BIG_ENDIAN) - uint32_t r_scattered : 1; - uint32_t r_pcrel : 1; - uint32_t r_length : 2; - uint32_t r_type : 4; - uint32_t r_address : 24; -#else -# error "Neither K_ENDIAN isn't LITTLE or BIG!" -#endif - int32_t r_value; -} scattered_relocation_info_t; - -typedef enum reloc_type_generic -{ - GENERIC_RELOC_VANILLA = 0, - GENERIC_RELOC_PAIR, - GENERIC_RELOC_SECTDIFF, - GENERIC_RELOC_PB_LA_PTR, - GENERIC_RELOC_LOCAL_SECTDIFF -} reloc_type_generic_t; - -typedef enum reloc_type_x86_64 -{ - X86_64_RELOC_UNSIGNED = 0, - X86_64_RELOC_SIGNED, - X86_64_RELOC_BRANCH, - X86_64_RELOC_GOT_LOAD, - X86_64_RELOC_GOT, - X86_64_RELOC_SUBTRACTOR, - X86_64_RELOC_SIGNED_1, - X86_64_RELOC_SIGNED_2, - X86_64_RELOC_SIGNED_4 -} reloc_type_x86_64_t; - -#endif - diff --git a/src/VBox/Runtime/include/internal/ldrPE.h b/src/VBox/Runtime/include/internal/ldrPE.h index 6b973a2c..dd2bc378 100644 --- a/src/VBox/Runtime/include/internal/ldrPE.h +++ b/src/VBox/Runtime/include/internal/ldrPE.h @@ -4,7 +4,7 @@ */ /* - * Copyright (C) 2006-2007 Oracle Corporation + * Copyright (C) 2006-2013 Oracle Corporation * * This file is part of VirtualBox Open Source Edition (OSE), as * available from http://www.virtualbox.org. This file is free software; @@ -28,8 +28,9 @@ #define ___internal_ldrPE_h #include <iprt/types.h> +#include <iprt/assert.h> -#pragma pack(4) +#pragma pack(4) /** @todo Necessary? */ /******************************************************************************* @@ -144,7 +145,8 @@ #define IMAGE_SCN_ALIGN_2048BYTES 0x00C00000 #define IMAGE_SCN_ALIGN_4096BYTES 0x00D00000 #define IMAGE_SCN_ALIGN_8192BYTES 0x00E00000 -#define IMAGE_SCN_ALIGN_MASK 0x00F00000 +#define IMAGE_SCN_ALIGN_MASK 0x00F00000 +#define IMAGE_SCN_ALIGN_SHIFT 20 #define IMAGE_SCN_LNK_NRELOC_OVFL 0x01000000 #define IMAGE_SCN_MEM_DISCARDABLE 0x02000000 @@ -180,28 +182,110 @@ /* debug dir */ -#define IMAGE_DEBUG_TYPE_UNKNOWN 0x0 -#define IMAGE_DEBUG_TYPE_COFF 0x1 -#define IMAGE_DEBUG_TYPE_CODEVIEW 0x2 -#define IMAGE_DEBUG_TYPE_FPO 0x3 -#define IMAGE_DEBUG_TYPE_MISC 0x4 -#define IMAGE_DEBUG_TYPE_EXCEPTION 0x5 -#define IMAGE_DEBUG_TYPE_FIXUP 0x6 -#define IMAGE_DEBUG_TYPE_OMAP_TO_SRC 0x7 -#define IMAGE_DEBUG_TYPE_OMAP_FROM_SRC 0x8 -#define IMAGE_DEBUG_TYPE_BORLAND 0x9 -#define IMAGE_DEBUG_TYPE_RESERVED10 0x10 +#define IMAGE_DEBUG_TYPE_UNKNOWN UINT32_C(0x0) +#define IMAGE_DEBUG_TYPE_COFF UINT32_C(0x1) +#define IMAGE_DEBUG_TYPE_CODEVIEW UINT32_C(0x2) +#define IMAGE_DEBUG_TYPE_FPO UINT32_C(0x3) +#define IMAGE_DEBUG_TYPE_MISC UINT32_C(0x4) +#define IMAGE_DEBUG_TYPE_EXCEPTION UINT32_C(0x5) +#define IMAGE_DEBUG_TYPE_FIXUP UINT32_C(0x6) +#define IMAGE_DEBUG_TYPE_OMAP_TO_SRC UINT32_C(0x7) +#define IMAGE_DEBUG_TYPE_OMAP_FROM_SRC UINT32_C(0x8) +#define IMAGE_DEBUG_TYPE_BORLAND UINT32_C(0x9) +#define IMAGE_DEBUG_TYPE_RESERVED10 UINT32_C(0x10) + +#define IMAGE_DEBUG_MISC_EXENAME UINT32_C(1) /* security directory */ -#define WIN_CERT_REVISION_1_0 UINT16_C(0x0100) -#define WIN_CERT_REVISION_2_0 UINT16_C(0x0200) - -#define WIN_CERT_TYPE_X509 UINT16_C(1) -#define WIN_CERT_TYPE_PKCS_SIGNED_DATA UINT16_C(2) -#define WIN_CERT_TYPE_RESERVED_1 UINT16_C(3) -#define WIN_CERT_TYPE_TS_STACK_SIGNED UINT16_C(4) -#define WIN_CERT_TYPE_EFI_PKCS115 UINT16_C(0x0ef0) -#define WIN_CERT_TYPE_EFI_GUID UINT16_C(0x0ef1) +#define WIN_CERT_REVISION_1_0 UINT16_C(0x0100) +#define WIN_CERT_REVISION_2_0 UINT16_C(0x0200) + +#define WIN_CERT_TYPE_X509 UINT16_C(1) +#define WIN_CERT_TYPE_PKCS_SIGNED_DATA UINT16_C(2) +#define WIN_CERT_TYPE_RESERVED_1 UINT16_C(3) +#define WIN_CERT_TYPE_TS_STACK_SIGNED UINT16_C(4) +#define WIN_CERT_TYPE_EFI_PKCS115 UINT16_C(0x0ef0) +#define WIN_CERT_TYPE_EFI_GUID UINT16_C(0x0ef1) + + +/* For .DBG files. */ +#define IMAGE_SEPARATE_DEBUG_SIGNATURE UINT16_C(0x4944) + +#define IMAGE_SIZE_OF_SYMBOL 18 +#define IMAGE_SIZE_OF_SYMBOL_EX 20 + +#define IMAGE_SYM_UNDEFINED INT16_C(0) +#define IMAGE_SYM_ABSOLUTE INT16_C(-1) +#define IMAGE_SYM_DEBUG INT16_C(-2) + +#define IMAGE_SYM_CLASS_END_OF_FUNCTION UINT8_C(0xff) /* -1 */ +#define IMAGE_SYM_CLASS_NULL UINT8_C(0) +#define IMAGE_SYM_CLASS_AUTOMATIC UINT8_C(1) +#define IMAGE_SYM_CLASS_EXTERNAL UINT8_C(2) +#define IMAGE_SYM_CLASS_STATIC UINT8_C(3) +#define IMAGE_SYM_CLASS_REGISTER UINT8_C(4) +#define IMAGE_SYM_CLASS_EXTERNAL_DEF UINT8_C(5) +#define IMAGE_SYM_CLASS_LABEL UINT8_C(6) +#define IMAGE_SYM_CLASS_UNDEFINED_LABEL UINT8_C(7) +#define IMAGE_SYM_CLASS_MEMBER_OF_STRUCT UINT8_C(8) +#define IMAGE_SYM_CLASS_ARGUMENT UINT8_C(9) +#define IMAGE_SYM_CLASS_STRUCT_TAG UINT8_C(10) +#define IMAGE_SYM_CLASS_MEMBER_OF_UNION UINT8_C(11) +#define IMAGE_SYM_CLASS_UNION_TAG UINT8_C(12) +#define IMAGE_SYM_CLASS_TYPE_DEFINITION UINT8_C(13) +#define IMAGE_SYM_CLASS_UNDEFINED_STATIC UINT8_C(14) +#define IMAGE_SYM_CLASS_ENUM_TAG UINT8_C(15) +#define IMAGE_SYM_CLASS_MEMBER_OF_ENUM UINT8_C(16) +#define IMAGE_SYM_CLASS_REGISTER_PARAM UINT8_C(17) +#define IMAGE_SYM_CLASS_BIT_FIELD UINT8_C(18) +#define IMAGE_SYM_CLASS_FAR_EXTERNAL UINT8_C(68) +#define IMAGE_SYM_CLASS_BLOCK UINT8_C(100) +#define IMAGE_SYM_CLASS_FUNCTION UINT8_C(101) +#define IMAGE_SYM_CLASS_END_OF_STRUCT UINT8_C(102) +#define IMAGE_SYM_CLASS_FILE UINT8_C(103) +#define IMAGE_SYM_CLASS_SECTION UINT8_C(104) +#define IMAGE_SYM_CLASS_WEAK_EXTERNAL UINT8_C(105) +#define IMAGE_SYM_CLASS_CLR_TOKEN UINT8_C(107) + + +#define IMAGE_SYM_TYPE_NULL UINT16_C(0x0000) +#define IMAGE_SYM_TYPE_VOID UINT16_C(0x0001) +#define IMAGE_SYM_TYPE_CHAR UINT16_C(0x0002) +#define IMAGE_SYM_TYPE_SHORT UINT16_C(0x0003) +#define IMAGE_SYM_TYPE_INT UINT16_C(0x0004) +#define IMAGE_SYM_TYPE_LONG UINT16_C(0x0005) +#define IMAGE_SYM_TYPE_FLOAT UINT16_C(0x0006) +#define IMAGE_SYM_TYPE_DOUBLE UINT16_C(0x0007) +#define IMAGE_SYM_TYPE_STRUCT UINT16_C(0x0008) +#define IMAGE_SYM_TYPE_UNION UINT16_C(0x0009) +#define IMAGE_SYM_TYPE_ENUM UINT16_C(0x000a) +#define IMAGE_SYM_TYPE_MOE UINT16_C(0x000b) +#define IMAGE_SYM_TYPE_BYTE UINT16_C(0x000c) +#define IMAGE_SYM_TYPE_WORD UINT16_C(0x000d) +#define IMAGE_SYM_TYPE_UINT UINT16_C(0x000e) +#define IMAGE_SYM_TYPE_DWORD UINT16_C(0x000f) +#define IMAGE_SYM_TYPE_PCODE UINT16_C(0x8000) + +#define IMAGE_SYM_DTYPE_NULL UINT16_C(0x0) +#define IMAGE_SYM_DTYPE_POINTER UINT16_C(0x1) +#define IMAGE_SYM_DTYPE_FUNCTION UINT16_C(0x2) +#define IMAGE_SYM_DTYPE_ARRAY UINT16_C(0x3) + + +#define N_BTMASK UINT16_C(0x000f) +#define N_TMASK UINT16_C(0x0030) +#define N_TMASK1 UINT16_C(0x00c0) +#define N_TMASK2 UINT16_C(0x00f0) +#define N_BTSHFT 4 +#define N_TSHIFT 2 + +#define BTYPE(a_Type) ( (a_Type) & N_BTMASK ) +#define ISPTR(a_Type) ( ((a_Type) & N_TMASK) == (IMAGE_SYM_DTYPE_POINTER << N_BTSHFT) ) +#define ISFCN(a_Type) ( ((a_Type) & N_TMASK) == (IMAGE_SYM_DTYPE_FUNCTION << N_BTSHFT) ) +#define ISARY(a_Type) ( ((a_Type) & N_TMASK) == (IMAGE_SYM_DTYPE_ARRAY << N_BTSHFT) ) +#define ISTAG(a_StorageClass) ( (a_StorageClass) == IMAGE_SYM_CLASS_STRUCT_TAG \ + || (a_StorageClass) == IMAGE_SYM_CLASS_UNION_TAG \ + || (a_StorageClass) == IMAGE_SYM_CLASS_ENUM_TAG ) /******************************************************************************* @@ -209,15 +293,17 @@ *******************************************************************************/ typedef struct _IMAGE_FILE_HEADER { - uint16_t Machine; - uint16_t NumberOfSections; - uint32_t TimeDateStamp; - uint32_t PointerToSymbolTable; - uint32_t NumberOfSymbols; - uint16_t SizeOfOptionalHeader; - uint16_t Characteristics; -} IMAGE_FILE_HEADER; + uint16_t Machine; /**< 0x00 */ + uint16_t NumberOfSections; /**< 0x02 */ + uint32_t TimeDateStamp; /**< 0x04 */ + uint32_t PointerToSymbolTable; /**< 0x08 */ + uint32_t NumberOfSymbols; /**< 0x0c */ + uint16_t SizeOfOptionalHeader; /**< 0x10 */ + uint16_t Characteristics; /**< 0x12 */ +} IMAGE_FILE_HEADER; /* size: 0x14 */ +AssertCompileSize(IMAGE_FILE_HEADER, 0x14); typedef IMAGE_FILE_HEADER *PIMAGE_FILE_HEADER; +typedef IMAGE_FILE_HEADER const *PCIMAGE_FILE_HEADER; typedef struct _IMAGE_DATA_DIRECTORY @@ -226,95 +312,107 @@ typedef struct _IMAGE_DATA_DIRECTORY uint32_t Size; } IMAGE_DATA_DIRECTORY; typedef IMAGE_DATA_DIRECTORY *PIMAGE_DATA_DIRECTORY; +typedef IMAGE_DATA_DIRECTORY const *PCIMAGE_DATA_DIRECTORY; typedef struct _IMAGE_OPTIONAL_HEADER32 { - uint16_t Magic; - uint8_t MajorLinkerVersion; - uint8_t MinorLinkerVersion; - uint32_t SizeOfCode; - uint32_t SizeOfInitializedData; - uint32_t SizeOfUninitializedData; - uint32_t AddressOfEntryPoint; - uint32_t BaseOfCode; - uint32_t BaseOfData; - uint32_t ImageBase; - uint32_t SectionAlignment; - uint32_t FileAlignment; - uint16_t MajorOperatingSystemVersion; - uint16_t MinorOperatingSystemVersion; - uint16_t MajorImageVersion; - uint16_t MinorImageVersion; - uint16_t MajorSubsystemVersion; - uint16_t MinorSubsystemVersion; - uint32_t Win32VersionValue; - uint32_t SizeOfImage; - uint32_t SizeOfHeaders; - uint32_t CheckSum; - uint16_t Subsystem; - uint16_t DllCharacteristics; - uint32_t SizeOfStackReserve; - uint32_t SizeOfStackCommit; - uint32_t SizeOfHeapReserve; - uint32_t SizeOfHeapCommit; - uint32_t LoaderFlags; - uint32_t NumberOfRvaAndSizes; - IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES]; -} IMAGE_OPTIONAL_HEADER32; + uint16_t Magic; /**< 0x00 */ + uint8_t MajorLinkerVersion; /**< 0x02 */ + uint8_t MinorLinkerVersion; /**< 0x03 */ + uint32_t SizeOfCode; /**< 0x04 */ + uint32_t SizeOfInitializedData; /**< 0x08 */ + uint32_t SizeOfUninitializedData; /**< 0x0c */ + uint32_t AddressOfEntryPoint; /**< 0x10 */ + uint32_t BaseOfCode; /**< 0x14 */ + uint32_t BaseOfData; /**< 0x18 */ + uint32_t ImageBase; /**< 0x1c */ + uint32_t SectionAlignment; /**< 0x20 */ + uint32_t FileAlignment; /**< 0x24 */ + uint16_t MajorOperatingSystemVersion; /**< 0x28 */ + uint16_t MinorOperatingSystemVersion; /**< 0x2a */ + uint16_t MajorImageVersion; /**< 0x2c */ + uint16_t MinorImageVersion; /**< 0x2e */ + uint16_t MajorSubsystemVersion; /**< 0x30 */ + uint16_t MinorSubsystemVersion; /**< 0x32 */ + uint32_t Win32VersionValue; /**< 0x34 */ + uint32_t SizeOfImage; /**< 0x38 */ + uint32_t SizeOfHeaders; /**< 0x3c */ + uint32_t CheckSum; /**< 0x40 */ + uint16_t Subsystem; /**< 0x44 */ + uint16_t DllCharacteristics; /**< 0x46 */ + uint32_t SizeOfStackReserve; /**< 0x48 */ + uint32_t SizeOfStackCommit; /**< 0x4c */ + uint32_t SizeOfHeapReserve; /**< 0x50 */ + uint32_t SizeOfHeapCommit; /**< 0x54 */ + uint32_t LoaderFlags; /**< 0x58 */ + uint32_t NumberOfRvaAndSizes; /**< 0x5c */ + IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES]; /**< 0x60; 0x10*8 = 0x80 */ +} IMAGE_OPTIONAL_HEADER32; /* size: 0xe0 */ +AssertCompileSize(IMAGE_OPTIONAL_HEADER32, 0xe0); typedef IMAGE_OPTIONAL_HEADER32 *PIMAGE_OPTIONAL_HEADER32; +typedef IMAGE_OPTIONAL_HEADER32 const *PCIMAGE_OPTIONAL_HEADER32; typedef struct _IMAGE_OPTIONAL_HEADER64 { - uint16_t Magic; - uint8_t MajorLinkerVersion; - uint8_t MinorLinkerVersion; - uint32_t SizeOfCode; - uint32_t SizeOfInitializedData; - uint32_t SizeOfUninitializedData; - uint32_t AddressOfEntryPoint; - uint32_t BaseOfCode; - uint64_t ImageBase; - uint32_t SectionAlignment; - uint32_t FileAlignment; - uint16_t MajorOperatingSystemVersion; - uint16_t MinorOperatingSystemVersion; - uint16_t MajorImageVersion; - uint16_t MinorImageVersion; - uint16_t MajorSubsystemVersion; - uint16_t MinorSubsystemVersion; - uint32_t Win32VersionValue; - uint32_t SizeOfImage; - uint32_t SizeOfHeaders; - uint32_t CheckSum; - uint16_t Subsystem; - uint16_t DllCharacteristics; - uint64_t SizeOfStackReserve; - uint64_t SizeOfStackCommit; - uint64_t SizeOfHeapReserve; - uint64_t SizeOfHeapCommit; - uint32_t LoaderFlags; - uint32_t NumberOfRvaAndSizes; - IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES]; -} IMAGE_OPTIONAL_HEADER64; + uint16_t Magic; /**< 0x00 */ + uint8_t MajorLinkerVersion; /**< 0x02 */ + uint8_t MinorLinkerVersion; /**< 0x03 */ + uint32_t SizeOfCode; /**< 0x04 */ + uint32_t SizeOfInitializedData; /**< 0x08 */ + uint32_t SizeOfUninitializedData; /**< 0x0c */ + uint32_t AddressOfEntryPoint; /**< 0x10 */ + uint32_t BaseOfCode; /**< 0x14 */ + uint64_t ImageBase; /**< 0x18 */ + uint32_t SectionAlignment; /**< 0x20 */ + uint32_t FileAlignment; /**< 0x24 */ + uint16_t MajorOperatingSystemVersion; /**< 0x28 */ + uint16_t MinorOperatingSystemVersion; /**< 0x2a */ + uint16_t MajorImageVersion; /**< 0x2c */ + uint16_t MinorImageVersion; /**< 0x2e */ + uint16_t MajorSubsystemVersion; /**< 0x30 */ + uint16_t MinorSubsystemVersion; /**< 0x32 */ + uint32_t Win32VersionValue; /**< 0x34 */ + uint32_t SizeOfImage; /**< 0x38 */ + uint32_t SizeOfHeaders; /**< 0x3c */ + uint32_t CheckSum; /**< 0x40 */ + uint16_t Subsystem; /**< 0x44 */ + uint16_t DllCharacteristics; /**< 0x46 */ + uint64_t SizeOfStackReserve; /**< 0x48 */ + uint64_t SizeOfStackCommit; /**< 0x50 */ + uint64_t SizeOfHeapReserve; /**< 0x58 */ + uint64_t SizeOfHeapCommit; /**< 0x60 */ + uint32_t LoaderFlags; /**< 0x68 */ + uint32_t NumberOfRvaAndSizes; /**< 0x6c */ + IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES]; /**< 0x70; 0x10*8 = 0x80 */ +} IMAGE_OPTIONAL_HEADER64; /* size: 0xf0 */ typedef IMAGE_OPTIONAL_HEADER64 *PIMAGE_OPTIONAL_HEADER64; +typedef IMAGE_OPTIONAL_HEADER64 const *PCIMAGE_OPTIONAL_HEADER64; typedef struct _IMAGE_NT_HEADERS { - uint32_t Signature; - IMAGE_FILE_HEADER FileHeader; - IMAGE_OPTIONAL_HEADER32 OptionalHeader; -} IMAGE_NT_HEADERS32; + uint32_t Signature; /**< 0x00 */ + IMAGE_FILE_HEADER FileHeader; /**< 0x04 */ + IMAGE_OPTIONAL_HEADER32 OptionalHeader; /**< 0x18 */ +} IMAGE_NT_HEADERS32; /* size: 0xf8 */ +AssertCompileSize(IMAGE_NT_HEADERS32, 0xf8); +AssertCompileMemberOffset(IMAGE_NT_HEADERS32, FileHeader, 4); +AssertCompileMemberOffset(IMAGE_NT_HEADERS32, OptionalHeader, 24); typedef IMAGE_NT_HEADERS32 *PIMAGE_NT_HEADERS32; +typedef IMAGE_NT_HEADERS32 const *PCIMAGE_NT_HEADERS32; typedef struct _IMAGE_NT_HEADERS64 { - uint32_t Signature; - IMAGE_FILE_HEADER FileHeader; - IMAGE_OPTIONAL_HEADER64 OptionalHeader; -} IMAGE_NT_HEADERS64; + uint32_t Signature; /**< 0x00 */ + IMAGE_FILE_HEADER FileHeader; /**< 0x04 */ + IMAGE_OPTIONAL_HEADER64 OptionalHeader; /**< 0x18 */ +} IMAGE_NT_HEADERS64; /**< 0x108 */ +AssertCompileSize(IMAGE_NT_HEADERS64, 0x108); +AssertCompileMemberOffset(IMAGE_NT_HEADERS64, FileHeader, 4); +AssertCompileMemberOffset(IMAGE_NT_HEADERS64, OptionalHeader, 24); typedef IMAGE_NT_HEADERS64 *PIMAGE_NT_HEADERS64; +typedef IMAGE_NT_HEADERS64 const *PCIMAGE_NT_HEADERS64; typedef struct _IMAGE_SECTION_HEADER @@ -335,6 +433,7 @@ typedef struct _IMAGE_SECTION_HEADER uint32_t Characteristics; } IMAGE_SECTION_HEADER; typedef IMAGE_SECTION_HEADER *PIMAGE_SECTION_HEADER; +typedef IMAGE_SECTION_HEADER const *PCIMAGE_SECTION_HEADER; typedef struct _IMAGE_BASE_RELOCATION @@ -343,6 +442,7 @@ typedef struct _IMAGE_BASE_RELOCATION uint32_t SizeOfBlock; } IMAGE_BASE_RELOCATION; typedef IMAGE_BASE_RELOCATION *PIMAGE_BASE_RELOCATION; +typedef IMAGE_BASE_RELOCATION const *PCIMAGE_BASE_RELOCATION; typedef struct _IMAGE_EXPORT_DIRECTORY @@ -358,7 +458,9 @@ typedef struct _IMAGE_EXPORT_DIRECTORY uint32_t AddressOfFunctions; uint32_t AddressOfNames; uint32_t AddressOfNameOrdinals; -} IMAGE_EXPORT_DIRECTORY, *PIMAGE_EXPORT_DIRECTORY; +} IMAGE_EXPORT_DIRECTORY; +typedef IMAGE_EXPORT_DIRECTORY *PIMAGE_EXPORT_DIRECTORY; +typedef IMAGE_EXPORT_DIRECTORY const *PCIMAGE_EXPORT_DIRECTORY; typedef struct _IMAGE_IMPORT_DESCRIPTOR @@ -374,14 +476,16 @@ typedef struct _IMAGE_IMPORT_DESCRIPTOR uint32_t FirstThunk; } IMAGE_IMPORT_DESCRIPTOR; typedef IMAGE_IMPORT_DESCRIPTOR *PIMAGE_IMPORT_DESCRIPTOR; +typedef IMAGE_IMPORT_DESCRIPTOR const *PCIMAGE_IMPORT_DESCRIPTOR; typedef struct _IMAGE_IMPORT_BY_NAME { uint16_t Hint; - uint8_t Name[1]; + uint8_t Name[1]; } IMAGE_IMPORT_BY_NAME; typedef IMAGE_IMPORT_BY_NAME *PIMAGE_IMPORT_BY_NAME; +typedef IMAGE_IMPORT_BY_NAME const *PCIMAGE_IMPORT_BY_NAME; /* The image_thunk_data32/64 structures are not very helpful except for getting RSI. keep them around till all the code has been converted. */ @@ -396,6 +500,7 @@ typedef struct _IMAGE_THUNK_DATA64 } u1; } IMAGE_THUNK_DATA64; typedef IMAGE_THUNK_DATA64 *PIMAGE_THUNK_DATA64; +typedef IMAGE_THUNK_DATA64 const *PCIMAGE_THUNK_DATA64; typedef struct _IMAGE_THUNK_DATA32 { @@ -408,6 +513,7 @@ typedef struct _IMAGE_THUNK_DATA32 } u1; } IMAGE_THUNK_DATA32; typedef IMAGE_THUNK_DATA32 *PIMAGE_THUNK_DATA32; +typedef IMAGE_THUNK_DATA32 const *PCIMAGE_THUNK_DATA32; typedef struct _IMAGE_LOAD_CONFIG_DIRECTORY32 @@ -433,7 +539,8 @@ typedef struct _IMAGE_LOAD_CONFIG_DIRECTORY32 uint32_t SEHandlerTable; uint32_t SEHandlerCount; } IMAGE_LOAD_CONFIG_DIRECTORY32; -typedef IMAGE_LOAD_CONFIG_DIRECTORY32 PIMAGE_LOAD_CONFIG_DIRECTORY32; +typedef IMAGE_LOAD_CONFIG_DIRECTORY32 *PIMAGE_LOAD_CONFIG_DIRECTORY32; +typedef IMAGE_LOAD_CONFIG_DIRECTORY32 const *PCIMAGE_LOAD_CONFIG_DIRECTORY32; typedef struct _IMAGE_LOAD_CONFIG_DIRECTORY64 { @@ -459,6 +566,7 @@ typedef struct _IMAGE_LOAD_CONFIG_DIRECTORY64 uint64_t SEHandlerCount; } IMAGE_LOAD_CONFIG_DIRECTORY64; typedef IMAGE_LOAD_CONFIG_DIRECTORY64 *PIMAGE_LOAD_CONFIG_DIRECTORY64; +typedef IMAGE_LOAD_CONFIG_DIRECTORY64 const *PCIMAGE_LOAD_CONFIG_DIRECTORY64; typedef struct _IMAGE_DEBUG_DIRECTORY @@ -473,6 +581,18 @@ typedef struct _IMAGE_DEBUG_DIRECTORY uint32_t PointerToRawData; } IMAGE_DEBUG_DIRECTORY; typedef IMAGE_DEBUG_DIRECTORY *PIMAGE_DEBUG_DIRECTORY; +typedef IMAGE_DEBUG_DIRECTORY const *PCIMAGE_DEBUG_DIRECTORY; + +typedef struct _IMAGE_DEBUG_MISC +{ + uint32_t DataType; + uint32_t Length; + uint8_t Unicode; + uint8_t Reserved[3]; + uint8_t Data[1]; +} IMAGE_DEBUG_MISC; +typedef IMAGE_DEBUG_MISC *PIMAGE_DEBUG_MISC; +typedef IMAGE_DEBUG_MISC const *PCIMAGE_DEBUG_MISC; typedef struct WIN_CERTIFICATE @@ -483,8 +603,243 @@ typedef struct WIN_CERTIFICATE uint8_t bCertificate[8]; } WIN_CERTIFICATE; typedef WIN_CERTIFICATE *PWIN_CERTIFICATE; +typedef WIN_CERTIFICATE const *PCWIN_CERTIFICATE; + + + + +/* WARNING! NO MORE PRAGMA PACK 4 from here on. Assert size of all new types. */ +/* WARNING! NO MORE PRAGMA PACK 4 from here on. Assert size of all new types. */ +/* WARNING! NO MORE PRAGMA PACK 4 from here on. Assert size of all new types. */ +/* WARNING! NO MORE PRAGMA PACK 4 from here on. Assert size of all new types. */ +/* WARNING! NO MORE PRAGMA PACK 4 from here on. Assert size of all new types. */ +/* WARNING! NO MORE PRAGMA PACK 4 from here on. Assert size of all new types. */ +/* WARNING! NO MORE PRAGMA PACK 4 from here on. Assert size of all new types. */ +/* WARNING! NO MORE PRAGMA PACK 4 from here on. Assert size of all new types. */ +/* WARNING! NO MORE PRAGMA PACK 4 from here on. Assert size of all new types. */ +#pragma pack() + + + + +/** The header of a .DBG file (NT4). */ +typedef struct _IMAGE_SEPARATE_DEBUG_HEADER +{ + uint16_t Signature; /**< 0x00 */ + uint16_t Flags; /**< 0x02 */ + uint16_t Machine; /**< 0x04 */ + uint16_t Characteristics; /**< 0x06 */ + uint32_t TimeDateStamp; /**< 0x08 */ + uint32_t CheckSum; /**< 0x0c */ + uint32_t ImageBase; /**< 0x10 */ + uint32_t SizeOfImage; /**< 0x14 */ + uint32_t NumberOfSections; /**< 0x18 */ + uint32_t ExportedNamesSize; /**< 0x1c */ + uint32_t DebugDirectorySize; /**< 0x20 */ + uint32_t SectionAlignment; /**< 0x24 */ + uint32_t Reserved[2]; /**< 0x28 */ +} IMAGE_SEPARATE_DEBUG_HEADER; /* size: 0x30 */ +AssertCompileSize(IMAGE_SEPARATE_DEBUG_HEADER, 0x30); +typedef IMAGE_SEPARATE_DEBUG_HEADER *PIMAGE_SEPARATE_DEBUG_HEADER; +typedef IMAGE_SEPARATE_DEBUG_HEADER const *PCIMAGE_SEPARATE_DEBUG_HEADER; + + +typedef struct _IMAGE_COFF_SYMBOLS_HEADER +{ + uint32_t NumberOfSymbols; + uint32_t LvaToFirstSymbol; + uint32_t NumberOfLinenumbers; + uint32_t LvaToFirstLinenumber; + uint32_t RvaToFirstByteOfCode; + uint32_t RvaToLastByteOfCode; + uint32_t RvaToFirstByteOfData; + uint32_t RvaToLastByteOfData; +} IMAGE_COFF_SYMBOLS_HEADER; +AssertCompileSize(IMAGE_COFF_SYMBOLS_HEADER, 0x20); +typedef IMAGE_COFF_SYMBOLS_HEADER *PIMAGE_COFF_SYMBOLS_HEADER; +typedef IMAGE_COFF_SYMBOLS_HEADER const *PCIMAGE_COFF_SYMBOLS_HEADER; + + +#pragma pack(2) +typedef struct _IMAGE_LINENUMBER +{ + union + { + uint32_t VirtualAddress; + uint32_t SymbolTableIndex; + } Type; + uint16_t Linenumber; +} IMAGE_LINENUMBER; #pragma pack() +AssertCompileSize(IMAGE_LINENUMBER, 6); +typedef IMAGE_LINENUMBER *PIMAGE_LINENUMBER; +typedef IMAGE_LINENUMBER const *PCIMAGE_LINENUMBER; + + +#pragma pack(2) +typedef struct _IMAGE_SYMBOL +{ + union + { + uint8_t ShortName[8]; + struct + { + uint32_t Short; + uint32_t Long; + } Name; + uint32_t LongName[2]; + } N; + + uint32_t Value; + int16_t SectionNumber; + uint16_t Type; + uint8_t StorageClass; + uint8_t NumberOfAuxSymbols; +} IMAGE_SYMBOL; +#pragma pack() +AssertCompileSize(IMAGE_SYMBOL, IMAGE_SIZE_OF_SYMBOL); +typedef IMAGE_SYMBOL *PIMAGE_SYMBOL; +typedef IMAGE_SYMBOL const *PCIMAGE_SYMBOL; + + +#pragma pack(2) +typedef struct IMAGE_AUX_SYMBOL_TOKEN_DEF +{ + uint8_t bAuxType; + uint8_t bReserved; + uint32_t SymbolTableIndex; + uint8_t rgbReserved[12]; +} IMAGE_AUX_SYMBOL_TOKEN_DEF; +#pragma pack() +AssertCompileSize(IMAGE_AUX_SYMBOL_TOKEN_DEF, IMAGE_SIZE_OF_SYMBOL); +typedef IMAGE_AUX_SYMBOL_TOKEN_DEF *PIMAGE_AUX_SYMBOL_TOKEN_DEF; +typedef IMAGE_AUX_SYMBOL_TOKEN_DEF const *PCIMAGE_AUX_SYMBOL_TOKEN_DEF; + + +#pragma pack(1) +typedef union _IMAGE_AUX_SYMBOL +{ + struct + { + uint32_t TagIndex; + union + { + struct + { + uint16_t Linenumber; + uint16_t Size; + } LnSz; + } Misc; + union + { + struct + { + uint32_t PointerToLinenumber; + uint32_t PointerToNextFunction; + } Function; + struct + { + uint16_t Dimension[4]; + } Array; + } FcnAry; + uint16_t TvIndex; + } Sym; + + struct + { + uint8_t Name[IMAGE_SIZE_OF_SYMBOL]; + } File; + + struct + { + uint32_t Length; + uint16_t NumberOfRelocations; + uint16_t NumberOfLinenumbers; + uint32_t CheckSum; + uint16_t Number; + uint8_t Selection; + uint8_t bReserved; + uint16_t HighNumber; + } Section; + + IMAGE_AUX_SYMBOL_TOKEN_DEF TokenDef; + struct + { + uint32_t crc; + uint8_t rgbReserved[14]; + } CRC; +} IMAGE_AUX_SYMBOL; +#pragma pack() +AssertCompileSize(IMAGE_AUX_SYMBOL, IMAGE_SIZE_OF_SYMBOL); +typedef IMAGE_AUX_SYMBOL *PIMAGE_AUX_SYMBOL; +typedef IMAGE_AUX_SYMBOL const *PCIMAGE_AUX_SYMBOL; + + + +typedef struct _IMAGE_SYMBOL_EX +{ + union + { + uint8_t ShortName[8]; + struct + { + uint32_t Short; + uint32_t Long; + } Name; + uint32_t LongName[2]; + } N; + + uint32_t Value; + int32_t SectionNumber; /* The difference from IMAGE_SYMBOL */ + uint16_t Type; + uint8_t StorageClass; + uint8_t NumberOfAuxSymbols; +} IMAGE_SYMBOL_EX; +AssertCompileSize(IMAGE_SYMBOL_EX, IMAGE_SIZE_OF_SYMBOL_EX); +typedef IMAGE_SYMBOL_EX *PIMAGE_SYMBOL_EX; +typedef IMAGE_SYMBOL_EX const *PCIMAGE_SYMBOL_EX; + + +typedef union _IMAGE_AUX_SYMBOL_EX +{ + struct + { + uint32_t WeakDefaultSymIndex; + uint32_t WeakSearchType; + uint8_t rgbReserved[12]; + } Sym; + + struct + { + uint8_t Name[IMAGE_SIZE_OF_SYMBOL_EX]; + } File; + + struct + { + uint32_t Length; + uint16_t NumberOfRelocations; + uint16_t NumberOfLinenumbers; + uint32_t CheckSum; + uint16_t Number; + uint8_t Selection; + uint8_t bReserved; + uint16_t HighNumber; + uint8_t rgbReserved[2]; + } Section; + + IMAGE_AUX_SYMBOL_TOKEN_DEF TokenDef; + + struct + { + uint32_t crc; + uint8_t rgbReserved[16]; + } CRC; +} IMAGE_AUX_SYMBOL_EX; +AssertCompileSize(IMAGE_AUX_SYMBOL_EX, IMAGE_SIZE_OF_SYMBOL_EX); +typedef IMAGE_AUX_SYMBOL_EX *PIMAGE_AUX_SYMBOL_EX; +typedef IMAGE_AUX_SYMBOL_EX const *PCIMAGE_AUX_SYMBOL_EX; + #endif diff --git a/src/VBox/Runtime/include/internal/lockvalidator.h b/src/VBox/Runtime/include/internal/lockvalidator.h index 793e3fff..a40a0981 100644 --- a/src/VBox/Runtime/include/internal/lockvalidator.h +++ b/src/VBox/Runtime/include/internal/lockvalidator.h @@ -4,7 +4,7 @@ */ /* - * Copyright (C) 2006-2009 Oracle Corporation + * Copyright (C) 2006-2011 Oracle Corporation * * This file is part of VirtualBox Open Source Edition (OSE), as * available from http://www.virtualbox.org. This file is free software; diff --git a/src/VBox/Runtime/include/internal/magics.h b/src/VBox/Runtime/include/internal/magics.h index 239c45cf..16be9000 100644 --- a/src/VBox/Runtime/include/internal/magics.h +++ b/src/VBox/Runtime/include/internal/magics.h @@ -4,7 +4,7 @@ */ /* - * Copyright (C) 2007-2011 Oracle Corporation + * Copyright (C) 2007-2012 Oracle Corporation * * This file is part of VirtualBox Open Source Edition (OSE), as * available from http://www.virtualbox.org. This file is free software; @@ -30,8 +30,14 @@ /** @name Magic Numbers. * @{ */ +/** Magic number for RTAIOMGRINT::u32Magic. (Emil Erich Kaestner) */ +#define RTAIOMGR_MAGIC UINT32_C(0x18990223) +/** Magic number for RTAIOMGRINTFILE::u32Magic. (Ephraim Kishon) */ +#define RTAIOMGRFILE_MAGIC UINT32_C(0x19240823) /** Magic number for RTDBGMODINT::u32Magic. (Charles Lloyd) */ #define RTDBGAS_MAGIC UINT32_C(0x19380315) +/** Magic number for RTDBGCFGINT::u32Magic. (McCoy Tyner) */ +#define RTDBGCFG_MAGIC UINT32_C(0x19381211) /** Magic number for RTDBGMODINT::u32Magic. (Keith Jarrett) */ #define RTDBGMOD_MAGIC UINT32_C(0x19450508) /** Magic number for RTDBGMODVTIMG::u32Magic. (Jack DeJohnette) */ @@ -68,6 +74,10 @@ #define RTHEAPOFFSET_MAGIC UINT32_C(0x19591031) /** Magic number for RTHEAPSIMPLEINTERNAL::uMagic. (Kyoichi Katayama) */ #define RTHEAPSIMPLE_MAGIC UINT32_C(0x19590105) +/** The magic value for RTHTTPINTERNAL::u32Magic. (Karl May) */ +#define RTHTTP_MAGIC UINT32_C(0x18420225) +/** The value of RTHTTPINTERNAL::u32Magic after close. */ +#define RTHTTP_MAGIC_DEAD UINT32_C(0x19120330) /** The magic value for RTLDRMODINTERNAL::u32Magic. (Alan Moore) */ #define RTLDRMOD_MAGIC UINT32_C(0x19531118) /** The magic value for RTLOCALIPCSERVER::u32Magic. (Naoki Yamamoto) */ @@ -104,6 +114,8 @@ #define RTMEMPOOL_MAGIC_DEAD UINT32_C(0x18170718) /** The magic value for heap blocks. (Edgar Allan Poe) */ #define RTMEMHDR_MAGIC UINT32_C(0x18090119) +/** The magic value for heap blocks after freeing. */ +#define RTMEMHDR_MAGIC_DEAD UINT32_C(0x18491007) /** The value of RTPIPEINTERNAL::u32Magic. (Frank Schaetzing) */ #define RTPIPE_MAGIC UINT32_C(0x19570528) /** The value of RTPOLLSETINTERNAL::u32Magic. (Ai Yazawa) */ @@ -178,6 +190,8 @@ #define RTTARFILE_MAGIC_DEAD UINT32_C(0x19120420) /** RTTESTINT::u32Magic value. (Daniel Kehlmann) */ #define RTTESTINT_MAGIC UINT32_C(0x19750113) +/** RTTHREADCTXINT::u32Magic value. (Dennis MacAlistair Ritchie) */ +#define RTTHREADCTXINT_MAGIC UINT32_C(0x19410909) /** RTTHREADINT::u32Magic value. (Gilbert Keith Chesterton) */ #define RTTHREADINT_MAGIC UINT32_C(0x18740529) /** RTTHREADINT::u32Magic value for a dead thread. */ diff --git a/src/VBox/Runtime/include/internal/path.h b/src/VBox/Runtime/include/internal/path.h index a1cdb1ee..3f6a5a9d 100644 --- a/src/VBox/Runtime/include/internal/path.h +++ b/src/VBox/Runtime/include/internal/path.h @@ -4,7 +4,7 @@ */ /* - * Copyright (C) 2006-2007 Oracle Corporation + * Copyright (C) 2006-2011 Oracle Corporation * * This file is part of VirtualBox Open Source Edition (OSE), as * available from http://www.virtualbox.org. This file is free software; diff --git a/src/VBox/Runtime/include/internal/pipe.h b/src/VBox/Runtime/include/internal/pipe.h index e5566d4f..6712b11e 100644 --- a/src/VBox/Runtime/include/internal/pipe.h +++ b/src/VBox/Runtime/include/internal/pipe.h @@ -4,7 +4,7 @@ */ /* - * Copyright (C) 2010 Oracle Corporation + * Copyright (C) 2010-2013 Oracle Corporation * * This file is part of VirtualBox Open Source Edition (OSE), as * available from http://www.virtualbox.org. This file is free software; @@ -28,15 +28,58 @@ #define ___internal_pipe_h #include <iprt/pipe.h> -/* Requires Windows.h on windows. */ RT_C_DECLS_BEGIN -#ifdef RT_OS_WINDOWS -int rtPipePollGetHandle(RTPIPE hPipe, uint32_t fEvents, PHANDLE ph); +/** + * Internal RTPollSetAdd helper that returns the handle that should be added to + * the pollset. + * + * @returns Valid handle on success, INVALID_HANDLE_VALUE on failure. + * @param hPipe The pipe handle. + * @param fEvents The events we're polling for. + * @param phNative Where to put the primary handle. + */ +int rtPipePollGetHandle(RTPIPE hPipe, uint32_t fEvents, PRTHCINTPTR phNative); + +/** + * Internal RTPoll helper that polls the pipe handle and, if @a fNoWait is + * clear, starts whatever actions we've got running during the poll call. + * + * @returns 0 if no pending events, actions initiated if @a fNoWait is clear. + * Event mask (in @a fEvents) and no actions if the handle is ready + * already. + * UINT32_MAX (asserted) if the pipe handle is busy in I/O or a + * different poll set. + * + * @param hPipe The pipe handle. + * @param hPollSet The poll set handle (for access checks). + * @param fEvents The events we're polling for. + * @param fFinalEntry Set if this is the final entry for this handle + * in this poll set. This can be used for dealing + * with duplicate entries. + * @param fNoWait Set if it's a zero-wait poll call. Clear if + * we'll wait for an event to occur. + */ uint32_t rtPipePollStart(RTPIPE hPipe, RTPOLLSET hPollSet, uint32_t fEvents, bool fFinalEntry, bool fNoWait); + +/** + * Called after a WaitForMultipleObjects returned in order to check for pending + * events and stop whatever actions that rtPipePollStart() initiated. + * + * @returns Event mask or 0. + * + * @param hPipe The pipe handle. + * @param fEvents The events we're polling for. + * @param fFinalEntry Set if this is the final entry for this handle + * in this poll set. This can be used for dealing + * with duplicate entries. Only keep in mind that + * this method is called in reverse order, so the + * first call will have this set (when the entire + * set was processed). + * @param fHarvestEvents Set if we should check for pending events. + */ uint32_t rtPipePollDone(RTPIPE hPipe, uint32_t fEvents, bool fFinalEntry, bool fHarvestEvents); -#endif /* RT_OS_WINDOWS */ RT_C_DECLS_END diff --git a/src/VBox/Runtime/include/internal/process.h b/src/VBox/Runtime/include/internal/process.h index cf2c0799..ab00fb95 100644 --- a/src/VBox/Runtime/include/internal/process.h +++ b/src/VBox/Runtime/include/internal/process.h @@ -4,7 +4,7 @@ */ /* - * Copyright (C) 2006-2007 Oracle Corporation + * Copyright (C) 2006-2011 Oracle Corporation * * This file is part of VirtualBox Open Source Edition (OSE), as * available from http://www.virtualbox.org. This file is free software; diff --git a/src/VBox/Runtime/include/internal/rand.h b/src/VBox/Runtime/include/internal/rand.h index a68de658..88c8fba6 100644 --- a/src/VBox/Runtime/include/internal/rand.h +++ b/src/VBox/Runtime/include/internal/rand.h @@ -4,7 +4,7 @@ */ /* - * Copyright (C) 2006-2007 Oracle Corporation + * Copyright (C) 2006-2011 Oracle Corporation * * This file is part of VirtualBox Open Source Edition (OSE), as * available from http://www.virtualbox.org. This file is free software; diff --git a/src/VBox/Runtime/include/internal/sched.h b/src/VBox/Runtime/include/internal/sched.h index bab1a063..075a583d 100644 --- a/src/VBox/Runtime/include/internal/sched.h +++ b/src/VBox/Runtime/include/internal/sched.h @@ -4,7 +4,7 @@ */ /* - * Copyright (C) 2006-2007 Oracle Corporation + * Copyright (C) 2006-2011 Oracle Corporation * * This file is part of VirtualBox Open Source Edition (OSE), as * available from http://www.virtualbox.org. This file is free software; diff --git a/src/VBox/Runtime/include/internal/socket.h b/src/VBox/Runtime/include/internal/socket.h index 8ebfd7e1..e3ff4eb1 100644 --- a/src/VBox/Runtime/include/internal/socket.h +++ b/src/VBox/Runtime/include/internal/socket.h @@ -4,7 +4,7 @@ */ /* - * Copyright (C) 2010 Oracle Corporation + * Copyright (C) 2010-2013 Oracle Corporation * * This file is part of VirtualBox Open Source Edition (OSE), as * available from http://www.virtualbox.org. This file is free software; @@ -61,11 +61,9 @@ int rtSocketConnect(RTSOCKET hSocket, PCRTNETADDR pAddr); int rtSocketSetOpt(RTSOCKET hSocket, int iLevel, int iOption, void const *pvValue, int cbValue); #endif /* IPRT_INTERNAL_SOCKET_POLLING_ONLY */ -#ifdef RT_OS_WINDOWS -int rtSocketPollGetHandle(RTSOCKET hSocket, uint32_t fEvents, PHANDLE ph); +int rtSocketPollGetHandle(RTSOCKET hSocket, uint32_t fEvents, PRTHCINTPTR phNative); uint32_t rtSocketPollStart(RTSOCKET hSocket, RTPOLLSET hPollSet, uint32_t fEvents, bool fFinalEntry, bool fNoWait); uint32_t rtSocketPollDone(RTSOCKET hSocket, uint32_t fEvents, bool fFinalEntry, bool fHarvestEvents); -#endif /* RT_OS_WINDOWS */ RT_C_DECLS_END diff --git a/src/VBox/Runtime/include/internal/strhash.h b/src/VBox/Runtime/include/internal/strhash.h index a7399d06..e8684c0f 100644 --- a/src/VBox/Runtime/include/internal/strhash.h +++ b/src/VBox/Runtime/include/internal/strhash.h @@ -4,7 +4,7 @@ */ /* - * Copyright (C) 2006-2011 Oracle Corporation + * Copyright (C) 2006-2012 Oracle Corporation * * This file is part of VirtualBox Open Source Edition (OSE), as * available from http://www.virtualbox.org. This file is free software; diff --git a/src/VBox/Runtime/include/internal/strict.h b/src/VBox/Runtime/include/internal/strict.h index eed9a33c..0d242490 100644 --- a/src/VBox/Runtime/include/internal/strict.h +++ b/src/VBox/Runtime/include/internal/strict.h @@ -4,7 +4,7 @@ */ /* - * Copyright (C) 2007 Oracle Corporation + * Copyright (C) 2007-2013 Oracle Corporation * * This file is part of VirtualBox Open Source Edition (OSE), as * available from http://www.virtualbox.org. This file is free software; @@ -37,6 +37,13 @@ # define RTCRITSECT_STRICT #endif +/** @def RTCRITSECTRW_STRICT + * Enables strictness checks and lock accounting of the RTCritSectRw API. + */ +#if (!defined(RTCRITSECTRW_STRICT) && defined(IN_RING3) && defined(RT_LOCK_STRICT)) || defined(DOXYGEN_RUNNING) +# define RTCRITSECTRW_STRICT +#endif + /** @def RTSEMEVENT_STRICT * Enables strictness checks and lock accounting of the RTSemEvent API. */ diff --git a/src/VBox/Runtime/include/internal/thread.h b/src/VBox/Runtime/include/internal/thread.h index ed6412d0..337b0bfc 100644 --- a/src/VBox/Runtime/include/internal/thread.h +++ b/src/VBox/Runtime/include/internal/thread.h @@ -4,7 +4,7 @@ */ /* - * Copyright (C) 2006-2007 Oracle Corporation + * Copyright (C) 2006-2011 Oracle Corporation * * This file is part of VirtualBox Open Source Edition (OSE), as * available from http://www.virtualbox.org. This file is free software; @@ -139,6 +139,16 @@ typedef RTTHREADINT *PRTTHREADINT; */ DECLHIDDEN(int) rtThreadNativeInit(void); +#ifdef IN_RING3 +/** + * Called when IPRT was first initialized in unobtrusive mode and later changed + * to obtrustive. + * + * This is only applicable in ring-3. + */ +DECLHIDDEN(void) rtThreadNativeReInitObtrusive(void); +#endif + /** * Create a native thread. * This creates the thread as described in pThreadInt and stores the thread id in *pThread. @@ -199,6 +209,9 @@ DECLHIDDEN(void) rtThreadTerminate(PRTTHREADINT pThread, int rc); DECLHIDDEN(PRTTHREADINT) rtThreadGetByNative(RTNATIVETHREAD NativeThread); DECLHIDDEN(PRTTHREADINT) rtThreadGet(RTTHREAD Thread); DECLHIDDEN(int) rtThreadInit(void); +#ifdef IN_RING3 +DECLHIDDEN(void) rtThreadReInitObtrusive(void); +#endif DECLHIDDEN(void) rtThreadTerm(void); DECLHIDDEN(void) rtThreadInsert(PRTTHREADINT pThread, RTNATIVETHREAD NativeThread); #ifdef IN_RING3 |