Index: kernel/Makefile
===================================================================
--- kernel/Makefile	(revision 553492bee0faefb2eb530f9618a7ad57db2d179c)
+++ kernel/Makefile	(revision ac47b7c2b6e75a9b9aa60b443fca9a151cf89e5c)
@@ -45,10 +45,10 @@
 #
 
-DEFS = -DKERNEL -DRELEASE=$(RELEASE) "-DNAME=$(NAME)"
+DEFS = -DKERNEL -DRELEASE=$(RELEASE) "-DNAME=$(NAME)" -D__$(BITS)_BITS__ -D__$(ENDIANESS)__
 
 GCC_CFLAGS = -I$(INCLUDES) -O$(OPTIMIZATION) -imacros ../config.h \
-	-fexec-charset=UTF-8 -fwide-exec-charset=UTF-32 -finput-charset=UTF-8 \
-	-fno-builtin -Wall -Wextra -Wno-unused-parameter -Wmissing-prototypes -Werror \
-	-nostdlib -nostdinc -pipe
+	-fexec-charset=UTF-8 -fwide-exec-charset=UTF-32$(ENDIANESS) \
+	-finput-charset=UTF-8 -fno-builtin -Wall -Wextra -Wno-unused-parameter \
+	-Wmissing-prototypes -Werror -nostdlib -nostdinc -pipe
 
 ICC_CFLAGS = -I$(INCLUDES) -O$(OPTIMIZATION) -imacros ../config.h \
Index: kernel/arch/amd64/Makefile.inc
===================================================================
--- kernel/arch/amd64/Makefile.inc	(revision 553492bee0faefb2eb530f9618a7ad57db2d179c)
+++ kernel/arch/amd64/Makefile.inc	(revision ac47b7c2b6e75a9b9aa60b443fca9a151cf89e5c)
@@ -42,5 +42,6 @@
 SUNCC_CFLAGS += -m64 -xmodel=kernel
 
-DEFS += -D__64_BITS__
+BITS = 64
+ENDIANESS = LE
 
 ## Accepted CPUs
Index: rnel/arch/amd64/include/byteorder.h
===================================================================
--- kernel/arch/amd64/include/byteorder.h	(revision 553492bee0faefb2eb530f9618a7ad57db2d179c)
+++ 	(revision )
@@ -1,44 +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.
- */
-
-/** @addtogroup amd64	
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_amd64_BYTEORDER_H_
-#define KERN_amd64_BYTEORDER_H_
-
-/* AMD64 is little-endian */
-#define ARCH_IS_LITTLE_ENDIAN
-
-#endif
-
-/** @}
- */
Index: kernel/arch/arm32/Makefile.inc
===================================================================
--- kernel/arch/arm32/Makefile.inc	(revision 553492bee0faefb2eb530f9618a7ad57db2d179c)
+++ kernel/arch/arm32/Makefile.inc	(revision ac47b7c2b6e75a9b9aa60b443fca9a151cf89e5c)
@@ -40,5 +40,6 @@
 GCC_CFLAGS += -fno-zero-initialized-in-bss
 
-DEFS += -D__32_BITS__
+BITS = 32
+ENDIANESS = LE
 
 ARCH_SOURCES = \
Index: rnel/arch/arm32/include/byteorder.h
===================================================================
--- kernel/arch/arm32/include/byteorder.h	(revision 553492bee0faefb2eb530f9618a7ad57db2d179c)
+++ 	(revision )
@@ -1,48 +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.
- */
-
-/** @addtogroup arm32	
- * @{
- */
-/** @file
- *  @brief Endianness definitions.
- */
-
-#ifndef KERN_arm32_BYTEORDER_H_
-#define KERN_arm32_BYTEORDER_H_
-
-#ifdef BIG_ENDIAN
-#define ARCH_IS_BIG_ENDIAN
-#else
-#define ARCH_IS_LITTLE_ENDIAN
-#endif
-
-#endif
-
-/** @}
- */
Index: kernel/arch/ia32/Makefile.inc
===================================================================
--- kernel/arch/ia32/Makefile.inc	(revision 553492bee0faefb2eb530f9618a7ad57db2d179c)
+++ kernel/arch/ia32/Makefile.inc	(revision ac47b7c2b6e75a9b9aa60b443fca9a151cf89e5c)
@@ -36,5 +36,6 @@
 TOOLCHAIN_DIR = $(CROSS_PREFIX)/i686
 
-DEFS += -D__32_BITS__
+BITS = 32
+ENDIANESS = LE
 
 CMN1 = -m32
