genode/repos/base-nova/src/core/ipc_pager.cc
Norman Feske fd401bdf53 Thread API cleanup
This patch cleans up the thread API and comes with the following
noteworthy changes:

- Introduced Cpu_session::Weight type that replaces a formerly used
  plain integer value to prevent the accidental mix-up of
  arguments.
- The enum definition of Cpu_session::DEFAULT_WEIGHT moved to
  Cpu_session::Weight::DEFAULT_WEIGHT
- New Thread constructor that takes a 'Env &' as first argument.
  The original constructors are now marked as deprecated. For the
  common use case where the default 'Weight' and 'Affinity' are
  used, a shortcut is provided. In the long term, those two
  constructors should be the only ones to remain.
- The former 'Thread<>' class template has been renamed to
  'Thread_deprecated'.
- The former 'Thread_base' class is now called 'Thread'.
- The new 'name()' accessor returns the thread's name as 'Name'
  object as centrally defined via 'Cpu_session::Name'. It is meant to
  replace the old-fashioned 'name' method that takes a buffer and size
  as arguments.
- Adaptation of the thread test to the new API

Issue #1954
2016-05-23 15:49:55 +02:00

55 lines
1.2 KiB
C++

/*
* \brief Low-level page-fault handling
* \author Norman Feske
* \date 2010-01-25
*/
/*
* Copyright (C) 2010-2013 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.
*/
/* Genode includes */
#include <base/thread.h>
/* Core includes */
#include <ipc_pager.h>
/* NOVA includes */
#include <nova/syscalls.h>
using namespace Genode;
void Ipc_pager::wait_for_fault()
{
/*
* When this function is called from the page-fault handler EC, a page
* fault already occurred. So we never wait but immediately read the
* page-fault information from our UTCB.
*/
Nova::Utcb *utcb = (Nova::Utcb *)Thread::myself()->utcb();
_fault_type = utcb->qual[0];
_fault_addr = utcb->qual[1];
_fault_ip = utcb->ip;
}
void Ipc_pager::set_reply_mapping(Mapping m)
{
Nova::Utcb *utcb = (Nova::Utcb *)Thread::myself()->utcb();
utcb->set_msg_word(0);
bool res = utcb->append_item(m.mem_crd(), m.dst_addr(), true, false,
false, m.dma(), m.write_combined());
/* one item ever fits on the UTCB */
(void)res;
}
void Ipc_pager::reply_and_wait_for_fault(unsigned sm)
{
Nova::reply(Thread::myself()->stack_top(), sm);
}