fixup "core: don't rely on Core_env in platform.cc" (base-hw: account caps for utcb)

This commit is contained in:
Norman Feske
2025-01-14 14:38:31 +01:00
parent 40b00e2bcd
commit 94ece697e1
5 changed files with 12 additions and 15 deletions

View File

@@ -29,17 +29,6 @@
using namespace Core; using namespace Core;
Ram_dataspace_capability Platform_thread::Utcb::_allocate(Ram_allocator &ram)
{
try {
return ram.alloc(sizeof(Native_utcb), CACHED);
} catch (...) {
error("failed to allocate UTCB");
throw Out_of_ram();
}
}
addr_t Platform_thread::Utcb::_attach(Region_map &core_rm) addr_t Platform_thread::Utcb::_attach(Region_map &core_rm)
{ {
Region_map::Attr attr { }; Region_map::Attr attr { };

View File

@@ -69,7 +69,14 @@ class Core::Platform_thread : Noncopyable
addr_t const core_addr; /* UTCB address within core/kernel */ addr_t const core_addr; /* UTCB address within core/kernel */
addr_t const phys_addr; addr_t const phys_addr;
Ram_dataspace_capability _allocate(Ram_allocator &); /*
* \throw Out_of_ram
* \throw Out_of_caps
*/
Ram_dataspace_capability _allocate(Ram_allocator &ram)
{
return ram.alloc(sizeof(Native_utcb), CACHED);
}
addr_t _attach(Region_map &); addr_t _attach(Region_map &);

View File

@@ -63,7 +63,7 @@ Cpu_session_component::create_thread(Capability<Pd_session> pd_cap,
Cpu_thread_component &thread = *new (&_thread_alloc) Cpu_thread_component &thread = *new (&_thread_alloc)
Cpu_thread_component( Cpu_thread_component(
cap(), *this, _thread_ep, _local_rm, _pager_ep, cap(), *this, _thread_ep, _local_rm, _pager_ep,
*pd, platform_pd, pd_threads, _trace_control_area, *pd, _ram_alloc, platform_pd, pd_threads, _trace_control_area,
_trace_sources, weight, _weight_to_quota(weight.value), _trace_sources, weight, _weight_to_quota(weight.value),
_thread_affinity(affinity), _label, name, _thread_affinity(affinity), _label, name,
_priority, utcb); _priority, utcb);

View File

@@ -144,6 +144,7 @@ class Core::Cpu_thread_component : public Rpc_object<Cpu_thread>,
Region_map &core_rm, Region_map &core_rm,
Pager_entrypoint &pager_ep, Pager_entrypoint &pager_ep,
Pd_session_component &pd, Pd_session_component &pd,
Ram_allocator &cpu_ram,
Platform_pd &platform_pd, Platform_pd &platform_pd,
Pd_threads &pd_threads, Pd_threads &pd_threads,
Trace::Control_area &trace_control_area, Trace::Control_area &trace_control_area,
@@ -161,7 +162,7 @@ class Core::Cpu_thread_component : public Rpc_object<Cpu_thread>,
_weight(weight), _weight(weight),
_session_label(label), _name(name), _session_label(label), _name(name),
_pd_element(pd_threads, *this), _pd_element(pd_threads, *this),
_platform_thread(platform_pd, ep, pd, core_rm, quota, name.string(), _platform_thread(platform_pd, ep, cpu_ram, core_rm, quota, name.string(),
priority, location, utcb), priority, location, utcb),
_trace_control_slot(trace_control_area), _trace_control_slot(trace_control_area),
_trace_sources(trace_sources), _trace_sources(trace_sources),

View File

@@ -27,7 +27,7 @@
<default-route> <default-route>
<any-service> <parent/> <any-child/> </any-service> <any-service> <parent/> <any-child/> </any-service>
</default-route> </default-route>
<start name="test-pthread" caps="200"> <start name="test-pthread" caps="600">
<resource name="RAM" quantum="64M"/> <resource name="RAM" quantum="64M"/>
<config> <config>
<vfs> <dir name="dev"> <log/> </dir> </vfs> <vfs> <dir name="dev"> <log/> </dir> </vfs>