X-Git-Url: https://oss.titaniummirror.com/gitweb/?a=blobdiff_plain;f=src%2Fstdlib%2Fldiv.S;fp=src%2Fstdlib%2Fldiv.S;h=597258076670e4e5831720c4fa0b9c646c8fd45c;hb=6f720ff00773571c2fa2d35e67bff68547617639;hp=66029b8c686744ae69d5433e5e3f1fd6b234d12e;hpb=807b2dd5b7365eb87b482197af3b4a3f520c14f7;p=msp430-libc.git diff --git a/src/stdlib/ldiv.S b/src/stdlib/ldiv.S index 66029b8..5972580 100644 --- a/src/stdlib/ldiv.S +++ b/src/stdlib/ldiv.S @@ -1,13 +1,18 @@ +#include "../core_common.inc" /* ldiv() is the same as __divmodsi4() in libgcc */ .section .text .global ldiv ldiv: ;; save clobbers first - push r8 - push r9 - push r10 +#if defined(__MSP430X__) + XPUSHM #2, r11 +#else push r11 + push r10 + push r9 + push r8 +#endif ;; mov registers. mov r13, r11 ;; denom mov r12, r10 @@ -17,9 +22,15 @@ ldiv: call #__divmodsi4 ;; result is in there already... ;; restore regs and return. - pop r11 - pop r10 - pop r9 +#if defined(__MSP430X__) + XPOPM #4, r11 + XRET +#elif defined(__MSP430_SAVE_PROLOGUE__) + br #__epilogue_restorer + 4 * 2 +#else pop r8 + pop r9 + pop r10 + pop r11 ret - +#endif