diff options
author | Mamone Tarsha <maamoun.tk@googlemail.com> | 2021-06-27 17:16:56 +0300 |
---|---|---|
committer | Mamone Tarsha <maamoun.tk@googlemail.com> | 2021-06-27 17:16:56 +0300 |
commit | b0525367c2dedbef9ebd9bf0a35a3cc3181cf7c6 (patch) | |
tree | 4de8305c997742801b27d0c9b33c752d5e73ea58 | |
parent | 724489280d94f224a12bd2ded23d060c9f6f3aec (diff) | |
download | nettle-b0525367c2dedbef9ebd9bf0a35a3cc3181cf7c6.tar.gz |
[S390x] Implement alloc_stack and free_stack macros in machine.m4
-rw-r--r-- | s390x/machine.m4 | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/s390x/machine.m4 b/s390x/machine.m4 index acd5e26c..b10b3045 100644 --- a/s390x/machine.m4 +++ b/s390x/machine.m4 @@ -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') |