diff options
author | 2007-11-14 23:15:03 +0000 | |
---|---|---|
committer | 2007-11-14 23:15:03 +0000 | |
commit | 32e6c4a3eaa27b26c003aacf6cdbfcdaa6096c3e (patch) | |
tree | 406eeea2d1fdc8ae46b48cbc88cc89b9953973d2 | |
parent | No need to check whether we are the primary processor in m188_{clock,stat}intr, (diff) | |
download | wireguard-openbsd-32e6c4a3eaa27b26c003aacf6cdbfcdaa6096c3e.tar.xz wireguard-openbsd-32e6c4a3eaa27b26c003aacf6cdbfcdaa6096c3e.zip |
Cache curcpu() value into a local variable when it is used more than once in
a function, so that it does not get reloaded from cr17 every time.
-rw-r--r-- | sys/arch/m88k/m88k/db_interface.c | 13 | ||||
-rw-r--r-- | sys/arch/mvme88k/mvme88k/machdep.c | 8 |
2 files changed, 12 insertions, 9 deletions
diff --git a/sys/arch/m88k/m88k/db_interface.c b/sys/arch/m88k/m88k/db_interface.c index 7db78c45ae3..03b7f6309b6 100644 --- a/sys/arch/m88k/m88k/db_interface.c +++ b/sys/arch/m88k/m88k/db_interface.c @@ -1,4 +1,4 @@ -/* $OpenBSD: db_interface.c,v 1.10 2007/11/14 23:12:46 miod Exp $ */ +/* $OpenBSD: db_interface.c,v 1.11 2007/11/14 23:15:03 miod Exp $ */ /* * Mach Operating System * Copyright (c) 1993-1991 Carnegie Mellon University @@ -389,8 +389,9 @@ m88k_db_trap(type, frame) int type; struct trapframe *frame; { - if (get_psr() & PSR_IND) - db_printf("WARNING: entered debugger with interrupts disabled\n"); +#ifdef MULTIPROCESSOR + struct cpu_info *ci = curcpu(); +#endif switch(type) { case T_KDB_BREAK: @@ -408,9 +409,9 @@ m88k_db_trap(type, frame) } #ifdef MULTIPROCESSOR - curcpu()->ci_ddb_state = CI_DDB_ENTERDDB; + ci->ci_ddb_state = CI_DDB_ENTERDDB; __mp_lock(&ddb_mp_lock); - curcpu()->ci_ddb_state = CI_DDB_INDDB; + ci->ci_ddb_state = CI_DDB_INDDB; ddb_mp_nextcpu = (cpuid_t)-1; m88k_broadcast_ipi(CI_IPI_DDB); /* pause other processors */ #endif @@ -424,7 +425,7 @@ m88k_db_trap(type, frame) frame->tf_regs = ddb_regs; #ifdef MULTIPROCESSOR - curcpu()->ci_ddb_state = CI_DDB_RUNNING; + ci->ci_ddb_state = CI_DDB_RUNNING; __mp_release_all(&ddb_mp_lock); #endif } diff --git a/sys/arch/mvme88k/mvme88k/machdep.c b/sys/arch/mvme88k/mvme88k/machdep.c index 3caa3ffe208..a3d3d336b9d 100644 --- a/sys/arch/mvme88k/mvme88k/machdep.c +++ b/sys/arch/mvme88k/mvme88k/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.199 2007/11/14 23:12:46 miod Exp $ */ +/* $OpenBSD: machdep.c,v 1.200 2007/11/14 23:15:07 miod Exp $ */ /* * Copyright (c) 1998, 1999, 2000, 2001 Steve Murphree, Jr. * Copyright (c) 1996 Nivas Madhur @@ -1035,6 +1035,7 @@ mvme_bootstrap() void cpu_boot_secondary_processors() { + struct cpu_info *ci = curcpu(); cpuid_t cpu; int rc; extern void secondary_start(void); @@ -1048,7 +1049,7 @@ cpu_boot_secondary_processors() case BRD_197: #endif for (cpu = 0; cpu < max_cpus; cpu++) { - if (cpu != curcpu()->ci_cpuid) { + if (cpu != ci->ci_cpuid) { __cpu_simple_lock(&cpu_boot_mutex); rc = spin_cpu(cpu, (vaddr_t)secondary_start); switch (rc) { @@ -1174,11 +1175,12 @@ m88k_send_ipi(int ipi, cpuid_t cpu) void m88k_broadcast_ipi(int ipi) { + struct cpu_info *us = curcpu(); struct cpu_info *ci; CPU_INFO_ITERATOR cii; CPU_INFO_FOREACH(cii, ci) { - if (ci == curcpu()) + if (ci == us) continue; if (ISSET(ci->ci_flags, CIF_ALIVE)) |