reactos/sdk/lib/crt/math/arm/__rt_udiv64.s
Roman Masanin be3c532bf4
[ARM/CRT] Refactor several functions (#3865)
- Make __fto64 function more readable
- Call worker function directly for __rt_sdiv/udiv
- Adapt __rt_sdiv64/udiv64 asm shims accordingly
- Add header files to CMake source list

CORE-17607 CORE-17614 CORE-17703 CORE-17604

Addendum to f2bc1f0e, e448094e and 54406bf4.
2021-07-31 11:24:03 +03:00

48 lines
1.1 KiB
ArmAsm

/*
* PROJECT: ReactOS CRT library
* LICENSE: MIT (https://spdx.org/licenses/MIT)
* PURPOSE: Implementation of __rt_udiv64
* COPYRIGHT: Copyright 2015 Timo Kreuzer <timo.kreuzer@reactos.org>
* Copyright 2021 Roman Masanin <36927roma@gmail.com>
*/
/* INCLUDES ******************************************************************/
#include <kxarm.h>
IMPORT __rt_udiv64_worker
/* CODE **********************************************************************/
TEXTAREA
/*
IN: r1:r0 = divisor
IN: r3:r2 = dividend
OUT: r1:r0 = quotient
OUT: r3:r2 = remainder
*/
NESTED_ENTRY __rt_udiv64
/* Allocate stack space and store parameters there */
push {lr}
sub sp,sp,0x10
mov r12,sp
push {r2,r3}
PROLOG_END
/* r0 = ret*, r2:r3 = divisor, [sp] = dividend */
mov r3,r1
mov r2,r0
mov r0,r12
/* Call the C worker function */
bl __rt_udiv64_worker
add sp,sp,0x08
/* Move result data into the appropriate registers and return */
pop {r0,r1,r2,r3,pc}
NESTED_END __rt_udiv64
END
/* EOF */