From 1e6df1675ccea95d99d767e6d2b9a735c8ee2a36 Mon Sep 17 00:00:00 2001 From: panciyan Date: Sun, 2 Apr 2023 05:17:17 +0000 Subject: rtos/linux.c: Fix Linux user space border check Linux kernel and user space border is 0xc0000000 not 0xc000000 Signed-off-by: panciyan Change-Id: I6b487cce62ac31737deca97d5f5f7bbc081280f4 Reviewed-on: https://review.openocd.org/c/openocd/+/7570 Tested-by: jenkins Reviewed-by: Antonio Borneo --- src/rtos/linux.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/rtos') diff --git a/src/rtos/linux.c b/src/rtos/linux.c index f9edabc..7517ec7 100644 --- a/src/rtos/linux.c +++ b/src/rtos/linux.c @@ -123,7 +123,7 @@ static int linux_read_memory(struct target *target, target->rtos->rtos_specific_params; uint32_t pa = (address & linux_os->phys_mask) + linux_os->phys_base; #endif - if (address < 0xc000000) { + if (address < 0xc0000000) { LOG_ERROR("linux awareness : address in user space"); return ERROR_FAIL; } -- cgit v1.1 From 314f4c665f746ebec3be69a8e26f0a671cfdcb46 Mon Sep 17 00:00:00 2001 From: Antonio Borneo Date: Sun, 9 Apr 2023 00:33:38 +0200 Subject: rtos: with pointers, use NULL instead of 0 Don't compare pointers with 0, use NULL when needed. Don't assign pointer to 0, use NULL. Detected through 'sparse' tool. Change-Id: Ifa81ba961c0d490cc74880b4a46b620e6358f779 Signed-off-by: Antonio Borneo Reviewed-on: https://review.openocd.org/c/openocd/+/7598 Tested-by: jenkins --- src/rtos/chibios.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/rtos') diff --git a/src/rtos/chibios.c b/src/rtos/chibios.c index 68fe8a1..2037827 100644 --- a/src/rtos/chibios.c +++ b/src/rtos/chibios.c @@ -80,12 +80,12 @@ struct chibios_params { static struct chibios_params chibios_params_list[] = { { "cortex_m", /* target_name */ - 0, + NULL, NULL, /* stacking_info */ }, { "hla_target", /* target_name */ - 0, + NULL, NULL, /* stacking_info */ } }; @@ -198,7 +198,7 @@ static int chibios_update_memory_signature(struct rtos *rtos) errfree: /* Error reading the ChibiOS memory structure */ free(signature); - param->signature = 0; + param->signature = NULL; return -1; } @@ -468,7 +468,7 @@ static int chibios_get_thread_reg_list(struct rtos *rtos, int64_t thread_id, return -1; /* Update stacking if it can only be determined from runtime information */ - if ((param->stacking_info == 0) && + if (!param->stacking_info && (chibios_update_stacking(rtos) != ERROR_OK)) { LOG_ERROR("Failed to determine exact stacking for the target type %s", rtos->target->type->name); return -1; -- cgit v1.1 From f07efff961ede4c8015624679bbfd5b54fcb25b5 Mon Sep 17 00:00:00 2001 From: Antonio Borneo Date: Sun, 30 Apr 2023 23:54:44 +0200 Subject: rtos: move in rtos.h the rtos_type's declaration The static analyser 'sparse' complains, while compiling a rtos' file, that the struct rtos_type is declared in the file as non static, but it is not exposed through an include file. The message is: warning: symbol 'XXX' was not declared. Should it be static? Move the list of rtos_type's declaration in rtos.h Change-Id: Ia96dff077407a6653b11920519c1724e4c1167a3 Signed-off-by: Antonio Borneo Reviewed-on: https://review.openocd.org/c/openocd/+/7660 Tested-by: jenkins --- src/rtos/rtos.c | 16 ---------------- src/rtos/rtos.h | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 16 deletions(-) (limited to 'src/rtos') diff --git a/src/rtos/rtos.c b/src/rtos/rtos.c index f1e8956..6c88de3 100644 --- a/src/rtos/rtos.c +++ b/src/rtos/rtos.c @@ -15,22 +15,6 @@ #include "helper/binarybuffer.h" #include "server/gdb_server.h" -/* RTOSs */ -extern const struct rtos_type freertos_rtos; -extern const struct rtos_type threadx_rtos; -extern const struct rtos_type ecos_rtos; -extern const struct rtos_type linux_rtos; -extern const struct rtos_type chibios_rtos; -extern const struct rtos_type chromium_ec_rtos; -extern const struct rtos_type embkernel_rtos; -extern const struct rtos_type mqx_rtos; -extern const struct rtos_type ucos_iii_rtos; -extern const struct rtos_type nuttx_rtos; -extern const struct rtos_type hwthread_rtos; -extern const struct rtos_type riot_rtos; -extern const struct rtos_type zephyr_rtos; -extern const struct rtos_type rtkernel_rtos; - static const struct rtos_type *rtos_types[] = { &threadx_rtos, &freertos_rtos, diff --git a/src/rtos/rtos.h b/src/rtos/rtos.h index 9128c16..e283dd2 100644 --- a/src/rtos/rtos.h +++ b/src/rtos/rtos.h @@ -135,4 +135,19 @@ int rtos_read_buffer(struct target *target, target_addr_t address, int rtos_write_buffer(struct target *target, target_addr_t address, uint32_t size, const uint8_t *buffer); +extern const struct rtos_type chibios_rtos; +extern const struct rtos_type chromium_ec_rtos; +extern const struct rtos_type ecos_rtos; +extern const struct rtos_type embkernel_rtos; +extern const struct rtos_type freertos_rtos; +extern const struct rtos_type hwthread_rtos; +extern const struct rtos_type linux_rtos; +extern const struct rtos_type mqx_rtos; +extern const struct rtos_type nuttx_rtos; +extern const struct rtos_type riot_rtos; +extern const struct rtos_type rtkernel_rtos; +extern const struct rtos_type threadx_rtos; +extern const struct rtos_type ucos_iii_rtos; +extern const struct rtos_type zephyr_rtos; + #endif /* OPENOCD_RTOS_RTOS_H */ -- cgit v1.1