Index: HelenOS.config
===================================================================
--- HelenOS.config	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ HelenOS.config	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -605,4 +605,7 @@
 ! CONFIG_STRIP_BINARIES (n/y)
 
+% Strip revision information (helpful when comparing outputs)
+! CONFIG_STRIP_REVISION_INFO (n/y)
+
 % Optimization level
 @ "3" Level 3 (recommended).
Index: abi/include/_bits/NULL.h
===================================================================
--- abi/include/_bits/NULL.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
+++ abi/include/_bits/NULL.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2017 CZ.NIC, z.s.p.o.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/* Authors:
+ *	Jiří Zárevúcky (jzr) <zarevucky.jiri@gmail.com>
+ */
+
+/** @addtogroup bits
+ * @{
+ */
+/** @file
+ * Definition of constant NULL.
+ *
+ * This definition is designed to work in both C and C++, and use
+ * the special constant `nullptr` in C++11 and above.
+ * Including this file is preferrable to defining the constant separately.
+ */
+
+#ifndef _BITS_NULL_H_
+#define _BITS_NULL_H_
+
+#ifndef NULL
+
+#if __cplusplus >= 201103L
+#define NULL  nullptr
+#elif defined(__cplusplus)
+#define NULL  0L
+#else
+#define NULL  ((void *) 0)
+#endif
+
+#endif
+
+#endif
+
+/** @}
+ */
Index: abi/include/_bits/WCHAR_MAX.h
===================================================================
--- abi/include/_bits/WCHAR_MAX.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
+++ abi/include/_bits/WCHAR_MAX.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2017 CZ.NIC, z.s.p.o.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/* Authors:
+ *	Jiří Zárevúcky (jzr) <zarevucky.jiri@gmail.com>
+ */
+
+/** @addtogroup bits
+ * @{
+ */
+/** @file
+ */
+
+#ifndef _BITS_WCHAR_MAX_H_
+#define _BITS_WCHAR_MAX_H_
+
+#include <_bits/macros.h>
+
+#define WCHAR_MAX  __WCHAR_MAX__
+
+#endif
+
+/** @}
+ */
Index: abi/include/_bits/WCHAR_MIN.h
===================================================================
--- abi/include/_bits/WCHAR_MIN.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
+++ abi/include/_bits/WCHAR_MIN.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2017 CZ.NIC, z.s.p.o.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/* Authors:
+ *	Jiří Zárevúcky (jzr) <zarevucky.jiri@gmail.com>
+ */
+
+/** @addtogroup bits
+ * @{
+ */
+/** @file
+ */
+
+#ifndef _BITS_WCHAR_MIN_H_
+#define _BITS_WCHAR_MIN_H_
+
+#include <_bits/macros.h>
+
+#define WCHAR_MIN  __WCHAR_MIN__
+
+#endif
+
+/** @}
+ */
Index: abi/include/_bits/WEOF.h
===================================================================
--- abi/include/_bits/WEOF.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
+++ abi/include/_bits/WEOF.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2017 CZ.NIC, z.s.p.o.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/* Authors:
+ *	Jiří Zárevúcky (jzr) <zarevucky.jiri@gmail.com>
+ */
+
+/** @addtogroup bits
+ * @{
+ */
+/** @file
+ */
+
+#ifndef _BITS_WEOF_H_
+#define _BITS_WEOF_H_
+
+#include <_bits/macros.h>
+
+#define WEOF  __WINT_EOF__
+
+#endif
+
+/** @}
+ */
Index: abi/include/_bits/all.h
===================================================================
--- abi/include/_bits/all.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
+++ abi/include/_bits/all.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2017 CZ.NIC, z.s.p.o.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/* Authors:
+ *	Jiří Zárevúcky (jzr) <zarevucky.jiri@gmail.com>
+ */
+
+/** @addtogroup bits
+ * @{
+ */
+/** @file
+ */
+
+#ifndef _BITS_ALL_H_
+#define _BITS_ALL_H_
+
+#include <_bits/inttypes.h>
+#include <_bits/limits.h>
+#include <_bits/native.h>
+#include <_bits/ptrdiff_t.h>
+#include <_bits/size_t.h>
+#include <_bits/ssize_t.h>
+#include <_bits/stdint.h>
+#include <_bits/wchar_t.h>
+#include <_bits/wint_t.h>
+
+#endif
+
+/** @}
+ */
Index: abi/include/_bits/inttypes.h
===================================================================
--- abi/include/_bits/inttypes.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
+++ abi/include/_bits/inttypes.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -0,0 +1,258 @@
+/*
+ * Copyright (c) 2017 CZ.NIC, z.s.p.o.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/* Authors:
+ *	Jiří Zárevúcky (jzr) <zarevucky.jiri@gmail.com>
+ */
+
+/** @addtogroup bits
+ * @{
+ */
+/** @file
+ */
+
+#ifndef _BITS_INTTYPES_H_
+#define _BITS_INTTYPES_H_
+
+#include <_bits/macros.h>
+#include <_bits/stdint.h>
+#include <_bits/wchar_t.h>
+
+#define PRId8       __PRId8__
+#define PRIdLEAST8  __PRId8__
+#define PRIdFAST8   __PRId8__
+
+#define PRIi8       __PRIi8__
+#define PRIiLEAST8  __PRIi8__
+#define PRIiFAST8   __PRIi8__
+
+#define PRIo8       __PRIo8__
+#define PRIoLEAST8  __PRIo8__
+#define PRIoFAST8   __PRIo8__
+
+#define PRIu8       __PRIu8__
+#define PRIuLEAST8  __PRIu8__
+#define PRIuFAST8   __PRIu8__
+
+#define PRIx8       __PRIx8__
+#define PRIxLEAST8  __PRIx8__
+#define PRIxFAST8   __PRIx8__
+
+#define PRIX8       __PRIX8__
+#define PRIXLEAST8  __PRIX8__
+#define PRIXFAST8   __PRIX8__
+
+#define SCNd8       __SCNd8__
+#define SCNdLEAST8  __SCNd8__
+#define SCNdFAST8   __SCNd8__
+
+#define SCNi8       __SCNi8__
+#define SCNiLEAST8  __SCNi8__
+#define SCNiFAST8   __SCNi8__
+
+#define SCNo8       __SCNo8__
+#define SCNoLEAST8  __SCNo8__
+#define SCNoFAST8   __SCNo8__
+
+#define SCNu8       __SCNu8__
+#define SCNuLEAST8  __SCNu8__
+#define SCNuFAST8   __SCNu8__
+
+#define SCNx8       __SCNx8__
+#define SCNxLEAST8  __SCNx8__
+#define SCNxFAST8   __SCNx8__
+
+#define PRId16       __PRId16__
+#define PRIdLEAST16  __PRId16__
+#define PRIdFAST16   __PRId16__
+
+#define PRIi16       __PRIi16__
+#define PRIiLEAST16  __PRIi16__
+#define PRIiFAST16   __PRIi16__
+
+#define PRIo16       __PRIo16__
+#define PRIoLEAST16  __PRIo16__
+#define PRIoFAST16   __PRIo16__
+
+#define PRIu16       __PRIu16__
+#define PRIuLEAST16  __PRIu16__
+#define PRIuFAST16   __PRIu16__
+
+#define PRIx16       __PRIx16__
+#define PRIxLEAST16  __PRIx16__
+#define PRIxFAST16   __PRIx16__
+
+#define PRIX16       __PRIX16__
+#define PRIXLEAST16  __PRIX16__
+#define PRIXFAST16   __PRIX16__
+
+#define SCNd16       __SCNd16__
+#define SCNdLEAST16  __SCNd16__
+#define SCNdFAST16   __SCNd16__
+
+#define SCNi16       __SCNi16__
+#define SCNiLEAST16  __SCNi16__
+#define SCNiFAST16   __SCNi16__
+
+#define SCNo16       __SCNo16__
+#define SCNoLEAST16  __SCNo16__
+#define SCNoFAST16   __SCNo16__
+
+#define SCNu16       __SCNu16__
+#define SCNuLEAST16  __SCNu16__
+#define SCNuFAST16   __SCNu16__
+
+#define SCNx16       __SCNx16__
+#define SCNxLEAST16  __SCNx16__
+#define SCNxFAST16   __SCNx16__
+
+#define PRId32       __PRId32__
+#define PRIdLEAST32  __PRId32__
+#define PRIdFAST32   __PRId32__
+
+#define PRIi32       __PRIi32__
+#define PRIiLEAST32  __PRIi32__
+#define PRIiFAST32   __PRIi32__
+
+#define PRIo32       __PRIo32__
+#define PRIoLEAST32  __PRIo32__
+#define PRIoFAST32   __PRIo32__
+
+#define PRIu32       __PRIu32__
+#define PRIuLEAST32  __PRIu32__
+#define PRIuFAST32   __PRIu32__
+
+#define PRIx32       __PRIx32__
+#define PRIxLEAST32  __PRIx32__
+#define PRIxFAST32   __PRIx32__
+
+#define PRIX32       __PRIX32__
+#define PRIXLEAST32  __PRIX32__
+#define PRIXFAST32   __PRIX32__
+
+#define SCNd32       __SCNd32__
+#define SCNdLEAST32  __SCNd32__
+#define SCNdFAST32   __SCNd32__
+
+#define SCNi32       __SCNi32__
+#define SCNiLEAST32  __SCNi32__
+#define SCNiFAST32   __SCNi32__
+
+#define SCNo32       __SCNo32__
+#define SCNoLEAST32  __SCNo32__
+#define SCNoFAST32   __SCNo32__
+
+#define SCNu32       __SCNu32__
+#define SCNuLEAST32  __SCNu32__
+#define SCNuFAST32   __SCNu32__
+
+#define SCNx32       __SCNx32__
+#define SCNxLEAST32  __SCNx32__
+#define SCNxFAST32   __SCNx32__
+
+#define PRId64       __PRId64__
+#define PRIdLEAST64  __PRId64__
+#define PRIdFAST64   __PRId64__
+
+#define PRIi64       __PRIi64__
+#define PRIiLEAST64  __PRIi64__
+#define PRIiFAST64   __PRIi64__
+
+#define PRIo64       __PRIo64__
+#define PRIoLEAST64  __PRIo64__
+#define PRIoFAST64   __PRIo64__
+
+#define PRIu64       __PRIu64__
+#define PRIuLEAST64  __PRIu64__
+#define PRIuFAST64   __PRIu64__
+
+#define PRIx64       __PRIx64__
+#define PRIxLEAST64  __PRIx64__
+#define PRIxFAST64   __PRIx64__
+
+#define PRIX64       __PRIX64__
+#define PRIXLEAST64  __PRIX64__
+#define PRIXFAST64   __PRIX64__
+
+#define SCNd64       __SCNd64__
+#define SCNdLEAST64  __SCNd64__
+#define SCNdFAST64   __SCNd64__
+
+#define SCNi64       __SCNi64__
+#define SCNiLEAST64  __SCNi64__
+#define SCNiFAST64   __SCNi64__
+
+#define SCNo64       __SCNo64__
+#define SCNoLEAST64  __SCNo64__
+#define SCNoFAST64   __SCNo64__
+
+#define SCNu64       __SCNu64__
+#define SCNuLEAST64  __SCNu64__
+#define SCNuFAST64   __SCNu64__
+
+#define SCNx64       __SCNx64__
+#define SCNxLEAST64  __SCNx64__
+#define SCNxFAST64   __SCNx64__
+
+#define PRIdPTR  __PRIdPTR__
+#define PRIiPTR  __PRIiPTR__
+#define PRIoPTR  __PRIoPTR__
+#define PRIuPTR  __PRIuPTR__
+#define PRIxPTR  __PRIxPTR__
+#define PRIXPTR  __PRIXPTR__
+#define SCNdPTR  __SCNdPTR__
+#define SCNiPTR  __SCNiPTR__
+#define SCNoPTR  __SCNoPTR__
+#define SCNuPTR  __SCNuPTR__
+#define SCNxPTR  __SCNxPTR__
+
+#ifndef __HELENOS_DISABLE_INTMAX__
+
+#define PRIdMAX  __PRIdMAX__
+#define PRIiMAX  __PRIiMAX__
+#define PRIoMAX  __PRIoMAX__
+#define PRIuMAX  __PRIuMAX__
+#define PRIxMAX  __PRIxMAX__
+#define PRIXMAX  __PRIXMAX__
+#define SCNdMAX  __SCNdMAX__
+#define SCNiMAX  __SCNiMAX__
+#define SCNoMAX  __SCNoMAX__
+#define SCNuMAX  __SCNuMAX__
+#define SCNxMAX  __SCNxMAX__
+
+typedef struct {
+	intmax_t quot;
+	intmax_t rem;
+} imaxdiv_t;
+
+#endif  /* __HELENOS_DISABLE_INTMAX__ */
+
+#endif
+
+/** @}
+ */
Index: abi/include/_bits/limits.h
===================================================================
--- abi/include/_bits/limits.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
+++ abi/include/_bits/limits.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2017 CZ.NIC, z.s.p.o.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/* Authors:
+ *	Jiří Zárevúcky (jzr) <zarevucky.jiri@gmail.com>
+ */
+
+/** @addtogroup bits
+ * @{
+ */
+/** @file
+ */
+
+#ifndef _BITS_LIMITS_H_
+#define _BITS_LIMITS_H_
+
+#include <_bits/macros.h>
+
+/* _MIN macros for unsigned types are non-standard (and of course, always 0),
+ * but we already have them for some reason, so whatever.
+ */
+
+#define CHAR_BIT  __CHAR_BIT__
+
+#define SCHAR_MIN  __SCHAR_MIN__
+#define SCHAR_MAX  __SCHAR_MAX__
+
+#define UCHAR_MIN  0
+#define UCHAR_MAX  __UCHAR_MAX__
+
+#define CHAR_MIN  __CHAR_MIN__
+#define CHAR_MAX  __CHAR_MAX__
+
+#define MB_LEN_MAX  16
+
+#define SHRT_MIN  __SHRT_MIN__
+#define SHRT_MAX  __SHRT_MAX__
+
+#define USHRT_MIN  0
+#define USHRT_MAX  __USHRT_MAX__
+
+#define INT_MIN  __INT_MIN__
+#define INT_MAX  __INT_MAX__
+
+#define UINT_MIN  0U
+#define UINT_MAX  __UINT_MAX__
+
+#define LONG_MIN  __LONG_MIN__
+#define LONG_MAX  __LONG_MAX__
+
+#define ULONG_MIN  0UL
+#define ULONG_MAX  __ULONG_MAX__
+
+#define LLONG_MIN  __LLONG_MIN__
+#define LLONG_MAX  __LLONG_MAX__
+
+#define ULLONG_MIN  0ULL
+#define ULLONG_MAX  __ULLONG_MAX__
+
+#endif
+
+/** @}
+ */
Index: abi/include/_bits/macros.h
===================================================================
--- abi/include/_bits/macros.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
+++ abi/include/_bits/macros.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -0,0 +1,661 @@
+/*
+ * Copyright (c) 2017 CZ.NIC, z.s.p.o.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/* Authors:
+ *	Jiří Zárevúcky (jzr) <zarevucky.jiri@gmail.com>
+ */
+
+/** @addtogroup bits
+ * @{
+ */
+/** @file
+ * Basic macro definitions and redefinitions that support basic C types.
+ *
+ * Both GCC and clang define macros for fixed-size integer names
+ * (e.g. __INT32_TYPE__ for int32_t). However, while clang also provides
+ * definitions for formatting macros (PRId32 et al.), GCC does not.
+ * This poses a subtle problem for diagnostics -- when 'int' and 'long int'
+ * have the same width, it's not possible to detect which one is used to
+ * define 'int32_t', but using a formatting specifier for 'int' on 'long int'
+ * value, or vice versa, causes a compiler warning. Analogous problem occurs
+ * with 'long int' and 'long long int', if they are the same size.
+ *
+ * In the interest of compatibility, we ignore the compiler's opinion on
+ * fixed-size types, and redefine the macros consistently.
+ *
+ * However, we can't do the same for 'size_t', 'ptrdiff_t', 'wchar_t', 'wint_t',
+ * 'intmax_t' and 'uintmax_t', since their format specifiers and other
+ * properties are built into the language and their identity is therefore
+ * determined by the compiler.
+ *
+ * We use some macros if they are present, but provide our own fallbacks when
+ * they are not. There are several macros that have to be predefined either by
+ * the compiler itself, or supplied by the build system if necessary
+ * (e.g. using the '-imacros' compiler argument). This is basically a subset
+ * of the common denominator of GCC and clang predefined macros at this moment.
+ *
+ * These required macros include:
+ *
+ *	__CHAR_BIT__
+ *	__SIZEOF_SHORT__
+ *	__SIZEOF_INT__
+ *	__SIZEOF_LONG__
+ *	__SIZEOF_LONG_LONG__
+ *	__SIZEOF_POINTER__
+ *	__SIZEOF_FLOAT__
+ *	__SIZEOF_DOUBLE__
+ *	__SIZEOF_LONG_DOUBLE__
+ *
+ *	__SIZE_TYPE__
+ *	__SIZE_MAX__
+ *
+ *	__PTRDIFF_TYPE__
+ *	__PTRDIFF_MAX__
+ *
+ *	__WCHAR_TYPE__
+ *	__WCHAR_MAX__
+ *
+ *	__WINT_TYPE__
+ *	__WINT_MAX__ or
+ *	__WINT_WIDTH__ and __WINT_UNSIGNED__ when wint_t is unsigned
+ *
+ *	__INTMAX_TYPE__
+ *	__INTMAX_MAX__
+ *	either __INTMAX_C_SUFFIX__ or __INTMAX_C
+ *
+ *	__CHAR_UNSIGNED__ when char is unsigned
+ *
+ * After this header is processed, the following additional macros are
+ * guaranteed to be defined, or the build will fail:
+ *
+ * 	for {type} being one of CHAR, SHRT, INT, LONG, LLONG
+ * 	__{type}_MIN__
+ * 	__{type}_MAX__
+ * 	__U{type}_MAX__
+ *
+ * 	__SCHAR_MIN__
+ * 	__SCHAR_MAX__
+ *
+ * 	for {size} being one of 8, 16, 32, 64, PTR, MAX
+ * 	__INT{size}_TYPE__
+ * 	__INT{size}_MIN__
+ * 	__INT{size}_MAX__
+ * 	__UINT{size}_TYPE__
+ * 	__UINT{size}_MAX__
+ * 	for {tag} being one of d, i, u, o, x, X
+ * 	__PRI{tag}{size}__
+ * 	for {tag} being one of d, i, u, o, x
+ * 	__SCN{tag}{size}__
+ * 	__INT{size}_C
+ * 	__UINT{size}_C
+ * 	(except for __INTPTR_C/__UINTPTR_C, which aren't provided)
+ *
+ * 	__PTRDIFF_MIN__
+ * 	__WCHAR_MIN__
+ * 	__WINT_MIN__
+ * 	__WINT_MAX__
+ * 	__WINT_EOF__
+ * 	__WCHAR_SIGNED__ or __WCHAR_UNSIGNED__
+ * 	__WINT_SIGNED__ or __WINT_UNSIGNED__
+ *
+ */
+
+// TODO: add sig_atomic_t for compatibility with C language standard
+
+#ifndef _BITS_MACROS_H_
+#define _BITS_MACROS_H_
+
+#if __CHAR_BIT__ != 8
+#error HelenOS expects char that is 8 bits wide.
+#endif
+
+#ifndef __SCHAR_MAX__
+#define __SCHAR_MAX__  0x7f
+#endif
+
+#ifndef __SCHAR_MIN__
+#define __SCHAR_MIN__  (-__SCHAR_MAX__ - 1)
+#endif
+
+#ifndef __UCHAR_MAX__
+#define __UCHAR_MAX__  0xff
+#endif
+
+#ifndef __CHAR_MIN__
+#ifdef __CHAR_UNSIGNED__
+#define __CHAR_MIN__  0
+#else
+#define __CHAR_MIN__  __SCHAR_MIN__
+#endif
+#endif
+
+#ifndef __CHAR_MAX__
+#ifdef __CHAR_UNSIGNED__
+#define __CHAR_MAX__  __UCHAR_MAX__
+#else
+#define __CHAR_MAX__  __SCHAR_MAX__
+#endif
+#endif
+
+#undef __INT8_TYPE__
+#undef __INT8_C
+#undef __INT8_C_SUFFIX__
+#undef __INT8_MIN__
+#undef __INT8_MAX__
+
+#define __INT8_TYPE__  signed char
+#define __INT8_C(x)    x
+#define __INT8_MIN__   __SCHAR_MIN__
+#define __INT8_MAX__   __SCHAR_MAX__
+
+#undef __UINT8_TYPE__
+#undef __UINT8_C
+#undef __UINT8_C_SUFFIX__
+#undef __UINT8_MIN__
+#undef __UINT8_MAX__
+
+#define __UINT8_TYPE__  unsigned char
+#define __UINT8_C(x)    x
+#define __UINT8_MAX__   __UCHAR_MAX__
+
+#undef __PRId8__
+#undef __PRIi8__
+#undef __PRIu8__
+#undef __PRIo8__
+#undef __PRIx8__
+#undef __PRIX8__
+
+#define __PRId8__  "hhd"
+#define __PRIi8__  "hhi"
+#define __PRIu8__  "hhu"
+#define __PRIo8__  "hho"
+#define __PRIx8__  "hhx"
+#define __PRIX8__  "hhX"
+
+#undef __SCNd8__
+#undef __SCNi8__
+#undef __SCNu8__
+#undef __SCNo8__
+#undef __SCNx8__
+
+#define __SCNd8__  "hhd"
+#define __SCNi8__  "hhi"
+#define __SCNu8__  "hhu"
+#define __SCNo8__  "hho"
+#define __SCNx8__  "hhx"
+
+#if __SIZEOF_SHORT__ != 2
+#error HelenOS expects short that is 16 bits wide.
+#endif
+
+#ifndef __SHRT_MAX__
+#define __SHRT_MAX__  0x7fff
+#endif
+
+#ifndef __SHRT_MIN__
+#define __SHRT_MIN__  (-__SHRT_MAX__ - 1)
+#endif
+
+#ifndef __USHRT_MAX__
+#define __USHRT_MAX__  0xffff
+#endif
+
+#undef __INT16_TYPE__
+#undef __INT16_C
+#undef __INT16_C_SUFFIX__
+#undef __INT16_MIN__
+#undef __INT16_MAX__
+
+#define __INT16_TYPE__  short
+#define __INT16_C(x)    x
+#define __INT16_MIN__   __SHRT_MIN__
+#define __INT16_MAX__   __SHRT_MAX__
+
+#undef __UINT16_TYPE__
+#undef __UINT16_C
+#undef __UINT16_C_SUFFIX__
+#undef __UINT16_MIN__
+#undef __UINT16_MAX__
+
+#define __UINT16_TYPE__  unsigned short
+#define __UINT16_C(x)    x
+#define __UINT16_MAX__   __USHRT_MAX__
+
+#undef __PRId16__
+#undef __PRIi16__
+#undef __PRIu16__
+#undef __PRIo16__
+#undef __PRIx16__
+#undef __PRIX16__
+
+#define __PRId16__  "hd"
+#define __PRIi16__  "hi"
+#define __PRIu16__  "hu"
+#define __PRIo16__  "ho"
+#define __PRIx16__  "hx"
+#define __PRIX16__  "hX"
+
+#undef __SCNd16__
+#undef __SCNi16__
+#undef __SCNu16__
+#undef __SCNo16__
+#undef __SCNx16__
+
+#define __SCNd16__  "hd"
+#define __SCNi16__  "hi"
+#define __SCNu16__  "hu"
+#define __SCNo16__  "ho"
+#define __SCNx16__  "hx"
+
+#if __SIZEOF_INT__ != 4
+#error HelenOS expects int that is 32 bits wide.
+#endif
+
+#ifndef __INT_MAX__
+#define __INT_MAX__  0x7fffffff
+#endif
+
+#ifndef __INT_MIN__
+#define __INT_MIN__  (-__INT_MAX__ - 1)
+#endif
+
+#ifndef __UINT_MAX__
+#define __UINT_MAX__  0xffffffffU
+#endif
+
+#undef __INT32_TYPE__
+#undef __INT32_C
+#undef __INT32_C_SUFFIX__
+#undef __INT32_MIN__
+#undef __INT32_MAX__
+
+#define __INT32_TYPE__  int
+#define __INT32_C(x)    x
+#define __INT32_MIN__   __INT_MIN__
+#define __INT32_MAX__   __INT_MAX__
+
+#undef __UINT32_TYPE__
+#undef __UINT32_C
+#undef __UINT32_C_SUFFIX__
+#undef __UINT32_MIN__
+#undef __UINT32_MAX__
+
+#define __UINT32_TYPE__  unsigned int
+#define __UINT32_C(x)    x##U
+#define __UINT32_MAX__   __UINT_MAX__
+
+#undef __PRId32__
+#undef __PRIi32__
+#undef __PRIu32__
+#undef __PRIo32__
+#undef __PRIx32__
+#undef __PRIX32__
+
+#define __PRId32__  "d"
+#define __PRIi32__  "i"
+#define __PRIu32__  "u"
+#define __PRIo32__  "o"
+#define __PRIx32__  "x"
+#define __PRIX32__  "X"
+
+#undef __SCNd32__
+#undef __SCNi32__
+#undef __SCNu32__
+#undef __SCNo32__
+#undef __SCNx32__
+
+#define __SCNd32__  "d"
+#define __SCNi32__  "i"
+#define __SCNu32__  "u"
+#define __SCNo32__  "o"
+#define __SCNx32__  "x"
+
+#if __SIZEOF_LONG__ != __SIZEOF_POINTER__
+#error HelenOS expects long that has native width for the architecture.
+#endif
+
+#if __SIZEOF_POINTER__ < 4 || __SIZEOF_POINTER__ > 8
+#error HelenOS expects pointer width to be either 32 bits or 64 bits.
+#endif
+
+#ifndef __LONG_MAX__
+#if __SIZEOF_LONG__ == 4
+#define __LONG_MAX__  0x7fffffffL
+#elif __SIZEOF_LONG__ == 8
+#define __LONG_MAX__  0x7fffffffffffffffL
+#endif
+#endif
+
+#ifndef __LONG_MIN__
+#define __LONG_MIN__  (-__LONG_MAX__ - 1)
+#endif
+
+#ifndef __ULONG_MAX__
+#if __SIZEOF_LONG__ == 4
+#define __ULONG_MAX__  0xffffffffUL
+#elif __SIZEOF_LONG__ == 8
+#define __ULONG_MAX__  0xffffffffffffffffUL
+#endif
+#endif
+
+#undef __INTPTR_TYPE__
+#undef __INTPTR_C
+#undef __INTPTR_C_SUFFIX__
+#undef __INTPTR_MIN__
+#undef __INTPTR_MAX__
+#undef __UINTPTR_TYPE__
+#undef __UINTPTR_C
+#undef __UINTPTR_C_SUFFIX__
+#undef __UINTPTR_MIN__
+#undef __UINTPTR_MAX__
+#undef __PRIdPTR__
+#undef __PRIiPTR__
+#undef __PRIuPTR__
+#undef __PRIoPTR__
+#undef __PRIxPTR__
+#undef __PRIXPTR__
+#undef __SCNdPTR__
+#undef __SCNiPTR__
+#undef __SCNuPTR__
+#undef __SCNoPTR__
+#undef __SCNxPTR__
+
+#ifdef __intptr_is_long__
+
+#define __INTPTR_TYPE__   long
+#define __INTPTR_MIN__    __LONG_MIN__
+#define __INTPTR_MAX__    __LONG_MAX__
+#define __UINTPTR_TYPE__  unsigned long
+#define __UINTPTR_MAX__   __ULONG_MAX__
+
+#define __PRIdPTR__  "ld"
+#define __PRIiPTR__  "li"
+#define __PRIuPTR__  "lu"
+#define __PRIoPTR__  "lo"
+#define __PRIxPTR__  "lx"
+#define __PRIXPTR__  "lX"
+
+#define __SCNdPTR__  "ld"
+#define __SCNiPTR__  "li"
+#define __SCNuPTR__  "lu"
+#define __SCNoPTR__  "lo"
+#define __SCNxPTR__  "lx"
+
+#else
+
+// Original definition results in size_t and uintptr_t always having the same
+// type. We keep this definition for the time being, to avoid unnecessary noise.
+
+#define __INTPTR_TYPE__   __PTRDIFF_TYPE__
+#define __INTPTR_MIN__    __PTRDIFF_MIN__
+#define __INTPTR_MAX__    __PTRDIFF_MAX__
+#define __UINTPTR_TYPE__  __SIZE_TYPE__
+#define __UINTPTR_MAX__   __SIZE_MAX__
+
+#define __PRIdPTR__  "zd"
+#define __PRIiPTR__  "zi"
+#define __PRIuPTR__  "zu"
+#define __PRIoPTR__  "zo"
+#define __PRIxPTR__  "zx"
+#define __PRIXPTR__  "zX"
+
+#define __SCNdPTR__  "zd"
+#define __SCNiPTR__  "zi"
+#define __SCNuPTR__  "zu"
+#define __SCNoPTR__  "zo"
+#define __SCNxPTR__  "zx"
+
+#endif
+
+#if __SIZEOF_LONG_LONG__ != 8
+#error HelenOS expects long long that is 64 bits wide.
+#endif
+
+#ifndef __LLONG_MAX__
+#define __LLONG_MAX__  0x7fffffffffffffffLL
+#endif
+
+#ifndef __LLONG_MIN__
+#define __LLONG_MIN__  (-__LLONG_MAX__ - 1)
+#endif
+
+#ifndef __ULLONG_MAX__
+#define __ULLONG_MAX__  0xffffffffffffffffULL
+#endif
+
+#undef __INT64_TYPE__
+#undef __INT64_C
+#undef __INT64_C_SUFFIX__
+#undef __INT64_MIN__
+#undef __INT64_MAX__
+
+#define __INT64_TYPE__  long long
+#define __INT64_C(x)    x##LL
+#define __INT64_MIN__   __LLONG_MIN__
+#define __INT64_MAX__   __LLONG_MAX__
+
+#undef __UINT64_TYPE__
+#undef __UINT64_C
+#undef __UINT64_C_SUFFIX__
+#undef __UINT64_MIN__
+#undef __UINT64_MAX__
+
+#define __UINT64_TYPE__  unsigned long long
+#define __UINT64_C(x)    x##ULL
+#define __UINT64_MAX__   __ULLONG_MAX__
+
+#undef __PRId64__
+#undef __PRIi64__
+#undef __PRIu64__
+#undef __PRIo64__
+#undef __PRIx64__
+#undef __PRIX64__
+
+#define __PRId64__  "lld"
+#define __PRIi64__  "lli"
+#define __PRIu64__  "llu"
+#define __PRIo64__  "llo"
+#define __PRIx64__  "llx"
+#define __PRIX64__  "llX"
+
+#undef __SCNd64__
+#undef __SCNi64__
+#undef __SCNu64__
+#undef __SCNo64__
+#undef __SCNx64__
+
+#define __SCNd64__  "lld"
+#define __SCNi64__  "lli"
+#define __SCNu64__  "llu"
+#define __SCNo64__  "llo"
+#define __SCNx64__  "llx"
+
+#if !defined(__SIZE_TYPE__) || !defined(__SIZE_MAX__)
+#error HelenOS expects __SIZE_TYPE__ and __SIZE_MAX__ \
+    to be defined by the toolchain.
+#endif
+
+#if !defined(__PTRDIFF_TYPE__) || !defined(__PTRDIFF_MAX__)
+#error HelenOS expects __PTRDIFF_TYPE__ and __PTRDIFF_MAX__ \
+    to be defined by the toolchain.
+#endif
+
+#ifndef __PTRDIFF_MIN__
+#define __PTRDIFF_MIN__  (-__PTRDIFF_MAX__ - 1)
+#endif
+
+#if !defined(__WCHAR_TYPE__) || !defined(__WCHAR_MAX__)
+#error HelenOS expects __WCHAR_TYPE__ and __WCHAR_MAX__ \
+    to be defined by the toolchain.
+#endif
+
+#undef __WCHAR_SIGNED__
+#undef __WCHAR_UNSIGNED__
+
+#if __WCHAR_MAX__ == __INT32_MAX__
+#define __WCHAR_SIGNED__  1
+#elif __WCHAR_MAX__ == __UINT32_MAX__
+#define __WCHAR_UNSIGNED__  1
+#else
+#error HelenOS expects __WCHAR_TYPE__ to be 32 bits wide.
+#endif
+
+#ifndef __WCHAR_MIN__
+#ifdef __WCHAR_UNSIGNED__
+#define __WCHAR_MIN__  0
+#else
+#define __WCHAR_MIN__  (-__WCHAR_MAX__ - 1)
+#endif
+#endif
+
+#if !defined(__WINT_TYPE__) || !defined(__WINT_WIDTH__)
+#error HelenOS expects __WINT_TYPE__ and __WINT_WIDTH__ \
+    to be defined by the toolchain.
+#endif
+
+#if __WINT_WIDTH__ != 32
+#error HelenOS expects __WINT_TYPE__ to be 32 bits wide.
+#endif
+
+#undef __WINT_SIGNED__
+#undef __WINT_UNSIGNED__
+
+#if __WINT_MAX__ == __INT32_MAX__
+#define __WINT_SIGNED__  1
+#elif __WINT_MAX__ == __UINT32_MAX__
+#define __WINT_UNSIGNED__  1
+#elif defined(__WINT_MAX__)
+#error Unrecognized value of __WINT_MAX__
+#endif
+
+#ifndef __WINT_MAX__
+#ifdef __WINT_UNSIGNED__
+#define __WINT_MAX__  0xffffffffU
+#else
+#define __WINT_MAX__  0x7fffffff
+#endif
+#endif
+
+#ifndef __WINT_MIN__
+#ifdef __WINT_UNSIGNED__
+#define __WINT_MIN__  0
+#else
+#define __WINT_MIN__  (-__WINT_MAX__ - 1)
+#endif
+#endif
+
+#ifndef __WINT_EOF__
+#ifdef __WINT_UNSIGNED__
+#define __WINT_EOF__  __WINT_MAX__
+#else
+#define __WINT_EOF__  -1
+#endif
+#endif
+
+#ifndef __HELENOS_DISABLE_INTMAX__
+
+#if !defined(__INTMAX_TYPE__) || !defined(__INTMAX_MAX__)
+#error HelenOS expects __INTMAX_TYPE__ and __INTMAX_MAX__ \
+    to be defined by the toolchain.
+#endif
+
+#ifndef __INTMAX_MIN__
+#define __INTMAX_MIN__  (-__INTMAX_MAX__ - 1)
+#endif
+
+#ifndef __INTMAX_C
+#ifndef __INTMAX_C_SUFFIX__
+#error HelenOS expects __INTMAX_C or __INTMAX_C_SUFFIX__ \
+    to be defined by the toolchain.
+#endif
+#define __INTMAX_C__(x, y)  x##y
+#define __INTMAX_C(x)       __INTMAX_C__(x, __INTMAX_C_SUFFIX__)
+#endif
+
+#ifndef __UINTMAX_TYPE__
+#define __UINTMAX_TYPE__  unsigned __INTMAX_TYPE__
+#endif
+
+#ifndef __UINTMAX_C
+#ifdef __UINTMAX_C_SUFFIX__
+#define __UINTMAX_C__(x, y)  x##y
+#define __UINTMAX_C(x)       __UINTMAX_C__(x, __UINTMAX_C_SUFFIX__)
+#else
+#define __UINTMAX_C(x)  __INTMAX_C(x##U)
+#endif
+#endif
+
+#ifndef __UINTMAX_MAX__
+#define ___UNSIGNED_INTMAX_MAX___(x)  x##U
+#define __UINTMAX_MAX__  (2 * ___UNSIGNED_INTMAX_MAX___(__INTMAX_MAX__) + 1)
+#endif
+
+#undef __PRIdMAX__
+#undef __PRIiMAX__
+#undef __PRIuMAX__
+#undef __PRIoMAX__
+#undef __PRIxMAX__
+#undef __PRIXMAX__
+
+#define __PRIdMAX__  "jd"
+#define __PRIiMAX__  "ji"
+#define __PRIuMAX__  "ju"
+#define __PRIoMAX__  "jo"
+#define __PRIxMAX__  "jx"
+#define __PRIXMAX__  "jX"
+
+#undef __SCNdMAX__
+#undef __SCNiMAX__
+#undef __SCNuMAX__
+#undef __SCNoMAX__
+#undef __SCNxMAX__
+
+#define __SCNdMAX__  "jd"
+#define __SCNiMAX__  "ji"
+#define __SCNuMAX__  "ju"
+#define __SCNoMAX__  "jo"
+#define __SCNxMAX__  "jx"
+
+#endif  /* __HELENOS_DISABLE_INTMAX__ */
+
+#ifndef __SIZEOF_FLOAT__
+#error HelenOS expects __SIZEOF_FLOAT__ to be defined.
+#endif
+
+#ifndef __SIZEOF_DOUBLE__
+#error HelenOS expects __SIZEOF_DOUBLE__ to be defined.
+#endif
+
+#ifndef __SIZEOF_LONG_DOUBLE__
+#error HelenOS expects __SIZEOF_LONG_DOUBLE__ to be defined.
+#endif
+
+#endif
+
+/** @}
+ */
Index: abi/include/_bits/native.h
===================================================================
--- abi/include/_bits/native.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
+++ abi/include/_bits/native.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2017 CZ.NIC, z.s.p.o.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/* Authors:
+ *	Jiří Zárevúcky (jzr) <zarevucky.jiri@gmail.com>
+ */
+
+/** @addtogroup bits
+ * @{
+ */
+/** @file
+ * A bunch of type aliases HelenOS code uses.
+ *
+ * They were originally defined as either u/int32_t or u/int64_t,
+ * specifically for each architecture, but in practice they are
+ * currently assumed to be identical to u/intptr_t, so we do just that.
+ */
+
+#ifndef _BITS_NATIVE_H_
+#define _BITS_NATIVE_H_
+
+#include <_bits/macros.h>
+
+#define ATOMIC_COUNT_MIN  __UINTPTR_MIN__
+#define ATOMIC_COUNT_MAX  __UINTPTR_MAX__
+
+typedef __UINTPTR_TYPE__ pfn_t;
+typedef __UINTPTR_TYPE__ ipl_t;
+typedef __UINTPTR_TYPE__ sysarg_t;
+typedef __INTPTR_TYPE__  native_t;
+typedef __UINTPTR_TYPE__ atomic_count_t;
+typedef __INTPTR_TYPE__  atomic_signed_t;
+
+#define PRIdn  __PRIdPTR__  /**< Format for native_t. */
+#define PRIun  __PRIuPTR__  /**< Format for sysarg_t. */
+#define PRIxn  __PRIxPTR__  /**< Format for hexadecimal sysarg_t. */
+#define PRIua  __PRIuPTR__  /**< Format for atomic_count_t. */
+
+#endif
+
+/** @}
+ */
Index: abi/include/_bits/ptrdiff_t.h
===================================================================
--- abi/include/_bits/ptrdiff_t.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
+++ abi/include/_bits/ptrdiff_t.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2017 CZ.NIC, z.s.p.o.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/* Authors:
+ *	Jiří Zárevúcky (jzr) <zarevucky.jiri@gmail.com>
+ */
+
+/** @addtogroup bits
+ * @{
+ */
+/** @file
+ */
+
+#ifndef _BITS_PTRDIFF_T_H_
+#define _BITS_PTRDIFF_T_H_
+
+#include <_bits/macros.h>
+
+typedef __PTRDIFF_TYPE__ ptrdiff_t;
+
+#endif
+
+/** @}
+ */
Index: abi/include/_bits/size_t.h
===================================================================
--- abi/include/_bits/size_t.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
+++ abi/include/_bits/size_t.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2017 CZ.NIC, z.s.p.o.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/* Authors:
+ *	Jiří Zárevúcky (jzr) <zarevucky.jiri@gmail.com>
+ */
+
+/** @addtogroup bits
+ * @{
+ */
+/** @file
+ */
+
+#ifndef _BITS_SIZE_T_H_
+#define _BITS_SIZE_T_H_
+
+#include <_bits/macros.h>
+
+typedef __SIZE_TYPE__ size_t;
+
+#endif
+
+/** @}
+ */
Index: abi/include/_bits/ssize_t.h
===================================================================
--- abi/include/_bits/ssize_t.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
+++ abi/include/_bits/ssize_t.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2017 CZ.NIC, z.s.p.o.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/* Authors:
+ *	Jiří Zárevúcky (jzr) <zarevucky.jiri@gmail.com>
+ */
+
+/** @addtogroup bits
+ * @{
+ */
+/** @file
+ */
+
+#ifndef _BITS_SSIZE_T_H_
+#define _BITS_SSIZE_T_H_
+
+#include <_bits/macros.h>
+
+typedef __PTRDIFF_TYPE__ ssize_t;
+
+#define SSIZE_MIN  __PTRDIFF_MIN__
+#define SSIZE_MAX  __PTRDIFF_MAX__
+
+#endif
+
+/** @}
+ */
Index: abi/include/_bits/stdint.h
===================================================================
--- abi/include/_bits/stdint.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
+++ abi/include/_bits/stdint.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -0,0 +1,194 @@
+/*
+ * Copyright (c) 2017 CZ.NIC, z.s.p.o.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/* Authors:
+ *	Jiří Zárevúcky (jzr) <zarevucky.jiri@gmail.com>
+ */
+
+/** @addtogroup bits
+ * @{
+ */
+/** @file
+ */
+
+#ifndef _BITS_STDINT_H_
+#define _BITS_STDINT_H_
+
+#include <_bits/macros.h>
+
+typedef __INT8_TYPE__ int8_t;
+typedef __INT8_TYPE__ int_least8_t;
+typedef __INT8_TYPE__ int_fast8_t;
+
+typedef __UINT8_TYPE__ uint8_t;
+typedef __UINT8_TYPE__ uint_least8_t;
+typedef __UINT8_TYPE__ uint_fast8_t;
+
+typedef __INT16_TYPE__ int16_t;
+typedef __INT16_TYPE__ int_least16_t;
+typedef __INT16_TYPE__ int_fast16_t;
+
+typedef __UINT16_TYPE__ uint16_t;
+typedef __UINT16_TYPE__ uint_least16_t;
+typedef __UINT16_TYPE__ uint_fast16_t;
+
+typedef __INT32_TYPE__ int32_t;
+typedef __INT32_TYPE__ int_least32_t;
+typedef __INT32_TYPE__ int_fast32_t;
+
+typedef __UINT32_TYPE__ uint32_t;
+typedef __UINT32_TYPE__ uint_least32_t;
+typedef __UINT32_TYPE__ uint_fast32_t;
+
+typedef __INT64_TYPE__ int64_t;
+typedef __INT64_TYPE__ int_least64_t;
+typedef __INT64_TYPE__ int_fast64_t;
+
+typedef __UINT64_TYPE__ uint64_t;
+typedef __UINT64_TYPE__ uint_least64_t;
+typedef __UINT64_TYPE__ uint_fast64_t;
+
+#define INT8_MIN        __INT8_MIN__
+#define INT_LEAST8_MIN  __INT8_MIN__
+#define INT_FAST8_MIN   __INT8_MIN__
+
+#define INT8_MAX        __INT8_MAX__
+#define INT_LEAST8_MAX  __INT8_MAX__
+#define INT_FAST8_MAX   __INT8_MAX__
+
+#define UINT8_MIN        __UINT8_C(0)
+#define UINT_LEAST8_MIN  __UINT8_C(0)
+#define UINT_FAST8_MIN   __UINT8_C(0)
+
+#define UINT8_MAX        __UINT8_MAX__
+#define UINT_LEAST8_MAX  __UINT8_MAX__
+#define UINT_FAST8_MAX   __UINT8_MAX__
+
+#define INT16_MIN        __INT16_MIN__
+#define INT_LEAST16_MIN  __INT16_MIN__
+#define INT_FAST16_MIN   __INT16_MIN__
+
+#define INT16_MAX        __INT16_MAX__
+#define INT_LEAST16_MAX  __INT16_MAX__
+#define INT_FAST16_MAX   __INT16_MAX__
+
+#define UINT16_MIN        __UINT16_C(0)
+#define UINT_LEAST16_MIN  __UINT16_C(0)
+#define UINT_FAST16_MIN   __UINT16_C(0)
+
+#define UINT16_MAX        __UINT16_MAX__
+#define UINT_LEAST16_MAX  __UINT16_MAX__
+#define UINT_FAST16_MAX   __UINT16_MAX__
+
+#define INT32_MIN        __INT32_MIN__
+#define INT_LEAST32_MIN  __INT32_MIN__
+#define INT_FAST32_MIN   __INT32_MIN__
+
+#define INT32_MAX        __INT32_MAX__
+#define INT_LEAST32_MAX  __INT32_MAX__
+#define INT_FAST32_MAX   __INT32_MAX__
+
+#define UINT32_MIN        __UINT32_C(0)
+#define UINT_LEAST32_MIN  __UINT32_C(0)
+#define UINT_FAST32_MIN   __UINT32_C(0)
+
+#define UINT32_MAX        __UINT32_MAX__
+#define UINT_LEAST32_MAX  __UINT32_MAX__
+#define UINT_FAST32_MAX   __UINT32_MAX__
+
+#define INT64_MIN        __INT64_MIN__
+#define INT_LEAST64_MIN  __INT64_MIN__
+#define INT_FAST64_MIN   __INT64_MIN__
+
+#define INT64_MAX        __INT64_MAX__
+#define INT_LEAST64_MAX  __INT64_MAX__
+#define INT_FAST64_MAX   __INT64_MAX__
+
+#define UINT64_MIN        __UINT64_C(0)
+#define UINT_LEAST64_MIN  __UINT64_C(0)
+#define UINT_FAST64_MIN   __UINT64_C(0)
+
+#define UINT64_MAX        __UINT64_MAX__
+#define UINT_LEAST64_MAX  __UINT64_MAX__
+#define UINT_FAST64_MAX   __UINT64_MAX__
+
+#define INT8_C(x)    __INT8_C(x)
+#define INT16_C(x)   __INT16_C(x)
+#define INT32_C(x)   __INT32_C(x)
+#define INT64_C(x)   __INT64_C(x)
+#define UINT8_C(x)   __UINT8_C(x)
+#define UINT16_C(x)  __UINT16_C(x)
+#define UINT32_C(x)  __UINT32_C(x)
+#define UINT64_C(x)  __UINT64_C(x)
+
+typedef __INTPTR_TYPE__  intptr_t;
+typedef __UINTPTR_TYPE__ uintptr_t;
+
+#define INTPTR_MIN   __INTPTR_MIN__
+#define INTPTR_MAX   __INTPTR_MAX__
+#define UINTPTR_MIN  __UINTPTR_C(0)
+#define UINTPTR_MAX  __UINTPTR_MAX__
+
+#ifndef __HELENOS_DISABLE_INTMAX__
+
+typedef __INTMAX_TYPE__  intmax_t;
+typedef __UINTMAX_TYPE__ uintmax_t;
+
+#define INTMAX_MIN   __INTMAX_MIN__
+#define INTMAX_MAX   __INTMAX_MAX__
+#define UINTMAX_MIN  __UINTMAX_C(0)
+#define UINTMAX_MAX  __UINTMAX_MAX__
+
+#define INTMAX_C(x)   __INTMAX_C(x)
+#define UINTMAX_C(x)  __UINTMAX_C(x)
+
+#endif  /* __HELENOS_DISABLE_INTMAX__ */
+
+#define PTRDIFF_MIN  __PTRDIFF_MIN__
+#define PTRDIFF_MAX  __PTRDIFF_MAX__
+
+#define SIZE_MIN  0
+#define SIZE_MAX  __SIZE_MAX__
+
+#define WINT_MIN  __WINT_MIN__
+#define WINT_MAX  __WINT_MAX__
+
+#include <_bits/WCHAR_MIN.h>
+#include <_bits/WCHAR_MAX.h>
+
+/* Use nonstandard 128-bit types if they are supported by the compiler. */
+
+#ifdef __SIZEOF_INT128__
+typedef __int128 int128_t;
+typedef unsigned __int128 uint128_t;
+#endif
+
+#endif
+
+/** @}
+ */
Index: abi/include/_bits/wchar_t.h
===================================================================
--- abi/include/_bits/wchar_t.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
+++ abi/include/_bits/wchar_t.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2017 CZ.NIC, z.s.p.o.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/* Authors:
+ *	Jiří Zárevúcky (jzr) <zarevucky.jiri@gmail.com>
+ */
+
+/** @addtogroup bits
+ * @{
+ */
+/** @file
+ */
+
+#ifndef _BITS_WCHAR_T_H_
+#define _BITS_WCHAR_T_H_
+
+#include <_bits/macros.h>
+
+typedef __WCHAR_TYPE__ wchar_t;
+
+#endif
+
+/** @}
+ */
Index: abi/include/_bits/wint_t.h
===================================================================
--- abi/include/_bits/wint_t.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
+++ abi/include/_bits/wint_t.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2017 CZ.NIC, z.s.p.o.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/* Authors:
+ *	Jiří Zárevúcky (jzr) <zarevucky.jiri@gmail.com>
+ */
+
+/** @addtogroup bits
+ * @{
+ */
+/** @file
+ */
+
+#ifndef _BITS_WINT_T_H_
+#define _BITS_WINT_T_H_
+
+#include <_bits/macros.h>
+
+typedef __WINT_TYPE__ wint_t;
+
+#endif
+
+/** @}
+ */
Index: boot/Makefile
===================================================================
--- boot/Makefile	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ boot/Makefile	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -117,5 +117,5 @@
 		cp "$(USPACE_PATH)/$(DRVS_PATH)/$$file_dir/$$file_name/$$file_name.fw" "$(DIST_PATH)/$(DRVS_PATH)/$$file_name/" ; \
 	done
