arch/sparc/lib/csum_copy.S

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

File Facts

System
Linux kernel
Corpus path
arch/sparc/lib/csum_copy.S
Extension
.S
Size
7143 bytes
Lines
316
Domain
Architecture Layer
Bucket
arch/sparc
Inferred role
Architecture Layer: exported/initcall integration point
Status
integration implementation candidate

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 <linux/export.h>

#ifdef __KERNEL__
#define GLOBAL_SPARE	%g7
#else
#define GLOBAL_SPARE	%g5
#endif

#ifndef EX_LD
#define EX_LD(x)	x
#endif

#ifndef EX_ST
#define EX_ST(x)	x
#endif

#ifndef EX_RETVAL
#define EX_RETVAL(x)	x
#endif

#ifndef LOAD
#define LOAD(type,addr,dest)	type [addr], dest
#endif

#ifndef STORE
#define STORE(type,src,addr)	type src, [addr]
#endif

#ifndef FUNC_NAME
#define FUNC_NAME	csum_partial_copy_nocheck
#endif

	.register	%g2, #scratch
	.register	%g3, #scratch

	.text

90:
	/* We checked for zero length already, so there must be
	 * at least one byte.
	 */
	be,pt		%icc, 1f
	 nop
	EX_LD(LOAD(ldub, %o0 + 0x00, %o4))
	add		%o0, 1, %o0
	sub		%o2, 1, %o2
	EX_ST(STORE(stb, %o4, %o1 + 0x00))
	add		%o1, 1, %o1
1:	andcc		%o0, 0x2, %g0
	be,pn		%icc, 80f
	 cmp		%o2, 2
	blu,pn		%icc, 60f
	 nop
	EX_LD(LOAD(lduh, %o0 + 0x00, %o5))
	add		%o0, 2, %o0
	sub		%o2, 2, %o2
	EX_ST(STORE(sth, %o5, %o1 + 0x00))
	add		%o1, 2, %o1
	ba,pt		%xcc, 80f
	 add		%o5, %o4, %o4

	.globl		FUNC_NAME
	.type		FUNC_NAME,#function
	EXPORT_SYMBOL(FUNC_NAME)
FUNC_NAME:		/* %o0=src, %o1=dst, %o2=len */
	LOAD(prefetch, %o0 + 0x000, #n_reads)
	xor		%o0, %o1, %g1
	mov		-1, %o3
	clr		%o4
	andcc		%g1, 0x3, %g0

Annotation

Implementation Notes