Changeset d5a89a3 in mainline for uspace/lib/c/arch/sparc64


Ignore:
Timestamp:
2019-02-11T22:31:04Z (6 years ago)
Author:
Matthieu Riolo <matthieu.riolo@…>
Children:
aaf9789c
Parents:
e3272101 (diff), 4805495 (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:

merging with upstream/master

Location:
uspace/lib/c/arch/sparc64
Files:
5 added
15 edited

Legend:

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

    re3272101 rd5a89a3  
    5252ifeq ($(PROCESSOR),sun4v)
    5353        DEFS += -DSUN4V
     54        COMMON_CFLAGS += -Wl,-z,max-page-size=0x2000
     55else
     56        COMMON_CFLAGS += -Wl,-z,max-page-size=0x4000
    5457endif
  • uspace/lib/c/arch/sparc64/Makefile.inc

    re3272101 rd5a89a3  
    3333        arch/$(UARCH)/src/tls.c \
    3434        arch/$(UARCH)/src/stacktrace.c \
    35         arch/$(UARCH)/src/stacktrace_asm.S
     35        arch/$(UARCH)/src/stacktrace_asm.S \
     36        arch/$(UARCH)/src/rtld/dynamic.c \
     37        arch/$(UARCH)/src/rtld/reloc.c
    3638
    3739ARCH_AUTOCHECK_HEADERS = \
  • uspace/lib/c/arch/sparc64/include/libarch/config.h

    re3272101 rd5a89a3  
    3333 */
    3434
    35 #ifndef LIBC_sparc64_CONFIG_H_
    36 #define LIBC_sparc64_CONFIG_H_
     35#ifndef _LIBC_sparc64_CONFIG_H_
     36#define _LIBC_sparc64_CONFIG_H_
    3737
    3838#if defined (SUN4U)
  • uspace/lib/c/arch/sparc64/include/libarch/ddi.h

    re3272101 rd5a89a3  
    3131 */
    3232
    33 #ifndef LIBC_sparc64_DDI_H_
    34 #define LIBC_sparc64_DDI_H_
     33#ifndef _LIBC_sparc64_DDI_H_
     34#define _LIBC_sparc64_DDI_H_
    3535
    3636#include <barrier.h>
  • uspace/lib/c/arch/sparc64/include/libarch/elf_linux.h

    re3272101 rd5a89a3  
    3333 */
    3434
    35 #ifndef LIBC_sparc64_ELF_LINUX_H_
    36 #define LIBC_sparc64_ELF_LINUX_H_
     35#ifndef _LIBC_sparc64_ELF_LINUX_H_
     36#define _LIBC_sparc64_ELF_LINUX_H_
    3737
    3838#include <libarch/istate.h>
  • uspace/lib/c/arch/sparc64/include/libarch/faddr.h

    re3272101 rd5a89a3  
    3333 */
    3434
    35 #ifndef LIBC_sparc64_FADDR_H_
    36 #define LIBC_sparc64_FADDR_H_
     35#ifndef _LIBC_sparc64_FADDR_H_
     36#define _LIBC_sparc64_FADDR_H_
    3737
    3838#include <types/common.h>
  • uspace/lib/c/arch/sparc64/include/libarch/fibril.h

    re3272101 rd5a89a3  
    3333 */
    3434
    35 #ifndef LIBC_sparc64_FIBRIL_H_
    36 #define LIBC_sparc64_FIBRIL_H_
     35#ifndef _LIBC_sparc64_FIBRIL_H_
     36#define _LIBC_sparc64_FIBRIL_H_
    3737
    3838#include <libarch/stack.h>
  • uspace/lib/c/arch/sparc64/include/libarch/fibril_context.h

    re3272101 rd5a89a3  
    2727 */
    2828
    29 #ifndef LIBC_ARCH_FIBRIL_CONTEXT_H_
    30 #define LIBC_ARCH_FIBRIL_CONTEXT_H_
     29#ifndef _LIBC_ARCH_FIBRIL_CONTEXT_H_
     30#define _LIBC_ARCH_FIBRIL_CONTEXT_H_
    3131
    32 #define CONTEXT_OFFSET_SP  0x00
    33 #define CONTEXT_OFFSET_PC  0x08
    34 #define CONTEXT_OFFSET_I0  0x10
    35 #define CONTEXT_OFFSET_I1  0x18
    36 #define CONTEXT_OFFSET_I2  0x20
    37 #define CONTEXT_OFFSET_I3  0x28
    38 #define CONTEXT_OFFSET_I4  0x30
    39 #define CONTEXT_OFFSET_I5  0x38
    40 #define CONTEXT_OFFSET_FP  0x40
    41 #define CONTEXT_OFFSET_I7  0x48
    42 #define CONTEXT_OFFSET_L0  0x50
    43 #define CONTEXT_OFFSET_L1  0x58
    44 #define CONTEXT_OFFSET_L2  0x60
    45 #define CONTEXT_OFFSET_L3  0x68
    46 #define CONTEXT_OFFSET_L4  0x70
    47 #define CONTEXT_OFFSET_L5  0x78
    48 #define CONTEXT_OFFSET_L6  0x80
    49 #define CONTEXT_OFFSET_L7  0x88
    50 #define CONTEXT_OFFSET_TP  0x90
    51 #define CONTEXT_SIZE       0x98
     32#define __CONTEXT_OFFSET_SP  0x00
     33#define __CONTEXT_OFFSET_PC  0x08
     34#define __CONTEXT_OFFSET_I0  0x10
     35#define __CONTEXT_OFFSET_I1  0x18
     36#define __CONTEXT_OFFSET_I2  0x20
     37#define __CONTEXT_OFFSET_I3  0x28
     38#define __CONTEXT_OFFSET_I4  0x30
     39#define __CONTEXT_OFFSET_I5  0x38
     40#define __CONTEXT_OFFSET_FP  0x40
     41#define __CONTEXT_OFFSET_I7  0x48
     42#define __CONTEXT_OFFSET_L0  0x50
     43#define __CONTEXT_OFFSET_L1  0x58
     44#define __CONTEXT_OFFSET_L2  0x60
     45#define __CONTEXT_OFFSET_L3  0x68
     46#define __CONTEXT_OFFSET_L4  0x70
     47#define __CONTEXT_OFFSET_L5  0x78
     48#define __CONTEXT_OFFSET_L6  0x80
     49#define __CONTEXT_OFFSET_L7  0x88
     50#define __CONTEXT_OFFSET_TP  0x90
     51#define __CONTEXT_SIZE       0x98
    5252
    5353#ifndef __ASSEMBLER__
     
    5656#include <stdint.h>
    5757
    58 typedef struct context {
     58typedef struct __context {
    5959        uintptr_t sp;  // %o6
    6060        uintptr_t pc;  // %o7
     
    7676        uint64_t l7;
    7777        uint64_t tp;  // %g7
    78 } context_t;
     78} __context_t;
    7979
    8080#endif
  • uspace/lib/c/arch/sparc64/include/libarch/stack.h

    re3272101 rd5a89a3  
    3333 */
    3434
    35 #ifndef LIBC_sparc64_STACK_H_
    36 #define LIBC_sparc64_STACK_H_
     35#ifndef _LIBC_sparc64_STACK_H_
     36#define _LIBC_sparc64_STACK_H_
    3737
    3838#define STACK_ITEM_SIZE                 8
  • uspace/lib/c/arch/sparc64/include/libarch/stackarg.h

    re3272101 rd5a89a3  
    3333 */
    3434
    35 #ifndef LIBC_sparc64_STACKARG_H_
    36 #define LIBC_sparc64_STACKARG_H_
     35#ifndef _LIBC_sparc64_STACKARG_H_
     36#define _LIBC_sparc64_STACKARG_H_
    3737
    3838#endif
  • uspace/lib/c/arch/sparc64/include/libarch/syscall.h

    re3272101 rd5a89a3  
    3333 */
    3434
    35 #ifndef LIBC_sparc64_SYSCALL_H_
    36 #define LIBC_sparc64_SYSCALL_H_
     35#ifndef _LIBC_sparc64_SYSCALL_H_
     36#define _LIBC_sparc64_SYSCALL_H_
    3737
    3838#include <stdint.h>
  • uspace/lib/c/arch/sparc64/include/libarch/thread.h

    re3272101 rd5a89a3  
    3232 */
    3333
    34 #ifndef LIBC_sparc64_THREAD_H_
    35 #define LIBC_sparc64_THREAD_H_
     34#ifndef _LIBC_sparc64_THREAD_H_
     35#define _LIBC_sparc64_THREAD_H_
    3636
    3737#endif
  • uspace/lib/c/arch/sparc64/include/libarch/tls.h

    re3272101 rd5a89a3  
    3636 */
    3737
    38 #ifndef LIBC_sparc64_TLS_H_
    39 #define LIBC_sparc64_TLS_H_
     38#ifndef _LIBC_sparc64_TLS_H_
     39#define _LIBC_sparc64_TLS_H_
    4040
    4141#define CONFIG_TLS_VARIANT_2
     
    4646        void *self;
    4747        void *fibril_data;
     48        void **dtv;
     49        void *pad;
    4850} tcb_t;
    4951
  • uspace/lib/c/arch/sparc64/src/fibril.S

    re3272101 rd5a89a3  
    3232.text
    3333
    34 FUNCTION_BEGIN(__setjmp)
     34FUNCTION_BEGIN(__context_save)
    3535        #
    3636        # We rely on the kernel to flush our active register windows to memory
    3737        # should a thread switch occur.
    3838        #
    39         stx %sp, [%o0 + CONTEXT_OFFSET_SP]
    40         stx %o7, [%o0 + CONTEXT_OFFSET_PC]
    41         stx %i0, [%o0 + CONTEXT_OFFSET_I0]
    42         stx %i1, [%o0 + CONTEXT_OFFSET_I1]
    43         stx %i2, [%o0 + CONTEXT_OFFSET_I2]
    44         stx %i3, [%o0 + CONTEXT_OFFSET_I3]
    45         stx %i4, [%o0 + CONTEXT_OFFSET_I4]
    46         stx %i5, [%o0 + CONTEXT_OFFSET_I5]
    47         stx %fp, [%o0 + CONTEXT_OFFSET_FP]
    48         stx %i7, [%o0 + CONTEXT_OFFSET_I7]
    49         stx %l0, [%o0 + CONTEXT_OFFSET_L0]
    50         stx %l1, [%o0 + CONTEXT_OFFSET_L1]
    51         stx %l2, [%o0 + CONTEXT_OFFSET_L2]
    52         stx %l3, [%o0 + CONTEXT_OFFSET_L3]
    53         stx %l4, [%o0 + CONTEXT_OFFSET_L4]
    54         stx %l5, [%o0 + CONTEXT_OFFSET_L5]
    55         stx %l6, [%o0 + CONTEXT_OFFSET_L6]
    56         stx %l7, [%o0 + CONTEXT_OFFSET_L7]
    57         stx %g7, [%o0 + CONTEXT_OFFSET_TP]
     39        stx %sp, [%o0 + __CONTEXT_OFFSET_SP]
     40        stx %o7, [%o0 + __CONTEXT_OFFSET_PC]
     41        stx %i0, [%o0 + __CONTEXT_OFFSET_I0]
     42        stx %i1, [%o0 + __CONTEXT_OFFSET_I1]
     43        stx %i2, [%o0 + __CONTEXT_OFFSET_I2]
     44        stx %i3, [%o0 + __CONTEXT_OFFSET_I3]
     45        stx %i4, [%o0 + __CONTEXT_OFFSET_I4]
     46        stx %i5, [%o0 + __CONTEXT_OFFSET_I5]
     47        stx %fp, [%o0 + __CONTEXT_OFFSET_FP]
     48        stx %i7, [%o0 + __CONTEXT_OFFSET_I7]
     49        stx %l0, [%o0 + __CONTEXT_OFFSET_L0]
     50        stx %l1, [%o0 + __CONTEXT_OFFSET_L1]
     51        stx %l2, [%o0 + __CONTEXT_OFFSET_L2]
     52        stx %l3, [%o0 + __CONTEXT_OFFSET_L3]
     53        stx %l4, [%o0 + __CONTEXT_OFFSET_L4]
     54        stx %l5, [%o0 + __CONTEXT_OFFSET_L5]
     55        stx %l6, [%o0 + __CONTEXT_OFFSET_L6]
     56        stx %l7, [%o0 + __CONTEXT_OFFSET_L7]
     57        stx %g7, [%o0 + __CONTEXT_OFFSET_TP]
    5858        retl
    59         mov 0, %o0              ! __setjmp returns 0
    60 FUNCTION_END(__setjmp)
     59        mov 0, %o0              ! __context_save returns 0
     60FUNCTION_END(__context_save)
    6161
    62 FUNCTION_BEGIN(__longjmp)
     62FUNCTION_BEGIN(__context_restore)
    6363        #
    6464        # Flush all active windows.
     
    6969        flushw
    7070
    71         ldx [%o0 + CONTEXT_OFFSET_SP], %sp
    72         ldx [%o0 + CONTEXT_OFFSET_PC], %o7
    73         ldx [%o0 + CONTEXT_OFFSET_I0], %i0
    74         ldx [%o0 + CONTEXT_OFFSET_I1], %i1
    75         ldx [%o0 + CONTEXT_OFFSET_I2], %i2
    76         ldx [%o0 + CONTEXT_OFFSET_I3], %i3
    77         ldx [%o0 + CONTEXT_OFFSET_I4], %i4
    78         ldx [%o0 + CONTEXT_OFFSET_I5], %i5
    79         ldx [%o0 + CONTEXT_OFFSET_FP], %fp
    80         ldx [%o0 + CONTEXT_OFFSET_I7], %i7
    81         ldx [%o0 + CONTEXT_OFFSET_L0], %l0
    82         ldx [%o0 + CONTEXT_OFFSET_L1], %l1
    83         ldx [%o0 + CONTEXT_OFFSET_L2], %l2
    84         ldx [%o0 + CONTEXT_OFFSET_L3], %l3
    85         ldx [%o0 + CONTEXT_OFFSET_L4], %l4
    86         ldx [%o0 + CONTEXT_OFFSET_L5], %l5
    87         ldx [%o0 + CONTEXT_OFFSET_L6], %l6
    88         ldx [%o0 + CONTEXT_OFFSET_L7], %l7
    89         ldx [%o0 + CONTEXT_OFFSET_TP], %g7
     71        ldx [%o0 + __CONTEXT_OFFSET_SP], %sp
     72        ldx [%o0 + __CONTEXT_OFFSET_PC], %o7
     73        ldx [%o0 + __CONTEXT_OFFSET_I0], %i0
     74        ldx [%o0 + __CONTEXT_OFFSET_I1], %i1
     75        ldx [%o0 + __CONTEXT_OFFSET_I2], %i2
     76        ldx [%o0 + __CONTEXT_OFFSET_I3], %i3
     77        ldx [%o0 + __CONTEXT_OFFSET_I4], %i4
     78        ldx [%o0 + __CONTEXT_OFFSET_I5], %i5
     79        ldx [%o0 + __CONTEXT_OFFSET_FP], %fp
     80        ldx [%o0 + __CONTEXT_OFFSET_I7], %i7
     81        ldx [%o0 + __CONTEXT_OFFSET_L0], %l0
     82        ldx [%o0 + __CONTEXT_OFFSET_L1], %l1
     83        ldx [%o0 + __CONTEXT_OFFSET_L2], %l2
     84        ldx [%o0 + __CONTEXT_OFFSET_L3], %l3
     85        ldx [%o0 + __CONTEXT_OFFSET_L4], %l4
     86        ldx [%o0 + __CONTEXT_OFFSET_L5], %l5
     87        ldx [%o0 + __CONTEXT_OFFSET_L6], %l6
     88        ldx [%o0 + __CONTEXT_OFFSET_L7], %l7
     89        ldx [%o0 + __CONTEXT_OFFSET_TP], %g7
    9090        retl
    91         mov %o1, %o0    ! __longjmp returns second argument
    92 FUNCTION_END(__longjmp)
     91        mov %o1, %o0    ! __context_restore returns second argument
     92FUNCTION_END(__context_restore)
  • uspace/lib/c/arch/sparc64/src/tls.c

    re3272101 rd5a89a3  
    3838#include <stddef.h>
    3939
     40#ifdef CONFIG_RTLD
     41#include <rtld/rtld.h>
     42#endif
     43
    4044tcb_t *tls_alloc_arch(size_t size, size_t align)
    4145{
     
    4852}
    4953
     54/*
     55 * Rtld TLS support
     56 */
     57
     58typedef struct {
     59        unsigned long int ti_module;
     60        unsigned long int ti_offset;
     61} tls_index;
     62
     63void *__tls_get_addr(tls_index *ti);
     64
     65void *__tls_get_addr(tls_index *ti)
     66{
     67        uint8_t *tls;
     68
     69#ifdef CONFIG_RTLD
     70        if (runtime_env != NULL) {
     71                return rtld_tls_get_addr(runtime_env, __tcb_get(),
     72                    ti->ti_module, ti->ti_offset);
     73        }
     74#endif
     75        /* Get address of static TLS block */
     76        tls = tls_get();
     77        return tls + ti->ti_offset;
     78}
     79
    5080/** @}
    5181 */
Note: See TracChangeset for help on using the changeset viewer.