-	if [ -d $(DIST_OVERLAY_PATH) ]; then \
+	if ls $(DIST_OVERLAY_PATH)/* >/dev/null 2>/dev/null; then \
 		cp -r -L $(DIST_OVERLAY_PATH)/* "$(DIST_PATH)"; \
 	fi
@@ -128,5 +128,5 @@
 	rm -f $(POST_OUTPUT) $(BOOT_OUTPUT) arch/*/include/common.h
 	find generic/src/ arch/*/src/ genarch/src/ -name '*.o' -follow -exec rm \{\} \;
-	find generic/src/ arch/*/src/ genarch/src/ -name '*.d' -follow -exec rm \{\} \;
+	find . -name '*.d' -follow -exec rm \{\} \;
 
 clean_dist:
Index: boot/Makefile.build
===================================================================
--- boot/Makefile.build	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ boot/Makefile.build	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -31,5 +31,5 @@
 include Makefile.common
 
-INCLUDES = -Igeneric/include -I$(ROOT_PATH)/abi/include
+INCLUDES = -Igeneric/include -Iarch/$(KARCH)/include -Igenarch/include -I$(ROOT_PATH)/abi/include
 OPTIMIZATION = 3
 
@@ -37,5 +37,5 @@
 
 AFLAGS =
-LFLAGS = --fatal-warnings
+LFLAGS = --fatal-warnings --warn-common
 
 # FIXME: This condition is a workaround for issue #693.
@@ -46,5 +46,6 @@
 COMMON_CFLAGS = $(INCLUDES) -O$(OPTIMIZATION) -imacros $(CONFIG_HEADER) \
 	-ffreestanding -fno-builtin -nostdlib -nostdinc \
-	-fexec-charset=UTF-8 -finput-charset=UTF-8
+	-fexec-charset=UTF-8 -finput-charset=UTF-8 -fno-common \
+	-fdebug-prefix-map=$(realpath $(ROOT_PATH))=.
 
 GCC_CFLAGS = -Wall -Wextra -Wno-unused-parameter -Wmissing-prototypes \
@@ -76,5 +77,5 @@
 
 clean:
-	rm -f $(RAW) $(MAP) $(ARCH_INCLUDE) $(GENARCH_INCLUDE)
+	rm -f $(RAW) $(MAP)
 
 -include $(DEPENDS)
@@ -109,5 +110,5 @@
 endif
 
-depend: $(ARCH_INCLUDE) $(GENARCH_INCLUDE) $(COMMON_HEADER_ARCH) $(PRE_DEPEND)
+depend: $(PRE_DEPEND)
 
 $(COMPS).s: $(COMPS).zip
@@ -128,10 +129,2 @@
 include Makefile.initrd
 
-$(ARCH_INCLUDE): arch/$(KARCH)/include/
-	ln -sfn ../../$< $@
-
-$(GENARCH_INCLUDE): genarch/include/
-	ln -sfn ../../$< $@
-
-$(COMMON_HEADER_ARCH): $(COMMON_HEADER)
-	ln -sfn ../../../$< $@
Index: boot/Makefile.common
===================================================================
--- boot/Makefile.common	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ boot/Makefile.common	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -36,5 +36,4 @@
 COMMON_MAKEFILE = $(ROOT_PATH)/Makefile.common
 COMMON_HEADER = $(ROOT_PATH)/common.h
-COMMON_HEADER_ARCH = arch/$(BARCH)/include/common.h
 
 CONFIG_MAKEFILE = $(ROOT_PATH)/Makefile.config
@@ -59,7 +58,4 @@
 
 JOBFILE = $(ROOT_PATH)/tools/jobfile.py
-
-ARCH_INCLUDE = generic/include/arch
-GENARCH_INCLUDE = generic/include/genarch
 
 DISTROOT = distroot
