[U-Boot] [PATCH v2 41/63] x86: Fix up type sizes for 64-bit

Simon Glass sjg at chromium.org
Mon Jan 16 15:08:17 CET 2017


Hi Bin,

On 14 January 2017 at 06:31, Bin Meng <bmeng.cn at gmail.com> wrote:
> Hi Simon,
>
> On Sun, Nov 20, 2016 at 4:25 AM, Simon Glass <sjg at chromium.org> wrote:
>> Adjust types as needed to support 64-bit compilation.
>>
>> Signed-off-by: Simon Glass <sjg at chromium.org>
>> ---
>>
>> Changes in v2: None
>>
>>  arch/x86/include/asm/posix_types.h | 5 +++++
>>  arch/x86/include/asm/types.h       | 5 +++++
>>  2 files changed, 10 insertions(+)
>>
>> diff --git a/arch/x86/include/asm/posix_types.h b/arch/x86/include/asm/posix_types.h
>> index 5529f32..717f6cb 100644
>> --- a/arch/x86/include/asm/posix_types.h
>> +++ b/arch/x86/include/asm/posix_types.h
>> @@ -16,8 +16,13 @@ typedef int          __kernel_pid_t;
>>  typedef unsigned short __kernel_ipc_pid_t;
>>  typedef unsigned short __kernel_uid_t;
>>  typedef unsigned short __kernel_gid_t;
>> +#if CONFIG_IS_ENABLED(X86_64)
>> +typedef unsigned long  __kernel_size_t;
>> +typedef long           __kernel_ssize_t;
>> +#else
>>  typedef unsigned int   __kernel_size_t;
>>  typedef int            __kernel_ssize_t;
>> +#endif
>
> Should these two just be the same? using long for both 32-bit and 64-bit

Unfortunately when I do that I get:

drivers/mtd/spi/spi_flash.c:387:3: warning: format '%zu' expects
argument of type 'size_t', but argument 7 has type 'unsigned int'
[-Wformat=]

>
>>  typedef int            __kernel_ptrdiff_t;
>>  typedef long           __kernel_time_t;
>>  typedef long           __kernel_suseconds_t;
>> diff --git a/arch/x86/include/asm/types.h b/arch/x86/include/asm/types.h
>> index 880dcb4..a47e581 100644
>> --- a/arch/x86/include/asm/types.h
>> +++ b/arch/x86/include/asm/types.h
>> @@ -44,7 +44,12 @@ typedef __INT64_TYPE__ s64;
>>  typedef __UINT64_TYPE__ u64;
>>  #endif
>>
>> +#if CONFIG_IS_ENABLED(X86_64)
>> +#define BITS_PER_LONG 64
>> +#else
>>  #define BITS_PER_LONG 32
>> +#endif
>> +
>>  /* Dma addresses are 32-bits wide.  */
>>
>>  typedef u32 dma_addr_t;
>
> Regards,
> Bin

Regards,
Simon


More information about the U-Boot mailing list