Index: rnel/arch/ia32/include/byteorder.h
===================================================================
--- kernel/arch/ia32/include/byteorder.h	(revision 553492bee0faefb2eb530f9618a7ad57db2d179c)
+++ 	(revision )
@@ -1,44 +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.
- */
-
-/** @addtogroup ia32	
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_ia32_BYTEORDER_H_
-#define KERN_ia32_BYTEORDER_H_
-
-/* IA-32 is little-endian */
-#define ARCH_IS_LITTLE_ENDIAN
-
-#endif
-
-/** @}
- */
Index: kernel/arch/ia64/Makefile.inc
===================================================================
--- kernel/arch/ia64/Makefile.inc	(revision 553492bee0faefb2eb530f9618a7ad57db2d179c)
+++ kernel/arch/ia64/Makefile.inc	(revision ac47b7c2b6e75a9b9aa60b443fca9a151cf89e5c)
@@ -42,5 +42,6 @@
 AFLAGS += -mconstant-gp
 
-DEFS += -D__64_BITS__
+BITS = 64
+ENDIANESS = LE
 
 ARCH_SOURCES = \
Index: rnel/arch/ia64/include/byteorder.h
===================================================================
--- kernel/arch/ia64/include/byteorder.h	(revision 553492bee0faefb2eb530f9618a7ad57db2d179c)
+++ 	(revision )
@@ -1,44 +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.
- */
-
-/** @addtogroup ia64	
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_ia64_BYTEORDER_H_
-#define KERN_ia64_BYTEORDER_H_
-
-/* IA-64 is little-endian */
-#define ARCH_IS_LITTLE_ENDIAN
-
-#endif
-
-/** @}
- */
Index: kernel/arch/mips32/Makefile.inc
===================================================================
--- kernel/arch/mips32/Makefile.inc	(revision 553492bee0faefb2eb530f9618a7ad57db2d179c)
+++ kernel/arch/mips32/Makefile.inc	(revision ac47b7c2b6e75a9b9aa60b443fca9a151cf89e5c)
@@ -37,5 +37,5 @@
 GCC_CFLAGS += -mno-abicalls -G 0 -fno-zero-initialized-in-bss -mips3
 
-DEFS += -D__32_BITS__
+BITS = 32
 
 ## Accepted MACHINEs
@@ -44,4 +44,5 @@
 ifeq ($(MACHINE),lgxemul)
 	BFD_NAME = elf32-tradlittlemips
+	ENDIANESS = LE
 endif
 ifeq ($(MACHINE),bgxemul)
@@ -49,8 +50,10 @@
 	TOOLCHAIN_DIR = $(CROSS_PREFIX)/mips
 	TARGET = mips-linux-gnu
-	GCC_CFLAGS += -DBIG_ENDIAN
+	ENDIANESS = BE
+	GCC_CFLAGS += -D__BE__
 endif
 ifeq ($(MACHINE),msim)
 	BFD_NAME = elf32-tradlittlemips
+	ENDIANESS = LE
 	GCC_CFLAGS += -mhard-float
 endif
Index: rnel/arch/mips32/include/byteorder.h
===================================================================
--- kernel/arch/mips32/include/byteorder.h	(revision 553492bee0faefb2eb530f9618a7ad57db2d179c)
+++ 	(revision )
@@ -1,47 +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.
- */
-
-/** @addtogroup mips32	
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_mips32_BYTEORDER_H_
-#define KERN_mips32_BYTEORDER_H_
-
-#ifdef BIG_ENDIAN
-#define ARCH_IS_BIG_ENDIAN
-#else
-#define ARCH_IS_LITTLE_ENDIAN
-#endif
-
-#endif
-
-/** @}
- */
Index: kernel/arch/mips32/include/elf.h
===================================================================
--- kernel/arch/mips32/include/elf.h	(revision 553492bee0faefb2eb530f9618a7ad57db2d179c)
+++ kernel/arch/mips32/include/elf.h	(revision ac47b7c2b6e75a9b9aa60b443fca9a151cf89e5c)
@@ -27,5 +27,5 @@
  */
 
-/** @addtogroup mips32	
+/** @addtogroup mips32
  * @{
  */
@@ -36,15 +36,13 @@
 #define KERN_mips32_ELF_H_
 
-#include <byteorder.h>
+#define ELF_MACHINE  EM_MIPS
 
-#define	ELF_MACHINE		EM_MIPS
-
-#ifdef ARCH_IS_BIG_ENDIAN
-#  define ELF_DATA_ENCODING	ELFDATA2MSB
+#ifdef __BE__
+	#define ELF_DATA_ENCODING  ELFDATA2MSB
 #else
-#  define ELF_DATA_ENCODING	ELFDATA2LSB
+	#define ELF_DATA_ENCODING  ELFDATA2LSB
 #endif
 
-#define ELF_CLASS		ELFCLASS32
+#define ELF_CLASS  ELFCLASS32
 
 #endif
Index: kernel/arch/ppc32/Makefile.inc
===================================================================
--- kernel/arch/ppc32/Makefile.inc	(revision 553492bee0faefb2eb530f9618a7ad57db2d179c)
+++ kernel/arch/ppc32/Makefile.inc	(revision ac47b7c2b6e75a9b9aa60b443fca9a151cf89e5c)
@@ -40,5 +40,6 @@
 LFLAGS += -no-check-sections -N
 
