Changeset ac47b7c2 in mainline


Ignore:
Timestamp:
2009-06-18T08:30:50Z (15 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
12956e57
Parents:
553492be
Message:

define endianess externally to be able to exactly specify whether we are using UTF-32LE or UTF-32BE
quit messing with BOM in UTF-32

Files:
15 deleted
27 edited

Legend:

Unmodified
Added
Removed
  • kernel/Makefile

    r553492be rac47b7c2  
    4545#
    4646
    47 DEFS = -DKERNEL -DRELEASE=$(RELEASE) "-DNAME=$(NAME)"
     47DEFS = -DKERNEL -DRELEASE=$(RELEASE) "-DNAME=$(NAME)" -D__$(BITS)_BITS__ -D__$(ENDIANESS)__
    4848
    4949GCC_CFLAGS = -I$(INCLUDES) -O$(OPTIMIZATION) -imacros ../config.h \
    50         -fexec-charset=UTF-8 -fwide-exec-charset=UTF-32 -finput-charset=UTF-8 \
    51         -fno-builtin -Wall -Wextra -Wno-unused-parameter -Wmissing-prototypes -Werror \
    52         -nostdlib -nostdinc -pipe
     50        -fexec-charset=UTF-8 -fwide-exec-charset=UTF-32$(ENDIANESS) \
     51        -finput-charset=UTF-8 -fno-builtin -Wall -Wextra -Wno-unused-parameter \
     52        -Wmissing-prototypes -Werror -nostdlib -nostdinc -pipe
    5353
    5454ICC_CFLAGS = -I$(INCLUDES) -O$(OPTIMIZATION) -imacros ../config.h \
  • kernel/arch/amd64/Makefile.inc

    r553492be rac47b7c2  
    4242SUNCC_CFLAGS += -m64 -xmodel=kernel
    4343
    44 DEFS += -D__64_BITS__
     44BITS = 64
     45ENDIANESS = LE
    4546
    4647## Accepted CPUs
  • kernel/arch/arm32/Makefile.inc

    r553492be rac47b7c2  
    4040GCC_CFLAGS += -fno-zero-initialized-in-bss
    4141
    42 DEFS += -D__32_BITS__
     42BITS = 32
     43ENDIANESS = LE
    4344
    4445ARCH_SOURCES = \
  • kernel/arch/ia32/Makefile.inc

    r553492be rac47b7c2  
    3636TOOLCHAIN_DIR = $(CROSS_PREFIX)/i686
    3737
    38 DEFS += -D__32_BITS__
     38BITS = 32
     39ENDIANESS = LE
    3940
    4041CMN1 = -m32
  • kernel/arch/ia64/Makefile.inc

    r553492be rac47b7c2  
    4242AFLAGS += -mconstant-gp
    4343
    44 DEFS += -D__64_BITS__
     44BITS = 64
     45ENDIANESS = LE
    4546
    4647ARCH_SOURCES = \
  • kernel/arch/mips32/Makefile.inc

    r553492be rac47b7c2  
    3737GCC_CFLAGS += -mno-abicalls -G 0 -fno-zero-initialized-in-bss -mips3
    3838
    39 DEFS += -D__32_BITS__
     39BITS = 32
    4040
    4141## Accepted MACHINEs
     
    4444ifeq ($(MACHINE),lgxemul)
    4545        BFD_NAME = elf32-tradlittlemips
     46        ENDIANESS = LE
    4647endif
    4748ifeq ($(MACHINE),bgxemul)
     
    4950        TOOLCHAIN_DIR = $(CROSS_PREFIX)/mips
    5051        TARGET = mips-linux-gnu
    51         GCC_CFLAGS += -DBIG_ENDIAN
     52        ENDIANESS = BE
     53        GCC_CFLAGS += -D__BE__
    5254endif
    5355ifeq ($(MACHINE),msim)
    5456        BFD_NAME = elf32-tradlittlemips
     57        ENDIANESS = LE
    5558        GCC_CFLAGS += -mhard-float
    5659endif
  • kernel/arch/mips32/include/elf.h

    r553492be rac47b7c2  
    2727 */
    2828
    29 /** @addtogroup mips32 
     29/** @addtogroup mips32
    3030 * @{
    3131 */
     
    3636#define KERN_mips32_ELF_H_
    3737
    38 #include <byteorder.h>
     38#define ELF_MACHINE  EM_MIPS
    3939
    40 #define ELF_MACHINE             EM_MIPS
    41 
    42 #ifdef ARCH_IS_BIG_ENDIAN
    43 #  define ELF_DATA_ENCODING     ELFDATA2MSB
     40#ifdef __BE__
     41        #define ELF_DATA_ENCODING  ELFDATA2MSB
    4442#else
    45 #  define ELF_DATA_ENCODING     ELFDATA2LSB
     43        #define ELF_DATA_ENCODING  ELFDATA2LSB
    4644#endif
    4745
    48 #define ELF_CLASS               ELFCLASS32
     46#define ELF_CLASS  ELFCLASS32
    4947
    5048#endif
  • kernel/arch/ppc32/Makefile.inc

    r553492be rac47b7c2  
    4040LFLAGS += -no-check-sections -N
    4141
    42 DEFS += -D__32_BITS__
     42BITS = 32
     43ENDIANESS = BE
    4344
    4445ARCH_SOURCES = \
  • kernel/arch/sparc64/Makefile.inc

    r553492be rac47b7c2  
    4141LFLAGS += -no-check-sections -N
    4242
    43 DEFS += -D__64_BITS__
     43BITS = 64
     44ENDIANESS = BE
    4445
    4546ifeq ($(PROCESSOR),us)
  • kernel/generic/include/byteorder.h

    r553492be rac47b7c2  
    2727 */
    2828
    29 /** @addtogroup generic 
     29/** @addtogroup generic
    3030 * @{
    3131 */
     
    3636#define KERN_BYTEORDER_H_
    3737
    38 #include <arch/byteorder.h>
    3938#include <arch/types.h>
    4039
    41 #if !(defined(ARCH_IS_BIG_ENDIAN) ^ defined(ARCH_IS_LITTLE_ENDIAN))
    42 #error The architecture must be either big-endian or little-endian.
     40#if !(defined(__BE__) ^ defined(__LE__))
     41        #error The architecture must be either big-endian or little-endian.
    4342#endif
    4443
    45 #ifdef ARCH_IS_BIG_ENDIAN
     44#ifdef __BE__
    4645
    47 #define uint16_t_le2host(n)             uint16_t_byteorder_swap(n)
    48 #define uint32_t_le2host(n)             uint32_t_byteorder_swap(n)
    49 #define uint64_t_le2host(n)             uint64_t_byteorder_swap(n)
     46#define uint16_t_le2host(n)  (uint16_t_byteorder_swap(n))
     47#define uint32_t_le2host(n)  (uint32_t_byteorder_swap(n))
     48#define uint64_t_le2host(n)  (uint64_t_byteorder_swap(n))
    5049
    51 #define uint16_t_be2host(n)             (n)
    52 #define uint32_t_be2host(n)             (n)
    53 #define uint64_t_be2host(n)             (n)
     50#define uint16_t_be2host(n)  (n)
     51#define uint32_t_be2host(n)  (n)
     52#define uint64_t_be2host(n)  (n)
    5453
    55 #define host2uint16_t_le(n)             uint16_t_byteorder_swap(n)
    56 #define host2uint32_t_le(n)             uint32_t_byteorder_swap(n)
    57 #define host2uint64_t_le(n)             uint64_t_byteorder_swap(n)
     54#define host2uint16_t_le(n)  (uint16_t_byteorder_swap(n))
     55#define host2uint32_t_le(n)  (uint32_t_byteorder_swap(n))
     56#define host2uint64_t_le(n)  (uint64_t_byteorder_swap(n))
    5857
    59 #define host2uint16_t_be(n)             (n)
    60 #define host2uint32_t_be(n)             (n)
    61 #define host2uint64_t_be(n)             (n)
     58#define host2uint16_t_be(n)  (n)
     59#define host2uint32_t_be(n)  (n)
     60#define host2uint64_t_be(n)  (n)
    6261
    6362#else
    6463
    65 #define uint16_t_le2host(n)             (n)
    66 #define uint32_t_le2host(n)             (n)
    67 #define uint64_t_le2host(n)             (n)
     64#define uint16_t_le2host(n)  (n)
     65#define uint32_t_le2host(n)  (n)
     66#define uint64_t_le2host(n)  (n)
    6867
    69 #define uint16_t_be2host(n)             uint16_t_byteorder_swap(n)
    70 #define uint32_t_be2host(n)             uint32_t_byteorder_swap(n)
    71 #define uint64_t_be2host(n)             uint64_t_byteorder_swap(n)
     68#define uint16_t_be2host(n)  (uint16_t_byteorder_swap(n))
     69#define uint32_t_be2host(n)  (uint32_t_byteorder_swap(n))
     70#define uint64_t_be2host(n)  (uint64_t_byteorder_swap(n))
    7271
    73 #define host2uint16_t_le(n)             (n)
    74 #define host2uint32_t_le(n)             (n)
    75 #define host2uint64_t_le(n)             (n)
     72#define host2uint16_t_le(n)  (n)
     73#define host2uint32_t_le(n)  (n)
     74#define host2uint64_t_le(n)  (n)
    7675
    77 #define host2uint16_t_be(n)             uint16_t_byteorder_swap(n)
    78 #define host2uint32_t_be(n)             uint32_t_byteorder_swap(n)
    79 #define host2uint64_t_be(n)             uint64_t_byteorder_swap(n)
     76#define host2uint16_t_be(n)  (uint16_t_byteorder_swap(n))
     77#define host2uint32_t_be(n)  (uint32_t_byteorder_swap(n))
     78#define host2uint64_t_be(n)  (uint64_t_byteorder_swap(n))
    8079
    8180#endif
  • kernel/generic/include/string.h

    r553492be rac47b7c2  
    5858#define U_CURSOR       0x2588
    5959
    60 #define U_BOM          0xfeff
    61 
    6260/**< No size limit constant */
    6361#define STR_NO_LIMIT  ((size_t) -1)
  • kernel/generic/src/printf/printf_core.c

    r553492be rac47b7c2  
    302302        if (str == NULL)
    303303                return printf_putstr(nullstr, ps);
    304        
    305         if (*str == U_BOM)
    306                 str++;
    307304       
    308305        /* Print leading spaces. */
  • uspace/lib/libc/Makefile

    r553492be rac47b7c2  
    3232LIBC_PREFIX = $(shell pwd)
    3333SOFTINT_PREFIX = ../softint
     34
    3435
    3536## Setup toolchain
  • uspace/lib/libc/Makefile.toolchain

    r553492be rac47b7c2  
    2828
    2929CFLAGS = -I$(LIBC_PREFIX)/include -O3 -imacros $(LIBC_PREFIX)/../../../config.h \
    30         -fexec-charset=UTF-8 -fwide-exec-charset=UTF-32 -finput-charset=UTF-8 \
    31         -fno-builtin -Wall -Wextra -Wno-unused-parameter -Wmissing-prototypes \
    32         -Werror-implicit-function-declaration -nostdlib -nostdinc -pipe -g
     30        -fexec-charset=UTF-8 -fwide-exec-charset=UTF-32$(ENDIANESS) \
     31        -finput-charset=UTF-8 -fno-builtin -Wall -Wextra -Wno-unused-parameter \
     32        -Wmissing-prototypes -Werror-implicit-function-declaration -nostdlib \
     33        -nostdinc -pipe -g -D__$(ENDIANESS)__
    3334LFLAGS = -M -N $(SOFTINT_PREFIX)/libsoftint.a
    3435AFLAGS =
  • uspace/lib/libc/arch/amd64/Makefile.inc

    r553492be rac47b7c2  
    3939LFLAGS += -N
    4040
     41ENDIANESS = LE
     42
    4143BFD_NAME = elf64-x86-64
    4244BFD_ARCH = i386:x86-64
  • uspace/lib/libc/arch/arm32/Makefile.inc

    r553492be rac47b7c2  
    3333TARGET = arm-linux-gnu
    3434TOOLCHAIN_DIR = $(CROSS_PREFIX)/arm/bin
    35 CFLAGS += -ffixed-r9 -mtp=soft
    36 LFLAGS += -N $(SOFTINT_PREFIX)/libsoftint.a
    37 AFLAGS +=
    3835
    3936ARCH_SOURCES += arch/$(UARCH)/src/syscall.c \
     
    4239        arch/$(UARCH)/src/eabi.S
    4340
     41CFLAGS += -ffixed-r9 -mtp=soft
     42LFLAGS += -N $(SOFTINT_PREFIX)/libsoftint.a
     43
     44ENDIANESS = LE
     45
    4446BFD_NAME = elf32-littlearm
    4547BFD_ARCH = arm
  • uspace/lib/libc/arch/ia32/Makefile.inc

    r553492be rac47b7c2  
    4040LFLAGS += -N
    4141
     42ENDIANESS = LE
     43
    4244BFD_NAME = elf32-i386
    4345BFD_ARCH = i386
  • uspace/lib/libc/arch/ia64/Makefile.inc

    r553492be rac47b7c2  
    3232TARGET = ia64-pc-linux-gnu
    3333TOOLCHAIN_DIR = $(CROSS_PREFIX)/ia64/bin
    34 CFLAGS += -fno-unwind-tables -DMALLOC_ALIGNMENT_16
    35 LFLAGS += -N $(SOFTINT_PREFIX)/libsoftint.a
    36 AFLAGS +=
    3734
    3835ARCH_SOURCES += arch/$(UARCH)/src/syscall.S \
     
    4138        arch/$(UARCH)/src/ddi.c
    4239
     40CFLAGS += -fno-unwind-tables -DMALLOC_ALIGNMENT_16
     41LFLAGS += -N $(SOFTINT_PREFIX)/libsoftint.a
     42
     43ENDIANESS = LE
     44
    4345BFD_NAME = elf64-ia64-little
    4446BFD_ARCH = ia64-elf64
  • uspace/lib/libc/arch/mips32/Makefile.inc

    r553492be rac47b7c2  
    3232TARGET = mipsel-linux-gnu
    3333TOOLCHAIN_DIR = $(CROSS_PREFIX)/mipsel/bin
    34 CFLAGS += -mips3
    3534
    3635ARCH_SOURCES += arch/$(UARCH)/src/syscall.c \
     
    3837        arch/$(UARCH)/src/tls.c
    3938
     39CFLAGS += -mips3
     40
     41ENDIANESS = LE
     42
    4043BFD_ARCH = mips
    4144BFD_NAME = elf32-tradlittlemips
  • uspace/lib/libc/arch/mips32eb/Makefile.inc

    r553492be rac47b7c2  
    3232TARGET = mips-linux-gnu
    3333TOOLCHAIN_DIR = $(CROSS_PREFIX)/mips/bin
    34 CFLAGS += -mips3
    3534
    3635ARCH_SOURCES += arch/$(UARCH)/src/syscall.c \
     
    3837                arch/$(UARCH)/src/tls.c
    3938
     39CFLAGS += -mips3
    4040LFLAGS += -N
     41
     42ENDIANESS = BE
    4143
    4244BFD_ARCH = mips
  • uspace/lib/libc/arch/ppc32/Makefile.inc

    r553492be rac47b7c2  
    4141LFLAGS += -N
    4242
     43ENDIANESS = BE
     44
    4345BFD_NAME = elf32-powerpc
    4446BFD_ARCH = powerpc:common
  • uspace/lib/libc/arch/sparc64/Makefile.inc

    r553492be rac47b7c2  
    3939LFLAGS += -no-check-sections -N
    4040
     41ENDIANESS = BE
     42
    4143BFD_NAME = elf64-sparc
    4244BFD_ARCH = sparc
  • uspace/lib/libc/generic/io/printf_core.c

    r553492be rac47b7c2  
    301301        if (str == NULL)
    302302                return printf_putstr(nullstr, ps);
    303        
    304         if (*str == U_BOM)
    305                 str++;
    306303       
    307304        /* Print leading spaces. */
  • uspace/lib/libc/include/byteorder.h

    r553492be rac47b7c2  
    3636#define LIBC_BYTEORDER_H_
    3737
    38 #include <libarch/byteorder.h>
    3938#include <stdint.h>
    4039
    41 #if !(defined(ARCH_IS_BIG_ENDIAN) ^ defined(ARCH_IS_LITTLE_ENDIAN))
    42 #error The architecture must be either big-endian or little-endian.
     40#if !(defined(__BE__) ^ defined(__LE__))
     41        #error The architecture must be either big-endian or little-endian.
    4342#endif
    4443
    45 #ifdef ARCH_IS_BIG_ENDIAN
     44#ifdef __BE__
    4645
    47 #define uint16_t_le2host(n)             uint16_t_byteorder_swap(n)
    48 #define uint32_t_le2host(n)             uint32_t_byteorder_swap(n)
    49 #define uint64_t_le2host(n)             uint64_t_byteorder_swap(n)
     46#define uint16_t_le2host(n)  (uint16_t_byteorder_swap(n))
     47#define uint32_t_le2host(n)  (uint32_t_byteorder_swap(n))
     48#define uint64_t_le2host(n)  (uint64_t_byteorder_swap(n))
    5049
    51 #define uint16_t_be2host(n)             (n)
    52 #define uint32_t_be2host(n)             (n)
    53 #define uint64_t_be2host(n)             (n)
     50#define uint16_t_be2host(n)  (n)
     51#define uint32_t_be2host(n)  (n)
     52#define uint64_t_be2host(n)  (n)
    5453
    55 #define host2uint16_t_le(n)             uint16_t_byteorder_swap(n)
    56 #define host2uint32_t_le(n)             uint32_t_byteorder_swap(n)
    57 #define host2uint64_t_le(n)             uint64_t_byteorder_swap(n)
     54#define host2uint16_t_le(n)  (uint16_t_byteorder_swap(n))
     55#define host2uint32_t_le(n)  (uint32_t_byteorder_swap(n))
     56#define host2uint64_t_le(n)  (uint64_t_byteorder_swap(n))
    5857
    59 #define host2uint16_t_be(n)             (n)
    60 #define host2uint32_t_be(n)             (n)
    61 #define host2uint64_t_be(n)             (n)
     58#define host2uint16_t_be(n)  (n)
     59#define host2uint32_t_be(n)  (n)
     60#define host2uint64_t_be(n)  (n)
    6261
    6362#else
    6463
    65 #define uint16_t_le2host(n)             (n)
    66 #define uint32_t_le2host(n)             (n)
    67 #define uint64_t_le2host(n)             (n)
     64#define uint16_t_le2host(n)  (n)
     65#define uint32_t_le2host(n)  (n)
     66#define uint64_t_le2host(n)  (n)
    6867
    69 #define uint16_t_be2host(n)             uint16_t_byteorder_swap(n)
    70 #define uint32_t_be2host(n)             uint32_t_byteorder_swap(n)
    71 #define uint64_t_be2host(n)             uint64_t_byteorder_swap(n)
     68#define uint16_t_be2host(n)  (uint16_t_byteorder_swap(n))
     69#define uint32_t_be2host(n)  (uint32_t_byteorder_swap(n))
     70#define uint64_t_be2host(n)  (uint64_t_byteorder_swap(n))
    7271
    73 #define host2uint16_t_le(n)             (n)
    74 #define host2uint32_t_le(n)             (n)
    75 #define host2uint64_t_le(n)             (n)
     72#define host2uint16_t_le(n)  (n)
     73#define host2uint32_t_le(n)  (n)
     74#define host2uint64_t_le(n)  (n)
    7675
    77 #define host2uint16_t_be(n)             uint16_t_byteorder_swap(n)
    78 #define host2uint32_t_be(n)             uint32_t_byteorder_swap(n)
    79 #define host2uint64_t_be(n)             uint64_t_byteorder_swap(n)
     76#define host2uint16_t_be(n)  (uint16_t_byteorder_swap(n))
     77#define host2uint32_t_be(n)  (uint32_t_byteorder_swap(n))
     78#define host2uint64_t_be(n)  (uint64_t_byteorder_swap(n))
    8079
    8180#endif
  • uspace/lib/libc/include/string.h

    r553492be rac47b7c2  
    4141
    4242#define U_SPECIAL  '?'
    43 #define U_BOM      0xfeff
    4443
    4544/** No size limit constant */
  • uspace/lib/softfloat/Makefile

    r553492be rac47b7c2  
    3737include $(LIBC_PREFIX)/Makefile.toolchain
    3838
    39 CFLAGS +=-Iinclude -Iarch/$(UARCH)/include/
     39CFLAGS += -Iinclude -Iarch/$(UARCH)/include/
    4040
    4141## Sources
  • uspace/lib/softfloat/include/sftypes.h

    r553492be rac47b7c2  
    2727 */
    2828
    29  /** @addtogroup softfloat     
     29/** @addtogroup softfloat
    3030 * @{
    3131 */
     
    4242        float f;
    4343        uint32_t binary;
    44 
    45         struct  {
    46 #if defined(ARCH_IS_BIG_ENDIAN)
    47                 uint32_t sign:1;
    48                 uint32_t exp:8;
    49                 uint32_t fraction:23;
    50 #elif defined(ARCH_IS_LITTLE_ENDIAN)
    51                 uint32_t fraction:23;
    52                 uint32_t exp:8;
    53                 uint32_t sign:1;
    54 #else 
    55 #error "Unknown endians."
     44       
     45        struct {
     46#if defined(__BE__)
     47                uint32_t sign : 1;
     48                uint32_t exp : 8;
     49                uint32_t fraction : 23;
     50#elif defined(__LE__)
     51                uint32_t fraction : 23;
     52                uint32_t exp : 8;
     53                uint32_t sign : 1;
     54#else
     55        #error Unknown endianess
    5656#endif
    5757                } parts __attribute__ ((packed));
    58         } float32;
    59        
     58} float32;
     59
    6060typedef union {
    6161        double d;
    6262        uint64_t binary;
    6363       
    64         struct  {
    65 #if defined(ARCH_IS_BIG_ENDIAN)
    66                 uint64_t sign:1;
    67                 uint64_t exp:11;
    68                 uint64_t fraction:52;
    69 #elif defined(ARCH_IS_LITTLE_ENDIAN)
    70                 uint64_t fraction:52;
    71                 uint64_t exp:11;
    72                 uint64_t sign:1;
    73 #else 
    74 #error "Unknown endians."
     64        struct {
     65#if defined(__BE__)
     66                uint64_t sign : 1;
     67                uint64_t exp : 11;
     68                uint64_t fraction : 52;
     69#elif defined(__LE__)
     70                uint64_t fraction : 52;
     71                uint64_t exp : 11;
     72                uint64_t sign : 1;
     73#else
     74        #error Unknown endianess
    7575#endif
    76                 } parts __attribute__ ((packed));
    77         } float64;
     76        } parts __attribute__ ((packed));
     77} float64;
    7878
    7979#define FLOAT32_MAX 0x7f800000
     
    110110#endif
    111111
    112 
    113  /** @}
     112/** @}
    114113 */
    115 
Note: See TracChangeset for help on using the changeset viewer.