mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-11 02:13:56 +09:00
LibC: Implement _setjmp and _longjmp
These are aliases to `setjmp()` and `longjmp()` on our system, as our implementations don't modify the signal mask. This is required for the syzkaller executor process.
This commit is contained in:
parent
eefe471dce
commit
49749e279a
Notes:
sideshowbarker
2024-07-17 23:07:41 +09:00
Author: https://github.com/bgianfo
Commit: 49749e279a
Pull-request: https://github.com/SerenityOS/serenity/pull/11392
Reviewed-by: https://github.com/IdanHo ✅
2 changed files with 16 additions and 0 deletions
|
@ -14,7 +14,9 @@
|
||||||
mov (%esp), %ebx
|
mov (%esp), %ebx
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
.global _setjmp
|
||||||
.global setjmp
|
.global setjmp
|
||||||
|
_setjmp:
|
||||||
setjmp:
|
setjmp:
|
||||||
xor %eax, %eax // Grab val argument (hardcoded to zero)
|
xor %eax, %eax // Grab val argument (hardcoded to zero)
|
||||||
jmp .Lsigset_common
|
jmp .Lsigset_common
|
||||||
|
@ -57,7 +59,9 @@ sigsetjmp:
|
||||||
xor %eax, %eax
|
xor %eax, %eax
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
.global _longjmp
|
||||||
.global longjmp
|
.global longjmp
|
||||||
|
_longjmp:
|
||||||
longjmp:
|
longjmp:
|
||||||
mov 4(%esp), %ecx // Grab jmp_buf argument
|
mov 4(%esp), %ecx // Grab jmp_buf argument
|
||||||
mov 8(%esp), %eax // Grab val argument
|
mov 8(%esp), %eax // Grab val argument
|
||||||
|
|
|
@ -79,4 +79,16 @@ __attribute__((noreturn)) void longjmp(jmp_buf, int val);
|
||||||
int sigsetjmp(sigjmp_buf, int savesigs);
|
int sigsetjmp(sigjmp_buf, int savesigs);
|
||||||
__attribute__((noreturn)) void siglongjmp(sigjmp_buf, int val);
|
__attribute__((noreturn)) void siglongjmp(sigjmp_buf, int val);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* _setjmp() and _longjmp() are specified as behaving the exactly the same as
|
||||||
|
* setjmp() and longjmp(), except they are not supposed to modify the signal mask.
|
||||||
|
*
|
||||||
|
* Our implementations already follow this restriction, so we just map them directly
|
||||||
|
* to the same functions.
|
||||||
|
*
|
||||||
|
* https://pubs.opengroup.org/onlinepubs/9699969599/functions/_setjmp.html
|
||||||
|
*/
|
||||||
|
int _setjmp(jmp_buf);
|
||||||
|
__attribute__((noreturn)) void _longjmp(jmp_buf, int val);
|
||||||
|
|
||||||
__END_DECLS
|
__END_DECLS
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue