From patchwork Fri Apr 23 20:39:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 12221665 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5A408C433ED for ; Fri, 23 Apr 2021 20:43:30 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id D8B8B61006 for ; Fri, 23 Apr 2021 20:43:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D8B8B61006 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bsdimp.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:46514 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1la2e8-0000ZP-RY for qemu-devel@archiver.kernel.org; Fri, 23 Apr 2021 16:43:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54350) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1la2aY-000543-M3 for qemu-devel@nongnu.org; Fri, 23 Apr 2021 16:39:46 -0400 Received: from mail-ot1-x333.google.com ([2607:f8b0:4864:20::333]:37542) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1la2aX-0007uI-15 for qemu-devel@nongnu.org; Fri, 23 Apr 2021 16:39:46 -0400 Received: by mail-ot1-x333.google.com with SMTP id c8-20020a9d78480000b0290289e9d1b7bcso32334707otm.4 for ; Fri, 23 Apr 2021 13:39: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:mime-version :content-transfer-encoding; bh=2s8vq4d/u6ExixWr3LABUBqHOg+2FqYKQ6WxdLTQB3U=; b=yduzLWhW34Sjac2zln4bKYrcC6o2//LQnrb6suPqxQh+2t8tbwY08Rd3ZOs+Oyzn7E APdZaxsYAs5ZYD8kN6AT26KihpkD48IU0zjyHczJvhWmdO/1RnfoSdFNNpQknRx0Dz3A Rm1jhDdPDu8Z344qgBbMkZ6tkgZjSVfakk7LYMnW/jI5ZPTp7F8VpAbmULdh6ZuQjNPz PZtGIrmtUlvsqF/tdQVT6BJbeylq2dUTdtmNfkVx2AeJhDNTTVxU9jUKfJCq4VBl2+lK 06gZ8cnEXeIhBonzuBYSMO4cv8NOKZmzoBB5MvgFutls+YT2t2wK4zJIlqK5FhccNp6a xEEw== 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:mime-version :content-transfer-encoding; bh=2s8vq4d/u6ExixWr3LABUBqHOg+2FqYKQ6WxdLTQB3U=; b=SjdxCZbFywZVrW4WRPy2DML4duv7cecqlRRo18GNVxfeB5w8WicCI8j+gtu0vVAQzX 7GbwLd+MzpCm2WvRBwpJw8+dXyJpuEfw2rHIMDei85FRQ5NfIk/KJeHJdfuGLNBY9etQ qNmeyRnWyYTFUwDih9UDYAIR4PLo727hFmw48SrQIcyoWDgOOgOdFRfOgFYI4WXcNfw6 8N/Dp5Rnt61kjLtsPv02Htfed7Mi2FLiyo6wJJCIbjnyRTjgi5LEqa8D5AX4AkFteTwV SzLaHBRg1ZlqJXqOaQ+xrlYn/aVdM54V7QUQsqLLyb97syQ4zc5sbpZdP/10FOoDbXXr s+Ow== X-Gm-Message-State: AOAM533AzEPX2VSsupJVbT0giIQfP6qZB7Tr92xG6RNSXWcJqUcXziGV Tm9o2V9aL4BWmTD42qSIhSyuf5DJef571n1s X-Google-Smtp-Source: ABdhPJwuSymUc1k32AwdbsNztctGgKDOVKDFPcGyjXjY/hBLrgBBdKauxaRXLK7pkoZUzBpk9D5ZSA== X-Received: by 2002:a9d:5f0c:: with SMTP id f12mr4799725oti.258.1619210383374; Fri, 23 Apr 2021 13:39: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 m127sm1511911oib.32.2021.04.23.13.39.42 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Apr 2021 13:39:42 -0700 (PDT) From: imp@bsdimp.com To: qemu-devel@nongnu.org Subject: [PULL 01/24] bsd-user: whitespace changes Date: Fri, 23 Apr 2021 14:39:27 -0600 Message-Id: <20210423203935.78225-1-imp@bsdimp.com> X-Mailer: git-send-email 2.22.1 MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::333; envelope-from=imp@bsdimp.com; helo=mail-ot1-x333.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Warner Losh keyword space paren, no space before ( in function calls, spaces around operators. Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/bsdload.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/bsd-user/bsdload.c b/bsd-user/bsdload.c index f38c4faacf..2bacae7393 100644 --- a/bsd-user/bsdload.c +++ b/bsd-user/bsdload.c @@ -24,7 +24,7 @@ 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); */ @@ -132,8 +132,8 @@ int loader_exec(const char * filename, char ** argv, char ** envp, 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: 12221657 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 38C69C433B4 for ; Fri, 23 Apr 2021 20:41:45 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 888716141C for ; Fri, 23 Apr 2021 20:41:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 888716141C Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bsdimp.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:41622 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1la2cR-00070X-Eg for qemu-devel@archiver.kernel.org; Fri, 23 Apr 2021 16:41:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54408) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1la2ab-000570-Hi for qemu-devel@nongnu.org; Fri, 23 Apr 2021 16:39:49 -0400 Received: from mail-oo1-xc32.google.com ([2607:f8b0:4864:20::c32]:33615) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1la2aY-0007uz-52 for qemu-devel@nongnu.org; Fri, 23 Apr 2021 16:39:49 -0400 Received: by mail-oo1-xc32.google.com with SMTP id i25-20020a4aa1190000b02901bbd9429832so10936325ool.0 for ; Fri, 23 Apr 2021 13:39: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=mi2RZhTENUzwxYsxYT6GJjLo6S5QScV+UqCj+9hN6UQ=; b=AxIOJgjYzjRa7ddjQmtWQ79n0Sv+RMYrK2nKSXgq098uOIaA+poCb3YamOPgLc0gyi IH5jU1qVAUHbVPE1OqdyZTLdrvJKBJfh08eRnlOSaLviRavyv1vG95H3h34xOXAYF1j1 dInFpzHLpVvYT4FYm/muCNtxNFKbiBLek4ECWxZPn6i3usOpy+WdCoyU85chGGqENDw/ MG3HTBJHSt9oJNFw9A6TuM0u4XTqnOw7vH6xZjadZqhT4tMtG9eImnPrNS7O9JMsIjbw e7fyPqtdIuMS+7fyf87uKVyxQmPx8WmEe2shVwKbu5ZKPTEbEYaihk4jQsBrot2PMnTm 47fw== 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=mi2RZhTENUzwxYsxYT6GJjLo6S5QScV+UqCj+9hN6UQ=; b=l7w9uVTtBLNUIkm8OzxDaeO217grUKcb4nQue6GkYcIpeYycbvmCujeBb9dL36QvYu hGWqUvzRt4qI3QjbyB0/q/C5wgGzmyAG5j7xtMiLgvSNPqw73sNLj1E2oQyi+QNZpL6A MXcPwtAcD8auy8Vy07e2dXycVVEGBoN9yHFyHYTd/ifHiA7ztQXWypsfP7nkEJdmfi6K PoE55LVV1/mkMpid9YM/ICGsjov06rtPBKi6FHKUj4K7WlZ3fVkW5ioFu0U1QfZD0Lto 8Bn90JaVvs8GACEgOvLubvms7bUV1E3pzb9KpZB9Fvb5kPEthU1VAvABPwEBSugxpMMq Npiw== X-Gm-Message-State: AOAM5304lWjxTujnBIsHZ6VxktxR5t5LNxVAtA8n8efmHbaOiHRSmmQ5 uXG+sZjNuO6iTv/L7GWXqUjoWeE21uKwj1yH X-Google-Smtp-Source: ABdhPJyH6dSpdetvl7Bq8Dp9nl/mKKCh8e3R1T1udfpsBm1TdMG0LQsZs3lWDuNnEsDK2yeUDCWiOQ== X-Received: by 2002:a4a:eaca:: with SMTP id s10mr4351847ooh.22.1619210384229; Fri, 23 Apr 2021 13:39: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 m127sm1511911oib.32.2021.04.23.13.39.43 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Apr 2021 13:39:43 -0700 (PDT) From: imp@bsdimp.com To: qemu-devel@nongnu.org Subject: [PULL 02/24] bsd-user: whitespace changes Date: Fri, 23 Apr 2021 14:39:28 -0600 Message-Id: <20210423203935.78225-2-imp@bsdimp.com> X-Mailer: git-send-email 2.22.1 In-Reply-To: <20210423203935.78225-1-imp@bsdimp.com> References: <20210423203935.78225-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::c32; envelope-from=imp@bsdimp.com; helo=mail-oo1-xc32.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+qemu-devel=archiver.kernel.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 Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- 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 Fri Apr 23 20:39: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: 12221655 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7FE16C433ED for ; Fri, 23 Apr 2021 20:41:21 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 04073613C1 for ; Fri, 23 Apr 2021 20:41:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 04073613C1 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bsdimp.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:41290 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1la2c4-0006sL-4f for qemu-devel@archiver.kernel.org; Fri, 23 Apr 2021 16:41:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54382) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1la2aa-00055V-52 for qemu-devel@nongnu.org; Fri, 23 Apr 2021 16:39:48 -0400 Received: from mail-ot1-x334.google.com ([2607:f8b0:4864:20::334]:43692) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1la2aY-0007v4-EG for qemu-devel@nongnu.org; Fri, 23 Apr 2021 16:39:47 -0400 Received: by mail-ot1-x334.google.com with SMTP id i26-20020a9d625a0000b02902a2119f7613so9583456otk.10 for ; Fri, 23 Apr 2021 13:39: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=rFfeE9NrqKLi2T7g5naTvNLQTZSCOawrbK1LnSvxfQI=; b=hNO9muwhvwumi2IqJ4LyGT/cfPIM5LdurQFgetc0+9/Q45rnBoxWZgnVV+ucB5BwnT l/XgLwZ2bNDrYyVJF6IppPp5cXL5Va8PfBvFC4T8cLHEZXfWSDHCZLqerUWFpQcAstvs OHSd886+s3L/p4AzUoDQd73XqdrYTMMKgvv12sGH644xExmSzV43CNP+AVn4WkXemUiR 4dSpjVTou/AfRjJBfl8ARPXzBdDsx8NnMwHcHVYzMurmpwECt5ISFPD008u8mCUJ8W7G JV6s1vvTdkWO78F+8C2XlfagpqsAP6VwNDJo0fCv8eWDsCtOtVI/QzrHcsA86FmK+gbb Dg5A== 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=rFfeE9NrqKLi2T7g5naTvNLQTZSCOawrbK1LnSvxfQI=; b=KtNhtZLRTCEwM6Qe4xyKQXrZfKfK2w6n+4J3i4722jNOu9Ol65x83tT6CMcRVFxdiH quIJnjhmBuj8z9s3Lr2D4NI4GnAAhgYKJ0S4zHGuHBVoTXy6d+rlZo7vbkdfOZU+PkpZ SacpDqDHKkAlkv5Y4V8+N/ECh2iodwf3O7Lz0alpmhT3aW2waDriJa4Cmu0Htb85sy2y jA57foH4elt/dQccIV+0bMspsFVzS1xiEeFwLxw3uN1KMfRf8REnHRlib8wZDtNc05Nt a8S0pvVJkF7wh+jm/IE5e9NAttqmx+J6a7G9e3eRlJfOHndcEcA7+WboP0jiEHNmumE7 IqXA== X-Gm-Message-State: AOAM5313yYxuCU+2aq0tsh85JJhIIhFFf6wGEVF7dIAQyWPXDA/ylicI ltoQQcBgol6Azm80qbtt3u/cNsFzLdzNazFc X-Google-Smtp-Source: ABdhPJztKdT38fcZLwUe9ze3oJxYwt8xsowd6WarIrpl+YBFRY3kZJF/FfMBtlkEGKg82pyItAY4sg== X-Received: by 2002:a9d:7a8b:: with SMTP id l11mr4930737otn.14.1619210385085; Fri, 23 Apr 2021 13:39: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 m127sm1511911oib.32.2021.04.23.13.39.44 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Apr 2021 13:39:44 -0700 (PDT) From: imp@bsdimp.com To: qemu-devel@nongnu.org Subject: [PULL 03/24] bsd-user: whitespace changes Date: Fri, 23 Apr 2021 14:39:29 -0600 Message-Id: <20210423203935.78225-3-imp@bsdimp.com> X-Mailer: git-send-email 2.22.1 In-Reply-To: <20210423203935.78225-1-imp@bsdimp.com> References: <20210423203935.78225-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::334; envelope-from=imp@bsdimp.com; helo=mail-ot1-x334.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Warner Losh Space after keywords, no space for function calls and spaces around operators. Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- 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 Fri Apr 23 20:39:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 12221673 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4714DC433ED for ; Fri, 23 Apr 2021 20:45:48 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id CA6FB61406 for ; Fri, 23 Apr 2021 20:45:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CA6FB61406 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bsdimp.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:55068 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1la2gM-00040G-T3 for qemu-devel@archiver.kernel.org; Fri, 23 Apr 2021 16:45:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54428) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1la2ac-00058R-Bb for qemu-devel@nongnu.org; Fri, 23 Apr 2021 16:39:50 -0400 Received: from mail-ot1-x329.google.com ([2607:f8b0:4864:20::329]:39470) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1la2aZ-0007vn-5Y for qemu-devel@nongnu.org; Fri, 23 Apr 2021 16:39:50 -0400 Received: by mail-ot1-x329.google.com with SMTP id 65-20020a9d03470000b02902808b4aec6dso41637628otv.6 for ; Fri, 23 Apr 2021 13:39: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=15YT+ApyZHI2KGADjA4ZvpKC21Gl1pivpnfS2CDPjro=; b=FuoLsVtvW4pduZs+iKKjKsXTrqaeaOlvlZ2GRIFgJXBOb+sVHy4INTJgQWsJCb5FoT XBSJcd4b9JDSjYJTY+ICkusNPr6nz+XD+10gLgoVYPCFb+lURmouYI2UowdehM6GjCjm D1TWVfhcP53yQOhJ/Tb3p4sFysSHq3IarzziM9SnK3nTgXrmSXlf3M6FkxoLypR1QdAr 4oeOgK5wv773qnEdYLpIa9D9D39BxfNPh6bmHEe5D72JaK8jzNR/QRlDkB6QyPVeA/pA sFZoI065VOXzHvbDB2yarlkuiydUULcgLmmUqT6LOu94xo/nUzcQz+OXvNTHIkk119lq 34mw== 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=15YT+ApyZHI2KGADjA4ZvpKC21Gl1pivpnfS2CDPjro=; b=YPfO7JfXWmcMAmzhtvJFXRitUa0EvDf1s579dsUskIXMmRD7G5e8vmWi1qzjYqFWkl wdGfg7y4JwAWecmc9y/jXNBmJnxJRE2E16tsAtKJYfJdZ943rYQbKyX0ElYk5r/qvmuD iPFbTTBu69apJzhJclKkwv4lcf5Mnb4a+WnVYaoqKiDv56Q/Zbzi/eGMEIAGgWz2I+lI CfeDj2l/9F/gMtGHA0t0HlpfDlIhUCNuiaYuKzZ/SSsvEJfr8AU32IiB+JxuvpUbbbcV ABHkefO0DXEwPiYMe35O6+lFEU8mBJukCt/1w4zYoxT5E3Vyco0zhdSRU9d96lCJTtn3 rNSQ== X-Gm-Message-State: AOAM531QCutSWJdhy1JM9rekaAOSulU3xDDkYTjF1inEWpSrS7QcrZE1 nP+iowGOdi7WjNMgD61CeUvkv9Byph+ra7Y2 X-Google-Smtp-Source: ABdhPJz+G28ZbLz2wdrqtxJ1IK/et0Gu1H/a+z1xZRIuIOE1/F9ak2al9znpczGTE1mxDiMEQsB5yA== X-Received: by 2002:a9d:6483:: with SMTP id g3mr4877158otl.332.1619210385861; Fri, 23 Apr 2021 13:39: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 m127sm1511911oib.32.2021.04.23.13.39.45 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Apr 2021 13:39:45 -0700 (PDT) From: imp@bsdimp.com To: qemu-devel@nongnu.org Subject: [PULL 04/24] bsd-user: style tweak: keyword space ( Date: Fri, 23 Apr 2021 14:39:30 -0600 Message-Id: <20210423203935.78225-4-imp@bsdimp.com> X-Mailer: git-send-email 2.22.1 In-Reply-To: <20210423203935.78225-1-imp@bsdimp.com> References: <20210423203935.78225-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::329; envelope-from=imp@bsdimp.com; helo=mail-ot1-x329.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Warner Losh Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- 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 Fri Apr 23 20:39: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: 12221653 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2CA5AC433B4 for ; Fri, 23 Apr 2021 20:41:21 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id D2882613B1 for ; Fri, 23 Apr 2021 20:41:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D2882613B1 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bsdimp.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:41314 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1la2c3-0006sp-Ug for qemu-devel@archiver.kernel.org; Fri, 23 Apr 2021 16:41:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54410) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1la2ab-000576-KC for qemu-devel@nongnu.org; Fri, 23 Apr 2021 16:39:49 -0400 Received: from mail-ot1-x32b.google.com ([2607:f8b0:4864:20::32b]:39472) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1la2aZ-0007w0-Tc for qemu-devel@nongnu.org; Fri, 23 Apr 2021 16:39:49 -0400 Received: by mail-ot1-x32b.google.com with SMTP id 65-20020a9d03470000b02902808b4aec6dso41637653otv.6 for ; Fri, 23 Apr 2021 13:39: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=AAnkUc8jISOMiDfFCRCZEzuk5CxhelAHBXEwn56RXZk=; b=fMeRkeaRI4axHMRSN23/ylRTxCNFqGLD2q22Rvdctbhhix2+FyPFq3VFzCUqrUlcGV UFCynWmzmlwB+VlpWRYzYqplPpPms9o/aZn94KY6TGdOugJM+ONmSVEkgc5mhccTurAx FUSzks9aOwgoy3GTy76tw/AKluVacyeEdxgx4z/jfYZQvAsNlJYqMwDI10OiNopZOqN3 i/Ej1BFQY8KEJXZ3Rr7zw/zbjSyO5zv9Asq86PD7tk5WQthltd3J5xE+fPXWKubyPmkP PuagieHXlqkLFbRzue0TbXWYnL5LbH1pQKGhJjueKWV7oYFv+c7I1FaEZd5em0/G43er 1qYQ== 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=AAnkUc8jISOMiDfFCRCZEzuk5CxhelAHBXEwn56RXZk=; b=fTR8AYrBos5yWLzLxpdnjCinr93QaZlSinKXHAJ5iPQ/7XglH2czjPCt37oTf4nblY Vmoqq3duNFWXnGZso5wlJn84MECahjK2xCVpXJhNvXTh1tvXe29PrTqFLMfHLHQZ4+IZ ilLTCidwabSk0WA7YlwjzG14gwrkqG6jd1msH7XBNwJuwi5Jn+P+lkWel2QgDqAdbtIh nsb4kd+nLM1Jq5zNJ7Iep7tGR1Z39TBprYNla8k0uCA/PpFtdlFq8pfkhYZI4eRsfQ2w 7WX0kHqd5a6l9o3Nv6WBnmI+TQk6mknF9+wEonGjzIiITnrNHqfKWZeuL/bYlhjH1rmd Bl6w== X-Gm-Message-State: AOAM53325XEPtkb8mf37IKNwsK0f6dX+CET6G78AjeJTjZWmS4RCjClv gQS31IV2YuYlPFOrR/pnPFUqWUJggkvhuoMI X-Google-Smtp-Source: ABdhPJzO6lsSnQcekOyR5I0vGSIfEn/AxpKxoxhDwnozu6p4bIwcdS7aDJkgh9EraZpYquflmRDipg== X-Received: by 2002:a05:6830:3497:: with SMTP id c23mr4791920otu.344.1619210386682; Fri, 23 Apr 2021 13:39: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 m127sm1511911oib.32.2021.04.23.13.39.45 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Apr 2021 13:39:46 -0700 (PDT) From: imp@bsdimp.com To: qemu-devel@nongnu.org Subject: [PULL 05/24] bsd-user: style tweak: keyword space ( Date: Fri, 23 Apr 2021 14:39:31 -0600 Message-Id: <20210423203935.78225-5-imp@bsdimp.com> X-Mailer: git-send-email 2.22.1 In-Reply-To: <20210423203935.78225-1-imp@bsdimp.com> References: <20210423203935.78225-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::32b; envelope-from=imp@bsdimp.com; helo=mail-ot1-x32b.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Warner Losh Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- 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 Fri Apr 23 20:39: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: 12221669 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8FC8EC433B4 for ; Fri, 23 Apr 2021 20:44:24 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 2741461006 for ; Fri, 23 Apr 2021 20:44:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2741461006 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bsdimp.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:49824 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1la2f1-0001uO-7K for qemu-devel@archiver.kernel.org; Fri, 23 Apr 2021 16:44:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54450) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1la2ad-00059q-3v for qemu-devel@nongnu.org; Fri, 23 Apr 2021 16:39:51 -0400 Received: from mail-oi1-x22b.google.com ([2607:f8b0:4864:20::22b]:38820) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1la2aa-0007wk-UW for qemu-devel@nongnu.org; Fri, 23 Apr 2021 16:39:50 -0400 Received: by mail-oi1-x22b.google.com with SMTP id d25so12882772oij.5 for ; Fri, 23 Apr 2021 13:39: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=M4SqFhVwp+qFFjGoMhAyPxx+zzs7u3r3DJJd2CS34OQ=; b=coi/8jQ3hLer3eZ5L/nHL4R6yL4z9Lli12adcb+FgWg3ORBrhAeVgxU1G2MJUkC9Mp 3aZfAK7ctIhCjOng5DzEz55UBHojw2GPGq7H18p7NFKqFvuykpT6TCpRcbwluatmDMW2 ozgNkdx0g446Gh1bj/MLtw8mtAdK4GRRE7q3oz3zqlXk94mDAYu9QL9iXk5z6P5XnNPf 2WiLXQx+xQ9hlrECqaFr25WVCcY0jT3KfsN53X0RnRhAPaR1cXC6Jd4vtmjRMhJNCp90 lz/f5iZBujQ64xSUr/3hT2rNDN3Z+uZnSxYu8iSIHKYts+wKuDP/Z7qa4FwhYYDo0OgB XAQg== 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=M4SqFhVwp+qFFjGoMhAyPxx+zzs7u3r3DJJd2CS34OQ=; b=cInA3B2D+0KDmH/pyRPokNjrJ9wRboYj6oeu3DYx4pNpx70y7JmfD1TEr3CHyA62CN i0AgKWacuxDs2Xkyr8sJYlG+/5QIrrUsp1MW4lRxeqKyku790zbeIbrtNqB9X39KfhAG kPSTgZlWQFOI3X1JH/tVRAC8ePUUzH2zOvuRWizj1c0b5tXFwR+1Y3MpSLE5CAvf9DuE 0EYihSI37n09LaXwDduPfUghuDexDXnE4206dtstBSFFDPgnaKSrId4CU22FQrD+x7od HdJ1BQQ3zB8YIy7ajUnreiyQJpdsjDhHhmzJgRxSwXM0003OEvGCJ/spf1DlVIn6kCwT qTFA== X-Gm-Message-State: AOAM532i9+z77qENTDF1LjdatlWZPxQmS5af9r5dN6LfRR+TynK0NdDr ohXlrHmC5D5m+OXyYZbPFrZu2YV4a6jFeUem X-Google-Smtp-Source: ABdhPJyjAURax91ugIwJNh3FnVA7UQL7L+esszcpFKmOmLDa4HD6pbd7FJHZutfCEa+XqiyvRpYdQQ== X-Received: by 2002:a05:6808:58:: with SMTP id v24mr4175304oic.130.1619210387558; Fri, 23 Apr 2021 13:39: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 m127sm1511911oib.32.2021.04.23.13.39.46 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Apr 2021 13:39:47 -0700 (PDT) From: imp@bsdimp.com To: qemu-devel@nongnu.org Subject: [PULL 06/24] bsd-user: style tweak: keyword space ( Date: Fri, 23 Apr 2021 14:39:32 -0600 Message-Id: <20210423203935.78225-6-imp@bsdimp.com> X-Mailer: git-send-email 2.22.1 In-Reply-To: <20210423203935.78225-1-imp@bsdimp.com> References: <20210423203935.78225-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::22b; envelope-from=imp@bsdimp.com; helo=mail-oi1-x22b.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Warner Losh Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- 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 Fri Apr 23 20:39: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: 12221685 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9B838C433B4 for ; Fri, 23 Apr 2021 20:48:48 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 3A55B61406 for ; Fri, 23 Apr 2021 20:48:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3A55B61406 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bsdimp.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:35400 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1la2jH-0007aV-67 for qemu-devel@archiver.kernel.org; Fri, 23 Apr 2021 16:48:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54470) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1la2ae-0005CB-2T for qemu-devel@nongnu.org; Fri, 23 Apr 2021 16:39:52 -0400 Received: from mail-ot1-x331.google.com ([2607:f8b0:4864:20::331]:41836) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1la2ab-0007ww-OO for qemu-devel@nongnu.org; Fri, 23 Apr 2021 16:39:51 -0400 Received: by mail-ot1-x331.google.com with SMTP id v19-20020a0568300913b029028423b78c2dso37767552ott.8 for ; Fri, 23 Apr 2021 13:39: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=xLVqyW6QocgCtWNC8ySv5WW9ttRqlB16OaGwZGT2xJY=; b=glTYekUbDEXWawF1rhYjs/Kz5OdYut5vlLd5Zi1wqn/fXw/QtxTSOmUPR1qVJ4Ezgb qEyT6Ws/Qzn3bCYPNP58SsCEZWVFbG5hsqPgZQ0FmW4AAGtSTfqoHA88pY1gisIRccKo cyVVvNxjno4gweAWThNBnpH3ZAghqzRAmOVD2Fk1IbHJ3PGcTl04hkv3b5X2LJ69mYEW JJ0r/CeNRbkSPfgFmh11CJ3FJtMQzkSFVsej8C9up2BDN6hk7myAicnFsvQ2VRwr1Hlk pSPndWJG8QPUWx2BlxSn84oX+l035POXXTgFMnfRmeYyQy5SA+rj94PXgfBeEJXDEOft LgfQ== 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=xLVqyW6QocgCtWNC8ySv5WW9ttRqlB16OaGwZGT2xJY=; b=qfIKQcn9mLvDfbq+EIq73S+Dl23yKcdl4kQiXSNJZgbB9fSOPwCTIyazKua+LH4Z0C QawlFevnYHFywh24p9/g54/RTzxktsoK4TSg2c67ak1WtIOg8VtNKAJQPjKDS02RjCRy eHE6bGszjgOFcQ3KIfIewxymyYV2KwYSLPIlTVChw5UUufXqtv1VhActzmGLs1VSLfw5 3BOyqa4HSWigYAWk1tDy5BVh49jb00cyNV5lLYpMuBhUPuKZYDJSapRfafBorLng6W6u mZA/STw5k/P9iz0sAQM9lpsOMUCMVEeexlWEyiLGl1rGZXE9IiLW1xyPTLU9DTAT6rwJ F+0Q== X-Gm-Message-State: AOAM5323joQgeG28M8eaoMOVIzxIzHtbhYDD6YxHmERZc4Q+lSMQGxXS Vmkr3oK2HwEKSLXc8Im11GN1SS62PPobfIR1 X-Google-Smtp-Source: ABdhPJwYm/AvpGAW1koub4GpuW1+21ffFbQOKbFzSLbAK14EPFjQqM4SBL+/efBLhh7kpr0aXVJHgQ== X-Received: by 2002:a05:6830:4110:: with SMTP id w16mr4968057ott.348.1619210388376; Fri, 23 Apr 2021 13:39: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 m127sm1511911oib.32.2021.04.23.13.39.47 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Apr 2021 13:39:47 -0700 (PDT) From: imp@bsdimp.com To: qemu-devel@nongnu.org Subject: [PULL 07/24] bsd-user: style tweak: keyword space ( Date: Fri, 23 Apr 2021 14:39:33 -0600 Message-Id: <20210423203935.78225-7-imp@bsdimp.com> X-Mailer: git-send-email 2.22.1 In-Reply-To: <20210423203935.78225-1-imp@bsdimp.com> References: <20210423203935.78225-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::331; envelope-from=imp@bsdimp.com; helo=mail-ot1-x331.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Warner Losh Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- 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 Fri Apr 23 20:39: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: 12221693 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 12FC3C433B4 for ; Fri, 23 Apr 2021 20:51:13 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id A6D296144A for ; Fri, 23 Apr 2021 20:51:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A6D296144A Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bsdimp.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:43814 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1la2lb-0002a8-NA for qemu-devel@archiver.kernel.org; Fri, 23 Apr 2021 16:51:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54490) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1la2ag-0005IU-Jd for qemu-devel@nongnu.org; Fri, 23 Apr 2021 16:39:54 -0400 Received: from mail-ot1-x32b.google.com ([2607:f8b0:4864:20::32b]:34484) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1la2ac-0007yH-KX for qemu-devel@nongnu.org; Fri, 23 Apr 2021 16:39:54 -0400 Received: by mail-ot1-x32b.google.com with SMTP id k14-20020a9d7dce0000b02901b866632f29so46389411otn.1 for ; Fri, 23 Apr 2021 13:39: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=3BGZ+7tsHEG8xoaKjUuLTzOOqi2eIKPJ+v4sZivJARQ=; b=S+4uUGp7nUAUtYZu2t0wn5jMg4IrLt6elgSylMx/BD9C80GWwNp6MTU7VqEklCpFEk Is7fbaWQXpYRIjok+rItb36FpDbfyoRdbJQCc8hcNJPiY4f1CuclLmtIhbMqx8PJKjrD TXQ8YXNP9q8ePpexUbt9hXMXNtQXtJXvbnxXluxJBF60kxlRzHYrqJLiIHpE//oVJY1o jQ/iBzTzA8VqDY7GGCbI7djCM/MkGqWYgBMUYXMaCQapMD0Lgup/DmJKqBrQg6QhhpXT v2TTVfOSbV4pQkIpI4vj5OYVQ/IghmS3GHv9s10JJ7LKthHt5PaDuiIjEVv5pR5JfSCW ogXA== 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=3BGZ+7tsHEG8xoaKjUuLTzOOqi2eIKPJ+v4sZivJARQ=; b=BsmT9lvYtew8pqaU88P9FXIVV+XVDK/i/V7M+L5pKzvqxH+GP9bOGPJqn3+xSefJbX vPSpoXRXSTCi9vlmENla8vYHaWwTzPQtCNVxxZ+zcgtRsHBexxAlqBHLOogkhq9O/KC/ Od5OF68ioVaCOTCReyLoLpjXow/AiArXLUff0jEjBv6OSPP8m8hQHLdl8k+LK/tp6TkB zWdlozzHotohI6qMDmtv99KbJUIRirEPqq+4gPqb0p37uwlqsQlumD+5rIsHgND5u+pj EMV9TWnwlg9bUHioVqA3tKFRLhCIDaMiyb1SMLGtWE4DWJlKvctnOvGeMvtjqJ92NBco lVdQ== X-Gm-Message-State: AOAM532PNltew2r3ZKUmmDEEFmotns1Ge9heWvJiySGeK8Mph72p6fxN rUxzC0Wiq15qATKSf9PE5FRFh872DXsFC4jz X-Google-Smtp-Source: ABdhPJxfBnD8B09/XPCx/IkY1O07ySDS0LUr+xlIqg2wjv8Ir1aOn6P/O4ihU35WEn0aQKhK0Rh2fA== X-Received: by 2002:a05:6830:1255:: with SMTP id s21mr4776041otp.334.1619210389256; Fri, 23 Apr 2021 13:39: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 m127sm1511911oib.32.2021.04.23.13.39.48 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Apr 2021 13:39:48 -0700 (PDT) From: imp@bsdimp.com To: qemu-devel@nongnu.org Subject: [PULL 08/24] bsd-user: style tweak: use C not C++ comments Date: Fri, 23 Apr 2021 14:39:34 -0600 Message-Id: <20210423203935.78225-8-imp@bsdimp.com> X-Mailer: git-send-email 2.22.1 In-Reply-To: <20210423203935.78225-1-imp@bsdimp.com> References: <20210423203935.78225-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::32b; envelope-from=imp@bsdimp.com; helo=mail-ot1-x32b.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Warner Losh Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- 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 Fri Apr 23 20:39: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: 12221671 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 951D3C433ED for ; Fri, 23 Apr 2021 20:44:30 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 4A7E7613BE for ; Fri, 23 Apr 2021 20:44:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4A7E7613BE Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bsdimp.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:50380 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1la2f7-00027s-99 for qemu-devel@archiver.kernel.org; Fri, 23 Apr 2021 16:44:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54488) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1la2af-0005Fn-Fd for qemu-devel@nongnu.org; Fri, 23 Apr 2021 16:39:53 -0400 Received: from mail-oi1-x230.google.com ([2607:f8b0:4864:20::230]:42857) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1la2ad-0007yT-G0 for qemu-devel@nongnu.org; Fri, 23 Apr 2021 16:39:53 -0400 Received: by mail-oi1-x230.google.com with SMTP id n140so50356072oig.9 for ; Fri, 23 Apr 2021 13:39: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=N1r5gMywxPv+UStonAWMLzTWtbbS/dkPWtKuXpNHgwU=; b=K1snjMOa0EWqurvx2ZI42thSxBX0K4HitCKJUNkX8Oc8ApNiKklf/Q8R8w+MM7/p1p LzzuvljepkWp7YUosQUOFh2N7tGlNYZ0XOwCOJKPb69gK16KxKMT7Io3zr4hVmbt7LSJ pCkrXGqZMgJ8LNFu3xJKv8ZCS7Dc0FUD3NBjFIPrRqIB0yxWs3DuhAiIDL+PJGdX6joR ttw89SFoPCgiWa5qmxQ/ZlVdWQTv+eh1YQruis6ap0qE2TLDbOhkj8wZqyZ82H8GX3Nh EMK4Xi4oXXakrgga1JU8/UbG0vNQ4+bje5i/SF8foREOTNHtAj0JviLFDjyIfjbPe2BK 4v6g== 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=N1r5gMywxPv+UStonAWMLzTWtbbS/dkPWtKuXpNHgwU=; b=tYatP1suL9cOkeiKwccdEee3MBDzaYumIUlz1tB20RgxN9RSA0hGpie0yfNqfBCi+1 nm0o+LaOfvxWd6ZwFOhK4VBnGKDs65SQ7vTBl3ajz2MTheyXY7fRncXkk4sNn7yju5zn Ad/0HnfhwDwzz1pQwmLULSrZbhr9SWxzp+ctEBPRcvuB9Wx60XGi0Tz0RXyspPHrcJNK iCVEnmaUadgcCjcogD0WtrQ64I9TMsR9vryds65t4r1wUtoP0lP7CRd0aFPRMV0whUNY Ssq6hTlIV0NiPvIrtr7Gke6rp2Kkyk3gN3RrEurX7WTJAMoG4NbRgXu4l9tYXtH+A3Ne z3HA== X-Gm-Message-State: AOAM532kUbviN52DEuEtI8U+v+y0t+zSZ6zdr2NRbdb36ajMT4jJ7F5Y B2Xz/TU9vTjvfQS+frePGsf5f4pHNBDpuMuE X-Google-Smtp-Source: ABdhPJxV+wy2HeZ+PAQTOF8na6WNy6j8tQT7jlI73A8egspyQHAS8yYoOcB8zSVU+sqteRWCKXGglg== X-Received: by 2002:aca:ef84:: with SMTP id n126mr5416623oih.84.1619210390067; Fri, 23 Apr 2021 13:39:50 -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 m127sm1511911oib.32.2021.04.23.13.39.49 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Apr 2021 13:39:49 -0700 (PDT) From: imp@bsdimp.com To: qemu-devel@nongnu.org Subject: [PULL 09/24] bsd-user: style tweak: use C not C++ comments Date: Fri, 23 Apr 2021 14:39:35 -0600 Message-Id: <20210423203935.78225-9-imp@bsdimp.com> X-Mailer: git-send-email 2.22.1 In-Reply-To: <20210423203935.78225-1-imp@bsdimp.com> References: <20210423203935.78225-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::230; envelope-from=imp@bsdimp.com; helo=mail-oi1-x230.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Warner Losh Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- 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 Fri Apr 23 20:39: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: 12221679 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5F529C433ED for ; Fri, 23 Apr 2021 20:47:04 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 1A617613BE for ; Fri, 23 Apr 2021 20:47:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1A617613BE Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bsdimp.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:58936 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1la2hb-0005ex-14 for qemu-devel@archiver.kernel.org; Fri, 23 Apr 2021 16:47:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54660) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1la2b0-0005rr-AE for qemu-devel@nongnu.org; Fri, 23 Apr 2021 16:40:15 -0400 Received: from mail-io1-xd2b.google.com ([2607:f8b0:4864:20::d2b]:42815) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1la2aw-00089a-W8 for qemu-devel@nongnu.org; Fri, 23 Apr 2021 16:40:14 -0400 Received: by mail-io1-xd2b.google.com with SMTP id s16so44834150iog.9 for ; Fri, 23 Apr 2021 13:40:10 -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:mime-version :content-transfer-encoding; bh=/gwCxCC7TtVXWBYc6FcQ7sYKzrLKeF2MwPhAfxAi6i0=; b=sbr+H0Jb2DsRi27VwhdZhQxOYhGkqbggvzcR7aYHGNcdEmsr3aEQGS1V50mFnQH2Ok 8r7qYxYviIyAcC10qV4y5UeblwzauFeKVlyFJrJJyIyiJIQDnK8gNQxvzoa5RTWVsVBg E1w+Aw0L2kjIdnYlDr0GmRnG/YFkVpENBjtUo5y9/9ff6lccKkGtkzSMYa0B4kgF4i/S yqdRw+lJX9fLVShK7SRwQ/8iyp+0nA7ZbzyvN7v+3p3cAv6ZH2XfB/VPTbtkVfIY1BDB xr/g7/iu50jkt09qz67GaFFgBnspunFaz5SMQvteAxraWbAxLZRi0OqnCX51KN1FA0b7 o0TQ== 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:mime-version :content-transfer-encoding; bh=/gwCxCC7TtVXWBYc6FcQ7sYKzrLKeF2MwPhAfxAi6i0=; b=lNsfc1/xX2Vmr2Z+DIEWLXOKK1wvuz6QKT5gfJTMaFPbg0qjpLNhOzPLJySd0pxx/i TmRvUUUcUEJRn21sJNEBX2iFbypTgP/xcqZwb4v+JgktSnBYmQKMGj+QklZpEJ3hoJGj L/y7Zoyk87xLBWEP5oZYJHGR2Db7J8OObbwSUzmVjS/iLfojuxDtbbBmRmf/2OlfwTc/ 5sw0XlfmD/mPPhMg7DVK6eOilsZOJqw7WlOGBNpCs5PJY5cfJsKNA1A+PNv0mMBMr/Dm y4F+l1J75UtEvWu0h5RS1uvGeEta4EKZX97AIrK2KP390OX2ndSRlGk8EzrmXQjLd9vT HtDg== X-Gm-Message-State: AOAM532tD2Sc74sdrJXAYntfc7QAd5cxoAkV2eNM93ohtG7i+IwEk0qC bZaeGktJT/tobxcqO6FTMMiFAYm67NBh/9XX X-Google-Smtp-Source: ABdhPJzFo0ExPDZVgpEYX7K9E9i28fDZD3irWZAVwiH3jSO8d5JjOxIKLbKHzKTz9JjSt9TVWarFRQ== X-Received: by 2002:a02:cd13:: with SMTP id g19mr5167190jaq.45.1619210409612; Fri, 23 Apr 2021 13:40:09 -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 n1sm3201308ion.22.2021.04.23.13.40.09 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Apr 2021 13:40:09 -0700 (PDT) From: imp@bsdimp.com To: qemu-devel@nongnu.org Subject: [PULL 10/24] bsd-user: style tweak: use C not C++ comments Date: Fri, 23 Apr 2021 14:39:45 -0600 Message-Id: <20210423203959.78275-1-imp@bsdimp.com> X-Mailer: git-send-email 2.22.1 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Warner Losh Signed-off-by: Warner Losh --- bsd-user/qemu.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/bsd-user/qemu.h b/bsd-user/qemu.h index b836b603af..3480db890d 100644 --- a/bsd-user/qemu.h +++ b/bsd-user/qemu.h @@ -71,7 +71,7 @@ struct image_info { struct sigqueue { struct sigqueue *next; - //target_siginfo_t info; + /* target_siginfo_t info; */ }; struct emulated_sigtable { @@ -193,9 +193,11 @@ 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); +/* + * 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 Fri Apr 23 20:39: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: 12221667 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DDD32C433ED for ; Fri, 23 Apr 2021 20:44:22 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 8760A613BE for ; Fri, 23 Apr 2021 20:44:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8760A613BE Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bsdimp.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:49690 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1la2ez-0001rF-Ks for qemu-devel@archiver.kernel.org; Fri, 23 Apr 2021 16:44:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54684) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1la2b1-0005s8-TW for qemu-devel@nongnu.org; Fri, 23 Apr 2021 16:40:16 -0400 Received: from mail-io1-xd35.google.com ([2607:f8b0:4864:20::d35]:41852) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1la2ay-0008AH-BP for qemu-devel@nongnu.org; Fri, 23 Apr 2021 16:40:14 -0400 Received: by mail-io1-xd35.google.com with SMTP id f21so13970270ioh.8 for ; Fri, 23 Apr 2021 13:40:11 -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=bsSkw7GH59nQ031zI/zjszqrhH3zAgQJ1pZYMcLiL7g=; b=iYn9o8UFrheSGxUzANEl4Vth+0GDJJWYBK9CCWLGvx3aZ5VtJ8zUD3j5TcnK7QdGIk zosvMkOCWm7YULh/WvugMlI3GJ6DdQN+peTyoUhpV7bWfI+oFMmKnqd21S4Q6C3XOAvD pppwNAUrcbJwL3SMFprPuHYlK5tVem/BRlOSymEvrofCGNDAaVVEMi99P3yA4LpjEwEy iANz//DA0EfZbhIHjOu+j7Efa0neXKk25YPMCRF5FhF3CdowFTMYBDyknvEoXclbK0XS kQvSri22H3xjSnuxPwi7gUjiK75cbvvEH+7J6RSL52MjfGgkl995KXQEKmiUhVMqOM4c opzw== 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=bsSkw7GH59nQ031zI/zjszqrhH3zAgQJ1pZYMcLiL7g=; b=e+tRC8q7yPG6Y88pZvJiE+kVAHM3rtsiN09uWaNwbGFKX0rQe2tPQfeitHC5DePAS3 BQxURqGGKInJpatlkc/0ecBKxs0qVGPAyR9Ke7vOgt3LUv6AoopwJQxoudpbPQy14GBj 8QVPWfmIVGVhVLJ1pOekI4oCXGhScDMLRcg/asnG1NX6JmT/HF9eLyKiUIokay33QFKi v1qzK8ejasWxVqKvO24aHrefWrcE81nagcuPo9LCzdCSN5P//R5f3Qjn6tV2rxvTTzaX CKdZotGkj/UOsn+wQxhFk3IJgfKV/THWJ8L8ZVh3++RQRltDOWnB/d2JK+zvYrz5gpOU tXfA== X-Gm-Message-State: AOAM5315gY4bwm8/z1XZpzP961L2WcWvp1QEW5ZXx3hMBaAPWE9GyvRV 1fvJrNTWksSRVdTUlMW5S7yEBzOoBa+222Yq X-Google-Smtp-Source: ABdhPJwZLe0f45BeRWX86YGaO6s18l+veEgtz0q4YtDwGA1Bb1lvjkCQdKiXp6FDYe+EQUmF23QDUQ== X-Received: by 2002:a02:c76c:: with SMTP id k12mr5270089jao.58.1619210410426; Fri, 23 Apr 2021 13:40:10 -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 n1sm3201308ion.22.2021.04.23.13.40.09 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Apr 2021 13:40:09 -0700 (PDT) From: imp@bsdimp.com To: qemu-devel@nongnu.org Subject: [PULL 11/24] bsd-user: style tweak: if 0 -> ifdef notyet for code needed in future Date: Fri, 23 Apr 2021 14:39:46 -0600 Message-Id: <20210423203959.78275-2-imp@bsdimp.com> X-Mailer: git-send-email 2.22.1 In-Reply-To: <20210423203959.78275-1-imp@bsdimp.com> References: <20210423203959.78275-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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Warner Losh 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 87154283ef..07a00ddbd5 100644 --- a/bsd-user/elfload.c +++ b/bsd-user/elfload.c @@ -1270,7 +1270,7 @@ int load_elf_binary(struct linux_binprm *bprm, struct target_pt_regs *regs, ibcs2_interpreter = 1; } -#if 0 +#ifdef notyet printf("Using ELF interpreter %s\n", path(elf_interpreter)); #endif if (retval >= 0) { @@ -1529,7 +1529,7 @@ int load_elf_binary(struct linux_binprm *bprm, struct target_pt_regs *regs, padzero(elf_bss, elf_brk); -#if 0 +#ifdef notyet printf("(start_brk) %x\n" , info->start_brk); printf("(end_code) %x\n" , info->end_code); printf("(start_code) %x\n" , info->start_code); From patchwork Fri Apr 23 20:39: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: 12221707 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A60E0C433B4 for ; Fri, 23 Apr 2021 20:54:16 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 4B770613C2 for ; Fri, 23 Apr 2021 20:54:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4B770613C2 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bsdimp.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:52908 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1la2oZ-0006TH-Es for qemu-devel@archiver.kernel.org; Fri, 23 Apr 2021 16:54:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54688) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1la2b2-0005sA-5P for qemu-devel@nongnu.org; Fri, 23 Apr 2021 16:40:17 -0400 Received: from mail-il1-x132.google.com ([2607:f8b0:4864:20::132]:35358) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1la2az-0008AS-Fr for qemu-devel@nongnu.org; Fri, 23 Apr 2021 16:40:15 -0400 Received: by mail-il1-x132.google.com with SMTP id r5so1545014ilb.2 for ; Fri, 23 Apr 2021 13:40:12 -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=yn305Hv7LfS1sfcLCaTREAMIUN04dPOLVdhMLNpl6lA=; b=Ge4ilK5k9L2iWq8Td8UPPaCHHd71qMqeelfIeE+Nmm9cy4m0bGKGAkPEwF5+545oJq cDHQRszhaqxjnUBle2rXkRSGU89WKvysxy8L9EXaew3k5LCZDFfM3W1CNM4y4CMvBZoa CWvcOMESxA/PSTTDHp2R8OGdmy3ZlbI/l/JbwxH+G44jsibKl2IoA29W7hBd2uPPMAzF trDvPI4u0IzvuZy7Ei95S+Qg/iyFmedGWRgjpa0nZoLnRdoH2Av9r7otsGz+YMZPWTqA sSt8FOFymWbAHhtiFrBqpqclPvZug064ImuYOr05pKHsJa7t/VXg/sz87P8OUfTwQyRx JvKw== 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=yn305Hv7LfS1sfcLCaTREAMIUN04dPOLVdhMLNpl6lA=; b=e8ScKr5l7v1uwyMsVND9sbMNcSRw3KPmMSVL3AjmUbrPLA71hF4QdDZE8m5U6BD1cJ DQ2+s2bWd2luErK4uwBgOKm7t1NhWFd/oWI3tX3iTd8YhhzgjTZd7oODAw6179AeO2bz X5C3Rcoox9H1a+Elf4SiV7ukFDuaRNy4rd3Y0Hp82pt2oeLUOkPW6ub5ss0m/cGua/bD 1Jlc3/gwCwH2GXnslnAWsve7/QUf4tLSDtoZPxC3kTwy1//+JOu2Bkk5YK4TuDW6UEMn D030Zx2uI/p/x75c+xhhQrWMxE+bPRUgjRVdxUdlL4vqJ1eJMj93aqj4bHQSFtE9lLTX IenA== X-Gm-Message-State: AOAM530XXddlNwmt5KTr14AqHrBXy1lwGdiG+6sTh9P3veU0cJPF7nhv i4C6uipXlqPV4V2rNaYJH+7uHpDRGTw2qKBQ X-Google-Smtp-Source: ABdhPJzQQlF/LKRm1+Rz2arQNClbjbgSOpsVXbTY7Cejq6gosoL5ByplWl+MXX2J1rU7dSTPbZVZwA== X-Received: by 2002:a92:1943:: with SMTP id e3mr4306132ilm.166.1619210411222; Fri, 23 Apr 2021 13:40:11 -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 n1sm3201308ion.22.2021.04.23.13.40.10 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Apr 2021 13:40:10 -0700 (PDT) From: imp@bsdimp.com To: qemu-devel@nongnu.org Subject: [PULL 12/24] bsd-user: style tweak: if 0 -> ifdef notyet for code needed in future Date: Fri, 23 Apr 2021 14:39:47 -0600 Message-Id: <20210423203959.78275-3-imp@bsdimp.com> X-Mailer: git-send-email 2.22.1 In-Reply-To: <20210423203959.78275-1-imp@bsdimp.com> References: <20210423203959.78275-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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Warner Losh Signed-off-by: Warner Losh --- bsd-user/main.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/bsd-user/main.c b/bsd-user/main.c index ff886de98e..91603f5ac2 100644 --- a/bsd-user/main.c +++ b/bsd-user/main.c @@ -245,7 +245,7 @@ void cpu_loop(CPUX86State *env) } break; #endif -#if 0 +#ifdef notyet case EXCP0B_NOSEG: case EXCP0C_STACK: info.si_signo = SIGBUS; @@ -340,7 +340,7 @@ void cpu_loop(CPUX86State *env) case EXCP_INTERRUPT: /* just indicate that signals should be handled asap */ break; -#if 0 +#ifdef notyet case EXCP_DEBUG: { int sig; @@ -589,7 +589,7 @@ void cpu_loop(CPUSPARCState *env) break; case TT_TFAULT: case TT_DFAULT: -#if 0 +#ifdef notyet { info.si_signo = SIGSEGV; info.si_errno = 0; @@ -609,7 +609,7 @@ void cpu_loop(CPUSPARCState *env) break; case TT_TFAULT: case TT_DFAULT: -#if 0 +#ifdef notyet { info.si_signo = SIGSEGV; info.si_errno = 0; @@ -629,11 +629,11 @@ void cpu_loop(CPUSPARCState *env) break; case EXCP_DEBUG: { -#if 0 +#ifdef notyet int sig = #endif gdb_handlesig(cs, TARGET_SIGTRAP); -#if 0 +#ifdef notyet if (sig) { info.si_signo = sig; From patchwork Fri Apr 23 20:39: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: 12221689 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 05E8BC43462 for ; Fri, 23 Apr 2021 20:49:56 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id A7F2D6128A for ; Fri, 23 Apr 2021 20:49:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A7F2D6128A Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bsdimp.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:39182 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1la2kM-0000gj-Kl for qemu-devel@archiver.kernel.org; Fri, 23 Apr 2021 16:49:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54686) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1la2b1-0005s9-V2 for qemu-devel@nongnu.org; Fri, 23 Apr 2021 16:40:16 -0400 Received: from mail-il1-x135.google.com ([2607:f8b0:4864:20::135]:33557) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1la2az-0008AY-G1 for qemu-devel@nongnu.org; Fri, 23 Apr 2021 16:40:15 -0400 Received: by mail-il1-x135.google.com with SMTP id y10so1020512ilv.0 for ; Fri, 23 Apr 2021 13:40:12 -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=Zp+PiVP+jZsUiUjaf9U9BA3ABGWIL9WHkgBnMTWpPeU=; b=collzNdF2Vw713NTLXVhw1xQ2nW+7GfYcSHbW+8q1h3yrsyPflXMKP4FQXbRARnTma yaTZcHwbVAmTM74q2MB40+wdkYkei/i+tTVQgQVVVv9eFXmdKRGm6/VT6vdQv23geB7p rLU0ZgvCDpPAhyvr16Mln2t33nX2GQFi9mhiM+P0r8MBQR8bSXO8u1aq7T3w3zhdMtaf v3XUaVUlp/PnS9+mruHm3T6V7AdwouHgKeYjrlj3CQ8cgqbGRjru0sQSlU0zuxr9nAoK 0PhLa2+sOGXJmtNFVfTQzfTPS4kEdOkmvn2n8GVTHtqOuj7V+HwQ1Q4CuUQkFetsChVx HauQ== 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=Zp+PiVP+jZsUiUjaf9U9BA3ABGWIL9WHkgBnMTWpPeU=; b=gvU8urRO5MkMwPs8czSM85zG8hH+yMkJytQmORn4Fs4GVhUmSF4mGhX/814K8SHVOL fXtGfz8Jvtdd7zcznVgjOEgmgz/+uqFA5pE6RDsLElZY0SNl/cKqSQGSODWOHaCAPLGG lLBIxdRbHPvo8bdimrJlatOyzpr8doIj9ZXoxwUHIB8epxziFLLQsYoVs3IwUk5zOqKI az0tEzQ8LR4o1UavqzQRHugWT+Z+jaXYCiMkcDvw+9ZP3R5hwv9ZyIbuCY9UgAAIBiIA KUCMGRWfAHIZ0jK8IhT6LxjWPXRsc5G44d605+N3pFDQd/qq/zmfhvLuTnLrAmiYp7qC WByg== X-Gm-Message-State: AOAM532Jai8lYoaKdSXIi6cOFY/Q0z3VKeSgB8nanoF/oJ2rG6vF+elR fQ/0zmtHK0QnO+udItmdIB+oELjRjrSQiFQS X-Google-Smtp-Source: ABdhPJyxEmEEEtAwwuOtdohPswDTIN7BHqobtDVrzzxWIy+8+No4xbhnmtVlnsokgAWtH2PoN4foqA== X-Received: by 2002:a92:d711:: with SMTP id m17mr4488222iln.12.1619210412013; Fri, 23 Apr 2021 13:40:12 -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 n1sm3201308ion.22.2021.04.23.13.40.11 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Apr 2021 13:40:11 -0700 (PDT) From: imp@bsdimp.com To: qemu-devel@nongnu.org Subject: [PULL 13/24] bsd-user: style tweak: if 0 -> ifdef notyet for code needed in future Date: Fri, 23 Apr 2021 14:39:48 -0600 Message-Id: <20210423203959.78275-4-imp@bsdimp.com> X-Mailer: git-send-email 2.22.1 In-Reply-To: <20210423203959.78275-1-imp@bsdimp.com> References: <20210423203959.78275-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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Warner Losh Signed-off-by: Warner Losh --- bsd-user/strace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bsd-user/strace.c b/bsd-user/strace.c index 2c3b59caf0..6a78dd7efa 100644 --- a/bsd-user/strace.c +++ b/bsd-user/strace.c @@ -128,7 +128,7 @@ static void print_syscall_ret_addr(const struct syscallname *name, abi_long ret) } } -#if 0 /* currently unused */ +#ifdef notyet /* currently unused */ static void print_syscall_ret_raw(struct syscallname *name, abi_long ret) { From patchwork Fri Apr 23 20:39: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: 12221677 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BB520C433B4 for ; Fri, 23 Apr 2021 20:46:56 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 5049261006 for ; Fri, 23 Apr 2021 20:46:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5049261006 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bsdimp.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:58360 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1la2hT-0005Qk-DM for qemu-devel@archiver.kernel.org; Fri, 23 Apr 2021 16:46:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54722) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1la2b4-0005sj-6a for qemu-devel@nongnu.org; Fri, 23 Apr 2021 16:40:19 -0400 Received: from mail-il1-x132.google.com ([2607:f8b0:4864:20::132]:38548) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1la2b0-0008B9-0e for qemu-devel@nongnu.org; Fri, 23 Apr 2021 16:40:17 -0400 Received: by mail-il1-x132.google.com with SMTP id c3so534341ils.5 for ; Fri, 23 Apr 2021 13:40:13 -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=KFYbyv1FT+tAXydS/iwoVTMJ63xlplCM/Sxb0YyvmoY=; b=I1CZQQAfLarnaI9CzdtVMq6HNHwxfyYrx6ctAXQjhzC0T5aeJyxk8qUariDWpA5ni1 ozhrUzRsISg6Wyk8Cv6BdGtQDUyNeRtasuSDzECDe4yII1Wavx6tjo5hnV9ltgDkN/8U pzFbkvAZtcP9Zt4X7itbZTobbZ4L9WM8Emdg2iM/6aMMZI6Cr9oJtOXwx6FDqN1JxnyH mDkuMiWyQNJxpdkcB8oXmNuRc3hHqZjmEiBcuJFE0CzHhYZLKamqt5DWMpeuw6FePvyI +quZ1xiyK6laBcy/R60bmZqOlhSQDDEarN2paVonGYQB9GAEEldxCL4oHgDDKN77/idK mAhA== 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=KFYbyv1FT+tAXydS/iwoVTMJ63xlplCM/Sxb0YyvmoY=; b=d3mG/8kyVpd2htfV4yHG4oSyPiuEjTAVXGeO/FBMeSOo/F0LiwfxS9dRfw3A3hAMq5 FQ2vVedKlQz0Fe9tCgu3PSciJtaUZjMEr2umytRc2WTaVXd9izhmyYGcFYUNW+avi5XR PzaTq/MlnWVU2wB1owkelKNOHedJ5qpw3H1+PIRcKb16YeQd8X0k6cD11ofBfRBKctsh rytZO8ZJfTxstLUXFOLn3HkfJ2LMl+gZRabqc6kkMcVm1qr1V0qA4I53hQz3hamY8+BB O0/JnYlvDnxCPWn4HcLt/0lEVIFHuzd4k2MQ/N6yAehWOj5mhO3PenU1fsnlk3vsH/HQ FfNg== X-Gm-Message-State: AOAM531aRrBuMF16GGBNM+6emlzXMlwZYDV58vG6IZsB5LfE3Jv7k5UH frWiMXFH3xSnTddTTq3iekK5UjirOJIfZXCG X-Google-Smtp-Source: ABdhPJw5STzXHCBDMx4UQUdK86MsGk3iY7me+HWqH5x8otPIKfr4zSaud1CCSqNXe/Srazm6zFZyAg== X-Received: by 2002:a92:d68a:: with SMTP id p10mr4410139iln.40.1619210412803; Fri, 23 Apr 2021 13:40:12 -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 n1sm3201308ion.22.2021.04.23.13.40.12 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Apr 2021 13:40:12 -0700 (PDT) From: imp@bsdimp.com To: qemu-devel@nongnu.org Subject: [PULL 14/24] bsd-user: style tweak: if 0 -> ifdef notyet for code needed in future Date: Fri, 23 Apr 2021 14:39:49 -0600 Message-Id: <20210423203959.78275-5-imp@bsdimp.com> X-Mailer: git-send-email 2.22.1 In-Reply-To: <20210423203959.78275-1-imp@bsdimp.com> References: <20210423203959.78275-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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Warner Losh Signed-off-by: Warner Losh --- bsd-user/x86_64/target_syscall.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bsd-user/x86_64/target_syscall.h b/bsd-user/x86_64/target_syscall.h index a8e6274b76..9a6e072f87 100644 --- a/bsd-user/x86_64/target_syscall.h +++ b/bsd-user/x86_64/target_syscall.h @@ -59,7 +59,7 @@ struct target_pt_regs { #define TARGET_GDT_ENTRY_TLS_MIN 12 #define TARGET_GDT_ENTRY_TLS_MAX 14 -#if 0 // Redefine this +#ifdef notyet /* Redefine this */ struct target_modify_ldt_ldt_s { unsigned int entry_number; abi_ulong base_addr; From patchwork Fri Apr 23 20:39: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: 12221695 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 11EA6C43460 for ; Fri, 23 Apr 2021 20:52:25 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 7DB8061458 for ; Fri, 23 Apr 2021 20:52:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7DB8061458 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bsdimp.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:47636 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1la2ml-0004GV-JU for qemu-devel@archiver.kernel.org; Fri, 23 Apr 2021 16:52:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54742) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1la2b5-0005ss-65 for qemu-devel@nongnu.org; Fri, 23 Apr 2021 16:40:19 -0400 Received: from mail-io1-xd33.google.com ([2607:f8b0:4864:20::d33]:44816) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1la2b1-0008BP-M1 for qemu-devel@nongnu.org; Fri, 23 Apr 2021 16:40:18 -0400 Received: by mail-io1-xd33.google.com with SMTP id p8so1666573iol.11 for ; Fri, 23 Apr 2021 13:40:14 -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=3vvSJlvlo+EU8vIqeNNS+/akqD84ySOCzpwxiSaklTk=; b=n5jFvz8pds8wGwF434Lx9l9TV0k3nDCu481sf3F+/T1ZB0Kne/pAUHxXvVhmog/yqH grvnJcsBgXGwrTz9KrBYpqjCMU0OwMrngLggdZXr6XvPAq9W5Z/zFtgigfSG63rfxP+F aJRc7gWyedSjOTDGCjQO9XyR/Kl3YGMlYuMy4um61WICCaS2mfRWrflqJBirIjKgmfhw KkmU7yS2nwxcKwbevCgiS38Qja0C5QPvf8DDm7xhv/ElMjKWmg7/H2j7Zma0/zyj0oWb fuUa7csoG3XJ+hZpxK/4loJ0RMV1FPNuY/kHm7HQ/2evUXUorKIRrdy5dTIpeOTNCYUB 3ZYw== 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=3vvSJlvlo+EU8vIqeNNS+/akqD84ySOCzpwxiSaklTk=; b=oJRMc0fOeNJ9ttCeo9WQGZonRYdtyV1F6SPK7Lzz4SJtuuDwPadq6AovEPbf/xNaXH LVXPVgKT4XIun1FSq64DfwharvFUsn3g4jQ6lBttM9SgeCCKMdauVgHw8liho9OanKmp r6l6PtmXO+5bG+U5xZyU9r+u+0HGxVbgluMcrZ6oEZEQITwh0MEifz48VNHr6flXgRdN 6EYEM4857kxUpz8S+nqf7+smQQkDLdytjxvhJY2tr9PvHeOfweDMb21DpaoMok48w2s0 MlfCC02HoP2TCeeSppBfyJZuL4yLO1pv0POfSyQdHntc/2fcArDiJXRtACVSRaF9tx7O OoQA== X-Gm-Message-State: AOAM532V/z9/YOVvksXSBpBc5RcahUyckiyNZOF/4PZY4uVSeliyvFVL 30Eo21YO0tfBaCOwj7ijvxNl1CrolSgFesrB X-Google-Smtp-Source: ABdhPJzj7NeJ+UHFuYeIE7I7QyqEPATw7qZmNwd/gr+30j32KA5HSPx901jl+C1CAcZ5wPQ47Ly4SQ== X-Received: by 2002:a5e:c74a:: with SMTP id g10mr4645808iop.165.1619210413645; Fri, 23 Apr 2021 13:40:13 -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 n1sm3201308ion.22.2021.04.23.13.40.12 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Apr 2021 13:40:13 -0700 (PDT) From: imp@bsdimp.com To: qemu-devel@nongnu.org Subject: [PULL 15/24] bsd-user: Fix commentary issues Date: Fri, 23 Apr 2021 14:39:50 -0600 Message-Id: <20210423203959.78275-6-imp@bsdimp.com> X-Mailer: git-send-email 2.22.1 In-Reply-To: <20210423203959.78275-1-imp@bsdimp.com> References: <20210423203959.78275-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, arichardson@freebsd.org, Warner Losh Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Warner Losh Lines > 80 or 90 characters C++ comments BSD /*- block comment convention removed. Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- 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 Fri Apr 23 20:39: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: 12221687 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8FAD0C433ED for ; Fri, 23 Apr 2021 20:49:49 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 212DE6144A for ; Fri, 23 Apr 2021 20:49:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 212DE6144A Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bsdimp.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:38550 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1la2kG-0000Qi-4Q for qemu-devel@archiver.kernel.org; Fri, 23 Apr 2021 16:49:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54776) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1la2b8-0005th-7X for qemu-devel@nongnu.org; Fri, 23 Apr 2021 16:40:23 -0400 Received: from mail-il1-x136.google.com ([2607:f8b0:4864:20::136]:45052) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1la2b2-0008C8-3h for qemu-devel@nongnu.org; Fri, 23 Apr 2021 16:40:20 -0400 Received: by mail-il1-x136.google.com with SMTP id i22so37050989ila.11 for ; Fri, 23 Apr 2021 13:40:15 -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=Vig8iW0/Swd4+9E5pXiJN31r0Gkde0pAJpq+5ENBE+8=; b=c1OUGaRmXiPtedwJ+FjvOXTTBWZEErDlbJtL11N8TokP05HdnzJ6GUlJCTjvBDgsMi wKQqBftyeLExVYCS7tr5bfMkGmmv+FLCpOFs5kbNKsJ6Wvo4vaELgNt1Ha5laVXE9S4X h3DzrQxAmEmFRFIpbG/TXyioMl7ZWsX0HY8bkSjSlO7XnXLR0ty0N0SWJ52QMA6knbh9 yha+TvojkdduLdXfhlsG06jyuq8lEzbKO0aYy0xJcWdlraePdWpESWopcrspleHyvd5O Pddbqx1CjWnlf4BMlKrXC17nljdPb2SyVra7mei/Eqo/kx3Y1c7eW2UEThOsJIf/6lbb drQQ== 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=Vig8iW0/Swd4+9E5pXiJN31r0Gkde0pAJpq+5ENBE+8=; b=fI09wxht5OEARYJZ0bke95/vW1ub77rNqFMSkEhfGCrtlMyPNuGbuuF0TYcO2I8rZY f+qBRcu/1sxJv+Tqe1zh+uZq4eC+C8yzG/A+u9rRm+JqjjnO1l8VUZ6Qsf8l4VSMzNie VdytyDgXKNS6f0ChmLVNyDEyB5pTQNfbPo16fm4O6cxEtUqfO1p4JueVoTUJo4noNj/x Vp2f60clNjVlvMwfW9bRIpW8Qflw8uuiYUyXp9g1K7M6xwi+pPgo3qrcISX5cx++54n/ CgUxnt9wZVkakdg+/HTQKPi9TbvgsRN01r3iyxv9R5sY5Hr8fKA1zGSlhVeXRXVC6ILC L8fg== X-Gm-Message-State: AOAM531DKIpusSm1BzQaglqmQ2vY73UaR/wdexDpG+hiP8ju30VNXXFs 78LhIEgJ3C0HCcrufSDpbIfXACedgIVJ3vrg X-Google-Smtp-Source: ABdhPJwyWb/UElhOGUB3+lOMEEoNBA2bMAeUav4w2rFIB9V1kPc9YcEaG+DDHBPd7WQUT95Er97UZA== X-Received: by 2002:a92:1948:: with SMTP id e8mr4208793ilm.145.1619210414635; Fri, 23 Apr 2021 13:40:14 -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 n1sm3201308ion.22.2021.04.23.13.40.13 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Apr 2021 13:40:13 -0700 (PDT) From: imp@bsdimp.com To: qemu-devel@nongnu.org Subject: [PULL 16/24] bsd-user: Use preferred block comments Date: Fri, 23 Apr 2021 14:39:51 -0600 Message-Id: <20210423203959.78275-7-imp@bsdimp.com> X-Mailer: git-send-email 2.22.1 In-Reply-To: <20210423203959.78275-1-imp@bsdimp.com> References: <20210423203959.78275-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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Warner Losh Use the preferred block comment style. Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- 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 91603f5ac2..5958b07e62 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, ...) @@ -371,13 +373,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; @@ -990,9 +996,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 Fri Apr 23 20:39: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: 12221675 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D9168C433ED for ; Fri, 23 Apr 2021 20:46:54 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 90F6561006 for ; Fri, 23 Apr 2021 20:46:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 90F6561006 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bsdimp.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:58206 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1la2hR-0005Mw-KA for qemu-devel@archiver.kernel.org; Fri, 23 Apr 2021 16:46:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54762) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1la2b6-0005tS-73 for qemu-devel@nongnu.org; Fri, 23 Apr 2021 16:40:21 -0400 Received: from mail-il1-x132.google.com ([2607:f8b0:4864:20::132]:47017) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1la2b2-0008CP-Oz for qemu-devel@nongnu.org; Fri, 23 Apr 2021 16:40:19 -0400 Received: by mail-il1-x132.google.com with SMTP id l19so1202792ilk.13 for ; Fri, 23 Apr 2021 13:40:16 -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=+p7bgzl3P92a2AG9Mhyg/hcdVHv2/BVMcAyEHGEflKI=; b=qmJe2AeUoRMc6wBO0GYk4j7bTkr9vMJnUB76QlzdUKDK0snTvo+X9rajs3Anu7OqkS k8Nug6U0Lx1kbgtyZmoyK9LCwK0Jox+wi18w5Bevl0G4QV4hmtDXS+PIhXao/fF1Wpdf AoQBH9i2vEkfrrxZ0ogipgbS8ye/N++/2byhJG49yaLIWY03CxJn0RmYdQ9einyQhZKw BVoPD6t1aaH/dlUs0zTNb08MwBU3XtWOXjD9C7yqzy7U40l/EhfwgTy3GlODejIhLaw1 PqnFU1DXLKv1L102XsZDeIkjdcVlSa38SRpFPFa6VlpTlKYjj0QZQNzUDv3xVJgzNvUZ k7oQ== 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=+p7bgzl3P92a2AG9Mhyg/hcdVHv2/BVMcAyEHGEflKI=; b=LmDXH2lj7qkKO8chWStpfrS/HP4XqipLIJ/EtIZRMn5xNdQwABCFHDz2aKHnjq3iyj PZ6eqyGGwsoHFOj0vbarM9PUKiaI8EWgAPpruiLXD55kVC7Bsab+Ytx6g29ihzWeGXd/ FkeIenRBuFVXl0N5EXUwIfTF2dGzm+9RSqG8u/efLUVQevL3bT8W2xVkO1w5e2BACvMV nKnJqtsTQGGrn53F4TV47XjgCyuN6gAzcon7vDiQHVZAeJgZuPY6ObmN6ja/LOX0btjL eJOKmbuNOIW9f8tn1wFOGXqd8K6n33QYTMfVCSLg54Zhsc/hjOJAbFu0oQljhjmyPghb x5OA== X-Gm-Message-State: AOAM53069o9SwDInDo+Oy/fvIR6UH32fkiCgyOO3FjaPCCeI6nQ5Z9U8 Mb8G1Yczd2FZG8jzDrnswZz6Z8wgm1wzHOWu X-Google-Smtp-Source: ABdhPJynRl+/c0oT0boZIH83RKo/EY4XtmVGWkixhCPrQuR618U3tuiXkhgG1LiMViBYspH/GE7kPQ== X-Received: by 2002:a92:cac5:: with SMTP id m5mr4337190ilq.222.1619210415458; Fri, 23 Apr 2021 13:40:15 -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 n1sm3201308ion.22.2021.04.23.13.40.14 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Apr 2021 13:40:14 -0700 (PDT) From: imp@bsdimp.com To: qemu-devel@nongnu.org Subject: [PULL 17/24] bsd-user: move extern to header file Date: Fri, 23 Apr 2021 14:39:52 -0600 Message-Id: <20210423203959.78275-8-imp@bsdimp.com> X-Mailer: git-send-email 2.22.1 In-Reply-To: <20210423203959.78275-1-imp@bsdimp.com> References: <20210423203959.78275-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+qemu-devel=archiver.kernel.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. Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- 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 5958b07e62..a94ab63065 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 3480db890d..4305bd1aed 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 Fri Apr 23 20:39: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: 12221711 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BD601C433ED for ; Fri, 23 Apr 2021 20:56:10 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 0C99F6144E for ; Fri, 23 Apr 2021 20:56:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0C99F6144E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bsdimp.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:60884 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1la2qP-0001V9-16 for qemu-devel@archiver.kernel.org; Fri, 23 Apr 2021 16:56:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54812) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1la2bF-0005zh-Ql for qemu-devel@nongnu.org; Fri, 23 Apr 2021 16:40:29 -0400 Received: from mail-il1-x133.google.com ([2607:f8b0:4864:20::133]:45815) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1la2b3-0008CX-U3 for qemu-devel@nongnu.org; Fri, 23 Apr 2021 16:40:26 -0400 Received: by mail-il1-x133.google.com with SMTP id e14so18025728ils.12 for ; Fri, 23 Apr 2021 13:40:17 -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=zrC/EBQo3vDpMAfJHbws2Iuw1OCGYzSSu4/URs0LFtg=; b=F0Izg5xy9ySgegwVG87g3DFcwh1hywzHrqNsidOphmFBaFWWGYA9dlMY6Gh8BUQepu zdlM26dYDNn9+TUDuAiMUbcbnuO3CcqsAl0ReUIbtGjJyDE99XlBndjnx2QRQM1ZeMIX bTd54yaQJkA5QT5dgvLE3glbKA7GL05TsmoZmWuZ/VPGNFyutU1ii7aDB+aBoW0vsyOV srsdZGd65i5ZWPES/IeB7GPW97NosfwRG7ViUktTio51qcyCLMMLQ/SIeWPM+1V5OUf/ EjS1PBwnR4WZc8ujquHZQ209nT0CP0i4KgHE3RKFv0HdxQyVzYLe6bankmsfRJ/+Hd8N 8+pQ== 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=zrC/EBQo3vDpMAfJHbws2Iuw1OCGYzSSu4/URs0LFtg=; b=QGVmuy85fOSe6y3aQVqPLhEO6XMYsB8xg0kpJ0WW3tUhLsE6vIzNqtOjB5Ww7ubzGJ z7OTehQeYBRdUfkeSEc7CeVAXKuATASoo62vGAX8UmDIcySEwbLnmg8jcibpYfCGbRcd 46HR/faij1dcPmYiuLzECjfrJNxQZoyQzXhz+LXgNLv21qU+QD0BR5qoYjEkDQvlGYo+ sxFQ5m6iqXjGZilB4x2P1jucgeO5OdEGl6/nDxAVvkvoSKAHioL5+N5pziMNZMMJJ7IV UvNghLu6lJjo/gG38+ImzTvw6N4jCdgn5UEdl2EqNlox65D8w2GLeT33H3FnVSle+dCT RV4Q== X-Gm-Message-State: AOAM530Q6CCZXQU64JPZJiI8r5pkZptR5vmGaQty4FN3TNfgGT+27iy6 Q0OSEASselMfco7mobyBrW/7MmGQxkGIpwML X-Google-Smtp-Source: ABdhPJwviWGhhlVkj65y21PjlDBEYF0lgva6oSoo5sEtLdml416pYCnwQ18re9a4vLm/o7JW6yR+Uw== X-Received: by 2002:a05:6e02:1c06:: with SMTP id l6mr4422821ilh.185.1619210416255; Fri, 23 Apr 2021 13:40:16 -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 n1sm3201308ion.22.2021.04.23.13.40.15 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Apr 2021 13:40:15 -0700 (PDT) From: imp@bsdimp.com To: qemu-devel@nongnu.org Subject: [PULL 18/24] bsd-user: style changes for {} Date: Fri, 23 Apr 2021 14:39:53 -0600 Message-Id: <20210423203959.78275-9-imp@bsdimp.com> X-Mailer: git-send-email 2.22.1 In-Reply-To: <20210423203959.78275-1-imp@bsdimp.com> References: <20210423203959.78275-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::133; envelope-from=imp@bsdimp.com; helo=mail-il1-x133.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Warner Losh Fix various issues with {} not being present on if / for / case statements. Tweak indentation where needed to appease checkpatch after this. Minor line length tweaks Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/main.c | 100 +++++++++++++++++++++++++++++------------------- 1 file changed, 60 insertions(+), 40 deletions(-) diff --git a/bsd-user/main.c b/bsd-user/main.c index a94ab63065..69e5525607 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], @@ -273,10 +273,11 @@ void cpu_loop(CPUX86State *env) case EXCP0E_PAGE: info.si_signo = SIGSEGV; info.si_errno = 0; - if (!(env->error_code & 1)) + if (!(env->error_code & 1)) { info.si_code = TARGET_SEGV_MAPERR; - else + } else { info.si_code = TARGET_SEGV_ACCERR; + } info._sifields._sigfault._addr = env->cr[2]; queue_signal(env, info.si_signo, &info); break; @@ -343,23 +344,23 @@ void cpu_loop(CPUX86State *env) break; #ifdef notyet case EXCP_DEBUG: - { - int sig; + { + 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); - } + 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", + fprintf(stderr, + "qemu: 0x%08lx: unhandled CPU exception 0x%x - aborting\n", (long)pc, trapnr); abort(); } @@ -383,8 +384,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; } @@ -396,8 +398,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", @@ -446,8 +449,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", @@ -460,8 +464,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; @@ -477,11 +482,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 @@ -516,8 +523,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 @@ -526,7 +534,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], @@ -620,10 +629,11 @@ void cpu_loop(CPUSPARCState *env) info.si_errno = 0; /* XXX: check env->error_code */ info.si_code = TARGET_SEGV_MAPERR; - if (trapnr == TT_DFAULT) + if (trapnr == TT_DFAULT) { info._sifields._sigfault._addr = env->dmmuregs[4]; - else + } else { info._sifields._sigfault._addr = env->tsptr->tpc; + } /* queue_signal(env, info.si_signo, &info); */ } #endif @@ -639,13 +649,12 @@ void cpu_loop(CPUSPARCState *env) #endif gdb_handlesig(cs, TARGET_SIGTRAP); #ifdef notyet - if (sig) - { + 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; @@ -754,8 +763,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); @@ -775,11 +785,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, "-")) { @@ -796,24 +808,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")) { @@ -953,11 +969,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); } @@ -1130,10 +1148,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 Fri Apr 23 20:39: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: 12221709 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNWANTED_LANGUAGE_BODY, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F27C7C433ED for ; Fri, 23 Apr 2021 20:54:33 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id AD8C8611AC for ; Fri, 23 Apr 2021 20:54:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AD8C8611AC Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bsdimp.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:54458 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1la2oq-00075x-Qh for qemu-devel@archiver.kernel.org; Fri, 23 Apr 2021 16:54:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54778) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1la2b8-0005ti-B4 for qemu-devel@nongnu.org; Fri, 23 Apr 2021 16:40:23 -0400 Received: from mail-io1-xd29.google.com ([2607:f8b0:4864:20::d29]:42814) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1la2b4-0008DB-Ik for qemu-devel@nongnu.org; Fri, 23 Apr 2021 16:40:22 -0400 Received: by mail-io1-xd29.google.com with SMTP id s16so44834428iog.9 for ; Fri, 23 Apr 2021 13:40:18 -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=YRAy0eIrnh85I4tH3EXzrP9m4u6fh0Jy9AAmaLsFdpQ=; b=D9kIwemACN+0drwniE1gaXoTGwBNdTj+1dJEir/ue5nwpPYHtKaaBjlc4clR7Pg0Ix 2SptWAcA+7STzH1wXbJB0fP7Id+Q5wyuvlzsGYeOeQrh//Y/YRyKaf8dv3fHplI7c1Nu csvVr/igN0EX0C5u+wCEZJjpNrDhLEQPs/ty4mYmfbFfhJcI1c1xoMkWgbP/LZTPqU2Y +THkckgeuuG2QRGeHtFTVxZeJxePdbo+ccBN7cnWGonsJcDY81QXWsTAO4tEnYUG8uu5 pxEvfH3+huVJvXrW5Cu3CpdW76tiA8cW8+g+J2usu58qCMpX0C0T4kdOiSk48twiAc/0 6HiQ== 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=YRAy0eIrnh85I4tH3EXzrP9m4u6fh0Jy9AAmaLsFdpQ=; b=H1WQJPT6TpoTBE7dFdexLJkbv7jk6DV326DP+TlPqpLl966kP6TQxjH3lYjESrWXeq my15H2VC2NUYbk870vEm6riUnttvd1NzR1tqj8HXB/2B4ZIHqTELN3FF+Aft5L7KS5Jw zz0vn3iuoE+HlmLnDVEs9qscrop9fQQBQoMaYEKfoEqYHCCUSr+NczpFChJPBgTWUjkh nB+nBA3zODhiBrnqVIvM+X6gYfQnmijqK3D07h5h17FcMunRJBq+7VytR3dtatU7XPJm NyLyyjvbc5wf3przDd6h1Yb0ZvFydxHh80gXgmLrwlsTCQsozwF4OmWeIF7hLQ8M1AFW au1A== X-Gm-Message-State: AOAM5319pnRARJuum9aUzKrKJ+citrmvK2FymwXHTie1iXuRjy55qpyE XPobazC43N9vEPBnGXldlUb5XRYxmqod7yBV X-Google-Smtp-Source: ABdhPJxtYL5hZElS9m+IZfVLZ4mqY6eqACIS4eHp9HjXzakMa+sqB3rGwHiimGZK8UoH+PTB5pER1g== X-Received: by 2002:a05:6602:1689:: with SMTP id s9mr4472638iow.171.1619210417256; Fri, 23 Apr 2021 13:40:17 -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 n1sm3201308ion.22.2021.04.23.13.40.16 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Apr 2021 13:40:16 -0700 (PDT) From: imp@bsdimp.com To: qemu-devel@nongnu.org Subject: [PULL 19/24] bsd-user: use qemu_strtol in preference to strtol Date: Fri, 23 Apr 2021 14:39:54 -0600 Message-Id: <20210423203959.78275-10-imp@bsdimp.com> X-Mailer: git-send-email 2.22.1 In-Reply-To: <20210423203959.78275-1-imp@bsdimp.com> References: <20210423203959.78275-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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Warner Losh Signed-off-by: Warner Losh --- bsd-user/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bsd-user/main.c b/bsd-user/main.c index 69e5525607..95fda8c5ae 100644 --- a/bsd-user/main.c +++ b/bsd-user/main.c @@ -821,7 +821,7 @@ int main(int argc, char **argv) } } else if (!strcmp(r, "s")) { r = argv[optind++]; - x86_stack_size = strtol(r, (char **)&r, 0); + x86_stack_size = qemu_strtol(r, (char **)&r, 0); if (x86_stack_size <= 0) { usage(); } @@ -853,7 +853,7 @@ int main(int argc, char **argv) exit(1); } } else if (!strcmp(r, "B")) { - guest_base = strtol(argv[optind++], NULL, 0); + guest_base = qemu_strtol(argv[optind++], NULL, 0); have_guest_base = true; } else if (!strcmp(r, "drop-ld-preload")) { (void) envlist_unsetenv(envlist, "LD_PRELOAD"); From patchwork Fri Apr 23 20:39: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: 12221719 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 31077C43461 for ; Fri, 23 Apr 2021 21:00:19 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 7E81161409 for ; Fri, 23 Apr 2021 21:00:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7E81161409 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bsdimp.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:39742 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1la2uP-0004V9-Du for qemu-devel@archiver.kernel.org; Fri, 23 Apr 2021 17:00:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54822) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1la2bH-00061Q-N5 for qemu-devel@nongnu.org; Fri, 23 Apr 2021 16:40:35 -0400 Received: from mail-il1-x130.google.com ([2607:f8b0:4864:20::130]:42980) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1la2b5-0008Dc-Sg for qemu-devel@nongnu.org; Fri, 23 Apr 2021 16:40:31 -0400 Received: by mail-il1-x130.google.com with SMTP id c4so15204634ilq.9 for ; Fri, 23 Apr 2021 13:40:19 -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=jhU1HMEXvEeUtKRiD585rg920MVTurXkg6N55NOj/8s=; b=al2RLTaZZb89dDQrmPkUPrNegWwrEOh1hE7E5y2g+tX6MpR1zIBGZ1z4Ha2mnPPqIM e/zLMbASpLB5YSCIK2OeldGwt7TrXYm1yMOOS+9tOhWcp5k2d5EvFPvy7KJoWor9hDu+ k6RUfGnH9x3RZLa9fyZ2Fn+2YM5y8aIWK3tbb9LOR45JA4FFiXbiviSNPugdnO8VLyHY iEzhwVY/K+cegSoxggESsClF9mm0NioV8okD/RS/puHjTnw7lVeOUG6JXD0/xdQsetFc NaXNrAxVxuHFOFuAQoTc/HZTLm80QLmnOTV1ik+tn8HnyW28bjWeIFX7vbdjsVtUlQtS ZEIQ== 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=jhU1HMEXvEeUtKRiD585rg920MVTurXkg6N55NOj/8s=; b=LrA3PfLoHRqu/wvYKyFQpUxbv9uNzQnMzInrBAelwyklineA3f58Z77CvymDqdVD79 3ezSv3vuJHsrB+bIvcYm8B/nMgK6uQOVFdWzwy3IWkoL5Ht1OatRFrqphAEXT9tX1hSG 1e16tgRzOj4cpb/POiu0KXg4tXCyOvoGnxhHZvi1Fhtq76xbODQL2Gn9a9Sj7l09W9Cd EXxu/fdoDdJLn6WNzWnhx5jDYxAFquwe4tyJzvP6nojNY20It9gUIV6mi78frYm6TrGE T+93mqwd/pcSJbK/WGx90CJxdwEShW1V3BJld3ZB//NuEZlHVnXKK073EHs1JafRRfhN lUXw== X-Gm-Message-State: AOAM530DhmHGklx7os5S7uOmohailwUWxQsAkI9U0TfLL0KtwliS4syC Lhn6bTTX5hw3kMnqFyl2ePeGgKqBIXqBmiCl X-Google-Smtp-Source: ABdhPJzX2oOzSrn1YCS3cWKi8Q9oNVAOjavd+apxMliEQTQPSJwBCXfHf0JVQI7Hp0vxHijO1vwXkQ== X-Received: by 2002:a92:d7c2:: with SMTP id g2mr4537183ilq.265.1619210418067; Fri, 23 Apr 2021 13:40:18 -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 n1sm3201308ion.22.2021.04.23.13.40.17 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Apr 2021 13:40:17 -0700 (PDT) From: imp@bsdimp.com To: qemu-devel@nongnu.org Subject: [PULL 20/24] bsd-user: introduce host_os.h for bsd-specific code and defaults Date: Fri, 23 Apr 2021 14:39:55 -0600 Message-Id: <20210423203959.78275-11-imp@bsdimp.com> X-Mailer: git-send-email 2.22.1 In-Reply-To: <20210423203959.78275-1-imp@bsdimp.com> References: <20210423203959.78275-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, arichardson@freebsd.org, Warner Losh , Stacey Son Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.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. Signed-off-by: Stacey Son Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- 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 95fda8c5ae..fbcc8cc28c 100644 --- a/bsd-user/main.c +++ b/bsd-user/main.c @@ -40,6 +40,8 @@ #include "exec/log.h" #include "trace/control.h" +#include "host_os.h" + int singlestep; unsigned long mmap_min_addr; uintptr_t guest_base; @@ -761,7 +763,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 Fri Apr 23 20:39: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: 12221721 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D20E4C433B4 for ; Fri, 23 Apr 2021 21:02:15 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 4B6F3613CB for ; Fri, 23 Apr 2021 21:02:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4B6F3613CB Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bsdimp.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:44474 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1la2wI-0006Xv-5s for qemu-devel@archiver.kernel.org; Fri, 23 Apr 2021 17:02:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54824) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1la2bL-00061n-2E for qemu-devel@nongnu.org; Fri, 23 Apr 2021 16:40:35 -0400 Received: from mail-io1-xd36.google.com ([2607:f8b0:4864:20::d36]:37560) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1la2b7-0008E6-RR for qemu-devel@nongnu.org; Fri, 23 Apr 2021 16:40:32 -0400 Received: by mail-io1-xd36.google.com with SMTP id b10so50081400iot.4 for ; Fri, 23 Apr 2021 13:40:19 -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=KCpN3fMjVnI6P/5+Hcy21zU+TlRkeIdqq7qwGLErEGg=; b=x8GKAOKiPefv5QO2a/MUFJf6ZPMSDaneW9djsmzNOsqqcCoQ2kLfx/S3p5gQyBrX4Q 84sAW5cjtR00T6cddtdHYmcrea3VcK7PcsKFcNPQ57sBUMplklVa51se9WkPIY6bYWTs idzz77aN1AzH8rXfN+M1VM4ZX8TUQAaWliatM60ErAfX5ZFhuoXUXvgyW/isYNCZugdn ADg+E3OmtQzD10ZcnKIDGAAPtSBPxzGNmpgS64vx/il50ON4Vs/hfzbnOxqdtp9P6xX4 N7KnbMyK1xM/SlcxIdtPNdFM0uJieymxQdstQlyOlagO9egK+19bFiXu1RSVzgcdRnjm BMCg== 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=KCpN3fMjVnI6P/5+Hcy21zU+TlRkeIdqq7qwGLErEGg=; b=eEt3PHq+NXv06ZZvZAvBJlJCoRpPHjQsRrGYhrk2g0UzcJyfsJrTMrSbg6WgmlLgNP jU5IXnu/R+yjuHQr8zeDuv0FtZX09ie9BoSxdP0mvCUBY7eos3IdtFvL5SCpqgtMTqIp bzzA+fcLXc55NPP4sTrAAm+jp3cCFk4GQgobIMOJUecWw0jsDN9Wnz3lHtR3C0JzWR7p 8OCX2+agB2vHfoQSv20fiwV0tEvXJDQsDnJFuR1UP2TiLSVDTHZhFpGrvCKBcIL9RsCV Ma2X10vIG4C9/7Wc5aE18LFacvkGiDf2yGYaewkcJ5dgv4+r/W9PvETpv0f794L4Oea4 N9Fg== X-Gm-Message-State: AOAM533KDxAM+aKlCVOUf9McyD8NMVps1OGbuYer1Qj7zVTTqhzoPni7 3NlNilIKAMyLtPVBbJcHbgM3tcBjLE7mYTX6 X-Google-Smtp-Source: ABdhPJxfrir9p3Uiqyxy9dJaUjTn0Vh/YXE4XBgl9QexD299UEX0Oj7idb8OplTlvn5zQqb4HJziiA== X-Received: by 2002:a6b:7d4c:: with SMTP id d12mr4415477ioq.29.1619210418941; Fri, 23 Apr 2021 13:40:18 -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 n1sm3201308ion.22.2021.04.23.13.40.18 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Apr 2021 13:40:18 -0700 (PDT) From: imp@bsdimp.com To: qemu-devel@nongnu.org Subject: [PULL 21/24] bsd-user: add arm target_signal.h Date: Fri, 23 Apr 2021 14:39:56 -0600 Message-Id: <20210423203959.78275-12-imp@bsdimp.com> X-Mailer: git-send-email 2.22.1 In-Reply-To: <20210423203959.78275-1-imp@bsdimp.com> References: <20210423203959.78275-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, arichardson@freebsd.org, Warner Losh , Stacey Son Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Warner Losh Add a arm target_signal.h to complete the files currently in the tree. The arm directory isn't compiled, so it was missing target_signal.h. Update it to the same level as x86 and sparc. This was abstracted from the target_arch_vmparam.h file in the bsd-user branch. Signed-off-by: Stacey Son Signed-off-by: Warner Losh --- bsd-user/arm/target_signal.h | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 bsd-user/arm/target_signal.h diff --git a/bsd-user/arm/target_signal.h b/bsd-user/arm/target_signal.h new file mode 100644 index 0000000000..02be90a2d1 --- /dev/null +++ b/bsd-user/arm/target_signal.h @@ -0,0 +1,31 @@ +/* + * ARM target specific signal handling code + * + * 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_SIGNAL_H +#define TARGET_SIGNAL_H + +#include "cpu.h" + +/* this struct defines a stack used during syscall handling */ + +static inline abi_ulong get_sp_from_cpustate(CPUARMState *state) +{ + return state->regs[R_ESP]; +} + +#endif /* TARGET_SIGNAL_H */ From patchwork Fri Apr 23 20:39: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: 12221717 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 60C74C433B4 for ; Fri, 23 Apr 2021 20:58:05 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id E683B611AC for ; Fri, 23 Apr 2021 20:58:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E683B611AC Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bsdimp.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:37008 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1la2sF-0003J2-W9 for qemu-devel@archiver.kernel.org; Fri, 23 Apr 2021 16:58:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54820) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1la2bH-00061G-Lg for qemu-devel@nongnu.org; Fri, 23 Apr 2021 16:40:35 -0400 Received: from mail-il1-x132.google.com ([2607:f8b0:4864:20::132]:37480) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1la2b8-0008Es-17 for qemu-devel@nongnu.org; Fri, 23 Apr 2021 16:40:29 -0400 Received: by mail-il1-x132.google.com with SMTP id j12so27845297ils.4 for ; Fri, 23 Apr 2021 13:40:20 -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=K7G+8Uqg5EuLucUk7kbJ9fT+UfpGKcYXpCPIxZdLvNI=; b=RMxYi97QBoC0W7YABmotGnW+HVU2NdLj99UiDyzAfVLaZHLt3KptsM1nOXVA3EOjJP ydclFv+1XCYDM2H+n+QR+IO0FkQcna0LKnGIetn/RR6v/46TNYZY2HMGmE7+bFVtArC7 YxlxRgW/FwTjiY4CzvqTM9eYkW5Bp5mDFDRiCylOwnYaONutcAPIrOjCR6wkRE6ZJJax YQoz0uthHv/cqewys26oKyRGbkI7yhDeOgtO9UgIna43cLL3CdqREFGWyOLe5Njx5YG1 MNgklarBObC9iF3rMVLkstv9vIbiMDIGsQDSi7jBZbTfTILFH4Zx100AUvXaP6oKs0zR mNgw== 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=K7G+8Uqg5EuLucUk7kbJ9fT+UfpGKcYXpCPIxZdLvNI=; b=Pvt5FKQCjh7auZg7DTjwUJbrpc8HkwQSTZz4hi+NBMITI7N/OxzwaYjXSguqtRL6Zo 64SeoZrCLnTktbKNyi+rY3gphX1wAHqSD2gZbyj04lx8I9WaOLvxHzcMD8GtcoWUPWBh MNoDDRK6PqDgQISSXf7JfWV4G82FxO5/bEjbgMiIM0OtCnhDmQjqlz9Q0gbd9BIf5xt/ izRVrltzQNu3DMcx88XcPCqgii6LSCmjqJkdc1AI3oW3oXTXEV3l87SyiPiNk7UyMFzU xQWRwVr1HZg4pRVj812R+m6Av5htHE7JjIf4s21mI6QSHIceIEGuI18AWnHW5hbuN6AW IFIg== X-Gm-Message-State: AOAM533CYhzLZ+354TrBygKWwKEfntG3hRhPWdM4GYYLEjBSb6c1TAeU 7RA+xSgEMUc3CAl9UBup0ChVGAwaNqDoefkO X-Google-Smtp-Source: ABdhPJyL7/RDQO/pFnt9ScDhVCFSbh4mQ1oBlZkYb7bmGqH25IyiXWtozzWo6/S8uH+jQzGB1cXvhw== X-Received: by 2002:a92:4b0b:: with SMTP id m11mr4342065ilg.58.1619210419776; Fri, 23 Apr 2021 13:40:19 -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 n1sm3201308ion.22.2021.04.23.13.40.19 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Apr 2021 13:40:19 -0700 (PDT) From: imp@bsdimp.com To: qemu-devel@nongnu.org Subject: [PULL 22/24] bsd-user: create target_arch_cpu.h Date: Fri, 23 Apr 2021 14:39:57 -0600 Message-Id: <20210423203959.78275-13-imp@bsdimp.com> X-Mailer: git-send-email 2.22.1 In-Reply-To: <20210423203959.78275-1-imp@bsdimp.com> References: <20210423203959.78275-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 , Stacey Son Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.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. Signed-off-by: Stacey Son Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- 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 fbcc8cc28c..d12b77fbfe 100644 --- a/bsd-user/main.c +++ b/bsd-user/main.c @@ -41,6 +41,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 Fri Apr 23 20:39: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: 12221733 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 98218C433ED for ; Fri, 23 Apr 2021 21:04:22 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 0FC9C61450 for ; Fri, 23 Apr 2021 21:04:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0FC9C61450 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bsdimp.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:49100 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1la2yL-0008Ti-7n for qemu-devel@archiver.kernel.org; Fri, 23 Apr 2021 17:04:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54826) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1la2bL-00062P-Gv for qemu-devel@nongnu.org; Fri, 23 Apr 2021 16:40:37 -0400 Received: from mail-io1-xd2c.google.com ([2607:f8b0:4864:20::d2c]:46704) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1la2b8-0008F1-D9 for qemu-devel@nongnu.org; Fri, 23 Apr 2021 16:40:35 -0400 Received: by mail-io1-xd2c.google.com with SMTP id b9so2630443iod.13 for ; Fri, 23 Apr 2021 13:40:22 -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=lyXM6hliagBe1YqegqFTwczILeo0yv536s9PmRh/HLM=; b=d8AmWQvYQ4yqejKngT2xuW/vmxU8RqmN+JsK77EsBcOfQgK+7I242GMv0gX0yg3wuv XBYqXhy+3iQjdi+1zI6vb3S/MvACDsYvprwupwK/VcboefE7kz7RTP7GPv4ou42JvbHT 1A2XhLsW/i/q9vbXXK9Tr6my7kxupVmCj5CVQtPN1JdX6r4Sz5Gfy7pnr2nRFvjMI3JF BWZPq70tN84UDek9sHxA21RmUSvKb9JHkrFYFv1OHqzLBA9Zbdd98xzCQxsuyRg3uay5 eAr4/PzMoqXLTxG+R6dcE3St9DhX63bSCc9TSgdOeOWHR2ZEXp+0H1+13g+cHCHvjQg9 k41A== 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=lyXM6hliagBe1YqegqFTwczILeo0yv536s9PmRh/HLM=; b=YHkWArWuDVrCLbKg5rFbiOF5sipUAF5+rc030n7nbqwqoaoHXODl94T/Dzkapki/WF SGQLZW5iiWxORWOLG86BNi88aeCYqm4WNJQHCldURteuQyf/4EXRnYqMVuhpnUTMKkcd RMdAgem3toNUjo25g77HmJBDzBBra9QHDJkaQzJqpMnNIc3WJmvehqMcI43KQYOwQhEr uxDuWPGG+dhfQSD7AJOHdsihFOyoCZoE7hszjSWXOYVitr1Og5PaIVc9NSkC85X3aNSt M51KxW7Gty9nvQI2lC2vD00e9NclhL2a5QFfUo6532rCCPwAgxb3bb5r8HBSDf7Zo+gS fNEg== X-Gm-Message-State: AOAM532XlAqWYJHWCk6UR8N0MVxMFeANoDqPdbgq+lWKEpcQM0sD/DGy dzxCASGQR+FWL1Jgs+Gt1hQoUzQDyaY5tHmg X-Google-Smtp-Source: ABdhPJylVaBlas4gCTDYQ8lH43o8u7UD5KZhp9isjv1ED5/KrC5Wkl8CJrjwfXAZRbPGPcfiltePew== X-Received: by 2002:a05:6602:2e82:: with SMTP id m2mr4627581iow.70.1619210420880; Fri, 23 Apr 2021 13:40:20 -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 n1sm3201308ion.22.2021.04.23.13.40.19 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Apr 2021 13:40:20 -0700 (PDT) From: imp@bsdimp.com To: qemu-devel@nongnu.org Subject: [PULL 23/24] bsd-user: move x86 (i386 and x86_64) cpu_loop to target_arch_cpu.h Date: Fri, 23 Apr 2021 14:39:58 -0600 Message-Id: <20210423203959.78275-14-imp@bsdimp.com> X-Mailer: git-send-email 2.22.1 In-Reply-To: <20210423203959.78275-1-imp@bsdimp.com> References: <20210423203959.78275-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 , Stacey Son Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.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 | 283 +++++++++++++++++++++++++++++++ bsd-user/main.c | 284 +------------------------------- 2 files changed, 286 insertions(+), 281 deletions(-) diff --git a/bsd-user/i386/target_arch_cpu.h b/bsd-user/i386/target_arch_cpu.h index c05e048b9b..c71b2ac3ec 100644 --- a/bsd-user/i386/target_arch_cpu.h +++ b/bsd-user/i386/target_arch_cpu.h @@ -19,4 +19,287 @@ #ifndef _TARGET_ARCH_CPU_H_ #define _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 + +void target_cpu_loop(CPUX86State *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 +#ifdef notyet + 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; +#ifdef notyet + 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", + (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 d12b77fbfe..3ebfa9425d 100644 --- a/bsd-user/main.c +++ b/bsd-user/main.c @@ -87,288 +87,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 -#ifdef notyet - 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; -#ifdef notyet - 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", - (long)pc, trapnr); - abort(); - } - process_pending_signals(env); - } + target_cpu_loop(env); } #endif From patchwork Fri Apr 23 20:39: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: 12221691 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7FB05C433ED for ; Fri, 23 Apr 2021 20:49:55 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id BB62D61406 for ; Fri, 23 Apr 2021 20:49:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BB62D61406 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bsdimp.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:39088 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1la2kL-0000eC-Tf for qemu-devel@archiver.kernel.org; Fri, 23 Apr 2021 16:49:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54832) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1la2bN-000633-FY for qemu-devel@nongnu.org; Fri, 23 Apr 2021 16:40:37 -0400 Received: from mail-il1-x12a.google.com ([2607:f8b0:4864:20::12a]:42975) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1la2bB-0008Fk-O3 for qemu-devel@nongnu.org; Fri, 23 Apr 2021 16:40:36 -0400 Received: by mail-il1-x12a.google.com with SMTP id c4so15204786ilq.9 for ; Fri, 23 Apr 2021 13:40:23 -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=pQZxDIVBuSYLHNecJKjQ2VuvLn3vixt7uU0o/CpnGyY=; b=uWBRbqWa8GiahmTjrzajdyIrHYZOryUiuR6OM8RO0BsJfNxP+fRW4QlYSQM5Lhk8Fe 2lt1gdP0M7wopCNZSS96II00Q/1Z3jEFUS6WjaFp6+f1+No7RkGQ23nY3Dr5fEIQgv3Y pGn1RHxcvJGX7h45s2FOBIaG/BmE+Z19q56+/x2qy4wou7Bg8kZrsPB2feS+uCBwBXIB n9eaVW+0iUzARaBC7A2v7O6Vlp0eLdGwgagwJ3w5MHKyunC1GG/SA2SgB8Zqba+E1+rG /kvU6inve2PD/uutFl7NPs0R7Ywn/xUxoF/S/3LgTNBbTmCiwd7fnRg+eB41LF7nEKv7 ccUg== 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=pQZxDIVBuSYLHNecJKjQ2VuvLn3vixt7uU0o/CpnGyY=; b=OK3XARQ009AvFcWw1a2Yj5PJ45S36a07GQpNTwmPPsfLnppi4yPMxc8iIzNusf647f 83OXlrNXgeEGqbMrNRtSWopD6YuSeJwEwdDo8FuNnm27PaXlceWUmmNuogMx/Jf55GsG iMcMfsq0lgU+iTwvmsum4Qa7lj2RpJ6T35wdL+qCDF8uWGfYXF8fzvvj5EUNOn9lyInA Vh09kXZ3IZxvQkhrNJohvKFcNkM1isoN6l5HiNhy+O//fudXsUTQeW2bqWpsdmwls0m+ MnsPDGinv/iJWUslTrwDHiWjFG3HftTKCbbMpTIvrLi5H1F33H2AZ1q9OxWkzaCAI+tD kOjw== X-Gm-Message-State: AOAM532sODHSwNR66RSKHShKEnBlC2XghTXZkiDXEjJsrgHc3WTyMkre 1K8uM8budwH8AHZhkqOSIs3yUKCzetJuuw3v X-Google-Smtp-Source: ABdhPJzZkP/AcyeDoGNszw54Flv+hq7wqs4tKV619KgOFInBnJd4/czU6wO6DGgQH3+K64FqhYEtzw== X-Received: by 2002:a05:6e02:d51:: with SMTP id h17mr4426624ilj.134.1619210422178; Fri, 23 Apr 2021 13:40:22 -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 n1sm3201308ion.22.2021.04.23.13.40.20 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Apr 2021 13:40:21 -0700 (PDT) From: imp@bsdimp.com To: qemu-devel@nongnu.org Subject: [PULL 24/24] bsd-user: move sparc cpu_loop into target_arch_cpu.h as target_cpu_loop Date: Fri, 23 Apr 2021 14:39:59 -0600 Message-Id: <20210423203959.78275-15-imp@bsdimp.com> X-Mailer: git-send-email 2.22.1 In-Reply-To: <20210423203959.78275-1-imp@bsdimp.com> References: <20210423203959.78275-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, arichardson@freebsd.org, Warner Losh , Stacey Son Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.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 | 305 ------------------------------- bsd-user/sparc/target_arch_cpu.h | 300 ++++++++++++++++++++++++++++++ 2 files changed, 300 insertions(+), 305 deletions(-) diff --git a/bsd-user/main.c b/bsd-user/main.c index 3ebfa9425d..5791c3a641 100644 --- a/bsd-user/main.c +++ b/bsd-user/main.c @@ -87,315 +87,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: -#ifdef notyet - { - 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 */ - save_window(env); - break; - case TT_FILL: /* window underflow */ - restore_window(env); - break; - case TT_TFAULT: - case TT_DFAULT: -#ifdef notyet - { - 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: - /* just indicate that signals should be handled asap */ - break; - case EXCP_DEBUG: - { -#ifdef notyet - int sig = -#endif - gdb_handlesig(cs, TARGET_SIGTRAP); -#ifdef notyet - 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: -#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..c2b9c2480e 100644 --- a/bsd-user/sparc/target_arch_cpu.h +++ b/bsd-user/sparc/target_arch_cpu.h @@ -19,4 +19,304 @@ #ifndef _TARGET_ARCH_CPU_H_ #define _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 +} + +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: +#ifdef notyet + { + 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 */ + save_window(env); + break; + case TT_FILL: /* window underflow */ + restore_window(env); + break; + case TT_TFAULT: + case TT_DFAULT: +#ifdef notyet + { + 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: + /* just indicate that signals should be handled asap */ + break; + case EXCP_DEBUG: + { +#ifdef notyet + int sig = +#endif + gdb_handlesig(cs, TARGET_SIGTRAP); +#ifdef notyet + 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: +#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_ */