Tue Feb 21 12:09:50 2012 UTC ()
Use actual physmem size for allocation of bootstrap extra PT pages
to avoid wasting pages on low memory machines.
Improves atari specific part of PR/45915, tested on TT030.


(tsutsui)
diff -r1.98 -r1.99 src/sys/arch/atari/atari/atari_init.c

cvs diff -r1.98 -r1.99 src/sys/arch/atari/atari/atari_init.c (expand / switch to unified diff)

--- src/sys/arch/atari/atari/atari_init.c 2012/02/10 04:49:44 1.98
+++ src/sys/arch/atari/atari/atari_init.c 2012/02/21 12:09:50 1.99
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: atari_init.c,v 1.98 2012/02/10 04:49:44 mhitch Exp $ */ 1/* $NetBSD: atari_init.c,v 1.99 2012/02/21 12:09:50 tsutsui Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1995 Leo Weppelman 4 * Copyright (c) 1995 Leo Weppelman
5 * Copyright (c) 1994 Michael L. Hitch 5 * Copyright (c) 1994 Michael L. Hitch
6 * Copyright (c) 1993 Markus Wild 6 * Copyright (c) 1993 Markus Wild
7 * All rights reserved. 7 * All rights reserved.
8 * 8 *
9 * Redistribution and use in source and binary forms, with or without 9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions 10 * modification, are permitted provided that the following conditions
11 * are met: 11 * are met:
12 * 1. Redistributions of source code must retain the above copyright 12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer. 13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright 14 * 2. Redistributions in binary form must reproduce the above copyright
@@ -23,27 +23,27 @@ @@ -23,27 +23,27 @@
23 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 23 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
24 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 24 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
25 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 25 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
26 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 26 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
27 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 27 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
28 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
32 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */ 33 */
34 34
35#include <sys/cdefs.h> 35#include <sys/cdefs.h>
36__KERNEL_RCSID(0, "$NetBSD: atari_init.c,v 1.98 2012/02/10 04:49:44 mhitch Exp $"); 36__KERNEL_RCSID(0, "$NetBSD: atari_init.c,v 1.99 2012/02/21 12:09:50 tsutsui Exp $");
37 37
38#include "opt_ddb.h" 38#include "opt_ddb.h"
39#include "opt_mbtype.h" 39#include "opt_mbtype.h"
40#include "opt_m060sp.h" 40#include "opt_m060sp.h"
41#include "opt_m68k_arch.h" 41#include "opt_m68k_arch.h"
42 42
43#include <sys/param.h> 43#include <sys/param.h>
44#include <sys/systm.h> 44#include <sys/systm.h>
45#include <sys/ioctl.h> 45#include <sys/ioctl.h>
46#include <sys/select.h> 46#include <sys/select.h>
47#include <sys/tty.h> 47#include <sys/tty.h>
48#include <sys/buf.h> 48#include <sys/buf.h>
49#include <sys/msgbuf.h> 49#include <sys/msgbuf.h>
@@ -216,26 +216,27 @@ start_c(int id, u_int ttphystart, u_int  @@ -216,26 +216,27 @@ start_c(int id, u_int ttphystart, u_int
216 boot_segs[2].start = boot_segs[2].end = 0; /* End of segments! */ 216 boot_segs[2].start = boot_segs[2].end = 0; /* End of segments! */
217 217
218 /* 218 /*
219 * The following is a hack. We do not know how much ST memory we 219 * The following is a hack. We do not know how much ST memory we
220 * really need until after configuration has finished. At this 220 * really need until after configuration has finished. At this
221 * time I have no idea how to grab ST memory at that time. 221 * time I have no idea how to grab ST memory at that time.
222 * The round_page() call is ment to correct errors made by 222 * The round_page() call is ment to correct errors made by
223 * binpatching! 223 * binpatching!
224 */ 224 */
225 st_pool_size = m68k_round_page(st_pool_size); 225 st_pool_size = m68k_round_page(st_pool_size);
226 st_pool_phys = stphysize - st_pool_size; 226 st_pool_phys = stphysize - st_pool_size;
227 stphysize = st_pool_phys; 227 stphysize = st_pool_phys;
228 228
 229 physmem = btoc(stphysize) + btoc(ttphysize);
229 machineid = id; 230 machineid = id;
230 esym = esym_addr; 231 esym = esym_addr;
231 232
232 /*  233 /*
233 * the kernel ends at end() or esym. 234 * the kernel ends at end() or esym.
234 */ 235 */
235 if (esym == NULL) 236 if (esym == NULL)
236 end_loaded = (vaddr_t)&end; 237 end_loaded = (vaddr_t)&end;
237 else 238 else
238 end_loaded = (vaddr_t)esym; 239 end_loaded = (vaddr_t)esym;
239 240
240 /* 241 /*
241 * If we have enough fast-memory to put the kernel in and the 242 * If we have enough fast-memory to put the kernel in and the