diff mbox

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

Message ID 1459260825-5710-1-git-send-email-chengang@emindsoft.com.cn
State New
Headers show

Commit Message

Chen Gang March 29, 2016, 2:13 p.m. UTC
From: Chen Gang <chengang@emindsoft.com.cn>

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

Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com>
---
 linux-user/signal.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Peter Maydell May 4, 2016, 4:05 p.m. UTC | #1
On 29 March 2016 at 15:13,  <chengang@emindsoft.com.cn> wrote:
> From: Chen Gang <chengang@emindsoft.com.cn>
>
> The return address is in target space, so the restorer address needs to
> be target space, too.
>
> Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com>
> ---
>  linux-user/signal.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/linux-user/signal.c b/linux-user/signal.c
> index 4157154..c0a6f7e 100644
> --- a/linux-user/signal.c
> +++ b/linux-user/signal.c
> @@ -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 */

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

thanks
-- PMM
Laurent Vivier May 4, 2016, 5:46 p.m. UTC | #2
Le 29/03/2016 à 16:13, chengang@emindsoft.com.cn a écrit :
> From: Chen Gang <chengang@emindsoft.com.cn>
> 
> The return address is in target space, so the restorer address needs to
> be target space, too.
> 
> Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com>
> ---
>  linux-user/signal.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/linux-user/signal.c b/linux-user/signal.c
> index 4157154..c0a6f7e 100644
> --- a/linux-user/signal.c
> +++ b/linux-user/signal.c
> @@ -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 */
> 

Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Chen Gang May 5, 2016, 2:48 p.m. UTC | #3
On 5/5/16 00:05, Peter Maydell wrote:
> On 29 March 2016 at 15:13,  <chengang@emindsoft.com.cn> wrote:
>> From: Chen Gang <chengang@emindsoft.com.cn>
>>
>> The return address is in target space, so the restorer address needs to
>> be target space, too.
>>
>> Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com>
>> ---
>>  linux-user/signal.c | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/linux-user/signal.c b/linux-user/signal.c
>> index 4157154..c0a6f7e 100644
>> --- a/linux-user/signal.c
>> +++ b/linux-user/signal.c
>> @@ -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 */
> 
> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
> 

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.
Edgar E. Iglesias May 5, 2016, 4:11 p.m. UTC | #4
On Thu, May 05, 2016 at 10:48:57PM +0800, Chen Gang wrote:
> On 5/5/16 00:05, Peter Maydell wrote:
> > On 29 March 2016 at 15:13,  <chengang@emindsoft.com.cn> wrote:
> >> From: Chen Gang <chengang@emindsoft.com.cn>
> >>
> >> The return address is in target space, so the restorer address needs to
> >> be target space, too.
> >>
> >> Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com>
> >> ---
> >>  linux-user/signal.c | 3 ++-
> >>  1 file changed, 2 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/linux-user/signal.c b/linux-user/signal.c
> >> index 4157154..c0a6f7e 100644
> >> --- a/linux-user/signal.c
> >> +++ b/linux-user/signal.c
> >> @@ -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 */
> > 
> > Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
> > 
> 
> 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).

Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Chen Gang May 14, 2016, 3:19 a.m. UTC | #5
On 5/6/16 00:11, Edgar E. Iglesias wrote:
> On Thu, May 05, 2016 at 10:48:57PM +0800, Chen Gang wrote:
>> On 5/5/16 00:05, Peter Maydell wrote:
>>> On 29 March 2016 at 15:13,  <chengang@emindsoft.com.cn> wrote:
>>>> From: Chen Gang <chengang@emindsoft.com.cn>
>>>>
>>>> The return address is in target space, so the restorer address needs to
>>>> be target space, too.
>>>>
>>>> Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com>
>>>> ---
>>>>  linux-user/signal.c | 3 ++-
>>>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>>>
>>>> diff --git a/linux-user/signal.c b/linux-user/signal.c
>>>> index 4157154..c0a6f7e 100644
>>>> --- a/linux-user/signal.c
>>>> +++ b/linux-user/signal.c
>>>> @@ -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 */
>>>
>>> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
>>>
>>
>> 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).
> 
> Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
> 

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.
diff mbox

Patch

diff --git a/linux-user/signal.c b/linux-user/signal.c
index 4157154..c0a6f7e 100644
--- a/linux-user/signal.c
+++ b/linux-user/signal.c
@@ -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 */