From b7ead750149f923b1284ed3afbce9d33cda986d3 Mon Sep 17 00:00:00 2001 From: Ryan Libby Date: Sat, 29 Jun 2024 17:33:24 -0700 Subject: [PATCH] XXX pcpu demo functions Thin wrappers around PCPU macros to examine codegen. --- sys/conf/files | 1 + sys/kern/pcpu_demo.c | 57 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 sys/kern/pcpu_demo.c diff --git a/sys/conf/files b/sys/conf/files index 968894ea948b..bfafe8043c6f 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -5283,3 +5283,4 @@ xdr/xdr_mbuf.c optional xdr | krpc | nfslockd | nfscl | nfsd xdr/xdr_mem.c optional xdr | krpc | nfslockd | nfscl | nfsd xdr/xdr_reference.c optional xdr | krpc | nfslockd | nfscl | nfsd xdr/xdr_sizeof.c optional xdr | krpc | nfslockd | nfscl | nfsd +kern/pcpu_demo.c standard diff --git a/sys/kern/pcpu_demo.c b/sys/kern/pcpu_demo.c new file mode 100644 index 000000000000..e099ba434b8b --- /dev/null +++ b/sys/kern/pcpu_demo.c @@ -0,0 +1,57 @@ +#include +#include +#include + +static struct pcpu * __used +pcpu_demo_get_pcpu(void) +{ + return get_pcpu(); +} + +static unsigned int __used +pcpu_demo_get(void) +{ + return PCPU_GET(cpuid); +} + +static void __used +pcpu_demo_add(unsigned int x) +{ + PCPU_ADD(cpuid, x); +} + +static void __used +pcpu_demo_set(unsigned int x) +{ + PCPU_SET(cpuid, x); +} + +static unsigned int * __used +pcpu_demo_ptr(void) +{ + return PCPU_PTR(cpuid); +} + +static unsigned int __used +pcpu_demo_ptr_get(void) +{ + return *PCPU_PTR(cpuid); +} + +static void __used +pcpu_demo_ptr_set(unsigned int x) +{ + *PCPU_PTR(cpuid) = x; +} + +static struct thread * __used +pcpu_demo_curthread(void) +{ + return curthread; +} + +static struct pcb * __used +pcpu_demo_curpcb(void) +{ + return curpcb; +} -- 2.45.2