div_small.S 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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