diff options
author | Bart Kuivenhoven <bemk@redhat.com> | 2013-10-10 13:43:30 +0200 |
---|---|---|
committer | Bart Kuivenhoven <bemk@redhat.com> | 2013-10-10 13:51:46 +0200 |
commit | 35959b0c4fdf76260c72515fa764a19c78d7d192 (patch) | |
tree | 0881facef7638528fc04114f34b39a30be58760d | |
parent | 13bb545e74116756af96d66f53b0a33d55381ac9 (diff) | |
download | gnu-efi-3.0-35959b0c4fdf76260c72515fa764a19c78d7d192.tar.gz gnu-efi-3.0-35959b0c4fdf76260c72515fa764a19c78d7d192.tar.xz gnu-efi-3.0-35959b0c4fdf76260c72515fa764a19c78d7d192.zip |
aarch64: Steal setjmp and longjmp from glibc
These functions have been slightly modified, in that they don't include
the right information for GDB anymore.
I haven't taken the time to investigate in what GDB requires these
functions to do, but assume. If you want to debug this using GDB, good
luck.
Signed-off-by: Bart Kuivenhoven <bemk@redhat.com>
-rw-r--r-- | gnu-efi-3.0/gnuefi/setjmp_aarch64.S | 70 |
1 files changed, 67 insertions, 3 deletions
diff --git a/gnu-efi-3.0/gnuefi/setjmp_aarch64.S b/gnu-efi-3.0/gnuefi/setjmp_aarch64.S index ffe24e2..b722023 100644 --- a/gnu-efi-3.0/gnuefi/setjmp_aarch64.S +++ b/gnu-efi-3.0/gnuefi/setjmp_aarch64.S @@ -1,5 +1,69 @@ -/* A stub to keep the compiler happy! */ - /* - * TODO: Port this file + * This code has been nicked from glibc (GNU-LGPL v2.1 or newer) + * Code modified by Bart Kuivenhoven <bemk@redhat.com> - Red Hat - 2013 */ + +#define EXT_C(sym) sym +#define FUNCTION(x) .globl EXT_C(x) ; .type EXT_C(x), @function ; EXT_C(x): + +#define JB_X19 0x00 +#define JB_X20 0x01 +#define JB_X21 0x02 +#define JB_X22 0x03 +#define JB_X23 0x04 +#define JB_X24 0x05 +#define JB_X25 0x06 +#define JB_X26 0x07 +#define JB_X27 0x08 +#define JB_X28 0x09 +#define JB_X29 0x0A +#define JB_X30 0x0B + +#define JB_D8 0x0C +#define JB_D9 0x0D +#define JB_D10 0x0E +#define JB_D11 0x0F +#define JB_D12 0x10 +#define JB_D13 0x11 +#define JB_D14 0x12 +#define JB_D15 0x13 + +#define JB_SP 0x14 + +FUNCTION(setjmp) + stp x19, x20, [x0, #JB_X19<<3] + stp x21, x22, [x0, #JB_X21<<3] + stp x23, x24, [x0, #JB_X23<<3] + stp x25, x26, [x0, #JB_X25<<3] + stp x27, x28, [x0, #JB_X27<<3] + stp x29, x30, [x0, #JB_X29<<3] + stp d8, d9, [x0, #JB_D8<<3] + stp d10, d11, [x0, #JB_D10<<3] + stp d12, d13, [x0, #JB_D12<<3] + stp d14, d15, [x0, #JB_D14<<3] + mov x2, sp + str x2, [x0, #JB_SP<<3] + + mov w0, #0 + RET + +FUNCTION(longjmp) + ldp x19, x20, [x0, #JB_X19<<3] + ldp x21, x22, [x0, #JB_X21<<3] + ldp x23, x24, [x0, #JB_X23<<3] + ldp x25, x26, [x0, #JB_X25<<3] + ldp x27, x28, [x0, #JB_X27<<3] + ldp x29, x30, [x0, #JB_X29<<3] + + ldp d8, d9, [x0, #JB_D8<<3] + ldp d10, d11, [x0, #JB_D10<<3] + ldp d12, d13, [x0, #JB_D12<<3] + ldp d14, d15, [x0, #JB_D14<<3] + + ldr x5, [x0, #JB_SP<<3] + mov sp, x5 + cmp x1, #0 + mov x0, #1 + csel x0, x1, x0, ne + /* Use br instead of ret because ret is guaranteed to mispredict */ + br x30 |