From a932829b01cb375ec9036da03bbe65e48ff82dd6 Mon Sep 17 00:00:00 2001 From: Chris Johns Date: Thu, 25 Aug 2022 14:10:21 +1000 Subject: libdebugger/aarch64: Set .start section to RW - Stops the server crashing when setting breakpoints in .start --- cpukit/libdebugger/rtems-debugger-aarch64.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'cpukit') diff --git a/cpukit/libdebugger/rtems-debugger-aarch64.c b/cpukit/libdebugger/rtems-debugger-aarch64.c index 279c2d61ef..9a53da0de9 100644 --- a/cpukit/libdebugger/rtems-debugger-aarch64.c +++ b/cpukit/libdebugger/rtems-debugger-aarch64.c @@ -34,7 +34,9 @@ #include #include -/* Defined by linkcmds.base */ +/* Defined by linkcmds.base. This should be taken from */ +extern char bsp_section_start_begin[]; +extern char bsp_section_start_end[]; extern char bsp_section_text_begin[]; extern char bsp_section_text_end[]; extern char bsp_section_fast_text_begin[]; @@ -1231,6 +1233,8 @@ static rtems_status_code rtems_debugger_target_set_text_writable( bool writable ) { + uintptr_t start_begin = (uintptr_t) bsp_section_start_begin; + uintptr_t start_end = (uintptr_t) bsp_section_start_end; uintptr_t text_begin = (uintptr_t) bsp_section_text_begin; uintptr_t text_end = (uintptr_t) bsp_section_text_end; uintptr_t fast_text_begin = (uintptr_t) bsp_section_fast_text_begin; @@ -1242,6 +1246,23 @@ static rtems_status_code rtems_debugger_target_set_text_writable( mmu_flags = AARCH64_MMU_CODE_CACHED; } + target_printk( + "[} MMU edit: start_begin: 0x%016" PRIxPTR + " start_end: 0x%016" PRIxPTR "\n", + start_begin, + start_end + ); + sc = aarch64_mmu_map( + start_begin, + start_end - start_begin, + mmu_flags + ); + + if ( sc != RTEMS_SUCCESSFUL ) { + target_printk( "[} MMU edit failed\n" ); + return sc; + } + target_printk( "[} MMU edit: text_begin: 0x%016" PRIxPTR " text_end: 0x%016" PRIxPTR "\n", -- cgit v1.2.3