]> git.ipfire.org Git - thirdparty/nettle.git/commitdiff
[S390x] Use uppercase for macro names in machine.m4 and enhance the documentation...
authorMamone Tarsha <maamoun.tk@googlemail.com>
Thu, 1 Jul 2021 02:47:02 +0000 (05:47 +0300)
committerMamone Tarsha <maamoun.tk@googlemail.com>
Thu, 1 Jul 2021 02:47:02 +0000 (05:47 +0300)
s390x/machine.m4
s390x/msa_x4/gcm-hash.asm

index b10b3045e6392817000b8e5c77111f89a854132b..8626cec15ae42bbe401035579b6248fb98f6d42e 100644 (file)
@@ -1,20 +1,21 @@
 C Register usage:
-define(`RA', `%r14')
-define(`SP', `%r15')
+define(`RA', `%r14') C Return address
+define(`SP', `%r15') C Stack pointer
 
 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',
+C AP is a general register to which the allocated space is assigned
+C SPACE_LEN is the length of space, must be a multiple of 8
+C FREE_STACK macro 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',
+C Free allocated stack space
+C FREE_STACK(SPACE_LEN)
+define(`FREE_STACK',
 `aghi           SP,STANDARD_STACK_FRAME+$1')
index b54debf20c4a6a57cdb4d2b2b75c28cb7a3f735d..73a50824a0abab0b23c6f49bd60011ac9dcfa53c 100644 (file)
@@ -65,15 +65,16 @@ C void gcm_hash (const struct gcm_key *key, union gcm_block *x,
 C                size_t length, const uint8_t *data)
 
 PROLOGUE(_nettle_gcm_hash)
-    ldgr           %f0,%r6
-    alloc_stack(%r1,PB_SIZE+16)                  C parameter block (must be general register 1)
+    ldgr           %f0,%r6                       C load non-volatile general register 6 into volatile float-point register 0
+    C --- allocate a stack space for parameter block in addition to 16-byte buffer to handle leftover bytes ---
+    ALLOC_STACK(%r1,PB_SIZE+16)                  C parameter block (must be general register 1)
     lgr            %r6,%r3
     mvc            0(16,%r1),0(%r3)              C copy x Initial Chaining Value field
     mvc            16(16,%r1),H_idx (%r2)        C copy H to Hash Subkey field
     lghi           %r0,65                        C GHASH function code (must be general register 0)
     lgr            %r2,%r5                       C location of leftmost byte of data (must not be odd-numbered general register nor be general register 0)
     C number of bytes (must be general register of data + 1). length must be a multiple of the data block size (16).
-    risbg          %r3,%r4,0,187,0               C Insert bit offsets 0-59, bit offset 0 of the fourth operant is set to clear the remaining bits.
+    risbg          %r3,%r4,0,187,0               C Insert bit offsets 0-59, bit offset 0 of the fourth operand is set to clear the remaining bits.
 1:  .long   0xb93e0002                           C kimd %r0,%r2
     brc            1,1b                          C safely branch back in case of partial completion
     C --- handle leftovers ---
@@ -91,7 +92,7 @@ PROLOGUE(_nettle_gcm_hash)
     brc            1,3b                          C safely branch back in case of partial completion
 4:
     mvc            0(16,%r6),0(%r1)              C store x
-    free_stack(PB_SIZE+16)
-    lgdr           %r6,%f0
+    FREE_STACK(PB_SIZE+16)
+    lgdr           %r6,%f0                       C restore general register 6
     br             RA
 EPILOGUE(_nettle_gcm_hash)