xref: /reactos/sdk/lib/crt/math/arm/__rt_sdiv64.s (revision 53221834)
1/*
2 * PROJECT:     ReactOS CRT library
3 * LICENSE:     MIT (https://spdx.org/licenses/MIT)
4 * PURPOSE:     Implementation of __rt_sdiv64
5 * COPYRIGHT:   Copyright 2015 Timo Kreuzer <timo.kreuzer@reactos.org>
6 *              Copyright 2021 Roman Masanin <36927roma@gmail.com>
7 */
8
9/* INCLUDES ******************************************************************/
10
11#include <kxarm.h>
12
13    IMPORT __rt_sdiv64_worker
14
15/* CODE **********************************************************************/
16
17    TEXTAREA
18
19    /*
20        IN: r1:r0 = divisor
21        IN: r3:r2 = dividend
22        OUT: r1:r0 = quotient
23        OUT: r3:r2 = remainder
24    */
25    NESTED_ENTRY __rt_sdiv64
26
27    /* Allocate stack space and store parameters there */
28    push {lr}
29    sub sp,sp,0x10
30    mov r12,sp
31    push {r2,r3}
32    PROLOG_END
33
34    /* r0 = ret*, r2:r3 = divisor, [sp] = dividend */
35    mov r3,r1
36    mov r2,r0
37    mov r0,r12
38
39    /* Call the C worker function */
40    bl __rt_sdiv64_worker
41    add sp,sp,0x08
42
43    /* Move result data into the appropriate registers and return */
44    pop {r0,r1,r2,r3,pc}
45    NESTED_END __rt_sdiv64
46
47    END
48/* EOF */
49