-DEFS += -D__32_BITS__
+BITS = 32
+ENDIANESS = BE
 
 ARCH_SOURCES = \
Index: rnel/arch/ppc32/include/byteorder.h
===================================================================
--- kernel/arch/ppc32/include/byteorder.h	(revision 553492bee0faefb2eb530f9618a7ad57db2d179c)
+++ 	(revision )
@@ -1,43 +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.
- */
-
-/** @addtogroup ppc32	
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_ppc32_BYTEORDER_H_
-#define KERN_ppc32_BYTEORDER_H_
-
-#define ARCH_IS_BIG_ENDIAN
-
-#endif
-
-/** @}
- */
Index: kernel/arch/sparc64/Makefile.inc
===================================================================
--- kernel/arch/sparc64/Makefile.inc	(revision 553492bee0faefb2eb530f9618a7ad57db2d179c)
+++ kernel/arch/sparc64/Makefile.inc	(revision ac47b7c2b6e75a9b9aa60b443fca9a151cf89e5c)
@@ -41,5 +41,6 @@
 LFLAGS += -no-check-sections -N
 
-DEFS += -D__64_BITS__
+BITS = 64
+ENDIANESS = BE
 
 ifeq ($(PROCESSOR),us)
Index: rnel/arch/sparc64/include/byteorder.h
===================================================================
--- kernel/arch/sparc64/include/byteorder.h	(revision 553492bee0faefb2eb530f9618a7ad57db2d179c)
+++ 	(revision )
@@ -1,43 +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.
- */
-
-/** @addtogroup sparc64	
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_sparc64_BYTEORDER_H_
-#define KERN_sparc64_BYTEORDER_H_
-
-#define ARCH_IS_BIG_ENDIAN
-
-#endif
-
-/** @}
- */
Index: kernel/generic/include/byteorder.h
===================================================================
--- kernel/generic/include/byteorder.h	(revision 553492bee0faefb2eb530f9618a7ad57db2d179c)
+++ kernel/generic/include/byteorder.h	(revision ac47b7c2b6e75a9b9aa60b443fca9a151cf89e5c)
@@ -27,5 +27,5 @@
  */
 
-/** @addtogroup generic	
+/** @addtogroup generic
  * @{
  */
@@ -36,46 +36,45 @@
 #define KERN_BYTEORDER_H_
 
-#include <arch/byteorder.h>
 #include <arch/types.h>
 
-#if !(defined(ARCH_IS_BIG_ENDIAN) ^ defined(ARCH_IS_LITTLE_ENDIAN))
-#error The architecture must be either big-endian or little-endian.
+#if !(defined(__BE__) ^ defined(__LE__))
+	#error The architecture must be either big-endian or little-endian.
 #endif
 
-#ifdef ARCH_IS_BIG_ENDIAN
+#ifdef __BE__
 
-#define uint16_t_le2host(n)		uint16_t_byteorder_swap(n)
-#define uint32_t_le2host(n)		uint32_t_byteorder_swap(n)
-#define uint64_t_le2host(n)		uint64_t_byteorder_swap(n)
+#define uint16_t_le2host(n)  (uint16_t_byteorder_swap(n))
+#define uint32_t_le2host(n)  (uint32_t_byteorder_swap(n))
+#define uint64_t_le2host(n)  (uint64_t_byteorder_swap(n))
 
-#define uint16_t_be2host(n)		(n)
-#define uint32_t_be2host(n)		(n)
-#define uint64_t_be2host(n)		(n)
+#define uint16_t_be2host(n)  (n)
+#define uint32_t_be2host(n)  (n)
+#define uint64_t_be2host(n)  (n)
 
-#define host2uint16_t_le(n)		uint16_t_byteorder_swap(n)
-#define host2uint32_t_le(n)		uint32_t_byteorder_swap(n)
-#define host2uint64_t_le(n)		uint64_t_byteorder_swap(n)
+#define host2uint16_t_le(n)  (uint16_t_byteorder_swap(n))
+#define host2uint32_t_le(n)  (uint32_t_byteorder_swap(n))
+#define host2uint64_t_le(n)  (uint64_t_byteorder_swap(n))
 
-#define host2uint16_t_be(n)		(n)
-#define host2uint32_t_be(n)		(n)
-#define host2uint64_t_be(n)		(n)
+#define host2uint16_t_be(n)  (n)
+#define host2uint32_t_be(n)  (n)
+#define host2uint64_t_be(n)  (n)
 
 #else
 
-#define uint16_t_le2host(n)		(n)
-#define uint32_t_le2host(n)		(n)
-#define uint64_t_le2host(n)		(n)
+#define uint16_t_le2host(n)  (n)
+#define uint32_t_le2host(n)  (n)
+#define uint64_t_le2host(n)  (n)
 
