From 6759608248f30eb575170c0700cc99140e0bdc35 Mon Sep 17 00:00:00 2001 From: Attilio Rao Date: Mon, 4 Jun 2007 21:38:48 +0000 Subject: Rework the PCPU_* (MD) interface: - Rename PCPU_LAZY_INC into PCPU_INC - Add the PCPU_ADD interface which just does an add on the pcpu member given a specific value. Note that for most architectures PCPU_INC and PCPU_ADD are not safe. This is a point that needs some discussions/work in the next days. Reviewed by: alc, bde Approved by: jeff (mentor) --- sys/sun4v/include/pcpu.h | 3 ++- sys/sun4v/sun4v/trap.c | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'sys/sun4v') diff --git a/sys/sun4v/include/pcpu.h b/sys/sun4v/include/pcpu.h index b6d901a4da1b..25150311afff 100644 --- a/sys/sun4v/include/pcpu.h +++ b/sys/sun4v/include/pcpu.h @@ -92,7 +92,8 @@ register struct pcpu *pcpup __asm__(__XSTRING(PCPU_REG)); * XXX The implementation of this operation should be made atomic * with respect to preemption. */ -#define PCPU_LAZY_INC(member) (++pcpup->pc_ ## member) +#define PCPU_ADD(member, value) (pcpup->pc_ ## member += (value)) +#define PCPU_INC(member) PCPU_ADD(member, 1) #define PCPU_PTR(member) (&pcpup->pc_ ## member) #define PCPU_SET(member,value) (pcpup->pc_ ## member = (value)) diff --git a/sys/sun4v/sun4v/trap.c b/sys/sun4v/sun4v/trap.c index 4fe6edc7fad5..fa2de3dc43f0 100644 --- a/sys/sun4v/sun4v/trap.c +++ b/sys/sun4v/sun4v/trap.c @@ -268,7 +268,7 @@ trap(struct trapframe *tf, int64_t type, uint64_t data) trap_msg[trapno], (TRAPF_USERMODE(tf) ? "user" : "kernel"), rdpr(pil)); - PCPU_LAZY_INC(cnt.v_trap); + PCPU_INC(cnt.v_trap); trapno = (type & TRAP_MASK); ctx = (type >> TRAP_CTX_SHIFT); @@ -575,7 +575,7 @@ syscall(struct trapframe *tf) p = td->td_proc; - PCPU_LAZY_INC(cnt.v_syscall); + PCPU_INC(cnt.v_syscall); narg = 0; error = 0; -- cgit v1.2.3