div_small.S 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. .file "div_small.S"
  3. /*---------------------------------------------------------------------------+
  4. | div_small.S |
  5. | |
  6. | Divide a 64 bit integer by a 32 bit integer & return remainder. |
  7. | |
  8. | Copyright (C) 1992,1995 |
  9. | W. Metzenthen, 22 Parker St, Ormond, Vic 3163, |
  10. | Australia. E-mail [email protected] |
  11. | |
  12. | |
  13. +---------------------------------------------------------------------------*/
  14. /*---------------------------------------------------------------------------+
  15. | unsigned long FPU_div_small(unsigned long long *x, unsigned long y) |
  16. +---------------------------------------------------------------------------*/
  17. #include "fpu_emu.h"
  18. .text
  19. SYM_FUNC_START(FPU_div_small)
  20. pushl %ebp
  21. movl %esp,%ebp
  22. pushl %esi
  23. movl PARAM1,%esi /* pointer to num */
  24. movl PARAM2,%ecx /* The denominator */
  25. movl 4(%esi),%eax /* Get the current num msw */
  26. xorl %edx,%edx
  27. divl %ecx
  28. movl %eax,4(%esi)
  29. movl (%esi),%eax /* Get the num lsw */
  30. divl %ecx
  31. movl %eax,(%esi)
  32. movl %edx,%eax /* Return the remainder in eax */
  33. popl %esi
  34. leave
  35. RET
  36. SYM_FUNC_END(FPU_div_small)