-#define uint16_t_be2host(n)		uint16_t_byteorder_swap(n)
-#define uint32_t_be2host(n)		uint32_t_byteorder_swap(n)
-#define uint64_t_be2host(n)		uint64_t_byteorder_swap(n)
+#define uint16_t_be2host(n)  (uint16_t_byteorder_swap(n))
+#define uint32_t_be2host(n)  (uint32_t_byteorder_swap(n))
+#define uint64_t_be2host(n)  (uint64_t_byteorder_swap(n))
 
-#define host2uint16_t_le(n)		(n)
-#define host2uint32_t_le(n)		(n)
-#define host2uint64_t_le(n)		(n)
+#define host2uint16_t_le(n)  (n)
+#define host2uint32_t_le(n)  (n)
+#define host2uint64_t_le(n)  (n)
 
-#define host2uint16_t_be(n)		uint16_t_byteorder_swap(n)
-#define host2uint32_t_be(n)		uint32_t_byteorder_swap(n)
-#define host2uint64_t_be(n)		uint64_t_byteorder_swap(n)
+#define host2uint16_t_be(n)  (uint16_t_byteorder_swap(n))
+#define host2uint32_t_be(n)  (uint32_t_byteorder_swap(n))
+#define host2uint64_t_be(n)  (uint64_t_byteorder_swap(n))
 
 #endif
Index: kernel/generic/include/string.h
===================================================================
--- kernel/generic/include/string.h	(revision 553492bee0faefb2eb530f9618a7ad57db2d179c)
+++ kernel/generic/include/string.h	(revision ac47b7c2b6e75a9b9aa60b443fca9a151cf89e5c)
@@ -58,6 +58,4 @@
 #define U_CURSOR       0x2588
 
-#define U_BOM          0xfeff
-
 /**< No size limit constant */
 #define STR_NO_LIMIT  ((size_t) -1)
Index: kernel/generic/src/printf/printf_core.c
===================================================================
--- kernel/generic/src/printf/printf_core.c	(revision 553492bee0faefb2eb530f9618a7ad57db2d179c)
+++ kernel/generic/src/printf/printf_core.c	(revision ac47b7c2b6e75a9b9aa60b443fca9a151cf89e5c)
@@ -302,7 +302,4 @@
 	if (str == NULL)
 		return printf_putstr(nullstr, ps);
-	
-	if (*str == U_BOM)
-		str++;
 	
 	/* Print leading spaces. */
Index: uspace/lib/libc/Makefile
===================================================================
--- uspace/lib/libc/Makefile	(revision 553492bee0faefb2eb530f9618a7ad57db2d179c)
+++ uspace/lib/libc/Makefile	(revision ac47b7c2b6e75a9b9aa60b443fca9a151cf89e5c)
@@ -32,4 +32,5 @@
 LIBC_PREFIX = $(shell pwd)
 SOFTINT_PREFIX = ../softint
+
 
 ## Setup toolchain
Index: uspace/lib/libc/Makefile.toolchain
===================================================================
--- uspace/lib/libc/Makefile.toolchain	(revision 553492bee0faefb2eb530f9618a7ad57db2d179c)
+++ uspace/lib/libc/Makefile.toolchain	(revision ac47b7c2b6e75a9b9aa60b443fca9a151cf89e5c)
@@ -28,7 +28,8 @@
 
 CFLAGS = -I$(LIBC_PREFIX)/include -O3 -imacros $(LIBC_PREFIX)/../../../config.h \
-	-fexec-charset=UTF-8 -fwide-exec-charset=UTF-32 -finput-charset=UTF-8 \
-	-fno-builtin -Wall -Wextra -Wno-unused-parameter -Wmissing-prototypes \
-	-Werror-implicit-function-declaration -nostdlib -nostdinc -pipe -g
+	-fexec-charset=UTF-8 -fwide-exec-charset=UTF-32$(ENDIANESS) \
+	-finput-charset=UTF-8 -fno-builtin -Wall -Wextra -Wno-unused-parameter \
+	-Wmissing-prototypes -Werror-implicit-function-declaration -nostdlib \
+	-nostdinc -pipe -g -D__$(ENDIANESS)__
 LFLAGS = -M -N $(SOFTINT_PREFIX)/libsoftint.a
 AFLAGS =
Index: uspace/lib/libc/arch/amd64/Makefile.inc
===================================================================
--- uspace/lib/libc/arch/amd64/Makefile.inc	(revision 553492bee0faefb2eb530f9618a7ad57db2d179c)
+++ uspace/lib/libc/arch/amd64/Makefile.inc	(revision ac47b7c2b6e75a9b9aa60b443fca9a151cf89e5c)
@@ -39,4 +39,6 @@
 LFLAGS += -N
 
+ENDIANESS = LE
+
 BFD_NAME = elf64-x86-64
 BFD_ARCH = i386:x86-64
