From patchwork Wed Sep 29 13:05:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 514839 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:4087:0:0:0:0 with SMTP id m7csp17973jam; Wed, 29 Sep 2021 06:19:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJykb+wT3dZgQ+nLMY39QlOobEqGSZIH3RQiEd57GpfAa65ctQMz9l7uOMpjaNuBBqkfGMbt X-Received: by 2002:a5d:4d84:: with SMTP id b4mr6081931wru.258.1632921589837; Wed, 29 Sep 2021 06:19:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632921589; cv=none; d=google.com; s=arc-20160816; b=j8M6OLRMtjb35ZPgbSRnZfFddxVFqEoF71yX8ylemuDiwi4dGpJZQwqK/sQL9QvcyO hRIU3/aCFNJB2J1yqOQdhADlU7idpu34gu5GEHYE1crudHvdjVTpKuybjLSDSwRWxO2m 93ns8xmZjGpTzu6Mi2Z1V3Z2967bCMw4jBAG1FQKMTixvJ2IAQbpPqL8j2tA+BTsWsyC HExwFgcLBNJ2cbQ6N7st37BQkTpFGthKgNJDULE1RpkaOtO3+AQnDsC2kzGbfwikCIex uYNyeXkV3wDFhqqERKeeDpMdY/a4EYxKSEjRKslTXhZgzDpQCMRc7U/Z40ebq8DediRZ 5cTw== 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=OSdvdPsRcWhs1JDho/mkMSs2DLSWs6Tw0ZJBGiwu/yx/WmxzlHV19QqBPFLkVmotZ3 mowB3wShIJGTMCIzsH7hoyaYRntHrQeR/17bdg/3yALwuJe0wX8SUzNdApbba6G8inuQ FK6Rszg0VwAA6FQ84H29guW7rU0p0v3EVgBnyKdhlC0WhmfOfM2CAJ7X9fqAv0vKXFKo Zcfz5sPQCwTal2ISzF3ObsJuICFpz3jBYQxFiwi0JYsntcjB4PQ8BDLHQAyEbe/ofuhF CmygxR4oKwQ5/3NasvgJBV2a/N43crUJ2dDZYQnr2RtMuVUGDYsDEkWVTNjny+tUlTeM C1iQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=tzfUPuFw; 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 f3si2378343wrj.592.2021.09.29.06.19.49 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 29 Sep 2021 06:19:49 -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=tzfUPuFw; 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]:60960 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mVZUy-0001N5-Oy for patch@linaro.org; Wed, 29 Sep 2021 09:19:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39340) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mVZI6-00071o-0r for qemu-devel@nongnu.org; Wed, 29 Sep 2021 09:06:30 -0400 Received: from mail-ot1-x32f.google.com ([2607:f8b0:4864:20::32f]:43639) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mVZI4-0006G2-Ae for qemu-devel@nongnu.org; Wed, 29 Sep 2021 09:06:29 -0400 Received: by mail-ot1-x32f.google.com with SMTP id x33-20020a9d37a4000000b0054733a85462so2733454otb.10 for ; Wed, 29 Sep 2021 06:06:27 -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=tzfUPuFwDIZC0sVrkWiKzmHYuihHmgcxLqmwPO47eI1S3wIuU/Nl/TiVQxlYIRxjA6 YGTlZ+qYXatq4nCdERPHrzhmPxK+ayunz887oXnMOKzUSfRy68jxg2OMqkXWCJf9Dcfo 78JozUtLxzpq6qJdxjuPEFeDPLWaAJu8jTHlQWPYHb6HNnwm9rdMb1lvMz+qbX0VvO3E /SCvrLcVZFlTzWKbZDoj/QwEvj4jc98L2v68pDRSO2tc1nnV6GniHKjFRlWdSLMVbQBi i+IRduT5I8hWe0FmnxoSm0xsxOiine6lHA0eRTwuBfO7IAjMJQ7pQ5ihvD5m1jkue+qE C8YA== 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=oKx0XIDNVWvosj9a41m+Hgb8deEPUtLTBjUJcHKU6g7ifTK1pHN9FkjysWOzGIlOfF PFxOcfnv6cu+0XPW4iKPxEIKUXcoLTyZbhBFaFfWngvZZjdpAuiUfP+ITBS1C+nMAzxk hj190RNts5NGH+5F579AIkhdJPp76eoGOiZCmEeOaDDCiyA9QtRvxIsf6ubvw2UJXmly GycR5KIbeYfDB8ncmEK8vIjL+kB9SyB24A70hawmDZVfKCXMAQcjOhklsf5DBZYpNfgY smdV3ANwWfPpsAzNsBvKh6hl9wIOrFYIlnr9DRYrvQZ3RjxpIA7B61S0PeGJRwyvPdyU GGOg== X-Gm-Message-State: AOAM5335C8GwUHfTS6Iz7nc24pQLTiQVFf73FB++EDFuwXkQYXBWWc4z 1XA1WeXFv/s79jzVgbR1Hzm0LPXgpvKprw== X-Received: by 2002:a05:6830:4095:: with SMTP id x21mr4655146ott.352.1632920786837; Wed, 29 Sep 2021 06:06:26 -0700 (PDT) Received: from localhost.localdomain ([172.58.171.248]) by smtp.gmail.com with ESMTPSA id w1sm442823ote.41.2021.09.29.06.06.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Sep 2021 06:06:26 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 13/26] linux-user/microblaze: Implement setup_sigtramp Date: Wed, 29 Sep 2021 09:05:40 -0400 Message-Id: <20210929130553.121567-14-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210929130553.121567-1-richard.henderson@linaro.org> References: <20210929130553.121567-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::32f; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x32f.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: "Edgar E . Iglesias" , alex.bennee@linaro.org, laurent@vivier.eu, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= 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); +}