diff --git a/src/cpu/x86/smm/smm_module_loader.c b/src/cpu/x86/smm/smm_module_loader.c index 071b33673d..f97f747132 100644 --- a/src/cpu/x86/smm/smm_module_loader.c +++ b/src/cpu/x86/smm/smm_module_loader.c @@ -43,6 +43,7 @@ struct cpu_smm_info { uint8_t active; uintptr_t smbase; uintptr_t ss_start; + uintptr_t ss_top; uintptr_t code_start; uintptr_t code_end; }; @@ -125,12 +126,12 @@ static int smm_create_map(const uintptr_t smbase, const unsigned int num_cpus, - needed_ss_size * (i % cpus_per_segment); cpus[i].code_start = cpus[i].smbase + SMM_ENTRY_OFFSET; cpus[i].code_end = cpus[i].code_start + stub_size; - cpus[i].ss_start = cpus[i].smbase + SMM_CODE_SEGMENT_SIZE - needed_ss_size; + cpus[i].ss_top = cpus[i].smbase + SMM_CODE_SEGMENT_SIZE; + cpus[i].ss_start = cpus[i].ss_top - params->real_cpu_save_state_size; printk(BIOS_DEBUG, " Stub [0x%lx-0x%lx[\n", cpus[i].code_start, cpus[i].code_end); - printk(BIOS_DEBUG, " Save state [0x%lx-0x%lx[\n", - cpus[i].ss_start + needed_ss_size - params->real_cpu_save_state_size, - cpus[i].ss_start + needed_ss_size); + printk(BIOS_DEBUG, " Save state [0x%lx-0x%lx[\n", cpus[i].ss_start, + cpus[i].ss_top); cpus[i].active = 1; } @@ -433,10 +434,8 @@ static void setup_smihandler_params(struct smm_runtime *mod_params, mod_params->cbmemc_size = 0; } - for (int i = 0; i < loader_params->num_cpus; i++) { - mod_params->save_state_top[i] = cpus[i].ss_start - + loader_params->per_cpu_save_state_size; - } + for (int i = 0; i < loader_params->num_cpus; i++) + mod_params->save_state_top[i] = cpus[i].ss_top; } /*