Changeset 55f068c in mainline


Ignore:
Timestamp:
2018-03-11T17:15:15Z (7 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Children:
12ae6d8
Parents:
615e83d
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-03-11 17:07:39)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-03-11 17:15:15)
Message:

Rename setjmp function to setjmp, use _Noreturn instead of attribute((noreturn)), minor comment changes.

Renaming for consistency with longjmp, and to better express that the implementation
of
setjmp has additional properties not defined by the C standard.

Location:
uspace/lib/c
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/arch/abs32le/src/fibril.c

    r615e83d r55f068c  
    3333#include <stdbool.h>
    3434
    35 int setjmp(context_t *ctx)
     35int __setjmp(context_t *ctx)
    3636{
    3737        return 0;
  • uspace/lib/c/arch/amd64/src/fibril.S

    r615e83d r55f068c  
    3535#
    3636# Save CPU context to context_t variable
    37 # pointed by the 1st argument. Returns 0 in EAX.
     37# pointed by the 1st argument. Returns 0 in RAX.
    3838#
    39 FUNCTION_BEGIN(setjmp)
     39FUNCTION_BEGIN(__setjmp)
    4040        movq (%rsp), %rdx     # the caller's return %eip
    4141
     
    5454        movq %rax, CONTEXT_OFFSET_TLS(%rdi)
    5555
    56         xorq %rax, %rax                      # setjmp returns 0
     56        xorq %rax, %rax                      # __setjmp returns 0
    5757        ret
    58 FUNCTION_END(setjmp)
     58FUNCTION_END(__setjmp)
    5959
    6060## Restore current CPU context
    6161#
    6262# Restore CPU context from context_t variable
    63 # pointed by the 1st argument. Returns RSI in EAX.
     63# pointed by the 1st argument. Returns second argument in RAX.
    6464#
    6565FUNCTION_BEGIN(__longjmp)
  • uspace/lib/c/arch/arm32/src/fibril.S

    r615e83d r55f068c  
    3131.text
    3232
    33 FUNCTION_BEGIN(setjmp)
     33FUNCTION_BEGIN(__setjmp)
    3434        stmia r0!, {sp, lr}
    3535        stmia r0!, {r4-r11}
     
    3838        mov r0, #0
    3939        mov pc, lr
    40 FUNCTION_END(setjmp)
     40FUNCTION_END(__setjmp)
    4141
    4242FUNCTION_BEGIN(__longjmp)
  • uspace/lib/c/arch/ia32/src/fibril.S

    r615e83d r55f068c  
    3737# pointed by the 1st argument. Returns 0 in EAX.
    3838#
    39 FUNCTION_BEGIN(setjmp)
     39FUNCTION_BEGIN(__setjmp)
    4040        movl 0(%esp), %eax  # the caller's return %eip
    4141        movl 4(%esp), %edx  # address of the context variable to save context to
     
    5353        movl %eax, CONTEXT_OFFSET_TLS(%edx)     # tls -> ctx->tls
    5454
    55         xorl %eax, %eax         # setjmp returns 0
     55        xorl %eax, %eax         # __setjmp returns 0
    5656        ret
    57 FUNCTION_END(setjmp)
     57FUNCTION_END(__setjmp)
    5858
    5959## Restore saved CPU context
  • uspace/lib/c/arch/ia64/include/libarch/fibril.h

    r615e83d r55f068c  
    4343
    4444/*
    45  * setjmp() and __longjmp() are both leaf procedures.
     45 * __setjmp() and __longjmp() are both leaf procedures.
    4646 * No need to allocate scratch area.
    4747 */
  • uspace/lib/c/arch/ia64/src/fibril.S

    r615e83d r55f068c  
    3232.text
    3333
    34 FUNCTION_BEGIN(setjmp)
     34FUNCTION_BEGIN(__setjmp)
    3535        alloc loc0 = ar.pfs, 1, 49, 0, 0
    3636        mov loc1 = ar.unat ;;
     
    178178        mov ar.unat = loc1
    179179
    180         mov r8 = 0      /* setjmp returns 0 */
     180        mov r8 = 0      /* __setjmp returns 0 */
    181181        br.ret.sptk.many b0
    182 FUNCTION_END(setjmp)
     182FUNCTION_END(__setjmp)
    183183
    184184FUNCTION_BEGIN(__longjmp)
  • uspace/lib/c/arch/mips32/src/fibril.S

    r615e83d r55f068c  
    3535#include <libarch/fibril_context.h>
    3636
    37 FUNCTION_BEGIN(setjmp)
     37FUNCTION_BEGIN(__setjmp)
    3838        sw $s0, CONTEXT_OFFSET_S0($a0)
    3939        sw $s1, CONTEXT_OFFSET_S1($a0)
     
    8787        sw $sp, CONTEXT_OFFSET_SP($a0)
    8888
    89         # setjmp returns 0
     89        # __setjmp returns 0
    9090        j $ra
    9191        li $v0, 0
    92 FUNCTION_END(setjmp)
     92FUNCTION_END(__setjmp)
    9393
    9494FUNCTION_BEGIN(__longjmp)
  • uspace/lib/c/arch/ppc32/src/fibril.S

    r615e83d r55f068c  
    3333#include <libarch/fibril_context.h>
    3434
    35 FUNCTION_BEGIN(setjmp)
     35FUNCTION_BEGIN(__setjmp)
    3636        stw sp, CONTEXT_OFFSET_SP(r3)
    3737        stw r2, CONTEXT_OFFSET_TLS(r3)
     
    6262        stw r4, CONTEXT_OFFSET_CR(r3)
    6363
    64         # setjmp returns 0
     64        # __setjmp returns 0
    6565        li r3, 0
    6666        blr
    67 FUNCTION_END(setjmp)
     67FUNCTION_END(__setjmp)
    6868
    6969FUNCTION_BEGIN(__longjmp)
  • uspace/lib/c/arch/riscv64/src/fibril.c

    r615e83d r55f068c  
    3333#include <stdbool.h>
    3434
    35 int setjmp(context_t *ctx)
     35int __setjmp(context_t *ctx)
    3636{
    3737        return 0;
  • uspace/lib/c/arch/sparc64/src/fibril.S

    r615e83d r55f068c  
    3232.text
    3333
    34 FUNCTION_BEGIN(setjmp)
     34FUNCTION_BEGIN(__setjmp)
    3535        #
    3636        # We rely on the kernel to flush our active register windows to memory
     
    5757        stx %g7, [%o0 + CONTEXT_OFFSET_TP]
    5858        retl
    59         mov 0, %o0              ! setjmp returns 0
    60 FUNCTION_END(setjmp)
     59        mov 0, %o0              ! __setjmp returns 0
     60FUNCTION_END(__setjmp)
    6161
    6262FUNCTION_BEGIN(__longjmp)
  • uspace/lib/c/generic/context.c

    r615e83d r55f068c  
    4343void context_swap(context_t *self, context_t *other)
    4444{
    45         if (!setjmp(self))
     45        if (!__setjmp(self))
    4646                __longjmp(other, 1);
    4747}
     
    4949void context_create(context_t *context, const context_create_t *arg)
    5050{
    51         setjmp(context);
     51        __setjmp(context);
    5252        context_set(context, FADDR(arg->fn), arg->stack_base,
    5353            arg->stack_size, arg->tls);
  • uspace/lib/c/include/setjmp.h

    r615e83d r55f068c  
    3838typedef context_t jmp_buf[1];
    3939
    40 extern int setjmp(jmp_buf) __attribute__((returns_twice));
    41 extern void longjmp(jmp_buf, int) __attribute__((noreturn));
    42 extern void __longjmp(jmp_buf, int) __attribute__((noreturn));
     40extern int __setjmp(jmp_buf) __attribute__((returns_twice));
     41extern _Noreturn void __longjmp(jmp_buf, int);
     42
     43#define setjmp __setjmp
     44extern _Noreturn void longjmp(jmp_buf, int);
    4345
    4446#endif
Note: See TracChangeset for help on using the changeset viewer.