div_small.S 1.5 KB

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