arch/sparc/lib/memscan_32.S

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

File Facts

System
Linux kernel
Corpus path
arch/sparc/lib/memscan_32.S
Extension
.S
Size
1969 bytes
Lines
139
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>

/* In essence, this is just a fancy strlen. */

#define LO_MAGIC 0x01010101
#define HI_MAGIC 0x80808080

	.text
	.align	4
	.globl	__memscan_zero, __memscan_generic
	.globl	memscan
EXPORT_SYMBOL(__memscan_zero)
EXPORT_SYMBOL(__memscan_generic)
__memscan_zero:
	/* %o0 = addr, %o1 = size */
	cmp	%o1, 0
	bne,a	1f
	 andcc	%o0, 3, %g0

	retl
	 nop

1:
	be	mzero_scan_word
	 sethi	%hi(HI_MAGIC), %g2

	ldsb	[%o0], %g3
mzero_still_not_word_aligned:
	cmp	%g3, 0
	bne	1f
	 add	%o0, 1, %o0

	retl
	 sub	%o0, 1, %o0

1:
	subcc	%o1, 1, %o1
	bne,a	1f
	 andcc	%o0, 3, %g0

	retl
	 nop

1:
	bne,a	mzero_still_not_word_aligned
	 ldsb	[%o0], %g3

	sethi	%hi(HI_MAGIC), %g2
mzero_scan_word:
	or	%g2, %lo(HI_MAGIC), %o3
	sethi	%hi(LO_MAGIC), %g3
	or	%g3, %lo(LO_MAGIC), %o2
mzero_next_word:
	ld	[%o0], %g2
mzero_next_word_preloaded:
	sub	%g2, %o2, %g2
mzero_next_word_preloaded_next:
	andcc	%g2, %o3, %g0
	bne	mzero_byte_zero
	 add	%o0, 4, %o0

mzero_check_out_of_fuel:
	subcc	%o1, 4, %o1
	bg,a	1f
	 ld	[%o0], %g2

	retl
	 nop

1:

Annotation

Implementation Notes