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


Ignore:
Timestamp:
2019-02-11T22:31:04Z (7 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
Files:
16 added
118 edited
1 moved

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/arch/abs32le/include/libarch/config.h

    re3272101 rd5a89a3  
    3333 */
    3434
    35 #ifndef LIBC_abs32le_CONFIG_H_
    36 #define LIBC_abs32le_CONFIG_H_
     35#ifndef _LIBC_abs32le_CONFIG_H_
     36#define _LIBC_abs32le_CONFIG_H_
    3737
    3838#define PAGE_WIDTH  12
  • uspace/lib/c/arch/abs32le/include/libarch/ddi.h

    re3272101 rd5a89a3  
    3030 */
    3131
    32 #ifndef LIBC_abs32le_DDI_H_
    33 #define LIBC_abs32le_DDI_H_
     32#ifndef _LIBC_abs32le_DDI_H_
     33#define _LIBC_abs32le_DDI_H_
    3434
    3535#include <ddi.h>
  • uspace/lib/c/arch/abs32le/include/libarch/elf_linux.h

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

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

    re3272101 rd5a89a3  
    3333 */
    3434
    35 #ifndef LIBC_abs32le_FIBRIL_H_
    36 #define LIBC_abs32le_FIBRIL_H_
     35#ifndef _LIBC_abs32le_FIBRIL_H_
     36#define _LIBC_abs32le_FIBRIL_H_
    3737
    3838#include <stdint.h>
  • uspace/lib/c/arch/abs32le/include/libarch/fibril_context.h

    re3272101 rd5a89a3  
    2727 */
    2828
    29 #ifndef LIBC_abs32le_FIBRIL_CONTEXT_H_
    30 #define LIBC_abs32le_FIBRIL_CONTEXT_H_
     29#ifndef _LIBC_abs32le_FIBRIL_CONTEXT_H_
     30#define _LIBC_abs32le_FIBRIL_CONTEXT_H_
    3131
    3232#include <stdint.h>
     
    3636 * need to be preserved across function calls.
    3737 */
    38 typedef struct context {
     38typedef struct __context {
    3939        uintptr_t sp;
    4040        uintptr_t fp;
    4141        uintptr_t pc;
    4242        uintptr_t tls;
    43 } context_t;
     43} __context_t;
    4444
    4545#endif
  • uspace/lib/c/arch/abs32le/include/libarch/syscall.h

    re3272101 rd5a89a3  
    3434 */
    3535
    36 #ifndef LIBC_abs32le_SYSCALL_H_
    37 #define LIBC_abs32le_SYSCALL_H_
     36#ifndef _LIBC_abs32le_SYSCALL_H_
     37#define _LIBC_abs32le_SYSCALL_H_
    3838
    3939#include <abi/syscall.h>
  • uspace/lib/c/arch/abs32le/include/libarch/thread.h

    re3272101 rd5a89a3  
    3333 */
    3434
    35 #ifndef LIBC_abs32le_THREAD_H_
    36 #define LIBC_abs32le_THREAD_H_
     35#ifndef _LIBC_abs32le_THREAD_H_
     36#define _LIBC_abs32le_THREAD_H_
    3737
    3838#endif
  • uspace/lib/c/arch/abs32le/include/libarch/tls.h

    re3272101 rd5a89a3  
    3333 */
    3434
    35 #ifndef LIBC_abs32le_TLS_H_
    36 #define LIBC_abs32le_TLS_H_
     35#ifndef _LIBC_abs32le_TLS_H_
     36#define _LIBC_abs32le_TLS_H_
    3737
    3838#define CONFIG_TLS_VARIANT_2
  • uspace/lib/c/arch/abs32le/src/fibril.c

    re3272101 rd5a89a3  
    3333#include <stdbool.h>
    3434
    35 int __setjmp(context_t *ctx)
     35int __context_save(__context_t *ctx)
    3636{
    3737        return 0;
    3838}
    3939
    40 void __longjmp(context_t *ctx, int val)
     40void __context_restore(__context_t *ctx, int val)
    4141{
    4242        while (true)
  • uspace/lib/c/arch/amd64/Makefile.common

    re3272101 rd5a89a3  
    2828
    2929# TODO: We need to implement DWARF unwinding and get rid of this flag.
    30 COMMON_CFLAGS += -fno-omit-frame-pointer
     30COMMON_CFLAGS += -fno-omit-frame-pointer -Wl,-z,max-page-size=0x1000
    3131
    3232# XXX: This architecture requires unoptimized TLS pointer access,
  • uspace/lib/c/arch/amd64/include/libarch/config.h

    re3272101 rd5a89a3  
    3333 */
    3434
    35 #ifndef LIBC_amd64_CONFIG_H_
    36 #define LIBC_amd64_CONFIG_H_
     35#ifndef _LIBC_amd64_CONFIG_H_
     36#define _LIBC_amd64_CONFIG_H_
    3737
    3838#define PAGE_WIDTH      12
  • uspace/lib/c/arch/amd64/include/libarch/elf_linux.h

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

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

    re3272101 rd5a89a3  
    3333 */
    3434
    35 #ifndef LIBC_amd64_FIBRIL_H_
    36 #define LIBC_amd64_FIBRIL_H_
     35#ifndef _LIBC_amd64_FIBRIL_H_
     36#define _LIBC_amd64_FIBRIL_H_
    3737
    3838#include <libarch/fibril_context.h>
  • uspace/lib/c/arch/amd64/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_RBX  0x10
    35 #define CONTEXT_OFFSET_RBP  0x18
    36 #define CONTEXT_OFFSET_R12  0x20
    37 #define CONTEXT_OFFSET_R13  0x28
    38 #define CONTEXT_OFFSET_R14  0x30
    39 #define CONTEXT_OFFSET_R15  0x38
    40 #define CONTEXT_OFFSET_TLS  0x40
    41 #define CONTEXT_SIZE        0x48
     32#define __CONTEXT_OFFSET_SP   0x00
     33#define __CONTEXT_OFFSET_PC   0x08
     34#define __CONTEXT_OFFSET_RBX  0x10
     35#define __CONTEXT_OFFSET_RBP  0x18
     36#define __CONTEXT_OFFSET_R12  0x20
     37#define __CONTEXT_OFFSET_R13  0x28
     38#define __CONTEXT_OFFSET_R14  0x30
     39#define __CONTEXT_OFFSET_R15  0x38
     40#define __CONTEXT_OFFSET_TLS  0x40
     41#define __CONTEXT_SIZE        0x48
    4242
    4343#ifndef __ASSEMBLER__
     
    4545#include <stdint.h>
    4646
    47 typedef struct context {
     47typedef struct __context {
    4848        /*
    4949         * We include only registers that must be preserved
     
    5959        uint64_t r15;
    6060        uint64_t tls;
    61 } context_t;
     61} __context_t;
    6262
    6363#endif
  • uspace/lib/c/arch/amd64/include/libarch/rtld/dynamic.h

    re3272101 rd5a89a3  
    3333 */
    3434
    35 #ifndef LIBC_amd64_RTLD_DYNAMIC_H_
    36 #define LIBC_amd64_RTLD_DYNAMIC_H_
     35#ifndef _LIBC_amd64_RTLD_DYNAMIC_H_
     36#define _LIBC_amd64_RTLD_DYNAMIC_H_
    3737
    3838typedef struct {
  • uspace/lib/c/arch/amd64/include/libarch/rtld/elf_dyn.h

    re3272101 rd5a89a3  
    3333 */
    3434
    35 #ifndef LIBC_amd64_RTLD_ELF_DYN_H_
    36 #define LIBC_amd64_RTLD_ELF_DYN_H_
     35#ifndef _LIBC_amd64_RTLD_ELF_DYN_H_
     36#define _LIBC_amd64_RTLD_ELF_DYN_H_
    3737
    3838#define R_X86_64_64             1
  • uspace/lib/c/arch/amd64/include/libarch/stackarg.h

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

    re3272101 rd5a89a3  
    3434 */
    3535
    36 #ifndef LIBC_amd64_SYSCALL_H_
    37 #define LIBC_amd64_SYSCALL_H_
     36#ifndef _LIBC_amd64_SYSCALL_H_
     37#define _LIBC_amd64_SYSCALL_H_
    3838
    3939#define LIBARCH_SYSCALL_GENERIC
  • uspace/lib/c/arch/amd64/include/libarch/thread.h

    re3272101 rd5a89a3  
    3333 */
    3434
    35 #ifndef LIBC_amd64_THREAD_H_
    36 #define LIBC_amd64_THREAD_H_
     35#ifndef _LIBC_amd64_THREAD_H_
     36#define _LIBC_amd64_THREAD_H_
    3737
    3838#endif
  • uspace/lib/c/arch/amd64/include/libarch/tls.h

    re3272101 rd5a89a3  
    3333 */
    3434
    35 #ifndef LIBC_amd64_TLS_H_
    36 #define LIBC_amd64_TLS_H_
     35#ifndef _LIBC_amd64_TLS_H_
     36#define _LIBC_amd64_TLS_H_
    3737
    3838#define CONFIG_TLS_VARIANT_2
  • uspace/lib/c/arch/amd64/src/fibril.S

    re3272101 rd5a89a3  
    3737# pointed by the 1st argument. Returns 0 in RAX.
    3838#
    39 FUNCTION_BEGIN(__setjmp)
     39FUNCTION_BEGIN(__context_save)
    4040        movq (%rsp), %rdx     # the caller's return %eip
    4141
    4242        # in %rdi is passed 1st argument
    43         movq %rdx, CONTEXT_OFFSET_PC(%rdi)
    44         movq %rsp, CONTEXT_OFFSET_SP(%rdi)
     43        movq %rdx, __CONTEXT_OFFSET_PC(%rdi)
     44        movq %rsp, __CONTEXT_OFFSET_SP(%rdi)
    4545
    46         movq %rbx, CONTEXT_OFFSET_RBX(%rdi)
    47         movq %rbp, CONTEXT_OFFSET_RBP(%rdi)
    48         movq %r12, CONTEXT_OFFSET_R12(%rdi)
    49         movq %r13, CONTEXT_OFFSET_R13(%rdi)
    50         movq %r14, CONTEXT_OFFSET_R14(%rdi)
    51         movq %r15, CONTEXT_OFFSET_R15(%rdi)
     46        movq %rbx, __CONTEXT_OFFSET_RBX(%rdi)
     47        movq %rbp, __CONTEXT_OFFSET_RBP(%rdi)
     48        movq %r12, __CONTEXT_OFFSET_R12(%rdi)
     49        movq %r13, __CONTEXT_OFFSET_R13(%rdi)
     50        movq %r14, __CONTEXT_OFFSET_R14(%rdi)
     51        movq %r15, __CONTEXT_OFFSET_R15(%rdi)
    5252
    5353        movq %fs:0, %rax
    54         movq %rax, CONTEXT_OFFSET_TLS(%rdi)
     54        movq %rax, __CONTEXT_OFFSET_TLS(%rdi)
    5555
    56         xorq %rax, %rax                      # __setjmp returns 0
     56        xorq %rax, %rax                      # __context_save returns 0
    5757        ret
    58 FUNCTION_END(__setjmp)
     58FUNCTION_END(__context_save)
    5959
    6060## Restore current CPU context
     
    6363# pointed by the 1st argument. Returns second argument in RAX.
    6464#
    65 FUNCTION_BEGIN(__longjmp)
    66         movq CONTEXT_OFFSET_R15(%rdi), %r15
    67         movq CONTEXT_OFFSET_R14(%rdi), %r14
    68         movq CONTEXT_OFFSET_R13(%rdi), %r13
    69         movq CONTEXT_OFFSET_R12(%rdi), %r12
    70         movq CONTEXT_OFFSET_RBP(%rdi), %rbp
    71         movq CONTEXT_OFFSET_RBX(%rdi), %rbx
     65FUNCTION_BEGIN(__context_restore)
     66        movq __CONTEXT_OFFSET_R15(%rdi), %r15
     67        movq __CONTEXT_OFFSET_R14(%rdi), %r14
     68        movq __CONTEXT_OFFSET_R13(%rdi), %r13
     69        movq __CONTEXT_OFFSET_R12(%rdi), %r12
     70        movq __CONTEXT_OFFSET_RBP(%rdi), %rbp
     71        movq __CONTEXT_OFFSET_RBX(%rdi), %rbx
    7272
    73         movq CONTEXT_OFFSET_SP(%rdi), %rsp   # ctx->sp -> %rsp
     73        movq __CONTEXT_OFFSET_SP(%rdi), %rsp   # ctx->sp -> %rsp
    7474
    75         movq CONTEXT_OFFSET_PC(%rdi), %rdx
     75        movq __CONTEXT_OFFSET_PC(%rdi), %rdx
    7676
    7777        movq %rdx,(%rsp)
    7878
    79         movq CONTEXT_OFFSET_TLS(%rdi), %rdi
     79        movq __CONTEXT_OFFSET_TLS(%rdi), %rdi
    8080        movq %rdi, %fs:0
    8181
    82         movq %rsi, %rax                      # __longjmp returns second argument
     82        movq %rsi, %rax                      # __context_restore returns second argument
    8383        ret
    84 FUNCTION_END(__longjmp)
     84FUNCTION_END(__context_restore)
    8585
  • uspace/lib/c/arch/amd64/src/rtld/dynamic.c

    re3272101 rd5a89a3  
    2727 */
    2828
    29 /** @addtogroup libcia32
     29/** @addtogroup libcamd64
    3030 * @brief
    3131 * @{
  • uspace/lib/c/arch/arm32/Makefile.common

    re3272101 rd5a89a3  
    2929
    3030COMMON_CFLAGS += -ffixed-r9 -mtp=soft -fno-omit-frame-pointer -mapcs-frame \
    31         -mcpu=$(subst _,-,$(PROCESSOR))
     31        -mcpu=$(subst _,-,$(PROCESSOR)) -Wl,-z,max-page-size=0x1000
    3232
    3333LDFLAGS += -Wl,--gc-sections
  • uspace/lib/c/arch/arm32/Makefile.inc

    re3272101 rd5a89a3  
    3737        arch/$(UARCH)/src/eabi.S \
    3838        arch/$(UARCH)/src/stacktrace.c \
    39         arch/$(UARCH)/src/stacktrace_asm.S
     39        arch/$(UARCH)/src/stacktrace_asm.S \
     40        arch/$(UARCH)/src/rtld/dynamic.c \
     41        arch/$(UARCH)/src/rtld/reloc.c
  • uspace/lib/c/arch/arm32/include/libarch/config.h

    re3272101 rd5a89a3  
    3434 */
    3535
    36 #ifndef LIBC_arm32_CONFIG_H_
    37 #define LIBC_arm32_CONFIG_H_
     36#ifndef _LIBC_arm32_CONFIG_H_
     37#define _LIBC_arm32_CONFIG_H_
    3838
    3939#define PAGE_WIDTH      12
  • uspace/lib/c/arch/arm32/include/libarch/ddi.h

    re3272101 rd5a89a3  
    3131 */
    3232
    33 #ifndef LIBC_arm32_DDI_H_
    34 #define LIBC_arm32_DDI_H_
     33#ifndef _LIBC_arm32_DDI_H_
     34#define _LIBC_arm32_DDI_H_
    3535
    3636#include <ddi.h>
  • uspace/lib/c/arch/arm32/include/libarch/elf_linux.h

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

    re3272101 rd5a89a3  
    3434 */
    3535
    36 #ifndef LIBC_arm32_FADDR_H_
    37 #define LIBC_arm32_FADDR_H_
     36#ifndef _LIBC_arm32_FADDR_H_
     37#define _LIBC_arm32_FADDR_H_
    3838
    3939#include <types/common.h>
  • uspace/lib/c/arch/arm32/include/libarch/fibril.h

    re3272101 rd5a89a3  
    3434 */
    3535
    36 #ifndef LIBC_arm32_FIBRIL_H_
    37 #define LIBC_arm32_FIBRIL_H_
     36#ifndef _LIBC_arm32_FIBRIL_H_
     37#define _LIBC_arm32_FIBRIL_H_
    3838
    3939#include <types/common.h>
  • uspace/lib/c/arch/arm32/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
    3232#include <stdint.h>
     
    4141// XXX: This struct must match the assembly code in src/fibril.S
    4242
    43 typedef struct context {
     43typedef struct __context {
    4444        uintptr_t sp;
    4545        uintptr_t pc;
     
    5454        /* r11 */
    5555        uint32_t fp;
    56 } context_t;
     56} __context_t;
    5757
    5858#endif
  • uspace/lib/c/arch/arm32/include/libarch/rtld/dynamic.h

    re3272101 rd5a89a3  
    11/*
    2  * Copyright (c) 2018 Jaroslav Jindrak
     2 * Copyright (c) 2019 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    2727 */
    2828
    29 #ifndef LIBCPP_BITS_COMMON
    30 #define LIBCPP_BITS_COMMON
     29/** @addtogroup libc
     30 * @{
     31 */
     32/** @file
     33 */
    3134
    32 /**
    33  * According to section 17.2 of the standard,
    34  * the restrict qualifier shall be omitted.
    35  */
    36 #define restrict
     35#ifndef _LIBC_arm32_RTLD_DYNAMIC_H_
     36#define _LIBC_arm32_RTLD_DYNAMIC_H_
    3737
    38 #undef NULL
    39 #define NULL nullptr
     38typedef struct {
     39        /* Empty. */
     40} dyn_info_arch_t;
    4041
    4142#endif
     43
     44/** @}
     45 */
  • uspace/lib/c/arch/arm32/include/libarch/stackarg.h

    re3272101 rd5a89a3  
    3434 */
    3535
    36 #ifndef LIBC_arm32_STACKARG_H_
    37 #define LIBC_arm32_STACKARG_H_
     36#ifndef _LIBC_arm32_STACKARG_H_
     37#define _LIBC_arm32_STACKARG_H_
    3838
    3939#endif
  • uspace/lib/c/arch/arm32/include/libarch/syscall.h

    re3272101 rd5a89a3  
    3434 */
    3535
    36 #ifndef LIBC_arm32_SYSCALL_H_
    37 #define LIBC_arm32_SYSCALL_H_
     36#ifndef _LIBC_arm32_SYSCALL_H_
     37#define _LIBC_arm32_SYSCALL_H_
    3838
    3939#define LIBARCH_SYSCALL_GENERIC
  • uspace/lib/c/arch/arm32/include/libarch/thread.h

    re3272101 rd5a89a3  
    3434 */
    3535
    36 #ifndef LIBC_arm32_THREAD_H_
    37 #define LIBC_arm32_THREAD_H_
     36#ifndef _LIBC_arm32_THREAD_H_
     37#define _LIBC_arm32_THREAD_H_
    3838
    3939#endif
  • uspace/lib/c/arch/arm32/include/libarch/tls.h

    re3272101 rd5a89a3  
    3434 */
    3535
    36 #ifndef LIBC_arm32_TLS_H_
    37 #define LIBC_arm32_TLS_H_
     36#ifndef _LIBC_arm32_TLS_H_
     37#define _LIBC_arm32_TLS_H_
    3838
    3939#include <stdint.h>
     
    4949 */
    5050typedef struct {
     51        void **dtv;
     52        void *pad;
    5153        /** Fibril data. */
    5254        void *fibril_data;
  • uspace/lib/c/arch/arm32/src/atomic.c

    re3272101 rd5a89a3  
    3535#include <stdbool.h>
    3636
    37 extern volatile unsigned *ras_page;
     37volatile unsigned *ras_page;
    3838
    3939bool __atomic_compare_exchange_4(volatile unsigned *mem, unsigned *expected, unsigned desired, bool weak, int success, int failure)
  • uspace/lib/c/arch/arm32/src/entry.S

    re3272101 rd5a89a3  
    5656
    5757.data
    58 
    59 SYMBOL(ras_page)
    60         .long 0
  • uspace/lib/c/arch/arm32/src/fibril.S

    re3272101 rd5a89a3  
    3131.text
    3232
    33 FUNCTION_BEGIN(__setjmp)
     33FUNCTION_BEGIN(__context_save)
    3434        stmia r0!, {sp, lr}
    3535        stmia r0!, {r4-r11}
     
    3838        mov r0, #0
    3939        mov pc, lr
    40 FUNCTION_END(__setjmp)
     40FUNCTION_END(__context_save)
    4141
    42 FUNCTION_BEGIN(__longjmp)
     42FUNCTION_BEGIN(__context_restore)
    4343        ldmia r0!, {sp, lr}
    4444        ldmia r0!, {r4-r11}
     
    4747        mov r0, r1
    4848        mov pc, lr
    49 FUNCTION_END(__longjmp)
     49FUNCTION_END(__context_restore)
    5050
  • uspace/lib/c/arch/arm32/src/syscall.c

    re3272101 rd5a89a3  
    7070              "r" (__arm_reg_r5),
    7171              "r" (__arm_reg_r6)
     72            :
     73              /*
     74               * Clobber memory too as some arguments might be
     75               * actually pointers.
     76               */
     77              "memory"
    7278        );
    7379
  • uspace/lib/c/arch/arm32/src/tls.c

    re3272101 rd5a89a3  
    11/*
     2 * Copyright (c) 2019 Jiri Svoboda
    23 * Copyright (c) 2007 Pavel Jancik
    34 * All rights reserved.
     
    3839#include <stddef.h>
    3940
     41#ifdef CONFIG_RTLD
     42#include <rtld/rtld.h>
     43#endif
     44
    4045tcb_t *tls_alloc_arch(size_t size, size_t align)
    4146{
     
    4853}
    4954
     55/*
     56 * Rtld TLS support
     57 */
     58
     59typedef struct {
     60        unsigned long int ti_module;
     61        unsigned long int ti_offset;
     62} tls_index;
     63
     64int __tls_debug = 0;
     65
     66void *__tls_get_addr(tls_index *ti);
     67
     68void *__tls_get_addr(tls_index *ti)
     69{
     70        uint8_t *tls;
     71
     72#ifdef CONFIG_RTLD
     73        if (runtime_env != NULL) {
     74                return rtld_tls_get_addr(runtime_env, __tcb_get(),
     75                    ti->ti_module, ti->ti_offset);
     76        }
     77#endif
     78        /* Get address of static TLS block */
     79        tls = tls_get();
     80        return tls + ti->ti_offset;
     81}
     82
    5083/** @}
    5184 */
  • uspace/lib/c/arch/ia32/include/libarch/config.h

    re3272101 rd5a89a3  
    3333 */
    3434
    35 #ifndef LIBC_ia32_CONFIG_H_
    36 #define LIBC_ia32_CONFIG_H_
     35#ifndef _LIBC_ia32_CONFIG_H_
     36#define _LIBC_ia32_CONFIG_H_
    3737
    3838#define PAGE_WIDTH  12
  • uspace/lib/c/arch/ia32/include/libarch/ddi.h

    re3272101 rd5a89a3  
    3131 */
    3232
    33 #ifndef LIBC_ia32_DDI_H_
    34 #define LIBC_ia32_DDI_H_
     33#ifndef _LIBC_ia32_DDI_H_
     34#define _LIBC_ia32_DDI_H_
    3535
    3636#include <ddi.h>
  • uspace/lib/c/arch/ia32/include/libarch/elf_linux.h

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

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

    re3272101 rd5a89a3  
    3333 */
    3434
    35 #ifndef LIBC_ia32_FIBRIL_H_
    36 #define LIBC_ia32_FIBRIL_H_
     35#ifndef _LIBC_ia32_FIBRIL_H_
     36#define _LIBC_ia32_FIBRIL_H_
    3737
    3838#include <types/common.h>
  • uspace/lib/c/arch/ia32/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   0x04
    34 #define CONTEXT_OFFSET_EBX  0x08
    35 #define CONTEXT_OFFSET_ESI  0x0c
    36 #define CONTEXT_OFFSET_EDI  0x10
    37 #define CONTEXT_OFFSET_EBP  0x14
    38 #define CONTEXT_OFFSET_TLS  0x18
    39 #define CONTEXT_SIZE        0x1c
     32#define __CONTEXT_OFFSET_SP   0x00
     33#define __CONTEXT_OFFSET_PC   0x04
     34#define __CONTEXT_OFFSET_EBX  0x08
     35#define __CONTEXT_OFFSET_ESI  0x0c
     36#define __CONTEXT_OFFSET_EDI  0x10
     37#define __CONTEXT_OFFSET_EBP  0x14
     38#define __CONTEXT_OFFSET_TLS  0x18
     39#define __CONTEXT_SIZE        0x1c
    4040
    4141#ifndef __ASSEMBLER__
     
    4444
    4545/* We include only registers that must be preserved during function call. */
    46 typedef struct context {
     46typedef struct __context {
    4747        uint32_t sp;
    4848        uint32_t pc;
     
    5252        uint32_t ebp;
    5353        uint32_t tls;
    54 } context_t;
     54} __context_t;
    5555
    5656#endif
  • uspace/lib/c/arch/ia32/include/libarch/rtld/dynamic.h

    re3272101 rd5a89a3  
    3333 */
    3434
    35 #ifndef LIBC_ia32_RTLD_DYNAMIC_H_
    36 #define LIBC_ia32_RTLD_DYNAMIC_H_
     35#ifndef _LIBC_ia32_RTLD_DYNAMIC_H_
     36#define _LIBC_ia32_RTLD_DYNAMIC_H_
    3737
    3838typedef struct {
  • uspace/lib/c/arch/ia32/include/libarch/rtld/elf_dyn.h

    re3272101 rd5a89a3  
    3333 */
    3434
    35 #ifndef LIBC_ia32_RTLD_ELF_DYN_H_
    36 #define LIBC_ia32_RTLD_ELF_DYN_H_
     35#ifndef _LIBC_ia32_RTLD_ELF_DYN_H_
     36#define _LIBC_ia32_RTLD_ELF_DYN_H_
    3737
    3838/*
  • uspace/lib/c/arch/ia32/include/libarch/syscall.h

    re3272101 rd5a89a3  
    3434 */
    3535
    36 #ifndef LIBC_ia32_SYSCALL_H_
    37 #define LIBC_ia32_SYSCALL_H_
     36#ifndef _LIBC_ia32_SYSCALL_H_
     37#define _LIBC_ia32_SYSCALL_H_
    3838
    3939#include <abi/syscall.h>
  • uspace/lib/c/arch/ia32/include/libarch/thread.h

    re3272101 rd5a89a3  
    3333 */
    3434
    35 #ifndef LIBC_ia32_THREAD_H_
    36 #define LIBC_ia32_THREAD_H_
     35#ifndef _LIBC_ia32_THREAD_H_
     36#define _LIBC_ia32_THREAD_H_
    3737
    3838#endif
  • uspace/lib/c/arch/ia32/include/libarch/tls.h

    re3272101 rd5a89a3  
    3333 */
    3434
    35 #ifndef LIBC_ia32_TLS_H_
    36 #define LIBC_ia32_TLS_H_
     35#ifndef _LIBC_ia32_TLS_H_
     36#define _LIBC_ia32_TLS_H_
    3737
    3838#define CONFIG_TLS_VARIANT_2
  • uspace/lib/c/arch/ia32/src/fibril.S

    re3272101 rd5a89a3  
    3737# pointed by the 1st argument. Returns 0 in EAX.
    3838#
    39 FUNCTION_BEGIN(__setjmp)
     39FUNCTION_BEGIN(__context_save)
    4040        movl 0(%esp), %eax  # the caller's return %eip
    4141        movl 4(%esp), %edx  # address of the context variable to save context to
    4242
    4343        # save registers to the context structure
    44         movl %esp, CONTEXT_OFFSET_SP(%edx)      # %esp -> ctx->sp
    45         movl %eax, CONTEXT_OFFSET_PC(%edx)      # %eip -> ctx->pc
    46         movl %ebx, CONTEXT_OFFSET_EBX(%edx)     # %ebx -> ctx->ebx
    47         movl %esi, CONTEXT_OFFSET_ESI(%edx)     # %esi -> ctx->esi
    48         movl %edi, CONTEXT_OFFSET_EDI(%edx)     # %edi -> ctx->edi
    49         movl %ebp, CONTEXT_OFFSET_EBP(%edx)     # %ebp -> ctx->ebp
     44        movl %esp, __CONTEXT_OFFSET_SP(%edx)    # %esp -> ctx->sp
     45        movl %eax, __CONTEXT_OFFSET_PC(%edx)    # %eip -> ctx->pc
     46        movl %ebx, __CONTEXT_OFFSET_EBX(%edx)   # %ebx -> ctx->ebx
     47        movl %esi, __CONTEXT_OFFSET_ESI(%edx)   # %esi -> ctx->esi
     48        movl %edi, __CONTEXT_OFFSET_EDI(%edx)   # %edi -> ctx->edi
     49        movl %ebp, __CONTEXT_OFFSET_EBP(%edx)   # %ebp -> ctx->ebp
    5050
    5151        # save TLS
    5252        movl %gs:0, %eax
    53         movl %eax, CONTEXT_OFFSET_TLS(%edx)     # tls -> ctx->tls
     53        movl %eax, __CONTEXT_OFFSET_TLS(%edx)   # tls -> ctx->tls
    5454
    55         xorl %eax, %eax         # __setjmp returns 0
     55        xorl %eax, %eax         # __context_save returns 0
    5656        ret
    57 FUNCTION_END(__setjmp)
     57FUNCTION_END(__context_save)
    5858
    5959## Restore saved CPU context
     
    6262# pointed by the 1st argument. Returns second argument in EAX.
    6363#
    64 FUNCTION_BEGIN(__longjmp)
     64FUNCTION_BEGIN(__context_restore)
    6565        movl 4(%esp), %eax  # address of the context variable to restore context from
    6666        movl 8(%esp), %ecx  # return value
    6767
    6868        # restore registers from the context structure
    69         movl CONTEXT_OFFSET_SP(%eax),%esp       # ctx->sp -> %esp
    70         movl CONTEXT_OFFSET_PC(%eax),%edx       # ctx->pc -> \pc
    71         movl CONTEXT_OFFSET_EBX(%eax),%ebx      # ctx->ebx -> %ebx
    72         movl CONTEXT_OFFSET_ESI(%eax),%esi      # ctx->esi -> %esi
    73         movl CONTEXT_OFFSET_EDI(%eax),%edi      # ctx->edi -> %edi
    74         movl CONTEXT_OFFSET_EBP(%eax),%ebp      # ctx->ebp -> %ebp
     69        movl __CONTEXT_OFFSET_SP(%eax),%esp     # ctx->sp -> %esp
     70        movl __CONTEXT_OFFSET_PC(%eax),%edx     # ctx->pc -> \pc
     71        movl __CONTEXT_OFFSET_EBX(%eax),%ebx    # ctx->ebx -> %ebx
     72        movl __CONTEXT_OFFSET_ESI(%eax),%esi    # ctx->esi -> %esi
     73        movl __CONTEXT_OFFSET_EDI(%eax),%edi    # ctx->edi -> %edi
     74        movl __CONTEXT_OFFSET_EBP(%eax),%ebp    # ctx->ebp -> %ebp
    7575
    7676        movl %edx, 0(%esp)  # ctx->pc -> saver's return %eip
    7777
    7878        # set thread local storage
    79         movl CONTEXT_OFFSET_TLS(%eax), %edx     # Set arg1 to TLS addr
     79        movl __CONTEXT_OFFSET_TLS(%eax), %edx   # Set arg1 to TLS addr
    8080        movl %edx, %gs:0
    8181
    8282        movl %ecx, %eax
    8383        ret
    84 FUNCTION_END(__longjmp)
     84FUNCTION_END(__context_restore)
    8585
  • uspace/lib/c/arch/ia64/include/libarch/config.h

    re3272101 rd5a89a3  
    3333 */
    3434
    35 #ifndef LIBC_ia64_CONFIG_H_
    36 #define LIBC_ia64_CONFIG_H_
     35#ifndef _LIBC_ia64_CONFIG_H_
     36#define _LIBC_ia64_CONFIG_H_
    3737
    3838#define PAGE_WIDTH      14
  • uspace/lib/c/arch/ia64/include/libarch/ddi.h

    re3272101 rd5a89a3  
    3333 */
    3434
    35 #ifndef LIBC_ia64_DDI_H_
    36 #define LIBC_ia64_DDI_H_
     35#ifndef _LIBC_ia64_DDI_H_
     36#define _LIBC_ia64_DDI_H_
    3737
    3838#include <ddi.h>
  • uspace/lib/c/arch/ia64/include/libarch/elf_linux.h

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

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

    re3272101 rd5a89a3  
    3333 */
    3434
    35 #ifndef LIBC_ia64_FIBRIL_H_
    36 #define LIBC_ia64_FIBRIL_H_
     35#ifndef _LIBC_ia64_FIBRIL_H_
     36#define _LIBC_ia64_FIBRIL_H_
    3737
    3838#include <stdint.h>
     
    4343
    4444/*
    45  * __setjmp() and __longjmp() are both leaf procedures.
     45 * __context_save() and __context_restore() are both leaf procedures.
    4646 * No need to allocate scratch area.
    4747 */
  • uspace/lib/c/arch/ia64/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_AR_PFS          0x000
    33 #define CONTEXT_OFFSET_AR_UNAT_CALLER  0x008
    34 #define CONTEXT_OFFSET_AR_UNAT_CALLEE  0x010
    35 #define CONTEXT_OFFSET_AR_RSC          0x018
    36 #define CONTEXT_OFFSET_BSP             0x020
    37 #define CONTEXT_OFFSET_AR_RNAT         0x028
    38 #define CONTEXT_OFFSET_AR_LC           0x030
    39 #define CONTEXT_OFFSET_R1              0x038
    40 #define CONTEXT_OFFSET_R4              0x040
    41 #define CONTEXT_OFFSET_R5              0x048
    42 #define CONTEXT_OFFSET_R6              0x050
    43 #define CONTEXT_OFFSET_R7              0x058
    44 #define CONTEXT_OFFSET_SP              0x060
    45 #define CONTEXT_OFFSET_TP              0x068
    46 #define CONTEXT_OFFSET_PC              0x070
    47 #define CONTEXT_OFFSET_B1              0x078
    48 #define CONTEXT_OFFSET_B2              0x080
    49 #define CONTEXT_OFFSET_B3              0x088
    50 #define CONTEXT_OFFSET_B4              0x090
    51 #define CONTEXT_OFFSET_B5              0x098
    52 #define CONTEXT_OFFSET_PR              0x0a0
    53 #define CONTEXT_OFFSET_F2              0x0b0
    54 #define CONTEXT_OFFSET_F3              0x0c0
    55 #define CONTEXT_OFFSET_F4              0x0d0
    56 #define CONTEXT_OFFSET_F5              0x0e0
    57 #define CONTEXT_OFFSET_F16             0x0f0
    58 #define CONTEXT_OFFSET_F17             0x100
    59 #define CONTEXT_OFFSET_F18             0x110
    60 #define CONTEXT_OFFSET_F19             0x120
    61 #define CONTEXT_OFFSET_F20             0x130
    62 #define CONTEXT_OFFSET_F21             0x140
    63 #define CONTEXT_OFFSET_F22             0x150
    64 #define CONTEXT_OFFSET_F23             0x160
    65 #define CONTEXT_OFFSET_F24             0x170
    66 #define CONTEXT_OFFSET_F25             0x180
    67 #define CONTEXT_OFFSET_F26             0x190
    68 #define CONTEXT_OFFSET_F27             0x1a0
    69 #define CONTEXT_OFFSET_F28             0x1b0
    70 #define CONTEXT_OFFSET_F29             0x1c0
    71 #define CONTEXT_OFFSET_F30             0x1d0
    72 #define CONTEXT_OFFSET_F31             0x1e0
    73 #define CONTEXT_SIZE                   0x1f0
     32#define __CONTEXT_OFFSET_AR_PFS          0x000
     33#define __CONTEXT_OFFSET_AR_UNAT_CALLER  0x008
     34#define __CONTEXT_OFFSET_AR_UNAT_CALLEE  0x010
     35#define __CONTEXT_OFFSET_AR_RSC          0x018
     36#define __CONTEXT_OFFSET_BSP             0x020
     37#define __CONTEXT_OFFSET_AR_RNAT         0x028
     38#define __CONTEXT_OFFSET_AR_LC           0x030
     39#define __CONTEXT_OFFSET_R1              0x038
     40#define __CONTEXT_OFFSET_R4              0x040
     41#define __CONTEXT_OFFSET_R5              0x048
     42#define __CONTEXT_OFFSET_R6              0x050
     43#define __CONTEXT_OFFSET_R7              0x058
     44#define __CONTEXT_OFFSET_SP              0x060
     45#define __CONTEXT_OFFSET_TP              0x068
     46#define __CONTEXT_OFFSET_PC              0x070
     47#define __CONTEXT_OFFSET_B1              0x078
     48#define __CONTEXT_OFFSET_B2              0x080
     49#define __CONTEXT_OFFSET_B3              0x088
     50#define __CONTEXT_OFFSET_B4              0x090
     51#define __CONTEXT_OFFSET_B5              0x098
     52#define __CONTEXT_OFFSET_PR              0x0a0
     53#define __CONTEXT_OFFSET_F2              0x0b0
     54#define __CONTEXT_OFFSET_F3              0x0c0
     55#define __CONTEXT_OFFSET_F4              0x0d0
     56#define __CONTEXT_OFFSET_F5              0x0e0
     57#define __CONTEXT_OFFSET_F16             0x0f0
     58#define __CONTEXT_OFFSET_F17             0x100
     59#define __CONTEXT_OFFSET_F18             0x110
     60#define __CONTEXT_OFFSET_F19             0x120
     61#define __CONTEXT_OFFSET_F20             0x130
     62#define __CONTEXT_OFFSET_F21             0x140
     63#define __CONTEXT_OFFSET_F22             0x150
     64#define __CONTEXT_OFFSET_F23             0x160
     65#define __CONTEXT_OFFSET_F24             0x170
     66#define __CONTEXT_OFFSET_F25             0x180
     67#define __CONTEXT_OFFSET_F26             0x190
     68#define __CONTEXT_OFFSET_F27             0x1a0
     69#define __CONTEXT_OFFSET_F28             0x1b0
     70#define __CONTEXT_OFFSET_F29             0x1c0
     71#define __CONTEXT_OFFSET_F30             0x1d0
     72#define __CONTEXT_OFFSET_F31             0x1e0
     73#define __CONTEXT_SIZE                   0x1f0
    7474
    7575#ifndef __ASSEMBLER__
     
    7979
    8080// Only save registers that must be preserved across function calls.
    81 typedef struct context {
     81typedef struct __context {
    8282        // Application registers.
    8383        uint64_t ar_pfs;
     
    132132        uint128_t f30;
    133133        uint128_t f31;
    134 } context_t;
     134} __context_t;
    135135
    136136#endif  /* __ASSEMBLER__ */
  • uspace/lib/c/arch/ia64/include/libarch/stack.h

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

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

    re3272101 rd5a89a3  
    3434 */
    3535
    36 #ifndef LIBC_ia64_SYSCALL_H_
    37 #define LIBC_ia64_SYSCALL_H_
     36#ifndef _LIBC_ia64_SYSCALL_H_
     37#define _LIBC_ia64_SYSCALL_H_
    3838
    3939#define LIBARCH_SYSCALL_GENERIC
  • uspace/lib/c/arch/ia64/include/libarch/thread.h

    re3272101 rd5a89a3  
    3333 */
    3434
    35 #ifndef LIBC_ia64_THREAD_H_
    36 #define LIBC_ia64_THREAD_H_
     35#ifndef _LIBC_ia64_THREAD_H_
     36#define _LIBC_ia64_THREAD_H_
    3737
    3838#endif
  • uspace/lib/c/arch/ia64/include/libarch/tls.h

    re3272101 rd5a89a3  
    3333 */
    3434
    35 #ifndef LIBC_ia64_TLS_H_
    36 #define LIBC_ia64_TLS_H_
     35#ifndef _LIBC_ia64_TLS_H_
     36#define _LIBC_ia64_TLS_H_
    3737
    3838#define CONFIG_TLS_VARIANT_1
  • uspace/lib/c/arch/ia64/src/fibril.S

    re3272101 rd5a89a3  
    3232.text
    3333
    34 FUNCTION_BEGIN(__setjmp)
     34FUNCTION_BEGIN(__context_save)
    3535        alloc loc0 = ar.pfs, 1, 49, 0, 0
    3636        mov loc1 = ar.unat ;;
     
    5858        mov loc6 = ar.lc
    5959
    60         add loc8 = CONTEXT_OFFSET_AR_PFS, in0
    61         add loc9 = CONTEXT_OFFSET_AR_UNAT_CALLER, in0
    62         add loc10 = CONTEXT_OFFSET_AR_UNAT_CALLEE, in0
    63         add loc11 = CONTEXT_OFFSET_AR_RSC, in0
    64         add loc12 = CONTEXT_OFFSET_BSP, in0
    65         add loc13 = CONTEXT_OFFSET_AR_RNAT, in0
    66         add loc14 = CONTEXT_OFFSET_AR_LC, in0
    67 
    68         add loc15 = CONTEXT_OFFSET_R1, in0
    69         add loc16 = CONTEXT_OFFSET_R4, in0
    70         add loc17 = CONTEXT_OFFSET_R5, in0
    71         add loc18 = CONTEXT_OFFSET_R6, in0
    72         add loc19 = CONTEXT_OFFSET_R7, in0
    73         add loc20 = CONTEXT_OFFSET_SP, in0
    74         add loc21 = CONTEXT_OFFSET_TP, in0
    75 
    76         add loc22 = CONTEXT_OFFSET_PC, in0
    77         add loc23 = CONTEXT_OFFSET_B1, in0
    78         add loc24 = CONTEXT_OFFSET_B2, in0
    79         add loc25 = CONTEXT_OFFSET_B3, in0
    80         add loc26 = CONTEXT_OFFSET_B4, in0
    81         add loc27 = CONTEXT_OFFSET_B5, in0
    82 
    83         add loc28 = CONTEXT_OFFSET_PR, in0
    84 
    85         add loc29 = CONTEXT_OFFSET_F2, in0
    86         add loc30 = CONTEXT_OFFSET_F3, in0
    87         add loc31 = CONTEXT_OFFSET_F4, in0
    88         add loc32 = CONTEXT_OFFSET_F5, in0
    89 
    90         add loc33 = CONTEXT_OFFSET_F16, in0
    91         add loc34 = CONTEXT_OFFSET_F17, in0
    92         add loc35 = CONTEXT_OFFSET_F18, in0
    93         add loc36 = CONTEXT_OFFSET_F19, in0
    94         add loc37 = CONTEXT_OFFSET_F20, in0
    95         add loc38 = CONTEXT_OFFSET_F21, in0
    96         add loc39 = CONTEXT_OFFSET_F22, in0
    97         add loc40 = CONTEXT_OFFSET_F23, in0
    98         add loc41 = CONTEXT_OFFSET_F24, in0
    99         add loc42 = CONTEXT_OFFSET_F25, in0
    100         add loc43 = CONTEXT_OFFSET_F26, in0
    101         add loc44 = CONTEXT_OFFSET_F27, in0
    102         add loc45 = CONTEXT_OFFSET_F28, in0
    103         add loc46 = CONTEXT_OFFSET_F29, in0
    104         add loc47 = CONTEXT_OFFSET_F30, in0
    105         add loc48 = CONTEXT_OFFSET_F31, in0 ;;
     60        add loc8 = __CONTEXT_OFFSET_AR_PFS, in0
     61        add loc9 = __CONTEXT_OFFSET_AR_UNAT_CALLER, in0
     62        add loc10 = __CONTEXT_OFFSET_AR_UNAT_CALLEE, in0
     63        add loc11 = __CONTEXT_OFFSET_AR_RSC, in0
     64        add loc12 = __CONTEXT_OFFSET_BSP, in0
     65        add loc13 = __CONTEXT_OFFSET_AR_RNAT, in0
     66        add loc14 = __CONTEXT_OFFSET_AR_LC, in0
     67
     68        add loc15 = __CONTEXT_OFFSET_R1, in0
     69        add loc16 = __CONTEXT_OFFSET_R4, in0
     70        add loc17 = __CONTEXT_OFFSET_R5, in0
     71        add loc18 = __CONTEXT_OFFSET_R6, in0
     72        add loc19 = __CONTEXT_OFFSET_R7, in0
     73        add loc20 = __CONTEXT_OFFSET_SP, in0
     74        add loc21 = __CONTEXT_OFFSET_TP, in0
     75
     76        add loc22 = __CONTEXT_OFFSET_PC, in0
     77        add loc23 = __CONTEXT_OFFSET_B1, in0
     78        add loc24 = __CONTEXT_OFFSET_B2, in0
     79        add loc25 = __CONTEXT_OFFSET_B3, in0
     80        add loc26 = __CONTEXT_OFFSET_B4, in0
     81        add loc27 = __CONTEXT_OFFSET_B5, in0
     82
     83        add loc28 = __CONTEXT_OFFSET_PR, in0
     84
     85        add loc29 = __CONTEXT_OFFSET_F2, in0
     86        add loc30 = __CONTEXT_OFFSET_F3, in0
     87        add loc31 = __CONTEXT_OFFSET_F4, in0
     88        add loc32 = __CONTEXT_OFFSET_F5, in0
     89
     90        add loc33 = __CONTEXT_OFFSET_F16, in0
     91        add loc34 = __CONTEXT_OFFSET_F17, in0
     92        add loc35 = __CONTEXT_OFFSET_F18, in0
     93        add loc36 = __CONTEXT_OFFSET_F19, in0
     94        add loc37 = __CONTEXT_OFFSET_F20, in0
     95        add loc38 = __CONTEXT_OFFSET_F21, in0
     96        add loc39 = __CONTEXT_OFFSET_F22, in0
     97        add loc40 = __CONTEXT_OFFSET_F23, in0
     98        add loc41 = __CONTEXT_OFFSET_F24, in0
     99        add loc42 = __CONTEXT_OFFSET_F25, in0
     100        add loc43 = __CONTEXT_OFFSET_F26, in0
     101        add loc44 = __CONTEXT_OFFSET_F27, in0
     102        add loc45 = __CONTEXT_OFFSET_F28, in0
     103        add loc46 = __CONTEXT_OFFSET_F29, in0
     104        add loc47 = __CONTEXT_OFFSET_F30, in0
     105        add loc48 = __CONTEXT_OFFSET_F31, in0 ;;
    106106
    107107        /*
     
    178178        mov ar.unat = loc1
    179179
    180         mov r8 = 0      /* __setjmp returns 0 */
     180        mov r8 = 0      /* __context_save returns 0 */
    181181        br.ret.sptk.many b0
    182 FUNCTION_END(__setjmp)
    183 
    184 FUNCTION_BEGIN(__longjmp)
     182FUNCTION_END(__context_save)
     183
     184FUNCTION_BEGIN(__context_restore)
    185185        alloc loc0 = ar.pfs, 2, 50, 0, 0 ;;
    186186
    187         add loc9 = CONTEXT_OFFSET_AR_PFS, in0
    188         add loc10 = CONTEXT_OFFSET_AR_UNAT_CALLER, in0
    189         add loc11 = CONTEXT_OFFSET_AR_UNAT_CALLEE, in0
    190         add loc12 = CONTEXT_OFFSET_AR_RSC, in0
    191         add loc13 = CONTEXT_OFFSET_BSP, in0
    192         add loc14 = CONTEXT_OFFSET_AR_RNAT, in0
    193         add loc15 = CONTEXT_OFFSET_AR_LC, in0
    194 
    195         add loc16 = CONTEXT_OFFSET_R1, in0
    196         add loc17 = CONTEXT_OFFSET_R4, in0
    197         add loc18 = CONTEXT_OFFSET_R5, in0
    198         add loc19 = CONTEXT_OFFSET_R6, in0
    199         add loc20 = CONTEXT_OFFSET_R7, in0
    200         add loc21 = CONTEXT_OFFSET_SP, in0
    201         add loc22 = CONTEXT_OFFSET_TP, in0
    202 
    203         add loc23 = CONTEXT_OFFSET_PC, in0
    204         add loc24 = CONTEXT_OFFSET_B1, in0
    205         add loc25 = CONTEXT_OFFSET_B2, in0
    206         add loc26 = CONTEXT_OFFSET_B3, in0
    207         add loc27 = CONTEXT_OFFSET_B4, in0
    208         add loc28 = CONTEXT_OFFSET_B5, in0
    209 
    210         add loc29 = CONTEXT_OFFSET_PR, in0
    211 
    212         add loc30 = CONTEXT_OFFSET_F2, in0
    213         add loc31 = CONTEXT_OFFSET_F3, in0
    214         add loc32 = CONTEXT_OFFSET_F4, in0
    215         add loc33 = CONTEXT_OFFSET_F5, in0
    216 
    217         add loc34 = CONTEXT_OFFSET_F16, in0
    218         add loc35 = CONTEXT_OFFSET_F17, in0
    219         add loc36 = CONTEXT_OFFSET_F18, in0
    220         add loc37 = CONTEXT_OFFSET_F19, in0
    221         add loc38 = CONTEXT_OFFSET_F20, in0
    222         add loc39 = CONTEXT_OFFSET_F21, in0
    223         add loc40 = CONTEXT_OFFSET_F22, in0
    224         add loc41 = CONTEXT_OFFSET_F23, in0
    225         add loc42 = CONTEXT_OFFSET_F24, in0
    226         add loc43 = CONTEXT_OFFSET_F25, in0
    227         add loc44 = CONTEXT_OFFSET_F26, in0
    228         add loc45 = CONTEXT_OFFSET_F27, in0
    229         add loc46 = CONTEXT_OFFSET_F28, in0
    230         add loc47 = CONTEXT_OFFSET_F29, in0
    231         add loc48 = CONTEXT_OFFSET_F30, in0
    232         add loc49 = CONTEXT_OFFSET_F31, in0 ;;
     187        add loc9 = __CONTEXT_OFFSET_AR_PFS, in0
     188        add loc10 = __CONTEXT_OFFSET_AR_UNAT_CALLER, in0
     189        add loc11 = __CONTEXT_OFFSET_AR_UNAT_CALLEE, in0
     190        add loc12 = __CONTEXT_OFFSET_AR_RSC, in0
     191        add loc13 = __CONTEXT_OFFSET_BSP, in0
     192        add loc14 = __CONTEXT_OFFSET_AR_RNAT, in0
     193        add loc15 = __CONTEXT_OFFSET_AR_LC, in0
     194
     195        add loc16 = __CONTEXT_OFFSET_R1, in0
     196        add loc17 = __CONTEXT_OFFSET_R4, in0
     197        add loc18 = __CONTEXT_OFFSET_R5, in0
     198        add loc19 = __CONTEXT_OFFSET_R6, in0
     199        add loc20 = __CONTEXT_OFFSET_R7, in0
     200        add loc21 = __CONTEXT_OFFSET_SP, in0
     201        add loc22 = __CONTEXT_OFFSET_TP, in0
     202
     203        add loc23 = __CONTEXT_OFFSET_PC, in0
     204        add loc24 = __CONTEXT_OFFSET_B1, in0
     205        add loc25 = __CONTEXT_OFFSET_B2, in0
     206        add loc26 = __CONTEXT_OFFSET_B3, in0
     207        add loc27 = __CONTEXT_OFFSET_B4, in0
     208        add loc28 = __CONTEXT_OFFSET_B5, in0
     209
     210        add loc29 = __CONTEXT_OFFSET_PR, in0
     211
     212        add loc30 = __CONTEXT_OFFSET_F2, in0
     213        add loc31 = __CONTEXT_OFFSET_F3, in0
     214        add loc32 = __CONTEXT_OFFSET_F4, in0
     215        add loc33 = __CONTEXT_OFFSET_F5, in0
     216
     217        add loc34 = __CONTEXT_OFFSET_F16, in0
     218        add loc35 = __CONTEXT_OFFSET_F17, in0
     219        add loc36 = __CONTEXT_OFFSET_F18, in0
     220        add loc37 = __CONTEXT_OFFSET_F19, in0
     221        add loc38 = __CONTEXT_OFFSET_F20, in0
     222        add loc39 = __CONTEXT_OFFSET_F21, in0
     223        add loc40 = __CONTEXT_OFFSET_F22, in0
     224        add loc41 = __CONTEXT_OFFSET_F23, in0
     225        add loc42 = __CONTEXT_OFFSET_F24, in0
     226        add loc43 = __CONTEXT_OFFSET_F25, in0
     227        add loc44 = __CONTEXT_OFFSET_F26, in0
     228        add loc45 = __CONTEXT_OFFSET_F27, in0
     229        add loc46 = __CONTEXT_OFFSET_F28, in0
     230        add loc47 = __CONTEXT_OFFSET_F29, in0
     231        add loc48 = __CONTEXT_OFFSET_F30, in0
     232        add loc49 = __CONTEXT_OFFSET_F31, in0 ;;
    233233
    234234        ld8 loc0 = [loc9]       /* load ar.pfs */
     
    335335        mov ar.unat = loc1
    336336
    337         mov r8 = in1                    /* __longjmp returns second argument */
     337        mov r8 = in1                    /* __context_restore returns second argument */
    338338        br.ret.sptk.many b0
    339 FUNCTION_END(__longjmp)
     339FUNCTION_END(__context_restore)
  • uspace/lib/c/arch/mips32/include/libarch/config.h

    re3272101 rd5a89a3  
    3333 */
    3434
    35 #ifndef LIBC_mips32_CONFIG_H_
    36 #define LIBC_mips32_CONFIG_H_
     35#ifndef _LIBC_mips32_CONFIG_H_
     36#define _LIBC_mips32_CONFIG_H_
    3737
    3838#define PAGE_WIDTH  14
  • uspace/lib/c/arch/mips32/include/libarch/ddi.h

    re3272101 rd5a89a3  
    3131 */
    3232
    33 #ifndef LIBC_mips32_DDI_H_
    34 #define LIBC_mips32_DDI_H_
     33#ifndef _LIBC_mips32_DDI_H_
     34#define _LIBC_mips32_DDI_H_
    3535
    3636#include <ddi.h>
  • uspace/lib/c/arch/mips32/include/libarch/elf_linux.h

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

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

    re3272101 rd5a89a3  
    3434 */
    3535
    36 #ifndef LIBC_mips32_FIBRIL_H_
    37 #define LIBC_mips32_FIBRIL_H_
     36#ifndef _LIBC_mips32_FIBRIL_H_
     37#define _LIBC_mips32_FIBRIL_H_
    3838
    3939#include <stdint.h>
  • uspace/lib/c/arch/mips32/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   0x04
    34 #define CONTEXT_OFFSET_S0   0x08
    35 #define CONTEXT_OFFSET_S1   0x0c
    36 #define CONTEXT_OFFSET_S2   0x10
    37 #define CONTEXT_OFFSET_S3   0x14
    38 #define CONTEXT_OFFSET_S4   0x18
    39 #define CONTEXT_OFFSET_S5   0x1c
    40 #define CONTEXT_OFFSET_S6   0x20
    41 #define CONTEXT_OFFSET_S7   0x24
    42 #define CONTEXT_OFFSET_S8   0x28
    43 #define CONTEXT_OFFSET_GP   0x2c
    44 #define CONTEXT_OFFSET_TLS  0x30
    45 #define CONTEXT_OFFSET_F20  0x34
    46 #define CONTEXT_OFFSET_F21  0x38
    47 #define CONTEXT_OFFSET_F22  0x3c
    48 #define CONTEXT_OFFSET_F23  0x40
    49 #define CONTEXT_OFFSET_F24  0x44
    50 #define CONTEXT_OFFSET_F25  0x48
    51 #define CONTEXT_OFFSET_F26  0x4c
    52 #define CONTEXT_OFFSET_F27  0x50
    53 #define CONTEXT_OFFSET_F28  0x54
    54 #define CONTEXT_OFFSET_F29  0x58
    55 #define CONTEXT_OFFSET_F30  0x5c
    56 #define CONTEXT_SIZE        0x60
     32#define __CONTEXT_OFFSET_SP   0x00
     33#define __CONTEXT_OFFSET_PC   0x04
     34#define __CONTEXT_OFFSET_S0   0x08
     35#define __CONTEXT_OFFSET_S1   0x0c
     36#define __CONTEXT_OFFSET_S2   0x10
     37#define __CONTEXT_OFFSET_S3   0x14
     38#define __CONTEXT_OFFSET_S4   0x18
     39#define __CONTEXT_OFFSET_S5   0x1c
     40#define __CONTEXT_OFFSET_S6   0x20
     41#define __CONTEXT_OFFSET_S7   0x24
     42#define __CONTEXT_OFFSET_S8   0x28
     43#define __CONTEXT_OFFSET_GP   0x2c
     44#define __CONTEXT_OFFSET_TLS  0x30
     45#define __CONTEXT_OFFSET_F20  0x34
     46#define __CONTEXT_OFFSET_F21  0x38
     47#define __CONTEXT_OFFSET_F22  0x3c
     48#define __CONTEXT_OFFSET_F23  0x40
     49#define __CONTEXT_OFFSET_F24  0x44
     50#define __CONTEXT_OFFSET_F25  0x48
     51#define __CONTEXT_OFFSET_F26  0x4c
     52#define __CONTEXT_OFFSET_F27  0x50
     53#define __CONTEXT_OFFSET_F28  0x54
     54#define __CONTEXT_OFFSET_F29  0x58
     55#define __CONTEXT_OFFSET_F30  0x5c
     56#define __CONTEXT_SIZE        0x60
    5757
    5858#ifndef __ASSEMBLER__
     
    6161#include <stdint.h>
    6262
    63 typedef struct context {
     63typedef struct __context {
    6464        uint32_t sp;
    6565        uint32_t pc;
     
    8787        uint32_t f29;
    8888        uint32_t f30;
    89 } context_t;
     89} __context_t;
    9090
    9191#endif
  • uspace/lib/c/arch/mips32/include/libarch/stack.h

    re3272101 rd5a89a3  
    3333 */
    3434
    35 #ifndef LIBC_mips32_STACK_H_
    36 #define LIBC_mips32_STACK_H_
     35#ifndef _LIBC_mips32_STACK_H_
     36#define _LIBC_mips32_STACK_H_
    3737
    3838#define STACK_ITEM_SIZE  4
  • uspace/lib/c/arch/mips32/include/libarch/syscall.h

    re3272101 rd5a89a3  
    3434 */
    3535
    36 #ifndef LIBC_mips32_SYSCALL_H_
    37 #define LIBC_mips32_SYSCALL_H_
     36#ifndef _LIBC_mips32_SYSCALL_H_
     37#define _LIBC_mips32_SYSCALL_H_
    3838
    3939#define LIBARCH_SYSCALL_GENERIC
  • uspace/lib/c/arch/mips32/include/libarch/thread.h

    re3272101 rd5a89a3  
    3434 */
    3535
    36 #ifndef LIBC_mips32_THREAD_H_
    37 #define LIBC_mips32_THREAD_H_
     36#ifndef _LIBC_mips32_THREAD_H_
     37#define _LIBC_mips32_THREAD_H_
    3838
    3939#endif
  • uspace/lib/c/arch/mips32/include/libarch/tls.h

    re3272101 rd5a89a3  
    3636/* TLS for MIPS is described in http://www.linux-mips.org/wiki/NPTL */
    3737
    38 #ifndef LIBC_mips32_TLS_H_
    39 #define LIBC_mips32_TLS_H_
     38#ifndef _LIBC_mips32_TLS_H_
     39#define _LIBC_mips32_TLS_H_
    4040
    4141/*
  • uspace/lib/c/arch/mips32/src/fibril.S

    re3272101 rd5a89a3  
    3535#include <libarch/fibril_context.h>
    3636
    37 FUNCTION_BEGIN(__setjmp)
    38         sw $s0, CONTEXT_OFFSET_S0($a0)
    39         sw $s1, CONTEXT_OFFSET_S1($a0)
    40         sw $s2, CONTEXT_OFFSET_S2($a0)
    41         sw $s3, CONTEXT_OFFSET_S3($a0)
    42         sw $s4, CONTEXT_OFFSET_S4($a0)
    43         sw $s5, CONTEXT_OFFSET_S5($a0)
    44         sw $s6, CONTEXT_OFFSET_S6($a0)
    45         sw $s7, CONTEXT_OFFSET_S7($a0)
    46         sw $s8, CONTEXT_OFFSET_S8($a0)
    47         sw $gp, CONTEXT_OFFSET_GP($a0)
     37FUNCTION_BEGIN(__context_save)
     38        sw $s0, __CONTEXT_OFFSET_S0($a0)
     39        sw $s1, __CONTEXT_OFFSET_S1($a0)
     40        sw $s2, __CONTEXT_OFFSET_S2($a0)
     41        sw $s3, __CONTEXT_OFFSET_S3($a0)
     42        sw $s4, __CONTEXT_OFFSET_S4($a0)
     43        sw $s5, __CONTEXT_OFFSET_S5($a0)
     44        sw $s6, __CONTEXT_OFFSET_S6($a0)
     45        sw $s7, __CONTEXT_OFFSET_S7($a0)
     46        sw $s8, __CONTEXT_OFFSET_S8($a0)
     47        sw $gp, __CONTEXT_OFFSET_GP($a0)
    4848
    49         sw $k1, CONTEXT_OFFSET_TLS($a0)
     49        sw $k1, __CONTEXT_OFFSET_TLS($a0)
    5050
    5151#ifdef CONFIG_FPU
    5252        mfc1 $t0, $20
    53         sw $t0, CONTEXT_OFFSET_F20($a0)
     53        sw $t0, __CONTEXT_OFFSET_F20($a0)
    5454
    5555        mfc1 $t0, $21
    56         sw $t0, CONTEXT_OFFSET_F21($a0)
     56        sw $t0, __CONTEXT_OFFSET_F21($a0)
    5757
    5858        mfc1 $t0, $22
    59         sw $t0, CONTEXT_OFFSET_F22($a0)
     59        sw $t0, __CONTEXT_OFFSET_F22($a0)
    6060
    6161        mfc1 $t0, $23
    62         sw $t0, CONTEXT_OFFSET_F23($a0)
     62        sw $t0, __CONTEXT_OFFSET_F23($a0)
    6363
    6464        mfc1 $t0, $24
    65         sw $t0, CONTEXT_OFFSET_F24($a0)
     65        sw $t0, __CONTEXT_OFFSET_F24($a0)
    6666
    6767        mfc1 $t0, $25
    68         sw $t0, CONTEXT_OFFSET_F25($a0)
     68        sw $t0, __CONTEXT_OFFSET_F25($a0)
    6969
    7070        mfc1 $t0, $26
    71         sw $t0, CONTEXT_OFFSET_F26($a0)
     71        sw $t0, __CONTEXT_OFFSET_F26($a0)
    7272
    7373        mfc1 $t0, $27
    74         sw $t0, CONTEXT_OFFSET_F27($a0)
     74        sw $t0, __CONTEXT_OFFSET_F27($a0)
    7575
    7676        mfc1 $t0, $28
    77         sw $t0, CONTEXT_OFFSET_F28($a0)
     77        sw $t0, __CONTEXT_OFFSET_F28($a0)
    7878
    7979        mfc1 $t0, $29
    80         sw $t0, CONTEXT_OFFSET_F29($a0)
     80        sw $t0, __CONTEXT_OFFSET_F29($a0)
    8181
    8282        mfc1 $t0, $30
    83         sw $t0, CONTEXT_OFFSET_F30($a0)
     83        sw $t0, __CONTEXT_OFFSET_F30($a0)
    8484#endif /* CONFIG_FPU */
    8585
    86         sw $ra, CONTEXT_OFFSET_PC($a0)
    87         sw $sp, CONTEXT_OFFSET_SP($a0)
     86        sw $ra, __CONTEXT_OFFSET_PC($a0)
     87        sw $sp, __CONTEXT_OFFSET_SP($a0)
    8888
    89         # __setjmp returns 0
     89        # __context_save returns 0
    9090        j $ra
    9191        li $v0, 0
    92 FUNCTION_END(__setjmp)
     92FUNCTION_END(__context_save)
    9393
    94 FUNCTION_BEGIN(__longjmp)
    95         lw $s0, CONTEXT_OFFSET_S0($a0)
    96         lw $s1, CONTEXT_OFFSET_S1($a0)
    97         lw $s2, CONTEXT_OFFSET_S2($a0)
    98         lw $s3, CONTEXT_OFFSET_S3($a0)
    99         lw $s4, CONTEXT_OFFSET_S4($a0)
    100         lw $s5, CONTEXT_OFFSET_S5($a0)
    101         lw $s6, CONTEXT_OFFSET_S6($a0)
    102         lw $s7, CONTEXT_OFFSET_S7($a0)
    103         lw $s8, CONTEXT_OFFSET_S8($a0)
    104         lw $gp, CONTEXT_OFFSET_GP($a0)
    105         lw $k1, CONTEXT_OFFSET_TLS($a0)
     94FUNCTION_BEGIN(__context_restore)
     95        lw $s0, __CONTEXT_OFFSET_S0($a0)
     96        lw $s1, __CONTEXT_OFFSET_S1($a0)
     97        lw $s2, __CONTEXT_OFFSET_S2($a0)
     98        lw $s3, __CONTEXT_OFFSET_S3($a0)
     99        lw $s4, __CONTEXT_OFFSET_S4($a0)
     100        lw $s5, __CONTEXT_OFFSET_S5($a0)
     101        lw $s6, __CONTEXT_OFFSET_S6($a0)
     102        lw $s7, __CONTEXT_OFFSET_S7($a0)
     103        lw $s8, __CONTEXT_OFFSET_S8($a0)
     104        lw $gp, __CONTEXT_OFFSET_GP($a0)
     105        lw $k1, __CONTEXT_OFFSET_TLS($a0)
    106106
    107107#ifdef CONFIG_FPU
    108         lw $t0, CONTEXT_OFFSET_F20($a0)
     108        lw $t0, __CONTEXT_OFFSET_F20($a0)
    109109        mtc1 $t0, $20
    110110
    111         lw $t0, CONTEXT_OFFSET_F21($a0)
     111        lw $t0, __CONTEXT_OFFSET_F21($a0)
    112112        mtc1 $t0, $21
    113113
    114         lw $t0, CONTEXT_OFFSET_F22($a0)
     114        lw $t0, __CONTEXT_OFFSET_F22($a0)
    115115        mtc1 $t0, $22
    116116
    117         lw $t0, CONTEXT_OFFSET_F23($a0)
     117        lw $t0, __CONTEXT_OFFSET_F23($a0)
    118118        mtc1 $t0, $23
    119119
    120         lw $t0, CONTEXT_OFFSET_F24($a0)
     120        lw $t0, __CONTEXT_OFFSET_F24($a0)
    121121        mtc1 $t0, $24
    122122
    123         lw $t0, CONTEXT_OFFSET_F25($a0)
     123        lw $t0, __CONTEXT_OFFSET_F25($a0)
    124124        mtc1 $t0, $25
    125125
    126         lw $t0, CONTEXT_OFFSET_F26($a0)
     126        lw $t0, __CONTEXT_OFFSET_F26($a0)
    127127        mtc1 $t0, $26
    128128
    129         lw $t0, CONTEXT_OFFSET_F27($a0)
     129        lw $t0, __CONTEXT_OFFSET_F27($a0)
    130130        mtc1 $t0, $27
    131131
    132         lw $t0, CONTEXT_OFFSET_F28($a0)
     132        lw $t0, __CONTEXT_OFFSET_F28($a0)
    133133        mtc1 $t0, $28
    134134
    135         lw $t0, CONTEXT_OFFSET_F29($a0)
     135        lw $t0, __CONTEXT_OFFSET_F29($a0)
    136136        mtc1 $t0, $29
    137137
    138         lw $t0, CONTEXT_OFFSET_F30($a0)
     138        lw $t0, __CONTEXT_OFFSET_F30($a0)
    139139        mtc1 $t0, $30
    140140#endif /* CONFIG_FPU */
    141141
    142         lw $ra, CONTEXT_OFFSET_PC($a0)
    143         lw $sp, CONTEXT_OFFSET_SP($a0)
     142        lw $ra, __CONTEXT_OFFSET_PC($a0)
     143        lw $sp, __CONTEXT_OFFSET_SP($a0)
    144144
    145145        # Just for the jump into first function,
     
    147147        move $t9, $ra
    148148
    149         # __longjmp returns second argument
     149        # __context_restore returns second argument
    150150        j $ra
    151151        move $v0, $a1
    152 FUNCTION_END(__longjmp)
     152FUNCTION_END(__context_restore)
  • uspace/lib/c/arch/mips32/src/syscall.c

    re3272101 rd5a89a3  
    5757              "r" (__mips_reg_t1),
    5858              "r" (__mips_reg_v0)
     59            :
    5960              /*
    6061               * We are a function call, although C
    6162               * does not know it.
    6263               */
    63             : "%ra"
     64              "%ra",
     65              /*
     66               * Clobber memory too as some arguments might be
     67               * actually pointers.
     68               */
     69              "memory"
    6470        );
    6571
  • uspace/lib/c/arch/ppc32/Makefile.common

    re3272101 rd5a89a3  
    3333endif
    3434
    35 COMMON_CFLAGS += -mcpu=powerpc -m$(FLOATS)-float -m32
     35COMMON_CFLAGS += -mcpu=powerpc -m$(FLOATS)-float -m32 -Wl,-z,max-page-size=0x1000
    3636AFLAGS += -a32
    3737LDFLAGS += -Wl,--gc-sections
  • uspace/lib/c/arch/ppc32/Makefile.inc

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

    re3272101 rd5a89a3  
    3333 */
    3434
    35 #ifndef LIBC_ppc32_CONFIG_H_
    36 #define LIBC_ppc32_CONFIG_H_
     35#ifndef _LIBC_ppc32_CONFIG_H_
     36#define _LIBC_ppc32_CONFIG_H_
    3737
    3838#define PAGE_WIDTH      12
  • uspace/lib/c/arch/ppc32/include/libarch/ddi.h

    re3272101 rd5a89a3  
    3131 */
    3232
    33 #ifndef LIBC_ppc32_DDI_H_
    34 #define LIBC_ppc32_DDI_H_
     33#ifndef _LIBC_ppc32_DDI_H_
     34#define _LIBC_ppc32_DDI_H_
    3535
    3636#include <ddi.h>
  • uspace/lib/c/arch/ppc32/include/libarch/elf_linux.h

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

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

    re3272101 rd5a89a3  
    3333 */
    3434
    35 #ifndef LIBC_ppc32_FIBRIL_H_
    36 #define LIBC_ppc32_FIBRIL_H_
     35#ifndef _LIBC_ppc32_FIBRIL_H_
     36#define _LIBC_ppc32_FIBRIL_H_
    3737
    3838#include <stdint.h>
  • uspace/lib/c/arch/ppc32/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   0x04
    34 #define CONTEXT_OFFSET_TLS  0x08
    35 #define CONTEXT_OFFSET_R13  0x0c
    36 #define CONTEXT_OFFSET_R14  0x10
    37 #define CONTEXT_OFFSET_R15  0x14
    38 #define CONTEXT_OFFSET_R16  0x18
    39 #define CONTEXT_OFFSET_R17  0x1c
    40 #define CONTEXT_OFFSET_R18  0x20
    41 #define CONTEXT_OFFSET_R19  0x24
    42 #define CONTEXT_OFFSET_R20  0x28
    43 #define CONTEXT_OFFSET_R21  0x2c
    44 #define CONTEXT_OFFSET_R22  0x30
    45 #define CONTEXT_OFFSET_R23  0x34
    46 #define CONTEXT_OFFSET_R24  0x38
    47 #define CONTEXT_OFFSET_R25  0x3c
    48 #define CONTEXT_OFFSET_R26  0x40
    49 #define CONTEXT_OFFSET_R27  0x44
    50 #define CONTEXT_OFFSET_R28  0x48
    51 #define CONTEXT_OFFSET_R29  0x4c
    52 #define CONTEXT_OFFSET_R30  0x50
    53 #define CONTEXT_OFFSET_R31  0x54
    54 #define CONTEXT_OFFSET_CR   0x58
    55 #define CONTEXT_SIZE        0x5c
     32#define __CONTEXT_OFFSET_SP   0x00
     33#define __CONTEXT_OFFSET_PC   0x04
     34#define __CONTEXT_OFFSET_TLS  0x08
     35#define __CONTEXT_OFFSET_R13  0x0c
     36#define __CONTEXT_OFFSET_R14  0x10
     37#define __CONTEXT_OFFSET_R15  0x14
     38#define __CONTEXT_OFFSET_R16  0x18
     39#define __CONTEXT_OFFSET_R17  0x1c
     40#define __CONTEXT_OFFSET_R18  0x20
     41#define __CONTEXT_OFFSET_R19  0x24
     42#define __CONTEXT_OFFSET_R20  0x28
     43#define __CONTEXT_OFFSET_R21  0x2c
     44#define __CONTEXT_OFFSET_R22  0x30
     45#define __CONTEXT_OFFSET_R23  0x34
     46#define __CONTEXT_OFFSET_R24  0x38
     47#define __CONTEXT_OFFSET_R25  0x3c
     48#define __CONTEXT_OFFSET_R26  0x40
     49#define __CONTEXT_OFFSET_R27  0x44
     50#define __CONTEXT_OFFSET_R28  0x48
     51#define __CONTEXT_OFFSET_R29  0x4c
     52#define __CONTEXT_OFFSET_R30  0x50
     53#define __CONTEXT_OFFSET_R31  0x54
     54#define __CONTEXT_OFFSET_CR   0x58
     55#define __CONTEXT_SIZE        0x5c
    5656
    5757#ifndef __ASSEMBLER__
     
    6060#include <stdint.h>
    6161
    62 typedef struct context {
     62typedef struct __context {
    6363        uint32_t sp;
    6464        uint32_t pc;
     
    8484        uint32_t r31;
    8585        uint32_t cr;
    86 } context_t;
     86} __context_t;
    8787
    8888#endif
  • uspace/lib/c/arch/ppc32/include/libarch/regname.h

    re3272101 rd5a89a3  
    3333 */
    3434
    35 #ifndef LIBC_ppc32_REGNAME_H_
    36 #define LIBC_ppc32_REGNAME_H_
     35#ifndef _LIBC_ppc32_REGNAME_H_
     36#define _LIBC_ppc32_REGNAME_H_
    3737
    3838/* Condition Register Bit Fields */
  • uspace/lib/c/arch/ppc32/include/libarch/stackarg.h

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

    re3272101 rd5a89a3  
    3434 */
    3535
    36 #ifndef LIBC_ppc32_SYSCALL_H_
    37 #define LIBC_ppc32_SYSCALL_H_
     36#ifndef _LIBC_ppc32_SYSCALL_H_
     37#define _LIBC_ppc32_SYSCALL_H_
    3838
    3939#define LIBARCH_SYSCALL_GENERIC
  • uspace/lib/c/arch/ppc32/include/libarch/thread.h

    re3272101 rd5a89a3  
    3333 */
    3434
    35 #ifndef LIBC_ppc32_THREAD_H_
    36 #define LIBC_ppc32_THREAD_H_
     35#ifndef _LIBC_ppc32_THREAD_H_
     36#define _LIBC_ppc32_THREAD_H_
    3737
    3838#endif
  • uspace/lib/c/arch/ppc32/include/libarch/tls.h

    re3272101 rd5a89a3  
    3333 */
    3434
    35 #ifndef LIBC_ppc32_TLS_H_
    36 #define LIBC_ppc32_TLS_H_
     35#ifndef _LIBC_ppc32_TLS_H_
     36#define _LIBC_ppc32_TLS_H_
    3737
    3838#define CONFIG_TLS_VARIANT_1
     
    4343
    4444typedef struct {
     45        void **dtv;
     46        void *pad;
    4547        void *fibril_data;
    4648} tcb_t;
  • uspace/lib/c/arch/ppc32/src/fibril.S

    re3272101 rd5a89a3  
    3333#include <libarch/fibril_context.h>
    3434
    35 FUNCTION_BEGIN(__setjmp)
    36         stw sp, CONTEXT_OFFSET_SP(r3)
    37         stw r2, CONTEXT_OFFSET_TLS(r3)
    38         stw r13, CONTEXT_OFFSET_R13(r3)
    39         stw r14, CONTEXT_OFFSET_R14(r3)
    40         stw r15, CONTEXT_OFFSET_R15(r3)
    41         stw r16, CONTEXT_OFFSET_R16(r3)
    42         stw r17, CONTEXT_OFFSET_R17(r3)
    43         stw r18, CONTEXT_OFFSET_R18(r3)
    44         stw r19, CONTEXT_OFFSET_R19(r3)
    45         stw r20, CONTEXT_OFFSET_R20(r3)
    46         stw r21, CONTEXT_OFFSET_R21(r3)
    47         stw r22, CONTEXT_OFFSET_R22(r3)
    48         stw r23, CONTEXT_OFFSET_R23(r3)
    49         stw r24, CONTEXT_OFFSET_R24(r3)
    50         stw r25, CONTEXT_OFFSET_R25(r3)
    51         stw r26, CONTEXT_OFFSET_R26(r3)
    52         stw r27, CONTEXT_OFFSET_R27(r3)
    53         stw r28, CONTEXT_OFFSET_R28(r3)
    54         stw r29, CONTEXT_OFFSET_R29(r3)
    55         stw r30, CONTEXT_OFFSET_R30(r3)
    56         stw r31, CONTEXT_OFFSET_R31(r3)
     35FUNCTION_BEGIN(__context_save)
     36        stw sp, __CONTEXT_OFFSET_SP(r3)
     37        stw r2, __CONTEXT_OFFSET_TLS(r3)
     38        stw r13, __CONTEXT_OFFSET_R13(r3)
     39        stw r14, __CONTEXT_OFFSET_R14(r3)
     40        stw r15, __CONTEXT_OFFSET_R15(r3)
     41        stw r16, __CONTEXT_OFFSET_R16(r3)
     42        stw r17, __CONTEXT_OFFSET_R17(r3)
     43        stw r18, __CONTEXT_OFFSET_R18(r3)
     44        stw r19, __CONTEXT_OFFSET_R19(r3)
     45        stw r20, __CONTEXT_OFFSET_R20(r3)
     46        stw r21, __CONTEXT_OFFSET_R21(r3)
     47        stw r22, __CONTEXT_OFFSET_R22(r3)
     48        stw r23, __CONTEXT_OFFSET_R23(r3)
     49        stw r24, __CONTEXT_OFFSET_R24(r3)
     50        stw r25, __CONTEXT_OFFSET_R25(r3)
     51        stw r26, __CONTEXT_OFFSET_R26(r3)
     52        stw r27, __CONTEXT_OFFSET_R27(r3)
     53        stw r28, __CONTEXT_OFFSET_R28(r3)
     54        stw r29, __CONTEXT_OFFSET_R29(r3)
     55        stw r30, __CONTEXT_OFFSET_R30(r3)
     56        stw r31, __CONTEXT_OFFSET_R31(r3)
    5757
    5858        mflr r4
    59         stw r4, CONTEXT_OFFSET_PC(r3)
     59        stw r4, __CONTEXT_OFFSET_PC(r3)
    6060
    6161        mfcr r4
    62         stw r4, CONTEXT_OFFSET_CR(r3)
     62        stw r4, __CONTEXT_OFFSET_CR(r3)
    6363
    64         # __setjmp returns 0
     64        # __context_save returns 0
    6565        li r3, 0
    6666        blr
    67 FUNCTION_END(__setjmp)
     67FUNCTION_END(__context_save)
    6868
    69 FUNCTION_BEGIN(__longjmp)
    70         lwz sp, CONTEXT_OFFSET_SP(r3)
    71         lwz r2, CONTEXT_OFFSET_TLS(r3)
    72         lwz r13, CONTEXT_OFFSET_R13(r3)
    73         lwz r14, CONTEXT_OFFSET_R14(r3)
    74         lwz r15, CONTEXT_OFFSET_R15(r3)
    75         lwz r16, CONTEXT_OFFSET_R16(r3)
    76         lwz r17, CONTEXT_OFFSET_R17(r3)
    77         lwz r18, CONTEXT_OFFSET_R18(r3)
    78         lwz r19, CONTEXT_OFFSET_R19(r3)
    79         lwz r20, CONTEXT_OFFSET_R20(r3)
    80         lwz r21, CONTEXT_OFFSET_R21(r3)
    81         lwz r22, CONTEXT_OFFSET_R22(r3)
    82         lwz r23, CONTEXT_OFFSET_R23(r3)
    83         lwz r24, CONTEXT_OFFSET_R24(r3)
    84         lwz r25, CONTEXT_OFFSET_R25(r3)
    85         lwz r26, CONTEXT_OFFSET_R26(r3)
    86         lwz r27, CONTEXT_OFFSET_R27(r3)
    87         lwz r28, CONTEXT_OFFSET_R28(r3)
    88         lwz r29, CONTEXT_OFFSET_R29(r3)
    89         lwz r30, CONTEXT_OFFSET_R30(r3)
    90         lwz r31, CONTEXT_OFFSET_R31(r3)
     69FUNCTION_BEGIN(__context_restore)
     70        lwz sp, __CONTEXT_OFFSET_SP(r3)
     71        lwz r2, __CONTEXT_OFFSET_TLS(r3)
     72        lwz r13, __CONTEXT_OFFSET_R13(r3)
     73        lwz r14, __CONTEXT_OFFSET_R14(r3)
     74        lwz r15, __CONTEXT_OFFSET_R15(r3)
     75        lwz r16, __CONTEXT_OFFSET_R16(r3)
     76        lwz r17, __CONTEXT_OFFSET_R17(r3)
     77        lwz r18, __CONTEXT_OFFSET_R18(r3)
     78        lwz r19, __CONTEXT_OFFSET_R19(r3)
     79        lwz r20, __CONTEXT_OFFSET_R20(r3)
     80        lwz r21, __CONTEXT_OFFSET_R21(r3)
     81        lwz r22, __CONTEXT_OFFSET_R22(r3)
     82        lwz r23, __CONTEXT_OFFSET_R23(r3)
     83        lwz r24, __CONTEXT_OFFSET_R24(r3)
     84        lwz r25, __CONTEXT_OFFSET_R25(r3)
     85        lwz r26, __CONTEXT_OFFSET_R26(r3)
     86        lwz r27, __CONTEXT_OFFSET_R27(r3)
     87        lwz r28, __CONTEXT_OFFSET_R28(r3)
     88        lwz r29, __CONTEXT_OFFSET_R29(r3)
     89        lwz r30, __CONTEXT_OFFSET_R30(r3)
     90        lwz r31, __CONTEXT_OFFSET_R31(r3)
    9191
    92         lwz r5, CONTEXT_OFFSET_CR(r3)
     92        lwz r5, __CONTEXT_OFFSET_CR(r3)
    9393        mtcr r5
    9494
    95         lwz r5, CONTEXT_OFFSET_PC(r3)
     95        lwz r5, __CONTEXT_OFFSET_PC(r3)
    9696        mtlr r5
    9797
    98         # __longjmp returns second argument
     98        # __context_restore returns second argument
    9999        mr r3, r4
    100100        blr
    101 FUNCTION_END(__longjmp)
     101FUNCTION_END(__context_restore)
  • uspace/lib/c/arch/ppc32/src/syscall.c

    re3272101 rd5a89a3  
    5858              "r" (__ppc32_reg_r8),
    5959              "r" (__ppc32_reg_r9)
     60            :
     61              /*
     62               * Clobber memory too as some arguments might be
     63               * actually pointers.
     64               */
     65              "memory"
    6066        );
    6167
  • uspace/lib/c/arch/ppc32/src/tls.c

    re3272101 rd5a89a3  
    11/*
     2 * Copyright (c) 2019 Jiri Svoboda
    23 * Copyright (c) 2006 Ondrej Palkovsky
    34 * All rights reserved.
     
    3637#include <stddef.h>
    3738
     39#ifdef CONFIG_RTLD
     40#include <rtld/rtld.h>
     41#endif
     42
    3843tcb_t *tls_alloc_arch(size_t size, size_t align)
    3944{
     
    4651}
    4752
     53/*
     54 * Rtld TLS support
     55 */
     56
     57typedef struct {
     58        unsigned long int ti_module;
     59        unsigned long int ti_offset;
     60} tls_index;
     61
     62int __tls_debug = 0;
     63
     64void *__tls_get_addr(tls_index *ti);
     65
     66void *__tls_get_addr(tls_index *ti)
     67{
     68        uint8_t *tls;
     69
     70#ifdef CONFIG_RTLD
     71        if (runtime_env != NULL) {
     72                return rtld_tls_get_addr(runtime_env, __tcb_get(),
     73                    ti->ti_module, ti->ti_offset) + 0x8000;
     74        }
     75#endif
     76        /* Get address of static TLS block */
     77        tls = tls_get();
     78        return tls + ti->ti_offset + 0x8000;
     79}
     80
    4881/** @}
    4982 */
  • uspace/lib/c/arch/riscv64/include/libarch/config.h

    re3272101 rd5a89a3  
    3333 */
    3434
    35 #ifndef LIBC_riscv64_CONFIG_H_
    36 #define LIBC_riscv64_CONFIG_H_
     35#ifndef _LIBC_riscv64_CONFIG_H_
     36#define _LIBC_riscv64_CONFIG_H_
    3737
    3838#define PAGE_WIDTH  12
  • uspace/lib/c/arch/riscv64/include/libarch/ddi.h

    re3272101 rd5a89a3  
    3030 */
    3131
    32 #ifndef LIBC_riscv64_DDI_H_
    33 #define LIBC_riscv64_DDI_H_
     32#ifndef _LIBC_riscv64_DDI_H_
     33#define _LIBC_riscv64_DDI_H_
    3434
    3535#include <ddi.h>
  • uspace/lib/c/arch/riscv64/include/libarch/elf_linux.h

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

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

    re3272101 rd5a89a3  
    3333 */
    3434
    35 #ifndef LIBC_riscv64_FIBRIL_H_
    36 #define LIBC_riscv64_FIBRIL_H_
     35#ifndef _LIBC_riscv64_FIBRIL_H_
     36#define _LIBC_riscv64_FIBRIL_H_
    3737
    3838#include <stdint.h>
  • uspace/lib/c/arch/riscv64/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_ZERO 0x10
    35 #define CONTEXT_OFFSET_RA   0x18
    36 #define CONTEXT_OFFSET_X3   0x20
    37 #define CONTEXT_OFFSET_X4   0x28
    38 #define CONTEXT_OFFSET_X5   0x30
    39 #define CONTEXT_OFFSET_X6   0x38
    40 #define CONTEXT_OFFSET_X7   0x40
    41 #define CONTEXT_OFFSET_X8   0x48
    42 #define CONTEXT_OFFSET_X9   0x50
    43 #define CONTEXT_OFFSET_X10  0x58
    44 #define CONTEXT_OFFSET_X11  0x60
    45 #define CONTEXT_OFFSET_X12  0x68
    46 #define CONTEXT_OFFSET_X13  0x70
    47 #define CONTEXT_OFFSET_X14  0x78
    48 #define CONTEXT_OFFSET_X15  0x80
    49 #define CONTEXT_OFFSET_X16  0x88
    50 #define CONTEXT_OFFSET_X17  0x90
    51 #define CONTEXT_OFFSET_X18  0x98
    52 #define CONTEXT_OFFSET_X19  0xa0
    53 #define CONTEXT_OFFSET_X20  0xa8
    54 #define CONTEXT_OFFSET_X21  0xb0
    55 #define CONTEXT_OFFSET_X22  0xb8
    56 #define CONTEXT_OFFSET_X23  0xc0
    57 #define CONTEXT_OFFSET_X24  0xc8
    58 #define CONTEXT_OFFSET_X25  0xd0
    59 #define CONTEXT_OFFSET_X26  0xd8
    60 #define CONTEXT_OFFSET_X27  0xe0
    61 #define CONTEXT_OFFSET_X28  0xe8
    62 #define CONTEXT_OFFSET_X29  0xf0
    63 #define CONTEXT_OFFSET_X30  0xf8
    64 #define CONTEXT_OFFSET_X31  0x100
    65 #define CONTEXT_SIZE        0x108
     32#define __CONTEXT_OFFSET_SP   0x00
     33#define __CONTEXT_OFFSET_PC   0x08
     34#define __CONTEXT_OFFSET_ZERO 0x10
     35#define __CONTEXT_OFFSET_RA   0x18
     36#define __CONTEXT_OFFSET_X3   0x20
     37#define __CONTEXT_OFFSET_X4   0x28
     38#define __CONTEXT_OFFSET_X5   0x30
     39#define __CONTEXT_OFFSET_X6   0x38
     40#define __CONTEXT_OFFSET_X7   0x40
     41#define __CONTEXT_OFFSET_X8   0x48
     42#define __CONTEXT_OFFSET_X9   0x50
     43#define __CONTEXT_OFFSET_X10  0x58
     44#define __CONTEXT_OFFSET_X11  0x60
     45#define __CONTEXT_OFFSET_X12  0x68
     46#define __CONTEXT_OFFSET_X13  0x70
     47#define __CONTEXT_OFFSET_X14  0x78
     48#define __CONTEXT_OFFSET_X15  0x80
     49#define __CONTEXT_OFFSET_X16  0x88
     50#define __CONTEXT_OFFSET_X17  0x90
     51#define __CONTEXT_OFFSET_X18  0x98
     52#define __CONTEXT_OFFSET_X19  0xa0
     53#define __CONTEXT_OFFSET_X20  0xa8
     54#define __CONTEXT_OFFSET_X21  0xb0
     55#define __CONTEXT_OFFSET_X22  0xb8
     56#define __CONTEXT_OFFSET_X23  0xc0
     57#define __CONTEXT_OFFSET_X24  0xc8
     58#define __CONTEXT_OFFSET_X25  0xd0
     59#define __CONTEXT_OFFSET_X26  0xd8
     60#define __CONTEXT_OFFSET_X27  0xe0
     61#define __CONTEXT_OFFSET_X28  0xe8
     62#define __CONTEXT_OFFSET_X29  0xf0
     63#define __CONTEXT_OFFSET_X30  0xf8
     64#define __CONTEXT_OFFSET_X31  0x100
     65#define __CONTEXT_SIZE        0x108
    6666
    6767#ifndef __ASSEMBLER__
     
    7575 */
    7676
    77 typedef struct context {
     77typedef struct __context {
    7878        uint64_t sp;
    7979        uint64_t pc;
     
    109109        uint64_t x30;
    110110        uint64_t x31;
    111 } context_t;
     111} __context_t;
    112112
    113113#endif
  • uspace/lib/c/arch/riscv64/include/libarch/syscall.h

    re3272101 rd5a89a3  
    3434 */
    3535
    36 #ifndef LIBC_riscv64_SYSCALL_H_
    37 #define LIBC_riscv64_SYSCALL_H_
     36#ifndef _LIBC_riscv64_SYSCALL_H_
     37#define _LIBC_riscv64_SYSCALL_H_
    3838
    3939#include <stdint.h>
  • uspace/lib/c/arch/riscv64/include/libarch/thread.h

    re3272101 rd5a89a3  
    3333 */
    3434
    35 #ifndef LIBC_riscv64_THREAD_H_
    36 #define LIBC_riscv64_THREAD_H_
     35#ifndef _LIBC_riscv64_THREAD_H_
     36#define _LIBC_riscv64_THREAD_H_
    3737
    3838#endif
  • uspace/lib/c/arch/riscv64/include/libarch/tls.h

    re3272101 rd5a89a3  
    3333 */
    3434
    35 #ifndef LIBC_riscv64_TLS_H_
    36 #define LIBC_riscv64_TLS_H_
     35#ifndef _LIBC_riscv64_TLS_H_
     36#define _LIBC_riscv64_TLS_H_
    3737
    3838#define CONFIG_TLS_VARIANT_2
  • uspace/lib/c/arch/riscv64/src/fibril.c

    re3272101 rd5a89a3  
    3333#include <stdbool.h>
    3434
    35 int __setjmp(context_t *ctx)
     35int __context_save(__context_t *ctx)
    3636{
    3737        return 0;
    3838}
    3939
    40 void __longjmp(context_t *ctx, int ret)
     40void __context_restore(__context_t *ctx, int ret)
    4141{
    4242        while (true)
  • 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.