L4Re - L4 Runtime Environment
ipc_legacy
1 // vi:set ft=cpp: -*- Mode: C++ -*-
2 /*
3  * Copyright (C) 2015 Kernkonzept GmbH.
4  * Author(s): Alexander Warg <alexander.warg@kernkonzept.com>
5  *
6  * This file is distributed under the terms of the GNU General Public
7  * License, version 2. Please see the COPYING-GPL-2 file for details.
8  *
9  * As a special exception, you may use this file as part of a free software
10  * library without restriction. Specifically, if other files instantiate
11  * templates or use macros or inline functions from this file, or you compile
12  * this file and link it with other files to produce an executable, this
13  * file does not by itself cause the resulting executable to be covered by
14  * the GNU General Public License. This exception does not however
15  * invalidate any other reasons why the executable file might be covered by
16  * the GNU General Public License.
17  */
18 #pragma once
19 
20 #include <l4/sys/cxx/ipc_epiface>
21 #ifndef L4_RPC_DISABLE_LEGACY_DISPATCH
22 #define L4_RPC_LEGACY_DISPATCH(IFACE) \
23  template<typename IOS> \
24  int dispatch(unsigned rights, IOS &ios) \
25  { \
26  typedef ::L4::Ipc::Detail::Dispatch<IFACE> Dispatch; \
27  l4_msgtag_t r = Dispatch::f(this, ios.tag(), rights, ios.utcb()); \
28  ios.set_ipc_params(r); \
29  return r.label(); \
30  } \
31  \
32  template<typename IOS> \
33  int p_dispatch(IFACE *, unsigned rights, IOS &ios) \
34  { \
35  using ::L4::Ipc::Msg::dispatch_call; \
36  l4_msgtag_t r; \
37  r = dispatch_call<typename IFACE::Rpcs>(this, ios.utcb(), \
38  ios.tag(), rights); \
39  ios.set_ipc_params(r); \
40  return r.label(); \
41  }
42 
43 #define L4_RPC_LEGACY_USING(IFACE) \
44  using IFACE::p_dispatch
45 
46 #else
47 #define L4_RPC_LEGACY_DISPATCH(IFACE)
48 #define L4_RPC_LEGACY_USING(IFACE)
49 #endif