From owner-freebsd-mips@FreeBSD.ORG Thu Jun 25 02:01:54 2009 Return-Path: Delivered-To: freebsd-mips@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DC6921065673 for ; Thu, 25 Jun 2009 02:01:54 +0000 (UTC) (envelope-from neelnatu@yahoo.com) Received: from web34405.mail.mud.yahoo.com (web34405.mail.mud.yahoo.com [66.163.178.154]) by mx1.freebsd.org (Postfix) with SMTP id 9D3C78FC13 for ; Thu, 25 Jun 2009 02:01:54 +0000 (UTC) (envelope-from neelnatu@yahoo.com) Received: (qmail 26041 invoked by uid 60001); 25 Jun 2009 02:01:54 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1245895314; bh=QTHw37F50J0YECLH76gZtnc8aVXFH7GJfdarlxlDksQ=; h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:MIME-Version:Content-Type; b=4WLoUM4luHg4Abw/gKrexSORZFZPfMOGY40nccCXFy1mcG379zJN+QiLMNGPUFJgCPwxhmGIkeU9q9WYsynaH6CMwXGm25W+J0nCILHs/4ftcSSeQcYAi1hMr7YANBV1GgV1dGYiX4W9kqRRIytWeIQuKTqwZc3ss3tB51ipHgY= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:MIME-Version:Content-Type; b=M45qKhlhqiWpT5OSe3lk2GspWcnZ/4lwVtux+kcnQ0D2TQnV+r3NAoPn0RnTvcyZY2QUSZfjtgY5Xid+k2FTITf2SWRGiChTftW0Tm2ttq4rXuRDXodO8Vh5y6SIRV4X0PUwFocHk+GGwKTGh5jQCnevOYumPrLbNgd5+oiMbWs=; Message-ID: <7874.24776.qm@web34405.mail.mud.yahoo.com> X-YMail-OSG: LxtcAbUVM1lY7Tgrz6LOfBsailOxlHEwv7rS2YYRVXWHhsWdIjmzHfyaRLdzxQdfhWn9ojzvU.rvHfzmlRY08vp7iKmWMF7rmP6xesrqXC52TOP_iO7hupYEwqCZ6Q2HZ0ZoX0u8_fGDsh4Gg3M_9Q_.tKN.110F.fjTm8CGaeAnajwbfWECPM5oNc33DJLa3tlpksHAulBYJQxrILULKubshZ.BA3TAYENfyp_XuTQf1yd2_Lck1huiiC2mOlFQkER38NL3box3Ptxe_5tIwYoEyTDOrsCMmz5mEkj112fEMln3de6qPWpY0cA4GBhq5_JnMw-- Received: from [198.95.226.228] by web34405.mail.mud.yahoo.com via HTTP; Wed, 24 Jun 2009 19:01:53 PDT X-Mailer: YahooMailClassic/5.4.17 YahooMailWebService/0.7.289.15 Date: Wed, 24 Jun 2009 19:01:53 -0700 (PDT) From: Neelkanth Natu To: freebsd-mips@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: Diffs to allow thread0 kstack to use 2 pages X-BeenThere: freebsd-mips@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to MIPS List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2009 02:01:55 -0000 Hi, Please take a look at the diffs below to allow the thread0 kernel stack to use 2 pages worth of stack space. I believe that was the original intent of the code. A side effect of the change is to align kstack0 on a PAGE_SIZE boundary. Could somebody review the code and commit it if possible? I have tested it on Sibyte and Malta platforms. best Neel ==== //depot/user/neelnatu/freebsd_current/src/sys/mips/mips/pmap.c#3 - /u/neelnatu/p4/freebsd_current/src/sys/mips/mips/pmap.c ==== @@ -292,6 +292,12 @@ /* Sort. */ again: for (i = 0; phys_avail[i + 1] != 0; i += 2) { + /* + * Keep the memory aligned on page boundary. + */ + phys_avail[i] = round_page(phys_avail[i]); + phys_avail[i + 1] = trunc_page(phys_avail[i + 1]); + if (phys_avail[i + 1] >= MIPS_KSEG0_LARGEST_PHYS) { memory_larger_than_512meg++; } ==== //depot/user/neelnatu/freebsd_current/src/sys/mips/mips/machdep.c#3 - /u/neelnatu/p4/freebsd_current/src/sys/mips/mips/machdep.c ==== @@ -253,8 +253,11 @@ mips_proc0_init(void) { proc_linkup(&proc0, &thread0); + + KASSERT((kstack0 & PAGE_MASK) == 0, + ("kstack0 is not aligned on a page boundary: 0x%0x", kstack0)); thread0.td_kstack = kstack0; - thread0.td_kstack_pages = KSTACK_PAGES - 1; + thread0.td_kstack_pages = KSTACK_PAGES; if (thread0.td_kstack & (1 << PAGE_SHIFT)) thread0.td_md.md_realstack = thread0.td_kstack + PAGE_SIZE; else