diff options
author | Jerome Forissier <jerome.forissier@linaro.org> | 2025-04-18 16:09:32 +0200 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2025-04-23 13:19:44 -0600 |
commit | a27844cc9443341ffe1314ccc4c384a54ad1ae32 (patch) | |
tree | 4a99e50a494582975b7fd3f9d65db01fa9141ddb /tools/u_boot_pylib/test_util.py | |
parent | 3691328ef69555148962654e7f834fd0b5273fcb (diff) |
sandbox: add initjmp()
Add initjm[() to sandbox, a non-standard extension to setjmp()/
longjmp() allowing to initialize a jump buffer with a function pointer
and a stack pointer. This will be useful to later introduce threads.
With this new function it becomes possible to longjmp() to a particular
function pointer (rather than to a point previously reached during
program execution as is the case with setjmp()), and with a custom stack.
Both things are needed to spin off a new thread. Then the usual
setjmp()/longjmp() pair is enough to save and restore a context, i.e.,
switch thread. The implementation is taken verbatim from barebox [1] with
the exception of the additional stack_sz argument. It is quite complex
because contrary to U-Boot platform code we don't know how the system's
C library implements the jump buffer, so we can't just write the function
and stack pointers into it.
[1] https://github.com/barebox/barebox/blob/b2a15c383ddc/arch/sandbox/os/setjmp.c
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Diffstat (limited to 'tools/u_boot_pylib/test_util.py')
0 files changed, 0 insertions, 0 deletions