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.
TL:DR the calling convention of
__ldvrmudoes not match the calling convention defined by Zilog.ldiv_t ldiv(long, long)calls__ldvrmuand is hard-coded to use theexx __ldvrmucalling convention, but the calling convention of__ldvrmuchanges depending on the state ofPREFER_OS_CRT.At a minimum, I think we should change the
exx __ldvrmuroutine to a different name, like__ldivrem_common.