summaryrefslogtreecommitdiffstats
path: root/runtime/user/alloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/user/alloc.c')
-rw-r--r--runtime/user/alloc.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/runtime/user/alloc.c b/runtime/user/alloc.c
index 9c7fa5c0..2691a36a 100644
--- a/runtime/user/alloc.c
+++ b/runtime/user/alloc.c
@@ -78,6 +78,13 @@ void *_stp_valloc(size_t len)
#define _stp_valloc_percpu(type) \
((type *)(__stp_valloc_percpu(sizeof(type), __alignof__(type))))
#define _stp_percpu_dptr(ptr) (((struct percpu_data *)~(unsigned long)(ptr))->blkp)
+#define _stp_per_cpu_ptr(ptr, cpu) \
+({ \
+ struct percpu_data *__p = (struct percpu_data *)~(unsigned long)(ptr); \
+ (__typeof__(ptr))__p->ptrs[(cpu)]; \
+})
+
+
/** Frees memory allocated by _stp_alloc or _stp_calloc.
* @param ptr pointer to memory to free
*/