Define a few XCALL? shorthand macros to avoid clutter.

This commit is contained in:
pk 2003-01-03 15:44:55 +00:00
parent 258457037f
commit 0a78c9e13a
6 changed files with 39 additions and 28 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: cache.c,v 1.69 2003/01/03 09:19:03 pk Exp $ */
/* $NetBSD: cache.c,v 1.70 2003/01/03 15:44:55 pk Exp $ */
/*
* Copyright (c) 1996
@ -1008,7 +1008,7 @@ smp_vcache_flush_page(va, ctx)
int va;
int ctx;
{
xcall((xcall_func_t)cpuinfo.sp_vcache_flush_page, va, ctx, 0, 0, 0);
XCALL2(cpuinfo.sp_vcache_flush_page, va, ctx, CPUSET_ALL);
}
void
@ -1016,7 +1016,7 @@ smp_vcache_flush_segment(vr, vs, ctx)
int vr, vs;
int ctx;
{
xcall((xcall_func_t)cpuinfo.sp_vcache_flush_segment, vr, vs, ctx, 0, 0);
XCALL3(cpuinfo.sp_vcache_flush_segment, vr, vs, ctx, CPUSET_ALL);
}
void
@ -1024,14 +1024,14 @@ smp_vcache_flush_region(vr, ctx)
int vr;
int ctx;
{
xcall((xcall_func_t)cpuinfo.sp_vcache_flush_region, vr, ctx, 0, 0, 0);
XCALL2(cpuinfo.sp_vcache_flush_region, vr, ctx, CPUSET_ALL);
}
void
smp_vcache_flush_context(ctx)
int ctx;
{
xcall((xcall_func_t)cpuinfo.sp_vcache_flush_context, ctx, 0, 0, 0, 0);
XCALL1(cpuinfo.sp_vcache_flush_context, ctx, CPUSET_ALL);
}
void
@ -1040,6 +1040,6 @@ smp_cache_flush(va, size, ctx)
u_int size;
int ctx;
{
xcall((xcall_func_t)cpuinfo.sp_cache_flush, (int)va, (int)size, ctx, 0, 0);
XCALL3(cpuinfo.sp_cache_flush, va, size, ctx, CPUSET_ALL);
}
#endif /* MULTIPROCESSOR */

View File

