rtos: Dynamically allocate memory for RTOS registers

Imported from
https://github.com/riscv-collab/riscv-openocd/pull/647

FreeRTOS part of patch dropped as it depends on other
riscv-collab specific changes.

This makes things work on RISC-V cores with large vector registers
(which can be up to kilobytes in size).

Change-Id: Ie53cb43a88e2a475f695cd5c1e28605569926817
Signed-off-by: Tim Newsome <tim@sifive.com>
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/9123
Tested-by: jenkins
Reviewed-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
This commit is contained in:
Tim Newsome
2021-10-05 10:03:53 -07:00
committed by Tomas Vanek
parent 6127077613
commit 6d764f5b09
3 changed files with 42 additions and 17 deletions

View File

@@ -53,6 +53,8 @@ struct rtos_reg {
uint32_t number;
uint32_t size;
uint8_t value[16];
/* WARNING: rtos_get_gdb_reg() relies on the fact that value is the last
* element of this struct. Any new fields should be added *before* value. */
};
struct rtos_type {
@@ -64,8 +66,10 @@ struct rtos_type {
/** Return a list of general registers, with their values filled out. */
int (*get_thread_reg_list)(struct rtos *rtos, int64_t thread_id,
struct rtos_reg **reg_list, int *num_regs);
int (*get_thread_reg)(struct rtos *rtos, int64_t thread_id,
uint32_t reg_num, struct rtos_reg *reg);
/** Return the size and value of the specified reg_num. The value is
* allocated by the callee and freed by the caller. */
int (*get_thread_reg_value)(struct rtos *rtos, threadid_t thread_id,
uint32_t reg_num, uint32_t *size, uint8_t **value);
int (*get_symbol_list_to_lookup)(struct symbol_table_elem *symbol_list[]);
int (*clean)(struct target *target);
char * (*ps_command)(struct target *target);