From owner-svn-src-head@FreeBSD.ORG Sat Jan 1 00:20:14 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 542C5106566B; Sat, 1 Jan 2011 00:20:14 +0000 (UTC) (envelope-from jmallett@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 43E608FC1A; Sat, 1 Jan 2011 00:20:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p010KEfo092974; Sat, 1 Jan 2011 00:20:14 GMT (envelope-from jmallett@svn.freebsd.org) Received: (from jmallett@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p010KEk5092972; Sat, 1 Jan 2011 00:20:14 GMT (envelope-from jmallett@svn.freebsd.org) Message-Id: <201101010020.p010KEk5092972@svn.freebsd.org> From: Juli Mallett Date: Sat, 1 Jan 2011 00:20:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r216862 - head/sys/mips/mips X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Jan 2011 00:20:14 -0000 Author: jmallett Date: Sat Jan 1 00:20:14 2011 New Revision: 216862 URL: http://svn.freebsd.org/changeset/base/216862 Log: o) When trying to determine whether the pcpu pointer is a managed address, check not just that it is greater than the minimal kernel virtual address, but also that it is less than the maximal kernel virtual address. On n64 kernels, the pcpup comes out of a direct-mapped address that, with an unsigned compare, is rather greater than the minimal kernel virtual address. o) Turn the panic if interrupts are disabled in cpu_idle into a KASSERT since on other architectures it's behind INVARIANTS anyway. o) Add a check that not all interrupts are masked, too. o) Add cpu_idleclock() and cpu_activeclock() use to cpu_idle as is done on other architectures. Modified: head/sys/mips/mips/machdep.c Modified: head/sys/mips/mips/machdep.c ============================================================================== --- head/sys/mips/mips/machdep.c Fri Dec 31 22:49:13 2010 (r216861) +++ head/sys/mips/mips/machdep.c Sat Jan 1 00:20:14 2011 (r216862) @@ -426,8 +426,10 @@ cpu_pcpu_init(struct pcpu *pcpu, int cpu pcpu->pc_next_asid = 1; pcpu->pc_asid_generation = 1; #ifdef SMP - if ((vm_offset_t)pcpup >= VM_MIN_KERNEL_ADDRESS) + if ((vm_offset_t)pcpup >= VM_MIN_KERNEL_ADDRESS && + (vm_offset_t)pcpup <= VM_MAX_KERNEL_ADDRESS) { mips_pcpu_tlb_init(pcpu); + } #endif } @@ -483,10 +485,20 @@ spinlock_exit(void) void cpu_idle(int busy) { - if (mips_rd_status() & MIPS_SR_INT_IE) - __asm __volatile ("wait"); - else - panic("ints disabled in idleproc!"); + KASSERT((mips_rd_status() & MIPS_SR_INT_IE) != 0, + ("interrupts disabled in idle process.")); + KASSERT((mips_rd_status() & MIPS_INT_MASK) != 0, + ("all interrupts masked in idle process.")); + + if (!busy) { + critical_enter(); + cpu_idleclock(); + } + __asm __volatile ("wait"); + if (!busy) { + cpu_activeclock(); + critical_exit(); + } } int