summaryrefslogtreecommitdiffstats
path: root/src/cpu/x86/smm/smm_module_loader.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/cpu/x86/smm/smm_module_loader.c')
-rw-r--r--src/cpu/x86/smm/smm_module_loader.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/src/cpu/x86/smm/smm_module_loader.c b/src/cpu/x86/smm/smm_module_loader.c
index 3ed20b70bd5c..19acea60d68b 100644
--- a/src/cpu/x86/smm/smm_module_loader.c
+++ b/src/cpu/x86/smm/smm_module_loader.c
@@ -318,13 +318,13 @@ int smm_setup_relocation_handler(struct smm_loader_params *params)
/* The SMM module is placed within the provided region in the following
* manner:
* +-----------------+ <- smram + size
- * | stacks |
- * +-----------------+ <- smram + size - total_stack_size
- * | fxsave area |
- * +-----------------+ <- smram + size - total_stack_size - fxsave_size
* | BIOS resource |
* | list (STM) |
- * +-----------------+ <- .. - CONFIG_BIOS_RESOURCE_LIST_SIZE
+ * +-----------------+ <- smram + size - CONFIG_BIOS_RESOURCE_LIST_SIZE
+ * | stacks |
+ * +-----------------+ <- .. - total_stack_size
+ * | fxsave area |
+ * +-----------------+ <- .. - total_stack_size - fxsave_size
* | ... |
* +-----------------+ <- smram + handler_size + SMM_DEFAULT_SIZE
* | handler |
@@ -365,11 +365,10 @@ int smm_load_module(void *smram, size_t size, struct smm_loader_params *params)
/* Stacks start at the top of the region. */
base = smram;
+ base += size;
if (CONFIG(STM))
- base += size - CONFIG_MSEG_SIZE; // take out the mseg
- else
- base += size;
+ base -= CONFIG_MSEG_SIZE + CONFIG_BIOS_RESOURCE_LIST_SIZE;
params->stack_top = base;
@@ -400,10 +399,6 @@ int smm_load_module(void *smram, size_t size, struct smm_loader_params *params)
total_size = total_stack_size + handler_size;
total_size += fxsave_size + SMM_DEFAULT_SIZE;
- // account for the bios resource list
- if (CONFIG(STM))
- total_size += CONFIG_BIOS_RESOURCE_LIST_SIZE;
-
if (total_size > size)
return -1;