From nobody Fri May 17 09:38:21 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1645895359929346.52340454130126; Sat, 26 Feb 2022 09:09:19 -0800 (PST) Received: from localhost ([::1]:33464 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nO0ZK-0002Kp-KH for importer@patchew.org; Sat, 26 Feb 2022 12:09:18 -0500 Received: from eggs.gnu.org ([209.51.188.92]:60378) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nO0XN-0008AM-Vo for qemu-devel@nongnu.org; Sat, 26 Feb 2022 12:07:17 -0500 Received: from [2607:f8b0:4864:20::136] (port=38825 helo=mail-il1-x136.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nO0XL-0000Ov-U4 for qemu-devel@nongnu.org; Sat, 26 Feb 2022 12:07:17 -0500 Received: by mail-il1-x136.google.com with SMTP id w4so6826799ilj.5 for ; Sat, 26 Feb 2022 09:07:14 -0800 (PST) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id e23-20020a6b5017000000b00635b8032d45sm3138764iob.22.2022.02.26.09.07.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 26 Feb 2022 09:07:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=KqQIGuilfSiZo5D0/DJJljqcgNhY6dZ6uWFUPpHnygI=; b=P6iml+wBzXG4jCIazXHsszGoiPpaOjf5AGyD5pFqKqn1vuLlPZ/gq5TKXG+TllM2KQ yePhp4VTL+jUWeUL9SQofTuT1Q8BNS/ndYKykCypW5TXGEMqqna9FYWVLqoqRp4HyW9D or89fzqdwOnXpwHI07Xn/pPqOkxM+hVfkoWGsEDHOkEF7foEZcPi2PdWAx/SV+lxGk2I Cnr4Pkq+jnoe0vIDpPrvgC1/7lsqorKElX3g/TQNsM6DKYzTJVaOtvV6EaRilGJQjFdL hXE3BaoX2PGuxAup6Fmu9tJRlcJtv/e86dO1bvJXceY8BX1fGKB4vDEspxAczwoZY4WW kCeg== 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=KqQIGuilfSiZo5D0/DJJljqcgNhY6dZ6uWFUPpHnygI=; b=jlWU0UsAkboXNAcl7mnJSFYFPO2FSsNV1X2QETT7RO+k0chaxFc8G7Qra9RsWkhHj7 fnaM7vxi8m75Pr05LSKamWcPRijM7MkrfdJmewdFUTkrp2dFDVI5tR/HqZQgpQvQpGQB YXNXRtIyPnoS68whbCiQWxYcnSyKSTmPIQcJznpx0NyA9PrbZk/fN0qWly+Bdmj3CG0G Olk/O1qbyg28HniBeJenV92exwXG+Lx3F9w/T1r5Kh2xf2fPP3APmujqXEuwUEIshRnn D5cNSElWEToMiGbNFFtByboQmewCqQFtsYlsJ82+W10Yk5uICqlQmmVw5xsdh35yBZSG TLpw== X-Gm-Message-State: AOAM531Yd3GDy4P0Pu6pXnMLdC0jNnDtjAMLY5TkWY5QzN84Ra1pbKki gdqE+hzriZSo4kUaPLdzEjvy+HExAMIOWQ== X-Google-Smtp-Source: ABdhPJzA2CS4S1at5N13ZeV5eZ5N8I0KVtqHQEN8aUWXmN3yFMGaY8fKqnr4IXmQaDdjRzpOuh2ggg== X-Received: by 2002:a05:6e02:180f:b0:2c2:6ad9:9eae with SMTP id a15-20020a056e02180f00b002c26ad99eaemr11694723ilv.0.1645895234095; Sat, 26 Feb 2022 09:07:14 -0800 (PST) From: Warner Losh To: qemu-devel@nongnu.org Subject: [PATCH v2 01/16] bsd-user/main.c: Drop syscall flavor arg -bsd Date: Sat, 26 Feb 2022 10:07:29 -0700 Message-Id: <20220226170744.76615-2-imp@bsdimp.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220226170744.76615-1-imp@bsdimp.com> References: <20220226170744.76615-1-imp@bsdimp.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::136 (failed) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: none client-ip=2607:f8b0:4864:20::136; envelope-from=imp@bsdimp.com; helo=mail-il1-x136.google.com X-Spam_score_int: -4 X-Spam_score: -0.5 X-Spam_bar: / X-Spam_report: (-0.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 , arrowd@FreeBSD.org, Kyle Evans , Richard Henderson , def@FreeBSD.org, jrtc27@FreeBSD.org, Warner Losh , Brad Smith Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1645895362577100001 Content-Type: text/plain; charset="utf-8" We've not realistically been able to actually run any bsd program on any other bsd program. They are too diverged to do this easily. The current code is setup to do it, but implementing it is hard. Stop pretending that we can do this. Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/main.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/bsd-user/main.c b/bsd-user/main.c index f1d58e905e7..bddb830e99b 100644 --- a/bsd-user/main.c +++ b/bsd-user/main.c @@ -164,7 +164,6 @@ static void usage(void) "-E var=3Dvalue sets/modifies targets environment variable= (s)\n" "-U var unsets targets environment variable(s)\n" "-B address set guest_base address to address\n" - "-bsd type select emulated BSD type FreeBSD/NetBSD/Open= BSD (default)\n" "\n" "Debug options:\n" "-d item1[,...] enable logging of specified items\n" @@ -392,17 +391,6 @@ int main(int argc, char **argv) have_guest_base =3D true; } else if (!strcmp(r, "drop-ld-preload")) { (void) envlist_unsetenv(envlist, "LD_PRELOAD"); - } else if (!strcmp(r, "bsd")) { - if (!strcasecmp(argv[optind], "freebsd")) { - bsd_type =3D target_freebsd; - } else if (!strcasecmp(argv[optind], "netbsd")) { - bsd_type =3D target_netbsd; - } else if (!strcasecmp(argv[optind], "openbsd")) { - bsd_type =3D target_openbsd; - } else { - usage(); - } - optind++; } else if (!strcmp(r, "seed")) { seed_optarg =3D optarg; } else if (!strcmp(r, "singlestep")) { --=20 2.33.1 From nobody Fri May 17 09:38:21 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1645895554718402.1484405411078; Sat, 26 Feb 2022 09:12:34 -0800 (PST) Received: from localhost ([::1]:41900 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nO0cT-00080V-E2 for importer@patchew.org; Sat, 26 Feb 2022 12:12:33 -0500 Received: from eggs.gnu.org ([209.51.188.92]:60396) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nO0XO-0008Ad-Ix for qemu-devel@nongnu.org; Sat, 26 Feb 2022 12:07:18 -0500 Received: from [2607:f8b0:4864:20::d34] (port=44714 helo=mail-io1-xd34.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nO0XM-0000P2-E0 for qemu-devel@nongnu.org; Sat, 26 Feb 2022 12:07:18 -0500 Received: by mail-io1-xd34.google.com with SMTP id h16so10147384iol.11 for ; Sat, 26 Feb 2022 09:07:16 -0800 (PST) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id e23-20020a6b5017000000b00635b8032d45sm3138764iob.22.2022.02.26.09.07.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 26 Feb 2022 09:07:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Ogh2FUndj4MIrU/iCsiac6cM3XenhFOByuX1UWjQajU=; b=QdAV35k3dEpHwl0UbI/EdisXfG4BGKbms09x2arWdhe0+MXc6aEU9ov/FjI8y2u6mO AFr55MPWKPp68gVz23cd/W/Y6tXhGjva9MnIuzb+IBEAFMeeLZb35bXI0bB+wUY5EGGw vrVJAOUI229My6K9JqbCHkFtfuV2SXkonb6gXbOgiaTizYNm56wY061BerzM94cbV9Lt wFVA0fhKXgv6bejaplvvDvCVNr2hn4yqOYzF7sSmbLt7zXf0RbkvR9XMnok4saOgPZAS 4A/TgB0jxEeebEMM6Mj0WkyaNgQhvPuT86/XQlY/BnFAqcfRuzDwtKEMgMcvJqWMGZEM JS7Q== 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=Ogh2FUndj4MIrU/iCsiac6cM3XenhFOByuX1UWjQajU=; b=ODEc4Sup+MuU8ql67+evmtqLGfPv+JBy3s+rs2AGlES0IWNAD0XS1raY0NTJLZQ9ij 90siBencw5lN0t8IRrtFovzrzXw4osuIYF8qq7BBOUUyBQpNgg8DjR887WgemTt6M4bv swkA2qpXjn5juIPxydkX9bAkt66CbVkwcA9lAbuqvesRdYdraziBC5x+QUVqeQDAk1sl 1g2omPI46QeJq+SJ4clqbej52TUDQUxKoml0mUn+FDQ4GxoDTzHWvmJqjdWhGvgq5n/0 RCKTdNmW6vfSHfItlf6FdXx8nKHXvtvFqWI7cfwlNE7uWT6OjVveIsea4yA6Qegw5VFb LzpQ== X-Gm-Message-State: AOAM531PWNHfqPD6Hx1RJhj0p2eFwXOjrH3bQ2kQO2SKNK+LHA+XfkUd CPxh9wHzvePtWrW885F/623MArKqaH7rfQ== X-Google-Smtp-Source: ABdhPJzRrP8IVn0Jb6vKp1n/a6QYHDpoBiTMN/dCBJXJmoEwEPtdaLqZ9T58o+HVLeV40c+4uaqeIA== X-Received: by 2002:a5e:930c:0:b0:641:7453:fdb with SMTP id k12-20020a5e930c000000b0064174530fdbmr9356540iom.184.1645895234993; Sat, 26 Feb 2022 09:07:14 -0800 (PST) From: Warner Losh To: qemu-devel@nongnu.org Subject: [PATCH v2 02/16] bsd-user/x86_64/target_arch_cpu.h: int $80 never was a BSD system call on amd64 Date: Sat, 26 Feb 2022 10:07:30 -0700 Message-Id: <20220226170744.76615-3-imp@bsdimp.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220226170744.76615-1-imp@bsdimp.com> References: <20220226170744.76615-1-imp@bsdimp.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::d34 (failed) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: none client-ip=2607:f8b0:4864:20::d34; envelope-from=imp@bsdimp.com; helo=mail-io1-xd34.google.com X-Spam_score_int: -4 X-Spam_score: -0.5 X-Spam_bar: / X-Spam_report: (-0.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 , arrowd@FreeBSD.org, Kyle Evans , Richard Henderson , def@FreeBSD.org, jrtc27@FreeBSD.org, Warner Losh , Brad Smith Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1645895555632100001 Content-Type: text/plain; charset="utf-8" Although initial versions of NetBSD did use int $80, it was replaced by syscall before any releases. OpenBSD and FreeBSD always did syscall. Signed-off-by: Warner Losh Reviewed-by: Kyle Evans Reviewed-by: Richard Henderson --- bsd-user/x86_64/target_arch_cpu.h | 58 ------------------------------- 1 file changed, 58 deletions(-) diff --git a/bsd-user/x86_64/target_arch_cpu.h b/bsd-user/x86_64/target_arc= h_cpu.h index 0a9c0f08946..9dc52d5afc4 100644 --- a/bsd-user/x86_64/target_arch_cpu.h +++ b/bsd-user/x86_64/target_arch_cpu.h @@ -124,64 +124,6 @@ static inline void target_cpu_loop(CPUX86State *env) process_queued_cpu_work(cs); =20 switch (trapnr) { - case 0x80: - /* syscall from int $0x80 */ - if (bsd_type =3D=3D target_freebsd) { - abi_ulong params =3D (abi_ulong) env->regs[R_ESP] + - sizeof(int32_t); - int32_t syscall_nr =3D env->regs[R_EAX]; - int32_t arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8; - - if (syscall_nr =3D=3D TARGET_FREEBSD_NR_syscall) { - get_user_s32(syscall_nr, params); - params +=3D sizeof(int32_t); - } else if (syscall_nr =3D=3D TARGET_FREEBSD_NR___syscall) { - get_user_s32(syscall_nr, params); - params +=3D sizeof(int64_t); - } - get_user_s32(arg1, params); - params +=3D sizeof(int32_t); - get_user_s32(arg2, params); - params +=3D sizeof(int32_t); - get_user_s32(arg3, params); - params +=3D sizeof(int32_t); - get_user_s32(arg4, params); - params +=3D sizeof(int32_t); - get_user_s32(arg5, params); - params +=3D sizeof(int32_t); - get_user_s32(arg6, params); - params +=3D sizeof(int32_t); - get_user_s32(arg7, params); - params +=3D sizeof(int32_t); - get_user_s32(arg8, params); - env->regs[R_EAX] =3D do_freebsd_syscall(env, - syscall_nr, - arg1, - arg2, - arg3, - arg4, - arg5, - arg6, - arg7, - arg8); - } else { /* if (bsd_type =3D=3D target_openbsd) */ - env->regs[R_EAX] =3D do_openbsd_syscall(env, - env->regs[R_EAX], - env->regs[R_EBX], - env->regs[R_ECX], - env->regs[R_EDX], - env->regs[R_ESI], - env->regs[R_EDI], - env->regs[R_EBP]); - } - if (((abi_ulong)env->regs[R_EAX]) >=3D (abi_ulong)(-515)) { - env->regs[R_EAX] =3D -env->regs[R_EAX]; - env->eflags |=3D CC_C; - } else { - env->eflags &=3D ~CC_C; - } - break; - case EXCP_SYSCALL: /* syscall from syscall instruction */ if (bsd_type =3D=3D target_freebsd) { --=20 2.33.1 From nobody Fri May 17 09:38:21 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1645895370192513.877693903053; Sat, 26 Feb 2022 09:09:30 -0800 (PST) Received: from localhost ([::1]:33654 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nO0ZT-0002SI-RR for importer@patchew.org; Sat, 26 Feb 2022 12:09:27 -0500 Received: from eggs.gnu.org ([209.51.188.92]:60416) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nO0XP-0008B4-RH for qemu-devel@nongnu.org; Sat, 26 Feb 2022 12:07:19 -0500 Received: from [2607:f8b0:4864:20::136] (port=35464 helo=mail-il1-x136.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nO0XN-0000PE-3s for qemu-devel@nongnu.org; Sat, 26 Feb 2022 12:07:19 -0500 Received: by mail-il1-x136.google.com with SMTP id j5so6839986ila.2 for ; Sat, 26 Feb 2022 09:07:16 -0800 (PST) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id e23-20020a6b5017000000b00635b8032d45sm3138764iob.22.2022.02.26.09.07.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 26 Feb 2022 09:07:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=LQyY9HazAmIIQN0Qysba5tizaG3itH2sn2cAotRVJ2c=; b=CTdJsv4CHIPDL2dNWv3vlyWxuAn7EHxL8vpL8I9r914Rw+IYewbqXx2wbHLWmsbe0g aJqkytERSmLYJChIloLiPmC8Q2hixzwG+awnVi+7rvlxArxzdFfBfI7WeS3eXeEnC9Gt VDejYw6ikiATEkKhIpCphwIXYN5M5qe2J8G0AT6fOIxDQ3yk/HIhR7yP78mFlLkv1Bj0 pYP3Spy1aT+E3h3TXf6t2SYQ9WOFijs3WJQWcUGbqpTrs7r5pjZdoJR7ZZ33IY/l7R9P 9QlBuLTJcZfFevwVaRr2yTdi+HT2Nh+9JmMZ/Q0SKMZR05mECDeUXZkTMHj+0uTEbTd0 HI5Q== 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=LQyY9HazAmIIQN0Qysba5tizaG3itH2sn2cAotRVJ2c=; b=Z83DbnhZQZFiLUsOMpCcCecBs8M9QSz7dS2GgW4VzpN8Rxp6fV3L1uIpzmIj8n6sm+ PETX83kePQFC46cfze5bKJq2wSy9uTCOQB1/KQUs1x3/9E+9J3YA0GIX9eA64+0jPDDt +HBFPeZRtKZG6DLqlrJSfwfh3xQmbn9lXLI0/nbD6tEFhDk2t7nZv7NK/lsIMTSw0mFd 57zl2/48AzfCbJKWQUh9TF+R138vT4T0E9G9F5s4Qa7lVsn7Tv7bpHmBFDt1Fx3/Zshh nd/3A0Giq8+VDW8vekBUoIw02Ot8McvHReLziWg/hy2CGAmRJKByc9hDNjeICJIHGLQM yB4g== X-Gm-Message-State: AOAM531/Uq2prur1VkVhPjrryZoTIdEQCoAeb7Geb7+c5WkIN9CO558p GUI+qNzQ5EOhONWkmE+YTG7BqdAb/bQikA== X-Google-Smtp-Source: ABdhPJyi6vBczO/q1nbPAZic5DzrKPLaBdlSIRkWqVFC1HSEa5m7Oqg0brGEDwrRXySWk9NQXfEGzw== X-Received: by 2002:a05:6e02:1a84:b0:2c2:d8e5:a0fe with SMTP id k4-20020a056e021a8400b002c2d8e5a0femr361196ilv.140.1645895235957; Sat, 26 Feb 2022 09:07:15 -0800 (PST) From: Warner Losh To: qemu-devel@nongnu.org Subject: [PATCH v2 03/16] bsd-user/x86_64/target_arch_cpu.h: Remove openbsd syscall Date: Sat, 26 Feb 2022 10:07:31 -0700 Message-Id: <20220226170744.76615-4-imp@bsdimp.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220226170744.76615-1-imp@bsdimp.com> References: <20220226170744.76615-1-imp@bsdimp.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::136 (failed) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: none client-ip=2607:f8b0:4864:20::136; envelope-from=imp@bsdimp.com; helo=mail-il1-x136.google.com X-Spam_score_int: -4 X-Spam_score: -0.5 X-Spam_bar: / X-Spam_report: (-0.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 , arrowd@FreeBSD.org, Kyle Evans , Richard Henderson , def@FreeBSD.org, jrtc27@FreeBSD.org, Warner Losh , Brad Smith Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1645895372014100001 Content-Type: text/plain; charset="utf-8" This doesn't build on openbsd at the moment, and this could should arguably be in bsd-user/*bsd/x86_64 somewhere. Until we refactor to support OpenBSD/NetBSD again, drop it here. Signed-off-by: Warner Losh Reviewed-by: Richard Henderson Reviewed-by: Kyle Evans --- bsd-user/x86_64/target_arch_cpu.h | 27 ++++++++------------------- 1 file changed, 8 insertions(+), 19 deletions(-) diff --git a/bsd-user/x86_64/target_arch_cpu.h b/bsd-user/x86_64/target_arc= h_cpu.h index 9dc52d5afc4..5be2f02416e 100644 --- a/bsd-user/x86_64/target_arch_cpu.h +++ b/bsd-user/x86_64/target_arch_cpu.h @@ -126,25 +126,14 @@ static inline void target_cpu_loop(CPUX86State *env) switch (trapnr) { case EXCP_SYSCALL: /* syscall from syscall instruction */ - if (bsd_type =3D=3D target_freebsd) { - env->regs[R_EAX] =3D do_freebsd_syscall(env, - env->regs[R_EAX], - env->regs[R_EDI], - env->regs[R_ESI], - env->regs[R_EDX], - env->regs[R_ECX], - env->regs[8], - env->regs[9], 0, 0); - } else { /* if (bsd_type =3D=3D target_openbsd) */ - env->regs[R_EAX] =3D do_openbsd_syscall(env, - env->regs[R_EAX], - env->regs[R_EDI], - env->regs[R_ESI], - env->regs[R_EDX], - env->regs[10], - env->regs[8], - env->regs[9]); - } + env->regs[R_EAX] =3D do_freebsd_syscall(env, + env->regs[R_EAX], + env->regs[R_EDI], + env->regs[R_ESI], + env->regs[R_EDX], + env->regs[R_ECX], + env->regs[8], + env->regs[9], 0, 0); env->eip =3D env->exception_next_eip; if (((abi_ulong)env->regs[R_EAX]) >=3D (abi_ulong)(-515)) { env->regs[R_EAX] =3D -env->regs[R_EAX]; --=20 2.33.1 From nobody Fri May 17 09:38:21 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1645895892219986.9519611519738; Sat, 26 Feb 2022 09:18:12 -0800 (PST) Received: from localhost ([::1]:58172 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nO0hu-0002F3-SH for importer@patchew.org; Sat, 26 Feb 2022 12:18:10 -0500 Received: from eggs.gnu.org ([209.51.188.92]:60424) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nO0XP-0008BF-Tn for qemu-devel@nongnu.org; Sat, 26 Feb 2022 12:07:19 -0500 Received: from [2607:f8b0:4864:20::131] (port=37503 helo=mail-il1-x131.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nO0XO-0000PK-3c for qemu-devel@nongnu.org; Sat, 26 Feb 2022 12:07:19 -0500 Received: by mail-il1-x131.google.com with SMTP id c14so6831789ilm.4 for ; Sat, 26 Feb 2022 09:07:17 -0800 (PST) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id e23-20020a6b5017000000b00635b8032d45sm3138764iob.22.2022.02.26.09.07.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 26 Feb 2022 09:07:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=DXLZp7GVZK+yie4WHT/uqpry+qSSGTFKOqK8kpW5rAI=; b=QQi0y6X9WzIWKZn+UBjtuVim268fNiGRoSe10n4ypGkyZQCDCjl++KEUCSkRHjiTNy Qhxa5q1LOWLnKLjxYSlRyvqyeyHxJtc7KsN6PgoEHMaBB+nD8nHTVnJXohi6k2HDObsd zoum8Wz+Nrrf/NEvzujX/I50PbNuG19gsUd2Xf5DVadN/zGAmOPqeBSBySkN6yyouP/Z ekoUWF/XPBLakQfXvYNJtkl8WG5fC9D0ZTNtAsqgpjey3XHnkQ8TBeeFIK3dTmdY7FMa Zwbya9JURdQI/gF+2t7xan1prGWKTGNc4Fa1uQioUKHAcYoOy2nUv2/DlIS8HLnvAErc n1Ow== 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=DXLZp7GVZK+yie4WHT/uqpry+qSSGTFKOqK8kpW5rAI=; b=LSqEEtuK0Rz8Tc+PzKPujF4LL8AOaRajCriKsaBdqy6ryZ8qXxwZDF35d3uElIA84F +VzZcEaX8UrlWC2zsrvJUBsWhrw+fNu0WwuwrnxNiNW0VCNsCFuF5jZzoJxgXkXhQ3Vk ydqOxKcmMB4VRzibMzsrP6/hHUcKRZfsSB43j5L/P7RSDWNflG3jVrCF8N7rdhgVsoIR Rai6MTSGFD3JiIfVvBPLv6TTi+Ss/CidStImZ7/nRSSV5gwGThMduZfcdcGo+Xr95CXu 2N8NaQUiSn0Vw0SWbXed/5/xTfOs6oXoqMXmykfjYoh4PqZq0LiRXBevkUlEgZ+6HKav C1Pw== X-Gm-Message-State: AOAM530No0NLDAJGGloLzFMsocKoI0gnkNYaPpZ3t3dRssKQlyHhbrF3 g58E6cGJmte53RbcXObK7+6TdN7SUu6SxQ== X-Google-Smtp-Source: ABdhPJznuMlaIg+9R2wgMu8itBznw0LEyKt5I39HpIseipDk6v/WtPkmPWYkIgxX4bDDgLhe2yPA8Q== X-Received: by 2002:a05:6e02:15c8:b0:2bd:fdca:18a8 with SMTP id q8-20020a056e0215c800b002bdfdca18a8mr10984801ilu.320.1645895236863; Sat, 26 Feb 2022 09:07:16 -0800 (PST) From: Warner Losh To: qemu-devel@nongnu.org Subject: [PATCH v2 04/16] bsd-user/i386/target_arch_cpu.h: Remove openbsd syscall Date: Sat, 26 Feb 2022 10:07:32 -0700 Message-Id: <20220226170744.76615-5-imp@bsdimp.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220226170744.76615-1-imp@bsdimp.com> References: <20220226170744.76615-1-imp@bsdimp.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::131 (failed) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: none client-ip=2607:f8b0:4864:20::131; envelope-from=imp@bsdimp.com; helo=mail-il1-x131.google.com X-Spam_score_int: -4 X-Spam_score: -0.5 X-Spam_bar: / X-Spam_report: (-0.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 , arrowd@FreeBSD.org, Kyle Evans , Richard Henderson , def@FreeBSD.org, jrtc27@FreeBSD.org, Warner Losh , Brad Smith Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1645895893618100001 Content-Type: text/plain; charset="utf-8" This doesn't build on openbsd at the moment, and this could should arguably be in bsd-user/*bsd/i386 somewhere. Until we refactor to support OpenBSD/NetBSD again, drop it here. Signed-off-by: Warner Losh Reviewed-by: Kyle Evans Reviewed-by: Richard Henderson --- bsd-user/i386/target_arch_cpu.h | 84 +++++++++++++++------------------ 1 file changed, 37 insertions(+), 47 deletions(-) diff --git a/bsd-user/i386/target_arch_cpu.h b/bsd-user/i386/target_arch_cp= u.h index 3cbf69d8af2..9da22202d48 100644 --- a/bsd-user/i386/target_arch_cpu.h +++ b/bsd-user/i386/target_arch_cpu.h @@ -116,55 +116,45 @@ static inline void target_cpu_loop(CPUX86State *env) process_queued_cpu_work(cs); =20 switch (trapnr) { - case 0x80: + case 0x80: { /* syscall from int $0x80 */ - if (bsd_type =3D=3D target_freebsd) { - abi_ulong params =3D (abi_ulong) env->regs[R_ESP] + - sizeof(int32_t); - int32_t syscall_nr =3D env->regs[R_EAX]; - int32_t arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8; - - if (syscall_nr =3D=3D TARGET_FREEBSD_NR_syscall) { - get_user_s32(syscall_nr, params); - params +=3D sizeof(int32_t); - } else if (syscall_nr =3D=3D TARGET_FREEBSD_NR___syscall) { - get_user_s32(syscall_nr, params); - params +=3D sizeof(int64_t); - } - get_user_s32(arg1, params); - params +=3D sizeof(int32_t); - get_user_s32(arg2, params); - params +=3D sizeof(int32_t); - get_user_s32(arg3, params); - params +=3D sizeof(int32_t); - get_user_s32(arg4, params); - params +=3D sizeof(int32_t); - get_user_s32(arg5, params); - params +=3D sizeof(int32_t); - get_user_s32(arg6, params); - params +=3D sizeof(int32_t); - get_user_s32(arg7, params); + abi_ulong params =3D (abi_ulong) env->regs[R_ESP] + + sizeof(int32_t); + int32_t syscall_nr =3D env->regs[R_EAX]; + int32_t arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8; + + if (syscall_nr =3D=3D TARGET_FREEBSD_NR_syscall) { + get_user_s32(syscall_nr, params); params +=3D sizeof(int32_t); - get_user_s32(arg8, params); - env->regs[R_EAX] =3D do_freebsd_syscall(env, - syscall_nr, - arg1, - arg2, - arg3, - arg4, - arg5, - arg6, - arg7, - arg8); - } else { /* if (bsd_type =3D=3D target_openbsd) */ - env->regs[R_EAX] =3D do_openbsd_syscall(env, - env->regs[R_EAX], - env->regs[R_EBX], - env->regs[R_ECX], - env->regs[R_EDX], - env->regs[R_ESI], - env->regs[R_EDI], - env->regs[R_EBP]); + } else if (syscall_nr =3D=3D TARGET_FREEBSD_NR___syscall) { + get_user_s32(syscall_nr, params); + params +=3D sizeof(int64_t); + } + get_user_s32(arg1, params); + params +=3D sizeof(int32_t); + get_user_s32(arg2, params); + params +=3D sizeof(int32_t); + get_user_s32(arg3, params); + params +=3D sizeof(int32_t); + get_user_s32(arg4, params); + params +=3D sizeof(int32_t); + get_user_s32(arg5, params); + params +=3D sizeof(int32_t); + get_user_s32(arg6, params); + params +=3D sizeof(int32_t); + get_user_s32(arg7, params); + params +=3D sizeof(int32_t); + get_user_s32(arg8, params); + env->regs[R_EAX] =3D do_freebsd_syscall(env, + syscall_nr, + arg1, + arg2, + arg3, + arg4, + arg5, + arg6, + arg7, + arg8); } if (((abi_ulong)env->regs[R_EAX]) >=3D (abi_ulong)(-515)) { env->regs[R_EAX] =3D -env->regs[R_EAX]; --=20 2.33.1 From nobody Fri May 17 09:38:21 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1645895372114107.67737271265707; Sat, 26 Feb 2022 09:09:32 -0800 (PST) Received: from localhost ([::1]:33906 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nO0ZX-0002c6-1K for importer@patchew.org; Sat, 26 Feb 2022 12:09:31 -0500 Received: from eggs.gnu.org ([209.51.188.92]:60448) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nO0XR-0008Co-Ew for qemu-devel@nongnu.org; Sat, 26 Feb 2022 12:07:21 -0500 Received: from [2607:f8b0:4864:20::d2a] (port=34498 helo=mail-io1-xd2a.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nO0XO-0000Pc-Vr for qemu-devel@nongnu.org; Sat, 26 Feb 2022 12:07:20 -0500 Received: by mail-io1-xd2a.google.com with SMTP id f14so10230044ioz.1 for ; Sat, 26 Feb 2022 09:07:18 -0800 (PST) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id e23-20020a6b5017000000b00635b8032d45sm3138764iob.22.2022.02.26.09.07.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 26 Feb 2022 09:07:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=/0Ungf5BAlJNkh7LvFfAMnGaakju4aH7gQ1ep4PqQIo=; b=1lBPQJv8RchkvNCqq0yO5lzgdyNLS8wSxVKPcLXaxial/2PijPW8TyyilTr9RWWMqq 5oMz9/JyzJfiYQZvEEhi41wa5oqEGG8MXiHMqfV+Oc1LjAviDW9dLQUrL1nEPDW+6fc2 nFP9+eQo0umOnBQw08MtSmAkUO1EoSZAg/RERlrpCqgeneS2PF3e8u/VazZvipS+HjTO YgXil8PGauodefirgld6mR+cZZbWvaHGqbU2jQItJ8K5enpZS8Wpk8oRtsSN4jyp/Vp2 u+AbR5on2e0HApXHdIN2KOYaiEh5NWr/AfI2MayvkxNveYdM+Qd5JFvenSC2/olF5GP3 fjSA== 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=/0Ungf5BAlJNkh7LvFfAMnGaakju4aH7gQ1ep4PqQIo=; b=KO85S2CsQ6mp6v3Sp4l7tk6jGx7aKxquS9ktYUuC9YLXVzR4NglUvtFJEavsXqalZd Lj0vhMld5+YTVNZHZi7XLmgY0OwkF8y1ttJERJVZTI9706Nf7zjdMU8TtUSj5FckwL7i vYNrgoEFTBlnALe86Q8DX81epbAlEqS5y0Kdmqz8E0ZJabajdwRtzWe4KAoTHGZ0gLmg 851mGh0v/7aTAHtkofAq0VvDqPBoTcGd/muaKggvWMs/4FoVVkTKGczusxEEhWQvTzNO 5/KvyFSDqbeSdt9XJgDwavN8/y1QgS8b03U9pNMJeRD1THeOePTNV6MmYr76iJZALzX+ CVIw== X-Gm-Message-State: AOAM531YxcHyKnjYNjucnBAiElXmdU2o+4Yg9sPzzdUTaCnMP6J4I5SG Rbyh//xW+WtXbHF2Y2ziBUUqyCg0ui2lwg== X-Google-Smtp-Source: ABdhPJxJYHtuZgyQi89Je4N1mQP3PNVj1Ip3mfpAx2gbPHK40exiKBHYthG9DQUnW/VE0lgbTlIzTw== X-Received: by 2002:a05:6602:2b8b:b0:608:c584:a1b0 with SMTP id r11-20020a0566022b8b00b00608c584a1b0mr9334450iov.159.1645895237674; Sat, 26 Feb 2022 09:07:17 -0800 (PST) From: Warner Losh To: qemu-devel@nongnu.org Subject: [PATCH v2 05/16] bsd-user/arm/target_arch_cpu.h: Only support FreeBSD sys calls Date: Sat, 26 Feb 2022 10:07:33 -0700 Message-Id: <20220226170744.76615-6-imp@bsdimp.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220226170744.76615-1-imp@bsdimp.com> References: <20220226170744.76615-1-imp@bsdimp.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::d2a (failed) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: none client-ip=2607:f8b0:4864:20::d2a; envelope-from=imp@bsdimp.com; helo=mail-io1-xd2a.google.com X-Spam_score_int: -4 X-Spam_score: -0.5 X-Spam_bar: / X-Spam_report: (-0.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 , arrowd@FreeBSD.org, Kyle Evans , Richard Henderson , def@FreeBSD.org, jrtc27@FreeBSD.org, Warner Losh , Brad Smith Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1645895373914100005 Content-Type: text/plain; charset="utf-8" Since we don't build on OpenBSD, only do FreeBSD system calls here. In the future, we'll need to move this to some place like bsd-user/freebsd/arm/mumble.h, but until then just leave this inline. This reflects changes to the upstream. Signed-off-by: Warner Losh Reviewed-by: Kyle Evans Reviewed-by: Richard Henderson --- bsd-user/arm/target_arch_cpu.h | 139 ++++++++++++++++----------------- 1 file changed, 66 insertions(+), 73 deletions(-) diff --git a/bsd-user/arm/target_arch_cpu.h b/bsd-user/arm/target_arch_cpu.h index b087db48fa4..afb7814a8d1 100644 --- a/bsd-user/arm/target_arch_cpu.h +++ b/bsd-user/arm/target_arch_cpu.h @@ -40,7 +40,6 @@ static inline void target_cpu_init(CPUARMState *env, static inline void target_cpu_loop(CPUARMState *env) { int trapnr, si_signo, si_code; - unsigned int n; CPUState *cs =3D env_cpu(env); =20 for (;;) { @@ -66,82 +65,76 @@ static inline void target_cpu_loop(CPUARMState *env) break; case EXCP_SWI: { - n =3D env->regs[7]; - if (bsd_type =3D=3D target_freebsd) { - int ret; - abi_ulong params =3D get_sp_from_cpustate(env); - int32_t syscall_nr =3D n; - int32_t arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8; + int ret; + abi_ulong params =3D get_sp_from_cpustate(env); + int32_t syscall_nr =3D env->regs[7]; + int32_t arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8; =20 - /* See arm/arm/syscall.c cpu_fetch_syscall_args() */ - if (syscall_nr =3D=3D TARGET_FREEBSD_NR_syscall) { - syscall_nr =3D env->regs[0]; - arg1 =3D env->regs[1]; - arg2 =3D env->regs[2]; - arg3 =3D env->regs[3]; - get_user_s32(arg4, params); - params +=3D sizeof(int32_t); - get_user_s32(arg5, params); - params +=3D sizeof(int32_t); - get_user_s32(arg6, params); - params +=3D sizeof(int32_t); - get_user_s32(arg7, params); - arg8 =3D 0; - } else if (syscall_nr =3D=3D TARGET_FREEBSD_NR___sysca= ll) { - syscall_nr =3D env->regs[0]; - arg1 =3D env->regs[2]; - arg2 =3D env->regs[3]; - get_user_s32(arg3, params); - params +=3D sizeof(int32_t); - get_user_s32(arg4, params); - params +=3D sizeof(int32_t); - get_user_s32(arg5, params); - params +=3D sizeof(int32_t); - get_user_s32(arg6, params); - arg7 =3D 0; - arg8 =3D 0; - } else { - arg1 =3D env->regs[0]; - arg2 =3D env->regs[1]; - arg3 =3D env->regs[2]; - arg4 =3D env->regs[3]; - get_user_s32(arg5, params); - params +=3D sizeof(int32_t); - get_user_s32(arg6, params); - params +=3D sizeof(int32_t); - get_user_s32(arg7, params); - params +=3D sizeof(int32_t); - get_user_s32(arg8, params); - } - ret =3D do_freebsd_syscall(env, syscall_nr, arg1, arg2= , arg3, - arg4, arg5, arg6, arg7, arg8); + /* See arm/arm/syscall.c cpu_fetch_syscall_args() */ + if (syscall_nr =3D=3D TARGET_FREEBSD_NR_syscall) { + syscall_nr =3D env->regs[0]; + arg1 =3D env->regs[1]; + arg2 =3D env->regs[2]; + arg3 =3D env->regs[3]; + get_user_s32(arg4, params); + params +=3D sizeof(int32_t); + get_user_s32(arg5, params); + params +=3D sizeof(int32_t); + get_user_s32(arg6, params); + params +=3D sizeof(int32_t); + get_user_s32(arg7, params); + arg8 =3D 0; + } else if (syscall_nr =3D=3D TARGET_FREEBSD_NR___syscall) { + syscall_nr =3D env->regs[0]; + arg1 =3D env->regs[2]; + arg2 =3D env->regs[3]; + get_user_s32(arg3, params); + params +=3D sizeof(int32_t); + get_user_s32(arg4, params); + params +=3D sizeof(int32_t); + get_user_s32(arg5, params); + params +=3D sizeof(int32_t); + get_user_s32(arg6, params); + arg7 =3D 0; + arg8 =3D 0; + } else { + arg1 =3D env->regs[0]; + arg2 =3D env->regs[1]; + arg3 =3D env->regs[2]; + arg4 =3D env->regs[3]; + get_user_s32(arg5, params); + params +=3D sizeof(int32_t); + get_user_s32(arg6, params); + params +=3D sizeof(int32_t); + get_user_s32(arg7, params); + params +=3D sizeof(int32_t); + get_user_s32(arg8, params); + } + ret =3D do_freebsd_syscall(env, syscall_nr, arg1, arg2, ar= g3, + arg4, arg5, arg6, arg7, arg8); + /* + * Compare to arm/arm/vm_machdep.c + * cpu_set_syscall_retval() + */ + if (-TARGET_EJUSTRETURN =3D=3D ret) { /* - * Compare to arm/arm/vm_machdep.c - * cpu_set_syscall_retval() + * Returning from a successful sigreturn syscall. + * Avoid clobbering register state. */ - if (-TARGET_EJUSTRETURN =3D=3D ret) { - /* - * Returning from a successful sigreturn syscall. - * Avoid clobbering register state. - */ - break; - } - if (-TARGET_ERESTART =3D=3D ret) { - env->regs[15] -=3D env->thumb ? 2 : 4; - break; - } - if ((unsigned int)ret >=3D (unsigned int)(-515)) { - ret =3D -ret; - cpsr_write(env, CPSR_C, CPSR_C, CPSRWriteByInstr); - env->regs[0] =3D ret; - } else { - cpsr_write(env, 0, CPSR_C, CPSRWriteByInstr); - env->regs[0] =3D ret; /* XXX need to handle lseek(= )? */ - /* env->regs[1] =3D 0; */ - } + break; + } + if (-TARGET_ERESTART =3D=3D ret) { + env->regs[15] -=3D env->thumb ? 2 : 4; + break; + } + if ((unsigned int)ret >=3D (unsigned int)(-515)) { + ret =3D -ret; + cpsr_write(env, CPSR_C, CPSR_C, CPSRWriteByInstr); + env->regs[0] =3D ret; } else { - fprintf(stderr, "qemu: bsd_type (=3D %d) syscall " - "not supported\n", bsd_type); + cpsr_write(env, 0, CPSR_C, CPSRWriteByInstr); + env->regs[0] =3D ret; /* XXX need to handle lseek()? */ + /* env->regs[1] =3D 0; */ } } break; --=20 2.33.1 From nobody Fri May 17 09:38:21 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16458953702171012.6006523767701; Sat, 26 Feb 2022 09:09:30 -0800 (PST) Received: from localhost ([::1]:33866 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nO0ZU-0002ac-NY for importer@patchew.org; Sat, 26 Feb 2022 12:09:28 -0500 Received: from eggs.gnu.org ([209.51.188.92]:60452) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nO0XR-0008DJ-Pc for qemu-devel@nongnu.org; Sat, 26 Feb 2022 12:07:21 -0500 Received: from [2607:f8b0:4864:20::d2d] (port=45766 helo=mail-io1-xd2d.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nO0XP-0000Pm-ON for qemu-devel@nongnu.org; Sat, 26 Feb 2022 12:07:21 -0500 Received: by mail-io1-xd2d.google.com with SMTP id c14so10146894ioa.12 for ; Sat, 26 Feb 2022 09:07:19 -0800 (PST) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id e23-20020a6b5017000000b00635b8032d45sm3138764iob.22.2022.02.26.09.07.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 26 Feb 2022 09:07:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ofnHKkN8PdXzijWUIHfVMI1oGobWCqOzmD9JyEB/pSk=; b=KxEm+ptU/3UaatRdYzJAOQMDdwX5+9SuskzDO1ot6uy2bR0xOhIKy87SvIyjHZheJF 9kEvnQRCQjPNxEBk8MUvDc46PSm+Rz5jOLgS3bGoLaWDH73CDY7OY68no/YJb12TGi7Z wLi5q/CnwrDGPJS9JcEZdoQeDXcxtkbaoTbK1i6mMUSFfaZpS26Dhdlcc5KKbO4JaQpZ 7S4H3wvmNM5oEvIo9Ww7P3MfG9AdINIKxkAGkVV8vk23kHnxmcFYHsmrMDT1GAbWIdhp FdEHeHlulRnDCvlvDOF4HRINp9CdoCI0pKu2fVHrTCprdSQwzVcr2ramp9O9eMcHmpUE B4Kg== 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=ofnHKkN8PdXzijWUIHfVMI1oGobWCqOzmD9JyEB/pSk=; b=F34P46EW70NxHE+AcnJYSmTOsyClq0xQLgc9xerpYxqDfGlUqT8bkX9p4m8IkNFRyT 5o9wNP+gO8tKoHEId6klFew6M1l8nyUwuCMJw16kLQ20oPjkTg2qhy2yw06oLPm91Dy6 yhKeuIfDUnQK+/in7pctNW4R2xA71l40SdDghdVYIj46sOdvz2PmUkI1Ap/8Fpe1PaG5 6H+4KM5mVhW7zm+J+HUd8e+NfNdUZEbd0UBKFVxEAgJ1tjt+LluWXLzClYG+6iCE6Zqx Ea0iMdYWsaqiTyFTf/nV4bzhQbsCEY10RrXnmPVnWtRSRaUGavV/Px9uTR2rNnGcqF/R xzYA== X-Gm-Message-State: AOAM531xpkKurHQ3gmhyln3/rKWsWoI3q7WieLZAmYtmIVtCMCWVcwI4 gDSM6EH8ir+bYZN8kV+uXSwFwq8wjcxLcA== X-Google-Smtp-Source: ABdhPJyg4ZxTm/vWzBHjCjDTi+5MxAcsIjnuY8X/Napb6IxGGYhsoGHs3++2m5Dw1rSGrsSjRfhJQA== X-Received: by 2002:a05:6602:2d90:b0:63d:b41e:e4e4 with SMTP id k16-20020a0566022d9000b0063db41ee4e4mr9433146iow.172.1645895238580; Sat, 26 Feb 2022 09:07:18 -0800 (PST) From: Warner Losh To: qemu-devel@nongnu.org Subject: [PATCH v2 06/16] bsd-user/arm/target_arch_thread.h: Assume a FreeBSD target Date: Sat, 26 Feb 2022 10:07:34 -0700 Message-Id: <20220226170744.76615-7-imp@bsdimp.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220226170744.76615-1-imp@bsdimp.com> References: <20220226170744.76615-1-imp@bsdimp.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::d2d (failed) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: none client-ip=2607:f8b0:4864:20::d2d; envelope-from=imp@bsdimp.com; helo=mail-io1-xd2d.google.com X-Spam_score_int: -4 X-Spam_score: -0.5 X-Spam_bar: / X-Spam_report: (-0.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 , arrowd@FreeBSD.org, Kyle Evans , Richard Henderson , def@FreeBSD.org, jrtc27@FreeBSD.org, Warner Losh , Brad Smith Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1645895372021100002 Content-Type: text/plain; charset="utf-8" Since we can't run on anything else, assume for the moment that this is a FreeBSD target. In the future, we'll need to handle this properly via some include file in bsd-user/*bsd/arm/mumble.h. There's a number of other diffs that would be needed to make things work on OtherBSD, so it doesn't make sense to preseve this one detail today. Signed-off-by: Warner Losh Reviewed-by: Kyle Evans Reviewed-by: Richard Henderson --- bsd-user/arm/target_arch_thread.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/bsd-user/arm/target_arch_thread.h b/bsd-user/arm/target_arch_t= hread.h index 11c7f765838..fcafca2408c 100644 --- a/bsd-user/arm/target_arch_thread.h +++ b/bsd-user/arm/target_arch_thread.h @@ -62,9 +62,7 @@ static inline void target_thread_init(struct target_pt_re= gs *regs, } regs->ARM_pc =3D infop->entry & 0xfffffffe; regs->ARM_sp =3D stack; - if (bsd_type =3D=3D target_freebsd) { - regs->ARM_lr =3D infop->entry & 0xfffffffe; - } + regs->ARM_lr =3D infop->entry & 0xfffffffe; /* * FreeBSD kernel passes the ps_strings pointer in r0. This is used by= some * programs to set status messages that we see in ps. bsd-user doesn't --=20 2.33.1 From nobody Fri May 17 09:38:21 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1645896007606904.7363556192539; Sat, 26 Feb 2022 09:20:07 -0800 (PST) Received: from localhost ([::1]:35744 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nO0jm-00067D-Lc for importer@patchew.org; Sat, 26 Feb 2022 12:20:06 -0500 Received: from eggs.gnu.org ([209.51.188.92]:60504) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nO0XW-0008J0-JZ for qemu-devel@nongnu.org; Sat, 26 Feb 2022 12:07:26 -0500 Received: from [2607:f8b0:4864:20::d2b] (port=44706 helo=mail-io1-xd2b.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nO0XQ-0000Q9-To for qemu-devel@nongnu.org; Sat, 26 Feb 2022 12:07:25 -0500 Received: by mail-io1-xd2b.google.com with SMTP id h16so10147511iol.11 for ; Sat, 26 Feb 2022 09:07:20 -0800 (PST) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id e23-20020a6b5017000000b00635b8032d45sm3138764iob.22.2022.02.26.09.07.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 26 Feb 2022 09:07:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=0W7CyGd+wltyjsV4bxtaXkJoEqxgaZms/OXr5iQpEmE=; b=pCKpbvFG84XhFi1icT9yGplBeEYFOb4YkBzfC801APJnkkFVOh4Q4/AxvrgsMp+kvr Xp0WFsOh62nMJYbtHAZFUdwysKQYYRJOII1qGhHdpikdvnBfOV+t+Nyv5Xax3W7TNZy+ fUz9OGMQSVDaNVJQmNT5GGcSihVqLWnjFl0h36kiWUcu0X1ueCwJryRkwnifJgE+Wosj yZKshWVwWrntVxJALFF3ONNNgEwVjhnuDGtGZyNAsOmt9fgr6O0eu52Ddp8+nfkkrL55 jzQn2A3KX5uhNdcpal8gdx2xO3vKl7x2nCeen1dgylE3kVI0unaTXUlAFMdzttG8fCiz VbYw== 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=0W7CyGd+wltyjsV4bxtaXkJoEqxgaZms/OXr5iQpEmE=; b=YjaXSkRBTabETTes0F4LKD1ltV7sd/EZrBXJhJXV5iv5MFGh4eReA1JFkZsfjpJbQN rLmKDLf/AK89KS6xo8bFUQWDT4XXy9KuDDTJH510dr23R0oc2aHFZAzr1LJNZDrxyW8G ZLqwLQKtb4odTTzWKgVgKfIKOeN0U5+CNmMC/D8E69LuF/m74UvyfhO0dhuIZ4s6z9Th rm69Sa3L95yS7xHD3Yn1qJlE1M3sJOsJfyZsw7WThrGPrv+G6xZcGTcTMRQue/eVnn82 s1DpAyD7u1ub//jmY4SXBI/eVzjJeE+RGi/okKiiGj+iTK7D71sM1okrpDJVa2RZH/Ft Idjg== X-Gm-Message-State: AOAM531QonryiGDSpQAvwiCktOr0awPilcRizE1Cgh6RTO+oDKrR6JVf h9I4BWsZEUnbr2jrM2dKtEpvAt8hbmIuLg== X-Google-Smtp-Source: ABdhPJweasE5iNYOH7TGeRJSfQdFxrQrBRWCpIvHKnVkeGLM+EPCtZKS3CtoSatiI3g6vPxbr1I8Pw== X-Received: by 2002:a6b:b704:0:b0:611:55c2:b2c7 with SMTP id h4-20020a6bb704000000b0061155c2b2c7mr9623939iof.12.1645895239639; Sat, 26 Feb 2022 09:07:19 -0800 (PST) From: Warner Losh To: qemu-devel@nongnu.org Subject: [PATCH v2 07/16] bsd-user/x86_64/target_arch_thread.h: Assume a FreeBSD target Date: Sat, 26 Feb 2022 10:07:35 -0700 Message-Id: <20220226170744.76615-8-imp@bsdimp.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220226170744.76615-1-imp@bsdimp.com> References: <20220226170744.76615-1-imp@bsdimp.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::d2b (failed) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: none client-ip=2607:f8b0:4864:20::d2b; envelope-from=imp@bsdimp.com; helo=mail-io1-xd2b.google.com X-Spam_score_int: -4 X-Spam_score: -0.5 X-Spam_bar: / X-Spam_report: (-0.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 , arrowd@FreeBSD.org, Kyle Evans , Richard Henderson , def@FreeBSD.org, jrtc27@FreeBSD.org, Warner Losh , Brad Smith Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1645896008356100001 Content-Type: text/plain; charset="utf-8" Since we can't run on anything else, assume for the moment that this is a FreeBSD target. In the future, we'll need to handle this properly via some include file in bsd-user/*bsd/x86_64/mumble.h. There's a number of other diffs that would be needed to make things work on OtherBSD, so it doesn't make sense to preseve this one detail today. Signed-off-by: Warner Losh Reviewed-by: Kyle Evans Reviewed-by: Richard Henderson --- bsd-user/x86_64/target_arch_thread.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/bsd-user/x86_64/target_arch_thread.h b/bsd-user/x86_64/target_= arch_thread.h index d105e43fd35..b745d7ffeb7 100644 --- a/bsd-user/x86_64/target_arch_thread.h +++ b/bsd-user/x86_64/target_arch_thread.h @@ -32,9 +32,7 @@ static inline void target_thread_init(struct target_pt_re= gs *regs, regs->rax =3D 0; regs->rsp =3D infop->start_stack; regs->rip =3D infop->entry; - if (bsd_type =3D=3D target_freebsd) { - regs->rdi =3D infop->start_stack; - } + regs->rdi =3D infop->start_stack; } =20 #endif /* !_TARGET_ARCH_THREAD_H_ */ --=20 2.33.1 From nobody Fri May 17 09:38:21 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1645895733491968.8250249714245; Sat, 26 Feb 2022 09:15:33 -0800 (PST) Received: from localhost ([::1]:50946 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nO0fM-0005h0-Go for importer@patchew.org; Sat, 26 Feb 2022 12:15:32 -0500 Received: from eggs.gnu.org ([209.51.188.92]:60516) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nO0XX-0008KM-3N for qemu-devel@nongnu.org; Sat, 26 Feb 2022 12:07:28 -0500 Received: from [2607:f8b0:4864:20::d2e] (port=45767 helo=mail-io1-xd2e.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nO0XR-0000QM-QB for qemu-devel@nongnu.org; Sat, 26 Feb 2022 12:07:26 -0500 Received: by mail-io1-xd2e.google.com with SMTP id c14so10146964ioa.12 for ; Sat, 26 Feb 2022 09:07:21 -0800 (PST) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id e23-20020a6b5017000000b00635b8032d45sm3138764iob.22.2022.02.26.09.07.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 26 Feb 2022 09:07:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=TkBhosKWDfacU7putxgRWL5fb9CqDgt1oqt0mYy2nvk=; b=uC0+kSJPkiHRAJ1KlA6x+zXp7L7WQxLLZgmA8Knh28GgpnlO1Qt1bqNQ7cyfOslHBW NsbO1lAtqHcX6znbx6O5xMu5TMrPn6LocPB8fWtXf2a48A16CNlxR14k5yqEnBZ7oTvs aBh/ns6MHSCvxmUauQyRe7Yo5bGKJyahsxQTDEeYcp8J113+5mMUrCrdeXAC2hyL5YpY tZD23A6c0ByGCp84pb0xuy5KZnxN+zWrpLLIS3p7q7WRxeGySG1IUrCRN7NYMBSz+m4U x0pWwGrna7HK3F8lO873ANLb5GZEnUHQiIV0twL1doul1mIw2RQdt00ZssPWddmCc8Iv o/LQ== 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=TkBhosKWDfacU7putxgRWL5fb9CqDgt1oqt0mYy2nvk=; b=vBIDayAUdeZKPo0o1EspQB8s8/1dIDgmQZ1z4oyeESS23Jw2iumTivq4GegjFnOmic dWEew+ee8AuCUTeRlui3ZcThegXbeR0OEFvxCn4lXugDb2WURkQG90gIjJ6uTLszYxD8 yOCCd2pG+OHrwMXuXugNw/v/bU57RNwkmh9a6uM9BQpGffBWTk17o+k86C0VwZwOl6IL DZjtlwEolcXqukvAuHxqYpS+DqtP5v3DO/QC/zncuHi6EIpXjKk0vc8X4gsirq4udahX 76f0+ZuVjonc/n+1X9EL/oUJaISmK+xuU7+k08XNjE4qfRUNRs1ypjNrjkNbX8A4aJvA Fz5w== X-Gm-Message-State: AOAM530R+3waklNmR+SSLzWkeZ20icRmis3U7hmtxz5Hg6E9lwHrKxZO R/vx+4AAw9JlAlpdm68209qH8mp56UauTA== X-Google-Smtp-Source: ABdhPJy2tA575ErjWZQl7A4e/3JmNG2PpWH5e2S5aVghYmgJAqC4JI/AK3j7+CbctanHtQhswn3EPg== X-Received: by 2002:a6b:7417:0:b0:640:a379:c950 with SMTP id s23-20020a6b7417000000b00640a379c950mr9102816iog.38.1645895240562; Sat, 26 Feb 2022 09:07:20 -0800 (PST) From: Warner Losh To: qemu-devel@nongnu.org Subject: [PATCH v2 08/16] bsd-user: Remove bsd_type Date: Sat, 26 Feb 2022 10:07:36 -0700 Message-Id: <20220226170744.76615-9-imp@bsdimp.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220226170744.76615-1-imp@bsdimp.com> References: <20220226170744.76615-1-imp@bsdimp.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::d2e (failed) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: none client-ip=2607:f8b0:4864:20::d2e; envelope-from=imp@bsdimp.com; helo=mail-io1-xd2e.google.com X-Spam_score_int: -4 X-Spam_score: -0.5 X-Spam_bar: / X-Spam_report: (-0.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 , arrowd@FreeBSD.org, Kyle Evans , Richard Henderson , def@FreeBSD.org, jrtc27@FreeBSD.org, Warner Losh , Brad Smith Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1645895734626100001 Content-Type: text/plain; charset="utf-8" Remove keeping track of which type of bsd we're running on. It's no longer referenced in the code. Building bsd-user on NetBSD or OpenBSD isn't possible, let alone running that code. Stop pretending that we can do the cross BSD thing since there's been a large divergence since 2000 that makes this nearly impossible between FreeBSD and {Net,Open}BSD and at least quite difficult between NetBSD and OpenBSD. Signed-off-by: Warner Losh Reviewed-by: Kyle Evans Reviewed-by: Richard Henderson --- bsd-user/main.c | 2 -- bsd-user/qemu.h | 7 ------- 2 files changed, 9 deletions(-) diff --git a/bsd-user/main.c b/bsd-user/main.c index bddb830e99b..88d347d05eb 100644 --- a/bsd-user/main.c +++ b/bsd-user/main.c @@ -96,7 +96,6 @@ unsigned long reserved_va; =20 static const char *interp_prefix =3D CONFIG_QEMU_INTERP_PREFIX; const char *qemu_uname_release; -enum BSDType bsd_type; char qemu_proc_pathname[PATH_MAX]; /* full path to exeutable */ =20 unsigned long target_maxtsiz =3D TARGET_MAXTSIZ; /* max text size */ @@ -284,7 +283,6 @@ int main(int argc, char **argv) const char *gdbstub =3D NULL; char **target_environ, **wrk; envlist_t *envlist =3D NULL; - bsd_type =3D HOST_DEFAULT_BSD_TYPE; char *argv0 =3D NULL; =20 adjust_ssize(); diff --git a/bsd-user/qemu.h b/bsd-user/qemu.h index 02921ac8b3b..e5742bd6c03 100644 --- a/bsd-user/qemu.h +++ b/bsd-user/qemu.h @@ -29,13 +29,6 @@ =20 extern char **environ; =20 -enum BSDType { - target_freebsd, - target_netbsd, - target_openbsd, -}; -extern enum BSDType bsd_type; - #include "exec/user/thunk.h" #include "target_arch.h" #include "syscall_defs.h" --=20 2.33.1 From nobody Fri May 17 09:38:21 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1645895563101589.0768775994546; Sat, 26 Feb 2022 09:12:43 -0800 (PST) Received: from localhost ([::1]:42426 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nO0cc-0008OE-8t for importer@patchew.org; Sat, 26 Feb 2022 12:12:42 -0500 Received: from eggs.gnu.org ([209.51.188.92]:60484) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nO0XV-0008Im-LF for qemu-devel@nongnu.org; Sat, 26 Feb 2022 12:07:26 -0500 Received: from [2607:f8b0:4864:20::131] (port=44558 helo=mail-il1-x131.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nO0XS-0000Qb-Nn for qemu-devel@nongnu.org; Sat, 26 Feb 2022 12:07:25 -0500 Received: by mail-il1-x131.google.com with SMTP id 9so6801309ily.11 for ; Sat, 26 Feb 2022 09:07:22 -0800 (PST) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id e23-20020a6b5017000000b00635b8032d45sm3138764iob.22.2022.02.26.09.07.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 26 Feb 2022 09:07:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=78KW/flWB6MtajWHw9g+3hzlOLi0kgwH7sG/RnsAKPw=; b=nvvmhkL+fYNQFJP0M3MurJOQ2k9dj+zTNhlof4RdzijQ22PfSlFC7gxw9IrXrzfSRJ qvQlR4LPv2jI8qSxbbBO3qu3pE97SpdAWGRMnuHpGlNoQzArXTmJlgBfklx3i20u+dYD 6lajxgagdfcGfA5cm4m8SnpyAElbprCBwvhBgsY09OJCPDs0+DNM8kF61LnuuGMnflsv 5wvDhVnL8jo6ZdGBdVO6FGPFhmSrBcXuR75TfDC54zCRzaoYV36H47UmVj2+Ifkt4wXk UpYHRorQC97prON2xOuL1v22cpsn1q3Zo1B9reHuuM+J/Jn/y9OMM/6VyfJfYp4ha1vk QymA== 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=78KW/flWB6MtajWHw9g+3hzlOLi0kgwH7sG/RnsAKPw=; b=KJpLgPWqdjJslHnpASb7k2rTa00kFvFq1FXldP1xgO0z5tT/NyF6paNtlRaJvyxv9p edWLJlEpAKLUTTVFlOLTUBg0ypAYF4SXWVWT+DoTIAkLkPulzty95MnwceFCvpH0tk05 APeNWAF8mSJqiWfqb9jTEaFdGvsQsqGgfwTXs1jixq/1wkxlVfoCsnmGdSF4/SntZCPX IJfK4HX9pPl1IfAfk7YUwy/2v3wyM7dWNxycUsB+PUmTBya/fIyUYOR99CLOvyjN5G1K gMGFpTCSuO8L96sbNVgDcOjbUlfa8r6J/jlU1Cd2reUd0Vq7cqH4DLl+vikT55nm/M+j 3BSA== X-Gm-Message-State: AOAM532GktGFrlbpgxcQrTNAxZnPH7Any0B64coxaWEd21NFRfkdlf4u QUNAqsjsJ28PA6Nydr91RzXfrc0BxJgQVg== X-Google-Smtp-Source: ABdhPJxB3nOx0Aly0C8s3go4rKikBqIQV7nj0NCOi+Q0fxNwhcuIkVeFJ+ZvopatBNzndNZ1ZG4xHg== X-Received: by 2002:a05:6e02:b24:b0:2be:88f8:c4ed with SMTP id e4-20020a056e020b2400b002be88f8c4edmr11285234ilu.72.1645895241468; Sat, 26 Feb 2022 09:07:21 -0800 (PST) From: Warner Losh To: qemu-devel@nongnu.org Subject: [PATCH v2 09/16] bsd-user/freebsd/os-syscall.c: Move syscall processing here Date: Sat, 26 Feb 2022 10:07:37 -0700 Message-Id: <20220226170744.76615-10-imp@bsdimp.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220226170744.76615-1-imp@bsdimp.com> References: <20220226170744.76615-1-imp@bsdimp.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::131 (failed) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: none client-ip=2607:f8b0:4864:20::131; envelope-from=imp@bsdimp.com; helo=mail-il1-x131.google.com X-Spam_score_int: -4 X-Spam_score: -0.5 X-Spam_bar: / X-Spam_report: (-0.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 , arrowd@FreeBSD.org, Kyle Evans , Richard Henderson , def@FreeBSD.org, jrtc27@FreeBSD.org, Warner Losh , Brad Smith Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1645895565354100001 Content-Type: text/plain; charset="utf-8" While there is some commonality between *BSD syscall processing, there's a number of differences and the system call numbers and ABIs have been independent since the late 90s. Move FreeBSD's proessing here and delete it. The upstream implementation is somewhat different than the current implementation. It will be much easier to upstream these from scratch, justifying the final result, rather than working out the diffs and justifying the changes. Also tweak a comment to qemu standard form. Signed-off-by: Warner Losh Reviewed-by: Kyle Evans Reviewed-by: Richard Henderson --- bsd-user/freebsd/os-syscall.c | 69 +++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 bsd-user/freebsd/os-syscall.c diff --git a/bsd-user/freebsd/os-syscall.c b/bsd-user/freebsd/os-syscall.c new file mode 100644 index 00000000000..fc57e324173 --- /dev/null +++ b/bsd-user/freebsd/os-syscall.c @@ -0,0 +1,69 @@ +/* + * BSD syscalls + * + * Copyright (c) 2003-2008 Fabrice Bellard + * Copyright (c) 2013-2014 Stacey D. Son + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +/* + * We need the FreeBSD "legacy" definitions. Rust needs the FreeBSD 11 sys= tem + * calls since it doesn't use libc at all, so we have to emulate that desp= ite + * FreeBSD 11 being EOL'd. + */ +#define _WANT_FREEBSD11_STAT +#define _WANT_FREEBSD11_STATFS +#define _WANT_FREEBSD11_DIRENT +#define _WANT_KERNEL_ERRNO +#define _WANT_SEMUN +#include "qemu/osdep.h" +#include "qemu/cutils.h" +#include "qemu/path.h" +#include +#include +#include +#include + +#include "qemu.h" +#include "qemu-common.h" +#include "signal-common.h" +#include "user/syscall-trace.h" + +void target_set_brk(abi_ulong new_brk) +{ +} + +bool is_error(abi_long ret) +{ + + return (abi_ulong)ret >=3D (abi_ulong)(-4096); +} + +/* + * do_syscall() should always have a single exit point at the end so that + * actions, such as logging of syscall results, can be performed. All err= nos + * that do_syscall() returns must be -TARGET_. + */ +abi_long do_freebsd_syscall(void *cpu_env, int num, abi_long arg1, + abi_long arg2, abi_long arg3, abi_long arg4, + abi_long arg5, abi_long arg6, abi_long arg7, + abi_long arg8) +{ + return 0; +} + +void syscall_init(void) +{ +} --=20 2.33.1 From nobody Fri May 17 09:38:21 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1645896107823836.3172065901178; Sat, 26 Feb 2022 09:21:47 -0800 (PST) Received: from localhost ([::1]:39126 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nO0lP-0008Uy-3G for importer@patchew.org; Sat, 26 Feb 2022 12:21:47 -0500 Received: from eggs.gnu.org ([209.51.188.92]:60522) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nO0XX-0008KN-4d for qemu-devel@nongnu.org; Sat, 26 Feb 2022 12:07:28 -0500 Received: from [2607:f8b0:4864:20::d31] (port=45770 helo=mail-io1-xd31.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nO0XU-0000Qf-Gg for qemu-devel@nongnu.org; Sat, 26 Feb 2022 12:07:26 -0500 Received: by mail-io1-xd31.google.com with SMTP id c14so10147018ioa.12 for ; Sat, 26 Feb 2022 09:07:24 -0800 (PST) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id e23-20020a6b5017000000b00635b8032d45sm3138764iob.22.2022.02.26.09.07.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 26 Feb 2022 09:07:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=hy2bdjFp84wHHa+MT23SEu6EAim31NmTv5svUlwzfpY=; b=NenM39sTuSsE1R/qfup/5Q/4gSrYUVdtnn9ZkSiON8xVwX0ZtLrhiWaA7bJkDHaoDg OP2v8aImTJnUr/nuDwA1Zu9SyL2hsD/GhfUW6FbNBheAHKLNFOhqRK2rnvkCUc31lFgN k6tk2/keL1J4klDvqtIJN209zoQU8idDZHRXOJ372OqY6oABJx5iZDXyhfIAxNVKTOSs fgMRThyp1yS3HCM1KMTVqqETEMYx16p5XZsVyB4VpLYMmiUELNapFYqlHCQbrXoad2ax ne1Scy0/CPJi6+CdQtTJu2b6xgzKB7DwQdpZm8qbPmx54KW8Qp30p/JorA5CbxtXZXsc suOw== 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=hy2bdjFp84wHHa+MT23SEu6EAim31NmTv5svUlwzfpY=; b=ztsBgjILzx73zCoYmcFl5KhWznLNAPGTg+7whLTwGcmerrZQCD78zj6RBQt7V31KHa DK9lsG+cXMwRE0kiRtdNgn4dz2rTmlinGAKFGZ6JhzGs/7JBYdV8guGpVsKjoykCe5fK 6i0YDJewXj3QNn4shiPBHAcNZtnWqE1PRwzuKwxmweb1Q9uWtOp3g+E7S5R48jDgJYx7 rjGrrV+z2FuGLgoXn1WnlZVpiChuGloDxkEB4wVJDy+f7BhHxxV4GXtWKKatGBoClAwM 1QAxIkaL3biTtDUDSueoXvPDQVy2gLi6MM+H4m4KEAj0y/HtMKEJ7+7S8vdjYXSGZyQj Hqiw== X-Gm-Message-State: AOAM530/Luujyrc7C7YvktO+aMellyr85kH9R95hI6G9iQ2Kq5Vovk/s hinYf8Inc1PBWRu9OvKgzWKpHgjiKwGnHA== X-Google-Smtp-Source: ABdhPJwlj1EMjvTjZJI3DXsmxefKZ95F/qQszeBv2LNsB3mNQoyQhI5u8jftTXRqmmpaStqKfNiVyg== X-Received: by 2002:a5e:9248:0:b0:640:70ff:4e28 with SMTP id z8-20020a5e9248000000b0064070ff4e28mr9603294iop.44.1645895242427; Sat, 26 Feb 2022 09:07:22 -0800 (PST) From: Warner Losh To: qemu-devel@nongnu.org Subject: [PATCH v2 10/16] bsd-user: Move system call building to os-syscall.c Date: Sat, 26 Feb 2022 10:07:38 -0700 Message-Id: <20220226170744.76615-11-imp@bsdimp.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220226170744.76615-1-imp@bsdimp.com> References: <20220226170744.76615-1-imp@bsdimp.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::d31 (failed) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: none client-ip=2607:f8b0:4864:20::d31; envelope-from=imp@bsdimp.com; helo=mail-io1-xd31.google.com X-Spam_score_int: -4 X-Spam_score: -0.5 X-Spam_bar: / X-Spam_report: (-0.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 , arrowd@FreeBSD.org, Kyle Evans , Richard Henderson , def@FreeBSD.org, jrtc27@FreeBSD.org, Warner Losh , Brad Smith Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1645896108944100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/freebsd/meson.build | 1 + bsd-user/meson.build | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/bsd-user/freebsd/meson.build b/bsd-user/freebsd/meson.build index 4b69cca7b90..f87c788e846 100644 --- a/bsd-user/freebsd/meson.build +++ b/bsd-user/freebsd/meson.build @@ -1,3 +1,4 @@ bsd_user_ss.add(files( 'os-sys.c', + 'os-syscall.c', )) diff --git a/bsd-user/meson.build b/bsd-user/meson.build index 8380fa44c25..5243122fc56 100644 --- a/bsd-user/meson.build +++ b/bsd-user/meson.build @@ -13,7 +13,6 @@ bsd_user_ss.add(files( 'mmap.c', 'signal.c', 'strace.c', - 'syscall.c', 'uaccess.c', )) =20 --=20 2.33.1 From nobody Fri May 17 09:38:21 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1645895565953568.5803971370086; Sat, 26 Feb 2022 09:12:45 -0800 (PST) Received: from localhost ([::1]:42662 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nO0ce-00006H-IM for importer@patchew.org; Sat, 26 Feb 2022 12:12:44 -0500 Received: from eggs.gnu.org ([209.51.188.92]:60544) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nO0XZ-0008Kj-Ck for qemu-devel@nongnu.org; Sat, 26 Feb 2022 12:07:30 -0500 Received: from [2607:f8b0:4864:20::d2b] (port=36815 helo=mail-io1-xd2b.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nO0XU-0000Qi-RG for qemu-devel@nongnu.org; Sat, 26 Feb 2022 12:07:27 -0500 Received: by mail-io1-xd2b.google.com with SMTP id r7so10204930iot.3 for ; Sat, 26 Feb 2022 09:07:24 -0800 (PST) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id e23-20020a6b5017000000b00635b8032d45sm3138764iob.22.2022.02.26.09.07.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 26 Feb 2022 09:07:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=HIQRCpKDC1DawVWcpCJ93ZH5gff2VvNr1ZGmkk/0YIk=; b=Rmr5fu+CEwQDxbZXq8/NPnfE/pskvERsN6VS0eNLfH+FuH7aXDJtJhb3ChE/9SQIEP MyFxMR6ZI8MuTxcrURM4/uGatYhLfvHMTjjq5sQZXb9nagLlrwr/3j3Q95LuiHw2TAbX sT0RfsQ3U7LYv7tnPHSB5FJ2kjbzLoF2lJcd/2CEuTLPOE/FO4WldP2M/ENmdB2GejtI 3IcGwt12GicTbU+8RVE5DwvyJ6hBoVwdmHwpK/MyB/Mu3i41ijmbEbBF4sSRmuluCxg6 n/12J98MhPmbN7u8ZawBvHgCNiMO2uR0C1MwnXUHTECFVjseea2eX3OvvdHaZzqAc9jZ 1D9A== 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=HIQRCpKDC1DawVWcpCJ93ZH5gff2VvNr1ZGmkk/0YIk=; b=V29GPwquFSwshQdvVVHr1tm/nL6QNoVAD+PumvJt3cZ1njRsNNyrelRhizRMfSHWER xfKP2KRzHQHV8U1tmaK9fWP5yrMVpYB/LriHamMW6uJMEfSKdp9FSj5PzZE0LeWotrGs N714emG0kYaqC+vPlK/Xzcx8kRtd7/k4eGtB9dan06jLo3APeUP8nUbE8ZFKPqS70kzV FFy1sIXCD9wzJ/rlan8WZDwWcufzwmMFSsRYaw1qPBG+V+FDsEOkGun0Q7QTy1gHX2N2 9kaAJIa45KHnJbr5ZJf4UV7agWpB343wVn/kiz2e0sr84mCCxWtX8f01Yy/9Na6+bo0l OY4g== X-Gm-Message-State: AOAM5325o4/HfyOdMrK4Bs4oklWrWSoPSDbJGSf7Hqzb2DRfQGf0akBy 8Qf5+cv0TDB3Fchn+o38VcK8bYaF1ljkag== X-Google-Smtp-Source: ABdhPJw2uKlRZ5P0le7N+dgyQm9NDzVviQjFIHeZulPMuU2Mrw1ULLckUDseEfArp++g8pHDt4R05g== X-Received: by 2002:a02:a1d6:0:b0:314:af71:b38a with SMTP id o22-20020a02a1d6000000b00314af71b38amr10598261jah.95.1645895243394; Sat, 26 Feb 2022 09:07:23 -0800 (PST) From: Warner Losh To: qemu-devel@nongnu.org Subject: [PATCH v2 11/16] bsd-user/sycall.c: Now obsolete, remove Date: Sat, 26 Feb 2022 10:07:39 -0700 Message-Id: <20220226170744.76615-12-imp@bsdimp.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220226170744.76615-1-imp@bsdimp.com> References: <20220226170744.76615-1-imp@bsdimp.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::d2b (failed) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: none client-ip=2607:f8b0:4864:20::d2b; envelope-from=imp@bsdimp.com; helo=mail-io1-xd2b.google.com X-Spam_score_int: -4 X-Spam_score: -0.5 X-Spam_bar: / X-Spam_report: (-0.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 , arrowd@FreeBSD.org, Kyle Evans , Richard Henderson , def@FreeBSD.org, jrtc27@FreeBSD.org, Warner Losh , Brad Smith Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1645895567468100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Warner Losh Reviewed-by: Kyle Evans Reviewed-by: Richard Henderson --- bsd-user/syscall.c | 516 --------------------------------------------- 1 file changed, 516 deletions(-) delete mode 100644 bsd-user/syscall.c diff --git a/bsd-user/syscall.c b/bsd-user/syscall.c deleted file mode 100644 index d3322760f43..00000000000 --- a/bsd-user/syscall.c +++ /dev/null @@ -1,516 +0,0 @@ -/* - * BSD syscalls - * - * Copyright (c) 2003 - 2008 Fabrice Bellard - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see . - */ -#include "qemu/osdep.h" -#include "qemu/cutils.h" -#include "qemu/path.h" -#include -#include -#include -#include - -#include "qemu.h" -#include "qemu-common.h" -#include "user/syscall-trace.h" - -//#define DEBUG - -static abi_ulong target_brk; -static abi_ulong target_original_brk; - -abi_long get_errno(abi_long ret) -{ - if (ret =3D=3D -1) { - /* XXX need to translate host -> target errnos here */ - return -(errno); - } - return ret; -} - -#define target_to_host_bitmask(x, tbl) (x) - -bool is_error(abi_long ret) -{ - return (abi_ulong)ret >=3D (abi_ulong)(-4096); -} - -void target_set_brk(abi_ulong new_brk) -{ - target_original_brk =3D target_brk =3D HOST_PAGE_ALIGN(new_brk); -} - -/* do_obreak() must return target errnos. */ -static abi_long do_obreak(abi_ulong new_brk) -{ - abi_ulong brk_page; - abi_long mapped_addr; - int new_alloc_size; - - if (!new_brk) - return 0; - if (new_brk < target_original_brk) - return -TARGET_EINVAL; - - brk_page =3D HOST_PAGE_ALIGN(target_brk); - - /* If the new brk is less than this, set it and we're done... */ - if (new_brk < brk_page) { - target_brk =3D new_brk; - return 0; - } - - /* We need to allocate more memory after the brk... */ - new_alloc_size =3D HOST_PAGE_ALIGN(new_brk - brk_page + 1); - mapped_addr =3D get_errno(target_mmap(brk_page, new_alloc_size, - PROT_READ|PROT_WRITE, - MAP_ANON|MAP_FIXED|MAP_PRIVATE, -1= , 0)); - - if (!is_error(mapped_addr)) - target_brk =3D new_brk; - else - return mapped_addr; - - return 0; -} - -#ifdef __FreeBSD__ -/* - * XXX this uses the undocumented oidfmt interface to find the kind of - * a requested sysctl, see /sys/kern/kern_sysctl.c:sysctl_sysctl_oidfmt() - * (this is mostly copied from src/sbin/sysctl/sysctl.c) - */ -static int -oidfmt(int *oid, int len, char *fmt, uint32_t *kind) -{ - int qoid[CTL_MAXNAME+2]; - uint8_t buf[BUFSIZ]; - int i; - size_t j; - - qoid[0] =3D 0; - qoid[1] =3D 4; - memcpy(qoid + 2, oid, len * sizeof(int)); - - j =3D sizeof(buf); - i =3D sysctl(qoid, len + 2, buf, &j, 0, 0); - if (i) - return i; - - if (kind) - *kind =3D *(uint32_t *)buf; - - if (fmt) - strcpy(fmt, (char *)(buf + sizeof(uint32_t))); - return (0); -} - -/* - * try and convert sysctl return data for the target. - * XXX doesn't handle CTLTYPE_OPAQUE and CTLTYPE_STRUCT. - */ -static int sysctl_oldcvt(void *holdp, size_t holdlen, uint32_t kind) -{ - switch (kind & CTLTYPE) { - case CTLTYPE_INT: - case CTLTYPE_UINT: - *(uint32_t *)holdp =3D tswap32(*(uint32_t *)holdp); - break; -#ifdef TARGET_ABI32 - case CTLTYPE_LONG: - case CTLTYPE_ULONG: - *(uint32_t *)holdp =3D tswap32(*(long *)holdp); - break; -#else - case CTLTYPE_LONG: - *(uint64_t *)holdp =3D tswap64(*(long *)holdp); - break; - case CTLTYPE_ULONG: - *(uint64_t *)holdp =3D tswap64(*(unsigned long *)holdp); - break; -#endif -#ifdef CTLTYPE_U64 - case CTLTYPE_S64: - case CTLTYPE_U64: -#else - case CTLTYPE_QUAD: -#endif - *(uint64_t *)holdp =3D tswap64(*(uint64_t *)holdp); - break; - case CTLTYPE_STRING: - break; - default: - /* XXX unhandled */ - return -1; - } - return 0; -} - -/* XXX this needs to be emulated on non-FreeBSD hosts... */ -static abi_long do_freebsd_sysctl(abi_ulong namep, int32_t namelen, abi_ul= ong oldp, - abi_ulong oldlenp, abi_ulong newp, abi_ulong new= len) -{ - abi_long ret; - void *hnamep, *holdp, *hnewp =3D NULL; - size_t holdlen; - abi_ulong oldlen =3D 0; - int32_t *snamep =3D g_malloc(sizeof(int32_t) * namelen), *p, *q, i; - uint32_t kind =3D 0; - - if (oldlenp) - get_user_ual(oldlen, oldlenp); - if (!(hnamep =3D lock_user(VERIFY_READ, namep, namelen, 1))) - return -TARGET_EFAULT; - if (newp && !(hnewp =3D lock_user(VERIFY_READ, newp, newlen, 1))) - return -TARGET_EFAULT; - if (!(holdp =3D lock_user(VERIFY_WRITE, oldp, oldlen, 0))) - return -TARGET_EFAULT; - holdlen =3D oldlen; - for (p =3D hnamep, q =3D snamep, i =3D 0; i < namelen; p++, i++) - *q++ =3D tswap32(*p); - oidfmt(snamep, namelen, NULL, &kind); - /* XXX swap hnewp */ - ret =3D get_errno(sysctl(snamep, namelen, holdp, &holdlen, hnewp, newl= en)); - if (!ret) - sysctl_oldcvt(holdp, holdlen, kind); - put_user_ual(holdlen, oldlenp); - unlock_user(hnamep, namep, 0); - unlock_user(holdp, oldp, holdlen); - if (hnewp) - unlock_user(hnewp, newp, 0); - g_free(snamep); - return ret; -} -#endif - -/* FIXME - * lock_iovec()/unlock_iovec() have a return code of 0 for success where - * other lock functions have a return code of 0 for failure. - */ -static abi_long lock_iovec(int type, struct iovec *vec, abi_ulong target_a= ddr, - int count, int copy) -{ - struct target_iovec *target_vec; - abi_ulong base; - int i; - - target_vec =3D lock_user(VERIFY_READ, target_addr, count * sizeof(stru= ct target_iovec), 1); - if (!target_vec) - return -TARGET_EFAULT; - for (i =3D 0;i < count; i++) { - base =3D tswapl(target_vec[i].iov_base); - vec[i].iov_len =3D tswapl(target_vec[i].iov_len); - if (vec[i].iov_len !=3D 0) { - vec[i].iov_base =3D lock_user(type, base, vec[i].iov_len, copy= ); - /* Don't check lock_user return value. We must call writev even - if a element has invalid base address. */ - } else { - /* zero length pointer is ignored */ - vec[i].iov_base =3D NULL; - } - } - unlock_user (target_vec, target_addr, 0); - return 0; -} - -static abi_long unlock_iovec(struct iovec *vec, abi_ulong target_addr, - int count, int copy) -{ - struct target_iovec *target_vec; - abi_ulong base; - int i; - - target_vec =3D lock_user(VERIFY_READ, target_addr, count * sizeof(stru= ct target_iovec), 1); - if (!target_vec) - return -TARGET_EFAULT; - for (i =3D 0;i < count; i++) { - if (target_vec[i].iov_base) { - base =3D tswapl(target_vec[i].iov_base); - unlock_user(vec[i].iov_base, base, copy ? vec[i].iov_len : 0); - } - } - unlock_user (target_vec, target_addr, 0); - - return 0; -} - -/* do_syscall() should always have a single exit point at the end so - that actions, such as logging of syscall results, can be performed. - All errnos that do_syscall() returns must be -TARGET_. */ -abi_long do_freebsd_syscall(void *cpu_env, int num, abi_long arg1, - abi_long arg2, abi_long arg3, abi_long arg4, - abi_long arg5, abi_long arg6, abi_long arg7, - abi_long arg8) -{ - CPUState *cpu =3D env_cpu(cpu_env); - abi_long ret; - void *p; - -#ifdef DEBUG - gemu_log("freebsd syscall %d\n", num); -#endif - record_syscall_start(cpu, num, arg1, arg2, arg3, arg4, arg5, arg6, 0, = 0); - - if (do_strace) - print_freebsd_syscall(num, arg1, arg2, arg3, arg4, arg5, arg6); - - switch (num) { - case TARGET_FREEBSD_NR_exit: -#ifdef CONFIG_GPROF - _mcleanup(); -#endif - gdb_exit(arg1); - qemu_plugin_user_exit(); - /* XXX: should free thread stack and CPU env */ - _exit(arg1); - ret =3D 0; /* avoid warning */ - break; - case TARGET_FREEBSD_NR_read: - if (!(p =3D lock_user(VERIFY_WRITE, arg2, arg3, 0))) - goto efault; - ret =3D get_errno(read(arg1, p, arg3)); - unlock_user(p, arg2, ret); - break; - case TARGET_FREEBSD_NR_write: - if (!(p =3D lock_user(VERIFY_READ, arg2, arg3, 1))) - goto efault; - ret =3D get_errno(write(arg1, p, arg3)); - unlock_user(p, arg2, 0); - break; - case TARGET_FREEBSD_NR_writev: - { - int count =3D arg3; - struct iovec *vec; - - vec =3D alloca(count * sizeof(struct iovec)); - if (lock_iovec(VERIFY_READ, vec, arg2, count, 1) < 0) - goto efault; - ret =3D get_errno(writev(arg1, vec, count)); - unlock_iovec(vec, arg2, count, 0); - } - break; - case TARGET_FREEBSD_NR_open: - if (!(p =3D lock_user_string(arg1))) - goto efault; - ret =3D get_errno(open(path(p), - target_to_host_bitmask(arg2, fcntl_flags_tbl), - arg3)); - unlock_user(p, arg1, 0); - break; - case TARGET_FREEBSD_NR_mmap: - ret =3D get_errno(target_mmap(arg1, arg2, arg3, - target_to_host_bitmask(arg4, mmap_flag= s_tbl), - arg5, - arg6)); - break; - case TARGET_FREEBSD_NR_mprotect: - ret =3D get_errno(target_mprotect(arg1, arg2, arg3)); - break; - case TARGET_FREEBSD_NR_break: - ret =3D do_obreak(arg1); - break; -#ifdef __FreeBSD__ - case TARGET_FREEBSD_NR___sysctl: - ret =3D do_freebsd_sysctl(arg1, arg2, arg3, arg4, arg5, arg6); - break; -#endif - case TARGET_FREEBSD_NR_sysarch: - ret =3D do_freebsd_sysarch(cpu_env, arg1, arg2); - break; - case TARGET_FREEBSD_NR_syscall: - case TARGET_FREEBSD_NR___syscall: - ret =3D do_freebsd_syscall(cpu_env,arg1 & 0xffff,arg2,arg3,arg4,ar= g5,arg6,arg7,arg8,0); - break; - default: - ret =3D get_errno(syscall(num, arg1, arg2, arg3, arg4, arg5, arg6,= arg7, arg8)); - break; - } - fail: -#ifdef DEBUG - gemu_log(" =3D %ld\n", ret); -#endif - if (do_strace) - print_freebsd_syscall_ret(num, ret); - - record_syscall_return(cpu, num, ret); - return ret; - efault: - ret =3D -TARGET_EFAULT; - goto fail; -} - -abi_long do_netbsd_syscall(void *cpu_env, int num, abi_long arg1, - abi_long arg2, abi_long arg3, abi_long arg4, - abi_long arg5, abi_long arg6) -{ - CPUState *cpu =3D env_cpu(cpu_env); - abi_long ret; - void *p; - -#ifdef DEBUG - gemu_log("netbsd syscall %d\n", num); -#endif - - record_syscall_start(cpu, num, arg1, arg2, arg3, arg4, arg5, arg6, 0, = 0); - - if (do_strace) - print_netbsd_syscall(num, arg1, arg2, arg3, arg4, arg5, arg6); - - switch (num) { - case TARGET_NETBSD_NR_exit: -#ifdef CONFIG_GPROF - _mcleanup(); -#endif - gdb_exit(arg1); - qemu_plugin_user_exit(); - /* XXX: should free thread stack and CPU env */ - _exit(arg1); - ret =3D 0; /* avoid warning */ - break; - case TARGET_NETBSD_NR_read: - if (!(p =3D lock_user(VERIFY_WRITE, arg2, arg3, 0))) - goto efault; - ret =3D get_errno(read(arg1, p, arg3)); - unlock_user(p, arg2, ret); - break; - case TARGET_NETBSD_NR_write: - if (!(p =3D lock_user(VERIFY_READ, arg2, arg3, 1))) - goto efault; - ret =3D get_errno(write(arg1, p, arg3)); - unlock_user(p, arg2, 0); - break; - case TARGET_NETBSD_NR_open: - if (!(p =3D lock_user_string(arg1))) - goto efault; - ret =3D get_errno(open(path(p), - target_to_host_bitmask(arg2, fcntl_flags_tbl), - arg3)); - unlock_user(p, arg1, 0); - break; - case TARGET_NETBSD_NR_mmap: - ret =3D get_errno(target_mmap(arg1, arg2, arg3, - target_to_host_bitmask(arg4, mmap_flag= s_tbl), - arg5, - arg6)); - break; - case TARGET_NETBSD_NR_mprotect: - ret =3D get_errno(target_mprotect(arg1, arg2, arg3)); - break; - case TARGET_NETBSD_NR_syscall: - case TARGET_NETBSD_NR___syscall: - ret =3D do_netbsd_syscall(cpu_env,arg1 & 0xffff,arg2,arg3,arg4,arg= 5,arg6,0); - break; - default: - ret =3D syscall(num, arg1, arg2, arg3, arg4, arg5, arg6); - break; - } - fail: -#ifdef DEBUG - gemu_log(" =3D %ld\n", ret); -#endif - if (do_strace) - print_netbsd_syscall_ret(num, ret); - - record_syscall_return(cpu, num, ret); - return ret; - efault: - ret =3D -TARGET_EFAULT; - goto fail; -} - -abi_long do_openbsd_syscall(void *cpu_env, int num, abi_long arg1, - abi_long arg2, abi_long arg3, abi_long arg4, - abi_long arg5, abi_long arg6) -{ - CPUState *cpu =3D env_cpu(cpu_env); - abi_long ret; - void *p; - -#ifdef DEBUG - gemu_log("openbsd syscall %d\n", num); -#endif - - record_syscall_start(cpu, num, arg1, arg2, arg3, arg4, arg5, arg6, 0, = 0); - - if (do_strace) - print_openbsd_syscall(num, arg1, arg2, arg3, arg4, arg5, arg6); - - switch (num) { - case TARGET_OPENBSD_NR_exit: -#ifdef CONFIG_GPROF - _mcleanup(); -#endif - gdb_exit(arg1); - qemu_plugin_user_exit(); - /* XXX: should free thread stack and CPU env */ - _exit(arg1); - ret =3D 0; /* avoid warning */ - break; - case TARGET_OPENBSD_NR_read: - if (!(p =3D lock_user(VERIFY_WRITE, arg2, arg3, 0))) - goto efault; - ret =3D get_errno(read(arg1, p, arg3)); - unlock_user(p, arg2, ret); - break; - case TARGET_OPENBSD_NR_write: - if (!(p =3D lock_user(VERIFY_READ, arg2, arg3, 1))) - goto efault; - ret =3D get_errno(write(arg1, p, arg3)); - unlock_user(p, arg2, 0); - break; - case TARGET_OPENBSD_NR_open: - if (!(p =3D lock_user_string(arg1))) - goto efault; - ret =3D get_errno(open(path(p), - target_to_host_bitmask(arg2, fcntl_flags_tbl), - arg3)); - unlock_user(p, arg1, 0); - break; - case TARGET_OPENBSD_NR_mmap: - ret =3D get_errno(target_mmap(arg1, arg2, arg3, - target_to_host_bitmask(arg4, mmap_flag= s_tbl), - arg5, - arg6)); - break; - case TARGET_OPENBSD_NR_mprotect: - ret =3D get_errno(target_mprotect(arg1, arg2, arg3)); - break; - case TARGET_OPENBSD_NR_syscall: - case TARGET_OPENBSD_NR___syscall: - ret =3D do_openbsd_syscall(cpu_env,arg1 & 0xffff,arg2,arg3,arg4,ar= g5,arg6,0); - break; - default: - ret =3D syscall(num, arg1, arg2, arg3, arg4, arg5, arg6); - break; - } - fail: -#ifdef DEBUG - gemu_log(" =3D %ld\n", ret); -#endif - if (do_strace) - print_openbsd_syscall_ret(num, ret); - - record_syscall_return(cpu, num, ret); - return ret; - efault: - ret =3D -TARGET_EFAULT; - goto fail; -} - -void syscall_init(void) -{ -} --=20 2.33.1 From nobody Fri May 17 09:38:21 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1645895557905231.90575979334824; Sat, 26 Feb 2022 09:12:37 -0800 (PST) Received: from localhost ([::1]:42242 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nO0cW-0008Ec-OU for importer@patchew.org; Sat, 26 Feb 2022 12:12:36 -0500 Received: from eggs.gnu.org ([209.51.188.92]:60556) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nO0Xa-0008Kl-EI for qemu-devel@nongnu.org; Sat, 26 Feb 2022 12:07:30 -0500 Received: from [2607:f8b0:4864:20::d36] (port=37557 helo=mail-io1-xd36.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nO0XW-0000Qo-CK for qemu-devel@nongnu.org; Sat, 26 Feb 2022 12:07:27 -0500 Received: by mail-io1-xd36.google.com with SMTP id c23so10209249ioi.4 for ; Sat, 26 Feb 2022 09:07:25 -0800 (PST) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id e23-20020a6b5017000000b00635b8032d45sm3138764iob.22.2022.02.26.09.07.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 26 Feb 2022 09:07:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=VjL7Mev6xqaa0v+8+i8B7VWCn7P7IPzcwixzN9m4rZc=; b=4pyid3TVD4uNIxYBUCoIvu5H/nqMYC9lkPTpRUbauaZDgCdC1P1dDe+FvnnDyhQr98 HR/w0Rv+TcqS5o+Ableiotl2EC3tAVVu6Qa3lktKCEmZCj7SqOpW5kkQlHC7SLp2b+hD 6HYDwdR2U7Vtm17XIuC1d5vVc+d5pmtEWBFTHyNK4s3iNCWUtVgBPICH4+PL+3Esyznc sjm07f98kim7M7uVRa5zFcG168f4SH7Vi+cmjwTbpK7q2DeydwM4jaEzFUdaAHrRavvG ZO2ihEMj++09mA1HlJSHr0sRfFHjc6WRyd2XByRZzUvgBdLy7trQTfUEJl69ky7GklrZ /iJQ== 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=VjL7Mev6xqaa0v+8+i8B7VWCn7P7IPzcwixzN9m4rZc=; b=fXmNkbeL69LTsfxdKOjH2PTx0nHS9wY3o0NVjDjOwzy7XQ1OILfBRxdySJEDnn0yiI uxXqJKW06xZSPVhufUJdhOdIdqpozxoGZ0l04QZ8/tqJH7adG6BOqqcdZGrijyVgVsF/ kPXS/cYmzYdlRVlCOjnhLnqKndGfD7PyLdGYC7HXw5nmWqjwIcnm+Cq1v15w+gP4q5yk mLWpMCaRGMaFP1jhvecASPA+34sLf2P0U1kskvloq31tn9qp/rBOU0rPZwACpHdDfBo8 avG7eLzjFmYHELkAigqW1nNTh8ITHu8ya6XqfPIWtTPv89+xInilQc2wwgCA/hbFF+Lv sZRw== X-Gm-Message-State: AOAM530aPKzTK4z+NC4/s4k4mLeKX89yDiqjsyE2tTljO99dc5YZArAo 3dMOw2hyW9pi8knITq0wZpM54A3nTLTPkA== X-Google-Smtp-Source: ABdhPJw6YqGvarNshSzfKWOw1qW7j972vcAW0IFXLQTnlTQ0Kxe9iNXf2mYK3oiDJe9TmKQpDlHWww== X-Received: by 2002:a02:69cc:0:b0:314:3518:780b with SMTP id e195-20020a0269cc000000b003143518780bmr10202373jac.133.1645895244375; Sat, 26 Feb 2022 09:07:24 -0800 (PST) From: Warner Losh To: qemu-devel@nongnu.org Subject: [PATCH v2 12/16] bsd-user/freebsd/os-syscall.c: Add get_errno and host_to_target_errno Date: Sat, 26 Feb 2022 10:07:40 -0700 Message-Id: <20220226170744.76615-13-imp@bsdimp.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220226170744.76615-1-imp@bsdimp.com> References: <20220226170744.76615-1-imp@bsdimp.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::d36 (failed) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: none client-ip=2607:f8b0:4864:20::d36; envelope-from=imp@bsdimp.com; helo=mail-io1-xd36.google.com X-Spam_score_int: -4 X-Spam_score: -0.5 X-Spam_bar: / X-Spam_report: (-0.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 , arrowd@FreeBSD.org, Kyle Evans , Richard Henderson , def@FreeBSD.org, jrtc27@FreeBSD.org, Warner Losh , Brad Smith Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1645895559301100001 Content-Type: text/plain; charset="utf-8" Add the helper functions get_errno and host_to_target_errno. get_errno returns either the system call results, or the -errno when system call indicates failure by returning -1. Host_to_target_errno returns errno (since on FreeBSD they are the same on all architectures) along with a comment about why it's the identity. Signed-off-by: Warner Losh Reviewed-by: Kyle Evans Reviewed-by: Richard Henderson --- bsd-user/freebsd/os-syscall.c | 23 ++++++++++++++++++++++- bsd-user/qemu.h | 3 ++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/bsd-user/freebsd/os-syscall.c b/bsd-user/freebsd/os-syscall.c index fc57e324173..597a41c2f50 100644 --- a/bsd-user/freebsd/os-syscall.c +++ b/bsd-user/freebsd/os-syscall.c @@ -45,9 +45,30 @@ void target_set_brk(abi_ulong new_brk) { } =20 -bool is_error(abi_long ret) +/* + * errno conversion. + */ +abi_long get_errno(abi_long ret) { + if (ret =3D=3D -1) { + return -host_to_target_errno(errno); + } else { + return ret; + } +} =20 +int host_to_target_errno(int err) +{ + /* + * All the BSDs have the property that the error numbers are uniform a= cross + * all architectures for a given BSD, though they may vary between dif= ferent + * BSDs. + */ + return err; +} + +bool is_error(abi_long ret) +{ return (abi_ulong)ret >=3D (abi_ulong)(-4096); } =20 diff --git a/bsd-user/qemu.h b/bsd-user/qemu.h index e5742bd6c03..56042ddbc5d 100644 --- a/bsd-user/qemu.h +++ b/bsd-user/qemu.h @@ -246,9 +246,10 @@ extern unsigned long target_dflssiz; extern unsigned long target_maxssiz; extern unsigned long target_sgrowsiz; =20 -/* syscall.c */ +/* os-syscall.c */ abi_long get_errno(abi_long ret); bool is_error(abi_long ret); +int host_to_target_errno(int err); =20 /* os-sys.c */ abi_long do_freebsd_sysarch(void *cpu_env, abi_long arg1, abi_long arg2); --=20 2.33.1 From nobody Fri May 17 09:38:21 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1645895896202127.71039333738474; Sat, 26 Feb 2022 09:18:16 -0800 (PST) Received: from localhost ([::1]:58356 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nO0hz-0002N7-2o for importer@patchew.org; Sat, 26 Feb 2022 12:18:15 -0500 Received: from eggs.gnu.org ([209.51.188.92]:60568) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nO0Xb-0008MQ-GX for qemu-devel@nongnu.org; Sat, 26 Feb 2022 12:07:32 -0500 Received: from [2607:f8b0:4864:20::d35] (port=33391 helo=mail-io1-xd35.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nO0XW-0000R0-QP for qemu-devel@nongnu.org; Sat, 26 Feb 2022 12:07:28 -0500 Received: by mail-io1-xd35.google.com with SMTP id 195so10261448iou.0 for ; Sat, 26 Feb 2022 09:07:26 -0800 (PST) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id e23-20020a6b5017000000b00635b8032d45sm3138764iob.22.2022.02.26.09.07.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 26 Feb 2022 09:07:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=eZAk+HxivcsVXdzMR+tdKprIWyAWN9zGQFho4BCOxTM=; b=UiC0dSiY+iEnf971gV5E90S00XLB/6RQNFutAjtl/yWuYWOgJR+5o4Wvsn7pKidz0k 3mF8DOfNTnQ5b5xpIJbF52f+Vl/Q69cdaUfqjPValorIaVdO0g0G11nCtnhiWU0NihmH qz6szljQRtXPtFF9pS0URZgrWneyI2MmubiZxxA4RWBDFkNny+NXOcLnrjCg3e9+3TzJ 9z5whifYsAdZFnenPWZETyL4NeRkcKQMKzDqKWyLTphCl4qbc9NEebbUgO3WYhsDJdXW uGoQQJdf2B8p6koPiwk+yQt+Jlm7wddvmWX9AdH72YANa/xIe7Qu3SMEyq04EEWcbU+s d5SA== 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=eZAk+HxivcsVXdzMR+tdKprIWyAWN9zGQFho4BCOxTM=; b=DQVtQATnh4XlZSqinWbr8gXGc3U3Lfw3dk4XSu4f7vJTubACm9/m4bLAHn5lDwHRxt 6jrGaBpTcZQqnc3jOs6Ofbnzuy3UEdngQiYUwD8PEwXD7u7y/+wNvtNgEHFREcHcE3SV 0EmWrA/4znGEyYNsqEUe19P+v+VfIFwssU51UUgyDPOpi+o1T5tGtz704f+loHOL/1SW x+lcjBv+cWtl4qP1Fj2LOuVvVxp2LTAuyJT3EY4XQO7f8RF62i2iTFt/Adkr4V49bdcd QBFfUB+lA9z+D4p0kZ3qKWyzc/lLK5URsgy2m0Sf/hjCN5cb65IKMaB5tmvtP59Nqz0/ bT7Q== X-Gm-Message-State: AOAM533upCWoUz3B9NMN6UYjw42rYarqsMXKU1QzbtcS+y4ofMHE/WRy wcsS6IaIIeEsqzJlhWxFCp5qaF4gXhpjKw== X-Google-Smtp-Source: ABdhPJy7TIWvLpmNujUEsP2kBiIbATcxcqTFypGo3Rrx85kQvt3W+P7hNlx3zaw3WQMjVwbZ61qfXQ== X-Received: by 2002:a6b:a0d:0:b0:641:4da9:db9b with SMTP id z13-20020a6b0a0d000000b006414da9db9bmr9382705ioi.166.1645895245521; Sat, 26 Feb 2022 09:07:25 -0800 (PST) From: Warner Losh To: qemu-devel@nongnu.org Subject: [PATCH v2 13/16] bsd-user/bsd-file.h: Implementation details for the filesystem calls Date: Sat, 26 Feb 2022 10:07:41 -0700 Message-Id: <20220226170744.76615-14-imp@bsdimp.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220226170744.76615-1-imp@bsdimp.com> References: <20220226170744.76615-1-imp@bsdimp.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::d35 (failed) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: none client-ip=2607:f8b0:4864:20::d35; envelope-from=imp@bsdimp.com; helo=mail-io1-xd35.google.com X-Spam_score_int: -4 X-Spam_score: -0.5 X-Spam_bar: / X-Spam_report: (-0.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 , arrowd@FreeBSD.org, Kyle Evans , Richard Henderson , def@FreeBSD.org, jrtc27@FreeBSD.org, Warner Losh , Brad Smith Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1645895897598100001 Content-Type: text/plain; charset="utf-8" An include file that pulls in all the definitions needed for the file related system calls. This also includes the host definitions to implement the system calls and some helper routines to lock/unlock different aspects of the system call arguments. Signed-off-by: Warner Losh --- bsd-user/bsd-file.h | 30 ++++++++++++++++++++++++++++++ bsd-user/freebsd/os-syscall.c | 2 ++ 2 files changed, 32 insertions(+) create mode 100644 bsd-user/bsd-file.h diff --git a/bsd-user/bsd-file.h b/bsd-user/bsd-file.h new file mode 100644 index 00000000000..f0c3f347ec0 --- /dev/null +++ b/bsd-user/bsd-file.h @@ -0,0 +1,30 @@ +/* + * file related system call shims and definitions + * + * Copyright (c) 2013 Stacey D. Son + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +#ifndef BSD_FILE_H_ +#define BSD_FILE_H_ + +#include "qemu/path.h" + +extern struct iovec *lock_iovec(int type, abi_ulong target_addr, int count, + int copy); +extern void unlock_iovec(struct iovec *vec, abi_ulong target_addr, int cou= nt, + int copy); + +#endif /* !BSD_FILE_H_ */ diff --git a/bsd-user/freebsd/os-syscall.c b/bsd-user/freebsd/os-syscall.c index 597a41c2f50..a17ff9f6ecc 100644 --- a/bsd-user/freebsd/os-syscall.c +++ b/bsd-user/freebsd/os-syscall.c @@ -41,6 +41,8 @@ #include "signal-common.h" #include "user/syscall-trace.h" =20 +#include "bsd-file.h" + void target_set_brk(abi_ulong new_brk) { } --=20 2.33.1 From nobody Fri May 17 09:38:21 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1645896209396107.43374153850823; Sat, 26 Feb 2022 09:23:29 -0800 (PST) Received: from localhost ([::1]:41252 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nO0n1-0001Z1-Ue for importer@patchew.org; Sat, 26 Feb 2022 12:23:27 -0500 Received: from eggs.gnu.org ([209.51.188.92]:60594) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nO0Xc-0008N9-Ky for qemu-devel@nongnu.org; Sat, 26 Feb 2022 12:07:32 -0500 Received: from [2607:f8b0:4864:20::d2d] (port=34502 helo=mail-io1-xd2d.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nO0XZ-0000RZ-5R for qemu-devel@nongnu.org; Sat, 26 Feb 2022 12:07:32 -0500 Received: by mail-io1-xd2d.google.com with SMTP id f14so10230319ioz.1 for ; Sat, 26 Feb 2022 09:07:27 -0800 (PST) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id e23-20020a6b5017000000b00635b8032d45sm3138764iob.22.2022.02.26.09.07.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 26 Feb 2022 09:07:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=g2a4iUrTub2nz3g1lIS5iV9/jqK5TM3KXVGIVjpt/k4=; b=ZC3ZLBuI8smnKr5OJUbtyGkKZpLo7K1i8nsBgYwdRgQHBixuK7V/CtZmQkTlQdVrwa WRdmiMoKHDzE8FPXkRWSWzGXx7gPXxKWtPSfh3o9GVqTSdSF3Vmm6qtSX8bdNHAXjcgh Y0wTyj1WF3/5TO/9sST9l10MoJHSwBqrHjQexEgLFNwauURkHevAp3pprRW9eVl+ai6f Vq6wteKgqvId+lQsOGI8/3KBozOHIw0oV6U3nlsMQtwkOge2QywiB5OOaZ2P8l5P14IY Pfh2pG+EJQqD+6Ru05IU/PnxX8K+odGv+l1Q5Cuwa+kwHYxenzRM1aXxbAty3zrofI+7 vmBQ== 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=g2a4iUrTub2nz3g1lIS5iV9/jqK5TM3KXVGIVjpt/k4=; b=v2ow12k2iC2LPUh/mBA8/ngkjRVE0zNe3iJwDRKWQRjhmQ8tlZZM8CbEK/XTZ1Z40k 5iClFNsbSH2As1ig862j+m3D7l9nTiVoH00qVmXW7BKzFtm/hFs2LUQ/7RjijCW1y2PJ 1tnlnGPIT6G9v3em6bYgTLsDj8Rv2H/1W477A6H9Y9WIWoLHiO6iIPITV8P2VkxL53qD Soj5kdd2biPkCBZuVbPvxZaK3wXnSx5CPLZEldr6fmb3vtxUOMcw5nqV8C0JelYIhQav M92i3WhrWdVSy/mcqR4+wvoFaalxxQtQ/4YRUuOjPshMnHildU5Vb6RS3uGSqOboUraL tSYA== X-Gm-Message-State: AOAM532815bdMYxZfjrqHlg+Jk4wwRk0D7NruYdhXwrCgiw5KMg4mZgL vif7EuzPSXof+VclocRFfIGQvnnR9Wn8sQ== X-Google-Smtp-Source: ABdhPJzeacKxKO3dzqGCZxuIAtZmTb1plNNb+cPr4UYPaBUNxAG+iuRwrUvWGssvuK+BfkKnBoqvzQ== X-Received: by 2002:a05:6638:92a:b0:314:ed12:9b3d with SMTP id 10-20020a056638092a00b00314ed129b3dmr10743840jak.229.1645895246450; Sat, 26 Feb 2022 09:07:26 -0800 (PST) From: Warner Losh To: qemu-devel@nongnu.org Subject: [PATCH v2 14/16] bsd-user: introduce target.h Date: Sat, 26 Feb 2022 10:07:42 -0700 Message-Id: <20220226170744.76615-15-imp@bsdimp.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220226170744.76615-1-imp@bsdimp.com> References: <20220226170744.76615-1-imp@bsdimp.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::d2d (failed) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: none client-ip=2607:f8b0:4864:20::d2d; envelope-from=imp@bsdimp.com; helo=mail-io1-xd2d.google.com X-Spam_score_int: -4 X-Spam_score: -0.5 X-Spam_bar: / X-Spam_report: (-0.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 , arrowd@FreeBSD.org, Kyle Evans , Richard Henderson , def@FreeBSD.org, jrtc27@FreeBSD.org, Warner Losh , Brad Smith Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1645896211833100001 Content-Type: text/plain; charset="utf-8" Create target.h. This file is intended to be simple and describe basic things about the architecture. If something is a basic feature of the architecture, it belongs here. Should we need something that's per-BSD there will be a target-os.h that will live in the per-bsd directories. Define regpairs_aligned to reflect whether or not registers are 'paired' for 64-bit arguments or not. This will be false for all 64-bit targets, and will be true on those architectures that pair (currently just armv7 and powerpc on FreeBSD 14.x). Signed-off-by: Warner Losh Reviewed-by: Kyle Evans Reviewed-by: Richard Henderson --- bsd-user/arm/target.h | 21 +++++++++++++++++++++ bsd-user/i386/target.h | 21 +++++++++++++++++++++ bsd-user/qemu.h | 1 + bsd-user/x86_64/target.h | 21 +++++++++++++++++++++ 4 files changed, 64 insertions(+) create mode 100644 bsd-user/arm/target.h create mode 100644 bsd-user/i386/target.h create mode 100644 bsd-user/x86_64/target.h diff --git a/bsd-user/arm/target.h b/bsd-user/arm/target.h new file mode 100644 index 00000000000..419c039b68e --- /dev/null +++ b/bsd-user/arm/target.h @@ -0,0 +1,21 @@ +/* + * Intel general target stuff that's common to all i386 details + * + * Copyright (c) 2022 M. Warner Losh + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#ifndef TARGET_H +#define TARGET_H + +/* + * arm EABI 'lumps' the registers for 64-bit args. + */ +static inline bool regpairs_aligned(void *cpu_env) +{ + return true; +} + +#endif /* ! TARGET_H */ + diff --git a/bsd-user/i386/target.h b/bsd-user/i386/target.h new file mode 100644 index 00000000000..9b9df047a3b --- /dev/null +++ b/bsd-user/i386/target.h @@ -0,0 +1,21 @@ +/* + * Intel general target stuff that's common to all i386 details + * + * Copyright (c) 2022 M. Warner Losh + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#ifndef TARGET_ARCH_H +#define TARGET_ARCH_H + +/* + * i386 doesn't 'lump' the registers for 64-bit args. + */ +static inline bool regpairs_aligned(void *cpu_env) +{ + return false; +} + +#endif /* ! TARGET_ARCH_H */ + diff --git a/bsd-user/qemu.h b/bsd-user/qemu.h index 56042ddbc5d..a9efa807b78 100644 --- a/bsd-user/qemu.h +++ b/bsd-user/qemu.h @@ -35,6 +35,7 @@ extern char **environ; #include "target_syscall.h" #include "target_os_vmparam.h" #include "target_os_signal.h" +#include "target.h" #include "exec/gdbstub.h" =20 /* diff --git a/bsd-user/x86_64/target.h b/bsd-user/x86_64/target.h new file mode 100644 index 00000000000..8956631db1d --- /dev/null +++ b/bsd-user/x86_64/target.h @@ -0,0 +1,21 @@ +/* + * Intel general target stuff that's common to all x86_64 details + * + * Copyright (c) 2022 M. Warner Losh + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#ifndef TARGET_H +#define TARGET_H + +/* + * x86 doesn't 'lump' the registers for 64-bit args, all args are 64 bits. + */ +static inline bool regpairs_aligned(void *cpu_env) +{ + return false; +} + +#endif /* ! TARGET_H */ + --=20 2.33.1 From nobody Fri May 17 09:38:21 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1645895740635364.86971791905694; Sat, 26 Feb 2022 09:15:40 -0800 (PST) Received: from localhost ([::1]:51300 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nO0fT-0005wv-Jl for importer@patchew.org; Sat, 26 Feb 2022 12:15:39 -0500 Received: from eggs.gnu.org ([209.51.188.92]:60608) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nO0Xd-0008Ny-EL for qemu-devel@nongnu.org; Sat, 26 Feb 2022 12:07:34 -0500 Received: from [2607:f8b0:4864:20::130] (port=36700 helo=mail-il1-x130.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nO0Xa-0000Rf-J1 for qemu-devel@nongnu.org; Sat, 26 Feb 2022 12:07:32 -0500 Received: by mail-il1-x130.google.com with SMTP id e11so6847621ils.3 for ; Sat, 26 Feb 2022 09:07:28 -0800 (PST) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id e23-20020a6b5017000000b00635b8032d45sm3138764iob.22.2022.02.26.09.07.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 26 Feb 2022 09:07:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=7Y45btB372BUYpl0DMg2V5qSfR8CjjH9rCY8SnGr7hw=; b=3sEK3M6Vha1V7yF9Y/xaKbKkal+cJnkNErJDh0OANbY3cEhC3AW5qV+Pr/iSYFmQ9/ oPp0IQGLx+XgTEDNdWtdUvbAdIWoOosCUVI3sauDxvpvr20Sgl5HP8v51DfSvAxHZ6v1 Ty6gpXYP/bM7TnYvo7Fdl/eB4At03iuwo0LjMJBHe1VLAAvmB4Mn8UZoyqNT9ydecNaw xQO4BX+4TWmIzewd+goRslYA7lvlJaCLcJxj0DdoyIr9lWCNVwF5DV6+rEUG2KYadPRH uVi/nIpg8T0OTYz10MOatU0co6ZgjR7K6SAwT07oP6YULbvnG5fWnap8y0dRo9CAQeV0 IB4A== 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=7Y45btB372BUYpl0DMg2V5qSfR8CjjH9rCY8SnGr7hw=; b=OP5k0vnja5w225zt6xy8cNT1NYlyxiGaQSwuogHUVgruiL+Pyy9wfW3IppUizUSjVH +8fewZoGOqwxK9d5zWbhwcc1gKRSgJpCBUTCjyPV1ZoN+6WmlFEyIoCNtIW47/UnZf9j xSwdUAY+YHsAjkMq4rA8oWk8PsQ4cg9qa+dv+in0HojXydbFcofKKR7lhTNvVczCALma hf9E8BKfjC3rmX+4PqXOhZMosLpLdLOXcMtvcgId2EJw7ERJs12ESWUi+u0I6dp81rV2 e9KATo1i35ujSUodbWekV1lhc3hYICX/oiLiXhXPpn2MYOv2JC/RDOwYAeJb8JF0oAXd gWAg== X-Gm-Message-State: AOAM530MWOiiVW+jxyvHaGkEFjj0FDZpKzyLRUpMJr+e73nzu1Gy6ZPB pgBNroUykDtfEiKxE4Ftojt5SNksWdgtrA== X-Google-Smtp-Source: ABdhPJxrTjue1flmymB72PZaI+bew2ezSWn/nMhmFffo52Tai55uJjwyivUmOQRTJdZbdtIOF8VLuw== X-Received: by 2002:a92:ca0f:0:b0:2c2:59c6:e32b with SMTP id j15-20020a92ca0f000000b002c259c6e32bmr10929134ils.224.1645895247182; Sat, 26 Feb 2022 09:07:27 -0800 (PST) From: Warner Losh To: qemu-devel@nongnu.org Subject: [PATCH v2 15/16] bsd-user: Define target_arg64 Date: Sat, 26 Feb 2022 10:07:43 -0700 Message-Id: <20220226170744.76615-16-imp@bsdimp.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220226170744.76615-1-imp@bsdimp.com> References: <20220226170744.76615-1-imp@bsdimp.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::130 (failed) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: none client-ip=2607:f8b0:4864:20::130; envelope-from=imp@bsdimp.com; helo=mail-il1-x130.google.com X-Spam_score_int: -4 X-Spam_score: -0.5 X-Spam_bar: / X-Spam_report: (-0.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 , Stacey Son , arrowd@FreeBSD.org, Kyle Evans , Richard Henderson , def@FreeBSD.org, jrtc27@FreeBSD.org, Warner Losh , Brad Smith Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1645895742562100001 Content-Type: text/plain; charset="utf-8" target_arg64 is a generic way to extract 64-bits from a pair of arguments. On 32-bit platforms, it returns them joined together as appropriate. On 64-bit platforms, it returns the first arg because it's already 64-bits. Signed-off-by: Stacey Son Signed-off-by: Warner Losh Reviewed-by: Kyle Evans Reviewed-by: Richard Henderson --- bsd-user/qemu.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/bsd-user/qemu.h b/bsd-user/qemu.h index a9efa807b78..af272c2a802 100644 --- a/bsd-user/qemu.h +++ b/bsd-user/qemu.h @@ -462,6 +462,19 @@ static inline void *lock_user_string(abi_ulong guest_a= ddr) #define unlock_user_struct(host_ptr, guest_addr, copy) \ unlock_user(host_ptr, guest_addr, (copy) ? sizeof(*host_ptr) : 0) =20 +static inline uint64_t target_arg64(uint32_t word0, uint32_t word1) +{ +#if TARGET_ABI_BITS =3D=3D 32 +#ifdef TARGET_WORDS_BIGENDIAN + return ((uint64_t)word0 << 32) | word1; +#else + return ((uint64_t)word1 << 32) | word0; +#endif +#else /* TARGET_ABI_BITS !=3D 32 */ + return word0; +#endif /* TARGET_ABI_BITS !=3D 32 */ +} + #include =20 #include "user/safe-syscall.h" --=20 2.33.1 From nobody Fri May 17 09:38:21 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1645895715575165.35064723362927; Sat, 26 Feb 2022 09:15:15 -0800 (PST) Received: from localhost ([::1]:50700 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nO0f4-0005XD-NB for importer@patchew.org; Sat, 26 Feb 2022 12:15:14 -0500 Received: from eggs.gnu.org ([209.51.188.92]:60614) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nO0Xd-0008O1-RR for qemu-devel@nongnu.org; Sat, 26 Feb 2022 12:07:34 -0500 Received: from [2607:f8b0:4864:20::131] (port=36701 helo=mail-il1-x131.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nO0Xb-0000Ro-AD for qemu-devel@nongnu.org; Sat, 26 Feb 2022 12:07:33 -0500 Received: by mail-il1-x131.google.com with SMTP id e11so6847644ils.3 for ; Sat, 26 Feb 2022 09:07:29 -0800 (PST) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id e23-20020a6b5017000000b00635b8032d45sm3138764iob.22.2022.02.26.09.07.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 26 Feb 2022 09:07:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=rjqNkZos8HcanC51tcv3i0kE1ONfZDlQEksCXgwLEAI=; b=vwjnhPmML5AvtPYhCC/qU0MSgDlrdAzG+xJ00MPa8m+QpVodMLrMb0WyfMiYjN40bV W9t3vUkl5QjXTevBg/HmLHvuhPVH4x2mv/VZykqCS1u9nhzNKgtqGaz08WdfF3XiFTUq jDlIU3ox13bg27okWvMjYPRo+F0JaAhI3+IR/DjLjfO9cU2uzxRd069lSBXYVMzyF+RV 0wdqf/KRnhZ7Hdn4Cv2biWQjcN4x/IEbh8tC9MyCf7qEePDl/bgoM3Old2GI1owGesLu ZOzqK1jyR2D+4PxPqW96+zJIIPtIjITSEkVcZAscCyP9tNoSAZ1XRytFX43bzHMrXqA5 nTCQ== 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=rjqNkZos8HcanC51tcv3i0kE1ONfZDlQEksCXgwLEAI=; b=gJ01SuRwNvkH5k0IQwMuT5CA1/+nsmP0IOMGa6KphU0PkW8ANxQmuxVc5NqQe7uRx4 ldbDwzw5xkRxdw8JVkkQGQL/ThihhmCLyOp/XXcTeDKGQOenREH+hFt+E64nJCFJ/cqL +G9uMO8ICWxE/kNMIHJ2xuS81s9e7hC3rzSBjlKz7G/jU60gFLhmLQiBYuB6PYAU5xb2 3v6jdemoUyvt2Hz4S+vZvzpUtUseg+uhyjtxuddCe2kREr1wa9BHYb2zieAx5pjgO7KP v9PEAw5705oAyGu8fNCV4wazlV7mtwH4XX/K0i6nyBMzfC0PLDbY9TQ8s8TCR9ikmEtF 0nnw== X-Gm-Message-State: AOAM530v/mYdq1EC9K0S4DqWeCXPQRmIbYaxu5ZB78zELTPWyzDP/u4o HZ/1fII1spnHB764EwnyP1x0wuUmbhrW0A== X-Google-Smtp-Source: ABdhPJzmFWTq18UF0VxAfbJytiN6TO1Y7/UpH4/0GjWCci02ZBovTSqgI/zYdK1qPUL8CJB3v8ykDA== X-Received: by 2002:a05:6e02:15c2:b0:2b8:4642:8e3c with SMTP id q2-20020a056e0215c200b002b846428e3cmr10895893ilu.244.1645895248258; Sat, 26 Feb 2022 09:07:28 -0800 (PST) From: Warner Losh To: qemu-devel@nongnu.org Subject: [PATCH v2 16/16] bsd-user: Add safe system call macros Date: Sat, 26 Feb 2022 10:07:44 -0700 Message-Id: <20220226170744.76615-17-imp@bsdimp.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220226170744.76615-1-imp@bsdimp.com> References: <20220226170744.76615-1-imp@bsdimp.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::131 (failed) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: none client-ip=2607:f8b0:4864:20::131; envelope-from=imp@bsdimp.com; helo=mail-il1-x131.google.com X-Spam_score_int: -4 X-Spam_score: -0.5 X-Spam_bar: / X-Spam_report: (-0.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 , arrowd@FreeBSD.org, Kyle Evans , Richard Henderson , def@FreeBSD.org, jrtc27@FreeBSD.org, Warner Losh , Brad Smith Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1645895716244100003 Content-Type: text/plain; charset="utf-8" Add a series of macros to create system call macros that go via the safe_syscall path. Signed-off-by: Kyle Evans Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/syscall_defs.h | 47 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/bsd-user/syscall_defs.h b/bsd-user/syscall_defs.h index 62b472b990b..c3bf14f38f4 100644 --- a/bsd-user/syscall_defs.h +++ b/bsd-user/syscall_defs.h @@ -179,4 +179,51 @@ struct target_freebsd__wrusage { struct target_freebsd_rusage wru_children; }; =20 +#define safe_syscall0(type, name) \ +type safe_##name(void) \ +{ \ + return safe_syscall(SYS_##name); \ +} + +#define safe_syscall1(type, name, type1, arg1) \ +type safe_##name(type1 arg1) \ +{ \ + return safe_syscall(SYS_##name, arg1); \ +} + +#define safe_syscall2(type, name, type1, arg1, type2, arg2) \ +type safe_##name(type1 arg1, type2 arg2) \ +{ \ + return safe_syscall(SYS_##name, arg1, arg2); \ +} + +#define safe_syscall3(type, name, type1, arg1, type2, arg2, type3, arg3) \ +type safe_##name(type1 arg1, type2 arg2, type3 arg3) \ +{ \ + return safe_syscall(SYS_##name, arg1, arg2, arg3); \ +} + +#define safe_syscall4(type, name, type1, arg1, type2, arg2, type3, arg3, \ + type4, arg4) \ +type safe_##name(type1 arg1, type2 arg2, type3 arg3, type4 arg4) \ +{ \ + return safe_syscall(SYS_##name, arg1, arg2, arg3, arg4); \ +} + +#define safe_syscall5(type, name, type1, arg1, type2, arg2, type3, arg3, \ + type4, arg4, type5, arg5) \ +type safe_##name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, \ + type5 arg5) \ +{ \ + return safe_syscall(SYS_##name, arg1, arg2, arg3, arg4, arg5); \ +} + +#define safe_syscall6(type, name, type1, arg1, type2, arg2, type3, arg3, \ + type4, arg4, type5, arg5, type6, arg6) \ +type safe_##name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, \ + type5 arg5, type6 arg6) \ +{ \ + return safe_syscall(SYS_##name, arg1, arg2, arg3, arg4, arg5, arg6); \ +} + #endif /* ! _SYSCALL_DEFS_H_ */ --=20 2.33.1