summaryrefslogtreecommitdiff
path: root/src/jit/codegencommon.cpp
diff options
context:
space:
mode:
authorBruce Forstall <brucefo@microsoft.com>2017-11-20 14:29:55 -0800
committerGitHub <noreply@github.com>2017-11-20 14:29:55 -0800
commit3d68768793f7fd2e13e9221b2e3dd0036503c084 (patch)
tree92506ef842ade4fcff97b4c33399454b10908c62 /src/jit/codegencommon.cpp
parent27bf8786233933ce8dbcc621d9a299d776acca6b (diff)
parent1a017d608b293bb3022ccf66d39581e6a54e3568 (diff)
downloadcoreclr-3d68768793f7fd2e13e9221b2e3dd0036503c084.tar.gz
coreclr-3d68768793f7fd2e13e9221b2e3dd0036503c084.tar.bz2
coreclr-3d68768793f7fd2e13e9221b2e3dd0036503c084.zip
Merge pull request #15087 from BruceForstall/FixJmpGsCheck
Fix RyuJIT/arm32 GS cookie check before JMP call
Diffstat (limited to 'src/jit/codegencommon.cpp')
-rw-r--r--src/jit/codegencommon.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/jit/codegencommon.cpp b/src/jit/codegencommon.cpp
index 54b0388fe4..53b1eb36c0 100644
--- a/src/jit/codegencommon.cpp
+++ b/src/jit/codegencommon.cpp
@@ -2647,7 +2647,7 @@ emitJumpKind CodeGen::genJumpKindForOper(genTreeOps cmp, CompareKind compareKind
#ifdef _TARGET_ARMARCH_
//------------------------------------------------------------------------
// genEmitGSCookieCheck: Generate code to check that the GS cookie
-// wasn't thrashed by a buffer overrun. Coomon code for ARM32 and ARM64
+// wasn't thrashed by a buffer overrun. Common code for ARM32 and ARM64.
//
void CodeGen::genEmitGSCookieCheck(bool pushReg)
{
@@ -2658,8 +2658,14 @@ void CodeGen::genEmitGSCookieCheck(bool pushReg)
if (!pushReg && (compiler->info.compRetType == TYP_REF))
gcInfo.gcRegGCrefSetCur |= RBM_INTRET;
- regNumber regGSConst = REG_TMP_0;
- regNumber regGSValue = REG_TMP_1;
+ // We need two temporary registers, to load the GS cookie values and compare them. We can't use
+ // any argument registers if 'pushReg' is true (meaning we have a JMP call). They should be
+ // callee-trash registers, which should not contain anything interesting at this point.
+ // We don't have any IR node representing this check, so LSRA can't communicate registers
+ // for us to use.
+
+ regNumber regGSConst = REG_GSCOOKIE_TMP_0;
+ regNumber regGSValue = REG_GSCOOKIE_TMP_1;
if (compiler->gsGlobalSecurityCookieAddr == nullptr)
{