Index: pace/lib/libc/arch/amd64/include/byteorder.h
===================================================================
--- uspace/lib/libc/arch/amd64/include/byteorder.h	(revision 553492bee0faefb2eb530f9618a7ad57db2d179c)
+++ 	(revision )
@@ -1,44 +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.
- */
-
-/** @addtogroup libcamd64
- * @{
- */
-/** @file
- */
-
-#ifndef LIBC_amd64_BYTEORDER_H_
-#define LIBC_amd64_BYTEORDER_H_
-
-/* AMD64 is little-endian */
-#define ARCH_IS_LITTLE_ENDIAN
-
-#endif
-
-/** @}
- */
Index: uspace/lib/libc/arch/arm32/Makefile.inc
===================================================================
--- uspace/lib/libc/arch/arm32/Makefile.inc	(revision 553492bee0faefb2eb530f9618a7ad57db2d179c)
+++ uspace/lib/libc/arch/arm32/Makefile.inc	(revision ac47b7c2b6e75a9b9aa60b443fca9a151cf89e5c)
@@ -33,7 +33,4 @@
 TARGET = arm-linux-gnu
 TOOLCHAIN_DIR = $(CROSS_PREFIX)/arm/bin
-CFLAGS += -ffixed-r9 -mtp=soft 
-LFLAGS += -N $(SOFTINT_PREFIX)/libsoftint.a
-AFLAGS +=
 
 ARCH_SOURCES += arch/$(UARCH)/src/syscall.c \
@@ -42,4 +39,9 @@
 	arch/$(UARCH)/src/eabi.S
 
+CFLAGS += -ffixed-r9 -mtp=soft
+LFLAGS += -N $(SOFTINT_PREFIX)/libsoftint.a
+
+ENDIANESS = LE
+
 BFD_NAME = elf32-littlearm
 BFD_ARCH = arm
Index: pace/lib/libc/arch/arm32/include/byteorder.h
===================================================================
--- uspace/lib/libc/arch/arm32/include/byteorder.h	(revision 553492bee0faefb2eb530f9618a7ad57db2d179c)
+++ 	(revision )
@@ -1,44 +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.
- */
-
-/** @addtogroup libcarm32
- * @{
- */
-/** @file
- *  @brief Endianness definitions.
- */
-
-#ifndef LIBC_arm32_BYTEORDER_H_
-#define LIBC_arm32_BYTEORDER_H_
-
-#define ARCH_IS_LITTLE_ENDIAN
-
-#endif
-
-/** @}
- */
Index: uspace/lib/libc/arch/ia32/Makefile.inc
===================================================================
--- uspace/lib/libc/arch/ia32/Makefile.inc	(revision 553492bee0faefb2eb530f9618a7ad57db2d179c)
+++ uspace/lib/libc/arch/ia32/Makefile.inc	(revision ac47b7c2b6e75a9b9aa60b443fca9a151cf89e5c)
@@ -40,4 +40,6 @@
 LFLAGS += -N
 
+ENDIANESS = LE
+
 BFD_NAME = elf32-i386
 BFD_ARCH = i386
Index: pace/lib/libc/arch/ia32/include/byteorder.h
===================================================================
--- uspace/lib/libc/arch/ia32/include/byteorder.h	(revision 553492bee0faefb2eb530f9618a7ad57db2d179c)
+++ 	(revision )
@@ -1,44 +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.
- */
-
-/** @addtogroup libcia32	
- * @{
- */
-/** @file
- */
-
-#ifndef LIBC_ia32_BYTEORDER_H_
-#define LIBC_ia32_BYTEORDER_H_
-
-/* IA-32 is little-endian */
-#define ARCH_IS_LITTLE_ENDIAN
-
-#endif
-
-/** @}
- */
Index: uspace/lib/libc/arch/ia64/Makefile.inc
===================================================================
--- uspace/lib/libc/arch/ia64/Makefile.inc	(revision 553492bee0faefb2eb530f9618a7ad57db2d179c)
+++ uspace/lib/libc/arch/ia64/Makefile.inc	(revision ac47b7c2b6e75a9b9aa60b443fca9a151cf89e5c)
@@ -32,7 +32,4 @@
 TARGET = ia64-pc-linux-gnu
 TOOLCHAIN_DIR = $(CROSS_PREFIX)/ia64/bin
-CFLAGS += -fno-unwind-tables -DMALLOC_ALIGNMENT_16
-LFLAGS += -N $(SOFTINT_PREFIX)/libsoftint.a
-AFLAGS += 
 
 ARCH_SOURCES += arch/$(UARCH)/src/syscall.S \
@@ -41,4 +38,9 @@
 	arch/$(UARCH)/src/ddi.c
 
+CFLAGS += -fno-unwind-tables -DMALLOC_ALIGNMENT_16
+LFLAGS += -N $(SOFTINT_PREFIX)/libsoftint.a
+
+ENDIANESS = LE
+
 BFD_NAME = elf64-ia64-little
 BFD_ARCH = ia64-elf64
