3 * \brief Kernel Info Page access functions.
7 * (c) 2008-2013 Adam Lackorzynski <adam@os.inf.tu-dresden.de>,
8 * Alexander Warg <warg@os.inf.tu-dresden.de>
9 * economic rights: Technische Universität Dresden (Germany)
11 * This file is part of TUD:OS and distributed under the terms of the
12 * GNU General Public License 2.
13 * Please see the COPYING-GPL-2 file for details.
15 * As a special exception, you may use this file as part of a free software
16 * library without restriction. Specifically, if other files instantiate
17 * templates or use macros or inline functions from this file, or you compile
18 * this file and link it with other files to produce an executable, this
19 * file does not by itself cause the resulting executable to be covered by
20 * the GNU General Public License. This exception does not however
21 * invalidate any other reasons why the executable file might be covered by
22 * the GNU General Public License.
26 #include <l4/sys/compiler.h>
27 #include <l4/sys/l4int.h>
29 #include <l4/sys/__kip-arch.h>
34 struct l4_kip_platform_info
38 struct l4_kip_platform_info_arch arch;
41 #if L4_MWORD_BITS == 32
42 # include <l4/sys/__kip-32bit.h>
44 # include <l4/sys/__kip-64bit.h>
48 * \addtogroup l4_kip_api
50 * C interface for the Kernel Interface Page:<br>
51 * <c>\#include <l4/sys/kip.h></c>
58 enum l4_kernel_info_consts_t
60 L4_KIP_VERSION_FIASCO = 0x87004444,
61 L4_KIP_VERSION_FIASCO_MASK = 0xff00ffff,
65 * \brief Kernel Info Page identifier ("L4µK").
67 #define L4_KERNEL_INFO_MAGIC (0x4BE6344CL) /* "L4µK" */
71 * \brief Get the kernel version.
72 * \param kip Kernel Interface Page.
73 * \return Kernel version string. 0 if KIP could not be mapped.
75 L4_INLINE l4_umword_t l4_kip_version(l4_kernel_info_t *kip) L4_NOTHROW;
78 * \brief Get the kernel version string.
79 * \param kip Kernel Interface Page.
80 * \return Kernel version string.
82 L4_INLINE const char *l4_kip_version_string(l4_kernel_info_t *kip) L4_NOTHROW;
85 * \brief Return offset in bytes of version_strings relative to the KIP base.
87 * \param kip Pointer to the kernel into page (KIP).
89 * \return offset of version_strings relative to the KIP base address, in
93 l4_kernel_info_version_offset(l4_kernel_info_t *kip) L4_NOTHROW;
97 /*************************************************************************
99 *************************************************************************/
101 L4_INLINE l4_umword_t
102 l4_kip_version(l4_kernel_info_t *kip) L4_NOTHROW
103 { return kip->version & L4_KIP_VERSION_FIASCO_MASK; }
105 L4_INLINE const char*
106 l4_kip_version_string(l4_kernel_info_t *k) L4_NOTHROW
107 { return (const char *)k + l4_kernel_info_version_offset(k); }
110 l4_kernel_info_version_offset(l4_kernel_info_t *kip) L4_NOTHROW
111 { return kip->offset_version_strings << 4; }