Home | History | Annotate | Download | only in Ia32
      1 #------------------------------------------------------------------------------
      2 #
      3 # Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
      4 # This program and the accompanying materials are licensed and made available
      5 # under the terms and conditions of the BSD License which accompanies this
      6 # distribution.  The full text of the license may be found at
      7 # http://opensource.org/licenses/bsd-license.php.
      8 #
      9 # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
     10 # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
     11 #
     12 # Module Name:
     13 #
     14 #   MathDivU64x64.S
     15 #
     16 # Abstract:
     17 #
     18 #   64-bit Math Worker Function.
     19 #   Divides a 64-bit unsigned value with a 64-bit unsigned value and returns
     20 #   a 64-bit unsigned result.
     21 #
     22 #------------------------------------------------------------------------------
     23 
     24     .686:
     25     .code:
     26 
     27 ASM_GLOBAL ASM_PFX(__udivdi3), ASM_PFX(DivU64x64Remainder)
     28 
     29 #------------------------------------------------------------------------------
     30 #
     31 # void __cdecl __udivdi3 (void)
     32 #
     33 #------------------------------------------------------------------------------
     34 ASM_PFX(__udivdi3):
     35     # Original local stack when calling __udivdi3
     36     #               -----------------
     37     #               |               |
     38     #               |---------------|
     39     #               |               |
     40     #               |--  Divisor  --|
     41     #               |               |
     42     #               |---------------|
     43     #               |               |
     44     #               |--  Dividend --|
     45     #               |               |
     46     #               |---------------|
     47     #               |  ReturnAddr** |
     48     #       ESP---->|---------------|
     49     #
     50 
     51     #
     52     # Set up the local stack for NULL Reminder pointer
     53     #
     54     xorl    %eax, %eax
     55     push    %eax
     56 
     57     #
     58     # Set up the local stack for Divisor parameter
     59     #
     60     movl    20(%esp), %eax
     61     push    %eax
     62     movl    20(%esp), %eax
     63     push    %eax
     64 
     65     #
     66     # Set up the local stack for Dividend parameter
     67     #
     68     movl    20(%esp), %eax
     69     push    %eax
     70     movl    20(%esp), %eax
     71     push    %eax
     72 
     73     #
     74     # Call native DivU64x64Remainder of BaseLib
     75     #
     76     jmp     ASM_PFX(DivU64x64Remainder)
     77 
     78     #
     79     # Adjust stack
     80     #
     81     addl    $20, %esp
     82 
     83     ret     $16
     84