diff --git a/repos/base-tukija/include/spec/64bit/tukija/syscalls.h b/repos/base-tukija/include/spec/64bit/tukija/syscalls.h index 2973f154bc..41b344e2c8 100644 --- a/repos/base-tukija/include/spec/64bit/tukija/syscalls.h +++ b/repos/base-tukija/include/spec/64bit/tukija/syscalls.h @@ -424,6 +424,12 @@ namespace Tukija { 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 inline uint8_t release(Tukija::Resource_type type, Tukija::Release_op op = Tukija::Release_op::RELEASE) { diff --git a/repos/base-tukija/include/tukija/syscall-generic.h b/repos/base-tukija/include/tukija/syscall-generic.h index 5b21a60721..7e8dd6e37f 100644 --- a/repos/base-tukija/include/tukija/syscall-generic.h +++ b/repos/base-tukija/include/tukija/syscall-generic.h @@ -57,26 +57,27 @@ namespace Tukija { * NOVA system-call IDs */ enum Syscall { - NOVA_CALL = 0x0, - NOVA_REPLY = 0x1, - NOVA_CREATE_PD = 0x2, - NOVA_CREATE_EC = 0x3, - NOVA_CREATE_SC = 0x4, - NOVA_CREATE_PT = 0x5, - NOVA_CREATE_SM = 0x6, - NOVA_REVOKE = 0x7, - NOVA_MISC = 0x8, /* lookup, delegate, acpi_suspend */ - NOVA_EC_CTRL = 0x9, - NOVA_SC_CTRL = 0xa, - NOVA_PT_CTRL = 0xb, - NOVA_SM_CTRL = 0xc, - NOVA_ASSIGN_PCI = 0xd, - NOVA_ASSIGN_GSI = 0xe, - NOVA_PD_CTRL = 0xf, + NOVA_CALL = 0x0, + NOVA_REPLY = 0x1, + NOVA_CREATE_PD = 0x2, + NOVA_CREATE_EC = 0x3, + NOVA_CREATE_SC = 0x4, + NOVA_CREATE_PT = 0x5, + NOVA_CREATE_SM = 0x6, + NOVA_REVOKE = 0x7, + NOVA_MISC = 0x8, /* lookup, delegate, acpi_suspend */ + NOVA_EC_CTRL = 0x9, + NOVA_SC_CTRL = 0xa, + NOVA_PT_CTRL = 0xb, + NOVA_SM_CTRL = 0xc, + NOVA_ASSIGN_PCI = 0xd, + NOVA_ASSIGN_GSI = 0xe, + NOVA_PD_CTRL = 0xf, TUKIJA_CREATE_CELL = 0x10, - TUKIJA_ALLOCATE = 0x11, + TUKIJA_ALLOCATE = 0x11, 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(); 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 diff --git a/repos/base-tukija/src/core/pager.cc b/repos/base-tukija/src/core/pager.cc index 6e2151d826..603fbf25ea 100644 --- a/repos/base-tukija/src/core/pager.cc +++ b/repos/base-tukija/src/core/pager.cc @@ -158,6 +158,11 @@ void Pager_object::_page_fault_handler(Pager_object &obj) /* lookup fault address and decide what to do */ unsigned error = (obj.pager(ipc_pager) == Pager_object::Pager_result::STOP); + if (ipc_pager.fault_addr() >= reinterpret_cast(Tukija::Tip::tip())) { + Genode::error("TIP is not mapped."); + Tukija::map_tip(obj.pd_sel()); + } + /* don't open receive window for pager threads */ if (utcb.crd_rcv.value()) nova_die();