arch/sparc/lib/NGbzero.S

Source file repositories/reference/linux-study-clean/arch/sparc/lib/NGbzero.S

File Facts

System
Linux kernel
Corpus path
arch/sparc/lib/NGbzero.S
Extension
.S
Size
3465 bytes
Lines
162
Domain
Architecture Layer
Bucket
arch/sparc
Inferred role
Architecture Layer: arch/sparc
Status
atlas-only

Why This File Exists

CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.

Dependency Surface

Detected Declarations

Annotated Snippet

#include <asm/asi.h>

#define EX_ST(x,y)		\
98:	x,y;			\
	.section __ex_table,"a";\
	.align 4;		\
	.word 98b, __retl_o1_asi;\
	.text;			\
	.align 4;

	.text

	.globl		NGmemset
	.type		NGmemset, #function
NGmemset:		/* %o0=buf, %o1=pat, %o2=len */
	and		%o1, 0xff, %o3
	mov		%o2, %o1
	sllx		%o3, 8, %g1
	or		%g1, %o3, %o2
	sllx		%o2, 16, %g1
	or		%g1, %o2, %o2
	sllx		%o2, 32, %g1
	ba,pt		%xcc, 1f
	 or		%g1, %o2, %o2

	.globl		NGbzero
	.type		NGbzero, #function
NGbzero:
	clr		%o2
1:	brz,pn		%o1, NGbzero_return
	 mov		%o0, %o3

	/* %o5: saved %asi, restored at NGbzero_done
	 * %g7: store-init %asi to use
	 * %o4:	non-store-init %asi to use
	 */
	rd		%asi, %o5
	mov		ASI_BLK_INIT_QUAD_LDD_P, %g7
	mov		ASI_P, %o4
	wr		%o4, 0x0, %asi

NGbzero_from_clear_user:
	cmp		%o1, 15
	bl,pn		%icc, NGbzero_tiny
	 andcc		%o0, 0x7, %g1
	be,pt		%xcc, 2f
	 mov		8, %g2
	sub		%g2, %g1, %g1
	sub		%o1, %g1, %o1
1:	EX_ST(stba %o2, [%o0 + 0x00] %asi)
	subcc		%g1, 1, %g1
	bne,pt		%xcc, 1b
	 add		%o0, 1, %o0
2:	cmp		%o1, 128
	bl,pn		%icc, NGbzero_medium
	 andcc		%o0, (64 - 1), %g1
	be,pt		%xcc, NGbzero_pre_loop
	 mov		64, %g2
	sub		%g2, %g1, %g1
	sub		%o1, %g1, %o1
1:	EX_ST(stxa %o2, [%o0 + 0x00] %asi)
	subcc		%g1, 8, %g1
	bne,pt		%xcc, 1b
	 add		%o0, 8, %o0

NGbzero_pre_loop:
	wr		%g7, 0x0, %asi
	andn		%o1, (64 - 1), %g1
	sub		%o1, %g1, %o1
NGbzero_loop:

Annotation

Implementation Notes