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.
This commit is contained in:
Norman Feske 2025-03-30 17:48:03 +02:00
parent f386b93e52
commit f53c1f3b2e
2 changed files with 9 additions and 18 deletions

View File

@ -16,23 +16,12 @@
#define _CORE__INCLUDE__IPC_PAGER_H_
/* Genode includes */
#include <base/ipc.h>
#include <base/stdint.h>
#include <base/native_capability.h>
#include <base/thread_state.h>
#include <util/touch.h>
#include <foc/native_capability.h>
#include <foc/thread_state.h>
/* base-internal includes */
#include <base/internal/native_thread.h>
/* core includes */
#include <mapping.h>
/* Fiasco.OC includes */
#include <foc/syscall.h>
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

View File

@ -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;