root/arch/i386/math-emu/div_small.S

/* [previous][next][first][last][top][bottom][index][help] */
   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    W. Metzenthen, 22 Parker St, Ormond, Vic 3163,      |
   8  |                       Australia.  E-mail   billm@vaxc.cc.monash.edu.au    |
   9  |                                                                           |
  10  |                                                                           |
  11  +---------------------------------------------------------------------------*/
  12 
  13 /*---------------------------------------------------------------------------+
  14  |    unsigned long div_small(unsigned long long *x, unsigned long y)        |
  15  +---------------------------------------------------------------------------*/
  16 
  17 #include "fpu_asm.h"
  18 
  19 .text
  20 ENTRY(div_small)
  21         pushl   %ebp
  22         movl    %esp,%ebp
  23 
  24         pushl   %esi
  25 
  26         movl    PARAM1,%esi     /* pointer to num */
  27         movl    PARAM2,%ecx     /* The denominator */
  28 
  29         movl    4(%esi),%eax    /* Get the current num msw */
  30         xorl    %edx,%edx
  31         divl    %ecx
  32 
  33         movl    %eax,4(%esi)
  34 
  35         movl    (%esi),%eax     /* Get the num lsw */
  36         divl    %ecx
  37 
  38         movl    %eax,(%esi)
  39 
  40         movl    %edx,%eax       /* Return the remainder in eax */
  41 
  42         popl    %esi
  43 
  44         leave
  45         ret
  46 

/* [previous][next][first][last][top][bottom][index][help] */