ref: 1e674fdb3338c137128eac6259bed85583b2925e
parent: 3d6d7683fa842103faf4ccf79e9663996d5bdd54
author: Martin Storsjö <martin@martin.st>
date: Tue Jun 16 05:26:15 EDT 2020
arm64: itx: Simplify and clarify the sub_sp macro a little bit Add an .error case for windows if subtracting more than 8 KB, simplify the generic subtraction case.
--- a/src/arm/64/itx.S
+++ b/src/arm/64/itx.S
@@ -3004,7 +3004,11 @@
.macro sub_sp space
#ifdef _WIN32
-.if \space > 4096
+.if \space > 8192
+ // Here, we'd need to touch two (or more) pages while decrementing
+ // the stack pointer.
+ .error "sub_sp_align doesn't support values over 8K at the moment"
+.elseif \space > 4096
sub x16, sp, #4096
ldr xzr, [x16]
sub sp, x16, #(\space - 4096)
@@ -3014,11 +3018,9 @@
#else
.if \space >= 4096
sub sp, sp, #(\space)/4096*4096
+.endif
.if (\space % 4096) != 0
sub sp, sp, #(\space)%4096
-.endif
-.else
- sub sp, sp, #\space
.endif
#endif
.endm
--- a/src/arm/64/itx16.S
+++ b/src/arm/64/itx16.S
@@ -3242,7 +3242,11 @@
.macro sub_sp space
#ifdef _WIN32
-.if \space > 4096
+.if \space > 8192
+ // Here, we'd need to touch two (or more) pages while decrementing
+ // the stack pointer.
+ .error "sub_sp_align doesn't support values over 8K at the moment"
+.elseif \space > 4096
sub x16, sp, #4096
ldr xzr, [x16]
sub sp, x16, #(\space - 4096)
@@ -3252,11 +3256,9 @@
#else
.if \space >= 4096
sub sp, sp, #(\space)/4096*4096
+.endif
.if (\space % 4096) != 0
sub sp, sp, #(\space)%4096
-.endif
-.else
- sub sp, sp, #\space
.endif
#endif
.endm