Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.jus...@intel.com>
---
 CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf    |  2 +-
 CryptoPkg/Library/BaseCryptLib/PeiCryptLib.inf     |  2 +-
 CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf |  2 +-
 CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf     |  2 +-
 .../BaseCryptLib/SysCall/Ia32/MathDivU64x64.S      | 83 ----------------------
 .../BaseCryptLib/SysCall/Ia32/MathDivU64x64.nasm   | 77 ++++++++++++++++++++
 6 files changed, 81 insertions(+), 87 deletions(-)
 delete mode 100644 CryptoPkg/Library/BaseCryptLib/SysCall/Ia32/MathDivU64x64.S
 create mode 100644 
CryptoPkg/Library/BaseCryptLib/SysCall/Ia32/MathDivU64x64.nasm

diff --git a/CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf 
b/CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
index b1e0590..2358102 100644
--- a/CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
+++ b/CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
@@ -70,7 +70,7 @@
   SysCall/Ia32/MathRShiftU64.c      | INTEL
 
   SysCall/Ia32/MathMultS64x64.nasm  | GCC
-  SysCall/Ia32/MathDivU64x64.S      | GCC
+  SysCall/Ia32/MathDivU64x64.nasm   | GCC
   SysCall/Ia32/MathReminderU64x64.S | GCC
   SysCall/Ia32/MathLShiftS64.S      | GCC
   SysCall/Ia32/MathRShiftU64.S      | GCC
diff --git a/CryptoPkg/Library/BaseCryptLib/PeiCryptLib.inf 
b/CryptoPkg/Library/BaseCryptLib/PeiCryptLib.inf
index 89a2264..a0dd683 100644
--- a/CryptoPkg/Library/BaseCryptLib/PeiCryptLib.inf
+++ b/CryptoPkg/Library/BaseCryptLib/PeiCryptLib.inf
@@ -80,7 +80,7 @@
   SysCall/Ia32/MathRShiftU64.c      | INTEL
 
   SysCall/Ia32/MathMultS64x64.nasm  | GCC
-  SysCall/Ia32/MathDivU64x64.S      | GCC
+  SysCall/Ia32/MathDivU64x64.nasm   | GCC
   SysCall/Ia32/MathReminderU64x64.S | GCC
   SysCall/Ia32/MathLShiftS64.S      | GCC
   SysCall/Ia32/MathRShiftU64.S      | GCC
diff --git a/CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf 
b/CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf
index 6b68dcc..57d0852 100644
--- a/CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf
+++ b/CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf
@@ -75,7 +75,7 @@
   SysCall/Ia32/MathRShiftU64.c      | INTEL
 
   SysCall/Ia32/MathMultS64x64.nasm  | GCC
-  SysCall/Ia32/MathDivU64x64.S      | GCC
+  SysCall/Ia32/MathDivU64x64.nasm   | GCC
   SysCall/Ia32/MathReminderU64x64.S | GCC
   SysCall/Ia32/MathLShiftS64.S      | GCC
   SysCall/Ia32/MathRShiftU64.S      | GCC
diff --git a/CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf 
b/CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf
index 14b6493..e3972bc 100644
--- a/CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf
+++ b/CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf
@@ -75,7 +75,7 @@
   SysCall/Ia32/MathRShiftU64.c      | INTEL
 
   SysCall/Ia32/MathMultS64x64.nasm  | GCC
-  SysCall/Ia32/MathDivU64x64.S      | GCC
+  SysCall/Ia32/MathDivU64x64.nasm   | GCC
   SysCall/Ia32/MathReminderU64x64.S | GCC
   SysCall/Ia32/MathLShiftS64.S      | GCC
   SysCall/Ia32/MathRShiftU64.S      | GCC
