x86: protect against abi assumptions from compiler
Some of the functions called from assembly assume the standard x86 32-bit ABI of passing all arguments on the stack. However, that calling ABI can be changed by compiler flags. In order to protect against the current implicit calling convention annotate the functions called from assembly with the cdecl function attribute. That tells the compiler to use the stack based parameter calling convention. Change-Id: I83625e1f92c6821a664b191b6ce1250977cf037a Signed-off-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: http://review.coreboot.org/2794 Tested-by: build bot (Jenkins) Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
This commit is contained in:
committed by
Ronald G. Minnich
parent
e2d9e5bfa9
commit
ef4275bc2e
@@ -85,8 +85,8 @@ static inline void write_uncore_emrr(struct smm_relocation_params *relo_params)
|
||||
/* The relocation work is actually performed in SMM context, but the code
|
||||
* resides in the ramstage module. This occurs by trampolining from the default
|
||||
* SMRAM entry point to here. */
|
||||
static void cpu_smm_do_relocation(void *arg, int cpu,
|
||||
const struct smm_runtime *runtime)
|
||||
static void __attribute__((cdecl))
|
||||
cpu_smm_do_relocation(void *arg, int cpu, const struct smm_runtime *runtime)
|
||||
{
|
||||
em64t101_smm_state_save_area_t *save_state;
|
||||
msr_t mtrr_cap;
|
||||
@@ -209,7 +209,7 @@ static int install_relocation_handler(int num_cpus,
|
||||
.num_concurrent_stacks = num_cpus,
|
||||
.per_cpu_save_state_size = save_state_size,
|
||||
.num_concurrent_save_states = 1,
|
||||
.handler = &cpu_smm_do_relocation,
|
||||
.handler = (smm_handler_t)&cpu_smm_do_relocation,
|
||||
.handler_arg = (void *)relo_params,
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user