[edk2] [PATCH 1/4] OvmfPkg/Sec/Ia32: free up EAX for other uses while setting up the stack

Laszlo Ersek posted 4 patches 8 years, 1 month ago
[edk2] [PATCH 1/4] OvmfPkg/Sec/Ia32: free up EAX for other uses while setting up the stack
Posted by Laszlo Ersek 8 years, 1 month ago
Currently EAX is used as an intermediary in setting ESP to
SEC_TOP_OF_STACK, and in passing SEC_TOP_OF_STACK to
SecCoreStartupWithStack() as the "TopOfCurrentStack" argument.

In a later patch we'll use EAX differently, so replace it with EBX under
the current use.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---
 OvmfPkg/Sec/Ia32/SecEntry.nasm | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/OvmfPkg/Sec/Ia32/SecEntry.nasm b/OvmfPkg/Sec/Ia32/SecEntry.nasm
index 7fee1c2b2e4f..54d074e621f6 100644
--- a/OvmfPkg/Sec/Ia32/SecEntry.nasm
+++ b/OvmfPkg/Sec/Ia32/SecEntry.nasm
@@ -40,8 +40,8 @@ ASM_PFX(_ModuleEntryPoint):
     ;
     %define SEC_TOP_OF_STACK (FixedPcdGet32 (PcdOvmfSecPeiTempRamBase) + \
                           FixedPcdGet32 (PcdOvmfSecPeiTempRamSize))
-    mov     eax, SEC_TOP_OF_STACK
-    mov     esp, eax
+    mov     ebx, SEC_TOP_OF_STACK
+    mov     esp, ebx
     nop
 
     ;
@@ -50,7 +50,7 @@ ASM_PFX(_ModuleEntryPoint):
     ;   [esp+4] BootFirmwareVolumePtr
     ;   [esp+8] TopOfCurrentStack
     ;
-    push    eax
+    push    ebx
     push    ebp
     call    ASM_PFX(SecCoreStartupWithStack)
 
-- 
2.14.1.3.gb7cf6e02401b


_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH 1/4] OvmfPkg/Sec/Ia32: free up EAX for other uses while setting up the stack
Posted by Jordan Justen 8 years, 1 month ago
On 2017-11-10 07:49:05, Laszlo Ersek wrote:
> Currently EAX is used as an intermediary in setting ESP to
> SEC_TOP_OF_STACK, and in passing SEC_TOP_OF_STACK to
> SecCoreStartupWithStack() as the "TopOfCurrentStack" argument.
> 
> In a later patch we'll use EAX differently, so replace it with EBX under
> the current use.
> 
> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Cc: Ruiyu Ni <ruiyu.ni@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
> ---
>  OvmfPkg/Sec/Ia32/SecEntry.nasm | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/OvmfPkg/Sec/Ia32/SecEntry.nasm b/OvmfPkg/Sec/Ia32/SecEntry.nasm
> index 7fee1c2b2e4f..54d074e621f6 100644
> --- a/OvmfPkg/Sec/Ia32/SecEntry.nasm
> +++ b/OvmfPkg/Sec/Ia32/SecEntry.nasm
> @@ -40,8 +40,8 @@ ASM_PFX(_ModuleEntryPoint):
>      ;
>      %define SEC_TOP_OF_STACK (FixedPcdGet32 (PcdOvmfSecPeiTempRamBase) + \
>                            FixedPcdGet32 (PcdOvmfSecPeiTempRamSize))
> -    mov     eax, SEC_TOP_OF_STACK
> -    mov     esp, eax
> +    mov     ebx, SEC_TOP_OF_STACK
> +    mov     esp, ebx

Can't you initialize the temp RAM before this code?

-Jordan
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH 1/4] OvmfPkg/Sec/Ia32: free up EAX for other uses while setting up the stack
Posted by Laszlo Ersek 8 years, 1 month ago
On 11/13/17 19:08, Jordan Justen wrote:
> On 2017-11-10 07:49:05, Laszlo Ersek wrote:
>> Currently EAX is used as an intermediary in setting ESP to
>> SEC_TOP_OF_STACK, and in passing SEC_TOP_OF_STACK to
>> SecCoreStartupWithStack() as the "TopOfCurrentStack" argument.
>>
>> In a later patch we'll use EAX differently, so replace it with EBX under
>> the current use.
>>
>> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
>> Cc: Jordan Justen <jordan.l.justen@intel.com>
>> Cc: Ruiyu Ni <ruiyu.ni@intel.com>
>> Contributed-under: TianoCore Contribution Agreement 1.1
>> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
>> ---
>>  OvmfPkg/Sec/Ia32/SecEntry.nasm | 6 +++---
>>  1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/OvmfPkg/Sec/Ia32/SecEntry.nasm b/OvmfPkg/Sec/Ia32/SecEntry.nasm
>> index 7fee1c2b2e4f..54d074e621f6 100644
>> --- a/OvmfPkg/Sec/Ia32/SecEntry.nasm
>> +++ b/OvmfPkg/Sec/Ia32/SecEntry.nasm
>> @@ -40,8 +40,8 @@ ASM_PFX(_ModuleEntryPoint):
>>      ;
>>      %define SEC_TOP_OF_STACK (FixedPcdGet32 (PcdOvmfSecPeiTempRamBase) + \
>>                            FixedPcdGet32 (PcdOvmfSecPeiTempRamSize))
>> -    mov     eax, SEC_TOP_OF_STACK
>> -    mov     esp, eax
>> +    mov     ebx, SEC_TOP_OF_STACK
>> +    mov     esp, ebx
> 
> Can't you initialize the temp RAM before this code?

Should be possible, yes.

Thanks
Laszlo
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel