+++ /dev/null
-#------------------------------------------------------------------------------\r
-#\r
-# Copyright (c) 2006, Intel Corporation\r
-# All rights reserved. This program and the accompanying materials\r
-# are licensed and made available under the terms and conditions of the BSD License\r
-# which accompanies this distribution. The full text of the license may be found at\r
-# http://opensource.org/licenses/bsd-license.php\r
-#\r
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-#\r
-# Module Name:\r
-#\r
-# DivU64x64Remainder.asm\r
-#\r
-# Abstract:\r
-#\r
-# Calculate the quotient of a 64-bit integer by a 64-bit integer and returns\r
-# both the quotient and the remainder\r
-#\r
-#------------------------------------------------------------------------------\r
-\r
-\r
-\r
- \r
-\r
-.extern _InternalMathDivRemU64x32\r
-\r
-.global _InternalMathDivRemU64x64\r
-_InternalMathDivRemU64x64: \r
- movl 16(%esp),%ecx\r
- testl %ecx,%ecx\r
- jnz _DivRemU64x64\r
- movl 20(%esp),%ecx\r
- jecxz L1\r
- and $0,4(%ecx)\r
- movl %ecx,16(%esp)\r
-L1: \r
- jmp _InternalMathDivRemU64x32\r
-\r
-\r
-.global DivRemU64x64\r
-DivRemU64x64:\r
-# MISMATCH: "DivRemU64x64: USES ebx esi edi"\r
- push %ebx \r
- push %esi \r
- push %edi \r
- mov 20(%esp), %edx\r
- mov 16(%esp), %eax\r
- movl %edx,%edi\r
- movl %eax,%esi\r
- mov 24(%esp), %ebx\r
-L2: \r
- shrl %edx\r
- rcrl $1,%eax\r
- shrdl $1,%ecx,%ebx\r
- shrl %ecx\r
- jnz L2\r
- divl %ebx\r
- movl %eax,%ebx\r
- movl 28(%esp),%ecx\r
- mull 24(%esp)\r
- imull %ebx,%ecx\r
- addl %ecx,%edx\r
- mov 32(%esp), %ecx\r
- jc TooLarge\r
- cmpl %edx,%edi\r
- ja Correct\r
- jb TooLarge\r
- cmpl %eax,%esi\r
- jae Correct\r
-TooLarge: \r
- decl %ebx\r
- jecxz Return\r
- sub 24(%esp), %eax\r
- sbb 28(%esp), %edx\r
-Correct: \r
- jecxz Return\r
- subl %eax,%esi\r
- sbbl %edx,%edi\r
- movl %esi,(%ecx)\r
- movl %edi,4(%ecx)\r
-Return: \r
- movl %ebx,%eax\r
- xorl %edx,%edx\r
- push %edi \r
- push %esi \r
- push %ebx \r
- ret\r