bootloader: Set a default heap size for all platforms.
Use the one from the BIOS loader (1.25 MB) and apply it everywhere.
This commit is contained in:
@@ -52,6 +52,9 @@
|
|||||||
|
|
||||||
const static size_t kAlignment = 8;
|
const static size_t kAlignment = 8;
|
||||||
// all memory chunks will be a multiple of this
|
// all memory chunks will be a multiple of this
|
||||||
|
|
||||||
|
const static size_t kDefaultHeapSize = (1024 + 256) * 1024;
|
||||||
|
// default initial heap size, unless overridden by platform loader
|
||||||
const static size_t kLargeAllocationThreshold = 16 * 1024;
|
const static size_t kLargeAllocationThreshold = 16 * 1024;
|
||||||
// allocations of this size or larger are allocated via
|
// allocations of this size or larger are allocated via
|
||||||
// platform_allocate_region()
|
// platform_allocate_region()
|
||||||
@@ -401,6 +404,9 @@ heap_print_statistics()
|
|||||||
status_t
|
status_t
|
||||||
heap_init(stage2_args* args)
|
heap_init(stage2_args* args)
|
||||||
{
|
{
|
||||||
|
if (args->heap_size == 0)
|
||||||
|
args->heap_size = kDefaultHeapSize;
|
||||||
|
|
||||||
void* base;
|
void* base;
|
||||||
void* top;
|
void* top;
|
||||||
if (platform_init_heap(args, &base, &top) < B_OK)
|
if (platform_init_heap(args, &base, &top) < B_OK)
|
||||||
|
|||||||
@@ -20,8 +20,6 @@
|
|||||||
#include "rom_calls.h"
|
#include "rom_calls.h"
|
||||||
|
|
||||||
|
|
||||||
#define HEAP_SIZE 65536
|
|
||||||
|
|
||||||
// GCC defined globals
|
// GCC defined globals
|
||||||
extern void (*__ctor_list)(void);
|
extern void (*__ctor_list)(void);
|
||||||
extern void (*__ctor_end)(void);
|
extern void (*__ctor_end)(void);
|
||||||
@@ -132,7 +130,7 @@ _start(void)
|
|||||||
call_ctors();
|
call_ctors();
|
||||||
// call C++ constructors before doing anything else
|
// call C++ constructors before doing anything else
|
||||||
|
|
||||||
args.heap_size = HEAP_SIZE;
|
args.heap_size = 0;
|
||||||
args.arguments = NULL;
|
args.arguments = NULL;
|
||||||
|
|
||||||
//serial_init();
|
//serial_init();
|
||||||
|
|||||||
@@ -20,8 +20,6 @@
|
|||||||
#include "toscalls.h"
|
#include "toscalls.h"
|
||||||
|
|
||||||
|
|
||||||
#define HEAP_SIZE 65536
|
|
||||||
|
|
||||||
// GCC defined globals
|
// GCC defined globals
|
||||||
extern void (*__ctor_list)(void);
|
extern void (*__ctor_list)(void);
|
||||||
extern void (*__ctor_end)(void);
|
extern void (*__ctor_end)(void);
|
||||||
@@ -140,7 +138,7 @@ _start(void)
|
|||||||
// call C++ constructors before doing anything else
|
// call C++ constructors before doing anything else
|
||||||
Bconout(DEV_CON, 'I');
|
Bconout(DEV_CON, 'I');
|
||||||
|
|
||||||
args.heap_size = HEAP_SIZE;
|
args.heap_size = 0;
|
||||||
args.arguments = NULL;
|
args.arguments = NULL;
|
||||||
|
|
||||||
// so we can dprintf
|
// so we can dprintf
|
||||||
|
|||||||
@@ -31,9 +31,6 @@
|
|||||||
#include "smp.h"
|
#include "smp.h"
|
||||||
|
|
||||||
|
|
||||||
#define HEAP_SIZE ((1024 + 256) * 1024)
|
|
||||||
|
|
||||||
|
|
||||||
// GCC defined globals
|
// GCC defined globals
|
||||||
extern void (*__ctor_list)(void);
|
extern void (*__ctor_list)(void);
|
||||||
extern void (*__ctor_end)(void);
|
extern void (*__ctor_end)(void);
|
||||||
@@ -184,7 +181,7 @@ _start(void)
|
|||||||
call_ctors();
|
call_ctors();
|
||||||
// call C++ constructors before doing anything else
|
// call C++ constructors before doing anything else
|
||||||
|
|
||||||
args.heap_size = HEAP_SIZE;
|
args.heap_size = 0;
|
||||||
args.arguments = NULL;
|
args.arguments = NULL;
|
||||||
|
|
||||||
serial_init();
|
serial_init();
|
||||||
|
|||||||
@@ -233,7 +233,6 @@ extern "C" efi_status
|
|||||||
efi_main(efi_handle image, efi_system_table *systemTable)
|
efi_main(efi_handle image, efi_system_table *systemTable)
|
||||||
{
|
{
|
||||||
stage2_args args;
|
stage2_args args;
|
||||||
|
|
||||||
memset(&args, 0, sizeof(stage2_args));
|
memset(&args, 0, sizeof(stage2_args));
|
||||||
|
|
||||||
kImage = image;
|
kImage = image;
|
||||||
|
|||||||
@@ -19,7 +19,6 @@
|
|||||||
#include "keyboard.h"
|
#include "keyboard.h"
|
||||||
#include "nextrom.h"
|
#include "nextrom.h"
|
||||||
|
|
||||||
#define HEAP_SIZE 65536
|
|
||||||
|
|
||||||
// GCC defined globals
|
// GCC defined globals
|
||||||
extern void (*__ctor_list)(void);
|
extern void (*__ctor_list)(void);
|
||||||
@@ -246,7 +245,7 @@ start_next(const char *boot_args, struct mon_global *monitor)
|
|||||||
// call C++ constructors before doing anything else
|
// call C++ constructors before doing anything else
|
||||||
mg->mg_putc('I');
|
mg->mg_putc('I');
|
||||||
|
|
||||||
args.heap_size = HEAP_SIZE;
|
args.heap_size = 0;
|
||||||
args.arguments = NULL;
|
args.arguments = NULL;
|
||||||
|
|
||||||
//serial_init();
|
//serial_init();
|
||||||
|
|||||||
@@ -23,9 +23,6 @@
|
|||||||
#include "real_time_clock.h"
|
#include "real_time_clock.h"
|
||||||
|
|
||||||
|
|
||||||
#define HEAP_SIZE (512 * 1024)
|
|
||||||
|
|
||||||
|
|
||||||
// GCC defined globals
|
// GCC defined globals
|
||||||
extern void (*__ctor_list)(void);
|
extern void (*__ctor_list)(void);
|
||||||
extern void (*__ctor_end)(void);
|
extern void (*__ctor_end)(void);
|
||||||
@@ -104,7 +101,7 @@ start(void *openFirmwareEntry)
|
|||||||
|
|
||||||
// stage2 args - might be set via the command line one day
|
// stage2 args - might be set via the command line one day
|
||||||
stage2_args args;
|
stage2_args args;
|
||||||
args.heap_size = HEAP_SIZE;
|
args.heap_size = 0;
|
||||||
args.arguments = NULL;
|
args.arguments = NULL;
|
||||||
|
|
||||||
if (of_init((intptr_t (*)(void*))openFirmwareEntry) != B_OK)
|
if (of_init((intptr_t (*)(void*))openFirmwareEntry) != B_OK)
|
||||||
|
|||||||
@@ -24,8 +24,6 @@
|
|||||||
#include "graphics.h"
|
#include "graphics.h"
|
||||||
|
|
||||||
|
|
||||||
#define HEAP_SIZE (1024*1024)
|
|
||||||
|
|
||||||
// GCC defined globals
|
// GCC defined globals
|
||||||
extern void (*__ctor_list)(void);
|
extern void (*__ctor_list)(void);
|
||||||
extern void (*__ctor_end)(void);
|
extern void (*__ctor_end)(void);
|
||||||
@@ -205,7 +203,7 @@ _start(int hartId, void* fdt)
|
|||||||
call_ctors();
|
call_ctors();
|
||||||
|
|
||||||
stage2_args args;
|
stage2_args args;
|
||||||
args.heap_size = HEAP_SIZE;
|
args.heap_size = 0;
|
||||||
args.arguments = NULL;
|
args.arguments = NULL;
|
||||||
|
|
||||||
traps_init();
|
traps_init();
|
||||||
|
|||||||
@@ -30,9 +30,6 @@ extern "C" {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#define HEAP_SIZE (128 * 1024)
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct uboot_gd {
|
typedef struct uboot_gd {
|
||||||
// those are the only few members that we can trust
|
// those are the only few members that we can trust
|
||||||
// others depend on compile-time config
|
// others depend on compile-time config
|
||||||
@@ -191,7 +188,7 @@ start_gen(int argc, const char **argv, struct image_header *uimage, void *fdt)
|
|||||||
clear_bss();
|
clear_bss();
|
||||||
// call C++ constructors before doing anything else
|
// call C++ constructors before doing anything else
|
||||||
call_ctors();
|
call_ctors();
|
||||||
args.heap_size = HEAP_SIZE;
|
args.heap_size = 0;
|
||||||
args.arguments = NULL;
|
args.arguments = NULL;
|
||||||
args.arguments_count = 0;
|
args.arguments_count = 0;
|
||||||
args.platform.boot_tgz_data = NULL;
|
args.platform.boot_tgz_data = NULL;
|
||||||
|
|||||||
Reference in New Issue
Block a user