summaryrefslogtreecommitdiff
path: root/libl4/l4/misc.h
blob: c26693654e32a274c677a5a32ef36a19d125338a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/* l4/misc.h - Public interface to L4 miscellaneous functions.
   Copyright (C) 2003, 2004 Free Software Foundation, Inc.
   Written by Marcus Brinkmann <marcus@gnu.org>.

   This file is part of the GNU L4 library.
 
   The GNU L4 library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Lesser General Public License
   as published by the Free Software Foundation; either version 2.1 of
   the License, or (at your option) any later version.
 
   The GNU L4 library is distributed in the hope that it will be
   useful, but WITHOUT ANY WARRANTY; without even the implied warranty
   of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU Lesser General Public License for more details.
 
   You should have received a copy of the GNU Lesser General Public
   License along with the GNU L4 library; if not, write to the Free
   Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
   02111-1307, USA.  */

#ifndef _L4_MISC_H
#define _L4_MISC_H	1

#include <l4/types.h>
#include <l4/bits/misc.h>
#include <l4/vregs.h>
#include <l4/syscall.h>


/* l4_memory_control convenience interface.  */

#define _L4_DEFAULT_MEMORY	(_L4_WORD_C(0))

static inline _L4_word_t
_L4_attribute_always_inline
_L4_set_page_attribute (_L4_fpage_t fpage, _L4_word_t attribute)
{
  _L4_word_t attributes[4];

  attributes[0] = attribute;
  _L4_set_rights (&fpage, 0);
  _L4_load_mr (0, fpage);
  return _L4_memory_control (0, &attribute); 
}


static inline _L4_word_t
_L4_attribute_always_inline
_L4_set_pages_attributes (_L4_word_t nr, _L4_fpage_t *fpages,
			  _L4_word_t *attributes)
{
  _L4_load_mrs (0, nr, (_L4_word_t *) fpages);
  return _L4_memory_control (nr - 1, attributes);
}


/* Now incorporate the public interfaces the user has selected.  */
#ifdef _L4_INTERFACE_L4
#include <l4/compat/misc.h>
#endif
#ifdef _L4_INTERFACE_GNU
#include <l4/gnu/misc.h>
#endif

#endif	/* misc.h */