mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-04 05:04:33 +02:00
gdbstub_xtensa.c: Replace with cpu_ll_pc_to_ptr macro
Signed-off-by: Sachin Parekh <sachin.parekh@espressif.com>
This commit is contained in:
@@ -34,7 +34,7 @@ static void init_regfile(esp_gdbstub_gdb_regfile_t *dst)
|
|||||||
static void update_regfile_common(esp_gdbstub_gdb_regfile_t *dst)
|
static void update_regfile_common(esp_gdbstub_gdb_regfile_t *dst)
|
||||||
{
|
{
|
||||||
if (dst->a[0] & 0x8000000U) {
|
if (dst->a[0] & 0x8000000U) {
|
||||||
dst->a[0] = (dst->a[0] & 0x3fffffffU) | 0x40000000U;
|
dst->a[0] = (uint32_t)cpu_ll_pc_to_ptr(dst->a[0]);
|
||||||
}
|
}
|
||||||
if (!esp_stack_ptr_is_sane(dst->a[1])) {
|
if (!esp_stack_ptr_is_sane(dst->a[1])) {
|
||||||
dst->a[1] = 0xDEADBEEF;
|
dst->a[1] = 0xDEADBEEF;
|
||||||
@@ -49,14 +49,14 @@ void esp_gdbstub_frame_to_regfile(const esp_gdbstub_frame_t *frame, esp_gdbstub_
|
|||||||
{
|
{
|
||||||
init_regfile(dst);
|
init_regfile(dst);
|
||||||
const uint32_t *a_regs = (const uint32_t *) &frame->a0;
|
const uint32_t *a_regs = (const uint32_t *) &frame->a0;
|
||||||
if (!(esp_ptr_executable((frame->pc & 0x3fffffffU) | 0x40000000U) && (frame->pc & 0xC0000000U))) {
|
if (!(esp_ptr_executable(cpu_ll_pc_to_ptr(frame->pc)) && (frame->pc & 0xC0000000U))) {
|
||||||
/* Xtensa ABI sets the 2 MSBs of the PC according to the windowed call size
|
/* Xtensa ABI sets the 2 MSBs of the PC according to the windowed call size
|
||||||
* Incase the PC is invalid, GDB will fail to translate addresses to function names
|
* Incase the PC is invalid, GDB will fail to translate addresses to function names
|
||||||
* Hence replacing the PC to a placeholder address in case of invalid PC
|
* Hence replacing the PC to a placeholder address in case of invalid PC
|
||||||
*/
|
*/
|
||||||
dst->pc = (uint32_t)&_invalid_pc_placeholder;
|
dst->pc = (uint32_t)&_invalid_pc_placeholder;
|
||||||
} else {
|
} else {
|
||||||
dst->pc = (frame->pc & 0x3fffffffU) | 0x40000000U;
|
dst->pc = (uint32_t)cpu_ll_pc_to_ptr(frame->pc);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < 16; i++) {
|
for (int i = 0; i < 16; i++) {
|
||||||
@@ -83,10 +83,10 @@ static void solicited_frame_to_regfile(const XtSolFrame *frame, esp_gdbstub_gdb_
|
|||||||
{
|
{
|
||||||
init_regfile(dst);
|
init_regfile(dst);
|
||||||
const uint32_t *a_regs = (const uint32_t *) &frame->a0;
|
const uint32_t *a_regs = (const uint32_t *) &frame->a0;
|
||||||
if (!(esp_ptr_executable((frame->pc & 0x3fffffffU) | 0x40000000U) && (frame->pc & 0xC0000000U))) {
|
if (!(esp_ptr_executable(cpu_ll_pc_to_ptr(frame->pc)) && (frame->pc & 0xC0000000U))) {
|
||||||
dst->pc = (uint32_t)&_invalid_pc_placeholder;
|
dst->pc = (uint32_t)&_invalid_pc_placeholder;
|
||||||
} else {
|
} else {
|
||||||
dst->pc = (frame->pc & 0x3fffffffU) | 0x40000000U;
|
dst->pc = (uint32_t)cpu_ll_pc_to_ptr(frame->pc);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* only 4 registers saved in the solicited frame */
|
/* only 4 registers saved in the solicited frame */
|
||||||
|
@@ -103,7 +103,7 @@ static inline uint32_t cpu_ll_ptr_to_pc(const void* addr)
|
|||||||
|
|
||||||
static inline void* cpu_ll_pc_to_ptr(uint32_t pc)
|
static inline void* cpu_ll_pc_to_ptr(uint32_t pc)
|
||||||
{
|
{
|
||||||
return (void*) ((pc & 0x3fffffff) | 0x40000000);
|
return (void*) ((pc & 0x3fffffffU) | 0x40000000U);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void cpu_ll_set_watchpoint(int id,
|
static inline void cpu_ll_set_watchpoint(int id,
|
||||||
|
@@ -97,7 +97,7 @@ static inline uint32_t cpu_ll_ptr_to_pc(const void* addr)
|
|||||||
|
|
||||||
static inline void* cpu_ll_pc_to_ptr(uint32_t pc)
|
static inline void* cpu_ll_pc_to_ptr(uint32_t pc)
|
||||||
{
|
{
|
||||||
return (void*) ((pc & 0x3fffffff) | 0x40000000);
|
return (void*) ((pc & 0x3fffffffU) | 0x40000000U);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void cpu_ll_set_watchpoint(int id,
|
static inline void cpu_ll_set_watchpoint(int id,
|
||||||
|
Reference in New Issue
Block a user