xref: /optee_os/lib/libutils/isoc/arch/arm/arm32_aeabi_ldivmod_a32.S (revision 5b25c76ac40f830867e3d60800120ffd7874e8dc)
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 */
21FUNC __aeabi_ldivmod , :
22LOCAL_UNWIND(.fnstart)
23	push	{ip, lr}
24LOCAL_UNWIND(.save {ip, lr})
25	push	{r0-r3}
26LOCAL_UNWIND(.save {r0-r3})
27	mov	r0, sp
28	bl	__l_divmod
29	pop	{r0-r3}
30	pop	{ip, pc}
31LOCAL_UNWIND(.fnend)
32END_FUNC __aeabi_ldivmod
33
34/*
35 * __value_in_regs ulldiv_t __aeabi_uldivmod(
36 *		unsigned long long n, unsigned long long d)
37 */
38FUNC __aeabi_uldivmod , :
39LOCAL_UNWIND(.fnstart)
40	push	{ip, lr}
41LOCAL_UNWIND(.save {ip, lr})
42	push	{r0-r3}
43LOCAL_UNWIND(.save {r0-r3})
44	mov	r0, sp
45	bl	__ul_divmod
46	pop	{r0-r3}
47	pop	{ip, pc}
48LOCAL_UNWIND(.fnend)
49END_FUNC __aeabi_uldivmod
50