diff --git a/sys/arch/amd64/include/cpufunc.h b/sys/arch/amd64/include/cpufunc.h index 52259f87bbca..07fa546f53c4 100644 --- a/sys/arch/amd64/include/cpufunc.h +++ b/sys/arch/amd64/include/cpufunc.h @@ -1,4 +1,4 @@ -/* $NetBSD: cpufunc.h,v 1.1 2003/04/26 18:39:39 fvdl Exp $ */ +/* $NetBSD: cpufunc.h,v 1.2 2003/05/08 01:04:35 fvdl Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -50,6 +50,8 @@ #ifdef _KERNEL +extern int cpu_feature; + static __inline void invlpg(u_int64_t addr) { @@ -263,6 +265,12 @@ breakpoint(void) __asm __volatile("int $3"); } +static __inline void +x86_pause(void) +{ + /* nothing */ +} + #define read_psl() read_rflags() #define write_psl(x) write_rflags(x) diff --git a/sys/arch/i386/i386/pmap.c b/sys/arch/i386/i386/pmap.c index c45d38374779..cb7e6a4bc831 100644 --- a/sys/arch/i386/i386/pmap.c +++ b/sys/arch/i386/i386/pmap.c @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.151 2003/04/01 20:54:23 thorpej Exp $ */ +/* $NetBSD: pmap.c,v 1.152 2003/05/08 01:04:36 fvdl Exp $ */ /* * @@ -60,7 +60,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.151 2003/04/01 20:54:23 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.152 2003/05/08 01:04:36 fvdl Exp $"); #include "opt_cputype.h" #include "opt_user_ldt.h" @@ -3318,7 +3318,7 @@ pmap_tlb_shootnow(int32_t cpumask) panic("TLB IPI rendezvous failed (mask %x)", self->ci_tlb_ipi_mask); #else - /* XXX insert pause instruction */ + x86_pause(); ; #endif #endif diff --git a/sys/arch/i386/include/cpufunc.h b/sys/arch/i386/include/cpufunc.h index 077f59cbdbbe..a4f967b09b80 100644 --- a/sys/arch/i386/include/cpufunc.h +++ b/sys/arch/i386/include/cpufunc.h @@ -1,4 +1,4 @@ -/* $NetBSD: cpufunc.h,v 1.23 2003/03/04 22:43:09 fvdl Exp $ */ +/* $NetBSD: cpufunc.h,v 1.24 2003/05/08 01:04:37 fvdl Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -50,6 +50,8 @@ #ifdef _KERNEL +extern int cpu_feature; + static __inline void invlpg(u_int addr) { @@ -264,6 +266,12 @@ breakpoint(void) __asm __volatile("int $3"); } +static __inline void +x86_pause(void) +{ + __asm __volatile("pause"); +} + #define read_psl() read_eflags() #define write_psl(x) write_eflags(x) diff --git a/sys/arch/x86/include/lock.h b/sys/arch/x86/include/lock.h index 2633452e620d..4b3a10b013a8 100644 --- a/sys/arch/x86/include/lock.h +++ b/sys/arch/x86/include/lock.h @@ -1,4 +1,4 @@ -/* $NetBSD: lock.h,v 1.1 2003/02/27 00:10:57 fvdl Exp $ */ +/* $NetBSD: lock.h,v 1.2 2003/05/08 01:04:34 fvdl Exp $ */ /*- * Copyright (c) 2000 The NetBSD Foundation, Inc. @@ -47,6 +47,8 @@ #include "opt_lockdebug.h" #endif +#include + typedef __volatile int __cpu_simple_lock_t; #define __SIMPLELOCK_LOCKED 1 @@ -95,9 +97,8 @@ __cpu_simple_lock(__cpu_simple_lock_t *lockp) { while (x86_atomic_testset_i(lockp, __SIMPLELOCK_LOCKED) - == __SIMPLELOCK_LOCKED) { - continue; /* spin */ - } + != __SIMPLELOCK_UNLOCKED) + x86_pause(); __lockbarrier(); } diff --git a/sys/arch/x86/x86/lapic.c b/sys/arch/x86/x86/lapic.c index 22a2e323ac59..12fcc7aa3b7d 100644 --- a/sys/arch/x86/x86/lapic.c +++ b/sys/arch/x86/x86/lapic.c @@ -1,4 +1,4 @@ -/* $NetBSD: lapic.c,v 1.1 2003/02/26 21:26:12 fvdl Exp $ */ +/* $NetBSD: lapic.c,v 1.2 2003/05/08 01:04:35 fvdl Exp $ */ /*- * Copyright (c) 2000 The NetBSD Foundation, Inc. @@ -411,6 +411,8 @@ void lapic_delay(usec) else deltat -= otick - tick; otick = tick; + + x86_pause(); } }