Skip to content

C ldiv_t ldiv(long, long) won't work with PREFER_OS_CRT #793

@ZERICO2005

Description

@ZERICO2005

TL:DR the calling convention of __ldvrmu does not match the calling convention defined by Zilog.

OS and fallback __ldvrmu:
; I: EUHL=dividend, AUBC=divisor
; O: a[uhl']=EUHL%AUBC, bcu=0, b=A, c=?, euhl=EUHL/AUBC, eubc'=AUBC, zf=!IEF2

exx __ldvrmu:
; I: EUHL=dividend, AUBC=divisor
; O: auhl=EUHL%AUBC, euix=EUHL/AUBC, iyh=A, iyl=0

ldiv_t ldiv(long, long) calls __ldvrmu and is hard-coded to use the exx __ldvrmu calling convention, but the calling convention of __ldvrmu changes depending on the state of PREFER_OS_CRT.

At a minimum, I think we should change the exx __ldvrmu routine to a different name, like __ldivrem_common.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions