mirror of
https://github.com/genodelabs/genode.git
synced 2025-06-21 00:23:16 +00:00
committed by
Christian Helmuth
parent
ec700e88f7
commit
c99fb2b69b
@ -351,9 +351,6 @@ void Platform::_setup_basics()
|
|||||||
{
|
{
|
||||||
l4_kernel_info_t * kip = get_kip();
|
l4_kernel_info_t * kip = get_kip();
|
||||||
|
|
||||||
/* add KIP as ROM module */
|
|
||||||
_rom_fs.insert(&_kip_rom);
|
|
||||||
|
|
||||||
/* parse memory descriptors - look for virtual memory configuration */
|
/* parse memory descriptors - look for virtual memory configuration */
|
||||||
/* XXX we support only one VM region (here and also inside RM) */
|
/* XXX we support only one VM region (here and also inside RM) */
|
||||||
using L4::Kip::Mem_desc;
|
using L4::Kip::Mem_desc;
|
||||||
@ -405,7 +402,7 @@ Platform::Platform()
|
|||||||
_ram_alloc(nullptr), _io_mem_alloc(&core_mem_alloc()),
|
_ram_alloc(nullptr), _io_mem_alloc(&core_mem_alloc()),
|
||||||
_io_port_alloc(&core_mem_alloc()), _irq_alloc(&core_mem_alloc()),
|
_io_port_alloc(&core_mem_alloc()), _irq_alloc(&core_mem_alloc()),
|
||||||
_region_alloc(&core_mem_alloc()),
|
_region_alloc(&core_mem_alloc()),
|
||||||
_kip_rom((addr_t)get_kip(), L4_PAGESIZE, "l4v2_kip")
|
_kip_rom(_rom_fs, "l4v2_kip", (addr_t)get_kip(), L4_PAGESIZE)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* We must be single-threaded at this stage and so this is safe.
|
* We must be single-threaded at this stage and so this is safe.
|
||||||
@ -459,8 +456,8 @@ Platform::Platform()
|
|||||||
memset(core_local_ptr, 0, size);
|
memset(core_local_ptr, 0, size);
|
||||||
content_fn(core_local_ptr, size);
|
content_fn(core_local_ptr, size);
|
||||||
|
|
||||||
_rom_fs.insert(new (core_mem_alloc())
|
new (core_mem_alloc())
|
||||||
Rom_module(phys_addr, size, rom_name));
|
Rom_module(_rom_fs, rom_name, phys_addr, size);
|
||||||
},
|
},
|
||||||
[&] (Range_allocator::Alloc_error) {
|
[&] (Range_allocator::Alloc_error) {
|
||||||
warning("failed to export ", rom_name, " as ROM module"); }
|
warning("failed to export ", rom_name, " as ROM module"); }
|
||||||
|
@ -356,9 +356,6 @@ void Platform::_setup_basics()
|
|||||||
log(" magic: ", Hex(kip.magic));
|
log(" magic: ", Hex(kip.magic));
|
||||||
log(" version: ", Hex(kip.version));
|
log(" version: ", Hex(kip.version));
|
||||||
|
|
||||||
/* add KIP as ROM module */
|
|
||||||
_rom_fs.insert(&_kip_rom);
|
|
||||||
|
|
||||||
/* update multi-boot info pointer from KIP */
|
/* update multi-boot info pointer from KIP */
|
||||||
addr_t const mb_info_addr = kip.user_ptr;
|
addr_t const mb_info_addr = kip.user_ptr;
|
||||||
log("MBI @ ", Hex(mb_info_addr));
|
log("MBI @ ", Hex(mb_info_addr));
|
||||||
@ -423,7 +420,7 @@ Platform::Platform()
|
|||||||
_ram_alloc(nullptr), _io_mem_alloc(&core_mem_alloc()),
|
_ram_alloc(nullptr), _io_mem_alloc(&core_mem_alloc()),
|
||||||
_io_port_alloc(&core_mem_alloc()), _irq_alloc(&core_mem_alloc()),
|
_io_port_alloc(&core_mem_alloc()), _irq_alloc(&core_mem_alloc()),
|
||||||
_region_alloc(&core_mem_alloc()), _cap_id_alloc(core_mem_alloc()),
|
_region_alloc(&core_mem_alloc()), _cap_id_alloc(core_mem_alloc()),
|
||||||
_kip_rom((addr_t)&sigma0_map_kip(), L4_PAGESIZE, "l4v2_kip"),
|
_kip_rom(_rom_fs, "l4v2_kip", (addr_t)&sigma0_map_kip(), L4_PAGESIZE),
|
||||||
_sigma0(cap_map().insert(_cap_id_alloc.alloc(), Foc::L4_BASE_PAGER_CAP))
|
_sigma0(cap_map().insert(_cap_id_alloc.alloc(), Foc::L4_BASE_PAGER_CAP))
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
@ -491,8 +488,8 @@ Platform::Platform()
|
|||||||
memset(core_local_ptr, 0, bytes);
|
memset(core_local_ptr, 0, bytes);
|
||||||
content_fn((char *)core_local_ptr, bytes);
|
content_fn((char *)core_local_ptr, bytes);
|
||||||
|
|
||||||
_rom_fs.insert(new (core_mem_alloc())
|
new (core_mem_alloc())
|
||||||
Rom_module(phys_addr, bytes, rom_name));
|
Rom_module(_rom_fs, rom_name, phys_addr, bytes);
|
||||||
},
|
},
|
||||||
[&] (Range_allocator::Alloc_error) {
|
[&] (Range_allocator::Alloc_error) {
|
||||||
warning("failed allocate virtual memory to export ",
|
warning("failed allocate virtual memory to export ",
|
||||||
|
@ -173,8 +173,7 @@ void Platform::_init_platform_info()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_rom_fs.insert(
|
new (core_mem_alloc()) Rom_module(_rom_fs, rom_name, phys_addr, rom_size);
|
||||||
new (core_mem_alloc()) Rom_module(phys_addr, rom_size, rom_name));
|
|
||||||
|
|
||||||
/* keep phys allocation but let guard revert virt allocation */
|
/* keep phys allocation but let guard revert virt allocation */
|
||||||
guard.phys_ptr = nullptr;
|
guard.phys_ptr = nullptr;
|
||||||
@ -237,8 +236,8 @@ Platform::Platform()
|
|||||||
map_local(phys_addr, (addr_t)ptr, pages);
|
map_local(phys_addr, (addr_t)ptr, pages);
|
||||||
memset(ptr, 0, log_size);
|
memset(ptr, 0, log_size);
|
||||||
|
|
||||||
_rom_fs.insert(new (core_mem_alloc())
|
new (core_mem_alloc())
|
||||||
Rom_module(phys_addr, log_size, "core_log"));
|
Rom_module(_rom_fs, "core_log", phys_addr, log_size);
|
||||||
|
|
||||||
init_core_log(Core_log_range { (addr_t)ptr, log_size } );
|
init_core_log(Core_log_range { (addr_t)ptr, log_size } );
|
||||||
},
|
},
|
||||||
|
@ -666,8 +666,8 @@ Platform::Platform()
|
|||||||
memset(core_local_ptr, 0, bytes);
|
memset(core_local_ptr, 0, bytes);
|
||||||
content_fn(core_local_ptr, bytes);
|
content_fn(core_local_ptr, bytes);
|
||||||
|
|
||||||
_rom_fs.insert(new (core_mem_alloc())
|
new (core_mem_alloc())
|
||||||
Rom_module(phys_addr, bytes, rom_name));
|
Rom_module(_rom_fs, rom_name, phys_addr, bytes);
|
||||||
|
|
||||||
/* leave the ROM backing store mapped within core */
|
/* leave the ROM backing store mapped within core */
|
||||||
},
|
},
|
||||||
@ -770,8 +770,8 @@ Platform::Platform()
|
|||||||
|
|
||||||
/* export hypervisor log memory */
|
/* export hypervisor log memory */
|
||||||
if (hyp_log && hyp_log_size)
|
if (hyp_log && hyp_log_size)
|
||||||
_rom_fs.insert(new (core_mem_alloc()) Rom_module(hyp_log, hyp_log_size,
|
new (core_mem_alloc())
|
||||||
"kernel_log"));
|
Rom_module(_rom_fs, "kernel_log", hyp_log, hyp_log_size);
|
||||||
|
|
||||||
if (verbose_boot_info) {
|
if (verbose_boot_info) {
|
||||||
if (hip.has_feature_vmx())
|
if (hip.has_feature_vmx())
|
||||||
|
@ -202,8 +202,8 @@ Platform::Platform()
|
|||||||
map_local(phys_addr, (addr_t)ptr, pages);
|
map_local(phys_addr, (addr_t)ptr, pages);
|
||||||
memset(ptr, 0, log_size);
|
memset(ptr, 0, log_size);
|
||||||
|
|
||||||
_rom_fs.insert(new (core_mem_alloc())
|
new (core_mem_alloc())
|
||||||
Rom_module(phys_addr, log_size, "core_log"));
|
Rom_module(_rom_fs, "core_log", phys_addr, log_size);
|
||||||
|
|
||||||
init_core_log(Core_log_range { (addr_t)ptr, log_size } );
|
init_core_log(Core_log_range { (addr_t)ptr, log_size } );
|
||||||
},
|
},
|
||||||
@ -214,7 +214,7 @@ Platform::Platform()
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* export platform specific infos */
|
/* export platform-specific infos */
|
||||||
{
|
{
|
||||||
unsigned const pages = 1;
|
unsigned const pages = 1;
|
||||||
size_t const size = pages << get_page_size_log2();
|
size_t const size = pages << get_page_size_log2();
|
||||||
@ -237,8 +237,8 @@ Platform::Platform()
|
|||||||
xml.node("kernel", [&] () { xml.attribute("name", "okl4"); });
|
xml.node("kernel", [&] () { xml.attribute("name", "okl4"); });
|
||||||
});
|
});
|
||||||
|
|
||||||
_rom_fs.insert(new (core_mem_alloc()) Rom_module(phys_addr, size,
|
new (core_mem_alloc())
|
||||||
"platform_info"));
|
Rom_module(_rom_fs, "platform_info", phys_addr, size);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[&] (Range_allocator::Alloc_error) { }
|
[&] (Range_allocator::Alloc_error) { }
|
||||||
|
@ -485,9 +485,6 @@ void Platform::_setup_basics()
|
|||||||
|
|
||||||
dump_kip_memdesc(kip);
|
dump_kip_memdesc(kip);
|
||||||
|
|
||||||
/* add KIP as ROM module */
|
|
||||||
_rom_fs.insert(&_kip_rom);
|
|
||||||
|
|
||||||
L4_Fpage_t bipage = L4_Sigma0_GetPage(get_sigma0(),
|
L4_Fpage_t bipage = L4_Sigma0_GetPage(get_sigma0(),
|
||||||
L4_Fpage(kip->BootInfo,
|
L4_Fpage(kip->BootInfo,
|
||||||
get_page_size()));
|
get_page_size()));
|
||||||
@ -571,8 +568,8 @@ Platform::Platform()
|
|||||||
_ram_alloc(nullptr), _io_mem_alloc(&core_mem_alloc()),
|
_ram_alloc(nullptr), _io_mem_alloc(&core_mem_alloc()),
|
||||||
_io_port_alloc(&core_mem_alloc()), _irq_alloc(&core_mem_alloc()),
|
_io_port_alloc(&core_mem_alloc()), _irq_alloc(&core_mem_alloc()),
|
||||||
_region_alloc(&core_mem_alloc()),
|
_region_alloc(&core_mem_alloc()),
|
||||||
_kip_rom((addr_t)Pistachio::get_kip(),
|
_kip_rom(_rom_fs, "pistachio_kip", (addr_t)Pistachio::get_kip(),
|
||||||
sizeof(Pistachio::L4_KernelInterfacePage_t), "pistachio_kip")
|
sizeof(Pistachio::L4_KernelInterfacePage_t))
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* We must be single-threaded at this stage and so this is safe.
|
* We must be single-threaded at this stage and so this is safe.
|
||||||
@ -619,8 +616,8 @@ Platform::Platform()
|
|||||||
memset(core_local_ptr, 0, size);
|
memset(core_local_ptr, 0, size);
|
||||||
content_fn(core_local_ptr, size);
|
content_fn(core_local_ptr, size);
|
||||||
|
|
||||||
_rom_fs.insert(new (core_mem_alloc())
|
new (core_mem_alloc())
|
||||||
Rom_module(phys_addr, size, rom_name));
|
Rom_module(_rom_fs, rom_name, phys_addr, size);
|
||||||
},
|
},
|
||||||
[&] (Range_allocator::Alloc_error) {
|
[&] (Range_allocator::Alloc_error) {
|
||||||
warning("failed to export ", rom_name, " as ROM module"); }
|
warning("failed to export ", rom_name, " as ROM module"); }
|
||||||
|
@ -343,11 +343,9 @@ void Platform::_init_rom_modules()
|
|||||||
* Register ROM module, the base address refers to location of the
|
* Register ROM module, the base address refers to location of the
|
||||||
* ROM module within the phys CNode address space.
|
* ROM module within the phys CNode address space.
|
||||||
*/
|
*/
|
||||||
Rom_module * rom_module = new (rom_module_slab)
|
new (rom_module_slab)
|
||||||
Rom_module(dst_frame << get_page_size_log2(), header->size,
|
Rom_module(_rom_fs, (const char*)header->name,
|
||||||
(const char*)header->name);
|
dst_frame << get_page_size_log2(), header->size);
|
||||||
|
|
||||||
_rom_fs.insert(rom_module);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
auto gen_platform_info = [&] (Xml_generator &xml)
|
auto gen_platform_info = [&] (Xml_generator &xml)
|
||||||
@ -507,8 +505,8 @@ void Platform::_init_rom_modules()
|
|||||||
memset(core_local_ptr, 0, size);
|
memset(core_local_ptr, 0, size);
|
||||||
content_fn((char *)core_local_ptr, size);
|
content_fn((char *)core_local_ptr, size);
|
||||||
|
|
||||||
_rom_fs.insert(
|
new (core_mem_alloc())
|
||||||
new (core_mem_alloc()) Rom_module(phys.addr, size, rom_name));
|
Rom_module(_rom_fs, rom_name, phys.addr, size);
|
||||||
|
|
||||||
phys.keep = true;
|
phys.keep = true;
|
||||||
},
|
},
|
||||||
|
@ -15,49 +15,46 @@
|
|||||||
#ifndef _CORE__INCLUDE__ROM_FS_H_
|
#ifndef _CORE__INCLUDE__ROM_FS_H_
|
||||||
#define _CORE__INCLUDE__ROM_FS_H_
|
#define _CORE__INCLUDE__ROM_FS_H_
|
||||||
|
|
||||||
#include <util/avl_string.h>
|
/* Genode includes */
|
||||||
|
#include <util/dictionary.h>
|
||||||
|
|
||||||
/* core includes */
|
/* core includes */
|
||||||
#include <types.h>
|
#include <types.h>
|
||||||
|
|
||||||
namespace Core {
|
namespace Core {
|
||||||
|
|
||||||
|
using Rom_name = String<64>;
|
||||||
struct Rom_module;
|
struct Rom_module;
|
||||||
struct Rom_fs;
|
struct Rom_fs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
struct Core::Rom_module : Avl_string_base
|
struct Core::Rom_module : Dictionary<Rom_module, Rom_name>::Element
|
||||||
{
|
{
|
||||||
addr_t const addr = 0;
|
addr_t const addr = 0;
|
||||||
size_t const size = 0;
|
size_t const size = 0;
|
||||||
|
|
||||||
Rom_module() : Avl_string_base(nullptr) { }
|
Rom_module(Dictionary<Rom_module, Rom_name> &dict, Rom_name const &name,
|
||||||
|
addr_t addr, size_t size)
|
||||||
Rom_module(addr_t const addr, size_t const size, char const * const name)
|
:
|
||||||
: Avl_string_base(name), addr(addr), size(size) { }
|
Dictionary<Rom_module, Rom_name>::Element(dict, name),
|
||||||
|
addr(addr), size(size)
|
||||||
|
{ }
|
||||||
|
|
||||||
bool valid() const { return size ? true : false; }
|
bool valid() const { return size ? true : false; }
|
||||||
|
|
||||||
void print(Output &out) const {
|
void print(Output &out) const {
|
||||||
Genode::print(out, Hex_range<addr_t>(addr, size), " ", name()); }
|
Genode::print(out, Hex_range<addr_t>(addr, size), " ", name); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
struct Core::Rom_fs : Avl_tree<Avl_string_base>
|
struct Core::Rom_fs : Dictionary<Rom_module, Rom_name>
|
||||||
{
|
{
|
||||||
Rom_module const * find(char const * const name) const
|
|
||||||
{
|
|
||||||
return first() ? (Rom_module const *)first()->find_by_name(name)
|
|
||||||
: nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
void print(Output & out) const
|
void print(Output & out) const
|
||||||
{
|
{
|
||||||
if (!first()) Genode::print(out, "No modules in Rom_fs\n");
|
|
||||||
|
|
||||||
Genode::print(out, "ROM modules:\n");
|
Genode::print(out, "ROM modules:\n");
|
||||||
for_each([&] (Avl_string_base const & rom) {
|
for_each([&] (Rom_module const &rom) {
|
||||||
Genode::print(out, " ROM: ", *static_cast<Rom_module const *>(&rom), "\n"); });
|
Genode::print(out, " ROM: ", rom, "\n"); });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -36,15 +36,13 @@ class Core::Rom_session_component : public Rpc_object<Rom_session>
|
|||||||
|
|
||||||
Rom_module const &_find_rom(Rom_fs &rom_fs, const char *args)
|
Rom_module const &_find_rom(Rom_fs &rom_fs, const char *args)
|
||||||
{
|
{
|
||||||
/* extract label */
|
return rom_fs.with_element(label_from_args(args).last_element(),
|
||||||
Session_label const label = label_from_args(args);
|
|
||||||
|
|
||||||
/* find ROM module for trailing label element */
|
[&] (Rom_module const &rom) -> Rom_module const & {
|
||||||
Rom_module const * rom = rom_fs.find(label.last_element().string());
|
return rom; },
|
||||||
if (rom)
|
|
||||||
return *rom;
|
|
||||||
|
|
||||||
throw Service_denied();
|
[&] () -> Rom_module const & {
|
||||||
|
throw Service_denied(); });
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -20,18 +20,18 @@ using namespace Core;
|
|||||||
|
|
||||||
void Platform::_init_rom_modules()
|
void Platform::_init_rom_modules()
|
||||||
{
|
{
|
||||||
/* add boot modules to ROM FS */
|
Boot_modules_header const *header_ptr = &_boot_modules_headers_begin;
|
||||||
Boot_modules_header *header = &_boot_modules_headers_begin;
|
|
||||||
for (; header < &_boot_modules_headers_end; header++) {
|
|
||||||
|
|
||||||
if (!header->size) {
|
for (; header_ptr < &_boot_modules_headers_end; header_ptr++) {
|
||||||
warning("ignore zero-sized boot module '",
|
|
||||||
Cstring((char const *)header->name), "'");
|
Rom_name const name((char const *)header_ptr->name);
|
||||||
|
|
||||||
|
if (!header_ptr->size) {
|
||||||
|
warning("ignore zero-sized boot module '", name, "'");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
Rom_module &rom_module = *new (core_mem_alloc())
|
new (core_mem_alloc())
|
||||||
Rom_module(_rom_module_phys(header->base), header->size,
|
Rom_module(_rom_fs, name,
|
||||||
(char const *)header->name);
|
_rom_module_phys(header_ptr->base), header_ptr->size);
|
||||||
_rom_fs.insert(&rom_module);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user