summaryrefslogtreecommitdiff
path: root/src/cpu/amd
diff options
context:
space:
mode:
authorKyösti Mälkki <kyosti.malkki@gmail.com>2016-12-04 22:17:37 +0200
committerKyösti Mälkki <kyosti.malkki@gmail.com>2016-12-11 08:56:40 +0100
commit9d8adc0e3a923e1d201d50344f94a9176e5ec939 (patch)
tree5868a41948f5eda05a1fb8a213c4891d8a631cad /src/cpu/amd
parent3b3a28436f8ef65e2aee80f7367452c2bc136a19 (diff)
downloadcoreboot-9d8adc0e3a923e1d201d50344f94a9176e5ec939.tar.xz
x86 SMM: Fix use with RELOCATABLE_RAMSTAGE
The value for _size was not evaluated correctly if ramstage is relocated, make the calculation runtime. While touching it, move symbol declarations to header file. Change-Id: I4402315945771acf1c86a81cac6d43f1fe99a2a2 Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Reviewed-on: https://review.coreboot.org/17784 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Diffstat (limited to 'src/cpu/amd')
-rw-r--r--src/cpu/amd/smm/smm_init.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/cpu/amd/smm/smm_init.c b/src/cpu/amd/smm/smm_init.c
index c87b70109f..4d04cf7762 100644
--- a/src/cpu/amd/smm/smm_init.c
+++ b/src/cpu/amd/smm/smm_init.c
@@ -26,9 +26,6 @@
#include <cpu/x86/smm.h>
#include <string.h>
-extern unsigned char _binary_smm_start;
-extern unsigned char _binary_smm_size;
-
void smm_init(void)
{
msr_t msr, syscfg_orig, mtrr_aseg_orig;
@@ -63,7 +60,8 @@ void smm_init(void)
enable_cache();
/* copy the real SMM handler */
- memcpy((void *)SMM_BASE, &_binary_smm_start, (size_t)&_binary_smm_size);
+ memcpy((void *)SMM_BASE, _binary_smm_start,
+ _binary_smm_end - _binary_smm_start);
wbinvd();
disable_cache();