From patchwork Wed Jun 16 01:11:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 461321 Delivered-To: patch@linaro.org Received: by 2002:a02:735a:0:0:0:0:0 with SMTP id a26csp101635jae; Tue, 15 Jun 2021 18:23:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxURvjb7Yut6yeRoeiowdR/rDmeMXijEFZYq8YR4Di1NHJxT8UVGCCErsW0+h5WRGrW+4CK X-Received: by 2002:a05:620a:1424:: with SMTP id k4mr2534357qkj.299.1623806631465; Tue, 15 Jun 2021 18:23:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623806631; cv=none; d=google.com; s=arc-20160816; b=NMqBxdr8/IlW0J3CNi7+gYKNCZS2YRBTaQC3cwEXXhJ3+FDanFXST3aCvJnxSYA39x RicdDHO740qWvXqN3U03D6HVL3P9RheuA7Jj2LkbGFEZh40VJpEPO19vNa0HeNCmNGOR w9sGuNaoZNYX5SPuvKn5/vCXvO6EJnKOwgu1Mx0/CcKufhKJpU8OhywgvZuB/iGgJko7 Yp491McyqI22Gwd48XfSKFV0jgwDy8YorubAIxra7Fhi66w0ou13du26gsYJMRcssT/1 G98qpeIDNB3iaik4Nwjm4SC8KWKYViZ03h0D6Q36JmYwP+1buADB2k3qjDSnj81ogdVH udEg== 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=9nbSdV/mD1SXmQjAVp8s+mtCkOW7kXOYfRwNUm5mNPg=; b=tHDV+HvBuaAfVV89MDufj9NAMj7DY+1m+DHfElB6s08FqiBsGjar2Zver7g41+bKlQ BegMP58S62y1+ix2sGP4JnM6IomL3hXsHovGF2IRncTgVMZV0VB66eboV+sUiDLcHzt0 Is4ilgZrc1BHTyhA2zTFt7jMoxqORG9c2NXD8Vx4SbywLUvarTF4+QIsY8Lckjkaf4k8 S3OUaNPC3BnNeObAjJ138KlVIbXD42XYMpc600shBPgzZRiG0pyK01fvzijL3VTM3Tvt /EsK4d0kyr81hARcmv95SK6XWxdtq6kFjiwz7jkAEdoK7DyCi225AHkpgxuQ8/6mh+XG ZFOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="e5/vIn2s"; 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 s11si493973qkp.244.2021.06.15.18.23.51 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 15 Jun 2021 18:23:51 -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="e5/vIn2s"; 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]:37420 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ltKHW-00022R-SR for patch@linaro.org; Tue, 15 Jun 2021 21:23:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52194) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ltK6T-0005Wn-IX for qemu-devel@nongnu.org; Tue, 15 Jun 2021 21:12:25 -0400 Received: from mail-pg1-x52e.google.com ([2607:f8b0:4864:20::52e]:40543) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ltK6M-0008Qv-T5 for qemu-devel@nongnu.org; Tue, 15 Jun 2021 21:12:25 -0400 Received: by mail-pg1-x52e.google.com with SMTP id m2so573653pgk.7 for ; Tue, 15 Jun 2021 18:12:18 -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=9nbSdV/mD1SXmQjAVp8s+mtCkOW7kXOYfRwNUm5mNPg=; b=e5/vIn2su3+gLCLIJpe0NCHvkWkgi7pgf+12oJ/0O0AzmLIgRoLjgPknrwRhaKYqzD ogqjDisC9VjAH6K7t7yN3+AOx+/M4cm5RAiiiUOWUwDjOj+IA44oQQBso9i58w+Edxhy zbnEL1KMLz690WDVAYKWus4TUkudIXc4SwPbumLgxNuXGemiDjUTpiLfdldX1WI0UTCE lwQi9WK1fmrInSGi1KQajI5KeL7yE14PgEfhiwKiSX90I1EkwXQ7v2xbTSymy+mAVq57 enqPqJdPqfgACiKikQw6e8d8458archYR/3yF6DWNrMtwmWPXuHgV/bP2DkJWnVnWKof rWGg== 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=9nbSdV/mD1SXmQjAVp8s+mtCkOW7kXOYfRwNUm5mNPg=; b=kApfI8OpvmI2tfTYA/gbcVuLeY5b1ZMMxr3jvFMGtuWosJe9YZCmWNNBH4K2OyslPQ xe1/qy7udMkqDcsa6c7AAx/ecIxFu+bduUUL3FFPvYS+87SEumx2g2/bu/6J3ihZiA8r Gnh1KYGeroCieCZur8xOK2u0WvT+2VV+4b0e1fQMjKOFy5sLC18VTC9RUrxHu+cBFHKj vnBVT4TzxsiX8GSqVX8iCG2pXIGcKGA8meN2sF3cxUdXTlmS4EMgKstNoddPhtuINrta ps/DOI03EO8YzfoE2CjHtw8nOaAx4mwBrdH7PfCCwmRVIfz2UhOBWm8tc8Zq/trjzTf9 ZjHw== X-Gm-Message-State: AOAM531r8obNUEinpHrPYDij//LZRkW9yko+4O6kGo8aIR5SrO0jeKKp 9FKqKHb5LLL10LtmB8CKXN2LbJUU4bXsqA== X-Received: by 2002:a05:6a00:7ca:b029:2fc:daf6:d0f0 with SMTP id n10-20020a056a0007cab02902fcdaf6d0f0mr1943820pfu.15.1623805937523; Tue, 15 Jun 2021 18:12:17 -0700 (PDT) Received: from localhost.localdomain (174-21-70-228.tukw.qwest.net. [174.21.70.228]) by smtp.gmail.com with ESMTPSA id y18sm305297pgk.53.2021.06.15.18.12.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Jun 2021 18:12:17 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 11/21] linux-user/microblaze: Implement setup_sigtramp Date: Tue, 15 Jun 2021 18:11:59 -0700 Message-Id: <20210616011209.1446045-12-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210616011209.1446045-1-richard.henderson@linaro.org> References: <20210616011209.1446045-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::52e; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52e.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 Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Create and record the rt signal trampoline. Cc: Edgar E. Iglesias 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 Reviewed-by: Philippe Mathieu-Daudé 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); +}