aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2014-05-15 13:22:29 +0200
committerKevin O'Connor <kevin@koconnor.net>2014-06-04 11:06:58 -0400
commit2126994528a160f56fbaa6e5f0a2da9c0d628095 (patch)
tree17cac538d3628880664e34fd2b38c2b0ab932dd5 /src
parent457ba42878bd9f704e5a6c1c7bc7fcced686fe4e (diff)
downloadseabios-hppa-2126994528a160f56fbaa6e5f0a2da9c0d628095.zip
seabios-hppa-2126994528a160f56fbaa6e5f0a2da9c0d628095.tar.gz
seabios-hppa-2126994528a160f56fbaa6e5f0a2da9c0d628095.tar.bz2
smm: unify SMM handlers
The next patch will add shared code between the initial handler for SMBASE relocation and the actual SMI handler. Combine the code of the two handlers for simplicity. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'src')
-rw-r--r--src/fw/smm.c27
1 files changed, 11 insertions, 16 deletions
diff --git a/src/fw/smm.c b/src/fw/smm.c
index eccef88..f486c78 100644
--- a/src/fw/smm.c
+++ b/src/fw/smm.c
@@ -17,13 +17,17 @@
#include "util.h" // smm_setup
#include "x86.h" // wbinvd
-extern u8 smm_relocation_start, smm_relocation_end;
+extern u8 smm_code_start, smm_code_end;
+
ASM32FLAT(
- ".global smm_relocation_start, smm_relocation_end\n"
+ ".global smm_code_start, smm_code_end\n"
" .code16gcc\n"
+ "smm_code_start:\n"
+ " mov %cs, %ax\n"
+ " cmp $0xa000, %ax\n"
+ " je smm_exit\n"
/* code to relocate SMBASE to 0xa0000 */
- "smm_relocation_start:\n"
" movl $" __stringify(BUILD_SMM_INIT_ADDR) " + 0x7efc, %ebx\n"
" addr32 movb (%ebx), %al\n" /* revision ID to see if x86_64 or x86 */
" cmpb $0x64, %al\n"
@@ -39,16 +43,7 @@ ASM32FLAT(
" movb $0x00, %al\n"
" movw $" __stringify(PORT_SMI_STATUS) ", %dx\n"
" outb %al, %dx\n"
- " rsm\n"
- "smm_relocation_end:\n"
- " .code32\n"
- );
-
-extern u8 smm_code_start, smm_code_end;
-ASM32FLAT(
- ".global smm_code_start, smm_code_end\n"
- " .code16gcc\n"
- "smm_code_start:\n"
+ "smm_exit:\n"
" rsm\n"
"smm_code_end:\n"
" .code32\n"
@@ -60,9 +55,9 @@ smm_save_and_copy(void)
/* save original memory content */
memcpy((void *)BUILD_SMM_ADDR, (void *)BUILD_SMM_INIT_ADDR, BUILD_SMM_SIZE);
- /* copy the SMM relocation code */
- memcpy((void *)BUILD_SMM_INIT_ADDR, &smm_relocation_start,
- &smm_relocation_end - &smm_relocation_start);
+ /* copy the SMM code, which will relocate itself on the first execution */
+ memcpy((void *)BUILD_SMM_INIT_ADDR, &smm_code_start,
+ &smm_code_end - &smm_code_start);
}
static void