-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bring back the old implementation of setjmp() for aarch64.
It looks like we can't really do without these functions. There are too many ports that for some reason want to make use of them. As Clang doesn't implement these functions only for AArch64, let that one use the original version written in assembly.
- Loading branch information
1 parent
df5d09f
commit ef8a62e
Showing
7 changed files
with
115 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// Copyright (c) 2015-2017 Nuxi, https://nuxi.nl/ | ||
// | ||
// SPDX-License-Identifier: BSD-2-Clause | ||
|
||
#include <common/assembly.h> | ||
|
||
#ifdef __aarch64__ | ||
|
||
ENTRY(longjmp) | ||
ALTENTRY(siglongjmp) | ||
// Restore callee-saved registers. | ||
ldp x19, x20, [x0, #0] | ||
ldp x21, x22, [x0, #16] | ||
ldp x23, x24, [x0, #32] | ||
ldp x25, x26, [x0, #48] | ||
ldp x27, x28, [x0, #64] | ||
|
||
// Restore frame pointer and link register. | ||
ldp x29, x30, [x0, #80] | ||
|
||
// Restore stack pointer. | ||
ldr x2, [x0, #96] | ||
mov sp, x2 | ||
|
||
// Restore VFP registers. | ||
ldp d8, d9, [x0, #104] | ||
ldp d10, d11, [x0, #120] | ||
ldp d12, d13, [x0, #136] | ||
ldp d14, d15, [x0, #152] | ||
|
||
// Return the second parameter of longjmp(), ensuring that we never | ||
// return zero. | ||
mov x0, x1 | ||
cbnz x0, 1f | ||
mov x0, #1 | ||
1: | ||
br x30 | ||
END(longjmp) | ||
END(siglongjmp) | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Copyright (c) 2015-2017 Nuxi, https://nuxi.nl/ | ||
// | ||
// SPDX-License-Identifier: BSD-2-Clause | ||
|
||
#include <common/assembly.h> | ||
|
||
#ifdef __aarch64__ | ||
|
||
ENTRY(__setjmp) | ||
// Save callee-saved registers. | ||
stp x19, x20, [x0, #0] | ||
stp x21, x22, [x0, #16] | ||
stp x23, x24, [x0, #32] | ||
stp x25, x26, [x0, #48] | ||
stp x27, x28, [x0, #64] | ||
|
||
// Save frame pointer and link register. | ||
stp x29, x30, [x0, #80] | ||
|
||
// Save stack pointer. | ||
mov x1, sp | ||
str x1, [x0, #96] | ||
|
||
// Save VFP registers. | ||
stp d8, d9, [x0, #104] | ||
stp d10, d11, [x0, #120] | ||
stp d12, d13, [x0, #136] | ||
stp d14, d15, [x0, #152] | ||
|
||
// Return zero for a direct invocation. | ||
mov x0, #0 | ||
ret | ||
END(setjmp) | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters