From patchwork Fri Sep 24 16:59:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 514591 Delivered-To: patch@linaro.org Received: by 2002:a02:c816:0:0:0:0:0 with SMTP id p22csp1681207jao; Fri, 24 Sep 2021 10:08:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzES6UR6qlmXubOyVDv/OjevONQ8FVE1QMQ+zfTfiaqpvbEr3Ivw8BU2RT0XaTmeT/Ee1qX X-Received: by 2002:a05:620a:68c:: with SMTP id f12mr12028653qkh.363.1632503296471; Fri, 24 Sep 2021 10:08:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632503296; cv=none; d=google.com; s=arc-20160816; b=bqLRif0+YGL43Sbmgyzr6qZ9sHC6en/zRC5nMQ4N+msfNzIjhG5jDaAKfI6at6Lpfr BEoCgEFqBs2XJkGB+1/UGmtvsZ/TFYj7zkdnb4lDvnkfzXX1DlsVKAVP5xZCMRC8miDw 0v8GhkKekc9gp5XqF9/0WcNnFtwgcFKEtaur9feB4w2dbGyBYQ19+CCRoxsM/Tnc74jb bcObPPEkx78daWiIEmKPMREC/qI+Dg8oMreTwSi4EVYGF4xhg4LV5YfjgirG4+JdB+XF kxD8aNx+dPb/GpTroVbNELAp7cdrewYpX+R07G2uPVd6AdagvTBA/ElnMFm7UXM9mGcs L1vQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=OeHNvhPeuZfmulgUe9ozzImEdGk/YkGYzR1u2KyMGGs=; b=YUB9L1J9fdRlIlKuQEyY6Dupo5OaFNLFaZ3/fowPn4Pb+2JYEfDwrNlBewYUbd0eq2 F7WfhO+nDbMr+DW/1vHcrRq8yCj/2PP+QdCxspJwIufwzqntjxEOkK0+uKdTsnt19eMC e2TaqllRzivCnZ6ARiOQhMx9Cjh//TMfx0w6DsNO4n/RR6I1PpAHd8o2SXJGKJ4wRDnH VUndzGoBIgt6FNb/Q4HwKMRvmh+DwR0hSmPlg3lw0CKwZm1cfjIQP3q+nGCMN8lWRmlN Xe8tfZC2g9bpYwGakRleqrdUobgc8iiIQmmeDYTBnu9+ZZE20jdMBCsAwX6dewXEqGtx X8XA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=zVH3lMoe; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id p20si6205301qvl.42.2021.09.24.10.08.16 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 Sep 2021 10:08:16 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=zVH3lMoe; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:44258 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mTogJ-0006SL-Vb for patch@linaro.org; Fri, 24 Sep 2021 13:08:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48392) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mToY2-0002fi-J1 for qemu-devel@nongnu.org; Fri, 24 Sep 2021 12:59:43 -0400 Received: from mail-qk1-x730.google.com ([2607:f8b0:4864:20::730]:37455) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mToXy-0006zQ-LN for qemu-devel@nongnu.org; Fri, 24 Sep 2021 12:59:42 -0400 Received: by mail-qk1-x730.google.com with SMTP id 73so28870149qki.4 for ; Fri, 24 Sep 2021 09:59:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=OeHNvhPeuZfmulgUe9ozzImEdGk/YkGYzR1u2KyMGGs=; b=zVH3lMoenLl4YiqnnqqgeZ7ttEm0hnZOlGueNBSeUaAjjJXy21eC9UAhtAf87totyx x0Bbn7cBm+VJzCDMbmOaW9IgG9AwV0Z8jTCZoGZS3ue0kl66al9NtKIbrAhVuBr+WRCP KHmSlRgeO3K7KYaWzUsiMEl3EtHECSG8cDd7Pgi0ubUhkEWheb+9Figdzi4qNMEA750o 7oa1scl0OEEBMdyX8IClI75CE8onpSJfS/P7xi5d8pmPyoKyWtgUi70w26vdJpQOyz/I ITvF0BZhPLRiMXAqQxu2QcW4guD02UtS4GVKIP4Fn5QOxyD8Rjjn2wvlHqNUOM8/Em1t UjLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=OeHNvhPeuZfmulgUe9ozzImEdGk/YkGYzR1u2KyMGGs=; b=4XYRImmUTxNHlg2oS/H66cCntdHzOD6PjMj/LzKgUYpyY4Wwg5VeXFZzIWXXiu2dyF kAvdstQ7S7aTEozjRPjVd1CZHxBFp+M0DsBuST7ahOLRnTL/VnZHrpe3aroIdx2RmM0d L06Oji5FFWSiMomSgZG2y3tHteN9Ozh/EMitSfY7HyGknWco7cN3Y1C534jXR9+nh/UR grp8qhFE9+PyfhfY+p2vZzCiN9GiS7vAOLMpxz4t6D9USTZc7DtduSy3lElx7az1ndtJ GG6um7I7uQApDquwfUa6yl3O1HYccSt1+6/50XerqOcOP6E9konmviV5eAFliMQEtsF1 ck2A== X-Gm-Message-State: AOAM530NspMks1JBb4bIMdYr+Me3iXnEcyc4bIp1BpMH0iEw60A0xZsf YsIF64VCxDb2NQ8AkhldbEQvtHh8sG4Prw== X-Received: by 2002:a37:c83:: with SMTP id 125mr12073152qkm.229.1632502777804; Fri, 24 Sep 2021 09:59:37 -0700 (PDT) Received: from localhost.localdomain (cpe-24-74-129-96.carolina.res.rr.com. [24.74.129.96]) by smtp.gmail.com with ESMTPSA id r13sm7141104qkk.73.2021.09.24.09.59.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Sep 2021 09:59:37 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 13/27] linux-user/microblaze: Implement setup_sigtramp Date: Fri, 24 Sep 2021 12:59:12 -0400 Message-Id: <20210924165926.752809-14-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210924165926.752809-1-richard.henderson@linaro.org> References: <20210924165926.752809-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::730; envelope-from=richard.henderson@linaro.org; helo=mail-qk1-x730.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , laurent@vivier.eu, "Edgar E . Iglesias" Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Create and record the rt signal trampoline. Cc: Edgar E. Iglesias Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- linux-user/microblaze/target_signal.h | 2 ++ linux-user/microblaze/signal.c | 24 +++++++++++++++++------- 2 files changed, 19 insertions(+), 7 deletions(-) -- 2.25.1 diff --git a/linux-user/microblaze/target_signal.h b/linux-user/microblaze/target_signal.h index 1c326296de..e8b510f6b1 100644 --- a/linux-user/microblaze/target_signal.h +++ b/linux-user/microblaze/target_signal.h @@ -21,4 +21,6 @@ typedef struct target_sigaltstack { #include "../generic/signal.h" +#define TARGET_ARCH_HAS_SIGTRAMP_PAGE 1 + #endif /* MICROBLAZE_TARGET_SIGNAL_H */ diff --git a/linux-user/microblaze/signal.c b/linux-user/microblaze/signal.c index b822679d18..8ebb6a1b7d 100644 --- a/linux-user/microblaze/signal.c +++ b/linux-user/microblaze/signal.c @@ -161,17 +161,11 @@ void setup_rt_frame(int sig, struct target_sigaction *ka, /* Kernel does not use SA_RESTORER. */ - /* addi r12, r0, __NR_sigreturn */ - __put_user(0x31800000U | TARGET_NR_rt_sigreturn, frame->tramp + 0); - /* brki r14, 0x8 */ - __put_user(0xb9cc0008U, frame->tramp + 1); - /* * Return from sighandler will jump to the tramp. * Negative 8 offset because return is rtsd r15, 8 */ - env->regs[15] = - frame_addr + offsetof(struct target_rt_sigframe, tramp) - 8; + env->regs[15] = default_rt_sigreturn - 8; /* Set up registers for signal handler */ env->regs[1] = frame_addr; @@ -220,3 +214,19 @@ long do_rt_sigreturn(CPUMBState *env) force_sig(TARGET_SIGSEGV); return -TARGET_QEMU_ESIGRETURN; } + +void setup_sigtramp(abi_ulong sigtramp_page) +{ + uint32_t *tramp = lock_user(VERIFY_WRITE, sigtramp_page, 8, 0); + assert(tramp != NULL); + + /* + * addi r12, r0, __NR_rt_sigreturn + * brki r14, 0x8 + */ + __put_user(0x31800000U | TARGET_NR_rt_sigreturn, tramp); + __put_user(0xb9cc0008U, tramp + 1); + + default_rt_sigreturn = sigtramp_page; + unlock_user(tramp, sigtramp_page, 8); +}