From patchwork Tue Jan 4 19:04:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 529870 Delivered-To: patch@linaro.org Received: by 2002:ac0:9f5c:0:0:0:0:0 with SMTP id l28csp73933imf; Tue, 4 Jan 2022 11:05:47 -0800 (PST) X-Google-Smtp-Source: ABdhPJzHBiqAvzh1uXGWBR3qxSPwa1/KVMLF06o0qimUnnczLW4bRe/M+HZzl0QzyJjNpdkGAoLz X-Received: by 2002:a25:2f4c:: with SMTP id v73mr54878801ybv.233.1641323147059; Tue, 04 Jan 2022 11:05:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1641323147; cv=none; d=google.com; s=arc-20160816; b=SWzi01eVnMLaPblEVOskiIyLDqyDeus2JDQXupHM5dR2BRQSkXM918GIJYmrYUDWZZ 9z83nQWM16TSQc+4nf/VYz4JNZadtQ5e7agPSfBd0ycdne633tn1MFd8/kf1rT5Wy/CT NDt8XO2056MHo+o14XLii6W4PA+H9/re66edinTpgfk3iyMYrhJ84TYxu/bExzBOx7au 3BfBHbv60WWISw3+hWsR3ANO4Zt/v1qpoLqfisieEdH/rsWcnc6DX8Stf2UolvaJaUjR VkHWAApLaR9rzCsVnCg1GbK64H5jrKKwL31cDNrh5inhGbwhG9KF/Ink96WZJs13uX5U tPKg== 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:message-id:date:subject:to:from:dkim-signature; bh=7lUdTNoTHxnRTzjvvQ4J1IabVe3mjQyphI5j6AoRnhQ=; b=dymIM+IcZzRUIeOWdWKSzNVzbZuMsETZ/P8mnJuVTZ5pi6mrilmtGq6DCIN56OJ1p5 9LR1sZEcK+pPTnx5kBN7KGk30VVdve83OvarvWBrtCuwKnK0y9hqqizsSSHXMJDLkw8B TrU5aQkokdX13SSdoaTK6bt+hzkLSsZXclA8er7kFacDpJ/aRh4kJgvMI+OHQVbaFLWe l6PTj0BI5OhyXROzdN/vSgZPa5fcYMWp58oi5jQLIvQbZlfX82PRkQwdmnjAHCHXy1+l AMC+tEMjfXEfKZsYnhpQKr3ZUl0V9S/RiAdu88EQK1G2PNeVhJn9nRxQLexBP1iM4kH0 TFZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Fz9PXuCF; 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=pass (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 i74si23093258yba.465.2022.01.04.11.05.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 04 Jan 2022 11:05:47 -0800 (PST) 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=pass header.i=@linaro.org header.s=google header.b=Fz9PXuCF; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:46762 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n4p7y-0004Hg-Gc for patch@linaro.org; Tue, 04 Jan 2022 14:05:46 -0500 Received: from eggs.gnu.org ([209.51.188.92]:56882) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n4p7D-0004HY-17 for qemu-devel@nongnu.org; Tue, 04 Jan 2022 14:04:59 -0500 Received: from [2607:f8b0:4864:20::1029] (port=45032 helo=mail-pj1-x1029.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n4p7B-00040S-FV for qemu-devel@nongnu.org; Tue, 04 Jan 2022 14:04:58 -0500 Received: by mail-pj1-x1029.google.com with SMTP id n30-20020a17090a5aa100b001b2b6509685so4115040pji.3 for ; Tue, 04 Jan 2022 11:04:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=7lUdTNoTHxnRTzjvvQ4J1IabVe3mjQyphI5j6AoRnhQ=; b=Fz9PXuCF9iCDVMiHrOUAzB2qP+Raz7uceAXYruB7dTzto61XYSqKAX3HJ9HH1QY9Pq mn6bmNd2qKMrFXIJdL0IxfqHiXkrtpnlneqs4wkWB5S206v31A9imxyMG6isYdWZ/Vt5 gI+MoGYTZSMGT65gCUz30e2cb0wqyMjEP739Lp10yPVvm2QnPYHQiVW13hSWKSXhGcJ3 H2sjvwuKpxwSODeBZQRwRfT2BafXG7W69lzpX6BYBfvMbtPrX/+rImh3YATdvO0o7I4Z oNDge3vBpi8lonv/cll8BieGkdCTxexMGvSJqrz1ZhmfK1p9xYFu2+Cfowq9HsOuzSjF ezgA== 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:mime-version :content-transfer-encoding; bh=7lUdTNoTHxnRTzjvvQ4J1IabVe3mjQyphI5j6AoRnhQ=; b=gbWRRDi+Y+nD2QHBJtMbBGQT4iwKGx+utaP/Ql7dosZAc226Wxpj/2Fn721BMV6peg +gAEIDhi/ntFosshAs0S7kiD/IwlijW5LwVvmHyxq5mupDPoqm26aeH6Eo9gSsSg040v 7iiBuKENzyE6fGzzWQhuUAY1DTMKvjxPRTR7y3ljAT498j4jE2qzOjsjE183SJcri2QJ qyh0AAGQWuRLPGpekeSbgQ88JdOpqwr+gxW+tK+CeFHxujw56w5HrXR6yVwpMHmrzdyk A7tPtKQxABUvb+XtVrKqdguAbtJ/JK3xY7ozBQOZ8NbYFuwXlmQF2N/Nx/tYxhYhk4KU beCQ== X-Gm-Message-State: AOAM531zUWRMgnF6CLHIFp+Og0n3ZN3beFO1IwfXSaAYFEdv5osCUVwA oF24yRcC/lDox6assgsy6CyF3IUYujPmcQ== X-Received: by 2002:a17:902:d509:b0:149:4493:ffe8 with SMTP id b9-20020a170902d50900b001494493ffe8mr49158923plg.36.1641323095871; Tue, 04 Jan 2022 11:04:55 -0800 (PST) Received: from localhost.localdomain (174-21-75-75.tukw.qwest.net. [174.21.75.75]) by smtp.gmail.com with ESMTPSA id g66sm41503573pfb.64.2022.01.04.11.04.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jan 2022 11:04:55 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH] common-user: Fix tail calls to safe_syscall_set_errno_tail Date: Tue, 4 Jan 2022 11:04:54 -0800 Message-Id: <20220104190454.542225-1-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::1029 (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::1029; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1029.google.com X-Spam_score_int: 6 X-Spam_score: 0.6 X-Spam_bar: / X-Spam_report: (0.6 / 5.0 requ) DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Vivier Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" For the ABIs in which the syscall return register is not also the first function argument register, move the errno value into the correct place. Fixes: a3310c0397e2 Reported-by: Laurent Vivier Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Tested-by: Laurent Vivier --- common-user/host/i386/safe-syscall.inc.S | 1 + common-user/host/mips/safe-syscall.inc.S | 1 + common-user/host/x86_64/safe-syscall.inc.S | 1 + 3 files changed, 3 insertions(+) diff --git a/common-user/host/i386/safe-syscall.inc.S b/common-user/host/i386/safe-syscall.inc.S index baf5400a29..9c45e56e48 100644 --- a/common-user/host/i386/safe-syscall.inc.S +++ b/common-user/host/i386/safe-syscall.inc.S @@ -120,6 +120,7 @@ safe_syscall_end: pop %ebp .cfi_adjust_cfa_offset -4 .cfi_restore ebp + mov %eax, (%esp) jmp safe_syscall_set_errno_tail .cfi_endproc diff --git a/common-user/host/mips/safe-syscall.inc.S b/common-user/host/mips/safe-syscall.inc.S index fc75a337d1..6a44614970 100644 --- a/common-user/host/mips/safe-syscall.inc.S +++ b/common-user/host/mips/safe-syscall.inc.S @@ -141,6 +141,7 @@ safe_syscall_end: 1: USE_ALT_CP(t0) SETUP_GPX(t1) SETUP_GPX64(t0, t1) + move a0, v0 PTR_LA t9, safe_syscall_set_errno_tail jr t9 diff --git a/common-user/host/x86_64/safe-syscall.inc.S b/common-user/host/x86_64/safe-syscall.inc.S index a20927a783..d1a67a303a 100644 --- a/common-user/host/x86_64/safe-syscall.inc.S +++ b/common-user/host/x86_64/safe-syscall.inc.S @@ -99,6 +99,7 @@ safe_syscall_end: 1: pop %rbp .cfi_def_cfa_offset 8 .cfi_restore rbp + mov %eax, %edi jmp safe_syscall_set_errno_tail .cfi_endproc