Changeset 04803bf in mainline for uspace/lib/c/arch/mips32


Ignore:
Timestamp:
2011-03-21T22:00:17Z (15 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
143932e3
Parents:
b50b5af2 (diff), 7308e84 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes (needs fixes).

Location:
uspace/lib/c/arch/mips32
Files:
5 added
18 moved

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/arch/mips32/Makefile.inc

    rb50b5af2 r04803bf  
    2727#
    2828
    29 ## Toolchain configuration
    30 #
     29ARCH_SOURCES = \
     30        arch/$(UARCH)/src/entry.s \
     31        arch/$(UARCH)/src/thread_entry.s \
     32        arch/$(UARCH)/src/syscall.c \
     33        arch/$(UARCH)/src/fibril.S \
     34        arch/$(UARCH)/src/tls.c \
     35        arch/$(UARCH)/src/stacktrace.c \
     36        arch/$(UARCH)/src/stacktrace_asm.S
    3137
    32 TARGET = amd64-linux-gnu
    33 TOOLCHAIN_DIR = $(CROSS_PREFIX)/amd64/bin
    34 
    35 ARCH_SOURCES += arch/$(UARCH)/src/syscall.S \
    36         arch/$(UARCH)/src/fibril.S \
    37         arch/$(UARCH)/src/tls.c
    38 
    39 LFLAGS += -N
    40 
    41 ENDIANESS = LE
    42 
    43 BFD_NAME = elf64-x86-64
    44 BFD_ARCH = i386:x86-64
     38.PRECIOUS: arch/$(UARCH)/src/entry.o
  • uspace/lib/c/arch/mips32/_link.ld.in

    rb50b5af2 r04803bf  
    1 STARTUP(LIBC_PREFIX/arch/UARCH/src/entry.o)
     1STARTUP(LIBC_PATH/arch/UARCH/src/entry.o)
    22ENTRY(__entry)
    33
     
    1313                *(.init);
    1414        } :text
     15       
    1516        .text : {
    16                 *(.text);
     17                *(.text);
    1718                *(.rodata*);
    1819        } :text
    19 
     20       
    2021        . = . + 0x4000;
    21 
     22       
    2223        .data : {
    2324                *(.data);
    2425                *(.data.rel*);
    2526        } :data
    26 
     27       
    2728        .got : {
    2829                _gp = .;
    2930                *(.got);
    3031        } :data
    31 
     32       
    3233        .tdata : {
    3334                _tdata_start = .;
    3435                *(.tdata);
    3536                _tdata_end = .;
     37        } :data
     38       
     39        .tbss : {
    3640                _tbss_start = .;
    3741                *(.tbss);
    3842                _tbss_end = .;
    3943        } :data
    40         _tls_alignment = ALIGNOF(.tdata);
    41 
     44       
     45        _tls_alignment = MAX(ALIGNOF(.tdata), ALIGNOF(.tbss));
     46       
    4247        .sbss : {
    4348                *(.scommon);
    4449                *(.sbss);
    45         }       
     50        }
     51       
    4652        .bss : {
    4753                *(.bss);
    4854                *(COMMON);
    4955        } :data
    50 
    51         . = ALIGN(0x4000);
    52         _heap = .;
    53 
     56       
    5457        /DISCARD/ : {
    5558                *(*);
  • uspace/lib/c/arch/mips32/include/atomic.h

    rb50b5af2 r04803bf  
    2727 */
    2828
    29 /** @addtogroup libcmips32     
     29/** @addtogroup libcmips32
    3030 * @{
    3131 */
    3232/** @file
    33  * @ingroup libcmips32eb       
     33 * @ingroup libcmips32eb
    3434 */
    3535
     
    3737#define LIBC_mips32_ATOMIC_H_
    3838
    39 #define atomic_inc(x)   ((void) atomic_add(x, 1))
    40 #define atomic_dec(x)   ((void) atomic_add(x, -1))
     39#define LIBC_ARCH_ATOMIC_H_
    4140
    42 #define atomic_postinc(x) (atomic_add(x, 1) - 1)
    43 #define atomic_postdec(x) (atomic_add(x, -1) + 1)
     41#include <atomicdflt.h>
    4442
    45 #define atomic_preinc(x) atomic_add(x, 1)
    46 #define atomic_predec(x) atomic_add(x, -1)
     43#define atomic_inc(x)  ((void) atomic_add(x, 1))
     44#define atomic_dec(x)  ((void) atomic_add(x, -1))
     45
     46#define atomic_postinc(x)  (atomic_add(x, 1) - 1)
     47#define atomic_postdec(x)  (atomic_add(x, -1) + 1)
     48
     49#define atomic_preinc(x)  atomic_add(x, 1)
     50#define atomic_predec(x)  atomic_add(x, -1)
    4751
    4852/* Atomic addition of immediate value.
    4953 *
    5054 * @param val Memory location to which will be the immediate value added.
    51  * @param i Signed immediate that will be added to *val.
     55 * @param i   Signed immediate that will be added to *val.
    5256 *
    5357 * @return Value after addition.
     58 *
    5459 */
    55 static inline long atomic_add(atomic_t *val, int i)
     60static inline atomic_count_t atomic_add(atomic_t *val, atomic_count_t i)
    5661{
    57         long tmp, v;
    58 
     62        atomic_count_t tmp;
     63        atomic_count_t v;
     64       
    5965        asm volatile (
    6066                "1:\n"
     
    6672                /*      nop     */              /* nop is inserted automatically by compiler */
    6773                "       nop\n"
    68                 : "=&r" (tmp), "+m" (val->count), "=&r" (v)
    69                 : "r" (i), "i" (0)
    70                 );
    71 
     74                : "=&r" (tmp),
     75                  "+m" (val->count),
     76                  "=&r" (v)
     77                : "r" (i),
     78                  "i" (0)
     79        );
     80       
    7281        return v;
    7382}
  • uspace/lib/c/arch/mips32/include/fibril.h

    rb50b5af2 r04803bf  
    8585} context_t;
    8686
     87static inline uintptr_t context_get_fp(context_t *ctx)
     88{
     89        return ctx->sp;
     90}
     91
    8792#endif
    8893
  • uspace/lib/c/arch/mips32/include/types.h

    rb50b5af2 r04803bf  
    2727 */
    2828
    29 /** @addtogroup libcmips32     
     29/** @addtogroup libcmips32
    3030 * @{
    3131 */
     
    3737#define LIBC_mips32_TYPES_H_
    3838
    39 typedef unsigned int sysarg_t;
     39#define __32_BITS__
    4040
    41 typedef char int8_t;
    42 typedef short int int16_t;
    43 typedef long int int32_t;
    44 typedef long long int int64_t;
     41#include <libarch/common.h>
    4542
    46 typedef unsigned char uint8_t;
    47 typedef unsigned short int uint16_t;
    48 typedef unsigned long int uint32_t;
    49 typedef unsigned long long int uint64_t;
     43#define SIZE_MIN  UINT32_MIN
     44#define SIZE_MAX  UINT32_MAX
     45
     46#define SSIZE_MIN  INT32_MIN
     47#define SSIZE_MAX  INT32_MAX
     48
     49typedef uint32_t sysarg_t;
    5050
    5151typedef int32_t ssize_t;
     
    5353
    5454typedef uint32_t uintptr_t;
     55typedef uint32_t atomic_count_t;
     56typedef int32_t atomic_signed_t;
    5557
    5658#endif
  • uspace/lib/c/arch/mips32/src/entry.s

    rb50b5af2 r04803bf  
    2929.text
    3030.section .init, "ax"
     31
    3132.global __entry
    32 .global __entry_driver
     33
    3334.set noreorder
    3435.option pic2
     
    5657        jal __main
    5758        nop
    58        
    59         jal __exit
    60         nop
    6159.end
    62 
    63 # Alignment of output section data to 0x4000
    64 .section .data
    65 .align 14
Note: See TracChangeset for help on using the changeset viewer.