]> git.ipfire.org Git - thirdparty/nettle.git/commitdiff
[S390x] Implement alloc_stack and free_stack macros in machine.m4
authorMamone Tarsha <maamoun.tk@googlemail.com>
Sun, 27 Jun 2021 14:16:56 +0000 (17:16 +0300)
committerMamone Tarsha <maamoun.tk@googlemail.com>
Sun, 27 Jun 2021 14:16:56 +0000 (17:16 +0300)
s390x/machine.m4

index acd5e26c41e6ca13ad2d72d08c2f6af2ef8c35fd..b10b3045e6392817000b8e5c77111f89a854132b 100644 (file)
@@ -1,2 +1,20 @@
 C Register usage:
 define(`RA', `%r14')
+define(`SP', `%r15')
+
+define(`STANDARD_STACK_FRAME',`160')
+
+C Dynamic stack space allocation
+C the allocated space is assigned to 'AP' general register
+C the length of space must be a multiple of 8
+C free_stack can be used to free the allocated space
+C alloc_stack(AP, space_len)
+define(`alloc_stack',
+`lgr            $1,SP
+    aghi           SP,-(STANDARD_STACK_FRAME+$2)
+    stg            $1,0(SP)
+    la             $1,STANDARD_STACK_FRAME (SP)')
+
+C free_stack(space_len)
+define(`free_stack',
+`aghi           SP,STANDARD_STACK_FRAME+$1')