From 308fc7d7ed006a5eb86727244f10042719a18def Mon Sep 17 00:00:00 2001 From: Jonghyun Park Date: Mon, 5 Dec 2016 18:45:42 +0900 Subject: [PATCH 1/3] [x86/Linux] Add dummy files and port gmsasm.asm This commit adds two dummy asm files (asmhelpers.S, jithelp.S) and ports gmsasm.asm as gmsasm.S. This commit also revises CMakeLists.txt accordingly. --- src/vm/CMakeLists.txt | 6 ++++++ src/vm/i386/asmhelpers.S | 7 +++++++ src/vm/i386/gmsasm.S | 28 ++++++++++++++++++++++++++++ src/vm/i386/jithelp.S | 7 +++++++ 4 files changed, 48 insertions(+) create mode 100644 src/vm/i386/asmhelpers.S create mode 100644 src/vm/i386/gmsasm.S create mode 100644 src/vm/i386/jithelp.S diff --git a/src/vm/CMakeLists.txt b/src/vm/CMakeLists.txt index 02e44d368339..940a563d5251 100644 --- a/src/vm/CMakeLists.txt +++ b/src/vm/CMakeLists.txt @@ -375,6 +375,12 @@ else(WIN32) ${ARCH_SOURCES_DIR}/umthunkstub.S ${ARCH_SOURCES_DIR}/virtualcallstubamd64.S ) + elseif(CLR_CMAKE_TARGET_ARCH_I386) + set(VM_SOURCES_WKS_ARCH_ASM + ${ARCH_SOURCES_DIR}/asmhelpers.S + ${ARCH_SOURCES_DIR}/jithelp.S + ${ARCH_SOURCES_DIR}/gmsasm.S + ) elseif(CLR_CMAKE_TARGET_ARCH_ARM) set(VM_SOURCES_WKS_ARCH_ASM ${ARCH_SOURCES_DIR}/asmhelpers.S diff --git a/src/vm/i386/asmhelpers.S b/src/vm/i386/asmhelpers.S new file mode 100644 index 000000000000..ff481961a6d3 --- /dev/null +++ b/src/vm/i386/asmhelpers.S @@ -0,0 +1,7 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +.intel_syntax noprefix +#include "unixasmmacros.inc" +#include "asmconstants.h" diff --git a/src/vm/i386/gmsasm.S b/src/vm/i386/gmsasm.S new file mode 100644 index 000000000000..b93c837c2090 --- /dev/null +++ b/src/vm/i386/gmsasm.S @@ -0,0 +1,28 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +.intel_syntax noprefix +#include "unixasmmacros.inc" +#include "asmconstants.h" + +// int __fastcall LazyMachStateCaptureState(struct LazyMachState *pState); +LEAF_ENTRY LazyMachStateCaptureState, _TEXT + // marks that this is not yet valid + mov dword ptr [ecx+MachState__pRetAddr], 0 + + // remember register values + mov [ecx+MachState__edi], edi + mov [ecx+MachState__esi], esi + mov [ecx+MachState__ebx], ebx + mov [ecx+LazyMachState_captureEbp], ebp + mov [ecx+LazyMachState_captureEsp], esp + + // capture return address + mov eax, [esp] + mov dword ptr [ecx+LazyMachState_captureEip], eax + + // return 0 + xor eax, eax + ret +LEAF_END LazyMachStateCaptureState, _TEXT diff --git a/src/vm/i386/jithelp.S b/src/vm/i386/jithelp.S new file mode 100644 index 000000000000..ff481961a6d3 --- /dev/null +++ b/src/vm/i386/jithelp.S @@ -0,0 +1,7 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +.intel_syntax noprefix +#include "unixasmmacros.inc" +#include "asmconstants.h" From 9cbaa60ed03e97fca462baf0cff2bd3fa97e7d10 Mon Sep 17 00:00:00 2001 From: Jonghyun Park Date: Tue, 6 Dec 2016 08:17:49 +0900 Subject: [PATCH 2/3] Remove dummy files --- src/vm/CMakeLists.txt | 2 -- src/vm/i386/asmhelpers.S | 7 ------- src/vm/i386/jithelp.S | 7 ------- 3 files changed, 16 deletions(-) delete mode 100644 src/vm/i386/asmhelpers.S delete mode 100644 src/vm/i386/jithelp.S diff --git a/src/vm/CMakeLists.txt b/src/vm/CMakeLists.txt index 940a563d5251..1fb0e41f75e9 100644 --- a/src/vm/CMakeLists.txt +++ b/src/vm/CMakeLists.txt @@ -377,8 +377,6 @@ else(WIN32) ) elseif(CLR_CMAKE_TARGET_ARCH_I386) set(VM_SOURCES_WKS_ARCH_ASM - ${ARCH_SOURCES_DIR}/asmhelpers.S - ${ARCH_SOURCES_DIR}/jithelp.S ${ARCH_SOURCES_DIR}/gmsasm.S ) elseif(CLR_CMAKE_TARGET_ARCH_ARM) diff --git a/src/vm/i386/asmhelpers.S b/src/vm/i386/asmhelpers.S deleted file mode 100644 index ff481961a6d3..000000000000 --- a/src/vm/i386/asmhelpers.S +++ /dev/null @@ -1,7 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -.intel_syntax noprefix -#include "unixasmmacros.inc" -#include "asmconstants.h" diff --git a/src/vm/i386/jithelp.S b/src/vm/i386/jithelp.S deleted file mode 100644 index ff481961a6d3..000000000000 --- a/src/vm/i386/jithelp.S +++ /dev/null @@ -1,7 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -.intel_syntax noprefix -#include "unixasmmacros.inc" -#include "asmconstants.h" From 8c922e48f664f87ec6912c7a9f4d54b2662b17ea Mon Sep 17 00:00:00 2001 From: Jonghyun Park Date: Tue, 6 Dec 2016 08:32:09 +0900 Subject: [PATCH 3/3] Replace tabs with spaces --- src/vm/i386/gmsasm.S | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/vm/i386/gmsasm.S b/src/vm/i386/gmsasm.S index b93c837c2090..1e43fd281f3b 100644 --- a/src/vm/i386/gmsasm.S +++ b/src/vm/i386/gmsasm.S @@ -13,16 +13,16 @@ LEAF_ENTRY LazyMachStateCaptureState, _TEXT // remember register values mov [ecx+MachState__edi], edi - mov [ecx+MachState__esi], esi + mov [ecx+MachState__esi], esi mov [ecx+MachState__ebx], ebx - mov [ecx+LazyMachState_captureEbp], ebp - mov [ecx+LazyMachState_captureEsp], esp + mov [ecx+LazyMachState_captureEbp], ebp + mov [ecx+LazyMachState_captureEsp], esp // capture return address mov eax, [esp] mov dword ptr [ecx+LazyMachState_captureEip], eax // return 0 - xor eax, eax - ret + xor eax, eax + ret LEAF_END LazyMachStateCaptureState, _TEXT