Skip to contentSkip to conversation

linux-user/signal.c: Use target address instead of host address for microblaze restorer

PATCH In review [email protected] 5 participants 6 messages Mar 29, 2016 – May 14, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 linux-user/signal.c: Use target address instead of host address for microblaze restorer

From: Chen Gang <[email protected]>

The return address is in target space, so the restorer address needs to be target space, too.

---
 linux-user/signal.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
linux-user/signal.c +2 -1
index 4157154..c0a6f7e 100644
@@ -3532,7 +3532,8 @@ static void setup_frame(int sig, struct target_sigaction *ka,
 
         /* Return from sighandler will jump to the tramp.
            Negative 8 offset because return is rtsd r15, 8 */
-        env->regs[15] = ((unsigned long)frame->tramp) - 8;
+        env->regs[15] = frame_addr + offsetof(struct target_signal_frame, tramp)
+                                   - 8;
     }
 
     /* Set up registers for signal handler */
Signature · 1 line
1.9.3
Reviewed-by on v1 1/1
#1 lore raw
Quoted 15 lines · On 29 March 2016 at 15:13, <[email protected]> wrote:

From: Chen Gang <[email protected]>

The return address is in target space, so the restorer address needs to be target space, too.

---
 linux-user/signal.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
linux-user/signal.c +0 -0
index 4157154..c0a6f7e 100644

linux-user/signal.c static void setup_frame(int sig, struct target_sigaction *ka, · line 3539

Quoted 9 lines
linux-user/signal.c +2 -1
@@ -3532,7 +3532,8 @@ static void setup_frame(int sig, struct target_sigaction *ka,
 
         /* Return from sighandler will jump to the tramp.
            Negative 8 offset because return is rtsd r15, 8 */
-        env->regs[15] = ((unsigned long)frame->tramp) - 8;
+        env->regs[15] = frame_addr + offsetof(struct target_signal_frame, tramp)
+                                   - 8;
     }
 
     /* Set up registers for signal handler */

thanks
-- PMM

author
#2 lore raw
Quoted 24 lines · Peter Maydell
Quoted 23 lines · On 29 March 2016 at 15:13, <[email protected]> wrote:

From: Chen Gang <[email protected]>

The return address is in target space, so the restorer address needs to be target space, too.

---
 linux-user/signal.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
linux-user/signal.c +2 -1
index 4157154..c0a6f7e 100644
@@ -3532,7 +3532,8 @@ static void setup_frame(int sig, struct target_sigaction *ka,
 
         /* Return from sighandler will jump to the tramp.
            Negative 8 offset because return is rtsd r15, 8 */
-        env->regs[15] = ((unsigned long)frame->tramp) - 8;
+        env->regs[15] = frame_addr + offsetof(struct target_signal_frame, tramp)
+                                   - 8;
     }
 
Quoted 4 lines

linux-user/signal.c static void setup_frame(int sig, struct target_sigaction *ka, · line 3539

Quoted 1 line
linux-user/signal.c +0 -0
     /* Set up registers for signal handler */

Thank all of you for the 2 patches reviewing.

I guess, this month, I may have free time (at least, will not be as busy as the previous month), I shall finish tilegx floating point insns (it has been delayed too long).

Thanks.

Signature · 3 lines
Chen Gang (陈刚)

Managing Natural Environments is the Duty of Human Beings.
Reviewed-by
#3 lore raw
Quoted 30 lines · Chen Gang
Quoted 24 lines · Peter Maydell
Quoted 23 lines · On 29 March 2016 at 15:13, <[email protected]> wrote:

From: Chen Gang <[email protected]>

The return address is in target space, so the restorer address needs to be target space, too.

---
 linux-user/signal.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
linux-user/signal.c +2 -1
index 4157154..c0a6f7e 100644
@@ -3532,7 +3532,8 @@ static void setup_frame(int sig, struct target_sigaction *ka,
 
         /* Return from sighandler will jump to the tramp.
            Negative 8 offset because return is rtsd r15, 8 */
-        env->regs[15] = ((unsigned long)frame->tramp) - 8;
+        env->regs[15] = frame_addr + offsetof(struct target_signal_frame, tramp)
+                                   - 8;
     }
 
Quoted 4 lines

linux-user/signal.c static void setup_frame(int sig, struct target_sigaction *ka, · line 3539

Quoted 1 line
linux-user/signal.c +0 -0
     /* Set up registers for signal handler */
Quoted 5 lines

Thank all of you for the 2 patches reviewing.

I guess, this month, I may have free time (at least, will not be as busy as the previous month), I shall finish tilegx floating point insns (it has been delayed too long).

#4 lore raw
Quoted 31 lines · Edgar E. Iglesias
Quoted 30 lines · Chen Gang
Quoted 28 lines · Peter Maydell
Quoted 15 lines · On 29 March 2016 at 15:13, <[email protected]> wrote:

From: Chen Gang <[email protected]>

The return address is in target space, so the restorer address needs to be target space, too.

---
 linux-user/signal.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
linux-user/signal.c +0 -0
index 4157154..c0a6f7e 100644

linux-user/signal.c static void setup_frame(int sig, struct target_sigaction *ka, · line 3539

Quoted 9 lines
linux-user/signal.c +2 -1
@@ -3532,7 +3532,8 @@ static void setup_frame(int sig, struct target_sigaction *ka,
 
         /* Return from sighandler will jump to the tramp.
            Negative 8 offset because return is rtsd r15, 8 */
-        env->regs[15] = ((unsigned long)frame->tramp) - 8;
+        env->regs[15] = frame_addr + offsetof(struct target_signal_frame, tramp)
+                                   - 8;
     }
 
     /* Set up registers for signal handler */
Quoted 8 lines
Quoted 5 lines

Thank all of you for the 2 patches reviewing.

I guess, this month, I may have free time (at least, will not be as busy as the previous month), I shall finish tilegx floating point insns (it has been delayed too long).

OK, thank you for your work.

And now (finally), I guess, I should have free time for open source, and I should try to finish tilegx floating point insns within this month.

Thanks.

Signature · 3 lines
Chen Gang (陈刚)

Managing Natural Environments is the Duty of Human Beings.
Reviewed-by on v1 1/1
#5 lore raw
In reply to [email protected]
Quoted 16 lines · Le 29/03/2016 à 16:13, [email protected] a écrit :

From: Chen Gang <[email protected]>

The return address is in target space, so the restorer address needs to be target space, too.

---
 linux-user/signal.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
linux-user/signal.c +0 -0
index 4157154..c0a6f7e 100644

linux-user/signal.c static void setup_frame(int sig, struct target_sigaction *ka, · line 3539

Quoted 9 lines
linux-user/signal.c +2 -1
@@ -3532,7 +3532,8 @@ static void setup_frame(int sig, struct target_sigaction *ka,
 
         /* Return from sighandler will jump to the tramp.
            Negative 8 offset because return is rtsd r15, 8 */
-        env->regs[15] = ((unsigned long)frame->tramp) - 8;
+        env->regs[15] = frame_addr + offsetof(struct target_signal_frame, tramp)
+                                   - 8;
     }
 
     /* Set up registers for signal handler */