mirror of
https://github.com/mmueller41/genode.git
synced 2026-01-21 12:32:56 +01:00
base: remove dependency from deprecated APIs
This patch adjusts the implementation of the base library and core such that the code no longer relies on deprecated APIs except for very few cases, mainly to keep those deprecated APIs in tact for now. The most prominent changes are: - Removing the use of base/printf.h - Removing of the log backend for printf. The 'Console' with the format-string parser is still there along with 'snprintf.h' because the latter is still used at a few places, most prominently the 'Connection' classes. - Removing the notion of a RAM session, which does not exist in Genode anymore. Still the types were preserved (by typedefs to PD session) to keep up compatibility. But this transition should come to an end now. - Slight rennovation of core's tracing service, e.g., the use of an Attached_dataspace as the Argument_buffer. - Reducing the reliance on global accessors like deprecated_env() or core_env(). Still there is a longish way to go to eliminate all such calls. A useful pattern (or at least a stop-gap solution) is to pass the 'Env' to the individual compilation units via init functions. - Avoiding the use of the old 'Child_policy::resolve_session_request' interface that returned a 'Service' instead of a 'Route'. Issue #1987
This commit is contained in:
@@ -145,8 +145,8 @@ class Core_child : public Child_policy
|
||||
|
||||
Name name() const { return "init"; }
|
||||
|
||||
Service &resolve_session_request(Service::Name const &name,
|
||||
Session_state::Args const &) override
|
||||
Route resolve_session_request(Service::Name const &name,
|
||||
Session_label const &label) override
|
||||
{
|
||||
Service *service = nullptr;
|
||||
_services.for_each([&] (Service &s) {
|
||||
@@ -156,7 +156,9 @@ class Core_child : public Child_policy
|
||||
if (!service)
|
||||
throw Service_denied();
|
||||
|
||||
return *service;
|
||||
return Route { .service = *service,
|
||||
.label = label,
|
||||
.diag = Session::Diag() };
|
||||
}
|
||||
|
||||
void init(Pd_session &session, Capability<Pd_session> cap) override
|
||||
@@ -172,11 +174,8 @@ class Core_child : public Child_policy
|
||||
_core_cpu.transfer_quota(cap, Cpu_session::quota_lim_upscale(100, 100));
|
||||
}
|
||||
|
||||
Pd_session &ref_pd() { return _core_pd; }
|
||||
Pd_session_capability ref_pd_cap() const { return _core_pd_cap; }
|
||||
|
||||
Ram_session &ref_ram() { return _core_pd; }
|
||||
Ram_session_capability ref_ram_cap() const { return _core_pd_cap; }
|
||||
Pd_session &ref_pd() override { return _core_pd; }
|
||||
Pd_session_capability ref_pd_cap() const override { return _core_pd_cap; }
|
||||
|
||||
size_t session_alloc_batch_size() const override { return 128; }
|
||||
};
|
||||
@@ -254,8 +253,8 @@ int main()
|
||||
|
||||
static Rom_root rom_root (ep, ep, platform().rom_fs(), sliced_heap);
|
||||
static Rm_root rm_root (ep, sliced_heap, pager_ep);
|
||||
static Cpu_root cpu_root (ep, ep, pager_ep, sliced_heap,
|
||||
Trace::sources());
|
||||
static Cpu_root cpu_root (core_ram_alloc, local_rm, ep, ep, pager_ep,
|
||||
sliced_heap, Trace::sources());
|
||||
static Pd_root pd_root (ep, core_env().signal_ep(), pager_ep,
|
||||
platform().ram_alloc(),
|
||||
local_rm, sliced_heap,
|
||||
@@ -265,7 +264,8 @@ int main()
|
||||
platform().ram_alloc(), sliced_heap);
|
||||
static Irq_root irq_root (*core_env().pd_session(),
|
||||
platform().irq_alloc(), sliced_heap);
|
||||
static Trace::Root trace_root (ep, sliced_heap, Trace::sources(), trace_policies);
|
||||
static Trace::Root trace_root (core_ram_alloc, local_rm, ep, sliced_heap,
|
||||
Trace::sources(), trace_policies);
|
||||
|
||||
static Core_service<Rom_session_component> rom_service (services, rom_root);
|
||||
static Core_service<Rm_session_component> rm_service (services, rm_root);
|
||||
@@ -300,7 +300,7 @@ int main()
|
||||
|
||||
/* CPU session representing core */
|
||||
static Cpu_session_component
|
||||
core_cpu(ep, ep, pager_ep, sliced_heap, Trace::sources(),
|
||||
core_cpu(core_ram_alloc, local_rm, ep, ep, pager_ep, sliced_heap, Trace::sources(),
|
||||
"label=\"core\"", Affinity(), Cpu_session::QUOTA_LIMIT);
|
||||
Cpu_session_capability core_cpu_cap = ep.manage(&core_cpu);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user