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


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/ppc32
Files:
5 added
19 moved

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/arch/ppc32/Makefile.common

    rb50b5af2 r04803bf  
    2727#
    2828
    29 #include "regname.h"
     29GCC_CFLAGS += -mcpu=powerpc -msoft-float -m32
     30AFLAGS = -a32
    3031
    31 .section BOOTSTRAP, "ax"
     32ENDIANESS = BE
    3233
    33 .global start
    34 
    35 start:
    36         lis r4, ofw_cif@ha
    37         addi r4, r4, ofw_cif@l
    38         stw r5, 0(r4)
    39        
    40         bl ofw_init
    41        
    42         b bootstrap
     34BFD_NAME = elf32-powerpc
     35BFD_ARCH = powerpc:common
  • uspace/lib/c/arch/ppc32/_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
     
    99SECTIONS {
    1010        . = 0x1000 + SIZEOF_HEADERS;
    11 
     11       
    1212        .init : {
    1313                *(.init);
    1414        } :text
     15       
    1516        .text : {
    1617                *(.text);
    1718                *(.rodata*);
    1819        } :text
    19 
     20       
    2021        . = . + 0x1000;
    21 
     22       
    2223        .data : {
    2324                *(.data);
    2425                *(.sdata);
    2526        } :data
     27       
    2628        .tdata : {
    2729                _tdata_start = .;
     
    3234                _tbss_end = .;
    3335        } :data
     36       
    3437        _tls_alignment = ALIGNOF(.tdata);
     38       
    3539        .bss : {
    3640                *(.sbss);
     
    3842                *(.bss);
    3943        } :data
    40 
    41         . = ALIGN(0x1000);
    42         _heap = .;
    4344       
    4445        /DISCARD/ : {
    4546                *(*);
    4647        }
    47 
    4848}
  • uspace/lib/c/arch/ppc32/include/atomic.h

    rb50b5af2 r04803bf  
    2727 */
    2828
    29 /** @addtogroup libcppc32       
     29/** @addtogroup libcppc32
    3030 * @{
    3131 */
     
    3636#define LIBC_ppc32_ATOMIC_H_
    3737
     38#define LIBC_ARCH_ATOMIC_H_
     39
     40#include <atomicdflt.h>
     41
    3842static inline void atomic_inc(atomic_t *val)
    3943{
    40         long tmp;
    41 
     44        atomic_count_t tmp;
     45       
    4246        asm volatile (
    4347                "1:\n"
     
    4650                "stwcx. %0, 0, %2\n"
    4751                "bne- 1b"
    48                 : "=&r" (tmp), "=m" (val->count)
    49                 : "r" (&val->count), "m" (val->count)
    50                 : "cc");
     52                : "=&r" (tmp),
     53                  "=m" (val->count)
     54                : "r" (&val->count),
     55                  "m" (val->count)
     56                : "cc"
     57        );
    5158}
    5259
    5360static inline void atomic_dec(atomic_t *val)
    5461{
    55         long tmp;
    56 
     62        atomic_count_t tmp;
     63       
    5764        asm volatile (
    5865                "1:\n"
    5966                "lwarx %0, 0, %2\n"
    6067                "addic %0, %0, -1\n"
    61                 "stwcx. %0, 0, %2\n"
     68                "stwcx. %0, 0, %2\n"
    6269                "bne- 1b"
    63                 : "=&r" (tmp), "=m" (val->count)
    64                 : "r" (&val->count), "m" (val->count)
    65                 : "cc");
     70                : "=&r" (tmp),
     71                  "=m" (val->count)
     72                : "r" (&val->count),
     73                  "m" (val->count)
     74                : "cc"
     75        );
    6676}
    6777
    68 static inline long atomic_postinc(atomic_t *val)
     78static inline atomic_count_t atomic_postinc(atomic_t *val)
    6979{
    7080        atomic_inc(val);
     
    7282}
    7383
    74 static inline long atomic_postdec(atomic_t *val)
     84static inline atomic_count_t atomic_postdec(atomic_t *val)
    7585{
    7686        atomic_dec(val);
     
    7888}
    7989
    80 static inline long atomic_preinc(atomic_t *val)
     90static inline atomic_count_t atomic_preinc(atomic_t *val)
    8191{
    8292        atomic_inc(val);
     
    8494}
    8595
    86 static inline long atomic_predec(atomic_t *val)
     96static inline atomic_count_t atomic_predec(atomic_t *val)
    8797{
    8898        atomic_dec(val);
  • uspace/lib/c/arch/ppc32/include/fibril.h

    rb50b5af2 r04803bf  
    7878} __attribute__ ((packed)) context_t;
    7979
     80static inline uintptr_t context_get_fp(context_t *ctx)
     81{
     82        return ctx->sp;
     83}
     84
    8085#endif
    8186
  • uspace/lib/c/arch/ppc32/include/types.h

    rb50b5af2 r04803bf  
    2727 */
    2828
    29 /** @addtogroup libcppc32       
     29/** @addtogroup libcppc32
    3030 * @{
    3131 */
     
    3636#define LIBC_ppc32_TYPES_H_
    3737
    38 typedef unsigned int sysarg_t;
     38#define __32_BITS__
    3939
    40 typedef char int8_t;
    41 typedef short int int16_t;
    42 typedef int int32_t;
    43 typedef long long int int64_t;
     40#include <libarch/common.h>
    4441
    45 typedef unsigned char uint8_t;
    46 typedef unsigned short int uint16_t;
    47 typedef unsigned int uint32_t;
    48 typedef unsigned long long int uint64_t;
     42#define SIZE_MIN  UINT32_MIN
     43#define SIZE_MAX  UINT32_MAX
     44
     45#define SSIZE_MIN  INT32_MIN
     46#define SSIZE_MAX  INT32_MAX
     47
     48typedef uint32_t sysarg_t;
    4949
    5050typedef int32_t ssize_t;
     
    5252
    5353typedef uint32_t uintptr_t;
     54typedef uint32_t atomic_count_t;
     55typedef int32_t atomic_signed_t;
    5456
    5557#endif
  • uspace/lib/c/arch/ppc32/src/entry.s

    rb50b5af2 r04803bf  
    3838#
    3939__entry:
     40        #
     41        # Create the first stack frame.
     42        #
     43        li %r3, 0
     44        stw %r3, 0(%r1)
     45        stwu %r1, -16(%r1)
     46       
    4047        # Pass the PCB pointer to __main() as the first argument.
    4148        # The first argument is passed in r3.
    4249        mr %r3, %r6
    4350        bl __main
    44 
    45         bl __exit
  • uspace/lib/c/arch/ppc32/src/thread_entry.s

    rb50b5af2 r04803bf  
    3535#
    3636__thread_entry:
     37        #
     38        # Create the first stack frame.
     39        #
     40        li %r4, 0
     41        stw %r4, 0(%r1)
     42        stwu %r1, -16(%r1)
     43
    3744        b __thread_main
    3845
Note: See TracChangeset for help on using the changeset viewer.