mirror of
https://github.com/genodelabs/genode.git
synced 2025-01-18 02:40:08 +00:00
parent
954aff7002
commit
f23579532e
@ -124,7 +124,7 @@ class Audio_out::Out
|
||||
/* convert float to S16LE */
|
||||
static short data[Audio_out::PERIOD * Audio_out::MAX_CHANNELS];
|
||||
|
||||
for (int i = 0; i < Audio_out::PERIOD * Audio_out::MAX_CHANNELS; i += 2) {
|
||||
for (unsigned i = 0; i < Audio_out::PERIOD * Audio_out::MAX_CHANNELS; i += 2) {
|
||||
data[i] = p_left->content()[i / 2] * 32767;
|
||||
data[i + 1] = p_right->content()[i / 2] * 32767;
|
||||
}
|
||||
@ -494,7 +494,7 @@ struct Main
|
||||
void handle_config_update()
|
||||
{
|
||||
config.update();
|
||||
if (!config.is_valid()) { return; }
|
||||
if (!config.valid()) { return; }
|
||||
Audio::update_config(env, config.xml());
|
||||
}
|
||||
|
||||
|
@ -334,17 +334,17 @@ static void configure_mixer(Genode::Env &env, Mixer &mixer, Genode::Xml_node con
|
||||
mixer_reporter.enabled(v);
|
||||
|
||||
config.for_each_sub_node("mixer", [&] (Xml_node node) {
|
||||
char field[32];
|
||||
char value[16];
|
||||
try {
|
||||
node.attribute("field").value(field, sizeof(field));
|
||||
node.attribute("value").value(value, sizeof(value));
|
||||
|
||||
set_mixer_value(mixer, field, value);
|
||||
} catch (Xml_attribute::Nonexistent_attribute) { }
|
||||
typedef String<32> Field;
|
||||
typedef String<16> Value;
|
||||
|
||||
Field const field = node.attribute_value("field", Field());
|
||||
Value const value = node.attribute_value("value", Value());
|
||||
|
||||
set_mixer_value(mixer, field.string(), value.string());
|
||||
});
|
||||
|
||||
if (mixer_reporter.is_enabled()) try {
|
||||
if (mixer_reporter.enabled()) try {
|
||||
Genode::Reporter::Xml_generator xml(mixer_reporter, [&]() {
|
||||
|
||||
for (unsigned i = 0; i < mixer.num; i++) {
|
||||
|
@ -57,7 +57,7 @@ class Bsd::Slab_backend_alloc : public Genode::Allocator,
|
||||
addr_t _ds_phys[ELEMENTS]; /* physical bases of dataspaces */
|
||||
int _index; /* current index in ds_cap */
|
||||
Genode::Allocator_avl _range; /* manage allocations */
|
||||
Genode::Ram_session &_ram; /* ram session to allocate ds from */
|
||||
Genode::Ram_allocator &_ram; /* allocator to allocate ds from */
|
||||
|
||||
bool _alloc_block()
|
||||
{
|
||||
@ -81,7 +81,7 @@ class Bsd::Slab_backend_alloc : public Genode::Allocator,
|
||||
|
||||
public:
|
||||
|
||||
Slab_backend_alloc(Genode::Env &env, Genode::Ram_session &ram,
|
||||
Slab_backend_alloc(Genode::Env &env, Genode::Ram_allocator &ram,
|
||||
Genode::Region_map &rm, Genode::Allocator &md_alloc)
|
||||
:
|
||||
Rm_connection(env),
|
||||
|
@ -12,7 +12,6 @@
|
||||
*/
|
||||
|
||||
/* Genode includes */
|
||||
#include <base/printf.h>
|
||||
#include <base/sleep.h>
|
||||
#include <base/snprintf.h>
|
||||
#include <util/string.h>
|
||||
@ -40,27 +39,36 @@ void mtx_leave(struct mutex *mtx) {
|
||||
** sys/systm.h **
|
||||
*****************/
|
||||
|
||||
extern "C" void panic(const char *fmt, ...)
|
||||
static int _vprintf(char const *format, va_list list)
|
||||
{
|
||||
va_list va;
|
||||
char buf[128] { };
|
||||
Genode::String_console sc(buf, sizeof(buf));
|
||||
sc.vprintf(format, list);
|
||||
return sc.len();
|
||||
}
|
||||
|
||||
va_start(va, fmt);
|
||||
Genode::vprintf(fmt, va);
|
||||
va_end(va);
|
||||
|
||||
extern "C" void panic(char const *format, ...)
|
||||
{
|
||||
va_list list;
|
||||
|
||||
va_start(list, format);
|
||||
_vprintf(format, list);
|
||||
va_end(list);
|
||||
|
||||
Genode::sleep_forever();
|
||||
}
|
||||
|
||||
|
||||
extern "C" int printf(const char *fmt, ...)
|
||||
extern "C" int printf(const char *format, ...)
|
||||
{
|
||||
va_list va;
|
||||
va_list list;
|
||||
|
||||
va_start(va, fmt);
|
||||
Genode::vprintf(fmt, va);
|
||||
va_end(va);
|
||||
va_start(list, format);
|
||||
int const result = _vprintf(format, list);
|
||||
va_end(list);
|
||||
|
||||
return 0; /* XXX proper return value */
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
@ -18,6 +18,7 @@
|
||||
/* Genode includes */
|
||||
#include <base/log.h>
|
||||
#include <base/sleep.h>
|
||||
#include <base/allocator.h>
|
||||
|
||||
/* local includes */
|
||||
#include <bsd.h>
|
||||
|
@ -22,7 +22,6 @@
|
||||
/* Genode includes */
|
||||
#include <base/allocator_avl.h>
|
||||
#include <base/env.h>
|
||||
#include <base/printf.h>
|
||||
#include <base/log.h>
|
||||
#include <base/slab.h>
|
||||
#include <dataspace/client.h>
|
||||
@ -72,8 +71,14 @@ extern "C" int dde_support_initialized(void)
|
||||
** printf **
|
||||
************/
|
||||
|
||||
extern "C" void dde_vprintf(const char *fmt, va_list va) {
|
||||
Genode::vprintf(fmt, va); }
|
||||
extern "C" void dde_vprintf(const char *format, va_list list)
|
||||
{
|
||||
using namespace Genode;
|
||||
|
||||
char buf[128] { };
|
||||
String_console(buf, sizeof(buf)).vprintf(format, list);
|
||||
log(Cstring(buf));
|
||||
}
|
||||
|
||||
|
||||
extern "C" void dde_printf(const char *fmt, ...)
|
||||
@ -467,7 +472,7 @@ struct Slab_backend_alloc : public Genode::Allocator,
|
||||
Genode::Ram_dataspace_capability _ds_cap[ELEMENTS];
|
||||
int _index;
|
||||
Genode::Allocator_avl _range;
|
||||
Genode::Ram_session &_ram;
|
||||
Genode::Ram_allocator &_ram;
|
||||
|
||||
bool _alloc_block()
|
||||
{
|
||||
@ -492,7 +497,7 @@ struct Slab_backend_alloc : public Genode::Allocator,
|
||||
}
|
||||
|
||||
Slab_backend_alloc(Genode::Env &env, Genode::Region_map &rm,
|
||||
Genode::Ram_session &ram,
|
||||
Genode::Ram_allocator &ram,
|
||||
Genode::Allocator &md_alloc)
|
||||
:
|
||||
Rm_connection(env),
|
||||
|
@ -1 +1 @@
|
||||
2019-01-13 f7ccf2c2c0820f4e9b2153f6aeb7fe6a5194e309
|
||||
2019-01-19-b ae0b702188012c3d8c790eb087706823ea81c7ae
|
||||
|
@ -113,7 +113,7 @@ class Framebuffer::Session_component : public Genode::Rpc_object<Session>
|
||||
Genode::Attached_rom_dataspace &_config;
|
||||
Genode::Signal_context_capability _mode_sigh;
|
||||
Timer::Connection _timer;
|
||||
Genode::Ram_session &_ram;
|
||||
Genode::Ram_allocator &_ram;
|
||||
Genode::Attached_ram_dataspace _ds;
|
||||
bool _in_mode_change = true;
|
||||
|
||||
|
@ -106,9 +106,9 @@ Framebuffer::Driver::_preferred_mode(drm_connector *connector,
|
||||
if (!xn.has_type("connector"))
|
||||
continue;
|
||||
|
||||
String<64> con_policy;
|
||||
xn.attribute("name").value(&con_policy);
|
||||
if (Genode::strcmp(con_policy.string(), connector->name) != 0)
|
||||
typedef String<64> Name;
|
||||
Name const con_policy = xn.attribute_value("name", Name());
|
||||
if (con_policy != connector->name)
|
||||
continue;
|
||||
|
||||
bool enabled = xn.attribute_value("enabled", true);
|
||||
@ -118,11 +118,9 @@ Framebuffer::Driver::_preferred_mode(drm_connector *connector,
|
||||
brightness = xn.attribute_value("brightness",
|
||||
(unsigned)MAX_BRIGHTNESS + 1);
|
||||
|
||||
unsigned long width = 0;
|
||||
unsigned long height = 0;
|
||||
long hz = xn.attribute_value("hz", 0L);
|
||||
xn.attribute("width").value(&width);
|
||||
xn.attribute("height").value(&height);
|
||||
unsigned long const width = xn.attribute_value("width", 0UL);
|
||||
unsigned long const height = xn.attribute_value("height", 0UL);
|
||||
long const hz = xn.attribute_value("hz", 0L);
|
||||
|
||||
struct drm_display_mode *mode;
|
||||
list_for_each_entry(mode, &connector->modes, head) {
|
||||
@ -275,7 +273,7 @@ void Framebuffer::Driver::generate_report()
|
||||
} catch (...) {
|
||||
_reporter.enabled(false);
|
||||
}
|
||||
if (!_reporter.is_enabled()) return;
|
||||
if (!_reporter.enabled()) return;
|
||||
|
||||
/* write new report */
|
||||
try {
|
||||
|
@ -23,7 +23,7 @@
|
||||
** lx_kit/backend_alloc.h **
|
||||
****************************/
|
||||
|
||||
void backend_alloc_init(Genode::Env&, Genode::Ram_session&,
|
||||
void backend_alloc_init(Genode::Env&, Genode::Ram_allocator&,
|
||||
Genode::Allocator&)
|
||||
{
|
||||
/* intentionally left blank */
|
||||
|
@ -172,8 +172,8 @@ void Driver::main_task_entry(void * arg)
|
||||
try {
|
||||
Genode::Xml_node config_node = Lx_kit::env().config_rom().xml();
|
||||
use_report = config_node.attribute_value("use_report", false);
|
||||
config_node.attribute("width").value(&screen_x);
|
||||
config_node.attribute("height").value(&screen_y);
|
||||
config_node.attribute("width").value(screen_x);
|
||||
config_node.attribute("height").value(screen_y);
|
||||
multi_touch = config_node.attribute_value("multitouch", false);
|
||||
} catch(...) { }
|
||||
|
||||
@ -211,11 +211,11 @@ void Driver::scan_report()
|
||||
report_node.for_each_sub_node([&] (Genode::Xml_node & dev_node)
|
||||
{
|
||||
unsigned long c = 0;
|
||||
dev_node.attribute("class").value(&c);
|
||||
dev_node.attribute("class").value(c);
|
||||
if (c != USB_CLASS_HID) return;
|
||||
|
||||
Label label;
|
||||
dev_node.attribute("label").value(&label);
|
||||
dev_node.attribute("label").value(label);
|
||||
|
||||
bool found = false;
|
||||
|
||||
|
@ -42,7 +42,7 @@ struct Services
|
||||
}
|
||||
};
|
||||
|
||||
void backend_alloc_init(Genode::Env &env, Genode::Ram_session &ram, Genode::Allocator &alloc);
|
||||
void backend_alloc_init(Genode::Env &env, Genode::Ram_allocator &ram, Genode::Allocator &alloc);
|
||||
|
||||
void platform_hcd_init(Services *services);
|
||||
Genode::Irq_session_capability platform_irq_activate(int irq);
|
||||
|
@ -960,7 +960,8 @@ class Usb::Root : public Genode::Root_component<Session_component>
|
||||
if (xhci) xml.attribute("xhci", "yes");
|
||||
if (ohci) xml.attribute("ohci", "yes");
|
||||
|
||||
xml.append(config.content_base(), config.content_size());
|
||||
config.with_raw_content([&] (char const *start, size_t length) {
|
||||
xml.append(start, length); });
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,7 @@ class Signal_helper
|
||||
Genode::Signal_transmitter &sender() { return _sender; }
|
||||
Genode::Parent &parent() { return _env.parent(); }
|
||||
Genode::Env &env() { return _env; }
|
||||
Genode::Ram_session &ram() { return _env.ram(); }
|
||||
Genode::Ram_allocator &ram() { return _env.ram(); }
|
||||
Genode::Region_map &rm() { return _env.rm(); }
|
||||
};
|
||||
|
||||
|
@ -25,7 +25,7 @@
|
||||
** lx_kit/backend_alloc.h **
|
||||
****************************/
|
||||
|
||||
void backend_alloc_init(Genode::Env&, Genode::Ram_session&,
|
||||
void backend_alloc_init(Genode::Env&, Genode::Ram_allocator&,
|
||||
Genode::Allocator&)
|
||||
{
|
||||
/* intentionally left blank */
|
||||
|
@ -198,7 +198,7 @@ int request_irq(unsigned int irq, irq_handler_t handler, unsigned long flags,
|
||||
** Platform backend alloc init **
|
||||
*********************************/
|
||||
|
||||
void backend_alloc_init(Genode::Env &env, Genode::Ram_session &ram,
|
||||
void backend_alloc_init(Genode::Env &env, Genode::Ram_allocator &ram,
|
||||
Genode::Allocator &alloc)
|
||||
{
|
||||
Lx::pci_init(env, ram, alloc);
|
||||
|
@ -300,7 +300,7 @@ static void random_ether_addr(u8 *addr)
|
||||
/* try using configured mac */
|
||||
try {
|
||||
Xml_node::Attribute mac_node = config_node.attribute("mac");
|
||||
mac_node.value(&mac);
|
||||
mac_node.value(mac);
|
||||
} catch (...) {
|
||||
/* use fallback mac */
|
||||
snprint_mac(str, fallback);
|
||||
|
@ -42,7 +42,7 @@ class Lx_kit::Env
|
||||
Genode::Env &env() { return _env; }
|
||||
Genode::Heap &heap() { return _heap; }
|
||||
Genode::Attached_rom_dataspace &config_rom() { return _config; }
|
||||
Genode::Ram_session &ram() { return _env.ram(); }
|
||||
Genode::Ram_allocator &ram() { return _env.ram(); }
|
||||
Genode::Region_map &rm() { return _env.rm(); }
|
||||
};
|
||||
|
||||
|
@ -16,11 +16,12 @@
|
||||
|
||||
/* Genode includes */
|
||||
#include <base/env.h>
|
||||
#include <base/allocator.h>
|
||||
|
||||
|
||||
namespace Lx {
|
||||
|
||||
void pci_init(Genode::Env&, Genode::Ram_session&, Genode::Allocator&);
|
||||
void pci_init(Genode::Env&, Genode::Ram_allocator&, Genode::Allocator&);
|
||||
}
|
||||
|
||||
#endif /* _LX_KIT__PCI_H_ */
|
||||
|
@ -18,6 +18,7 @@
|
||||
|
||||
/* Genode includes */
|
||||
#include <base/entrypoint.h>
|
||||
#include <base/allocator.h>
|
||||
|
||||
namespace Lx {
|
||||
|
||||
|
@ -195,38 +195,30 @@ Plugin::Plugin()
|
||||
|
||||
void Plugin::init(Genode::Env &env)
|
||||
{
|
||||
char ip_addr_str[16] = {0};
|
||||
char netmask_str[16] = {0};
|
||||
char gateway_str[16] = {0};
|
||||
|
||||
Genode::Attached_rom_dataspace config { env, "config"} ;
|
||||
|
||||
try {
|
||||
Genode::Xml_node libc_node = config.xml().sub_node("libc");
|
||||
|
||||
try {
|
||||
libc_node.attribute("ip_addr").value(ip_addr_str, sizeof(ip_addr_str));
|
||||
} catch(...) { }
|
||||
typedef Genode::String<20> Ip_addr;
|
||||
|
||||
try {
|
||||
libc_node.attribute("netmask").value(netmask_str, sizeof(netmask_str));
|
||||
} catch(...) { }
|
||||
|
||||
try {
|
||||
libc_node.attribute("gateway").value(gateway_str, sizeof(gateway_str));
|
||||
} catch(...) { }
|
||||
Ip_addr const ip_addr = libc_node.attribute_value("ip_addr", Ip_addr());
|
||||
Ip_addr const netmask = libc_node.attribute_value("netmask", Ip_addr());
|
||||
Ip_addr const gateway = libc_node.attribute_value("gateway", Ip_addr());
|
||||
|
||||
/* either none or all 3 interface attributes must exist */
|
||||
if ((Genode::strlen(ip_addr_str) != 0) ||
|
||||
(Genode::strlen(netmask_str) != 0) ||
|
||||
(Genode::strlen(gateway_str) != 0)) {
|
||||
if (Genode::strlen(ip_addr_str) == 0) {
|
||||
if (ip_addr.valid() || netmask.valid() || gateway.valid()) {
|
||||
|
||||
if (!ip_addr.valid()) {
|
||||
Genode::error("missing \"ip_addr\" attribute. Ignoring network interface config.");
|
||||
throw Genode::Xml_node::Nonexistent_attribute();
|
||||
} else if (Genode::strlen(netmask_str) == 0) {
|
||||
}
|
||||
if (!netmask.valid()) {
|
||||
Genode::error("missing \"netmask\" attribute. Ignoring network interface config.");
|
||||
throw Genode::Xml_node::Nonexistent_attribute();
|
||||
} else if (Genode::strlen(gateway_str) == 0) {
|
||||
}
|
||||
if (!gateway.valid()) {
|
||||
Genode::error("missing \"gateway\" attribute. Ignoring network interface config.");
|
||||
throw Genode::Xml_node::Nonexistent_attribute();
|
||||
}
|
||||
@ -234,15 +226,19 @@ void Plugin::init(Genode::Env &env)
|
||||
throw -1;
|
||||
|
||||
Genode::log("static network interface: ",
|
||||
"ip_addr=", Genode::Cstring(ip_addr_str), " "
|
||||
"netmask=", Genode::Cstring(netmask_str), " "
|
||||
"gateway=", Genode::Cstring(gateway_str));
|
||||
"ip_addr=", ip_addr, " "
|
||||
"netmask=", netmask, " "
|
||||
"gateway=", gateway);
|
||||
|
||||
socketconstruct.construct(env, ip_addr.string(),
|
||||
netmask.string(),
|
||||
gateway.string());
|
||||
}
|
||||
catch (...) {
|
||||
Genode::log("Using DHCP for interface configuration.");
|
||||
}
|
||||
|
||||
socketconstruct.construct(env, ip_addr_str, netmask_str, gateway_str);
|
||||
socketconstruct.construct(env, "", "", "");
|
||||
};
|
||||
|
||||
/* TODO shameful copied from lwip... generalize this */
|
||||
|
@ -13,6 +13,7 @@
|
||||
|
||||
/* Genode includes */
|
||||
#include <base/env.h>
|
||||
#include <base/allocator.h>
|
||||
#include <base/signal.h>
|
||||
#include <base/log.h>
|
||||
#include <base/thread.h>
|
||||
|
@ -61,8 +61,8 @@ struct Services
|
||||
|
||||
try {
|
||||
Genode::Xml_node node_screen = node_hid.sub_node("touchscreen");
|
||||
node_screen.attribute("width").value(&screen_width);
|
||||
node_screen.attribute("height").value(&screen_height);
|
||||
node_screen.attribute("width").value(screen_width);
|
||||
node_screen.attribute("height").value(screen_height);
|
||||
multitouch = node_screen.attribute_value("multitouch", false);
|
||||
} catch (...) {
|
||||
screen_width = screen_height = 0;
|
||||
@ -127,7 +127,7 @@ struct Services
|
||||
}
|
||||
};
|
||||
|
||||
void backend_alloc_init(Genode::Env &env, Genode::Ram_session &ram, Genode::Allocator &alloc);
|
||||
void backend_alloc_init(Genode::Env &env, Genode::Ram_allocator &ram, Genode::Allocator &alloc);
|
||||
|
||||
void platform_hcd_init(Services *services);
|
||||
Genode::Irq_session_capability platform_irq_activate(int irq);
|
||||
|
@ -38,7 +38,7 @@ class Signal_helper
|
||||
Genode::Signal_transmitter &sender() { return _sender; }
|
||||
Genode::Parent &parent() { return _env.parent(); }
|
||||
Genode::Env &env() { return _env; }
|
||||
Genode::Ram_session &ram() { return _env.ram(); }
|
||||
Genode::Ram_allocator &ram() { return _env.ram(); }
|
||||
Genode::Region_map &rm() { return _env.rm(); }
|
||||
};
|
||||
|
||||
|
@ -708,7 +708,7 @@ void random_ether_addr(u8 *addr)
|
||||
try {
|
||||
Xml_node nic_config = config_node.sub_node("nic");
|
||||
Xml_node::Attribute mac_node = nic_config.attribute("mac");
|
||||
mac_node.value(&mac);
|
||||
mac_node.value(mac);
|
||||
} catch (...) {
|
||||
/* use fallback mac */
|
||||
snprint_mac(str, fallback);
|
||||
|
@ -932,7 +932,8 @@ class Usb::Root : public Genode::Root_component<Session_component>
|
||||
if (xhci) xml.attribute("xhci", "yes");
|
||||
if (ohci) xml.attribute("ohci", "yes");
|
||||
|
||||
xml.append(config.content_base(), config.content_size());
|
||||
config.with_raw_content([&] (char const *start, size_t length) {
|
||||
xml.append(start, length); });
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,7 @@
|
||||
** lx_kit/backend_alloc.h **
|
||||
****************************/
|
||||
|
||||
void backend_alloc_init(Genode::Env&, Genode::Ram_session&,
|
||||
void backend_alloc_init(Genode::Env&, Genode::Ram_allocator&,
|
||||
Genode::Allocator&)
|
||||
{
|
||||
/* intentionally left blank */
|
||||
|
@ -191,7 +191,7 @@ int request_irq(unsigned int irq, irq_handler_t handler, unsigned long flags,
|
||||
** Platform backend alloc init **
|
||||
*********************************/
|
||||
|
||||
void backend_alloc_init(Genode::Env &env, Genode::Ram_session &ram,
|
||||
void backend_alloc_init(Genode::Env &env, Genode::Ram_allocator &ram,
|
||||
Genode::Allocator &alloc)
|
||||
{
|
||||
Lx::pci_init(env, ram, alloc);
|
||||
|
@ -137,7 +137,7 @@ class Storage_device : public Genode::List<Storage_device>::Element,
|
||||
|
||||
public:
|
||||
|
||||
Storage_device(Genode::Ram_session &ram, struct scsi_device *sdev)
|
||||
Storage_device(Genode::Ram_allocator &ram, struct scsi_device *sdev)
|
||||
: Block::Driver(ram), _sdev(sdev)
|
||||
{
|
||||
/* read device capacity */
|
||||
@ -185,7 +185,7 @@ struct Factory : Block::Driver_factory
|
||||
{
|
||||
Storage_device device;
|
||||
|
||||
Factory(Genode::Ram_session &ram, struct scsi_device *sdev)
|
||||
Factory(Genode::Ram_allocator &ram, struct scsi_device *sdev)
|
||||
: device(ram, sdev) {}
|
||||
|
||||
Block::Driver *create() { return &device; }
|
||||
|
@ -14,6 +14,9 @@
|
||||
#ifndef _LX_H_
|
||||
#define _LX_H_
|
||||
|
||||
/* Genode includes */
|
||||
#include <base/allocator.h>
|
||||
|
||||
/* local includes */
|
||||
#include <lx_kit/scheduler.h>
|
||||
|
||||
|
@ -53,9 +53,9 @@ struct Lx_kit::Memory_object_base : Genode::Object_pool<Memory_object_base>::Ent
|
||||
|
||||
struct Lx_kit::Ram_object : Memory_object_base
|
||||
{
|
||||
Genode::Ram_session &_ram;
|
||||
Genode::Ram_allocator &_ram;
|
||||
|
||||
Ram_object(Genode::Ram_session &ram,
|
||||
Ram_object(Genode::Ram_allocator &ram,
|
||||
Genode::Ram_dataspace_capability cap)
|
||||
: Memory_object_base(cap), _ram(ram) {}
|
||||
|
||||
@ -80,11 +80,11 @@ struct Lx_kit::Dma_object : Memory_object_base
|
||||
********************/
|
||||
|
||||
static Genode::Constructible<Platform::Connection> _global_pci;
|
||||
static Genode::Allocator *_global_md_alloc;
|
||||
static Genode::Ram_session *_global_ram;
|
||||
static Genode::Allocator *_global_md_alloc;
|
||||
static Genode::Ram_allocator *_global_ram;
|
||||
|
||||
|
||||
void Lx::pci_init(Genode::Env &env, Genode::Ram_session &ram,
|
||||
void Lx::pci_init(Genode::Env &env, Genode::Ram_allocator &ram,
|
||||
Genode::Allocator &md_alloc)
|
||||
{
|
||||
_global_pci.construct(env);
|
||||
|
@ -36,7 +36,7 @@ struct Framebuffer_controller
|
||||
Signal_handler<Framebuffer_controller> timer_handler;
|
||||
|
||||
void update_connector_config(Xml_generator & xml, Xml_node & node);
|
||||
void update_fb_config(Xml_node & report);
|
||||
void update_fb_config(Xml_node const &report);
|
||||
void report_changed();
|
||||
void handle_timer();
|
||||
|
||||
@ -66,9 +66,8 @@ void Framebuffer_controller::update_connector_config(Xml_generator & xml,
|
||||
Xml_node & node)
|
||||
{
|
||||
xml.node("connector", [&] {
|
||||
String<64> name;
|
||||
node.attribute("name").value(&name);
|
||||
xml.attribute("name", name.string());
|
||||
|
||||
xml.attribute("name", node.attribute_value("name", String<64>()));
|
||||
|
||||
bool connected = node.attribute_value("connected", false);
|
||||
xml.attribute("enabled", connected ? "true" : "false");
|
||||
@ -97,7 +96,7 @@ void Framebuffer_controller::update_connector_config(Xml_generator & xml,
|
||||
}
|
||||
|
||||
|
||||
void Framebuffer_controller::update_fb_config(Xml_node & report)
|
||||
void Framebuffer_controller::update_fb_config(Xml_node const &report)
|
||||
{
|
||||
try {
|
||||
static char buf[4096];
|
||||
@ -128,21 +127,15 @@ void Framebuffer_controller::update_fb_config(Xml_node & report)
|
||||
void Framebuffer_controller::report_changed()
|
||||
{
|
||||
rom.update();
|
||||
if (!rom.is_valid()) return;
|
||||
|
||||
Xml_node report(rom.local_addr<char>(), rom.size());
|
||||
update_fb_config(report);
|
||||
update_fb_config(rom.xml());
|
||||
}
|
||||
|
||||
|
||||
void Framebuffer_controller::handle_timer()
|
||||
{
|
||||
if (!rom.is_valid())
|
||||
return;
|
||||
|
||||
/* artificial update */
|
||||
Xml_node report(rom.local_addr<char>(), rom.size());
|
||||
update_fb_config(report);
|
||||
update_fb_config(rom.xml());
|
||||
}
|
||||
|
||||
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
#include "sched.h"
|
||||
#include <base/allocator_avl.h>
|
||||
#include <base/printf.h>
|
||||
#include <block_session/connection.h>
|
||||
#include <rump/env.h>
|
||||
#include <rump_fs/fs.h>
|
||||
@ -176,12 +175,14 @@ void rump_io_backend_init()
|
||||
}
|
||||
|
||||
|
||||
void rumpuser_dprintf(const char *fmt, ...)
|
||||
void rumpuser_dprintf(const char *format, ...)
|
||||
{
|
||||
va_list list;
|
||||
va_start(list, fmt);
|
||||
va_start(list, format);
|
||||
|
||||
Genode::vprintf(fmt, list);
|
||||
char buf[128] { };
|
||||
Genode::String_console(buf, sizeof(buf)).vprintf(format, list);
|
||||
Genode::log(Genode::Cstring(buf));
|
||||
|
||||
va_end(list);
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ void File_system::init()
|
||||
|
||||
Genode::log("Using ", fs_type, " as file system");
|
||||
|
||||
size_t const avail = Rump::env().env().ram().avail_ram().value;
|
||||
size_t const avail = Rump::env().env().pd().avail_ram().value;
|
||||
rump_set_memlimit(avail);
|
||||
|
||||
/* start rump kernel */
|
||||
|
@ -484,30 +484,27 @@ class Rump_fs::Root : public Root_component<Session_component>
|
||||
}
|
||||
ram_quota -= session_size;
|
||||
|
||||
char tmp[MAX_PATH_LEN];
|
||||
try {
|
||||
Session_policy policy(label, _config.xml());
|
||||
Session_policy const policy(label, _config.xml());
|
||||
|
||||
/* determine policy root offset */
|
||||
try {
|
||||
policy.attribute("root").value(tmp, sizeof(tmp));
|
||||
session_root.import(tmp, "/mnt");
|
||||
} catch (Xml_node::Nonexistent_attribute) { }
|
||||
/* determine policy root offset */
|
||||
typedef String<MAX_PATH_LEN> Root;
|
||||
session_root.import(policy.attribute_value("root", Root()).string(), "/mnt");
|
||||
|
||||
/*
|
||||
* Determine if the session is writeable.
|
||||
* Policy overrides client argument, both default to false.
|
||||
*/
|
||||
if (policy.attribute_value("writeable", false))
|
||||
writeable = Arg_string::find_arg(args, "writeable").bool_value(false);
|
||||
}
|
||||
catch (Session_policy::No_policy_defined) { throw Service_denied(); }
|
||||
/*
|
||||
* Determine if the session is writeable.
|
||||
* Policy overrides client argument, both default to false.
|
||||
*/
|
||||
if (policy.attribute_value("writeable", false))
|
||||
writeable = Arg_string::find_arg(args, "writeable").bool_value(false);
|
||||
|
||||
/* apply client's root offset */
|
||||
Arg_string::find_arg(args, "root").string(tmp, sizeof(tmp), "/");
|
||||
if (Genode::strcmp("/", tmp, sizeof(tmp))) {
|
||||
session_root.append("/");
|
||||
session_root.append(tmp);
|
||||
{
|
||||
char tmp[MAX_PATH_LEN] { };
|
||||
Arg_string::find_arg(args, "root").string(tmp, sizeof(tmp), "/");
|
||||
if (Genode::strcmp("/", tmp, sizeof(tmp))) {
|
||||
session_root.append("/");
|
||||
session_root.append(tmp);
|
||||
}
|
||||
}
|
||||
session_root.remove_trailing('/');
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user