From owner-svn-src-head@FreeBSD.ORG Tue Jan 26 03:39:11 2010 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 196DD1065672; Tue, 26 Jan 2010 03:39:11 +0000 (UTC) (envelope-from neel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 095A48FC0A; Tue, 26 Jan 2010 03:39:11 +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 o0Q3dADO066166; Tue, 26 Jan 2010 03:39:10 GMT (envelope-from neel@svn.freebsd.org) Received: (from neel@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o0Q3dAxh066164; Tue, 26 Jan 2010 03:39:10 GMT (envelope-from neel@svn.freebsd.org) Message-Id: <201001260339.o0Q3dAxh066164@svn.freebsd.org> From: Neel Natu Date: Tue, 26 Jan 2010 03:39:10 +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: r203000 - head/sys/mips/sibyte 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: Tue, 26 Jan 2010 03:39:11 -0000 Author: neel Date: Tue Jan 26 03:39:10 2010 New Revision: 203000 URL: http://svn.freebsd.org/changeset/base/203000 Log: Install the XTLB exception handler for Sibyte processors. This is a workaround for the fact that the CFE is compiled as a 64-bit application and therefore sets the SR_KX bit every time we call into it (for e.g. console). A TLB miss for any address above 0xc0000000 with the SR_KX bit set will end up at the XTLB exception vector. We workaround this by copying the standard TLB handler at the XTLB exception vector. Approved by: imp (mentor) Modified: head/sys/mips/sibyte/sb_machdep.c Modified: head/sys/mips/sibyte/sb_machdep.c ============================================================================== --- head/sys/mips/sibyte/sb_machdep.c Tue Jan 26 03:29:52 2010 (r202999) +++ head/sys/mips/sibyte/sb_machdep.c Tue Jan 26 03:39:10 2010 (r203000) @@ -93,6 +93,8 @@ extern void cfe_env_init(void); extern int *edata; extern int *end; +extern char MipsTLBMiss[], MipsTLBMissEnd[]; + void platform_cpu_init() { @@ -183,6 +185,28 @@ mips_init(void) init_param1(); init_param2(physmem); mips_cpu_init(); + + /* + * XXX + * The kernel is running in 32-bit mode but the CFE is running in + * 64-bit mode. So the SR_KX bit in the status register is turned + * on by the CFE every time we call into it - for e.g. CFE_CONSOLE. + * + * This means that if get a TLB miss for any address above 0xc0000000 + * and the SR_KX bit is set then we will end up in the XTLB exception + * vector. + * + * For now work around this by copying the TLB exception handling + * code to the XTLB exception vector. + */ + { + bcopy(MipsTLBMiss, (void *)XTLB_MISS_EXC_VEC, + MipsTLBMissEnd - MipsTLBMiss); + + mips_icache_sync_all(); + mips_dcache_wbinv_all(); + } + pmap_bootstrap(); mips_proc0_init(); mutex_init();