From patchwork Mon Dec 20 20:24:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 526057 Delivered-To: patch@linaro.org Received: by 2002:a05:6e04:2287:0:0:0:0 with SMTP id bl7csp4423168imb; Mon, 20 Dec 2021 12:28:52 -0800 (PST) X-Google-Smtp-Source: ABdhPJwmdVemWfmGcc3rIowKoaDfdmEFy5f8uzT9k2Wt7e716j8VM/w0aFa+ZHSTIUuVPcQcGPP7 X-Received: by 2002:a25:4c8:: with SMTP id 191mr24998538ybe.357.1640032132842; Mon, 20 Dec 2021 12:28:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1640032132; cv=none; d=google.com; s=arc-20160816; b=RA5uEhRIcYKM9KI1+Z9zmAQ3UT9sKSdBg8MmVehqx+mP+OIr1aGI38+XIgK0PJRCNh iXU3NHnVJbLokHSnSJ0K3nfgas5hRW8OG00a/y7gJ4N5uWWcyNwLyisOE+CDOC2LiPlW GZS7v9DhVUsCQUrjskkDXkgBQaOt6kUqdDrx+rnyo9O7ADxJVI5SkjhK3lI6prtDei9o sTvXnhYUsCQ+SwsaTcjPivXubDpFzx31BCRzsdydJClq4i/wG0Ie7ExPSHAB9rfl1TAl XFyLywTTXBEFXxZ2PT7BAzY2BZz/mN0Hxg3JS5v3S5QLvUJCn8O6mqn1qoi6HU0Ch/9F 4m+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=ZIxvMCInzGAhnlnl/7XpFhtX3/AUhx7g699DhuXJbfA=; b=dqd3L6R1k+h2g2s8hSFIjKXhYtbvXy+VpoXUQ/FDtm/Sj8gBpUaOQlMMhm0VuPSjlN F/Av7ia8VvTQ+tRP53pTt2TEmzBRhE1FlvkzsI90ETqYl+OKHwmKtq4WQqcFLiDZx8yj Jj6F8Yo/LtTeNr+O+smmy90FzPQ84KeTCYeGkj0vOIoUcPh+3mzOEToqUSDeEVzlSmdq 0qbrLMOC0AboFRwc6SNuyk6py9qFDIQ3zmt7DdYbvaAPETguZi1ye4XoW/jfaDMPQfor AWhSZRU8NiNRT/eO+q7ULw+eQy/tgSBEDDYM0YtHVCn1HgxqnR0ft1EQHdsKNeFZM10z 2KuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=l5lSLU0j; 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 o11si26635936ybu.482.2021.12.20.12.28.52 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 20 Dec 2021 12:28:52 -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=l5lSLU0j; 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]:43760 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mzPHA-0006dI-9k for patch@linaro.org; Mon, 20 Dec 2021 15:28:52 -0500 Received: from eggs.gnu.org ([209.51.188.92]:44300) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mzPDe-0001fW-Py for qemu-devel@nongnu.org; Mon, 20 Dec 2021 15:25:15 -0500 Received: from [2607:f8b0:4864:20::536] (port=40917 helo=mail-pg1-x536.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mzPDV-0006zc-C2 for qemu-devel@nongnu.org; Mon, 20 Dec 2021 15:25:08 -0500 Received: by mail-pg1-x536.google.com with SMTP id l10so10349976pgm.7 for ; Mon, 20 Dec 2021 12:25:05 -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=ZIxvMCInzGAhnlnl/7XpFhtX3/AUhx7g699DhuXJbfA=; b=l5lSLU0jvdDgRgUmKehyvGDb9zx9rArQFX3yQ+dgDLR6pIleIluLHR6kCmdlK64h6f dbvI7u4ZvRftKFFOAKgJxkagGcnSEC8xMhwyhtfOgFNGha6kQKL4Jz07aPQwIujo6FpS FYUz7uYUvoZGj899RrDl2scPMHmG/KNBkyZj1oguuYvdXmmdLWlJpvzFA9KsUvlYoEaq uiTBMLcvrfaK05BGLods2OHginYbqACo4cjCY271UggfexZpYHwB8n6yIwNf5/wtTAEd 1QFR5XyK2j7hEuXvarulM3VHQSful4aKPcjPsYVt6dA9mpuZ0NUr2hX4p/reqvR5ng39 NSDg== 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=ZIxvMCInzGAhnlnl/7XpFhtX3/AUhx7g699DhuXJbfA=; b=bZGpMuAWobvmmCN+QqYaafxOMQBMi9k2xaflBtX1jQQRTxBxbyUjolV5d6Eh7oFsKp COszZ/D0zzXRE2dd31uL3gENy4kCIXCgmOlYTZbDEPtli+UqZdhQXciRnbxvNfwWySUu FdgR9YuXe3eAetNXmA/vEgDPDS4MxRw2V1ikjDEt1MrjIQeSDA8TY8EYh5Uhml7BjSDg 5KHsCI5Z33X1KEZ3Kwq5jeG0Ab20uPXyTxCIvhTPAPyX4HwR7wYViFYM9HPrRkudOna0 hAhGkjNkld4qcXL979jvYnnB0JXliXFid4d6Mu9zXCZtcY1Um4cX88HECn+SazElKm26 PpzQ== X-Gm-Message-State: AOAM533bxVANfxTHkuJwvFKPeTLIFpUwGXbefYVwLvdEDTmOQRZfQXsS NuLQ2cwhReOWZospmBSIBK3QQbSuTLeWUA== X-Received: by 2002:aa7:9298:0:b0:4ba:7d3a:1742 with SMTP id j24-20020aa79298000000b004ba7d3a1742mr16705826pfa.62.1640031903693; Mon, 20 Dec 2021 12:25:03 -0800 (PST) Received: from localhost.localdomain ([156.19.246.20]) by smtp.gmail.com with ESMTPSA id q19sm233118pjd.21.2021.12.20.12.25.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Dec 2021 12:25:03 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 01/15] linux-user: Untabify all safe-syscall.inc.S Date: Mon, 20 Dec 2021 12:24:46 -0800 Message-Id: <20211220202500.111897-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211220202500.111897-1-richard.henderson@linaro.org> References: <20211220202500.111897-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::536 (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::536; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x536.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, 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 , =?utf-8?q?Philippe_Mathieu-Dau?= =?utf-8?q?d=C3=A9?= , Warner Losh Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Reviewed-by: Warner Losh Reviewed-by: Philippe Mathieu-Daudé Suggested-by: Peter Maydell Signed-off-by: Richard Henderson --- 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 Mon Dec 20 20:24: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: 526058 Delivered-To: patch@linaro.org Received: by 2002:a05:6e04:2287:0:0:0:0 with SMTP id bl7csp4424237imb; Mon, 20 Dec 2021 12:30:36 -0800 (PST) X-Google-Smtp-Source: ABdhPJxxPeyVQ+zRwxOuSYfITDx8ogf/Uk0TS1Kbz0X39zCSewMnMgYEsFqk/0R8YHrCCHPgSXGv X-Received: by 2002:a25:d55:: with SMTP id 82mr24646784ybn.237.1640032236497; Mon, 20 Dec 2021 12:30:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1640032236; cv=none; d=google.com; s=arc-20160816; b=W+0qvwcHcIvB1GQ6YTUxbWWvtxY7nmMEpBkdyasKmK5bQY6+y7wQ/BLZe23DRa4cQ2 vdBVFkz9YxBTphbKFsEebT/L7jNktvnGMSPHY48xRqK8BngKvnq0wjn6o8rzbsShvUPA 0rzd9AG9pzf5uOfJT3kjNlGaxsSHHHnRC0s5yKYxnqZXllINr93bnWy5jdjJAkDH1MOv 59NvKBugp3Y+HOOygOMQ7ExDQNtnQHmqpsQwH0fnnBowrIbkXvFzYKlcMy6gbC6Te4Qd 3rkSzm7fuEtcojp2u679YQoKU6IBdA25NTaen1hEH3c0l6s5SwHhHsNH8NLbk2V4To8o oGNw== 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=GufoDHfjYxZ3FYh1AK2uby8vthRBQr9IHhcQ3lafcZ8=; b=uKP8DnsUUUPh3m/q6Uw6lUHiuzMiLGzOFvPXuBsYN1n7JUPqIggtJq18xyml+skWMY ggPt52o8/Rbp4SoTOYCslEnuRF9y/ncy8PkEEQ4nO9iqS/T4pY9HQc9Ju+BjUreoO8rQ Ml5U9VZ2aZgK5D5zeRClB0VUraXTKp8KsrVup/BfzNLfSAUtmYoPsuyIgxc5a7Y1aMbi /qXIWi8+wKdqWsRlz+0p8Mhbooft9DK2HCRjS5fdkfK2QUddOGOKKZwq7XJEEoxAYJug G9Vnvuz563L7PvJxmJqZpXDpGLqAaHCPKlk8vN3pAW9Ww8Nr55XVmB/KTkNu38RRaAJ8 1fGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=myKrsgi7; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 9si16952826yba.173.2021.12.20.12.30.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 20 Dec 2021 12:30:36 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=myKrsgi7; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:50028 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mzPIp-0002Op-RR for patch@linaro.org; Mon, 20 Dec 2021 15:30:35 -0500 Received: from eggs.gnu.org ([209.51.188.92]:44308) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mzPDe-0001fZ-PM for qemu-devel@nongnu.org; Mon, 20 Dec 2021 15:25:14 -0500 Received: from [2607:f8b0:4864:20::42e] (port=41921 helo=mail-pf1-x42e.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mzPDV-0006zf-Pw for qemu-devel@nongnu.org; Mon, 20 Dec 2021 15:25:07 -0500 Received: by mail-pf1-x42e.google.com with SMTP id m1so8641098pfk.8 for ; Mon, 20 Dec 2021 12:25:05 -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=GufoDHfjYxZ3FYh1AK2uby8vthRBQr9IHhcQ3lafcZ8=; b=myKrsgi7Wg0sqO2sBruzK68hxRyEF1ev8Luc1X6vfCCABcEO27yVLZlJ08LKLdcwod dp9bsTadqRGm4uxpJ5czfArphqsfg7jeGxZoAMZc4wX7KqprfhptcYPqZNad5Q5vNQ+G AvLHnVCmM7cOWGNYgBWM4XuidO3FXaSEpx74b9qHoZ2fkkauC2JFi5cQHoXxiHDgSwGL BLsJ3F/bXEwHfCml39q3vwSLkZ0NXzW4L9ivPulKbnCLR79nmvS270zylRhW28FYFm42 I+j+Kp2qX8YWUFIrKshekM8nS7CkGl/uO7V2TYWfJd+goWxun3h3veX0yVEHf37PgqUA leHA== 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=GufoDHfjYxZ3FYh1AK2uby8vthRBQr9IHhcQ3lafcZ8=; b=oxJQe0cR3QGCOzHZeQRSGcA2+PazkSrq3H9Cj82xmE/RuJLwIBWAvhZObtM+PhT10W KzxwfTt2F7PsKuDKDEQEidspmNEpXYBRYampgbtoKTZNoR8ZjmGfYQC1oM0hSkL30OGE ZI0LtAjocIOy8m4r7oitgqsai67RiT+UGa61FXFbpWzMyhHnOz5FnutntQTr0PWtw3Be FyJpSkY1//3LPfl5ut67rcwyI0W8UPKcD3+vcdqylmw98GkrO/djFpTGWJzl92PJUyWX ZH96EZ0TEwTReqv6sIOC21v0VClkOaK7eZsJYeJckGiYF8dwzCtfb3E9sesJljuZyWQg FptQ== X-Gm-Message-State: AOAM53326a12OfoU1/wU5AJEt2hVNBCFiW1+h32CiFhIHak34QwiIoB4 U4hnEG74NfeYyKFPo3CwBBz2lW9Ivk6VmQ== X-Received: by 2002:a63:6806:: with SMTP id d6mr16439210pgc.68.1640031904460; Mon, 20 Dec 2021 12:25:04 -0800 (PST) Received: from localhost.localdomain ([156.19.246.20]) by smtp.gmail.com with ESMTPSA id q19sm233118pjd.21.2021.12.20.12.25.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Dec 2021 12:25:04 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 02/15] linux-user: Move syscall error detection into safe_syscall_base Date: Mon, 20 Dec 2021 12:24:47 -0800 Message-Id: <20211220202500.111897-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211220202500.111897-1-richard.henderson@linaro.org> References: <20211220202500.111897-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::42e (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::42e; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42e.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, 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: Warner Losh 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. Reviewed-by: Warner Losh Signed-off-by: Richard Henderson --- 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 | 24 +++++++------- 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, 147 insertions(+), 87 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 4b57440585..3a640cfc04 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 @@ -71,21 +68,22 @@ safe_syscall_start: /* if signal_pending is non-zero, don't do the call */ lwz 12, 0(14) cmpwi 0, 12, 0 - bne- 0f + bne- 2f 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 */ - neg 3, 3 + ld 14, 16(1) /* restore r14 */ + bso- 1f 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 +2: ld 14, 16(1) /* restore r14 */ + 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 Mon Dec 20 20:24:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 526055 Delivered-To: patch@linaro.org Received: by 2002:a05:6e04:2287:0:0:0:0 with SMTP id bl7csp4423127imb; Mon, 20 Dec 2021 12:28:48 -0800 (PST) X-Google-Smtp-Source: ABdhPJw8+lXt1Jz5ADO0fU2W+YCujXGIKSxu6AJo/Na5uuClyNRbqLgxMnS8cPf+hlToHKX7oxZ7 X-Received: by 2002:a05:6902:561:: with SMTP id a1mr26094698ybt.240.1640032128641; Mon, 20 Dec 2021 12:28:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1640032128; cv=none; d=google.com; s=arc-20160816; b=S56ualIAeOqv2wpg9VPsWrHqkyULLeUaF7s23OfbscYlmEWyFzHZYzo5f71gJ8wjfj E/EdFD/YjVvVeJnHW5rsl6FrY75wD7zmRrJCM8jP3EyqFuzu5LfFK/mcAs+jxSwhaoII w78YSOqdzO6iCanqqhg1l1Xd5kC0o6PND2VBwoip3KmsBBzTwk4wrwSkTjTGsezikPso k1/DbZmTVvYDf1MCBPHnbMIjzyYO84hh+FyPBztBLL0+7pVMMmqKbJcKWjVqGxTgi/D3 7X5xRZ65nFNGacQamJRq1fUj2/K0YI3VoHXM4TmlVhYx7IkV/HnaUsYcXoz1ljZS4XBa Kwcw== 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=8fpxAyMyVNl+CmSBxFw2EondzEXrJSlZxjaKGpCYVGY=; b=wKLnUgsxPcLxKfHZ4e4ollQJGGFFByVKwm9jJKxYbPpAIxmuip4CLSlQnljoDycjkR LARxrkBQyJlj9953RU/LHYT7a3JQZ6z+2Cjb3jxn5VISiyMj+M4OYA/hLPC/LME9Uoup 492e/w1Uud8IVRg/9asJUAr6Vyd983p0Zkhyzke+VXFWSH/Av1zb1uBq8HS4QYN8rkkK jIodUSaSZXZm9XCZSJrYAKg8qmD362lrM8y9wMiRMpDHXrWU6Xs7MWSQKToZJNj4jh1z qOs6Y5wajzP/VDD2AQOrr27ZR0A6O0DTgX7hyV+9B2EkiB4ZnGa1zqLtWo6xcnXGsU7x hBdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=MHzNLKb+; 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 o3si25807181ybu.413.2021.12.20.12.28.48 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 20 Dec 2021 12:28: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=MHzNLKb+; 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]:43822 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mzPH6-0006ft-4U for patch@linaro.org; Mon, 20 Dec 2021 15:28:48 -0500 Received: from eggs.gnu.org ([209.51.188.92]:44310) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mzPDe-0001fa-PO for qemu-devel@nongnu.org; Mon, 20 Dec 2021 15:25:14 -0500 Received: from [2607:f8b0:4864:20::436] (port=34480 helo=mail-pf1-x436.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mzPDW-0006zm-K6 for qemu-devel@nongnu.org; Mon, 20 Dec 2021 15:25:08 -0500 Received: by mail-pf1-x436.google.com with SMTP id c2so9693442pfc.1 for ; Mon, 20 Dec 2021 12:25: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=8fpxAyMyVNl+CmSBxFw2EondzEXrJSlZxjaKGpCYVGY=; b=MHzNLKb+2HdQAyjzVHeDctJOrHtzXlSQ2VofPdhIhOjJaIFBi1CUnZZ2eiu0+dZhUW KtsLKm4d1fLfcg9DCKVxZRCFC/6RLsO+sVxquG86UqEFr70f/anMRJyYwC3c6ZhQVCxj uhPuKqqRR9l+zk8SgcPzIwvx3owYbEv/r749uzeMwu04/X8/crY2RGS30V3GVz+2ycKf NL0WAvh8LutLy4ob7xq4EQI6BD0KqhsslnN5Hyb6Scron7u6jVhdlgv0Jd7vP3JSCtbX vTFeyWygkTFwDUDT8+aEnOZKnPSMAJ9mylNmL2ufLCuxn77p65zig+2K+O0jFwRHrMlm hkfw== 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=8fpxAyMyVNl+CmSBxFw2EondzEXrJSlZxjaKGpCYVGY=; b=v9axodgbsdvsG7QpKagP6DfR6V/3wkHz67FfWRFfCvlQBzk+S6R7d2Qiz4RCvBYAc6 DAcwwEjWAUUj3EhkXvRnMJ3wMetnnzHvWNZgyG9vVojs6V9ax1wdNnajc28R6fNGkarG cf9GVueRL2pe1F285RgPy1AveLlA99K2+5l9pNiuiYltIH5TpOzOrRrlPIEhEyERH7uW /HU4mLI7dH98xUXcKuDvk+pCQ+99H5UYC6mg1kY/3wnqJBH5laqvnjQBpcStdwviXjZG X8vAIVVQa9tE3/b7xu03VTw9GKI/e4SDmcHNEvZgeb4nJwfsvRm1kPWxBELvVIO1eu/T JQhA== X-Gm-Message-State: AOAM5322hWZPI3TdJ8vTWMKEF/lxVAeFciNLNq1bBuTKD8ww3Up/IFu6 Lsa8cplocFTSexFKCQFVxpQM/c92OU1Reg== X-Received: by 2002:a05:6a00:2401:b0:4a8:909:1d01 with SMTP id z1-20020a056a00240100b004a809091d01mr17727147pfh.83.1640031905339; Mon, 20 Dec 2021 12:25:05 -0800 (PST) Received: from localhost.localdomain ([156.19.246.20]) by smtp.gmail.com with ESMTPSA id q19sm233118pjd.21.2021.12.20.12.25.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Dec 2021 12:25:05 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 03/15] linux-user/host/mips: Add safe-syscall.inc.S Date: Mon, 20 Dec 2021 12:24:48 -0800 Message-Id: <20211220202500.111897-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211220202500.111897-1-richard.henderson@linaro.org> References: <20211220202500.111897-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::436 (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::436; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x436.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, 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: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Warner Losh Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Reviewed-by: Warner Losh Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- linux-user/host/mips/hostdep.h | 3 + linux-user/host/mips/safe-syscall.inc.S | 148 ++++++++++++++++++++++++ 2 files changed, 151 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..041d1a6e65 --- /dev/null +++ b/linux-user/host/mips/safe-syscall.inc.S @@ -0,0 +1,148 @@ +/* + * 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'). + */ + +#if _MIPS_SIM == _ABIO32 +/* 8 * 4 = 32 for outgoing parameters; 1 * 4 for s0 save; 1 * 4 for align. */ +#define FRAME 40 +#define OFS_S0 32 +#else +/* 1 * 8 for s0 save; 1 * 8 for align. */ +#define FRAME 16 +#define OFS_S0 0 +#endif + + +NESTED(safe_syscall_base, FRAME, ra) + .cfi_startproc + PTR_ADDIU sp, sp, -FRAME + .cfi_adjust_cfa_offset FRAME + REG_S s0, OFS_S0(sp) + .cfi_rel_offset s0, OFS_S0 +#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 s0, a0 /* signal_pending pointer */ + move v0, a1 /* syscall number */ + move a0, a2 /* syscall arguments */ + move a1, a3 + lw a2, FRAME+16(sp) + lw a3, FRAME+20(sp) + lw t4, FRAME+24(sp) + lw t5, FRAME+28(sp) + lw t6, FRAME+32(sp) + lw t7, FRAME+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 s0, 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(s0) + bnez t1, 2f + syscall +safe_syscall_end: + + /* code path for having successfully executed the syscall */ + REG_L s0, OFS_S0(sp) + PTR_ADDIU sp, sp, FRAME + .cfi_remember_state + .cfi_adjust_cfa_offset -FRAME + .cfi_restore s0 + bnez a3, 1f + jr ra + .cfi_restore_state + + /* code path when we didn't execute the syscall */ +2: REG_L s0, OFS_S0(sp) + PTR_ADDIU sp, sp, FRAME + .cfi_adjust_cfa_offset -FRAME + .cfi_restore s0 + 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 Mon Dec 20 20:24: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: 526054 Delivered-To: patch@linaro.org Received: by 2002:a05:6e04:2287:0:0:0:0 with SMTP id bl7csp4422039imb; Mon, 20 Dec 2021 12:26:48 -0800 (PST) X-Google-Smtp-Source: ABdhPJy9dswCR4SlcDczxJFPvQYp+8FhmRF8YPZDITPeE4eMPPtd8Ps/sKdGqzZo1FIYFaNf0vCI X-Received: by 2002:a92:ca91:: with SMTP id t17mr8614786ilo.33.1640032008417; Mon, 20 Dec 2021 12:26:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1640032008; cv=none; d=google.com; s=arc-20160816; b=JUJpsHmGqYcdCTFhsfKVD3ncVb7x9EzHYJMRByLwlAPD7lcX+cgBDm+9fJhxVJx3Ou PoaK2xXa+yLmxG9eBKCewSRC5YqeBjQd1pjusjTZZoHIsd0PtFpU9QW+ONiee3tRCbWc 17VedkkcUFv59X1q80BhBDdnXMD8N5VdmzU9q+sRVzcfexJSOpNTO8lmyfxsXms+hdgJ XV1JvDV3cwdcpCQuUaZ89L0VS6AmAcu1XKtGbHITwQt1LoCGd/evbfouMcUrkM2rvMPk Icar8Xuk/C8lJRDzrgrryLfyZ61iw3pHGuC8w/NY2bk4q8Flc0VXzi34+R4T61HskIDi CffQ== 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=0Ij3KpROxLC8dtK7aIvTpcOO8V/yzRNnTNXtooq2NSs=; b=ENqpblLibfdQvTpBIjYXd2FWAtppnsMG8o7L0q0GYw5VPcDdA8ZH6gkK/Q/nGbekN5 1SCTIbXbQKslkxGhWmCROwTdFCQNHwgh9BZVqlJIC3JgXa2dBK01nbJvqQrbyBScmNy1 qSFw/tflGWyQMYLgiUpGYWfMqFwpS6c6SXvW3RJLMbll2KpZnnd49kfufxAxIn4e8yy2 IXA2bOLEQ3JlZ+A8MgFPh0yRHAHtIZSYZsgLW0ladXluLptBT+XC0dDp1SAQAhxTfGPx ynee+MXXgi2YVxHcFbsj8LOYRnHOIy7Cf1XCWu0E5AQqY+uXtHuTsL/R+f95LjlAuZl6 57SA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jzlkNKQE; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id x8si7373860ila.170.2021.12.20.12.26.48 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 20 Dec 2021 12:26: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=pass header.i=@linaro.org header.s=google header.b=jzlkNKQE; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:36746 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mzPF9-0001gi-TP for patch@linaro.org; Mon, 20 Dec 2021 15:26:47 -0500 Received: from eggs.gnu.org ([209.51.188.92]:44306) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mzPDe-0001fY-SI for qemu-devel@nongnu.org; Mon, 20 Dec 2021 15:25:15 -0500 Received: from [2607:f8b0:4864:20::42e] (port=42873 helo=mail-pf1-x42e.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mzPDX-0006zw-Bf for qemu-devel@nongnu.org; Mon, 20 Dec 2021 15:25:09 -0500 Received: by mail-pf1-x42e.google.com with SMTP id t19so3393820pfg.9 for ; Mon, 20 Dec 2021 12:25: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=0Ij3KpROxLC8dtK7aIvTpcOO8V/yzRNnTNXtooq2NSs=; b=jzlkNKQErIHVxlwRHnlBOfoMsT3ttJDGtY1KP7fOap/thxnXd9RYNZ3VqI5N6g5bAm OfmNdzAMTrzXNyuIIeHQKqLjEse/wSLEWpZ+nFqxu97lCFqjsu8o2hoDdfQEv0H8eOlV GRX8Cfhad/5HrIOqVb3CReJbV40iCXO+4IY7uZfcPWv1fiQ68EJqnFqulftRbbUq1gDh t+87AV57G5PZ3wU4y8SmP5zn3y9wDqcR0rRCk6Hv/1bU5PC044P9Jz8Zg+DGQh03gtsZ uqPENlNMbgFes9cBH8Hy+oSfybRbf2rK1ELe4HUhzCwBY2AAbx7J0zRj+ZWRWB/8MC94 fe0w== 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=0Ij3KpROxLC8dtK7aIvTpcOO8V/yzRNnTNXtooq2NSs=; b=ojeizySKt6SHLGcjUCB8ZmDkjOyfroE+zUM35u6AZDvA7Yh/WD/E1CBfTcKbXuwDK2 GnQajpOB4QH3GCA6kDMPxPPajajgbcdIaDMK4scVF0Uu3PvOsThFnBcHGGLcc5OHnS52 ZpdTjW+JS1HuTauI8q3czLmbWzVRBgWIcKx0YPrnVPsjOHqrdwSx3ndoVo34tYiMSstf lgxul+RQKdV6RIzOA3uisi9DdnEgKstBqDLHaVm7ggOe8DIn2hTI6HS0LOeHgmo5r3zJ ftgdqQkXD58TZG/f8lDZA0hp/2NQyIMDoE4xL8LQblEdJy1+3NjJgshTReHUt6SdxKXW Klyw== X-Gm-Message-State: AOAM531HQFrIv2xbGppqdUTqdbQbFeKF5L51GKh8K9d89wH/wBToT9UM HU2jeNeCmGO0UqiXARCEodEajKZRWbFNMg== X-Received: by 2002:a63:701b:: with SMTP id l27mr16235615pgc.241.1640031906032; Mon, 20 Dec 2021 12:25:06 -0800 (PST) Received: from localhost.localdomain ([156.19.246.20]) by smtp.gmail.com with ESMTPSA id q19sm233118pjd.21.2021.12.20.12.25.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Dec 2021 12:25:05 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 04/15] linux-user/host/sparc64: Add safe-syscall.inc.S Date: Mon, 20 Dec 2021 12:24:49 -0800 Message-Id: <20211220202500.111897-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211220202500.111897-1-richard.henderson@linaro.org> References: <20211220202500.111897-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::42e (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::42e; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42e.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, 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: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Reviewed-by: Philippe Mathieu-Daudé 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..901db15959 --- /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 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. + */ + + .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 Mon Dec 20 20:24: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: 526064 Delivered-To: patch@linaro.org Received: by 2002:a05:6e04:2287:0:0:0:0 with SMTP id bl7csp4428105imb; Mon, 20 Dec 2021 12:35:57 -0800 (PST) X-Google-Smtp-Source: ABdhPJzYjXa7ejwKeaOeRq9agh9RPH1tt5xB4NePpjxlFf9Csbtm58ZlL/DvKJCnyIfOzqfg7SRQ X-Received: by 2002:a05:6902:1103:: with SMTP id o3mr27157566ybu.139.1640032556938; Mon, 20 Dec 2021 12:35:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1640032556; cv=none; d=google.com; s=arc-20160816; b=Bj7QIOZJ9Doy0wu19uS8BNj6q+IudqrCdPqZI3VdcorcFIhuu428yqvkqrKC7VtLxN bGgdkrMN8nB4OQEnTRtWQPUWf7ZSv0bgsuuGWoml7kiNZWBLh6dDu0qy0ftkbuBqd0JU 62yIAvbDUzWKrUAgwUjDl1HYbBAiWkulC4Hbx+yB/PjNJ5oMZz/Uags6mKEDfP5OCdNq sCRq+sMHnA2rYqRT3vC6RSEA8KHgx/DAzjRwUW8Q0/mMTBi8ife2bJVCKinMPwR0M3Ln mCGsMI5mA0DzEEjgjULLNP1vCSrd7zpgmDkXewiXkt8nk6vCKrJXDrnmFXEO17iq+qrV 2thQ== 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=uywoYiNrSNWko9LKtxwQeBOxPl/+yLKDMkapXHZnHKx7c9WGdPnw3hHiVJdmof0eUt XKEx3wznbJ3/NgknJNr3bppGQWP1UppdeZCJbGdl2X3DH2zDK7quTgWtPCzlgxNgDF+1 0xcDoMtpA4u/PPYvv0EhcyCp2EJ0sI5X3NZB9+j/D4qTBNh3WZo5AJGObWWvbveXks5L 7OzLeR8zPFkob4xgbCvQP/SizOwDfkssENRQDxSoV2dJRUtSk0btJfa4RsLdj2UPsbrt 2oLtSfXuyWIlSkyukOH6IKpugcTr/IGuK5dlMnJdYEbk8tEc9jzcZsYevvY58Ter0TDw HBUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=xJiwb3W2; 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 6si18523576ybu.832.2021.12.20.12.35.56 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 20 Dec 2021 12:35:56 -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=xJiwb3W2; 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]:34122 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mzPO0-0002yH-Dc for patch@linaro.org; Mon, 20 Dec 2021 15:35:56 -0500 Received: from eggs.gnu.org ([209.51.188.92]:44404) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mzPDi-0001he-Aw for qemu-devel@nongnu.org; Mon, 20 Dec 2021 15:25:18 -0500 Received: from [2607:f8b0:4864:20::42a] (port=38485 helo=mail-pf1-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 1mzPDe-000700-DX for qemu-devel@nongnu.org; Mon, 20 Dec 2021 15:25:16 -0500 Received: by mail-pf1-x42a.google.com with SMTP id b22so4940891pfb.5 for ; Mon, 20 Dec 2021 12:25: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=RxRUdWmNOzFbW06/oXjlpc/Ha36TYqwiBWfJ/9yrr1M=; b=xJiwb3W2a0J0zV2ty+7j8Ja8XIaqhrte8haNAs2urr1Lf9LleRMc8Xjw+f6h/SbgTq GL6px9OefaARi8aVxwcnX5bo2ZDCRGeeuO2U9QtWURQf0vU7m7T5USqW5Wumi8dmZzmc iDTzFSjosQpGAh/iSzpFTyakXGodabxRrASnofH6pzdwOqiWfRQWYZau5GbP0AmIMuFB J7gfwMpyW4olK6ViBlEe+41UdKc5nVHhQ/exYZxdgUSsWhGEkHwQW/2aIuFrB47KUQUb l44CrEvUOeJ2AegcVEA6szGPCAJ1T33Tu10J/mmeALLxicdf+S5uYEr8N1Rew5QD2qGd qJcA== 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=67niUufNuGlXZiYfOr5DiVGIUGus+r1EN8GLwxHekeczgcW50wnsWdURk4caUdT7xJ JnkiuXZBqfhcA9fyE7QZjsAvN7JZA7qDfgZkxuCyUk6UjevC1V99Zn2wt+Wlaae//itw ivUNpyfpEzpfa79Ze+ESg3/7Njnj/vybF5oI6ICPzJ2XU92MM5DOv3BMJlO4PmzTtFi9 VVu96bQWmj88nqOd/AdYmp5Z1yImumIIOENxo6vJkHBJbx/InfJGpDQGV3R4RChUnw0C iahH/tnRy9uPZ1lP8HhQBHc4WXfYnF5SZTr/vXXM4cDnQ4qh6pl0jbmX2CmAZhLeE1Fr ru2A== X-Gm-Message-State: AOAM5334Q6IjcSaO9StuKJm0ET2Cbozovhiblgg764cao3Ai8HRBiw8z 7POeYG84Rq1wT9Rd5gUfyTLHtRAqbseMrg== X-Received: by 2002:aa7:9114:0:b0:4b0:7c1:cf97 with SMTP id 20-20020aa79114000000b004b007c1cf97mr18085380pfh.50.1640031906852; Mon, 20 Dec 2021 12:25:06 -0800 (PST) Received: from localhost.localdomain ([156.19.246.20]) by smtp.gmail.com with ESMTPSA id q19sm233118pjd.21.2021.12.20.12.25.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Dec 2021 12:25:06 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 05/15] linux-user: Remove HAVE_SAFE_SYSCALL and hostdep.h Date: Mon, 20 Dec 2021 12:24:50 -0800 Message-Id: <20211220202500.111897-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211220202500.111897-1-richard.henderson@linaro.org> References: <20211220202500.111897-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::42a (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::42a; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-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, 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: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Warner Losh 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 Mon Dec 20 20:24: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: 526060 Delivered-To: patch@linaro.org Received: by 2002:a05:6e04:2287:0:0:0:0 with SMTP id bl7csp4424360imb; Mon, 20 Dec 2021 12:30:45 -0800 (PST) X-Google-Smtp-Source: ABdhPJxElSrwL/QtLF7W3hdDcYKUnq8fMUwDJTLs3Lht3ciRwIZ0n6ydrs+9godGXyJw8v2NzyHz X-Received: by 2002:a5d:9650:: with SMTP id d16mr9154350ios.15.1640032245410; Mon, 20 Dec 2021 12:30:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1640032245; cv=none; d=google.com; s=arc-20160816; b=R/HR1ckQTvG0V7hqjKqHL1mixaeHOhzSMWQ59HO7UjxlJxHqlh1yzU53M0aT8PRwRx /84SgcY003D0kOSkg43EX9dt/2b+HQtfWfMIKdhwIz5lNtVJK+4hbBXoizk6uOIa/PPN xIb8bwFdjSKuJTGMFzn9DexUM+5LxXGVzHzRT8o28k2MwV/gTXrv+yEDhP1j7XjjAO7d Bt98JcBKu7nc/sNnmZrFNEFxPJNNEuPJtiEQAnVPTPvh3cTr+VGfi6yWdLWNY/lkm9mW 2v6kcJPXs5nJGBArLQvRpZHHvwWqusfpI8bkrIps6PrG2CZ008sCq2Rn/ymAb6wZtENu jT8A== 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=I88xgR/bhuJqIqF155cD5NONlWRg2dTyXLOBU5CjDXM=; b=z/SeeNXGwFt40vCH/KQVvfpugMs/5+w+lBlc83w+tVG7F+h73EqhBDsS4bT5VSvAft iJa7ckKrbhj3f9JvNPbm55OshHOBLWyJdBDHh9T9I3zynyT0NUP/J7lMLh0SWUUxarjQ pUxZzJZ2a+4lloQ04CL2wHj8QiThMYUEbENlx2f6k5TlT7zR0Iol6Col6C4vLNQsWp3K 1afzoUzWmkVcutX9vFTDE26yWfSylsUd/29nMnoVQ4CWP0n1kzYrqgxsq7w7ZXsdUDqG 0F5+XBoeB3luCF9PKFtzyki7idfJ5OR4VVaRXvfYxFDd2BM1Td8e+9y4N3gG15R8E/Yo p9Mg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=ev1ocKPV; 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 r18si9718751ilg.51.2021.12.20.12.30.45 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 20 Dec 2021 12:30:45 -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=ev1ocKPV; 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]:50508 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mzPIy-0002jL-Qa for patch@linaro.org; Mon, 20 Dec 2021 15:30:44 -0500 Received: from eggs.gnu.org ([209.51.188.92]:44394) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mzPDi-0001hY-9n for qemu-devel@nongnu.org; Mon, 20 Dec 2021 15:25:18 -0500 Received: from [2607:f8b0:4864:20::534] (port=37493 helo=mail-pg1-x534.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mzPDe-000709-Dn for qemu-devel@nongnu.org; Mon, 20 Dec 2021 15:25:16 -0500 Received: by mail-pg1-x534.google.com with SMTP id a23so10349705pgm.4 for ; Mon, 20 Dec 2021 12:25:08 -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=I88xgR/bhuJqIqF155cD5NONlWRg2dTyXLOBU5CjDXM=; b=ev1ocKPVTiZ7nfS0oWOQXpwf+ckrJ4tNEOf1pSzJi0kU09MJPsJwkWwxKHRJVG98Xm UhRj9fi6qlUmpwscfhjSCoA6AylsglawpiE3qIe6pcfLcAOVyfrM4PIeI5J8aBU7dGR3 55kT/9myVChXSJViJ+t9qAdoSd9VHGyh5+BEeZng5N5CBCQXTv+8RLoZVZ1fZOkP2ybL j/AwTm2WCiIjuKtu9+bAK8bAxLl4Pwh5SvrMd/ixXNhLNjYSueVEphOPzXUkXa12FH0D bZ56fmd1TsOqodkFQ8ywOYt47DgrqtJGdvPLdXBm/sQmDvSU1ZPpC86MZkFsOJPQKquc aDHg== 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=I88xgR/bhuJqIqF155cD5NONlWRg2dTyXLOBU5CjDXM=; b=p+OHaQ9rZbVn4wYUxtENhrib4np+uXACLvmA2XMKAlP0jHOp8SwzCSn/i4FZAvlXc0 wiTuH+wsgHw+mJ12dF+eN0Kz1SvfL72eLbedvFN/qKr7/JHorfxUqur8XyldE7E5IDMe zkqpNz9H6AqNVY9rzQ8AG27VUa9IC38Na7cfpB2hzLEzp/rYUflk7qfqNnL5XJfLuOIc QS0pe/zZK9VQDfmQ2iQLEsSFyKfF5wz3mk50nR6rjU+oqF97gRxr6Ayd3gtoo9f7cjnp vGRsEKBhQpTi5eo9T/JZi2UokMA80GDowxElS2hIhIcYvVLsSvCfj3MQYgoZ14UO7nqv Evvw== X-Gm-Message-State: AOAM531dNaEvoxnR0lAFDrnrZv18P4g6coqY5J7QvQv4tSY1Pyh/WZh1 fzYOau5pMDL7TldTGYgwSSLq3I5oD1Jcfw== X-Received: by 2002:a63:dc0a:: with SMTP id s10mr16216809pgg.187.1640031907750; Mon, 20 Dec 2021 12:25:07 -0800 (PST) Received: from localhost.localdomain ([156.19.246.20]) by smtp.gmail.com with ESMTPSA id q19sm233118pjd.21.2021.12.20.12.25.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Dec 2021 12:25:07 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 06/15] linux-user: Rename TARGET_ERESTARTSYS to QEMU_ERESTARTSYS Date: Mon, 20 Dec 2021 12:24:51 -0800 Message-Id: <20211220202500.111897-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211220202500.111897-1-richard.henderson@linaro.org> References: <20211220202500.111897-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::534 (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::534; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x534.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, 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: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Warner Losh 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 f9f3473288..ad9a8fdc25 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 e47f8348d5..108d755ce0 100644 --- a/linux-user/hexagon/cpu_loop.c +++ b/linux-user/hexagon/cpu_loop.c @@ -55,7 +55,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 041d1a6e65..e9362e774d 100644 --- a/linux-user/host/mips/safe-syscall.inc.S +++ b/linux-user/host/mips/safe-syscall.inc.S @@ -127,7 +127,7 @@ safe_syscall_end: PTR_ADDIU sp, sp, FRAME .cfi_adjust_cfa_offset -FRAME .cfi_restore s0 - li v0, TARGET_ERESTARTSYS + 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 3a640cfc04..69d3c70094 100644 --- a/linux-user/host/ppc64/safe-syscall.inc.S +++ b/linux-user/host/ppc64/safe-syscall.inc.S @@ -78,7 +78,7 @@ safe_syscall_end: /* code path when we didn't execute the syscall */ 2: ld 14, 16(1) /* restore r14 */ - addi 3, 0, TARGET_ERESTARTSYS + 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 901db15959..f4b3c0f9ae 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 Mon Dec 20 20:24:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 526053 Delivered-To: patch@linaro.org Received: by 2002:a05:6e04:2287:0:0:0:0 with SMTP id bl7csp4422041imb; Mon, 20 Dec 2021 12:26:48 -0800 (PST) X-Google-Smtp-Source: ABdhPJzsj1qleirOyc+3C0mhcdwIHl+GAKo20oXQ4cZmWaOmJmsluB93STexKR53ZRzgpviTJz8i X-Received: by 2002:a6b:f018:: with SMTP id w24mr9184401ioc.124.1640032008436; Mon, 20 Dec 2021 12:26:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1640032008; cv=none; d=google.com; s=arc-20160816; b=BowAvmnQ5YmCt/0yxdCwpTg1cqcbqMoRKlUg9RZT+lBBta6Vsi6FUejFna1Vem4DN+ sE/YOu5dD8PhhPBZQ3ftZ5jR8JhCGE5FWwZj4jlHFsdLkQASd0w2f1XX01IPQtb7RFdT lkat/Qk7TnkmbPc17BPi5U4lk3PLtBpC3ZBm1jCvHC+eMu4vAwaGRRexbPcpDuNXBIyD GhN4NonMrZMH/tovFFh0GakLS6AHGQOblJqI+T/Udso+BDI+xlh3gO6yGXx0H1rSubA1 oYC5zxQqIuy3kwLIgFlgX9/lU2OF6SHFhyduYGfOoQg8OFNhWnluiMjCIzwEzImsX4UY 5l8A== 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=fYTTahc1/FTqs7r6UAJwuLEIENbk9cJdkoTIy+6ykiDM5ooyXanBeTQdNbWYFfXJPJ nr5r144AFbpJzYJUt4A7qZxqZ+ZdKh33Yu6PZ4nl2yiI8Li49l/61pEZCtoitX+duLRx AQ6iY5pHy1WkaD896Gh6EgeTc8EJZ5zTqaMrH6tj8EgGCL9FqNUH96YJQFqfnKa/2+bA 4dmyjjLVXagZ55gIfCIay9oohu5DVPo4RAMihg7K0sL5GAile52ldu7jLVHwWkSXXfDE YWcnPEzmpBIyFaVSGhxAD5Yw1VfvMUib1SQ4BDFenk6dt1gejrQLDdP3I08kNw9bVQ5r SF3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=igydWZSO; 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 r9si13204091jad.71.2021.12.20.12.26.48 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 20 Dec 2021 12:26: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=igydWZSO; 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]:36882 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mzPF9-0001m3-VX for patch@linaro.org; Mon, 20 Dec 2021 15:26:47 -0500 Received: from eggs.gnu.org ([209.51.188.92]:44406) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mzPDi-0001hg-B1 for qemu-devel@nongnu.org; Mon, 20 Dec 2021 15:25:18 -0500 Received: from [2607:f8b0:4864:20::429] (port=41917 helo=mail-pf1-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 1mzPDe-00070E-E0 for qemu-devel@nongnu.org; Mon, 20 Dec 2021 15:25:17 -0500 Received: by mail-pf1-x429.google.com with SMTP id m1so8641239pfk.8 for ; Mon, 20 Dec 2021 12:25: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=TFNb/strBQB9hLaOeOMEOLWgIeKVijWjHGUQ12nJnAw=; b=igydWZSOj9B2sZrf0+9GvzkY2Hpwfh8INrFRQfg93CcbFptOI4KAQ5+5ZDi6J7B1Ix Zp+A0uL0xQtK/Exhw/dK2+tBDbh2tgu4QSumdSJb1gIplIDf39PZdNBaTW96WMk/TfIg SGE+mO4KrsnXpqqw55r0hu4m7BjsvYU6gDCJ8he92rUHwWs+CLrUvigD2cV2jKohbtNL aKCxM+jYPD5AmqJB8ryI5htcj0FIhza75kO5FFDSPt7RjlQVfCyKaiSoXdErGPV4iLu9 eKmJvZQWtQP4oXbcXDWRF00xfURZIuYoVOdjJungkNXzk0VTibJ4dKzYg4Q+5niyJf9g QZAw== 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=slnISpKEtLaNGrbLEFb7dCRQojy8G/MFwSRwaEics1F81xox/Y7tDsduDT/qycmUDs SD+M05m7KNXkGcYzjAkUykLoNSZm3PnsZazGPU2n5djdGOzrYHOWGk5zu7crprXJYlsQ 8zfboCTreT4GWn1WUNsHCQCYVaGLkf93ZmRgqiiISrlmgHWu6wKqZ2ZUzzyjVdY5xA5E RKivMB2b7h/DW9tdzPBm4j+bBHE4ElHiZJ7s92Ffvg6kN4SGuMuNgWEVbLqiXrejiHAB dkCg9PgdQMsaIH/UiyTwQaJrMUU8Fi06mDNmkiikucRzaVMrGT7LVIB4Qhs8cR5wrllU fHfQ== X-Gm-Message-State: AOAM531AAORZC1WCWYU3Ynxels41180rOizw9IH2iUZ4iTRzepYKcSpA tAIoD84BXwhtlYo60kS58JQ1e+Qs+lLG2g== X-Received: by 2002:a63:40c5:: with SMTP id n188mr2082025pga.118.1640031908620; Mon, 20 Dec 2021 12:25:08 -0800 (PST) Received: from localhost.localdomain ([156.19.246.20]) by smtp.gmail.com with ESMTPSA id q19sm233118pjd.21.2021.12.20.12.25.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Dec 2021 12:25:08 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 07/15] bsd-user: Rename TARGET_ERESTARTSYS to QEMU_ERESTARTSYS Date: Mon, 20 Dec 2021 12:24:52 -0800 Message-Id: <20211220202500.111897-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211220202500.111897-1-richard.henderson@linaro.org> References: <20211220202500.111897-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::429 (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::429; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-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, 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: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Warner Losh 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 Mon Dec 20 20:24:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 526056 Delivered-To: patch@linaro.org Received: by 2002:a05:6e04:2287:0:0:0:0 with SMTP id bl7csp4423157imb; Mon, 20 Dec 2021 12:28:51 -0800 (PST) X-Google-Smtp-Source: ABdhPJyP0Bw1UqSyvXivwyAxZpGVN218iJq7dRB1aXIk49C/c9ZeYON1qA05QziBK04/+w/VacIS X-Received: by 2002:a25:f826:: with SMTP id u38mr24311663ybd.535.1640032131736; Mon, 20 Dec 2021 12:28:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1640032131; cv=none; d=google.com; s=arc-20160816; b=XXyglR7tE5LROo2lW5mh3IpB3Q25Pv7ONTdCe3O0h8P/2mfXiGHqHZdnC4PHChUNtc uNVRpfgSZ2RpHZ+kbgMXXoiVVZRuHDi+u/Cx6yVOpjnJ6nTiqmR1UfVX3q2Bghga/18u BsbnNZ6/dZ61cPttIXrBgaHztFx0mBXGzGxSMHtKiJuNsoBOEv4NC97eZfnMa9upDaPC 1U39X8FE9WAv9/xSMmurVk5yKcmA7I+lAAZWGutWoehgzaIuAOiHntRA8GRE6QMyMQ25 54Fp94lMyl2Nlyb6BINywWpN37Pc9YFMez1DxOpMjQjwnD6vxI4K3uUr7j2JbeTmAmS6 pd5g== 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=+YjBMy7w0Bg0xbuI4bMShGvNBN/9ZCuSS/NSb7/ve74=; b=R2BBXRTiKzIAVZaoVttpx6itmEuHNU3hytmiZGFDIvQUYekhaUU3XCWfd5xMb+LIdy En9VBblnITlyyBGwObj/R7SMLIja9IVOzMN92p55IEJWoBniazjyZBGJW2tf34i9uSJj ZKwKjRCxHTg1TQJQ2Qic7EZLTD/pAyr7BfL125Qui6w9AfAucXyiuBE+9M8pLQgBrMND WrYRcnmWxCUT/utYxhmiY4H9rs/iwTNeESlmyW2WtEjQC26e1UhM9OtYAbbQaiOXY4Rq WOECYgcEK+q8mMuK4k3cPfvm+9Ep+4yID/G0T4yEeeLtVjk0SzN1u2bbRJLp7OqioIe4 o7YA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Q7zZsdCe; 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 67si16876827ybu.629.2021.12.20.12.28.51 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 20 Dec 2021 12:28:51 -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=Q7zZsdCe; 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]:43688 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mzPH9-0006a6-6H for patch@linaro.org; Mon, 20 Dec 2021 15:28:51 -0500 Received: from eggs.gnu.org ([209.51.188.92]:44440) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mzPDj-0001jI-8E for qemu-devel@nongnu.org; Mon, 20 Dec 2021 15:25:19 -0500 Received: from [2607:f8b0:4864:20::62e] (port=45968 helo=mail-pl1-x62e.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mzPDe-00070K-IC for qemu-devel@nongnu.org; Mon, 20 Dec 2021 15:25:18 -0500 Received: by mail-pl1-x62e.google.com with SMTP id w24so8944941ply.12 for ; Mon, 20 Dec 2021 12:25: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=+YjBMy7w0Bg0xbuI4bMShGvNBN/9ZCuSS/NSb7/ve74=; b=Q7zZsdCeu6p6EqxVM+yvp+sWPIWP5zYE5QCNdJuenXJUlswOlkAugoedtG9eYHzBbp jwtrD6sHVQjVRYgk7EaGD7/QiRLDa5lVWElmYLnv1TKvSJEND/np6Jfz9shqWRv+9nEY IEcsR8iE0cD2sswyUgJ5KJ14d1s/ndyVFgsgzJGaA+UcC21wwNMb2D3LJpSyEBkcqwFr Irfgfk3M2vyCGWyIU0mcjESKqGtAKlLFkw/7g46PACoMBYRLgL4CRkWQ3miMAeaCOAuO Qx6EM9S2iLZ2SMFjbHCwtgsNgVZY1pR/mhC7piooE7TVxh5JUsCKbnlTwSLApeXNaoeQ vfGQ== 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=+YjBMy7w0Bg0xbuI4bMShGvNBN/9ZCuSS/NSb7/ve74=; b=r1chQSqoe0f8+9ED9UTTbFHJSjkwmkAfo1Ys0IwdIP9KRIm0HtLwTVTV/rCTNomFLa 3eCKDia81LK5ZIt8FM9Zi0FAkqcRcaHjo3qnJVfCVKRJD479xC4Bgxn+PXKvR7bP7dMN G3egfRneeH95a0blv8kWD/xgeqRaZZXV9NhTPQjBCLKvzQ5Gy2GZbEiHTxTC502wdtab PVYuTKNwzJbHvHBDlpTpXjlJkLTSuoOfS87wnt61AHFh0PGK0KU+5178C5mwDEKBWGAv 1PxGYJIeBSeaPCFrUWvWOXECzFgNUcOMuMKKH1OkZGt1lKb/e9aDYJhc1nEqThu0oX46 On1Q== X-Gm-Message-State: AOAM530hOYmR31bbVyXfjd24ybswps8N9qQ4E9TzuB8EoCrHGJZ7HNQh nRH8gz7QAyNoJOakGUKnp24q2ziG8iJUxg== X-Received: by 2002:a17:90b:3145:: with SMTP id ip5mr824739pjb.94.1640031909481; Mon, 20 Dec 2021 12:25:09 -0800 (PST) Received: from localhost.localdomain ([156.19.246.20]) by smtp.gmail.com with ESMTPSA id q19sm233118pjd.21.2021.12.20.12.25.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Dec 2021 12:25:09 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 08/15] linux-user: Rename TARGET_QEMU_ESIGRETURN to QEMU_ESIGRETURN Date: Mon, 20 Dec 2021 12:24:53 -0800 Message-Id: <20211220202500.111897-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211220202500.111897-1-richard.henderson@linaro.org> References: <20211220202500.111897-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::62e (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::62e; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62e.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, 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: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Warner Losh 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 Reviewed-by: Philippe Mathieu-Daudé 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 ad9a8fdc25..1737e2ea65 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 108d755ce0..0d73934d31 100644 --- a/linux-user/hexagon/cpu_loop.c +++ b/linux-user/hexagon/cpu_loop.c @@ -57,7 +57,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 Mon Dec 20 20:24:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 526067 Delivered-To: patch@linaro.org Received: by 2002:a05:6e04:2287:0:0:0:0 with SMTP id bl7csp4431305imb; Mon, 20 Dec 2021 12:40:51 -0800 (PST) X-Google-Smtp-Source: ABdhPJw6ciEZ7pUdj52FrqoWlyM21grEo516e8+wTv2Jwib+WV/mrQ6v9Pu/AbVxPzru8SHH9sDM X-Received: by 2002:a05:6e02:545:: with SMTP id i5mr8868638ils.128.1640032851534; Mon, 20 Dec 2021 12:40:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1640032851; cv=none; d=google.com; s=arc-20160816; b=ZS5iU+SMQnGzqY1cGl7rV0zOQ5LfHas6h+DYZz+KdBbfuEXRVEflMteHxjJn4yq6Ew QEoXdX87AroYa1A1zY7jlsITrgmId/HOdkQbxycKIQG5K1PqCgw065y/kDiZZVeevuBF DdkBUBzMfQjbGrsgoPuL2WKOBSqUFqqtndhZxW70Cx30E9MGFgsL93WfR52deMOlVVR7 8W+LzEuYPYuShH3driAH12ZRsy27S7qIyJzEgY3b7KZ4AIqUnr5rD+irH6/F9Bh2owLd rCA9Tsd0prDE3fRRJsX0vwmbgShRi9sHKvgh5m9YF5rmQ9jbKbDHZiNZIeFTcYHUAyQW XN1A== 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=Gfvc6aI7WjYFeF9ly3kUangvwL6n6u92O4HwLhkZ27I=; b=eUdbZoElxGA9292IlyCLMnslcurMFolWekk7fN/CLUgoCVwLdQzronaw4vxydb0+06 CKfSLf4Pa3VESV+33tb/fgOO9Jhxzf0IvNSuWSqsg10fHgo1gYmoAbLN0dMywlrwZMHv PfEcUwDskIXH2e++H8XdgvwtGYq79vDDInRUxo6UT8mOLMMm++r+/iVXth2L7TEBtOgE QglSdWNB/FZNSleJjhcUTVdZ8F19Mfe6xyWi3w+a891njk8en3MkW9w8G2yEezyRA0Bj s58a+S8R/Ksyk2qXz1jeCYLFXO6FJYyZzYlItRKiqdoQn15MMrIROh9hUkVCC6IGWNfs elWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=hrLNstsH; 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 j10si12989167iow.47.2021.12.20.12.40.51 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 20 Dec 2021 12:40:51 -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=hrLNstsH; 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]:42386 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mzPSl-0000Ji-1o for patch@linaro.org; Mon, 20 Dec 2021 15:40:51 -0500 Received: from eggs.gnu.org ([209.51.188.92]:44444) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mzPDj-0001jQ-Bt for qemu-devel@nongnu.org; Mon, 20 Dec 2021 15:25:19 -0500 Received: from [2607:f8b0:4864:20::42f] (port=40505 helo=mail-pf1-x42f.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mzPDe-00070Q-JQ for qemu-devel@nongnu.org; Mon, 20 Dec 2021 15:25:19 -0500 Received: by mail-pf1-x42f.google.com with SMTP id z6so9709385pfe.7 for ; Mon, 20 Dec 2021 12:25:11 -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=Gfvc6aI7WjYFeF9ly3kUangvwL6n6u92O4HwLhkZ27I=; b=hrLNstsHeyDDusEe6C0qhRAaQCWvuURAR9TXeB6E1cUeXobRDme5bUjk/pTWT9x1uz mzuuv4z32C4mXNRTZCao0RVwtIiRAVw3lWtZKtWvoNpcLpzeTdeC2HLZI045xDz72EPi GBWz0J8WQXtLCBiXxM4UaCQIBxKYPgjlvaI7Gs+3lhYq1OQbm5b3/LB3HySDl1JKblJI iPsXac9wPyj/OmGaiU4gRryBJ+a8qCHGqkMedhB6b+Ad495emKO0h1up3WkUqv0YrKTW LZ0xNupjyMDT4VGeDuAC3QhEDCXbA1tJ9S/jIN3a7qhpKdrRRwLLCnbdvEAKv+3cN0X6 VelA== 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=Gfvc6aI7WjYFeF9ly3kUangvwL6n6u92O4HwLhkZ27I=; b=An4cWasUhgBc2GDCTSx+6KBm/Qse/Ks4RnhzD4frmkKKGqEfsn32WJ9T6man3awQ0i 9dUfpcxM11k8bYy+JQzfUrYEA3a+JkfGoQeGWdJqZpLvHRoreTop+75W6CyZ15bum0ka dNC1t6qwYnTbM7co32gR1cyH5mcxdVyJKwktoOpLcl6YZ6crF0YVKeceqzzZ2EvU6mUd Hg2eiGD2Kekv3RE7nDaLZCypx8G379QTvfq0COF9NWswbwBcRdZqzJ6lzH5g5wBHmb20 SaQ29nYZDHSFKUysXnPDWuJFApxy2x5FF6AgAx3lk33etgGOVmD3DpB/Q4yS3GW5rY+x wlog== X-Gm-Message-State: AOAM533LQFKntgf6L+CYuDHhViHYIBABBZOs+VnGrw/7fgecyZtSMOE2 t+ndXCqTZkYgknqmmZWf/2i1RysbL+wy6Q== X-Received: by 2002:a62:88c3:0:b0:4a2:b2d2:7082 with SMTP id l186-20020a6288c3000000b004a2b2d27082mr18102822pfd.48.1640031910246; Mon, 20 Dec 2021 12:25:10 -0800 (PST) Received: from localhost.localdomain ([156.19.246.20]) by smtp.gmail.com with ESMTPSA id q19sm233118pjd.21.2021.12.20.12.25.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Dec 2021 12:25:09 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 09/15] linux-user: Create special-errno.h Date: Mon, 20 Dec 2021 12:24:54 -0800 Message-Id: <20211220202500.111897-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211220202500.111897-1-richard.henderson@linaro.org> References: <20211220202500.111897-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::42f (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::42f; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42f.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, 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: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Warner Losh 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 Reviewed-by: Philippe Mathieu-Daudé 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 Mon Dec 20 20:24:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 526066 Delivered-To: patch@linaro.org Received: by 2002:a05:6e04:2287:0:0:0:0 with SMTP id bl7csp4429842imb; Mon, 20 Dec 2021 12:38:30 -0800 (PST) X-Google-Smtp-Source: ABdhPJybLnH8KGOBeya9NptCtlIZjiPEk8yo0NbUq5KuIB2H3zLroXfBFDIFMAFkximItGbTfX+N X-Received: by 2002:a25:c6c2:: with SMTP id k185mr25899199ybf.230.1640032710313; Mon, 20 Dec 2021 12:38:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1640032710; cv=none; d=google.com; s=arc-20160816; b=xud2dHmq5VUMtywiaSgtiIwfY0oEqCnyAUTRJfbDSdJYraOtBZj66h+cvmUBbhmsGx jO8nXWq8ydqvr2LstY4+2OryeprZZ8z1a7cRUgahFDC7cJQ7eBVg1Qc0hrt5EcBbi2yJ M0uRlgTBvx5iiY2G37qGOJ/V14M0zkBtADBa4Z9Dh69butC7CobyusYHeNmm/mMCduJj oTThEVlHrZUsUoZXhPgQPILD+gjO6HvUNxSj8vhqE1+Z+UQT6eQ2sU3voBn+49oy0na0 zSStq3+4NgFvwM+A8yojjtyv2+LJSsJoIXR+1Ryv3IAJxoCdT9cHyJGZib6mMDaDzjpt sH+w== 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=bypa977r/WSLdHMHGE0uu+vGdO4aiDcArSJh/3S9q6U=; b=g/HH2d7a9pEKoyltbrrEbIWp7mVfUuJjOCwaKhUlrrjLZWztvIO/CH6wny2XoPBHe5 KDGkk2/Co9GdqzGhZKq8QUXNzGpzZ3WFZwNsB+sguiFfGo9EI7EZBIiSTkGioQBsK4gI LVJ7cNkjPYMA0k3Q28eqVwNuj4sTfbm9IwkHWNRPxmI1PzxgIqApMBR6l59qLYuQ+Bxh RVhXLTaaIAjnCteDkSsw3WzWKbZdQWfAmPXdK26gNlSOyzy/GBbinbLz945ML+XBj4UJ tQdiHzyjgVf0gu71xhXBWNnHxhn4ku75fWoPaRxANNdbqzA6hKNh9zV+gYm2iwdQMneM gvDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=sP3av77y; 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 o9si19857840ybq.140.2021.12.20.12.38.30 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 20 Dec 2021 12:38: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=sP3av77y; 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]:38478 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mzPQT-000679-Sj for patch@linaro.org; Mon, 20 Dec 2021 15:38:29 -0500 Received: from eggs.gnu.org ([209.51.188.92]:44408) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mzPDi-0001hk-Cb for qemu-devel@nongnu.org; Mon, 20 Dec 2021 15:25:18 -0500 Received: from [2607:f8b0:4864:20::531] (port=46896 helo=mail-pg1-x531.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mzPDe-00070W-G8 for qemu-devel@nongnu.org; Mon, 20 Dec 2021 15:25:17 -0500 Received: by mail-pg1-x531.google.com with SMTP id r138so10329469pgr.13 for ; Mon, 20 Dec 2021 12:25:11 -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=bypa977r/WSLdHMHGE0uu+vGdO4aiDcArSJh/3S9q6U=; b=sP3av77yysr2sEoQ0AbFga6th3wsV0hosIKSiaDrlpujlBXCFJAT0fAKPjeKqnSmpz aLCmfyvdxYJjfHkz8f2J5fEMUSaePvCewWCMGJbS4G2spkya8eFeR2ilveTz3Pw3K2XO EjOuTydR68MrXRGrh30MVt/sRDd3QG0alfH9HOGuvmaeC8NYtZh0C+8VN04D/ygPcqVL BLuyrMlXdmZjd6w2DwAp0OnjqVdRaG2CVGMd6FQWyuzQHyBbk1E7QMxEon4dmMCtaeSP Ib/VGlslwkb+HXHXvDXlk5BgRT7dSKdgtk5YJp1mdSXACMPG+aZeOyuc+1QjIWyGl+BN QNUw== 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=bypa977r/WSLdHMHGE0uu+vGdO4aiDcArSJh/3S9q6U=; b=NIRo8geFZacEwGhQ9ca59SMRsZxJ7fuMzvVojOkqbdQtwB8tkMBCCQuq0OH30gg3SG 4HZ91q+xcHmQeKNoPM7o1EbIqNJOwe7tKEh5XNUlKj1uquUlT990F8xhX15DgXAQKXoJ 9yGdLZjcFljSy90a++QOhp3vQLMllbQRNUN/DmS3PpYLbJxrirwopYueJp+LG3BrSj+G E8Gq/x24icpmshs4KYQ0Q3SIvUZS8EwmfXr/Gv3tFNHhqeFl5er01RokgmE19LmKd3bf es0FQ+BwzVg0XLvf+FTL41WY4f1PZpSDTuTCJX4SxWvUyyrZCGTU71HYuSerugMjDqiF 9Odg== X-Gm-Message-State: AOAM531GBD1DTc7tMUyFfsBQocOKrnPjRRTTH3drdoVw8zgQnMiwwomE ezGQ8DAB7Weh6MK2NT5InLK0xrP6JKHZ7Q== X-Received: by 2002:a05:6a00:23d2:b0:4ba:e5e6:94f2 with SMTP id g18-20020a056a0023d200b004bae5e694f2mr6351046pfc.14.1640031911027; Mon, 20 Dec 2021 12:25:11 -0800 (PST) Received: from localhost.localdomain ([156.19.246.20]) by smtp.gmail.com with ESMTPSA id q19sm233118pjd.21.2021.12.20.12.25.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Dec 2021 12:25:10 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 10/15] bsd-user: Create special-errno.h Date: Mon, 20 Dec 2021 12:24:55 -0800 Message-Id: <20211220202500.111897-11-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211220202500.111897-1-richard.henderson@linaro.org> References: <20211220202500.111897-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::531 (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::531; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x531.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, 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: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Warner Losh 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 Reviewed-by: Philippe Mathieu-Daudé 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 Mon Dec 20 20:24:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 526065 Delivered-To: patch@linaro.org Received: by 2002:a05:6e04:2287:0:0:0:0 with SMTP id bl7csp4429576imb; Mon, 20 Dec 2021 12:38:02 -0800 (PST) X-Google-Smtp-Source: ABdhPJxozT/2Z2cWSKBeAIUL2hKCm0IlndMu2xU2OdIzXHr3IsAZqFzva2WZkcunsziRlizHM+uj X-Received: by 2002:a25:fc5:: with SMTP id 188mr24799303ybp.608.1640032682369; Mon, 20 Dec 2021 12:38:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1640032682; cv=none; d=google.com; s=arc-20160816; b=vGXN4C5aDJ6cd8dEbxlNLLnPpW9ksMY79EUbPUdehXHrnob6kMo+AkDx0N4xXyQ1jw OZ4TV4iUjAQeHLk690lYQ7XQS02s1cXIgrQDz7N0YDLqTg78t+TUU/HKgqtq2VtHbEZ8 tzwuGsTMrOv1yprvXDJ3tOAQhMpaTOtPgnx2i3ywhnwAGXFyCx7SgH+VK1xGW9cestkF pjMN8ujIpxEl4/lUtsuqI9iYCmlYCYPEs/1uTTWleNK94+sF7C7dmslcy+vX3oODlDTW XyKYAsucB3Supda9jh9jH5+yskQeicpfziIqJR0W7dlTjG2xISBoFlcR5+rkWr8dBLOj ovww== 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=zzB27zc9DRkTvMYzzTgHtA9L6gIU2P2EOiXNkMnHgz4=; b=W0+cLPe2sPn3cSlxqW5a4w20oLBUvzY3rpvzO9jlffwwszYp2VZuGMQGTVFdwBZkoZ kji3GBsLhobzrAXlWkhy0tjAhTf7hUgGjpU/FAvQ98yVnxV+cquNXqKqS/WRYkF7TTvk OmlbDN/M1OIcMP+dI3/rXc4MZlyqnYtSzrUt9WhCruAIqXmmd8tE4kG+8Hz13Oqm7tf4 zPymJpZW5jvYA3S0aeem1AkOddTfjhcZeDKSpoRRYLqUdIJnZ7jRFt0WkYIGE5M1vh1R X3yDV1L9mojMJ5jqlVPxtgg25RZcXeD5YhauhS6qlryV/mUEj6nhIt1yEFkUj7JZV77s M7yQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=ztKe2nBv; 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 r13si20792018ybk.372.2021.12.20.12.38.02 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 20 Dec 2021 12:38:02 -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=ztKe2nBv; 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]:37286 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mzPQ1-0005GB-RX for patch@linaro.org; Mon, 20 Dec 2021 15:38:01 -0500 Received: from eggs.gnu.org ([209.51.188.92]:44462) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mzPDl-0001kO-1H for qemu-devel@nongnu.org; Mon, 20 Dec 2021 15:25:21 -0500 Received: from [2607:f8b0:4864:20::52b] (port=33574 helo=mail-pg1-x52b.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mzPDe-00070a-JS for qemu-devel@nongnu.org; Mon, 20 Dec 2021 15:25:20 -0500 Received: by mail-pg1-x52b.google.com with SMTP id f125so10394232pgc.0 for ; Mon, 20 Dec 2021 12:25: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=zzB27zc9DRkTvMYzzTgHtA9L6gIU2P2EOiXNkMnHgz4=; b=ztKe2nBvQiTvFL2RNJTAFoeFfUAuDWwAZ+GopLeXUa7eDhkD8sdmm25CV5m+71NZv+ b2zReFDu9aE2XEFC24Tcdn741w0c92+ALCW+OQzIqCUfpu6MpA5hBH3OWfIZh+UdKCOV F9EJ3ml+Jmu76QWGmnfoCgjdhILYWD13biev4HLxawOsJONHJA/mAooa/jsZUzUWPf5d S3bXTXJe9tytLB9dm9nWVXSlOTcJiiRs+Tsf7Vkocr92PrGIdqcSVgODiCdhrOuy7dr4 XIQOeGyd81RLxs0MWdaoinU4PdWe1JTwqqrURnbN+Xcu78UcedYyLLHNXCoVJl0zdPjb JtdA== 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=zzB27zc9DRkTvMYzzTgHtA9L6gIU2P2EOiXNkMnHgz4=; b=fl41CgUw+BvpPaVCzLArxsMRfZp+nedrGumHwDfgV9qu8offcPW9w+UD4ZLfxzcvLj Nob52mJFsjiuR2GxaT3JQ0RfB+sw7RUXTk7nt8KoHswDJwVD2QWcO+zFKdZbL4n3rfqT nzYpA8QItAQEP2LZ3pFPM+pD2XSOcvtey+Q8EhZVe0gQGkNvDisUMxowFIyABFYDp5nb Rv7tVA6JHVZ6ALiTO17zK66xD749KPBYC1s+JlOklcrXBrfRl7eyIVGXX0cUJoOCGovG VJAHlOCcwbmipcyQ1khNOgY7vFRfjw/dCeDZ4WQ2krOxxvGJn5rgEkXnQpkGvWKyclTY 5/HQ== X-Gm-Message-State: AOAM5334FWgwkomk0NteoXi/qjsQz/t0UFRrXkJUfZbeNE3nUmAq8J6r zrGBHNhSDTkY+Ei9yne9YBwo19Nnz/vWfg== X-Received: by 2002:a62:2503:0:b0:4a2:b772:25ac with SMTP id l3-20020a622503000000b004a2b77225acmr17723721pfl.53.1640031912011; Mon, 20 Dec 2021 12:25:12 -0800 (PST) Received: from localhost.localdomain ([156.19.246.20]) by smtp.gmail.com with ESMTPSA id q19sm233118pjd.21.2021.12.20.12.25.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Dec 2021 12:25:11 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 11/15] common-user: Move safe-syscall.* from linux-user Date: Mon, 20 Dec 2021 12:24:56 -0800 Message-Id: <20211220202500.111897-12-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211220202500.111897-1-richard.henderson@linaro.org> References: <20211220202500.111897-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::52b (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::52b; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52b.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, 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: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Warner Losh 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 Reviewed-by: Philippe Mathieu-Daudé 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 (98%) 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 2495360fd0..4e0a8033f7 100644 --- a/meson.build +++ b/meson.build @@ -2378,6 +2378,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() @@ -2622,15 +2623,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 9a8d1bdf72..be8fc57538 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -3079,6 +3079,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 e9362e774d..fc75a337d1 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 98% rename from linux-user/host/ppc64/safe-syscall.inc.S rename to common-user/host/ppc64/safe-syscall.inc.S index 69d3c70094..947a850dfd 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 f4b3c0f9ae..a2f2b9c967 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 Linaro, 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..5cb42bc664 --- /dev/null +++ b/common-user/meson.build @@ -0,0 +1,6 @@ +common_user_inc += include_directories('host/' / 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..eef1dd68bd 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/' / 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 Mon Dec 20 20:24:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 526062 Delivered-To: patch@linaro.org Received: by 2002:a05:6e04:2287:0:0:0:0 with SMTP id bl7csp4427177imb; Mon, 20 Dec 2021 12:34:42 -0800 (PST) X-Google-Smtp-Source: ABdhPJxZS2QvHlAmD1pgc5+cDdPatsfbZLxPLBGbWzC60Er8jZrj8v3PRSC+zGYAPluSNirrU9rG X-Received: by 2002:a05:6214:23c8:: with SMTP id hr8mr14849875qvb.79.1640032482886; Mon, 20 Dec 2021 12:34:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1640032482; cv=none; d=google.com; s=arc-20160816; b=JXrDPNjYE2JWFciaF2vd7s6klYwyXUge5HWmc/TH+6SjK+KaxL+TG5mx45VSU72guH MC+fw4a5nT/01VDMtlTOcqvagCxi1LdwLPmR/QmklbRondvtyBdEZeLIdu9Lw8FxV4wr BgcM6x50m3Xn1RZFiUZeQImfVELlNvLjgqSiYcmGGacrqzu0eNxwNtjnUQZGEhERViWj A5GpudN9c05SteFj+veg28+NMEnYWKrbiiVqqtTClEiiSIK/3Ae8YR+yIYpE02uiGHN/ 8G4I7A1Wo7FloS9iR3G2enaD82rl43OcgSOUtDK5bnB5B4a7Efwq9K4guKoSWHolZf6h FYnw== 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=zHGWGwjr0Ugpl5pO0K/qLHZ6SlPgsyTFOQjkA3y3SdDxSq+uysFLj6sNE1KCBb0zgn 1u2gtMp5PaYC7u35UsF5FOSKIlG+l17juWZB49CU8tLig5VgKTULqNKjveuq5eIATVHt +2DGcvFZg3MV5zQyrUFwGm1FeOGD7van8ESK2dsffpWiaCTJ7PoxFnHM4uutRXXutBH7 w3Jc3DYJ4w4VNq8ry8+ytWUJjpEaHwziEfY35ExHW/mO+PWmvWab6MgxDOmZRy04srlR rvOXr6KMPKCC9qAP+Bui/1pahdgcgPQskgDfwMlYX4Gl4NBCtsUQvHvRZPX1B9T8cjqA p0AA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WKNqGYJO; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id j11si7670974qta.239.2021.12.20.12.34.42 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 20 Dec 2021 12:34: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=pass header.i=@linaro.org header.s=google header.b=WKNqGYJO; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:58120 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mzPMo-0008OG-BY for patch@linaro.org; Mon, 20 Dec 2021 15:34:42 -0500 Received: from eggs.gnu.org ([209.51.188.92]:44400) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mzPDi-0001hd-An for qemu-devel@nongnu.org; Mon, 20 Dec 2021 15:25:18 -0500 Received: from [2607:f8b0:4864:20::431] (port=38492 helo=mail-pf1-x431.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mzPDe-00070e-HA for qemu-devel@nongnu.org; Mon, 20 Dec 2021 15:25:17 -0500 Received: by mail-pf1-x431.google.com with SMTP id b22so4941100pfb.5 for ; Mon, 20 Dec 2021 12:25: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=eT2OMMtgUWRlyX31jrb7FBHkLkGN7+LrqX+ZG1ZjPS0=; b=WKNqGYJOwE+MHykF/LPnqx1AVKQjddRdjPlSwV7BHvdcC7JUFEjNGYBmR+gN+gCI/s vcZkspcLTHM7YoS6eqBKjlDD+2hzrHiSGmquxaNk9jYX7CGTdWWeMMD7KmHPyFfQ/Y5/ 3KCbh74KmXK1Uu76y06d5jM3HsU7BH2puree68KyA1iXnglKBOaz2AtZx9oixInIr6W+ 3qRBZ1cn8HwmOhUqAlT1K3QODLJ/U/zoYRSI9T6rMV53yx/ps9FlQLSWzlQIqLeTbvub yCFvZWPCvkFmZ18hW/CZQJ3BVUQhP+I/uy6864R+MRRH/4ipIUcfxB8vyK42NZMagk6r EXyw== 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=KvUgnFOiLXYupDduY0yHXcRhNY2mhWnzJZPqBCGm2NHG+iE5sdRhgzhF2Ytgz8nTJQ d2O/crMFMxgluPmvkWE9XeMaC2pDi3Azv/vGkQrPbhS7LfkSGwgxwpVYwiSuH/hy4Hg5 XMMUTbUsNLcUiPFJHqPkU7JLBGLfl51leSwp9jGX3wgg67GJOWnuG6fDN1qSGyLWia4U CcB20AlhhafEaeuqDErwPDxI7CSZub+KZ/ujk6NXYLL9N4CTsHTBC+E6533Xp2VAd5DP LNkOAXav6201pS38Q+rEThi/pG1yIpMDoUZCPA3zQKUyaJDG1K9Rv+Bo8/FwL9W++z8o xgSQ== X-Gm-Message-State: AOAM531zKcCvbrEWDyJmPhBhkzzas4fOYmVkSmpOB0VL4mlcK6sWG4ia vH3HfuSojLHUhtV27McAgu7wKNwbQUaE5w== X-Received: by 2002:a62:d10f:0:b0:4b1:3bd6:533 with SMTP id z15-20020a62d10f000000b004b13bd60533mr2101810pfg.8.1640031912711; Mon, 20 Dec 2021 12:25:12 -0800 (PST) Received: from localhost.localdomain ([156.19.246.20]) by smtp.gmail.com with ESMTPSA id q19sm233118pjd.21.2021.12.20.12.25.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Dec 2021 12:25:12 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 12/15] common-user: Adjust system call return on FreeBSD Date: Mon, 20 Dec 2021 12:24:57 -0800 Message-Id: <20211220202500.111897-13-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211220202500.111897-1-richard.henderson@linaro.org> References: <20211220202500.111897-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::431 (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::431; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x431.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, 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: Warner Losh 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 Mon Dec 20 20:24:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 526063 Delivered-To: patch@linaro.org Received: by 2002:a05:6e04:2287:0:0:0:0 with SMTP id bl7csp4427885imb; Mon, 20 Dec 2021 12:35:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJxFtSS9VDTVU05IVAewDu+rYLRugF7HRtjYAWCNTndqezGVXMoCS5wn8BTEtrj+exFzTl/c X-Received: by 2002:a05:6e02:110f:: with SMTP id u15mr9012968ilk.140.1640032538495; Mon, 20 Dec 2021 12:35:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1640032538; cv=none; d=google.com; s=arc-20160816; b=Pg6kOJwaOmtLo80UInmwWCJiCERvcR1Fl7R5x5ltUwXvIalZmhPpC+kAdSnfTF+e/m 4fay4HTWYiRj/lTE2WanMZfxtr9wcMh5QaW/+Nsnv38cfV+kPAH6NWxZbAD6+MGulUNK CwDsxyxYK+AVPO92vtZaWST8+M1vF22AgEIJATwwyK2QwePwKV5TRorOx5D66HIGGvVW EovXLQzSVRfc7KqIuv0Le3OuGUDkff9Mh6zO42eLkorekWxP/4XzdkLpb025mEsIPkd+ kEXK+eElehp2+gKkYSesYTr4WlrWEYv2h71k3pTxHb8MMt3d35UsTChsMK0HFQPn15FT dbwg== 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=s/pA8V+yNrBMZnuZyz1KWKoRUi8x+EMLOwcwdtIndmA=; b=0qlYHOiM5zyFpV3FPRdJG5f6k9FrEwZdQSD+hXDdoq0feWYHRALlORKfHNZ6ZOasl0 ZJlD+Agx0izuSPihuFGf/QCs3neSl4GHdzgZsfD+3RP0S1QqQUuU2qhTmehxS0H64VnG reSoGlIG1A4ry16AEk4eDdiamR8j+MAI2LUk41xzsJViccAqdIf9muDC/g1zTEZ+Zrq4 gxa0X5eT1qQ4G5byV9n3LbWegXq+dwuSLM2ZpxMuL4i+mP+4URu59KhLq1TQ9LOMnBJG Q65t+UEw39yYxQiEjAEwsn9L7LEFbDc5MnyYTtkr17XAKhzqYsqXdvZhL8tvAaM3Czvk 7oPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=rzNwS6j4; 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 y18si6265633jat.66.2021.12.20.12.35.38 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 20 Dec 2021 12:35:38 -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=rzNwS6j4; 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]:33054 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mzPNh-0002C2-VT for patch@linaro.org; Mon, 20 Dec 2021 15:35:37 -0500 Received: from eggs.gnu.org ([209.51.188.92]:44446) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mzPDj-0001jT-C7 for qemu-devel@nongnu.org; Mon, 20 Dec 2021 15:25:20 -0500 Received: from [2607:f8b0:4864:20::102b] (port=53228 helo=mail-pj1-x102b.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mzPDe-00070x-S2 for qemu-devel@nongnu.org; Mon, 20 Dec 2021 15:25:19 -0500 Received: by mail-pj1-x102b.google.com with SMTP id co15so10443330pjb.2 for ; Mon, 20 Dec 2021 12:25:14 -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=s/pA8V+yNrBMZnuZyz1KWKoRUi8x+EMLOwcwdtIndmA=; b=rzNwS6j4lpysmyIaAFcsaQzVY4vbOsbolvBTijrKAOXllyMIsL6x4UhQtN4+lEzjOu mMecqXu1Ncv7dvHmiMchJVRgK0GJT7xhOjIlcVcA/AQ+H04K++YyakvQkYhNGu3fyYIn b3dDJsD0V/pzIfWEPSPeMtQFPAhxJEiWg4Kf6WunQv4w+bl4UsZww1jQIDuw8PuDJ40z UgtuNI67ooYxi9YPclfQWPgg/1aCp+Ru9OQchwB478uSPpRqD6k2FrjLGaX3XHU3os5I pPBhfhwXa4OYTF3WiDj0k/3jM7/NLggzzLbICwSa3I+soxVEQsHKppG9ujwJNPa7FU8w DOOA== 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=s/pA8V+yNrBMZnuZyz1KWKoRUi8x+EMLOwcwdtIndmA=; b=ZHu1nM98n/Xb1Y/KW2dVpzICnRIQ49kEAClIbFSh+J4FnU7myaFUsm/TZfAGRVnETg ICAvx80KJ7py5JS4PhH+ic8YtPQGUCT+wq6Img4SzvQJ9elNmoaWrZiYpWvpQPlzKibx jtLLL4KPHTH9A4arQ3XLDjhzscRg9Eo+IcRF4798z7lD8Xu4KUZiECSd/qCpl8T7i5Vi UFmxotTRZHqQJUl7RLUlxNsHwt7fITTikNchSyNhVYdCeHJBFXL71tK2aBJwPxKVSLhR NZKPKz+TAESSYqX8fot9rDJwieUm3tfmCTG2RtEAqf6aGqvIRbbGbeMtDizs3y2IPlmv +MVw== X-Gm-Message-State: AOAM532+pTwrQHRIdant8uoRqWwtZC+Ebe02uWjpE36aD0YQw/lkoiKf Hy2N0wvPeK7Dr6PqIhdLHsC3RUvHMwFExQ== X-Received: by 2002:a17:90b:1b43:: with SMTP id nv3mr785498pjb.93.1640031913471; Mon, 20 Dec 2021 12:25:13 -0800 (PST) Received: from localhost.localdomain ([156.19.246.20]) by smtp.gmail.com with ESMTPSA id q19sm233118pjd.21.2021.12.20.12.25.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Dec 2021 12:25:13 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 13/15] linux-user: Move thunk.c from top-level Date: Mon, 20 Dec 2021 12:24:58 -0800 Message-Id: <20211220202500.111897-14-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211220202500.111897-1-richard.henderson@linaro.org> References: <20211220202500.111897-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::102b (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::102b; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102b.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, 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: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Warner Losh 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 4e0a8033f7..eebeaab9ce 100644 --- a/meson.build +++ b/meson.build @@ -2633,7 +2633,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 be8fc57538..1de6ce6e44 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -3077,7 +3077,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 eef1dd68bd..ca8b86f209 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 Mon Dec 20 20:24: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: 526059 Delivered-To: patch@linaro.org Received: by 2002:a05:6e04:2287:0:0:0:0 with SMTP id bl7csp4424318imb; Mon, 20 Dec 2021 12:30:42 -0800 (PST) X-Google-Smtp-Source: ABdhPJzezrPoOQ7yob3AgdehOQ8AnP7j9QFtVhv2hAIo7vlst3Tt0tU3TvQpmeKq3pFcRQTcE87B X-Received: by 2002:a05:620a:318d:: with SMTP id bi13mr10806635qkb.279.1640032242460; Mon, 20 Dec 2021 12:30:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1640032242; cv=none; d=google.com; s=arc-20160816; b=XDiWZ8yyXQU6JTwoxgFGGy8TDeukX+AI0Tk2gTE/Qs7e5lVJj0iJLMKPJ95QWOlJ9j BAqCJlm3Hm0TYbzZxR5/ryP3lGY2BOPFL0Q3Pp5YTCfxC9tw1HkmNdRgNAbLXPE3OK0o 2SxuhZfGUEUbra+WFPbCnwunJej/FdMGkTKZhegy/s8886/s20VnKF1i2DLkq1fEgbof gKnOq0Jrdf8yZtj4yanoRwOWnYzHzFj0Bw0gNBMbq0ShWEdvvZHjD2j7umhnIUVYOnKD cf5nJkOuHbfV6217I8u921pPu7Pp6CPuttvmaz2NbvbYVWlBUxaq9CVIo+RMi43VfAc0 MVXw== 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=fyndVhlQb13TDZ3esc1S9oqyuqQXnQYXlc770BtW8OY=; b=NhtxBrKBJ2LGyIhb8+TJqWceukxKk4TVYf1ho7T4Y+gX/pEvzsRZNbo9jzz7EjYduZ avxy1ZM9+0OuDpe0H7R6MDtVlsGxhtNFs7w2rtEnMeH3KdXiWmpVAF6zuj5W70Q+ec07 s1BzgITw3iFC0MdSdy0aAyj2htV1kxXjsPBxxtCwcKwpmKKdBW0rbCl2L2QCwtEc57zn 15IKvQy7s0GD+0DMHW60NAMCtS433B95xZV0ijO3JO3pSKdk9np5nLpnxxjOczfSHvtn OlUiCyldaj3EsQnVVXX6aOB+CL33qyLB5m2oJ/hfkK/K/+xkhFyO2AOwVkb6Aj5XNKaR UjKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=cPTQvpMJ; 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 p12si6951798qtw.300.2021.12.20.12.30.42 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 20 Dec 2021 12:30: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=cPTQvpMJ; 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]:50374 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mzPIv-0002dN-Ur for patch@linaro.org; Mon, 20 Dec 2021 15:30:41 -0500 Received: from eggs.gnu.org ([209.51.188.92]:44452) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mzPDj-0001ji-F6 for qemu-devel@nongnu.org; Mon, 20 Dec 2021 15:25:20 -0500 Received: from [2607:f8b0:4864:20::535] (port=42689 helo=mail-pg1-x535.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mzPDg-000722-1d for qemu-devel@nongnu.org; Mon, 20 Dec 2021 15:25:19 -0500 Received: by mail-pg1-x535.google.com with SMTP id g2so7773061pgo.9 for ; Mon, 20 Dec 2021 12:25: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=fyndVhlQb13TDZ3esc1S9oqyuqQXnQYXlc770BtW8OY=; b=cPTQvpMJJHcmhTTuf8m2m0W0gg6pweDn1YFCy8kwDo7yLFhX9peQS1RBDosUWQQBDC YfwUebS25aRnjYkoYF4hKRuJTIX+HuqzktQtfaq/p8BYF+mMq2R3tkeIwpKJ45HZZ3n1 KII8NtlwQ5r+V/J30wQzf5Te3CptMt2WdLyKhyOpfwOnesk7sL17FFL6HZ+nQ3Kgm93K 1Jx7wrFWxumfYPjF8Pfo9k9I1MV+3k/CkXjmFgXDagh12vbLfUUACuJFYMZuM1eggyjW 1jqOcJ8Z1wEUkEPQRhZxat4GLJ7sicQmrHP0cefN3uU8UTA3N7r4W90Ej7JVa+jjWnEK Dd4A== 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=fyndVhlQb13TDZ3esc1S9oqyuqQXnQYXlc770BtW8OY=; b=qz2EbWJ78mlTlEtYoaKLQKMhr9q9LFLSWgw4vaA/v1d1FtNWM5AIRsA35+Mjxp4Nmr baTp7WaEZj35bcq2k9mZROXAiOnOQjo+rJpVpWoIrqx52p2LmcmbwXrRHrwHz+qt+4i4 YbguGlDgCGAHG9BCm18xqp2LAoeo9D1gAwYDWg3oplxE2gcEnQpmMuwZG9ByiK+nKEvv w+YcX4F+kdd8MU7zFHkwqkoEQp0LuFEYa8tLYfA7M6cASHxbV0nfer3fqqyssKVogbEZ jTFst4bb0D8LL4fbW68H+LXOQrBcNjiSymXDnhPakpavnUunLYXr5VO8lHYO0F4yzkqj keFQ== X-Gm-Message-State: AOAM530erLhD9vz88CFZZ/4GBwfkdmmC5CbNHlDgU82UP5N4OOy8UnHb V2sARrv8CBPALZy9l3ftfz/+zAFjzQvHgw== X-Received: by 2002:a63:2b05:: with SMTP id r5mr16412301pgr.0.1640031914332; Mon, 20 Dec 2021 12:25:14 -0800 (PST) Received: from localhost.localdomain ([156.19.246.20]) by smtp.gmail.com with ESMTPSA id q19sm233118pjd.21.2021.12.20.12.25.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Dec 2021 12:25:14 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 14/15] meson: Move linux_user_ss to linux-user/ Date: Mon, 20 Dec 2021 12:24:59 -0800 Message-Id: <20211220202500.111897-15-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211220202500.111897-1-richard.henderson@linaro.org> References: <20211220202500.111897-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::535 (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::535; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x535.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, 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: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Warner Losh 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 Reviewed-by: Philippe Mathieu-Daudé 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 eebeaab9ce..cc4df68b20 100644 --- a/meson.build +++ b/meson.build @@ -2382,7 +2382,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() @@ -2633,8 +2632,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 ca8b86f209..b2f4afd5e7 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/' / 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 Mon Dec 20 20:25:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 526061 Delivered-To: patch@linaro.org Received: by 2002:a05:6e04:2287:0:0:0:0 with SMTP id bl7csp4426912imb; Mon, 20 Dec 2021 12:34:22 -0800 (PST) X-Google-Smtp-Source: ABdhPJxrcnv75XzeAywc3E90HJNM8H9qTFDy6InOw24UGAZBvaWikeLXLkIivxhHjtN/Xubvv33+ X-Received: by 2002:a25:fc24:: with SMTP id v36mr25898914ybd.588.1640032462159; Mon, 20 Dec 2021 12:34:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1640032462; cv=none; d=google.com; s=arc-20160816; b=nQEgq4SKK0mMy0N56uzVR1aYlp+jU+H3iQNvUpJpLXBdqnsIKPC+bSWjPrOE6TdMQD e1qZ3+YmJ4d7QS5fPbj9iDbsPp+tZEzCmjiVINuyTqZafImtwEtR4TZPinNB6alDiADw P8hSt4/e4duUYEkXZ0MhWEaPP3uO3ld7LiJXG5zuBvFEga8jTrPJE3NLiF+/mFj4L6ae kUU/N/3da+OtIixuDKXxIEw6/RfuD5QzaKezVyl5cjp3ljxvSnWClnctb2+qexuOq120 km3iIN1v01v9T0ocoEGZsoGgYNrr0DVFYqRmGRLaE7XD8JVpfhqmmsbN7DX/P1ug9PMW WuQA== 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=brtV571okmpgrnWIgKtPwoUNkykZ08GvD5KZnRkT83o=; b=MAViteCe8zBM8BVVGNB61I42TWJPgyFeA9CqWBVn35YBV3f65cb4T2hJOvrWaKajmZ ouGCxVLjSQkiwAYps9tDhQGqBIFaVuERfi7i/cG50sxmviAIg9UtY+7hFMjR6kpiiSvS UzbzihC+5NwqO4BJCI8bdpNd0jvxozF2MdB5MtZ9bOOxVFOqeQ01lcF2nFbYTmryi3ae tINhi2jL0WHM9oTGCIor4cAxPX9Uw6zvWV/KvfDw7hL+rJXQtonO7j4VCd76xVHVSAQw AB0u1B05hTGsha+jXV89yrSpfErlTK52h+cYaDU6+olEX/j0iCfMoUFVbVpYTjUNqxKe TSYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="QRFXt/6l"; 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 y77si19361786yby.385.2021.12.20.12.34.22 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 20 Dec 2021 12:34:22 -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="QRFXt/6l"; 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]:57026 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mzPMT-0007aB-MX for patch@linaro.org; Mon, 20 Dec 2021 15:34:21 -0500 Received: from eggs.gnu.org ([209.51.188.92]:44460) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mzPDk-0001kL-CU for qemu-devel@nongnu.org; Mon, 20 Dec 2021 15:25:21 -0500 Received: from [2607:f8b0:4864:20::633] (port=44613 helo=mail-pl1-x633.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mzPDh-00072U-UU for qemu-devel@nongnu.org; Mon, 20 Dec 2021 15:25:20 -0500 Received: by mail-pl1-x633.google.com with SMTP id q17so8956436plr.11 for ; Mon, 20 Dec 2021 12:25: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=brtV571okmpgrnWIgKtPwoUNkykZ08GvD5KZnRkT83o=; b=QRFXt/6lEnQxE8VY4h8HBmv4bZNx9bcpgBs+ctngXGorx2Gdn+lnYnbpq54WAw/lY4 Sn1KdPLYxJW2Hnp/rPT0A24VMlYa74jfVJsd0ZcGf2NqeUQihv8qcbN6QWl4GyPTq6TL 50BT7itMHTYh5uoLWxwVdssMTa1+xFH1aAchnmcQKaK4lLX306KrL2oxDBftYQuFl0Gz wnuqBGC2G1xBKPHxMLbWPR73+iFffiEtBxszq02FFdAwV7WPeM+ElKN869endBChy371 AG9JsGplMFYh/Zj/uVoZh9bZpNtiw7Nu91wJ5bdBhHy4nQTMKXGt041fNmReExspG4Cu nBgg== 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=brtV571okmpgrnWIgKtPwoUNkykZ08GvD5KZnRkT83o=; b=ozvwjvyffoKk4d447nHMJnRzRx3/I66CtnSTWLer6GW33IUFftWB3GvBD9tXL/nuOb mZp2yyvrpmg7+AX23jGnBPhd39+SkFtCGAOoC4EVrLmdl7bQEQd98lSXEwkoZm1WdK63 F3RoyyKOe4//UyMiygEdjZAhT4huGacF6JWavPi5EUR90+KPexVQZ2360xdEcOp5nOJJ j2yQ7GFWVVcDkJkHpLCvPopEpZx2rFHwq1b6SEfObVO2KxdS6gKwqu03oC7Tr8CQGsEG 66rYwnnWe+TA/Ur7lwkYvBDV7+/Y4/MCC9soH6GGhx1eKPaan4Es+28JTFt7+xusPuxK 2AYw== X-Gm-Message-State: AOAM531iRoyaL+xiWQifsVKKMLjAAp4x3fekERUtkeET1iUx6iby0Fdu 435dWUw2ABsRtLzvx7ZP/TpgHYkqP0x1vw== X-Received: by 2002:a17:90a:414b:: with SMTP id m11mr813587pjg.158.1640031915131; Mon, 20 Dec 2021 12:25:15 -0800 (PST) Received: from localhost.localdomain ([156.19.246.20]) by smtp.gmail.com with ESMTPSA id q19sm233118pjd.21.2021.12.20.12.25.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Dec 2021 12:25:14 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 15/15] meson: Move bsd_user_ss to bsd-user/ Date: Mon, 20 Dec 2021 12:25:00 -0800 Message-Id: <20211220202500.111897-16-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211220202500.111897-1-richard.henderson@linaro.org> References: <20211220202500.111897-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::633 (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::633; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x633.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, 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: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Warner Losh 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 cc4df68b20..f45ecf31bd 100644 --- a/meson.build +++ b/meson.build @@ -2375,7 +2375,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() @@ -2630,8 +2629,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)