mirror of
https://github.com/genodelabs/genode.git
synced 2025-01-18 02:40:08 +00:00
parent
15cc6d688f
commit
a36465426b
@ -25,6 +25,7 @@
|
||||
#include <base/internal/globals.h>
|
||||
|
||||
/* core includes */
|
||||
#include <core_log.h>
|
||||
#include <platform.h>
|
||||
#include <platform_thread.h>
|
||||
#include <platform_pd.h>
|
||||
@ -457,6 +458,29 @@ Platform::Platform() :
|
||||
|
||||
/* we never call _core_thread.start(), so set name directly */
|
||||
Fiasco::fiasco_register_thread_name(core_thread->native_thread_id(), core_thread->name());
|
||||
|
||||
/* core log as ROM module */
|
||||
{
|
||||
void * phys_ptr = nullptr;
|
||||
unsigned const pages = 1;
|
||||
size_t const log_size = pages << get_page_size_log2();
|
||||
|
||||
ram_alloc()->alloc_aligned(log_size, &phys_ptr, get_page_size_log2());
|
||||
addr_t const phys_addr = reinterpret_cast<addr_t>(phys_ptr);
|
||||
|
||||
void * const core_local_ptr = phys_ptr;
|
||||
addr_t const core_local_addr = phys_addr;
|
||||
|
||||
/* let one page free after the log buffer */
|
||||
region_alloc()->remove_range(core_local_addr, log_size + get_page_size());
|
||||
|
||||
memset(core_local_ptr, 0, log_size);
|
||||
|
||||
_rom_fs.insert(new (core_mem_alloc()) Rom_module(phys_addr, log_size,
|
||||
"core_log"));
|
||||
|
||||
init_core_log(Core_log_range { core_local_addr, log_size } );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -25,6 +25,8 @@
|
||||
|
||||
/* core includes */
|
||||
#include <boot_modules.h>
|
||||
#include <core_log.h>
|
||||
#include <map_local.h>
|
||||
#include <platform.h>
|
||||
#include <platform_thread.h>
|
||||
#include <platform_pd.h>
|
||||
@ -457,6 +459,29 @@ Platform::Platform() :
|
||||
|
||||
core_thread->pager(&_sigma0);
|
||||
_core_pd->bind_thread(core_thread);
|
||||
|
||||
/* core log as ROM module */
|
||||
{
|
||||
void * core_local_ptr = nullptr;
|
||||
void * phys_ptr = nullptr;
|
||||
unsigned const pages = 1;
|
||||
size_t const log_size = pages << get_page_size_log2();
|
||||
|
||||
ram_alloc()->alloc_aligned(log_size, &phys_ptr, get_page_size_log2());
|
||||
addr_t const phys_addr = reinterpret_cast<addr_t>(phys_ptr);
|
||||
|
||||
/* let one page free after the log buffer */
|
||||
region_alloc()->alloc_aligned(log_size, &core_local_ptr, get_page_size_log2());
|
||||
addr_t const core_local_addr = reinterpret_cast<addr_t>(core_local_ptr);
|
||||
|
||||
map_local(phys_addr, core_local_addr, pages);
|
||||
memset(core_local_ptr, 0, log_size);
|
||||
|
||||
_rom_fs.insert(new (core_mem_alloc()) Rom_module(phys_addr, log_size,
|
||||
"core_log"));
|
||||
|
||||
init_core_log(Core_log_range { core_local_addr, log_size } );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
/* core includes */
|
||||
#include <boot_modules.h>
|
||||
#include <core_log.h>
|
||||
#include <hw/memory_region.h>
|
||||
#include <map_local.h>
|
||||
#include <platform.h>
|
||||
@ -134,6 +135,29 @@ Platform::Platform()
|
||||
_init_rom_modules();
|
||||
_init_additional();
|
||||
|
||||
/* core log as ROM module */
|
||||
{
|
||||
void * core_local_ptr = nullptr;
|
||||
void * phys_ptr = nullptr;
|
||||
unsigned const pages = 1;
|
||||
size_t const log_size = pages << get_page_size_log2();
|
||||
|
||||
ram_alloc()->alloc_aligned(log_size, &phys_ptr, get_page_size_log2());
|
||||
addr_t const phys_addr = reinterpret_cast<addr_t>(phys_ptr);
|
||||
|
||||
/* let one page free after the log buffer */
|
||||
region_alloc()->alloc_aligned(log_size, &core_local_ptr, get_page_size_log2());
|
||||
addr_t const core_local_addr = reinterpret_cast<addr_t>(core_local_ptr);
|
||||
|
||||
map_local(phys_addr, core_local_addr, pages);
|
||||
memset(core_local_ptr, 0, log_size);
|
||||
|
||||
_rom_fs.insert(new (core_mem_alloc()) Rom_module(phys_addr, log_size,
|
||||
"core_log"));
|
||||
|
||||
init_core_log(Core_log_range { core_local_addr, log_size } );
|
||||
}
|
||||
|
||||
/* print ressource summary */
|
||||
log(":virt_alloc: ", *_core_mem_alloc.virt_alloc());
|
||||
log(":phys_alloc: ", *_core_mem_alloc.phys_alloc());
|
||||
|
@ -50,7 +50,8 @@ namespace Genode {
|
||||
/* map of virtual cpu ids in Genode to kernel cpu ids */
|
||||
uint8_t map_cpu_ids[MAX_SUPPORTED_CPUS];
|
||||
|
||||
addr_t _map_pages(addr_t phys_page, addr_t pages);
|
||||
addr_t _map_pages(addr_t phys_page, addr_t pages,
|
||||
bool guard_page = false);
|
||||
|
||||
size_t _max_caps = 0;
|
||||
|
||||
|
@ -23,6 +23,7 @@
|
||||
|
||||
/* core includes */
|
||||
#include <boot_modules.h>
|
||||
#include <core_log.h>
|
||||
#include <platform.h>
|
||||
#include <nova_util.h>
|
||||
#include <util.h>
|
||||
@ -71,14 +72,15 @@ extern unsigned _prog_img_beg, _prog_img_end;
|
||||
* This function uses the virtual-memory region allocator to find a region
|
||||
* fitting the desired mapping. Other allocators are left alone.
|
||||
*/
|
||||
addr_t Platform::_map_pages(addr_t phys_page, addr_t const pages)
|
||||
addr_t Platform::_map_pages(addr_t const phys_addr, addr_t const pages,
|
||||
bool guard_page)
|
||||
{
|
||||
addr_t const phys_addr = phys_page << get_page_size_log2();
|
||||
addr_t const size = pages << get_page_size_log2();
|
||||
addr_t const size = pages << get_page_size_log2();
|
||||
|
||||
/* try to reserve contiguous virtual area */
|
||||
void *core_local_ptr = 0;
|
||||
if (!region_alloc()->alloc(size, &core_local_ptr))
|
||||
if (region_alloc()->alloc_aligned(size + (guard_page ? get_page_size() : 0),
|
||||
&core_local_ptr, get_page_size_log2()).error())
|
||||
return 0;
|
||||
|
||||
addr_t const core_local_addr = reinterpret_cast<addr_t>(core_local_ptr);
|
||||
@ -637,10 +639,9 @@ Platform::Platform() :
|
||||
|
||||
unsigned const pages = 1;
|
||||
void * phys_ptr = 0;
|
||||
ram_alloc()->alloc(get_page_size(), &phys_ptr);
|
||||
ram_alloc()->alloc_aligned(get_page_size(), &phys_ptr, get_page_size_log2());
|
||||
addr_t const phys_addr = reinterpret_cast<addr_t>(phys_ptr);
|
||||
addr_t const core_local_addr = _map_pages(phys_addr >> get_page_size_log2(),
|
||||
pages);
|
||||
addr_t const core_local_addr = _map_pages(phys_addr, pages);
|
||||
|
||||
Genode::Xml_generator xml(reinterpret_cast<char *>(core_local_addr),
|
||||
pages << get_page_size_log2(),
|
||||
@ -681,11 +682,11 @@ Platform::Platform() :
|
||||
|
||||
/* export hypervisor info page as ROM module */
|
||||
{
|
||||
void * phys_ptr = 0;
|
||||
ram_alloc()->alloc(get_page_size(), &phys_ptr);
|
||||
addr_t phys_addr = reinterpret_cast<addr_t>(phys_ptr);
|
||||
void * phys_ptr = nullptr;
|
||||
ram_alloc()->alloc_aligned(get_page_size(), &phys_ptr, get_page_size_log2());
|
||||
|
||||
addr_t core_local_addr = _map_pages(phys_addr >> get_page_size_log2(), 1);
|
||||
addr_t const phys_addr = reinterpret_cast<addr_t>(phys_ptr);
|
||||
addr_t const core_local_addr = _map_pages(phys_addr, 1);
|
||||
|
||||
memcpy(reinterpret_cast<void *>(core_local_addr), hip, get_page_size());
|
||||
|
||||
@ -697,6 +698,24 @@ Platform::Platform() :
|
||||
"hypervisor_info_page"));
|
||||
}
|
||||
|
||||
/* core log as ROM module */
|
||||
{
|
||||
void * phys_ptr = nullptr;
|
||||
unsigned const pages = 1;
|
||||
size_t const log_size = pages << get_page_size_log2();
|
||||
|
||||
ram_alloc()->alloc_aligned(log_size, &phys_ptr, get_page_size_log2());
|
||||
addr_t const phys_addr = reinterpret_cast<addr_t>(phys_ptr);
|
||||
|
||||
addr_t const core_local_addr = _map_pages(phys_addr, pages, true);
|
||||
memset(reinterpret_cast<void *>(core_local_addr), 0, log_size);
|
||||
|
||||
_rom_fs.insert(new (core_mem_alloc()) Rom_module(phys_addr, log_size,
|
||||
"core_log"));
|
||||
|
||||
init_core_log( Core_log_range { core_local_addr, log_size } );
|
||||
}
|
||||
|
||||
/* I/O port allocator (only meaningful for x86) */
|
||||
_io_port_alloc.add_range(0, 0x10000);
|
||||
|
||||
@ -717,10 +736,10 @@ Platform::Platform() :
|
||||
for (unsigned i = 0; i < 32; i++)
|
||||
{
|
||||
void * phys_ptr = 0;
|
||||
ram_alloc()->alloc(4096, &phys_ptr);
|
||||
ram_alloc()->alloc_aligned(get_page_size(), &phys_ptr, get_page_size_log2());
|
||||
|
||||
addr_t phys_addr = reinterpret_cast<addr_t>(phys_ptr);
|
||||
addr_t core_local_addr = _map_pages(phys_addr >> get_page_size_log2(), 1);
|
||||
addr_t core_local_addr = _map_pages(phys_addr, 1);
|
||||
|
||||
Cap_range * range = reinterpret_cast<Cap_range *>(core_local_addr);
|
||||
*range = Cap_range(index);
|
||||
|
@ -25,6 +25,7 @@
|
||||
|
||||
/* core includes */
|
||||
#include <boot_modules.h>
|
||||
#include <core_log.h>
|
||||
#include <platform.h>
|
||||
#include <platform_thread.h>
|
||||
#include <platform_pd.h>
|
||||
@ -192,6 +193,29 @@ Platform::Platform() :
|
||||
core_thread->set_l4_thread_id(Okl4::L4_rootserver);
|
||||
|
||||
_core_pd->bind_thread(core_thread);
|
||||
|
||||
/* core log as ROM module */
|
||||
{
|
||||
void * core_local_ptr = nullptr;
|
||||
void * phys_ptr = nullptr;
|
||||
unsigned const pages = 1;
|
||||
size_t const log_size = pages << get_page_size_log2();
|
||||
|
||||
ram_alloc()->alloc_aligned(log_size, &phys_ptr, get_page_size_log2());
|
||||
addr_t const phys_addr = reinterpret_cast<addr_t>(phys_ptr);
|
||||
|
||||
/* let one page free after the log buffer */
|
||||
region_alloc()->alloc_aligned(log_size, &core_local_ptr, get_page_size_log2());
|
||||
addr_t const core_local_addr = reinterpret_cast<addr_t>(core_local_ptr);
|
||||
|
||||
map_local(phys_addr, core_local_addr, pages);
|
||||
memset(core_local_ptr, 0, log_size);
|
||||
|
||||
_rom_fs.insert(new (core_mem_alloc()) Rom_module(phys_addr, log_size,
|
||||
"core_log"));
|
||||
|
||||
init_core_log(Core_log_range { core_local_addr, log_size } );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -26,6 +26,7 @@
|
||||
|
||||
/* core includes */
|
||||
#include <boot_modules.h>
|
||||
#include <core_log.h>
|
||||
#include <map_local.h>
|
||||
#include <platform.h>
|
||||
#include <platform_thread.h>
|
||||
@ -633,6 +634,29 @@ Platform::Platform() :
|
||||
core_thread.pager(sigma0());
|
||||
|
||||
core_pd()->bind_thread(&core_thread);
|
||||
|
||||
/* core log as ROM module */
|
||||
{
|
||||
void * phys_ptr = nullptr;
|
||||
unsigned const pages = 1;
|
||||
size_t const log_size = pages << get_page_size_log2();
|
||||
|
||||
ram_alloc()->alloc_aligned(log_size, &phys_ptr, get_page_size_log2());
|
||||
addr_t const phys_addr = reinterpret_cast<addr_t>(phys_ptr);
|
||||
|
||||
void * const core_local_ptr = phys_ptr;
|
||||
addr_t const core_local_addr = phys_addr;
|
||||
|
||||
/* let one page free after the log buffer */
|
||||
region_alloc()->remove_range(core_local_addr, log_size + get_page_size());
|
||||
|
||||
memset(core_local_ptr, 0, log_size);
|
||||
|
||||
_rom_fs.insert(new (core_mem_alloc()) Rom_module(phys_addr, log_size,
|
||||
"core_log"));
|
||||
|
||||
init_core_log(Core_log_range { core_local_addr, log_size } );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -20,6 +20,7 @@
|
||||
|
||||
/* core includes */
|
||||
#include <boot_modules.h>
|
||||
#include <core_log.h>
|
||||
#include <platform.h>
|
||||
#include <map_local.h>
|
||||
#include <cnode.h>
|
||||
@ -360,7 +361,7 @@ void Platform::_init_rom_modules()
|
||||
addr_t const phys_addr = Untyped_memory::alloc_page(*ram_alloc());
|
||||
Untyped_memory::convert_to_page_frames(phys_addr, pages);
|
||||
|
||||
if (!region_alloc()->alloc(rom_size, &virt_ptr)) {
|
||||
if (region_alloc()->alloc_aligned(rom_size, &virt_ptr, get_page_size_log2()).error()) {
|
||||
error("could not setup platform_info ROM - region allocation error");
|
||||
Untyped_memory::free_page(*ram_alloc(), phys_addr);
|
||||
return;
|
||||
@ -526,7 +527,7 @@ Platform::Platform()
|
||||
/* add some minor virtual region for dynamic usage by core */
|
||||
addr_t const virt_size = 32 * 1024 * 1024;
|
||||
void * virt_ptr = nullptr;
|
||||
if (_unused_virt_alloc.alloc(virt_size, &virt_ptr)) {
|
||||
if (_unused_virt_alloc.alloc_aligned(virt_size, &virt_ptr, get_page_size_log2()).ok()) {
|
||||
|
||||
addr_t const virt_addr = (addr_t)virt_ptr;
|
||||
|
||||
@ -585,6 +586,28 @@ Platform::Platform()
|
||||
/* I/O port allocator (only meaningful for x86) */
|
||||
_io_port_alloc.add_range(0, 0x10000);
|
||||
|
||||
/* core log as ROM module */
|
||||
{
|
||||
void * core_local_ptr = nullptr;
|
||||
unsigned const pages = 1;
|
||||
size_t const log_size = pages << get_page_size_log2();
|
||||
|
||||
addr_t const phys_addr = Untyped_memory::alloc_page(*ram_alloc());
|
||||
Untyped_memory::convert_to_page_frames(phys_addr, pages);
|
||||
|
||||
/* let one page free after the log buffer */
|
||||
region_alloc()->alloc_aligned(log_size + get_page_size(), &core_local_ptr, get_page_size_log2());
|
||||
addr_t const core_local_addr = reinterpret_cast<addr_t>(core_local_ptr);
|
||||
|
||||
map_local(phys_addr, core_local_addr, pages, this);
|
||||
memset(core_local_ptr, 0, log_size);
|
||||
|
||||
_rom_fs.insert(new (core_mem_alloc()) Rom_module(phys_addr, log_size,
|
||||
"core_log"));
|
||||
|
||||
init_core_log(Core_log_range { core_local_addr, log_size } );
|
||||
}
|
||||
|
||||
/*
|
||||
* Log statistics about allocator initialization
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user