arch/riscv/lib/strchr.S

Source file repositories/reference/linux-study-clean/arch/riscv/lib/strchr.S

File Facts

System
Linux kernel
Corpus path
arch/riscv/lib/strchr.S
Extension
.S
Size
600 bytes
Lines
36
Domain
Architecture Layer
Bucket
arch/riscv
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/linkage.h>
#include <asm/asm.h>

/* char *strchr(const char *s, int c) */
SYM_FUNC_START(strchr)
	/*
	 * Parameters
	 *   a0 - The string to be searched
	 *   a1 - The character to search for
	 *
	 * Returns
	 *   a0 - Address of first occurrence of 'c' or 0
	 *
	 * Clobbers
	 *   t0
	 */
	andi	a1, a1, 0xff
1:
	lbu	t0, 0(a0)
	beq	t0, a1, 2f
	addi	a0, a0, 1
	bnez	t0, 1b
	li	a0, 0
2:
	ret
SYM_FUNC_END(strchr)

SYM_FUNC_ALIAS_WEAK(__pi_strchr, strchr)
EXPORT_SYMBOL(strchr)

Annotation

Implementation Notes