Index: ot/arch/arm32/include/arch.h
===================================================================
--- boot/arch/arm32/include/arch.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ 	(revision )
@@ -1,74 +1,0 @@
-/*
- * Copyright (c) 2010 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef BOOT_arm32_ARCH_H
-#define BOOT_arm32_ARCH_H
-
-#define PAGE_WIDTH  12
-#define PAGE_SIZE   (1 << PAGE_WIDTH)
-
-#define PTL0_ENTRIES     4096
-#define PTL0_ENTRY_SIZE  4
-
-/*
- * Address where the boot stage image starts (beginning of usable physical
- * memory).
- */
-#ifdef MACHINE_gta02
-#define BOOT_BASE	0x30008000
-#elif defined MACHINE_beagleboardxm
-#define BOOT_BASE	0x80000000
-#elif defined MACHINE_beaglebone
-#define BOOT_BASE       0x80000000
-#elif defined MACHINE_raspberrypi
-#define BOOT_BASE	0x00008000
-#else
-#define BOOT_BASE	0x00000000
-#endif
-
-#define BOOT_OFFSET	(BOOT_BASE + 0xa00000)
-
-#ifdef MACHINE_beagleboardxm
-	#define PA_OFFSET 0
-#elif defined MACHINE_beaglebone
-	#define PA_OFFSET 0
-#else
-	#define PA_OFFSET 0x80000000
-#endif
-
-#ifndef __ASM__
-	#define PA2KA(addr)  (((uintptr_t) (addr)) + PA_OFFSET)
-#else
-	#define PA2KA(addr)  ((addr) + PA_OFFSET)
-#endif
-
-
-#endif
-
-/** @}
- */
Index: boot/arch/arm32/include/arch/arch.h
===================================================================
--- boot/arch/arm32/include/arch/arch.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
+++ boot/arch/arm32/include/arch/arch.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2010 Martin Decky
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef BOOT_arm32_ARCH_H
+#define BOOT_arm32_ARCH_H
+
+#define PAGE_WIDTH  12
+#define PAGE_SIZE   (1 << PAGE_WIDTH)
+
+#define PTL0_ENTRIES     4096
+#define PTL0_ENTRY_SIZE  4
+
+/*
+ * Address where the boot stage image starts (beginning of usable physical
+ * memory).
+ */
+#ifdef MACHINE_gta02
+#define BOOT_BASE	0x30008000
+#elif defined MACHINE_beagleboardxm
+#define BOOT_BASE	0x80000000
+#elif defined MACHINE_beaglebone
+#define BOOT_BASE       0x80000000
+#elif defined MACHINE_raspberrypi
+#define BOOT_BASE	0x00008000
+#else
+#define BOOT_BASE	0x00000000
+#endif
+
+#define BOOT_OFFSET	(BOOT_BASE + 0xa00000)
+
+#ifdef MACHINE_beagleboardxm
+	#define PA_OFFSET 0
+#elif defined MACHINE_beaglebone
+	#define PA_OFFSET 0
+#else
+	#define PA_OFFSET 0x80000000
+#endif
+
+#ifndef __ASM__
+	#define PA2KA(addr)  (((uintptr_t) (addr)) + PA_OFFSET)
+#else
+	#define PA2KA(addr)  ((addr) + PA_OFFSET)
+#endif
+
+
+#endif
+
+/** @}
+ */
Index: boot/arch/arm32/include/arch/asm.h
===================================================================
--- boot/arch/arm32/include/arch/asm.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
+++ boot/arch/arm32/include/arch/asm.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2007 Michal Kebrt
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup arm32boot
+ * @{
+ */
+/** @file
+ * @brief Functions implemented in assembly.
+ */
+
+#ifndef BOOT_arm32_ASM_H
+#define BOOT_arm32_ASM_H
+
+#include <arch/arch.h>
+#include <arch/mm.h>
+
+extern pte_level0_section_t boot_pt[PTL0_ENTRIES];
+extern void *boot_stack;
+
+/** Jump to the kernel entry point.
+ *
+ * @param entry    Kernel entry point.
+ * @param bootinfo Structure holding information about loaded tasks.
+ *
+ */
+extern void jump_to_kernel(void *entry, void *bootinfo)
+    __attribute__((noreturn));
+
+#endif
+
+/** @}
+ */
Index: boot/arch/arm32/include/arch/cp15.h
===================================================================
--- boot/arch/arm32/include/arch/cp15.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
+++ boot/arch/arm32/include/arch/cp15.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -0,0 +1,1 @@
+../../../../../kernel/arch/arm32/include/arch/cp15.h
Index: boot/arch/arm32/include/arch/main.h
===================================================================
--- boot/arch/arm32/include/arch/main.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
+++ boot/arch/arm32/include/arch/main.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -0,0 +1,102 @@
+/*
+ * Copyright (c) 2007 Michal Kebrt
+ * Copyright (c) 2010 Jiri Svoboda
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup arm32boot
+ * @{
+ */
+/** @file
+ * @brief Boot related declarations.
+ */
+
+#ifndef BOOT_arm32_MAIN_H
+#define BOOT_arm32_MAIN_H
+
+/** Address where characters to be printed are expected. */
+
+
+/** BeagleBoard-xM UART register address
+ *
+ * This is UART3 of AM/DM37x CPU
+ */
+#define BBXM_SCONS_THR          0x49020000
+#define BBXM_SCONS_SSR          0x49020044
+
+/* Check this bit before writing (tx fifo full) */
+#define BBXM_THR_FULL           0x00000001
+
+/** Beaglebone UART register addresses
+ *
+ * This is UART0 of AM335x CPU
+ */
+#define BBONE_SCONS_THR         0x44E09000
+#define BBONE_SCONS_SSR         0x44E09044
+
+/** Check this bit before writing (tx fifo full) */
+#define BBONE_TXFIFO_FULL       0x00000001
+
+/** GTA02 serial console UART register addresses.
+ *
+ * This is UART channel 2 of the S3C24xx CPU
+ */
+#define GTA02_SCONS_UTRSTAT	0x50008010
+#define GTA02_SCONS_UTXH	0x50008020
+
+/* Bits in UTXH register */
+#define S3C24XX_UTXH_TX_EMPTY	0x00000004
+
+
+/** IntegratorCP serial console output register */
+#define ICP_SCONS_ADDR		0x16000000
+
+/** Raspberry PI serial console registers */
+#define BCM2835_UART0_BASE	0x20201000
+#define BCM2835_UART0_DR	(BCM2835_UART0_BASE + 0x00)
+#define BCM2835_UART0_FR	(BCM2835_UART0_BASE + 0x18)
+#define BCM2835_UART0_ILPR	(BCM2835_UART0_BASE + 0x20)
+#define BCM2835_UART0_IBRD	(BCM2835_UART0_BASE + 0x24)
+#define BCM2835_UART0_FBRD	(BCM2835_UART0_BASE + 0x28)
+#define BCM2835_UART0_LCRH	(BCM2835_UART0_BASE + 0x2C)
+#define BCM2835_UART0_CR	(BCM2835_UART0_BASE + 0x30)
+#define BCM2835_UART0_ICR	(BCM2835_UART0_BASE + 0x44)
+
+#define BCM2835_UART0_FR_TXFF	(1 << 5)
+#define BCM2835_UART0_LCRH_FEN	(1 << 4)
+#define BCM2835_UART0_LCRH_WL8	((1 << 5) | (1 << 6))
+#define BCM2835_UART0_CR_UARTEN	(1 << 0)
+#define BCM2835_UART0_CR_TXE	(1 << 8)
+#define BCM2835_UART0_CR_RXE	(1 << 9)
+
+
+
+extern void bootstrap(void);
+
+#endif
+
+/** @}
+ */
Index: boot/arch/arm32/include/arch/mm.h
===================================================================
--- boot/arch/arm32/include/arch/mm.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
+++ boot/arch/arm32/include/arch/mm.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2007 Pavel Jancik
+ * Copyright (c) 2007 Michal Kebrt
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup arm32boot
+ * @{
+ */
+/** @file
+ * @brief Memory management used while booting the kernel.
+ *
+ * So called "section" paging is used while booting the kernel. The term
+ * "section" comes from the ARM architecture specification and stands for the
+ * following: one-level paging, 1MB sized pages, 4096 entries in the page
+ * table.
+ */
+
+#ifndef BOOT_arm32__MM_H
+#define BOOT_arm32__MM_H
+
+/** Describe "section" page table entry (one-level paging with 1 MB sized pages). */
+#define PTE_DESCRIPTOR_SECTION  0x02
+/** Shift of memory address in section descriptor */
+#define PTE_SECTION_SHIFT  20
+
+/** Page table access rights: user - no access, kernel - read/write. */
+#define PTE_AP_USER_NO_KERNEL_RW  0x01
+
+/** Start of memory mapped I/O area for GTA02 */
+#define GTA02_IOMEM_START  0x48000000
+/** End of memory mapped I/O area for GTA02 */
+#define GTA02_IOMEM_END  0x60000000
+
+/** Start of ram memory on BBxM */
+#define BBXM_RAM_START   0x80000000
+/** Start of ram memory on BBxM */
+#define BBXM_RAM_END   0xc0000000
+
+/** Start of ram memory on AM335x */
+#define AM335x_RAM_START   0x80000000
+/** End of ram memory on AM335x */
+#define AM335x_RAM_END     0xC0000000
+
+/** Start of ram memory on BCM2835 */
+#define BCM2835_RAM_START   0
+/** End of ram memory on BCM2835 */
+#define BCM2835_RAM_END     0x20000000
+
+/* Page table level 0 entry - "section" format is used
+ * (one-level paging, 1 MB sized pages). Used only while booting the kernel.
+ */
+typedef struct {
+	unsigned int descriptor_type : 2;
+	unsigned int bufferable : 1;
+	unsigned int cacheable : 1;
+	unsigned int xn : 1;
+	unsigned int domain : 4;
+	unsigned int should_be_zero_1 : 1;
+	unsigned int access_permission_0 : 2;
+	unsigned int tex : 3;
+	unsigned int access_permission_1 : 1;
+	unsigned int shareable : 1;
+	unsigned int non_global : 1;
+	unsigned int should_be_zero_2 : 1;
+	unsigned int non_secure : 1;
+	unsigned int section_base_addr : 12;
+} __attribute__((packed)) pte_level0_section_t;
+
+extern void mmu_start(void);
+
+#endif
+
+/** @}
+ */
Index: boot/arch/arm32/include/arch/types.h
===================================================================
--- boot/arch/arm32/include/arch/types.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
+++ boot/arch/arm32/include/arch/types.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2006 Martin Decky
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup arm32boot
+ * @{
+ */
+/** @file
+ * @brief Definitions of basic types like #uintptr_t.
+ */
+
+#ifndef BOOT_arm32_TYPES_H
+#define BOOT_arm32_TYPES_H
+
+#include <_bits/all.h>
+
+#define TASKMAP_MAX_RECORDS        32
+#define BOOTINFO_TASK_NAME_BUFLEN  32
+
+typedef struct {
+	/** Address where the task was placed. */
+	void *addr;
+	/** Size of the task's binary. */
+	size_t size;
+	/** Task name. */
+	char name[BOOTINFO_TASK_NAME_BUFLEN];
+} task_t;
+
+typedef struct {
+	size_t cnt;
+	task_t tasks[TASKMAP_MAX_RECORDS];
+} bootinfo_t;
+
+#endif
+
+/** @}
+ */
Index: ot/arch/arm32/include/asm.h
===================================================================
--- boot/arch/arm32/include/asm.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ 	(revision )
@@ -1,57 +1,0 @@
-/*
- * Copyright (c) 2007 Michal Kebrt
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup arm32boot
- * @{
- */
-/** @file
- * @brief Functions implemented in assembly.
- */
-
-#ifndef BOOT_arm32_ASM_H
-#define BOOT_arm32_ASM_H
-
-#include <arch/arch.h>
-#include <arch/mm.h>
-
-extern pte_level0_section_t boot_pt[PTL0_ENTRIES];
-extern void *boot_stack;
-
-/** Jump to the kernel entry point.
- *
- * @param entry    Kernel entry point.
- * @param bootinfo Structure holding information about loaded tasks.
- *
- */
-extern void jump_to_kernel(void *entry, void *bootinfo)
-    __attribute__((noreturn));
-
-#endif
-
-/** @}
- */
Index: ot/arch/arm32/include/cp15.h
===================================================================
--- boot/arch/arm32/include/cp15.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ 	(revision )
@@ -1,1 +1,0 @@
-../../../../kernel/arch/arm32/include/arch/cp15.h
Index: ot/arch/arm32/include/main.h
===================================================================
--- boot/arch/arm32/include/main.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ 	(revision )
@@ -1,102 +1,0 @@
-/*
- * Copyright (c) 2007 Michal Kebrt
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup arm32boot
- * @{
- */
-/** @file
- * @brief Boot related declarations.
- */
-
-#ifndef BOOT_arm32_MAIN_H
-#define BOOT_arm32_MAIN_H
-
-/** Address where characters to be printed are expected. */
-
-
-/** BeagleBoard-xM UART register address
- *
- * This is UART3 of AM/DM37x CPU
- */
-#define BBXM_SCONS_THR          0x49020000
-#define BBXM_SCONS_SSR          0x49020044
-
-/* Check this bit before writing (tx fifo full) */
-#define BBXM_THR_FULL           0x00000001
-
-/** Beaglebone UART register addresses
- *
- * This is UART0 of AM335x CPU
- */
-#define BBONE_SCONS_THR         0x44E09000
-#define BBONE_SCONS_SSR         0x44E09044
-
-/** Check this bit before writing (tx fifo full) */
-#define BBONE_TXFIFO_FULL       0x00000001
-
-/** GTA02 serial console UART register addresses.
- *
- * This is UART channel 2 of the S3C24xx CPU
- */
-#define GTA02_SCONS_UTRSTAT	0x50008010
-#define GTA02_SCONS_UTXH	0x50008020
-
-/* Bits in UTXH register */
-#define S3C24XX_UTXH_TX_EMPTY	0x00000004
-
-
-/** IntegratorCP serial console output register */
-#define ICP_SCONS_ADDR		0x16000000
-
-/** Raspberry PI serial console registers */
-#define BCM2835_UART0_BASE	0x20201000
-#define BCM2835_UART0_DR	(BCM2835_UART0_BASE + 0x00)
-#define BCM2835_UART0_FR	(BCM2835_UART0_BASE + 0x18)
-#define BCM2835_UART0_ILPR	(BCM2835_UART0_BASE + 0x20)
-#define BCM2835_UART0_IBRD	(BCM2835_UART0_BASE + 0x24)
-#define BCM2835_UART0_FBRD	(BCM2835_UART0_BASE + 0x28)
-#define BCM2835_UART0_LCRH	(BCM2835_UART0_BASE + 0x2C)
-#define BCM2835_UART0_CR	(BCM2835_UART0_BASE + 0x30)
-#define BCM2835_UART0_ICR	(BCM2835_UART0_BASE + 0x44)
-
-#define BCM2835_UART0_FR_TXFF	(1 << 5)
-#define BCM2835_UART0_LCRH_FEN	(1 << 4)
-#define BCM2835_UART0_LCRH_WL8	((1 << 5) | (1 << 6))
-#define BCM2835_UART0_CR_UARTEN	(1 << 0)
-#define BCM2835_UART0_CR_TXE	(1 << 8)
-#define BCM2835_UART0_CR_RXE	(1 << 9)
-
-
-
-extern void bootstrap(void);
-
-#endif
-
-/** @}
- */
Index: ot/arch/arm32/include/mm.h
===================================================================
--- boot/arch/arm32/include/mm.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ 	(revision )
@@ -1,98 +1,0 @@
-/*
- * Copyright (c) 2007 Pavel Jancik
- * Copyright (c) 2007 Michal Kebrt
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup arm32boot
- * @{
- */
-/** @file
- * @brief Memory management used while booting the kernel.
- *
- * So called "section" paging is used while booting the kernel. The term
- * "section" comes from the ARM architecture specification and stands for the
- * following: one-level paging, 1MB sized pages, 4096 entries in the page
- * table.
- */
-
-#ifndef BOOT_arm32__MM_H
-#define BOOT_arm32__MM_H
-
-/** Describe "section" page table entry (one-level paging with 1 MB sized pages). */
-#define PTE_DESCRIPTOR_SECTION  0x02
-/** Shift of memory address in section descriptor */
-#define PTE_SECTION_SHIFT  20
-
-/** Page table access rights: user - no access, kernel - read/write. */
-#define PTE_AP_USER_NO_KERNEL_RW  0x01
-
-/** Start of memory mapped I/O area for GTA02 */
-#define GTA02_IOMEM_START  0x48000000
-/** End of memory mapped I/O area for GTA02 */
-#define GTA02_IOMEM_END  0x60000000
-
-/** Start of ram memory on BBxM */
-#define BBXM_RAM_START   0x80000000
-/** Start of ram memory on BBxM */
-#define BBXM_RAM_END   0xc0000000
-
-/** Start of ram memory on AM335x */
-#define AM335x_RAM_START   0x80000000
-/** End of ram memory on AM335x */
-#define AM335x_RAM_END     0xC0000000
-
-/** Start of ram memory on BCM2835 */
-#define BCM2835_RAM_START   0
-/** End of ram memory on BCM2835 */
-#define BCM2835_RAM_END     0x20000000
-
-/* Page table level 0 entry - "section" format is used
- * (one-level paging, 1 MB sized pages). Used only while booting the kernel.
- */
-typedef struct {
-	unsigned int descriptor_type : 2;
-	unsigned int bufferable : 1;
-	unsigned int cacheable : 1;
-	unsigned int xn : 1;
-	unsigned int domain : 4;
-	unsigned int should_be_zero_1 : 1;
-	unsigned int access_permission_0 : 2;
-	unsigned int tex : 3;
-	unsigned int access_permission_1 : 1;
-	unsigned int shareable : 1;
-	unsigned int non_global : 1;
-	unsigned int should_be_zero_2 : 1;
-	unsigned int non_secure : 1;
-	unsigned int section_base_addr : 12;
-} __attribute__((packed)) pte_level0_section_t;
-
-extern void mmu_start(void);
-
-#endif
-
-/** @}
- */
Index: ot/arch/arm32/include/types.h
===================================================================
--- boot/arch/arm32/include/types.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ 	(revision )
@@ -1,68 +1,0 @@
-/*
- * Copyright (c) 2006 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup arm32boot
- * @{
- */
-/** @file
- * @brief Definitions of basic types like #uintptr_t.
- */
-
-#ifndef BOOT_arm32_TYPES_H
-#define BOOT_arm32_TYPES_H
-
-#include <arch/common.h>
-
-#define TASKMAP_MAX_RECORDS        32
-#define BOOTINFO_TASK_NAME_BUFLEN  32
-
-typedef uint32_t size_t;
-typedef uint32_t uintptr_t;
-
-typedef uint32_t pfn_t;
-
-typedef int32_t ptrdiff_t;
-
-typedef struct {
-	/** Address where the task was placed. */
-	void *addr;
-	/** Size of the task's binary. */
-	size_t size;
-	/** Task name. */
-	char name[BOOTINFO_TASK_NAME_BUFLEN];
-} task_t;
-
-typedef struct {
-	size_t cnt;
-	task_t tasks[TASKMAP_MAX_RECORDS];
-} bootinfo_t;
-
-#endif
-
-/** @}
- */
Index: ot/arch/ia64/include/arch.h
===================================================================
--- boot/arch/ia64/include/arch.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ 	(revision )
@@ -1,42 +1,0 @@
-/*
- * Copyright (c) 2006 Martin Decky
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef BOOT_ia64_ARCH_H_
-#define BOOT_ia64_ARCH_H_
-
-#define PAGE_WIDTH  14
-#define PAGE_SIZE   (1 << PAGE_WIDTH)
-
-#define LOADER_ADDRESS  0x4400000
-#define KERNEL_ADDRESS  0x4800000
-
-#define STACK_SIZE                   8192
-#define STACK_ALIGNMENT              16
-
-#endif
Index: boot/arch/ia64/include/arch/arch.h
===================================================================
--- boot/arch/ia64/include/arch/arch.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
+++ boot/arch/ia64/include/arch/arch.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2006 Martin Decky
+ * Copyright (c) 2006 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef BOOT_ia64_ARCH_H_
+#define BOOT_ia64_ARCH_H_
+
+#define PAGE_WIDTH  14
+#define PAGE_SIZE   (1 << PAGE_WIDTH)
+
+#define LOADER_ADDRESS  0x4400000
+#define KERNEL_ADDRESS  0x4800000
+
+#define STACK_SIZE                   8192
+#define STACK_ALIGNMENT              16
+
+#endif
Index: boot/arch/ia64/include/arch/asm.h
===================================================================
--- boot/arch/ia64/include/arch/asm.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
+++ boot/arch/ia64/include/arch/asm.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2006 Martin Decky
+ * Copyright (c) 2006 Jakub Jermar 
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef BOOT_ia64_ASM_H_
+#define BOOT_ia64_ASM_H_
+
+extern void jump_to_kernel(void *) __attribute__((noreturn));
+
+#endif
Index: boot/arch/ia64/include/arch/main.h
===================================================================
--- boot/arch/ia64/include/arch/main.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
+++ boot/arch/ia64/include/arch/main.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2005 Martin Decky
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef BOOT_ia64_MAIN_H_
+#define BOOT_ia64_MAIN_H_
+
+extern void bootstrap(void);
+
+#endif
Index: boot/arch/ia64/include/arch/pal.h
===================================================================
--- boot/arch/ia64/include/arch/pal.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
+++ boot/arch/ia64/include/arch/pal.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2011 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef BOOT_ia64_PAL_H_
+#define BOOT_ia64_PAL_H_
+
+#include <arch/types.h>
+#include <stddef.h>
+#include <stdint.h>
+
+/*
+ * Essential PAL procedures' IDs
+ */
+#define PAL_FREQ_RATIOS		14	
+
+extern uint64_t pal_proc_freq_ratio(void);
+
+#define pal_static_call_0_1(id, ret1) \
+	pal_static_call((id), 0, 0, 0, (ret1), NULL, NULL)
+
+extern uint64_t pal_static_call(uint64_t, uint64_t, uint64_t, uint64_t,
+    uint64_t *, uint64_t *, uint64_t *);
+
+#endif
Index: boot/arch/ia64/include/arch/sal.h
===================================================================
--- boot/arch/ia64/include/arch/sal.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
+++ boot/arch/ia64/include/arch/sal.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -0,0 +1,119 @@
+/*
+ * Copyright (c) 2011 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef BOOT_ia64_SAL_H_
+#define BOOT_ia64_SAL_H_
+
+#include <arch/types.h>
+#include <stddef.h>
+#include <stdint.h>
+
+/*
+ * Essential SAL procedures' IDs
+ */
+#define SAL_FREQ_BASE	0x1000012
+
+typedef struct {
+	uint8_t signature[4];
+	uint32_t total_length;
+	uint16_t sal_revision;
+	uint16_t entry_count;
+	uint8_t checksum;
+	uint8_t reserved1[7];
+	uint16_t sal_a_version;
+	uint16_t sal_b_version;
+	uint8_t oem_id[32];
+	uint8_t product_id[32];
+	uint8_t reserved2[8];
+} sal_system_table_header_t;
+
+typedef enum {
+	SSTT_ENTRYPOINT_DESC,
+	SSTT_MEMORY_DESC,
+	SSTT_PLATFORM_FEATURES_DESC,
+	SSTT_TR_DESC,
+	SSTT_PTC_COHERENCE_DOMAIN_DESC,
+	SSTT_AP_WAKEUP_DESC
+} sal_sst_type_t;
+
+typedef struct {
+	uint8_t type;
+	uint8_t reserved1[7];
+	uint64_t pal_proc;
+	uint64_t sal_proc;
+	uint64_t sal_proc_gp;
+	uint8_t reserved2[16];
+} sal_entrypoint_desc_t;
+
+/* This descriptor is unused on Itanium systems. */
+typedef struct {
+	uint8_t type;
+	uint8_t unused[31];
+} sal_memory_desc_t;
+
+typedef struct {
+	uint8_t type;
+	uint8_t features;
+	uint8_t reserved[14];
+} sal_platform_features_desc_t;
+
+typedef struct {
+	uint8_t type;
+	uint8_t tr_type;
+	uint8_t tr_number;
+	uint8_t reserved1[5];
+	uint64_t va;
+	uint64_t psc;
+	uint8_t reserved2[8];
+} sal_tr_desc_t;
+
+typedef struct {
+	uint8_t type;
+	uint8_t reserved[3];
+	uint32_t coherence_domains;
+	uint64_t coherence_domain_info;
+} sal_ptc_coherence_domain_desc_t;
+
+typedef struct {
+	uint8_t type;
+	uint8_t mechanism;
+	uint8_t reserved[6];
+	uint64_t vector;
+} sal_ap_wakeup_desc_t;
+
+extern void sal_system_table_parse(sal_system_table_header_t *);
+
+extern uint64_t sal_base_clock_frequency(void);
+
+#define sal_call_1_1(id, arg1, ret1) \
+	sal_call((id), (arg1), 0, 0, 0, 0, 0, 0, (ret1), NULL, NULL)
+
+extern uint64_t sal_call(uint64_t, uint64_t, uint64_t, uint64_t, uint64_t,
+    uint64_t, uint64_t, uint64_t, uint64_t *, uint64_t *, uint64_t *);
+
+#endif
Index: boot/arch/ia64/include/arch/ski.h
===================================================================
--- boot/arch/ia64/include/arch/ski.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
+++ boot/arch/ia64/include/arch/ski.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2005 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef BOOT_ia64_SKI_H_
+#define BOOT_ia64_SKI_H_
+
+#include <stddef.h>
+#include <str.h>
+
+extern void ski_putchar(const wchar_t);
+
+#endif
Index: boot/arch/ia64/include/arch/types.h
===================================================================
--- boot/arch/ia64/include/arch/types.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
+++ boot/arch/ia64/include/arch/types.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2005 Martin Decky
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef BOOT_ia64_TYPES_H_
+#define BOOT_ia64_TYPES_H_
+
+#include <_bits/all.h>
+
+#define TASKMAP_MAX_RECORDS		32
+#define BOOTINFO_TASK_NAME_BUFLEN	32
+#define MEMMAP_ITEMS			128
+
+typedef struct {
+	void *addr;
+	size_t size;
+	char name[BOOTINFO_TASK_NAME_BUFLEN];
+} binit_task_t;
+
+typedef struct {
+	size_t cnt;
+	binit_task_t tasks[TASKMAP_MAX_RECORDS];
+} binit_t;
+
+typedef struct {
+	unsigned int type;
+	unsigned long base;
+	unsigned long size;
+} memmap_item_t;
+
+typedef struct {
+	binit_t taskmap;
+
+	memmap_item_t memmap[MEMMAP_ITEMS];
+	unsigned int memmap_items;
+
+	sysarg_t *sapic;
+	unsigned long sys_freq;
+	unsigned long freq_scale;
+	unsigned int wakeup_intno;
+} bootinfo_t;
+
+/** This is a minimal ELILO-compatible boot parameter structure. */
+typedef struct {
+	uint64_t cmd_line;
+	uint64_t efi_system_table;
+	uint64_t efi_memmap;
+	uint64_t efi_memmap_sz;
+	uint64_t efi_memdesc_sz;
+} boot_param_t;
+
+#endif
Index: ot/arch/ia64/include/asm.h
===================================================================
--- boot/arch/ia64/include/asm.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ 	(revision )
@@ -1,35 +1,0 @@
-/*
- * Copyright (c) 2006 Martin Decky
- * Copyright (c) 2006 Jakub Jermar 
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef BOOT_ia64_ASM_H_
-#define BOOT_ia64_ASM_H_
-
-extern void jump_to_kernel(void *) __attribute__((noreturn));
-
-#endif
Index: ot/arch/ia64/include/main.h
===================================================================
--- boot/arch/ia64/include/main.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ 	(revision )
@@ -1,34 +1,0 @@
-/*
- * Copyright (c) 2005 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef BOOT_ia64_MAIN_H_
-#define BOOT_ia64_MAIN_H_
-
-extern void bootstrap(void);
-
-#endif
Index: ot/arch/ia64/include/pal.h
===================================================================
--- boot/arch/ia64/include/pal.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ 	(revision )
@@ -1,49 +1,0 @@
-/*
- * Copyright (c) 2011 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef BOOT_ia64_PAL_H_
-#define BOOT_ia64_PAL_H_
-
-#include <arch/types.h>
-#include <stddef.h>
-#include <stdint.h>
-
-/*
- * Essential PAL procedures' IDs
- */
-#define PAL_FREQ_RATIOS		14	
-
-extern uint64_t pal_proc_freq_ratio(void);
-
-#define pal_static_call_0_1(id, ret1) \
-	pal_static_call((id), 0, 0, 0, (ret1), NULL, NULL)
-
-extern uint64_t pal_static_call(uint64_t, uint64_t, uint64_t, uint64_t,
-    uint64_t *, uint64_t *, uint64_t *);
-
-#endif
Index: ot/arch/ia64/include/sal.h
===================================================================
--- boot/arch/ia64/include/sal.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ 	(revision )
@@ -1,119 +1,0 @@
-/*
- * Copyright (c) 2011 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef BOOT_ia64_SAL_H_
-#define BOOT_ia64_SAL_H_
-
-#include <arch/types.h>
-#include <stddef.h>
-#include <stdint.h>
-
-/*
- * Essential SAL procedures' IDs
- */
-#define SAL_FREQ_BASE	0x1000012
-
-typedef struct {
-	uint8_t signature[4];
-	uint32_t total_length;
-	uint16_t sal_revision;
-	uint16_t entry_count;
-	uint8_t checksum;
-	uint8_t reserved1[7];
-	uint16_t sal_a_version;
-	uint16_t sal_b_version;
-	uint8_t oem_id[32];
-	uint8_t product_id[32];
-	uint8_t reserved2[8];
-} sal_system_table_header_t;
-
-typedef enum {
-	SSTT_ENTRYPOINT_DESC,
-	SSTT_MEMORY_DESC,
-	SSTT_PLATFORM_FEATURES_DESC,
-	SSTT_TR_DESC,
-	SSTT_PTC_COHERENCE_DOMAIN_DESC,
-	SSTT_AP_WAKEUP_DESC
-} sal_sst_type_t;
-
-typedef struct {
-	uint8_t type;
-	uint8_t reserved1[7];
-	uint64_t pal_proc;
-	uint64_t sal_proc;
-	uint64_t sal_proc_gp;
-	uint8_t reserved2[16];
-} sal_entrypoint_desc_t;
-
-/* This descriptor is unused on Itanium systems. */
-typedef struct {
-	uint8_t type;
-	uint8_t unused[31];
-} sal_memory_desc_t;
-
-typedef struct {
-	uint8_t type;
-	uint8_t features;
-	uint8_t reserved[14];
-} sal_platform_features_desc_t;
-
-typedef struct {
-	uint8_t type;
-	uint8_t tr_type;
-	uint8_t tr_number;
-	uint8_t reserved1[5];
-	uint64_t va;
-	uint64_t psc;
-	uint8_t reserved2[8];
-} sal_tr_desc_t;
-
-typedef struct {
-	uint8_t type;
-	uint8_t reserved[3];
-	uint32_t coherence_domains;
-	uint64_t coherence_domain_info;
-} sal_ptc_coherence_domain_desc_t;
-
-typedef struct {
-	uint8_t type;
-	uint8_t mechanism;
-	uint8_t reserved[6];
-	uint64_t vector;
-} sal_ap_wakeup_desc_t;
-
-extern void sal_system_table_parse(sal_system_table_header_t *);
-
-extern uint64_t sal_base_clock_frequency(void);
-
-#define sal_call_1_1(id, arg1, ret1) \
-	sal_call((id), (arg1), 0, 0, 0, 0, 0, 0, (ret1), NULL, NULL)
-
-extern uint64_t sal_call(uint64_t, uint64_t, uint64_t, uint64_t, uint64_t,
-    uint64_t, uint64_t, uint64_t, uint64_t *, uint64_t *, uint64_t *);
-
-#endif
Index: ot/arch/ia64/include/ski.h
===================================================================
--- boot/arch/ia64/include/ski.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ 	(revision )
@@ -1,37 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef BOOT_ia64_SKI_H_
-#define BOOT_ia64_SKI_H_
-
-#include <stddef.h>
-#include <str.h>
-
-extern void ski_putchar(const wchar_t);
-
-#endif
Index: ot/arch/ia64/include/types.h
===================================================================
--- boot/arch/ia64/include/types.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ 	(revision )
@@ -1,82 +1,0 @@
-/*
- * Copyright (c) 2005 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef BOOT_ia64_TYPES_H_
-#define BOOT_ia64_TYPES_H_
-
-#include <arch/common.h>
-
-#define TASKMAP_MAX_RECORDS		32
-#define BOOTINFO_TASK_NAME_BUFLEN	32
-#define MEMMAP_ITEMS			128
-
-typedef uint64_t size_t;
-typedef uint64_t sysarg_t;
-typedef uint64_t uintptr_t;
-
-typedef int64_t ptrdiff_t;
-
-typedef struct {
-	void *addr;
-	size_t size;
-	char name[BOOTINFO_TASK_NAME_BUFLEN];
-} binit_task_t;
-
-typedef struct {
-	size_t cnt;
-	binit_task_t tasks[TASKMAP_MAX_RECORDS];
-} binit_t;
-
-typedef struct {
-	unsigned int type;
-	unsigned long base;
-	unsigned long size;
-} memmap_item_t;
-
-typedef struct {
-	binit_t taskmap;
-
-	memmap_item_t memmap[MEMMAP_ITEMS];
-	unsigned int memmap_items;
-
-	sysarg_t *sapic;
-	unsigned long sys_freq;
-	unsigned long freq_scale;
-	unsigned int wakeup_intno;
-} bootinfo_t;
-
-/** This is a minimal ELILO-compatible boot parameter structure. */
-typedef struct {
-	uint64_t cmd_line;
-	uint64_t efi_system_table;
-	uint64_t efi_memmap;
-	uint64_t efi_memmap_sz;
-	uint64_t efi_memdesc_sz;
-} boot_param_t;
-
-#endif
Index: ot/arch/mips32/include/arch.h
===================================================================
--- boot/arch/mips32/include/arch.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ 	(revision )
@@ -1,67 +1,0 @@
-/*
- * Copyright (c) 2006 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef BOOT_mips32_ARCH_H_
-#define BOOT_mips32_ARCH_H_
-
-#define PAGE_WIDTH  14
-#define PAGE_SIZE   (1 << PAGE_WIDTH)
-
-#if defined(MACHINE_msim)
-#define CPUMAP_OFFSET    0x00001000
-#define STACK_OFFSET     0x00002000
-#define BOOTINFO_OFFSET  0x00003000
-#define BOOT_OFFSET      0x00100000
-#define LOADER_OFFSET    0x1fc00000
-
-#define MSIM_VIDEORAM_ADDRESS  0xb0000000
-#define MSIM_DORDER_ADDRESS    0xb0000100
-#endif
-
-#if defined(MACHINE_lmalta) || defined(MACHINE_bmalta)
-#define CPUMAP_OFFSET    0x00100000
-#define STACK_OFFSET     0x00101000
-#define BOOTINFO_OFFSET  0x00102000
-#define BOOT_OFFSET      0x00200000
-#define LOADER_OFFSET    0x00103000
-
-#define YAMON_SUBR_BASE		PA2KA(0x1fc00500)
-#define YAMON_SUBR_PRINT_COUNT	(YAMON_SUBR_BASE + 0x4)
-#endif
-
-#ifndef __ASM__
-	#define PA2KA(addr)    (((uintptr_t) (addr)) + 0x80000000)
-	#define PA2KSEG(addr)  (((uintptr_t) (addr)) + 0xa0000000)
-	#define KA2PA(addr)    (((uintptr_t) (addr)) - 0x80000000)
-	#define KSEG2PA(addr)  (((uintptr_t) (addr)) - 0xa0000000)
-#else
-	#define PA2KA(addr)    ((addr) + 0x80000000)
-	#define KSEG2PA(addr)  ((addr) - 0xa0000000)
-#endif
-
-#endif
Index: boot/arch/mips32/include/arch/arch.h
===================================================================
--- boot/arch/mips32/include/arch/arch.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
+++ boot/arch/mips32/include/arch/arch.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2006 Martin Decky
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef BOOT_mips32_ARCH_H_
+#define BOOT_mips32_ARCH_H_
+
+#define PAGE_WIDTH  14
+#define PAGE_SIZE   (1 << PAGE_WIDTH)
+
+#if defined(MACHINE_msim)
+#define CPUMAP_OFFSET    0x00001000
+#define STACK_OFFSET     0x00002000
+#define BOOTINFO_OFFSET  0x00003000
+#define BOOT_OFFSET      0x00100000
+#define LOADER_OFFSET    0x1fc00000
+
+#define MSIM_VIDEORAM_ADDRESS  0xb0000000
+#define MSIM_DORDER_ADDRESS    0xb0000100
+#endif
+
+#if defined(MACHINE_lmalta) || defined(MACHINE_bmalta)
+#define CPUMAP_OFFSET    0x00100000
+#define STACK_OFFSET     0x00101000
+#define BOOTINFO_OFFSET  0x00102000
+#define BOOT_OFFSET      0x00200000
+#define LOADER_OFFSET    0x00103000
+
+#define YAMON_SUBR_BASE		PA2KA(0x1fc00500)
+#define YAMON_SUBR_PRINT_COUNT	(YAMON_SUBR_BASE + 0x4)
+#endif
+
+#ifndef __ASM__
+	#define PA2KA(addr)    (((uintptr_t) (addr)) + 0x80000000)
+	#define PA2KSEG(addr)  (((uintptr_t) (addr)) + 0xa0000000)
+	#define KA2PA(addr)    (((uintptr_t) (addr)) - 0x80000000)
+	#define KSEG2PA(addr)  (((uintptr_t) (addr)) - 0xa0000000)
+#else
+	#define PA2KA(addr)    ((addr) + 0x80000000)
+	#define KSEG2PA(addr)  ((addr) - 0xa0000000)
+#endif
+
+#endif
Index: boot/arch/mips32/include/arch/asm.h
===================================================================
--- boot/arch/mips32/include/arch/asm.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
+++ boot/arch/mips32/include/arch/asm.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2006 Martin Decky
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef BOOT_mips32_ASM_H_
+#define BOOT_mips32_ASM_H_
+
+extern void jump_to_kernel(void *, void *) __attribute__((noreturn));
+
+#endif
Index: boot/arch/mips32/include/arch/main.h
===================================================================
--- boot/arch/mips32/include/arch/main.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
+++ boot/arch/mips32/include/arch/main.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2005 Martin Decky
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef BOOT_mips32_MAIN_H_
+#define BOOT_mips32_MAIN_H_
+
+extern void bootstrap(void);
+
+#endif
Index: boot/arch/mips32/include/arch/regname.h
===================================================================
--- boot/arch/mips32/include/arch/regname.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
+++ boot/arch/mips32/include/arch/regname.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2005 Ondrej Palkovsky
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef BOOT_mips32_REGNAME_H_
+#define BOOT_mips32_REGNAME_H_
+
+#define zero    0
+#define at      1
+#define v0      2
+#define v1      3
+#define a0      4
+#define a1      5
+#define a2      6
+#define a3      7
+#define t0      8
+#define t1      9
+#define t2      10
+#define t3      11
+#define t4      12
+#define t5      13
+#define t6      14
+#define t7      15
+#define s0      16
+#define s1      17
+#define s2      18
+#define s3      19
+#define s4      20
+#define s5      21
+#define s6      22
+#define s7      23
+#define t8      24
+#define t9      25
+#define k0      26
+#define k1      27
+#define gp      28
+#define sp      29
+#define s8      30
+#define ra      31
+
+#define rindex    0
+#define rrandom   1
+#define entrylo0  2
+#define entrylo1  3
+#define context   4
+#define pagemask  5
+#define wired     6
+#define badvaddr  8
+#define count     9
+#define entryhi   10
+#define compare   11
+#define status    12
+#define cause     13
+#define epc       14
+#define rconfig   16
+#define lladdr    17
+#define watchlo   18
+#define watchhi   19
+#define xcontext  20
+#define rdebug    23
+#define depc      24
+#define eepc      30
+
+#endif
Index: boot/arch/mips32/include/arch/types.h
===================================================================
--- boot/arch/mips32/include/arch/types.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
+++ boot/arch/mips32/include/arch/types.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2006 Martin Decky
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef BOOT_mips32_TYPES_H_
+#define BOOT_mips32_TYPES_H_
+
+#include <_bits/all.h>
+
+#define TASKMAP_MAX_RECORDS        32
+#define CPUMAP_MAX_RECORDS         32
+#define BOOTINFO_TASK_NAME_BUFLEN  32
+
+typedef struct {
+	/** Address where the task was placed. */
+	void *addr;
+	/** Size of the task's binary. */
+	size_t size;
+	/** Task name. */
+	char name[BOOTINFO_TASK_NAME_BUFLEN];
+} task_t;
+
+typedef struct {
+#if defined(MACHINE_lmalta) || defined(MACHINE_bmalta)
+	uint32_t sdram_size;
+#endif
+	uint32_t cpumap;
+	size_t cnt;
+	task_t tasks[TASKMAP_MAX_RECORDS];
+} bootinfo_t;
+
+#endif
Index: ot/arch/mips32/include/asm.h
===================================================================
--- boot/arch/mips32/include/asm.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ 	(revision )
@@ -1,34 +1,0 @@
-/*
- * Copyright (c) 2006 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef BOOT_mips32_ASM_H_
-#define BOOT_mips32_ASM_H_
-
-extern void jump_to_kernel(void *, void *) __attribute__((noreturn));
-
-#endif
Index: ot/arch/mips32/include/main.h
===================================================================
--- boot/arch/mips32/include/main.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ 	(revision )
@@ -1,34 +1,0 @@
-/*
- * Copyright (c) 2005 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef BOOT_mips32_MAIN_H_
-#define BOOT_mips32_MAIN_H_
-
-extern void bootstrap(void);
-
-#endif
Index: ot/arch/mips32/include/regname.h
===================================================================
--- boot/arch/mips32/include/regname.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ 	(revision )
@@ -1,88 +1,0 @@
-/*
- * Copyright (c) 2005 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef BOOT_mips32_REGNAME_H_
-#define BOOT_mips32_REGNAME_H_
-
-#define zero    0
-#define at      1
-#define v0      2
-#define v1      3
-#define a0      4
-#define a1      5
-#define a2      6
-#define a3      7
-#define t0      8
-#define t1      9
-#define t2      10
-#define t3      11
-#define t4      12
-#define t5      13
-#define t6      14
-#define t7      15
-#define s0      16
-#define s1      17
-#define s2      18
-#define s3      19
-#define s4      20
-#define s5      21
-#define s6      22
-#define s7      23
-#define t8      24
-#define t9      25
-#define k0      26
-#define k1      27
-#define gp      28
-#define sp      29
-#define s8      30
-#define ra      31
-
-#define rindex    0
-#define rrandom   1
-#define entrylo0  2
-#define entrylo1  3
-#define context   4
-#define pagemask  5
-#define wired     6
-#define badvaddr  8
-#define count     9
-#define entryhi   10
-#define compare   11
-#define status    12
-#define cause     13
-#define epc       14
-#define rconfig   16
-#define lladdr    17
-#define watchlo   18
-#define watchhi   19
-#define xcontext  20
-#define rdebug    23
-#define depc      24
-#define eepc      30
-
-#endif
Index: ot/arch/mips32/include/types.h
===================================================================
--- boot/arch/mips32/include/types.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ 	(revision )
@@ -1,61 +1,0 @@
-/*
- * Copyright (c) 2006 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef BOOT_mips32_TYPES_H_
-#define BOOT_mips32_TYPES_H_
-
-#include <arch/common.h>
-
-#define TASKMAP_MAX_RECORDS        32
-#define CPUMAP_MAX_RECORDS         32
-#define BOOTINFO_TASK_NAME_BUFLEN  32
-
-typedef uint32_t size_t;
-typedef uint32_t uintptr_t;
-
-typedef int32_t ptrdiff_t;
-
-typedef struct {
-	/** Address where the task was placed. */
-	void *addr;
-	/** Size of the task's binary. */
-	size_t size;
-	/** Task name. */
-	char name[BOOTINFO_TASK_NAME_BUFLEN];
-} task_t;
-
-typedef struct {
-#if defined(MACHINE_lmalta) || defined(MACHINE_bmalta)
-	uint32_t sdram_size;
-#endif
-	uint32_t cpumap;
-	size_t cnt;
-	task_t tasks[TASKMAP_MAX_RECORDS];
-} bootinfo_t;
-
-#endif
Index: ot/arch/ppc32/include/arch.h
===================================================================
--- boot/arch/ppc32/include/arch.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2006 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef BOOT_ppc32_ARCH_H_
-#define BOOT_ppc32_ARCH_H_
-
-#define PAGE_WIDTH  12
-#define PAGE_SIZE   (1 << PAGE_WIDTH)
-
-#define BOOT_OFFSET  0x8000
-
-#define LOADER_ADDRESS  0x08000000
-
-#ifndef __ASM__
-	#define PA2KA(addr)  (((uintptr_t) (addr)) + 0x80000000)
-#else
-	#define PA2KA(addr)  ((addr) + 0x80000000)
-#endif
-
-#endif
Index: boot/arch/ppc32/include/arch/arch.h
===================================================================
--- boot/arch/ppc32/include/arch/arch.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
+++ boot/arch/ppc32/include/arch/arch.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2006 Martin Decky
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef BOOT_ppc32_ARCH_H_
+#define BOOT_ppc32_ARCH_H_
+
+#define PAGE_WIDTH  12
+#define PAGE_SIZE   (1 << PAGE_WIDTH)
+
+#define BOOT_OFFSET  0x8000
+
+#define LOADER_ADDRESS  0x08000000
+
+#ifndef __ASM__
+	#define PA2KA(addr)  (((uintptr_t) (addr)) + 0x80000000)
+#else
+	#define PA2KA(addr)  ((addr) + 0x80000000)
+#endif
+
+#endif
Index: boot/arch/ppc32/include/arch/asm.h
===================================================================
--- boot/arch/ppc32/include/arch/asm.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
+++ boot/arch/ppc32/include/arch/asm.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2006 Martin Decky
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef BOOT_ppc32_ASM_H_
+#define BOOT_ppc32_ASM_H_
+
+#include <stddef.h>
+#include <arch/main.h>
+
+extern void jump_to_kernel(void *, void *, size_t, void *)
+    __attribute__((noreturn));
+extern void real_mode(void);
+
+#endif
Index: boot/arch/ppc32/include/arch/main.h
===================================================================
--- boot/arch/ppc32/include/arch/main.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
+++ boot/arch/ppc32/include/arch/main.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2005 Martin Decky
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef BOOT_ppc32_MAIN_H_
+#define BOOT_ppc32_MAIN_H_
+
+#include <stddef.h>
+#include <balloc.h>
+#include <genarch/ofw_tree.h>
+
+typedef struct {
+	memmap_t memmap;
+	taskmap_t taskmap;
+	ballocs_t ballocs;
+	ofw_tree_node_t *ofw_root;
+} bootinfo_t;
+
+extern void bootstrap(void);
+
+#endif
Index: boot/arch/ppc32/include/arch/ofw.h
===================================================================
--- boot/arch/ppc32/include/arch/ofw.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
+++ boot/arch/ppc32/include/arch/ofw.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2006 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef BOOT_ppc32_OFWARCH_H_
+#define BOOT_ppc32_OFWARCH_H_
+
+#define OFW_ADDRESS_CELLS  1
+#define OFW_SIZE_CELLS     1
+
+#endif
Index: boot/arch/ppc32/include/arch/regname.h
===================================================================
--- boot/arch/ppc32/include/arch/regname.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
+++ boot/arch/ppc32/include/arch/regname.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -0,0 +1,226 @@
+/*
+ * Copyright (c) 2005 Martin Decky
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef BOOT_ppc32_REGNAME_H_
+#define BOOT_ppc32_REGNAME_H_
+
+/* Condition Register Bit Fields */
+#define cr0  0
+#define cr1  1
+#define cr2  2
+#define cr3  3
+#define cr4  4
+#define cr5  5
+#define cr6  6
+#define cr7  7
+
+/* General Purpose Registers (GPRs) */
+#define r0   0
+#define r1   1
+#define r2   2
+#define r3   3
+#define r4   4
+#define r5   5
+#define r6   6
+#define r7   7
+#define r8   8
+#define r9   9
+#define r10  10
+#define r11  11
+#define r12  12
+#define r13  13
+#define r14  14
+#define r15  15
+#define r16  16
+#define r17  17
+#define r18  18
+#define r19  19
+#define r20  20
+#define r21  21
+#define r22  22
+#define r23  23
+#define r24  24
+#define r25  25
+#define r26  26
+#define r27  27
+#define r28  28
+#define r29  29
+#define r30  30
+#define r31  31
+
+/* GPR Aliases */
+#define sp  1
+
+/* Floating Point Registers (FPRs) */
+#define fr0   0
+#define fr1   1
+#define fr2   2
+#define fr3   3
+#define fr4   4
+#define fr5   5
+#define fr6   6
+#define fr7   7
+#define fr8   8
+#define fr9   9
+#define fr10  10
+#define fr11  11
+#define fr12  12
+#define fr13  13
+#define fr14  14
+#define fr15  15
+#define fr16  16
+#define fr17  17
+#define fr18  18
+#define fr19  19
+#define fr20  20
+#define fr21  21
+#define fr22  22
+#define fr23  23
+#define fr24  24
+#define fr25  25
+#define fr26  26
+#define fr27  27
+#define fr28  28
+#define fr29  29
+#define fr30  30
+#define fr31  31
+
+#define vr0   0
+#define vr1   1
+#define vr2   2
+#define vr3   3
+#define vr4   4
+#define vr5   5
+#define vr6   6
+#define vr7   7
+#define vr8   8
+#define vr9   9
+#define vr10  10
+#define vr11  11
+#define vr12  12
+#define vr13  13
+#define vr14  14
+#define vr15  15
+#define vr16  16
+#define vr17  17
+#define vr18  18
+#define vr19  19
+#define vr20  20
+#define vr21  21
+#define vr22  22
+#define vr23  23
+#define vr24  24
+#define vr25  25
+#define vr26  26
+#define vr27  27
+#define vr28  28
+#define vr29  29
+#define vr30  30
+#define vr31  31
+
+#define evr0   0
+#define evr1   1
+#define evr2   2
+#define evr3   3
+#define evr4   4
+#define evr5   5
+#define evr6   6
+#define evr7   7
+#define evr8   8
+#define evr9   9
+#define evr10  10
+#define evr11  11
+#define evr12  12
+#define evr13  13
+#define evr14  14
+#define evr15  15
+#define evr16  16
+#define evr17  17
+#define evr18  18
+#define evr19  19
+#define evr20  20
+#define evr21  21
+#define evr22  22
+#define evr23  23
+#define evr24  24
+#define evr25  25
+#define evr26  26
+#define evr27  27
+#define evr28  28
+#define evr29  29
+#define evr30  30
+#define evr31  31
+
+/* Special Purpose Registers (SPRs) */
+#define xer      1
+#define lr       8
+#define ctr      9
+#define dec      22
+#define sdr1     25
+#define srr0     26
+#define srr1     27
+#define sprg0    272
+#define sprg1    273
+#define sprg2    274
+#define sprg3    275
+#define prv      287
+#define ibat0u   528
+#define ibat0l   529
+#define ibat1u   530
+#define ibat1l   531
+#define ibat2u   532
+#define ibat2l   533
+#define ibat3u   534
+#define ibat3l   535
+#define dbat0u   536
+#define dbat0l   537
+#define dbat1u   538
+#define dbat1l   539
+#define dbat2u   540
+#define dbat2l   541
+#define dbat3u   542
+#define dbat3l   543
+#define tlbmiss  980
+#define ptehi    981
+#define ptelo    982
+#define hid0     1008
+
+/* MSR bits */
+#define msr_dr  (1 << 4)
+#define msr_ir  (1 << 5)
+#define msr_pr  (1 << 14)
+#define msr_ee  (1 << 15)
+
+/* HID0 bits */
+#define hid0_sten  (1 << 24)
+#define hid0_ice   (1 << 15)
+#define hid0_dce   (1 << 14)
+#define hid0_icfi  (1 << 11)
+#define hid0_dci   (1 << 10)
+
+#endif
Index: boot/arch/ppc32/include/arch/types.h
===================================================================
--- boot/arch/ppc32/include/arch/types.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
+++ boot/arch/ppc32/include/arch/types.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2006 Martin Decky
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef BOOT_ppc32_TYPES_H_
+#define BOOT_ppc32_TYPES_H_
+
+#include <_bits/all.h>
+
+#define TASKMAP_MAX_RECORDS        32
+#define BOOTINFO_TASK_NAME_BUFLEN  32
+
+typedef struct {
+	void *addr;
+	size_t size;
+	char name[BOOTINFO_TASK_NAME_BUFLEN];
+} task_t;
+
+typedef struct {
+	size_t cnt;
+	task_t tasks[TASKMAP_MAX_RECORDS];
+} taskmap_t;
+
+#endif
Index: ot/arch/ppc32/include/asm.h
===================================================================
--- boot/arch/ppc32/include/asm.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ 	(revision )
@@ -1,39 +1,0 @@
-/*
- * Copyright (c) 2006 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef BOOT_ppc32_ASM_H_
-#define BOOT_ppc32_ASM_H_
-
-#include <stddef.h>
-#include <arch/main.h>
-
-extern void jump_to_kernel(void *, void *, size_t, void *)
-    __attribute__((noreturn));
-extern void real_mode(void);
-
-#endif
Index: ot/arch/ppc32/include/main.h
===================================================================
--- boot/arch/ppc32/include/main.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2005 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef BOOT_ppc32_MAIN_H_
-#define BOOT_ppc32_MAIN_H_
-
-#include <stddef.h>
-#include <balloc.h>
-#include <genarch/ofw_tree.h>
-
-typedef struct {
-	memmap_t memmap;
-	taskmap_t taskmap;
-	ballocs_t ballocs;
-	ofw_tree_node_t *ofw_root;
-} bootinfo_t;
-
-extern void bootstrap(void);
-
-#endif
Index: ot/arch/ppc32/include/ofw.h
===================================================================
--- boot/arch/ppc32/include/ofw.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ 	(revision )
@@ -1,35 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef BOOT_ppc32_OFWARCH_H_
-#define BOOT_ppc32_OFWARCH_H_
-
-#define OFW_ADDRESS_CELLS  1
-#define OFW_SIZE_CELLS     1
-
-#endif
Index: ot/arch/ppc32/include/regname.h
===================================================================
--- boot/arch/ppc32/include/regname.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ 	(revision )
@@ -1,226 +1,0 @@
-/*
- * Copyright (c) 2005 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef BOOT_ppc32_REGNAME_H_
-#define BOOT_ppc32_REGNAME_H_
-
-/* Condition Register Bit Fields */
-#define cr0  0
-#define cr1  1
-#define cr2  2
-#define cr3  3
-#define cr4  4
-#define cr5  5
-#define cr6  6
-#define cr7  7
-
-/* General Purpose Registers (GPRs) */
-#define r0   0
-#define r1   1
-#define r2   2
-#define r3   3
-#define r4   4
-#define r5   5
-#define r6   6
-#define r7   7
-#define r8   8
-#define r9   9
-#define r10  10
-#define r11  11
-#define r12  12
-#define r13  13
-#define r14  14
-#define r15  15
-#define r16  16
-#define r17  17
-#define r18  18
-#define r19  19
-#define r20  20
-#define r21  21
-#define r22  22
-#define r23  23
-#define r24  24
-#define r25  25
-#define r26  26
-#define r27  27
-#define r28  28
-#define r29  29
-#define r30  30
-#define r31  31
-
-/* GPR Aliases */
-#define sp  1
-
-/* Floating Point Registers (FPRs) */
-#define fr0   0
-#define fr1   1
-#define fr2   2
-#define fr3   3
-#define fr4   4
-#define fr5   5
-#define fr6   6
-#define fr7   7
-#define fr8   8
-#define fr9   9
-#define fr10  10
-#define fr11  11
-#define fr12  12
-#define fr13  13
-#define fr14  14
-#define fr15  15
-#define fr16  16
-#define fr17  17
-#define fr18  18
-#define fr19  19
-#define fr20  20
-#define fr21  21
-#define fr22  22
-#define fr23  23
-#define fr24  24
-#define fr25  25
-#define fr26  26
-#define fr27  27
-#define fr28  28
-#define fr29  29
-#define fr30  30
-#define fr31  31
-
-#define vr0   0
-#define vr1   1
-#define vr2   2
-#define vr3   3
-#define vr4   4
-#define vr5   5
-#define vr6   6
-#define vr7   7
-#define vr8   8
-#define vr9   9
-#define vr10  10
-#define vr11  11
-#define vr12  12
-#define vr13  13
-#define vr14  14
-#define vr15  15
-#define vr16  16
-#define vr17  17
-#define vr18  18
-#define vr19  19
-#define vr20  20
-#define vr21  21
-#define vr22  22
-#define vr23  23
-#define vr24  24
-#define vr25  25
-#define vr26  26
-#define vr27  27
-#define vr28  28
-#define vr29  29
-#define vr30  30
-#define vr31  31
-
-#define evr0   0
-#define evr1   1
-#define evr2   2
-#define evr3   3
-#define evr4   4
-#define evr5   5
-#define evr6   6
-#define evr7   7
-#define evr8   8
-#define evr9   9
-#define evr10  10
-#define evr11  11
-#define evr12  12
-#define evr13  13
-#define evr14  14
-#define evr15  15
-#define evr16  16
-#define evr17  17
-#define evr18  18
-#define evr19  19
-#define evr20  20
-#define evr21  21
-#define evr22  22
-#define evr23  23
-#define evr24  24
-#define evr25  25
-#define evr26  26
-#define evr27  27
-#define evr28  28
-#define evr29  29
-#define evr30  30
-#define evr31  31
-
-/* Special Purpose Registers (SPRs) */
-#define xer      1
-#define lr       8
-#define ctr      9
-#define dec      22
-#define sdr1     25
-#define srr0     26
-#define srr1     27
-#define sprg0    272
-#define sprg1    273
-#define sprg2    274
-#define sprg3    275
-#define prv      287
-#define ibat0u   528
-#define ibat0l   529
-#define ibat1u   530
-#define ibat1l   531
-#define ibat2u   532
-#define ibat2l   533
-#define ibat3u   534
-#define ibat3l   535
-#define dbat0u   536
-#define dbat0l   537
-#define dbat1u   538
-#define dbat1l   539
-#define dbat2u   540
-#define dbat2l   541
-#define dbat3u   542
-#define dbat3l   543
-#define tlbmiss  980
-#define ptehi    981
-#define ptelo    982
-#define hid0     1008
-
-/* MSR bits */
-#define msr_dr  (1 << 4)
-#define msr_ir  (1 << 5)
-#define msr_pr  (1 << 14)
-#define msr_ee  (1 << 15)
-
-/* HID0 bits */
-#define hid0_sten  (1 << 24)
-#define hid0_ice   (1 << 15)
-#define hid0_dce   (1 << 14)
-#define hid0_icfi  (1 << 11)
-#define hid0_dci   (1 << 10)
-
-#endif
Index: ot/arch/ppc32/include/types.h
===================================================================
--- boot/arch/ppc32/include/types.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ 	(revision )
@@ -1,55 +1,0 @@
-/*
- * Copyright (c) 2006 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef BOOT_ppc32_TYPES_H_
-#define BOOT_ppc32_TYPES_H_
-
-#include <arch/common.h>
-
-#define TASKMAP_MAX_RECORDS        32
-#define BOOTINFO_TASK_NAME_BUFLEN  32
-
-typedef uint32_t size_t;
-typedef uint32_t uintptr_t;
-typedef uint32_t sysarg_t;
-typedef int32_t native_t;
-
-typedef int32_t ptrdiff_t;
-
-typedef struct {
-	void *addr;
-	size_t size;
-	char name[BOOTINFO_TASK_NAME_BUFLEN];
-} task_t;
-
-typedef struct {
-	size_t cnt;
-	task_t tasks[TASKMAP_MAX_RECORDS];
-} taskmap_t;
-
-#endif
Index: ot/arch/riscv64/include/arch.h
===================================================================
--- boot/arch/riscv64/include/arch.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ 	(revision )
@@ -1,44 +1,0 @@
-/*
- * Copyright (c) 2016 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef BOOT_riscv64_ARCH_H_
-#define BOOT_riscv64_ARCH_H_
-
-#define PAGE_WIDTH  12
-#define PAGE_SIZE   (1 << PAGE_WIDTH)
-
-#define BOOT_STACK_SIZE  PAGE_SIZE
-
-#define PHYSMEM_START  0x40000000
-#define PHYSMEM_SIZE   1073741824
-#define BOOT_OFFSET    0x48000000
-
-#define DEFAULT_MTVEC      0x00000100
-#define TRAP_VECTOR_RESET  0x0100
-
-#endif
Index: boot/arch/riscv64/include/arch/arch.h
===================================================================
--- boot/arch/riscv64/include/arch/arch.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
+++ boot/arch/riscv64/include/arch/arch.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2016 Martin Decky
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef BOOT_riscv64_ARCH_H_
+#define BOOT_riscv64_ARCH_H_
+
+#define PAGE_WIDTH  12
+#define PAGE_SIZE   (1 << PAGE_WIDTH)
+
+#define BOOT_STACK_SIZE  PAGE_SIZE
+
+#define PHYSMEM_START  0x40000000
+#define PHYSMEM_SIZE   1073741824
+#define BOOT_OFFSET    0x48000000
+
+#define DEFAULT_MTVEC      0x00000100
+#define TRAP_VECTOR_RESET  0x0100
+
+#endif
Index: boot/arch/riscv64/include/arch/asm.h
===================================================================
--- boot/arch/riscv64/include/arch/asm.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
+++ boot/arch/riscv64/include/arch/asm.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2016 Martin Decky
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef BOOT_riscv64_ASM_H_
+#define BOOT_riscv64_ASM_H_
+
+#include <stddef.h>
+
+extern char htif_page[];
+extern char pt_page[];
+
+extern void jump_to_kernel(uintptr_t)
+    __attribute__((noreturn));
+
+#endif
Index: boot/arch/riscv64/include/arch/main.h
===================================================================
--- boot/arch/riscv64/include/arch/main.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
+++ boot/arch/riscv64/include/arch/main.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2016 Martin Decky
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef BOOT_riscv64_MAIN_H_
+#define BOOT_riscv64_MAIN_H_
+
+extern void bootstrap(void);
+
+#endif
Index: boot/arch/riscv64/include/arch/mm.h
===================================================================
--- boot/arch/riscv64/include/arch/mm.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
+++ boot/arch/riscv64/include/arch/mm.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2017 Martin Decky
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @file
+ */
+
+#ifndef BOOT_riscv64_MM_H_
+#define BOOT_riscv64_MM_H_
+
+#ifndef __ASM__
+	#define KA2PA(x)  (((uintptr_t) (x)) - UINT64_C(0xffff800000000000))
+	#define PA2KA(x)  (((uintptr_t) (x)) + UINT64_C(0xffff800000000000))
+#else
+	#define KA2PA(x)  ((x) - 0xffff800000000000)
+	#define PA2KA(x)  ((x) + 0xffff800000000000)
+#endif
+
+#define PTL_DIRTY       (1 << 7)
+#define PTL_ACCESSED    (1 << 6)
+#define PTL_GLOBAL      (1 << 5)
+#define PTL_USER        (1 << 4)
+#define PTL_EXECUTABLE  (1 << 3)
+#define PTL_WRITABLE    (1 << 2)
+#define PTL_READABLE    (1 << 1)
+#define PTL_VALID       1
+
+#endif
+
+/** @}
+ */
Index: boot/arch/riscv64/include/arch/types.h
===================================================================
--- boot/arch/riscv64/include/arch/types.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
+++ boot/arch/riscv64/include/arch/types.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2016 Martin Decky
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef BOOT_riscv64_TYPES_H_
+#define BOOT_riscv64_TYPES_H_
+
+#include <_bits/all.h>
+
+#define MEMMAP_MAX_RECORDS         32
+#define TASKMAP_MAX_RECORDS        32
+#define BOOTINFO_TASK_NAME_BUFLEN  32
+
+typedef struct {
+	volatile uint64_t *tohost;
+	volatile uint64_t *fromhost;
+} ucbinfo_t;
+
+typedef struct {
+	void *start;
+	size_t size;
+} memzone_t;
+
+typedef struct {
+	uint64_t total;
+	size_t cnt;
+	memzone_t zones[MEMMAP_MAX_RECORDS];
+} memmap_t;
+
+typedef struct {
+	/** Address where the task was placed. */
+	void *addr;
+	/** Size of the task's binary. */
+	size_t size;
+	/** Task name. */
+	char name[BOOTINFO_TASK_NAME_BUFLEN];
+} task_t;
+
+typedef struct {
+	size_t cnt;
+	task_t tasks[TASKMAP_MAX_RECORDS];
+} taskmap_t;
+
+typedef struct {
+	ucbinfo_t ucbinfo;
+	uintptr_t physmem_start;
+	uintptr_t htif_frame;
+	uintptr_t pt_frame;
+	memmap_t memmap;
+	taskmap_t taskmap;
+} bootinfo_t;
+
+#endif
Index: boot/arch/riscv64/include/arch/ucb.h
===================================================================
--- boot/arch/riscv64/include/arch/ucb.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
+++ boot/arch/riscv64/include/arch/ucb.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2016 Martin Decky
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef BOOT_riscv64_UCB_H_
+#define BOOT_riscv64_UCB_H_
+
+/** University of California, Berkeley extensions to RISC-V
+ *
+ * Non-standard host-target interface extension targeting
+ * primarily the Spike ISA Simulator.
+ */
+
+#include <stddef.h>
+
+extern volatile uint64_t tohost;
+extern volatile uint64_t fromhost;
+
+#define HTIF_DEVICE_CONSOLE  1
+
+#define HTIF_CONSOLE_PUTC  1
+
+extern void htif_cmd(uint8_t device, uint8_t cmd, uint64_t payload);
+
+#endif
Index: ot/arch/riscv64/include/asm.h
===================================================================
--- boot/arch/riscv64/include/asm.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ 	(revision )
@@ -1,40 +1,0 @@
-/*
- * Copyright (c) 2016 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef BOOT_riscv64_ASM_H_
-#define BOOT_riscv64_ASM_H_
-
-#include <stddef.h>
-
-extern char htif_page[];
-extern char pt_page[];
-
-extern void jump_to_kernel(uintptr_t)
-    __attribute__((noreturn));
-
-#endif
Index: ot/arch/riscv64/include/main.h
===================================================================
--- boot/arch/riscv64/include/main.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ 	(revision )
@@ -1,34 +1,0 @@
-/*
- * Copyright (c) 2016 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef BOOT_riscv64_MAIN_H_
-#define BOOT_riscv64_MAIN_H_
-
-extern void bootstrap(void);
-
-#endif
Index: ot/arch/riscv64/include/mm.h
===================================================================
--- boot/arch/riscv64/include/mm.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ 	(revision )
@@ -1,55 +1,0 @@
-/*
- * Copyright (c) 2017 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file
- */
-
-#ifndef BOOT_riscv64_MM_H_
-#define BOOT_riscv64_MM_H_
-
-#ifndef __ASM__
-	#define KA2PA(x)  (((uintptr_t) (x)) - UINT64_C(0xffff800000000000))
-	#define PA2KA(x)  (((uintptr_t) (x)) + UINT64_C(0xffff800000000000))
-#else
-	#define KA2PA(x)  ((x) - 0xffff800000000000)
-	#define PA2KA(x)  ((x) + 0xffff800000000000)
-#endif
-
-#define PTL_DIRTY       (1 << 7)
-#define PTL_ACCESSED    (1 << 6)
-#define PTL_GLOBAL      (1 << 5)
-#define PTL_USER        (1 << 4)
-#define PTL_EXECUTABLE  (1 << 3)
-#define PTL_WRITABLE    (1 << 2)
-#define PTL_READABLE    (1 << 1)
-#define PTL_VALID       1
-
-#endif
-
-/** @}
- */
Index: ot/arch/riscv64/include/types.h
===================================================================
--- boot/arch/riscv64/include/types.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ 	(revision )
@@ -1,82 +1,0 @@
-/*
- * Copyright (c) 2016 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef BOOT_riscv64_TYPES_H_
-#define BOOT_riscv64_TYPES_H_
-
-#include <arch/common.h>
-
-#define MEMMAP_MAX_RECORDS         32
-#define TASKMAP_MAX_RECORDS        32
-#define BOOTINFO_TASK_NAME_BUFLEN  32
-
-typedef uint64_t size_t;
-typedef uint64_t uintptr_t;
-
-typedef int64_t ptrdiff_t;
-
-typedef struct {
-	volatile uint64_t *tohost;
-	volatile uint64_t *fromhost;
-} ucbinfo_t;
-
-typedef struct {
-	void *start;
-	size_t size;
-} memzone_t;
-
-typedef struct {
-	uint64_t total;
-	size_t cnt;
-	memzone_t zones[MEMMAP_MAX_RECORDS];
-} memmap_t;
-
-typedef struct {
-	/** Address where the task was placed. */
-	void *addr;
-	/** Size of the task's binary. */
-	size_t size;
-	/** Task name. */
-	char name[BOOTINFO_TASK_NAME_BUFLEN];
-} task_t;
-
-typedef struct {
-	size_t cnt;
-	task_t tasks[TASKMAP_MAX_RECORDS];
-} taskmap_t;
-
-typedef struct {
-	ucbinfo_t ucbinfo;
-	uintptr_t physmem_start;
-	uintptr_t htif_frame;
-	uintptr_t pt_frame;
-	memmap_t memmap;
-	taskmap_t taskmap;
-} bootinfo_t;
-
-#endif
Index: ot/arch/riscv64/include/ucb.h
===================================================================
--- boot/arch/riscv64/include/ucb.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ 	(revision )
@@ -1,49 +1,0 @@
-/*
- * Copyright (c) 2016 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef BOOT_riscv64_UCB_H_
-#define BOOT_riscv64_UCB_H_
-
-/** University of California, Berkeley extensions to RISC-V
- *
- * Non-standard host-target interface extension targeting
- * primarily the Spike ISA Simulator.
- */
-
-#include <stddef.h>
-
-extern volatile uint64_t tohost;
-extern volatile uint64_t fromhost;
-
-#define HTIF_DEVICE_CONSOLE  1
-
-#define HTIF_CONSOLE_PUTC  1
-
-extern void htif_cmd(uint8_t device, uint8_t cmd, uint64_t payload);
-
-#endif
Index: ot/arch/sparc64/include/arch.h
===================================================================
--- boot/arch/sparc64/include/arch.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ 	(revision )
@@ -1,66 +1,0 @@
-/*
- * Copyright (c) 2006 Martin Decky
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef BOOT_sparc64_ARCH_H_
-#define BOOT_sparc64_ARCH_H_
-
-#define PAGE_WIDTH  14
-#define PAGE_SIZE   (1 << PAGE_WIDTH)
-
-#define LOADER_ADDRESS  0x004000
-#define KERNEL_ADDRESS  0x400000
-
-#define STACK_SIZE                   8192
-#define STACK_ALIGNMENT              16
-#define STACK_BIAS                   2047
-#define STACK_WINDOW_SAVE_AREA_SIZE  (16 * 8)
-#define STACK_ARG_SAVE_AREA_SIZE     (6 * 8)
-
-#define NWINDOWS  8
-
-#define PSTATE_IE_BIT    2
-#define PSTATE_PRIV_BIT  4
-#define PSTATE_AM_BIT    8
-
-#define ASI_ICBUS_CONFIG        0x4a
-#define ICBUS_CONFIG_MID_SHIFT  17
-
-/** Constants to distinguish particular UltraSPARC architecture */
-#define ARCH_SUN4U  10
-#define ARCH_SUN4V  20
-
-/** Constants to distinguish particular UltraSPARC subarchitecture */
-#define SUBARCH_UNKNOWN  0
-#define SUBARCH_US       1
-#define SUBARCH_US3      3
-
-#define BSP_PROCESSOR  1
-#define AP_PROCESSOR   0
-
-#endif
Index: boot/arch/sparc64/include/arch/arch.h
===================================================================
--- boot/arch/sparc64/include/arch/arch.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
+++ boot/arch/sparc64/include/arch/arch.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2006 Martin Decky
+ * Copyright (c) 2006 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef BOOT_sparc64_ARCH_H_
+#define BOOT_sparc64_ARCH_H_
+
+#define PAGE_WIDTH  14
+#define PAGE_SIZE   (1 << PAGE_WIDTH)
+
+#define LOADER_ADDRESS  0x004000
+#define KERNEL_ADDRESS  0x400000
+
+#define STACK_SIZE                   8192
+#define STACK_ALIGNMENT              16
+#define STACK_BIAS                   2047
+#define STACK_WINDOW_SAVE_AREA_SIZE  (16 * 8)
+#define STACK_ARG_SAVE_AREA_SIZE     (6 * 8)
+
+#define NWINDOWS  8
+
+#define PSTATE_IE_BIT    2
+#define PSTATE_PRIV_BIT  4
+#define PSTATE_AM_BIT    8
+
+#define ASI_ICBUS_CONFIG        0x4a
+#define ICBUS_CONFIG_MID_SHIFT  17
+
+/** Constants to distinguish particular UltraSPARC architecture */
+#define ARCH_SUN4U  10
+#define ARCH_SUN4V  20
+
+/** Constants to distinguish particular UltraSPARC subarchitecture */
+#define SUBARCH_UNKNOWN  0
+#define SUBARCH_US       1
+#define SUBARCH_US3      3
+
+#define BSP_PROCESSOR  1
+#define AP_PROCESSOR   0
+
+#endif
Index: boot/arch/sparc64/include/arch/asm.h
===================================================================
--- boot/arch/sparc64/include/arch/asm.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
+++ boot/arch/sparc64/include/arch/asm.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2006 Martin Decky
+ * Copyright (c) 2006 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef BOOT_sparc64_ASM_H_
+#define BOOT_sparc64_ASM_H_
+
+#include <stdint.h>
+
+extern void jump_to_kernel(uintptr_t physmem_start, bootinfo_t *bootinfo,
+    uint8_t subarch, void *entry) __attribute__((noreturn));
+
+#endif
Index: boot/arch/sparc64/include/arch/main.h
===================================================================
--- boot/arch/sparc64/include/arch/main.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
+++ boot/arch/sparc64/include/arch/main.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2005 Martin Decky
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef BOOT_sparc64_MAIN_H_
+#define BOOT_sparc64_MAIN_H_
+
+#include <stdint.h>
+#include <balloc.h>
+#include <genarch/ofw_tree.h>
+
+typedef struct {
+	uintptr_t physmem_start;
+	taskmap_t taskmap;
+	memmap_t memmap;
+	ballocs_t ballocs;
+	ofw_tree_node_t *ofw_root;
+} bootinfo_t;
+
+extern void bootstrap(void);
+
+#endif
Index: boot/arch/sparc64/include/arch/ofw.h
===================================================================
--- boot/arch/sparc64/include/arch/ofw.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
+++ boot/arch/sparc64/include/arch/ofw.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2006 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef BOOT_sparc64_OFW_H_
+#define BOOT_sparc64_OFW_H_
+
+#include <stdint.h>
+
+#define OFW_ADDRESS_CELLS  2
+#define OFW_SIZE_CELLS     2
+
+extern uintptr_t ofw_get_physmem_start(void);
+extern void ofw_cpu(uint16_t, uintptr_t);
+
+#endif
Index: boot/arch/sparc64/include/arch/types.h
===================================================================
--- boot/arch/sparc64/include/arch/types.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
+++ boot/arch/sparc64/include/arch/types.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2006 Martin Decky
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef BOOT_sparc64_TYPES_H_
+#define BOOT_sparc64_TYPES_H_
+
+#include <_bits/all.h>
+
+#define TASKMAP_MAX_RECORDS        32
+#define BOOTINFO_TASK_NAME_BUFLEN  32
+
+typedef struct {
+	void *addr;
+	size_t size;
+	char name[BOOTINFO_TASK_NAME_BUFLEN];
+} task_t;
+
+typedef struct {
+	size_t cnt;
+	task_t tasks[TASKMAP_MAX_RECORDS];
+} taskmap_t;
+
+#endif
Index: ot/arch/sparc64/include/asm.h
===================================================================
--- boot/arch/sparc64/include/asm.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ 	(revision )
@@ -1,38 +1,0 @@
-/*
- * Copyright (c) 2006 Martin Decky
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef BOOT_sparc64_ASM_H_
-#define BOOT_sparc64_ASM_H_
-
-#include <stdint.h>
-
-extern void jump_to_kernel(uintptr_t physmem_start, bootinfo_t *bootinfo,
-    uint8_t subarch, void *entry) __attribute__((noreturn));
-
-#endif
Index: ot/arch/sparc64/include/main.h
===================================================================
--- boot/arch/sparc64/include/main.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ 	(revision )
@@ -1,46 +1,0 @@
-/*
- * Copyright (c) 2005 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef BOOT_sparc64_MAIN_H_
-#define BOOT_sparc64_MAIN_H_
-
-#include <stdint.h>
-#include <balloc.h>
-#include <genarch/ofw_tree.h>
-
-typedef struct {
-	uintptr_t physmem_start;
-	taskmap_t taskmap;
-	memmap_t memmap;
-	ballocs_t ballocs;
-	ofw_tree_node_t *ofw_root;
-} bootinfo_t;
-
-extern void bootstrap(void);
-
-#endif
Index: ot/arch/sparc64/include/ofw.h
===================================================================
--- boot/arch/sparc64/include/ofw.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ 	(revision )
@@ -1,40 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef BOOT_sparc64_OFW_H_
-#define BOOT_sparc64_OFW_H_
-
-#include <stdint.h>
-
-#define OFW_ADDRESS_CELLS  2
-#define OFW_SIZE_CELLS     2
-
-extern uintptr_t ofw_get_physmem_start(void);
-extern void ofw_cpu(uint16_t, uintptr_t);
-
-#endif
Index: ot/arch/sparc64/include/types.h
===================================================================
--- boot/arch/sparc64/include/types.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ 	(revision )
@@ -1,55 +1,0 @@
-/*
- * Copyright (c) 2006 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef BOOT_sparc64_TYPES_H_
-#define BOOT_sparc64_TYPES_H_
-
-#include <arch/common.h>
-
-#define TASKMAP_MAX_RECORDS        32
-#define BOOTINFO_TASK_NAME_BUFLEN  32
-
-typedef uint64_t size_t;
-typedef uint64_t uintptr_t;
-typedef uint64_t sysarg_t;
-typedef int64_t native_t;
-
-typedef int64_t ptrdiff_t;
-
-typedef struct {
-	void *addr;
-	size_t size;
-	char name[BOOTINFO_TASK_NAME_BUFLEN];
-} task_t;
-
-typedef struct {
-	size_t cnt;
-	task_t tasks[TASKMAP_MAX_RECORDS];
-} taskmap_t;
-
-#endif
Index: ot/genarch/include/division.h
===================================================================
--- boot/genarch/include/division.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ 	(revision )
@@ -1,57 +1,0 @@
-/*
- * Copyright (c) 2006 Josef Cejka
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file
- */
-
-#ifndef BOOT_DIVISION_H_
-#define BOOT_DIVISION_H_
-
-extern int __divsi3(int, int);
-extern long long __divdi3(long long, long long);
-
-extern unsigned int __udivsi3(unsigned int, unsigned int);
-extern unsigned long long __udivdi3(unsigned long long, unsigned long long);
-
-extern int __modsi3(int, int);
-extern long long __moddi3(long long, long long);
-
-extern unsigned int __umodsi3(unsigned int, unsigned int);
-extern unsigned long long __umoddi3(unsigned long long, unsigned long long);
-
-extern int __divmodsi3(int, int, int *);
-extern unsigned int __udivmodsi3(unsigned int, unsigned int, unsigned int *);
-
-extern long long __divmoddi3(long long, long long, long long *);
-extern unsigned long long __udivmoddi3(unsigned long long, unsigned long long,
-    unsigned long long *);
-
-#endif
-
-/** @}
- */
Index: ot/genarch/include/efi.h
===================================================================
--- boot/genarch/include/efi.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ 	(revision )
@@ -1,108 +1,0 @@
-/*
- * Copyright (c) 2011 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef BOOT_EFI_H_
-#define BOOT_EFI_H_
-
-#include <arch/types.h>
-
-typedef struct {
-	uint64_t signature;
-	uint32_t revision;
-	uint32_t header_size;
-	uint32_t crc32;
-	uint32_t reserved;
-} efi_table_header_t;
-
-#define SAL_SYSTEM_TABLE_GUID \
-	{ \
-		{ \
-			0x32, 0x2d, 0x9d, 0xeb, 0x88, 0x2d, 0xd3, 0x11, \
-			0x9a, 0x16, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d \
-		} \
-	}
-
-typedef union {
-	uint8_t bytes[16];
-	struct {
-		uint64_t low;
-		uint64_t high;
-	};
-} efi_guid_t;
-
-typedef struct {
-	efi_guid_t guid;
-	void *table;
-} efi_configuration_table_t;
-
-typedef struct {
-	efi_table_header_t hdr;
-	char *fw_vendor;
-	uint32_t fw_revision;
-	void *cons_in_handle;
-	void *cons_in;
-	void *cons_out_handle;
-	void *cons_out;
-	void *cons_err_handle;
-	void *cons_err;
-	void *runtime_services;
-	void *boot_services;
-	sysarg_t conf_table_entries;
-	efi_configuration_table_t *conf_table;
-} efi_system_table_t;
-
-typedef enum {
-	EFI_RESERVED,
-	EFI_LOADER_CODE,
-	EFI_LOADER_DATA,
-	EFI_BOOT_SERVICES_CODE,
-	EFI_BOOT_SERVICES_DATA,
-	EFI_RUNTIME_SERVICES_CODE,
-	EFI_RUNTIME_SERVICES_DATA,
-	EFI_CONVENTIONAL_MEMORY,
-	EFI_UNUSABLE_MEMORY,
-	EFI_ACPI_RECLAIM_MEMORY,
-	EFI_ACPI_MEMORY_NVS,
-	EFI_MEMORY_MAPPED_IO,
-	EFI_MEMORY_MAPPED_IO_PORT_SPACE,
-	EFI_PAL_CODE
-} efi_memory_type_t;
-
-typedef struct {
-	uint32_t type;
-	uint64_t phys_start;
-	uint64_t virt_start;
-	uint64_t pages;
-	uint64_t attribute;
-} efi_v1_memdesc_t;
-
-#define EFI_PAGE_SIZE	4096
-
-extern void *efi_vendor_table_find(efi_system_table_t *, efi_guid_t);
-
-#endif
Index: boot/genarch/include/genarch/division.h
===================================================================
--- boot/genarch/include/genarch/division.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
+++ boot/genarch/include/genarch/division.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2006 Josef Cejka
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @file
+ */
+
+#ifndef BOOT_DIVISION_H_
+#define BOOT_DIVISION_H_
+
+extern int __divsi3(int, int);
+extern long long __divdi3(long long, long long);
+
+extern unsigned int __udivsi3(unsigned int, unsigned int);
+extern unsigned long long __udivdi3(unsigned long long, unsigned long long);
+
+extern int __modsi3(int, int);
+extern long long __moddi3(long long, long long);
+
+extern unsigned int __umodsi3(unsigned int, unsigned int);
+extern unsigned long long __umoddi3(unsigned long long, unsigned long long);
+
+extern int __divmodsi3(int, int, int *);
+extern unsigned int __udivmodsi3(unsigned int, unsigned int, unsigned int *);
+
+extern long long __divmoddi3(long long, long long, long long *);
+extern unsigned long long __udivmoddi3(unsigned long long, unsigned long long,
+    unsigned long long *);
+
+#endif
+
+/** @}
+ */
Index: boot/genarch/include/genarch/efi.h
===================================================================
--- boot/genarch/include/genarch/efi.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
+++ boot/genarch/include/genarch/efi.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -0,0 +1,108 @@
+/*
+ * Copyright (c) 2011 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef BOOT_EFI_H_
+#define BOOT_EFI_H_
+
+#include <arch/types.h>
+
+typedef struct {
+	uint64_t signature;
+	uint32_t revision;
+	uint32_t header_size;
+	uint32_t crc32;
+	uint32_t reserved;
+} efi_table_header_t;
+
+#define SAL_SYSTEM_TABLE_GUID \
+	{ \
+		{ \
+			0x32, 0x2d, 0x9d, 0xeb, 0x88, 0x2d, 0xd3, 0x11, \
+			0x9a, 0x16, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d \
+		} \
+	}
+
+typedef union {
+	uint8_t bytes[16];
+	struct {
+		uint64_t low;
+		uint64_t high;
+	};
+} efi_guid_t;
+
+typedef struct {
+	efi_guid_t guid;
+	void *table;
+} efi_configuration_table_t;
+
+typedef struct {
+	efi_table_header_t hdr;
+	char *fw_vendor;
+	uint32_t fw_revision;
+	void *cons_in_handle;
+	void *cons_in;
+	void *cons_out_handle;
+	void *cons_out;
+	void *cons_err_handle;
+	void *cons_err;
+	void *runtime_services;
+	void *boot_services;
+	sysarg_t conf_table_entries;
+	efi_configuration_table_t *conf_table;
+} efi_system_table_t;
+
+typedef enum {
+	EFI_RESERVED,
+	EFI_LOADER_CODE,
+	EFI_LOADER_DATA,
+	EFI_BOOT_SERVICES_CODE,
+	EFI_BOOT_SERVICES_DATA,
+	EFI_RUNTIME_SERVICES_CODE,
+	EFI_RUNTIME_SERVICES_DATA,
+	EFI_CONVENTIONAL_MEMORY,
+	EFI_UNUSABLE_MEMORY,
+	EFI_ACPI_RECLAIM_MEMORY,
+	EFI_ACPI_MEMORY_NVS,
+	EFI_MEMORY_MAPPED_IO,
+	EFI_MEMORY_MAPPED_IO_PORT_SPACE,
+	EFI_PAL_CODE
+} efi_memory_type_t;
+
+typedef struct {
+	uint32_t type;
+	uint64_t phys_start;
+	uint64_t virt_start;
+	uint64_t pages;
+	uint64_t attribute;
+} efi_v1_memdesc_t;
+
+#define EFI_PAGE_SIZE	4096
+
+extern void *efi_vendor_table_find(efi_system_table_t *, efi_guid_t);
+
+#endif
Index: boot/genarch/include/genarch/multiplication.h
===================================================================
--- boot/genarch/include/genarch/multiplication.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
+++ boot/genarch/include/genarch/multiplication.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2009 Josef Cejka
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * @file
+ */
+
+#ifndef BOOT_MULTIPLICATION_H__
+#define BOOT_MULTIPLICATION_H__
+
+/* 64 bit multiplication */
+extern long long __muldi3(long long, long long);
+
+#endif
+
+/** @}
+ */
+
+
Index: boot/genarch/include/genarch/ofw.h
===================================================================
--- boot/genarch/include/genarch/ofw.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
+++ boot/genarch/include/genarch/ofw.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -0,0 +1,128 @@
+/*
+ * Copyright (c) 2005 Martin Decky
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef BOOT_OFW_H_
+#define BOOT_OFW_H_
+
+#include <stddef.h>
+#include <stdarg.h>
+
+#define MEMMAP_MAX_RECORDS  32
+#define MAX_OFW_ARGS        12
+
+#define OFW_TREE_PATH_MAX_LEN           256
+#define OFW_TREE_PROPERTY_MAX_NAMELEN   32
+#define OFW_TREE_PROPERTY_MAX_VALUELEN  64
+
+typedef sysarg_t ofw_arg_t;
+typedef native_t ofw_ret_t;
+typedef uint32_t ofw_prop_t;
+typedef uint32_t ihandle;
+typedef uint32_t phandle;
+
+/** OpenFirmware command structure
+ *
+ */
+typedef struct {
+	ofw_arg_t service;             /**< Command name. */
+	ofw_arg_t nargs;               /**< Number of in arguments. */
+	ofw_arg_t nret;                /**< Number of out arguments. */
+	ofw_arg_t args[MAX_OFW_ARGS];  /**< List of arguments. */
+} ofw_args_t;
+
+typedef struct {
+	void *start;
+	size_t size;
+} memzone_t;
+
+typedef struct {
+	uint64_t total;
+	size_t cnt;
+	memzone_t zones[MEMMAP_MAX_RECORDS];
+} memmap_t;
+
+typedef struct {
+	uint32_t info;
+	uint32_t addr_hi;
+	uint32_t addr_lo;
+} pci_addr_t;
+
+typedef struct {
+	pci_addr_t addr;
+	uint32_t size_hi;
+	uint32_t size_lo;
+} pci_reg_t;
+
+extern uintptr_t ofw_cif;
+
+extern phandle ofw_chosen;
+extern ihandle ofw_stdout;
+extern phandle ofw_root;
+extern ihandle ofw_mmu;
+extern phandle ofw_memory;
+
+extern void ofw_init(void);
+
+extern void ofw_putchar(const char);
+
+extern ofw_arg_t ofw_get_property(const phandle, const char *, void *,
+    const size_t);
+extern ofw_arg_t ofw_get_proplen(const phandle, const char *);
+extern ofw_arg_t ofw_next_property(const phandle, char *, char *);
+
+extern phandle ofw_get_child_node(const phandle);
+extern phandle ofw_get_peer_node(const phandle);
+extern phandle ofw_find_device(const char *);
+
+extern ofw_arg_t ofw_package_to_path(const phandle, char *, const size_t);
+
+extern ofw_arg_t ofw(ofw_args_t *);
+extern ofw_arg_t ofw_call(const char *, const size_t, const size_t, ofw_arg_t *,
+    ...);
+
+extern size_t ofw_get_address_cells(const phandle);
+extern size_t ofw_get_size_cells(const phandle);
+
+extern void *ofw_translate(const void *);
+
+extern void ofw_claim_virt(const void *, const size_t);
+extern void *ofw_claim_virt_any(const size_t, const size_t);
+
+extern void ofw_claim_phys(const void *, const size_t);
+extern void *ofw_claim_phys_any(const size_t, const size_t);
+
+extern void ofw_map(const void *, const void *, const size_t,
+    const ofw_arg_t);
+
+extern void ofw_alloc(const char *, void **, void **, const size_t, void *);
+
+extern void ofw_memmap(memmap_t *);
+extern void ofw_setup_screens(void);
+extern void ofw_quiesce(void);
+
+#endif
Index: boot/genarch/include/genarch/ofw_tree.h
===================================================================
--- boot/genarch/include/genarch/ofw_tree.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
+++ boot/genarch/include/genarch/ofw_tree.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2006 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef BOOT_OFW_TREE_H_
+#define BOOT_OFW_TREE_H_
+
+#include <stddef.h>
+#include <genarch/ofw.h>
+
+/** Memory representation of OpenFirmware device tree node property. */
+typedef struct {
+	char name[OFW_TREE_PROPERTY_MAX_NAMELEN];
+	size_t size;
+	void *value;
+} ofw_tree_property_t;
+
+/** Memory representation of OpenFirmware device tree node. */
+typedef struct ofw_tree_node {
+	struct ofw_tree_node *parent;
+	struct ofw_tree_node *peer;
+	struct ofw_tree_node *child;
+	
+	phandle node_handle;            /**< Old OpenFirmware node handle. */
+	
+	char *da_name;                  /**< Disambigued name. */
+	
+	size_t properties;              /**< Number of properties. */
+	ofw_tree_property_t *property;
+	
+	void *device;                   /**< Member used solely by the kernel. */
+} ofw_tree_node_t;
+
+extern ofw_tree_node_t *ofw_tree_build(void);
+
+#endif
Index: ot/genarch/include/multiplication.h
===================================================================
--- boot/genarch/include/multiplication.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ 	(revision )
@@ -1,44 +1,0 @@
-/*
- * Copyright (c) 2009 Josef Cejka
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @file
- */
-
-#ifndef BOOT_MULTIPLICATION_H__
-#define BOOT_MULTIPLICATION_H__
-
-/* 64 bit multiplication */
-extern long long __muldi3(long long, long long);
-
-#endif
-
-/** @}
- */
-
-
Index: ot/genarch/include/ofw.h
===================================================================
--- boot/genarch/include/ofw.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ 	(revision )
@@ -1,128 +1,0 @@
-/*
- * Copyright (c) 2005 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef BOOT_OFW_H_
-#define BOOT_OFW_H_
-
-#include <stddef.h>
-#include <stdarg.h>
-
-#define MEMMAP_MAX_RECORDS  32
-#define MAX_OFW_ARGS        12
-
-#define OFW_TREE_PATH_MAX_LEN           256
-#define OFW_TREE_PROPERTY_MAX_NAMELEN   32
-#define OFW_TREE_PROPERTY_MAX_VALUELEN  64
-
-typedef sysarg_t ofw_arg_t;
-typedef native_t ofw_ret_t;
-typedef uint32_t ofw_prop_t;
-typedef uint32_t ihandle;
-typedef uint32_t phandle;
-
-/** OpenFirmware command structure
- *
- */
-typedef struct {
-	ofw_arg_t service;             /**< Command name. */
-	ofw_arg_t nargs;               /**< Number of in arguments. */
-	ofw_arg_t nret;                /**< Number of out arguments. */
-	ofw_arg_t args[MAX_OFW_ARGS];  /**< List of arguments. */
-} ofw_args_t;
-
-typedef struct {
-	void *start;
-	size_t size;
-} memzone_t;
-
-typedef struct {
-	uint64_t total;
-	size_t cnt;
-	memzone_t zones[MEMMAP_MAX_RECORDS];
-} memmap_t;
-
-typedef struct {
-	uint32_t info;
-	uint32_t addr_hi;
-	uint32_t addr_lo;
-} pci_addr_t;
-
-typedef struct {
-	pci_addr_t addr;
-	uint32_t size_hi;
-	uint32_t size_lo;
-} pci_reg_t;
-
-extern uintptr_t ofw_cif;
-
-extern phandle ofw_chosen;
-extern ihandle ofw_stdout;
-extern phandle ofw_root;
-extern ihandle ofw_mmu;
-extern phandle ofw_memory;
-
-extern void ofw_init(void);
-
-extern void ofw_putchar(const char);
-
-extern ofw_arg_t ofw_get_property(const phandle, const char *, void *,
-    const size_t);
-extern ofw_arg_t ofw_get_proplen(const phandle, const char *);
-extern ofw_arg_t ofw_next_property(const phandle, char *, char *);
-
-extern phandle ofw_get_child_node(const phandle);
-extern phandle ofw_get_peer_node(const phandle);
-extern phandle ofw_find_device(const char *);
-
-extern ofw_arg_t ofw_package_to_path(const phandle, char *, const size_t);
-
-extern ofw_arg_t ofw(ofw_args_t *);
-extern ofw_arg_t ofw_call(const char *, const size_t, const size_t, ofw_arg_t *,
-    ...);
-
-extern size_t ofw_get_address_cells(const phandle);
-extern size_t ofw_get_size_cells(const phandle);
-
-extern void *ofw_translate(const void *);
-
-extern void ofw_claim_virt(const void *, const size_t);
-extern void *ofw_claim_virt_any(const size_t, const size_t);
-
-extern void ofw_claim_phys(const void *, const size_t);
-extern void *ofw_claim_phys_any(const size_t, const size_t);
-
-extern void ofw_map(const void *, const void *, const size_t,
-    const ofw_arg_t);
-
-extern void ofw_alloc(const char *, void **, void **, const size_t, void *);
-
-extern void ofw_memmap(memmap_t *);
-extern void ofw_setup_screens(void);
-extern void ofw_quiesce(void);
-
-#endif
Index: ot/genarch/include/ofw_tree.h
===================================================================
--- boot/genarch/include/ofw_tree.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ 	(revision )
@@ -1,60 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef BOOT_OFW_TREE_H_
-#define BOOT_OFW_TREE_H_
-
-#include <stddef.h>
-#include <genarch/ofw.h>
-
-/** Memory representation of OpenFirmware device tree node property. */
-typedef struct {
-	char name[OFW_TREE_PROPERTY_MAX_NAMELEN];
-	size_t size;
-	void *value;
-} ofw_tree_property_t;
-
-/** Memory representation of OpenFirmware device tree node. */
-typedef struct ofw_tree_node {
-	struct ofw_tree_node *parent;
-	struct ofw_tree_node *peer;
-	struct ofw_tree_node *child;
-	
-	phandle node_handle;            /**< Old OpenFirmware node handle. */
-	
-	char *da_name;                  /**< Disambigued name. */
-	
-	size_t properties;              /**< Number of properties. */
-	ofw_tree_property_t *property;
-	
-	void *device;                   /**< Member used solely by the kernel. */
-} ofw_tree_node_t;
-
-extern ofw_tree_node_t *ofw_tree_build(void);
-
-#endif
Index: boot/generic/include/stddef.h
===================================================================
--- boot/generic/include/stddef.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ boot/generic/include/stddef.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -33,8 +33,7 @@
 #define BOOT_STDDEF_H_
 
