smm: Make local variables relative to ebp
This reduces the cognitive overhead of referencing locals via esp since it changes with every push. BUG=b:80539294 TEST=built and booted on grunt. Change-Id: Ib7eb98ce3483d4fc803696c1b2496d8384317536 Signed-off-by: Raul E Rangel <rrangel@chromium.org> Reviewed-on: https://review.coreboot.org/27225 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Martin Roth <martinroth@google.com>
This commit is contained in:
committed by
Martin Roth
parent
dd549e1175
commit
0140541f50
@ -131,10 +131,14 @@ smm_trampoline32:
|
|||||||
jmp 2f
|
jmp 2f
|
||||||
1:
|
1:
|
||||||
movl stack_size, %eax
|
movl stack_size, %eax
|
||||||
mul %ecx
|
mul %ecx /* %eax(stack_size) * %ecx(cpu) = %eax(offset) */
|
||||||
movl stack_top, %edx
|
movl stack_top, %edx
|
||||||
subl %eax, %edx
|
subl %eax, %edx /* global_stack_top - offset = stack_top */
|
||||||
mov %edx, %esp
|
mov %edx, %esp
|
||||||
|
mov %esp, %ebp
|
||||||
|
|
||||||
|
/* Allocate locals (fxsave) */
|
||||||
|
subl $0x4, %esp
|
||||||
|
|
||||||
/* calculate fxsave location */
|
/* calculate fxsave location */
|
||||||
mov fxsave_area, %edi
|
mov fxsave_area, %edi
|
||||||
@ -146,8 +150,7 @@ smm_trampoline32:
|
|||||||
|
|
||||||
2:
|
2:
|
||||||
/* Save location of fxsave area. */
|
/* Save location of fxsave area. */
|
||||||
push %edi
|
mov %edi, -4(%ebp)
|
||||||
mov %esp, %ebp
|
|
||||||
test %edi, %edi
|
test %edi, %edi
|
||||||
jz 1f
|
jz 1f
|
||||||
|
|
||||||
@ -165,20 +168,18 @@ smm_trampoline32:
|
|||||||
|
|
||||||
/* Call into the c-based SMM relocation function with the platform
|
/* Call into the c-based SMM relocation function with the platform
|
||||||
* parameters. Equivalent to:
|
* parameters. Equivalent to:
|
||||||
* struct arg = { c_handler_params, cpu_num, smm_runtime {;
|
* struct arg = { c_handler_params, cpu_num, smm_runtime };
|
||||||
* c_handler(&arg)
|
* c_handler(&arg)
|
||||||
*/
|
*/
|
||||||
push $(smm_runtime)
|
push $(smm_runtime)
|
||||||
push %ecx
|
push %ecx /* int cpu */
|
||||||
push c_handler_arg
|
push c_handler_arg /* void *arg */
|
||||||
push %esp
|
push %esp /* smm_module_params *arg (allocated on stack). */
|
||||||
mov c_handler, %eax
|
mov c_handler, %eax
|
||||||
call *%eax
|
call *%eax
|
||||||
|
|
||||||
/* Restore stack from call frame */
|
|
||||||
mov %ebp, %esp
|
|
||||||
/* Retrieve fxsave location. */
|
/* Retrieve fxsave location. */
|
||||||
pop %edi
|
mov -4(%ebp), %edi
|
||||||
test %edi, %edi
|
test %edi, %edi
|
||||||
jz 1f
|
jz 1f
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user