diff --git a/headers/private/kernel/boot_item.h b/headers/private/kernel/boot_item.h new file mode 100644 index 0000000000..4629c224f8 --- /dev/null +++ b/headers/private/kernel/boot_item.h @@ -0,0 +1,22 @@ +/* + * Copyright 2005, Axel Dörfler, axeld@pinc-software.de. All rights reserved. + * Distributed under the terms of the MIT License. + */ +#ifndef _KERNEL_BOOT_ITEM_H +#define _KERNEL_BOOT_ITEM_H + +#include + + +#ifdef __cplusplus +extern "C" { +#endif + +extern status_t add_boot_item(const char *name, void *data, size_t size); +extern void *get_boot_item(const char *name); + +#ifdef __cplusplus +} +#endif + +#endif /* _KERNEL_BOOT_ITEM_H */ diff --git a/headers/private/kernel/frame_buffer_console.h b/headers/private/kernel/frame_buffer_console.h index 25653242ac..0b2c5b7a91 100644 --- a/headers/private/kernel/frame_buffer_console.h +++ b/headers/private/kernel/frame_buffer_console.h @@ -11,6 +11,16 @@ struct kernel_args; #define FRAME_BUFFER_CONSOLE_MODULE_NAME "console/frame_buffer/v1" +#define FRAME_BUFFER_BOOT_INFO "frame_buffer/v1" + +struct frame_buffer_boot_info { + area_id area; + addr_t frame_buffer; + int32 width; + int32 height; + int32 depth; + int32 bytes_per_row; +}; #ifdef __cplusplus extern "C" { diff --git a/src/kernel/core/Jamfile b/src/kernel/core/Jamfile index 8b96a1fbaf..c25ee1c70f 100644 --- a/src/kernel/core/Jamfile +++ b/src/kernel/core/Jamfile @@ -17,6 +17,7 @@ if $(OS) != BEOS { } KernelMergeObject kernel_core.o : + boot_item.cpp cpu.c elf.c faults.c diff --git a/src/kernel/core/boot_item.cpp b/src/kernel/core/boot_item.cpp new file mode 100644 index 0000000000..29b6ffa34d --- /dev/null +++ b/src/kernel/core/boot_item.cpp @@ -0,0 +1,62 @@ +/* + * Copyright 2005, Axel Dörfler, axeld@pinc-software.de. All rights reserved. + * Distributed under the terms of the MIT License. + */ + + +#include +#include +#include + +#include + + +// ToDo: the boot items are not supposed to be changed after kernel startup +// so no locking is done. So for now, we need to be careful with adding +// new items. + +struct boot_item : public DoublyLinkedListLinkImpl { + const char *name; + void *data; + size_t size; +}; + +typedef DoublyLinkedList ItemList; + + +static ItemList sItemList; + + +status_t +add_boot_item(const char *name, void *data, size_t size) +{ + boot_item *item = new boot_item; + if (item == NULL) + return B_NO_MEMORY; + + item->name = name; + item->data = data; + item->size = size; + + sItemList.Add(item); + return B_OK; +} + + +void * +get_boot_item(const char *name) +{ + if (name == NULL || name[0] == '\0') + return NULL; + + // search item + for (ItemList::Iterator it = sItemList.GetIterator(); it.HasNext();) { + boot_item *item = it.Next(); + + if (!strcmp(name, item->name)) + return item->data; + } + + return NULL; +} + diff --git a/src/kernel/core/debug/frame_buffer_console.cpp b/src/kernel/core/debug/frame_buffer_console.cpp index d11a05fcb6..5b1423bef5 100644 --- a/src/kernel/core/debug/frame_buffer_console.cpp +++ b/src/kernel/core/debug/frame_buffer_console.cpp @@ -5,9 +5,10 @@ #include #include +#include #include - #include + #include #include "font.h" @@ -63,6 +64,7 @@ static uint32 sPalette32[] = { }; static struct console_info sConsole; +static struct frame_buffer_boot_info sBootInfo; static inline uint8 @@ -313,7 +315,7 @@ frame_buffer_console_init(kernel_args *args) sConsole.area = map_physical_memory("vesa_fb", (void *)args->frame_buffer.physical_buffer.start, args->frame_buffer.physical_buffer.size, B_ANY_KERNEL_ADDRESS, - B_READ_AREA | B_WRITE_AREA, &frameBuffer); + B_READ_AREA | B_WRITE_AREA | B_USER_CLONEABLE_AREA, &frameBuffer); if (sConsole.area < B_OK) return sConsole.area; @@ -335,6 +337,13 @@ frame_buffer_console_init(kernel_args *args) frame_buffer_update((addr_t)frameBuffer, args->frame_buffer.width, args->frame_buffer.height, args->frame_buffer.depth, bytesPerRow); + sBootInfo.frame_buffer = (addr_t)frameBuffer; + sBootInfo.width = args->frame_buffer.width; + sBootInfo.height = args->frame_buffer.height; + sBootInfo.depth = args->frame_buffer.depth; + sBootInfo.bytes_per_row = bytesPerRow; + add_boot_item(FRAME_BUFFER_BOOT_INFO, &sBootInfo, sizeof(frame_buffer_boot_info)); + return B_OK; }