types: use int-ll64 for both aarch32 and aarch64
Since commit 031dbb122472 ("AArch32: Add essential Arch helpers"),
it is difficult to use consistent format strings for printf() family
between aarch32 and aarch64.
For example, uint64_t is defined as 'unsigned long long' for aarch32
and as 'unsigned long' for aarch64. Likewise, uintptr_t is defined
as 'unsigned int' for aarch32, and as 'unsigned long' for aarch64.
A problem typically arises when you use printf() in common code.
One solution could be, to cast the arguments to a type long enough
for both architectures. For example, if 'val' is uint64_t type,
like this:
printf("val = %llx\n", (unsigned long long)val);
Or, somebody may suggest to use a macro provided by <inttypes.h>,
like this:
printf("val = %" PRIx64 "\n", val);
But, both would make the code ugly.
The solution adopted in Linux kernel is to use the same typedefs for
all architectures. The fixed integer types in the kernel-space have
been unified into int-ll64, like follows:
typedef signed char int8_t;
typedef unsigned char uint8_t;
typedef signed short int16_t;
typedef unsigned short uint16_t;
typedef signed int int32_t;
typedef unsigned int uint32_t;
typedef signed long long int64_t;
typedef unsigned long long uint64_t;
[ Linux commit:
|
---|
|
bl32/tsp/tsp_interrupt.c |
---|
bl32/tsp/tsp_main.c |
---|
include/lib/stdlib/machine/_types.h |
---|
plat/common/aarch64/plat_common.c |
---|
plat/hisilicon/hikey/hikey_bl1_setup.c |
---|
plat/nvidia/tegra/soc/t186/drivers/mce/mce.c |
---|
plat/rockchip/common/params_setup.c |
---|
plat/xilinx/zynqmp/plat_startup.c |
---|
services/spd/trusty/trusty.c |
---|