Remove variables from .data section
Update code base to remove variables from the .data section,
mainly by using const static data where possible and adding
the const specifier as required. Most changes are to the IO
subsystem, including the framework APIs. The FVP power
management code is also affected.
Delay initialization of the global static variable,
next_image_type in bl31_main.c, until it is realy needed.
Doing this moves the variable from the .data to the .bss
section.
Also review the IO interface for inconsistencies, using
uintptr_t where possible instead of void *. Remove the
io_handle and io_dev_handle typedefs, which were
unnecessary, replacing instances with uintptr_t.
Fixes ARM-software/tf-issues#107.
Change-Id: I085a62197c82410b566e4698e5590063563ed304
diff --git a/lib/semihosting/semihosting.c b/lib/semihosting/semihosting.c
index 1bce377..3c9db22 100644
--- a/lib/semihosting/semihosting.c
+++ b/lib/semihosting/semihosting.c
@@ -48,7 +48,7 @@
typedef struct {
long handle;
- void *buffer;
+ uintptr_t buffer;
size_t length;
} smh_file_read_write_block_t;
@@ -96,12 +96,12 @@
return result;
}
-long semihosting_file_read(long file_handle, size_t *length, void *buffer)
+long semihosting_file_read(long file_handle, size_t *length, uintptr_t buffer)
{
smh_file_read_write_block_t read_block;
long result = -EINVAL;
- if ((length == NULL) || (buffer == NULL))
+ if ((length == NULL) || (buffer == (uintptr_t)NULL))
return result;
read_block.handle = file_handle;
@@ -122,15 +122,15 @@
long semihosting_file_write(long file_handle,
size_t *length,
- const void *buffer)
+ const uintptr_t buffer)
{
smh_file_read_write_block_t write_block;
- if ((length == NULL) || (buffer == NULL))
+ if ((length == NULL) || (buffer == (uintptr_t)NULL))
return -EINVAL;
write_block.handle = file_handle;
- write_block.buffer = (void *)buffer;
+ write_block.buffer = (uintptr_t)buffer; /* cast away const */
write_block.length = *length;
*length = semihosting_call(SEMIHOSTING_SYS_WRITE,
@@ -196,7 +196,7 @@
long semihosting_download_file(const char *file_name,
size_t buf_size,
- void *buf)
+ uintptr_t buf)
{
long ret = -EINVAL;
size_t length;