Skip to content

Commit

Permalink
Updated the red zone offset to be ABI-compatible and made a more info…
Browse files Browse the repository at this point in the history
…rmative comment.
  • Loading branch information
deeglaze committed Mar 2, 2018
1 parent 05fac37 commit 9319ac1
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions sdk/trts/linux/trts_pic.S
Original file line number Diff line number Diff line change
Expand Up @@ -584,13 +584,14 @@ DECLARE_LOCAL_FUNC continue_execution

# do not setup the new stack until info is not needed any more
# otherwise, info will be overwritten
# Offset some amount up the stack, to avoid stomping on values in use at the
# time of the exception.
mov %xcx, -64(%xax) # save xip to the new stack
# Offset the stack to avoid the red zone, which interrupts are allowed to
# write into. Using the __attribute__((interrupt)) on internal_handle_exception
# is hostile to older compilers.
mov %xcx, -128(%xax) # save xip to the new stack
pop %xcx # restore xcx
pop %xsp # xsp: xax
xchg %xax, %xsp

# The desired xip was stashed further up in the stack; retrieve it and jump
# there to resume execution.
jmp *-64(%xsp)
jmp *-128(%xsp)

0 comments on commit 9319ac1

Please sign in to comment.