mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-23 07:22:25 +00:00
f186587cab
Besides unifying the Msgbuf_base classes across all platforms, this patch merges the Ipc_marshaller functionality into Msgbuf_base, which leads to several further simplifications. For example, this patch eventually moves the Native_connection_state and removes all state from the former Ipc_server to the actual server loop, which not only makes the flow of control and information much more obvious, but is also more flexible. I.e., on NOVA, we don't even have the notion of reply-and-wait. Now, we are no longer forced to pretend otherwise. Issue #1832
66 lines
1.3 KiB
C++
66 lines
1.3 KiB
C++
/*
|
|
* \brief Receive window for capability selectors
|
|
* \author Norman Feske
|
|
* \date 2016-03-22
|
|
*/
|
|
|
|
/*
|
|
* Copyright (C) 2016 Genode Labs GmbH
|
|
*
|
|
* This file is part of the Genode OS framework, which is distributed
|
|
* under the terms of the GNU General Public License version 2.
|
|
*/
|
|
|
|
#ifndef _INCLUDE__FOC__RECEIVE_WINDOW_H_
|
|
#define _INCLUDE__FOC__RECEIVE_WINDOW_H_
|
|
|
|
/* Genode includes */
|
|
#include <base/stdint.h>
|
|
#include <base/ipc_msgbuf.h>
|
|
#include <base/cap_map.h>
|
|
|
|
namespace Genode { struct Receive_window; }
|
|
|
|
|
|
class Genode::Receive_window
|
|
{
|
|
private:
|
|
|
|
/**
|
|
* Base of capability receive window.
|
|
*/
|
|
Cap_index* _rcv_idx_base = nullptr;
|
|
|
|
enum { MAX_CAPS_PER_MSG = Msgbuf_base::MAX_CAPS_PER_MSG };
|
|
|
|
public:
|
|
|
|
Receive_window() { }
|
|
|
|
~Receive_window()
|
|
{
|
|
if (_rcv_idx_base)
|
|
cap_idx_alloc()->free(_rcv_idx_base, MAX_CAPS_PER_MSG);
|
|
}
|
|
|
|
void init()
|
|
{
|
|
_rcv_idx_base = cap_idx_alloc()->alloc_range(MAX_CAPS_PER_MSG);
|
|
}
|
|
|
|
/**
|
|
* Return address of capability receive window
|
|
*/
|
|
addr_t rcv_cap_sel_base() { return _rcv_idx_base->kcap(); }
|
|
|
|
/**
|
|
* Return received selector with index i
|
|
*
|
|
* \return capability selector, or 0 if index is invalid
|
|
*/
|
|
addr_t rcv_cap_sel(unsigned i) {
|
|
return rcv_cap_sel_base() + i*Fiasco::L4_CAP_SIZE; }
|
|
};
|
|
|
|
#endif /* _INCLUDE__FOC__RECEIVE_WINDOW_H_ */
|