-#include <arch/common.h>
 #include <arch/types.h>
 
-#define NULL  ((void *) 0)
+#include <_bits/NULL.h>
 
 #endif
Index: boot/generic/include/stdint.h
===================================================================
--- boot/generic/include/stdint.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ boot/generic/include/stdint.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -33,30 +33,5 @@
 #define BOOT_STDINT_H_
 
-#include <arch/common.h>
 #include <arch/types.h>
-
-#define INT8_MIN  INT8_C(0x80)
-#define INT8_MAX  INT8_C(0x7F)
-
-#define UINT8_MIN  UINT8_C(0)
-#define UINT8_MAX  UINT8_C(0xFF)
-
-#define INT16_MIN  INT16_C(0x8000)
-#define INT16_MAX  INT16_C(0x7FFF)
-
-#define UINT16_MIN  UINT16_C(0)
-#define UINT16_MAX  UINT16_C(0xFFFF)
-
-#define INT32_MIN  INT32_C(0x80000000)
-#define INT32_MAX  INT32_C(0x7FFFFFFF)
-
-#define UINT32_MIN  UINT32_C(0)
-#define UINT32_MAX  UINT32_C(0xFFFFFFFF)
-
-#define INT64_MIN  INT64_C(0x8000000000000000)
-#define INT64_MAX  INT64_C(0x7FFFFFFFFFFFFFFF)
-
-#define UINT64_MIN  UINT64_C(0)
-#define UINT64_MAX  UINT64_C(0xFFFFFFFFFFFFFFFF)
 
 #endif
