Make setjmp.h prototypes comply with the C standard
[project/bcm63xx/atf.git] / lib / aarch64 / setjmp.S
index 9060cb7569fb412050628e9f0ad6062af4b08784..9d9eb49ba445ebb6a45482865917f323d59fe25c 100644 (file)
@@ -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
  */
        .globl  longjmp
 
 /*
- * int setjmp(struct jmpbuf *buf);
- *
- * Sets a jump point in the buffer specified in x0. Returns 0 to the caller when
- * when setting up the jump, and 1 when returning from the jump.
+ * int setjmp(jmp_buf env);
  */
 func setjmp
        mov     x7, sp
@@ -34,9 +31,7 @@ endfunc setjmp
 
 
 /*
- * void longjmp(struct jmpbuf *buf);
- *
- * Return to a jump point setup by setjmp()
+ * void longjmp(jmp_buf env, int val);
  */
 func longjmp
        ldp     x7, xzr, [x0, #JMP_CTX_SP]
@@ -60,6 +55,7 @@ func longjmp
 
        mov     sp, x7
 
-       mov     x0, #1
+       ands    x0, x1, x1 /* Move val to x0 and set flags */
+       cinc    x0, x0, eq /* If val is 0, return 1 */
        ret
 endfunc longjmp