You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/04/06 10:01:26 UTC
[GitHub] [incubator-nuttx-apps] anchao opened a new pull request, #1126: system/note: correct unflatten format
anchao opened a new pull request, #1126:
URL: https://github.com/apache/incubator-nuttx-apps/pull/1126
## Summary
system/note: correct unflatten format
## Impact
Fix endian issue reported by @pkarashchenko :
https://github.com/apache/incubator-nuttx-apps/pull/1114#discussion_r842466352
## Testing
sched note trace test
--
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-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx-apps] xiaoxiang781216 merged pull request #1126: system/note: correct unflatten format
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 merged PR #1126:
URL: https://github.com/apache/incubator-nuttx-apps/pull/1126
--
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-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx-apps] xiaoxiang781216 commented on a diff in pull request #1126: system/note: correct unflatten format
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #1126:
URL: https://github.com/apache/incubator-nuttx-apps/pull/1126#discussion_r844650188
##########
system/sched_note/note_main.c:
##########
@@ -90,27 +90,35 @@ static FAR const char *g_statenames[] =
static void trace_dump_unflatten(FAR void *dst,
FAR uint8_t *src, size_t len)
{
+#ifdef CONFIG_HAVE_LONG_LONG
+ uint64_t tmp = 0;
+#else
+ uint32_t tmp = 0;
+#endif
+
switch (len)
{
#ifdef CONFIG_HAVE_LONG_LONG
case 8:
- *(uint64_t *)dst = ((uint64_t)src[7] << 56)
- + ((uint64_t)src[6] << 48)
- + ((uint64_t)src[5] << 40)
- + ((uint64_t)src[4] << 32);
+ tmp += ((uint64_t)src[7] << 56);
+ tmp += ((uint64_t)src[6] << 48);
+ tmp += ((uint64_t)src[5] << 40);
+ tmp += ((uint64_t)src[4] << 32);
Review Comment:
let's follow the same change:
https://github.com/apache/incubator-nuttx/pull/5992
--
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-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx-apps] pkarashchenko commented on a diff in pull request #1126: system/note: correct unflatten format
Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on code in PR #1126:
URL: https://github.com/apache/incubator-nuttx-apps/pull/1126#discussion_r843859122
##########
system/sched_note/note_main.c:
##########
@@ -94,18 +95,17 @@ static void trace_dump_unflatten(FAR void *dst,
{
#ifdef CONFIG_HAVE_LONG_LONG
case 8:
- *(uint64_t *)dst = ((uint64_t)src[7] << 56)
- + ((uint64_t)src[6] << 48)
- + ((uint64_t)src[5] << 40)
- + ((uint64_t)src[4] << 32);
+ *(uint64_t *)dst = le64toh(*(uint64_t *)src);
Review Comment:
I have only one question. Are we sure that `src` is target type aligned? I mean that if `len == 4` then `src` can be promoted to `uint32_t *`. If not, then we will have troubles with archs that require pointers to be aligned.
--
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-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx-apps] anchao commented on a diff in pull request #1126: system/note: correct unflatten format
Posted by GitBox <gi...@apache.org>.
anchao commented on code in PR #1126:
URL: https://github.com/apache/incubator-nuttx-apps/pull/1126#discussion_r843998968
##########
system/sched_note/note_main.c:
##########
@@ -94,18 +95,17 @@ static void trace_dump_unflatten(FAR void *dst,
{
#ifdef CONFIG_HAVE_LONG_LONG
case 8:
- *(uint64_t *)dst = ((uint64_t)src[7] << 56)
- + ((uint64_t)src[6] << 48)
- + ((uint64_t)src[5] << 40)
- + ((uint64_t)src[4] << 32);
+ *(uint64_t *)dst = le64toh(*(uint64_t *)src);
Review Comment:
Yes, there are potential issues if the hardware do not support aligned access, seems there is no more elegant way, I used the scheme you recommended.
--
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-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org