Index: boot/generic/src/printf_core.c
===================================================================
--- boot/generic/src/printf_core.c	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ boot/generic/src/printf_core.c	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -101,5 +101,6 @@
 	PrintfQualifierLongLong,
 	PrintfQualifierPointer,
-	PrintfQualifierSize
+	PrintfQualifierSize,
+	PrintfQualifierMax
 } qualifier_t;
 
@@ -643,4 +644,9 @@
 				uc = str_decode(fmt, &nxt, STR_NO_LIMIT);
 				break;
+			case 'j':
+				qualifier = PrintfQualifierMax;
+				i = nxt;
+				uc = str_decode(fmt, &nxt, STR_NO_LIMIT);
+				break;
 			default:
 				/* Default type */
@@ -759,4 +765,8 @@
 				number = (uint64_t) va_arg(ap, size_t);
 				break;
+			case PrintfQualifierMax:
+				size = sizeof(uintmax_t);
+				number = (uint64_t) va_arg(ap, uintmax_t);
+				break;
 			default:
 				/* Unknown qualifier */
Index: boot/generic/src/str.c
===================================================================
--- boot/generic/src/str.c	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ boot/generic/src/str.c	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -104,5 +104,5 @@
 
 /** Check the condition if wchar_t is signed */
-#ifdef WCHAR_IS_UNSIGNED
+#ifdef __WCHAR_UNSIGNED__
 	#define WCHAR_SIGNED_CHECK(cond)  (true)
 #else
Index: kernel/Makefile
===================================================================
--- kernel/Makefile	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ kernel/Makefile	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -84,5 +84,6 @@
 COMMON_CFLAGS = $(INCLUDES_FLAGS) -O$(OPTIMIZATION) -imacros $(CONFIG_HEADER) \
 	-ffreestanding -fno-builtin -nostdlib -nostdinc \
-	-fexec-charset=UTF-8 -finput-charset=UTF-8
+	-fexec-charset=UTF-8 -finput-charset=UTF-8 -fno-common \
+	-fdebug-prefix-map=$(realpath $(ROOT_PATH))=.
 
 GCC_CFLAGS = -std=gnu99 -Wall -Wextra -Wno-unused-parameter \
@@ -112,5 +113,5 @@
 #
 AFLAGS =
-LFLAGS = -n -T $(LINK) -M --fatal-warnings
+LFLAGS = -n -T $(LINK) -M --fatal-warnings --warn-common
 
 # FIXME: This condition is a workaround for issues #693 and #694.
@@ -458,8 +459,5 @@
 	done
 
-depend: $(COMMON_HEADER_ARCH) $(AUTOGENS_H)
-
-$(COMMON_HEADER_ARCH): $(COMMON_HEADER)
-	ln -sfn ../../../../$< $@
+depend: $(AUTOGENS_H)
 
 autogen_clean:
Index: kernel/arch/abs32le/include/arch/types.h
===================================================================
--- kernel/arch/abs32le/include/arch/types.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ kernel/arch/abs32le/include/arch/types.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -36,28 +36,8 @@
 #define KERN_abs32le_TYPES_H_
 
-#include <arch/common.h>
-
-#define ATOMIC_COUNT_MIN  UINT32_MIN
-#define ATOMIC_COUNT_MAX  UINT32_MAX
-
-typedef uint32_t size_t;
-typedef int32_t ssize_t;
-
-typedef uint32_t uintptr_t;
-typedef uint32_t pfn_t;
-
-typedef uint32_t ipl_t;
-
-typedef uint32_t sysarg_t;
-typedef int32_t native_t;
-typedef uint32_t atomic_count_t;
+#include <_bits/all.h>
 
 typedef struct {
 } fncptr_t;
-
-#define PRIdn  PRId32  /**< Format for native_t. */
-#define PRIun  PRIu32  /**< Format for sysarg_t. */
-#define PRIxn  PRIx32  /**< Format for hexadecimal sysarg_t. */
-#define PRIua  PRIu32  /**< Format for atomic_count_t. */
 
 #endif
Index: kernel/arch/amd64/include/arch/types.h
===================================================================
--- kernel/arch/amd64/include/arch/types.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ kernel/arch/amd64/include/arch/types.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -36,25 +36,8 @@
 #define KERN_amd64_TYPES_H_
 
-#include <arch/common.h>
-
-typedef uint64_t size_t;
-typedef int64_t ssize_t;
-
-typedef uint64_t uintptr_t;
-typedef uint64_t pfn_t;
-
-typedef uint64_t ipl_t;
-
-typedef uint64_t sysarg_t;
-typedef int64_t native_t;
-typedef uint64_t atomic_count_t;
+#include <_bits/all.h>
 
 typedef struct {
 } fncptr_t;
-
-#define PRIdn  PRId64  /**< Format for native_t. */
-#define PRIun  PRIu64  /**< Format for sysarg_t. */
-#define PRIxn  PRIx64  /**< Format for hexadecimal sysarg_t. */
-#define PRIua  PRIu64  /**< Format for atomic_count_t. */
 
 #endif
Index: kernel/arch/arm32/include/arch/types.h
===================================================================
--- kernel/arch/arm32/include/arch/types.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ kernel/arch/arm32/include/arch/types.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -37,6 +37,4 @@
 #define KERN_arm32_TYPES_H_
 
-#include <arch/common.h>
-
 #ifndef DOXYGEN
 	#define ATTRIBUTE_PACKED __attribute__((packed))
@@ -45,23 +43,8 @@
 #endif
 
-typedef uint32_t size_t;
-typedef int32_t ssize_t;
-
-typedef uint32_t uintptr_t;
-typedef uint32_t pfn_t;
-
-typedef uint32_t ipl_t;
-
-typedef uint32_t sysarg_t;
-typedef int32_t native_t;
-typedef uint32_t atomic_count_t;
+#include <_bits/all.h>
 
 typedef struct {
 } fncptr_t;
-
-#define PRIdn  PRId32  /**< Format for native_t. */
-#define PRIun  PRIu32  /**< Format for sysarg_t. */
-#define PRIxn  PRIx32  /**< Format for hexadecimal sysarg_t. */
-#define PRIua  PRIu32  /**< Format for atomic_count_t. */
 
 #endif
Index: kernel/arch/ia32/include/arch/types.h
===================================================================
--- kernel/arch/ia32/include/arch/types.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ kernel/arch/ia32/include/arch/types.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -36,25 +36,8 @@
 #define KERN_ia32_TYPES_H_
 
-#include <arch/common.h>
-
-typedef uint32_t size_t;
-typedef int32_t ssize_t;
-
-typedef uint32_t uintptr_t;
-typedef uint32_t pfn_t;
-
-typedef uint32_t ipl_t;
-
-typedef uint32_t sysarg_t;
-typedef int32_t native_t;
-typedef uint32_t atomic_count_t;
+#include <_bits/all.h>
 
 typedef struct {
 } fncptr_t;
-
-#define PRIdn  PRId32  /**< Format for native_t. */
-#define PRIun  PRIu32  /**< Format for sysarg_t. */
-#define PRIxn  PRIx32  /**< Format for hexadecimal sysarg_t. */
-#define PRIua  PRIu32  /**< Format for atomic_count_t. */
 
 #endif
Index: kernel/arch/ia32/src/interrupt.c
===================================================================
--- kernel/arch/ia32/src/interrupt.c	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ kernel/arch/ia32/src/interrupt.c	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -88,5 +88,5 @@
 	    istate->esi, istate->edi, istate->ebp,
 	    istate_from_uspace(istate) ? istate->esp :
-	    (uintptr_t) &istate->esp);
+	    (uint32_t) &istate->esp);
 }
 
Index: kernel/arch/ia64/include/arch/types.h
===================================================================
--- kernel/arch/ia64/include/arch/types.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ kernel/arch/ia64/include/arch/types.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -36,17 +36,5 @@
 #define KERN_ia64_TYPES_H_
 
-#include <arch/common.h>
-
-typedef uint64_t size_t;
-typedef int64_t ssize_t;
-
-typedef uint64_t uintptr_t;
-typedef uint64_t pfn_t;
-
-typedef uint64_t ipl_t;
-
-typedef uint64_t sysarg_t;
-typedef int64_t native_t;
-typedef uint64_t atomic_count_t;
+#include <_bits/all.h>
 
 typedef struct {
@@ -55,9 +43,4 @@
 } __attribute__((may_alias)) fncptr_t;
 
-#define PRIdn  PRId64  /**< Format for native_t. */
-#define PRIun  PRIu64  /**< Format for sysarg_t. */
-#define PRIxn  PRIx64  /**< Format for hexadecimal sysarg_t. */
-#define PRIua  PRIu64  /**< Format for atomic_count_t. */
-
 #endif
 
Index: kernel/arch/ia64/src/interrupt.c
===================================================================
--- kernel/arch/ia64/src/interrupt.c	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ kernel/arch/ia64/src/interrupt.c	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -142,10 +142,10 @@
 	    istate->cr_isr.value, istate->cr_ipsr.value);
 	
