Skip to content

Commit b96be51

Browse files
committed
fix trafficserver segmentation fault on arm64
on arm64, compression and decompression of pointers are inconsistent use top 12 bits to save version info and update pointer extraction method
1 parent 01f2b99 commit b96be51

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

include/tscore/ink_queue.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,11 @@ union head_p {
136136
#define SET_FREELIST_POINTER_VERSION(_x, _p, _v) \
137137
(_x).s.pointer = _p; \
138138
(_x).s.version = _v
139-
#elif defined(__x86_64__) || defined(__ia64__) || defined(__powerpc64__) || defined(__aarch64__) || defined(__mips64)
139+
#elif defined(__aarch64__)
140+
#define FREELIST_POINTER(_x) ((void *)((((intptr_t)(_x).data) & 0x000FFFFFFFFFFFFFULL)))
141+
#define FREELIST_VERSION(_x) (((intptr_t)(_x).data) >> 52)
142+
#define SET_FREELIST_POINTER_VERSION(_x, _p, _v) (_x).data = (((intptr_t)(_p)) | (((_v)&0xFFFULL) << 52))
143+
#elif defined(__x86_64__) || defined(__ia64__) || defined(__powerpc64__) || defined(__mips64)
140144
#define FREELIST_POINTER(_x) \
141145
((void *)(((((intptr_t)(_x).data) << 16) >> 16) | (((~((((intptr_t)(_x).data) << 16 >> 63) - 1)) >> 48) << 48))) // sign extend
142146
#define FREELIST_VERSION(_x) (((intptr_t)(_x).data) >> 48)

0 commit comments

Comments
 (0)