Adjust the reserved heap space based on memory size. This avoids running out

of heap on machines with large amounts of memory.  Tested on 33MB RISC OS 4
and 128MB RISC OS 5 machines.  Updated version to 3.40.
This commit is contained in:
abs 2004-05-26 23:13:03 +00:00
parent cb0c78eebb
commit eb8a427e28
2 changed files with 11 additions and 8 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: boot32.c,v 1.18 2004/05/19 23:37:41 abs Exp $ */
/* $NetBSD: boot32.c,v 1.19 2004/05/26 23:13:03 abs Exp $ */
/*-
* Copyright (c) 2002 Reinoud Zandijk
@ -42,6 +42,7 @@
#include <arm/arm32/pte.h>
#include <machine/bootconfig.h>
extern char end[];
/* debugging flags */
int debug = 1;
@ -159,8 +160,10 @@ void init_datastructures(void) {
/* Get number of pages and the memorytablesize */
osmemory_read_arrangement_table_size(&memory_table_size, &nbpp);
/* reserve some space for heap etc... 512 might be bigish though */
memory_image_size = (int) HIMEM - 512*1024;
/* Allocate 99% - (small fixed amount) of the heap for memory_image */
memory_image_size = (int)HIMEM - (int)end - 512 * 1024;
memory_image_size /= 100;
memory_image_size *= 99;
if (memory_image_size <= 256*1024)
panic("Insufficient memory");
@ -175,9 +178,8 @@ void init_datastructures(void) {
lastpage = ((int) top_memory / nbpp) - 1;
totalpages = lastpage - firstpage;
printf("Got %ld memory pages each %d kilobytes to mess with.\n\n",
totalpages, nbpp>>10
);
printf("Allocated %ld memory pages, each of %d kilobytes.\n\n",
totalpages, nbpp>>10 );
/*
* Setup the relocation table. Its a simple array of 3 * 32 bit

View File

@ -1,4 +1,4 @@
$NetBSD: version,v 1.8 2004/05/19 23:37:41 abs Exp $
$NetBSD: version,v 1.9 2004/05/26 23:13:05 abs Exp $
0.90: Experimental C version
0.91: General cleanup
@ -17,10 +17,11 @@ $NetBSD: version,v 1.8 2004/05/19 23:37:41 abs Exp $
3.00: acorn32 bootloader version 3 is alive
3.01: fixed serious non VRAM screen issues and made NC live again!
3.02: first small try for bootfile name fixing
3.03: no zeropage useage anymore
3.03: no zeropage usage anymore
3.04: fixed physical memory blocks searching; it was a sorting error
3.05: fixed printing of videomem useage
3.06: fixed non 1Mb-alignment problems for the top 1Mb in the memorymap
3.10: Serious loading problems fixed and cleanup code
3.20: Redone videomem mapping and top memory search; esp. for smaller machines
3.30: Use qsort to significantly speed memory sort
3.40: Adjust reserved heap space based on memory size