rtos/FreeRTOS: fix next pointer member offset in FreeRTOS lists

Currently, we are using offset of xListEnd.pxPrevious in List_t for
list_next_offset and offset of pxPrevious in ListItem_t for
list_elem_next_offset. This is confusing. Fix this.
As the related lists are doubly linked lists, only iteration order is
changed without breaking functionality.
Also document those offsets.

Change-Id: I8beacc235ee781ab4e3b415fccad7b72ec55b098
Signed-off-by: Chien Wong <m@xv97.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8833
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
This commit is contained in:
Chien Wong
2025-04-08 20:33:56 +08:00
committed by Antonio Borneo
parent 3a879c7dcb
commit 3954896d6e

View File

@@ -30,12 +30,12 @@ struct freertos_params {
const char *target_name;
const unsigned char thread_count_width;
const unsigned char pointer_width;
const unsigned char list_next_offset;
const unsigned char list_width;
const unsigned char list_elem_next_offset;
const unsigned char list_elem_content_offset;
const unsigned char thread_stack_offset;
const unsigned char thread_name_offset;
const unsigned char list_next_offset; /* offsetof(List_t, xListEnd.pxNext) */
const unsigned char list_width; /* sizeof(List_t) */
const unsigned char list_elem_next_offset; /* offsetof(ListItem_t, pxNext) */
const unsigned char list_elem_content_offset; /* offsetof(ListItem_t, pvOwner) */
const unsigned char thread_stack_offset; /* offsetof(TCB_t, pxTopOfStack) */
const unsigned char thread_name_offset; /* offsetof(TCB_t, pcTaskName) */
const struct rtos_register_stacking *stacking_info_cm3;
const struct rtos_register_stacking *stacking_info_cm4f;
const struct rtos_register_stacking *stacking_info_cm4f_fpu;
@@ -46,9 +46,9 @@ static const struct freertos_params freertos_params_list[] = {
"cortex_m", /* target_name */
4, /* thread_count_width; */
4, /* pointer_width; */
16, /* list_next_offset; */
12, /* list_next_offset; */
20, /* list_width; */
8, /* list_elem_next_offset; */
4, /* list_elem_next_offset; */
12, /* list_elem_content_offset */
0, /* thread_stack_offset; */
52, /* thread_name_offset; */
@@ -60,9 +60,9 @@ static const struct freertos_params freertos_params_list[] = {
"hla_target", /* target_name */
4, /* thread_count_width; */
4, /* pointer_width; */
16, /* list_next_offset; */
12, /* list_next_offset; */
20, /* list_width; */
8, /* list_elem_next_offset; */
4, /* list_elem_next_offset; */
12, /* list_elem_content_offset */
0, /* thread_stack_offset; */
52, /* thread_name_offset; */