aboutsummaryrefslogtreecommitdiff
path: root/sys/amd64/include/pcpu.h
diff options
context:
space:
mode:
authorMateusz Guzik <mjg@FreeBSD.org>2020-02-12 11:12:13 +0000
committerMateusz Guzik <mjg@FreeBSD.org>2020-02-12 11:12:13 +0000
commitfb886947d97375ea9906fa1396f83573b6d0674b (patch)
treebc47d67f771fbc25572b79c4d056fe3e80f9d2cc /sys/amd64/include/pcpu.h
parent3acb6572fc0ef19119240a319873fa75fd597f28 (diff)
Notes
Diffstat (limited to 'sys/amd64/include/pcpu.h')
-rw-r--r--sys/amd64/include/pcpu.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/sys/amd64/include/pcpu.h b/sys/amd64/include/pcpu.h
index 24388e204df0b..718c36d792fbe 100644
--- a/sys/amd64/include/pcpu.h
+++ b/sys/amd64/include/pcpu.h
@@ -240,6 +240,10 @@ _Static_assert(sizeof(struct monitorbuf) == 128, "2x cache line");
#define IS_BSP() (PCPU_GET(cpuid) == 0)
+#define zpcpu_offset_cpu(cpu) ((uintptr_t)&__pcpu[0] + UMA_PCPU_ALLOC_SIZE * cpu)
+#define zpcpu_base_to_offset(base) (void *)((uintptr_t)(base) - (uintptr_t)&__pcpu[0])
+#define zpcpu_offset_to_base(base) (void *)((uintptr_t)(base) + (uintptr_t)&__pcpu[0])
+
#else /* !__GNUCLIKE_ASM || !__GNUCLIKE___TYPEOF */
#error "this file needs to be ported to your compiler"