From: Hui-Wen Ni <sabrinanitw@gmail.com>
To: newlib@sourceware.org
Subject: [PATCH 08/15] [nds32] Keep jmp_buff sync with GDB.
Date: Thu, 20 Mar 2014 03:39:00 -0000 [thread overview]
Message-ID: <CAAw2OtY0N0r3ssmbOHTeySE_H=OJ71QArA0_aUYa0PznDyXMeA@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1 bytes --]
[-- Attachment #2: 0008-nds32-Keep-jmp_buff-sync-with-GDB.patch --]
[-- Type: application/octet-stream, Size: 2237 bytes --]
From 2227986fc1da3255445788fab19c123c90de0828 Mon Sep 17 00:00:00 2001
From: Sabrina Ni <sabrina@andestech.com>
Date: Thu, 31 Oct 2013 13:22:14 +0800
Subject: [PATCH 08/15] [nds32] Keep jmp_buff sync with GDB.
* newlib/libc/machine/nds32/setjmp.S: Keep jmp_buff sync with GDB.
---
newlib/libc/machine/nds32/setjmp.S | 24 +++++++++++++-----------
1 file changed, 13 insertions(+), 11 deletions(-)
diff --git a/newlib/libc/machine/nds32/setjmp.S b/newlib/libc/machine/nds32/setjmp.S
index 906efab..e5d8531 100644
--- a/newlib/libc/machine/nds32/setjmp.S
+++ b/newlib/libc/machine/nds32/setjmp.S
@@ -40,7 +40,9 @@ The usage of thirty-two 32-bit General Purpose Registers (GPR):
reserved for assembler : $r15
reserved for other use : $r24, $r25, $r26, $r27
-Save all callee-save registers and $fp, $gp, $lp and $sp.
+Save all callee-save registers and $fp, $gp, $lp and $sp is enough in theory.
+For debugging issue, the layout of jum_buf in here should be in sync with GDB.
+The $r16 ~ $r19 are used to store D0/D1, keep them for backward-compatible.
*/
/* int setjmp(jmp_buf env); */
@@ -50,13 +52,12 @@ Save all callee-save registers and $fp, $gp, $lp and $sp.
.type setjmp, @function
setjmp:
#ifdef __NDS32_REDUCED_REGS__
- /* This case, save 10 words. */
- smw.bim $r6, [$r0], $r10, 0x0
- smw.bim $r31, [$r0], $r31, 0xf
+ smw.bim $r6, [$r0], $r10, #0b0000
+ addi $r0, $r0, #32 /* Leave room to keep jum_buf all the same. */
+ smw.bim $r31, [$r0], $r31, #0b1111
#else
- /* This case, save 17 words. */
- smw.bim $r6, [$r0], $r14, 0x0
- smw.bim $r16, [$r0], $r19, 0xf
+ smw.bim $r6, [$r0], $r14, #0b0000
+ smw.bim $r16, [$r0], $r19, #0b1111
#endif
/* Set return value to zero. */
@@ -72,11 +73,12 @@ setjmp:
.type longjmp, @function
longjmp:
#ifdef __NDS32_REDUCED_REGS__
- lmw.bim $r6, [$r0], $r10, 0x0
- lmw.bim $r31, [$r0], $r31, 0xf
+ lmw.bim $r6, [$r0], $r10, #0b0000
+ addi $r0, $r0, #32
+ lmw.bim $r31, [$r0], $r31, #0b1111
#else
- lmw.bim $r6, [$r0], $r14, 0x0
- lmw.bim $r16, [$r0], $r19, 0xf
+ lmw.bim $r6, [$r0], $r14, #0b0000
+ lmw.bim $r16, [$r0], $r19, #0b1111
#endif
/* Set val as return value. If the value val is 0, 1 will be returned
instead. */
--
1.9.0
reply other threads:[~2014-03-20 3:39 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAAw2OtY0N0r3ssmbOHTeySE_H=OJ71QArA0_aUYa0PznDyXMeA@mail.gmail.com' \
--to=sabrinanitw@gmail.com \
--cc=newlib@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).