From 03b50ff6ed2b233425ec3cbcc8140db5b2a80c98 Mon Sep 17 00:00:00 2001 From: ragmani Date: Wed, 5 Apr 2017 19:00:04 +0900 Subject: [PATCH] [x86/Linux] add three functions for _X86_TARGET_ (dotnet/coreclr#10378) * [x86/Linux] add three functions for _X86_TARGET_ There is no functions for _X86_TARGET_. - ZapUnwindData::GetAlignment() - DWORD ZapUnwindData::GetSize() - void ZapUnwindData::Save(ZapWriter * pZapWriter) * [x86/Linux] remove personality routine on x86/linux. remove creating personaly routine when assemblies is generated to ni. add a function for getting size of UnwindDataBlob on x86/linux. Signed-off-by: ragmani * [x86/Linux] correct the unclearly fixed parts. change Unwindinfo's size from sizeof(ULONG) to sizeof(UNWIND_INFO). change Unwindinfo's alignment from sizeof(DWORD) to sizeof(BYTE). remove unnecessary code. * [x86/Linux] change alignment from sizeof(BYTE) to sizeof(DWORD). Commit migrated from https://github.com/dotnet/coreclr/commit/c7241a9c7af7b2076d6876c0b747f6d7144ac347 --- src/coreclr/src/inc/daccess.h | 4 ++++ src/coreclr/src/vm/codeman.cpp | 7 +++++++ src/coreclr/src/zap/zapcode.cpp | 24 ++++++++++++++++++++++++ 3 files changed, 35 insertions(+) diff --git a/src/coreclr/src/inc/daccess.h b/src/coreclr/src/inc/daccess.h index 8ca9587..7d82e86 100644 --- a/src/coreclr/src/inc/daccess.h +++ b/src/coreclr/src/inc/daccess.h @@ -2393,6 +2393,10 @@ typedef DPTR(IMAGE_TLS_DIRECTORY) PTR_IMAGE_TLS_DIRECTORY; #include #endif +#if defined(_TARGET_X86_) && defined(FEATURE_PAL) +typedef DPTR(struct _UNWIND_INFO) PTR_UNWIND_INFO; +#endif + #ifdef _WIN64 typedef DPTR(T_RUNTIME_FUNCTION) PTR_RUNTIME_FUNCTION; typedef DPTR(struct _UNWIND_INFO) PTR_UNWIND_INFO; diff --git a/src/coreclr/src/vm/codeman.cpp b/src/coreclr/src/vm/codeman.cpp index ad4c519..c2632f7 100644 --- a/src/coreclr/src/vm/codeman.cpp +++ b/src/coreclr/src/vm/codeman.cpp @@ -985,6 +985,13 @@ PTR_VOID GetUnwindDataBlob(TADDR moduleBase, PTR_RUNTIME_FUNCTION pRuntimeFuncti return pUnwindInfo; +#elif defined(_TARGET_X86_) && defined(FEATURE_PAL) + PTR_UNWIND_INFO pUnwindInfo(dac_cast(moduleBase + RUNTIME_FUNCTION__GetUnwindInfoAddress(pRuntimeFunction))); + + *pSize = ALIGN_UP(sizeof(UNWIND_INFO), sizeof(DWORD)); + + return pUnwindInfo; + #elif defined(_TARGET_ARM_) // if this function uses packed unwind data then at least one of the two least significant bits diff --git a/src/coreclr/src/zap/zapcode.cpp b/src/coreclr/src/zap/zapcode.cpp index e54e884..ead385d 100644 --- a/src/coreclr/src/zap/zapcode.cpp +++ b/src/coreclr/src/zap/zapcode.cpp @@ -1202,6 +1202,30 @@ void ZapUnwindData::Save(ZapWriter * pZapWriter) #endif //REDHAWK } +#elif defined(_TARGET_X86_) && defined(FEATURE_PAL) + +UINT ZapUnwindData::GetAlignment() +{ + return sizeof(BYTE); +} + +DWORD ZapUnwindData::GetSize() +{ + DWORD dwSize = ZapBlob::GetSize(); + + return dwSize; +} + +void ZapUnwindData::Save(ZapWriter * pZapWriter) +{ + ZapImage * pImage = ZapImage::GetImage(pZapWriter); + + PVOID pData = GetData(); + DWORD dwSize = GetBlobSize(); + + pZapWriter->Write(pData, dwSize); +} + #elif defined(_TARGET_ARM_) || defined(_TARGET_ARM64_) UINT ZapUnwindData::GetAlignment() -- 2.7.4