From owner-freebsd-current Wed Jul 3 19: 0:23 2002 Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1734637B401 for ; Wed, 3 Jul 2002 19:00:13 -0700 (PDT) Received: from rwcrmhc52.attbi.com (rwcrmhc52.attbi.com [216.148.227.88]) by mx1.FreeBSD.org (Postfix) with ESMTP id B5C0643E4A for ; Wed, 3 Jul 2002 19:00:12 -0700 (PDT) (envelope-from julian@elischer.org) Received: from InterJet.elischer.org ([12.232.206.8]) by rwcrmhc52.attbi.com (InterMail vM.4.01.03.27 201-229-121-127-20010626) with ESMTP id <20020704020012.FOMD8262.rwcrmhc52.attbi.com@InterJet.elischer.org> for ; Thu, 4 Jul 2002 02:00:12 +0000 Received: from localhost (localhost.elischer.org [127.0.0.1]) by InterJet.elischer.org (8.9.1a/8.9.1) with ESMTP id SAA05573 for ; Wed, 3 Jul 2002 18:50:03 -0700 (PDT) Date: Wed, 3 Jul 2002 18:50:01 -0700 (PDT) From: Julian Elischer To: FreeBSD current users Subject: sparc64 patch for testing. Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG to keep the sparc 64 pmap up with the others.. I had a look at a couple of thread related points. Here's a possible diff (1 bug found I think) any sparc64 people care to comment? (cat-n-pasted patch) The last addition is I think needed to not leak KV space. The first changes are because the conditional is not needed. This function is only ever called for uninitialised (new) thread structures now.. Index: pmap.c =================================================================== RCS file: /home/ncvs/src/sys/sparc64/sparc64/pmap.c,v retrieving revision 1.58 diff -u -r1.58 pmap.c --- pmap.c 29 May 2002 06:12:13 -0000 1.58 +++ pmap.c 4 Jul 2002 01:44:34 -0000 @@ -962,27 +962,21 @@ /* * Allocate object for the kstack, */ - ksobj = td->td_kstack_obj; - if (ksobj == NULL) { - ksobj = vm_object_allocate(OBJT_DEFAULT, KSTACK_PAGES); - td->td_kstack_obj = ksobj; - } + ksobj = vm_object_allocate(OBJT_DEFAULT, KSTACK_PAGES); + td->td_kstack_obj = ksobj; /* * Get a kernel virtual address for the kstack for this thread. */ - ks = td->td_kstack; - if (ks == 0) { - ks = kmem_alloc_nofault(kernel_map, - (KSTACK_PAGES + KSTACK_GUARD_PAGES) * PAGE_SIZE); - if (ks == 0) - panic("pmap_new_thread: kstack allocation failed"); - if (KSTACK_GUARD_PAGES != 0) { - tlb_page_demap(TLB_DTLB, kernel_pmap, ks); - ks += KSTACK_GUARD_PAGES * PAGE_SIZE; - } - td->td_kstack = ks; + ks = kmem_alloc_nofault(kernel_map, + (KSTACK_PAGES + KSTACK_GUARD_PAGES) * PAGE_SIZE); + if (ks == 0) + panic("pmap_new_thread: kstack allocation failed"); + if (KSTACK_GUARD_PAGES != 0) { + tlb_page_demap(TLB_DTLB, kernel_pmap, ks); + ks += KSTACK_GUARD_PAGES * PAGE_SIZE; } + td->td_kstack = ks; for (i = 0; i < KSTACK_PAGES; i++) { /* @@ -1042,6 +1036,13 @@ td->td_kstack_obj = NULL; vm_object_deallocate(ksobj); } + /* + * don't forget to free the kmem space we were using. + * (including guard pages). + */ + ks -= KSTACK_GUARD_PAGES * PAGE_SIZE; + kmem_free(kernel_map, ks, + (KSTACK_PAGES + KSTACK_GUARD_PAGES) * PAGE_SIZE); } /* To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message