From owner-freebsd-sparc Wed Jul 3 19:12:59 2002 Delivered-To: freebsd-sparc@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4920E37B400 for ; Wed, 3 Jul 2002 19:12:55 -0700 (PDT) Received: from fledge.watson.org (fledge.watson.org [204.156.12.50]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9289843E31 for ; Wed, 3 Jul 2002 19:12:54 -0700 (PDT) (envelope-from robert@fledge.watson.org) Received: from fledge.watson.org (fledge.pr.watson.org [192.0.2.3]) by fledge.watson.org (8.12.4/8.12.4) with SMTP id g642CpbM097991 for ; Wed, 3 Jul 2002 22:12:51 -0400 (EDT) (envelope-from robert@fledge.watson.org) Date: Wed, 3 Jul 2002 22:12:51 -0400 (EDT) From: Robert Watson X-Sender: robert@fledge.watson.org To: sparc64@FreeBSD.org Subject: sparc64 patch for testing. (fwd) Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-sparc@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org This went over on -current, but there might be better chances of review here given less non-sparc64 noise, etc. Robert N M Watson FreeBSD Core Team, TrustedBSD Projects robert@fledge.watson.org Network Associates Laboratories ---------- Forwarded message ---------- Date: Wed, 3 Jul 2002 18:50:01 -0700 (PDT) From: Julian Elischer To: FreeBSD current users Subject: sparc64 patch for testing. 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 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-sparc" in the body of the message