92 lines
3.2 KiB
C++
92 lines
3.2 KiB
C++
// vi:ft=cpp
|
|
/**
|
|
* \file
|
|
* Pager and Io_pager C++ interface.
|
|
*/
|
|
/*
|
|
* (c) 2014 Alexander Warg <alexander.warg@kernkonzept.com>
|
|
*
|
|
* This file is part of TUD:OS and distributed under the terms of the
|
|
* GNU General Public License 2.
|
|
* Please see the COPYING-GPL-2 file for details.
|
|
*
|
|
* As a special exception, you may use this file as part of a free software
|
|
* library without restriction. Specifically, if other files instantiate
|
|
* templates or use macros or inline functions from this file, or you compile
|
|
* this file and link it with other files to produce an executable, this
|
|
* file does not by itself cause the resulting executable to be covered by
|
|
* the GNU General Public License. This exception does not however
|
|
* invalidate any other reasons why the executable file might be covered by
|
|
* the GNU General Public License.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <l4/sys/capability>
|
|
#include <l4/sys/types.h>
|
|
#include <l4/sys/cxx/ipc_types>
|
|
#include <l4/sys/cxx/ipc_iface>
|
|
|
|
namespace L4 {
|
|
|
|
class L4_EXPORT Io_pager :
|
|
public Kobject_0t<Io_pager, L4_PROTO_IO_PAGE_FAULT>
|
|
{
|
|
public:
|
|
/**
|
|
* IO page fault protocol message.
|
|
*
|
|
* \param io_pfa Flex-page describing the faulting IO-port.
|
|
* \param pc Faulting program counter.
|
|
* \param[out] result Optional: handling result value.
|
|
* \param rwin The receive window for a flex-page mapping.
|
|
* \param[out] fp Optional: flex-page descriptor to send to the task
|
|
* raising the page fault.
|
|
*
|
|
* \return System call message tag; use l4_error() to check for errors.
|
|
*
|
|
* IO-port fault messages are usually generated by the kernel and an
|
|
* IO-page-fault handler needs to be in place to handle such faults
|
|
* and generate a reply by filling in `result` and / or `fp`.
|
|
*/
|
|
L4_INLINE_RPC(
|
|
l4_msgtag_t, io_page_fault, (l4_fpage_t io_pfa, l4_umword_t pc,
|
|
L4::Ipc::Opt<l4_mword_t &> result,
|
|
L4::Ipc::Rcv_fpage rwin,
|
|
L4::Ipc::Opt<L4::Ipc::Snd_fpage &> fp));
|
|
|
|
typedef L4::Typeid::Rpc_nocode<io_page_fault_t> Rpcs;
|
|
};
|
|
|
|
class L4_EXPORT Pager :
|
|
public Kobject_t<Pager, Io_pager, L4_PROTO_PAGE_FAULT>
|
|
{
|
|
public:
|
|
/**
|
|
* Page-fault protocol message.
|
|
*
|
|
* \param pfa Faulting address.
|
|
* \param pc Faulting program counter.
|
|
* \param[out] result Optional: handling result value.
|
|
* \param rwin Receive window for a flex-page mapping resolving the
|
|
* page fault
|
|
* \param[out] fp Optional: flex-page descriptor to send to the task
|
|
* raising the page fault.
|
|
*
|
|
* \return System call message tag; use l4_error() to check for errors.
|
|
*
|
|
* Page-fault messages are usually generated by the kernel and need to
|
|
* be handled by an appropriate handler funtion that fills in `result`
|
|
* and / or `fp` for the reply.
|
|
*/
|
|
L4_INLINE_RPC(
|
|
l4_msgtag_t, page_fault, (l4_umword_t pfa, l4_umword_t pc,
|
|
L4::Ipc::Opt<l4_mword_t &> result,
|
|
L4::Ipc::Rcv_fpage rwin,
|
|
L4::Ipc::Opt<L4::Ipc::Snd_fpage &> fp));
|
|
|
|
typedef L4::Typeid::Rpc_nocode<page_fault_t> Rpcs;
|
|
};
|
|
|
|
}
|