This is an automated email from Gerrit.

"Chien Wong <m...@xv97.com>" just uploaded a new patch set to Gerrit, which you 
can find at https://review.openocd.org/c/openocd/+/8833

-- gerrit

commit 76ef2bbe2fcc913a354bffde6284c71f98a36c02
Author: Chien Wong <m...@xv97.com>
Date:   Tue Apr 8 20:33:56 2025 +0800

    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 ralated 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>

diff --git a/src/rtos/freertos.c b/src/rtos/freertos.c
index 20977e07e9..4ec6bec55d 100644
--- a/src/rtos/freertos.c
+++ b/src/rtos/freertos.c
@@ -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; 
*/

-- 

Reply via email to