mbox series

[v2,kvm-unit-tests,0/2] fix long division routines for ARM eabi

Message ID 20210512105440.748153-1-pbonzini@redhat.com (mailing list archive)
Headers show
Series fix long division routines for ARM eabi | expand

Message

Paolo Bonzini May 12, 2021, 10:54 a.m. UTC
As reported by Alexandru, ARM follows a different convention than
x86 so it needs __aeabi_ldivmod and __aeabi_uldivmod.  Because
it does not use __divdi3 and __moddi3, it also needs __divmoddi4
to build the eabi function upon.

Paolo

v1->v2: fix __divmoddi4, make sure -DTEST covers it

Paolo Bonzini (2):
  libcflat: clean up and complete long division routines
  arm: add eabi version of 64-bit division functions

 arm/Makefile.arm  |  1 +
 lib/arm/ldivmod.S | 32 ++++++++++++++++++++++++++++++++
 lib/ldiv32.c      | 40 ++++++++++++++++++++++++----------------
 3 files changed, 57 insertions(+), 16 deletions(-)
 create mode 100644 lib/arm/ldivmod.S

Comments

Alexandru Elisei May 12, 2021, 2:04 p.m. UTC | #1
Hello,

On 5/12/21 11:54 AM, Paolo Bonzini wrote:

> As reported by Alexandru, ARM follows a different convention than
> x86 so it needs __aeabi_ldivmod and __aeabi_uldivmod.  Because
> it does not use __divdi3 and __moddi3, it also needs __divmoddi4
> to build the eabi function upon.
>
> Paolo
>
> v1->v2: fix __divmoddi4, make sure -DTEST covers it
>
> Paolo Bonzini (2):
>   libcflat: clean up and complete long division routines
>   arm: add eabi version of 64-bit division functions
>
>  arm/Makefile.arm  |  1 +
>  lib/arm/ldivmod.S | 32 ++++++++++++++++++++++++++++++++
>  lib/ldiv32.c      | 40 ++++++++++++++++++++++++----------------
>  3 files changed, 57 insertions(+), 16 deletions(-)
>  create mode 100644 lib/arm/ldivmod.S
>
I ran the arm (compiled with arm-none-eabi-gcc and arm-linux-gnu-gcc) and arm64
tests under QEMU TCG, and everything worked as expected.

I ran the arm (compiled with both toolchains) and arm64 tests under qemu and
kvmtool on a Rockpro64 dev board, again I didn't encounter any issues. So for the
entire series:

Tested-by: Alexandru Elisei <alexandru.elisei@arm.com>

Thanks,

Alex