qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Andreas Färber" <andreas.faerber@web.de>
To: Khansa Butt <khansa@kics.edu.pk>
Cc: qemu-devel@nongnu.org, Richard Henderson <rth@twiddle.net>
Subject: Re: [Qemu-devel] [PATCH 3/3] linux-user:Signal handling for MIPS64
Date: Thu, 29 Dec 2011 12:23:16 +0100	[thread overview]
Message-ID: <4EFC4DA4.5090906@web.de> (raw)
In-Reply-To: <CAAoJSP6=chUxHYMAcj1Aqz4LxM9jk26VCWsWEuC36+xzV_p0xw@mail.gmail.com>

Am 29.12.2011 11:58, schrieb Khansa Butt:
> On Wed, Dec 14, 2011 at 9:20 PM, Richard Henderson <rth@twiddle.net> wrote:
>> On 12/07/2011 09:25 PM, khansa@kics.edu.pk wrote:
>>> +#if defined(TARGET_MIPS64)
>>> +        /* tswapal() do 64 bit swap in case of MIPS64 but
>>> +           we need 32 bit swap as sa_flags is 32 bit */
>>> +        k->sa_flags = bswap32(act->sa_flags);
>>> +#else
>>>          k->sa_flags = tswapal(act->sa_flags);
>>> +#endif
>>
>> The condition in syscall_defs.h is TARGET_MIPS, not TARGET_MIPS64.
>> They should match, despite the fact that it doesn't actually matter
>> for the 32-bit abis.
>>
>>>  #elif defined(TARGET_ABI_MIPSN64)
>>>
>>> -# warning signal handling not implemented
>>> +struct target_sigcontext {
>>> +    uint32_t   sc_regmask;     /* Unused */
>>> +    uint32_t   sc_status;
>>
>> There's no reason to duplicate all this code.  Yes, when someone wrote
>> this in the first place, they wrote separate sectons for each mips abi.
>> However, as you can see that huge portions of this block are identical,
>> this was obviously a mistake.
>>
>> Start by changing the original section to #elif defined(TARGET_MIPS)
>> and see what needs changing specifically for the ABIs.  I'm not even
>> sure there are any differences at all.
> 
> The difference lies in setup_frame(). the trampoline function needs
> syscall number
>     install_sigtramp(frame->sf_code, TARGET_NR_sigreturn);
> sigreturn is not defined for MIPS64 instead it has only rt_sigreturn.
> I tried with #elif defined(TARGET_MIPS). cross compile the following
> small program and run it on
> qemu-mips64
> #include <stdio.h>
> #include <signal.h>
> #include <string.h>
> #include <unistd.h>
> 
> struct sigaction act;
> 
> void sighandler(int signum, siginfo_t *info, void *ptr)
> {
>     printf("Received signal %d\n", signum);
>     printf("Signal originates from process %lu\n",(unsigned long)info->si_pid);
> }
> 
> int main()
> {
>     printf("I am %lu\n", (unsigned long)getpid());
> 
>     memset(&act, 0, sizeof(act));
> 
>     act.sa_sigaction = sighandler;
>     act.sa_flags = SA_SIGINFO;
> 
>     sigaction(SIGILL, &act, NULL);
> 
>     // Waiting
>     sleep(100);
> 
>     return 0;
> }
> 
> and again I found that only install_sigtramp line is needed to be changed.
> keeping  #elif defined(TARGET_MIPS) above signal handling portion, can i use
>  #if defined(TARGET_MIPS64)
>  ....
> #else
> for install_sigtramp() difference

That's not the only difference - the sigcontext is different, too, for
instance. I hope to get something finished for n32 later today.

Andreas

  reply	other threads:[~2011-12-29 11:24 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-08  5:25 [Qemu-devel] [PATCH 0/3] MIPS64 user mode emulation in QEMU khansa
2011-12-08  5:25 ` [Qemu-devel] [PATCH 1/3] linux-user:Support for " khansa
2011-12-08 15:15   ` Andreas Färber
2011-12-09  0:18     ` Andreas Färber
2011-12-14 16:04     ` Richard Henderson
2011-12-08  5:25 ` [Qemu-devel] [PATCH 2/3] target-mips:enabling of 64 bit user mode and floating point operations MIPS_HFLAG_UX is included in env->hflags so that the address computation for LD instruction does not treated as 32 bit code see gen_op_addr_add() in translate.c khansa
2011-12-09  0:04   ` Andreas Färber
2011-12-14 17:05     ` Richard Henderson
2011-12-08  5:25 ` [Qemu-devel] [PATCH 3/3] linux-user:Signal handling for MIPS64 khansa
2011-12-14 16:20   ` Richard Henderson
2011-12-28 11:09     ` Khansa Butt
2011-12-29 10:58     ` Khansa Butt
2011-12-29 11:23       ` Andreas Färber [this message]
2011-12-08 13:22 ` [Qemu-devel] [PATCH 0/3] MIPS64 user mode emulation in QEMU Andreas Färber
  -- strict thread matches above, loose matches on Subject: below --
2011-11-30 11:07 [Qemu-devel] [PATCH 0/3] MIPS64 user mode emulation in QEMU with Cavium specific instruction support khansa
2011-11-30 11:07 ` [Qemu-devel] [PATCH 3/3] linux-user:Signal handling for MIPS64 khansa
2011-04-29  6:20 Khansa Butt

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=4EFC4DA4.5090906@web.de \
    --to=andreas.faerber@web.de \
    --cc=khansa@kics.edu.pk \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    /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 NNTP newsgroup(s).