lib/crypto/powerpc/sha256-spe-asm.S

Source file repositories/reference/linux-study-clean/lib/crypto/powerpc/sha256-spe-asm.S

File Facts

System
Linux kernel
Corpus path
lib/crypto/powerpc/sha256-spe-asm.S
Extension
.S
Size
11199 bytes
Lines
319
Domain
Kernel Services
Bucket
lib
Inferred role
Kernel Services: lib
Status
atlas-only

Why This File Exists

Shared kernel service surface used by multiple subsystems, including helpers, cryptography, virtualization support, and async I/O infrastructure.

Dependency Surface

Detected Declarations

Annotated Snippet

#include <asm/ppc_asm.h>
#include <asm/asm-offsets.h>

#define rHP	r3	/* pointer to hash values in memory		*/
#define rKP	r24	/* pointer to round constants			*/
#define rWP	r4	/* pointer to input data			*/

#define rH0	r5	/* 8 32 bit hash values in 8 registers		*/
#define rH1	r6
#define rH2	r7
#define rH3	r8
#define rH4	r9
#define rH5	r10
#define rH6	r11
#define rH7	r12

#define rW0	r14	/* 64 bit registers. 16 words in 8 registers	*/
#define rW1	r15
#define rW2	r16
#define rW3	r17
#define rW4	r18
#define rW5	r19
#define rW6	r20
#define rW7	r21

#define rT0	r22	/* 64 bit temporaries 				*/
#define rT1	r23
#define rT2	r0	/* 32 bit temporaries				*/
#define rT3	r25

#define CMP_KN_LOOP
#define CMP_KC_LOOP \
	cmpwi		rT1,0;

#define INITIALIZE \
	stwu		r1,-128(r1);	/* create stack frame		*/ \
	evstdw		r14,8(r1);	/* We must save non volatile	*/ \
	evstdw		r15,16(r1);	/* registers. Take the chance	*/ \
	evstdw		r16,24(r1);	/* and save the SPE part too	*/ \
	evstdw		r17,32(r1);					   \
	evstdw		r18,40(r1);					   \
	evstdw		r19,48(r1);					   \
	evstdw		r20,56(r1);					   \
	evstdw		r21,64(r1);					   \
	evstdw		r22,72(r1);					   \
	evstdw		r23,80(r1);					   \
	stw		r24,88(r1);	/* save normal registers	*/ \
	stw		r25,92(r1);


#define FINALIZE \
	evldw		r14,8(r1);	/* restore SPE registers	*/ \
	evldw		r15,16(r1);					   \
	evldw		r16,24(r1);					   \
	evldw		r17,32(r1);					   \
	evldw		r18,40(r1);					   \
	evldw		r19,48(r1);					   \
	evldw		r20,56(r1);					   \
	evldw		r21,64(r1);					   \
	evldw		r22,72(r1);					   \
	evldw		r23,80(r1);					   \
	lwz		r24,88(r1);	/* restore normal registers	*/ \
	lwz		r25,92(r1);					   \
	xor		r0,r0,r0;					   \
	stw		r0,8(r1);	/* Delete sensitive data	*/ \
	stw		r0,16(r1);	/* that we might have pushed	*/ \
	stw		r0,24(r1);	/* from other context that runs	*/ \
	stw		r0,32(r1);	/* the same code. Assume that	*/ \
	stw		r0,40(r1);	/* the lower part of the GPRs	*/ \
	stw		r0,48(r1);	/* was already overwritten on	*/ \

Annotation

Implementation Notes