From owner-p4-projects@FreeBSD.ORG Wed Jan 16 01:27:45 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 38BEA16A51F; Wed, 16 Jan 2008 01:27:45 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D3B8B16A501 for ; Wed, 16 Jan 2008 01:27:44 +0000 (UTC) (envelope-from imp@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id B225013C4E1 for ; Wed, 16 Jan 2008 01:27:44 +0000 (UTC) (envelope-from imp@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id m0G1RiPc065050 for ; Wed, 16 Jan 2008 01:27:44 GMT (envelope-from imp@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id m0G1Risb065046 for perforce@freebsd.org; Wed, 16 Jan 2008 01:27:44 GMT (envelope-from imp@freebsd.org) Date: Wed, 16 Jan 2008 01:27:44 GMT Message-Id: <200801160127.m0G1Risb065046@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to imp@freebsd.org using -f From: Warner Losh To: Perforce Change Reviews Cc: Subject: PERFORCE change 133384 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: Wed, 16 Jan 2008 01:27:45 -0000 http://perforce.freebsd.org/chv.cgi?CH=133384 Change 133384 by imp@imp_lighthouse on 2008/01/16 01:26:43 Initialize kstack0 in the mips2 way rather than in the jmips way. Affected files ... .. //depot/projects/mips2-jnpr/src/sys/mips/include/md_var.h#8 edit .. //depot/projects/mips2-jnpr/src/sys/mips/mips/pmap.c#17 edit Differences ... ==== //depot/projects/mips2-jnpr/src/sys/mips/include/md_var.h#8 (text+ko) ==== @@ -43,6 +43,8 @@ extern char sigcode[]; extern int szsigcode, szosigcode; +extern vm_offset_t kstack0; + void MipsSaveCurFPState(struct thread *); void fork_trampoline(void); void cpu_swapin(struct proc *); ==== //depot/projects/mips2-jnpr/src/sys/mips/mips/pmap.c#17 (text+ko) ==== @@ -1,4 +1,3 @@ - kstack0 = pmap_steal_memory(KSTACK_PAGES * PAGE_SIZE); /* * Copyright (c) 1991 Regents of the University of California. * All rights reserved. @@ -256,7 +255,8 @@ } /* - * Bootstrap the system enough to run with virtual memory. + * Bootstrap the system enough to run with virtual memory. This + * assumes that the phys_avail array has been initialized. */ void pmap_bootstrap(void) @@ -265,6 +265,51 @@ pt_entry_t *pte; int i, j; + /* Sort. */ +again: + for (i = 0; phys_avail[i + 1] != 0; i += 2) { + if (i < 2) + continue; + if (phys_avail[i - 2] > phys_avail[i]) { + vm_paddr_t ptemp[2]; + + ptemp[0] = phys_avail[i+0]; + ptemp[1] = phys_avail[i+1]; + + phys_avail[i + 0] = phys_avail[i - 2]; + phys_avail[i + 1] = phys_avail[i - 1]; + + phys_avail[i - 2] = ptemp[0]; + phys_avail[i - 1] = ptemp[1]; + goto again; + } + } + + if (bootverbose) { + printf("Physical memory chunk(s):\n"); + for (i = 0; phys_avail[i + 1] != 0; i += 2) { + vm_paddr_t size; + + size = phys_avail[i + 1] - phys_avail[i]; + printf("%#08jx - %#08jx, %ju bytes (%ju pages)\n", + (uintmax_t)phys_avail[i], + (uintmax_t)phys_avail[i + 1] - 1, + (uintmax_t)size, (uintmax_t)size / PAGE_SIZE); + } + } + + + /* + * Steal the message buffer from the beginning of memory. + */ + msgbufp = (struct msgbuf *) pmap_steal_memory(MSGBUF_SIZE); + msgbufinit(msgbufp, MSGBUF_SIZE); + + /* + * Steal thread0 kstack. + */ + kstack0 = pmap_steal_memory(KSTACK_PAGES << PAGE_SHIFT); + /* * Allocate segment table for the kernel */