2011-12-22 16:19:25 +01:00
|
|
|
/*
|
2015-07-29 10:58:17 +02:00
|
|
|
* \brief Pager support for Fiasco
|
2011-12-22 16:19:25 +01:00
|
|
|
* \author Christian Helmuth
|
2015-07-29 10:58:17 +02:00
|
|
|
* \date 2006-06-14
|
2011-12-22 16:19:25 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
2013-01-10 21:44:47 +01:00
|
|
|
* Copyright (C) 2006-2013 Genode Labs GmbH
|
2011-12-22 16:19:25 +01:00
|
|
|
*
|
|
|
|
* This file is part of the Genode OS framework, which is distributed
|
|
|
|
* under the terms of the GNU General Public License version 2.
|
|
|
|
*/
|
|
|
|
|
2015-07-29 10:58:17 +02:00
|
|
|
/* Genode includes */
|
|
|
|
#include <base/printf.h>
|
|
|
|
|
2015-06-19 14:58:18 +02:00
|
|
|
/* Core includes */
|
2015-07-29 10:58:17 +02:00
|
|
|
#include <ipc_pager.h>
|
2015-06-19 14:58:18 +02:00
|
|
|
#include <pager.h>
|
2011-12-22 16:19:25 +01:00
|
|
|
|
|
|
|
namespace Fiasco {
|
|
|
|
#include <l4/sys/ipc.h>
|
|
|
|
#include <l4/sys/syscalls.h>
|
|
|
|
}
|
|
|
|
|
|
|
|
using namespace Genode;
|
2015-07-29 10:58:17 +02:00
|
|
|
using namespace Fiasco;
|
2011-12-22 16:19:25 +01:00
|
|
|
|
|
|
|
|
2015-07-29 10:58:17 +02:00
|
|
|
/***************
|
|
|
|
** Ipc_pager **
|
|
|
|
***************/
|
2011-12-22 16:19:25 +01:00
|
|
|
|
2015-07-29 10:58:17 +02:00
|
|
|
void Ipc_pager::wait_for_fault()
|
2011-12-22 16:19:25 +01:00
|
|
|
{
|
2015-07-29 10:58:17 +02:00
|
|
|
l4_msgdope_t result;
|
2011-12-22 16:19:25 +01:00
|
|
|
|
2015-07-29 10:58:17 +02:00
|
|
|
do {
|
|
|
|
l4_ipc_wait(&_last,
|
|
|
|
L4_IPC_SHORT_MSG, &_pf_addr, &_pf_ip,
|
|
|
|
L4_IPC_NEVER, &result);
|
2011-12-22 16:19:25 +01:00
|
|
|
|
2015-07-29 10:58:17 +02:00
|
|
|
if (L4_IPC_IS_ERROR(result))
|
|
|
|
PERR("Ipc error %lx", L4_IPC_ERROR(result));
|
2011-12-22 16:19:25 +01:00
|
|
|
|
2015-07-29 10:58:17 +02:00
|
|
|
} while (L4_IPC_IS_ERROR(result));
|
|
|
|
}
|
2011-12-22 16:19:25 +01:00
|
|
|
|
|
|
|
|
2015-07-29 10:58:17 +02:00
|
|
|
void Ipc_pager::reply_and_wait_for_fault()
|
2011-12-22 16:19:25 +01:00
|
|
|
{
|
2015-07-29 10:58:17 +02:00
|
|
|
l4_msgdope_t result;
|
|
|
|
|
|
|
|
l4_ipc_reply_and_wait(_last,
|
|
|
|
L4_IPC_SHORT_FPAGE, _reply_mapping.dst_addr(),
|
|
|
|
_reply_mapping.fpage().fpage, &_last,
|
|
|
|
L4_IPC_SHORT_MSG, &_pf_addr, &_pf_ip,
|
|
|
|
L4_IPC_SEND_TIMEOUT_0, &result);
|
|
|
|
|
|
|
|
if (L4_IPC_IS_ERROR(result)) {
|
|
|
|
PERR("Ipc error %lx", L4_IPC_ERROR(result));
|
|
|
|
|
|
|
|
/* ignore all errors and wait for next proper message */
|
|
|
|
wait_for_fault();
|
|
|
|
}
|
2011-12-22 16:19:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-07-29 10:58:17 +02:00
|
|
|
void Ipc_pager::acknowledge_wakeup()
|
2011-12-22 16:19:25 +01:00
|
|
|
{
|
2015-07-29 10:58:17 +02:00
|
|
|
/* answer wakeup call from one of core's region-manager sessions */
|
|
|
|
l4_msgdope_t result;
|
|
|
|
l4_ipc_send(_last, L4_IPC_SHORT_MSG, 0, 0, L4_IPC_SEND_TIMEOUT_0, &result);
|
|
|
|
}
|
2011-12-22 16:19:25 +01:00
|
|
|
|
|
|
|
|
2015-07-29 10:58:17 +02:00
|
|
|
/**********************
|
|
|
|
** Pager Entrypoint **
|
|
|
|
**********************/
|
2011-12-22 16:19:25 +01:00
|
|
|
|
2015-08-10 13:34:16 +02:00
|
|
|
Untyped_capability Pager_entrypoint::_pager_object_cap(unsigned long badge)
|
2015-07-29 10:58:17 +02:00
|
|
|
{
|
2015-08-10 13:34:16 +02:00
|
|
|
return Untyped_capability(_tid.l4id, badge);
|
2011-12-22 16:19:25 +01:00
|
|
|
}
|