xref: /kernel/linux/linux-5.10/arch/arm64/lib/strrchr.S
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /kernel/linux/linux-5.10/arch/arm64/lib/
18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Based on arch/arm/lib/strrchr.S
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Copyright (C) 1995-2000 Russell King
68c2ecf20Sopenharmony_ci * Copyright (C) 2013 ARM Ltd.
78c2ecf20Sopenharmony_ci */
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci#include <linux/linkage.h>
108c2ecf20Sopenharmony_ci#include <asm/assembler.h>
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci/*
138c2ecf20Sopenharmony_ci * Find the last occurrence of a character in a string.
148c2ecf20Sopenharmony_ci *
158c2ecf20Sopenharmony_ci * Parameters:
168c2ecf20Sopenharmony_ci *	x0 - str
178c2ecf20Sopenharmony_ci *	x1 - c
188c2ecf20Sopenharmony_ci * Returns:
198c2ecf20Sopenharmony_ci *	x0 - address of last occurrence of 'c' or 0
208c2ecf20Sopenharmony_ci */
218c2ecf20Sopenharmony_ciSYM_FUNC_START_WEAK_PI(strrchr)
228c2ecf20Sopenharmony_ci	mov	x3, #0
238c2ecf20Sopenharmony_ci	and	w1, w1, #0xff
248c2ecf20Sopenharmony_ci1:	ldrb	w2, [x0], #1
258c2ecf20Sopenharmony_ci	cbz	w2, 2f
268c2ecf20Sopenharmony_ci	cmp	w2, w1
278c2ecf20Sopenharmony_ci	b.ne	1b
288c2ecf20Sopenharmony_ci	sub	x3, x0, #1
298c2ecf20Sopenharmony_ci	b	1b
308c2ecf20Sopenharmony_ci2:	mov	x0, x3
318c2ecf20Sopenharmony_ci	ret
328c2ecf20Sopenharmony_ciSYM_FUNC_END_PI(strrchr)
338c2ecf20Sopenharmony_ciEXPORT_SYMBOL_NOKASAN(strrchr)
34

Indexes created Thu Nov 07 10:32:03 CST 2024