-	printf("cr.iip=%#0" PRIx64 ", #%u\t(%s)\n",
+	printf("cr.iip=%#0" PRIxPTR ", #%u\t(%s)\n",
 	    istate->cr_iip, istate->cr_isr.ei,
 	    symtab_fmt_name_lookup(istate->cr_iip));
-	printf("cr.iipa=%#0" PRIx64 "\t(%s)\n", istate->cr_iipa,
+	printf("cr.iipa=%#0" PRIxPTR "\t(%s)\n", istate->cr_iipa,
 	    symtab_fmt_name_lookup(istate->cr_iipa));
-	printf("cr.ifa=%#0" PRIx64 "\t(%s)\n", istate->cr_ifa,
+	printf("cr.ifa=%#0" PRIxPTR "\t(%s)\n", istate->cr_ifa,
 	    symtab_fmt_name_lookup(istate->cr_ifa));
 }
Index: kernel/arch/mips32/include/arch/types.h
===================================================================
--- kernel/arch/mips32/include/arch/types.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ kernel/arch/mips32/include/arch/types.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -36,25 +36,8 @@
 #define KERN_mips32_TYPES_H_
 
-#include <arch/common.h>
-
-typedef uint32_t size_t;
-typedef int32_t ssize_t;
-
-typedef uint32_t uintptr_t;
-typedef uint32_t pfn_t;
-
-typedef uint32_t ipl_t;
-
-typedef uint32_t sysarg_t;
-typedef int32_t native_t;
-typedef uint32_t atomic_count_t;
+#include <_bits/all.h>
 
 typedef struct {
 } fncptr_t;
-
-#define PRIdn  PRId32  /**< Format for native_t. */
-#define PRIun  PRIu32  /**< Format for sysarg_t. */
-#define PRIxn  PRIx32  /**< Format for hexadecimal sysarg_t. */
-#define PRIua  PRIu32  /**< Format for atomic_count_t. */
 
 #endif
Index: kernel/arch/ppc32/include/arch/types.h
===================================================================
--- kernel/arch/ppc32/include/arch/types.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ kernel/arch/ppc32/include/arch/types.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -36,25 +36,8 @@
 #define KERN_ppc32_TYPES_H_
 
-#include <arch/common.h>
-
-typedef uint32_t size_t;
-typedef int32_t ssize_t;
-
-typedef uint32_t uintptr_t;
-typedef uint32_t pfn_t;
-
-typedef uint32_t ipl_t;
-
-typedef uint32_t sysarg_t;
-typedef int32_t native_t;
-typedef uint32_t atomic_count_t;
+#include <_bits/all.h>
 
 typedef struct {
 } fncptr_t;
-
-#define PRIdn  PRId32  /**< Format for native_t. */
-#define PRIun  PRIu32  /**< Format for sysarg_t. */
-#define PRIxn  PRIx32  /**< Format for hexadecimal sysarg_t. */
-#define PRIua  PRIu32  /**< Format for atomic_count_t. */
 
 #endif
Index: kernel/arch/riscv64/include/arch/types.h
===================================================================
--- kernel/arch/riscv64/include/arch/types.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ kernel/arch/riscv64/include/arch/types.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -36,25 +36,8 @@
 #define KERN_riscv64_TYPES_H_
 
-#include <arch/common.h>
-
-typedef uint64_t size_t;
-typedef int64_t ssize_t;
-
-typedef uint64_t uintptr_t;
-typedef uint64_t pfn_t;
-
-typedef uint64_t ipl_t;
-
-typedef uint64_t sysarg_t;
-typedef int64_t native_t;
-typedef uint64_t atomic_count_t;
+#include <_bits/all.h>
 
 typedef struct {
 } fncptr_t;
-
-#define PRIdn  PRId64  /**< Format for native_t. */
-#define PRIun  PRIu64  /**< Format for sysarg_t. */
-#define PRIxn  PRIx64  /**< Format for hexadecimal sysarg_t. */
-#define PRIua  PRIu64  /**< Format for atomic_count_t. */
 
 #endif
Index: kernel/arch/sparc64/include/arch/asm.h
===================================================================
--- kernel/arch/sparc64/include/arch/asm.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ kernel/arch/sparc64/include/arch/asm.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -350,5 +350,5 @@
 	
 	pstate.value = pstate_read();
-	pstate.ie = ((pstate_reg_t) ipl).ie;
+	pstate.ie = ((pstate_reg_t)(uint64_t) ipl).ie;
 	pstate_write(pstate.value);
 }
Index: kernel/arch/sparc64/include/arch/barrier.h
===================================================================
--- kernel/arch/sparc64/include/arch/barrier.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ kernel/arch/sparc64/include/arch/barrier.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -37,10 +37,4 @@
 
 #include <trace.h>
-
-#ifdef KERNEL
-#include <arch/common.h>
-#else
-#include <libarch/common.h>
-#endif
 
 /*
@@ -88,5 +82,5 @@
 NO_TRACE static inline void flush_pipeline(void)
 {
-	uint64_t pc;
+	unsigned long pc;
 	
 	/*
Index: kernel/arch/sparc64/include/arch/mm/sun4v/tsb.h
===================================================================
--- kernel/arch/sparc64/include/arch/mm/sun4v/tsb.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ kernel/arch/sparc64/include/arch/mm/sun4v/tsb.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -72,5 +72,5 @@
 struct pte;
 
-extern void tsb_invalidate(struct as *as, uintptr_t page, uint64_t pages);
+extern void tsb_invalidate(struct as *as, uintptr_t page, size_t pages);
 extern void itsb_pte_copy(struct pte *t);
 extern void dtsb_pte_copy(struct pte *t, bool ro);
Index: kernel/arch/sparc64/include/arch/types.h
===================================================================
--- kernel/arch/sparc64/include/arch/types.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ kernel/arch/sparc64/include/arch/types.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -36,17 +36,5 @@
 #define KERN_sparc64_TYPES_H_
 
-#include <arch/common.h>
-
-typedef uint64_t size_t;
-typedef int64_t ssize_t;
-
-typedef uint64_t uintptr_t;
-typedef uint64_t pfn_t;
-
-typedef uint64_t ipl_t;
-
-typedef uint64_t sysarg_t;
-typedef int64_t native_t;
-typedef uint64_t atomic_count_t;
+#include <_bits/all.h>
 
 typedef struct {
@@ -55,9 +43,4 @@
 typedef uint8_t asi_t;
 
-#define PRIdn  PRId64  /**< Format for native_t. */
-#define PRIun  PRIu64  /**< Format for sysarg_t. */
-#define PRIxn  PRIx64  /**< Format for hexadecimal sysarg_t. */
-#define PRIua  PRIu64  /**< Format for atomic_count_t. */
-
 #endif
 
Index: kernel/generic/include/stddef.h
===================================================================
--- kernel/generic/include/stddef.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ kernel/generic/include/stddef.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -38,9 +38,5 @@
 #include <arch/types.h>
 
-typedef native_t ptrdiff_t;
-
-#ifndef NULL
-	#define NULL  ((void *) 0)
-#endif
+#include <_bits/NULL.h>
 
 #define offsetof(type,member) ((size_t) &(((type *) 0)->member))
Index: kernel/generic/include/stdint.h
===================================================================
--- kernel/generic/include/stdint.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ kernel/generic/include/stdint.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -36,29 +36,5 @@
 #define KERN_STDINT_H_
 
-#include <arch/common.h>
-
-#define INT8_MIN  INT8_C(0x80)
-#define INT8_MAX  INT8_C(0x7F)
-
-#define UINT8_MIN  UINT8_C(0)
-#define UINT8_MAX  UINT8_C(0xFF)
-
-#define INT16_MIN  INT16_C(0x8000)
-#define INT16_MAX  INT16_C(0x7FFF)
-
-#define UINT16_MIN  UINT16_C(0)
-#define UINT16_MAX  UINT16_C(0xFFFF)
-
-#define INT32_MIN  INT32_C(0x80000000)
-#define INT32_MAX  INT32_C(0x7FFFFFFF)
-
-#define UINT32_MIN  UINT32_C(0)
-#define UINT32_MAX  UINT32_C(0xFFFFFFFF)
-
-#define INT64_MIN  INT64_C(0x8000000000000000)
-#define INT64_MAX  INT64_C(0x7FFFFFFFFFFFFFFF)
-
-#define UINT64_MIN  UINT64_C(0)
-#define UINT64_MAX  UINT64_C(0xFFFFFFFFFFFFFFFF)
+#include <_bits/stdint.h>
 
 #endif
Index: kernel/generic/include/synch/mutex.h
===================================================================
--- kernel/generic/include/synch/mutex.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ kernel/generic/include/synch/mutex.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -43,10 +43,15 @@
 typedef enum {
 	MUTEX_PASSIVE,
+	MUTEX_RECURSIVE,
 	MUTEX_ACTIVE
 } mutex_type_t;
+
+struct thread;
 
 typedef struct {
 	mutex_type_t type;
 	semaphore_t sem;
+	struct thread *owner;
+	unsigned nesting;
 } mutex_t;
 
Index: kernel/generic/include/typedefs.h
===================================================================
--- kernel/generic/include/typedefs.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ kernel/generic/include/typedefs.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -36,6 +36,4 @@
 #define KERN_TYPEDEFS_H_
 
-#include <stdint.h>
-#include <arch/common.h>
 #include <arch/types.h>
 
Index: kernel/generic/src/cap/cap.c
===================================================================
--- kernel/generic/src/cap/cap.c	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ kernel/generic/src/cap/cap.c	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -84,6 +84,4 @@
 
 static slab_cache_t *cap_slab;
-
-static kobject_t *cap_unpublish_locked(task_t *, cap_handle_t, kobject_type_t);
 
 static size_t caps_hash(const ht_link_t *item)
@@ -150,5 +148,5 @@
 void caps_task_init(task_t *task)
 {
-	mutex_initialize(&task->cap_info->lock, MUTEX_PASSIVE);
+	mutex_initialize(&task->cap_info->lock, MUTEX_RECURSIVE);
 
 	for (kobject_type_t t = 0; t < KOBJECT_TYPE_MAX; t++)
@@ -240,5 +238,5 @@
 	if (cap->state == CAP_STATE_PUBLISHED && cap->kobject->ops->reclaim &&
 	    cap->kobject->ops->reclaim(cap->kobject)) {
-		kobject_t *kobj = cap_unpublish_locked(cap->task, cap->handle,
+		kobject_t *kobj = cap_unpublish(cap->task, cap->handle,
 		    cap->kobject->type);
 		kobject_put(kobj);
@@ -320,9 +318,21 @@
 }
 
-static kobject_t *
-cap_unpublish_locked(task_t *task, cap_handle_t handle, kobject_type_t type)
+/** Unpublish published capability
+ *
+ * The kernel object is moved out of the capability. In other words, the
+ * capability's reference to the objects is handed over to the kernel object
+ * pointer returned by this function. Once unpublished, the capability does not
+ * refer to any kernel object anymore.
+ *
+ * @param task    Task in which to unpublish the capability.
+ * @param handle  Capability handle.
+ * @param type    Kernel object type of the object associated with the
+ *                capability.
+ */
+kobject_t *cap_unpublish(task_t *task, cap_handle_t handle, kobject_type_t type)
 {
 	kobject_t *kobj = NULL;
 
+	mutex_lock(&task->cap_info->lock);
 	cap_t *cap = cap_get(task, handle, CAP_STATE_PUBLISHED);
 	if (cap) {
@@ -335,25 +345,4 @@
 		}
 	}
-
-	return kobj;
-}
-
-/** Unpublish published capability
- *
- * The kernel object is moved out of the capability. In other words, the
- * capability's reference to the objects is handed over to the kernel object
- * pointer returned by this function. Once unpublished, the capability does not
- * refer to any kernel object anymore.
- *
- * @param task    Task in which to unpublish the capability.
- * @param handle  Capability handle.
- * @param type    Kernel object type of the object associated with the
- *                capability.
- */
-kobject_t *cap_unpublish(task_t *task, cap_handle_t handle, kobject_type_t type)
-{
-
-	mutex_lock(&task->cap_info->lock);
-	kobject_t *kobj = cap_unpublish_locked(task, handle, type);
 	mutex_unlock(&task->cap_info->lock);
 
Index: kernel/generic/src/debug/panic.c
===================================================================
--- kernel/generic/src/debug/panic.c	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ kernel/generic/src/debug/panic.c	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -62,5 +62,5 @@
 		printf("\n");
 	} else if (cat == PANIC_BADTRAP) {
-		printf("bad trap %" PRIun ". %s\n", address,
+		printf("bad trap %" PRIuPTR ". %s\n", address,
 		    BANNER_RIGHT);
 		if (fmt) {
@@ -96,5 +96,5 @@
 	printf("THE=%p: ", THE);
 	if (THE != NULL) {
-		printf("pe=%" PRIun " thread=%p task=%p cpu=%p as=%p"
+		printf("pe=%" PRIuPTR " thread=%p task=%p cpu=%p as=%p"
 		    " magic=%#" PRIx32 "\n", THE->preemption,
 		    THE->thread, THE->task, THE->cpu, THE->as, THE->magic);
Index: kernel/generic/src/ipc/ipc.c
===================================================================
--- kernel/generic/src/ipc/ipc.c	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ kernel/generic/src/ipc/ipc.c	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -97,4 +97,6 @@
 		if (call->buffer)
 			free(call->buffer);
+		if (call->caller_phone)
+			kobject_put(call->caller_phone->kobject);
 		slab_free(call_slab, call);
 	}
@@ -346,4 +348,5 @@
 
 	call->caller_phone = phone;
+	kobject_add_ref(phone->kobject);
 
 	if (preforget) {
@@ -826,4 +829,8 @@
 {
 	ipc_phone_hangup(cap->kobject->phone);
+	kobject_t *kobj = cap_unpublish(cap->task, cap->handle,
+	    KOBJECT_TYPE_PHONE);
+	kobject_put(kobj);
+	cap_free(cap->task, cap->handle);
 	return true;
 }
Index: kernel/generic/src/ipc/irq.c
===================================================================
--- kernel/generic/src/ipc/irq.c	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ kernel/generic/src/ipc/irq.c	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -271,7 +271,24 @@
 }
 
+static void irq_hash_out(irq_t *irq)
+{
+	irq_spinlock_lock(&irq_uspace_hash_table_lock, true);
+	irq_spinlock_lock(&irq->lock, false);
+	
+	if (irq->notif_cfg.hashed_in) {
+		/* Remove the IRQ from the uspace IRQ hash table. */
+		hash_table_remove_item(&irq_uspace_hash_table, &irq->link);
+		irq->notif_cfg.hashed_in = false;
+	}
+
+	irq_spinlock_unlock(&irq->lock, false);
+	irq_spinlock_unlock(&irq_uspace_hash_table_lock, true);
+}
+
 static void irq_destroy(void *arg)
 {
 	irq_t *irq = (irq_t *) arg;
+
+	irq_hash_out(irq);
 
 	/* Free up the IRQ code and associated structures. */
@@ -373,16 +390,5 @@
 	assert(kobj->irq->notif_cfg.answerbox == box);
 
-	irq_spinlock_lock(&irq_uspace_hash_table_lock, true);
-	irq_spinlock_lock(&kobj->irq->lock, false);
-	
-	if (kobj->irq->notif_cfg.hashed_in) {
-		/* Remove the IRQ from the uspace IRQ hash table. */
-		hash_table_remove_item(&irq_uspace_hash_table,
-		    &kobj->irq->link);
-		kobj->irq->notif_cfg.hashed_in = false;
-	}
-
-	irq_spinlock_unlock(&kobj->irq->lock, false);
-	irq_spinlock_unlock(&irq_uspace_hash_table_lock, true);
+	irq_hash_out(kobj->irq);
 
 	kobject_put(kobj);
Index: kernel/generic/src/ipc/sysipc.c
===================================================================
--- kernel/generic/src/ipc/sysipc.c	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ kernel/generic/src/ipc/sysipc.c	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -199,4 +199,6 @@
 			irq_spinlock_lock(&phone->callee->lock, true);
 			list_remove(&phone->link);
+			/* Drop callee->connected_phones reference */
+			kobject_put(phone->kobject);
 			phone->state = IPC_PHONE_SLAMMED;
 			irq_spinlock_unlock(&phone->callee->lock, true);
Index: kernel/generic/src/ipc/sysipc_ops.c
===================================================================
--- kernel/generic/src/ipc/sysipc_ops.c	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ kernel/generic/src/ipc/sysipc_ops.c	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -38,13 +38,13 @@
 
 /* Forward declarations. */
-sysipc_ops_t ipc_m_connect_to_me_ops;
-sysipc_ops_t ipc_m_connect_me_to_ops;
-sysipc_ops_t ipc_m_page_in_ops;
-sysipc_ops_t ipc_m_share_out_ops;
-sysipc_ops_t ipc_m_share_in_ops;
-sysipc_ops_t ipc_m_data_write_ops;
-sysipc_ops_t ipc_m_data_read_ops;
-sysipc_ops_t ipc_m_state_change_authorize_ops;
-sysipc_ops_t ipc_m_debug_ops;
+extern sysipc_ops_t ipc_m_connect_to_me_ops;
+extern sysipc_ops_t ipc_m_connect_me_to_ops;
+extern sysipc_ops_t ipc_m_page_in_ops;
+extern sysipc_ops_t ipc_m_share_out_ops;
+extern sysipc_ops_t ipc_m_share_in_ops;
+extern sysipc_ops_t ipc_m_data_write_ops;
+extern sysipc_ops_t ipc_m_data_read_ops;
+extern sysipc_ops_t ipc_m_state_change_authorize_ops;
+extern sysipc_ops_t ipc_m_debug_ops;
 
 static sysipc_ops_t *sysipc_ops[] = {
Index: kernel/generic/src/lib/ra.c
===================================================================
--- kernel/generic/src/lib/ra.c	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ kernel/generic/src/lib/ra.c	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -353,6 +353,6 @@
 	link = hash_table_find(&span->used, &key);
 	if (!link) {
-		panic("Freeing segment which is not known to be used (base=%"
-		    PRIxn ", size=%" PRIdn ").", base, size);
+		panic("Freeing segment which is not known to be used (base=%zx"
+		    ", size=%zd).", base, size);
 	}
 	seg = hash_table_get_inst(link, ra_segment_t, uh_link);
@@ -447,5 +447,5 @@
 	irq_spinlock_unlock(&arena->lock, true);
 
-	panic("Freeing to wrong arena (base=%" PRIxn ", size=%" PRIdn ").",
+	panic("Freeing to wrong arena (base=%" PRIxPTR ", size=%zd).",
 	    base, size);
 }
Index: kernel/generic/src/lib/str.c
===================================================================
--- kernel/generic/src/lib/str.c	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ kernel/generic/src/lib/str.c	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -114,5 +114,5 @@
 
 /** Check the condition if wchar_t is signed */
-#ifdef WCHAR_IS_UNSIGNED
+#ifdef __WCHAR_UNSIGNED__
 	#define WCHAR_SIGNED_CHECK(cond)  (true)
 #else
Index: kernel/generic/src/mm/backend_user.c
===================================================================
--- kernel/generic/src/mm/backend_user.c	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ kernel/generic/src/mm/backend_user.c	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -129,5 +129,5 @@
 	if (rc != EOK) {
 		log(LF_USPACE, LVL_FATAL,
-		    "Page-in request for page %#" PRIxn
+		    "Page-in request for page %#" PRIxPTR
 		    " at pager %d failed with error %d.",
 		    upage, pager_info->pager, rc);
Index: kernel/generic/src/printf/printf_core.c
===================================================================
--- kernel/generic/src/printf/printf_core.c	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ kernel/generic/src/printf/printf_core.c	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -104,5 +104,6 @@
 	PrintfQualifierLongLong,
 	PrintfQualifierPointer,
-	PrintfQualifierSize
+	PrintfQualifierSize,
+	PrintfQualifierMax
 } qualifier_t;
 
@@ -767,4 +768,9 @@
 			case 'z':
 				qualifier = PrintfQualifierSize;
+				i = nxt;
+				uc = str_decode(fmt, &nxt, STR_NO_LIMIT);
+				break;
+			case 'j':
+				qualifier = PrintfQualifierMax;
 				i = nxt;
 				uc = str_decode(fmt, &nxt, STR_NO_LIMIT);
@@ -892,4 +898,8 @@
 				number = (uint64_t) va_arg(ap, size_t);
 				break;
+			case PrintfQualifierMax:
+				size = sizeof(uintmax_t);
+				number = (uint64_t) va_arg(ap, uintmax_t);
+				break;
 			default:
 				/* Unknown qualifier */
Index: kernel/generic/src/synch/mutex.c
===================================================================
--- kernel/generic/src/synch/mutex.c	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ kernel/generic/src/synch/mutex.c	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -46,10 +46,12 @@
 /** Initialize mutex.
  *
- * @param mtx  Mutex.
- * @param type Type of the mutex.
+ * @param mtx   Mutex.
+ * @param type  Type of the mutex.
  */
 void mutex_initialize(mutex_t *mtx, mutex_type_t type)
 {
 	mtx->type = type;
+	mtx->owner = NULL;
+	mtx->nesting = 0;
 	semaphore_initialize(&mtx->sem, 1);
 }
@@ -57,6 +59,7 @@
 /** Find out whether the mutex is currently locked.
  *
- * @param mtx		Mutex.
- * @return 		True if the mutex is locked, false otherwise.
+ * @param mtx  Mutex.
+ *
+ * @return  True if the mutex is locked, false otherwise.
  */
 bool mutex_locked(mutex_t *mtx)
@@ -71,10 +74,10 @@
  * Timeout mode and non-blocking mode can be requested.
  *
- * @param mtx   Mutex.
- * @param usec  Timeout in microseconds.
- * @param flags Specify mode of operation.
+ * @param mtx    Mutex.
+ * @param usec   Timeout in microseconds.
+ * @param flags  Specify mode of operation.
  *
- * For exact description of possible combinations of
- * usec and flags, see comment for waitq_sleep_timeout().
+ * For exact description of possible combinations of usec and flags, see
+ * comment for waitq_sleep_timeout().
  *
  * @return See comment for waitq_sleep_timeout().
@@ -85,8 +88,21 @@
 	int rc;
 
-	if ((mtx->type == MUTEX_PASSIVE) && (THREAD)) {
+	if (mtx->type == MUTEX_PASSIVE && THREAD) {
 		rc = _semaphore_down_timeout(&mtx->sem, usec, flags);
+	} else if (mtx->type == MUTEX_RECURSIVE) {
+		assert(THREAD);
+
+		if (mtx->owner == THREAD) {
+			mtx->nesting++;
+			return ESYNCH_OK_ATOMIC;
+		} else {
+			rc = _semaphore_down_timeout(&mtx->sem, usec, flags);
+			if (SYNCH_OK(rc)) {
+				mtx->owner = THREAD;
+				mtx->nesting = 1;
+			}
+		}
 	} else {
-		assert((mtx->type == MUTEX_ACTIVE) || (!THREAD));
+		assert((mtx->type == MUTEX_ACTIVE) || !THREAD);
 		assert(usec == SYNCH_NO_TIMEOUT);
 		assert(!(flags & SYNCH_FLAGS_INTERRUPTIBLE));
@@ -114,8 +130,14 @@
 /** Release mutex.
  *
- * @param mtx Mutex.
+ * @param mtx  Mutex.
  */
 void mutex_unlock(mutex_t *mtx)
 {
+	if (mtx->type == MUTEX_RECURSIVE) {
+		assert(mtx->owner == THREAD);
+		if (--mtx->nesting > 0)
+			return;
+		mtx->owner = NULL;
+	}
 	semaphore_up(&mtx->sem);
 }
Index: tools/autotool.py
===================================================================
--- tools/autotool.py	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ tools/autotool.py	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -1,3 +1,3 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
 #
 # Copyright (c) 2010 Martin Decky
@@ -43,11 +43,8 @@
 MAKEFILE = 'Makefile.common'
 HEADER = 'common.h.new'
-GUARD = 'AUTOTOOL_COMMON_H_'
+GUARD = '_AUTOTOOL_COMMON_H_'
 
 PROBE_SOURCE = 'probe.c'
 PROBE_OUTPUT = 'probe.s'
-
-PROBE_INT128_SOURCE = 'probe_int128.c'
-PROBE_INT128_OUTPUT = 'probe_int128.s'
 
 PACKAGE_BINUTILS = "usually part of binutils"
@@ -59,9 +56,9 @@
 COMPILER_WARNING = "The compilation of HelenOS might fail."
 
-PROBE_HEAD = """#define AUTOTOOL_DECLARE(category, subcategory, tag, name, strc, conc, value) \\
+PROBE_HEAD = """#define AUTOTOOL_DECLARE(category, tag, name, signedness, base, size, compatible) \\
 	asm volatile ( \\
-		"AUTOTOOL_DECLARE\\t" category "\\t" subcategory "\\t" tag "\\t" name "\\t" strc "\\t" conc "\\t%[val]\\n" \\
+		"AUTOTOOL_DECLARE\\t" category "\\t" tag "\\t" name "\\t" signedness "\\t" base "\\t%[size_val]\\t%[cmp_val]\\n" \\
 		: \\
-		: [val] "n" (value) \\
+		: [size_val] "n" (size), [cmp_val] "n" (compatible) \\
 	)
 
@@ -70,51 +67,18 @@
 
 #define DECLARE_BUILTIN_TYPE(tag, type) \\
-	AUTOTOOL_DECLARE("builtin_size", "", tag, STRING(type), "", "", sizeof(type)); \\
-	AUTOTOOL_DECLARE("builtin_sign", "unsigned long long int", tag, STRING(type), "unsigned", "", __builtin_types_compatible_p(type, unsigned long long int)); \\
-	AUTOTOOL_DECLARE("builtin_sign", "unsigned long int", tag, STRING(type), "unsigned", "", __builtin_types_compatible_p(type, unsigned long int)); \\
-	AUTOTOOL_DECLARE("builtin_sign", "unsigned int", tag, STRING(type), "unsigned", "", __builtin_types_compatible_p(type, unsigned int)); \\
-	AUTOTOOL_DECLARE("builtin_sign", "unsigned short int", tag, STRING(type), "unsigned", "", __builtin_types_compatible_p(type, unsigned short int)); \\
-	AUTOTOOL_DECLARE("builtin_sign", "unsigned char", tag, STRING(type), "unsigned", "", __builtin_types_compatible_p(type, unsigned char)); \\
-	AUTOTOOL_DECLARE("builtin_sign", "signed long long int", tag, STRING(type), "signed", "", __builtin_types_compatible_p(type, signed long long int)); \\
-	AUTOTOOL_DECLARE("builtin_sign", "signed long int", tag, STRING(type), "signed", "", __builtin_types_compatible_p(type, signed long int)); \\
-	AUTOTOOL_DECLARE("builtin_sign", "signed int", tag, STRING(type), "signed", "", __builtin_types_compatible_p(type, signed int)); \\
-	AUTOTOOL_DECLARE("builtin_sign", "signed short int", tag, STRING(type), "signed", "", __builtin_types_compatible_p(type, signed short int)); \\
-	AUTOTOOL_DECLARE("builtin_sign", "signed char", tag, STRING(type), "signed", "", __builtin_types_compatible_p(type, signed char));
-
-#define DECLARE_INTSIZE(tag, type, strc, conc) \\
-	AUTOTOOL_DECLARE("intsize", "unsigned", tag, #type, strc, conc, sizeof(unsigned type)); \\
-	AUTOTOOL_DECLARE("intsize", "signed", tag, #type, strc, conc, sizeof(signed type));
-
-#define DECLARE_FLOATSIZE(tag, type) \\
-	AUTOTOOL_DECLARE("floatsize", "", tag, #type, "", "", sizeof(type));
-
-extern int main(int, char *[]);
-
-int main(int argc, char *argv[])
-{
-#ifdef __SIZE_TYPE__
-	DECLARE_BUILTIN_TYPE("size", __SIZE_TYPE__);
-#endif
-#ifdef __WCHAR_TYPE__
-	DECLARE_BUILTIN_TYPE("wchar", __WCHAR_TYPE__);
-#endif
-#ifdef __WINT_TYPE__
-	DECLARE_BUILTIN_TYPE("wint", __WINT_TYPE__);
-#endif
-"""
-
-PROBE_TAIL = """}
-"""
-
-PROBE_INT128_HEAD = """#define AUTOTOOL_DECLARE(category, subcategory, tag, name, strc, conc, value) \\
-	asm volatile ( \\
-		"AUTOTOOL_DECLARE\\t" category "\\t" subcategory "\\t" tag "\\t" name "\\t" strc "\\t" conc "\\t%[val]\\n" \\
-		: \\
-		: [val] "n" (value) \\
-	)
-
-#define DECLARE_INTSIZE(tag, type) \\
-	AUTOTOOL_DECLARE("intsize", "unsigned", tag, #type, "", "", sizeof(unsigned type)); \\
-	AUTOTOOL_DECLARE("intsize", "signed", tag, #type, "", "", sizeof(signed type));
+	AUTOTOOL_DECLARE("unsigned long long int", tag, STRING(type), "unsigned", "long long", sizeof(type), __builtin_types_compatible_p(type, unsigned long long int)); \\
+	AUTOTOOL_DECLARE("unsigned long int", tag, STRING(type), "unsigned", "long", sizeof(type), __builtin_types_compatible_p(type, unsigned long int)); \\
+	AUTOTOOL_DECLARE("unsigned int", tag, STRING(type), "unsigned", "int", sizeof(type), __builtin_types_compatible_p(type, unsigned int)); \\
+	AUTOTOOL_DECLARE("unsigned short int", tag, STRING(type), "unsigned", "short", sizeof(type), __builtin_types_compatible_p(type, unsigned short int)); \\
+	AUTOTOOL_DECLARE("unsigned char", tag, STRING(type), "unsigned", "char", sizeof(type), __builtin_types_compatible_p(type, unsigned char)); \\
+	AUTOTOOL_DECLARE("signed long long int", tag, STRING(type), "signed", "long long", sizeof(type), __builtin_types_compatible_p(type, signed long long int)); \\
+	AUTOTOOL_DECLARE("signed long int", tag, STRING(type), "signed", "long", sizeof(type), __builtin_types_compatible_p(type, signed long int)); \\
+	AUTOTOOL_DECLARE("signed int", tag, STRING(type), "signed", "int", sizeof(type), __builtin_types_compatible_p(type, signed int)); \\
+	AUTOTOOL_DECLARE("signed short int", tag, STRING(type), "signed", "short", sizeof(type), __builtin_types_compatible_p(type, signed short int)); \\
+	AUTOTOOL_DECLARE("signed char", tag, STRING(type), "signed", "char", sizeof(type), __builtin_types_compatible_p(type, signed char)); \\
+	AUTOTOOL_DECLARE("pointer", tag, STRING(type), "N/A", "pointer", sizeof(type), __builtin_types_compatible_p(type, void*)); \\
+	AUTOTOOL_DECLARE("long double", tag, STRING(type), "signed", "long double", sizeof(type), __builtin_types_compatible_p(type, long double)); \\
+	AUTOTOOL_DECLARE("double", tag, STRING(type), "signed", "double", sizeof(type), __builtin_types_compatible_p(type, double)); \\
+	AUTOTOOL_DECLARE("float", tag, STRING(type), "signed", "float", sizeof(type), __builtin_types_compatible_p(type, float));
 
 extern int main(int, char *[]);
@@ -124,5 +88,5 @@
 """
 
-PROBE_INT128_TAIL = """}
+PROBE_TAIL = """}
 """
 
@@ -414,5 +378,5 @@
 	return int(value, base)
 
-def probe_compiler(common, intsizes, floatsizes):
+def probe_compiler(common, typesizes):
 	"Generate, compile and parse probing source"
 	
@@ -422,9 +386,10 @@
 	outf.write(PROBE_HEAD)
 	
-	for typedef in intsizes:
-		outf.write("\tDECLARE_INTSIZE(\"%s\", %s, %s, %s);\n" % (typedef['tag'], typedef['type'], typedef['strc'], typedef['conc']))
-	
-	for typedef in floatsizes:
-		outf.write("\tDECLARE_FLOATSIZE(\"%s\", %s);\n" % (typedef['tag'], typedef['type']))
+	for typedef in typesizes:
+		if 'def' in typedef:
+			outf.write("#ifdef %s\n" % typedef['def'])
+		outf.write("\tDECLARE_BUILTIN_TYPE(\"%s\", %s);\n" % (typedef['tag'], typedef['type']))
+		if 'def' in typedef:
+			outf.write("#endif\n")
 	
 	outf.write(PROBE_TAIL)
@@ -457,20 +422,5 @@
 	inf.close()
 	
-	unsigned_sizes = {}
-	signed_sizes = {}
-	
-	unsigned_tags = {}
-	signed_tags = {}
-	
-	unsigned_strcs = {}
-	signed_strcs = {}
-	
-	unsigned_concs = {}
-	signed_concs = {}
-	
-	float_tags = {}
-	
-	builtin_sizes = {}
-	builtin_signs = {}
+	builtins = {}
 	
 	for j in range(len(lines)):
@@ -479,283 +429,82 @@
 		if (len(tokens) > 0):
 			if (tokens[0] == "AUTOTOOL_DECLARE"):
-				if (len(tokens) < 7):
+				if (len(tokens) < 8):
 					print_error(["Malformed declaration in \"%s\" on line %s." % (PROBE_OUTPUT, j), COMPILER_FAIL])
 				
 				category = tokens[1]
-				subcategory = tokens[2]
-				tag = tokens[3]
-				name = tokens[4]
-				strc = tokens[5]
-				conc = tokens[6]
-				value = tokens[7]
+				tag = tokens[2]
+				name = tokens[3]
+				signedness = tokens[4]
+				base = tokens[5]
+				size = tokens[6]
+				compatible = tokens[7]
 				
-				if (category == "intsize"):
-					try:
-						value_int = decode_value(value)
-					except:
-						print_error(["Integer value expected in \"%s\" on line %s." % (PROBE_OUTPUT, j), COMPILER_FAIL])
-					
-					if (subcategory == "unsigned"):
-						unsigned_sizes[value_int] = name
-						unsigned_tags[tag] = value_int
-						unsigned_strcs[value_int] = strc
-						unsigned_concs[value_int] = conc
-					elif (subcategory == "signed"):
-						signed_sizes[value_int] = name
-						signed_tags[tag] = value_int
-						signed_strcs[value_int] = strc
-						signed_concs[value_int] = conc
-					else:
-						print_error(["Unexpected keyword \"%s\" in \"%s\" on line %s." % (subcategory, PROBE_OUTPUT, j), COMPILER_FAIL])
+				try:
+					compatible_int = decode_value(compatible)
+					size_int = decode_value(size)
+				except:
+					print_error(["Integer value expected in \"%s\" on line %s." % (PROBE_OUTPUT, j), COMPILER_FAIL])
 				
-				if (category == "floatsize"):
-					try:
-						value_int = decode_value(value)
-					except:
-						print_error(["Integer value expected in \"%s\" on line %s." % (PROBE_OUTPUT, j), COMPILER_FAIL])
-					
-					float_tags[tag] = value_int
-				
-				if (category == "builtin_size"):
-					try:
-						value_int = decode_value(value)
-					except:
-						print_error(["Integer value expected in \"%s\" on line %s." % (PROBE_OUTPUT, j), COMPILER_FAIL])
-					
-					builtin_sizes[tag] = {'name': name, 'value': value_int}
-				
-				if (category == "builtin_sign"):
-					try:
-						value_int = decode_value(value)
-					except:
-						print_error(["Integer value expected in \"%s\" on line %s." % (PROBE_OUTPUT, j), COMPILER_FAIL])
-					
-					if (value_int == 1):
-						if (not tag in builtin_signs):
-							builtin_signs[tag] = strc;
-						elif (builtin_signs[tag] != strc):
-							print_error(["Inconsistent builtin type detection in \"%s\" on line %s." % (PROBE_OUTPUT, j), COMPILER_FAIL])
-	
-	return {'unsigned_sizes': unsigned_sizes, 'signed_sizes': signed_sizes, 'unsigned_tags': unsigned_tags, 'signed_tags': signed_tags, 'unsigned_strcs': unsigned_strcs, 'signed_strcs': signed_strcs, 'unsigned_concs': unsigned_concs, 'signed_concs': signed_concs, 'float_tags': float_tags, 'builtin_sizes': builtin_sizes, 'builtin_signs': builtin_signs}
-
-def probe_int128(common):
-	"Generate, compile and parse probing source for 128-bit integers"
-	
-	check_common(common, "CC")
-	
-	outf = open(PROBE_INT128_SOURCE, 'w')
-	outf.write(PROBE_INT128_HEAD)
-	outf.write("\tDECLARE_INTSIZE(\"INT128\", int __attribute((mode(TI))));\n")
-	outf.write(PROBE_INT128_TAIL)
-	outf.close()
-	
-	args = common['CC_AUTOGEN'].split(' ')
-	args.extend(["-S", "-o", PROBE_INT128_OUTPUT, PROBE_INT128_SOURCE])
-	
-	try:
-		sys.stderr.write("Checking whether the compiler has intrinsic support for 128-bit integers ... ")
-		output = subprocess.Popen(args, stdout = subprocess.PIPE, stderr = subprocess.PIPE).communicate()
-	except:
-		sys.stderr.write("no\n")
-		return False
-	
-	if (not os.path.isfile(PROBE_INT128_OUTPUT)):
-		sys.stderr.write("no\n")
-		return False
-	
-	inf = open(PROBE_INT128_OUTPUT, 'r')
-	lines = inf.readlines()
-	inf.close()
-	
-	for j in range(len(lines)):
-		tokens = lines[j].strip().split("\t")
-		
-		if (len(tokens) > 0):
-			if (tokens[0] == "AUTOTOOL_DECLARE"):
-				if (len(tokens) < 7):
-					print_error(["Malformed declaration in \"%s\" on line %s." % (PROBE_INT128_OUTPUT, j), COMPILER_FAIL])
-				
-				category = tokens[1]
-				subcategory = tokens[2]
-				tag = tokens[3]
-				name = tokens[4]
-				strc = tokens[5]
-				conc = tokens[6]
-				value = tokens[7]
-				
-				if (category == "intsize"):
-					try:
-						value_int = decode_value(value)
-					except:
-						print_error(["Integer value expected in \"%s\" on line %s." % (PROBE_INT128_OUTPUT, j), COMPILER_FAIL])
-					
-					if (subcategory == "unsigned"):
-						if (value_int != 16):
-							sys.stderr.write("no\n")
-							return False
-					elif (subcategory == "signed"):
-						if (value_int != 16):
-							sys.stderr.write("no\n")
-							return False
-					else:
-						print_error(["Unexpected keyword \"%s\" in \"%s\" on line %s." % (subcategory, PROBE_INT128_OUTPUT, j), COMPILER_FAIL])
-	
-	sys.stderr.write("yes\n")
-	return True
-
-def detect_sizes(probe, bytes, inttags, floattags):
-	"Detect correct types for fixed-size types"
-	
-	macros = []
-	typedefs = []
-	
-	for b in bytes:
-		if (not b in probe['unsigned_sizes']):
-			print_error(['Unable to find appropriate unsigned integer type for %u bytes.' % b,
-			             COMPILER_FAIL])
-		
-		if (not b in probe['signed_sizes']):
-			print_error(['Unable to find appropriate signed integer type for %u bytes.' % b,
-			             COMPILER_FAIL])
-		
-		if (not b in probe['unsigned_strcs']):
-			print_error(['Unable to find appropriate unsigned printf formatter for %u bytes.' % b,
-			             COMPILER_FAIL])
-		
-		if (not b in probe['signed_strcs']):
-			print_error(['Unable to find appropriate signed printf formatter for %u bytes.' % b,
-			             COMPILER_FAIL])
-		
-		if (not b in probe['unsigned_concs']):
-			print_error(['Unable to find appropriate unsigned literal macro for %u bytes.' % b,
-			             COMPILER_FAIL])
-		
-		if (not b in probe['signed_concs']):
-			print_error(['Unable to find appropriate signed literal macro for %u bytes.' % b,
-			             COMPILER_FAIL])
-		
-		typedefs.append({'oldtype': "unsigned %s" % probe['unsigned_sizes'][b], 'newtype': "uint%u_t" % (b * 8)})
-		typedefs.append({'oldtype': "signed %s" % probe['signed_sizes'][b], 'newtype': "int%u_t" % (b * 8)})
-		
-		macros.append({'oldmacro': "unsigned %s" % probe['unsigned_sizes'][b], 'newmacro': "UINT%u_T" % (b * 8)})
-		macros.append({'oldmacro': "signed %s" % probe['signed_sizes'][b], 'newmacro': "INT%u_T" % (b * 8)})
-		
-		macros.append({'oldmacro': "\"%so\"" % probe['unsigned_strcs'][b], 'newmacro': "PRIo%u" % (b * 8)})
-		macros.append({'oldmacro': "\"%su\"" % probe['unsigned_strcs'][b], 'newmacro': "PRIu%u" % (b * 8)})
-		macros.append({'oldmacro': "\"%sx\"" % probe['unsigned_strcs'][b], 'newmacro': "PRIx%u" % (b * 8)})
-		macros.append({'oldmacro': "\"%sX\"" % probe['unsigned_strcs'][b], 'newmacro': "PRIX%u" % (b * 8)})
-		macros.append({'oldmacro': "\"%sd\"" % probe['signed_strcs'][b], 'newmacro': "PRId%u" % (b * 8)})
-		
-		name = probe['unsigned_concs'][b]
-		if ((name.startswith('@')) or (name == "")):
-			macros.append({'oldmacro': "c ## U", 'newmacro': "UINT%u_C(c)" % (b * 8)})
-		else:
-			macros.append({'oldmacro': "c ## U%s" % name, 'newmacro': "UINT%u_C(c)" % (b * 8)})
-		
-		name = probe['unsigned_concs'][b]
-		if ((name.startswith('@')) or (name == "")):
-			macros.append({'oldmacro': "c", 'newmacro': "INT%u_C(c)" % (b * 8)})
-		else:
-			macros.append({'oldmacro': "c ## %s" % name, 'newmacro': "INT%u_C(c)" % (b * 8)})
-	
-	for tag in inttags:
-		newmacro = "U%s" % tag
-		if (not tag in probe['unsigned_tags']):
-			print_error(['Unable to find appropriate size macro for %s.' % newmacro,
-			             COMPILER_FAIL])
-		
-		oldmacro = "UINT%s" % (probe['unsigned_tags'][tag] * 8)
-		macros.append({'oldmacro': "%s_MIN" % oldmacro, 'newmacro': "%s_MIN" % newmacro})
-		macros.append({'oldmacro': "%s_MAX" % oldmacro, 'newmacro': "%s_MAX" % newmacro})
-		macros.append({'oldmacro': "1", 'newmacro': 'U%s_SIZE_%s' % (tag, probe['unsigned_tags'][tag] * 8)})
-		
-		newmacro = tag
-		if (not tag in probe['signed_tags']):
-			print_error(['Unable to find appropriate size macro for %s' % newmacro,
-			             COMPILER_FAIL])
-		
-		oldmacro = "INT%s" % (probe['signed_tags'][tag] * 8)
-		macros.append({'oldmacro': "%s_MIN" % oldmacro, 'newmacro': "%s_MIN" % newmacro})
-		macros.append({'oldmacro': "%s_MAX" % oldmacro, 'newmacro': "%s_MAX" % newmacro})
-		macros.append({'oldmacro': "1", 'newmacro': '%s_SIZE_%s' % (tag, probe['signed_tags'][tag] * 8)})
-	
-	for tag in floattags:
-		if (not tag in probe['float_tags']):
-			print_error(['Unable to find appropriate size macro for %s' % tag,
-			             COMPILER_FAIL])
-		
-		macros.append({'oldmacro': "1", 'newmacro': '%s_SIZE_%s' % (tag, probe['float_tags'][tag] * 8)})
-	
-	if (not 'size' in probe['builtin_signs']):
-		print_error(['Unable to determine whether size_t is signed or unsigned.',
+				if (compatible_int == 1):
+					builtins[tag] = {
+						'tag': tag,
+						'name': name,
+						'sign': signedness,
+						'base': base,
+						'size': size_int,
+					}
+	
+	for typedef in typesizes:
+		if not typedef['tag'] in builtins:
+			print_error(['Unable to determine the properties of type %s.' % typedef['tag'],
 		             COMPILER_FAIL])
-	
-	if (probe['builtin_signs']['size'] != 'unsigned'):
-		print_error(['The type size_t is not unsigned.',
-		             COMPILER_FAIL])
-	
-	fnd = True
-	
-	if (not 'wchar' in probe['builtin_sizes']):
-		print_warning(['The compiler does not provide the macro __WCHAR_TYPE__',
-		               'for defining the compiler-native type wchar_t. We are',
-		               'forced to define wchar_t as a hardwired type int32_t.',
-		               COMPILER_WARNING])
-		fnd = False
-	
-	if (probe['builtin_sizes']['wchar']['value'] != 4):
-		print_warning(['The compiler provided macro __WCHAR_TYPE__ for defining',
-		               'the compiler-native type wchar_t is not compliant with',
-		               'HelenOS. We are forced to define wchar_t as a hardwired',
-		               'type int32_t.',
-		               COMPILER_WARNING])
-		fnd = False
-	
-	if (not fnd):
-		macros.append({'oldmacro': "int32_t", 'newmacro': "wchar_t"})
+		if 'sname' in typedef:
+			builtins[typedef['tag']]['sname'] = typedef['sname']
+	
+	return builtins
+
+def get_suffix(type):
+	if type['sign'] == 'unsigned':
+		return {
+			"char": "",
+			"short": "",
+			"int": "U",
+			"long": "UL",
+			"long long": "ULL",
+		}[type['base']]
 	else:
-		macros.append({'oldmacro': "__WCHAR_TYPE__", 'newmacro': "wchar_t"})
-	
-	if (not 'wchar' in probe['builtin_signs']):
-		print_error(['Unable to determine whether wchar_t is signed or unsigned.',
-		             COMPILER_FAIL])
-	
-	if (probe['builtin_signs']['wchar'] == 'unsigned'):
-		macros.append({'oldmacro': "1", 'newmacro': 'WCHAR_IS_UNSIGNED'})
-	if (probe['builtin_signs']['wchar'] == 'signed'):
-		macros.append({'oldmacro': "1", 'newmacro': 'WCHAR_IS_SIGNED'})
-	
-	fnd = True
-	
-	if (not 'wint' in probe['builtin_sizes']):
-		print_warning(['The compiler does not provide the macro __WINT_TYPE__',
-		               'for defining the compiler-native type wint_t. We are',
-		               'forced to define wint_t as a hardwired type int32_t.',
-		               COMPILER_WARNING])
-		fnd = False
-	
-	if (probe['builtin_sizes']['wint']['value'] != 4):
-		print_warning(['The compiler provided macro __WINT_TYPE__ for defining',
-		               'the compiler-native type wint_t is not compliant with',
-		               'HelenOS. We are forced to define wint_t as a hardwired',
-		               'type int32_t.',
-		               COMPILER_WARNING])
-		fnd = False
-	
-	if (not fnd):
-		macros.append({'oldmacro': "int32_t", 'newmacro': "wint_t"})
-	else:
-		macros.append({'oldmacro': "__WINT_TYPE__", 'newmacro': "wint_t"})
-	
-	if (not 'wint' in probe['builtin_signs']):
-		print_error(['Unable to determine whether wint_t is signed or unsigned.',
-		             COMPILER_FAIL])
-	
-	if (probe['builtin_signs']['wint'] == 'unsigned'):
-		macros.append({'oldmacro': "1", 'newmacro': 'WINT_IS_UNSIGNED'})
-	if (probe['builtin_signs']['wint'] == 'signed'):
-		macros.append({'oldmacro': "1", 'newmacro': 'WINT_IS_SIGNED'})
-	
-	return {'macros': macros, 'typedefs': typedefs}
+		return {
+			"char": "",
+			"short": "",
+			"int": "",
+			"long": "L",
+			"long long": "LL",
+		}[type['base']]
+
+def get_max(type):
+	val = (1 << (type['size']*8 - 1))
+	if type['sign'] == 'unsigned':
+		val *= 2
+	return val - 1
+
+def detect_sizes(probe):
+	"Detect properties of builtin types"
+	
+	macros = {}
+	
+	for type in probe.values():
+		macros['__SIZEOF_%s__' % type['tag']] = type['size']
+		
+		if ('sname' in type):
+			macros['__%s_TYPE__'  % type['sname']] = type['name']
+			macros['__%s_WIDTH__' % type['sname']] = type['size']*8
+			macros['__%s_%s__' % (type['sname'], type['sign'].upper())] = "1"
+			macros['__%s_C_SUFFIX__' % type['sname']] = get_suffix(type)
+			macros['__%s_MAX__' % type['sname']] = "%d%s" % (get_max(type), get_suffix(type))
+	
+	if (probe['SIZE_T']['sign'] != 'unsigned'):
+		print_error(['The type size_t is not unsigned.', COMPILER_FAIL])
+	
+	return macros
 
 def create_makefile(mkname, common):
@@ -777,5 +526,5 @@
 	outmk.close()
 
-def create_header(hdname, maps, int128):
+def create_header(hdname, macros):
 	"Create header output"
 	
@@ -790,15 +539,8 @@
 	outhd.write('#define %s\n\n' % GUARD)
 	
-	for macro in maps['macros']:
-		outhd.write('#define %s  %s\n' % (macro['newmacro'], macro['oldmacro']))
-	
-	outhd.write('\n')
-	
-	for typedef in maps['typedefs']:
-		outhd.write('typedef %s %s;\n' % (typedef['oldtype'], typedef['newtype']))
-	
-	if (int128):
-		outhd.write('typedef unsigned int __attribute((mode(TI))) uint128_t;\n')
-		outhd.write('typedef signed int __attribute((mode(TI))) int128_t;\n')
+	for macro in sorted(macros):
+		outhd.write('#ifndef %s\n' % macro)
+		outhd.write('#define %s  %s\n' % (macro, macros[macro]))
+		outhd.write('#endif\n\n')
 	
 	outhd.write('\n#endif\n')
@@ -916,20 +658,22 @@
 		probe = probe_compiler(common,
 			[
-				{'type': 'long long int', 'tag': 'LLONG', 'strc': '"ll"', 'conc': '"LL"'},
-				{'type': 'long int', 'tag': 'LONG', 'strc': '"l"', 'conc': '"L"'},
-				{'type': 'int', 'tag': 'INT', 'strc': '""', 'conc': '""'},
-				{'type': 'short int', 'tag': 'SHRT', 'strc': '"h"', 'conc': '"@"'},
-				{'type': 'char', 'tag': 'CHAR', 'strc': '"hh"', 'conc': '"@@"'}
-			],
-			[
+				{'type': 'long long int', 'tag': 'LONG_LONG', 'sname': 'LLONG' },
+				{'type': 'long int', 'tag': 'LONG', 'sname': 'LONG' },
+				{'type': 'int', 'tag': 'INT', 'sname': 'INT' },
+				{'type': 'short int', 'tag': 'SHORT', 'sname': 'SHRT'},
+				{'type': 'void*', 'tag': 'POINTER'},
 				{'type': 'long double', 'tag': 'LONG_DOUBLE'},
 				{'type': 'double', 'tag': 'DOUBLE'},
-				{'type': 'float', 'tag': 'FLOAT'}
+				{'type': 'float', 'tag': 'FLOAT'},
+				{'type': '__SIZE_TYPE__', 'tag': 'SIZE_T', 'def': '__SIZE_TYPE__', 'sname': 'SIZE' },
+				{'type': '__PTRDIFF_TYPE__', 'tag': 'PTRDIFF_T', 'def': '__PTRDIFF_TYPE__', 'sname': 'PTRDIFF' },
+				{'type': '__WINT_TYPE__', 'tag': 'WINT_T', 'def': '__WINT_TYPE__', 'sname': 'WINT' },
+				{'type': '__WCHAR_TYPE__', 'tag': 'WCHAR_T', 'def': '__WCHAR_TYPE__', 'sname': 'WCHAR' },
+				{'type': '__INTMAX_TYPE__', 'tag': 'INTMAX_T', 'def': '__INTMAX_TYPE__', 'sname': 'INTMAX' },
+				{'type': 'unsigned __INTMAX_TYPE__', 'tag': 'UINTMAX_T', 'def': '__INTMAX_TYPE__', 'sname': 'UINTMAX' },
 			]
 		)
 		
-		int128 = probe_int128(common)
-		
-		maps = detect_sizes(probe, [1, 2, 4, 8], ['CHAR', 'SHRT', 'INT', 'LONG', 'LLONG'], ['LONG_DOUBLE', 'DOUBLE', 'FLOAT'])
+		macros = detect_sizes(probe)
 		
 	finally:
@@ -939,5 +683,5 @@
 	
 	create_makefile(MAKEFILE, common)
-	create_header(HEADER, maps, int128)
+	create_header(HEADER, macros)
 	
 	return 0
Index: tools/config.py
===================================================================
--- tools/config.py	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ tools/config.py	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -445,6 +445,14 @@
 def create_output(mkname, mcname, config, rules):
 	"Create output configuration"
-
-	timestamp_unix = int(time.time())
+	
+	varname_strip = 'CONFIG_STRIP_REVISION_INFO'
+	strip_rev_info = (varname_strip in config) and (config[varname_strip] == 'y')
+	
+	if strip_rev_info:
+		timestamp_unix = int(0)
+	else:
+		# TODO: Use commit timestamp instead of build time.
+		timestamp_unix = int(time.time())
+	
 	timestamp = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(timestamp_unix))
 	
@@ -458,5 +466,5 @@
 		sys.stderr.write("failed\n")
 	
-	if len(version) == 3:
+	if (not strip_rev_info) and (len(version) == 3):
 		revision = version[1]
 		if version[0] != 1:
Index: tools/ew.py
===================================================================
--- tools/ew.py	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ tools/ew.py	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -56,9 +56,17 @@
 		return emulators[platform][machine][processor]
 
+def termemu_detect():
+	for termemu in ['xfce4-terminal', 'xterm']:
+		try:
+			subprocess.check_output('which ' + termemu, shell = True)
+			return termemu
+		except:
+			pass
+
 def run_in_console(cmd, title):
-	cmdline = 'xterm -T ' + '"' + title + '"' + ' -e ' + cmd
+	cmdline = termemu_detect() + ' -T ' + '"' + title + '"' + ' -e \'' + cmd + '\''
 	print(cmdline)
 	if not is_override('dryrun'):
-		subprocess.call(cmdline, shell = True);
+		subprocess.call(cmdline, shell = True)
 
 def get_host_native_width():
Index: tools/mkarray.py
===================================================================
--- tools/mkarray.py	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ tools/mkarray.py	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -70,4 +70,6 @@
 	section = sys.argv[4]
 	
+	timestamp = (1980, 1, 1, 0, 0, 0)
+	
 	header_ctx = []
 	desc_ctx = []
@@ -79,5 +81,5 @@
 	archive = zipfile.ZipFile("%s.zip" % dest, "w", zipfile.ZIP_STORED)
 	
-	for src in sys.argv[5:]:
+	for src in sorted(sys.argv[5:]):
 		basename = os.path.basename(src)
 		plainname = os.path.splitext(basename)[0]
@@ -95,5 +97,6 @@
 			src_data = deflate(src_data)
 			src_fname = os.path.basename("%s.deflate" % src)
-			archive.writestr(src_fname, src_data)
+			zipinfo = zipfile.ZipInfo(src_fname, timestamp)
+			archive.writestr(zipinfo, src_data)
 		else:
 			src_fname = src
@@ -155,5 +158,6 @@
 	data += "\n\n"
 	data += "#endif\n"
-	archive.writestr("%s.h" % dest, data)
+	zipinfo = zipfile.ZipInfo("%s.h" % dest, timestamp)
+	archive.writestr(zipinfo, data)
 	
 	data = ''
@@ -166,5 +170,6 @@
 	data += "\n".join(data_ctx)
 	data += "\n"
-	archive.writestr("%s.s" % dest, data)
+	zipinfo = zipfile.ZipInfo("%s.s" % dest, timestamp)
+	archive.writestr(zipinfo, data)
 	
 	data = ''
@@ -180,5 +185,6 @@
 	data += "\n".join(size_ctx)
 	data += "\n"
-	archive.writestr("%s_desc.c" % dest, data)
+	zipinfo = zipfile.ZipInfo("%s_desc.c" % dest, timestamp)
+	archive.writestr(zipinfo, data)
 	
 	archive.close()
Index: tools/toolchain.sh
===================================================================
--- tools/toolchain.sh	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ tools/toolchain.sh	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -64,4 +64,5 @@
 GDB_VERSION="7.12.1"
 ## GDB_PATCHES="toolchain-gdb-7.6.1.patch"
+ISL_VERSION="0.18"
 
 BASEDIR="`pwd`"
@@ -70,7 +71,9 @@
 GCC="gcc-${GCC_VERSION}.tar.bz2"
 GDB="gdb-${GDB_VERSION}.tar.gz"
+ISL="isl-${ISL_VERSION}.tar.bz2"
 
 REAL_INSTALL=true
 USE_HELENOS_TARGET=false
+BUILD_ISL=false
 
 #
@@ -97,13 +100,19 @@
 	
 	if [ "$RC" -ne "0" ] ; then
-		echo " ${DEPENDENCY} not found, too old or compiler error."
-		echo " Please recheck manually the source file \"${FNAME}.c\"."
-		echo " The compilation of the toolchain is probably going to fail,"
-		echo " you have been warned."
-		echo
-		echo " ===== Compiler output ====="
-		cat "${FNAME}.log"
-		echo " ==========================="
-		echo
+		if [ "${DEPENDENCY}" == "isl" ]; then
+			BUILD_ISL=true
+			
+			echo " isl not found. Will be downloaded and built with GCC."
+		else
+			echo " ${DEPENDENCY} not found, too old or compiler error."
+			echo " Please recheck manually the source file \"${FNAME}.c\"."
+			echo " The compilation of the toolchain is probably going to fail,"
+			echo " you have been warned."
+			echo
+			echo " ===== Compiler output ====="
+			cat "${FNAME}.log"
+			echo " ==========================="
+			echo
+		fi
 	else
 		echo " ${DEPENDENCY} found"
@@ -237,6 +246,8 @@
 	if [ ! -f "${FILE}" ] ; then
 		change_title "Downloading ${FILE}"
-		wget -c "${SOURCE}${FILE}"
+		wget -c "${SOURCE}${FILE}" -O "${FILE}".part
 		check_error $? "Error downloading ${FILE}."
+		
+		mv "${FILE}".part "${FILE}"
 	fi
 	
@@ -350,8 +361,13 @@
 	GCC_SOURCE="ftp://ftp.gnu.org/gnu/gcc/gcc-${GCC_VERSION}/"
 	GDB_SOURCE="ftp://ftp.gnu.org/gnu/gdb/"
+	ISL_SOURCE="http://isl.gforge.inria.fr/"
 	
 	download_fetch "${BINUTILS_SOURCE}" "${BINUTILS}" "9e8340c96626b469a603c15c9d843727"
 	download_fetch "${GCC_SOURCE}" "${GCC}" "6bf56a2bca9dac9dbbf8e8d1036964a8"
 	download_fetch "${GDB_SOURCE}" "${GDB}" "06c8f40521ed65fe36ebc2be29b56942"
+	
+	if $BUILD_ISL ; then
+		download_fetch "${ISL_SOURCE}" "${ISL}" "11436d6b205e516635b666090b94ab32"
+	fi
 }
 
@@ -423,4 +439,5 @@
 	BINUTILSDIR="${WORKDIR}/binutils-${BINUTILS_VERSION}"
 	GCCDIR="${WORKDIR}/gcc-${GCC_VERSION}"
+	ISLDIR="${WORKDIR}/isl-${ISL_VERSION}"
 	OBJDIR="${WORKDIR}/gcc-obj"
 	GDBDIR="${WORKDIR}/gdb-${GDB_VERSION}"
@@ -436,4 +453,7 @@
 	source_check "${BASEDIR}/${GCC}"
 	source_check "${BASEDIR}/${GDB}"
+	if $BUILD_ISL ; then
+		source_check "${BASEDIR}/${ISL}"
+	fi
 	
 	echo ">>> Removing previous content"
@@ -451,4 +471,8 @@
 	unpack_tarball "${BASEDIR}/${GCC}" "GCC"
 	unpack_tarball "${BASEDIR}/${GDB}" "GDB"
+	if $BUILD_ISL ; then
+		unpack_tarball "${BASEDIR}/${ISL}" "isl"
+		mv "${ISLDIR}" "${GCCDIR}"/isl
+	fi
 	
 	echo ">>> Applying patches"
@@ -471,5 +495,6 @@
 		"--target=${TARGET}" \
 		"--prefix=${PREFIX}" "--program-prefix=${TARGET}-" \
-		--disable-nls --disable-werror --enable-gold
+		--disable-nls --disable-werror --enable-gold \
+		--enable-deterministic-archives
 	check_error $? "Error configuring binutils."
 	
Index: uspace/Makefile
===================================================================
--- uspace/Makefile	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ uspace/Makefile	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -240,15 +240,14 @@
 LIBC_BUILD = $(addsuffix .build,$(LIBC))
 LIBS_BUILD = $(addsuffix .build,$(LIBS))
-LIBN_BUILD = $(addsuffix .build,$(LIBN))
 BUILDS := $(addsuffix .build,$(DIRS))
 BUILDS_TESTS := $(addsuffix .build-test,$(DIRS) $(LIBS) lib/c)
 
-CLEANS := $(addsuffix .clean,$(DIRS)) $(addsuffix .clean,$(LIBN)) $(addsuffix .clean,$(LIBS)) $(addsuffix .clean,$(LIBC))
-
-.PHONY: all $(LIBC_BUILD) $(LIBS_BUILD) $(LIBN_BUILD) $(BUILDS) $(CLEANS) clean
+CLEANS := $(addsuffix .clean,$(DIRS)) $(addsuffix .clean,$(LIBS)) $(addsuffix .clean,$(LIBC))
+
+.PHONY: all $(LIBC_BUILD) $(LIBS_BUILD) $(BUILDS) $(CLEANS) clean
 
 all: $(BUILDS) $(BUILDS_TESTS)
 
-$(BUILDS_TESTS): $(LIBC_BUILD) $(LIBS_BUILD) $(LIBN_BUILD)
+$(BUILDS_TESTS): $(LIBC_BUILD) $(LIBS_BUILD)
 	$(MAKE) -r -C $(basename $@) all-test PRECHECK=$(PRECHECK)
 
@@ -258,8 +257,5 @@
 	-$(MAKE) -r -C $(basename $@) clean
 
-$(BUILDS): $(LIBC_BUILD) $(LIBS_BUILD) $(LIBN_BUILD)
-	$(MAKE) -r -C $(basename $@) all PRECHECK=$(PRECHECK)
-
-$(LIBN_BUILD): $(LIBC_BUILD) $(LIBS_BUILD)
+$(BUILDS): $(LIBC_BUILD) $(LIBS_BUILD)
 	$(MAKE) -r -C $(basename $@) all PRECHECK=$(PRECHECK)
 
Index: uspace/Makefile.common
===================================================================
--- uspace/Makefile.common	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ uspace/Makefile.common	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -158,5 +158,5 @@
 
 AFLAGS =
-LFLAGS = --fatal-warnings
+LFLAGS = --fatal-warnings --warn-common
 
 # FIXME: This condition is a workaround for issues #692 and #693.
@@ -234,5 +234,6 @@
 COMMON_CFLAGS = $(INCLUDES_FLAGS) -O$(OPTIMIZATION) -imacros $(CONFIG_HEADER) \
 	-ffreestanding -fno-builtin -nostdlib -nostdinc -fexec-charset=UTF-8 \
-	-finput-charset=UTF-8 -D__$(ENDIANESS)__
+	-finput-charset=UTF-8 -D__$(ENDIANESS)__ -fno-common \
+	-fdebug-prefix-map=$(realpath $(ROOT_PATH))=.
 
 GCC_CFLAGS = -ffunction-sections -Wall -Wextra -Wno-clobbered \
Index: uspace/app/edit/search.c
===================================================================
--- uspace/app/edit/search.c	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ uspace/app/edit/search.c	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -35,7 +35,8 @@
  */
 
+#include <errno.h>
 #include <stdlib.h>
 #include <stddef.h>
-#include <errno.h>
+#include <types/common.h>
 
 #include "search.h"
Index: uspace/app/tester/float/softfloat1.c
===================================================================
--- uspace/app/tester/float/softfloat1.c	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ uspace/app/tester/float/softfloat1.c	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -31,4 +31,5 @@
 #include <stdbool.h>
 #include <stddef.h>
+#include <inttypes.h>
 #include <mathtypes.h>
 #include <add.h>
Index: uspace/app/tester/print/print4.c
===================================================================
--- uspace/app/tester/print/print4.c	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ uspace/app/tester/print/print4.c	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -29,4 +29,5 @@
 #include <stdio.h>
 #include <stddef.h>
+#include <wchar.h>
 #include "../tester.h"
 
Index: uspace/app/tester/util.h
===================================================================
--- uspace/app/tester/util.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ uspace/app/tester/util.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -37,4 +37,5 @@
 
 #include <stdio.h>
+#include <inttypes.h>
 #include "tester.h"
 
Index: uspace/lib/bithenge/src/print.c
===================================================================
--- uspace/lib/bithenge/src/print.c	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ uspace/lib/bithenge/src/print.c	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -40,4 +40,5 @@
 #include <stdarg.h>
 #include <stdio.h>
+#include <wchar.h>
 #include <bithenge/blob.h>
 #include <bithenge/print.h>
Index: uspace/lib/c/Makefile
===================================================================
--- uspace/lib/c/Makefile	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ uspace/lib/c/Makefile	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -32,5 +32,4 @@
 
 CONFIG_MAKEFILE = $(ROOT_PATH)/Makefile.config
-COMMON_HEADER_ARCH = arch/$(UARCH)/include/libarch/common.h
 
 LINKER_SCRIPTS = \
@@ -40,7 +39,7 @@
 	$(LIBC_PREFIX)/arch/$(UARCH)/_link-dlexe.ld
 
-PRE_DEPEND = $(COMMON_HEADER_ARCH)
+PRE_DEPEND =
 EXTRA_OUTPUT = $(LINKER_SCRIPTS)
-EXTRA_CLEAN = $(COMMON_HEADER_ARCH) $(LINKER_SCRIPTS)
+EXTRA_CLEAN = $(LINKER_SCRIPTS)
 LIBRARY = libc
 SLIBRARY = libc.so.0.0
@@ -208,5 +207,2 @@
 $(LIBC_PREFIX)/arch/$(UARCH)/_link-dlexe.ld: $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld.in
 	$(CC) $(DEFS) $(CFLAGS) -DLIBC_PATH=$(CURDIR) -DDLEXE -E -x c $< | grep -v "^\#" > $@
-
-$(COMMON_HEADER_ARCH): $(COMMON_HEADER)
-	ln -sfn ../../../../$< $@
Index: pace/lib/c/arch/abs32le/include/libarch/inttypes.h
===================================================================
--- uspace/lib/c/arch/abs32le/include/libarch/inttypes.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ 	(revision )
@@ -1,48 +1,0 @@
-/*
- * Copyright (c) 2010 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcabs32le
- * @{
- */
-
-#ifndef LIBC_abs32le_INTTYPES_H_
-#define LIBC_abs32le_INTTYPES_H_
-
-#define PRIdPTR  PRId32  /**< Format for intptr_t. */
-#define PRIuPTR  PRIu32  /**< Format for uintptr_t. */
-#define PRIxPTR  PRIx32  /**< Format for hexadecimal uintptr_t. */
-
-#define PRIdn  PRId32  /**< Format for native_t. */
-#define PRIun  PRIu32  /**< Format for sysarg_t. */
-#define PRIxn  PRIx32  /**< Format for hexadecimal sysarg_t. */
-#define PRIua  PRIu32  /**< Format for atomic_count_t. */
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/abs32le/include/libarch/stddef.h
===================================================================
--- uspace/lib/c/arch/abs32le/include/libarch/stddef.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ 	(revision )
@@ -1,47 +1,0 @@
-/*
- * Copyright (c) 2006 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcabs32
- * @{
- */
-/** @file
- */
-
-#ifndef LIBC_abs32_STDDEF_H_
-#define LIBC_abs32_STDDEF_H_
-
-#include <libarch/common.h>
-
-typedef uint32_t size_t;
-typedef int32_t ssize_t;
-typedef int32_t ptrdiff_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/abs32le/include/libarch/stdint.h
===================================================================
--- uspace/lib/c/arch/abs32le/include/libarch/stdint.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ 	(revision )
@@ -1,58 +1,0 @@
-/*
- * Copyright (c) 2006 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcabs32
- * @{
- */
-/** @file
- */
-
-#ifndef LIBC_abs32_STDINT_H_
-#define LIBC_abs32_STDINT_H_
-
-#include <libarch/common.h>
-
-#define SIZE_MAX UINT32_MAX
-
-#define UINTPTR_MAX UINT32_MAX
-typedef uint32_t uintptr_t;
-
-#define INTPTR_MIN INT32_MIN
-#define INTPTR_MAX INT32_MAX
-typedef int32_t intptr_t;
-
-#define UINTMAX_MAX UINT64_MAX
-typedef uint64_t uintmax_t;
-
-#define INTMAX_MAX INT64_MAX
-typedef int64_t intmax_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/abs32le/include/libarch/types.h
===================================================================
--- uspace/lib/c/arch/abs32le/include/libarch/types.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ 	(revision )
@@ -1,56 +1,0 @@
-/*
- * Copyright (c) 2010 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcabs32le
- * @{
- */
-/** @file
- */
-
-#ifndef LIBC_abs32le_TYPES_H_
-#define LIBC_abs32le_TYPES_H_
-
-#include <libarch/common.h>
-#include <libarch/stddef.h>
-#include <libarch/stdint.h>
-
-#define __32_BITS__
-
-#define SSIZE_MIN  INT32_MIN
-#define SSIZE_MAX  INT32_MAX
-
-typedef uint32_t sysarg_t;
-typedef int32_t native_t;
-
-typedef uint32_t atomic_count_t;
-typedef int32_t atomic_signed_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/amd64/include/libarch/inttypes.h
===================================================================
--- uspace/lib/c/arch/amd64/include/libarch/inttypes.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ 	(revision )
@@ -1,48 +1,0 @@
-/*
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcamd64
- * @{
- */
-
-#ifndef LIBC_amd64_INTTYPES_H_
-#define LIBC_amd64_INTTYPES_H_
-
-#define PRIdPTR  PRId64  /**< Format for intptr_t. */
-#define PRIuPTR  PRIu64  /**< Format for uintptr_t. */
-#define PRIxPTR  PRIx64  /**< Format for hexadecimal uintptr_t. */
-
-#define PRIdn  PRId64  /**< Format for native_t. */
-#define PRIun  PRIu64  /**< Format for sysarg_t. */
-#define PRIxn  PRIx64  /**< Format for hexadecimal sysarg_t. */
-#define PRIua  PRIu64  /**< Format for atomic_count_t. */
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/amd64/include/libarch/stddef.h
===================================================================
--- uspace/lib/c/arch/amd64/include/libarch/stddef.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ 	(revision )
@@ -1,47 +1,0 @@
-/*
- * Copyright (c) 2006 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcamd64
- * @{
- */
-/** @file
- */
-
-#ifndef LIBC_amd64_STDDEF_H_
-#define LIBC_amd64_STDDEF_H_
-
-#include <libarch/common.h>
-
-typedef uint64_t size_t;
-typedef int64_t ssize_t;
-typedef int64_t ptrdiff_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/amd64/include/libarch/stdint.h
===================================================================
--- uspace/lib/c/arch/amd64/include/libarch/stdint.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ 	(revision )
@@ -1,59 +1,0 @@
-/*
- * Copyright (c) 2006 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcamd64
- * @{
- */
-/** @file
- */
-
-#ifndef LIBC_amd64_STDINT_H_
-#define LIBC_amd64_STDINT_H_
-
-#include <libarch/common.h>
-
-#define SIZE_MIN  UINT64_MIN
-#define SIZE_MAX  UINT64_MAX
-
-#define UINTPTR_MAX UINT64_MAX
-typedef uint64_t uintptr_t;
-
-#define INTPTR_MIN INT64_MIN
-#define INTPTR_MAX INT64_MAX
-typedef int64_t intptr_t;
-
-#define UINTMAX_MAX UINT64_MAX
-typedef uint64_t uintmax_t;
-
-#define INTMAX_MAX INT64_MAX
-typedef int64_t intmax_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/amd64/include/libarch/types.h
===================================================================
--- uspace/lib/c/arch/amd64/include/libarch/types.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ 	(revision )
@@ -1,56 +1,0 @@
-/*
- * Copyright (c) 2006 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcamd64
- * @{
- */
-/** @file
- */
-
-#ifndef LIBC_amd64_TYPES_H_
-#define LIBC_amd64_TYPES_H_
-
-#include <libarch/common.h>
-#include <libarch/stddef.h>
-#include <libarch/stdint.h>
-
-#define __64_BITS__
-
-#define SSIZE_MIN  INT64_MIN
-#define SSIZE_MAX  INT64_MAX
-
-typedef uint64_t sysarg_t;
-typedef int64_t native_t;
-
-typedef uint64_t atomic_count_t;
-typedef int64_t atomic_signed_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/arm32/include/libarch/inttypes.h
===================================================================
--- uspace/lib/c/arch/arm32/include/libarch/inttypes.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ 	(revision )
@@ -1,48 +1,0 @@
-/*
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcarm32
- * @{
- */
-
-#ifndef LIBC_arm32_INTTYPES_H_
-#define LIBC_arm32_INTTYPES_H_
-
-#define PRIdPTR  PRId32  /**< Format for intptr_t. */
-#define PRIuPTR  PRIu32  /**< Format for uintptr_t. */
-#define PRIxPTR  PRIx32  /**< Format for hexadecimal uintptr_t. */
-
-#define PRIdn  PRId32  /**< Format for native_t. */
-#define PRIun  PRIu32  /**< Format for sysarg_t. */
-#define PRIxn  PRIx32  /**< Format for hexadecimal sysarg_t. */
-#define PRIua  PRIu32  /**< Format for atomic_count_t. */
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/arm32/include/libarch/stddef.h
===================================================================
--- uspace/lib/c/arch/arm32/include/libarch/stddef.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ 	(revision )
@@ -1,47 +1,0 @@
-/*
- * Copyright (c) 2006 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcarm32
- * @{
- */
-/** @file
- */
-
-#ifndef LIBC_arm32_STDDEF_H_
-#define LIBC_arm32_STDDEF_H_
-
-#include <libarch/common.h>
-
-typedef uint32_t size_t;
-typedef int32_t ssize_t;
-typedef int32_t ptrdiff_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/arm32/include/libarch/stdint.h
===================================================================
--- uspace/lib/c/arch/arm32/include/libarch/stdint.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ 	(revision )
@@ -1,59 +1,0 @@
-/*
- * Copyright (c) 2006 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcarm32
- * @{
- */
-/** @file
- */
-
-#ifndef LIBC_arm32_STDINT_H_
-#define LIBC_arm32_STDINT_H_
-
-#include <libarch/common.h>
-
-#define SIZE_MIN  UINT32_MIN
-#define SIZE_MAX  UINT32_MAX
-
-#define UINTPTR_MAX UINT32_MAX
-typedef uint32_t uintptr_t;
-
-#define INTPTR_MIN INT32_MIN
-#define INTPTR_MAX INT32_MAX
-typedef int32_t intptr_t;
-
-#define UINTMAX_MAX UINT64_MAX
-typedef uint64_t uintmax_t;
-
-#define INTMAX_MAX INT64_MAX
-typedef int64_t intmax_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/arm32/include/libarch/types.h
===================================================================
--- uspace/lib/c/arch/arm32/include/libarch/types.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ 	(revision )
@@ -1,57 +1,0 @@
-/*
- * Copyright (c) 2005 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcarm32
- * @{
- */
-/** @file
- *  @brief Definitions of basic types like #uintptr_t.
- */
-
-#ifndef LIBC_arm32_TYPES_H_
-#define LIBC_arm32_TYPES_H_
-
-#include <libarch/common.h>
-#include <libarch/stddef.h>
-#include <libarch/stdint.h>
-
-#define __32_BITS__
-
-#define SSIZE_MIN  INT32_MIN
-#define SSIZE_MAX  INT32_MAX
-
-typedef uint32_t sysarg_t;
-typedef int32_t native_t;
-
-typedef uint32_t atomic_count_t;
-typedef int32_t atomic_signed_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/ia32/include/libarch/inttypes.h
===================================================================
--- uspace/lib/c/arch/ia32/include/libarch/inttypes.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ 	(revision )
@@ -1,48 +1,0 @@
-/*
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcia32
- * @{
- */
-
-#ifndef LIBC_ia32_INTTYPES_H_
-#define LIBC_ia32_INTTYPES_H_
-
-#define PRIdPTR  PRId32  /**< Format for intptr_t. */
-#define PRIuPTR  PRIu32  /**< Format for uintptr_t. */
-#define PRIxPTR  PRIx32  /**< Format for hexadecimal uintptr_t. */
-
-#define PRIdn  PRId32  /**< Format for native_t. */
-#define PRIun  PRIu32  /**< Format for sysarg_t. */
-#define PRIxn  PRIx32  /**< Format for hexadecimal sysarg_t. */
-#define PRIua  PRIu32  /**< Format for atomic_count_t. */
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/ia32/include/libarch/stddef.h
===================================================================
--- uspace/lib/c/arch/ia32/include/libarch/stddef.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ 	(revision )
@@ -1,47 +1,0 @@
-/*
- * Copyright (c) 2006 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcia32
- * @{
- */
-/** @file
- */
-
-#ifndef LIBC_ia32_STDDEF_H_
-#define LIBC_ia32_STDDEF_H_
-
-#include <libarch/common.h>
-
-typedef uint32_t size_t;
-typedef int32_t ssize_t;
-typedef int32_t ptrdiff_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/ia32/include/libarch/stdint.h
===================================================================
--- uspace/lib/c/arch/ia32/include/libarch/stdint.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ 	(revision )
@@ -1,59 +1,0 @@
-/*
- * Copyright (c) 2006 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcia32
- * @{
- */
-/** @file
- */
-
-#ifndef LIBC_ia32_STDINT_H_
-#define LIBC_ia32_STDINT_H_
-
-#include <libarch/common.h>
-
-#define SIZE_MIN  UINT32_MIN
-#define SIZE_MAX  UINT32_MAX
-
-#define UINTPTR_MAX UINT32_MAX
-typedef uint32_t uintptr_t;
-
-#define INTPTR_MIN INT32_MIN
-#define INTPTR_MAX INT32_MAX
-typedef int32_t intptr_t;
-
-#define UINTMAX_MAX UINT64_MAX
-typedef uint64_t uintmax_t;
-
-#define INTMAX_MAX INT64_MAX
-typedef int64_t intmax_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/ia32/include/libarch/types.h
===================================================================
--- uspace/lib/c/arch/ia32/include/libarch/types.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ 	(revision )
@@ -1,56 +1,0 @@
-/*
- * Copyright (c) 2005 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcia32
- * @{
- */
-/** @file
- */
-
-#ifndef LIBC_ia32_TYPES_H_
-#define LIBC_ia32_TYPES_H_
-
-#include <libarch/common.h>
-#include <libarch/stddef.h>
-#include <libarch/stdint.h>
-
-#define __32_BITS__
-
-#define SSIZE_MIN  INT32_MIN
-#define SSIZE_MAX  INT32_MAX
-
-typedef uint32_t sysarg_t;
-typedef int32_t native_t;
-
-typedef uint32_t atomic_count_t;
-typedef int32_t atomic_signed_t;
-
-#endif
-
-/** @}
- */
Index: uspace/lib/c/arch/ia64/include/libarch/faddr.h
===================================================================
--- uspace/lib/c/arch/ia64/include/libarch/faddr.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ uspace/lib/c/arch/ia64/include/libarch/faddr.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -38,4 +38,9 @@
 #include <types/common.h>
 
+typedef struct {
+	uintptr_t fnc;
+	uintptr_t gp;
+} __attribute__((may_alias)) fncptr_t;
+
 /**
  *
Index: pace/lib/c/arch/ia64/include/libarch/inttypes.h
===================================================================
--- uspace/lib/c/arch/ia64/include/libarch/inttypes.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ 	(revision )
@@ -1,48 +1,0 @@
-/*
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libia64
- * @{
- */
-
-#ifndef LIBC_ia64_INTTYPES_H_
-#define LIBC_ia64_INTTYPES_H_
-
-#define PRIdPTR  PRId64  /**< Format for intptr_t. */
-#define PRIuPTR  PRIu64  /**< Format for uintptr_t. */
-#define PRIxPTR  PRIx64  /**< Format for hexadecimal uintptr_t. */
-
-#define PRIdn  PRId64  /**< Format for native_t. */
-#define PRIun  PRIu64  /**< Format for sysarg_t. */
-#define PRIxn  PRIx64  /**< Format for hexadecimal sysarg_t. */
-#define PRIua  PRIu64  /**< Format for atomic_count_t. */
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/ia64/include/libarch/stddef.h
===================================================================
--- uspace/lib/c/arch/ia64/include/libarch/stddef.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ 	(revision )
@@ -1,47 +1,0 @@
-/*
- * Copyright (c) 2006 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcia64
- * @{
- */
-/** @file
- */
-
-#ifndef LIBC_ia64_STDDEF_H_
-#define LIBC_ia64_STDDEF_H_
-
-#include <libarch/common.h>
-
-typedef uint64_t size_t;
-typedef int64_t ssize_t;
-typedef int64_t ptrdiff_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/ia64/include/libarch/stdint.h
===================================================================
--- uspace/lib/c/arch/ia64/include/libarch/stdint.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ 	(revision )
@@ -1,59 +1,0 @@
-/*
- * Copyright (c) 2006 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcia64
- * @{
- */
-/** @file
- */
-
-#ifndef LIBC_ia64_STDINT_H_
-#define LIBC_ia64_STDINT_H_
-
-#include <libarch/common.h>
-
-#define SIZE_MIN  UINT64_MIN
-#define SIZE_MAX  UINT64_MAX
-
-#define UINTPTR_MAX UINT64_MAX
-typedef uint64_t uintptr_t;
-
-#define INTPTR_MIN INT64_MIN
-#define INTPTR_MAX INT64_MAX
-typedef int64_t intptr_t;
-
-#define UINTMAX_MAX UINT64_MAX
-typedef uint64_t uintmax_t;
-
-#define INTMAX_MAX INT64_MAX
-typedef int64_t intmax_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/ia64/include/libarch/types.h
===================================================================
--- uspace/lib/c/arch/ia64/include/libarch/types.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ 	(revision )
@@ -1,61 +1,0 @@
-/*
- * Copyright (c) 2006 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcia64
- * @{
- */
-/** @file
- */
-
-#ifndef LIBC_ia64_TYPES_H_
-#define LIBC_ia64_TYPES_H_
-
-#include <libarch/common.h>
-#include <libarch/stddef.h>
-#include <libarch/stdint.h>
-
-#define __64_BITS__
-
-#define SSIZE_MIN  INT64_MIN
-#define SSIZE_MAX  INT64_MAX
-
-typedef uint64_t sysarg_t;
-typedef int64_t native_t;
-
-typedef uint64_t atomic_count_t;
-typedef int64_t atomic_signed_t;
-
-typedef struct {
-	uintptr_t fnc;
-	uintptr_t gp;
-} __attribute__((may_alias)) fncptr_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/mips32/include/libarch/inttypes.h
===================================================================
--- uspace/lib/c/arch/mips32/include/libarch/inttypes.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ 	(revision )
@@ -1,48 +1,0 @@
-/*
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcmips32
- * @{
- */
-
-#ifndef LIBC_mips32_INTTYPES_H_
-#define LIBC_mips32_INTTYPES_H_
-
-#define PRIdPTR  PRId32  /**< Format for intptr_t. */
-#define PRIuPTR  PRIu32  /**< Format for uintptr_t. */
-#define PRIxPTR  PRIx32  /**< Format for hexadecimal uintptr_t. */
-
-#define PRIdn  PRId32  /**< Format for native_t. */
-#define PRIun  PRIu32  /**< Format for sysarg_t. */
-#define PRIxn  PRIx32  /**< Format for hexadecimal sysarg_t. */
-#define PRIua  PRIu32  /**< Format for atomic_count_t. */
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/mips32/include/libarch/stddef.h
===================================================================
--- uspace/lib/c/arch/mips32/include/libarch/stddef.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ 	(revision )
@@ -1,47 +1,0 @@
-/*
- * Copyright (c) 2006 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcmips32
- * @{
- */
-/** @file
- */
-
-#ifndef LIBC_mips32_STDDEF_H_
-#define LIBC_mips32_STDDEF_H_
-
-#include <libarch/common.h>
-
-typedef uint32_t size_t;
-typedef int32_t ssize_t;
-typedef int32_t ptrdiff_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/mips32/include/libarch/stdint.h
===================================================================
--- uspace/lib/c/arch/mips32/include/libarch/stdint.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ 	(revision )
@@ -1,59 +1,0 @@
-/*
- * Copyright (c) 2006 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcmips32
- * @{
- */
-/** @file
- */
-
-#ifndef LIBC_mips32_STDINT_H_
-#define LIBC_mips32_STDINT_H_
-
-#include <libarch/common.h>
-
-#define SIZE_MIN  UINT32_MIN
-#define SIZE_MAX  UINT32_MAX
-
-#define UINTPTR_MAX UINT32_MAX
-typedef uint32_t uintptr_t;
-
-#define INTPTR_MIN INT32_MIN
-#define INTPTR_MAX INT32_MAX
-typedef int32_t intptr_t;
-
-#define UINTMAX_MAX UINT64_MAX
-typedef uint64_t uintmax_t;
-
-#define INTMAX_MAX INT64_MAX
-typedef int64_t intmax_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/mips32/include/libarch/types.h
===================================================================
--- uspace/lib/c/arch/mips32/include/libarch/types.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ 	(revision )
@@ -1,57 +1,0 @@
-/*
- * Copyright (c) 2005 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcmips32
- * @{
- */
-/** @file
- * @ingroup libcmips32
- */
-
-#ifndef LIBC_mips32_TYPES_H_
-#define LIBC_mips32_TYPES_H_
-
-#include <libarch/common.h>
-#include <libarch/stddef.h>
-#include <libarch/stdint.h>
-
-#define __32_BITS__
-
-#define SSIZE_MIN  INT32_MIN
-#define SSIZE_MAX  INT32_MAX
-
-typedef uint32_t sysarg_t;
-typedef int32_t native_t;
-
-typedef uint32_t atomic_count_t;
-typedef int32_t atomic_signed_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/mips32eb/include/libarch/inttypes.h
===================================================================
--- uspace/lib/c/arch/mips32eb/include/libarch/inttypes.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ 	(revision )
@@ -1,1 +1,0 @@
-../../../mips32/include/libarch/inttypes.h
Index: pace/lib/c/arch/mips32eb/include/libarch/stddef.h
===================================================================
--- uspace/lib/c/arch/mips32eb/include/libarch/stddef.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ 	(revision )
@@ -1,1 +1,0 @@
-../../../mips32/include/libarch/stddef.h
Index: pace/lib/c/arch/mips32eb/include/libarch/stdint.h
===================================================================
--- uspace/lib/c/arch/mips32eb/include/libarch/stdint.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ 	(revision )
@@ -1,1 +1,0 @@
-../../../mips32/include/libarch/stdint.h
Index: pace/lib/c/arch/mips32eb/include/libarch/types.h
===================================================================
--- uspace/lib/c/arch/mips32eb/include/libarch/types.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ 	(revision )
@@ -1,1 +1,0 @@
-../../../mips32/include/libarch/types.h
Index: pace/lib/c/arch/ppc32/include/libarch/inttypes.h
===================================================================
--- uspace/lib/c/arch/ppc32/include/libarch/inttypes.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ 	(revision )
@@ -1,48 +1,0 @@
-/*
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcppc32
- * @{
- */
-
-#ifndef LIBC_ppc32_INTTYPES_H_
-#define LIBC_ppc32_INTTYPES_H_
-
-#define PRIdPTR  PRId32  /**< Format for intptr_t. */
-#define PRIuPTR  PRIu32  /**< Format for uintptr_t. */
-#define PRIxPTR  PRIx32  /**< Format for hexadecimal uintptr_t. */
-
-#define PRIdn  PRId32  /**< Format for native_t. */
-#define PRIun  PRIu32  /**< Format for sysarg_t. */
-#define PRIxn  PRIx32  /**< Format for hexadecimal sysarg_t. */
-#define PRIua  PRIu32  /**< Format for atomic_count_t. */
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/ppc32/include/libarch/stddef.h
===================================================================
--- uspace/lib/c/arch/ppc32/include/libarch/stddef.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ 	(revision )
@@ -1,47 +1,0 @@
-/*
- * Copyright (c) 2006 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcppc32
- * @{
- */
-/** @file
- */
-
-#ifndef LIBC_ppc32_STDDEF_H_
-#define LIBC_ppc32_STDDEF_H_
-
-#include <libarch/common.h>
-
-typedef uint32_t size_t;
-typedef int32_t ssize_t;
-typedef int32_t ptrdiff_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/ppc32/include/libarch/stdint.h
===================================================================
--- uspace/lib/c/arch/ppc32/include/libarch/stdint.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ 	(revision )
@@ -1,59 +1,0 @@
-/*
- * Copyright (c) 2006 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcppc32
- * @{
- */
-/** @file
- */
-
-#ifndef LIBC_ppc32_STDINT_H_
-#define LIBC_ppc32_STDINT_H_
-
-#include <libarch/common.h>
-
-#define SIZE_MIN  UINT32_MIN
-#define SIZE_MAX  UINT32_MAX
-
-#define UINTPTR_MAX UINT32_MAX
-typedef uint32_t uintptr_t;
-
-#define INTPTR_MIN INT32_MIN
-#define INTPTR_MAX INT32_MAX
-typedef int32_t intptr_t;
-
-#define UINTMAX_MAX UINT64_MAX
-typedef uint64_t uintmax_t;
-
-#define INTMAX_MAX INT64_MAX
-typedef int64_t intmax_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/ppc32/include/libarch/types.h
===================================================================
--- uspace/lib/c/arch/ppc32/include/libarch/types.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ 	(revision )
@@ -1,57 +1,0 @@
-/*
- * Copyright (c) 2005 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcppc32
- * @{
- */
-/** @file
- */
-
-#ifndef LIBC_ppc32_TYPES_H_
-#define LIBC_ppc32_TYPES_H_
-
-#include <libarch/common.h>
-#include <libarch/stddef.h>
-#include <libarch/stdint.h>
-
-#define __32_BITS__
-
-#define SSIZE_MIN  INT32_MIN
-#define SSIZE_MAX  INT32_MAX
-
-typedef uint32_t sysarg_t;
-typedef int32_t native_t;
-
-typedef uint32_t atomic_count_t;
-typedef int32_t atomic_signed_t;
-
-#endif
-
-/** @}
- */
-
Index: pace/lib/c/arch/riscv64/include/libarch/inttypes.h
===================================================================
--- uspace/lib/c/arch/riscv64/include/libarch/inttypes.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ 	(revision )
@@ -1,48 +1,0 @@
-/*
- * Copyright (c) 2016 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcriscv64
- * @{
- */
-
-#ifndef LIBC_riscv64_INTTYPES_H_
-#define LIBC_riscv64_INTTYPES_H_
-
-#define PRIdPTR  PRId64  /**< Format for intptr_t. */
-#define PRIuPTR  PRIu64  /**< Format for uintptr_t. */
-#define PRIxPTR  PRIx64  /**< Format for hexadecimal uintptr_t. */
-
-#define PRIdn  PRId64  /**< Format for native_t. */
-#define PRIun  PRIu64  /**< Format for sysarg_t. */
-#define PRIxn  PRIx64  /**< Format for hexadecimal sysarg_t. */
-#define PRIua  PRIu64  /**< Format for atomic_count_t. */
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/riscv64/include/libarch/stddef.h
===================================================================
--- uspace/lib/c/arch/riscv64/include/libarch/stddef.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ 	(revision )
@@ -1,47 +1,0 @@
-/*
- * Copyright (c) 2016 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcabs32
- * @{
- */
-/** @file
- */
-
-#ifndef LIBC_abs32_STDDEF_H_
-#define LIBC_abs32_STDDEF_H_
-
-#include <libarch/common.h>
-
-typedef uint64_t size_t;
-typedef int64_t ssize_t;
-typedef int64_t ptrdiff_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/riscv64/include/libarch/stdint.h
===================================================================
--- uspace/lib/c/arch/riscv64/include/libarch/stdint.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ 	(revision )
@@ -1,58 +1,0 @@
-/*
- * Copyright (c) 2016 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcabs32
- * @{
- */
-/** @file
- */
-
-#ifndef LIBC_abs32_STDINT_H_
-#define LIBC_abs32_STDINT_H_
-
-#include <libarch/common.h>
-
-#define SIZE_MAX UINT64_MAX
-
-#define UINTPTR_MAX UINT64_MAX
-typedef uint64_t uintptr_t;
-
-#define INTPTR_MIN INT64_MIN
-#define INTPTR_MAX INT64_MAX
-typedef int64_t intptr_t;
-
-#define UINTMAX_MAX UINT64_MAX
-typedef uint64_t uintmax_t;
-
-#define INTMAX_MAX INT64_MAX
-typedef int64_t intmax_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/riscv64/include/libarch/types.h
===================================================================
--- uspace/lib/c/arch/riscv64/include/libarch/types.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ 	(revision )
@@ -1,56 +1,0 @@
-/*
- * Copyright (c) 2016 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcriscv64
- * @{
- */
-/** @file
- */
-
-#ifndef LIBC_riscv64_TYPES_H_
-#define LIBC_riscv64_TYPES_H_
-
-#include <libarch/common.h>
-#include <libarch/stddef.h>
-#include <libarch/stdint.h>
-
-#define __64_BITS__
-
-#define SSIZE_MIN  INT64_MIN
-#define SSIZE_MAX  INT64_MAX
-
-typedef uint64_t sysarg_t;
-typedef int64_t native_t;
-
-typedef uint64_t atomic_count_t;
-typedef int64_t atomic_signed_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/sparc64/include/libarch/inttypes.h
===================================================================
--- uspace/lib/c/arch/sparc64/include/libarch/inttypes.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ 	(revision )
@@ -1,48 +1,0 @@
-/*
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcsparc64
- * @{
- */
-
-#ifndef LIBC_sparc64_INTTYPES_H_
-#define LIBC_sparc64_INTTYPES_H_
-
-#define PRIdPTR  PRId64  /**< Format for intptr_t. */
-#define PRIuPTR  PRIu64  /**< Format for uintptr_t. */
-#define PRIxPTR  PRIx64  /**< Format for hexadecimal uintptr_t. */
-
-#define PRIdn  PRId64  /**< Format for native_t. */
-#define PRIun  PRIu64  /**< Format for sysarg_t. */
-#define PRIxn  PRIx64  /**< Format for hexadecimal sysarg_t. */
-#define PRIua  PRIu64  /**< Format for atomic_count_t. */
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/sparc64/include/libarch/stddef.h
===================================================================
--- uspace/lib/c/arch/sparc64/include/libarch/stddef.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ 	(revision )
@@ -1,47 +1,0 @@
-/*
- * Copyright (c) 2006 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcsparc64
- * @{
- */
-/** @file
- */
-
-#ifndef LIBC_sparc64_STDDEF_H_
-#define LIBC_sparc64_STDDEF_H_
-
-#include <libarch/common.h>
-
-typedef uint64_t size_t;
-typedef int64_t ssize_t;
-typedef int64_t ptrdiff_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/sparc64/include/libarch/stdint.h
===================================================================
--- uspace/lib/c/arch/sparc64/include/libarch/stdint.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ 	(revision )
@@ -1,59 +1,0 @@
-/*
- * Copyright (c) 2006 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcsparc64
- * @{
- */
-/** @file
- */
-
-#ifndef LIBC_sparc64_STDINT_H_
-#define LIBC_sparc64_STDINT_H_
-
-#include <libarch/common.h>
-
-#define SIZE_MIN  UINT64_MIN
-#define SIZE_MAX  UINT64_MAX
-
-#define UINTPTR_MAX UINT64_MAX
-typedef uint64_t uintptr_t;
-
-#define INTPTR_MIN INT64_MIN
-#define INTPTR_MAX INT64_MAX
-typedef int64_t intptr_t;
-
-#define UINTMAX_MAX UINT64_MAX
-typedef uint64_t uintmax_t;
-
-#define INTMAX_MAX INT64_MAX
-typedef int64_t intmax_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/sparc64/include/libarch/types.h
===================================================================
--- uspace/lib/c/arch/sparc64/include/libarch/types.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ 	(revision )
@@ -1,56 +1,0 @@
-/*
- * Copyright (c) 2005 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcsparc64
- * @{
- */
-/** @file
- */
-
-#ifndef LIBC_sparc64_TYPES_H_
-#define LIBC_sparc64_TYPES_H_
-
-#include <libarch/common.h>
-#include <libarch/stddef.h>
-#include <libarch/stdint.h>
-
-#define __64_BITS__
-
-#define SSIZE_MIN  INT64_MIN
-#define SSIZE_MAX  INT64_MAX
-
-typedef uint64_t sysarg_t;
-typedef int64_t native_t;
-
-typedef uint64_t atomic_count_t;
-typedef int64_t atomic_signed_t;
-
-#endif
-
-/** @}
- */
Index: uspace/lib/c/generic/double_to_str.c
===================================================================
--- uspace/lib/c/generic/double_to_str.c	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ uspace/lib/c/generic/double_to_str.c	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -32,4 +32,5 @@
 #include <ieee_double.h>
 
+#include <limits.h>
 #include <stdint.h>
 #include <stdbool.h>
Index: uspace/lib/c/generic/gsort.c
===================================================================
--- uspace/lib/c/generic/gsort.c	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ uspace/lib/c/generic/gsort.c	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -41,4 +41,5 @@
 
 #include <gsort.h>
+#include <inttypes.h>
 #include <mem.h>
 #include <malloc.h>
Index: uspace/lib/c/generic/inet/addr.c
===================================================================
--- uspace/lib/c/generic/inet/addr.c	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ uspace/lib/c/generic/inet/addr.c	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -41,4 +41,5 @@
 #include <malloc.h>
 #include <bitops.h>
+#include <inttypes.h>
 
 #define INET_PREFIXSTRSIZE  5
Index: uspace/lib/c/generic/io/printf_core.c
===================================================================
--- uspace/lib/c/generic/io/printf_core.c	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ uspace/lib/c/generic/io/printf_core.c	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -46,4 +46,5 @@
 #include <assert.h>
 #include <macros.h>
+#include <wchar.h>
 
 
@@ -114,5 +115,6 @@
 	PrintfQualifierLongLong,
 	PrintfQualifierPointer,
-	PrintfQualifierSize
+	PrintfQualifierSize,
+	PrintfQualifierMax
 } qualifier_t;
 
@@ -1484,4 +1486,9 @@
 				uc = str_decode(fmt, &nxt, STR_NO_LIMIT);
 				break;
+			case 'j':
+				qualifier = PrintfQualifierMax;
+				i = nxt;
+				uc = str_decode(fmt, &nxt, STR_NO_LIMIT);
+				break;
 			default:
 				/* Default type */
@@ -1629,4 +1636,8 @@
 				number = (uint64_t) va_arg(ap, size_t);
 				break;
+			case PrintfQualifierMax:
+				size = sizeof(uintmax_t);
+				number = (uint64_t) va_arg(ap, uintmax_t);
+				break;
 			default:
 				/* Unknown qualifier */
Index: uspace/lib/c/generic/str.c
===================================================================
--- uspace/lib/c/generic/str.c	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ uspace/lib/c/generic/str.c	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -46,7 +46,8 @@
 #include <align.h>
 #include <mem.h>
+#include <limits.h>
 
 /** Check the condition if wchar_t is signed */
-#ifdef WCHAR_IS_UNSIGNED
+#ifdef __WCHAR_UNSIGNED__
 	#define WCHAR_SIGNED_CHECK(cond)  (true)
 #else
Index: uspace/lib/c/include/inttypes.h
===================================================================
--- uspace/lib/c/include/inttypes.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ uspace/lib/c/include/inttypes.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -36,5 +36,5 @@
 #define LIBC_INTTYPES_H_
 
-#include <libarch/inttypes.h>
+#include <_bits/inttypes.h>
 
 #endif
Index: uspace/lib/c/include/io/charfield.h
===================================================================
--- uspace/lib/c/include/io/charfield.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ uspace/lib/c/include/io/charfield.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -38,4 +38,5 @@
 
 #include <stdbool.h>
+#include <wchar.h>
 #include <io/color.h>
 #include <io/style.h>
Index: uspace/lib/c/include/limits.h
===================================================================
--- uspace/lib/c/include/limits.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ uspace/lib/c/include/limits.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -36,7 +36,5 @@
 #define LIBC_LIMITS_H_
 
-/* XXX Make this more accurate */
-#include <stdint.h>
-#include <libarch/stdint.h>
+#include <_bits/limits.h>
 
 #endif
Index: uspace/lib/c/include/stddef.h
===================================================================
--- uspace/lib/c/include/stddef.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ uspace/lib/c/include/stddef.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -36,9 +36,9 @@
 #define LIBC_STDDEF_H_
 
-#include <libarch/stddef.h>
+#include <_bits/size_t.h>
+#include <_bits/ptrdiff_t.h>
+#include <_bits/wchar_t.h>
 
-#ifndef NULL
-	#define NULL  ((void *) 0)
-#endif
+#include <_bits/NULL.h>
 
 #define offsetof(type, member) \
Index: uspace/lib/c/include/stdint.h
===================================================================
--- uspace/lib/c/include/stdint.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ uspace/lib/c/include/stdint.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -36,29 +36,5 @@
 #define LIBC_STDINT_H_
 
-#define INT8_MIN  INT8_C(0x80)
-#define INT8_MAX  INT8_C(0x7F)
-
-#define UINT8_MIN  UINT8_C(0)
-#define UINT8_MAX  UINT8_C(0xFF)
-
-#define INT16_MIN  INT16_C(0x8000)
-#define INT16_MAX  INT16_C(0x7FFF)
-
-#define UINT16_MIN  UINT16_C(0)
-#define UINT16_MAX  UINT16_C(0xFFFF)
-
-#define INT32_MIN  INT32_C(0x80000000)
-#define INT32_MAX  INT32_C(0x7FFFFFFF)
-
-#define UINT32_MIN  UINT32_C(0)
-#define UINT32_MAX  UINT32_C(0xFFFFFFFF)
-
-#define INT64_MIN  INT64_C(0x8000000000000000)
-#define INT64_MAX  INT64_C(0x7FFFFFFFFFFFFFFF)
-
-#define UINT64_MIN  UINT64_C(0)
-#define UINT64_MAX  UINT64_C(0xFFFFFFFFFFFFFFFF)
-
-#include <libarch/stdint.h>
+#include <_bits/stdint.h>
 
 #endif
Index: uspace/lib/c/include/types/common.h
===================================================================
--- uspace/lib/c/include/types/common.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ uspace/lib/c/include/types/common.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -36,5 +36,13 @@
 #define LIBC_TYPES_COMMON_H_
 
-#include <libarch/types.h>
+#if __SIZEOF_POINTER__ == 4
+#define __32_BITS__
+#elif __SIZEOF_POINTER__ == 8
+#define __64_BITS__
+#else
+#error __SIZEOF_POINTER__ is not defined.
+#endif
+
+#include <_bits/all.h>
 
 #endif
Index: uspace/lib/c/include/wchar.h
===================================================================
--- uspace/lib/c/include/wchar.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
+++ uspace/lib/c/include/wchar.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2017 CZ.NIC, z.s.p.o.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/* Authors:
+ *	Jiří Zárevúcky (jzr) <zarevucky.jiri@gmail.com>
+ */
+
+/** @addtogroup libc
+ * @{
+ */
+/** @file
+ */
+
+#ifndef LIBC_WCHAR_H_
+#define LIBC_WCHAR_H_
+
+#include <_bits/size_t.h>
+#include <_bits/wchar_t.h>
+#include <_bits/wint_t.h>
+
+#include <_bits/NULL.h>
+#include <_bits/WCHAR_MIN.h>
+#include <_bits/WCHAR_MAX.h>
+#include <_bits/WEOF.h>
+
+#endif
+
+/** @}
+ */
Index: uspace/lib/draw/gfx/font-8x16.h
===================================================================
--- uspace/lib/draw/gfx/font-8x16.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ uspace/lib/draw/gfx/font-8x16.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -38,4 +38,5 @@
 #include <stdint.h>
 #include <stdbool.h>
+#include <stddef.h>
 
 #define FONT_GLYPHS     2899
Index: uspace/lib/drv/Makefile
===================================================================
--- uspace/lib/drv/Makefile	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ uspace/lib/drv/Makefile	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -32,5 +32,4 @@
 	-Iinclude \
 	-Igeneric/private \
-	-I$(LIBUSB_PREFIX)/include \
 	-I$(LIBPCM_PREFIX)/include
 LIBRARY = libdrv
Index: uspace/lib/drv/generic/logbuf.c
===================================================================
--- uspace/lib/drv/generic/logbuf.c	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ uspace/lib/drv/generic/logbuf.c	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -31,5 +31,4 @@
  */
 
-#include <libarch/common.h>
 #include <stdio.h>
 #include <stddef.h>
Index: uspace/lib/drv/generic/remote_usb.c
===================================================================
--- uspace/lib/drv/generic/remote_usb.c	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ uspace/lib/drv/generic/remote_usb.c	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -35,4 +35,5 @@
 
 #include <async.h>
+#include <assert.h>
 #include <macros.h>
 #include <errno.h>
@@ -169,5 +170,6 @@
 }
 
-int static_assert[sizeof(sysarg_t) >= 4 ? 1 : -1];
+static_assert(sizeof(sysarg_t) >= 4);
+
 typedef union {
 	uint8_t arr[sizeof(sysarg_t)];
Index: uspace/lib/drv/include/ddf/interrupt.h
===================================================================
--- uspace/lib/drv/include/ddf/interrupt.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ uspace/lib/drv/include/ddf/interrupt.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -36,5 +36,4 @@
 #define DDF_INTERRUPT_H_
 
-#include <libarch/common.h>
 #include <types/common.h>
 #include <abi/ddi/irq.h>
Index: uspace/lib/drv/include/usb_iface.h
===================================================================
--- uspace/lib/drv/include/usb_iface.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ uspace/lib/drv/include/usb_iface.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -40,7 +40,54 @@
 #include "ddf/driver.h"
 #include <async.h>
-#include <usb/usb.h>
 
 typedef async_sess_t usb_dev_session_t;
+
+/** USB speeds. */
+typedef enum {
+	/** USB 1.1 low speed (1.5Mbits/s). */
+	USB_SPEED_LOW,
+	/** USB 1.1 full speed (12Mbits/s). */
+	USB_SPEED_FULL,
+	/** USB 2.0 high speed (480Mbits/s). */
+	USB_SPEED_HIGH,
+	/** Psuedo-speed serving as a boundary. */
+	USB_SPEED_MAX
+} usb_speed_t;
+
+/** USB endpoint number type.
+ * Negative values could be used to indicate error.
+ */
+typedef int16_t usb_endpoint_t;
+
+/** USB address type.
+ * Negative values could be used to indicate error.
+ */
+typedef int16_t usb_address_t;
+
+/** USB transfer type. */
+typedef enum {
+	USB_TRANSFER_CONTROL = 0,
+	USB_TRANSFER_ISOCHRONOUS = 1,
+	USB_TRANSFER_BULK = 2,
+	USB_TRANSFER_INTERRUPT = 3
+} usb_transfer_type_t;
+
+/** USB data transfer direction. */
+typedef enum {
+	USB_DIRECTION_IN,
+	USB_DIRECTION_OUT,
+	USB_DIRECTION_BOTH
+} usb_direction_t;
+
+/** USB complete address type.
+ * Pair address + endpoint is identification of transaction recipient.
+ */
+typedef union {
+	struct {
+		usb_address_t address;
+		usb_endpoint_t endpoint;
+	} __attribute__((packed));
+	uint32_t packed;
+} usb_target_t;
 
 extern usb_dev_session_t *usb_dev_connect(devman_handle_t);
Index: uspace/lib/drv/include/usbhc_iface.h
===================================================================
--- uspace/lib/drv/include/usbhc_iface.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ uspace/lib/drv/include/usbhc_iface.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -41,5 +41,5 @@
 
 #include "ddf/driver.h"
-#include <usb/usb.h>
+#include <usb_iface.h>
 #include <stdbool.h>
 
Index: uspace/lib/drv/include/usbhid_iface.h
===================================================================
--- uspace/lib/drv/include/usbhid_iface.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ uspace/lib/drv/include/usbhid_iface.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -38,5 +38,4 @@
 
 #include "ddf/driver.h"
-#include <usb/usb.h>
 
 extern int usbhid_dev_get_event_length(async_sess_t *, size_t *);
Index: uspace/lib/http/include/http/receive-buffer.h
===================================================================
--- uspace/lib/http/include/http/receive-buffer.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ uspace/lib/http/include/http/receive-buffer.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -39,4 +39,5 @@
 #include <adt/list.h>
 #include <stddef.h>
+#include <types/common.h>
 
 /** Receive data.
Index: uspace/lib/math/include/mathtypes.h
===================================================================
--- uspace/lib/math/include/mathtypes.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ uspace/lib/math/include/mathtypes.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -191,85 +191,35 @@
 #endif
 
-
-#if defined(FLOAT_SIZE_32)
-
-#ifndef float32_t
-	#define float32_t  float
-#endif
-
-#elif defined(FLOAT_SIZE_64)
-
-#ifndef float64_t
-	#define float64_t  float
-#endif
-
-#elif defined(FLOAT_SIZE_96)
-
-#ifndef float96_t
-	#define float96_t  float
-#endif
-
-#elif defined(FLOAT_SIZE_128)
-
-#ifndef float128_t
-	#define float128_t  float
-#endif
-
-#endif
-
-
-#if defined(DOUBLE_SIZE_32)
-
-#ifndef float32_t
-	#define float32_t  double
-#endif
-
-#elif defined(DOUBLE_SIZE_64)
-
-#ifndef float64_t
-	#define float64_t  double
-#endif
-
-#elif defined(DOUBLE_SIZE_96)
-
-#ifndef float96_t
-	#define float96_t  double
-#endif
-
-#elif defined(DOUBLE_SIZE_128)
-
-#ifndef float128_t
-	#define float128_t  double
-#endif
-
-#endif
-
-
-#if defined(LONG_DOUBLE_SIZE_32)
-
-#ifndef float32_t
-	#define float32_t  long double
-#endif
-
-#elif defined(LONG_DOUBLE_SIZE_64)
-
-#ifndef float64_t
-	#define float64_t  long double
-#endif
-
-#elif defined(LONG_DOUBLE_SIZE_96)
-
-#ifndef float96_t
-	#define float96_t  long double
-#endif
-
-#elif defined(LONG_DOUBLE_SIZE_128)
-
-#ifndef float128_t
-	#define float128_t  long double
-#endif
-
-#endif
-
+#if __SIZEOF_FLOAT__ == 4
+#define float32_t float
+#elif __SIZEOF_DOUBLE__ == 4
+#define float32_t double
+#elif __SIZEOF_LONG_DOUBLE__ == 4
+#define float32_t long double
+#endif
+
+#if __SIZEOF_FLOAT__ == 8
+#define float64_t float
+#elif __SIZEOF_DOUBLE__ == 8
+#define float64_t double
+#elif __SIZEOF_LONG_DOUBLE__ == 8
+#define float64_t long double
+#endif
+
+#if __SIZEOF_FLOAT__ == 12
+#define float96_t float
+#elif __SIZEOF_DOUBLE__ == 12
+#define float96_t double
+#elif __SIZEOF_LONG_DOUBLE__ == 12
+#define float96_t long double
+#endif
+
+#if __SIZEOF_FLOAT__ == 16
+#define float128_t float
+#elif __SIZEOF_DOUBLE__ == 16
+#define float128_t double
+#elif __SIZEOF_LONG_DOUBLE__ == 16
+#define float128_t long double
+#endif
 
 #ifdef float32_t
Index: uspace/lib/nic/include/nic_addr_db.h
===================================================================
--- uspace/lib/nic/include/nic_addr_db.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ uspace/lib/nic/include/nic_addr_db.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -44,4 +44,5 @@
 
 #include <adt/hash_table.h>
+#include <types/common.h>
 
 /**
Index: uspace/lib/nic/src/nic_addr_db.c
===================================================================
--- uspace/lib/nic/src/nic_addr_db.c	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ uspace/lib/nic/src/nic_addr_db.c	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -36,5 +36,4 @@
  */
 #include "nic_addr_db.h"
-#include "libarch/common.h"
 #include <assert.h>
 #include <stdlib.h>
Index: uspace/lib/pcut/Makefile
===================================================================
--- uspace/lib/pcut/Makefile	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ uspace/lib/pcut/Makefile	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -36,4 +36,4 @@
 
 test-libpcut-%: $(OUTPUT)
-	$(LD) -n $(LFLAGS) -T $(LINKER_SCRIPT) -o $@ $^ $(OUTPUT) $(BASE_LIBS)
+	$(LD) -n $(LFLAGS) -T $(LINKER_SCRIPT) -o $@ $(STARTUP) $^ $(OUTPUT) $(BASE_LIBS)
 
Index: uspace/lib/pcut/update-from-master.sh
===================================================================
--- uspace/lib/pcut/update-from-master.sh	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ uspace/lib/pcut/update-from-master.sh	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -80,5 +80,5 @@
 
 test-libpcut-%: $(OUTPUT)
-	$(LD) -n $(LFLAGS) -T $(LINKER_SCRIPT) -o $@ $^ $(OUTPUT) $(BASE_LIBS)
+	$(LD) -n $(LFLAGS) -T $(LINKER_SCRIPT) -o $@ $(STARTUP) $^ $(OUTPUT) $(BASE_LIBS)
 
 EOF_MAKEFILE_TAIL
Index: uspace/lib/posix/include/posix/limits.h
===================================================================
--- uspace/lib/posix/include/posix/limits.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ uspace/lib/posix/include/posix/limits.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -42,8 +42,4 @@
 #define PATH_MAX 256
 
-/* it's probably a safe assumption */
-#undef CHAR_BIT
-#define CHAR_BIT 8
-
 #endif /* POSIX_LIMITS_H_ */
 
Index: uspace/lib/posix/include/posix/locale.h
===================================================================
--- uspace/lib/posix/include/posix/locale.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ uspace/lib/posix/include/posix/locale.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -40,7 +40,5 @@
 #endif
 
-#ifndef NULL
-	#define NULL ((void *) 0)
-#endif
+#include <_bits/NULL.h>
 
 #ifndef __locale_t_defined
Index: uspace/lib/posix/include/posix/stddef.h
===================================================================
--- uspace/lib/posix/include/posix/stddef.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ uspace/lib/posix/include/posix/stddef.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -42,7 +42,5 @@
 #include "sys/types.h"
 
-#ifndef NULL
-	#define NULL  ((void *) 0)
-#endif
+#include <_bits/NULL.h>
 
 #define offsetof(type,member) ((size_t) &(((type *) 0)->member))
Index: uspace/lib/posix/include/posix/stdint.h
===================================================================
--- uspace/lib/posix/include/posix/stdint.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ uspace/lib/posix/include/posix/stdint.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -42,44 +42,4 @@
 #include "libc/stdint.h"
 
-#undef INT8_MAX
-#undef INT8_MIN
-#define INT8_MAX  127
-#define INT8_MIN  (-128)
-
-#undef UINT8_MAX
-#undef UINT8_MIN
-#define UINT8_MAX  255
-#define UINT8_MIN  0
-
-#undef INT16_MAX
-#undef INT16_MIN
-#define INT16_MAX  32767
-#define INT16_MIN  (-32768)
-
-#undef UINT16_MAX
-#undef UINT16_MIN
-#define UINT16_MAX  65535
-#define UINT16_MIN  0
-
-#undef INT32_MAX
-#undef INT32_MIN
-#define INT32_MAX  2147483647
-#define INT32_MIN  (-INT32_MAX - 1)
-
-#undef UINT32_MAX
-#undef UINT32_MIN
-#define UINT32_MAX  4294967295U
-#define UINT32_MIN  0U
-
-#undef INT64_MAX
-#undef INT64_MIN
-#define INT64_MAX  9223372036854775807LL
-#define INT64_MIN  (-INT64_MAX - 1LL)
-
-#undef UINT64_MAX
-#undef  UINT64_MIN
-#define UINT64_MAX  18446744073709551615ULL
-#define UINT64_MIN  0ULL
-
 #undef OFF64_MAX
 #undef OFF64_MIN
@@ -92,41 +52,4 @@
 #define AOFF64_MIN  UINT64_MIN
 
-#undef INTMAX_MIN
-#undef INTMAX_MAX
-#define INTMAX_MIN INT64_MIN
-#define INTMAX_MAX INT64_MAX
-
-#undef UINTMAX_MIN
-#undef UINTMAX_MAX
-#define UINTMAX_MIN UINT64_MIN
-#define UINTMAX_MAX UINT64_MAX
-
-/*
- * Fast* and least* integer types.
- *
- * The definitions below are correct as long as uint8/16/32/64_t are defined.
- * Considering the entire rest of the system would break down if they were not,
- * these definitions are just fine.
- */
-typedef uint8_t uint_least8_t;
-typedef uint16_t uint_least16_t;
-typedef uint32_t uint_least32_t;
-typedef uint64_t uint_least64_t;
-
-typedef int8_t int_least8_t;
-typedef int16_t int_least16_t;
-typedef int32_t int_least32_t;
-typedef int64_t int_least64_t;
-
-typedef uint8_t uint_fast8_t;
-typedef uint16_t uint_fast16_t;
-typedef uint32_t uint_fast32_t;
-typedef uint64_t uint_fast64_t;
-
-typedef int8_t int_fast8_t;
-typedef int16_t int_fast16_t;
-typedef int32_t int_fast32_t;
-typedef int64_t int_fast64_t;
-
 #endif /* POSIX_STDINT_H_ */
 
Index: uspace/lib/posix/include/posix/stdlib.h
===================================================================
--- uspace/lib/posix/include/posix/stdlib.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ uspace/lib/posix/include/posix/stdlib.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -43,7 +43,5 @@
 #include "sys/types.h"
 
-#ifndef NULL
-	#define NULL  ((void *) 0)
-#endif
+#include <_bits/NULL.h>
 
 #define RAND_MAX  714025
Index: uspace/lib/posix/include/posix/string.h
===================================================================
--- uspace/lib/posix/include/posix/string.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ uspace/lib/posix/include/posix/string.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -51,7 +51,5 @@
  */
 
-#ifndef NULL
-	#define NULL  ((void *) 0)
-#endif
+#include <_bits/NULL.h>
 
 /*
Index: uspace/lib/posix/include/posix/strings.h
===================================================================
--- uspace/lib/posix/include/posix/strings.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ uspace/lib/posix/include/posix/strings.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -42,5 +42,5 @@
 
 
-#include <types/common.h>
+#include "libc/types/common.h"
 
 /* Search Functions */
Index: uspace/lib/posix/include/posix/time.h
===================================================================
--- uspace/lib/posix/include/posix/time.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ uspace/lib/posix/include/posix/time.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -43,7 +43,5 @@
 #include "sys/types.h"
 
-#ifndef NULL
-	#define NULL  ((void *) 0)
-#endif
+#include <_bits/NULL.h>
 
 #ifndef CLOCKS_PER_SEC
Index: uspace/lib/trackmod/xm.c
===================================================================
--- uspace/lib/trackmod/xm.c	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ uspace/lib/trackmod/xm.c	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -38,4 +38,5 @@
 #include <stdlib.h>
 #include <mem.h>
+#include <types/common.h>
 
 #include "byteorder.h"
Index: uspace/lib/usb/Makefile
===================================================================
--- uspace/lib/usb/Makefile	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ uspace/lib/usb/Makefile	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -31,5 +31,4 @@
 EXTRA_CFLAGS += \
 	-I$(LIBDRV_PREFIX)/include \
-	-I$(LIBUSBDEV_PREFIX)/include \
 	-Iinclude
 
Index: uspace/lib/usb/include/usb/request.h
===================================================================
--- uspace/lib/usb/include/usb/request.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ uspace/lib/usb/include/usb/request.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -37,4 +37,5 @@
 
 #include <stdint.h>
+#include <assert.h>
 
 /** Standard device request. */
@@ -107,5 +108,5 @@
 } __attribute__ ((packed)) usb_device_request_setup_packet_t;
 
-int assert[(sizeof(usb_device_request_setup_packet_t) == 8) ? 1: -1];
+static_assert(sizeof(usb_device_request_setup_packet_t) == 8);
 
 int usb_request_needs_toggle_reset(
Index: uspace/lib/usb/include/usb/usb.h
===================================================================
--- uspace/lib/usb/include/usb/usb.h	(revision 2b11c3c0cf74426080bd899202376055d7cb591d)
+++ uspace/lib/usb/include/usb/usb.h	(revision f834dd816464592376050320f24119ef2aabf8e8)
@@ -39,4 +39,5 @@
 #include <stdint.h>
 #include <types/common.h>
+#include <usb_iface.h>
 
 /** Convert 16bit value from native (host) endianness to USB endianness. */
@@ -52,36 +53,8 @@
 #define uint32_usb2host(n) uint32_t_le2host((n))
 
-
-/** USB transfer type. */
-typedef enum {
-	USB_TRANSFER_CONTROL = 0,
-	USB_TRANSFER_ISOCHRONOUS = 1,
-	USB_TRANSFER_BULK = 2,
-	USB_TRANSFER_INTERRUPT = 3
-} usb_transfer_type_t;
-
 const char * usb_str_transfer_type(usb_transfer_type_t t);
 const char * usb_str_transfer_type_short(usb_transfer_type_t t);
 
-/** USB data transfer direction. */
-typedef enum {
-	USB_DIRECTION_IN,
-	USB_DIRECTION_OUT,
-	USB_DIRECTION_BOTH
-} usb_direction_t;
-
 const char *usb_str_direction(usb_direction_t);
-
-/** USB speeds. */
-typedef enum {
-	/** USB 1.1 low speed (1.5Mbits/s). */
-	USB_SPEED_LOW,
-	/** USB 1.1 full speed (12Mbits/s). */
-	USB_SPEED_FULL,
-	/** USB 2.0 high speed (480Mbits/s). */
-	USB_SPEED_HIGH,
-	/** Psuedo-speed serving as a boundary. */
-	USB_SPEED_MAX
-} usb_speed_t;
 
 static inline bool usb_speed_is_11(const usb_speed_t s)
@@ -108,9 +81,4 @@
 } usb_request_recipient_t;
 
-/** USB address type.
- * Negative values could be used to indicate error.
- */
-typedef int16_t usb_address_t;
-
 /** Default USB address. */
 #define USB_ADDRESS_DEFAULT 0
@@ -132,9 +100,4 @@
 }
 
-/** USB endpoint number type.
- * Negative values could be used to indicate error.
- */
-typedef int16_t usb_endpoint_t;
-
 /** Default control endpoint */
 #define USB_ENDPOINT_DEFAULT_CONTROL 0
@@ -155,16 +118,4 @@
 	    (ep < USB11_ENDPOINT_MAX);
 }
-
-
-/** USB complete address type. 
- * Pair address + endpoint is identification of transaction recipient.
- */
-typedef union {
-	struct {
-		usb_address_t address;
-		usb_endpoint_t endpoint;
-	} __attribute__((packed));
-	uint32_t packed;
-} usb_target_t;
 
 /** Check USB target for allowed values (address and endpoint).
