From patchwork Fri Jun 18 19:29: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: 463084 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:102:0:0:0:0 with SMTP id x2csp177358jao; Fri, 18 Jun 2021 12:41:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzhGBv0K9easqQIgKVvKO1fEiNita6p+44+gAlhXTdU1pe11t2Pd8rBvX/4Agn2uQBeYX5D X-Received: by 2002:a05:6e02:1284:: with SMTP id y4mr8752596ilq.240.1624045275532; Fri, 18 Jun 2021 12:41:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624045275; cv=none; d=google.com; s=arc-20160816; b=G36uLihk9v7goZPbPzK3p8mU/qRTHKYpK/FlBZ1mnSQMHpcYmbjYHPMCQaSHqQsr7t UJCqY3YGQSWgNa0aIZWC/6tusqoSRnFa0GzznMTEFMqvUfxT2ch4obLFgk7DGaOaZEau IG4kwXqafUbhI/f6Tkux96GRcCa4zEea+fimdB5fsp2fsYguzWf0gATdMvi3JxFYhIJu YS8L6kmCaNqjMUnqTvQmGRQ1faWK28Rec7U3HrkWR5AiSSQ49aFTVPt/zzsA5mAV/UfB 2tVfda4JGgbv3rXv7D2n9ywjqGBY72pQMOYBdij2As2NhBakFNlCB9ZojPKEjGgtzX/6 QAzA== 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=TA71KdY0ADT8/xQwWyVtukyaxSrQMBNG8W0Sl0VZeBM=; b=W39IXg0TUwbkDOOmQ/6dhnMJGJX1XJJVXCf31uLJzsb4BAuV5Be43UAwqY4spek12Y Z34JI1Ru6Ngh4yVXjNIWx7tKLTSnOHd2XuudqWFNfJuioiRUOARDiJv6+H2/DpgEW8wE LZtfh759T4ZlUHYcMX9C64D0ZUG3zn6wp5oWRhjIsLIK0CrpX9FX2SN3IvouncqSuYCv HU9L82neB/HRk/tlFr1rzQOGrI/wCR3QEkXioh8TkWTk9WKmK7OD2wMMj2J30SrLSYtK QIMogbzRteiC2+Wf2R5EW9+cPvPlvIgbFfljDkmbNjc1NobJmE4ozpsjExd0+L2eJ4Z1 CKeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=WCgmp3xt; 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 p24si8553927jal.79.2021.06.18.12.41.15 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 18 Jun 2021 12:41:15 -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=WCgmp3xt; 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]:34514 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1luKMd-00006d-0Y for patch@linaro.org; Fri, 18 Jun 2021 15:41:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58320) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1luKBo-0001bV-Ud for qemu-devel@nongnu.org; Fri, 18 Jun 2021 15:30:05 -0400 Received: from mail-pg1-x52f.google.com ([2607:f8b0:4864:20::52f]:38642) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1luKBk-0001Tx-C6 for qemu-devel@nongnu.org; Fri, 18 Jun 2021 15:30:04 -0400 Received: by mail-pg1-x52f.google.com with SMTP id t17so8594240pga.5 for ; Fri, 18 Jun 2021 12:29:59 -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=TA71KdY0ADT8/xQwWyVtukyaxSrQMBNG8W0Sl0VZeBM=; b=WCgmp3xtNOWyJCeVKGGBOhtZ2erCff7jAAGZlHCJ8unArE1RjHmrV69RNVbIBNSeHR vHLbrlKE9lfBqsghv9OZqXccqaglsmJPDChnldYDYELnzNafPLG1wyZByH/p1hnGUe2A Gkqp0eUc1zhqusZMyIqgeaA+0+NwdVoYYisYhKP+PrySF6i0UEb8z8tCw8sgdvv9geA9 WB43tRLRE4uTURIcGHaJktz4/Im5UGtpvlYnbB7yHaoRy9VmKTMQ7O5RV4noFDSpl38j kgTMFBXTFxM/66TrGuYkiSYF0HUIDmLKr2Hhkd7t8D9IgVPvmFipIGo0fFakxnPy7cF2 2bDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=TA71KdY0ADT8/xQwWyVtukyaxSrQMBNG8W0Sl0VZeBM=; b=gGdt3C3znC+/C4E3jauB0QSe+uqF4FfSilk4oo79VxduiktUoteh7ZDeEL9l+G4LHJ AOtwxP+IqL3cDaqS+BoOzz9dBE/9kYKUWxplBJS4wPF8ScjA5k6gJInU0tenzl+3+UlT gS4PdtG0GTLHP/HztHCBbHpzVosAJo+MXxhL8EZ0NPVgVW54WqjpQpMe7b99Z+C5hXru tvPRdME/UMr4aNif/j9+rhHc8fkQCRypJOQZSHwe2lAuWKYFJAljAyDV9xdwdf3gv+RT VoVm1N5XfArWpVsg8NAc5awjnG/QhOaUa/ISKSomL+kjpa6sLSks5zTeflTndS3eeVkB LVNw== X-Gm-Message-State: AOAM533ij5yZDalQl6TbLIHvbjKKHBikF9+h6kAkWYRb/W4kSvEjIwyr auwR8hNSugmfnrJzLq2gKTHSu2tFHLA7bw== X-Received: by 2002:aa7:9912:0:b029:2e9:c61d:2f27 with SMTP id z18-20020aa799120000b02902e9c61d2f27mr6651823pff.60.1624044599173; Fri, 18 Jun 2021 12:29:59 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id 92sm11938234pjv.29.2021.06.18.12.29.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Jun 2021 12:29:58 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 12/23] linux-user/microblaze: Implement setup_sigtramp Date: Fri, 18 Jun 2021 12:29:40 -0700 Message-Id: <20210618192951.125651-13-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210618192951.125651-1-richard.henderson@linaro.org> References: <20210618192951.125651-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::52f; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52f.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 4c483bd8c6..aa27454931 100644 --- a/linux-user/microblaze/signal.c +++ b/linux-user/microblaze/signal.c @@ -160,17 +160,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; @@ -219,3 +213,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); +}