From f53c1f3b2e357f200bcbcf3bc8362d65aeaf8dc6 Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Sun, 30 Mar 2025 17:48:03 +0200 Subject: [PATCH] base-foc: don't use Native_thread in pager code The Native_thread type was solely used to refer to the originator of a page fault. A plain kcap value suffices for that. --- repos/base-foc/src/core/include/ipc_pager.h | 19 +++++-------------- repos/base-foc/src/core/pager.cc | 8 ++++---- 2 files changed, 9 insertions(+), 18 deletions(-) diff --git a/repos/base-foc/src/core/include/ipc_pager.h b/repos/base-foc/src/core/include/ipc_pager.h index 8786d8cfed..5faef5903d 100644 --- a/repos/base-foc/src/core/include/ipc_pager.h +++ b/repos/base-foc/src/core/include/ipc_pager.h @@ -16,23 +16,12 @@ #define _CORE__INCLUDE__IPC_PAGER_H_ /* Genode includes */ -#include -#include -#include -#include -#include #include #include -/* base-internal includes */ -#include - /* core includes */ #include -/* Fiasco.OC includes */ -#include - namespace Core { class Ipc_pager; } @@ -44,7 +33,9 @@ class Core::Ipc_pager : public Native_capability private: - Native_thread _last { }; /* origin of last fault */ + struct Last { Foc::l4_cap_idx_t kcap; }; + + Last _last { }; /* origin of last fault */ addr_t _pf_addr { 0 }; /* page-fault address */ addr_t _pf_ip { 0 }; /* ip of faulter */ Mapping _reply_mapping { }; /* page-fault answer */ @@ -97,7 +88,7 @@ class Core::Ipc_pager : public Native_capability /** * Set destination for next reply */ - void set_reply_dst(Native_thread t) { _last = t; } + void set_reply_dst(Last last) { _last = last; } /** * Answer call without sending a flex-page mapping @@ -115,7 +106,7 @@ class Core::Ipc_pager : public Native_capability /** * Return thread ID of last faulter */ - Native_thread last() const { return _last; } + Last last() const { return _last; } /** * Return badge for faulting thread diff --git a/repos/base-foc/src/core/pager.cc b/repos/base-foc/src/core/pager.cc index 102df00cb3..698c1b1eb8 100644 --- a/repos/base-foc/src/core/pager.cc +++ b/repos/base-foc/src/core/pager.cc @@ -61,7 +61,7 @@ void Pager_entrypoint::entry() /* handle request */ if (obj->pager(_pager) == Pager_object::Pager_result::CONTINUE) { - _pager.set_reply_dst(Native_thread(obj->badge())); + _pager.set_reply_dst({ .kcap = obj->badge() }); reply_pending = true; return; } @@ -79,7 +79,7 @@ void Pager_entrypoint::entry() */ /* send reply to the caller */ - _pager.set_reply_dst(Native_thread()); + _pager.set_reply_dst({ }); _pager.acknowledge_wakeup(); { @@ -91,7 +91,7 @@ void Pager_entrypoint::entry() } /* send wake up message to requested thread */ - _pager.set_reply_dst(Native_thread(obj->badge())); + _pager.set_reply_dst({ .kcap = obj->badge() }); _pager.acknowledge_exception(); break; } @@ -113,7 +113,7 @@ void Pager_entrypoint::entry() * that case we unblock it immediately. */ if (!obj->state.paused) { - _pager.set_reply_dst(Native_thread(obj->badge())); + _pager.set_reply_dst({ .kcap = obj->badge() }); reply_pending = true; } break;