From owner-p4-projects@FreeBSD.ORG Fri Oct 13 14:26:47 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 6E60E16A417; Fri, 13 Oct 2006 14:26:47 +0000 (UTC) X-Original-To: perforce@FreeBSD.org Delivered-To: perforce@FreeBSD.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 43DAE16A415 for ; Fri, 13 Oct 2006 14:26:47 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id E166543D91 for ; Fri, 13 Oct 2006 14:26:43 +0000 (GMT) (envelope-from gonzo@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id k9DEQhvf032968 for ; Fri, 13 Oct 2006 14:26:43 GMT (envelope-from gonzo@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k9DEQhsW032965 for perforce@freebsd.org; Fri, 13 Oct 2006 14:26:43 GMT (envelope-from gonzo@FreeBSD.org) Date: Fri, 13 Oct 2006 14:26:43 GMT Message-Id: <200610131426.k9DEQhsW032965@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko To: Perforce Change Reviews Cc: Subject: PERFORCE change 107822 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Oct 2006 14:26:47 -0000 http://perforce.freebsd.org/chv.cgi?CH=107822 Change 107822 by gonzo@gonzo_hq on 2006/10/13 14:25:55 o Keep realstack pointer and pte0, pte1 for this pointer in machine-dependant fields of thread struct for further use. Affected files ... .. //depot/projects/mips2/src/sys/mips/include/proc.h#4 edit .. //depot/projects/mips2/src/sys/mips/mips/vm_machdep.c#9 edit Differences ... ==== //depot/projects/mips2/src/sys/mips/include/proc.h#4 (text+ko) ==== @@ -33,14 +33,18 @@ #ifndef _MACHINE_PROC_H_ #define _MACHINE_PROC_H_ +#include + /* * Machine-dependent part of the proc structure for AMD64. */ struct mdthread { - int md_flags; /* machine-dependent flags */ - void *md_regs; /* registers on current frame */ - __register_t md_saved_sr; /* critical section saved SR */ - int md_spinlock_count; + int md_flags; /* machine-dependent flags */ + void *md_regs; /* registers on current frame */ + __register_t md_saved_sr; /* critical section saved SR */ + vm_offset_t md_realstack; + pt_entry_t md_stack_pte[2]; + int md_spinlock_count; }; struct mdproc { ==== //depot/projects/mips2/src/sys/mips/mips/vm_machdep.c#9 (text+ko) ==== @@ -40,6 +40,7 @@ #include #include #include +#include #include #include #include @@ -178,8 +179,31 @@ void cpu_thread_setup(struct thread *td) { + pt_entry_t *pte; + /* + * To use wired TLB we should have even-aligned virtual address + * Since there is no way to specify alignment for td_kstack we + * drop KSTACK_GUARD support and request 3 pages for kstack. + * And use first even-aligned page number. + */ + if(td->td_kstack & (1 << PAGE_SHIFT)) + td->td_md.md_realstack = td->td_kstack + PAGE_SIZE; + else + td->td_md.md_realstack = td->td_kstack; + + /* + * Fill out PTEs to be wired then + */ + pte = tlb_kern_pte_find(kptmap, td->td_md.md_realstack); + td->td_md.md_stack_pte[0] = *pte; + + pte = tlb_kern_pte_find(kptmap, td->td_md.md_realstack + PAGE_SIZE); + td->td_md.md_stack_pte[1] = *pte; + + td->td_pcb = - (struct pcb *)(td->td_kstack + KSTACK_PAGES * PAGE_SIZE) - 1; + (struct pcb *)(td->td_md.md_realstack \ + + (KSTACK_PAGES - 1) * PAGE_SIZE) - 1; td->td_frame = (struct trapframe *)td->td_pcb - 1; /*