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         .align 2,144
  21 
  22 .globl _div_small
  23 
  24 _div_small:
  25         pushl   %ebp
  26         movl    %esp,%ebp
  27 
  28         pushl   %esi
  29 
  30         movl    PARAM1,%esi     /* pointer to num */
  31         movl    PARAM2,%ecx     /* The denominator */
  32 
  33         movl    4(%esi),%eax    /* Get the current num msw */
  34         xorl    %edx,%edx
  35         divl    %ecx
  36 
  37         movl    %eax,4(%esi)
  38 
  39         movl    (%esi),%eax     /* Get the num lsw */
  40         divl    %ecx
  41 
  42         movl    %eax,(%esi)
  43 
  44         movl    %edx,%eax       /* Return the remainder in eax */
  45 
  46         popl    %esi
  47 
  48         leave
  49         ret
  50 

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