Hi Paul,
Paul Menzel wrote:
printk(BIOS_DEBUG, "%s: stack_end = 0x%lx\n", __func__, stub_params->stack_top - total_stack_size);
Using `PRIx32` fixes the build with 64-bit but now it fails with 32-bit, as commit 3a323808 (include, lib: Add <inttypes.h> printf macros) [2] adds
src/include/inttypes.h:#define PRIx32 "x"
which is dependent on the architecture(?),
Isn't the purpose of those PRI defines that they are always correct?
If they aren't correct in some cases then they should probably just be fixed? I guess that -m32 with a x86_64 toolchain may need to be detected differently than a i686 toolchain.
and is not the right length modifier for u32 on 32-bit.
Huh? What is?
AFAIK %x is fine for a 32-bit value, both with i686 and x86_64.
%lx is always for a (signed or unsigned) long value, which obviously differs between i686 and x86_64.
%llx is always for a long long value, which AFAIK is 64-bit on all systems, but sure, not neccessarily guaranteed to be.
Is there an elegant way around it besides casting the values?
If the PRI-defines are wrong in some cases they should be fixed.
Code explicitly using a l or ll length modifier for fixed-size values is incorrect and should also be fixed.
Do we need specific headers for 32-bit or 64-bit?
No, but maybe more cases in the existing header.
//Peter