xref: /optee_os/lib/libutils/isoc/arch/arm/arm32_aeabi_ldivmod_a32.S (revision 5a913ee74d3c71af2a2860ce8a4e7aeab2916f9b)
1/* SPDX-License-Identifier: BSD-2-Clause */
2/*
3 * Copyright (c) 2015, Linaro Limited
4 */
5
6#include <asm.S>
7
8/*
9 * This assembly source is used both in kernel and userland
10 * hence define unwind resources that match both environments.
11 */
12#if defined(CFG_UNWIND)
13#define LOCAL_UNWIND(...)	__VA_ARGS__
14#else
15#define LOCAL_UNWIND(...)
16#endif
17
18/*
19 * __value_in_regs lldiv_t __aeabi_ldivmod( long long n, long long d)
20 */
21.section .text.__aeabi_ldivmod
22FUNC __aeabi_ldivmod , :
23LOCAL_UNWIND(.fnstart)
24	push	{ip, lr}
25LOCAL_UNWIND(.save {ip, lr})
26	push	{r0-r3}
27LOCAL_UNWIND(.save {r0-r3})
28	mov	r0, sp
29	bl	__l_divmod
30	pop	{r0-r3}
31	pop	{ip, pc}
32LOCAL_UNWIND(.fnend)
33END_FUNC __aeabi_ldivmod
34
35/*
36 * __value_in_regs ulldiv_t __aeabi_uldivmod(
37 *		unsigned long long n, unsigned long long d)
38 */
39.section .text.__aeabi_uldivmod
40FUNC __aeabi_uldivmod , :
41LOCAL_UNWIND(.fnstart)
42	push	{ip, lr}
43LOCAL_UNWIND(.save {ip, lr})
44	push	{r0-r3}
45LOCAL_UNWIND(.save {r0-r3})
46	mov	r0, sp
47	bl	__ul_divmod
48	pop	{r0-r3}
49	pop	{ip, pc}
50LOCAL_UNWIND(.fnend)
51END_FUNC __aeabi_uldivmod
52