Index: pace/lib/libc/arch/ia64/include/byteorder.h
===================================================================
--- uspace/lib/libc/arch/ia64/include/byteorder.h	(revision 553492bee0faefb2eb530f9618a7ad57db2d179c)
+++ 	(revision )
@@ -1,44 +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.
- */
-
-/** @addtogroup libcia64
- * @{
- */
-/** @file
- */
-
-#ifndef LIBC_ia64_BYTEORDER_H_
-#define LIBC_ia64_BYTEORDER_H_
-
-/* IA-64 is little-endian */
-#define ARCH_IS_LITTLE_ENDIAN
-
-#endif
-
-/** @}
- */
Index: uspace/lib/libc/arch/mips32/Makefile.inc
===================================================================
--- uspace/lib/libc/arch/mips32/Makefile.inc	(revision 553492bee0faefb2eb530f9618a7ad57db2d179c)
+++ uspace/lib/libc/arch/mips32/Makefile.inc	(revision ac47b7c2b6e75a9b9aa60b443fca9a151cf89e5c)
@@ -32,5 +32,4 @@
 TARGET = mipsel-linux-gnu
 TOOLCHAIN_DIR = $(CROSS_PREFIX)/mipsel/bin
-CFLAGS += -mips3
 
 ARCH_SOURCES += arch/$(UARCH)/src/syscall.c \
@@ -38,4 +37,8 @@
 	arch/$(UARCH)/src/tls.c
 
+CFLAGS += -mips3
+
+ENDIANESS = LE
+
 BFD_ARCH = mips
 BFD_NAME = elf32-tradlittlemips
Index: pace/lib/libc/arch/mips32/include/byteorder.h
===================================================================
--- uspace/lib/libc/arch/mips32/include/byteorder.h	(revision 553492bee0faefb2eb530f9618a7ad57db2d179c)
+++ 	(revision )
@@ -1,43 +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.
- */
-
-/** @addtogroup libcmips32
- * @{
- */
-/** @file
- */
-
-#ifndef LIBC_mips32_BYTEORDER_H_
-#define LIBC_mips32_BYTEORDER_H_
-
-#define ARCH_IS_LITTLE_ENDIAN
-
-#endif
-
-/** @}
- */
Index: uspace/lib/libc/arch/mips32eb/Makefile.inc
===================================================================
--- uspace/lib/libc/arch/mips32eb/Makefile.inc	(revision 553492bee0faefb2eb530f9618a7ad57db2d179c)
+++ uspace/lib/libc/arch/mips32eb/Makefile.inc	(revision ac47b7c2b6e75a9b9aa60b443fca9a151cf89e5c)
@@ -32,5 +32,4 @@
 TARGET = mips-linux-gnu
 TOOLCHAIN_DIR = $(CROSS_PREFIX)/mips/bin
-CFLAGS += -mips3
 
 ARCH_SOURCES += arch/$(UARCH)/src/syscall.c \
@@ -38,5 +37,8 @@
 		arch/$(UARCH)/src/tls.c
 
+CFLAGS += -mips3
 LFLAGS += -N
+
+ENDIANESS = BE
 
 BFD_ARCH = mips
Index: pace/lib/libc/arch/mips32eb/include/byteorder.h
===================================================================
--- uspace/lib/libc/arch/mips32eb/include/byteorder.h	(revision 553492bee0faefb2eb530f9618a7ad57db2d179c)
+++ 	(revision )
@@ -1,43 +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.
- */
-
-/** @addtogroup libcmips32
- * @{
- */
-/** @file
- */
-
-#ifndef LIBC_mips32eb_BYTEORDER_H_
-#define LIBC_mips32eb_BYTEORDER_H_
-
-#define ARCH_IS_BIG_ENDIAN
-
-#endif
-
-/** @}
- */
Index: uspace/lib/libc/arch/ppc32/Makefile.inc
===================================================================
--- uspace/lib/libc/arch/ppc32/Makefile.inc	(revision 553492bee0faefb2eb530f9618a7ad57db2d179c)
+++ uspace/lib/libc/arch/ppc32/Makefile.inc	(revision ac47b7c2b6e75a9b9aa60b443fca9a151cf89e5c)
@@ -41,4 +41,6 @@
 LFLAGS += -N
 
+ENDIANESS = BE
+
 BFD_NAME = elf32-powerpc
 BFD_ARCH = powerpc:common