diff --git a/CryptoPkg/Library/BaseCryptLib/SysCall/Ia32/MathDivU64x64.S 
b/CryptoPkg/Library/BaseCryptLib/SysCall/Ia32/MathDivU64x64.S
deleted file mode 100644
index f46d5b8..0000000
--- a/CryptoPkg/Library/BaseCryptLib/SysCall/Ia32/MathDivU64x64.S
+++ /dev/null
@@ -1,83 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD 
License
-# which accompanies this distribution.  The full text of the license may be 
found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-#   MathDivU64x64.S
-#
-# Abstract:
-#
-#   64-bit Math Worker Function.
-#   Divides a 64-bit unsigned value with a 64-bit unsigned value and returns
-#   a 64-bit unsigned result.
-#
-#------------------------------------------------------------------------------
-
-    .686:
-    .code:
-
-ASM_GLOBAL ASM_PFX(__udivdi3), ASM_PFX(DivU64x64Remainder)
-
-#------------------------------------------------------------------------------
-#
-# void __cdecl __udivdi3 (void)
-#
-#------------------------------------------------------------------------------
-ASM_PFX(__udivdi3):
-    # Original local stack when calling __udivdi3
-    #               -----------------
-    #               |               |
-    #               |---------------|
-    #               |               |
-    #               |--  Divisor  --|
-    #               |               |
-    #               |---------------|
-    #               |               |
-    #               |--  Dividend --|
-    #               |               |
-    #               |---------------|
-    #               |  ReturnAddr** |
-    #       ESP---->|---------------|
-    #
-
-    #
-    # Set up the local stack for NULL Reminder pointer
-    #
-    xorl    %eax, %eax
-    push    %eax
-
-    #
-    # Set up the local stack for Divisor parameter
-    #
-    movl    20(%esp), %eax
-    push    %eax
-    movl    20(%esp), %eax
-    push    %eax
-
-    #
-    # Set up the local stack for Dividend parameter
-    #
-    movl    20(%esp), %eax
-    push    %eax
-    movl    20(%esp), %eax
-    push    %eax
-
-    #
-    # Call native DivU64x64Remainder of BaseLib
-    #
-    jmp     ASM_PFX(DivU64x64Remainder)
-
-    #
-    # Adjust stack
-    #
-    addl    $20, %esp
-
-    ret     $16
diff --git a/CryptoPkg/Library/BaseCryptLib/SysCall/Ia32/MathDivU64x64.nasm 
b/CryptoPkg/Library/BaseCryptLib/SysCall/Ia32/MathDivU64x64.nasm
new file mode 100644
index 0000000..fd2abf3
--- /dev/null
+++ b/CryptoPkg/Library/BaseCryptLib/SysCall/Ia32/MathDivU64x64.nasm
@@ -0,0 +1,77 @@
+;------------------------------------------------------------------------------
+; @file
+;   64-bit Math Worker Function.
+;   Divides a 64-bit unsigned value with a 64-bit unsigned value and returns
+;   a 64-bit unsigned result.
+;
+; Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>
+; This program and the accompanying materials
+; are licensed and made available under the terms and conditions of the BSD 
License
+; which accompanies this distribution.  The full text of the license may be 
found at
+; http://opensource.org/licenses/bsd-license.php.
+;
+; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+;
+;------------------------------------------------------------------------------
+
+SECTION .text
+
+extern ASM_PFX(DivU64x64Remainder)
+
+;------------------------------------------------------------------------------
+;
+; void __cdecl __udivdi3 (void)
+;
+;------------------------------------------------------------------------------
+global ASM_PFX(__udivdi3)
+ASM_PFX(__udivdi3):
+    ; Original local stack when calling __udivdi3
+    ;               -----------------
+    ;               |               |
+    ;               |---------------|
+    ;               |               |
+    ;               |--  Divisor  --|
+    ;               |               |
+    ;               |---------------|
+    ;               |               |
+    ;               |--  Dividend --|
+    ;               |               |
+    ;               |---------------|
+    ;               |  ReturnAddr** |
+    ;       ESP---->|---------------|
+    ;
+
+    ;
+    ; Set up the local stack for NULL Reminder pointer
+    ;
+    xor     eax, eax
+    push    eax
+
+    ;
+    ; Set up the local stack for Divisor parameter
+    ;
+    mov     eax, [esp + 20]
+    push    eax
+    mov     eax, [esp + 20]
+    push    eax
+
+    ;
+    ; Set up the local stack for Dividend parameter
+    ;
+    mov     eax, [esp + 20]
+    push    eax
+    mov     eax, [esp + 20]
+    push    eax
+
+    ;
+    ; Call native DivU64x64Remainder of BaseLib
+    ;
+    jmp     ASM_PFX(DivU64x64Remainder)
+
+    ;
+    ; Adjust stack
+    ;
+    add     esp, 20
+
+    ret     16
-- 
2.1.1


------------------------------------------------------------------------------
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to