From patchwork Sat Apr 24 15:59:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1469936 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=bsdimp-com.20150623.gappssmtp.com header.i=@bsdimp-com.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=tSgdyN42; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FSGDN2ylqz9sVw for ; Sun, 25 Apr 2021 02:03:46 +1000 (AEST) Received: from localhost ([::1]:40958 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1laKkx-00073c-59 for incoming@patchwork.ozlabs.org; Sat, 24 Apr 2021 12:03:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50040) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1laKhs-0005MC-8A for qemu-devel@nongnu.org; Sat, 24 Apr 2021 12:00:33 -0400 Received: from mail-io1-xd33.google.com ([2607:f8b0:4864:20::d33]:34657) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1laKhp-0004B0-4d for qemu-devel@nongnu.org; Sat, 24 Apr 2021 12:00:32 -0400 Received: by mail-io1-xd33.google.com with SMTP id l21so8547795iob.1 for ; Sat, 24 Apr 2021 09:00:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=1/0ZDjPpNKimgApH3VJbA8iqD7cHZMxKyxi6PoUgZmI=; b=tSgdyN42kSFrr/nLVBYqH9HjNVv25apObBYhGEF4YHkTaIVmHI0vVXAZYk53zFr//I hQ+BumOWezTrlOYbqVRI/eO89IxNfUc4AL15kuzMHzW1Ogs1TjY30F5hMfBRmZGZCsF9 qzBZv4otgGl6uVu+1NVqDwgBNFAiZXOJQ6T3FQqb6kKPTpzsZe2Gxa90TIpcnewcoMqP y9wWg5sjuZ22bY2ZsxF2LZUXzKdXP4C7gm8Ld7o+3ucM5yOpWEBjpxOZj2fciTuDTtMA Fy8VADOgLz+sAGKYWHk3Gw8MxHmwKHgUMJlT/O2GbWXtFF0dRUlwr+su/NNmIiT41A/v jS1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=1/0ZDjPpNKimgApH3VJbA8iqD7cHZMxKyxi6PoUgZmI=; b=JGZeyHhxCeFwWgUrKNtvauYlSl1sTg66PRv3P2rlE96kUCd6m9jg4KyDwVpAF/xSP4 nCj86kstGuLYvOUU+8rIHDanIjGbf7UC08VRK/SLuwfkPSW2M2EhqwJWXIchRfxtf+vX og2+NBeympMmK+hs1NsN36R+kXxW9jDt4ypqwNb8Oon/PzjpWLUsq97qGkAOBl7CB16r tnKbbWL8GSjgBNj28PKPvQmvtM2JS5E5ucaIOzFvE4kz961z6ypo7NgHstxt1gZIxlSu Dpt0N2R5Gzt4rxs9NeH+no6F/Ffv9evI7UivJNsECYQlpw+Mr3H+8SRjQ/qShlr4Sxrl 1dXw== X-Gm-Message-State: AOAM531S/5r5H/8uiBWLMPQU7omL/vmtI6ldxsBJIgz8gEunTS5tTale VW/FfULkGdemUMERZfpCRU0a4bWi6Pyme2NP X-Google-Smtp-Source: ABdhPJzS1UlXg+M89hc54toKfiNiiERcNORPEFaZ4jsuLhwEahmLxb4gnIhuXNI/JAHDEAYQOVkAIw== X-Received: by 2002:a6b:ce12:: with SMTP id p18mr7542817iob.199.1619280027412; Sat, 24 Apr 2021 09:00:27 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id h4sm4055901ili.52.2021.04.24.09.00.26 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 24 Apr 2021 09:00:27 -0700 (PDT) From: imp@bsdimp.com To: qemu-devel@nongnu.org Subject: [PATCH v2 01/48] bsd-user: whitespace changes Date: Sat, 24 Apr 2021 09:59:29 -0600 Message-Id: <20210424160016.15200-2-imp@bsdimp.com> X-Mailer: git-send-email 2.22.1 In-Reply-To: <20210424160016.15200-1-imp@bsdimp.com> References: <20210424160016.15200-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::d33; envelope-from=imp@bsdimp.com; helo=mail-io1-xd33.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kevans@freebsd.org, Richard Henderson , arichardson@freebsd.org, Warner Losh Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Warner Losh keyword space paren, no space before ( in function calls, spaces around operators. Reviewed-by: Richard Henderson Signed-off-by: Warner Losh --- bsd-user/bsdload.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/bsd-user/bsdload.c b/bsd-user/bsdload.c index f38c4faacf..546946b91d 100644 --- a/bsd-user/bsdload.c +++ b/bsd-user/bsdload.c @@ -20,11 +20,11 @@ abi_long memcpy_to_target(abi_ulong dest, const void *src, return 0; } -static int count(char ** vec) +static int count(char **vec) { int i; - for(i = 0; *vec; i++) { + for (i = 0; *vec; i++) { vec++; } @@ -37,15 +37,15 @@ static int prepare_binprm(struct linux_binprm *bprm) int mode; int retval; - if(fstat(bprm->fd, &st) < 0) { + if (fstat(bprm->fd, &st) < 0) { return(-errno); } mode = st.st_mode; - if(!S_ISREG(mode)) { /* Must be regular file */ + if (!S_ISREG(mode)) { /* Must be regular file */ return(-EACCES); } - if(!(mode & 0111)) { /* Must have at least one execute bit set */ + if (!(mode & 0111)) { /* Must have at least one execute bit set */ return(-EACCES); } @@ -53,7 +53,7 @@ static int prepare_binprm(struct linux_binprm *bprm) bprm->e_gid = getegid(); /* Set-uid? */ - if(mode & S_ISUID) { + if (mode & S_ISUID) { bprm->e_uid = st.st_uid; } @@ -69,10 +69,10 @@ static int prepare_binprm(struct linux_binprm *bprm) memset(bprm->buf, 0, sizeof(bprm->buf)); retval = lseek(bprm->fd, 0L, SEEK_SET); - if(retval >= 0) { + if (retval >= 0) { retval = read(bprm->fd, bprm->buf, 128); } - if(retval < 0) { + if (retval < 0) { perror("prepare_binprm"); exit(-1); /* return(-errno); */ @@ -125,15 +125,15 @@ abi_ulong loader_build_argptr(int envc, int argc, abi_ulong sp, return sp; } -int loader_exec(const char * filename, char ** argv, char ** envp, - struct target_pt_regs * regs, struct image_info *infop) +int loader_exec(const char *filename, char **argv, char **envp, + struct target_pt_regs *regs, struct image_info *infop) { struct linux_binprm bprm; int retval; int i; - bprm.p = TARGET_PAGE_SIZE*MAX_ARG_PAGES-sizeof(unsigned int); - for (i=0 ; i=0) { + if (retval >= 0) { if (bprm.buf[0] == 0x7f && bprm.buf[1] == 'E' && bprm.buf[2] == 'L' && bprm.buf[3] == 'F') { - retval = load_elf_binary(&bprm,regs,infop); + retval = load_elf_binary(&bprm, regs, infop); } else { fprintf(stderr, "Unknown binary format\n"); return -1; } } - if(retval>=0) { + if (retval >= 0) { /* success. Initialize important registers */ do_init_thread(regs, infop); return retval; } /* Something went wrong, return the inode and free the argument pages*/ - for (i=0 ; i X-Patchwork-Id: 1469942 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=bsdimp-com.20150623.gappssmtp.com header.i=@bsdimp-com.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=yEINUFVz; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FSGKb2wpkz9sVw for ; Sun, 25 Apr 2021 02:08:19 +1000 (AEST) Received: from localhost ([::1]:53920 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1laKpN-0004oY-E6 for incoming@patchwork.ozlabs.org; Sat, 24 Apr 2021 12:08:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50108) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1laKhw-0005SY-RH for qemu-devel@nongnu.org; Sat, 24 Apr 2021 12:00:36 -0400 Received: from mail-io1-xd35.google.com ([2607:f8b0:4864:20::d35]:41516) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1laKhq-0004Br-52 for qemu-devel@nongnu.org; Sat, 24 Apr 2021 12:00:36 -0400 Received: by mail-io1-xd35.google.com with SMTP id f21so15648034ioh.8 for ; Sat, 24 Apr 2021 09:00:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=eLSunyF7yqNE6jwrYnXqTpq83LjJhVTopLCSU9ZyU5Q=; b=yEINUFVz4xH4Y1ikNC0Tyd6uoblZXafUr611Iy4jdeol480nBeh+iY1l44kOPPa72F m7Y91La7og1HqJQQYw/8R0kVSYCABG9K6dHWlFwno2DF9L2BsYK7xUZh7lYU4Xfa/8jU S9425HlrqXg6N9Oto1eEeDImZ0D9tVofBYQd1Eq5sW3JzWYi6eoYqjxK8oNoTS9zu1T2 b7HO69jjhSiwqHIisYpE6+va8+baVlgJij7PpBErB29ftF77W+1n0Fs4NjmdVOPm1p7Q oY+7M+G6/mPaMgRAl2MCVQ5ksiyUs+Ewo2X0UYtCiP1IoiDWpms/KDYSexsGoU7yieMt 1CAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=eLSunyF7yqNE6jwrYnXqTpq83LjJhVTopLCSU9ZyU5Q=; b=CobvX2OnEcivIny73W3DgiuKh7jqgjVxz8EckK8skKB2SN/GjXPXQUJDxf1c8slAQM 56pQjPseKXcOlWgIt9W5r/I6CAPkRayicw6vA0hwX7UN/KJguCIzbTnDBYkO9y6thizZ cz+iAQiL8rWorj+mrBq4dQvJ53s75DYrgfVogZb9EKaTh8wv8eDlIKoJXhVmzRt7ZLhd Tby6cc+a3BYKMpRKIAq/eF14MS0BbbCYaI4ScXFWi7kq4uuYsUPqVPhg4B/8D0vp/E9g giEapJMNk23MHAxq2qYNmBqaooZ48g1Au3ZaH88HSBTSpDpaDl0NapReDvz8BMAmgrLs HqBA== X-Gm-Message-State: AOAM5336rsnzDof5+hDl0BF9GJJjjg/eM0G+JxxGUUx5JqKt8tM08ZlC tOCTJDhz0qjjpoRWoFyvmavx/5fekC/7oefY X-Google-Smtp-Source: ABdhPJziMkvyF9PF9KlByAyKne4kYEIVOZZizgVAfHzDqapQzr+alVdP98mwlGjRJCjLglS+OJvk8g== X-Received: by 2002:a5e:880c:: with SMTP id l12mr7484726ioj.195.1619280028320; Sat, 24 Apr 2021 09:00:28 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id h4sm4055901ili.52.2021.04.24.09.00.27 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 24 Apr 2021 09:00:27 -0700 (PDT) From: imp@bsdimp.com To: qemu-devel@nongnu.org Subject: [PATCH v2 02/48] bsd-user: whitespace changes Date: Sat, 24 Apr 2021 09:59:30 -0600 Message-Id: <20210424160016.15200-3-imp@bsdimp.com> X-Mailer: git-send-email 2.22.1 In-Reply-To: <20210424160016.15200-1-imp@bsdimp.com> References: <20210424160016.15200-1-imp@bsdimp.com> MIME-Version: 1.0 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: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kevans@freebsd.org, Richard Henderson , arichardson@freebsd.org, Warner Losh Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Warner Losh Fix various whitespace-only issues from checkpatch: keyword space ( no space before ( on function calls spaces around operators suspect indentations (including one functions reindented) extra spaces around unary operators Reviewed-by: Richard Henderson Signed-off-by: Warner Losh --- bsd-user/elfload.c | 326 ++++++++++++++++++++++----------------------- 1 file changed, 163 insertions(+), 163 deletions(-) diff --git a/bsd-user/elfload.c b/bsd-user/elfload.c index 5f4d824d78..3c9d8c2845 100644 --- a/bsd-user/elfload.c +++ b/bsd-user/elfload.c @@ -111,7 +111,7 @@ static uint32_t get_elf_hwcap(void) #ifdef TARGET_X86_64 #define ELF_START_MMAP 0x2aaaaab000ULL -#define elf_check_arch(x) ( ((x) == ELF_ARCH) ) +#define elf_check_arch(x) (((x) == ELF_ARCH)) #define ELF_CLASS ELFCLASS64 #define ELF_DATA ELFDATA2LSB @@ -134,7 +134,7 @@ static inline void init_thread(struct target_pt_regs *regs, struct image_info *i /* * This is used to ensure we don't load something for the wrong architecture. */ -#define elf_check_arch(x) ( ((x) == EM_386) || ((x) == EM_486) ) +#define elf_check_arch(x) (((x) == EM_386) || ((x) == EM_486)) /* * These are used to set parameters in the core dumps. @@ -168,7 +168,7 @@ static inline void init_thread(struct target_pt_regs *regs, struct image_info *i #define ELF_START_MMAP 0x80000000 -#define elf_check_arch(x) ( (x) == EM_ARM ) +#define elf_check_arch(x) ((x) == EM_ARM) #define ELF_CLASS ELFCLASS32 #ifdef TARGET_WORDS_BIGENDIAN @@ -184,7 +184,7 @@ static inline void init_thread(struct target_pt_regs *regs, struct image_info *i memset(regs, 0, sizeof(*regs)); regs->ARM_cpsr = 0x10; if (infop->entry & 1) - regs->ARM_cpsr |= CPSR_T; + regs->ARM_cpsr |= CPSR_T; regs->ARM_pc = infop->entry & 0xfffffffe; regs->ARM_sp = infop->start_stack; /* FIXME - what to for failure of get_user()? */ @@ -224,9 +224,9 @@ enum #define ELF_START_MMAP 0x80000000 #ifndef TARGET_ABI32 -#define elf_check_arch(x) ( (x) == EM_SPARCV9 || (x) == EM_SPARC32PLUS ) +#define elf_check_arch(x) ((x) == EM_SPARCV9 || (x) == EM_SPARC32PLUS) #else -#define elf_check_arch(x) ( (x) == EM_SPARC32PLUS || (x) == EM_SPARC ) +#define elf_check_arch(x) ((x) == EM_SPARC32PLUS || (x) == EM_SPARC) #endif #define ELF_CLASS ELFCLASS64 @@ -261,7 +261,7 @@ static inline void init_thread(struct target_pt_regs *regs, struct image_info *i #else #define ELF_START_MMAP 0x80000000 -#define elf_check_arch(x) ( (x) == EM_SPARC ) +#define elf_check_arch(x) ((x) == EM_SPARC) #define ELF_CLASS ELFCLASS32 #define ELF_DATA ELFDATA2MSB @@ -285,13 +285,13 @@ static inline void init_thread(struct target_pt_regs *regs, struct image_info *i #if defined(TARGET_PPC64) && !defined(TARGET_ABI32) -#define elf_check_arch(x) ( (x) == EM_PPC64 ) +#define elf_check_arch(x) ((x) == EM_PPC64) #define ELF_CLASS ELFCLASS64 #else -#define elf_check_arch(x) ( (x) == EM_PPC ) +#define elf_check_arch(x) ((x) == EM_PPC) #define ELF_CLASS ELFCLASS32 @@ -376,7 +376,7 @@ static inline void init_thread(struct target_pt_regs *_regs, struct image_info * #define ELF_START_MMAP 0x80000000 -#define elf_check_arch(x) ( (x) == EM_MIPS ) +#define elf_check_arch(x) ((x) == EM_MIPS) #ifdef TARGET_MIPS64 #define ELF_CLASS ELFCLASS64 @@ -406,7 +406,7 @@ static inline void init_thread(struct target_pt_regs *regs, struct image_info *i #define ELF_START_MMAP 0x80000000 -#define elf_check_arch(x) ( (x) == EM_SH ) +#define elf_check_arch(x) ((x) == EM_SH) #define ELF_CLASS ELFCLASS32 #define ELF_DATA ELFDATA2LSB @@ -428,7 +428,7 @@ static inline void init_thread(struct target_pt_regs *regs, struct image_info *i #define ELF_START_MMAP 0x80000000 -#define elf_check_arch(x) ( (x) == EM_CRIS ) +#define elf_check_arch(x) ((x) == EM_CRIS) #define ELF_CLASS ELFCLASS32 #define ELF_DATA ELFDATA2LSB @@ -448,7 +448,7 @@ static inline void init_thread(struct target_pt_regs *regs, struct image_info *i #define ELF_START_MMAP 0x80000000 -#define elf_check_arch(x) ( (x) == EM_68K ) +#define elf_check_arch(x) ((x) == EM_68K) #define ELF_CLASS ELFCLASS32 #define ELF_DATA ELFDATA2MSB @@ -473,7 +473,7 @@ static inline void init_thread(struct target_pt_regs *regs, struct image_info *i #define ELF_START_MMAP (0x30000000000ULL) -#define elf_check_arch(x) ( (x) == ELF_ARCH ) +#define elf_check_arch(x) ((x) == ELF_ARCH) #define ELF_CLASS ELFCLASS64 #define ELF_DATA ELFDATA2MSB @@ -538,8 +538,8 @@ struct exec /* Necessary parameters */ #define TARGET_ELF_EXEC_PAGESIZE TARGET_PAGE_SIZE -#define TARGET_ELF_PAGESTART(_v) ((_v) & ~(unsigned long)(TARGET_ELF_EXEC_PAGESIZE-1)) -#define TARGET_ELF_PAGEOFFSET(_v) ((_v) & (TARGET_ELF_EXEC_PAGESIZE-1)) +#define TARGET_ELF_PAGESTART(_v) ((_v) & ~(unsigned long)(TARGET_ELF_EXEC_PAGESIZE - 1)) +#define TARGET_ELF_PAGEOFFSET(_v) ((_v) & (TARGET_ELF_EXEC_PAGESIZE - 1)) #define INTERPRETER_NONE 0 #define INTERPRETER_AOUT 1 @@ -547,12 +547,12 @@ struct exec #define DLINFO_ITEMS 12 -static inline void memcpy_fromfs(void * to, const void * from, unsigned long n) +static inline void memcpy_fromfs(void *to, const void *from, unsigned long n) { memcpy(to, from, n); } -static int load_aout_interp(void * exptr, int interp_fd); +static int load_aout_interp(void *exptr, int interp_fd); #ifdef BSWAP_NEEDED static void bswap_ehdr(struct elfhdr *ehdr) @@ -613,7 +613,7 @@ static void bswap_sym(struct elf_sym *sym) * to be put directly into the top of new user memory. * */ -static abi_ulong copy_elf_strings(int argc,char ** argv, void **page, +static abi_ulong copy_elf_strings(int argc, char **argv, void **page, abi_ulong p) { char *tmp, *tmp1, *pag = NULL; @@ -638,10 +638,10 @@ static abi_ulong copy_elf_strings(int argc,char ** argv, void **page, --p; --tmp; --len; if (--offset < 0) { offset = p % TARGET_PAGE_SIZE; - pag = (char *)page[p/TARGET_PAGE_SIZE]; + pag = (char *)page[p / TARGET_PAGE_SIZE]; if (!pag) { pag = g_try_malloc0(TARGET_PAGE_SIZE); - page[p/TARGET_PAGE_SIZE] = pag; + page[p / TARGET_PAGE_SIZE] = pag; if (!pag) return 0; } @@ -672,8 +672,8 @@ static abi_ulong setup_arg_pages(abi_ulong p, struct linux_binprm *bprm, * it for args, we'll use it for something else... */ size = x86_stack_size; - if (size < MAX_ARG_PAGES*TARGET_PAGE_SIZE) - size = MAX_ARG_PAGES*TARGET_PAGE_SIZE; + if (size < MAX_ARG_PAGES * TARGET_PAGE_SIZE) + size = MAX_ARG_PAGES * TARGET_PAGE_SIZE; error = target_mmap(0, size + qemu_host_page_size, PROT_READ | PROT_WRITE, @@ -686,7 +686,7 @@ static abi_ulong setup_arg_pages(abi_ulong p, struct linux_binprm *bprm, /* we reserve one extra page at the top of the stack as guard */ target_mprotect(error + size, qemu_host_page_size, PROT_NONE); - stack_base = error + size - MAX_ARG_PAGES*TARGET_PAGE_SIZE; + stack_base = error + size - MAX_ARG_PAGES * TARGET_PAGE_SIZE; p += stack_base; for (i = 0 ; i < MAX_ARG_PAGES ; i++) { @@ -708,7 +708,7 @@ static void set_brk(abi_ulong start, abi_ulong end) end = HOST_PAGE_ALIGN(end); if (end <= start) return; - if(target_mmap(start, end - start, + if (target_mmap(start, end - start, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_FIXED | MAP_PRIVATE | MAP_ANON, -1, 0) == -1) { perror("cannot mmap brk"); @@ -738,12 +738,12 @@ static void padzero(abi_ulong elf_bss, abi_ulong last_bss) end_addr = HOST_PAGE_ALIGN(elf_bss); if (end_addr1 < end_addr) { mmap((void *)g2h_untagged(end_addr1), end_addr - end_addr1, - PROT_READ|PROT_WRITE|PROT_EXEC, - MAP_FIXED|MAP_PRIVATE|MAP_ANON, -1, 0); + PROT_READ | PROT_WRITE | PROT_EXEC, + MAP_FIXED | MAP_PRIVATE | MAP_ANON, -1, 0); } } - nbyte = elf_bss & (qemu_host_page_size-1); + nbyte = elf_bss & (qemu_host_page_size - 1); if (nbyte) { nbyte = qemu_host_page_size - nbyte; do { @@ -781,10 +781,10 @@ static abi_ulong create_elf_tables(abi_ulong p, int argc, int envc, /* * Force 16 byte _final_ alignment here for generality. */ - sp = sp &~ (abi_ulong)15; + sp = sp & ~(abi_ulong)15; size = (DLINFO_ITEMS + 1) * 2; if (k_platform) - size += 2; + size += 2; #ifdef DLINFO_ARCH_ITEMS size += DLINFO_ARCH_ITEMS * 2; #endif @@ -792,7 +792,7 @@ static abi_ulong create_elf_tables(abi_ulong p, int argc, int envc, size += (!ibcs ? 3 : 1); /* argc itself */ size *= n; if (size & 15) - sp -= 16 - (size & 15); + sp -= 16 - (size & 15); /* This is correct because Linux defines * elf_addr_t as Elf32_Off / Elf64_Off @@ -800,13 +800,13 @@ static abi_ulong create_elf_tables(abi_ulong p, int argc, int envc, #define NEW_AUX_ENT(id, val) do { \ sp -= n; put_user_ual(val, sp); \ sp -= n; put_user_ual(id, sp); \ - } while(0) + } while (0) - NEW_AUX_ENT (AT_NULL, 0); + NEW_AUX_ENT(AT_NULL, 0); /* There must be exactly DLINFO_ITEMS entries here. */ NEW_AUX_ENT(AT_PHDR, (abi_ulong)(load_addr + exec->e_phoff)); - NEW_AUX_ENT(AT_PHENT, (abi_ulong)(sizeof (struct elf_phdr))); + NEW_AUX_ENT(AT_PHENT, (abi_ulong)(sizeof(struct elf_phdr))); NEW_AUX_ENT(AT_PHNUM, (abi_ulong)(exec->e_phnum)); NEW_AUX_ENT(AT_PAGESZ, (abi_ulong)(TARGET_PAGE_SIZE)); NEW_AUX_ENT(AT_BASE, (abi_ulong)(interp_load_addr)); @@ -834,90 +834,90 @@ static abi_ulong create_elf_tables(abi_ulong p, int argc, int envc, } -static abi_ulong load_elf_interp(struct elfhdr * interp_elf_ex, +static abi_ulong load_elf_interp(struct elfhdr *interp_elf_ex, int interpreter_fd, abi_ulong *interp_load_addr) { - struct elf_phdr *elf_phdata = NULL; - struct elf_phdr *eppnt; - abi_ulong load_addr = 0; - int load_addr_set = 0; - int retval; - abi_ulong last_bss, elf_bss; - abi_ulong error; - int i; + struct elf_phdr *elf_phdata = NULL; + struct elf_phdr *eppnt; + abi_ulong load_addr = 0; + int load_addr_set = 0; + int retval; + abi_ulong last_bss, elf_bss; + abi_ulong error; + int i; - elf_bss = 0; - last_bss = 0; - error = 0; + elf_bss = 0; + last_bss = 0; + error = 0; #ifdef BSWAP_NEEDED - bswap_ehdr(interp_elf_ex); + bswap_ehdr(interp_elf_ex); #endif - /* First of all, some simple consistency checks */ - if ((interp_elf_ex->e_type != ET_EXEC && - interp_elf_ex->e_type != ET_DYN) || - !elf_check_arch(interp_elf_ex->e_machine)) { - return ~((abi_ulong)0UL); - } + /* First of all, some simple consistency checks */ + if ((interp_elf_ex->e_type != ET_EXEC && + interp_elf_ex->e_type != ET_DYN) || + !elf_check_arch(interp_elf_ex->e_machine)) { + return ~((abi_ulong)0UL); + } - /* Now read in all of the header information */ + /* Now read in all of the header information */ - if (sizeof(struct elf_phdr) * interp_elf_ex->e_phnum > TARGET_PAGE_SIZE) - return ~(abi_ulong)0UL; + if (sizeof(struct elf_phdr) * interp_elf_ex->e_phnum > TARGET_PAGE_SIZE) + return ~(abi_ulong)0UL; - elf_phdata = (struct elf_phdr *) - malloc(sizeof(struct elf_phdr) * interp_elf_ex->e_phnum); + elf_phdata = (struct elf_phdr *) + malloc(sizeof(struct elf_phdr) * interp_elf_ex->e_phnum); - if (!elf_phdata) - return ~((abi_ulong)0UL); + if (!elf_phdata) + return ~((abi_ulong)0UL); - /* - * If the size of this structure has changed, then punt, since - * we will be doing the wrong thing. - */ - if (interp_elf_ex->e_phentsize != sizeof(struct elf_phdr)) { - free(elf_phdata); - return ~((abi_ulong)0UL); - } + /* + * If the size of this structure has changed, then punt, since + * we will be doing the wrong thing. + */ + if (interp_elf_ex->e_phentsize != sizeof(struct elf_phdr)) { + free(elf_phdata); + return ~((abi_ulong)0UL); + } - retval = lseek(interpreter_fd, interp_elf_ex->e_phoff, SEEK_SET); - if(retval >= 0) { - retval = read(interpreter_fd, - (char *) elf_phdata, - sizeof(struct elf_phdr) * interp_elf_ex->e_phnum); - } - if (retval < 0) { - perror("load_elf_interp"); - exit(-1); - free (elf_phdata); - return retval; - } + retval = lseek(interpreter_fd, interp_elf_ex->e_phoff, SEEK_SET); + if (retval >= 0) { + retval = read(interpreter_fd, + (char *) elf_phdata, + sizeof(struct elf_phdr) * interp_elf_ex->e_phnum); + } + if (retval < 0) { + perror("load_elf_interp"); + exit(-1); + free (elf_phdata); + return retval; + } #ifdef BSWAP_NEEDED - eppnt = elf_phdata; - for (i=0; ie_phnum; i++, eppnt++) { - bswap_phdr(eppnt); - } + eppnt = elf_phdata; + for (i = 0; ie_phnum; i++, eppnt++) { + bswap_phdr(eppnt); + } #endif - if (interp_elf_ex->e_type == ET_DYN) { - /* in order to avoid hardcoding the interpreter load - address in qemu, we allocate a big enough memory zone */ - error = target_mmap(0, INTERP_MAP_SIZE, - PROT_NONE, MAP_PRIVATE | MAP_ANON, - -1, 0); - if (error == -1) { - perror("mmap"); - exit(-1); - } - load_addr = error; - load_addr_set = 1; + if (interp_elf_ex->e_type == ET_DYN) { + /* in order to avoid hardcoding the interpreter load + address in qemu, we allocate a big enough memory zone */ + error = target_mmap(0, INTERP_MAP_SIZE, + PROT_NONE, MAP_PRIVATE | MAP_ANON, + -1, 0); + if (error == -1) { + perror("mmap"); + exit(-1); } + load_addr = error; + load_addr_set = 1; + } - eppnt = elf_phdata; - for(i=0; ie_phnum; i++, eppnt++) - if (eppnt->p_type == PT_LOAD) { + eppnt = elf_phdata; + for (i = 0; i < interp_elf_ex->e_phnum; i++, eppnt++) + if (eppnt->p_type == PT_LOAD) { int elf_type = MAP_PRIVATE | MAP_DENYWRITE; int elf_prot = 0; abi_ulong vaddr = 0; @@ -930,23 +930,23 @@ static abi_ulong load_elf_interp(struct elfhdr * interp_elf_ex, elf_type |= MAP_FIXED; vaddr = eppnt->p_vaddr; } - error = target_mmap(load_addr+TARGET_ELF_PAGESTART(vaddr), - eppnt->p_filesz + TARGET_ELF_PAGEOFFSET(eppnt->p_vaddr), - elf_prot, - elf_type, - interpreter_fd, - eppnt->p_offset - TARGET_ELF_PAGEOFFSET(eppnt->p_vaddr)); + error = target_mmap(load_addr + TARGET_ELF_PAGESTART(vaddr), + eppnt->p_filesz + TARGET_ELF_PAGEOFFSET(eppnt->p_vaddr), + elf_prot, + elf_type, + interpreter_fd, + eppnt->p_offset - TARGET_ELF_PAGEOFFSET(eppnt->p_vaddr)); if (error == -1) { - /* Real error */ - close(interpreter_fd); - free(elf_phdata); - return ~((abi_ulong)0UL); + /* Real error */ + close(interpreter_fd); + free(elf_phdata); + return ~((abi_ulong)0UL); } if (!load_addr_set && interp_elf_ex->e_type == ET_DYN) { - load_addr = error; - load_addr_set = 1; + load_addr = error; + load_addr_set = 1; } /* @@ -962,31 +962,31 @@ static abi_ulong load_elf_interp(struct elfhdr * interp_elf_ex, */ k = load_addr + eppnt->p_memsz + eppnt->p_vaddr; if (k > last_bss) last_bss = k; - } + } - /* Now use mmap to map the library into memory. */ + /* Now use mmap to map the library into memory. */ - close(interpreter_fd); + close(interpreter_fd); - /* - * Now fill out the bss section. First pad the last page up - * to the page boundary, and then perform a mmap to make sure - * that there are zeromapped pages up to and including the last - * bss page. - */ - padzero(elf_bss, last_bss); - elf_bss = TARGET_ELF_PAGESTART(elf_bss + qemu_host_page_size - 1); /* What we have mapped so far */ - - /* Map the last of the bss segment */ - if (last_bss > elf_bss) { - target_mmap(elf_bss, last_bss-elf_bss, - PROT_READ|PROT_WRITE|PROT_EXEC, - MAP_FIXED|MAP_PRIVATE|MAP_ANON, -1, 0); - } - free(elf_phdata); + /* + * Now fill out the bss section. First pad the last page up + * to the page boundary, and then perform a mmap to make sure + * that there are zeromapped pages up to and including the last + * bss page. + */ + padzero(elf_bss, last_bss); + elf_bss = TARGET_ELF_PAGESTART(elf_bss + qemu_host_page_size - 1); /* What we have mapped so far */ + + /* Map the last of the bss segment */ + if (last_bss > elf_bss) { + target_mmap(elf_bss, last_bss - elf_bss, + PROT_READ | PROT_WRITE | PROT_EXEC, + MAP_FIXED | MAP_PRIVATE | MAP_ANON, -1, 0); + } + free(elf_phdata); - *interp_load_addr = load_addr; - return ((abi_ulong) interp_elf_ex->e_entry) + load_addr; + *interp_load_addr = load_addr; + return ((abi_ulong) interp_elf_ex->e_entry) + load_addr; } static int symfind(const void *s0, const void *s1) @@ -1102,7 +1102,7 @@ static void load_symbols(struct elfhdr *hdr, int fd) } continue; } -#if defined(TARGET_ARM) || defined (TARGET_MIPS) +#if defined(TARGET_ARM) || defined(TARGET_MIPS) /* The bottom address bit marks a Thumb or MIPS16 symbol. */ syms[i].st_value &= ~(target_ulong)1; #endif @@ -1143,8 +1143,8 @@ static void load_symbols(struct elfhdr *hdr, int fd) syminfos = s; } -int load_elf_binary(struct linux_binprm * bprm, struct target_pt_regs * regs, - struct image_info * info) +int load_elf_binary(struct linux_binprm *bprm, struct target_pt_regs *regs, + struct image_info *info) { struct elfhdr elf_ex; struct elfhdr interp_elf_ex; @@ -1178,13 +1178,13 @@ int load_elf_binary(struct linux_binprm * bprm, struct target_pt_regs * regs, /* First of all, some simple consistency checks */ if ((elf_ex.e_type != ET_EXEC && elf_ex.e_type != ET_DYN) || - (! elf_check_arch(elf_ex.e_machine))) { + (!elf_check_arch(elf_ex.e_machine))) { return -ENOEXEC; } bprm->p = copy_elf_strings(1, &bprm->filename, bprm->page, bprm->p); - bprm->p = copy_elf_strings(bprm->envc,bprm->envp,bprm->page,bprm->p); - bprm->p = copy_elf_strings(bprm->argc,bprm->argv,bprm->page,bprm->p); + bprm->p = copy_elf_strings(bprm->envc, bprm->envp, bprm->page,bprm->p); + bprm->p = copy_elf_strings(bprm->argc, bprm->argv, bprm->page,bprm->p); if (!bprm->p) { retval = -E2BIG; } @@ -1196,21 +1196,21 @@ int load_elf_binary(struct linux_binprm * bprm, struct target_pt_regs * regs, } retval = lseek(bprm->fd, elf_ex.e_phoff, SEEK_SET); - if(retval > 0) { - retval = read(bprm->fd, (char *) elf_phdata, + if (retval > 0) { + retval = read(bprm->fd, (char *)elf_phdata, elf_ex.e_phentsize * elf_ex.e_phnum); } if (retval < 0) { perror("load_elf_binary"); exit(-1); - free (elf_phdata); + free(elf_phdata); return -errno; } #ifdef BSWAP_NEEDED elf_ppnt = elf_phdata; - for (i=0; ip_type == PT_INTERP) { - if ( elf_interpreter != NULL ) + if (elf_interpreter != NULL) { - free (elf_phdata); + free(elf_phdata); free(elf_interpreter); close(bprm->fd); return -EINVAL; @@ -1245,16 +1245,16 @@ int load_elf_binary(struct linux_binprm * bprm, struct target_pt_regs * regs, elf_interpreter = (char *)malloc(elf_ppnt->p_filesz); if (elf_interpreter == NULL) { - free (elf_phdata); + free(elf_phdata); close(bprm->fd); return -ENOMEM; } retval = lseek(bprm->fd, elf_ppnt->p_offset, SEEK_SET); - if(retval >= 0) { + if (retval >= 0) { retval = read(bprm->fd, elf_interpreter, elf_ppnt->p_filesz); } - if(retval < 0) { + if (retval < 0) { perror("load_elf_binary2"); exit(-1); } @@ -1265,8 +1265,8 @@ int load_elf_binary(struct linux_binprm * bprm, struct target_pt_regs * regs, /* JRP - Need to add X86 lib dir stuff here... */ - if (strcmp(elf_interpreter,"/usr/lib/libc.so.1") == 0 || - strcmp(elf_interpreter,"/usr/lib/ld.so.1") == 0) { + if (strcmp(elf_interpreter, "/usr/lib/libc.so.1") == 0 || + strcmp(elf_interpreter, "/usr/lib/ld.so.1") == 0) { ibcs2_interpreter = 1; } @@ -1275,7 +1275,7 @@ int load_elf_binary(struct linux_binprm * bprm, struct target_pt_regs * regs, #endif if (retval >= 0) { retval = open(path(elf_interpreter), O_RDONLY); - if(retval >= 0) { + if (retval >= 0) { interpreter_fd = retval; } else { @@ -1287,8 +1287,8 @@ int load_elf_binary(struct linux_binprm * bprm, struct target_pt_regs * regs, if (retval >= 0) { retval = lseek(interpreter_fd, 0, SEEK_SET); - if(retval >= 0) { - retval = read(interpreter_fd,bprm->buf,128); + if (retval >= 0) { + retval = read(interpreter_fd, bprm->buf, 128); } } if (retval >= 0) { @@ -1298,7 +1298,7 @@ int load_elf_binary(struct linux_binprm * bprm, struct target_pt_regs * regs, if (retval < 0) { perror("load_elf_binary3"); exit(-1); - free (elf_phdata); + free(elf_phdata); free(elf_interpreter); close(bprm->fd); return retval; @@ -1308,17 +1308,17 @@ int load_elf_binary(struct linux_binprm * bprm, struct target_pt_regs * regs, } /* Some simple consistency checks for the interpreter */ - if (elf_interpreter){ + if (elf_interpreter) { interpreter_type = INTERPRETER_ELF | INTERPRETER_AOUT; /* Now figure out which format our binary is */ if ((N_MAGIC(interp_ex) != OMAGIC) && (N_MAGIC(interp_ex) != ZMAGIC) && (N_MAGIC(interp_ex) != QMAGIC)) { - interpreter_type = INTERPRETER_ELF; + interpreter_type = INTERPRETER_ELF; } if (interp_elf_ex.e_ident[0] != 0x7f || - strncmp((char *)&interp_elf_ex.e_ident[1], "ELF",3) != 0) { + strncmp((char *)&interp_elf_ex.e_ident[1], "ELF", 3) != 0) { interpreter_type &= ~INTERPRETER_ELF; } @@ -1334,20 +1334,20 @@ int load_elf_binary(struct linux_binprm * bprm, struct target_pt_regs * regs, and then start this sucker up */ { - char * passed_p; + char *passed_p; if (interpreter_type == INTERPRETER_AOUT) { snprintf(passed_fileno, sizeof(passed_fileno), "%d", bprm->fd); passed_p = passed_fileno; if (elf_interpreter) { - bprm->p = copy_elf_strings(1,&passed_p,bprm->page,bprm->p); + bprm->p = copy_elf_strings(1, &passed_p, bprm->page, bprm->p); bprm->argc++; } } if (!bprm->p) { free(elf_interpreter); - free (elf_phdata); + free(elf_phdata); close(bprm->fd); return -E2BIG; } @@ -1393,7 +1393,7 @@ int load_elf_binary(struct linux_binprm * bprm, struct target_pt_regs * regs, * address. */ - for(i = 0, elf_ppnt = elf_phdata; i < elf_ex.e_phnum; i++, elf_ppnt++) { + for (i = 0, elf_ppnt = elf_phdata; i < elf_ex.e_phnum; i++, elf_ppnt++) { int elf_prot = 0; int elf_flags = 0; abi_ulong error; @@ -1538,7 +1538,7 @@ int load_elf_binary(struct linux_binprm * bprm, struct target_pt_regs * regs, printf("(brk) %x\n" , info->brk); #endif - if ( info->personality == PER_SVR4 ) + if (info->personality == PER_SVR4) { /* Why this, you ask??? Well SVr4 maps page 0 as read-only, and some applications "depend" upon this behavior. @@ -1553,7 +1553,7 @@ int load_elf_binary(struct linux_binprm * bprm, struct target_pt_regs * regs, return 0; } -static int load_aout_interp(void * exptr, int interp_fd) +static int load_aout_interp(void *exptr, int interp_fd) { printf("a.out interpreter not yet supported\n"); return(0); From patchwork Sat Apr 24 15:59:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1469938 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=bsdimp-com.20150623.gappssmtp.com header.i=@bsdimp-com.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=x9XQKfJy; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FSGFB497Jz9sVw for ; Sun, 25 Apr 2021 02:04:30 +1000 (AEST) Received: from localhost ([::1]:44208 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1laKlg-0008VI-FA for incoming@patchwork.ozlabs.org; Sat, 24 Apr 2021 12:04:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50096) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1laKhw-0005Qo-2x for qemu-devel@nongnu.org; Sat, 24 Apr 2021 12:00:36 -0400 Received: from mail-io1-xd2b.google.com ([2607:f8b0:4864:20::d2b]:39637) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1laKhq-0004Bu-Gm for qemu-devel@nongnu.org; Sat, 24 Apr 2021 12:00:35 -0400 Received: by mail-io1-xd2b.google.com with SMTP id k25so8748646iob.6 for ; Sat, 24 Apr 2021 09:00:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=/OVr7/iF9QwRMuNLkTonYfMoL4e8SyG1h9wUWyeqRXo=; b=x9XQKfJyRLaeQcIdMzK78P4K4lHT5iJbUS29EpZpbNm0IgZD3hVU1pYYjueN1woPJX m50yWYPO+hozPXbss+rQlemFK4JGrNnatdqcb6h/9Iayp86uFKHE36TG98tF1wNFgPbC NvLs8BWzEPbewe4Lgp3Q4qW7ln+6lZYFLGzqysuYAa72GzP67JZAp2bGzcszybAI2SPx MAtg8VSGznxsA8fp+Bo7cYzi+DpVSTzINFVfXu/Mwb5/DZgWfMtmlaIljYdNTzTS8RCP kM3u5Ny5zfndC7YxOO7eQk3JiI4XRDppLkws+5inZZaukpPMn3mG25JitcQEh86p1kk5 Z/KQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/OVr7/iF9QwRMuNLkTonYfMoL4e8SyG1h9wUWyeqRXo=; b=Wg9Vxg3pQ6Oob94NzCswsbUEMl8b5ZWDmh3cV3koEDaM1XV0O4V6sW+oJzWDrH7wYZ kT75ixPkWGSklFLLgX3AOyjC6sGPUwUeMbzt3SepCmPq/WC9ny6N7iIj77UOJqiiwyEF Qz5Bm19OcU6h7DRPTrQsUhmNTGewOQq9p1t2BYCTGfycQKB+lFpxAV5+Kv6HIk/xH3qQ jWoZcLyOAROCB3IwQo288CbD5G0vMztlYYMsuWuYu3dA2YMp78Y9+B1hQycRou2GV9ya D1GVC10r2d41RSM1Q/Uoi6FcEWpmfesYEmGgdMQFz5CBNR761VabAtvaNKrmYwdlr7w7 5yjQ== X-Gm-Message-State: AOAM532s9jyzKFC7CIjV3gBhtaP3PQEj6TZgDVq6/tBxRt8gjDlYRLWs BoWwwGqrqrEHrxUvjTB2PEv3KL4kq6ahC57C X-Google-Smtp-Source: ABdhPJxTiI84J2+joDxd2vE1fZ0kLVER00plGlxNjUIb2C21Au3bGRksMELFq3gA5XuCLy1Xhc60DA== X-Received: by 2002:a02:4e45:: with SMTP id r66mr8208081jaa.137.1619280029063; Sat, 24 Apr 2021 09:00:29 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id h4sm4055901ili.52.2021.04.24.09.00.28 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 24 Apr 2021 09:00:28 -0700 (PDT) From: imp@bsdimp.com To: qemu-devel@nongnu.org Subject: [PATCH v2 03/48] bsd-user: whitespace changes Date: Sat, 24 Apr 2021 09:59:31 -0600 Message-Id: <20210424160016.15200-4-imp@bsdimp.com> X-Mailer: git-send-email 2.22.1 In-Reply-To: <20210424160016.15200-1-imp@bsdimp.com> References: <20210424160016.15200-1-imp@bsdimp.com> MIME-Version: 1.0 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: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kevans@freebsd.org, Richard Henderson , arichardson@freebsd.org, Warner Losh Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Warner Losh Space after keywords, no space for function calls and spaces around operators. Reviewed-by: Richard Henderson Signed-off-by: Warner Losh --- bsd-user/main.c | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/bsd-user/main.c b/bsd-user/main.c index 798aba512c..455b8eddab 100644 --- a/bsd-user/main.c +++ b/bsd-user/main.c @@ -150,13 +150,13 @@ void cpu_loop(CPUX86State *env) abi_ulong pc; //target_siginfo_t info; - for(;;) { + for (;;) { cpu_exec_start(cs); trapnr = cpu_exec(cs); cpu_exec_end(cs); process_queued_cpu_work(cs); - switch(trapnr) { + switch (trapnr) { case 0x80: /* syscall from int $0x80 */ if (bsd_type == target_freebsd) { @@ -345,7 +345,7 @@ void cpu_loop(CPUX86State *env) { int sig; - sig = gdb_handlesig (env, TARGET_SIGTRAP); + sig = gdb_handlesig(env, TARGET_SIGTRAP); if (sig) { info.si_signo = sig; @@ -398,7 +398,7 @@ static inline void save_window_offset(CPUSPARCState *env, int cwp1) printf("win_overflow: sp_ptr=0x" TARGET_ABI_FMT_lx " save_cwp=%d\n", sp_ptr, cwp1); #endif - for(i = 0; i < 16; i++) { + for (i = 0; i < 16; i++) { /* FIXME - what to do if put_user() fails? */ put_user_ual(env->regbase[get_reg_index(env, cwp1, 8 + i)], sp_ptr); sp_ptr += sizeof(abi_ulong); @@ -448,7 +448,7 @@ static void restore_window(CPUSPARCState *env) printf("win_underflow: sp_ptr=0x" TARGET_ABI_FMT_lx " load_cwp=%d\n", sp_ptr, cwp1); #endif - for(i = 0; i < 16; i++) { + for (i = 0; i < 16; i++) { /* FIXME - what to do if get_user() fails? */ get_user_ual(env->regbase[get_reg_index(env, cwp1, 8 + i)], sp_ptr); sp_ptr += sizeof(abi_ulong); @@ -468,7 +468,7 @@ static void flush_windows(CPUSPARCState *env) int offset, cwp1; offset = 1; - for(;;) { + for (;;) { /* if restore would invoke restore_window(), then we can stop */ cwp1 = cpu_cwp_inc(env, env->cwp + offset); #ifndef TARGET_SPARC64 @@ -648,11 +648,11 @@ void cpu_loop(CPUSPARCState *env) #ifdef TARGET_SPARC64 badtrap: #endif - printf ("Unhandled trap: 0x%x\n", trapnr); + printf("Unhandled trap: 0x%x\n", trapnr); cpu_dump_state(cs, stderr, 0); - exit (1); + exit(1); } - process_pending_signals (env); + process_pending_signals(env); } } @@ -825,15 +825,15 @@ int main(int argc, char **argv) } else if (!strcmp(r, "cpu")) { cpu_model = argv[optind++]; if (is_help_option(cpu_model)) { -/* XXX: implement xxx_cpu_list for targets that still miss it */ + /* XXX: implement xxx_cpu_list for targets that still miss it */ #if defined(cpu_list) - cpu_list(); + cpu_list(); #endif exit(1); } } else if (!strcmp(r, "B")) { - guest_base = strtol(argv[optind++], NULL, 0); - have_guest_base = true; + guest_base = strtol(argv[optind++], NULL, 0); + have_guest_base = true; } else if (!strcmp(r, "drop-ld-preload")) { (void) envlist_unsetenv(envlist, "LD_PRELOAD"); } else if (!strcmp(r, "bsd")) { @@ -958,7 +958,7 @@ int main(int argc, char **argv) } } - if (loader_exec(filename, argv+optind, target_environ, regs, info) != 0) { + if (loader_exec(filename, argv + optind, target_environ, regs, info) != 0) { printf("Error loading %s\n", filename); _exit(1); } @@ -1053,8 +1053,8 @@ int main(int argc, char **argv) env->idt.limit = 255; #endif env->idt.base = target_mmap(0, sizeof(uint64_t) * (env->idt.limit + 1), - PROT_READ|PROT_WRITE, - MAP_ANONYMOUS|MAP_PRIVATE, -1, 0); + PROT_READ | PROT_WRITE, + MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); idt_table = g2h_untagged(env->idt.base); set_idt(0, 0); set_idt(1, 0); @@ -1082,8 +1082,8 @@ int main(int argc, char **argv) { uint64_t *gdt_table; env->gdt.base = target_mmap(0, sizeof(uint64_t) * TARGET_GDT_ENTRIES, - PROT_READ|PROT_WRITE, - MAP_ANONYMOUS|MAP_PRIVATE, -1, 0); + PROT_READ | PROT_WRITE, + MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); env->gdt.limit = sizeof(uint64_t) * TARGET_GDT_ENTRIES - 1; gdt_table = g2h_untagged(env->gdt.base); #ifdef TARGET_ABI32 @@ -1123,9 +1123,9 @@ int main(int argc, char **argv) env->pc = regs->pc; env->npc = regs->npc; env->y = regs->y; - for(i = 0; i < 8; i++) + for (i = 0; i < 8; i++) env->gregs[i] = regs->u_regs[i]; - for(i = 0; i < 8; i++) + for (i = 0; i < 8; i++) env->regwptr[i] = regs->u_regs[i + 8]; } #else From patchwork Sat Apr 24 15:59:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1469939 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=bsdimp-com.20150623.gappssmtp.com header.i=@bsdimp-com.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=mjNn6xIK; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FSGJ452lMz9sVw for ; Sun, 25 Apr 2021 02:07:00 +1000 (AEST) Received: from localhost ([::1]:49764 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1laKo4-0002VQ-LI for incoming@patchwork.ozlabs.org; Sat, 24 Apr 2021 12:06:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50136) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1laKhx-0005UP-NA for qemu-devel@nongnu.org; Sat, 24 Apr 2021 12:00:38 -0400 Received: from mail-il1-x131.google.com ([2607:f8b0:4864:20::131]:40749) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1laKhr-0004C6-7F for qemu-devel@nongnu.org; Sat, 24 Apr 2021 12:00:37 -0400 Received: by mail-il1-x131.google.com with SMTP id c18so43123492iln.7 for ; Sat, 24 Apr 2021 09:00:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=XCvW0RvcGPuNbJcgTUYRtSCfe0vwlmcMwLQDKxcnt5Q=; b=mjNn6xIKCbI25FZmLLvwQWsPtwpLUpM7yBKcNtYJY5ilBkT8V+uxWlk+zPafhex1fs HSWvSTps3bPDmzFfU0uoczwHlw3wbs33pgPHDCcEnS2OrXXjToJO1qL/BPVFk4k9XdLm ggjq/K3Ch+mPpEvgFGfOHJ/vmKZgOyYccfzpKuZ3iQQBQqnzYkeKtovEFRI3oLAqXgOK 2XdXV4aspzAUvAfiZPP8BKG5XeogN7IOtcjFPMZqIY7haqY1HIqtSUV69xSidK3Og0OE ldXFXXPW3D/5YW5nbsQeRH2xAgi23i5CnHukROt+M8lpuzzqbT7Ldqv6RQWHvKUlIaGt 6w5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=XCvW0RvcGPuNbJcgTUYRtSCfe0vwlmcMwLQDKxcnt5Q=; b=fVDCmHOrKpmKltwKXSOlk+OELExr5LJCW+0tQVP9aj0mStB66mOrXd2neU/+4XkjDT nUFjQGysMgJAFw2BSPyLnbbdSeKcyDho4gAkmARBEbFI0dmkL4ieRuSj7PEGa1731LLD 3iF1qaag1zmc99tPU79AsLh0//lzksZshqwWfFaJ6490Yb3q4MpMNUFGFOp8pIcPCJIe uoRg8ZtfXwXZFqNnx+c78c01v2OJFST6dLE7PLlLDKKFHrWBCww0vd7scCdGHSGI8Uwj UnnxDzjbixB0lvAdiGnJuiUSdmLoKVl3NJ5qzi+SM0oju500QVhr6CaM8yA4HSHKiNwD lbUg== X-Gm-Message-State: AOAM532nYRucG5qplw6BOQHg+EN1uoYc3p2/TFnfYiMDjLvkEIFMFdv+ Vbc/oqre9N29mJocX+2+mxzZ7u/nXBTAFyHb X-Google-Smtp-Source: ABdhPJxS6atWWrufXrW3yELAswKiwr/T/RnWr/ikA6beQq2w0/ubwbrhQcOc+p+QF/jBVUzAMKIpZg== X-Received: by 2002:a05:6e02:1809:: with SMTP id a9mr7191430ilv.184.1619280029932; Sat, 24 Apr 2021 09:00:29 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id h4sm4055901ili.52.2021.04.24.09.00.29 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 24 Apr 2021 09:00:29 -0700 (PDT) From: imp@bsdimp.com To: qemu-devel@nongnu.org Subject: [PATCH v2 04/48] bsd-user: style tweak: keyword space ( Date: Sat, 24 Apr 2021 09:59:32 -0600 Message-Id: <20210424160016.15200-5-imp@bsdimp.com> X-Mailer: git-send-email 2.22.1 In-Reply-To: <20210424160016.15200-1-imp@bsdimp.com> References: <20210424160016.15200-1-imp@bsdimp.com> MIME-Version: 1.0 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: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kevans@freebsd.org, Richard Henderson , arichardson@freebsd.org, Warner Losh Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Warner Losh Reviewed-by: Richard Henderson Signed-off-by: Warner Losh --- bsd-user/mmap.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/bsd-user/mmap.c b/bsd-user/mmap.c index 01ec808003..0ac1b92706 100644 --- a/bsd-user/mmap.c +++ b/bsd-user/mmap.c @@ -93,11 +93,11 @@ int target_mprotect(abi_ulong start, abi_ulong len, int prot) if (start > host_start) { /* handle host page containing start */ prot1 = prot; - for(addr = host_start; addr < start; addr += TARGET_PAGE_SIZE) { + for (addr = host_start; addr < start; addr += TARGET_PAGE_SIZE) { prot1 |= page_get_flags(addr); } if (host_end == host_start + qemu_host_page_size) { - for(addr = end; addr < host_end; addr += TARGET_PAGE_SIZE) { + for (addr = end; addr < host_end; addr += TARGET_PAGE_SIZE) { prot1 |= page_get_flags(addr); } end = host_end; @@ -110,7 +110,7 @@ int target_mprotect(abi_ulong start, abi_ulong len, int prot) } if (end < host_end) { prot1 = prot; - for(addr = end; addr < host_end; addr += TARGET_PAGE_SIZE) { + for (addr = end; addr < host_end; addr += TARGET_PAGE_SIZE) { prot1 |= page_get_flags(addr); } ret = mprotect(g2h_untagged(host_end - qemu_host_page_size), @@ -148,7 +148,7 @@ static int mmap_frag(abi_ulong real_start, /* get the protection of the target pages outside the mapping */ prot1 = 0; - for(addr = real_start; addr < real_end; addr++) { + for (addr = real_start; addr < real_end; addr++) { if (addr < start || addr >= end) prot1 |= page_get_flags(addr); } @@ -225,9 +225,9 @@ static abi_ulong mmap_find_vma(abi_ulong start, abi_ulong size) if (addr == 0) addr = mmap_next_start; addr_start = addr; - for(;;) { + for (;;) { prot = 0; - for(addr1 = addr; addr1 < (addr + size); addr1 += TARGET_PAGE_SIZE) { + for (addr1 = addr; addr1 < (addr + size); addr1 += TARGET_PAGE_SIZE) { prot |= page_get_flags(addr1); } if (prot == 0) @@ -262,7 +262,7 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int prot, printf("MAP_FIXED "); if (flags & MAP_ANON) printf("MAP_ANON "); - switch(flags & TARGET_BSD_MAP_FLAGMASK) { + switch (flags & TARGET_BSD_MAP_FLAGMASK) { case MAP_PRIVATE: printf("MAP_PRIVATE "); break; @@ -321,7 +321,7 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int prot, end = start + len; real_end = HOST_PAGE_ALIGN(end); - for(addr = real_start; addr < real_end; addr += TARGET_PAGE_SIZE) { + for (addr = real_start; addr < real_end; addr += TARGET_PAGE_SIZE) { flg = page_get_flags(addr); if (flg & PAGE_RESERVED) { errno = ENXIO; @@ -433,11 +433,11 @@ int target_munmap(abi_ulong start, abi_ulong len) if (start > real_start) { /* handle host page containing start */ prot = 0; - for(addr = real_start; addr < start; addr += TARGET_PAGE_SIZE) { + for (addr = real_start; addr < start; addr += TARGET_PAGE_SIZE) { prot |= page_get_flags(addr); } if (real_end == real_start + qemu_host_page_size) { - for(addr = end; addr < real_end; addr += TARGET_PAGE_SIZE) { + for (addr = end; addr < real_end; addr += TARGET_PAGE_SIZE) { prot |= page_get_flags(addr); } end = real_end; @@ -447,7 +447,7 @@ int target_munmap(abi_ulong start, abi_ulong len) } if (end < real_end) { prot = 0; - for(addr = end; addr < real_end; addr += TARGET_PAGE_SIZE) { + for (addr = end; addr < real_end; addr += TARGET_PAGE_SIZE) { prot |= page_get_flags(addr); } if (prot != 0) From patchwork Sat Apr 24 15:59:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1469946 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=bsdimp-com.20150623.gappssmtp.com header.i=@bsdimp-com.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=VEX5J8rJ; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FSGNp0V7Hz9sVw for ; Sun, 25 Apr 2021 02:11:06 +1000 (AEST) Received: from localhost ([::1]:34254 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1laKs4-0008Ug-2D for incoming@patchwork.ozlabs.org; Sat, 24 Apr 2021 12:11:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50120) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1laKhx-0005Tg-Ak for qemu-devel@nongnu.org; Sat, 24 Apr 2021 12:00:37 -0400 Received: from mail-io1-xd36.google.com ([2607:f8b0:4864:20::d36]:46048) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1laKhr-0004CA-Vp for qemu-devel@nongnu.org; Sat, 24 Apr 2021 12:00:36 -0400 Received: by mail-io1-xd36.google.com with SMTP id z14so1402828ioc.12 for ; Sat, 24 Apr 2021 09:00:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=/WnAAtcFzxO8r69DXQ+9tsdNR29OS9N9nKXWHORJzaM=; b=VEX5J8rJOyckvhSCDN86jjM+jChyblHrk5ZAdG/G2mX+0vU5b+q7mxbdvFRIDC75Qd G3xuO7H1li91eEmpi+YTPyC+HKwclRaAfT9gvgYj2D2vH6paqci2//fjxysRCwnntEMv /lmWJjZkYD4cmn0q6gA1YULBl4iG/ARf9VQfQ6T9Dg2HtEJ7Xm90+fBzicQKtzydggg+ DXTq7XHltDSZ3kWHD1fw92V7fftg1/aIRAVA741SNGY8XHESVwngVx+71uCj5AaR3yxu +OxpIg7Kf/tc91BbqZ8WMQjQc+GxfRNn8P+SQ+giBVLZ67QEsaCByc/p/SB/sJvLtWxa mXrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/WnAAtcFzxO8r69DXQ+9tsdNR29OS9N9nKXWHORJzaM=; b=AjZLMAIbV51n6YHlDp7eO1L+abr0xw7Ur9GQCrkOnYMa5s6kKg7u822/gtKnTo26RX EKH2GWJfJ/Zq/TSl3UTxbnXmK02PA1+IDy1dcw1bX4ncngG/ZfDlQz6iy6D/J7pi9FOw SCPfv+I5QtyoC4QexnQ/O5gaHVjm51TivZ7rVsMXgx2IvUk0puIWYi3QMc3TAHYkpuBw WRypVx1DLSUdTm94/1Qx1xm/mM3LyHu4lu7fF1l0PLvSMUB2Wt0l7YVq4hZD+y5xKhFW Vnt2WqJtzAf6RxxeCiimyMfZgma6noWgnwY+yimXNcM8mE4Z+FhPkhK+xlPwaP0yZjaY 5jdQ== X-Gm-Message-State: AOAM531OLvWeTs3W8pdyTutTpy58KQF931e11llvZrs57TokhnfFYYdM kMZb9knSVnkUbgc/RJJ9kJz1zY11EY2595Xu X-Google-Smtp-Source: ABdhPJytSXS4qoCI14pF68hYZchtdojQxkMuOygQJp9hLA/BSvbufP/89SmaCPm5Odt+R1lmz5bh4Q== X-Received: by 2002:a02:a40a:: with SMTP id c10mr8202027jal.98.1619280030702; Sat, 24 Apr 2021 09:00:30 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id h4sm4055901ili.52.2021.04.24.09.00.29 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 24 Apr 2021 09:00:30 -0700 (PDT) From: imp@bsdimp.com To: qemu-devel@nongnu.org Subject: [PATCH v2 05/48] bsd-user: style tweak: keyword space ( Date: Sat, 24 Apr 2021 09:59:33 -0600 Message-Id: <20210424160016.15200-6-imp@bsdimp.com> X-Mailer: git-send-email 2.22.1 In-Reply-To: <20210424160016.15200-1-imp@bsdimp.com> References: <20210424160016.15200-1-imp@bsdimp.com> MIME-Version: 1.0 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: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kevans@freebsd.org, Richard Henderson , arichardson@freebsd.org, Warner Losh Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Warner Losh Reviewed-by: Richard Henderson Signed-off-by: Warner Losh --- bsd-user/qemu.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bsd-user/qemu.h b/bsd-user/qemu.h index d2bcaab741..b836b603af 100644 --- a/bsd-user/qemu.h +++ b/bsd-user/qemu.h @@ -233,7 +233,7 @@ static inline bool access_ok(int type, abi_ulong addr, abi_ulong size) #define __put_user(x, hptr)\ ({\ int size = sizeof(*hptr);\ - switch(size) {\ + switch (size) {\ case 1:\ *(uint8_t *)(hptr) = (uint8_t)(typeof(*hptr))(x);\ break;\ @@ -255,7 +255,7 @@ static inline bool access_ok(int type, abi_ulong addr, abi_ulong size) #define __get_user(x, hptr) \ ({\ int size = sizeof(*hptr);\ - switch(size) {\ + switch (size) {\ case 1:\ x = (typeof(*hptr))*(uint8_t *)(hptr);\ break;\ From patchwork Sat Apr 24 15:59:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1469943 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=bsdimp-com.20150623.gappssmtp.com header.i=@bsdimp-com.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=TRW0WIeq; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FSGM76Bvtz9sVw for ; Sun, 25 Apr 2021 02:09:39 +1000 (AEST) Received: from localhost ([::1]:57994 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1laKqf-0006Vc-QP for incoming@patchwork.ozlabs.org; Sat, 24 Apr 2021 12:09:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50152) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1laKhy-0005Ux-FJ for qemu-devel@nongnu.org; Sat, 24 Apr 2021 12:00:38 -0400 Received: from mail-il1-x12b.google.com ([2607:f8b0:4864:20::12b]:35528) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1laKhs-0004CO-Ul for qemu-devel@nongnu.org; Sat, 24 Apr 2021 12:00:38 -0400 Received: by mail-il1-x12b.google.com with SMTP id r5so2958080ilb.2 for ; Sat, 24 Apr 2021 09:00:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Joh6sYPdqWoZ7daN4rswi5g+4s7Yq8+szdUVhDLRb+k=; b=TRW0WIeqxWrrgPnT04NJp/1anqKo1TMYzXFfJgkuQG/FrOGPWw4kVH/QK7TB0ZvoMz AS8ylNdYdJM9I8lMe0HFEYnETnkEtyVylM/x/PG1Y87d/khtyLNHRuMPkzju9vwyOpan LjMz20383lfw1Xl72LoMfB9NJ2DlLKr7+Up42PLPzQ1C5fbpBY911spPS6SRO8NSfb+Y ReXLsI6BUM9f+yVXXYXO2ccF0rdQBLH3LqCHvB+HN79Y+lBhWEnOXaIsfWELRrJlDHfU T6sLc205c0hemh7EOocF4TuVAqFc+26ByUH3+dHmDr2cJYzkDxScPhC3M0MptVnpM8qh m4KQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Joh6sYPdqWoZ7daN4rswi5g+4s7Yq8+szdUVhDLRb+k=; b=Vtg0lNPpKTtStKpA24KW5Ia7LNbTr0GS1IT5qrOLNVw7BopbSOzJN5o+ItxtKeyGCx O1weXrVrDfeCfsstKrmlFIH5Qbp1E6u4SYXv+QVZspr+qn+5/NenYWqKnauVCIRlZ9fU DB334TxBJZt8h6i0HzRZas71BMSHEqraNigo9tGSikaXLsllfYktf/PNcAV4SxQlLn8+ 3biiVg2dLu5VKpxMQfh5x6tR41moqfJj4JOoypeqgQkRKtVCAKbTMlRSW5JMGxAKhUNZ 4Va5E4IbEAnDXDp+bB7HPEStkzAGh1C6XDvhWqm6sc/T9og1gLHL/WY51O7jDe0SN2Mo o0hw== X-Gm-Message-State: AOAM5335LLbjoUHo/kCLoJhKMYlUITRzysUp7vCBrtK/NpOxNIt4rk/k CLruPteClabWpXJUB2I4JRhzsCUKA2JG0LKx X-Google-Smtp-Source: ABdhPJy48POnk6Rh+Bz6JxDAKH66cM6zA8WzMEKPjHbid2tl4I02HC+xJT+nXPLPMJUTmNj4HK1Y3g== X-Received: by 2002:a92:7f08:: with SMTP id a8mr7300884ild.87.1619280031589; Sat, 24 Apr 2021 09:00:31 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id h4sm4055901ili.52.2021.04.24.09.00.30 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 24 Apr 2021 09:00:31 -0700 (PDT) From: imp@bsdimp.com To: qemu-devel@nongnu.org Subject: [PATCH v2 06/48] bsd-user: style tweak: keyword space ( Date: Sat, 24 Apr 2021 09:59:34 -0600 Message-Id: <20210424160016.15200-7-imp@bsdimp.com> X-Mailer: git-send-email 2.22.1 In-Reply-To: <20210424160016.15200-1-imp@bsdimp.com> References: <20210424160016.15200-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::12b; envelope-from=imp@bsdimp.com; helo=mail-il1-x12b.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kevans@freebsd.org, Richard Henderson , arichardson@freebsd.org, Warner Losh Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Warner Losh Reviewed-by: Richard Henderson Signed-off-by: Warner Losh --- bsd-user/syscall.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/bsd-user/syscall.c b/bsd-user/syscall.c index adc3d21b54..3352735c68 100644 --- a/bsd-user/syscall.c +++ b/bsd-user/syscall.c @@ -95,7 +95,7 @@ static abi_long do_freebsd_sysarch(CPUX86State *env, int op, abi_ulong parms) abi_ulong val; int idx; - switch(op) { + switch (op) { #ifdef TARGET_ABI32 case TARGET_FREEBSD_I386_SET_GSBASE: case TARGET_FREEBSD_I386_SET_FSBASE: @@ -271,7 +271,7 @@ static abi_long lock_iovec(int type, struct iovec *vec, abi_ulong target_addr, target_vec = lock_user(VERIFY_READ, target_addr, count * sizeof(struct target_iovec), 1); if (!target_vec) return -TARGET_EFAULT; - for(i = 0;i < count; i++) { + for (i = 0;i < count; i++) { base = tswapl(target_vec[i].iov_base); vec[i].iov_len = tswapl(target_vec[i].iov_len); if (vec[i].iov_len != 0) { @@ -297,7 +297,7 @@ static abi_long unlock_iovec(struct iovec *vec, abi_ulong target_addr, target_vec = lock_user(VERIFY_READ, target_addr, count * sizeof(struct target_iovec), 1); if (!target_vec) return -TARGET_EFAULT; - for(i = 0;i < count; i++) { + for (i = 0;i < count; i++) { if (target_vec[i].iov_base) { base = tswapl(target_vec[i].iov_base); unlock_user(vec[i].iov_base, base, copy ? vec[i].iov_len : 0); @@ -325,10 +325,10 @@ abi_long do_freebsd_syscall(void *cpu_env, int num, abi_long arg1, #endif record_syscall_start(cpu, num, arg1, arg2, arg3, arg4, arg5, arg6, 0, 0); - if(do_strace) + if (do_strace) print_freebsd_syscall(num, arg1, arg2, arg3, arg4, arg5, arg6); - switch(num) { + switch (num) { case TARGET_FREEBSD_NR_exit: #ifdef CONFIG_GPROF _mcleanup(); @@ -427,10 +427,10 @@ abi_long do_netbsd_syscall(void *cpu_env, int num, abi_long arg1, record_syscall_start(cpu, num, arg1, arg2, arg3, arg4, arg5, arg6, 0, 0); - if(do_strace) + if (do_strace) print_netbsd_syscall(num, arg1, arg2, arg3, arg4, arg5, arg6); - switch(num) { + switch (num) { case TARGET_NETBSD_NR_exit: #ifdef CONFIG_GPROF _mcleanup(); @@ -506,10 +506,10 @@ abi_long do_openbsd_syscall(void *cpu_env, int num, abi_long arg1, record_syscall_start(cpu, num, arg1, arg2, arg3, arg4, arg5, arg6, 0, 0); - if(do_strace) + if (do_strace) print_openbsd_syscall(num, arg1, arg2, arg3, arg4, arg5, arg6); - switch(num) { + switch (num) { case TARGET_OPENBSD_NR_exit: #ifdef CONFIG_GPROF _mcleanup(); From patchwork Sat Apr 24 15:59:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1469949 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=bsdimp-com.20150623.gappssmtp.com header.i=@bsdimp-com.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=By9K3n49; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FSGRL1KYPz9sVw for ; Sun, 25 Apr 2021 02:13:18 +1000 (AEST) Received: from localhost ([::1]:42518 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1laKuC-0003UV-8K for incoming@patchwork.ozlabs.org; Sat, 24 Apr 2021 12:13:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50154) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1laKhy-0005VY-Nb for qemu-devel@nongnu.org; Sat, 24 Apr 2021 12:00:39 -0400 Received: from mail-io1-xd33.google.com ([2607:f8b0:4864:20::d33]:36832) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1laKht-0004CT-Ua for qemu-devel@nongnu.org; Sat, 24 Apr 2021 12:00:38 -0400 Received: by mail-io1-xd33.google.com with SMTP id g125so3394631iof.3 for ; Sat, 24 Apr 2021 09:00:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=HSHRS0z4r0qhim5P0rpE1zVoI4Ligyk7KuFYx7l7Qs4=; b=By9K3n49VP0y87PHZly3XoYl0XYm9s4S5ZkLiWiVSluaakU06vc5Jw31L0fjLlCtDL 3ZVaPuVMAihDN81QHFPCyFn89QpNiMaAeEl5mMtqa+hCIiq0h49TeSEOF7idzZX46M/R WIhQfGjTqJtu4l6RI6okGCjZkFDL2K2yzxunJzR+3Zr/z9o3N+mRwtzYJ/2JJH4R0/gb SynjQhrzu7vyyBD2XtEVBSNzXjDO6fXFQWez/ct0xVvxIOTQIEo1oQwAv0z9/7CJgbUn bQFd/sTVvazksPGrcfFkg0Kj08fazPWTuxTHMcJaxK8IPTKDMU5zo8H4soOulyKMWO5P wO4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=HSHRS0z4r0qhim5P0rpE1zVoI4Ligyk7KuFYx7l7Qs4=; b=q5OjDX4w9LdjHMn6t9yb77mqetFnMkx1UzgfrLKwOpYNvbHNHNr+tOMoXoxu8oxH7s hO0CGDCtHOI0cbrXRSciI9lfTc5/tPxKpfFvyrZFtZXmDJZhKOiiNKQjkBEglz80C1hw l2sWdiYT9KvGXBfLz2qgxKcd+z36CPy7Hq5K+nQPHAiVrpzFNpcibxx8FxbrrpFfrQ/S x4pGWQSkq+OzDDcuXebuUhTd9yFNX+jASae9GFSDBcyqWfWytTaOpzUb+HQpDGSupSxj Dz9NYutLkCaEkkSInKl5Q010IWhbilUs9NEnyzRXmD4wRIZPqW3aF5YAYX0afCJ8wVz6 6V1w== X-Gm-Message-State: AOAM530MTOPXP22ANif3Fp7u3p8IfEgPZNHnV2I/YMMSI7fXh0VJOr/q N99W6OPjJcnP19lUoU0UBQRaTO9+SfiuYwF9 X-Google-Smtp-Source: ABdhPJw/1N8TvIIC5VIEdcPCDg6+Qc9Wtj+xqzI4/I+J1EQMU4auNaKAr4OoZa/0IvcQv4vE+2yOlw== X-Received: by 2002:a02:6951:: with SMTP id e78mr8277752jac.56.1619280032536; Sat, 24 Apr 2021 09:00:32 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id h4sm4055901ili.52.2021.04.24.09.00.31 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 24 Apr 2021 09:00:31 -0700 (PDT) From: imp@bsdimp.com To: qemu-devel@nongnu.org Subject: [PATCH v2 07/48] bsd-user: style tweak: keyword space ( Date: Sat, 24 Apr 2021 09:59:35 -0600 Message-Id: <20210424160016.15200-8-imp@bsdimp.com> X-Mailer: git-send-email 2.22.1 In-Reply-To: <20210424160016.15200-1-imp@bsdimp.com> References: <20210424160016.15200-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::d33; envelope-from=imp@bsdimp.com; helo=mail-io1-xd33.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kevans@freebsd.org, Richard Henderson , arichardson@freebsd.org, Warner Losh Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Warner Losh Reviewed-by: Richard Henderson Signed-off-by: Warner Losh --- bsd-user/uaccess.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bsd-user/uaccess.c b/bsd-user/uaccess.c index 91e2067933..89163257f4 100644 --- a/bsd-user/uaccess.c +++ b/bsd-user/uaccess.c @@ -46,7 +46,7 @@ abi_long target_strlen(abi_ulong guest_addr1) int max_len, len; guest_addr = guest_addr1; - for(;;) { + for (;;) { max_len = TARGET_PAGE_SIZE - (guest_addr & ~TARGET_PAGE_MASK); ptr = lock_user(VERIFY_READ, guest_addr, max_len, 1); if (!ptr) From patchwork Sat Apr 24 15:59:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1469947 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=bsdimp-com.20150623.gappssmtp.com header.i=@bsdimp-com.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=vRuBOaxG; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FSGQ90tSDz9sVw for ; Sun, 25 Apr 2021 02:12:17 +1000 (AEST) Received: from localhost ([::1]:37980 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1laKtD-0001c6-6s for incoming@patchwork.ozlabs.org; Sat, 24 Apr 2021 12:12:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50178) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1laKhz-0005Vs-Bc for qemu-devel@nongnu.org; Sat, 24 Apr 2021 12:00:39 -0400 Received: from mail-il1-x132.google.com ([2607:f8b0:4864:20::132]:41854) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1laKhu-0004Ce-Re for qemu-devel@nongnu.org; Sat, 24 Apr 2021 12:00:39 -0400 Received: by mail-il1-x132.google.com with SMTP id v13so3392798ilj.8 for ; Sat, 24 Apr 2021 09:00:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=A2WXoZNR18cPe3xuWHxneWeGgI/yhNHoyKk1SebgGQY=; b=vRuBOaxGufsfWTDXvzxQnb3Pe5rbSb7UixjJSBSkEfmrJjqWUcDc6tS9PztyO9FKYD sfoTAtscGKh4lHOMsRJL5WDpz3UK4P+otcIVvIK8kliLNMWuDDueLN26VwBMHZwWV1Jc suDPLsfV+YJ9Xt99gCScUESDooMXLq7KS1mKjvhTbf8Sy6mOSXdJczEfbvJiJolsNoc8 hgi9fhLES8QA+AUUEk/rcLvEIkiCAnVMZpCMjjLcbTRxwIOGcBuA2n77GNu3orUzHHnA Xh1ecAGowl1S09iofhEjuSdl1bHHRUfK8tdc1j2gEgaiLbDhO8phpWjb0asFB5UnayNb 8+hw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=A2WXoZNR18cPe3xuWHxneWeGgI/yhNHoyKk1SebgGQY=; b=OgjmKHS1qhxuU0fIOW6h9ATZWfsjPFlj2cFaelH3LlKRNi5aTrJBQToyVUlWQl3vHX bHrj6Qpg14IT+lc4L+HGkZ2fLUUTGldmsXsjzjOVF3bb0ha9dKuU/yol/9NuXmKoQmvL uwDe183YMzEpi/jqIZUy23fqyn6QuOm6TSsGl0wuCh7E+IrbHS3fIiPWz/nIKEprEzzE 7TKnFx080qV63lm15PTi6L/bj+DgZRftnCtYM3iqP8lKEClMc5nARSk8O6uWHgyiAenA mHmqAcvj+vCP1lD4MgVVNo4QzB6okAr+pTZOhkQcv2DeYniJcUC8vvpUVBrrFZQcMtCI TWjg== X-Gm-Message-State: AOAM532QSLBJYwk/w5ytPzdkJPFlPBajrYLPwIdBUzxEuS0ZN+ggvXZE fWA6rfutwNB+7FvYR2uqUb2AdxN9mL6rzQc9 X-Google-Smtp-Source: ABdhPJw0c62XEDmyoQzSpugmSkV8L/UMprXn2a0Oi0/uIRYCyNBObstjoxl9EiHZSoG00Uuh6pzWRg== X-Received: by 2002:a05:6e02:1caf:: with SMTP id x15mr7454311ill.89.1619280033321; Sat, 24 Apr 2021 09:00:33 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id h4sm4055901ili.52.2021.04.24.09.00.32 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 24 Apr 2021 09:00:32 -0700 (PDT) From: imp@bsdimp.com To: qemu-devel@nongnu.org Subject: [PATCH v2 08/48] bsd-user: style tweak: use C not C++ comments Date: Sat, 24 Apr 2021 09:59:36 -0600 Message-Id: <20210424160016.15200-9-imp@bsdimp.com> X-Mailer: git-send-email 2.22.1 In-Reply-To: <20210424160016.15200-1-imp@bsdimp.com> References: <20210424160016.15200-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::132; envelope-from=imp@bsdimp.com; helo=mail-il1-x132.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kevans@freebsd.org, Richard Henderson , arichardson@freebsd.org, Warner Losh Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Warner Losh Reviewed-by: Richard Henderson Signed-off-by: Warner Losh --- bsd-user/elfload.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bsd-user/elfload.c b/bsd-user/elfload.c index 3c9d8c2845..87154283ef 100644 --- a/bsd-user/elfload.c +++ b/bsd-user/elfload.c @@ -1010,7 +1010,7 @@ static const char *lookup_symbolxx(struct syminfo *s, target_ulong orig_addr) struct elf_sym *syms = s->disas_symtab.elf64; #endif - // binary search + /* binary search */ struct elf_sym *sym; sym = bsearch(&orig_addr, syms, s->disas_num_syms, sizeof(*syms), symfind); @@ -1092,7 +1092,7 @@ static void load_symbols(struct elfhdr *hdr, int fd) #ifdef BSWAP_NEEDED bswap_sym(syms + i); #endif - // Throw away entries which we do not need. + /* Throw away entries which we do not need. */ if (syms[i].st_shndx == SHN_UNDEF || syms[i].st_shndx >= SHN_LORESERVE || ELF_ST_TYPE(syms[i].st_info) != STT_FUNC) { From patchwork Sat Apr 24 15:59:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1469940 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=bsdimp-com.20150623.gappssmtp.com header.i=@bsdimp-com.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=VNnMQk7a; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FSGKK6n3Hz9sW1 for ; Sun, 25 Apr 2021 02:08:05 +1000 (AEST) Received: from localhost ([::1]:52694 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1laKp9-000403-Tz for incoming@patchwork.ozlabs.org; Sat, 24 Apr 2021 12:08:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50226) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1laKi4-0005Yw-Gv for qemu-devel@nongnu.org; Sat, 24 Apr 2021 12:00:46 -0400 Received: from mail-io1-xd2c.google.com ([2607:f8b0:4864:20::d2c]:34651) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1laKhv-0004Cp-Cv for qemu-devel@nongnu.org; Sat, 24 Apr 2021 12:00:44 -0400 Received: by mail-io1-xd2c.google.com with SMTP id l21so8548019iob.1 for ; Sat, 24 Apr 2021 09:00:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ghN5evOr+lJ1hwh8OcKOBoA6w2BllVvDqUcGoBlbrmE=; b=VNnMQk7aIWowbZ10g34EjBuRy1rLI1aSao7lvLSNWV/NW5Tr2gi5eKx7DQBMueUo5s Nf291BnrOVu7AujtjaBdXDZz2fWTatGIL+lf6E/Zntv91t9XGtQa+Gh/wzGCg6ir0ir8 ML2d/Ydgiw+GGeJt9DlnqU263dc9v3eEQT0wkinMVl3vDd0BQYCkqvq08EJFLvhtnhfz +dXaxu3xJv0e+X3NACRtotsU23l3h3H9aGrYdEgXIlGF6jWx9JOZwjSH6xVoqe4/0u/b VEzRE6YG+PzU3Y2os/NibjiS7KyBhjG3LWwx4vyAubb5NT2wM1piSwvTyDEfqMsBRC2p 1wUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ghN5evOr+lJ1hwh8OcKOBoA6w2BllVvDqUcGoBlbrmE=; b=B810+KnXaQE642ZYoP4/eDPKncVJUmnUY46KGedU8PIfvaQ39+wgwXIFwX//kJnulW IVyUE8L7VxhnIl5sEEuS65AFx5jtUtKZbbZsqkJeDftziD2ySs/9wtcbk3TIL16xU47i KeRWm26dEVgWZ+J82uhNreyV/GrT3nj2LFbH0e+yEXPE/K95AFbAaTnYt9AhqAgo5gpM vlDm3hAZOeQ7C81EVg7m15DXpzNv3qxuqB2Tu4w05NxemKAmMvnK7fNUx9zogpv0XU7k WomG3CS7HeBNiVky+BX1KBfWsMrzJ5QSR78Rh1mljVcPf1EAL5ONIv+G6FP5RKtiZzVS EyVw== X-Gm-Message-State: AOAM532SKA8L5aNU5IpgObzkMOcMOYbbhcOpwXa/Yho5g0tCSCxgrJmc 0BWidN3ZdPWAlzBWevFJDKK/XOLa5Wjb7XT9 X-Google-Smtp-Source: ABdhPJz1XNc7R8DOCYpT6lZ3un9rD3q5rbsDtEy14yyuI7+DMnoQI90SVkHBdk74AfkkeXNrr6IgNg== X-Received: by 2002:a02:5d82:: with SMTP id w124mr8358736jaa.21.1619280034017; Sat, 24 Apr 2021 09:00:34 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id h4sm4055901ili.52.2021.04.24.09.00.33 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 24 Apr 2021 09:00:33 -0700 (PDT) From: imp@bsdimp.com To: qemu-devel@nongnu.org Subject: [PATCH v2 09/48] bsd-user: style tweak: use C not C++ comments Date: Sat, 24 Apr 2021 09:59:37 -0600 Message-Id: <20210424160016.15200-10-imp@bsdimp.com> X-Mailer: git-send-email 2.22.1 In-Reply-To: <20210424160016.15200-1-imp@bsdimp.com> References: <20210424160016.15200-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::d2c; envelope-from=imp@bsdimp.com; helo=mail-io1-xd2c.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kevans@freebsd.org, Richard Henderson , arichardson@freebsd.org, Warner Losh Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Warner Losh Reviewed-by: Richard Henderson Signed-off-by: Warner Losh --- bsd-user/main.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/bsd-user/main.c b/bsd-user/main.c index 455b8eddab..ff886de98e 100644 --- a/bsd-user/main.c +++ b/bsd-user/main.c @@ -148,7 +148,7 @@ void cpu_loop(CPUX86State *env) CPUState *cs = env_cpu(env); int trapnr; abi_ulong pc; - //target_siginfo_t info; + /* target_siginfo_t info; */ for (;;) { cpu_exec_start(cs); @@ -197,7 +197,7 @@ void cpu_loop(CPUX86State *env) arg6, arg7, arg8); - } else { //if (bsd_type == target_openbsd) + } else { /* if (bsd_type == target_openbsd) */ env->regs[R_EAX] = do_openbsd_syscall(env, env->regs[R_EAX], env->regs[R_EBX], @@ -226,7 +226,7 @@ void cpu_loop(CPUX86State *env) env->regs[R_ECX], env->regs[8], env->regs[9], 0, 0); - else { //if (bsd_type == target_openbsd) + else { /* if (bsd_type == target_openbsd) */ env->regs[R_EAX] = do_openbsd_syscall(env, env->regs[R_EAX], env->regs[R_EDI], @@ -370,7 +370,7 @@ void cpu_loop(CPUX86State *env) #ifdef TARGET_SPARC #define SPARC64_STACK_BIAS 2047 -//#define DEBUG_WIN +/* #define DEBUG_WIN */ /* WARNING: dealing with register windows _is_ complicated. More info can be found at http://www.sics.se/~psm/sparcstack.html */ static inline int get_reg_index(CPUSPARCState *env, int cwp, int index) @@ -497,7 +497,7 @@ void cpu_loop(CPUSPARCState *env) { CPUState *cs = env_cpu(env); int trapnr, ret, syscall_nr; - //target_siginfo_t info; + /* target_siginfo_t info; */ while (1) { cpu_exec_start(cs); @@ -527,7 +527,7 @@ void cpu_loop(CPUSPARCState *env) env->regwptr[0], env->regwptr[1], env->regwptr[2], env->regwptr[3], env->regwptr[4], env->regwptr[5]); - else { //if (bsd_type == target_openbsd) + else { /* if (bsd_type == target_openbsd) */ #if defined(TARGET_SPARC64) syscall_nr &= ~(TARGET_OPENBSD_SYSCALL_G7RFLAG | TARGET_OPENBSD_SYSCALL_G2RFLAG); @@ -619,7 +619,7 @@ void cpu_loop(CPUSPARCState *env) info._sifields._sigfault._addr = env->dmmuregs[4]; else info._sifields._sigfault._addr = env->tsptr->tpc; - //queue_signal(env, info.si_signo, &info); + /* queue_signal(env, info.si_signo, &info); */ } #endif break; @@ -639,7 +639,7 @@ void cpu_loop(CPUSPARCState *env) info.si_signo = sig; info.si_errno = 0; info.si_code = TARGET_TRAP_BRKPT; - //queue_signal(env, info.si_signo, &info); + /* queue_signal(env, info.si_signo, &info); */ } #endif } From patchwork Sat Apr 24 15:59:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1469951 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=bsdimp-com.20150623.gappssmtp.com header.i=@bsdimp-com.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=mdDcvXXH; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FSGSd6MRnz9sW4 for ; Sun, 25 Apr 2021 02:14:25 +1000 (AEST) Received: from localhost ([::1]:46284 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1laKvH-00053h-Rw for incoming@patchwork.ozlabs.org; Sat, 24 Apr 2021 12:14:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50208) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1laKi2-0005Yn-MH for qemu-devel@nongnu.org; Sat, 24 Apr 2021 12:00:46 -0400 Received: from mail-il1-x132.google.com ([2607:f8b0:4864:20::132]:35535) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1laKhw-0004D0-7I for qemu-devel@nongnu.org; Sat, 24 Apr 2021 12:00:42 -0400 Received: by mail-il1-x132.google.com with SMTP id r5so2958152ilb.2 for ; Sat, 24 Apr 2021 09:00:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5spDA4ad8IC94jF1bigmtQ1FSEIn1pWZKjNT8+eHgHE=; b=mdDcvXXHa3xVu1qM47oXXYw4YG6kqY4Dd+oabOdd7P5hR+kmhDnIJaF5UQ8rLuIfuH 1d3NJs1MM35HlOw9H1IkKdwNraNcU4N66NY1eLmEyw9EgnCyeQXaRhphhBvO5u3ynXyX 6F3oEoOAmmBjBoNl76pdymq9GbuPMwf/1rtWRDC0cDXVm7hvJfZjJ0Rnu34vCQ7AU8si Q8gD8DRQA7DT8Dc+92Rxjn4X365rgtjfV9aL5o6i9Qxedt3GVHhXlTJudfRIHyritnpG o1fJOn+phG2OJUk88rsPG+FOcCJnuGtEjoG16mupvdekiwcd9VGVSVDu5fkzV/x8gN1f 8VMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5spDA4ad8IC94jF1bigmtQ1FSEIn1pWZKjNT8+eHgHE=; b=rkIrOGJVmoYGAH+uFsFsh2mNCEG5oS0E5jn+zWR2w/PYujG9gKxo+dEM9t6c1syS0D fT/FFAZLlTMvIGkxXw5WthCFzf+DKWSq1R0dAC8awxVL9NioMaQLj8an0jJiPHTa0mZz Yy9yqi0xwpHQLkjBTnYBir0pPKD2w34R0tzrqhOse8BGqRnHulU6WSj0RtQWeq2tVq1B ZGtJExqfOX7itaVuNTQIapTkjQMr8XTf26G72z12I/uHtC1GpCqhKbO+6gP0K6ZFiYRM lvU3Dh1l0lTiNH+RXriUE+sOCgj8fuGLsnvTgb9uTn++RuZtkf+nIqFkRuW4fpfcpCwF rqew== X-Gm-Message-State: AOAM531/Fsho0k/rK/SKW7ecjG1pGDMAYK/JRzgBUlHxybGFFUyzYL90 1tE1C7fpJZFbGiVclmZ6hAnx/5nhHb6pCVVl X-Google-Smtp-Source: ABdhPJyGH3PRoGzJf4ZXTMkk6efSlVbzR/QtN4Yg8obrskgPEwM2tjItXShtaNUz17I+gzVHEyPNGw== X-Received: by 2002:a92:6810:: with SMTP id d16mr7660152ilc.88.1619280034837; Sat, 24 Apr 2021 09:00:34 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id h4sm4055901ili.52.2021.04.24.09.00.34 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 24 Apr 2021 09:00:34 -0700 (PDT) From: imp@bsdimp.com To: qemu-devel@nongnu.org Subject: [PATCH v2 10/48] bsd-user: Remove commented out code Date: Sat, 24 Apr 2021 09:59:38 -0600 Message-Id: <20210424160016.15200-11-imp@bsdimp.com> X-Mailer: git-send-email 2.22.1 In-Reply-To: <20210424160016.15200-1-imp@bsdimp.com> References: <20210424160016.15200-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::132; envelope-from=imp@bsdimp.com; helo=mail-il1-x132.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kevans@freebsd.org, arichardson@freebsd.org, Warner Losh Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Warner Losh Remove dead code that's been commented out forever. Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/qemu.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/bsd-user/qemu.h b/bsd-user/qemu.h index b836b603af..7ccc8ad397 100644 --- a/bsd-user/qemu.h +++ b/bsd-user/qemu.h @@ -71,7 +71,6 @@ struct image_info { struct sigqueue { struct sigqueue *next; - //target_siginfo_t info; }; struct emulated_sigtable { @@ -193,9 +192,6 @@ extern int do_strace; /* signal.c */ void process_pending_signals(CPUArchState *cpu_env); void signal_init(void); -//int queue_signal(CPUArchState *env, int sig, target_siginfo_t *info); -//void host_to_target_siginfo(target_siginfo_t *tinfo, const siginfo_t *info); -//void target_to_host_siginfo(siginfo_t *info, const target_siginfo_t *tinfo); long do_sigreturn(CPUArchState *env); long do_rt_sigreturn(CPUArchState *env); abi_long do_sigaltstack(abi_ulong uss_addr, abi_ulong uoss_addr, abi_ulong sp); From patchwork Sat Apr 24 15:59:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1469957 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=bsdimp-com.20150623.gappssmtp.com header.i=@bsdimp-com.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=Bb9w1yBl; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FSGYL593rz9sW1 for ; Sun, 25 Apr 2021 02:18:30 +1000 (AEST) Received: from localhost ([::1]:59062 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1laKzE-00029m-Nc for incoming@patchwork.ozlabs.org; Sat, 24 Apr 2021 12:18:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50284) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1laKi9-0005af-VY for qemu-devel@nongnu.org; Sat, 24 Apr 2021 12:00:55 -0400 Received: from mail-io1-xd2b.google.com ([2607:f8b0:4864:20::d2b]:35436) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1laKhw-0004DC-VI for qemu-devel@nongnu.org; Sat, 24 Apr 2021 12:00:49 -0400 Received: by mail-io1-xd2b.google.com with SMTP id t21so943800iob.2 for ; Sat, 24 Apr 2021 09:00:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=h22zSJcv65mLDeK4wR1kfxWQM4XY7qd7DrXHOulaaTM=; b=Bb9w1yBlVPSgONytHKU0zCsCx+gNOCCth8Y3LcYEkYd8YIn5KjxSuNRSp6X9UkkySC 5L1Nmsbu6FWzeJSMgfjSnULrKbGejmbEE+83Aj9HQysQ3tTbDwhcDRrN8ayETv2BGb3F VNT5rCR77PZrOzLL53VoTCQXYCenDSzYYoObdceYoEixfslRjvuqKqaJSCDU7qkW+bcZ trVGsoWo5W7HNIHxPjL+YI7u7CmXP9ScfOOHbSoiGcqII/wvpaSDiH7O/lKZxcC0iTCd /+QuGCJ8qQnPsmRqsZ70jNhMQeYtdBqVFBB5770vSch+lnEWHfORB8gfS/GK3T1bpNzm +rXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=h22zSJcv65mLDeK4wR1kfxWQM4XY7qd7DrXHOulaaTM=; b=Nx3lIeuFQZQVfxVn5nQsQH08Yicv6fOsbTv6R2G0JqncaB/qKoz7btYHHPlh+wi+iT svCKSGtlUoJNFAGOZWy0VxSX4N/TIgmg+ovsEy5Q0oCFysOjfxZUrTzw727ADGu/MSRF GqMlHypQiazk14Mg97HGssyddUaaqTagz0fnwPySmTaufJ+y6uqhP/2SWfUxFYLWmgOj shEce86S68obU6L5l0TMxZXL7/Zu534laxVP/3uJ0W70tU4S1FnNn6PL76GLSg8osTNX oWGdfPKQVV0uVq+uXkUmO0ueEOUsr6hCVRMe+Tb3n7WjsLfSPUVxEWw5vqLTvm8YmvpB Dawg== X-Gm-Message-State: AOAM530K71ONY5Vqh5OdZpXxK1ExQAmLRJzLJgpwZA+fnEDfyvYyB9jl ZwOnRAnKV5ld/XZum7e+KvmSi6d/3qu/Zu+Q X-Google-Smtp-Source: ABdhPJw3t9+NMRQq+DTL6rBf7kBBsO2FW7PUkNDnGL0HQ1oLZX4HfhDdfvHRxNbOR81ibiRqiHU3pQ== X-Received: by 2002:a02:818b:: with SMTP id n11mr8590242jag.62.1619280035707; Sat, 24 Apr 2021 09:00:35 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id h4sm4055901ili.52.2021.04.24.09.00.34 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 24 Apr 2021 09:00:35 -0700 (PDT) From: imp@bsdimp.com To: qemu-devel@nongnu.org Subject: [PATCH v2 11/48] bsd-user: style tweak: Remove #if 0'd code Date: Sat, 24 Apr 2021 09:59:39 -0600 Message-Id: <20210424160016.15200-12-imp@bsdimp.com> X-Mailer: git-send-email 2.22.1 In-Reply-To: <20210424160016.15200-1-imp@bsdimp.com> References: <20210424160016.15200-1-imp@bsdimp.com> MIME-Version: 1.0 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: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kevans@freebsd.org, arichardson@freebsd.org, Warner Losh Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Warner Losh Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/elfload.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/bsd-user/elfload.c b/bsd-user/elfload.c index 87154283ef..2c6764d372 100644 --- a/bsd-user/elfload.c +++ b/bsd-user/elfload.c @@ -1270,9 +1270,6 @@ int load_elf_binary(struct linux_binprm *bprm, struct target_pt_regs *regs, ibcs2_interpreter = 1; } -#if 0 - printf("Using ELF interpreter %s\n", path(elf_interpreter)); -#endif if (retval >= 0) { retval = open(path(elf_interpreter), O_RDONLY); if (retval >= 0) { @@ -1529,15 +1526,6 @@ int load_elf_binary(struct linux_binprm *bprm, struct target_pt_regs *regs, padzero(elf_bss, elf_brk); -#if 0 - printf("(start_brk) %x\n" , info->start_brk); - printf("(end_code) %x\n" , info->end_code); - printf("(start_code) %x\n" , info->start_code); - printf("(end_data) %x\n" , info->end_data); - printf("(start_stack) %x\n" , info->start_stack); - printf("(brk) %x\n" , info->brk); -#endif - if (info->personality == PER_SVR4) { /* Why this, you ask??? Well SVr4 maps page 0 as read-only, From patchwork Sat Apr 24 15:59:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1469941 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=bsdimp-com.20150623.gappssmtp.com header.i=@bsdimp-com.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=M08zcBfl; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FSGKY6wzLz9sVw for ; Sun, 25 Apr 2021 02:08:17 +1000 (AEST) Received: from localhost ([::1]:53888 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1laKpL-0004nh-N4 for incoming@patchwork.ozlabs.org; Sat, 24 Apr 2021 12:08:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50286) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1laKiA-0005ag-08 for qemu-devel@nongnu.org; Sat, 24 Apr 2021 12:00:55 -0400 Received: from mail-io1-xd32.google.com ([2607:f8b0:4864:20::d32]:45003) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1laKhx-0004E4-VH for qemu-devel@nongnu.org; Sat, 24 Apr 2021 12:00:49 -0400 Received: by mail-io1-xd32.google.com with SMTP id p8so3348876iol.11 for ; Sat, 24 Apr 2021 09:00:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=xfOm/Ivh+JfqV00Fz/64C5CrriNC8PYXVMSw99nEiXo=; b=M08zcBflkKPwl8zJ9ZH6/2GSGzxcS4IQ/iKkuNVTWBbaNLl2Hqa2kl9VMfVDYb37do M2+/er5RTZolR5OoXkNMPMfxr4JpfjQjUqA5lWhvKqkd01rz/s/hofBYVOzZ81w7XrOu IiTYeUA3ufkgpfeWag3OwtfIm4Qs74Be4vmhBn0kXimaiDIa9FmA/EerdYapD/6OJ7dM 52IYq+CWQh6WabTgYGT05YGly8G2gZ4xfvRKTI+Bp0GUChj1QNMqrptOPWHlwd9AIt/Z BK0LcDCx8O8sbBWrRkyzTpL0Hu/c22TA7J8M0LV8rl0ilewIxeDRJZ9NPVAlSM2ZpqxW E9gg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xfOm/Ivh+JfqV00Fz/64C5CrriNC8PYXVMSw99nEiXo=; b=omAKXeXLS4De+Jvi8yxErSoCoSELYEGcEwJUnBChMm/xQHWRXbNqTpT9GCowdNHp1W KNe/04hErr5SnYkOtlHZ1LwIGJNCDvxmw49Mxn2MteeVA6KQtP2oYvEGHzHzyZE6QEO/ 7CCMkomHfufwdegHiF6TMQK6UTzyecGGe/ecWkY2rIC45humy+sArtebFTQS27nyl/v8 7fe1BpqOAEylqk918l45GZQYo2RnezYihIcCQqm1/srIY186tzlbLTyoW8ruPngjrl3h wcOX8wqAER8fsoPM59FOVkebMerejan9paSIoPNJVXld3/NilWMXwMlZ09DVJSQMkLUb ROsg== X-Gm-Message-State: AOAM531X3GV7Ue1eANBEnqeKlr4QnTjS+xiaHO3DawT29kw+nhnHtP/N 2bQGeekxreDsS/Y1P2c6a6jcMb2bUb9lQ79N X-Google-Smtp-Source: ABdhPJy4Vt5vPC+UkT+K6q9dpeK81gBsLiEiEseyK0HZe2EQ/F0NbuuLnWiq+cxyoC1e+pPQ9+tPVg== X-Received: by 2002:a05:6638:258e:: with SMTP id s14mr8425333jat.28.1619280036510; Sat, 24 Apr 2021 09:00:36 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id h4sm4055901ili.52.2021.04.24.09.00.35 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 24 Apr 2021 09:00:36 -0700 (PDT) From: imp@bsdimp.com To: qemu-devel@nongnu.org Subject: [PATCH v2 12/48] bsd-user: style tweak: Remove #if 0'd code Date: Sat, 24 Apr 2021 09:59:40 -0600 Message-Id: <20210424160016.15200-13-imp@bsdimp.com> X-Mailer: git-send-email 2.22.1 In-Reply-To: <20210424160016.15200-1-imp@bsdimp.com> References: <20210424160016.15200-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::d32; envelope-from=imp@bsdimp.com; helo=mail-io1-xd32.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kevans@freebsd.org, arichardson@freebsd.org, Warner Losh Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Warner Losh Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/main.c | 143 ------------------------------------------------ 1 file changed, 143 deletions(-) diff --git a/bsd-user/main.c b/bsd-user/main.c index ff886de98e..3c6c0ec687 100644 --- a/bsd-user/main.c +++ b/bsd-user/main.c @@ -244,118 +244,10 @@ void cpu_loop(CPUX86State *env) env->eflags &= ~CC_C; } break; -#endif -#if 0 - case EXCP0B_NOSEG: - case EXCP0C_STACK: - info.si_signo = SIGBUS; - info.si_errno = 0; - info.si_code = TARGET_SI_KERNEL; - info._sifields._sigfault._addr = 0; - queue_signal(env, info.si_signo, &info); - break; - case EXCP0D_GPF: - /* XXX: potential problem if ABI32 */ -#ifndef TARGET_X86_64 - if (env->eflags & VM_MASK) { - handle_vm86_fault(env); - } else -#endif - { - info.si_signo = SIGSEGV; - info.si_errno = 0; - info.si_code = TARGET_SI_KERNEL; - info._sifields._sigfault._addr = 0; - queue_signal(env, info.si_signo, &info); - } - break; - case EXCP0E_PAGE: - info.si_signo = SIGSEGV; - info.si_errno = 0; - if (!(env->error_code & 1)) - info.si_code = TARGET_SEGV_MAPERR; - else - info.si_code = TARGET_SEGV_ACCERR; - info._sifields._sigfault._addr = env->cr[2]; - queue_signal(env, info.si_signo, &info); - break; - case EXCP00_DIVZ: -#ifndef TARGET_X86_64 - if (env->eflags & VM_MASK) { - handle_vm86_trap(env, trapnr); - } else -#endif - { - /* division by zero */ - info.si_signo = SIGFPE; - info.si_errno = 0; - info.si_code = TARGET_FPE_INTDIV; - info._sifields._sigfault._addr = env->eip; - queue_signal(env, info.si_signo, &info); - } - break; - case EXCP01_DB: - case EXCP03_INT3: -#ifndef TARGET_X86_64 - if (env->eflags & VM_MASK) { - handle_vm86_trap(env, trapnr); - } else -#endif - { - info.si_signo = SIGTRAP; - info.si_errno = 0; - if (trapnr == EXCP01_DB) { - info.si_code = TARGET_TRAP_BRKPT; - info._sifields._sigfault._addr = env->eip; - } else { - info.si_code = TARGET_SI_KERNEL; - info._sifields._sigfault._addr = 0; - } - queue_signal(env, info.si_signo, &info); - } - break; - case EXCP04_INTO: - case EXCP05_BOUND: -#ifndef TARGET_X86_64 - if (env->eflags & VM_MASK) { - handle_vm86_trap(env, trapnr); - } else -#endif - { - info.si_signo = SIGSEGV; - info.si_errno = 0; - info.si_code = TARGET_SI_KERNEL; - info._sifields._sigfault._addr = 0; - queue_signal(env, info.si_signo, &info); - } - break; - case EXCP06_ILLOP: - info.si_signo = SIGILL; - info.si_errno = 0; - info.si_code = TARGET_ILL_ILLOPN; - info._sifields._sigfault._addr = env->eip; - queue_signal(env, info.si_signo, &info); - break; #endif case EXCP_INTERRUPT: /* just indicate that signals should be handled asap */ break; -#if 0 - case EXCP_DEBUG: - { - int sig; - - sig = gdb_handlesig(env, TARGET_SIGTRAP); - if (sig) - { - info.si_signo = sig; - info.si_errno = 0; - info.si_code = TARGET_TRAP_BRKPT; - queue_signal(env, info.si_signo, &info); - } - } - break; -#endif default: pc = env->segs[R_CS].base + env->eip; fprintf(stderr, "qemu: 0x%08lx: unhandled CPU exception 0x%x - aborting\n", @@ -589,16 +481,6 @@ void cpu_loop(CPUSPARCState *env) break; case TT_TFAULT: case TT_DFAULT: -#if 0 - { - info.si_signo = SIGSEGV; - info.si_errno = 0; - /* XXX: check env->error_code */ - info.si_code = TARGET_SEGV_MAPERR; - info._sifields._sigfault._addr = env->mmuregs[4]; - queue_signal(env, info.si_signo, &info); - } -#endif break; #else case TT_SPILL: /* window overflow */ @@ -609,19 +491,6 @@ void cpu_loop(CPUSPARCState *env) break; case TT_TFAULT: case TT_DFAULT: -#if 0 - { - info.si_signo = SIGSEGV; - info.si_errno = 0; - /* XXX: check env->error_code */ - info.si_code = TARGET_SEGV_MAPERR; - if (trapnr == TT_DFAULT) - info._sifields._sigfault._addr = env->dmmuregs[4]; - else - info._sifields._sigfault._addr = env->tsptr->tpc; - /* queue_signal(env, info.si_signo, &info); */ - } -#endif break; #endif case EXCP_INTERRUPT: @@ -629,19 +498,7 @@ void cpu_loop(CPUSPARCState *env) break; case EXCP_DEBUG: { -#if 0 - int sig = -#endif gdb_handlesig(cs, TARGET_SIGTRAP); -#if 0 - if (sig) - { - info.si_signo = sig; - info.si_errno = 0; - info.si_code = TARGET_TRAP_BRKPT; - /* queue_signal(env, info.si_signo, &info); */ - } -#endif } break; default: From patchwork Sat Apr 24 15:59:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1469953 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=bsdimp-com.20150623.gappssmtp.com header.i=@bsdimp-com.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=xPRIgNcq; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FSGVn3x0Vz9sVw for ; Sun, 25 Apr 2021 02:16:17 +1000 (AEST) Received: from localhost ([::1]:50742 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1laKx5-0006x4-Ir for incoming@patchwork.ozlabs.org; Sat, 24 Apr 2021 12:16:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50250) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1laKi6-0005ZA-EB for qemu-devel@nongnu.org; Sat, 24 Apr 2021 12:00:46 -0400 Received: from mail-io1-xd34.google.com ([2607:f8b0:4864:20::d34]:45005) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1laKhy-0004EJ-MO for qemu-devel@nongnu.org; Sat, 24 Apr 2021 12:00:46 -0400 Received: by mail-io1-xd34.google.com with SMTP id p8so3348895iol.11 for ; Sat, 24 Apr 2021 09:00:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=mw+kFPTVaTTcnceuhbsFPa+58+NOTGYx6sghR1AquDw=; b=xPRIgNcqYRgHQJRrGpQY+JAL73jdxnn/wqGrWsArEq4bCvY8MbOyEItYmlxdCb0EIq FH1VxU3r9k35rYpxbTYvo8OzZ1TCYqcOLizxzbfmeL5l0w+3DDqmzn4UB+nxVQQvm8wV 8Q1jExhN42DT6HyJpYyV9fYE+FaGSAJq9fKTNJk+6yt6UJH+4rGfiIoDiRmyiBXdlv10 RcYX8D5BnHUBWVaeDs76WvNyTgLMdqfBhi23sqUk58mkY/YW2Wd/U2Q8XiDriefVArDD Pfh+RUVnjf8tCSEoJ5AEVjtmrFciY7fcFWP89elBLusVEgApDnZlJVC9Sx4RlYvmhf3c 8TXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=mw+kFPTVaTTcnceuhbsFPa+58+NOTGYx6sghR1AquDw=; b=Oe7zZ/qzBglr244n6b4DxY0AuU6M5NmYQw6MTIv4QH/8ZqhOLIfiT1RxA0J3r4L4ny /0ypFxjSceOUHs3Yo8SQw4lxtHzV37VG4fWaCVm4Vs37JSs7mcUlWj3nZlP5fT9Sktno WjMFmtr38hi5wYxg7RMZnbSS6MdoyRHMVESG6hQEfS9GduYRE6gjPGAzQb4eq6UWWK79 KPyI+b4hKAtFWZP9w2Hhp2GDwHMxdsWJE90+kVjUW5I3jFWOjkgNXM0vs762tu2QUliq xRIUQlGvsibyUsOIuD4gqMwY71t8SgkO+dMDpZ8/MYb5P8c4XctAVsEDrmxgBWKJ5iaA XbXQ== X-Gm-Message-State: AOAM533rpoVRHOlcxPGhP6y3P7dtWa7mNxe9xAUu+7YKR4bHYXPQd1GV 2V7B50erzGsexEKi5VGPLdBfAjy3jbeosQWv X-Google-Smtp-Source: ABdhPJzbeJMrU+gbkVDYRuuP6z4Hob7NdUHPFCYadsDj+aggnt1lnhh53C1x+coty+gRUy+5yETGWA== X-Received: by 2002:a02:cd8a:: with SMTP id l10mr8432292jap.6.1619280037354; Sat, 24 Apr 2021 09:00:37 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id h4sm4055901ili.52.2021.04.24.09.00.36 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 24 Apr 2021 09:00:36 -0700 (PDT) From: imp@bsdimp.com To: qemu-devel@nongnu.org Subject: [PATCH v2 13/48] bsd-user: style tweak: Remove #if 0'd code Date: Sat, 24 Apr 2021 09:59:41 -0600 Message-Id: <20210424160016.15200-14-imp@bsdimp.com> X-Mailer: git-send-email 2.22.1 In-Reply-To: <20210424160016.15200-1-imp@bsdimp.com> References: <20210424160016.15200-1-imp@bsdimp.com> MIME-Version: 1.0 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: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kevans@freebsd.org, arichardson@freebsd.org, Warner Losh Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Warner Losh Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/strace.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/bsd-user/strace.c b/bsd-user/strace.c index 2c3b59caf0..be40b8a20c 100644 --- a/bsd-user/strace.c +++ b/bsd-user/strace.c @@ -128,14 +128,6 @@ static void print_syscall_ret_addr(const struct syscallname *name, abi_long ret) } } -#if 0 /* currently unused */ -static void -print_syscall_ret_raw(struct syscallname *name, abi_long ret) -{ - gemu_log(" = 0x" TARGET_ABI_FMT_lx "\n", ret); -} -#endif - /* * An array of all of the syscalls we know about */ From patchwork Sat Apr 24 15:59:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1469960 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=bsdimp-com.20150623.gappssmtp.com header.i=@bsdimp-com.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=oO9PYnrj; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FSGbk3hBqz9sTD for ; Sun, 25 Apr 2021 02:20:34 +1000 (AEST) Received: from localhost ([::1]:37982 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1laL1E-00052w-Hx for incoming@patchwork.ozlabs.org; Sat, 24 Apr 2021 12:20:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50300) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1laKiA-0005ah-Gq for qemu-devel@nongnu.org; Sat, 24 Apr 2021 12:00:55 -0400 Received: from mail-io1-xd31.google.com ([2607:f8b0:4864:20::d31]:36831) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1laKhz-0004EV-Jc for qemu-devel@nongnu.org; Sat, 24 Apr 2021 12:00:50 -0400 Received: by mail-io1-xd31.google.com with SMTP id g125so3394816iof.3 for ; Sat, 24 Apr 2021 09:00:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=IrZsTXapOHjyeE4p1RaLMUoR1OTIYLnNpiXIDlmyhWw=; b=oO9PYnrj3RYyOmBC0+tRy0dtcDlxZ0RhGEp86dHZ50WJlOdzqPoGbGvIvZKdvZDso8 WhaTqEBiGgYjX8pOealEaRumoIZmOPerQBngrFE8pwfGgeX0M/jyGCnQ3ToTfiF5rzqo JVRjwdiKUivikv8MRRr+dFzfxK6ppGcJhb2qI9kjbCSWgallHjw8utDvF6G6CEBacGjW sv/y43kCv4u3x+sAVDoDB8uHATTIeZ3UcX0TtRZjzvM+TQPuL7O3sf5aLT5nsJV9wnbM nFPkEvijUvQQeUUS4KuWiYgFLFBqM0bZjAMmD+7f4gO3kqgLuIkzOOGHJm2k0xJRn2vw uoEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=IrZsTXapOHjyeE4p1RaLMUoR1OTIYLnNpiXIDlmyhWw=; b=mqun7nHKL5q5u81PdsKABa2X3pE6yG9P9WSxNg7vuxJrJUKQPujFMprOu33maZ5hFn NbPxVZB1XdDfR0MB2VuEzVOURckKq0qpIGB1d99uBsodAzi1ZbjejTI+2wggLuL/xz2N Cfl0VEO+DARnOvs28yxBmTrrOpso9IOY6geWk1Tn2uFU9g8moXyMCX4iobeL+o0iiyqM VDjNArEyVSyFszS3KNir0jk8FQLSFrufvzIQR457m4hmlcr1qGQckiBDZQPz5YiUTtFs KX+pLD60OJg6thJL45c6DpHcgKF4ZPu2kldicRj3PFmoznunSebcmJrlSJNoDxjSs2Ou WVUQ== X-Gm-Message-State: AOAM530WPW4cBUEUiY+TA+wVidsRT0xyGr7E+tnI9rC7U1pxn01ZXURJ 4WB6jIjhCSWSIcNcB/cQoPXr72KbRUJIMv2i X-Google-Smtp-Source: ABdhPJyRZXTEKhUh/YaS9X0/lsg45TqFdraueXkCKtl3BNMsYiDg2WJ2C7CZ+1Mgz+5C0VFO7zibiA== X-Received: by 2002:a02:c76c:: with SMTP id k12mr8344904jao.58.1619280038244; Sat, 24 Apr 2021 09:00:38 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id h4sm4055901ili.52.2021.04.24.09.00.37 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 24 Apr 2021 09:00:37 -0700 (PDT) From: imp@bsdimp.com To: qemu-devel@nongnu.org Subject: [PATCH v2 14/48] bsd-user: style tweak: Remove #if 0'd code Date: Sat, 24 Apr 2021 09:59:42 -0600 Message-Id: <20210424160016.15200-15-imp@bsdimp.com> X-Mailer: git-send-email 2.22.1 In-Reply-To: <20210424160016.15200-1-imp@bsdimp.com> References: <20210424160016.15200-1-imp@bsdimp.com> MIME-Version: 1.0 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: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kevans@freebsd.org, arichardson@freebsd.org, Warner Losh Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Warner Losh Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/x86_64/target_syscall.h | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/bsd-user/x86_64/target_syscall.h b/bsd-user/x86_64/target_syscall.h index a8e6274b76..ec99354e15 100644 --- a/bsd-user/x86_64/target_syscall.h +++ b/bsd-user/x86_64/target_syscall.h @@ -59,27 +59,12 @@ struct target_pt_regs { #define TARGET_GDT_ENTRY_TLS_MIN 12 #define TARGET_GDT_ENTRY_TLS_MAX 14 -#if 0 // Redefine this -struct target_modify_ldt_ldt_s { - unsigned int entry_number; - abi_ulong base_addr; - unsigned int limit; - unsigned int seg_32bit:1; - unsigned int contents:2; - unsigned int read_exec_only:1; - unsigned int limit_in_pages:1; - unsigned int seg_not_present:1; - unsigned int useable:1; - unsigned int lm:1; -}; -#else struct target_modify_ldt_ldt_s { unsigned int entry_number; abi_ulong base_addr; unsigned int limit; unsigned int flags; }; -#endif struct target_ipc64_perm { From patchwork Sat Apr 24 15:59:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1469944 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=bsdimp-com.20150623.gappssmtp.com header.i=@bsdimp-com.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=xVAT+wEs; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FSGNQ14Zvz9sVw for ; Sun, 25 Apr 2021 02:10:46 +1000 (AEST) Received: from localhost ([::1]:60980 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1laKrk-0007lX-4L for incoming@patchwork.ozlabs.org; Sat, 24 Apr 2021 12:10:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50330) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1laKiC-0005al-Cu for qemu-devel@nongnu.org; Sat, 24 Apr 2021 12:00:55 -0400 Received: from mail-io1-xd35.google.com ([2607:f8b0:4864:20::d35]:42993) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1laKi0-0004Ei-Eu for qemu-devel@nongnu.org; Sat, 24 Apr 2021 12:00:52 -0400 Received: by mail-io1-xd35.google.com with SMTP id s16so46514569iog.9 for ; Sat, 24 Apr 2021 09:00:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=jwn0jq9vw81KUNjF09Db7kJARnyiJOCQ0KsTJG3SzFQ=; b=xVAT+wEskcNxqdAE//G8XpJkpLy0FmYZoXS9GHj9cl/h50RIyrwyW31PcXomi4WL0q fP3H3WAnty2lVpPIHiRlrUr/7D1k9mLtKBUxDgaayDqIq7mHHoLx+J169rP7BD7Dhh2V gy8ppSHsLFheBfKOwICMoko/NGFyDe6hGz8zAT99pfPt69JHBCQe+u3zN1KFEzmT/ICi 8d1kdHAlc/Nk639Yc5naw1yYLX6Em1u8ResQYXAjLftgZqha/gWM5eDqqEDqBU8Axqry l+IMdTo0VWp3HbMiV8qkCeQ3e/JLYctxS/cQVEKmcrA3ZDXHXUPr5g3xyYyY/hO81RMS K3ew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=jwn0jq9vw81KUNjF09Db7kJARnyiJOCQ0KsTJG3SzFQ=; b=LuXYLd53dPhc4Ism9Wn1qEaNncvTvhaD7jv46FgacLMWNjSnhg03qyyWvZnF8pUUw/ ny+KgFGmk06SaHAGps0cDhNqTqjKFp/yFopU0CHZZu6olZXd3SYvIK1q5Giv8zvYiXar dunIFrbjv9D5g8+X1hmxjqu57oydMYhP1NhPE3o8efe8eFBnQgoNrnN924hOWH2wfbL2 AV3XUUfTFG+89DOI0VFNSvvEAPutGXfBum2mToREswk91/tGtD3TFSox3GgMjOKNmI4B AAeOqDzgA2iaJImtOdegjDV4AAstSUr4YxUTPaAyg/pxUGWNo5OCzFui62eh+y8CthKV gL4A== X-Gm-Message-State: AOAM532OYVp6qvsQsrdC0cPWeAWvI6d7iutUSDXkwwSlm9ObUZf87PB6 7p2OPy2Mdi1CVuTalo49fre7erCxBAV+7RsN X-Google-Smtp-Source: ABdhPJzWX60rXZP8DF4juUK28lQYeqv+TEUshHj7WALRTCfaHGaiQ8YL6LUUCH4GXdyrLbCi/FnVsg== X-Received: by 2002:a6b:9186:: with SMTP id t128mr7211987iod.43.1619280039167; Sat, 24 Apr 2021 09:00:39 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id h4sm4055901ili.52.2021.04.24.09.00.38 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 24 Apr 2021 09:00:38 -0700 (PDT) From: imp@bsdimp.com To: qemu-devel@nongnu.org Subject: [PATCH v2 15/48] bsd-user: style tweak: return is not a function, eliminate () Date: Sat, 24 Apr 2021 09:59:43 -0600 Message-Id: <20210424160016.15200-16-imp@bsdimp.com> X-Mailer: git-send-email 2.22.1 In-Reply-To: <20210424160016.15200-1-imp@bsdimp.com> References: <20210424160016.15200-1-imp@bsdimp.com> MIME-Version: 1.0 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: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kevans@freebsd.org, arichardson@freebsd.org, Warner Losh Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Warner Losh Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/bsdload.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/bsd-user/bsdload.c b/bsd-user/bsdload.c index 546946b91d..fd14ffa4cd 100644 --- a/bsd-user/bsdload.c +++ b/bsd-user/bsdload.c @@ -28,7 +28,7 @@ static int count(char **vec) vec++; } - return(i); + return i; } static int prepare_binprm(struct linux_binprm *bprm) @@ -38,15 +38,15 @@ static int prepare_binprm(struct linux_binprm *bprm) int retval; if (fstat(bprm->fd, &st) < 0) { - return(-errno); + return -errno; } mode = st.st_mode; if (!S_ISREG(mode)) { /* Must be regular file */ - return(-EACCES); + return -EACCES; } if (!(mode & 0111)) { /* Must have at least one execute bit set */ - return(-EACCES); + return -EACCES; } bprm->e_uid = geteuid(); @@ -75,10 +75,9 @@ static int prepare_binprm(struct linux_binprm *bprm) if (retval < 0) { perror("prepare_binprm"); exit(-1); - /* return(-errno); */ } else { - return(retval); + return retval; } } @@ -169,5 +168,5 @@ int loader_exec(const char *filename, char **argv, char **envp, for (i = 0 ; i < MAX_ARG_PAGES ; i++) { g_free(bprm.page[i]); } - return(retval); + return retval; } From patchwork Sat Apr 24 15:59:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1469963 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=bsdimp-com.20150623.gappssmtp.com header.i=@bsdimp-com.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=bm+o8ZGy; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FSGfM6kPFz9sW4 for ; Sun, 25 Apr 2021 02:22:51 +1000 (AEST) Received: from localhost ([::1]:44274 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1laL3R-0007f8-Qq for incoming@patchwork.ozlabs.org; Sat, 24 Apr 2021 12:22:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50352) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1laKiE-0005an-LV for qemu-devel@nongnu.org; Sat, 24 Apr 2021 12:00:55 -0400 Received: from mail-il1-x12b.google.com ([2607:f8b0:4864:20::12b]:42759) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1laKi2-0004FL-Cz for qemu-devel@nongnu.org; Sat, 24 Apr 2021 12:00:53 -0400 Received: by mail-il1-x12b.google.com with SMTP id a9so1187645ilh.9 for ; Sat, 24 Apr 2021 09:00:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=+qgB7LIv7ulI10/sB6fMYvxgl/UL1tSMx6lT6tBXwJc=; b=bm+o8ZGyDNA2L3GrisWJUDvv2HPhHRhEWm68wbP4DPz4CJpAoHB6Ripu0wgAmOAC7t HYaByXBVxAKHcAKWc6qr1CNktyNoPlrJTaxvgFe+JgdunuwnD3AWJ9jNLuHud4KzdnWZ Cr00f54Pky+toSzB9YHUCMJQ7derfG8RAeAAejoCmS5NEOvu+13/pwLwVLi5ZDA0kEZ4 YwkMKYM5Xd2KH4wlwGl4d2XcpuJGvGxdrjrxMnOU3dJ3TW1+tRkwS29Sw2lvqLUhIsGW +zolpWl9B1aKs+2nXiG1h3ZETyCa6jN4Cb9ngxI0g49nIFgJb8CSJDpHz2sdpNjRwbIY d68Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=+qgB7LIv7ulI10/sB6fMYvxgl/UL1tSMx6lT6tBXwJc=; b=dC7Ii9m0CcTD+W5JwvsI5bxPmqM+I24S/O3ZBTQol2kmWHl/41jSFP37IIzHfcuOMH IwEbnbM0ZTi4ZDx+zgkBLCvEEdONFO+iFbsigPCApNSj9+FGvuT+u+C3saj4vlECNVP8 +LLRI60kBI+brq+GQpshISaSHMO9IEMB91Q0cNdg8C/h2WFWFQLbYmFWm/ssmVKuOkwf dqYPGsIRmusqZbg+CCAQtubadtEfz/jsglbiozDTu3YH1rw4+VApxmmDeXR8LTJPOaud RiANRGbscLPqN8CS6khGEffpg18RTqUTfBrTSTAGFI4hcIJZSDGxERv17dKl7UaJKv5X yvHQ== X-Gm-Message-State: AOAM531cpZCXmRc2oS2Sc15U5xD7J4hFv7oI230MDOPJPR2+VJH5Q7rb AcDDQdTNVsQSzj5g00FLBSmfHAHxS6C64+AC X-Google-Smtp-Source: ABdhPJzYL57O4yujeZKUf9NBEq5F0CKJtG9h/KDxGF7A+rbfcVgtsw8TNWT1dWjGHTbAoAOS9gPR6A== X-Received: by 2002:a92:d650:: with SMTP id x16mr7034694ilp.223.1619280039908; Sat, 24 Apr 2021 09:00:39 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id h4sm4055901ili.52.2021.04.24.09.00.39 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 24 Apr 2021 09:00:39 -0700 (PDT) From: imp@bsdimp.com To: qemu-devel@nongnu.org Subject: [PATCH v2 16/48] bsd-user: style tweak: Put {} around all if/else/for statements Date: Sat, 24 Apr 2021 09:59:44 -0600 Message-Id: <20210424160016.15200-17-imp@bsdimp.com> X-Mailer: git-send-email 2.22.1 In-Reply-To: <20210424160016.15200-1-imp@bsdimp.com> References: <20210424160016.15200-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::12b; envelope-from=imp@bsdimp.com; helo=mail-il1-x12b.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kevans@freebsd.org, arichardson@freebsd.org, Warner Losh Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Warner Losh Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/bsdload.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/bsd-user/bsdload.c b/bsd-user/bsdload.c index fd14ffa4cd..e1ed3b7b60 100644 --- a/bsd-user/bsdload.c +++ b/bsd-user/bsdload.c @@ -13,8 +13,9 @@ abi_long memcpy_to_target(abi_ulong dest, const void *src, void *host_ptr; host_ptr = lock_user(VERIFY_WRITE, dest, len, 0); - if (!host_ptr) + if (!host_ptr) { return -TARGET_EFAULT; + } memcpy(host_ptr, src, len); unlock_user(host_ptr, dest, 1); return 0; @@ -75,8 +76,7 @@ static int prepare_binprm(struct linux_binprm *bprm) if (retval < 0) { perror("prepare_binprm"); exit(-1); - } - else { + } else { return retval; } } @@ -132,11 +132,13 @@ int loader_exec(const char *filename, char **argv, char **envp, int i; bprm.p = TARGET_PAGE_SIZE * MAX_ARG_PAGES - sizeof(unsigned int); - for (i = 0 ; i < MAX_ARG_PAGES ; i++) /* clear page-table */ + for (i = 0 ; i < MAX_ARG_PAGES ; i++) { /* clear page-table */ bprm.page[i] = NULL; + } retval = open(filename, O_RDONLY); - if (retval < 0) + if (retval < 0) { return retval; + } bprm.fd = retval; bprm.filename = (char *)filename; bprm.argc = count(argv); From patchwork Sat Apr 24 15:59:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1469955 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=bsdimp-com.20150623.gappssmtp.com header.i=@bsdimp-com.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=ewp5Et71; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FSGXN60l3z9sVw for ; Sun, 25 Apr 2021 02:17:40 +1000 (AEST) Received: from localhost ([::1]:56482 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1laKyQ-00016q-QU for incoming@patchwork.ozlabs.org; Sat, 24 Apr 2021 12:17:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50404) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1laKiL-0005d7-6T for qemu-devel@nongnu.org; Sat, 24 Apr 2021 12:01:10 -0400 Received: from mail-io1-xd2b.google.com ([2607:f8b0:4864:20::d2b]:37738) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1laKi2-0004Fi-DF for qemu-devel@nongnu.org; Sat, 24 Apr 2021 12:00:59 -0400 Received: by mail-io1-xd2b.google.com with SMTP id b10so51767512iot.4 for ; Sat, 24 Apr 2021 09:00:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=WzQaTwpcBBBA0bJhz9jyCl+zJZ6Jo5JR+AjitG9u2PU=; b=ewp5Et71qIuOhJMbvZlTYN1RyD39vkkI0NqYNR+KKEz+z2zJBnxJ40V0CnxmK212mI 5soaJ8e8xMAy2DqYhl0cVw05bA22GByYcEugFvaH3oq10a5CYMID+m18cc1FJf3CSr9A 7iZ+e+V0trHq+u3CQ+KsWw1gmf4gcvrPeI5fke+jB6rFBBprZgWCYjfEmXoZXrmJgh9A hYRh2yJqXaeNPRRIr6ePrMcQWQzALNKFEOFRwcAyJI/8V0lhWGI2bo6DrEYGtc1uZGTx QTzb3WBT/PrubpB0VOcRl/+Te9x5Ltf7Hw95Io8WQFGgKDewRig6J+wxpBt0YA/xW8E/ z6lw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=WzQaTwpcBBBA0bJhz9jyCl+zJZ6Jo5JR+AjitG9u2PU=; b=W2jBir6EpNHWy3+dv4/dJVi+z+LYjDPx0dC7R+ynjykYWTID5TiA+Kv23pZapuaHJK wkK99OkNBKW4eTNs28FTozde7uoH2Z+lWj0ai8yigwavAnnXZyxTtK6zUvVl6xPnACqc noDqkHCb4FUpDwHCnXlEarLmYIHSGvTkYGhpsal+PTbexOwmZiRQepuV7aEmLemVlSly 1dXXqQQ+2anZrzJ+Jbczsfn5xOg+uH8eFxwhG6mzNufruFZYZRoUE9/gjreao4Ro8r/s JplMjfUt8kHutZVbttvreNqWqxOwWreec0PKd1ys/jQNdT7Gmr5zmug+Q0D252FCPkeW BwUg== X-Gm-Message-State: AOAM533WkXU3nFAXDYZ6lxBO1fVPxTLS5vg71BDmBFCe6fvtyxiRy7B9 k9P/hXHfN+faqWD8SATFBGSp9aWASO3mUG7h X-Google-Smtp-Source: ABdhPJyImwXnnQd9imAGhb91+CFkTGfRDLlzEcg5j+CjxGugi01OyxIIPS1Y2tjNW1kbmcW0LIo/oA== X-Received: by 2002:a05:6602:1611:: with SMTP id x17mr7378087iow.65.1619280040636; Sat, 24 Apr 2021 09:00:40 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id h4sm4055901ili.52.2021.04.24.09.00.39 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 24 Apr 2021 09:00:40 -0700 (PDT) From: imp@bsdimp.com To: qemu-devel@nongnu.org Subject: [PATCH v2 17/48] bsd-user: style tweak: Fix commentary issues Date: Sat, 24 Apr 2021 09:59:45 -0600 Message-Id: <20210424160016.15200-18-imp@bsdimp.com> X-Mailer: git-send-email 2.22.1 In-Reply-To: <20210424160016.15200-1-imp@bsdimp.com> References: <20210424160016.15200-1-imp@bsdimp.com> MIME-Version: 1.0 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: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kevans@freebsd.org, Richard Henderson , arichardson@freebsd.org, Warner Losh Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Warner Losh Lines > 80 or 90 characters C++ comments BSD /*- block comment convention removed. Reviewed-by: Richard Henderson Signed-off-by: Warner Losh --- bsd-user/bsd-mman.h | 42 ++++++++++++++++++++++++++---------------- 1 file changed, 26 insertions(+), 16 deletions(-) diff --git a/bsd-user/bsd-mman.h b/bsd-user/bsd-mman.h index 910e8c1921..5a64d0d425 100644 --- a/bsd-user/bsd-mman.h +++ b/bsd-user/bsd-mman.h @@ -1,4 +1,4 @@ -/*- +/* * Copyright (c) 1982, 1986, 1993 * The Regents of the University of California. All rights reserved. * @@ -30,16 +30,20 @@ * $FreeBSD: src/sys/sys/mman.h,v 1.42 2008/03/28 04:29:27 ps Exp $ */ -#define TARGET_FREEBSD_MAP_RESERVED0080 0x0080 /* previously misimplemented MAP_INHERIT */ -#define TARGET_FREEBSD_MAP_RESERVED0100 0x0100 /* previously unimplemented MAP_NOEXTEND */ -#define TARGET_FREEBSD_MAP_STACK 0x0400 /* region grows down, like a stack */ -#define TARGET_FREEBSD_MAP_NOSYNC 0x0800 /* page to but do not sync underlying file */ +#define TARGET_FREEBSD_MAP_RESERVED0080 0x0080 + /* previously misimplemented MAP_INHERIT */ +#define TARGET_FREEBSD_MAP_RESERVED0100 0x0100 + /* previously unimplemented MAP_NOEXTEND */ +#define TARGET_FREEBSD_MAP_STACK 0x0400 + /* region grows down, like a stack */ +#define TARGET_FREEBSD_MAP_NOSYNC 0x0800 + /* page to but do not sync underlying file */ #define TARGET_FREEBSD_MAP_FLAGMASK 0x1ff7 /* $NetBSD: mman.h,v 1.42 2008/11/18 22:13:49 ad Exp $ */ -/*- +/* * Copyright (c) 1982, 1986, 1993 * The Regents of the University of California. All rights reserved. * @@ -69,18 +73,21 @@ * * @(#)mman.h 8.2 (Berkeley) 1/9/95 */ -#define TARGET_NETBSD_MAP_INHERIT 0x0080 /* region is retained after exec */ -#define TARGET_NETBSD_MAP_TRYFIXED 0x0400 /* attempt hint address, even within break */ -#define TARGET_NETBSD_MAP_WIRED 0x0800 /* mlock() mapping when it is established */ - -#define TARGET_NETBSD_MAP_STACK 0x2000 /* allocated from memory, swap space (stack) */ +#define TARGET_NETBSD_MAP_INHERIT 0x0080 + /* region is retained after exec */ +#define TARGET_NETBSD_MAP_TRYFIXED 0x0400 + /* attempt hint address, even within break */ +#define TARGET_NETBSD_MAP_WIRED 0x0800 + /* mlock() mapping when it is established */ +#define TARGET_NETBSD_MAP_STACK 0x2000 + /* allocated from memory, swap space (stack) */ #define TARGET_NETBSD_MAP_FLAGMASK 0x3ff7 /* $OpenBSD: mman.h,v 1.18 2003/07/21 22:52:19 tedu Exp $ */ /* $NetBSD: mman.h,v 1.11 1995/03/26 20:24:23 jtc Exp $ */ -/*- +/* * Copyright (c) 1982, 1986, 1993 * The Regents of the University of California. All rights reserved. * @@ -111,11 +118,14 @@ * @(#)mman.h 8.1 (Berkeley) 6/2/93 */ -#define TARGET_OPENBSD_MAP_INHERIT 0x0080 /* region is retained after exec */ -#define TARGET_OPENBSD_MAP_NOEXTEND 0x0100 /* for MAP_FILE, don't change file size */ -#define TARGET_OPENBSD_MAP_TRYFIXED 0x0400 /* attempt hint address, even within heap */ +#define TARGET_OPENBSD_MAP_INHERIT 0x0080 + /* region is retained after exec */ +#define TARGET_OPENBSD_MAP_NOEXTEND 0x0100 + /* for MAP_FILE, don't change file size */ +#define TARGET_OPENBSD_MAP_TRYFIXED 0x0400 + /* attempt hint address, even within heap */ #define TARGET_OPENBSD_MAP_FLAGMASK 0x17f7 -// XXX +/* XXX what to do in the future? */ #define TARGET_BSD_MAP_FLAGMASK 0x3ff7 From patchwork Sat Apr 24 15:59:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1469948 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=bsdimp-com.20150623.gappssmtp.com header.i=@bsdimp-com.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=oaIhameP; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FSGR04Lyxz9sVw for ; Sun, 25 Apr 2021 02:13:00 +1000 (AEST) Received: from localhost ([::1]:40950 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1laKtu-0002qa-Ia for incoming@patchwork.ozlabs.org; Sat, 24 Apr 2021 12:12:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50354) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1laKiE-0005ao-Ni for qemu-devel@nongnu.org; Sat, 24 Apr 2021 12:00:55 -0400 Received: from mail-il1-x130.google.com ([2607:f8b0:4864:20::130]:46653) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1laKi4-0004Fo-6c for qemu-devel@nongnu.org; Sat, 24 Apr 2021 12:00:54 -0400 Received: by mail-il1-x130.google.com with SMTP id l19so2612298ilk.13 for ; Sat, 24 Apr 2021 09:00:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=0Ra4ojyBQiRXbq3yO7fIMnjiQqytgyVg+dy0QRHbDHg=; b=oaIhamePoTgLpLs/c3J67Eljwzu3KJl0sCiCq3uS1djja5i/gIza+yXuPSHDYHvLH9 KLtKhpd3O0e6O5JIxxI5xwSXhwAQ3Dan8B9a/DUbcLt2d0D0f8PF63NGaT5Lmxlu8MeV TCAAzBOGPtdrHhbqOB2L4QSXv4jrfjJyfliJLEqDH/wd/xn7DWz5zrLnHOQZTs1U5Pgy iNjeCcdW+xriHZFJfPegBOpDN21XlTg7eUEKRBkFnWhMXoU/jWBu5XXZgedPkvgyPkDj QC9WJixaa4cOgysfGr+TBGj8JsK5hJxllor9YiIOTvbi8NDQ7wky4KkGNmZJDyqqoFHH h1PQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=0Ra4ojyBQiRXbq3yO7fIMnjiQqytgyVg+dy0QRHbDHg=; b=eriy6bYSxPHYUwwz35+tguQLhkpdZ/Rpm1qxF84iHy5tjCMVH3SYs1DrEKb613qvBv +4Ktxj7DDn6Aaor5gALexRVGdn+9GAzQKkvxEHP9uT/2tduCAEXPwEP+i60y/dmCibhc J+/XXJpTRyXu6CAuEx0QMht/METv4LohgpUcO+L7/Ci2f1I3h6mrWpGwzLkpndCfziHu MLnU48pL7KyEgJm3wZBMM8Asz+RHADmzMm45qUChtCFJ0paHwdyyoHOvD6LG5+BoogIc r5y34BdHZQDAto8+4Tbi/Lc+eHYz8rNg8JxyF7qQbqyM5uNhx+75At1SGPo5OQmYi3Bx ww6w== X-Gm-Message-State: AOAM530GTUeijMRuC05OQc7X7E1h3v3kMxipIjioN5Kq1UXJSem+oOwV uZY2J3BuXCYsapqhzfwecpfqk6RXMcMsJ0V5 X-Google-Smtp-Source: ABdhPJxU32facO63Yg4uSmLrZkyKK36klE/46kGqhZuA5eFCpdb8q6cCW5c3/a1X/iqgQeSvGpRM/g== X-Received: by 2002:a05:6e02:eb4:: with SMTP id u20mr7572769ilj.182.1619280041391; Sat, 24 Apr 2021 09:00:41 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id h4sm4055901ili.52.2021.04.24.09.00.40 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 24 Apr 2021 09:00:40 -0700 (PDT) From: imp@bsdimp.com To: qemu-devel@nongnu.org Subject: [PATCH v2 18/48] bsd-user: style tweak: Use preferred block comments Date: Sat, 24 Apr 2021 09:59:46 -0600 Message-Id: <20210424160016.15200-19-imp@bsdimp.com> X-Mailer: git-send-email 2.22.1 In-Reply-To: <20210424160016.15200-1-imp@bsdimp.com> References: <20210424160016.15200-1-imp@bsdimp.com> MIME-Version: 1.0 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: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kevans@freebsd.org, Richard Henderson , arichardson@freebsd.org, Warner Losh Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Warner Losh Use the preferred block comment style. Reviewed-by: Richard Henderson Signed-off-by: Warner Losh --- bsd-user/main.c | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/bsd-user/main.c b/bsd-user/main.c index 3c6c0ec687..60a62e016a 100644 --- a/bsd-user/main.c +++ b/bsd-user/main.c @@ -51,9 +51,11 @@ const char *qemu_uname_release; extern char **environ; enum BSDType bsd_type; -/* XXX: on x86 MAP_GROWSDOWN only works if ESP <= address + 32, so - we allocate a bigger stack. Need a better solution, for example - by remapping the process stack directly at the right place */ +/* + * XXX: on x86 MAP_GROWSDOWN only works if ESP <= address + 32, so + * we allocate a bigger stack. Need a better solution, for example + * by remapping the process stack directly at the right place + */ unsigned long x86_stack_size = 512 * 1024; void gemu_log(const char *fmt, ...) @@ -263,13 +265,17 @@ void cpu_loop(CPUX86State *env) #define SPARC64_STACK_BIAS 2047 /* #define DEBUG_WIN */ -/* WARNING: dealing with register windows _is_ complicated. More info - can be found at http://www.sics.se/~psm/sparcstack.html */ +/* + * WARNING: dealing with register windows _is_ complicated. More info + * can be found at http://www.sics.se/~psm/sparcstack.html + */ static inline int get_reg_index(CPUSPARCState *env, int cwp, int index) { index = (index + cwp * 16) % (16 * env->nwindows); - /* wrap handling : if cwp is on the last window, then we use the - registers 'after' the end */ + /* + * wrap handling : if cwp is on the last window, then we use the + * registers 'after' the end + */ if (index < 8 && env->cwp == env->nwindows - 1) index += 16 * env->nwindows; return index; @@ -847,9 +853,11 @@ int main(int argc, char **argv) syscall_init(); signal_init(); - /* Now that we've loaded the binary, GUEST_BASE is fixed. Delay - generating the prologue until now so that the prologue can take - the real value of GUEST_BASE into account. */ + /* + * Now that we've loaded the binary, GUEST_BASE is fixed. Delay + * generating the prologue until now so that the prologue can take + * the real value of GUEST_BASE into account. + */ tcg_prologue_init(tcg_ctx); tcg_region_init(); From patchwork Sat Apr 24 15:59:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1469975 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=bsdimp-com.20150623.gappssmtp.com header.i=@bsdimp-com.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=vSk5ScBB; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FSGps1CYxz9sTD for ; Sun, 25 Apr 2021 02:30:12 +1000 (AEST) Received: from localhost ([::1]:40578 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1laLAY-0000qs-TK for incoming@patchwork.ozlabs.org; Sat, 24 Apr 2021 12:30:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50440) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1laKiS-0005dK-SP for qemu-devel@nongnu.org; Sat, 24 Apr 2021 12:01:11 -0400 Received: from mail-il1-x132.google.com ([2607:f8b0:4864:20::132]:46655) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1laKi4-0004Fw-7f for qemu-devel@nongnu.org; Sat, 24 Apr 2021 12:01:04 -0400 Received: by mail-il1-x132.google.com with SMTP id l19so2612357ilk.13 for ; Sat, 24 Apr 2021 09:00:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=yc0G57w66B+c5dfyiTCbs3UapbbpPr/2pow6STVVxmI=; b=vSk5ScBBMmlB/aYZ5hsTgIgt60Sr7jWkIGUYv91d8HhCkbx+RDKugB8jwk2TX9mc38 1eM/bCKhNgjrk4ado5ObMY3Lgp7eL9l/NbspP7tEpvOf02c9Lv/Ns0AW7UG0pJr0ld8P iawaJGWp2uc6OpbVp3gA87sYsOJ5b0WZDSMjbBPvLcUqr6yM8NEZP02LB8bN7wsM9fz4 JX9qS3JN5z1Rqy/uJLnN4Ikvzoc1237LdCQu6wFueT62nJriz4pOKHty6C0rrTaOihyz v07DtJOXdHUXo352cMW47Pzj3NyxLnN2dA45eu3EO1kqSfkeBcae/4S+5O89JEGybfFD eqHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=yc0G57w66B+c5dfyiTCbs3UapbbpPr/2pow6STVVxmI=; b=tTA6X++SQ2/5nSLd74OQrwxjvfLtjBpeW5KkOP/1/+lZjMNBRCZLGE/HooUedGuh0p P8bd+oN/XLj26rOvu63atWuo42MnCcMl9MDyR/Du+Jddx/NSyKyB72EsukenoIPpFLBD WSuEuqOZjpsNumiMaLitgfUOz2FHgr/MUSjSDnbBO0tphVWsoVH3uB9RbncTVSslU3WZ mmMVw2P0CF25Ao8tbCBiR5SYtD4RnibKYgUFi29Y7WAWsz2l2o1FnqhoZatwwfBVLsft vKWFfsbonSzAcrkdhnVUNY5eaubF0D4k2eZd/cLrSr1IfH2sDj1vPqk8jKTGrgtp18Vz dn1g== X-Gm-Message-State: AOAM532fLN5RogsTZ1jgT8HF0j+YCEMGa0JMjJu8S8i1aJmtmGVIhVnn SNrOn6ciNPe5tPwNuUv+Mx79g2Q8py3fbzqN X-Google-Smtp-Source: ABdhPJzZEMZUbZDQWM53YAEAQZ0dTMZcxJhifNcarCCpOdW0MmligpaVpx1ygjLwEYHU+6RZF7b1GA== X-Received: by 2002:a92:dd0e:: with SMTP id n14mr1301955ilm.117.1619280042226; Sat, 24 Apr 2021 09:00:42 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id h4sm4055901ili.52.2021.04.24.09.00.41 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 24 Apr 2021 09:00:41 -0700 (PDT) From: imp@bsdimp.com To: qemu-devel@nongnu.org Subject: [PATCH v2 19/48] bsd-user: style tweak: move extern to header file Date: Sat, 24 Apr 2021 09:59:47 -0600 Message-Id: <20210424160016.15200-20-imp@bsdimp.com> X-Mailer: git-send-email 2.22.1 In-Reply-To: <20210424160016.15200-1-imp@bsdimp.com> References: <20210424160016.15200-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::132; envelope-from=imp@bsdimp.com; helo=mail-il1-x132.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kevans@freebsd.org, Richard Henderson , arichardson@freebsd.org, Warner Losh Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Warner Losh extern char **environ has no standard home, so move the declaration from the .c file to a handy .h file. Since this is a standard, old-school UNIX interface dating from the 5th edition, it's not quite the same issue that the rule is supposed to protect against, though. Reviewed-by: Richard Henderson Signed-off-by: Warner Losh --- bsd-user/main.c | 1 - bsd-user/qemu.h | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/bsd-user/main.c b/bsd-user/main.c index 60a62e016a..1b5d815c3a 100644 --- a/bsd-user/main.c +++ b/bsd-user/main.c @@ -48,7 +48,6 @@ unsigned long reserved_va; static const char *interp_prefix = CONFIG_QEMU_INTERP_PREFIX; const char *qemu_uname_release; -extern char **environ; enum BSDType bsd_type; /* diff --git a/bsd-user/qemu.h b/bsd-user/qemu.h index 7ccc8ad397..5a82722281 100644 --- a/bsd-user/qemu.h +++ b/bsd-user/qemu.h @@ -27,6 +27,8 @@ #include "exec/user/abitypes.h" +extern char **environ; + enum BSDType { target_freebsd, target_netbsd, From patchwork Sat Apr 24 15:59:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1469952 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=bsdimp-com.20150623.gappssmtp.com header.i=@bsdimp-com.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=cXxC3sBk; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FSGTv18jkz9sVw for ; Sun, 25 Apr 2021 02:15:31 +1000 (AEST) Received: from localhost ([::1]:49196 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1laKwL-0006Fr-7U for incoming@patchwork.ozlabs.org; Sat, 24 Apr 2021 12:15:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50406) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1laKiL-0005d8-8l for qemu-devel@nongnu.org; Sat, 24 Apr 2021 12:01:10 -0400 Received: from mail-il1-x12a.google.com ([2607:f8b0:4864:20::12a]:46648) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1laKi4-0004G5-ET for qemu-devel@nongnu.org; Sat, 24 Apr 2021 12:00:59 -0400 Received: by mail-il1-x12a.google.com with SMTP id l19so2612382ilk.13 for ; Sat, 24 Apr 2021 09:00:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=tqvL7SBx52oX7eGuRLboo8MvR/9/Fu4t1g4WpvQPaco=; b=cXxC3sBk+C8hj4IM1ty+yoye5+QaGRTGxqujPSUNaBaAh/7VCiIHTCgig68wC3l0YX hPsn0qboRplRRnlExM5QWMOFO8Q7BjneRrePnnjKO+5ZMFO9kGpzp4UDK/l/t/UzLT6P QuvbKRJ0ScUT4bCfd95Tea+PSduCpHtUCdxrE/3T7KaJbAbpZqLHbEcqiSXzPoJQ9HxY JhbWmS7Sspx+L2C8ses18+hXQtSQxdwEtbqsik91gld/OIs2MnfjC3YIuznNStvOzcLK QK0EyVAZyyTBlEXCvmwCJrNdX8tSrsHlY2LSxeQkJV2H5B5h/N82gG4ghxTpQYfvOyaR NZww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=tqvL7SBx52oX7eGuRLboo8MvR/9/Fu4t1g4WpvQPaco=; b=S9akepqpkRSMUZg/nd5ruidvItB8LL1CfKLn95PKvTaUqq/zlF4WpvN6g2oojJzGiP f5pBphb5b31Gek3L0kcC0cQJUT63ry417gYZ1Fp1bCPsRonuvbElHwlm+DHemwdwsitN ensWjuxEh8PICmVlAM1odOBqXMmfU+7o1CaUtAbgRjPhqDJ1A6whH407vOIcEnlV/mhn hbnp0HF2bm4ATvqT4zQ29SrPO2Jdvqd/Qh5fJ2ZECqqJj8EVUiQQ6SA9q3lsYASDzs0B HKnVHhHlOO83JzjIpELtqkS+d8hjoG3UeOVZbeglHgaBISAZz96j3qqwk9a3H7mv+IKA t4Aw== X-Gm-Message-State: AOAM533bFVz+nr/c0PL/lfwRmDMkJfHGTxzjUOtnvsOcWamgxSyOZpWm 4XZ05quUGC4g97UqD+yZ9J2X6pSwPVfFultn X-Google-Smtp-Source: ABdhPJw0syvNF3D+E6wzmjQVFYKL8czV4vGdfKVBLI8L+st98yFPvbSQJ6gRgxjXEcA+cfH+sQUC3Q== X-Received: by 2002:a05:6e02:154d:: with SMTP id j13mr6787216ilu.46.1619280043016; Sat, 24 Apr 2021 09:00:43 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id h4sm4055901ili.52.2021.04.24.09.00.42 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 24 Apr 2021 09:00:42 -0700 (PDT) From: imp@bsdimp.com To: qemu-devel@nongnu.org Subject: [PATCH v2 20/48] bsd-user: style tweak: use {} consistently in for / if / else statements Date: Sat, 24 Apr 2021 09:59:48 -0600 Message-Id: <20210424160016.15200-21-imp@bsdimp.com> X-Mailer: git-send-email 2.22.1 In-Reply-To: <20210424160016.15200-1-imp@bsdimp.com> References: <20210424160016.15200-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::12a; envelope-from=imp@bsdimp.com; helo=mail-il1-x12a.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kevans@freebsd.org, Richard Henderson , arichardson@freebsd.org, Warner Losh Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Warner Losh Fix various issues with {} not being present on if / for statements. Minor line length tweaks Move an assignment in an if out. Reviewed-by: Richard Henderson Signed-off-by: Warner Losh --- bsd-user/main.c | 66 ++++++++++++++++++++++++++++++++----------------- 1 file changed, 43 insertions(+), 23 deletions(-) diff --git a/bsd-user/main.c b/bsd-user/main.c index 1b5d815c3a..8f5cb7162d 100644 --- a/bsd-user/main.c +++ b/bsd-user/main.c @@ -218,7 +218,7 @@ void cpu_loop(CPUX86State *env) #ifndef TARGET_ABI32 case EXCP_SYSCALL: /* syscall from syscall instruction */ - if (bsd_type == target_freebsd) + if (bsd_type == target_freebsd) { env->regs[R_EAX] = do_freebsd_syscall(env, env->regs[R_EAX], env->regs[R_EDI], @@ -227,7 +227,7 @@ void cpu_loop(CPUX86State *env) env->regs[R_ECX], env->regs[8], env->regs[9], 0, 0); - else { /* if (bsd_type == target_openbsd) */ + } else { /* if (bsd_type == target_openbsd) */ env->regs[R_EAX] = do_openbsd_syscall(env, env->regs[R_EAX], env->regs[R_EDI], @@ -251,7 +251,8 @@ void cpu_loop(CPUX86State *env) break; default: pc = env->segs[R_CS].base + env->eip; - fprintf(stderr, "qemu: 0x%08lx: unhandled CPU exception 0x%x - aborting\n", + fprintf(stderr, + "qemu: 0x%08lx: unhandled CPU exception 0x%x - aborting\n", (long)pc, trapnr); abort(); } @@ -275,8 +276,9 @@ static inline int get_reg_index(CPUSPARCState *env, int cwp, int index) * wrap handling : if cwp is on the last window, then we use the * registers 'after' the end */ - if (index < 8 && env->cwp == env->nwindows - 1) + if (index < 8 && env->cwp == env->nwindows - 1) { index += 16 * env->nwindows; + } return index; } @@ -288,8 +290,9 @@ static inline void save_window_offset(CPUSPARCState *env, int cwp1) sp_ptr = env->regbase[get_reg_index(env, cwp1, 6)]; #ifdef TARGET_SPARC64 - if (sp_ptr & 3) + if (sp_ptr & 3) { sp_ptr += SPARC64_STACK_BIAS; + } #endif #if defined(DEBUG_WIN) printf("win_overflow: sp_ptr=0x" TARGET_ABI_FMT_lx " save_cwp=%d\n", @@ -338,8 +341,9 @@ static void restore_window(CPUSPARCState *env) cwp1 = cpu_cwp_inc(env, env->cwp + 1); sp_ptr = env->regbase[get_reg_index(env, cwp1, 6)]; #ifdef TARGET_SPARC64 - if (sp_ptr & 3) + if (sp_ptr & 3) { sp_ptr += SPARC64_STACK_BIAS; + } #endif #if defined(DEBUG_WIN) printf("win_underflow: sp_ptr=0x" TARGET_ABI_FMT_lx " load_cwp=%d\n", @@ -352,8 +356,9 @@ static void restore_window(CPUSPARCState *env) } #ifdef TARGET_SPARC64 env->canrestore++; - if (env->cleanwin < env->nwindows - 1) + if (env->cleanwin < env->nwindows - 1) { env->cleanwin++; + } env->cansave--; #else env->wim = new_wim; @@ -369,11 +374,13 @@ static void flush_windows(CPUSPARCState *env) /* if restore would invoke restore_window(), then we can stop */ cwp1 = cpu_cwp_inc(env, env->cwp + offset); #ifndef TARGET_SPARC64 - if (env->wim & (1 << cwp1)) + if (env->wim & (1 << cwp1)) { break; + } #else - if (env->canrestore == 0) + if (env->canrestore == 0) { break; + } env->cansave++; env->canrestore--; #endif @@ -408,8 +415,9 @@ void cpu_loop(CPUSPARCState *env) #else /* FreeBSD uses 0x141 for syscalls too */ case 0x141: - if (bsd_type != target_freebsd) + if (bsd_type != target_freebsd) { goto badtrap; + } /* fallthrough */ case 0x100: #endif @@ -418,7 +426,8 @@ void cpu_loop(CPUSPARCState *env) ret = do_freebsd_syscall(env, syscall_nr, env->regwptr[0], env->regwptr[1], env->regwptr[2], env->regwptr[3], - env->regwptr[4], env->regwptr[5], 0, 0); + env->regwptr[4], env->regwptr[5], + 0, 0); else if (bsd_type == target_netbsd) ret = do_netbsd_syscall(env, syscall_nr, env->regwptr[0], env->regwptr[1], @@ -611,8 +620,9 @@ int main(int argc, char **argv) envlist_t *envlist = NULL; bsd_type = target_openbsd; - if (argc <= 1) + if (argc <= 1) { usage(); + } error_init(argv[0]); module_call_init(MODULE_INIT_TRACE); @@ -632,11 +642,13 @@ int main(int argc, char **argv) optind = 1; for (;;) { - if (optind >= argc) + if (optind >= argc) { break; + } r = argv[optind]; - if (r[0] != '-') + if (r[0] != '-') { break; + } optind++; r++; if (!strcmp(r, "-")) { @@ -653,24 +665,28 @@ int main(int argc, char **argv) log_file = argv[optind++]; } else if (!strcmp(r, "E")) { r = argv[optind++]; - if (envlist_setenv(envlist, r) != 0) + if (envlist_setenv(envlist, r) != 0) { usage(); + } } else if (!strcmp(r, "ignore-environment")) { envlist_free(envlist); envlist = envlist_create(); } else if (!strcmp(r, "U")) { r = argv[optind++]; - if (envlist_unsetenv(envlist, r) != 0) + if (envlist_unsetenv(envlist, r) != 0) { usage(); + } } else if (!strcmp(r, "s")) { r = argv[optind++]; x86_stack_size = strtol(r, (char **)&r, 0); - if (x86_stack_size <= 0) + if (x86_stack_size <= 0) { usage(); - if (*r == 'M') + } + if (*r == 'M') { x86_stack_size *= MiB; - else if (*r == 'k' || *r == 'K') + } else if (*r == 'k' || *r == 'K') { x86_stack_size *= KiB; + } } else if (!strcmp(r, "L")) { interp_prefix = argv[optind++]; } else if (!strcmp(r, "p")) { @@ -810,11 +826,13 @@ int main(int argc, char **argv) if (!have_guest_base) { FILE *fp; - if ((fp = fopen("/proc/sys/vm/mmap_min_addr", "r")) != NULL) { + fp = fopen("/proc/sys/vm/mmap_min_addr", "r"); + if (fp != NULL) { unsigned long tmp; if (fscanf(fp, "%lu", &tmp) == 1) { mmap_min_addr = tmp; - qemu_log_mask(CPU_LOG_PAGE, "host mmap_min_addr=0x%lx\n", mmap_min_addr); + qemu_log_mask(CPU_LOG_PAGE, "host mmap_min_addr=0x%lx\n", + mmap_min_addr); } fclose(fp); } @@ -987,10 +1005,12 @@ int main(int argc, char **argv) env->pc = regs->pc; env->npc = regs->npc; env->y = regs->y; - for (i = 0; i < 8; i++) + for (i = 0; i < 8; i++) { env->gregs[i] = regs->u_regs[i]; - for (i = 0; i < 8; i++) + } + for (i = 0; i < 8; i++) { env->regwptr[i] = regs->u_regs[i + 8]; + } } #else #error unsupported target CPU From patchwork Sat Apr 24 15:59:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1469958 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=bsdimp-com.20150623.gappssmtp.com header.i=@bsdimp-com.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=OiqWBq9L; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FSGb24KR5z9sVw for ; Sun, 25 Apr 2021 02:19:57 +1000 (AEST) Received: from localhost ([::1]:36040 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1laL0c-0004HR-Eu for incoming@patchwork.ozlabs.org; Sat, 24 Apr 2021 12:19:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50470) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1laKiW-0005dm-GH for qemu-devel@nongnu.org; Sat, 24 Apr 2021 12:01:13 -0400 Received: from mail-io1-xd31.google.com ([2607:f8b0:4864:20::d31]:39644) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1laKi6-0004GE-3o for qemu-devel@nongnu.org; Sat, 24 Apr 2021 12:01:08 -0400 Received: by mail-io1-xd31.google.com with SMTP id k25so8749108iob.6 for ; Sat, 24 Apr 2021 09:00:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=cypGHuke1Rz48cNj0jFWF3sRIOifetEd7yIWaCjHGfg=; b=OiqWBq9LdYIkuMYHPcwchiCGbSZFlgAyiPqUZY9kT3trPVtsPX1+z501T2vIxdRj+n J8zcbpL8xmT+RJw1/fr2kddx+6oCk807MO/jbUsG0jzNbWJshoNIYEahZ1MHKffpWIKB frSheMUBvbVpgJ/m/3ANcz1LSQtdYE1O1GilLzOlKIgC1gMzC4EbfRsz5Hr7o/u1ltDY kf/fqBaRUXNel4Ocj+Bk/bVYHgz9EH0BFl1tLowNrUIafqLDTzLe41E/dEr9eoFDjShS k32Dl8i4Ht8L7SbEbN/+jSuDxsfa8B3H1A+9J/45YKae3aaapc9LJabYDk6iyOUA4b7J U2nQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=cypGHuke1Rz48cNj0jFWF3sRIOifetEd7yIWaCjHGfg=; b=GNhos+UhjwTzdARIgT9YkqRN/x19hWhy9uI8m1I031sIfERxm+lWWufqjmCPJ7cUFA dLAVZKh02+lCrAha+znIrArRxOtdZVXeNbQwQ+pk8NhU5KwGkWJ+Jq9+Tzw4l6FWDCGQ IF54OG1s4MZlhR6ioDnpCMYzTsAzDDUmWkvD9tfs9fnBQztcHNWKz1wAcJRzqRpPsAqU e8FIsaNJ8QM8A6LXj51O0xICVUTAY+uV5yjV7bOZD7+3TaWygPFi4tsaStk7IS1TxgjS uk+BS154PVbsAO9pymPx3uiW6pezaFnCgsVcSSMmn3DEcIV6KDEQiaMdXGztz5VS5fuM OmSQ== X-Gm-Message-State: AOAM531a+QfR/9jPwygO4o/BpPpnPOegC7Y5V8CDf0Fib9RmKoz/7pVS GtepVNIUxToaMIZIwvInufe2o7jYa2wQKWHo X-Google-Smtp-Source: ABdhPJw98eNE0EkK/Ck+/JUuZ7w5+0YEPTrU8JcY6Eo6u0K32PhjN7wSOOWaDIXp90ShTg7y9+qS6Q== X-Received: by 2002:a5d:8712:: with SMTP id u18mr7591083iom.10.1619280043903; Sat, 24 Apr 2021 09:00:43 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id h4sm4055901ili.52.2021.04.24.09.00.43 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 24 Apr 2021 09:00:43 -0700 (PDT) From: imp@bsdimp.com To: qemu-devel@nongnu.org Subject: [PATCH v2 21/48] bsd-user: style nits: return is not a function Date: Sat, 24 Apr 2021 09:59:49 -0600 Message-Id: <20210424160016.15200-22-imp@bsdimp.com> X-Mailer: git-send-email 2.22.1 In-Reply-To: <20210424160016.15200-1-imp@bsdimp.com> References: <20210424160016.15200-1-imp@bsdimp.com> MIME-Version: 1.0 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: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kevans@freebsd.org, arichardson@freebsd.org, Warner Losh Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Warner Losh Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/elfload.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bsd-user/elfload.c b/bsd-user/elfload.c index 2c6764d372..243a5a5048 100644 --- a/bsd-user/elfload.c +++ b/bsd-user/elfload.c @@ -1544,7 +1544,7 @@ int load_elf_binary(struct linux_binprm *bprm, struct target_pt_regs *regs, static int load_aout_interp(void *exptr, int interp_fd) { printf("a.out interpreter not yet supported\n"); - return(0); + return 0; } void do_init_thread(struct target_pt_regs *regs, struct image_info *infop) From patchwork Sat Apr 24 15:59:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1469972 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=bsdimp-com.20150623.gappssmtp.com header.i=@bsdimp-com.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=aq3AIIe4; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FSGlj5cLXz9sTD for ; Sun, 25 Apr 2021 02:27:29 +1000 (AEST) Received: from localhost ([::1]:32912 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1laL7v-00069u-PN for incoming@patchwork.ozlabs.org; Sat, 24 Apr 2021 12:27:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50408) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1laKiL-0005d9-9y for qemu-devel@nongnu.org; Sat, 24 Apr 2021 12:01:10 -0400 Received: from mail-il1-x135.google.com ([2607:f8b0:4864:20::135]:40755) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1laKi6-0004GQ-3W for qemu-devel@nongnu.org; Sat, 24 Apr 2021 12:01:00 -0400 Received: by mail-il1-x135.google.com with SMTP id c18so43123844iln.7 for ; Sat, 24 Apr 2021 09:00:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=CWwnQ467vFuXEUPgGAX4g261qyt/TTfvpq777LQXKTo=; b=aq3AIIe4Mam9V5JJC+eMqka2/9IY+1ldTKt5o9oyyLcCn/DN3UoxVAquv/snpcESxk IT8qpO1vpzXRW/PYw4e87NDs7OSZpBdG78yxfgFvWzevnoauokHGR46wngh7Gkb78on6 3Dv0tfR/zdJW+EsJSBbuCSch+IySTkZgcW5NvVQfTnlDjqQ4ny3jC7tRSl7HF4lE3KH/ 8WyvsliAdBntYrt6asxmeYHWsk1l5DirXrFg93Kof9/0feY4WM6pHcoprFhACOAQDd5S Fg8oOuI6aq7+kJbAcUSRQ8bQIQS8S++pkfsOnnZRhvZABjDHK8HRZf6S7hA91tB4juKb 8dFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=CWwnQ467vFuXEUPgGAX4g261qyt/TTfvpq777LQXKTo=; b=frNNH/I/KrYH4tv8pF4Wf9kBWAsBHPjgYycl/QTEV5pMqrTtNWVbCGZbo2QdOaLAqP k8g1Ur4Yp7Uxav32rDNm6wbhEK6kB4R7B2WMLilrfg3SqfJ40Y5ePrDLbEIQHIV5PosB czj4i9h/6AQRL4JkViJHHgXaWehnptXbP26OuVUQcmhGLqJYn8UEdMGKkcvI81ku9ix4 iP2VtZXaCUgDxXlwKZQjbeRps8WYZhZlLb8g4K4I5xAe4g4kWtVoKLCrdIYmAzEi3yPM CfIzXWrpAqs7am0zznwYn31yDiApl792w4teRDgYubhqSb7F5fWr5WePMjk59bORxzmy qX3w== X-Gm-Message-State: AOAM530oxkGwgG4UFzyU056FeQFUIhNYed7Dn/XWMJheZxTipbd9UIcy 8XtI5Ic072rw9dnyhYLdlcCltcgP8zvcslnu X-Google-Smtp-Source: ABdhPJwoLpktzVje1KhR4fGjg8BNAYHYcb64DyJLKg2gHjA0ucNm492f0x4biq1pzsOpmyS42xkjbQ== X-Received: by 2002:a05:6e02:1c06:: with SMTP id l6mr7226225ilh.185.1619280044785; Sat, 24 Apr 2021 09:00:44 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id h4sm4055901ili.52.2021.04.24.09.00.43 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 24 Apr 2021 09:00:44 -0700 (PDT) From: imp@bsdimp.com To: qemu-devel@nongnu.org Subject: [PATCH v2 22/48] bsd-user: use qemu_strtoul in preference to strtol Date: Sat, 24 Apr 2021 09:59:50 -0600 Message-Id: <20210424160016.15200-23-imp@bsdimp.com> X-Mailer: git-send-email 2.22.1 In-Reply-To: <20210424160016.15200-1-imp@bsdimp.com> References: <20210424160016.15200-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::135; envelope-from=imp@bsdimp.com; helo=mail-il1-x135.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kevans@freebsd.org, arichardson@freebsd.org, Warner Losh Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Warner Losh Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/main.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/bsd-user/main.c b/bsd-user/main.c index 8f5cb7162d..a98a45df21 100644 --- a/bsd-user/main.c +++ b/bsd-user/main.c @@ -37,6 +37,7 @@ #include "tcg/tcg.h" #include "qemu/timer.h" #include "qemu/envlist.h" +#include "qemu/cutils.h" #include "exec/log.h" #include "trace/control.h" @@ -613,7 +614,7 @@ int main(int argc, char **argv) TaskState ts1, *ts = &ts1; CPUArchState *env; CPUState *cpu; - int optind; + int optind, rv; const char *r; const char *gdbstub = NULL; char **target_environ, **wrk; @@ -678,8 +679,8 @@ int main(int argc, char **argv) } } else if (!strcmp(r, "s")) { r = argv[optind++]; - x86_stack_size = strtol(r, (char **)&r, 0); - if (x86_stack_size <= 0) { + rv = qemu_strtoul(r, &r, 0, &x86_stack_size); + if (rv < 0 || x86_stack_size <= 0) { usage(); } if (*r == 'M') { @@ -710,7 +711,10 @@ int main(int argc, char **argv) exit(1); } } else if (!strcmp(r, "B")) { - guest_base = strtol(argv[optind++], NULL, 0); + rv = qemu_strtoul(argv[optind++], NULL, 0, &guest_base); + if (rv < 0) { + usage(); + } have_guest_base = true; } else if (!strcmp(r, "drop-ld-preload")) { (void) envlist_unsetenv(envlist, "LD_PRELOAD"); From patchwork Sat Apr 24 15:59:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1469967 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=bsdimp-com.20150623.gappssmtp.com header.i=@bsdimp-com.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=JOACspWZ; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FSGhz3rqDz9sTD for ; Sun, 25 Apr 2021 02:25:07 +1000 (AEST) Received: from localhost ([::1]:52460 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1laL5d-0002bi-FW for incoming@patchwork.ozlabs.org; Sat, 24 Apr 2021 12:25:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50474) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1laKiW-0005dp-KO for qemu-devel@nongnu.org; Sat, 24 Apr 2021 12:01:13 -0400 Received: from mail-io1-xd34.google.com ([2607:f8b0:4864:20::d34]:41517) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1laKi8-0004Gf-Aw for qemu-devel@nongnu.org; Sat, 24 Apr 2021 12:01:12 -0400 Received: by mail-io1-xd34.google.com with SMTP id f21so15648612ioh.8 for ; Sat, 24 Apr 2021 09:00:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=kRsfn0hNO8O4221/YdDV/oj5LN+Il3pJXCXbGHcuegg=; b=JOACspWZH/Bvbl6QYnI32zI/vrr49Hk1dNnW9ZUltZGBBiVyXhEqMK6BkrInsk9W8w gy+7eDcrLqeNSNIv+hZuLPhYRyYcVp8Qxd1nz6FxPTS9hoGsLj3sZ5eZx/5N/rketaoR 6neYTt3JOVaQ1msCykdfPgF1IP/07WxLm9Sd8PFq86EkMbDmGv49T+81vDFMAbvJbqQW jjsZqU70Y8YLyrOgDqEJ0r9M2xQ0XUsPCDE/nVj5sIWq8yNcikN44fsgPoaZLbONU5nV 4MASwJhlhobRwI8H2ft7Y0NghqpDkfrP+1FuvM4r4xk7TMSMtKvze8EZJttPwkp3TeMJ p2jw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=kRsfn0hNO8O4221/YdDV/oj5LN+Il3pJXCXbGHcuegg=; b=RMhxOhj1iPx5Dr3n4LhnkzvdCnz5eeef9gsGuUHSNxQqAIkzqu4MaSmMHDQs03R9Ys 3EuPeLRyXny/agHr7zlMVkTVmOA2mYyQMpRlw1bPLAFsmI/fP6fay1slXPWF09YxzQLP 4pl8OmT/yoTKukGrU/COc78dToOcTxOr2tHqaOXBD3isc14gC84w/WgVHdVHzm8VXZlT j1owCMBNKNxNbW2CXxbKaTvaGzkzgwuyTa3lkMdjD67s70r75D7qe9YlrPxp7Y+mI8pv 9hfwM9srHVXpM410AZJ4EwjpEyKYHHTxdbk9CEDCRajy9EYFsNaRp11f7vwZEt9PRUux nYbw== X-Gm-Message-State: AOAM532pIn5yxHp12siHEfZCTydOQnpMZdAhtnro4Wy2LEcpSag4ZBiD pcBaEfWVXjyGLUH2p1j+MXgtUmMXDWmq/un1 X-Google-Smtp-Source: ABdhPJzLwpm4FP5dNevVZGhBo6KQcz80OlZtttJtpShOXU2pl539+xW80aUhgnigR4v8TJQR+Bg/gQ== X-Received: by 2002:a6b:b542:: with SMTP id e63mr7260368iof.144.1619280045746; Sat, 24 Apr 2021 09:00:45 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id h4sm4055901ili.52.2021.04.24.09.00.44 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 24 Apr 2021 09:00:45 -0700 (PDT) From: imp@bsdimp.com To: qemu-devel@nongnu.org Subject: [PATCH v2 23/48] bsd-user: introduce host_os.h for bsd-specific code and defaults Date: Sat, 24 Apr 2021 09:59:51 -0600 Message-Id: <20210424160016.15200-24-imp@bsdimp.com> X-Mailer: git-send-email 2.22.1 In-Reply-To: <20210424160016.15200-1-imp@bsdimp.com> References: <20210424160016.15200-1-imp@bsdimp.com> MIME-Version: 1.0 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: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kevans@freebsd.org, Richard Henderson , arichardson@freebsd.org, Warner Losh , Stacey Son Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Warner Losh Introduce host_os.h for frebsd, netbsd and openbsd. This sets the default bsd being implemented today. In the future it will have code that is per-BSD specific. Abstracted from a larger c93465b6208c4c95cc0a394ffef4180ba6ccf27a in the qemu-bsd-user repo. Reviewed-by: Richard Henderson Signed-off-by: Stacey Son Signed-off-by: Warner Losh --- bsd-user/freebsd/host_os.h | 25 +++++++++++++++++++++++++ bsd-user/main.c | 4 +++- bsd-user/netbsd/host_os.h | 25 +++++++++++++++++++++++++ bsd-user/openbsd/host_os.h | 25 +++++++++++++++++++++++++ 4 files changed, 78 insertions(+), 1 deletion(-) create mode 100644 bsd-user/freebsd/host_os.h create mode 100644 bsd-user/netbsd/host_os.h create mode 100644 bsd-user/openbsd/host_os.h diff --git a/bsd-user/freebsd/host_os.h b/bsd-user/freebsd/host_os.h new file mode 100644 index 0000000000..ceb1543d06 --- /dev/null +++ b/bsd-user/freebsd/host_os.h @@ -0,0 +1,25 @@ +/* + * FreeBSD host dependent code 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 __HOST_OS_H_ +#define __HOST_OS_H_ + +#define HOST_DEFAULT_BSD_TYPE target_freebsd + +#endif /*!__HOST_OS_H_ */ diff --git a/bsd-user/main.c b/bsd-user/main.c index a98a45df21..a81a70f8ac 100644 --- a/bsd-user/main.c +++ b/bsd-user/main.c @@ -41,6 +41,8 @@ #include "exec/log.h" #include "trace/control.h" +#include "host_os.h" + int singlestep; unsigned long mmap_min_addr; uintptr_t guest_base; @@ -619,7 +621,7 @@ int main(int argc, char **argv) const char *gdbstub = NULL; char **target_environ, **wrk; envlist_t *envlist = NULL; - bsd_type = target_openbsd; + bsd_type = HOST_DEFAULT_BSD_TYPE; if (argc <= 1) { usage(); diff --git a/bsd-user/netbsd/host_os.h b/bsd-user/netbsd/host_os.h new file mode 100644 index 0000000000..ccbea076e6 --- /dev/null +++ b/bsd-user/netbsd/host_os.h @@ -0,0 +1,25 @@ +/* + * NetBSD host dependent code 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 __HOST_OS_H_ +#define __HOST_OS_H_ + +#define HOST_DEFAULT_BSD_TYPE target_netbsd + +#endif /*!__HOST_OS_H_ */ diff --git a/bsd-user/openbsd/host_os.h b/bsd-user/openbsd/host_os.h new file mode 100644 index 0000000000..79468073e4 --- /dev/null +++ b/bsd-user/openbsd/host_os.h @@ -0,0 +1,25 @@ +/* + * OpenBSD host dependent code 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 __HOST_OS_H_ +#define __HOST_OS_H_ + +#define HOST_DEFAULT_BSD_TYPE target_openbsd + +#endif /*!__HOST_OS_H_ */ From patchwork Sat Apr 24 15:59:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1469961 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=bsdimp-com.20150623.gappssmtp.com header.i=@bsdimp-com.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=YvilGwOC; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FSGdY2s8Pz9sTD for ; Sun, 25 Apr 2021 02:22:09 +1000 (AEST) Received: from localhost ([::1]:42340 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1laL2l-0006sd-DE for incoming@patchwork.ozlabs.org; Sat, 24 Apr 2021 12:22:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50466) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1laKiW-0005dl-G3 for qemu-devel@nongnu.org; Sat, 24 Apr 2021 12:01:13 -0400 Received: from mail-io1-xd29.google.com ([2607:f8b0:4864:20::d29]:34650) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1laKi8-0004Gr-CC for qemu-devel@nongnu.org; Sat, 24 Apr 2021 12:01:12 -0400 Received: by mail-io1-xd29.google.com with SMTP id l21so8548420iob.1 for ; Sat, 24 Apr 2021 09:00:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=QGgDsEQCSEreTiFa0pBkZshQIPOID11pa8whoy7y464=; b=YvilGwOCWjekHZislDN4cbs1D4DyCfWNjzXytMBJ4ZyUIjgQeRiyAdJaLSv1VkAKUz V9pXWW+sddopnKaytOfNW2ItgRBOw3czVPMIHDdcXsLudSZ0P0HEj4uAFZwBVLhsYufQ d4VjewTDTYAmXLQVBbRO0KlDQoyZdOe/FqwSf91n6+WrgRhNC2+8iPWAhNKeV1oZ4v00 +uDlUgONhfEEGycy9e8KtLDhz3nLOy6xMtl/KbIb38bGG44npNOtnW4df+6DtVBpa9oC hJcINfcUWFmuXNm6UMDFovwNtXm4PABTJYW9yBT6k6KXyprycqNQCgrI75EryQhmaSgc FPnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=QGgDsEQCSEreTiFa0pBkZshQIPOID11pa8whoy7y464=; b=gH7sTz+zWLL/RYdTw4XY3VEod7KDW5QSFq1+7udszhVjK9BRd6e97caP0wMCGYM0Q8 YW+SYoVrvQh1rfv8AjmHF++j6yKDkTpQ0I0pBcfM5EhyuSSQ5kSoIl53ReQbb3U8RFwS pHT24req+l0bSkzhIjwgRNolfSm+7uBXKCgQPLGhiI4SjsMfkwY73pX+pFwlhQNgpZl/ rh1s673C3Ol9HPRzE98dexghv7tgdv/BVlNjrTRErBszKs7ImXX3MSsxn8VdQs52wKaI CQoT+saG4ombFculEkvtmXhK8Mtw98/4S+fi8Uq2R+TKUsV0QNmEHCmTRp41D0XT0bK0 ybiw== X-Gm-Message-State: AOAM533BI3kv/qGpakqZgq8ejJ4iqTHxSh6pkGufZ0NnIPP3IZOh9AkY fzyBSP57u+GbO8m7rqBKmdShcGdPiffj6MCs X-Google-Smtp-Source: ABdhPJwIZz4VIkj0cYlEZATPWnN6TRnF0b2Xt9DJqSlJ4S+RZGoz4Pf4iihUDIHLtydeB4G8Uxxewg== X-Received: by 2002:a5d:8441:: with SMTP id w1mr7566260ior.210.1619280046593; Sat, 24 Apr 2021 09:00:46 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id h4sm4055901ili.52.2021.04.24.09.00.45 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 24 Apr 2021 09:00:46 -0700 (PDT) From: imp@bsdimp.com To: qemu-devel@nongnu.org Subject: [PATCH v2 24/48] bsd-user: create target_arch_cpu.h Date: Sat, 24 Apr 2021 09:59:52 -0600 Message-Id: <20210424160016.15200-25-imp@bsdimp.com> X-Mailer: git-send-email 2.22.1 In-Reply-To: <20210424160016.15200-1-imp@bsdimp.com> References: <20210424160016.15200-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::d29; envelope-from=imp@bsdimp.com; helo=mail-io1-xd29.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kevans@freebsd.org, Richard Henderson , arichardson@freebsd.org, Warner Losh , Stacey Son Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Warner Losh Create target_arch_cpu.h to house the target_cpu_loop and target_cpu_init functions. These are the empty files that will be populated by moving the appropriate cpu-specific functions out of main.c. This work pre-dates the linux-user work that moved these to cpu-loop.c, so was done differently. As there's a number of things linux-user did differently than bsd-user in their time of divergence, and as the recertification of the code to redo it the same way will take a fair amount of effort, a separate effort to address the divergence once everything is in the tree and we can create a common qemu-user directory for the munane common elements between the two. Reviewed-by: Richard Henderson Signed-off-by: Stacey Son Signed-off-by: Warner Losh --- bsd-user/arm/target_arch_cpu.h | 22 ++++++++++++++++++++++ bsd-user/i386/target_arch_cpu.h | 22 ++++++++++++++++++++++ bsd-user/main.c | 1 + bsd-user/sparc/target_arch_cpu.h | 22 ++++++++++++++++++++++ bsd-user/sparc64/target_arch_cpu.h | 19 +++++++++++++++++++ bsd-user/x86_64/target_arch_cpu.h | 19 +++++++++++++++++++ 6 files changed, 105 insertions(+) create mode 100644 bsd-user/arm/target_arch_cpu.h create mode 100644 bsd-user/i386/target_arch_cpu.h create mode 100644 bsd-user/sparc/target_arch_cpu.h create mode 100644 bsd-user/sparc64/target_arch_cpu.h create mode 100644 bsd-user/x86_64/target_arch_cpu.h diff --git a/bsd-user/arm/target_arch_cpu.h b/bsd-user/arm/target_arch_cpu.h new file mode 100644 index 0000000000..71c89174f2 --- /dev/null +++ b/bsd-user/arm/target_arch_cpu.h @@ -0,0 +1,22 @@ +/* + * arm cpu init and loop + * + * 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 _TARGET_ARCH_CPU_H_ +#define _TARGET_ARCH_CPU_H_ + +#endif /* ! _TARGET_ARCH_CPU_H_ */ diff --git a/bsd-user/i386/target_arch_cpu.h b/bsd-user/i386/target_arch_cpu.h new file mode 100644 index 0000000000..c05e048b9b --- /dev/null +++ b/bsd-user/i386/target_arch_cpu.h @@ -0,0 +1,22 @@ +/* + * i386 cpu init and loop + * + * 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 _TARGET_ARCH_CPU_H_ +#define _TARGET_ARCH_CPU_H_ + +#endif /* ! _TARGET_ARCH_CPU_H_ */ diff --git a/bsd-user/main.c b/bsd-user/main.c index a81a70f8ac..8a270ccfe6 100644 --- a/bsd-user/main.c +++ b/bsd-user/main.c @@ -42,6 +42,7 @@ #include "trace/control.h" #include "host_os.h" +#include "target_arch_cpu.h" int singlestep; unsigned long mmap_min_addr; diff --git a/bsd-user/sparc/target_arch_cpu.h b/bsd-user/sparc/target_arch_cpu.h new file mode 100644 index 0000000000..dcf7694cba --- /dev/null +++ b/bsd-user/sparc/target_arch_cpu.h @@ -0,0 +1,22 @@ +/* + * sparc cpu init and loop + * + * 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 _TARGET_ARCH_CPU_H_ +#define _TARGET_ARCH_CPU_H_ + +#endif /* ! _TARGET_ARCH_CPU_H_ */ diff --git a/bsd-user/sparc64/target_arch_cpu.h b/bsd-user/sparc64/target_arch_cpu.h new file mode 100644 index 0000000000..c3962a8e9a --- /dev/null +++ b/bsd-user/sparc64/target_arch_cpu.h @@ -0,0 +1,19 @@ +/* + * sparc64 cpu init and loop + * + * 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 . + */ +#include "../sparc/target_arch_cpu.h" diff --git a/bsd-user/x86_64/target_arch_cpu.h b/bsd-user/x86_64/target_arch_cpu.h new file mode 100644 index 0000000000..56cb59ae0b --- /dev/null +++ b/bsd-user/x86_64/target_arch_cpu.h @@ -0,0 +1,19 @@ +/* + * x86_64 cpu init and loop + * + * 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 . + */ +#include "../i386/target_arch_cpu.h" From patchwork Sat Apr 24 15:59:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1469978 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=bsdimp-com.20150623.gappssmtp.com header.i=@bsdimp-com.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=A/d5JWyA; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FSGtM4FBhz9sTD for ; Sun, 25 Apr 2021 02:33:15 +1000 (AEST) Received: from localhost ([::1]:47264 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1laLDV-0003ie-KG for incoming@patchwork.ozlabs.org; Sat, 24 Apr 2021 12:33:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50482) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1laKiX-0005dx-NF for qemu-devel@nongnu.org; Sat, 24 Apr 2021 12:01:15 -0400 Received: from mail-io1-xd2c.google.com ([2607:f8b0:4864:20::d2c]:42986) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1laKi9-0004Gy-O8 for qemu-devel@nongnu.org; Sat, 24 Apr 2021 12:01:12 -0400 Received: by mail-io1-xd2c.google.com with SMTP id s16so46514851iog.9 for ; Sat, 24 Apr 2021 09:00:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ChJIKsZ+72i4GqDFS6kRJf73P8Vzo0ytnwE8c5MWZRo=; b=A/d5JWyAOuZYIxdSmdwp/hZHPIcQBLP8JpHDmQh/KrILQJ1uaoD+YBiQSwxsYIjC6d MJ2ew7z++HmoCfYiV0JM8ZF6GIEb01NbR1uJOWKhdTz+d9OOCLs3f+DNryhBP1BVe1gX adY7i8EaWc2ZIszRaFt2tj9+uktlctp8gXuoLQwx0Sov9HZMSV6GCIW2Grj+tOb9WL7j DXQl0n4OT8qpwHM34VJS1XswDfs7k79Nc+tuMbXpC74s76bVyRkOEMLHTljuHhJCR21u HPuehCYL1Ez47Nq3oYzFM/vrr25wEnFnkQWDyFWp6jMWtc6O8NhmoOqOahjhkSlZxSzQ ip9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ChJIKsZ+72i4GqDFS6kRJf73P8Vzo0ytnwE8c5MWZRo=; b=jq3IYDQiCQv1WMT7Qza1vYU8JsgFVzEXwM8gEPO7LiVL7BrC+hvudMLqHy/hAMkW5W FRqzBga6LU+tn457UYWA3hIlBkZvcZJIcawdYfs1zxWJ0oR0pQ119XYGM6w1/4q2RJHr gIVnz0uDM10RRRFm6Mf1CwKnP//c1W+4E2X51MgRqQ6w0dN07j13/w+Hmm6ZwyNXQmpR lrqVhj00Jc8/WDdfno+tgWlgNqEBdhfLm06BQXxjEV3nsMo3E7aPJ+ccBs32OTSH0JET PqtRQmTbCOvEW4e0b5XYj8xijJQvLrMR/acAeFssYGXfc1YxwR/Owq/Bu/L3HXSLLtB+ Wlpw== X-Gm-Message-State: AOAM530z3bh71GO3oR1YREXe1NR6cXLD26lFjdRhB+gzfD0IIh0CQjU8 ui3+SophZZ4iCEgiSGRWtlN+pHQubl6Jdz/w X-Google-Smtp-Source: ABdhPJyrTIFW8WXiLEstq3XFC7m1tvdl9DocyHQ20JPN+gaXH/i6Um4lkjpKbbrZBuWvy1VECCQ1aw== X-Received: by 2002:a05:6602:24d4:: with SMTP id h20mr7534331ioe.4.1619280047505; Sat, 24 Apr 2021 09:00:47 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id h4sm4055901ili.52.2021.04.24.09.00.46 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 24 Apr 2021 09:00:46 -0700 (PDT) From: imp@bsdimp.com To: qemu-devel@nongnu.org Subject: [PATCH v2 25/48] bsd-user: move x86 (i386 and x86_64) cpu_loop to target_arch_cpu.h Date: Sat, 24 Apr 2021 09:59:53 -0600 Message-Id: <20210424160016.15200-26-imp@bsdimp.com> X-Mailer: git-send-email 2.22.1 In-Reply-To: <20210424160016.15200-1-imp@bsdimp.com> References: <20210424160016.15200-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::d2c; envelope-from=imp@bsdimp.com; helo=mail-io1-xd2c.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kevans@freebsd.org, arichardson@freebsd.org, Warner Losh , Stacey Son Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Warner Losh Move the x86 version of the cpu_loop to target_arch_cpu.h as target_cpu_loop. Create a cpu_loop that calls the target_cpu_loop function, but only for x86 for now. This is code-movement only commit. Signed-off-by: Stacey Son Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/i386/target_arch_cpu.h | 177 +++++++++++++++++++++++++++++++- bsd-user/main.c | 176 +------------------------------ 2 files changed, 179 insertions(+), 174 deletions(-) diff --git a/bsd-user/i386/target_arch_cpu.h b/bsd-user/i386/target_arch_cpu.h index c05e048b9b..e8b306c832 100644 --- a/bsd-user/i386/target_arch_cpu.h +++ b/bsd-user/i386/target_arch_cpu.h @@ -19,4 +19,179 @@ #ifndef _TARGET_ARCH_CPU_H_ #define _TARGET_ARCH_CPU_H_ -#endif /* ! _TARGET_ARCH_CPU_H_ */ +/***********************************************************/ +/* CPUX86 core interface */ + +uint64_t cpu_get_tsc(CPUX86State *env) +{ + return cpu_get_host_ticks(); +} + +static void write_dt(void *ptr, unsigned long addr, unsigned long limit, + int flags) +{ + unsigned int e1, e2; + uint32_t *p; + e1 = (addr << 16) | (limit & 0xffff); + e2 = ((addr >> 16) & 0xff) | (addr & 0xff000000) | (limit & 0x000f0000); + e2 |= flags; + p = ptr; + p[0] = tswap32(e1); + p[1] = tswap32(e2); +} + +static uint64_t *idt_table; +#ifdef TARGET_X86_64 +static void set_gate64(void *ptr, unsigned int type, unsigned int dpl, + uint64_t addr, unsigned int sel) +{ + uint32_t *p, e1, e2; + e1 = (addr & 0xffff) | (sel << 16); + e2 = (addr & 0xffff0000) | 0x8000 | (dpl << 13) | (type << 8); + p = ptr; + p[0] = tswap32(e1); + p[1] = tswap32(e2); + p[2] = tswap32(addr >> 32); + p[3] = 0; +} +/* only dpl matters as we do only user space emulation */ +static void set_idt(int n, unsigned int dpl) +{ + set_gate64(idt_table + n * 2, 0, dpl, 0, 0); +} +#else +static void set_gate(void *ptr, unsigned int type, unsigned int dpl, + uint32_t addr, unsigned int sel) +{ + uint32_t *p, e1, e2; + e1 = (addr & 0xffff) | (sel << 16); + e2 = (addr & 0xffff0000) | 0x8000 | (dpl << 13) | (type << 8); + p = ptr; + p[0] = tswap32(e1); + p[1] = tswap32(e2); +} + +/* only dpl matters as we do only user space emulation */ +static void set_idt(int n, unsigned int dpl) +{ + set_gate(idt_table + n, 0, dpl, 0, 0); +} +#endif + +static void target_cpu_loop(CPUArchState *env) +{ + CPUState *cs = env_cpu(env); + int trapnr; + abi_ulong pc; + /* target_siginfo_t info; */ + + for (;;) { + cpu_exec_start(cs); + trapnr = cpu_exec(cs); + cpu_exec_end(cs); + process_queued_cpu_work(cs); + + switch (trapnr) { + case 0x80: + /* syscall from int $0x80 */ + if (bsd_type == target_freebsd) { + abi_ulong params = (abi_ulong) env->regs[R_ESP] + + sizeof(int32_t); + int32_t syscall_nr = env->regs[R_EAX]; + int32_t arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8; + + if (syscall_nr == TARGET_FREEBSD_NR_syscall) { + get_user_s32(syscall_nr, params); + params += sizeof(int32_t); + } else if (syscall_nr == TARGET_FREEBSD_NR___syscall) { + get_user_s32(syscall_nr, params); + params += sizeof(int64_t); + } + get_user_s32(arg1, params); + params += sizeof(int32_t); + get_user_s32(arg2, params); + params += sizeof(int32_t); + get_user_s32(arg3, params); + params += sizeof(int32_t); + get_user_s32(arg4, params); + params += sizeof(int32_t); + get_user_s32(arg5, params); + params += sizeof(int32_t); + get_user_s32(arg6, params); + params += sizeof(int32_t); + get_user_s32(arg7, params); + params += sizeof(int32_t); + get_user_s32(arg8, params); + env->regs[R_EAX] = do_freebsd_syscall(env, + syscall_nr, + arg1, + arg2, + arg3, + arg4, + arg5, + arg6, + arg7, + arg8); + } else { /* if (bsd_type == target_openbsd) */ + env->regs[R_EAX] = 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]) >= (abi_ulong)(-515)) { + env->regs[R_EAX] = -env->regs[R_EAX]; + env->eflags |= CC_C; + } else { + env->eflags &= ~CC_C; + } + break; +#ifndef TARGET_ABI32 + case EXCP_SYSCALL: + /* syscall from syscall instruction */ + if (bsd_type == target_freebsd) { + env->regs[R_EAX] = 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 == target_openbsd) */ + env->regs[R_EAX] = 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->eip = env->exception_next_eip; + if (((abi_ulong)env->regs[R_EAX]) >= (abi_ulong)(-515)) { + env->regs[R_EAX] = -env->regs[R_EAX]; + env->eflags |= CC_C; + } else { + env->eflags &= ~CC_C; + } + break; +#endif + case EXCP_INTERRUPT: + /* just indicate that signals should be handled asap */ + break; + default: + pc = env->segs[R_CS].base + env->eip; + fprintf(stderr, + "qemu: 0x%08lx: unhandled CPU exception 0x%x - aborting\n", + (long)pc, trapnr); + abort(); + } + process_pending_signals(env); + } +} + +#endif /* _TARGET_ARCH_CPU_H_ */ diff --git a/bsd-user/main.c b/bsd-user/main.c index 8a270ccfe6..43c578c760 100644 --- a/bsd-user/main.c +++ b/bsd-user/main.c @@ -88,180 +88,10 @@ void fork_end(int child) } } -#ifdef TARGET_I386 -/***********************************************************/ -/* CPUX86 core interface */ - -uint64_t cpu_get_tsc(CPUX86State *env) -{ - return cpu_get_host_ticks(); -} - -static void write_dt(void *ptr, unsigned long addr, unsigned long limit, - int flags) -{ - unsigned int e1, e2; - uint32_t *p; - e1 = (addr << 16) | (limit & 0xffff); - e2 = ((addr >> 16) & 0xff) | (addr & 0xff000000) | (limit & 0x000f0000); - e2 |= flags; - p = ptr; - p[0] = tswap32(e1); - p[1] = tswap32(e2); -} - -static uint64_t *idt_table; -#ifdef TARGET_X86_64 -static void set_gate64(void *ptr, unsigned int type, unsigned int dpl, - uint64_t addr, unsigned int sel) -{ - uint32_t *p, e1, e2; - e1 = (addr & 0xffff) | (sel << 16); - e2 = (addr & 0xffff0000) | 0x8000 | (dpl << 13) | (type << 8); - p = ptr; - p[0] = tswap32(e1); - p[1] = tswap32(e2); - p[2] = tswap32(addr >> 32); - p[3] = 0; -} -/* only dpl matters as we do only user space emulation */ -static void set_idt(int n, unsigned int dpl) -{ - set_gate64(idt_table + n * 2, 0, dpl, 0, 0); -} -#else -static void set_gate(void *ptr, unsigned int type, unsigned int dpl, - uint32_t addr, unsigned int sel) -{ - uint32_t *p, e1, e2; - e1 = (addr & 0xffff) | (sel << 16); - e2 = (addr & 0xffff0000) | 0x8000 | (dpl << 13) | (type << 8); - p = ptr; - p[0] = tswap32(e1); - p[1] = tswap32(e2); -} - -/* only dpl matters as we do only user space emulation */ -static void set_idt(int n, unsigned int dpl) -{ - set_gate(idt_table + n, 0, dpl, 0, 0); -} -#endif - -void cpu_loop(CPUX86State *env) +#ifdef TARGET_I386 /* stopgap ifdef */ +void cpu_loop(CPUArchState *env) { - CPUState *cs = env_cpu(env); - int trapnr; - abi_ulong pc; - /* target_siginfo_t info; */ - - for (;;) { - cpu_exec_start(cs); - trapnr = cpu_exec(cs); - cpu_exec_end(cs); - process_queued_cpu_work(cs); - - switch (trapnr) { - case 0x80: - /* syscall from int $0x80 */ - if (bsd_type == target_freebsd) { - abi_ulong params = (abi_ulong) env->regs[R_ESP] + - sizeof(int32_t); - int32_t syscall_nr = env->regs[R_EAX]; - int32_t arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8; - - if (syscall_nr == TARGET_FREEBSD_NR_syscall) { - get_user_s32(syscall_nr, params); - params += sizeof(int32_t); - } else if (syscall_nr == TARGET_FREEBSD_NR___syscall) { - get_user_s32(syscall_nr, params); - params += sizeof(int64_t); - } - get_user_s32(arg1, params); - params += sizeof(int32_t); - get_user_s32(arg2, params); - params += sizeof(int32_t); - get_user_s32(arg3, params); - params += sizeof(int32_t); - get_user_s32(arg4, params); - params += sizeof(int32_t); - get_user_s32(arg5, params); - params += sizeof(int32_t); - get_user_s32(arg6, params); - params += sizeof(int32_t); - get_user_s32(arg7, params); - params += sizeof(int32_t); - get_user_s32(arg8, params); - env->regs[R_EAX] = do_freebsd_syscall(env, - syscall_nr, - arg1, - arg2, - arg3, - arg4, - arg5, - arg6, - arg7, - arg8); - } else { /* if (bsd_type == target_openbsd) */ - env->regs[R_EAX] = 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]) >= (abi_ulong)(-515)) { - env->regs[R_EAX] = -env->regs[R_EAX]; - env->eflags |= CC_C; - } else { - env->eflags &= ~CC_C; - } - break; -#ifndef TARGET_ABI32 - case EXCP_SYSCALL: - /* syscall from syscall instruction */ - if (bsd_type == target_freebsd) { - env->regs[R_EAX] = 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 == target_openbsd) */ - env->regs[R_EAX] = 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->eip = env->exception_next_eip; - if (((abi_ulong)env->regs[R_EAX]) >= (abi_ulong)(-515)) { - env->regs[R_EAX] = -env->regs[R_EAX]; - env->eflags |= CC_C; - } else { - env->eflags &= ~CC_C; - } - break; -#endif - case EXCP_INTERRUPT: - /* just indicate that signals should be handled asap */ - break; - default: - pc = env->segs[R_CS].base + env->eip; - fprintf(stderr, - "qemu: 0x%08lx: unhandled CPU exception 0x%x - aborting\n", - (long)pc, trapnr); - abort(); - } - process_pending_signals(env); - } + target_cpu_loop(env); } #endif From patchwork Sat Apr 24 15:59:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1469965 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=bsdimp-com.20150623.gappssmtp.com header.i=@bsdimp-com.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=M719Dcbj; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FSGhP1RNKz9sW1 for ; Sun, 25 Apr 2021 02:24:36 +1000 (AEST) Received: from localhost ([::1]:50016 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1laL58-0001cR-VQ for incoming@patchwork.ozlabs.org; Sat, 24 Apr 2021 12:24:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50500) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1laKia-0005fG-AE for qemu-devel@nongnu.org; Sat, 24 Apr 2021 12:01:16 -0400 Received: from mail-il1-x136.google.com ([2607:f8b0:4864:20::136]:46660) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1laKiA-0004Hv-1l for qemu-devel@nongnu.org; Sat, 24 Apr 2021 12:01:16 -0400 Received: by mail-il1-x136.google.com with SMTP id l19so2612503ilk.13 for ; Sat, 24 Apr 2021 09:00:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=HRrjj+riKuNxsoGNobDL2vgkm9NEj0EAf2amQImSd+Y=; b=M719DcbjYkmAwYSyrR37TUiK2+dX3I+o8l7DR6njGXK+FZzgVKFoetCUu1kCSTNHL4 VzbV5tPlkVz8lWxUefWlVUxtX4JgwlVvD9M6WcdvBWMgyU7P3v+TalGwAC46rS/ykQTM s1sV1jV4YG/KkA9qxZWz0VkrY+LU9Pv67Q9Nyad/0OigwUdMHP4WvfGCVCtzTK3VN+zK 8hDE2fLDslTS7X637usv/i7zo0b1vALZVuVhOvBCB7DvHQXiDgQQAPSFxcZIVan1qUVr q71m4VXRL/P+AgemOsFr2Qq6g07kdbVp+nEYtSIUSZcA5bhrC7uyAG7YSIMqVlc1eIUh QR1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=HRrjj+riKuNxsoGNobDL2vgkm9NEj0EAf2amQImSd+Y=; b=QwowxsR2NE03qA9yaDg/e35/WjOMoSPDYdvI5yFs6vFSr2nKyhahldrEeJHqth0spu Gc4AN2+cll3R34kmnsJF1eMxpAcpdaLdpFDkvv9XeEzkGbc3KMIBattLTWutaNdtGMNy 8snu+CAZ71gcdV+vJTDYuUB7kXMv7e56eHgH9Mur3OKy6f+jvpG70ccnQZyqjKmHDud7 Y6md0DhWEZFd9B5XZ2o/KOs9Zsu3EC/+EG2idlyandJLBozxJVkxmPM8I5+ulaJlSfa9 wkKXcJnYjV782dnor5tFO6bl2fwI8EDYcfQik4/pj0a9TMR5cMj50Pnr8q1OhcVP/WNX XxQw== X-Gm-Message-State: AOAM5314iwJaLS4WKrSctGYaQqWD3nqZJnPY98F/S6W152h3MqV4VWHn S0YoBj/C3fS0uhM/azgMfZk5kknZ+ebhoFsr X-Google-Smtp-Source: ABdhPJzQdMgOg8mJglknqNO2X62A2gPUlPxxyaYzb5f0bpxLe1OTVJGk+k/lYSjF3ShxGBB0KUDtig== X-Received: by 2002:a92:cd85:: with SMTP id r5mr7155713ilb.169.1619280048463; Sat, 24 Apr 2021 09:00:48 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id h4sm4055901ili.52.2021.04.24.09.00.47 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 24 Apr 2021 09:00:47 -0700 (PDT) From: imp@bsdimp.com To: qemu-devel@nongnu.org Subject: [PATCH v2 26/48] bsd-user: move sparc cpu_loop into target_arch_cpu.h as target_cpu_loop Date: Sat, 24 Apr 2021 09:59:54 -0600 Message-Id: <20210424160016.15200-27-imp@bsdimp.com> X-Mailer: git-send-email 2.22.1 In-Reply-To: <20210424160016.15200-1-imp@bsdimp.com> References: <20210424160016.15200-1-imp@bsdimp.com> MIME-Version: 1.0 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: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kevans@freebsd.org, arichardson@freebsd.org, Warner Losh , Stacey Son Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Warner Losh Move the sparc cpu_loop out of main.c and into target_arch_cpu.h and rename it from cpu_loop to target_cpu_loop. Remove the #ifdef around the catch-all cpu_loop. Signed-off-by: Stacey Son Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/main.c | 270 ------------------------------- bsd-user/sparc/target_arch_cpu.h | 267 +++++++++++++++++++++++++++++- 2 files changed, 266 insertions(+), 271 deletions(-) diff --git a/bsd-user/main.c b/bsd-user/main.c index 43c578c760..af4eae2e8b 100644 --- a/bsd-user/main.c +++ b/bsd-user/main.c @@ -88,280 +88,10 @@ void fork_end(int child) } } -#ifdef TARGET_I386 /* stopgap ifdef */ void cpu_loop(CPUArchState *env) { target_cpu_loop(env); } -#endif - -#ifdef TARGET_SPARC -#define SPARC64_STACK_BIAS 2047 - -/* #define DEBUG_WIN */ -/* - * WARNING: dealing with register windows _is_ complicated. More info - * can be found at http://www.sics.se/~psm/sparcstack.html - */ -static inline int get_reg_index(CPUSPARCState *env, int cwp, int index) -{ - index = (index + cwp * 16) % (16 * env->nwindows); - /* - * wrap handling : if cwp is on the last window, then we use the - * registers 'after' the end - */ - if (index < 8 && env->cwp == env->nwindows - 1) { - index += 16 * env->nwindows; - } - return index; -} - -/* save the register window 'cwp1' */ -static inline void save_window_offset(CPUSPARCState *env, int cwp1) -{ - unsigned int i; - abi_ulong sp_ptr; - - sp_ptr = env->regbase[get_reg_index(env, cwp1, 6)]; -#ifdef TARGET_SPARC64 - if (sp_ptr & 3) { - sp_ptr += SPARC64_STACK_BIAS; - } -#endif -#if defined(DEBUG_WIN) - printf("win_overflow: sp_ptr=0x" TARGET_ABI_FMT_lx " save_cwp=%d\n", - sp_ptr, cwp1); -#endif - for (i = 0; i < 16; i++) { - /* FIXME - what to do if put_user() fails? */ - put_user_ual(env->regbase[get_reg_index(env, cwp1, 8 + i)], sp_ptr); - sp_ptr += sizeof(abi_ulong); - } -} - -static void save_window(CPUSPARCState *env) -{ -#ifndef TARGET_SPARC64 - unsigned int new_wim; - new_wim = ((env->wim >> 1) | (env->wim << (env->nwindows - 1))) & - ((1LL << env->nwindows) - 1); - save_window_offset(env, cpu_cwp_dec(env, env->cwp - 2)); - env->wim = new_wim; -#else - /* - * cansave is zero if the spill trap handler is triggered by `save` and - * nonzero if triggered by a `flushw` - */ - save_window_offset(env, cpu_cwp_dec(env, env->cwp - env->cansave - 2)); - env->cansave++; - env->canrestore--; -#endif -} - -static void restore_window(CPUSPARCState *env) -{ -#ifndef TARGET_SPARC64 - unsigned int new_wim; -#endif - unsigned int i, cwp1; - abi_ulong sp_ptr; - -#ifndef TARGET_SPARC64 - new_wim = ((env->wim << 1) | (env->wim >> (env->nwindows - 1))) & - ((1LL << env->nwindows) - 1); -#endif - - /* restore the invalid window */ - cwp1 = cpu_cwp_inc(env, env->cwp + 1); - sp_ptr = env->regbase[get_reg_index(env, cwp1, 6)]; -#ifdef TARGET_SPARC64 - if (sp_ptr & 3) { - sp_ptr += SPARC64_STACK_BIAS; - } -#endif -#if defined(DEBUG_WIN) - printf("win_underflow: sp_ptr=0x" TARGET_ABI_FMT_lx " load_cwp=%d\n", - sp_ptr, cwp1); -#endif - for (i = 0; i < 16; i++) { - /* FIXME - what to do if get_user() fails? */ - get_user_ual(env->regbase[get_reg_index(env, cwp1, 8 + i)], sp_ptr); - sp_ptr += sizeof(abi_ulong); - } -#ifdef TARGET_SPARC64 - env->canrestore++; - if (env->cleanwin < env->nwindows - 1) { - env->cleanwin++; - } - env->cansave--; -#else - env->wim = new_wim; -#endif -} - -static void flush_windows(CPUSPARCState *env) -{ - int offset, cwp1; - - offset = 1; - for (;;) { - /* if restore would invoke restore_window(), then we can stop */ - cwp1 = cpu_cwp_inc(env, env->cwp + offset); -#ifndef TARGET_SPARC64 - if (env->wim & (1 << cwp1)) { - break; - } -#else - if (env->canrestore == 0) { - break; - } - env->cansave++; - env->canrestore--; -#endif - save_window_offset(env, cwp1); - offset++; - } - cwp1 = cpu_cwp_inc(env, env->cwp + 1); -#ifndef TARGET_SPARC64 - /* set wim so that restore will reload the registers */ - env->wim = 1 << cwp1; -#endif -#if defined(DEBUG_WIN) - printf("flush_windows: nb=%d\n", offset - 1); -#endif -} - -void cpu_loop(CPUSPARCState *env) -{ - CPUState *cs = env_cpu(env); - int trapnr, ret, syscall_nr; - /* target_siginfo_t info; */ - - while (1) { - cpu_exec_start(cs); - trapnr = cpu_exec(cs); - cpu_exec_end(cs); - process_queued_cpu_work(cs); - - switch (trapnr) { -#ifndef TARGET_SPARC64 - case 0x80: -#else - /* FreeBSD uses 0x141 for syscalls too */ - case 0x141: - if (bsd_type != target_freebsd) { - goto badtrap; - } - /* fallthrough */ - case 0x100: -#endif - syscall_nr = env->gregs[1]; - if (bsd_type == target_freebsd) - ret = do_freebsd_syscall(env, syscall_nr, - env->regwptr[0], env->regwptr[1], - env->regwptr[2], env->regwptr[3], - env->regwptr[4], env->regwptr[5], - 0, 0); - else if (bsd_type == target_netbsd) - ret = do_netbsd_syscall(env, syscall_nr, - env->regwptr[0], env->regwptr[1], - env->regwptr[2], env->regwptr[3], - env->regwptr[4], env->regwptr[5]); - else { /* if (bsd_type == target_openbsd) */ -#if defined(TARGET_SPARC64) - syscall_nr &= ~(TARGET_OPENBSD_SYSCALL_G7RFLAG | - TARGET_OPENBSD_SYSCALL_G2RFLAG); -#endif - ret = do_openbsd_syscall(env, syscall_nr, - env->regwptr[0], env->regwptr[1], - env->regwptr[2], env->regwptr[3], - env->regwptr[4], env->regwptr[5]); - } - if ((unsigned int)ret >= (unsigned int)(-515)) { - ret = -ret; -#if defined(TARGET_SPARC64) && !defined(TARGET_ABI32) - env->xcc |= PSR_CARRY; -#else - env->psr |= PSR_CARRY; -#endif - } else { -#if defined(TARGET_SPARC64) && !defined(TARGET_ABI32) - env->xcc &= ~PSR_CARRY; -#else - env->psr &= ~PSR_CARRY; -#endif - } - env->regwptr[0] = ret; - /* next instruction */ -#if defined(TARGET_SPARC64) - if (bsd_type == target_openbsd && - env->gregs[1] & TARGET_OPENBSD_SYSCALL_G2RFLAG) { - env->pc = env->gregs[2]; - env->npc = env->pc + 4; - } else if (bsd_type == target_openbsd && - env->gregs[1] & TARGET_OPENBSD_SYSCALL_G7RFLAG) { - env->pc = env->gregs[7]; - env->npc = env->pc + 4; - } else { - env->pc = env->npc; - env->npc = env->npc + 4; - } -#else - env->pc = env->npc; - env->npc = env->npc + 4; -#endif - break; - case 0x83: /* flush windows */ -#ifdef TARGET_ABI32 - case 0x103: -#endif - flush_windows(env); - /* next instruction */ - env->pc = env->npc; - env->npc = env->npc + 4; - break; -#ifndef TARGET_SPARC64 - case TT_WIN_OVF: /* window overflow */ - save_window(env); - break; - case TT_WIN_UNF: /* window underflow */ - restore_window(env); - break; - case TT_TFAULT: - case TT_DFAULT: - break; -#else - case TT_SPILL: /* window overflow */ - save_window(env); - break; - case TT_FILL: /* window underflow */ - restore_window(env); - break; - case TT_TFAULT: - case TT_DFAULT: - break; -#endif - case EXCP_INTERRUPT: - /* just indicate that signals should be handled asap */ - break; - case EXCP_DEBUG: - { - gdb_handlesig(cs, TARGET_SIGTRAP); - } - break; - default: -#ifdef TARGET_SPARC64 - badtrap: -#endif - printf("Unhandled trap: 0x%x\n", trapnr); - cpu_dump_state(cs, stderr, 0); - exit(1); - } - process_pending_signals(env); - } -} - -#endif static void usage(void) { diff --git a/bsd-user/sparc/target_arch_cpu.h b/bsd-user/sparc/target_arch_cpu.h index dcf7694cba..5e3ecbed5c 100644 --- a/bsd-user/sparc/target_arch_cpu.h +++ b/bsd-user/sparc/target_arch_cpu.h @@ -19,4 +19,269 @@ #ifndef _TARGET_ARCH_CPU_H_ #define _TARGET_ARCH_CPU_H_ -#endif /* ! _TARGET_ARCH_CPU_H_ */ +#define SPARC64_STACK_BIAS 2047 + +/* #define DEBUG_WIN */ +/* + * WARNING: dealing with register windows _is_ complicated. More info + * can be found at http://www.sics.se/~psm/sparcstack.html + */ +static inline int get_reg_index(CPUSPARCState *env, int cwp, int index) +{ + index = (index + cwp * 16) % (16 * env->nwindows); + /* + * wrap handling : if cwp is on the last window, then we use the + * registers 'after' the end + */ + if (index < 8 && env->cwp == env->nwindows - 1) { + index += 16 * env->nwindows; + } + return index; +} + +/* save the register window 'cwp1' */ +static inline void save_window_offset(CPUSPARCState *env, int cwp1) +{ + unsigned int i; + abi_ulong sp_ptr; + + sp_ptr = env->regbase[get_reg_index(env, cwp1, 6)]; +#ifdef TARGET_SPARC64 + if (sp_ptr & 3) { + sp_ptr += SPARC64_STACK_BIAS; + } +#endif +#if defined(DEBUG_WIN) + printf("win_overflow: sp_ptr=0x" TARGET_ABI_FMT_lx " save_cwp=%d\n", + sp_ptr, cwp1); +#endif + for (i = 0; i < 16; i++) { + /* FIXME - what to do if put_user() fails? */ + put_user_ual(env->regbase[get_reg_index(env, cwp1, 8 + i)], sp_ptr); + sp_ptr += sizeof(abi_ulong); + } +} + +static void save_window(CPUSPARCState *env) +{ +#ifndef TARGET_SPARC64 + unsigned int new_wim; + new_wim = ((env->wim >> 1) | (env->wim << (env->nwindows - 1))) & + ((1LL << env->nwindows) - 1); + save_window_offset(env, cpu_cwp_dec(env, env->cwp - 2)); + env->wim = new_wim; +#else + /* + * cansave is zero if the spill trap handler is triggered by `save` and + * nonzero if triggered by a `flushw` + */ + save_window_offset(env, cpu_cwp_dec(env, env->cwp - env->cansave - 2)); + env->cansave++; + env->canrestore--; +#endif +} + +static void restore_window(CPUSPARCState *env) +{ +#ifndef TARGET_SPARC64 + unsigned int new_wim; +#endif + unsigned int i, cwp1; + abi_ulong sp_ptr; + +#ifndef TARGET_SPARC64 + new_wim = ((env->wim << 1) | (env->wim >> (env->nwindows - 1))) & + ((1LL << env->nwindows) - 1); +#endif + + /* restore the invalid window */ + cwp1 = cpu_cwp_inc(env, env->cwp + 1); + sp_ptr = env->regbase[get_reg_index(env, cwp1, 6)]; +#ifdef TARGET_SPARC64 + if (sp_ptr & 3) { + sp_ptr += SPARC64_STACK_BIAS; + } +#endif +#if defined(DEBUG_WIN) + printf("win_underflow: sp_ptr=0x" TARGET_ABI_FMT_lx " load_cwp=%d\n", + sp_ptr, cwp1); +#endif + for (i = 0; i < 16; i++) { + /* FIXME - what to do if get_user() fails? */ + get_user_ual(env->regbase[get_reg_index(env, cwp1, 8 + i)], sp_ptr); + sp_ptr += sizeof(abi_ulong); + } +#ifdef TARGET_SPARC64 + env->canrestore++; + if (env->cleanwin < env->nwindows - 1) { + env->cleanwin++; + } + env->cansave--; +#else + env->wim = new_wim; +#endif +} + +static void flush_windows(CPUSPARCState *env) +{ + int offset, cwp1; + + offset = 1; + for (;;) { + /* if restore would invoke restore_window(), then we can stop */ + cwp1 = cpu_cwp_inc(env, env->cwp + offset); +#ifndef TARGET_SPARC64 + if (env->wim & (1 << cwp1)) { + break; + } +#else + if (env->canrestore == 0) { + break; + } + env->cansave++; + env->canrestore--; +#endif + save_window_offset(env, cwp1); + offset++; + } + cwp1 = cpu_cwp_inc(env, env->cwp + 1); +#ifndef TARGET_SPARC64 + /* set wim so that restore will reload the registers */ + env->wim = 1 << cwp1; +#endif +#if defined(DEBUG_WIN) + printf("flush_windows: nb=%d\n", offset - 1); +#endif +} + +static void target_cpu_loop(CPUSPARCState *env) +{ + CPUState *cs = env_cpu(env); + int trapnr, ret, syscall_nr; + /* target_siginfo_t info; */ + + while (1) { + cpu_exec_start(cs); + trapnr = cpu_exec(cs); + cpu_exec_end(cs); + process_queued_cpu_work(cs); + + switch (trapnr) { +#ifndef TARGET_SPARC64 + case 0x80: +#else + /* FreeBSD uses 0x141 for syscalls too */ + case 0x141: + if (bsd_type != target_freebsd) { + goto badtrap; + } + /* fallthrough */ + case 0x100: +#endif + syscall_nr = env->gregs[1]; + if (bsd_type == target_freebsd) + ret = do_freebsd_syscall(env, syscall_nr, + env->regwptr[0], env->regwptr[1], + env->regwptr[2], env->regwptr[3], + env->regwptr[4], env->regwptr[5], + 0, 0); + else if (bsd_type == target_netbsd) + ret = do_netbsd_syscall(env, syscall_nr, + env->regwptr[0], env->regwptr[1], + env->regwptr[2], env->regwptr[3], + env->regwptr[4], env->regwptr[5]); + else { /* if (bsd_type == target_openbsd) */ +#if defined(TARGET_SPARC64) + syscall_nr &= ~(TARGET_OPENBSD_SYSCALL_G7RFLAG | + TARGET_OPENBSD_SYSCALL_G2RFLAG); +#endif + ret = do_openbsd_syscall(env, syscall_nr, + env->regwptr[0], env->regwptr[1], + env->regwptr[2], env->regwptr[3], + env->regwptr[4], env->regwptr[5]); + } + if ((unsigned int)ret >= (unsigned int)(-515)) { + ret = -ret; +#if defined(TARGET_SPARC64) && !defined(TARGET_ABI32) + env->xcc |= PSR_CARRY; +#else + env->psr |= PSR_CARRY; +#endif + } else { +#if defined(TARGET_SPARC64) && !defined(TARGET_ABI32) + env->xcc &= ~PSR_CARRY; +#else + env->psr &= ~PSR_CARRY; +#endif + } + env->regwptr[0] = ret; + /* next instruction */ +#if defined(TARGET_SPARC64) + if (bsd_type == target_openbsd && + env->gregs[1] & TARGET_OPENBSD_SYSCALL_G2RFLAG) { + env->pc = env->gregs[2]; + env->npc = env->pc + 4; + } else if (bsd_type == target_openbsd && + env->gregs[1] & TARGET_OPENBSD_SYSCALL_G7RFLAG) { + env->pc = env->gregs[7]; + env->npc = env->pc + 4; + } else { + env->pc = env->npc; + env->npc = env->npc + 4; + } +#else + env->pc = env->npc; + env->npc = env->npc + 4; +#endif + break; + case 0x83: /* flush windows */ +#ifdef TARGET_ABI32 + case 0x103: +#endif + flush_windows(env); + /* next instruction */ + env->pc = env->npc; + env->npc = env->npc + 4; + break; +#ifndef TARGET_SPARC64 + case TT_WIN_OVF: /* window overflow */ + save_window(env); + break; + case TT_WIN_UNF: /* window underflow */ + restore_window(env); + break; + case TT_TFAULT: + case TT_DFAULT: + break; +#else + case TT_SPILL: /* window overflow */ + save_window(env); + break; + case TT_FILL: /* window underflow */ + restore_window(env); + break; + case TT_TFAULT: + case TT_DFAULT: + break; +#endif + case EXCP_INTERRUPT: + /* just indicate that signals should be handled asap */ + break; + case EXCP_DEBUG: + { + gdb_handlesig(cs, TARGET_SIGTRAP); + } + break; + default: +#ifdef TARGET_SPARC64 + badtrap: +#endif + printf("Unhandled trap: 0x%x\n", trapnr); + cpu_dump_state(cs, stderr, 0); + exit(1); + } + process_pending_signals(env); + } +} + +#endif /* _TARGET_ARCH_CPU_H_ */ From patchwork Sat Apr 24 15:59:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1469956 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=bsdimp-com.20150623.gappssmtp.com header.i=@bsdimp-com.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=URaR9I8n; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FSGXc75DJz9sVw for ; Sun, 25 Apr 2021 02:17:52 +1000 (AEST) Received: from localhost ([::1]:57658 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1laKyc-0001aB-Vs for incoming@patchwork.ozlabs.org; Sat, 24 Apr 2021 12:17:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50524) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1laKie-0005h9-7b for qemu-devel@nongnu.org; Sat, 24 Apr 2021 12:01:20 -0400 Received: from mail-io1-xd30.google.com ([2607:f8b0:4864:20::d30]:35442) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1laKiB-0004IN-LM for qemu-devel@nongnu.org; Sat, 24 Apr 2021 12:01:19 -0400 Received: by mail-io1-xd30.google.com with SMTP id t21so944227iob.2 for ; Sat, 24 Apr 2021 09:00:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=skPt9enRR+SX6X1JLVS3CXeQzytNJXaZIsNfJk8nNA0=; b=URaR9I8njhMOsAyVDmMISiIkogB6GUW4mFYtIvUA0yeHrz+RMwN5Dto18eV4ueA/kf Iov1MIkWCs3bUyS8nnGN8bUZyfLjNJX6Ch479Q+J9tSR3bq89PIjMwTs8ICNy3pagNVl Gz8Aqd8fEhUu4e4OFtBZxdFBbB09VmEPcp2OYuMyXcalppo0GPEPrlExJgbDlWd2ILVO 18S1gI3m51T7Ftd51PjiUv5Mm31mwmvjEjp6ZzqsPAOKIK1JrVM3J/gst0SQMZtpklDz eFpnS7UnVNI7KkdQPtGEbu1nOqbGBTkvzOESoqebbLEmTdrXMf5Z+XxCC+n7KYTJb6te d06w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=skPt9enRR+SX6X1JLVS3CXeQzytNJXaZIsNfJk8nNA0=; b=qwB8XmHX/ZudCq6+6fLEZ0Lff0GLaq1VZmtm3nH7nMltOxvaKjwmMT4sR8fo9mRLCh HoJmnvid9QF4U/IyP2Z/ls33nuEhxjPMn1V2TzfugeEjrhB8okyl3Rd85dN3lDGedTvg mkDLbjKmj+2UgPvVQ7se+3e3eQgVNhaqHgj/bw4OuLnKa7rLMwAkYtJIeIPBXSruw7p/ zxPhGN+5zxmpNM+wV0ZH+vSlZ5q6e3/0vUHEJV5yOHRVZl/19DxMIM6ZhcCNTaA1vdMa lrjag6YCi05B+Z9H+qIQh+V9m1YwhqsOR/2i5aRVihwz0JRvGMNM8KZ8kMkJZ4RcRUWx Unxg== X-Gm-Message-State: AOAM532vZy5eVoAtfZfM+/3X9T9oD3NyDvGl2eH2ct7J7kqhhLVH6jTc zd6VpPsQYmQ79DptQWCVfVkdMHNpzofwtaYT X-Google-Smtp-Source: ABdhPJzNqZxPU61x3XiV8G4ePWyUkWNfWeDiTwtMb3xpoAusMJhYar9HpflGKWpQa7NUkzYvoFC97w== X-Received: by 2002:a02:a14a:: with SMTP id m10mr8367292jah.105.1619280049112; Sat, 24 Apr 2021 09:00:49 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id h4sm4055901ili.52.2021.04.24.09.00.48 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 24 Apr 2021 09:00:48 -0700 (PDT) From: imp@bsdimp.com To: qemu-devel@nongnu.org Subject: [PATCH v2 27/48] bsd-user: style tweak: space pedantry Date: Sat, 24 Apr 2021 09:59:55 -0600 Message-Id: <20210424160016.15200-28-imp@bsdimp.com> X-Mailer: git-send-email 2.22.1 In-Reply-To: <20210424160016.15200-1-imp@bsdimp.com> References: <20210424160016.15200-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::d30; envelope-from=imp@bsdimp.com; helo=mail-io1-xd30.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kevans@freebsd.org, arichardson@freebsd.org, Warner Losh Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Warner Losh Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/elfload.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/bsd-user/elfload.c b/bsd-user/elfload.c index 243a5a5048..f455a3812a 100644 --- a/bsd-user/elfload.c +++ b/bsd-user/elfload.c @@ -756,7 +756,7 @@ static void padzero(abi_ulong elf_bss, abi_ulong last_bss) static abi_ulong create_elf_tables(abi_ulong p, int argc, int envc, - struct elfhdr * exec, + struct elfhdr *exec, abi_ulong load_addr, abi_ulong load_bias, abi_ulong interp_load_addr, int ibcs, @@ -891,12 +891,12 @@ static abi_ulong load_elf_interp(struct elfhdr *interp_elf_ex, if (retval < 0) { perror("load_elf_interp"); exit(-1); - free (elf_phdata); + free(elf_phdata); return retval; } #ifdef BSWAP_NEEDED eppnt = elf_phdata; - for (i = 0; ie_phnum; i++, eppnt++) { + for (i = 0; i < interp_elf_ex->e_phnum; i++, eppnt++) { bswap_phdr(eppnt); } #endif @@ -1155,11 +1155,11 @@ int load_elf_binary(struct linux_binprm *bprm, struct target_pt_regs *regs, unsigned int interpreter_type = INTERPRETER_NONE; unsigned char ibcs2_interpreter; int i; - struct elf_phdr * elf_ppnt; + struct elf_phdr *elf_ppnt; struct elf_phdr *elf_phdata; abi_ulong elf_bss, k, elf_brk; int retval; - char * elf_interpreter; + char *elf_interpreter; abi_ulong elf_entry, interp_load_addr = 0; abi_ulong start_code, end_code, start_data, end_data; abi_ulong reloc_func_desc = 0; @@ -1183,14 +1183,14 @@ int load_elf_binary(struct linux_binprm *bprm, struct target_pt_regs *regs, } bprm->p = copy_elf_strings(1, &bprm->filename, bprm->page, bprm->p); - bprm->p = copy_elf_strings(bprm->envc, bprm->envp, bprm->page,bprm->p); - bprm->p = copy_elf_strings(bprm->argc, bprm->argv, bprm->page,bprm->p); + bprm->p = copy_elf_strings(bprm->envc, bprm->envp, bprm->page, bprm->p); + bprm->p = copy_elf_strings(bprm->argc, bprm->argv, bprm->page, bprm->p); if (!bprm->p) { retval = -E2BIG; } /* Now read in all of the header information */ - elf_phdata = (struct elf_phdr *)malloc(elf_ex.e_phentsize*elf_ex.e_phnum); + elf_phdata = (struct elf_phdr *)malloc(elf_ex.e_phentsize * elf_ex.e_phnum); if (elf_phdata == NULL) { return -ENOMEM; } @@ -1223,11 +1223,11 @@ int load_elf_binary(struct linux_binprm *bprm, struct target_pt_regs *regs, elf_interpreter = NULL; start_code = ~((abi_ulong)0UL); end_code = 0; - start_data = 0; + start_data =n 0; end_data = 0; interp_ex.a_info = 0; - for (i = 0;i < elf_ex.e_phnum; i++) { + for (i = 0; i < elf_ex.e_phnum; i++) { if (elf_ppnt->p_type == PT_INTERP) { if (elf_interpreter != NULL) { @@ -1267,7 +1267,7 @@ int load_elf_binary(struct linux_binprm *bprm, struct target_pt_regs *regs, if (strcmp(elf_interpreter, "/usr/lib/libc.so.1") == 0 || strcmp(elf_interpreter, "/usr/lib/ld.so.1") == 0) { - ibcs2_interpreter = 1; + ibcs2_interpreter = 1; } if (retval >= 0) { From patchwork Sat Apr 24 15:59:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1469959 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=bsdimp-com.20150623.gappssmtp.com header.i=@bsdimp-com.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=ECHxF7/4; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FSGbQ1Jppz9sTD for ; Sun, 25 Apr 2021 02:20:18 +1000 (AEST) Received: from localhost ([::1]:36870 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1laL0y-0004bu-84 for incoming@patchwork.ozlabs.org; Sat, 24 Apr 2021 12:20:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50578) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1laKih-0005lA-2P for qemu-devel@nongnu.org; Sat, 24 Apr 2021 12:01:23 -0400 Received: from mail-il1-x135.google.com ([2607:f8b0:4864:20::135]:41858) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1laKiC-0004Ik-4n for qemu-devel@nongnu.org; Sat, 24 Apr 2021 12:01:22 -0400 Received: by mail-il1-x135.google.com with SMTP id v13so3393220ilj.8 for ; Sat, 24 Apr 2021 09:00:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=3Loms89On+HG9roTBfduFzz7Xoo1aA4kWUV9uyqYbeY=; b=ECHxF7/4yFj0sHwTsaaO5iNAlcpzk8HoOyYbcixVvu1ckLhkhYbJNpsCvH1LvMfb9A 2So1TJwPPa2SNBijuA8b7lftmsY+xcAbPD8WR95KWkJfafY2ma5gpyrB7PWcSEuVh79N oxHtSEtDiWjq9jnj698Uqwo4/ZghVfJbE0/XSVTuVMHCfDKE5oDslEMblbCwn3PbkyCc u5S79JUVIYkH47i0+D7FPxbrtuLHCQhokBvT/H0WaFAdxCbogFMBWzZiHs4p5gdUXVH8 WUfrMkKZUeQvp1SXknXcXKa+fj4oo8BAidEBemQ9HygJWJnZwGsX0zuEQHDq/0OwHAwe Jh/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=3Loms89On+HG9roTBfduFzz7Xoo1aA4kWUV9uyqYbeY=; b=hPgAIqw44f+TcaErJsasCjvq5VhTfz9mSH6xAt6q3DlnrBsY+/xoiSglEoTqjXUCH7 Y77wzi7401euLEUFtndgZHtFgNg6GHhHfEm9UuJtxLc8zhBIMvsQTq7F/A1k2SOA3S5e 7Uw+CCI0RK6y805fvR+ZIZITOOVu8TDrBAXIvoPYRY+2+svrMffemiXDFNY5tIYvz+R+ 2ClPgDGHZacIUPtjfkLX4+goKZnEBnlV05i2MePoLr88KRcl7FOhHraHkgV5M/0CmIF4 XpPLYiSItVcF1CQbyGO2Q7omfOkGK4D12DY7WfzHt6FpGXZYDlsTI8cakbV1c/LWlKZv tDRQ== X-Gm-Message-State: AOAM5317xtrN3Yu/AKffPJ/HVHBYRRD5kXE+6/u8AAsfnRAYDkNagIKY XcQgLlMOszChX43S1ni0cjM1Fd+mXxYSAaq7 X-Google-Smtp-Source: ABdhPJyqtky+iU68d9nnrzHk7kqqArEm0SK6iJrpXCx46W63rNE81pry715KYXHoItoPDb/+NZaMWw== X-Received: by 2002:a92:6908:: with SMTP id e8mr7172809ilc.207.1619280049949; Sat, 24 Apr 2021 09:00:49 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id h4sm4055901ili.52.2021.04.24.09.00.49 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 24 Apr 2021 09:00:49 -0700 (PDT) From: imp@bsdimp.com To: qemu-devel@nongnu.org Subject: [PATCH v2 28/48] bsd-user: style tweak: comments Date: Sat, 24 Apr 2021 09:59:56 -0600 Message-Id: <20210424160016.15200-29-imp@bsdimp.com> X-Mailer: git-send-email 2.22.1 In-Reply-To: <20210424160016.15200-1-imp@bsdimp.com> References: <20210424160016.15200-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::135; envelope-from=imp@bsdimp.com; helo=mail-il1-x135.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kevans@freebsd.org, arichardson@freebsd.org, Warner Losh Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Warner Losh Use the preferred block comment style, move comments as needed for line length restrictions, delete some dead code that looked like a comment, break some lines > 80 columns at the same time since there are many associated with comments. Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/elfload.c | 216 ++++++++++++++++++++++++++------------------- 1 file changed, 123 insertions(+), 93 deletions(-) diff --git a/bsd-user/elfload.c b/bsd-user/elfload.c index f455a3812a..75ccc06719 100644 --- a/bsd-user/elfload.c +++ b/bsd-user/elfload.c @@ -23,10 +23,10 @@ * These occupy the top three bytes. */ enum { - ADDR_NO_RANDOMIZE = 0x0040000, /* disable randomization of VA space */ - FDPIC_FUNCPTRS = 0x0080000, /* userspace function ptrs point to descriptors - * (signal handling) - */ + /* disable randomization of VA space */ + ADDR_NO_RANDOMIZE = 0x0040000, + /* userspace function ptrs point to descriptors (signal handling) */ + FDPIC_FUNCPTRS = 0x0080000, MMAP_PAGE_ZERO = 0x0100000, ADDR_COMPAT_LAYOUT = 0x0200000, READ_IMPLIES_EXEC = 0x0400000, @@ -117,7 +117,8 @@ static uint32_t get_elf_hwcap(void) #define ELF_DATA ELFDATA2LSB #define ELF_ARCH EM_X86_64 -static inline void init_thread(struct target_pt_regs *regs, struct image_info *infop) +static inline void init_thread(struct target_pt_regs *regs, + struct image_info *infop) { regs->rax = 0; regs->rsp = infop->start_stack; @@ -143,18 +144,21 @@ static inline void init_thread(struct target_pt_regs *regs, struct image_info *i #define ELF_DATA ELFDATA2LSB #define ELF_ARCH EM_386 -static inline void init_thread(struct target_pt_regs *regs, struct image_info *infop) +static inline void init_thread(struct target_pt_regs *regs, + struct image_info *infop) { regs->esp = infop->start_stack; regs->eip = infop->entry; - /* SVR4/i386 ABI (pages 3-31, 3-32) says that when the program - starts %edx contains a pointer to a function which might be - registered using `atexit'. This provides a mean for the - dynamic linker to call DT_FINI functions for shared libraries - that have been loaded before the code runs. - - A value of 0 tells we have no such handler. */ + /* + * SVR4/i386 ABI (pages 3-31, 3-32) says that when the program starts %edx + * contains a pointer to a function which might be registered using + * `atexit'. This provides a mean for the dynamic linker to call DT_FINI + * functions for shared libraries that have been loaded before the code + * runs. + * + * A value of 0 tells we have no such handler. + */ regs->edx = 0; } #endif @@ -178,7 +182,8 @@ static inline void init_thread(struct target_pt_regs *regs, struct image_info *i #endif #define ELF_ARCH EM_ARM -static inline void init_thread(struct target_pt_regs *regs, struct image_info *infop) +static inline void init_thread(struct target_pt_regs *regs, + struct image_info *infop) { abi_long stack = infop->start_stack; memset(regs, 0, sizeof(*regs)); @@ -235,7 +240,8 @@ enum #define STACK_BIAS 2047 -static inline void init_thread(struct target_pt_regs *regs, struct image_info *infop) +static inline void init_thread(struct target_pt_regs *regs, + struct image_info *infop) { #ifndef TARGET_ABI32 regs->tstate = 0; @@ -267,7 +273,8 @@ static inline void init_thread(struct target_pt_regs *regs, struct image_info *i #define ELF_DATA ELFDATA2MSB #define ELF_ARCH EM_SPARC -static inline void init_thread(struct target_pt_regs *regs, struct image_info *infop) +static inline void init_thread(struct target_pt_regs *regs, + struct image_info *infop) { regs->psr = 0; regs->pc = infop->entry; @@ -321,6 +328,7 @@ static inline void init_thread(struct target_pt_regs *regs, struct image_info *i * AT_IGNOREPPC is used for that. * - for compatibility with glibc ARCH_DLINFO must always be defined on PPC, * even if DLINFO_ARCH_ITEMS goes to zero or is undefined. + * - Handle glibc compatibility with last two... */ #define DLINFO_ARCH_ITEMS 5 #define ARCH_DLINFO \ @@ -328,14 +336,12 @@ do { \ NEW_AUX_ENT(AT_DCACHEBSIZE, 0x20); \ NEW_AUX_ENT(AT_ICACHEBSIZE, 0x20); \ NEW_AUX_ENT(AT_UCACHEBSIZE, 0); \ - /* \ - * Now handle glibc compatibility. \ - */ \ NEW_AUX_ENT(AT_IGNOREPPC, AT_IGNOREPPC); \ NEW_AUX_ENT(AT_IGNOREPPC, AT_IGNOREPPC); \ } while (0) -static inline void init_thread(struct target_pt_regs *_regs, struct image_info *infop) +static inline void init_thread(struct target_pt_regs *_regs, + struct image_info *infop) { abi_ulong pos = infop->start_stack; abi_ulong tmp; @@ -353,11 +359,12 @@ static inline void init_thread(struct target_pt_regs *_regs, struct image_info * infop->entry = entry; #endif _regs->nip = infop->entry; - /* Note that isn't exactly what regular kernel does + /* + * Note that isn't exactly what regular kernel does * but this is what the ABI wants and is needed to allow * execution of PPC BSD programs. + * FIXME - what to for failure of get_user()? */ - /* FIXME - what to for failure of get_user()? */ get_user_ual(_regs->gpr[3], pos); pos += sizeof(abi_ulong); _regs->gpr[4] = pos; @@ -390,7 +397,8 @@ static inline void init_thread(struct target_pt_regs *_regs, struct image_info * #endif #define ELF_ARCH EM_MIPS -static inline void init_thread(struct target_pt_regs *regs, struct image_info *infop) +static inline void init_thread(struct target_pt_regs *regs, + struct image_info *infop) { regs->cp0_status = 2 << CP0St_KSU; regs->cp0_epc = infop->entry; @@ -412,11 +420,12 @@ static inline void init_thread(struct target_pt_regs *regs, struct image_info *i #define ELF_DATA ELFDATA2LSB #define ELF_ARCH EM_SH -static inline void init_thread(struct target_pt_regs *regs, struct image_info *infop) +static inline void init_thread(struct target_pt_regs *regs, + struct image_info *infop) { - /* Check other registers XXXXX */ - regs->pc = infop->entry; - regs->regs[15] = infop->start_stack; + /* Check other registers XXXXX */ + regs->pc = infop->entry; + regs->regs[15] = infop->start_stack; } #define USE_ELF_CORE_DUMP @@ -434,9 +443,10 @@ static inline void init_thread(struct target_pt_regs *regs, struct image_info *i #define ELF_DATA ELFDATA2LSB #define ELF_ARCH EM_CRIS -static inline void init_thread(struct target_pt_regs *regs, struct image_info *infop) +static inline void init_thread(struct target_pt_regs *regs, + struct image_info *infop) { - regs->erp = infop->entry; + regs->erp = infop->entry; } #define USE_ELF_CORE_DUMP @@ -454,10 +464,8 @@ static inline void init_thread(struct target_pt_regs *regs, struct image_info *i #define ELF_DATA ELFDATA2MSB #define ELF_ARCH EM_68K -/* ??? Does this need to do anything? -#define ELF_PLAT_INIT(_r) */ - -static inline void init_thread(struct target_pt_regs *regs, struct image_info *infop) +static inline void init_thread(struct target_pt_regs *regs, + struct image_info *infop) { regs->usp = infop->start_stack; regs->sr = 0; @@ -479,7 +487,8 @@ static inline void init_thread(struct target_pt_regs *regs, struct image_info *i #define ELF_DATA ELFDATA2MSB #define ELF_ARCH EM_ALPHA -static inline void init_thread(struct target_pt_regs *regs, struct image_info *infop) +static inline void init_thread(struct target_pt_regs *regs, + struct image_info *infop) { regs->pc = infop->entry; regs->ps = 8; @@ -538,8 +547,10 @@ struct exec /* Necessary parameters */ #define TARGET_ELF_EXEC_PAGESIZE TARGET_PAGE_SIZE -#define TARGET_ELF_PAGESTART(_v) ((_v) & ~(unsigned long)(TARGET_ELF_EXEC_PAGESIZE - 1)) -#define TARGET_ELF_PAGEOFFSET(_v) ((_v) & (TARGET_ELF_EXEC_PAGESIZE - 1)) +#define TARGET_ELF_PAGESTART(_v) \ + ((_v) & ~(unsigned long)(TARGET_ELF_EXEC_PAGESIZE - 1)) +#define TARGET_ELF_PAGEOFFSET(_v) \ + ((_v) & (TARGET_ELF_EXEC_PAGESIZE - 1)) #define INTERPRETER_NONE 0 #define INTERPRETER_AOUT 1 @@ -557,7 +568,7 @@ static int load_aout_interp(void *exptr, int interp_fd); #ifdef BSWAP_NEEDED static void bswap_ehdr(struct elfhdr *ehdr) { - bswap16s(&ehdr->e_type); /* Object file type */ + bswap16s(&ehdr->e_type); /* Object file type */ bswap16s(&ehdr->e_machine); /* Architecture */ bswap32s(&ehdr->e_version); /* Object file version */ bswaptls(&ehdr->e_entry); /* Entry point virtual address */ @@ -565,16 +576,16 @@ static void bswap_ehdr(struct elfhdr *ehdr) bswaptls(&ehdr->e_shoff); /* Section header table file offset */ bswap32s(&ehdr->e_flags); /* Processor-specific flags */ bswap16s(&ehdr->e_ehsize); /* ELF header size in bytes */ - bswap16s(&ehdr->e_phentsize); /* Program header table entry size */ + bswap16s(&ehdr->e_phentsize); /* Program header table entry size */ bswap16s(&ehdr->e_phnum); /* Program header table entry count */ - bswap16s(&ehdr->e_shentsize); /* Section header table entry size */ + bswap16s(&ehdr->e_shentsize); /* Section header table entry size */ bswap16s(&ehdr->e_shnum); /* Section header table entry count */ - bswap16s(&ehdr->e_shstrndx); /* Section header string table index */ + bswap16s(&ehdr->e_shstrndx); /* Section header string table index */ } static void bswap_phdr(struct elf_phdr *phdr) { - bswap32s(&phdr->p_type); /* Segment type */ + bswap32s(&phdr->p_type); /* Segment type */ bswaptls(&phdr->p_offset); /* Segment file offset */ bswaptls(&phdr->p_vaddr); /* Segment virtual address */ bswaptls(&phdr->p_paddr); /* Segment physical address */ @@ -668,8 +679,9 @@ static abi_ulong setup_arg_pages(abi_ulong p, struct linux_binprm *bprm, abi_ulong stack_base, size, error; int i; - /* Create enough stack to hold everything. If we don't use - * it for args, we'll use it for something else... + /* + * Create enough stack to hold everything. If we don't use it for args, + * we'll use it for something else... */ size = x86_stack_size; if (size < MAX_ARG_PAGES * TARGET_PAGE_SIZE) @@ -717,9 +729,11 @@ static void set_brk(abi_ulong start, abi_ulong end) } -/* We need to explicitly zero any fractional pages after the data - section (i.e. bss). This would contain the junk from the file that - should not be in memory. */ +/* + * We need to explicitly zero any fractional pages after the data section + * (i.e. bss). This would contain the junk from the file that should not be in + * memory. + */ static void padzero(abi_ulong elf_bss, abi_ulong last_bss) { abi_ulong nbyte; @@ -727,11 +741,12 @@ static void padzero(abi_ulong elf_bss, abi_ulong last_bss) if (elf_bss >= last_bss) return; - /* XXX: this is really a hack : if the real host page size is - smaller than the target page size, some pages after the end - of the file may not be mapped. A better fix would be to - patch target_mmap(), but it is more complicated as the file - size must be known */ + /* + * XXX: this is really a hack : if the real host page size is smaller + * than the target page size, some pages after the end f the file may + * not be mapped. A better fix would be to patch target_mmap(), but it + * is more complicated as the file size must be known. + */ if (qemu_real_host_page_size < qemu_host_page_size) { abi_ulong end_addr, end_addr1; end_addr1 = REAL_HOST_PAGE_ALIGN(elf_bss); @@ -794,7 +809,8 @@ static abi_ulong create_elf_tables(abi_ulong p, int argc, int envc, if (size & 15) sp -= 16 - (size & 15); - /* This is correct because Linux defines + /* + * This is correct because Linux defines * elf_addr_t as Elf32_Off / Elf64_Off */ #define NEW_AUX_ENT(id, val) do { \ @@ -902,8 +918,10 @@ static abi_ulong load_elf_interp(struct elfhdr *interp_elf_ex, #endif if (interp_elf_ex->e_type == ET_DYN) { - /* in order to avoid hardcoding the interpreter load - address in qemu, we allocate a big enough memory zone */ + /* + * in order to avoid hardcoding the interpreter load address in qemu, we + * allocate a big enough memory zone + */ error = target_mmap(0, INTERP_MAP_SIZE, PROT_NONE, MAP_PRIVATE | MAP_ANON, -1, 0); @@ -931,11 +949,11 @@ static abi_ulong load_elf_interp(struct elfhdr *interp_elf_ex, vaddr = eppnt->p_vaddr; } error = target_mmap(load_addr + TARGET_ELF_PAGESTART(vaddr), - eppnt->p_filesz + TARGET_ELF_PAGEOFFSET(eppnt->p_vaddr), - elf_prot, - elf_type, - interpreter_fd, - eppnt->p_offset - TARGET_ELF_PAGEOFFSET(eppnt->p_vaddr)); + eppnt->p_filesz + TARGET_ELF_PAGEOFFSET(eppnt->p_vaddr), + elf_prot, + elf_type, + interpreter_fd, + eppnt->p_offset - TARGET_ELF_PAGEOFFSET(eppnt->p_vaddr)); if (error == -1) { /* Real error */ @@ -975,7 +993,8 @@ static abi_ulong load_elf_interp(struct elfhdr *interp_elf_ex, * bss page. */ padzero(elf_bss, last_bss); - elf_bss = TARGET_ELF_PAGESTART(elf_bss + qemu_host_page_size - 1); /* What we have mapped so far */ + /* What we have mapped so far */ + elf_bss = TARGET_ELF_PAGESTART(elf_bss + qemu_host_page_size - 1); /* Map the last of the bss segment */ if (last_bss > elf_bss) { @@ -1109,10 +1128,12 @@ static void load_symbols(struct elfhdr *hdr, int fd) i++; } - /* Attempt to free the storage associated with the local symbols - that we threw away. Whether or not this has any effect on the - memory allocation depends on the malloc implementation and how - many symbols we managed to discard. */ + /* + * Attempt to free the storage associated with the local symbols that we + * threw away. Whether or not this has any effect on the memory allocation + * depends on the malloc implementation and how many symbols we managed to + * discard. + */ new_syms = realloc(syms, nsyms * sizeof(*syms)); if (new_syms == NULL) { free(s); @@ -1237,9 +1258,9 @@ int load_elf_binary(struct linux_binprm *bprm, struct target_pt_regs *regs, return -EINVAL; } - /* This is the program interpreter used for - * shared libraries - for now assume that this - * is an a.out format binary + /* + * This is the program interpreter used for shared libraries - for + * now assume that this is an a.out format binary */ elf_interpreter = (char *)malloc(elf_ppnt->p_filesz); @@ -1259,9 +1280,10 @@ int load_elf_binary(struct linux_binprm *bprm, struct target_pt_regs *regs, exit(-1); } - /* If the program interpreter is one of these two, - then assume an iBCS2 image. Otherwise assume - a native linux image. */ + /* + * If the program interpreter is one of these two, then assume an + * iBCS2 image. Otherwise assume a native linux image. + */ /* JRP - Need to add X86 lib dir stuff here... */ @@ -1278,7 +1300,6 @@ int load_elf_binary(struct linux_binprm *bprm, struct target_pt_regs *regs, else { perror(elf_interpreter); exit(-1); - /* retval = -errno; */ } } @@ -1289,8 +1310,8 @@ int load_elf_binary(struct linux_binprm *bprm, struct target_pt_regs *regs, } } if (retval >= 0) { - interp_ex = *((struct exec *) bprm->buf); /* aout exec-header */ - interp_elf_ex = *((struct elfhdr *) bprm->buf); /* elf exec-header */ + interp_ex = *((struct exec *) bprm->buf); /* aout */ + interp_elf_ex = *((struct elfhdr *) bprm->buf); /* elf */ } if (retval < 0) { perror("load_elf_binary3"); @@ -1327,8 +1348,10 @@ int load_elf_binary(struct linux_binprm *bprm, struct target_pt_regs *regs, } } - /* OK, we are done with that, now set up the arg stuff, - and then start this sucker up */ + /* + * OK, we are done with that, now set up the arg stuff, and then start this + * sucker up + */ { char *passed_p; @@ -1378,18 +1401,19 @@ int load_elf_binary(struct linux_binprm *bprm, struct target_pt_regs *regs, } } - /* Do this so that we can load the interpreter, if need be. We will - change some of these later */ + /* + * Do this so that we can load the interpreter, if need be. We will change + * some of these later + */ info->rss = 0; bprm->p = setup_arg_pages(bprm->p, bprm, info); info->start_stack = bprm->p; - /* Now we do a little grungy work by mmaping the ELF image into - * the correct location in memory. At this point, we assume that - * the image should be loaded at fixed address, not at a variable - * address. + /* + * Now we do a little grungy work by mmaping the ELF image into the correct + * location in memory. At this point, we assume that the image should be + * loaded at fixed address, not at a variable address. */ - for (i = 0, elf_ppnt = elf_phdata; i < elf_ex.e_phnum; i++, elf_ppnt++) { int elf_prot = 0; int elf_flags = 0; @@ -1405,11 +1429,13 @@ int load_elf_binary(struct linux_binprm *bprm, struct target_pt_regs *regs, if (elf_ex.e_type == ET_EXEC || load_addr_set) { elf_flags |= MAP_FIXED; } else if (elf_ex.e_type == ET_DYN) { - /* Try and get dynamic programs out of the way of the default mmap - base, as well as whatever program they might try to exec. This - is because the brk will follow the loader, and is not movable. */ - /* NOTE: for qemu, we do a big mmap to get enough space - without hardcoding any address */ + /* + * Try and get dynamic programs out of the way of the default mmap + * base, as well as whatever program they might try to exec. This + * is because the brk will follow the loader, and is not movable. + * NOTE: for qemu, we do a big mmap to get enough space without + * hardcoding any address + */ error = target_mmap(0, ET_DYN_MAP_SIZE, PROT_NONE, MAP_PRIVATE | MAP_ANON, -1, 0); @@ -1520,18 +1546,22 @@ int load_elf_binary(struct linux_binprm *bprm, struct target_pt_regs *regs, info->end_data = end_data; info->start_stack = bprm->p; - /* Calling set_brk effectively mmaps the pages that we need for the bss and break - sections */ + /* + * Calling set_brk effectively mmaps the pages that we need for the bss and + * break sections + */ set_brk(elf_bss, elf_brk); padzero(elf_bss, elf_brk); if (info->personality == PER_SVR4) { - /* Why this, you ask??? Well SVr4 maps page 0 as read-only, - and some applications "depend" upon this behavior. - Since we do not have the power to recompile these, we - emulate the SVr4 behavior. Sigh. */ + /* + * Why this, you ask??? Well SVr4 maps page 0 as read-only, and + * some applications "depend" upon this behavior. Since we do not + * have the power to recompile these, we emulate the SVr4 behavior. + * Sigh. + */ target_mmap(0, qemu_host_page_size, PROT_READ | PROT_EXEC, MAP_FIXED | MAP_PRIVATE, -1, 0); } From patchwork Sat Apr 24 15:59:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1469976 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=bsdimp-com.20150623.gappssmtp.com header.i=@bsdimp-com.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=zHfIIbhG; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FSGsz6GT5z9sTD for ; Sun, 25 Apr 2021 02:32:55 +1000 (AEST) Received: from localhost ([::1]:45564 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1laLDB-00030r-S9 for incoming@patchwork.ozlabs.org; Sat, 24 Apr 2021 12:32:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50586) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1laKih-0005m3-H8 for qemu-devel@nongnu.org; Sat, 24 Apr 2021 12:01:23 -0400 Received: from mail-io1-xd2c.google.com ([2607:f8b0:4864:20::d2c]:44999) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1laKiD-0004It-VR for qemu-devel@nongnu.org; Sat, 24 Apr 2021 12:01:23 -0400 Received: by mail-io1-xd2c.google.com with SMTP id p8so3349321iol.11 for ; Sat, 24 Apr 2021 09:00:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=CfTfHjIplvFUCZ6Pf4s7liZGutXFFwjfMMaiBUf8GIA=; b=zHfIIbhGBLKTq4iSnIgjQtOOGgkkwDuTtOmNMJLOiX0GTzERlYiqyNlbE1ZKkHfyZw QX07CjdM61ju7/6NAtsOPoQCtGSstOMe6/vqbBiMweJokSagr9nCGbh6nYr6njXantYP kR2qFAXqLvVID4pHGPvWqr7xGU6EhtVifZLfTQZv82QzPu2r4VvF1jpwqb1soTrr7NCN J1KXrtmQYZO/w1FXBo8JVlApNIawYI92KyUGYGivZUpIUoyZBDRwpSn1T0WunZWQYBWu hHgV8AxRbXNl3oVvsAbYZEiLyakD12fXPdAfiP/s16Ro6s1j8MJ+p1z9f0+22tc3jy1t itEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=CfTfHjIplvFUCZ6Pf4s7liZGutXFFwjfMMaiBUf8GIA=; b=Yq6ohARrrKpFke6hbz+lHDaL3YsEL7jBaparoU+sJfZlDxjnZr2uXVhXajPjW90S1/ VGDkP4uiPa4mbUuBdj21FBakZNjSuN++GDkTboRa0pOeVh0HE6SWYfQmvWltoVHohnm9 TTeUKgxe/srw+RK9ipTkUeVPHJHjskzGMkz5ZvwRPFb2KsNV01Chcp1XsK++32S15daV nnQnWZApIC9hdQ+hxsOVJvRQ2nR9s4BeYKV+QkjALcggMs2WgRrCaRDGpi+VRo1Skszb Sk7XhPqMdOnD/3V+7yQ6A6yw0YFZN6m35i0vz2i6hs5Nh5ayDLCPv43ndF56oslY4X6I bzyg== X-Gm-Message-State: AOAM531NXwL+oojc7Zt9jYHesYTPdwq3crlN17qHJmN/LevehtQKuDj1 b3g0DulnJ43K8GEoEiOj58nk5zKYRUZFZh3d X-Google-Smtp-Source: ABdhPJy4zq7Nl6O0irR3o3kt/DBk39curpy7aTTvMnhymF+fP2xIlmJj4iHzZAzUJhT8UnHA+7NsXQ== X-Received: by 2002:a02:7f86:: with SMTP id r128mr8504270jac.136.1619280051067; Sat, 24 Apr 2021 09:00:51 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id h4sm4055901ili.52.2021.04.24.09.00.50 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 24 Apr 2021 09:00:50 -0700 (PDT) From: imp@bsdimp.com To: qemu-devel@nongnu.org Subject: [PATCH v2 29/48] bsd-user: style tweak: use {} correctly Date: Sat, 24 Apr 2021 09:59:57 -0600 Message-Id: <20210424160016.15200-30-imp@bsdimp.com> X-Mailer: git-send-email 2.22.1 In-Reply-To: <20210424160016.15200-1-imp@bsdimp.com> References: <20210424160016.15200-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::d2c; envelope-from=imp@bsdimp.com; helo=mail-io1-xd2c.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kevans@freebsd.org, arichardson@freebsd.org, Warner Losh Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Warner Losh Format if/for/while statements with {} always, on a separate line and fix a couple indentations issues for singletons. Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/elfload.c | 147 ++++++++++++++++++++++++++++----------------- 1 file changed, 92 insertions(+), 55 deletions(-) diff --git a/bsd-user/elfload.c b/bsd-user/elfload.c index 75ccc06719..437ee82637 100644 --- a/bsd-user/elfload.c +++ b/bsd-user/elfload.c @@ -93,10 +93,12 @@ static const char *get_elf_platform(void) { static char elf_platform[] = "i386"; int family = object_property_get_int(OBJECT(thread_cpu), "family", NULL); - if (family > 6) + if (family > 6) { family = 6; - if (family >= 3) + } + if (family >= 3) { elf_platform[1] = '0' + family; + } return elf_platform; } @@ -188,8 +190,9 @@ static inline void init_thread(struct target_pt_regs *regs, abi_long stack = infop->start_stack; memset(regs, 0, sizeof(*regs)); regs->ARM_cpsr = 0x10; - if (infop->entry & 1) + if (infop->entry & 1) { regs->ARM_cpsr |= CPSR_T; + } regs->ARM_pc = infop->entry & 0xfffffffe; regs->ARM_sp = infop->start_stack; /* FIXME - what to for failure of get_user()? */ @@ -205,8 +208,7 @@ static inline void init_thread(struct target_pt_regs *regs, #define USE_ELF_CORE_DUMP #define ELF_EXEC_PAGESIZE 4096 -enum -{ +enum { ARM_HWCAP_ARM_SWP = 1 << 0, ARM_HWCAP_ARM_HALF = 1 << 1, ARM_HWCAP_ARM_THUMB = 1 << 2, @@ -252,9 +254,9 @@ static inline void init_thread(struct target_pt_regs *regs, #ifdef TARGET_ABI32 regs->u_regs[14] = infop->start_stack - 16 * 4; #else - if (personality(infop->personality) == PER_LINUX32) + if (personality(infop->personality) == PER_LINUX32) { regs->u_regs[14] = infop->start_stack - 16 * 4; - else { + } else { regs->u_regs[14] = infop->start_stack - 16 * 8 - STACK_BIAS; if (bsd_type == target_freebsd) { regs->u_regs[8] = infop->start_stack; @@ -520,8 +522,7 @@ static inline void init_thread(struct target_pt_regs *regs, #include "elf.h" -struct exec -{ +struct exec { unsigned int a_info; /* Use macros N_MAGIC, etc for access */ unsigned int a_text; /* length of text, in bytes */ unsigned int a_data; /* length of data, in bytes */ @@ -640,7 +641,9 @@ static abi_ulong copy_elf_strings(int argc, char **argv, void **page, exit(-1); } tmp1 = tmp; - while (*tmp++); + while (*tmp++) { + continue; + } len = tmp - tmp1; if (p < len) { /* this shouldn't happen - 128kB */ return 0; @@ -653,14 +656,14 @@ static abi_ulong copy_elf_strings(int argc, char **argv, void **page, if (!pag) { pag = g_try_malloc0(TARGET_PAGE_SIZE); page[p / TARGET_PAGE_SIZE] = pag; - if (!pag) + if (!pag) { return 0; + } } } if (len == 0 || offset == 0) { *(pag + offset) = *tmp; - } - else { + } else { int bytes_to_copy = (len > offset) ? offset : len; tmp -= bytes_to_copy; p -= bytes_to_copy; @@ -684,8 +687,9 @@ static abi_ulong setup_arg_pages(abi_ulong p, struct linux_binprm *bprm, * we'll use it for something else... */ size = x86_stack_size; - if (size < MAX_ARG_PAGES * TARGET_PAGE_SIZE) + if (size < MAX_ARG_PAGES * TARGET_PAGE_SIZE) { size = MAX_ARG_PAGES * TARGET_PAGE_SIZE; + } error = target_mmap(0, size + qemu_host_page_size, PROT_READ | PROT_WRITE, @@ -718,8 +722,9 @@ static void set_brk(abi_ulong start, abi_ulong end) /* page-align the start and end addresses... */ start = HOST_PAGE_ALIGN(start); end = HOST_PAGE_ALIGN(end); - if (end <= start) + if (end <= start) { return; + } if (target_mmap(start, end - start, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_FIXED | MAP_PRIVATE | MAP_ANON, -1, 0) == -1) { @@ -738,8 +743,9 @@ static void padzero(abi_ulong elf_bss, abi_ulong last_bss) { abi_ulong nbyte; - if (elf_bss >= last_bss) - return; + if (elf_bss >= last_bss) { + return; + } /* * XXX: this is really a hack : if the real host page size is smaller @@ -798,16 +804,18 @@ static abi_ulong create_elf_tables(abi_ulong p, int argc, int envc, */ sp = sp & ~(abi_ulong)15; size = (DLINFO_ITEMS + 1) * 2; - if (k_platform) - size += 2; + if (k_platform) { + size += 2; + } #ifdef DLINFO_ARCH_ITEMS size += DLINFO_ARCH_ITEMS * 2; #endif size += envc + argc + 2; size += (!ibcs ? 3 : 1); /* argc itself */ size *= n; - if (size & 15) - sp -= 16 - (size & 15); + if (size & 15) { + sp -= 16 - (size & 15); + } /* * This is correct because Linux defines @@ -834,8 +842,9 @@ static abi_ulong create_elf_tables(abi_ulong p, int argc, int envc, NEW_AUX_ENT(AT_EGID, (abi_ulong) getegid()); NEW_AUX_ENT(AT_HWCAP, (abi_ulong) ELF_HWCAP); NEW_AUX_ENT(AT_CLKTCK, (abi_ulong) sysconf(_SC_CLK_TCK)); - if (k_platform) + if (k_platform) { NEW_AUX_ENT(AT_PLATFORM, u_platform); + } #ifdef ARCH_DLINFO /* * ARCH_DLINFO must come last so platform specific code can enforce @@ -879,15 +888,16 @@ static abi_ulong load_elf_interp(struct elfhdr *interp_elf_ex, /* Now read in all of the header information */ - - if (sizeof(struct elf_phdr) * interp_elf_ex->e_phnum > TARGET_PAGE_SIZE) + if (sizeof(struct elf_phdr) * interp_elf_ex->e_phnum > TARGET_PAGE_SIZE) { return ~(abi_ulong)0UL; + } elf_phdata = (struct elf_phdr *) malloc(sizeof(struct elf_phdr) * interp_elf_ex->e_phnum); - if (!elf_phdata) + if (!elf_phdata) { return ~((abi_ulong)0UL); + } /* * If the size of this structure has changed, then punt, since @@ -934,16 +944,22 @@ static abi_ulong load_elf_interp(struct elfhdr *interp_elf_ex, } eppnt = elf_phdata; - for (i = 0; i < interp_elf_ex->e_phnum; i++, eppnt++) + for (i = 0; i < interp_elf_ex->e_phnum; i++, eppnt++) { if (eppnt->p_type == PT_LOAD) { int elf_type = MAP_PRIVATE | MAP_DENYWRITE; int elf_prot = 0; abi_ulong vaddr = 0; abi_ulong k; - if (eppnt->p_flags & PF_R) elf_prot = PROT_READ; - if (eppnt->p_flags & PF_W) elf_prot |= PROT_WRITE; - if (eppnt->p_flags & PF_X) elf_prot |= PROT_EXEC; + if (eppnt->p_flags & PF_R) { + elf_prot = PROT_READ; + } + if (eppnt->p_flags & PF_W) { + elf_prot |= PROT_WRITE; + } + if (eppnt->p_flags & PF_X) { + elf_prot |= PROT_EXEC; + } if (interp_elf_ex->e_type == ET_EXEC || load_addr_set) { elf_type |= MAP_FIXED; vaddr = eppnt->p_vaddr; @@ -972,15 +988,20 @@ static abi_ulong load_elf_interp(struct elfhdr *interp_elf_ex, * track of the largest address we see for this. */ k = load_addr + eppnt->p_vaddr + eppnt->p_filesz; - if (k > elf_bss) elf_bss = k; + if (k > elf_bss) { + elf_bss = k; + } /* * Do the same thing for the memory mapping - between * elf_bss and last_bss is the bss section. */ k = load_addr + eppnt->p_memsz + eppnt->p_vaddr; - if (k > last_bss) last_bss = k; + if (k > last_bss) { + last_bss = k; + } } + } /* Now use mmap to map the library into memory. */ @@ -1061,8 +1082,9 @@ static void load_symbols(struct elfhdr *hdr, int fd) lseek(fd, hdr->e_shoff, SEEK_SET); for (i = 0; i < hdr->e_shnum; i++) { - if (read(fd, &sechdr, sizeof(sechdr)) != sizeof(sechdr)) + if (read(fd, &sechdr, sizeof(sechdr)) != sizeof(sechdr)) { return; + } #ifdef BSWAP_NEEDED bswap_shdr(&sechdr); #endif @@ -1244,14 +1266,13 @@ int load_elf_binary(struct linux_binprm *bprm, struct target_pt_regs *regs, elf_interpreter = NULL; start_code = ~((abi_ulong)0UL); end_code = 0; - start_data =n 0; + start_data = 0; end_data = 0; interp_ex.a_info = 0; for (i = 0; i < elf_ex.e_phnum; i++) { if (elf_ppnt->p_type == PT_INTERP) { - if (elf_interpreter != NULL) - { + if (elf_interpreter != NULL) { free(elf_phdata); free(elf_interpreter); close(bprm->fd); @@ -1296,8 +1317,7 @@ int load_elf_binary(struct linux_binprm *bprm, struct target_pt_regs *regs, retval = open(path(elf_interpreter), O_RDONLY); if (retval >= 0) { interpreter_fd = retval; - } - else { + } else { perror(elf_interpreter); exit(-1); } @@ -1392,8 +1412,9 @@ int load_elf_binary(struct linux_binprm *bprm, struct target_pt_regs *regs, */ for (i = 0, elf_ppnt = elf_phdata; i < elf_ex.e_phnum; i++, elf_ppnt++) { - if (elf_ppnt->p_type != PT_LOAD) + if (elf_ppnt->p_type != PT_LOAD) { continue; + } if (HOST_PAGE_ALIGN(elf_ppnt->p_vaddr) < mmap_min_addr) { guest_base = HOST_PAGE_ALIGN(mmap_min_addr); break; @@ -1419,12 +1440,19 @@ int load_elf_binary(struct linux_binprm *bprm, struct target_pt_regs *regs, int elf_flags = 0; abi_ulong error; - if (elf_ppnt->p_type != PT_LOAD) + if (elf_ppnt->p_type != PT_LOAD) { continue; + } - if (elf_ppnt->p_flags & PF_R) elf_prot |= PROT_READ; - if (elf_ppnt->p_flags & PF_W) elf_prot |= PROT_WRITE; - if (elf_ppnt->p_flags & PF_X) elf_prot |= PROT_EXEC; + if (elf_ppnt->p_flags & PF_R) { + elf_prot |= PROT_READ; + } + if (elf_ppnt->p_flags & PF_W) { + elf_prot |= PROT_WRITE; + } + if (elf_ppnt->p_flags & PF_X) { + elf_prot |= PROT_EXEC; + } elf_flags = MAP_PRIVATE | MAP_DENYWRITE; if (elf_ex.e_type == ET_EXEC || load_addr_set) { elf_flags |= MAP_FIXED; @@ -1460,8 +1488,9 @@ int load_elf_binary(struct linux_binprm *bprm, struct target_pt_regs *regs, } #ifdef LOW_ELF_STACK - if (TARGET_ELF_PAGESTART(elf_ppnt->p_vaddr) < elf_stack) + if (TARGET_ELF_PAGESTART(elf_ppnt->p_vaddr) < elf_stack) { elf_stack = TARGET_ELF_PAGESTART(elf_ppnt->p_vaddr); + } #endif if (!load_addr_set) { @@ -1475,19 +1504,26 @@ int load_elf_binary(struct linux_binprm *bprm, struct target_pt_regs *regs, } } k = elf_ppnt->p_vaddr; - if (k < start_code) + if (k < start_code) { start_code = k; - if (start_data < k) + } + if (start_data < k) { start_data = k; + } k = elf_ppnt->p_vaddr + elf_ppnt->p_filesz; - if (k > elf_bss) + if (k > elf_bss) { elf_bss = k; - if ((elf_ppnt->p_flags & PF_X) && end_code < k) + } + if ((elf_ppnt->p_flags & PF_X) && end_code < k) { end_code = k; - if (end_data < k) + } + if (end_data < k) { end_data = k; + } k = elf_ppnt->p_vaddr + elf_ppnt->p_memsz; - if (k > elf_brk) elf_brk = k; + if (k > elf_brk) { + elf_brk = k; + } } elf_entry += load_bias; @@ -1501,8 +1537,7 @@ int load_elf_binary(struct linux_binprm *bprm, struct target_pt_regs *regs, if (elf_interpreter) { if (interpreter_type & 1) { elf_entry = load_aout_interp(&interp_ex, interpreter_fd); - } - else if (interpreter_type & 2) { + } else if (interpreter_type & 2) { elf_entry = load_elf_interp(&interp_elf_ex, interpreter_fd, &interp_load_addr); } @@ -1521,10 +1556,13 @@ int load_elf_binary(struct linux_binprm *bprm, struct target_pt_regs *regs, free(elf_phdata); - if (qemu_log_enabled()) + if (qemu_log_enabled()) { load_symbols(&elf_ex, bprm->fd); + } - if (interpreter_type != INTERPRETER_AOUT) close(bprm->fd); + if (interpreter_type != INTERPRETER_AOUT) { + close(bprm->fd); + } info->personality = (ibcs2_interpreter ? PER_SVR4 : PER_LINUX); #ifdef LOW_ELF_STACK @@ -1554,8 +1592,7 @@ int load_elf_binary(struct linux_binprm *bprm, struct target_pt_regs *regs, padzero(elf_bss, elf_brk); - if (info->personality == PER_SVR4) - { + if (info->personality == PER_SVR4) { /* * Why this, you ask??? Well SVr4 maps page 0 as read-only, and * some applications "depend" upon this behavior. Since we do not From patchwork Sat Apr 24 15:59:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1469945 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=bsdimp-com.20150623.gappssmtp.com header.i=@bsdimp-com.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=hyQFuJYC; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FSGNm3hVRz9sVw for ; Sun, 25 Apr 2021 02:11:04 +1000 (AEST) Received: from localhost ([::1]:34094 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1laKs2-0008Qc-FQ for incoming@patchwork.ozlabs.org; Sat, 24 Apr 2021 12:11:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50534) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1laKif-0005hp-2e for qemu-devel@nongnu.org; Sat, 24 Apr 2021 12:01:21 -0400 Received: from mail-io1-xd34.google.com ([2607:f8b0:4864:20::d34]:42994) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1laKiE-0004J6-2N for qemu-devel@nongnu.org; Sat, 24 Apr 2021 12:01:20 -0400 Received: by mail-io1-xd34.google.com with SMTP id s16so46514992iog.9 for ; Sat, 24 Apr 2021 09:00:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=VZAtilvnIeDP+jP8/xPOGjIu8lTW/AxOvqbnMGjlqJY=; b=hyQFuJYC0YCa/sebF6Oe3Y6bfMkzIt9nn9KyqpB3STYk4ZzaRP3idtxVwncKA/UdHA Uzq1qOQqeN2HhqDjcfuDo3WVYtkpxyBhvwExyG2eiPWZA4a94vi+teM+8CRgggveB3il wlEYBUqkDFGXCdIp/JgdIjpzdYnmoOq/XLrbWVwBED0yj96XcQPeuNeSl3z+8THXmsdP C+1GnKLRqYIAnZmHYF69A4HnWgxGWUK63ABhUl9u2cgJUrhwy0fKTt3LevOZAEAM0nNU gYbiutBWhSAoCzh8cXLq2OmYI/+VKwrTxSOf3hPPyksHnLLBSDT7UI/KLFswKjuzu1NM Z5YA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=VZAtilvnIeDP+jP8/xPOGjIu8lTW/AxOvqbnMGjlqJY=; b=p4+ybcjpajzKlu8zRiRIE1XTbNCjVaoPsNXZ2qxjGuq7KGP8H79q0s+fNgH243pB0d b89sXMF7NGBUq7h7P59sNsxXSzD7aIP0lbmY0AwtCZD3vfed0VYetZphfyk22nlOM5nN 4g76ALtJyhY2IZirzEabHO14/lHNOC1zlj3BYX8DKNMeuj8/8d6Ql88qqpeZWdIZNXja +I7NaLmCX654FEy7fIi5Ff72uxCWEKO40msPNhmYpYmRceUFLk2v/928r4eHBpJjsyUw TCHT4EmEO/kWz15aRzasrgHguL3/VtHDu6O1W1dwxycUWTDvOEHkNUpNIDbzjE8aPDVD avGA== X-Gm-Message-State: AOAM531yDG1T4IOQXGc9v9xyjYTJvfZDjQr/epRM9ppwC3xpTYzmWVLu gpFriab+UxnDkBOcyclT8ijUVV6jvWxU0Oth X-Google-Smtp-Source: ABdhPJxNSoVxlH2LjADbtQotAs5CBrEnBVzXUApo9Gw1wyalUvwAIj5UL1mPnB06V4KCKJJTkMTzfQ== X-Received: by 2002:a6b:f901:: with SMTP id j1mr7633021iog.100.1619280052055; Sat, 24 Apr 2021 09:00:52 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id h4sm4055901ili.52.2021.04.24.09.00.51 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 24 Apr 2021 09:00:51 -0700 (PDT) From: imp@bsdimp.com To: qemu-devel@nongnu.org Subject: [PATCH v2 30/48] bsd-user: style tweak: fix block comments Date: Sat, 24 Apr 2021 09:59:58 -0600 Message-Id: <20210424160016.15200-31-imp@bsdimp.com> X-Mailer: git-send-email 2.22.1 In-Reply-To: <20210424160016.15200-1-imp@bsdimp.com> References: <20210424160016.15200-1-imp@bsdimp.com> MIME-Version: 1.0 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: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kevans@freebsd.org, arichardson@freebsd.org, Warner Losh Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Warner Losh Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/mmap.c | 51 ++++++++++++++++++++++++++++--------------------- 1 file changed, 29 insertions(+), 22 deletions(-) diff --git a/bsd-user/mmap.c b/bsd-user/mmap.c index 0ac1b92706..0ff06d7349 100644 --- a/bsd-user/mmap.c +++ b/bsd-user/mmap.c @@ -23,8 +23,6 @@ #include "bsd-mman.h" #include "exec/exec-all.h" -//#define DEBUG_MMAP - static pthread_mutex_t mmap_mutex = PTHREAD_MUTEX_INITIALIZER; static __thread int mmap_lock_count; @@ -165,8 +163,10 @@ static int mmap_frag(abi_ulong real_start, prot_new = prot | prot1; if (!(flags & MAP_ANON)) { - /* msync() won't work here, so we return an error if write is - possible while it is a shared mapping */ + /* + * msync() won't work here, so we return an error if write is possible + * while it is a shared mapping + */ if ((flags & TARGET_BSD_MAP_FLAGMASK) == MAP_SHARED && (prot & PROT_WRITE)) return -1; @@ -194,12 +194,13 @@ static abi_ulong mmap_next_start = 0x40000000; unsigned long last_brk; -/* find a free memory area of size 'size'. The search starts at - 'start'. If 'start' == 0, then a default start address is used. - Return -1 if error. -*/ -/* page_init() marks pages used by the host as reserved to be sure not - to use them. */ +/* + * find a free memory area of size 'size'. The search starts at 'start'. If + * 'start' == 0, then a default start address is used. Return -1 if error. + * + * page_init() marks pages used by the host as reserved to be sure not to use + * them. + */ static abi_ulong mmap_find_vma(abi_ulong start, abi_ulong size) { abi_ulong addr, addr1, addr_start; @@ -208,11 +209,12 @@ static abi_ulong mmap_find_vma(abi_ulong start, abi_ulong size) new_brk = (unsigned long)sbrk(0); if (last_brk && last_brk < new_brk && last_brk == (target_ulong)last_brk) { - /* This is a hack to catch the host allocating memory with brk(). - If it uses mmap then we loose. - FIXME: We really want to avoid the host allocating memory in - the first place, and maybe leave some slack to avoid switching - to mmap. */ + /* + * This is a hack to catch the host allocating memory with brk(). If it + * uses mmap then we loose. + * FIXME: We really want to avoid the host allocating memory in the + * first place, and maybe leave some slack to avoid switching to mmap. + */ page_set_flags(last_brk & TARGET_PAGE_MASK, TARGET_PAGE_ALIGN(new_brk), PAGE_RESERVED); @@ -298,9 +300,10 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int prot, errno = ENOMEM; goto fail; } - /* Note: we prefer to control the mapping address. It is - especially important if qemu_host_page_size > - qemu_real_host_page_size */ + /* + * Note: we prefer to control the mapping address. It is specially + * important if qemu_host_page_size > qemu_real_host_page_size + */ p = mmap(g2h_untagged(mmap_start), host_len, prot, flags | MAP_FIXED, fd, host_offset); if (p == MAP_FAILED) @@ -329,12 +332,16 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int prot, } } - /* worst case: we cannot map the file because the offset is not - aligned, so we read it */ + /* + * worst case: we cannot map the file because the offset is not aligned, + * so we read it + */ if (!(flags & MAP_ANON) && (offset & ~qemu_host_page_mask) != (start & ~qemu_host_page_mask)) { - /* msync() won't work here, so we return an error if write is - possible while it is a shared mapping */ + /* + * msync() won't work here, so we return an error if write is + * possible while it is a shared mapping + */ if ((flags & TARGET_BSD_MAP_FLAGMASK) == MAP_SHARED && (prot & PROT_WRITE)) { errno = EINVAL; From patchwork Sat Apr 24 15:59:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1469970 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=bsdimp-com.20150623.gappssmtp.com header.i=@bsdimp-com.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=unqESEfc; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FSGkw3Td1z9sTD for ; Sun, 25 Apr 2021 02:26:48 +1000 (AEST) Received: from localhost ([::1]:58696 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1laL7G-0005Bz-Gd for incoming@patchwork.ozlabs.org; Sat, 24 Apr 2021 12:26:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50550) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1laKif-0005iY-VV for qemu-devel@nongnu.org; Sat, 24 Apr 2021 12:01:22 -0400 Received: from mail-il1-x135.google.com ([2607:f8b0:4864:20::135]:44880) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1laKiE-0004JE-EE for qemu-devel@nongnu.org; Sat, 24 Apr 2021 12:01:21 -0400 Received: by mail-il1-x135.google.com with SMTP id i22so393151ila.11 for ; Sat, 24 Apr 2021 09:00:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=pnchoQA/ZqjPQSSH2ekFTKVyc7FezQYrIYZdDfoc05M=; b=unqESEfc4cWWszsmwVP0mp10FSs6obU0h5W1yh/jR44VydF1J+BzNSXTJ8seYqbpuu yI6DNo1rNNbbWS3dGk5+uup5HZXumfacyKmcxONXmXa949+YOqBMaAI2K0bQc1JgeXNU a1QSrf3wY7ZrTSMK6RCuWpqrJ1ozE6VMvbHc4v0ij2vYQslf+eAPMmxit8ydjb03rTM5 3hl/uJpxdR4EGRd0uVX4r3Yo30Oqe8DA/xqa2YxoACmGcrF7VshdErqk84tBahc5kWig myDfRMZgeCEZLNmWYYtvk6WVQmWZ8/mY0y+4+NzVp2eoTI/YT8TdGKdVAmdEOEzsOI/9 Jiqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=pnchoQA/ZqjPQSSH2ekFTKVyc7FezQYrIYZdDfoc05M=; b=gMfLCWnfJsc0bnNOrnMKrGvHM5Ved3AhQ2Ci7gHIDV0If7vcDWegWiTIg9cK6FojR4 oDzO6hxUOuVD4KM1Kj9pYexTkOBk/mz7/KC1zu2NPnxnu/+8RSJGKpYzmRhUDFpQJN0T xcd1U1OBBcKjzM+4rf22hVoW7r72qf/3s8FgFmyfqD3RD/SH1FuBCR/gcPeII19f6Ck2 S7IbP+I48D1Hz8Z4vnMo/lRAh7HDnhzQHrPVPHJqzD9CkeHDMonSemO827oeZs6rthsk ow95zEqJ0NyYDgl6Pz4rBUjrKrOMJrO1Hh32am4Mo+hx4QzDD1TxIFCUBRmvXePLy9EG Krvw== X-Gm-Message-State: AOAM533qOMgeSoJGtmu4xmZEo5C8SJZ4Fyftbdtf9dEBQ8CnXukBblCv BSqr7eY4D3Dqt92kzqZ4VnHp+6snYSdo5rH5 X-Google-Smtp-Source: ABdhPJyCwbzFoq3WHrppOkQshUK5PbOVhZsz17gGqYgBgq9wbV7mZkH8Qtyo6kfP1fRvIzTIPA2r8w== X-Received: by 2002:a92:4a12:: with SMTP id m18mr6947462ilf.296.1619280052848; Sat, 24 Apr 2021 09:00:52 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id h4sm4055901ili.52.2021.04.24.09.00.52 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 24 Apr 2021 09:00:52 -0700 (PDT) From: imp@bsdimp.com To: qemu-devel@nongnu.org Subject: [PATCH v2 31/48] bsd-user: style tweak: use {} for all if statements, format else correctly Date: Sat, 24 Apr 2021 09:59:59 -0600 Message-Id: <20210424160016.15200-32-imp@bsdimp.com> X-Mailer: git-send-email 2.22.1 In-Reply-To: <20210424160016.15200-1-imp@bsdimp.com> References: <20210424160016.15200-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::135; envelope-from=imp@bsdimp.com; helo=mail-il1-x135.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kevans@freebsd.org, arichardson@freebsd.org, Warner Losh Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Warner Losh Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/mmap.c | 112 ++++++++++++++++++++++++++++++++---------------- 1 file changed, 74 insertions(+), 38 deletions(-) diff --git a/bsd-user/mmap.c b/bsd-user/mmap.c index 0ff06d7349..1aec1916c0 100644 --- a/bsd-user/mmap.c +++ b/bsd-user/mmap.c @@ -48,17 +48,19 @@ bool have_mmap_lock(void) /* Grab lock to make sure things are in a consistent state after fork(). */ void mmap_fork_start(void) { - if (mmap_lock_count) + if (mmap_lock_count) { abort(); + } pthread_mutex_lock(&mmap_mutex); } void mmap_fork_end(int child) { - if (child) + if (child) { pthread_mutex_init(&mmap_mutex, NULL); - else + } else { pthread_mutex_unlock(&mmap_mutex); + } } /* NOTE: all the constants are the HOST ones, but addresses are target. */ @@ -75,15 +77,18 @@ int target_mprotect(abi_ulong start, abi_ulong len, int prot) prot & PROT_EXEC ? 'x' : '-'); #endif - if ((start & ~TARGET_PAGE_MASK) != 0) + if ((start & ~TARGET_PAGE_MASK) != 0) { return -EINVAL; + } len = TARGET_PAGE_ALIGN(len); end = start + len; - if (end < start) + if (end < start) { return -EINVAL; + } prot &= PROT_READ | PROT_WRITE | PROT_EXEC; - if (len == 0) + if (len == 0) { return 0; + } mmap_lock(); host_start = start & qemu_host_page_mask; @@ -102,8 +107,9 @@ int target_mprotect(abi_ulong start, abi_ulong len, int prot) } ret = mprotect(g2h_untagged(host_start), qemu_host_page_size, prot1 & PAGE_BITS); - if (ret != 0) + if (ret != 0) { goto error; + } host_start += qemu_host_page_size; } if (end < host_end) { @@ -113,16 +119,18 @@ int target_mprotect(abi_ulong start, abi_ulong len, int prot) } ret = mprotect(g2h_untagged(host_end - qemu_host_page_size), qemu_host_page_size, prot1 & PAGE_BITS); - if (ret != 0) + if (ret != 0) { goto error; + } host_end -= qemu_host_page_size; } /* handle the pages in the middle */ if (host_start < host_end) { ret = mprotect(g2h_untagged(host_start), host_end - host_start, prot); - if (ret != 0) + if (ret != 0) { goto error; + } } page_set_flags(start, start + len, prot | PAGE_VALID); mmap_unlock(); @@ -147,16 +155,18 @@ static int mmap_frag(abi_ulong real_start, /* get the protection of the target pages outside the mapping */ prot1 = 0; for (addr = real_start; addr < real_end; addr++) { - if (addr < start || addr >= end) + if (addr < start || addr >= end) { prot1 |= page_get_flags(addr); + } } if (prot1 == 0) { /* no page was there, so we allocate one */ void *p = mmap(host_start, qemu_host_page_size, prot, flags | MAP_ANON, -1, 0); - if (p == MAP_FAILED) + if (p == MAP_FAILED) { return -1; + } prot1 = prot; } prot1 &= PAGE_BITS; @@ -168,19 +178,22 @@ static int mmap_frag(abi_ulong real_start, * while it is a shared mapping */ if ((flags & TARGET_BSD_MAP_FLAGMASK) == MAP_SHARED && - (prot & PROT_WRITE)) + (prot & PROT_WRITE)) { return -1; + } /* adjust protection to be able to read */ - if (!(prot1 & PROT_WRITE)) + if (!(prot1 & PROT_WRITE)) { mprotect(host_start, qemu_host_page_size, prot1 | PROT_WRITE); + } /* read the corresponding file data */ pread(fd, g2h_untagged(start), end - start, offset); /* put final protection */ - if (prot_new != (prot1 | PROT_WRITE)) + if (prot_new != (prot1 | PROT_WRITE)) { mprotect(host_start, qemu_host_page_size, prot_new); + } } else { /* just update the protection */ if (prot_new != prot1) { @@ -224,23 +237,27 @@ static abi_ulong mmap_find_vma(abi_ulong start, abi_ulong size) size = HOST_PAGE_ALIGN(size); start = start & qemu_host_page_mask; addr = start; - if (addr == 0) + if (addr == 0) { addr = mmap_next_start; + } addr_start = addr; for (;;) { prot = 0; for (addr1 = addr; addr1 < (addr + size); addr1 += TARGET_PAGE_SIZE) { prot |= page_get_flags(addr1); } - if (prot == 0) + if (prot == 0) { break; + } addr += qemu_host_page_size; /* we found nothing */ - if (addr == addr_start) + if (addr == addr_start) { return (abi_ulong)-1; + } } - if (start == 0) + if (start == 0) { mmap_next_start = addr + size; + } return addr; } @@ -260,10 +277,12 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int prot, prot & PROT_READ ? 'r' : '-', prot & PROT_WRITE ? 'w' : '-', prot & PROT_EXEC ? 'x' : '-'); - if (flags & MAP_FIXED) + if (flags & MAP_FIXED) { printf("MAP_FIXED "); - if (flags & MAP_ANON) + } + if (flags & MAP_ANON) { printf("MAP_ANON "); + } switch (flags & TARGET_BSD_MAP_FLAGMASK) { case MAP_PRIVATE: printf("MAP_PRIVATE "); @@ -285,8 +304,9 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int prot, } len = TARGET_PAGE_ALIGN(len); - if (len == 0) + if (len == 0) { goto the_end; + } real_start = start & qemu_host_page_mask; if (!(flags & MAP_FIXED)) { @@ -306,12 +326,14 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int prot, */ p = mmap(g2h_untagged(mmap_start), host_len, prot, flags | MAP_FIXED, fd, host_offset); - if (p == MAP_FAILED) + if (p == MAP_FAILED) { goto fail; + } /* update start so that it points to the file position at 'offset' */ host_start = (unsigned long)p; - if (!(flags & MAP_ANON)) + if (!(flags & MAP_ANON)) { host_start += offset - host_offset; + } start = h2g(host_start); } else { int flg; @@ -350,8 +372,9 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int prot, retaddr = target_mmap(start, len, prot | PROT_WRITE, MAP_FIXED | MAP_PRIVATE | MAP_ANON, -1, 0); - if (retaddr == -1) + if (retaddr == -1) { goto fail; + } pread(fd, g2h_untagged(start), len, offset); if (!(prot & PROT_WRITE)) { ret = target_mprotect(start, len, prot); @@ -369,14 +392,16 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int prot, /* one single host page */ ret = mmap_frag(real_start, start, end, prot, flags, fd, offset); - if (ret == -1) + if (ret == -1) { goto fail; + } goto the_end1; } ret = mmap_frag(real_start, start, real_start + qemu_host_page_size, prot, flags, fd, offset); - if (ret == -1) + if (ret == -1) { goto fail; + } real_start += qemu_host_page_size; } /* handle the end of the mapping */ @@ -385,8 +410,9 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int prot, real_end - qemu_host_page_size, real_end, prot, flags, fd, offset + real_end - qemu_host_page_size - start); - if (ret == -1) + if (ret == -1) { goto fail; + } real_end -= qemu_host_page_size; } @@ -394,14 +420,16 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int prot, if (real_start < real_end) { void *p; unsigned long offset1; - if (flags & MAP_ANON) + if (flags & MAP_ANON) { offset1 = 0; - else + } else { offset1 = offset + real_start - start; + } p = mmap(g2h_untagged(real_start), real_end - real_start, prot, flags, fd, offset1); - if (p == MAP_FAILED) + if (p == MAP_FAILED) { goto fail; + } } } the_end1: @@ -427,11 +455,13 @@ int target_munmap(abi_ulong start, abi_ulong len) #ifdef DEBUG_MMAP printf("munmap: start=0x%lx len=0x%lx\n", start, len); #endif - if (start & ~TARGET_PAGE_MASK) + if (start & ~TARGET_PAGE_MASK) { return -EINVAL; + } len = TARGET_PAGE_ALIGN(len); - if (len == 0) + if (len == 0) { return -EINVAL; + } mmap_lock(); end = start + len; real_start = start & qemu_host_page_mask; @@ -449,16 +479,18 @@ int target_munmap(abi_ulong start, abi_ulong len) } end = real_end; } - if (prot != 0) + if (prot != 0) { real_start += qemu_host_page_size; + } } if (end < real_end) { prot = 0; for (addr = end; addr < real_end; addr += TARGET_PAGE_SIZE) { prot |= page_get_flags(addr); } - if (prot != 0) + if (prot != 0) { real_end -= qemu_host_page_size; + } } ret = 0; @@ -467,8 +499,9 @@ int target_munmap(abi_ulong start, abi_ulong len) ret = munmap(g2h_untagged(real_start), real_end - real_start); } - if (ret == 0) + if (ret == 0) { page_set_flags(start, start + len, 0); + } mmap_unlock(); return ret; } @@ -477,14 +510,17 @@ int target_msync(abi_ulong start, abi_ulong len, int flags) { abi_ulong end; - if (start & ~TARGET_PAGE_MASK) + if (start & ~TARGET_PAGE_MASK) { return -EINVAL; + } len = TARGET_PAGE_ALIGN(len); end = start + len; - if (end < start) + if (end < start) { return -EINVAL; - if (end == start) + } + if (end == start) { return 0; + } start &= qemu_host_page_mask; return msync(g2h_untagged(start), end - start, flags); From patchwork Sat Apr 24 16:00:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1469973 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=bsdimp-com.20150623.gappssmtp.com header.i=@bsdimp-com.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=TfphHh3f; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FSGpD15Qlz9sTD for ; Sun, 25 Apr 2021 02:29:40 +1000 (AEST) Received: from localhost ([::1]:38938 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1laLA1-0000BD-UB for incoming@patchwork.ozlabs.org; Sat, 24 Apr 2021 12:29:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50558) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1laKig-0005jo-GP for qemu-devel@nongnu.org; Sat, 24 Apr 2021 12:01:22 -0400 Received: from mail-io1-xd29.google.com ([2607:f8b0:4864:20::d29]:40864) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1laKiE-0004JI-Lt for qemu-devel@nongnu.org; Sat, 24 Apr 2021 12:01:22 -0400 Received: by mail-io1-xd29.google.com with SMTP id e186so1610407iof.7 for ; Sat, 24 Apr 2021 09:00:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Y9AQJRvMtMdTIZnD3mQV1ThnImiIAURk0S2tBBlFFtk=; b=TfphHh3fnx2THVKxOa8XVbyRhxtfjOzj7VTzgiCJhrYwaI43ljmUG1Zjgh3PYFi4KB eGrbxq4tcgCXNwEoQWFeJtvaGWeI9oWvkThxpEb9typdS9ItYTjgB/vE9msTeMVrToJa 6U8MzvrYRVav6GMICdIIky40+v/6js+3ZYnt450rj7O1QfpYt0pI/200esFkhW2HyyJl Qrx9aDP9BBOaMv8qFHPFdgW7I+mhj4Jq/YhA+3J5xSAWx8sdycA7xvIV5m2L1QyAcX2Z PdwbtRv8AYwtSVqDSwYJ1s/vj1Sm8f9vbO7SgzmZtsTghg6fnfJisn13p+trlySb2TDa fTzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Y9AQJRvMtMdTIZnD3mQV1ThnImiIAURk0S2tBBlFFtk=; b=H59EdnP0MgwHlncz44R0gHK+7wwuVUC2v1/fsk8TipXrDj0bN7VX9r3VUPasg737+A Qs649/s13DWraOfIgZ8G+TwlGTDT3TJM+9nzxJ94F1G8Ovu4mQqIfpzP6+uXBTURO9du I+wSGdmVp/ppm0NaNNduCVjKK6/uPKi7FSo8b/GfGnXEMxxEbBDgdaPDew4kYvJmh/YJ rtAGlGFlu8xRKIzuHeQfE/tuUeuPUWg5JmFSYKluk7qW5vMT3IXU1qYU06KL59HrX4C4 rOmjasovTVzR4wT8ZuAqslnByFM5xkCJ4jmX4L8MXjvm1AEUTqpcWVptFFtVh2N4KxqH En0A== X-Gm-Message-State: AOAM531k8sP1+Wl4tLCDwolOz/cMma4dIZI5XsyEEnF45imbVNbeBYlp uZ9ZShJA3Odk0+g/fdVt9R+Y39prVYfgs8Zl X-Google-Smtp-Source: ABdhPJywEhrAa/3s2x3QbZ40twqvlwh57wQfRZwgtYybtoy2zo45lKshsl9suY/UvKSwEOVR+/ptUA== X-Received: by 2002:a02:9643:: with SMTP id c61mr8290930jai.124.1619280053436; Sat, 24 Apr 2021 09:00:53 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id h4sm4055901ili.52.2021.04.24.09.00.52 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 24 Apr 2021 09:00:53 -0700 (PDT) From: imp@bsdimp.com To: qemu-devel@nongnu.org Subject: [PATCH v2 32/48] bsd-user: style tweak: remove spacing after '*' and add after } Date: Sat, 24 Apr 2021 10:00:00 -0600 Message-Id: <20210424160016.15200-33-imp@bsdimp.com> X-Mailer: git-send-email 2.22.1 In-Reply-To: <20210424160016.15200-1-imp@bsdimp.com> References: <20210424160016.15200-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::d29; envelope-from=imp@bsdimp.com; helo=mail-io1-xd29.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kevans@freebsd.org, arichardson@freebsd.org, Warner Losh Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Warner Losh Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/qemu.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/bsd-user/qemu.h b/bsd-user/qemu.h index 5a82722281..de20e8329a 100644 --- a/bsd-user/qemu.h +++ b/bsd-user/qemu.h @@ -124,19 +124,19 @@ struct linux_binprm { int argc, envc; char **argv; char **envp; - char * filename; /* Name of binary */ + char *filename; /* Name of binary */ }; void do_init_thread(struct target_pt_regs *regs, struct image_info *infop); abi_ulong loader_build_argptr(int envc, int argc, abi_ulong sp, abi_ulong stringp, int push_ptr); -int loader_exec(const char * filename, char ** argv, char ** envp, - struct target_pt_regs * regs, struct image_info *infop); +int loader_exec(const char *filename, char **argv, char **envp, + struct target_pt_regs *regs, struct image_info *infop); -int load_elf_binary(struct linux_binprm * bprm, struct target_pt_regs * regs, - struct image_info * info); -int load_flt_binary(struct linux_binprm * bprm, struct target_pt_regs * regs, - struct image_info * info); +int load_elf_binary(struct linux_binprm *bprm, struct target_pt_regs *regs, + struct image_info *info); +int load_flt_binary(struct linux_binprm *bprm, struct target_pt_regs *regs, + struct image_info *info); abi_long memcpy_to_target(abi_ulong dest, const void *src, unsigned long len); @@ -246,7 +246,7 @@ static inline bool access_ok(int type, abi_ulong addr, abi_ulong size) break;\ default:\ abort();\ - }\ + } \ 0;\ }) @@ -270,7 +270,7 @@ static inline bool access_ok(int type, abi_ulong addr, abi_ulong size) /* avoid warning */\ x = 0;\ abort();\ - }\ + } \ 0;\ }) From patchwork Sat Apr 24 16:00:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1469962 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=bsdimp-com.20150623.gappssmtp.com header.i=@bsdimp-com.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=VO9xd1nT; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FSGf92z88z9sW4 for ; Sun, 25 Apr 2021 02:22:41 +1000 (AEST) Received: from localhost ([::1]:43464 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1laL3H-0007KN-Eg for incoming@patchwork.ozlabs.org; Sat, 24 Apr 2021 12:22:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50600) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1laKih-0005nV-VJ for qemu-devel@nongnu.org; Sat, 24 Apr 2021 12:01:24 -0400 Received: from mail-io1-xd2b.google.com ([2607:f8b0:4864:20::d2b]:39640) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1laKiJ-0004Jb-54 for qemu-devel@nongnu.org; Sat, 24 Apr 2021 12:01:23 -0400 Received: by mail-io1-xd2b.google.com with SMTP id k25so8749470iob.6 for ; Sat, 24 Apr 2021 09:00:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=q+XTeWxts5sk5LrurE8SZKOV4GTG2HFFTz7olzF6hdE=; b=VO9xd1nTMUsTeOJjyqH2BEUM3c+yuheRJc2g9JgQqtNEaeoHwUV8IBtfcOWDvsabqK q8HahzjJ545uL3WJhJG0DTRonSPNA2aUR2DtMJgjG1IPrQkLXdZ7/iWQLwK76Dq5bVsA iT9Wb00rfQ6rdgkszWoNEzL5SGlxIbRIbzDLRczFE8PsOh5GGu2iDWfFt8pkJZ2mu/E7 Z91aiK9/mM8reY7p/fKUznSVtP4gj6fKF4hZF7hkqAhBLNiS/yt4qrs5JsVRyaIRg5W8 GevcA3qfZj8UMdrTkqsUUO8rMNzNB7C5kfRQDy7qpkXu7EQsbJ6TKikij1y5E6H4CCpO 1V7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=q+XTeWxts5sk5LrurE8SZKOV4GTG2HFFTz7olzF6hdE=; b=X2ZizozdzogBgrc9XO5ojG7yp3ZbPy47YFjvMt/eVluAG6RSwO491jO5npUaxkLg8M ATMsHiNr6hwWuFiRB9PYeW8qVxfvlLT5GvD9tI9a3gReZaFZcxK3RxojhJUtRyCtmxxQ 0S8PFway/ITlwfo/EqKAOFH4ze4hZ9Whbnil7JCa5blQjwzuoLS5nZeuWZkXDIk/sCLG 1Kqn/XmBVoApI67agfqpOdHaEZqhuIyFRKJgSx4gWMGWIc2RGCpc0TX14C03iFgpXFhx yrgUh3XtnVZTGJuSrvB9Jq88ZBviN+fMW2BAlyU3Vq7KmVRbripWnL5X/4PAeMHMtkhn DF5Q== X-Gm-Message-State: AOAM5305gFfJxvjjaUh8cBHlSE47Pi/qeJGv+A0yi380m9aRapspGmke 509NsEhj2J88ovXKL5IS4McQG5zksIuPkPcK X-Google-Smtp-Source: ABdhPJzR8AXzTz8p1s0wsw2oCq/U7l90wFr/hSXs3zmYXlyWp0smMe1O9zBcrkou9l1v42I6zhEMxQ== X-Received: by 2002:a02:c9c7:: with SMTP id c7mr272810jap.57.1619280054212; Sat, 24 Apr 2021 09:00:54 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id h4sm4055901ili.52.2021.04.24.09.00.53 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 24 Apr 2021 09:00:53 -0700 (PDT) From: imp@bsdimp.com To: qemu-devel@nongnu.org Subject: [PATCH v2 33/48] bsd-user: style tweak: Use preferred block comments Date: Sat, 24 Apr 2021 10:00:01 -0600 Message-Id: <20210424160016.15200-34-imp@bsdimp.com> X-Mailer: git-send-email 2.22.1 In-Reply-To: <20210424160016.15200-1-imp@bsdimp.com> References: <20210424160016.15200-1-imp@bsdimp.com> MIME-Version: 1.0 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: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kevans@freebsd.org, arichardson@freebsd.org, Warner Losh Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Warner Losh Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/qemu.h | 74 ++++++++++++++++++++++++++++--------------------- 1 file changed, 43 insertions(+), 31 deletions(-) diff --git a/bsd-user/qemu.h b/bsd-user/qemu.h index de20e8329a..7f3cfa68aa 100644 --- a/bsd-user/qemu.h +++ b/bsd-user/qemu.h @@ -47,9 +47,10 @@ extern enum BSDType bsd_type; #define THREAD #endif -/* This struct is used to hold certain information about the image. - * Basically, it replicates in user space what would be certain - * task_struct fields in the kernel +/* + * This struct is used to hold certain information about the image. Basically, + * it replicates in user space what would be certain task_struct fields in the + * kernel */ struct image_info { abi_ulong load_addr; @@ -78,12 +79,13 @@ struct sigqueue { struct emulated_sigtable { int pending; /* true if signal is pending */ struct sigqueue *first; - struct sigqueue info; /* in order to always have memory for the - first signal, we put it here */ + /* in order to always have memory for the first signal, we put it here */ + struct sigqueue info; }; -/* NOTE: we force a big alignment so that the stack stored after is - aligned too */ +/* + * NOTE: we force a big alignment so that the stack stored after is aligned too + */ typedef struct TaskState { pid_t ts_tid; /* tid (or pid) of this task */ @@ -103,7 +105,6 @@ void init_task_state(TaskState *ts); extern const char *qemu_uname_release; extern unsigned long mmap_min_addr; -/* ??? See if we can avoid exposing so much of the loader internals. */ /* * MAX_ARG_PAGES defines the number of pages allocated for arguments * and envelope for the new program. 32 should suffice, this gives @@ -224,9 +225,11 @@ static inline bool access_ok(int type, abi_ulong addr, abi_ulong size) return page_check_range((target_ulong)addr, size, type) == 0; } -/* NOTE __get_user and __put_user use host pointers and don't check access. */ -/* These are usually used to access struct data members once the - * struct has been locked - usually with lock_user_struct(). +/* + * NOTE __get_user and __put_user use host pointers and don't check access. + * + * These are usually used to access struct data members once the struct has been + * locked - usually with lock_user_struct(). */ #define __put_user(x, hptr)\ ({\ @@ -267,17 +270,18 @@ static inline bool access_ok(int type, abi_ulong addr, abi_ulong size) x = (typeof(*hptr))tswap64(*(uint64_t *)(hptr));\ break;\ default:\ - /* avoid warning */\ x = 0;\ abort();\ } \ 0;\ }) -/* put_user()/get_user() take a guest address and check access */ -/* These are usually used to access an atomic data type, such as an int, - * that has been passed by address. These internally perform locking - * and unlocking on the data type. +/* + * put_user()/get_user() take a guest address and check access + * + * These are usually used to access an atomic data type, such as an int, that + * has been passed by address. These internally perform locking and unlocking + * on the data type. */ #define put_user(x, gaddr, target_type) \ ({ \ @@ -301,7 +305,6 @@ static inline bool access_ok(int type, abi_ulong addr, abi_ulong size) __ret = __get_user((x), __hptr); \ unlock_user(__hptr, __gaddr, 0); \ } else { \ - /* avoid warning */ \ (x) = 0; \ __ret = -TARGET_EFAULT; \ } \ @@ -330,22 +333,28 @@ static inline bool access_ok(int type, abi_ulong addr, abi_ulong size) #define get_user_u8(x, gaddr) get_user((x), (gaddr), uint8_t) #define get_user_s8(x, gaddr) get_user((x), (gaddr), int8_t) -/* copy_from_user() and copy_to_user() are usually used to copy data +/* + * copy_from_user() and copy_to_user() are usually used to copy data * buffers between the target and host. These internally perform * locking/unlocking of the memory. */ abi_long copy_from_user(void *hptr, abi_ulong gaddr, size_t len); abi_long copy_to_user(abi_ulong gaddr, void *hptr, size_t len); -/* Functions for accessing guest memory. The tget and tput functions - read/write single values, byteswapping as necessary. The lock_user function - gets a pointer to a contiguous area of guest memory, but does not perform - any byteswapping. lock_user may return either a pointer to the guest - memory, or a temporary buffer. */ +/* + * Functions for accessing guest memory. The tget and tput functions + * read/write single values, byteswapping as necessary. The lock_user function + * gets a pointer to a contiguous area of guest memory, but does not perform + * any byteswapping. lock_user may return either a pointer to the guest + * memory, or a temporary buffer. + */ -/* Lock an area of guest memory into the host. If copy is true then the - host area will have the same contents as the guest. */ -static inline void *lock_user(int type, abi_ulong guest_addr, long len, int copy) +/* + * Lock an area of guest memory into the host. If copy is true then the + * host area will have the same contents as the guest. + */ +static inline void *lock_user(int type, abi_ulong guest_addr, long len, + int copy) { if (!access_ok(type, guest_addr, len)) return NULL; @@ -364,9 +373,10 @@ static inline void *lock_user(int type, abi_ulong guest_addr, long len, int copy #endif } -/* Unlock an area of guest memory. The first LEN bytes must be - flushed back to guest memory. host_ptr = NULL is explicitly - allowed and does nothing. */ +/* + * Unlock an area of guest memory. The first LEN bytes must be flushed back to + * guest memory. host_ptr = NULL is explicitly allowed and does nothing. + */ static inline void unlock_user(void *host_ptr, abi_ulong guest_addr, long len) { @@ -382,8 +392,10 @@ static inline void unlock_user(void *host_ptr, abi_ulong guest_addr, #endif } -/* Return the length of a string in target memory or -TARGET_EFAULT if - access error. */ +/* + * Return the length of a string in target memory or -TARGET_EFAULT if access + * error. + */ abi_long target_strlen(abi_ulong gaddr); /* Like lock_user but for null terminated strings. */ From patchwork Sat Apr 24 16:00:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1469981 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=bsdimp-com.20150623.gappssmtp.com header.i=@bsdimp-com.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=jvm/tkGw; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FSGzn2rpmz9sTD for ; Sun, 25 Apr 2021 02:37:57 +1000 (AEST) Received: from localhost ([::1]:56428 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1laLI3-0007dW-Db for incoming@patchwork.ozlabs.org; Sat, 24 Apr 2021 12:37:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50660) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1laKij-0005r4-U1 for qemu-devel@nongnu.org; Sat, 24 Apr 2021 12:01:25 -0400 Received: from mail-il1-x12e.google.com ([2607:f8b0:4864:20::12e]:33754) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1laKiJ-0004Jj-59 for qemu-devel@nongnu.org; Sat, 24 Apr 2021 12:01:25 -0400 Received: by mail-il1-x12e.google.com with SMTP id y10so2434134ilv.0 for ; Sat, 24 Apr 2021 09:00:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=tUDFu/I6EM+q361qAo+D5v6XcOpZP9dVZrI/ucKywtM=; b=jvm/tkGwc/cuLhgtwtxm+biQMGI+oBqzriY6c8LH++sHkC5PCY8LpPCriEDAFnVklM IUIFbtuTnPruXumLQ7SEduCuWcRP1xCuei75ayxEg0xQS0hEgakXZdqmaSPFWdoiTm3d C9UvNkcNvh4M8dHjDVAKm7pXKtu0PSeZXdeMNQDRr/H5t3Ww/CH2ME0aJ9nU6Pkn+470 k8LqioyEDgLQaUzbaGBwy64GaF1t+ipuPAgCrzLzXMHP6X9kOSUaa+enPrzOGQ/cl6ie 0DksRL8/0z+GXNSh69tJJ6GgsZZc0xIaI4LDO25zS7+BdwrRKJUL4s6Wo/8vur2FjE7B 7Xag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=tUDFu/I6EM+q361qAo+D5v6XcOpZP9dVZrI/ucKywtM=; b=hw2xFELgNJoLnGjJGGTsYfppFBHlNJeuNAZc3NOWnmzn4xvN5aQ+aCvn5bW9rXOAIM 7bHzLEiEdzeBlr3QUXV9z82edg0gUPOvtZAGBKwPzrhNLuYUgklWTyalQuQONMvJMEqg Fffq1osNVDuum4GMBKdPQwtBssbInxnzBg14+VDKM7GkLtYuygpcPNhM9tQH3ZSmib1M J2MTJ65s7i7jF4xxnn1oHN0KHUg3w0OO7aYETI+nnZP93KpaNerAgQXaxQl5IduYleBZ VuJptCRZHBVFmdY+svfKE2el09WmwPjrG2FaoHVI6WQ52vVMQEtD1O8XV0BYGmvzcNBY +3Dg== X-Gm-Message-State: AOAM530rHdDqi05f35FtZAbpSJtnI9f9btyToy2w5vlBhxbu3JP61PPA R0+61vlx28vooc9I9v6cvN9H9rJbxEg0348z X-Google-Smtp-Source: ABdhPJzwUZjkpKyN9Zq3rI0NkgVZfjpQuNpJ8eMeYRLBat4IbpV3HgzogNZbwfWLGXgGxltYQJpYlQ== X-Received: by 2002:a92:c56a:: with SMTP id b10mr7355848ilj.6.1619280055187; Sat, 24 Apr 2021 09:00:55 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id h4sm4055901ili.52.2021.04.24.09.00.54 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 24 Apr 2021 09:00:54 -0700 (PDT) From: imp@bsdimp.com To: qemu-devel@nongnu.org Subject: [PATCH v2 34/48] bsd-user: style tweak: don't assign in if statements Date: Sat, 24 Apr 2021 10:00:02 -0600 Message-Id: <20210424160016.15200-35-imp@bsdimp.com> X-Mailer: git-send-email 2.22.1 In-Reply-To: <20210424160016.15200-1-imp@bsdimp.com> References: <20210424160016.15200-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::12e; envelope-from=imp@bsdimp.com; helo=mail-il1-x12e.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kevans@freebsd.org, arichardson@freebsd.org, Warner Losh Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Warner Losh Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/qemu.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bsd-user/qemu.h b/bsd-user/qemu.h index 7f3cfa68aa..2494d9209d 100644 --- a/bsd-user/qemu.h +++ b/bsd-user/qemu.h @@ -288,7 +288,8 @@ static inline bool access_ok(int type, abi_ulong addr, abi_ulong size) abi_ulong __gaddr = (gaddr); \ target_type *__hptr; \ abi_long __ret; \ - if ((__hptr = lock_user(VERIFY_WRITE, __gaddr, sizeof(target_type), 0))) { \ + __hptr = lock_user(VERIFY_WRITE, __gaddr, sizeof(target_type), 0); \ + if (__hptr) { \ __ret = __put_user((x), __hptr); \ unlock_user(__hptr, __gaddr, sizeof(target_type)); \ } else \ @@ -301,7 +302,8 @@ static inline bool access_ok(int type, abi_ulong addr, abi_ulong size) abi_ulong __gaddr = (gaddr); \ target_type *__hptr; \ abi_long __ret; \ - if ((__hptr = lock_user(VERIFY_READ, __gaddr, sizeof(target_type), 1))) { \ + __hptr = lock_user(VERIFY_READ, __gaddr, sizeof(target_type), 1); \ + if (__hptr) { \ __ret = __get_user((x), __hptr); \ unlock_user(__hptr, __gaddr, 0); \ } else { \ From patchwork Sat Apr 24 16:00:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1469971 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=bsdimp-com.20150623.gappssmtp.com header.i=@bsdimp-com.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=z8R4+40w; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FSGlD0y14z9sTD for ; Sun, 25 Apr 2021 02:27:04 +1000 (AEST) Received: from localhost ([::1]:59892 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1laL7W-0005fT-6I for incoming@patchwork.ozlabs.org; Sat, 24 Apr 2021 12:27:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50622) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1laKii-0005or-Sg for qemu-devel@nongnu.org; Sat, 24 Apr 2021 12:01:24 -0400 Received: from mail-io1-xd2f.google.com ([2607:f8b0:4864:20::d2f]:38723) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1laKiK-0004Jo-1o for qemu-devel@nongnu.org; Sat, 24 Apr 2021 12:01:24 -0400 Received: by mail-io1-xd2f.google.com with SMTP id q25so8310690iog.5 for ; Sat, 24 Apr 2021 09:00:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=xKCD+PPDyOUrgWplU9tqkEeeW0rorHGKoJtS0fxSytw=; b=z8R4+40wcpkSGGjwOUgDZ6ROM/ps9DGhBVQC8hqcsSKDi/PwCdO3VCNlWi/HjagQ4X ia6JPf6ljaj17/d/KVJnvXeVxYBQoaXC+moYIOwkXVMdHyUX0IQ9odlOHOn3SGXdI0el Leeva2lHMNheA0yAah0bbCFbu6E4cV1i7BFBh9QdYQ9+/4wo8wrH61RVtJDEB+zaLfyL o1626qHpoe9A9xprTiakWc5yLqcaDvSnCLvMdZW0p8RQWGf5Qtj8G1/8K4IUPGUsiPKE 0RkbwBov4egx3b6qxNmI38hQzPYQc+FZy8KjKSMTmGqFOd74spTdnfYg2qBB2CY79nwp aruA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xKCD+PPDyOUrgWplU9tqkEeeW0rorHGKoJtS0fxSytw=; b=ud67x1tH4akRGMahRpWnQ01c2KlN7mrJS++lRckFstoDixs0S7vQKzqOtlPqPD8zIb HKQqbaQgI0AFaCDKPcNw/PYJVd7BQw3PxcCx8kPgkWOxTImXXuxUXtxT5s29s99usK6a Vvo9fl0pSh4Y3NMnNzy1kU28A0XX0xI4foQDty4YdDFQU2Ge2m8JhuOVJf9WyKmODPK8 BigBBZeOIZhctPYrq+OR9yg3QtH8kJkfiVHAE6n1j7j0oQaM0netVyXOHZ9sKPRhuQPg bKqQrhoUHxLpH3WY2MTFCJNlN3+PZU04l4tD/qOK4HKckGh3zBTBJG3w5jf0Zz9w3V8P 9bQw== X-Gm-Message-State: AOAM533JXN1CYe/zg/78yNULLPI/y1krxh1MQgM9HNhk+AI5bMgZrw17 XT5EAjVwKmKFkpMQ0JopXsgMX6Egc1rpf2J9 X-Google-Smtp-Source: ABdhPJzgzP34TcOniz+zQXToMXVdlRJXHU+wgd7J8pyQ4OkppYKKchp5XF3XyxuOZkurJxAGKiSX1Q== X-Received: by 2002:a02:308e:: with SMTP id q136mr8394550jaq.47.1619280056141; Sat, 24 Apr 2021 09:00:56 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id h4sm4055901ili.52.2021.04.24.09.00.55 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 24 Apr 2021 09:00:55 -0700 (PDT) From: imp@bsdimp.com To: qemu-devel@nongnu.org Subject: [PATCH v2 35/48] bsd-user: style tweak: use {} for all if statements, format else correctly Date: Sat, 24 Apr 2021 10:00:03 -0600 Message-Id: <20210424160016.15200-36-imp@bsdimp.com> X-Mailer: git-send-email 2.22.1 In-Reply-To: <20210424160016.15200-1-imp@bsdimp.com> References: <20210424160016.15200-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::d2f; envelope-from=imp@bsdimp.com; helo=mail-io1-xd2f.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kevans@freebsd.org, arichardson@freebsd.org, Warner Losh Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Warner Losh Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/qemu.h | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/bsd-user/qemu.h b/bsd-user/qemu.h index 2494d9209d..8d3767964d 100644 --- a/bsd-user/qemu.h +++ b/bsd-user/qemu.h @@ -358,16 +358,18 @@ abi_long copy_to_user(abi_ulong gaddr, void *hptr, size_t len); static inline void *lock_user(int type, abi_ulong guest_addr, long len, int copy) { - if (!access_ok(type, guest_addr, len)) + if (!access_ok(type, guest_addr, len)) { return NULL; + } #ifdef DEBUG_REMAP { void *addr; addr = g_malloc(len); - if (copy) + if (copy) { memcpy(addr, g2h_untagged(guest_addr), len); - else + } else { memset(addr, 0, len); + } return addr; } #else @@ -384,12 +386,15 @@ static inline void unlock_user(void *host_ptr, abi_ulong guest_addr, { #ifdef DEBUG_REMAP - if (!host_ptr) + if (!host_ptr) { return; - if (host_ptr == g2h_untagged(guest_addr)) + } + if (host_ptr == g2h_untagged(guest_addr)) { return; - if (len > 0) + } + if (len > 0) { memcpy(g2h_untagged(guest_addr), host_ptr, len); + } g_free(host_ptr); #endif } @@ -405,8 +410,9 @@ static inline void *lock_user_string(abi_ulong guest_addr) { abi_long len; len = target_strlen(guest_addr); - if (len < 0) + if (len < 0) { return NULL; + } return lock_user(VERIFY_READ, guest_addr, (long)(len + 1), 1); } From patchwork Sat Apr 24 16:00:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1469966 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=bsdimp-com.20150623.gappssmtp.com header.i=@bsdimp-com.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=VzVNpNW0; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FSGhp72RCz9sTD for ; Sun, 25 Apr 2021 02:24:58 +1000 (AEST) Received: from localhost ([::1]:51492 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1laL5T-0002Du-FQ for incoming@patchwork.ozlabs.org; Sat, 24 Apr 2021 12:24:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50620) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1laKii-0005oZ-N6 for qemu-devel@nongnu.org; Sat, 24 Apr 2021 12:01:24 -0400 Received: from mail-io1-xd2b.google.com ([2607:f8b0:4864:20::d2b]:43625) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1laKiJ-0004Jv-59 for qemu-devel@nongnu.org; Sat, 24 Apr 2021 12:01:24 -0400 Received: by mail-io1-xd2b.google.com with SMTP id v123so703326ioe.10 for ; Sat, 24 Apr 2021 09:00:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=kfabuplVH/Xndi+YByBhcEdJT1l70+GW7yUfnMNV+4M=; b=VzVNpNW017B/niUM/CUwTtPrxO8uQQEKfN/s52TdY3LAmOGBOTwipLr/8Y0w5HR94d nenhCKlYAEduP3jDFfMOroP6myzk2YYQzFBnMUPKS/XBkEKyVWYF28cqOYGMA0dkCifP FXZbuVYApyDoXDuaFx0zPmLcVNTJJezIQW91NPawJ3ZWmyNnmkHw2eNjUybrw9KMjxiZ Mz4yfZySZDw0tcLbS+VaN0f20xmlHPVZn48FvTCd8Lq2bx7bRSMb4wHMLRJUFSYuMfLh f9SILJVtn+GOEm6jQcB2euEPocws73vAN/1mekrQwf6pMMogOPYWnoi0OFjGH0VViqEU 3Khw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=kfabuplVH/Xndi+YByBhcEdJT1l70+GW7yUfnMNV+4M=; b=qulPjOoREOvh+EhLlbgsV0H+1T2cijKV506aaYeE98S2peIyZ4HlqSsY/M+d5OUEzf YhxchQpyY+IHUyHKJhrPHehPfFJyAp32dTi06OhHEUtGiK3LJJokkRWPTGmUMr2mbmR4 dUSTg3G4BQoLWUEmtTZ+7+YmZf803ATp3trsP1Oxg9w1TwYwSJZm2mA5Xnh7Xnmtz51V AfQB9NMRskrD7w1hGzdvkzF5WY4eF5Ld8ZAtDiG89z56A7fK3SiX49p8ie6Zmm/uHg/G aVCtD1icu6Ks/9SO1k+V5z86G/r5VGYAJg8/q2sg8kChuCLweMm3RZU1ol2sJrMDkkPw 7AiA== X-Gm-Message-State: AOAM5326bHO0bECf0GJXPgHZFiHH/hy0aeI+NHwb+rCjNF/bYmaMWN6O FthqlNCAbCrLH0r2m7WjsP3Dqgwo49SQpYn+ X-Google-Smtp-Source: ABdhPJxXZ62m1UvYAQaWD8Kam+wSGsanYFT4yNMSEjBJs2mnPdI0dgZ0pr8xSRaNGnc+6WYG6vn6Ow== X-Received: by 2002:a5d:9694:: with SMTP id m20mr7473490ion.40.1619280056997; Sat, 24 Apr 2021 09:00:56 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id h4sm4055901ili.52.2021.04.24.09.00.56 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 24 Apr 2021 09:00:56 -0700 (PDT) From: imp@bsdimp.com To: qemu-devel@nongnu.org Subject: [PATCH v2 36/48] bsd-user: style tweak: Use preferred block comments Date: Sat, 24 Apr 2021 10:00:04 -0600 Message-Id: <20210424160016.15200-37-imp@bsdimp.com> X-Mailer: git-send-email 2.22.1 In-Reply-To: <20210424160016.15200-1-imp@bsdimp.com> References: <20210424160016.15200-1-imp@bsdimp.com> MIME-Version: 1.0 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: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kevans@freebsd.org, arichardson@freebsd.org, Warner Losh Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Warner Losh Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/uaccess.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/bsd-user/uaccess.c b/bsd-user/uaccess.c index 89163257f4..7eb4546fed 100644 --- a/bsd-user/uaccess.c +++ b/bsd-user/uaccess.c @@ -4,9 +4,10 @@ #include "qemu.h" -/* copy_from_user() and copy_to_user() are usually used to copy data - * buffers between the target and host. These internally perform - * locking/unlocking of the memory. +/* + * copy_from_user() and copy_to_user() are usually used to copy data buffers + * between the target and host. These internally perform locking/unlocking of + * the memory. */ abi_long copy_from_user(void *hptr, abi_ulong gaddr, size_t len) { @@ -37,8 +38,10 @@ abi_long copy_to_user(abi_ulong gaddr, void *hptr, size_t len) return ret; } -/* Return the length of a string in target memory or -TARGET_EFAULT if - access error */ +/* + * Return the length of a string in target memory or -TARGET_EFAULT if access + * error + */ abi_long target_strlen(abi_ulong guest_addr1) { uint8_t *ptr; From patchwork Sat Apr 24 16:00:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1469974 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=bsdimp-com.20150623.gappssmtp.com header.i=@bsdimp-com.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=I2hJ3TSb; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FSGpg3pPzz9sTD for ; Sun, 25 Apr 2021 02:30:01 +1000 (AEST) Received: from localhost ([::1]:39696 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1laLAN-0000Um-6k for incoming@patchwork.ozlabs.org; Sat, 24 Apr 2021 12:29:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50628) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1laKij-0005pM-2d for qemu-devel@nongnu.org; Sat, 24 Apr 2021 12:01:25 -0400 Received: from mail-il1-x12c.google.com ([2607:f8b0:4864:20::12c]:44872) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1laKiK-0004K1-V0 for qemu-devel@nongnu.org; Sat, 24 Apr 2021 12:01:24 -0400 Received: by mail-il1-x12c.google.com with SMTP id i22so393257ila.11 for ; Sat, 24 Apr 2021 09:00:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=S9w7CJ0+MJpr5zL1Lbw3l/YeW43hAWDuCaPwKLYTrT8=; b=I2hJ3TSb9UL97rgTQrLQ3HLY1ysw+Jm2GxiGqQY7lCB0BMjGy8N82/4JpM19CBiKXh fEPqlJ2Ql7n5j0haA4blaDZyNUK2CxSebVo+PyVdsCq1D4e83zhvrsz1byv9khwRd7BS Yh/38FWE4lqbM+Kc/bTptOhToW7ou4eXeLj+U8Y1ZaAHgwFmrPvpcDDpTDgHuWBb0Rdz GGj77VLACYpZeMPcYXZboQ2SqBsFaPaDrTv3Qlh7PEbnKjGpqJhIRGJqyCAFJFJ2+p2D BTmSMkaUHSm5GrDDYhWPhNuwesVQiKZ5XIxi8A+r67wmdeH8Osctrxo+xuHqBQve/YXE x0og== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=S9w7CJ0+MJpr5zL1Lbw3l/YeW43hAWDuCaPwKLYTrT8=; b=M5zrOdyAGrhUO/9vcalFIKWE5wbjRH74YMbyRPZgaurj/JAeQjCBr1drEJehj6LGu2 64tcrO8AMpc0cw4AVdT8yI5bv7pIReClufSHcl/OWO7qMnM6CARwJoHGWWZFw7z/+NtN P6SGkFtxaxZEMegVie6O7cfhPvg8iQjgs+ScOdOljAatexJUFT/YtXGwa7NeNxzoQQtX RJJFbpKqQ6gKOOdlO0OFB4FDJVTUdj3m192yGu4CkvHn52+v4AZZqy39/h/QtaWi3YfL mwttpbF/UEqfVQg+GNfRJOC23u3XR0acx+IHiNxy+d7oDnT50Id3lETO/knSFsARoOzh zC9g== X-Gm-Message-State: AOAM5319AXFJ6NIxnVpfeAShsdYZbb8aKtKNI8oUOkmZfgGlJsCyiP19 kN9W1PA0APgq9h8EjMtHhYQRi1NImM0Dlziv X-Google-Smtp-Source: ABdhPJyvid7tQZbl2jpWGIXYMonTvuFx9WmpFj+mmw7ot2gHzzT5PK9+OPhbvqGBFyFi2coh8RtzeQ== X-Received: by 2002:a05:6e02:5a2:: with SMTP id k2mr7315462ils.177.1619280057761; Sat, 24 Apr 2021 09:00:57 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id h4sm4055901ili.52.2021.04.24.09.00.57 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 24 Apr 2021 09:00:57 -0700 (PDT) From: imp@bsdimp.com To: qemu-devel@nongnu.org Subject: [PATCH v2 37/48] bsd-user: style tweak: don't assign in if statements Date: Sat, 24 Apr 2021 10:00:05 -0600 Message-Id: <20210424160016.15200-38-imp@bsdimp.com> X-Mailer: git-send-email 2.22.1 In-Reply-To: <20210424160016.15200-1-imp@bsdimp.com> References: <20210424160016.15200-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::12c; envelope-from=imp@bsdimp.com; helo=mail-il1-x12c.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kevans@freebsd.org, arichardson@freebsd.org, Warner Losh Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Warner Losh Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/uaccess.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bsd-user/uaccess.c b/bsd-user/uaccess.c index 7eb4546fed..aab5e995a9 100644 --- a/bsd-user/uaccess.c +++ b/bsd-user/uaccess.c @@ -14,7 +14,8 @@ abi_long copy_from_user(void *hptr, abi_ulong gaddr, size_t len) abi_long ret = 0; void *ghptr; - if ((ghptr = lock_user(VERIFY_READ, gaddr, len, 1))) { + ghptr = lock_user(VERIFY_READ, gaddr, len, 1); + if (ghptr) { memcpy(hptr, ghptr, len); unlock_user(ghptr, gaddr, 0); } else @@ -29,7 +30,8 @@ abi_long copy_to_user(abi_ulong gaddr, void *hptr, size_t len) abi_long ret = 0; void *ghptr; - if ((ghptr = lock_user(VERIFY_WRITE, gaddr, len, 0))) { + ghptr = lock_user(VERIFY_WRITE, gaddr, len, 0); + if (ghptr) { memcpy(ghptr, hptr, len); unlock_user(ghptr, gaddr, len); } else From patchwork Sat Apr 24 16:00:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1469979 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=bsdimp-com.20150623.gappssmtp.com header.i=@bsdimp-com.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=mEl+ZmJJ; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FSGxh47GVz9sW4 for ; Sun, 25 Apr 2021 02:36:08 +1000 (AEST) Received: from localhost ([::1]:52294 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1laLGH-0005sI-8z for incoming@patchwork.ozlabs.org; Sat, 24 Apr 2021 12:36:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50668) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1laKik-0005sU-Ih for qemu-devel@nongnu.org; Sat, 24 Apr 2021 12:01:26 -0400 Received: from mail-il1-x129.google.com ([2607:f8b0:4864:20::129]:36856) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1laKiL-0004K7-2D for qemu-devel@nongnu.org; Sat, 24 Apr 2021 12:01:26 -0400 Received: by mail-il1-x129.google.com with SMTP id p15so7428748iln.3 for ; Sat, 24 Apr 2021 09:00:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=PoD849iWu2bWzUO4nDp3ypRtrOgwVSOKxnGpOs50MwI=; b=mEl+ZmJJuP1I+HHS24xHqPTNt46fOAytxuS2BzPRoQdq4d9ctivGgAO53yn5FZVWa0 xomQR/IgtGqghnXGUqZW9JaqU9W9iezwiu6R+SP6crA5qTDj3CLhzOGQHiOlzE9eoq/J s1FH9J8ci21i/fsAMTPfwzW8rlpC7aCAIpNq4+C/6zybDami18khy65bZwEDJDYaQwru F43ZNUexuEgoC5AAOIKMXfmosf+cyJt4mnogi/n2fzFYZ7omk+VaKE2MtERCFlpgvdA4 Y7gj8wkxszJQ0oNJduCgG9mVKbIH69pH36+W82a38Qx9unEQYk7VYa6dNAR8BlgZwbz+ R1LQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=PoD849iWu2bWzUO4nDp3ypRtrOgwVSOKxnGpOs50MwI=; b=KZqj/u6NR9faOhYQjAwHEUwZ+7KvyzpKq5ZVIMk5Ra4vvcCSoVrNTd3M5Jk2nBDKne izMF49OiHGE4tHHaeEhhVDZXXsmK+knJUpesOtriWT3ad7124LgLg2bRyzP6tHPe+GG6 laEFzFNYhvTVizKNUoi2TKf+TSgQkHU2YDHF9xYMMseEinECvBH7/J440JH5PPs9imOR gBa1se8wlBn0BF4sg10Jgc5zydL9pArW0lkJ6nJuJM+qYvBvvtPR29YON/JdiLT6EENC 8YH6u+O496gXKH8L1Xlz2ogD9KDVssAQ0kV94egIhQsbVVBzfbtkZhl2us1WEFhwcTRs wA9Q== X-Gm-Message-State: AOAM530utTjTtOYrQV/ZQLUwF2VsVFVM816zGnic9cJQi0nSJzA9MbmF SsEwKbK4PwzQ9gPegBK270w529i0fAPtCJyB X-Google-Smtp-Source: ABdhPJwAbJC2AUMdjMLr/LX8L1iwupKcPy8P/5K2qa/8ePrNYKmD++LAH8hS04O/Nvk2XiexhXiISQ== X-Received: by 2002:a05:6e02:1808:: with SMTP id a8mr7058458ilv.175.1619280058488; Sat, 24 Apr 2021 09:00:58 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id h4sm4055901ili.52.2021.04.24.09.00.57 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 24 Apr 2021 09:00:58 -0700 (PDT) From: imp@bsdimp.com To: qemu-devel@nongnu.org Subject: [PATCH v2 38/48] bsd-user: style tweak: use {} for all if statements, format else correctly Date: Sat, 24 Apr 2021 10:00:06 -0600 Message-Id: <20210424160016.15200-39-imp@bsdimp.com> X-Mailer: git-send-email 2.22.1 In-Reply-To: <20210424160016.15200-1-imp@bsdimp.com> References: <20210424160016.15200-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::129; envelope-from=imp@bsdimp.com; helo=mail-il1-x129.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kevans@freebsd.org, arichardson@freebsd.org, Warner Losh Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Warner Losh Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/uaccess.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bsd-user/uaccess.c b/bsd-user/uaccess.c index aab5e995a9..2e8ad2982f 100644 --- a/bsd-user/uaccess.c +++ b/bsd-user/uaccess.c @@ -54,8 +54,9 @@ abi_long target_strlen(abi_ulong guest_addr1) for (;;) { max_len = TARGET_PAGE_SIZE - (guest_addr & ~TARGET_PAGE_MASK); ptr = lock_user(VERIFY_READ, guest_addr, max_len, 1); - if (!ptr) + if (!ptr) { return -TARGET_EFAULT; + } len = qemu_strnlen((const char *)ptr, max_len); unlock_user(ptr, guest_addr, 0); guest_addr += len; @@ -63,8 +64,9 @@ abi_long target_strlen(abi_ulong guest_addr1) if (guest_addr == 0 || (guest_addr - guest_addr1) > 0x7fffffff) return -TARGET_EFAULT; - if (len != max_len) + if (len != max_len) { break; + } } return guest_addr - guest_addr1; } From patchwork Sat Apr 24 16:00:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1469977 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=bsdimp-com.20150623.gappssmtp.com header.i=@bsdimp-com.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=G8uQSqBy; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FSGt85Cygz9sTD for ; Sun, 25 Apr 2021 02:33:04 +1000 (AEST) Received: from localhost ([::1]:46400 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1laLDK-0003Mr-Ou for incoming@patchwork.ozlabs.org; Sat, 24 Apr 2021 12:33:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50642) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1laKij-0005pq-Bd for qemu-devel@nongnu.org; Sat, 24 Apr 2021 12:01:25 -0400 Received: from mail-il1-x129.google.com ([2607:f8b0:4864:20::129]:40745) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1laKiL-0004Kw-23 for qemu-devel@nongnu.org; Sat, 24 Apr 2021 12:01:25 -0400 Received: by mail-il1-x129.google.com with SMTP id c18so43124165iln.7 for ; Sat, 24 Apr 2021 09:01:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=LwG+nWA2LtdBBnjFrGwuENdtJtdJ3/bpWBWdq5mEXd8=; b=G8uQSqBy9ycxOHOtptCKYH4wmvelfbZwOF311yd/Xc4fhGF56ClLkoz3QrcRnxWH/z kYFdBPnC+iDdaUGYUif9SBdqWKgPcq4IVqVuFU3LoM7t3KOcqVc1M7tULcQfa3evI9mo aGZoollIDEAyRX4vPx7FjD7gxFwDh9EZY8xgx0GxHen6FgFQl90FHzSLMu+US/98AK/g nEEpAfBQUJhTrH85kfpl2M8Fy1FbP64ldN3zQ4iUuH/PNE/gZ6FPIXdZMO4kt7QgfBF8 CmZXqf97J/SVfi5ewV8MqWJHj/wA91eSaWdW+iMaCWqdqsTSJm/bLW52L2M4E3Fl5Eu4 xYNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=LwG+nWA2LtdBBnjFrGwuENdtJtdJ3/bpWBWdq5mEXd8=; b=YX1A3mVvd5DN4kCI+iz6mVZjjC2FwH2plrnSj982QuShOLAEit3/+Kb5XWAheG2wA5 qsOV+5upSp3D9YLLIRQhVjZSbzzpbROGQaBU+TqEfDh/CkPmQ4MDdj33Gy5LjAxT9E/c J6ZG3cLL4rBmLhyU5nGi2r1d6U8EixWsHWNnOheMxkog7Wt83Nr5rxCrZ8iLdKyTVk2m MHy8n7puRfqvNiECNaelNjmuLWXmlkXtq4VvyrAB3W7aEFoSQf0QJFrqxNCef7eqKIXP Oj3L5c7Iu9wVd8bnRkTVJF9x9Fmv16MGW2Ec3beBvg1mun2fusHphHe+3XDlO/wnmAn5 VDbg== X-Gm-Message-State: AOAM533Xr+a2tZaSEOmbaN/3hJN/qrpFUQci/JoJ/Ag5VwwDaOW7CsDc QRvMwF5aiKtHVW0fyuh8h3a65l6P8DMabILQ X-Google-Smtp-Source: ABdhPJxrvK5qnn8BoNHuIvqPgAE2WeKA1bkfTuZZKEWapaz1+OQW4rzkWFDeYhSgxR/qf/XGwS6qtA== X-Received: by 2002:a05:6e02:1baf:: with SMTP id n15mr7180330ili.148.1619280059266; Sat, 24 Apr 2021 09:00:59 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id h4sm4055901ili.52.2021.04.24.09.00.58 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 24 Apr 2021 09:00:58 -0700 (PDT) From: imp@bsdimp.com To: qemu-devel@nongnu.org Subject: [PATCH v2 39/48] bsd-user: style tweak: spaces around =, remove stray space Date: Sat, 24 Apr 2021 10:00:07 -0600 Message-Id: <20210424160016.15200-40-imp@bsdimp.com> X-Mailer: git-send-email 2.22.1 In-Reply-To: <20210424160016.15200-1-imp@bsdimp.com> References: <20210424160016.15200-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::129; envelope-from=imp@bsdimp.com; helo=mail-il1-x129.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kevans@freebsd.org, arichardson@freebsd.org, Warner Losh Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Warner Losh Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/strace.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bsd-user/strace.c b/bsd-user/strace.c index be40b8a20c..e4153fd0a1 100644 --- a/bsd-user/strace.c +++ b/bsd-user/strace.c @@ -147,11 +147,11 @@ static void print_syscall(int num, const struct syscallname *scnames, abi_long arg4, abi_long arg5, abi_long arg6) { unsigned int i; - const char *format="%s(" TARGET_ABI_FMT_ld "," TARGET_ABI_FMT_ld "," + const char *format = "%s(" TARGET_ABI_FMT_ld "," TARGET_ABI_FMT_ld "," TARGET_ABI_FMT_ld "," TARGET_ABI_FMT_ld "," TARGET_ABI_FMT_ld "," TARGET_ABI_FMT_ld ")"; - gemu_log("%d ", getpid() ); + gemu_log("%d ", getpid()); for (i = 0; i < nscnames; i++) { if (scnames[i].nr == num) { From patchwork Sat Apr 24 16:00:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1469950 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=bsdimp-com.20150623.gappssmtp.com header.i=@bsdimp-com.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=DYkYSr1q; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FSGRL4Jy8z9sW1 for ; Sun, 25 Apr 2021 02:13:18 +1000 (AEST) Received: from localhost ([::1]:42432 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1laKuC-0003S1-I4 for incoming@patchwork.ozlabs.org; Sat, 24 Apr 2021 12:13:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50700) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1laKil-0005us-HA for qemu-devel@nongnu.org; Sat, 24 Apr 2021 12:01:27 -0400 Received: from mail-il1-x136.google.com ([2607:f8b0:4864:20::136]:34585) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1laKiM-0004LN-VE for qemu-devel@nongnu.org; Sat, 24 Apr 2021 12:01:27 -0400 Received: by mail-il1-x136.google.com with SMTP id c15so43208989ilj.1 for ; Sat, 24 Apr 2021 09:01:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=bFmEuRUoyogZECJof/Yh6AI51ApSTVaAZW3RigfbmQg=; b=DYkYSr1q4M7nIQwWKVFYKLCCAmWUeoIFvS9lXyqu8apKbdGkHz8ZP0LZ+hZd1onf/k f9akCu/whAFeHBV+daXvjpjdrJrD1vfXxLpNkg3HLeAQnQcdi8fIb/RLi+31wR+VhxiG 1fdWQe6lC+rPXWBVeE4y0YDnmpIBX8KXZSNJ8Cg4X9KDifJLjkp45HL73gGRWDM/vVuS f49Ws6xcCv4dnJYslKH471TyVts6CQv+mWGGPzvQTBYQbm8IOD/7bkIvtxB6paEW6SA3 EamoCgVW2MKsNEifut71yU69jxM/cROSy4Xauut6Qyx5mqazbQnGog6aSVkUD/JLI5hR Q3mQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=bFmEuRUoyogZECJof/Yh6AI51ApSTVaAZW3RigfbmQg=; b=Qv9sc5EIDcutML5plNrKRKByK62eeDf0bK7NFZu1wEnZxkvzY1NvATqVdDrK9y36nS uIbk2qPA/syim/wtM0dKIfsEmCYeqeu2eQt4u+XmjCejd56Cc5QXdF0Hq+0xP7tukmL/ 0cZBetzkuVzPHV60pNUrY4qTqdl/m0Gi7UCKcMMF1B5JKeR3OV8gMov25Dr9w7xKtrBp vXPJZBvMRwRfWSW+OMHmFYIsWVGCP2RIlcDkC+hpX5rg3LAPKNFIKq2YyFf3qbFno2bB 6am7ZGBqPCgCWwVMk6x8ZwBG8aNOfTMqClAh0kVqe/y1qr8ugHQtYurAXNGpIFexjdzd PBNg== X-Gm-Message-State: AOAM530sZj9IwEADWjbdu80EwUJyunnvJRCkq7I2SBP+YEoMzi1unxt8 zngy6D71K3+/igWznRSBfwO9v+BUNIfHWS2a X-Google-Smtp-Source: ABdhPJzMXrGjSE8kj8WqMgq39Rnjr1ktXt+deBgJi3/hcPJJZhwGKoi1t9Ne8hj+ZB27v+M1IRc+pA== X-Received: by 2002:a05:6e02:13ca:: with SMTP id v10mr6592243ilj.191.1619280060075; Sat, 24 Apr 2021 09:01:00 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id h4sm4055901ili.52.2021.04.24.09.00.59 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 24 Apr 2021 09:00:59 -0700 (PDT) From: imp@bsdimp.com To: qemu-devel@nongnu.org Subject: [PATCH v2 40/48] bsd-user: style tweak: Use preferred block comments Date: Sat, 24 Apr 2021 10:00:08 -0600 Message-Id: <20210424160016.15200-41-imp@bsdimp.com> X-Mailer: git-send-email 2.22.1 In-Reply-To: <20210424160016.15200-1-imp@bsdimp.com> References: <20210424160016.15200-1-imp@bsdimp.com> MIME-Version: 1.0 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: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kevans@freebsd.org, arichardson@freebsd.org, Warner Losh Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Warner Losh Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/strace.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bsd-user/strace.c b/bsd-user/strace.c index e4153fd0a1..aa4ab8cee7 100644 --- a/bsd-user/strace.c +++ b/bsd-user/strace.c @@ -159,8 +159,10 @@ static void print_syscall(int num, const struct syscallname *scnames, scnames[i].call(&scnames[i], arg1, arg2, arg3, arg4, arg5, arg6); } else { - /* XXX: this format system is broken because it uses - host types and host pointers for strings */ + /* + * XXX: this format system is broken because it uses host types + * and host pointers for strings + */ if (scnames[i].format != NULL) { format = scnames[i].format; } From patchwork Sat Apr 24 16:00:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1469982 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=bsdimp-com.20150623.gappssmtp.com header.i=@bsdimp-com.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=oTBeHnaP; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FSH0k0csgz9sTD for ; Sun, 25 Apr 2021 02:38:46 +1000 (AEST) Received: from localhost ([::1]:58876 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1laLIq-0000Ek-3p for incoming@patchwork.ozlabs.org; Sat, 24 Apr 2021 12:38:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50674) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1laKik-0005sb-MN for qemu-devel@nongnu.org; Sat, 24 Apr 2021 12:01:26 -0400 Received: from mail-io1-xd2c.google.com ([2607:f8b0:4864:20::d2c]:45000) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1laKiO-0004Ld-Bx for qemu-devel@nongnu.org; Sat, 24 Apr 2021 12:01:26 -0400 Received: by mail-io1-xd2c.google.com with SMTP id p8so3349620iol.11 for ; Sat, 24 Apr 2021 09:01:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=VAS9sE+mTu7+251DSMTeCpBzI+coYUq4leMgoBBIuEY=; b=oTBeHnaP/CFvCgvkZSrveJDjkt4D6ZfB8Ke4u0hFh1fb9nc4yw0FWlQiCzFv5APUwL EGNKaopckFUGa5geAKZ8rz4JN4KYFUnbEcBJkfzmOUnFmC5kCeOj8Q0iviQugaxqdfZg 1xkrvdKSWqPnN3qFHhUDONISK6jJLvGcT9EuR1hQ/aENKXuVObCN1mkX84zRdn3fpoW+ VlHnX1lIz5+Oe+IaQLiSDtR+9/4JQrhKQ8mVSERoFNloRpD24UgB2rZlLSJMYh+Q8T3Y 7k14xcxIe+Z69WWkgwnLlMqINBfGYQNb/iXO+ouBJo6EKRpWMzIkrhu/Z3resGH2ZSIe uYIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=VAS9sE+mTu7+251DSMTeCpBzI+coYUq4leMgoBBIuEY=; b=fby5ML4g9DdbPpJpzW9i+5qj+JgK1jeQfFhi5Aoa/W3MyEPAxc+NDxdNdas2jGX1K7 4rvwM2Ay7dOlJM3nXPQB9g/pM6X5Si+Dq5Rnc5hqwOcKl2AoSPR0p6Z+beJmzMniHJRT NomjabIyZ7elWPzyo7EQEzYkX2f0pEOiwHafsdbA4LVsB/T8fiJZZTHA7gBxluebMGQi NRFn5PlH1qLkcCPXp8ptENRju+AnBulw3kq4Xd1ocKh4VYSbJuU92RPKK7V2QQt9ASID 6p6ouazfalYLe860Fdx7ubujPJAI4EtSgeY0Zse7BSsng5jT9Vr1HKH4IuyiV4eLaoAh 0IVg== X-Gm-Message-State: AOAM530JJP1DasshI59aTQ2ivNFVyQrX22cVwBci1qhwxdb8zDm/V+kz 5g81tplZJMHNN1cZYJK36MHvJRLu05Q1DNUz X-Google-Smtp-Source: ABdhPJyPF145Gzb5I6+6mSyegzYaTgLhofANi243/P36xYTy3eqh2R4S6joZfdqnTt4gvrDhuofuGw== X-Received: by 2002:a02:c492:: with SMTP id t18mr8232719jam.59.1619280060895; Sat, 24 Apr 2021 09:01:00 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id h4sm4055901ili.52.2021.04.24.09.01.00 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 24 Apr 2021 09:01:00 -0700 (PDT) From: imp@bsdimp.com To: qemu-devel@nongnu.org Subject: [PATCH v2 41/48] bsd-user: style tweak: don't assign in if statements Date: Sat, 24 Apr 2021 10:00:09 -0600 Message-Id: <20210424160016.15200-42-imp@bsdimp.com> X-Mailer: git-send-email 2.22.1 In-Reply-To: <20210424160016.15200-1-imp@bsdimp.com> References: <20210424160016.15200-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::d2c; envelope-from=imp@bsdimp.com; helo=mail-io1-xd2c.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kevans@freebsd.org, arichardson@freebsd.org, Warner Losh Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Warner Losh Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/strace.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bsd-user/strace.c b/bsd-user/strace.c index aa4ab8cee7..94f2b59565 100644 --- a/bsd-user/strace.c +++ b/bsd-user/strace.c @@ -80,7 +80,8 @@ static void print_execve(const struct syscallname *name, abi_long arg1, if (!arg_addr) { break; } - if ((s = lock_user_string(arg_addr))) { + s = lock_user_string(arg_addr); + if (s) { gemu_log("\"%s\",", s); unlock_user(s, arg_addr, 0); } From patchwork Sat Apr 24 16:00:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1469986 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=bsdimp-com.20150623.gappssmtp.com header.i=@bsdimp-com.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=qymgdilr; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FSH906vHnz9sTD for ; Sun, 25 Apr 2021 02:45:56 +1000 (AEST) Received: from localhost ([::1]:40658 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1laLPm-0004ak-V9 for incoming@patchwork.ozlabs.org; Sat, 24 Apr 2021 12:45:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50746) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1laKio-000617-2u for qemu-devel@nongnu.org; Sat, 24 Apr 2021 12:01:30 -0400 Received: from mail-il1-x131.google.com ([2607:f8b0:4864:20::131]:42766) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1laKiO-0004Li-CA for qemu-devel@nongnu.org; Sat, 24 Apr 2021 12:01:29 -0400 Received: by mail-il1-x131.google.com with SMTP id a9so1188101ilh.9 for ; Sat, 24 Apr 2021 09:01:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=AW8Ml+/YNE+c65+lgJayPesQmaT8Aad6d4PcEHSzYQw=; b=qymgdilrpWDdF3GlMGmvOz+KUUAZKhjcLItWxt4m4zHbSE/vRpvdx48BxUHZnV7uB+ cLJPvgSTrYhIi8xZ4+Ze2WeY4EdEi1kLgRTYAV7flAJ/r81d/xbwff7V0WnjJlyppIKx 49oXMhpZTVGz1Ws5biigUf2xwKB/JPzymvG39f2s9ezE8SRslv5ky2xSwG7+K77ySIKH a9YtwKvkcxIaCpKlQJzKHAn+3SJqyNR5zfYdYqh2zRmpf1jDnhflaJIsMkwZCYV9FElP nAJ72PU/rpEzUeFS1ZROLNWHJhpciIs/tF+IgYzL8I5ZXzd+BndtROKL/cjpPMcQkIVp 4XrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=AW8Ml+/YNE+c65+lgJayPesQmaT8Aad6d4PcEHSzYQw=; b=fq6Ku516D8HmIpEMKcVIDfgabA5BJTqq1n2Vx+Uf4NFc6xiQQ2qMp276dR69NaXzi3 GRKij71hpecrKvWBqp93+jdCZ5+vEMpq9IR3yd9rGpxjthjB9zTsNPM1JO8yvApT708/ zPhd2dTxc0a4IdLmp9PC5wVwHEYCbI/vkCwy+20x1lOlpjhOGO1sEgqCrKAzddmyMoAE WeIlGh3eSUeo9+4fmvOPbq22ajPRFxHqU774Ewv5l141IXezArmQD7en4g7l48pbLNLu 5pXd7GO8gX8YaM6Tud52iz24qpUyX8/z7ryIkCUMJbXb0EM3pr6g5dLAtH2MxMt/V4pI 5rjA== X-Gm-Message-State: AOAM532oH3S2yqwidEJNTeXRP4JlKG9dFYD+OLMUk6kIbCLOwsx3F84A QSZVfewkk4MeiJFJiKf0bNs1aEQo4jDsQl2U X-Google-Smtp-Source: ABdhPJxpItEusyUsEoST9c3jVtymwUFhQi1cBwslOQsdKGq8HUMWulv9weAPDbAbdOlO2H5oCKQ6Vw== X-Received: by 2002:a92:d58a:: with SMTP id a10mr6980426iln.170.1619280061651; Sat, 24 Apr 2021 09:01:01 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id h4sm4055901ili.52.2021.04.24.09.01.01 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 24 Apr 2021 09:01:01 -0700 (PDT) From: imp@bsdimp.com To: qemu-devel@nongnu.org Subject: [PATCH v2 42/48] bsd-user: style tweak: spaces around operators and commas Date: Sat, 24 Apr 2021 10:00:10 -0600 Message-Id: <20210424160016.15200-43-imp@bsdimp.com> X-Mailer: git-send-email 2.22.1 In-Reply-To: <20210424160016.15200-1-imp@bsdimp.com> References: <20210424160016.15200-1-imp@bsdimp.com> MIME-Version: 1.0 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: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kevans@freebsd.org, arichardson@freebsd.org, Warner Losh Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Warner Losh Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/syscall.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/bsd-user/syscall.c b/bsd-user/syscall.c index 3352735c68..5e033e8bf4 100644 --- a/bsd-user/syscall.c +++ b/bsd-user/syscall.c @@ -77,8 +77,8 @@ static abi_long do_obreak(abi_ulong new_brk) /* We need to allocate more memory after the brk... */ new_alloc_size = HOST_PAGE_ALIGN(new_brk - brk_page + 1); mapped_addr = get_errno(target_mmap(brk_page, new_alloc_size, - PROT_READ|PROT_WRITE, - MAP_ANON|MAP_FIXED|MAP_PRIVATE, -1, 0)); + PROT_READ | PROT_WRITE, + MAP_ANON | MAP_FIXED | MAP_PRIVATE, -1, 0)); if (!is_error(mapped_addr)) target_brk = new_brk; @@ -158,7 +158,7 @@ static abi_long do_freebsd_sysarch(void *env, int op, abi_ulong parms) static int oidfmt(int *oid, int len, char *fmt, uint32_t *kind) { - int qoid[CTL_MAXNAME+2]; + int qoid[CTL_MAXNAME + 2]; uint8_t buf[BUFSIZ]; int i; size_t j; @@ -241,7 +241,7 @@ static abi_long do_freebsd_sysctl(abi_ulong namep, int32_t namelen, abi_ulong ol return -TARGET_EFAULT; holdlen = oldlen; for (p = hnamep, q = snamep, i = 0; i < namelen; p++, i++) - *q++ = tswap32(*p); + *q++ = tswap32(*p); oidfmt(snamep, namelen, NULL, &kind); /* XXX swap hnewp */ ret = get_errno(sysctl(snamep, namelen, holdp, &holdlen, hnewp, newlen)); @@ -271,7 +271,7 @@ static abi_long lock_iovec(int type, struct iovec *vec, abi_ulong target_addr, target_vec = lock_user(VERIFY_READ, target_addr, count * sizeof(struct target_iovec), 1); if (!target_vec) return -TARGET_EFAULT; - for (i = 0;i < count; i++) { + for (i = 0; i < count; i++) { base = tswapl(target_vec[i].iov_base); vec[i].iov_len = tswapl(target_vec[i].iov_len); if (vec[i].iov_len != 0) { @@ -283,7 +283,7 @@ static abi_long lock_iovec(int type, struct iovec *vec, abi_ulong target_addr, vec[i].iov_base = NULL; } } - unlock_user (target_vec, target_addr, 0); + unlock_user(target_vec, target_addr, 0); return 0; } @@ -297,13 +297,13 @@ static abi_long unlock_iovec(struct iovec *vec, abi_ulong target_addr, target_vec = lock_user(VERIFY_READ, target_addr, count * sizeof(struct target_iovec), 1); if (!target_vec) return -TARGET_EFAULT; - for (i = 0;i < count; i++) { + for (i = 0; i < count; i++) { if (target_vec[i].iov_base) { base = 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); + unlock_user(target_vec, target_addr, 0); return 0; } @@ -393,7 +393,7 @@ abi_long do_freebsd_syscall(void *cpu_env, int num, abi_long arg1, break; case TARGET_FREEBSD_NR_syscall: case TARGET_FREEBSD_NR___syscall: - ret = do_freebsd_syscall(cpu_env,arg1 & 0xffff,arg2,arg3,arg4,arg5,arg6,arg7,arg8,0); + ret = do_freebsd_syscall(cpu_env, arg1 & 0xffff, arg2, arg3, arg4, arg5, arg6, arg7, arg8, 0); break; default: ret = get_errno(syscall(num, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)); @@ -472,7 +472,7 @@ abi_long do_netbsd_syscall(void *cpu_env, int num, abi_long arg1, break; case TARGET_NETBSD_NR_syscall: case TARGET_NETBSD_NR___syscall: - ret = do_netbsd_syscall(cpu_env,arg1 & 0xffff,arg2,arg3,arg4,arg5,arg6,0); + ret = do_netbsd_syscall(cpu_env, arg1 & 0xffff, arg2, arg3, arg4, arg5, arg6, 0); break; default: ret = syscall(num, arg1, arg2, arg3, arg4, arg5, arg6); @@ -551,7 +551,7 @@ abi_long do_openbsd_syscall(void *cpu_env, int num, abi_long arg1, break; case TARGET_OPENBSD_NR_syscall: case TARGET_OPENBSD_NR___syscall: - ret = do_openbsd_syscall(cpu_env,arg1 & 0xffff,arg2,arg3,arg4,arg5,arg6,0); + ret = do_openbsd_syscall(cpu_env, arg1 & 0xffff, arg2, arg3, arg4, arg5, arg6, 0); break; default: ret = syscall(num, arg1, arg2, arg3, arg4, arg5, arg6); From patchwork Sat Apr 24 16:00:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1469980 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=bsdimp-com.20150623.gappssmtp.com header.i=@bsdimp-com.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=Tv+nvPoy; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FSGxx56rZz9sTD for ; Sun, 25 Apr 2021 02:36:21 +1000 (AEST) Received: from localhost ([::1]:53038 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1laLGV-0006A9-Ol for incoming@patchwork.ozlabs.org; Sat, 24 Apr 2021 12:36:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50710) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1laKil-0005wL-V7 for qemu-devel@nongnu.org; Sat, 24 Apr 2021 12:01:27 -0400 Received: from mail-io1-xd2f.google.com ([2607:f8b0:4864:20::d2f]:36832) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1laKiO-0004Ln-P0 for qemu-devel@nongnu.org; Sat, 24 Apr 2021 12:01:27 -0400 Received: by mail-io1-xd2f.google.com with SMTP id g125so3395578iof.3 for ; Sat, 24 Apr 2021 09:01:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=IGhuygBexU6sDyrgbBDXbEgL9owYCnZh70/eHV+xwYk=; b=Tv+nvPoyyptTH6QTahYmGYMu6TJ4EjFIx60HwIRagdYyAaDpoNtC7zIkYwKpOoyra9 jE8ydzl1TggEizQcsBoyQu8RzZk0xyEbpkcAyBsPFsXlm5iZ/tvBNTKg9s6Xt8tGtZUv NwH9GXN6nUhtobdfXTDmUASIdSrWyKE7099CTNW0rohg6SMagIAsCDsZSpFjE9M6kUmW O21cDuS6v+jYtq8Ul5KaOJYtiCx5KHJtglSbj700pfKDn4XNPCjrskn1eBHi80G6vMcm +ppxDW+qXspHDawFjVg7PJ6s8KzQWa/vJ62vrEwY1Buy5Gn0Kld7QEa3fuyh5NK+k7EJ 6I4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=IGhuygBexU6sDyrgbBDXbEgL9owYCnZh70/eHV+xwYk=; b=blIWq/KmXY/Y0U8Iev3osOg5URYureA/HgoMc2jLcS47laVOnNd+Zhar6oA59k6KFA coXno9QaK64USKYuUsPRyk59Bs3ILvOAJnXgLmoj3oP6vvK2nCEU/qiNzA95rdH9ZUa7 M6etttjzBdWLjqGMugo+5/yDRUq3Jet9f5tBLsIQkIFJGWN2kusjfyBf1Kj93t/u638U 0ZaA6SCjdbAJF+MtR4kY0NdoFVefBZQFdcFzjf3fL2nQoAQLUTdlzcPhFCuLik2xN9oH FOiBSNZdQEM4rsk+u3EOv/PbSTvaxMNAkv2Qp9+cIRwXbNnaqYXdTWLRhkvk7rQ6UNnm IpCg== X-Gm-Message-State: AOAM532sNS7hoCjyn2eNseiIzEDDwSkOLd6vYDwGUg9ZyQvqZZfKJQCy u3Nc/1SFDuB47tRvHlNBfZ4gYVc0VKptyhFD X-Google-Smtp-Source: ABdhPJzGbw8cvneBiQkxvLiyqYNp9e2ha7dSk4gWYXKaBxI7CqpRKc76kdOorD/XrZreLh5EpKucQA== X-Received: by 2002:a05:6638:3293:: with SMTP id f19mr8616995jav.0.1619280062522; Sat, 24 Apr 2021 09:01:02 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id h4sm4055901ili.52.2021.04.24.09.01.01 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 24 Apr 2021 09:01:02 -0700 (PDT) From: imp@bsdimp.com To: qemu-devel@nongnu.org Subject: [PATCH v2 43/48] bsd-user: style tweak: fold long lines Date: Sat, 24 Apr 2021 10:00:11 -0600 Message-Id: <20210424160016.15200-44-imp@bsdimp.com> X-Mailer: git-send-email 2.22.1 In-Reply-To: <20210424160016.15200-1-imp@bsdimp.com> References: <20210424160016.15200-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::d2f; envelope-from=imp@bsdimp.com; helo=mail-io1-xd2f.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kevans@freebsd.org, arichardson@freebsd.org, Warner Losh Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Warner Losh Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/syscall.c | 40 +++++++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/bsd-user/syscall.c b/bsd-user/syscall.c index 5e033e8bf4..46c0e29841 100644 --- a/bsd-user/syscall.c +++ b/bsd-user/syscall.c @@ -28,8 +28,6 @@ #include "qemu-common.h" #include "user/syscall-trace.h" -//#define DEBUG - static abi_ulong target_brk; static abi_ulong target_original_brk; @@ -78,7 +76,8 @@ static abi_long do_obreak(abi_ulong new_brk) new_alloc_size = HOST_PAGE_ALIGN(new_brk - brk_page + 1); mapped_addr = get_errno(target_mmap(brk_page, new_alloc_size, PROT_READ | PROT_WRITE, - MAP_ANON | MAP_FIXED | MAP_PRIVATE, -1, 0)); + MAP_ANON | MAP_FIXED | MAP_PRIVATE, + -1, 0)); if (!is_error(mapped_addr)) target_brk = new_brk; @@ -221,8 +220,9 @@ static int sysctl_oldcvt(void *holdp, size_t holdlen, uint32_t kind) } /* XXX this needs to be emulated on non-FreeBSD hosts... */ -static abi_long do_freebsd_sysctl(abi_ulong namep, int32_t namelen, abi_ulong oldp, - abi_ulong oldlenp, abi_ulong newp, abi_ulong newlen) +static abi_long do_freebsd_sysctl(abi_ulong namep, int32_t namelen, + abi_ulong oldp, abi_ulong oldlenp, + abi_ulong newp, abi_ulong newlen) { abi_long ret; void *hnamep, *holdp, *hnewp = NULL; @@ -268,7 +268,8 @@ static abi_long lock_iovec(int type, struct iovec *vec, abi_ulong target_addr, abi_ulong base; int i; - target_vec = lock_user(VERIFY_READ, target_addr, count * sizeof(struct target_iovec), 1); + target_vec = lock_user(VERIFY_READ, target_addr, + count * sizeof(struct target_iovec), 1); if (!target_vec) return -TARGET_EFAULT; for (i = 0; i < count; i++) { @@ -294,7 +295,8 @@ static abi_long unlock_iovec(struct iovec *vec, abi_ulong target_addr, abi_ulong base; int i; - target_vec = lock_user(VERIFY_READ, target_addr, count * sizeof(struct target_iovec), 1); + target_vec = lock_user(VERIFY_READ, target_addr, + count * sizeof(struct target_iovec), 1); if (!target_vec) return -TARGET_EFAULT; for (i = 0; i < count; i++) { @@ -373,7 +375,8 @@ abi_long do_freebsd_syscall(void *cpu_env, int num, abi_long arg1, break; case TARGET_FREEBSD_NR_mmap: ret = get_errno(target_mmap(arg1, arg2, arg3, - target_to_host_bitmask(arg4, mmap_flags_tbl), + target_to_host_bitmask(arg4, + mmap_flags_tbl), arg5, arg6)); break; @@ -393,10 +396,12 @@ abi_long do_freebsd_syscall(void *cpu_env, int num, abi_long arg1, break; case TARGET_FREEBSD_NR_syscall: case TARGET_FREEBSD_NR___syscall: - ret = do_freebsd_syscall(cpu_env, arg1 & 0xffff, arg2, arg3, arg4, arg5, arg6, arg7, arg8, 0); + ret = do_freebsd_syscall(cpu_env, arg1 & 0xffff, arg2, arg3, arg4, + arg5, arg6, arg7, arg8, 0); break; default: - ret = get_errno(syscall(num, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)); + ret = get_errno(syscall(num, arg1, arg2, arg3, arg4, arg5, arg6, + arg7, arg8)); break; } fail: @@ -463,7 +468,8 @@ abi_long do_netbsd_syscall(void *cpu_env, int num, abi_long arg1, break; case TARGET_NETBSD_NR_mmap: ret = get_errno(target_mmap(arg1, arg2, arg3, - target_to_host_bitmask(arg4, mmap_flags_tbl), + target_to_host_bitmask(arg4, + mmap_flags_tbl), arg5, arg6)); break; @@ -472,7 +478,8 @@ abi_long do_netbsd_syscall(void *cpu_env, int num, abi_long arg1, break; case TARGET_NETBSD_NR_syscall: case TARGET_NETBSD_NR___syscall: - ret = do_netbsd_syscall(cpu_env, arg1 & 0xffff, arg2, arg3, arg4, arg5, arg6, 0); + ret = do_netbsd_syscall(cpu_env, arg1 & 0xffff, arg2, arg3, arg4, arg5, + arg6, 0); break; default: ret = syscall(num, arg1, arg2, arg3, arg4, arg5, arg6); @@ -536,13 +543,15 @@ abi_long do_openbsd_syscall(void *cpu_env, int num, abi_long arg1, if (!(p = lock_user_string(arg1))) goto efault; ret = get_errno(open(path(p), - target_to_host_bitmask(arg2, fcntl_flags_tbl), + target_to_host_bitmask(arg2, + fcntl_flags_tbl), arg3)); unlock_user(p, arg1, 0); break; case TARGET_OPENBSD_NR_mmap: ret = get_errno(target_mmap(arg1, arg2, arg3, - target_to_host_bitmask(arg4, mmap_flags_tbl), + target_to_host_bitmask(arg4, + mmap_flags_tbl), arg5, arg6)); break; @@ -551,7 +560,8 @@ abi_long do_openbsd_syscall(void *cpu_env, int num, abi_long arg1, break; case TARGET_OPENBSD_NR_syscall: case TARGET_OPENBSD_NR___syscall: - ret = do_openbsd_syscall(cpu_env, arg1 & 0xffff, arg2, arg3, arg4, arg5, arg6, 0); + ret = do_openbsd_syscall(cpu_env, arg1 & 0xffff, arg2, arg3, arg4, + arg5, arg6, 0); break; default: ret = syscall(num, arg1, arg2, arg3, arg4, arg5, arg6); From patchwork Sat Apr 24 16:00:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1469984 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=bsdimp-com.20150623.gappssmtp.com header.i=@bsdimp-com.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=oKQh7Lp2; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FSH3N5KrNz9sTD for ; Sun, 25 Apr 2021 02:41:04 +1000 (AEST) Received: from localhost ([::1]:34776 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1laLL4-00023s-PQ for incoming@patchwork.ozlabs.org; Sat, 24 Apr 2021 12:41:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50712) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1laKim-0005xt-Mi for qemu-devel@nongnu.org; Sat, 24 Apr 2021 12:01:28 -0400 Received: from mail-il1-x12b.google.com ([2607:f8b0:4864:20::12b]:34575) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1laKiQ-0004Lr-UC for qemu-devel@nongnu.org; Sat, 24 Apr 2021 12:01:28 -0400 Received: by mail-il1-x12b.google.com with SMTP id c15so43209051ilj.1 for ; Sat, 24 Apr 2021 09:01:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Z1e34V6vsrnu+DKXQalAPcoojfgzLqn0cNN6qHP4kck=; b=oKQh7Lp2saTxRqCvLO/jZAzhWT1yYaVancplepCrnmKNiNtsVQza7W/h467qhLWvKy 11x0zEj8l0vhlLSvQPNVO4Lzn1mSmgEUfIO2RP1uwxjBSkqSAe60uTbxqLnl/kCiWl8C z7GdgoQuUJ6znf73bYNN2WyoEYZ/40MMo5O22Kr1rjnUV8mLas8N8JTz/giQQnL35gew sShdmFs8+yb14PCeUBL7uC34d0+pUd2Hu8LaC5bCLfcGmshbYv2PSbaR42Lex7DlqEUd ew4eifPJ9nf5QQrSAO9SzKe7M1cR2+T5s8tTAZwCcWEoVB88dazvsRUSS0AvHSwmLxoS dDeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Z1e34V6vsrnu+DKXQalAPcoojfgzLqn0cNN6qHP4kck=; b=RUqblTQAwdOEuKpSkhbQuVVxIWbRi4aj7V/a1JfNbf0MAwY7nYsk8mYH4jBHR+9NDv 06THNR08yckQd5QZkH9Ts3QGIdSW7uhxzNTKVj88Spu++nuxORxa1YR9U9f/Wws4/KqK qorbvNf5fgCmMuXMo/jJ7SsKTQKVvfWgOoFKCIlx+21n7jre0Rz1jfsgybg3f/7fI86s YhygwzDZncAc5Fl6oM6fmmaO0xN+h/GtNmrEv4JFjWr1dVEZhqHf3kuTfn05c9vhS1Jm d2TmPYWZQsJT0mJrT7SYz5BQw4y6ZVQNS5zxtRF5wB8/St/tvsE+JjeqxMTueJXaMEp/ zxZA== X-Gm-Message-State: AOAM531bWknDprEik+/yupOtRz+AiWnPWVO52isugBO3DJSGIQ9FizTg CtwlIhSzcRZjPtvUqzehQc5tBKYIQRx1sLS1 X-Google-Smtp-Source: ABdhPJyUfW6dWuF82ae2bAF1pZKpwX33+xt5Ldd+wmQO55ZRO6L8Q8TlwvaCUG1VQN+OuSVPqywaOQ== X-Received: by 2002:a05:6e02:48b:: with SMTP id b11mr7157096ils.245.1619280063281; Sat, 24 Apr 2021 09:01:03 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id h4sm4055901ili.52.2021.04.24.09.01.02 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 24 Apr 2021 09:01:02 -0700 (PDT) From: imp@bsdimp.com To: qemu-devel@nongnu.org Subject: [PATCH v2 44/48] bsd-user: style tweak: use preferred block comments Date: Sat, 24 Apr 2021 10:00:12 -0600 Message-Id: <20210424160016.15200-45-imp@bsdimp.com> X-Mailer: git-send-email 2.22.1 In-Reply-To: <20210424160016.15200-1-imp@bsdimp.com> References: <20210424160016.15200-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::12b; envelope-from=imp@bsdimp.com; helo=mail-il1-x12b.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kevans@freebsd.org, arichardson@freebsd.org, Warner Losh Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Warner Losh Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/syscall.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/bsd-user/syscall.c b/bsd-user/syscall.c index 46c0e29841..fbe3b3b2fe 100644 --- a/bsd-user/syscall.c +++ b/bsd-user/syscall.c @@ -140,8 +140,8 @@ static abi_long do_freebsd_sysarch(CPUX86State *env, int op, abi_ulong parms) #ifdef TARGET_SPARC static abi_long do_freebsd_sysarch(void *env, int op, abi_ulong parms) { - /* XXX handle - * TARGET_FREEBSD_SPARC_UTRAP_INSTALL, + /* + * XXX handle TARGET_FREEBSD_SPARC_UTRAP_INSTALL, * TARGET_FREEBSD_SPARC_SIGTRAMP_INSTALL */ return -TARGET_EINVAL; @@ -257,7 +257,8 @@ static abi_long do_freebsd_sysctl(abi_ulong namep, int32_t namelen, } #endif -/* FIXME +/* + * 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. */ @@ -277,8 +278,10 @@ static abi_long lock_iovec(int type, struct iovec *vec, abi_ulong target_addr, vec[i].iov_len = tswapl(target_vec[i].iov_len); if (vec[i].iov_len != 0) { vec[i].iov_base = 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. */ + /* + * 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 = NULL; @@ -310,9 +313,11 @@ static abi_long unlock_iovec(struct iovec *vec, abi_ulong target_addr, 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_. */ +/* + * 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, From patchwork Sat Apr 24 16:00:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1469989 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=bsdimp-com.20150623.gappssmtp.com header.i=@bsdimp-com.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=u+4OawJl; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FSHFD6sVjz9sTD for ; Sun, 25 Apr 2021 02:49:36 +1000 (AEST) Received: from localhost ([::1]:49462 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1laLTK-0008Gf-J3 for incoming@patchwork.ozlabs.org; Sat, 24 Apr 2021 12:49:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50788) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1laKip-00064s-FM for qemu-devel@nongnu.org; Sat, 24 Apr 2021 12:01:31 -0400 Received: from mail-il1-x132.google.com ([2607:f8b0:4864:20::132]:39674) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1laKiS-0004Lv-VT for qemu-devel@nongnu.org; Sat, 24 Apr 2021 12:01:31 -0400 Received: by mail-il1-x132.google.com with SMTP id b17so43160962ilh.6 for ; Sat, 24 Apr 2021 09:01:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=W0Kb819q+mXdmsjSgnvN1FJvqrihYP2dk/lhl4G+fRg=; b=u+4OawJl5IOpTzkcZhkrDxcNTjjbqzx2VUNqpl7l5pcIRTt567yJV3LfG4E5KMPocS xESBOukOcYKr5/tJ0CxAziSKIWUbq/Mau8UGFnEwWGT05G/mKM4YDsrHS0flW+6TYJI4 2sgNtuTuVV4F6122e9A9o7P2/mj/037qACktoTwymXjeHS1ilEB35NG0jv4+U6f3h6AE ECyVtHlqgoNhKKbZyJuI3xRr2TLkorje6zFmuESuyLxYUki2Ehl/psN+0+iEeioWctq/ hJH7Q+2jlAIBdfxVadLJvcUh0MCCS7Y0nfPeJhXvLi2EPnEPqhFR+TtQ2w1p5THdlEjs OpCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=W0Kb819q+mXdmsjSgnvN1FJvqrihYP2dk/lhl4G+fRg=; b=siM9DB7C681o4Gd9fg0iWg6ZxPzNWV7txZ9Oe+C9PsM6PYVmITF7JN15UJlGEGmQ7k SizN2pUZ/2jGYNoJ/yPgBwCaWK8EMpkpj8lq8oFJNBj1YL84cyZbshrPz+RBOyNVvmGa Dyl5AXdMLy+Jqb7aWQfNaNOkqrN1Na9KFsSox5tzxlwyhHI5ar9ClyTgnH3MGD2KjdtA hAP93dBCn8X7T5I6u4qeugtjYL32oxVgdCNUwqmb9F13SX0jiUegt3L4oClo4ve+whs5 Da2lKLXJrrQvcvgf93lMzrf9llEFRxe1kdn+WtC2M5ZTYTwh2WhK+OELvMnKKbzSNuPn ALWw== X-Gm-Message-State: AOAM531KPZ1i86p1fUkOYpMunIGhMxoL23yXzeeqcd0NKNI9FOsMIQjs v2rJEHMfTJisD/hc5rrAzbuCcw3wsH6B1Pt0 X-Google-Smtp-Source: ABdhPJy7RESc5b9iknABa+tddrzkwS+gJQH2rnYGC+3ze7X+N+c59qlqzpnGU4Xq5zkmZ9gNOUrLzA== X-Received: by 2002:a92:3644:: with SMTP id d4mr7387092ilf.53.1619280064126; Sat, 24 Apr 2021 09:01:04 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id h4sm4055901ili.52.2021.04.24.09.01.03 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 24 Apr 2021 09:01:03 -0700 (PDT) From: imp@bsdimp.com To: qemu-devel@nongnu.org Subject: [PATCH v2 45/48] bsd-user: style tweak: Use preferred {} in if/else statements. Date: Sat, 24 Apr 2021 10:00:13 -0600 Message-Id: <20210424160016.15200-46-imp@bsdimp.com> X-Mailer: git-send-email 2.22.1 In-Reply-To: <20210424160016.15200-1-imp@bsdimp.com> References: <20210424160016.15200-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::132; envelope-from=imp@bsdimp.com; helo=mail-il1-x132.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kevans@freebsd.org, arichardson@freebsd.org, Warner Losh Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Warner Losh Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/syscall.c | 120 +++++++++++++++++++++++++++++---------------- 1 file changed, 78 insertions(+), 42 deletions(-) diff --git a/bsd-user/syscall.c b/bsd-user/syscall.c index fbe3b3b2fe..36ffa6a880 100644 --- a/bsd-user/syscall.c +++ b/bsd-user/syscall.c @@ -33,11 +33,12 @@ static abi_ulong target_original_brk; static inline abi_long get_errno(abi_long ret) { - if (ret == -1) + if (ret == -1) { /* XXX need to translate host -> target errnos here */ return -(errno); - else + } else { return ret; + } } #define target_to_host_bitmask(x, tbl) (x) @@ -59,10 +60,12 @@ static abi_long do_obreak(abi_ulong new_brk) abi_long mapped_addr; int new_alloc_size; - if (!new_brk) + if (!new_brk) { return 0; - if (new_brk < target_original_brk) + } + if (new_brk < target_original_brk) { return -TARGET_EINVAL; + } brk_page = HOST_PAGE_ALIGN(target_brk); @@ -79,10 +82,11 @@ static abi_long do_obreak(abi_ulong new_brk) MAP_ANON | MAP_FIXED | MAP_PRIVATE, -1, 0)); - if (!is_error(mapped_addr)) + if (!is_error(mapped_addr)) { target_brk = new_brk; - else + } else { return mapped_addr; + } return 0; } @@ -98,35 +102,39 @@ static abi_long do_freebsd_sysarch(CPUX86State *env, int op, abi_ulong parms) #ifdef TARGET_ABI32 case TARGET_FREEBSD_I386_SET_GSBASE: case TARGET_FREEBSD_I386_SET_FSBASE: - if (op == TARGET_FREEBSD_I386_SET_GSBASE) + if (op == TARGET_FREEBSD_I386_SET_GSBASE) { #else case TARGET_FREEBSD_AMD64_SET_GSBASE: case TARGET_FREEBSD_AMD64_SET_FSBASE: - if (op == TARGET_FREEBSD_AMD64_SET_GSBASE) + if (op == TARGET_FREEBSD_AMD64_SET_GSBASE) { #endif idx = R_GS; - else + } else { idx = R_FS; - if (get_user(val, parms, abi_ulong)) + } + if (get_user(val, parms, abi_ulong)) { return -TARGET_EFAULT; + } cpu_x86_load_seg(env, idx, 0); env->segs[idx].base = val; break; #ifdef TARGET_ABI32 case TARGET_FREEBSD_I386_GET_GSBASE: case TARGET_FREEBSD_I386_GET_FSBASE: - if (op == TARGET_FREEBSD_I386_GET_GSBASE) + if (op == TARGET_FREEBSD_I386_GET_GSBASE) { #else case TARGET_FREEBSD_AMD64_GET_GSBASE: case TARGET_FREEBSD_AMD64_GET_FSBASE: - if (op == TARGET_FREEBSD_AMD64_GET_GSBASE) + if (op == TARGET_FREEBSD_AMD64_GET_GSBASE) { #endif idx = R_GS; - else + } else { idx = R_FS; + } val = env->segs[idx].base; - if (put_user(val, parms, abi_ulong)) + if (put_user(val, parms, abi_ulong)) { return -TARGET_EFAULT; + } break; /* XXX handle the others... */ default: @@ -168,14 +176,17 @@ oidfmt(int *oid, int len, char *fmt, uint32_t *kind) j = sizeof(buf); i = sysctl(qoid, len + 2, buf, &j, 0, 0); - if (i) + if (i) { return i; + } - if (kind) + if (kind) { *kind = *(uint32_t *)buf; + } - if (fmt) + if (fmt) { strcpy(fmt, (char *)(buf + sizeof(uint32_t))); + } return (0); } @@ -231,27 +242,34 @@ static abi_long do_freebsd_sysctl(abi_ulong namep, int32_t namelen, int32_t *snamep = g_malloc(sizeof(int32_t) * namelen), *p, *q, i; uint32_t kind = 0; - if (oldlenp) + if (oldlenp) { get_user_ual(oldlen, oldlenp); - if (!(hnamep = lock_user(VERIFY_READ, namep, namelen, 1))) + } + if (!(hnamep = lock_user(VERIFY_READ, namep, namelen, 1))) { return -TARGET_EFAULT; - if (newp && !(hnewp = lock_user(VERIFY_READ, newp, newlen, 1))) + } + if (newp && !(hnewp = lock_user(VERIFY_READ, newp, newlen, 1))) { return -TARGET_EFAULT; - if (!(holdp = lock_user(VERIFY_WRITE, oldp, oldlen, 0))) + } + if (!(holdp = lock_user(VERIFY_WRITE, oldp, oldlen, 0))) { return -TARGET_EFAULT; + } holdlen = oldlen; - for (p = hnamep, q = snamep, i = 0; i < namelen; p++, i++) + for (p = hnamep, q = snamep, i = 0; i < namelen; p++, i++) { *q++ = tswap32(*p); + } oidfmt(snamep, namelen, NULL, &kind); /* XXX swap hnewp */ ret = get_errno(sysctl(snamep, namelen, holdp, &holdlen, hnewp, newlen)); - if (!ret) + if (!ret) { sysctl_oldcvt(holdp, holdlen, kind); + } put_user_ual(holdlen, oldlenp); unlock_user(hnamep, namep, 0); unlock_user(holdp, oldp, holdlen); - if (hnewp) + if (hnewp) { unlock_user(hnewp, newp, 0); + } g_free(snamep); return ret; } @@ -271,8 +289,9 @@ static abi_long lock_iovec(int type, struct iovec *vec, abi_ulong target_addr, target_vec = lock_user(VERIFY_READ, target_addr, count * sizeof(struct target_iovec), 1); - if (!target_vec) + if (!target_vec) { return -TARGET_EFAULT; + } for (i = 0; i < count; i++) { base = tswapl(target_vec[i].iov_base); vec[i].iov_len = tswapl(target_vec[i].iov_len); @@ -300,8 +319,9 @@ static abi_long unlock_iovec(struct iovec *vec, abi_ulong target_addr, target_vec = lock_user(VERIFY_READ, target_addr, count * sizeof(struct target_iovec), 1); - if (!target_vec) + if (!target_vec) { return -TARGET_EFAULT; + } for (i = 0; i < count; i++) { if (target_vec[i].iov_base) { base = tswapl(target_vec[i].iov_base); @@ -332,8 +352,9 @@ abi_long do_freebsd_syscall(void *cpu_env, int num, abi_long arg1, #endif record_syscall_start(cpu, num, arg1, arg2, arg3, arg4, arg5, arg6, 0, 0); - if (do_strace) + if (do_strace) { print_freebsd_syscall(num, arg1, arg2, arg3, arg4, arg5, arg6); + } switch (num) { case TARGET_FREEBSD_NR_exit: @@ -347,14 +368,16 @@ abi_long do_freebsd_syscall(void *cpu_env, int num, abi_long arg1, ret = 0; /* avoid warning */ break; case TARGET_FREEBSD_NR_read: - if (!(p = lock_user(VERIFY_WRITE, arg2, arg3, 0))) + if (!(p = lock_user(VERIFY_WRITE, arg2, arg3, 0))) { goto efault; + } ret = get_errno(read(arg1, p, arg3)); unlock_user(p, arg2, ret); break; case TARGET_FREEBSD_NR_write: - if (!(p = lock_user(VERIFY_READ, arg2, arg3, 1))) + if (!(p = lock_user(VERIFY_READ, arg2, arg3, 1))) { goto efault; + } ret = get_errno(write(arg1, p, arg3)); unlock_user(p, arg2, 0); break; @@ -364,15 +387,17 @@ abi_long do_freebsd_syscall(void *cpu_env, int num, abi_long arg1, struct iovec *vec; vec = alloca(count * sizeof(struct iovec)); - if (lock_iovec(VERIFY_READ, vec, arg2, count, 1) < 0) + if (lock_iovec(VERIFY_READ, vec, arg2, count, 1) < 0) { goto efault; + } ret = get_errno(writev(arg1, vec, count)); unlock_iovec(vec, arg2, count, 0); } break; case TARGET_FREEBSD_NR_open: - if (!(p = lock_user_string(arg1))) + if (!(p = lock_user_string(arg1))) { goto efault; + } ret = get_errno(open(path(p), target_to_host_bitmask(arg2, fcntl_flags_tbl), arg3)); @@ -413,8 +438,9 @@ abi_long do_freebsd_syscall(void *cpu_env, int num, abi_long arg1, #ifdef DEBUG gemu_log(" = %ld\n", ret); #endif - if (do_strace) + if (do_strace) { print_freebsd_syscall_ret(num, ret); + } record_syscall_return(cpu, num, ret); return ret; @@ -437,8 +463,9 @@ abi_long do_netbsd_syscall(void *cpu_env, int num, abi_long arg1, record_syscall_start(cpu, num, arg1, arg2, arg3, arg4, arg5, arg6, 0, 0); - if (do_strace) + if (do_strace) { print_netbsd_syscall(num, arg1, arg2, arg3, arg4, arg5, arg6); + } switch (num) { case TARGET_NETBSD_NR_exit: @@ -452,20 +479,23 @@ abi_long do_netbsd_syscall(void *cpu_env, int num, abi_long arg1, ret = 0; /* avoid warning */ break; case TARGET_NETBSD_NR_read: - if (!(p = lock_user(VERIFY_WRITE, arg2, arg3, 0))) + if (!(p = lock_user(VERIFY_WRITE, arg2, arg3, 0))) { goto efault; + } ret = get_errno(read(arg1, p, arg3)); unlock_user(p, arg2, ret); break; case TARGET_NETBSD_NR_write: - if (!(p = lock_user(VERIFY_READ, arg2, arg3, 1))) + if (!(p = lock_user(VERIFY_READ, arg2, arg3, 1))) { goto efault; + } ret = get_errno(write(arg1, p, arg3)); unlock_user(p, arg2, 0); break; case TARGET_NETBSD_NR_open: - if (!(p = lock_user_string(arg1))) + if (!(p = lock_user_string(arg1))) { goto efault; + } ret = get_errno(open(path(p), target_to_host_bitmask(arg2, fcntl_flags_tbl), arg3)); @@ -494,8 +524,9 @@ abi_long do_netbsd_syscall(void *cpu_env, int num, abi_long arg1, #ifdef DEBUG gemu_log(" = %ld\n", ret); #endif - if (do_strace) + if (do_strace) { print_netbsd_syscall_ret(num, ret); + } record_syscall_return(cpu, num, ret); return ret; @@ -518,8 +549,9 @@ abi_long do_openbsd_syscall(void *cpu_env, int num, abi_long arg1, record_syscall_start(cpu, num, arg1, arg2, arg3, arg4, arg5, arg6, 0, 0); - if (do_strace) + if (do_strace) { print_openbsd_syscall(num, arg1, arg2, arg3, arg4, arg5, arg6); + } switch (num) { case TARGET_OPENBSD_NR_exit: @@ -533,20 +565,23 @@ abi_long do_openbsd_syscall(void *cpu_env, int num, abi_long arg1, ret = 0; /* avoid warning */ break; case TARGET_OPENBSD_NR_read: - if (!(p = lock_user(VERIFY_WRITE, arg2, arg3, 0))) + if (!(p = lock_user(VERIFY_WRITE, arg2, arg3, 0))) { goto efault; + } ret = get_errno(read(arg1, p, arg3)); unlock_user(p, arg2, ret); break; case TARGET_OPENBSD_NR_write: - if (!(p = lock_user(VERIFY_READ, arg2, arg3, 1))) + if (!(p = lock_user(VERIFY_READ, arg2, arg3, 1))) { goto efault; + } ret = get_errno(write(arg1, p, arg3)); unlock_user(p, arg2, 0); break; case TARGET_OPENBSD_NR_open: - if (!(p = lock_user_string(arg1))) + if (!(p = lock_user_string(arg1))) { goto efault; + } ret = get_errno(open(path(p), target_to_host_bitmask(arg2, fcntl_flags_tbl), @@ -576,8 +611,9 @@ abi_long do_openbsd_syscall(void *cpu_env, int num, abi_long arg1, #ifdef DEBUG gemu_log(" = %ld\n", ret); #endif - if (do_strace) + if (do_strace) { print_openbsd_syscall_ret(num, ret); + } record_syscall_return(cpu, num, ret); return ret; From patchwork Sat Apr 24 16:00:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1469985 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=bsdimp-com.20150623.gappssmtp.com header.i=@bsdimp-com.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=psPmD5sj; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FSH7l5nR5z9sTD for ; Sun, 25 Apr 2021 02:44:51 +1000 (AEST) Received: from localhost ([::1]:39364 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1laLOj-00042T-RI for incoming@patchwork.ozlabs.org; Sat, 24 Apr 2021 12:44:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50740) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1laKin-000608-Fy for qemu-devel@nongnu.org; Sat, 24 Apr 2021 12:01:29 -0400 Received: from mail-il1-x129.google.com ([2607:f8b0:4864:20::129]:33750) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1laKiS-0004M0-PC for qemu-devel@nongnu.org; Sat, 24 Apr 2021 12:01:29 -0400 Received: by mail-il1-x129.google.com with SMTP id y10so2434341ilv.0 for ; Sat, 24 Apr 2021 09:01:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=fenm71ctA8siFXGt24gmLjyuh+TI+89yJ5yek6MtItw=; b=psPmD5sjGSC4qzzbI1B6cnAky1JzrUWfYV3sKqsIPFGfPmmh89+FdsnR9XhjWHWRcC +S+tRDFvT361PafDJOCHTGoWTlzBQJwSYR5rkJMxVzdvfpajQW2ZyHtgI7sfGJSap25V klVkRxe1+FZkTZsOnbCTCv64ESAZT/J/vbk4i5jxYwTIRjAv3GVlnGPU8brZbdIbL+fQ 5iG+UV1VboXXWIqhmr3DXGB2jsvHV53FaAk/woKw3tezI6+nhUIU1ngG615Ol+tS06UM qWL474nzYtQeckCBX2aavzvwxxVSHCAHTvpgU9yaJ767qf1wUkkRt75Illn/2F2oewbH dmwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=fenm71ctA8siFXGt24gmLjyuh+TI+89yJ5yek6MtItw=; b=RXuhs1Fknr+aigCGOkyrN9rFRbTPMUFR2HXWGn+9rWo40dKTvoiM4ltumCKyGmAomx 6a1g6tgQZ88zWqwa79Ho1aOGXXsUwiHAMyj4Kl+WJvGi1eIeSww9HwbTmlNcDWMwwSd4 J0pmW/NmaNBZN/9u/sFuMcCG+unjAHaddfk3FbmSvzd6UG2xUaAwL0F3gg2qYgx04Eil ULWcaIZYX5UYRv9mggxvBCxjku9Qrz991mj6I+O4KmamOkJg9E9ONb+/ywHNYfGxJ3vs ldRTTfiIUkyC/4UpN7fc/o9i2269PRphbTJiarfVjh5ueNCJ46FnYHkrYR8j5KO2lGE/ hY4A== X-Gm-Message-State: AOAM532sgbuyFrhCtE6wY2ifpteAMuZvHH5rFhF3fm0e0d18Fz7vDX24 8HWYaHujg8AYpQa3DBGyIbm3JDNp3QfbVIC6 X-Google-Smtp-Source: ABdhPJzzj8/WHBM993LltDxThft5gitnUtY/j0yxoR12hPtcKEO1xUqEcwGtlVxuh60jBuFm63oSig== X-Received: by 2002:a92:1304:: with SMTP id 4mr7029025ilt.126.1619280065198; Sat, 24 Apr 2021 09:01:05 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id h4sm4055901ili.52.2021.04.24.09.01.04 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 24 Apr 2021 09:01:04 -0700 (PDT) From: imp@bsdimp.com To: qemu-devel@nongnu.org Subject: [PATCH v2 46/48] bsd-user: style tweak: Return is not a function call. Date: Sat, 24 Apr 2021 10:00:14 -0600 Message-Id: <20210424160016.15200-47-imp@bsdimp.com> X-Mailer: git-send-email 2.22.1 In-Reply-To: <20210424160016.15200-1-imp@bsdimp.com> References: <20210424160016.15200-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::129; envelope-from=imp@bsdimp.com; helo=mail-il1-x129.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kevans@freebsd.org, arichardson@freebsd.org, Warner Losh Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Warner Losh Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/syscall.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bsd-user/syscall.c b/bsd-user/syscall.c index 36ffa6a880..1f6b93923c 100644 --- a/bsd-user/syscall.c +++ b/bsd-user/syscall.c @@ -187,7 +187,7 @@ oidfmt(int *oid, int len, char *fmt, uint32_t *kind) if (fmt) { strcpy(fmt, (char *)(buf + sizeof(uint32_t))); } - return (0); + return 0; } /* From patchwork Sat Apr 24 16:00:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1469954 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=bsdimp-com.20150623.gappssmtp.com header.i=@bsdimp-com.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=KQmmT9It; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FSGVn6G0nz9sW1 for ; Sun, 25 Apr 2021 02:16:17 +1000 (AEST) Received: from localhost ([::1]:50792 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1laKx5-0006yN-PI for incoming@patchwork.ozlabs.org; Sat, 24 Apr 2021 12:16:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50768) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1laKip-00063f-3J for qemu-devel@nongnu.org; Sat, 24 Apr 2021 12:01:31 -0400 Received: from mail-io1-xd31.google.com ([2607:f8b0:4864:20::d31]:40873) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1laKiT-0004M5-1t for qemu-devel@nongnu.org; Sat, 24 Apr 2021 12:01:30 -0400 Received: by mail-io1-xd31.google.com with SMTP id e186so1610808iof.7 for ; Sat, 24 Apr 2021 09:01:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=lT0iyUwum8EZCC05GDsUg7mVcpTBPEwFXTcaOzq9xxc=; b=KQmmT9ItVuV0KbjLcWsXYkRQx6OWg9YSSARRAXegwTpAhxoPDOd8QB/O4xfiVBOEHH SPEXMxppR72hMWOgDlvVZtZ+TkFj66YFuv5n88bkgGCOQ2ixZIKeRTNzYCuTl9VqWm0s 7qnW6pEoWzubq8CZteXpLqj97U2590jmgqH4/xEZiZRUZCr8zOxHcvp/2rOYRmpasoOE 5blO4cXezk/cWjdYBWacAoIM7A6PwLuoU6YqpPsBb/KfDncAfoNvWm/N6/gMnczMFCWR v6XlUKd/ZmGUtJ2LlCohaBVXSZTxIvM07zykU4fQvqcHX9t9qqGYKGzCIbi5Q0yvcny9 FjNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=lT0iyUwum8EZCC05GDsUg7mVcpTBPEwFXTcaOzq9xxc=; b=T9VNLrZcLzUi4qulJ47wKk471GWmtlRp1Bp24CU+OEVaV6NkekKC74CNvoNTGZuBcn p+CiWsCM+v+rWe0PipQ3DMVvSGIZJltwVfO9XjT0NlTwr7lD6K8tPUGMWRT0TH0vQFtf N1vteoGCmCME3pyvc41VtfYALsE4pYQx4RbEo6HYwCtyq/t5rv5HN00iA92Uwh619ZVe Maj2RZd7DZ6Q9wcIpmTtTLLDB45dh5gaONK04YL2eiI8UfsMtCHYtJazA6FSXefL7qOJ wB7xr6oLM1SRZohMsTY41Ay3oFM2N0zR85KK7NLjOxEshD/33NnOsPkKKJXV3Mw786WE plAw== X-Gm-Message-State: AOAM530c5kZwP9UfaLaKzxHRfMA0YE4ezQMpYLia7CRw0e1RYm7e20m6 FdnX6cn64u6gfu9Av2zfu4y8lDryykOq5yuf X-Google-Smtp-Source: ABdhPJzJRk/K3YdbJQjdMLYYjd/otHo41G+9uuDFiKGqI6BKYLOGwCaRFyoMkhMI3JDuzxFYm1T1DA== X-Received: by 2002:a02:a04d:: with SMTP id f13mr1994100jah.38.1619280065909; Sat, 24 Apr 2021 09:01:05 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id h4sm4055901ili.52.2021.04.24.09.01.05 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 24 Apr 2021 09:01:05 -0700 (PDT) From: imp@bsdimp.com To: qemu-devel@nongnu.org Subject: [PATCH v2 47/48] bsd-user: style tweak: don't assign in if statement. Date: Sat, 24 Apr 2021 10:00:15 -0600 Message-Id: <20210424160016.15200-48-imp@bsdimp.com> X-Mailer: git-send-email 2.22.1 In-Reply-To: <20210424160016.15200-1-imp@bsdimp.com> References: <20210424160016.15200-1-imp@bsdimp.com> MIME-Version: 1.0 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: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kevans@freebsd.org, arichardson@freebsd.org, Warner Losh Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Warner Losh Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/syscall.c | 40 +++++++++++++++++++++++++++------------- 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/bsd-user/syscall.c b/bsd-user/syscall.c index 1f6b93923c..1851311acd 100644 --- a/bsd-user/syscall.c +++ b/bsd-user/syscall.c @@ -245,13 +245,18 @@ static abi_long do_freebsd_sysctl(abi_ulong namep, int32_t namelen, if (oldlenp) { get_user_ual(oldlen, oldlenp); } - if (!(hnamep = lock_user(VERIFY_READ, namep, namelen, 1))) { + hnamep = lock_user(VERIFY_READ, namep, namelen, 1); + if (!hnamep) { return -TARGET_EFAULT; } - if (newp && !(hnewp = lock_user(VERIFY_READ, newp, newlen, 1))) { - return -TARGET_EFAULT; + if (newp) { + hnewp = lock_user(VERIFY_READ, newp, newlen, 1); + if (!hnewp) { + return -TARGET_EFAULT; + } } - if (!(holdp = lock_user(VERIFY_WRITE, oldp, oldlen, 0))) { + holdp = lock_user(VERIFY_WRITE, oldp, oldlen, 0); + if (!holdp) { return -TARGET_EFAULT; } holdlen = oldlen; @@ -368,14 +373,16 @@ abi_long do_freebsd_syscall(void *cpu_env, int num, abi_long arg1, ret = 0; /* avoid warning */ break; case TARGET_FREEBSD_NR_read: - if (!(p = lock_user(VERIFY_WRITE, arg2, arg3, 0))) { + p = lock_user(VERIFY_WRITE, arg2, arg3, 0); + if (!p) { goto efault; } ret = get_errno(read(arg1, p, arg3)); unlock_user(p, arg2, ret); break; case TARGET_FREEBSD_NR_write: - if (!(p = lock_user(VERIFY_READ, arg2, arg3, 1))) { + p = lock_user(VERIFY_READ, arg2, arg3, 1); + if (!p) { goto efault; } ret = get_errno(write(arg1, p, arg3)); @@ -395,7 +402,8 @@ abi_long do_freebsd_syscall(void *cpu_env, int num, abi_long arg1, } break; case TARGET_FREEBSD_NR_open: - if (!(p = lock_user_string(arg1))) { + p = lock_user_string(arg1); + if (!p) { goto efault; } ret = get_errno(open(path(p), @@ -479,21 +487,24 @@ abi_long do_netbsd_syscall(void *cpu_env, int num, abi_long arg1, ret = 0; /* avoid warning */ break; case TARGET_NETBSD_NR_read: - if (!(p = lock_user(VERIFY_WRITE, arg2, arg3, 0))) { + p = lock_user(VERIFY_WRITE, arg2, arg3, 0); + if (!p) { goto efault; } ret = get_errno(read(arg1, p, arg3)); unlock_user(p, arg2, ret); break; case TARGET_NETBSD_NR_write: - if (!(p = lock_user(VERIFY_READ, arg2, arg3, 1))) { + p = lock_user(VERIFY_READ, arg2, arg3, 1); + if (!p) { goto efault; } ret = get_errno(write(arg1, p, arg3)); unlock_user(p, arg2, 0); break; case TARGET_NETBSD_NR_open: - if (!(p = lock_user_string(arg1))) { + p = lock_user_string(arg1); + if (!p) { goto efault; } ret = get_errno(open(path(p), @@ -565,21 +576,24 @@ abi_long do_openbsd_syscall(void *cpu_env, int num, abi_long arg1, ret = 0; /* avoid warning */ break; case TARGET_OPENBSD_NR_read: - if (!(p = lock_user(VERIFY_WRITE, arg2, arg3, 0))) { + p = lock_user(VERIFY_WRITE, arg2, arg3, 0); + if (!p) { goto efault; } ret = get_errno(read(arg1, p, arg3)); unlock_user(p, arg2, ret); break; case TARGET_OPENBSD_NR_write: - if (!(p = lock_user(VERIFY_READ, arg2, arg3, 1))) { + p = lock_user(VERIFY_READ, arg2, arg3, 1); + if (!p) { goto efault; } ret = get_errno(write(arg1, p, arg3)); unlock_user(p, arg2, 0); break; case TARGET_OPENBSD_NR_open: - if (!(p = lock_user_string(arg1))) { + p = lock_user_string(arg1); + if (!p) { goto efault; } ret = get_errno(open(path(p), From patchwork Sat Apr 24 16:00:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1469987 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=bsdimp-com.20150623.gappssmtp.com header.i=@bsdimp-com.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=wduaOpeC; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FSHCL1VTfz9sTD for ; Sun, 25 Apr 2021 02:47:57 +1000 (AEST) Received: from localhost ([::1]:45102 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1laLRh-0006UZ-Iu for incoming@patchwork.ozlabs.org; Sat, 24 Apr 2021 12:47:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50762) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1laKip-00063U-00 for qemu-devel@nongnu.org; Sat, 24 Apr 2021 12:01:31 -0400 Received: from mail-il1-x129.google.com ([2607:f8b0:4864:20::129]:46649) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1laKiV-0004MB-7r for qemu-devel@nongnu.org; Sat, 24 Apr 2021 12:01:30 -0400 Received: by mail-il1-x129.google.com with SMTP id l19so2612938ilk.13 for ; Sat, 24 Apr 2021 09:01:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=LaNNaJI8YED5C6FCGe65g3uSHjcaTw5V2nEzlMwd5gQ=; b=wduaOpeCby0zTkaqrGv4miXNlg+bNQ7a7uMGIjGzBS4dXPLbvG2bJRBORzcbPukkH6 SvU2XLdVdUVbFTc33msHGWpg9oPG/H55oFbSpAwfnzS98vtJkr/goM5Tdmc14SdRR35K 3ZmUQkKaHW3IgGyB+NKX4XWg8v7d4+WcOr5hahQuZClPGPCsyvzG+HKrz4mRdpdAMcQi 6Td9HP8HlMiiYQj5yzCQbjn2gwYivMVLm8ZsggO7QegFnBdc1KKJqpZOi9dHaByVgslU y8XxGmJoFYObppK8M88YX5sY1E3FrPPk3RwMkjdDlN87laSXdx5oSlmwKQQBiBTv2NZF W71w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=LaNNaJI8YED5C6FCGe65g3uSHjcaTw5V2nEzlMwd5gQ=; b=KMkKnCiBAeMHgp+7AtRYOK3wAE2X/ytYPSk6CYMAWggagkJuxPD62j1CzdE0eZXgwV McXpHBXGtm78rkRAo/KWyZGeodSsGv8oF5gHgBcyydNU8cSo8AjpN+Th+IwpokFoEV4B LfyoX03upAAvq5Tcw/w1nWMc8YiSk7fpDXg6m4U9T2R7tAuAQzcW1iUQJyyxXRATLBNC qBvDDR7eULahrk9fs54g6lbmcByNM27xZHK9KA9W8um0ZWOk+SGSqWcRW+7v0vosj9ga ayXWLw/q9x/5t6GGXhyb1rns+vKC79IPmAWJ4BG4uJLyGK5TIvqv8kBzagsZj1ClumYb D1NQ== X-Gm-Message-State: AOAM530Hl3MxmByuHvl5Rf6qQNeF/FOzuCjj3bXBU3TJWJTGkW5grDj2 sbYrrfhtE4kFGDs2uFRDLfeqCxOwBc9OFjQU X-Google-Smtp-Source: ABdhPJzc5yB2vTZosjIy9N3UwwIUb8vsGtEwRDWiMTXjeGZL5GALbZ1AvkbUwDe28TEeeOOOcaLtQw== X-Received: by 2002:a05:6e02:1809:: with SMTP id a9mr7192869ilv.184.1619280066683; Sat, 24 Apr 2021 09:01:06 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id h4sm4055901ili.52.2021.04.24.09.01.05 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 24 Apr 2021 09:01:06 -0700 (PDT) From: imp@bsdimp.com To: qemu-devel@nongnu.org Subject: [PATCH v2 48/48] bsd-user: put back a break; that had gone missing... Date: Sat, 24 Apr 2021 10:00:16 -0600 Message-Id: <20210424160016.15200-49-imp@bsdimp.com> X-Mailer: git-send-email 2.22.1 In-Reply-To: <20210424160016.15200-1-imp@bsdimp.com> References: <20210424160016.15200-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::129; envelope-from=imp@bsdimp.com; helo=mail-il1-x129.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kevans@freebsd.org, arichardson@freebsd.org, Warner Losh Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Warner Losh Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/syscall.c | 1 + 1 file changed, 1 insertion(+) diff --git a/bsd-user/syscall.c b/bsd-user/syscall.c index 1851311acd..d5c3168a6d 100644 --- a/bsd-user/syscall.c +++ b/bsd-user/syscall.c @@ -209,6 +209,7 @@ static int sysctl_oldcvt(void *holdp, size_t holdlen, uint32_t kind) #else case CTLTYPE_LONG: *(uint64_t *)holdp = tswap64(*(long *)holdp); + break; case CTLTYPE_ULONG: *(uint64_t *)holdp = tswap64(*(unsigned long *)holdp); break;