2015-04-11 12:44:55 +00:00
|
|
|
/*
|
2021-07-24 09:41:06 +00:00
|
|
|
* 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>
|
2021-07-31 01:04:25 +00:00
|
|
|
* Copyright 2021 Roman Masanin <36927roma@gmail.com>
|
2015-04-11 12:44:55 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/* INCLUDES ******************************************************************/
|
|
|
|
|
|
|
|
#include <kxarm.h>
|
|
|
|
|
2015-04-14 18:42:28 +00:00
|
|
|
IMPORT __rt_udiv64_worker
|
|
|
|
|
2015-04-11 12:44:55 +00:00
|
|
|
/* CODE **********************************************************************/
|
2015-04-30 21:04:29 +00:00
|
|
|
|
2015-04-11 12:44:55 +00:00
|
|
|
TEXTAREA
|
|
|
|
|
2021-07-24 09:41:06 +00:00
|
|
|
/*
|
|
|
|
IN: r1:r0 = divisor
|
|
|
|
IN: r3:r2 = dividend
|
|
|
|
OUT: r1:r0 = quotient
|
|
|
|
OUT: r3:r2 = remainder
|
|
|
|
*/
|
2015-04-14 18:42:28 +00:00
|
|
|
NESTED_ENTRY __rt_udiv64
|
|
|
|
|
|
|
|
/* Allocate stack space and store parameters there */
|
2021-07-24 18:23:58 +00:00
|
|
|
push {lr}
|
|
|
|
sub sp,sp,0x10
|
|
|
|
mov r12,sp
|
2021-07-31 01:04:25 +00:00
|
|
|
push {r2,r3}
|
2015-04-14 18:42:28 +00:00
|
|
|
PROLOG_END
|
|
|
|
|
2021-07-31 01:04:25 +00:00
|
|
|
/* r0 = ret*, r2:r3 = divisor, [sp] = dividend */
|
|
|
|
mov r3,r1
|
|
|
|
mov r2,r0
|
|
|
|
mov r0,r12
|
|
|
|
|
2015-04-14 18:42:28 +00:00
|
|
|
/* Call the C worker function */
|
2021-07-24 18:23:58 +00:00
|
|
|
bl __rt_udiv64_worker
|
2021-07-31 01:04:25 +00:00
|
|
|
add sp,sp,0x08
|
2015-04-11 12:44:55 +00:00
|
|
|
|
2015-04-14 18:42:28 +00:00
|
|
|
/* Move result data into the appropriate registers and return */
|
2021-07-24 18:23:58 +00:00
|
|
|
pop {r0,r1,r2,r3,pc}
|
2015-04-30 21:04:29 +00:00
|
|
|
NESTED_END __rt_udiv64
|
2015-04-11 12:44:55 +00:00
|
|
|
|
|
|
|
END
|
|
|
|
/* EOF */
|