mirror of
https://review.haiku-os.org/haiku
synced 2025-01-18 12:38:51 +01:00
bootloader: Make releasing the heap the platform loader's responsibility.
Otherwise, platform loaders couldn't make heap allocations inside platform_start_kernel(), which some loaders (e.g. EFI) do. Implement calling heap_release() for the BIOS loaders at least. This gets us back the ~1.5MB of bootloader heap memory there.
This commit is contained in:
parent
e738425f4d
commit
e52dd571d9
@ -1,23 +1,28 @@
|
||||
/*
|
||||
** Copyright 2003, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
|
||||
** Distributed under the terms of the MIT License.
|
||||
*/
|
||||
* Copyright 2003, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef KERNEL_BOOT_HEAP_H
|
||||
#define KERNEL_BOOT_HEAP_H
|
||||
|
||||
|
||||
#include <SupportDefs.h>
|
||||
#include <boot/stage2_args.h>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern void heap_release(struct stage2_args *args);
|
||||
extern void heap_print_statistics();
|
||||
|
||||
extern status_t heap_init(struct stage2_args *args);
|
||||
extern void heap_print_statistics();
|
||||
extern void heap_release();
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* KERNEL_BOOT_HEAP_H */
|
||||
|
@ -383,7 +383,7 @@ FreeChunk::SetToAllocated(void* allocated)
|
||||
|
||||
|
||||
void
|
||||
heap_release(stage2_args* args)
|
||||
heap_release()
|
||||
{
|
||||
heap_print_statistics();
|
||||
|
||||
|
@ -161,13 +161,13 @@ main(stage2_args *args)
|
||||
gKernelArgs.boot_volume_size = gBootVolume.ContentSize();
|
||||
|
||||
platform_cleanup_devices();
|
||||
// TODO: cleanup, heap_release() etc.
|
||||
heap_print_statistics();
|
||||
// Further cleanup (e.g. heap_release) is the platform's responsibility.
|
||||
|
||||
platform_start_kernel();
|
||||
}
|
||||
}
|
||||
|
||||
out:
|
||||
heap_release(args);
|
||||
heap_release();
|
||||
return 0;
|
||||
}
|
||||
|
@ -354,6 +354,8 @@ long_start_kernel()
|
||||
long_gdt_init();
|
||||
debug_cleanup();
|
||||
long_mmu_init();
|
||||
heap_release();
|
||||
|
||||
convert_kernel_args();
|
||||
|
||||
// Save the kernel entry point address.
|
||||
|
@ -139,6 +139,7 @@ platform_start_kernel(void)
|
||||
smp_init_other_cpus();
|
||||
debug_cleanup();
|
||||
mmu_init_for_kernel();
|
||||
heap_release();
|
||||
|
||||
// We're about to enter the kernel -- disable console output.
|
||||
stdout = NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user