Use explicit-width data types in AAPCS parameter structs
authorJulius Werner <jwerner@chromium.org>
Wed, 24 Jul 2019 03:00:13 +0000 (20:00 -0700)
committerJulius Werner <jwerner@chromium.org>
Wed, 24 Jul 2019 03:25:34 +0000 (20:25 -0700)
It's not a good idea to use u_register_t for the members of
aapcs64_params_t and aapcs32_params_t, since the width of that type
always depends on the current execution environment. This would cause
problems if e.g. we used this structure to set up the entry point of an
AArch32 program from within an AArch64 program. (It doesn't seem like
any code is doing that today, but it's probably still a good idea to
write this defensively. Also, it helps with my next patch.)

Change-Id: I12c04a85611f2b6702589f3362bea3e6a7c9f776
Signed-off-by: Julius Werner <jwerner@chromium.org>
include/common/ep_info.h
plat/hisilicon/poplar/bl31_plat_setup.c

index a09d03ba081b7d20607cf8f8ef5e064fac2c707b..97df52b33cf74b3467b8036b01c86ee70343b9bb 100644 (file)
 #include <lib/cassert.h>
 
 typedef struct aapcs64_params {
-       u_register_t arg0;
-       u_register_t arg1;
-       u_register_t arg2;
-       u_register_t arg3;
-       u_register_t arg4;
-       u_register_t arg5;
-       u_register_t arg6;
-       u_register_t arg7;
+       uint64_t arg0;
+       uint64_t arg1;
+       uint64_t arg2;
+       uint64_t arg3;
+       uint64_t arg4;
+       uint64_t arg5;
+       uint64_t arg6;
+       uint64_t arg7;
 } aapcs64_params_t;
 
 typedef struct aapcs32_params {
-       u_register_t arg0;
-       u_register_t arg1;
-       u_register_t arg2;
-       u_register_t arg3;
+       uint32_t arg0;
+       uint32_t arg1;
+       uint32_t arg2;
+       uint32_t arg3;
 } aapcs32_params_t;
 
 /*****************************************************************************
index f81078f09e51ee208b92afb9d2631ef11549132b..981ef376bc664d006ca340bbc0b41e8e573012e4 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017-2018, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2017-2019, ARM Limited and Contributors. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
@@ -130,6 +130,6 @@ void bl31_plat_arch_setup(void)
                               BL_COHERENT_RAM_BASE,
                               BL_COHERENT_RAM_END);
 
-       INFO("Boot BL33 from 0x%lx for %lu Bytes\n",
+       INFO("Boot BL33 from 0x%lx for %llu Bytes\n",
             bl33_image_ep_info.pc, bl33_image_ep_info.args.arg2);
 }