From patchwork Tue Nov 23 17:37:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 519323 Delivered-To: patch@linaro.org Received: by 2002:ac0:c605:0:0:0:0:0 with SMTP id p5csp8977225imj; Tue, 23 Nov 2021 09:41:25 -0800 (PST) X-Google-Smtp-Source: ABdhPJyJx1nmOmq8SJndRyjRv8JhHf4zJAMO6w66MjK3B6NenpqBVtHtpt/Khu1/xsQxIqx0/U2X X-Received: by 2002:a05:6122:1782:: with SMTP id o2mr13765522vkf.3.1637689284947; Tue, 23 Nov 2021 09:41:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1637689284; cv=none; d=google.com; s=arc-20160816; b=VRhNOORiY6khEVrbzHj+RisZ/BU/kKsXM1rL7x9BC38xD1j/s8Re8AKRua2W+vJC41 zgq+doIKcSUwnke8YmRmjhQZvL5wzP78HKqUCDjMihr/FVz2q2wLu10Bv3YTBIcdza8q U51XqsmIP6ksAP+4IUJ2ddOQbCk7kaVo1GtILfsj1ZTvAgH+qQNs2F7YRBkYwXX/4gIM jJimxt9ItJbQTLmam3FCmOhaKtlihK3eL1muhRTFihpuVT6rAkULoiXXvwNXFhN3of74 SD4Ww8mRhFwKIlPZi9lFCOoq3Zpn49wgfHpT1x9QbzZvnC/h/74SMbmyPWTLW7ueT0/b /L1Q== 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=nekW1+2ofx7NhoJUSWJ5yr+1szG0GNfCPTwQMGmuflI=; b=eNIjdMDD3xWR/ZuFxrKh5SES9KUT5mLNMarcb2oJHeRkg8YIC+hszeyxF96S6ZcToY Mg/Y6xlGdKZcbWydA0ynN/14ZeEo7v36W7kkqWbf+VEQZNw5WIVZtDS7c+Rl2LbywEXQ yWIZL/FwhcbomobgIlaMpEZ4yHn0B/1UTztG2vbJ88S4/Ob20hP+gOAlF98M9o/CLOPV hhwRhCWGHrcJHAFhg7R4yZGiJMiF2bth0PK+2LMLe69oGqfqAHVf3o0isE80HYwQO5NE phLx2MtbziwlRRIAJZlO86erjcTJulkoR8ga6dtlH3Y9hyMFEB74w5OWD7zCwM5VrJO5 /6Jw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=DTqe8a70; 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 t22si11040929vsk.352.2021.11.23.09.41.24 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 23 Nov 2021 09:41:24 -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=fail header.i=@linaro.org header.s=google header.b=DTqe8a70; 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]:36724 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mpZnI-0000uQ-B9 for patch@linaro.org; Tue, 23 Nov 2021 12:41:24 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52208) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mpZkA-0003zk-MP for qemu-devel@nongnu.org; Tue, 23 Nov 2021 12:38:10 -0500 Received: from [2a00:1450:4864:20::334] (port=37571 helo=mail-wm1-x334.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mpZk7-0004zG-Bj for qemu-devel@nongnu.org; Tue, 23 Nov 2021 12:38:10 -0500 Received: by mail-wm1-x334.google.com with SMTP id k37-20020a05600c1ca500b00330cb84834fso3014145wms.2 for ; Tue, 23 Nov 2021 09:38:06 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=nekW1+2ofx7NhoJUSWJ5yr+1szG0GNfCPTwQMGmuflI=; b=DTqe8a70YFk8gxQHvpaZk7OtIbjjOzSIRAssl6QMK04bG9V1uE4jInQuuRT0sZJ0Ws omsMtqJx/vh4t+GOFVO9wWNAeGKEIqu1FTu8J6pBvPBY5h5DvfO9xwK5Um2iuBA042UT Dj94tnFcWwNPyvBtVT4AByk6QnqGX413ebNtxb8Fjc/yxmhyRTkUSD9DPIg3OrLKqPl2 G5tqD5pGWoHkP/NjB72eIFjDJk0AXbYM1Q6giDD0hWQwHTQz4WwLqtMYiIovlzaixi9Q tR9Qa2lufssjpqek7l/C35saitJzjz4sEpfb9Bo8fOVb2AyF6o5va1DzhX6+oqElkTfJ TIxQ== 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=nekW1+2ofx7NhoJUSWJ5yr+1szG0GNfCPTwQMGmuflI=; b=YLzlGayAAxd1C+cz4lXQyKxLMwpz1eVH5QHAEGdSMpfuTGvn0GPRr/coh0To1KmjOC fg0EiRXR1zz0xi1HH9lHNSUIMrGEF/Kh85LnSiw/PUhTukXLSyQsElawUdvPTB1SiL2v JK3hvhcRuidIXC7qKdmQiBep8ydpBUvMT5RuQ8I0GzUi+uMi2UqMbvw5kKrTBL5McSxO pIz+boIisR3S30JXA2v5YaISsnbH5Aj6VMA6RTba1H4LZe4hsHYc9B5c3A5blEDWprcK l9PNsVPOjtG2lk4XCaeRs7RBmQlFnbvTXwefhJ+aDuww6PyXiR0Ht4cccj+ukMjLcurD oi0g== X-Gm-Message-State: AOAM532WfOWttNRoMMYJwW4zo7XQLFN0O88Z/RNMGempCaQyDeCDvZfF aMZ0hg8tu37sM5lDCk/prw23JBnZICSl74aKJLI= X-Received: by 2002:a05:600c:3584:: with SMTP id p4mr5311510wmq.65.1637689085106; Tue, 23 Nov 2021 09:38:05 -0800 (PST) Received: from cloudburst.home (149.164.14.37.dynamic.jazztel.es. [37.14.164.149]) by smtp.gmail.com with ESMTPSA id n13sm13054883wrt.44.2021.11.23.09.38.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Nov 2021 09:38:04 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v6 01/16] linux-user: Untabify all safe-syscall.inc.S Date: Tue, 23 Nov 2021 18:37:44 +0100 Message-Id: <20211123173759.1383510-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211123173759.1383510-1-richard.henderson@linaro.org> References: <20211123173759.1383510-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::334 (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x334.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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, PDS_HP_HELO_NORDNS=0.001, 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: Peter Maydell , laurent@vivier.eu, imp@bsdimp.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Suggested-by: Peter Maydell Signed-off-by: Richard Henderson Reviewed-by: Warner Losh --- linux-user/host/aarch64/safe-syscall.inc.S | 110 +++++++------- linux-user/host/arm/safe-syscall.inc.S | 134 ++++++++--------- linux-user/host/i386/safe-syscall.inc.S | 158 ++++++++++----------- linux-user/host/ppc64/safe-syscall.inc.S | 134 ++++++++--------- linux-user/host/riscv/safe-syscall.inc.S | 114 +++++++-------- linux-user/host/s390x/safe-syscall.inc.S | 140 +++++++++--------- linux-user/host/x86_64/safe-syscall.inc.S | 2 +- 7 files changed, 396 insertions(+), 396 deletions(-) diff --git a/linux-user/host/aarch64/safe-syscall.inc.S b/linux-user/host/aarch64/safe-syscall.inc.S index bc1f5a9792..e2e726ef55 100644 --- a/linux-user/host/aarch64/safe-syscall.inc.S +++ b/linux-user/host/aarch64/safe-syscall.inc.S @@ -10,66 +10,66 @@ * See the COPYING file in the top-level directory. */ - .global safe_syscall_base - .global safe_syscall_start - .global safe_syscall_end - .type safe_syscall_base, #function - .type safe_syscall_start, #function - .type safe_syscall_end, #function + .global safe_syscall_base + .global safe_syscall_start + .global safe_syscall_end + .type safe_syscall_base, #function + .type safe_syscall_start, #function + .type safe_syscall_end, #function - /* This is the entry point for making a system call. The calling - * convention here is that of a C varargs function with the - * first argument an 'int *' to the signal_pending flag, the - * second one the system call number (as a 'long'), and all further - * arguments being syscall arguments (also 'long'). - * We return a long which is the syscall's return value, which - * may be negative-errno on failure. Conversion to the - * -1-and-errno-set convention is done by the calling wrapper. - */ + /* This is the entry point for making a system call. The calling + * convention here is that of a C varargs function with the + * first argument an 'int *' to the signal_pending flag, the + * second one the system call number (as a 'long'), and all further + * arguments being syscall arguments (also 'long'). + * We return a long which is the syscall's return value, which + * may be negative-errno on failure. Conversion to the + * -1-and-errno-set convention is done by the calling wrapper. + */ safe_syscall_base: - .cfi_startproc - /* The syscall calling convention isn't the same as the - * C one: - * we enter with x0 == *signal_pending - * x1 == syscall number - * x2 ... x7, (stack) == syscall arguments - * and return the result in x0 - * and the syscall instruction needs - * x8 == syscall number - * x0 ... x6 == syscall arguments - * and returns the result in x0 - * Shuffle everything around appropriately. - */ - mov x9, x0 /* signal_pending pointer */ - mov x8, x1 /* syscall number */ - mov x0, x2 /* syscall arguments */ - mov x1, x3 - mov x2, x4 - mov x3, x5 - mov x4, x6 - mov x5, x7 - ldr x6, [sp] + .cfi_startproc + /* The syscall calling convention isn't the same as the + * C one: + * we enter with x0 == *signal_pending + * x1 == syscall number + * x2 ... x7, (stack) == syscall arguments + * and return the result in x0 + * and the syscall instruction needs + * x8 == syscall number + * x0 ... x6 == syscall arguments + * and returns the result in x0 + * Shuffle everything around appropriately. + */ + mov x9, x0 /* signal_pending pointer */ + mov x8, x1 /* syscall number */ + mov x0, x2 /* syscall arguments */ + mov x1, x3 + mov x2, x4 + mov x3, x5 + mov x4, x6 + mov x5, x7 + ldr x6, [sp] - /* This next sequence of code works in conjunction with the - * rewind_if_safe_syscall_function(). If a signal is taken - * and the interrupted PC is anywhere between 'safe_syscall_start' - * and 'safe_syscall_end' then we rewind it to 'safe_syscall_start'. - * The code sequence must therefore be able to cope with this, and - * the syscall instruction must be the final one in the sequence. - */ + /* This next sequence of code works in conjunction with the + * rewind_if_safe_syscall_function(). If a signal is taken + * and the interrupted PC is anywhere between 'safe_syscall_start' + * and 'safe_syscall_end' then we rewind it to 'safe_syscall_start'. + * The code sequence must therefore be able to cope with this, and + * the syscall instruction must be the final one in the sequence. + */ safe_syscall_start: - /* if signal_pending is non-zero, don't do the call */ - ldr w10, [x9] - cbnz w10, 0f - svc 0x0 + /* if signal_pending is non-zero, don't do the call */ + ldr w10, [x9] + cbnz w10, 0f + svc 0x0 safe_syscall_end: - /* code path for having successfully executed the syscall */ - ret + /* code path for having successfully executed the syscall */ + ret 0: - /* code path when we didn't execute the syscall */ - mov x0, #-TARGET_ERESTARTSYS - ret - .cfi_endproc + /* code path when we didn't execute the syscall */ + mov x0, #-TARGET_ERESTARTSYS + ret + .cfi_endproc - .size safe_syscall_base, .-safe_syscall_base + .size safe_syscall_base, .-safe_syscall_base diff --git a/linux-user/host/arm/safe-syscall.inc.S b/linux-user/host/arm/safe-syscall.inc.S index 88c4958504..1f1ee8327b 100644 --- a/linux-user/host/arm/safe-syscall.inc.S +++ b/linux-user/host/arm/safe-syscall.inc.S @@ -10,81 +10,81 @@ * See the COPYING file in the top-level directory. */ - .global safe_syscall_base - .global safe_syscall_start - .global safe_syscall_end - .type safe_syscall_base, %function + .global safe_syscall_base + .global safe_syscall_start + .global safe_syscall_end + .type safe_syscall_base, %function - .cfi_sections .debug_frame + .cfi_sections .debug_frame - .text - .syntax unified - .arm - .align 2 + .text + .syntax unified + .arm + .align 2 - /* This is the entry point for making a system call. The calling - * convention here is that of a C varargs function with the - * first argument an 'int *' to the signal_pending flag, the - * second one the system call number (as a 'long'), and all further - * arguments being syscall arguments (also 'long'). - * We return a long which is the syscall's return value, which - * may be negative-errno on failure. Conversion to the - * -1-and-errno-set convention is done by the calling wrapper. - */ + /* This is the entry point for making a system call. The calling + * convention here is that of a C varargs function with the + * first argument an 'int *' to the signal_pending flag, the + * second one the system call number (as a 'long'), and all further + * arguments being syscall arguments (also 'long'). + * We return a long which is the syscall's return value, which + * may be negative-errno on failure. Conversion to the + * -1-and-errno-set convention is done by the calling wrapper. + */ safe_syscall_base: - .fnstart - .cfi_startproc - mov r12, sp /* save entry stack */ - push { r4, r5, r6, r7, r8, lr } - .save { r4, r5, r6, r7, r8, lr } - .cfi_adjust_cfa_offset 24 - .cfi_rel_offset r4, 0 - .cfi_rel_offset r5, 4 - .cfi_rel_offset r6, 8 - .cfi_rel_offset r7, 12 - .cfi_rel_offset r8, 16 - .cfi_rel_offset lr, 20 + .fnstart + .cfi_startproc + mov r12, sp /* save entry stack */ + push { r4, r5, r6, r7, r8, lr } + .save { r4, r5, r6, r7, r8, lr } + .cfi_adjust_cfa_offset 24 + .cfi_rel_offset r4, 0 + .cfi_rel_offset r5, 4 + .cfi_rel_offset r6, 8 + .cfi_rel_offset r7, 12 + .cfi_rel_offset r8, 16 + .cfi_rel_offset lr, 20 - /* The syscall calling convention isn't the same as the C one: - * we enter with r0 == *signal_pending - * r1 == syscall number - * r2, r3, [sp+0] ... [sp+12] == syscall arguments - * and return the result in r0 - * and the syscall instruction needs - * r7 == syscall number - * r0 ... r6 == syscall arguments - * and returns the result in r0 - * Shuffle everything around appropriately. - * Note the 16 bytes that we pushed to save registers. - */ - mov r8, r0 /* copy signal_pending */ - mov r7, r1 /* syscall number */ - mov r0, r2 /* syscall args */ - mov r1, r3 - ldm r12, { r2, r3, r4, r5, r6 } + /* The syscall calling convention isn't the same as the C one: + * we enter with r0 == *signal_pending + * r1 == syscall number + * r2, r3, [sp+0] ... [sp+12] == syscall arguments + * and return the result in r0 + * and the syscall instruction needs + * r7 == syscall number + * r0 ... r6 == syscall arguments + * and returns the result in r0 + * Shuffle everything around appropriately. + * Note the 16 bytes that we pushed to save registers. + */ + mov r8, r0 /* copy signal_pending */ + mov r7, r1 /* syscall number */ + mov r0, r2 /* syscall args */ + mov r1, r3 + ldm r12, { r2, r3, r4, r5, r6 } - /* This next sequence of code works in conjunction with the - * rewind_if_safe_syscall_function(). If a signal is taken - * and the interrupted PC is anywhere between 'safe_syscall_start' - * and 'safe_syscall_end' then we rewind it to 'safe_syscall_start'. - * The code sequence must therefore be able to cope with this, and - * the syscall instruction must be the final one in the sequence. - */ + /* This next sequence of code works in conjunction with the + * rewind_if_safe_syscall_function(). If a signal is taken + * and the interrupted PC is anywhere between 'safe_syscall_start' + * and 'safe_syscall_end' then we rewind it to 'safe_syscall_start'. + * The code sequence must therefore be able to cope with this, and + * the syscall instruction must be the final one in the sequence. + */ safe_syscall_start: - /* if signal_pending is non-zero, don't do the call */ - ldr r12, [r8] /* signal_pending */ - tst r12, r12 - bne 1f - swi 0 + /* if signal_pending is non-zero, don't do the call */ + ldr r12, [r8] /* signal_pending */ + tst r12, r12 + bne 1f + swi 0 safe_syscall_end: - /* code path for having successfully executed the syscall */ - pop { r4, r5, r6, r7, r8, pc } + /* code path for having successfully executed the syscall */ + pop { r4, r5, r6, r7, r8, pc } 1: - /* code path when we didn't execute the syscall */ - ldr r0, =-TARGET_ERESTARTSYS - pop { r4, r5, r6, r7, r8, pc } - .fnend - .cfi_endproc + /* code path when we didn't execute the syscall */ + ldr r0, =-TARGET_ERESTARTSYS + pop { r4, r5, r6, r7, r8, pc } + .fnend + .cfi_endproc - .size safe_syscall_base, .-safe_syscall_base + .size safe_syscall_base, .-safe_syscall_base diff --git a/linux-user/host/i386/safe-syscall.inc.S b/linux-user/host/i386/safe-syscall.inc.S index 9e58fc6504..e425aa54d8 100644 --- a/linux-user/host/i386/safe-syscall.inc.S +++ b/linux-user/host/i386/safe-syscall.inc.S @@ -10,91 +10,91 @@ * See the COPYING file in the top-level directory. */ - .global safe_syscall_base - .global safe_syscall_start - .global safe_syscall_end - .type safe_syscall_base, @function + .global safe_syscall_base + .global safe_syscall_start + .global safe_syscall_end + .type safe_syscall_base, @function - /* This is the entry point for making a system call. The calling - * convention here is that of a C varargs function with the - * first argument an 'int *' to the signal_pending flag, the - * second one the system call number (as a 'long'), and all further - * arguments being syscall arguments (also 'long'). - * We return a long which is the syscall's return value, which - * may be negative-errno on failure. Conversion to the - * -1-and-errno-set convention is done by the calling wrapper. - */ + /* This is the entry point for making a system call. The calling + * convention here is that of a C varargs function with the + * first argument an 'int *' to the signal_pending flag, the + * second one the system call number (as a 'long'), and all further + * arguments being syscall arguments (also 'long'). + * We return a long which is the syscall's return value, which + * may be negative-errno on failure. Conversion to the + * -1-and-errno-set convention is done by the calling wrapper. + */ safe_syscall_base: - .cfi_startproc - push %ebp - .cfi_adjust_cfa_offset 4 - .cfi_rel_offset ebp, 0 - push %esi - .cfi_adjust_cfa_offset 4 - .cfi_rel_offset esi, 0 - push %edi - .cfi_adjust_cfa_offset 4 - .cfi_rel_offset edi, 0 - push %ebx - .cfi_adjust_cfa_offset 4 - .cfi_rel_offset ebx, 0 + .cfi_startproc + push %ebp + .cfi_adjust_cfa_offset 4 + .cfi_rel_offset ebp, 0 + push %esi + .cfi_adjust_cfa_offset 4 + .cfi_rel_offset esi, 0 + push %edi + .cfi_adjust_cfa_offset 4 + .cfi_rel_offset edi, 0 + push %ebx + .cfi_adjust_cfa_offset 4 + .cfi_rel_offset ebx, 0 - /* The syscall calling convention isn't the same as the C one: - * we enter with 0(%esp) == return address - * 4(%esp) == *signal_pending - * 8(%esp) == syscall number - * 12(%esp) ... 32(%esp) == syscall arguments - * and return the result in eax - * and the syscall instruction needs - * eax == syscall number - * ebx, ecx, edx, esi, edi, ebp == syscall arguments - * and returns the result in eax - * Shuffle everything around appropriately. - * Note the 16 bytes that we pushed to save registers. - */ - mov 12+16(%esp), %ebx /* the syscall arguments */ - mov 16+16(%esp), %ecx - mov 20+16(%esp), %edx - mov 24+16(%esp), %esi - mov 28+16(%esp), %edi - mov 32+16(%esp), %ebp + /* The syscall calling convention isn't the same as the C one: + * we enter with 0(%esp) == return address + * 4(%esp) == *signal_pending + * 8(%esp) == syscall number + * 12(%esp) ... 32(%esp) == syscall arguments + * and return the result in eax + * and the syscall instruction needs + * eax == syscall number + * ebx, ecx, edx, esi, edi, ebp == syscall arguments + * and returns the result in eax + * Shuffle everything around appropriately. + * Note the 16 bytes that we pushed to save registers. + */ + mov 12+16(%esp), %ebx /* the syscall arguments */ + mov 16+16(%esp), %ecx + mov 20+16(%esp), %edx + mov 24+16(%esp), %esi + mov 28+16(%esp), %edi + mov 32+16(%esp), %ebp - /* This next sequence of code works in conjunction with the - * rewind_if_safe_syscall_function(). If a signal is taken - * and the interrupted PC is anywhere between 'safe_syscall_start' - * and 'safe_syscall_end' then we rewind it to 'safe_syscall_start'. - * The code sequence must therefore be able to cope with this, and - * the syscall instruction must be the final one in the sequence. - */ + /* This next sequence of code works in conjunction with the + * rewind_if_safe_syscall_function(). If a signal is taken + * and the interrupted PC is anywhere between 'safe_syscall_start' + * and 'safe_syscall_end' then we rewind it to 'safe_syscall_start'. + * The code sequence must therefore be able to cope with this, and + * the syscall instruction must be the final one in the sequence. + */ safe_syscall_start: - /* if signal_pending is non-zero, don't do the call */ - mov 4+16(%esp), %eax /* signal_pending */ - cmpl $0, (%eax) - jnz 1f - mov 8+16(%esp), %eax /* syscall number */ - int $0x80 + /* if signal_pending is non-zero, don't do the call */ + mov 4+16(%esp), %eax /* signal_pending */ + cmpl $0, (%eax) + jnz 1f + mov 8+16(%esp), %eax /* syscall number */ + int $0x80 safe_syscall_end: - /* code path for having successfully executed the syscall */ - pop %ebx - .cfi_remember_state - .cfi_adjust_cfa_offset -4 - .cfi_restore ebx - pop %edi - .cfi_adjust_cfa_offset -4 - .cfi_restore edi - pop %esi - .cfi_adjust_cfa_offset -4 - .cfi_restore esi - pop %ebp - .cfi_adjust_cfa_offset -4 - .cfi_restore ebp - ret + /* code path for having successfully executed the syscall */ + pop %ebx + .cfi_remember_state + .cfi_adjust_cfa_offset -4 + .cfi_restore ebx + pop %edi + .cfi_adjust_cfa_offset -4 + .cfi_restore edi + pop %esi + .cfi_adjust_cfa_offset -4 + .cfi_restore esi + pop %ebp + .cfi_adjust_cfa_offset -4 + .cfi_restore ebp + ret 1: - /* code path when we didn't execute the syscall */ - .cfi_restore_state - mov $-TARGET_ERESTARTSYS, %eax - jmp safe_syscall_end - .cfi_endproc + /* code path when we didn't execute the syscall */ + .cfi_restore_state + mov $-TARGET_ERESTARTSYS, %eax + jmp safe_syscall_end + .cfi_endproc - .size safe_syscall_base, .-safe_syscall_base + .size safe_syscall_base, .-safe_syscall_base diff --git a/linux-user/host/ppc64/safe-syscall.inc.S b/linux-user/host/ppc64/safe-syscall.inc.S index 875133173b..4b57440585 100644 --- a/linux-user/host/ppc64/safe-syscall.inc.S +++ b/linux-user/host/ppc64/safe-syscall.inc.S @@ -10,87 +10,87 @@ * See the COPYING file in the top-level directory. */ - .global safe_syscall_base - .global safe_syscall_start - .global safe_syscall_end - .type safe_syscall_base, @function + .global safe_syscall_base + .global safe_syscall_start + .global safe_syscall_end + .type safe_syscall_base, @function - .text + .text - /* This is the entry point for making a system call. The calling - * convention here is that of a C varargs function with the - * first argument an 'int *' to the signal_pending flag, the - * second one the system call number (as a 'long'), and all further - * arguments being syscall arguments (also 'long'). - * We return a long which is the syscall's return value, which - * may be negative-errno on failure. Conversion to the - * -1-and-errno-set convention is done by the calling wrapper. - */ + /* This is the entry point for making a system call. The calling + * convention here is that of a C varargs function with the + * first argument an 'int *' to the signal_pending flag, the + * second one the system call number (as a 'long'), and all further + * arguments being syscall arguments (also 'long'). + * We return a long which is the syscall's return value, which + * may be negative-errno on failure. Conversion to the + * -1-and-errno-set convention is done by the calling wrapper. + */ #if _CALL_ELF == 2 safe_syscall_base: - .cfi_startproc - .localentry safe_syscall_base,0 + .cfi_startproc + .localentry safe_syscall_base,0 #else - .section ".opd","aw" - .align 3 + .section ".opd","aw" + .align 3 safe_syscall_base: - .quad .L.safe_syscall_base,.TOC.@tocbase,0 - .previous + .quad .L.safe_syscall_base,.TOC.@tocbase,0 + .previous .L.safe_syscall_base: - .cfi_startproc + .cfi_startproc #endif - /* We enter with r3 == *signal_pending - * r4 == syscall number - * r5 ... r10 == syscall arguments - * and return the result in r3 - * and the syscall instruction needs - * r0 == syscall number - * r3 ... r8 == syscall arguments - * and returns the result in r3 - * Shuffle everything around appropriately. - */ - std 14, 16(1) /* Preserve r14 in SP+16 */ - .cfi_offset 14, 16 - mr 14, 3 /* signal_pending */ - mr 0, 4 /* syscall number */ - mr 3, 5 /* syscall arguments */ - mr 4, 6 - mr 5, 7 - mr 6, 8 - mr 7, 9 - mr 8, 10 + /* We enter with r3 == *signal_pending + * r4 == syscall number + * r5 ... r10 == syscall arguments + * and return the result in r3 + * and the syscall instruction needs + * r0 == syscall number + * r3 ... r8 == syscall arguments + * and returns the result in r3 + * Shuffle everything around appropriately. + */ + std 14, 16(1) /* Preserve r14 in SP+16 */ + .cfi_offset 14, 16 + mr 14, 3 /* signal_pending */ + mr 0, 4 /* syscall number */ + mr 3, 5 /* syscall arguments */ + mr 4, 6 + mr 5, 7 + mr 6, 8 + mr 7, 9 + mr 8, 10 - /* This next sequence of code works in conjunction with the - * rewind_if_safe_syscall_function(). If a signal is taken - * and the interrupted PC is anywhere between 'safe_syscall_start' - * and 'safe_syscall_end' then we rewind it to 'safe_syscall_start'. - * The code sequence must therefore be able to cope with this, and - * the syscall instruction must be the final one in the sequence. - */ + /* This next sequence of code works in conjunction with the + * rewind_if_safe_syscall_function(). If a signal is taken + * and the interrupted PC is anywhere between 'safe_syscall_start' + * and 'safe_syscall_end' then we rewind it to 'safe_syscall_start'. + * The code sequence must therefore be able to cope with this, and + * the syscall instruction must be the final one in the sequence. + */ safe_syscall_start: - /* if signal_pending is non-zero, don't do the call */ - lwz 12, 0(14) - cmpwi 0, 12, 0 - bne- 0f - sc + /* if signal_pending is non-zero, don't do the call */ + lwz 12, 0(14) + cmpwi 0, 12, 0 + bne- 0f + sc safe_syscall_end: - /* code path when we did execute the syscall */ - ld 14, 16(1) /* restore r14 to its original value */ - bnslr+ + /* code path when we did execute the syscall */ + ld 14, 16(1) /* restore r14 to its original value */ + bnslr+ - /* syscall failed; return negative errno */ - neg 3, 3 - blr + /* syscall failed; return negative errno */ + neg 3, 3 + blr - /* code path when we didn't execute the syscall */ -0: addi 3, 0, -TARGET_ERESTARTSYS - ld 14, 16(1) /* restore r14 to its original value */ - blr - .cfi_endproc + /* code path when we didn't execute the syscall */ +0: addi 3, 0, -TARGET_ERESTARTSYS + ld 14, 16(1) /* restore r14 to its original value */ + blr + .cfi_endproc #if _CALL_ELF == 2 - .size safe_syscall_base, .-safe_syscall_base + .size safe_syscall_base, .-safe_syscall_base #else - .size safe_syscall_base, .-.L.safe_syscall_base - .size .L.safe_syscall_base, .-.L.safe_syscall_base + .size safe_syscall_base, .-.L.safe_syscall_base + .size .L.safe_syscall_base, .-.L.safe_syscall_base #endif diff --git a/linux-user/host/riscv/safe-syscall.inc.S b/linux-user/host/riscv/safe-syscall.inc.S index 9ca3fbfd1e..95c4832de2 100644 --- a/linux-user/host/riscv/safe-syscall.inc.S +++ b/linux-user/host/riscv/safe-syscall.inc.S @@ -10,68 +10,68 @@ * See the COPYING file in the top-level directory. */ - .global safe_syscall_base - .global safe_syscall_start - .global safe_syscall_end - .type safe_syscall_base, @function - .type safe_syscall_start, @function - .type safe_syscall_end, @function + .global safe_syscall_base + .global safe_syscall_start + .global safe_syscall_end + .type safe_syscall_base, @function + .type safe_syscall_start, @function + .type safe_syscall_end, @function - /* - * This is the entry point for making a system call. The calling - * convention here is that of a C varargs function with the - * first argument an 'int *' to the signal_pending flag, the - * second one the system call number (as a 'long'), and all further - * arguments being syscall arguments (also 'long'). - * We return a long which is the syscall's return value, which - * may be negative-errno on failure. Conversion to the - * -1-and-errno-set convention is done by the calling wrapper. - */ + /* + * This is the entry point for making a system call. The calling + * convention here is that of a C varargs function with the + * first argument an 'int *' to the signal_pending flag, the + * second one the system call number (as a 'long'), and all further + * arguments being syscall arguments (also 'long'). + * We return a long which is the syscall's return value, which + * may be negative-errno on failure. Conversion to the + * -1-and-errno-set convention is done by the calling wrapper. + */ safe_syscall_base: - .cfi_startproc - /* - * The syscall calling convention is nearly the same as C: - * we enter with a0 == *signal_pending - * a1 == syscall number - * a2 ... a7 == syscall arguments - * and return the result in a0 - * and the syscall instruction needs - * a7 == syscall number - * a0 ... a5 == syscall arguments - * and returns the result in a0 - * Shuffle everything around appropriately. - */ - mv t0, a0 /* signal_pending pointer */ - mv t1, a1 /* syscall number */ - mv a0, a2 /* syscall arguments */ - mv a1, a3 - mv a2, a4 - mv a3, a5 - mv a4, a6 - mv a5, a7 - mv a7, t1 + .cfi_startproc + /* + * The syscall calling convention is nearly the same as C: + * we enter with a0 == *signal_pending + * a1 == syscall number + * a2 ... a7 == syscall arguments + * and return the result in a0 + * and the syscall instruction needs + * a7 == syscall number + * a0 ... a5 == syscall arguments + * and returns the result in a0 + * Shuffle everything around appropriately. + */ + mv t0, a0 /* signal_pending pointer */ + mv t1, a1 /* syscall number */ + mv a0, a2 /* syscall arguments */ + mv a1, a3 + mv a2, a4 + mv a3, a5 + mv a4, a6 + mv a5, a7 + mv a7, t1 - /* - * This next sequence of code works in conjunction with the - * rewind_if_safe_syscall_function(). If a signal is taken - * and the interrupted PC is anywhere between 'safe_syscall_start' - * and 'safe_syscall_end' then we rewind it to 'safe_syscall_start'. - * The code sequence must therefore be able to cope with this, and - * the syscall instruction must be the final one in the sequence. - */ + /* + * This next sequence of code works in conjunction with the + * rewind_if_safe_syscall_function(). If a signal is taken + * and the interrupted PC is anywhere between 'safe_syscall_start' + * and 'safe_syscall_end' then we rewind it to 'safe_syscall_start'. + * The code sequence must therefore be able to cope with this, and + * the syscall instruction must be the final one in the sequence. + */ safe_syscall_start: - /* If signal_pending is non-zero, don't do the call */ - lw t1, 0(t0) - bnez t1, 0f - scall + /* If signal_pending is non-zero, don't do the call */ + lw t1, 0(t0) + bnez t1, 0f + scall safe_syscall_end: - /* code path for having successfully executed the syscall */ - ret + /* code path for having successfully executed the syscall */ + ret 0: - /* code path when we didn't execute the syscall */ - li a0, -TARGET_ERESTARTSYS - ret - .cfi_endproc + /* code path when we didn't execute the syscall */ + li a0, -TARGET_ERESTARTSYS + ret + .cfi_endproc - .size safe_syscall_base, .-safe_syscall_base + .size safe_syscall_base, .-safe_syscall_base diff --git a/linux-user/host/s390x/safe-syscall.inc.S b/linux-user/host/s390x/safe-syscall.inc.S index 414b44ad38..d97d27458e 100644 --- a/linux-user/host/s390x/safe-syscall.inc.S +++ b/linux-user/host/s390x/safe-syscall.inc.S @@ -10,81 +10,81 @@ * See the COPYING file in the top-level directory. */ - .global safe_syscall_base - .global safe_syscall_start - .global safe_syscall_end - .type safe_syscall_base, @function + .global safe_syscall_base + .global safe_syscall_start + .global safe_syscall_end + .type safe_syscall_base, @function - /* This is the entry point for making a system call. The calling - * convention here is that of a C varargs function with the - * first argument an 'int *' to the signal_pending flag, the - * second one the system call number (as a 'long'), and all further - * arguments being syscall arguments (also 'long'). - * We return a long which is the syscall's return value, which - * may be negative-errno on failure. Conversion to the - * -1-and-errno-set convention is done by the calling wrapper. - */ + /* This is the entry point for making a system call. The calling + * convention here is that of a C varargs function with the + * first argument an 'int *' to the signal_pending flag, the + * second one the system call number (as a 'long'), and all further + * arguments being syscall arguments (also 'long'). + * We return a long which is the syscall's return value, which + * may be negative-errno on failure. Conversion to the + * -1-and-errno-set convention is done by the calling wrapper. + */ safe_syscall_base: - .cfi_startproc - stmg %r6,%r15,48(%r15) /* save all call-saved registers */ - .cfi_offset %r15,-40 - .cfi_offset %r14,-48 - .cfi_offset %r13,-56 - .cfi_offset %r12,-64 - .cfi_offset %r11,-72 - .cfi_offset %r10,-80 - .cfi_offset %r9,-88 - .cfi_offset %r8,-96 - .cfi_offset %r7,-104 - .cfi_offset %r6,-112 - lgr %r1,%r15 - lg %r0,8(%r15) /* load eos */ - aghi %r15,-160 - .cfi_adjust_cfa_offset 160 - stg %r1,0(%r15) /* store back chain */ - stg %r0,8(%r15) /* store eos */ + .cfi_startproc + stmg %r6,%r15,48(%r15) /* save all call-saved registers */ + .cfi_offset %r15,-40 + .cfi_offset %r14,-48 + .cfi_offset %r13,-56 + .cfi_offset %r12,-64 + .cfi_offset %r11,-72 + .cfi_offset %r10,-80 + .cfi_offset %r9,-88 + .cfi_offset %r8,-96 + .cfi_offset %r7,-104 + .cfi_offset %r6,-112 + lgr %r1,%r15 + lg %r0,8(%r15) /* load eos */ + aghi %r15,-160 + .cfi_adjust_cfa_offset 160 + stg %r1,0(%r15) /* store back chain */ + stg %r0,8(%r15) /* store eos */ - /* The syscall calling convention isn't the same as the - * C one: - * we enter with r2 == *signal_pending - * r3 == syscall number - * r4, r5, r6, (stack) == syscall arguments - * and return the result in r2 - * and the syscall instruction needs - * r1 == syscall number - * r2 ... r7 == syscall arguments - * and returns the result in r2 - * Shuffle everything around appropriately. - */ - lgr %r8,%r2 /* signal_pending pointer */ - lgr %r1,%r3 /* syscall number */ - lgr %r2,%r4 /* syscall args */ - lgr %r3,%r5 - lgr %r4,%r6 - lmg %r5,%r7,320(%r15) + /* The syscall calling convention isn't the same as the + * C one: + * we enter with r2 == *signal_pending + * r3 == syscall number + * r4, r5, r6, (stack) == syscall arguments + * and return the result in r2 + * and the syscall instruction needs + * r1 == syscall number + * r2 ... r7 == syscall arguments + * and returns the result in r2 + * Shuffle everything around appropriately. + */ + lgr %r8,%r2 /* signal_pending pointer */ + lgr %r1,%r3 /* syscall number */ + lgr %r2,%r4 /* syscall args */ + lgr %r3,%r5 + lgr %r4,%r6 + lmg %r5,%r7,320(%r15) - /* This next sequence of code works in conjunction with the - * rewind_if_safe_syscall_function(). If a signal is taken - * and the interrupted PC is anywhere between 'safe_syscall_start' - * and 'safe_syscall_end' then we rewind it to 'safe_syscall_start'. - * The code sequence must therefore be able to cope with this, and - * the syscall instruction must be the final one in the sequence. - */ + /* This next sequence of code works in conjunction with the + * rewind_if_safe_syscall_function(). If a signal is taken + * and the interrupted PC is anywhere between 'safe_syscall_start' + * and 'safe_syscall_end' then we rewind it to 'safe_syscall_start'. + * The code sequence must therefore be able to cope with this, and + * the syscall instruction must be the final one in the sequence. + */ safe_syscall_start: - /* if signal_pending is non-zero, don't do the call */ - icm %r0,15,0(%r8) - jne 2f - svc 0 + /* if signal_pending is non-zero, don't do the call */ + icm %r0,15,0(%r8) + jne 2f + svc 0 safe_syscall_end: -1: lg %r15,0(%r15) /* load back chain */ - .cfi_remember_state - .cfi_adjust_cfa_offset -160 - lmg %r6,%r15,48(%r15) /* load saved registers */ - br %r14 - .cfi_restore_state -2: lghi %r2, -TARGET_ERESTARTSYS - j 1b - .cfi_endproc +1: lg %r15,0(%r15) /* load back chain */ + .cfi_remember_state + .cfi_adjust_cfa_offset -160 + lmg %r6,%r15,48(%r15) /* load saved registers */ + br %r14 + .cfi_restore_state +2: lghi %r2, -TARGET_ERESTARTSYS + j 1b + .cfi_endproc - .size safe_syscall_base, .-safe_syscall_base + .size safe_syscall_base, .-safe_syscall_base diff --git a/linux-user/host/x86_64/safe-syscall.inc.S b/linux-user/host/x86_64/safe-syscall.inc.S index f36992daa3..158225553e 100644 --- a/linux-user/host/x86_64/safe-syscall.inc.S +++ b/linux-user/host/x86_64/safe-syscall.inc.S @@ -67,7 +67,7 @@ safe_syscall_base: */ safe_syscall_start: /* if signal_pending is non-zero, don't do the call */ - cmpl $0, (%rbp) + cmpl $0, (%rbp) jnz 1f syscall safe_syscall_end: From patchwork Tue Nov 23 17:37:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 519320 Delivered-To: patch@linaro.org Received: by 2002:ac0:c605:0:0:0:0:0 with SMTP id p5csp8973825imj; Tue, 23 Nov 2021 09:39:07 -0800 (PST) X-Google-Smtp-Source: ABdhPJxbkSb399DfRTcgG0v+pxlcbfm2GrHaYf3PJ4Oj/h9VLBJvDCktecGqsIIVmnMmBFtGbaPk X-Received: by 2002:a05:6122:920:: with SMTP id j32mr13605793vka.13.1637689147037; Tue, 23 Nov 2021 09:39:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1637689147; cv=none; d=google.com; s=arc-20160816; b=B2EBsSza0S3FvA/5Q4l6LfriqDm+xHVcRA1nzCIEioAHlrh/ehBXH5ZbcCIYz+MxgK jngCEowFwEB1SK1UAWckzw4DCclZVHv5mYxRzBgbYh23xk6aY7nu8Snea0Wu1b/0Pqp/ sX814fNH0Krx7Trug8dYs88k+c6LsyfI6WeIhA9DJJwXEF/j0o9XIE+rVKq9Bx3+xvpA vL2fdKZ0n6H6Nek3AFapILGg1eNJy6ooRdvzcMla/jm/dNuR0kKGn9LeP4bXcc/TA5lL Ce5UOZZqsmbQZMPolPaDXQc87nhy8fVr7afCr5evaRVsYvH23UA5saeVwVX+VNiU2Iuv qJIQ== 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=npTV63kmQYBDZvVZZRKo6vQ+WQa403g9CWt7bYXbgz0=; b=W5sOeXNtm/cFPyMqi4E4AbdjddkgId5ul371JLrrx8j43DbTPEGokj9bKHzSqDh1cn Gtqe91ULvt5TsvOtzLLmAbeec5Ey5wk4Nq7gNTl465wOTwSAAqf9/NGAAj621tU9ir6Z cIXbt2zT/9B3acblydJAGbHZRyBSkIPiz5JEknCASdjYiTvn1c9ZEA8/2p/elqp8A1Xc tvuSE9Jq9KfRWQtslWkLDvWj2JQRXIaepCnavSInLF9sWjMlnrzhKMpoHS/QhcIoaNr8 1hsRCEyeYNVtfWMIxPjq592eEGR+b8Wd219CBYJa6Hk1KL/TxET9BlbQWJCkOk9OyAkT 5nQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=hmcqVU1t; 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 ba10si5494209uab.35.2021.11.23.09.39.06 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 23 Nov 2021 09:39:07 -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=fail header.i=@linaro.org header.s=google header.b=hmcqVU1t; 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]:56890 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mpZl4-0003zX-GS for patch@linaro.org; Tue, 23 Nov 2021 12:39:06 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52190) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mpZk9-0003xt-7g for qemu-devel@nongnu.org; Tue, 23 Nov 2021 12:38:09 -0500 Received: from [2a00:1450:4864:20::42a] (port=35652 helo=mail-wr1-x42a.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mpZk7-0004zO-TT for qemu-devel@nongnu.org; Tue, 23 Nov 2021 12:38:08 -0500 Received: by mail-wr1-x42a.google.com with SMTP id i5so40358502wrb.2 for ; Tue, 23 Nov 2021 09:38:07 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=npTV63kmQYBDZvVZZRKo6vQ+WQa403g9CWt7bYXbgz0=; b=hmcqVU1tcSwG9ThiJHTiOs3CT/fGG3XjrzF1q4l73h0KxxMtGSkDWnJkcipsFkhSC6 WyZpw0tbkypu3Y4MD3qkCeYyBx1icJpAlkwpgI1CKwqmyaiqtH+jir1EVxLSEvhIFhja L0e/dFkEnyhRXpv5UUDubCTd/njNAOKIuaHfbaHwKv3gOIaEMoDthRegtzUsOqJQCIKV 2GqQbPQwq+pYFfiCJElLHCOdJ+VUiPo7p2As6jYFRYlSdMY2aqEXGazFp0J4pqlQkkyM Rzf3b9Z8oBczoKLFKlaxTvv6/0lkXPLeySpBygg5ghkkCpzM220zRw/k2usjATec4DYz oKWg== 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=npTV63kmQYBDZvVZZRKo6vQ+WQa403g9CWt7bYXbgz0=; b=GPAF+IKVkOkB/fbSFu+brvnwZ2V1zv2DKw4JdWwd37kahA1m/1+9B4olcsZEL9WDSn zohxCK/VytMn6b6DwX9WJoIUs34kFUCKyjPbGDtsk8tNrfJsjPGxY8GklHv5tAZRt1wv DGk1UmpmOfctnG0mAPtx7fno6JDFvLCVsC3zvhxQ7fuuK4O9X8yZgMVDrvLvdo6jS7sn B5vH8SUwoOlDIxAPBG5xbHNCW878c/pAaVmjJKQCrvnHrQfDL5y5ZPOCLh3RV6hTypak +/2izlbcjEGcLK+YR/3vvX7FILgCB5g5IRVvePTJkET4N3lQMjAleIwSnk3u/ZK5pi/d /Qug== X-Gm-Message-State: AOAM5330/KJnzwqiLkGMIwBqFKCac2kw+NXN5ovNAvfTGj0Fpo/IfXkc zlBV+twzbFU2bnyyuEZhAexu3HONY9wumxFSbTw= X-Received: by 2002:a05:6000:168e:: with SMTP id y14mr8102087wrd.331.1637689086593; Tue, 23 Nov 2021 09:38:06 -0800 (PST) Received: from cloudburst.home (149.164.14.37.dynamic.jazztel.es. [37.14.164.149]) by smtp.gmail.com with ESMTPSA id n13sm13054883wrt.44.2021.11.23.09.38.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Nov 2021 09:38:06 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v6 02/16] linux-user/host/ppc64: Use r11 for signal_pending address Date: Tue, 23 Nov 2021 18:37:45 +0100 Message-Id: <20211123173759.1383510-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211123173759.1383510-1-richard.henderson@linaro.org> References: <20211123173759.1383510-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::42a (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::42a; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x42a.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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, PDS_HP_HELO_NORDNS=0.001, 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.eu, imp@bsdimp.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" We don't need a register that can live across the syscall; we only need a register that can live until the syscall. Use call-clobbered r11 instead of call-saved r14. Eliminate the save and restore of r14 from the stack frame. Signed-off-by: Richard Henderson --- linux-user/host/ppc64/safe-syscall.inc.S | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/linux-user/host/ppc64/safe-syscall.inc.S b/linux-user/host/ppc64/safe-syscall.inc.S index 4b57440585..5f19cd193c 100644 --- a/linux-user/host/ppc64/safe-syscall.inc.S +++ b/linux-user/host/ppc64/safe-syscall.inc.S @@ -49,9 +49,7 @@ safe_syscall_base: * and returns the result in r3 * Shuffle everything around appropriately. */ - std 14, 16(1) /* Preserve r14 in SP+16 */ - .cfi_offset 14, 16 - mr 14, 3 /* signal_pending */ + mr 11, 3 /* signal_pending */ mr 0, 4 /* syscall number */ mr 3, 5 /* syscall arguments */ mr 4, 6 @@ -69,13 +67,12 @@ safe_syscall_base: */ safe_syscall_start: /* if signal_pending is non-zero, don't do the call */ - lwz 12, 0(14) + lwz 12, 0(11) cmpwi 0, 12, 0 bne- 0f sc safe_syscall_end: /* code path when we did execute the syscall */ - ld 14, 16(1) /* restore r14 to its original value */ bnslr+ /* syscall failed; return negative errno */ @@ -84,7 +81,6 @@ safe_syscall_end: /* code path when we didn't execute the syscall */ 0: addi 3, 0, -TARGET_ERESTARTSYS - ld 14, 16(1) /* restore r14 to its original value */ blr .cfi_endproc From patchwork Tue Nov 23 17:37:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 519324 Delivered-To: patch@linaro.org Received: by 2002:ac0:c605:0:0:0:0:0 with SMTP id p5csp8977253imj; Tue, 23 Nov 2021 09:41:26 -0800 (PST) X-Google-Smtp-Source: ABdhPJziS8uRDpVtTPPZeKx/KFQ78cqGhpJpKduDGdzuMesr84mbwJ2aa4jZtbDrAYvdL6Z7ujvx X-Received: by 2002:a67:c29a:: with SMTP id k26mr12296999vsj.32.1637689286144; Tue, 23 Nov 2021 09:41:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1637689286; cv=none; d=google.com; s=arc-20160816; b=JuRjcMjEWHYiFTgl/kzPrn38nn6V8CGcKTqOeX8YFCkjjQpY3SU5POm66R8Ye3RwzP Az60aroX+UsqIMlEQ3VJMPYTF8Plnbz6vHRu5BLhClCMbk8z0XtGZjvtxX+vfTKuzL3Y N5saNLjm5uoFu6wftnRnFdak9kwaE7CjHZoicEYv5pRHCmaeZaeXEMnTeIRKw1uqiBiV c7xHtOrA4XRrmQGN5clPYBJxG7ziN7Cm8kO7zIcAApBnONwSZ58WWdPsh1iOwodHFe3f oENG38U5kyzXUIckgQ32AUKw7s3CfC7WpMqXQOt8iAjPYXc62ihyzbyPTbrJCDK6WQHf 2LCg== 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=IgYh2+9rVmSXjGt9XblY+eDpWS5IBmxZWOswHrBkaug=; b=LzywG8QDpKUdcfb3zsFrkrUaVK95SI28Sb2+C40tQFWDxEMUTsR2yG2LdznlZ0Zd27 JET3HFHR4XCly0bFbSqpXsfPPus6qcRngyyH1emDl19jrxq23H4ju69Y1vJ9DSoFlVL4 s0DOMpCXIsQYxJZWyuk21ZuZPSUbsEsxrfIw+KyNtMwnKJCIzuaOGt2BZiAwD6f7BJvt NVYi8yIgmr/Z0XRHGZSRVlMSyZkheRzWu/ByCf2kUENxq81a0oWgzhU5Ia9SK7meJ9Wq g4IZWptjhTZ3oUnMejc2fdFlxvLHTF5eX/XeZ5CkwSNlc7qGTXj9nxoQIUZbYgJ1VDXO pXkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=LJ1Zn+Qi; 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 k11si9101976uao.212.2021.11.23.09.41.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 23 Nov 2021 09:41:26 -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=fail header.i=@linaro.org header.s=google header.b=LJ1Zn+Qi; 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]:36926 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mpZnJ-00012A-HQ for patch@linaro.org; Tue, 23 Nov 2021 12:41:25 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52232) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mpZkC-00041D-33 for qemu-devel@nongnu.org; Tue, 23 Nov 2021 12:38:12 -0500 Received: from [2a00:1450:4864:20::42a] (port=38878 helo=mail-wr1-x42a.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mpZk9-0004zf-IW for qemu-devel@nongnu.org; Tue, 23 Nov 2021 12:38:11 -0500 Received: by mail-wr1-x42a.google.com with SMTP id u18so40326997wrg.5 for ; Tue, 23 Nov 2021 09:38:09 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=IgYh2+9rVmSXjGt9XblY+eDpWS5IBmxZWOswHrBkaug=; b=LJ1Zn+Qi9v89JwP568rHHXwPmhWpLa2sqh3TO2HMOons397qsxEv//wgV8dQeSUSX9 9Z6/DP03jnVfZKAqFaqlwCw6N4UYq0OSLj8NhDmS1EDYf2ExIOGYLa+2EhEUPSzWSmnA p1uC9RrNjP/kEtE9yQxKSJW1XGI304U4IML+3VrQaFLdrTt1Ym7fllJ17Z5iBNbk4/GS frIUNtcK3D+b+8Cn8rjX1o8mKo8N0QEu0YsBvH3n6IgE/5VR2UhltibMlPQkHemYAJ// U7erCIoj9n+Hg2eQeMs/x3Q/g2ASH6gcrGu417WG/9x0hZ2sMVMB+tg+xHr+hjwrKwyJ mVpQ== 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=IgYh2+9rVmSXjGt9XblY+eDpWS5IBmxZWOswHrBkaug=; b=2g2ILAhfZzegmMv7FublchHLh/KRlACV6C4Df3l/ewhMaXbR2orAHaxSoSp952abqx 8NfM2shHAL7pxyw9yxJxf9nXaUh8u5gqp2ZPr6m+1JV2zD/h0VdzfPLZtIak2xWjlEgp BmBumkEgARHBXCJEBGv1uLy6R7oMgd7eSRKyKjQX0W7snQOXDy5u5EfYvohigmx/V99R bZO6lhGKrHVqh4nXelVvf6D5iUsIRxd6DMDyaYJ9IV9hUuCApGe7OTLiDpWZMkb+AWEL u0lJnjkNnKazy6aFqEvR0NMRlGVBpOPU+5dsor7ovOjuFjGgSLtTUyrhEH8ZtNMWwXPq k2Aw== X-Gm-Message-State: AOAM533/dg9UxFlAC9EtvkDwhDgcYlAaU6YFbJ02AyiGQzplIxYhUz/Y XuUtPjP+BOWvUNF7he8LJDVVYBXMmpnZxiF98Ts= X-Received: by 2002:a5d:4a0b:: with SMTP id m11mr9321855wrq.120.1637689088104; Tue, 23 Nov 2021 09:38:08 -0800 (PST) Received: from cloudburst.home (149.164.14.37.dynamic.jazztel.es. [37.14.164.149]) by smtp.gmail.com with ESMTPSA id n13sm13054883wrt.44.2021.11.23.09.38.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Nov 2021 09:38:07 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v6 03/16] linux-user: Move syscall error detection into safe_syscall_base Date: Tue, 23 Nov 2021 18:37:46 +0100 Message-Id: <20211123173759.1383510-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211123173759.1383510-1-richard.henderson@linaro.org> References: <20211123173759.1383510-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::42a (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::42a; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x42a.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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, PDS_HP_HELO_NORDNS=0.001, 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.eu, imp@bsdimp.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" The current api from safe_syscall_base() is to return -errno, which is the interface provided by *some* linux kernel abis. The wrapper macro, safe_syscall(), detects error, stores into errno, and returns -1, to match the api of the system syscall(). For those kernel abis that do not return -errno natively, this leads to double syscall error detection. E.g. Linux ppc64, which sets the SO flag for error. Simplify the usage from C by moving the error detection into assembly, and usage from assembly by providing a C helper with which to set errno. Signed-off-by: Richard Henderson Reviewed-by: Warner Losh --- linux-user/safe-syscall.h | 16 +++------- linux-user/safe-syscall-error.c | 28 ++++++++++++++++ linux-user/host/aarch64/safe-syscall.inc.S | 20 ++++++------ linux-user/host/arm/safe-syscall.inc.S | 27 ++++++++++------ linux-user/host/i386/safe-syscall.inc.S | 37 +++++++++++++++------- linux-user/host/ppc64/safe-syscall.inc.S | 20 ++++++------ linux-user/host/riscv/safe-syscall.inc.S | 20 ++++++------ linux-user/host/s390x/safe-syscall.inc.S | 32 ++++++++++++------- linux-user/host/x86_64/safe-syscall.inc.S | 29 +++++++++-------- linux-user/meson.build | 1 + 10 files changed, 145 insertions(+), 85 deletions(-) create mode 100644 linux-user/safe-syscall-error.c diff --git a/linux-user/safe-syscall.h b/linux-user/safe-syscall.h index aaa9ffc0e2..97837faddb 100644 --- a/linux-user/safe-syscall.h +++ b/linux-user/safe-syscall.h @@ -127,21 +127,15 @@ #ifdef HAVE_SAFE_SYSCALL /* The core part of this function is implemented in assembly */ extern long safe_syscall_base(int *pending, long number, ...); +extern long safe_syscall_set_errno_tail(int value); + /* These are defined by the safe-syscall.inc.S file */ extern char safe_syscall_start[]; extern char safe_syscall_end[]; -#define safe_syscall(...) \ - ({ \ - long ret_; \ - int *psp_ = &((TaskState *)thread_cpu->opaque)->signal_pending; \ - ret_ = safe_syscall_base(psp_, __VA_ARGS__); \ - if (is_error(ret_)) { \ - errno = -ret_; \ - ret_ = -1; \ - } \ - ret_; \ - }) +#define safe_syscall(...) \ + safe_syscall_base(&((TaskState *)thread_cpu->opaque)->signal_pending, \ + __VA_ARGS__) #else diff --git a/linux-user/safe-syscall-error.c b/linux-user/safe-syscall-error.c new file mode 100644 index 0000000000..d7e2700f81 --- /dev/null +++ b/linux-user/safe-syscall-error.c @@ -0,0 +1,28 @@ +/* + * safe-syscall-error.c: errno setting fragment + * This is intended to be invoked by safe-syscall.S + * + * Written by Richard Henderson + * Copyright (C) 2021 Red Hat, Inc. + * + * This work is licensed under the terms of the GNU GPL, version 2 or later. + * See the COPYING file in the top-level directory. + */ + +#include "qemu/osdep.h" +#include "hostdep.h" +#include "safe-syscall.h" + +#ifdef HAVE_SAFE_SYSCALL +/* + * This is intended to be invoked via tail-call on the error path + * from the assembly in host/arch/safe-syscall.inc.S. This takes + * care of the host specific addressing of errno. + * Return -1 to finalize the return value for safe_syscall_base. + */ +long safe_syscall_set_errno_tail(int value) +{ + errno = value; + return -1; +} +#endif diff --git a/linux-user/host/aarch64/safe-syscall.inc.S b/linux-user/host/aarch64/safe-syscall.inc.S index e2e726ef55..76a0a18a6c 100644 --- a/linux-user/host/aarch64/safe-syscall.inc.S +++ b/linux-user/host/aarch64/safe-syscall.inc.S @@ -22,15 +22,12 @@ * first argument an 'int *' to the signal_pending flag, the * second one the system call number (as a 'long'), and all further * arguments being syscall arguments (also 'long'). - * We return a long which is the syscall's return value, which - * may be negative-errno on failure. Conversion to the - * -1-and-errno-set convention is done by the calling wrapper. */ safe_syscall_base: .cfi_startproc /* The syscall calling convention isn't the same as the * C one: - * we enter with x0 == *signal_pending + * we enter with x0 == &signal_pending * x1 == syscall number * x2 ... x7, (stack) == syscall arguments * and return the result in x0 @@ -60,16 +57,21 @@ safe_syscall_base: safe_syscall_start: /* if signal_pending is non-zero, don't do the call */ ldr w10, [x9] - cbnz w10, 0f + cbnz w10, 2f svc 0x0 safe_syscall_end: /* code path for having successfully executed the syscall */ + cmp x0, #-4096 + b.hi 0f ret -0: + /* code path setting errno */ +0: neg w0, w0 + b safe_syscall_set_errno_tail + /* code path when we didn't execute the syscall */ - mov x0, #-TARGET_ERESTARTSYS - ret - .cfi_endproc +2: mov w0, #TARGET_ERESTARTSYS + b safe_syscall_set_errno_tail + .cfi_endproc .size safe_syscall_base, .-safe_syscall_base diff --git a/linux-user/host/arm/safe-syscall.inc.S b/linux-user/host/arm/safe-syscall.inc.S index 1f1ee8327b..618112c6bf 100644 --- a/linux-user/host/arm/safe-syscall.inc.S +++ b/linux-user/host/arm/safe-syscall.inc.S @@ -27,9 +27,6 @@ * first argument an 'int *' to the signal_pending flag, the * second one the system call number (as a 'long'), and all further * arguments being syscall arguments (also 'long'). - * We return a long which is the syscall's return value, which - * may be negative-errno on failure. Conversion to the - * -1-and-errno-set convention is done by the calling wrapper. */ safe_syscall_base: .fnstart @@ -46,7 +43,7 @@ safe_syscall_base: .cfi_rel_offset lr, 20 /* The syscall calling convention isn't the same as the C one: - * we enter with r0 == *signal_pending + * we enter with r0 == &signal_pending * r1 == syscall number * r2, r3, [sp+0] ... [sp+12] == syscall arguments * and return the result in r0 @@ -74,17 +71,29 @@ safe_syscall_start: /* if signal_pending is non-zero, don't do the call */ ldr r12, [r8] /* signal_pending */ tst r12, r12 - bne 1f + bne 2f swi 0 safe_syscall_end: /* code path for having successfully executed the syscall */ + cmp r0, #-4096 + neghi r0, r0 + bhi 1f pop { r4, r5, r6, r7, r8, pc } -1: /* code path when we didn't execute the syscall */ - ldr r0, =-TARGET_ERESTARTSYS - pop { r4, r5, r6, r7, r8, pc } +2: mov r0, #TARGET_ERESTARTSYS + + /* code path setting errno */ +1: pop { r4, r5, r6, r7, r8, lr } + .cfi_adjust_cfa_offset -24 + .cfi_restore r4 + .cfi_restore r5 + .cfi_restore r6 + .cfi_restore r7 + .cfi_restore r8 + .cfi_restore lr + b safe_syscall_set_errno_tail + .fnend .cfi_endproc - .size safe_syscall_base, .-safe_syscall_base diff --git a/linux-user/host/i386/safe-syscall.inc.S b/linux-user/host/i386/safe-syscall.inc.S index e425aa54d8..f5883234bb 100644 --- a/linux-user/host/i386/safe-syscall.inc.S +++ b/linux-user/host/i386/safe-syscall.inc.S @@ -20,9 +20,6 @@ * first argument an 'int *' to the signal_pending flag, the * second one the system call number (as a 'long'), and all further * arguments being syscall arguments (also 'long'). - * We return a long which is the syscall's return value, which - * may be negative-errno on failure. Conversion to the - * -1-and-errno-set convention is done by the calling wrapper. */ safe_syscall_base: .cfi_startproc @@ -41,7 +38,7 @@ safe_syscall_base: /* The syscall calling convention isn't the same as the C one: * we enter with 0(%esp) == return address - * 4(%esp) == *signal_pending + * 4(%esp) == &signal_pending * 8(%esp) == syscall number * 12(%esp) ... 32(%esp) == syscall arguments * and return the result in eax @@ -70,11 +67,13 @@ safe_syscall_start: /* if signal_pending is non-zero, don't do the call */ mov 4+16(%esp), %eax /* signal_pending */ cmpl $0, (%eax) - jnz 1f + jnz 2f mov 8+16(%esp), %eax /* syscall number */ int $0x80 safe_syscall_end: /* code path for having successfully executed the syscall */ + cmp $-4095, %eax + jae 0f pop %ebx .cfi_remember_state .cfi_adjust_cfa_offset -4 @@ -89,12 +88,28 @@ safe_syscall_end: .cfi_adjust_cfa_offset -4 .cfi_restore ebp ret - -1: - /* code path when we didn't execute the syscall */ .cfi_restore_state - mov $-TARGET_ERESTARTSYS, %eax - jmp safe_syscall_end - .cfi_endproc +0: neg %eax + jmp 1f + + /* code path when we didn't execute the syscall */ +2: mov $TARGET_ERESTARTSYS, %eax + + /* code path setting errno */ +1: pop %ebx + .cfi_adjust_cfa_offset -4 + .cfi_restore ebx + pop %edi + .cfi_adjust_cfa_offset -4 + .cfi_restore edi + pop %esi + .cfi_adjust_cfa_offset -4 + .cfi_restore esi + pop %ebp + .cfi_adjust_cfa_offset -4 + .cfi_restore ebp + jmp safe_syscall_set_errno_tail + + .cfi_endproc .size safe_syscall_base, .-safe_syscall_base diff --git a/linux-user/host/ppc64/safe-syscall.inc.S b/linux-user/host/ppc64/safe-syscall.inc.S index 5f19cd193c..b370889480 100644 --- a/linux-user/host/ppc64/safe-syscall.inc.S +++ b/linux-user/host/ppc64/safe-syscall.inc.S @@ -22,9 +22,6 @@ * first argument an 'int *' to the signal_pending flag, the * second one the system call number (as a 'long'), and all further * arguments being syscall arguments (also 'long'). - * We return a long which is the syscall's return value, which - * may be negative-errno on failure. Conversion to the - * -1-and-errno-set convention is done by the calling wrapper. */ #if _CALL_ELF == 2 safe_syscall_base: @@ -39,7 +36,7 @@ safe_syscall_base: .L.safe_syscall_base: .cfi_startproc #endif - /* We enter with r3 == *signal_pending + /* We enter with r3 == &signal_pending * r4 == syscall number * r5 ... r10 == syscall arguments * and return the result in r3 @@ -69,19 +66,20 @@ safe_syscall_start: /* if signal_pending is non-zero, don't do the call */ lwz 12, 0(11) cmpwi 0, 12, 0 - bne- 0f + bne- 2f sc safe_syscall_end: /* code path when we did execute the syscall */ - bnslr+ - - /* syscall failed; return negative errno */ - neg 3, 3 + bso- 1f blr /* code path when we didn't execute the syscall */ -0: addi 3, 0, -TARGET_ERESTARTSYS - blr +2: addi 3, 0, TARGET_ERESTARTSYS + + /* code path setting errno */ +1: b safe_syscall_set_errno_tail + nop /* per abi, for the linker to modify */ + .cfi_endproc #if _CALL_ELF == 2 diff --git a/linux-user/host/riscv/safe-syscall.inc.S b/linux-user/host/riscv/safe-syscall.inc.S index 95c4832de2..54c2e23f75 100644 --- a/linux-user/host/riscv/safe-syscall.inc.S +++ b/linux-user/host/riscv/safe-syscall.inc.S @@ -23,15 +23,12 @@ * first argument an 'int *' to the signal_pending flag, the * second one the system call number (as a 'long'), and all further * arguments being syscall arguments (also 'long'). - * We return a long which is the syscall's return value, which - * may be negative-errno on failure. Conversion to the - * -1-and-errno-set convention is done by the calling wrapper. */ safe_syscall_base: .cfi_startproc /* * The syscall calling convention is nearly the same as C: - * we enter with a0 == *signal_pending + * we enter with a0 == &signal_pending * a1 == syscall number * a2 ... a7 == syscall arguments * and return the result in a0 @@ -62,16 +59,21 @@ safe_syscall_base: safe_syscall_start: /* If signal_pending is non-zero, don't do the call */ lw t1, 0(t0) - bnez t1, 0f + bnez t1, 2f scall safe_syscall_end: /* code path for having successfully executed the syscall */ + li t2, -4096 + bgtu a0, t2, 0f ret -0: + /* code path setting errno */ +0: neg a0, a0 + j safe_syscall_set_errno_tail + /* code path when we didn't execute the syscall */ - li a0, -TARGET_ERESTARTSYS - ret - .cfi_endproc +2: li a0, TARGET_ERESTARTSYS + j safe_syscall_set_errno_tail + .cfi_endproc .size safe_syscall_base, .-safe_syscall_base diff --git a/linux-user/host/s390x/safe-syscall.inc.S b/linux-user/host/s390x/safe-syscall.inc.S index d97d27458e..899dab39e9 100644 --- a/linux-user/host/s390x/safe-syscall.inc.S +++ b/linux-user/host/s390x/safe-syscall.inc.S @@ -20,9 +20,6 @@ * first argument an 'int *' to the signal_pending flag, the * second one the system call number (as a 'long'), and all further * arguments being syscall arguments (also 'long'). - * We return a long which is the syscall's return value, which - * may be negative-errno on failure. Conversion to the - * -1-and-errno-set convention is done by the calling wrapper. */ safe_syscall_base: .cfi_startproc @@ -44,9 +41,9 @@ safe_syscall_base: stg %r1,0(%r15) /* store back chain */ stg %r0,8(%r15) /* store eos */ - /* The syscall calling convention isn't the same as the - * C one: - * we enter with r2 == *signal_pending + /* + * The syscall calling convention isn't the same as the C one: + * we enter with r2 == &signal_pending * r3 == syscall number * r4, r5, r6, (stack) == syscall arguments * and return the result in r2 @@ -77,14 +74,25 @@ safe_syscall_start: svc 0 safe_syscall_end: -1: lg %r15,0(%r15) /* load back chain */ + /* code path for having successfully executed the syscall */ + lg %r15,0(%r15) /* load back chain */ .cfi_remember_state .cfi_adjust_cfa_offset -160 lmg %r6,%r15,48(%r15) /* load saved registers */ - br %r14 - .cfi_restore_state -2: lghi %r2, -TARGET_ERESTARTSYS - j 1b - .cfi_endproc + lghi %r0, -4095 /* check for syscall error */ + clgr %r2, %r0 + blr %r14 /* return on success */ + lcr %r2, %r2 /* create positive errno */ + jg safe_syscall_set_errno_tail + .cfi_restore_state + + /* code path when we didn't execute the syscall */ +2: lg %r15,0(%r15) /* load back chain */ + .cfi_adjust_cfa_offset -160 + lmg %r6,%r15,48(%r15) /* load saved registers */ + lghi %r2, TARGET_ERESTARTSYS + jg safe_syscall_set_errno_tail + + .cfi_endproc .size safe_syscall_base, .-safe_syscall_base diff --git a/linux-user/host/x86_64/safe-syscall.inc.S b/linux-user/host/x86_64/safe-syscall.inc.S index 158225553e..39b64250c3 100644 --- a/linux-user/host/x86_64/safe-syscall.inc.S +++ b/linux-user/host/x86_64/safe-syscall.inc.S @@ -19,9 +19,6 @@ * first argument an 'int *' to the signal_pending flag, the * second one the system call number (as a 'long'), and all further * arguments being syscall arguments (also 'long'). - * We return a long which is the syscall's return value, which - * may be negative-errno on failure. Conversion to the - * -1-and-errno-set convention is done by the calling wrapper. */ safe_syscall_base: .cfi_startproc @@ -35,9 +32,9 @@ safe_syscall_base: .cfi_adjust_cfa_offset 8 .cfi_rel_offset rbp, 0 - /* The syscall calling convention isn't the same as the - * C one: - * we enter with rdi == *signal_pending + /* + * The syscall calling convention isn't the same as the C one: + * we enter with rdi == &signal_pending * rsi == syscall number * rdx, rcx, r8, r9, (stack), (stack) == syscall arguments * and return the result in rax @@ -68,24 +65,30 @@ safe_syscall_base: safe_syscall_start: /* if signal_pending is non-zero, don't do the call */ cmpl $0, (%rbp) - jnz 1f + jnz 2f syscall safe_syscall_end: /* code path for having successfully executed the syscall */ + cmp $-4095, %rax + jae 0f pop %rbp .cfi_remember_state .cfi_def_cfa_offset 8 .cfi_restore rbp ret - -1: - /* code path when we didn't execute the syscall */ .cfi_restore_state - mov $-TARGET_ERESTARTSYS, %rax - pop %rbp + +0: neg %eax + jmp 1f + + /* code path when we didn't execute the syscall */ +2: mov $TARGET_ERESTARTSYS, %eax + + /* code path setting errno */ +1: pop %rbp .cfi_def_cfa_offset 8 .cfi_restore rbp - ret + jmp safe_syscall_set_errno_tail .cfi_endproc .size safe_syscall_base, .-safe_syscall_base diff --git a/linux-user/meson.build b/linux-user/meson.build index bf62c13e37..94ac3c58ce 100644 --- a/linux-user/meson.build +++ b/linux-user/meson.build @@ -10,6 +10,7 @@ linux_user_ss.add(files( 'main.c', 'mmap.c', 'safe-syscall.S', + 'safe-syscall-error.c', 'signal.c', 'strace.c', 'syscall.c', From patchwork Tue Nov 23 17:37:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 519328 Delivered-To: patch@linaro.org Received: by 2002:ac0:c605:0:0:0:0:0 with SMTP id p5csp8980126imj; Tue, 23 Nov 2021 09:43:37 -0800 (PST) X-Google-Smtp-Source: ABdhPJwjXdRX66DC4uUcpn9y+WGdFdYoF0pfID/uQVQin1Fvmwg6EN6ioBWmEQKg/umiX3G62bo5 X-Received: by 2002:a1f:9158:: with SMTP id t85mr13558385vkd.8.1637689417134; Tue, 23 Nov 2021 09:43:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1637689417; cv=none; d=google.com; s=arc-20160816; b=TlnlIvT6T7Xmibi0/lcBmYBM5mKe84pMRNk8K5HmHZ3MypbNYwelK3l3a+OhmtZSE7 TgLjuMkjH7RYkbUVSOq3arFCrjhxbGSwiA5PsbfSqs61u2dmDgxgKEZAoSCbsMMjrYi9 eIx+gJc+umbn0Nc3pTv0MmpNpanamt7WQOSQZa/UHjgAuCzgSM0kn/e4/Q4/kX9j0Op5 l2jxEbgDHFIx9XZJRtgDEriPzGO0yQ3lcy4XWpRAaYUJ+yGCDqQyz/GA1DVzqPaQGuJi GsTTicZs0XJmB8Tczb/5bDePAf2NZznmbCWWK5L2rUMDHEPKCOf4I9kFpcMaeLpJgM1y 8bVQ== 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=N7ifV7lHO8lRE2Wpho0vLQOIlb6dvWhebWkO0CZFmhw=; b=oBl7QB4d8tTlz5xO6/SZC2qZCE78Y6SvHoF1XdMsVv1P+3foJxAwqmLvpnYGLcxtHL GoZ0voroeNS+FcwS3cqcWbWWVZqSzP3Hnh0KMtLVU6A7kXF2BbW4ioRlREsOyETrFgVf gi5xEEyd/mCnwRT8Ku3iLG4drNesMM46LRsslgWaaJeCJFaYi1Wq7vPxzEA5wm8XopxG l2wpD3ix997FEvE8nsMvEYne5IILkpnjbEcEIYTlgfkw0rGQJbB8nxX4Ohr8QvDCVQl8 RDb33AU+xPocmIcjsH4yzHz+T6TbKCxFeHNnXHHoSJ7/HJitVxTMPtovsPkMt8T09tjk aO9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=OlXCwYDh; 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 y10si38240482vko.92.2021.11.23.09.43.37 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 23 Nov 2021 09:43:37 -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=fail header.i=@linaro.org header.s=google header.b=OlXCwYDh; 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]:45554 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mpZpQ-0006mo-H4 for patch@linaro.org; Tue, 23 Nov 2021 12:43:36 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52234) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mpZkC-00042W-FN for qemu-devel@nongnu.org; Tue, 23 Nov 2021 12:38:12 -0500 Received: from [2a00:1450:4864:20::331] (port=33729 helo=mail-wm1-x331.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mpZkA-0004zp-RM for qemu-devel@nongnu.org; Tue, 23 Nov 2021 12:38:12 -0500 Received: by mail-wm1-x331.google.com with SMTP id r9-20020a7bc089000000b00332f4abf43fso2439600wmh.0 for ; Tue, 23 Nov 2021 09:38:10 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=N7ifV7lHO8lRE2Wpho0vLQOIlb6dvWhebWkO0CZFmhw=; b=OlXCwYDhzfokR1zsTCPF+AICPDesNr1MJNBDIYnUqFS7iiwhrfMgDXiyQbk7bYrpE0 Qi4HxbciewP96tgbAPM6PE17226wPbfZML8tR09TBeI6hC7JuB6tnSNz3S/MQlbqRNnw 31bApKF7fRLy1T1UNfS+EsOrwft88NisEXU0lKKyakU2xKUaDr3RWdm5+QEKhNN1Wka/ 8hr30bDDANekcM4F3WJYvPiNgvDUgZvWX7sj5ntUmjFcu3VRnOHjXt0LAb1sjatJnA8a Iiii5VvfdPCvsDJaJ5l6wcOdmlW+2neyRsGtOkxl8/txxv/+SqSapxymwbsHAsKkIfcu FHog== 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=N7ifV7lHO8lRE2Wpho0vLQOIlb6dvWhebWkO0CZFmhw=; b=sGl7cbfRe5pYcNIcuXAb8+c8IHmYkEbA8rx8H6pIqdWRcZtKJJc5nzhHMDhR2pEgvC BQq4AxPydVn7nQikkOgyEv5CeKt3b5wFX5ewsl+uONYsxCp/hC5HDprjpvKHIf3Mo53D ce5Cg31VNj4NLbR41GtTsKHKNpfV98dICWSfQBNoSFS1iMSW2Zy2tQhrJl6emjQWJhXQ whSIYr/FPxwGEyWsdrVJb7GCJ6fDSuqbUYMu4ioA10UwwJHSC7bhBOzVQhdmry9aLb3D 9QQQlww9R3876XSBD+C2BXl6rso9uD7GQzWL6YgPw9mv2xgwqMR2xYPr3tCqIJNZocOZ nqAQ== X-Gm-Message-State: AOAM532gBLyqTK63ogTVOPBZTOgK1hI6daiLhFGzFDy6ay8fG7huv6R6 em5CkZtnDEFMEd5licbPk0SXDkyE+MlmZ7UDncw= X-Received: by 2002:a05:600c:6016:: with SMTP id az22mr5385546wmb.11.1637689089443; Tue, 23 Nov 2021 09:38:09 -0800 (PST) Received: from cloudburst.home (149.164.14.37.dynamic.jazztel.es. [37.14.164.149]) by smtp.gmail.com with ESMTPSA id n13sm13054883wrt.44.2021.11.23.09.38.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Nov 2021 09:38:08 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v6 04/16] linux-user/host/mips: Add safe-syscall.inc.S Date: Tue, 23 Nov 2021 18:37:47 +0100 Message-Id: <20211123173759.1383510-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211123173759.1383510-1-richard.henderson@linaro.org> References: <20211123173759.1383510-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::331 (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::331; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x331.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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, PDS_HP_HELO_NORDNS=0.001, 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.eu, imp@bsdimp.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Richard Henderson Reviewed-by: Warner Losh --- linux-user/host/mips/hostdep.h | 3 + linux-user/host/mips/safe-syscall.inc.S | 123 ++++++++++++++++++++++++ 2 files changed, 126 insertions(+) create mode 100644 linux-user/host/mips/safe-syscall.inc.S diff --git a/linux-user/host/mips/hostdep.h b/linux-user/host/mips/hostdep.h index ba111d75c3..d9e90a096b 100644 --- a/linux-user/host/mips/hostdep.h +++ b/linux-user/host/mips/hostdep.h @@ -12,4 +12,7 @@ #ifndef MIPS_HOSTDEP_H #define MIPS_HOSTDEP_H +/* We have a safe-syscall.inc.S */ +#define HAVE_SAFE_SYSCALL + #endif diff --git a/linux-user/host/mips/safe-syscall.inc.S b/linux-user/host/mips/safe-syscall.inc.S new file mode 100644 index 0000000000..c6dd726001 --- /dev/null +++ b/linux-user/host/mips/safe-syscall.inc.S @@ -0,0 +1,123 @@ +/* + * safe-syscall.inc.S : host-specific assembly fragment + * to handle signals occurring at the same time as system calls. + * This is intended to be included by linux-user/safe-syscall.S + * + * Written by Richard Henderson + * Copyright (C) 2021 Linaro, Inc. + * + * This work is licensed under the terms of the GNU GPL, version 2 or later. + * See the COPYING file in the top-level directory. + */ + +#include "sys/regdef.h" +#include "sys/asm.h" + + .text + .set nomips16 + .set reorder + + .global safe_syscall_start + .global safe_syscall_end + .type safe_syscall_start, @function + .type safe_syscall_end, @function + + /* + * This is the entry point for making a system call. The calling + * convention here is that of a C varargs function with the + * first argument an 'int *' to the signal_pending flag, the + * second one the system call number (as a 'long'), and all further + * arguments being syscall arguments (also 'long'). + */ + +LEAF(safe_syscall_base) + .cfi_startproc +#if _MIPS_SIM == _ABIO32 + /* + * The syscall calling convention is nearly the same as C: + * we enter with a0 == &signal_pending + * a1 == syscall number + * a2, a3, stack == syscall arguments + * and return the result in a0 + * and the syscall instruction needs + * v0 == syscall number + * a0 ... a3, stack == syscall arguments + * and returns the result in v0 + * Shuffle everything around appropriately. + */ + move t0, a0 /* signal_pending pointer */ + move v0, a1 /* syscall number */ + move a0, a2 /* syscall arguments */ + move a1, a3 + lw a2, 16(sp) + lw a3, 20(sp) + lw t4, 24(sp) + lw t5, 28(sp) + lw t6, 32(sp) + lw t7, 40(sp) + sw t4, 16(sp) + sw t5, 20(sp) + sw t6, 24(sp) + sw t7, 28(sp) +#else + /* + * The syscall calling convention is nearly the same as C: + * we enter with a0 == &signal_pending + * a1 == syscall number + * a2 ... a7 == syscall arguments + * and return the result in a0 + * and the syscall instruction needs + * v0 == syscall number + * a0 ... a5 == syscall arguments + * and returns the result in v0 + * Shuffle everything around appropriately. + */ + move t0, a0 /* signal_pending pointer */ + move v0, a1 /* syscall number */ + move a0, a2 /* syscall arguments */ + move a1, a3 + move a2, a4 + move a3, a5 + move a4, a6 + move a5, a7 +#endif + + /* + * This next sequence of code works in conjunction with the + * rewind_if_safe_syscall_function(). If a signal is taken + * and the interrupted PC is anywhere between 'safe_syscall_start' + * and 'safe_syscall_end' then we rewind it to 'safe_syscall_start'. + * The code sequence must therefore be able to cope with this, and + * the syscall instruction must be the final one in the sequence. + */ +safe_syscall_start: + /* If signal_pending is non-zero, don't do the call */ + lw t1, 0(t0) + bnez t1, 2f + syscall +safe_syscall_end: + + /* code path for having successfully executed the syscall */ + bnez a3, 1f + jr ra + + /* code path when we didn't execute the syscall */ +2: li v0, TARGET_ERESTARTSYS + + /* code path setting errno */ + /* + * We didn't setup GP on entry, optimistic of the syscall success. + * We must do so now to load the address of the helper, as required + * by the ABI, into t9. + * + * Note that SETUP_GPX and SETUP_GPX64 are themselves conditional, + * so we can simply let the one that's not empty succeed. + */ +1: USE_ALT_CP(t0) + SETUP_GPX(t1) + SETUP_GPX64(t0, t1) + PTR_LA t9, safe_syscall_set_errno_tail + jr t9 + + .cfi_endproc +END(safe_syscall_base) From patchwork Tue Nov 23 17:37:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 519321 Delivered-To: patch@linaro.org Received: by 2002:ac0:c605:0:0:0:0:0 with SMTP id p5csp8973969imj; Tue, 23 Nov 2021 09:39:13 -0800 (PST) X-Google-Smtp-Source: ABdhPJxl6a9AtnbjJQaL+651Os7ffLbFHKbWb8lsi2UVK9YzWQXxxm7FcM0Zon9bY6o8yvrtorfU X-Received: by 2002:a67:df04:: with SMTP id s4mr11518500vsk.46.1637689153598; Tue, 23 Nov 2021 09:39:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1637689153; cv=none; d=google.com; s=arc-20160816; b=doh1xK+fCzOwEhmOftIwnPU2A9ifs3N1mEfxrL51QTqN6jZB0ybMzjtn/x0HLVVlEQ QwF76HmuvJR/X89iQDhLqQAQ7jTPb0pvZ/TkQTffMKHNq7Iv41LPA4p3kJlXzY4fo4Io vahQDtu+XO+y3KzPJbMi0QmpLhveWHWFn3fKTREAhPGEaURktoqVD5PJZgRTIECJqVYS iicRXQdSBgMAgt1ICyEkqMn1ho5V4nedYG/DU9+Ud15eHp8dr3RtDMfAE9qX5/RqCBoe RfeuS4RFJOaDYJ5YlEHrvf0zFFInmaYUAK7XRIJi2TQEGu9arMUOa+8mI6oqC2c13q+v B4jg== 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=mT+zuzmDZjEjStGuNXpCAnb7RPXTMmCHpcEJ6vHxP1Y=; b=N8lqEkhqnWrDt97ZKSPTLv5buhvg2ZeohA7tH/A9rKUpYEThqWl1C7MDa96X328GDG 62/qp0xwC2H+4Kndl0vaxG4NiMIzuOk0U7rf9etCPlx+B9cVnExuQDM04ifCP9hhUfTJ 7VGYOOqCgoFZA898+pG9nMr6ViVP68H1nvUl9oo3npGUvvSlTiERKqpyD4yg3iERC7RJ BcSg9/15WO/64LKN+2iVnZ36v1qo5Q6Y/F68h4tQ2ERRJbYGNZYOT9DKUvv9TH07zz4q B9EMaah++xFjMv0hJNQeL4EbnSq5qZ5nGvGwvhkiQkyb6yc4rZZ9XapL1Exsp95ONMuS 8ZLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="F0wzx/rH"; 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 128si117047vka.73.2021.11.23.09.39.13 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 23 Nov 2021 09:39:13 -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=fail header.i=@linaro.org header.s=google header.b="F0wzx/rH"; 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]:57240 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mpZlB-0004D8-1y for patch@linaro.org; Tue, 23 Nov 2021 12:39:13 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52258) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mpZkE-00047B-T1 for qemu-devel@nongnu.org; Tue, 23 Nov 2021 12:38:14 -0500 Received: from [2a00:1450:4864:20::333] (port=35761 helo=mail-wm1-x333.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mpZkD-000502-CO for qemu-devel@nongnu.org; Tue, 23 Nov 2021 12:38:14 -0500 Received: by mail-wm1-x333.google.com with SMTP id 77-20020a1c0450000000b0033123de3425so3045067wme.0 for ; Tue, 23 Nov 2021 09:38:12 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=mT+zuzmDZjEjStGuNXpCAnb7RPXTMmCHpcEJ6vHxP1Y=; b=F0wzx/rHfAA1ekdil+cTekIST8Uv3FZ7jxcs0MO1ApCXuwwotMxuLjfHEsTKkI5Paw jWUwqvi5a3xMei6u/OJIeHraHA5hmVdflUKhV+DC+5FnsHSUU2x/4A+SEaxJoDjUtRjo 6nf7x7qSwX72gjUIMsAXecpHjMmgIhHzb0g97ts7Mc916jJ6qjhgLtd60a/N3DNwGYzJ R924MPpnN8kdCp1oFigw3o72elKMnjIqNtKyZZls2pnlm77s36Z4aU8OwymnRhOsKGuZ I7KphvepL1FACEpL+ewGX3xyU3SHgKWhq9sNhs5ohRMXlykTgYu6RVGnEJI5s3FSRft3 /7Xg== 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=mT+zuzmDZjEjStGuNXpCAnb7RPXTMmCHpcEJ6vHxP1Y=; b=v3pf5YoSJyeXKS5EWGJviTvPxacgu1zIBy6jJ2y/T6i38rMyp1HPvSybHpvrh3GTDd QFMYFPZyPVIbHyU575NG6RKkzonrlbE8MulzirRshOGX5L5aBonlSj61uASfsZaSvmSQ WFBa2YuF42WObKSiV01yjiLiys6i3jybH7GrZBiz0R/73YeMX3vY4zrmvPYCqu/OC5KZ fsZixwRy2x00A0SK9739KSU7xy0axfwn+VjpqRqhfT3tgZpHWwIRIAY8dsOqDiVVvfvQ RrE+m28c5K3dhq/4cXLQgUWh1ENgNDkckAEwdLVebQJdVLAUkA7ABcpD+5FS/9KFR2QX /fBw== X-Gm-Message-State: AOAM531cGFp/+I1r2FUFBipHzIxMQOyirQTZ4BF6gbk6Uxwb/uoEobgV ryfYT+BbWofZgHEIcjVN7ZSpqg+rVZGFmPc782E= X-Received: by 2002:a05:600c:2308:: with SMTP id 8mr5037876wmo.179.1637689090938; Tue, 23 Nov 2021 09:38:10 -0800 (PST) Received: from cloudburst.home (149.164.14.37.dynamic.jazztel.es. [37.14.164.149]) by smtp.gmail.com with ESMTPSA id n13sm13054883wrt.44.2021.11.23.09.38.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Nov 2021 09:38:10 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v6 05/16] linux-user/host/sparc64: Add safe-syscall.inc.S Date: Tue, 23 Nov 2021 18:37:48 +0100 Message-Id: <20211123173759.1383510-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211123173759.1383510-1-richard.henderson@linaro.org> References: <20211123173759.1383510-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::333 (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::333; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x333.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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, PDS_HP_HELO_NORDNS=0.001, 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.eu, imp@bsdimp.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Richard Henderson --- linux-user/host/sparc64/hostdep.h | 3 + linux-user/host/sparc64/safe-syscall.inc.S | 89 ++++++++++++++++++++++ 2 files changed, 92 insertions(+) create mode 100644 linux-user/host/sparc64/safe-syscall.inc.S diff --git a/linux-user/host/sparc64/hostdep.h b/linux-user/host/sparc64/hostdep.h index ce3968fca0..d832868cb1 100644 --- a/linux-user/host/sparc64/hostdep.h +++ b/linux-user/host/sparc64/hostdep.h @@ -12,4 +12,7 @@ #ifndef SPARC64_HOSTDEP_H #define SPARC64_HOSTDEP_H +/* We have a safe-syscall.inc.S */ +#define HAVE_SAFE_SYSCALL + #endif diff --git a/linux-user/host/sparc64/safe-syscall.inc.S b/linux-user/host/sparc64/safe-syscall.inc.S new file mode 100644 index 0000000000..bb35c64cfc --- /dev/null +++ b/linux-user/host/sparc64/safe-syscall.inc.S @@ -0,0 +1,89 @@ +/* + * safe-syscall.inc.S : host-specific assembly fragment + * to handle signals occurring at the same time as system calls. + * This is intended to be included by linux-user/safe-syscall.S + * + * Written by Richard Henderson + * Copyright (C) 2021 Red Hat, Inc. + * + * This work is licensed under the terms of the GNU GPL, version 2 or later. + * See the COPYING file in the top-level directory. + */ + + .text + .balign 4 + + .register %g2, #scratch + .register %g3, #scratch + + .global safe_syscall_base + .global safe_syscall_start + .global safe_syscall_end + .type safe_syscall_base, @function + .type safe_syscall_start, @function + .type safe_syscall_end, @function + +#define STACK_BIAS 2047 +#define PARAM(N) STACK_BIAS + N*8 + + /* + * This is the entry point for making a system call. The calling + * convention here is that of a C varargs function with the + * first argument an 'int *' to the signal_pending flag, the + * second one the system call number (as a 'long'), and all further + * arguments being syscall arguments (also 'long'). + */ +safe_syscall_base: + .cfi_startproc + /* + * The syscall calling convention isn't the same as the C one: + * we enter with o0 == &signal_pending + * o1 == syscall number + * o2 ... o5, (stack) == syscall arguments + * and return the result in x0 + * and the syscall instruction needs + * g1 == syscall number + * o0 ... o5 == syscall arguments + * and returns the result in o0 + * Shuffle everything around appropriately. + */ + mov %o0, %g2 /* signal_pending pointer */ + mov %o1, %g1 /* syscall number */ + mov %o2, %o0 /* syscall arguments */ + mov %o3, %o1 + mov %o4, %o2 + mov %o5, %o3 + ldx [%sp + PARAM(6)], %o4 + ldx [%sp + PARAM(7)], %o5 + + /* + * This next sequence of code works in conjunction with the + * rewind_if_safe_syscall_function(). If a signal is taken + * and the interrupted PC is anywhere between 'safe_syscall_start' + * and 'safe_syscall_end' then we rewind it to 'safe_syscall_start'. + * The code sequence must therefore be able to cope with this, and + * the syscall instruction must be the final one in the sequence. + */ +safe_syscall_start: + /* if signal_pending is non-zero, don't do the call */ + lduw [%g2], %g3 + brnz,pn %g3, 2f + nop + ta 0x6d +safe_syscall_end: + /* code path for having successfully executed the syscall */ + bcs,pn %xcc, 1f + nop + ret + nop + + /* code path when we didn't execute the syscall */ +2: set TARGET_ERESTARTSYS, %o0 + + /* code path setting errno */ +1: mov %o7, %g1 + call safe_syscall_set_errno_tail + mov %g1, %o7 + + .cfi_endproc + .size safe_syscall_base, .-safe_syscall_base From patchwork Tue Nov 23 17:37:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 519331 Delivered-To: patch@linaro.org Received: by 2002:ac0:c605:0:0:0:0:0 with SMTP id p5csp8983393imj; Tue, 23 Nov 2021 09:45:58 -0800 (PST) X-Google-Smtp-Source: ABdhPJz73PksgOiT49+dSs4AFLKhha7Hb8DTn9aZs7V3id1kKNfmuw+suAWwsWxZFEGazncFKkRd X-Received: by 2002:a05:6102:389:: with SMTP id m9mr12096592vsq.43.1637689558448; Tue, 23 Nov 2021 09:45:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1637689558; cv=none; d=google.com; s=arc-20160816; b=kWAF8xfu3bLcpF8br1IIhWyGqyVQIyStNiht6WNaPhpMgCHxsJBDeuFutHLIu78LZg ycBb/TBNf9PTaFKx9wnSmvKYDzsYDrmyMwwMHud7oSmhTVipWa8Uj/eMf12FRjqMNzS3 JzfdqlMZ43zOajU8Lxmvzzs6gn+n2Nrlh4TTgQU+JsGpMeC+sCM03tl8fb0vp7j9ce57 t4XodqwpxDAjMm5XL7YTOqCd2Kz0jggYho32Hwj2GNap1W1abr6OTPPaXm33V0IdECcy tNZZxkfeypepwN66e9zYGML3Ydc8mQ2o5p9wb+4xQKDWnXsRo2SDOCfYzPZnycD/nsr/ nYEA== 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=RxRUdWmNOzFbW06/oXjlpc/Ha36TYqwiBWfJ/9yrr1M=; b=TC2s+hQTTIJ8UwsNceyVcp/VdgjC1r1PY9cRnx5/embzP4X0KnfAqQ8XD5w/FJtVPA ydnR9cDjl6fgc7FpfQHRpdWCgQ1DAEugwcQ7HJRhQ3RpyOJ9zyvoL6YFX7pCuXAbx9Fu MfPcqEJrFN7wMIr8Yk7l5zQhH1bqjER/macU7G53t6tEwNfGZ44uVGFrN5UZC20AKi4m EhjAlR7hA6baaHuWrodCrI21ZjcrWOICUfK4RS7u1oF7i9C9qsSwtqsPSipKJhaSd+Pk kk0b6snjv9XZizQ1OKtDNlP2y8vxZb1+4dVlK3QFgbbBjvaVEV4bjHIrq2HcAPgXzG3d nNcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=lN3ghdTG; 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 d17si22256764vsb.79.2021.11.23.09.45.58 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 23 Nov 2021 09:45:58 -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=fail header.i=@linaro.org header.s=google header.b=lN3ghdTG; 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]:53900 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mpZrh-0003tX-RN for patch@linaro.org; Tue, 23 Nov 2021 12:45:57 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52274) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mpZkG-0004Bt-Gd for qemu-devel@nongnu.org; Tue, 23 Nov 2021 12:38:16 -0500 Received: from [2a00:1450:4864:20::432] (port=34776 helo=mail-wr1-x432.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mpZkE-00050K-1U for qemu-devel@nongnu.org; Tue, 23 Nov 2021 12:38:16 -0500 Received: by mail-wr1-x432.google.com with SMTP id j3so2589481wrp.1 for ; Tue, 23 Nov 2021 09:38:13 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=RxRUdWmNOzFbW06/oXjlpc/Ha36TYqwiBWfJ/9yrr1M=; b=lN3ghdTGSFt1TQ6AEby2EUjXG2KxGyANup+MXbuZcKs9e4iauIxlsschF46HrzOSfO mGQvKXsuchbDGY7sld5+Cd2U8earbssIR8IPvVUXdKkiNv233bKBD39pzQpw/gNUQ2bQ 1orun9lXgH7VXHixZ7JZ5AQ3Umy+M6Kho22qBWAWM4khIke8bOROxE90YJAu/YTK399l jlL553aYrJ+s7HSeW10yz9CmSl8Yghdpo4wbLNXe8g0HxuUt3MiuAKT6Cbcz8Xmx4O6d J8kXrbew0LvednC4ixTRohV3+m1ssTdSHgAbBLXuLIl1TIbnBddUgVz35XYSHEMpNZhl /D4Q== 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=RxRUdWmNOzFbW06/oXjlpc/Ha36TYqwiBWfJ/9yrr1M=; b=msr53ob+CS1BvPUmel1XIQSNz6Dl2fdzvIelhjMcTRNEZAZks5wstsKN6Hi0yIPQZ9 ZL21VZ6I2Sxf+Mmul6EMOA/0iQhn87HsTjEeRyesKr9C1XqnCZR9jf3P5BJHo4iV/SS5 8jVJ8sUNAQQtLLWBhSzCfqpnTGve03X6R4C3gnEpmHn7O4xjR7o+WyC/T5nJDkaHpkEF LenIamWZuCwrnVA5gYzFI3b+pRg2pCek8SZOlpdrIa0D9WmQ/NJCwg/XY5VXkfklefDB cR2ioRqZQJAKcxLPts4xL1Y08H6nh/C6fD054n1aGlXIbjCc2dEM6C1Ag/9K90Z0EYEO 1YDw== X-Gm-Message-State: AOAM531yWwCb4D+9+pFYwxD8knFqDBYnUUVSmFj2t4dbbndAKf/Gi407 qRyzBz+eeeTDGF2onx3mUNhuTDnyg7c6gIMKCgE= X-Received: by 2002:adf:f6cf:: with SMTP id y15mr9846356wrp.56.1637689092448; Tue, 23 Nov 2021 09:38:12 -0800 (PST) Received: from cloudburst.home (149.164.14.37.dynamic.jazztel.es. [37.14.164.149]) by smtp.gmail.com with ESMTPSA id n13sm13054883wrt.44.2021.11.23.09.38.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Nov 2021 09:38:11 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v6 06/16] linux-user: Remove HAVE_SAFE_SYSCALL and hostdep.h Date: Tue, 23 Nov 2021 18:37:49 +0100 Message-Id: <20211123173759.1383510-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211123173759.1383510-1-richard.henderson@linaro.org> References: <20211123173759.1383510-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::432 (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::432; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x432.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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, PDS_HP_HELO_NORDNS=0.001, 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.eu, imp@bsdimp.com, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" All supported hosts now define HAVE_SAFE_SYSCALL, so remove the ifdefs. This leaves hostdep.h empty, so remove it. Reviewed-by: Warner Losh Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- linux-user/host/aarch64/hostdep.h | 18 ------------------ linux-user/host/arm/hostdep.h | 18 ------------------ linux-user/host/i386/hostdep.h | 18 ------------------ linux-user/host/ia64/hostdep.h | 15 --------------- linux-user/host/mips/hostdep.h | 18 ------------------ linux-user/host/ppc/hostdep.h | 15 --------------- linux-user/host/ppc64/hostdep.h | 18 ------------------ linux-user/host/riscv/hostdep.h | 14 -------------- linux-user/host/s390/hostdep.h | 15 --------------- linux-user/host/s390x/hostdep.h | 18 ------------------ linux-user/host/sparc/hostdep.h | 15 --------------- linux-user/host/sparc64/hostdep.h | 18 ------------------ linux-user/host/x32/hostdep.h | 15 --------------- linux-user/host/x86_64/hostdep.h | 18 ------------------ linux-user/safe-syscall.h | 13 +------------ linux-user/user-internals.h | 1 - linux-user/safe-syscall-error.c | 3 --- linux-user/signal.c | 2 -- linux-user/safe-syscall.S | 3 --- 19 files changed, 1 insertion(+), 254 deletions(-) delete mode 100644 linux-user/host/aarch64/hostdep.h delete mode 100644 linux-user/host/arm/hostdep.h delete mode 100644 linux-user/host/i386/hostdep.h delete mode 100644 linux-user/host/ia64/hostdep.h delete mode 100644 linux-user/host/mips/hostdep.h delete mode 100644 linux-user/host/ppc/hostdep.h delete mode 100644 linux-user/host/ppc64/hostdep.h delete mode 100644 linux-user/host/riscv/hostdep.h delete mode 100644 linux-user/host/s390/hostdep.h delete mode 100644 linux-user/host/s390x/hostdep.h delete mode 100644 linux-user/host/sparc/hostdep.h delete mode 100644 linux-user/host/sparc64/hostdep.h delete mode 100644 linux-user/host/x32/hostdep.h delete mode 100644 linux-user/host/x86_64/hostdep.h diff --git a/linux-user/host/aarch64/hostdep.h b/linux-user/host/aarch64/hostdep.h deleted file mode 100644 index 39299d798a..0000000000 --- a/linux-user/host/aarch64/hostdep.h +++ /dev/null @@ -1,18 +0,0 @@ -/* - * hostdep.h : things which are dependent on the host architecture - * - * * Written by Peter Maydell - * - * Copyright (C) 2016 Linaro Limited - * - * This work is licensed under the terms of the GNU GPL, version 2 or later. - * See the COPYING file in the top-level directory. - */ - -#ifndef AARCH64_HOSTDEP_H -#define AARCH64_HOSTDEP_H - -/* We have a safe-syscall.inc.S */ -#define HAVE_SAFE_SYSCALL - -#endif diff --git a/linux-user/host/arm/hostdep.h b/linux-user/host/arm/hostdep.h deleted file mode 100644 index 86b137875a..0000000000 --- a/linux-user/host/arm/hostdep.h +++ /dev/null @@ -1,18 +0,0 @@ -/* - * hostdep.h : things which are dependent on the host architecture - * - * * Written by Peter Maydell - * - * Copyright (C) 2016 Linaro Limited - * - * This work is licensed under the terms of the GNU GPL, version 2 or later. - * See the COPYING file in the top-level directory. - */ - -#ifndef ARM_HOSTDEP_H -#define ARM_HOSTDEP_H - -/* We have a safe-syscall.inc.S */ -#define HAVE_SAFE_SYSCALL - -#endif diff --git a/linux-user/host/i386/hostdep.h b/linux-user/host/i386/hostdep.h deleted file mode 100644 index ce7136501f..0000000000 --- a/linux-user/host/i386/hostdep.h +++ /dev/null @@ -1,18 +0,0 @@ -/* - * hostdep.h : things which are dependent on the host architecture - * - * * Written by Peter Maydell - * - * Copyright (C) 2016 Linaro Limited - * - * This work is licensed under the terms of the GNU GPL, version 2 or later. - * See the COPYING file in the top-level directory. - */ - -#ifndef I386_HOSTDEP_H -#define I386_HOSTDEP_H - -/* We have a safe-syscall.inc.S */ -#define HAVE_SAFE_SYSCALL - -#endif diff --git a/linux-user/host/ia64/hostdep.h b/linux-user/host/ia64/hostdep.h deleted file mode 100644 index 263bf7658e..0000000000 --- a/linux-user/host/ia64/hostdep.h +++ /dev/null @@ -1,15 +0,0 @@ -/* - * hostdep.h : things which are dependent on the host architecture - * - * * Written by Peter Maydell - * - * Copyright (C) 2016 Linaro Limited - * - * This work is licensed under the terms of the GNU GPL, version 2 or later. - * See the COPYING file in the top-level directory. - */ - -#ifndef IA64_HOSTDEP_H -#define IA64_HOSTDEP_H - -#endif diff --git a/linux-user/host/mips/hostdep.h b/linux-user/host/mips/hostdep.h deleted file mode 100644 index d9e90a096b..0000000000 --- a/linux-user/host/mips/hostdep.h +++ /dev/null @@ -1,18 +0,0 @@ -/* - * hostdep.h : things which are dependent on the host architecture - * - * * Written by Peter Maydell - * - * Copyright (C) 2016 Linaro Limited - * - * This work is licensed under the terms of the GNU GPL, version 2 or later. - * See the COPYING file in the top-level directory. - */ - -#ifndef MIPS_HOSTDEP_H -#define MIPS_HOSTDEP_H - -/* We have a safe-syscall.inc.S */ -#define HAVE_SAFE_SYSCALL - -#endif diff --git a/linux-user/host/ppc/hostdep.h b/linux-user/host/ppc/hostdep.h deleted file mode 100644 index 23d8bd9d47..0000000000 --- a/linux-user/host/ppc/hostdep.h +++ /dev/null @@ -1,15 +0,0 @@ -/* - * hostdep.h : things which are dependent on the host architecture - * - * * Written by Peter Maydell - * - * Copyright (C) 2016 Linaro Limited - * - * This work is licensed under the terms of the GNU GPL, version 2 or later. - * See the COPYING file in the top-level directory. - */ - -#ifndef PPC_HOSTDEP_H -#define PPC_HOSTDEP_H - -#endif diff --git a/linux-user/host/ppc64/hostdep.h b/linux-user/host/ppc64/hostdep.h deleted file mode 100644 index 0c290dd904..0000000000 --- a/linux-user/host/ppc64/hostdep.h +++ /dev/null @@ -1,18 +0,0 @@ -/* - * hostdep.h : things which are dependent on the host architecture - * - * * Written by Peter Maydell - * - * Copyright (C) 2016 Linaro Limited - * - * This work is licensed under the terms of the GNU GPL, version 2 or later. - * See the COPYING file in the top-level directory. - */ - -#ifndef PPC64_HOSTDEP_H -#define PPC64_HOSTDEP_H - -/* We have a safe-syscall.inc.S */ -#define HAVE_SAFE_SYSCALL - -#endif diff --git a/linux-user/host/riscv/hostdep.h b/linux-user/host/riscv/hostdep.h deleted file mode 100644 index 7f67c22868..0000000000 --- a/linux-user/host/riscv/hostdep.h +++ /dev/null @@ -1,14 +0,0 @@ -/* - * hostdep.h : things which are dependent on the host architecture - * - * This work is licensed under the terms of the GNU GPL, version 2 or later. - * See the COPYING file in the top-level directory. - */ - -#ifndef RISCV_HOSTDEP_H -#define RISCV_HOSTDEP_H - -/* We have a safe-syscall.inc.S */ -#define HAVE_SAFE_SYSCALL - -#endif diff --git a/linux-user/host/s390/hostdep.h b/linux-user/host/s390/hostdep.h deleted file mode 100644 index afcba5a16a..0000000000 --- a/linux-user/host/s390/hostdep.h +++ /dev/null @@ -1,15 +0,0 @@ -/* - * hostdep.h : things which are dependent on the host architecture - * - * * Written by Peter Maydell - * - * Copyright (C) 2016 Linaro Limited - * - * This work is licensed under the terms of the GNU GPL, version 2 or later. - * See the COPYING file in the top-level directory. - */ - -#ifndef S390_HOSTDEP_H -#define S390_HOSTDEP_H - -#endif diff --git a/linux-user/host/s390x/hostdep.h b/linux-user/host/s390x/hostdep.h deleted file mode 100644 index d801145854..0000000000 --- a/linux-user/host/s390x/hostdep.h +++ /dev/null @@ -1,18 +0,0 @@ -/* - * hostdep.h : things which are dependent on the host architecture - * - * * Written by Peter Maydell - * - * Copyright (C) 2016 Linaro Limited - * - * This work is licensed under the terms of the GNU GPL, version 2 or later. - * See the COPYING file in the top-level directory. - */ - -#ifndef S390X_HOSTDEP_H -#define S390X_HOSTDEP_H - -/* We have a safe-syscall.inc.S */ -#define HAVE_SAFE_SYSCALL - -#endif diff --git a/linux-user/host/sparc/hostdep.h b/linux-user/host/sparc/hostdep.h deleted file mode 100644 index 391ad923cf..0000000000 --- a/linux-user/host/sparc/hostdep.h +++ /dev/null @@ -1,15 +0,0 @@ -/* - * hostdep.h : things which are dependent on the host architecture - * - * * Written by Peter Maydell - * - * Copyright (C) 2016 Linaro Limited - * - * This work is licensed under the terms of the GNU GPL, version 2 or later. - * See the COPYING file in the top-level directory. - */ - -#ifndef SPARC_HOSTDEP_H -#define SPARC_HOSTDEP_H - -#endif diff --git a/linux-user/host/sparc64/hostdep.h b/linux-user/host/sparc64/hostdep.h deleted file mode 100644 index d832868cb1..0000000000 --- a/linux-user/host/sparc64/hostdep.h +++ /dev/null @@ -1,18 +0,0 @@ -/* - * hostdep.h : things which are dependent on the host architecture - * - * * Written by Peter Maydell - * - * Copyright (C) 2016 Linaro Limited - * - * This work is licensed under the terms of the GNU GPL, version 2 or later. - * See the COPYING file in the top-level directory. - */ - -#ifndef SPARC64_HOSTDEP_H -#define SPARC64_HOSTDEP_H - -/* We have a safe-syscall.inc.S */ -#define HAVE_SAFE_SYSCALL - -#endif diff --git a/linux-user/host/x32/hostdep.h b/linux-user/host/x32/hostdep.h deleted file mode 100644 index 2c2d6d37da..0000000000 --- a/linux-user/host/x32/hostdep.h +++ /dev/null @@ -1,15 +0,0 @@ -/* - * hostdep.h : things which are dependent on the host architecture - * - * * Written by Peter Maydell - * - * Copyright (C) 2016 Linaro Limited - * - * This work is licensed under the terms of the GNU GPL, version 2 or later. - * See the COPYING file in the top-level directory. - */ - -#ifndef X32_HOSTDEP_H -#define X32_HOSTDEP_H - -#endif diff --git a/linux-user/host/x86_64/hostdep.h b/linux-user/host/x86_64/hostdep.h deleted file mode 100644 index 9c62bd26bd..0000000000 --- a/linux-user/host/x86_64/hostdep.h +++ /dev/null @@ -1,18 +0,0 @@ -/* - * hostdep.h : things which are dependent on the host architecture - * - * * Written by Peter Maydell - * - * Copyright (C) 2016 Linaro Limited - * - * This work is licensed under the terms of the GNU GPL, version 2 or later. - * See the COPYING file in the top-level directory. - */ - -#ifndef X86_64_HOSTDEP_H -#define X86_64_HOSTDEP_H - -/* We have a safe-syscall.inc.S */ -#define HAVE_SAFE_SYSCALL - -#endif diff --git a/linux-user/safe-syscall.h b/linux-user/safe-syscall.h index 97837faddb..f43267a8fc 100644 --- a/linux-user/safe-syscall.h +++ b/linux-user/safe-syscall.h @@ -124,7 +124,7 @@ * need to check SA_RESTART flags in QEMU or distinguish the various * kinds of restartability. */ -#ifdef HAVE_SAFE_SYSCALL + /* The core part of this function is implemented in assembly */ extern long safe_syscall_base(int *pending, long number, ...); extern long safe_syscall_set_errno_tail(int value); @@ -137,15 +137,4 @@ extern char safe_syscall_end[]; safe_syscall_base(&((TaskState *)thread_cpu->opaque)->signal_pending, \ __VA_ARGS__) -#else - -/* - * Fallback for architectures which don't yet provide a safe-syscall assembly - * fragment; note that this is racy! - * This should go away when all host architectures have been updated. - */ -#define safe_syscall syscall - -#endif - #endif diff --git a/linux-user/user-internals.h b/linux-user/user-internals.h index 661612a088..f71f372829 100644 --- a/linux-user/user-internals.h +++ b/linux-user/user-internals.h @@ -18,7 +18,6 @@ #ifndef LINUX_USER_USER_INTERNALS_H #define LINUX_USER_USER_INTERNALS_H -#include "hostdep.h" #include "exec/user/thunk.h" #include "exec/exec-all.h" #include "qemu/log.h" diff --git a/linux-user/safe-syscall-error.c b/linux-user/safe-syscall-error.c index d7e2700f81..55d95ac39a 100644 --- a/linux-user/safe-syscall-error.c +++ b/linux-user/safe-syscall-error.c @@ -10,10 +10,8 @@ */ #include "qemu/osdep.h" -#include "hostdep.h" #include "safe-syscall.h" -#ifdef HAVE_SAFE_SYSCALL /* * This is intended to be invoked via tail-call on the error path * from the assembly in host/arch/safe-syscall.inc.S. This takes @@ -25,4 +23,3 @@ long safe_syscall_set_errno_tail(int value) errno = value; return -1; } -#endif diff --git a/linux-user/signal.c b/linux-user/signal.c index 6d5e5b698c..ca8f24b9ec 100644 --- a/linux-user/signal.c +++ b/linux-user/signal.c @@ -798,7 +798,6 @@ int queue_signal(CPUArchState *env, int sig, int si_type, /* Adjust the signal context to rewind out of safe-syscall if we're in it */ static inline void rewind_if_in_safe_syscall(void *puc) { -#ifdef HAVE_SAFE_SYSCALL ucontext_t *uc = (ucontext_t *)puc; uintptr_t pcreg = host_signal_pc(uc); @@ -806,7 +805,6 @@ static inline void rewind_if_in_safe_syscall(void *puc) && pcreg < (uintptr_t)safe_syscall_end) { host_signal_set_pc(uc, (uintptr_t)safe_syscall_start); } -#endif } static void host_signal_handler(int host_sig, siginfo_t *info, void *puc) diff --git a/linux-user/safe-syscall.S b/linux-user/safe-syscall.S index 42ea7c40ba..7ddc997801 100644 --- a/linux-user/safe-syscall.S +++ b/linux-user/safe-syscall.S @@ -10,15 +10,12 @@ * See the COPYING file in the top-level directory. */ -#include "hostdep.h" #include "target_errno_defs.h" /* We have the correct host directory on our include path * so that this will pull in the right fragment for the architecture. */ -#ifdef HAVE_SAFE_SYSCALL #include "safe-syscall.inc.S" -#endif /* We must specifically say that we're happy for the stack to not be * executable, otherwise the toolchain will default to assuming our From patchwork Tue Nov 23 17:37:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 519322 Delivered-To: patch@linaro.org Received: by 2002:ac0:c605:0:0:0:0:0 with SMTP id p5csp8974888imj; Tue, 23 Nov 2021 09:39:54 -0800 (PST) X-Google-Smtp-Source: ABdhPJzThojxDIpL/9yrqw0XqzHIQ8P/tJYhk76A16+NgtAntsJ5Necvyoxo3bgG6ySun0VhcgWm X-Received: by 2002:ab0:f2:: with SMTP id 105mr10850328uaj.125.1637689194725; Tue, 23 Nov 2021 09:39:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1637689194; cv=none; d=google.com; s=arc-20160816; b=wLqjvE1gFnbEQbIckrUN9FAXT5WSBL0wB4cs063o8FIbvKZLET8IrhOy4/qHRVvnIH XVMRcTZJg6VeApj3bOyel0Bg4FQk+UyJXvGB5TTyt58dkZBpEyjly8SrSvpSttEt7f2N oB6h9N5zprdV2utedLnLIkgDHYLI7f1rfvCvOO8cFW6Ok5cjo/+RqriWKPLhVnGlN2Fg O97qAuWrMYRda+1KDgyxqc5R+tkdptORwTYLAwmPr0iXBwoQxEMMnkb+BB8R9vGJwFHQ owC9+esFUEyDp+8E0RP4kPxsJFGZmH29y1Jbd7WYnN3gUECpLgkJZP8Oki+r5UZ8tRTW vYBw== 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=CQBWb4vrOl0u0SYvunnH7Hx+p/iS9p5uKhN29onoZ/I=; b=UQyvz+0NHr5tnsSYDw0bmoty5S/7JxKSl+tiVuWBXveKJqsHXGF72FTUGXaV5aSStZ x0GdR2exICM5oG0viVfbr+6DqetymYk78GsZxmaTyaZ7522VAXiNViUM4ai8HJcrqicn 2Agi2Uu6CC5v+sGfg2zENlnleNDVAYU6haR7BM9V2w4u4xQvo1n2OShVgmtwjQY2V++z DgX2TiCSFi49u6+r1juRqaE+Mbjnlqf+0wWiVvN7xWOrbMnPLE5odYujWYLCe8/dPPb+ GHnvbmQ6AbTPC38g5/7+j5IPbbGqZnlZWofy2norXSvd2SwqMBuHR9A+qm1lsIZtgYjT 1djQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=DXY7e855; 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 t197si9474851vkd.15.2021.11.23.09.39.54 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 23 Nov 2021 09:39:54 -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=fail header.i=@linaro.org header.s=google header.b=DXY7e855; 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]:60246 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mpZlq-0006Eb-3i for patch@linaro.org; Tue, 23 Nov 2021 12:39:54 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52306) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mpZkI-0004GP-Dy for qemu-devel@nongnu.org; Tue, 23 Nov 2021 12:38:18 -0500 Received: from [2a00:1450:4864:20::434] (port=37594 helo=mail-wr1-x434.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mpZkF-00050Q-Ko for qemu-devel@nongnu.org; Tue, 23 Nov 2021 12:38:18 -0500 Received: by mail-wr1-x434.google.com with SMTP id b12so40292883wrh.4 for ; Tue, 23 Nov 2021 09:38:15 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=CQBWb4vrOl0u0SYvunnH7Hx+p/iS9p5uKhN29onoZ/I=; b=DXY7e855yXhM/W4XRBBeyZrAXJohpkbx289Vc1ZDDN19HxyizHCB5LZzi2LUAVLau1 jxxl7wJEVJWROpqNCxWcUnFVjtbU1rTk85oP7Sm9QoiFBm0XVxm1sr8ampCGXhMwqSQc mp5NGN+mUIF5FLTrsaqP33w2H9bDZbIefOV/9eKEm7aLk3MV3jvyDUqjpIqS11mk6pt5 E/1q1BKb33T8Ky5phxA70nYBGO/HQxMsnlspVWshO1ijf3r0xP8Q1Zn3TvdJzOfKH0eD 8XkO1O3ol9okzNk60PqWFZP5QWkT01/UHf5Z7zYqDRLd3Zi1exxNMII7ziaNEBo/jg5x V1QQ== 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=CQBWb4vrOl0u0SYvunnH7Hx+p/iS9p5uKhN29onoZ/I=; b=zEE4ShUALQahgzsbKPBgodILoJhUqpo63l2zUZxXnIzLGYE5PuWNOJnQ5lz1DtGMRK XsblPRZmrGjqIZmjxQN9wKgfnSU5sBGM6fnc1vYIgBHQGCexS3mZg5kHLfgTyJgVCvXn lawC4RbEYmSg+s3cC9MwUTUDaT1GQioS+tpAvt4FMnLJWK+CWnP+lt4jbEK+OhVDQyPC oAjoxLQd70XpZHmR/JBMlNcTRmnU9RLmtnlS6VYG5fisECdlxsTp3sUhR6XaGnq/bYj6 EkiKbDRB6oTqqEg/PZ1pXQnrdmGBL1G7KdyjTZz0whk/Rxowh9rd5HGmP1nm7Pai2tzv GMtw== X-Gm-Message-State: AOAM533N2lVoKSn2Wz83kJyS/GKQkUVhYuZLCCdIm/hwuwthyTFSe0mS qSiMQ0lv0axtzJmIICoEIo8+CLBa+p7sNFmyEIU= X-Received: by 2002:a5d:47aa:: with SMTP id 10mr9825534wrb.50.1637689093954; Tue, 23 Nov 2021 09:38:13 -0800 (PST) Received: from cloudburst.home (149.164.14.37.dynamic.jazztel.es. [37.14.164.149]) by smtp.gmail.com with ESMTPSA id n13sm13054883wrt.44.2021.11.23.09.38.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Nov 2021 09:38:13 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v6 07/16] linux-user: Rename TARGET_ERESTARTSYS to QEMU_ERESTARTSYS Date: Tue, 23 Nov 2021 18:37:50 +0100 Message-Id: <20211123173759.1383510-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211123173759.1383510-1-richard.henderson@linaro.org> References: <20211123173759.1383510-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::434 (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::434; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x434.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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, PDS_HP_HELO_NORDNS=0.001, 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.eu, imp@bsdimp.com, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" This value is fully internal to qemu, and so is not a TARGET define. We use this as an extra marker for both host and target errno. Reviewed-by: Warner Losh Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- linux-user/generic/target_errno_defs.h | 2 +- linux-user/safe-syscall.h | 8 ++++---- linux-user/signal-common.h | 2 +- linux-user/aarch64/cpu_loop.c | 2 +- linux-user/alpha/cpu_loop.c | 2 +- linux-user/arm/cpu_loop.c | 2 +- linux-user/cris/cpu_loop.c | 2 +- linux-user/hexagon/cpu_loop.c | 2 +- linux-user/hppa/cpu_loop.c | 2 +- linux-user/i386/cpu_loop.c | 6 +++--- linux-user/m68k/cpu_loop.c | 2 +- linux-user/microblaze/cpu_loop.c | 2 +- linux-user/mips/cpu_loop.c | 2 +- linux-user/openrisc/cpu_loop.c | 2 +- linux-user/ppc/cpu_loop.c | 2 +- linux-user/riscv/cpu_loop.c | 2 +- linux-user/s390x/cpu_loop.c | 2 +- linux-user/sh4/cpu_loop.c | 2 +- linux-user/signal.c | 6 +++--- linux-user/sparc/cpu_loop.c | 2 +- linux-user/syscall.c | 16 ++++++++-------- linux-user/xtensa/cpu_loop.c | 2 +- linux-user/host/aarch64/safe-syscall.inc.S | 3 +-- linux-user/host/arm/safe-syscall.inc.S | 2 +- linux-user/host/i386/safe-syscall.inc.S | 2 +- linux-user/host/mips/safe-syscall.inc.S | 2 +- linux-user/host/ppc64/safe-syscall.inc.S | 2 +- linux-user/host/riscv/safe-syscall.inc.S | 2 +- linux-user/host/s390x/safe-syscall.inc.S | 2 +- linux-user/host/sparc64/safe-syscall.inc.S | 2 +- linux-user/host/x86_64/safe-syscall.inc.S | 2 +- 31 files changed, 45 insertions(+), 46 deletions(-) diff --git a/linux-user/generic/target_errno_defs.h b/linux-user/generic/target_errno_defs.h index 17d85e0b61..58a06a10d6 100644 --- a/linux-user/generic/target_errno_defs.h +++ b/linux-user/generic/target_errno_defs.h @@ -153,7 +153,7 @@ * after handling any pending signals. They match with the ones the guest * kernel uses for the same purpose. */ -#define TARGET_ERESTARTSYS 512 /* Restart system call (if SA_RESTART) */ +#define QEMU_ERESTARTSYS 512 /* Restart system call (if SA_RESTART) */ /* QEMU internal, not visible to the guest. This is returned by the * do_sigreturn() code after a successful sigreturn syscall, to indicate diff --git a/linux-user/safe-syscall.h b/linux-user/safe-syscall.h index f43267a8fc..61a04e2b5a 100644 --- a/linux-user/safe-syscall.h +++ b/linux-user/safe-syscall.h @@ -25,10 +25,10 @@ * * Call a system call if guest signal not pending. * This has the same API as the libc syscall() function, except that it - * may return -1 with errno == TARGET_ERESTARTSYS if a signal was pending. + * may return -1 with errno == QEMU_ERESTARTSYS if a signal was pending. * * Returns: the system call result, or -1 with an error code in errno - * (Errnos are host errnos; we rely on TARGET_ERESTARTSYS not clashing + * (Errnos are host errnos; we rely on QEMU_ERESTARTSYS not clashing * with any of the host errno values.) */ @@ -81,7 +81,7 @@ * which are only technically blocking (ie which we know in practice won't * stay in the host kernel indefinitely) it's OK to use libc if necessary. * You must be able to cope with backing out correctly if some safe_syscall - * you make in the implementation returns either -TARGET_ERESTARTSYS or + * you make in the implementation returns either -QEMU_ERESTARTSYS or * EINTR though.) * * block_signals() cannot be used for interruptible syscalls. @@ -94,7 +94,7 @@ * handler checks the interrupted host PC against the addresse of that * known section. If the PC is before or at the address of the syscall * instruction then we change the PC to point at a "return - * -TARGET_ERESTARTSYS" code path instead, and then exit the signal handler + * -QEMU_ERESTARTSYS" code path instead, and then exit the signal handler * (causing the safe_syscall() call to immediately return that value). * Then in the main.c loop if we see this magic return value we adjust * the guest PC to wind it back to before the system call, and invoke diff --git a/linux-user/signal-common.h b/linux-user/signal-common.h index 7457f8025c..b9f33bb44f 100644 --- a/linux-user/signal-common.h +++ b/linux-user/signal-common.h @@ -76,7 +76,7 @@ abi_long do_swapcontext(CPUArchState *env, abi_ulong uold_ctx, * Block all signals, and arrange that the signal mask is returned to * its correct value for the guest before we resume execution of guest code. * If this function returns non-zero, then the caller should immediately - * return -TARGET_ERESTARTSYS to the main loop, which will take the pending + * return -QEMU_ERESTARTSYS to the main loop, which will take the pending * signal and restart execution of the syscall. * If block_signals() returns zero, then the caller can continue with * emulation of the system call knowing that no signals can be taken diff --git a/linux-user/aarch64/cpu_loop.c b/linux-user/aarch64/cpu_loop.c index 97e0728b67..775ba43913 100644 --- a/linux-user/aarch64/cpu_loop.c +++ b/linux-user/aarch64/cpu_loop.c @@ -99,7 +99,7 @@ void cpu_loop(CPUARMState *env) env->xregs[4], env->xregs[5], 0, 0); - if (ret == -TARGET_ERESTARTSYS) { + if (ret == -QEMU_ERESTARTSYS) { env->pc -= 4; } else if (ret != -TARGET_QEMU_ESIGRETURN) { env->xregs[0] = ret; diff --git a/linux-user/alpha/cpu_loop.c b/linux-user/alpha/cpu_loop.c index 4029849d5c..ce9b251ce3 100644 --- a/linux-user/alpha/cpu_loop.c +++ b/linux-user/alpha/cpu_loop.c @@ -98,7 +98,7 @@ void cpu_loop(CPUAlphaState *env) env->ir[IR_A2], env->ir[IR_A3], env->ir[IR_A4], env->ir[IR_A5], 0, 0); - if (sysret == -TARGET_ERESTARTSYS) { + if (sysret == -QEMU_ERESTARTSYS) { env->pc -= 4; break; } diff --git a/linux-user/arm/cpu_loop.c b/linux-user/arm/cpu_loop.c index 01cb6eb534..1fcf19750e 100644 --- a/linux-user/arm/cpu_loop.c +++ b/linux-user/arm/cpu_loop.c @@ -407,7 +407,7 @@ void cpu_loop(CPUARMState *env) env->regs[4], env->regs[5], 0, 0); - if (ret == -TARGET_ERESTARTSYS) { + if (ret == -QEMU_ERESTARTSYS) { env->regs[15] -= env->thumb ? 2 : 4; } else if (ret != -TARGET_QEMU_ESIGRETURN) { env->regs[0] = ret; diff --git a/linux-user/cris/cpu_loop.c b/linux-user/cris/cpu_loop.c index 0d5d268609..f3e5b13f89 100644 --- a/linux-user/cris/cpu_loop.c +++ b/linux-user/cris/cpu_loop.c @@ -50,7 +50,7 @@ void cpu_loop(CPUCRISState *env) env->pregs[7], env->pregs[11], 0, 0); - if (ret == -TARGET_ERESTARTSYS) { + if (ret == -QEMU_ERESTARTSYS) { env->pc -= 2; } else if (ret != -TARGET_QEMU_ESIGRETURN) { env->regs[10] = ret; diff --git a/linux-user/hexagon/cpu_loop.c b/linux-user/hexagon/cpu_loop.c index 6b24cbaba9..1cacbf42f1 100644 --- a/linux-user/hexagon/cpu_loop.c +++ b/linux-user/hexagon/cpu_loop.c @@ -54,7 +54,7 @@ void cpu_loop(CPUHexagonState *env) env->gpr[4], env->gpr[5], 0, 0); - if (ret == -TARGET_ERESTARTSYS) { + if (ret == -QEMU_ERESTARTSYS) { env->gpr[HEX_REG_PC] -= 4; } else if (ret != -TARGET_QEMU_ESIGRETURN) { env->gpr[0] = ret; diff --git a/linux-user/hppa/cpu_loop.c b/linux-user/hppa/cpu_loop.c index 375576c8f0..5315224d12 100644 --- a/linux-user/hppa/cpu_loop.c +++ b/linux-user/hppa/cpu_loop.c @@ -133,7 +133,7 @@ void cpu_loop(CPUHPPAState *env) env->iaoq_f = env->gr[31]; env->iaoq_b = env->gr[31] + 4; break; - case -TARGET_ERESTARTSYS: + case -QEMU_ERESTARTSYS: case -TARGET_QEMU_ESIGRETURN: break; } diff --git a/linux-user/i386/cpu_loop.c b/linux-user/i386/cpu_loop.c index f6a1cc632b..fbd9a353e5 100644 --- a/linux-user/i386/cpu_loop.c +++ b/linux-user/i386/cpu_loop.c @@ -180,7 +180,7 @@ static void emulate_vsyscall(CPUX86State *env) ret = do_syscall(env, syscall, env->regs[R_EDI], env->regs[R_ESI], env->regs[R_EDX], env->regs[10], env->regs[8], env->regs[9], 0, 0); - g_assert(ret != -TARGET_ERESTARTSYS); + g_assert(ret != -QEMU_ERESTARTSYS); g_assert(ret != -TARGET_QEMU_ESIGRETURN); if (ret == -TARGET_EFAULT) { goto sigsegv; @@ -223,7 +223,7 @@ void cpu_loop(CPUX86State *env) env->regs[R_EDI], env->regs[R_EBP], 0, 0); - if (ret == -TARGET_ERESTARTSYS) { + if (ret == -QEMU_ERESTARTSYS) { env->eip -= 2; } else if (ret != -TARGET_QEMU_ESIGRETURN) { env->regs[R_EAX] = ret; @@ -241,7 +241,7 @@ void cpu_loop(CPUX86State *env) env->regs[8], env->regs[9], 0, 0); - if (ret == -TARGET_ERESTARTSYS) { + if (ret == -QEMU_ERESTARTSYS) { env->eip -= 2; } else if (ret != -TARGET_QEMU_ESIGRETURN) { env->regs[R_EAX] = ret; diff --git a/linux-user/m68k/cpu_loop.c b/linux-user/m68k/cpu_loop.c index 790bd558c3..b03c21a3dc 100644 --- a/linux-user/m68k/cpu_loop.c +++ b/linux-user/m68k/cpu_loop.c @@ -80,7 +80,7 @@ void cpu_loop(CPUM68KState *env) env->dregs[5], env->aregs[0], 0, 0); - if (ret == -TARGET_ERESTARTSYS) { + if (ret == -QEMU_ERESTARTSYS) { env->pc -= 2; } else if (ret != -TARGET_QEMU_ESIGRETURN) { env->dregs[0] = ret; diff --git a/linux-user/microblaze/cpu_loop.c b/linux-user/microblaze/cpu_loop.c index a94467dd2d..6e368f986e 100644 --- a/linux-user/microblaze/cpu_loop.c +++ b/linux-user/microblaze/cpu_loop.c @@ -53,7 +53,7 @@ void cpu_loop(CPUMBState *env) env->regs[9], env->regs[10], 0, 0); - if (ret == -TARGET_ERESTARTSYS) { + if (ret == -QEMU_ERESTARTSYS) { /* Wind back to before the syscall. */ env->pc -= 4; } else if (ret != -TARGET_QEMU_ESIGRETURN) { diff --git a/linux-user/mips/cpu_loop.c b/linux-user/mips/cpu_loop.c index b735c99a24..64f308c6ad 100644 --- a/linux-user/mips/cpu_loop.c +++ b/linux-user/mips/cpu_loop.c @@ -141,7 +141,7 @@ done_syscall: env->active_tc.gpr[8], env->active_tc.gpr[9], env->active_tc.gpr[10], env->active_tc.gpr[11]); # endif /* O32 */ - if (ret == -TARGET_ERESTARTSYS) { + if (ret == -QEMU_ERESTARTSYS) { env->active_tc.PC -= 4; break; } diff --git a/linux-user/openrisc/cpu_loop.c b/linux-user/openrisc/cpu_loop.c index 3cfdbbf037..3147ab2b62 100644 --- a/linux-user/openrisc/cpu_loop.c +++ b/linux-user/openrisc/cpu_loop.c @@ -48,7 +48,7 @@ void cpu_loop(CPUOpenRISCState *env) cpu_get_gpr(env, 6), cpu_get_gpr(env, 7), cpu_get_gpr(env, 8), 0, 0); - if (ret == -TARGET_ERESTARTSYS) { + if (ret == -QEMU_ERESTARTSYS) { env->pc -= 4; } else if (ret != -TARGET_QEMU_ESIGRETURN) { cpu_set_gpr(env, 11, ret); diff --git a/linux-user/ppc/cpu_loop.c b/linux-user/ppc/cpu_loop.c index 483e669300..5348641e9e 100644 --- a/linux-user/ppc/cpu_loop.c +++ b/linux-user/ppc/cpu_loop.c @@ -428,7 +428,7 @@ void cpu_loop(CPUPPCState *env) ret = do_syscall(env, env->gpr[0], env->gpr[3], env->gpr[4], env->gpr[5], env->gpr[6], env->gpr[7], env->gpr[8], 0, 0); - if (ret == -TARGET_ERESTARTSYS) { + if (ret == -QEMU_ERESTARTSYS) { env->nip -= 4; break; } diff --git a/linux-user/riscv/cpu_loop.c b/linux-user/riscv/cpu_loop.c index b301dac802..20f8c48b1d 100644 --- a/linux-user/riscv/cpu_loop.c +++ b/linux-user/riscv/cpu_loop.c @@ -69,7 +69,7 @@ void cpu_loop(CPURISCVState *env) env->gpr[xA5], 0, 0); } - if (ret == -TARGET_ERESTARTSYS) { + if (ret == -QEMU_ERESTARTSYS) { env->pc -= 4; } else if (ret != -TARGET_QEMU_ESIGRETURN) { env->gpr[xA0] = ret; diff --git a/linux-user/s390x/cpu_loop.c b/linux-user/s390x/cpu_loop.c index d089c8417e..043582ca7c 100644 --- a/linux-user/s390x/cpu_loop.c +++ b/linux-user/s390x/cpu_loop.c @@ -83,7 +83,7 @@ void cpu_loop(CPUS390XState *env) ret = do_syscall(env, n, env->regs[2], env->regs[3], env->regs[4], env->regs[5], env->regs[6], env->regs[7], 0, 0); - if (ret == -TARGET_ERESTARTSYS) { + if (ret == -QEMU_ERESTARTSYS) { env->psw.addr -= env->int_svc_ilen; } else if (ret != -TARGET_QEMU_ESIGRETURN) { env->regs[2] = ret; diff --git a/linux-user/sh4/cpu_loop.c b/linux-user/sh4/cpu_loop.c index ac9b01840c..6c4ebfa969 100644 --- a/linux-user/sh4/cpu_loop.c +++ b/linux-user/sh4/cpu_loop.c @@ -50,7 +50,7 @@ void cpu_loop(CPUSH4State *env) env->gregs[0], env->gregs[1], 0, 0); - if (ret == -TARGET_ERESTARTSYS) { + if (ret == -QEMU_ERESTARTSYS) { env->pc -= 2; } else if (ret != -TARGET_QEMU_ESIGRETURN) { env->gregs[0] = ret; diff --git a/linux-user/signal.c b/linux-user/signal.c index ca8f24b9ec..12b1705287 100644 --- a/linux-user/signal.c +++ b/linux-user/signal.c @@ -213,7 +213,7 @@ int block_signals(void) /* Wrapper for sigprocmask function * Emulates a sigprocmask in a safe way for the guest. Note that set and oldset - * are host signal set, not guest ones. Returns -TARGET_ERESTARTSYS if + * are host signal set, not guest ones. Returns -QEMU_ERESTARTSYS if * a signal was already pending and the syscall must be restarted, or * 0 on success. * If set is NULL, this is guaranteed not to fail. @@ -230,7 +230,7 @@ int do_sigprocmask(int how, const sigset_t *set, sigset_t *oldset) int i; if (block_signals()) { - return -TARGET_ERESTARTSYS; + return -QEMU_ERESTARTSYS; } switch (how) { @@ -985,7 +985,7 @@ int do_sigaction(int sig, const struct target_sigaction *act, } if (block_signals()) { - return -TARGET_ERESTARTSYS; + return -QEMU_ERESTARTSYS; } k = &sigact_table[sig - 1]; diff --git a/linux-user/sparc/cpu_loop.c b/linux-user/sparc/cpu_loop.c index 0ba65e431c..529337c5e0 100644 --- a/linux-user/sparc/cpu_loop.c +++ b/linux-user/sparc/cpu_loop.c @@ -181,7 +181,7 @@ void cpu_loop (CPUSPARCState *env) env->regwptr[2], env->regwptr[3], env->regwptr[4], env->regwptr[5], 0, 0); - if (ret == -TARGET_ERESTARTSYS || ret == -TARGET_QEMU_ESIGRETURN) { + if (ret == -QEMU_ERESTARTSYS || ret == -TARGET_QEMU_ESIGRETURN) { break; } if ((abi_ulong)ret >= (abi_ulong)(-515)) { diff --git a/linux-user/syscall.c b/linux-user/syscall.c index f1cfcc8104..23fb45e0f1 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -547,7 +547,7 @@ static inline abi_long get_errno(abi_long ret) const char *target_strerror(int err) { - if (err == TARGET_ERESTARTSYS) { + if (err == QEMU_ERESTARTSYS) { return "To be restarted"; } if (err == TARGET_QEMU_ESIGRETURN) { @@ -6458,7 +6458,7 @@ static int do_fork(CPUArchState *env, unsigned int flags, abi_ulong newsp, } if (block_signals()) { - return -TARGET_ERESTARTSYS; + return -QEMU_ERESTARTSYS; } fork_start(); @@ -8328,7 +8328,7 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1, Do thread termination if we have more then one thread. */ if (block_signals()) { - return -TARGET_ERESTARTSYS; + return -QEMU_ERESTARTSYS; } pthread_mutex_lock(&clone_lock); @@ -9317,7 +9317,7 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1, #endif ret = get_errno(safe_rt_sigsuspend(&ts->sigsuspend_mask, SIGSET_T_SIZE)); - if (ret != -TARGET_ERESTARTSYS) { + if (ret != -QEMU_ERESTARTSYS) { ts->in_sigsuspend = 1; } } @@ -9336,7 +9336,7 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1, unlock_user(p, arg1, 0); ret = get_errno(safe_rt_sigsuspend(&ts->sigsuspend_mask, SIGSET_T_SIZE)); - if (ret != -TARGET_ERESTARTSYS) { + if (ret != -QEMU_ERESTARTSYS) { ts->in_sigsuspend = 1; } } @@ -9452,13 +9452,13 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1, #ifdef TARGET_NR_sigreturn case TARGET_NR_sigreturn: if (block_signals()) { - return -TARGET_ERESTARTSYS; + return -QEMU_ERESTARTSYS; } return do_sigreturn(cpu_env); #endif case TARGET_NR_rt_sigreturn: if (block_signals()) { - return -TARGET_ERESTARTSYS; + return -QEMU_ERESTARTSYS; } return do_rt_sigreturn(cpu_env); case TARGET_NR_sethostname: @@ -13145,7 +13145,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, static bool flag; flag = !flag; if (flag) { - return -TARGET_ERESTARTSYS; + return -QEMU_ERESTARTSYS; } } #endif diff --git a/linux-user/xtensa/cpu_loop.c b/linux-user/xtensa/cpu_loop.c index a83490ab35..29cc6f3830 100644 --- a/linux-user/xtensa/cpu_loop.c +++ b/linux-user/xtensa/cpu_loop.c @@ -184,7 +184,7 @@ void cpu_loop(CPUXtensaState *env) env->regs[2] = ret; break; - case -TARGET_ERESTARTSYS: + case -QEMU_ERESTARTSYS: env->pc -= 3; break; diff --git a/linux-user/host/aarch64/safe-syscall.inc.S b/linux-user/host/aarch64/safe-syscall.inc.S index 76a0a18a6c..87c9580faa 100644 --- a/linux-user/host/aarch64/safe-syscall.inc.S +++ b/linux-user/host/aarch64/safe-syscall.inc.S @@ -70,8 +70,7 @@ safe_syscall_end: b safe_syscall_set_errno_tail /* code path when we didn't execute the syscall */ -2: mov w0, #TARGET_ERESTARTSYS +2: mov w0, #QEMU_ERESTARTSYS b safe_syscall_set_errno_tail - .cfi_endproc .size safe_syscall_base, .-safe_syscall_base diff --git a/linux-user/host/arm/safe-syscall.inc.S b/linux-user/host/arm/safe-syscall.inc.S index 618112c6bf..f1a6aabfd3 100644 --- a/linux-user/host/arm/safe-syscall.inc.S +++ b/linux-user/host/arm/safe-syscall.inc.S @@ -81,7 +81,7 @@ safe_syscall_end: pop { r4, r5, r6, r7, r8, pc } /* code path when we didn't execute the syscall */ -2: mov r0, #TARGET_ERESTARTSYS +2: mov r0, #QEMU_ERESTARTSYS /* code path setting errno */ 1: pop { r4, r5, r6, r7, r8, lr } diff --git a/linux-user/host/i386/safe-syscall.inc.S b/linux-user/host/i386/safe-syscall.inc.S index f5883234bb..1fb031d228 100644 --- a/linux-user/host/i386/safe-syscall.inc.S +++ b/linux-user/host/i386/safe-syscall.inc.S @@ -94,7 +94,7 @@ safe_syscall_end: jmp 1f /* code path when we didn't execute the syscall */ -2: mov $TARGET_ERESTARTSYS, %eax +2: mov $QEMU_ERESTARTSYS, %eax /* code path setting errno */ 1: pop %ebx diff --git a/linux-user/host/mips/safe-syscall.inc.S b/linux-user/host/mips/safe-syscall.inc.S index c6dd726001..3252aff23d 100644 --- a/linux-user/host/mips/safe-syscall.inc.S +++ b/linux-user/host/mips/safe-syscall.inc.S @@ -102,7 +102,7 @@ safe_syscall_end: jr ra /* code path when we didn't execute the syscall */ -2: li v0, TARGET_ERESTARTSYS +2: li v0, QEMU_ERESTARTSYS /* code path setting errno */ /* diff --git a/linux-user/host/ppc64/safe-syscall.inc.S b/linux-user/host/ppc64/safe-syscall.inc.S index b370889480..36230169f4 100644 --- a/linux-user/host/ppc64/safe-syscall.inc.S +++ b/linux-user/host/ppc64/safe-syscall.inc.S @@ -74,7 +74,7 @@ safe_syscall_end: blr /* code path when we didn't execute the syscall */ -2: addi 3, 0, TARGET_ERESTARTSYS +2: addi 3, 0, QEMU_ERESTARTSYS /* code path setting errno */ 1: b safe_syscall_set_errno_tail diff --git a/linux-user/host/riscv/safe-syscall.inc.S b/linux-user/host/riscv/safe-syscall.inc.S index 54c2e23f75..ca456d8a46 100644 --- a/linux-user/host/riscv/safe-syscall.inc.S +++ b/linux-user/host/riscv/safe-syscall.inc.S @@ -72,7 +72,7 @@ safe_syscall_end: j safe_syscall_set_errno_tail /* code path when we didn't execute the syscall */ -2: li a0, TARGET_ERESTARTSYS +2: li a0, QEMU_ERESTARTSYS j safe_syscall_set_errno_tail .cfi_endproc diff --git a/linux-user/host/s390x/safe-syscall.inc.S b/linux-user/host/s390x/safe-syscall.inc.S index 899dab39e9..66f84385a2 100644 --- a/linux-user/host/s390x/safe-syscall.inc.S +++ b/linux-user/host/s390x/safe-syscall.inc.S @@ -91,7 +91,7 @@ safe_syscall_end: 2: lg %r15,0(%r15) /* load back chain */ .cfi_adjust_cfa_offset -160 lmg %r6,%r15,48(%r15) /* load saved registers */ - lghi %r2, TARGET_ERESTARTSYS + lghi %r2, QEMU_ERESTARTSYS jg safe_syscall_set_errno_tail .cfi_endproc diff --git a/linux-user/host/sparc64/safe-syscall.inc.S b/linux-user/host/sparc64/safe-syscall.inc.S index bb35c64cfc..3a0e76fcc7 100644 --- a/linux-user/host/sparc64/safe-syscall.inc.S +++ b/linux-user/host/sparc64/safe-syscall.inc.S @@ -78,7 +78,7 @@ safe_syscall_end: nop /* code path when we didn't execute the syscall */ -2: set TARGET_ERESTARTSYS, %o0 +2: set QEMU_ERESTARTSYS, %o0 /* code path setting errno */ 1: mov %o7, %g1 diff --git a/linux-user/host/x86_64/safe-syscall.inc.S b/linux-user/host/x86_64/safe-syscall.inc.S index 39b64250c3..f88cbe1347 100644 --- a/linux-user/host/x86_64/safe-syscall.inc.S +++ b/linux-user/host/x86_64/safe-syscall.inc.S @@ -82,7 +82,7 @@ safe_syscall_end: jmp 1f /* code path when we didn't execute the syscall */ -2: mov $TARGET_ERESTARTSYS, %eax +2: mov $QEMU_ERESTARTSYS, %eax /* code path setting errno */ 1: pop %rbp From patchwork Tue Nov 23 17:37:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 519325 Delivered-To: patch@linaro.org Received: by 2002:ac0:c605:0:0:0:0:0 with SMTP id p5csp8977382imj; Tue, 23 Nov 2021 09:41:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJxXR+Y8wc10P7Snsu67o14dgOxn39H6i84PGZvq9/wMuroxiyxp36tVjcAfhmX6o/rgydgZ X-Received: by 2002:a05:6122:1796:: with SMTP id o22mr13244842vkf.23.1637689290932; Tue, 23 Nov 2021 09:41:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1637689290; cv=none; d=google.com; s=arc-20160816; b=K8d3HfZUVK1Uq4WxxWAlnuzJY4apEjb5057GKKH694s9dGFDHDF4UW0/UhOxqzaty5 9s8WXbY99pb6ByVnpf3tEUEQ6zPblYkY9nIGtWROLB8ps5wkI/Ml3hIqRZ91/0QYxuWr ykJl1046MnvDvLGln6EQ0RzzuxSn6hdRY+atn3SnYl+uyvB72DqHkwboaYkDNA6ReuTA b2ujHomuEE/ZG/6fLWIf1gBbsbGZG3tXfRkYGdScDOZE1d/e97U3KPKUXERXMMm4H0X2 t9G81PYxXzSJuNJ73LlpnWcRYxpPyOJNFuAGtXCOtSYORZ0UEFH9e5xDHRWXOb0PZFQD Z+2Q== 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=TFNb/strBQB9hLaOeOMEOLWgIeKVijWjHGUQ12nJnAw=; b=h1FFBJsEKIgoWIcaOTtGmpla3fz4doSBf0IayF0XOu4PseduETLYKhBqujbLCXU3Ow cdiBa4vHPKDmp8g5FYXRD+Ll7FQwm4hBky3Z0BtTz7Wk1wzU96hy8YnPWBN/yW36YUIM C11nu5F0J1Ly7sG2/3Jom4zhxzknL38r7a57R4PX08Sm/DhLCFTB4csGwil98yjXGxY1 dpO7NUO9Qbbn/QGudSpAtIwdXmhy+dxG7nyOI5ssaNkO7ezw2xDWzK8M4rhu4TkkOhYQ VRcOXvhWaiX93dVhf7cr7lTk9En1DC7vTK0OBbpP13OvIAiR4GNlCk+s0tD+cwRXwDxw zQgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=OGA2+Qf0; 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 w1si29660988vse.114.2021.11.23.09.41.30 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 23 Nov 2021 09:41:30 -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=fail header.i=@linaro.org header.s=google header.b=OGA2+Qf0; 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]:37502 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mpZnO-0001Pm-E0 for patch@linaro.org; Tue, 23 Nov 2021 12:41:30 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52298) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mpZkH-0004FW-Vy for qemu-devel@nongnu.org; Tue, 23 Nov 2021 12:38:18 -0500 Received: from [2a00:1450:4864:20::42d] (port=33772 helo=mail-wr1-x42d.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mpZkG-00050a-FH for qemu-devel@nongnu.org; Tue, 23 Nov 2021 12:38:17 -0500 Received: by mail-wr1-x42d.google.com with SMTP id d24so40360166wra.0 for ; Tue, 23 Nov 2021 09:38:16 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=TFNb/strBQB9hLaOeOMEOLWgIeKVijWjHGUQ12nJnAw=; b=OGA2+Qf0QlY3J8KsHQepxJh+BCNJwpr5wQSM2Gow4GU5sXB4HJB7iczF7G9FtLjsCc 7tnFvZQKrIlt2URVjbGgZuq/V9KE8tbRTOH1hYQuFcvkvFewTABhTPprFgLWEPk2+ehe g+mdGnO93sjwvlLzptDVNCbGVOOtfmsOyGcUur2L86uGUaKfHVV2yPMErNB2p0aMDfRs apeQyj3lULodIjK9RK/74Uq0MGOoVQYqpfhOMEIMgRIJph2ktCNejfotzW1Yde95CAnL lv3lJ7O78nH0xO+1L12Fp+Sks6qQmZUjoFULf1ukbYZRz8INUepvpZXmaV7QItw6G/Yn PxEA== 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=TFNb/strBQB9hLaOeOMEOLWgIeKVijWjHGUQ12nJnAw=; b=pfnI/p4NPQrzuwcgitrd8n8ybfBFhomaGP82BmklXKDXuv9DO0NSqvSLJbUuXZnS72 ONil5x9cHa2TmAPoBpatB6x6eE0g2z6pWVcQR4eHrICfZJcSMdRXs3yvo/hJkL2L6dgn zr9aXDx7BzAhyvKltvbs7r6ARzpqoWTGfs2Vcxhxwh4mkod3p8CzoS5Z0ohOX5RE/QQ2 EvqtbkM+r/x8c3PdREImXdjZH1c7pHNUCrHGQjcgqdHE9+0tvFeCdSzAO23rwXkvDVkK FaciNEeQtblGxCPyOKR5Ocyyeqkqq9gflHfnQA0NJlRQ8rJhuroNw4yVOVjV1PCJGe+p nArg== X-Gm-Message-State: AOAM532E/5As0+cLsFFdfc9bpTV3RldBqiwezY62anZ2aqjHXBAYwPlT 2ZH+vNg6lJq1MQ2CyoDRYapJ6Nv13BjskIElHSc= X-Received: by 2002:adf:f90a:: with SMTP id b10mr9689970wrr.255.1637689095137; Tue, 23 Nov 2021 09:38:15 -0800 (PST) Received: from cloudburst.home (149.164.14.37.dynamic.jazztel.es. [37.14.164.149]) by smtp.gmail.com with ESMTPSA id n13sm13054883wrt.44.2021.11.23.09.38.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Nov 2021 09:38:14 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v6 08/16] bsd-user: Rename TARGET_ERESTARTSYS to QEMU_ERESTARTSYS Date: Tue, 23 Nov 2021 18:37:51 +0100 Message-Id: <20211123173759.1383510-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211123173759.1383510-1-richard.henderson@linaro.org> References: <20211123173759.1383510-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::42d (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::42d; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x42d.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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, PDS_HP_HELO_NORDNS=0.001, 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.eu, imp@bsdimp.com, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" This value is fully internal to qemu, and so is not a TARGET define. We use this as an extra marker for both host and target errno. Reviewed-by: Warner Losh Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- bsd-user/errno_defs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bsd-user/errno_defs.h b/bsd-user/errno_defs.h index 832671354f..141e08456c 100644 --- a/bsd-user/errno_defs.h +++ b/bsd-user/errno_defs.h @@ -151,6 +151,6 @@ /* Internal errors: */ #define TARGET_EJUSTRETURN 254 /* Just return without modifing regs */ #define TARGET_ERESTART 255 /* Restart syscall */ -#define TARGET_ERESTARTSYS TARGET_ERESTART /* Linux compat */ +#define QEMU_ERESTARTSYS TARGET_ERESTART #endif /* ! _ERRNO_DEFS_H_ */ From patchwork Tue Nov 23 17:37:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 519329 Delivered-To: patch@linaro.org Received: by 2002:ac0:c605:0:0:0:0:0 with SMTP id p5csp8980317imj; Tue, 23 Nov 2021 09:43:46 -0800 (PST) X-Google-Smtp-Source: ABdhPJz1e9ZvVcFEiyNzmCHk8TKbJryzFQQyD94jRKDacN81MP1LcLsK+jOaT+DZOdpdmwFGJ8zz X-Received: by 2002:a67:ed87:: with SMTP id d7mr11512583vsp.30.1637689426717; Tue, 23 Nov 2021 09:43:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1637689426; cv=none; d=google.com; s=arc-20160816; b=qhhjUUzzAlheKEyo5hgdx6ESWPFAFfczBdP4wwA3WbvKylXDv9zQR9lOcb++NNg8BJ eM89S+EubznRaWvtkjlEIxs23CiGXoSzydoNznHe8VWmkoSFgZsul5ZZVirdPwJGgkB9 XQrlnyy6J8jIByfuJ02v826U/B/jmRgn6N4cW9ts7XnH5/Ci+GBUCr/Xc6wleNlyMEaB 82qpSAHpyqChQkz6KVyikTvdJTIaOp3pNxKe7bh5X4tycfYEuc4PRK6iN/miSidDD5qW mtSTQlULxKCWSPbqUI+Xbn1zbvotdz1bAGTzIRW22w1SPcuR19aqcLDdo/PalEh3pr7n Oddg== 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=OXKTkD0XslX3F2mSmJn4vyqwKgYwlny2SKE6rytHBgc=; b=rjZAd+kDQUmsouDAm5xsfdW5bpy9fCS3sFnmxRn2ulOaeDLdm1c6mUiAyXcycflj4c OLE9ZoiavD6ocyASgtSukg0Fq1si7f44jU9Y7bxocVkNB58Vbq5bbz5lzgOtLrFxAwJT v0KSNxWTbDr0A3wUMzD+H4w4gpYnDp/82lFnF1UyON0x9BKbT4KVL4nXPHXQACgpPTqD CHqIfftOM60jFAPelLjeP/dht6Adq0GeeQQF1kTs+MbMOBVhprmasFbkM5DCxIQKAwwM /0YfBR3AiGT2mD2CBZNkgGZMiRcr/Pc384wDRcWv79/qToS/ksIZVKRHxmlBIuMwGUc2 KPlw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=O1nnyRHf; 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 t24si8338269vkl.29.2021.11.23.09.43.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 23 Nov 2021 09:43:46 -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=fail header.i=@linaro.org header.s=google header.b=O1nnyRHf; 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]:45794 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mpZpa-0006wS-4n for patch@linaro.org; Tue, 23 Nov 2021 12:43:46 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52328) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mpZkL-0004O2-PO for qemu-devel@nongnu.org; Tue, 23 Nov 2021 12:38:21 -0500 Received: from [2a00:1450:4864:20::434] (port=38889 helo=mail-wr1-x434.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mpZkI-00050o-5g for qemu-devel@nongnu.org; Tue, 23 Nov 2021 12:38:20 -0500 Received: by mail-wr1-x434.google.com with SMTP id u18so40327608wrg.5 for ; Tue, 23 Nov 2021 09:38:17 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=OXKTkD0XslX3F2mSmJn4vyqwKgYwlny2SKE6rytHBgc=; b=O1nnyRHfvSbXUVrYTgeKVqB0X1EMBbMQyt95U6KULYBdOQvi7K8fswJsiWWdECdx1k 6ozICRykxjYTm879I1LQkfVEyfWFxXdM39wi0cDFOvfwh47xTVLBXwjQ3hJHTBFqJapK O93KNcuzygkIKyy04urGTmrODyoJUbnGGrOaWQ/iu0VZhkXh+CMw7QgGutjOJHUAib6X 1/0SsIK+Jq27wug/AdGgdm/+jcdczPnhiYLeAPyBKx+mfSX6UfmfrlXWC8aM1j8fweBL baZgStG/r7tybi7tomK44owKav1B9dIZfDMQUSa3UrB7cxJgcXzGJsQ8/MSm7AYNYk35 r88g== 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=OXKTkD0XslX3F2mSmJn4vyqwKgYwlny2SKE6rytHBgc=; b=XJHD1vpP/ap4NvIDhL727XtRO26DIQXSHYob4GsrSrNXKc7++enK5nE6Vm+zc7WzrA 5/Q3Q6KkP8fd6+v3ABilRYMBNa/Lu/0RumRvuED/4d3zWsA2Z1Xmk7JrVlVfE0LXJ1Io TFJ99ZNDirzX90Zmt/TXJM3iOgW7XfJhYY50zEkGqNuftjsjhpdwLMkZvbb2YCs7PZeZ k6pMWeCDaCKc3UMSa1LQNuqQ4ZwSsaIz2wu7y+n+iSumNdDVGwpH7jutbrLacYoB+3KD moMFy8WRN0GKqGV1VRDPLMqEwFIbSMAYdgdnERFJAnIyMbSckQvtEz2EWmjmn0VrCyh1 M7MQ== X-Gm-Message-State: AOAM530EaqlhgVWTqqHPAELqiVKWw3X+m0uxWoXcGBpt9EzTkzNCgsmJ TWwszrbiNt4uiz3FIDF2Ds0tdrB/9cPa/538mT4= X-Received: by 2002:a5d:64ea:: with SMTP id g10mr9597935wri.137.1637689096541; Tue, 23 Nov 2021 09:38:16 -0800 (PST) Received: from cloudburst.home (149.164.14.37.dynamic.jazztel.es. [37.14.164.149]) by smtp.gmail.com with ESMTPSA id n13sm13054883wrt.44.2021.11.23.09.38.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Nov 2021 09:38:16 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v6 09/16] linux-user: Rename TARGET_QEMU_ESIGRETURN to QEMU_ESIGRETURN Date: Tue, 23 Nov 2021 18:37:52 +0100 Message-Id: <20211123173759.1383510-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211123173759.1383510-1-richard.henderson@linaro.org> References: <20211123173759.1383510-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::434 (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::434; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x434.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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, PDS_HP_HELO_NORDNS=0.001, 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.eu, imp@bsdimp.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" This value is fully internal to qemu, and so is not a TARGET define. Reviewed-by: Warner Losh Signed-off-by: Richard Henderson --- linux-user/generic/target_errno_defs.h | 2 +- linux-user/aarch64/cpu_loop.c | 2 +- linux-user/aarch64/signal.c | 4 ++-- linux-user/alpha/cpu_loop.c | 2 +- linux-user/alpha/signal.c | 8 ++++---- linux-user/arm/cpu_loop.c | 2 +- linux-user/arm/signal.c | 8 ++++---- linux-user/cris/cpu_loop.c | 2 +- linux-user/cris/signal.c | 4 ++-- linux-user/hexagon/cpu_loop.c | 2 +- linux-user/hexagon/signal.c | 2 +- linux-user/hppa/cpu_loop.c | 2 +- linux-user/hppa/signal.c | 4 ++-- linux-user/i386/cpu_loop.c | 6 +++--- linux-user/i386/signal.c | 8 ++++---- linux-user/m68k/cpu_loop.c | 2 +- linux-user/m68k/signal.c | 8 ++++---- linux-user/microblaze/cpu_loop.c | 2 +- linux-user/microblaze/signal.c | 4 ++-- linux-user/mips/cpu_loop.c | 2 +- linux-user/mips/signal.c | 8 ++++---- linux-user/openrisc/cpu_loop.c | 2 +- linux-user/ppc/cpu_loop.c | 2 +- linux-user/ppc/signal.c | 10 +++++----- linux-user/riscv/cpu_loop.c | 2 +- linux-user/riscv/signal.c | 2 +- linux-user/s390x/cpu_loop.c | 2 +- linux-user/s390x/signal.c | 8 ++++---- linux-user/sh4/cpu_loop.c | 2 +- linux-user/sh4/signal.c | 8 ++++---- linux-user/sparc/cpu_loop.c | 2 +- linux-user/sparc/signal.c | 8 ++++---- linux-user/syscall.c | 2 +- linux-user/xtensa/cpu_loop.c | 2 +- linux-user/xtensa/signal.c | 4 ++-- 35 files changed, 70 insertions(+), 70 deletions(-) diff --git a/linux-user/generic/target_errno_defs.h b/linux-user/generic/target_errno_defs.h index 58a06a10d6..bb37d88be9 100644 --- a/linux-user/generic/target_errno_defs.h +++ b/linux-user/generic/target_errno_defs.h @@ -162,6 +162,6 @@ * ERESTART_NOINTR (which is kernel internal) to guarantee that we won't * clash with a valid guest errno now or in the future. */ -#define TARGET_QEMU_ESIGRETURN 513 /* Return from signal */ +#define QEMU_ESIGRETURN 513 /* Return from signal */ #endif diff --git a/linux-user/aarch64/cpu_loop.c b/linux-user/aarch64/cpu_loop.c index 775ba43913..98b53962cd 100644 --- a/linux-user/aarch64/cpu_loop.c +++ b/linux-user/aarch64/cpu_loop.c @@ -101,7 +101,7 @@ void cpu_loop(CPUARMState *env) 0, 0); if (ret == -QEMU_ERESTARTSYS) { env->pc -= 4; - } else if (ret != -TARGET_QEMU_ESIGRETURN) { + } else if (ret != -QEMU_ESIGRETURN) { env->xregs[0] = ret; } break; diff --git a/linux-user/aarch64/signal.c b/linux-user/aarch64/signal.c index 29c52db3f1..df9e39a4ba 100644 --- a/linux-user/aarch64/signal.c +++ b/linux-user/aarch64/signal.c @@ -556,12 +556,12 @@ long do_rt_sigreturn(CPUARMState *env) target_restore_altstack(&frame->uc.tuc_stack, env); unlock_user_struct(frame, frame_addr, 0); - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; badframe: unlock_user_struct(frame, frame_addr, 0); force_sig(TARGET_SIGSEGV); - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; } long do_sigreturn(CPUARMState *env) diff --git a/linux-user/alpha/cpu_loop.c b/linux-user/alpha/cpu_loop.c index ce9b251ce3..37c33f0ccd 100644 --- a/linux-user/alpha/cpu_loop.c +++ b/linux-user/alpha/cpu_loop.c @@ -102,7 +102,7 @@ void cpu_loop(CPUAlphaState *env) env->pc -= 4; break; } - if (sysret == -TARGET_QEMU_ESIGRETURN) { + if (sysret == -QEMU_ESIGRETURN) { break; } /* Syscall writes 0 to V0 to bypass error check, similar diff --git a/linux-user/alpha/signal.c b/linux-user/alpha/signal.c index bbe3dd175a..4ec42994d4 100644 --- a/linux-user/alpha/signal.c +++ b/linux-user/alpha/signal.c @@ -225,11 +225,11 @@ long do_sigreturn(CPUAlphaState *env) restore_sigcontext(env, sc); unlock_user_struct(sc, sc_addr, 0); - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; badframe: force_sig(TARGET_SIGSEGV); - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; } long do_rt_sigreturn(CPUAlphaState *env) @@ -249,13 +249,13 @@ long do_rt_sigreturn(CPUAlphaState *env) target_restore_altstack(&frame->uc.tuc_stack, env); unlock_user_struct(frame, frame_addr, 0); - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; badframe: unlock_user_struct(frame, frame_addr, 0); force_sig(TARGET_SIGSEGV); - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; } void setup_sigtramp(abi_ulong sigtramp_page) diff --git a/linux-user/arm/cpu_loop.c b/linux-user/arm/cpu_loop.c index 1fcf19750e..f153ab503a 100644 --- a/linux-user/arm/cpu_loop.c +++ b/linux-user/arm/cpu_loop.c @@ -409,7 +409,7 @@ void cpu_loop(CPUARMState *env) 0, 0); if (ret == -QEMU_ERESTARTSYS) { env->regs[15] -= env->thumb ? 2 : 4; - } else if (ret != -TARGET_QEMU_ESIGRETURN) { + } else if (ret != -QEMU_ESIGRETURN) { env->regs[0] = ret; } } diff --git a/linux-user/arm/signal.c b/linux-user/arm/signal.c index df9f8e8eb2..cf99fd7b8a 100644 --- a/linux-user/arm/signal.c +++ b/linux-user/arm/signal.c @@ -511,12 +511,12 @@ long do_sigreturn(CPUARMState *env) } unlock_user_struct(frame, frame_addr, 0); - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; badframe: unlock_user_struct(frame, frame_addr, 0); force_sig(TARGET_SIGSEGV); - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; } long do_rt_sigreturn(CPUARMState *env) @@ -546,12 +546,12 @@ long do_rt_sigreturn(CPUARMState *env) } unlock_user_struct(frame, frame_addr, 0); - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; badframe: unlock_user_struct(frame, frame_addr, 0); force_sig(TARGET_SIGSEGV); - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; } /* diff --git a/linux-user/cris/cpu_loop.c b/linux-user/cris/cpu_loop.c index f3e5b13f89..5213aebf55 100644 --- a/linux-user/cris/cpu_loop.c +++ b/linux-user/cris/cpu_loop.c @@ -52,7 +52,7 @@ void cpu_loop(CPUCRISState *env) 0, 0); if (ret == -QEMU_ERESTARTSYS) { env->pc -= 2; - } else if (ret != -TARGET_QEMU_ESIGRETURN) { + } else if (ret != -QEMU_ESIGRETURN) { env->regs[10] = ret; } break; diff --git a/linux-user/cris/signal.c b/linux-user/cris/signal.c index 7f6aca934e..4f532b2903 100644 --- a/linux-user/cris/signal.c +++ b/linux-user/cris/signal.c @@ -177,10 +177,10 @@ long do_sigreturn(CPUCRISState *env) restore_sigcontext(&frame->sc, env); unlock_user_struct(frame, frame_addr, 0); - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; badframe: force_sig(TARGET_SIGSEGV); - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; } long do_rt_sigreturn(CPUCRISState *env) diff --git a/linux-user/hexagon/cpu_loop.c b/linux-user/hexagon/cpu_loop.c index 1cacbf42f1..b84e25bf71 100644 --- a/linux-user/hexagon/cpu_loop.c +++ b/linux-user/hexagon/cpu_loop.c @@ -56,7 +56,7 @@ void cpu_loop(CPUHexagonState *env) 0, 0); if (ret == -QEMU_ERESTARTSYS) { env->gpr[HEX_REG_PC] -= 4; - } else if (ret != -TARGET_QEMU_ESIGRETURN) { + } else if (ret != -QEMU_ESIGRETURN) { env->gpr[0] = ret; } break; diff --git a/linux-user/hexagon/signal.c b/linux-user/hexagon/signal.c index 74e61739a0..ad4e3822d5 100644 --- a/linux-user/hexagon/signal.c +++ b/linux-user/hexagon/signal.c @@ -268,7 +268,7 @@ long do_rt_sigreturn(CPUHexagonState *env) target_restore_altstack(&frame->uc.uc_stack, env); unlock_user_struct(frame, frame_addr, 0); - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; badframe: unlock_user_struct(frame, frame_addr, 0); diff --git a/linux-user/hppa/cpu_loop.c b/linux-user/hppa/cpu_loop.c index 5315224d12..a47a63176b 100644 --- a/linux-user/hppa/cpu_loop.c +++ b/linux-user/hppa/cpu_loop.c @@ -134,7 +134,7 @@ void cpu_loop(CPUHPPAState *env) env->iaoq_b = env->gr[31] + 4; break; case -QEMU_ERESTARTSYS: - case -TARGET_QEMU_ESIGRETURN: + case -QEMU_ESIGRETURN: break; } break; diff --git a/linux-user/hppa/signal.c b/linux-user/hppa/signal.c index c2fbc26ebb..962f551c04 100644 --- a/linux-user/hppa/signal.c +++ b/linux-user/hppa/signal.c @@ -191,9 +191,9 @@ long do_rt_sigreturn(CPUArchState *env) target_restore_altstack(&frame->uc.tuc_stack, env); unlock_user_struct(frame, frame_addr, 0); - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; badframe: force_sig(TARGET_SIGSEGV); - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; } diff --git a/linux-user/i386/cpu_loop.c b/linux-user/i386/cpu_loop.c index fbd9a353e5..9aaae93e2f 100644 --- a/linux-user/i386/cpu_loop.c +++ b/linux-user/i386/cpu_loop.c @@ -181,7 +181,7 @@ static void emulate_vsyscall(CPUX86State *env) env->regs[R_EDX], env->regs[10], env->regs[8], env->regs[9], 0, 0); g_assert(ret != -QEMU_ERESTARTSYS); - g_assert(ret != -TARGET_QEMU_ESIGRETURN); + g_assert(ret != -QEMU_ESIGRETURN); if (ret == -TARGET_EFAULT) { goto sigsegv; } @@ -225,7 +225,7 @@ void cpu_loop(CPUX86State *env) 0, 0); if (ret == -QEMU_ERESTARTSYS) { env->eip -= 2; - } else if (ret != -TARGET_QEMU_ESIGRETURN) { + } else if (ret != -QEMU_ESIGRETURN) { env->regs[R_EAX] = ret; } break; @@ -243,7 +243,7 @@ void cpu_loop(CPUX86State *env) 0, 0); if (ret == -QEMU_ERESTARTSYS) { env->eip -= 2; - } else if (ret != -TARGET_QEMU_ESIGRETURN) { + } else if (ret != -QEMU_ESIGRETURN) { env->regs[R_EAX] = ret; } break; diff --git a/linux-user/i386/signal.c b/linux-user/i386/signal.c index 433efa3d69..4372621a4d 100644 --- a/linux-user/i386/signal.c +++ b/linux-user/i386/signal.c @@ -559,12 +559,12 @@ long do_sigreturn(CPUX86State *env) if (restore_sigcontext(env, &frame->sc)) goto badframe; unlock_user_struct(frame, frame_addr, 0); - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; badframe: unlock_user_struct(frame, frame_addr, 0); force_sig(TARGET_SIGSEGV); - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; } #endif @@ -588,12 +588,12 @@ long do_rt_sigreturn(CPUX86State *env) target_restore_altstack(&frame->uc.tuc_stack, env); unlock_user_struct(frame, frame_addr, 0); - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; badframe: unlock_user_struct(frame, frame_addr, 0); force_sig(TARGET_SIGSEGV); - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; } #ifndef TARGET_X86_64 diff --git a/linux-user/m68k/cpu_loop.c b/linux-user/m68k/cpu_loop.c index b03c21a3dc..3181594414 100644 --- a/linux-user/m68k/cpu_loop.c +++ b/linux-user/m68k/cpu_loop.c @@ -82,7 +82,7 @@ void cpu_loop(CPUM68KState *env) 0, 0); if (ret == -QEMU_ERESTARTSYS) { env->pc -= 2; - } else if (ret != -TARGET_QEMU_ESIGRETURN) { + } else if (ret != -QEMU_ESIGRETURN) { env->dregs[0] = ret; } } diff --git a/linux-user/m68k/signal.c b/linux-user/m68k/signal.c index ec33482e14..5f35354487 100644 --- a/linux-user/m68k/signal.c +++ b/linux-user/m68k/signal.c @@ -353,11 +353,11 @@ long do_sigreturn(CPUM68KState *env) restore_sigcontext(env, &frame->sc); unlock_user_struct(frame, frame_addr, 0); - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; badframe: force_sig(TARGET_SIGSEGV); - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; } long do_rt_sigreturn(CPUM68KState *env) @@ -381,12 +381,12 @@ long do_rt_sigreturn(CPUM68KState *env) target_restore_altstack(&frame->uc.tuc_stack, env); unlock_user_struct(frame, frame_addr, 0); - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; badframe: unlock_user_struct(frame, frame_addr, 0); force_sig(TARGET_SIGSEGV); - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; } void setup_sigtramp(abi_ulong sigtramp_page) diff --git a/linux-user/microblaze/cpu_loop.c b/linux-user/microblaze/cpu_loop.c index 6e368f986e..ff1fb26c8b 100644 --- a/linux-user/microblaze/cpu_loop.c +++ b/linux-user/microblaze/cpu_loop.c @@ -56,7 +56,7 @@ void cpu_loop(CPUMBState *env) if (ret == -QEMU_ERESTARTSYS) { /* Wind back to before the syscall. */ env->pc -= 4; - } else if (ret != -TARGET_QEMU_ESIGRETURN) { + } else if (ret != -QEMU_ESIGRETURN) { env->regs[3] = ret; } /* All syscall exits result in guest r14 being equal to the diff --git a/linux-user/microblaze/signal.c b/linux-user/microblaze/signal.c index 8ebb6a1b7d..5188d74025 100644 --- a/linux-user/microblaze/signal.c +++ b/linux-user/microblaze/signal.c @@ -207,12 +207,12 @@ long do_rt_sigreturn(CPUMBState *env) target_restore_altstack(&frame->uc.tuc_stack, env); unlock_user_struct(frame, frame_addr, 0); - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; badframe: unlock_user_struct(frame, frame_addr, 0); force_sig(TARGET_SIGSEGV); - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; } void setup_sigtramp(abi_ulong sigtramp_page) diff --git a/linux-user/mips/cpu_loop.c b/linux-user/mips/cpu_loop.c index 64f308c6ad..32f9fc1c1c 100644 --- a/linux-user/mips/cpu_loop.c +++ b/linux-user/mips/cpu_loop.c @@ -145,7 +145,7 @@ done_syscall: env->active_tc.PC -= 4; break; } - if (ret == -TARGET_QEMU_ESIGRETURN) { + if (ret == -QEMU_ESIGRETURN) { /* Returning from a successful sigreturn syscall. Avoid clobbering register state. */ break; diff --git a/linux-user/mips/signal.c b/linux-user/mips/signal.c index 8f79e405ec..58a9d7a8a3 100644 --- a/linux-user/mips/signal.c +++ b/linux-user/mips/signal.c @@ -281,11 +281,11 @@ long do_sigreturn(CPUMIPSState *regs) /* I am not sure this is right, but it seems to work * maybe a problem with nested signals ? */ regs->CP0_EPC = 0; - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; badframe: force_sig(TARGET_SIGSEGV); - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; } # endif /* O32 */ @@ -371,11 +371,11 @@ long do_rt_sigreturn(CPUMIPSState *env) /* I am not sure this is right, but it seems to work * maybe a problem with nested signals ? */ env->CP0_EPC = 0; - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; badframe: force_sig(TARGET_SIGSEGV); - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; } void setup_sigtramp(abi_ulong sigtramp_page) diff --git a/linux-user/openrisc/cpu_loop.c b/linux-user/openrisc/cpu_loop.c index 3147ab2b62..592901a68b 100644 --- a/linux-user/openrisc/cpu_loop.c +++ b/linux-user/openrisc/cpu_loop.c @@ -50,7 +50,7 @@ void cpu_loop(CPUOpenRISCState *env) cpu_get_gpr(env, 8), 0, 0); if (ret == -QEMU_ERESTARTSYS) { env->pc -= 4; - } else if (ret != -TARGET_QEMU_ESIGRETURN) { + } else if (ret != -QEMU_ESIGRETURN) { cpu_set_gpr(env, 11, ret); } break; diff --git a/linux-user/ppc/cpu_loop.c b/linux-user/ppc/cpu_loop.c index 5348641e9e..30c82f2354 100644 --- a/linux-user/ppc/cpu_loop.c +++ b/linux-user/ppc/cpu_loop.c @@ -432,7 +432,7 @@ void cpu_loop(CPUPPCState *env) env->nip -= 4; break; } - if (ret == (target_ulong)(-TARGET_QEMU_ESIGRETURN)) { + if (ret == (target_ulong)(-QEMU_ESIGRETURN)) { /* Returning from a successful sigreturn syscall. Avoid corrupting register state. */ break; diff --git a/linux-user/ppc/signal.c b/linux-user/ppc/signal.c index 90a0369632..176c9d8503 100644 --- a/linux-user/ppc/signal.c +++ b/linux-user/ppc/signal.c @@ -591,13 +591,13 @@ long do_sigreturn(CPUPPCState *env) unlock_user_struct(sr, sr_addr, 1); unlock_user_struct(sc, sc_addr, 1); - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; sigsegv: unlock_user_struct(sr, sr_addr, 1); unlock_user_struct(sc, sc_addr, 1); force_sig(TARGET_SIGSEGV); - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; } #endif /* !defined(TARGET_PPC64) */ @@ -646,12 +646,12 @@ long do_rt_sigreturn(CPUPPCState *env) target_restore_altstack(&rt_sf->uc.tuc_stack, env); unlock_user_struct(rt_sf, rt_sf_addr, 1); - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; sigsegv: unlock_user_struct(rt_sf, rt_sf_addr, 1); force_sig(TARGET_SIGSEGV); - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; } /* This syscall implements {get,set,swap}context for userland. */ @@ -704,7 +704,7 @@ abi_long do_swapcontext(CPUArchState *env, abi_ulong uold_ctx, /* We cannot return to a partially updated context. */ force_sig(TARGET_SIGSEGV); } - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; } return 0; diff --git a/linux-user/riscv/cpu_loop.c b/linux-user/riscv/cpu_loop.c index 20f8c48b1d..0cd8985cb8 100644 --- a/linux-user/riscv/cpu_loop.c +++ b/linux-user/riscv/cpu_loop.c @@ -71,7 +71,7 @@ void cpu_loop(CPURISCVState *env) } if (ret == -QEMU_ERESTARTSYS) { env->pc -= 4; - } else if (ret != -TARGET_QEMU_ESIGRETURN) { + } else if (ret != -QEMU_ESIGRETURN) { env->gpr[xA0] = ret; } if (cs->singlestep_enabled) { diff --git a/linux-user/riscv/signal.c b/linux-user/riscv/signal.c index a0f9542ce3..296e39fbf0 100644 --- a/linux-user/riscv/signal.c +++ b/linux-user/riscv/signal.c @@ -188,7 +188,7 @@ long do_rt_sigreturn(CPURISCVState *env) target_restore_altstack(&frame->uc.uc_stack, env); unlock_user_struct(frame, frame_addr, 0); - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; badframe: unlock_user_struct(frame, frame_addr, 0); diff --git a/linux-user/s390x/cpu_loop.c b/linux-user/s390x/cpu_loop.c index 043582ca7c..ad0c3cd263 100644 --- a/linux-user/s390x/cpu_loop.c +++ b/linux-user/s390x/cpu_loop.c @@ -85,7 +85,7 @@ void cpu_loop(CPUS390XState *env) env->regs[6], env->regs[7], 0, 0); if (ret == -QEMU_ERESTARTSYS) { env->psw.addr -= env->int_svc_ilen; - } else if (ret != -TARGET_QEMU_ESIGRETURN) { + } else if (ret != -QEMU_ESIGRETURN) { env->regs[2] = ret; } break; diff --git a/linux-user/s390x/signal.c b/linux-user/s390x/signal.c index 676b948147..f47713e04a 100644 --- a/linux-user/s390x/signal.c +++ b/linux-user/s390x/signal.c @@ -359,7 +359,7 @@ long do_sigreturn(CPUS390XState *env) trace_user_do_sigreturn(env, frame_addr); if (!lock_user_struct(VERIFY_READ, frame, frame_addr, 1)) { force_sig(TARGET_SIGSEGV); - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; } /* Make sure that we're initializing all of target_set. */ @@ -373,7 +373,7 @@ long do_sigreturn(CPUS390XState *env) restore_sigregs_ext(env, &frame->sregs_ext); unlock_user_struct(frame, frame_addr, 0); - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; } long do_rt_sigreturn(CPUS390XState *env) @@ -385,7 +385,7 @@ long do_rt_sigreturn(CPUS390XState *env) trace_user_do_rt_sigreturn(env, frame_addr); if (!lock_user_struct(VERIFY_READ, frame, frame_addr, 1)) { force_sig(TARGET_SIGSEGV); - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; } target_to_host_sigset(&set, &frame->uc.tuc_sigmask); @@ -397,7 +397,7 @@ long do_rt_sigreturn(CPUS390XState *env) target_restore_altstack(&frame->uc.tuc_stack, env); unlock_user_struct(frame, frame_addr, 0); - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; } void setup_sigtramp(abi_ulong sigtramp_page) diff --git a/linux-user/sh4/cpu_loop.c b/linux-user/sh4/cpu_loop.c index 6c4ebfa969..3290f6445c 100644 --- a/linux-user/sh4/cpu_loop.c +++ b/linux-user/sh4/cpu_loop.c @@ -52,7 +52,7 @@ void cpu_loop(CPUSH4State *env) 0, 0); if (ret == -QEMU_ERESTARTSYS) { env->pc -= 2; - } else if (ret != -TARGET_QEMU_ESIGRETURN) { + } else if (ret != -QEMU_ESIGRETURN) { env->gregs[0] = ret; } break; diff --git a/linux-user/sh4/signal.c b/linux-user/sh4/signal.c index faa869fb19..f6a18bc6b5 100644 --- a/linux-user/sh4/signal.c +++ b/linux-user/sh4/signal.c @@ -286,12 +286,12 @@ long do_sigreturn(CPUSH4State *regs) restore_sigcontext(regs, &frame->sc); unlock_user_struct(frame, frame_addr, 0); - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; badframe: unlock_user_struct(frame, frame_addr, 0); force_sig(TARGET_SIGSEGV); - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; } long do_rt_sigreturn(CPUSH4State *regs) @@ -313,12 +313,12 @@ long do_rt_sigreturn(CPUSH4State *regs) target_restore_altstack(&frame->uc.tuc_stack, regs); unlock_user_struct(frame, frame_addr, 0); - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; badframe: unlock_user_struct(frame, frame_addr, 0); force_sig(TARGET_SIGSEGV); - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; } void setup_sigtramp(abi_ulong sigtramp_page) diff --git a/linux-user/sparc/cpu_loop.c b/linux-user/sparc/cpu_loop.c index 529337c5e0..8765ab6020 100644 --- a/linux-user/sparc/cpu_loop.c +++ b/linux-user/sparc/cpu_loop.c @@ -181,7 +181,7 @@ void cpu_loop (CPUSPARCState *env) env->regwptr[2], env->regwptr[3], env->regwptr[4], env->regwptr[5], 0, 0); - if (ret == -QEMU_ERESTARTSYS || ret == -TARGET_QEMU_ESIGRETURN) { + if (ret == -QEMU_ERESTARTSYS || ret == -QEMU_ESIGRETURN) { break; } if ((abi_ulong)ret >= (abi_ulong)(-515)) { diff --git a/linux-user/sparc/signal.c b/linux-user/sparc/signal.c index 23e1e761de..b501750fe0 100644 --- a/linux-user/sparc/signal.c +++ b/linux-user/sparc/signal.c @@ -431,12 +431,12 @@ long do_sigreturn(CPUSPARCState *env) set_sigmask(&host_set); unlock_user_struct(sf, sf_addr, 0); - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; segv_and_exit: unlock_user_struct(sf, sf_addr, 0); force_sig(TARGET_SIGSEGV); - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; #else return -TARGET_ENOSYS; #endif @@ -495,12 +495,12 @@ long do_rt_sigreturn(CPUSPARCState *env) env->npc = tnpc; unlock_user_struct(sf, sf_addr, 0); - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; segv_and_exit: unlock_user_struct(sf, sf_addr, 0); force_sig(TARGET_SIGSEGV); - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; } #if defined(TARGET_SPARC64) && !defined(TARGET_ABI32) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 23fb45e0f1..2867be4cd3 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -550,7 +550,7 @@ const char *target_strerror(int err) if (err == QEMU_ERESTARTSYS) { return "To be restarted"; } - if (err == TARGET_QEMU_ESIGRETURN) { + if (err == QEMU_ESIGRETURN) { return "Successful exit from sigreturn"; } diff --git a/linux-user/xtensa/cpu_loop.c b/linux-user/xtensa/cpu_loop.c index 29cc6f3830..6bc6d6dee6 100644 --- a/linux-user/xtensa/cpu_loop.c +++ b/linux-user/xtensa/cpu_loop.c @@ -188,7 +188,7 @@ void cpu_loop(CPUXtensaState *env) env->pc -= 3; break; - case -TARGET_QEMU_ESIGRETURN: + case -QEMU_ESIGRETURN: break; } break; diff --git a/linux-user/xtensa/signal.c b/linux-user/xtensa/signal.c index 81572a5fc7..06d91a37ec 100644 --- a/linux-user/xtensa/signal.c +++ b/linux-user/xtensa/signal.c @@ -263,12 +263,12 @@ long do_rt_sigreturn(CPUXtensaState *env) target_restore_altstack(&frame->uc.tuc_stack, env); unlock_user_struct(frame, frame_addr, 0); - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; badframe: unlock_user_struct(frame, frame_addr, 0); force_sig(TARGET_SIGSEGV); - return -TARGET_QEMU_ESIGRETURN; + return -QEMU_ESIGRETURN; } void setup_sigtramp(abi_ulong sigtramp_page) From patchwork Tue Nov 23 17:37:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 519332 Delivered-To: patch@linaro.org Received: by 2002:ac0:c605:0:0:0:0:0 with SMTP id p5csp8983563imj; Tue, 23 Nov 2021 09:46:05 -0800 (PST) X-Google-Smtp-Source: ABdhPJzoqdPMDEj5TbpfaLSH7IWyz7s6ggnOHsVK1eVsvOfu015V4H6KYbIAcVDMnlDEldUa48H/ X-Received: by 2002:a05:6122:514:: with SMTP id x20mr7126846vko.23.1637689565149; Tue, 23 Nov 2021 09:46:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1637689565; cv=none; d=google.com; s=arc-20160816; b=CPZcm81ur9GbpbTiLhP4tFu0AFfMZK2SPpxcvcJH4RTDWO7PCSp5wY8rwXGzxPKZyO yWmuknRNUX/LSN3ejAxwylU7uPhapmQrmqaU1Ck9VgFWoQDFmD9duHjSGX+BysPlP2JV JiXzDfJxK5Rlm1WlYPoc3aj0khIdFPSaIweB3RwQq30m4i6wNVykzBSO1UCiQsZbGNEo +dRL2nw4iLTix8/n11LhDNHEL8XGWrbII7aB/nBtQ4/MWGCi7YPnVKTWqeWi7ruTxV6D kRcdZ7gWUHCoZv11jFP9lX3oKRDdCqKPN1HXGdFDbp49eaaxFHtusnonzSovr+R1Ma4H g4zg== 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=TT19p4RIHqcMgyPqlvdP5DEN83TNSNvFv1GopYPkozA=; b=RI9xwDH3pDDnbzcv3UAzDk5ZvyX2JwqGZJXCksFN6TDcwJm1GVYvbnW0So9DD+TNVZ rKD7zRl8IlYD7h6fVnj89umbxjcCEpmlZMEPf7quUprdm7N1EMx1NOMKlspmGEMIyJmu eNplvCahFjqxdzjRXa6+23MOKrcjMFAHTOdLAlHAtC5FvZ2gtlwfexVu9XE5VOZ4urq/ FocuBM7L9kL3jwC5DBYFqeiaD/FjQScdmfkgt02aDrgWVdzByShkgQEwN0pqQz6G1hto CURvFwleCZ75wKLH3lj1x/8QSpUAhjRy0LejlGin8XHpub5XNZakydAewiwKhA6tHJYV X8fg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=zD2yUK92; 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 n15si3126812vkp.101.2021.11.23.09.46.04 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 23 Nov 2021 09:46:05 -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=fail header.i=@linaro.org header.s=google header.b=zD2yUK92; 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]:54404 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mpZro-0004EK-9n for patch@linaro.org; Tue, 23 Nov 2021 12:46:04 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52346) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mpZkM-0004Qp-Mo for qemu-devel@nongnu.org; Tue, 23 Nov 2021 12:38:22 -0500 Received: from [2a00:1450:4864:20::435] (port=46903 helo=mail-wr1-x435.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mpZkJ-000516-N5 for qemu-devel@nongnu.org; Tue, 23 Nov 2021 12:38:22 -0500 Received: by mail-wr1-x435.google.com with SMTP id u1so40264036wru.13 for ; Tue, 23 Nov 2021 09:38:19 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=TT19p4RIHqcMgyPqlvdP5DEN83TNSNvFv1GopYPkozA=; b=zD2yUK92vVaTicIMwxuZuNB5w8tMM8VXmOZTyhacHrXGwQA7Feo4oD61PVOKgW2jZg xwonXyVfVImFsgCFK0HBoImbOHgeEz+R6Y+tbQtl9615AKMan1RPDVLHqtR0ok2mW+gJ AoN3GoRwofHXjFOgWcZfTWSje+COO2hs767GPjMDArwC3Za8n779Mecui/IDPtddDK/u RtUR8bdO85sCc8XUGxke/BhOI7QwjNukIssZNm7I5vHBXnZdKdNIG8jAiF1quEy7m/hu 5z4GuKkThT6WsFEdN7otY1+ZCqD+1J6khab1y+H2qNWFv/ItOsF1v85g7jbQHFpWbJO4 l5Cg== 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=TT19p4RIHqcMgyPqlvdP5DEN83TNSNvFv1GopYPkozA=; b=CCmCHel7cjSq0Kv/ui2sa69UzH7w2egsNWe57P0Oly3z3jhQVX4VrVk/oDq/2zKYic nWA8iqtrVgPzuJsAdA0u1dYqPKIGlLVzSBTl7HnYmUO9X8ow/zcJimK4uiNJwvevzEGq 537eNFvbn33FtgIJxlS+QW8LZ3EZm6hcS7EmVmusYYMYwYC3CQx/K9yKmUgBQBOBynf7 fbvWp45EOhuPePxVRGhLt48VwHL09Lr2I0Z0lHdtxTTCMPjKMoCLkuYO8hn67y0gy9OD Ip5XBsQu3pR9eVCHnpyD3/m+0WGuk729rgFOzs6m31YGIrKrCfjVNN5O/byE1VEiEwKD sZbA== X-Gm-Message-State: AOAM530F7Rl8jOFYX6w2XZ0w/WMu36EpyJUsrVXSojd8FXQ0GyYMsSM3 +0xv3Zgeobt30pkMgIv+X/iBHlHSsiKI6MgAM7U= X-Received: by 2002:a05:6000:188c:: with SMTP id a12mr9574529wri.92.1637689098104; Tue, 23 Nov 2021 09:38:18 -0800 (PST) Received: from cloudburst.home (149.164.14.37.dynamic.jazztel.es. [37.14.164.149]) by smtp.gmail.com with ESMTPSA id n13sm13054883wrt.44.2021.11.23.09.38.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Nov 2021 09:38:17 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v6 10/16] linux-user: Create special-errno.h Date: Tue, 23 Nov 2021 18:37:53 +0100 Message-Id: <20211123173759.1383510-11-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211123173759.1383510-1-richard.henderson@linaro.org> References: <20211123173759.1383510-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::435 (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::435; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x435.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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, PDS_HP_HELO_NORDNS=0.001, 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.eu, imp@bsdimp.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Pull the two internal errno used by qemu internally into their own header file. This includes the one define required by safe-syscall.S. Reviewed-by: Warner Losh Signed-off-by: Richard Henderson --- linux-user/cpu_loop-common.h | 1 + linux-user/generic/target_errno_defs.h | 17 -------------- linux-user/signal-common.h | 2 ++ linux-user/special-errno.h | 32 ++++++++++++++++++++++++++ linux-user/syscall.c | 1 + linux-user/safe-syscall.S | 2 +- 6 files changed, 37 insertions(+), 18 deletions(-) create mode 100644 linux-user/special-errno.h diff --git a/linux-user/cpu_loop-common.h b/linux-user/cpu_loop-common.h index 8828af28a4..dc0042e4de 100644 --- a/linux-user/cpu_loop-common.h +++ b/linux-user/cpu_loop-common.h @@ -21,6 +21,7 @@ #define CPU_LOOP_COMMON_H #include "exec/log.h" +#include "special-errno.h" #define EXCP_DUMP(env, fmt, ...) \ do { \ diff --git a/linux-user/generic/target_errno_defs.h b/linux-user/generic/target_errno_defs.h index bb37d88be9..c2f9d403e7 100644 --- a/linux-user/generic/target_errno_defs.h +++ b/linux-user/generic/target_errno_defs.h @@ -147,21 +147,4 @@ #define TARGET_ERFKILL 132 /* Operation not possible due to RF-kill */ #define TARGET_EHWPOISON 133 /* Memory page has hardware error */ -/* QEMU internal, not visible to the guest. This is returned when a - * system call should be restarted, to tell the main loop that it - * should wind the guest PC backwards so it will re-execute the syscall - * after handling any pending signals. They match with the ones the guest - * kernel uses for the same purpose. - */ -#define QEMU_ERESTARTSYS 512 /* Restart system call (if SA_RESTART) */ - -/* QEMU internal, not visible to the guest. This is returned by the - * do_sigreturn() code after a successful sigreturn syscall, to indicate - * that it has correctly set the guest registers and so the main loop - * should not touch them. We use the value the guest would use for - * ERESTART_NOINTR (which is kernel internal) to guarantee that we won't - * clash with a valid guest errno now or in the future. - */ -#define QEMU_ESIGRETURN 513 /* Return from signal */ - #endif diff --git a/linux-user/signal-common.h b/linux-user/signal-common.h index b9f33bb44f..42aa479080 100644 --- a/linux-user/signal-common.h +++ b/linux-user/signal-common.h @@ -20,6 +20,8 @@ #ifndef SIGNAL_COMMON_H #define SIGNAL_COMMON_H +#include "special-errno.h" + /* Fallback addresses into sigtramp page. */ extern abi_ulong default_sigreturn; extern abi_ulong default_rt_sigreturn; diff --git a/linux-user/special-errno.h b/linux-user/special-errno.h new file mode 100644 index 0000000000..4120455baa --- /dev/null +++ b/linux-user/special-errno.h @@ -0,0 +1,32 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * QEMU internal errno values for implementing user-only POSIX. + * + * Copyright (c) 2003 Fabrice Bellard + * Copyright (c) 2021 Linaro, Ltd. + */ + +#ifndef SPECIAL_ERRNO_H +#define SPECIAL_ERRNO_H + +/* + * All of these are QEMU internal, not visible to the guest. + * They should be chosen so as to not overlap with any host + * or guest errno. + */ + +/* + * This is returned when a system call should be restarted, to tell the + * main loop that it should wind the guest PC backwards so it will + * re-execute the syscall after handling any pending signals. + */ +#define QEMU_ERESTARTSYS 512 + +/* + * This is returned after a successful sigreturn syscall, to indicate + * that it has correctly set the guest registers and so the main loop + * should not touch them. + */ +#define QEMU_ESIGRETURN 513 + +#endif /* SPECIAL_ERRNO_H */ diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 2867be4cd3..f5bf6d155c 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -136,6 +136,7 @@ #include "qemu/guest-random.h" #include "qemu/selfmap.h" #include "user/syscall-trace.h" +#include "special-errno.h" #include "qapi/error.h" #include "fd-trans.h" #include "tcg/tcg.h" diff --git a/linux-user/safe-syscall.S b/linux-user/safe-syscall.S index 7ddc997801..74f7e35694 100644 --- a/linux-user/safe-syscall.S +++ b/linux-user/safe-syscall.S @@ -10,7 +10,7 @@ * See the COPYING file in the top-level directory. */ -#include "target_errno_defs.h" +#include "special-errno.h" /* We have the correct host directory on our include path * so that this will pull in the right fragment for the architecture. From patchwork Tue Nov 23 17:37:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 519326 Delivered-To: patch@linaro.org Received: by 2002:ac0:c605:0:0:0:0:0 with SMTP id p5csp8978470imj; Tue, 23 Nov 2021 09:42:16 -0800 (PST) X-Google-Smtp-Source: ABdhPJzyxZVdPcEEvW+wpW+3xqDb23dMUkpIaxA1Wxqq5fPgkv8mxO2dD85ZCT8mE45Cz4rmVmkp X-Received: by 2002:a05:6102:c8a:: with SMTP id f10mr11826495vst.22.1637689336845; Tue, 23 Nov 2021 09:42:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1637689336; cv=none; d=google.com; s=arc-20160816; b=buRDDS0k/lQElHa2xEG2orj3gBw/sWt29kB/G0dMCaVrxzqQOU36ojVVzF2JaihY59 YhzH2XcLDcTbClFUZe4jOt2oj9lOF5gEgWsuZqiHQ4yoSuySLMWW5E/iXIfe+6+nFdiY VvPjpsE6vzgrni5k0n6LT8EyGAWLWko3x5OtR3UK4fVqWcFzGcVBLKqlOzmcHU4XDEML tvYKIvBQelGy57e0v19tS+scMhSeIiWGGHPI0v4QFRe3lRbfT9GT0GO9F9bHWboxOjIZ Tbz7wXXN/JkFqfm2PndncR7FmYn6zQqNDXi0B/HL4k52eDJQfAMUIFz3Q4n2BTJgstc0 EZiQ== 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=HHuNKnhfo/1w0XhuBwX3/PDJWu35E1qSroF+d/Nu4gg=; b=nW/RjD5bFvPlKMJasiT8Pr/Z2/lP3A9S7na+9HD4LgtelmAX45fBUwty5kKcjPW06E tlH6HpF1ft++sGV13tFSG/4tEsBf5ZHRo7/7CFaphlMcUOuKeIzF1tRBJpc60+KCBIRK A4G0sacWpPaTXvanAVyRMbiadZZ7dF+NM6fk0ck+ALc5G2AXdNuXtjwHGZEV4u2xX6sJ 0386eS69S7tx0v2/iBmGXwWcpq7gaMAXWKOpdZD8YBSDimJVILVgMRSYankTGlfQQbhs K64M1Z78Pb+mk9LLSv+r5v9t2FsXyaFihyaVd5VtyTUjKym29poeVzmzscWnH79zSBqt xg2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=FimBvJdc; 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 s12si5780441uar.70.2021.11.23.09.42.16 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 23 Nov 2021 09:42:16 -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=fail header.i=@linaro.org header.s=google header.b=FimBvJdc; 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]:40684 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mpZo5-0003ar-Hq for patch@linaro.org; Tue, 23 Nov 2021 12:42:13 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52354) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mpZkN-0004Sl-0S for qemu-devel@nongnu.org; Tue, 23 Nov 2021 12:38:23 -0500 Received: from [2a00:1450:4864:20::32a] (port=42933 helo=mail-wm1-x32a.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mpZkL-00051A-Ge for qemu-devel@nongnu.org; Tue, 23 Nov 2021 12:38:22 -0500 Received: by mail-wm1-x32a.google.com with SMTP id d72-20020a1c1d4b000000b00331140f3dc8so3257536wmd.1 for ; Tue, 23 Nov 2021 09:38:20 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=HHuNKnhfo/1w0XhuBwX3/PDJWu35E1qSroF+d/Nu4gg=; b=FimBvJdcIMhGd7b1EaVa1vdJBrLU5iBS3jvMX3zJQq3+jut1z1Yv10PTbHieu5pwGM xJ5HaBQKwUTbO2S1v2ULqcnoRtbvGbeZqQcSDF4rppQMbu1aTxAMyq/P3WhkjoRXsijn iEY8B2KSaJ7b7Wb0J3MJzeIkY6TyXVrckDDGhXw2crKC3mjcqfH5B2gro9dxaZBWQ3Nv C5nOKWpBeT101OqJoY3ythmtxIWEBagcs+6QCsURjxw7mdOsW27gh7I8sIOYP/48IcYe 31lxWInrxZWLuve5eYgeXzvB7Hs0CIieQAQPt5ruqKNJI/zFbwLBk8ZbFb0ss785oaVn X7HA== 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=HHuNKnhfo/1w0XhuBwX3/PDJWu35E1qSroF+d/Nu4gg=; b=Hqr8o8T8xIgKDHjXkYKLoEqm8FjiRlbwHYuIh27UiO3ylbcUctDy54mWvdDBKhgRy6 BZEnqceJDEAuxSAkiX6HLPjqifrnkvSk6r3ceaUnPfsIKdIOFZB2VXwWQwW2ZGZOeHZI lI+WJSAJ59EWvuB2z84hND9HWsaMlqBYciCGzDR4KI5M+i8wrMw/U6uY48pSFb/cI4oF rpbODrivZuuSQ6CHK7Txstr+gh8Ewn6VPt8RK6xU+TuX0K7tn2wL8AnG6ThXqD1/5/JR k+FTduqo1yoqrHr0g0l0bfODSJSpfkNo/dvZoMcLT1RcK30aSgNOdZi6TriOafpzNho8 F/OA== X-Gm-Message-State: AOAM532MgG3HAIyoKzPrvNg6iRLk6VtP0lyjcxxBYV9rgjOWp8euL4bo NAdEW3gYndVG/VlvtD3Vtic97lxt+Fh3SCXxgJM= X-Received: by 2002:a05:600c:4f0f:: with SMTP id l15mr5305484wmq.25.1637689099538; Tue, 23 Nov 2021 09:38:19 -0800 (PST) Received: from cloudburst.home (149.164.14.37.dynamic.jazztel.es. [37.14.164.149]) by smtp.gmail.com with ESMTPSA id n13sm13054883wrt.44.2021.11.23.09.38.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Nov 2021 09:38:19 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v6 11/16] bsd-user: Create special-errno.h Date: Tue, 23 Nov 2021 18:37:54 +0100 Message-Id: <20211123173759.1383510-12-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211123173759.1383510-1-richard.henderson@linaro.org> References: <20211123173759.1383510-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::32a (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::32a; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x32a.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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, PDS_HP_HELO_NORDNS=0.001, 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.eu, imp@bsdimp.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Pull the internal errno used by qemu internally its own header file, for use by safe-syscall.S. Reviewed-by: Warner Losh Signed-off-by: Richard Henderson --- bsd-user/errno_defs.h | 6 +++++- bsd-user/special-errno.h | 24 ++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 bsd-user/special-errno.h diff --git a/bsd-user/errno_defs.h b/bsd-user/errno_defs.h index 141e08456c..73cfa24b7f 100644 --- a/bsd-user/errno_defs.h +++ b/bsd-user/errno_defs.h @@ -151,6 +151,10 @@ /* Internal errors: */ #define TARGET_EJUSTRETURN 254 /* Just return without modifing regs */ #define TARGET_ERESTART 255 /* Restart syscall */ -#define QEMU_ERESTARTSYS TARGET_ERESTART + +#include "special-errno.h" + +_Static_assert(TARGET_ERESTART == QEMU_ERESTARTSYS, + "TARGET_ERESTART and QEMU_ERESTARTSYS expected to match"); #endif /* ! _ERRNO_DEFS_H_ */ diff --git a/bsd-user/special-errno.h b/bsd-user/special-errno.h new file mode 100644 index 0000000000..03599d9b5a --- /dev/null +++ b/bsd-user/special-errno.h @@ -0,0 +1,24 @@ +/* SPDX-License-Identifier: BSD-3-Clause */ +/* + * QEMU internal errno values for implementing user-only POSIX. + * + * Copyright (c) 2021 Linaro, Ltd. + */ + +#ifndef SPECIAL_ERRNO_H +#define SPECIAL_ERRNO_H + +/* + * All of these are QEMU internal, not visible to the guest. + * They should be chosen so as to not overlap with any host + * or guest errno. + */ + +/* + * This is returned when a system call should be restarted, to tell the + * main loop that it should wind the guest PC backwards so it will + * re-execute the syscall after handling any pending signals. + */ +#define QEMU_ERESTARTSYS 255 + +#endif /* SPECIAL_ERRNO_H */ From patchwork Tue Nov 23 17:37:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 519330 Delivered-To: patch@linaro.org Received: by 2002:ac0:c605:0:0:0:0:0 with SMTP id p5csp8981851imj; Tue, 23 Nov 2021 09:44:48 -0800 (PST) X-Google-Smtp-Source: ABdhPJxktDk3q5Kf0aY7B/ZYGvwnhC8bftz/EMgxB7xPBFn3ha0D2l56x2XH84R+rjdecpZ32zfe X-Received: by 2002:a05:6102:3911:: with SMTP id e17mr12075481vsu.40.1637689488785; Tue, 23 Nov 2021 09:44:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1637689488; cv=none; d=google.com; s=arc-20160816; b=REgqGAf5qVWAAyHwZQdzmVqZ6p5RMEs93eXeFmFIDoQ0q6473n6o81fU0BkFyqOEQA gp66WnH/EdCeFVge7NSaaQ15uMIHQ1vbJ+pX5f7wCqXvHrQKZ+gELUnZQH+3iyZCi2vG S6SFFzpfQRp3+0hr40Wx1vqSqVTpSzh7vA4eljh22jQt3cM3V/vwryvAaitX/sAnXFw/ TIJH48JArNWeWwMNNI2k47BZSMQX7eAHg3tUx8elC1kVtNlS3TWuRbkdYYKUzzR8BUly t3rbkJbm1dQKpCpyXHQ6OCSDJWRjVNJTSD3tTi+2PuhOZ+oeOB+irgsc2UvlXA+6KzUI 8aPQ== 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=Cmtw05llgb/mcCqlw3igL1JShmvNTdbzkXIsqE25pVo=; b=E9oax86RSew+5ySyrJOPvJYABmuxhavlZ5fEQOAH0Y3jfic9QyM9hk+uDa8nNRVSlP XQHU3tUyMamq+sBhOxqR5ezFIeI/uOqalv44vRnkjGKhsg0LEQ8BasYsJO7BueArfjMp DjoUZA9i4QzcvBBiZqrRztSX+m0TNra2dpOZXNQ+EDDVyf0duq5pRTk1W/c8J750CQiw WYITL7dYrfpyK2/p2SlLDu7GG4KIHjZuTMQUZz0ZSYt3uvRcZ/j1AldPAx42FGPXEhex LkhDyU3mnDQeLhqalzVKcPsc8L3pdsj7nKZXWBPX9fDhmr5x1sa/tZILWfojRMlE6qKm D/Tg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=cG1IHwjX; 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 d12si31598005vsb.323.2021.11.23.09.44.48 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 23 Nov 2021 09:44:48 -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=fail header.i=@linaro.org header.s=google header.b=cG1IHwjX; 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]:49168 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mpZqa-0000kU-6M for patch@linaro.org; Tue, 23 Nov 2021 12:44:48 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52392) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mpZkO-0004Zi-VI for qemu-devel@nongnu.org; Tue, 23 Nov 2021 12:38:25 -0500 Received: from [2a00:1450:4864:20::429] (port=39436 helo=mail-wr1-x429.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mpZkM-00051M-OB for qemu-devel@nongnu.org; Tue, 23 Nov 2021 12:38:24 -0500 Received: by mail-wr1-x429.google.com with SMTP id a18so3731421wrn.6 for ; Tue, 23 Nov 2021 09:38:22 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=Cmtw05llgb/mcCqlw3igL1JShmvNTdbzkXIsqE25pVo=; b=cG1IHwjX0JTUX+evIDjTsgnUCFWIpu03G3o7zbiXKpM9otfEE0BuZqgQChKg19kTI9 NxB32konO/q34ccmkLCnjAnWgPzEPumuLXu55HcK1eVkQRxLeM/VflaEz8gkHwzyipF1 RRR+oL8JZ5QBdtomhUb1kBxJkN0n2+H/IRKurlqOPzNZsimu2qZTZC7bMsrAyyzk+OGi LgLlUCn4UGei1bZxiBznhl7qQIEaoIrdLglz5T4QpORLC72wVNh/IjclHMw6fpOOboG0 LA5qaSKB5dGUbGC0iw8o+6Z4RjeY/Z26FTeHPgGTm3WQMHzpuXJc1408jKtdBS1L1nnQ cavA== 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=Cmtw05llgb/mcCqlw3igL1JShmvNTdbzkXIsqE25pVo=; b=5t85aGVL/BKnZemV9tE6sLs+VDIsoYSgpIS28G5jR76Q8PUtR7/zzg7AgC2Ky5EVu8 MsdRCFQ668XcZMlioSQqvx/SiVhooggMHSmLQpMaVVEhUeEqcPI7kr4blcQ8pFvhaBRu DY3r9IJ4b2b6+G3AvAQdje1jgShn4y+F41YbhHLTOqPfIN7ydXssrHKp2cRDxBPEbrHV +9yUAScVcitw6SQSNPIuN6QJ6b/JGMiBmNv8M3KOsEwSK0bxipP21PrlBuPxQTd8Ym9D 8acml0exUtACKqdmk0HyTprG4D1wcD6ZwbV74zgSO1vLIZ7j0XNPV2bRG5tYo/QTnxQ1 BMsQ== X-Gm-Message-State: AOAM531WaxSwBxkc5UPzlSk8/idyyzO40ybAW09FcGWEIf9zMc8em253 tWAHwklXEvCV7+zcQT00Vpx/z5fpeookiXnSqSA= X-Received: by 2002:a5d:6347:: with SMTP id b7mr9065595wrw.36.1637689101247; Tue, 23 Nov 2021 09:38:21 -0800 (PST) Received: from cloudburst.home (149.164.14.37.dynamic.jazztel.es. [37.14.164.149]) by smtp.gmail.com with ESMTPSA id n13sm13054883wrt.44.2021.11.23.09.38.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Nov 2021 09:38:20 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v6 12/16] common-user: Move safe-syscall.* from linux-user Date: Tue, 23 Nov 2021 18:37:55 +0100 Message-Id: <20211123173759.1383510-13-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211123173759.1383510-1-richard.henderson@linaro.org> References: <20211123173759.1383510-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::429 (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::429; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x429.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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, PDS_HP_HELO_NORDNS=0.001, 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.eu, imp@bsdimp.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Move linux-user safe-syscall.S and safe-syscall-error.c to common-user so that bsd-user can also use it. Also move safe-syscall.h to include/user/. Since there is nothing here that is related to the guest, as opposed to the host, build it once. Reviewed-by: Warner Losh Signed-off-by: Richard Henderson --- meson.build | 18 +++++++++++++++++- {linux-user => include/user}/safe-syscall.h | 0 .../safe-syscall-error.c | 2 +- linux-user/signal.c | 2 +- linux-user/syscall.c | 2 +- MAINTAINERS | 2 ++ bsd-user/meson.build | 2 ++ .../host/aarch64/safe-syscall.inc.S | 2 +- .../host/arm/safe-syscall.inc.S | 2 +- .../host/i386/safe-syscall.inc.S | 2 +- .../host/mips/safe-syscall.inc.S | 2 +- .../host/ppc64/safe-syscall.inc.S | 2 +- .../host/riscv/safe-syscall.inc.S | 2 +- .../host/s390x/safe-syscall.inc.S | 2 +- .../host/sparc64/safe-syscall.inc.S | 2 +- .../host/x86_64/safe-syscall.inc.S | 2 +- common-user/meson.build | 6 ++++++ {linux-user => common-user}/safe-syscall.S | 0 linux-user/meson.build | 5 +++-- 19 files changed, 42 insertions(+), 15 deletions(-) rename {linux-user => include/user}/safe-syscall.h (100%) rename {linux-user => common-user}/safe-syscall-error.c (95%) rename {linux-user => common-user}/host/aarch64/safe-syscall.inc.S (97%) rename {linux-user => common-user}/host/arm/safe-syscall.inc.S (98%) rename {linux-user => common-user}/host/i386/safe-syscall.inc.S (98%) rename {linux-user => common-user}/host/mips/safe-syscall.inc.S (98%) rename {linux-user => common-user}/host/ppc64/safe-syscall.inc.S (97%) rename {linux-user => common-user}/host/riscv/safe-syscall.inc.S (97%) rename {linux-user => common-user}/host/s390x/safe-syscall.inc.S (98%) rename {linux-user => common-user}/host/sparc64/safe-syscall.inc.S (97%) rename {linux-user => common-user}/host/x86_64/safe-syscall.inc.S (98%) create mode 100644 common-user/meson.build rename {linux-user => common-user}/safe-syscall.S (100%) diff --git a/meson.build b/meson.build index 96de1a6ef9..d5ac65b877 100644 --- a/meson.build +++ b/meson.build @@ -2366,6 +2366,7 @@ block_ss = ss.source_set() bsd_user_ss = ss.source_set() chardev_ss = ss.source_set() common_ss = ss.source_set() +common_user_ss = ss.source_set() crypto_ss = ss.source_set() hwcore_ss = ss.source_set() io_ss = ss.source_set() @@ -2610,15 +2611,30 @@ subdir('tcg') subdir('fpu') subdir('accel') subdir('plugins') +subdir('ebpf') + +common_user_inc = [] + +subdir('common-user') subdir('bsd-user') subdir('linux-user') -subdir('ebpf') specific_ss.add_all(when: 'CONFIG_BSD_USER', if_true: bsd_user_ss) linux_user_ss.add(files('thunk.c')) specific_ss.add_all(when: 'CONFIG_LINUX_USER', if_true: linux_user_ss) +common_user_ss = common_user_ss.apply(config_all, strict: false) +common_user = static_library('common-user', + sources: common_user_ss.sources(), + dependencies: common_user_ss.dependencies(), + include_directories: common_user_inc, + name_suffix: 'fa', + build_by_default: false) +common_user = declare_dependency(link_with: common_user) + +user_ss.add(common_user) + # needed for fuzzing binaries subdir('tests/qtest/libqos') subdir('tests/qtest/fuzz') diff --git a/linux-user/safe-syscall.h b/include/user/safe-syscall.h similarity index 100% rename from linux-user/safe-syscall.h rename to include/user/safe-syscall.h diff --git a/linux-user/safe-syscall-error.c b/common-user/safe-syscall-error.c similarity index 95% rename from linux-user/safe-syscall-error.c rename to common-user/safe-syscall-error.c index 55d95ac39a..cf74b504f8 100644 --- a/linux-user/safe-syscall-error.c +++ b/common-user/safe-syscall-error.c @@ -10,7 +10,7 @@ */ #include "qemu/osdep.h" -#include "safe-syscall.h" +#include "user/safe-syscall.h" /* * This is intended to be invoked via tail-call on the error path diff --git a/linux-user/signal.c b/linux-user/signal.c index 12b1705287..510db73c34 100644 --- a/linux-user/signal.c +++ b/linux-user/signal.c @@ -31,7 +31,7 @@ #include "trace.h" #include "signal-common.h" #include "host-signal.h" -#include "safe-syscall.h" +#include "user/safe-syscall.h" static struct target_sigaction sigact_table[TARGET_NSIG]; diff --git a/linux-user/syscall.c b/linux-user/syscall.c index f5bf6d155c..56a3e17183 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -132,7 +132,7 @@ #include "signal-common.h" #include "loader.h" #include "user-mmap.h" -#include "safe-syscall.h" +#include "user/safe-syscall.h" #include "qemu/guest-random.h" #include "qemu/selfmap.h" #include "user/syscall-trace.h" diff --git a/MAINTAINERS b/MAINTAINERS index d3879aa3c1..e3a12857f9 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -3078,6 +3078,8 @@ M: Riku Voipio S: Maintained F: thunk.c F: accel/tcg/user-exec*.c +F: include/user/ +F: common-user/ BSD user M: Warner Losh diff --git a/bsd-user/meson.build b/bsd-user/meson.build index 87885d91ed..25c3976ead 100644 --- a/bsd-user/meson.build +++ b/bsd-user/meson.build @@ -2,6 +2,8 @@ if not have_bsd_user subdir_done() endif +common_user_inc += include_directories('.') + bsd_user_ss.add(files( 'bsdload.c', 'elfload.c', diff --git a/linux-user/host/aarch64/safe-syscall.inc.S b/common-user/host/aarch64/safe-syscall.inc.S similarity index 97% rename from linux-user/host/aarch64/safe-syscall.inc.S rename to common-user/host/aarch64/safe-syscall.inc.S index 87c9580faa..73a04b73b3 100644 --- a/linux-user/host/aarch64/safe-syscall.inc.S +++ b/common-user/host/aarch64/safe-syscall.inc.S @@ -1,7 +1,7 @@ /* * safe-syscall.inc.S : host-specific assembly fragment * to handle signals occurring at the same time as system calls. - * This is intended to be included by linux-user/safe-syscall.S + * This is intended to be included by common-user/safe-syscall.S * * Written by Richard Henderson * Copyright (C) 2016 Red Hat, Inc. diff --git a/linux-user/host/arm/safe-syscall.inc.S b/common-user/host/arm/safe-syscall.inc.S similarity index 98% rename from linux-user/host/arm/safe-syscall.inc.S rename to common-user/host/arm/safe-syscall.inc.S index f1a6aabfd3..66176a902c 100644 --- a/linux-user/host/arm/safe-syscall.inc.S +++ b/common-user/host/arm/safe-syscall.inc.S @@ -1,7 +1,7 @@ /* * safe-syscall.inc.S : host-specific assembly fragment * to handle signals occurring at the same time as system calls. - * This is intended to be included by linux-user/safe-syscall.S + * This is intended to be included by common-user/safe-syscall.S * * Written by Richard Henderson * Copyright (C) 2016 Red Hat, Inc. diff --git a/linux-user/host/i386/safe-syscall.inc.S b/common-user/host/i386/safe-syscall.inc.S similarity index 98% rename from linux-user/host/i386/safe-syscall.inc.S rename to common-user/host/i386/safe-syscall.inc.S index 1fb031d228..aced8c5141 100644 --- a/linux-user/host/i386/safe-syscall.inc.S +++ b/common-user/host/i386/safe-syscall.inc.S @@ -1,7 +1,7 @@ /* * safe-syscall.inc.S : host-specific assembly fragment * to handle signals occurring at the same time as system calls. - * This is intended to be included by linux-user/safe-syscall.S + * This is intended to be included by common-user/safe-syscall.S * * Written by Richard Henderson * Copyright (C) 2016 Red Hat, Inc. diff --git a/linux-user/host/mips/safe-syscall.inc.S b/common-user/host/mips/safe-syscall.inc.S similarity index 98% rename from linux-user/host/mips/safe-syscall.inc.S rename to common-user/host/mips/safe-syscall.inc.S index 3252aff23d..190c050220 100644 --- a/linux-user/host/mips/safe-syscall.inc.S +++ b/common-user/host/mips/safe-syscall.inc.S @@ -1,7 +1,7 @@ /* * safe-syscall.inc.S : host-specific assembly fragment * to handle signals occurring at the same time as system calls. - * This is intended to be included by linux-user/safe-syscall.S + * This is intended to be included by common-user/safe-syscall.S * * Written by Richard Henderson * Copyright (C) 2021 Linaro, Inc. diff --git a/linux-user/host/ppc64/safe-syscall.inc.S b/common-user/host/ppc64/safe-syscall.inc.S similarity index 97% rename from linux-user/host/ppc64/safe-syscall.inc.S rename to common-user/host/ppc64/safe-syscall.inc.S index 36230169f4..5271b47248 100644 --- a/linux-user/host/ppc64/safe-syscall.inc.S +++ b/common-user/host/ppc64/safe-syscall.inc.S @@ -1,7 +1,7 @@ /* * safe-syscall.inc.S : host-specific assembly fragment * to handle signals occurring at the same time as system calls. - * This is intended to be included by linux-user/safe-syscall.S + * This is intended to be included by common-user/safe-syscall.S * * Written by Richard Henderson * Copyright (C) 2016 Red Hat, Inc. diff --git a/linux-user/host/riscv/safe-syscall.inc.S b/common-user/host/riscv/safe-syscall.inc.S similarity index 97% rename from linux-user/host/riscv/safe-syscall.inc.S rename to common-user/host/riscv/safe-syscall.inc.S index ca456d8a46..dfe83c300e 100644 --- a/linux-user/host/riscv/safe-syscall.inc.S +++ b/common-user/host/riscv/safe-syscall.inc.S @@ -1,7 +1,7 @@ /* * safe-syscall.inc.S : host-specific assembly fragment * to handle signals occurring at the same time as system calls. - * This is intended to be included by linux-user/safe-syscall.S + * This is intended to be included by common-user/safe-syscall.S * * Written by Richard Henderson * Copyright (C) 2018 Linaro, Inc. diff --git a/linux-user/host/s390x/safe-syscall.inc.S b/common-user/host/s390x/safe-syscall.inc.S similarity index 98% rename from linux-user/host/s390x/safe-syscall.inc.S rename to common-user/host/s390x/safe-syscall.inc.S index 66f84385a2..2ccbaa2402 100644 --- a/linux-user/host/s390x/safe-syscall.inc.S +++ b/common-user/host/s390x/safe-syscall.inc.S @@ -1,7 +1,7 @@ /* * safe-syscall.inc.S : host-specific assembly fragment * to handle signals occurring at the same time as system calls. - * This is intended to be included by linux-user/safe-syscall.S + * This is intended to be included by common-user/safe-syscall.S * * Written by Richard Henderson * Copyright (C) 2016 Red Hat, Inc. diff --git a/linux-user/host/sparc64/safe-syscall.inc.S b/common-user/host/sparc64/safe-syscall.inc.S similarity index 97% rename from linux-user/host/sparc64/safe-syscall.inc.S rename to common-user/host/sparc64/safe-syscall.inc.S index 3a0e76fcc7..6ad0b06d9a 100644 --- a/linux-user/host/sparc64/safe-syscall.inc.S +++ b/common-user/host/sparc64/safe-syscall.inc.S @@ -1,7 +1,7 @@ /* * safe-syscall.inc.S : host-specific assembly fragment * to handle signals occurring at the same time as system calls. - * This is intended to be included by linux-user/safe-syscall.S + * This is intended to be included by common-user/safe-syscall.S * * Written by Richard Henderson * Copyright (C) 2021 Red Hat, Inc. diff --git a/linux-user/host/x86_64/safe-syscall.inc.S b/common-user/host/x86_64/safe-syscall.inc.S similarity index 98% rename from linux-user/host/x86_64/safe-syscall.inc.S rename to common-user/host/x86_64/safe-syscall.inc.S index f88cbe1347..84fed206f9 100644 --- a/linux-user/host/x86_64/safe-syscall.inc.S +++ b/common-user/host/x86_64/safe-syscall.inc.S @@ -1,7 +1,7 @@ /* * safe-syscall.inc.S : host-specific assembly fragment * to handle signals occurring at the same time as system calls. - * This is intended to be included by linux-user/safe-syscall.S + * This is intended to be included by common-user/safe-syscall.S * * Copyright (C) 2015 Timothy Edward Baldwin * diff --git a/common-user/meson.build b/common-user/meson.build new file mode 100644 index 0000000000..45b8d0de2c --- /dev/null +++ b/common-user/meson.build @@ -0,0 +1,6 @@ +common_user_inc += include_directories('host/' / config_host['ARCH']) + +common_user_ss.add(files( + 'safe-syscall.S', + 'safe-syscall-error.c', +)) diff --git a/linux-user/safe-syscall.S b/common-user/safe-syscall.S similarity index 100% rename from linux-user/safe-syscall.S rename to common-user/safe-syscall.S diff --git a/linux-user/meson.build b/linux-user/meson.build index 94ac3c58ce..bf9d945504 100644 --- a/linux-user/meson.build +++ b/linux-user/meson.build @@ -2,6 +2,9 @@ if not have_linux_user subdir_done() endif +common_user_inc += include_directories('host/' / config_host['ARCH']) +common_user_inc += include_directories('.') + linux_user_ss.add(files( 'elfload.c', 'exit.c', @@ -9,8 +12,6 @@ linux_user_ss.add(files( 'linuxload.c', 'main.c', 'mmap.c', - 'safe-syscall.S', - 'safe-syscall-error.c', 'signal.c', 'strace.c', 'syscall.c', From patchwork Tue Nov 23 17:37:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 519327 Delivered-To: patch@linaro.org Received: by 2002:ac0:c605:0:0:0:0:0 with SMTP id p5csp8980101imj; Tue, 23 Nov 2021 09:43:36 -0800 (PST) X-Google-Smtp-Source: ABdhPJyYXY0mSvSFN0mprU3D1mhTR8+YCx/ncTrpI8x9gWhczU+Bgkx6fhzUqUPkD52ckqxM3nCD X-Received: by 2002:a05:620a:2153:: with SMTP id m19mr6719755qkm.77.1637689415891; Tue, 23 Nov 2021 09:43:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1637689415; cv=none; d=google.com; s=arc-20160816; b=mqgEVuHO3mfEg7xoAdQ6itYt25csDZUCgW6xBWsqe22LTlc379Oj5ydSBmqymW11ZG O8FXjhYCWTCtiPKkH4qyx/TwCfo308KadHEjtjRbAuaRHityCh4/oj0OXygYexzZ39EM 9Q7RhdaALD23fvLVYYg67404Ko0Rpkqp7BVJCC00waHvZl/LUL7LRf58iAWncbqQAnKB hWtjLLkqHriTF8UzZCTi+soUU5JF0QATChxSsRruwjlgayu3fI5E5NnmnuyOrugEPV/U vxq5ESaGqf3KfWdMqZoZRVkotrekwVclL/23ACzqz/wEZXgtu0NhG639sCXd4DS389BH hLMg== 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=eT2OMMtgUWRlyX31jrb7FBHkLkGN7+LrqX+ZG1ZjPS0=; b=FqcTaE+bf52mKV+HGS7SLoAfopvAoInBvleTkBJ3gykppT9hTw/8dha3x+IwiTBp9y YmKCJChw7NcN1QUkQFTVdrXon+QGaUueGjcUeVgW0sHePiC4vPHZLzn0FwBcExt8uAEH 9eUqyMRDpcp5Z643tb9nDdtc7u+LUXWGA3wN9FPfWXVRTepc4ltvKaIjgWaOXN0VLV9Z OUIJp9D/H++p0wrZKw05UtO7SOYrG6Kqw0m4reg8BpxYWqXSbYEUO0SJchnFC2B/dt0H 5WpJzcf+tuZUkF3MaFUO0tHwHaQUWM0GPhOV1znvRplaxvBccwg/RhX6ZcSXbNi6oIbc h4tA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=a8isYkxc; 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 b10si32515640vst.140.2021.11.23.09.43.35 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 23 Nov 2021 09:43:35 -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=fail header.i=@linaro.org header.s=google header.b=a8isYkxc; 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]:45440 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mpZpP-0006iY-AP for patch@linaro.org; Tue, 23 Nov 2021 12:43:35 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52408) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mpZkQ-0004dX-2O for qemu-devel@nongnu.org; Tue, 23 Nov 2021 12:38:26 -0500 Received: from [2a00:1450:4864:20::429] (port=42877 helo=mail-wr1-x429.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mpZkO-00051f-44 for qemu-devel@nongnu.org; Tue, 23 Nov 2021 12:38:25 -0500 Received: by mail-wr1-x429.google.com with SMTP id c4so40260658wrd.9 for ; Tue, 23 Nov 2021 09:38:23 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=eT2OMMtgUWRlyX31jrb7FBHkLkGN7+LrqX+ZG1ZjPS0=; b=a8isYkxchPBI2kG171Ixrg55LY6eoLftSd99O1kunKem/Y7BYl9ZIXTsS5DJEZVHDM PDFVu2RlItAPeJZ0tM/q8gGCsSqhjL7N05XtmBAWdJmQ0XXjOQppQ7n5yLTdVVXOgy7L 28rYMJU1A4+YEKrb90lPE5s5xzoEsN2OMeFihOuBEgdopxA8LAZhrNrLJZALqc66Yg/o NKpvqlTKxyZuitk1f8elsR/r7JTx2h4z9e9K5oyGkouuEhLcR74xDYJ/FAzQgbXPn1oY JyOVo92uy03OpXJAuPJ2GCuwW92neS64qxFPEPyptZR64Eh4OxUP2Kas0C/KMEt93p2k Pybg== 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=eT2OMMtgUWRlyX31jrb7FBHkLkGN7+LrqX+ZG1ZjPS0=; b=KZgk244a85cOI3IiDPyewk+MGUnsfglCnYKGlxNxsIQV/XKWLZqs632+Ume+K467jz aIgrz9NBt/BQNxjBd1QajvL4sFUhTf3NYwjGxnlQmQ0mGOJ4efV834Wh4FqQtqMq4xNs Dt7ybY4Wfrt3M+Ng4rgHX+BZfV9m4/V7sC1nUY8qwfsPvo4xoXhfct3LMrlMxNmRy9ho PI7bzSUH6rwxaxoP3Gdg922uStV3ikRrBuE8yh0ts10irBGMlJns1w26wou+eC2mdXTU 1l++LWQ4YMkKA2lWWM6fyoVA2jjEg99APsY+NlK0k1VERpmIU1mweXdN9bCnsUamQhgt HY/w== X-Gm-Message-State: AOAM530n3x5jYJO+3opLg9h+eA87AGpxW2WTaFDSeo4h9s4WeqYqlfiK /DdxLefgPlullm28PN4FHuLAfVdn3b+CifxAneo= X-Received: by 2002:a05:6000:15c8:: with SMTP id y8mr9280183wry.55.1637689102341; Tue, 23 Nov 2021 09:38:22 -0800 (PST) Received: from cloudburst.home (149.164.14.37.dynamic.jazztel.es. [37.14.164.149]) by smtp.gmail.com with ESMTPSA id n13sm13054883wrt.44.2021.11.23.09.38.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Nov 2021 09:38:21 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v6 13/16] common-user: Adjust system call return on FreeBSD Date: Tue, 23 Nov 2021 18:37:56 +0100 Message-Id: <20211123173759.1383510-14-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211123173759.1383510-1-richard.henderson@linaro.org> References: <20211123173759.1383510-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::429 (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::429; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x429.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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, PDS_HP_HELO_NORDNS=0.001, 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.eu, imp@bsdimp.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" FreeBSD system calls return positive errno. On the 4 hosts for which we have support, error is indicated by the C bit set or clear. Reviewed-by: Warner Losh Signed-off-by: Richard Henderson --- common-user/host/aarch64/safe-syscall.inc.S | 14 +++++++++++++- common-user/host/arm/safe-syscall.inc.S | 9 +++++++++ common-user/host/i386/safe-syscall.inc.S | 11 +++++++++++ common-user/host/x86_64/safe-syscall.inc.S | 11 +++++++++++ 4 files changed, 44 insertions(+), 1 deletion(-) diff --git a/common-user/host/aarch64/safe-syscall.inc.S b/common-user/host/aarch64/safe-syscall.inc.S index 73a04b73b3..b8fd5b553e 100644 --- a/common-user/host/aarch64/safe-syscall.inc.S +++ b/common-user/host/aarch64/safe-syscall.inc.S @@ -60,17 +60,29 @@ safe_syscall_start: cbnz w10, 2f svc 0x0 safe_syscall_end: + /* code path for having successfully executed the syscall */ +#if defined(__linux__) + /* Linux kernel returns (small) negative errno. */ cmp x0, #-4096 b.hi 0f +#elif defined(__FreeBSD__) + /* FreeBSD kernel returns positive errno and C bit set. */ + b.cs 1f +#else +#error "unsupported os" +#endif ret +#if defined(__linux__) /* code path setting errno */ 0: neg w0, w0 b safe_syscall_set_errno_tail +#endif /* code path when we didn't execute the syscall */ 2: mov w0, #QEMU_ERESTARTSYS - b safe_syscall_set_errno_tail +1: b safe_syscall_set_errno_tail + .cfi_endproc .size safe_syscall_base, .-safe_syscall_base diff --git a/common-user/host/arm/safe-syscall.inc.S b/common-user/host/arm/safe-syscall.inc.S index 66176a902c..bbfb89634e 100644 --- a/common-user/host/arm/safe-syscall.inc.S +++ b/common-user/host/arm/safe-syscall.inc.S @@ -74,10 +74,19 @@ safe_syscall_start: bne 2f swi 0 safe_syscall_end: + /* code path for having successfully executed the syscall */ +#if defined(__linux__) + /* Linux kernel returns (small) negative errno. */ cmp r0, #-4096 neghi r0, r0 bhi 1f +#elif defined(__FreeBSD__) + /* FreeBSD kernel returns positive errno and C bit set. */ + bcs 1f +#else +#error "unsupported os" +#endif pop { r4, r5, r6, r7, r8, pc } /* code path when we didn't execute the syscall */ diff --git a/common-user/host/i386/safe-syscall.inc.S b/common-user/host/i386/safe-syscall.inc.S index aced8c5141..baf5400a29 100644 --- a/common-user/host/i386/safe-syscall.inc.S +++ b/common-user/host/i386/safe-syscall.inc.S @@ -71,9 +71,18 @@ safe_syscall_start: mov 8+16(%esp), %eax /* syscall number */ int $0x80 safe_syscall_end: + /* code path for having successfully executed the syscall */ +#if defined(__linux__) + /* Linux kernel returns (small) negative errno. */ cmp $-4095, %eax jae 0f +#elif defined(__FreeBSD__) + /* FreeBSD kernel returns positive errno and C bit set. */ + jc 1f +#else +#error "unsupported os" +#endif pop %ebx .cfi_remember_state .cfi_adjust_cfa_offset -4 @@ -90,8 +99,10 @@ safe_syscall_end: ret .cfi_restore_state +#if defined(__linux__) 0: neg %eax jmp 1f +#endif /* code path when we didn't execute the syscall */ 2: mov $QEMU_ERESTARTSYS, %eax diff --git a/common-user/host/x86_64/safe-syscall.inc.S b/common-user/host/x86_64/safe-syscall.inc.S index 84fed206f9..a20927a783 100644 --- a/common-user/host/x86_64/safe-syscall.inc.S +++ b/common-user/host/x86_64/safe-syscall.inc.S @@ -68,9 +68,18 @@ safe_syscall_start: jnz 2f syscall safe_syscall_end: + /* code path for having successfully executed the syscall */ +#if defined(__linux__) + /* Linux kernel returns (small) negative errno. */ cmp $-4095, %rax jae 0f +#elif defined(__FreeBSD__) + /* FreeBSD kernel returns positive errno and C bit set. */ + jc 1f +#else +#error "unsupported os" +#endif pop %rbp .cfi_remember_state .cfi_def_cfa_offset 8 @@ -78,8 +87,10 @@ safe_syscall_end: ret .cfi_restore_state +#if defined(__linux__) 0: neg %eax jmp 1f +#endif /* code path when we didn't execute the syscall */ 2: mov $QEMU_ERESTARTSYS, %eax From patchwork Tue Nov 23 17:37:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 519334 Delivered-To: patch@linaro.org Received: by 2002:ac0:c605:0:0:0:0:0 with SMTP id p5csp8986204imj; Tue, 23 Nov 2021 09:47:55 -0800 (PST) X-Google-Smtp-Source: ABdhPJwCh0kGo7u9sR2ap6Y8a2Jteavv7miR9h2Nc0gi3Y4DXR64j97hsrhEkenHG5bkdC/mjp5j X-Received: by 2002:ab0:6ecf:: with SMTP id c15mr11665058uav.113.1637689675273; Tue, 23 Nov 2021 09:47:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1637689675; cv=none; d=google.com; s=arc-20160816; b=k6a3zFZ06I8xDZ+L69i3GUjl8vfhnJICNwtWixQs3wcDK6q48E/Y8xlLNu8eN3Vp/X 1MO0RBoBhMDLtczPHxoO815QYWd0TGunIO3LJHVVVXXx8NKpv2pDdZ5U0/6bBxEU1SzA o+/J69Zra34ZrlHir0CBEbi/yeSLMnBnoCTOFqnEhdSyRktKNwiXkrwMT1UHylc71wDO BAmp5V1D7K61dqHn4YJkap/Ts4eHnKE2yRQf9JeMLYHPf3a7UqYLvykmuIE5mNTJp4kF 94VUmSc5AnfLDCz+kXuU+EAWOC0OgeODd6WGakpNR12LmTs+No6P/AJcpko0JyNWRv99 MC+Q== 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=6aHmyZ7eJwkq/2psQWocUvvFYakpSRUqI65Q0Y59+TI=; b=kcJyfx5+h/NrpykyRzODIsU2GIKMdPs1Vo4FgJknLiSJHKzrZLiwq1WeSP+G8l93eN l+beWxSg6bNpI3g/pimVWuZgPAzIqSq95HpM44X1OFgtw7ZJWcqrCKdKth5qNL9GTm78 syzP+0Hjkp1c6k/ISqU0um2G+RdMEzeIgTA6uLbLe4hlrXZ8NmFCIUyGzsJh0iyascZa Y5H9z0ySMOt24D0Phyxo0J9BMkemM96tLNCzZZRBBkwgqI43a1Q/skYR7ylfj8TipBKh RBkuetOswIA+cxl+eu9lf/NuXHBbCRRmxQMSjtMXNEWQQIf6yZWySL6DWCrXFvisuU07 ZE7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=dZhBlAaw; 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 q3si2950111vsh.172.2021.11.23.09.47.55 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 23 Nov 2021 09:47:55 -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=fail header.i=@linaro.org header.s=google header.b=dZhBlAaw; 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]:60974 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mpZta-0000IL-PA for patch@linaro.org; Tue, 23 Nov 2021 12:47:54 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52422) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mpZkR-0004hK-2N for qemu-devel@nongnu.org; Tue, 23 Nov 2021 12:38:27 -0500 Received: from [2a00:1450:4864:20::430] (port=36659 helo=mail-wr1-x430.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mpZkP-00051u-8u for qemu-devel@nongnu.org; Tue, 23 Nov 2021 12:38:26 -0500 Received: by mail-wr1-x430.google.com with SMTP id s13so40365720wrb.3 for ; Tue, 23 Nov 2021 09:38:24 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=6aHmyZ7eJwkq/2psQWocUvvFYakpSRUqI65Q0Y59+TI=; b=dZhBlAawkXkgXXD395K+QuA5+9d5iEj29M5ZPzzlvUG3qXljziLfLlzY/Y/6ms4wRR GkA2IoUlDHyRkoWou89dvLlkpe1eQZrY/1ptmh6BgqAZi69u/Rjpz+14y0x+irW9N1WE O/g6u26AMlflKYUovY6+kLkPgq3saawfGej/9KNNd30P5FlAU8vSQ7+NI/LclBibt5IN 339stuXQNZc4XnzHkW0BdgNMJSJKeLyiSGDLdPFpAZRZSDEC2uCtERWE+WOQGZfQpwTZ twm/pCMYGqbpRV6sQH+xQW3E/arqndWbAOLSN6rDfBMGQ2LdMgXks/DHe8QpRTMUz/CZ n4sA== 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=6aHmyZ7eJwkq/2psQWocUvvFYakpSRUqI65Q0Y59+TI=; b=sBG+wDTk1qBw7rHdurht3EkMshHmhKduUbsE2s/sdUVX0ftqTx0SbFEiF3QH2wnTts dBT3YbHESXWqZ2C959ZVdXy5cdrY5HTeqydmgGRtNL+Mtt4teHS6FTSEzi9e/cBxUzon x2LcO/CsJH+G/UVUumenAMP2FpCh/+Qlaj/J0rWmWZvvE1woXzzirb9oLOKWh8tj4yc6 5WXZJ+NvgcTm2HLCAN74iI6PsOZc4OBFXq+SqCokbaIXxywD9Hvnr6J9nME3sHtAjBdw U4JXsobi23hVvGEJaJ8KGAGZrYFtuQtzwRrp9hvj2s3cuo2izLkjsMX1OsXAPdz+cWr0 6CQg== X-Gm-Message-State: AOAM532+GQfiz4fORjyV2RZHQmC+WmmdZoCbfSTLemW20SC7CoMC3e9C +6qQXiX5ujiYn4kF7K9AlGXKHGTFwUH5fikPCRE= X-Received: by 2002:a05:6000:4b:: with SMTP id k11mr9108420wrx.86.1637689103821; Tue, 23 Nov 2021 09:38:23 -0800 (PST) Received: from cloudburst.home (149.164.14.37.dynamic.jazztel.es. [37.14.164.149]) by smtp.gmail.com with ESMTPSA id n13sm13054883wrt.44.2021.11.23.09.38.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Nov 2021 09:38:23 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v6 14/16] linux-user: Move thunk.c from top-level Date: Tue, 23 Nov 2021 18:37:57 +0100 Message-Id: <20211123173759.1383510-15-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211123173759.1383510-1-richard.henderson@linaro.org> References: <20211123173759.1383510-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::430 (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::430; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x430.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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, PDS_HP_HELO_NORDNS=0.001, 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.eu, imp@bsdimp.com, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" So far, linux-user is the only user of these functions. Clean up the build machinery by restricting it to linux-user. Reviewed-by: Warner Losh Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- meson.build | 1 - thunk.c => linux-user/thunk.c | 0 MAINTAINERS | 1 - linux-user/meson.build | 1 + 4 files changed, 1 insertion(+), 2 deletions(-) rename thunk.c => linux-user/thunk.c (100%) diff --git a/meson.build b/meson.build index d5ac65b877..cd97b154bd 100644 --- a/meson.build +++ b/meson.build @@ -2621,7 +2621,6 @@ subdir('linux-user') specific_ss.add_all(when: 'CONFIG_BSD_USER', if_true: bsd_user_ss) -linux_user_ss.add(files('thunk.c')) specific_ss.add_all(when: 'CONFIG_LINUX_USER', if_true: linux_user_ss) common_user_ss = common_user_ss.apply(config_all, strict: false) diff --git a/thunk.c b/linux-user/thunk.c similarity index 100% rename from thunk.c rename to linux-user/thunk.c diff --git a/MAINTAINERS b/MAINTAINERS index e3a12857f9..d3c045ff86 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -3076,7 +3076,6 @@ Usermode Emulation Overall usermode emulation M: Riku Voipio S: Maintained -F: thunk.c F: accel/tcg/user-exec*.c F: include/user/ F: common-user/ diff --git a/linux-user/meson.build b/linux-user/meson.build index bf9d945504..fcf7d40f23 100644 --- a/linux-user/meson.build +++ b/linux-user/meson.build @@ -15,6 +15,7 @@ linux_user_ss.add(files( 'signal.c', 'strace.c', 'syscall.c', + 'thunk.c', 'uaccess.c', 'uname.c', )) From patchwork Tue Nov 23 17:37:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 519333 Delivered-To: patch@linaro.org Received: by 2002:ac0:c605:0:0:0:0:0 with SMTP id p5csp8984697imj; Tue, 23 Nov 2021 09:46:50 -0800 (PST) X-Google-Smtp-Source: ABdhPJye8dDnK1kSS2BivrZzlbJq4hHflB/6+IEnoLH0rLU4MbVxSHt70A/MAvJyJGFFQsfBaZef X-Received: by 2002:a05:6102:5492:: with SMTP id bk18mr11991596vsb.18.1637689610136; Tue, 23 Nov 2021 09:46:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1637689610; cv=none; d=google.com; s=arc-20160816; b=QRLwmSjXjRyBEpJul6Sz5AahqqkUNU5ZjMpvwZO9V2dhwZlpOcoJPfdKrhZpPS0mhO 3pYkz4L4dLboOMa4wuE/NULyUVRFbnQ+MUwAJiIww4lJVXxSVB+ki3vx3Xdb3XvKeH6z RV0ltc6zj6jarqeLMRyTn9WJ/A4eMyPfe4ZXqVdlbmLdU8a/qne+F5CvxyIA3+suYUc8 +LyLNGIITqNEaIE9tdKqEhofWGx7hDvQo1mmMCR/ZrEzu4Ar1CGXR5NqI6HTADsLWnqN L80uoSQTsij+RfendM+9qcX/Ep31oPqwGdZVRrPeiHoZGAzLvMr4YIfsVCsUHmXwMMLQ M3SA== 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=BZTFEWkCcq7QoVstw7Mtl+bBngHaigSh+UQzae6el5A=; b=jV7DaYg+MqtXCRfsXoKurUoXqXZg4zx0VibgW0VFgBWfyyJkuH09ukbPul1YJaxnfy oq5RaoFac4f+IrrBQ/R+kuxKsk6DKJUqvFn4hZ+Mw60482cHcofO/hEZjG2JZR5RKFzv RadOwMvnDq7vPW9Vatd3ARlA6sVKV0ygM6YOK3pllYCcKNFlYEXgKXxI+a4HN0GB2CO+ FIC/UfsCK1cq6vTf6MYtFwWF8l8Gh4ssnvwmtUqGZlbRNGZPywDXuHZyrOpEHqT22111 9g7pgOqzUSY7/KobPJt95gXgZlakfyuns1KOGdUYUUWT3oDoLPDKlMZ31ancjSL3ciLs ad6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=tWs39q42; 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 r11si1120417uat.250.2021.11.23.09.46.50 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 23 Nov 2021 09:46:50 -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=fail header.i=@linaro.org header.s=google header.b=tWs39q42; 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]:56802 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mpZsX-0005tE-In for patch@linaro.org; Tue, 23 Nov 2021 12:46:49 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52432) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mpZkR-0004l3-Ud for qemu-devel@nongnu.org; Tue, 23 Nov 2021 12:38:27 -0500 Received: from [2a00:1450:4864:20::42d] (port=34773 helo=mail-wr1-x42d.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mpZkQ-000526-FA for qemu-devel@nongnu.org; Tue, 23 Nov 2021 12:38:27 -0500 Received: by mail-wr1-x42d.google.com with SMTP id j3so2590426wrp.1 for ; Tue, 23 Nov 2021 09:38:26 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=BZTFEWkCcq7QoVstw7Mtl+bBngHaigSh+UQzae6el5A=; b=tWs39q42/vFaYtFNFQArMNOWOziIduahqsqWnetRTQGjLP1avimrgzNOT+iEnoby2S e0MWqpY8BK5olNOFIPlk7+AgPtpsCkNWQVoHM2f4fEoPjIxep0sVoUeCauuIvsOqNq7K Qq6RjgNsMWAowa6oGtiaaMU7VOHC12wNxd8/KNwr5AlxIxlN66r6v8VChq4iJmPOWEvq 6gfL5HC35zoURLlX0L9IOKfHBJbvqBDAFJfVoSJUznU6COV5JOUDa1mBBAjSH8No2lTT mYZJPg8fpTmDCW0IuVG38CG81DqYbYnoP5sArguKbdB7SXEsawxDDGVuHWijMUPyGhIr 04LQ== 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=BZTFEWkCcq7QoVstw7Mtl+bBngHaigSh+UQzae6el5A=; b=k2WRQUO0rkpvnR44eX8cDb2u6OZ83CcZcTSfuv43/0sYbxK7Va6uIn7pzpeYdKp1Sa dF6DS4BkqPcnW4VlYKuGeEKvC3FkKXHZO0xDhiUGj6MBhjIP/52/gqscm6yvnqBWMV8Q NDRjwqKi4L5M0SUm0pk6xcqtClSjMbpOAa4qCF1ZWVFALC2KsF7emf4g91x6L3cMziMy 6H9N8E8NP4E3bhLBxOL+Q16eq4ajK5YObJrYCkJaegkQm6yGI812e1ogilvfdfbamtE8 mkqi3j+t44mDREy0yjtFO5mcZxryCJWinlkyKKbCt9MljZQQ6cgMU1wygrqmZyD/kMKm G3yQ== X-Gm-Message-State: AOAM533RwCHqR7fzilXh/mhd70tm2w+5B3X191F9yvj8o5pY3E+XB0G4 C8SsqMzhRt+seoADO+q4F9mpeFV5QS1cTi26bUI= X-Received: by 2002:adf:8b1e:: with SMTP id n30mr3727445wra.75.1637689105230; Tue, 23 Nov 2021 09:38:25 -0800 (PST) Received: from cloudburst.home (149.164.14.37.dynamic.jazztel.es. [37.14.164.149]) by smtp.gmail.com with ESMTPSA id n13sm13054883wrt.44.2021.11.23.09.38.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Nov 2021 09:38:24 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v6 15/16] meson: Move linux_user_ss to linux-user/ Date: Tue, 23 Nov 2021 18:37:58 +0100 Message-Id: <20211123173759.1383510-16-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211123173759.1383510-1-richard.henderson@linaro.org> References: <20211123173759.1383510-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::42d (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::42d; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x42d.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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, PDS_HP_HELO_NORDNS=0.001, 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.eu, imp@bsdimp.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" We have no need to reference linux_user_ss outside of linux-user. Go ahead and merge it directly into specific_ss. Reviewed-by: Warner Losh Signed-off-by: Richard Henderson --- meson.build | 3 --- linux-user/meson.build | 4 ++++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/meson.build b/meson.build index cd97b154bd..bf7af382de 100644 --- a/meson.build +++ b/meson.build @@ -2370,7 +2370,6 @@ common_user_ss = ss.source_set() crypto_ss = ss.source_set() hwcore_ss = ss.source_set() io_ss = ss.source_set() -linux_user_ss = ss.source_set() qmp_ss = ss.source_set() qom_ss = ss.source_set() softmmu_ss = ss.source_set() @@ -2621,8 +2620,6 @@ subdir('linux-user') specific_ss.add_all(when: 'CONFIG_BSD_USER', if_true: bsd_user_ss) -specific_ss.add_all(when: 'CONFIG_LINUX_USER', if_true: linux_user_ss) - common_user_ss = common_user_ss.apply(config_all, strict: false) common_user = static_library('common-user', sources: common_user_ss.sources(), diff --git a/linux-user/meson.build b/linux-user/meson.build index fcf7d40f23..b89534c49c 100644 --- a/linux-user/meson.build +++ b/linux-user/meson.build @@ -2,6 +2,8 @@ if not have_linux_user subdir_done() endif +linux_user_ss = ss.source_set() + common_user_inc += include_directories('host/' / config_host['ARCH']) common_user_inc += include_directories('.') @@ -42,3 +44,5 @@ subdir('sh4') subdir('sparc') subdir('x86_64') subdir('xtensa') + +specific_ss.add_all(when: 'CONFIG_LINUX_USER', if_true: linux_user_ss) From patchwork Tue Nov 23 17:37: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: 519335 Delivered-To: patch@linaro.org Received: by 2002:ac0:c605:0:0:0:0:0 with SMTP id p5csp8987252imj; Tue, 23 Nov 2021 09:48:42 -0800 (PST) X-Google-Smtp-Source: ABdhPJwhuz0g0DZ62VNmXWqLwZxNnhfYAejLJTxGm9RdiopbaiC+uAN780yCIqO/dQ8/xIu30COt X-Received: by 2002:a05:6102:e14:: with SMTP id o20mr11359586vst.26.1637689722217; Tue, 23 Nov 2021 09:48:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1637689722; cv=none; d=google.com; s=arc-20160816; b=Eu3db1dpkHQRbclntRqaw1fFrYDx5sQOAcmh9Rt1Q5gFGuy3Z0qfj0wdL2WA57G8vW LUO4YMjJsWWTRDkvCz+rbX5ECbWuZbYAUzqMH1jUw5i+seldUKumFKrN0ZhOLAB/zzQ2 nEqps7VIkeUiWIHyOOqZlDiEAxKd87R/xdyDxaPjYaD1nLzcAx1KZdqE0gi06Hx6UfSk VBqOecAGmVt6uUuXYORkys9BKsLOtCOXB0+WlPDNFPfJZy6NdBSBoq714A7XG331JGq/ UUZcJ/fuUmvCTmoWc0IfxOB2H7dYw6BV04Dgu6dW2d3cAtRJU/BsavY54EPEisOatAHl 3jMA== 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=EG4DMUGXVEyZNv1Q4b/NktcGLb+o4TMJ3Kcuz4Efvk0=; b=Uu1YztwlNmrdvQP8qjoGpyVS8PPsvLoOMkLe2e4ujyvOde1cdavMwuTZb/4xx80upO g8XtV/3g2yMN8B7iBUi5be7JG5W3FSUT8aU6tzBkK7nvpKTldicTna8NJFsXgKw5HrSe Y1158BGrXReaegUornrr7aZb7I7o5eBdbxFAbxPzJ7Ll0Zn7dfXJLixOpjgJp7a59TJe E9oKmgqFgeWRSjx6q3pBnJSKHXB5XnWlRcHOasNGqzOy4VL2dqL1/n0Ie/oCmTn4jtVu XInafD2N81IU+/t/fov9QLMuPz9aBa8rhhZH0VnKoZbx8NB3QMg6Erk1YsuMYH0hdG7z s8ww== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=VmB3ArHR; 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 4si14538925vkg.64.2021.11.23.09.48.42 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 23 Nov 2021 09:48:42 -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=fail header.i=@linaro.org header.s=google header.b=VmB3ArHR; 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]:34308 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mpZuL-0001Nf-Nb for patch@linaro.org; Tue, 23 Nov 2021 12:48:41 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52446) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mpZkT-0004pT-6T for qemu-devel@nongnu.org; Tue, 23 Nov 2021 12:38:29 -0500 Received: from [2a00:1450:4864:20::42a] (port=41487 helo=mail-wr1-x42a.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mpZkR-00052J-QT for qemu-devel@nongnu.org; Tue, 23 Nov 2021 12:38:28 -0500 Received: by mail-wr1-x42a.google.com with SMTP id a9so40276003wrr.8 for ; Tue, 23 Nov 2021 09:38:27 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=EG4DMUGXVEyZNv1Q4b/NktcGLb+o4TMJ3Kcuz4Efvk0=; b=VmB3ArHRas2JsubwzWGCImBIQHihsJKdV4h4a6Tw7prAar7RzvHEkVr18HXMIToOgk pZggtwS+EJpbtuAU2Hz/SCE2hLAv/9hrLUa4G16pvycuihkPqRfUqNFI1ZvCVhCJDNrg PotuyUUgn1ADWiquV9aBuk0SDPlAB7J/4+CKqAvUpDNo550aSTMWuNoa3nMGaiSWnPTT lteG9r+CfmwuSQLHOtMGtIoD3MqcG3gJZiSg8a1qXnNzv1NdImuHl67a80Ztg986G4eP nDHiG4yTDNPRS/6BK3bXLcP+MQVnT1P2N8ychLXfeoojIsyViTNX7K+jIXjKsPVzo3hB 1f8A== 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=EG4DMUGXVEyZNv1Q4b/NktcGLb+o4TMJ3Kcuz4Efvk0=; b=HHThhQqyiFihKngKIJkuxtJMHK05VW5kZhOaICcLtSETlTgEWFHw5S1V6F0lMqVD6A IRhh01paRNPBwfkR7n48vGuOSqMoXf0aLEYGvyKCiwSC2kBdiDIpFwd1k/ysXW/SrcHi oYfHkBQRafUYY0eF8OEUREBMehtas6K6omKSEB2GU3GS7ozU9/S0rsLI0MApj3nPOVMj 1JkXWyzLRx8m5VonRNLBHhjbLSFmFS/p8/aHCB0f9Rx28UJxcbJ9REOMl9abuBBDLV47 nlNCmDq+EMWR+vCPwZYMZnJPxYNBOn8uDlLd9XMvHqh88z5pyG0K+k10W8QRDL0GfOoC WI1Q== X-Gm-Message-State: AOAM533oNl7AnrwPpNS/9nCX3CCqnZRIfjAz77j4mT2r/I3lSj6ZLUA0 mEHzoR0glP+3mM6o8NLTpR1oplrVS8NfOOtq35o= X-Received: by 2002:a5d:4a0b:: with SMTP id m11mr9324459wrq.120.1637689106475; Tue, 23 Nov 2021 09:38:26 -0800 (PST) Received: from cloudburst.home (149.164.14.37.dynamic.jazztel.es. [37.14.164.149]) by smtp.gmail.com with ESMTPSA id n13sm13054883wrt.44.2021.11.23.09.38.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Nov 2021 09:38:26 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v6 16/16] meson: Move bsd_user_ss to bsd-user/ Date: Tue, 23 Nov 2021 18:37:59 +0100 Message-Id: <20211123173759.1383510-17-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211123173759.1383510-1-richard.henderson@linaro.org> References: <20211123173759.1383510-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::42a (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::42a; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x42a.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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, PDS_HP_HELO_NORDNS=0.001, 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.eu, imp@bsdimp.com, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" We have no need to reference bsd_user_ss outside of bsd-user. Go ahead and merge it directly into specific_ss. Reviewed-by: Warner Losh Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- meson.build | 3 --- bsd-user/meson.build | 4 ++++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/meson.build b/meson.build index bf7af382de..e425129011 100644 --- a/meson.build +++ b/meson.build @@ -2363,7 +2363,6 @@ genh += hxdep authz_ss = ss.source_set() blockdev_ss = ss.source_set() block_ss = ss.source_set() -bsd_user_ss = ss.source_set() chardev_ss = ss.source_set() common_ss = ss.source_set() common_user_ss = ss.source_set() @@ -2618,8 +2617,6 @@ subdir('common-user') subdir('bsd-user') subdir('linux-user') -specific_ss.add_all(when: 'CONFIG_BSD_USER', if_true: bsd_user_ss) - common_user_ss = common_user_ss.apply(config_all, strict: false) common_user = static_library('common-user', sources: common_user_ss.sources(), diff --git a/bsd-user/meson.build b/bsd-user/meson.build index 25c3976ead..9fcb80c3fa 100644 --- a/bsd-user/meson.build +++ b/bsd-user/meson.build @@ -2,6 +2,8 @@ if not have_bsd_user subdir_done() endif +bsd_user_ss = ss.source_set() + common_user_inc += include_directories('.') bsd_user_ss.add(files( @@ -17,3 +19,5 @@ bsd_user_ss.add(files( # Pull in the OS-specific build glue, if any subdir(targetos) + +specific_ss.add_all(when: 'CONFIG_BSD_USER', if_true: bsd_user_ss)