Jeenu Viswambharan | 2de8153 | 2018-02-16 11:54:24 +0000 | [diff] [blame] | 1 | /* |
Antonio Nino Diaz | 4586d1c | 2019-02-08 13:10:45 +0000 | [diff] [blame^] | 2 | * Copyright (c) 2018-2019, ARM Limited and Contributors. All rights reserved. |
Jeenu Viswambharan | 2de8153 | 2018-02-16 11:54:24 +0000 | [diff] [blame] | 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
| 6 | |
Antonio Nino Diaz | 5eb8837 | 2018-11-08 10:20:19 +0000 | [diff] [blame] | 7 | #ifndef SETJMP_H |
| 8 | #define SETJMP_H |
Jeenu Viswambharan | 2de8153 | 2018-02-16 11:54:24 +0000 | [diff] [blame] | 9 | |
| 10 | #define JMP_CTX_X19 0x0 |
| 11 | #define JMP_CTX_X21 0x10 |
| 12 | #define JMP_CTX_X23 0x20 |
| 13 | #define JMP_CTX_X25 0x30 |
| 14 | #define JMP_CTX_X27 0x40 |
| 15 | #define JMP_CTX_X29 0x50 |
| 16 | #define JMP_CTX_SP 0x60 |
Antonio Nino Diaz | 4586d1c | 2019-02-08 13:10:45 +0000 | [diff] [blame^] | 17 | #define JMP_CTX_END 0x70 /* Aligned to 16 bytes */ |
Jeenu Viswambharan | 2de8153 | 2018-02-16 11:54:24 +0000 | [diff] [blame] | 18 | |
| 19 | #define JMP_SIZE (JMP_CTX_END >> 3) |
| 20 | |
| 21 | #ifndef __ASSEMBLY__ |
| 22 | |
Antonio Nino Diaz | 4586d1c | 2019-02-08 13:10:45 +0000 | [diff] [blame^] | 23 | #include <cdefs.h> |
Jeenu Viswambharan | 2de8153 | 2018-02-16 11:54:24 +0000 | [diff] [blame] | 24 | #include <stdint.h> |
| 25 | |
| 26 | /* Jump buffer hosting x18 - x30 and sp_el0 registers */ |
Antonio Nino Diaz | 4586d1c | 2019-02-08 13:10:45 +0000 | [diff] [blame^] | 27 | typedef uint64_t jmp_buf[JMP_SIZE] __aligned(16); |
Jeenu Viswambharan | 2de8153 | 2018-02-16 11:54:24 +0000 | [diff] [blame] | 28 | |
Antonio Nino Diaz | 4586d1c | 2019-02-08 13:10:45 +0000 | [diff] [blame^] | 29 | int setjmp(jmp_buf env); |
| 30 | __dead2 void longjmp(jmp_buf env, int val); |
Jeenu Viswambharan | 2de8153 | 2018-02-16 11:54:24 +0000 | [diff] [blame] | 31 | |
| 32 | #endif /* __ASSEMBLY__ */ |
Antonio Nino Diaz | 5eb8837 | 2018-11-08 10:20:19 +0000 | [diff] [blame] | 33 | #endif /* SETJMP_H */ |