public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] sparc: Improve setjmp()
@ 2023-10-06  5:31 Sebastian Huber
  2023-10-12  9:39 ` Sebastian Huber
  0 siblings, 1 reply; 6+ messages in thread
From: Sebastian Huber @ 2023-10-06  5:31 UTC (permalink / raw)
  To: newlib

Flush the windows in setjmp().  This helps if the stack is changed after
the setjmp() and we want to jump back to the original stack using
longjmp().
---
 newlib/libc/machine/sparc/setjmp.S | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/newlib/libc/machine/sparc/setjmp.S b/newlib/libc/machine/sparc/setjmp.S
index 613df2ba2..d7185be4c 100644
--- a/newlib/libc/machine/sparc/setjmp.S
+++ b/newlib/libc/machine/sparc/setjmp.S
@@ -110,6 +110,8 @@
 
 ENTRY(setjmp)
 ENTRY(_setjmp)
+        ta      0x03            /* Flush registers, just in case another stack
+                                   is used after the setjmp().  */
         st      %sp, [%o0]      /* caller's stack pointer */
         st      %i7, [%o0+4]    /* caller's return pc */
         st      %fp, [%o0+8]    /* store caller's frame pointer */
-- 
2.35.3


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-10-12 15:33 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-06  5:31 [PATCH] sparc: Improve setjmp() Sebastian Huber
2023-10-12  9:39 ` Sebastian Huber
2023-10-12 14:50   ` Jeff Johnston
2023-10-12 14:55     ` Sebastian Huber
2023-10-12 15:33       ` Jeff Johnston
2023-10-12 15:19   ` Brian Inglis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).