From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:32871) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RgE6J-00036g-JC for qemu-devel@nongnu.org; Thu, 29 Dec 2011 06:24:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RgE6D-0002WD-S2 for qemu-devel@nongnu.org; Thu, 29 Dec 2011 06:24:47 -0500 Received: from mout.web.de ([212.227.15.3]:58947) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RgE6C-0002TS-8f for qemu-devel@nongnu.org; Thu, 29 Dec 2011 06:24:41 -0500 Message-ID: <4EFC4DA4.5090906@web.de> Date: Thu, 29 Dec 2011 12:23:16 +0100 From: =?ISO-8859-1?Q?Andreas_F=E4rber?= MIME-Version: 1.0 References: <1323321912-15922-1-git-send-email-khansa@kics.edu.pk> <1323321912-15922-4-git-send-email-khansa@kics.edu.pk> <4EE8CCCE.8010108@twiddle.net> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 3/3] linux-user:Signal handling for MIPS64 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Khansa Butt Cc: qemu-devel@nongnu.org, Richard Henderson Am 29.12.2011 11:58, schrieb Khansa Butt: > On Wed, Dec 14, 2011 at 9:20 PM, Richard Henderson 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 > #include > #include > #include > > 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