aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAntonio Nino Diaz <antonio.ninodiaz@arm.com>2019-02-08 13:10:45 +0000
committerAntonio Nino Diaz <antonio.ninodiaz@arm.com>2019-02-08 13:42:38 +0000
commite05663051671bdec38056a2da5ddebd390b4abca (patch)
tree3371718c3add99e403f96db4e19fbed348ff26f2 /include
parent30490b15fef50900acac0f23a528651c24759e7d (diff)
downloadtrusted-firmware-a-e05663051671bdec38056a2da5ddebd390b4abca.tar.gz
Make setjmp.h prototypes comply with the C standard
Instead of having a custom implementation of setjmp() and longjmp() it is better to follow the C standard. The comments in setjmp.h are no longer needed as there are no deviations from the expected one, so they have been removed. All SDEI code that relied on them has been fixed to use the new function prototypes and structs. Change-Id: I6cd2e21cb5a5bcf81ba12283f2e4c067bd5172ca Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
Diffstat (limited to 'include')
-rw-r--r--include/arch/aarch64/setjmp.h38
1 files changed, 6 insertions, 32 deletions
diff --git a/include/arch/aarch64/setjmp.h b/include/arch/aarch64/setjmp.h
index bbfe1df434..f7991fddbd 100644
--- a/include/arch/aarch64/setjmp.h
+++ b/include/arch/aarch64/setjmp.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2018-2019, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -14,46 +14,20 @@
#define JMP_CTX_X27 0x40
#define JMP_CTX_X29 0x50
#define JMP_CTX_SP 0x60
-#define JMP_CTX_END 0x70
+#define JMP_CTX_END 0x70 /* Aligned to 16 bytes */
#define JMP_SIZE (JMP_CTX_END >> 3)
#ifndef __ASSEMBLY__
+#include <cdefs.h>
#include <stdint.h>
/* Jump buffer hosting x18 - x30 and sp_el0 registers */
-struct jmpbuf {
- uint64_t buf[JMP_SIZE];
-} __aligned(16);
+typedef uint64_t jmp_buf[JMP_SIZE] __aligned(16);
-
-/*
- * Set a jump point, and populate the jump buffer with context information so
- * that longjmp() can jump later. The caller must adhere to the following
- * conditions:
- *
- * - After calling this function, the stack must not be shrunk. The contents of
- * the stack must not be changed either.
- *
- * - If the caller were to 'return', the buffer must be considered invalid, and
- * must not be used with longjmp().
- *
- * The caller will observe this function returning at two distinct
- * circumstances, each with different return values:
- *
- * - Zero, when the buffer is setup;
- *
- * - Non-zero, when a call to longjmp() is made (presumably by one of the
- * callee functions) with the same jump buffer.
- */
-int setjmp(struct jmpbuf *buf);
-
-/*
- * Reset execution to a jump point, and restore context information according to
- * the jump buffer populated by setjmp().
- */
-void longjmp(struct jmpbuf *buf);
+int setjmp(jmp_buf env);
+__dead2 void longjmp(jmp_buf env, int val);
#endif /* __ASSEMBLY__ */
#endif /* SETJMP_H */