You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@trafficserver.apache.org by GitBox <gi...@apache.org> on 2022/01/19 21:32:46 UTC

[GitHub] [trafficserver] ywkaras commented on a change in pull request #8601: fix trafficserver segmentation fault on arm64

ywkaras commented on a change in pull request #8601:
URL: https://github.com/apache/trafficserver/pull/8601#discussion_r788156975



##########
File path: include/tscore/ink_queue.h
##########
@@ -136,7 +136,11 @@ union head_p {
 #define SET_FREELIST_POINTER_VERSION(_x, _p, _v) \
   (_x).s.pointer = _p;                           \
   (_x).s.version = _v
-#elif defined(__x86_64__) || defined(__ia64__) || defined(__powerpc64__) || defined(__aarch64__) || defined(__mips64)
+#elif defined(__aarch64__)
+#define FREELIST_POINTER(_x) ((void *)((((intptr_t)(_x).data) & 0x000FFFFFFFFFFFFFULL)))
+#define FREELIST_VERSION(_x) (((intptr_t)(_x).data) >> 52)
+#define SET_FREELIST_POINTER_VERSION(_x, _p, _v) (_x).data = (((intptr_t)(_p)) | (((_v)&0xFFFULL) << 52))
+#elif defined(__x86_64__) || defined(__ia64__) || defined(__powerpc64__) || defined(__mips64)
 #define FREELIST_POINTER(_x) \
   ((void *)(((((intptr_t)(_x).data) << 16) >> 16) | (((~((((intptr_t)(_x).data) << 16 >> 63) - 1)) >> 48) << 48))) // sign extend
 #define FREELIST_VERSION(_x) (((intptr_t)(_x).data) >> 48)

Review comment:
       I would think we'd actually want to cast to uintptr_t, so that the right shift would not sign extend.




-- 
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: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org