summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libl4/ChangeLog8
-rw-r--r--libl4/Makefile.am21
-rw-r--r--libl4/README47
-rw-r--r--libl4/headers.m431
-rw-r--r--libl4/ia32/Makefile.am8
-rw-r--r--libl4/ia32/l4/bits/compat/ipc.h29
-rw-r--r--libl4/ia32/l4/bits/compat/misc.h31
-rw-r--r--libl4/ia32/l4/bits/compat/space.h60
-rw-r--r--libl4/ia32/l4/bits/gnu/ipc.h29
-rw-r--r--libl4/ia32/l4/bits/gnu/kip.h28
-rw-r--r--libl4/ia32/l4/bits/gnu/misc.h31
-rw-r--r--libl4/ia32/l4/bits/gnu/space.h43
-rw-r--r--libl4/ia32/l4/bits/ipc.h20
-rw-r--r--libl4/ia32/l4/bits/kip.h13
-rw-r--r--libl4/ia32/l4/bits/math.h20
-rw-r--r--libl4/ia32/l4/bits/misc.h24
-rw-r--r--libl4/ia32/l4/bits/space.h67
-rw-r--r--libl4/ia32/l4/bits/stubs-init.h2
-rw-r--r--libl4/ia32/l4/bits/syscall.h226
-rw-r--r--libl4/ia32/l4/bits/types.h9
-rw-r--r--libl4/ia32/l4/bits/vregs.h356
-rw-r--r--libl4/l4.h2
-rw-r--r--libl4/l4/compat/ipc.h1231
-rw-r--r--libl4/l4/compat/kip.h389
-rw-r--r--libl4/l4/compat/message.h92
-rw-r--r--libl4/l4/compat/misc.h70
-rw-r--r--libl4/l4/compat/schedule.h517
-rw-r--r--libl4/l4/compat/space.h290
-rw-r--r--libl4/l4/compat/syscall.h33
-rw-r--r--libl4/l4/compat/thread.h583
-rw-r--r--libl4/l4/compat/types.h87
-rw-r--r--libl4/l4/features.h52
-rw-r--r--libl4/l4/globals.h6
-rw-r--r--libl4/l4/gnu/ipc.h760
-rw-r--r--libl4/l4/gnu/kip.h527
-rw-r--r--libl4/l4/gnu/math.h40
-rw-r--r--libl4/l4/gnu/message.h94
-rw-r--r--libl4/l4/gnu/misc.h62
-rw-r--r--libl4/l4/gnu/schedule.h232
-rw-r--r--libl4/l4/gnu/space.h206
-rw-r--r--libl4/l4/gnu/syscall.h78
-rw-r--r--libl4/l4/gnu/thread.h429
-rw-r--r--libl4/l4/gnu/types.h76
-rw-r--r--libl4/l4/init.h15
-rw-r--r--libl4/l4/ipc.h1166
-rw-r--r--libl4/l4/kip.h599
-rw-r--r--libl4/l4/math.h35
-rw-r--r--libl4/l4/message.h48
-rw-r--r--libl4/l4/misc.h39
-rw-r--r--libl4/l4/schedule.h208
-rw-r--r--libl4/l4/space.h291
-rw-r--r--libl4/l4/stubs-init.h3
-rw-r--r--libl4/l4/stubs.h4
-rw-r--r--libl4/l4/syscall.h140
-rw-r--r--libl4/l4/thread.h412
-rw-r--r--libl4/l4/types.h211
-rw-r--r--libl4/l4/vregs.h26
-rw-r--r--libl4/powerpc/Makefile.am6
-rw-r--r--libl4/powerpc/l4/bits/compat/ipc.h27
-rw-r--r--libl4/powerpc/l4/bits/compat/misc.h34
-rw-r--r--libl4/powerpc/l4/bits/compat/space.h27
-rw-r--r--libl4/powerpc/l4/bits/gnu/ipc.h40
-rw-r--r--libl4/powerpc/l4/bits/gnu/kip.h40
-rw-r--r--libl4/powerpc/l4/bits/gnu/misc.h47
-rw-r--r--libl4/powerpc/l4/bits/gnu/space.h40
-rw-r--r--libl4/powerpc/l4/bits/ipc.h10
-rw-r--r--libl4/powerpc/l4/bits/kip.h7
-rw-r--r--libl4/powerpc/l4/bits/math.h20
-rw-r--r--libl4/powerpc/l4/bits/misc.h30
-rw-r--r--libl4/powerpc/l4/bits/space.h13
-rw-r--r--libl4/powerpc/l4/bits/syscall.h240
-rw-r--r--libl4/powerpc/l4/bits/types.h9
-rw-r--r--libl4/powerpc/l4/bits/vregs.h324
73 files changed, 8901 insertions, 2169 deletions
diff --git a/libl4/ChangeLog b/libl4/ChangeLog
index c43bba5..3f2c098 100644
--- a/libl4/ChangeLog
+++ b/libl4/ChangeLog
@@ -1,3 +1,11 @@
+2004-03-16 Marcus Brinkmann <marcus@gnu.org>
+
+ Total overhaul, and I am not going to list all the changes. Every
+ single file, and every single interface has been touched, to be
+ able to cleanly provide multiple interfaces in parallel. The
+ compatibility interface has been added. Some bugs have been
+ fixed, some others have been introduced.
+
2003-10-20 Johan Rydberg <jrydberg@night.trouble.net>
* l4/kip.h (l4_page_trunc): New function.
diff --git a/libl4/Makefile.am b/libl4/Makefile.am
index 18a2fe1..28b34d1 100644
--- a/libl4/Makefile.am
+++ b/libl4/Makefile.am
@@ -1,5 +1,5 @@
# Makefile.am - Makefile template for libl4.
-# Copyright (C) 2003 Free Software Foundation, Inc.
+# Copyright (C) 2003, 2004 Free Software Foundation, Inc.
# Written by Marcus Brinkmann.
#
# This file is part of the GNU Hurd.
@@ -26,8 +26,19 @@ if ARCH_POWERPC
endif
SUBDIRS = $(ARCH_SUBDIR)
+# Header files that must be provided by all interfaces.
+common_headers := ipc.h kip.h message.h misc.h schedule.h space.h \
+ syscall.h thread.h types.h
+# Interface-specific header files.
+gnu_headers := $(common_headers) math.h
+compat_headers := $(common_headers)
+
+# Main libl4 header files.
+l4_headers = features.h globals.h init.h ipc.h kip.h math.h message.h \
+ misc.h schedule.h space.h stubs-init.h stubs.h syscall.h \
+ thread.h types.h vregs.h
+
include_HEADERS = l4.h
-nobase_include_HEADERS = l4/types.h l4/math.h l4/globals.h l4/init.h \
- l4/vregs.h l4/stubs.h l4/stubs-init.h l4/syscall.h \
- l4/kip.h l4/thread.h l4/schedule.h l4/space.h \
- l4/ipc.h l4/misc.h
+nobase_include_HEADERS = $(addprefix l4/, $(l4_headers)) \
+ $(addprefix l4/gnu/, $(gnu_headers)) \
+ $(addprefix l4/compat/, $(compat_headers))
diff --git a/libl4/README b/libl4/README
index 1479017..2084748 100644
--- a/libl4/README
+++ b/libl4/README
@@ -17,17 +17,23 @@ actual code contained in the library is little. This also applies to
names of functions and data types, which follow the GNU coding
standard (except for the compatibility interface).
+* Interface extensions. The official L4 API is pretty minimalistic.
+Some generic convenience functions should just be provided by libl4.
+Having a separate code base means we can deal in the interface as we
+see fit, and be more oriented towards usability in the GNU system
+rather than tight definition.
+
* No struct returns. Many small data types in the official interface
are defined to be of an opaque struct type. This is nice from a data
encapsulation point of view, but causes problems in the C language.
-Although all functions the interface defined are usually inlined,
+Although all functions the interface defines are usually inlined,
user-defined functions on top of the official interface might use
structure types as return types of functions. However, there are two
calling conventions in use for that, one compatible to PCC which
-passes the struct on the stack, and one more efficient that uses
+passes the struct on the stack, and a more efficient one that uses
registers for small structures. Unfortunately, the less efficient one
-is the default. This makes these data types less optimal for use in
-C programs.
+is the default for some platforms. This makes these data types less
+optimal for use in C programs.
* Making best use of available tools. Some additional requirements
lead to code that can be simpler to understand and sometimes even more
@@ -88,3 +94,36 @@ requirements are:
bit-fields (which sizes add up to word size) in the order of the
endianess of the architecture into a single word, and the bits
within the individual bit-fields in the same order.
+
+
+What is the status of the library?
+----------------------------------
+
+The following interfaces are provided
+
+compat Enabled by default or if _L4_INTERFACE_COMPAT is defined, can
+ be disabled by defining _L4_NON_COMPAT.
+
+The compat interface is supposed to (eventually) be a drop-in
+replacement for the official libl4 library. Currently, this is not
+the case, though. Some inofficial interfaces are not implemented, and
+the system call stubs behave differently (the official library
+initializes them lazily, while in GNU libl4 they have to be
+initialized explicitely or implicitely by the linker).
+
+gnu Enabled if _GNU_SOURCE of _L4_INTERFACE_GNU is defined.
+
+The GNU interface is the interface of our choice. It provides all of
+the functionality of the official interface, and more. It does not
+provide a C++ API, though.
+
+
+Overall status:
+
+The operations on the TIME data type have not been implemented
+(_L4_time_point, _L4_time_add_usec, etc) yet.
+
+Architecture specific status:
+
+i386 complete and up-to-date
+powerpc needs to be tested and updated to latest API version
diff --git a/libl4/headers.m4 b/libl4/headers.m4
index b784e2e..0c2200f 100644
--- a/libl4/headers.m4
+++ b/libl4/headers.m4
@@ -1,5 +1,5 @@
# headers.m4 - Autoconf snippets to install links for header files.
-# Copyright 2003 Free Software Foundation, Inc.
+# Copyright 2003, 2004 Free Software Foundation, Inc.
# Written by Marcus Brinkmann <marcus@gnu.org>.
#
# This file is free software; as a special exception the author gives
@@ -12,21 +12,41 @@
AC_CONFIG_LINKS([
include/l4.h:libl4/l4.h
+ include/l4/features.h:libl4/l4/features.h
include/l4/globals.h:libl4/l4/globals.h
include/l4/init.h:libl4/l4/init.h
include/l4/ipc.h:libl4/l4/ipc.h
include/l4/kip.h:libl4/l4/kip.h
include/l4/math.h:libl4/l4/math.h
+ include/l4/message.h:libl4/l4/message.h
include/l4/misc.h:libl4/l4/misc.h
include/l4/schedule.h:libl4/l4/schedule.h
include/l4/space.h:libl4/l4/space.h
- include/l4/stubs.h:libl4/l4/stubs.h
include/l4/stubs-init.h:libl4/l4/stubs-init.h
+ include/l4/stubs.h:libl4/l4/stubs.h
include/l4/syscall.h:libl4/l4/syscall.h
include/l4/thread.h:libl4/l4/thread.h
include/l4/types.h:libl4/l4/types.h
include/l4/vregs.h:libl4/l4/vregs.h
+ include/l4/compat/ipc.h:libl4/l4/compat/ipc.h
+ include/l4/compat/kip.h:libl4/l4/compat/kip.h
+ include/l4/compat/message.h:libl4/l4/compat/message.h
+ include/l4/compat/misc.h:libl4/l4/compat/misc.h
+ include/l4/compat/schedule.h:libl4/l4/compat/schedule.h
+ include/l4/compat/space.h:libl4/l4/compat/space.h
+ include/l4/compat/syscall.h:libl4/l4/compat/syscall.h
+ include/l4/compat/thread.h:libl4/l4/compat/thread.h
include/l4/compat/types.h:libl4/l4/compat/types.h
+ include/l4/gnu/ipc.h:libl4/l4/gnu/ipc.h
+ include/l4/gnu/kip.h:libl4/l4/gnu/kip.h
+ include/l4/gnu/math.h:libl4/l4/gnu/math.h
+ include/l4/gnu/message.h:libl4/l4/gnu/message.h
+ include/l4/gnu/misc.h:libl4/l4/gnu/misc.h
+ include/l4/gnu/schedule.h:libl4/l4/gnu/schedule.h
+ include/l4/gnu/space.h:libl4/l4/gnu/space.h
+ include/l4/gnu/syscall.h:libl4/l4/gnu/syscall.h
+ include/l4/gnu/thread.h:libl4/l4/gnu/thread.h
+ include/l4/gnu/types.h:libl4/l4/gnu/types.h
include/l4/bits/ipc.h:libl4/${arch}/l4/bits/ipc.h
include/l4/bits/kip.h:libl4/${arch}/l4/bits/kip.h
include/l4/bits/math.h:libl4/${arch}/l4/bits/math.h
@@ -37,4 +57,11 @@ AC_CONFIG_LINKS([
include/l4/bits/syscall.h:libl4/${arch}/l4/bits/syscall.h
include/l4/bits/types.h:libl4/${arch}/l4/bits/types.h
include/l4/bits/vregs.h:libl4/${arch}/l4/bits/vregs.h
+ include/l4/bits/compat/ipc.h:libl4/${arch}/l4/bits/compat/ipc.h
+ include/l4/bits/compat/misc.h:libl4/${arch}/l4/bits/compat/misc.h
+ include/l4/bits/compat/space.h:libl4/${arch}/l4/bits/compat/space.h
+ include/l4/bits/gnu/ipc.h:libl4/${arch}/l4/bits/gnu/ipc.h
+ include/l4/bits/gnu/kip.h:libl4/${arch}/l4/bits/gnu/kip.h
+ include/l4/bits/gnu/misc.h:libl4/${arch}/l4/bits/gnu/misc.h
+ include/l4/bits/gnu/space.h:libl4/${arch}/l4/bits/gnu/space.h
])
diff --git a/libl4/ia32/Makefile.am b/libl4/ia32/Makefile.am
index 6dc68a9..2c14602 100644
--- a/libl4/ia32/Makefile.am
+++ b/libl4/ia32/Makefile.am
@@ -1,5 +1,5 @@
# Makefile.am - Makefile template for libl4/ia32.
-# Copyright (C) 2003 Free Software Foundation, Inc.
+# Copyright (C) 2003, 2004 Free Software Foundation, Inc.
# Written by Marcus Brinkmann.
#
# This file is part of the GNU Hurd.
@@ -22,4 +22,8 @@ nobase_include_HEADERS = l4/bits/types.h \
l4/bits/math.h l4/bits/vregs.h l4/bits/syscall.h \
l4/bits/stubs.h l4/bits/stubs-init.h \
l4/bits/kip.h l4/bits/space.h l4/bits/ipc.h \
- l4/bits/misc.h
+ l4/bits/misc.h \
+ l4/bits/compat/ipc.h l4/bits/compat/misc.h \
+ l4/bits/compat/space.h \
+ l4/bits/gnu/ipc.h l4/bits/gnu/kip.h l4/bits/gnu/misc.h \
+ l4/bits/compat/space.h
diff --git a/libl4/ia32/l4/bits/compat/ipc.h b/libl4/ia32/l4/bits/compat/ipc.h
new file mode 100644
index 0000000..5df0dec
--- /dev/null
+++ b/libl4/ia32/l4/bits/compat/ipc.h
@@ -0,0 +1,29 @@
+/* l4/bits/compat/ipc.h - L4 IPC features for ia32.
+ Copyright (C) 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_IPC_H
+# error "Never use <l4/bits/compat/ipc.h> directly; include <l4/ipc.h> instead."
+#endif
+
+
+#define L4_AllocateNewCacheLines _L4_ALLOCATE_NEW_CACHE_LINES
+#define L4_DoNotAllocateNewCacheLines _L4_DO_NOT_ALLOCATE_NEW_CACHE_LINES
+#define L4_AllocateOnlyNewCacheLines _L4_ALLOCATE_ONLY_NEW_CACHE_LINES
diff --git a/libl4/ia32/l4/bits/compat/misc.h b/libl4/ia32/l4/bits/compat/misc.h
new file mode 100644
index 0000000..e8780ca
--- /dev/null
+++ b/libl4/ia32/l4/bits/compat/misc.h
@@ -0,0 +1,31 @@
+/* l4/bits/compat/misc.h - L4 miscellaneous features for ia32.
+ Copyright (C) 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
+# error "Never use <l4/bits/compat/misc.h> directly; include <l4/misc.h> instead."
+#endif
+
+
+#define L4_UncacheableMemory _L4_UNCACHEABLE_MEMORY
+#define L4_WriteCombiningMemory _L4_WRITE_COMBINING_MEMORY
+#define L4_WriteThroughMemory _L4_WRITE_THROUGH_MEMORY
+#define L4_WriteProtectedMemory _L4_WRITE_PROTECTED_MEMORY
+#define L4_WriteBackMemory _L4_WRITE_BACK_MEMORY
diff --git a/libl4/ia32/l4/bits/compat/space.h b/libl4/ia32/l4/bits/compat/space.h
new file mode 100644
index 0000000..79ea8d3
--- /dev/null
+++ b/libl4/ia32/l4/bits/compat/space.h
@@ -0,0 +1,60 @@
+/* l4/bits/compat/space.h - L4 space features for ia32.
+ Copyright (C) 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_SPACE_H
+# error "Never use <l4/bits/compat/space.h> directly; include <l4/space.h> instead."
+#endif
+
+
+/* IO Fpages. */
+
+static inline L4_Fpage_t
+_L4_attribute_always_inline
+L4_IoFpage (L4_Word_t base_address, int size)
+{
+ L4_Fpage_t f;
+
+ f.raw = _L4_io_fpage (base_address, size);
+ return f;
+}
+
+
+static inline L4_Fpage_t
+_L4_attribute_always_inline
+L4_IoFpageLog2 (L4_Word_t base_address, int size_log2)
+{
+ L4_Fpage_t f;
+
+ f.raw = _L4_io_fpage_log2 (base_address, size_log2);
+ return f;
+}
+
+
+/* L4_SpaceControl control argument. */
+
+#define L4_LargeSpace _L4_LARGE_SPACE
+
+static inline L4_Word_t
+_L4_attribute_always_inline
+L4_SmallSpace (L4_Word_t loc, L4_Word_t size)
+{
+ return _L4_small_space (loc, size);
+}
diff --git a/libl4/ia32/l4/bits/gnu/ipc.h b/libl4/ia32/l4/bits/gnu/ipc.h
new file mode 100644
index 0000000..e3e1cec
--- /dev/null
+++ b/libl4/ia32/l4/bits/gnu/ipc.h
@@ -0,0 +1,29 @@
+/* l4/bits/gnu/ipc.h - GNU L4 IPC features for ia32.
+ Copyright (C) 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_IPC_H
+# error "Never use <l4/bits/gnu/ipc.h> directly; include <l4/ipc.h> instead."
+#endif
+
+
+#define L4_ALLOCATE_NEW_CACHE_LINES _L4_ALLOCATE_NEW_CACHE_LINES
+#define L4_DO_NOT_ALLOCATE_NEW_CACHE_LINES _L4_DO_NOT_ALLOCATE_NEW_CACHE_LINES
+#define L4_ALLOCATE_ONLY_NEW_CACHE_LINES _L4_ALLOCATE_ONLY_NEW_CACHE_LINES
diff --git a/libl4/ia32/l4/bits/gnu/kip.h b/libl4/ia32/l4/bits/gnu/kip.h
new file mode 100644
index 0000000..8daec62
--- /dev/null
+++ b/libl4/ia32/l4/bits/gnu/kip.h
@@ -0,0 +1,28 @@
+/* l4/bits/gnu/kip.h - L4 KIP features GNU interface for ia32.
+ Copyright (C) 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_KIP_H
+# error "Never use <l4/bits/gnu/kip.h> directly; include <l4/kip.h> instead."
+#endif
+
+
+/* Kernel features. */
+#define L4_FEATURE_SMALLSPACES _L4_FEATURE_SMALLSPACES
diff --git a/libl4/ia32/l4/bits/gnu/misc.h b/libl4/ia32/l4/bits/gnu/misc.h
new file mode 100644
index 0000000..1631a86
--- /dev/null
+++ b/libl4/ia32/l4/bits/gnu/misc.h
@@ -0,0 +1,31 @@
+/* l4/bits/gnu/misc.h - GNU L4 miscellaneous features for ia32.
+ Copyright (C) 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
+# error "Never use <l4/bits/gnu/misc.h> directly; include <l4/misc.h> instead."
+#endif
+
+
+#define L4_UNCACHEABLE_MEMORY _L4_UNCACHEABLE_MEMORY
+#define L4_WRITE_COMBINING_MEMORY _L4_WRITE_COMBINING_MEMORY
+#define L4_WRITE_THROUGH_MEMORY _L4_WRITE_THROUGH_MEMORY
+#define L4_WRITE_PROTECTED_MEMORY _L4_WRITE_PROTECTED_MEMORY
+#define L4_WRITE_BACK_MEMORY _L4_WRITE_BACK_MEMORY
diff --git a/libl4/ia32/l4/bits/gnu/space.h b/libl4/ia32/l4/bits/gnu/space.h
new file mode 100644
index 0000000..91ae6a4
--- /dev/null
+++ b/libl4/ia32/l4/bits/gnu/space.h
@@ -0,0 +1,43 @@
+/* l4/bits/gnu/space.h - GNU L4 space features for ia32.
+ Copyright (C) 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_SPACE_H
+# error "Never use <l4/bits/gnu/space.h> directly; include <l4/space.h> instead."
+#endif
+
+
+/* IO Fpages. */
+
+static inline l4_fpage_t l4_io_fpage (l4_word_t base_address, int size)
+ _L4_attribute_alias (_L4_io_fpage);
+
+static inline l4_fpage_t l4_io_fpage_log2 (l4_word_t base_address,
+ int log2_size)
+ _L4_attribute_alias (_L4_io_fpage_log2);
+
+
+/* l4_space_control control argument. */
+
+#define L4_LARGE_SPACE _L4_LARGE_SPACE
+#define L4_SMALL_SPACE _L4_SMALL_SPACE
+
+static inline l4_word_t l4_small_space (l4_word_t loc, l4_word_t size)
+ _L4_attribute_alias (_L4_small_space);
diff --git a/libl4/ia32/l4/bits/ipc.h b/libl4/ia32/l4/bits/ipc.h
index 2de735c..4c18f2c 100644
--- a/libl4/ia32/l4/bits/ipc.h
+++ b/libl4/ia32/l4/bits/ipc.h
@@ -1,5 +1,5 @@
-/* ipc.h - L4 IPC features for ia32.
- Copyright (C) 2003 Free Software Foundation, Inc.
+/* l4/bits/ipc.h - L4 IPC features for ia32.
+ Copyright (C) 2003, 2004 Free Software Foundation, Inc.
Written by Marcus Brinkmann <marcus@gnu.org>.
This file is part of the GNU L4 library.
@@ -23,6 +23,16 @@
# error "Never use <l4/bits/ipc.h> directly; include <l4/ipc.h> instead."
#endif
-#define l4_allocate_new_cache_lines 1
-#define l4_do_not_allocate_new_cache_lines 2
-#define l4_allocate_only_new_cache_lines 3
+
+#define _L4_ALLOCATE_NEW_CACHE_LINES 1
+#define _L4_DO_NOT_ALLOCATE_NEW_CACHE_LINES 2
+#define _L4_ALLOCATE_ONLY_NEW_CACHE_LINES 3
+
+
+/* Now incorporate the public interfaces the user has selected. */
+#ifdef _L4_INTERFACE_L4
+#include <l4/bits/compat/ipc.h>
+#endif
+#ifdef _L4_INTERFACE_GNU
+#include <l4/bits/gnu/ipc.h>
+#endif
diff --git a/libl4/ia32/l4/bits/kip.h b/libl4/ia32/l4/bits/kip.h
index 574ea5d..d628a96 100644
--- a/libl4/ia32/l4/bits/kip.h
+++ b/libl4/ia32/l4/bits/kip.h
@@ -1,5 +1,5 @@
-/* kip.h - L4 KIP features for powerpc.
- Copyright (C) 2003 Free Software Foundation, Inc.
+/* l4/bits/kip.h - L4 KIP features for ia32.
+ Copyright (C) 2003, 2004 Free Software Foundation, Inc.
Written by Marcus Brinkmann <marcus@gnu.org>.
This file is part of the GNU L4 library.
@@ -23,5 +23,12 @@
# error "Never use <l4/bits/kip.h> directly; include <l4/kip.h> instead."
#endif
+
/* Kernel features. */
-#define L4_FEATURE_SMALLSPACES "smallspaces"
+#define _L4_FEATURE_SMALLSPACES "smallspaces"
+
+
+/* Now incorporate the public interfaces the user has selected. */
+#ifdef _L4_INTERFACE_GNU
+#include <l4/bits/gnu/kip.h>
+#endif
diff --git a/libl4/ia32/l4/bits/math.h b/libl4/ia32/l4/bits/math.h
index dc7fe04..d8c2929 100644
--- a/libl4/ia32/l4/bits/math.h
+++ b/libl4/ia32/l4/bits/math.h
@@ -1,5 +1,5 @@
-/* math.h - Math support routines for ia32.
- Copyright (C) 2003 Free Software Foundation, Inc.
+/* l4/bits/math.h - Math support routines for ia32.
+ Copyright (C) 2003, 2004 Free Software Foundation, Inc.
Written by Marcus Brinkmann <marcus@gnu.org>.
This file is part of the GNU L4 library.
@@ -25,11 +25,11 @@
/* Calculate the MSB set in DATA. DATA is not 0. */
-static inline l4_word_t
-__attribute__((__always_inline__, __const__))
-__l4_msb (l4_word_t data)
+static inline _L4_word_t
+_L4_attribute_always_inline _L4_attribute_const
+__L4_msb (_L4_word_t data)
{
- l4_word_t msb;
+ _L4_word_t msb;
__asm__ ("bsr %[data], %[msb]"
: [msb] "=r" (msb)
@@ -40,11 +40,11 @@ __l4_msb (l4_word_t data)
/* Calculate the LSB set in DATA. DATA is not 0. */
-static inline l4_word_t
-__attribute__((__always_inline__, __const__))
-__l4_lsb (l4_word_t data)
+static inline _L4_word_t
+_L4_attribute_always_inline _L4_attribute_const
+__L4_lsb (_L4_word_t data)
{
- l4_word_t lsb;
+ _L4_word_t lsb;
__asm__ ("bsf %[data], %[lsb]"
: [lsb] "=r" (lsb)
diff --git a/libl4/ia32/l4/bits/misc.h b/libl4/ia32/l4/bits/misc.h
index 236c9ed..db28426 100644
--- a/libl4/ia32/l4/bits/misc.h
+++ b/libl4/ia32/l4/bits/misc.h
@@ -1,5 +1,5 @@
-/* misc.h - L4 miscellaneous definitions for ia32.
- Copyright (C) 2003 Free Software Foundation, Inc.
+/* l4/bits/misc.h - L4 miscellaneous definitions for ia32.
+ Copyright (C) 2003, 2004 Free Software Foundation, Inc.
Written by Marcus Brinkmann <marcus@gnu.org>.
This file is part of the GNU L4 library.
@@ -23,8 +23,18 @@
# error "Never use <l4/bits/misc.h> directly; include <l4/misc.h> instead."
#endif
-#define l4_uncacheable_memory 1
-#define l4_write_combining_memory 2
-#define l4_write_through_memory 5
-#define l4_write_protected_memory 6
-#define l4_write_back_memory 7
+
+#define _L4_UNCACHEABLE_MEMORY (_L4_WORD_C(1))
+#define _L4_WRITE_COMBINING_MEMORY (_L4_WORD_C(2))
+#define _L4_WRITE_THROUGH_MEMORY (_L4_WORD_C(5))
+#define _L4_WRITE_PROTECTED_MEMORY (_L4_WORD_C(6))
+#define _L4_WRITE_BACK_MEMORY (_L4_WORD_C(7))
+
+
+/* Now incorporate the public interfaces the user has selected. */
+#ifdef _L4_INTERFACE_L4
+#include <l4/bits/compat/misc.h>
+#endif
+#ifdef _L4_INTERFACE_GNU
+#include <l4/bits/gnu/misc.h>
+#endif
diff --git a/libl4/ia32/l4/bits/space.h b/libl4/ia32/l4/bits/space.h
index 99d8fb1..6483bc9 100644
--- a/libl4/ia32/l4/bits/space.h
+++ b/libl4/ia32/l4/bits/space.h
@@ -1,5 +1,5 @@
-/* space.h - Architecture dependent part of public interface to L4 threads.
- Copyright (C) 2003 Free Software Foundation, Inc.
+/* l4/bits/space.h - L4 spaces definitions for ia32.
+ Copyright (C) 2003, 2004 Free Software Foundation, Inc.
Written by Marcus Brinkmann <marcus@gnu.org>.
This file is part of the GNU L4 library.
@@ -23,69 +23,78 @@
# error "Never use <l4/bits/space.h> directly; include <l4/space.h> instead."
#endif
+#include <l4/math.h>
+
/* IO Fpages. */
+typedef _L4_word_t _L4_io_fpage_t;
+
typedef _L4_RAW
-(l4_word_t, _L4_STRUCT1
+(_L4_io_fpage_t, _L4_STRUCT1
({
_L4_BITFIELD4
- (l4_word_t,
+ (_L4_word_t,
_L4_BITFIELD (rights, 4),
_L4_BITFIELD (_two, 2),
_L4_BITFIELD (log2_size, 6),
_L4_BITFIELD_32_64 (base, 16, 48));
- })) l4_io_fpage_t;
-
+ })) __L4_io_fpage_t;
-static inline l4_fpage_t
-__attribute__((__always_inline__))
-l4_io_fpage (l4_word_t base_address, int size)
+
+static inline _L4_fpage_t
+_L4_attribute_always_inline
+_L4_io_fpage (_L4_word_t base_address, int size)
{
- l4_fpage_t fpage;
- l4_io_fpage_t io_fpage;
- l4_word_t msb = __l4_msb (size);
+ __L4_io_fpage_t io_fpage;
+ _L4_word_t msb = _L4_msb (size);
io_fpage.rights = 0;
io_fpage._two = 2;
io_fpage.log2_size = (1 << msb) == size ? msb : msb + 1;
io_fpage.base = base_address;
- fpage.raw = io_fpage.raw;
- return fpage;
+ return io_fpage.raw;
}
-static inline l4_fpage_t
-__attribute__((__always_inline__))
-l4_io_fpage_log2 (l4_word_t base_address, int log2_size)
+static inline _L4_fpage_t
+_L4_attribute_always_inline
+_L4_io_fpage_log2 (_L4_word_t base_address, int log2_size)
{
- l4_fpage_t fpage;
- l4_io_fpage_t io_fpage;
+ __L4_io_fpage_t io_fpage;
io_fpage.rights = 0;
io_fpage._two = 2;
io_fpage.log2_size = log2_size;
io_fpage.base = base_address;
- fpage.raw = io_fpage.raw;
- return fpage;
+ return io_fpage.raw;
}
-/* l4_space_control control argument. */
+/* _L4_space_control control argument. */
-#define L4_LARGE_SPACE 0
-#define L4_SMALL_SPACE (1 << 31)
+#define _L4_LARGE_SPACE (_L4_WORD_C(0))
+#define _L4_SMALL_SPACE (_L4_WORD_C(1) << 31)
/* LOC and SIZE are in MB. */
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_small_space (l4_word_t loc, l4_word_t size)
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_small_space (_L4_word_t loc, _L4_word_t size)
{
- l4_word_t small_space = loc >> 1; /* Divide by 2 (MB). */
- l4_word_t two_pow_p = size >> 2; /* Divide by 4 (MB). */
+ _L4_word_t small_space = loc >> 1; /* Divide by 2 (MB). */
+ _L4_word_t two_pow_p = size >> 2; /* Divide by 4 (MB). */
/* Make P the LSB of small_space. */
small_space = (small_space & ~(two_pow_p - 1)) | two_pow_p;
return small_space & 0xff;
}
+
+
+/* Now incorporate the public interfaces the user has selected. */
+#ifdef _L4_INTERFACE_L4
+#include <l4/bits/compat/space.h>
+#endif
+#ifdef _L4_INTERFACE_GNU
+#include <l4/bits/gnu/space.h>
+#endif
diff --git a/libl4/ia32/l4/bits/stubs-init.h b/libl4/ia32/l4/bits/stubs-init.h
index 1ad673e..d7aef85 100644
--- a/libl4/ia32/l4/bits/stubs-init.h
+++ b/libl4/ia32/l4/bits/stubs-init.h
@@ -31,7 +31,7 @@ extern void (*__l4_ ## name) (void); \
/* Initialize the syscall stubs. */
static inline void
-__attribute__((__always_inline__))
+_L4_attribute_always_inline
l4_init_stubs (void)
{
__L4_SETUP_SYSCALL (exchange_registers);
diff --git a/libl4/ia32/l4/bits/syscall.h b/libl4/ia32/l4/bits/syscall.h
index 389d3f9..8bd6c5a 100644
--- a/libl4/ia32/l4/bits/syscall.h
+++ b/libl4/ia32/l4/bits/syscall.h
@@ -27,10 +27,10 @@
/* Return the pointer to the kernel interface page, the API version,
the API flags, and the kernel ID. */
-static inline l4_kip_t
-__attribute__((__always_inline__, __const__))
-l4_kernel_interface (l4_api_version_t *api_version, l4_api_flags_t *api_flags,
- l4_kernel_id_t *kernel_id)
+static inline _L4_kip_t
+_L4_attribute_always_inline _L4_attribute_const
+_L4_kernel_interface (_L4_api_version_t *api_version,
+ _L4_api_flags_t *api_flags, _L4_kernel_id_t *kernel_id)
{
void *kip;
@@ -39,18 +39,18 @@ l4_kernel_interface (l4_api_version_t *api_version, l4_api_flags_t *api_flags,
version in %ecx, the API flags in %edx, and the kernel ID in
%esi. */
__asm__ (" lock; nop\n"
- : "=a" (kip), "=c" (api_version->raw),
- "=d" (api_flags->raw), "=S" (kernel_id->raw));
+ : "=a" (kip), "=c" (*api_version),
+ "=d" (*api_flags), "=S" (*kernel_id));
return kip;
}
static inline void
-__attribute__((__always_inline__))
-l4_exchange_registers (l4_thread_id_t *dest, l4_word_t *control,
- l4_word_t *sp, l4_word_t *ip, l4_word_t *flags,
- l4_word_t *user_defined_handle, l4_thread_id_t *pager)
+_L4_attribute_always_inline
+_L4_exchange_registers (_L4_thread_id_t *dest, _L4_word_t *control,
+ _L4_word_t *sp, _L4_word_t *ip, _L4_word_t *flags,
+ _L4_word_t *user_defined_handle, _L4_thread_id_t *pager)
{
/* We can not invoke the system call directly using GCC inline
assembler, as the system call requires the PAGER argument to be
@@ -62,9 +62,9 @@ l4_exchange_registers (l4_thread_id_t *dest, l4_word_t *control,
register used to hold the array pointer. */
struct
{
- l4_word_t ebp;
- l4_word_t esi;
- } regs = { pager->raw, *ip };
+ _L4_word_t ebp;
+ _L4_word_t esi;
+ } regs = { *pager, *ip };
__asm__ __volatile__ ("pushl %%ebp\n"
"pushl %%esi\n"
@@ -82,44 +82,44 @@ l4_exchange_registers (l4_thread_id_t *dest, l4_word_t *control,
/* Pop %esi that was returned from the syscall. */
"popl %%esi\n"
"popl %%ebp\n"
- : "=a" (dest->raw), "=c" (*control), "=d" (*sp),
+ : "=a" (*dest), "=c" (*control), "=d" (*sp),
"=S" (*ip), "=D" (*flags), "=b" (*user_defined_handle)
- : "a" (dest->raw), "c" (*control), "d" (*sp),
+ : "a" (*dest), "c" (*control), "d" (*sp),
"S" (&regs), "D" (*flags), "b" (*user_defined_handle)
: "memory");
- pager->raw = regs.ebp;
+ *pager = regs.ebp;
return;
}
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_thread_control (l4_thread_id_t dest, l4_thread_id_t space,
- l4_thread_id_t scheduler, l4_thread_id_t pager,
- void *utcb_loc)
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_thread_control (_L4_thread_id_t dest, _L4_thread_id_t space,
+ _L4_thread_id_t scheduler, _L4_thread_id_t pager,
+ void *utcb_loc)
{
- l4_word_t result;
- l4_word_t dummy;
+ _L4_word_t result;
+ _L4_word_t dummy;
__asm__ __volatile__ ("push %%ebp\n"
"call *__l4_thread_control\n"
"pop %%ebp\n"
: "=a" (result), "=c" (dummy),
"=d" (dummy), "=S" (dummy), "=D" (dummy)
- : "a" (dest.raw), "c" (pager.raw),
- "d" (scheduler.raw), "S" (space.raw),
+ : "a" (dest), "c" (pager),
+ "d" (scheduler), "S" (space),
"D" (utcb_loc)
: "ebx");
return result;
}
-static inline l4_clock_t
-__attribute__((__always_inline__))
-l4_system_clock (void)
+static inline _L4_clock_t
+_L4_attribute_always_inline
+_L4_system_clock (void)
{
- l4_clock_t time;
+ _L4_clock_t time;
__asm__ __volatile__ ("call *__l4_system_clock"
: "=A" (time)
@@ -131,23 +131,23 @@ l4_system_clock (void)
static inline void
-__attribute__((__always_inline__))
-l4_thread_switch (l4_thread_id_t dest)
+_L4_attribute_always_inline
+_L4_thread_switch (_L4_thread_id_t dest)
{
__asm__ __volatile__ ("call *__l4_thread_switch"
:
- : "a" (dest.raw));
+ : "a" (dest));
}
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_schedule (l4_thread_id_t dest, l4_word_t time_control,
- l4_word_t proc_control, l4_word_t prio,
- l4_word_t preempt_control, l4_word_t *old_time_control)
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_schedule (_L4_thread_id_t dest, _L4_word_t time_control,
+ _L4_word_t proc_control, _L4_word_t prio,
+ _L4_word_t preempt_control, _L4_word_t *old_time_control)
{
- l4_word_t result;
- l4_word_t dummy;
+ _L4_word_t result;
+ _L4_word_t dummy;
__asm__ __volatile__ ("push %%ebp\n"
"call *__l4_schedule\n"
@@ -163,15 +163,15 @@ l4_schedule (l4_thread_id_t dest, l4_word_t time_control,
static inline void
-__attribute__((__always_inline__))
-l4_unmap (l4_word_t control)
+_L4_attribute_always_inline
+_L4_unmap (_L4_word_t control)
{
- l4_word_t mr0;
- l4_word_t utcb;
- l4_word_t dummy;
+ _L4_word_t mr0;
+ _L4_word_t utcb;
+ _L4_word_t dummy;
- l4_store_mr (0, &mr0);
- utcb = (l4_word_t) __l4_utcb ();
+ _L4_store_mr (0, &mr0);
+ utcb = (_L4_word_t) _L4_utcb ();
__asm__ __volatile__ ("push %%ebp\n"
"call *__l4_unmap\n"
@@ -182,105 +182,106 @@ l4_unmap (l4_word_t control)
}
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_space_control (l4_thread_id_t space, l4_word_t control,
- l4_fpage_t kip_area, l4_fpage_t utcb_area,
- l4_thread_id_t redirector, l4_word_t *old_control)
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_space_control (_L4_thread_id_t space, _L4_word_t control,
+ _L4_fpage_t kip_area, _L4_fpage_t utcb_area,
+ _L4_thread_id_t redirector, _L4_word_t *old_control)
{
- l4_word_t result;
- l4_word_t dummy;
+ _L4_word_t result;
+ _L4_word_t dummy;
__asm__ __volatile__ ("push %%ebp\n"
"call *__l4_space_control\n"
"pop %%ebp\n"
: "=a" (result), "=c" (*old_control),
"=d" (dummy), "=S" (dummy), "=D" (dummy)
- : "a" (space.raw), "c" (control),
- "d" (kip_area.raw), "S" (utcb_area.raw),
- "D" (redirector.raw)
+ : "a" (space), "c" (control),
+ "d" (kip_area), "S" (utcb_area),
+ "D" (redirector)
: "ebx");
return result;
}
-static inline l4_msg_tag_t
-__attribute__((__always_inline__))
-l4_ipc (l4_thread_id_t to, l4_thread_id_t from_spec,
- l4_word_t timeouts, l4_thread_id_t *from)
+static inline _L4_msg_tag_t
+_L4_attribute_always_inline
+_L4_ipc (_L4_thread_id_t to, _L4_thread_id_t from_spec,
+ _L4_word_t timeouts, _L4_thread_id_t *from)
{
- l4_word_t mr[2];
- l4_word_t utcb;
- l4_msg_tag_t tag;
- l4_thread_id_t result;
- l4_word_t dummy;
+ _L4_word_t mr[2];
+ _L4_word_t utcb;
+ _L4_msg_tag_t tag;
+ _L4_thread_id_t result;
+ _L4_word_t dummy;
- utcb = (l4_word_t) __l4_utcb ();
- l4_store_mr (0, &tag.raw);
- l4_store_mr (1, &mr[0]);
- l4_store_mr (2, &mr[1]);
+ utcb = (_L4_word_t) _L4_utcb ();
+ _L4_store_mr (0, &tag);
+ _L4_store_mr (1, &mr[0]);
+ _L4_store_mr (2, &mr[1]);
__asm__ __volatile__ ("push %%ebp\n"
"call *__l4_ipc\n"
"movl %%ebp, %%ecx\n"
"pop %%ebp\n"
- : "=a" (result.raw), "=c" (mr[1]), "=d" (dummy),
- "=S" (tag.raw), "=b" (mr[0])
- : "a" (to.raw), "c" (timeouts), "d" (from_spec.raw),
- "S" (tag.raw), "D" (utcb));
- /* FIXME: Make it so that we can use l4_is_nilthread? */
- if (from_spec.raw)
+ : "=a" (result), "=c" (mr[1]), "=d" (dummy),
+ "=S" (tag), "=b" (mr[0])
+ : "a" (to), "c" (timeouts), "d" (from_spec),
+ "S" (tag), "D" (utcb));
+ /* FIXME: Make it so that we can use _L4_is_nilthread? */
+ if (from_spec)
{
*from = result;
- l4_load_mr (1, mr[0]);
- l4_load_mr (2, mr[1]);
+ _L4_load_mr (1, mr[0]);
+ _L4_load_mr (2, mr[1]);
}
return tag;
}
-static inline l4_msg_tag_t
-__attribute__((__always_inline__))
-l4_lipc (l4_thread_id_t to, l4_thread_id_t from_spec,
- l4_word_t timeouts, l4_thread_id_t *from)
+static inline _L4_msg_tag_t
+_L4_attribute_always_inline
+_L4_lipc (_L4_thread_id_t to, _L4_thread_id_t from_spec,
+ _L4_word_t timeouts, _L4_thread_id_t *from)
{
- l4_word_t mr[2];
- l4_word_t utcb;
- l4_msg_tag_t tag;
- l4_thread_id_t result;
- l4_word_t dummy;
+ _L4_word_t mr[2];
+ _L4_word_t utcb;
+ _L4_msg_tag_t tag;
+ _L4_thread_id_t result;
+ _L4_word_t dummy;
- utcb = (l4_word_t) __l4_utcb ();
- l4_store_mr (0, &tag.raw);
- l4_store_mr (1, &mr[0]);
- l4_store_mr (2, &mr[1]);
+ utcb = (_L4_word_t) _L4_utcb ();
+ _L4_store_mr (0, &tag);
+ _L4_store_mr (1, &mr[0]);
+ _L4_store_mr (2, &mr[1]);
__asm__ __volatile__ ("push %%ebp\n"
"call *__l4_lipc\n"
"movl %%ebp, %%ecx\n"
"pop %%ebp\n"
- : "=a" (result.raw), "=c" (mr[1]), "=d" (dummy),
- "=S" (tag.raw), "=b" (mr[0])
- : "a" (to.raw), "c" (timeouts), "d" (from_spec.raw),
- "S" (tag.raw), "D" (utcb));
- /* FIXME: Make it so that we can use l4_is_nilthread? */
- if (from_spec.raw)
+ : "=a" (result), "=c" (mr[1]), "=d" (dummy),
+ "=S" (tag), "=b" (mr[0])
+ : "a" (to), "c" (timeouts), "d" (from_spec),
+ "S" (tag), "D" (utcb));
+ /* FIXME: Make it so that we can use _L4_is_nilthread? */
+ if (from_spec)
{
*from = result;
- l4_load_mr (1, mr[0]);
- l4_load_mr (2, mr[1]);
+ _L4_load_mr (1, mr[0]);
+ _L4_load_mr (2, mr[1]);
}
return tag;
}
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_processor_control (l4_word_t proc, l4_word_t control, l4_word_t int_freq,
- l4_word_t ext_freq, l4_word_t voltage)
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_processor_control (_L4_word_t proc, _L4_word_t control,
+ _L4_word_t int_freq, _L4_word_t ext_freq,
+ _L4_word_t voltage)
{
- l4_word_t result;
- l4_word_t dummy;
+ _L4_word_t result;
+ _L4_word_t dummy;
__asm__ __volatile__ ("push %%ebp\n"
"call *__l4_processor_control\n"
@@ -294,21 +295,24 @@ l4_processor_control (l4_word_t proc, l4_word_t control, l4_word_t int_freq,
}
-static inline void
-__attribute__((__always_inline__))
-l4_memory_control (l4_word_t control, l4_word_t *attributes)
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_memory_control (_L4_word_t control, _L4_word_t *attributes)
{
- l4_word_t tag;
- l4_word_t dummy;
+ _L4_word_t tag;
+ _L4_word_t result;
+ _L4_word_t dummy;
- l4_store_mr (0, &tag);
+ _L4_store_mr (0, &tag);
__asm__ __volatile__ ("push %%ebp\n"
"call *__l4_memory_control\n"
"pop %%ebp\n"
- : "=a" (dummy), "=c" (dummy), "=d" (dummy),
+ : "=a" (result), "=c" (dummy), "=d" (dummy),
"=S" (dummy), "=D" (dummy), "=b" (dummy)
: "a" (tag), "c" (control), "d" (attributes[0]),
"S" (attributes[1]), "D" (attributes[2]),
"b" (attributes[3]));
+
+ return result;
}
diff --git a/libl4/ia32/l4/bits/types.h b/libl4/ia32/l4/bits/types.h
index f4724f4..44da460 100644
--- a/libl4/ia32/l4/bits/types.h
+++ b/libl4/ia32/l4/bits/types.h
@@ -1,5 +1,5 @@
-/* types.h - L4 machine type definitions for ia32.
- Copyright (C) 2003 Free Software Foundation, Inc.
+/* l4/bits/types.h - L4 machine type definitions for ia32.
+ Copyright (C) 2003, 2004 Free Software Foundation, Inc.
Written by Marcus Brinkmann <marcus@gnu.org>.
This file is part of the GNU L4 library.
@@ -23,8 +23,9 @@
# error "Never use <l4/bits/types.h> directly; include <l4/types.h> instead."
#endif
+
/* ia32 has 32 bits per word. */
-#define L4_WORDSIZE L4_WORDSIZE_32
+#define _L4_WORDSIZE _L4_WORDSIZE_32
/* ia32 is little-endian. */
-#define L4_BYTE_ORDER L4_LITTLE_ENDIAN
+#define _L4_BYTE_ORDER _L4_LITTLE_ENDIAN
diff --git a/libl4/ia32/l4/bits/vregs.h b/libl4/ia32/l4/bits/vregs.h
index 02beea2..dec2d53 100644
--- a/libl4/ia32/l4/bits/vregs.h
+++ b/libl4/ia32/l4/bits/vregs.h
@@ -1,5 +1,5 @@
-/* vregs.h - L4 virtual registers for ia32.
- Copyright (C) 2003 Free Software Foundation, Inc.
+/* l4/bits/vregs.h - L4 virtual registers for ia32.
+ Copyright (C) 2003, 2004 Free Software Foundation, Inc.
Written by Marcus Brinkmann <marcus@gnu.org>.
This file is part of the GNU L4 library.
@@ -25,11 +25,11 @@
/* Retrieve the UTCB address. */
-static inline l4_word_t *
-__attribute__((__always_inline__, __const__))
-__l4_utcb (void)
+static inline _L4_word_t *
+_L4_attribute_always_inline
+_L4_utcb (void)
{
- l4_word_t *utcb;
+ _L4_word_t *utcb;
__asm__ ("movl %%gs:0, %[utcb]"
: [utcb] "=r" (utcb));
@@ -39,402 +39,388 @@ __l4_utcb (void)
/* Offsets of various elements in the UTCB, relativ to the UTCB
address. */
-#define __L4_UTCB_MR0 0
-#define __L4_UTCB_THREAD_WORD0 -4
-#define __L4_UTCB_THREAD_WORD1 -5
-#define __L4_UTCB_SENDER -6
-#define __L4_UTCB_RECEIVER -7
-#define __L4_UTCB_TIMEOUT -8
-#define __L4_UTCB_ERROR_CODE -9
-#define __L4_UTCB_FLAGS -10
-#define __L4_UTCB_EXC_HANDLER -11
-#define __L4_UTCB_PAGER -12
-#define __L4_UTCB_USER_HANDLE -13
-#define __L4_UTCB_PROCESSOR_NO -14
-#define __L4_UTCB_MY_GLOBAL_ID -15
-#define __L4_UTCB_BR0 -16
+#define _L4_UTCB_MR0 0
+#define _L4_UTCB_THREAD_WORD0 -4
+#define _L4_UTCB_THREAD_WORD1 -5
+#define _L4_UTCB_SENDER -6
+#define _L4_UTCB_RECEIVER -7
+#define _L4_UTCB_TIMEOUT -8
+#define _L4_UTCB_ERROR_CODE -9
+#define _L4_UTCB_FLAGS -10
+#define _L4_UTCB_EXC_HANDLER -11
+#define _L4_UTCB_PAGER -12
+#define _L4_UTCB_USER_HANDLE -13
+#define _L4_UTCB_PROCESSOR_NO -14
+#define _L4_UTCB_MY_GLOBAL_ID -15
+#define _L4_UTCB_BR0 -16
/* Get the local thread ID. */
-static inline l4_thread_id_t
-__attribute__((__always_inline__))
-l4_my_local_id (void)
+static inline _L4_thread_id_t
+_L4_attribute_always_inline
+_L4_my_local_id (void)
{
- l4_thread_id_t id;
-
/* Local thread ID is equal to the UTCB address. */
- id.raw = (l4_word_t) __l4_utcb ();
-
- return id;
+ return (_L4_word_t) _L4_utcb ();
}
/* Get the global thread ID. */
-static inline l4_thread_id_t
-__attribute__((__always_inline__))
-l4_my_global_id (void)
+static inline _L4_thread_id_t
+_L4_attribute_always_inline
+_L4_my_global_id (void)
{
- l4_thread_id_t id;
- l4_word_t *utcb = __l4_utcb ();
+ _L4_word_t *utcb = _L4_utcb ();
- id.raw = utcb[__L4_UTCB_MY_GLOBAL_ID];
- return id;
+ return utcb[_L4_UTCB_MY_GLOBAL_ID];
}
static inline int
-__attribute__((__always_inline__))
-l4_processor_no (void)
+_L4_attribute_always_inline
+_L4_processor_no (void)
{
- l4_word_t *utcb = __l4_utcb ();
+ _L4_word_t *utcb = _L4_utcb ();
- return utcb[__L4_UTCB_PROCESSOR_NO];
+ return utcb[_L4_UTCB_PROCESSOR_NO];
}
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_user_defined_handle (void)
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_user_defined_handle (void)
{
- l4_word_t *utcb = __l4_utcb ();
+ _L4_word_t *utcb = _L4_utcb ();
- return utcb[__L4_UTCB_USER_HANDLE];
+ return utcb[_L4_UTCB_USER_HANDLE];
}
static inline void
-__attribute__((__always_inline__))
-l4_set_user_defined_handle (l4_word_t data)
+_L4_attribute_always_inline
+_L4_set_user_defined_handle (_L4_word_t data)
{
- l4_word_t *utcb = __l4_utcb ();
+ _L4_word_t *utcb = _L4_utcb ();
- utcb[__L4_UTCB_USER_HANDLE] = data;
+ utcb[_L4_UTCB_USER_HANDLE] = data;
}
-static inline l4_thread_id_t
-__attribute__((__always_inline__))
-l4_pager (void)
+static inline _L4_thread_id_t
+_L4_attribute_always_inline
+_L4_pager (void)
{
- l4_thread_id_t thread;
- l4_word_t *utcb = __l4_utcb ();
+ _L4_word_t *utcb = _L4_utcb ();
- thread.raw = utcb[__L4_UTCB_PAGER];
- return thread;
+ return utcb[_L4_UTCB_PAGER];
}
static inline void
-__attribute__((__always_inline__))
-l4_set_pager (l4_thread_id_t thread)
+_L4_attribute_always_inline
+_L4_set_pager (_L4_thread_id_t thread)
{
- l4_word_t *utcb = __l4_utcb ();
+ _L4_word_t *utcb = _L4_utcb ();
- utcb[__L4_UTCB_PAGER] = thread.raw;
+ utcb[_L4_UTCB_PAGER] = thread;
}
-static inline l4_thread_id_t
-__attribute__((__always_inline__))
-l4_exception_handler (void)
+static inline _L4_thread_id_t
+_L4_attribute_always_inline
+_L4_exception_handler (void)
{
- l4_thread_id_t thread;
- l4_word_t *utcb = __l4_utcb ();
+ _L4_word_t *utcb = _L4_utcb ();
- thread.raw = utcb[__L4_UTCB_EXC_HANDLER];
- return thread;
+ return utcb[_L4_UTCB_EXC_HANDLER];
}
static inline void
-__attribute__((__always_inline__))
-l4_set_exception_handler (l4_thread_id_t thread)
+_L4_attribute_always_inline
+_L4_set_exception_handler (_L4_thread_id_t thread)
{
- l4_word_t *utcb = __l4_utcb ();
+ _L4_word_t *utcb = _L4_utcb ();
- utcb[__L4_UTCB_EXC_HANDLER] = thread.raw;
+ utcb[_L4_UTCB_EXC_HANDLER] = thread;
}
static inline void
-__attribute__((__always_inline__))
-l4_clr_cop_flag (l4_word_t n)
+_L4_attribute_always_inline
+_L4_clr_cop_flag (_L4_word_t n)
{
- l4_word_t *utcb = __l4_utcb ();
+ _L4_word_t *utcb = _L4_utcb ();
/* The second byte in the flags field contains the coprocessor
flags. */
__asm__ ("andl %[mask], %[where]"
:
: [mask] "ir" (~(1 << (8 + n))),
- [where] "m" (utcb[__L4_UTCB_FLAGS]));
+ [where] "m" (utcb[_L4_UTCB_FLAGS]));
}
static inline void
-__attribute__((__always_inline__))
-l4_set_cop_flag (l4_word_t n)
+_L4_attribute_always_inline
+_L4_set_cop_flag (_L4_word_t n)
{
- l4_word_t *utcb = __l4_utcb ();
+ _L4_word_t *utcb = _L4_utcb ();
/* The second byte in the flags field contains the coprocessor
flags. */
__asm__ ("orl %[mask], %[where]"
:
: [mask] "ir" (1 << (8 + n)),
- [where] "m" (utcb[__L4_UTCB_FLAGS]));
+ [where] "m" (utcb[_L4_UTCB_FLAGS]));
}
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_disable_preemption_fault_exception (void)
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_disable_preemption_fault_exception (void)
{
- l4_word_t *utcb = __l4_utcb ();
- l4_uint8_t result;
+ _L4_word_t *utcb = _L4_utcb ();
+ _L4_uint8_t result;
/* The first byte in the flags field contains the preemption
flags. The sixth bit is the signal bit*/
__asm__ ("btr %[offset], %[base]\n"
"setc %[result]"
: [result] "=r" (result)
- : [offset] "i" (5), [base] "m" (utcb[__L4_UTCB_FLAGS]));
+ : [offset] "i" (5), [base] "m" (utcb[_L4_UTCB_FLAGS]));
return result;
}
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_enable_preemption_fault_exception (void)
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_enable_preemption_fault_exception (void)
{
- l4_word_t *utcb = __l4_utcb ();
- l4_uint8_t result;
+ _L4_word_t *utcb = _L4_utcb ();
+ _L4_uint8_t result;
/* The first byte in the flags field contains the preemption
flags. The sixth bit is the signal flag. */
__asm__ ("bts %[offset], %[base]\n"
"setc %[result]"
: [result] "=r" (result)
- : [offset] "i" (5), [base] "m" (utcb[__L4_UTCB_FLAGS]));
+ : [offset] "i" (5), [base] "m" (utcb[_L4_UTCB_FLAGS]));
return result;
}
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_disable_preemption (void)
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_disable_preemption (void)
{
- l4_word_t *utcb = __l4_utcb ();
- l4_uint8_t result;
+ _L4_word_t *utcb = _L4_utcb ();
+ _L4_uint8_t result;
/* The first byte in the flags field contains the preemption
flags. The seventh bit is the delay flag. */
__asm__ ("btr %[offset], %[base]\n"
"setc %[result]"
: [result] "=r" (result)
- : [offset] "i" (6), [base] "m" (utcb[__L4_UTCB_FLAGS]));
+ : [offset] "i" (6), [base] "m" (utcb[_L4_UTCB_FLAGS]));
return result;
}
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_enable_preemption (void)
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_enable_preemption (void)
{
- l4_word_t *utcb = __l4_utcb ();
- l4_uint8_t result;
+ _L4_word_t *utcb = _L4_utcb ();
+ _L4_uint8_t result;
/* The first byte in the flags field contains the preemption
flags. The seventh bit is the delay flag. */
__asm__ ("bts %[offset], %[base]\n"
"setc %[result]"
: [result] "=r" (result)
- : [offset] "i" (6), [base] "m" (utcb[__L4_UTCB_FLAGS]));
+ : [offset] "i" (6), [base] "m" (utcb[_L4_UTCB_FLAGS]));
return result;
}
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_preemption_pending (void)
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_preemption_pending (void)
{
- l4_word_t *utcb = __l4_utcb ();
- l4_uint8_t result;
+ _L4_word_t *utcb = _L4_utcb ();
+ _L4_uint8_t result;
/* The first byte in the flags field contains the preemption
flags. The eighth bit is the pending flag. */
__asm__ ("btr %[offset], %[base]\n"
"setc %[result]"
: [result] "=r" (result)
- : [offset] "i" (7), [base] "m" (utcb[__L4_UTCB_FLAGS]));
+ : [offset] "i" (7), [base] "m" (utcb[_L4_UTCB_FLAGS]));
return result;
}
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_error_code (void)
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_error_code (void)
{
- l4_word_t *utcb = __l4_utcb ();
+ _L4_word_t *utcb = _L4_utcb ();
- return utcb[__L4_UTCB_ERROR_CODE];
+ return utcb[_L4_UTCB_ERROR_CODE];
}
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_xfer_timeout (void)
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_xfer_timeouts (void)
{
- l4_word_t *utcb = __l4_utcb ();
+ _L4_word_t *utcb = _L4_utcb ();
- return utcb[__L4_UTCB_TIMEOUT];
+ return utcb[_L4_UTCB_TIMEOUT];
}
static inline void
-__attribute__((__always_inline__))
-l4_set_xfer_timeout (l4_word_t time)
+_L4_attribute_always_inline
+_L4_set_xfer_timeouts (_L4_word_t time)
{
- l4_word_t *utcb = __l4_utcb ();
+ _L4_word_t *utcb = _L4_utcb ();
- utcb[__L4_UTCB_TIMEOUT] = time;
+ utcb[_L4_UTCB_TIMEOUT] = time;
}
-static inline l4_thread_id_t
-__attribute__((__always_inline__))
-l4_intended_receiver (void)
+static inline _L4_thread_id_t
+_L4_attribute_always_inline
+_L4_intended_receiver (void)
{
- l4_thread_id_t thread;
- l4_word_t *utcb = __l4_utcb ();
+ _L4_word_t *utcb = _L4_utcb ();
- thread.raw = utcb[__L4_UTCB_RECEIVER];
- return thread;
+ return utcb[_L4_UTCB_RECEIVER];
}
-static inline l4_thread_id_t
-__attribute__((__always_inline__))
-l4_actual_sender (void)
+static inline _L4_thread_id_t
+_L4_attribute_always_inline
+_L4_actual_sender (void)
{
- l4_thread_id_t thread;
- l4_word_t *utcb = __l4_utcb ();
+ _L4_word_t *utcb = _L4_utcb ();
- thread.raw = utcb[__L4_UTCB_SENDER];
- return thread;
+ return utcb[_L4_UTCB_SENDER];
}
static inline void
-__attribute__((__always_inline__))
-l4_set_virtual_sender (l4_thread_id_t thread)
+_L4_attribute_always_inline
+_L4_set_virtual_sender (_L4_thread_id_t thread)
{
- l4_word_t *utcb = __l4_utcb ();
+ _L4_word_t *utcb = _L4_utcb ();
- utcb[__L4_UTCB_SENDER] = thread.raw;
+ utcb[_L4_UTCB_SENDER] = thread;
}
-/* Message registers (MR0 to MR63) start at offset __L4_UTCB_MR0 and
+/* Message registers (MR0 to MR63) start at offset _L4_UTCB_MR0 and
go upward. */
-/* Set message register NR to DATA. */
+/* Store message register NR in DATA. */
static inline void
-__attribute__((__always_inline__))
-l4_load_mr (int nr, l4_word_t data)
+_L4_attribute_always_inline
+_L4_store_mr (int nr, _L4_word_t *data)
{
- l4_word_t *mr = __l4_utcb () + __L4_UTCB_MR0;
+ _L4_word_t *mr = _L4_utcb () + _L4_UTCB_MR0;
- mr[nr] = data;
+ *data = mr[nr];
}
-/* Set COUNT message registers beginning from START to the values in
- DATA. */
+/* Store COUNT message registers beginning from START in DATA. */
static inline void
-__attribute__((__always_inline__))
-l4_load_mrs (int start, int count, l4_word_t *data)
+_L4_attribute_always_inline
+_L4_store_mrs (int start, int count, _L4_word_t *data)
{
- l4_word_t *mr = __l4_utcb () + __L4_UTCB_MR0 + start;
+ _L4_word_t *mr = _L4_utcb () + _L4_UTCB_MR0 + start;
while (count--)
- *(mr++) = *(data++);
+ *(data++) = *(mr++);
}
-/* Store message register NR in DATA. */
+/* Set message register NR to DATA. */
static inline void
-__attribute__((__always_inline__))
-l4_store_mr (int nr, l4_word_t *data)
+_L4_attribute_always_inline
+_L4_load_mr (int nr, _L4_word_t data)
{
- l4_word_t *mr = __l4_utcb () + __L4_UTCB_MR0;
+ _L4_word_t *mr = _L4_utcb () + _L4_UTCB_MR0;
- *data = mr[nr];
+ mr[nr] = data;
}
-/* Store COUNT message registers beginning from START in DATA. */
+/* Set COUNT message registers beginning from START to the values in
+ DATA. */
static inline void
-__attribute__((__always_inline__))
-l4_store_mrs (int start, int count, l4_word_t *data)
+_L4_attribute_always_inline
+_L4_load_mrs (int start, int count, _L4_word_t *data)
{
- l4_word_t *mr = __l4_utcb () + __L4_UTCB_MR0 + start;
+ _L4_word_t *mr = _L4_utcb () + _L4_UTCB_MR0 + start;
while (count--)
- *(data++) = *(mr++);
+ *(mr++) = *(data++);
}
+
-/* Buffer registers (BR0 to BR31) start at offset __L4_UTCB_BR0 and go
+/* Buffer registers (BR0 to BR31) start at offset _L4_UTCB_BR0 and go
downward. */
-/* Set message register NR to DATA. */
+/* Store message register NR in DATA. */
static inline void
-__attribute__((__always_inline__))
-l4_load_br (int nr, l4_word_t data)
+_L4_attribute_always_inline
+_L4_store_br (int nr, _L4_word_t *data)
{
- l4_word_t *br = __l4_utcb () + __L4_UTCB_BR0;
+ _L4_word_t *br = _L4_utcb () + _L4_UTCB_BR0;
- br[nr] = data;
+ *data = br[nr];
}
-/* Set COUNT message registers beginning from START to the values in
- DATA. */
+/* Store COUNT message registers beginning from START in DATA. */
static inline void
-__attribute__((__always_inline__))
-l4_load_brs (int start, int count, l4_word_t *data)
+_L4_attribute_always_inline
+_L4_store_brs (int start, int count, _L4_word_t *data)
{
- l4_word_t *br = __l4_utcb () + __L4_UTCB_BR0 - start;
+ _L4_word_t *br = _L4_utcb () + _L4_UTCB_BR0 - start;
while (count--)
- *(br--) = *(data--);
+ *(data--) = *(br--);
}
-
-/* Store message register NR in DATA. */
+/* Set message register NR to DATA. */
static inline void
-__attribute__((__always_inline__))
-l4_store_br (int nr, l4_word_t *data)
+_L4_attribute_always_inline
+_L4_load_br (int nr, _L4_word_t data)
{
- l4_word_t *br = __l4_utcb () + __L4_UTCB_BR0;
+ _L4_word_t *br = _L4_utcb () + _L4_UTCB_BR0;
- *data = br[nr];
+ br[nr] = data;
}
-/* Store COUNT message registers beginning from START in DATA. */
+/* Set COUNT message registers beginning from START to the values in
+ DATA. */
static inline void
-__attribute__((__always_inline__))
-l4_store_brs (int start, int count, l4_word_t *data)
+_L4_attribute_always_inline
+_L4_load_brs (int start, int count, _L4_word_t *data)
{
- l4_word_t *br = __l4_utcb () + __L4_UTCB_BR0 - start;
+ _L4_word_t *br = _L4_utcb () + _L4_UTCB_BR0 - start;
while (count--)
- *(data--) = *(br--);
+ *(br--) = *(data--);
}
diff --git a/libl4/l4.h b/libl4/l4.h
index d1e538d..22b7b17 100644
--- a/libl4/l4.h
+++ b/libl4/l4.h
@@ -24,11 +24,11 @@
#include <l4/types.h>
#include <l4/syscall.h>
+#include <l4/kip.h>
#include <l4/thread.h>
#include <l4/schedule.h>
#include <l4/space.h>
#include <l4/ipc.h>
#include <l4/misc.h>
-#include <l4/kip.h>
#endif /* l4.h */
diff --git a/libl4/l4/compat/ipc.h b/libl4/l4/compat/ipc.h
new file mode 100644
index 0000000..a98ad8f
--- /dev/null
+++ b/libl4/l4/compat/ipc.h
@@ -0,0 +1,1231 @@
+/* l4/compat/ipc.h - Public interface for L4 IPC.
+ Copyright (C) 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_IPC_H
+# error "Never use <l4/compat/ipc.h> directly; include <l4/ipc.h> instead."
+#endif
+
+
+/* 5.1 Messages And Message Registers (MRs) [Virtual Registers] */
+
+/* Generic Programming Interface. */
+typedef struct
+{
+ L4_Word_t raw;
+} L4_MsgTag_t;
+
+
+#define L4_Niltag ((L4_MsgTag_t) { .raw = _L4_niltag })
+
+static inline L4_Bool_t
+_L4_attribute_always_inline
+#if defined(__cplusplus)
+operator == (const L4_MsgTag_t& l, const L4_MsgTag_t& r)
+#else
+IsMsgTagEqual (L4_MsgTag_t l, L4_MsgTag_t r)
+#endif
+{
+ return _L4_is_msg_tag_equal (l.raw, r.raw);
+}
+
+
+static inline L4_Bool_t
+_L4_attribute_always_inline
+#if defined(__cplusplus)
+operator != (const L4_MsgTag_t& l, const L4_MsgTag_t& r)
+#else
+IsMsgTagNotEqual (L4_MsgTag_t l, L4_MsgTag_t r)
+#endif
+{
+ return _L4_is_msg_tag_not_equal (l.raw, r.raw);
+}
+
+
+static inline L4_Word_t
+_L4_attribute_always_inline
+L4_Label (L4_MsgTag_t t)
+{
+ return _L4_label (t.raw);
+}
+
+
+static inline L4_Word_t
+_L4_attribute_always_inline
+L4_UntypedWords (L4_MsgTag_t t)
+{
+ return _L4_untyped_words (t.raw);
+}
+
+
+static inline L4_Word_t
+_L4_attribute_always_inline
+L4_TypedWords (L4_MsgTag_t t)
+{
+ return _L4_typed_words (t.raw);
+}
+
+
+static inline L4_MsgTag_t
+_L4_attribute_always_inline
+#if defined(__cplusplus)
+operator + (const L4_MsgTag_t& l, const L4_Word_t& r)
+#else
+MsgTagAddLabel (const L4_MsgTag_t l, const L4_Word_t r)
+#endif
+{
+ L4_MsgTag_t tag;
+
+ tag.raw = _L4_msg_tag_add_label (l.raw, r);
+ return tag;
+}
+
+
+static inline L4_MsgTag_t *
+_L4_attribute_always_inline
+#if defined(__cplusplus)
+operator += (L4_MsgTag_t *l, const L4_Word_t& r)
+#else
+MsgTagAddLabelTo (L4_MsgTag_t *l, const L4_Word_t r)
+#endif
+{
+ _L4_msg_tag_add_label_to (&l->raw, r);
+ return l;
+}
+
+
+static inline L4_MsgTag_t
+_L4_attribute_always_inline
+L4_MsgTag (void)
+{
+ L4_MsgTag_t tag;
+
+ tag.raw = _L4_msg_tag ();
+ return tag;
+}
+
+
+static inline void
+_L4_attribute_always_inline
+L4_Set_MsgTag_t (L4_MsgTag_t tag)
+{
+ _L4_set_msg_tag (tag.raw);
+}
+
+
+/* Convenience Programming Interface. */
+
+typedef struct
+{
+ L4_Word_t raw[64];
+} L4_Msg_t;
+
+
+static inline void
+_L4_attribute_always_inline
+#if defined(__cplusplus)
+L4_Put (L4_Msg_t *msg, L4_Word_t l, int u, L4_Word_t *ut, int t, void *items)
+#else
+L4_MsgPut (L4_Msg_t *msg, L4_Word_t l, int u, L4_Word_t *ut,
+ int t, void *items)
+#endif
+{
+ _L4_msg_put (msg->raw, l, u, ut, t, items);
+}
+
+
+static inline void
+_L4_attribute_always_inline
+#if defined(__cplusplus)
+L4_Get (L4_Msg_t *msg, L4_Word_t *ut, void *items)
+#else
+L4_MsgGet (L4_Msg_t *msg, L4_Word_t *ut, void *items)
+#endif
+{
+ _L4_msg_get (msg->raw, ut, items);
+}
+
+
+static inline L4_MsgTag_t
+_L4_attribute_always_inline
+#if defined(__cplusplus)
+L4_MsgTag (L4_Msg_t *msg)
+#else
+L4_MsgMsgTag (L4_Msg_t *msg)
+#endif
+{
+ L4_MsgTag_t tag;
+
+ tag.raw = _L4_msg_msg_tag (msg->raw);
+ return tag;
+}
+
+
+static inline void
+_L4_attribute_always_inline
+#if defined(__cplusplus)
+L4_Set_MsgTag (L4_Msg_t *msg, L4_MsgTag_t t)
+#else
+L4_Set_MsgMsgTag (L4_Msg_t *msg, L4_MsgTag_t t)
+#endif
+{
+ _L4_set_msg_msg_tag (msg->raw, t.raw);
+}
+
+
+static inline L4_Word_t
+_L4_attribute_always_inline
+#if defined(__cplusplus)
+L4_MsgLabel (L4_Msg_t *msg)
+#else
+L4_MsgMsgLabel (L4_Msg_t *msg)
+#endif
+{
+ return _L4_msg_msg_label (msg->raw);
+}
+
+
+static inline void
+_L4_attribute_always_inline
+#if defined(__cplusplus)
+L4_Set_MsgLabel (L4_Msg_t *msg, L4_Word_t label)
+#else
+L4_Set_MsgMsgLabel (L4_Msg_t *msg, L4_Word_t label)
+#endif
+{
+ _L4_set_msg_msg_label (msg->raw, label);
+}
+
+
+static inline void
+_L4_attribute_always_inline
+#if defined(__cplusplus)
+L4_Load (L4_Msg_t *msg)
+#else
+L4_MsgLoad (L4_Msg_t *msg)
+#endif
+{
+ _L4_msg_load (msg->raw);
+}
+
+
+static inline void
+_L4_attribute_always_inline
+#if defined(__cplusplus)
+L4_Store (L4_Msg_t *msg)
+#else
+L4_MsgStore (L4_MsgTag_t t, L4_Msg_t *msg)
+#endif
+{
+ _L4_msg_store (t.raw, msg->raw);
+}
+
+
+static inline void
+_L4_attribute_always_inline
+#if defined(__cplusplus)
+L4_Clear (L4_Msg_t *msg)
+#else
+L4_MsgClear (L4_Msg_t *msg)
+#endif
+{
+ _L4_msg_clear (msg->raw);
+}
+
+
+/* The L4_Msg* interface is continued below, after defining the item
+ types. */
+
+
+/* Low-Level MR Access is defined by <l4/message.h>. */
+
+
+/* 5.2 MapItem [Data type] */
+
+/* Generic Programming Interface. */
+typedef struct
+{
+ L4_Word_t raw[2];
+} L4_MapItem_t;
+
+
+static inline L4_MapItem_t
+_L4_attribute_always_inline
+L4_MapItem (L4_Fpage_t f, L4_Word_t SndBase)
+{
+ L4_MapItem_t m;
+
+ *((_L4_map_item_t *) m.raw) = _L4_map_item (f.raw, SndBase);
+ return m;
+}
+
+
+static inline L4_Bool_t
+_L4_attribute_always_inline
+#if defined(__cplusplus)
+L4_MapItem (L4_MapItem_t m)
+#else
+L4_IsMapItem (L4_MapItem_t m)
+#endif
+{
+ return _L4_is_map_item (*((_L4_map_item_t *) m.raw));
+}
+
+
+static inline L4_Fpage_t
+_L4_attribute_always_inline
+#if defined(__cplusplus)
+L4_SndFpage (L4_MapItem_t m)
+#else
+L4_MapItemSndFpage (L4_MapItem_t m)
+#endif
+{
+ L4_Fpage_t f;
+
+ f.raw = _L4_map_item_snd_fpage (*((_L4_map_item_t *) m.raw));
+ return f;
+}
+
+
+static inline L4_Word_t
+_L4_attribute_always_inline
+#if defined(__cplusplus)
+L4_SndBase (L4_MapItem_t m)
+#else
+L4_MapItemSndBase (L4_MapItem_t m)
+#endif
+{
+ return _L4_map_item_snd_base (*((_L4_map_item_t *) m.raw));
+}
+
+
+/* 5.3 GrantItem [Data type] */
+
+/* Generic Programming Interface. */
+typedef struct
+{
+ L4_Word_t raw[2];
+} L4_GrantItem_t;
+
+
+static inline L4_GrantItem_t
+_L4_attribute_always_inline
+L4_GrantItem (L4_Fpage_t f, L4_Word_t SndBase)
+{
+ L4_GrantItem_t g;
+
+ *((_L4_grant_item_t *) g.raw) = _L4_grant_item (f.raw, SndBase);
+ return g;
+}
+
+
+static inline L4_Bool_t
+_L4_attribute_always_inline
+#if defined(__cplusplus)
+L4_GrantItem (L4_GrantItem_t g)
+#else
+L4_IsGrantItem (L4_GrantItem_t g)
+#endif
+{
+ return _L4_is_grant_item (*((_L4_grant_item_t *) g.raw));
+}
+
+
+static inline L4_Fpage_t
+_L4_attribute_always_inline
+#if defined(__cplusplus)
+L4_SndFpage (L4_GrantItem_t g)
+#else
+L4_GrantItemSndFpage (L4_GrantItem_t g)
+#endif
+{
+ L4_Fpage_t f;
+
+ f.raw = _L4_grant_item_snd_fpage (*((_L4_grant_item_t *) g.raw));
+ return f;
+}
+
+
+static inline L4_Word_t
+_L4_attribute_always_inline
+#if defined(__cplusplus)
+L4_SndBase (L4_GrantItem_t g)
+#else
+L4_GrantItemSndBase (L4_GrantItem_t g)
+#endif
+{
+ return _L4_grant_item_snd_base (*((_L4_grant_item_t *) g.raw));
+}
+
+
+/* 5.4 StringItem [Data type] */
+
+/* Generic Programming Interface. */
+typedef struct
+{
+ L4_Word_t raw[2];
+} L4_StringItem_t;
+
+
+static inline L4_Bool_t
+_L4_attribute_always_inline
+#if defined(__cplusplus)
+L4_StringItem (L4_StringItem_t *s)
+#else
+L4_IsStringItem (L4_StringItem_t *s)
+#endif
+{
+ return _L4_is_string_item ((_L4_string_item_t *) s->raw);
+}
+
+
+static inline L4_Bool_t
+_L4_attribute_always_inline
+L4_CompoundString (L4_StringItem_t *s)
+{
+ return _L4_compound_string ((_L4_string_item_t *) s->raw);
+}
+
+
+static inline L4_Word_t
+_L4_attribute_always_inline
+L4_Substrings (L4_StringItem_t *s)
+{
+ return _L4_substrings ((_L4_string_item_t *) s->raw);
+}
+
+
+static inline void *
+_L4_attribute_always_inline
+L4_Substring (L4_StringItem_t *s, L4_Word_t n)
+{
+ return _L4_substring ((_L4_string_item_t *) s->raw, n);
+}
+
+
+static inline L4_StringItem_t
+_L4_attribute_always_inline
+L4_StringItem (int size, void *address)
+{
+ L4_StringItem_t s;
+
+ *((_L4_string_item_t *) s.raw) = _L4_string_item (size, address);
+ return s;
+}
+
+
+#if defined(__cplusplus)
+
+/* FIXME: Add L4_StringItem_t& operator += (L4_StringItem_t& dest,
+ L4_StringItem_t Addsub)? */
+
+static inline L4_StringItem_t&
+_L4_attribute_always_inline
+operator += (L4_StringItem_t& dest, L4_StringItem_t &substring)
+{
+ _L4_add_substring_to ((_L4_string_item_t *) dest.raw,
+ (_L4_string_item_t *) substring.raw);
+ return dest;
+}
+
+
+static inline L4_StringItem_t&
+_L4_attribute_always_inline
+operator += (L4_StringItem_t& dest, void *substringAddress)
+{
+ _L4_add_substring_address_to ((_L4_string_item_t *) dest.raw,
+ substringAddress);
+ return dest;
+}
+
+#else
+
+
+static inline L4_StringItem_t *
+_L4_attribute_always_inline
+L4_AddSubstringTo (L4_StringItem_t *dest, L4_StringItem_t *substring)
+{
+ _L4_add_substring_to ((_L4_string_item_t *) dest->raw,
+ (_L4_string_item_t *) substring->raw);
+ return dest;
+}
+
+
+static inline L4_StringItem_t *
+_L4_attribute_always_inline
+L4_AddSubstringAddressTo (L4_StringItem_t *dest, void *substringAddress)
+{
+ _L4_add_substring_address_to ((_L4_string_item_t *) dest->raw,
+ substringAddress);
+ return dest;
+}
+
+#endif
+
+
+/* Convenience Programming Interface. */
+
+typedef struct
+{
+ L4_Word_t raw;
+} L4_CacheAllocationHint_t;
+
+
+#define L4_UseDefaultCacheLineAllocation \
+ ((L4_CacheAllocationHint_t) { .raw = _L4_use_default_cache_line_allocation })
+
+
+static inline L4_Bool_t
+_L4_attribute_always_inline
+#if defined(__cplusplus)
+operator == (const L4_CacheAllocationHint_t l, const L4_CacheAllocationHint_t r)
+#else
+L4_IsCacheAllocationHintEqual (const L4_CacheAllocationHint_t l,
+ const L4_CacheAllocationHint_t r)
+#endif
+{
+ return l.raw == r.raw;
+}
+
+
+static inline L4_Bool_t
+_L4_attribute_always_inline
+#if defined(__cplusplus)
+operator != (const L4_CacheAllocationHint_t l, const L4_CacheAllocationHint_t r)
+#else
+L4_IsCacheAllocationHintNotEqual (const L4_CacheAllocationHint_t l,
+ const L4_CacheAllocationHint_t r)
+#endif
+{
+ return l.raw != r.raw;
+}
+
+
+static inline L4_CacheAllocationHint_t
+_L4_attribute_always_inline
+L4_CacheAllocationHint (L4_StringItem_t s)
+{
+ L4_CacheAllocationHint_t hint;
+
+ hint.raw = _L4_cache_allocation_hint (*((_L4_string_item_t *) s.raw));
+ return hint;
+}
+
+
+#if defined(__cplusplus)
+static inline L4_StringItem_t
+_L4_attribute_always_inline
+operator + (const L4_StringItem_t& s, const L4_CacheAllocationHint hint)
+{
+ L4_StringItem_t _s = s;
+ _L4_add_cache_allocation_hint_to ((_L4_string_item_t *) _s.raw, hint.raw);
+ return _s;
+}
+
+
+static inline L4_StringItem_t&
+_L4_attribute_always_inline
+operator += (const L4_StringItem_t& s, const L4_CacheAllocationHint hint)
+{
+ _L4_add_cache_allocation_hint_to ((_L4_string_item_t *) s.raw, hint.raw);
+ return s;
+}
+
+#else
+
+static inline L4_StringItem_t
+_L4_attribute_always_inline
+L4_AddCacheAllocationHint (const L4_StringItem_t s,
+ const L4_CacheAllocationHint_t hint)
+{
+ L4_StringItem_t _s = s;
+ _L4_add_cache_allocation_hint_to ((_L4_string_item_t *) _s.raw, hint.raw);
+ return _s;
+}
+
+
+
+static inline L4_StringItem_t *
+_L4_attribute_always_inline
+L4_AddCacheAllocationHintTo (L4_StringItem_t *s,
+ const L4_CacheAllocationHint_t hint)
+{
+ _L4_add_cache_allocation_hint_to ((_L4_string_item_t *) s->raw, hint.raw);
+ return s;
+}
+
+#endif
+
+
+/* L4_Msg* interface continued. */
+
+static inline void
+_L4_attribute_always_inline
+#if defined(__cplusplus)
+L4_Append (L4_Msg_t *msg, L4_Word_t w)
+#else
+L4_MsgAppendWord (L4_Msg_t *msg, L4_Word_t w)
+#endif
+{
+ _L4_msg_append_word (msg->raw, w);
+}
+
+
+static inline void
+_L4_attribute_always_inline
+#if defined(__cplusplus)
+L4_Append (L4_Msg_t *msg, L4_MapItem_t m)
+#else
+L4_MsgAppendMapItem (L4_Msg_t *msg, L4_MapItem_t m)
+#endif
+{
+ _L4_msg_append_map_item (msg->raw, *((_L4_map_item_t *) m.raw));
+}
+
+
+static inline void
+_L4_attribute_always_inline
+#if defined(__cplusplus)
+L4_Append (L4_Msg_t *msg, L4_GrantItem_t g)
+#else
+L4_MsgAppendGrantItem (L4_Msg_t *msg, L4_GrantItem_t g)
+#endif
+{
+ _L4_msg_append_grant_item (msg->raw, *((_L4_grant_item_t *) g.raw));
+}
+
+
+static inline void
+_L4_attribute_always_inline
+#if defined(__cplusplus)
+L4_Append (L4_Msg_t *msg, L4_StringItem_t s)
+#else
+L4_MsgAppendSimpleStringItem (L4_Msg_t *msg, L4_StringItem_t s)
+#endif
+{
+ _L4_msg_append_simple_string_item (msg->raw, *((_L4_string_item_t *) s.raw));
+}
+
+
+static inline void
+_L4_attribute_always_inline
+#if defined(__cplusplus)
+L4_Append (L4_Msg_t *msg, L4_StringItem_t *s)
+#else
+L4_MsgAppendStringItem (L4_Msg_t *msg, L4_StringItem_t *s)
+#endif
+{
+ _L4_msg_append_string_item (msg->raw, (_L4_string_item_t *) s->raw);
+}
+
+
+static inline void
+_L4_attribute_always_inline
+#if defined(__cplusplus)
+L4_Put (L4_Msg_t *msg, L4_Word_t u, L4_Word_t w)
+#else
+L4_MsgPutWord (L4_Msg_t *msg, L4_Word_t u, L4_Word_t w)
+#endif
+{
+ _L4_msg_put_word (msg->raw, u, w);
+}
+
+
+static inline void
+_L4_attribute_always_inline
+#if defined(__cplusplus)
+L4_Put (L4_Msg_t *msg, L4_Word_t t, L4_MapItem_t m)
+#else
+L4_MsgPutMapItem (L4_Msg_t *msg, L4_Word_t t, L4_MapItem_t m)
+#endif
+{
+ _L4_msg_put_map_item (msg->raw, t, *((_L4_map_item_t *) m.raw));
+}
+
+
+static inline void
+_L4_attribute_always_inline
+#if defined(__cplusplus)
+L4_Put (L4_Msg_t *msg, L4_Word_t t, L4_GrantItem_t g)
+#else
+L4_MsgPutGrantItem (L4_Msg_t *msg, L4_Word_t t, L4_GrantItem_t g)
+#endif
+{
+ _L4_msg_put_grant_item (msg->raw, t, *((_L4_grant_item_t *) g.raw));
+}
+
+
+static inline void
+_L4_attribute_always_inline
+#if defined(__cplusplus)
+L4_Put (L4_Msg_t *msg, L4_Word_t t, L4_StringItem_t s)
+#else
+L4_MsgPutSimpleStringItem (L4_Msg_t *msg, L4_Word_t t, L4_StringItem_t s)
+#endif
+{
+ _L4_msg_put_simple_string_item (msg->raw, t, *((_L4_string_item_t *) s.raw));
+}
+
+
+static inline void
+_L4_attribute_always_inline
+#if defined(__cplusplus)
+L4_Put (L4_Msg_t *msg, L4_Word_t t, L4_StringItem_t *s)
+#else
+L4_MsgPutStringItem (L4_Msg_t *msg, L4_Word_t t, L4_StringItem_t *s)
+#endif
+{
+ _L4_msg_put_string_item (msg->raw, t, (_L4_string_item_t *) s->raw);
+}
+
+
+static inline L4_Word_t
+_L4_attribute_always_inline
+#if defined(__cplusplus)
+L4_Get (L4_Msg_t *msg, L4_Word_t u)
+#else
+L4_MsgWord (L4_Msg_t *msg, L4_Word_t u)
+#endif
+{
+ return _L4_msg_word (msg->raw, u);
+}
+
+
+static inline void
+_L4_attribute_always_inline
+#if defined(__cplusplus)
+L4_Get (L4_Msg_t *msg, L4_Word_t u, L4_Word_t *w)
+#else
+L4_MsgGetWord (L4_Msg_t *msg, L4_Word_t u, L4_Word_t *w)
+#endif
+{
+ _L4_msg_get_word (msg->raw, u, w);
+}
+
+
+static inline L4_Word_t
+_L4_attribute_always_inline
+#if defined(__cplusplus)
+L4_Get (L4_Msg_t *msg, L4_Word_t t, L4_MapItem_t *m)
+#else
+L4_MsgGetMapItem (L4_Msg_t *msg, L4_Word_t t, L4_MapItem_t *m)
+#endif
+{
+ return _L4_msg_get_map_item (msg->raw, t, (_L4_map_item_t *) m->raw);
+}
+
+
+static inline L4_Word_t
+_L4_attribute_always_inline
+#if defined(__cplusplus)
+L4_Get (L4_Msg_t *msg, L4_Word_t t, L4_GrantItem_t *g)
+#else
+L4_MsgGetGrantItem (L4_Msg_t *msg, L4_Word_t t, L4_GrantItem_t *g)
+#endif
+{
+ return _L4_msg_get_grant_item (msg->raw, t, (_L4_grant_item_t *) g->raw);
+}
+
+
+static inline L4_Word_t
+_L4_attribute_always_inline
+#if defined(__cplusplus)
+L4_Get (L4_Msg_t *msg, L4_Word_t t, L4_StringItem_t *s)
+#else
+L4_MsgGetStringItem (L4_Msg_t *msg, L4_Word_t t, L4_StringItem_t *s)
+#endif
+{
+ return _L4_msg_get_string_item (msg->raw, t, (_L4_string_item_t *) s->raw);
+}
+
+
+/* 5.5 String Buffers And Buffer Registers (BRs) [Pseudo Registers] */
+
+typedef struct
+{
+ L4_Word_t raw;
+} L4_Acceptor_t;
+
+#define L4_UntypedWordsAcceptor \
+ ((L4_Acceptor_t) { .raw = _L4_untyped_words_acceptor })
+#define L4_StringItemsAcceptor \
+ ((L4_Acceptor_t) { .raw = _L4_string_items_acceptor })
+
+
+static inline L4_Acceptor_t
+_L4_attribute_always_inline
+L4_MapGrantItem (L4_Fpage_t RcvWindow)
+{
+ L4_Acceptor_t a;
+
+ a.raw = _L4_map_grant_items (RcvWindow.raw);
+ return a;
+}
+
+
+static inline L4_Acceptor_t
+_L4_attribute_always_inline
+#if defined(__cplusplus)
+operator + (const L4_Acceptor_t l, const L4_Acceptor_t r)
+#else
+L4_AddAcceptor (const L4_Acceptor_t l, const L4_Acceptor_t r)
+#endif
+{
+ L4_Acceptor_t a;
+
+ a.raw = _L4_add_acceptor (l.raw, r.raw);
+ return a;
+}
+
+
+#if defined(__cplusplus)
+static inline L4_Acceptor_t&
+_L4_attribute_always_inline
+operator += (L4_Acceptor_t& l, const L4_Acceptor_t r)
+{
+ l.raw = _L4_add_acceptor (l.raw, r.raw);
+ return l;
+}
+#endif
+
+
+static inline L4_Acceptor_t *
+_L4_attribute_always_inline
+L4_AddAcceptorTo (L4_Acceptor_t *l, const L4_Acceptor_t r)
+{
+ _L4_add_acceptor_to (&l->raw, r.raw);
+ return l;
+}
+
+
+static inline L4_Acceptor_t
+_L4_attribute_always_inline
+#if defined(__cplusplus)
+operator - (const L4_Acceptor_t l, const L4_Acceptor_t r)
+#else
+L4_RemoveAcceptor (const L4_Acceptor_t l, const L4_Acceptor_t r)
+#endif
+{
+ L4_Acceptor_t a;
+
+ a.raw = _L4_remove_acceptor (l.raw, r.raw);
+ return a;
+}
+
+
+#if defined(__cplusplus)
+static inline L4_Acceptor_t&
+_L4_attribute_always_inline
+operator += (L4_Acceptor_t& l, const L4_Acceptor_t r)
+{
+ l.raw = _L4_remove_acceptor (l.raw, r.raw);
+ return l;
+}
+#endif
+
+
+static inline L4_Acceptor_t *
+_L4_attribute_always_inline
+L4_RemoveAcceptorFrom (L4_Acceptor_t *l, const L4_Acceptor_t r)
+{
+ _L4_remove_acceptor_from (&l->raw, r.raw);
+ return l;
+}
+
+
+static inline L4_Bool_t
+_L4_attribute_always_inline
+#if defined(__cplusplus)
+L4_StringItems (L4_Acceptor_t a)
+#else
+L4_HasStringItems (L4_Acceptor_t a)
+#endif
+{
+ return _L4_has_string_items (a.raw);
+}
+
+
+static inline L4_Bool_t
+_L4_attribute_always_inline
+#if defined(__cplusplus)
+L4_MapGrantItems (L4_Acceptor_t a)
+#else
+L4_HasMapGrantItems (L4_Acceptor_t a)
+#endif
+{
+ return _L4_has_map_grant_items (a.raw);
+}
+
+
+static inline L4_Fpage_t
+_L4_attribute_always_inline
+L4_RcvWindow (L4_Acceptor_t a)
+{
+ L4_Fpage_t f;
+ f.raw = _L4_rcv_window (a.raw);
+ return f;
+}
+
+
+static inline void
+_L4_attribute_always_inline
+L4_Accept (L4_Acceptor_t a)
+{
+ _L4_accept (a.raw);
+}
+
+
+/* L4_AcceptStrings is defined below. */
+static inline L4_Acceptor_t
+_L4_attribute_always_inline
+L4_Accepted (void)
+{
+ L4_Acceptor_t a;
+ a.raw = _L4_accepted ();
+ return a;
+}
+
+
+/* Convenience Programming Interface. */
+
+typedef struct
+{
+ L4_Word_t raw[32];
+} L4_MsgBuffer_t;
+
+
+static inline void
+_L4_attribute_always_inline
+#if defined(__cplusplus)
+L4_Clear (L4_MsgBuffer_t *b)
+#else
+L4_MsgBufferClear (L4_MsgBuffer_t *b)
+#endif
+{
+ _L4_msg_buffer_clear (b->raw);
+}
+
+
+static inline void
+_L4_attribute_always_inline
+#if defined(__cplusplus)
+L4_Append (L4_MsgBuffer_t *b, L4_StringItem_t s)
+#else
+L4_MsgBufferAppendSimpleRcvString (L4_MsgBuffer_t *b, L4_StringItem_t s)
+#endif
+{
+ _L4_msg_buffer_append_simple_rcv_string (b->raw,
+ *((_L4_string_item_t *) s.raw));
+}
+
+
+static inline void
+_L4_attribute_always_inline
+#if defined(__cplusplus)
+L4_Append (L4_MsgBuffer_t *b, L4_StringItem_t *s)
+#else
+L4_MsgBufferAppendRcvString (L4_MsgBuffer_t *b, L4_StringItem_t *s)
+#endif
+{
+ _L4_msg_buffer_append_rcv_string (b->raw, (_L4_string_item_t *) s->raw);
+}
+
+
+/* 5.5 continued. */
+static inline void
+_L4_attribute_always_inline
+#if defined(__cplusplus)
+L4_Accept (L4_Acceptor_t a, L4_MsgBuffer_t *b)
+#else
+L4_AcceptStrings (L4_Acceptor_t a, L4_MsgBuffer_t *b)
+#endif
+{
+ _L4_accept_strings (a.raw, b->raw);
+}
+
+
+/* Low-Level BR Access is defined by <l4/message.h>. */
+
+
+/* 5.6 Ipc [Systemcall] */
+
+/* Generic Programming Interface. */
+
+static inline L4_MsgTag_t
+_L4_attribute_always_inline
+L4_Ipc (L4_ThreadId_t to, L4_ThreadId_t FromSpecifier, L4_Word_t Timeouts,
+ L4_ThreadId_t *from)
+{
+ L4_MsgTag_t t;
+
+ t.raw = _L4_ipc (to.raw, FromSpecifier.raw, Timeouts, &from->raw);
+ return t;
+}
+
+
+static inline L4_MsgTag_t
+_L4_attribute_always_inline
+L4_Lipc (L4_ThreadId_t to, L4_ThreadId_t FromSpecifier, L4_Word_t Timeouts,
+ L4_ThreadId_t *from)
+{
+ L4_MsgTag_t t;
+
+ t.raw = _L4_lipc (to.raw, FromSpecifier.raw, Timeouts, &from->raw);
+ return t;
+}
+
+
+/* Convenience Programming Interface. */
+
+static inline L4_MsgTag_t
+_L4_attribute_always_inline
+L4_Call (L4_ThreadId_t to)
+{
+ L4_MsgTag_t t;
+
+ t.raw = _L4_call (to.raw);
+ return t;
+}
+
+
+static inline L4_MsgTag_t
+_L4_attribute_always_inline
+#if defined(__cplusplus)
+L4_Call (L4_ThreadId_t to, L4_Time_t SndTimeout, L4_Time_t RcvTimeout)
+#else
+L4_Call_Timeouts (L4_ThreadId_t to, L4_Time_t SndTimeout, L4_Time_t RcvTimeout)
+#endif
+{
+ L4_MsgTag_t t;
+
+ t.raw = _L4_call_timeouts (to.raw, SndTimeout.raw, RcvTimeout.raw);
+ return t;
+}
+
+
+static inline L4_MsgTag_t
+_L4_attribute_always_inline
+L4_Send (L4_ThreadId_t to)
+{
+ L4_MsgTag_t t;
+
+ t.raw = _L4_send (to.raw);
+ return t;
+}
+
+
+static inline L4_MsgTag_t
+_L4_attribute_always_inline
+#if defined(__cplusplus)
+L4_Send (L4_ThreadId_t to, L4_Time_t SndTimeout)
+#else
+L4_Send_Timeout (L4_ThreadId_t to, L4_Time_t SndTimeout)
+#endif
+{
+ L4_MsgTag_t t;
+
+ t.raw = _L4_send_timeout (to.raw, SndTimeout.raw);
+ return t;
+}
+
+
+static inline L4_MsgTag_t
+_L4_attribute_always_inline
+L4_Reply (L4_ThreadId_t to)
+{
+ L4_MsgTag_t t;
+
+ t.raw = _L4_reply (to.raw);
+ return t;
+}
+
+
+static inline L4_MsgTag_t
+_L4_attribute_always_inline
+L4_Receive (L4_ThreadId_t from)
+{
+ L4_MsgTag_t t;
+
+ t.raw = _L4_receive (from.raw);
+ return t;
+}
+
+
+static inline L4_MsgTag_t
+_L4_attribute_always_inline
+#if defined(__cplusplus)
+L4_Receive (L4_ThreadId_t from, L4_Time_t RcvTimeout)
+#else
+L4_Receive_Timeout (L4_ThreadId_t from, L4_Time_t RcvTimeout)
+#endif
+{
+ L4_MsgTag_t t;
+
+ t.raw = _L4_receive_timeout (from.raw, RcvTimeout.raw);
+ return t;
+}
+
+
+static inline L4_MsgTag_t
+_L4_attribute_always_inline
+L4_Wait (L4_ThreadId_t *from)
+{
+ L4_MsgTag_t t;
+
+ t.raw = _L4_wait (&from->raw);
+ return t;
+}
+
+
+static inline L4_MsgTag_t
+_L4_attribute_always_inline
+#if defined(__cplusplus)
+L4_Wait (L4_Time_t RcvTimeout, L4_ThreadId_t *from)
+#else
+L4_Wait_Timeout (L4_Time_t RcvTimeout, L4_ThreadId_t *from)
+#endif
+{
+ L4_MsgTag_t t;
+
+ t.raw = _L4_wait_timeout (RcvTimeout.raw, &from->raw);
+ return t;
+}
+
+
+static inline L4_MsgTag_t
+_L4_attribute_always_inline
+L4_ReplyWait (L4_ThreadId_t to, L4_ThreadId_t *from)
+{
+ L4_MsgTag_t t;
+
+ t.raw = _L4_reply_wait (to.raw, &from->raw);
+ return t;
+}
+
+
+static inline L4_MsgTag_t
+_L4_attribute_always_inline
+#if defined(__cplusplus)
+L4_ReplyWait (L4_ThreadId_t to, L4_Time_t RcvTimeout, L4_ThreadId_t *from)
+#else
+L4_ReplyWait_Timeout (L4_ThreadId_t to, L4_Time_t RcvTimeout,
+ L4_ThreadId_t *from)
+#endif
+{
+ L4_MsgTag_t t;
+
+ t.raw = _L4_reply_wait_timeout (to.raw, RcvTimeout.raw, &from->raw);
+ return t;
+}
+
+
+static inline void
+_L4_attribute_always_inline
+L4_Sleep (L4_Time_t t)
+{
+ _L4_sleep (t.raw);
+}
+
+
+static inline L4_MsgTag_t
+_L4_attribute_always_inline
+L4_Lcall (L4_ThreadId_t to)
+{
+ L4_MsgTag_t t;
+
+ t.raw = _L4_lcall (to.raw);
+ return t;
+}
+
+
+static inline L4_MsgTag_t
+_L4_attribute_always_inline
+L4_LreplyWait (L4_ThreadId_t to, L4_ThreadId_t *from)
+{
+ L4_MsgTag_t t;
+
+ t.raw = _L4_lreply_wait (to.raw, &from->raw);
+ return t;
+}
+
+
+/* Support Functions. */
+
+static inline L4_Bool_t
+_L4_attribute_always_inline
+L4_IpcSucceeded (L4_MsgTag_t t)
+{
+ return _L4_ipc_succeeded (t.raw);
+}
+
+
+static inline L4_Bool_t
+_L4_attribute_always_inline
+L4_IpcFailed (L4_MsgTag_t t)
+{
+ return _L4_ipc_failed (t.raw);
+}
+
+
+static inline L4_Bool_t
+_L4_attribute_always_inline
+L4_IpcPropagated (L4_MsgTag_t t)
+{
+ return _L4_ipc_propagated (t.raw);
+}
+
+
+static inline L4_Bool_t
+_L4_attribute_always_inline
+L4_IpcRedirected (L4_MsgTag_t t)
+{
+ return _L4_ipc_redirected (t.raw);
+}
+
+
+static inline L4_Bool_t
+_L4_attribute_always_inline
+L4_IpcXcpu (L4_MsgTag_t t)
+{
+ return _L4_ipc_xcpu (t.raw);
+}
+
+
+/* L4_ErrorCode(), L4_IntendedReceiver() and L4_ActualSender() are
+ defined in <l4/compat/thread.h>. */
+
+
+static inline void
+_L4_attribute_always_inline
+L4_SetPropagation (L4_MsgTag_t *t)
+{
+ return _L4_set_propagation (&t->raw);
+}
+
+
+/* L4_SetVirtualSender() is defined in <l4/compat/thread.h>. */
+
+
+static inline L4_Word_t
+_L4_attribute_always_inline
+L4_Timeouts (L4_Time_t SndTimeout, L4_Time_t RcvTimeout)
+{
+ return _L4_timeouts (SndTimeout.raw, RcvTimeout.raw);
+}
diff --git a/libl4/l4/compat/kip.h b/libl4/l4/compat/kip.h
new file mode 100644
index 0000000..c91e3c2
--- /dev/null
+++ b/libl4/l4/compat/kip.h
@@ -0,0 +1,389 @@
+/* l4/compat/kip.h - Public interface for L4 types.
+ Copyright (C) 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_KIP_H
+# error "Never use <l4/compat/kip.h> directly; include <l4/kip.h> instead."
+#endif
+
+
+/* 1.2 Kernel Interface [Slow Systemcall] */
+
+/* Generic Programming Interface. */
+
+static inline void *
+_L4_attribute_always_inline
+L4_KernelInterface (L4_Word_t *api_version, L4_Word_t *api_flags,
+ L4_Word_t *kernel_id)
+{
+ return _L4_kernel_interface (api_version, api_flags, kernel_id);
+}
+
+
+/* Convenience Programming Interface. */
+
+typedef struct
+{
+ L4_Word_t raw[2];
+} L4_MemoryDesc_t;
+
+typedef struct
+{
+ L4_Word_t raw[2];
+} L4_ProcDesc_t;
+
+
+/* Returns the address of the kernel interface page. */
+static inline void *
+_L4_attribute_always_inline
+#if defined(__cplusplus)
+L4_KernelInterface (void)
+#else
+L4_GetKernelInterface (void)
+#endif
+{
+ _L4_api_version_t api_version;
+ _L4_api_flags_t api_flags;
+ _L4_kernel_id_t kernel_id;
+
+ return _L4_kernel_interface (&api_version, &api_flags, &kernel_id);
+}
+
+
+/* Returns the API version. */
+static inline L4_Word_t
+_L4_attribute_always_inline
+L4_ApiVersion (void)
+{
+ L4_Word_t api_version;
+ L4_Word_t api_flags;
+ L4_Word_t kernel_id;
+
+ _L4_kernel_interface (&api_version, &api_flags, &kernel_id);
+
+ return api_version;
+}
+
+
+/* Returns the API flags. */
+static inline L4_Word_t
+_L4_attribute_always_inline
+L4_ApiFlags (void)
+{
+ L4_Word_t api_version;
+ L4_Word_t api_flags;
+ L4_Word_t kernel_id;
+
+ _L4_kernel_interface (&api_version, &api_flags, &kernel_id);
+
+ return api_flags;
+}
+
+
+/* Returns the kernel ID. */
+static inline L4_Word_t
+_L4_attribute_always_inline
+L4_KernelId (void)
+{
+ L4_Word_t api_version;
+ L4_Word_t api_flags;
+ L4_Word_t kernel_id;
+
+ _L4_kernel_interface (&api_version, &api_flags, &kernel_id);
+
+ return kernel_id;
+}
+
+
+/* Returns the generation date of the kernel in YEAR, MONTH and
+ DAY. */
+static inline void
+_L4_attribute_always_inline
+L4_KernelGenDate (void *kip, L4_Word_t *year, L4_Word_t *month, L4_Word_t *day)
+{
+ _L4_kernel_gen_date (kip, year, month, day);
+}
+
+
+/* Returns the kernel version. */
+static inline L4_Word_t
+_L4_attribute_always_inline
+L4_KernelVersion (void *kip)
+{
+ _L4_kern_desc_t kern = _L4_kernel_desc (kip);
+
+ return kern->version.raw;
+}
+
+
+/* Returns the kernel supplier. */
+static inline L4_Word_t
+_L4_attribute_always_inline
+L4_KernelSupplier (void *kip)
+{
+ _L4_kern_desc_t kern = _L4_kernel_desc (kip);
+
+ return kern->supplier;
+}
+
+
+/* Returns the number of processors. */
+static inline L4_Word_t
+_L4_attribute_always_inline
+L4_NumProcessors (void *kip)
+{
+ return _L4_num_processors (kip);
+}
+
+
+/* Returns the number of memory descriptors. */
+static inline L4_Word_t
+_L4_attribute_always_inline
+L4_NumMemoryDescriptors (void *kip)
+{
+ return _L4_num_memory_desc (kip);
+}
+
+
+/* Returns the page size mask. */
+static inline L4_Word_t
+_L4_attribute_always_inline
+L4_PageSizeMask (void *kip)
+{
+ return _L4_page_size_mask (kip);
+}
+
+
+/* Returns the page rights. */
+static inline L4_Word_t
+_L4_attribute_always_inline
+L4_PageRights (void *kip)
+{
+ return _L4_page_rights (kip);
+}
+
+
+/* Returns the thread ID bits. */
+static inline L4_Word_t
+_L4_attribute_always_inline
+L4_ThreadIdBits (void *kip)
+{
+ return _L4_thread_id_bits (kip);
+}
+
+
+/* Returns the thread ID system base. */
+static inline L4_Word_t
+_L4_attribute_always_inline
+L4_ThreadIdSystemBase (void *kip)
+{
+ return _L4_thread_system_base (kip);
+}
+
+
+/* Returns the thread ID user base. */
+static inline L4_Word_t
+_L4_attribute_always_inline
+L4_ThreadIdUserBase (void *kip)
+{
+ return _L4_thread_user_base (kip);
+}
+
+
+/* Returns the read precision. */
+static inline L4_Word_t
+_L4_attribute_always_inline
+L4_ReadPrecision (void *kip)
+{
+ return _L4_read_precision (kip);
+}
+
+
+/* Returns the schedule precision. */
+static inline L4_Word_t
+_L4_attribute_always_inline
+L4_SchedulePrecision (void *kip)
+{
+ return _L4_schedule_precision (kip);
+}
+
+
+/* Returns the UTCB area size. */
+static inline L4_Word_t
+_L4_attribute_always_inline
+L4_UtcbAreaSizeLog2 (void *kip)
+{
+ return _L4_utcb_area_size_log2 (kip);
+}
+
+
+/* Returns the alignment. */
+static inline L4_Word_t
+_L4_attribute_always_inline
+L4_UtcbAlignmentLog2 (void *kip)
+{
+ return _L4_utcb_alignment_log2 (kip);
+}
+
+
+/* Returns the UTCB size. */
+static inline L4_Word_t
+_L4_attribute_always_inline
+L4_UtcbSize (void *kip)
+{
+ return _L4_utcb_size (kip);
+}
+
+
+/* Returns the KIP area size. */
+static inline L4_Word_t
+_L4_attribute_always_inline
+L4_KipAreaSizeLog2 (void *kip)
+{
+ return _L4_kip_area_size_log2 (kip);
+}
+
+
+/* Returns the boot info field. */
+static inline L4_Word_t
+_L4_attribute_always_inline
+L4_BootInfo (void *kip)
+{
+ return _L4_boot_info (kip);
+}
+
+
+/* Returns the kernel version string. */
+static inline char *
+_L4_attribute_always_inline
+L4_KernelVersionString (void *kip)
+{
+ return _L4_kernel_version_string (kip);
+}
+
+
+/* Returns the NUMth kernel feature string. */
+static inline char *
+_L4_attribute_always_inline
+L4_Feature (void *kip, L4_Word_t num)
+{
+ return _L4_feature (kip, num);
+}
+
+
+/* Returns a pointer to the NUMth memory descriptor. */
+static inline L4_MemoryDesc_t *
+_L4_attribute_always_inline
+L4_MemoryDesc (void *kip, L4_Word_t num)
+{
+ return (L4_MemoryDesc_t *) _L4_memory_desc (kip, num);
+}
+
+
+/* Returns a pointer to the NUMth processor descriptor. */
+static inline L4_ProcDesc_t *
+_L4_attribute_always_inline
+L4_ProcDesc (void *kip, L4_Word_t num)
+{
+ return (L4_ProcDesc_t *) _L4_proc_desc (kip, num);
+}
+
+
+/* Support Functions. */
+
+#define L4_UndefinedMemoryType ((L4_Word_t) _L4_MEMDESC_UNDEFINED)
+#define L4_ConventionalMemoryType ((L4_Word_t) _L4_MEMDESC_CONVENTIONAL)
+#define L4_ReservedMemoryType ((L4_Word_t) _L4_MEMDESC_RESERVED)
+#define L4_DedicatedMemoryType ((L4_Word_t) _L4_MEMDESC_DEDICATED)
+#define L4_SharedMemoryType ((L4_Word_t) _L4_MEMDESC_SHARED)
+#define L4_BootLoaderSpecificMemoryType ((L4_Word_t) _L4_MEMDESC_BOOTLOADER)
+#define L4_ArchitectureSpecificMemoryType ((L4_Word_t) _L4_MEMDESC_ARCH)
+
+
+static inline L4_Bool_t
+_L4_attribute_always_inline
+#if defined(__cplusplus)
+L4_IsVirtual (L4_MemoryDesc_t *mem_desc)
+#else
+L4_IsMemoryDescVirtual (L4_MemoryDesc_t *mem_desc)
+#endif
+{
+ return _L4_is_memory_desc_virtual ((_L4_memory_desc_t) mem_desc);
+}
+
+
+static inline L4_Word_t
+_L4_attribute_always_inline
+#if defined(__cplusplus)
+L4_Type (L4_MemoryDesc_t *mem_desc)
+#else
+L4_MemoryDescType (L4_MemoryDesc_t *mem_desc)
+#endif
+{
+ return _L4_memory_desc_type ((_L4_memory_desc_t) mem_desc);
+}
+
+
+static inline L4_Word_t
+_L4_attribute_always_inline
+#if defined(__cplusplus)
+L4_Low (L4_MemoryDesc_t *mem_desc)
+#else
+L4_MemoryDescLow(L4_MemoryDesc_t *mem_desc)
+#endif
+{
+ return _L4_memory_desc_low ((_L4_memory_desc_t) mem_desc);
+}
+
+
+static inline L4_Word_t
+_L4_attribute_always_inline
+#if defined(__cplusplus)
+L4_High (L4_MemoryDesc_t *mem_desc)
+#else
+L4_MemoryDescHigh (L4_MemoryDesc_t *mem_desc)
+#endif
+{
+ return _L4_memory_desc_high ((_L4_memory_desc_t) mem_desc);
+}
+
+
+static inline L4_Word_t
+_L4_attribute_always_inline
+#if defined(__cplusplus)
+L4_ExternalFreq (L4_ProcDesc_t *proc_desc)
+#else
+L4_ProcDescExternalFreq (L4_ProcDesc_t *proc_desc)
+#endif
+{
+ return _L4_proc_external_freq ((_L4_proc_desc_t) proc_desc);
+}
+
+
+static inline L4_Word_t
+_L4_attribute_always_inline
+#if defined(__cplusplus)
+L4_InternalFreq (L4_ProcDesc_t *proc_desc)
+#else
+L4_ProcDescInternalFreq (L4_ProcDesc_t *proc_desc)
+#endif
+{
+ return _L4_proc_internal_freq ((_L4_proc_desc_t) proc_desc);
+}
diff --git a/libl4/l4/compat/message.h b/libl4/l4/compat/message.h
new file mode 100644
index 0000000..a1b6e6a
--- /dev/null
+++ b/libl4/l4/compat/message.h
@@ -0,0 +1,92 @@
+/* l4/compat/message.h - Public interface to the L4 message registers.
+ Copyright (C) 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_MESSAGE_H
+# error "Never use <l4/compat/message.h> directly; include <l4/message.h> instead."
+#endif
+
+
+/* 1.3 Virtual Registers [Virtual Registers] */
+
+/* Generic Programming Interface. */
+
+static inline void
+_L4_attribute_always_inline
+L4_StoreMR (int i, L4_Word_t *w)
+{
+ _L4_store_mr (i, w);
+}
+
+
+static inline void
+_L4_attribute_always_inline
+L4_LoadMR (int i, L4_Word_t w)
+{
+ _L4_load_mr (i, w);
+}
+
+
+static inline void
+_L4_attribute_always_inline
+L4_StoreMRs (int i, int k, L4_Word_t *w)
+{
+ _L4_store_mrs (i, k, w);
+}
+
+
+static inline void
+_L4_attribute_always_inline
+L4_LoadMRs (int i, int k, L4_Word_t *w)
+{
+ _L4_load_mrs (i, k, w);
+}
+
+
+static inline void
+_L4_attribute_always_inline
+L4_StoreBR (int i, L4_Word_t *w)
+{
+ _L4_store_br (i, w);
+}
+
+
+static inline void
+_L4_attribute_always_inline
+L4_LoadBR (int i, L4_Word_t w)
+{
+ _L4_load_br (i, w);
+}
+
+
+static inline void
+_L4_attribute_always_inline
+L4_StoreBRs (int i, int k, L4_Word_t *w)
+{
+ _L4_store_brs (i, k, w);
+}
+
+
+static inline void
+_L4_attribute_always_inline
+L4_LoadBRs (int i, int k, L4_Word_t *w)
+{
+ _L4_load_brs (i, k, w);
+}
diff --git a/libl4/l4/compat/misc.h b/libl4/l4/compat/misc.h
new file mode 100644
index 0000000..0e4f7df
--- /dev/null
+++ b/libl4/l4/compat/misc.h
@@ -0,0 +1,70 @@
+/* l4/compat/misc.h - Public interface for L4 miscellaneous functions.
+ Copyright (C) 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
+# error "Never use <l4/compat/misc.h> directly; include <l4/misc.h> instead."
+#endif
+
+
+/* 6.3 ProcessorControl [Privileged Systemcall] */
+
+/* Generic Programming Interface. */
+static inline L4_Word_t
+_L4_attribute_always_inline
+L4_ProcessorControl (L4_Word_t ProcessorNo, L4_Word_t control,
+ L4_Word_t InternalFrequency,
+ L4_Word_t ExternalFrequency, L4_Word_t voltage)
+{
+ return _L4_processor_control (ProcessorNo, control, InternalFrequency,
+ ExternalFrequency, voltage);
+}
+
+
+/* 6.4 MemoryControl [Privileged Systemcall] */
+
+/* Generic Programming Interface. */
+static inline L4_Word_t
+_L4_attribute_always_inline
+L4_MemoryControl (L4_Word_t control, L4_Word_t *attributes)
+{
+ return _L4_memory_control (control, attributes);
+}
+
+
+#define L4_DefaultMemory _L4_DEFAULT_MEMORY
+
+
+/* Convenience Programming Interface. */
+
+static inline L4_Word_t
+_L4_attribute_always_inline
+L4_Set_PageAttribute (L4_Fpage_t f, L4_Word_t attribute)
+{
+ return _L4_set_page_attribute (f.raw, attribute);
+}
+
+
+static inline L4_Word_t
+_L4_attribute_always_inline
+L4_Set_PagesAttributes (L4_Word_t n, L4_Fpage_t *f, L4_Word_t *attributes)
+{
+ return _L4_set_pages_attributes (n, &f->raw, attributes);
+}
diff --git a/libl4/l4/compat/schedule.h b/libl4/l4/compat/schedule.h
new file mode 100644
index 0000000..a2664e7
--- /dev/null
+++ b/libl4/l4/compat/schedule.h
@@ -0,0 +1,517 @@
+/* l4/compat/schedule.h - Public interface to the L4 scheduler.
+ Copyright (C) 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_SCHEDULE_H
+# error "Never use <l4/compat/schedule.h> directly; include <l4/schedule.h> instead."
+#endif
+
+
+/* 3.1 Clock [Data Type] */
+
+/* Generic Programming Interface. */
+
+typedef struct
+{
+ L4_Word64_t raw;
+} L4_Clock_t;
+
+
+/* Convenience Programming Interface. */
+
+#if defined(__cplusplus)
+
+#define _L4_CLOCK_OP(op, type) \
+static inline L4_Clock_t \
+_L4_attribute_always_inline \
+operator ## op ## (const L4_Clock_t clock, const type usec) \
+{ \
+ L4_Clock_t new_clock; \
+ new_clock.raw = clock.raw op usec; \
+ return new_clock; \
+}
+
+_L4_CLOCK_OP(+, int)
+_L4_CLOCK_OP(+, L4_Word64_t)
+_L4_CLOCK_OP(-, int)
+_L4_CLOCK_OP(-, L4_Word64_t)
+#undef _L4_CLOCK_OP
+
+
+#define _L4_CLOCK_OP(op) \
+static inline L4_Bool_t \
+_L4_attribute_always_inline \
+operator ## op ## (const L4_Clock_t& clock1, const L4_Clock_t& clock2) \
+{ \
+ return clock1.raw op clock2.raw; \
+}
+
+_L4_CLOCK_OP(<)
+_L4_CLOCK_OP(>)
+_L4_CLOCK_OP(<=)
+_L4_CLOCK_OP(>=)
+_L4_CLOCK_OP(==)
+_L4_CLOCK_OP(!=)
+#undef _L4_CLOCK_OP
+
+#else
+
+#define _L4_CLOCK_OP(name, op) \
+static inline L4_Clock_t \
+_L4_attribute_always_inline \
+L4_Clock ## name ## Usec (const L4_Clock_t clock, const L4_Word64_t usec) \
+{ \
+ L4_Clock_t new_clock; \
+ new_clock.raw = clock.raw op usec; \
+ return new_clock; \
+}
+
+_L4_CLOCK_OP(Add, +)
+_L4_CLOCK_OP(Sub, -)
+#undef _L4_CLOCK_OP
+
+
+#define _L4_CLOCK_OP(name, op) \
+static inline L4_Bool_t \
+_L4_attribute_always_inline \
+L4_Clock ## name (const L4_Clock_t clock1, const L4_Clock_t clock2) \
+{ \
+ return clock1.raw op clock2.raw; \
+}
+
+_L4_CLOCK_OP(Earlier, <)
+_L4_CLOCK_OP(Later, >)
+_L4_CLOCK_OP(Equal, ==)
+_L4_CLOCK_OP(NotEqual, !=)
+#undef _L4_CLOCK_OP
+
+#endif
+
+
+/* 3.2 SystemClock [Systemcall] */
+
+/* Generic Programming Interface. */
+
+static inline L4_Clock_t
+_L4_attribute_always_inline
+L4_SystemClock (void)
+{
+ L4_Clock_t clock;
+
+ clock.raw = _L4_system_clock ();
+ return clock;
+}
+
+
+/* 3.3 Time [Data Type] */
+
+/* Generic Programming Interface. */
+
+typedef struct
+{
+ L4_Word16_t raw;
+} L4_Time_t;
+
+
+#define L4_Never ((L4_Time_t) { .raw = _L4_never })
+#define L4_ZeroTime ((L4_Time_t) { .raw = _L4_zero_time })
+
+
+static inline L4_Time_t
+_L4_attribute_always_inline
+L4_TimePeriod (L4_Word64_t microseconds)
+{
+ L4_Time_t tp;
+
+ tp.raw = _L4_time_period (microseconds);
+ return tp;
+}
+
+
+static inline L4_Time_t
+_L4_attribute_always_inline
+L4_TimePoint (L4_Clock_t at)
+{
+ L4_Time_t tp;
+
+ tp.raw = _L4_time_point (at.raw);
+ return tp;
+}
+
+
+/* Convenience Programming Interface. */
+
+#if defined(__cplusplus)
+
+static inline L4_Time_t
+_L4_attribute_always_inline
+operator + (const L4_Time_t l, const L4_Word_t r)
+{
+ L4_Time_t new_time;
+ new_time.raw = _L4_time_add_usec (l.raw, r);
+ return new_time;
+}
+
+
+static inline L4_Time_t
+_L4_attribute_always_inline
+operator += (const L4_Time_t& l, const L4_Word_t r)
+{
+ l.raw = _L4_time_add_usec (l.raw, r);
+ return l;
+}
+
+
+static inline L4_Time_t
+_L4_attribute_always_inline
+operator - (const L4_Time_t l, const L4_Word_t r)
+{
+ L4_Time_t new_time;
+ new_time.raw = _L4_time_sub_usec (l.raw, r);
+ return new_time;
+}
+
+
+static inline L4_Time_t
+_L4_attribute_always_inline
+operator -= (const L4_Time_t& l, const L4_Word_t r)
+{
+ l.raw = _L4_time_sub_usec (l.raw, r);
+ return l;
+}
+
+
+
+static inline L4_Time_t
+_L4_attribute_always_inline
+operator + (L4_Time_t l, const L4_Time_t r)
+{
+ L4_Time_t new_time;
+ new_time.raw = _L4_time_add (l.raw, r.raw);
+ return new_time;
+}
+
+
+static inline L4_Time_t
+_L4_attribute_always_inline
+operator += (const L4_Time_t& l, const L4_Time_t r)
+{
+ l.raw = _L4_time_add (l.raw, r.raw);
+ return l;
+}
+
+
+static inline L4_Time_t
+_L4_attribute_always_inline
+operator - (const L4_Time_t l, const L4_Time_t r)
+{
+ L4_Time_t new_time;
+ new_time.raw = _L4_time_sub (l.raw, r.raw);
+ return new_time;
+}
+
+
+static inline L4_Time_t
+_L4_attribute_always_inline
+operator -= (L4_Time_t& l, const L4_Time_t r)
+{
+ l.raw = _L4_time_sub (l.raw, r.raw);
+ return l;
+}
+
+
+static inline L4_Time_t
+_L4_attribute_always_inline
+operator < (const L4_Time_t l, const L4_Time_t r)
+{
+ return _L4_is_time_shorter (l.raw, r.raw);
+}
+
+
+static inline L4_Time_t
+_L4_attribute_always_inline
+operator <= (const L4_Time_t l, const L4_Time_t r)
+{
+ return _L4_is_time_shorter (l.raw, r.raw)
+ || _L4_is_time_equal (l.raw, r.raw);
+}
+
+
+static inline L4_Time_t
+_L4_attribute_always_inline
+operator > (const L4_Time_t l, const L4_Time_t r)
+{
+ return _L4_is_time_longer (l.raw, r.raw);
+}
+
+
+static inline L4_Time_t
+_L4_attribute_always_inline
+operator >= (const L4_Time_t l, const L4_Time_t r)
+{
+ return _L4_is_time_longer (l.raw, r.raw)
+ || _L4_is_time_equal (l.raw, r.raw);
+}
+
+
+static inline L4_Time_t
+_L4_attribute_always_inline
+operator == (const L4_Time_t l, const L4_Time_t r)
+{
+ return _L4_is_time_equal (l.raw, r.raw);
+}
+
+
+static inline L4_Time_t
+_L4_attribute_always_inline
+operator != (const L4_Time_t l, const L4_Time_t r)
+{
+ return !_L4_is_time_not_equal (l.raw, r.raw);
+}
+
+#else
+
+static inline L4_Time_t
+_L4_attribute_always_inline
+L4_TimeAddUsec (const L4_Time_t l, const L4_Word_t r)
+{
+ L4_Time_t new_time;
+ new_time.raw = _L4_time_add_usec (l.raw, r);
+ return new_time;
+}
+
+
+static inline L4_Time_t *
+_L4_attribute_always_inline
+L4_TimeAddUsecTo (L4_Time_t *l, const L4_Word_t r)
+{
+ l->raw = _L4_time_add_usec (l->raw, r);
+ return l;
+}
+
+
+static inline L4_Time_t
+_L4_attribute_always_inline
+L4_TimeSubUsec (const L4_Time_t l, const L4_Word_t r)
+{
+ L4_Time_t new_time;
+ new_time.raw = _L4_time_sub_usec (l.raw, r);
+ return new_time;
+}
+
+
+static inline L4_Time_t *
+_L4_attribute_always_inline
+L4_TimeSubUsecFrom (L4_Time_t *l, const L4_Word_t r)
+{
+ l->raw = _L4_time_sub_usec (l->raw, r);
+ return l;
+}
+
+
+static inline L4_Time_t
+_L4_attribute_always_inline
+L4_TimeAdd (const L4_Time_t l, const L4_Time_t r)
+{
+ L4_Time_t new_time;
+ new_time.raw = _L4_time_add (l.raw, r.raw);
+ return new_time;
+}
+
+
+static inline L4_Time_t *
+_L4_attribute_always_inline
+L4_TimeAddTo (L4_Time_t *l, const L4_Time_t r)
+{
+ l->raw = _L4_time_add (l->raw, r.raw);
+ return l;
+}
+
+
+static inline L4_Time_t
+_L4_attribute_always_inline
+L4_TimeSub (const L4_Time_t l, const L4_Time_t r)
+{
+ L4_Time_t new_time;
+ new_time.raw = _L4_time_sub (l.raw, r.raw);
+ return new_time;
+}
+
+
+static inline L4_Time_t *
+_L4_attribute_always_inline
+L4_TimeSubFrom (L4_Time_t *l, const L4_Time_t r)
+{
+ l->raw = _L4_time_sub (l->raw, r.raw);
+ return l;
+}
+
+
+static inline L4_Bool_t
+_L4_attribute_always_inline
+L4_IsTimeLonger (const L4_Time_t l, const L4_Time_t r)
+{
+ return _L4_is_time_longer (l.raw, r.raw);
+}
+
+
+static inline L4_Bool_t
+_L4_attribute_always_inline
+L4_IsTimeShorter (const L4_Time_t l, const L4_Time_t r)
+{
+ return _L4_is_time_shorter (l.raw, r.raw);
+}
+
+
+static inline L4_Bool_t
+_L4_attribute_always_inline
+L4_IsTimeEqual (const L4_Time_t l, const L4_Time_t r)
+{
+ return _L4_is_time_equal (l.raw, r.raw);
+}
+
+
+static inline L4_Bool_t
+_L4_attribute_always_inline
+L4_IsTimeNotEqual (const L4_Time_t l, const L4_Time_t r)
+{
+ return _L4_is_time_not_equal (l.raw, r.raw);
+}
+
+#endif /* _cplusplus */
+
+
+/* 3.4 ThreadSwitch [Systemcall] */
+
+/* Generic Programming Interface. */
+
+static inline void
+_L4_attribute_always_inline
+L4_ThreadSwitch (L4_ThreadId_t thread)
+{
+ _L4_thread_switch (thread.raw);
+}
+
+
+/* Convenience Programming Interface. */
+
+static inline void
+_L4_attribute_always_inline
+L4_Yield (void)
+{
+ _L4_thread_switch (_L4_nilthread);
+}
+
+
+/* 3.5 Schedule [Systemcall] */
+
+/* Generic Programming Interface. */
+static inline L4_Word_t
+_L4_attribute_always_inline
+L4_Schedule (L4_ThreadId_t dest, L4_Word_t time_control,
+ L4_Word_t proc_control, L4_Word_t prio,
+ L4_Word_t preempt_control, L4_Word_t *old_time_control)
+{
+ return _L4_schedule (dest.raw, time_control, proc_control, prio,
+ preempt_control, old_time_control);
+}
+
+
+/* Convenience Programming Interface. */
+
+static inline L4_Word_t
+_L4_attribute_always_inline
+L4_Set_Priority (L4_ThreadId_t dest, L4_Word_t prio)
+{
+ return _L4_set_priority (dest.raw, prio);
+}
+
+
+static inline L4_Word_t
+_L4_attribute_always_inline
+L4_Set_ProcessorNo (L4_ThreadId_t dest, L4_Word_t proc_no)
+{
+ return _L4_set_processor_no (dest.raw, proc_no);
+}
+
+
+static inline L4_Word_t
+_L4_attribute_always_inline
+L4_TimeSlice (L4_ThreadId_t dest, L4_Time_t *ts, L4_Time_t *tq)
+{
+ return _L4_time_slice (dest.raw, &ts->raw, &tq->raw);
+}
+
+
+static inline L4_Word_t
+_L4_attribute_always_inline
+L4_Set_TimeSlice (L4_ThreadId_t dest, L4_Time_t ts, L4_Time_t tq)
+{
+ return _L4_set_time_slice (dest.raw, ts.raw, tq.raw);
+}
+
+
+static inline L4_Word_t
+_L4_attribute_always_inline
+L4_Set_PreemptionDelay (L4_ThreadId_t dest, L4_Word_t sensitivePrio,
+ L4_Word_t maxDelay)
+{
+ return _L4_set_preemption_delay (dest.raw, sensitivePrio, maxDelay);
+}
+
+
+static inline L4_Bool_t
+_L4_attribute_always_inline
+L4_EnablePreemptionFaultException (void)
+{
+ return _L4_enable_preemption_fault_exception ();
+}
+
+
+static inline L4_Bool_t
+_L4_attribute_always_inline
+L4_DisablePreemptionFaultException (void)
+{
+ return _L4_disable_preemption_fault_exception ();
+}
+
+
+static inline L4_Bool_t
+_L4_attribute_always_inline
+L4_EnablePreemption (void)
+{
+ return _L4_enable_preemption ();
+}
+
+
+static inline L4_Bool_t
+_L4_attribute_always_inline
+L4_DisablePreemption (void)
+{
+ return _L4_disable_preemption ();
+}
+
+
+static inline L4_Bool_t
+_L4_attribute_always_inline
+L4_PreemptionPending (void)
+{
+ return _L4_preemption_pending ();
+}
diff --git a/libl4/l4/compat/space.h b/libl4/l4/compat/space.h
new file mode 100644
index 0000000..b37e5f7
--- /dev/null
+++ b/libl4/l4/compat/space.h
@@ -0,0 +1,290 @@
+/* l4/compat/space.h - Public interface for L4 spaces.
+ Copyright (C) 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_SPACE_H
+# error "Never use <l4/compat/space.h> directly; include <l4/space.h> instead."
+#endif
+
+
+/* 2.1 ThreadID [Data Type] */
+
+/* Generic Programming Interface. */
+
+/* L4_Fpage_t is defined in <l4/compat/types.h>. */
+
+#define L4_Readable _L4_readable
+#define L4_Writable _L4_writable
+#define L4_eXecutable _L4_executable
+#define L4_FullyAccessible _L4_fullly_accesible
+#define L4_ReadeXecOnly _L4_read_exec_only
+#define L4_NoAccess _L4_no_access
+
+#define L4_Nilpage ((L4_Fpage_t) { .raw = _L4_nilpage })
+#define L4_CompleteAddressSpace \
+ ((L4_Fpage_t) { .raw = _L4_complete_address_space })
+
+
+static inline L4_Bool_t
+_L4_attribute_always_inline
+L4_IsNilFpage (L4_Fpage_t f)
+{
+ return _L4_is_nil_fpage (f.raw);
+}
+
+
+static inline L4_Fpage_t
+_L4_attribute_always_inline
+L4_Fpage (L4_Word_t BaseAddress, int FpageSize)
+{
+ L4_Fpage_t fpage;
+
+ fpage.raw = _L4_fpage (BaseAddress, FpageSize);
+ return fpage;
+}
+
+
+static inline L4_Fpage_t
+_L4_attribute_always_inline
+L4_FpageLog2 (L4_Word_t BaseAddress, int Log2FpageSize)
+{
+ L4_Fpage_t fpage;
+
+ fpage.raw = _L4_fpage_log2 (BaseAddress, Log2FpageSize);
+ return fpage;
+}
+
+
+static inline L4_Word_t
+_L4_attribute_always_inline
+L4_Address (L4_Fpage_t fpage)
+{
+ return _L4_address (fpage.raw);
+}
+
+static inline L4_Word_t
+_L4_attribute_always_inline
+L4_Size (L4_Fpage_t fpage)
+{
+ return _L4_size (fpage.raw);
+}
+
+
+static inline L4_Word_t
+_L4_attribute_always_inline
+L4_SizeLog2 (L4_Fpage_t fpage)
+{
+ return _L4_size_log2 (fpage.raw);
+}
+
+
+static inline L4_Word_t
+_L4_attribute_always_inline
+L4_Rights (L4_Fpage_t fpage)
+{
+ return _L4_rights (fpage.raw);
+}
+
+
+static inline void
+_L4_attribute_always_inline
+L4_Set_Rights (L4_Fpage_t *fpage, L4_Word_t AccessRights)
+{
+ _L4_set_rights (&fpage->raw, AccessRights);
+}
+
+
+static inline L4_Fpage_t
+_L4_attribute_always_inline
+#ifdef _cplusplus
+operator + (const L4_Fpage_t l, const L4_Word_t r)
+#else
+L4_FpageAddRights (L4_Fpage_t l, L4_Word_t r)
+#endif
+{
+ L4_Fpage_t new_fpage;
+
+ new_fpage.raw = _L4_fpage_add_rights (l.raw, r);
+ return new_fpage;
+}
+
+
+static inline L4_Fpage_t
+_L4_attribute_always_inline
+#ifdef _cplusplus
+operator - (const L4_Fpage_t l, const L4_Word_t r)
+#else
+L4_FpageRemoveRights (const L4_Fpage_t l, const L4_Word_t r)
+#endif
+{
+ L4_Fpage_t new_fpage;
+
+ new_fpage.raw = _L4_fpage_remove_rights (l.raw, r);
+ return new_fpage;
+}
+
+
+#ifdef _cplusplus
+
+static inline L4_Fpage_t&
+_L4_attribute_always_inline
+operator += (L4_Fpage_t& l, const L4_Word_t r)
+{
+ _L4_fpage_add_rights_to (&l.raw, r);
+ return l;
+}
+
+
+static inline L4_Fpage_t&
+_L4_attribute_always_inline
+operator -= (L4_Fpage_t& l, const L4_Word_t r)
+{
+ _L4_fpage_remove_rights_from (&l.raw, r);
+ return l;
+}
+
+#else
+
+static inline L4_Fpage_t *
+_L4_attribute_always_inline
+L4_FpageAddRightsTo (L4_Fpage_t *l, L4_Word_t r)
+{
+ _L4_fpage_add_rights_to (&l->raw, r);
+ return l;
+}
+
+
+static inline L4_Fpage_t *
+_L4_attribute_always_inline
+L4_FpageRemoveRightsFrom (L4_Fpage_t *l, L4_Word_t r)
+{
+ _L4_fpage_remove_rights_from (&l->raw, r);
+ return l;
+}
+
+#endif
+
+
+/* 4.2 Unmap [Systemcall] */
+
+/* Generic Programming Interface. */
+
+static inline void
+_L4_attribute_always_inline
+L4_Unmap (L4_Word_t control)
+{
+ _L4_unmap (control);
+}
+
+
+/* Convenience Programming Interface. */
+
+static inline void
+_L4_attribute_always_inline
+#ifdef _cplusplus
+L4_Unmap (L4_Fpage_t fpage)
+#else
+L4_UnmapFpage (L4_Fpage_t fpage)
+#endif
+{
+ _L4_unmap_fpage (fpage.raw);
+}
+
+
+static inline void
+_L4_attribute_always_inline
+#ifdef _cplusplus
+L4_Unmap (L4_Word_t n, L4_Fpage_t *fpages, )
+#else
+L4_UnmapFpages (L4_Word_t n, L4_Fpage_t *fpages)
+#endif
+{
+ _L4_unmap_fpages (n, &fpages[0].raw);
+}
+
+
+static inline void
+_L4_attribute_always_inline
+L4_Flush (L4_Fpage_t fpage)
+{
+ _L4_flush (fpage.raw);
+}
+
+
+static inline void
+_L4_attribute_always_inline
+#ifdef _cplusplus
+L4_Flush (L4_Word_t n, L4_Fpage_t *fpages, )
+#else
+L4_FlushFpage (L4_Word_t n, L4_Fpage_t *fpages)
+#endif
+{
+ _L4_flush_fpages (n, &fpages[0].raw);
+}
+
+
+static inline L4_Fpage_t
+_L4_attribute_always_inline
+L4_GetStatus (L4_Fpage_t fpage)
+{
+ L4_Fpage_t status;
+
+ status.raw = _L4_get_status (fpage.raw);
+ return status;
+}
+
+
+static inline L4_Bool_t
+_L4_attribute_always_inline
+L4_WasReferenced (L4_Fpage_t fpage)
+{
+ return _L4_was_referenced (fpage.raw);
+}
+
+
+static inline L4_Bool_t
+_L4_attribute_always_inline
+L4_WasWritten (L4_Fpage_t fpage)
+{
+ return _L4_was_written (fpage.raw);
+}
+
+
+static inline L4_Bool_t
+_L4_attribute_always_inline
+L4_WaseXecuted (L4_Fpage_t fpage)
+{
+ return _L4_was_executed (fpage.raw);
+}
+
+
+/* 4.3 SpaceControl [Privileged Systemcall] */
+
+/* Generic Programming Interface. */
+
+static inline L4_Word_t
+_L4_attribute_always_inline
+L4_SpaceControl (L4_ThreadId_t SpaceSpecifier, L4_Word_t control,
+ L4_Fpage_t KipArea, L4_Fpage_t UtcbArea,
+ L4_ThreadId_t Redirector, L4_Word_t *old_control)
+{
+ return _L4_space_control (SpaceSpecifier.raw, control, KipArea.raw,
+ UtcbArea.raw, Redirector.raw, old_control);
+}
diff --git a/libl4/l4/compat/syscall.h b/libl4/l4/compat/syscall.h
new file mode 100644
index 0000000..b6c3d5c
--- /dev/null
+++ b/libl4/l4/compat/syscall.h
@@ -0,0 +1,33 @@
+/* l4/compat/syscall.h - Public interface for L4 system calls.
+ Copyright (C) 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_SYSCALL_H
+# error "Never use <l4/compat/syscall.h> directly; include <l4/syscall.h> instead."
+#endif
+
+#define L4_ErrNoPrivilege _L4_ERR_NO_PRIVILEGE
+#define L4_ErrInvalidThread _L4_ERR_INV_THREAD
+#define L4_ErrInvalidSpace _L4_ERR_INV_SPACE
+#define L4_ErrInvalidScheduler _L4_ERR_INV_SCHEDULER
+#define L4_ErrInvalidParam _L4_ERR_INV_PARAM
+#define L4_ErrUtcbArea _L4_ERR_UTCB_AREA
+#define L4_ErrKipArea _L4_ERR_KIP_AREA
+#define L4_ErrNoMem _L4_ERR_NO_MEM
diff --git a/libl4/l4/compat/thread.h b/libl4/l4/compat/thread.h
new file mode 100644
index 0000000..7c2cf14
--- /dev/null
+++ b/libl4/l4/compat/thread.h
@@ -0,0 +1,583 @@
+/* l4/compat/thread.h - Public interface for L4 threads.
+ Copyright (C) 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_THREAD_H
+# error "Never use <l4/compat/thread.h> directly; include <l4/thread.h> instead."
+#endif
+
+
+/* 2.1 ThreadID [Data Type] */
+
+/* Generic Programming Interface. */
+
+typedef struct
+{
+ L4_Word_t raw;
+} L4_ThreadId_t;
+
+#define L4_nilthread ((L4_ThreadId_t) { .raw = _L4_nilthread })
+#define L4_anythread ((L4_ThreadId_t) { .raw = _L4_anythread })
+#define L4_anylocalthread ((L4_ThreadId_t) { .raw = _L4_anylocalthread })
+
+
+static inline L4_ThreadId_t
+_L4_attribute_always_inline
+L4_GlobalId (L4_Word_t threadno, L4_Word_t version)
+{
+ L4_ThreadId_t tid;
+
+ tid.raw = _L4_global_id (threadno, version);
+ return tid;
+}
+
+
+static inline L4_Word_t
+_L4_attribute_always_inline
+L4_Version (L4_ThreadId_t t)
+{
+ return _L4_version (t.raw);
+}
+
+
+static inline L4_Word_t
+_L4_attribute_always_inline
+L4_ThreadNo (L4_ThreadId_t t)
+{
+ return _L4_thread_no (t.raw);
+}
+
+
+/* Convenience Programming Interface. */
+
+static inline L4_Bool_t
+_L4_attribute_always_inline
+#if defined(__cplusplus)
+operator == (L4_ThreadId_t l, L4_ThreadId_t r)
+#else
+L4_IsThreadEqual (L4_ThreadId_t l, L4_ThreadId_t r)
+#endif
+{
+ return _L4_is_thread_equal (l.raw, r.raw);
+}
+
+
+static inline L4_Bool_t
+_L4_attribute_always_inline
+#if defined(__cplusplus)
+operator != (L4_ThreadId_t l, L4_ThreadId_t r)
+#else
+L4_IsThreadNotEqual (L4_ThreadId_t l, L4_ThreadId_t r)
+#endif
+{
+ return _L4_is_thread_not_equal (l.raw, r.raw);
+}
+
+
+static inline L4_Bool_t
+_L4_attribute_always_inline
+L4_SameThreads (L4_ThreadId_t l, L4_ThreadId_t r)
+{
+ return _L4_same_threads (l.raw, r.raw);
+}
+
+
+static inline L4_Bool_t
+_L4_attribute_always_inline
+L4_IsNilThread (L4_ThreadId_t t)
+{
+ return _L4_is_thread_equal (_L4_nilthread, t.raw);
+}
+
+
+static inline L4_Bool_t
+_L4_attribute_always_inline
+L4_IsLocalId (L4_ThreadId_t t)
+{
+ return _L4_is_local_id (t.raw);
+}
+
+
+static inline L4_Bool_t
+_L4_attribute_always_inline
+L4_IsGlobalId (L4_ThreadId_t t)
+{
+ return _L4_is_global_id (t.raw);
+}
+
+
+static inline L4_ThreadId_t
+_L4_attribute_always_inline
+#if defined(__cplusplus)
+L4_LocalId (L4_ThreadId_t t)
+#else
+L4_LocalIdOf (L4_ThreadId_t t)
+#endif
+{
+ L4_ThreadId_t local_tid;
+
+ local_tid.raw = _L4_local_id_of (t.raw);
+ return local_tid;
+}
+
+
+static inline L4_ThreadId_t
+_L4_attribute_always_inline
+#if defined(__cplusplus)
+L4_GlobalId (L4_ThreadId_t t)
+#else
+L4_GlobalIdOf (L4_ThreadId_t t)
+#endif
+{
+ L4_ThreadId_t global_tid;
+
+ global_tid.raw = _L4_global_id_of (t.raw);
+ return global_tid;
+}
+
+
+static inline L4_ThreadId_t
+_L4_attribute_always_inline
+L4_MyLocalId (void)
+{
+ L4_ThreadId_t tid;
+
+ tid.raw = _L4_my_local_id ();
+ return tid;
+}
+
+
+static inline L4_ThreadId_t
+_L4_attribute_always_inline
+L4_MyGlobalId (void)
+{
+ L4_ThreadId_t tid;
+
+ tid.raw = _L4_my_global_id ();
+ return tid;
+}
+
+
+static inline L4_ThreadId_t
+_L4_attribute_always_inline
+L4_Myself (void)
+{
+ return L4_MyGlobalId ();
+}
+
+
+/* 2.2 Thread Control Registers (TCRs) [Virtual Registers] */
+
+/* Generic Programming Interface. */
+
+/* MyLocalId, MyGlobalID and Myself are defined above. */
+
+static inline int
+_L4_attribute_always_inline
+L4_ProcessorNo (void)
+{
+ return _L4_processor_no ();
+}
+
+
+static inline L4_Word_t
+_L4_attribute_always_inline
+L4_UserDefinedHandle (void)
+{
+ return _L4_user_defined_handle ();
+}
+
+
+static inline void
+_L4_attribute_always_inline
+L4_Set_UserDefinedHandle (L4_Word_t NewValue)
+{
+ _L4_set_user_defined_handle (NewValue);
+}
+
+
+static inline L4_ThreadId_t
+_L4_attribute_always_inline
+L4_Pager (void)
+{
+ L4_ThreadId_t tid;
+
+ tid.raw = _L4_pager ();
+ return tid;
+}
+
+
+static inline void
+_L4_attribute_always_inline
+L4_Set_Pager (L4_ThreadId_t NewPager)
+{
+ _L4_set_pager (NewPager.raw);
+}
+
+
+static inline L4_ThreadId_t
+_L4_attribute_always_inline
+L4_ExceptionHandler (void)
+{
+ L4_ThreadId_t tid;
+
+ tid.raw = _L4_exception_handler ();
+ return tid;
+}
+
+
+static inline void
+_L4_attribute_always_inline
+L4_Set_ExceptionHandler (L4_ThreadId_t NewHandler)
+{
+ _L4_set_exception_handler (NewHandler.raw);
+}
+
+
+static inline void
+_L4_attribute_always_inline
+L4_Set_CopFlag (L4_Word_t n)
+{
+ _L4_set_cop_flag (n);
+}
+
+
+static inline void
+_L4_attribute_always_inline
+L4_Clr_CopFlag (L4_Word_t n)
+{
+ _L4_clr_cop_flag (n);
+}
+
+
+static inline L4_Word_t
+_L4_attribute_always_inline
+L4_ErrorCode (void)
+{
+ return _L4_error_code ();
+}
+
+
+static inline L4_Word_t
+_L4_attribute_always_inline
+L4_XferTimeouts (void)
+{
+ return _L4_xfer_timeouts ();
+}
+
+
+static inline void
+_L4_attribute_always_inline
+L4_Set_XferTimeouts (L4_Word_t NewValue)
+{
+ return _L4_set_xfer_timeouts (NewValue);
+}
+
+
+static inline L4_ThreadId_t
+_L4_attribute_always_inline
+L4_IntendedReceiver (void)
+{
+ L4_ThreadId_t tid;
+
+ tid.raw = _L4_intended_receiver ();
+ return tid;
+}
+
+
+static inline L4_ThreadId_t
+_L4_attribute_always_inline
+L4_ActualSender (void)
+{
+ L4_ThreadId_t tid;
+
+ tid.raw = _L4_actual_sender ();
+ return tid;
+}
+
+
+static inline void
+_L4_attribute_always_inline
+L4_Set_VirtualSender (L4_ThreadId_t t)
+{
+ _L4_set_virtual_sender (t.raw);
+}
+
+
+/* 2.3 ExchangeRegisters [Systemcall] */
+
+/* Generic Programming Interface. */
+
+static inline L4_ThreadId_t
+_L4_attribute_always_inline
+L4_ExchangeRegisters (L4_ThreadId_t dest, L4_Word_t control, L4_Word_t sp,
+ L4_Word_t ip, L4_Word_t flags,
+ L4_Word_t UserDefinedHandle, L4_ThreadId_t pager,
+ L4_Word_t *old_control, L4_Word_t *old_sp,
+ L4_Word_t *old_ip, L4_Word_t *old_flags,
+ L4_Word_t *old_UserDefinedHandle,
+ L4_ThreadId_t *old_pager)
+{
+ L4_ThreadId_t dest_tid;
+
+ dest_tid = dest;
+ *old_control = control;
+ *old_sp = sp;
+ *old_ip = ip;
+ *old_flags = flags;
+ *old_UserDefinedHandle = UserDefinedHandle;
+ *old_pager = pager;
+
+ _L4_exchange_registers (&dest_tid.raw, old_control, old_sp, old_ip,
+ old_flags, old_UserDefinedHandle, &old_pager->raw);
+ return dest_tid;
+}
+
+
+/* Convenience Programming Interface. */
+
+/* GlobalId, LocalId, UserDefinedHandle, Set_UserDefinedHandle, Pager
+ and Set_Pager are defined above. */
+
+static inline void
+_L4_attribute_always_inline
+L4_Start (L4_ThreadId_t t)
+{
+ _L4_start (t.raw);
+}
+
+static inline void
+_L4_attribute_always_inline
+#if defined(__cplusplus)
+L4_Start (L4_ThreadId_t t, L4_Word_t sp, L4_Word_t ip)
+#else
+L4_Start_SpIp (L4_ThreadId_t t, L4_Word_t sp, L4_Word_t ip)
+#endif
+{
+ _L4_start_sp_ip (t.raw, sp, ip);
+}
+
+
+static inline void
+_L4_attribute_always_inline
+#if defined(__cplusplus)
+L4_Start (L4_ThreadId_t t, L4_Word_t sp, L4_Word_t ip, L4_Word_t flags)
+#else
+L4_Start_SpIpFlags (L4_ThreadId_t t, L4_Word_t sp, L4_Word_t ip,
+ L4_Word_t flags)
+#endif
+{
+ _L4_start_sp_ip_flags (t.raw, sp, ip, flags);
+}
+
+
+/* This data type is part of the support functions section, but
+ required here. */
+typedef struct
+{
+ L4_Word_t raw;
+} L4_ThreadState_t;
+
+
+static inline L4_ThreadState_t
+_L4_attribute_always_inline
+L4_Stop (L4_ThreadId_t t)
+{
+ L4_ThreadState_t s;
+
+ s.raw = _L4_stop (t.raw);
+ return s;
+}
+
+
+static inline L4_ThreadState_t
+_L4_attribute_always_inline
+#if defined(__cplusplus)
+L4_Stop (L4_ThreadId_t t, L4_Word_t *sp, L4_Word_t *ip, L4_Word_t *flags)
+#else
+L4_Stop_SpIpFlags (L4_ThreadId_t t, L4_Word_t *sp, L4_Word_t *ip,
+ L4_Word_t *flags)
+#endif
+{
+ L4_ThreadState_t s;
+
+ s.raw = _L4_stop_sp_ip_flags (t.raw, sp, ip, flags);
+ return s;
+}
+
+
+static inline L4_ThreadState_t
+_L4_attribute_always_inline
+L4_AbortReceive_and_stop (L4_ThreadId_t t)
+{
+ L4_ThreadState_t s;
+
+ s.raw = _L4_abort_receive_and_stop (t.raw);
+ return s;
+}
+
+
+static inline L4_ThreadState_t
+_L4_attribute_always_inline
+#if defined(__cplusplus)
+L4_AbortReceive_and_stop (L4_ThreadId_t t, L4_Word_t *sp, L4_Word_t *ip,
+ L4_Word_t *flags)
+#else
+L4_AbortReceive_and_stop_SpIpFlags (L4_ThreadId_t t, L4_Word_t *sp,
+ L4_Word_t *ip, L4_Word_t *flags)
+#endif
+{
+ L4_ThreadState_t s;
+
+ s.raw = _L4_abort_receive_and_stop_sp_ip_flags (t.raw, sp, ip, flags);
+ return s;
+}
+
+
+static inline L4_ThreadState_t
+_L4_attribute_always_inline
+L4_AbortSend_and_stop (L4_ThreadId_t t)
+{
+ L4_ThreadState_t s;
+
+ s.raw = _L4_abort_send_and_stop (t.raw);
+ return s;
+}
+
+
+static inline L4_ThreadState_t
+_L4_attribute_always_inline
+#if defined(__cplusplus)
+L4_AbortSend_and_stop (L4_ThreadId_t t, L4_Word_t *sp, L4_Word_t *ip,
+ L4_Word_t *flags)
+#else
+L4_AbortSend_and_stop_SpIpFlags (L4_ThreadId_t t, L4_Word_t *sp,
+ L4_Word_t *ip, L4_Word_t *flags)
+#endif
+{
+ L4_ThreadState_t s;
+
+ s.raw = _L4_abort_send_and_stop_sp_ip_flags (t.raw, sp, ip, flags);
+ return s;
+}
+
+
+static inline L4_ThreadState_t
+_L4_attribute_always_inline
+L4_AbortIpc_and_stop (L4_ThreadId_t t)
+{
+ L4_ThreadState_t s;
+
+ s.raw = _L4_abort_ipc_and_stop (t.raw);
+ return s;
+}
+
+
+static inline L4_ThreadState_t
+_L4_attribute_always_inline
+#if defined(__cplusplus)
+L4_AbortIpc_and_stop (L4_ThreadId_t t, L4_Word_t *sp, L4_Word_t *ip,
+ L4_Word_t *flags)
+#else
+L4_AbortIpc_and_stop_SpIpFlags (L4_ThreadId_t t, L4_Word_t *sp,
+ L4_Word_t *ip, L4_Word_t *flags)
+#endif
+{
+ L4_ThreadState_t s;
+
+ s.raw = _L4_abort_ipc_and_stop_sp_ip_flags (t.raw, sp, ip, flags);
+ return s;
+}
+
+
+/* Support Functions. */
+
+/* L4_ThreadState_t defined above. */
+
+static inline L4_Bool_t
+_L4_attribute_always_inline
+L4_ThreadWasHalted (L4_ThreadState_t s)
+{
+ return s.raw & _L4_XCHG_REGS_HALTED;
+}
+
+
+static inline L4_Bool_t
+_L4_attribute_always_inline
+L4_ThreadWasReceiving (L4_ThreadState_t s)
+{
+ return s.raw & _L4_XCHG_REGS_RECEIVING;
+}
+
+
+static inline L4_Bool_t
+_L4_attribute_always_inline
+L4_ThreadWasSending (L4_ThreadState_t s)
+{
+ return s.raw & _L4_XCHG_REGS_SENDING;
+}
+
+
+static inline L4_Bool_t
+_L4_attribute_always_inline
+L4_ThreadWasIpcing (L4_ThreadState_t s)
+{
+ return s.raw & _L4_XCHG_REGS_IPCING;
+}
+
+/* L4_ErrorCode is defined above. */
+
+/* Error codes are defined in <l4/compat/syscall.h>. */
+
+
+/* 2.4 Thread Control [Privileged Systemcall] */
+
+/* Generic Programming Interface. */
+
+static inline L4_Word_t
+_L4_attribute_always_inline
+L4_ThreadControl (L4_ThreadId_t dest, L4_ThreadId_t SpaceSpecifier, L4_ThreadId_t Scheduler,
+ L4_ThreadId_t Pager, void *UtcbLocation)
+{
+ return _L4_thread_control (dest.raw, SpaceSpecifier.raw, Scheduler.raw, Pager.raw,
+ UtcbLocation);
+}
+
+
+/* Convenience Interface. */
+
+static inline L4_Word_t
+_L4_attribute_always_inline
+L4_AssociateInterrupt (L4_ThreadId_t InterruptThread, L4_ThreadId_t InterruptHandler)
+{
+ return _L4_associate_interrupt (InterruptThread.raw, InterruptHandler.raw);
+}
+
+
+static inline L4_Word_t
+_L4_attribute_always_inline
+L4_DeassociateInterrupt (L4_ThreadId_t InterruptThread)
+{
+ return _L4_deassociate_interrupt (InterruptThread.raw);
+}
+
+/* L4_ErrorCode is defined above. */
+
+/* Error codes are defined in <l4/compat/syscall.h>. */
diff --git a/libl4/l4/compat/types.h b/libl4/l4/compat/types.h
index 859abe5..2325cd3 100644
--- a/libl4/l4/compat/types.h
+++ b/libl4/l4/compat/types.h
@@ -1,5 +1,5 @@
-/* types.h - Public interface for L4 compatibility types.
- Copyright (C) 2003 Free Software Foundation, Inc.
+/* l4/compat/types.h - Public interface for L4 compatibility types.
+ Copyright (C) 2003, 2004 Free Software Foundation, Inc.
Written by Marcus Brinkmann <marcus@gnu.org>.
This file is part of the GNU L4 library.
@@ -23,80 +23,13 @@
# error "Never use <l4/compat/types.h> directly; include <l4/types.h> instead."
#endif
-typedef l4_word_t L4_Word_t;
-typedef l4_uint64_t L4_Word64_t;
-typedef l4_word_t L4_Bool_t;
+typedef _L4_word_t L4_Word_t;
+typedef _L4_uint16_t L4_Word16_t;
+typedef _L4_uint64_t L4_Word64_t;
+typedef _L4_word_t L4_Bool_t;
-/* Clock interface. */
-
-typedef _L4_RAW
-(L4_Word64_t, _L4_STRUCT1
- ({
- l4_clock_t clock;
- })) L4_Clock_t;
-
-
-
-#define _L4_CLOCK_OP(name, op) \
-static inline L4_Clock_t \
-L4_Clock ## name ## Usec (const L4_Clock_t clock, const L4_Word64_t usec) \
-{ \
- L4_Clock_t new_clock; \
- new_clock.clock = clock.clock op usec; \
- return new_clock; \
-}
-
-_L4_CLOCK_OP(Add, +)
-_L4_CLOCK_OP(Sub, -)
-#undef _L4_CLOCK_OP
-
-
-#define _L4_CLOCK_OP(name, op) \
-static inline L4_Bool_t \
-L4_Clock ## name (const L4_Clock_t clock1, const L4_Clock_t clock2) \
-{ \
- return clock1.clock op clock2.clock; \
-}
-
-_L4_CLOCK_OP(Earlier, <)
-_L4_CLOCK_OP(Later, >)
-_L4_CLOCK_OP(Equal, ==)
-_L4_CLOCK_OP(NotEqual, !=)
-#undef _L4_CLOCK_OP
-
-
-#if defined(__cplusplus)
-
-#define _L4_CLOCK_OP(op, type) \
-static inline L4_Clock_t \
-operator ## op ## (const L4_Clock_t& clock, const type usec) \
-{ \
- L4_Clock_t new_clock; \
- new_clock.clock = clock op usec; \
- return new_clock; \
-}
-
-_L4_CLOCK_OP(+, int)
-_L4_CLOCK_OP(+, L4_Word64_t)
-_L4_CLOCK_OP(-, int)
-_L4_CLOCK_OP(-, L4_Word64_t)
-#undef _L4_CLOCK_OP
-
-
-#define _L4_CLOCK_OP(op) \
-static inline L4_Bool_t \
-operator ## op ## (const L4_Clock_t& clock1, const L4_Clock_t& clock2) \
-{ \
- return clock1.clock op clock2.clock; \
-}
-
-_L4_CLOCK_OP(<)
-_L4_CLOCK_OP(>)
-_L4_CLOCK_OP(<=)
-_L4_CLOCK_OP(>=)
-_L4_CLOCK_OP(==)
-_L4_CLOCK_OP(!=)
-#undef _L4_CLOCK_OP
-
-#endif /* __cplusplus */
+typedef struct
+{
+ L4_Word_t raw;
+} L4_Fpage_t;
diff --git a/libl4/l4/features.h b/libl4/l4/features.h
new file mode 100644
index 0000000..0c1617c
--- /dev/null
+++ b/libl4/l4/features.h
@@ -0,0 +1,52 @@
+/* l4/features.h - Public interface to the L4 library.
+ Copyright (C) 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_FEATURES_H
+#define _L4_FEATURES_H 1
+
+
+/* If _GNU_SOURCE is defined, we always enable the GNU interface,
+ because it is convenient to do so. */
+#ifdef _GNU_SOURCE
+#ifndef _L4_INTERFACE_GNU
+#define _L4_INTERFACE_GNU 1
+#endif
+#endif
+
+/* The official L4 interface is always enabled unless _L4_NOT_COMPAT
+ is defined. */
+#ifndef _L4_NOT_COMPAT
+#ifndef _L4_INTERFACE_L4
+#define _L4_INTERFACE_L4 1
+#endif
+#endif
+
+
+/* The rest of the file is here because every other header file
+ includes this one. */
+
+#define _L4_attribute_always_inline __attribute__((__always_inline__))
+
+#define _L4_attribute_const __attribute__((__const__))
+
+#define _L4_attribute_alias(name) __attribute__((__alias__(#name)))
+
+#endif /* _L4_FEATURES_H */
diff --git a/libl4/l4/globals.h b/libl4/l4/globals.h
index c49827c..8f7273e 100644
--- a/libl4/l4/globals.h
+++ b/libl4/l4/globals.h
@@ -1,5 +1,5 @@
-/* globals.h - Global variables for libl4.
- Copyright (C) 2003 Free Software Foundation, Inc.
+/* l4/globals.h - Global variables for libl4.
+ Copyright (C) 2003, 2004 Free Software Foundation, Inc.
Written by Marcus Brinkmann <marcus@gnu.org>.
This file is part of the GNU L4 library.
@@ -27,4 +27,4 @@
#include <l4/kip.h>
/* The global kernel interface page. */
-l4_kip_t __l4_kip;
+_L4_kip_t __l4_kip;
diff --git a/libl4/l4/gnu/ipc.h b/libl4/l4/gnu/ipc.h
new file mode 100644
index 0000000..ee92ac0
--- /dev/null
+++ b/libl4/l4/gnu/ipc.h
@@ -0,0 +1,760 @@
+/* l4/gnu/ipc.h - Public GNU interface for L4 IPC.
+ Copyright (C) 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_IPC_H
+# error "Never use <l4/gnu/ipc.h> directly; include <l4/ipc.h> instead."
+#endif
+
+
+typedef _L4_msg_tag_t l4_msg_tag_t;
+
+#define l4_niltag _L4_niltag
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_is_msg_tag_equal (l4_msg_tag_t l, l4_msg_tag_t r)
+{
+ return _L4_is_msg_tag_equal (l, r);
+}
+
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_is_msg_tag_not_equal (l4_msg_tag_t l, l4_msg_tag_t r)
+{
+ return _L4_is_msg_tag_not_equal (l, r);
+}
+
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_label (l4_msg_tag_t t)
+{
+ return _L4_label (t);
+}
+
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_untyped_words (l4_msg_tag_t t)
+{
+ return _L4_untyped_words (t);
+}
+
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_typed_words (l4_msg_tag_t t)
+{
+ return _L4_typed_words (t);
+}
+
+
+static inline l4_msg_tag_t
+_L4_attribute_always_inline
+l4_msg_tag_add_label (l4_msg_tag_t tag, l4_word_t label)
+{
+ return _L4_msg_tag_add_label (tag, label);
+}
+
+
+static inline void
+_L4_attribute_always_inline
+l4_msg_tag_add_label_to (l4_msg_tag_t *tag, l4_word_t label)
+{
+ return _L4_msg_tag_add_label_to (tag, label);
+}
+
+
+static inline l4_msg_tag_t
+_L4_attribute_always_inline
+l4_msg_tag (void)
+{
+ return _L4_msg_tag ();
+}
+
+
+static inline void
+_L4_attribute_always_inline
+l4_set_msg_tag (l4_msg_tag_t tag)
+{
+ _L4_set_msg_tag (tag);
+}
+
+
+
+/* Map items. */
+
+typedef _L4_map_item_t l4_map_item_t;
+
+static inline l4_map_item_t
+_L4_attribute_always_inline
+l_map_item (l4_fpage_t fpage, l4_word_t send_base)
+{
+ return _L4_map_item (fpage, send_base);
+}
+
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l_is_map_item (l4_map_item_t map_item)
+{
+ return _L4_is_map_item (map_item);
+}
+
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_map_item_snd_fpage (l4_map_item_t map_item)
+{
+ return _L4_map_item_snd_fpage (map_item);
+}
+
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_map_item_snd_base (l4_map_item_t map_item)
+{
+ return _L4_map_item_snd_base (map_item);
+}
+
+
+/* Grant items. */
+
+typedef _L4_grant_item_t l4_grant_item_t;
+
+static inline l4_grant_item_t
+_L4_attribute_always_inline
+l4_grant_item (l4_fpage_t fpage, l4_word_t send_base)
+{
+ return _L4_grant_item (fpage, send_base);
+}
+
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_is_grant_item (l4_grant_item_t grant_item)
+{
+ return _L4_is_grant_item (grant_item);
+}
+
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_grant_item_snd_fpage (l4_grant_item_t grant_item)
+{
+ return _L4_grant_item_snd_fpage (grant_item);
+}
+
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_grant_item_snd_base (l4_grant_item_t grant_item)
+{
+ return _L4_grant_item_snd_base (grant_item);
+}
+
+
+/* String items. */
+
+typedef _L4_string_item_t l4_string_item_t;
+
+typedef _L4_cache_allocation_hint_t l4_cache_allocation_hint_t;
+
+#define L4_use_default_cache_line_allocation \
+ _L4_use_default_cache_line_allocation
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_is_string_item (l4_string_item_t *string_item)
+{
+ return _L4_is_string_item (string_item);
+}
+
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_compound_string (l4_string_item_t *string_item)
+{
+ return _L4_compound_string (string_item);
+}
+
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_substrings (l4_string_item_t *string_item)
+{
+ return _L4_substrings (string_item);
+}
+
+
+static inline void *
+_L4_attribute_always_inline
+l4_substring (l4_string_item_t *string_item, l4_word_t nr)
+{
+ return _L4_substring (string_item, nr);
+}
+
+
+static inline l4_string_item_t *
+_L4_attribute_always_inline
+l4_add_substring_address_to (l4_string_item_t *string_item,
+ l4_string_item_t *source)
+{
+ return _L4_add_substring_address_to (string_item, source);
+}
+
+
+static inline l4_string_item_t *
+_L4_attribute_always_inline
+l4_add_substring_to (l4_string_item_t *string_item, void *source)
+{
+ return _L4_add_substring_to (string_item, source);
+}
+
+
+static inline
+_L4_attribute_always_inline
+l4_cache_allocation_hint_t
+l4_cache_allocation_hint (l4_string_item_t string_item)
+{
+ return _L4_cache_allocation_hint (string_item);
+}
+
+
+static inline
+_L4_attribute_always_inline
+l4_string_item_t
+l4_add_cache_allocation_hint (l4_string_item_t string_item,
+ l4_cache_allocation_hint_t hint)
+{
+ return _L4_add_cache_allocation_hint (string_item, hint);
+}
+
+
+static inline l4_string_item_t
+_L4_attribute_always_inline
+*
+l4_add_cache_allocation_hint_to (l4_string_item_t *string_item,
+ l4_cache_allocation_hint_t hint)
+{
+ return _L4_add_cache_allocation_hint_to (string_item, hint);
+}
+
+
+
+/* Acceptors and message buffers. */
+typedef _L4_acceptor_t l4_acceptor_t;
+
+
+#define L4_untyped_words_acceptor _L4_untyped_words_acceptor
+#define L4_string_items_acceptor _L4_string_items_acceptor
+
+typedef _L4_msg_buffer_t l4_msg_buffer_t;
+
+static inline l4_acceptor_t
+_L4_attribute_always_inline
+l4_map_grant_items (l4_fpage_t rcv_window)
+{
+ return _L4_map_grant_items (rcv_window);
+}
+
+
+static inline l4_acceptor_t
+_L4_attribute_always_inline
+l4_add_acceptor (l4_acceptor_t acceptor1, l4_acceptor_t acceptor2)
+{
+ return _L4_add_acceptor (acceptor1, acceptor2);
+}
+
+
+static inline l4_acceptor_t *
+_L4_attribute_always_inline
+l4_add_acceptor_to (l4_acceptor_t *acceptor1, l4_acceptor_t acceptor2)
+{
+ return _L4_add_acceptor_to (acceptor1, acceptor2);
+}
+
+
+static inline l4_acceptor_t
+_L4_attribute_always_inline
+l4_remove_acceptor (l4_acceptor_t acceptor1, l4_acceptor_t acceptor2)
+{
+ return _L4_remove_acceptor (acceptor1, acceptor2);
+}
+
+
+static inline l4_acceptor_t *
+_L4_attribute_always_inline
+l4_remove_acceptor_from (l4_acceptor_t *acceptor1, l4_acceptor_t acceptor2)
+{
+ return _L4_remove_acceptor_from (acceptor1, acceptor2);
+}
+
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_has_string_items (l4_acceptor_t acceptor)
+{
+ return _L4_has_string_items (acceptor);
+}
+
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_has_map_grant_items (l4_acceptor_t acceptor)
+{
+ return _L4_has_map_grant_items (acceptor);
+}
+
+
+static inline l4_fpage_t
+_L4_attribute_always_inline
+l4_rcv_window (l4_acceptor_t acceptor)
+{
+ return _L4_rcv_window (acceptor);
+}
+
+
+static inline void
+_L4_attribute_always_inline
+l4_accept (l4_acceptor_t acceptor)
+{
+ _L4_accept (acceptor);
+}
+
+
+static inline void
+_L4_attribute_always_inline
+l4_accept_strings (l4_acceptor_t acceptor, l4_msg_buffer_t msg_buffer)
+{
+ _L4_accept_strings (acceptor, msg_buffer);
+}
+
+
+static inline l4_acceptor_t
+_L4_attribute_always_inline
+l4_accepted (void)
+{
+ return _L4_accepted ();
+}
+
+
+static inline void
+_L4_attribute_always_inline
+l4_msg_buffer_clear (l4_msg_buffer_t msg_buffer)
+{
+ _L4_msg_buffer_clear (msg_buffer);
+}
+
+
+static inline void
+_L4_attribute_always_inline
+l4_msg_buffer_append_simple_rcv_string (l4_msg_buffer_t msg_buffer,
+ l4_string_item_t string_item)
+{
+ return _L4_msg_buffer_append_simple_rcv_string (msg_buffer, string_item);
+}
+
+
+static inline void
+_L4_attribute_always_inline
+l4_msg_buffer_append_rcv_string (l4_msg_buffer_t msg_buffer,
+ l4_string_item_t *string_item)
+{
+ _L4_msg_buffer_append_rcv_string (msg_buffer, string_item);
+}
+
+
+
+/* Message composition. */
+
+typedef _L4_msg_t l4_msg_t;
+
+static inline void
+_L4_attribute_always_inline
+l4_msg_put (l4_msg_t msg, l4_word_t label, int untyped_nr,
+ l4_word_t *untyped, int typed_nr, void *typed)
+{
+ _L4_msg_put (msg, label, untyped_nr, untyped, typed_nr, typed);
+}
+
+
+static inline void
+_L4_attribute_always_inline
+l4_msg_get (l4_msg_t msg, l4_word_t *untyped, void *typed)
+{
+ _L4_msg_get (msg, untyped, typed);
+}
+
+
+static inline l4_msg_tag_t
+_L4_attribute_always_inline
+l4_msg_msg_tag (l4_msg_t msg)
+{
+ return _L4_msg_msg_tag (msg);
+}
+
+
+static inline void
+_L4_attribute_always_inline
+l4_set_msg_msg_tag (l4_msg_t msg, l4_msg_tag_t tag)
+{
+ _L4_set_msg_msg_tag (msg, tag);
+}
+
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_msg_label (l4_msg_t msg)
+{
+ return _L4_msg_msg_label (msg);
+}
+
+
+static inline void
+_L4_attribute_always_inline
+l4_set_msg_label (l4_msg_t msg, l4_word_t label)
+{
+ _L4_set_msg_msg_label (msg, label);
+}
+
+
+static inline void
+_L4_attribute_always_inline
+l4_msg_load (l4_msg_t msg)
+{
+ _L4_msg_load (msg);
+}
+
+
+static inline void
+_L4_attribute_always_inline
+l4_msg_store (l4_msg_tag_t tag, l4_msg_t msg)
+{
+ _L4_msg_store (tag, msg);
+}
+
+
+static inline void
+_L4_attribute_always_inline
+l4_msg_clear (l4_msg_t msg)
+{
+ _L4_msg_clear (msg);
+}
+
+
+static inline void
+_L4_attribute_always_inline
+l4_msg_append_word (l4_msg_t msg, l4_word_t data)
+{
+ _L4_msg_append_word (msg, data);
+}
+
+
+static inline void
+_L4_attribute_always_inline
+l4_msg_append_map_item (l4_msg_t msg, l4_map_item_t map_item)
+{
+ _L4_msg_append_map_item (msg, map_item);
+}
+
+
+static inline void
+_L4_attribute_always_inline
+l4_msg_append_grant_item (l4_msg_t msg, l4_grant_item_t grant_item)
+{
+ _L4_msg_append_grant_item (msg, grant_item);
+}
+
+
+static inline void
+_L4_attribute_always_inline
+l4_msg_append_simple_string_item (l4_msg_t msg,
+ l4_string_item_t string_item)
+{
+ _L4_msg_append_simple_string_item (msg, string_item);
+}
+
+
+static inline void
+_L4_attribute_always_inline
+l4_msg_append_string_item (l4_msg_t msg, l4_string_item_t *string_item)
+{
+ _L4_msg_append_string_item (msg, string_item);
+}
+
+
+static inline void
+_L4_attribute_always_inline
+l4_msg_put_word (l4_msg_t msg, l4_word_t nr, l4_word_t data)
+{
+ _L4_msg_put_word (msg, nr, data);
+}
+
+
+static inline void
+_L4_attribute_always_inline
+l4_msg_put_map_item (l4_msg_t msg, l4_word_t nr, l4_map_item_t map_item)
+{
+ _L4_msg_put_map_item (msg, nr, map_item);
+}
+
+
+static inline void
+_L4_attribute_always_inline
+l4_msg_put_grant_item (l4_msg_t msg, l4_word_t nr, l4_grant_item_t grant_item)
+{
+ _L4_msg_put_grant_item (msg, nr, grant_item);
+}
+
+
+static inline void
+_L4_attribute_always_inline
+l4_msg_put_simple_string_item (l4_msg_t msg, l4_word_t nr,
+ l4_string_item_t string_item)
+{
+ _L4_msg_put_simple_string_item (msg, nr, string_item);
+}
+
+
+static inline void
+_L4_attribute_always_inline
+l4_msg_put_string_item (l4_msg_t msg, l4_word_t nr,
+ l4_string_item_t *string_item)
+{
+ _L4_msg_put_string_item (msg, nr, string_item);
+}
+
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_msg_word (l4_msg_t msg, l4_word_t nr)
+{
+ return _L4_msg_word (msg, nr);
+}
+
+
+static inline void
+_L4_attribute_always_inline
+l4_msg_get_word (l4_msg_t msg, l4_word_t nr,
+ l4_word_t *data)
+{
+ _L4_msg_get_word (msg, nr, data);
+}
+
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_msg_get_map_item (l4_msg_t msg, l4_word_t nr, l4_map_item_t *map_item)
+{
+ return _L4_msg_get_map_item (msg, nr, map_item);
+}
+
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_msg_get_grant_item (l4_msg_t msg, l4_word_t nr, l4_grant_item_t *grant_item)
+{
+ return _L4_msg_get_grant_item (msg, nr, grant_item);
+}
+
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_msg_get_string_item (l4_msg_t msg, l4_word_t nr,
+ l4_string_item_t *string_item)
+{
+ return _L4_msg_get_string_item (msg, nr, string_item);
+}
+
+
+
+/* IPC interface. */
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_timeouts (l4_time_t send_timeout, l4_time_t receive_timeout)
+{
+ return _L4_timeouts (send_timeout, receive_timeout);
+}
+
+
+static inline l4_msg_tag_t
+_L4_attribute_always_inline
+l4_call_timeouts (l4_thread_id_t dest, l4_time_t send_timeout,
+ l4_time_t receive_timeout)
+{
+ return _L4_call_timeouts (dest, send_timeout, receive_timeout);
+}
+
+
+static inline l4_msg_tag_t
+_L4_attribute_always_inline
+l4_call (l4_thread_id_t dest)
+{
+ return _L4_call (dest);
+}
+
+
+static inline l4_msg_tag_t
+_L4_attribute_always_inline
+l4_send_timeout (l4_thread_id_t dest, l4_time_t send_timeout)
+{
+ return _l4_send_timeout (dest, send_timeout);
+}
+
+
+static inline l4_msg_tag_t
+_L4_attribute_always_inline
+l4_send (l4_thread_id_t dest)
+{
+ return _L4_send (dest);
+}
+
+
+static inline l4_msg_tag_t
+_L4_attribute_always_inline
+l4_reply (l4_thread_id_t dest)
+{
+ return _L4_reply (dest);
+}
+
+
+static inline l4_msg_tag_t
+_L4_attribute_always_inline
+l4_receive_timeout (l4_thread_id_t from, l4_time_t receive_timeout)
+{
+ return _L4_receive_timeout (from, receive_timeout);
+}
+
+
+static inline l4_msg_tag_t
+_L4_attribute_always_inline
+l4_receive (l4_thread_id_t from)
+{
+ return _L4_receive (from);
+}
+
+
+static inline l4_msg_tag_t
+_L4_attribute_always_inline
+l4_wait_timeout (l4_time_t receive_timeout, l4_thread_id_t *from)
+{
+ return _L4_wait_timeout (receive_timeout, from);
+}
+
+
+static inline l4_msg_tag_t
+_L4_attribute_always_inline
+l4_wait (l4_thread_id_t *from)
+{
+ return _L4_wait (from);
+}
+
+
+static inline l4_msg_tag_t
+_L4_attribute_always_inline
+l4_reply_wait_timeout (l4_thread_id_t dest, l4_time_t receive_timeout,
+ l4_thread_id_t *from)
+{
+ return _L4_reply_wait_timeout (dest, receive_timeout, from);
+}
+
+
+static inline l4_msg_tag_t
+_L4_attribute_always_inline
+l4_reply_wait (l4_thread_id_t dest, l4_thread_id_t *from)
+{
+ return _L4_reply_wait (dest, from);
+}
+
+
+static inline void
+_L4_attribute_always_inline
+l4_sleep (l4_time_t time)
+{
+ _L4_sleep (time);
+}
+
+
+static inline l4_msg_tag_t
+_L4_attribute_always_inline
+l4_lcall (l4_thread_id_t dest)
+{
+ return _L4_lcall (dest);
+}
+
+
+static inline l4_msg_tag_t
+_L4_attribute_always_inline
+l4_lreply_wait (l4_thread_id_t dest, l4_thread_id_t *from)
+{
+ return _L4_lreply_wait (dest, from);
+}
+
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_ipc_succeeded (l4_msg_tag_t tag)
+{
+ return _L4_ipc_succeeded (tag);
+}
+
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_ipc_failed (l4_msg_tag_t tag)
+{
+ return _L4_ipc_failed (tag);
+}
+
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_ipc_propagated (l4_msg_tag_t tag)
+{
+ return _L4_ipc_propagated (tag);
+}
+
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_ipc_redirected (l4_msg_tag_t tag)
+{
+ return _L4_ipc_redirected (tag);
+}
+
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_ipc_xcpu (l4_msg_tag_t tag)
+{
+ return _L4_ipc_xcpu (tag);
+}
+
+
+static inline void
+_L4_attribute_always_inline
+l4_set_propagation (l4_msg_tag_t *tag)
+{
+ return _L4_set_propagation (tag);
+}
diff --git a/libl4/l4/gnu/kip.h b/libl4/l4/gnu/kip.h
new file mode 100644
index 0000000..10ef71e
--- /dev/null
+++ b/libl4/l4/gnu/kip.h
@@ -0,0 +1,527 @@
+/* l4/gnu/kip.h - Public GNU interface to the L4 kernel interface page.
+ Copyright (C) 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_KIP_H
+# error "Never use <l4/gnu/kip.h> directly; include <l4/kip.h> instead."
+#endif
+
+/* The kernel interface page. */
+
+typedef _L4_kip_t l4_kip_t;
+
+/* This will be initialized by the linker to the task's kernel
+ interface page. */
+extern l4_kip_t __l4_kip;
+
+static inline l4_kip_t
+_L4_attribute_always_inline
+l4_kip (void)
+{
+ return __l4_kip;
+}
+
+typedef _L4_rootserver_t l4_rootserver_t;
+
+
+/* Paging information. */
+
+#define L4_MIN_PAGE_SIZE_LOG2 _L4_MIN_PAGE_SIZE_LOG2
+#define L4_MIN_PAGE_SIZE _L4_MIN_PAGE_SIZE
+
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_page_size_mask_from (l4_kip_t kip)
+{
+ return _L4_page_size_mask (kip);
+}
+
+
+static inline l4_word_t
+l4_page_size_mask (void)
+{
+ return l4_page_size_mask_from (l4_kip ());
+}
+
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_page_rights_from (l4_kip_t kip)
+{
+ return _L4_page_rights (kip);
+}
+
+
+static inline l4_word_t
+l4_page_rights (void)
+{
+ return l4_page_rights_from (l4_kip ());
+}
+
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_min_page_size_log2 (void)
+{
+ l4_word_t page_size_mask = l4_page_size_mask ();
+
+ /* There'd better be one bit set. */
+ return l4_lsb (page_size_mask) - 1;
+}
+
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_min_page_size (void)
+{
+ return L4_WORD_C(1) << l4_min_page_size_log2 ();
+}
+
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_page_trunc (l4_word_t addr)
+{
+ return (addr & ~(l4_min_page_size () - 1));
+}
+
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_page_round (l4_word_t addr)
+{
+ return ((addr + (l4_min_page_size () - 1))
+ & ~(l4_min_page_size () - 1));
+}
+
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_atop (l4_word_t addr)
+{
+ return ((addr) >> l4_min_page_size_log2 ());
+}
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_ptoa (l4_word_t p)
+{
+ return ((p) << l4_min_page_size_log2 ());
+}
+
+
+/* Thread ID information. */
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_thread_id_bits_from (l4_kip_t kip)
+{
+ return _L4_thread_id_bits (kip);
+}
+
+
+static inline l4_word_t
+l4_thread_id_bits (void)
+{
+ return l4_thread_id_bits_from (l4_kip ());
+}
+
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_thread_system_base_from (l4_kip_t kip)
+{
+ return _L4_thread_system_base (kip);
+}
+
+
+static inline l4_word_t
+l4_thread_system_base (void)
+{
+ return l4_thread_system_base_from (l4_kip ());
+}
+
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_thread_user_base_from (l4_kip_t kip)
+{
+ return _L4_thread_user_base (kip);
+}
+
+
+static inline l4_word_t
+l4_thread_user_base (void)
+{
+ return l4_thread_user_base_from (l4_kip ());
+}
+
+
+/* Scheduler information. */
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_read_precision_from (l4_kip_t kip)
+{
+ return _L4_read_precision (kip);
+}
+
+
+static inline l4_word_t
+l4_read_precision (void)
+{
+ return l4_read_precision_from (l4_kip ());
+}
+
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_schedule_precision_from (l4_kip_t kip)
+{
+ return _L4_schedule_precision (kip);
+}
+
+
+static inline l4_word_t
+l4_schedule_precision (void)
+{
+ return l4_schedule_precision_from (l4_kip ());
+}
+
+
+/* UTCB area information. */
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_utcb_area_size_log2_from (l4_kip_t kip)
+{
+ return _L4_utcb_area_size_log2 (kip);
+}
+
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_utcb_area_size_log2 (void)
+{
+ return l4_utcb_area_size_log2_from (l4_kip ());
+}
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_utcb_area_size (void)
+{
+ return L4_WORD_C(1) << l4_utcb_area_size_log2 ();
+}
+
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_utcb_alignment_log2_from (l4_kip_t kip)
+{
+ return _L4_utcb_alignment_log2 (kip);
+}
+
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_utcb_alignment_log2 ()
+{
+ return l4_utcb_alignment_log2_from (l4_kip ());
+}
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_utcb_alignment ()
+{
+ return L4_WORD_C(1) << l4_utcb_alignment_log2 ();
+}
+
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_utcb_size_from (l4_kip_t kip)
+{
+ return _L4_utcb_size (kip);
+}
+
+
+static inline _L4_word_t
+_L4_attribute_always_inline
+l4_utcb_size (void)
+{
+ return l4_utcb_size_from (l4_kip ());
+}
+
+
+/* Meta-information about the KIP. */
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_kip_area_size_log2_from (l4_kip_t kip)
+{
+ return _L4_kip_area_size_log2 (kip);
+}
+
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_kip_area_size_log2 (void)
+{
+ return l4_kip_area_size_log2_from (l4_kip ());
+}
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_kip_area_size (void)
+{
+ return L4_WORD_C(1) << l4_kip_area_size_log2 ();
+}
+
+
+/* Boot information. */
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_boot_info_from (l4_kip_t kip)
+{
+ return _L4_boot_info (kip);
+}
+
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_boot_info (void)
+{
+ return l4_boot_info_from (l4_kip ());
+}
+
+
+/* Kernel information. */
+
+static inline void
+_L4_attribute_always_inline
+l4_kernel_gen_date_from (l4_kip_t kip, l4_word_t *year,
+ l4_word_t *month, l4_word_t *day)
+{
+ return _L4_kernel_gen_date (kip, year, month, day);
+}
+
+
+static inline void
+_L4_attribute_always_inline
+l4_kernel_gen_date (l4_word_t *year, l4_word_t *month, l4_word_t *day)
+{
+ l4_kernel_gen_date_from (l4_kip (), year, month, day);
+}
+
+
+static inline void
+_L4_attribute_always_inline
+l4_kernel_version_from (l4_kip_t kip, l4_word_t *ver, l4_word_t *subver,
+ l4_word_t *subsubver)
+{
+ _L4_kernel_version (kip, ver, subver, subsubver);
+}
+
+
+static inline void
+_L4_attribute_always_inline
+l4_kernel_version (l4_word_t *ver, l4_word_t *subver, l4_word_t *subsubver)
+{
+ return l4_kernel_version_from (l4_kip (), ver, subver, subsubver);
+}
+
+
+static inline char *
+_L4_attribute_always_inline
+l4_kernel_supplier_from (l4_kip_t kip)
+{
+ return _L4_kernel_supplier (kip);
+}
+
+
+static inline char *
+_L4_attribute_always_inline
+l4_kernel_supplier (void)
+{
+ return l4_kernel_supplier_from (l4_kip ());
+}
+
+
+static inline char *
+_L4_attribute_always_inline
+l4_kernel_version_string_from (l4_kip_t kip)
+{
+ return _L4_kernel_version_string (kip);
+}
+
+
+static inline char *
+_L4_attribute_always_inline
+l4_kernel_version_string (void)
+{
+ return l4_kernel_version_string_from (l4_kip ());
+}
+
+
+static inline char *
+_L4_attribute_always_inline
+l4_feature_from (l4_kip_t kip, l4_word_t num)
+{
+ return _L4_feature (kip, num);
+}
+
+
+static inline char *
+_L4_attribute_always_inline
+l4_feature (l4_word_t num)
+{
+ return l4_feature_from (l4_kip (), num);
+}
+
+
+/* Memory descriptors. */
+
+typedef __L4_memory_desc_t l4_memory_desc_t;
+
+#define L4_MEMDESC_UNDEFINED _L4_MEMDESC_UNDEFINED
+#define L4_MEMDESC_CONVENTIONAL _L4_MEMDESC_CONVENTIONAL
+#define L4_MEMDESC_RESERVED _L4_MEMDESC_RESERVED
+#define L4_MEMDESC_DEDICATED _L4_MEMDESC_DEDICATED
+#define L4_MEMDESC_SHARED _L4_MEMDESC_SHARED
+#define L4_MEMDESC_BOOTLOADER _L4_MEMDESC_BOOTLOADER
+#define L4_MEMDESC_ARCH _L4_MEMDESC_ARCH
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_num_memory_desc_from (l4_kip_t kip)
+{
+ return _L4_num_memory_desc (kip);
+}
+
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_num_memory_desc (void)
+{
+ return l4_num_memory_desc_from (l4_kip ());
+}
+
+
+static inline l4_memory_desc_t *
+_L4_attribute_always_inline
+l4_memory_desc_from (l4_kip_t kip, l4_word_t num)
+{
+ return _L4_memory_desc (kip, num);
+}
+
+
+static inline l4_memory_desc_t *
+_L4_attribute_always_inline
+l4_memory_desc (l4_word_t num)
+{
+ return l4_memory_desc_from (l4_kip (), num);
+}
+
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_is_memory_desc_virtual (l4_memory_desc_t *mem)
+{
+ return _L4_is_memory_desc_virtual (mem);
+}
+
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_memory_desc_type (l4_memory_desc_t *mem)
+{
+ return _L4_memory_desc_type (mem);
+}
+
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_memory_desc_low (l4_memory_desc_t *mem)
+{
+ return _L4_memory_desc_low (mem);
+}
+
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_memory_desc_high (l4_memory_desc_t *mem)
+{
+ return _L4_memory_desc_high (mem);
+}
+
+
+
+/* Processor descriptors. */
+
+typedef __L4_proc_desc_t l4_proc_desc_t;
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_num_processors_desc_from (l4_kip_t kip)
+{
+ return _L4_num_processors_desc (kip);
+}
+
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_num_processors_desc (void)
+{
+ return l4_num_processors_desc_from (l4_kip ());
+}
+
+
+static inline l4_proc_desc_t *
+_L4_attribute_always_inline
+l4_proc_desc_from (l4_kip_t kip, l4_word_t num)
+{
+ return _L4_proc_desc (kip, num);
+}
+
+
+static inline l4_proc_desc_t *
+_L4_attribute_always_inline
+l4_proc_desc (l4_word_t num)
+{
+ return l4_proc_desc_from (l4_kip (), num);
+}
+
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_proc_external_freq (l4_proc_desc_t *proc)
+{
+ return _L4_proc_external_freq (proc);
+}
+
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_proc_internal_freq (l4_proc_desc_t *proc)
+{
+ return _L4_proc_internal_freq (proc);
+}
diff --git a/libl4/l4/gnu/math.h b/libl4/l4/gnu/math.h
new file mode 100644
index 0000000..e91c6dc
--- /dev/null
+++ b/libl4/l4/gnu/math.h
@@ -0,0 +1,40 @@
+/* l4/gnu/math.h - Public GNU interface for L4 mathematical functions.
+ Copyright (C) 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_MATH_H
+# error "Never use <l4/gnu/math.h> directly; include <l4/math.h> instead."
+#endif
+
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_msb (l4_word_t data)
+{
+ return _L4_msb (data);
+}
+
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_lsb (l4_word_t data)
+{
+ return _L4_lsb (data);
+}
diff --git a/libl4/l4/gnu/message.h b/libl4/l4/gnu/message.h
new file mode 100644
index 0000000..f342356
--- /dev/null
+++ b/libl4/l4/gnu/message.h
@@ -0,0 +1,94 @@
+/* l4/gnu/message.h - Public GNU interface to the L4 message registers.
+ Copyright (C) 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_MESSAGE_H
+# error "Never use <l4/gnu/message.h> directly; include <l4/message.h> instead."
+#endif
+
+/* The number of buffer registers available. */
+#define L4_NUM_BRS _L4_NUM_BRS
+
+/* The number of message registers available. */
+#define L4_NUM_MRS _L4_NUM_MRS
+
+
+static inline void
+_L4_attribute_always_inline
+l4_store_mr (int i, l4_word_t *w)
+{
+ _L4_store_mr (i, w);
+}
+
+
+static inline void
+_L4_attribute_always_inline
+l4_load_mr (int i, l4_word_t w)
+{
+ _L4_load_mr (i, w);
+}
+
+
+static inline void
+_L4_attribute_always_inline
+l4_store_mrs (int i, int k, l4_word_t *w)
+{
+ _L4_store_mrs (i, k, w);
+}
+
+
+static inline void
+_L4_attribute_always_inline
+l4_load_mrs (int i, int k, l4_word_t *w)
+{
+ _L4_load_mrs (i, k, w);
+}
+
+
+static inline void
+_L4_attribute_always_inline
+l4_store_br (int i, l4_word_t *w)
+{
+ _L4_store_br (i, w);
+}
+
+
+static inline void
+_L4_attribute_always_inline
+l4_load_br (int i, l4_word_t w)
+{
+ _L4_load_br (i, w);
+}
+
+
+static inline void
+_L4_attribute_always_inline
+l4_store_brs (int i, int k, l4_word_t *w)
+{
+ _L4_store_brs (i, k, w);
+}
+
+
+static inline void
+_L4_attribute_always_inline
+l4_load_brs (int i, int k, l4_word_t *w)
+{
+ _L4_load_brs (i, k, w);
+}
diff --git a/libl4/l4/gnu/misc.h b/libl4/l4/gnu/misc.h
new file mode 100644
index 0000000..bbcbc63
--- /dev/null
+++ b/libl4/l4/gnu/misc.h
@@ -0,0 +1,62 @@
+/* l4/gnu/misc.h - Public GNU interface for L4 miscellaneous functions.
+ Copyright (C) 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
+# error "Never use <l4/gnu/misc.h> directly; include <l4/misc.h> instead."
+#endif
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_processor_control (l4_word_t proc, l4_word_t control,
+ l4_word_t internal_freq, l4_word_t external_freq,
+ l4_word_t voltage)
+{
+ return _L4_processor_control (proc, control, internal_freq, external_freq,
+ voltage);
+}
+
+
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_memory_control (l4_word_t control, l4_word_t *attributes)
+{
+ return _L4_memory_control (control, attributes);
+}
+
+
+#define L4_DEFAULT_MEMORY _L4_DEFAULT_MEMORY
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_set_page_attribute (l4_fpage_t fpage, l4_word_t attribute)
+{
+ return _L4_set_page_attribute (fpage, 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)
+{
+ return _L4_set_pages_attributes (nr, fpages, attributes);
+}
diff --git a/libl4/l4/gnu/schedule.h b/libl4/l4/gnu/schedule.h
new file mode 100644
index 0000000..d3c9dcc
--- /dev/null
+++ b/libl4/l4/gnu/schedule.h
@@ -0,0 +1,232 @@
+/* l4/gnu/schedule.h - Public GNU interface for L4 scheduling interface.
+ Copyright (C) 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_SCHEDULE_H
+# error "Never use <l4/gnu/schedule.h> directly; include <l4/schedule.h> instead."
+#endif
+
+
+typedef _L4_clock_t l4_clock_t;
+
+
+static inline l4_clock_t
+_L4_attribute_always_inline
+l4_SystemClock (void)
+{
+ return _L4_system_clock ();
+}
+
+
+typedef _L4_time_t l4_time_t;
+
+#define L4_NEVER _L4_never
+#define L4_ZERO_TIME _L4_zero_time
+
+static inline l4_time_t
+_L4_attribute_always_inline
+l4_time_period (l4_uint64_t usec)
+{
+ return _L4_time_period (usec);
+}
+
+
+static inline l4_time_t
+_L4_attribute_always_inline
+l4_time_point (l4_uint64_t at)
+{
+ return _L4_time_point (at);
+}
+
+
+static inline l4_time_t
+_L4_attribute_always_inline
+l4_time_add_usec (l4_time_t l, l4_word_t r)
+{
+ return _L4_time_add_usec (l, r);
+}
+
+
+static inline l4_time_t
+_L4_attribute_always_inline
+l4_time_sub_usec (l4_time_t l, l4_word_t r)
+{
+ return _L4_time_sub_usec (l, r);
+}
+
+
+static inline l4_time_t
+_L4_attribute_always_inline
+l4_time_add (l4_time_t l, l4_time_t r)
+{
+ return _L4_time_add (l, r);
+}
+
+
+static inline l4_time_t
+_L4_attribute_always_inline
+l4_time_sub (l4_time_t l, l4_time_t r)
+{
+ return _L4_time_sub (l, r);
+}
+
+
+static inline l4_time_t
+_L4_attribute_always_inline
+l4_is_time_longer (l4_time_t l, l4_time_t r)
+{
+ return _L4_time_longer (l, r);
+}
+
+
+static inline l4_time_t
+_L4_attribute_always_inline
+l4_is_time_shorter (l4_time_t l, l4_time_t r)
+{
+ return _L4_time_shorter (l, r);
+}
+
+
+static inline l4_time_t
+_L4_attribute_always_inline
+l4_is_time_equal (l4_time_t l, l4_time_t r)
+{
+ return _L4_time_equal (l, r);
+}
+
+
+static inline l4_time_t
+_L4_attribute_always_inline
+l4_is_time_not_equal (l4_time_t l, l4_time_t r)
+{
+ return _L4_time_not_equal (l, r);
+}
+
+
+
+static inline void
+_L4_attribute_always_inline
+l4_thread_switch (l4_thread_id_t thread)
+{
+ _L4_thread_switch (thread);
+}
+
+
+static inline void
+_L4_attribute_always_inline
+l4_yield (void)
+{
+ _L4_yield ();
+}
+
+
+
+/* Generic Programming Interface. */
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_schedule (l4_thread_id_t dest, l4_word_t time_control,
+ l4_word_t proc_control, l4_word_t prio,
+ l4_word_t preempt_control, l4_word_t *old_time_control)
+{
+ return _L4_schedule (dest, time_control, proc_control, prio,
+ preempt_control, old_time_control);
+}
+
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_set_priority (l4_thread_id_t dest, l4_word_t priority)
+{
+ return _L4_set_priority (dest, priority);
+}
+
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_set_processor_no (l4_thread_id_t dest, l4_word_t proc_num)
+{
+ return _L4_set_processor_no (dest, proc_num);
+}
+
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_time_slice (l4_thread_id_t dest, l4_time_t *ts,
+ l4_time_t *tq)
+{
+ return _L4_time_slice (dest, ts, tq);
+}
+
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_set_time_slice (l4_thread_id_t dest, l4_time_t ts, l4_time_t tq)
+{
+ return _L4_set_time_slice (dest, ts, tq);
+}
+
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_set_preemption_delay (l4_thread_id_t dest, l4_word_t sensitive_prio,
+ l4_word_t max_delay)
+{
+ return _L4_set_preemption_delay (dest, sensitive_prio, max_delay);
+}
+
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_enable_preemption_fault_exception (void)
+{
+ return _L4_enable_preemption_fault_exception ();
+}
+
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_disable_preemption_fault_exception (void)
+{
+ return _L4_disable_preemption_fault_exception ();
+}
+
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_enable_preemption (void)
+{
+ return _L4_enable_preemption ();
+}
+
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_disable_preemption (void)
+{
+ return _L4_disable_preemption ();
+}
+
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_preemptionpending (void)
+{
+ return _L4_preemption_pending ();
+}
diff --git a/libl4/l4/gnu/space.h b/libl4/l4/gnu/space.h
new file mode 100644
index 0000000..58433eb
--- /dev/null
+++ b/libl4/l4/gnu/space.h
@@ -0,0 +1,206 @@
+/* l4/gnu/space.h - Public GNU interface for L4 spaces.
+ Copyright (C) 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_SPACE_H
+# error "Never use <l4/gnu/space.h> directly; include <l4/space.h> instead."
+#endif
+
+
+#define L4_FPAGE_NO_ACCESS _l4_no_access
+#define L4_FPAGE_EXECUTABLE _L4_executable
+#define L4_FPAGE_WRITABLE _L4_writable
+#define L4_FPAGE_READABLE _L4_readable
+#define L4_FPAGE_FULLY_ACCESSIBLE _L4_fully_accessible
+#define L4_FPAGE_READ_EXEC_ONLY _L4_read_exec_only
+
+#define L4_NILPAGE _L4_nilpage
+#define L4_COMPLETE_ADDRESS_SPACE _L4_complete_address_space
+
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_is_nil_fpage (l4_fpage_t fpage)
+{
+ return _L4_is_nil_fpage (fpage);
+}
+
+
+static inline l4_fpage_t
+_L4_attribute_always_inline
+l4_fpage (l4_word_t base, int size)
+{
+ return _L4_fpage (base, size);
+}
+
+
+static inline l4_fpage_t
+_L4_attribute_always_inline
+l4_fpage_log2 (l4_word_t base, int log2_size)
+{
+ return _L4_fpage_log2 (base, log2_size);
+}
+
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_address (l4_fpage_t fpage)
+{
+ return _L4_address (fpage);
+}
+
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_size (l4_fpage_t fpage)
+{
+ return _L4_size (fpage);
+}
+
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_size_log2 (l4_fpage_t fpage)
+{
+ return _L4_size_log2 (fpage);
+}
+
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_rights (l4_fpage_t fpage)
+{
+ return _L4_rights (fpage);
+}
+
+
+static inline void
+_L4_attribute_always_inline
+l4_set_rights (l4_fpage_t *fpage, l4_word_t rights)
+{
+ _L4_set_rights (fpage, rights);
+}
+
+
+static inline l4_fpage_t
+_L4_attribute_always_inline
+l4_fpage_add_rights (l4_fpage_t fpage, l4_word_t rights)
+{
+ return _L4_fpage_add_rights (fpage, rights);
+}
+
+
+static inline void
+_L4_attribute_always_inline
+l4_fpage_add_rights_to (l4_fpage_t *fpage, l4_word_t rights)
+{
+ _L4_fpage_add_rights_to (fpage, rights);
+}
+
+
+static inline l4_fpage_t
+_L4_attribute_always_inline
+l4_fpage_remove_rights (l4_fpage_t fpage, l4_word_t rights)
+{
+ return _L4_fpage_remove_rights (fpage, rights);
+}
+
+
+static inline void
+_L4_attribute_always_inline
+l4_fpage_remove_rights_from (l4_fpage_t *fpage, l4_word_t rights)
+{
+ _L4_fpage_remove_rights_from (fpage, rights);
+}
+
+
+static inline void
+_L4_attribute_always_inline
+l4_unmap_fpage (l4_fpage_t fpage)
+{
+ _L4_unmap_fpage (fpage);
+}
+
+
+static inline void
+_L4_attribute_always_inline
+l4_unmap_fpages (l4_word_t nr, l4_fpage_t *fpages)
+{
+ _L4_unmap_fpages (nr, fpages);
+}
+
+
+static inline void
+_L4_attribute_always_inline
+l4_flush (l4_fpage_t fpage)
+{
+ _L4_flush (fpage);
+}
+
+
+static inline void
+_L4_attribute_always_inline
+l4_flush_fpages (l4_word_t nr, l4_fpage_t *fpages)
+{
+ _L4_flush_fpages (nr, fpages);
+}
+
+
+static inline l4_fpage_t
+_L4_attribute_always_inline
+l4_get_status (l4_fpage_t fpage)
+{
+ return _L4_get_status (fpage);
+}
+
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_was_referenced (l4_fpage_t fpage)
+{
+ return _L4_was_referenced (fpage);
+}
+
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_was_written (l4_fpage_t fpage)
+{
+ return _L4_was_written (fpage);
+}
+
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_was_executed (l4_fpage_t fpage)
+{
+ return _L4_was_executed (fpage);
+}
+
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_space_control (l4_thread_id_t space, l4_word_t control,
+ l4_fpage_t kip, l4_fpage_t utcb,
+ l4_thread_id_t redirector, l4_word_t *old_control)
+{
+ return _L4_space_control (space, control, kip, utcb, redirector,
+ old_control);
+}
diff --git a/libl4/l4/gnu/syscall.h b/libl4/l4/gnu/syscall.h
new file mode 100644
index 0000000..1bacff3
--- /dev/null
+++ b/libl4/l4/gnu/syscall.h
@@ -0,0 +1,78 @@
+/* l4/gnu/syscall.h - Public GNU interface for L4 system calls.
+ Copyright (C) 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_SYSCALL_H
+# error "Never use <l4/gnu/syscall.h> directly; include <l4/syscall.h> instead."
+#endif
+
+
+/* _L4_exchange_registers control argument. */
+
+/* Input. */
+#define L4_XCHG_REGS_HALT _L4_XCHG_REGS_HALT
+#define L4_XCHG_REGS_CANCEL_RECV _L4_XCHG_REGS_CANCEL_RECV
+#define L4_XCHG_REGS_CANCEL_SEND _L4_XCHG_REGS_CANCEL_SEND
+#define L4_XCHG_REGS_CANCEL_IPC _L4_XCHG_REGS_CANCEL_IPC
+#define L4_XCHG_REGS_SET_SP _L4_XCHG_REGS_SET_SP
+#define L4_XCHG_REGS_SET_IP _L4_XCHG_REGS_SET_IP
+#define L4_XCHG_REGS_SET_FLAGS _L4_XCHG_REGS_SET_FLAGS
+#define L4_XCHG_REGS_SET_USER_HANDLE _L4_XCHG_REGS_SET_USER_HANDLE
+#define L4_XCHG_REGS_SET_PAGER _L4_XCHG_REGS_SET_PAGER
+#define L4_XCHG_REGS_SET_HALT _L4_XCHG_REGS_SET_HALT
+
+/* Output. */
+#define L4_XCHG_REGS_HALTED _L4_XCHG_REGS_HALTED
+#define L4_XCHG_REGS_RECEIVING _L4_XCHG_REGS_RECEIVING
+#define L4_XCHG_REGS_SENDING _L4_XCHG_REGS_SENDING
+#define L4_XCHG_REGS_IPCING _L4_XCHG_REGS_IPCING
+
+
+/* _L4_schedule return codes. */
+#define L4_SCHEDULE_ERROR _L4_SCHEDULE_ERROR
+#define L4_SCHEDULE_DEAD _L4_SCHEDULE_DEAD
+#define L4_SCHEDULE_INACTIVE _L4_SCHEDULE_INACTIVE
+#define L4_SCHEDULE_RUNNING _L4_SCHEDULE_RUNNING
+#define L4_SCHEDULE_PENDING_SEND _L4_SCHEDULE_PENDING_SEND
+#define L4_SCHEDULE_SENDING _L4_SCHEDULE_SENDING
+#define L4_SCHEDULE_WAITING _L4_SCHEDULE_WAITING
+#define L4_SCHEDULE_RECEIVING _L4_SCHEDULE_RECEIVING
+
+
+/* _L4_unmap flags. */
+#define L4_UNMAP_FLUSH _L4_UNMAP_FLUSH
+#define L4_UNMAP_COUNT_MASK _L4_UNMAP_COUNT_MASK
+
+
+#define L4_ERR_NO_PRIVILEGE _L4_ERR_NO_PRIVILEGE
+#define L4_ERR_INV_THREAD _L4_ERR_INV_THREAD
+#define L4_ERR_INV_SPACE _L4_ERR_INV_SPACE
+#define L4_ERR_INV_SCHEDULER _L4_ERR_INV_SCHEDULER
+#define L4_ERR_INV_PARAM _L4_ERR_INV_PARAM
+#define L4_ERR_UTCB_AREA _L4_ERR_UTCB_AREA
+#define L4_ERR_KIP_AREA _L4_ERR_KIP_AREA
+#define L4_ERR_NO_MEM _L4_ERR_NO_MEM
+
+static inline const char *const
+_L4_attribute_always_inline
+l4_strerror (l4_word_t err_code)
+{
+ return _L4_strerror (err_code);
+}
diff --git a/libl4/l4/gnu/thread.h b/libl4/l4/gnu/thread.h
new file mode 100644
index 0000000..cac613f
--- /dev/null
+++ b/libl4/l4/gnu/thread.h
@@ -0,0 +1,429 @@
+/* l4/gnu/thread.h - Public GNU interface for L4 threads.
+ Copyright (C) 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_THREAD_H
+# error "Never use <l4/gnu/thread.h> directly; include <l4/thread.h> instead."
+#endif
+
+/* l4_thread_id_t is defined in <l4/gnu/types.h>. */
+
+#define l4_nilthread _L4_nilthread
+#define l4_anythread _L4_anythread
+#define l4_anylocalthread _L4_anylocalthread
+
+/* The theoretical maximum number of thread no bits. The practical
+ limit is l4_thread_id_bits(). */
+#define L4_THREAD_NO_BITS _L4_THREAD_NO_BITS
+#define L4_THREAD_VERSION_BITS _L4_THREAD_VERSION_BITS
+
+
+static inline l4_thread_id_t
+_L4_attribute_always_inline
+l4_global_id (l4_word_t thread_no, l4_word_t version)
+{
+ return _L4_global_id (thread_no, version);
+}
+
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_version (l4_thread_id_t thread)
+{
+ return _L4_version (thread);
+}
+
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_thread_no (l4_thread_id_t thread)
+{
+ return _L4_thread_no (thread);
+}
+
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_is_thread_equal (l4_thread_id_t thread1, l4_thread_id_t thread2)
+{
+ return _L4_is_thread_equal (thread1, thread2);
+}
+
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_is_thread_not_equal (l4_thread_id_t thread1, l4_thread_id_t thread2)
+{
+ return _L4_is_thread_not_equal (thread1, thread2);
+}
+
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_same_threads (l4_thread_id_t thread1, l4_thread_id_t thread2)
+{
+ return _L4_same_threads (thread1, thread2);
+}
+
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_is_nil_thread (l4_thread_id_t thread)
+{
+ return _L4_is_nil_thread (thread);
+}
+
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_is_local_id (l4_thread_id_t thread)
+{
+ return _L4_is_local_id (thread);
+}
+
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_is_global_id (l4_thread_id_t thread)
+{
+ return _L4_is_global_id (thread);
+}
+
+
+static inline l4_thread_id_t
+_L4_attribute_always_inline
+l4_my_local_id (void)
+{
+ return _L4_my_local_id ();
+}
+
+
+static inline l4_thread_id_t
+_L4_attribute_always_inline
+l4_my_global_id (void)
+{
+ return _L4_my_global_id ();
+}
+
+
+static inline l4_thread_id_t
+_L4_attribute_always_inline
+l4_myself (void)
+{
+ return _L4_myself ();
+}
+
+
+static inline l4_thread_id_t
+_L4_attribute_always_inline
+l4_global_id_of (l4_thread_id_t thread)
+{
+ return _L4_global_id_of (thread);
+}
+
+
+static inline l4_thread_id_t
+_L4_attribute_always_inline
+l4_local_id_of (l4_thread_id_t thread)
+{
+ return _L4_local_id_of (thread);
+}
+
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_processor_no (void)
+{
+ return _L4_processor_no ();
+}
+
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_user_defined_handle_of (l4_thread_id_t thread)
+{
+ return _L4_user_defined_handle_of (thread);
+}
+
+
+static inline void
+_L4_attribute_always_inline
+l4_set_user_defined_handle_of (l4_thread_id_t thread, l4_word_t handle)
+{
+ return _L4_set_user_defined_handle_of (thread, handle);
+}
+
+
+static inline l4_thread_id_t
+_L4_attribute_always_inline
+l4_pager_of (l4_thread_id_t thread)
+{
+ return _L4_pager_of (thread);
+}
+
+
+static inline void
+_L4_attribute_always_inline
+l4_set_pager_of (l4_thread_id_t thread, l4_thread_id_t pager_thread)
+{
+ return _L4_set_pager_of (thread, pager_thread);
+}
+
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_user_defined_handle (void)
+{
+ return _L4_user_defined_handle ();
+}
+
+
+static inline void
+_L4_attribute_always_inline
+l4_set_user_defined_handle (l4_word_t new)
+{
+ _L4_set_user_defined_handle (new);
+}
+
+
+static inline l4_thread_id_t
+_L4_attribute_always_inline
+l4_pager (void)
+{
+ return _L4_pager ();
+}
+
+
+static inline void
+_L4_attribute_always_inline
+l4_set_pager (l4_thread_id_t pager)
+{
+ _L4_set_pager (pager);
+}
+
+
+static inline l4_thread_id_t
+_L4_attribute_always_inline
+l4_exception_handler (void)
+{
+ return _L4_exception_handler ();
+}
+
+
+static inline void
+_L4_attribute_always_inline
+l4_set_exception_handler (l4_thread_id_t handler)
+{
+ _L4_set_exception_handler (handler);
+}
+
+
+static inline void
+_L4_attribute_always_inline
+l4_set_cop_flag (l4_word_t n)
+{
+ _L4_set_cop_flag (n);
+}
+
+
+static inline void
+_L4_attribute_always_inline
+l4_clr_cop_flag (l4_word_t n)
+{
+ _L4_clr_cop_flag (n);
+}
+
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_error_code (void)
+{
+ return _L4_error_code ();
+}
+
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_xfer_timeouts (void)
+{
+ return _L4_xfer_timeouts ();
+}
+
+
+static inline void
+_L4_attribute_always_inline
+l4_set_xfer_timeouts (l4_word_t timeouts)
+{
+ return _L4_set_xfer_timeouts (timeouts);
+}
+
+
+static inline l4_thread_id_t
+_L4_attribute_always_inline
+l4_intended_receiver (void)
+{
+ return _L4_intended_receiver ();
+}
+
+
+static inline l4_thread_id_t
+_L4_attribute_always_inline
+l4_actual_sender (void)
+{
+ return _L4_actual_sender ();
+}
+
+
+static inline void
+_L4_attribute_always_inline
+l4_set_virtual_sender (l4_thread_id_t t)
+{
+ _L4_set_virtual_sender (t);
+}
+
+
+
+static inline void
+_L4_attribute_always_inline
+l4_exchange_registers (l4_thread_id_t *dest, l4_word_t *control,
+ l4_word_t *sp, l4_word_t *ip, l4_word_t *flags,
+ l4_word_t *user_defined_handle, l4_thread_id_t *pager)
+{
+ _L4_exchange_registers (dest, control, sp, ip, flags,
+ user_defined_handle, pager);
+}
+
+
+static inline void
+_L4_attribute_always_inline
+l4_start (l4_thread_id_t thread)
+{
+ _L4_start (thread);
+}
+
+
+static inline void
+_L4_attribute_always_inline
+l4_start_sp_ip (l4_thread_id_t thread, l4_word_t sp, l4_word_t ip)
+{
+ _L4_start_sp_ip (thread, sp, ip);
+}
+
+
+static inline void
+_L4_attribute_always_inline
+l4_start_sp_ip_flags (l4_thread_id_t thread, l4_word_t sp,
+ l4_word_t ip, l4_word_t flags)
+{
+ return _L4_start_sp_ip_flags (thread, sp, ip, flags);
+}
+
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_stop (l4_thread_id_t thread)
+{
+ return _L4_stop (thread);
+}
+
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_stop_sp_ip_flags (l4_thread_id_t thread, l4_word_t *sp, l4_word_t *ip,
+ l4_word_t *flags)
+{
+ return _L4_stop_sp_ip_flags (thread, sp, ip, flags);
+}
+
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_abort_receive_and_stop (l4_thread_id_t thread)
+{
+ return _L4_abort_receive_and_stop (thread);
+}
+
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_abort_receive_and_stop_sp_ip_flags (l4_thread_id_t thread, l4_word_t *sp,
+ l4_word_t *ip, l4_word_t *flags)
+{
+ return _L4_abort_receive_and_stop_sp_ip_flags (thread, sp, ip, flags);
+}
+
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_abort_send_and_stop (l4_thread_id_t thread)
+{
+ return _L4_abort_send_and_stop (thread);
+}
+
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_abort_send_and_stop_sp_ip_flags
+(l4_thread_id_t thread, l4_word_t *sp, l4_word_t *ip, l4_word_t *flags)
+{
+ return _L4_abort_send_and_stop_sp_ip_flags (thread, sp, ip, flags);
+}
+
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_abort_ipc_and_stop (l4_thread_id_t thread)
+{
+ return _L4_abort_ipc_and_stop (thread);
+}
+
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_abort_ipc_and_stop_sp_ip_flags
+(l4_thread_id_t thread, l4_word_t *sp, l4_word_t *ip, l4_word_t *flags)
+{
+ return _L4_abort_ipc_and_stop_sp_ip_flags (thread, sp, ip, flags);
+}
+
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_thread_control (l4_thread_id_t dest, l4_thread_id_t space,
+ l4_thread_id_t scheduler, l4_thread_id_t pager, void *utcb)
+{
+ return _L4_thread_control (dest, space, scheduler, pager, utcb);
+}
+
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_associate_interrupt (l4_thread_id_t irq, l4_thread_id_t handler)
+{
+ return _L4_associate_interrupt (irq, handler);
+}
+
+
+static inline l4_word_t
+_L4_attribute_always_inline
+l4_deassociate_interrupt (l4_thread_id_t irq)
+{
+ return _L4_deassociate_interrupt (irq);
+}
diff --git a/libl4/l4/gnu/types.h b/libl4/l4/gnu/types.h
new file mode 100644
index 0000000..3aef347
--- /dev/null
+++ b/libl4/l4/gnu/types.h
@@ -0,0 +1,76 @@
+/* l4/gnu/types.h - Public GNU interface for L4 types.
+ 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_TYPES_H
+# error "Never use <l4/gnu/types.h> directly; include <l4/types.h> instead."
+#endif
+
+
+#define L4_BYTE_ORDER _L4_BYTE_ORDER
+#define L4_WORDSIZE _L4_WORDSIZE
+
+#define L4_LITTLE_ENDIAN _L4_LITTLE_ENDIAN
+#define L4_BIG_ENDIAN _L4_BIG_ENDIAN
+
+#define L4_WORDSIZE_32 _L4_WORDSIZE_32
+#define L4_WORDSIZE_64 _L4_WORDSIZE_64
+
+
+typedef _L4_int8_t l4_int8_t;
+typedef _L4_int16_t l4_int16_t;
+typedef _L4_int32_t l4_int32_t;
+typedef _L4_int64_t l4_int64_t;
+
+typedef _L4_uint8_t l4_uint8_t;
+typedef _L4_uint16_t l4_uint16_t;
+typedef _L4_uint32_t l4_uint32_t;
+typedef _L4_uint64_t l4_uint64_t;
+
+
+typedef _L4_word_t l4_word_t;
+#define L4_WORD_C(x) _L4_WORD_C(x)
+
+#if _L4_WORDSIZE == _L4_WORDSIZE_32
+#define __L4_PRI_PREFIX
+#else
+#define __L4_PRI_PREFIX "l"
+#endif
+
+#define L4_PRIdWORD __L4_PRI_PREFIX "d"
+#define L4_PRIiWORD __L4_PRI_PREFIX "i"
+#define L4_PRIoWORD __L4_PRI_PREFIX "o"
+#define L4_PRIuWORD __L4_PRI_PREFIX "u"
+#define L4_PRIxWORD __L4_PRI_PREFIX "x"
+#define L4_PRIXWORD __L4_PRI_PREFIX "X"
+
+#define L4_SCNdWORD __L4_PRI_PREFIX "d"
+#define L4_SCNiWORD __L4_PRI_PREFIX "i"
+#define L4_SCNoWORD __L4_PRI_PREFIX "o"
+#define L4_SCNuWORD __L4_PRI_PREFIX "u"
+#define L4_SCNxWORD __L4_PRI_PREFIX "x"
+#define L4_SCNXWORD __L4_PRI_PREFIX "X"
+
+
+/* Basic types. */
+
+typedef _L4_thread_id_t l4_thread_id_t;
+
+typedef _L4_fpage_t l4_fpage_t;
diff --git a/libl4/l4/init.h b/libl4/l4/init.h
index aa383de..5dfcaf5 100644
--- a/libl4/l4/init.h
+++ b/libl4/l4/init.h
@@ -1,5 +1,5 @@
-/* init.h - Public interface to L4 for initialization.
- Copyright (C) 2003 Free Software Foundation, Inc.
+/* l4/init.h - Public interface to L4 for initialization.
+ Copyright (C) 2003, 2004 Free Software Foundation, Inc.
Written by Marcus Brinkmann <marcus@gnu.org>.
This file is part of the GNU L4 library.
@@ -22,20 +22,21 @@
#ifndef _L4_INIT_H
#define _L4_INIT_H 1
+#include <l4/features.h>
#include <l4/kip.h>
#include <l4/syscall.h>
/* Initialize the global data. */
static inline void
-__attribute__((__always_inline__))
+_L4_attribute_always_inline
l4_init (void)
{
- l4_api_version_t version;
- l4_api_flags_t flags;
- l4_kernel_id_t id;
+ _L4_api_version_t version;
+ _L4_api_flags_t flags;
+ _L4_kernel_id_t id;
- __l4_kip = l4_kernel_interface (&version, &flags, &id);
+ __l4_kip = _L4_kernel_interface (&version, &flags, &id);
};
#endif /* l4/init.h */
diff --git a/libl4/l4/ipc.h b/libl4/l4/ipc.h
index f0e2dba..cb7ab37 100644
--- a/libl4/l4/ipc.h
+++ b/libl4/l4/ipc.h
@@ -1,5 +1,5 @@
-/* ipc.h - Public interface to the L4 IPC primitive.
- Copyright (C) 2003 Free Software Foundation, Inc.
+/* l4/ipc.h - Public interface to the L4 IPC primitive.
+ Copyright (C) 2003, 2004 Free Software Foundation, Inc.
Written by Marcus Brinkmann <marcus@gnu.org>.
This file is part of the GNU L4 library.
@@ -22,183 +22,278 @@
#ifndef _L4_IPC_H
#define _L4_IPC_H 1
+#include <l4/features.h>
#include <l4/types.h>
#include <l4/bits/ipc.h>
#include <l4/vregs.h>
#include <l4/syscall.h>
#include <l4/schedule.h>
+#include <l4/message.h>
+/* Must make visible the thread control registers related to IPC. */
+#include <l4/thread.h>
+
+
/* Message tags. */
-#define l4_niltag ((l4_msg_tag_t) { .raw = 0 })
+/* _L4_msg_tag_t is defined in <l4/types.h>. */
+
+typedef _L4_RAW (_L4_msg_tag_t, _L4_STRUCT1 ({
+ _L4_BITFIELD7
+ (_L4_word_t,
+ _L4_BITFIELD (untyped, 6),
+ _L4_BITFIELD (typed, 6),
+ _L4_BITFIELD (propagated, 1),
+ _L4_BITFIELD (redirected, 1),
+ _L4_BITFIELD (cross_cpu, 1),
+ _L4_BITFIELD (error, 1),
+ _L4_BITFIELD_32_64 (label, 16, 48));
+})) __L4_msg_tag_t;
+
+#define _L4_niltag ((_L4_msg_tag_t) 0 )
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_is_msg_tag_equal (l4_msg_tag_t tag1, l4_msg_tag_t tag2)
+
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_is_msg_tag_equal (_L4_msg_tag_t tag1, _L4_msg_tag_t tag2)
{
- return tag1.raw == tag2.raw;
+ return tag1 == tag2;
}
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_is_msg_tag_not_equal (l4_msg_tag_t tag1, l4_msg_tag_t tag2)
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_is_msg_tag_not_equal (_L4_msg_tag_t tag1, _L4_msg_tag_t tag2)
{
- return tag1.raw != tag2.raw;
+ return tag1 != tag2;
}
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_label (l4_msg_tag_t tag)
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_label (_L4_msg_tag_t tag)
{
- return tag.label;
+ __L4_msg_tag_t _tag;
+
+ _tag.raw = tag;
+ return _tag.label;
}
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_untyped_words (l4_msg_tag_t tag)
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_untyped_words (_L4_msg_tag_t tag)
{
- return tag.untyped;
+ __L4_msg_tag_t _tag;
+
+ _tag.raw = tag;
+ return _tag.untyped;
}
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_typed_words (l4_msg_tag_t tag)
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_typed_words (_L4_msg_tag_t tag)
{
- return tag.typed;
+ __L4_msg_tag_t _tag;
+
+ _tag.raw = tag;
+ return _tag.typed;
}
-static inline l4_msg_tag_t
-__attribute__((__always_inline__))
-l4_msg_tag_add_label (l4_msg_tag_t tag, l4_word_t label)
+static inline _L4_msg_tag_t
+_L4_attribute_always_inline
+_L4_msg_tag_add_label (_L4_msg_tag_t tag, _L4_word_t label)
{
- l4_msg_tag_t new_tag = tag;
- new_tag.label = label;
- return new_tag;
+ __L4_msg_tag_t _tag;
+
+ _tag.raw = tag;
+ _tag.label = label;
+ return _tag.raw;
}
static inline void
-__attribute__((__always_inline__))
-l4_msg_tag_add_label_to (l4_msg_tag_t *tag, l4_word_t label)
+_L4_attribute_always_inline
+_L4_msg_tag_add_label_to (_L4_msg_tag_t *tag, _L4_word_t label)
{
- tag->label = label;
+ __L4_msg_tag_t _tag;
+
+ _tag.raw = *tag;
+ _tag.label = label;
+ *tag = _tag.raw;
}
-static inline l4_msg_tag_t
-__attribute__((__always_inline__))
-l4_msg_tag (void)
+static inline _L4_msg_tag_t
+_L4_attribute_always_inline
+_L4_msg_tag (void)
{
- l4_msg_tag_t tag;
- l4_store_mr (0, &tag.raw);
+ _L4_msg_tag_t tag;
+ _L4_store_mr (0, &tag);
return tag;
}
static inline void
-__attribute__((__always_inline__))
-l4_set_msg_tag (l4_msg_tag_t tag)
+_L4_attribute_always_inline
+_L4_set_msg_tag (_L4_msg_tag_t tag)
{
- l4_load_mr (0, tag.raw);
+ _L4_load_mr (0, tag);
}
/* Map items. */
+typedef _L4_dword_t _L4_map_item_t;
+
typedef union
{
- l4_word_t raw[2];
+ _L4_map_item_t raw;
+
struct
{
_L4_BITFIELD4
- (l4_word_t,
+ (_L4_word_t,
_L4_BITFIELD (not_last, 1),
_L4_BITFIELD (_four, 3),
_L4_BITFIELD (_zero, 6),
_L4_BITFIELD_32_64 (send_base, 22, 54));
- l4_fpage_t send_fpage;
+ _L4_fpage_t send_fpage;
};
-} l4_map_item_t;
+} __L4_map_item_t;
-static inline l4_map_item_t
-__attribute__((__always_inline__))
-l4_map_item (l4_fpage_t fpage, l4_word_t send_base)
+static inline _L4_map_item_t
+_L4_attribute_always_inline
+_L4_map_item (_L4_fpage_t fpage, _L4_word_t send_base)
{
- l4_map_item_t map_item;
+ __L4_map_item_t map_item;
map_item.not_last = 0;
map_item._four = 4;
map_item._zero = 0;
- map_item.send_base = send_base / 1024;
+ map_item.send_base = send_base >> 10;
map_item.send_fpage = fpage;
- return map_item;
+ return map_item.raw;
+}
+
+
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_is_map_item (_L4_map_item_t map_item)
+{
+ __L4_map_item_t _map_item;
+
+ _map_item.raw = map_item;
+ return _map_item._four == 4;
+}
+
+
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_map_item_snd_fpage (_L4_map_item_t map_item)
+{
+ __L4_map_item_t _map_item;
+
+ _map_item.raw = map_item;
+ return _map_item.send_fpage;
}
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_is_map_item (l4_map_item_t map_item)
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_map_item_snd_base (_L4_map_item_t map_item)
{
- return map_item._four == 4;
+ __L4_map_item_t _map_item;
+
+ _map_item.raw = map_item;
+ return _map_item.send_base << 10;
}
/* Grant items. */
+typedef _L4_dword_t _L4_grant_item_t;
+
typedef union
{
- l4_word_t raw[2];
+
+ _L4_grant_item_t raw;
+
struct
{
_L4_BITFIELD4
- (l4_word_t,
+ (_L4_word_t,
_L4_BITFIELD (not_last, 1),
_L4_BITFIELD (_five, 3),
_L4_BITFIELD (_zero, 6),
_L4_BITFIELD_32_64 (send_base, 22, 54));
- l4_fpage_t send_fpage;
+ _L4_fpage_t send_fpage;
};
-} l4_grant_item_t;
+} __L4_grant_item_t;
-static inline l4_grant_item_t
-__attribute__((__always_inline__))
-l4_grant_item (l4_fpage_t fpage, l4_word_t send_base)
+static inline _L4_grant_item_t
+_L4_attribute_always_inline
+_L4_grant_item (_L4_fpage_t fpage, _L4_word_t send_base)
{
- l4_grant_item_t grant_item;
+ __L4_grant_item_t grant_item;
grant_item.not_last = 0;
grant_item._five = 5;
grant_item._zero = 0;
grant_item.send_base = send_base / 1024;
grant_item.send_fpage = fpage;
- return grant_item;
+ return grant_item.raw;
}
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_is_grant_item (l4_grant_item_t grant_item)
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_is_grant_item (_L4_grant_item_t grant_item)
{
- return grant_item._five == 5;
+ __L4_grant_item_t _grant_item;
+ _grant_item.raw = grant_item;
+ return _grant_item._five == 5;
+}
+
+
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_grant_item_snd_fpage (_L4_grant_item_t grant_item)
+{
+ __L4_grant_item_t _grant_item;
+
+ _grant_item.raw = grant_item;
+ return _grant_item.send_fpage;
+}
+
+
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_grant_item_snd_base (_L4_grant_item_t grant_item)
+{
+ __L4_grant_item_t _grant_item;
+
+ _grant_item.raw = grant_item;
+ return _grant_item.send_base << 10;
}
/* String items. */
+typedef _L4_dword_t _L4_string_item_t;
+
typedef union
{
- l4_word_t raw[2];
+ _L4_string_item_t raw;
+
struct
{
_L4_BITFIELD6
- (l4_word_t,
+ (_L4_word_t,
_L4_BITFIELD (not_last, 1),
_L4_BITFIELD (cache_hint, 2),
_L4_BITFIELD (_zero, 1),
@@ -206,76 +301,79 @@ typedef union
_L4_BITFIELD (cont, 1),
_L4_BITFIELD_32_64 (length, 22, 54));
- l4_word_t string[1];
+ _L4_word_t string[1];
};
-} l4_string_item_t;
+} __L4_string_item_t;
-typedef struct
-{
- l4_word_t cache_hint;
-} l4_cache_allocation_hint_t;
+typedef _L4_word_t _L4_cache_allocation_hint_t;
-#define l4_use_default_cache_line_allocation \
- ((l4_cache_allocation_hint_t) { .cache_hint = 0 })
+#define _L4_use_default_cache_line_allocation ((_L4_cache_allocation_hint_t) 0)
-
-static inline l4_string_item_t
-__attribute__((__always_inline__))
-l4_string_item (int length, void *address)
+static inline _L4_string_item_t
+_L4_attribute_always_inline
+_L4_string_item (int length, void *address)
{
- l4_string_item_t string_item;
+ __L4_string_item_t string_item;
string_item.not_last = 0;
- string_item.cache_hint = l4_use_default_cache_line_allocation.cache_hint;
+ string_item.cache_hint = _L4_use_default_cache_line_allocation;
string_item._zero = 0;
string_item.nr_substrings = 0;
string_item.cont = 0;
string_item.length = length;
- string_item.string[0] = (l4_word_t) address;
- return string_item;
+ string_item.string[0] = (_L4_word_t) address;
+ return string_item.raw;
}
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_is_string_item (l4_string_item_t *string_item)
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_is_string_item (_L4_string_item_t *string_item)
{
- return string_item->_zero == 0;
+ __L4_string_item_t *_string_item = (__L4_string_item_t *) string_item;
+
+ return _string_item->_zero == 0;
}
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_compound_string (l4_string_item_t *string_item)
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_compound_string (_L4_string_item_t *string_item)
{
- return string_item->cont;
+ __L4_string_item_t *_string_item = (__L4_string_item_t *) string_item;
+
+ return _string_item->cont;
}
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_substrings (l4_string_item_t *string_item)
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_substrings (_L4_string_item_t *string_item)
{
- return string_item->nr_substrings + 1;
+ __L4_string_item_t *_string_item = (__L4_string_item_t *) string_item;
+
+ return _string_item->nr_substrings + 1;
}
static inline void *
-__attribute__((__always_inline__))
-l4_substring (l4_string_item_t *string_item, l4_word_t nr)
+_L4_attribute_always_inline
+_L4_substring (_L4_string_item_t *string_item, _L4_word_t nr)
{
- return (void *) string_item->string[nr];
+ __L4_string_item_t *_string_item = (__L4_string_item_t *) string_item;
+ return (void *) _string_item->string[nr];
}
/* Append the string described by string item SOURCE to the string
described by string item STRING_ITEM. */
-static inline l4_string_item_t *
-__attribute__((__always_inline__))
-l4_add_substring_address_to (l4_string_item_t *string_item,
- l4_string_item_t *source)
+static inline _L4_string_item_t *
+_L4_attribute_always_inline
+_L4_add_substring_address_to (_L4_string_item_t *string_item,
+ _L4_string_item_t *source)
{
- l4_string_item_t *target = string_item;
+ __L4_string_item_t *target = (__L4_string_item_t *) string_item;
+ __L4_string_item_t *_source = (__L4_string_item_t *) source;
int cont;
/* First search for end of target string item. */
@@ -284,18 +382,18 @@ l4_add_substring_address_to (l4_string_item_t *string_item,
cont = target->cont;
if (!cont)
target->cont = 1;
- target = (l4_string_item_t *)
- (((void *) target) + 1 + target->nr_substrings + 1);
+ target = (__L4_string_item_t *)
+ (((_L4_word_t *) target) + 1 + target->nr_substrings + 1);
}
while (cont);
/* Now copy the source string item. */
do
{
- int nr = 1 + source->nr_substrings + 1;
- cont = source->cont;
+ int nr = 1 + _source->nr_substrings + 1;
+ cont = _source->cont;
while (nr--)
- *(target++) = *(source++);
+ *(target++) = *(_source++);
}
while (cont);
@@ -305,256 +403,269 @@ l4_add_substring_address_to (l4_string_item_t *string_item,
/* Append the string described by string item SOURCE as a substring
(of the same length) to the string item STRING_ITEM. */
-static inline l4_string_item_t *
-__attribute__((__always_inline__))
-l4_add_substring_to (l4_string_item_t *string_item, void *source)
+static inline _L4_string_item_t *
+_L4_attribute_always_inline
+_L4_add_substring_to (_L4_string_item_t *string_item, void *source)
{
- l4_string_item_t *target = string_item;
+ __L4_string_item_t *target = (__L4_string_item_t *) string_item;
/* First search for end of target string item. */
while (target->cont)
- target = (l4_string_item_t *)
- (((void *) target) + 1 + target->nr_substrings + 1);
+ target = (__L4_string_item_t *)
+ (((_L4_word_t *) target) + 1 + target->nr_substrings + 1);
/* Now add the source substring. */
target->nr_substrings++;
- target->string[target->nr_substrings + 1] = (l4_word_t) source;
+ target->string[target->nr_substrings + 1] = (_L4_word_t) source;
return string_item;
}
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_is_cache_allocation_hint_equal (l4_cache_allocation_hint_t hint1,
- l4_cache_allocation_hint_t hint2)
+static inline _L4_cache_allocation_hint_t
+_L4_attribute_always_inline
+_L4_cache_allocation_hint (_L4_string_item_t string_item)
{
- return hint1.cache_hint == hint2.cache_hint;
-}
-
+ __L4_string_item_t _string_item;
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_is_cache_allocation_hint_not_equal (l4_cache_allocation_hint_t hint1,
- l4_cache_allocation_hint_t hint2)
-{
- return hint1.cache_hint != hint2.cache_hint;
+ _string_item.raw = string_item;
+ return _string_item.cache_hint;
}
-static inline l4_cache_allocation_hint_t
-__attribute__((__always_inline__))
-l4_cache_allocation_hint (l4_string_item_t *string_item)
+static inline _L4_string_item_t
+_L4_attribute_always_inline
+_L4_add_cache_allocation_hint (_L4_string_item_t string_item,
+ _L4_cache_allocation_hint_t hint)
{
- l4_cache_allocation_hint_t hint;
- hint.cache_hint = string_item->cache_hint;
- return hint;
-}
-
+ __L4_string_item_t _string_item;
-static inline l4_string_item_t
-__attribute__((__always_inline__))
-l4_add_cache_allocation_hint (l4_string_item_t string_item,
- l4_cache_allocation_hint_t hint)
-{
- string_item.cache_hint = hint.cache_hint;
- return string_item;
+ _string_item.raw = string_item;
+ _string_item.cache_hint = hint;
+ return _string_item.raw;
}
-static inline l4_string_item_t *
-__attribute__((__always_inline__))
-l4_add_cache_allocation_hint_to (l4_string_item_t *string_item,
- l4_cache_allocation_hint_t hint)
+static inline _L4_string_item_t *
+_L4_attribute_always_inline
+_L4_add_cache_allocation_hint_to (_L4_string_item_t *string_item,
+ _L4_cache_allocation_hint_t hint)
{
- string_item->cache_hint = hint.cache_hint;
+ __L4_string_item_t *_string_item = (__L4_string_item_t *) string_item;
+
+ _string_item->cache_hint = hint;
return string_item;
}
/* Acceptors and message buffers. */
-typedef _L4_RAW (l4_word_t, _L4_STRUCT1 ({
+
+typedef _L4_word_t _L4_acceptor_t;
+
+typedef _L4_RAW (_L4_acceptor_t, _L4_STRUCT1 ({
_L4_BITFIELD3
- (l4_word_t,
+ (_L4_word_t,
_L4_BITFIELD (string_items, 1),
_L4_BITFIELD (_zero, 3),
_L4_BITFIELD_32_64 (rcv_window, 28, 60));
-})) l4_acceptor_t;
+})) __L4_acceptor_t;
-#define l4_untyped_words_acceptor \
- ((l4_acceptor_t) { .string_items = 0, ._zero = 0, .rcv_window = 0 })
-#define l4_string_items_acceptor \
- ((l4_acceptor_t) { .string_items = 1, ._zero = 0, .rcv_window = 0 })
+#define _L4_untyped_words_acceptor ((_L4_acceptor_t) 0)
+/* For string items, only bit 1 is set. */
+#define _L4_string_items_acceptor ((_L4_acceptor_t) 1)
+typedef _L4_word_t _L4_msg_buffer_t[_L4_NUM_BRS - 1];
-typedef union
+static inline _L4_acceptor_t
+_L4_attribute_always_inline
+_L4_map_grant_items (_L4_fpage_t rcv_window)
{
- l4_word_t br[33];
- l4_string_item_t string_item[33];
-} l4_msg_buffer_t;
-
-
-static inline l4_acceptor_t
-__attribute__((__always_inline__))
-l4_map_grant_items (l4_fpage_t rcv_window)
-{
- l4_acceptor_t acceptor;
- acceptor.raw = rcv_window.raw;
- acceptor.string_items = 1;
+ __L4_acceptor_t acceptor;
+ acceptor.raw = rcv_window;
+ acceptor.string_items = 0;
acceptor._zero = 0;
- return acceptor;
+ return acceptor.raw;
}
-static inline l4_acceptor_t
-__attribute__((__always_inline__))
-l4_add_acceptor (l4_acceptor_t acceptor1, l4_acceptor_t acceptor2)
+static inline _L4_acceptor_t
+_L4_attribute_always_inline
+_L4_add_acceptor (_L4_acceptor_t acceptor1, _L4_acceptor_t acceptor2)
{
- acceptor1.string_items |= acceptor2.string_items;
- if (acceptor2.rcv_window)
- acceptor1.rcv_window = acceptor2.rcv_window;
- return acceptor1;
+ __L4_acceptor_t _acceptor1;
+ __L4_acceptor_t _acceptor2;
+
+ _acceptor1.raw = acceptor1;
+ _acceptor2.raw = acceptor2;
+ _acceptor1.string_items |= _acceptor2.string_items;
+ if (_acceptor2.rcv_window)
+ _acceptor1.rcv_window = _acceptor2.rcv_window;
+ return _acceptor1.raw;
}
-static inline l4_acceptor_t *
-__attribute__((__always_inline__))
-l4_add_acceptor_to (l4_acceptor_t *acceptor1, l4_acceptor_t acceptor2)
+static inline _L4_acceptor_t *
+_L4_attribute_always_inline
+_L4_add_acceptor_to (_L4_acceptor_t *acceptor1, _L4_acceptor_t acceptor2)
{
- acceptor1->string_items |= acceptor2.string_items;
- if (acceptor2.rcv_window)
- acceptor1->rcv_window = acceptor2.rcv_window;
+ __L4_acceptor_t *_acceptor1 = (__L4_acceptor_t *) acceptor1;
+ __L4_acceptor_t _acceptor2;
+
+ _acceptor2.raw = acceptor2;
+ _acceptor1->string_items |= _acceptor2.string_items;
+ if (_acceptor2.rcv_window)
+ _acceptor1->rcv_window = _acceptor2.rcv_window;
return acceptor1;
}
-static inline l4_acceptor_t
-__attribute__((__always_inline__))
-l4_remove_acceptor (l4_acceptor_t acceptor1, l4_acceptor_t acceptor2)
+static inline _L4_acceptor_t
+_L4_attribute_always_inline
+_L4_remove_acceptor (_L4_acceptor_t acceptor1, _L4_acceptor_t acceptor2)
{
- acceptor1.string_items &= ~acceptor2.string_items;
- if (acceptor2.rcv_window)
- acceptor1.rcv_window = 0;
- return acceptor1;
+ __L4_acceptor_t _acceptor1;
+ __L4_acceptor_t _acceptor2;
+
+ _acceptor1.raw = acceptor1;
+ _acceptor2.raw = acceptor2;
+ _acceptor1.string_items &= ~_acceptor2.string_items;
+ if (_acceptor2.rcv_window)
+ _acceptor1.rcv_window = 0;
+ return _acceptor1.raw;
}
-static inline l4_acceptor_t *
-__attribute__((__always_inline__))
-l4_remove_acceptor_from (l4_acceptor_t *acceptor1, l4_acceptor_t acceptor2)
+static inline _L4_acceptor_t *
+_L4_attribute_always_inline
+_L4_remove_acceptor_from (_L4_acceptor_t *acceptor1, _L4_acceptor_t acceptor2)
{
- acceptor1->string_items &= ~acceptor2.string_items;
- if (acceptor2.rcv_window)
- acceptor1->rcv_window = 0;
+ __L4_acceptor_t *_acceptor1 = (__L4_acceptor_t *) acceptor1;
+ __L4_acceptor_t _acceptor2;
+
+ _acceptor2.raw = acceptor2;
+ _acceptor1->string_items &= ~_acceptor2.string_items;
+ if (_acceptor2.rcv_window)
+ _acceptor1->rcv_window = 0;
return acceptor1;
}
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_has_string_items (l4_acceptor_t acceptor)
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_has_string_items (_L4_acceptor_t acceptor)
{
- return acceptor.string_items;
+ __L4_acceptor_t _acceptor;
+
+ _acceptor.raw = acceptor;
+ return _acceptor.string_items;
}
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_has_map_grant_items (l4_acceptor_t acceptor)
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_has_map_grant_items (_L4_acceptor_t acceptor)
{
- return acceptor.rcv_window;
+ __L4_acceptor_t _acceptor;
+
+ _acceptor.raw = acceptor;
+ return _acceptor.rcv_window;
}
-static inline l4_fpage_t
-__attribute__((__always_inline__))
-l4_rcv_window (l4_acceptor_t acceptor)
+static inline _L4_fpage_t
+_L4_attribute_always_inline
+_L4_rcv_window (_L4_acceptor_t acceptor)
{
- l4_fpage_t fpage;
- acceptor.string_items = 0;
- fpage.raw = acceptor.raw;
- return fpage;
+ __L4_acceptor_t _acceptor;
+
+ _acceptor.raw = acceptor;
+ _acceptor.string_items = 0;
+ return (_L4_fpage_t) _acceptor.rcv_window;
}
static inline void
-__attribute__((__always_inline__))
-l4_accept (l4_acceptor_t acceptor)
+_L4_attribute_always_inline
+_L4_accept (_L4_acceptor_t acceptor)
{
- l4_load_br (0, acceptor.raw);
+ _L4_load_br (0, acceptor);
}
static inline void
-__attribute__((__always_inline__))
-l4_accept_strings (l4_acceptor_t acceptor, l4_msg_buffer_t *msg_buffer)
+_L4_attribute_always_inline
+_L4_accept_strings (_L4_acceptor_t acceptor, _L4_msg_buffer_t msg_buffer)
{
- l4_string_item_t *string_item = msg_buffer->string_item;
+ __L4_string_item_t *string_item = (__L4_string_item_t *) msg_buffer;
int br = 1;
int cont;
- l4_load_br (0, acceptor.raw);
+ _L4_load_br (0, acceptor);
do
{
int nr = 1 + string_item->nr_substrings + 1;
cont = string_item->cont || string_item->not_last;
- l4_load_brs (br, nr, (l4_word_t *) string_item);
+ _L4_load_brs (br, nr, (_L4_word_t *) string_item);
br += nr;
- string_item = (l4_string_item_t *) (((void *) string_item) + nr);
+ string_item = (__L4_string_item_t *) (((_L4_word_t *) string_item) + nr);
}
while (cont);
}
-static inline l4_acceptor_t
-__attribute__((__always_inline__))
-l4_accepted (void)
+static inline _L4_acceptor_t
+_L4_attribute_always_inline
+_L4_accepted (void)
{
- l4_acceptor_t acceptor;
- l4_store_br (0, &acceptor.raw);
+ _L4_acceptor_t acceptor;
+ _L4_store_br (0, &acceptor);
return acceptor;
}
static inline void
-__attribute__((__always_inline__))
-l4_msg_buffer_clear (l4_msg_buffer_t *msg_buffer)
+_L4_attribute_always_inline
+_L4_msg_buffer_clear (_L4_msg_buffer_t msg_buffer)
{
- msg_buffer->br[0] = 0;
+ msg_buffer[0] = 0;
}
static inline void
-__attribute__((__always_inline__))
-l4_msg_buffer_append_simple_rcv_string (l4_msg_buffer_t *msg_buffer,
- l4_string_item_t string_item)
+_L4_attribute_always_inline
+_L4_msg_buffer_append_simple_rcv_string (_L4_msg_buffer_t msg_buffer,
+ _L4_string_item_t string_item)
{
- l4_string_item_t *target = msg_buffer->string_item;
+ __L4_string_item_t *target = (__L4_string_item_t *) msg_buffer;
+ __L4_string_item_t _string_item;
int cont;
+ _string_item.raw = string_item;
+
do
{
int nr = 1 + target->nr_substrings + 1;
cont = target->cont | target->not_last;
if (!cont)
target->not_last = 1;
- target = (l4_string_item_t *) (((void *) target) + nr);
+ target = (__L4_string_item_t *) (((_L4_word_t *) target) + nr);
}
while (cont);
- string_item.not_last = 0;
- string_item.nr_substrings = 0;
- *target = string_item;
+ _string_item.not_last = 0;
+ _string_item.nr_substrings = 0;
+ *target = _string_item;
}
static inline void
-__attribute__((__always_inline__))
-l4_msg_buffer_append_rcv_string (l4_msg_buffer_t *msg_buffer,
- l4_string_item_t *string_item)
+_L4_attribute_always_inline
+_L4_msg_buffer_append_rcv_string (_L4_msg_buffer_t msg_buffer,
+ _L4_string_item_t *string_item)
{
- l4_string_item_t *target = msg_buffer->string_item;
- l4_word_t *brp;
+ __L4_string_item_t *target = (__L4_string_item_t *) msg_buffer;
+ __L4_string_item_t *_string_item = (__L4_string_item_t *) string_item;
+ _L4_word_t *brp;
int cont;
/* Find the end of the message buffer. */
@@ -564,143 +675,155 @@ l4_msg_buffer_append_rcv_string (l4_msg_buffer_t *msg_buffer,
cont = target->cont | target->not_last;
if (!cont)
target->not_last = 1;
- target = (l4_string_item_t *) (((void *) target) + nr);
+ target = (__L4_string_item_t *) (((_L4_word_t *) target) + nr);
}
while (cont);
- brp = (l4_word_t *) target;
+ brp = (_L4_word_t *) target;
/* Copy the source string. */
do
{
- int nr = string_item->nr_substrings + 1;
- l4_word_t *substrings = string_item->string;
+ int nr = _string_item->nr_substrings;
+ _L4_word_t *substrings = &_string_item->string[1];
+
+ cont = _string_item->cont;
+ *((__L4_string_item_t *) brp) = *_string_item;
+ brp += 2;
- cont = string_item->cont;
- *(brp++) = string_item->raw[0];
while (nr-- > 0)
*(brp++) = *(substrings++);
- string_item = (l4_string_item_t *) substrings;
+ _string_item = (__L4_string_item_t *) substrings;
}
while (cont);
}
/* Message composition. */
-
+typedef _L4_word_t _L4_msg_t[_L4_NUM_MRS];
typedef union
{
- l4_msg_tag_t tag;
- l4_word_t mr[64];
-} l4_msg_t;
+ _L4_msg_t _msg;
+ __L4_msg_tag_t tag;
+} __L4_msg_t;
static inline void
-__attribute__((__always_inline__))
-l4_msg_put (l4_msg_t *msg, l4_word_t label, int untyped_nr, l4_word_t *untyped,
- int typed_nr, l4_word_t *typed)
+_L4_attribute_always_inline
+_L4_msg_put (_L4_msg_t msg, _L4_word_t label, int untyped_nr,
+ _L4_word_t *untyped, int typed_nr, void *typed)
{
- l4_word_t *mrs = msg->mr;
+ __L4_msg_t *_msg = (__L4_msg_t *) msg;
+ _L4_word_t *mrs = msg;
- msg->tag.untyped = untyped_nr;
- msg->tag.typed = typed_nr;
- msg->tag.propagated = 0;
- msg->tag.redirected = 0;
- msg->tag.cross_cpu = 0;
- msg->tag.error = 0;
- msg->tag.label = label;
+ _msg->tag.untyped = untyped_nr;
+ _msg->tag.typed = typed_nr;
+ _msg->tag.propagated = 0;
+ _msg->tag.redirected = 0;
+ _msg->tag.cross_cpu = 0;
+ _msg->tag.error = 0;
+ _msg->tag.label = label;
while (untyped_nr--)
*(mrs++) = *(untyped++);
while (typed_nr--)
- *(mrs++) = *(typed++);
+ *(mrs++) = *(((_L4_word_t *) typed)++);
}
static inline void
-__attribute__((__always_inline__))
-l4_msg_get (l4_msg_t *msg, l4_word_t *untyped, l4_word_t *typed)
+_L4_attribute_always_inline
+_L4_msg_get (_L4_msg_t msg, _L4_word_t *untyped, void *typed)
{
- l4_word_t *mr = msg->mr;
- int untyped_nr = msg->tag.untyped;
- int typed_nr = msg->tag.typed;
+ __L4_msg_t *_msg = (__L4_msg_t *) msg;
+ int untyped_nr = _msg->tag.untyped;
+ int typed_nr = _msg->tag.typed;
+ _L4_word_t *mrs = msg;
- while (untyped_nr)
- *(untyped++) = *(mr++);
+ while (untyped_nr--)
+ *(untyped++) = *(mrs++);
- while (typed_nr)
- *(typed++) = *(mr++);
+ while (typed_nr--)
+ *(((_L4_word_t *) typed)++) = *(mrs++);
}
-static inline l4_msg_tag_t
-__attribute__((__always_inline__))
-l4_msg_msg_tag (l4_msg_t *msg)
+static inline _L4_msg_tag_t
+_L4_attribute_always_inline
+_L4_msg_msg_tag (_L4_msg_t msg)
{
- return msg->tag;
+ __L4_msg_t *_msg = (__L4_msg_t *) msg;
+ return _msg->tag.raw;
}
static inline void
-__attribute__((__always_inline__))
-l4_set_msg_msg_tag (l4_msg_t *msg, l4_msg_tag_t tag)
+_L4_attribute_always_inline
+_L4_set_msg_msg_tag (_L4_msg_t msg, _L4_msg_tag_t tag)
{
- msg->tag = tag;
+ __L4_msg_t *_msg = (__L4_msg_t *) msg;
+ _msg->tag.raw = tag;
}
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_msg_label (l4_msg_t *msg)
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_msg_msg_label (_L4_msg_t msg)
{
- return msg->tag.label;
+ __L4_msg_t *_msg = (__L4_msg_t *) msg;
+ return _msg->tag.label;
}
static inline void
-__attribute__((__always_inline__))
-l4_set_msg_label (l4_msg_t *msg, l4_word_t label)
+_L4_attribute_always_inline
+_L4_set_msg_msg_label (_L4_msg_t msg, _L4_word_t label)
{
- msg->tag.label = label;
+ __L4_msg_t *_msg = (__L4_msg_t *) msg;
+ _msg->tag.label = label;
}
static inline void
-__attribute__((__always_inline__))
-l4_msg_load (l4_msg_t *msg)
+_L4_attribute_always_inline
+_L4_msg_load (_L4_msg_t msg)
{
- l4_load_mrs (0, 1 + msg->tag.untyped + msg->tag.typed, msg->mr);
+ __L4_msg_t *_msg = (__L4_msg_t *) msg;
+ _L4_load_mrs (0, 1 + _msg->tag.untyped + _msg->tag.typed, msg);
}
static inline void
-__attribute__((__always_inline__))
-l4_msg_store (l4_msg_tag_t tag, l4_msg_t *msg)
+_L4_attribute_always_inline
+_L4_msg_store (_L4_msg_tag_t tag, _L4_msg_t msg)
{
- msg->tag = tag;
- l4_store_mrs (1, msg->tag.untyped + msg->tag.typed, &msg->mr[1]);
+ __L4_msg_t *_msg = (__L4_msg_t *) msg;
+ _msg->tag.raw = tag;
+ _L4_store_mrs (1, _msg->tag.untyped + _msg->tag.typed, &msg[1]);
}
static inline void
-__attribute__((__always_inline__))
-l4_msg_clear (l4_msg_t *msg)
+_L4_attribute_always_inline
+_L4_msg_clear (_L4_msg_t msg)
{
- msg->tag = l4_niltag;
+ __L4_msg_t *_msg = (__L4_msg_t *) msg;
+ _msg->tag.raw = _L4_niltag;
}
static inline void
-__attribute__((__always_inline__))
-l4_msg_append_word (l4_msg_t *msg, l4_word_t data)
+_L4_attribute_always_inline
+_L4_msg_append_word (_L4_msg_t msg, _L4_word_t data)
{
- l4_word_t new_untyped_nr = ++msg->tag.untyped;
- l4_word_t typed_nr = msg->tag.typed;
+ __L4_msg_t *_msg = (__L4_msg_t *) msg;
+ _L4_word_t new_untyped_nr = ++_msg->tag.untyped;
+ _L4_word_t typed_nr = _msg->tag.typed;
if (typed_nr)
{
- l4_word_t *mrs = &msg->mr[new_untyped_nr + typed_nr];
+ _L4_word_t *mrs = &msg[new_untyped_nr + typed_nr];
while (typed_nr--)
{
*(mrs) = *(mrs - 1);
@@ -709,375 +832,434 @@ l4_msg_append_word (l4_msg_t *msg, l4_word_t data)
*mrs = data;
}
else
- msg->mr[new_untyped_nr] = data;
+ msg[new_untyped_nr] = data;
}
static inline void
-__attribute__((__always_inline__))
-l4_msg_append_map_item (l4_msg_t *msg, l4_map_item_t map_item)
+_L4_attribute_always_inline
+_L4_msg_append_map_item (_L4_msg_t msg, _L4_map_item_t map_item)
{
+ __L4_msg_t *_msg = (__L4_msg_t *) msg;
/* The "not last" bit is ignored for sending. */
- int pos = 1 + msg->tag.untyped + msg->tag.typed;
- msg->mr[pos++] = map_item.raw[0];
- msg->mr[pos] = map_item.raw[1];
- msg->tag.typed += 2;
+ int pos = 1 + _msg->tag.untyped + _msg->tag.typed;
+
+ *((_L4_map_item_t *) &msg[pos]) = map_item;
+ _msg->tag.typed += 2;
}
-
-
+
+
static inline void
-__attribute__((__always_inline__))
-l4_msg_append_grant_item (l4_msg_t *msg, l4_grant_item_t grant_item)
+_L4_attribute_always_inline
+_L4_msg_append_grant_item (_L4_msg_t msg, _L4_grant_item_t grant_item)
{
+ __L4_msg_t *_msg = (__L4_msg_t *) msg;
/* The "not last" bit is ignored for sending. */
- int pos = 1 + msg->tag.untyped + msg->tag.typed;
- msg->mr[pos++] = grant_item.raw[0];
- msg->mr[pos] = grant_item.raw[1];
- msg->tag.typed += 2;
+ int pos = 1 + _msg->tag.untyped + _msg->tag.typed;
+
+ *((_L4_grant_item_t *) &msg[pos]) = grant_item;
+ _msg->tag.typed += 2;
}
static inline void
-__attribute__((__always_inline__))
-l4_msg_append_simple_string_item (l4_msg_t *msg, l4_string_item_t string_item)
+_L4_attribute_always_inline
+_L4_msg_append_simple_string_item (_L4_msg_t msg,
+ _L4_string_item_t string_item)
{
+ __L4_msg_t *_msg = (__L4_msg_t *) msg;
+ __L4_string_item_t _string_item;
/* The "not last" bit is ignored for sending. */
- int pos = 1 + msg->tag.untyped + msg->tag.typed;
- string_item.cont = 0;
- string_item.nr_substrings = 0;
- msg->mr[pos++] = string_item.raw[0];
- msg->mr[pos] = string_item.raw[1];
- msg->tag.typed += 2;
+ int pos = 1 + _msg->tag.untyped + _msg->tag.typed;
+
+ _string_item.raw = string_item;
+ _string_item.cont = 0;
+ _string_item.nr_substrings = 0;
+
+ *((_L4_string_item_t *) &msg[pos]) = string_item;
+ _msg->tag.typed += 2;
}
static inline void
-__attribute__((__always_inline__))
-l4_msg_append_string_item (l4_msg_t *msg, l4_string_item_t *string_item)
+_L4_attribute_always_inline
+_L4_msg_append_string_item (_L4_msg_t msg, _L4_string_item_t *string_item)
{
+ __L4_msg_t *_msg = (__L4_msg_t *) msg;
+ __L4_string_item_t *_string_item = (__L4_string_item_t *) string_item;
/* The "not last" bit is ignored for sending. */
- int pos = 1 + msg->tag.untyped + msg->tag.typed;
+ int pos = 1 + _msg->tag.untyped + _msg->tag.typed;
int cont;
do
{
- int nr = string_item->nr_substrings + 1;
- l4_word_t *substrings = string_item->string;
+ int nr = _string_item->nr_substrings;
+ _L4_word_t *substrings = &_string_item->string[1];
+
+ cont = _string_item->cont;
+ *((__L4_string_item_t *) &msg[pos]) = *_string_item;
+ pos += 2;
- cont = string_item->cont;
- msg->mr[pos++] = string_item->raw[0];
while (nr-- > 0)
- msg->mr[pos++] = *(substrings++);
- string_item = (l4_string_item_t *) substrings;
+ msg[pos++] = *(substrings++);
+ _string_item = (__L4_string_item_t *) substrings;
}
while (cont);
- msg->tag.typed += pos - 1 - msg->tag.untyped;
+ _msg->tag.typed += pos - 1 - _msg->tag.untyped;
}
static inline void
-__attribute__((__always_inline__))
-l4_msg_put_word (l4_msg_t *msg, l4_word_t nr, l4_word_t data)
+_L4_attribute_always_inline
+_L4_msg_put_word (_L4_msg_t msg, _L4_word_t nr, _L4_word_t data)
{
- msg->mr[1 + nr] = data;
+ msg[1 + nr] = data;
}
+
static inline void
-__attribute__((__always_inline__))
-l4_msg_put_map_item (l4_msg_t *msg, l4_word_t nr, l4_map_item_t map_item)
+_L4_attribute_always_inline
+_L4_msg_put_map_item (_L4_msg_t msg, _L4_word_t nr, _L4_map_item_t map_item)
{
- l4_word_t pos = 1 + msg->tag.untyped + nr;
- msg->mr[pos++] = map_item.raw[0];
- msg->mr[pos] = map_item.raw[1];
+ __L4_msg_t *_msg = (__L4_msg_t *) msg;
+ _L4_word_t pos = 1 + _msg->tag.untyped + nr;
+
+ *((_L4_map_item_t *) &msg[pos]) = map_item;
}
static inline void
-__attribute__((__always_inline__))
-l4_msg_put_grant_item (l4_msg_t *msg, l4_word_t nr, l4_grant_item_t grant_item)
+_L4_attribute_always_inline
+_L4_msg_put_grant_item (_L4_msg_t msg, _L4_word_t nr,
+ _L4_grant_item_t grant_item)
{
- l4_word_t pos = 1 + msg->tag.untyped + nr;
- msg->mr[pos++] = grant_item.raw[0];
- msg->mr[pos] = grant_item.raw[1];
+ __L4_msg_t *_msg = (__L4_msg_t *) msg;
+ _L4_word_t pos = 1 + _msg->tag.untyped + nr;
+
+ *((_L4_grant_item_t *) &msg[pos]) = grant_item;
}
static inline void
-__attribute__((__always_inline__))
-l4_msg_put_simple_string_item (l4_msg_t *msg, l4_word_t nr,
- l4_string_item_t string_item)
+_L4_attribute_always_inline
+_L4_msg_put_simple_string_item (_L4_msg_t msg, _L4_word_t nr,
+ _L4_string_item_t string_item)
{
- l4_word_t pos = 1 + msg->tag.untyped + nr;
- string_item.cont = 0;
- string_item.nr_substrings = 0;
- msg->mr[pos++] = string_item.raw[0];
- msg->mr[pos] = string_item.raw[1];
+ __L4_msg_t *_msg = (__L4_msg_t *) msg;
+ __L4_string_item_t _string_item;
+ _L4_word_t pos = 1 + _msg->tag.untyped + nr;
+
+ _string_item.raw = string_item;
+ _string_item.cont = 0;
+ _string_item.nr_substrings = 0;
+
+ *((__L4_string_item_t *) &msg[pos]) = _string_item;
}
static inline void
-__attribute__((__always_inline__))
-l4_msg_put_string_item (l4_msg_t *msg, l4_word_t nr,
- l4_string_item_t *string_item)
+_L4_attribute_always_inline
+_L4_msg_put_string_item (_L4_msg_t msg, _L4_word_t nr,
+ _L4_string_item_t *string_item)
{
- l4_word_t pos = 1 + msg->tag.untyped + nr;
+ __L4_msg_t *_msg = (__L4_msg_t *) msg;
+ __L4_string_item_t *_string_item = (__L4_string_item_t *) string_item;
+ _L4_word_t pos = 1 + _msg->tag.untyped + nr;
int cont;
do
{
- int nr = string_item->nr_substrings + 1;
- l4_word_t *substrings = string_item->string;
+ int nr = _string_item->nr_substrings;
+ _L4_word_t *substrings = &_string_item->string[1];
+
+ cont = _string_item->cont;
+ *((__L4_string_item_t *) &msg[pos]) = *_string_item;
+ pos += 2;
- cont = string_item->cont;
- msg->mr[pos++] = string_item->raw[0];
while (nr-- > 0)
- msg->mr[pos++] = *(substrings++);
- string_item = (l4_string_item_t *) substrings;
+ msg[pos++] = *(substrings++);
+ _string_item = (__L4_string_item_t *) substrings;
}
while (cont);
}
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_msg_word (l4_msg_t *msg, l4_word_t nr)
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_msg_word (_L4_msg_t msg, _L4_word_t nr)
{
- return msg->mr[1 + nr];
+ return msg[1 + nr];
}
static inline void
-__attribute__((__always_inline__))
-l4_msg_get_word (l4_msg_t *msg, l4_word_t nr, l4_word_t *data)
+_L4_attribute_always_inline
+_L4_msg_get_word (_L4_msg_t msg, _L4_word_t nr, _L4_word_t *data)
{
- *data = l4_msg_word (msg, nr);
+ *data = _L4_msg_word (msg, nr);
}
-static inline void
-__attribute__((__always_inline__))
-l4_msg_get_map_item (l4_msg_t *msg, l4_word_t nr, l4_map_item_t *map_item)
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_msg_get_map_item (_L4_msg_t msg, _L4_word_t nr, _L4_map_item_t *map_item)
{
- l4_word_t pos = 1 + msg->tag.untyped + nr;
- map_item->raw[0] = msg->mr[pos++];
- map_item->raw[1] = msg->mr[pos];
+ __L4_msg_t *_msg = (__L4_msg_t *) msg;
+ _L4_word_t pos = 1 + _msg->tag.untyped + nr;
+ *map_item = *((_L4_map_item_t *) &msg[pos]);
+ return sizeof (_L4_map_item_t) / sizeof (_L4_word_t);
}
-static inline void
-__attribute__((__always_inline__))
-l4_msg_get_grant_item (l4_msg_t *msg, l4_word_t nr,
- l4_grant_item_t *grant_item)
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_msg_get_grant_item (_L4_msg_t msg, _L4_word_t nr,
+ _L4_grant_item_t *grant_item)
{
- l4_word_t pos = 1 + msg->tag.untyped + nr;
- grant_item->raw[0] = msg->mr[pos++];
- grant_item->raw[1] = msg->mr[pos];
+ __L4_msg_t *_msg = (__L4_msg_t *) msg;
+ _L4_word_t pos = 1 + _msg->tag.untyped + nr;
+ *grant_item = *((_L4_grant_item_t *) &msg[pos]);
+ return sizeof (_L4_grant_item_t) / sizeof (_L4_word_t);
}
-static inline void
-__attribute__((__always_inline__))
-l4_msg_get_string_item (l4_msg_t *msg, l4_word_t nr,
- l4_string_item_t *string_item)
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_msg_get_string_item (_L4_msg_t msg, _L4_word_t nr,
+ _L4_string_item_t *string_item)
{
- l4_word_t pos = 1 + msg->tag.untyped + nr;
+ __L4_msg_t *_msg = (__L4_msg_t *) msg;
+ __L4_string_item_t *_string_item = (__L4_string_item_t *) string_item;
+ _L4_word_t pos = 1 + _msg->tag.untyped + nr;
int cont;
do
{
- int nr = string_item->nr_substrings + 1;
- l4_word_t *substrings = string_item->string;
+ int nr = _string_item->nr_substrings;
+ _L4_word_t *substrings = &_string_item->string[1];
+
+ cont = _string_item->cont;
+
+ *((__L4_string_item_t *) &msg[pos]) = *_string_item;
+ pos += 2;
- cont = string_item->cont;
- msg->mr[pos++] = string_item->raw[0];
while (nr-- > 0)
- *(substrings++) = msg->mr[pos++];
- string_item = (l4_string_item_t *) substrings;
+ *(substrings++) = msg[pos++];
+ _string_item = (__L4_string_item_t *) substrings;
}
while (cont);
+
+ return ((_L4_word_t *) _string_item) - ((_L4_word_t *) string_item);
}
/* l4_ipc convenience interface. */
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_timeouts (l4_time_t send_timeout, l4_time_t receive_timeout)
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_timeouts (_L4_time_t send_timeout, _L4_time_t receive_timeout)
{
- return (send_timeout.raw << 16) | receive_timeout.raw;
+ return (send_timeout << 16) | receive_timeout;
}
-static inline l4_msg_tag_t
-__attribute__((__always_inline__))
-l4_call_timeouts (l4_thread_id_t dest, l4_time_t send_timeout,
- l4_time_t receive_timeout)
+static inline _L4_msg_tag_t
+_L4_attribute_always_inline
+_L4_call_timeouts (_L4_thread_id_t dest, _L4_time_t send_timeout,
+ _L4_time_t receive_timeout)
{
- l4_thread_id_t from;
- return l4_ipc (dest, dest, l4_timeouts (send_timeout, receive_timeout),
- &from);
+ _L4_thread_id_t from;
+ return _L4_ipc (dest, dest, _L4_timeouts (send_timeout, receive_timeout),
+ &from);
}
-static inline l4_msg_tag_t
-__attribute__((__always_inline__))
-l4_call (l4_thread_id_t dest)
+static inline _L4_msg_tag_t
+_L4_attribute_always_inline
+_L4_call (_L4_thread_id_t dest)
{
- return l4_call_timeouts (dest, l4_never, l4_never);
+ return _L4_call_timeouts (dest, _L4_never, _L4_never);
}
-static inline l4_msg_tag_t
-__attribute__((__always_inline__))
-l4_send_timeout (l4_thread_id_t dest, l4_time_t send_timeout)
+static inline _L4_msg_tag_t
+_L4_attribute_always_inline
+_L4_send_timeout (_L4_thread_id_t dest, _L4_time_t send_timeout)
{
- l4_thread_id_t dummy;
- return l4_ipc (dest, l4_nilthread, l4_timeouts (send_timeout, l4_zero_time),
- &dummy);
+ _L4_thread_id_t dummy;
+ return _L4_ipc (dest, _L4_nilthread,
+ _L4_timeouts (send_timeout, _L4_zero_time),
+ &dummy);
}
-static inline l4_msg_tag_t
-__attribute__((__always_inline__))
-l4_send (l4_thread_id_t dest)
+static inline _L4_msg_tag_t
+_L4_attribute_always_inline
+_L4_send (_L4_thread_id_t dest)
{
- return l4_send_timeout (dest, l4_never);
+ return _L4_send_timeout (dest, _L4_never);
}
-static inline l4_msg_tag_t
-__attribute__((__always_inline__))
-l4_reply (l4_thread_id_t dest)
+static inline _L4_msg_tag_t
+_L4_attribute_always_inline
+_L4_reply (_L4_thread_id_t dest)
{
- return l4_send_timeout (dest, l4_zero_time);
+ return _L4_send_timeout (dest, _L4_zero_time);
}
-static inline l4_msg_tag_t
-__attribute__((__always_inline__))
-l4_receive_timeout (l4_thread_id_t from, l4_time_t receive_timeout)
+static inline _L4_msg_tag_t
+_L4_attribute_always_inline
+_L4_receive_timeout (_L4_thread_id_t from, _L4_time_t receive_timeout)
{
- l4_thread_id_t dummy;
- return l4_ipc (l4_nilthread, from,
- l4_timeouts (l4_zero_time, receive_timeout), &dummy);
+ _L4_thread_id_t dummy;
+ return _L4_ipc (_L4_nilthread, from,
+ _L4_timeouts (_L4_zero_time, receive_timeout), &dummy);
}
-static inline l4_msg_tag_t
-__attribute__((__always_inline__))
-l4_receive (l4_thread_id_t from)
+static inline _L4_msg_tag_t
+_L4_attribute_always_inline
+_L4_receive (_L4_thread_id_t from)
{
- return l4_receive_timeout (from, l4_never);
+ return _L4_receive_timeout (from, _L4_never);
}
-static inline l4_msg_tag_t
-__attribute__((__always_inline__))
-l4_wait_timeout (l4_time_t receive_timeout, l4_thread_id_t *from)
+static inline _L4_msg_tag_t
+_L4_attribute_always_inline
+_L4_wait_timeout (_L4_time_t receive_timeout, _L4_thread_id_t *from)
{
- return l4_ipc (l4_nilthread, l4_anythread,
- l4_timeouts (l4_zero_time, receive_timeout), from);
+ return _L4_ipc (_L4_nilthread, _L4_anythread,
+ _L4_timeouts (_L4_zero_time, receive_timeout), from);
}
-static inline l4_msg_tag_t
-__attribute__((__always_inline__))
-l4_wait (l4_thread_id_t *from)
+static inline _L4_msg_tag_t
+_L4_attribute_always_inline
+_L4_wait (_L4_thread_id_t *from)
{
- return l4_wait_timeout (l4_never, from);
+ return _L4_wait_timeout (_L4_never, from);
}
-static inline l4_msg_tag_t
-__attribute__((__always_inline__))
-l4_reply_wait_timeout (l4_thread_id_t dest, l4_time_t receive_timeout,
- l4_thread_id_t *from)
+static inline _L4_msg_tag_t
+_L4_attribute_always_inline
+_L4_reply_wait_timeout (_L4_thread_id_t dest, _L4_time_t receive_timeout,
+ _L4_thread_id_t *from)
{
- return l4_ipc (dest, l4_anythread,
- l4_timeouts (l4_time_period (0), receive_timeout), from);
+ return _L4_ipc (dest, _L4_anythread,
+ _L4_timeouts (_L4_time_period (0), receive_timeout), from);
}
-static inline l4_msg_tag_t
-__attribute__((__always_inline__))
-l4_reply_wait (l4_thread_id_t dest, l4_thread_id_t *from)
+static inline _L4_msg_tag_t
+_L4_attribute_always_inline
+_L4_reply_wait (_L4_thread_id_t dest, _L4_thread_id_t *from)
{
- return l4_reply_wait_timeout (dest, l4_never, from);
+ return _L4_reply_wait_timeout (dest, _L4_never, from);
}
static inline void
-__attribute__((__always_inline__))
-l4_sleep (l4_time_t time)
+_L4_attribute_always_inline
+_L4_sleep (_L4_time_t time)
{
- l4_set_msg_tag (l4_receive_timeout (l4_my_local_id (), time));
+ _L4_set_msg_tag (_L4_receive_timeout (_L4_my_local_id (), time));
}
-static inline l4_msg_tag_t
-__attribute__((__always_inline__))
-l4_lcall (l4_thread_id_t dest)
+static inline _L4_msg_tag_t
+_L4_attribute_always_inline
+_L4_lcall (_L4_thread_id_t dest)
{
- l4_thread_id_t dummy;
- return l4_lipc (dest, dest, l4_timeouts (l4_never, l4_never), &dummy);
+ _L4_thread_id_t dummy;
+ return _L4_lipc (dest, dest, _L4_timeouts (_L4_never, _L4_never), &dummy);
}
-static inline l4_msg_tag_t
-__attribute__((__always_inline__))
-l4_lreply_wait (l4_thread_id_t dest, l4_thread_id_t *from)
+static inline _L4_msg_tag_t
+_L4_attribute_always_inline
+_L4_lreply_wait (_L4_thread_id_t dest, _L4_thread_id_t *from)
{
- return l4_lipc (dest, dest, l4_timeouts (l4_time_period (0), l4_never),
- from);
+ return _L4_lipc (dest, dest, _L4_timeouts (_L4_time_period (0), _L4_never),
+ from);
}
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_ipc_succeeded (l4_msg_tag_t tag)
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_ipc_succeeded (_L4_msg_tag_t tag)
{
- return !tag.error;
+ __L4_msg_tag_t _tag;
+
+ _tag.raw = tag;
+ return !_tag.error;
}
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_ipc_failed (l4_msg_tag_t tag)
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_ipc_failed (_L4_msg_tag_t tag)
{
- return tag.error;
+ __L4_msg_tag_t _tag;
+
+ _tag.raw = tag;
+ return _tag.error;
}
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_ipc_propagated (l4_msg_tag_t tag)
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_ipc_propagated (_L4_msg_tag_t tag)
{
- return tag.propagated;
+ __L4_msg_tag_t _tag;
+
+ _tag.raw = tag;
+ return _tag.propagated;
}
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_ipc_redirected (l4_msg_tag_t tag)
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_ipc_redirected (_L4_msg_tag_t tag)
{
- return tag.redirected;
+ __L4_msg_tag_t _tag;
+
+ _tag.raw = tag;
+ return _tag.redirected;
}
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_ipc_xcpu (l4_msg_tag_t tag)
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_ipc_xcpu (_L4_msg_tag_t tag)
{
- return tag.cross_cpu;
+ __L4_msg_tag_t _tag;
+
+ _tag.raw = tag;
+ return _tag.cross_cpu;
}
static inline void
-__attribute__((__always_inline__))
-l4_set_propagation (l4_msg_tag_t *tag)
+_L4_attribute_always_inline
+_L4_set_propagation (_L4_msg_tag_t *tag)
{
- tag->propagated = 1;
+ __L4_msg_tag_t *_tag = (__L4_msg_tag_t *) tag;
+
+ _tag->propagated = 1;
}
+
+/* Now incorporate the public interfaces the user has selected. */
+#ifdef _L4_INTERFACE_L4
+#include <l4/compat/ipc.h>
+#endif
+#ifdef _L4_INTERFACE_GNU
+#include <l4/gnu/ipc.h>
+#endif
+
#endif /* l4/ipc.h */
diff --git a/libl4/l4/kip.h b/libl4/l4/kip.h
index 907597c..9a6ade3 100644
--- a/libl4/l4/kip.h
+++ b/libl4/l4/kip.h
@@ -1,5 +1,5 @@
-/* kip.h - Public interface to the L4 kernel interface page.
- Copyright (C) 2003 Free Software Foundation, Inc.
+/* l4/kip.h - Public interface to the L4 kernel interface page.
+ Copyright (C) 2003, 2004 Free Software Foundation, Inc.
Written by Marcus Brinkmann <marcus@gnu.org>.
This file is part of the GNU L4 library.
@@ -22,15 +22,17 @@
#ifndef _L4_KIP_H
#define _L4_KIP_H 1
+#include <l4/features.h>
#include <l4/types.h>
#include <l4/math.h>
#include <l4/bits/kip.h>
-typedef _L4_RAW (l4_word_t, _L4_STRUCT1 ({
+/* The API version field. */
+typedef _L4_RAW (_L4_api_version_t, _L4_STRUCT1 ({
_L4_BITFIELD4
- (l4_word_t,
+ (_L4_word_t,
_L4_BITFIELD (__pad1, 16),
/* The subversion or revision. */
@@ -40,17 +42,18 @@ typedef _L4_RAW (l4_word_t, _L4_STRUCT1 ({
_L4_BITFIELD (version, 8),
_L4_BITFIELD_64 (__pad2, 32));
-})) l4_api_version_t;
+})) __L4_api_version_t;
-#define L4_API_FLAGS_LITTLE_ENDIAN 0x0
-#define L4_API_FLAGS_BIG_ENDIAN 0x1
-#define L4_API_FLAGS_WORDSIZE_32 0x0
-#define L4_API_FLAGS_WORDSIZE_64 0x1
+/* The API flags field. */
+#define L4_API_FLAGS_LITTLE_ENDIAN (0x0)
+#define L4_API_FLAGS_BIG_ENDIAN (0x1)
+#define L4_API_FLAGS_WORDSIZE_32 (0x0)
+#define L4_API_FLAGS_WORDSIZE_64 (0x1)
-typedef _L4_RAW (l4_word_t, _L4_STRUCT1 ({
+typedef _L4_RAW (_L4_api_flags_t, _L4_STRUCT1 ({
_L4_BITFIELD3
- (l4_word_t,
+ (_L4_word_t,
/* The endianess. */
_L4_BITFIELD (endian, 2),
@@ -58,12 +61,13 @@ typedef _L4_RAW (l4_word_t, _L4_STRUCT1 ({
_L4_BITFIELD (wordsize, 2),
_L4_BITFIELD_32_64 (__pad, 28, 60));
-})) l4_api_flags_t;
+})) __L4_api_flags_t;
-typedef _L4_RAW (l4_word_t, _L4_STRUCT1 ({
+/* The kernel ID field. */
+typedef _L4_RAW (_L4_kernel_id_t, _L4_STRUCT1 ({
_L4_BITFIELD4
- (l4_word_t,
+ (_L4_word_t,
_L4_BITFIELD (__pad, 16),
/* The kernel sub ID. */
@@ -73,12 +77,15 @@ typedef _L4_RAW (l4_word_t, _L4_STRUCT1 ({
_L4_BITFIELD (id, 8),
_L4_BITFIELD_64 (__pad, 32));
-})) l4_kernel_id_t;
+})) __L4_kernel_id_t;
-typedef _L4_RAW (l4_word_t, _L4_STRUCT1 ({
+/* The page rights field. */
+typedef _L4_word_t _L4_page_info_t;
+
+typedef _L4_RAW (_L4_page_info_t, _L4_STRUCT1 ({
_L4_BITFIELD5
- (l4_word_t,
+ (_L4_word_t,
/* Execute access right can be independently set. */
_L4_BITFIELD (execute, 1),
@@ -93,46 +100,49 @@ typedef _L4_RAW (l4_word_t, _L4_STRUCT1 ({
/* Page size of 2^(k + 10) is supported by hardware and kernel if
bit k is set. */
_L4_BITFIELD_32_64 (page_size_mask, 22, 54));
-})) l4_page_info_t;
+})) __L4_page_info_t;
+/* The rootserver fields. */
typedef struct
{
- l4_word_t sp;
- l4_word_t ip;
- l4_word_t low;
- l4_word_t high;
-} __l4_rootserver_t;
+ _L4_word_t sp;
+ _L4_word_t ip;
+ _L4_word_t low;
+ _L4_word_t high;
+} _L4_rootserver_t;
-typedef struct
+
+/* The kernel interface page. */
+struct _L4_kip
{
char magic[4];
#if L4_WORDSIZE == L4_WORDSIZE_64
char __pad1[4];
#endif
- l4_api_version_t api_version;
- l4_api_flags_t api_flags;
+ __L4_api_version_t api_version;
+ __L4_api_flags_t api_flags;
- l4_word_t kern_desc_ptr;
+ _L4_word_t kern_desc_ptr;
struct
{
- l4_word_t init;
- l4_word_t entry;
- l4_word_t low;
- l4_word_t high;
+ _L4_word_t init;
+ _L4_word_t entry;
+ _L4_word_t low;
+ _L4_word_t high;
} kdebug;
- __l4_rootserver_t sigma0;
- __l4_rootserver_t sigma1;
- __l4_rootserver_t rootserver;
+ _L4_rootserver_t sigma0;
+ _L4_rootserver_t sigma1;
+ _L4_rootserver_t rootserver;
- l4_word_t __pad2[1];
+ _L4_word_t __pad2[1];
- _L4_RAW (l4_word_t, _L4_STRUCT1 ({
+ _L4_RAW (_L4_word_t, _L4_STRUCT1 ({
_L4_BITFIELD2
- (l4_word_t,
+ (_L4_word_t,
/* Number of memory descriptors. */
_L4_BITFIELD_32_64 (nr, 16, 32),
@@ -140,13 +150,13 @@ typedef struct
_L4_BITFIELD_32_64 (mem_desc_ptr, 16, 32));
})) memory_info;
- l4_word_t kdebug_config[2];
+ _L4_word_t kdebug_config[2];
- l4_word_t __pad3[18];
+ _L4_word_t __pad3[18];
- _L4_RAW (l4_word_t, _L4_STRUCT1 ({
+ _L4_RAW (_L4_word_t, _L4_STRUCT1 ({
_L4_BITFIELD4
- (l4_word_t,
+ (_L4_word_t,
/* UTCB size multiplier. Size of one UTCB block is m *
2^log2_align. */
_L4_BITFIELD (size_mul, 10),
@@ -160,25 +170,25 @@ typedef struct
_L4_BITFIELD_32_64 (__pad, 10, 42));
})) utcb_info;
- _L4_RAW (l4_word_t, _L4_STRUCT1 ({
+ _L4_RAW (_L4_word_t, _L4_STRUCT1 ({
_L4_BITFIELD2
- (l4_word_t,
+ (_L4_word_t,
/* The size of the KIP area is 2^log2_size. */
_L4_BITFIELD (log2_size, 6),
_L4_BITFIELD_32_64 (__pad, 26, 58));
})) kip_area_info;
- l4_word_t __pad4[2];
+ _L4_word_t __pad4[2];
- l4_word_t boot_info;
+ _L4_word_t boot_info;
/* Offset (in bytes) of processor descriptors in KIP. */
- l4_word_t proc_desc_ptr;
+ _L4_word_t proc_desc_ptr;
- _L4_RAW (l4_word_t, _L4_STRUCT1 ({
+ _L4_RAW (_L4_word_t, _L4_STRUCT1 ({
_L4_BITFIELD3
- (l4_word_t,
+ (_L4_word_t,
/* Minimal time difference that can be read with the system
clock syscall. */
_L4_BITFIELD (read_precision, 16),
@@ -189,9 +199,9 @@ typedef struct
_L4_BITFIELD_64 (__pad, 32));
})) clock_info;
- _L4_RAW (l4_word_t, _L4_STRUCT1 ({
+ _L4_RAW (_L4_word_t, _L4_STRUCT1 ({
_L4_BITFIELD4
- (l4_word_t,
+ (_L4_word_t,
/* Number of valid thread number bits. */
_L4_BITFIELD (log2_max_thread, 8),
@@ -204,11 +214,11 @@ typedef struct
_L4_BITFIELD_64 (__pad, 32));
})) thread_info;
- l4_page_info_t page_info;
+ __L4_page_info_t page_info;
- _L4_RAW (l4_word_t, _L4_STRUCT1 ({
+ _L4_RAW (_L4_word_t, _L4_STRUCT1 ({
_L4_BITFIELD3
- (l4_word_t,
+ (_L4_word_t,
/* The number of processors minus 1. */
_L4_BITFIELD (processors, 16),
@@ -219,80 +229,94 @@ typedef struct
})) processor_info;
/* Privileged system call links. */
- l4_word_t space_control;
- l4_word_t thread_control;
- l4_word_t processor_control;
- l4_word_t memory_control;
+ _L4_word_t space_control;
+ _L4_word_t thread_control;
+ _L4_word_t processor_control;
+ _L4_word_t memory_control;
/* Normal system call links. */
- l4_word_t ipc;
- l4_word_t lipc;
- l4_word_t unmap;
- l4_word_t exchange_registers;
- l4_word_t system_clock;
- l4_word_t thread_switch;
- l4_word_t schedule;
-} *l4_kip_t;
-
+ _L4_word_t ipc;
+ _L4_word_t lipc;
+ _L4_word_t unmap;
+ _L4_word_t exchange_registers;
+ _L4_word_t system_clock;
+ _L4_word_t thread_switch;
+ _L4_word_t schedule;
+};
-struct l4_memory_desc
+
+/* The memory descriptor field. */
+typedef union _L4_memory_desc
{
- _L4_BITFIELD5
- (l4_word_t,
- /* The type of the memory descriptor. */
- _L4_BITFIELD (type, 4),
+ _L4_word_t raw[2];
- /* The subtype of the memory descriptor if type is
- L4_MEMDESC_BOOTLOADER or L4_MEMDESC_ARCH, otherwise
- undefined. */
- _L4_BITFIELD (subtype, 4),
+ struct
+ {
+ _L4_BITFIELD5
+ (_L4_word_t,
+ /* The type of the memory descriptor. */
+ _L4_BITFIELD (type, 4),
- _L4_BITFIELD (__pad1, 1),
+ /* The subtype of the memory descriptor if type is
+ L4_MEMDESC_BOOTLOADER or L4_MEMDESC_ARCH, otherwise
+ undefined. */
+ _L4_BITFIELD (subtype, 4),
- /* 1 if memory is virtual, 0 if it is physical. */
- _L4_BITFIELD (virtual, 1),
+ _L4_BITFIELD (__pad1, 1),
- _L4_BITFIELD_32_64 (low, 22, 54));
+ /* 1 if memory is virtual, 0 if it is physical. */
+ _L4_BITFIELD (virtual, 1),
- _L4_BITFIELD2
- (l4_word_t,
- _L4_BITFIELD (__pad2, 10),
+ _L4_BITFIELD_32_64 (low, 22, 54));
- _L4_BITFIELD_32_64 (high, 22, 54));
-};
-typedef struct l4_memory_desc *l4_memory_desc_t;
+ _L4_BITFIELD2
+ (_L4_word_t,
+ _L4_BITFIELD (__pad2, 10),
-#define L4_MEMDESC_MASK 0xf
-#define L4_MEMDESC_UNDEFINED 0x0
-#define L4_MEMDESC_CONVENTIONAL 0x1
-#define L4_MEMDESC_RESERVED 0x2
-#define L4_MEMDESC_DEDICATED 0x3
-#define L4_MEMDESC_SHARED 0x4
-#define L4_MEMDESC_BOOTLOADER 0xe
-#define L4_MEMDESC_ARCH 0xf
+ _L4_BITFIELD_32_64 (high, 22, 54));
+ };
+} __L4_memory_desc_t;
+typedef __L4_memory_desc_t *_L4_memory_desc_t;
-typedef struct
+#define _L4_MEMDESC_UNDEFINED (0x0)
+#define _L4_MEMDESC_CONVENTIONAL (0x1)
+#define _L4_MEMDESC_RESERVED (0x2)
+#define _L4_MEMDESC_DEDICATED (0x3)
+#define _L4_MEMDESC_SHARED (0x4)
+#define _L4_MEMDESC_BOOTLOADER (0xe)
+#define _L4_MEMDESC_ARCH (0xf)
+
+
+/* The processor descriptor field. */
+typedef union _L4_proc_desc
{
- /* External frequency in kHz. */
- l4_word_t external_freq;
+ _L4_word_t raw[2];
+ struct
+ {
+ /* External frequency in kHz. */
+ _L4_word_t external_freq;
- /* Internal frequency in kHz. */
- l4_word_t internal_freq;
+ /* Internal frequency in kHz. */
+ _L4_word_t internal_freq;
- l4_word_t __pad[2];
-} *l4_proc_desc_t;
+ _L4_word_t __pad[2];
+ };
+} __L4_proc_desc_t;
+typedef __L4_proc_desc_t *_L4_proc_desc_t;
+
+/* The kernel description fields. */
typedef struct
{
/* Kernel ID. */
- l4_kernel_id_t id;
+ __L4_kernel_id_t id;
/* The kernel generation date. */
- _L4_RAW (l4_word_t, _L4_STRUCT1 ({
+ _L4_RAW (_L4_word_t, _L4_STRUCT1 ({
_L4_BITFIELD4
- (l4_word_t,
+ (_L4_word_t,
_L4_BITFIELD (day, 5),
_L4_BITFIELD (month, 4),
/* The year from 2000 on. */
@@ -301,9 +325,9 @@ typedef struct
})) gen_date;
/* The kernel version. */
- _L4_RAW (l4_word_t, _L4_STRUCT1 ({
+ _L4_RAW (_L4_word_t, _L4_STRUCT1 ({
_L4_BITFIELD4
- (l4_word_t,
+ (_L4_word_t,
_L4_BITFIELD (subsubver, 16),
_L4_BITFIELD (subver, 8),
_L4_BITFIELD (ver, 8),
@@ -311,317 +335,234 @@ typedef struct
_L4_BITFIELD_64 (__pad, 32));
})) version;
- char supplier[4];
-#if L4_WORDSIZE == L4_WORDSIZE_64
- char __pad[4];
-#endif
+ _L4_word_t supplier;
/* The kernel version string followed by architecture specific
feature strings. */
char version_parts[0];
-} *l4_kern_desc_t;
+} __L4_kern_desc_t;
-
-extern l4_kip_t __l4_kip;
+typedef __L4_kern_desc_t *_L4_kern_desc_t;
-static inline l4_kip_t
-__attribute__((__always_inline__))
-l4_kip (void)
+
+static inline _L4_api_version_t
+_L4_attribute_always_inline
+_L4_api_version (_L4_kip_t kip)
{
- return __l4_kip;
+ return kip->api_version.raw;
}
-static inline l4_api_version_t
-__attribute__((__always_inline__))
-l4_api_version (void)
+static inline _L4_api_flags_t
+_L4_attribute_always_inline
+_L4_api_flags (_L4_kip_t kip)
{
- return l4_kip ()->api_version;
+ return kip->api_flags.raw;
}
-static inline l4_api_flags_t
-__attribute__((__always_inline__))
-l4_api_flags (void)
+static inline _L4_kern_desc_t
+_L4_attribute_always_inline
+_L4_kernel_desc (_L4_kip_t kip)
{
- return l4_kip ()->api_flags;
+ return (_L4_kern_desc_t) (((_L4_word_t) kip) + kip->kern_desc_ptr);
}
-static inline l4_kernel_id_t
-__attribute__((__always_inline__))
-l4_kernel_id (void)
+static inline _L4_kernel_id_t
+_L4_attribute_always_inline
+_L4_kernel_id (_L4_kip_t kip)
{
- l4_kern_desc_t kern;
-
- kern = (l4_kern_desc_t) ((l4_word_t) l4_kip () + l4_kip ()->kern_desc_ptr);
- return kern->id;
+ return _L4_kernel_desc (kip)->id.raw;
}
static inline void
-__attribute__((__always_inline__))
-l4_kernel_gen_date (l4_word_t *year, l4_word_t *month, l4_word_t *day)
+_L4_attribute_always_inline
+_L4_kernel_gen_date (_L4_kip_t kip,
+ _L4_word_t *year, _L4_word_t *month, _L4_word_t *day)
{
- l4_kern_desc_t kern;
+ _L4_kern_desc_t kern = _L4_kernel_desc (kip);
- kern = (l4_kern_desc_t) ((l4_word_t) l4_kip () + l4_kip ()->kern_desc_ptr);
-
- if (year)
- *year = kern->gen_date.year + 2000;
- if (month)
- *month = kern->gen_date.month;
- if (day)
- *day = kern->gen_date.day;
+ *year = kern->gen_date.year + 2000;
+ *month = kern->gen_date.month;
+ *day = kern->gen_date.day;
}
static inline void
-__attribute__((__always_inline__))
-l4_kernel_version (l4_word_t *ver, l4_word_t *subver, l4_word_t *subsubver)
+_L4_attribute_always_inline
+_L4_kernel_version (_L4_kip_t kip,
+ _L4_word_t *ver, _L4_word_t *subver, _L4_word_t *subsubver)
{
- l4_kern_desc_t kern;
-
- kern = (l4_kern_desc_t) ((l4_word_t) l4_kip () + l4_kip ()->kern_desc_ptr);
+ _L4_kern_desc_t kern = _L4_kernel_desc (kip);
- if (ver)
- *ver = kern->version.ver;
- if (subver)
- *subver = kern->version.subver;
- if (subsubver)
- *subsubver = kern->version.subsubver;
+ *ver = kern->version.ver;
+ *subver = kern->version.subver;
+ *subsubver = kern->version.subsubver;
}
static inline char *
-__attribute__((__always_inline__))
-l4_kernel_supplier (void)
+_L4_attribute_always_inline
+_L4_kernel_supplier (_L4_kip_t kip)
{
- l4_kern_desc_t kern;
+ _L4_kern_desc_t kern = _L4_kernel_desc (kip);
- kern = (l4_kern_desc_t) ((l4_word_t) l4_kip () + l4_kip ()->kern_desc_ptr);
-
- return kern->supplier;
+ return (char *) &kern->supplier;
}
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_num_processors (void)
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_num_processors (_L4_kip_t kip)
{
- return l4_kip ()->processor_info.processors + 1;
+ return kip->processor_info.processors + 1;
}
-static inline l4_proc_desc_t
-__attribute__((__always_inline__))
-l4_proc_desc (l4_word_t num)
+static inline _L4_proc_desc_t
+_L4_attribute_always_inline
+_L4_proc_desc (_L4_kip_t kip, _L4_word_t num)
{
- if (num >= l4_num_processors ())
- return (l4_proc_desc_t) 0;
+ if (num >= _L4_num_processors (kip))
+ return (_L4_proc_desc_t) 0;
- return (l4_proc_desc_t) ((l4_word_t) l4_kip () + l4_kip ()->proc_desc_ptr)
- + num * (1 << l4_kip ()->processor_info.log2_size);
+ return (_L4_proc_desc_t) (((_L4_word_t) kip) + kip->proc_desc_ptr)
+ + num * (1 << kip->processor_info.log2_size);
}
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_proc_internal_freq (l4_proc_desc_t proc)
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_proc_internal_freq (_L4_proc_desc_t proc)
{
return proc->internal_freq;
}
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_proc_external_freq (l4_proc_desc_t proc)
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_proc_external_freq (_L4_proc_desc_t proc)
{
return proc->external_freq;
}
-#define L4_MIN_PAGE_SIZE_LOG2 10
-#define L4_MIN_PAGE_SIZE (L4_WORD_C(1) << L4_MIN_PAGE_SIZE_LOG2)
-
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_page_size_mask (void)
-{
- return l4_kip ()->page_info.page_size_mask << L4_MIN_PAGE_SIZE_LOG2;
-}
-
-
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_min_page_size_log2 (void)
-{
- l4_word_t page_size_mask = l4_kip ()->page_info.page_size_mask;
-
- /* There'd better be one bit set. */
- return l4_lsb (page_size_mask) - 1 + L4_MIN_PAGE_SIZE_LOG2;
-}
-
+#define _L4_MIN_PAGE_SIZE_LOG2 10
+#define _L4_MIN_PAGE_SIZE (_L4_WORD_C(1) << _L4_MIN_PAGE_SIZE_LOG2)
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_min_page_size (void)
-{
- return L4_WORD_C(1) << l4_min_page_size_log2 ();
-}
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_page_trunc (l4_word_t addr)
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_page_size_mask (_L4_kip_t kip)
{
- return (addr & ~(l4_min_page_size () - 1));
+ return kip->page_info.page_size_mask << _L4_MIN_PAGE_SIZE_LOG2;
}
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_page_round (l4_word_t addr)
-{
- return ((addr + (l4_min_page_size () - 1))
- & ~(l4_min_page_size () - 1));
-}
-
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_atop (l4_word_t addr)
-{
- return ((addr) >> l4_min_page_size_log2 ());
-}
-
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_ptoa (l4_word_t p)
-{
- return ((p) << l4_min_page_size_log2 ());
-}
-static inline l4_page_info_t
-__attribute__((__always_inline__))
-l4_page_rights (void)
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_page_rights (_L4_kip_t kip)
{
- return l4_kip ()->page_info;
+ return kip->page_info.raw;
}
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_thread_id_bits (void)
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_thread_id_bits (_L4_kip_t kip)
{
- return l4_kip ()->thread_info.log2_max_thread;
+ return kip->thread_info.log2_max_thread;
}
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_thread_user_base (void)
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_thread_system_base (_L4_kip_t kip)
{
- return l4_kip ()->thread_info.user_base;
+ return kip->thread_info.system_base;
}
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_thread_system_base (void)
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_thread_user_base (_L4_kip_t kip)
{
- return l4_kip ()->thread_info.system_base;
+ return kip->thread_info.user_base;
}
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_read_precision (void)
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_read_precision (_L4_kip_t kip)
{
- return l4_kip ()->clock_info.read_precision;
+ return kip->clock_info.read_precision;
}
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_schedule_precision (void)
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_schedule_precision (_L4_kip_t kip)
{
- return l4_kip ()->clock_info.schedule_precision;
+ return kip->clock_info.schedule_precision;
}
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_utcb_area_size_log2 (void)
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_utcb_area_size_log2 (_L4_kip_t kip)
{
- return l4_kip ()->utcb_info.log2_min_size;
+ return kip->utcb_info.log2_min_size;
}
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_utcb_area_size (void)
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_utcb_alignment_log2 (_L4_kip_t kip)
{
- return 1 << l4_kip ()->utcb_info.log2_min_size;
+ return kip->utcb_info.log2_align;
}
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_utcb_alignment_log2 (void)
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_utcb_size (_L4_kip_t kip)
{
- return l4_kip ()->utcb_info.log2_align;
+ return kip->utcb_info.size_mul
+ * (_L4_WORD_C(1) << _L4_utcb_alignment_log2 (kip));
}
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_utcb_size (void)
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_kip_area_size_log2 (_L4_kip_t kip)
{
- return l4_kip ()->utcb_info.size_mul
- * (1 << l4_utcb_alignment_log2 ());
+ return kip->kip_area_info.log2_size;
}
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_kip_area_size_log2 (void)
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_boot_info (_L4_kip_t kip)
{
- return l4_kip ()->kip_area_info.log2_size;
-}
-
-
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_kip_area_size (void)
-{
- return 1 << l4_kip ()->kip_area_info.log2_size;
-}
-
-
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_boot_info (void)
-{
- return l4_kip ()->boot_info;
+ return kip->boot_info;
}
static inline char *
-__attribute__((__always_inline__))
-l4_kernel_version_string (void)
+_L4_attribute_always_inline
+_L4_kernel_version_string (_L4_kip_t kip)
{
- l4_kern_desc_t kern;
-
- kern = (l4_kern_desc_t) ((l4_word_t) l4_kip ()
- + l4_kip ()->kern_desc_ptr);
-
- return kern->version_parts;
+ return _L4_kernel_desc (kip)->version_parts;
}
static inline char *
-__attribute__((__always_inline__))
-l4_feature (l4_word_t num)
+_L4_attribute_always_inline
+_L4_feature (_L4_kip_t kip, _L4_word_t num)
{
- char *feature = l4_kernel_version_string ();
+ char *feature = _L4_kernel_version_string (kip);
do
{
@@ -637,40 +578,40 @@ l4_feature (l4_word_t num)
}
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_num_memory_desc (void)
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_num_memory_desc (_L4_kip_t kip)
{
- return l4_kip ()->memory_info.nr;
+ return kip->memory_info.nr;
}
-static inline l4_memory_desc_t
-__attribute__((__always_inline__))
-l4_memory_desc (l4_word_t num)
+static inline _L4_memory_desc_t
+_L4_attribute_always_inline
+_L4_memory_desc (_L4_kip_t kip, _L4_word_t num)
{
- l4_memory_desc_t mem;
+ _L4_memory_desc_t mem;
- if (num >= l4_num_memory_desc ())
- return (l4_memory_desc_t) 0;
+ if (num >= _L4_num_memory_desc (kip))
+ return (_L4_memory_desc_t) 0;
- mem = (l4_memory_desc_t) ((l4_word_t) l4_kip ()
- + l4_kip ()->memory_info.mem_desc_ptr);
+ mem = (_L4_memory_desc_t) (((_L4_word_t) kip)
+ + kip->memory_info.mem_desc_ptr);
return mem + num;
}
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_is_memory_desc_virtual (l4_memory_desc_t mem)
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_is_memory_desc_virtual (_L4_memory_desc_t mem)
{
return mem->virtual;
}
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_memory_desc_type (l4_memory_desc_t mem)
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_memory_desc_type (_L4_memory_desc_t mem)
{
return (mem->subtype << 4) + mem->type;
}
@@ -678,9 +619,9 @@ l4_memory_desc_type (l4_memory_desc_t mem)
/* Return the address of the first byte of the memory region described
by MEM. */
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_memory_desc_low (l4_memory_desc_t mem)
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_memory_desc_low (_L4_memory_desc_t mem)
{
/* The lower 10 bits are hard-wired to 0. */
return mem->low << 10;
@@ -689,12 +630,22 @@ l4_memory_desc_low (l4_memory_desc_t mem)
/* Return the address of the last byte of the memory region described
by MEM. */
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_memory_desc_high (l4_memory_desc_t mem)
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_memory_desc_high (_L4_memory_desc_t mem)
{
/* The lower 10 bits are hard-wired to 1. */
return (mem->high << 10) | ((1 << 10) - 1);
}
+
+/* Now incorporate the public interfaces the user has selected. */
+#include <l4/syscall.h>
+#ifdef _L4_INTERFACE_L4
+#include <l4/compat/kip.h>
+#endif
+#ifdef _L4_INTERFACE_GNU
+#include <l4/gnu/kip.h>
+#endif
+
#endif /* l4/kip.h */
diff --git a/libl4/l4/math.h b/libl4/l4/math.h
index 5738fe4..46675fe 100644
--- a/libl4/l4/math.h
+++ b/libl4/l4/math.h
@@ -1,5 +1,5 @@
-/* math.h - Public interface to L4 mathematical support functions.
- Copyright (C) 2003 Free Software Foundation, Inc.
+/* l4/math.h - Public interface to L4 mathematical support 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.
@@ -22,18 +22,19 @@
#ifndef _L4_MATH_H
#define _L4_MATH_H 1
+#include <l4/features.h>
#include <l4/types.h>
-/* <l4/bits/math.h> defines__l4_msb() and __l4_lsb(). */
+/* The architecture specific file defines __L4_msb() and __L4_lsb(). */
#include <l4/bits/math.h>
-
+
/* Return 0 if DATA is 0, or the bit number of the most significant
bit set in DATA. The least significant bit is 1, the most
significant bit 32 resp. 64. */
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_msb (l4_word_t data)
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_msb (_L4_word_t data)
{
if (__builtin_constant_p (data))
{
@@ -50,7 +51,7 @@ l4_msb (l4_word_t data)
__L4_MSB_TRY(21); __L4_MSB_TRY(22); __L4_MSB_TRY(23); __L4_MSB_TRY(24);
__L4_MSB_TRY(25); __L4_MSB_TRY(26); __L4_MSB_TRY(27); __L4_MSB_TRY(28);
__L4_MSB_TRY(29); __L4_MSB_TRY(30); __L4_MSB_TRY(31);
-#if L4_WORDSIZE == L4_WORDSIZE_32
+#if _L4_WORDSIZE == _L4_WORDSIZE_32
__L4_MSB_IS(32);
#else
__L4_MSB_TRY(32); __L4_MSB_TRY(33); __L4_MSB_TRY(34); __L4_MSB_TRY(35);
@@ -66,7 +67,7 @@ l4_msb (l4_word_t data)
}
if (__builtin_expect (data != 0, 1))
- return __l4_msb (data);
+ return __L4_msb (data);
else
return 0;
}
@@ -75,9 +76,9 @@ l4_msb (l4_word_t data)
/* Return 0 if DATA is 0, or the bit number of the least significant
bit set in DATA. The least significant bit is 1, the most
significant bit 32 resp. 64. */
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_lsb (l4_word_t data)
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_lsb (_L4_word_t data)
{
if (__builtin_constant_p (data))
{
@@ -86,7 +87,7 @@ l4_lsb (l4_word_t data)
if (!data)
return 0;
-#if L4_WORDSIZE == L4_WORDSIZE_64
+#if _L4_WORDSIZE == _L4_WORDSIZE_64
__L4_LSB_TRY(64); __L4_LSB_TRY(63); __L4_LSB_TRY(62); __L4_LSB_TRY(61);
__L4_LSB_TRY(60); __L4_LSB_TRY(59); __L4_LSB_TRY(58); __L4_LSB_TRY(57);
__L4_LSB_TRY(56); __L4_LSB_TRY(55); __L4_LSB_TRY(54); __L4_LSB_TRY(53);
@@ -107,9 +108,15 @@ l4_lsb (l4_word_t data)
}
if (__builtin_expect (data != 0, 1))
- return __l4_lsb (data);
+ return __L4_lsb (data);
else
return 0;
}
+
+/* Now incorporate the public interfaces the user has selected. */
+#ifdef _L4_INTERFACE_GNU
+#include <l4/gnu/math.h>
+#endif
+
#endif /* l4/math.h */
diff --git a/libl4/l4/message.h b/libl4/l4/message.h
new file mode 100644
index 0000000..c6f2c32
--- /dev/null
+++ b/libl4/l4/message.h
@@ -0,0 +1,48 @@
+/* l4/message.h - Public interface to the L4 message registers.
+ Copyright (C) 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_MESSAGE_H
+#define _L4_MESSAGE_H 1
+
+#include <l4/features.h>
+#include <l4/types.h>
+
+/* All architectures implement message registers as part of the
+ virtual registers in the UTCB. */
+#include <l4/vregs.h>
+
+
+/* The number of buffer registers available. */
+#define _L4_NUM_BRS 33
+
+/* The number of message registers available. */
+#define _L4_NUM_MRS 64
+
+
+/* Now incorporate the public interfaces the user has selected. */
+#ifdef _L4_INTERFACE_L4
+#include <l4/compat/message.h>
+#endif
+#ifdef _L4_INTERFACE_GNU
+#include <l4/gnu/message.h>
+#endif
+
+#endif /* l4/message.h */
diff --git a/libl4/l4/misc.h b/libl4/l4/misc.h
index 575e9ce..38008d3 100644
--- a/libl4/l4/misc.h
+++ b/libl4/l4/misc.h
@@ -1,5 +1,5 @@
-/* misc.h - Public interface to L4 miscellaneous functions.
- Copyright (C) 2003 Free Software Foundation, Inc.
+/* 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.
@@ -30,25 +30,34 @@
/* l4_memory_control convenience interface. */
-#define L4_DEFAULT_MEMORY 0x0
+#define _L4_DEFAULT_MEMORY (_L4_WORD_C(0))
-static inline void
-__attribute__((__always_inline__))
-l4_set_page_attribute (l4_fpage_t fpage, l4_word_t attribute)
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_set_page_attribute (_L4_fpage_t fpage, _L4_word_t attribute)
{
- l4_set_rights (&fpage, 0);
- l4_load_mr (0, fpage.raw);
- l4_memory_control (0, &attribute);
+ _L4_set_rights (&fpage, 0);
+ _L4_load_mr (0, fpage);
+ return _L4_memory_control (0, &attribute);
}
-static inline void
-__attribute__((__always_inline__))
-l4_set_pages_attributes (l4_word_t nr, l4_fpage_t *fpages,
- l4_word_t *attributes)
+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);
- l4_memory_control (nr - 1, 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 */
diff --git a/libl4/l4/schedule.h b/libl4/l4/schedule.h
index 4f93c9b..2bffc6c 100644
--- a/libl4/l4/schedule.h
+++ b/libl4/l4/schedule.h
@@ -1,5 +1,5 @@
-/* schedule.h - Public interface to the L4 scheduler.
- Copyright (C) 2003 Free Software Foundation, Inc.
+/* l4/schedule.h - Public interface to the L4 scheduler.
+ Copyright (C) 2003, 2004 Free Software Foundation, Inc.
Written by Marcus Brinkmann <marcus@gnu.org>.
This file is part of the GNU L4 library.
@@ -28,101 +28,207 @@
#include <l4/thread.h>
-/* FIXME: These are compound statements and can not be used for
- initialization of global variables in C99. */
-#define l4_never ((l4_time_t) { .raw = 0 })
-#define l4_zero_time \
- ((l4_time_t) { .period.m = 0, .period.e = 5, .period._zero = 0 })
+typedef _L4_RAW
+(_L4_time_t, _L4_STRUCT2
+ ({
+ /* This is a time period. It is 2^e * m usec long. */
+ _L4_BITFIELD3
+ (_L4_uint16_t,
+ _L4_BITFIELD (m, 10),
+ _L4_BITFIELD (e, 5),
+ _L4_BITFIELD (_zero, 1));
+ } period,
+ {
+ /* This is a time point with validity (2^10 - 1) * 2^e. */
+ _L4_BITFIELD4
+ (_L4_uint16_t,
+ _L4_BITFIELD (m, 10),
+ _L4_BITFIELD (c, 1),
+ _L4_BITFIELD (e, 4),
+ _L4_BITFIELD (_one, 1));
+ } point)) __L4_time_t;
+
+
+#define _L4_never ((_L4_time_t) 0)
+/* _L4_zero_time is a time period with mantisse 0 and exponent 1. */
+#define _L4_zero_time ((_L4_time_t) (1 << 10))
+
+
+static inline _L4_time_t
+_L4_attribute_always_inline
+_L4_time_add_usec (_L4_time_t time, _L4_word_t usec)
+{
+ /* FIXME: Implement me. */
+ return 0;
+}
+
+
+static inline _L4_time_t
+_L4_attribute_always_inline
+_L4_time_sub_usec (_L4_time_t time, _L4_word_t usec)
+{
+ /* FIXME: Implement me. */
+ return 0;
+}
+
+
+static inline _L4_time_t
+_L4_attribute_always_inline
+_L4_time_add (_L4_time_t time1, _L4_time_t time2)
+{
+ /* FIXME: Implement me. */
+ return 0;
+}
+
+
+static inline _L4_time_t
+_L4_attribute_always_inline
+_L4_time_sub (_L4_time_t time1, _L4_time_t time2)
+{
+ /* FIXME: Implement me. */
+ return 0;
+}
+
+
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_is_time_longer (_L4_time_t time1, _L4_time_t time2)
+{
+ /* FIXME: Implement me. */
+ return 0;
+}
+
-static inline l4_time_t
-__attribute__((__always_inline__))
-l4_time_period (l4_uint64_t usec)
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_is_time_shorter (_L4_time_t time1, _L4_time_t time2)
+{
+ /* FIXME: Implement me. */
+ return 0;
+}
+
+
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_is_time_equal (_L4_time_t time1, _L4_time_t time2)
+{
+ /* FIXME: Implement me. */
+ return 0;
+}
+
+
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_is_time_not_equal (_L4_time_t time1, _L4_time_t time2)
+{
+ /* FIXME: Implement me. */
+ return 0;
+}
+
+
+
+static inline _L4_time_t
+_L4_attribute_always_inline
+_L4_time_period (_L4_uint64_t usec)
{
/* FIXME: If usec is a built-in constant, optimize. Optimize the
loop for the run-time case. Probably just use optimized version
from Karlsruhe. */
- l4_time_t time = { .raw = 0 };
+ __L4_time_t time = { .raw = 0 };
while (usec & ~((1 << 10) - 1))
{
if (time.period.e == 31)
- return l4_never;
+ return _L4_never;
time.period.e++;
usec = usec >> 1;
}
time.period.m = usec;
- return time;
+ return time.raw;
+}
+
+
+static inline _L4_time_t
+_L4_attribute_always_inline
+_L4_time_point (_L4_uint64_t at)
+{
+ /* FIXME: Implement me. */
+ return 0;
}
/* Convenience interface for l4_thread_switch. */
static inline void
-__attribute__((__always_inline__))
-l4_yield (void)
+_L4_attribute_always_inline
+_L4_yield (void)
{
- l4_thread_switch (l4_nilthread);
+ _L4_thread_switch (_L4_nilthread);
}
-/* Convenience interface for l4_schedule. */
+/* Convenience interface for _L4_schedule. */
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_set_priority (l4_thread_id_t dest, l4_word_t priority)
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_set_priority (_L4_thread_id_t dest, _L4_word_t priority)
{
- l4_word_t prio = priority & ((1 << 16) - 1);
- l4_word_t dummy;
- return l4_schedule (dest, -1, -1, prio, -1, &dummy);
+ _L4_word_t prio = priority & ((1 << 16) - 1);
+ _L4_word_t dummy;
+ return _L4_schedule (dest, -1, -1, prio, -1, &dummy);
}
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_set_processor_no (l4_thread_id_t dest, l4_word_t proc_num)
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_set_processor_no (_L4_thread_id_t dest, _L4_word_t proc_num)
{
- l4_word_t proc = proc_num & ((1 << 8) - 1);
- l4_word_t dummy;
- return l4_schedule (dest, -1, proc, -1, -1, &dummy);
+ _L4_word_t proc = proc_num & ((1 << 8) - 1);
+ _L4_word_t dummy;
+ return _L4_schedule (dest, -1, proc, -1, -1, &dummy);
}
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_time_slice (l4_thread_id_t dest, l4_time_t *ts, l4_time_t *tq)
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_time_slice (_L4_thread_id_t dest, _L4_time_t *ts, _L4_time_t *tq)
{
- l4_word_t time_control;
- return l4_schedule (dest, -1, -1, -1, -1, &time_control);
- ts->raw = time_control >> 16;
- tq->raw = time_control & ((1 << 16) - 1);
+ _L4_word_t time_control;
+ return _L4_schedule (dest, -1, -1, -1, -1, &time_control);
+ *ts = time_control >> 16;
+ *tq = time_control & ((1 << 16) - 1);
}
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_set_time_slice (l4_thread_id_t dest, l4_time_t ts, l4_time_t tq)
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_set_time_slice (_L4_thread_id_t dest, _L4_time_t ts, _L4_time_t tq)
{
- l4_word_t time_control = (ts.raw << 16) | tq.raw;
- l4_word_t dummy;
- return l4_schedule (dest, time_control, -1, -1, -1, &dummy);
+ _L4_word_t time_control = (ts << 16) | tq;
+ _L4_word_t dummy;
+ return _L4_schedule (dest, time_control, -1, -1, -1, &dummy);
}
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_preemption_delay (l4_thread_id_t dest, l4_word_t sensitive_prio,
- l4_word_t max_delay)
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_set_preemption_delay (_L4_thread_id_t dest, _L4_word_t sensitive_prio,
+ _L4_word_t max_delay)
{
- l4_word_t preempt_control = (sensitive_prio << 16)
+ _L4_word_t preempt_control = (sensitive_prio << 16)
| (max_delay & ((1 << 16) - 1));
- return l4_schedule (dest, -1, -1, -1, -1, &preempt_control);
+ return _L4_schedule (dest, -1, -1, -1, -1, &preempt_control);
}
-
-#ifndef _L4_NOT_COMPAT
-#endif /* !_L4_NOT_COMPAT */
+/* Now incorporate the public interfaces the user has selected. */
+#ifdef _L4_INTERFACE_L4
+#include <l4/compat/schedule.h>
+#endif
+#ifdef _L4_INTERFACE_GNU
+#include <l4/gnu/schedule.h>
+#endif
#endif /* l4/schedule.h */
diff --git a/libl4/l4/space.h b/libl4/l4/space.h
index 59cbcb8..6e9b1f2 100644
--- a/libl4/l4/space.h
+++ b/libl4/l4/space.h
@@ -1,4 +1,4 @@
-/* space.h - Public interface to L4 spaces.
+/* l4/space.h - Public interface to L4 spaces.
Copyright (C) 2003 Free Software Foundation, Inc.
Written by Marcus Brinkmann <marcus@gnu.org>.
@@ -27,212 +27,279 @@
#include <l4/bits/space.h>
#include <l4/syscall.h>
+
+typedef _L4_RAW
+(_L4_word_t, _L4_STRUCT3
+ ({
+ _L4_BITFIELD3
+ (_L4_word_t,
+ _L4_BITFIELD (rights, 4),
+ _L4_BITFIELD (log2_size, 6),
+ _L4_BITFIELD_32_64 (base, 22, 54));
+ },
+ {
+ /* Alias names for RIGHTS. */
+ _L4_BITFIELD3
+ (_L4_word_t,
+ _L4_BITFIELD (executable, 1),
+ _L4_BITFIELD (writable, 1),
+ _L4_BITFIELD (readable, 1));
+ },
+ {
+ /* Names for status bits as returned from l4_unmap. */
+ _L4_BITFIELD3
+ (_L4_word_t,
+ _L4_BITFIELD (executed, 1),
+ _L4_BITFIELD (written, 1),
+ _L4_BITFIELD (referenced, 1));
+ })) __L4_fpage_t;
+
/* fpage support. */
-#define l4_no_access 0x00
-#define l4_executable 0x01
-#define l4_writable 0x02
-#define l4_readable 0x04
-#define l4_fully_accessible (l4_readable | l4_writable | l4_executable)
-#define l4_read_exec_only (l4_readable | l4_executable)
-
-/* FIXME: These are compound statements and can not be used for
- initialization of global variables in C99. */
-#define l4_nilpage ((l4_fpage_t) { .raw = 0 })
-/* FIXME: When gcc supports unnamed fields in initializer. */
-#define l4_complete_address_space \
- ((l4_fpage_t) { .page.rights = 0, .page.log2_size = 1, .page.base = 0 })
+#define _L4_no_access 0x00
+#define _L4_executable 0x01
+#define _L4_writable 0x02
+#define _L4_readable 0x04
+#define _L4_fully_accessible (_L4_readable | _L4_writable | _L4_executable)
+#define _L4_read_exec_only (_L4_readable | _L4_executable)
+
+#define _L4_nilpage ((_L4_fpage_t) 0)
+#define _L4_complete_address_space ((_L4_fpage_t) (1 << 4))
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_is_nil_fpage (l4_fpage_t fpage)
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_is_nil_fpage (_L4_fpage_t fpage)
{
- return fpage.raw == l4_nilpage.raw;
+ return fpage == _L4_nilpage;
}
-static inline l4_fpage_t
-__attribute__((__always_inline__))
-l4_fpage (l4_word_t base, int size)
+static inline _L4_fpage_t
+_L4_attribute_always_inline
+_L4_fpage (_L4_word_t base, int size)
{
- l4_fpage_t fpage;
- l4_word_t msb = l4_msb (size) - 1;
+ __L4_fpage_t fpage;
+ _L4_word_t msb = _L4_msb (size) - 1;
fpage.base = base >> 10;
fpage.log2_size = size ? ((1 << msb) == size ? msb : msb + 1) : 0;
- fpage.rights = l4_no_access;
+ fpage.rights = _L4_no_access;
- return fpage;
+ return fpage.raw;
}
-static inline l4_fpage_t
-__attribute__((__always_inline__))
-l4_fpage_log2 (l4_word_t base, int log2_size)
+static inline _L4_fpage_t
+_L4_attribute_always_inline
+_L4_fpage_log2 (_L4_word_t base, int log2_size)
{
- l4_fpage_t fpage;
+ __L4_fpage_t fpage;
fpage.base = base >> 10;
fpage.log2_size = log2_size;
- fpage.rights = l4_no_access;
- return fpage;
+ fpage.rights = _L4_no_access;
+
+ return fpage.raw;
}
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_address (l4_fpage_t fpage)
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_address (_L4_fpage_t fpage)
{
- return fpage.base << 10;
+ __L4_fpage_t _fpage;
+
+ _fpage.raw = fpage;
+ return _fpage.base << 10;
}
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_size (l4_fpage_t fpage)
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_size (_L4_fpage_t fpage)
{
- return 1 << fpage.log2_size;
+ __L4_fpage_t _fpage;
+
+ _fpage.raw = fpage;
+ return 1 << _fpage.log2_size;
}
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_size_log2 (l4_fpage_t fpage)
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_size_log2 (_L4_fpage_t fpage)
{
- return fpage.log2_size;
+ __L4_fpage_t _fpage;
+
+ _fpage.raw = fpage;
+ return _fpage.log2_size;
}
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_rights (l4_fpage_t fpage)
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_rights (_L4_fpage_t fpage)
{
- return fpage.rights;
+ __L4_fpage_t _fpage;
+
+ _fpage.raw = fpage;
+ return _fpage.rights;
}
static inline void
-__attribute__((__always_inline__))
-l4_set_rights (l4_fpage_t *fpage, l4_word_t rights)
+_L4_attribute_always_inline
+_L4_set_rights (_L4_fpage_t *fpage, _L4_word_t rights)
{
- fpage->rights = rights;
+ __L4_fpage_t _fpage;
+
+ _fpage.raw = *fpage;
+ _fpage.rights = rights;
+ *fpage = _fpage.raw;
}
-static inline l4_fpage_t
-__attribute__((__always_inline__))
-l4_fpage_add_rights (l4_fpage_t fpage, l4_word_t rights)
+static inline _L4_fpage_t
+_L4_attribute_always_inline
+_L4_fpage_add_rights (_L4_fpage_t fpage, _L4_word_t rights)
{
- l4_fpage_t new_fpage = fpage;
- new_fpage.rights |= rights;
- return new_fpage;
+ __L4_fpage_t _fpage;
+
+ _fpage.raw = fpage;
+ _fpage.rights |= rights;
+ return _fpage.raw;
}
static inline void
-__attribute__((__always_inline__))
-l4_fpage_add_rights_to (l4_fpage_t *fpage, l4_word_t rights)
+_L4_attribute_always_inline
+_L4_fpage_add_rights_to (_L4_fpage_t *fpage, _L4_word_t rights)
{
- fpage->rights |= rights;
+ __L4_fpage_t _fpage;
+
+ _fpage.raw = *fpage;
+ _fpage.rights |= rights;
+ *fpage = _fpage.raw;
}
-static inline l4_fpage_t
-__attribute__((__always_inline__))
-l4_fpage_remove_rights (l4_fpage_t fpage, l4_word_t rights)
+static inline _L4_fpage_t
+_L4_attribute_always_inline
+_L4_fpage_remove_rights (_L4_fpage_t fpage, _L4_word_t rights)
{
- l4_fpage_t new_fpage = fpage;
- new_fpage.rights &= ~rights;
- return new_fpage;
+ __L4_fpage_t _fpage;
+
+ _fpage.raw = fpage;
+ _fpage.rights &= ~rights;
+ return _fpage.raw;
}
static inline void
-__attribute__((__always_inline__))
-l4_fpage_remove_rights_from (l4_fpage_t *fpage, l4_word_t rights)
+_L4_attribute_always_inline
+_L4_fpage_remove_rights_from (_L4_fpage_t *fpage, _L4_word_t rights)
{
- fpage->rights &= ~rights;
+ __L4_fpage_t _fpage;
+
+ _fpage.raw = *fpage;
+ _fpage.rights &= ~rights;
+ *fpage = _fpage.raw;
}
/* l4_unmap convenience interface. */
static inline void
-__attribute__((__always_inline__))
-l4_unmap_fpage (l4_fpage_t fpage)
+_L4_attribute_always_inline
+_L4_unmap_fpage (_L4_fpage_t fpage)
{
- l4_load_mr (0, fpage.raw);
- l4_unmap (0);
- l4_store_mr (0, &fpage.raw);
+ _L4_load_mr (0, fpage);
+ _L4_unmap (0);
+ _L4_store_mr (0, &fpage);
}
static inline void
-__attribute__((__always_inline__))
-l4_unmap_fpages (l4_word_t nr, l4_fpage_t *fpages)
+_L4_attribute_always_inline
+_L4_unmap_fpages (_L4_word_t nr, _L4_fpage_t *fpages)
{
- l4_load_mrs (0, nr, (l4_word_t *) fpages);
- l4_unmap ((nr - 1) & L4_UNMAP_COUNT_MASK);
- l4_store_mrs (0, nr, (l4_word_t *) fpages);
+ _L4_load_mrs (0, nr, fpages);
+ _L4_unmap ((nr - 1) & _L4_UNMAP_COUNT_MASK);
+ _L4_store_mrs (0, nr, fpages);
}
static inline void
-__attribute__((__always_inline__))
-l4_flush (l4_fpage_t fpage)
+_L4_attribute_always_inline
+_L4_flush (_L4_fpage_t fpage)
{
- l4_load_mr (0, fpage.raw);
- l4_unmap (L4_UNMAP_FLUSH);
- l4_store_mr (0, &fpage.raw);
+ _L4_load_mr (0, fpage);
+ _L4_unmap (_L4_UNMAP_FLUSH);
+ _L4_store_mr (0, &fpage);
}
static inline void
-__attribute__((__always_inline__))
-l4_flush_fpages (l4_word_t nr, l4_fpage_t *fpages)
+_L4_attribute_always_inline
+_L4_flush_fpages (_L4_word_t nr, _L4_fpage_t *fpages)
{
- l4_load_mrs (0, nr, (l4_word_t *) fpages);
- l4_unmap (L4_UNMAP_FLUSH | ((nr - 1) & L4_UNMAP_COUNT_MASK));
- l4_store_mrs (0, nr, (l4_word_t *) fpages);
+ _L4_load_mrs (0, nr, fpages);
+ _L4_unmap (_L4_UNMAP_FLUSH | ((nr - 1) & _L4_UNMAP_COUNT_MASK));
+ _L4_store_mrs (0, nr, fpages);
}
-static inline l4_fpage_t
-__attribute__((__always_inline__))
-l4_get_status (l4_fpage_t fpage)
+static inline _L4_fpage_t
+_L4_attribute_always_inline
+_L4_get_status (_L4_fpage_t fpage)
{
- l4_fpage_t save_fpage;
- l4_fpage_t status;
-
- save_fpage = l4_fpage_remove_rights (fpage, l4_fully_accessible);
- l4_load_mr (0, save_fpage.raw);
- l4_unmap (0);
- l4_store_mr (0, &status.raw);
- return status;
+ _L4_fpage_remove_rights_from (&fpage, _L4_fully_accessible);
+ _L4_load_mr (0, fpage);
+ _L4_unmap (0);
+ _L4_store_mr (0, &fpage);
+ return fpage;
}
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_was_referenced (l4_fpage_t fpage)
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_was_referenced (_L4_fpage_t fpage)
{
- return fpage.referenced;
+ __L4_fpage_t _fpage;
+
+ _fpage.raw = fpage;
+ return _fpage.referenced;
}
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_was_written (l4_fpage_t fpage)
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_was_written (_L4_fpage_t fpage)
{
- return fpage.written;
+ __L4_fpage_t _fpage;
+
+ _fpage.raw = fpage;
+ return _fpage.written;
}
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_was_executed (l4_fpage_t fpage)
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_was_executed (_L4_fpage_t fpage)
{
- return fpage.executed;
+ __L4_fpage_t _fpage;
+
+ _fpage.raw = fpage;
+ return _fpage.executed;
}
-#endif /* l4/syscall.h */
+
+/* Now incorporate the public interfaces the user has selected. */
+#ifdef _L4_INTERFACE_L4
+#include <l4/compat/space.h>
+#endif
+#ifdef _L4_INTERFACE_GNU
+#include <l4/gnu/space.h>
+#endif
+
+#endif /* l4/space.h */
diff --git a/libl4/l4/stubs-init.h b/libl4/l4/stubs-init.h
index 82f70ee..1a2da38 100644
--- a/libl4/l4/stubs-init.h
+++ b/libl4/l4/stubs-init.h
@@ -1,4 +1,4 @@
-/* stubs-init.h - Initialization function for system call stubs.
+/* l4/stubs-init.h - Initialization function for system call stubs.
Copyright (C) 2003 Free Software Foundation, Inc.
Written by Marcus Brinkmann <marcus@gnu.org>.
@@ -22,6 +22,7 @@
#ifndef _L4_STUBS_INIT_H
#define _L4_STUBS_INIT_H 1
+#include <l4/features.h>
#include <l4/types.h>
#include <l4/kip.h>
diff --git a/libl4/l4/stubs.h b/libl4/l4/stubs.h
index 9adc4a1..e6908a8 100644
--- a/libl4/l4/stubs.h
+++ b/libl4/l4/stubs.h
@@ -1,4 +1,4 @@
-/* stubs.h - Global system call stubs variables for libl4.
+/* l4/stubs.h - Global system call stubs variables for libl4.
Copyright (C) 2003 Free Software Foundation, Inc.
Written by Marcus Brinkmann <marcus@gnu.org>.
@@ -27,6 +27,8 @@
#ifndef _L4_STUBS_H
#define _L4_STUBS_H 1
+#include <l4/features.h>
+
#include <l4/bits/stubs.h>
#endif /* l4/stubs.h */
diff --git a/libl4/l4/syscall.h b/libl4/l4/syscall.h
index 9dbd94b..c0e2602 100644
--- a/libl4/l4/syscall.h
+++ b/libl4/l4/syscall.h
@@ -1,4 +1,4 @@
-/* syscall.h - Public interface to the L4 system calls.
+/* l4/syscall.h - Public interface to the L4 system calls.
Copyright (C) 2003 Free Software Foundation, Inc.
Written by Marcus Brinkmann <marcus@gnu.org>.
@@ -22,63 +22,103 @@
#ifndef _L4_SYSCALL_H
#define _L4_SYSCALL_H 1
+#include <l4/features.h>
#include <l4/types.h>
#include <l4/vregs.h>
-#include <l4/kip.h>
-/* <l4/bits/syscall.h> defines all system calls. */
+/* The system calls are defined by the architecture specific header file. */
#include <l4/bits/syscall.h>
-/* l4_exchange_registers control argument. */
+
+/* _L4_exchange_registers control argument. */
/* Input. */
-#define L4_XCHG_REGS_HALT 0x0001
-#define L4_XCHG_REGS_CANCEL_RECV 0x0002
-#define L4_XCHG_REGS_CANCEL_SEND 0x0004
-#define L4_XCHG_REGS_CANCEL_IPC (L4_XCHG_REGS_CANCEL_RECV \
- | L4_XCHG_REGS_CANCEL_SEND)
-#define L4_XCHG_REGS_SET_SP 0x0008
-#define L4_XCHG_REGS_SET_IP 0x0010
-#define L4_XCHG_REGS_SET_FLAGS 0x0020
-#define L4_XCHG_REGS_SET_USER_HANDLE 0x0040
-#define L4_XCHG_REGS_SET_PAGER 0x0080
-#define L4_XCHG_REGS_SET_HALT 0x0100
+#define _L4_XCHG_REGS_HALT _L4_WORD_C(0x0001)
+#define _L4_XCHG_REGS_CANCEL_RECV _L4_WORD_C(0x0002)
+#define _L4_XCHG_REGS_CANCEL_SEND _L4_WORD_C(0x0004)
+#define _L4_XCHG_REGS_CANCEL_IPC (_L4_XCHG_REGS_CANCEL_RECV \
+ | _L4_XCHG_REGS_CANCEL_SEND)
+#define _L4_XCHG_REGS_SET_SP _L4_WORD_C(0x0008)
+#define _L4_XCHG_REGS_SET_IP _L4_WORD_C(0x0010)
+#define _L4_XCHG_REGS_SET_FLAGS _L4_WORD_C(0x0020)
+#define _L4_XCHG_REGS_SET_USER_HANDLE _L4_WORD_C(0x0040)
+#define _L4_XCHG_REGS_SET_PAGER _L4_WORD_C(0x0080)
+#define _L4_XCHG_REGS_SET_HALT _L4_WORD_C(0x0100)
/* Output. */
-#define L4_XCHG_REGS_HALTED 0x01
-#define L4_XCHG_REGS_RECEIVING 0x02
-#define L4_XCHG_REGS_SENDING 0x04
-#define L4_XCHG_REGS_IPCING (L4_XCHG_REGS_RECEIVING \
- | L4_XCHG_REGS_SENDING)
-
-/* l4_schedule return codes. */
-#define L4_SCHEDULE_ERROR 0
-#define L4_SCHEDULE_DEAD 1
-#define L4_SCHEDULE_INACTIVE 2
-#define L4_SCHEDULE_RUNNING 3
-#define L4_SCHEDULE_PENDING_SEND 4
-#define L4_SCHEDULE_SENDING 5
-#define L4_SCHEDULE_WAITING 6
-#define L4_SCHEDULE_RECEIVING 7
-
-
-/* l4_unmap flags. */
-#define L4_UNMAP_FLUSH 0x40
-#define L4_UNMAP_COUNT_MASK 0x3f
-
-#ifndef _L4_NOT_COMPAT
-#define L4_ExchangeRegisters l4_exchange_registers
-#define L4_ThreadControl l4_thread_control
-#define L4_SystemClock() \
- ({ return ((L4_Clock_t) { .clock = l4_system_clock () })
-#define L4_ThreadSwitch l4_thread_switch
-#define L4_Schedule l4_schedule
-#define L4_Ipc l4_ipc
-#define L4_Lipc l4_lipc
-#define L4_Unmap l4_unmap
-#define L4_SpaceControl l4_space_control
-#define L4_ProcessorControl l4_processor_control
-#define L4_MemoryControl l4_memory_control
-#endif /* !_L4_NOT_COMPAT */
+#define _L4_XCHG_REGS_HALTED _L4_WORD_C(0x01)
+#define _L4_XCHG_REGS_RECEIVING _L4_WORD_C(0x02)
+#define _L4_XCHG_REGS_SENDING _L4_WORD_C(0x04)
+#define _L4_XCHG_REGS_IPCING (_L4_XCHG_REGS_RECEIVING \
+ | _L4_XCHG_REGS_SENDING)
+
+
+/* _L4_schedule return codes. */
+#define _L4_SCHEDULE_ERROR _L4_WORD_C(0)
+#define _L4_SCHEDULE_DEAD _L4_WORD_C(1)
+#define _L4_SCHEDULE_INACTIVE _L4_WORD_C(2)
+#define _L4_SCHEDULE_RUNNING _L4_WORD_C(3)
+#define _L4_SCHEDULE_PENDING_SEND _L4_WORD_C(4)
+#define _L4_SCHEDULE_SENDING _L4_WORD_C(5)
+#define _L4_SCHEDULE_WAITING _L4_WORD_C(6)
+#define _L4_SCHEDULE_RECEIVING _L4_WORD_C(7)
+
+
+/* _L4_unmap flags. */
+#define _L4_UNMAP_FLUSH _L4_WORD_C(0x40)
+#define _L4_UNMAP_COUNT_MASK _L4_WORD_C(0x3f)
+
+
+/* Error codes. */
+#define _L4_ERR_NO_PRIVILEGE _L4_WORD_C(1)
+#define _L4_ERR_INV_THREAD _L4_WORD_C(2)
+#define _L4_ERR_INV_SPACE _L4_WORD_C(4)
+#define _L4_ERR_INV_SCHEDULER _L4_WORD_C(5)
+#define _L4_ERR_INV_PARAM _L4_WORD_C(6)
+#define _L4_ERR_UTCB_AREA _L4_WORD_C(7)
+#define _L4_ERR_KIP_AREA _L4_WORD_C(8)
+#define _L4_ERR_NO_MEM _L4_WORD_C(9)
+
+
+static inline const char *const
+_L4_attribute_always_inline
+_L4_strerror (_L4_word_t err_code)
+{
+ switch (err_code)
+ {
+ case _L4_ERR_NO_PRIVILEGE:
+ return "no privilege";
+
+ case _L4_ERR_INV_THREAD:
+ return "invalid thread";
+
+ case _L4_ERR_INV_SPACE:
+ return "invalid space";
+
+ case _L4_ERR_INV_PARAM:
+ return "invalid parameter";
+
+ case _L4_ERR_UTCB_AREA:
+ return "invalid utcb area";
+
+ case _L4_ERR_KIP_AREA:
+ return "invalid kip area";
+
+ case _L4_ERR_NO_MEM:
+ return "out of memory";
+
+ default:
+ return "unknown error code";
+ }
+}
+
+
+/* Now incorporate the public interfaces the user has selected. */
+#ifdef _L4_INTERFACE_L4
+#include <l4/compat/syscall.h>
+#endif
+#ifdef _L4_INTERFACE_GNU
+#include <l4/gnu/syscall.h>
+#endif
#endif /* l4/syscall.h */
diff --git a/libl4/l4/thread.h b/libl4/l4/thread.h
index 1af9873..f130401 100644
--- a/libl4/l4/thread.h
+++ b/libl4/l4/thread.h
@@ -1,5 +1,5 @@
-/* thread.h - Public interface to L4 threads.
- Copyright (C) 2003 Free Software Foundation, Inc.
+/* l4/thread.h - Public interface to L4 threads.
+ Copyright (C) 2003, 2004 Free Software Foundation, Inc.
Written by Marcus Brinkmann <marcus@gnu.org>.
This file is part of the GNU L4 library.
@@ -26,307 +26,335 @@
#include <l4/vregs.h>
#include <l4/syscall.h>
-/* FIXME: These are compound statements and can not be used for
- initialization of global variables in C99. */
-#define l4_nilthread ((l4_thread_id_t) { .raw = 0 })
-#define l4_anythread ((l4_thread_id_t) { .raw = (l4_word_t) -1 })
-/* FIXME: When gcc supports unnamed fields as initializers, use them. */
-#define l4_anylocalthread \
- ((l4_thread_id_t) { .local.local = -1, .local._all_zero = 0 })
+
+typedef _L4_RAW
+(_L4_word_t, _L4_STRUCT2
+ ({
+ _L4_BITFIELD2
+ (_L4_word_t,
+ _L4_BITFIELD_32_64 (version, 14, 32),
+ _L4_BITFIELD_32_64 (thread_no, 18, 32));
+ },
+ {
+ _L4_BITFIELD2
+ (_L4_word_t,
+ _L4_BITFIELD (_all_zero, 6),
+ _L4_BITFIELD_32_64 (local, 26, 58));
+ })) __L4_thread_id_t;
+
+
+#if _L4_WORDSIZE == _L4_WORDSIZE_32
+#define _L4_THREAD_NO_BITS (32 - 6)
+#else
+#define _L4_THREAD_NO_BITS (64 - 6)
+#endif
+#define _L4_THREAD_VERSION_BITS (6)
+
+#define _L4_THREAD_NO_MASK ((_L4_WORD_C(1) << _L4_THREAD_NO_BITS) - 1)
+#define _L4_THREAD_VERSION_MASK ((_L4_WORD_C(1) << _L4_THREAD_VERSION_BITS) -1)
+
+/* These define the raw versions of the special thread IDs. */
+#define _L4_nilthread _L4_WORD_C(0)
+#define _L4_anythread (~ _L4_WORD_C(0))
+#define _L4_anylocalthread ((~ _L4_WORD_C(0)) << _L4_THREAD_VERSION_BITS)
-static inline l4_thread_id_t
-__attribute__((__always_inline__))
-l4_global_id (l4_word_t thread_no, l4_word_t version)
+static inline _L4_thread_id_t
+_L4_attribute_always_inline
+_L4_global_id (_L4_word_t thread_no, _L4_word_t version)
{
- l4_thread_id_t thread;
+ __L4_thread_id_t tid;
- thread.thread_no = thread_no;
- thread.version = version;
+ tid.thread_no = thread_no;
+ tid.version = version;
- return thread;
+ return tid.raw;
}
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_version (l4_thread_id_t thread)
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_version (_L4_thread_id_t thread)
{
- return thread.version;
+ __L4_thread_id_t tid;
+
+ tid.raw = thread;
+ return tid.version;
}
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_thread_no (l4_thread_id_t thread)
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_thread_no (_L4_thread_id_t thread)
{
- return thread.thread_no;
+ __L4_thread_id_t tid;
+
+ tid.raw = thread;
+ return tid.thread_no;
}
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_is_thread_equal (l4_thread_id_t thread1, l4_thread_id_t thread2)
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_is_thread_equal (_L4_thread_id_t thread1, _L4_thread_id_t thread2)
{
- return thread1.raw == thread2.raw;
+ return thread1 == thread2;
}
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_is_thread_not_equal (l4_thread_id_t thread1, l4_thread_id_t thread2)
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_is_thread_not_equal (_L4_thread_id_t thread1, _L4_thread_id_t thread2)
{
- return thread1.raw != thread2.raw;
+ return thread1 != thread2;
}
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_is_nil_thread (l4_thread_id_t thread)
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_is_nil_thread (_L4_thread_id_t thread)
{
- return thread.raw == 0;
+ return thread == _L4_nilthread;
}
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_is_local_id (l4_thread_id_t thread)
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_is_local_id (_L4_thread_id_t thread)
{
- return thread._all_zero == 0;
+ __L4_thread_id_t tid;
+
+ tid.raw = thread;
+ return tid._all_zero == 0;
}
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_is_global_id (l4_thread_id_t thread)
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_is_global_id (_L4_thread_id_t thread)
{
- return thread._all_zero != 0;
+ __L4_thread_id_t tid;
+
+ tid.raw = thread;
+ return tid._all_zero != 0;
}
-static inline l4_thread_id_t
-__attribute__((__always_inline__))
-l4_myself (void)
+static inline _L4_thread_id_t
+_L4_attribute_always_inline
+_L4_myself (void)
{
- return l4_my_global_id ();
+ return _L4_my_global_id ();
}
-static inline l4_thread_id_t
-__attribute__((__always_inline__))
-l4_global_id_of (l4_thread_id_t thread)
+static inline _L4_thread_id_t
+_L4_attribute_always_inline
+_L4_global_id_of (_L4_thread_id_t thread)
{
- if (l4_is_global_id (thread))
+ if (_L4_is_global_id (thread))
return thread;
else
{
- l4_thread_id_t dest = thread;
- l4_word_t control = 0;
- l4_word_t dummy = 0;
- l4_thread_id_t pager = l4_nilthread;
-
- l4_exchange_registers (&dest, &control, &dummy, &dummy, &dummy,
- &dummy, &pager);
- return dest;
+ _L4_word_t control = 0;
+ _L4_word_t dummy = 0;
+ _L4_thread_id_t pager = _L4_nilthread;
+
+ _L4_exchange_registers (&thread, &control, &dummy, &dummy, &dummy,
+ &dummy, &pager);
+ return thread;
}
}
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_same_threads (l4_thread_id_t thread1, l4_thread_id_t thread2)
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_same_threads (_L4_thread_id_t thread1, _L4_thread_id_t thread2)
{
- l4_thread_id_t global1 = l4_global_id_of (thread1);
- l4_thread_id_t global2 = l4_global_id_of (thread2);
+ _L4_thread_id_t global1 = _L4_global_id_of (thread1);
+ _L4_thread_id_t global2 = _L4_global_id_of (thread2);
- return global1.raw == global2.raw;
+ return global1 == global2;
}
-static inline l4_thread_id_t
-__attribute__((__always_inline__))
-l4_local_id_of (l4_thread_id_t thread)
+static inline _L4_thread_id_t
+_L4_attribute_always_inline
+_L4_local_id_of (_L4_thread_id_t thread)
{
- if (l4_is_local_id (thread))
+ if (_L4_is_local_id (thread))
return thread;
else
{
- l4_thread_id_t dest = thread;
- l4_word_t control = 0;
- l4_word_t dummy = 0;
- l4_thread_id_t pager = l4_nilthread;
-
- l4_exchange_registers (&dest, &control, &dummy, &dummy, &dummy,
- &dummy, &pager);
- return dest;
+ _L4_word_t control = 0;
+ _L4_word_t dummy = 0;
+ _L4_thread_id_t pager = _L4_nilthread;
+
+ _L4_exchange_registers (&thread, &control, &dummy, &dummy, &dummy,
+ &dummy, &pager);
+ return thread;
}
}
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_user_defined_handle_of (l4_thread_id_t thread)
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_user_defined_handle_of (_L4_thread_id_t thread)
{
- l4_thread_id_t dest = thread;
- l4_word_t control = 0;
- l4_word_t user_handle = 0;
- l4_word_t dummy = 0;
- l4_thread_id_t pager = l4_nilthread;
-
- l4_exchange_registers (&dest, &control, &dummy, &dummy, &dummy,
- &user_handle, &pager);
+ _L4_word_t control = 0;
+ _L4_word_t user_handle = 0;
+ _L4_word_t dummy = 0;
+ _L4_thread_id_t pager = _L4_nilthread;
+
+ _L4_exchange_registers (&thread, &control, &dummy, &dummy, &dummy,
+ &user_handle, &pager);
return user_handle;
}
static inline void
-__attribute__((__always_inline__))
-l4_set_user_defined_handle_of (l4_thread_id_t thread, l4_word_t handle)
+_L4_attribute_always_inline
+_L4_set_user_defined_handle_of (_L4_thread_id_t thread, _L4_word_t handle)
{
- l4_thread_id_t dest = thread;
- l4_word_t control = L4_XCHG_REGS_SET_USER_HANDLE;
- l4_word_t user_handle = handle;
- l4_word_t dummy = 0;
- l4_thread_id_t pager = l4_nilthread;
-
- l4_exchange_registers (&dest, &control, &dummy, &dummy, &dummy,
- &user_handle, &pager);
+ _L4_word_t control = _L4_XCHG_REGS_SET_USER_HANDLE;
+ _L4_word_t user_handle = handle;
+ _L4_word_t dummy = 0;
+ _L4_thread_id_t pager = _L4_nilthread;
+
+ _L4_exchange_registers (&thread, &control, &dummy, &dummy, &dummy,
+ &user_handle, &pager);
}
-static inline l4_thread_id_t
-__attribute__((__always_inline__))
-l4_pager_of (l4_thread_id_t thread)
+static inline _L4_thread_id_t
+_L4_attribute_always_inline
+_L4_pager_of (_L4_thread_id_t thread)
{
- l4_thread_id_t dest = thread;
- l4_word_t control = 0;
- l4_thread_id_t pager = l4_nilthread;
- l4_word_t dummy = 0;
+ _L4_word_t control = 0;
+ _L4_thread_id_t pager = _L4_nilthread;
+ _L4_word_t dummy = 0;
- l4_exchange_registers (&dest, &control, &dummy, &dummy, &dummy,
- &dummy, &pager);
+ _L4_exchange_registers (&thread, &control, &dummy, &dummy, &dummy,
+ &dummy, &pager);
return pager;
}
static inline void
-__attribute__((__always_inline__))
-l4_set_pager_of (l4_thread_id_t thread, l4_thread_id_t pager_thread)
+_L4_attribute_always_inline
+_L4_set_pager_of (_L4_thread_id_t thread, _L4_thread_id_t pager_thread)
{
- l4_thread_id_t dest = thread;
- l4_word_t control = L4_XCHG_REGS_SET_PAGER;
- l4_thread_id_t pager = pager_thread;
- l4_word_t dummy = 0;
+ _L4_word_t control = _L4_XCHG_REGS_SET_PAGER;
+ _L4_thread_id_t pager = pager_thread;
+ _L4_word_t dummy = 0;
- l4_exchange_registers (&dest, &control, &dummy, &dummy, &dummy,
- &dummy, &pager);
+ _L4_exchange_registers (&thread, &control, &dummy, &dummy, &dummy,
+ &dummy, &pager);
}
static inline void
-__attribute__((__always_inline__))
-l4_start (l4_thread_id_t thread)
+_L4_attribute_always_inline
+_L4_start (_L4_thread_id_t thread)
{
- l4_thread_id_t dest = thread;
- l4_word_t control = L4_XCHG_REGS_SET_HALT;
- l4_word_t dummy = 0;
- l4_thread_id_t pager = l4_nilthread;
+ _L4_word_t control = _L4_XCHG_REGS_SET_HALT;
+ _L4_word_t dummy = 0;
+ _L4_thread_id_t pager = _L4_nilthread;
- l4_exchange_registers (&dest, &control, &dummy, &dummy, &dummy,
- &dummy, &pager);
+ _L4_exchange_registers (&thread, &control, &dummy, &dummy, &dummy,
+ &dummy, &pager);
}
static inline void
-__attribute__((__always_inline__))
-l4_start_sp_ip (l4_thread_id_t thread, l4_word_t sp_data, l4_word_t ip_data)
+_L4_attribute_always_inline
+_L4_start_sp_ip (_L4_thread_id_t thread, _L4_word_t sp, _L4_word_t ip)
{
- l4_thread_id_t dest = thread;
- l4_word_t control = L4_XCHG_REGS_SET_HALT | L4_XCHG_REGS_SET_SP
- | L4_XCHG_REGS_SET_IP;
- l4_word_t sp = sp_data;
- l4_word_t ip = ip_data;
- l4_word_t dummy = 0;
- l4_thread_id_t pager = l4_nilthread;
-
- l4_exchange_registers (&dest, &control, &sp, &ip, &dummy, &dummy, &pager);
+ _L4_word_t control = _L4_XCHG_REGS_SET_HALT | _L4_XCHG_REGS_SET_SP
+ | _L4_XCHG_REGS_SET_IP;
+ _L4_word_t dummy = 0;
+ _L4_thread_id_t pager = _L4_nilthread;
+
+ _L4_exchange_registers (&thread, &control, &sp, &ip, &dummy, &dummy, &pager);
}
static inline void
-__attribute__((__always_inline__))
-l4_start_sp_ip_flags (l4_thread_id_t thread, l4_word_t sp_data,
- l4_word_t ip_data, l4_word_t flags_data)
+_L4_attribute_always_inline
+_L4_start_sp_ip_flags (_L4_thread_id_t thread, _L4_word_t sp,
+ _L4_word_t ip, _L4_word_t flags)
{
- l4_thread_id_t dest = thread;
- l4_word_t control = L4_XCHG_REGS_SET_HALT | L4_XCHG_REGS_SET_SP
- | L4_XCHG_REGS_SET_IP | L4_XCHG_REGS_SET_FLAGS;
- l4_word_t sp = sp_data;
- l4_word_t ip = ip_data;
- l4_word_t flags = flags_data;
- l4_word_t dummy = 0;
- l4_thread_id_t pager = l4_nilthread;
-
- l4_exchange_registers (&dest, &control, &sp, &ip, &flags, &dummy, &pager);
+ _L4_word_t control = _L4_XCHG_REGS_SET_HALT | _L4_XCHG_REGS_SET_SP
+ | _L4_XCHG_REGS_SET_IP | _L4_XCHG_REGS_SET_FLAGS;
+ _L4_word_t dummy = 0;
+ _L4_thread_id_t pager = _L4_nilthread;
+
+ _L4_exchange_registers (&thread, &control, &sp, &ip, &flags, &dummy, &pager);
}
-#define __L4_STOP(name, extra_control) \
-static inline l4_word_t \
-__attribute__((__always_inline__)) \
-name (l4_thread_id_t thread) \
-{ \
- l4_thread_id_t dest = thread; \
- l4_word_t control = L4_XCHG_REGS_SET_HALT | L4_XCHG_REGS_HALT \
- | (extra_control); \
- l4_word_t dummy = 0; \
- l4_thread_id_t pager = l4_nilthread; \
- \
- l4_exchange_registers (&dest, &control, &dummy, &dummy, \
- &dummy, &dummy, &pager); \
- return control; \
-} \
- \
- \
-static inline l4_word_t \
-__attribute__((__always_inline__)) \
-name ## _sp_ip_flags (l4_thread_id_t thread, l4_word_t *sp, \
- l4_word_t *ip, l4_word_t *flags) \
-{ \
- l4_thread_id_t dest = thread; \
- l4_word_t control = L4_XCHG_REGS_SET_HALT | L4_XCHG_REGS_HALT \
- | L4_XCHG_REGS_SET_SP | L4_XCHG_REGS_SET_IP \
- | (extra_control); \
- l4_word_t dummy = 0; \
- l4_thread_id_t pager = l4_nilthread; \
- \
- l4_exchange_registers (&dest, &control, sp, ip, flags, \
- &dummy, &pager); \
- return control; \
+#define __L4_STOP(name, extra_control) \
+static inline _L4_word_t \
+_L4_attribute_always_inline \
+name (_L4_thread_id_t thread) \
+{ \
+ _L4_word_t control = _L4_XCHG_REGS_SET_HALT | _L4_XCHG_REGS_HALT \
+ | (extra_control); \
+ _L4_word_t dummy = 0; \
+ _L4_thread_id_t pager = _L4_nilthread; \
+ \
+ _L4_exchange_registers (&thread, &control, &dummy, &dummy, \
+ &dummy, &dummy, &pager); \
+ return control; \
+} \
+ \
+ \
+static inline _L4_word_t \
+_L4_attribute_always_inline \
+name ## _sp_ip_flags (_L4_thread_id_t thread, _L4_word_t *sp, \
+ _L4_word_t *ip, _L4_word_t *flags) \
+{ \
+ _L4_word_t control = _L4_XCHG_REGS_SET_HALT | _L4_XCHG_REGS_HALT \
+ | _L4_XCHG_REGS_SET_SP | _L4_XCHG_REGS_SET_IP \
+ | (extra_control); \
+ _L4_word_t dummy = 0; \
+ _L4_thread_id_t pager = _L4_nilthread; \
+ \
+ _L4_exchange_registers (&thread, &control, sp, ip, flags, \
+ &dummy, &pager); \
+ return control; \
}
-__L4_STOP (l4_stop, 0)
-__L4_STOP (l4_abort_receive_and_stop, L4_XCHG_REGS_CANCEL_RECV)
-__L4_STOP (l4_abort_send_and_stop, L4_XCHG_REGS_CANCEL_SEND)
-__L4_STOP (l4_abort_ipc_and_stop, L4_XCHG_REGS_CANCEL_IPC)
+__L4_STOP (_L4_stop, 0)
+__L4_STOP (_L4_abort_receive_and_stop, _L4_XCHG_REGS_CANCEL_RECV)
+__L4_STOP (_L4_abort_send_and_stop, _L4_XCHG_REGS_CANCEL_SEND)
+__L4_STOP (_L4_abort_ipc_and_stop, _L4_XCHG_REGS_CANCEL_IPC)
/* Convenience interface for l4_thread_control. */
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_associate_interrupt (l4_thread_id_t irq, l4_thread_id_t handler)
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_associate_interrupt (_L4_thread_id_t irq, _L4_thread_id_t handler)
{
- return l4_thread_control (irq, irq, l4_nilthread, handler, (void *) -1);
+ return _L4_thread_control (irq, irq, _L4_nilthread, handler, (void *) -1);
}
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_deassociate_interrupt (l4_thread_id_t irq)
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_deassociate_interrupt (_L4_thread_id_t irq)
{
- return l4_thread_control (irq, irq, l4_nilthread, irq, (void *) -1);
+ return _L4_thread_control (irq, irq, _L4_nilthread, irq, (void *) -1);
}
+
+/* Now incorporate the public interfaces the user has selected. */
+#ifdef _L4_INTERFACE_L4
+#include <l4/compat/thread.h>
+#endif
+#ifdef _L4_INTERFACE_GNU
+#include <l4/gnu/thread.h>
+#endif
#endif /* l4/thread.h */
diff --git a/libl4/l4/types.h b/libl4/l4/types.h
index 1523af3..cc2fc0d 100644
--- a/libl4/l4/types.h
+++ b/libl4/l4/types.h
@@ -1,5 +1,5 @@
-/* types.h - Public interface for L4 types.
- Copyright (C) 2003 Free Software Foundation, Inc.
+/* l4/types.h - Public interface for L4 types.
+ Copyright (C) 2003, 2004 Free Software Foundation, Inc.
Written by Marcus Brinkmann <marcus@gnu.org>.
This file is part of the GNU L4 library.
@@ -22,59 +22,50 @@
#ifndef _L4_TYPES_H
#define _L4_TYPES_H 1
-#define L4_LITTLE_ENDIAN 0
-#define L4_BIG_ENDIAN 1
+#include <l4/features.h>
-#define L4_WORDSIZE_32 0
-#define L4_WORDSIZE_64 1
-
-/* <l4/bits/types.h> defines L4_BYTE_ORDER and L4_WORDSIZE. It also
- defines the basic type l4_word_t. */
+/* The architecture specific file defines _L4_BYTE_ORDER and _L4_WORDSIZE. */
#include <l4/bits/types.h>
-# define __l4_intN_t(N, MODE) \
- typedef int l4_int##N##_t __attribute__ ((__mode__ (MODE)))
-# define __l4_uintN_t(N, MODE) \
- typedef unsigned int l4_uint##N##_t __attribute__ ((__mode__ (MODE)))
-
-__l4_intN_t (8, __QI__);
-__l4_intN_t (16, __HI__);
-__l4_intN_t (32, __SI__);
-__l4_intN_t (64, __DI__);
-
-__l4_uintN_t (8, __QI__);
-__l4_uintN_t (16, __HI__);
-__l4_uintN_t (32, __SI__);
-__l4_uintN_t (64, __DI__);
+
+#define _L4_LITTLE_ENDIAN 0
+#define _L4_BIG_ENDIAN 1
+
+#define _L4_WORDSIZE_32 0
+#define _L4_WORDSIZE_64 1
+
+# define __L4_intN_t(N, MODE) \
+ typedef int _L4_int##N##_t __attribute__ ((__mode__ (MODE)))
+# define __L4_uintN_t(N, MODE) \
+ typedef unsigned int _L4_uint##N##_t __attribute__ ((__mode__ (MODE)))
+
+__L4_intN_t (8, __QI__);
+__L4_intN_t (16, __HI__);
+__L4_intN_t (32, __SI__);
+__L4_intN_t (64, __DI__);
+
+__L4_uintN_t (8, __QI__);
+__L4_uintN_t (16, __HI__);
+__L4_uintN_t (32, __SI__);
+__L4_uintN_t (64, __DI__);
+#if _L4_WORDSIZE == _L4_WORDSIZE_64
+__L4_uintN_t (128, __TI__);
+#endif
-#if L4_WORDSIZE == L4_WORDSIZE_32
-typedef l4_uint32_t l4_word_t;
-#define L4_WORD_C(c) c ## U
-#define __L4_PRI_PREFIX
+#if _L4_WORDSIZE == _L4_WORDSIZE_32
+typedef _L4_uint32_t _L4_word_t;
+#define _L4_WORD_C(c) c ## U
+typedef _L4_uint64_t _L4_dword_t;
#else
-#if L4_WORDSIZE == L4_WORDSIZE_64
-typedef l4_uint64_t l4_word_t;
-#define L4_WORD_C(c) c ## UL
-#define __L4_PRI_PREFIX "l"
+#if _L4_WORDSIZE == _L4_WORDSIZE_64
+typedef _L4_uint64_t _L4_word_t;
+#define _L4_WORD_C(c) c ## UL
+typedef _L4_uint128_t _L4_dword_t;
#else
#error "Unsupported word size."
#endif
#endif
-#define L4_PRIdWORD __L4_PRI_PREFIX "d"
-#define L4_PRIiWORD __L4_PRI_PREFIX "i"
-#define L4_PRIoWORD __L4_PRI_PREFIX "o"
-#define L4_PRIuWORD __L4_PRI_PREFIX "u"
-#define L4_PRIxWORD __L4_PRI_PREFIX "x"
-#define L4_PRIXWORD __L4_PRI_PREFIX "X"
-
-#define L4_SCNdWORD __L4_PRI_PREFIX "d"
-#define L4_SCNiWORD __L4_PRI_PREFIX "i"
-#define L4_SCNoWORD __L4_PRI_PREFIX "o"
-#define L4_SCNuWORD __L4_PRI_PREFIX "u"
-#define L4_SCNxWORD __L4_PRI_PREFIX "x"
-#define L4_SCNXWORD __L4_PRI_PREFIX "X"
-
/* Utility macros for structure definitions. */
@@ -85,11 +76,11 @@ typedef l4_uint64_t l4_word_t;
/* Sometimes the bit-field has different sizes depending on the word
size, and sometimes it only exists on systems with a specific word
size. */
-#if L4_WORDSIZE == L4_WORDSIZE_32
+#if _L4_WORDSIZE == _L4_WORDSIZE_32
#define _L4_BITFIELD_64(name, nr) : 0
#define _L4_BITFIELD_32_64(name, nr32, nr64) name : nr32
#else
-#if L4_WORDSIZE == L4_WORDSIZE_64
+#if _L4_WORDSIZE == _L4_WORDSIZE_64
#define _L4_BITFIELD_64(name, nr) name : nr
#define _L4_BITFIELD_32_64(name, nr32, nr64) name : nr64
#endif
@@ -98,7 +89,7 @@ typedef l4_uint64_t l4_word_t;
/* The representation of a bit-field is system and/or compiler
specific. We require that GCC uses a specific representation that
only depends on the endianess of the system. */
-#if L4_BYTE_ORDER == L4_LITTLE_ENDIAN
+#if _L4_BYTE_ORDER == _L4_LITTLE_ENDIAN
#define _L4_BITFIELD2(type, bf1, bf2) type bf1; type bf2
#define _L4_BITFIELD3(type, bf1, bf2, bf3) type bf1; type bf2; type bf3
#define _L4_BITFIELD4(type, bf1, bf2, bf3, bf4) \
@@ -110,7 +101,7 @@ typedef l4_uint64_t l4_word_t;
#define _L4_BITFIELD7(type, bf1, bf2, bf3, bf4, bf5, bf6, bf7) \
type bf1; type bf2; type bf3; type bf4; type bf5; type bf6; type bf7
#else
-#if L4_BYTE_ORDER == L4_BIG_ENDIAN
+#if _L4_BYTE_ORDER == _L4_BIG_ENDIAN
#define _L4_BITFIELD2(type, bf1, bf2) type bf2; type bf1
#define _L4_BITFIELD3(type, bf1, bf2, bf3) type bf3; type bf2; type bf1
#define _L4_BITFIELD4(type, bf1, bf2, bf3, bf4) \
@@ -143,118 +134,36 @@ typedef l4_uint64_t l4_word_t;
struct s1; struct s2; struct s3; struct s4
-/* The Thread ID type is here to avoid vregs.h requiring thread.h. */
-/* FIXME: Remove named structs when gcc supports initializers for
- unnamed fields, and change the initializers in <l4/thread.h>. */
-typedef _L4_RAW
-(l4_word_t, _L4_STRUCT4
- ({
- _L4_BITFIELD2
- (l4_word_t,
- _L4_BITFIELD_32_64 (version, 14, 32),
- _L4_BITFIELD_32_64 (thread_no, 18, 32));
- },
- {
- _L4_BITFIELD2
- (l4_word_t,
- _L4_BITFIELD (_all_zero, 6),
- _L4_BITFIELD_32_64 (local, 26, 58));
- },
- {
- _L4_BITFIELD2
- (l4_word_t,
- _L4_BITFIELD_32_64 (version, 14, 32),
- _L4_BITFIELD_32_64 (thread_no, 18, 32));
- } global,
- {
- _L4_BITFIELD2
- (l4_word_t,
- _L4_BITFIELD (_all_zero, 6),
- _L4_BITFIELD_32_64 (local, 26, 58));
- } local)) l4_thread_id_t;
+/* The following basic types need to be defined here, because they are
+ liberally used in various header files (syscall.h for example). */
+typedef _L4_word_t _L4_api_version_t;
+typedef _L4_word_t _L4_api_flags_t;
+typedef _L4_word_t _L4_kernel_id_t;
+struct _L4_kip;
+typedef struct _L4_kip *_L4_kip_t;
+
+typedef _L4_word_t _L4_thread_id_t;
-
/* The clock is 64 bits on all architectures. The clock base is
undefined. The base unit is 1 microsecond. */
-typedef l4_uint64_t l4_clock_t;
+typedef _L4_uint64_t _L4_clock_t;
-
-typedef _L4_RAW
-(l4_uint16_t, _L4_STRUCT2
- ({
- /* This is a time period. It is 2^e * m usec long. */
- _L4_BITFIELD3
- (l4_uint16_t,
- _L4_BITFIELD (m, 10),
- _L4_BITFIELD (e, 5),
- _L4_BITFIELD (_zero, 1));
- } period,
- {
- /* This is a time point with validity (2^10 - 1) * 2^e. */
- _L4_BITFIELD4
- (l4_uint16_t,
- _L4_BITFIELD (m, 10),
- _L4_BITFIELD (c, 1),
- _L4_BITFIELD (e, 4),
- _L4_BITFIELD (_one, 1));
- } point)) l4_time_t;
+typedef _L4_uint16_t _L4_time_t;
-
-/* FIXME: Remove named structs when gcc supports initializers for
- unnamed fields, and change the initializers in <l4/space.h>. */
-typedef _L4_RAW
-(l4_word_t, _L4_STRUCT4
- ({
- _L4_BITFIELD3
- (l4_word_t,
- _L4_BITFIELD (rights, 4),
- _L4_BITFIELD (log2_size, 6),
- _L4_BITFIELD_32_64 (base, 22, 54));
- },
- {
- /* Alias names for RIGHTS. */
- _L4_BITFIELD3
- (l4_word_t,
- _L4_BITFIELD (executable, 1),
- _L4_BITFIELD (writable, 1),
- _L4_BITFIELD (readable, 1));
- },
- {
- /* Names for status bits as returned from l4_unmap. */
- _L4_BITFIELD3
- (l4_word_t,
- _L4_BITFIELD (executed, 1),
- _L4_BITFIELD (written, 1),
- _L4_BITFIELD (referenced, 1));
- },
- {
- _L4_BITFIELD3
- (l4_word_t,
- _L4_BITFIELD (rights, 4),
- _L4_BITFIELD (log2_size, 6),
- _L4_BITFIELD_32_64 (base, 22, 54));
- } page)) l4_fpage_t;
+typedef _L4_word_t _L4_fpage_t;
-
-/* Message tags. */
-typedef _L4_RAW (l4_word_t, _L4_STRUCT1 ({
- _L4_BITFIELD7
- (l4_word_t,
- _L4_BITFIELD (untyped, 6),
- _L4_BITFIELD (typed, 6),
- _L4_BITFIELD (propagated, 1),
- _L4_BITFIELD (redirected, 1),
- _L4_BITFIELD (cross_cpu, 1),
- _L4_BITFIELD (error, 1),
- _L4_BITFIELD_32_64 (label, 16, 48));
-})) l4_msg_tag_t;
+typedef _L4_word_t _L4_msg_tag_t;
-#ifndef _L4_NO_COMPAT
-
+/* Now incorporate the public interfaces the user has selected. */
+#ifdef _L4_INTERFACE_L4
#include <l4/compat/types.h>
+#endif
+#ifdef _L4_INTERFACE_GNU
+#include <l4/gnu/types.h>
+#endif
-#endif /* !_L4_NO_COMPAT */
+
#endif /* l4/types.h */
diff --git a/libl4/l4/vregs.h b/libl4/l4/vregs.h
index d2d6c01..5d18035 100644
--- a/libl4/l4/vregs.h
+++ b/libl4/l4/vregs.h
@@ -1,10 +1,32 @@
+/* l4/vregs.h - Public interface to the L4 virtual registers.
+ 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_VREGS_H
#define _L4_VREGS_H 1
+#include <l4/features.h>
#include <l4/types.h>
-/* <l4/bits/vregs.h> defines extern inlines for virtual register
- access. */
+/* All virtual registers are defined by the architecture specific
+ header file. */
#include <l4/bits/vregs.h>
#endif /* l4/vregs.h */
diff --git a/libl4/powerpc/Makefile.am b/libl4/powerpc/Makefile.am
index 663567d..bd919f9 100644
--- a/libl4/powerpc/Makefile.am
+++ b/libl4/powerpc/Makefile.am
@@ -22,4 +22,8 @@ nobase_include_HEADERS = l4/bits/types.h \
l4/bits/math.h l4/bits/vregs.h l4/bits/syscall.h \
l4/bits/stubs.h l4/bits/stubs-init.h \
l4/bits/kip.h l4/bits/space.h l4/bits/ipc.h \
- l4/bits/misc.h
+ l4/bits/misc.h \
+ l4/bits/compat/ipc.h l4/bits/compat/misc.h \
+ l4/bits/compat/space.h \
+ l4/bits/gnu/ipc.h l4/bits/gnu/kip.h l4/bits/gnu/misc.h \
+ l4/bits/compat/space.h \ No newline at end of file
diff --git a/libl4/powerpc/l4/bits/compat/ipc.h b/libl4/powerpc/l4/bits/compat/ipc.h
new file mode 100644
index 0000000..c361086
--- /dev/null
+++ b/libl4/powerpc/l4/bits/compat/ipc.h
@@ -0,0 +1,27 @@
+/* l4/bits/compat/ipc.h - L4 IPC features for powerpc.
+ Copyright (C) 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_IPC_H
+# error "Never use <l4/bits/compat/ipc.h> directly; include <l4/ipc.h> instead."
+#endif
+
+
+/* Nothing yet. */
diff --git a/libl4/powerpc/l4/bits/compat/misc.h b/libl4/powerpc/l4/bits/compat/misc.h
new file mode 100644
index 0000000..afe7f1f
--- /dev/null
+++ b/libl4/powerpc/l4/bits/compat/misc.h
@@ -0,0 +1,34 @@
+/* l4/bits/compat/misc.h - L4 miscellaneous features for powerpc.
+ Copyright (C) 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
+# error "Never use <l4/bits/compat/misc.h> directly; include <l4/misc.h> instead."
+#endif
+
+
+#define L4_WriteThroughMemory _L4_WRITE_THROUGH_MEMORY
+#define L4_WriteBackMemory _L4_WRITE_BACK_MEMORY
+#define L4_CacheInhibitedMemory _L4_CACHE_INHIBITED_MEMORY
+#define L4_CacheEnabledMemory _L4_CACHE_ENABLED_MEMORY
+#define L4_GlobalMemory _L4_GLOBAL_MEMORY
+#define L4_LocalMemory _L4_LOCAL_MEMORY
+#define L4_GuardedMemory _L4_GUARDED_MEMORY
+#define L4_SpeculativeMemory _L4_SPECULATIVE_MEMORY
diff --git a/libl4/powerpc/l4/bits/compat/space.h b/libl4/powerpc/l4/bits/compat/space.h
new file mode 100644
index 0000000..77637e3
--- /dev/null
+++ b/libl4/powerpc/l4/bits/compat/space.h
@@ -0,0 +1,27 @@
+/* l4/bits/compat/space.h - L4 space features for powerpc.
+ Copyright (C) 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_SPACE_H
+# error "Never use <l4/bits/compat/space.h> directly; include <l4/space.h> instead."
+#endif
+
+
+/* Nothing yet. */
diff --git a/libl4/powerpc/l4/bits/gnu/ipc.h b/libl4/powerpc/l4/bits/gnu/ipc.h
new file mode 100644
index 0000000..425682c
--- /dev/null
+++ b/libl4/powerpc/l4/bits/gnu/ipc.h
@@ -0,0 +1,40 @@
+/* l4/bits/gnu/ipc.h - GNU L4 IPC features for powerpc.
+ Copyright (C) 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_IPC_H
+# error "Never use <l4/bits/gnu/ipc.h> directly; include <l4/ipc.h> instead."
+#endif
+
+
+#ifdef __cplusplus
+extern "C" {
+#if 0 /* Just to make Emacs auto-indent happy. */
+}
+#endif
+#endif /* __cplusplus */
+
+
+/* Nothing yet. */
+
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/libl4/powerpc/l4/bits/gnu/kip.h b/libl4/powerpc/l4/bits/gnu/kip.h
new file mode 100644
index 0000000..72bb8a0
--- /dev/null
+++ b/libl4/powerpc/l4/bits/gnu/kip.h
@@ -0,0 +1,40 @@
+/* l4/bits/gnu/kip.h - L4 KIP features GNU interface for powerpc.
+ Copyright (C) 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_KIP_H
+# error "Never use <l4/bits/gnu/kip.h> directly; include <l4/kip.h> instead."
+#endif
+
+
+#ifdef __cplusplus
+extern "C" {
+#if 0 /* Just to make Emacs auto-indent happy. */
+}
+#endif
+#endif /* __cplusplus */
+
+
+/* Nothing yet. */
+
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/libl4/powerpc/l4/bits/gnu/misc.h b/libl4/powerpc/l4/bits/gnu/misc.h
new file mode 100644
index 0000000..8c03dfc
--- /dev/null
+++ b/libl4/powerpc/l4/bits/gnu/misc.h
@@ -0,0 +1,47 @@
+/* l4/bits/gnu/misc.h - GNU L4 miscellaneous features for powerpc.
+ Copyright (C) 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
+# error "Never use <l4/bits/gnu/misc.h> directly; include <l4/misc.h> instead."
+#endif
+
+
+#ifdef __cplusplus
+extern "C" {
+#if 0 /* Just to make Emacs auto-indent happy. */
+}
+#endif
+#endif /* __cplusplus */
+
+
+#define L4_WRITE_THROUGH_MEMORY _L4_WRITE_THROUGH_MEMORY
+#define L4_WRITE_BACK_MEMORY _L4_WRITE_BACK_MEMORY
+#define L4_CACHE_INHIBITED_MEMORY _L4_CACHE_INHIBITED_MEMORY
+#define L4_CACHE_ENABLED_MEMORY _L4_CACHE_ENABLED_MEMORY
+#define L4_GLOBAL_MEMORY _L4_GLOBAL_MEMORY
+#define L4_LOCAL_MEMORY _L4_LOCAL_MEMORY
+#define L4_GUARDED_MEMORY _L4_GUARDED_MEMORY
+#define L4_SPECULATIVE_MEMORY _L4_SPECULATIVE_MEMORY
+
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/libl4/powerpc/l4/bits/gnu/space.h b/libl4/powerpc/l4/bits/gnu/space.h
new file mode 100644
index 0000000..d8b4ea5
--- /dev/null
+++ b/libl4/powerpc/l4/bits/gnu/space.h
@@ -0,0 +1,40 @@
+/* l4/bits/gnu/space.h - GNU L4 space features for powerpc.
+ Copyright (C) 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_SPACE_H
+# error "Never use <l4/bits/gnu/space.h> directly; include <l4/space.h> instead."
+#endif
+
+
+#ifdef __cplusplus
+extern "C" {
+#if 0 /* Just to make Emacs auto-indent happy. */
+}
+#endif
+#endif /* __cplusplus */
+
+
+/* Nothing yet. */
+
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/libl4/powerpc/l4/bits/ipc.h b/libl4/powerpc/l4/bits/ipc.h
index a764dfa..ade912f 100644
--- a/libl4/powerpc/l4/bits/ipc.h
+++ b/libl4/powerpc/l4/bits/ipc.h
@@ -23,4 +23,14 @@
# error "Never use <l4/bits/ipc.h> directly; include <l4/ipc.h> instead."
#endif
+
/* Nothing yet. */
+
+
+/* Now incorporate the public interfaces the user has selected. */
+#ifdef _L4_INTERFACE_L4
+#include <l4/bits/compat/ipc.h>
+#endif
+#ifdef _L4_INTERFACE_GNU
+#include <l4/bits/gnu/ipc.h>
+#endif
diff --git a/libl4/powerpc/l4/bits/kip.h b/libl4/powerpc/l4/bits/kip.h
index e40c49d..d0eb80b 100644
--- a/libl4/powerpc/l4/bits/kip.h
+++ b/libl4/powerpc/l4/bits/kip.h
@@ -23,4 +23,11 @@
# error "Never use <l4/bits/kip.h> directly; include <l4/kip.h> instead."
#endif
+
/* Nothing yet. */
+
+
+/* Now incorporate the public interfaces the user has selected. */
+#ifdef _L4_INTERFACE_GNU
+#include <l4/bits/gnu/kip.h>
+#endif
diff --git a/libl4/powerpc/l4/bits/math.h b/libl4/powerpc/l4/bits/math.h
index b1543d9..2a1af9a 100644
--- a/libl4/powerpc/l4/bits/math.h
+++ b/libl4/powerpc/l4/bits/math.h
@@ -1,5 +1,5 @@
-/* math.h - Math support routines for powerpc.
- Copyright (C) 2003 Free Software Foundation, Inc.
+/* l4/bits/math.h - Math support routines for powerpc.
+ Copyright (C) 2003, 2004 Free Software Foundation, Inc.
Written by Marcus Brinkmann <marcus@gnu.org>.
This file is part of the GNU L4 library.
@@ -25,11 +25,11 @@
/* Calculate the MSB set in DATA. DATA is not 0. */
-static inline l4_word_t
-__attribute__((__always_inline__, __const__))
-__l4_msb (l4_word_t data)
+static inline _L4_word_t
+_L4_attribute_always_inline _L4_attribute_const
+__L4_msb (_L4_word_t data)
{
- l4_word_t msb;
+ _L4_word_t msb;
/* Count the leading zeros. */
asm ("cntlzw %[msb], %[data]"
@@ -41,11 +41,11 @@ __l4_msb (l4_word_t data)
/* Calculate the LSB set in DATA. DATA is not 0. */
-static inline l4_word_t
-__attribute__((__always_inline__, __const__))
-__l4_lsb (l4_word_t data)
+static inline _L4_word_t
+_L4_attribute_always_inline _L4_attribute_const
+__L4_lsb (_L4_word_t data)
{
- l4_word_t lsb;
+ _L4_word_t lsb;
/* x & -x clears all bits in the word except the LSB set. */
return __l4_msb (data & -data);
diff --git a/libl4/powerpc/l4/bits/misc.h b/libl4/powerpc/l4/bits/misc.h
index 55e552a..529d3e4 100644
--- a/libl4/powerpc/l4/bits/misc.h
+++ b/libl4/powerpc/l4/bits/misc.h
@@ -1,5 +1,5 @@
-/* misc.h - L4 miscellaneous definitions for powerpc.
- Copyright (C) 2003 Free Software Foundation, Inc.
+/* l4/bits/misc.h - L4 miscellaneous definitions for powerpc.
+ Copyright (C) 2003, 2004 Free Software Foundation, Inc.
Written by Marcus Brinkmann <marcus@gnu.org>.
This file is part of the GNU L4 library.
@@ -23,11 +23,21 @@
# error "Never use <l4/bits/misc.h> directly; include <l4/misc.h> instead."
#endif
-#define l4_write_through_memory 1
-#define l4_write_back_memory 2
-#define l4_cache_inhibited_memory 3
-#define l4_cache_enabled_memory 4
-#define l4_global_memory 5
-#define l4_local_memory 6
-#define l4_guarded_memory 7
-#define l4_speculative_memory 8
+
+#define _L4_WRITE_THROUGH_MEMORY _L4_WORD_C(1)
+#define _L4_WRITE_BACK_MEMORY _L4_WORD_C(2)
+#define _L4_CACHE_INHIBITED_MEMORY _L4_WORD_C(3)
+#define _L4_CACHE_ENABLED_MEMORY _L4_WORD_C(4)
+#define _L4_GLOBAL_MEMORY _L4_WORD_C(5)
+#define _L4_LOCAL_MEMORY _L4_WORD_C(6)
+#define _L4_GUARDED_MEMORY _L4_WORD_C(7)
+#define _L4_SPECULATIVE_MEMORY _L4_WORD_C(8)
+
+
+/* Now incorporate the public interfaces the user has selected. */
+#ifdef _L4_INTERFACE_L4
+#include <l4/bits/compat/misc.h>
+#endif
+#ifdef _L4_INTERFACE_GNU
+#include <l4/bits/gnu/misc.h>
+#endif
diff --git a/libl4/powerpc/l4/bits/space.h b/libl4/powerpc/l4/bits/space.h
index 4c8822f..5fdb3b0 100644
--- a/libl4/powerpc/l4/bits/space.h
+++ b/libl4/powerpc/l4/bits/space.h
@@ -1,5 +1,5 @@
-/* space.h - Architecture dependent part of public interface to L4 threads.
- Copyright (C) 2003 Free Software Foundation, Inc.
+/* l4/bits/space.h - L4 spaces definitions for powerpc.
+ Copyright (C) 2003, 2004 Free Software Foundation, Inc.
Written by Marcus Brinkmann <marcus@gnu.org>.
This file is part of the GNU L4 library.
@@ -25,3 +25,12 @@
/* Nothing yet. */
+
+
+/* Now incorporate the public interfaces the user has selected. */
+#ifdef _L4_INTERFACE_L4
+#include <l4/bits/compat/space.h>
+#endif
+#ifdef _L4_INTERFACE_GNU
+#include <l4/bits/gnu/space.h>
+#endif
diff --git a/libl4/powerpc/l4/bits/syscall.h b/libl4/powerpc/l4/bits/syscall.h
index d50f975..4c74adf 100644
--- a/libl4/powerpc/l4/bits/syscall.h
+++ b/libl4/powerpc/l4/bits/syscall.h
@@ -45,39 +45,41 @@
the API flags, and the kernel ID. */
static inline l4_kip_t
-__attribute__((__always_inline__, __const__))
-l4_kernel_interface (l4_api_version_t *api_version, l4_api_flags_t *api_flags,
- l4_kernel_id_t *kernel_id)
+_L4_attribute_always_inline _L4_attribute_const
+_L4_kernel_interface (_L4_api_version_t *api_version,
+ _L4_api_flags_t *api_flags,
+ _L4_kernel_id_t *kernel_id)
{
register void *kip asm ("r3");
- register l4_word_t version asm ("r4");
- register l4_word_t flags asm ("r5");
- register l4_word_t id asm ("r6");
+ register _L4_word_t version asm ("r4");
+ register _L4_word_t flags asm ("r5");
+ register _L4_word_t id asm ("r6");
__asm__ ("tlbia\n"
: "+r" (kip), "+r" (version), "+r" (flags), "+r" (id));
- api_version->raw = version;
- api_flags->raw = flags;
- kernel_id->raw = id;
+ *api_version = version;
+ *api_flags = flags;
+ *kernel_id = id;
return kip;
}
static inline void
-__attribute__((__always_inline__))
-l4_exchange_registers (l4_thread_id_t *dest_p, l4_word_t *control_p,
- l4_word_t *sp_p, l4_word_t *ip_p, l4_word_t *flags_p,
- l4_word_t *user_handle_p, l4_thread_id_t *pager_p)
+_L4_attribute_always_inline
+_L4_exchange_registers (_L4_thread_id_t *dest_p, _L4_word_t *control_p,
+ _L4_word_t *sp_p, _L4_word_t *ip_p,
+ _L4_word_t *flags_p, _L4_word_t *user_handle_p,
+ _L4_thread_id_t *pager_p)
{
- register l4_word_t dest_result asm ("r3") = dest_p->raw;
- register l4_word_t control asm ("r4") = *control_p;
- register l4_word_t sp asm ("r5") = *sp_p;
- register l4_word_t ip asm ("r6") = *ip_p;
- register l4_word_t flags asm ("r7") = *flags_p;
- register l4_word_t user_handle asm ("r8") = *user_handle_p;
- register l4_word_t pager asm ("r9") = pager_p->raw;
+ register _L4_word_t dest_result asm ("r3") = *dest_p;
+ register _L4_word_t control asm ("r4") = *control_p;
+ register _L4_word_t sp asm ("r5") = *sp_p;
+ register _L4_word_t ip asm ("r6") = *ip_p;
+ register _L4_word_t flags asm ("r7") = *flags_p;
+ register _L4_word_t user_handle asm ("r8") = *user_handle_p;
+ register _L4_word_t pager asm ("r9") = *pager_p;
__asm__ __volatile__ ("mtctr %[addr]\n"
"bctrl\n"
@@ -87,27 +89,27 @@ l4_exchange_registers (l4_thread_id_t *dest_p, l4_word_t *control_p,
: [addr] "r" (__l4_exchange_registers)
: "r10", __L4_PPC_CLOB);
- dest_p->raw = dest_result;
+ *dest_p = dest_result;
*control_p = control;
*sp_p = sp;
*ip_p = ip;
*flags_p = flags;
*user_handle_p = user_handle;
- pager_p->raw = pager;
+ *pager_p = pager;
}
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_thread_control (l4_thread_id_t dest, l4_thread_id_t space,
- l4_thread_id_t scheduler, l4_thread_id_t pager,
- void *utcb_loc)
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_thread_control (_L4_thread_id_t dest, _L4_thread_id_t space,
+ _L4_thread_id_t scheduler, _L4_thread_id_t pager,
+ void *utcb_loc)
{
- register l4_word_t dest_result asm ("r3") = dest.raw;
- register l4_word_t space_raw asm ("r4") = space.raw;
- register l4_word_t scheduler_raw asm ("r5") = scheduler.raw;
- register l4_word_t pager_raw asm ("r6") = pager.raw;
- register l4_word_t utcb asm ("r7") = (l4_word_t) utcb_loc;
+ register _L4_word_t dest_result asm ("r3") = dest;
+ register _L4_word_t space_raw asm ("r4") = space;
+ register _L4_word_t scheduler_raw asm ("r5") = scheduler;
+ register _L4_word_t pager_raw asm ("r6") = pager;
+ register _L4_word_t utcb asm ("r7") = (_L4_word_t) utcb_loc;
__asm__ __volatile__ ("mtctr %[addr]\n"
"bctrl\n"
@@ -121,12 +123,12 @@ l4_thread_control (l4_thread_id_t dest, l4_thread_id_t space,
}
-static inline l4_clock_t
-__attribute__((__always_inline__))
-l4_system_clock (void)
+static inline _L4_clock_t
+_L4_attribute_always_inline
+_L4_system_clock (void)
{
- register l4_word_t time_low asm ("r3");
- register l4_word_t time_high asm ("r4");
+ register _L4_word_t time_low asm ("r3");
+ register _L4_word_t time_high asm ("r4");
__asm__ __volatile__ ("mtctr %[addr]\n"
"bctrl\n"
@@ -135,15 +137,15 @@ l4_system_clock (void)
: "r5", "r6", "r7", "r8", "r9", "r10",
__L4_PPC_CLOB);
- return (((l4_clock_t) time_high) << 32) | time_low;
+ return (((_L4_clock_t) time_high) << 32) | time_low;
}
static inline void
-__attribute__((__always_inline__))
-l4_thread_switch (l4_thread_id_t dest)
+_L4_attribute_always_inline
+_L4_thread_switch (_L4_thread_id_t dest)
{
- register l4_word_t dest_raw asm ("r3") = dest.raw;
+ register _L4_word_t dest_raw asm ("r3") = dest;
__asm__ __volatile__ ("mtctr %[addr]\n"
"bctrl\n"
@@ -153,17 +155,17 @@ l4_thread_switch (l4_thread_id_t dest)
}
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_schedule (l4_thread_id_t dest, l4_word_t time_control,
- l4_word_t proc_control, l4_word_t prio,
- l4_word_t preempt_control, l4_word_t *old_time_control)
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_schedule (_L4_thread_id_t dest, _L4_word_t time_control,
+ _L4_word_t proc_control, _L4_word_t prio,
+ _L4_word_t preempt_control, _L4_word_t *old_time_control)
{
- register l4_word_t dest_result asm ("r3") = dest.raw;
- register l4_word_t time asm ("r4") = time_control;
- register l4_word_t proc asm ("r5") = proc_control;
- register l4_word_t priority asm ("r6") = prio;
- register l4_word_t preempt asm ("r7") = preempt_control;
+ register _L4_word_t dest_result asm ("r3") = dest;
+ register _L4_word_t time asm ("r4") = time_control;
+ register _L4_word_t proc asm ("r5") = proc_control;
+ register _L4_word_t priority asm ("r6") = prio;
+ register _L4_word_t preempt asm ("r7") = preempt_control;
__asm__ __volatile__ ("mtctr %[addr]\n"
"bctrl\n"
@@ -178,10 +180,10 @@ l4_schedule (l4_thread_id_t dest, l4_word_t time_control,
static inline void
-__attribute__((__always_inline__))
-l4_unmap (l4_word_t control)
+_L4_attribute_always_inline
+_L4_unmap (_L4_word_t control)
{
- register l4_word_t ctrl asm ("r3") = control;
+ register _L4_word_t ctrl asm ("r3") = control;
__asm__ __volatile__ ("mtctr %[addr]\n"
"bctrl\n"
@@ -192,17 +194,17 @@ l4_unmap (l4_word_t control)
}
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_space_control (l4_thread_id_t space, l4_word_t control,
- l4_fpage_t kip_area, l4_fpage_t utcb_area,
- l4_thread_id_t redirector, l4_word_t *old_control)
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_space_control (_L4_thread_id_t space, _L4_word_t control,
+ _L4_fpage_t kip_area, _L4_fpage_t utcb_area,
+ _L4_thread_id_t redirector, _L4_word_t *old_control)
{
- register l4_word_t space_result asm ("r3") = space.raw;
- register l4_word_t ctrl asm ("r4") = control;
- register l4_word_t kip asm ("r5") = kip_area.raw;
- register l4_word_t utcb asm ("r6") = utcb_area.raw;
- register l4_word_t redir asm ("r7") = redirector.raw;
+ register _L4_word_t space_result asm ("r3") = space;
+ register _L4_word_t ctrl asm ("r4") = control;
+ register _L4_word_t kip asm ("r5") = kip_area;
+ register _L4_word_t utcb asm ("r6") = utcb_area;
+ register _L4_word_t redir asm ("r7") = redirector;
__asm__ __volatile__ ("mtctr %[addr]\n"
"bctrl\n"
@@ -216,25 +218,25 @@ l4_space_control (l4_thread_id_t space, l4_word_t control,
}
-static inline l4_msg_tag_t
-__attribute__((__always_inline__))
-l4_ipc (l4_thread_id_t to, l4_thread_id_t from_spec,
- l4_word_t timeouts, l4_thread_id_t *from)
+static inline _L4_msg_tag_t
+_L4_attribute_always_inline
+_L4_ipc (_L4_thread_id_t to, _L4_thread_id_t from_spec,
+ _L4_word_t timeouts, _L4_thread_id_t *from)
{
- l4_word_t *mr = __l4_utcb () + __L4_UTCB_MR0;
- register l4_word_t mr9 asm ("r0") = mr[9];
- register l4_word_t mr1 asm ("r3") = mr[1];
- register l4_word_t mr2 asm ("r4") = mr[2];
- register l4_word_t mr3 asm ("r5") = mr[3];
- register l4_word_t mr4 asm ("r6") = mr[4];
- register l4_word_t mr5 asm ("r7") = mr[5];
- register l4_word_t mr6 asm ("r8") = mr[6];
- register l4_word_t mr7 asm ("r9") = mr[7];
- register l4_word_t mr8 asm ("r10") = mr[8];
- register l4_word_t mr0 asm ("r14") = mr[0];
- register l4_word_t to_raw asm ("r15") = to.raw;
- register l4_word_t from_spec_raw asm ("r16") = from_spec.raw;
- register l4_word_t time_outs asm ("r17") = timeouts;
+ _L4_word_t *mr = _L4_utcb () + _L4_UTCB_MR0;
+ register _L4_word_t mr9 asm ("r0") = mr[9];
+ register _L4_word_t mr1 asm ("r3") = mr[1];
+ register _L4_word_t mr2 asm ("r4") = mr[2];
+ register _L4_word_t mr3 asm ("r5") = mr[3];
+ register _L4_word_t mr4 asm ("r6") = mr[4];
+ register _L4_word_t mr5 asm ("r7") = mr[5];
+ register _L4_word_t mr6 asm ("r8") = mr[6];
+ register _L4_word_t mr7 asm ("r9") = mr[7];
+ register _L4_word_t mr8 asm ("r10") = mr[8];
+ register _L4_word_t mr0 asm ("r14") = mr[0];
+ register _L4_word_t to_raw asm ("r15") = to;
+ register _L4_word_t from_spec_raw asm ("r16") = from_spec;
+ register _L4_word_t time_outs asm ("r17") = timeouts;
__asm__ __volatile__ ("mtctr %[addr]\n"
"bctrl\n"
@@ -248,7 +250,7 @@ l4_ipc (l4_thread_id_t to, l4_thread_id_t from_spec,
/* FIXME: Make it so that we can use l4_is_nilthread? */
if (from_spec_raw)
{
- from->raw = from_spec_raw;
+ *from = from_spec_raw;
mr[1] = mr1;
mr[2] = mr2;
mr[3] = mr3;
@@ -259,29 +261,29 @@ l4_ipc (l4_thread_id_t to, l4_thread_id_t from_spec,
mr[8] = mr8;
mr[9] = mr9;
}
- return (l4_msg_tag_t) { .raw = mr0 };
+ return mr0;
}
-static inline l4_msg_tag_t
-__attribute__((__always_inline__))
-l4_lipc (l4_thread_id_t to, l4_thread_id_t from_spec,
- l4_word_t timeouts, l4_thread_id_t *from)
+static inline _L4_msg_tag_t
+_L4_attribute_always_inline
+_L4_lipc (_L4_thread_id_t to, _L4_thread_id_t from_spec,
+ _L4_word_t timeouts, _L4_thread_id_t *from)
{
- l4_word_t *mr = __l4_utcb () + __L4_UTCB_MR0;
- register l4_word_t mr9 asm ("r0") = mr[9];
- register l4_word_t mr1 asm ("r3") = mr[1];
- register l4_word_t mr2 asm ("r4") = mr[2];
- register l4_word_t mr3 asm ("r5") = mr[3];
- register l4_word_t mr4 asm ("r6") = mr[4];
- register l4_word_t mr5 asm ("r7") = mr[5];
- register l4_word_t mr6 asm ("r8") = mr[6];
- register l4_word_t mr7 asm ("r9") = mr[7];
- register l4_word_t mr8 asm ("r10") = mr[8];
- register l4_word_t mr0 asm ("r14") = mr[0];
- register l4_word_t to_raw asm ("r15") = to.raw;
- register l4_word_t from_spec_raw asm ("r16") = from_spec.raw;
- register l4_word_t time_outs asm ("r17") = timeouts;
+ _L4_word_t *mr = _L4_utcb () + _L4_UTCB_MR0;
+ register _L4_word_t mr9 asm ("r0") = mr[9];
+ register _L4_word_t mr1 asm ("r3") = mr[1];
+ register _L4_word_t mr2 asm ("r4") = mr[2];
+ register _L4_word_t mr3 asm ("r5") = mr[3];
+ register _L4_word_t mr4 asm ("r6") = mr[4];
+ register _L4_word_t mr5 asm ("r7") = mr[5];
+ register _L4_word_t mr6 asm ("r8") = mr[6];
+ register _L4_word_t mr7 asm ("r9") = mr[7];
+ register _L4_word_t mr8 asm ("r10") = mr[8];
+ register _L4_word_t mr0 asm ("r14") = mr[0];
+ register _L4_word_t to_raw asm ("r15") = to;
+ register _L4_word_t from_spec_raw asm ("r16") = from_spec;
+ register _L4_word_t time_outs asm ("r17") = timeouts;
__asm__ __volatile__ ("mtctr %[addr]\n"
"bctrl\n"
@@ -295,7 +297,7 @@ l4_lipc (l4_thread_id_t to, l4_thread_id_t from_spec,
/* FIXME: Make it so that we can use l4_is_nilthread? */
if (from_spec_raw)
{
- from->raw = from_spec_raw;
+ *from = from_spec_raw;
mr[1] = mr1;
mr[2] = mr2;
mr[3] = mr3;
@@ -306,19 +308,19 @@ l4_lipc (l4_thread_id_t to, l4_thread_id_t from_spec,
mr[8] = mr8;
mr[9] = mr9;
}
- return (l4_msg_tag_t) { .raw = mr0 };
+ return mr0;
}
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_processor_control (l4_word_t proc, l4_word_t int_freq,
- l4_word_t ext_freq, l4_word_t voltage)
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_processor_control (_L4_word_t proc, _L4_word_t int_freq,
+ _L4_word_t ext_freq, _L4_word_t voltage)
{
- register l4_word_t proc_result asm ("r3") = proc;
- register l4_word_t internal_freq asm ("r4") = int_freq;
- register l4_word_t external_freq asm ("r5") = ext_freq;
- register l4_word_t volt asm ("r6") = voltage;
+ register _L4_word_t proc_result asm ("r3") = proc;
+ register _L4_word_t internal_freq asm ("r4") = int_freq;
+ register _L4_word_t external_freq asm ("r5") = ext_freq;
+ register _L4_word_t volt asm ("r6") = voltage;
__asm__ __volatile__ ("mtctr %[addr]\n"
"bctrl\n"
@@ -333,14 +335,14 @@ l4_processor_control (l4_word_t proc, l4_word_t int_freq,
static inline void
-__attribute__((__always_inline__))
-l4_memory_control (l4_word_t control, l4_word_t *attributes)
+_L4_attribute_always_inline
+_L4_memory_control (_L4_word_t control, _L4_word_t *attributes)
{
- register l4_word_t ctrl asm ("r3") = control;
- register l4_word_t attr0 asm ("r4") = attributes[0];
- register l4_word_t attr1 asm ("r5") = attributes[1];
- register l4_word_t attr2 asm ("r6") = attributes[2];
- register l4_word_t attr3 asm ("r7") = attributes[3];
+ register _L4_word_t ctrl asm ("r3") = control;
+ register _L4_word_t attr0 asm ("r4") = attributes[0];
+ register _L4_word_t attr1 asm ("r5") = attributes[1];
+ register _L4_word_t attr2 asm ("r6") = attributes[2];
+ register _L4_word_t attr3 asm ("r7") = attributes[3];
__asm__ __volatile__ ("mtctr %[addr]\n"
"bctrl\n"
diff --git a/libl4/powerpc/l4/bits/types.h b/libl4/powerpc/l4/bits/types.h
index 2371d79..f4317bf 100644
--- a/libl4/powerpc/l4/bits/types.h
+++ b/libl4/powerpc/l4/bits/types.h
@@ -1,5 +1,5 @@
-/* types.h - L4 machine type definitions for powerpc.
- Copyright (C) 2003 Free Software Foundation, Inc.
+/* l4/bits/types.h - L4 machine type definitions for powerpc.
+ Copyright (C) 2003, 2004 Free Software Foundation, Inc.
Written by Marcus Brinkmann <marcus@gnu.org>.
This file is part of the GNU L4 library.
@@ -23,8 +23,9 @@
# error "Never use <l4/bits/types.h> directly; include <l4/types.h> instead."
#endif
+
/* PowerPC has 32 bits per word. */
-#define L4_WORDSIZE L4_WORDSIZE_32
+#define _L4_WORDSIZE _L4_WORDSIZE_32
/* PowerPC is big-endian. */
-#define L4_BYTE_ORDER L4_BIG_ENDIAN
+#define _L4_BYTE_ORDER _L4_BIG_ENDIAN
diff --git a/libl4/powerpc/l4/bits/vregs.h b/libl4/powerpc/l4/bits/vregs.h
index 1b5fe3f..aedd96e 100644
--- a/libl4/powerpc/l4/bits/vregs.h
+++ b/libl4/powerpc/l4/bits/vregs.h
@@ -1,4 +1,4 @@
-/* vregs.h - L4 virtual registers for powerpc.
+/* l4/bits/vregs.h - L4 virtual registers for powerpc.
Copyright (C) 2003 Free Software Foundation, Inc.
Written by Marcus Brinkmann <marcus@gnu.org>.
@@ -25,11 +25,11 @@
/* Retrieve the UTCB address. */
-static inline l4_word_t *
-__attribute__((__always_inline__, __const__))
-__l4_utcb (void)
+static inline _L4_word_t *
+_L4_attribute_always_inline _L4_attribute_const
+_L4_utcb (void)
{
- l4_word_t *utcb;
+ _L4_word_t *utcb;
__asm__ ("mr %[utcb], %%r2"
: [utcb] "=r" (utcb));
@@ -39,298 +39,298 @@ __l4_utcb (void)
/* Offsets of various elements in the UTCB, relativ to the UTCB
address. */
-#define __L4_UTCB_MR0 0
-#define __L4_UTCB_THREAD_WORD0 -4
-#define __L4_UTCB_THREAD_WORD1 -5
-#define __L4_UTCB_SENDER -6
-#define __L4_UTCB_RECEIVER -7
-#define __L4_UTCB_TIMEOUT -8
-#define __L4_UTCB_ERROR_CODE -9
-#define __L4_UTCB_FLAGS -10
-#define __L4_UTCB_EXC_HANDLER -11
-#define __L4_UTCB_PAGER -12
-#define __L4_UTCB_USER_HANDLE -13
-#define __L4_UTCB_PROCESSOR_NO -14
-#define __L4_UTCB_MY_GLOBAL_ID -15
-#define __L4_UTCB_BR0 -16
+#define _L4_UTCB_MR0 0
+#define _L4_UTCB_THREAD_WORD0 -4
+#define _L4_UTCB_THREAD_WORD1 -5
+#define _L4_UTCB_SENDER -6
+#define _L4_UTCB_RECEIVER -7
+#define _L4_UTCB_TIMEOUT -8
+#define _L4_UTCB_ERROR_CODE -9
+#define _L4_UTCB_FLAGS -10
+#define _L4_UTCB_EXC_HANDLER -11
+#define _L4_UTCB_PAGER -12
+#define _L4_UTCB_USER_HANDLE -13
+#define _L4_UTCB_PROCESSOR_NO -14
+#define _L4_UTCB_MY_GLOBAL_ID -15
+#define _L4_UTCB_BR0 -16
/* Get the local thread ID. */
-static inline l4_thread_id_t
-__attribute__((__always_inline__))
-l4_my_local_id (void)
+static inline _L4_thread_id_t
+_L4_attribute_always_inline
+_L4_my_local_id (void)
{
- l4_thread_id_t id;
+ _L4_thread_id_t id;
/* Local thread ID is equal to the UTCB address. */
- id.raw = (l4_word_t) __l4_utcb ();
+ id.raw = (_L4_word_t) _L4_utcb ();
return id;
}
/* Get the global thread ID. */
-static inline l4_thread_id_t
-__attribute__((__always_inline__))
-l4_my_global_id (void)
+static inline _L4_thread_id_t
+_L4_attribute_always_inline
+_L4_my_global_id (void)
{
- l4_thread_id_t id;
- l4_word_t *utcb = __l4_utcb ();
+ _L4_thread_id_t id;
+ _L4_word_t *utcb = _L4_utcb ();
- id.raw = utcb[__L4_UTCB_MY_GLOBAL_ID];
+ id.raw = utcb[_L4_UTCB_MY_GLOBAL_ID];
return id;
}
static inline int
-__attribute__((__always_inline__))
-l4_processor_no (void)
+_L4_attribute_always_inline
+_L4_processor_no (void)
{
- l4_word_t *utcb = __l4_utcb ();
+ _L4_word_t *utcb = _L4_utcb ();
- return utcb[__L4_UTCB_PROCESSOR_NO];
+ return utcb[_L4_UTCB_PROCESSOR_NO];
}
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_user_defined_handle (void)
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_user_defined_handle (void)
{
- l4_word_t *utcb = __l4_utcb ();
+ _L4_word_t *utcb = _L4_utcb ();
- return utcb[__L4_UTCB_USER_HANDLE];
+ return utcb[_L4_UTCB_USER_HANDLE];
}
static inline void
-__attribute__((__always_inline__))
-l4_set_user_defined_handle (l4_word_t data)
+_L4_attribute_always_inline
+_L4_set_user_defined_handle (_L4_word_t data)
{
- l4_word_t *utcb = __l4_utcb ();
+ _L4_word_t *utcb = _L4_utcb ();
- utcb[__L4_UTCB_USER_HANDLE] = data;
+ utcb[_L4_UTCB_USER_HANDLE] = data;
}
-static inline l4_thread_id_t
-__attribute__((__always_inline__))
-l4_pager (void)
+static inline _L4_thread_id_t
+_L4_attribute_always_inline
+_L4_pager (void)
{
- l4_thread_id_t thread;
- l4_word_t *utcb = __l4_utcb ();
+ _L4_thread_id_t thread;
+ _L4_word_t *utcb = _L4_utcb ();
- thread.raw = utcb[__L4_UTCB_PAGER];
+ thread.raw = utcb[_L4_UTCB_PAGER];
return thread;
}
static inline void
-__attribute__((__always_inline__))
-l4_set_pager (l4_thread_id_t thread)
+_L4_attribute_always_inline
+_L4_set_pager (_L4_thread_id_t thread)
{
- l4_word_t *utcb = __l4_utcb ();
+ _L4_word_t *utcb = _L4_utcb ();
- utcb[__L4_UTCB_PAGER] = thread.raw;
+ utcb[_L4_UTCB_PAGER] = thread.raw;
}
-static inline l4_thread_id_t
-__attribute__((__always_inline__))
-l4_exception_handler (void)
+static inline _L4_thread_id_t
+_L4_attribute_always_inline
+_L4_exception_handler (void)
{
- l4_thread_id_t thread;
- l4_word_t *utcb = __l4_utcb ();
+ _L4_thread_id_t thread;
+ _L4_word_t *utcb = _L4_utcb ();
- thread.raw = utcb[__L4_UTCB_EXC_HANDLER];
+ thread.raw = utcb[_L4_UTCB_EXC_HANDLER];
return thread;
}
static inline void
-__attribute__((__always_inline__))
-l4_set_exception_handler (l4_thread_id_t thread)
+_L4_attribute_always_inline
+_L4_set_exception_handler (_L4_thread_id_t thread)
{
- l4_word_t *utcb = __l4_utcb ();
+ _L4_word_t *utcb = _L4_utcb ();
- utcb[__L4_UTCB_EXC_HANDLER] = thread.raw;
+ utcb[_L4_UTCB_EXC_HANDLER] = thread.raw;
}
static inline void
-__attribute__((__always_inline__))
-l4_clr_cop_flag (l4_word_t n)
+_L4_attribute_always_inline
+_L4_clr_cop_flag (_L4_word_t n)
{
- l4_word_t *utcb = __l4_utcb ();
+ _L4_word_t *utcb = _L4_utcb ();
/* The second byte in the flags field contains the coprocessor
flags. */
- utcb[__L4_UTCB_FLAGS] &= ~(1 << (8 + n));
+ utcb[_L4_UTCB_FLAGS] &= ~(1 << (8 + n));
}
static inline void
-__attribute__((__always_inline__))
-l4_set_cop_flag (l4_word_t n)
+_L4_attribute_always_inline
+_L4_set_cop_flag (_L4_word_t n)
{
- l4_word_t *utcb = __l4_utcb ();
+ _L4_word_t *utcb = _L4_utcb ();
/* The second byte in the flags field contains the coprocessor
flags. */
- utcb[__L4_UTCB_FLAGS] |= 1 << (8 + n);
+ utcb[_L4_UTCB_FLAGS] |= 1 << (8 + n);
}
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_disable_preemption_fault_exception (void)
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_disable_preemption_fault_exception (void)
{
- l4_word_t *utcb = __l4_utcb ();
- l4_word_t result;
+ _L4_word_t *utcb = _L4_utcb ();
+ _L4_word_t result;
/* The first byte in the flags field contains the preemption
flags. The sixth bit is the signal bit. */
- result = (utcb[__L4_UTCB_FLAGS] >> 5) & 1;
- utcb[__L4_UTCB_FLAGS] &= ~(1 << 5);
+ result = (utcb[_L4_UTCB_FLAGS] >> 5) & 1;
+ utcb[_L4_UTCB_FLAGS] &= ~(1 << 5);
return result;
}
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_enable_preemption_fault_exception (void)
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_enable_preemption_fault_exception (void)
{
- l4_word_t *utcb = __l4_utcb ();
- l4_word_t result;
+ _L4_word_t *utcb = _L4_utcb ();
+ _L4_word_t result;
/* The first byte in the flags field contains the preemption
flags. The sixth bit is the signal flag. */
- result = (utcb[__L4_UTCB_FLAGS] >> 5) & 1;
- utcb[__L4_UTCB_FLAGS] |= 1 << 5;
+ result = (utcb[_L4_UTCB_FLAGS] >> 5) & 1;
+ utcb[_L4_UTCB_FLAGS] |= 1 << 5;
return result;
}
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_disable_preemption (void)
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_disable_preemption (void)
{
- l4_word_t *utcb = __l4_utcb ();
- l4_word_t result;
+ _L4_word_t *utcb = _L4_utcb ();
+ _L4_word_t result;
/* The first byte in the flags field contains the preemption
flags. The seventh bit is the delay flag. */
- result = (utcb[__L4_UTCB_FLAGS] >> 6) & 1;
- utcb[__L4_UTCB_FLAGS] &= ~(1 << 6);
+ result = (utcb[_L4_UTCB_FLAGS] >> 6) & 1;
+ utcb[_L4_UTCB_FLAGS] &= ~(1 << 6);
return result;
}
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_enable_preemption (void)
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_enable_preemption (void)
{
- l4_word_t *utcb = __l4_utcb ();
- l4_word_t result;
+ _L4_word_t *utcb = _L4_utcb ();
+ _L4_word_t result;
/* The first byte in the flags field contains the preemption
flags. The seventh bit is the delay flag. */
- result = (utcb[__L4_UTCB_FLAGS] >> 6) & 1;
- utcb[__L4_UTCB_FLAGS] |= 1 << 6;
+ result = (utcb[_L4_UTCB_FLAGS] >> 6) & 1;
+ utcb[_L4_UTCB_FLAGS] |= 1 << 6;
return result;
}
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_preemption_pending (void)
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_preemption_pending (void)
{
- l4_word_t *utcb = __l4_utcb ();
- l4_word_t result;
+ _L4_word_t *utcb = _L4_utcb ();
+ _L4_word_t result;
- result = (utcb[__L4_UTCB_FLAGS] >> 7) & 1;
- utcb[__L4_UTCB_FLAGS] &= ~(1 << 7);
+ result = (utcb[_L4_UTCB_FLAGS] >> 7) & 1;
+ utcb[_L4_UTCB_FLAGS] &= ~(1 << 7);
return result;
}
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_error_code (void)
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_error_code (void)
{
- l4_word_t *utcb = __l4_utcb ();
+ _L4_word_t *utcb = _L4_utcb ();
- return utcb[__L4_UTCB_ERROR_CODE];
+ return utcb[_L4_UTCB_ERROR_CODE];
}
-static inline l4_word_t
-__attribute__((__always_inline__))
-l4_xfer_timeout (void)
+static inline _L4_word_t
+_L4_attribute_always_inline
+_L4_xfer_timeout (void)
{
- l4_word_t *utcb = __l4_utcb ();
+ _L4_word_t *utcb = _L4_utcb ();
- return utcb[__L4_UTCB_TIMEOUT];
+ return utcb[_L4_UTCB_TIMEOUT];
}
static inline void
-__attribute__((__always_inline__))
-l4_set_xfer_timeout (l4_word_t time)
+_L4_attribute_always_inline
+_L4_set_xfer_timeout (_L4_word_t time)
{
- l4_word_t *utcb = __l4_utcb ();
+ _L4_word_t *utcb = _L4_utcb ();
- utcb[__L4_UTCB_TIMEOUT] = time;
+ utcb[_L4_UTCB_TIMEOUT] = time;
}
-static inline l4_thread_id_t
-__attribute__((__always_inline__))
-l4_intended_receiver (void)
+static inline _L4_thread_id_t
+_L4_attribute_always_inline
+_L4_intended_receiver (void)
{
- l4_thread_id_t thread;
- l4_word_t *utcb = __l4_utcb ();
+ _L4_thread_id_t thread;
+ _L4_word_t *utcb = _L4_utcb ();
- thread.raw = utcb[__L4_UTCB_RECEIVER];
+ thread.raw = utcb[_L4_UTCB_RECEIVER];
return thread;
}
-static inline l4_thread_id_t
-__attribute__((__always_inline__))
-l4_actual_sender (void)
+static inline _L4_thread_id_t
+_L4_attribute_always_inline
+_L4_actual_sender (void)
{
- l4_thread_id_t thread;
- l4_word_t *utcb = __l4_utcb ();
+ _L4_thread_id_t thread;
+ _L4_word_t *utcb = _L4_utcb ();
- thread.raw = utcb[__L4_UTCB_SENDER];
+ thread.raw = utcb[_L4_UTCB_SENDER];
return thread;
}
static inline void
-__attribute__((__always_inline__))
-l4_set_virtual_sender (l4_thread_id_t thread)
+_L4_attribute_always_inline
+_L4_set_virtual_sender (_L4_thread_id_t thread)
{
- l4_word_t *utcb = __l4_utcb ();
+ _L4_word_t *utcb = _L4_utcb ();
- utcb[__L4_UTCB_SENDER] = thread.raw;
+ utcb[_L4_UTCB_SENDER] = thread.raw;
}
-/* Message registers (MR0 to MR63) start at offset __L4_UTCB_MR0 and
+/* Message registers (MR0 to MR63) start at offset _L4_UTCB_MR0 and
go upward. */
/* Set message register NR to DATA. */
static inline void
-__attribute__((__always_inline__))
-l4_load_mr (int nr, l4_word_t data)
+_L4_attribute_always_inline
+_L4_load_mr (int nr, _L4_word_t data)
{
- l4_word_t *mr = __l4_utcb () + __L4_UTCB_MR0;
+ _L4_word_t *mr = _L4_utcb () + _L4_UTCB_MR0;
mr[nr] = data;
}
@@ -339,10 +339,10 @@ l4_load_mr (int nr, l4_word_t data)
/* Set COUNT message registers beginning from START to the values in
DATA. */
static inline void
-__attribute__((__always_inline__))
-l4_load_mrs (int start, int count, l4_word_t *data)
+_L4_attribute_always_inline
+_L4_load_mrs (int start, int count, _L4_word_t *data)
{
- l4_word_t *mr = __l4_utcb () + __L4_UTCB_MR0 + start;
+ _L4_word_t *mr = _L4_utcb () + _L4_UTCB_MR0 + start;
while (count--)
*(mr++) = *(data++);
@@ -351,10 +351,10 @@ l4_load_mrs (int start, int count, l4_word_t *data)
/* Store message register NR in DATA. */
static inline void
-__attribute__((__always_inline__))
-l4_store_mr (int nr, l4_word_t *data)
+_L4_attribute_always_inline
+_L4_store_mr (int nr, _L4_word_t *data)
{
- l4_word_t *mr = __l4_utcb () + __L4_UTCB_MR0;
+ _L4_word_t *mr = _L4_utcb () + _L4_UTCB_MR0;
*data = mr[nr];
}
@@ -362,25 +362,25 @@ l4_store_mr (int nr, l4_word_t *data)
/* Store COUNT message registers beginning from START in DATA. */
static inline void
-__attribute__((__always_inline__))
-l4_store_mrs (int start, int count, l4_word_t *data)
+_L4_attribute_always_inline
+_L4_store_mrs (int start, int count, _L4_word_t *data)
{
- l4_word_t *mr = __l4_utcb () + __L4_UTCB_MR0 + start;
+ _L4_word_t *mr = _L4_utcb () + _L4_UTCB_MR0 + start;
while (count--)
*(data++) = *(mr++);
}
-/* Buffer registers (BR0 to BR31) start at offset __L4_UTCB_BR0 and go
+/* Buffer registers (BR0 to BR31) start at offset _L4_UTCB_BR0 and go
downward. */
/* Set message register NR to DATA. */
static inline void
-__attribute__((__always_inline__))
-l4_load_br (int nr, l4_word_t data)
+_L4_attribute_always_inline
+_L4_load_br (int nr, _L4_word_t data)
{
- l4_word_t *br = __l4_utcb () + __L4_UTCB_BR0;
+ _L4_word_t *br = _L4_utcb () + _L4_UTCB_BR0;
br[nr] = data;
}
@@ -389,10 +389,10 @@ l4_load_br (int nr, l4_word_t data)
/* Set COUNT message registers beginning from START to the values in
DATA. */
static inline void
-__attribute__((__always_inline__))
-l4_load_brs (int start, int count, l4_word_t *data)
+_L4_attribute_always_inline
+_L4_load_brs (int start, int count, _L4_word_t *data)
{
- l4_word_t *br = __l4_utcb () + __L4_UTCB_BR0 - start;
+ _L4_word_t *br = _L4_utcb () + _L4_UTCB_BR0 - start;
while (count--)
*(br--) = *(data--);
@@ -401,10 +401,10 @@ l4_load_brs (int start, int count, l4_word_t *data)
/* Store message register NR in DATA. */
static inline void
-__attribute__((__always_inline__))
-l4_store_br (int nr, l4_word_t *data)
+_L4_attribute_always_inline
+_L4_store_br (int nr, _L4_word_t *data)
{
- l4_word_t *br = __l4_utcb () + __L4_UTCB_BR0;
+ _L4_word_t *br = _L4_utcb () + _L4_UTCB_BR0;
*data = br[nr];
}
@@ -412,10 +412,10 @@ l4_store_br (int nr, l4_word_t *data)
/* Store COUNT message registers beginning from START in DATA. */
static inline void
-__attribute__((__always_inline__))
-l4_store_brs (int start, int count, l4_word_t *data)
+_L4_attribute_always_inline
+_L4_store_brs (int start, int count, _L4_word_t *data)
{
- l4_word_t *br = __l4_utcb () + __L4_UTCB_BR0 - start;
+ _L4_word_t *br = _L4_utcb () + _L4_UTCB_BR0 - start;
while (count--)
*(data--) = *(br--);