From 0fb90682e7103d7f75c17b1b86595eb7f1f49d25 Mon Sep 17 00:00:00 2001 From: qwang12 Date: Mon, 21 Jul 2008 05:57:04 +0000 Subject: Use ebp as frame buffer in DivU64x32. Fix a typo in GetPowerOfTwo. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5532 6f19259b-4bc3-4df7-8a09-765794883524 --- .../Foundation/Library/EfiCommonLib/Ia32/DivU64x32.asm | 13 +++++++++---- .../Foundation/Library/EfiCommonLib/Ia32/GetPowerOfTwo.asm | 4 ++-- 2 files changed, 11 insertions(+), 6 deletions(-) (limited to 'EdkCompatibilityPkg/Foundation/Library/EfiCommonLib') diff --git a/EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/Ia32/DivU64x32.asm b/EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/Ia32/DivU64x32.asm index 6e5d71e009..afe58667d6 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/Ia32/DivU64x32.asm +++ b/EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/Ia32/DivU64x32.asm @@ -56,27 +56,32 @@ ;--------------------------------------------------------------------------- DivU64x32 PROC + push ebp + mov ebp, esp xor edx, edx ; Clear EDX - mov eax, [esp + 8] ; Put high 32 bits of 64-bit dividend in EAX - mov ecx, [esp + 12] ; Put 32 bits divisor in ECX + mov eax, [ebp + 0Ch] ; Put high 32 bits of 64-bit dividend in EAX + mov ecx, [ebp + 10h] ; Put 32 bits divisor in ECX div ecx ; Dividend Divisor Quoitent...Remainder ; 0:EAX / ECX = EAX EDX push eax ; Push quoitent in stack - mov eax, [esp + 4] ; Put low 32 bits of 64-bit dividend in EAX + mov eax, [ebp + 8] ; Put low 32 bits of 64-bit dividend in EAX div ecx ; Leave the REMAINDER in EDX as High 32-bit of new dividend ; Dividend Divisor Quoitent...Remainder ; EDX:EAX / ECX = EAX EDX - mov ecx, [esp + 16] ; Put &REMAINDER to ecx + mov ecx, [ebp + 14h] ; Put &REMAINDER to ecx jecxz Label1 ; If ecx == 0, no remainder exist, return with quoitent in EDX directly mov dword ptr [ecx], edx ; Put EDX through REMAINDER pointer in ECX Label1: pop edx ; Pop High 32-bit QUOITENT to EDX + pop ebp + + ret DivU64x32 ENDP END diff --git a/EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/Ia32/GetPowerOfTwo.asm b/EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/Ia32/GetPowerOfTwo.asm index 2d7b6de7a3..af009c7a7a 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/Ia32/GetPowerOfTwo.asm +++ b/EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/Ia32/GetPowerOfTwo.asm @@ -47,7 +47,7 @@ ; two and less than Input ; ;--*/ -GetPowerOfTow PROC +GetPowerOfTwo PROC xor eax, eax mov edx, eax mov ecx, [esp + 8] ; dword ptr Input[4] @@ -63,5 +63,5 @@ _F: _Exit: ret -GetPowerOfTow ENDP +GetPowerOfTwo ENDP END -- cgit v1.2.3