<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Mar 18, 2021 at 9:18 AM Stephen Clark <<a href="mailto:stephen.clark@oarcorp.com">stephen.clark@oarcorp.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Using 32bit types like uint32_t for pointers creates issues on 64 bit<br>
architectures like AArch64. Replaced occurrences of these with uintptr_t,<br>
which will work for both 32 and 64 bit architectures.<br>
---<br>
cpukit/libdebugger/rtems-debugger-server.c | 4 ++--<br>
cpukit/libdebugger/rtems-debugger-target.c | 2 +-<br>
cpukit/libdebugger/rtems-debugger-target.h | 2 +-<br>
cpukit/libmisc/rtems-fdt/rtems-fdt-shell.c | 4 ++--<br>
cpukit/libmisc/stackchk/check.c | 3 ++-<br>
5 files changed, 8 insertions(+), 7 deletions(-)<br></blockquote><div><br></div><div>This is the same basic issue but it is in three completely different areas.</div><div><br></div><div>This patch should be split into a series for rtems-debugger, rtems-fdt,</div><div>and stackchk. </div><div><br></div><div>That should make most of it OK. Using uint32_t to hold pointers</div><div>is wrong but has been a valid assumption for almost every architecture</div><div>RTEMS has ever supported. I suspect these warnings also showed up</div><div>on the sparc64 port but no one noticed them.<br><br>But the cases Gedare points out where they then get cast again</div><div>needs examination. Splitting it will help. I think different people are</div><div>the expert on each of the three areas.</div><div><br></div><div>--joel</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
diff --git a/cpukit/libdebugger/rtems-debugger-server.c b/cpukit/libdebugger/rtems-debugger-server.c<br>
index 975ec23a30..f8c485a794 100644<br>
--- a/cpukit/libdebugger/rtems-debugger-server.c<br>
+++ b/cpukit/libdebugger/rtems-debugger-server.c<br>
@@ -1438,7 +1438,7 @@ remote_read_memory(uint8_t* buffer, int size)<br>
if (comma == NULL)<br>
remote_packet_out_str(r_E01);<br>
else {<br>
- DB_UINT addr;<br>
+ uintptr_t addr;<br>
DB_UINT length;<br>
int r;<br>
addr = hex_decode_uint(&buffer[1]);<br>
@@ -1468,7 +1468,7 @@ remote_write_memory(uint8_t* buffer, int size)<br>
comma = strchr((const char*) buffer, ',');<br>
colon = strchr((const char*) buffer, ':');<br>
if (comma != NULL && colon != NULL) {<br>
- DB_UINT addr;<br>
+ uintptr_t addr;<br>
DB_UINT length;<br>
int r;<br>
addr = hex_decode_uint(&buffer[1]);<br>
diff --git a/cpukit/libdebugger/rtems-debugger-target.c b/cpukit/libdebugger/rtems-debugger-target.c<br>
index bf7579700d..34e4e84d2f 100644<br>
--- a/cpukit/libdebugger/rtems-debugger-target.c<br>
+++ b/cpukit/libdebugger/rtems-debugger-target.c<br>
@@ -168,7 +168,7 @@ rtems_debugger_target_reg_table_size(void)<br>
}<br>
<br>
int<br>
-rtems_debugger_target_swbreak_control(bool insert, DB_UINT addr, DB_UINT kind)<br>
+rtems_debugger_target_swbreak_control(bool insert, uintptr_t addr, DB_UINT kind)<br>
{<br>
rtems_debugger_target* target = rtems_debugger->target;<br>
rtems_debugger_target_swbreak* swbreaks;<br>
diff --git a/cpukit/libdebugger/rtems-debugger-target.h b/cpukit/libdebugger/rtems-debugger-target.h<br>
index f2abbe5fd3..db356e1f07 100644<br>
--- a/cpukit/libdebugger/rtems-debugger-target.h<br>
+++ b/cpukit/libdebugger/rtems-debugger-target.h<br>
@@ -200,7 +200,7 @@ extern void rtems_debugger_target_exception_print(CPU_Exception_frame* frame);<br>
* Software breakpoints. These are also referred to as memory breakpoints.<br>
*/<br>
extern int rtems_debugger_target_swbreak_control(bool insert,<br>
- DB_UINT addr,<br>
+ uintptr_t addr,<br>
DB_UINT kind);<br>
<br>
/**<br>
diff --git a/cpukit/libmisc/rtems-fdt/rtems-fdt-shell.c b/cpukit/libmisc/rtems-fdt/rtems-fdt-shell.c<br>
index b0894c1d38..61f20765e0 100644<br>
--- a/cpukit/libmisc/rtems-fdt/rtems-fdt-shell.c<br>
+++ b/cpukit/libmisc/rtems-fdt/rtems-fdt-shell.c<br>
@@ -52,14 +52,14 @@ static long rtems_fdt_test_timeout = 5;<br>
static rtems_fdt_handle cmd_fdt_handle;<br>
<br>
static void<br>
-rtems_fdt_write (uint32_t address, uint32_t value)<br>
+rtems_fdt_write (uintptr_t address, uint32_t value)<br>
{<br>
volatile uint32_t* ap = (uint32_t*) address;<br>
*ap = value;<br>
}<br>
<br>
static uint32_t<br>
-rtems_fdt_read (uint32_t address)<br>
+rtems_fdt_read (uintptr_t address)<br>
{<br>
volatile uint32_t* ap = (uint32_t*) address;<br>
return *ap;<br>
diff --git a/cpukit/libmisc/stackchk/check.c b/cpukit/libmisc/stackchk/check.c<br>
index ab08155c92..a2b63345d9 100644<br>
--- a/cpukit/libmisc/stackchk/check.c<br>
+++ b/cpukit/libmisc/stackchk/check.c<br>
@@ -447,12 +447,13 @@ static bool Stack_check_Dump_threads_usage(<br>
{<br>
char name[ 22 ];<br>
const rtems_printer *printer;<br>
+ uintptr_t sp = _CPU_Context_Get_SP( &the_thread->Registers );<br>
<br>
printer = arg;<br>
_Thread_Get_name( the_thread, name, sizeof( name ) );<br>
Stack_check_Dump_stack_usage(<br>
&the_thread->Start.Initial_stack,<br>
- (void *) _CPU_Context_Get_SP( &the_thread->Registers ),<br>
+ (void *) sp,<br>
name,<br>
the_thread->Object.id,<br>
printer<br>
-- <br>
2.27.0<br>
<br>
_______________________________________________<br>
devel mailing list<br>
<a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a><br>
<a href="http://lists.rtems.org/mailman/listinfo/devel" rel="noreferrer" target="_blank">http://lists.rtems.org/mailman/listinfo/devel</a><br>
</blockquote></div></div>