From patchwork Mon Apr 30 09:09:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 10371211 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 297B86032A for ; Mon, 30 Apr 2018 09:15:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 16238289FC for ; Mon, 30 Apr 2018 09:15:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0A91828A03; Mon, 30 Apr 2018 09:15:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1FB4528A01 for ; Mon, 30 Apr 2018 09:15:53 +0000 (UTC) Received: from localhost ([::1]:58547 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fD4uW-0002LD-9V for patchwork-qemu-devel@patchwork.kernel.org; Mon, 30 Apr 2018 05:15:52 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:32840) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fD4q3-0006Hn-0q for qemu-devel@nongnu.org; Mon, 30 Apr 2018 05:11:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fD4pw-00062c-Rl for qemu-devel@nongnu.org; Mon, 30 Apr 2018 05:11:14 -0400 Received: from mout.kundenserver.de ([217.72.192.75]:34937) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fD4pw-0005zx-DY; Mon, 30 Apr 2018 05:11:08 -0400 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue102 [212.227.15.183]) with ESMTPSA (Nemesis) id 0MfqL6-1eyghx2QnU-00NEZE; Mon, 30 Apr 2018 11:10:50 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Mon, 30 Apr 2018 11:09:58 +0200 Message-Id: <20180430091037.13878-4-laurent@vivier.eu> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180430091037.13878-1-laurent@vivier.eu> References: <20180430091037.13878-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:kQBG9mEYhLxftKwWE1mUMu94wfO1uLC1HJa0CGdfOE6EOQh+8Cw rvTfMjW3TCJCQhnPQrfnr9Qz3T5sBc9yoen2qoq1f5/H55QyFaijJ2+SrWkj6fleBHU9XA8 S3f8AvPmiT8sXGiLgT8xSPVzCScJfjtDQ1t1xsBdcezhnt9vAiGZ3G1n095cyO0BAo1eJV2 Q9wsLRd7q2fYnTNA1jlpQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:TSCg9kKVYLU=:Zn9E55O+lViC94/aXg0ldM AIxzibGPumpbQZ91wiX+FlpU+kvxFMLRk/Z4KOR67dhOktD9S83i0UQkVEZRZr7TztXGIGb/7 jFk7t8qlNVClfF4R+YDwEQ28DMBuoHSWJ7Oh4F5unMx/u7lvxYaPQdok3k2EdEWwW3+5NJn9E KiPKwB17CPJPpDb4KL0yzsslZnT0oIjeCeFTEzoK2FSrUbE5TYEJq93ADpbXBafIzJDfWMWwK SRSVm4+xmWrfkbaR5R8lOpO9aMOV32+cd4eRtTrpPFkXvEytC65RE5y8vJTodzgDxDDGp4brK SfE62FAHjJ7Py69FmGlQayGdLzV8rlSDF1BTX7AQ66D1nb9pM8v8jecnhctPEcW4T3LHVlOWy W/jIQGxWI9X7cCgGcl9HQkiJKIskCs3bvhKfFdxtNWOMs+FfrC7nnZmsGI9B8PNw177yh/8ei qKjfjvG//iXbagWjsqg/x0l3/casGb4BKDpo3IIaMy4hVEbYmEJ3my5y2U2i17MoCWVX+2PGk P9ipSjSOObG0VDqqdSq6j7VvwMyYHtGXW3pATPlAPRMf7iDildtygYSM/8OvsgtKHzzsJtL0e vOpxFdZ+DvaeppRIFiuKhVLqAJ8T8YyMcc1CimXcrskmWn1vFC2pG16QtOLiR/MpjwaRBBlpo NjqdRfjiE4HLihBfyNvtpQgzf/hMHzHxBQHvz16aKh7xZkRTOCC/c2bsCwtALd/bl1qE9CCle pOdXeEjfxQHvgMOM X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 217.72.192.75 Subject: [Qemu-devel] [PULL 03/42] linux-user: create a dummy per arch signal.c X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-s390x@nongnu.org, Riku Voipio , Laurent Vivier , Cornelia Huck Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Create a signal-common.h for future use by these new files and use it in the existing signal.c Signed-off-by: Laurent Vivier Reviewed-by: Alex Bennée Reviewed-by: Richard Henderson Message-Id: <20180424192635.6027-2-laurent@vivier.eu> --- linux-user/Makefile.objs | 2 +- linux-user/aarch64/signal.c | 18 +++++++++++++++ linux-user/alpha/signal.c | 18 +++++++++++++++ linux-user/arm/signal.c | 18 +++++++++++++++ linux-user/cris/signal.c | 18 +++++++++++++++ linux-user/hppa/signal.c | 18 +++++++++++++++ linux-user/i386/signal.c | 18 +++++++++++++++ linux-user/m68k/signal.c | 18 +++++++++++++++ linux-user/microblaze/signal.c | 18 +++++++++++++++ linux-user/mips/signal.c | 18 +++++++++++++++ linux-user/mips64/signal.c | 18 +++++++++++++++ linux-user/nios2/signal.c | 18 +++++++++++++++ linux-user/openrisc/signal.c | 18 +++++++++++++++ linux-user/ppc/signal.c | 18 +++++++++++++++ linux-user/riscv/signal.c | 18 +++++++++++++++ linux-user/s390x/signal.c | 18 +++++++++++++++ linux-user/sh4/signal.c | 18 +++++++++++++++ linux-user/signal-common.h | 50 ++++++++++++++++++++++++++++++++++++++++++ linux-user/signal.c | 41 ++++++++++------------------------ linux-user/sparc/signal.c | 18 +++++++++++++++ linux-user/sparc64/signal.c | 18 +++++++++++++++ linux-user/tilegx/signal.c | 18 +++++++++++++++ linux-user/x86_64/signal.c | 18 +++++++++++++++ linux-user/xtensa/signal.c | 18 +++++++++++++++ 24 files changed, 440 insertions(+), 31 deletions(-) create mode 100644 linux-user/aarch64/signal.c create mode 100644 linux-user/alpha/signal.c create mode 100644 linux-user/arm/signal.c create mode 100644 linux-user/cris/signal.c create mode 100644 linux-user/hppa/signal.c create mode 100644 linux-user/i386/signal.c create mode 100644 linux-user/m68k/signal.c create mode 100644 linux-user/microblaze/signal.c create mode 100644 linux-user/mips/signal.c create mode 100644 linux-user/mips64/signal.c create mode 100644 linux-user/nios2/signal.c create mode 100644 linux-user/openrisc/signal.c create mode 100644 linux-user/ppc/signal.c create mode 100644 linux-user/riscv/signal.c create mode 100644 linux-user/s390x/signal.c create mode 100644 linux-user/sh4/signal.c create mode 100644 linux-user/signal-common.h create mode 100644 linux-user/sparc/signal.c create mode 100644 linux-user/sparc64/signal.c create mode 100644 linux-user/tilegx/signal.c create mode 100644 linux-user/x86_64/signal.c create mode 100644 linux-user/xtensa/signal.c diff --git a/linux-user/Makefile.objs b/linux-user/Makefile.objs index 8c93058100..811a7f5ce5 100644 --- a/linux-user/Makefile.objs +++ b/linux-user/Makefile.objs @@ -1,6 +1,6 @@ obj-y = main.o syscall.o strace.o mmap.o signal.o \ elfload.o linuxload.o uaccess.o uname.o \ - safe-syscall.o + safe-syscall.o $(TARGET_ABI_DIR)/signal.o obj-$(TARGET_HAS_BFLT) += flatload.o obj-$(TARGET_I386) += vm86.o diff --git a/linux-user/aarch64/signal.c b/linux-user/aarch64/signal.c new file mode 100644 index 0000000000..02ca338b6c --- /dev/null +++ b/linux-user/aarch64/signal.c @@ -0,0 +1,18 @@ +/* + * Emulation of Linux signals + * + * Copyright (c) 2003 Fabrice Bellard + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ diff --git a/linux-user/alpha/signal.c b/linux-user/alpha/signal.c new file mode 100644 index 0000000000..02ca338b6c --- /dev/null +++ b/linux-user/alpha/signal.c @@ -0,0 +1,18 @@ +/* + * Emulation of Linux signals + * + * Copyright (c) 2003 Fabrice Bellard + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ diff --git a/linux-user/arm/signal.c b/linux-user/arm/signal.c new file mode 100644 index 0000000000..02ca338b6c --- /dev/null +++ b/linux-user/arm/signal.c @@ -0,0 +1,18 @@ +/* + * Emulation of Linux signals + * + * Copyright (c) 2003 Fabrice Bellard + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ diff --git a/linux-user/cris/signal.c b/linux-user/cris/signal.c new file mode 100644 index 0000000000..02ca338b6c --- /dev/null +++ b/linux-user/cris/signal.c @@ -0,0 +1,18 @@ +/* + * Emulation of Linux signals + * + * Copyright (c) 2003 Fabrice Bellard + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ diff --git a/linux-user/hppa/signal.c b/linux-user/hppa/signal.c new file mode 100644 index 0000000000..02ca338b6c --- /dev/null +++ b/linux-user/hppa/signal.c @@ -0,0 +1,18 @@ +/* + * Emulation of Linux signals + * + * Copyright (c) 2003 Fabrice Bellard + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ diff --git a/linux-user/i386/signal.c b/linux-user/i386/signal.c new file mode 100644 index 0000000000..02ca338b6c --- /dev/null +++ b/linux-user/i386/signal.c @@ -0,0 +1,18 @@ +/* + * Emulation of Linux signals + * + * Copyright (c) 2003 Fabrice Bellard + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ diff --git a/linux-user/m68k/signal.c b/linux-user/m68k/signal.c new file mode 100644 index 0000000000..02ca338b6c --- /dev/null +++ b/linux-user/m68k/signal.c @@ -0,0 +1,18 @@ +/* + * Emulation of Linux signals + * + * Copyright (c) 2003 Fabrice Bellard + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ diff --git a/linux-user/microblaze/signal.c b/linux-user/microblaze/signal.c new file mode 100644 index 0000000000..02ca338b6c --- /dev/null +++ b/linux-user/microblaze/signal.c @@ -0,0 +1,18 @@ +/* + * Emulation of Linux signals + * + * Copyright (c) 2003 Fabrice Bellard + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ diff --git a/linux-user/mips/signal.c b/linux-user/mips/signal.c new file mode 100644 index 0000000000..02ca338b6c --- /dev/null +++ b/linux-user/mips/signal.c @@ -0,0 +1,18 @@ +/* + * Emulation of Linux signals + * + * Copyright (c) 2003 Fabrice Bellard + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ diff --git a/linux-user/mips64/signal.c b/linux-user/mips64/signal.c new file mode 100644 index 0000000000..02ca338b6c --- /dev/null +++ b/linux-user/mips64/signal.c @@ -0,0 +1,18 @@ +/* + * Emulation of Linux signals + * + * Copyright (c) 2003 Fabrice Bellard + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ diff --git a/linux-user/nios2/signal.c b/linux-user/nios2/signal.c new file mode 100644 index 0000000000..02ca338b6c --- /dev/null +++ b/linux-user/nios2/signal.c @@ -0,0 +1,18 @@ +/* + * Emulation of Linux signals + * + * Copyright (c) 2003 Fabrice Bellard + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ diff --git a/linux-user/openrisc/signal.c b/linux-user/openrisc/signal.c new file mode 100644 index 0000000000..02ca338b6c --- /dev/null +++ b/linux-user/openrisc/signal.c @@ -0,0 +1,18 @@ +/* + * Emulation of Linux signals + * + * Copyright (c) 2003 Fabrice Bellard + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ diff --git a/linux-user/ppc/signal.c b/linux-user/ppc/signal.c new file mode 100644 index 0000000000..02ca338b6c --- /dev/null +++ b/linux-user/ppc/signal.c @@ -0,0 +1,18 @@ +/* + * Emulation of Linux signals + * + * Copyright (c) 2003 Fabrice Bellard + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ diff --git a/linux-user/riscv/signal.c b/linux-user/riscv/signal.c new file mode 100644 index 0000000000..02ca338b6c --- /dev/null +++ b/linux-user/riscv/signal.c @@ -0,0 +1,18 @@ +/* + * Emulation of Linux signals + * + * Copyright (c) 2003 Fabrice Bellard + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ diff --git a/linux-user/s390x/signal.c b/linux-user/s390x/signal.c new file mode 100644 index 0000000000..02ca338b6c --- /dev/null +++ b/linux-user/s390x/signal.c @@ -0,0 +1,18 @@ +/* + * Emulation of Linux signals + * + * Copyright (c) 2003 Fabrice Bellard + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ diff --git a/linux-user/sh4/signal.c b/linux-user/sh4/signal.c new file mode 100644 index 0000000000..02ca338b6c --- /dev/null +++ b/linux-user/sh4/signal.c @@ -0,0 +1,18 @@ +/* + * Emulation of Linux signals + * + * Copyright (c) 2003 Fabrice Bellard + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ diff --git a/linux-user/signal-common.h b/linux-user/signal-common.h new file mode 100644 index 0000000000..838b6e9198 --- /dev/null +++ b/linux-user/signal-common.h @@ -0,0 +1,50 @@ +/* + * Emulation of Linux signals + * + * Copyright (c) 2003 Fabrice Bellard + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +#ifndef SIGNAL_COMMON_H +#define SIGNAL_COMMON_H +extern struct target_sigaltstack target_sigaltstack_used; + +static inline int on_sig_stack(unsigned long sp) +{ + return (sp - target_sigaltstack_used.ss_sp + < target_sigaltstack_used.ss_size); +} + +static inline int sas_ss_flags(unsigned long sp) +{ + return (target_sigaltstack_used.ss_size == 0 ? SS_DISABLE + : on_sig_stack(sp) ? SS_ONSTACK : 0); +} + +static inline void target_sigemptyset(target_sigset_t *set) +{ + memset(set, 0, sizeof(*set)); +} + +void host_to_target_sigset_internal(target_sigset_t *d, + const sigset_t *s); +void target_to_host_sigset_internal(sigset_t *d, + const target_sigset_t *s); +void tswap_siginfo(target_siginfo_t *tinfo, + const target_siginfo_t *info); +void set_sigmask(const sigset_t *set); +void force_sig(int sig); +void force_sigsegv(int oldsig); +#endif diff --git a/linux-user/signal.c b/linux-user/signal.c index b283270391..0f956740ef 100644 --- a/linux-user/signal.c +++ b/linux-user/signal.c @@ -25,8 +25,9 @@ #include "qemu-common.h" #include "target_signal.h" #include "trace.h" +#include "signal-common.h" -static struct target_sigaltstack target_sigaltstack_used = { +struct target_sigaltstack target_sigaltstack_used = { .ss_sp = 0, .ss_size = 0, .ss_flags = TARGET_SS_DISABLE, @@ -82,18 +83,6 @@ static uint8_t host_to_target_signal_table[_NSIG] = { }; static uint8_t target_to_host_signal_table[_NSIG]; -static inline int on_sig_stack(unsigned long sp) -{ - return (sp - target_sigaltstack_used.ss_sp - < target_sigaltstack_used.ss_size); -} - -static inline int sas_ss_flags(unsigned long sp) -{ - return (target_sigaltstack_used.ss_size == 0 ? SS_DISABLE - : on_sig_stack(sp) ? SS_ONSTACK : 0); -} - int host_to_target_signal(int sig) { if (sig < 0 || sig >= _NSIG) @@ -108,11 +97,6 @@ int target_to_host_signal(int sig) return target_to_host_signal_table[sig]; } -static inline void target_sigemptyset(target_sigset_t *set) -{ - memset(set, 0, sizeof(*set)); -} - static inline void target_sigaddset(target_sigset_t *set, int signum) { signum--; @@ -127,8 +111,8 @@ static inline int target_sigismember(const target_sigset_t *set, int signum) return ((set->sig[signum / TARGET_NSIG_BPW] & mask) != 0); } -static void host_to_target_sigset_internal(target_sigset_t *d, - const sigset_t *s) +void host_to_target_sigset_internal(target_sigset_t *d, + const sigset_t *s) { int i; target_sigemptyset(d); @@ -149,8 +133,8 @@ void host_to_target_sigset(target_sigset_t *d, const sigset_t *s) d->sig[i] = tswapal(d1.sig[i]); } -static void target_to_host_sigset_internal(sigset_t *d, - const target_sigset_t *s) +void target_to_host_sigset_internal(sigset_t *d, + const target_sigset_t *s) { int i; sigemptyset(d); @@ -257,7 +241,7 @@ int do_sigprocmask(int how, const sigset_t *set, sigset_t *oldset) /* Just set the guest's signal mask to the specified value; the * caller is assumed to have called block_signals() already. */ -static void set_sigmask(const sigset_t *set) +void set_sigmask(const sigset_t *set) { TaskState *ts = (TaskState *)thread_cpu->opaque; @@ -344,8 +328,8 @@ static inline void host_to_target_siginfo_noswap(target_siginfo_t *tinfo, tinfo->si_code = deposit32(si_code, 16, 16, si_type); } -static void tswap_siginfo(target_siginfo_t *tinfo, - const target_siginfo_t *info) +void tswap_siginfo(target_siginfo_t *tinfo, + const target_siginfo_t *info) { int si_type = extract32(info->si_code, 16, 16); int si_code = sextract32(info->si_code, 0, 16); @@ -515,7 +499,7 @@ void signal_init(void) * also forces the signal to "not blocked, not ignored", but for QEMU * that work is done in process_pending_signals(). */ -static void force_sig(int sig) +void force_sig(int sig) { CPUState *cpu = thread_cpu; CPUArchState *env = cpu->env_ptr; @@ -534,7 +518,7 @@ static void force_sig(int sig) * at the point of failure. */ #if !defined(TARGET_RISCV) -static void force_sigsegv(int oldsig) +void force_sigsegv(int oldsig) { if (oldsig == SIGSEGV) { /* Make sure we don't try to deliver the signal again; this will @@ -7301,9 +7285,6 @@ badframe: force_sig(TARGET_SIGSEGV); return -TARGET_QEMU_ESIGRETURN; } - -#else -#error Target needs to add support for signal handling #endif static void handle_pending_signal(CPUArchState *cpu_env, int sig, diff --git a/linux-user/sparc/signal.c b/linux-user/sparc/signal.c new file mode 100644 index 0000000000..02ca338b6c --- /dev/null +++ b/linux-user/sparc/signal.c @@ -0,0 +1,18 @@ +/* + * Emulation of Linux signals + * + * Copyright (c) 2003 Fabrice Bellard + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ diff --git a/linux-user/sparc64/signal.c b/linux-user/sparc64/signal.c new file mode 100644 index 0000000000..02ca338b6c --- /dev/null +++ b/linux-user/sparc64/signal.c @@ -0,0 +1,18 @@ +/* + * Emulation of Linux signals + * + * Copyright (c) 2003 Fabrice Bellard + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ diff --git a/linux-user/tilegx/signal.c b/linux-user/tilegx/signal.c new file mode 100644 index 0000000000..02ca338b6c --- /dev/null +++ b/linux-user/tilegx/signal.c @@ -0,0 +1,18 @@ +/* + * Emulation of Linux signals + * + * Copyright (c) 2003 Fabrice Bellard + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ diff --git a/linux-user/x86_64/signal.c b/linux-user/x86_64/signal.c new file mode 100644 index 0000000000..02ca338b6c --- /dev/null +++ b/linux-user/x86_64/signal.c @@ -0,0 +1,18 @@ +/* + * Emulation of Linux signals + * + * Copyright (c) 2003 Fabrice Bellard + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ diff --git a/linux-user/xtensa/signal.c b/linux-user/xtensa/signal.c new file mode 100644 index 0000000000..02ca338b6c --- /dev/null +++ b/linux-user/xtensa/signal.c @@ -0,0 +1,18 @@ +/* + * Emulation of Linux signals + * + * Copyright (c) 2003 Fabrice Bellard + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */