cpu/x86/smm: Fix u32 type mismatch in print statement
The 64-bit compiler x86_64-linux-gnu-gcc-10 aborts the build with the
format warning below:
CC ramstage/cpu/x86/smm/smm_module_loader.o
src/cpu/x86/smm/smm_module_loader.c:415:42: error: format '%lx' expects argument of type 'long unsigned int', but argument 4 has type 'u32' {aka 'unsigned int'} [-Werror=format=]
415 | printk(BIOS_DEBUG, "%s: stack_end = 0x%lx\n",
| ~~^
| |
| long unsigned int
| %x
416 | __func__, stub_params->stack_top - total_stack_size);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| u32 {aka unsigned int}
The size of `size_t` differs between i386-elf (32-bit) and
x86_64-elf/x86_64-linux-gnu (64-bit).
Unfortunately, coreboot hardcodes
src/include/inttypes.h:#define PRIx32 "x"
so `PRIx32` cannot be used.
There use `z` as length modifier, as size_t should be always big enough
to hold the value.
Found-by: x86_64-linux-gnu-gcc-10 (Debian 10.2.1-6) 10.2.1 20210110
Fixes: afb7a814
("cpu/x86/smm: Introduce SMM module loader version 2")
Change-Id: Ib504bc5e5b19f62d4702b7f485522a2ee3d26685
Signed-off-by: Paul Menzel <pmenzel@molgen.mpg.de>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/54343
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Felix Held <felix-coreboot@felixheld.de>
This commit is contained in:
parent
85ac0675ed
commit
50e9d3860b
|
@ -411,7 +411,7 @@ static int smm_module_setup_stub(void *const smbase, const size_t smm_size,
|
|||
|
||||
const size_t total_stack_size =
|
||||
params->num_concurrent_stacks * params->per_cpu_stack_size;
|
||||
printk(BIOS_DEBUG, "%s: stack_end = 0x%lx\n",
|
||||
printk(BIOS_DEBUG, "%s: stack_end = 0x%zx\n",
|
||||
__func__, stub_params->stack_top - total_stack_size);
|
||||
printk(BIOS_DEBUG,
|
||||
"%s: stack_top = 0x%x\n", __func__, stub_params->stack_top);
|
||||
|
|
Loading…
Reference in New Issue