mirror of
https://github.com/genodelabs/genode.git
synced 2025-06-18 15:18:20 +00:00
@ -472,8 +472,8 @@ Core::Platform::Platform()
|
|||||||
[&] (void *core_local_ptr, size_t size) {
|
[&] (void *core_local_ptr, size_t size) {
|
||||||
Xml_generator xml(reinterpret_cast<char *>(core_local_ptr),
|
Xml_generator xml(reinterpret_cast<char *>(core_local_ptr),
|
||||||
size, "platform_info",
|
size, "platform_info",
|
||||||
[&] () {
|
[&] {
|
||||||
xml.node("kernel", [&] () {
|
xml.node("kernel", [&] {
|
||||||
xml.attribute("name", "fiasco"); }); }); });
|
xml.attribute("name", "fiasco"); }); }); });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -505,17 +505,17 @@ Core::Platform::Platform()
|
|||||||
|
|
||||||
export_page_as_rom_module("platform_info",
|
export_page_as_rom_module("platform_info",
|
||||||
[&] (char *core_local_ptr, size_t size) {
|
[&] (char *core_local_ptr, size_t size) {
|
||||||
Xml_generator xml(core_local_ptr, size, "platform_info", [&] ()
|
Xml_generator xml(core_local_ptr, size, "platform_info", [&]
|
||||||
{
|
{
|
||||||
xml.node("kernel", [&] () {
|
xml.node("kernel", [&] {
|
||||||
xml.attribute("name", "foc");
|
xml.attribute("name", "foc");
|
||||||
xml.attribute("acpi", true);
|
xml.attribute("acpi", true);
|
||||||
xml.attribute("msi" , true);
|
xml.attribute("msi" , true);
|
||||||
});
|
});
|
||||||
xml.node("hardware", [&] () {
|
xml.node("hardware", [&] {
|
||||||
_setup_platform_info(xml, sigma0_map_kip()); });
|
_setup_platform_info(xml, sigma0_map_kip()); });
|
||||||
|
|
||||||
xml.node("affinity-space", [&] () {
|
xml.node("affinity-space", [&] {
|
||||||
xml.attribute("width", affinity_space().width());
|
xml.attribute("width", affinity_space().width());
|
||||||
xml.attribute("height", affinity_space().height()); });
|
xml.attribute("height", affinity_space().height()); });
|
||||||
});
|
});
|
||||||
|
@ -102,11 +102,11 @@ static bool cpu_name(char const * name)
|
|||||||
void Platform::_setup_platform_info(Xml_generator &xml,
|
void Platform::_setup_platform_info(Xml_generator &xml,
|
||||||
Foc::l4_kernel_info_t &kip)
|
Foc::l4_kernel_info_t &kip)
|
||||||
{
|
{
|
||||||
xml.node("features", [&] () {
|
xml.node("features", [&] {
|
||||||
/* XXX better detection required, best told us by kernel !? */
|
/* XXX better detection required, best told us by kernel !? */
|
||||||
xml.attribute("svm", cpu_name("AuthenticAMD"));
|
xml.attribute("svm", cpu_name("AuthenticAMD"));
|
||||||
xml.attribute("vmx", cpu_name("GenuineIntel")); });
|
xml.attribute("vmx", cpu_name("GenuineIntel")); });
|
||||||
|
|
||||||
xml.node("tsc", [&] () {
|
xml.node("tsc", [&] {
|
||||||
xml.attribute("freq_khz" , kip.frequency_cpu); });
|
xml.attribute("freq_khz" , kip.frequency_cpu); });
|
||||||
}
|
}
|
||||||
|
@ -72,7 +72,7 @@ struct Foc_native_vcpu_rpc : Rpc_client<Vm_session::Native_vcpu>, Noncopyable
|
|||||||
Capability<Vm_session::Native_vcpu> _create_vcpu(Vm_connection &vm,
|
Capability<Vm_session::Native_vcpu> _create_vcpu(Vm_connection &vm,
|
||||||
Thread_capability &cap)
|
Thread_capability &cap)
|
||||||
{
|
{
|
||||||
return vm.with_upgrade([&] () {
|
return vm.with_upgrade([&] {
|
||||||
return vm.call<Vm_session::Rpc_create_vcpu>(cap); });
|
return vm.call<Vm_session::Rpc_create_vcpu>(cap); });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,15 +154,15 @@ void Platform::_init_platform_info()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Xml_generator xml(reinterpret_cast<char *>(virt_addr), rom_size, rom_name, [&] ()
|
Xml_generator xml(reinterpret_cast<char *>(virt_addr), rom_size, rom_name, [&]
|
||||||
{
|
{
|
||||||
xml.node("kernel", [&] () {
|
xml.node("kernel", [&] {
|
||||||
xml.attribute("name", "hw");
|
xml.attribute("name", "hw");
|
||||||
xml.attribute("acpi", true);
|
xml.attribute("acpi", true);
|
||||||
xml.attribute("msi", true);
|
xml.attribute("msi", true);
|
||||||
});
|
});
|
||||||
_init_additional_platform_info(xml);
|
_init_additional_platform_info(xml);
|
||||||
xml.node("affinity-space", [&] () {
|
xml.node("affinity-space", [&] {
|
||||||
xml.attribute("width", affinity_space().width());
|
xml.attribute("width", affinity_space().width());
|
||||||
xml.attribute("height", affinity_space().height());
|
xml.attribute("height", affinity_space().height());
|
||||||
});
|
});
|
||||||
|
@ -24,11 +24,11 @@ using namespace Core;
|
|||||||
void Platform::_init_additional_platform_info(Xml_generator &xml)
|
void Platform::_init_additional_platform_info(Xml_generator &xml)
|
||||||
{
|
{
|
||||||
if (_boot_info().plat_info.efi_system_table != 0) {
|
if (_boot_info().plat_info.efi_system_table != 0) {
|
||||||
xml.node("efi-system-table", [&] () {
|
xml.node("efi-system-table", [&] {
|
||||||
xml.attribute("address", String<32>(Hex(_boot_info().plat_info.efi_system_table)));
|
xml.attribute("address", String<32>(Hex(_boot_info().plat_info.efi_system_table)));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
xml.node("acpi", [&] () {
|
xml.node("acpi", [&] {
|
||||||
uint32_t const revision = _boot_info().plat_info.acpi_rsdp.revision;
|
uint32_t const revision = _boot_info().plat_info.acpi_rsdp.revision;
|
||||||
uint32_t const rsdt = _boot_info().plat_info.acpi_rsdp.rsdt;
|
uint32_t const rsdt = _boot_info().plat_info.acpi_rsdp.rsdt;
|
||||||
uint64_t const xsdt = _boot_info().plat_info.acpi_rsdp.xsdt;
|
uint64_t const xsdt = _boot_info().plat_info.acpi_rsdp.xsdt;
|
||||||
@ -42,8 +42,8 @@ void Platform::_init_additional_platform_info(Xml_generator &xml)
|
|||||||
xml.attribute("xsdt", String<32>(Hex(xsdt)));
|
xml.attribute("xsdt", String<32>(Hex(xsdt)));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
xml.node("boot", [&] () {
|
xml.node("boot", [&] {
|
||||||
xml.node("framebuffer", [&] () {
|
xml.node("framebuffer", [&] {
|
||||||
Hw::Framebuffer const &boot_fb = _boot_info().plat_info.framebuffer;
|
Hw::Framebuffer const &boot_fb = _boot_info().plat_info.framebuffer;
|
||||||
xml.attribute("phys", String<32>(Hex(boot_fb.addr)));
|
xml.attribute("phys", String<32>(Hex(boot_fb.addr)));
|
||||||
xml.attribute("width", boot_fb.width);
|
xml.attribute("width", boot_fb.width);
|
||||||
@ -53,12 +53,12 @@ void Platform::_init_additional_platform_info(Xml_generator &xml)
|
|||||||
xml.attribute("pitch", boot_fb.pitch);
|
xml.attribute("pitch", boot_fb.pitch);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
xml.node("hardware", [&]() {
|
xml.node("hardware", [&] {
|
||||||
xml.node("features", [&] () {
|
xml.node("features", [&] {
|
||||||
xml.attribute("svm", Hw::Virtualization_support::has_svm());
|
xml.attribute("svm", Hw::Virtualization_support::has_svm());
|
||||||
xml.attribute("vmx", Hw::Virtualization_support::has_vmx());
|
xml.attribute("vmx", Hw::Virtualization_support::has_vmx());
|
||||||
});
|
});
|
||||||
xml.node("tsc", [&]() {
|
xml.node("tsc", [&] {
|
||||||
xml.attribute("invariant", Hw::Lapic::invariant_tsc());
|
xml.attribute("invariant", Hw::Lapic::invariant_tsc());
|
||||||
xml.attribute("freq_khz", Hw::Lapic::tsc_freq());
|
xml.attribute("freq_khz", Hw::Lapic::tsc_freq());
|
||||||
});
|
});
|
||||||
|
@ -56,15 +56,15 @@ void Genode::upgrade_capability_slab()
|
|||||||
};
|
};
|
||||||
|
|
||||||
retry<Genode::Out_of_caps>(
|
retry<Genode::Out_of_caps>(
|
||||||
[&] () {
|
[&] {
|
||||||
retry<Genode::Out_of_ram>(
|
retry<Genode::Out_of_ram>(
|
||||||
[&] () {
|
[&] {
|
||||||
native_pd_ptr->upgrade_cap_slab(); },
|
native_pd_ptr->upgrade_cap_slab(); },
|
||||||
[&] () {
|
[&] {
|
||||||
request_resources_from_parent(Ram_quota{8192}, Cap_quota{0});
|
request_resources_from_parent(Ram_quota{8192}, Cap_quota{0});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
[&] () {
|
[&] {
|
||||||
request_resources_from_parent(Ram_quota{0}, Cap_quota{2});
|
request_resources_from_parent(Ram_quota{0}, Cap_quota{2});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,7 @@ struct Hw_vcpu : Rpc_client<Vm_session::Native_vcpu>, Noncopyable
|
|||||||
Hw_vcpu::Hw_vcpu(Env &env, Vm_connection &vm, Vcpu_handler_base &handler)
|
Hw_vcpu::Hw_vcpu(Env &env, Vm_connection &vm, Vcpu_handler_base &handler)
|
||||||
:
|
:
|
||||||
Rpc_client<Native_vcpu>(_create_vcpu(vm, handler)),
|
Rpc_client<Native_vcpu>(_create_vcpu(vm, handler)),
|
||||||
_state(env.rm(), vm.with_upgrade([&] () { return call<Rpc_state>(); }))
|
_state(env.rm(), vm.with_upgrade([&] { return call<Rpc_state>(); }))
|
||||||
{
|
{
|
||||||
_ep_handler = reinterpret_cast<Thread *>(&handler.rpc_ep());
|
_ep_handler = reinterpret_cast<Thread *>(&handler.rpc_ep());
|
||||||
call<Rpc_exception_handler>(handler.signal_cap());
|
call<Rpc_exception_handler>(handler.signal_cap());
|
||||||
@ -90,7 +90,7 @@ Capability<Vm_session::Native_vcpu> Hw_vcpu::_create_vcpu(Vm_connection &vm,
|
|||||||
{
|
{
|
||||||
Thread &tep { *reinterpret_cast<Thread *>(&handler.rpc_ep()) };
|
Thread &tep { *reinterpret_cast<Thread *>(&handler.rpc_ep()) };
|
||||||
|
|
||||||
return vm.with_upgrade([&] () {
|
return vm.with_upgrade([&] {
|
||||||
return vm.call<Vm_session::Rpc_create_vcpu>(tep.cap()); });
|
return vm.call<Vm_session::Rpc_create_vcpu>(tep.cap()); });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ struct Hw_vcpu : Rpc_client<Vm_session::Native_vcpu>, Noncopyable
|
|||||||
Hw_vcpu::Hw_vcpu(Env &env, Vm_connection &vm, Vcpu_handler_base &handler)
|
Hw_vcpu::Hw_vcpu(Env &env, Vm_connection &vm, Vcpu_handler_base &handler)
|
||||||
:
|
:
|
||||||
Rpc_client<Native_vcpu>(_create_vcpu(vm, handler)),
|
Rpc_client<Native_vcpu>(_create_vcpu(vm, handler)),
|
||||||
_state(env.rm(), vm.with_upgrade([&] () { return call<Rpc_state>(); })),
|
_state(env.rm(), vm.with_upgrade([&] { return call<Rpc_state>(); })),
|
||||||
_vcpu_handler(handler)
|
_vcpu_handler(handler)
|
||||||
{
|
{
|
||||||
static unsigned counter = 0;
|
static unsigned counter = 0;
|
||||||
@ -102,7 +102,7 @@ Capability<Vm_session::Native_vcpu> Hw_vcpu::_create_vcpu(Vm_connection &vm,
|
|||||||
{
|
{
|
||||||
Thread &tep { *reinterpret_cast<Thread *>(&handler.rpc_ep()) };
|
Thread &tep { *reinterpret_cast<Thread *>(&handler.rpc_ep()) };
|
||||||
|
|
||||||
return vm.with_upgrade([&] () {
|
return vm.with_upgrade([&] {
|
||||||
return vm.call<Vm_session::Rpc_create_vcpu>(tep.cap()); });
|
return vm.call<Vm_session::Rpc_create_vcpu>(tep.cap()); });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -195,7 +195,7 @@ Native_capability Native_thread::Epoll::alloc_rpc_cap()
|
|||||||
|
|
||||||
dst.foreign = false;
|
dst.foreign = false;
|
||||||
|
|
||||||
_exec_control([&] () { _add(socketpair.local); });
|
_exec_control([&] { _add(socketpair.local); });
|
||||||
|
|
||||||
return Capability_space::import(dst, Rpc_obj_key(socketpair.local.value));
|
return Capability_space::import(dst, Rpc_obj_key(socketpair.local.value));
|
||||||
}
|
}
|
||||||
@ -205,5 +205,5 @@ void Native_thread::Epoll::free_rpc_cap(Native_capability cap)
|
|||||||
{
|
{
|
||||||
int const local_socket = (int)Capability_space::ipc_cap_data(cap).rpc_obj_key.value();
|
int const local_socket = (int)Capability_space::ipc_cap_data(cap).rpc_obj_key.value();
|
||||||
|
|
||||||
_exec_control([&] () { _remove(Lx_sd{local_socket}); });
|
_exec_control([&] { _remove(Lx_sd{local_socket}); });
|
||||||
}
|
}
|
||||||
|
@ -244,7 +244,7 @@ inline Nova::uint8_t async_map(Core::Pager_object &pager,
|
|||||||
(void)ok;
|
(void)ok;
|
||||||
|
|
||||||
return syscall_retry(pager,
|
return syscall_retry(pager,
|
||||||
[&]() {
|
[&] {
|
||||||
return Nova::delegate(source_pd, target_pd, target_initial_caps);
|
return Nova::delegate(source_pd, target_pd, target_initial_caps);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -281,7 +281,7 @@ bool Pager_object::_migrate_thread()
|
|||||||
|
|
||||||
/* syscall to migrate */
|
/* syscall to migrate */
|
||||||
unsigned const migrate_to = platform_specific().kernel_cpu_id(_location);
|
unsigned const migrate_to = platform_specific().kernel_cpu_id(_location);
|
||||||
uint8_t res = syscall_retry(*this, [&]() {
|
uint8_t res = syscall_retry(*this, [&] {
|
||||||
return ec_ctrl(EC_MIGRATE, _state.sel_client_ec, migrate_to,
|
return ec_ctrl(EC_MIGRATE, _state.sel_client_ec, migrate_to,
|
||||||
Obj_crd(EC_SEL_THREAD, 0, Obj_crd::RIGHT_EC_RECALL));
|
Obj_crd(EC_SEL_THREAD, 0, Obj_crd::RIGHT_EC_RECALL));
|
||||||
});
|
});
|
||||||
@ -553,7 +553,7 @@ static uint8_t create_portal(addr_t pt, addr_t pd, addr_t ec, Mtd mtd,
|
|||||||
addr_t eip, Pager_object * oom_handler)
|
addr_t eip, Pager_object * oom_handler)
|
||||||
{
|
{
|
||||||
uint8_t res = syscall_retry(*oom_handler,
|
uint8_t res = syscall_retry(*oom_handler,
|
||||||
[&]() { return create_pt(pt, pd, ec, mtd, eip); });
|
[&] { return create_pt(pt, pd, ec, mtd, eip); });
|
||||||
|
|
||||||
if (res != NOVA_OK)
|
if (res != NOVA_OK)
|
||||||
return res;
|
return res;
|
||||||
|
@ -36,7 +36,7 @@ inline Nova::uint8_t retry_syscall(addr_t pd_sel, auto const &fn)
|
|||||||
|
|
||||||
bool Pd_session_component::assign_pci(addr_t pci_config_memory, uint16_t bdf)
|
bool Pd_session_component::assign_pci(addr_t pci_config_memory, uint16_t bdf)
|
||||||
{
|
{
|
||||||
return retry_syscall(_pd->pd_sel(), [&]() {
|
return retry_syscall(_pd->pd_sel(), [&] {
|
||||||
return Nova::assign_pci(_pd->pd_sel(), pci_config_memory, bdf);
|
return Nova::assign_pci(_pd->pd_sel(), pci_config_memory, bdf);
|
||||||
}) == Nova::NOVA_OK;
|
}) == Nova::NOVA_OK;
|
||||||
}
|
}
|
||||||
@ -52,7 +52,7 @@ Pd_session::Map_result Pd_session_component::map(Pd_session::Virt_range const vi
|
|||||||
auto map_memory = [&] (Mapping const &mapping)
|
auto map_memory = [&] (Mapping const &mapping)
|
||||||
{
|
{
|
||||||
/* asynchronously map memory */
|
/* asynchronously map memory */
|
||||||
uint8_t err = retry_syscall(_pd->pd_sel(), [&]() {
|
uint8_t err = retry_syscall(_pd->pd_sel(), [&] {
|
||||||
utcb.set_msg_word(0);
|
utcb.set_msg_word(0);
|
||||||
|
|
||||||
bool res = utcb.append_item(nova_src_crd(mapping), 0, true, false,
|
bool res = utcb.append_item(nova_src_crd(mapping), 0, true, false,
|
||||||
|
@ -679,20 +679,20 @@ Core::Platform::Platform()
|
|||||||
|
|
||||||
export_pages_as_rom_module("platform_info", 1 + (MAX_SUPPORTED_CPUS / 32),
|
export_pages_as_rom_module("platform_info", 1 + (MAX_SUPPORTED_CPUS / 32),
|
||||||
[&] (char * const ptr, size_t const size) {
|
[&] (char * const ptr, size_t const size) {
|
||||||
Xml_generator xml(ptr, size, "platform_info", [&] ()
|
Xml_generator xml(ptr, size, "platform_info", [&]
|
||||||
{
|
{
|
||||||
xml.node("kernel", [&] () {
|
xml.node("kernel", [&] {
|
||||||
xml.attribute("name", "nova");
|
xml.attribute("name", "nova");
|
||||||
xml.attribute("acpi", true);
|
xml.attribute("acpi", true);
|
||||||
xml.attribute("msi" , true);
|
xml.attribute("msi" , true);
|
||||||
xml.attribute("iommu", hip.has_feature_iommu());
|
xml.attribute("iommu", hip.has_feature_iommu());
|
||||||
});
|
});
|
||||||
if (efi_sys_tab_phy) {
|
if (efi_sys_tab_phy) {
|
||||||
xml.node("efi-system-table", [&] () {
|
xml.node("efi-system-table", [&] {
|
||||||
xml.attribute("address", String<32>(Hex(efi_sys_tab_phy)));
|
xml.attribute("address", String<32>(Hex(efi_sys_tab_phy)));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
xml.node("acpi", [&] () {
|
xml.node("acpi", [&] {
|
||||||
|
|
||||||
xml.attribute("revision", 2); /* XXX */
|
xml.attribute("revision", 2); /* XXX */
|
||||||
|
|
||||||
@ -702,18 +702,18 @@ Core::Platform::Platform()
|
|||||||
if (xsdt)
|
if (xsdt)
|
||||||
xml.attribute("xsdt", String<32>(Hex(xsdt)));
|
xml.attribute("xsdt", String<32>(Hex(xsdt)));
|
||||||
});
|
});
|
||||||
xml.node("affinity-space", [&] () {
|
xml.node("affinity-space", [&] {
|
||||||
xml.attribute("width", _cpus.width());
|
xml.attribute("width", _cpus.width());
|
||||||
xml.attribute("height", _cpus.height());
|
xml.attribute("height", _cpus.height());
|
||||||
});
|
});
|
||||||
xml.node("boot", [&] () {
|
xml.node("boot", [&] {
|
||||||
if (!boot_fb)
|
if (!boot_fb)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!efi_boot && (Resolution::Type::get(boot_fb->size) != Resolution::Type::VGA_TEXT))
|
if (!efi_boot && (Resolution::Type::get(boot_fb->size) != Resolution::Type::VGA_TEXT))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
xml.node("framebuffer", [&] () {
|
xml.node("framebuffer", [&] {
|
||||||
xml.attribute("phys", String<32>(Hex(boot_fb->addr)));
|
xml.attribute("phys", String<32>(Hex(boot_fb->addr)));
|
||||||
xml.attribute("width", Resolution::Width::get(boot_fb->size));
|
xml.attribute("width", Resolution::Width::get(boot_fb->size));
|
||||||
xml.attribute("height", Resolution::Height::get(boot_fb->size));
|
xml.attribute("height", Resolution::Height::get(boot_fb->size));
|
||||||
@ -722,16 +722,16 @@ Core::Platform::Platform()
|
|||||||
xml.attribute("pitch", boot_fb->aux);
|
xml.attribute("pitch", boot_fb->aux);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
xml.node("hardware", [&] () {
|
xml.node("hardware", [&] {
|
||||||
xml.node("features", [&] () {
|
xml.node("features", [&] {
|
||||||
xml.attribute("svm", hip.has_feature_svm());
|
xml.attribute("svm", hip.has_feature_svm());
|
||||||
xml.attribute("vmx", hip.has_feature_vmx());
|
xml.attribute("vmx", hip.has_feature_vmx());
|
||||||
});
|
});
|
||||||
xml.node("tsc", [&] () {
|
xml.node("tsc", [&] {
|
||||||
xml.attribute("invariant", cpuid_invariant_tsc());
|
xml.attribute("invariant", cpuid_invariant_tsc());
|
||||||
xml.attribute("freq_khz" , hip.tsc_freq);
|
xml.attribute("freq_khz" , hip.tsc_freq);
|
||||||
});
|
});
|
||||||
xml.node("cpus", [&] () {
|
xml.node("cpus", [&] {
|
||||||
for_each_location([&](Affinity::Location &location) {
|
for_each_location([&](Affinity::Location &location) {
|
||||||
unsigned const kernel_cpu_id = Platform::kernel_cpu_id(location);
|
unsigned const kernel_cpu_id = Platform::kernel_cpu_id(location);
|
||||||
auto const cpu_ptr = hip.cpu_desc_of_cpu(kernel_cpu_id);
|
auto const cpu_ptr = hip.cpu_desc_of_cpu(kernel_cpu_id);
|
||||||
@ -741,7 +741,7 @@ Core::Platform::Platform()
|
|||||||
|
|
||||||
auto const &cpu = *cpu_ptr;
|
auto const &cpu = *cpu_ptr;
|
||||||
|
|
||||||
xml.node("cpu", [&] () {
|
xml.node("cpu", [&] {
|
||||||
xml.attribute("xpos", location.xpos());
|
xml.attribute("xpos", location.xpos());
|
||||||
xml.attribute("ypos", location.ypos());
|
xml.attribute("ypos", location.ypos());
|
||||||
xml.attribute("id", kernel_cpu_id);
|
xml.attribute("id", kernel_cpu_id);
|
||||||
|
@ -133,7 +133,7 @@ void Platform_thread::start(void *ip, void *sp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint8_t res = syscall_retry(pager,
|
uint8_t res = syscall_retry(pager,
|
||||||
[&]() {
|
[&] {
|
||||||
return create_ec(_sel_ec(), _pd.pd_sel(), kernel_cpu_id,
|
return create_ec(_sel_ec(), _pd.pd_sel(), kernel_cpu_id,
|
||||||
utcb_addr, initial_sp, _sel_exc_base,
|
utcb_addr, initial_sp, _sel_exc_base,
|
||||||
!worker());
|
!worker());
|
||||||
@ -209,7 +209,7 @@ void Platform_thread::start(void *ip, void *sp)
|
|||||||
|
|
||||||
if (res == NOVA_OK) {
|
if (res == NOVA_OK) {
|
||||||
res = syscall_retry(pager,
|
res = syscall_retry(pager,
|
||||||
[&]() {
|
[&] {
|
||||||
/* let the thread run */
|
/* let the thread run */
|
||||||
return create_sc(_sel_sc(), _pd.pd_sel(), _sel_ec(),
|
return create_sc(_sel_sc(), _pd.pd_sel(), _sel_ec(),
|
||||||
Qpd(Qpd::DEFAULT_QUANTUM, _priority));
|
Qpd(Qpd::DEFAULT_QUANTUM, _priority));
|
||||||
@ -257,7 +257,7 @@ void Platform_thread::resume()
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint8_t res = syscall_retry(*_pager,
|
uint8_t res = syscall_retry(*_pager,
|
||||||
[&]() {
|
[&] {
|
||||||
return create_sc(_sel_sc(), _pd.pd_sel(), _sel_ec(),
|
return create_sc(_sel_sc(), _pd.pd_sel(), _sel_ec(),
|
||||||
Qpd(Qpd::DEFAULT_QUANTUM, _priority));
|
Qpd(Qpd::DEFAULT_QUANTUM, _priority));
|
||||||
});
|
});
|
||||||
|
@ -703,7 +703,7 @@ Capability<Vm_session::Native_vcpu> Nova_vcpu::_create_vcpu(Vm_connection &v
|
|||||||
{
|
{
|
||||||
Thread &tep { *reinterpret_cast<Thread *>(&handler.rpc_ep()) };
|
Thread &tep { *reinterpret_cast<Thread *>(&handler.rpc_ep()) };
|
||||||
|
|
||||||
return vm.with_upgrade([&] () {
|
return vm.with_upgrade([&] {
|
||||||
return vm.call<Vm_session::Rpc_create_vcpu>(tep.cap()); });
|
return vm.call<Vm_session::Rpc_create_vcpu>(tep.cap()); });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -231,8 +231,8 @@ Core::Platform::Platform()
|
|||||||
if (map_local(phys_addr, core_local_addr, pages)) {
|
if (map_local(phys_addr, core_local_addr, pages)) {
|
||||||
|
|
||||||
Xml_generator xml(reinterpret_cast<char *>(core_local_addr),
|
Xml_generator xml(reinterpret_cast<char *>(core_local_addr),
|
||||||
size, "platform_info", [&] () {
|
size, "platform_info", [&] {
|
||||||
xml.node("kernel", [&] () { xml.attribute("name", "okl4"); });
|
xml.node("kernel", [&] { xml.attribute("name", "okl4"); });
|
||||||
});
|
});
|
||||||
|
|
||||||
new (core_mem_alloc())
|
new (core_mem_alloc())
|
||||||
|
@ -60,7 +60,7 @@ addr_t Io_mem_session_component::_map_local(addr_t base, size_t size)
|
|||||||
{
|
{
|
||||||
using namespace Pistachio;
|
using namespace Pistachio;
|
||||||
|
|
||||||
auto alloc_virt_range = [&] ()
|
auto alloc_virt_range = [&]
|
||||||
{
|
{
|
||||||
/* special case for the null page */
|
/* special case for the null page */
|
||||||
if (is_conventional_memory(base))
|
if (is_conventional_memory(base))
|
||||||
|
@ -630,8 +630,8 @@ Core::Platform::Platform()
|
|||||||
[&] (void *core_local_ptr, size_t size) {
|
[&] (void *core_local_ptr, size_t size) {
|
||||||
Xml_generator xml(reinterpret_cast<char *>(core_local_ptr),
|
Xml_generator xml(reinterpret_cast<char *>(core_local_ptr),
|
||||||
size, "platform_info",
|
size, "platform_info",
|
||||||
[&] () {
|
[&] {
|
||||||
xml.node("kernel", [&] () {
|
xml.node("kernel", [&] {
|
||||||
xml.attribute("name", "pistachio"); }); }); });
|
xml.attribute("name", "pistachio"); }); }); });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -377,23 +377,23 @@ void Core::Platform::_init_rom_modules()
|
|||||||
|
|
||||||
tsc_freq const * boot_freq = reinterpret_cast<tsc_freq const *>(reinterpret_cast<addr_t>(element) + sizeof(* element));
|
tsc_freq const * boot_freq = reinterpret_cast<tsc_freq const *>(reinterpret_cast<addr_t>(element) + sizeof(* element));
|
||||||
|
|
||||||
xml.node("kernel", [&] () {
|
xml.node("kernel", [&] {
|
||||||
xml.attribute("name", "sel4");
|
xml.attribute("name", "sel4");
|
||||||
xml.attribute("acpi", true);
|
xml.attribute("acpi", true);
|
||||||
});
|
});
|
||||||
xml.node("hardware", [&] () {
|
xml.node("hardware", [&] {
|
||||||
xml.node("features", [&] () {
|
xml.node("features", [&] {
|
||||||
#ifdef CONFIG_VTX
|
#ifdef CONFIG_VTX
|
||||||
xml.attribute("vmx", true);
|
xml.attribute("vmx", true);
|
||||||
#else
|
#else
|
||||||
xml.attribute("vmx", false);
|
xml.attribute("vmx", false);
|
||||||
#endif
|
#endif
|
||||||
});
|
});
|
||||||
xml.node("tsc", [&] () {
|
xml.node("tsc", [&] {
|
||||||
xml.attribute("freq_khz" , boot_freq->freq_mhz * 1000UL);
|
xml.attribute("freq_khz" , boot_freq->freq_mhz * 1000UL);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
xml.node("affinity-space", [&] () {
|
xml.node("affinity-space", [&] {
|
||||||
xml.attribute("width", affinity_space().width());
|
xml.attribute("width", affinity_space().width());
|
||||||
xml.attribute("height", affinity_space().height());
|
xml.attribute("height", affinity_space().height());
|
||||||
});
|
});
|
||||||
@ -416,8 +416,8 @@ void Core::Platform::_init_rom_modules()
|
|||||||
|
|
||||||
mbi2_framebuffer const * boot_fb = reinterpret_cast<mbi2_framebuffer const *>(reinterpret_cast<addr_t>(element) + sizeof(*element));
|
mbi2_framebuffer const * boot_fb = reinterpret_cast<mbi2_framebuffer const *>(reinterpret_cast<addr_t>(element) + sizeof(*element));
|
||||||
|
|
||||||
xml.node("boot", [&] () {
|
xml.node("boot", [&] {
|
||||||
xml.node("framebuffer", [&] () {
|
xml.node("framebuffer", [&] {
|
||||||
xml.attribute("phys", String<32>(Hex(boot_fb->addr)));
|
xml.attribute("phys", String<32>(Hex(boot_fb->addr)));
|
||||||
xml.attribute("width", boot_fb->width);
|
xml.attribute("width", boot_fb->width);
|
||||||
xml.attribute("height", boot_fb->height);
|
xml.attribute("height", boot_fb->height);
|
||||||
@ -431,7 +431,7 @@ void Core::Platform::_init_rom_modules()
|
|||||||
if (element->id != SEL4_BOOTINFO_HEADER_X86_ACPI_RSDP)
|
if (element->id != SEL4_BOOTINFO_HEADER_X86_ACPI_RSDP)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
xml.node("acpi", [&] () {
|
xml.node("acpi", [&] {
|
||||||
|
|
||||||
struct Acpi_rsdp
|
struct Acpi_rsdp
|
||||||
{
|
{
|
||||||
@ -520,7 +520,7 @@ void Core::Platform::_init_rom_modules()
|
|||||||
};
|
};
|
||||||
|
|
||||||
export_page_as_rom_module("platform_info", [&] (char *ptr, size_t size) {
|
export_page_as_rom_module("platform_info", [&] (char *ptr, size_t size) {
|
||||||
Xml_generator xml(ptr, size, "platform_info", [&] () {
|
Xml_generator xml(ptr, size, "platform_info", [&] {
|
||||||
gen_platform_info(xml); }); });
|
gen_platform_info(xml); }); });
|
||||||
|
|
||||||
export_page_as_rom_module("core_log", [&] (char *ptr, size_t size) {
|
export_page_as_rom_module("core_log", [&] (char *ptr, size_t size) {
|
||||||
|
@ -208,7 +208,7 @@ Capability<Vm_session::Native_vcpu> Vm_session_component::create_vcpu(Thread_cap
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
/* code to revert partial allocations in case of Out_of_ram/_quota */
|
/* code to revert partial allocations in case of Out_of_ram/_quota */
|
||||||
auto free_up = [&] () { if (vcpu) destroy(_heap, vcpu); };
|
auto free_up = [&] { if (vcpu) destroy(_heap, vcpu); };
|
||||||
|
|
||||||
try {
|
try {
|
||||||
vcpu = new (_heap) Registered<Vcpu>(_vcpus,
|
vcpu = new (_heap) Registered<Vcpu>(_vcpus,
|
||||||
|
@ -49,7 +49,7 @@ struct Sel4_native_rpc : Rpc_client<Vm_session::Native_vcpu>, Noncopyable
|
|||||||
Capability<Vm_session::Native_vcpu> _create_vcpu(Vm_connection &vm,
|
Capability<Vm_session::Native_vcpu> _create_vcpu(Vm_connection &vm,
|
||||||
Thread_capability &cap)
|
Thread_capability &cap)
|
||||||
{
|
{
|
||||||
return vm.with_upgrade([&] () {
|
return vm.with_upgrade([&] {
|
||||||
return vm.call<Vm_session::Rpc_create_vcpu>(cap); });
|
return vm.call<Vm_session::Rpc_create_vcpu>(cap); });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,13 +75,13 @@ class Genode::Connection_base : Noncopyable, Interface
|
|||||||
{
|
{
|
||||||
enum { UPGRADE_ATTEMPTS = ~0U };
|
enum { UPGRADE_ATTEMPTS = ~0U };
|
||||||
return Genode::retry<Out_of_ram>(
|
return Genode::retry<Out_of_ram>(
|
||||||
[&] () {
|
[&] {
|
||||||
return Genode::retry<Out_of_caps>(
|
return Genode::retry<Out_of_caps>(
|
||||||
[&] () { return fn(); },
|
[&] { return fn(); },
|
||||||
[&] () { upgrade_caps(caps.value); },
|
[&] { upgrade_caps(caps.value); },
|
||||||
UPGRADE_ATTEMPTS);
|
UPGRADE_ATTEMPTS);
|
||||||
},
|
},
|
||||||
[&] () { upgrade_ram(ram.value); },
|
[&] { upgrade_ram(ram.value); },
|
||||||
UPGRADE_ATTEMPTS);
|
UPGRADE_ATTEMPTS);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -80,8 +80,8 @@ class Genode::Page_table_allocator
|
|||||||
table.~TABLE();
|
table.~TABLE();
|
||||||
_free((unsigned)(_offset(table) / sizeof(TABLE)));
|
_free((unsigned)(_offset(table) / sizeof(TABLE)));
|
||||||
},
|
},
|
||||||
[&] () {
|
[&] {
|
||||||
Genode::error("Trying to destruct foreign table at ", Genode::Hex(phys_addr));
|
Genode::error("Trying to destruct foreign table at ", Genode::Hex(phys_addr));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -296,7 +296,7 @@ class Genode::Page_directory
|
|||||||
table.insert_translation(vo - (vo & PAGE_MASK), pa, size,
|
table.insert_translation(vo - (vo & PAGE_MASK), pa, size,
|
||||||
flags, alloc, flush, supported_sizes);
|
flags, alloc, flush, supported_sizes);
|
||||||
},
|
},
|
||||||
[&] () {
|
[&] {
|
||||||
error("Unable to get mapped table address for ",
|
error("Unable to get mapped table address for ",
|
||||||
Genode::Hex(Td::Pa::masked(desc)));
|
Genode::Hex(Td::Pa::masked(desc)));
|
||||||
});
|
});
|
||||||
@ -334,7 +334,7 @@ class Genode::Page_directory
|
|||||||
desc = 0;
|
desc = 0;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[&] () {
|
[&] {
|
||||||
error("Unable to get mapped table address for ",
|
error("Unable to get mapped table address for ",
|
||||||
Genode::Hex(table_phys));
|
Genode::Hex(table_phys));
|
||||||
});
|
});
|
||||||
@ -490,7 +490,7 @@ class Genode::Pml4_table
|
|||||||
table.insert_translation(table_vo, pa, size, flags, alloc,
|
table.insert_translation(table_vo, pa, size, flags, alloc,
|
||||||
flush, supported_sizes);
|
flush, supported_sizes);
|
||||||
},
|
},
|
||||||
[&] () {
|
[&] {
|
||||||
error("Unable to get mapped table address for ",
|
error("Unable to get mapped table address for ",
|
||||||
Genode::Hex(table_phys));
|
Genode::Hex(table_phys));
|
||||||
});
|
});
|
||||||
@ -525,7 +525,7 @@ class Genode::Pml4_table
|
|||||||
clflush(&desc);
|
clflush(&desc);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[&] () {
|
[&] {
|
||||||
error("Unable to get mapped table address for ",
|
error("Unable to get mapped table address for ",
|
||||||
Genode::Hex(table_phys));
|
Genode::Hex(table_phys));
|
||||||
});
|
});
|
||||||
|
@ -307,12 +307,12 @@ class Genode::Xml_generator
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void node(char const *name, auto const &fn = [] () { } )
|
void node(char const *name, auto const &fn = [] { } )
|
||||||
{
|
{
|
||||||
Node(*this, name, fn);
|
Node(*this, name, fn);
|
||||||
}
|
}
|
||||||
|
|
||||||
void node(char const *name) { Node(*this, name, [] () { }); }
|
void node(char const *name) { Node(*this, name, [] { }); }
|
||||||
|
|
||||||
void attribute(char const *name, char const *str)
|
void attribute(char const *name, char const *str)
|
||||||
{
|
{
|
||||||
|
@ -108,12 +108,12 @@ struct Genode::Vm_connection : Connection<Vm_session>, Rpc_client<Vm_session>
|
|||||||
auto with_upgrade(auto const &fn) -> decltype(fn())
|
auto with_upgrade(auto const &fn) -> decltype(fn())
|
||||||
{
|
{
|
||||||
return Genode::retry<Genode::Out_of_ram>(
|
return Genode::retry<Genode::Out_of_ram>(
|
||||||
[&] () {
|
[&] {
|
||||||
return Genode::retry<Genode::Out_of_caps>(
|
return Genode::retry<Genode::Out_of_caps>(
|
||||||
[&] () { return fn(); },
|
[&] { return fn(); },
|
||||||
[&] () { this->upgrade_caps(2); });
|
[&] { this->upgrade_caps(2); });
|
||||||
},
|
},
|
||||||
[&] () { this->upgrade_ram(4096); }
|
[&] { this->upgrade_ram(4096); }
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -124,7 +124,7 @@ struct Genode::Vm_connection : Connection<Vm_session>, Rpc_client<Vm_session>
|
|||||||
|
|
||||||
void attach(Dataspace_capability ds, addr_t vm_addr, Attach_attr attr) override
|
void attach(Dataspace_capability ds, addr_t vm_addr, Attach_attr attr) override
|
||||||
{
|
{
|
||||||
with_upgrade([&] () {
|
with_upgrade([&] {
|
||||||
call<Rpc_attach>(ds, vm_addr, attr); });
|
call<Rpc_attach>(ds, vm_addr, attr); });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -151,15 +151,15 @@ class Genode::Expanding_parent_client : public Parent_client
|
|||||||
using Arg = String<64>;
|
using Arg = String<64>;
|
||||||
|
|
||||||
return retry<Out_of_ram>(
|
return retry<Out_of_ram>(
|
||||||
[&] () {
|
[&] {
|
||||||
return retry<Out_of_caps>(
|
return retry<Out_of_caps>(
|
||||||
[&] () { return Parent_client::upgrade(id, args); },
|
[&] { return Parent_client::upgrade(id, args); },
|
||||||
[&] () {
|
[&] {
|
||||||
Arg cap_arg("cap_quota=", amount.cap_quota);
|
Arg cap_arg("cap_quota=", amount.cap_quota);
|
||||||
resource_request(Resource_args(cap_arg.string()));
|
resource_request(Resource_args(cap_arg.string()));
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
[&] () {
|
[&] {
|
||||||
Arg ram_arg("ram_quota=", amount.ram_quota);
|
Arg ram_arg("ram_quota=", amount.ram_quota);
|
||||||
resource_request(Resource_args(ram_arg.string()));
|
resource_request(Resource_args(ram_arg.string()));
|
||||||
});
|
});
|
||||||
|
@ -195,7 +195,7 @@ bool Allocator_avl_base::_revert_block_ranges(auto const &any_block_fn)
|
|||||||
|
|
||||||
bool Allocator_avl_base::_revert_unused_ranges()
|
bool Allocator_avl_base::_revert_unused_ranges()
|
||||||
{
|
{
|
||||||
return _revert_block_ranges([&] () {
|
return _revert_block_ranges([&] {
|
||||||
return _find_any_unused_block(_addr_tree.first()); });
|
return _find_any_unused_block(_addr_tree.first()); });
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -218,7 +218,7 @@ void Allocator_avl_base::_revert_allocations_and_ranges()
|
|||||||
" at allocator destruction time");
|
" at allocator destruction time");
|
||||||
|
|
||||||
/* destroy all remaining blocks */
|
/* destroy all remaining blocks */
|
||||||
_revert_block_ranges([&] () { return _addr_tree.first(); });
|
_revert_block_ranges([&] { return _addr_tree.first(); });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -63,19 +63,19 @@ void Session_state::generate_session_request(Xml_generator &xml) const
|
|||||||
|
|
||||||
case CREATE_REQUESTED:
|
case CREATE_REQUESTED:
|
||||||
|
|
||||||
xml.node("create", [&] () {
|
xml.node("create", [&] {
|
||||||
xml.attribute("id", id_at_server->id().value);
|
xml.attribute("id", id_at_server->id().value);
|
||||||
xml.attribute("service", _service.name());
|
xml.attribute("service", _service.name());
|
||||||
xml.attribute("label", _label);
|
xml.attribute("label", _label);
|
||||||
xml.node("args", [&] () {
|
xml.node("args", [&] {
|
||||||
xml.append_sanitized(Server_args(*this).string());
|
xml.append_sanitized(Server_args(*this).string());
|
||||||
});
|
});
|
||||||
xml.node("affinity", [&] () {
|
xml.node("affinity", [&] {
|
||||||
xml.node("space", [&] () {
|
xml.node("space", [&] {
|
||||||
xml.attribute("width", _affinity.space().width());
|
xml.attribute("width", _affinity.space().width());
|
||||||
xml.attribute("height", _affinity.space().height());
|
xml.attribute("height", _affinity.space().height());
|
||||||
});
|
});
|
||||||
xml.node("location", [&] () {
|
xml.node("location", [&] {
|
||||||
xml.attribute("xpos", _affinity.location().xpos());
|
xml.attribute("xpos", _affinity.location().xpos());
|
||||||
xml.attribute("ypos", _affinity.location().ypos());
|
xml.attribute("ypos", _affinity.location().ypos());
|
||||||
xml.attribute("width", _affinity.location().width());
|
xml.attribute("width", _affinity.location().width());
|
||||||
@ -87,7 +87,7 @@ void Session_state::generate_session_request(Xml_generator &xml) const
|
|||||||
|
|
||||||
case UPGRADE_REQUESTED:
|
case UPGRADE_REQUESTED:
|
||||||
|
|
||||||
xml.node("upgrade", [&] () {
|
xml.node("upgrade", [&] {
|
||||||
xml.attribute("id", id_at_server->id().value);
|
xml.attribute("id", id_at_server->id().value);
|
||||||
xml.attribute("ram_quota", ram_upgrade.value);
|
xml.attribute("ram_quota", ram_upgrade.value);
|
||||||
xml.attribute("cap_quota", cap_upgrade.value);
|
xml.attribute("cap_quota", cap_upgrade.value);
|
||||||
@ -96,7 +96,7 @@ void Session_state::generate_session_request(Xml_generator &xml) const
|
|||||||
|
|
||||||
case CLOSE_REQUESTED:
|
case CLOSE_REQUESTED:
|
||||||
|
|
||||||
xml.node("close", [&] () {
|
xml.node("close", [&] {
|
||||||
xml.attribute("id", id_at_server->id().value); });
|
xml.attribute("id", id_at_server->id().value); });
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -120,7 +120,7 @@ void Session_state::generate_client_side_info(Xml_generator &xml, Detail detail)
|
|||||||
xml.attribute("caps", String<32>(_donated_cap_quota));
|
xml.attribute("caps", String<32>(_donated_cap_quota));
|
||||||
|
|
||||||
if (detail.args == Detail::ARGS)
|
if (detail.args == Detail::ARGS)
|
||||||
xml.node("args", [&] () { xml.append_sanitized(_args.string()); });
|
xml.node("args", [&] { xml.append_sanitized(_args.string()); });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -110,4 +110,4 @@ char *Trace::Partitioned_buffer::reserve(size_t len)
|
|||||||
|
|
||||||
|
|
||||||
void Trace::Partitioned_buffer::commit(size_t len) {
|
void Trace::Partitioned_buffer::commit(size_t len) {
|
||||||
_producer()._commit(len, [&] () { _switch_producer(); }); }
|
_producer()._commit(len, [&] { _switch_producer(); }); }
|
||||||
|
@ -48,7 +48,7 @@ static void test_exception_during_for_each()
|
|||||||
Registered<Item> second(items, "second");
|
Registered<Item> second(items, "second");
|
||||||
Registered<Item> third (items, "third");
|
Registered<Item> third (items, "third");
|
||||||
|
|
||||||
auto num_items = [&] () {
|
auto num_items = [&] {
|
||||||
unsigned cnt = 0;
|
unsigned cnt = 0;
|
||||||
items.for_each([&] (Item &) { cnt++; });
|
items.for_each([&] (Item &) { cnt++; });
|
||||||
return cnt;
|
return cnt;
|
||||||
|
@ -26,32 +26,32 @@ static size_t fill_buffer_with_xml(char *dst, size_t dst_len)
|
|||||||
xml.attribute("xpos", "27");
|
xml.attribute("xpos", "27");
|
||||||
xml.attribute("ypos", "34");
|
xml.attribute("ypos", "34");
|
||||||
|
|
||||||
xml.node("box", [&]()
|
xml.node("box", [&]
|
||||||
{
|
{
|
||||||
xml.attribute("width", "320");
|
xml.attribute("width", "320");
|
||||||
xml.attribute("height", "240");
|
xml.attribute("height", "240");
|
||||||
});
|
});
|
||||||
xml.node("label", [&] ()
|
xml.node("label", [&]
|
||||||
{
|
{
|
||||||
xml.attribute("name", "a test");
|
xml.attribute("name", "a test");
|
||||||
xml.node("sub_label");
|
xml.node("sub_label");
|
||||||
xml.node("another_sub_label", [&] ()
|
xml.node("another_sub_label", [&]
|
||||||
{
|
{
|
||||||
xml.node("sub_sub_label");
|
xml.node("sub_sub_label");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
xml.node("bool", [&] ()
|
xml.node("bool", [&]
|
||||||
{
|
{
|
||||||
xml.attribute("true", true);
|
xml.attribute("true", true);
|
||||||
xml.attribute("false", false);
|
xml.attribute("false", false);
|
||||||
});
|
});
|
||||||
xml.node("signed", [&] ()
|
xml.node("signed", [&]
|
||||||
{
|
{
|
||||||
xml.attribute("int", -1);
|
xml.attribute("int", -1);
|
||||||
xml.attribute("long", -2L);
|
xml.attribute("long", -2L);
|
||||||
xml.attribute("longlong", -3LL);
|
xml.attribute("longlong", -3LL);
|
||||||
});
|
});
|
||||||
xml.node("unsigned", [&] ()
|
xml.node("unsigned", [&]
|
||||||
{
|
{
|
||||||
xml.attribute("int", 1U);
|
xml.attribute("int", 1U);
|
||||||
xml.attribute("long", 2UL);
|
xml.attribute("long", 2UL);
|
||||||
@ -67,61 +67,61 @@ static size_t xml_with_exceptions(char *dst, size_t dst_len)
|
|||||||
{
|
{
|
||||||
Genode::Xml_generator xml(dst, dst_len, "config", [&]
|
Genode::Xml_generator xml(dst, dst_len, "config", [&]
|
||||||
{
|
{
|
||||||
xml.node("level1", [&] ()
|
xml.node("level1", [&]
|
||||||
{
|
{
|
||||||
xml.node("level2", [&] ()
|
xml.node("level2", [&]
|
||||||
{
|
{
|
||||||
xml.attribute("attr1", 0x87654321ULL);
|
xml.attribute("attr1", 0x87654321ULL);
|
||||||
for (unsigned i=0; i < 3; i++) {
|
for (unsigned i=0; i < 3; i++) {
|
||||||
try {
|
try {
|
||||||
xml.node("level3_exception", [&] ()
|
xml.node("level3_exception", [&]
|
||||||
{
|
{
|
||||||
xml.attribute("attr1", 1234);
|
xml.attribute("attr1", 1234);
|
||||||
xml.attribute("attr2", 4321);
|
xml.attribute("attr2", 4321);
|
||||||
xml.attribute("attr3", 2143);
|
xml.attribute("attr3", 2143);
|
||||||
xml.node("level4_exception", [&] ()
|
xml.node("level4_exception", [&]
|
||||||
{
|
{
|
||||||
xml.attribute("attr1", "Hallo");
|
xml.attribute("attr1", "Hallo");
|
||||||
xml.node("level5_exception_1", [&] ()
|
xml.node("level5_exception_1", [&]
|
||||||
{
|
{
|
||||||
xml.attribute("attr1", true);
|
xml.attribute("attr1", true);
|
||||||
xml.attribute("attr2", false);
|
xml.attribute("attr2", false);
|
||||||
});
|
});
|
||||||
xml.node("level5_exception_2", [&] () { });
|
xml.node("level5_exception_2", [&] { });
|
||||||
throw 10 + i;
|
throw 10 + i;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
} catch (unsigned error) {
|
} catch (unsigned error) {
|
||||||
Genode::log("exception with value ", error, " on level 4 (expected error)");
|
Genode::log("exception with value ", error, " on level 4 (expected error)");
|
||||||
}
|
}
|
||||||
xml.node("level3", [&] ()
|
xml.node("level3", [&]
|
||||||
{
|
{
|
||||||
xml.attribute("attr1", "Hallo");
|
xml.attribute("attr1", "Hallo");
|
||||||
xml.attribute("attr2", 123000 + i);
|
xml.attribute("attr2", 123000 + i);
|
||||||
xml.node("level4_1", [&] () {
|
xml.node("level4_1", [&] {
|
||||||
xml.attribute("attr1", true);
|
xml.attribute("attr1", true);
|
||||||
xml.attribute("attr2", "Welt");
|
xml.attribute("attr2", "Welt");
|
||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
xml.node("level4_exception", [&] ()
|
xml.node("level4_exception", [&]
|
||||||
{
|
{
|
||||||
xml.attribute("attr1", "Welt");
|
xml.attribute("attr1", "Welt");
|
||||||
xml.attribute("attr2", 2143);
|
xml.attribute("attr2", 2143);
|
||||||
xml.attribute("attr3", false);
|
xml.attribute("attr3", false);
|
||||||
xml.attribute("attr3", 0x12345678ULL);
|
xml.attribute("attr3", 0x12345678ULL);
|
||||||
xml.node("level5_exception_1", [&] () { });
|
xml.node("level5_exception_1", [&] { });
|
||||||
xml.node("level5_exception_2", [&] () { });
|
xml.node("level5_exception_2", [&] { });
|
||||||
xml.node("level5_exception_3", [&] ()
|
xml.node("level5_exception_3", [&]
|
||||||
{
|
{
|
||||||
xml.node("level6_exception", [&] ()
|
xml.node("level6_exception", [&]
|
||||||
{
|
{
|
||||||
xml.attribute("attr1", 0x12345678ULL);
|
xml.attribute("attr1", 0x12345678ULL);
|
||||||
xml.node("level7_exception_3", [&] ()
|
xml.node("level7_exception_3", [&]
|
||||||
{
|
{
|
||||||
xml.node("level8_exception_1", [&] () { });
|
xml.node("level8_exception_1", [&] { });
|
||||||
xml.node("level8_exception_2", [&] () { });
|
xml.node("level8_exception_2", [&] { });
|
||||||
xml.node("level8_exception_3", [&] () { });
|
xml.node("level8_exception_3", [&] { });
|
||||||
xml.node("level8_exception_4", [&] ()
|
xml.node("level8_exception_4", [&]
|
||||||
{
|
{
|
||||||
throw 20 + i;
|
throw 20 + i;
|
||||||
});
|
});
|
||||||
@ -132,9 +132,9 @@ static size_t xml_with_exceptions(char *dst, size_t dst_len)
|
|||||||
} catch (unsigned error) {
|
} catch (unsigned error) {
|
||||||
Genode::log("exception with value ", error, " on level 8 (expected error)");
|
Genode::log("exception with value ", error, " on level 8 (expected error)");
|
||||||
}
|
}
|
||||||
xml.node("level4_2", [&] () { });
|
xml.node("level4_2", [&] { });
|
||||||
try {
|
try {
|
||||||
xml.node("level4_exception", [&] ()
|
xml.node("level4_exception", [&]
|
||||||
{
|
{
|
||||||
xml.attribute("attr1", "Welt");
|
xml.attribute("attr1", "Welt");
|
||||||
xml.attribute("attr2", 2143);
|
xml.attribute("attr2", 2143);
|
||||||
@ -147,7 +147,7 @@ static size_t xml_with_exceptions(char *dst, size_t dst_len)
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
xml.node("level2_exception", [&] ()
|
xml.node("level2_exception", [&]
|
||||||
{
|
{
|
||||||
throw 40;
|
throw 40;
|
||||||
});
|
});
|
||||||
@ -205,7 +205,7 @@ void Component::construct(Genode::Env &env)
|
|||||||
pattern[i] = (char)i;
|
pattern[i] = (char)i;
|
||||||
|
|
||||||
/* generate XML with the pattern as content */
|
/* generate XML with the pattern as content */
|
||||||
Xml_generator xml(dst, sizeof(dst), "data", [&] () {
|
Xml_generator xml(dst, sizeof(dst), "data", [&] {
|
||||||
xml.append_sanitized(pattern, sizeof(pattern)); });
|
xml.append_sanitized(pattern, sizeof(pattern)); });
|
||||||
|
|
||||||
/* parse the generated XML data */
|
/* parse the generated XML data */
|
||||||
@ -230,7 +230,7 @@ void Component::construct(Genode::Env &env)
|
|||||||
* Test arbitrary content
|
* Test arbitrary content
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
Xml_generator xml(dst, sizeof(dst), "data", [&] () {
|
Xml_generator xml(dst, sizeof(dst), "data", [&] {
|
||||||
xml.append_content(" ", 2 + 2, " == 2 + 2 == ", 4.0, " ");
|
xml.append_content(" ", 2 + 2, " == 2 + 2 == ", 4.0, " ");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user