anchao commented on a change in pull request #5915: URL: https://github.com/apache/incubator-nuttx/pull/5915#discussion_r839765941
########## File path: sched/sched/sched_note.c ########## @@ -789,18 +800,8 @@ void sched_note_syscall_enter(int nr, int argc, ...) for (i = 0; i < argc; i++) { arg = (uintptr_t)va_arg(ap, uintptr_t); - *args++ = (uint8_t)(arg & 0xff); - *args++ = (uint8_t)((arg >> 8) & 0xff); -#if UINTPTR_MAX > UINT16_MAX - *args++ = (uint8_t)((arg >> 16) & 0xff); - *args++ = (uint8_t)((arg >> 24) & 0xff); -#if UINTPTR_MAX > UINT32_MAX - *args++ = (uint8_t)((arg >> 32) & 0xff); - *args++ = (uint8_t)((arg >> 40) & 0xff); - *args++ = (uint8_t)((arg >> 48) & 0xff); - *args++ = (uint8_t)((arg >> 56) & 0xff); -#endif -#endif + sched_note_flatten(args, &arg, sizeof(uintptr_t)); Review comment: Done ########## File path: sched/sched/sched_note.c ########## @@ -825,20 +826,9 @@ void sched_note_syscall_leave(int nr, uintptr_t result) note_common(tcb, ¬e.nsc_cmn, sizeof(struct note_syscall_leave_s), NOTE_SYSCALL_LEAVE); DEBUGASSERT(nr <= UCHAR_MAX); - note.nsc_nr = nr; - - note.nsc_result[0] = (uint8_t)(result & 0xff); - note.nsc_result[1] = (uint8_t)((result >> 8) & 0xff); -#if UINTPTR_MAX > UINT16_MAX - note.nsc_result[2] = (uint8_t)((result >> 16) & 0xff); - note.nsc_result[3] = (uint8_t)((result >> 24) & 0xff); -#if UINTPTR_MAX > UINT32_MAX - note.nsc_result[4] = (uint8_t)((result >> 32) & 0xff); - note.nsc_result[5] = (uint8_t)((result >> 40) & 0xff); - note.nsc_result[6] = (uint8_t)((result >> 48) & 0xff); - note.nsc_result[7] = (uint8_t)((result >> 56) & 0xff); -#endif -#endif + note.nsc_nr = nr; + + sched_note_flatten(note.nsc_result, &result, sizeof(uintptr_t)); Review comment: Done ########## File path: sched/sched/sched_note.c ########## @@ -419,20 +443,8 @@ static void note_spincommon(FAR struct tcb_s *tcb, note_common(tcb, ¬e.nsp_cmn, sizeof(struct note_spinlock_s), type); - note.nsp_spinlock[0] = (uint8_t)((uintptr_t)spinlock & 0xff); - note.nsp_spinlock[1] = (uint8_t)(((uintptr_t)spinlock >> 8) & 0xff); -#if UINTPTR_MAX > UINT16_MAX - note.nsp_spinlock[2] = (uint8_t)(((uintptr_t)spinlock >> 16) & 0xff); - note.nsp_spinlock[3] = (uint8_t)(((uintptr_t)spinlock >> 24) & 0xff); -#if UINTPTR_MAX > UINT32_MAX - note.nsp_spinlock[4] = (uint8_t)(((uintptr_t)spinlock >> 32) & 0xff); - note.nsp_spinlock[5] = (uint8_t)(((uintptr_t)spinlock >> 40) & 0xff); - note.nsp_spinlock[6] = (uint8_t)(((uintptr_t)spinlock >> 48) & 0xff); - note.nsp_spinlock[7] = (uint8_t)(((uintptr_t)spinlock >> 56) & 0xff); -#endif -#endif - - note.nsp_value = (uint8_t)*spinlock; + sched_note_flatten(note.nsp_spinlock, &spinlock, sizeof(uintptr_t)); Review comment: Done ########## File path: sched/sched/sched_note.c ########## @@ -133,7 +167,7 @@ static void note_common(FAR struct tcb_s *tcb, clock_systime_timespec(&ts); #else - uint32_t systime = (uint32_t)clock_systime_ticks(); + clock_t systime = (clock_t)clock_systime_ticks(); Review comment: Done ########## File path: include/nuttx/sched_note.h ########## @@ -113,8 +113,29 @@ ((uint32_t)((b) & 0xff) << 8) | \ ((uint32_t)((c) & 0xff) << 16) | \ ((uint32_t)((d) & 0xff) << 24)) + +# define SCHED_NOTE_IP \ + ({__label__ __sched_note_here; __sched_note_here: (uintptr_t)&&__sched_note_here;}) Review comment: Done ########## File path: include/nuttx/sched_note.h ########## @@ -188,11 +188,11 @@ struct note_common_s #ifdef CONFIG_SMP uint8_t nc_cpu; /* CPU thread/task running on */ #endif - uint8_t nc_pid[2]; /* ID of the thread/task */ + uint8_t nc_pid[sizeof(pid_t)]; /* ID of the thread/task */ #ifdef CONFIG_SCHED_INSTRUMENTATION_HIRES - uint8_t nc_systime_sec[4]; /* Time when note was buffered (sec) */ - uint8_t nc_systime_nsec[4]; /* Time when note was buffered (nsec) */ + uint8_t nc_systime_sec[sizeof(time_t)]; /* Time when note was buffered (sec) */ + uint8_t nc_systime_nsec[sizeof(long)]; /* Time when note was buffered (nsec) */ #else uint8_t nc_systime[4]; /* Time when note was buffered */ Review comment: Done -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org