Skip to content

Commit 3954896

Browse files
ivqborneoa
authored andcommitted
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
1 parent 3a879c7 commit 3954896

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

src/rtos/freertos.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ struct freertos_params {
3030
const char *target_name;
3131
const unsigned char thread_count_width;
3232
const unsigned char pointer_width;
33-
const unsigned char list_next_offset;
34-
const unsigned char list_width;
35-
const unsigned char list_elem_next_offset;
36-
const unsigned char list_elem_content_offset;
37-
const unsigned char thread_stack_offset;
38-
const unsigned char thread_name_offset;
33+
const unsigned char list_next_offset; /* offsetof(List_t, xListEnd.pxNext) */
34+
const unsigned char list_width; /* sizeof(List_t) */
35+
const unsigned char list_elem_next_offset; /* offsetof(ListItem_t, pxNext) */
36+
const unsigned char list_elem_content_offset; /* offsetof(ListItem_t, pvOwner) */
37+
const unsigned char thread_stack_offset; /* offsetof(TCB_t, pxTopOfStack) */
38+
const unsigned char thread_name_offset; /* offsetof(TCB_t, pcTaskName) */
3939
const struct rtos_register_stacking *stacking_info_cm3;
4040
const struct rtos_register_stacking *stacking_info_cm4f;
4141
const struct rtos_register_stacking *stacking_info_cm4f_fpu;
@@ -46,9 +46,9 @@ static const struct freertos_params freertos_params_list[] = {
4646
"cortex_m", /* target_name */
4747
4, /* thread_count_width; */
4848
4, /* pointer_width; */
49-
16, /* list_next_offset; */
49+
12, /* list_next_offset; */
5050
20, /* list_width; */
51-
8, /* list_elem_next_offset; */
51+
4, /* list_elem_next_offset; */
5252
12, /* list_elem_content_offset */
5353
0, /* thread_stack_offset; */
5454
52, /* thread_name_offset; */
@@ -60,9 +60,9 @@ static const struct freertos_params freertos_params_list[] = {
6060
"hla_target", /* target_name */
6161
4, /* thread_count_width; */
6262
4, /* pointer_width; */
63-
16, /* list_next_offset; */
63+
12, /* list_next_offset; */
6464
20, /* list_width; */
65-
8, /* list_elem_next_offset; */
65+
4, /* list_elem_next_offset; */
6666
12, /* list_elem_content_offset */
6767
0, /* thread_stack_offset; */
6868
52, /* thread_name_offset; */

0 commit comments

Comments
 (0)