@ -1,4 +1,4 @@
/* $NetBSD: cpuvar.h,v 1.46 2002/12/31 15:04:49 pk Exp $ */
/* $NetBSD: cpuvar.h,v 1.47 2003/01/03 15:44:55 pk Exp $ */
/*
* Copyright (c) 1996 The NetBSD Foundation, Inc.
@ -426,11 +426,26 @@ void getcpuinfo (struct cpu_info *sc, int node);
void mmu_install_tables (struct cpu_info *);
void pmap_alloc_cpu (struct cpu_info *);
void pmap_globalize_boot_cpu (struct cpu_info *);
#if defined(MULTIPROCESSOR)
void raise_ipi_wait_and_unlock (struct cpu_info *);
typedef int (*xcall_func_t)(int, int, int, int);
void xcall (xcall_func_t, int, int, int, int, int);
#endif
void xcall(xcall_func_t, int, int, int, int, u_int);
#define CPUSET_ALL 0xffffffffU /* xcall to all configured CPUs */
/* Shorthand */
#define XCALL0(f,cpuset) \
xcall((xcall_func_t)f, 0, 0, 0, 0, cpuset)
#define XCALL1(f,a1,cpuset) \
xcall((xcall_func_t)f, (int)a1, 0, 0, 0, cpuset)
#define XCALL2(f,a1,a2,cpuset) \
xcall((xcall_func_t)f, (int)a1, (int)a2, 0, 0, cpuset)
#define XCALL3(f,a1,a2,a3,cpuset) \
xcall((xcall_func_t)f, (int)a1, (int)a2, (int)a3, 0, cpuset)
#else
#define XCALL0(f,cpuset) /**/
#define XCALL1(f,a1,cpuset) /**/
#define XCALL2(f,a1,a2,cpuset) /**/
#define XCALL3(f,a1,a2,a3,cpuset) /**/
#endif /* MULTIPROCESSOR */
extern struct cpu_info **cpus;

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.212 2003/01/03 15:12:02 pk Exp $ */
/* $NetBSD: machdep.c,v 1.213 2003/01/03 15:44:56 pk Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@ -421,8 +421,7 @@ setregs(p, pack, stack)
savefpstate(fs);
#if defined(MULTIPROCESSOR)
else
xcall((xcall_func_t)savefpstate,
(int)fs, 0, 0, 0, 1 << cpi->ci_cpuid);
XCALL1(savefpstate, fs, 1 << cpi->ci_cpuid);
#endif
cpi->fpproc = NULL;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap.c,v 1.218 2003/01/01 15:56:11 pk Exp $ */
/* $NetBSD: pmap.c,v 1.219 2003/01/03 15:44:55 pk Exp $ */
/*
* Copyright (c) 1996
@ -631,7 +631,7 @@ static __inline__ void
smp_tlb_flush_page(int va, int ctx)
{
INCR_COUNT(smp_tlb_fp_cnt);
xcall((xcall_func_t)sp_tlb_flush_page, va, ctx, 0, 0, 0);
XCALL2(sp_tlb_flush_page, va, ctx, CPUSET_ALL);
}
static __inline__ void
@ -639,7 +639,7 @@ smp_tlb_flush_segment(int va, int ctx)
{
INCR_COUNT(smp_tlb_fs_cnt);
xcall((xcall_func_t)sp_tlb_flush_segment, va, ctx, 0, 0, 0);
XCALL2(sp_tlb_flush_segment, va, ctx, CPUSET_ALL);
}
static __inline__ void
@ -647,7 +647,7 @@ smp_tlb_flush_region(int va, int ctx)
{
INCR_COUNT(smp_tlb_fr_cnt);
xcall((xcall_func_t)sp_tlb_flush_region, va, ctx, 0, 0, 0);
XCALL2(sp_tlb_flush_region, va, ctx, CPUSET_ALL);
}
static __inline__ void
@ -655,7 +655,7 @@ smp_tlb_flush_context(int ctx)
{
INCR_COUNT(smp_tlb_fc_cnt);
xcall((xcall_func_t)sp_tlb_flush_context, ctx, 0, 0, 0, 0);
XCALL1(sp_tlb_flush_context, ctx, CPUSET_ALL);
}
static __inline__ void
@ -663,7 +663,7 @@ smp_tlb_flush_all()
{
INCR_COUNT(smp_tlb_fa_cnt);
xcall((xcall_func_t)sp_tlb_flush_all, 0, 0, 0, 0, 0);
XCALL0(sp_tlb_flush_all, CPUSET_ALL);
}
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: trap.c,v 1.120 2003/01/03 15:12:03 pk Exp $ */
/* $NetBSD: trap.c,v 1.121 2003/01/03 15:44:55 pk Exp $ */
/*
* Copyright (c) 1996
@ -324,7 +324,7 @@ trap(type, psr, pc, tf)
(*cpuinfo.pure_vcache_flush)();
#if defined(MULTIPROCESSOR)
/* Broadcast to other CPUs */
/* e.g. xcall(cpuinfo.pure_vcache_flush, 0, 0, 0, 0);*/
/* e.g. XCALL0(cpuinfo.pure_vcache_flush, CPUSET_ALL);*/
#endif
ADVANCE;
return;
@ -485,8 +485,7 @@ badtrap:
panic("FPU(%d): state for %p",
cpi->ci_cpuid, p);
#if defined(MULTIPROCESSOR)
xcall((xcall_func_t)savefpstate,
(int)fs, 0, 0, 0, 1 << cpi->ci_cpuid);
XCALL1(savefpstate, fs, 1 << cpi->ci_cpuid);
#endif
cpi->fpproc = NULL;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: vm_machdep.c,v 1.65 2003/01/03 15:12:03 pk Exp $ */
/* $NetBSD: vm_machdep.c,v 1.66 2003/01/03 15:44:56 pk Exp $ */
/*
* Copyright (c) 1996
@ -241,8 +241,7 @@ cpu_fork(p1, p2, stack, stacksize, func, arg)
savefpstate(p1->p_md.md_fpstate);
#if defined(MULTIPROCESSOR)
else
xcall((xcall_func_t)savefpstate,
(int)p1->p_md.md_fpstate, 0, 0, 0,
XCALL1(savefpstate, p1->p_md.md_fpstate,
1 << cpi->ci_cpuid);
#endif
}
@ -322,8 +321,7 @@ cpu_exit(p)
savefpstate(fs);
#if defined(MULTIPROCESSOR)
else
xcall((xcall_func_t)savefpstate,
(int)fs, 0, 0, 0, 1 << cpi->ci_cpuid);
XCALL1(savefpstate, fs, 1 << cpi->ci_cpuid);
#endif
cpi->fpproc = NULL;
}