Changeset 615e83d in mainline for uspace/lib/c/arch/amd64/src/fibril.S


Ignore:
Timestamp:
2018-03-08T18:25:31Z (7 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Children:
55f068c
Parents:
e0a4686
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-03-08 17:43:06)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-03-08 18:25:31)
Message:

Turn context_save/context_restore into standard setjmp/longjmp.

File:
1 edited

Legend:

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

    re0a4686 r615e83d  
    3535#
    3636# Save CPU context to context_t variable
    37 # pointed by the 1st argument. Returns 1 in EAX.
     37# pointed by the 1st argument. Returns 0 in EAX.
    3838#
    39 FUNCTION_BEGIN(context_save)
     39FUNCTION_BEGIN(setjmp)
    4040        movq (%rsp), %rdx     # the caller's return %eip
    4141
     
    5454        movq %rax, CONTEXT_OFFSET_TLS(%rdi)
    5555
    56         xorl %eax, %eax                      # context_save returns 1
    57         incl %eax
     56        xorq %rax, %rax                      # setjmp returns 0
    5857        ret
    59 FUNCTION_END(context_save)
     58FUNCTION_END(setjmp)
    6059
    6160## Restore current CPU context
    6261#
    6362# Restore CPU context from context_t variable
    64 # pointed by the 1st argument. Returns 0 in EAX.
     63# pointed by the 1st argument. Returns RSI in EAX.
    6564#
    66 FUNCTION_BEGIN(context_restore)
     65FUNCTION_BEGIN(__longjmp)
    6766        movq CONTEXT_OFFSET_R15(%rdi), %r15
    6867        movq CONTEXT_OFFSET_R14(%rdi), %r14
     
    8180        movq %rdi, %fs:0
    8281
    83         xorl %eax, %eax                      # context_restore returns 0
     82        movq %rsi, %rax                      # __longjmp returns second argument
    8483        ret
    85 FUNCTION_END(context_restore)
     84FUNCTION_END(__longjmp)
    8685
Note: See TracChangeset for help on using the changeset viewer.