base-tukija: Map TIP if a page-fault occurs while accessing it.

This commit is contained in:
Michael Mueller
2025-10-17 16:48:06 +02:00
parent 0da523ce73
commit 8845be160a
3 changed files with 49 additions and 18 deletions

View File

@@ -424,6 +424,12 @@ namespace Tukija {
return syscall_0(TUKIJA_CELL_CTRL, op, pd); return syscall_0(TUKIJA_CELL_CTRL, op, pd);
} }
ALWAYS_INLINE
inline uint8_t map_tip(mword_t pd)
{
return syscall_0(TUKIJA_MAP_TIP, 0, pd);
}
ALWAYS_INLINE ALWAYS_INLINE
inline uint8_t release(Tukija::Resource_type type, Tukija::Release_op op = Tukija::Release_op::RELEASE) inline uint8_t release(Tukija::Resource_type type, Tukija::Release_op op = Tukija::Release_op::RELEASE)
{ {

View File

@@ -57,26 +57,27 @@ namespace Tukija {
* NOVA system-call IDs * NOVA system-call IDs
*/ */
enum Syscall { enum Syscall {
NOVA_CALL = 0x0, NOVA_CALL = 0x0,
NOVA_REPLY = 0x1, NOVA_REPLY = 0x1,
NOVA_CREATE_PD = 0x2, NOVA_CREATE_PD = 0x2,
NOVA_CREATE_EC = 0x3, NOVA_CREATE_EC = 0x3,
NOVA_CREATE_SC = 0x4, NOVA_CREATE_SC = 0x4,
NOVA_CREATE_PT = 0x5, NOVA_CREATE_PT = 0x5,
NOVA_CREATE_SM = 0x6, NOVA_CREATE_SM = 0x6,
NOVA_REVOKE = 0x7, NOVA_REVOKE = 0x7,
NOVA_MISC = 0x8, /* lookup, delegate, acpi_suspend */ NOVA_MISC = 0x8, /* lookup, delegate, acpi_suspend */
NOVA_EC_CTRL = 0x9, NOVA_EC_CTRL = 0x9,
NOVA_SC_CTRL = 0xa, NOVA_SC_CTRL = 0xa,
NOVA_PT_CTRL = 0xb, NOVA_PT_CTRL = 0xb,
NOVA_SM_CTRL = 0xc, NOVA_SM_CTRL = 0xc,
NOVA_ASSIGN_PCI = 0xd, NOVA_ASSIGN_PCI = 0xd,
NOVA_ASSIGN_GSI = 0xe, NOVA_ASSIGN_GSI = 0xe,
NOVA_PD_CTRL = 0xf, NOVA_PD_CTRL = 0xf,
TUKIJA_CREATE_CELL = 0x10, TUKIJA_CREATE_CELL = 0x10,
TUKIJA_ALLOCATE = 0x11, TUKIJA_ALLOCATE = 0x11,
TUKIJA_CELL_CTRL = 0x12, TUKIJA_CELL_CTRL = 0x12,
TUKIJA_RELEASE = 0x13, TUKIJA_RELEASE = 0x13,
TUKIJA_MAP_TIP = 0x14
}; };
/** /**
@@ -300,6 +301,25 @@ namespace Tukija {
Genode::Affinity::Location loc = Genode::Thread::myself()->affinity(); Genode::Affinity::Location loc = Genode::Thread::myself()->affinity();
return location_to_index(loc); return location_to_index(loc);
} }
Genode::Affinity::Location kernel_cpu_to_location(unsigned cpu)
{
unsigned idx = 0;
for (; idx < 256; idx++) {
if (idx_to_phys_cpu_id[idx] == cpu)
break;
}
if (idx >= habitat_affinity.total())
return Genode::Affinity::Location();
unsigned y = idx / habitat_affinity.width();
unsigned x = ((idx - y) / habitat_affinity.height() - location.xpos()) %
habitat_affinity.width();
return Genode::Affinity::Location(x,y);
}
/** /**
* @brief Return the worker information structure for the workers at the given location * @brief Return the worker information structure for the workers at the given location

View File

@@ -158,6 +158,11 @@ void Pager_object::_page_fault_handler(Pager_object &obj)
/* lookup fault address and decide what to do */ /* lookup fault address and decide what to do */
unsigned error = (obj.pager(ipc_pager) == Pager_object::Pager_result::STOP); unsigned error = (obj.pager(ipc_pager) == Pager_object::Pager_result::STOP);
if (ipc_pager.fault_addr() >= reinterpret_cast<Genode::addr_t>(Tukija::Tip::tip())) {
Genode::error("TIP is not mapped.");
Tukija::map_tip(obj.pd_sel());
}
/* don't open receive window for pager threads */ /* don't open receive window for pager threads */
if (utcb.crd_rcv.value()) if (utcb.crd_rcv.value())
nova_die(); nova_die();