* Enlarged a single kernel_args chunk to 32 KB (was 16 KB).
* Reduced the kernel_args array size from 32 to 16 (7 are used on a normal build). * Cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27690 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -21,7 +21,7 @@
|
||||
#include <util/KMessage.h>
|
||||
|
||||
#define CURRENT_KERNEL_ARGS_VERSION 1
|
||||
#define MAX_KERNEL_ARGS_RANGE 32
|
||||
#define MAX_KERNEL_ARGS_RANGE 16
|
||||
|
||||
// names of common boot_volume fields
|
||||
#define BOOT_METHOD "boot method"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2004-2006, Axel Dörfler, [email protected]. All rights reserved.
|
||||
* Copyright 2004-2008, Axel Dörfler, [email protected].
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include <string.h>
|
||||
|
||||
|
||||
static const size_t kChunkSize = 4 * B_PAGE_SIZE;
|
||||
static const size_t kChunkSize = 8 * B_PAGE_SIZE;
|
||||
|
||||
kernel_args gKernelArgs;
|
||||
|
||||
@@ -31,7 +31,8 @@ remove_range_index(addr_range *ranges, uint32 &numRanges, uint32 index)
|
||||
return;
|
||||
}
|
||||
|
||||
memmove(&ranges[index], &ranges[index + 1], sizeof(addr_range) * (numRanges - 1 - index));
|
||||
memmove(&ranges[index], &ranges[index + 1],
|
||||
sizeof(addr_range) * (numRanges - 1 - index));
|
||||
numRanges--;
|
||||
}
|
||||
|
||||
@@ -48,14 +49,13 @@ add_kernel_args_range(void *start, uint32 size)
|
||||
// #pragma mark - addr_range utility
|
||||
|
||||
|
||||
/** Inserts the specified (start, size) pair (aka range) in the
|
||||
* addr_range array.
|
||||
* It will extend existing ranges in order to have as little
|
||||
* ranges in the array as possible.
|
||||
* Returns B_OK on success, or B_ENTRY_NOT_FOUND if there was
|
||||
* no free array entry available anymore.
|
||||
/*! Inserts the specified (start, size) pair (aka range) in the
|
||||
addr_range array.
|
||||
It will extend existing ranges in order to have as little
|
||||
ranges in the array as possible.
|
||||
Returns B_OK on success, or B_ENTRY_NOT_FOUND if there was
|
||||
no free array entry available anymore.
|
||||
*/
|
||||
|
||||
extern "C" status_t
|
||||
insert_address_range(addr_range* ranges, uint32* _numRanges, uint32 maxRanges,
|
||||
addr_t start, uint32 size)
|
||||
@@ -193,8 +193,8 @@ status_t
|
||||
insert_physical_allocated_range(addr_t start, uint32 size)
|
||||
{
|
||||
return insert_address_range(gKernelArgs.physical_allocated_range,
|
||||
&gKernelArgs.num_physical_allocated_ranges, MAX_PHYSICAL_ALLOCATED_RANGE,
|
||||
start, size);
|
||||
&gKernelArgs.num_physical_allocated_ranges,
|
||||
MAX_PHYSICAL_ALLOCATED_RANGE, start, size);
|
||||
}
|
||||
|
||||
|
||||
@@ -210,12 +210,11 @@ insert_virtual_allocated_range(addr_t start, uint32 size)
|
||||
// #pragma mark - kernel_args allocations
|
||||
|
||||
|
||||
/** This function can be used to allocate memory that is going
|
||||
* to be passed over to the kernel. For example, the preloaded_image
|
||||
* structures are allocated this way.
|
||||
* The boot loader heap doesn't make it into the kernel!
|
||||
/*! This function can be used to allocate memory that is going
|
||||
to be passed over to the kernel. For example, the preloaded_image
|
||||
structures are allocated this way.
|
||||
The boot loader heap doesn't make it into the kernel!
|
||||
*/
|
||||
|
||||
extern "C" void*
|
||||
kernel_args_malloc(size_t size)
|
||||
{
|
||||
@@ -246,8 +245,8 @@ kernel_args_malloc(size_t size)
|
||||
|
||||
// just allocate a new block and "close" the old one
|
||||
void* block = NULL;
|
||||
if (platform_allocate_region(&block, kChunkSize,
|
||||
B_READ_AREA | B_WRITE_AREA, false) != B_OK) {
|
||||
if (platform_allocate_region(&block, kChunkSize, B_READ_AREA | B_WRITE_AREA,
|
||||
false) != B_OK) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -261,10 +260,9 @@ kernel_args_malloc(size_t size)
|
||||
}
|
||||
|
||||
|
||||
/** Convenience function that copies strdup() functions for the
|
||||
* kernel args heap.
|
||||
/*! Convenience function that copies strdup() functions for the
|
||||
kernel args heap.
|
||||
*/
|
||||
|
||||
extern "C" char *
|
||||
kernel_args_strdup(const char *string)
|
||||
{
|
||||
@@ -282,11 +280,10 @@ kernel_args_strdup(const char *string)
|
||||
}
|
||||
|
||||
|
||||
/** This function frees a block allocated via kernel_args_malloc().
|
||||
* It's very simple; it can only free the last allocation. It's
|
||||
* enough for its current usage in the boot loader, though.
|
||||
/*! This function frees a block allocated via kernel_args_malloc().
|
||||
It's very simple; it can only free the last allocation. It's
|
||||
enough for its current usage in the boot loader, though.
|
||||
*/
|
||||
|
||||
extern "C" void
|
||||
kernel_args_free(void *block)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user