Index: pace/lib/libc/arch/ppc32/include/byteorder.h
===================================================================
--- uspace/lib/libc/arch/ppc32/include/byteorder.h	(revision 553492bee0faefb2eb530f9618a7ad57db2d179c)
+++ 	(revision )
@@ -1,43 +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.
- */
-
-/** @addtogroup libcppc32
- * @{
- */
-/** @file
- */
-
-#ifndef LIBC_ppc32_BYTEORDER_H_
-#define LIBC_ppc32_BYTEORDER_H_
-
-#define ARCH_IS_BIG_ENDIAN
-
-#endif
-
-/** @}
- */
Index: uspace/lib/libc/arch/sparc64/Makefile.inc
===================================================================
--- uspace/lib/libc/arch/sparc64/Makefile.inc	(revision 553492bee0faefb2eb530f9618a7ad57db2d179c)
+++ uspace/lib/libc/arch/sparc64/Makefile.inc	(revision ac47b7c2b6e75a9b9aa60b443fca9a151cf89e5c)
@@ -39,4 +39,6 @@
 LFLAGS += -no-check-sections -N
 
+ENDIANESS = BE
+
 BFD_NAME = elf64-sparc
 BFD_ARCH = sparc
Index: pace/lib/libc/arch/sparc64/include/byteorder.h
===================================================================
--- uspace/lib/libc/arch/sparc64/include/byteorder.h	(revision 553492bee0faefb2eb530f9618a7ad57db2d179c)
+++ 	(revision )
@@ -1,43 +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.
- */
-
-/** @addtogroup libcsparc64
- * @{
- */
-/** @file
- */
-
-#ifndef LIBC_sparc64_BYTEORDER_H_
-#define LIBC_sparc64_BYTEORDER_H_
-
-#define ARCH_IS_BIG_ENDIAN
-
-#endif
-
-/** @}
- */
Index: uspace/lib/libc/generic/io/printf_core.c
===================================================================
--- uspace/lib/libc/generic/io/printf_core.c	(revision 553492bee0faefb2eb530f9618a7ad57db2d179c)
+++ uspace/lib/libc/generic/io/printf_core.c	(revision ac47b7c2b6e75a9b9aa60b443fca9a151cf89e5c)
@@ -301,7 +301,4 @@
 	if (str == NULL)
 		return printf_putstr(nullstr, ps);
-	
-	if (*str == U_BOM)
-		str++;
 	
 	/* Print leading spaces. */
Index: uspace/lib/libc/include/byteorder.h
===================================================================
--- uspace/lib/libc/include/byteorder.h	(revision 553492bee0faefb2eb530f9618a7ad57db2d179c)
+++ uspace/lib/libc/include/byteorder.h	(revision ac47b7c2b6e75a9b9aa60b443fca9a151cf89e5c)
@@ -36,46 +36,45 @@
 #define LIBC_BYTEORDER_H_
 
-#include <libarch/byteorder.h>
 #include <stdint.h>
 
-#if !(defined(ARCH_IS_BIG_ENDIAN) ^ defined(ARCH_IS_LITTLE_ENDIAN))
-#error The architecture must be either big-endian or little-endian.
+#if !(defined(__BE__) ^ defined(__LE__))
+	#error The architecture must be either big-endian or little-endian.
 #endif
 
-#ifdef ARCH_IS_BIG_ENDIAN
+#ifdef __BE__
 
-#define uint16_t_le2host(n)		uint16_t_byteorder_swap(n)
-#define uint32_t_le2host(n)		uint32_t_byteorder_swap(n)
-#define uint64_t_le2host(n)		uint64_t_byteorder_swap(n)
+#define uint16_t_le2host(n)  (uint16_t_byteorder_swap(n))
+#define uint32_t_le2host(n)  (uint32_t_byteorder_swap(n))
+#define uint64_t_le2host(n)  (uint64_t_byteorder_swap(n))
 
-#define uint16_t_be2host(n)		(n)
-#define uint32_t_be2host(n)		(n)
-#define uint64_t_be2host(n)		(n)
+#define uint16_t_be2host(n)  (n)
+#define uint32_t_be2host(n)  (n)
+#define uint64_t_be2host(n)  (n)
 
-#define host2uint16_t_le(n)		uint16_t_byteorder_swap(n)
-#define host2uint32_t_le(n)		uint32_t_byteorder_swap(n)
-#define host2uint64_t_le(n)		uint64_t_byteorder_swap(n)
+#define host2uint16_t_le(n)  (uint16_t_byteorder_swap(n))
+#define host2uint32_t_le(n)  (uint32_t_byteorder_swap(n))
+#define host2uint64_t_le(n)  (uint64_t_byteorder_swap(n))
 
-#define host2uint16_t_be(n)		(n)
-#define host2uint32_t_be(n)		(n)
-#define host2uint64_t_be(n)		(n)
+#define host2uint16_t_be(n)  (n)
+#define host2uint32_t_be(n)  (n)
+#define host2uint64_t_be(n)  (n)
 
 #else
 
-#define uint16_t_le2host(n)		(n)
-#define uint32_t_le2host(n)		(n)
-#define uint64_t_le2host(n)		(n)
+#define uint16_t_le2host(n)  (n)
+#define uint32_t_le2host(n)  (n)
+#define uint64_t_le2host(n)  (n)
 
