diff options
author | Vic Yang <victoryang@chromium.org> | 2013-05-08 04:50:56 +0800 |
---|---|---|
committer | ChromeBot <chrome-bot@google.com> | 2013-05-07 20:59:53 -0700 |
commit | 5007bbc009ccc8c8e64fac5f5540c85573d4ae80 (patch) | |
tree | b0e7f1c5d4bd2ec286d8866759711b30cb5345a2 /common/system_common.c | |
parent | 235e6e1d0d713ddad79fa77d6982c006378053cd (diff) | |
download | chrome-ec-5007bbc009ccc8c8e64fac5f5540c85573d4ae80.tar.gz |
Use uintptr_t when converting integer from/to pointer
Perviously we use uint32_t for this, but this doesn't compile for 64-bit
environment (and likely doesn't for 16-bit either.) Use uintptr_t so that
we don't get size mismatch errors.
BUG=chrome-os-partner:19257
TEST=Run host emulated tests
BRANCH=None
Change-Id: I3cd66a745fa171c41a5f142514284ec106586acb
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/50358
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'common/system_common.c')
-rw-r--r-- | common/system_common.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/common/system_common.c b/common/system_common.c index 239dd12a75..4df9aa70df 100644 --- a/common/system_common.c +++ b/common/system_common.c @@ -104,7 +104,7 @@ int system_is_locked(void) #endif } -test_mockable int system_usable_ram_end(void) +test_mockable uintptr_t system_usable_ram_end(void) { /* Leave space at the end of RAM for jump data and tags. * @@ -113,7 +113,7 @@ test_mockable int system_usable_ram_end(void) * tags after a sysjump. When verified boot runs after a reboot, it'll * have as much RAM as we can give it; after verified boot jumps to * another image there'll be less RAM, but we'll care less too. */ - return (uint32_t)jdata - jdata->jump_tag_total; + return (uintptr_t)jdata - jdata->jump_tag_total; } uint32_t system_get_reset_flags(void) @@ -215,7 +215,8 @@ void system_disable_jump(void) enum system_image_copy_t system_get_image_copy(void) { - uint32_t my_addr = (uint32_t)system_get_image_copy - CONFIG_FLASH_BASE; + uintptr_t my_addr = (uintptr_t)system_get_image_copy - + CONFIG_FLASH_BASE; if (my_addr >= CONFIG_SECTION_RO_OFF && my_addr < (CONFIG_SECTION_RO_OFF + CONFIG_SECTION_RO_SIZE)) @@ -293,7 +294,7 @@ const char *system_get_image_copy_string(void) * * @param init_addr Init address of target image */ -static void jump_to_image(uint32_t init_addr) +static void jump_to_image(uintptr_t init_addr) { void (*resetvec)(void) = (void(*)(void))init_addr; @@ -360,8 +361,8 @@ static uint32_t get_size(enum system_image_copy_t copy) int system_run_image_copy(enum system_image_copy_t copy) { - uint32_t base; - uint32_t init_addr; + uintptr_t base; + uintptr_t init_addr; /* If system is already running the requested image, done */ if (system_get_image_copy() == copy) @@ -408,7 +409,7 @@ int system_run_image_copy(enum system_image_copy_t copy) const char *system_get_version(enum system_image_copy_t copy) { - uint32_t addr; + uintptr_t addr; const struct version_struct *v; /* Handle version of current image */ @@ -421,7 +422,7 @@ const char *system_get_version(enum system_image_copy_t copy) /* The version string is always located after the reset vectors, so * it's the same as in the current image. */ - addr += ((uint32_t)&version_data - get_base(system_get_image_copy())); + addr += ((uintptr_t)&version_data - get_base(system_get_image_copy())); /* Make sure the version struct cookies match before returning the * version string. */ @@ -456,13 +457,13 @@ const char *system_get_build_info(void) void system_common_pre_init(void) { - uint32_t addr; + uintptr_t addr; /* * Put the jump data before the panic data, or at the end of RAM if * panic data is not present. */ - addr = (uint32_t)panic_get_data(); + addr = (uintptr_t)panic_get_data(); if (!addr) addr = CONFIG_RAM_BASE + CONFIG_RAM_SIZE; |