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:
Augustin Cavalier
2024-10-09 22:08:36 -04:00
parent 6dae8511ff
commit 10bba152b3
9 changed files with 13 additions and 24 deletions
+6
View File
@@ -52,6 +52,9 @@
const static size_t kAlignment = 8;
// 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;
// allocations of this size or larger are allocated via
// platform_allocate_region()
@@ -401,6 +404,9 @@ heap_print_statistics()
status_t
heap_init(stage2_args* args)
{
if (args->heap_size == 0)
args->heap_size = kDefaultHeapSize;
void* base;
void* top;
if (platform_init_heap(args, &base, &top) < B_OK)
@@ -20,8 +20,6 @@
#include "rom_calls.h"
#define HEAP_SIZE 65536
// GCC defined globals
extern void (*__ctor_list)(void);
extern void (*__ctor_end)(void);
@@ -132,7 +130,7 @@ _start(void)
call_ctors();
// call C++ constructors before doing anything else
args.heap_size = HEAP_SIZE;
args.heap_size = 0;
args.arguments = NULL;
//serial_init();
@@ -20,8 +20,6 @@
#include "toscalls.h"
#define HEAP_SIZE 65536
// GCC defined globals
extern void (*__ctor_list)(void);
extern void (*__ctor_end)(void);
@@ -140,7 +138,7 @@ _start(void)
// call C++ constructors before doing anything else
Bconout(DEV_CON, 'I');
args.heap_size = HEAP_SIZE;
args.heap_size = 0;
args.arguments = NULL;
// so we can dprintf
+1 -4
View File
@@ -31,9 +31,6 @@
#include "smp.h"
#define HEAP_SIZE ((1024 + 256) * 1024)
// GCC defined globals
extern void (*__ctor_list)(void);
extern void (*__ctor_end)(void);
@@ -184,7 +181,7 @@ _start(void)
call_ctors();
// call C++ constructors before doing anything else
args.heap_size = HEAP_SIZE;
args.heap_size = 0;
args.arguments = NULL;
serial_init();
-1
View File
@@ -233,7 +233,6 @@ extern "C" efi_status
efi_main(efi_handle image, efi_system_table *systemTable)
{
stage2_args args;
memset(&args, 0, sizeof(stage2_args));
kImage = image;
+1 -2
View File
@@ -19,7 +19,6 @@
#include "keyboard.h"
#include "nextrom.h"
#define HEAP_SIZE 65536
// GCC defined globals
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
mg->mg_putc('I');
args.heap_size = HEAP_SIZE;
args.heap_size = 0;
args.arguments = NULL;
//serial_init();
@@ -23,9 +23,6 @@
#include "real_time_clock.h"
#define HEAP_SIZE (512 * 1024)
// GCC defined globals
extern void (*__ctor_list)(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 args;
args.heap_size = HEAP_SIZE;
args.heap_size = 0;
args.arguments = NULL;
if (of_init((intptr_t (*)(void*))openFirmwareEntry) != B_OK)
+1 -3
View File
@@ -24,8 +24,6 @@
#include "graphics.h"
#define HEAP_SIZE (1024*1024)
// GCC defined globals
extern void (*__ctor_list)(void);
extern void (*__ctor_end)(void);
@@ -205,7 +203,7 @@ _start(int hartId, void* fdt)
call_ctors();
stage2_args args;
args.heap_size = HEAP_SIZE;
args.heap_size = 0;
args.arguments = NULL;
traps_init();
+1 -4
View File
@@ -30,9 +30,6 @@ extern "C" {
};
#define HEAP_SIZE (128 * 1024)
typedef struct uboot_gd {
// those are the only few members that we can trust
// 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();
// call C++ constructors before doing anything else
call_ctors();
args.heap_size = HEAP_SIZE;
args.heap_size = 0;
args.arguments = NULL;
args.arguments_count = 0;
args.platform.boot_tgz_data = NULL;