summaryrefslogtreecommitdiff
path: root/src/pal/src/arch/amd64/context.S
diff options
context:
space:
mode:
Diffstat (limited to 'src/pal/src/arch/amd64/context.S')
-rw-r--r--src/pal/src/arch/amd64/context.S21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/pal/src/arch/amd64/context.S b/src/pal/src/arch/amd64/context.S
new file mode 100644
index 0000000000..f8a2dca89c
--- /dev/null
+++ b/src/pal/src/arch/amd64/context.S
@@ -0,0 +1,21 @@
+// 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.
+
+#if defined(_DEBUG)
+ .text
+ .globl _DBG_CheckStackAlignment
+
+_DBG_CheckStackAlignment:
+ // Prolog - at this point we are at aligned - 8 (for the call)
+ pushq %rbp // aligned -16
+ movq %rsp, %rbp
+
+ testl $0xf,%esp // can get away with esp even on AMD64.
+ jz .+3
+ int3
+
+ // Epilog
+ popq %rbp
+ ret
+#endif