-#define uint16_t_be2host(n)		uint16_t_byteorder_swap(n)
-#define uint32_t_be2host(n)		uint32_t_byteorder_swap(n)
-#define uint64_t_be2host(n)		uint64_t_byteorder_swap(n)
+#define uint16_t_be2host(n)  (uint16_t_byteorder_swap(n))
+#define uint32_t_be2host(n)  (uint32_t_byteorder_swap(n))
+#define uint64_t_be2host(n)  (uint64_t_byteorder_swap(n))
 
-#define host2uint16_t_le(n)		(n)
-#define host2uint32_t_le(n)		(n)
-#define host2uint64_t_le(n)		(n)
+#define host2uint16_t_le(n)  (n)
+#define host2uint32_t_le(n)  (n)
+#define host2uint64_t_le(n)  (n)
 
-#define host2uint16_t_be(n)		uint16_t_byteorder_swap(n)
-#define host2uint32_t_be(n)		uint32_t_byteorder_swap(n)
-#define host2uint64_t_be(n)		uint64_t_byteorder_swap(n)
+#define host2uint16_t_be(n)  (uint16_t_byteorder_swap(n))
+#define host2uint32_t_be(n)  (uint32_t_byteorder_swap(n))
+#define host2uint64_t_be(n)  (uint64_t_byteorder_swap(n))
 
 #endif
Index: uspace/lib/libc/include/string.h
===================================================================
--- uspace/lib/libc/include/string.h	(revision 553492bee0faefb2eb530f9618a7ad57db2d179c)
+++ uspace/lib/libc/include/string.h	(revision ac47b7c2b6e75a9b9aa60b443fca9a151cf89e5c)
@@ -41,5 +41,4 @@
 
 #define U_SPECIAL  '?'
-#define U_BOM      0xfeff
 
 /** No size limit constant */
Index: uspace/lib/softfloat/Makefile
===================================================================
--- uspace/lib/softfloat/Makefile	(revision 553492bee0faefb2eb530f9618a7ad57db2d179c)
+++ uspace/lib/softfloat/Makefile	(revision ac47b7c2b6e75a9b9aa60b443fca9a151cf89e5c)
@@ -37,5 +37,5 @@
 include $(LIBC_PREFIX)/Makefile.toolchain
 
-CFLAGS +=-Iinclude -Iarch/$(UARCH)/include/
+CFLAGS += -Iinclude -Iarch/$(UARCH)/include/
 
 ## Sources
Index: uspace/lib/softfloat/include/sftypes.h
===================================================================
--- uspace/lib/softfloat/include/sftypes.h	(revision 553492bee0faefb2eb530f9618a7ad57db2d179c)
+++ uspace/lib/softfloat/include/sftypes.h	(revision ac47b7c2b6e75a9b9aa60b443fca9a151cf89e5c)
@@ -27,5 +27,5 @@
  */
 
- /** @addtogroup softfloat	
+/** @addtogroup softfloat
  * @{
  */
@@ -42,38 +42,38 @@
 	float f;
 	uint32_t binary;
-
-	struct 	{
-#if defined(ARCH_IS_BIG_ENDIAN)
-		uint32_t sign:1;
-		uint32_t exp:8;
-		uint32_t fraction:23;
-#elif defined(ARCH_IS_LITTLE_ENDIAN)
-		uint32_t fraction:23;
-		uint32_t exp:8;
-		uint32_t sign:1;
-#else 
-#error "Unknown endians."
+	
+	struct {
+#if defined(__BE__)
+		uint32_t sign : 1;
+		uint32_t exp : 8;
+		uint32_t fraction : 23;
+#elif defined(__LE__)
+		uint32_t fraction : 23;
+		uint32_t exp : 8;
+		uint32_t sign : 1;
+#else
+	#error Unknown endianess
 #endif
 		} parts __attribute__ ((packed));
- 	} float32;
-	
+} float32;
+
 typedef union {
 	double d;
 	uint64_t binary;
 	
-	struct	{
-#if defined(ARCH_IS_BIG_ENDIAN)
-		uint64_t sign:1;
-		uint64_t exp:11;
-		uint64_t fraction:52;
-#elif defined(ARCH_IS_LITTLE_ENDIAN)
-		uint64_t fraction:52;
-		uint64_t exp:11;
-		uint64_t sign:1;
-#else 
-#error "Unknown endians."
+	struct {
+#if defined(__BE__)
+		uint64_t sign : 1;
+		uint64_t exp : 11;
+		uint64_t fraction : 52;
+#elif defined(__LE__)
+		uint64_t fraction : 52;
+		uint64_t exp : 11;
+		uint64_t sign : 1;
+#else
+	#error Unknown endianess
 #endif
-		} parts __attribute__ ((packed));
-	} float64;
+	} parts __attribute__ ((packed));
+} float64;
 
 #define FLOAT32_MAX 0x7f800000
@@ -110,6 +110,4 @@
 #endif
 
-
- /** @}
+/** @}
  */
-
