base: add check whether stack belongs to ep

Add method to check whether a given pointer are part of the primary stack
of the rpc entrypoint.

Issue #4540
This commit is contained in:
Alexander Boettcher 2022-06-24 11:14:26 +02:00 committed by Christian Helmuth
parent fb0fe8617c
commit c81b3d4757

View File

@ -481,6 +481,17 @@ class Genode::Rpc_entrypoint : Thread, public Object_pool<Rpc_object_base>
* This method is solely needed on Linux. * This method is solely needed on Linux.
*/ */
bool is_myself() const; bool is_myself() const;
/**
* Check whether given stack info matches stack of the entrypoint.
*
* \noapi
*
*/
bool myself(addr_t const ptr) const
{
return addr_t(stack_base()) <= ptr && ptr <= addr_t(stack_top());
}
}; };