Revision: 17279
http://sourceforge.net/p/edk2/code/17279
Author: erictian
Date: 2015-04-30 07:25:07 +0000 (Thu, 30 Apr 2015)
Log Message:
-----------
MdePkg/BaseLib: Preserve EBX register and fix stack offset to LinearAddress in
AsmFlushCacheLine()
The value of EBX must be preserved to follow IA32 cdecl calling convention in
the assembly
implementation of AsmFlushCacheLine(). The CPUID instruction modifies the EBX
register.
The EBX register value is saved onto the stack before CPUID and restored from
the stack
after CPUID.
The update to the inline assembly implementation of AsmFlushCacheLine() changed
the location of the
LinearAddress parameter value on the stack. The hardcoded lookup using [esp +
4] is not correct.
Use the parameter name LinearAddress instead of the hard coded [esp + 4] stack
location to prevent
this issue from occurring again if there are changes to the inline assembly in
the future.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael Kinney <[email protected]>
Reviewed-by: Feng Tian <[email protected]>
Modified Paths:
--------------
trunk/edk2/MdePkg/Library/BaseLib/Ia32/FlushCacheLine.asm
trunk/edk2/MdePkg/Library/BaseLib/Ia32/FlushCacheLine.c
Modified: trunk/edk2/MdePkg/Library/BaseLib/Ia32/FlushCacheLine.asm
===================================================================
--- trunk/edk2/MdePkg/Library/BaseLib/Ia32/FlushCacheLine.asm 2015-04-30
05:54:26 UTC (rev 17278)
+++ trunk/edk2/MdePkg/Library/BaseLib/Ia32/FlushCacheLine.asm 2015-04-30
07:25:07 UTC (rev 17279)
@@ -39,7 +39,9 @@
; then promote flush range to flush entire cache.
;
mov eax, 1
+ push ebx
cpuid
+ pop ebx
mov eax, [esp + 4]
test edx, BIT19
jz @F
Modified: trunk/edk2/MdePkg/Library/BaseLib/Ia32/FlushCacheLine.c
===================================================================
--- trunk/edk2/MdePkg/Library/BaseLib/Ia32/FlushCacheLine.c 2015-04-30
05:54:26 UTC (rev 17278)
+++ trunk/edk2/MdePkg/Library/BaseLib/Ia32/FlushCacheLine.c 2015-04-30
07:25:07 UTC (rev 17279)
@@ -45,7 +45,7 @@
cpuid
test edx, BIT19
jz NoClflush
- mov eax, [esp + 4]
+ mov eax, dword ptr [LinearAddress]
clflush [eax]
jmp Done
NoClflush:
------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits