From patchwork Sat Jul 15 13:52:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 703224 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e4d:0:b0:314:25da:8dc4 with SMTP id r13csp157300wrt; Sat, 15 Jul 2023 06:55:58 -0700 (PDT) X-Google-Smtp-Source: APBJJlHJqXSBXYrukzjXLEbOB95e9VbliaJPXu13kFAskAsG3CjKZZ4dDcxgvuUOfze8Y/3IDk1d X-Received: by 2002:a05:620a:2911:b0:767:4068:1df4 with SMTP id m17-20020a05620a291100b0076740681df4mr8138048qkp.31.1689429358009; Sat, 15 Jul 2023 06:55:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689429357; cv=none; d=google.com; s=arc-20160816; b=O/KckUP0L3EKF1BE29G32P0F/h9NbMCMMJBhzLto43ZHsFuYHJS1aGc3gNFLIzVWck v6gkOBKwfgsyHK8dL6vTmDvMm/Xvx/DWCTcv8Q5rQWmAcKKUuMuRrfOHbbcDo8R2kjrr +nIsbvyZRugxzsWeCE2yXY8+KipXshaRph/svG6ApvL40pgcjqncbqjeLbMeD8uovs9u vc/dd6iaAqaiHQkTBNWdldTbUAS5HTX0QSXlgdxrc5RhTf9uR/TNH8xf7m+BnCtyseDO Byg/GzDlK+YgXqxpoqUybH7hSaeVtYQC0mQiic1zvHXf+LqUCNru1MpvCzyHosHK/Ggf mvEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ucetWZKQxGf1H8/69kqF4wjbJkZDEr6t/e7SdhPKj/g=; fh=i1mkeM7bD/ppus3C3v+92ltBBCUUU0zBXrpbYjAjHqE=; b=XwglRM7D6AKCfypJ7x/xOp3lwiHCImc5O6qW9xvCQR7gepqaJXx6oagBZxemsBcvxX 5RDJlrl0EvkRnU98z1N3ItQwy+PrrVJu7+iDrfKHC6H5RD1XPIczileJFEz7EZYUXw2E UzK0n9MfiJNPcgI1Reqyux8LH2iF+yDbboZ+RgN2EgZZmJ7MwgoHEJX/LuOQkPBoqlux DgxDwL0+hUGg96PoGPpM8jt9HrmmlcQ9bktIrosuqM0edBt7h7YJBE3DwuUMS4Nv5W1A HddKY4bj2uftaBRKSNWSCDrpctdE5SckE4zCpbWA+rQzsQY8ZsNIaZZc9eHryglYnvz9 /EhQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VQOjfJEe; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id y12-20020a05620a25cc00b0075cc9190379si6053893qko.522.2023.07.15.06.55.57 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 15 Jul 2023 06:55:57 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VQOjfJEe; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qKfiq-0004EW-IN; Sat, 15 Jul 2023 09:54:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qKfiB-00040m-P1 for qemu-devel@nongnu.org; Sat, 15 Jul 2023 09:53:28 -0400 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qKfi6-0001Ck-R2 for qemu-devel@nongnu.org; Sat, 15 Jul 2023 09:53:27 -0400 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-3fbdfda88f4so25769695e9.1 for ; Sat, 15 Jul 2023 06:53:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689429201; x=1692021201; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ucetWZKQxGf1H8/69kqF4wjbJkZDEr6t/e7SdhPKj/g=; b=VQOjfJEeOA3gsNACVRj2PS5yDbhau/EKh4BRRfGld9rhm/CyXjqJtClgofqYhanWam VfPnLiBmwqd+YNS9ZJnQx/kmRnVf/E4lDdM5H6NPS5e0A4ww60Xv1itIv+RHqIxTGpl6 cn/Oy/71liOz04+ShtO1vLUFPU0mteUMMjnWqJQuKg03JwcdG56/3rAqcn11Z33AJkX3 vp1Tahd28istzY7iJThfw/YrjFxSBcaGgkLi/zHpDAxTBN2KFbTQ19Y4n61JWIi3JqqM 0FZC9lVPR8rgqbuadpPEfYEb6LXdchk4ub1KoWDnbnVSi2oiva9jFYw6wzAF7zmZ4Byt 9NgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689429201; x=1692021201; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ucetWZKQxGf1H8/69kqF4wjbJkZDEr6t/e7SdhPKj/g=; b=dtVb2pGtQe7IblAi55T5PQ3Nmz48ECEF7VdkmJZR6haaIG1Za5o7mSplyFWB7YTnG3 lVssF7xD+vGUWFOggY3LqQSvyzdsj5pzWScs7j+385fkKOyv0ksga1+hVFWL0lBHXR6d R1jkkdLnT5roVfI4X75KgbWfO2G94iNw6nWrz/MHqwNYUPskhiA2g/jGFMZc9729Hfxs 6A7NNK3tuED2Y6gV5GavVkvSlzmdqNJqFdmEiyF3MJQezxb7GeW9XHFkEaT2P0fva4aY Cv1kR7wajfaqAzB3w7qPwFQ2nJjNm3ohRe1N7riBSSAutDgNW/MaGdWxqwIFveSQeST0 /a8A== X-Gm-Message-State: ABy/qLaRd6GqRXxKGNNi+JXibpgGk0o9a0yH0fzL9kiEot7XohicoIBo LHCEn438bvX8wp1Pw1xjmiPoB0Lh2ng/0MxCIBxCpQ== X-Received: by 2002:a5d:6603:0:b0:313:ee2e:dae1 with SMTP id n3-20020a5d6603000000b00313ee2edae1mr6207149wru.18.1689429200797; Sat, 15 Jul 2023 06:53:20 -0700 (PDT) Received: from stoup.lan ([51.219.12.49]) by smtp.gmail.com with ESMTPSA id k10-20020a5d66ca000000b00313f9085119sm13838014wrw.113.2023.07.15.06.53.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Jul 2023 06:53:20 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL 01/47] linux-user: Reformat syscall_defs.h Date: Sat, 15 Jul 2023 14:52:31 +0100 Message-Id: <20230715135317.7219-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230715135317.7219-1-richard.henderson@linaro.org> References: <20230715135317.7219-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::336; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x336.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Untabify and re-indent. We had a mix of 2, 3, 4, and 8 space indentation. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- linux-user/syscall_defs.h | 1948 ++++++++++++++++++------------------- 1 file changed, 974 insertions(+), 974 deletions(-) diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index cc37054cb5..e80d54780b 100644 --- a/linux-user/syscall_defs.h +++ b/linux-user/syscall_defs.h @@ -33,18 +33,18 @@ #define TARGET_SYS_SENDMMSG 20 /* sendmmsg() */ #define IPCOP_CALL(VERSION, OP) ((VERSION) << 16 | (OP)) -#define IPCOP_semop 1 -#define IPCOP_semget 2 -#define IPCOP_semctl 3 -#define IPCOP_semtimedop 4 -#define IPCOP_msgsnd 11 -#define IPCOP_msgrcv 12 -#define IPCOP_msgget 13 -#define IPCOP_msgctl 14 -#define IPCOP_shmat 21 -#define IPCOP_shmdt 22 -#define IPCOP_shmget 23 -#define IPCOP_shmctl 24 +#define IPCOP_semop 1 +#define IPCOP_semget 2 +#define IPCOP_semctl 3 +#define IPCOP_semtimedop 4 +#define IPCOP_msgsnd 11 +#define IPCOP_msgrcv 12 +#define IPCOP_msgget 13 +#define IPCOP_msgctl 14 +#define IPCOP_shmat 21 +#define IPCOP_shmdt 22 +#define IPCOP_shmget 23 +#define IPCOP_shmctl 24 #define TARGET_SEMOPM 500 @@ -56,42 +56,42 @@ * this explicit here. Please be sure to use the decoding macros * below from now on. */ -#define TARGET_IOC_NRBITS 8 -#define TARGET_IOC_TYPEBITS 8 +#define TARGET_IOC_NRBITS 8 +#define TARGET_IOC_TYPEBITS 8 -#if (defined(TARGET_I386) && defined(TARGET_ABI32)) \ - || (defined(TARGET_ARM) && defined(TARGET_ABI32)) \ - || (defined(TARGET_SPARC) && defined(TARGET_ABI32)) \ +#if (defined(TARGET_I386) && defined(TARGET_ABI32)) \ + || (defined(TARGET_ARM) && defined(TARGET_ABI32)) \ + || (defined(TARGET_SPARC) && defined(TARGET_ABI32)) \ || defined(TARGET_M68K) || defined(TARGET_SH4) || defined(TARGET_CRIS) - /* 16 bit uid wrappers emulation */ +/* 16 bit uid wrappers emulation */ #define USE_UID16 #define target_id uint16_t #else #define target_id uint32_t #endif -#if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_SH4) \ - || defined(TARGET_M68K) || defined(TARGET_CRIS) \ - || defined(TARGET_S390X) || defined(TARGET_OPENRISC) \ - || defined(TARGET_NIOS2) || defined(TARGET_RISCV) \ +#if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_SH4) \ + || defined(TARGET_M68K) || defined(TARGET_CRIS) \ + || defined(TARGET_S390X) || defined(TARGET_OPENRISC) \ + || defined(TARGET_NIOS2) || defined(TARGET_RISCV) \ || defined(TARGET_XTENSA) || defined(TARGET_LOONGARCH64) -#define TARGET_IOC_SIZEBITS 14 -#define TARGET_IOC_DIRBITS 2 +#define TARGET_IOC_SIZEBITS 14 +#define TARGET_IOC_DIRBITS 2 -#define TARGET_IOC_NONE 0U +#define TARGET_IOC_NONE 0U #define TARGET_IOC_WRITE 1U -#define TARGET_IOC_READ 2U +#define TARGET_IOC_READ 2U -#elif defined(TARGET_PPC) || defined(TARGET_ALPHA) || \ - defined(TARGET_SPARC) || defined(TARGET_MICROBLAZE) || \ - defined(TARGET_MIPS) +#elif defined(TARGET_PPC) || defined(TARGET_ALPHA) || \ + defined(TARGET_SPARC) || defined(TARGET_MICROBLAZE) || \ + defined(TARGET_MIPS) -#define TARGET_IOC_SIZEBITS 13 -#define TARGET_IOC_DIRBITS 3 +#define TARGET_IOC_SIZEBITS 13 +#define TARGET_IOC_DIRBITS 3 -#define TARGET_IOC_NONE 1U -#define TARGET_IOC_READ 2U +#define TARGET_IOC_NONE 1U +#define TARGET_IOC_READ 2U #define TARGET_IOC_WRITE 4U #elif defined(TARGET_HPPA) @@ -115,32 +115,32 @@ #error unsupported CPU #endif -#define TARGET_IOC_NRMASK ((1 << TARGET_IOC_NRBITS)-1) -#define TARGET_IOC_TYPEMASK ((1 << TARGET_IOC_TYPEBITS)-1) -#define TARGET_IOC_SIZEMASK ((1 << TARGET_IOC_SIZEBITS)-1) -#define TARGET_IOC_DIRMASK ((1 << TARGET_IOC_DIRBITS)-1) +#define TARGET_IOC_NRMASK ((1 << TARGET_IOC_NRBITS)-1) +#define TARGET_IOC_TYPEMASK ((1 << TARGET_IOC_TYPEBITS)-1) +#define TARGET_IOC_SIZEMASK ((1 << TARGET_IOC_SIZEBITS)-1) +#define TARGET_IOC_DIRMASK ((1 << TARGET_IOC_DIRBITS)-1) -#define TARGET_IOC_NRSHIFT 0 -#define TARGET_IOC_TYPESHIFT (TARGET_IOC_NRSHIFT+TARGET_IOC_NRBITS) -#define TARGET_IOC_SIZESHIFT (TARGET_IOC_TYPESHIFT+TARGET_IOC_TYPEBITS) -#define TARGET_IOC_DIRSHIFT (TARGET_IOC_SIZESHIFT+TARGET_IOC_SIZEBITS) +#define TARGET_IOC_NRSHIFT 0 +#define TARGET_IOC_TYPESHIFT (TARGET_IOC_NRSHIFT+TARGET_IOC_NRBITS) +#define TARGET_IOC_SIZESHIFT (TARGET_IOC_TYPESHIFT+TARGET_IOC_TYPEBITS) +#define TARGET_IOC_DIRSHIFT (TARGET_IOC_SIZESHIFT+TARGET_IOC_SIZEBITS) -#define TARGET_IOC(dir,type,nr,size) \ - (((dir) << TARGET_IOC_DIRSHIFT) | \ - ((type) << TARGET_IOC_TYPESHIFT) | \ - ((nr) << TARGET_IOC_NRSHIFT) | \ - ((size) << TARGET_IOC_SIZESHIFT)) +#define TARGET_IOC(dir,type,nr,size) \ + (((dir) << TARGET_IOC_DIRSHIFT) | \ + ((type) << TARGET_IOC_TYPESHIFT) | \ + ((nr) << TARGET_IOC_NRSHIFT) | \ + ((size) << TARGET_IOC_SIZESHIFT)) /* used to create numbers */ -#define TARGET_IO(type,nr) TARGET_IOC(TARGET_IOC_NONE,(type),(nr),0) -#define TARGET_IOR(type,nr,size) TARGET_IOC(TARGET_IOC_READ,(type),(nr),sizeof(size)) -#define TARGET_IOW(type,nr,size) TARGET_IOC(TARGET_IOC_WRITE,(type),(nr),sizeof(size)) -#define TARGET_IOWR(type,nr,size) TARGET_IOC(TARGET_IOC_READ|TARGET_IOC_WRITE,(type),(nr),sizeof(size)) +#define TARGET_IO(type,nr) TARGET_IOC(TARGET_IOC_NONE,(type),(nr),0) +#define TARGET_IOR(type,nr,size) TARGET_IOC(TARGET_IOC_READ,(type),(nr),sizeof(size)) +#define TARGET_IOW(type,nr,size) TARGET_IOC(TARGET_IOC_WRITE,(type),(nr),sizeof(size)) +#define TARGET_IOWR(type,nr,size) TARGET_IOC(TARGET_IOC_READ|TARGET_IOC_WRITE,(type),(nr),sizeof(size)) /* the size is automatically computed for these defines */ -#define TARGET_IORU(type,nr) TARGET_IOC(TARGET_IOC_READ,(type),(nr),TARGET_IOC_SIZEMASK) -#define TARGET_IOWU(type,nr) TARGET_IOC(TARGET_IOC_WRITE,(type),(nr),TARGET_IOC_SIZEMASK) -#define TARGET_IOWRU(type,nr) TARGET_IOC(TARGET_IOC_READ|TARGET_IOC_WRITE,(type),(nr),TARGET_IOC_SIZEMASK) +#define TARGET_IORU(type,nr) TARGET_IOC(TARGET_IOC_READ,(type),(nr),TARGET_IOC_SIZEMASK) +#define TARGET_IOWU(type,nr) TARGET_IOC(TARGET_IOC_WRITE,(type),(nr),TARGET_IOC_SIZEMASK) +#define TARGET_IOWRU(type,nr) TARGET_IOC(TARGET_IOC_READ|TARGET_IOC_WRITE,(type),(nr),TARGET_IOC_SIZEMASK) struct target_sockaddr { abi_ushort sa_family; @@ -174,12 +174,12 @@ struct target_in_addr { }; struct target_sockaddr_in { - abi_ushort sin_family; - abi_short sin_port; /* big endian */ - struct target_in_addr sin_addr; - uint8_t __pad[sizeof(struct target_sockaddr) - - sizeof(abi_ushort) - sizeof(abi_short) - - sizeof(struct target_in_addr)]; + abi_ushort sin_family; + abi_short sin_port; /* big endian */ + struct target_in_addr sin_addr; + uint8_t __pad[sizeof(struct target_sockaddr) - + sizeof(abi_ushort) - sizeof(abi_short) - + sizeof(struct target_in_addr)]; }; struct target_sockaddr_in6 { @@ -360,12 +360,12 @@ struct target_iovec { }; struct target_msghdr { - abi_long msg_name; /* Socket name */ - int msg_namelen; /* Length of name */ - abi_long msg_iov; /* Data blocks */ - abi_long msg_iovlen; /* Number of blocks */ - abi_long msg_control; /* Per protocol magic (eg BSD file descriptor passing) */ - abi_long msg_controllen; /* Length of cmsg list */ + abi_long msg_name; /* Socket name */ + int msg_namelen; /* Length of name */ + abi_long msg_iov; /* Data blocks */ + abi_long msg_iovlen; /* Number of blocks */ + abi_long msg_control; /* Per protocol magic (eg BSD file descriptor passing) */ + abi_long msg_controllen; /* Length of cmsg list */ unsigned int msg_flags; }; @@ -376,10 +376,10 @@ struct target_cmsghdr { }; #define TARGET_CMSG_DATA(cmsg) ((unsigned char *) ((struct target_cmsghdr *) (cmsg) + 1)) -#define TARGET_CMSG_NXTHDR(mhdr, cmsg, cmsg_start) \ - __target_cmsg_nxthdr(mhdr, cmsg, cmsg_start) -#define TARGET_CMSG_ALIGN(len) (((len) + sizeof (abi_long) - 1) \ - & (size_t) ~(sizeof (abi_long) - 1)) +#define TARGET_CMSG_NXTHDR(mhdr, cmsg, cmsg_start) \ + __target_cmsg_nxthdr(mhdr, cmsg, cmsg_start) +#define TARGET_CMSG_ALIGN(len) (((len) + sizeof (abi_long) - 1) \ + & (size_t) ~(sizeof (abi_long) - 1)) #define TARGET_CMSG_SPACE(len) (sizeof(struct target_cmsghdr) + \ TARGET_CMSG_ALIGN(len)) #define TARGET_CMSG_LEN(len) (sizeof(struct target_cmsghdr) + (len)) @@ -389,16 +389,16 @@ __target_cmsg_nxthdr(struct target_msghdr *__mhdr, struct target_cmsghdr *__cmsg, struct target_cmsghdr *__cmsg_start) { - struct target_cmsghdr *__ptr; + struct target_cmsghdr *__ptr; - __ptr = (struct target_cmsghdr *)((unsigned char *) __cmsg - + TARGET_CMSG_ALIGN (tswapal(__cmsg->cmsg_len))); - if ((unsigned long)((char *)(__ptr+1) - (char *)__cmsg_start) - > tswapal(__mhdr->msg_controllen)) { - /* No more entries. */ - return (struct target_cmsghdr *)0; - } - return __ptr; + __ptr = (struct target_cmsghdr *)((unsigned char *) __cmsg + + TARGET_CMSG_ALIGN (tswapal(__cmsg->cmsg_len))); + if ((unsigned long)((char *)(__ptr+1) - (char *)__cmsg_start) + > tswapal(__mhdr->msg_controllen)) { + /* No more entries. */ + return (struct target_cmsghdr *)0; + } + return __ptr; } struct target_mmsghdr { @@ -407,55 +407,55 @@ struct target_mmsghdr { }; struct target_rusage { - struct target_timeval ru_utime; /* user time used */ - struct target_timeval ru_stime; /* system time used */ - abi_long ru_maxrss; /* maximum resident set size */ - abi_long ru_ixrss; /* integral shared memory size */ - abi_long ru_idrss; /* integral unshared data size */ - abi_long ru_isrss; /* integral unshared stack size */ - abi_long ru_minflt; /* page reclaims */ - abi_long ru_majflt; /* page faults */ - abi_long ru_nswap; /* swaps */ - abi_long ru_inblock; /* block input operations */ - abi_long ru_oublock; /* block output operations */ - abi_long ru_msgsnd; /* messages sent */ - abi_long ru_msgrcv; /* messages received */ - abi_long ru_nsignals; /* signals received */ - abi_long ru_nvcsw; /* voluntary context switches */ - abi_long ru_nivcsw; /* involuntary " */ + struct target_timeval ru_utime; /* user time used */ + struct target_timeval ru_stime; /* system time used */ + abi_long ru_maxrss; /* maximum resident set size */ + abi_long ru_ixrss; /* integral shared memory size */ + abi_long ru_idrss; /* integral unshared data size */ + abi_long ru_isrss; /* integral unshared stack size */ + abi_long ru_minflt; /* page reclaims */ + abi_long ru_majflt; /* page faults */ + abi_long ru_nswap; /* swaps */ + abi_long ru_inblock; /* block input operations */ + abi_long ru_oublock; /* block output operations */ + abi_long ru_msgsnd; /* messages sent */ + abi_long ru_msgrcv; /* messages received */ + abi_long ru_nsignals; /* signals received */ + abi_long ru_nvcsw; /* voluntary context switches */ + abi_long ru_nivcsw; /* involuntary " */ }; typedef struct { - int val[2]; + int val[2]; } kernel_fsid_t; struct target_dirent { - abi_long d_ino; - abi_long d_off; - unsigned short d_reclen; - char d_name[]; + abi_long d_ino; + abi_long d_off; + unsigned short d_reclen; + char d_name[]; }; struct target_dirent64 { - abi_ullong d_ino; - abi_llong d_off; - abi_ushort d_reclen; - unsigned char d_type; - char d_name[]; + abi_ullong d_ino; + abi_llong d_off; + abi_ushort d_reclen; + unsigned char d_type; + char d_name[]; }; /* mostly generic signal stuff */ -#define TARGET_SIG_DFL ((abi_long)0) /* default signal handling */ -#define TARGET_SIG_IGN ((abi_long)1) /* ignore signal */ -#define TARGET_SIG_ERR ((abi_long)-1) /* error return from signal */ +#define TARGET_SIG_DFL ((abi_long)0) /* default signal handling */ +#define TARGET_SIG_IGN ((abi_long)1) /* ignore signal */ +#define TARGET_SIG_ERR ((abi_long)-1) /* error return from signal */ #ifdef TARGET_MIPS -#define TARGET_NSIG 128 +#define TARGET_NSIG 128 #else -#define TARGET_NSIG 64 +#define TARGET_NSIG 64 #endif -#define TARGET_NSIG_BPW TARGET_ABI_BITS +#define TARGET_NSIG_BPW TARGET_ABI_BITS #define TARGET_NSIG_WORDS (TARGET_NSIG / TARGET_NSIG_BPW) typedef struct { @@ -508,71 +508,71 @@ typedef abi_ulong target_old_sa_flags; #if defined(TARGET_MIPS) struct target_sigaction { - uint32_t sa_flags; + uint32_t sa_flags; #if defined(TARGET_ABI_MIPSN32) - uint32_t _sa_handler; + uint32_t _sa_handler; #else - abi_ulong _sa_handler; + abi_ulong _sa_handler; #endif - target_sigset_t sa_mask; + target_sigset_t sa_mask; #ifdef TARGET_ARCH_HAS_SA_RESTORER - /* ??? This is always present, but ignored unless O32. */ - abi_ulong sa_restorer; + /* ??? This is always present, but ignored unless O32. */ + abi_ulong sa_restorer; #endif }; #else struct target_old_sigaction { - abi_ulong _sa_handler; - abi_ulong sa_mask; - target_old_sa_flags sa_flags; + abi_ulong _sa_handler; + abi_ulong sa_mask; + target_old_sa_flags sa_flags; #ifdef TARGET_ARCH_HAS_SA_RESTORER - abi_ulong sa_restorer; + abi_ulong sa_restorer; #endif }; struct target_sigaction { - abi_ulong _sa_handler; - abi_ulong sa_flags; + abi_ulong _sa_handler; + abi_ulong sa_flags; #ifdef TARGET_ARCH_HAS_SA_RESTORER - abi_ulong sa_restorer; + abi_ulong sa_restorer; #endif - target_sigset_t sa_mask; + target_sigset_t sa_mask; #ifdef TARGET_ARCH_HAS_KA_RESTORER - abi_ulong ka_restorer; + abi_ulong ka_restorer; #endif }; #endif typedef union target_sigval { - int sival_int; - abi_ulong sival_ptr; + int sival_int; + abi_ulong sival_ptr; } target_sigval_t; #if 0 #if defined (TARGET_SPARC) typedef struct { - struct { - abi_ulong psr; - abi_ulong pc; - abi_ulong npc; - abi_ulong y; - abi_ulong u_regs[16]; /* globals and ins */ - } si_regs; - int si_mask; + struct { + abi_ulong psr; + abi_ulong pc; + abi_ulong npc; + abi_ulong y; + abi_ulong u_regs[16]; /* globals and ins */ + } si_regs; + int si_mask; } __siginfo_t; typedef struct { - unsigned long si_float_regs [32]; - unsigned long si_fsr; - unsigned long si_fpqdepth; - struct { - unsigned long *insn_addr; - unsigned long insn; - } si_fpqueue [16]; + unsigned long si_float_regs [32]; + unsigned long si_fsr; + unsigned long si_fpqdepth; + struct { + unsigned long *insn_addr; + unsigned long insn; + } si_fpqueue [16]; } __siginfo_fpu_t; #endif #endif -#define TARGET_SI_MAX_SIZE 128 +#define TARGET_SI_MAX_SIZE 128 #if TARGET_ABI_BITS == 32 #define TARGET_SI_PREAMBLE_SIZE (3 * sizeof(int)) @@ -599,82 +599,82 @@ typedef struct { typedef struct target_siginfo { #ifdef TARGET_MIPS - int si_signo; - int si_code; - int si_errno; + int si_signo; + int si_code; + int si_errno; #else - int si_signo; - int si_errno; - int si_code; + int si_signo; + int si_errno; + int si_code; #endif - union { - int _pad[TARGET_SI_PAD_SIZE]; + union { + int _pad[TARGET_SI_PAD_SIZE]; - /* kill() */ - struct { - pid_t _pid; /* sender's pid */ - uid_t _uid; /* sender's uid */ - } _kill; + /* kill() */ + struct { + pid_t _pid; /* sender's pid */ + uid_t _uid; /* sender's uid */ + } _kill; - /* POSIX.1b timers */ - struct { - unsigned int _timer1; - unsigned int _timer2; - } _timer; + /* POSIX.1b timers */ + struct { + unsigned int _timer1; + unsigned int _timer2; + } _timer; - /* POSIX.1b signals */ - struct { - pid_t _pid; /* sender's pid */ - uid_t _uid; /* sender's uid */ - target_sigval_t _sigval; - } _rt; + /* POSIX.1b signals */ + struct { + pid_t _pid; /* sender's pid */ + uid_t _uid; /* sender's uid */ + target_sigval_t _sigval; + } _rt; - /* SIGCHLD */ - struct { - pid_t _pid; /* which child */ - uid_t _uid; /* sender's uid */ - int _status; /* exit code */ - target_clock_t _utime; - target_clock_t _stime; - } _sigchld; + /* SIGCHLD */ + struct { + pid_t _pid; /* which child */ + uid_t _uid; /* sender's uid */ + int _status; /* exit code */ + target_clock_t _utime; + target_clock_t _stime; + } _sigchld; - /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */ - struct { - abi_ulong _addr; /* faulting insn/memory ref. */ - } _sigfault; + /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */ + struct { + abi_ulong _addr; /* faulting insn/memory ref. */ + } _sigfault; - /* SIGPOLL */ - struct { - int _band; /* POLL_IN, POLL_OUT, POLL_MSG */ - int _fd; - } _sigpoll; - } _sifields; + /* SIGPOLL */ + struct { + int _band; /* POLL_IN, POLL_OUT, POLL_MSG */ + int _fd; + } _sigpoll; + } _sifields; } target_siginfo_t; /* * si_code values * Digital reserves positive values for kernel-generated signals. */ -#define TARGET_SI_USER 0 /* sent by kill, sigsend, raise */ -#define TARGET_SI_KERNEL 0x80 /* sent by the kernel from somewhere */ -#define TARGET_SI_QUEUE -1 /* sent by sigqueue */ +#define TARGET_SI_USER 0 /* sent by kill, sigsend, raise */ +#define TARGET_SI_KERNEL 0x80 /* sent by the kernel from somewhere */ +#define TARGET_SI_QUEUE -1 /* sent by sigqueue */ #define TARGET_SI_TIMER -2 /* sent by timer expiration */ -#define TARGET_SI_MESGQ -3 /* sent by real time mesq state change */ -#define TARGET_SI_ASYNCIO -4 /* sent by AIO completion */ -#define TARGET_SI_SIGIO -5 /* sent by queued SIGIO */ +#define TARGET_SI_MESGQ -3 /* sent by real time mesq state change */ +#define TARGET_SI_ASYNCIO -4 /* sent by AIO completion */ +#define TARGET_SI_SIGIO -5 /* sent by queued SIGIO */ /* * SIGILL si_codes */ -#define TARGET_ILL_ILLOPC (1) /* illegal opcode */ -#define TARGET_ILL_ILLOPN (2) /* illegal operand */ -#define TARGET_ILL_ILLADR (3) /* illegal addressing mode */ -#define TARGET_ILL_ILLTRP (4) /* illegal trap */ -#define TARGET_ILL_PRVOPC (5) /* privileged opcode */ -#define TARGET_ILL_PRVREG (6) /* privileged register */ -#define TARGET_ILL_COPROC (7) /* coprocessor error */ -#define TARGET_ILL_BADSTK (8) /* internal stack error */ +#define TARGET_ILL_ILLOPC (1) /* illegal opcode */ +#define TARGET_ILL_ILLOPN (2) /* illegal operand */ +#define TARGET_ILL_ILLADR (3) /* illegal addressing mode */ +#define TARGET_ILL_ILLTRP (4) /* illegal trap */ +#define TARGET_ILL_PRVOPC (5) /* privileged opcode */ +#define TARGET_ILL_PRVREG (6) /* privileged register */ +#define TARGET_ILL_COPROC (7) /* coprocessor error */ +#define TARGET_ILL_BADSTK (8) /* internal stack error */ /* * SIGFPE si_codes @@ -700,9 +700,9 @@ typedef struct target_siginfo { /* * SIGBUS si_codes */ -#define TARGET_BUS_ADRALN (1) /* invalid address alignment */ -#define TARGET_BUS_ADRERR (2) /* non-existent physical address */ -#define TARGET_BUS_OBJERR (3) /* object specific hardware error */ +#define TARGET_BUS_ADRALN (1) /* invalid address alignment */ +#define TARGET_BUS_ADRERR (2) /* non-existent physical address */ +#define TARGET_BUS_OBJERR (3) /* object specific hardware error */ /* hardware memory error consumed on a machine check: action required */ #define TARGET_BUS_MCEERR_AR (4) /* hardware memory error detected in process but not consumed: action optional*/ @@ -711,8 +711,8 @@ typedef struct target_siginfo { /* * SIGTRAP si_codes */ -#define TARGET_TRAP_BRKPT (1) /* process breakpoint */ -#define TARGET_TRAP_TRACE (2) /* process trace trap */ +#define TARGET_TRAP_BRKPT (1) /* process breakpoint */ +#define TARGET_TRAP_TRACE (2) /* process trace trap */ #define TARGET_TRAP_BRANCH (3) /* process taken branch trap */ #define TARGET_TRAP_HWBKPT (4) /* hardware breakpoint/watchpoint */ #define TARGET_TRAP_UNK (5) /* undiagnosed trap */ @@ -731,18 +731,18 @@ struct target_pollfd { }; /* virtual terminal ioctls */ -#define TARGET_KIOCSOUND 0x4B2F /* start sound generation (0 for off) */ -#define TARGET_KDMKTONE 0x4B30 /* generate tone */ +#define TARGET_KIOCSOUND 0x4B2F /* start sound generation (0 for off) */ +#define TARGET_KDMKTONE 0x4B30 /* generate tone */ #define TARGET_KDGKBTYPE 0x4b33 #define TARGET_KDSETMODE 0x4b3a #define TARGET_KDGKBMODE 0x4b44 #define TARGET_KDSKBMODE 0x4b45 -#define TARGET_KDGKBENT 0x4B46 /* gets one entry in translation table */ -#define TARGET_KDGKBSENT 0x4B48 /* gets one function key string entry */ -#define TARGET_KDGKBLED 0x4B64 /* get led flags (not lights) */ -#define TARGET_KDSKBLED 0x4B65 /* set led flags (not lights) */ -#define TARGET_KDGETLED 0x4B31 /* return current led state */ -#define TARGET_KDSETLED 0x4B32 /* set led state [lights, not flags] */ +#define TARGET_KDGKBENT 0x4B46 /* gets one entry in translation table */ +#define TARGET_KDGKBSENT 0x4B48 /* gets one function key string entry */ +#define TARGET_KDGKBLED 0x4B64 /* get led flags (not lights) */ +#define TARGET_KDSKBLED 0x4B65 /* set led flags (not lights) */ +#define TARGET_KDGETLED 0x4B31 /* return current led state */ +#define TARGET_KDSETLED 0x4B32 /* set led state [lights, not flags] */ #define TARGET_KDSIGACCEPT 0x4B4E struct target_rtc_pll_info { @@ -774,15 +774,15 @@ struct target_rtc_pll_info { #define TARGET_RTC_EPOCH_SET TARGET_IOW('p', 0x0e, abi_ulong) #define TARGET_RTC_WKALM_RD TARGET_IOR('p', 0x10, struct rtc_wkalrm) #define TARGET_RTC_WKALM_SET TARGET_IOW('p', 0x0f, struct rtc_wkalrm) -#define TARGET_RTC_PLL_GET TARGET_IOR('p', 0x11, \ +#define TARGET_RTC_PLL_GET TARGET_IOR('p', 0x11, \ struct target_rtc_pll_info) -#define TARGET_RTC_PLL_SET TARGET_IOW('p', 0x12, \ +#define TARGET_RTC_PLL_SET TARGET_IOW('p', 0x12, \ struct target_rtc_pll_info) #define TARGET_RTC_VL_READ TARGET_IOR('p', 0x13, int) #define TARGET_RTC_VL_CLR TARGET_IO('p', 0x14) -#if defined(TARGET_ALPHA) || defined(TARGET_MIPS) || defined(TARGET_SH4) || \ - defined(TARGET_XTENSA) +#if defined(TARGET_ALPHA) || defined(TARGET_MIPS) || defined(TARGET_SH4) || \ + defined(TARGET_XTENSA) #define TARGET_FIOGETOWN TARGET_IOR('f', 123, int) #define TARGET_FIOSETOWN TARGET_IOW('f', 124, int) #define TARGET_SIOCATMARK TARGET_IOR('s', 7, int) @@ -932,8 +932,8 @@ struct target_rtc_pll_info { #define TARGET_BLKBSZGET TARGET_IOR(0x12, 112, abi_ulong) #define TARGET_BLKBSZSET TARGET_IOW(0x12, 113, abi_ulong) #define TARGET_BLKGETSIZE64 TARGET_IOR(0x12,114,abi_ulong) - /* return device size in bytes - (u64 *arg) */ +/* return device size in bytes + (u64 *arg) */ #define TARGET_BLKDISCARD TARGET_IO(0x12, 119) #define TARGET_BLKIOMIN TARGET_IO(0x12, 120) @@ -991,11 +991,11 @@ struct target_rtc_pll_info { #define TARGET_BTRFS_IOC_SUBVOL_CREATE TARGET_IOWU(BTRFS_IOCTL_MAGIC, 14) #define TARGET_BTRFS_IOC_SNAP_DESTROY TARGET_IOWU(BTRFS_IOCTL_MAGIC, 15) #define TARGET_BTRFS_IOC_INO_LOOKUP TARGET_IOWRU(BTRFS_IOCTL_MAGIC, 18) -#define TARGET_BTRFS_IOC_DEFAULT_SUBVOL TARGET_IOW(BTRFS_IOCTL_MAGIC, 19,\ +#define TARGET_BTRFS_IOC_DEFAULT_SUBVOL TARGET_IOW(BTRFS_IOCTL_MAGIC, 19, \ abi_ullong) -#define TARGET_BTRFS_IOC_SUBVOL_GETFLAGS TARGET_IOR(BTRFS_IOCTL_MAGIC, 25,\ +#define TARGET_BTRFS_IOC_SUBVOL_GETFLAGS TARGET_IOR(BTRFS_IOCTL_MAGIC, 25, \ abi_ullong) -#define TARGET_BTRFS_IOC_SUBVOL_SETFLAGS TARGET_IOW(BTRFS_IOCTL_MAGIC, 26,\ +#define TARGET_BTRFS_IOC_SUBVOL_SETFLAGS TARGET_IOW(BTRFS_IOCTL_MAGIC, 26, \ abi_ullong) #define TARGET_BTRFS_IOC_SCRUB TARGET_IOWRU(BTRFS_IOCTL_MAGIC, 27) #define TARGET_BTRFS_IOC_SCRUB_CANCEL TARGET_IO(BTRFS_IOCTL_MAGIC, 28) @@ -1049,56 +1049,56 @@ struct target_rtc_pll_info { #define TARGET_USBDEVFS_GET_SPEED TARGET_IO('U', 31) /* cdrom commands */ -#define TARGET_CDROMPAUSE 0x5301 /* Pause Audio Operation */ -#define TARGET_CDROMRESUME 0x5302 /* Resume paused Audio Operation */ -#define TARGET_CDROMPLAYMSF 0x5303 /* Play Audio MSF (struct cdrom_msf) */ -#define TARGET_CDROMPLAYTRKIND 0x5304 /* Play Audio Track/index - (struct cdrom_ti) */ -#define TARGET_CDROMREADTOCHDR 0x5305 /* Read TOC header - (struct cdrom_tochdr) */ -#define TARGET_CDROMREADTOCENTRY 0x5306 /* Read TOC entry - (struct cdrom_tocentry) */ -#define TARGET_CDROMSTOP 0x5307 /* Stop the cdrom drive */ -#define TARGET_CDROMSTART 0x5308 /* Start the cdrom drive */ -#define TARGET_CDROMEJECT 0x5309 /* Ejects the cdrom media */ -#define TARGET_CDROMVOLCTRL 0x530a /* Control output volume - (struct cdrom_volctrl) */ -#define TARGET_CDROMSUBCHNL 0x530b /* Read subchannel data - (struct cdrom_subchnl) */ -#define TARGET_CDROMREADMODE2 0x530c /* Read TARGET_CDROM mode 2 data (2336 Bytes) - (struct cdrom_read) */ -#define TARGET_CDROMREADMODE1 0x530d /* Read TARGET_CDROM mode 1 data (2048 Bytes) - (struct cdrom_read) */ -#define TARGET_CDROMREADAUDIO 0x530e /* (struct cdrom_read_audio) */ -#define TARGET_CDROMEJECT_SW 0x530f /* enable(1)/disable(0) auto-ejecting */ -#define TARGET_CDROMMULTISESSION 0x5310 /* Obtain the start-of-last-session - address of multi session disks - (struct cdrom_multisession) */ -#define TARGET_CDROM_GET_MCN 0x5311 /* Obtain the "Universal Product Code" - if available (struct cdrom_mcn) */ -#define TARGET_CDROM_GET_UPC TARGET_CDROM_GET_MCN /* This one is deprecated, - but here anyway for compatibility */ -#define TARGET_CDROMRESET 0x5312 /* hard-reset the drive */ -#define TARGET_CDROMVOLREAD 0x5313 /* Get the drive's volume setting - (struct cdrom_volctrl) */ -#define TARGET_CDROMREADRAW 0x5314 /* read data in raw mode (2352 Bytes) - (struct cdrom_read) */ +#define TARGET_CDROMPAUSE 0x5301 /* Pause Audio Operation */ +#define TARGET_CDROMRESUME 0x5302 /* Resume paused Audio Operation */ +#define TARGET_CDROMPLAYMSF 0x5303 /* Play Audio MSF (struct cdrom_msf) */ +#define TARGET_CDROMPLAYTRKIND 0x5304 /* Play Audio Track/index + (struct cdrom_ti) */ +#define TARGET_CDROMREADTOCHDR 0x5305 /* Read TOC header + (struct cdrom_tochdr) */ +#define TARGET_CDROMREADTOCENTRY 0x5306 /* Read TOC entry + (struct cdrom_tocentry) */ +#define TARGET_CDROMSTOP 0x5307 /* Stop the cdrom drive */ +#define TARGET_CDROMSTART 0x5308 /* Start the cdrom drive */ +#define TARGET_CDROMEJECT 0x5309 /* Ejects the cdrom media */ +#define TARGET_CDROMVOLCTRL 0x530a /* Control output volume + (struct cdrom_volctrl) */ +#define TARGET_CDROMSUBCHNL 0x530b /* Read subchannel data + (struct cdrom_subchnl) */ +#define TARGET_CDROMREADMODE2 0x530c /* Read TARGET_CDROM mode 2 data (2336 Bytes) + (struct cdrom_read) */ +#define TARGET_CDROMREADMODE1 0x530d /* Read TARGET_CDROM mode 1 data (2048 Bytes) + (struct cdrom_read) */ +#define TARGET_CDROMREADAUDIO 0x530e /* (struct cdrom_read_audio) */ +#define TARGET_CDROMEJECT_SW 0x530f /* enable(1)/disable(0) auto-ejecting */ +#define TARGET_CDROMMULTISESSION 0x5310 /* Obtain the start-of-last-session + address of multi session disks + (struct cdrom_multisession) */ +#define TARGET_CDROM_GET_MCN 0x5311 /* Obtain the "Universal Product Code" + if available (struct cdrom_mcn) */ +#define TARGET_CDROM_GET_UPC TARGET_CDROM_GET_MCN /* This one is deprecated, + but here anyway for compatibility */ +#define TARGET_CDROMRESET 0x5312 /* hard-reset the drive */ +#define TARGET_CDROMVOLREAD 0x5313 /* Get the drive's volume setting + (struct cdrom_volctrl) */ +#define TARGET_CDROMREADRAW 0x5314 /* read data in raw mode (2352 Bytes) + (struct cdrom_read) */ /* * These ioctls are used only used in aztcd.c and optcd.c */ -#define TARGET_CDROMREADCOOKED 0x5315 /* read data in cooked mode */ -#define TARGET_CDROMSEEK 0x5316 /* seek msf address */ +#define TARGET_CDROMREADCOOKED 0x5315 /* read data in cooked mode */ +#define TARGET_CDROMSEEK 0x5316 /* seek msf address */ /* * This ioctl is only used by the scsi-cd driver. - It is for playing audio in logical block addressing mode. - */ -#define TARGET_CDROMPLAYBLK 0x5317 /* (struct cdrom_blk) */ + It is for playing audio in logical block addressing mode. +*/ +#define TARGET_CDROMPLAYBLK 0x5317 /* (struct cdrom_blk) */ /* * These ioctls are only used in optcd.c */ -#define TARGET_CDROMREADALL 0x5318 /* read all 2646 bytes */ +#define TARGET_CDROMREADALL 0x5318 /* read all 2646 bytes */ /* * These ioctls are (now) only in ide-cd.c for controlling @@ -1115,35 +1115,35 @@ struct target_rtc_pll_info { * They _will_ be adopted by all CD-ROM drivers, when all the CD-ROM * drivers are eventually ported to the uniform CD-ROM driver interface. */ -#define TARGET_CDROMCLOSETRAY 0x5319 /* pendant of CDROMEJECT */ -#define TARGET_CDROM_SET_OPTIONS 0x5320 /* Set behavior options */ -#define TARGET_CDROM_CLEAR_OPTIONS 0x5321 /* Clear behavior options */ -#define TARGET_CDROM_SELECT_SPEED 0x5322 /* Set the CD-ROM speed */ -#define TARGET_CDROM_SELECT_DISC 0x5323 /* Select disc (for juke-boxes) */ -#define TARGET_CDROM_MEDIA_CHANGED 0x5325 /* Check is media changed */ -#define TARGET_CDROM_DRIVE_STATUS 0x5326 /* Get tray position, etc. */ -#define TARGET_CDROM_DISC_STATUS 0x5327 /* Get disc type, etc. */ +#define TARGET_CDROMCLOSETRAY 0x5319 /* pendant of CDROMEJECT */ +#define TARGET_CDROM_SET_OPTIONS 0x5320 /* Set behavior options */ +#define TARGET_CDROM_CLEAR_OPTIONS 0x5321 /* Clear behavior options */ +#define TARGET_CDROM_SELECT_SPEED 0x5322 /* Set the CD-ROM speed */ +#define TARGET_CDROM_SELECT_DISC 0x5323 /* Select disc (for juke-boxes) */ +#define TARGET_CDROM_MEDIA_CHANGED 0x5325 /* Check is media changed */ +#define TARGET_CDROM_DRIVE_STATUS 0x5326 /* Get tray position, etc. */ +#define TARGET_CDROM_DISC_STATUS 0x5327 /* Get disc type, etc. */ #define TARGET_CDROM_CHANGER_NSLOTS 0x5328 /* Get number of slots */ -#define TARGET_CDROM_LOCKDOOR 0x5329 /* lock or unlock door */ -#define TARGET_CDROM_DEBUG 0x5330 /* Turn debug messages on/off */ -#define TARGET_CDROM_GET_CAPABILITY 0x5331 /* get capabilities */ +#define TARGET_CDROM_LOCKDOOR 0x5329 /* lock or unlock door */ +#define TARGET_CDROM_DEBUG 0x5330 /* Turn debug messages on/off */ +#define TARGET_CDROM_GET_CAPABILITY 0x5331 /* get capabilities */ /* Note that scsi/scsi_ioctl.h also uses 0x5382 - 0x5386. * Future CDROM ioctls should be kept below 0x537F */ /* This ioctl is only used by sbpcd at the moment */ -#define TARGET_CDROMAUDIOBUFSIZ 0x5382 /* set the audio buffer size */ - /* conflict with SCSI_IOCTL_GET_IDLUN */ +#define TARGET_CDROMAUDIOBUFSIZ 0x5382 /* set the audio buffer size */ +/* conflict with SCSI_IOCTL_GET_IDLUN */ /* DVD-ROM Specific ioctls */ -#define TARGET_DVD_READ_STRUCT 0x5390 /* Read structure */ -#define TARGET_DVD_WRITE_STRUCT 0x5391 /* Write structure */ -#define TARGET_DVD_AUTH 0x5392 /* Authentication */ +#define TARGET_DVD_READ_STRUCT 0x5390 /* Read structure */ +#define TARGET_DVD_WRITE_STRUCT 0x5391 /* Write structure */ +#define TARGET_DVD_AUTH 0x5392 /* Authentication */ -#define TARGET_CDROM_SEND_PACKET 0x5393 /* send a packet to the drive */ -#define TARGET_CDROM_NEXT_WRITABLE 0x5394 /* get next writable block */ -#define TARGET_CDROM_LAST_WRITTEN 0x5395 /* get last block written on disc */ +#define TARGET_CDROM_SEND_PACKET 0x5393 /* send a packet to the drive */ +#define TARGET_CDROM_NEXT_WRITABLE 0x5394 /* get next writable block */ +#define TARGET_CDROM_LAST_WRITTEN 0x5395 /* get last block written on disc */ /* HD commands */ @@ -1234,19 +1234,19 @@ struct target_rtc_pll_info { #define TARGET_NCC 8 struct target_termio { - unsigned short c_iflag; /* input mode flags */ - unsigned short c_oflag; /* output mode flags */ - unsigned short c_cflag; /* control mode flags */ - unsigned short c_lflag; /* local mode flags */ - unsigned char c_line; /* line discipline */ - unsigned char c_cc[TARGET_NCC]; /* control characters */ + unsigned short c_iflag; /* input mode flags */ + unsigned short c_oflag; /* output mode flags */ + unsigned short c_cflag; /* control mode flags */ + unsigned short c_lflag; /* local mode flags */ + unsigned char c_line; /* line discipline */ + unsigned char c_cc[TARGET_NCC]; /* control characters */ }; struct target_winsize { - unsigned short ws_row; - unsigned short ws_col; - unsigned short ws_xpixel; - unsigned short ws_ypixel; + unsigned short ws_row; + unsigned short ws_col; + unsigned short ws_xpixel; + unsigned short ws_ypixel; }; #include "termbits.h" @@ -1263,115 +1263,115 @@ struct target_winsize { #endif /* Common */ -#define TARGET_MAP_SHARED 0x01 /* Share changes */ -#define TARGET_MAP_PRIVATE 0x02 /* Changes are private */ +#define TARGET_MAP_SHARED 0x01 /* Share changes */ +#define TARGET_MAP_PRIVATE 0x02 /* Changes are private */ #if defined(TARGET_HPPA) -#define TARGET_MAP_TYPE 0x03 /* Mask for type of mapping */ +#define TARGET_MAP_TYPE 0x03 /* Mask for type of mapping */ #else -#define TARGET_MAP_TYPE 0x0f /* Mask for type of mapping */ +#define TARGET_MAP_TYPE 0x0f /* Mask for type of mapping */ #endif /* Target specific */ #if defined(TARGET_MIPS) -#define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */ -#define TARGET_MAP_ANONYMOUS 0x0800 /* don't use a file */ -#define TARGET_MAP_GROWSDOWN 0x1000 /* stack-like segment */ -#define TARGET_MAP_DENYWRITE 0x2000 /* ETXTBSY */ -#define TARGET_MAP_EXECUTABLE 0x4000 /* mark it as an executable */ -#define TARGET_MAP_LOCKED 0x8000 /* pages are locked */ -#define TARGET_MAP_NORESERVE 0x0400 /* don't check for reservations */ -#define TARGET_MAP_POPULATE 0x10000 /* populate (prefault) pagetables */ -#define TARGET_MAP_NONBLOCK 0x20000 /* do not block on IO */ +#define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */ +#define TARGET_MAP_ANONYMOUS 0x0800 /* don't use a file */ +#define TARGET_MAP_GROWSDOWN 0x1000 /* stack-like segment */ +#define TARGET_MAP_DENYWRITE 0x2000 /* ETXTBSY */ +#define TARGET_MAP_EXECUTABLE 0x4000 /* mark it as an executable */ +#define TARGET_MAP_LOCKED 0x8000 /* pages are locked */ +#define TARGET_MAP_NORESERVE 0x0400 /* don't check for reservations */ +#define TARGET_MAP_POPULATE 0x10000 /* populate (prefault) pagetables */ +#define TARGET_MAP_NONBLOCK 0x20000 /* do not block on IO */ #define TARGET_MAP_STACK 0x40000 /* ignored */ #define TARGET_MAP_HUGETLB 0x80000 /* create a huge page mapping */ #elif defined(TARGET_PPC) -#define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */ -#define TARGET_MAP_ANONYMOUS 0x20 /* don't use a file */ -#define TARGET_MAP_GROWSDOWN 0x0100 /* stack-like segment */ -#define TARGET_MAP_DENYWRITE 0x0800 /* ETXTBSY */ -#define TARGET_MAP_EXECUTABLE 0x1000 /* mark it as an executable */ -#define TARGET_MAP_LOCKED 0x0080 /* pages are locked */ -#define TARGET_MAP_NORESERVE 0x0040 /* don't check for reservations */ -#define TARGET_MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ -#define TARGET_MAP_NONBLOCK 0x10000 /* do not block on IO */ +#define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */ +#define TARGET_MAP_ANONYMOUS 0x20 /* don't use a file */ +#define TARGET_MAP_GROWSDOWN 0x0100 /* stack-like segment */ +#define TARGET_MAP_DENYWRITE 0x0800 /* ETXTBSY */ +#define TARGET_MAP_EXECUTABLE 0x1000 /* mark it as an executable */ +#define TARGET_MAP_LOCKED 0x0080 /* pages are locked */ +#define TARGET_MAP_NORESERVE 0x0040 /* don't check for reservations */ +#define TARGET_MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ +#define TARGET_MAP_NONBLOCK 0x10000 /* do not block on IO */ #define TARGET_MAP_STACK 0x20000 /* ignored */ #define TARGET_MAP_HUGETLB 0x40000 /* create a huge page mapping */ #elif defined(TARGET_ALPHA) -#define TARGET_MAP_ANONYMOUS 0x10 /* don't use a file */ -#define TARGET_MAP_FIXED 0x100 /* Interpret addr exactly */ -#define TARGET_MAP_GROWSDOWN 0x01000 /* stack-like segment */ -#define TARGET_MAP_DENYWRITE 0x02000 /* ETXTBSY */ -#define TARGET_MAP_EXECUTABLE 0x04000 /* mark it as an executable */ -#define TARGET_MAP_LOCKED 0x08000 /* lock the mapping */ -#define TARGET_MAP_NORESERVE 0x10000 /* no check for reservations */ -#define TARGET_MAP_POPULATE 0x20000 /* pop (prefault) pagetables */ -#define TARGET_MAP_NONBLOCK 0x40000 /* do not block on IO */ +#define TARGET_MAP_ANONYMOUS 0x10 /* don't use a file */ +#define TARGET_MAP_FIXED 0x100 /* Interpret addr exactly */ +#define TARGET_MAP_GROWSDOWN 0x01000 /* stack-like segment */ +#define TARGET_MAP_DENYWRITE 0x02000 /* ETXTBSY */ +#define TARGET_MAP_EXECUTABLE 0x04000 /* mark it as an executable */ +#define TARGET_MAP_LOCKED 0x08000 /* lock the mapping */ +#define TARGET_MAP_NORESERVE 0x10000 /* no check for reservations */ +#define TARGET_MAP_POPULATE 0x20000 /* pop (prefault) pagetables */ +#define TARGET_MAP_NONBLOCK 0x40000 /* do not block on IO */ #define TARGET_MAP_STACK 0x80000 /* ignored */ #define TARGET_MAP_HUGETLB 0x100000 /* create a huge page mapping */ #elif defined(TARGET_HPPA) -#define TARGET_MAP_ANONYMOUS 0x10 /* don't use a file */ -#define TARGET_MAP_FIXED 0x04 /* Interpret addr exactly */ -#define TARGET_MAP_GROWSDOWN 0x08000 /* stack-like segment */ -#define TARGET_MAP_DENYWRITE 0x00800 /* ETXTBSY */ -#define TARGET_MAP_EXECUTABLE 0x01000 /* mark it as an executable */ -#define TARGET_MAP_LOCKED 0x02000 /* lock the mapping */ -#define TARGET_MAP_NORESERVE 0x04000 /* no check for reservations */ -#define TARGET_MAP_POPULATE 0x10000 /* pop (prefault) pagetables */ -#define TARGET_MAP_NONBLOCK 0x20000 /* do not block on IO */ +#define TARGET_MAP_ANONYMOUS 0x10 /* don't use a file */ +#define TARGET_MAP_FIXED 0x04 /* Interpret addr exactly */ +#define TARGET_MAP_GROWSDOWN 0x08000 /* stack-like segment */ +#define TARGET_MAP_DENYWRITE 0x00800 /* ETXTBSY */ +#define TARGET_MAP_EXECUTABLE 0x01000 /* mark it as an executable */ +#define TARGET_MAP_LOCKED 0x02000 /* lock the mapping */ +#define TARGET_MAP_NORESERVE 0x04000 /* no check for reservations */ +#define TARGET_MAP_POPULATE 0x10000 /* pop (prefault) pagetables */ +#define TARGET_MAP_NONBLOCK 0x20000 /* do not block on IO */ #define TARGET_MAP_STACK 0x40000 /* ignored */ #define TARGET_MAP_HUGETLB 0x80000 /* create a huge page mapping */ #elif defined(TARGET_XTENSA) -#define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */ -#define TARGET_MAP_ANONYMOUS 0x0800 /* don't use a file */ -#define TARGET_MAP_GROWSDOWN 0x1000 /* stack-like segment */ -#define TARGET_MAP_DENYWRITE 0x2000 /* ETXTBSY */ -#define TARGET_MAP_EXECUTABLE 0x4000 /* mark it as an executable */ -#define TARGET_MAP_LOCKED 0x8000 /* pages are locked */ -#define TARGET_MAP_NORESERVE 0x0400 /* don't check for reservations */ -#define TARGET_MAP_POPULATE 0x10000 /* populate (prefault) pagetables */ -#define TARGET_MAP_NONBLOCK 0x20000 /* do not block on IO */ -#define TARGET_MAP_STACK 0x40000 +#define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */ +#define TARGET_MAP_ANONYMOUS 0x0800 /* don't use a file */ +#define TARGET_MAP_GROWSDOWN 0x1000 /* stack-like segment */ +#define TARGET_MAP_DENYWRITE 0x2000 /* ETXTBSY */ +#define TARGET_MAP_EXECUTABLE 0x4000 /* mark it as an executable */ +#define TARGET_MAP_LOCKED 0x8000 /* pages are locked */ +#define TARGET_MAP_NORESERVE 0x0400 /* don't check for reservations */ +#define TARGET_MAP_POPULATE 0x10000 /* populate (prefault) pagetables */ +#define TARGET_MAP_NONBLOCK 0x20000 /* do not block on IO */ +#define TARGET_MAP_STACK 0x40000 #define TARGET_MAP_HUGETLB 0x80000 /* create a huge page mapping */ #else -#define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */ -#define TARGET_MAP_ANONYMOUS 0x20 /* don't use a file */ -#define TARGET_MAP_GROWSDOWN 0x0100 /* stack-like segment */ -#define TARGET_MAP_DENYWRITE 0x0800 /* ETXTBSY */ -#define TARGET_MAP_EXECUTABLE 0x1000 /* mark it as an executable */ -#define TARGET_MAP_LOCKED 0x2000 /* pages are locked */ -#define TARGET_MAP_NORESERVE 0x4000 /* don't check for reservations */ -#define TARGET_MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ -#define TARGET_MAP_NONBLOCK 0x10000 /* do not block on IO */ +#define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */ +#define TARGET_MAP_ANONYMOUS 0x20 /* don't use a file */ +#define TARGET_MAP_GROWSDOWN 0x0100 /* stack-like segment */ +#define TARGET_MAP_DENYWRITE 0x0800 /* ETXTBSY */ +#define TARGET_MAP_EXECUTABLE 0x1000 /* mark it as an executable */ +#define TARGET_MAP_LOCKED 0x2000 /* pages are locked */ +#define TARGET_MAP_NORESERVE 0x4000 /* don't check for reservations */ +#define TARGET_MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ +#define TARGET_MAP_NONBLOCK 0x10000 /* do not block on IO */ #define TARGET_MAP_STACK 0x20000 /* ignored */ #define TARGET_MAP_HUGETLB 0x40000 /* create a huge page mapping */ -#define TARGET_MAP_UNINITIALIZED 0x4000000 /* for anonymous mmap, memory could be uninitialized */ +#define TARGET_MAP_UNINITIALIZED 0x4000000 /* for anonymous mmap, memory could be uninitialized */ #endif -#if (defined(TARGET_I386) && defined(TARGET_ABI32)) \ - || (defined(TARGET_ARM) && defined(TARGET_ABI32)) \ +#if (defined(TARGET_I386) && defined(TARGET_ABI32)) \ + || (defined(TARGET_ARM) && defined(TARGET_ABI32)) \ || defined(TARGET_CRIS) #define TARGET_STAT_HAVE_NSEC struct target_stat { - unsigned short st_dev; - unsigned short __pad1; - abi_ulong st_ino; - unsigned short st_mode; - unsigned short st_nlink; - unsigned short st_uid; - unsigned short st_gid; - unsigned short st_rdev; - unsigned short __pad2; - abi_ulong st_size; - abi_ulong st_blksize; - abi_ulong st_blocks; - abi_ulong target_st_atime; - abi_ulong target_st_atime_nsec; - abi_ulong target_st_mtime; - abi_ulong target_st_mtime_nsec; - abi_ulong target_st_ctime; - abi_ulong target_st_ctime_nsec; - abi_ulong __unused4; - abi_ulong __unused5; + unsigned short st_dev; + unsigned short __pad1; + abi_ulong st_ino; + unsigned short st_mode; + unsigned short st_nlink; + unsigned short st_uid; + unsigned short st_gid; + unsigned short st_rdev; + unsigned short __pad2; + abi_ulong st_size; + abi_ulong st_blksize; + abi_ulong st_blocks; + abi_ulong target_st_atime; + abi_ulong target_st_atime_nsec; + abi_ulong target_st_mtime; + abi_ulong target_st_mtime_nsec; + abi_ulong target_st_ctime; + abi_ulong target_st_ctime_nsec; + abi_ulong __unused4; + abi_ulong __unused5; }; /* This matches struct stat64 in glibc2.1, hence the absolutely @@ -1379,239 +1379,239 @@ struct target_stat { */ #define TARGET_HAS_STRUCT_STAT64 struct target_stat64 { - unsigned short st_dev; - unsigned char __pad0[10]; + unsigned short st_dev; + unsigned char __pad0[10]; -#define TARGET_STAT64_HAS_BROKEN_ST_INO 1 - abi_ulong __st_ino; +#define TARGET_STAT64_HAS_BROKEN_ST_INO 1 + abi_ulong __st_ino; - unsigned int st_mode; - unsigned int st_nlink; + unsigned int st_mode; + unsigned int st_nlink; - abi_ulong st_uid; - abi_ulong st_gid; + abi_ulong st_uid; + abi_ulong st_gid; - unsigned short st_rdev; - unsigned char __pad3[10]; + unsigned short st_rdev; + unsigned char __pad3[10]; - long long st_size; - abi_ulong st_blksize; + long long st_size; + abi_ulong st_blksize; - abi_ulong st_blocks; /* Number 512-byte blocks allocated. */ - abi_ulong __pad4; /* future possible st_blocks high bits */ + abi_ulong st_blocks; /* Number 512-byte blocks allocated. */ + abi_ulong __pad4; /* future possible st_blocks high bits */ - abi_ulong target_st_atime; - abi_ulong target_st_atime_nsec; + abi_ulong target_st_atime; + abi_ulong target_st_atime_nsec; - abi_ulong target_st_mtime; - abi_ulong target_st_mtime_nsec; + abi_ulong target_st_mtime; + abi_ulong target_st_mtime_nsec; - abi_ulong target_st_ctime; - abi_ulong target_st_ctime_nsec; + abi_ulong target_st_ctime; + abi_ulong target_st_ctime_nsec; - unsigned long long st_ino; + unsigned long long st_ino; } QEMU_PACKED; #ifdef TARGET_ARM #define TARGET_HAS_STRUCT_STAT64 struct target_eabi_stat64 { - unsigned long long st_dev; - unsigned int __pad1; - abi_ulong __st_ino; - unsigned int st_mode; - unsigned int st_nlink; + unsigned long long st_dev; + unsigned int __pad1; + abi_ulong __st_ino; + unsigned int st_mode; + unsigned int st_nlink; - abi_ulong st_uid; - abi_ulong st_gid; + abi_ulong st_uid; + abi_ulong st_gid; - unsigned long long st_rdev; - unsigned int __pad2[2]; + unsigned long long st_rdev; + unsigned int __pad2[2]; - long long st_size; - abi_ulong st_blksize; - unsigned int __pad3; - unsigned long long st_blocks; + long long st_size; + abi_ulong st_blksize; + unsigned int __pad3; + unsigned long long st_blocks; - abi_ulong target_st_atime; - abi_ulong target_st_atime_nsec; + abi_ulong target_st_atime; + abi_ulong target_st_atime_nsec; - abi_ulong target_st_mtime; - abi_ulong target_st_mtime_nsec; + abi_ulong target_st_mtime; + abi_ulong target_st_mtime_nsec; - abi_ulong target_st_ctime; - abi_ulong target_st_ctime_nsec; + abi_ulong target_st_ctime; + abi_ulong target_st_ctime_nsec; - unsigned long long st_ino; + unsigned long long st_ino; } QEMU_PACKED; #endif #elif defined(TARGET_SPARC64) && !defined(TARGET_ABI32) struct target_stat { - unsigned int st_dev; - abi_ulong st_ino; - unsigned int st_mode; - unsigned int st_nlink; - unsigned int st_uid; - unsigned int st_gid; - unsigned int st_rdev; - abi_long st_size; - abi_long target_st_atime; - abi_long target_st_mtime; - abi_long target_st_ctime; - abi_long st_blksize; - abi_long st_blocks; - abi_ulong __unused4[2]; + unsigned int st_dev; + abi_ulong st_ino; + unsigned int st_mode; + unsigned int st_nlink; + unsigned int st_uid; + unsigned int st_gid; + unsigned int st_rdev; + abi_long st_size; + abi_long target_st_atime; + abi_long target_st_mtime; + abi_long target_st_ctime; + abi_long st_blksize; + abi_long st_blocks; + abi_ulong __unused4[2]; }; #define TARGET_HAS_STRUCT_STAT64 struct target_stat64 { - unsigned char __pad0[6]; - unsigned short st_dev; + unsigned char __pad0[6]; + unsigned short st_dev; - uint64_t st_ino; - uint64_t st_nlink; + uint64_t st_ino; + uint64_t st_nlink; - unsigned int st_mode; + unsigned int st_mode; - unsigned int st_uid; - unsigned int st_gid; + unsigned int st_uid; + unsigned int st_gid; - unsigned char __pad2[6]; - unsigned short st_rdev; + unsigned char __pad2[6]; + unsigned short st_rdev; - int64_t st_size; - int64_t st_blksize; + int64_t st_size; + int64_t st_blksize; - unsigned char __pad4[4]; - unsigned int st_blocks; + unsigned char __pad4[4]; + unsigned int st_blocks; - abi_ulong target_st_atime; - abi_ulong target_st_atime_nsec; + abi_ulong target_st_atime; + abi_ulong target_st_atime_nsec; - abi_ulong target_st_mtime; - abi_ulong target_st_mtime_nsec; + abi_ulong target_st_mtime; + abi_ulong target_st_mtime_nsec; - abi_ulong target_st_ctime; - abi_ulong target_st_ctime_nsec; + abi_ulong target_st_ctime; + abi_ulong target_st_ctime_nsec; - abi_ulong __unused4[3]; + abi_ulong __unused4[3]; }; #elif defined(TARGET_SPARC) #define TARGET_STAT_HAVE_NSEC struct target_stat { - unsigned short st_dev; - abi_ulong st_ino; - unsigned short st_mode; - short st_nlink; - unsigned short st_uid; - unsigned short st_gid; - unsigned short st_rdev; - abi_long st_size; - abi_long target_st_atime; - abi_ulong target_st_atime_nsec; - abi_long target_st_mtime; - abi_ulong target_st_mtime_nsec; - abi_long target_st_ctime; - abi_ulong target_st_ctime_nsec; - abi_long st_blksize; - abi_long st_blocks; - abi_ulong __unused1[2]; + unsigned short st_dev; + abi_ulong st_ino; + unsigned short st_mode; + short st_nlink; + unsigned short st_uid; + unsigned short st_gid; + unsigned short st_rdev; + abi_long st_size; + abi_long target_st_atime; + abi_ulong target_st_atime_nsec; + abi_long target_st_mtime; + abi_ulong target_st_mtime_nsec; + abi_long target_st_ctime; + abi_ulong target_st_ctime_nsec; + abi_long st_blksize; + abi_long st_blocks; + abi_ulong __unused1[2]; }; #define TARGET_HAS_STRUCT_STAT64 struct target_stat64 { - unsigned char __pad0[6]; - unsigned short st_dev; + unsigned char __pad0[6]; + unsigned short st_dev; - uint64_t st_ino; + uint64_t st_ino; - unsigned int st_mode; - unsigned int st_nlink; + unsigned int st_mode; + unsigned int st_nlink; - unsigned int st_uid; - unsigned int st_gid; + unsigned int st_uid; + unsigned int st_gid; - unsigned char __pad2[6]; - unsigned short st_rdev; + unsigned char __pad2[6]; + unsigned short st_rdev; - unsigned char __pad3[8]; + unsigned char __pad3[8]; - int64_t st_size; - unsigned int st_blksize; + int64_t st_size; + unsigned int st_blksize; - unsigned char __pad4[8]; - unsigned int st_blocks; + unsigned char __pad4[8]; + unsigned int st_blocks; - unsigned int target_st_atime; - unsigned int target_st_atime_nsec; + unsigned int target_st_atime; + unsigned int target_st_atime_nsec; - unsigned int target_st_mtime; - unsigned int target_st_mtime_nsec; + unsigned int target_st_mtime; + unsigned int target_st_mtime_nsec; - unsigned int target_st_ctime; - unsigned int target_st_ctime_nsec; + unsigned int target_st_ctime; + unsigned int target_st_ctime_nsec; - unsigned int __unused1; - unsigned int __unused2; + unsigned int __unused1; + unsigned int __unused2; }; #elif defined(TARGET_PPC) #define TARGET_STAT_HAVE_NSEC struct target_stat { - abi_ulong st_dev; - abi_ulong st_ino; + abi_ulong st_dev; + abi_ulong st_ino; #if defined(TARGET_PPC64) - abi_ulong st_nlink; - unsigned int st_mode; + abi_ulong st_nlink; + unsigned int st_mode; #else - unsigned int st_mode; - unsigned short st_nlink; + unsigned int st_mode; + unsigned short st_nlink; #endif - unsigned int st_uid; - unsigned int st_gid; - abi_ulong st_rdev; - abi_ulong st_size; - abi_ulong st_blksize; - abi_ulong st_blocks; - abi_ulong target_st_atime; - abi_ulong target_st_atime_nsec; - abi_ulong target_st_mtime; - abi_ulong target_st_mtime_nsec; - abi_ulong target_st_ctime; - abi_ulong target_st_ctime_nsec; - abi_ulong __unused4; - abi_ulong __unused5; + unsigned int st_uid; + unsigned int st_gid; + abi_ulong st_rdev; + abi_ulong st_size; + abi_ulong st_blksize; + abi_ulong st_blocks; + abi_ulong target_st_atime; + abi_ulong target_st_atime_nsec; + abi_ulong target_st_mtime; + abi_ulong target_st_mtime_nsec; + abi_ulong target_st_ctime; + abi_ulong target_st_ctime_nsec; + abi_ulong __unused4; + abi_ulong __unused5; #if defined(TARGET_PPC64) - abi_ulong __unused6; + abi_ulong __unused6; #endif }; #if !defined(TARGET_PPC64) #define TARGET_HAS_STRUCT_STAT64 struct QEMU_PACKED target_stat64 { - unsigned long long st_dev; - unsigned long long st_ino; - unsigned int st_mode; - unsigned int st_nlink; - unsigned int st_uid; - unsigned int st_gid; - unsigned long long st_rdev; - unsigned long long __pad0; - long long st_size; - int st_blksize; - unsigned int __pad1; - long long st_blocks; /* Number 512-byte blocks allocated. */ - int target_st_atime; - unsigned int target_st_atime_nsec; - int target_st_mtime; - unsigned int target_st_mtime_nsec; - int target_st_ctime; - unsigned int target_st_ctime_nsec; - unsigned int __unused4; - unsigned int __unused5; + unsigned long long st_dev; + unsigned long long st_ino; + unsigned int st_mode; + unsigned int st_nlink; + unsigned int st_uid; + unsigned int st_gid; + unsigned long long st_rdev; + unsigned long long __pad0; + long long st_size; + int st_blksize; + unsigned int __pad1; + long long st_blocks; /* Number 512-byte blocks allocated. */ + int target_st_atime; + unsigned int target_st_atime_nsec; + int target_st_mtime; + unsigned int target_st_mtime_nsec; + int target_st_ctime; + unsigned int target_st_ctime_nsec; + unsigned int __unused4; + unsigned int __unused5; }; #endif @@ -1619,78 +1619,78 @@ struct QEMU_PACKED target_stat64 { #define TARGET_STAT_HAVE_NSEC struct target_stat { - abi_ulong st_dev; - abi_ulong st_ino; - unsigned int st_mode; - unsigned short st_nlink; - unsigned int st_uid; - unsigned int st_gid; - abi_ulong st_rdev; - abi_ulong st_size; - abi_ulong st_blksize; - abi_ulong st_blocks; - abi_ulong target_st_atime; - abi_ulong target_st_atime_nsec; - abi_ulong target_st_mtime; - abi_ulong target_st_mtime_nsec; - abi_ulong target_st_ctime; - abi_ulong target_st_ctime_nsec; - abi_ulong __unused4; - abi_ulong __unused5; + abi_ulong st_dev; + abi_ulong st_ino; + unsigned int st_mode; + unsigned short st_nlink; + unsigned int st_uid; + unsigned int st_gid; + abi_ulong st_rdev; + abi_ulong st_size; + abi_ulong st_blksize; + abi_ulong st_blocks; + abi_ulong target_st_atime; + abi_ulong target_st_atime_nsec; + abi_ulong target_st_mtime; + abi_ulong target_st_mtime_nsec; + abi_ulong target_st_ctime; + abi_ulong target_st_ctime_nsec; + abi_ulong __unused4; + abi_ulong __unused5; }; /* FIXME: Microblaze no-mmu user-space has a difference stat64 layout... */ #define TARGET_HAS_STRUCT_STAT64 struct QEMU_PACKED target_stat64 { - uint64_t st_dev; + uint64_t st_dev; #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 - uint32_t pad0; - uint32_t __st_ino; + uint32_t pad0; + uint32_t __st_ino; - uint32_t st_mode; - uint32_t st_nlink; - uint32_t st_uid; - uint32_t st_gid; - uint64_t st_rdev; - uint64_t __pad1; + uint32_t st_mode; + uint32_t st_nlink; + uint32_t st_uid; + uint32_t st_gid; + uint64_t st_rdev; + uint64_t __pad1; - int64_t st_size; - int32_t st_blksize; - uint32_t __pad2; - int64_t st_blocks; /* Number 512-byte blocks allocated. */ + int64_t st_size; + int32_t st_blksize; + uint32_t __pad2; + int64_t st_blocks; /* Number 512-byte blocks allocated. */ - int target_st_atime; - unsigned int target_st_atime_nsec; - int target_st_mtime; - unsigned int target_st_mtime_nsec; - int target_st_ctime; - unsigned int target_st_ctime_nsec; - uint64_t st_ino; + int target_st_atime; + unsigned int target_st_atime_nsec; + int target_st_mtime; + unsigned int target_st_mtime_nsec; + int target_st_ctime; + unsigned int target_st_ctime_nsec; + uint64_t st_ino; }; #elif defined(TARGET_M68K) struct target_stat { - unsigned short st_dev; - unsigned short __pad1; - abi_ulong st_ino; - unsigned short st_mode; - unsigned short st_nlink; - unsigned short st_uid; - unsigned short st_gid; - unsigned short st_rdev; - unsigned short __pad2; - abi_ulong st_size; - abi_ulong st_blksize; - abi_ulong st_blocks; - abi_ulong target_st_atime; - abi_ulong __unused1; - abi_ulong target_st_mtime; - abi_ulong __unused2; - abi_ulong target_st_ctime; - abi_ulong __unused3; - abi_ulong __unused4; - abi_ulong __unused5; + unsigned short st_dev; + unsigned short __pad1; + abi_ulong st_ino; + unsigned short st_mode; + unsigned short st_nlink; + unsigned short st_uid; + unsigned short st_gid; + unsigned short st_rdev; + unsigned short __pad2; + abi_ulong st_size; + abi_ulong st_blksize; + abi_ulong st_blocks; + abi_ulong target_st_atime; + abi_ulong __unused1; + abi_ulong target_st_mtime; + abi_ulong __unused2; + abi_ulong target_st_ctime; + abi_ulong __unused3; + abi_ulong __unused4; + abi_ulong __unused5; }; /* This matches struct stat64 in glibc2.1, hence the absolutely @@ -1698,37 +1698,37 @@ struct target_stat { */ #define TARGET_HAS_STRUCT_STAT64 struct target_stat64 { - unsigned long long st_dev; - unsigned char __pad1[2]; + unsigned long long st_dev; + unsigned char __pad1[2]; -#define TARGET_STAT64_HAS_BROKEN_ST_INO 1 - abi_ulong __st_ino; +#define TARGET_STAT64_HAS_BROKEN_ST_INO 1 + abi_ulong __st_ino; - unsigned int st_mode; - unsigned int st_nlink; + unsigned int st_mode; + unsigned int st_nlink; - abi_ulong st_uid; - abi_ulong st_gid; + abi_ulong st_uid; + abi_ulong st_gid; - unsigned long long st_rdev; - unsigned char __pad3[2]; + unsigned long long st_rdev; + unsigned char __pad3[2]; - long long st_size; - abi_ulong st_blksize; + long long st_size; + abi_ulong st_blksize; - abi_ulong __pad4; /* future possible st_blocks high bits */ - abi_ulong st_blocks; /* Number 512-byte blocks allocated. */ + abi_ulong __pad4; /* future possible st_blocks high bits */ + abi_ulong st_blocks; /* Number 512-byte blocks allocated. */ - abi_ulong target_st_atime; - abi_ulong target_st_atime_nsec; + abi_ulong target_st_atime; + abi_ulong target_st_atime_nsec; - abi_ulong target_st_mtime; - abi_ulong target_st_mtime_nsec; + abi_ulong target_st_mtime; + abi_ulong target_st_mtime_nsec; - abi_ulong target_st_ctime; - abi_ulong target_st_ctime_nsec; + abi_ulong target_st_ctime; + abi_ulong target_st_ctime_nsec; - unsigned long long st_ino; + unsigned long long st_ino; } QEMU_PACKED; #elif defined(TARGET_ABI_MIPSN64) @@ -1736,94 +1736,94 @@ struct target_stat64 { #define TARGET_STAT_HAVE_NSEC /* The memory layout is the same as of struct stat64 of the 32-bit kernel. */ struct target_stat { - unsigned int st_dev; - unsigned int st_pad0[3]; /* Reserved for st_dev expansion */ + unsigned int st_dev; + unsigned int st_pad0[3]; /* Reserved for st_dev expansion */ - abi_ulong st_ino; + abi_ulong st_ino; - unsigned int st_mode; - unsigned int st_nlink; + unsigned int st_mode; + unsigned int st_nlink; - int st_uid; - int st_gid; + int st_uid; + int st_gid; - unsigned int st_rdev; - unsigned int st_pad1[3]; /* Reserved for st_rdev expansion */ + unsigned int st_rdev; + unsigned int st_pad1[3]; /* Reserved for st_rdev expansion */ - abi_ulong st_size; + abi_ulong st_size; - /* - * Actually this should be timestruc_t st_atime, st_mtime and st_ctime - * but we don't have it under Linux. - */ - unsigned int target_st_atime; - unsigned int target_st_atime_nsec; + /* + * Actually this should be timestruc_t st_atime, st_mtime and st_ctime + * but we don't have it under Linux. + */ + unsigned int target_st_atime; + unsigned int target_st_atime_nsec; - unsigned int target_st_mtime; - unsigned int target_st_mtime_nsec; + unsigned int target_st_mtime; + unsigned int target_st_mtime_nsec; - unsigned int target_st_ctime; - unsigned int target_st_ctime_nsec; + unsigned int target_st_ctime; + unsigned int target_st_ctime_nsec; - unsigned int st_blksize; - unsigned int st_pad2; + unsigned int st_blksize; + unsigned int st_pad2; - abi_ulong st_blocks; + abi_ulong st_blocks; }; #elif defined(TARGET_ABI_MIPSN32) #define TARGET_STAT_HAVE_NSEC struct target_stat { - abi_ulong st_dev; - abi_ulong st_pad0[3]; /* Reserved for st_dev expansion */ - uint64_t st_ino; - unsigned int st_mode; - unsigned int st_nlink; - int st_uid; - int st_gid; - abi_ulong st_rdev; - abi_ulong st_pad1[3]; /* Reserved for st_rdev expansion */ - int64_t st_size; - abi_long target_st_atime; - abi_ulong target_st_atime_nsec; /* Reserved for st_atime expansion */ - abi_long target_st_mtime; - abi_ulong target_st_mtime_nsec; /* Reserved for st_mtime expansion */ - abi_long target_st_ctime; - abi_ulong target_st_ctime_nsec; /* Reserved for st_ctime expansion */ - abi_ulong st_blksize; - abi_ulong st_pad2; - int64_t st_blocks; + abi_ulong st_dev; + abi_ulong st_pad0[3]; /* Reserved for st_dev expansion */ + uint64_t st_ino; + unsigned int st_mode; + unsigned int st_nlink; + int st_uid; + int st_gid; + abi_ulong st_rdev; + abi_ulong st_pad1[3]; /* Reserved for st_rdev expansion */ + int64_t st_size; + abi_long target_st_atime; + abi_ulong target_st_atime_nsec; /* Reserved for st_atime expansion */ + abi_long target_st_mtime; + abi_ulong target_st_mtime_nsec; /* Reserved for st_mtime expansion */ + abi_long target_st_ctime; + abi_ulong target_st_ctime_nsec; /* Reserved for st_ctime expansion */ + abi_ulong st_blksize; + abi_ulong st_pad2; + int64_t st_blocks; }; #elif defined(TARGET_ABI_MIPSO32) #define TARGET_STAT_HAVE_NSEC struct target_stat { - unsigned st_dev; - abi_long st_pad1[3]; /* Reserved for network id */ - abi_ulong st_ino; - unsigned int st_mode; - unsigned int st_nlink; - int st_uid; - int st_gid; - unsigned st_rdev; - abi_long st_pad2[2]; - abi_long st_size; - abi_long st_pad3; - /* - * Actually this should be timestruc_t st_atime, st_mtime and st_ctime - * but we don't have it under Linux. - */ - abi_long target_st_atime; - abi_long target_st_atime_nsec; - abi_long target_st_mtime; - abi_long target_st_mtime_nsec; - abi_long target_st_ctime; - abi_long target_st_ctime_nsec; - abi_long st_blksize; - abi_long st_blocks; - abi_long st_pad4[14]; + unsigned st_dev; + abi_long st_pad1[3]; /* Reserved for network id */ + abi_ulong st_ino; + unsigned int st_mode; + unsigned int st_nlink; + int st_uid; + int st_gid; + unsigned st_rdev; + abi_long st_pad2[2]; + abi_long st_size; + abi_long st_pad3; + /* + * Actually this should be timestruc_t st_atime, st_mtime and st_ctime + * but we don't have it under Linux. + */ + abi_long target_st_atime; + abi_long target_st_atime_nsec; + abi_long target_st_mtime; + abi_long target_st_mtime_nsec; + abi_long target_st_ctime; + abi_long target_st_ctime_nsec; + abi_long st_blksize; + abi_long st_blocks; + abi_long st_pad4[14]; }; /* @@ -1834,107 +1834,107 @@ struct target_stat { #define TARGET_HAS_STRUCT_STAT64 struct target_stat64 { - abi_ulong st_dev; - abi_ulong st_pad0[3]; /* Reserved for st_dev expansion */ + abi_ulong st_dev; + abi_ulong st_pad0[3]; /* Reserved for st_dev expansion */ - uint64_t st_ino; + uint64_t st_ino; - unsigned int st_mode; - unsigned int st_nlink; + unsigned int st_mode; + unsigned int st_nlink; - int st_uid; - int st_gid; + int st_uid; + int st_gid; - abi_ulong st_rdev; - abi_ulong st_pad1[3]; /* Reserved for st_rdev expansion */ + abi_ulong st_rdev; + abi_ulong st_pad1[3]; /* Reserved for st_rdev expansion */ - int64_t st_size; + int64_t st_size; - /* - * Actually this should be timestruc_t st_atime, st_mtime and st_ctime - * but we don't have it under Linux. - */ - abi_long target_st_atime; - abi_ulong target_st_atime_nsec; /* Reserved for st_atime expansion */ + /* + * Actually this should be timestruc_t st_atime, st_mtime and st_ctime + * but we don't have it under Linux. + */ + abi_long target_st_atime; + abi_ulong target_st_atime_nsec; /* Reserved for st_atime expansion */ - abi_long target_st_mtime; - abi_ulong target_st_mtime_nsec; /* Reserved for st_mtime expansion */ + abi_long target_st_mtime; + abi_ulong target_st_mtime_nsec; /* Reserved for st_mtime expansion */ - abi_long target_st_ctime; - abi_ulong target_st_ctime_nsec; /* Reserved for st_ctime expansion */ + abi_long target_st_ctime; + abi_ulong target_st_ctime_nsec; /* Reserved for st_ctime expansion */ - abi_ulong st_blksize; - abi_ulong st_pad2; + abi_ulong st_blksize; + abi_ulong st_pad2; - int64_t st_blocks; + int64_t st_blocks; }; #elif defined(TARGET_ALPHA) struct target_stat { - unsigned int st_dev; - unsigned int st_ino; - unsigned int st_mode; - unsigned int st_nlink; - unsigned int st_uid; - unsigned int st_gid; - unsigned int st_rdev; - abi_long st_size; - abi_ulong target_st_atime; - abi_ulong target_st_mtime; - abi_ulong target_st_ctime; - unsigned int st_blksize; - unsigned int st_blocks; - unsigned int st_flags; - unsigned int st_gen; + unsigned int st_dev; + unsigned int st_ino; + unsigned int st_mode; + unsigned int st_nlink; + unsigned int st_uid; + unsigned int st_gid; + unsigned int st_rdev; + abi_long st_size; + abi_ulong target_st_atime; + abi_ulong target_st_mtime; + abi_ulong target_st_ctime; + unsigned int st_blksize; + unsigned int st_blocks; + unsigned int st_flags; + unsigned int st_gen; }; #define TARGET_HAS_STRUCT_STAT64 struct target_stat64 { - abi_ulong st_dev; - abi_ulong st_ino; - abi_ulong st_rdev; - abi_long st_size; - abi_ulong st_blocks; + abi_ulong st_dev; + abi_ulong st_ino; + abi_ulong st_rdev; + abi_long st_size; + abi_ulong st_blocks; - unsigned int st_mode; - unsigned int st_uid; - unsigned int st_gid; - unsigned int st_blksize; - unsigned int st_nlink; - unsigned int __pad0; + unsigned int st_mode; + unsigned int st_uid; + unsigned int st_gid; + unsigned int st_blksize; + unsigned int st_nlink; + unsigned int __pad0; - abi_ulong target_st_atime; - abi_ulong target_st_atime_nsec; - abi_ulong target_st_mtime; - abi_ulong target_st_mtime_nsec; - abi_ulong target_st_ctime; - abi_ulong target_st_ctime_nsec; - abi_long __unused[3]; + abi_ulong target_st_atime; + abi_ulong target_st_atime_nsec; + abi_ulong target_st_mtime; + abi_ulong target_st_mtime_nsec; + abi_ulong target_st_ctime; + abi_ulong target_st_ctime_nsec; + abi_long __unused[3]; }; #elif defined(TARGET_SH4) #define TARGET_STAT_HAVE_NSEC struct target_stat { - abi_ulong st_dev; - abi_ulong st_ino; - unsigned short st_mode; - unsigned short st_nlink; - unsigned short st_uid; - unsigned short st_gid; - abi_ulong st_rdev; - abi_ulong st_size; - abi_ulong st_blksize; - abi_ulong st_blocks; - abi_ulong target_st_atime; - abi_ulong target_st_atime_nsec; - abi_ulong target_st_mtime; - abi_ulong target_st_mtime_nsec; - abi_ulong target_st_ctime; - abi_ulong target_st_ctime_nsec; - abi_ulong __unused4; - abi_ulong __unused5; + abi_ulong st_dev; + abi_ulong st_ino; + unsigned short st_mode; + unsigned short st_nlink; + unsigned short st_uid; + unsigned short st_gid; + abi_ulong st_rdev; + abi_ulong st_size; + abi_ulong st_blksize; + abi_ulong st_blocks; + abi_ulong target_st_atime; + abi_ulong target_st_atime_nsec; + abi_ulong target_st_mtime; + abi_ulong target_st_mtime_nsec; + abi_ulong target_st_ctime; + abi_ulong target_st_ctime_nsec; + abi_ulong __unused4; + abi_ulong __unused5; }; /* This matches struct stat64 in glibc2.1, hence the absolutely @@ -1942,62 +1942,62 @@ struct target_stat { */ #define TARGET_HAS_STRUCT_STAT64 struct QEMU_PACKED target_stat64 { - unsigned long long st_dev; - unsigned char __pad0[4]; + unsigned long long st_dev; + unsigned char __pad0[4]; -#define TARGET_STAT64_HAS_BROKEN_ST_INO 1 - abi_ulong __st_ino; +#define TARGET_STAT64_HAS_BROKEN_ST_INO 1 + abi_ulong __st_ino; - unsigned int st_mode; - unsigned int st_nlink; + unsigned int st_mode; + unsigned int st_nlink; - abi_ulong st_uid; - abi_ulong st_gid; + abi_ulong st_uid; + abi_ulong st_gid; - unsigned long long st_rdev; - unsigned char __pad3[4]; + unsigned long long st_rdev; + unsigned char __pad3[4]; - long long st_size; - abi_ulong st_blksize; + long long st_size; + abi_ulong st_blksize; - unsigned long long st_blocks; /* Number 512-byte blocks allocated. */ + unsigned long long st_blocks; /* Number 512-byte blocks allocated. */ - abi_ulong target_st_atime; - abi_ulong target_st_atime_nsec; + abi_ulong target_st_atime; + abi_ulong target_st_atime_nsec; - abi_ulong target_st_mtime; - abi_ulong target_st_mtime_nsec; + abi_ulong target_st_mtime; + abi_ulong target_st_mtime_nsec; - abi_ulong target_st_ctime; - abi_ulong target_st_ctime_nsec; + abi_ulong target_st_ctime; + abi_ulong target_st_ctime_nsec; - unsigned long long st_ino; + unsigned long long st_ino; }; #elif defined(TARGET_I386) && !defined(TARGET_ABI32) #define TARGET_STAT_HAVE_NSEC struct target_stat { - abi_ulong st_dev; - abi_ulong st_ino; - abi_ulong st_nlink; + abi_ulong st_dev; + abi_ulong st_ino; + abi_ulong st_nlink; - unsigned int st_mode; - unsigned int st_uid; - unsigned int st_gid; - unsigned int __pad0; - abi_ulong st_rdev; - abi_long st_size; - abi_long st_blksize; - abi_long st_blocks; /* Number 512-byte blocks allocated. */ + unsigned int st_mode; + unsigned int st_uid; + unsigned int st_gid; + unsigned int __pad0; + abi_ulong st_rdev; + abi_long st_size; + abi_long st_blksize; + abi_long st_blocks; /* Number 512-byte blocks allocated. */ - abi_ulong target_st_atime; - abi_ulong target_st_atime_nsec; - abi_ulong target_st_mtime; - abi_ulong target_st_mtime_nsec; - abi_ulong target_st_ctime; - abi_ulong target_st_ctime_nsec; + abi_ulong target_st_atime; + abi_ulong target_st_atime_nsec; + abi_ulong target_st_mtime; + abi_ulong target_st_mtime_nsec; + abi_ulong target_st_ctime; + abi_ulong target_st_ctime_nsec; - abi_long __unused[3]; + abi_long __unused[3]; }; #elif defined(TARGET_S390X) struct target_stat { @@ -2090,7 +2090,7 @@ struct target_stat64 { }; #elif defined(TARGET_OPENRISC) || defined(TARGET_NIOS2) \ - || defined(TARGET_RISCV) || defined(TARGET_HEXAGON) + || defined(TARGET_RISCV) || defined(TARGET_HEXAGON) /* These are the asm-generic versions of the stat and stat64 structures */ @@ -2210,93 +2210,93 @@ struct target_stat64 { #endif typedef struct { - int val[2]; + int val[2]; } target_fsid_t; #ifdef TARGET_MIPS #ifdef TARGET_ABI_MIPSN32 struct target_statfs { - int32_t f_type; - int32_t f_bsize; - int32_t f_frsize; /* Fragment size - unsupported */ - int32_t f_blocks; - int32_t f_bfree; - int32_t f_files; - int32_t f_ffree; - int32_t f_bavail; + int32_t f_type; + int32_t f_bsize; + int32_t f_frsize; /* Fragment size - unsupported */ + int32_t f_blocks; + int32_t f_bfree; + int32_t f_files; + int32_t f_ffree; + int32_t f_bavail; - /* Linux specials */ - target_fsid_t f_fsid; - int32_t f_namelen; - int32_t f_flags; - int32_t f_spare[5]; + /* Linux specials */ + target_fsid_t f_fsid; + int32_t f_namelen; + int32_t f_flags; + int32_t f_spare[5]; }; #else struct target_statfs { - abi_long f_type; - abi_long f_bsize; - abi_long f_frsize; /* Fragment size - unsupported */ - abi_long f_blocks; - abi_long f_bfree; - abi_long f_files; - abi_long f_ffree; - abi_long f_bavail; + abi_long f_type; + abi_long f_bsize; + abi_long f_frsize; /* Fragment size - unsupported */ + abi_long f_blocks; + abi_long f_bfree; + abi_long f_files; + abi_long f_ffree; + abi_long f_bavail; - /* Linux specials */ - target_fsid_t f_fsid; - abi_long f_namelen; - abi_long f_flags; - abi_long f_spare[5]; + /* Linux specials */ + target_fsid_t f_fsid; + abi_long f_namelen; + abi_long f_flags; + abi_long f_spare[5]; }; #endif struct target_statfs64 { - uint32_t f_type; - uint32_t f_bsize; - uint32_t f_frsize; /* Fragment size - unsupported */ - uint32_t __pad; - uint64_t f_blocks; - uint64_t f_bfree; - uint64_t f_files; - uint64_t f_ffree; - uint64_t f_bavail; - target_fsid_t f_fsid; - uint32_t f_namelen; - uint32_t f_flags; - uint32_t f_spare[5]; + uint32_t f_type; + uint32_t f_bsize; + uint32_t f_frsize; /* Fragment size - unsupported */ + uint32_t __pad; + uint64_t f_blocks; + uint64_t f_bfree; + uint64_t f_files; + uint64_t f_ffree; + uint64_t f_bavail; + target_fsid_t f_fsid; + uint32_t f_namelen; + uint32_t f_flags; + uint32_t f_spare[5]; }; -#elif (defined(TARGET_PPC64) || defined(TARGET_X86_64) || \ - defined(TARGET_SPARC64) || defined(TARGET_AARCH64) || \ +#elif (defined(TARGET_PPC64) || defined(TARGET_X86_64) || \ + defined(TARGET_SPARC64) || defined(TARGET_AARCH64) || \ defined(TARGET_RISCV) || defined(TARGET_LOONGARCH64)) && \ - !defined(TARGET_ABI32) + !defined(TARGET_ABI32) struct target_statfs { - abi_long f_type; - abi_long f_bsize; - abi_long f_blocks; - abi_long f_bfree; - abi_long f_bavail; - abi_long f_files; - abi_long f_ffree; - target_fsid_t f_fsid; - abi_long f_namelen; - abi_long f_frsize; - abi_long f_flags; - abi_long f_spare[4]; + abi_long f_type; + abi_long f_bsize; + abi_long f_blocks; + abi_long f_bfree; + abi_long f_bavail; + abi_long f_files; + abi_long f_ffree; + target_fsid_t f_fsid; + abi_long f_namelen; + abi_long f_frsize; + abi_long f_flags; + abi_long f_spare[4]; }; struct target_statfs64 { - abi_long f_type; - abi_long f_bsize; - abi_long f_blocks; - abi_long f_bfree; - abi_long f_bavail; - abi_long f_files; - abi_long f_ffree; - target_fsid_t f_fsid; - abi_long f_namelen; - abi_long f_frsize; - abi_long f_flags; - abi_long f_spare[4]; + abi_long f_type; + abi_long f_bsize; + abi_long f_blocks; + abi_long f_bfree; + abi_long f_bavail; + abi_long f_files; + abi_long f_ffree; + target_fsid_t f_fsid; + abi_long f_namelen; + abi_long f_frsize; + abi_long f_flags; + abi_long f_spare[4]; }; #elif defined(TARGET_S390X) struct target_statfs { @@ -2331,33 +2331,33 @@ struct target_statfs64 { }; #else struct target_statfs { - uint32_t f_type; - uint32_t f_bsize; - uint32_t f_blocks; - uint32_t f_bfree; - uint32_t f_bavail; - uint32_t f_files; - uint32_t f_ffree; - target_fsid_t f_fsid; - uint32_t f_namelen; - uint32_t f_frsize; - uint32_t f_flags; - uint32_t f_spare[4]; + uint32_t f_type; + uint32_t f_bsize; + uint32_t f_blocks; + uint32_t f_bfree; + uint32_t f_bavail; + uint32_t f_files; + uint32_t f_ffree; + target_fsid_t f_fsid; + uint32_t f_namelen; + uint32_t f_frsize; + uint32_t f_flags; + uint32_t f_spare[4]; }; struct target_statfs64 { - uint32_t f_type; - uint32_t f_bsize; - uint64_t f_blocks; - uint64_t f_bfree; - uint64_t f_bavail; - uint64_t f_files; - uint64_t f_ffree; - target_fsid_t f_fsid; - uint32_t f_namelen; - uint32_t f_frsize; - uint32_t f_flags; - uint32_t f_spare[4]; + uint32_t f_type; + uint32_t f_bsize; + uint64_t f_blocks; + uint64_t f_bfree; + uint64_t f_bavail; + uint64_t f_files; + uint64_t f_ffree; + target_fsid_t f_fsid; + uint32_t f_namelen; + uint32_t f_frsize; + uint32_t f_flags; + uint32_t f_spare[4]; }; #endif @@ -2454,63 +2454,63 @@ struct target_statfs64 { #define TARGET_SOUND_MIXER_PRIVATE4 TARGET_IOWR('M', 114, int) #define TARGET_SOUND_MIXER_PRIVATE5 TARGET_IOWR('M', 115, int) -#define TARGET_MIXER_READ(dev) TARGET_IOR('M', dev, int) +#define TARGET_MIXER_READ(dev) TARGET_IOR('M', dev, int) -#define TARGET_SOUND_MIXER_READ_VOLUME TARGET_MIXER_READ(SOUND_MIXER_VOLUME) -#define TARGET_SOUND_MIXER_READ_BASS TARGET_MIXER_READ(SOUND_MIXER_BASS) -#define TARGET_SOUND_MIXER_READ_TREBLE TARGET_MIXER_READ(SOUND_MIXER_TREBLE) -#define TARGET_SOUND_MIXER_READ_SYNTH TARGET_MIXER_READ(SOUND_MIXER_SYNTH) -#define TARGET_SOUND_MIXER_READ_PCM TARGET_MIXER_READ(SOUND_MIXER_PCM) -#define TARGET_SOUND_MIXER_READ_SPEAKER TARGET_MIXER_READ(SOUND_MIXER_SPEAKER) -#define TARGET_SOUND_MIXER_READ_LINE TARGET_MIXER_READ(SOUND_MIXER_LINE) -#define TARGET_SOUND_MIXER_READ_MIC TARGET_MIXER_READ(SOUND_MIXER_MIC) -#define TARGET_SOUND_MIXER_READ_CD TARGET_MIXER_READ(SOUND_MIXER_CD) -#define TARGET_SOUND_MIXER_READ_IMIX TARGET_MIXER_READ(SOUND_MIXER_IMIX) -#define TARGET_SOUND_MIXER_READ_ALTPCM TARGET_MIXER_READ(SOUND_MIXER_ALTPCM) -#define TARGET_SOUND_MIXER_READ_RECLEV TARGET_MIXER_READ(SOUND_MIXER_RECLEV) -#define TARGET_SOUND_MIXER_READ_IGAIN TARGET_MIXER_READ(SOUND_MIXER_IGAIN) -#define TARGET_SOUND_MIXER_READ_OGAIN TARGET_MIXER_READ(SOUND_MIXER_OGAIN) -#define TARGET_SOUND_MIXER_READ_LINE1 TARGET_MIXER_READ(SOUND_MIXER_LINE1) -#define TARGET_SOUND_MIXER_READ_LINE2 TARGET_MIXER_READ(SOUND_MIXER_LINE2) -#define TARGET_SOUND_MIXER_READ_LINE3 TARGET_MIXER_READ(SOUND_MIXER_LINE3) +#define TARGET_SOUND_MIXER_READ_VOLUME TARGET_MIXER_READ(SOUND_MIXER_VOLUME) +#define TARGET_SOUND_MIXER_READ_BASS TARGET_MIXER_READ(SOUND_MIXER_BASS) +#define TARGET_SOUND_MIXER_READ_TREBLE TARGET_MIXER_READ(SOUND_MIXER_TREBLE) +#define TARGET_SOUND_MIXER_READ_SYNTH TARGET_MIXER_READ(SOUND_MIXER_SYNTH) +#define TARGET_SOUND_MIXER_READ_PCM TARGET_MIXER_READ(SOUND_MIXER_PCM) +#define TARGET_SOUND_MIXER_READ_SPEAKER TARGET_MIXER_READ(SOUND_MIXER_SPEAKER) +#define TARGET_SOUND_MIXER_READ_LINE TARGET_MIXER_READ(SOUND_MIXER_LINE) +#define TARGET_SOUND_MIXER_READ_MIC TARGET_MIXER_READ(SOUND_MIXER_MIC) +#define TARGET_SOUND_MIXER_READ_CD TARGET_MIXER_READ(SOUND_MIXER_CD) +#define TARGET_SOUND_MIXER_READ_IMIX TARGET_MIXER_READ(SOUND_MIXER_IMIX) +#define TARGET_SOUND_MIXER_READ_ALTPCM TARGET_MIXER_READ(SOUND_MIXER_ALTPCM) +#define TARGET_SOUND_MIXER_READ_RECLEV TARGET_MIXER_READ(SOUND_MIXER_RECLEV) +#define TARGET_SOUND_MIXER_READ_IGAIN TARGET_MIXER_READ(SOUND_MIXER_IGAIN) +#define TARGET_SOUND_MIXER_READ_OGAIN TARGET_MIXER_READ(SOUND_MIXER_OGAIN) +#define TARGET_SOUND_MIXER_READ_LINE1 TARGET_MIXER_READ(SOUND_MIXER_LINE1) +#define TARGET_SOUND_MIXER_READ_LINE2 TARGET_MIXER_READ(SOUND_MIXER_LINE2) +#define TARGET_SOUND_MIXER_READ_LINE3 TARGET_MIXER_READ(SOUND_MIXER_LINE3) /* Obsolete macros */ -#define TARGET_SOUND_MIXER_READ_MUTE TARGET_MIXER_READ(SOUND_MIXER_MUTE) -#define TARGET_SOUND_MIXER_READ_ENHANCE TARGET_MIXER_READ(SOUND_MIXER_ENHANCE) -#define TARGET_SOUND_MIXER_READ_LOUD TARGET_MIXER_READ(SOUND_MIXER_LOUD) +#define TARGET_SOUND_MIXER_READ_MUTE TARGET_MIXER_READ(SOUND_MIXER_MUTE) +#define TARGET_SOUND_MIXER_READ_ENHANCE TARGET_MIXER_READ(SOUND_MIXER_ENHANCE) +#define TARGET_SOUND_MIXER_READ_LOUD TARGET_MIXER_READ(SOUND_MIXER_LOUD) -#define TARGET_SOUND_MIXER_READ_RECSRC TARGET_MIXER_READ(SOUND_MIXER_RECSRC) -#define TARGET_SOUND_MIXER_READ_DEVMASK TARGET_MIXER_READ(SOUND_MIXER_DEVMASK) -#define TARGET_SOUND_MIXER_READ_RECMASK TARGET_MIXER_READ(SOUND_MIXER_RECMASK) -#define TARGET_SOUND_MIXER_READ_STEREODEVS TARGET_MIXER_READ(SOUND_MIXER_STEREODEVS) -#define TARGET_SOUND_MIXER_READ_CAPS TARGET_MIXER_READ(SOUND_MIXER_CAPS) +#define TARGET_SOUND_MIXER_READ_RECSRC TARGET_MIXER_READ(SOUND_MIXER_RECSRC) +#define TARGET_SOUND_MIXER_READ_DEVMASK TARGET_MIXER_READ(SOUND_MIXER_DEVMASK) +#define TARGET_SOUND_MIXER_READ_RECMASK TARGET_MIXER_READ(SOUND_MIXER_RECMASK) +#define TARGET_SOUND_MIXER_READ_STEREODEVS TARGET_MIXER_READ(SOUND_MIXER_STEREODEVS) +#define TARGET_SOUND_MIXER_READ_CAPS TARGET_MIXER_READ(SOUND_MIXER_CAPS) -#define TARGET_MIXER_WRITE(dev) TARGET_IOWR('M', dev, int) +#define TARGET_MIXER_WRITE(dev) TARGET_IOWR('M', dev, int) -#define TARGET_SOUND_MIXER_WRITE_VOLUME TARGET_MIXER_WRITE(SOUND_MIXER_VOLUME) -#define TARGET_SOUND_MIXER_WRITE_BASS TARGET_MIXER_WRITE(SOUND_MIXER_BASS) -#define TARGET_SOUND_MIXER_WRITE_TREBLE TARGET_MIXER_WRITE(SOUND_MIXER_TREBLE) -#define TARGET_SOUND_MIXER_WRITE_SYNTH TARGET_MIXER_WRITE(SOUND_MIXER_SYNTH) -#define TARGET_SOUND_MIXER_WRITE_PCM TARGET_MIXER_WRITE(SOUND_MIXER_PCM) -#define TARGET_SOUND_MIXER_WRITE_SPEAKER TARGET_MIXER_WRITE(SOUND_MIXER_SPEAKER) -#define TARGET_SOUND_MIXER_WRITE_LINE TARGET_MIXER_WRITE(SOUND_MIXER_LINE) -#define TARGET_SOUND_MIXER_WRITE_MIC TARGET_MIXER_WRITE(SOUND_MIXER_MIC) -#define TARGET_SOUND_MIXER_WRITE_CD TARGET_MIXER_WRITE(SOUND_MIXER_CD) -#define TARGET_SOUND_MIXER_WRITE_IMIX TARGET_MIXER_WRITE(SOUND_MIXER_IMIX) -#define TARGET_SOUND_MIXER_WRITE_ALTPCM TARGET_MIXER_WRITE(SOUND_MIXER_ALTPCM) -#define TARGET_SOUND_MIXER_WRITE_RECLEV TARGET_MIXER_WRITE(SOUND_MIXER_RECLEV) -#define TARGET_SOUND_MIXER_WRITE_IGAIN TARGET_MIXER_WRITE(SOUND_MIXER_IGAIN) -#define TARGET_SOUND_MIXER_WRITE_OGAIN TARGET_MIXER_WRITE(SOUND_MIXER_OGAIN) -#define TARGET_SOUND_MIXER_WRITE_LINE1 TARGET_MIXER_WRITE(SOUND_MIXER_LINE1) -#define TARGET_SOUND_MIXER_WRITE_LINE2 TARGET_MIXER_WRITE(SOUND_MIXER_LINE2) -#define TARGET_SOUND_MIXER_WRITE_LINE3 TARGET_MIXER_WRITE(SOUND_MIXER_LINE3) +#define TARGET_SOUND_MIXER_WRITE_VOLUME TARGET_MIXER_WRITE(SOUND_MIXER_VOLUME) +#define TARGET_SOUND_MIXER_WRITE_BASS TARGET_MIXER_WRITE(SOUND_MIXER_BASS) +#define TARGET_SOUND_MIXER_WRITE_TREBLE TARGET_MIXER_WRITE(SOUND_MIXER_TREBLE) +#define TARGET_SOUND_MIXER_WRITE_SYNTH TARGET_MIXER_WRITE(SOUND_MIXER_SYNTH) +#define TARGET_SOUND_MIXER_WRITE_PCM TARGET_MIXER_WRITE(SOUND_MIXER_PCM) +#define TARGET_SOUND_MIXER_WRITE_SPEAKER TARGET_MIXER_WRITE(SOUND_MIXER_SPEAKER) +#define TARGET_SOUND_MIXER_WRITE_LINE TARGET_MIXER_WRITE(SOUND_MIXER_LINE) +#define TARGET_SOUND_MIXER_WRITE_MIC TARGET_MIXER_WRITE(SOUND_MIXER_MIC) +#define TARGET_SOUND_MIXER_WRITE_CD TARGET_MIXER_WRITE(SOUND_MIXER_CD) +#define TARGET_SOUND_MIXER_WRITE_IMIX TARGET_MIXER_WRITE(SOUND_MIXER_IMIX) +#define TARGET_SOUND_MIXER_WRITE_ALTPCM TARGET_MIXER_WRITE(SOUND_MIXER_ALTPCM) +#define TARGET_SOUND_MIXER_WRITE_RECLEV TARGET_MIXER_WRITE(SOUND_MIXER_RECLEV) +#define TARGET_SOUND_MIXER_WRITE_IGAIN TARGET_MIXER_WRITE(SOUND_MIXER_IGAIN) +#define TARGET_SOUND_MIXER_WRITE_OGAIN TARGET_MIXER_WRITE(SOUND_MIXER_OGAIN) +#define TARGET_SOUND_MIXER_WRITE_LINE1 TARGET_MIXER_WRITE(SOUND_MIXER_LINE1) +#define TARGET_SOUND_MIXER_WRITE_LINE2 TARGET_MIXER_WRITE(SOUND_MIXER_LINE2) +#define TARGET_SOUND_MIXER_WRITE_LINE3 TARGET_MIXER_WRITE(SOUND_MIXER_LINE3) /* Obsolete macros */ -#define TARGET_SOUND_MIXER_WRITE_MUTE TARGET_MIXER_WRITE(SOUND_MIXER_MUTE) -#define TARGET_SOUND_MIXER_WRITE_ENHANCE TARGET_MIXER_WRITE(SOUND_MIXER_ENHANCE) -#define TARGET_SOUND_MIXER_WRITE_LOUD TARGET_MIXER_WRITE(SOUND_MIXER_LOUD) +#define TARGET_SOUND_MIXER_WRITE_MUTE TARGET_MIXER_WRITE(SOUND_MIXER_MUTE) +#define TARGET_SOUND_MIXER_WRITE_ENHANCE TARGET_MIXER_WRITE(SOUND_MIXER_ENHANCE) +#define TARGET_SOUND_MIXER_WRITE_LOUD TARGET_MIXER_WRITE(SOUND_MIXER_LOUD) -#define TARGET_SOUND_MIXER_WRITE_RECSRC TARGET_MIXER_WRITE(SOUND_MIXER_RECSRC) +#define TARGET_SOUND_MIXER_WRITE_RECSRC TARGET_MIXER_WRITE(SOUND_MIXER_RECSRC) struct target_snd_timer_id { int dev_class; @@ -2575,22 +2575,22 @@ struct target_snd_timer_status { /* alsa timer ioctls */ #define TARGET_SNDRV_TIMER_IOCTL_PVERSION TARGET_IOR('T', 0x00, int) -#define TARGET_SNDRV_TIMER_IOCTL_NEXT_DEVICE TARGET_IOWR('T', 0x01, \ - struct snd_timer_id) -#define TARGET_SNDRV_TIMER_IOCTL_GINFO TARGET_IOWR('T', 0x03, \ - struct target_snd_timer_ginfo) -#define TARGET_SNDRV_TIMER_IOCTL_GPARAMS TARGET_IOW('T', 0x04, \ - struct target_snd_timer_gparams) -#define TARGET_SNDRV_TIMER_IOCTL_GSTATUS TARGET_IOWR('T', 0x05, \ - struct target_snd_timer_gstatus) -#define TARGET_SNDRV_TIMER_IOCTL_SELECT TARGET_IOW('T', 0x10, \ - struct target_snd_timer_select) -#define TARGET_SNDRV_TIMER_IOCTL_INFO TARGET_IOR('T', 0x11, \ - struct target_snd_timer_info) -#define TARGET_SNDRV_TIMER_IOCTL_PARAMS TARGET_IOW('T', 0x12, \ - struct snd_timer_params) -#define TARGET_SNDRV_TIMER_IOCTL_STATUS TARGET_IOR('T', 0x14, \ - struct target_snd_timer_status) +#define TARGET_SNDRV_TIMER_IOCTL_NEXT_DEVICE TARGET_IOWR('T', 0x01, \ + struct snd_timer_id) +#define TARGET_SNDRV_TIMER_IOCTL_GINFO TARGET_IOWR('T', 0x03, \ + struct target_snd_timer_ginfo) +#define TARGET_SNDRV_TIMER_IOCTL_GPARAMS TARGET_IOW('T', 0x04, \ + struct target_snd_timer_gparams) +#define TARGET_SNDRV_TIMER_IOCTL_GSTATUS TARGET_IOWR('T', 0x05, \ + struct target_snd_timer_gstatus) +#define TARGET_SNDRV_TIMER_IOCTL_SELECT TARGET_IOW('T', 0x10, \ + struct target_snd_timer_select) +#define TARGET_SNDRV_TIMER_IOCTL_INFO TARGET_IOR('T', 0x11, \ + struct target_snd_timer_info) +#define TARGET_SNDRV_TIMER_IOCTL_PARAMS TARGET_IOW('T', 0x12, \ + struct snd_timer_params) +#define TARGET_SNDRV_TIMER_IOCTL_STATUS TARGET_IOR('T', 0x14, \ + struct target_snd_timer_status) #define TARGET_SNDRV_TIMER_IOCTL_START TARGET_IO('T', 0xa0) #define TARGET_SNDRV_TIMER_IOCTL_STOP TARGET_IO('T', 0xa1) #define TARGET_SNDRV_TIMER_IOCTL_CONTINUE TARGET_IO('T', 0xa2) @@ -2750,12 +2750,12 @@ typedef int32_t target_timer_t; #ifdef TARGET_MIPS #define TARGET_SIGEV_PREAMBLE_SIZE (sizeof(int32_t) * 2 + sizeof(abi_long)) #else -#define TARGET_SIGEV_PREAMBLE_SIZE (sizeof(int32_t) * 2 \ +#define TARGET_SIGEV_PREAMBLE_SIZE (sizeof(int32_t) * 2 \ + sizeof(target_sigval_t)) #endif -#define TARGET_SIGEV_PAD_SIZE ((TARGET_SIGEV_MAX_SIZE \ - - TARGET_SIGEV_PREAMBLE_SIZE) \ +#define TARGET_SIGEV_PAD_SIZE ((TARGET_SIGEV_MAX_SIZE \ + - TARGET_SIGEV_PREAMBLE_SIZE) \ / sizeof(int32_t)) struct target_sigevent { @@ -2814,40 +2814,40 @@ struct target_user_cap_data { #define TARGET_SYSLOG_ACTION_SIZE_BUFFER 10 struct target_statx_timestamp { - int64_t tv_sec; - uint32_t tv_nsec; - int32_t __reserved; + int64_t tv_sec; + uint32_t tv_nsec; + int32_t __reserved; }; struct target_statx { - /* 0x00 */ - uint32_t stx_mask; /* What results were written [uncond] */ - uint32_t stx_blksize; /* Preferred general I/O size [uncond] */ - uint64_t stx_attributes; /* Flags conveying information about the file */ - /* 0x10 */ - uint32_t stx_nlink; /* Number of hard links */ - uint32_t stx_uid; /* User ID of owner */ - uint32_t stx_gid; /* Group ID of owner */ - uint16_t stx_mode; /* File mode */ - uint16_t __spare0[1]; - /* 0x20 */ - uint64_t stx_ino; /* Inode number */ - uint64_t stx_size; /* File size */ - uint64_t stx_blocks; /* Number of 512-byte blocks allocated */ - uint64_t stx_attributes_mask; /* Mask to show what is supported */ - /* 0x40 */ - struct target_statx_timestamp stx_atime; /* Last access time */ - struct target_statx_timestamp stx_btime; /* File creation time */ - struct target_statx_timestamp stx_ctime; /* Last attribute change time */ - struct target_statx_timestamp stx_mtime; /* Last data modification time */ - /* 0x80 */ - uint32_t stx_rdev_major; /* Device ID of special file [if bdev/cdev] */ - uint32_t stx_rdev_minor; - uint32_t stx_dev_major; /* ID of device containing file [uncond] */ - uint32_t stx_dev_minor; - /* 0x90 */ - uint64_t __spare2[14]; /* Spare space for future expansion */ - /* 0x100 */ + /* 0x00 */ + uint32_t stx_mask; /* What results were written [uncond] */ + uint32_t stx_blksize; /* Preferred general I/O size [uncond] */ + uint64_t stx_attributes; /* Flags conveying information about the file */ + /* 0x10 */ + uint32_t stx_nlink; /* Number of hard links */ + uint32_t stx_uid; /* User ID of owner */ + uint32_t stx_gid; /* Group ID of owner */ + uint16_t stx_mode; /* File mode */ + uint16_t __spare0[1]; + /* 0x20 */ + uint64_t stx_ino; /* Inode number */ + uint64_t stx_size; /* File size */ + uint64_t stx_blocks; /* Number of 512-byte blocks allocated */ + uint64_t stx_attributes_mask; /* Mask to show what is supported */ + /* 0x40 */ + struct target_statx_timestamp stx_atime; /* Last access time */ + struct target_statx_timestamp stx_btime; /* File creation time */ + struct target_statx_timestamp stx_ctime; /* Last attribute change time */ + struct target_statx_timestamp stx_mtime; /* Last data modification time */ + /* 0x80 */ + uint32_t stx_rdev_major; /* Device ID of special file [if bdev/cdev] */ + uint32_t stx_rdev_minor; + uint32_t stx_dev_major; /* ID of device containing file [uncond] */ + uint32_t stx_dev_minor; + /* 0x90 */ + uint64_t __spare2[14]; /* Spare space for future expansion */ + /* 0x100 */ }; /* from kernel's include/linux/sched/types.h */ From patchwork Sat Jul 15 13:52:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 703206 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e4d:0:b0:314:25da:8dc4 with SMTP id r13csp156636wrt; Sat, 15 Jul 2023 06:54:11 -0700 (PDT) X-Google-Smtp-Source: APBJJlHlwj7ga1qMI7fPhsq7PNPLb9AVJ7to5TDRFkhnGWzRQE94/9oWT/BNqjq1U22RXLxfR2BT X-Received: by 2002:a05:622a:1052:b0:403:33dd:6a7a with SMTP id f18-20020a05622a105200b0040333dd6a7amr9921990qte.41.1689429250949; Sat, 15 Jul 2023 06:54:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689429250; cv=none; d=google.com; s=arc-20160816; b=1KkqTU1N+eo3KSdHNbu0QImmhzGgs8OvWiatp5hgkA2QFrX+bOa/3iGQT6WeUq2OJB ZDnJzvWH8kztDPU++BC5W+DnU6YkuB+9BErXnCTyX/KDDxHrF5pgxk1Zv6LCyJdFKt1+ BNsFsX1qLeO1HtLMBNk5vild7FvE+MDijTJqnM+lS7jtq04nBXApurjWbv8IxypPUyFk mtXg21aQf9T+AJ1EYHjRxFocPIa8F2yoI4VgrzBSVM8oTPLhflkYkfC+01ugj/UC9+Mm oHji142m9FAj+35qbvgtgUZg1WBrk7BbOj5Z93j1IsDEbX28rKxx3fYvUBZkzvf65DuM l4+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=dfPcEEmBTn/D8MUOuhUDyuANxxowzTkGOvS1jQDZcxE=; fh=i1mkeM7bD/ppus3C3v+92ltBBCUUU0zBXrpbYjAjHqE=; b=Ti+5WPfTecbZ7eFgmmT+CnUsR70h7l4W74RrF/CLdOxaR06IGdHbp4ZT42yM68mNHM W5mThINzn5vN6qQ+96p83deRiyXAFzj3zM06fBRbhmryiDkiZZyVQ1wpGg2qfGKxhmwp 1nWxTF78OAqzrjFFZgAt1oJBxyoFl91CHtTB9ftc4xvoWn4zVqyJ+cRqmz13iSCRRDPv DtbmAuybd4v/Bbk6qD6ZXUHKmduB2/pTnKC9huHTEiN2E5HOxwMmbqGw+ZnVn9LDNwZ4 62YS4KdMMFGjPMHcSt752lVLdxYvC6KyVhHBCPShIMdHH0wMtzcsptW1KjNZ/ZUwiVFE Z7Xw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OqXein9f; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id v13-20020a05622a188d00b004034ec745e1si5788730qtc.59.2023.07.15.06.54.10 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 15 Jul 2023 06:54:10 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OqXein9f; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qKfiF-00041S-8L; Sat, 15 Jul 2023 09:53:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qKfi9-0003zb-FV for qemu-devel@nongnu.org; Sat, 15 Jul 2023 09:53:25 -0400 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qKfi7-0001Cq-E3 for qemu-devel@nongnu.org; Sat, 15 Jul 2023 09:53:25 -0400 Received: by mail-wr1-x429.google.com with SMTP id ffacd0b85a97d-313e742a787so1745954f8f.1 for ; Sat, 15 Jul 2023 06:53:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689429202; x=1692021202; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=dfPcEEmBTn/D8MUOuhUDyuANxxowzTkGOvS1jQDZcxE=; b=OqXein9fBinO/gwAQJ8NmBxtj4z+/9wVz+3A58p4ExqZfC2jmo/5zpQk0tHgvWUksX tLO+e0KJc0xpFME0uwTGrunPDbS+Ikca/Y7DPA6ez2v6P4m7wf7GL+miQ5IRK3gm/aRD 3MxwFiaZ5U0ywH+XqtscY404bD0IHIe/wVCpkiQn6zm7Lhlz/i5Aa/ffncsM06Vp26jo cRKwfxU6C5+sLrHYRs+x6FrVShqaiJDqmCpSTgaLE47Pb8/FHiQniteWjcOttPL9TQjD Owar/jrPyzbqen+GNwAiwx5Azu+hBwoFQ/InRhHAyt01O2zlLzHR1iJESI0ZhKNDr0MO 8ImQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689429202; x=1692021202; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dfPcEEmBTn/D8MUOuhUDyuANxxowzTkGOvS1jQDZcxE=; b=DqmalAbj+qtMaMbq3p3nYCibUoAJCYvhSWsGxQ/cOeOy6ss7i4XNj/nizlcw5r2WTj Z3qk2BtvJHmu5WnXY/wBOrIRqpnH0zTMA63YnsdWMInUPlBj4iCar6dBH/HPR2D63Zwb dx2Hnq66VfUqApRjNfO9MoPBtZ0o32mUcbNLk26kjq6yHXwWZODuTFHr67CAaqDH/XJc VehvSa9kOpGMeA//yjXcAwVsxKM6NTh2kLkAquEmVcQOWndZzhW5hnOmylsZF9RjBbi/ egzGn5dtuc+zhmYasMNI4MWK4DUKMmklybYHWp68fLQM3bd3jAs9lOh0mtJ1YZBmarJX pe/A== X-Gm-Message-State: ABy/qLYk/hZps/IbTbp/mJtQuaq1S6E0IZynS7vM/EH+ytHR2BqrwSFB MnkIRB7GPz62Y97Kvs7ugFyo+ij20pysBCDReO2+Rw== X-Received: by 2002:adf:ed82:0:b0:314:2736:ba3e with SMTP id c2-20020adfed82000000b003142736ba3emr4533911wro.3.1689429202013; Sat, 15 Jul 2023 06:53:22 -0700 (PDT) Received: from stoup.lan ([51.219.12.49]) by smtp.gmail.com with ESMTPSA id k10-20020a5d66ca000000b00313f9085119sm13838014wrw.113.2023.07.15.06.53.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Jul 2023 06:53:21 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL 02/47] linux-user: Remove #if 0 block in syscall_defs.h Date: Sat, 15 Jul 2023 14:52:32 +0100 Message-Id: <20230715135317.7219-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230715135317.7219-1-richard.henderson@linaro.org> References: <20230715135317.7219-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::429; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x429.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org These definitions are in sparc/signal.c. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- linux-user/syscall_defs.h | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index e80d54780b..a4e4df8d3e 100644 --- a/linux-user/syscall_defs.h +++ b/linux-user/syscall_defs.h @@ -547,30 +547,6 @@ typedef union target_sigval { int sival_int; abi_ulong sival_ptr; } target_sigval_t; -#if 0 -#if defined (TARGET_SPARC) -typedef struct { - struct { - abi_ulong psr; - abi_ulong pc; - abi_ulong npc; - abi_ulong y; - abi_ulong u_regs[16]; /* globals and ins */ - } si_regs; - int si_mask; -} __siginfo_t; - -typedef struct { - unsigned long si_float_regs [32]; - unsigned long si_fsr; - unsigned long si_fpqdepth; - struct { - unsigned long *insn_addr; - unsigned long insn; - } si_fpqueue [16]; -} __siginfo_fpu_t; -#endif -#endif #define TARGET_SI_MAX_SIZE 128 From patchwork Sat Jul 15 13:52:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 703228 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e4d:0:b0:314:25da:8dc4 with SMTP id r13csp157465wrt; Sat, 15 Jul 2023 06:56:22 -0700 (PDT) X-Google-Smtp-Source: APBJJlF75m76kyDrLPd5gCGDq6gfzLurPMfBPWXpv9OKHt3N2frxLqH7ouo35UDqPMKoY753N8Ye X-Received: by 2002:a05:620a:4608:b0:75b:23a0:e7a1 with SMTP id br8-20020a05620a460800b0075b23a0e7a1mr9353896qkb.2.1689429382277; Sat, 15 Jul 2023 06:56:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689429382; cv=none; d=google.com; s=arc-20160816; b=xPbNzNHBYKvHL8Lfum4ZsgNWpvMKCVH+PUJtNMftZzc8BqL61tq5UdKuVL64RdnsKm RION07zpuo+XPm0B+Oik+n8ETW9NEjhKvxKX04yatYsdL56EEGCub2KGdu2ZJOGK57Ls 0i+6AibXSDO6RPURjrWydhuCt7w5cg2kom3018dSqgej36KTK+izTtif1w5xx7ca43Xe /Qn7CxMULG4URp8kayTo83bc79veC0E10lm5y+LYgcL6xe6kJOmKf3xMtGqHEVFbsW/q 4y3kWJO8nDTiTF7z/jF53Uf//pr/suy9ysnGuBSUqWqiR21gLMZ1jgXurX0RjgOZ6zyA 3UvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=y5HDzepAQyRVnixawY50vCjdQyLm/QL5xJqPsc4X3Xg=; fh=i1mkeM7bD/ppus3C3v+92ltBBCUUU0zBXrpbYjAjHqE=; b=vtmExCoxCd8P5kdMHp+iEO2deoteWErpiuIN8L2mVvRCN527720SmTolP1GBCf8yJ9 GXurM7VKvuiGy6Hub5XDemO3iYnWbCB7ePv1gz0XeCn/QqhJGcwbxMd9qbe1p06PUE0l PSI4J1JqLvXFH21VNHs5h3mVGWOuVVX+FUmmBur3nelAh+z6nijEn9Wg2BFYGncBaWzf 4Ub5tjayJwUWW8Zv2evRPpzCrQl4L4otjjqmhIBLaGnyG6fpbcOglpJAcv3R8jfGR/qQ goUHSj4GpMhTNiFxTM0fAwnh5ymqxLYwgf0mNk4VDlvLwNyWNA86UwRzCNYwDRNVH8EQ 1QNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ol9sDhyE; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id y19-20020a05620a44d300b00767f1d863adsi4571018qkp.285.2023.07.15.06.56.22 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 15 Jul 2023 06:56:22 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ol9sDhyE; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qKfiq-0004EV-Hf; Sat, 15 Jul 2023 09:54:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qKfiA-0003zu-Ub for qemu-devel@nongnu.org; Sat, 15 Jul 2023 09:53:27 -0400 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qKfi8-0001D0-M3 for qemu-devel@nongnu.org; Sat, 15 Jul 2023 09:53:26 -0400 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-3fbc59de0e2so25911915e9.3 for ; Sat, 15 Jul 2023 06:53:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689429203; x=1692021203; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=y5HDzepAQyRVnixawY50vCjdQyLm/QL5xJqPsc4X3Xg=; b=ol9sDhyEwuUyxufDH6oB6cYMleayRudr6C7++rgSNtsflIjy7XUGxnvBtZhJM5/HiM ZC7kPBRCLc75qKuOHbqlceLp66rb6aklR4J39S0Ne8WpjdMEGrrsni9+SJgqeneDCORU HJPJ+sJweTOb+qU5+NXumvB5w+GXF+O2+dVnFf3/dALPf++TujzH2gmBFNbuh+O6xl1t g1BBHuftspGir1BqgZagO/hO3rn6pC8oW/s2yEoA7ex6fD/mNLreVmwh+vN0lRYi9iHJ kKNRtyvYMoLAcmDS+zXFyvJo3HLOGvval8e5/jxwi5kdA8VXldxnCjhhGHT0kpJdsdBH WD6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689429203; x=1692021203; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=y5HDzepAQyRVnixawY50vCjdQyLm/QL5xJqPsc4X3Xg=; b=L2PPbbi3af7xa744bCAzIcoKlz5KYM61zUPz2c/9qyjmkcEnAIUiLfreUSPjuuhd8L PHA3ObPkGfzU6RwS9IDyjtfBCZj31i//AJDmnU6pdlOqaBAEKfx5kWodxazdXRqGf4os HaB7PYVuGcvZyG8Cj755ucmFadk9YbNw/PWxGpdojrQSgWLavAmX1DX/IrXesIH29p04 r1r9GyYHn8Rx9BST6wvd1s25stHu2KwR4kCxWeP/UeVozYZOJFLF2krKfEN8G4M/hir3 doKll48jVd3555oE9mX5Do5NOkUmktVJD0xV/kyJRBPu2SVX5CW2ZEodyO9YiA5tMx8h v96g== X-Gm-Message-State: ABy/qLZWLJiGxU1Bb4zSTTkLfSyeJepZv1SKMgSPWzC/WEwSsBXH3Ie0 xIde87x5sLFwmiwqTO8F/AVxAP14k9Et+9n8MuMLKQ== X-Received: by 2002:a05:6000:c9:b0:314:1230:29b0 with SMTP id q9-20020a05600000c900b00314123029b0mr6265028wrx.52.1689429202761; Sat, 15 Jul 2023 06:53:22 -0700 (PDT) Received: from stoup.lan ([51.219.12.49]) by smtp.gmail.com with ESMTPSA id k10-20020a5d66ca000000b00313f9085119sm13838014wrw.113.2023.07.15.06.53.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Jul 2023 06:53:22 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL 03/47] linux-user: Use abi_uint not uint32_t in syscall_defs.h Date: Sat, 15 Jul 2023 14:52:33 +0100 Message-Id: <20230715135317.7219-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230715135317.7219-1-richard.henderson@linaro.org> References: <20230715135317.7219-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::332; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x332.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- linux-user/syscall_defs.h | 108 +++++++++++++++++++------------------- 1 file changed, 54 insertions(+), 54 deletions(-) diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index a4e4df8d3e..414d88a9ec 100644 --- a/linux-user/syscall_defs.h +++ b/linux-user/syscall_defs.h @@ -67,7 +67,7 @@ #define USE_UID16 #define target_id uint16_t #else -#define target_id uint32_t +#define target_id abi_uint #endif #if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_SH4) \ @@ -215,9 +215,9 @@ struct target_ip_mreqn { struct target_ip_mreq_source { /* big endian */ - uint32_t imr_multiaddr; - uint32_t imr_interface; - uint32_t imr_sourceaddr; + abi_uint imr_multiaddr; + abi_uint imr_interface; + abi_uint imr_sourceaddr; }; struct target_linger { @@ -508,9 +508,9 @@ typedef abi_ulong target_old_sa_flags; #if defined(TARGET_MIPS) struct target_sigaction { - uint32_t sa_flags; + abi_uint sa_flags; #if defined(TARGET_ABI_MIPSN32) - uint32_t _sa_handler; + abi_uint _sa_handler; #else abi_ulong _sa_handler; #endif @@ -1620,19 +1620,19 @@ struct target_stat { struct QEMU_PACKED target_stat64 { uint64_t st_dev; #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 - uint32_t pad0; - uint32_t __st_ino; + abi_uint pad0; + abi_uint __st_ino; - uint32_t st_mode; - uint32_t st_nlink; - uint32_t st_uid; - uint32_t st_gid; + abi_uint st_mode; + abi_uint st_nlink; + abi_uint st_uid; + abi_uint st_gid; uint64_t st_rdev; uint64_t __pad1; int64_t st_size; int32_t st_blksize; - uint32_t __pad2; + abi_uint __pad2; int64_t st_blocks; /* Number 512-byte blocks allocated. */ int target_st_atime; @@ -2227,19 +2227,19 @@ struct target_statfs { #endif struct target_statfs64 { - uint32_t f_type; - uint32_t f_bsize; - uint32_t f_frsize; /* Fragment size - unsupported */ - uint32_t __pad; + abi_uint f_type; + abi_uint f_bsize; + abi_uint f_frsize; /* Fragment size - unsupported */ + abi_uint __pad; uint64_t f_blocks; uint64_t f_bfree; uint64_t f_files; uint64_t f_ffree; uint64_t f_bavail; target_fsid_t f_fsid; - uint32_t f_namelen; - uint32_t f_flags; - uint32_t f_spare[5]; + abi_uint f_namelen; + abi_uint f_flags; + abi_uint f_spare[5]; }; #elif (defined(TARGET_PPC64) || defined(TARGET_X86_64) || \ defined(TARGET_SPARC64) || defined(TARGET_AARCH64) || \ @@ -2307,33 +2307,33 @@ struct target_statfs64 { }; #else struct target_statfs { - uint32_t f_type; - uint32_t f_bsize; - uint32_t f_blocks; - uint32_t f_bfree; - uint32_t f_bavail; - uint32_t f_files; - uint32_t f_ffree; + abi_uint f_type; + abi_uint f_bsize; + abi_uint f_blocks; + abi_uint f_bfree; + abi_uint f_bavail; + abi_uint f_files; + abi_uint f_ffree; target_fsid_t f_fsid; - uint32_t f_namelen; - uint32_t f_frsize; - uint32_t f_flags; - uint32_t f_spare[4]; + abi_uint f_namelen; + abi_uint f_frsize; + abi_uint f_flags; + abi_uint f_spare[4]; }; struct target_statfs64 { - uint32_t f_type; - uint32_t f_bsize; + abi_uint f_type; + abi_uint f_bsize; uint64_t f_blocks; uint64_t f_bfree; uint64_t f_bavail; uint64_t f_files; uint64_t f_ffree; target_fsid_t f_fsid; - uint32_t f_namelen; - uint32_t f_frsize; - uint32_t f_flags; - uint32_t f_spare[4]; + abi_uint f_namelen; + abi_uint f_frsize; + abi_uint f_flags; + abi_uint f_spare[4]; }; #endif @@ -2713,9 +2713,9 @@ struct target_epoll_event { #endif struct target_ucred { - uint32_t pid; - uint32_t uid; - uint32_t gid; + abi_uint pid; + abi_uint uid; + abi_uint gid; }; typedef int32_t target_timer_t; @@ -2754,14 +2754,14 @@ struct target_sigevent { }; struct target_user_cap_header { - uint32_t version; + abi_uint version; int pid; }; struct target_user_cap_data { - uint32_t effective; - uint32_t permitted; - uint32_t inheritable; + abi_uint effective; + abi_uint permitted; + abi_uint inheritable; }; /* from kernel's include/linux/syslog.h */ @@ -2791,19 +2791,19 @@ struct target_user_cap_data { struct target_statx_timestamp { int64_t tv_sec; - uint32_t tv_nsec; + abi_uint tv_nsec; int32_t __reserved; }; struct target_statx { /* 0x00 */ - uint32_t stx_mask; /* What results were written [uncond] */ - uint32_t stx_blksize; /* Preferred general I/O size [uncond] */ + abi_uint stx_mask; /* What results were written [uncond] */ + abi_uint stx_blksize; /* Preferred general I/O size [uncond] */ uint64_t stx_attributes; /* Flags conveying information about the file */ /* 0x10 */ - uint32_t stx_nlink; /* Number of hard links */ - uint32_t stx_uid; /* User ID of owner */ - uint32_t stx_gid; /* Group ID of owner */ + abi_uint stx_nlink; /* Number of hard links */ + abi_uint stx_uid; /* User ID of owner */ + abi_uint stx_gid; /* Group ID of owner */ uint16_t stx_mode; /* File mode */ uint16_t __spare0[1]; /* 0x20 */ @@ -2817,10 +2817,10 @@ struct target_statx { struct target_statx_timestamp stx_ctime; /* Last attribute change time */ struct target_statx_timestamp stx_mtime; /* Last data modification time */ /* 0x80 */ - uint32_t stx_rdev_major; /* Device ID of special file [if bdev/cdev] */ - uint32_t stx_rdev_minor; - uint32_t stx_dev_major; /* ID of device containing file [uncond] */ - uint32_t stx_dev_minor; + abi_uint stx_rdev_major; /* Device ID of special file [if bdev/cdev] */ + abi_uint stx_rdev_minor; + abi_uint stx_dev_major; /* ID of device containing file [uncond] */ + abi_uint stx_dev_minor; /* 0x90 */ uint64_t __spare2[14]; /* Spare space for future expansion */ /* 0x100 */ From patchwork Sat Jul 15 13:52:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 703205 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e4d:0:b0:314:25da:8dc4 with SMTP id r13csp156630wrt; Sat, 15 Jul 2023 06:54:11 -0700 (PDT) X-Google-Smtp-Source: APBJJlGxcH5zm2FeZB1tV4gWlQH6AOxwrLysftZCEZS069mOS1HncGl5OTz32X2jJ1i6idMZUdT4 X-Received: by 2002:a05:620a:2906:b0:767:f108:c26d with SMTP id m6-20020a05620a290600b00767f108c26dmr9681632qkp.55.1689429250837; Sat, 15 Jul 2023 06:54:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689429250; cv=none; d=google.com; s=arc-20160816; b=m/E5fOSENl7n98HEmyQCWB+fUgEQ9GWyJRNn2HHz9fx018nSSX+q7ib1d7l89BAEMO Dx68V4Su1VoWXC8L74UBp17ruPaLI33VRaU6/e6Cmnlfr3FpSZonJLBPnZV8gfxXj/yA xsNfxiA3A2GDKu+3u6StSmU8gYSfCMFJd+or5KCXYBx+XVegGPNU3ZfNLYWw675HtEyM PCD6innG9b4qB/AGIqYiwkwv8FbMdmHndw8znkk6A0Rn8g8iTBEzaGMufoyvzX6/bbGD ouyCZ56DPBlNjx2l6bLaBTtg6SI/ur2IjzQSeASl7VgjpOdet8ZaR+h2OwKRiX2a9lsI tpxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=aow7z7inlkO3pr/eTAXJ2bbplOH1xZ+KdEP0VBoCQXI=; fh=i1mkeM7bD/ppus3C3v+92ltBBCUUU0zBXrpbYjAjHqE=; b=C863qUhJI8+eyDgPZeh2On0EZuRbIpsXQMz+TJmfsxj1ubiVY3ebgUWJtNYsCARxEt ULnugjtV2byhLYyyBU9YgNVkqvW2T/gyNeIqL2NFh7DvtPogVevoxJOoUry5Qw0PNok/ nn+408cLTIUzBk/PwFvEhOVYFQc0yCvtTS0+zyVYNbTPPZWlUelaZ83zrwPEvLXqNhnV rkSqdmhr7YbfIKpoDvXoX8Aa6Y7T4EMalOkc/X7bLJd9UOF/Z4hSRxNdQCB8a5rLk4kP XfZTQY9XBULMsvAhJXuWhurqz3lMY/nropWEY731+ItV1Zj2no79Te1aHU9GCoPvpvDA I24g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=RTjwWOYm; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id s21-20020a05620a0bd500b007671821d546si6003529qki.187.2023.07.15.06.54.10 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 15 Jul 2023 06:54:10 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=RTjwWOYm; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qKfiM-00043P-6I; Sat, 15 Jul 2023 09:53:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qKfiB-000402-8X for qemu-devel@nongnu.org; Sat, 15 Jul 2023 09:53:27 -0400 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qKfi9-0001D8-ED for qemu-devel@nongnu.org; Sat, 15 Jul 2023 09:53:26 -0400 Received: by mail-wr1-x429.google.com with SMTP id ffacd0b85a97d-3142970df44so2813875f8f.3 for ; Sat, 15 Jul 2023 06:53:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689429203; x=1692021203; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=aow7z7inlkO3pr/eTAXJ2bbplOH1xZ+KdEP0VBoCQXI=; b=RTjwWOYm4eKzKUjiWS3cqDlE2GjnEiWDG3uy9B1VtH7qvBRPlQrkc5R8QX6ScjRVTB CBTFnSIBbbEMg3x98gKw8veaJ2rAQdfgYDEzWOrI1QyVmmY0/Vrnp/XJLkoVHGBdY6cm lTgQfv0L1MUs6DTH36RJ+i0PScYHyzSeYd/75YQ5jyVS7+bI8rJU7xz3sv90k0mE75vu 3kWqG6YNssgbjC0/Hag9RRJzIdXuGtiXNyNyfyBTWYtgYIliXZEm4X16aYHSApG7IK2y NZ7FF5gEI+AVAmNzdl2alQBXmQQxZoDfo2dWzS6DsO7DM5QGGiV2UQUB3fMhUDlFuOyF wHEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689429203; x=1692021203; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=aow7z7inlkO3pr/eTAXJ2bbplOH1xZ+KdEP0VBoCQXI=; b=Ra1nYnhHPwwEl2DMRUizCpv4eby5hV9s8xbLYu6Ugo49j0Byt4cMAcrrvnByLJsCAP bVeVlnTXdT3v1cBc+xcLQLmIZ8I4XgMypM+QiLtluZaJyl7smmIlY5dHZMw97BxIO12I mQ9gi/y8E8YB1I5MuWAtRwtYP/n0UiopLx5uGXElsgOUsi9Qdnpdx9m+WUavtM7cLOL5 +i8JdqCPEifV7QrosXNfhvcnUiA4KOS4bR+ZZ5f15jWXj0OBTjO97flUboUSl0gTxAeo CtybMvu5TA2okm7xhhwJixpeSsoI/IdendDvTDlC8gQtz417wlamROehf52NpG6GHhWH uD3Q== X-Gm-Message-State: ABy/qLYw8vA/Pot+JUgRYaSxGbr+O96C4/LJBt6Jq5M3kh+LFrlmZLcb nMYbJOStu37b1DX5OScbJKuQnEpBq7PlW2oasuUKVA== X-Received: by 2002:adf:cf0d:0:b0:314:121d:8cbf with SMTP id o13-20020adfcf0d000000b00314121d8cbfmr6538926wrj.25.1689429203496; Sat, 15 Jul 2023 06:53:23 -0700 (PDT) Received: from stoup.lan ([51.219.12.49]) by smtp.gmail.com with ESMTPSA id k10-20020a5d66ca000000b00313f9085119sm13838014wrw.113.2023.07.15.06.53.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Jul 2023 06:53:23 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL 04/47] linux-user: Use abi_int not int32_t in syscall_defs.h Date: Sat, 15 Jul 2023 14:52:34 +0100 Message-Id: <20230715135317.7219-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230715135317.7219-1-richard.henderson@linaro.org> References: <20230715135317.7219-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::429; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x429.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- linux-user/syscall_defs.h | 60 +++++++++++++++++++-------------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index 414d88a9ec..caaa895bec 100644 --- a/linux-user/syscall_defs.h +++ b/linux-user/syscall_defs.h @@ -501,7 +501,7 @@ int do_sigaction(int sig, const struct target_sigaction *act, #endif #if defined(TARGET_ALPHA) -typedef int32_t target_old_sa_flags; +typedef abi_int target_old_sa_flags; #else typedef abi_ulong target_old_sa_flags; #endif @@ -1631,7 +1631,7 @@ struct QEMU_PACKED target_stat64 { uint64_t __pad1; int64_t st_size; - int32_t st_blksize; + abi_int st_blksize; abi_uint __pad2; int64_t st_blocks; /* Number 512-byte blocks allocated. */ @@ -2192,20 +2192,20 @@ typedef struct { #ifdef TARGET_MIPS #ifdef TARGET_ABI_MIPSN32 struct target_statfs { - int32_t f_type; - int32_t f_bsize; - int32_t f_frsize; /* Fragment size - unsupported */ - int32_t f_blocks; - int32_t f_bfree; - int32_t f_files; - int32_t f_ffree; - int32_t f_bavail; + abi_int f_type; + abi_int f_bsize; + abi_int f_frsize; /* Fragment size - unsupported */ + abi_int f_blocks; + abi_int f_bfree; + abi_int f_files; + abi_int f_ffree; + abi_int f_bavail; /* Linux specials */ target_fsid_t f_fsid; - int32_t f_namelen; - int32_t f_flags; - int32_t f_spare[5]; + abi_int f_namelen; + abi_int f_flags; + abi_int f_spare[5]; }; #else struct target_statfs { @@ -2276,34 +2276,34 @@ struct target_statfs64 { }; #elif defined(TARGET_S390X) struct target_statfs { - int32_t f_type; - int32_t f_bsize; + abi_int f_type; + abi_int f_bsize; abi_long f_blocks; abi_long f_bfree; abi_long f_bavail; abi_long f_files; abi_long f_ffree; kernel_fsid_t f_fsid; - int32_t f_namelen; - int32_t f_frsize; - int32_t f_flags; - int32_t f_spare[4]; + abi_int f_namelen; + abi_int f_frsize; + abi_int f_flags; + abi_int f_spare[4]; }; struct target_statfs64 { - int32_t f_type; - int32_t f_bsize; + abi_int f_type; + abi_int f_bsize; abi_long f_blocks; abi_long f_bfree; abi_long f_bavail; abi_long f_files; abi_long f_ffree; kernel_fsid_t f_fsid; - int32_t f_namelen; - int32_t f_frsize; - int32_t f_flags; - int32_t f_spare[4]; + abi_int f_namelen; + abi_int f_frsize; + abi_int f_flags; + abi_int f_spare[4]; }; #else struct target_statfs { @@ -2718,21 +2718,21 @@ struct target_ucred { abi_uint gid; }; -typedef int32_t target_timer_t; +typedef abi_int target_timer_t; #define TARGET_SIGEV_MAX_SIZE 64 /* This is architecture-specific but most architectures use the default */ #ifdef TARGET_MIPS -#define TARGET_SIGEV_PREAMBLE_SIZE (sizeof(int32_t) * 2 + sizeof(abi_long)) +#define TARGET_SIGEV_PREAMBLE_SIZE (sizeof(abi_int) * 2 + sizeof(abi_long)) #else -#define TARGET_SIGEV_PREAMBLE_SIZE (sizeof(int32_t) * 2 \ +#define TARGET_SIGEV_PREAMBLE_SIZE (sizeof(abi_int) * 2 \ + sizeof(target_sigval_t)) #endif #define TARGET_SIGEV_PAD_SIZE ((TARGET_SIGEV_MAX_SIZE \ - TARGET_SIGEV_PREAMBLE_SIZE) \ - / sizeof(int32_t)) + / sizeof(abi_int)) struct target_sigevent { target_sigval_t sigev_value; @@ -2792,7 +2792,7 @@ struct target_user_cap_data { struct target_statx_timestamp { int64_t tv_sec; abi_uint tv_nsec; - int32_t __reserved; + abi_int __reserved; }; struct target_statx { From patchwork Sat Jul 15 13:52:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 703214 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e4d:0:b0:314:25da:8dc4 with SMTP id r13csp157077wrt; Sat, 15 Jul 2023 06:55:18 -0700 (PDT) X-Google-Smtp-Source: APBJJlF4mUKCMbFSJXzFQ2d8idQ9h14RJx/pB4vuELK4+2wIEbTSlxwlwscJ9h9+CkdVyP4wHpET X-Received: by 2002:a0c:e385:0:b0:63c:6f79:f57e with SMTP id a5-20020a0ce385000000b0063c6f79f57emr4258637qvl.2.1689429318553; Sat, 15 Jul 2023 06:55:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689429318; cv=none; d=google.com; s=arc-20160816; b=D12jnSPyCjr2ebHbkXsGU5isuzOMa2NylbAxiIVSpqmwT4SpynKPCgSkD36mca8zzF CmlhU9QPAgqom6+lRJ1qJumgJAzaZtYI+4gJ6EkbFGR8INjVgSefcsuZ4Usgj67q0EBr j/g6+KmEptKGyVGAxzsiJtHnNtyvFF6yjLXjqH53pN7mG/4o5FDDHqfvYHzS9j0axwFx PLqdZyb6RFTy51VPezsO6kTyPkXc2/73MXcdUb3VStwzOBwLZ5ZYc1htspY6ly/ZGl2O OaKud7bFni0EU9RJcatHHvLbzaFaU1AVSMFIG0EC42JzmUi7zJTgc3oKGBRRENQvlOY2 G53g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=LO73AWeIHAR2oL9a8MGDntKx1EKSzMSEdZSpHf3WsVU=; fh=i1mkeM7bD/ppus3C3v+92ltBBCUUU0zBXrpbYjAjHqE=; b=JtDWI5yLOP5XkTVFgqmQqw9sP7EodQtHD927OFwZI/iO82e6q83t2y4zGpw71AI9jL ObCH2J1gcmoP4BStgWaJkalFF/SgiOzsOjd2GjnA/v3qMn7nIAUEO4Buq28nWCVk/gj5 sav0gHeAaoOMrDZ2b2+BxjgFEoNDPxH8J/8IFtEu5xjiu+y1Ft4MjGtF4+wJycaQGrlJ sEY60YV3AnG8J9Un4D79PMxwaN2txgC9sNUqoiRc+l8ioC6SZf6vEMSSp4cocptZaEJ4 OmedB/NdOJOWFH2tpALfM2ZOS+s6VSd3s4Tbj0al3KMpgMptVKf0oRwWSnnRKsLDzZ8J wcZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TwVb2J+d; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d13-20020a0cb2cd000000b0062391476344si5736267qvf.383.2023.07.15.06.55.18 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 15 Jul 2023 06:55:18 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TwVb2J+d; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qKfiG-00042L-4L; Sat, 15 Jul 2023 09:53:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qKfiC-00040w-IW for qemu-devel@nongnu.org; Sat, 15 Jul 2023 09:53:29 -0400 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qKfi9-0001DI-Um for qemu-devel@nongnu.org; Sat, 15 Jul 2023 09:53:28 -0400 Received: by mail-wr1-x42d.google.com with SMTP id ffacd0b85a97d-307d20548adso2876256f8f.0 for ; Sat, 15 Jul 2023 06:53:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689429204; x=1692021204; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=LO73AWeIHAR2oL9a8MGDntKx1EKSzMSEdZSpHf3WsVU=; b=TwVb2J+dv7XD4RwXPs8updH17KS+A4Y9JPg5jPgBLEj4Lnfxj6C1GCY9qWuIdY6q8L Pg/nzz64F/yNOZB2IZskINYkPbzpWl7BoLIQY1R9KM/vhi7Pbi5v2T20DWsRs9tzAa2k 1thFqr0X2JJkEVYUXqdJF9nSdE1EmPYPLfAH6iomtfq+3PhHWeY4a1A6WhMG4YjjR972 udUIzdspen/VSBFTCm8Rx78zZRZAZhrquppaTpwPliIywEV7zba0wQY0uBIbQIxGgEKW niuzRY0gYUcbRPKxUkmNX3Jj1hvu0aMihJ9n5M370eGoG1JcsyqlmYKfLf4njYs0S7aT PWHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689429204; x=1692021204; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LO73AWeIHAR2oL9a8MGDntKx1EKSzMSEdZSpHf3WsVU=; b=PHKEI8uZcRgcI8H+aYfSYhN1rlftv6d3kzCpNTFGF8UNWRZPWyr1v4V5JDKaR3MSWR BPGDqYPYcMW/pDJ4Le9ZWH6eGyGff3Hznga5XSg0+u4As6YszMbdqPH0DvgIohRfVpcH D1cxZrNHjPolAU6IhBcPCR3G6MNDhuluBYckmoBqtHrJQwG3DhF8Zvy6Dmi0sEa/9O/r ekWky2YpFtz5KVCn4c5xeZNYCoss3Zke3hAKvRNqWGGJ+2LV6oKREk5ktuZcSPePGTE5 rZ7fwcDuPa8dxOCzEuOhUfEIY9CEgt6wWQO28RA4soV4O/mcYr09gMgvP2BNwed507u2 EUxQ== X-Gm-Message-State: ABy/qLbaSFGaGMnTucZHYBPEt1xeyun3FKrs+7XWe46orEpetttGX3UM uzZBa8rTRaQvh24aDogEFPBI+hagQTD0psQoryfbWw== X-Received: by 2002:a05:6000:4f:b0:314:dc0:73f1 with SMTP id k15-20020a056000004f00b003140dc073f1mr6711517wrx.38.1689429204174; Sat, 15 Jul 2023 06:53:24 -0700 (PDT) Received: from stoup.lan ([51.219.12.49]) by smtp.gmail.com with ESMTPSA id k10-20020a5d66ca000000b00313f9085119sm13838014wrw.113.2023.07.15.06.53.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Jul 2023 06:53:23 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL 05/47] linux-user: Use abi_ullong not uint64_t in syscall_defs.h Date: Sat, 15 Jul 2023 14:52:35 +0100 Message-Id: <20230715135317.7219-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230715135317.7219-1-richard.henderson@linaro.org> References: <20230715135317.7219-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42d; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x42d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Be careful not to change linux_dirent64, which is a host structure. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- linux-user/syscall_defs.h | 72 +++++++++++++++++++-------------------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index caaa895bec..0af7249330 100644 --- a/linux-user/syscall_defs.h +++ b/linux-user/syscall_defs.h @@ -1444,8 +1444,8 @@ struct target_stat64 { unsigned char __pad0[6]; unsigned short st_dev; - uint64_t st_ino; - uint64_t st_nlink; + abi_ullong st_ino; + abi_ullong st_nlink; unsigned int st_mode; @@ -1501,7 +1501,7 @@ struct target_stat64 { unsigned char __pad0[6]; unsigned short st_dev; - uint64_t st_ino; + abi_ullong st_ino; unsigned int st_mode; unsigned int st_nlink; @@ -1618,7 +1618,7 @@ struct target_stat { /* FIXME: Microblaze no-mmu user-space has a difference stat64 layout... */ #define TARGET_HAS_STRUCT_STAT64 struct QEMU_PACKED target_stat64 { - uint64_t st_dev; + abi_ullong st_dev; #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 abi_uint pad0; abi_uint __st_ino; @@ -1627,8 +1627,8 @@ struct QEMU_PACKED target_stat64 { abi_uint st_nlink; abi_uint st_uid; abi_uint st_gid; - uint64_t st_rdev; - uint64_t __pad1; + abi_ullong st_rdev; + abi_ullong __pad1; int64_t st_size; abi_int st_blksize; @@ -1641,7 +1641,7 @@ struct QEMU_PACKED target_stat64 { unsigned int target_st_mtime_nsec; int target_st_ctime; unsigned int target_st_ctime_nsec; - uint64_t st_ino; + abi_ullong st_ino; }; #elif defined(TARGET_M68K) @@ -1753,7 +1753,7 @@ struct target_stat { struct target_stat { abi_ulong st_dev; abi_ulong st_pad0[3]; /* Reserved for st_dev expansion */ - uint64_t st_ino; + abi_ullong st_ino; unsigned int st_mode; unsigned int st_nlink; int st_uid; @@ -1813,7 +1813,7 @@ struct target_stat64 { abi_ulong st_dev; abi_ulong st_pad0[3]; /* Reserved for st_dev expansion */ - uint64_t st_ino; + abi_ullong st_ino; unsigned int st_mode; unsigned int st_nlink; @@ -2044,17 +2044,17 @@ struct target_stat { #define TARGET_HAS_STRUCT_STAT64 struct target_stat64 { - uint64_t st_dev; /* Device */ - uint64_t st_ino; /* File serial number */ + abi_ullong st_dev; /* Device */ + abi_ullong st_ino; /* File serial number */ unsigned int st_mode; /* File mode. */ unsigned int st_nlink; /* Link count. */ unsigned int st_uid; /* User ID of the file's owner. */ unsigned int st_gid; /* Group ID of the file's group. */ - uint64_t st_rdev; /* Device number, if device. */ + abi_ullong st_rdev; /* Device number, if device. */ int64_t st_size; /* Size of file, in bytes. */ abi_ulong st_blksize; /* Optimal block size for I/O. */ abi_ulong __unused2; - uint64_t st_blocks; /* Number 512-byte blocks allocated. */ + abi_ullong st_blocks; /* Number 512-byte blocks allocated. */ abi_ulong target_st_atime; /* Time of last access. */ abi_ulong target_st_atime_nsec; abi_ulong target_st_mtime; /* Time of last modification. */ @@ -2097,14 +2097,14 @@ struct target_stat { #if !defined(TARGET_RISCV64) #define TARGET_HAS_STRUCT_STAT64 struct target_stat64 { - uint64_t st_dev; - uint64_t st_ino; + abi_ullong st_dev; + abi_ullong st_ino; unsigned int st_mode; unsigned int st_nlink; unsigned int st_uid; unsigned int st_gid; - uint64_t st_rdev; - uint64_t __pad1; + abi_ullong st_rdev; + abi_ullong __pad1; int64_t st_size; int st_blksize; int __pad2; @@ -2156,14 +2156,14 @@ struct target_stat { #define TARGET_HAS_STRUCT_STAT64 struct target_stat64 { - uint64_t st_dev; + abi_ullong st_dev; abi_uint _pad1; abi_uint _res1; abi_uint st_mode; abi_uint st_nlink; abi_uint st_uid; abi_uint st_gid; - uint64_t st_rdev; + abi_ullong st_rdev; abi_uint _pad2; int64_t st_size; abi_int st_blksize; @@ -2174,7 +2174,7 @@ struct target_stat64 { abi_uint target_st_mtime_nsec; abi_int target_st_ctime; abi_uint target_st_ctime_nsec; - uint64_t st_ino; + abi_ullong st_ino; }; #elif defined(TARGET_LOONGARCH64) @@ -2231,11 +2231,11 @@ struct target_statfs64 { abi_uint f_bsize; abi_uint f_frsize; /* Fragment size - unsupported */ abi_uint __pad; - uint64_t f_blocks; - uint64_t f_bfree; - uint64_t f_files; - uint64_t f_ffree; - uint64_t f_bavail; + abi_ullong f_blocks; + abi_ullong f_bfree; + abi_ullong f_files; + abi_ullong f_ffree; + abi_ullong f_bavail; target_fsid_t f_fsid; abi_uint f_namelen; abi_uint f_flags; @@ -2324,11 +2324,11 @@ struct target_statfs { struct target_statfs64 { abi_uint f_type; abi_uint f_bsize; - uint64_t f_blocks; - uint64_t f_bfree; - uint64_t f_bavail; - uint64_t f_files; - uint64_t f_ffree; + abi_ullong f_blocks; + abi_ullong f_bfree; + abi_ullong f_bavail; + abi_ullong f_files; + abi_ullong f_ffree; target_fsid_t f_fsid; abi_uint f_namelen; abi_uint f_frsize; @@ -2799,7 +2799,7 @@ struct target_statx { /* 0x00 */ abi_uint stx_mask; /* What results were written [uncond] */ abi_uint stx_blksize; /* Preferred general I/O size [uncond] */ - uint64_t stx_attributes; /* Flags conveying information about the file */ + abi_ullong stx_attributes; /* Flags conveying information about the file */ /* 0x10 */ abi_uint stx_nlink; /* Number of hard links */ abi_uint stx_uid; /* User ID of owner */ @@ -2807,10 +2807,10 @@ struct target_statx { uint16_t stx_mode; /* File mode */ uint16_t __spare0[1]; /* 0x20 */ - uint64_t stx_ino; /* Inode number */ - uint64_t stx_size; /* File size */ - uint64_t stx_blocks; /* Number of 512-byte blocks allocated */ - uint64_t stx_attributes_mask; /* Mask to show what is supported */ + abi_ullong stx_ino; /* Inode number */ + abi_ullong stx_size; /* File size */ + abi_ullong stx_blocks; /* Number of 512-byte blocks allocated */ + abi_ullong stx_attributes_mask; /* Mask to show what is supported */ /* 0x40 */ struct target_statx_timestamp stx_atime; /* Last access time */ struct target_statx_timestamp stx_btime; /* File creation time */ @@ -2822,7 +2822,7 @@ struct target_statx { abi_uint stx_dev_major; /* ID of device containing file [uncond] */ abi_uint stx_dev_minor; /* 0x90 */ - uint64_t __spare2[14]; /* Spare space for future expansion */ + abi_ullong __spare2[14]; /* Spare space for future expansion */ /* 0x100 */ }; From patchwork Sat Jul 15 13:52:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 703207 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e4d:0:b0:314:25da:8dc4 with SMTP id r13csp156632wrt; Sat, 15 Jul 2023 06:54:11 -0700 (PDT) X-Google-Smtp-Source: APBJJlFffKCeYgQ2SwTVT0cBE09E5bPoGriBLaLadGqidwtkXswWHML6xv3nHWxyjgwleZgLYNg/ X-Received: by 2002:a0c:eb09:0:b0:62d:f170:f6b3 with SMTP id j9-20020a0ceb09000000b0062df170f6b3mr6618773qvp.19.1689429250928; Sat, 15 Jul 2023 06:54:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689429250; cv=none; d=google.com; s=arc-20160816; b=YUusxfC48H7NNEW0cnmPo3uIf6BMge/k3zHpYt2VEBDEuKMIhUVkqXH6plHsJFcJL4 O0eyqlz7136dLevUkwOzUG3c5vySHZcW7JgwEzu5deFatIL/MoRvzhzUVOz0oQUjLw3/ dJ8eexYrjOpLlezO9904svAnce92TGyuVdM2D7VASFil4pG10yikGU3ESDTdS4gxk33F cfg8DbvTdHYHjC0cPBmdAmIhdWAu3whvdWFSzilURceofw+CU5CvF8vWV+tpCDGqpyKo xJA8CFm2sCuxleWZHwbDM1fSRfD8a8//SjVVqEAvHagFw9zeoTNdX5LhiVJ2Y7OgTeEg YOfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=IDhKHcH/mNT2yQDdOveHYCYG5DGoM6IQc0ARd1bSGIA=; fh=i1mkeM7bD/ppus3C3v+92ltBBCUUU0zBXrpbYjAjHqE=; b=f6JOFLDlarj8orVqf3mt6lFwthPeOiz8ThJQFOcc82rKo8OsOr11HhU41hlBWn7o4N xyTcb4ld54avJl/ZqZdsQ4JMh9Z6DJsYLfEOGHPpwGBksGAhviiQFNQIAuGO6hO3zqBj YW2Wk0Hl5R7p0Y8zyaQ717K+SbKwAcTNz1YwQbUYHqQITozcZRqYV4wOvvWzdngSXqbG IZx6HNb003LzdNgVXfUr7/y0LuxW9VuZiCGZmrP1Zw1ohGkAT2emZs2ZaWWWId00uHkf 7L/FKI8uOS9RTNgnjYl2FuqXTwCveKebYk9gb/3RT4bCCsNqXklIy76zAudq5Cmv9KUG V7PQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=a2mLXyWv; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d1-20020a0cdb01000000b0063673095de0si5802873qvk.179.2023.07.15.06.54.10 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 15 Jul 2023 06:54:10 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=a2mLXyWv; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qKfiV-00045P-MU; Sat, 15 Jul 2023 09:53:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qKfiC-00040v-CG for qemu-devel@nongnu.org; Sat, 15 Jul 2023 09:53:29 -0400 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qKfiA-0001DN-7g for qemu-devel@nongnu.org; Sat, 15 Jul 2023 09:53:28 -0400 Received: by mail-wr1-x42b.google.com with SMTP id ffacd0b85a97d-3142970df44so2813896f8f.3 for ; Sat, 15 Jul 2023 06:53:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689429205; x=1692021205; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=IDhKHcH/mNT2yQDdOveHYCYG5DGoM6IQc0ARd1bSGIA=; b=a2mLXyWvNFNCzB/3H4pTulMciSxBrCVsWNnsUTXNvZjja1l15Pr0LPw4JNM4TDjdTl X7SvQ2fUqVt1e42Zk3IfP1HWV7cxy2UqMjzv+aj2cXuKRNmCp8AQvT1d4TdXCMXH8dIW jjzdCRelL2w51XFoCte+uJs/LNoTY9M5xS/z2+kfEyWihO5y22GNZ3fmXu04N6K3EYFs 2t0KR8iXkGvBbkb/TaH5gHpvhdTCYiQD24x3KqVfAahlxUV3cLX6wK1kt4VApARQgguQ bN1y9QfjvCpGjrR7msjamSLhjKVsjwpUoQoFnZn/JHETgGBPMZwfpaZSFojnQGWjsona qAKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689429205; x=1692021205; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=IDhKHcH/mNT2yQDdOveHYCYG5DGoM6IQc0ARd1bSGIA=; b=KmD1Pr8xtTarR2HIqb4xW6Ce+VNAkH6RA9jlVjB4KL/TxF8NXoO5Q30J6PzBfeAbqf bxE77yUST/U1LTUAmssxohiOiyMsOHU8gZ+25OUoYTWdXJv5pnrTZ6YHHcGD2vKza4CP Yl0QSMCSDf+rEQ7wgyQGQtEgg8dJbZ3kn88CtnJHvyZoLFV1GbndAjv3TB1ViL7dWxA/ QTKO20fad4l0VmcAGWeDPFEBoPTijHikSviEusTaSrTJ0CD8WnbPVyN0JrY/dyRrcFjO ZFzqH1CehrEVVa0i4zfHSZmjPJdUeueVpwURBHp+oUHa85aZ0z41LbW7AE2yGh5IK1ID 1x0A== X-Gm-Message-State: ABy/qLZXKLqyGPSNBpho7X0oTItG8Z8yV01lw/eQS+NN/kJVHGQ8DEWv +YOBpu227AhYJCyQszAqecKwZYJm64LITEIP2bXDtg== X-Received: by 2002:a5d:6110:0:b0:315:a6a5:fe95 with SMTP id v16-20020a5d6110000000b00315a6a5fe95mr6189396wrt.52.1689429204895; Sat, 15 Jul 2023 06:53:24 -0700 (PDT) Received: from stoup.lan ([51.219.12.49]) by smtp.gmail.com with ESMTPSA id k10-20020a5d66ca000000b00313f9085119sm13838014wrw.113.2023.07.15.06.53.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Jul 2023 06:53:24 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL 06/47] linux-user: Use abi_llong not int64_t in syscall_defs.h Date: Sat, 15 Jul 2023 14:52:36 +0100 Message-Id: <20230715135317.7219-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230715135317.7219-1-richard.henderson@linaro.org> References: <20230715135317.7219-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42b; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x42b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Be careful not to change linux_dirent64, which is a host structure. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- linux-user/syscall_defs.h | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index 0af7249330..2846a8cfa5 100644 --- a/linux-user/syscall_defs.h +++ b/linux-user/syscall_defs.h @@ -1455,8 +1455,8 @@ struct target_stat64 { unsigned char __pad2[6]; unsigned short st_rdev; - int64_t st_size; - int64_t st_blksize; + abi_llong st_size; + abi_llong st_blksize; unsigned char __pad4[4]; unsigned int st_blocks; @@ -1514,7 +1514,7 @@ struct target_stat64 { unsigned char __pad3[8]; - int64_t st_size; + abi_llong st_size; unsigned int st_blksize; unsigned char __pad4[8]; @@ -1630,10 +1630,10 @@ struct QEMU_PACKED target_stat64 { abi_ullong st_rdev; abi_ullong __pad1; - int64_t st_size; + abi_llong st_size; abi_int st_blksize; abi_uint __pad2; - int64_t st_blocks; /* Number 512-byte blocks allocated. */ + abi_llong st_blocks; int target_st_atime; unsigned int target_st_atime_nsec; @@ -1760,7 +1760,7 @@ struct target_stat { int st_gid; abi_ulong st_rdev; abi_ulong st_pad1[3]; /* Reserved for st_rdev expansion */ - int64_t st_size; + abi_llong st_size; abi_long target_st_atime; abi_ulong target_st_atime_nsec; /* Reserved for st_atime expansion */ abi_long target_st_mtime; @@ -1769,7 +1769,7 @@ struct target_stat { abi_ulong target_st_ctime_nsec; /* Reserved for st_ctime expansion */ abi_ulong st_blksize; abi_ulong st_pad2; - int64_t st_blocks; + abi_llong st_blocks; }; #elif defined(TARGET_ABI_MIPSO32) @@ -1824,7 +1824,7 @@ struct target_stat64 { abi_ulong st_rdev; abi_ulong st_pad1[3]; /* Reserved for st_rdev expansion */ - int64_t st_size; + abi_llong st_size; /* * Actually this should be timestruc_t st_atime, st_mtime and st_ctime @@ -1842,7 +1842,7 @@ struct target_stat64 { abi_ulong st_blksize; abi_ulong st_pad2; - int64_t st_blocks; + abi_llong st_blocks; }; #elif defined(TARGET_ALPHA) @@ -2051,7 +2051,7 @@ struct target_stat64 { unsigned int st_uid; /* User ID of the file's owner. */ unsigned int st_gid; /* Group ID of the file's group. */ abi_ullong st_rdev; /* Device number, if device. */ - int64_t st_size; /* Size of file, in bytes. */ + abi_llong st_size; /* Size of file, in bytes. */ abi_ulong st_blksize; /* Optimal block size for I/O. */ abi_ulong __unused2; abi_ullong st_blocks; /* Number 512-byte blocks allocated. */ @@ -2105,10 +2105,10 @@ struct target_stat64 { unsigned int st_gid; abi_ullong st_rdev; abi_ullong __pad1; - int64_t st_size; + abi_llong st_size; int st_blksize; int __pad2; - int64_t st_blocks; + abi_llong st_blocks; int target_st_atime; unsigned int target_st_atime_nsec; int target_st_mtime; @@ -2165,9 +2165,9 @@ struct target_stat64 { abi_uint st_gid; abi_ullong st_rdev; abi_uint _pad2; - int64_t st_size; + abi_llong st_size; abi_int st_blksize; - int64_t st_blocks; + abi_llong st_blocks; abi_int target_st_atime; abi_uint target_st_atime_nsec; abi_int target_st_mtime; @@ -2790,7 +2790,7 @@ struct target_user_cap_data { #define TARGET_SYSLOG_ACTION_SIZE_BUFFER 10 struct target_statx_timestamp { - int64_t tv_sec; + abi_llong tv_sec; abi_uint tv_nsec; abi_int __reserved; }; From patchwork Sat Jul 15 13:52:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 703244 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e4d:0:b0:314:25da:8dc4 with SMTP id r13csp158830wrt; Sat, 15 Jul 2023 07:00:07 -0700 (PDT) X-Google-Smtp-Source: APBJJlFXGleV2UH6vf9MzAbdKFHqMSBLvJXBQpgyhV3ZRwNTdtLqMoUR6cNfB11W63Od/0g4jm8r X-Received: by 2002:a0c:e3c7:0:b0:626:1ba1:70ae with SMTP id e7-20020a0ce3c7000000b006261ba170aemr6537308qvl.33.1689429606942; Sat, 15 Jul 2023 07:00:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689429606; cv=none; d=google.com; s=arc-20160816; b=rH43D2McgNr462ADpRUVutut5sU404vd820o3LOHCurb48FpfhznLLaCGBCJE6FitR mDGhusiejo88g98RMYfngdmcI+/HRQjWmPmqUZj4FNgVP8mE0UcabBQHJqXXzXqmF4rh 3Rcb6SCSuJImH4r/gj83HHAKRFOMcSKoMHAyiRttKsTbvYDSafuRbbaXr+zgFVGZSyiu VYiKbdu3slopX3Vx3sTEQIae7ZFGHcRR628aBx1uDcGcOBoqXwvwdfmBKOpTLx/OhmTu 9y6fnit1w3z4iNzDk6uMxw4zwJIfGawu24lx9+BbT/S03/2akq1IKuvWye9b4Pk+l9HM 1Epw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=WZowV46RDd4UZGFRJaWN3kYV5vNiK42zQttdiJYmLHk=; fh=oYAd+8Lj9FKlReeF9hgENQXa3P4LhBP5C4njRBbobDA=; b=LIuWbIoHRgRalPjBKCRK+hq1rJxmKv1d2dCa424TBe5wTvKiibLJFADeiMGFoJ7Xhs AY6LQG+Ch8ZB6kxvAf0IdLmrDYRdD2h4ov/0Md/ScdZBKhQiEP2xfIALzVQLzzuVvga1 gN42IbmnX1xr2QGBsm8UnV2wDhoFCIcDk/sQDwDkD3Nyb1fszzliMRyNMzXePNPsjDEB 7t14tdbgCMZboAvoSxLYF1uQdDvBOlqUdTM8EVMqhBiZ98uhNv10MKIwuiDzqbys3zS6 ddlRTQ4vCCebjsqglevWVoRtN2HjQbhZWLYJ2M1xAC4UlXaLhhWdVLpdG4yvCaohDaCU AIrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LgCb11Mf; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id v4-20020a0c9c04000000b005df47f81d70si5746623qve.234.2023.07.15.07.00.06 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 15 Jul 2023 07:00:06 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LgCb11Mf; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qKfiu-0004MR-F9; Sat, 15 Jul 2023 09:54:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qKfiD-00041R-KJ for qemu-devel@nongnu.org; Sat, 15 Jul 2023 09:53:31 -0400 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qKfiB-0001Df-2J for qemu-devel@nongnu.org; Sat, 15 Jul 2023 09:53:29 -0400 Received: by mail-wr1-x429.google.com with SMTP id ffacd0b85a97d-31438512cafso2993039f8f.2 for ; Sat, 15 Jul 2023 06:53:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689429206; x=1692021206; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=WZowV46RDd4UZGFRJaWN3kYV5vNiK42zQttdiJYmLHk=; b=LgCb11Mfe5zs6W4nfob0cjmlFcgsmQQevz9bDNO0Fd4l3XGc/pz8H/Hy/La1QanltB V+3+G8IQQEXxJ5Kr9EYeUnBdt+ImFU2JHemVVEhbvKsKwmG4uFrnJqz/EpIE3SkiQEXm ftngjU9fq8i1XIsranbjpFJvUeX7BoJ3qwOJlfSVsdD2Qw6/1zODiKkYI0TaNSO/rAha HzHKEm64YCywQQtDbG8UkbFJeiyoXwwPL59RHZ8rQikYfEqg7arIGChextjB0sPercCB IVsQmztyY4ggvBtp8Ip3pK6WKsJq5NaZylxE5l6wpjKkxZ349rXAhDZ4F/J9so/kcBcH uyNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689429206; x=1692021206; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WZowV46RDd4UZGFRJaWN3kYV5vNiK42zQttdiJYmLHk=; b=HYOAbDtLanAqKEVXGBw6krVske7a3kmKOxDdtc3XsXppUoWlgX79+XE4EazIudY0MY gpht5IzeuvmQE+hkAIzzys+I4kPYS7M3qoA9BGZyjLY/vMzb/yKOjt/L64v44XVunRX8 lmUA72fwxyUkP9xA3jRxjX+PBpyPh4VNtbBcjEmETUv7XEtYgHnRLRj0SPJKlXJ9gzpe BznmJK37uW/tke4lJ61bp0fQsYtVeXBYHBs/iMIztHNgTP8Fms3o8WMdix1cwbrjEWnf WsxSFgN3iM6gPdQDTCaonPFgA/GXIfJH0TReqRdhQRSPrwrOSuRQOhh8m7YN5uwOl9s2 VdaQ== X-Gm-Message-State: ABy/qLaH3T+RB6fUDN2UU5jwcjShxj5BVes1kr1siSys7u+R/X0p6BTY FJgEImnHnCiKdqNJr6FK+Htbo/88YS7jlzwlY1sPXA== X-Received: by 2002:a5d:6102:0:b0:30f:c1c3:8173 with SMTP id v2-20020a5d6102000000b0030fc1c38173mr7111445wrt.26.1689429205679; Sat, 15 Jul 2023 06:53:25 -0700 (PDT) Received: from stoup.lan ([51.219.12.49]) by smtp.gmail.com with ESMTPSA id k10-20020a5d66ca000000b00313f9085119sm13838014wrw.113.2023.07.15.06.53.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Jul 2023 06:53:25 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 07/47] linux-user: Use abi_uint not unsigned int in syscall_defs.h Date: Sat, 15 Jul 2023 14:52:37 +0100 Message-Id: <20230715135317.7219-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230715135317.7219-1-richard.henderson@linaro.org> References: <20230715135317.7219-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::429; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x429.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Signed-off-by: Richard Henderson --- linux-user/syscall_defs.h | 290 +++++++++++++++++++------------------- 1 file changed, 145 insertions(+), 145 deletions(-) diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index 2846a8cfa5..20986bd1d3 100644 --- a/linux-user/syscall_defs.h +++ b/linux-user/syscall_defs.h @@ -366,7 +366,7 @@ struct target_msghdr { abi_long msg_iovlen; /* Number of blocks */ abi_long msg_control; /* Per protocol magic (eg BSD file descriptor passing) */ abi_long msg_controllen; /* Length of cmsg list */ - unsigned int msg_flags; + abi_uint msg_flags; }; struct target_cmsghdr { @@ -403,7 +403,7 @@ __target_cmsg_nxthdr(struct target_msghdr *__mhdr, struct target_mmsghdr { struct target_msghdr msg_hdr; /* Message header */ - unsigned int msg_len; /* Number of bytes transmitted */ + abi_uint msg_len; /* Number of bytes transmitted */ }; struct target_rusage { @@ -595,8 +595,8 @@ typedef struct target_siginfo { /* POSIX.1b timers */ struct { - unsigned int _timer1; - unsigned int _timer2; + abi_uint _timer1; + abi_uint _timer2; } _timer; /* POSIX.1b signals */ @@ -857,10 +857,10 @@ struct target_rtc_pll_info { #define TARGET_TUNSETOWNER TARGET_IOW('T', 204, int) #define TARGET_TUNSETLINK TARGET_IOW('T', 205, int) #define TARGET_TUNSETGROUP TARGET_IOW('T', 206, int) -#define TARGET_TUNGETFEATURES TARGET_IOR('T', 207, unsigned int) -#define TARGET_TUNSETOFFLOAD TARGET_IOW('T', 208, unsigned int) -#define TARGET_TUNSETTXFILTER TARGET_IOW('T', 209, unsigned int) -#define TARGET_TUNGETIFF TARGET_IOR('T', 210, unsigned int) +#define TARGET_TUNGETFEATURES TARGET_IOR('T', 207, abi_uint) +#define TARGET_TUNSETOFFLOAD TARGET_IOW('T', 208, abi_uint) +#define TARGET_TUNSETTXFILTER TARGET_IOW('T', 209, abi_uint) +#define TARGET_TUNGETIFF TARGET_IOR('T', 210, abi_uint) #define TARGET_TUNGETSNDBUF TARGET_IOR('T', 211, int) #define TARGET_TUNSETSNDBUF TARGET_IOW('T', 212, int) /* @@ -870,7 +870,7 @@ struct target_rtc_pll_info { #define TARGET_TUNGETVNETHDRSZ TARGET_IOR('T', 215, int) #define TARGET_TUNSETVNETHDRSZ TARGET_IOW('T', 216, int) #define TARGET_TUNSETQUEUE TARGET_IOW('T', 217, int) -#define TARGET_TUNSETIFINDEX TARGET_IOW('T', 218, unsigned int) +#define TARGET_TUNSETIFINDEX TARGET_IOW('T', 218, abi_uint) /* TUNGETFILTER is not supported: see TUNATTACHFILTER. */ #define TARGET_TUNSETVNETLE TARGET_IOW('T', 220, int) #define TARGET_TUNGETVNETLE TARGET_IOR('T', 221, int) @@ -1361,8 +1361,8 @@ struct target_stat64 { #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 abi_ulong __st_ino; - unsigned int st_mode; - unsigned int st_nlink; + abi_uint st_mode; + abi_uint st_nlink; abi_ulong st_uid; abi_ulong st_gid; @@ -1392,20 +1392,20 @@ struct target_stat64 { #define TARGET_HAS_STRUCT_STAT64 struct target_eabi_stat64 { unsigned long long st_dev; - unsigned int __pad1; + abi_uint __pad1; abi_ulong __st_ino; - unsigned int st_mode; - unsigned int st_nlink; + abi_uint st_mode; + abi_uint st_nlink; abi_ulong st_uid; abi_ulong st_gid; unsigned long long st_rdev; - unsigned int __pad2[2]; + abi_uint __pad2[2]; long long st_size; abi_ulong st_blksize; - unsigned int __pad3; + abi_uint __pad3; unsigned long long st_blocks; abi_ulong target_st_atime; @@ -1423,13 +1423,13 @@ struct target_eabi_stat64 { #elif defined(TARGET_SPARC64) && !defined(TARGET_ABI32) struct target_stat { - unsigned int st_dev; + abi_uint st_dev; abi_ulong st_ino; - unsigned int st_mode; - unsigned int st_nlink; - unsigned int st_uid; - unsigned int st_gid; - unsigned int st_rdev; + abi_uint st_mode; + abi_uint st_nlink; + abi_uint st_uid; + abi_uint st_gid; + abi_uint st_rdev; abi_long st_size; abi_long target_st_atime; abi_long target_st_mtime; @@ -1447,10 +1447,10 @@ struct target_stat64 { abi_ullong st_ino; abi_ullong st_nlink; - unsigned int st_mode; + abi_uint st_mode; - unsigned int st_uid; - unsigned int st_gid; + abi_uint st_uid; + abi_uint st_gid; unsigned char __pad2[6]; unsigned short st_rdev; @@ -1459,7 +1459,7 @@ struct target_stat64 { abi_llong st_blksize; unsigned char __pad4[4]; - unsigned int st_blocks; + abi_uint st_blocks; abi_ulong target_st_atime; abi_ulong target_st_atime_nsec; @@ -1503,11 +1503,11 @@ struct target_stat64 { abi_ullong st_ino; - unsigned int st_mode; - unsigned int st_nlink; + abi_uint st_mode; + abi_uint st_nlink; - unsigned int st_uid; - unsigned int st_gid; + abi_uint st_uid; + abi_uint st_gid; unsigned char __pad2[6]; unsigned short st_rdev; @@ -1515,22 +1515,22 @@ struct target_stat64 { unsigned char __pad3[8]; abi_llong st_size; - unsigned int st_blksize; + abi_uint st_blksize; unsigned char __pad4[8]; - unsigned int st_blocks; + abi_uint st_blocks; - unsigned int target_st_atime; - unsigned int target_st_atime_nsec; + abi_uint target_st_atime; + abi_uint target_st_atime_nsec; - unsigned int target_st_mtime; - unsigned int target_st_mtime_nsec; + abi_uint target_st_mtime; + abi_uint target_st_mtime_nsec; - unsigned int target_st_ctime; - unsigned int target_st_ctime_nsec; + abi_uint target_st_ctime; + abi_uint target_st_ctime_nsec; - unsigned int __unused1; - unsigned int __unused2; + abi_uint __unused1; + abi_uint __unused2; }; #elif defined(TARGET_PPC) @@ -1541,13 +1541,13 @@ struct target_stat { abi_ulong st_ino; #if defined(TARGET_PPC64) abi_ulong st_nlink; - unsigned int st_mode; + abi_uint st_mode; #else - unsigned int st_mode; + abi_uint st_mode; unsigned short st_nlink; #endif - unsigned int st_uid; - unsigned int st_gid; + abi_uint st_uid; + abi_uint st_gid; abi_ulong st_rdev; abi_ulong st_size; abi_ulong st_blksize; @@ -1570,24 +1570,24 @@ struct target_stat { struct QEMU_PACKED target_stat64 { unsigned long long st_dev; unsigned long long st_ino; - unsigned int st_mode; - unsigned int st_nlink; - unsigned int st_uid; - unsigned int st_gid; + abi_uint st_mode; + abi_uint st_nlink; + abi_uint st_uid; + abi_uint st_gid; unsigned long long st_rdev; unsigned long long __pad0; long long st_size; int st_blksize; - unsigned int __pad1; + abi_uint __pad1; long long st_blocks; /* Number 512-byte blocks allocated. */ int target_st_atime; - unsigned int target_st_atime_nsec; + abi_uint target_st_atime_nsec; int target_st_mtime; - unsigned int target_st_mtime_nsec; + abi_uint target_st_mtime_nsec; int target_st_ctime; - unsigned int target_st_ctime_nsec; - unsigned int __unused4; - unsigned int __unused5; + abi_uint target_st_ctime_nsec; + abi_uint __unused4; + abi_uint __unused5; }; #endif @@ -1597,10 +1597,10 @@ struct QEMU_PACKED target_stat64 { struct target_stat { abi_ulong st_dev; abi_ulong st_ino; - unsigned int st_mode; + abi_uint st_mode; unsigned short st_nlink; - unsigned int st_uid; - unsigned int st_gid; + abi_uint st_uid; + abi_uint st_gid; abi_ulong st_rdev; abi_ulong st_size; abi_ulong st_blksize; @@ -1636,11 +1636,11 @@ struct QEMU_PACKED target_stat64 { abi_llong st_blocks; int target_st_atime; - unsigned int target_st_atime_nsec; + abi_uint target_st_atime_nsec; int target_st_mtime; - unsigned int target_st_mtime_nsec; + abi_uint target_st_mtime_nsec; int target_st_ctime; - unsigned int target_st_ctime_nsec; + abi_uint target_st_ctime_nsec; abi_ullong st_ino; }; @@ -1680,8 +1680,8 @@ struct target_stat64 { #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 abi_ulong __st_ino; - unsigned int st_mode; - unsigned int st_nlink; + abi_uint st_mode; + abi_uint st_nlink; abi_ulong st_uid; abi_ulong st_gid; @@ -1712,19 +1712,19 @@ struct target_stat64 { #define TARGET_STAT_HAVE_NSEC /* The memory layout is the same as of struct stat64 of the 32-bit kernel. */ struct target_stat { - unsigned int st_dev; - unsigned int st_pad0[3]; /* Reserved for st_dev expansion */ + abi_uint st_dev; + abi_uint st_pad0[3]; /* Reserved for st_dev expansion */ abi_ulong st_ino; - unsigned int st_mode; - unsigned int st_nlink; + abi_uint st_mode; + abi_uint st_nlink; int st_uid; int st_gid; - unsigned int st_rdev; - unsigned int st_pad1[3]; /* Reserved for st_rdev expansion */ + abi_uint st_rdev; + abi_uint st_pad1[3]; /* Reserved for st_rdev expansion */ abi_ulong st_size; @@ -1732,17 +1732,17 @@ struct target_stat { * Actually this should be timestruc_t st_atime, st_mtime and st_ctime * but we don't have it under Linux. */ - unsigned int target_st_atime; - unsigned int target_st_atime_nsec; + abi_uint target_st_atime; + abi_uint target_st_atime_nsec; - unsigned int target_st_mtime; - unsigned int target_st_mtime_nsec; + abi_uint target_st_mtime; + abi_uint target_st_mtime_nsec; - unsigned int target_st_ctime; - unsigned int target_st_ctime_nsec; + abi_uint target_st_ctime; + abi_uint target_st_ctime_nsec; - unsigned int st_blksize; - unsigned int st_pad2; + abi_uint st_blksize; + abi_uint st_pad2; abi_ulong st_blocks; }; @@ -1754,8 +1754,8 @@ struct target_stat { abi_ulong st_dev; abi_ulong st_pad0[3]; /* Reserved for st_dev expansion */ abi_ullong st_ino; - unsigned int st_mode; - unsigned int st_nlink; + abi_uint st_mode; + abi_uint st_nlink; int st_uid; int st_gid; abi_ulong st_rdev; @@ -1779,8 +1779,8 @@ struct target_stat { unsigned st_dev; abi_long st_pad1[3]; /* Reserved for network id */ abi_ulong st_ino; - unsigned int st_mode; - unsigned int st_nlink; + abi_uint st_mode; + abi_uint st_nlink; int st_uid; int st_gid; unsigned st_rdev; @@ -1815,8 +1815,8 @@ struct target_stat64 { abi_ullong st_ino; - unsigned int st_mode; - unsigned int st_nlink; + abi_uint st_mode; + abi_uint st_nlink; int st_uid; int st_gid; @@ -1848,21 +1848,21 @@ struct target_stat64 { #elif defined(TARGET_ALPHA) struct target_stat { - unsigned int st_dev; - unsigned int st_ino; - unsigned int st_mode; - unsigned int st_nlink; - unsigned int st_uid; - unsigned int st_gid; - unsigned int st_rdev; + abi_uint st_dev; + abi_uint st_ino; + abi_uint st_mode; + abi_uint st_nlink; + abi_uint st_uid; + abi_uint st_gid; + abi_uint st_rdev; abi_long st_size; abi_ulong target_st_atime; abi_ulong target_st_mtime; abi_ulong target_st_ctime; - unsigned int st_blksize; - unsigned int st_blocks; - unsigned int st_flags; - unsigned int st_gen; + abi_uint st_blksize; + abi_uint st_blocks; + abi_uint st_flags; + abi_uint st_gen; }; #define TARGET_HAS_STRUCT_STAT64 @@ -1873,12 +1873,12 @@ struct target_stat64 { abi_long st_size; abi_ulong st_blocks; - unsigned int st_mode; - unsigned int st_uid; - unsigned int st_gid; - unsigned int st_blksize; - unsigned int st_nlink; - unsigned int __pad0; + abi_uint st_mode; + abi_uint st_uid; + abi_uint st_gid; + abi_uint st_blksize; + abi_uint st_nlink; + abi_uint __pad0; abi_ulong target_st_atime; abi_ulong target_st_atime_nsec; @@ -1924,8 +1924,8 @@ struct QEMU_PACKED target_stat64 { #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 abi_ulong __st_ino; - unsigned int st_mode; - unsigned int st_nlink; + abi_uint st_mode; + abi_uint st_nlink; abi_ulong st_uid; abi_ulong st_gid; @@ -1957,10 +1957,10 @@ struct target_stat { abi_ulong st_ino; abi_ulong st_nlink; - unsigned int st_mode; - unsigned int st_uid; - unsigned int st_gid; - unsigned int __pad0; + abi_uint st_mode; + abi_uint st_uid; + abi_uint st_gid; + abi_uint __pad0; abi_ulong st_rdev; abi_long st_size; abi_long st_blksize; @@ -1980,10 +1980,10 @@ struct target_stat { abi_ulong st_dev; abi_ulong st_ino; abi_ulong st_nlink; - unsigned int st_mode; - unsigned int st_uid; - unsigned int st_gid; - unsigned int __pad1; + abi_uint st_mode; + abi_uint st_uid; + abi_uint st_gid; + abi_uint __pad1; abi_ulong st_rdev; abi_ulong st_size; abi_ulong target_st_atime; @@ -2001,10 +2001,10 @@ struct target_stat { struct target_stat { abi_ulong st_dev; abi_ulong st_ino; - unsigned int st_mode; - unsigned int st_nlink; - unsigned int st_uid; - unsigned int st_gid; + abi_uint st_mode; + abi_uint st_nlink; + abi_uint st_uid; + abi_uint st_gid; abi_ulong st_rdev; abi_ulong _pad1; abi_long st_size; @@ -2017,17 +2017,17 @@ struct target_stat { abi_ulong target_st_mtime_nsec; abi_long target_st_ctime; abi_ulong target_st_ctime_nsec; - unsigned int __unused[2]; + abi_uint __unused[2]; }; #elif defined(TARGET_XTENSA) #define TARGET_STAT_HAVE_NSEC struct target_stat { abi_ulong st_dev; abi_ulong st_ino; - unsigned int st_mode; - unsigned int st_nlink; - unsigned int st_uid; - unsigned int st_gid; + abi_uint st_mode; + abi_uint st_nlink; + abi_uint st_uid; + abi_uint st_gid; abi_ulong st_rdev; abi_long st_size; abi_ulong st_blksize; @@ -2046,10 +2046,10 @@ struct target_stat { struct target_stat64 { abi_ullong st_dev; /* Device */ abi_ullong st_ino; /* File serial number */ - unsigned int st_mode; /* File mode. */ - unsigned int st_nlink; /* Link count. */ - unsigned int st_uid; /* User ID of the file's owner. */ - unsigned int st_gid; /* Group ID of the file's group. */ + abi_uint st_mode; /* File mode. */ + abi_uint st_nlink; /* Link count. */ + abi_uint st_uid; /* User ID of the file's owner. */ + abi_uint st_gid; /* Group ID of the file's group. */ abi_ullong st_rdev; /* Device number, if device. */ abi_llong st_size; /* Size of file, in bytes. */ abi_ulong st_blksize; /* Optimal block size for I/O. */ @@ -2074,10 +2074,10 @@ struct target_stat64 { struct target_stat { abi_ulong st_dev; abi_ulong st_ino; - unsigned int st_mode; - unsigned int st_nlink; - unsigned int st_uid; - unsigned int st_gid; + abi_uint st_mode; + abi_uint st_nlink; + abi_uint st_uid; + abi_uint st_gid; abi_ulong st_rdev; abi_ulong __pad1; abi_long st_size; @@ -2090,8 +2090,8 @@ struct target_stat { abi_ulong target_st_mtime_nsec; abi_long target_st_ctime; abi_ulong target_st_ctime_nsec; - unsigned int __unused4; - unsigned int __unused5; + abi_uint __unused4; + abi_uint __unused5; }; #if !defined(TARGET_RISCV64) @@ -2099,10 +2099,10 @@ struct target_stat { struct target_stat64 { abi_ullong st_dev; abi_ullong st_ino; - unsigned int st_mode; - unsigned int st_nlink; - unsigned int st_uid; - unsigned int st_gid; + abi_uint st_mode; + abi_uint st_nlink; + abi_uint st_uid; + abi_uint st_gid; abi_ullong st_rdev; abi_ullong __pad1; abi_llong st_size; @@ -2110,13 +2110,13 @@ struct target_stat64 { int __pad2; abi_llong st_blocks; int target_st_atime; - unsigned int target_st_atime_nsec; + abi_uint target_st_atime_nsec; int target_st_mtime; - unsigned int target_st_mtime_nsec; + abi_uint target_st_mtime_nsec; int target_st_ctime; - unsigned int target_st_ctime_nsec; - unsigned int __unused4; - unsigned int __unused5; + abi_uint target_st_ctime_nsec; + abi_uint __unused4; + abi_uint __unused5; }; #endif @@ -2498,7 +2498,7 @@ struct target_snd_timer_id { struct target_snd_timer_ginfo { struct target_snd_timer_id tid; - unsigned int flags; + abi_uint flags; int card; unsigned char id[64]; unsigned char name[80]; @@ -2506,7 +2506,7 @@ struct target_snd_timer_ginfo { abi_ulong resolution; abi_ulong resolution_min; abi_ulong resolution_max; - unsigned int clients; + abi_uint clients; unsigned char reserved[32]; }; @@ -2531,7 +2531,7 @@ struct target_snd_timer_select { }; struct target_snd_timer_info { - unsigned int flags; + abi_uint flags; int card; unsigned char id[64]; unsigned char name[80]; @@ -2542,10 +2542,10 @@ struct target_snd_timer_info { struct target_snd_timer_status { struct target_timespec tstamp; - unsigned int resolution; - unsigned int lost; - unsigned int overrun; - unsigned int queue; + abi_uint resolution; + abi_uint lost; + abi_uint overrun; + abi_uint queue; unsigned char reserved[64]; }; @@ -2623,7 +2623,7 @@ struct target_sysinfo { unsigned short pad; /* explicit padding for m68k */ abi_ulong totalhigh; /* Total high memory size */ abi_ulong freehigh; /* Available high memory size */ - unsigned int mem_unit; /* Memory unit size in bytes */ + abi_uint mem_unit; /* Memory unit size in bytes */ char _f[20-2*sizeof(abi_long)-sizeof(int)]; /* Padding: libc5 uses this.. */ }; From patchwork Sat Jul 15 13:52:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 703229 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e4d:0:b0:314:25da:8dc4 with SMTP id r13csp157469wrt; Sat, 15 Jul 2023 06:56:23 -0700 (PDT) X-Google-Smtp-Source: APBJJlHaCCG6GWrukYZvSj9BbhzZ4Lqa7Je8EpJ7Xo5m1Rf+4ffa4zmHKJzuXLCq2STNxKOZR8Z6 X-Received: by 2002:ac8:5f4a:0:b0:403:2761:9e6a with SMTP id y10-20020ac85f4a000000b0040327619e6amr8940788qta.1.1689429383096; Sat, 15 Jul 2023 06:56:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689429383; cv=none; d=google.com; s=arc-20160816; b=hxq7hsIwDnUlv3peOZttb1vM6KmZe9YxlXXHyKJfT9RKzThBynYF2NJrcvzVdHTNy0 KEFvSlhlA1CJ5M4y0dUWt+MN1prbZrE7YFQ6eS6hbTRcg2iGv8wwPWqh8zi52YAbOjFG H3/V6Jp1KoTx+HG9lrAdvZtjWYLugamG/BMrwDcm773fY5EHtiVCQOme5t2fFOHA7xnp DutuqichDiFg3Ku6zZAdD3IyZz0gco0jIjPuBeVYOxzeJji67R4yfXvIpeIw3Qiu8bVs BoStUf2k/xlmbm1/ec3A9xlm32sB9PiX1sqvOre2y6oC3lRgWTAPN57PqBpjQo6CK9WZ rvfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Bny+QrSk9kOHXY9n7JH/neknIRvMmyCuxL4ghWqdlbg=; fh=i1mkeM7bD/ppus3C3v+92ltBBCUUU0zBXrpbYjAjHqE=; b=ieO7QeATWo6RZI84WKCc8tC1bAYvlUVI17+Nvu74qx/t2ss4vQ7d0bzBDWXnNUTiLw w+QVh0A4Glic95SbM/3fabYH6kxsUrHFn7YFMr3fG+wMQLUdD0A9HZZAkdj+cYSYYGEE Q/R1zXKUh4a9WCAuCVn8QBWjjzIG+2Hi7dduj/SYaeeqROuM5C7dkAZrF+u3uM9V6Grw jk8aM/47ceBO/JAN762Y2Vd+6kPGNIGXTyhueU69cMF3dPY8uPlK6NNCaPvcsxSlxV9A gmMqdgn6mu6FrwFD1K0Ona7FYzrGykIQdEnj27s0YI8yljN1K8ZNOgj8/V53a4LYnfGU IvWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kvoQjYfs; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id s14-20020a05622a018e00b004036e610f2csi5988121qtw.44.2023.07.15.06.56.22 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 15 Jul 2023 06:56:23 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kvoQjYfs; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qKfjZ-0005z9-W9; Sat, 15 Jul 2023 09:54:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qKfiE-00041T-Di for qemu-devel@nongnu.org; Sat, 15 Jul 2023 09:53:31 -0400 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qKfiB-0001Dp-OY for qemu-devel@nongnu.org; Sat, 15 Jul 2023 09:53:30 -0400 Received: by mail-wr1-x431.google.com with SMTP id ffacd0b85a97d-3128fcd58f3so3057711f8f.1 for ; Sat, 15 Jul 2023 06:53:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689429206; x=1692021206; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Bny+QrSk9kOHXY9n7JH/neknIRvMmyCuxL4ghWqdlbg=; b=kvoQjYfsluMHe2RntKm3FJztPFWJbkOJq1VTmqq50O3uXwxHvbJSgj2s7flRMA/iEh Tikwy2maOG8k27PVFfxD+itCPHzou2arVQ7mun64qZtnkiibOt4nAh4Sjswgb5XnUv9P cIyEaSsGD85E6+LU/UvglSJ+F4GM37X+eBVlbkJCllHhtn/I962eBN8ZkwoWQYdserPL hdxEj53b5ekpzTXLHDUj20InJfwGKqSPApW3ykyabBbAizE/mirJp0pwMI8iBodcrBiX Q9/2lxf6R8DURKEMu4NcLwE4BJxRBMZTy/o8zybeT7gJbUH58qwqRdxQhfQc7r70LC0F RlwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689429206; x=1692021206; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Bny+QrSk9kOHXY9n7JH/neknIRvMmyCuxL4ghWqdlbg=; b=agYVQc+BSWcF4gGDkVrAi0o6M64iz3Vkbob0dw0SKSL6416p2ShT8dvprszMd6uvkV 9r+Egb1a3vqjCIhULaWN8RdM0cBAW5SD7u3S81qM5XK345OMZf0uFwHwH59wuaUfZc5r wTlEGaDOXJJc4Pdk7CYrdA48bFSHoByn99dW7iTH9aYPV3Z9TE0H9ZDOEYUDwKxXcnnR AR5TbawBUyLngd78fN5NHFFvqgHi1VDeCkrXUmrCb5XjS1VMtWtyaiOas4vMNbM+CpjE WxfH6W0c7NNBT0Iyw+3aCEpepmXwq33RuQOJBZAvn66bjBwPE8ygP4H9JmEJhOFmjGuE 3hCg== X-Gm-Message-State: ABy/qLYMalLJPa444rP6Vh4jb2NXtdfV65uj3+FzJG9Yb2ScILnT4p2l ejvCZXJQKj3j0SV0fW8Y7N4rLsvAsnu3MPc2SRH2jQ== X-Received: by 2002:adf:ff84:0:b0:314:dc0:2fca with SMTP id j4-20020adfff84000000b003140dc02fcamr7173400wrr.29.1689429206385; Sat, 15 Jul 2023 06:53:26 -0700 (PDT) Received: from stoup.lan ([51.219.12.49]) by smtp.gmail.com with ESMTPSA id k10-20020a5d66ca000000b00313f9085119sm13838014wrw.113.2023.07.15.06.53.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Jul 2023 06:53:26 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL 08/47] linux-user: Use abi_ullong not unsigned long long in syscall_defs.h Date: Sat, 15 Jul 2023 14:52:38 +0100 Message-Id: <20230715135317.7219-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230715135317.7219-1-richard.henderson@linaro.org> References: <20230715135317.7219-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::431; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x431.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- linux-user/syscall_defs.h | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index 20986bd1d3..45ebacd4b4 100644 --- a/linux-user/syscall_defs.h +++ b/linux-user/syscall_defs.h @@ -1385,13 +1385,13 @@ struct target_stat64 { abi_ulong target_st_ctime; abi_ulong target_st_ctime_nsec; - unsigned long long st_ino; + abi_ullong st_ino; } QEMU_PACKED; #ifdef TARGET_ARM #define TARGET_HAS_STRUCT_STAT64 struct target_eabi_stat64 { - unsigned long long st_dev; + abi_ullong st_dev; abi_uint __pad1; abi_ulong __st_ino; abi_uint st_mode; @@ -1400,13 +1400,13 @@ struct target_eabi_stat64 { abi_ulong st_uid; abi_ulong st_gid; - unsigned long long st_rdev; + abi_ullong st_rdev; abi_uint __pad2[2]; long long st_size; abi_ulong st_blksize; abi_uint __pad3; - unsigned long long st_blocks; + abi_ullong st_blocks; abi_ulong target_st_atime; abi_ulong target_st_atime_nsec; @@ -1417,7 +1417,7 @@ struct target_eabi_stat64 { abi_ulong target_st_ctime; abi_ulong target_st_ctime_nsec; - unsigned long long st_ino; + abi_ullong st_ino; } QEMU_PACKED; #endif @@ -1568,14 +1568,14 @@ struct target_stat { #if !defined(TARGET_PPC64) #define TARGET_HAS_STRUCT_STAT64 struct QEMU_PACKED target_stat64 { - unsigned long long st_dev; - unsigned long long st_ino; + abi_ullong st_dev; + abi_ullong st_ino; abi_uint st_mode; abi_uint st_nlink; abi_uint st_uid; abi_uint st_gid; - unsigned long long st_rdev; - unsigned long long __pad0; + abi_ullong st_rdev; + abi_ullong __pad0; long long st_size; int st_blksize; abi_uint __pad1; @@ -1674,7 +1674,7 @@ struct target_stat { */ #define TARGET_HAS_STRUCT_STAT64 struct target_stat64 { - unsigned long long st_dev; + abi_ullong st_dev; unsigned char __pad1[2]; #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 @@ -1686,7 +1686,7 @@ struct target_stat64 { abi_ulong st_uid; abi_ulong st_gid; - unsigned long long st_rdev; + abi_ullong st_rdev; unsigned char __pad3[2]; long long st_size; @@ -1704,7 +1704,7 @@ struct target_stat64 { abi_ulong target_st_ctime; abi_ulong target_st_ctime_nsec; - unsigned long long st_ino; + abi_ullong st_ino; } QEMU_PACKED; #elif defined(TARGET_ABI_MIPSN64) @@ -1918,7 +1918,7 @@ struct target_stat { */ #define TARGET_HAS_STRUCT_STAT64 struct QEMU_PACKED target_stat64 { - unsigned long long st_dev; + abi_ullong st_dev; unsigned char __pad0[4]; #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 @@ -1930,13 +1930,13 @@ struct QEMU_PACKED target_stat64 { abi_ulong st_uid; abi_ulong st_gid; - unsigned long long st_rdev; + abi_ullong st_rdev; unsigned char __pad3[4]; long long st_size; abi_ulong st_blksize; - unsigned long long st_blocks; /* Number 512-byte blocks allocated. */ + abi_ullong st_blocks; /* Number 512-byte blocks allocated. */ abi_ulong target_st_atime; abi_ulong target_st_atime_nsec; @@ -1947,7 +1947,7 @@ struct QEMU_PACKED target_stat64 { abi_ulong target_st_ctime; abi_ulong target_st_ctime_nsec; - unsigned long long st_ino; + abi_ullong st_ino; }; #elif defined(TARGET_I386) && !defined(TARGET_ABI32) From patchwork Sat Jul 15 13:52:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 703240 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e4d:0:b0:314:25da:8dc4 with SMTP id r13csp158155wrt; Sat, 15 Jul 2023 06:58:14 -0700 (PDT) X-Google-Smtp-Source: APBJJlGUIWEkmkQUfg0RSfBMFRVSQsOiZoaXYV/qk03AGLR9ZCprEIzlUyp4PRj1M9FW4AAXkXWZ X-Received: by 2002:a05:620a:4256:b0:765:a7d9:7085 with SMTP id w22-20020a05620a425600b00765a7d97085mr8225757qko.51.1689429493965; Sat, 15 Jul 2023 06:58:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689429493; cv=none; d=google.com; s=arc-20160816; b=p6pgu2vUcClxb5kKnrfR7vGjX4txpc0sFeobbAidfpRlXNUTkpv+iaZ8kfBfMO7ntY EK06yJGqUQ/hw8HDQmfzJJRTW7Z1lJjcSnuuvKDhnWrn3pcuUb9yQM9YI1PzgwBmviJ4 fCTIxrRZ9kqwZjtFA01wAS/Qn5lHq0v16pcC39oBkiCBBRYjwFkA+bxUr7KbwP0GJV3N VkDFKJespHLNkTyWOwP93Ob03QBUfQZaFS8BhMaKYAnXGTDlJm6mJ0n/mFC/TjZYIX4w QDAtFmLQXi7MRg4lRvoGrBNgfH8XOHeqSh2pS8Q3S9f51h3YzdtWBlidGejlVWZ4Yzsh OzRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=gtm9LlPfPfRyjkKrgBvN2xo7wsnPpDSqZNVUjufgcPA=; fh=i1mkeM7bD/ppus3C3v+92ltBBCUUU0zBXrpbYjAjHqE=; b=GMw7QhuadsIVV4JZEorZ7saWcIw7KDOjusyavjQgy5nd7D3tpBszamtK1S2GCBJZ5O 5UQlckBIrw7j0tLdy6EGwGOJMco2jNV0R5jmnB94OYufzh+nwZLmfybxVDL49XKnMRKh 6CkhQXVPmE5v0C4EzJjs2w/MMPKNozBnsGBvodQh1Sjbjmj+K+Hl0C0v7/FWa2wwTVfz avSzO4F8UUufCyfAYSIpE6bbpNQHV/YLyREfbyIHH08jlBXMNbVGiMB7T5Ax+n1F8DVG ZomvvulqY86QBxQObQoMdl7cuDL/Oc7EFHQypXKK2O/kpH1G/5npsWrRwBkN3J/Hw8Dy ipLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DFt53Ulx; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id x4-20020ae9e644000000b0076719299daasi5504734qkl.574.2023.07.15.06.58.13 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 15 Jul 2023 06:58:13 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DFt53Ulx; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qKfil-000493-Da; Sat, 15 Jul 2023 09:54:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qKfiE-00041U-NP for qemu-devel@nongnu.org; Sat, 15 Jul 2023 09:53:31 -0400 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qKfiD-0001EH-2k for qemu-devel@nongnu.org; Sat, 15 Jul 2023 09:53:30 -0400 Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-3fbc63c2e84so26406615e9.3 for ; Sat, 15 Jul 2023 06:53:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689429207; x=1692021207; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=gtm9LlPfPfRyjkKrgBvN2xo7wsnPpDSqZNVUjufgcPA=; b=DFt53Ulxvd6K4euDdopprRMIFdeqqC5PGkDk0o+Do6USXwTk+mlpzvgqV+erSITt7J cZ9PsRtNzVJCksQJE6Ph0TnM20Dl/w6nznHsO9QalVym0jaKKjB3P7KCmmnmxKzVvVhf qJ+lLBgp+cjJfHn5R7f0/aNI8WrGMJuvMPmLfJ5XgnpQe/P0UeAiGW6AjPtTdDYb+Dgv zTzxFbS86bdj8DHxLuJkvMJHNT3JgAPzmNVNy3CAWPv40EgUbAC3n2RYWLuWrtkj5Stn I4HfyK+y5acbS7G9pkF5B/GNGjYSl/3gdi9PbZ3wlpDAgPWusKVEJL8eFgIXHHUf9uqR 8D8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689429207; x=1692021207; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gtm9LlPfPfRyjkKrgBvN2xo7wsnPpDSqZNVUjufgcPA=; b=S1C1C8cGKKK/p/Cr3Ja6nkyBvRSAVr7t0y2GKI1/+IsegUVPgK2vqXrpSTp+nHi2I+ C9rfGswL59xsgQ6X4MuW8X3PNLEm5j5oXq2L8acA3KT8vukJHxWgyRFzbgRefzxAv2w4 UgWlKe/Hd3U5x8kA2suyF9TpreEooFj4wC1u1oEnlLg/XwpQLEy+0+KrIjpzX24v/fW1 ickcWODdT+C5bVi94BCS+5u33/mBSzZ8bHXVi4mIYRB8DZI9hBhIZx8Q65a6U5sA+jzB LEtMVEYNQCcp23bnFPWtDth/PxUgJri4f1Dsf6rFwAanzCbKLtrdqPnFg0TCQyFjZwcY TPBQ== X-Gm-Message-State: ABy/qLYI9H9/AA1bTlSnT8hO/FW4cc8Qs2VBIPdx/l/VnSNpG3ynEK6X 0Hv7LsTEFpIoJWmA5NJ1tGU9ishVLB8DZTMGQZdKjw== X-Received: by 2002:a05:600c:22c9:b0:3fa:96ad:5d2e with SMTP id 9-20020a05600c22c900b003fa96ad5d2emr6665845wmg.19.1689429207272; Sat, 15 Jul 2023 06:53:27 -0700 (PDT) Received: from stoup.lan ([51.219.12.49]) by smtp.gmail.com with ESMTPSA id k10-20020a5d66ca000000b00313f9085119sm13838014wrw.113.2023.07.15.06.53.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Jul 2023 06:53:26 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL 09/47] linux-user: Use abi_llong not long long in syscall_defs.h Date: Sat, 15 Jul 2023 14:52:39 +0100 Message-Id: <20230715135317.7219-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230715135317.7219-1-richard.henderson@linaro.org> References: <20230715135317.7219-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::331; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x331.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- linux-user/syscall_defs.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index 45ebacd4b4..e4fcbd16d2 100644 --- a/linux-user/syscall_defs.h +++ b/linux-user/syscall_defs.h @@ -1370,7 +1370,7 @@ struct target_stat64 { unsigned short st_rdev; unsigned char __pad3[10]; - long long st_size; + abi_llong st_size; abi_ulong st_blksize; abi_ulong st_blocks; /* Number 512-byte blocks allocated. */ @@ -1403,7 +1403,7 @@ struct target_eabi_stat64 { abi_ullong st_rdev; abi_uint __pad2[2]; - long long st_size; + abi_llong st_size; abi_ulong st_blksize; abi_uint __pad3; abi_ullong st_blocks; @@ -1576,10 +1576,10 @@ struct QEMU_PACKED target_stat64 { abi_uint st_gid; abi_ullong st_rdev; abi_ullong __pad0; - long long st_size; + abi_llong st_size; int st_blksize; abi_uint __pad1; - long long st_blocks; /* Number 512-byte blocks allocated. */ + abi_llong st_blocks; /* Number 512-byte blocks allocated. */ int target_st_atime; abi_uint target_st_atime_nsec; int target_st_mtime; @@ -1689,7 +1689,7 @@ struct target_stat64 { abi_ullong st_rdev; unsigned char __pad3[2]; - long long st_size; + abi_llong st_size; abi_ulong st_blksize; abi_ulong __pad4; /* future possible st_blocks high bits */ @@ -1933,7 +1933,7 @@ struct QEMU_PACKED target_stat64 { abi_ullong st_rdev; unsigned char __pad3[4]; - long long st_size; + abi_llong st_size; abi_ulong st_blksize; abi_ullong st_blocks; /* Number 512-byte blocks allocated. */ From patchwork Sat Jul 15 13:52:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 703216 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e4d:0:b0:314:25da:8dc4 with SMTP id r13csp157134wrt; Sat, 15 Jul 2023 06:55:29 -0700 (PDT) X-Google-Smtp-Source: APBJJlGfkI6ZE5JO6Rb5C03VhCRZM4WJZSWmsLrX2W0Ri1J2QenYXPrBNjXLJyrsR/e7YMQjaslc X-Received: by 2002:a05:620a:1a9c:b0:766:fa7b:7694 with SMTP id bl28-20020a05620a1a9c00b00766fa7b7694mr9972845qkb.70.1689429329519; Sat, 15 Jul 2023 06:55:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689429329; cv=none; d=google.com; s=arc-20160816; b=a27qs5ypFZVn5UgiZTx+jgJvPHq78V040n9YyHVF+zz+nPIZuBFyxvedSeYbiPQuAR JV5StEn6yr7/mlW1optyNTKpZJ1MzFwBVvdEX0UmXWZGJdBhAxaEkz6JrGQiiUvjJ7X7 kTv3nAkDWvE/tZPOpoHzezaPvO+kBpTclNfvlzr/OV42UJDM3ObjyW5Vs42dXqq4LYEi 7zHB/cAtFfxA+BMtXGpOS7gNzTuF9jI/ucVjIeN43f6xSn6AeczB/sifwnJwSm8J7JUw HTKmM/doFIqxiMDhWEP1+3RY6hEEpuu4Nl55zVr7HK7gGWistyYZj6ndlCKDpXKGL0ew FqPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=vXgUJPpmGDw6aWrzATIglyuAQTPw9nlDBqSS3HfZd1c=; fh=i1mkeM7bD/ppus3C3v+92ltBBCUUU0zBXrpbYjAjHqE=; b=fKoqR3mWJRQfaQtwyZOOIFDAyy9cBHXduS/ESxvaEeg61ZfBqOwIcN6JWvyRn4D1+0 9ztUcl8b+3wUw7Ep3ZfL3Ox00gXQCqChZKUWtjw6i6GrxvRFSsGd6r/KHddGbqgM/PQY jBREzUxzeUhHtbOZgtlVzEINN3Jn5v33PXFq9Jf08ZeErWQM0pnW9ydw8+jbHJBCHgBj iaFuTyFoeuuK4CsNA3cbBM6wziqKqH5TyqigYq84FOBMbcvD1ePiGVo25ItfH1FNpmXv RnuayC8TjN870p+8IGVt9Lc/mONmzRtgVIyjmLAV85yWMmnAJNM2hcQbk8PLNHG/vegX sglw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PJlloNyK; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id w11-20020a05620a424b00b00767c99883bbsi5906477qko.110.2023.07.15.06.55.29 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 15 Jul 2023 06:55:29 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PJlloNyK; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qKfiw-0004TJ-AD; Sat, 15 Jul 2023 09:54:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qKfiG-00042X-G3 for qemu-devel@nongnu.org; Sat, 15 Jul 2023 09:53:34 -0400 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qKfiD-0001Ek-EI for qemu-devel@nongnu.org; Sat, 15 Jul 2023 09:53:32 -0400 Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-3fbea14700bso25694235e9.3 for ; Sat, 15 Jul 2023 06:53:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689429208; x=1692021208; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=vXgUJPpmGDw6aWrzATIglyuAQTPw9nlDBqSS3HfZd1c=; b=PJlloNyKfmlgBgvpmjLa6bcePrzD4MQqFkV5Miwqwm1glrfnWDaLdQLLsJGvC2gFvs jjl7ViI6UoXyYkkrFBUl0s/miT2J07Lp0lcGr8ZUBjnSM20wPrpr9XbizMQo9ZUp1BAy ckU4h/LtP1gRRf1vtQ6HwYeuffK1AhhtJfpZww4HtSSxcdA3MnQpsRW1WW5vSmVGJjAM calUcyEtZR8r5W70nIMqwP7Ld/n10Aun5OQP1GSInir39pfkLM9bgeS/SHGCIZTlkOXL 9a3W6hYICWsxseM+/v2YFOzRSgtm1k6Mw0fVT4DBq/19dQ2lnIvDg5EXk0aXG1dpVw2X CS1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689429208; x=1692021208; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vXgUJPpmGDw6aWrzATIglyuAQTPw9nlDBqSS3HfZd1c=; b=be4QRZm9GaGoLnHfFedrQMUy2bR3C4sM2HENBLUxYVnz3OXUsVbbWzQbcXrERtldx2 HALd6FTTOat0OQCXyjkhFv9i+0tFtZxSFLqw6e8Kb+IET9ASHLVfIdbJfDu9om6CsZq9 toFOKo7OVuykGMP7Bbc8Gxdbv8MtJhjJZ9NaLVl40MjBvN7NOyKyUsm2UpktJlYnkhyt hrGzXsoc4hGt6U8dIHlp4eEtltuUQWZNkTu4PAsF0CAj7xw7lJQe/FNg5b9tNu/MAgPt htER+L/ykfUTGImYrK+NzuWhikUGvc+/gJBanlI9GkxoUtIyUfrGb9f6plFoIrMwyuef NcTw== X-Gm-Message-State: ABy/qLZYDzJ9DqhtmEXtGYpU3POP75xj07crcPQ2Rv9i3ZYrl2MkIFPW z18mlOsHs4O3TqrjDWK1sXpgOAImVuHNVP+yhGsx9A== X-Received: by 2002:a05:600c:204d:b0:3fc:60:7dbf with SMTP id p13-20020a05600c204d00b003fc00607dbfmr5934404wmg.41.1689429208019; Sat, 15 Jul 2023 06:53:28 -0700 (PDT) Received: from stoup.lan ([51.219.12.49]) by smtp.gmail.com with ESMTPSA id k10-20020a5d66ca000000b00313f9085119sm13838014wrw.113.2023.07.15.06.53.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Jul 2023 06:53:27 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL 10/47] linux-user: Use abi_int not int in syscall_defs.h Date: Sat, 15 Jul 2023 14:52:40 +0100 Message-Id: <20230715135317.7219-11-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230715135317.7219-1-richard.henderson@linaro.org> References: <20230715135317.7219-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::331; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x331.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- linux-user/syscall_defs.h | 216 +++++++++++++++++++------------------- 1 file changed, 108 insertions(+), 108 deletions(-) diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index e4fcbd16d2..442a8aefe3 100644 --- a/linux-user/syscall_defs.h +++ b/linux-user/syscall_defs.h @@ -361,7 +361,7 @@ struct target_iovec { struct target_msghdr { abi_long msg_name; /* Socket name */ - int msg_namelen; /* Length of name */ + abi_int msg_namelen; /* Length of name */ abi_long msg_iov; /* Data blocks */ abi_long msg_iovlen; /* Number of blocks */ abi_long msg_control; /* Per protocol magic (eg BSD file descriptor passing) */ @@ -371,8 +371,8 @@ struct target_msghdr { struct target_cmsghdr { abi_long cmsg_len; - int cmsg_level; - int cmsg_type; + abi_int cmsg_level; + abi_int cmsg_type; }; #define TARGET_CMSG_DATA(cmsg) ((unsigned char *) ((struct target_cmsghdr *) (cmsg) + 1)) @@ -426,7 +426,7 @@ struct target_rusage { }; typedef struct { - int val[2]; + abi_int val[2]; } kernel_fsid_t; struct target_dirent { @@ -544,7 +544,7 @@ struct target_sigaction { #endif typedef union target_sigval { - int sival_int; + abi_int sival_int; abi_ulong sival_ptr; } target_sigval_t; @@ -575,17 +575,17 @@ typedef union target_sigval { typedef struct target_siginfo { #ifdef TARGET_MIPS - int si_signo; - int si_code; - int si_errno; + abi_int si_signo; + abi_int si_code; + abi_int si_errno; #else - int si_signo; - int si_errno; - int si_code; + abi_int si_signo; + abi_int si_errno; + abi_int si_code; #endif union { - int _pad[TARGET_SI_PAD_SIZE]; + abi_int _pad[TARGET_SI_PAD_SIZE]; /* kill() */ struct { @@ -610,7 +610,7 @@ typedef struct target_siginfo { struct { pid_t _pid; /* which child */ uid_t _uid; /* sender's uid */ - int _status; /* exit code */ + abi_int _status; /* exit code */ target_clock_t _utime; target_clock_t _stime; } _sigchld; @@ -622,8 +622,8 @@ typedef struct target_siginfo { /* SIGPOLL */ struct { - int _band; /* POLL_IN, POLL_OUT, POLL_MSG */ - int _fd; + abi_int _band; /* POLL_IN, POLL_OUT, POLL_MSG */ + abi_int _fd; } _sigpoll; } _sifields; } target_siginfo_t; @@ -701,7 +701,7 @@ typedef struct target_siginfo { #include "target_resource.h" struct target_pollfd { - int fd; /* file descriptor */ + abi_int fd; /* file descriptor */ short events; /* requested events */ short revents; /* returned events */ }; @@ -722,12 +722,12 @@ struct target_pollfd { #define TARGET_KDSIGACCEPT 0x4B4E struct target_rtc_pll_info { - int pll_ctrl; - int pll_value; - int pll_max; - int pll_min; - int pll_posmult; - int pll_negmult; + abi_int pll_ctrl; + abi_int pll_value; + abi_int pll_max; + abi_int pll_min; + abi_int pll_posmult; + abi_int pll_negmult; abi_long pll_clock; }; @@ -754,14 +754,14 @@ struct target_rtc_pll_info { struct target_rtc_pll_info) #define TARGET_RTC_PLL_SET TARGET_IOW('p', 0x12, \ struct target_rtc_pll_info) -#define TARGET_RTC_VL_READ TARGET_IOR('p', 0x13, int) +#define TARGET_RTC_VL_READ TARGET_IOR('p', 0x13, abi_int) #define TARGET_RTC_VL_CLR TARGET_IO('p', 0x14) #if defined(TARGET_ALPHA) || defined(TARGET_MIPS) || defined(TARGET_SH4) || \ defined(TARGET_XTENSA) -#define TARGET_FIOGETOWN TARGET_IOR('f', 123, int) -#define TARGET_FIOSETOWN TARGET_IOW('f', 124, int) -#define TARGET_SIOCATMARK TARGET_IOR('s', 7, int) +#define TARGET_FIOGETOWN TARGET_IOR('f', 123, abi_int) +#define TARGET_FIOSETOWN TARGET_IOW('f', 124, abi_int) +#define TARGET_SIOCATMARK TARGET_IOR('s', 7, abi_int) #define TARGET_SIOCSPGRP TARGET_IOW('s', 8, pid_t) #define TARGET_SIOCGPGRP TARGET_IOR('s', 9, pid_t) #else @@ -851,40 +851,40 @@ struct target_rtc_pll_info { /* From */ -#define TARGET_TUNSETDEBUG TARGET_IOW('T', 201, int) -#define TARGET_TUNSETIFF TARGET_IOW('T', 202, int) -#define TARGET_TUNSETPERSIST TARGET_IOW('T', 203, int) -#define TARGET_TUNSETOWNER TARGET_IOW('T', 204, int) -#define TARGET_TUNSETLINK TARGET_IOW('T', 205, int) -#define TARGET_TUNSETGROUP TARGET_IOW('T', 206, int) +#define TARGET_TUNSETDEBUG TARGET_IOW('T', 201, abi_int) +#define TARGET_TUNSETIFF TARGET_IOW('T', 202, abi_int) +#define TARGET_TUNSETPERSIST TARGET_IOW('T', 203, abi_int) +#define TARGET_TUNSETOWNER TARGET_IOW('T', 204, abi_int) +#define TARGET_TUNSETLINK TARGET_IOW('T', 205, abi_int) +#define TARGET_TUNSETGROUP TARGET_IOW('T', 206, abi_int) #define TARGET_TUNGETFEATURES TARGET_IOR('T', 207, abi_uint) #define TARGET_TUNSETOFFLOAD TARGET_IOW('T', 208, abi_uint) #define TARGET_TUNSETTXFILTER TARGET_IOW('T', 209, abi_uint) #define TARGET_TUNGETIFF TARGET_IOR('T', 210, abi_uint) -#define TARGET_TUNGETSNDBUF TARGET_IOR('T', 211, int) -#define TARGET_TUNSETSNDBUF TARGET_IOW('T', 212, int) +#define TARGET_TUNGETSNDBUF TARGET_IOR('T', 211, abi_int) +#define TARGET_TUNSETSNDBUF TARGET_IOW('T', 212, abi_int) /* * TUNATTACHFILTER and TUNDETACHFILTER are not supported. Linux kernel keeps a * user pointer in TUNATTACHFILTER, which we are not able to correctly handle. */ -#define TARGET_TUNGETVNETHDRSZ TARGET_IOR('T', 215, int) -#define TARGET_TUNSETVNETHDRSZ TARGET_IOW('T', 216, int) -#define TARGET_TUNSETQUEUE TARGET_IOW('T', 217, int) +#define TARGET_TUNGETVNETHDRSZ TARGET_IOR('T', 215, abi_int) +#define TARGET_TUNSETVNETHDRSZ TARGET_IOW('T', 216, abi_int) +#define TARGET_TUNSETQUEUE TARGET_IOW('T', 217, abi_int) #define TARGET_TUNSETIFINDEX TARGET_IOW('T', 218, abi_uint) /* TUNGETFILTER is not supported: see TUNATTACHFILTER. */ -#define TARGET_TUNSETVNETLE TARGET_IOW('T', 220, int) -#define TARGET_TUNGETVNETLE TARGET_IOR('T', 221, int) -#define TARGET_TUNSETVNETBE TARGET_IOW('T', 222, int) -#define TARGET_TUNGETVNETBE TARGET_IOR('T', 223, int) -#define TARGET_TUNSETSTEERINGEBPF TARGET_IOR('T', 224, int) -#define TARGET_TUNSETFILTEREBPF TARGET_IOR('T', 225, int) -#define TARGET_TUNSETCARRIER TARGET_IOW('T', 226, int) +#define TARGET_TUNSETVNETLE TARGET_IOW('T', 220, abi_int) +#define TARGET_TUNGETVNETLE TARGET_IOR('T', 221, abi_int) +#define TARGET_TUNSETVNETBE TARGET_IOW('T', 222, abi_int) +#define TARGET_TUNGETVNETBE TARGET_IOR('T', 223, abi_int) +#define TARGET_TUNSETSTEERINGEBPF TARGET_IOR('T', 224, abi_int) +#define TARGET_TUNSETFILTEREBPF TARGET_IOR('T', 225, abi_int) +#define TARGET_TUNSETCARRIER TARGET_IOW('T', 226, abi_int) #define TARGET_TUNGETDEVNETNS TARGET_IO('T', 227) /* From */ -#define TARGET_RNDGETENTCNT TARGET_IOR('R', 0x00, int) -#define TARGET_RNDADDTOENTCNT TARGET_IOW('R', 0x01, int) +#define TARGET_RNDGETENTCNT TARGET_IOR('R', 0x00, abi_int) +#define TARGET_RNDADDTOENTCNT TARGET_IOW('R', 0x01, abi_int) #define TARGET_RNDZAPENTCNT TARGET_IO('R', 0x04) #define TARGET_RNDCLEARPOOL TARGET_IO('R', 0x06) #define TARGET_RNDRESEEDCRNG TARGET_IO('R', 0x07) @@ -940,7 +940,7 @@ struct target_rtc_pll_info { #define TARGET_FIBMAP TARGET_IO(0x00,1) /* bmap access */ #define TARGET_FIGETBSZ TARGET_IO(0x00,2) /* get the block size used for bmap */ -#define TARGET_FICLONE TARGET_IOW(0x94, 9, int) +#define TARGET_FICLONE TARGET_IOW(0x94, 9, abi_int) #define TARGET_FICLONERANGE TARGET_IOW(0x94, 13, struct file_clone_range) /* @@ -952,10 +952,10 @@ struct target_rtc_pll_info { #define TARGET_FS_IOC_GETVERSION TARGET_IOR('v', 1, abi_long) #define TARGET_FS_IOC_SETVERSION TARGET_IOW('v', 2, abi_long) #define TARGET_FS_IOC_FIEMAP TARGET_IOWR('f',11,struct fiemap) -#define TARGET_FS_IOC32_GETFLAGS TARGET_IOR('f', 1, int) -#define TARGET_FS_IOC32_SETFLAGS TARGET_IOW('f', 2, int) -#define TARGET_FS_IOC32_GETVERSION TARGET_IOR('v', 1, int) -#define TARGET_FS_IOC32_SETVERSION TARGET_IOW('v', 2, int) +#define TARGET_FS_IOC32_GETFLAGS TARGET_IOR('f', 1, abi_int) +#define TARGET_FS_IOC32_SETFLAGS TARGET_IOW('f', 2, abi_int) +#define TARGET_FS_IOC32_GETVERSION TARGET_IOR('v', 1, abi_int) +#define TARGET_FS_IOC32_SETVERSION TARGET_IOW('v', 2, abi_int) /* btrfs ioctls */ #ifdef HAVE_BTRFS_H @@ -1577,14 +1577,14 @@ struct QEMU_PACKED target_stat64 { abi_ullong st_rdev; abi_ullong __pad0; abi_llong st_size; - int st_blksize; + abi_int st_blksize; abi_uint __pad1; abi_llong st_blocks; /* Number 512-byte blocks allocated. */ - int target_st_atime; + abi_int target_st_atime; abi_uint target_st_atime_nsec; - int target_st_mtime; + abi_int target_st_mtime; abi_uint target_st_mtime_nsec; - int target_st_ctime; + abi_int target_st_ctime; abi_uint target_st_ctime_nsec; abi_uint __unused4; abi_uint __unused5; @@ -1635,11 +1635,11 @@ struct QEMU_PACKED target_stat64 { abi_uint __pad2; abi_llong st_blocks; - int target_st_atime; + abi_int target_st_atime; abi_uint target_st_atime_nsec; - int target_st_mtime; + abi_int target_st_mtime; abi_uint target_st_mtime_nsec; - int target_st_ctime; + abi_int target_st_ctime; abi_uint target_st_ctime_nsec; abi_ullong st_ino; }; @@ -1720,8 +1720,8 @@ struct target_stat { abi_uint st_mode; abi_uint st_nlink; - int st_uid; - int st_gid; + abi_int st_uid; + abi_int st_gid; abi_uint st_rdev; abi_uint st_pad1[3]; /* Reserved for st_rdev expansion */ @@ -1756,8 +1756,8 @@ struct target_stat { abi_ullong st_ino; abi_uint st_mode; abi_uint st_nlink; - int st_uid; - int st_gid; + abi_int st_uid; + abi_int st_gid; abi_ulong st_rdev; abi_ulong st_pad1[3]; /* Reserved for st_rdev expansion */ abi_llong st_size; @@ -1781,8 +1781,8 @@ struct target_stat { abi_ulong st_ino; abi_uint st_mode; abi_uint st_nlink; - int st_uid; - int st_gid; + abi_int st_uid; + abi_int st_gid; unsigned st_rdev; abi_long st_pad2[2]; abi_long st_size; @@ -1818,8 +1818,8 @@ struct target_stat64 { abi_uint st_mode; abi_uint st_nlink; - int st_uid; - int st_gid; + abi_int st_uid; + abi_int st_gid; abi_ulong st_rdev; abi_ulong st_pad1[3]; /* Reserved for st_rdev expansion */ @@ -2008,8 +2008,8 @@ struct target_stat { abi_ulong st_rdev; abi_ulong _pad1; abi_long st_size; - int st_blksize; - int __pad2; + abi_int st_blksize; + abi_int __pad2; abi_long st_blocks; abi_long target_st_atime; abi_ulong target_st_atime_nsec; @@ -2081,8 +2081,8 @@ struct target_stat { abi_ulong st_rdev; abi_ulong __pad1; abi_long st_size; - int st_blksize; - int __pad2; + abi_int st_blksize; + abi_int __pad2; abi_long st_blocks; abi_long target_st_atime; abi_ulong target_st_atime_nsec; @@ -2106,14 +2106,14 @@ struct target_stat64 { abi_ullong st_rdev; abi_ullong __pad1; abi_llong st_size; - int st_blksize; - int __pad2; + abi_int st_blksize; + abi_int __pad2; abi_llong st_blocks; - int target_st_atime; + abi_int target_st_atime; abi_uint target_st_atime_nsec; - int target_st_mtime; + abi_int target_st_mtime; abi_uint target_st_mtime_nsec; - int target_st_ctime; + abi_int target_st_ctime; abi_uint target_st_ctime_nsec; abi_uint __unused4; abi_uint __unused5; @@ -2186,7 +2186,7 @@ struct target_stat64 { #endif typedef struct { - int val[2]; + abi_int val[2]; } target_fsid_t; #ifdef TARGET_MIPS @@ -2351,7 +2351,7 @@ struct target_statfs64 { /* soundcard defines */ /* XXX: convert them all to arch independent entries */ -#define TARGET_SNDCTL_COPR_HALT TARGET_IOWR('C', 7, int); +#define TARGET_SNDCTL_COPR_HALT TARGET_IOWR('C', 7, abi_int); #define TARGET_SNDCTL_COPR_LOAD 0xcfb04301 #define TARGET_SNDCTL_COPR_RCODE 0xc0144303 #define TARGET_SNDCTL_COPR_RCVMSG 0x8fa44309 @@ -2363,20 +2363,20 @@ struct target_statfs64 { #define TARGET_SNDCTL_COPR_WDATA 0x40144304 #define TARGET_SNDCTL_DSP_RESET TARGET_IO('P', 0) #define TARGET_SNDCTL_DSP_SYNC TARGET_IO('P', 1) -#define TARGET_SNDCTL_DSP_SPEED TARGET_IOWR('P', 2, int) -#define TARGET_SNDCTL_DSP_STEREO TARGET_IOWR('P', 3, int) -#define TARGET_SNDCTL_DSP_GETBLKSIZE TARGET_IOWR('P', 4, int) -#define TARGET_SNDCTL_DSP_SETFMT TARGET_IOWR('P', 5, int) -#define TARGET_SNDCTL_DSP_CHANNELS TARGET_IOWR('P', 6, int) -#define TARGET_SOUND_PCM_WRITE_FILTER TARGET_IOWR('P', 7, int) +#define TARGET_SNDCTL_DSP_SPEED TARGET_IOWR('P', 2, abi_int) +#define TARGET_SNDCTL_DSP_STEREO TARGET_IOWR('P', 3, abi_int) +#define TARGET_SNDCTL_DSP_GETBLKSIZE TARGET_IOWR('P', 4, abi_int) +#define TARGET_SNDCTL_DSP_SETFMT TARGET_IOWR('P', 5, abi_int) +#define TARGET_SNDCTL_DSP_CHANNELS TARGET_IOWR('P', 6, abi_int) +#define TARGET_SOUND_PCM_WRITE_FILTER TARGET_IOWR('P', 7, abi_int) #define TARGET_SNDCTL_DSP_POST TARGET_IO('P', 8) -#define TARGET_SNDCTL_DSP_SUBDIVIDE TARGET_IOWR('P', 9, int) -#define TARGET_SNDCTL_DSP_SETFRAGMENT TARGET_IOWR('P',10, int) -#define TARGET_SNDCTL_DSP_GETFMTS TARGET_IOR('P', 11, int) +#define TARGET_SNDCTL_DSP_SUBDIVIDE TARGET_IOWR('P', 9, abi_int) +#define TARGET_SNDCTL_DSP_SETFRAGMENT TARGET_IOWR('P',10, abi_int) +#define TARGET_SNDCTL_DSP_GETFMTS TARGET_IOR('P', 11, abi_int) #define TARGET_SNDCTL_DSP_GETOSPACE TARGET_IORU('P',12) #define TARGET_SNDCTL_DSP_GETISPACE TARGET_IORU('P',13) -#define TARGET_SNDCTL_DSP_GETCAPS TARGET_IOR('P', 15, int) -#define TARGET_SNDCTL_DSP_GETTRIGGER TARGET_IOR('P',16, int) +#define TARGET_SNDCTL_DSP_GETCAPS TARGET_IOR('P', 15, abi_int) +#define TARGET_SNDCTL_DSP_GETTRIGGER TARGET_IOR('P',16, abi_int) #define TARGET_SNDCTL_DSP_GETIPTR TARGET_IORU('P',17) #define TARGET_SNDCTL_DSP_GETOPTR TARGET_IORU('P',18) #define TARGET_SNDCTL_DSP_MAPINBUF TARGET_IORU('P', 19) @@ -2424,13 +2424,13 @@ struct target_statfs64 { #define TARGET_SOUND_PCM_READ_FILTER 0x80045007 #define TARGET_SOUND_MIXER_INFO TARGET_IOR ('M', 101, mixer_info) #define TARGET_SOUND_MIXER_ACCESS 0xc0804d66 -#define TARGET_SOUND_MIXER_PRIVATE1 TARGET_IOWR('M', 111, int) -#define TARGET_SOUND_MIXER_PRIVATE2 TARGET_IOWR('M', 112, int) -#define TARGET_SOUND_MIXER_PRIVATE3 TARGET_IOWR('M', 113, int) -#define TARGET_SOUND_MIXER_PRIVATE4 TARGET_IOWR('M', 114, int) -#define TARGET_SOUND_MIXER_PRIVATE5 TARGET_IOWR('M', 115, int) +#define TARGET_SOUND_MIXER_PRIVATE1 TARGET_IOWR('M', 111, abi_int) +#define TARGET_SOUND_MIXER_PRIVATE2 TARGET_IOWR('M', 112, abi_int) +#define TARGET_SOUND_MIXER_PRIVATE3 TARGET_IOWR('M', 113, abi_int) +#define TARGET_SOUND_MIXER_PRIVATE4 TARGET_IOWR('M', 114, abi_int) +#define TARGET_SOUND_MIXER_PRIVATE5 TARGET_IOWR('M', 115, abi_int) -#define TARGET_MIXER_READ(dev) TARGET_IOR('M', dev, int) +#define TARGET_MIXER_READ(dev) TARGET_IOR('M', dev, abi_int) #define TARGET_SOUND_MIXER_READ_VOLUME TARGET_MIXER_READ(SOUND_MIXER_VOLUME) #define TARGET_SOUND_MIXER_READ_BASS TARGET_MIXER_READ(SOUND_MIXER_BASS) @@ -2461,7 +2461,7 @@ struct target_statfs64 { #define TARGET_SOUND_MIXER_READ_STEREODEVS TARGET_MIXER_READ(SOUND_MIXER_STEREODEVS) #define TARGET_SOUND_MIXER_READ_CAPS TARGET_MIXER_READ(SOUND_MIXER_CAPS) -#define TARGET_MIXER_WRITE(dev) TARGET_IOWR('M', dev, int) +#define TARGET_MIXER_WRITE(dev) TARGET_IOWR('M', dev, abi_int) #define TARGET_SOUND_MIXER_WRITE_VOLUME TARGET_MIXER_WRITE(SOUND_MIXER_VOLUME) #define TARGET_SOUND_MIXER_WRITE_BASS TARGET_MIXER_WRITE(SOUND_MIXER_BASS) @@ -2489,17 +2489,17 @@ struct target_statfs64 { #define TARGET_SOUND_MIXER_WRITE_RECSRC TARGET_MIXER_WRITE(SOUND_MIXER_RECSRC) struct target_snd_timer_id { - int dev_class; - int dev_sclass; - int card; - int device; - int subdevice; + abi_int dev_class; + abi_int dev_sclass; + abi_int card; + abi_int device; + abi_int subdevice; }; struct target_snd_timer_ginfo { struct target_snd_timer_id tid; abi_uint flags; - int card; + abi_int card; unsigned char id[64]; unsigned char name[80]; abi_ulong reserved0; @@ -2532,7 +2532,7 @@ struct target_snd_timer_select { struct target_snd_timer_info { abi_uint flags; - int card; + abi_int card; unsigned char id[64]; unsigned char name[80]; abi_ulong reserved0; @@ -2550,7 +2550,7 @@ struct target_snd_timer_status { }; /* alsa timer ioctls */ -#define TARGET_SNDRV_TIMER_IOCTL_PVERSION TARGET_IOR('T', 0x00, int) +#define TARGET_SNDRV_TIMER_IOCTL_PVERSION TARGET_IOR('T', 0x00, abi_int) #define TARGET_SNDRV_TIMER_IOCTL_NEXT_DEVICE TARGET_IOWR('T', 0x01, \ struct snd_timer_id) #define TARGET_SNDRV_TIMER_IOCTL_GINFO TARGET_IOWR('T', 0x03, \ @@ -2650,9 +2650,9 @@ struct target_mq_attr { }; struct target_drm_version { - int version_major; - int version_minor; - int version_patchlevel; + abi_int version_major; + abi_int version_minor; + abi_int version_patchlevel; abi_ulong name_len; abi_ulong name; abi_ulong date_len; @@ -2662,7 +2662,7 @@ struct target_drm_version { }; struct target_drm_i915_getparam { - int param; + abi_int param; abi_ulong value; }; @@ -2755,7 +2755,7 @@ struct target_sigevent { struct target_user_cap_header { abi_uint version; - int pid; + abi_int pid; }; struct target_user_cap_data { From patchwork Sat Jul 15 13:52:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 703221 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e4d:0:b0:314:25da:8dc4 with SMTP id r13csp157257wrt; Sat, 15 Jul 2023 06:55:47 -0700 (PDT) X-Google-Smtp-Source: APBJJlEsG26Uj+bSVhJyuH7foprMexRSjYjITZFDshW2As59w1PkyBJN/AC+kkPsTOKQbVHaGoZ9 X-Received: by 2002:a0c:ab19:0:b0:61b:7bac:aeb7 with SMTP id h25-20020a0cab19000000b0061b7bacaeb7mr6004789qvb.40.1689429347188; Sat, 15 Jul 2023 06:55:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689429347; cv=none; d=google.com; s=arc-20160816; b=DdJq69labRio3jkMLPTiYt7Vz0qaW6w0aRE6hbdmwO0mNJsNGGJNtjaVDpj9hxxkpw vpXQd9SkpQ4JjdKm7s6TC+8m9FE1Dgy/bM9lFmVL37ACKbcJQklL4KisJBsJrGlpRzea mON3wBUMAF+GkXBszctYJHLnqt8cl2oEOsG9x5nj+Eesk7IgTiMFUaE87eFemIf72IED XeX6dePfQogo7ZnD58m7kw4Vu9OoFEp3ghD0rYPnwbh23vRLnIEh5EhUdixboIY3yP7z twfy69P3a3X7NxcgUHAUrfY4qzKSDkr6vRlep2SSwFsTLRJYEOXrZYOfAIs91PzHd7ZJ PpZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=0axJfNA+Z363BLcyj9VA5KZ1tFbJa96aH9vwiYFI9Ic=; fh=i1mkeM7bD/ppus3C3v+92ltBBCUUU0zBXrpbYjAjHqE=; b=O9cKzLV2AAFUoayFH+9rXcDhCiHlmXYqecTI79QmGvBlhK5lvGl0n5q9H8/p8UrgOw p9Be+JS/Zj821HX2kPvW4PqKYb6vy1FAnmNJ15MJA+mjH9SfLOMK4cTgr6xh6xPOgJr5 Kf0CGxU4N7I30Z09DBrwIkbU4EXyYKHg3IWlnndMQkhmJlsLTF4DX15VqQ/6QYkNRSt4 6x4V6DbW7rqLJfxECZVkfdUQdqzTF3xKcEudena5B9zl5VZMzme/OOfE2WkpdGC31VJt CgJH6TYnXWyQqHGCX/J059A9T30Vyw6jtcD9KSKW+DaZtxxGO13Ko5jVL+4DI29TfvoR 72Pw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SrdTNYG8; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id a14-20020a0cca8e000000b00636cec467casi5835127qvk.108.2023.07.15.06.55.47 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 15 Jul 2023 06:55:47 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SrdTNYG8; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qKfiw-0004TL-AE; Sat, 15 Jul 2023 09:54:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qKfiG-00042M-6V for qemu-devel@nongnu.org; Sat, 15 Jul 2023 09:53:32 -0400 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qKfiE-0001F4-An for qemu-devel@nongnu.org; Sat, 15 Jul 2023 09:53:31 -0400 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-3fbc5d5742bso26493635e9.2 for ; Sat, 15 Jul 2023 06:53:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689429209; x=1692021209; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=0axJfNA+Z363BLcyj9VA5KZ1tFbJa96aH9vwiYFI9Ic=; b=SrdTNYG8tCX/BbtFwlVg943r8hTttT+hCQnr8BXmQEfEsbRLXryuNOKwWKssjIQQsJ zi2fR4G1y0WH6T/watMyvXjZZoA4hsccM2HtBFJdKkt1g6i9Be5WnR2TaGXXYzuOKT7G fToGp5zuGlwwweAYL9o+4UusvVt33ht4gE+WvavlMN/040q8mBNy8zKF2CXLDlouc+NR VoJUHH8biOvXBU+506/eTaAoyz21qgWqoNFD/A91fj30qbmKYlmDK3GI97lLQw2OPSVq 97L7vAiFrcCTm471NgtxypfRUpk1UBuhReHoJK/SM65nka56rmemxSCLAhLXSjdxjZmS aXlg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689429209; x=1692021209; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0axJfNA+Z363BLcyj9VA5KZ1tFbJa96aH9vwiYFI9Ic=; b=VB8HYET6LW9sepEVBbJIkJf4HUE5RyrGFSO/1/Dd+co/n5hFWSb5O6dCTx1pjQIsTX 93o/umSeLOxeH++DRafuhQ8eIWphqsC3cQtGMnFJejxAuJ3kWcu/ksnPwYB8pkPu9N01 7wyGAjsKTfKJoS1F27hGr5oqvy5iFyw+j2f4fGyVZjDS2Cd6o1wSH2WTgWZ+YkXxBkjg DzVsJvWs+XhpI/rrbiGKh2gzUsehaSva9hzFHchhcaZj4RhZUfc4cn4jMZ4yz+rDpcuR veR4p2sZk99MEL2o8MDQoGFE0f3wpuMgDPdgWkxqaKo6n4vcZBJ7AdAjuZMyzAOaXjYX oI3w== X-Gm-Message-State: ABy/qLaUegI0cRNs5PNrsToTuHusz1Qgi8xqsSgE292P6sH59SdLD6cZ V1NtHFkBKJQUtsG1YictqdO/g0NFvBk5R7Z98xQqrw== X-Received: by 2002:a05:600c:da:b0:3f7:f584:5796 with SMTP id u26-20020a05600c00da00b003f7f5845796mr7046903wmm.2.1689429208813; Sat, 15 Jul 2023 06:53:28 -0700 (PDT) Received: from stoup.lan ([51.219.12.49]) by smtp.gmail.com with ESMTPSA id k10-20020a5d66ca000000b00313f9085119sm13838014wrw.113.2023.07.15.06.53.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Jul 2023 06:53:28 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL 11/47] linux-user: Use abi_ushort not unsigned short in syscall_defs.h Date: Sat, 15 Jul 2023 14:52:41 +0100 Message-Id: <20230715135317.7219-12-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230715135317.7219-1-richard.henderson@linaro.org> References: <20230715135317.7219-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32d; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x32d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- linux-user/syscall_defs.h | 90 +++++++++++++++++++-------------------- 1 file changed, 45 insertions(+), 45 deletions(-) diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index 442a8aefe3..21ca03b0f4 100644 --- a/linux-user/syscall_defs.h +++ b/linux-user/syscall_defs.h @@ -432,7 +432,7 @@ typedef struct { struct target_dirent { abi_long d_ino; abi_long d_off; - unsigned short d_reclen; + abi_ushort d_reclen; char d_name[]; }; @@ -1210,19 +1210,19 @@ struct target_rtc_pll_info { #define TARGET_NCC 8 struct target_termio { - unsigned short c_iflag; /* input mode flags */ - unsigned short c_oflag; /* output mode flags */ - unsigned short c_cflag; /* control mode flags */ - unsigned short c_lflag; /* local mode flags */ + abi_ushort c_iflag; /* input mode flags */ + abi_ushort c_oflag; /* output mode flags */ + abi_ushort c_cflag; /* control mode flags */ + abi_ushort c_lflag; /* local mode flags */ unsigned char c_line; /* line discipline */ unsigned char c_cc[TARGET_NCC]; /* control characters */ }; struct target_winsize { - unsigned short ws_row; - unsigned short ws_col; - unsigned short ws_xpixel; - unsigned short ws_ypixel; + abi_ushort ws_row; + abi_ushort ws_col; + abi_ushort ws_xpixel; + abi_ushort ws_ypixel; }; #include "termbits.h" @@ -1328,15 +1328,15 @@ struct target_winsize { || defined(TARGET_CRIS) #define TARGET_STAT_HAVE_NSEC struct target_stat { - unsigned short st_dev; - unsigned short __pad1; + abi_ushort st_dev; + abi_ushort __pad1; abi_ulong st_ino; - unsigned short st_mode; - unsigned short st_nlink; - unsigned short st_uid; - unsigned short st_gid; - unsigned short st_rdev; - unsigned short __pad2; + abi_ushort st_mode; + abi_ushort st_nlink; + abi_ushort st_uid; + abi_ushort st_gid; + abi_ushort st_rdev; + abi_ushort __pad2; abi_ulong st_size; abi_ulong st_blksize; abi_ulong st_blocks; @@ -1355,7 +1355,7 @@ struct target_stat { */ #define TARGET_HAS_STRUCT_STAT64 struct target_stat64 { - unsigned short st_dev; + abi_ushort st_dev; unsigned char __pad0[10]; #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 @@ -1367,7 +1367,7 @@ struct target_stat64 { abi_ulong st_uid; abi_ulong st_gid; - unsigned short st_rdev; + abi_ushort st_rdev; unsigned char __pad3[10]; abi_llong st_size; @@ -1442,7 +1442,7 @@ struct target_stat { #define TARGET_HAS_STRUCT_STAT64 struct target_stat64 { unsigned char __pad0[6]; - unsigned short st_dev; + abi_ushort st_dev; abi_ullong st_ino; abi_ullong st_nlink; @@ -1453,7 +1453,7 @@ struct target_stat64 { abi_uint st_gid; unsigned char __pad2[6]; - unsigned short st_rdev; + abi_ushort st_rdev; abi_llong st_size; abi_llong st_blksize; @@ -1477,13 +1477,13 @@ struct target_stat64 { #define TARGET_STAT_HAVE_NSEC struct target_stat { - unsigned short st_dev; + abi_ushort st_dev; abi_ulong st_ino; - unsigned short st_mode; + abi_ushort st_mode; short st_nlink; - unsigned short st_uid; - unsigned short st_gid; - unsigned short st_rdev; + abi_ushort st_uid; + abi_ushort st_gid; + abi_ushort st_rdev; abi_long st_size; abi_long target_st_atime; abi_ulong target_st_atime_nsec; @@ -1499,7 +1499,7 @@ struct target_stat { #define TARGET_HAS_STRUCT_STAT64 struct target_stat64 { unsigned char __pad0[6]; - unsigned short st_dev; + abi_ushort st_dev; abi_ullong st_ino; @@ -1510,7 +1510,7 @@ struct target_stat64 { abi_uint st_gid; unsigned char __pad2[6]; - unsigned short st_rdev; + abi_ushort st_rdev; unsigned char __pad3[8]; @@ -1544,7 +1544,7 @@ struct target_stat { abi_uint st_mode; #else abi_uint st_mode; - unsigned short st_nlink; + abi_ushort st_nlink; #endif abi_uint st_uid; abi_uint st_gid; @@ -1598,7 +1598,7 @@ struct target_stat { abi_ulong st_dev; abi_ulong st_ino; abi_uint st_mode; - unsigned short st_nlink; + abi_ushort st_nlink; abi_uint st_uid; abi_uint st_gid; abi_ulong st_rdev; @@ -1647,15 +1647,15 @@ struct QEMU_PACKED target_stat64 { #elif defined(TARGET_M68K) struct target_stat { - unsigned short st_dev; - unsigned short __pad1; - abi_ulong st_ino; - unsigned short st_mode; - unsigned short st_nlink; - unsigned short st_uid; - unsigned short st_gid; - unsigned short st_rdev; - unsigned short __pad2; + abi_ushort st_dev; + abi_ushort __pad1; + abi_ulong st_ino; + abi_ushort st_mode; + abi_ushort st_nlink; + abi_ushort st_uid; + abi_ushort st_gid; + abi_ushort st_rdev; + abi_ushort __pad2; abi_ulong st_size; abi_ulong st_blksize; abi_ulong st_blocks; @@ -1895,10 +1895,10 @@ struct target_stat64 { struct target_stat { abi_ulong st_dev; abi_ulong st_ino; - unsigned short st_mode; - unsigned short st_nlink; - unsigned short st_uid; - unsigned short st_gid; + abi_ushort st_mode; + abi_ushort st_nlink; + abi_ushort st_uid; + abi_ushort st_gid; abi_ulong st_rdev; abi_ulong st_size; abi_ulong st_blksize; @@ -2619,8 +2619,8 @@ struct target_sysinfo { abi_ulong bufferram; /* Memory used by buffers */ abi_ulong totalswap; /* Total swap space size */ abi_ulong freeswap; /* swap space still available */ - unsigned short procs; /* Number of current processes */ - unsigned short pad; /* explicit padding for m68k */ + abi_ushort procs; /* Number of current processes */ + abi_ushort pad; /* explicit padding for m68k */ abi_ulong totalhigh; /* Total high memory size */ abi_ulong freehigh; /* Available high memory size */ abi_uint mem_unit; /* Memory unit size in bytes */ From patchwork Sat Jul 15 13:52:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 703250 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e4d:0:b0:314:25da:8dc4 with SMTP id r13csp160942wrt; Sat, 15 Jul 2023 07:03:22 -0700 (PDT) X-Google-Smtp-Source: APBJJlH1SW2pXWlojIV5NyKSKHJ4WSElrZ4jW0MTn+uI1pUnugN4U6Rh68+Ay2ogRIExyv5p6Nmy X-Received: by 2002:a05:6214:408:b0:631:f590:69bd with SMTP id z8-20020a056214040800b00631f59069bdmr7067686qvx.25.1689429802554; Sat, 15 Jul 2023 07:03:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689429802; cv=none; d=google.com; s=arc-20160816; b=Al+vbESpTyIXPkWR7h0iiTFPJqrDHScnmhyPWN3VACYVz1Q9MD1efzsUM2P92YG1wU 8MZbapk9GiXgaOpFH8mK2sVDbK9V/Q87EqlVhHRaXo5gR3XY7ruVQd+rsNFFJgOhL83h 46kOb61XflYCXG11nJv4gCQMUTb5IhV4ITQ49yj1IGwhPlwmsOPbJJG0m35T2RUCWWVM jtoeoV7mH64piSlU4fz7jHqRvuQjYtvjJ3KFQw1UhdWhi9qO+MhQT4xA1u3OBbtgnZ46 cPd6TS7Rw5Zxo2CssRkaI/Nj/LwwpN4colzSQ/DLQd3CLrzuC62VlIGpquEVj/eaqmHm C3sw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=gQ2Bxu/rilowTJXaihrKCWkhFlHMy8pQmQA827CvuAY=; fh=i1mkeM7bD/ppus3C3v+92ltBBCUUU0zBXrpbYjAjHqE=; b=AvR4iEGRoah/QsXgCLlJx65XQl4o3Qrxr7Jjg0Qgbc57f6X3LxWSmcQCNOAZx2ASyb Rz+AviNbVIFToFYpEaDSaJnrtQ4JyDhn3XIHAoLDIf+iirBcDNwGpNj+4XqFlaYW14ZI eAuKBMgXECY8Ui5KxOeVbir5Lf3nZ9IB069cKWGmIpoSyh286/mhvNiR1aTK/X1HoGsH jVtuA7Otft/t/Qeaq6a1Phd8z8PgNJ5gJGCZrkMB147MclgHRkTahB2rO20lw644v+WF h0O2qDkkZuwf8mcfGMWe1XnRS4EvWk0kW+PbNIgJQzJLbXXHTFT/CdtXfvE8DknqTuDy mn2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MEGosP0Y; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id k5-20020a0cf585000000b006060526a818si5784023qvm.294.2023.07.15.07.03.22 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 15 Jul 2023 07:03:22 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MEGosP0Y; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qKfjW-0005Su-3c; Sat, 15 Jul 2023 09:54:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qKfiG-00042Y-OX for qemu-devel@nongnu.org; Sat, 15 Jul 2023 09:53:34 -0400 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qKfiF-0001FE-6O for qemu-devel@nongnu.org; Sat, 15 Jul 2023 09:53:32 -0400 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-3fc02a92dcfso26057855e9.0 for ; Sat, 15 Jul 2023 06:53:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689429209; x=1692021209; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=gQ2Bxu/rilowTJXaihrKCWkhFlHMy8pQmQA827CvuAY=; b=MEGosP0Yy+10uRbZiHvlRDxU3yGa0m7gKvbZJV9Bw2Nl0j2kljDIeE6+rSwv+cshRl UvtYJ/zXIu3VmaGHbsR4hvsVLMe3EL5doyaG8jsuNTHDyneBwWCiW6r1CiylDx4+d5fA 8R7mvpwJ0LmNwgRJniF87LvKhny1ahYvpLuIGcyKL9oA2lXixBVuI2tYxRbXwN0hP7f7 TfMfM6CRtBxpvG8tEFzlDXvC1Gq/5iA8Z+pOeulX+MtdS1LRgkKfCegCazve2sGCA2Tn 0DZ25T+E4a/tqXxa/z47F7l6s141CbGPMGkEeLbuZqibC+2Ord+pmCRbJOy/WQXN/BZE FJVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689429209; x=1692021209; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gQ2Bxu/rilowTJXaihrKCWkhFlHMy8pQmQA827CvuAY=; b=bruUazsw0vM2fcbzQHvLG0fS+UU9WZECDfnJ0J7OWWzbhXlxZQa0HVzhD00bW2Po+w bmMTKKf3iIpi1G10x721OishGNeDogjJRB1yLtWj1fhtKcVYbMJdqsB1M2lbgNqmV3ze 3oP++pBmMx117BMzS3my6mGMEwiVf1AfUQqbzi7Mv0PRfQ7v7IaEQmOvd2KGNqRYKJfa ot/tt1OqjTl9zX+XhwfUxCDw8kiWodLFUK7MQzGKPz8Vd9GgfVT6gv/o8W4QGvz1+qAJ XzG2jUZOvanpoZQ8BDx+fljqot2tqDw9o0Gkn6RzNcI1vU1rr49ATrME9scZ0fG0c5i6 nZ4w== X-Gm-Message-State: ABy/qLaHo4Cpxd1SXi9e7HcyzlHEb0U5lmwO1K50X2+dqKpfdIs50n8/ 1CzCZ+ZT95Zzq++JHVY454O2O0WMUARaPSJtu/3H8w== X-Received: by 2002:adf:cd09:0:b0:314:3f98:a788 with SMTP id w9-20020adfcd09000000b003143f98a788mr6379541wrm.7.1689429209650; Sat, 15 Jul 2023 06:53:29 -0700 (PDT) Received: from stoup.lan ([51.219.12.49]) by smtp.gmail.com with ESMTPSA id k10-20020a5d66ca000000b00313f9085119sm13838014wrw.113.2023.07.15.06.53.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Jul 2023 06:53:29 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL 12/47] linux-user: Use abi_short not short in syscall_defs.h Date: Sat, 15 Jul 2023 14:52:42 +0100 Message-Id: <20230715135317.7219-13-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230715135317.7219-1-richard.henderson@linaro.org> References: <20230715135317.7219-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32a; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x32a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- linux-user/syscall_defs.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index 21ca03b0f4..9dc41828cf 100644 --- a/linux-user/syscall_defs.h +++ b/linux-user/syscall_defs.h @@ -702,8 +702,8 @@ typedef struct target_siginfo { struct target_pollfd { abi_int fd; /* file descriptor */ - short events; /* requested events */ - short revents; /* returned events */ + abi_short events; /* requested events */ + abi_short revents; /* returned events */ }; /* virtual terminal ioctls */ @@ -1480,7 +1480,7 @@ struct target_stat { abi_ushort st_dev; abi_ulong st_ino; abi_ushort st_mode; - short st_nlink; + abi_short st_nlink; abi_ushort st_uid; abi_ushort st_gid; abi_ushort st_rdev; From patchwork Sat Jul 15 13:52:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 703226 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e4d:0:b0:314:25da:8dc4 with SMTP id r13csp157384wrt; Sat, 15 Jul 2023 06:56:10 -0700 (PDT) X-Google-Smtp-Source: APBJJlHvpbL+RB8/YS7xR3LFnne9YPZ8oNSzLX/5oUzuWOfbXdjS4ag9GNABZKrvYzfYFTYUgRi0 X-Received: by 2002:a05:622a:1807:b0:403:b016:a2b6 with SMTP id t7-20020a05622a180700b00403b016a2b6mr9769918qtc.16.1689429370522; Sat, 15 Jul 2023 06:56:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689429370; cv=none; d=google.com; s=arc-20160816; b=rX6c98aAQD0xTqXCY3aCjUQlDV7lUyL1ekKp/mvYjQdk1PcjY7t2tuU6fbNm17kqk8 kM0Iv5u8jFcAPDWgMuHk2kOts+ASHFVr2uSxRmruuTy4ZNd9B9oigfXyQSIJDhVSaTAg 32yM+Hm74x57dMADCoFOR6ADgHVoZn08rRaCAwlGkRj36Uz7GeIKBEI5nIcCzon+aVA5 NXz8Ko34AghnewOipLKVnXWztNNIrxYHPBv5GqX0PEENZmUkzOoqBLOVDdnVuYqfu8ja FQV0jaLIzAFYzv340uMizzRf6dEF14gp7JzuaP5njuG9mwUz7XowcMOtA3L/rsTRlMMd 41hw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=NM1xXL81EtFD9ExbvPk3EQKQbkl//TA55SFLIHfjSWw=; fh=i1mkeM7bD/ppus3C3v+92ltBBCUUU0zBXrpbYjAjHqE=; b=yPJxyht/4z7ehyqe7Y20EC1Q4igSQuTz/WI5XDGDDYPi55AgB8OSTjIq+qRwytJiU2 XmIhP57kozZa87qF0wE9PnJcDhX1Zn2z47KxPFhHM6TF9xAVJvM8xG96yt3+hKLrQ0Gx kLJZc9wtg4/h0ury/4ES9FekW1PF2JGnTF37Z+C9CuwpxSIRujYpb+fUwO5ircZimauK N3YIDtlqfLCsS3Q2yKM/Nlut4OeoMh7YxFrFZMgFEryjRTnO16ySDer9Kdf64Ow+9xGo YkL5HkjV93sHYwo8o65HQSusYWo0QNpFZNOc+eurIyu53/U3K6tohX42VkAPQpLCl3lW /s3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZSNp0u33; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id l20-20020a05622a175400b0040399b08195si5668653qtk.738.2023.07.15.06.56.10 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 15 Jul 2023 06:56:10 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZSNp0u33; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qKfiq-0004EX-L6; Sat, 15 Jul 2023 09:54:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qKfiH-00042a-4j for qemu-devel@nongnu.org; Sat, 15 Jul 2023 09:53:34 -0400 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qKfiF-0001FS-Je for qemu-devel@nongnu.org; Sat, 15 Jul 2023 09:53:32 -0400 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-3fbc5d5742eso29395465e9.3 for ; Sat, 15 Jul 2023 06:53:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689429210; x=1692021210; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=NM1xXL81EtFD9ExbvPk3EQKQbkl//TA55SFLIHfjSWw=; b=ZSNp0u33UreTJeB22qnslIsn7ZkAqD/6fW7QNFIp75qmN064npL8vy8OW5Sk3oVxbb vtMMR+W2iRmoDlh8FK0Nb6xNIJKuJXRiAfJvWVcX3IUBcjxYpjL2d2VwGRmSTmNx4P8+ qP537i8EQBEUP/1pMhLeSGFzG5ripphJ+X/bDoWrUM6zet2ajoGpsZErmG1ca8JJDytm bQScIx4LBh4ttfPb8S2XyVeTik24aRfc6X5jXcF+IDM5pO69abLo/CcP2dn+xjn/omC5 giDCAxPyLBd1X3zxHTGpyE8oBEpMCkDW+/VEaBM514lUvIzPKRsPTwdQ2LmtrqZTa1+e Nd8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689429210; x=1692021210; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=NM1xXL81EtFD9ExbvPk3EQKQbkl//TA55SFLIHfjSWw=; b=XQu8INQ7qoDwisOSnhZr/meetAoEWM9dh6SpcWhkJLvCHfzd1NF0RTkUSXklUNmawK J2CgJWn7+tcqn2eiJFlJtK8Y0u7wrQx96ooesUNw31hMdADN/SE3x9U+c+kLlHjMlGXv t256xB0bQiBQocqs/aqixq4BpqLnG9JDlaVtO3Zfz0bxVQ4vom7IRjpn8UzzfP1SBJ57 uOHF3RJYeG0ly/PcaMlwmzi0flC71uziDlezynlX1hw+vCbb2BXiKE7GKrWtRStEjsys bfnM6AyFLKIYTAcZM4PbSMLl2LI6HLN8OkTvkwJwFn4GfRslxWIBI3VJDLLAlnxdKU3q aBdA== X-Gm-Message-State: ABy/qLa8bgWZxaYXA1/S6XnsBkAhR7H1LoOPOnSuvm9bjUOxqmBklw54 Rq826VILlk3uxKdnBxJu6kTPPTww887A5ZhOCUtb4w== X-Received: by 2002:a7b:cbc6:0:b0:3fc:70:2f76 with SMTP id n6-20020a7bcbc6000000b003fc00702f76mr6605414wmi.20.1689429210308; Sat, 15 Jul 2023 06:53:30 -0700 (PDT) Received: from stoup.lan ([51.219.12.49]) by smtp.gmail.com with ESMTPSA id k10-20020a5d66ca000000b00313f9085119sm13838014wrw.113.2023.07.15.06.53.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Jul 2023 06:53:30 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL 13/47] linux-user: Use abi_uint not unsigned in syscall_defs.h Date: Sat, 15 Jul 2023 14:52:43 +0100 Message-Id: <20230715135317.7219-14-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230715135317.7219-1-richard.henderson@linaro.org> References: <20230715135317.7219-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32a; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x32a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- linux-user/syscall_defs.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index 9dc41828cf..c8ffb4f785 100644 --- a/linux-user/syscall_defs.h +++ b/linux-user/syscall_defs.h @@ -1776,14 +1776,14 @@ struct target_stat { #define TARGET_STAT_HAVE_NSEC struct target_stat { - unsigned st_dev; + abi_uint st_dev; abi_long st_pad1[3]; /* Reserved for network id */ abi_ulong st_ino; abi_uint st_mode; abi_uint st_nlink; abi_int st_uid; abi_int st_gid; - unsigned st_rdev; + abi_uint st_rdev; abi_long st_pad2[2]; abi_long st_size; abi_long st_pad3; From patchwork Sat Jul 15 13:52:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 703238 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e4d:0:b0:314:25da:8dc4 with SMTP id r13csp158143wrt; Sat, 15 Jul 2023 06:58:12 -0700 (PDT) X-Google-Smtp-Source: APBJJlH+87vBCKxt9z7+VdL1lV0r1CqOoY6M9fcOZWmbzNhOf8fsQqK1Wq5h7OqYKmP5eHwBw7LE X-Received: by 2002:a0c:e153:0:b0:636:435:377a with SMTP id c19-20020a0ce153000000b006360435377amr6746850qvl.16.1689429492720; Sat, 15 Jul 2023 06:58:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689429492; cv=none; d=google.com; s=arc-20160816; b=Qv0ooVaaEtA7yGeBwoQRmDSvpOcnR9cE+UiEgRjin0C6aOdDj5PAAMww6iH1kvqDQD tnaQMDDyg5b9MhgjzmLmOmXmk9UDEGHx4ohexjb8+eXMSIpyLcZ8ercbM+3lEz4EZzTc XIvhS0Zn0gavfa49EuAvqTXzip4/jsDQB/cCkWyFv/8VMew7cDvHWlUjPg5y1VtuiY1E A1R6DfZ8zQfyjxNgNULfZPuMICw4mvZdAK2q32bFO3vQGO2FwyNxvs/oHGJv6dyjgj0P vStoz0bnDzIRhh2eqvl+TFrLwIRe3DoTdF076dAkOJ5ROsraPgaubEdpiKXR6NkON8rL eIpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=TsEvG+VWvCxR8wzqDIyWaXPHqC8uQbp4ZRAeyYSrQhw=; fh=oYAd+8Lj9FKlReeF9hgENQXa3P4LhBP5C4njRBbobDA=; b=YdDyDZ6mxTOfXRhpKBbsAgUMv7QBNw8wgVuvt5cNayoXP4aW+EB7rjopDwjNnHdW3n 0aQVDBBidpXWLTrlfJ0cqKs96oeG9CfvO+p6Z5e9RKrMY1sgf0YcMW5/qCnOlqv3UgHV xG6E+u2zjR3+c0GhUJZTTMC1uQXc5Rlf2YuBOhJAh9+pyhHh3uA8RgqgiRqFpVvHr9mB AphZDw/LDKne4xkCatVWZNQWktdPh0q3jLpOyNrulzqeYeVIybrekHaDmyWpDeRZbTPx wMjFAFKciml0hwac2/aGmt9KfC1Wj50H/P30N/Oo1vcyNQAcSYrC62vG8wEtm3qZVosJ W6Wg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tV8M2B+W; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id s17-20020a0cdc11000000b0062df0e6d4a1si5787224qvk.295.2023.07.15.06.58.12 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 15 Jul 2023 06:58:12 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tV8M2B+W; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qKfiy-0004Wf-JT; Sat, 15 Jul 2023 09:54:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qKfiI-00042c-Am for qemu-devel@nongnu.org; Sat, 15 Jul 2023 09:53:34 -0400 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qKfiG-0001Fk-Ju for qemu-devel@nongnu.org; Sat, 15 Jul 2023 09:53:34 -0400 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-3fbab0d0b88so24926785e9.0 for ; Sat, 15 Jul 2023 06:53:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689429211; x=1692021211; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=TsEvG+VWvCxR8wzqDIyWaXPHqC8uQbp4ZRAeyYSrQhw=; b=tV8M2B+W4xFNbzX44m/SvtOMztiCdlRnMo2tzSASbOteqG4sfJXnKK+gQnJqNDRheE l0kQLlcytPnXM4zYl22Gp4yEjTmeox3O1/sKPGuq1Z8I60y84oIGfMRaNnesiIW3kNUW cmr8QeoCVMPEjYlo/tPgVr/j6wUy0la4onLdoLCkwhezdBovU57LuibA8JKbf7K8P1zS lchbZKhrMfbKAKgFiqMZwEvD5fiufaY/zItMaDsY6dn09nUnI9bPKLmyuqXzJ3sS3Y06 f9pTHPdkwnV6npQdu05qilIjSVGWxuGBXGNNYF4xmn3HrIujGcF8g8D1tU+B0m858B3g eNbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689429211; x=1692021211; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=TsEvG+VWvCxR8wzqDIyWaXPHqC8uQbp4ZRAeyYSrQhw=; b=M3Ej1zwTOw7Cth5FZqrICrvxF6pHqMuxEJWMqTLlLavnCBBr0uUiT8/2HIa1uQvZFG 2f9TDS8cH2+1IUKI7B337U2D/cFgjPpLvxNIxDNGmefbH20YsNsKhmMZTi4NmCvC2acv UEo6gw9DFBggbjDDO7dkMBqeFtvPJix+kDkMjZzUU2llxDHkR0gYMBWKR/LvjePxvFc/ zHz5EHS9FEJfeXhpoDog9we21uRDua9XkFVIyfG+pFYBJqBc/E11G/JjYICmnav/63Ug eZ8Foq0qZI2e7NTdt4pA0p6BVtAbhQ2GgcGkG/RluPp15c3TjXW5m+vShCeyf1orGESS 5y3Q== X-Gm-Message-State: ABy/qLaEF6hWvXeFfFcirYUgOIFQWZR3x0rbqiJ5OsoD42+PNKP99HO9 33n710DtqmEF1EQoK8waeCX60hs9fUwfG3nVmDjsnw== X-Received: by 2002:a05:600c:20c:b0:3fb:416d:7324 with SMTP id 12-20020a05600c020c00b003fb416d7324mr4789756wmi.6.1689429210984; Sat, 15 Jul 2023 06:53:30 -0700 (PDT) Received: from stoup.lan ([51.219.12.49]) by smtp.gmail.com with ESMTPSA id k10-20020a5d66ca000000b00313f9085119sm13838014wrw.113.2023.07.15.06.53.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Jul 2023 06:53:30 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 14/47] include/exec/user: Set ABI_LLONG_ALIGNMENT to 4 for microblaze Date: Sat, 15 Jul 2023 14:52:44 +0100 Message-Id: <20230715135317.7219-15-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230715135317.7219-1-richard.henderson@linaro.org> References: <20230715135317.7219-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x335.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Based on gcc's microblaze.h setting BIGGEST_ALIGNMENT to 32 bits. Signed-off-by: Richard Henderson --- include/exec/user/abitypes.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/exec/user/abitypes.h b/include/exec/user/abitypes.h index 743b8bb9ea..beba0a48c7 100644 --- a/include/exec/user/abitypes.h +++ b/include/exec/user/abitypes.h @@ -15,7 +15,9 @@ #define ABI_LLONG_ALIGNMENT 2 #endif -#if (defined(TARGET_I386) && !defined(TARGET_X86_64)) || defined(TARGET_SH4) +#if (defined(TARGET_I386) && !defined(TARGET_X86_64)) \ + || defined(TARGET_SH4) \ + || defined(TARGET_MICROBLAZE) #define ABI_LLONG_ALIGNMENT 4 #endif From patchwork Sat Jul 15 13:52:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 703220 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e4d:0:b0:314:25da:8dc4 with SMTP id r13csp157251wrt; Sat, 15 Jul 2023 06:55:46 -0700 (PDT) X-Google-Smtp-Source: APBJJlGDzyMQE4LNYPomDTIGWG/lEbHU9NLXO4kwMK0dxgmm440hU6pXnxArbCtWx1hOJg0lRFiQ X-Received: by 2002:a05:620a:4113:b0:767:26a4:ab3d with SMTP id j19-20020a05620a411300b0076726a4ab3dmr10421414qko.19.1689429346532; Sat, 15 Jul 2023 06:55:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689429346; cv=none; d=google.com; s=arc-20160816; b=OpbO6ccsOinsq1GfPOPWOE7SMPK58/Rth9x//JNouvpf2NESVu0w9IR/Uh2TYtEF0H iGYbtfWrtS03Oic+y1Skglqnhu6oaUpoR7DCrcafScnKIbRVkC1Tkyq+IdwJdKMIbO8a ZFQvp4smYkuzeU8OYqC/GaeMW5fHBNwIBbmENNDxJxXcHswkhN0vN0sMO3pSpeDbUZ4N cZ3fQAPYMQ5XvbVhxAsZjRCa/+ecTA+j8yMK63L7ru0zLDNe9Lr9gDAxh8LCRjGXTHVB HrvZR9VFuwRU+hPiDaGHQOy75sVaYXSCHs4pBoJvwO6uFKFZLK5dwVyJ9nIkCHBzfudb 32Lw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=HWNck64Rdzbsq9/3XcWJpVmBPzEh5+xH4mb3RyYLiec=; fh=oYAd+8Lj9FKlReeF9hgENQXa3P4LhBP5C4njRBbobDA=; b=PbzjiMaTeqzMg3YAcA2MMsk30iZ0y/m/BmaLYBMZ6hxpGfTdJvb6BINNj8iR/X7U8u mwOmE+R0eAxuoGQNYKoAUcUywmFVaIwqYLxQQvd1vcsgctWUMxvVqIBlHNFZJlRkQZJG N+87NiMdvKLT3U9XZVCgsDIyhAhXfUdTdcXP7j+ZGM+cWxumJUoBr5hvLuCgQvFSbqTM 2P5Fv/N7HLweL7wO8ov2DWd0fSBnn1nQXw9D/9EqPzxNf9qlhdWEXIbkCTasZceEaKK4 AtWCkvc62pQUwV6MX6reEvHTc89UhaqlOSk2e5W9tnUj9gIvZr3C1PTSVK4ourun+het rllQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SO81RTHT; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id j10-20020a37ef0a000000b0076255a93333si5492579qkk.786.2023.07.15.06.55.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 15 Jul 2023 06:55:46 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SO81RTHT; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qKfim-0004DC-QY; Sat, 15 Jul 2023 09:54:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qKfiK-00044H-Oy for qemu-devel@nongnu.org; Sat, 15 Jul 2023 09:53:38 -0400 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qKfiH-0001Fw-6E for qemu-devel@nongnu.org; Sat, 15 Jul 2023 09:53:34 -0400 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-3fbc5d5742bso26494155e9.2 for ; Sat, 15 Jul 2023 06:53:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689429211; x=1692021211; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=HWNck64Rdzbsq9/3XcWJpVmBPzEh5+xH4mb3RyYLiec=; b=SO81RTHTX6hAXnhPXH5hUtz7J2K2eXxMhQ3xDDjgxO9Mdo/H+fkAcA5o9Q7hCLGpnj jjs3xTloO6e54r7HLF/nQKasg8zVgwOqIuZnbJzSHxfdJeBHwmIr4sSB4itTraINYwBW uiZ5vPUOeBeL0YhOj3KciJWmldCSjtnYUvtTXEgMRZwlczmyzMx56f+s+VHIZXL9FzjA A+dvdFxBmwG5Sm0b3b5o17vhAER4W83Qe9kt/TlNoBoFwEyjb0b5f1eMl2oTcJRd8RXG R4l0U7whBVo2qhNw8fuThY5hCI9xAQaJ1dFsVfflR9XPOrnk+UuSyJ1k/tQaQjgiG1td ZGKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689429211; x=1692021211; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HWNck64Rdzbsq9/3XcWJpVmBPzEh5+xH4mb3RyYLiec=; b=eC6Fs8sy7m+CUoPTEmgAAL8GkRcCB8ameAWtYriGBtcnIRpZbO+n2HsOOfzmaKTyr6 Qn00yqq1M8EpPveoHms0vv+obUJJnhKwcqlaWJ9yq66nEhXy/G5JsC1WFXFEMR+1yQlj +kuUhs90psWsWsUMfcHZvzpoIXwgeBDXmMmNedxQgcCQMaWqfK/NwRo43QDRsDRrlOb7 /+Fh4LBVsFhn+BFpsh1VaensY/ZvSdOAsY5PBE3enWMRm6ofeOc5O6NvkAgvbvuvCnrh 4nMRXzK49kgEAft8WWCVMLrFkoro4nRWYH2Q8Qoq5V3G6qfBw6GVl2AilkNbS9WrSM5R 6RgQ== X-Gm-Message-State: ABy/qLZa6yYmSc6pdETIXheCALssHoE6jqidjkTIHSzMuhpJorga42Y5 h6ggAtNRhQbcxXfVD1vu8EREj/rUSMjiiGcjRLyNuQ== X-Received: by 2002:a05:600c:2310:b0:3fa:8fb1:50fe with SMTP id 16-20020a05600c231000b003fa8fb150femr6652640wmo.15.1689429211687; Sat, 15 Jul 2023 06:53:31 -0700 (PDT) Received: from stoup.lan ([51.219.12.49]) by smtp.gmail.com with ESMTPSA id k10-20020a5d66ca000000b00313f9085119sm13838014wrw.113.2023.07.15.06.53.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Jul 2023 06:53:31 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 15/47] include/exec/user: Set ABI_LLONG_ALIGNMENT to 4 for nios2 Date: Sat, 15 Jul 2023 14:52:45 +0100 Message-Id: <20230715135317.7219-16-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230715135317.7219-1-richard.henderson@linaro.org> References: <20230715135317.7219-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32f; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x32f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Based on gcc's nios2.h setting BIGGEST_ALIGNMENT to 32 bits. Signed-off-by: Richard Henderson --- include/exec/user/abitypes.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/exec/user/abitypes.h b/include/exec/user/abitypes.h index beba0a48c7..6191ce9f74 100644 --- a/include/exec/user/abitypes.h +++ b/include/exec/user/abitypes.h @@ -17,7 +17,8 @@ #if (defined(TARGET_I386) && !defined(TARGET_X86_64)) \ || defined(TARGET_SH4) \ - || defined(TARGET_MICROBLAZE) + || defined(TARGET_MICROBLAZE) \ + || defined(TARGET_NIOS2) #define ABI_LLONG_ALIGNMENT 4 #endif From patchwork Sat Jul 15 13:52:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 703219 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e4d:0:b0:314:25da:8dc4 with SMTP id r13csp157219wrt; Sat, 15 Jul 2023 06:55:42 -0700 (PDT) X-Google-Smtp-Source: APBJJlGdvzKgX1aM5bz2Qg+qWV7Cc6RAJ0p9rsNwZR/b1TuumHYrfGDBw+6fw3ZlRLTOZBdyybID X-Received: by 2002:ac8:4e94:0:b0:403:b88d:1e60 with SMTP id 20-20020ac84e94000000b00403b88d1e60mr11444950qtp.51.1689429342041; Sat, 15 Jul 2023 06:55:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689429342; cv=none; d=google.com; s=arc-20160816; b=WevtoMoTm79OCqV8UH7ppxTzeNGf/Bivr+o0psm7OTyjT9kMEcSmfrehGHV2xofWIe sWl6QupozvAJWfC78jggbnTQuy7AZx+Dg7gM3bZo5T2fbu+gNWqbxLVKAOcj6wcaLgYi cMDPRcHTn5STCPPLYYkXklaDm/BtQQRsiAnOtOjG3vUpfQm92oP9FbDFLIQMPANmGx7C S/RRNunGD02MFfcYaqmTAu9kOcjbTlr1Q/cGNsxwXziGDrp766096xZ+n2VCqxTl4baG jEbwv9rxFg3egAAHUYwGdHm3oz8NjKEEdOD/D87B1aOIImju0TEOmPRPGu5ak33w1sCG baOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=WkQYBTdmbAtTnWW2W9s3BK95MSziKUcKtiWY2RX73t0=; fh=4LQkIyJWpiN6k4Osx3jCJvb3DPh7oEN5bIyCYJFinrI=; b=NgV8sqDbxpUMkWC8ddIv7LXFofzohJU+/DqRsNWSPcTWuifVnXUYDRft1NHfVa2peO Sqc5J0oV0AsPKQtTFYVW++R3cJLy8yokuQG69seakMZmZrjKKFa2oHhQtMJSw2bREUSM J3cSjCdljRPFabEGYwYZKsxIjLFlQWeqcc8KR/nfbAb7Gx+Bm94oRaeOtjGsgHmm0fH2 T5A0jxMlPhQz7YANcPvKAtjr27qUFZcU11BbPGh2+/Lg7Pgur08E++On14K5pdjp42j3 4vFedFzZ4LgpDfGUP2JrQzn/1adpIWOgI+LkFgqx8cquQ/GS5eYbXn1s34A5899IZGSu zhGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PptHln31; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id o13-20020a05622a044d00b00403397c9074si5918440qtx.744.2023.07.15.06.55.41 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 15 Jul 2023 06:55:42 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PptHln31; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qKfj3-0004ZL-CE; Sat, 15 Jul 2023 09:54:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qKfiL-00044I-0H for qemu-devel@nongnu.org; Sat, 15 Jul 2023 09:53:38 -0400 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qKfiH-0001GP-RO for qemu-devel@nongnu.org; Sat, 15 Jul 2023 09:53:35 -0400 Received: by mail-wr1-x432.google.com with SMTP id ffacd0b85a97d-307d20548adso2876430f8f.0 for ; Sat, 15 Jul 2023 06:53:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689429212; x=1692021212; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=WkQYBTdmbAtTnWW2W9s3BK95MSziKUcKtiWY2RX73t0=; b=PptHln31sBhZ5BPAO2orRGKH/Od5By8a2EuS+D8d8AfX+pSxoVzQAlxCC/tERMrQ9Y JHcrFyshgkOXoaTEUxiAgK083lrgzCbeGm1uzW8Dzor/MF76OEPzHvSWIsgF7iEGLrH6 eFHInefQd7IBXwoOrBxUeWAEfyUhvaVszrd6mu1HLdh+/9mmh5llMS0nolBNs/Q0TpdJ bTcfegMowBDPU2rAyUSCPw8rm1dCzjkLhYlHRiZguQoctlT1GnOmcKwtpWrp3dvgBWko mrxV0+iGntdjI5QLdEcAl1eltvwFKX4g2hLkvTUYzmwAJMpKhTYwNS6GvE9BTeS4XnbB Rtbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689429212; x=1692021212; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WkQYBTdmbAtTnWW2W9s3BK95MSziKUcKtiWY2RX73t0=; b=Und6NmTJb/rpToM5neOwtP6TEC6g9u1rQRTPAM8BfDQ3yDm2/vYL+LiG8fPLV6VBrx kOFazekyVdMbEB7v+5/6q3UD8UeIwqIKp9rhH9OHBuCsx/h1OdSFW2+J5FYJmwPyvQkm lf4EZnUz0cII9a26XGKeNRkeL4AAyCh8geZbKGqll/y6DX358FdczHkQKcaBmyVHVP6W xmbFBSRZASG5IhWHfKlcWbTJY55UXglp0OZGUkWRzoTNZuvBwErphPWOWBZcFWienGM6 TLwFLLXDht/fUrnVxQmPIVcqMWstXkGwMNQbRw4l7x4L92Ifvf/3aPwCCdonUxarU9lb UGzQ== X-Gm-Message-State: ABy/qLbnB/9FinpdCpX0hU/PF5/aMm0YUZ4qWJyCLVjYn3BZcKcLYiqa SPjfID11PNCdbYDv8h1fGlfydVtofE+/UhL4OYCyDQ== X-Received: by 2002:a5d:4b10:0:b0:314:1ddc:ecbd with SMTP id v16-20020a5d4b10000000b003141ddcecbdmr6019130wrq.18.1689429212471; Sat, 15 Jul 2023 06:53:32 -0700 (PDT) Received: from stoup.lan ([51.219.12.49]) by smtp.gmail.com with ESMTPSA id k10-20020a5d66ca000000b00313f9085119sm13838014wrw.113.2023.07.15.06.53.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Jul 2023 06:53:32 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Pierrick Bouvier , Michael Tokarev Subject: [PULL 16/47] linux-user/syscall: Implement execve without execveat Date: Sat, 15 Jul 2023 14:52:46 +0100 Message-Id: <20230715135317.7219-17-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230715135317.7219-1-richard.henderson@linaro.org> References: <20230715135317.7219-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::432; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x432.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Pierrick Bouvier Support for execveat syscall was implemented in 55bbe4 and is available since QEMU 8.0.0. It relies on host execveat, which is widely available on most of Linux kernels today. However, this change breaks qemu-user self emulation, if "host" qemu version is less than 8.0.0. Indeed, it does not implement yet execveat. This strange use case happens with most of distribution today having binfmt support. With a concrete failing example: $ qemu-x86_64-7.2 qemu-x86_64-8.0 /bin/bash -c /bin/ls /bin/bash: line 1: /bin/ls: Function not implemented -> not implemented means execve returned ENOSYS qemu-user-static 7.2 and 8.0 can be conveniently grabbed from debian packages qemu-user-static* [1]. One usage of this is running wine-arm64 from linux-x64 (details [2]). This is by updating qemu embedded in docker image that we ran into this issue. The solution to update host qemu is not always possible. Either it's complicated or ask you to recompile it, or simply is not accessible (GitLab CI, GitHub Actions). Thus, it could be worth to implement execve without relying on execveat, which is the goal of this patch. This patch was tested with example presented in this commit message. [1] http://ftp.us.debian.org/debian/pool/main/q/qemu/ [1] https://www.linaro.org/blog/emulate-windows-on-arm/ Signed-off-by: Pierrick Bouvier Reviewed-by: Richard Henderson Reviewed-by: Michael Tokarev Message-Id: <20230705121023.973284-1-pierrick.bouvier@linaro.org> Signed-off-by: Richard Henderson --- linux-user/syscall.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 420bab7c68..c15d9ad743 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -659,6 +659,7 @@ safe_syscall4(pid_t, wait4, pid_t, pid, int *, status, int, options, \ #endif safe_syscall5(int, waitid, idtype_t, idtype, id_t, id, siginfo_t *, infop, \ int, options, struct rusage *, rusage) +safe_syscall3(int, execve, const char *, filename, char **, argv, char **, envp) safe_syscall5(int, execveat, int, dirfd, const char *, filename, char **, argv, char **, envp, int, flags) #if defined(TARGET_NR_select) || defined(TARGET_NR__newselect) || \ @@ -8629,9 +8630,9 @@ ssize_t do_guest_readlink(const char *pathname, char *buf, size_t bufsiz) return ret; } -static int do_execveat(CPUArchState *cpu_env, int dirfd, - abi_long pathname, abi_long guest_argp, - abi_long guest_envp, int flags) +static int do_execv(CPUArchState *cpu_env, int dirfd, + abi_long pathname, abi_long guest_argp, + abi_long guest_envp, int flags, bool is_execveat) { int ret; char **argp, **envp; @@ -8710,11 +8711,14 @@ static int do_execveat(CPUArchState *cpu_env, int dirfd, goto execve_efault; } + const char *exe = p; if (is_proc_myself(p, "exe")) { - ret = get_errno(safe_execveat(dirfd, exec_path, argp, envp, flags)); - } else { - ret = get_errno(safe_execveat(dirfd, p, argp, envp, flags)); + exe = exec_path; } + ret = is_execveat + ? safe_execveat(dirfd, exe, argp, envp, flags) + : safe_execve(exe, argp, envp); + ret = get_errno(ret); unlock_user(p, pathname, 0); @@ -9406,9 +9410,9 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1, return ret; #endif case TARGET_NR_execveat: - return do_execveat(cpu_env, arg1, arg2, arg3, arg4, arg5); + return do_execv(cpu_env, arg1, arg2, arg3, arg4, arg5, true); case TARGET_NR_execve: - return do_execveat(cpu_env, AT_FDCWD, arg1, arg2, arg3, 0); + return do_execv(cpu_env, AT_FDCWD, arg1, arg2, arg3, 0, false); case TARGET_NR_chdir: if (!(p = lock_user_string(arg1))) return -TARGET_EFAULT; From patchwork Sat Jul 15 13:52:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 703230 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e4d:0:b0:314:25da:8dc4 with SMTP id r13csp157616wrt; Sat, 15 Jul 2023 06:56:47 -0700 (PDT) X-Google-Smtp-Source: APBJJlF+ekxIzgFjS03XwJm33XENAWSVPcENk3onhMHKag+13VRLDADIZKi/RwJIbHVwjqNDskQ+ X-Received: by 2002:a05:622a:1647:b0:403:2966:8fc8 with SMTP id y7-20020a05622a164700b0040329668fc8mr8986100qtj.2.1689429407112; Sat, 15 Jul 2023 06:56:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689429407; cv=none; d=google.com; s=arc-20160816; b=I/CEAvMtnU/vPe+4uRk62W4VrcEXeH/COV5q4fxup9pQ18a2nTNcxRWhR0v+jBFSmx KYHK4KNFS6bacwydV+wszIR/D8TaN/XYnZMGVUv0fw63akGYwZrFxXgehGtmQiS7Wzzq N9e4JFtXtLR6E8d2yjx1J3I2+hg8gmz2B5spOO4KP85QtLQTl5d3HLqzvh8/Gk0a1Kio SlztdbHZsV2Ikvz/104jb+1m1R72W04EHuYH/LG8xB/vUyyHA8n3HhqRE+LLaFRSmbYO leouFG5UbJA/ZubMv8wjYApXxJT9sl4+Hx/86rNHqClQOE8dliyg2xT7sEYHT1vpwOfs 6ZAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Lr74WqM5fLrf+RSkbW96g9irEI/4kt9CeJO9GueF4Ho=; fh=UZ+eQQAF3T+z3+fFt8++ZIKkuAqX+VverPSwAmJxzX0=; b=BAkBY90esUXJWIWia+x8WHGesklB0qoPKJSTamHm31kGPdWRHQRfYJK9YuLLKMQWn/ RX+e3HEdU9SrwelMGqbgaFkn8XjvwPnS+hEf/kGkuNQviS4P75fIzn4t3gFl0k1CZG0E Rbtm3pblPSKd/1sDNv8PFkECjCqLhpmnR7OHH3XtaJ2bkyebjAb+IuKzCdSGXy/nIXD0 MSvsRWT5M8t0KKk5edCo1wDWt8POLBxw5f6/cWfcU4b1ANAwIn7F3gsGdJU8zcDgOPgk GjesT80LG/OkA5AQV4QMy1rpOG+YyB0dOP+9KU5P0SEw0P+Xh3qwSJBnC8Tu6VcHGXWE 6T+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ytlbjaV9; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id p19-20020a05622a13d300b0040349c011cfsi5801031qtk.259.2023.07.15.06.56.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 15 Jul 2023 06:56:47 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ytlbjaV9; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qKfiy-0004WR-Af; Sat, 15 Jul 2023 09:54:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qKfiM-00044R-6h for qemu-devel@nongnu.org; Sat, 15 Jul 2023 09:53:38 -0400 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qKfiK-0001Gh-7b for qemu-devel@nongnu.org; Sat, 15 Jul 2023 09:53:37 -0400 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-3fbdfda88f4so25771915e9.1 for ; Sat, 15 Jul 2023 06:53:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689429213; x=1692021213; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Lr74WqM5fLrf+RSkbW96g9irEI/4kt9CeJO9GueF4Ho=; b=ytlbjaV9E9M79C03Q8T2CryOSi0CnEjt6brGkPXctqR7npFgD/ETR5dkvURNFI9G7E 0BWGsGJEAPPGzAQnMCYZ4Y1avwTQnks0xP8h3oME8LAH1WYEaSjO/gEpVnyYlUQsew4k j3b7gjmgjoDt/VyufSO5HiFlJetww1cGAI50rbiR/BCTzXB81IzJZ7fYxDfDcqT4URBc s56jY2c0+IGXOlwnDsFXIboj+0cU8SHO8YsK8fhefUQan5Eaenl5xKF93T5/c1KZTBv9 qM3yRYGSOFS+gUf83zL7KUTpbGLR3V9dqDBGnbUTMt3KSPeDxW27JNxVRkN+tfIK4rfG GvhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689429213; x=1692021213; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Lr74WqM5fLrf+RSkbW96g9irEI/4kt9CeJO9GueF4Ho=; b=hvnAMUw0r4zS1UCBbqH4rGPChB9kkjoNrSm/v3+KStTChzZRrQDrquDpuEjnK73sTV vwGsRRSY15dTuzj1EinwfXlGu3YAqZBDB2Va0YvBExOqQw7WHagcWE4j7SjVsH8TFV+U +Z6/vZdLIYjd54KUNcE/UjCk/6xWV2tLy3R18SYKbDNJpFkO/LDi8yh9zDCBXvsxdUXZ cnhf+IYRe6eYapo07qanM5wNO8C4gvOylzPADkRLe39k4zi4tWuwZo4CWB7+pwLgX1Df 8749pMwtmnaOlQLD2U8syTFkoPf6F6i24LPGbKUOr0CHN2iGAqJy9LJrxybnQyBfT4cP P3ow== X-Gm-Message-State: ABy/qLblOn/9jjiCSVj87SUDfNqfOTOIozmud6QHb3x8WFGbD0QDrYgt t7n+HEvX8+Kvexu6iBAMsxNFVs/NO4fQ83I/oYciBg== X-Received: by 2002:a05:6000:c4:b0:314:e929:bcb9 with SMTP id q4-20020a05600000c400b00314e929bcb9mr6528191wrx.57.1689429213604; Sat, 15 Jul 2023 06:53:33 -0700 (PDT) Received: from stoup.lan ([51.219.12.49]) by smtp.gmail.com with ESMTPSA id k10-20020a5d66ca000000b00313f9085119sm13838014wrw.113.2023.07.15.06.53.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Jul 2023 06:53:33 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Anton Johansson Subject: [PULL 17/47] linux-user: Fix do_shmat type errors Date: Sat, 15 Jul 2023 14:52:47 +0100 Message-Id: <20230715135317.7219-18-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230715135317.7219-1-richard.henderson@linaro.org> References: <20230715135317.7219-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32e; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x32e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org The guest address, raddr, should be unsigned, aka abi_ulong. The host addresses should be cast via *intptr_t not long. Drop the inline and fix two other whitespace issues. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Anton Johansson Message-Id: <20230626140250.69572-1-richard.henderson@linaro.org> --- linux-user/syscall.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index c15d9ad743..b78eb686d8 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -4539,14 +4539,14 @@ static inline abi_ulong target_shmlba(CPUArchState *cpu_env) } #endif -static inline abi_ulong do_shmat(CPUArchState *cpu_env, - int shmid, abi_ulong shmaddr, int shmflg) +static abi_ulong do_shmat(CPUArchState *cpu_env, int shmid, + abi_ulong shmaddr, int shmflg) { CPUState *cpu = env_cpu(cpu_env); - abi_long raddr; + abi_ulong raddr; void *host_raddr; struct shmid_ds shm_info; - int i,ret; + int i, ret; abi_ulong shmlba; /* shmat pointers are always untagged */ @@ -4602,9 +4602,9 @@ static inline abi_ulong do_shmat(CPUArchState *cpu_env, if (host_raddr == (void *)-1) { mmap_unlock(); - return get_errno((long)host_raddr); + return get_errno((intptr_t)host_raddr); } - raddr=h2g((unsigned long)host_raddr); + raddr = h2g((uintptr_t)host_raddr); page_set_flags(raddr, raddr + shm_info.shm_segsz - 1, PAGE_VALID | PAGE_RESET | PAGE_READ | @@ -4621,7 +4621,6 @@ static inline abi_ulong do_shmat(CPUArchState *cpu_env, mmap_unlock(); return raddr; - } static inline abi_long do_shmdt(abi_ulong shmaddr) From patchwork Sat Jul 15 13:52:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 703232 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e4d:0:b0:314:25da:8dc4 with SMTP id r13csp157710wrt; Sat, 15 Jul 2023 06:57:01 -0700 (PDT) X-Google-Smtp-Source: APBJJlECtbIoMBhaGJm/ajG07r4O1DkInd1RNpO0UqgAj3uDj9tFqGf0qeNarPXHm0YoUKz93aDx X-Received: by 2002:ac8:5c92:0:b0:403:a808:2f50 with SMTP id r18-20020ac85c92000000b00403a8082f50mr8232629qta.31.1689429421587; Sat, 15 Jul 2023 06:57:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689429421; cv=none; d=google.com; s=arc-20160816; b=ThjlkhJ9xwxBPfNiv7R1PVENir8UtJWG4UwpRuoyahIKmKutqI8LVEvEiIFPNHzI1V /Tb1V3twVbbufJchjC4BeK14BbGMH6ODDudwdhr90g+firoFQ5fcKsUevMkPtDLLGNnE Tcm7Wn7uyHgC3pexl0syHvL14THrmNGXwzhNnLWln/FuqfmgHgfwBBI/FWBC2LTwCLTW F9rsBCmve//QkTPAnr2v35A/w2GsB90KXG/ptkSlCTnkBmCWsU4+E8Z/LksoVRfniSYl 6LlTH0VxxS6s5qpaCDRYOFzvpKrOTVo3maZWEc5KQwR58gEBXZmWbusikriZm5kOhwQa IIjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=KPSt9c/ngpAMvKxksu2NUPKStpNSLJ8TjY6ZtwR8h/Q=; fh=1Ld5JXWWMVhI493r8gVAwNahLwugINmk0SiqRP6Iy3A=; b=QMeUfK4KPk3f0Qsn/L2FqrCYRxqYFZVNSnx5EZWngzk9xfHPYBj+rj8dNxP9r/lGre DXnp85yZnbrZiB00nIcrK+FlpOs4l/FIQ6pYctzVGBeBx8mvk/gzJ8qA5fFnSHxksvws wq+EDfOUoWJT34DvaBr2meo8AakIN8/wEWUr2+CdrFLnsnsRzT47w2I0eGgN0AErx3+9 VYYRMLyYdxSg1ozZ972XoKRyYPppK1eD/T/r29oKM4L6vuz0f2qbzIfJ2lml/nFkCO5k AGN2QePT/ovvqRgGjw3NruT3QQowOGJfokPO37Z36lNEHp7+k1Yny08z5ZFkkxcTb0ii oyAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SXRp5ip1; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id k5-20020ac85fc5000000b003ef3d74694esi5908043qta.34.2023.07.15.06.57.01 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 15 Jul 2023 06:57:01 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SXRp5ip1; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qKfjd-0006Rz-V8; Sat, 15 Jul 2023 09:54:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qKfiN-00045M-I6 for qemu-devel@nongnu.org; Sat, 15 Jul 2023 09:53:40 -0400 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qKfiK-0001Gs-Pa for qemu-devel@nongnu.org; Sat, 15 Jul 2023 09:53:39 -0400 Received: by mail-wr1-x431.google.com with SMTP id ffacd0b85a97d-3094910b150so3067963f8f.0 for ; Sat, 15 Jul 2023 06:53:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689429214; x=1692021214; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=KPSt9c/ngpAMvKxksu2NUPKStpNSLJ8TjY6ZtwR8h/Q=; b=SXRp5ip1qgGnb2AYrM50ZLVsfXoYjtYlbeA+FLdZB1Ek9gWdhuvoxpDD4lqY5GOM7S jx8qVgun/qW1/hEIGWK45CtgUNymy8iOEypJFydySVeSyvlOv6gzgmp+pg1LtpyfZu0T 8hnX09zPnGMpcKvS9U5wua/VnhOX6nxRvH6CiYcbYXObxyLhifvnR+hNHFZ0MIUtav3/ k9HXxQRSVNflrTh3dVfGBmkbOB6xDQTqBNGMH7SXBc8m7BWBF1oLpU+P+bbmI/hc8adw LU18hEp5f4j/dPcw6lo+VE1NEXQVYs+xJQNoMDlVRJChEwkZ4xEBV6St/UxitPtUvu7t FvWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689429214; x=1692021214; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KPSt9c/ngpAMvKxksu2NUPKStpNSLJ8TjY6ZtwR8h/Q=; b=O9Bk8lw/piKM9pTL9iHW2NZgB9hv0PD5hFH9bDRSMBwvN0nrttwz/DYtsNtPjm+uCR i8gsF76st+bOr5Qd8mI5+tIiwhnRct26QOji0uVsDH0721EqLGiyfx3AxOBAbxbtYtav Y/MWbli7pbgmbw44ojusCZeX0JBaRAwmKIPq5gay66bJvFl13bBn+bVf5sVBeHWWC+g4 ZOBlSgktJ7el76D/x1TRbDtz320wHw/gQswdMYIDlpdZvj/eyO12GJIb11iMYq2kB00p Ul4qc/y+p7RK+5ixxyvnQDaPH+uHqU8vTN2NaITumRGhuyjJn3bbqgL1VZxi+5A6vSqm 7oSQ== X-Gm-Message-State: ABy/qLbV7gFYSEK935SC7qG+tQNWOtYcFx2hJnMZfsPDiQl5gdP8M8uj 0je2aAZ1da0MnR7rBvgOu9y7tFKrECxnlrh5rtlnOQ== X-Received: by 2002:a5d:4bd1:0:b0:315:a74c:f627 with SMTP id l17-20020a5d4bd1000000b00315a74cf627mr6938552wrt.16.1689429214383; Sat, 15 Jul 2023 06:53:34 -0700 (PDT) Received: from stoup.lan ([51.219.12.49]) by smtp.gmail.com with ESMTPSA id k10-20020a5d66ca000000b00313f9085119sm13838014wrw.113.2023.07.15.06.53.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Jul 2023 06:53:33 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Philipp?= =?utf-8?q?e_Mathieu-Daud=C3=A9?= , "Richard W . M . Jones" Subject: [PULL 18/47] accel/tcg: Split out cpu_exec_longjmp_cleanup Date: Sat, 15 Jul 2023 14:52:48 +0100 Message-Id: <20230715135317.7219-19-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230715135317.7219-1-richard.henderson@linaro.org> References: <20230715135317.7219-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::431; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x431.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Share the setjmp cleanup between cpu_exec_step_atomic and cpu_exec_setjmp. Reviewed-by: Alex Bennée Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Richard W.M. Jones Signed-off-by: Richard Henderson --- accel/tcg/cpu-exec.c | 43 +++++++++++++++++++------------------------ 1 file changed, 19 insertions(+), 24 deletions(-) diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index ba1890a373..31aa320513 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -526,6 +526,23 @@ static void cpu_exec_exit(CPUState *cpu) } } +static void cpu_exec_longjmp_cleanup(CPUState *cpu) +{ + /* Non-buggy compilers preserve this; assert the correct value. */ + g_assert(cpu == current_cpu); + +#ifdef CONFIG_USER_ONLY + clear_helper_retaddr(); + if (have_mmap_lock()) { + mmap_unlock(); + } +#endif + if (qemu_mutex_iothread_locked()) { + qemu_mutex_unlock_iothread(); + } + assert_no_pages_locked(); +} + void cpu_exec_step_atomic(CPUState *cpu) { CPUArchState *env = cpu->env_ptr; @@ -568,16 +585,7 @@ void cpu_exec_step_atomic(CPUState *cpu) cpu_tb_exec(cpu, tb, &tb_exit); cpu_exec_exit(cpu); } else { -#ifdef CONFIG_USER_ONLY - clear_helper_retaddr(); - if (have_mmap_lock()) { - mmap_unlock(); - } -#endif - if (qemu_mutex_iothread_locked()) { - qemu_mutex_unlock_iothread(); - } - assert_no_pages_locked(); + cpu_exec_longjmp_cleanup(cpu); } /* @@ -1023,20 +1031,7 @@ static int cpu_exec_setjmp(CPUState *cpu, SyncClocks *sc) { /* Prepare setjmp context for exception handling. */ if (unlikely(sigsetjmp(cpu->jmp_env, 0) != 0)) { - /* Non-buggy compilers preserve this; assert the correct value. */ - g_assert(cpu == current_cpu); - -#ifdef CONFIG_USER_ONLY - clear_helper_retaddr(); - if (have_mmap_lock()) { - mmap_unlock(); - } -#endif - if (qemu_mutex_iothread_locked()) { - qemu_mutex_unlock_iothread(); - } - - assert_no_pages_locked(); + cpu_exec_longjmp_cleanup(cpu); } return cpu_exec_loop(cpu, sc); From patchwork Sat Jul 15 13:52:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 703231 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e4d:0:b0:314:25da:8dc4 with SMTP id r13csp157647wrt; Sat, 15 Jul 2023 06:56:50 -0700 (PDT) X-Google-Smtp-Source: APBJJlHxkc/Aj2qg0I+Nj/EMhMzmBkZQqvEhD7DtEN+wYyAW5cbXLhP6GbXx91xJTFE4RJeP9mVJ X-Received: by 2002:ac8:59c4:0:b0:403:9a00:2edb with SMTP id f4-20020ac859c4000000b004039a002edbmr10129742qtf.47.1689429409887; Sat, 15 Jul 2023 06:56:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689429409; cv=none; d=google.com; s=arc-20160816; b=wkVlsGZj71ZHbmaUhUYHlfRyLvW+FLUy9mqnU6RB7bhNobdK7kHwmhZTnufdVBAcJH SAr90ZzhRsZzXDXWDiFStXWPTTzChzCBChWeLOaOVfYQWNiiFshXF3GWA3eAmEqXQN3C XTjdsJGsMBMzRvp2Wj/LQhqG36FG+ULrJdiuqdL5DlbOoqSO5pGjygma7WSJpVvOI1Pd A/cUqdfmgNsXdA9Rtu1needactCOB13MNwZlJSOcBqjexRVxG6K1vMTW1kaUGuDEPEnI JBzX7OMpg54rrrONZJ7xJR4orE3ltagb8JZ8lg255mqbnZEzV7xrQEfhT2OC2gbe/ZGZ DTrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=jzyDMcbYQjI8gvZN9VCzZxgmLv/k9AezEb13MRPeL3k=; fh=mAPHO5VzBjR9OURwpC+NZR+4x+NBl0VD/Lm/8apGT4I=; b=ILDnL6F/uzCIIbM5OtbZcvTqFjuZQXD3v8Nk2zeFczqLyZLzx45ZYTD851Tl813n6F IE2Rrl7BR+jneglJpfwljfMrhpOhaq1MT1EobZBGGSDH3TuvUbEXoSsu8cHB6gRwfWVx FVmqN/ssvWjAwY4qVZ5z4PBcVmEUmtu5lE3CXSN1Qe9m+Dg5l7l1I66jkfV2dmpQnV2Y yIGZRJA+GF9KV8gktQHCmcakNcFDtjhVn0+F446aWLcv5c7X6YDnV7J5hxHTrlQFVNK1 ouIIka5Hg5cDzedfCmsfetCoHXaZRbenzIXjQ1iy0ofj4boXM5Qtrqotqi8dKjR7KrYO DxbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Fmcyln+Z; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id f13-20020ac87f0d000000b00403b0f5c273si5752330qtk.696.2023.07.15.06.56.49 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 15 Jul 2023 06:56:49 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Fmcyln+Z; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qKfj1-0004YD-5C; Sat, 15 Jul 2023 09:54:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qKfiM-00045E-Rc for qemu-devel@nongnu.org; Sat, 15 Jul 2023 09:53:40 -0400 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qKfiK-0001H1-Pb for qemu-devel@nongnu.org; Sat, 15 Jul 2023 09:53:38 -0400 Received: by mail-wr1-x42b.google.com with SMTP id ffacd0b85a97d-316eabffaa6so2378501f8f.2 for ; Sat, 15 Jul 2023 06:53:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689429215; x=1692021215; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=jzyDMcbYQjI8gvZN9VCzZxgmLv/k9AezEb13MRPeL3k=; b=Fmcyln+ZV6z4yTSqqk0nZ7i+ji8JuvQzRcnLaGEtGvk/z3R0xhffEqwITyGBGBrGp2 ESFPM5Zpa3YnysJTGviEBXgxKrQlbDTXAslXvxqlLrNt7lmFObAw/8YBTwkK+q+Rvi8K Mvb9sfCMGu64gdr1oztj+UEfiQOiNZKzdzq7wIkwr903ZYdjR3V80QROK4EvdquXm+pf vZ77EPB0qJ4DKvQ53TrjaJ18wGXad3mA6Hb1KWX8gFkoZj+7FXbLWczKipfK9gP8gZIO yKMbVBNlahgVli9IeuHaoY4mTUfu98olmxh9zmnAUR3fP1It9lPpnEWtJhqoDA9jYS28 rXrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689429215; x=1692021215; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jzyDMcbYQjI8gvZN9VCzZxgmLv/k9AezEb13MRPeL3k=; b=k7Ub6rFEJHGVVLSWT407oYggR+xrjeNC09KFPj4cWy6Pm80Xvw2zz12okbdP3GDeBS 9dBR181tRfrGU22kNqSjzHuJhzaVkgIrtKxvp2nPlt15oDw8/++RYoBAV6HD8q+1FtO3 vc+umLe+QOXfRXsiqBCs6u5BQQ9nVZJFAXK0CjapAqMhvkmUvJ4PlkViMUTDVReo6wOH u2igKHcSKsfk2L5j81vNv+BGT0V2bsFDohMQ/XKYMJ4trE9WE7Br9BDPa8chdcXjVrtU pHy871pvZGJIFORsCLdO9NGQvKhje6u5RvvM1w0v/fYakmwv5+nQZ3h//2zAdje0wBhE 18wg== X-Gm-Message-State: ABy/qLYX03GQjWUAt4BvzvPmfXrZ5tSyk3o+mMHVhvpRq4l92o6eVKs7 i1NEtAkoq4eVb/RSPIU4oY8PYqjqWckTpRINbeF/1g== X-Received: by 2002:a5d:4d02:0:b0:314:17cc:31d0 with SMTP id z2-20020a5d4d02000000b0031417cc31d0mr5713624wrt.34.1689429215149; Sat, 15 Jul 2023 06:53:35 -0700 (PDT) Received: from stoup.lan ([51.219.12.49]) by smtp.gmail.com with ESMTPSA id k10-20020a5d66ca000000b00313f9085119sm13838014wrw.113.2023.07.15.06.53.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Jul 2023 06:53:34 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-stable@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Peter Maydell Subject: [PULL 19/47] tcg: Fix info_in_idx increment in layout_arg_by_ref Date: Sat, 15 Jul 2023 14:52:49 +0100 Message-Id: <20230715135317.7219-20-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230715135317.7219-1-richard.henderson@linaro.org> References: <20230715135317.7219-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42b; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x42b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Off by one error, failing to take into account that layout_arg_1 already incremented info_in_idx for the first piece. We only need care for the n-1 TCG_CALL_ARG_BY_REF_N pieces here. Cc: qemu-stable@nongnu.org Fixes: 313bdea84d2 ("tcg: Add TCG_CALL_{RET,ARG}_BY_REF") Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1751 Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Tested-by: Peter Maydell --- tcg/tcg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tcg/tcg.c b/tcg/tcg.c index a0628fe424..652e8ea6b9 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -1083,7 +1083,7 @@ static void layout_arg_by_ref(TCGCumulativeArgs *cum, TCGHelperInfo *info) .ref_slot = cum->ref_slot + i, }; } - cum->info_in_idx += n; + cum->info_in_idx += n - 1; /* i=0 accounted for in layout_arg_1 */ cum->ref_slot += n; } From patchwork Sat Jul 15 13:52:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 703223 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e4d:0:b0:314:25da:8dc4 with SMTP id r13csp157301wrt; Sat, 15 Jul 2023 06:55:58 -0700 (PDT) X-Google-Smtp-Source: APBJJlFsVdBkUxic85KRXST2VFp9Y7hIQtX8RyvItFh+6bCv7M8P+gzRnG1yE6hlowwH0cRiQIMK X-Received: by 2002:a05:620a:2237:b0:767:205b:7f4b with SMTP id n23-20020a05620a223700b00767205b7f4bmr5918863qkh.41.1689429357972; Sat, 15 Jul 2023 06:55:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689429357; cv=none; d=google.com; s=arc-20160816; b=k0mIsw4Zzd6Li2p8+CUuNw7PdDGnAc+gsDhUNA11FLC7wK39MTNeRND9KJr7sq7HPb VJCoNqUj161NHocLNkLtfWqDakoPcT6bCOMA1OWJUXILlLIfPCAAmtIXk/3a5Xc/o5yp psR5KvZgtwfl/OUdQbYV4+dMUTGyv42xKvrbr4zMST2iRwxhu3i5nvCLD5TGAKFs3cGb YOsVzW8b/ZDDtves8HHshFoDGLxoyzDrPusWK08J8AFkdDHGDiT5Y+iyrDVYlSlszNtL 8cWWF2iAZvD3ZUB0lJePl4stgPRRLpaqWjkJkgYspxUCgPFX3xyqoD9+PrGfU2/QnsZ3 ITOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=GYIDC6C9sVxFY0DlBpogq7e8qtq1Fq4gc1frrPqq0IQ=; fh=QUXSShV/V/Dw9iY34phh7SXooQbch9h9OBWS0wJsjSs=; b=bAyUtsP9yBZDhZfl4ppL9DCuTXvY+4m4rhfBd1qmyTpCbDrJ5X505ohkMz/Rt0pPoI sEtnYk+2WvwZsWjyOaDJFUZ5wjuNkw4CcyILi9dz1IZFns2qfz1KNKvoG05QZl5BRu1x INhTXIQnO9GVm7GOA3H96S7PcJn1+yd2JIi81LgAT7tJ7H4RyeWgrXShH3SYAhWkSRSw 2Q4wtMJQ6PhCqrPJ5NGsOs5ku7FNR6DuhfAxKKN4AmPh1jKB66Kzv2/dWcXK8ah2DBJQ 7wrmOY59Gi+LAdTi9BDANBtcoqpNpix8ynEVx3B2sTtI9U+F/4yjsLSmrFf1Am9cIDbi mUXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Z5jQet2d; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id h16-20020a05620a401000b00767eafe9cc0si4907890qko.418.2023.07.15.06.55.57 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 15 Jul 2023 06:55:57 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Z5jQet2d; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qKfiy-0004WW-Cd; Sat, 15 Jul 2023 09:54:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qKfiN-00045L-Hh for qemu-devel@nongnu.org; Sat, 15 Jul 2023 09:53:40 -0400 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qKfiL-0001HN-BR for qemu-devel@nongnu.org; Sat, 15 Jul 2023 09:53:39 -0400 Received: by mail-wr1-x42d.google.com with SMTP id ffacd0b85a97d-3144bf65ce9so2840237f8f.3 for ; Sat, 15 Jul 2023 06:53:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689429216; x=1692021216; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=GYIDC6C9sVxFY0DlBpogq7e8qtq1Fq4gc1frrPqq0IQ=; b=Z5jQet2dyrtANj7hJTmkFGdhPyQZoOehgxlVV/uUMWSl0IAY7v7/nvSOCnkt7AUtFg pQjwEwYkWl5jYH9mZRvRRkkuSybkJqS25mR+YMg8NNNYHVKc20SQvkkkvy1J5yqJCf7A yJy1ZEaF0MxCxEur+2tzo/cCrHEyrrnmUFk4gaM5lZ+wGyNcnakWryHps+r5CB/8K8zn AB7bONfe+GJyzFZZgye7acg7s8GdZjs+vaNKa3Z/v5Zco1j3JkGUH9U0GN84s/FIOuox e2v9lNoirwjg/uP1KRHpn5DttVlX2tlnDgOVpOkBlld8YSW9PWmV2gu6lFNhaOBO0KKc wBRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689429216; x=1692021216; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=GYIDC6C9sVxFY0DlBpogq7e8qtq1Fq4gc1frrPqq0IQ=; b=StH6YHyX+D6orUVfqpWy4/oMuYKsqpQ8tSeM4iQGTH8gUnJlPTSoCLJqq0jb4OIh8p 7NrOMqXsyDBRTncOMwaM+RvdgF9A7d6Av0Y03HefB49YNSHav5RdTkNXilDCGXhhnSl2 dIsAIy1Gj0Tnr9WV+AVRrFL1sZuNNULqycwZ/w1qlKNoJRqlOfKaDYMVELqB8GN/ARJp TaWbCEOV3N30Cqz283O/Sd7CDP6RxBNMgALd+uSjDXtOP7Hsf0nTb1a9u2eC7QHU6VTO IXurcG7ohUeu6jNM4iOOAj/9VEdupxyet8BKN2+QlkwNDXcgWuWA5tZWLdDuhE1kcRjf raLw== X-Gm-Message-State: ABy/qLaz5DDDyigT88Tk32NaCa3j95aA52LIAFUEXsy/jwZZUVbSXtfK 3qkNtqdrzMWcrsSv8X4ANTC0QOpWvL9hIBKt8BHLNQ== X-Received: by 2002:a5d:670e:0:b0:313:ee3e:50c5 with SMTP id o14-20020a5d670e000000b00313ee3e50c5mr6190431wru.20.1689429215894; Sat, 15 Jul 2023 06:53:35 -0700 (PDT) Received: from stoup.lan ([51.219.12.49]) by smtp.gmail.com with ESMTPSA id k10-20020a5d66ca000000b00313f9085119sm13838014wrw.113.2023.07.15.06.53.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Jul 2023 06:53:35 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Andreas Schwab Subject: [PULL 20/47] linux-user: Make sure initial brk(0) is page-aligned Date: Sat, 15 Jul 2023 14:52:50 +0100 Message-Id: <20230715135317.7219-21-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230715135317.7219-1-richard.henderson@linaro.org> References: <20230715135317.7219-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42d; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x42d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Andreas Schwab Fixes: 86f04735ac ("linux-user: Fix brk() to release pages") Signed-off-by: Andreas Schwab Message-Id: Reviewed-by: Richard Henderson Signed-off-by: Richard Henderson --- linux-user/syscall.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index b78eb686d8..02d3b6c90a 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -806,7 +806,7 @@ static abi_ulong brk_page; void target_set_brk(abi_ulong new_brk) { - target_brk = new_brk; + target_brk = TARGET_PAGE_ALIGN(new_brk); brk_page = HOST_PAGE_ALIGN(target_brk); } From patchwork Sat Jul 15 13:52:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 703227 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e4d:0:b0:314:25da:8dc4 with SMTP id r13csp157453wrt; Sat, 15 Jul 2023 06:56:20 -0700 (PDT) X-Google-Smtp-Source: APBJJlETaobs90aGpdYb71U11ZZQIaSdthhygk1BizvlNru2A5zuPBof2VfBIcpn7xcilfHTXg3J X-Received: by 2002:a05:622a:11c1:b0:403:af9b:ee8e with SMTP id n1-20020a05622a11c100b00403af9bee8emr8698256qtk.9.1689429380451; Sat, 15 Jul 2023 06:56:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689429380; cv=none; d=google.com; s=arc-20160816; b=GlzHtvFM4eHuXxF4VSg+4Kno8F/O39+Uq9G8g5rmwloBEs74dYhZZP4mKBxBuXXvSI 6yhuwykP5hzb7XJPq5bOh5wwy4ea1lIJAFxKRGsaj/CZOEQ/LIB2HXeh/qQYxxsFRHq0 8TWY/+kkDZp47D7Og/R9UNXA1dRhNBcbBuutF4a/1fB3JRhx+GSXodr2Sw4//xQnqGfU f3tJVNn0o9Har5df7+MTsif6/ANDOXOfPde3I0tZxj97EUgrxMD7vN+qTs1vHBPDmlnH o6MDrfzilMyuwufBErtp4iBOKRHnRrkExmvMe7vVMOQzPvXYP8UMdrrDeTNpAHAK1ZYD aDkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=2MU6soREEIeWjjQLlmK8RHmCnAP0c3qo3FFfRalqkkk=; fh=P0V/Y70HKiPuHhoCuPJxmK0kQFpmXwOOVIu7VqYXDLE=; b=PHYulMjJu3Yle7zaa0JPf2OsR9q0lWvJ7iS66xOSSPfRRn1I8Jd7t61pOz0gIgMPOO k1YxqEL9U87pmy+qNm+UKR7ZkEwB8qC0qP549obrigWha0WccPQiJWNVXo1bPtm8S+YJ iXAUzLJgULuYmov18mKfq+Ot9h9906pxpy8TNhxS5gKplJ0DwpT3bNHimbA/2BhVT6C7 bn9Iuv+sJ4nJWKuErW0wf0o7Xwvef/536YaBwSAVPHtKX66aguvcXXdTN020lIcnpvq1 2HI1ARnhxDLpLzRt9NA9U3kVgs6ytPo0JtR8KJ09NL9a6mQcs7qDW8LMuKjMIWvNh6N8 uI8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jKdR8IJJ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id j18-20020ac85f92000000b00403a7a5820fsi5883713qta.142.2023.07.15.06.56.20 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 15 Jul 2023 06:56:20 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jKdR8IJJ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qKfjp-0007Kv-PT; Sat, 15 Jul 2023 09:55:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qKfiP-00045g-NK for qemu-devel@nongnu.org; Sat, 15 Jul 2023 09:53:43 -0400 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qKfiM-0001Hp-8T for qemu-devel@nongnu.org; Sat, 15 Jul 2023 09:53:40 -0400 Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-307d20548adso2876502f8f.0 for ; Sat, 15 Jul 2023 06:53:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689429216; x=1692021216; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=2MU6soREEIeWjjQLlmK8RHmCnAP0c3qo3FFfRalqkkk=; b=jKdR8IJJYg+ppWH/oXqnn/VcvQLdjfiprMbvBqVsWzoBdEECMsNmxb35Q59wmbZQH0 fSHIabpon+WE/2sMMThsHL6CDroIclrQlhxc4zJT/nyXUZKgut0871pUBuFNILfoD5/x rhBDSYMfuPYWrOwY9EahxuFEO0jb7H6al01PugL5AgZ7jVhg8qrdREGeKuHxuZIVD1Hk uhSotfrPk6kFAsWPowoO3vNQ0kHPEQTu1UvFaMbym095YPQU+g10iQ0aS7aF6r7ZHFwU gt7hczq1TSJ1muTaLV0+oWt8oZhmCnqFVpV9i7w4Z0dFUQQYbQt+bseXO0U6B0mSUOE9 DzBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689429216; x=1692021216; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2MU6soREEIeWjjQLlmK8RHmCnAP0c3qo3FFfRalqkkk=; b=CkS6UDg5BgOE5cdgF1v1e6lDejwJ4WA/EW7v3IIch/+wn1PeLhRI4MymIqAa/Nnh6y 7BCeZPkAwyjoa04F+fZ1GIjMF/2iNqFIs+8jD/+UltuEDdH5OZlS0Rc575OcZyQl1W4b 4UkgPKtjkNzUN63ynyhS6uW6KzHzhKdrM9bpKDJ2/p5UO4rIl+ghhXrEDVkj0i+YhP2Q VbeA7I4kTaOm4WZVlPZH8k2yx0Vr1XkHTW2eO63h3g51XxGYRbHcsWdtx5ziCRrt1TRi Eq1sHN1oPVUUxFRJyiIqmxNj1FdtbRpFlBMHsLDuWmCMDwEzrevob7J6pEdojwrQVe9v R6LA== X-Gm-Message-State: ABy/qLblcrhoJ9qUwDF9UDMajQUisEEA5InVm1w69t6OUSsmHxb8sf6q 2O3+czlEHwgJho2UvpYAjS6GR2KPBqD3G+FSj/moNg== X-Received: by 2002:a5d:4dd0:0:b0:313:f8de:1ff6 with SMTP id f16-20020a5d4dd0000000b00313f8de1ff6mr6310278wru.51.1689429216529; Sat, 15 Jul 2023 06:53:36 -0700 (PDT) Received: from stoup.lan ([51.219.12.49]) by smtp.gmail.com with ESMTPSA id k10-20020a5d66ca000000b00313f9085119sm13838014wrw.113.2023.07.15.06.53.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Jul 2023 06:53:36 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Philipp?= =?utf-8?q?e_Mathieu-Daud=C3=A9?= Subject: [PULL 21/47] linux-user: Fix formatting of mmap.c Date: Sat, 15 Jul 2023 14:52:51 +0100 Message-Id: <20230715135317.7219-22-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230715135317.7219-1-richard.henderson@linaro.org> References: <20230715135317.7219-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::434; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x434.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Fix all checkpatch.pl errors within mmap.c. Reviewed-by: Alex Bennée Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson Message-Id: <20230707204054.8792-5-richard.henderson@linaro.org> --- linux-user/mmap.c | 199 ++++++++++++++++++++++++++++------------------ 1 file changed, 122 insertions(+), 77 deletions(-) diff --git a/linux-user/mmap.c b/linux-user/mmap.c index 2692936773..639921dba0 100644 --- a/linux-user/mmap.c +++ b/linux-user/mmap.c @@ -56,10 +56,11 @@ void mmap_fork_start(void) void mmap_fork_end(int child) { - if (child) + if (child) { pthread_mutex_init(&mmap_mutex, NULL); - else + } else { pthread_mutex_unlock(&mmap_mutex); + } } /* @@ -203,40 +204,47 @@ static int mmap_frag(abi_ulong real_start, /* get the protection of the target pages outside the mapping */ prot1 = 0; - for(addr = real_start; addr < real_end; addr++) { - if (addr < start || addr >= end) + for (addr = real_start; addr < real_end; addr++) { + if (addr < start || addr >= end) { prot1 |= page_get_flags(addr); + } } if (prot1 == 0) { /* no page was there, so we allocate one */ void *p = mmap(host_start, qemu_host_page_size, prot, flags | MAP_ANONYMOUS, -1, 0); - if (p == MAP_FAILED) + if (p == MAP_FAILED) { return -1; + } prot1 = prot; } prot1 &= PAGE_BITS; prot_new = prot | prot1; if (!(flags & MAP_ANONYMOUS)) { - /* msync() won't work here, so we return an error if write is - possible while it is a shared mapping */ - if ((flags & MAP_TYPE) == MAP_SHARED && - (prot & PROT_WRITE)) + /* + * msync() won't work here, so we return an error if write is + * possible while it is a shared mapping. + */ + if ((flags & MAP_TYPE) == MAP_SHARED && (prot & PROT_WRITE)) { return -1; + } /* adjust protection to be able to read */ - if (!(prot1 & PROT_WRITE)) + if (!(prot1 & PROT_WRITE)) { mprotect(host_start, qemu_host_page_size, prot1 | PROT_WRITE); + } /* read the corresponding file data */ - if (pread(fd, g2h_untagged(start), end - start, offset) == -1) + if (pread(fd, g2h_untagged(start), end - start, offset) == -1) { return -1; + } /* put final protection */ - if (prot_new != (prot1 | PROT_WRITE)) + if (prot_new != (prot1 | PROT_WRITE)) { mprotect(host_start, qemu_host_page_size, prot_new); + } } else { if (prot_new != prot1) { mprotect(host_start, qemu_host_page_size, prot_new); @@ -265,8 +273,10 @@ abi_ulong mmap_next_start = TASK_UNMAPPED_BASE; unsigned long last_brk; -/* Subroutine of mmap_find_vma, used when we have pre-allocated a chunk - of guest address space. */ +/* + * Subroutine of mmap_find_vma, used when we have pre-allocated + * a chunk of guest address space. + */ static abi_ulong mmap_find_vma_reserved(abi_ulong start, abi_ulong size, abi_ulong align) { @@ -362,15 +372,17 @@ abi_ulong mmap_find_vma(abi_ulong start, abi_ulong size, abi_ulong align) * - shmat() with SHM_REMAP flag */ ptr = mmap(g2h_untagged(addr), size, PROT_NONE, - MAP_ANONYMOUS|MAP_PRIVATE|MAP_NORESERVE, -1, 0); + MAP_ANONYMOUS | MAP_PRIVATE | MAP_NORESERVE, -1, 0); /* ENOMEM, if host address space has no memory */ if (ptr == MAP_FAILED) { return (abi_ulong)-1; } - /* Count the number of sequential returns of the same address. - This is used to modify the search algorithm below. */ + /* + * Count the number of sequential returns of the same address. + * This is used to modify the search algorithm below. + */ repeat = (ptr == prev ? repeat + 1 : 0); if (h2g_valid(ptr + size - 1)) { @@ -387,14 +399,18 @@ abi_ulong mmap_find_vma(abi_ulong start, abi_ulong size, abi_ulong align) /* The address is not properly aligned for the target. */ switch (repeat) { case 0: - /* Assume the result that the kernel gave us is the - first with enough free space, so start again at the - next higher target page. */ + /* + * Assume the result that the kernel gave us is the + * first with enough free space, so start again at the + * next higher target page. + */ addr = ROUND_UP(addr, align); break; case 1: - /* Sometimes the kernel decides to perform the allocation - at the top end of memory instead. */ + /* + * Sometimes the kernel decides to perform the allocation + * at the top end of memory instead. + */ addr &= -align; break; case 2: @@ -407,8 +423,10 @@ abi_ulong mmap_find_vma(abi_ulong start, abi_ulong size, abi_ulong align) break; } } else { - /* Since the result the kernel gave didn't fit, start - again at low memory. If any repetition, fail. */ + /* + * Since the result the kernel gave didn't fit, start + * again at low memory. If any repetition, fail. + */ addr = (repeat ? -1 : 0); } @@ -423,8 +441,10 @@ abi_ulong mmap_find_vma(abi_ulong start, abi_ulong size, abi_ulong align) return (abi_ulong)-1; } wrapped = 1; - /* Don't actually use 0 when wrapping, instead indicate - that we'd truly like an allocation in low memory. */ + /* + * Don't actually use 0 when wrapping, instead indicate + * that we'd truly like an allocation in low memory. + */ addr = (mmap_min_addr > TARGET_PAGE_SIZE ? TARGET_PAGE_ALIGN(mmap_min_addr) : TARGET_PAGE_SIZE); @@ -485,8 +505,10 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int target_prot, real_start = start & qemu_host_page_mask; host_offset = offset & qemu_host_page_mask; - /* If the user is asking for the kernel to find a location, do that - before we truncate the length for mapping files below. */ + /* + * If the user is asking for the kernel to find a location, do that + * before we truncate the length for mapping files below. + */ if (!(flags & MAP_FIXED)) { host_len = len + offset - host_offset; host_len = HOST_PAGE_ALIGN(host_len); @@ -497,32 +519,36 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int target_prot, } } - /* When mapping files into a memory area larger than the file, accesses - to pages beyond the file size will cause a SIGBUS. - - For example, if mmaping a file of 100 bytes on a host with 4K pages - emulating a target with 8K pages, the target expects to be able to - access the first 8K. But the host will trap us on any access beyond - 4K. - - When emulating a target with a larger page-size than the hosts, we - may need to truncate file maps at EOF and add extra anonymous pages - up to the targets page boundary. */ - + /* + * When mapping files into a memory area larger than the file, accesses + * to pages beyond the file size will cause a SIGBUS. + * + * For example, if mmaping a file of 100 bytes on a host with 4K pages + * emulating a target with 8K pages, the target expects to be able to + * access the first 8K. But the host will trap us on any access beyond + * 4K. + * + * When emulating a target with a larger page-size than the hosts, we + * may need to truncate file maps at EOF and add extra anonymous pages + * up to the targets page boundary. + */ if ((qemu_real_host_page_size() < qemu_host_page_size) && !(flags & MAP_ANONYMOUS)) { struct stat sb; - if (fstat (fd, &sb) == -1) - goto fail; + if (fstat(fd, &sb) == -1) { + goto fail; + } - /* Are we trying to create a map beyond EOF?. */ - if (offset + len > sb.st_size) { - /* If so, truncate the file map at eof aligned with - the hosts real pagesize. Additional anonymous maps - will be created beyond EOF. */ - len = REAL_HOST_PAGE_ALIGN(sb.st_size - offset); - } + /* Are we trying to create a map beyond EOF?. */ + if (offset + len > sb.st_size) { + /* + * If so, truncate the file map at eof aligned with + * the hosts real pagesize. Additional anonymous maps + * will be created beyond EOF. + */ + len = REAL_HOST_PAGE_ALIGN(sb.st_size - offset); + } } if (!(flags & MAP_FIXED)) { @@ -532,9 +558,11 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int target_prot, host_len = len + offset - host_offset; host_len = HOST_PAGE_ALIGN(host_len); - /* Note: we prefer to control the mapping address. It is - especially important if qemu_host_page_size > - qemu_real_host_page_size */ + /* + * Note: we prefer to control the mapping address. It is + * especially important if qemu_host_page_size > + * qemu_real_host_page_size. + */ p = mmap(g2h_untagged(start), host_len, host_prot, flags | MAP_FIXED | MAP_ANONYMOUS, -1, 0); if (p == MAP_FAILED) { @@ -572,45 +600,52 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int target_prot, goto fail; } - /* worst case: we cannot map the file because the offset is not - aligned, so we read it */ + /* + * worst case: we cannot map the file because the offset is not + * aligned, so we read it + */ if (!(flags & MAP_ANONYMOUS) && (offset & ~qemu_host_page_mask) != (start & ~qemu_host_page_mask)) { - /* msync() won't work here, so we return an error if write is - possible while it is a shared mapping */ - if ((flags & MAP_TYPE) == MAP_SHARED && - (host_prot & PROT_WRITE)) { + /* + * msync() won't work here, so we return an error if write is + * possible while it is a shared mapping + */ + if ((flags & MAP_TYPE) == MAP_SHARED && (host_prot & PROT_WRITE)) { errno = EINVAL; goto fail; } retaddr = target_mmap(start, len, target_prot | PROT_WRITE, MAP_FIXED | MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); - if (retaddr == -1) + if (retaddr == -1) { goto fail; - if (pread(fd, g2h_untagged(start), len, offset) == -1) + } + if (pread(fd, g2h_untagged(start), len, offset) == -1) { goto fail; + } if (!(host_prot & PROT_WRITE)) { ret = target_mprotect(start, len, target_prot); assert(ret == 0); } goto the_end; } - + /* handle the start of the mapping */ if (start > real_start) { if (real_end == real_start + qemu_host_page_size) { /* one single host page */ ret = mmap_frag(real_start, start, end, host_prot, flags, fd, offset); - if (ret == -1) + if (ret == -1) { goto fail; + } goto the_end1; } ret = mmap_frag(real_start, start, real_start + qemu_host_page_size, host_prot, flags, fd, offset); - if (ret == -1) + if (ret == -1) { goto fail; + } real_start += qemu_host_page_size; } /* handle the end of the mapping */ @@ -619,8 +654,9 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int target_prot, real_end - qemu_host_page_size, end, host_prot, flags, fd, offset + real_end - qemu_host_page_size - start); - if (ret == -1) + if (ret == -1) { goto fail; + } real_end -= qemu_host_page_size; } @@ -628,14 +664,16 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int target_prot, if (real_start < real_end) { void *p; unsigned long offset1; - if (flags & MAP_ANONYMOUS) + if (flags & MAP_ANONYMOUS) { offset1 = 0; - else + } else { offset1 = offset + real_start - start; + } p = mmap(g2h_untagged(real_start), real_end - real_start, host_prot, flags, fd, offset1); - if (p == MAP_FAILED) + if (p == MAP_FAILED) { goto fail; + } passthrough_start = real_start; passthrough_end = real_end; } @@ -697,16 +735,18 @@ static void mmap_reserve(abi_ulong start, abi_ulong size) } end = real_end; } - if (prot != 0) + if (prot != 0) { real_start += qemu_host_page_size; + } } if (end < real_end) { prot = 0; for (addr = end; addr < real_end; addr += TARGET_PAGE_SIZE) { prot |= page_get_flags(addr); } - if (prot != 0) + if (prot != 0) { real_end -= qemu_host_page_size; + } } if (real_start != real_end) { mmap(g2h_untagged(real_start), real_end - real_start, PROT_NONE, @@ -722,8 +762,9 @@ int target_munmap(abi_ulong start, abi_ulong len) trace_target_munmap(start, len); - if (start & ~TARGET_PAGE_MASK) + if (start & ~TARGET_PAGE_MASK) { return -TARGET_EINVAL; + } len = TARGET_PAGE_ALIGN(len); if (len == 0 || !guest_range_valid_untagged(start, len)) { return -TARGET_EINVAL; @@ -737,25 +778,27 @@ 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; } - if (prot != 0) + if (prot != 0) { real_start += qemu_host_page_size; + } } if (end < real_end) { prot = 0; - for(addr = end; addr < real_end; addr += TARGET_PAGE_SIZE) { + for (addr = end; addr < real_end; addr += TARGET_PAGE_SIZE) { prot |= page_get_flags(addr); } - if (prot != 0) + if (prot != 0) { real_end -= qemu_host_page_size; + } } ret = 0; @@ -798,8 +841,10 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size, flags, g2h_untagged(new_addr)); if (reserved_va && host_addr != MAP_FAILED) { - /* If new and old addresses overlap then the above mremap will - already have failed with EINVAL. */ + /* + * If new and old addresses overlap then the above mremap will + * already have failed with EINVAL. + */ mmap_reserve(old_addr, old_size); } } else if (flags & MREMAP_MAYMOVE) { From patchwork Sat Jul 15 13:52:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 703210 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e4d:0:b0:314:25da:8dc4 with SMTP id r13csp156730wrt; Sat, 15 Jul 2023 06:54:28 -0700 (PDT) X-Google-Smtp-Source: APBJJlHZJFFz4YmYJ7A8cJXaDVGK9akorhNn+Wq4xNJiysP4FCB+qZcxd8sGSTcVDMEq8XlnG45+ X-Received: by 2002:a0c:db03:0:b0:621:3b88:7b09 with SMTP id d3-20020a0cdb03000000b006213b887b09mr7229929qvk.35.1689429267990; Sat, 15 Jul 2023 06:54:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689429267; cv=none; d=google.com; s=arc-20160816; b=z8h6ig4sdfyhJoiu0RPN89E0yPsq5x7I8ozbFbt4nblyD1Z0JVRS3lf+JyKg29ZfH3 Zq+skTALghcbYLVy7Z8O+yiNJjwyU5S+gSRJMwd0jFnaXWfQ/+smh29exMcXuSD9MFWr hPGlcJlr7gjEYX0pxLKLucpfUnUPHOHcSJMtKR87CfgSLTH0ix5P+sSH4Y5GJLhV/Aka HsARSQKdYW/cKLIgx4puYfg9AoRLmIX8k+yyLP1mpLo7nJnfX4VcAlMgRImICulLy7eV OxGhE+qHSBTe7hprXYnSRMqpTQJRjwJCZZRMyqf0GmnfM9OKoj5vvFhkQHiaGotyfAlc zBhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=0PrN0L5Atjyx6hFnGJcyTHnWGq2syM21Wu73egPOuXw=; fh=ZuLSLtzpwbOj79Lm6HQkAzCl7AYBeBRT4Q/1zeFcrQg=; b=iuOSP393KokJszqjHASGA6yAJQEXxVuWg05Vg1uKFutKcqp6RAgBAP7aQudhhpgOy9 fdzKKfP8xlzbjwwTvw1FbbZy+q5/lhYVHYA+ZBh/mNPsDTpMxEi2Beal6KofoK4rWcJx VA5q68hdsKPByaIaqchtPEP/Rk3TvSWNc9Y1Rgg63SUg9vbPfIOfD9ou/9v+lylEfBke GDVuxlA9Q7npVdbNipVu+KuUPmzMIfscWwFDsmSVxZkVlsc5PEp8C467QWTR+7BlAuIr 5JixE01w8Tw1G/KDFe+fxsMvCIYmaMg0HxQEuAzNThW87BsFCAnXJpsOr+FBwAnuhprq m1ow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wmCpZrzt; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id w10-20020a0ca80a000000b006259adfabbcsi5639869qva.283.2023.07.15.06.54.27 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 15 Jul 2023 06:54:27 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wmCpZrzt; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qKfir-0004EY-TA; Sat, 15 Jul 2023 09:54:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qKfiO-00045V-7L for qemu-devel@nongnu.org; Sat, 15 Jul 2023 09:53:41 -0400 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qKfiM-0001Hu-K6 for qemu-devel@nongnu.org; Sat, 15 Jul 2023 09:53:40 -0400 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-3fbd33a57dcso29510255e9.0 for ; Sat, 15 Jul 2023 06:53:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689429217; x=1692021217; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=0PrN0L5Atjyx6hFnGJcyTHnWGq2syM21Wu73egPOuXw=; b=wmCpZrzt9CW2VaTqz/sExcOWDC0dI3Y9DVSjbnE75X0PnetawVc2bmZT51B7pxbBiO 0wAzYchNSSRy25zt+o8mx6p/h2ZFJRV7vcgAuFOEpmIFXLnkPeS+Nrxtea3q401WTXKl kFB3lM8XazziLMnH8VkM7f6vRPXIsi+zmfIYnbNVaeysnw+LLjPZNfnC5I6U4lxg1PT4 x2RceFby1vzjIAmuRzD59ipQFzi0KIlOFKv56JTdyk6FMYr8db/piR2Ym6aLChAclgQx LnFG7YUIFWqrLz5jf0W9rzQ4LA/77P6uQxdbbDDQmbz3Xaz2X4MW1FwiPIIn01a/QLiF ldpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689429217; x=1692021217; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0PrN0L5Atjyx6hFnGJcyTHnWGq2syM21Wu73egPOuXw=; b=QhXO7jLMjzfHQVSx/QjWpXJOY7skYYA3bExHcv+XFtagcSewOwoygbq6uQH0rp2imy xltJL2YinJhEVd3NC6EGWVsh9Igg+74ARP19LI91ytLIQSDDrfK7FWIBcxPaFaEdnYNG NsYafAToZvM3KEFGV8DtiCyEui2+BQgsEVieFEvZDcDwc2Y9nWtpBJhk6Dir66vcxeug TcPr7ZEST8aVJLUx46VVu+ugWUWigVcyMay2zluh9eSCpl1HEg454JQONCHGvGJ00a3q MY6wYc86/xAC/aDgZecR6292YfiykZepyMl4Oh+vjAq4sz4t34ABEJaq67+xsEgrNUsK U9Ew== X-Gm-Message-State: ABy/qLaOE7/YI2DxX+bYMdolReSEZ5zAsTD+yQ17Gu301qoeHRymktAl SVkevDwt3z0JoHp+cO48qi/7ewNtMvfB2f5rOeE3YQ== X-Received: by 2002:a05:600c:2993:b0:3f9:c82e:9d87 with SMTP id r19-20020a05600c299300b003f9c82e9d87mr6634743wmd.13.1689429217231; Sat, 15 Jul 2023 06:53:37 -0700 (PDT) Received: from stoup.lan ([51.219.12.49]) by smtp.gmail.com with ESMTPSA id k10-20020a5d66ca000000b00313f9085119sm13838014wrw.113.2023.07.15.06.53.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Jul 2023 06:53:36 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Alex_Benn=C3=A9e?= Subject: [PULL 22/47] linux-user/strace: Expand struct flags to hold a mask Date: Sat, 15 Jul 2023 14:52:52 +0100 Message-Id: <20230715135317.7219-23-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230715135317.7219-1-richard.henderson@linaro.org> References: <20230715135317.7219-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::336; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x336.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org A zero bit value does not make sense -- it must relate to some field in some way. Define FLAG_BASIC with a build-time sanity check. Adjust FLAG_GENERIC and FLAG_TARGET to use it. Add FLAG_GENERIC_MASK and FLAG_TARGET_MASK. Fix up the existing flag definitions for build errors. Reviewed-by: Alex Bennée Signed-off-by: Richard Henderson Message-Id: <20230707204054.8792-6-richard.henderson@linaro.org> --- linux-user/strace.c | 40 ++++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/linux-user/strace.c b/linux-user/strace.c index 669200c4a4..9228b235da 100644 --- a/linux-user/strace.c +++ b/linux-user/strace.c @@ -46,15 +46,21 @@ struct syscallname { */ struct flags { abi_long f_value; /* flag */ + abi_long f_mask; /* mask */ const char *f_string; /* stringified flag */ }; +/* No 'struct flags' element should have a zero mask. */ +#define FLAG_BASIC(V, M, N) { V, M | QEMU_BUILD_BUG_ON_ZERO(!(M)), N } + /* common flags for all architectures */ -#define FLAG_GENERIC(name) { name, #name } +#define FLAG_GENERIC_MASK(V, M) FLAG_BASIC(V, M, #V) +#define FLAG_GENERIC(V) FLAG_BASIC(V, V, #V) /* target specific flags (syscall_defs.h has TARGET_) */ -#define FLAG_TARGET(name) { TARGET_ ## name, #name } +#define FLAG_TARGET_MASK(V, M) FLAG_BASIC(TARGET_##V, TARGET_##M, #V) +#define FLAG_TARGET(V) FLAG_BASIC(TARGET_##V, TARGET_##V, #V) /* end of flags array */ -#define FLAG_END { 0, NULL } +#define FLAG_END { 0, 0, NULL } /* Structure used to translate enumerated values into strings */ struct enums { @@ -963,7 +969,7 @@ print_syscall_ret_ioctl(CPUArchState *cpu_env, const struct syscallname *name, #endif UNUSED static const struct flags access_flags[] = { - FLAG_GENERIC(F_OK), + FLAG_GENERIC_MASK(F_OK, R_OK | W_OK | X_OK), FLAG_GENERIC(R_OK), FLAG_GENERIC(W_OK), FLAG_GENERIC(X_OK), @@ -999,9 +1005,9 @@ UNUSED static const struct flags mode_flags[] = { }; UNUSED static const struct flags open_access_flags[] = { - FLAG_TARGET(O_RDONLY), - FLAG_TARGET(O_WRONLY), - FLAG_TARGET(O_RDWR), + FLAG_TARGET_MASK(O_RDONLY, O_ACCMODE), + FLAG_TARGET_MASK(O_WRONLY, O_ACCMODE), + FLAG_TARGET_MASK(O_RDWR, O_ACCMODE), FLAG_END, }; @@ -1010,7 +1016,9 @@ UNUSED static const struct flags open_flags[] = { FLAG_TARGET(O_CREAT), FLAG_TARGET(O_DIRECTORY), FLAG_TARGET(O_EXCL), +#if TARGET_O_LARGEFILE != 0 FLAG_TARGET(O_LARGEFILE), +#endif FLAG_TARGET(O_NOCTTY), FLAG_TARGET(O_NOFOLLOW), FLAG_TARGET(O_NONBLOCK), /* also O_NDELAY */ @@ -1075,7 +1083,7 @@ UNUSED static const struct flags umount2_flags[] = { }; UNUSED static const struct flags mmap_prot_flags[] = { - FLAG_GENERIC(PROT_NONE), + FLAG_GENERIC_MASK(PROT_NONE, PROT_READ | PROT_WRITE | PROT_EXEC), FLAG_GENERIC(PROT_EXEC), FLAG_GENERIC(PROT_READ), FLAG_GENERIC(PROT_WRITE), @@ -1103,7 +1111,7 @@ UNUSED static const struct flags mmap_flags[] = { #ifdef MAP_POPULATE FLAG_TARGET(MAP_POPULATE), #endif -#ifdef TARGET_MAP_UNINITIALIZED +#if defined(TARGET_MAP_UNINITIALIZED) && TARGET_MAP_UNINITIALIZED != 0 FLAG_TARGET(MAP_UNINITIALIZED), #endif FLAG_TARGET(MAP_HUGETLB), @@ -1201,13 +1209,13 @@ UNUSED static const struct flags statx_flags[] = { FLAG_GENERIC(AT_SYMLINK_NOFOLLOW), #endif #ifdef AT_STATX_SYNC_AS_STAT - FLAG_GENERIC(AT_STATX_SYNC_AS_STAT), + FLAG_GENERIC_MASK(AT_STATX_SYNC_AS_STAT, AT_STATX_SYNC_TYPE), #endif #ifdef AT_STATX_FORCE_SYNC - FLAG_GENERIC(AT_STATX_FORCE_SYNC), + FLAG_GENERIC_MASK(AT_STATX_FORCE_SYNC, AT_STATX_SYNC_TYPE), #endif #ifdef AT_STATX_DONT_SYNC - FLAG_GENERIC(AT_STATX_DONT_SYNC), + FLAG_GENERIC_MASK(AT_STATX_DONT_SYNC, AT_STATX_SYNC_TYPE), #endif FLAG_END, }; @@ -1481,14 +1489,10 @@ print_flags(const struct flags *f, abi_long flags, int last) const char *sep = ""; int n; - if ((flags == 0) && (f->f_value == 0)) { - qemu_log("%s%s", f->f_string, get_comma(last)); - return; - } for (n = 0; f->f_string != NULL; f++) { - if ((f->f_value != 0) && ((flags & f->f_value) == f->f_value)) { + if ((flags & f->f_mask) == f->f_value) { qemu_log("%s%s", sep, f->f_string); - flags &= ~f->f_value; + flags &= ~f->f_mask; sep = "|"; n++; } From patchwork Sat Jul 15 13:52:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 703213 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e4d:0:b0:314:25da:8dc4 with SMTP id r13csp157071wrt; Sat, 15 Jul 2023 06:55:18 -0700 (PDT) X-Google-Smtp-Source: APBJJlH0PRB7clg5KZeqInNxNV9Y1Zk8qTexmTcWOv1+9fKEAY7MUaHyryN/qa66+9H6md/YW4+L X-Received: by 2002:ac8:7e81:0:b0:403:a261:8ad2 with SMTP id w1-20020ac87e81000000b00403a2618ad2mr9467532qtj.30.1689429317855; Sat, 15 Jul 2023 06:55:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689429317; cv=none; d=google.com; s=arc-20160816; b=uUPIU1x2ujqfOsOKckjCyxAwWEOo6RlTpPQ/ZC8XOkQhO8HgPw5erIB9gojk5JG/Gq zjd/DrOsuBHNdKlnBC0N3FGt+6rycb0zaeeOZVf0S98dcobhYB7ZGDnourhVbA8AXo5t AWj/0jXfpb6yzh+Dbh0ZXi8X94PsX4Ls8ARlda03PSYkLYsn+voEC/nY/p9IT9VT8Raf Wn2lEAL0CXL1/QxGqRdyvkrW43qOJEMeFCPZMQIdUv5uzbWHJt/bZQChj1oohsf3LNsT 9zmPsGNQys95lnBZgs8pGQyLWrgi4ujes3YLsl1F7xGiJpNaRrT2c0u0Ucn0WtHuH7ri kItA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=v53BpocOSkZq13xiAuKy1Z69SsuVPyzPYM9KNeUZOtU=; fh=ZuLSLtzpwbOj79Lm6HQkAzCl7AYBeBRT4Q/1zeFcrQg=; b=NTqifbLM5N5qSp444vxMrav19wY6L2VqdxeZT57LJ976j/OlR5HlatfRL7pkIvteBn 95gpNFEhpnig9qLA1AvNFp4qdKmJy3BRGU1yJ/E+bqSeRTmQHZ9+Avao6lfL7iXCPBWI WBv8Lhla9LRM+Lov99SCnVmfsXYAV3YLvcLFA/IH5Z/YsFcCIKEzz1FMe5v9it3CWUzO CDFL8DwYpoLwbHTEi13Nc7XdTYiLHIwBvICb0wg/oK6PkSuhsYKPV9x6brD3/MGbUqYR MjH469cJTXHBTDPIWOD1VrL9DDnMPlh+noN1ZkD5s/9DiRFlvOCWZ9qyEZ5vq4hoLHqu jd2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=iq+QA56V; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id w20-20020ac87e94000000b00403c5ae5a58si4637433qtj.804.2023.07.15.06.55.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 15 Jul 2023 06:55:17 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=iq+QA56V; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qKfje-0006St-2z; Sat, 15 Jul 2023 09:54:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qKfiP-00045h-Oo for qemu-devel@nongnu.org; Sat, 15 Jul 2023 09:53:43 -0400 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qKfiN-0001I9-Lo for qemu-devel@nongnu.org; Sat, 15 Jul 2023 09:53:41 -0400 Received: by mail-wr1-x432.google.com with SMTP id ffacd0b85a97d-314313f127fso2846113f8f.1 for ; Sat, 15 Jul 2023 06:53:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689429218; x=1692021218; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=v53BpocOSkZq13xiAuKy1Z69SsuVPyzPYM9KNeUZOtU=; b=iq+QA56VqVNxyRBkR94ZRYRVSMWWWcCusC9ds/fBzomfrtg/3A8pNdk+RvfWHSHQDV F9qJ8L5OKCeYpZf2BVI8uZhvMVd2BeIenJmcrCBLQzVlPxHTTTqNqg8mqEA6ZyGgx/eQ vCL5HOAIbZz3gkhIqjn6tqT4hzZC0ht0r6bHp+g3nIv4qbHgufcS6QKan37E/izD91Wa 3pPiZ4nd9V7neKbtrnWvUW59Y/Plq+Q0PyusDEa/T0QKQo+lN8KwAjXU4BE1cRZvlL4u tcaNdx4oLe7IaEs+NN8wq2YO3/aDENF9qLJwQZAccb0tvVBeySvmgrDgNyHY6Sir/yh3 LGNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689429218; x=1692021218; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=v53BpocOSkZq13xiAuKy1Z69SsuVPyzPYM9KNeUZOtU=; b=ChR662AMxyKnypFN0B+WshSALniRcd8gvusnm+tWF7V0wBqJKCAorArg9OvgQKd1io +9uBrA9lnysKBFTm3a//uPG+OgEgMuGffLCvMzmoWe4m0BkNf9d+fsn2ubnn0OxWBK0x uNmbMispfqYAXGQMi/LQRT55FS2R65KvpMbBEXIy7HHIHYB0OMlRgPkgzycsNa7QV9aw pvakv0RvhRKUjOEx/bf60RWT52LFN27qIYEUmdYsPHWzV1XXcq6XOigQkRBgEkDPE/03 3kJUFbws8HihuMRKxeCgKUepi2+j3/7ht10P/+u5vljJbQ1HCFzkcAKIfeFYERLDKutX wOCg== X-Gm-Message-State: ABy/qLaXLqLsPcmFDF+updxhFNjlXAVOzrGJ9Nw8lKM52pX+pe23y88C qcnNy26PAqv3t/h1Y4t0P22wZgoPXQgUegFMfLpyiA== X-Received: by 2002:a5d:4e4d:0:b0:313:eee0:89a4 with SMTP id r13-20020a5d4e4d000000b00313eee089a4mr5666342wrt.12.1689429217835; Sat, 15 Jul 2023 06:53:37 -0700 (PDT) Received: from stoup.lan ([51.219.12.49]) by smtp.gmail.com with ESMTPSA id k10-20020a5d66ca000000b00313f9085119sm13838014wrw.113.2023.07.15.06.53.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Jul 2023 06:53:37 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Alex_Benn=C3=A9e?= Subject: [PULL 23/47] linux-user: Split TARGET_MAP_* out of syscall_defs.h Date: Sat, 15 Jul 2023 14:52:53 +0100 Message-Id: <20230715135317.7219-24-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230715135317.7219-1-richard.henderson@linaro.org> References: <20230715135317.7219-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::432; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x432.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Move the values into the per-target target_mman.h headers Reviewed-by: Alex Bennée Signed-off-by: Richard Henderson Message-Id: <20230707204054.8792-7-richard.henderson@linaro.org> --- linux-user/alpha/target_mman.h | 13 +++++ linux-user/generic/target_mman.h | 54 ++++++++++++++++++++ linux-user/hppa/target_mman.h | 10 ++++ linux-user/mips/target_mman.h | 16 ++++++ linux-user/mips64/target_mman.h | 2 +- linux-user/ppc/target_mman.h | 8 +++ linux-user/sparc/target_mman.h | 9 ++++ linux-user/syscall_defs.h | 85 +------------------------------- linux-user/xtensa/target_mman.h | 16 ++++++ 9 files changed, 128 insertions(+), 85 deletions(-) diff --git a/linux-user/alpha/target_mman.h b/linux-user/alpha/target_mman.h index 051544f5ab..6bb03e7336 100644 --- a/linux-user/alpha/target_mman.h +++ b/linux-user/alpha/target_mman.h @@ -1,6 +1,19 @@ #ifndef ALPHA_TARGET_MMAN_H #define ALPHA_TARGET_MMAN_H +#define TARGET_MAP_ANONYMOUS 0x10 +#define TARGET_MAP_FIXED 0x100 +#define TARGET_MAP_GROWSDOWN 0x01000 +#define TARGET_MAP_DENYWRITE 0x02000 +#define TARGET_MAP_EXECUTABLE 0x04000 +#define TARGET_MAP_LOCKED 0x08000 +#define TARGET_MAP_NORESERVE 0x10000 +#define TARGET_MAP_POPULATE 0x20000 +#define TARGET_MAP_NONBLOCK 0x40000 +#define TARGET_MAP_STACK 0x80000 +#define TARGET_MAP_HUGETLB 0x100000 +#define TARGET_MAP_FIXED_NOREPLACE 0x200000 + #define TARGET_MADV_DONTNEED 6 #define TARGET_MS_ASYNC 1 diff --git a/linux-user/generic/target_mman.h b/linux-user/generic/target_mman.h index 32bf1a52d0..7b888fb7f8 100644 --- a/linux-user/generic/target_mman.h +++ b/linux-user/generic/target_mman.h @@ -1,6 +1,60 @@ #ifndef LINUX_USER_TARGET_MMAN_H #define LINUX_USER_TARGET_MMAN_H +/* These are defined in linux/mmap.h */ +#define TARGET_MAP_SHARED 0x01 +#define TARGET_MAP_PRIVATE 0x02 +#define TARGET_MAP_SHARED_VALIDATE 0x03 + +/* 0x0100 - 0x4000 flags are defined in asm-generic/mman.h */ +#ifndef TARGET_MAP_GROWSDOWN +#define TARGET_MAP_GROWSDOWN 0x0100 +#endif +#ifndef TARGET_MAP_DENYWRITE +#define TARGET_MAP_DENYWRITE 0x0800 +#endif +#ifndef TARGET_MAP_EXECUTABLE +#define TARGET_MAP_EXECUTABLE 0x1000 +#endif +#ifndef TARGET_MAP_LOCKED +#define TARGET_MAP_LOCKED 0x2000 +#endif +#ifndef TARGET_MAP_NORESERVE +#define TARGET_MAP_NORESERVE 0x4000 +#endif + +/* Other MAP flags are defined in asm-generic/mman-common.h */ +#ifndef TARGET_MAP_TYPE +#define TARGET_MAP_TYPE 0x0f +#endif +#ifndef TARGET_MAP_FIXED +#define TARGET_MAP_FIXED 0x10 +#endif +#ifndef TARGET_MAP_ANONYMOUS +#define TARGET_MAP_ANONYMOUS 0x20 +#endif +#ifndef TARGET_MAP_POPULATE +#define TARGET_MAP_POPULATE 0x008000 +#endif +#ifndef TARGET_MAP_NONBLOCK +#define TARGET_MAP_NONBLOCK 0x010000 +#endif +#ifndef TARGET_MAP_STACK +#define TARGET_MAP_STACK 0x020000 +#endif +#ifndef TARGET_MAP_HUGETLB +#define TARGET_MAP_HUGETLB 0x040000 +#endif +#ifndef TARGET_MAP_SYNC +#define TARGET_MAP_SYNC 0x080000 +#endif +#ifndef TARGET_MAP_FIXED_NOREPLACE +#define TARGET_MAP_FIXED_NOREPLACE 0x100000 +#endif +#ifndef TARGET_MAP_UNINITIALIZED +#define TARGET_MAP_UNINITIALIZED 0x4000000 +#endif + #ifndef TARGET_MADV_NORMAL #define TARGET_MADV_NORMAL 0 #endif diff --git a/linux-user/hppa/target_mman.h b/linux-user/hppa/target_mman.h index f9b6b97032..97f87d042a 100644 --- a/linux-user/hppa/target_mman.h +++ b/linux-user/hppa/target_mman.h @@ -1,6 +1,16 @@ #ifndef HPPA_TARGET_MMAN_H #define HPPA_TARGET_MMAN_H +#define TARGET_MAP_TYPE 0x2b +#define TARGET_MAP_FIXED 0x04 +#define TARGET_MAP_ANONYMOUS 0x10 +#define TARGET_MAP_GROWSDOWN 0x8000 +#define TARGET_MAP_POPULATE 0x10000 +#define TARGET_MAP_NONBLOCK 0x20000 +#define TARGET_MAP_STACK 0x40000 +#define TARGET_MAP_HUGETLB 0x80000 +#define TARGET_MAP_UNINITIALIZED 0 + #define TARGET_MADV_MERGEABLE 65 #define TARGET_MADV_UNMERGEABLE 66 #define TARGET_MADV_HUGEPAGE 67 diff --git a/linux-user/mips/target_mman.h b/linux-user/mips/target_mman.h index e7ba6070fe..cd566c24b6 100644 --- a/linux-user/mips/target_mman.h +++ b/linux-user/mips/target_mman.h @@ -1 +1,17 @@ +#ifndef MIPS_TARGET_MMAN_H +#define MIPS_TARGET_MMAN_H + +#define TARGET_MAP_NORESERVE 0x0400 +#define TARGET_MAP_ANONYMOUS 0x0800 +#define TARGET_MAP_GROWSDOWN 0x1000 +#define TARGET_MAP_DENYWRITE 0x2000 +#define TARGET_MAP_EXECUTABLE 0x4000 +#define TARGET_MAP_LOCKED 0x8000 +#define TARGET_MAP_POPULATE 0x10000 +#define TARGET_MAP_NONBLOCK 0x20000 +#define TARGET_MAP_STACK 0x40000 +#define TARGET_MAP_HUGETLB 0x80000 + #include "../generic/target_mman.h" + +#endif diff --git a/linux-user/mips64/target_mman.h b/linux-user/mips64/target_mman.h index e7ba6070fe..7bdc47d902 100644 --- a/linux-user/mips64/target_mman.h +++ b/linux-user/mips64/target_mman.h @@ -1 +1 @@ -#include "../generic/target_mman.h" +#include "../mips/target_mman.h" diff --git a/linux-user/ppc/target_mman.h b/linux-user/ppc/target_mman.h index e7ba6070fe..67cc218f2e 100644 --- a/linux-user/ppc/target_mman.h +++ b/linux-user/ppc/target_mman.h @@ -1 +1,9 @@ +#ifndef PPC_TARGET_MMAN_H +#define PPC_TARGET_MMAN_H + +#define TARGET_MAP_NORESERVE 0x40 +#define TARGET_MAP_LOCKED 0x80 + #include "../generic/target_mman.h" + +#endif diff --git a/linux-user/sparc/target_mman.h b/linux-user/sparc/target_mman.h index e7ba6070fe..9bad99c852 100644 --- a/linux-user/sparc/target_mman.h +++ b/linux-user/sparc/target_mman.h @@ -1 +1,10 @@ +#ifndef SPARC_TARGET_MMAN_H +#define SPARC_TARGET_MMAN_H + +#define TARGET_MAP_NORESERVE 0x40 +#define TARGET_MAP_LOCKED 0x100 +#define TARGET_MAP_GROWSDOWN 0x0200 + #include "../generic/target_mman.h" + +#endif diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index c8ffb4f785..041105b7a7 100644 --- a/linux-user/syscall_defs.h +++ b/linux-user/syscall_defs.h @@ -1238,90 +1238,7 @@ struct target_winsize { #define TARGET_PROT_MTE 0x20 #endif -/* Common */ -#define TARGET_MAP_SHARED 0x01 /* Share changes */ -#define TARGET_MAP_PRIVATE 0x02 /* Changes are private */ -#if defined(TARGET_HPPA) -#define TARGET_MAP_TYPE 0x03 /* Mask for type of mapping */ -#else -#define TARGET_MAP_TYPE 0x0f /* Mask for type of mapping */ -#endif - -/* Target specific */ -#if defined(TARGET_MIPS) -#define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */ -#define TARGET_MAP_ANONYMOUS 0x0800 /* don't use a file */ -#define TARGET_MAP_GROWSDOWN 0x1000 /* stack-like segment */ -#define TARGET_MAP_DENYWRITE 0x2000 /* ETXTBSY */ -#define TARGET_MAP_EXECUTABLE 0x4000 /* mark it as an executable */ -#define TARGET_MAP_LOCKED 0x8000 /* pages are locked */ -#define TARGET_MAP_NORESERVE 0x0400 /* don't check for reservations */ -#define TARGET_MAP_POPULATE 0x10000 /* populate (prefault) pagetables */ -#define TARGET_MAP_NONBLOCK 0x20000 /* do not block on IO */ -#define TARGET_MAP_STACK 0x40000 /* ignored */ -#define TARGET_MAP_HUGETLB 0x80000 /* create a huge page mapping */ -#elif defined(TARGET_PPC) -#define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */ -#define TARGET_MAP_ANONYMOUS 0x20 /* don't use a file */ -#define TARGET_MAP_GROWSDOWN 0x0100 /* stack-like segment */ -#define TARGET_MAP_DENYWRITE 0x0800 /* ETXTBSY */ -#define TARGET_MAP_EXECUTABLE 0x1000 /* mark it as an executable */ -#define TARGET_MAP_LOCKED 0x0080 /* pages are locked */ -#define TARGET_MAP_NORESERVE 0x0040 /* don't check for reservations */ -#define TARGET_MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ -#define TARGET_MAP_NONBLOCK 0x10000 /* do not block on IO */ -#define TARGET_MAP_STACK 0x20000 /* ignored */ -#define TARGET_MAP_HUGETLB 0x40000 /* create a huge page mapping */ -#elif defined(TARGET_ALPHA) -#define TARGET_MAP_ANONYMOUS 0x10 /* don't use a file */ -#define TARGET_MAP_FIXED 0x100 /* Interpret addr exactly */ -#define TARGET_MAP_GROWSDOWN 0x01000 /* stack-like segment */ -#define TARGET_MAP_DENYWRITE 0x02000 /* ETXTBSY */ -#define TARGET_MAP_EXECUTABLE 0x04000 /* mark it as an executable */ -#define TARGET_MAP_LOCKED 0x08000 /* lock the mapping */ -#define TARGET_MAP_NORESERVE 0x10000 /* no check for reservations */ -#define TARGET_MAP_POPULATE 0x20000 /* pop (prefault) pagetables */ -#define TARGET_MAP_NONBLOCK 0x40000 /* do not block on IO */ -#define TARGET_MAP_STACK 0x80000 /* ignored */ -#define TARGET_MAP_HUGETLB 0x100000 /* create a huge page mapping */ -#elif defined(TARGET_HPPA) -#define TARGET_MAP_ANONYMOUS 0x10 /* don't use a file */ -#define TARGET_MAP_FIXED 0x04 /* Interpret addr exactly */ -#define TARGET_MAP_GROWSDOWN 0x08000 /* stack-like segment */ -#define TARGET_MAP_DENYWRITE 0x00800 /* ETXTBSY */ -#define TARGET_MAP_EXECUTABLE 0x01000 /* mark it as an executable */ -#define TARGET_MAP_LOCKED 0x02000 /* lock the mapping */ -#define TARGET_MAP_NORESERVE 0x04000 /* no check for reservations */ -#define TARGET_MAP_POPULATE 0x10000 /* pop (prefault) pagetables */ -#define TARGET_MAP_NONBLOCK 0x20000 /* do not block on IO */ -#define TARGET_MAP_STACK 0x40000 /* ignored */ -#define TARGET_MAP_HUGETLB 0x80000 /* create a huge page mapping */ -#elif defined(TARGET_XTENSA) -#define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */ -#define TARGET_MAP_ANONYMOUS 0x0800 /* don't use a file */ -#define TARGET_MAP_GROWSDOWN 0x1000 /* stack-like segment */ -#define TARGET_MAP_DENYWRITE 0x2000 /* ETXTBSY */ -#define TARGET_MAP_EXECUTABLE 0x4000 /* mark it as an executable */ -#define TARGET_MAP_LOCKED 0x8000 /* pages are locked */ -#define TARGET_MAP_NORESERVE 0x0400 /* don't check for reservations */ -#define TARGET_MAP_POPULATE 0x10000 /* populate (prefault) pagetables */ -#define TARGET_MAP_NONBLOCK 0x20000 /* do not block on IO */ -#define TARGET_MAP_STACK 0x40000 -#define TARGET_MAP_HUGETLB 0x80000 /* create a huge page mapping */ -#else -#define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */ -#define TARGET_MAP_ANONYMOUS 0x20 /* don't use a file */ -#define TARGET_MAP_GROWSDOWN 0x0100 /* stack-like segment */ -#define TARGET_MAP_DENYWRITE 0x0800 /* ETXTBSY */ -#define TARGET_MAP_EXECUTABLE 0x1000 /* mark it as an executable */ -#define TARGET_MAP_LOCKED 0x2000 /* pages are locked */ -#define TARGET_MAP_NORESERVE 0x4000 /* don't check for reservations */ -#define TARGET_MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ -#define TARGET_MAP_NONBLOCK 0x10000 /* do not block on IO */ -#define TARGET_MAP_STACK 0x20000 /* ignored */ -#define TARGET_MAP_HUGETLB 0x40000 /* create a huge page mapping */ -#define TARGET_MAP_UNINITIALIZED 0x4000000 /* for anonymous mmap, memory could be uninitialized */ -#endif +#include "target_mman.h" #if (defined(TARGET_I386) && defined(TARGET_ABI32)) \ || (defined(TARGET_ARM) && defined(TARGET_ABI32)) \ diff --git a/linux-user/xtensa/target_mman.h b/linux-user/xtensa/target_mman.h index e7ba6070fe..3891bb5e07 100644 --- a/linux-user/xtensa/target_mman.h +++ b/linux-user/xtensa/target_mman.h @@ -1 +1,17 @@ +#ifndef XTENSA_TARGET_MMAN_H +#define XTENSA_TARGET_MMAN_H + +#define TARGET_MAP_NORESERVE 0x0400 +#define TARGET_MAP_ANONYMOUS 0x0800 +#define TARGET_MAP_GROWSDOWN 0x1000 +#define TARGET_MAP_DENYWRITE 0x2000 +#define TARGET_MAP_EXECUTABLE 0x4000 +#define TARGET_MAP_LOCKED 0x8000 +#define TARGET_MAP_POPULATE 0x10000 +#define TARGET_MAP_NONBLOCK 0x20000 +#define TARGET_MAP_STACK 0x40000 +#define TARGET_MAP_HUGETLB 0x80000 + #include "../generic/target_mman.h" + +#endif From patchwork Sat Jul 15 13:52:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 703249 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e4d:0:b0:314:25da:8dc4 with SMTP id r13csp160900wrt; Sat, 15 Jul 2023 07:03:20 -0700 (PDT) X-Google-Smtp-Source: APBJJlGzn1JpGJcJ+1FHnxGLuWs/CjS6tWlfe4OlECxwLIhewqqrqb4HVlViIl9YwwxjgGUfMNeB X-Received: by 2002:a0c:8b1a:0:b0:631:eb39:b7a6 with SMTP id q26-20020a0c8b1a000000b00631eb39b7a6mr6630156qva.33.1689429800235; Sat, 15 Jul 2023 07:03:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689429800; cv=none; d=google.com; s=arc-20160816; b=XQQO92mMHuyvxO5Aawy1cMxTfkXJ6ZGLBRUhPp/OfgBNIBgWJ0D/1QDqX5rR69+O80 xVFp2FTYe34BU5WX5yERej36D77VkfLg9RR1Nd24QpzcXWCt1FyeL2wGPSDmq8U9BLnR ebP9Pwm+8T0ArYPe0tpE7Yyhj717WV4dfoezzZ6iN9SHJUXwEwBqEiTd1LlFi2ViMenK SrfppBWo6zbvgFPx0wXCZ3AExT1zbpcOKoeCFByzykNeEnqsVazUYFd0dXVUEjoPwM0S uIP/s599h2iYCmvtvBciAMoSnINcm9Kf5T6Rkn21G7kIcFH/+7w7shHYaJb8IEPPBnkJ 3l5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=7XT7/zvTpZMeqxSdbndcDLpIQTRXhkVJ5EOXRYsTIYQ=; fh=P0V/Y70HKiPuHhoCuPJxmK0kQFpmXwOOVIu7VqYXDLE=; b=bbELEMGX53AWjOyx7yTYmW6N/0K1O61Iz4qbAlfiYnIkuX0KBg9G+WKPWb+jOX/5uO THFFjlnwvpEw//ePn8H/I304P1yTXq1Nw450Am4TurbUpqzev+LpeATcWl8AxbmC2xtR AyBTQFCtWUatw1nta60szXj6uG8P6go5Cwxnbu7ANFAyTnBTuQBOiX5SjzIV1UiiG3VE 63FEVahNB5DUZpmszhhV6r5K+FRoT80l3Jt2wWsLH++bJriDICosClcyrn916rU18j37 kr4g3hFGzSzuX/jg09mH443D+fhW/yoDgWj7A0oYiHRJAsbtNOZrP6Qqk4m4tTZJHEzW Y8xg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NyIynGRL; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id br9-20020a05620a460900b00767b4fa5d95si5989281qkb.190.2023.07.15.07.03.20 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 15 Jul 2023 07:03:20 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NyIynGRL; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qKfjr-0007Tn-CK; Sat, 15 Jul 2023 09:55:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qKfiP-00045f-NE for qemu-devel@nongnu.org; Sat, 15 Jul 2023 09:53:43 -0400 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qKfiN-0001IK-Ng for qemu-devel@nongnu.org; Sat, 15 Jul 2023 09:53:41 -0400 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-3fbea14706eso26405225e9.2 for ; Sat, 15 Jul 2023 06:53:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689429218; x=1692021218; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=7XT7/zvTpZMeqxSdbndcDLpIQTRXhkVJ5EOXRYsTIYQ=; b=NyIynGRLVEIxm4F71XBmV5pvQENJWVTW2QcJzM09t5UXFh6qKICwnZYog5Da+805Ck aMqQNvZwFF81KTadpVm292RkvMgAUJR6BQAIUW9XdNM1G38UlFjNBDDq42OMisAZZSL2 +zZ5JeQpLE2PxjubncDORU6wtVgxuv5rZ9JDMb/XLcwgJgOmzq2H4iEnk6pbQGRurD22 BfGou+Mp0Gr2ZLrF515Vr2KX0JBc9YxAZy7WYtXPVdlfzfgjlJ2lAy+hyar7qIv4d9/G ST91pAxjEa2p99iC/hQeLew1vs2erHNiK3kY9NvT1W6XYwQDXa0/64iD/gHvfcTrdOjb lobA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689429218; x=1692021218; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7XT7/zvTpZMeqxSdbndcDLpIQTRXhkVJ5EOXRYsTIYQ=; b=DtWfm+nMdePiDcrRwiPfZxxOjsJM/vSsrRp2EOwHlmIQcg37wWA/ygIhF1/tTjNezb Twcb/x0RtRoKfDpRIe25JyXsasrJydr2YM+T3Uhw6UllrTTR6bBaNgILHMbxsXTnWe65 KDDmEIRYnD2PUTKZgAcLahqikpvkK8pHUOr6QccF+5HdbdDAPLB0pGQsCTG/scNWG7LW BWPxCYn4WYY4UHNDk5t9vlEyFPV1zZetL/Laem6J9m23U78lXTsgElGHUsFK/rtG60uT ZrfexQcl5iL5sGU+Bo8wVjCMuOgxk2kwvRbmLzXRZ9wl6O8Ao9lgG0UvcY2aT3Z4GWXh zjcA== X-Gm-Message-State: ABy/qLZRtD55gC/27l2zIOmv8vW38nuog2GIn2z06GA4IodLBn3pHpQD YgwyTQrUDXWKpUAj3LvXXOCvufXLU7WGxV9XGBqB8g== X-Received: by 2002:a7b:c04b:0:b0:3fa:97ad:2ba5 with SMTP id u11-20020a7bc04b000000b003fa97ad2ba5mr5818794wmc.31.1689429218529; Sat, 15 Jul 2023 06:53:38 -0700 (PDT) Received: from stoup.lan ([51.219.12.49]) by smtp.gmail.com with ESMTPSA id k10-20020a5d66ca000000b00313f9085119sm13838014wrw.113.2023.07.15.06.53.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Jul 2023 06:53:38 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Philipp?= =?utf-8?q?e_Mathieu-Daud=C3=A9?= Subject: [PULL 24/47] linux-user: Split TARGET_PROT_* out of syscall_defs.h Date: Sat, 15 Jul 2023 14:52:54 +0100 Message-Id: <20230715135317.7219-25-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230715135317.7219-1-richard.henderson@linaro.org> References: <20230715135317.7219-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32a; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x32a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Move the values into the per-target target_mman.h headers Reviewed-by: Alex Bennée Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson Message-Id: <20230707204054.8792-8-richard.henderson@linaro.org> --- linux-user/aarch64/target_mman.h | 8 ++++++++ linux-user/generic/target_mman.h | 6 +++++- linux-user/mips/target_mman.h | 2 ++ linux-user/syscall_defs.h | 11 ----------- linux-user/xtensa/target_mman.h | 2 ++ 5 files changed, 17 insertions(+), 12 deletions(-) diff --git a/linux-user/aarch64/target_mman.h b/linux-user/aarch64/target_mman.h index e7ba6070fe..f721295fe1 100644 --- a/linux-user/aarch64/target_mman.h +++ b/linux-user/aarch64/target_mman.h @@ -1 +1,9 @@ +#ifndef AARCH64_TARGET_MMAN_H +#define AARCH64_TARGET_MMAN_H + +#define TARGET_PROT_BTI 0x10 +#define TARGET_PROT_MTE 0x20 + #include "../generic/target_mman.h" + +#endif diff --git a/linux-user/generic/target_mman.h b/linux-user/generic/target_mman.h index 7b888fb7f8..ec76a91b46 100644 --- a/linux-user/generic/target_mman.h +++ b/linux-user/generic/target_mman.h @@ -23,7 +23,11 @@ #define TARGET_MAP_NORESERVE 0x4000 #endif -/* Other MAP flags are defined in asm-generic/mman-common.h */ +/* Defined in asm-generic/mman-common.h */ +#ifndef TARGET_PROT_SEM +#define TARGET_PROT_SEM 0x08 +#endif + #ifndef TARGET_MAP_TYPE #define TARGET_MAP_TYPE 0x0f #endif diff --git a/linux-user/mips/target_mman.h b/linux-user/mips/target_mman.h index cd566c24b6..e97694aa4e 100644 --- a/linux-user/mips/target_mman.h +++ b/linux-user/mips/target_mman.h @@ -1,6 +1,8 @@ #ifndef MIPS_TARGET_MMAN_H #define MIPS_TARGET_MMAN_H +#define TARGET_PROT_SEM 0x10 + #define TARGET_MAP_NORESERVE 0x0400 #define TARGET_MAP_ANONYMOUS 0x0800 #define TARGET_MAP_GROWSDOWN 0x1000 diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index 041105b7a7..77ba343c85 100644 --- a/linux-user/syscall_defs.h +++ b/linux-user/syscall_defs.h @@ -1227,17 +1227,6 @@ struct target_winsize { #include "termbits.h" -#if defined(TARGET_MIPS) || defined(TARGET_XTENSA) -#define TARGET_PROT_SEM 0x10 -#else -#define TARGET_PROT_SEM 0x08 -#endif - -#ifdef TARGET_AARCH64 -#define TARGET_PROT_BTI 0x10 -#define TARGET_PROT_MTE 0x20 -#endif - #include "target_mman.h" #if (defined(TARGET_I386) && defined(TARGET_ABI32)) \ diff --git a/linux-user/xtensa/target_mman.h b/linux-user/xtensa/target_mman.h index 3891bb5e07..3933771b5b 100644 --- a/linux-user/xtensa/target_mman.h +++ b/linux-user/xtensa/target_mman.h @@ -1,6 +1,8 @@ #ifndef XTENSA_TARGET_MMAN_H #define XTENSA_TARGET_MMAN_H +#define TARGET_PROT_SEM 0x10 + #define TARGET_MAP_NORESERVE 0x0400 #define TARGET_MAP_ANONYMOUS 0x0800 #define TARGET_MAP_GROWSDOWN 0x1000 From patchwork Sat Jul 15 13:52:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 703211 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e4d:0:b0:314:25da:8dc4 with SMTP id r13csp156837wrt; Sat, 15 Jul 2023 06:54:45 -0700 (PDT) X-Google-Smtp-Source: APBJJlGn5gFOEVgAjwQlfjNd06c07jkhjwQJXR7GYeAFLl5c+VUa+eghxaYtx/BiTjNwpe2La/Sf X-Received: by 2002:a05:620a:9c3:b0:764:a7d8:1591 with SMTP id y3-20020a05620a09c300b00764a7d81591mr7088804qky.33.1689429285223; Sat, 15 Jul 2023 06:54:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689429285; cv=none; d=google.com; s=arc-20160816; b=SrmeHI3W9/Vcf9Zex/zp7UrOOlL1m5NedJSPaeQzhcMMoK62WdDcsRbkPL/3kLi597 RljQvkQ88ftDsFu+HvTxwd4rUJaVceJgEjqn4/Qp9T06LvnSir94G2FlWYBxQ9+dJMsr urbeT2MJQJbpb3TPWpFHLG7K1lTYsB0scZAqmlG8ZZBVeTaLGBLktw9TA21UxFC1DSMo QiN/KRURqq8nyRSb4BQMVZvQJqpQmbw6qjGGwVZXNmalm9aNRZHHof31swmEv4cXitY+ t6KdNdbK8fkWQCa5MbkfLRhIemO9ki6/SKBkljDd0//99BEM4zl97lI75I5y73rwqUlO gRuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=4EchJl5hjgKZgeWYuYg1q+jxNR3MablBrvDvJkqZmCU=; fh=ZuLSLtzpwbOj79Lm6HQkAzCl7AYBeBRT4Q/1zeFcrQg=; b=GQ1GOEzxwkp5dMSEyGBYOcMjL8XN9sR/EpnlGIqbbD+QT17ctihNQWV/cWlV/D9xK4 +aFYe1C1MkZ77qn5Z4AOtZAMjBH0JKllh6GGBXxgj3ecAFMUr65LAmcKPhX9c7UoElt6 U2hxfFpbYQQnMsveBEQJgmCRWtrhBWdjsxl7yiDnfrqyBFdvZrEDIxW3WJQv3l2iUolr uIyJ93mpYI6tMJgk4RTsX/cn+jEcfbDSLzdVR03pRWhYgPUb0Y+MpHYYsbaVHIOP5bKw G0bd9/9hGOVNbPodOmnNxPnwFAzK4b0ADgWgPA8oYfCNz3+xo4hwKHES3cMPmGax5R2j p97A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eNv6KoKl; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d125-20020a37b483000000b00767cba57b88si5627946qkf.372.2023.07.15.06.54.45 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 15 Jul 2023 06:54:45 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eNv6KoKl; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qKfiz-0004Wp-Hy; Sat, 15 Jul 2023 09:54:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qKfiR-000465-3E for qemu-devel@nongnu.org; Sat, 15 Jul 2023 09:53:47 -0400 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qKfiP-0001Ig-H8 for qemu-devel@nongnu.org; Sat, 15 Jul 2023 09:53:42 -0400 Received: by mail-wr1-x435.google.com with SMTP id ffacd0b85a97d-31441bc0092so2962726f8f.1 for ; Sat, 15 Jul 2023 06:53:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689429219; x=1692021219; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=4EchJl5hjgKZgeWYuYg1q+jxNR3MablBrvDvJkqZmCU=; b=eNv6KoKlNQZZMsoIMzJoL+ZzExXw342ELL1HrpWXaxhSq1wgs3OdvUrAME6urpVk/s NyoP6qRJ0er9XrBvzVrjSGDEb5uVMu5H4nJDKte1H+Abu731gBbDz1p65JuaBgO9ebdO mMkORZSBc8WdkkfgqVBfC2jhz6h2dfxIevdPSY8NJd8hq0zbhjn4/ufHSlKWpHT4Bx8u aRopsMf24KYiLczFIXnfwnhbiRUe6c5vuZd9qYzA3FwF3EVYM0Varasgqnr9+cQHS3Bs U998R2wyexEW9vxtsRIo5iUGZO5DgeRkxh/yh5357H0SAWBPw3nLII8XQLm0KdRSc82e 2e3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689429219; x=1692021219; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4EchJl5hjgKZgeWYuYg1q+jxNR3MablBrvDvJkqZmCU=; b=E08KIpcUcmmV8kA+bT3ki8evTMXiOj5H+LwO1XvM2Z/9ABc1k5JAcwW68bJTTkBsMN 6L4DJpWd7CERnQGmWM4RK4lN3khBM1ywpPcWD3mzyE17235ZNP+CayIeb6Fq3K90vuE9 b/kfnBACpEjlComPIK6sXHOFb8OoqT4qgS685H3XVluPP4ZTzRE4aMRV5eqoslDhwsdA Lb1ptysBhq3MTcc++mFW2RoZIM29Gz8KLetUp9bKeaeYwWbXSj7NIHn8rpuaqk85bCDN Z/qBZ8A4RrHFAVG4Xbj6GRWCx9990NTLbIxxW+OIQ/VuS7tjHU3Vl5D/d7l+vYyBWoC+ KwIQ== X-Gm-Message-State: ABy/qLavtrrKrNiwAo0LvwZ+jPWksCVfhFddR1v1C9eBQKT85rbyKnKb KmuhaGKa+q6MPEcbNI1dLM6IBJhAITiD+5NI44PKrA== X-Received: by 2002:a5d:5505:0:b0:313:f98a:1fd3 with SMTP id b5-20020a5d5505000000b00313f98a1fd3mr6977580wrv.27.1689429219290; Sat, 15 Jul 2023 06:53:39 -0700 (PDT) Received: from stoup.lan ([51.219.12.49]) by smtp.gmail.com with ESMTPSA id k10-20020a5d66ca000000b00313f9085119sm13838014wrw.113.2023.07.15.06.53.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Jul 2023 06:53:38 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Alex_Benn=C3=A9e?= Subject: [PULL 25/47] linux-user: Populate more bits in mmap_flags_tbl Date: Sat, 15 Jul 2023 14:52:55 +0100 Message-Id: <20230715135317.7219-26-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230715135317.7219-1-richard.henderson@linaro.org> References: <20230715135317.7219-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::435; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x435.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, UPPERCASE_50_75=0.008 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Fix translation of TARGET_MAP_SHARED and TARGET_MAP_PRIVATE, which are types not single bits. Add TARGET_MAP_SHARED_VALIDATE, TARGET_MAP_SYNC, TARGET_MAP_NONBLOCK, TARGET_MAP_POPULATE, TARGET_MAP_FIXED_NOREPLACE, and TARGET_MAP_UNINITIALIZED. Update strace to match. Reviewed-by: Alex Bennée Signed-off-by: Richard Henderson Message-Id: <20230707204054.8792-9-richard.henderson@linaro.org> --- linux-user/strace.c | 23 ++++++++++------------- linux-user/syscall.c | 21 +++++++++++++++++++-- 2 files changed, 29 insertions(+), 15 deletions(-) diff --git a/linux-user/strace.c b/linux-user/strace.c index 9228b235da..bbd29148d4 100644 --- a/linux-user/strace.c +++ b/linux-user/strace.c @@ -1094,28 +1094,25 @@ UNUSED static const struct flags mmap_prot_flags[] = { }; UNUSED static const struct flags mmap_flags[] = { - FLAG_TARGET(MAP_SHARED), - FLAG_TARGET(MAP_PRIVATE), + FLAG_TARGET_MASK(MAP_SHARED, MAP_TYPE), + FLAG_TARGET_MASK(MAP_PRIVATE, MAP_TYPE), + FLAG_TARGET_MASK(MAP_SHARED_VALIDATE, MAP_TYPE), FLAG_TARGET(MAP_ANONYMOUS), FLAG_TARGET(MAP_DENYWRITE), - FLAG_TARGET(MAP_FIXED), - FLAG_TARGET(MAP_GROWSDOWN), FLAG_TARGET(MAP_EXECUTABLE), -#ifdef MAP_LOCKED + FLAG_TARGET(MAP_FIXED), + FLAG_TARGET(MAP_FIXED_NOREPLACE), + FLAG_TARGET(MAP_GROWSDOWN), + FLAG_TARGET(MAP_HUGETLB), FLAG_TARGET(MAP_LOCKED), -#endif -#ifdef MAP_NONBLOCK FLAG_TARGET(MAP_NONBLOCK), -#endif FLAG_TARGET(MAP_NORESERVE), -#ifdef MAP_POPULATE FLAG_TARGET(MAP_POPULATE), -#endif -#if defined(TARGET_MAP_UNINITIALIZED) && TARGET_MAP_UNINITIALIZED != 0 + FLAG_TARGET(MAP_STACK), + FLAG_TARGET(MAP_SYNC), +#if TARGET_MAP_UNINITIALIZED != 0 FLAG_TARGET(MAP_UNINITIALIZED), #endif - FLAG_TARGET(MAP_HUGETLB), - FLAG_TARGET(MAP_STACK), FLAG_END, }; diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 02d3b6c90a..3a89f6b408 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -6012,9 +6012,19 @@ static const StructEntry struct_termios_def = { .print = print_termios, }; +/* If the host does not provide these bits, they may be safely discarded. */ +#ifndef MAP_SYNC +#define MAP_SYNC 0 +#endif +#ifndef MAP_UNINITIALIZED +#define MAP_UNINITIALIZED 0 +#endif + static const bitmask_transtbl mmap_flags_tbl[] = { - { TARGET_MAP_SHARED, TARGET_MAP_SHARED, MAP_SHARED, MAP_SHARED }, - { TARGET_MAP_PRIVATE, TARGET_MAP_PRIVATE, MAP_PRIVATE, MAP_PRIVATE }, + { TARGET_MAP_TYPE, TARGET_MAP_SHARED, MAP_TYPE, MAP_SHARED }, + { TARGET_MAP_TYPE, TARGET_MAP_PRIVATE, MAP_TYPE, MAP_PRIVATE }, + { TARGET_MAP_TYPE, TARGET_MAP_SHARED_VALIDATE, + MAP_TYPE, MAP_SHARED_VALIDATE }, { TARGET_MAP_FIXED, TARGET_MAP_FIXED, MAP_FIXED, MAP_FIXED }, { TARGET_MAP_ANONYMOUS, TARGET_MAP_ANONYMOUS, MAP_ANONYMOUS, MAP_ANONYMOUS }, @@ -6032,6 +6042,13 @@ static const bitmask_transtbl mmap_flags_tbl[] = { Recognize it for the target insofar as we do not want to pass it through to the host. */ { TARGET_MAP_STACK, TARGET_MAP_STACK, 0, 0 }, + { TARGET_MAP_SYNC, TARGET_MAP_SYNC, MAP_SYNC, MAP_SYNC }, + { TARGET_MAP_NONBLOCK, TARGET_MAP_NONBLOCK, MAP_NONBLOCK, MAP_NONBLOCK }, + { TARGET_MAP_POPULATE, TARGET_MAP_POPULATE, MAP_POPULATE, MAP_POPULATE }, + { TARGET_MAP_FIXED_NOREPLACE, TARGET_MAP_FIXED_NOREPLACE, + MAP_FIXED_NOREPLACE, MAP_FIXED_NOREPLACE }, + { TARGET_MAP_UNINITIALIZED, TARGET_MAP_UNINITIALIZED, + MAP_UNINITIALIZED, MAP_UNINITIALIZED }, { 0, 0, 0, 0 } }; From patchwork Sat Jul 15 13:52:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 703245 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e4d:0:b0:314:25da:8dc4 with SMTP id r13csp158827wrt; Sat, 15 Jul 2023 07:00:07 -0700 (PDT) X-Google-Smtp-Source: APBJJlHP9ZPXog6m/yBJUjrKSJdhdeWfFB6HFqjTQXJd0sqSc6EzbK//4SKZgy6gtSdyvorKnAVK X-Received: by 2002:ac8:7c44:0:b0:403:be5e:9ce7 with SMTP id o4-20020ac87c44000000b00403be5e9ce7mr10026435qtv.64.1689429606815; Sat, 15 Jul 2023 07:00:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689429606; cv=none; d=google.com; s=arc-20160816; b=B+fvDDMW5BxRqe+ec1s8XOF/S0tllM7/svEh/BG9K8P1WZrTlmoRpyWqo1Xrucvz9r mcc89rpyOz3qcbE83Qsvb2SnPCwdCvniJgVH31y2xlBNBqMcr5Mwxm7YFJymizmUdEqv bG/PUdP93QSV/h/SbsW4x+w3B62Kea4MJz/OW/i7TEvtYJgxXf5aEun7zeI72Of0OTLs Zald2bDYd8FVPri57ywsQRr18EZBQ0wQKuUA/25+hzqMmuDfkTmM3+jHWbwJewo4cvnD oTsPr1Fyb6ieVfhSlyQO0ag3KoWg9DdGi7gc7FUqr3F35hYdOJ7KEzhGuy9XdVU92jjV ekRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=viFchcHGsP+nKMHrpwcA4jNmykwjrSvjDrmv/nDVIvw=; fh=ZuLSLtzpwbOj79Lm6HQkAzCl7AYBeBRT4Q/1zeFcrQg=; b=VjZUAlXxSDxKIV0zEAjJwPO/nL+/YEGJxwtbf+DplCKDse0+fHouTE7YWOrRU8Fxr4 9kga0kvYW5lpLrVY789b0grlYABo6UTZ+D2CQjdRdXNG32rUTT1fBmtb8WET2MGrhk7B 5/ulct0hMVTeVqHhIxK6H+VanxYcpO0bzhnpG6amUdb0zcv5WpL+A/wScQ0noD6E/+9K 8cRzN+g2zeFyfU0enNQO8vPQQIFG/1Sm4ta0h8gKW3shHwli45hs6pN5YEq5ifnEz5xE 3E+jL8Y//rp84IlNozvY9Key9g1OTZGdVNBhJNNj+Ei3j9hELMOnjevLI0JfxdVa+C7B 4JKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pnld6Wn9; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id z26-20020a0c8f1a000000b006377ab7c9edsi5835099qvd.508.2023.07.15.07.00.06 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 15 Jul 2023 07:00:06 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pnld6Wn9; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qKfjj-0006WQ-LP; Sat, 15 Jul 2023 09:55:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qKfiR-000466-4Y for qemu-devel@nongnu.org; Sat, 15 Jul 2023 09:53:47 -0400 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qKfiP-0001Is-LZ for qemu-devel@nongnu.org; Sat, 15 Jul 2023 09:53:42 -0400 Received: by mail-wr1-x42b.google.com with SMTP id ffacd0b85a97d-307d58b3efbso2971675f8f.0 for ; Sat, 15 Jul 2023 06:53:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689429220; x=1692021220; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=viFchcHGsP+nKMHrpwcA4jNmykwjrSvjDrmv/nDVIvw=; b=pnld6Wn9wt7S295hr6wOEUse81Ubsg6JhK81XigM8Ow7P/8V3lj46tf0gVRZZwlBle dvpp8c9bZBagQspOOc+jTqzII+CiVY7L4SI/qWq0+Md6ROon/6B1np7zXF9yAbcJEVg0 gCiEGEZpdKddUyy2gMYeHKIxlVC84gy73CcJZ2Pye01k2SfsTAa2UAkTIBHVdLP+STP8 7Fpv7Xz7t00IyJWpsLzHO69iLmP14aiDpFN5fdKDT5oImTfE49a0m+CEdV0C717vwvMA O3I+Qr/l5BOhLIKp+eaI1bviY6woyegSbxcuWfB04t4umgq5a23pGXYko+mixy7sL/29 uNPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689429220; x=1692021220; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=viFchcHGsP+nKMHrpwcA4jNmykwjrSvjDrmv/nDVIvw=; b=B/kboN6ISWH3OpC+HMa8/9UnelDTYZLEXWwk5RRtuZco2UnxRmAkLjBumKkc0gdJL8 szvdTcyFdq8+c3GSTnrJmnMJM0IH8rwZUFPYySnF/c6NMNILukn27+oE+P756uTqdLde M/3LOy+siIqCnMHiuMuXZ5prrTs4yiZkaXmaGBP9Av5BaXHYPKJNYtWzvSiVA6XOZJr3 8a/1gNccIqXKSd+ZkmB/QLiIZASmajSA7pjWtN9Ys+bRQfTV/5vdzICghIYJWkOXupID gaBkMUjBJaOfp8pMMCUSAL3/HRl0EVGuJYcYK2ka/Bry0gSDvamnOvuykaz3rZTT3pb+ WWsw== X-Gm-Message-State: ABy/qLbgqsqoyLSmYUmGAs7/m6OuGIsAK8NuFud+cIgrX0viS6St6E9+ awuwMgi4eWx5ABzBDRDNodocJrGU2W528Y1OojTYhQ== X-Received: by 2002:adf:d84e:0:b0:313:f6bb:ec2b with SMTP id k14-20020adfd84e000000b00313f6bbec2bmr5756555wrl.47.1689429220394; Sat, 15 Jul 2023 06:53:40 -0700 (PDT) Received: from stoup.lan ([51.219.12.49]) by smtp.gmail.com with ESMTPSA id k10-20020a5d66ca000000b00313f9085119sm13838014wrw.113.2023.07.15.06.53.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Jul 2023 06:53:39 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Alex_Benn=C3=A9e?= Subject: [PULL 26/47] accel/tcg: Introduce page_check_range_empty Date: Sat, 15 Jul 2023 14:52:56 +0100 Message-Id: <20230715135317.7219-27-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230715135317.7219-1-richard.henderson@linaro.org> References: <20230715135317.7219-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42b; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x42b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Examine the interval tree to validate that a region has no existing mappings. Reviewed-by: Alex Bennée Signed-off-by: Richard Henderson Message-Id: <20230707204054.8792-10-richard.henderson@linaro.org> --- include/exec/cpu-all.h | 12 ++++++++++++ accel/tcg/user-exec.c | 7 +++++++ 2 files changed, 19 insertions(+) diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h index 472fe9ad9c..94f828b109 100644 --- a/include/exec/cpu-all.h +++ b/include/exec/cpu-all.h @@ -224,6 +224,18 @@ void page_set_flags(target_ulong start, target_ulong last, int flags); void page_reset_target_data(target_ulong start, target_ulong last); int page_check_range(target_ulong start, target_ulong len, int flags); +/** + * page_check_range_empty: + * @start: first byte of range + * @last: last byte of range + * Context: holding mmap lock + * + * Return true if the entire range [@start, @last] is unmapped. + * The memory lock must be held so that the caller will can ensure + * the result stays true until a new mapping can be installed. + */ +bool page_check_range_empty(target_ulong start, target_ulong last); + /** * page_get_target_data(address) * @address: guest virtual address diff --git a/accel/tcg/user-exec.c b/accel/tcg/user-exec.c index d95b875a6a..ab684a3ea2 100644 --- a/accel/tcg/user-exec.c +++ b/accel/tcg/user-exec.c @@ -598,6 +598,13 @@ int page_check_range(target_ulong start, target_ulong len, int flags) return ret; } +bool page_check_range_empty(target_ulong start, target_ulong last) +{ + assert(last >= start); + assert_memory_lock(); + return pageflags_find(start, last) == NULL; +} + void page_protect(tb_page_addr_t address) { PageFlagsNode *p; From patchwork Sat Jul 15 13:52:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 703217 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e4d:0:b0:314:25da:8dc4 with SMTP id r13csp157145wrt; Sat, 15 Jul 2023 06:55:31 -0700 (PDT) X-Google-Smtp-Source: APBJJlEEYvOezDCn13xF+cxI019VO1W82Itl5GL5dREyYzOA9STrXZ32n5uhoo5aX3YW+AWjacMF X-Received: by 2002:ac8:5a8e:0:b0:403:3583:68eb with SMTP id c14-20020ac85a8e000000b00403358368ebmr8713887qtc.19.1689429331271; Sat, 15 Jul 2023 06:55:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689429331; cv=none; d=google.com; s=arc-20160816; b=s35TwGnzZwBm1piFH1uaSZe3wm2BBB4aD8YKjzPIrrUDHST0iI/AudjsxJIygxBmp2 ySxJeaUHzM3w9sdtHI2jPjJ1iWrRTma/DYpiNs6ToGAAdS6zQb/ySGof5inI0SjQixx1 HHO8UmIpRbir0J00SLLR5MICxnCspN7SFlQRw2rRCbm5XncHCBY+U+uEB01IES4hKt5E lOd6g3JQN1WcT/RcbQhQkb/0p2dv9SwKMYMYyzz0/dejuocUwWjS3UFRCGJhHuULZi8t HmUbgh80sN9QwWcha0JJzFAj53fbmiNR34X7wB0nqYp5n4qRTBaj7MnraoRg9X0ZD6GB Mmbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ZraICE1rSSuyJwFU+r8vOCOFS1v3NI7u5DpDqpVSLj4=; fh=n5QY4Tpv4/lI7qJJHJjODuMehB6ug+e1S/4zpncWpMY=; b=lZZd70nfJy274h4hv95lmdVlMvrkxPIT9nRJz4ELzEFPaSqcfqb7SgJRYlqOE/5vTc u74LSi0ZxmDbjWOraGXCWOJai0WGJ91sR6P+1i9z7xSDpu0jRvVkHCzn9d5rFUF71OAu 2ldbfmvt9Q33oGIgBK53o4g4Dh2y3hv84N9eJwSAGJGvRix94t1qGfKyzFXqKbvpmxJ8 9bKCYKZ9L75WHUeZ0W8+zOLbkNUBAOgwiUlMOg7OouOWAqx0BUJLMXqnQHJIOsjDKGLX qwvxEBG/BK/c+zd/jgHsF3VrA0ODTjqZQH1/cTChmKvzasO4Q60ry3l1zMGdVXrhyGC6 cvTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HYaI6atZ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id u13-20020a05622a010d00b00403a3001308si5924940qtw.197.2023.07.15.06.55.31 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 15 Jul 2023 06:55:31 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HYaI6atZ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qKfiz-0004Wq-Ox; Sat, 15 Jul 2023 09:54:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qKfiX-00047o-QE for qemu-devel@nongnu.org; Sat, 15 Jul 2023 09:53:51 -0400 Received: from mail-lf1-x12b.google.com ([2a00:1450:4864:20::12b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qKfiR-0001JA-PL for qemu-devel@nongnu.org; Sat, 15 Jul 2023 09:53:48 -0400 Received: by mail-lf1-x12b.google.com with SMTP id 2adb3069b0e04-4fb7589b187so4758393e87.1 for ; Sat, 15 Jul 2023 06:53:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689429221; x=1692021221; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ZraICE1rSSuyJwFU+r8vOCOFS1v3NI7u5DpDqpVSLj4=; b=HYaI6atZuOFWX/lNaR6czwKdnlIwNyXfftQGPYPTeXRgBrO+uCJoalpekxMHGszfqd 4kRTOmZssF4JQALW+Io1TFHfV0JMaI+r+/nW0KmOnACvnS4zPzSBJQJhaGPdv8RroUcp 4CH/jZZ4M0bot94PE98thNMfJ4YnHXhSKanfIp/0oQ55lWhgQ+btCaMAd0I1PunaEzsk nNINaAQVJpmzFE178OFg7mu1qgbQHijHui+ney+PbiLeFeejdU83k6h4V5+GAl31zxa1 lVQwPTOaivdJJdyq8/f0BrVwRxC6ExI0zE23UhIMLU7MqEBR4YFvlYp+JgiEDv9TTaOR TsiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689429221; x=1692021221; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ZraICE1rSSuyJwFU+r8vOCOFS1v3NI7u5DpDqpVSLj4=; b=DTWlpSSYnb69HakhUW2TKj4zuvy8u6jQjnLzXQV2mcsWdJKg/CeYpd0Ke5U8ulGju6 CuPkCPAKcIN/V4yRFxv0wm48ZW1KJUhcpt394DVgi96WUNP1VreRKs+juQJ+azvKb2J3 Yrir3MjZX/BXjMR7dkG19C+CgwN0ADiewJ52KbNPo1vqGVdR/BxyrnSI3zaCAzsaYRdu Y4ZEQF9/LFG8taWX03eL/0BHDmMhBGdf65jAdtCoCDN/fl3g+GWtgn3mM1rWYN7owyF6 M/H0zI54chk/sKmeUMJz2Tmma5zHG6bUsS/K78Mdwq+OEUpnv7N72IuLUvwH/mSya1CW lcCQ== X-Gm-Message-State: ABy/qLYfeOmvf4l2xGi6fSa5BgIncto0JpQFOrq8AbYzgAPr5E3qFD3k foLs+nS8Dl6IMpl4RdpLgXndfFaRX6orrneapwRRTg== X-Received: by 2002:a05:6512:45a:b0:4f8:5696:6bbc with SMTP id y26-20020a056512045a00b004f856966bbcmr4467263lfk.29.1689429221141; Sat, 15 Jul 2023 06:53:41 -0700 (PDT) Received: from stoup.lan ([51.219.12.49]) by smtp.gmail.com with ESMTPSA id k10-20020a5d66ca000000b00313f9085119sm13838014wrw.113.2023.07.15.06.53.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Jul 2023 06:53:40 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Warner Losh , Kyle Evans Subject: [PULL 27/47] bsd-user: Use page_check_range_empty for MAP_EXCL Date: Sat, 15 Jul 2023 14:52:57 +0100 Message-Id: <20230715135317.7219-28-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230715135317.7219-1-richard.henderson@linaro.org> References: <20230715135317.7219-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::12b; envelope-from=richard.henderson@linaro.org; helo=mail-lf1-x12b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org The previous check returned -1 when any page within [start, start+len) is unmapped, not when all are unmapped. Cc: Warner Losh Cc: Kyle Evans Signed-off-by: Richard Henderson Reviewed-by: Warner Losh Message-Id: <20230707204054.8792-11-richard.henderson@linaro.org> --- bsd-user/mmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bsd-user/mmap.c b/bsd-user/mmap.c index 565b9f97ed..07b5b8055e 100644 --- a/bsd-user/mmap.c +++ b/bsd-user/mmap.c @@ -609,7 +609,7 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int prot, } /* Reject the mapping if any page within the range is mapped */ - if ((flags & MAP_EXCL) && page_check_range(start, len, 0) < 0) { + if ((flags & MAP_EXCL) && !page_check_range_empty(start, end - 1)) { errno = EINVAL; goto fail; } From patchwork Sat Jul 15 13:52:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 703243 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e4d:0:b0:314:25da:8dc4 with SMTP id r13csp158829wrt; Sat, 15 Jul 2023 07:00:07 -0700 (PDT) X-Google-Smtp-Source: APBJJlGIKduGbbepX2NB6f4birgsJP7fP0ofyp0bo3MCDWapfkfBZP96fnYaKRZQ8H/QvA/V6jQZ X-Received: by 2002:a05:620a:1a92:b0:767:1cd5:3456 with SMTP id bl18-20020a05620a1a9200b007671cd53456mr9987139qkb.39.1689429606984; Sat, 15 Jul 2023 07:00:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689429606; cv=none; d=google.com; s=arc-20160816; b=M3rh27byxXrwVQaVRG9h5O6v91zDI41SdwD+lb88mR7af8Q3rsq9cbGtdtF7i8mM/H CSBE3XI7y2iFyJ548pblBxRZAEGPabuWNllPAER2P2fNXuJ25yZbrcvOR3c04LOyG+4p Z4N7/H/3zwQY/j+X6SStKcsnPBxDmkKJJ1UFX3phVoH+LsglBNdqDwyzdlSI+l/bFPvN Dt2uinoFDtRhdN5aaphW+1QdIYg8Md12O1qivtLaHauLoxarVHs21DmnuNC54Fez0qF4 EefSLOTchZf2+lBd3Lfo1XoJl/1s4z0CN60FCIDnId0bQ/KU31pAqFKpsQDa/8Mosr3g MSmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=QVp7bvOVNX9kOQlZjcnMWNBhc4o39/6I/4Tb+lJViFc=; fh=oYAd+8Lj9FKlReeF9hgENQXa3P4LhBP5C4njRBbobDA=; b=SIdMgAKI1fcKzse42mfk2a1zCJRf8+3Doo856utYPW/8ot/d3z0NFZsqRmCzmCHZoO rGD7fJNu2tl5KGD8OK32ZT0U8vjqx4w4Oc9wKxx2c6k3Due0BRCYMoiqIAp76e71Gr84 GRd2QDfptfB7QJYYSjTNbSk5QO6JRRpOoURONTwnYYyeA0Hr58piPegq0a9dOwa1lvs/ cCuEgb2Ut0VYBjfMzmkfQaSXQNstaIuYQweEanLIqRIjK/GC3ylRnk7Z6crqyESYuWen 1w/ex9Ebpl2fl+25FMf6dQWPqEVpU2WiMcuuIEceQpRgra0mbVDzY2y9mbrDwziHYyxo /SIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XtKFtlKt; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id a15-20020a05622a064f00b00403a49182b3si5583344qtb.579.2023.07.15.07.00.06 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 15 Jul 2023 07:00:06 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XtKFtlKt; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qKfjn-0007Aa-3e; Sat, 15 Jul 2023 09:55:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qKfiX-00047p-Qy for qemu-devel@nongnu.org; Sat, 15 Jul 2023 09:53:51 -0400 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qKfiR-0001JC-Qc for qemu-devel@nongnu.org; Sat, 15 Jul 2023 09:53:48 -0400 Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-3fbdfda88f4so25773525e9.1 for ; Sat, 15 Jul 2023 06:53:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689429222; x=1692021222; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=QVp7bvOVNX9kOQlZjcnMWNBhc4o39/6I/4Tb+lJViFc=; b=XtKFtlKtko5uNMNACbbQ8r4U2tisRfWIEcBb7Hisl4tuzSAwhWmJUppQ+Wo75Ra0OP 0aLh6cpShYGhnrovksSTlYIfe9jgyrerjJimiIPUzL9tT5LhwWNT0Ts9JKLtNFSzEr26 lb9wg9q5jVyRJyiU4ve3H5DRlmkGC7IC8zwrorouHPqrlqTzlve6gY9vOXWaDKGDGb3s kH4Hy7N8i9tD6ag/FHbInrfnW9YtDwyQEY+up6SKoLpJopqrItwW8q6V4cbnuc65yVDu qtN4jfcPbhow2pX+0l/q9lreJnUf3IxLmtLvnaUMXjnFsrEDI3ZO3N6hMCABXVFNU9d9 iFUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689429222; x=1692021222; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=QVp7bvOVNX9kOQlZjcnMWNBhc4o39/6I/4Tb+lJViFc=; b=QTKZv7axUHLiPxrehzkLOpHKyDF0hN1sjQuL/TaH5JgsPBtchHWOpN4m0zvYAAdZmM X889mS1pL8pYcincts2RGf+xzmoY/PzqM8VCcQEmswTuHBUdw5cWlBE8G248OVbx2YUz qJD6s8vowGxBkQSXMFNZpm11zJkIy2NrDnS4A2i9wWxhdhWDAaiwrXNFkPTEp6v3AyG7 5gsEaLf2qTiE4G1sSVCQG2qPgWixTg3OElDtR74C+Bg47F/wHIpQgPl90DSO5mKlGiVB 1QGlZVvY6rRKv3ZaOn5PpDbemyPcjNkWQCmOIRLqhA1fjgJvV2C6nLlqf2i3Q09SvAqa auew== X-Gm-Message-State: ABy/qLb0303xeDByTMbbLGJgisbCzFaSeD3pVZhY5EmG9OALkkO6oeEH JXCjh5kguOzoK/fI30WlrWlYr4Mo/PkeqpTk55mE4Q== X-Received: by 2002:adf:fe49:0:b0:314:1ca4:dbd9 with SMTP id m9-20020adffe49000000b003141ca4dbd9mr6080779wrs.27.1689429221787; Sat, 15 Jul 2023 06:53:41 -0700 (PDT) Received: from stoup.lan ([51.219.12.49]) by smtp.gmail.com with ESMTPSA id k10-20020a5d66ca000000b00313f9085119sm13838014wrw.113.2023.07.15.06.53.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Jul 2023 06:53:41 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 28/47] linux-user: Implement MAP_FIXED_NOREPLACE Date: Sat, 15 Jul 2023 14:52:58 +0100 Message-Id: <20230715135317.7219-29-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230715135317.7219-1-richard.henderson@linaro.org> References: <20230715135317.7219-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::331; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x331.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Signed-off-by: Richard Henderson Message-Id: <20230707204054.8792-12-richard.henderson@linaro.org> --- linux-user/mmap.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/linux-user/mmap.c b/linux-user/mmap.c index 639921dba0..9dc34fc29d 100644 --- a/linux-user/mmap.c +++ b/linux-user/mmap.c @@ -509,7 +509,7 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int target_prot, * If the user is asking for the kernel to find a location, do that * before we truncate the length for mapping files below. */ - if (!(flags & MAP_FIXED)) { + if (!(flags & (MAP_FIXED | MAP_FIXED_NOREPLACE))) { host_len = len + offset - host_offset; host_len = HOST_PAGE_ALIGN(host_len); start = mmap_find_vma(real_start, host_len, TARGET_PAGE_SIZE); @@ -551,7 +551,7 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int target_prot, } } - if (!(flags & MAP_FIXED)) { + if (!(flags & (MAP_FIXED | MAP_FIXED_NOREPLACE))) { unsigned long host_start; void *p; @@ -600,6 +600,13 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int target_prot, goto fail; } + /* Validate that the chosen range is empty. */ + if ((flags & MAP_FIXED_NOREPLACE) + && !page_check_range_empty(start, end - 1)) { + errno = EEXIST; + goto fail; + } + /* * worst case: we cannot map the file because the offset is not * aligned, so we read it @@ -615,7 +622,8 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int target_prot, goto fail; } retaddr = target_mmap(start, len, target_prot | PROT_WRITE, - MAP_FIXED | MAP_PRIVATE | MAP_ANONYMOUS, + (flags & (MAP_FIXED | MAP_FIXED_NOREPLACE)) + | MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); if (retaddr == -1) { goto fail; From patchwork Sat Jul 15 13:52:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 703209 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e4d:0:b0:314:25da:8dc4 with SMTP id r13csp156666wrt; Sat, 15 Jul 2023 06:54:14 -0700 (PDT) X-Google-Smtp-Source: APBJJlF5UXpmcAQQMZomatE5WN3M8RR67BBXhfYwe+ZZ//GCebVTaq1wJ3FJvIHdbCkq6DyW8ea+ X-Received: by 2002:a05:620a:29d3:b0:763:d32b:507f with SMTP id s19-20020a05620a29d300b00763d32b507fmr10890399qkp.48.1689429254022; Sat, 15 Jul 2023 06:54:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689429254; cv=none; d=google.com; s=arc-20160816; b=oZw9NjxlNmlH0gbBJSiKZmVBomQiVvM/XOQ20kov5xrKqL74UNem10q2Uzc9JKLOhR cg2HCcLRW7NubxCyAWhwf89TCe1peeMO4CWX9QIFPZe5ZXcoy53p/Rf3oDyvGz0+5hDU bDpnrc36YatzUrQI37Ok1N5LrfgFWZbZcdwtC8hvRBdtM9pbSxu8c1fElQ19FeHFBxtU 9WPSXjznRx+OsYSmtGB6HX7TnlwJKXm41x25VkkBTBgS8aZiAfgEmj0/78sBZAf4B86u bAREFdnBdthwFgHYoPaPeu1fLeC/Ncz9LrrU5yIEQrnmeju7JvzyW5tnwcPN7xZX47hA TbDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=7S8fJjWsfM8/RKnCcasDShb0DLhg94fNTjj77rs37DE=; fh=ZuLSLtzpwbOj79Lm6HQkAzCl7AYBeBRT4Q/1zeFcrQg=; b=bkjGhkzph9OQ1gl92dttsgzEKCxN3kryHUtSdMbURkP7jSnJ5TAnDzfuY1L+qXhj+f fcJNUVpwWnrldotQX3qPQ3dO4RTDb8eAsw6SlMoYCn4zyo+juegpwAWt+eNMCoUXfrzb sh6f6zpDgQJsT9Uf1/AK4awa6jAjxrUWviD3T5XRUBaD7+sJzcJ11DBRPH63/KSEpg6d bsmARfu30qogbjIHb6+/ggcam8O6KVcmQ6JvGHLXAWOIeo7f10K0IeXy/Nce0t6iYPgU QWQFgNFDjoBIe4nkvqFvZ386O69IuFflELEAgYGZA8FZSdGedCHB8045UiAxRPO2pXDx oVhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=adaWzhfJ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 16-20020a05620a049000b00767ee53f0absi4499243qkr.340.2023.07.15.06.54.13 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 15 Jul 2023 06:54:14 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=adaWzhfJ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qKfir-0004EZ-Tg; Sat, 15 Jul 2023 09:54:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qKfia-00048U-11 for qemu-devel@nongnu.org; Sat, 15 Jul 2023 09:53:55 -0400 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qKfiS-0001JI-DW for qemu-devel@nongnu.org; Sat, 15 Jul 2023 09:53:50 -0400 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-3fbc6ab5ff5so25921965e9.1 for ; Sat, 15 Jul 2023 06:53:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689429222; x=1692021222; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=7S8fJjWsfM8/RKnCcasDShb0DLhg94fNTjj77rs37DE=; b=adaWzhfJF68woo4+Ou6nQ8GniG7eOI2oqpAo541kTPodiLeBQdzXXThSJFxkClIIwn NEH/+nRihFFVkaiWvdCbUXxtjHMdXyIjVtA/dnKotNd4z5kMp1ssDfSCmC68FZmQqB5c TPFstxkoQSXgUaPsN27n149DiBH3v3e5rKzGfPQPIcb/ZjFgpd3YFVtfISi6KATBYV2a 9AKdmCReILDEEjUCxhZITwCyD2WTRX0Qp+8rXNWB+PM7T4Gl6+tosvb1ELJrf83qDxWK i22EmlgF1/xczTPJ5CPkcHpiqyHX2vAXN0PhFPvGVudsxmw6ai0TozIsFbpEzB6LKptk p54A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689429222; x=1692021222; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7S8fJjWsfM8/RKnCcasDShb0DLhg94fNTjj77rs37DE=; b=ebtcNmF0KRRaYKvM286XfEFknp7eFJqyQUOCyjepSjS1lO7puzagoB5UJu0bU5bFqk lrntvY7EdovyhVkrss7E//2TuS9C7RFOM4Ky68202An9jQzkz68O1h6auuKHfuBopdYX Cm65JxN13HKSW4B0Z4CW2NoHF9472bIIVQpxFiBCcKIHCXIfJLeWV1EJChr53a1ka13C xQ5LwH8PuKd1ji5z0+7DRNs6wP9gUMNY5WeCECxdmWTvuSJfEitRa7HYfS01QWA8y7S+ Ay8E6bdOmqwk7YgYbVFHkKOcvoGWLgObmAjba6CXAtB1AXdXAFchZZomS9Dt+AHdOdvX ew9A== X-Gm-Message-State: ABy/qLZheDBIBtpClnGzFQyyEvvuQsn9X7+Ux6k04Kphu6M1PFYT5PP0 GnKkf2sYQJGynDug/Tdh8Ih9J22+cOkaMKQrrlV0mw== X-Received: by 2002:adf:ea4a:0:b0:316:e422:38e8 with SMTP id j10-20020adfea4a000000b00316e42238e8mr7550246wrn.66.1689429222400; Sat, 15 Jul 2023 06:53:42 -0700 (PDT) Received: from stoup.lan ([51.219.12.49]) by smtp.gmail.com with ESMTPSA id k10-20020a5d66ca000000b00313f9085119sm13838014wrw.113.2023.07.15.06.53.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Jul 2023 06:53:42 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Alex_Benn=C3=A9e?= Subject: [PULL 29/47] linux-user: Split out target_to_host_prot Date: Sat, 15 Jul 2023 14:52:59 +0100 Message-Id: <20230715135317.7219-30-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230715135317.7219-1-richard.henderson@linaro.org> References: <20230715135317.7219-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x334.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Split out from validate_prot_to_pageflags, as there is not one single host_prot for the entire range. We need to adjust prot for every host page that overlaps multiple guest pages. Reviewed-by: Alex Bennée Signed-off-by: Richard Henderson Message-Id: <20230707204054.8792-13-richard.henderson@linaro.org> --- linux-user/mmap.c | 78 ++++++++++++++++++++++++++--------------------- 1 file changed, 44 insertions(+), 34 deletions(-) diff --git a/linux-user/mmap.c b/linux-user/mmap.c index 9dc34fc29d..12b1308a83 100644 --- a/linux-user/mmap.c +++ b/linux-user/mmap.c @@ -69,24 +69,11 @@ void mmap_fork_end(int child) * Return 0 if the target prot bitmask is invalid, otherwise * the internal qemu page_flags (which will include PAGE_VALID). */ -static int validate_prot_to_pageflags(int *host_prot, int prot) +static int validate_prot_to_pageflags(int prot) { int valid = PROT_READ | PROT_WRITE | PROT_EXEC | TARGET_PROT_SEM; int page_flags = (prot & PAGE_BITS) | PAGE_VALID; - /* - * For the host, we need not pass anything except read/write/exec. - * While PROT_SEM is allowed by all hosts, it is also ignored, so - * don't bother transforming guest bit to host bit. Any other - * target-specific prot bits will not be understood by the host - * and will need to be encoded into page_flags for qemu emulation. - * - * Pages that are executable by the guest will never be executed - * by the host, but the host will need to be able to read them. - */ - *host_prot = (prot & (PROT_READ | PROT_WRITE)) - | (prot & PROT_EXEC ? PROT_READ : 0); - #ifdef TARGET_AARCH64 { ARMCPU *cpu = ARM_CPU(thread_cpu); @@ -114,18 +101,34 @@ static int validate_prot_to_pageflags(int *host_prot, int prot) return prot & ~valid ? 0 : page_flags; } +/* + * For the host, we need not pass anything except read/write/exec. + * While PROT_SEM is allowed by all hosts, it is also ignored, so + * don't bother transforming guest bit to host bit. Any other + * target-specific prot bits will not be understood by the host + * and will need to be encoded into page_flags for qemu emulation. + * + * Pages that are executable by the guest will never be executed + * by the host, but the host will need to be able to read them. + */ +static int target_to_host_prot(int prot) +{ + return (prot & (PROT_READ | PROT_WRITE)) | + (prot & PROT_EXEC ? PROT_READ : 0); +} + /* NOTE: all the constants are the HOST ones, but addresses are target. */ int target_mprotect(abi_ulong start, abi_ulong len, int target_prot) { abi_ulong end, host_start, host_end, addr; - int prot1, ret, page_flags, host_prot; + int prot1, ret, page_flags; trace_target_mprotect(start, len, target_prot); if ((start & ~TARGET_PAGE_MASK) != 0) { return -TARGET_EINVAL; } - page_flags = validate_prot_to_pageflags(&host_prot, target_prot); + page_flags = validate_prot_to_pageflags(target_prot); if (!page_flags) { return -TARGET_EINVAL; } @@ -143,7 +146,7 @@ int target_mprotect(abi_ulong start, abi_ulong len, int target_prot) host_end = HOST_PAGE_ALIGN(end); if (start > host_start) { /* handle host page containing start */ - prot1 = host_prot; + prot1 = target_prot; for (addr = host_start; addr < start; addr += TARGET_PAGE_SIZE) { prot1 |= page_get_flags(addr); } @@ -154,19 +157,19 @@ int target_mprotect(abi_ulong start, abi_ulong len, int target_prot) end = host_end; } ret = mprotect(g2h_untagged(host_start), qemu_host_page_size, - prot1 & PAGE_BITS); + target_to_host_prot(prot1)); if (ret != 0) { goto error; } host_start += qemu_host_page_size; } if (end < host_end) { - prot1 = host_prot; + prot1 = target_prot; 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), - qemu_host_page_size, prot1 & PAGE_BITS); + qemu_host_page_size, target_to_host_prot(prot1)); if (ret != 0) { goto error; } @@ -175,8 +178,8 @@ int target_mprotect(abi_ulong start, abi_ulong len, int target_prot) /* handle the pages in the middle */ if (host_start < host_end) { - ret = mprotect(g2h_untagged(host_start), - host_end - host_start, host_prot); + ret = mprotect(g2h_untagged(host_start), host_end - host_start, + target_to_host_prot(target_prot)); if (ret != 0) { goto error; } @@ -212,7 +215,8 @@ static int mmap_frag(abi_ulong real_start, if (prot1 == 0) { /* no page was there, so we allocate one */ - void *p = mmap(host_start, qemu_host_page_size, prot, + void *p = mmap(host_start, qemu_host_page_size, + target_to_host_prot(prot), flags | MAP_ANONYMOUS, -1, 0); if (p == MAP_FAILED) { return -1; @@ -233,7 +237,8 @@ static int mmap_frag(abi_ulong real_start, /* adjust protection to be able to read */ if (!(prot1 & PROT_WRITE)) { - mprotect(host_start, qemu_host_page_size, prot1 | PROT_WRITE); + mprotect(host_start, qemu_host_page_size, + target_to_host_prot(prot1) | PROT_WRITE); } /* read the corresponding file data */ @@ -243,11 +248,13 @@ static int mmap_frag(abi_ulong real_start, /* put final protection */ if (prot_new != (prot1 | PROT_WRITE)) { - mprotect(host_start, qemu_host_page_size, prot_new); + mprotect(host_start, qemu_host_page_size, + target_to_host_prot(prot_new)); } } else { if (prot_new != prot1) { - mprotect(host_start, qemu_host_page_size, prot_new); + mprotect(host_start, qemu_host_page_size, + target_to_host_prot(prot_new)); } if (prot_new & PROT_WRITE) { memset(g2h_untagged(start), 0, end - start); @@ -460,7 +467,7 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int target_prot, { abi_ulong ret, end, real_start, real_end, retaddr, host_offset, host_len, passthrough_start = -1, passthrough_end = -1; - int page_flags, host_prot; + int page_flags; mmap_lock(); trace_target_mmap(start, len, target_prot, flags, fd, offset); @@ -470,7 +477,7 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int target_prot, goto fail; } - page_flags = validate_prot_to_pageflags(&host_prot, target_prot); + page_flags = validate_prot_to_pageflags(target_prot); if (!page_flags) { errno = EINVAL; goto fail; @@ -553,10 +560,12 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int target_prot, if (!(flags & (MAP_FIXED | MAP_FIXED_NOREPLACE))) { unsigned long host_start; + int host_prot; void *p; host_len = len + offset - host_offset; host_len = HOST_PAGE_ALIGN(host_len); + host_prot = target_to_host_prot(target_prot); /* * Note: we prefer to control the mapping address. It is @@ -617,7 +626,8 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int target_prot, * msync() won't work here, so we return an error if write is * possible while it is a shared mapping */ - if ((flags & MAP_TYPE) == MAP_SHARED && (host_prot & PROT_WRITE)) { + if ((flags & MAP_TYPE) == MAP_SHARED + && (target_prot & PROT_WRITE)) { errno = EINVAL; goto fail; } @@ -631,7 +641,7 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int target_prot, if (pread(fd, g2h_untagged(start), len, offset) == -1) { goto fail; } - if (!(host_prot & PROT_WRITE)) { + if (!(target_prot & PROT_WRITE)) { ret = target_mprotect(start, len, target_prot); assert(ret == 0); } @@ -643,14 +653,14 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int target_prot, if (real_end == real_start + qemu_host_page_size) { /* one single host page */ ret = mmap_frag(real_start, start, end, - host_prot, flags, fd, offset); + target_prot, flags, fd, offset); if (ret == -1) { goto fail; } goto the_end1; } ret = mmap_frag(real_start, start, real_start + qemu_host_page_size, - host_prot, flags, fd, offset); + target_prot, flags, fd, offset); if (ret == -1) { goto fail; } @@ -660,7 +670,7 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int target_prot, if (end < real_end) { ret = mmap_frag(real_end - qemu_host_page_size, real_end - qemu_host_page_size, end, - host_prot, flags, fd, + target_prot, flags, fd, offset + real_end - qemu_host_page_size - start); if (ret == -1) { goto fail; @@ -678,7 +688,7 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int target_prot, offset1 = offset + real_start - start; } p = mmap(g2h_untagged(real_start), real_end - real_start, - host_prot, flags, fd, offset1); + target_to_host_prot(target_prot), flags, fd, offset1); if (p == MAP_FAILED) { goto fail; } From patchwork Sat Jul 15 13:53:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 703222 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e4d:0:b0:314:25da:8dc4 with SMTP id r13csp157272wrt; Sat, 15 Jul 2023 06:55:51 -0700 (PDT) X-Google-Smtp-Source: APBJJlGSdcfBeLKLGiSZ+Sxxs8ZQCuLu1iFZK5X6i2uF4yl+1g16ngEWML0+KVta0WktmzH2ydbA X-Received: by 2002:ac8:5cce:0:b0:403:691f:5403 with SMTP id s14-20020ac85cce000000b00403691f5403mr9792426qta.67.1689429351436; Sat, 15 Jul 2023 06:55:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689429351; cv=none; d=google.com; s=arc-20160816; b=dJHhJPzeyOIXIGKFhTrBFT4z4cMNQOcmTk56mCq7VTCkzNf9TSPxnHHd98aBemG1Eb vOfIF/J5rn/KGp6uhxGg9vuWAZjuNtwi+57Vr1FB8PntxoR67i0mQv3Ghk02PTLQvvBD tPc+sbmq8Ke/RWBf8tDGnc0Gq5PmPnAx7z+exI2auH1Jhg9/1SRPcS6qQ6OX3bEA9k1H pUgrJ+8Gc/zcB5+Yy1YNGpPgT+0TJdVGUr0XR0oOqHZcPyd9vl6/yGYgrfkFJMkSpPGh YxJ3MyTeyMeSHL5DGzfxOie2SwlBPi+vng3RmU6umAGDn1f57zp/euhKY1nwEhTWEl3U OcGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Fokkd6so43K12JUZOnDmBsniw0YcAJ7z1i5mex4l2TY=; fh=ZuLSLtzpwbOj79Lm6HQkAzCl7AYBeBRT4Q/1zeFcrQg=; b=1GxUMHV/ExRflXfLUZ0aOUBJTwouk353mlp995dZgMmsDxVX/7hshYKCSZqPSHLDzy 3KW6XJLCcyFBrc/Bo53pK9PPE3R0s3xHbUbSmXL49je77IX7216gqqZkBjGhdnhz/BH0 GOlMIgdOVJkMRczOlubV6JMxfqsNaZMcupMdda5oFjrbM5DrPXMQZruvaSAQkAd4IxXZ q4rQuIBii9pLuuSZdxXGaQNeBotxd3W+dUFNrMEi7Kakq4eHV1QU0O6r/YJYyiIMzbbh vRP7qHXj9kvRtgjckFOYlAnr63uWk8fVkj2ZPxM807N1DJunFkQl2BXeMgc021l0TPjH IkTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="QaR3sF//"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id c7-20020ac85a87000000b0040357383472si5788315qtc.256.2023.07.15.06.55.50 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 15 Jul 2023 06:55:51 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="QaR3sF//"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qKfj3-0004ZN-BU; Sat, 15 Jul 2023 09:54:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qKfia-00048Y-22 for qemu-devel@nongnu.org; Sat, 15 Jul 2023 09:53:59 -0400 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qKfiS-0001Jh-FR for qemu-devel@nongnu.org; Sat, 15 Jul 2023 09:53:49 -0400 Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-3159da54e95so2755272f8f.3 for ; Sat, 15 Jul 2023 06:53:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689429223; x=1692021223; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Fokkd6so43K12JUZOnDmBsniw0YcAJ7z1i5mex4l2TY=; b=QaR3sF//XkO8mVzAb1z/ZvnUn8vHEcew6h/biywu1IdsIghKWcWvqmC7cDr61WF83W Vq9A9L6w2gK3F8iSiXq/zG0MOvRDwKo6j7uskk+cp3pDx7G5NN5hmjcTF50PtGCfVy0f obrlLbS/TaN1Q7rV3j8JCnyxOepzAvT0Nnc8xBo7s7Euwuun6j6h0r5fHoaay+HZ72Rg C8ggAVYf6coZHsRVQ0zW5dYGNQp2nXHpN222xFxcAJLdWs1Hzvjz1vjrST5vAOO+fP2q WjXuOsjBqC2/b32xGinHsOCGFG3fF2BEx+ZDGQUV+eWdYDXEUFApVQQouZIbM6SFnVGj 8JDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689429223; x=1692021223; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Fokkd6so43K12JUZOnDmBsniw0YcAJ7z1i5mex4l2TY=; b=HvKkk9hoQkLjiTp4RSZfy6j493ulPwnSccVUmb+IsjCJIU44GvICQ2gkWXBLtOEIYi 9H/aW2CkSunRtl5lG+zSPsQCobdBhyziwkwiVKKk/q5I2GsRhAO5dIRku67+/g1l7WTz 2bkFezE04Zevim5J7kexqXQpkYI5yYl0gHLwG6AvYWFLT4TRs19zNwiiR0UBJ5c5BNOD S163kHkBgvIDR3cHwdLh/nW945pkU008RG8k/OTbpkqYd8dUSdy3eTZNZN1QiT9w4dM1 v0zDrNxkqNyRx+y+Quxv1vxSz1C3st67vPyj42NCK/KeATskT4diYKd5MDXx4MuG6y+E 8aqQ== X-Gm-Message-State: ABy/qLbGRo2pOVo+8XBEnKPDHQ6MxlC7uFcdJN2pG9j/+6jp0Dg2GRn0 lbOjUIz+OavBuKyNoCSLNLo7unchGmy0ZzZc1dPffQ== X-Received: by 2002:a5d:570d:0:b0:315:ad1a:5abc with SMTP id a13-20020a5d570d000000b00315ad1a5abcmr6869984wrv.5.1689429223284; Sat, 15 Jul 2023 06:53:43 -0700 (PDT) Received: from stoup.lan ([51.219.12.49]) by smtp.gmail.com with ESMTPSA id k10-20020a5d66ca000000b00313f9085119sm13838014wrw.113.2023.07.15.06.53.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Jul 2023 06:53:42 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Alex_Benn=C3=A9e?= Subject: [PULL 30/47] linux-user: Widen target_mmap offset argument to off_t Date: Sat, 15 Jul 2023 14:53:00 +0100 Message-Id: <20230715135317.7219-31-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230715135317.7219-1-richard.henderson@linaro.org> References: <20230715135317.7219-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42e; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x42e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org We build with _FILE_OFFSET_BITS=64, so off_t = off64_t = uint64_t. With an extra cast, this fixes emulation of mmap2, which could overflow the computation of the full value of offset. Reviewed-by: Alex Bennée Signed-off-by: Richard Henderson Message-Id: <20230707204054.8792-14-richard.henderson@linaro.org> --- linux-user/user-mmap.h | 2 +- linux-user/mmap.c | 14 ++++++++------ linux-user/syscall.c | 2 +- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/linux-user/user-mmap.h b/linux-user/user-mmap.h index 480ce1c114..3fc986f92f 100644 --- a/linux-user/user-mmap.h +++ b/linux-user/user-mmap.h @@ -20,7 +20,7 @@ int target_mprotect(abi_ulong start, abi_ulong len, int prot); abi_long target_mmap(abi_ulong start, abi_ulong len, int prot, - int flags, int fd, abi_ulong offset); + int flags, int fd, off_t offset); int target_munmap(abi_ulong start, abi_ulong len); abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size, abi_ulong new_size, unsigned long flags, diff --git a/linux-user/mmap.c b/linux-user/mmap.c index 12b1308a83..b2c2d85857 100644 --- a/linux-user/mmap.c +++ b/linux-user/mmap.c @@ -196,7 +196,7 @@ error: /* map an incomplete host page */ static int mmap_frag(abi_ulong real_start, abi_ulong start, abi_ulong end, - int prot, int flags, int fd, abi_ulong offset) + int prot, int flags, int fd, off_t offset) { abi_ulong real_end, addr; void *host_start; @@ -463,11 +463,12 @@ abi_ulong mmap_find_vma(abi_ulong start, abi_ulong size, abi_ulong align) /* NOTE: all the constants are the HOST ones */ abi_long target_mmap(abi_ulong start, abi_ulong len, int target_prot, - int flags, int fd, abi_ulong offset) + int flags, int fd, off_t offset) { - abi_ulong ret, end, real_start, real_end, retaddr, host_offset, host_len, + abi_ulong ret, end, real_start, real_end, retaddr, host_len, passthrough_start = -1, passthrough_end = -1; int page_flags; + off_t host_offset; mmap_lock(); trace_target_mmap(start, len, target_prot, flags, fd, offset); @@ -559,7 +560,7 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int target_prot, } if (!(flags & (MAP_FIXED | MAP_FIXED_NOREPLACE))) { - unsigned long host_start; + uintptr_t host_start; int host_prot; void *p; @@ -578,7 +579,7 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int target_prot, goto fail; } /* update start so that it points to the file position at 'offset' */ - host_start = (unsigned long)p; + host_start = (uintptr_t)p; if (!(flags & MAP_ANONYMOUS)) { p = mmap(g2h_untagged(start), len, host_prot, flags | MAP_FIXED, fd, host_offset); @@ -681,7 +682,8 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int target_prot, /* map the middle (easier) */ if (real_start < real_end) { void *p; - unsigned long offset1; + off_t offset1; + if (flags & MAP_ANONYMOUS) { offset1 = 0; } else { diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 3a89f6b408..a80d33ecf2 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -10591,7 +10591,7 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1, #endif ret = target_mmap(arg1, arg2, arg3, target_to_host_bitmask(arg4, mmap_flags_tbl), - arg5, arg6 << MMAP_SHIFT); + arg5, (off_t)(abi_ulong)arg6 << MMAP_SHIFT); return get_errno(ret); #endif case TARGET_NR_munmap: From patchwork Sat Jul 15 13:53:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 703242 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e4d:0:b0:314:25da:8dc4 with SMTP id r13csp158565wrt; Sat, 15 Jul 2023 06:59:27 -0700 (PDT) X-Google-Smtp-Source: APBJJlFiR7AT2nJYQfK1K1RyzLH2c+ocm1Rmt9CWfl8aq57BDruGUX3efI/Yf0YmQ8BEqcFU3Dqk X-Received: by 2002:a05:622a:134f:b0:403:a8c9:d650 with SMTP id w15-20020a05622a134f00b00403a8c9d650mr9201848qtk.43.1689429567572; Sat, 15 Jul 2023 06:59:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689429567; cv=none; d=google.com; s=arc-20160816; b=r9gGwMogbrrdQkKwsq+3eTocn8vS0gl4F5f6IVCDCnn7D15r5yMsOyqTbabWsw+Fde 2GEDEFsrt8V+8GaJqoMAubFuUyhPsBE9pRx9hZAB0gmf9vJGh1vhfpgSdiNdNzOmtUmK QNSwZH6A+pIEINct7WEkqxofASegctbcXNqrZwbZL6WOU8BbAao99jyqjg1S/7cbXgOe zMaJr5sjG5MvXJIncdsrX/2BQmEQxVH3R+TS6x/tucl69j05LU28/c6bbHNQm8IXLzy2 UKecPFgV5IkhXmjjShv5mgO7+Dm+yWKoKVf5asCJR/9eo5vULjRzY5OBuQf81YN2XPv/ HFvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=N9gguT3TBruptKaq1lWfbF+0g4+LhgVIPeZNOW/uhRg=; fh=oYAd+8Lj9FKlReeF9hgENQXa3P4LhBP5C4njRBbobDA=; b=WMFyHELDWRTMb2BbW4AqurHCnXUe+vbMupG3SJhhj1CRa9jMDj1tf7s3kq+MUCbZhd inKXAW6x4c+YFjC1rfZViyvGqViqDOpyFw9xHClQZVpF9mh1OaMMqYXOkoosUpZxoimc UExPTEpIYh6w/M29NHHVB5+aWAhWUp4MUz2YqmvDsmYjTWEVmR0zh6H4/KpZdKuL1DHF 897L6K64eibgkNwNf16lKUI+tqdfWLIU6uzOykg/umDfgIXsfVm64N1ypWOpFPFxVwa6 RxUKDrcfH6FJZBvy4WmFB0WYAHjjM/WbM38ifasaznDM86At2bjtcdm2aAf4dx/wrYXI M+nA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gNLS2Mv0; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id t10-20020a05622a148a00b004037f7b157bsi5882696qtx.33.2023.07.15.06.59.27 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 15 Jul 2023 06:59:27 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gNLS2Mv0; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qKfiu-0004M7-EK; Sat, 15 Jul 2023 09:54:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qKfib-00048X-1m for qemu-devel@nongnu.org; Sat, 15 Jul 2023 09:53:59 -0400 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qKfiT-0001Jo-BN for qemu-devel@nongnu.org; Sat, 15 Jul 2023 09:53:49 -0400 Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-31590e4e27aso2768387f8f.1 for ; Sat, 15 Jul 2023 06:53:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689429224; x=1692021224; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=N9gguT3TBruptKaq1lWfbF+0g4+LhgVIPeZNOW/uhRg=; b=gNLS2Mv0rgcoBt9ZiMRNzYNOPVmiUz2GqFWQDpE2Ba+PDT8gOXsoBLvyfFtysJhUai 4i08Zjt/hjPQA/DgrAjw/KQGxBRt2OlrPI/3NT9zSADAVm0lSHQqToFHHRhty08+O3kL eq0SWhfUl94zTW4RtXEAXbEyGLUwOwnAoBJ1X7L6gXuSwcpXTbV1JO6YXwRe4IAbJdoO moDXkN/vC4mFJvXtWABEdiCxytoVFaEXBGze+If/PIogYOi1IyyOUEhjwCsUCocmrIAZ RvXk075g1s12iRRsXgtHK29jZaRL4fTSJ+cD2sgtJaZ6lQnNraYfZN01HCY/VRTgyoQa rMMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689429224; x=1692021224; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=N9gguT3TBruptKaq1lWfbF+0g4+LhgVIPeZNOW/uhRg=; b=f2F9YWE2bKbek9sMveaXG4pgDuML0SaTFTVCxY2ljJ/YSBCXuGVsA308Xk6oai3i+H YjDoWh8e3wD+Zh2JkGgxkYF4uid+kK4i0nD0e8A4OBfOffoOHg2i9qWk7YFy77HglWPv 9jKquoqRiU6PG+o3KtNdT5rC6I5MJUL58Hqy+8mFQxQt60D42P/iB5QsRxgBjWg4aGzu dPXX9aZ20qtY46D6Cwh7wGmckPavdwuqay527ZCrGli0tAfly2wO4/vbnLD9Y2vEcU5m 4/W3D4Fj/b7KPbTy/eKmCYLsxpi/vTW8bhOAssji343IQidyDIXo7s9grksSJZ0imZJr 5BDA== X-Gm-Message-State: ABy/qLbLr1axHWb/89cIhkuRL/sN94Gakh99McO+ZnO3XYdPIIVNR/eq DMOLZFYUP14H9uDWgbR+w6wsRJnRK3pBC0XIW9NZ+g== X-Received: by 2002:a5d:658e:0:b0:316:f25c:d0c0 with SMTP id q14-20020a5d658e000000b00316f25cd0c0mr2696891wru.16.1689429224055; Sat, 15 Jul 2023 06:53:44 -0700 (PDT) Received: from stoup.lan ([51.219.12.49]) by smtp.gmail.com with ESMTPSA id k10-20020a5d66ca000000b00313f9085119sm13838014wrw.113.2023.07.15.06.53.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Jul 2023 06:53:43 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 31/47] linux-user: Rewrite target_mprotect Date: Sat, 15 Jul 2023 14:53:01 +0100 Message-Id: <20230715135317.7219-32-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230715135317.7219-1-richard.henderson@linaro.org> References: <20230715135317.7219-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42c; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x42c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Use 'last' variables instead of 'end' variables. When host page size > guest page size, detect when adjacent host pages have the same protection and merge that expanded host range into fewer syscalls. Signed-off-by: Richard Henderson Message-Id: <20230707204054.8792-15-richard.henderson@linaro.org> --- linux-user/mmap.c | 106 +++++++++++++++++++++++++++++----------------- 1 file changed, 67 insertions(+), 39 deletions(-) diff --git a/linux-user/mmap.c b/linux-user/mmap.c index b2c2d85857..d02d74d279 100644 --- a/linux-user/mmap.c +++ b/linux-user/mmap.c @@ -120,8 +120,11 @@ static int target_to_host_prot(int prot) /* NOTE: all the constants are the HOST ones, but addresses are target. */ int target_mprotect(abi_ulong start, abi_ulong len, int target_prot) { - abi_ulong end, host_start, host_end, addr; - int prot1, ret, page_flags; + abi_ulong starts[3]; + abi_ulong lens[3]; + int prots[3]; + abi_ulong host_start, host_last, last; + int prot1, ret, page_flags, nranges; trace_target_mprotect(start, len, target_prot); @@ -132,63 +135,88 @@ int target_mprotect(abi_ulong start, abi_ulong len, int target_prot) if (!page_flags) { return -TARGET_EINVAL; } - len = TARGET_PAGE_ALIGN(len); - end = start + len; - if (!guest_range_valid_untagged(start, len)) { - return -TARGET_ENOMEM; - } if (len == 0) { return 0; } + len = TARGET_PAGE_ALIGN(len); + if (!guest_range_valid_untagged(start, len)) { + return -TARGET_ENOMEM; + } + + last = start + len - 1; + host_start = start & qemu_host_page_mask; + host_last = HOST_PAGE_ALIGN(last) - 1; + nranges = 0; mmap_lock(); - host_start = start & qemu_host_page_mask; - host_end = HOST_PAGE_ALIGN(end); - if (start > host_start) { - /* handle host page containing start */ + + if (host_last - host_start < qemu_host_page_size) { + /* Single host page contains all guest pages: sum the prot. */ prot1 = target_prot; - for (addr = host_start; addr < start; addr += TARGET_PAGE_SIZE) { - prot1 |= page_get_flags(addr); + for (abi_ulong a = host_start; a < start; a += TARGET_PAGE_SIZE) { + prot1 |= page_get_flags(a); } - if (host_end == host_start + qemu_host_page_size) { - for (addr = end; addr < host_end; addr += TARGET_PAGE_SIZE) { - prot1 |= page_get_flags(addr); + for (abi_ulong a = last; a < host_last; a += TARGET_PAGE_SIZE) { + prot1 |= page_get_flags(a + 1); + } + starts[nranges] = host_start; + lens[nranges] = qemu_host_page_size; + prots[nranges] = prot1; + nranges++; + } else { + if (host_start < start) { + /* Host page contains more than one guest page: sum the prot. */ + prot1 = target_prot; + for (abi_ulong a = host_start; a < start; a += TARGET_PAGE_SIZE) { + prot1 |= page_get_flags(a); + } + /* If the resulting sum differs, create a new range. */ + if (prot1 != target_prot) { + starts[nranges] = host_start; + lens[nranges] = qemu_host_page_size; + prots[nranges] = prot1; + nranges++; + host_start += qemu_host_page_size; } - end = host_end; } - ret = mprotect(g2h_untagged(host_start), qemu_host_page_size, - target_to_host_prot(prot1)); - if (ret != 0) { - goto error; + + if (last < host_last) { + /* Host page contains more than one guest page: sum the prot. */ + prot1 = target_prot; + for (abi_ulong a = last; a < host_last; a += TARGET_PAGE_SIZE) { + prot1 |= page_get_flags(a + 1); + } + /* If the resulting sum differs, create a new range. */ + if (prot1 != target_prot) { + host_last -= qemu_host_page_size; + starts[nranges] = host_last + 1; + lens[nranges] = qemu_host_page_size; + prots[nranges] = prot1; + nranges++; + } } - host_start += qemu_host_page_size; - } - if (end < host_end) { - prot1 = target_prot; - for (addr = end; addr < host_end; addr += TARGET_PAGE_SIZE) { - prot1 |= page_get_flags(addr); + + /* Create a range for the middle, if any remains. */ + if (host_start < host_last) { + starts[nranges] = host_start; + lens[nranges] = host_last - host_start + 1; + prots[nranges] = target_prot; + nranges++; } - ret = mprotect(g2h_untagged(host_end - qemu_host_page_size), - qemu_host_page_size, target_to_host_prot(prot1)); - if (ret != 0) { - goto error; - } - host_end -= qemu_host_page_size; } - /* handle the pages in the middle */ - if (host_start < host_end) { - ret = mprotect(g2h_untagged(host_start), host_end - host_start, - target_to_host_prot(target_prot)); + for (int i = 0; i < nranges; ++i) { + ret = mprotect(g2h_untagged(starts[i]), lens[i], + target_to_host_prot(prots[i])); if (ret != 0) { goto error; } } - page_set_flags(start, start + len - 1, page_flags); + page_set_flags(start, last, page_flags); ret = 0; -error: + error: mmap_unlock(); return ret; } From patchwork Sat Jul 15 13:53:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 703225 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e4d:0:b0:314:25da:8dc4 with SMTP id r13csp157370wrt; Sat, 15 Jul 2023 06:56:07 -0700 (PDT) X-Google-Smtp-Source: APBJJlHgj2TPtIjWBr2WMqN+GUxrfmBrzPPS23mTlHmhZoqCNmpkUU8N/HbCrW9RM2pIN2ldWfMu X-Received: by 2002:ac8:7f8d:0:b0:403:2dc0:e895 with SMTP id z13-20020ac87f8d000000b004032dc0e895mr8362290qtj.59.1689429366978; Sat, 15 Jul 2023 06:56:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689429366; cv=none; d=google.com; s=arc-20160816; b=VSCwgys7gN8Ef0zliVPZ2cC7VmsO6VbNjrrfBQwgCqkNeFVo8h72BDFSsXe6AN6MsK jXX2xvG3vNgHTUO9k7T6dGMheA5IFJjaXI6gNpXqKBGqxdVqksv3xgKAvGtgTKPBD8Tt jLB1b/TaKNzWRdee1edLyxd3sKhlpS+qTADMSiB+d5Ns29iqEJ++zyzd5b/wqI7hJNac QcbV8xueqXVTbDdVwPCST+RLKx1zkvqGZb45E5UYZaL5Qon17R0iWbGYc6m8URsUuVx4 LoWGiDserN8RfWOvktA5Ywq8yGzw0gaGYc19aWalna/IKQ7CQomKIo3PZpQvXV+Plf6B CAcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=aO8i+PWWEj2wFULENv6+H9RCy3N3UL0z2bpJ1K4Mi2s=; fh=oYAd+8Lj9FKlReeF9hgENQXa3P4LhBP5C4njRBbobDA=; b=aiXiUk0szhTwcaew7RS/dccRndxXIuc1sAdaCtKlvRHrbVUKI/jj7MQVIg1HiVvEpA 14FqpszELH0Deh+B96WTSL3oFERtilt0NadLM+gCOqhnoYkJbBHnb29Ch2K/suWoGXDj cUF9C49DLT9kcva64slWsemqsOKcCkCNePp8YyfVVVLZqKNnE/BjDkaqCV16t502M+t/ eMxvep2BZ53yUSZMeGAdDgb9/JgXkshltMH4I/k0kSR9eF9F5LBof8WUpfDobt9cA92a 53Pxi4ZfCmBDADx6PPqT21tFqFg4v0KXVmR9jzhU/ugatN5E1T3k06M/VOE6rTU30BPj FdWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wsEvgqE5; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id bp36-20020a05622a1ba400b00403d8705935si2411103qtb.562.2023.07.15.06.56.06 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 15 Jul 2023 06:56:06 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wsEvgqE5; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qKfjZ-00062M-Vm; Sat, 15 Jul 2023 09:54:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qKfia-00048V-1A for qemu-devel@nongnu.org; Sat, 15 Jul 2023 09:53:59 -0400 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qKfiU-0001KB-3M for qemu-devel@nongnu.org; Sat, 15 Jul 2023 09:53:50 -0400 Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-3090d3e9c92so3053009f8f.2 for ; Sat, 15 Jul 2023 06:53:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689429225; x=1692021225; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=aO8i+PWWEj2wFULENv6+H9RCy3N3UL0z2bpJ1K4Mi2s=; b=wsEvgqE5JwG2oMXqSuKUyB74s//5oP3TdSjTQFzT8S8Hk0lKibidfY78ixLTyuEXZu 6UwEj3NuwsDcvNsVkj75tLGE4TQFVnkvV9x99ix2TAzfwXCaV/Ldwfv2/kPxDxPPE+cY qoeouKTOhWwkHAz1mXOBa749xFCmPBcXwc5tZw+2x0gifbbbn0ViwP9KQeHZ9y56lbrV RKxmaOij2b6ShkGf4r2QLEEiMoysOpsEAFb5Y7rUaQ9ksCv5JELS9/adU47Ye7dKQdb6 2sCc3LdY4QVvXzWLsP5SV2SYO9wLAIrjK1gPIredUJn0a9K9rPNuVdzy1WkFnvMcpGDc 9tMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689429225; x=1692021225; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=aO8i+PWWEj2wFULENv6+H9RCy3N3UL0z2bpJ1K4Mi2s=; b=HggP1hEKIjQHu2yg9mApvJUOANnghMPj+5m9RZU9J2+kFhi/56yDRqRhaox13eFuWZ JR7NPBYfEY1XaissTLoP6uR+cuO4t8fZZsVIk1QPxiNXi7Bkl2iJ+42ho0hX2Q+9El6S iRQW5oHujkbHUrHaUC4/gj1NCc8rau7W4B0AK/BWRTZiZUPQ91BIhOeGij30QEMegmUY IdXfs5Ik4xs3ji7O08df2aphkvpGVgMNv45n6EveULGTNchS2KjgQmVZIeBcn5xaSK4c tVg0nQV9hVXErKhjWLF31E/7BN1Q0ynFx8OoEcRvz8VN57AsKa83h1Cu2r44//ctVcil +kFw== X-Gm-Message-State: ABy/qLYOZWEl2pMBMcZ5fVgRda/FROtThOvZs41IpdOuSsv1ypR++qb8 g32yTVwWMY9/ryIFn8q/YjqmIsl9S+6X7g8fvZA6iw== X-Received: by 2002:adf:fbc4:0:b0:316:e325:fd92 with SMTP id d4-20020adffbc4000000b00316e325fd92mr7014989wrs.55.1689429224759; Sat, 15 Jul 2023 06:53:44 -0700 (PDT) Received: from stoup.lan ([51.219.12.49]) by smtp.gmail.com with ESMTPSA id k10-20020a5d66ca000000b00313f9085119sm13838014wrw.113.2023.07.15.06.53.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Jul 2023 06:53:44 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 32/47] linux-user: Rewrite mmap_frag Date: Sat, 15 Jul 2023 14:53:02 +0100 Message-Id: <20230715135317.7219-33-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230715135317.7219-1-richard.henderson@linaro.org> References: <20230715135317.7219-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::436; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x436.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Use 'last' variables instead of 'end' variables. Always zero MAP_ANONYMOUS fragments, which we previously failed to do if they were not writable; early exit in case we allocate a new page from the kernel, known zeros. Signed-off-by: Richard Henderson Message-Id: <20230707204054.8792-16-richard.henderson@linaro.org> --- linux-user/mmap.c | 123 +++++++++++++++++++++++----------------------- 1 file changed, 62 insertions(+), 61 deletions(-) diff --git a/linux-user/mmap.c b/linux-user/mmap.c index d02d74d279..c4b2515271 100644 --- a/linux-user/mmap.c +++ b/linux-user/mmap.c @@ -222,73 +222,76 @@ int target_mprotect(abi_ulong start, abi_ulong len, int target_prot) } /* map an incomplete host page */ -static int mmap_frag(abi_ulong real_start, - abi_ulong start, abi_ulong end, - int prot, int flags, int fd, off_t offset) +static bool mmap_frag(abi_ulong real_start, abi_ulong start, abi_ulong last, + int prot, int flags, int fd, off_t offset) { - abi_ulong real_end, addr; + abi_ulong real_last; void *host_start; - int prot1, prot_new; + int prot_old, prot_new; + int host_prot_old, host_prot_new; - real_end = real_start + qemu_host_page_size; - host_start = g2h_untagged(real_start); - - /* get the protection of the target pages outside the mapping */ - prot1 = 0; - for (addr = real_start; addr < real_end; addr++) { - if (addr < start || addr >= end) { - prot1 |= page_get_flags(addr); - } + if (!(flags & MAP_ANONYMOUS) + && (flags & MAP_TYPE) == MAP_SHARED + && (prot & PROT_WRITE)) { + /* + * msync() won't work with the partial page, so we return an + * error if write is possible while it is a shared mapping. + */ + errno = EINVAL; + return false; } - if (prot1 == 0) { - /* no page was there, so we allocate one */ + real_last = real_start + qemu_host_page_size - 1; + host_start = g2h_untagged(real_start); + + /* Get the protection of the target pages outside the mapping. */ + prot_old = 0; + for (abi_ulong a = real_start; a < start; a += TARGET_PAGE_SIZE) { + prot_old |= page_get_flags(a); + } + for (abi_ulong a = real_last; a > last; a -= TARGET_PAGE_SIZE) { + prot_old |= page_get_flags(a); + } + + if (prot_old == 0) { + /* + * Since !(prot_old & PAGE_VALID), there were no guest pages + * outside of the fragment we need to map. Allocate a new host + * page to cover, discarding whatever else may have been present. + */ void *p = mmap(host_start, qemu_host_page_size, target_to_host_prot(prot), flags | MAP_ANONYMOUS, -1, 0); if (p == MAP_FAILED) { - return -1; + return false; } - prot1 = prot; + prot_old = prot; } - prot1 &= PAGE_BITS; + prot_new = prot | prot_old; - prot_new = prot | prot1; - if (!(flags & MAP_ANONYMOUS)) { - /* - * msync() won't work here, so we return an error if write is - * possible while it is a shared mapping. - */ - if ((flags & MAP_TYPE) == MAP_SHARED && (prot & PROT_WRITE)) { - return -1; - } + host_prot_old = target_to_host_prot(prot_old); + host_prot_new = target_to_host_prot(prot_new); - /* adjust protection to be able to read */ - if (!(prot1 & PROT_WRITE)) { - mprotect(host_start, qemu_host_page_size, - target_to_host_prot(prot1) | PROT_WRITE); - } + /* Adjust protection to be able to write. */ + if (!(host_prot_old & PROT_WRITE)) { + host_prot_old |= PROT_WRITE; + mprotect(host_start, qemu_host_page_size, host_prot_old); + } - /* read the corresponding file data */ - if (pread(fd, g2h_untagged(start), end - start, offset) == -1) { - return -1; - } - - /* put final protection */ - if (prot_new != (prot1 | PROT_WRITE)) { - mprotect(host_start, qemu_host_page_size, - target_to_host_prot(prot_new)); - } + /* Read or zero the new guest pages. */ + if (flags & MAP_ANONYMOUS) { + memset(g2h_untagged(start), 0, last - start + 1); } else { - if (prot_new != prot1) { - mprotect(host_start, qemu_host_page_size, - target_to_host_prot(prot_new)); - } - if (prot_new & PROT_WRITE) { - memset(g2h_untagged(start), 0, end - start); + if (pread(fd, g2h_untagged(start), last - start + 1, offset) == -1) { + return false; } } - return 0; + + /* Put final protection */ + if (host_prot_new != host_prot_old) { + mprotect(host_start, qemu_host_page_size, host_prot_new); + } + return true; } #if HOST_LONG_BITS == 64 && TARGET_ABI_BITS == 64 @@ -681,27 +684,25 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int target_prot, if (start > real_start) { if (real_end == real_start + qemu_host_page_size) { /* one single host page */ - ret = mmap_frag(real_start, start, end, - target_prot, flags, fd, offset); - if (ret == -1) { + if (!mmap_frag(real_start, start, end - 1, + target_prot, flags, fd, offset)) { goto fail; } goto the_end1; } - ret = mmap_frag(real_start, start, real_start + qemu_host_page_size, - target_prot, flags, fd, offset); - if (ret == -1) { + if (!mmap_frag(real_start, start, + real_start + qemu_host_page_size - 1, + target_prot, flags, fd, offset)) { goto fail; } real_start += qemu_host_page_size; } /* handle the end of the mapping */ if (end < real_end) { - ret = mmap_frag(real_end - qemu_host_page_size, - real_end - qemu_host_page_size, end, - target_prot, flags, fd, - offset + real_end - qemu_host_page_size - start); - if (ret == -1) { + if (!mmap_frag(real_end - qemu_host_page_size, + real_end - qemu_host_page_size, end - 1, + target_prot, flags, fd, + offset + real_end - qemu_host_page_size - start)) { goto fail; } real_end -= qemu_host_page_size; From patchwork Sat Jul 15 13:53:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 703239 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e4d:0:b0:314:25da:8dc4 with SMTP id r13csp158145wrt; Sat, 15 Jul 2023 06:58:13 -0700 (PDT) X-Google-Smtp-Source: APBJJlF3PxSdwV7ZS8yk4hgkhguqSh7a7VrJKLVRXotx/sf+dLd5dReNzbL3JfjfblF/r8T2zxmb X-Received: by 2002:a05:620a:2449:b0:767:ca49:bacd with SMTP id h9-20020a05620a244900b00767ca49bacdmr7538929qkn.30.1689429493005; Sat, 15 Jul 2023 06:58:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689429492; cv=none; d=google.com; s=arc-20160816; b=DHrHvoQ4Ix5gDtxeKKc/fOtPmxJ7m34dRWdi5Q1HKoK7rkX4HHPsjpzyN/QSit2227 3F6yoTbd4LqpasaE6ce4tpCQrCregvyGFFgN0OUGPPGxXDdUprEM9tAQwIWewcYgBjMY w5EK72hL2Lfz74o+0MiAB+om00a1xZJe47mWoh9z54s5nHa/Pmg6FH3pjgVBQy5JQBjR j/uvvj+a0mDjAjZewRuTGCzG6tQzbT8l2fPJMoYxghNhuRa8C08PZSyBtwK5ndde6Va2 /PecTmUwJj1wr26q0jt/pJnDWA1p0pVxCynNANW6H9nqPPMX9kZE+RUQRLN43yITKEmb Rp3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=Tw+lHuhQDkl8BHlJVK/TymddlbqOTxzC1UGZ1En8Tes=; fh=oYAd+8Lj9FKlReeF9hgENQXa3P4LhBP5C4njRBbobDA=; b=Yiq3poQeVbQ74rf29XjCRUitIVfAbeEUGpbQJMhynNfYAjy84ORfZc6Lhd28lZso0a qy3HQLywofukkRnPmH8NUgG0BsKWfzjc5pGQiA53Izklit42ZbEQd1SFHjA6tvwX01O/ TsgtZcD0DwV4D0FN6NmU0BooiRdrihekc55L1BSqpWLLH6135tv9Q7iMnnNYS2I7TkiY Bp9c7HWdRyke4Fl6f85HLlqbuXR+Q9xrytBI6X4soAU1vzFY+MomXvBahpcthWEN6QyD D85043uhBdiQMXnMaFEOKA5tKRCEZA56I0xuslw7JRahHAQOYxaeRLZs6JVaJ5/yWqyL GYng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YT9veVfF; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id qs14-20020a05620a394e00b00767b7c58ac4si5995604qkn.605.2023.07.15.06.58.12 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 15 Jul 2023 06:58:12 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YT9veVfF; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qKfjs-0007h1-Lw; Sat, 15 Jul 2023 09:55:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qKfia-00048W-1n for qemu-devel@nongnu.org; Sat, 15 Jul 2023 09:53:59 -0400 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qKfiU-0001KG-Nk for qemu-devel@nongnu.org; Sat, 15 Jul 2023 09:53:49 -0400 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-3fbc6ab5ff5so25922245e9.1 for ; Sat, 15 Jul 2023 06:53:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689429225; x=1692021225; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=Tw+lHuhQDkl8BHlJVK/TymddlbqOTxzC1UGZ1En8Tes=; b=YT9veVfFWibE/mKemkpFQc6aJXt3Nj0Iwh7NxSqb5q5wqXTQZTfgduGblkPLjrAxaa nYDo0bRTfCnLQlR2PJdGHn7cQLY/HW8SDFog19O1kuis1fnHcKHfSvqvNiGAuXufp+5L M5dB4he5LK3nHSxgEilAnauwgSmGy0CYABqdemQikJyJvnIUwaT8uVuSJgbkH0YU0LY+ lccC4hRDMgsKI7jY9Y579CRV3fxeYU3EU/BVmSfh46urxa39zqCJar5NrWxQUlQYr3y4 LEAszEbfJ7Dcm+PibnyTg2dPoH1DK5NcN+Da2c+tl9xYDLquKx2WCzLN3R+mvPiYZVz8 vOyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689429225; x=1692021225; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Tw+lHuhQDkl8BHlJVK/TymddlbqOTxzC1UGZ1En8Tes=; b=H0axSSkfDpRu3g6e7BcM/oHllSjyy9maEsNBza9mXR2wasPLxF4he+teNUjOntMjKH DPxRToYgQckHc1aUdTtvq9xpul0isFCYiyIXAGsInh5wXTMzL1EahXMCa9GBij1+ct/v H6IZZQhs4zMgIRfp1w5uW7nUEzzjZs8JwmEAMBAwDrd/vJTOFgVJERJhxoiRBH14vP70 UN1B1cccKpqLUOaN4QAG4xCpx+hJMOUQ/xULeq4loifLaRg1x36E6tMISVXSTazvYL1S ggy+JM34Myqw/1zQFj4z4YfR57J3fY2wDKuv9KnlhZrj4AA4JBZE2LNQ2m886p4b6yoS SwTg== X-Gm-Message-State: ABy/qLbm2vpZblM3E499IOKHAghKMrPkly2iFuaP+NdvSWvVUbSuz5k5 gWviBUo1LLKBnXFl1Tj0PUzxsmkcYWJJid7sJJskjA== X-Received: by 2002:a05:6000:1c4:b0:314:133a:f04 with SMTP id t4-20020a05600001c400b00314133a0f04mr6611871wrx.49.1689429225483; Sat, 15 Jul 2023 06:53:45 -0700 (PDT) Received: from stoup.lan ([51.219.12.49]) by smtp.gmail.com with ESMTPSA id k10-20020a5d66ca000000b00313f9085119sm13838014wrw.113.2023.07.15.06.53.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Jul 2023 06:53:45 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 33/47] accel/tcg: Introduce page_find_range_empty Date: Sat, 15 Jul 2023 14:53:03 +0100 Message-Id: <20230715135317.7219-34-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230715135317.7219-1-richard.henderson@linaro.org> References: <20230715135317.7219-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x335.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Use the interval tree to locate an unused range in the VM. Signed-off-by: Richard Henderson Message-Id: <20230707204054.8792-17-richard.henderson@linaro.org> --- include/exec/cpu-all.h | 15 +++++++++++++++ accel/tcg/user-exec.c | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+) diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h index 94f828b109..eb1c54701a 100644 --- a/include/exec/cpu-all.h +++ b/include/exec/cpu-all.h @@ -236,6 +236,21 @@ int page_check_range(target_ulong start, target_ulong len, int flags); */ bool page_check_range_empty(target_ulong start, target_ulong last); +/** + * page_find_range_empty + * @min: first byte of search range + * @max: last byte of search range + * @len: size of the hole required + * @align: alignment of the hole required (power of 2) + * + * If there is a range [x, x+@len) within [@min, @max] such that + * x % @align == 0, then return x. Otherwise return -1. + * The memory lock must be held, as the caller will want to ensure + * the returned range stays empty until a new mapping can be installed. + */ +target_ulong page_find_range_empty(target_ulong min, target_ulong max, + target_ulong len, target_ulong align); + /** * page_get_target_data(address) * @address: guest virtual address diff --git a/accel/tcg/user-exec.c b/accel/tcg/user-exec.c index ab684a3ea2..e4f9563730 100644 --- a/accel/tcg/user-exec.c +++ b/accel/tcg/user-exec.c @@ -605,6 +605,47 @@ bool page_check_range_empty(target_ulong start, target_ulong last) return pageflags_find(start, last) == NULL; } +target_ulong page_find_range_empty(target_ulong min, target_ulong max, + target_ulong len, target_ulong align) +{ + target_ulong len_m1, align_m1; + + assert(min <= max); + assert(max <= GUEST_ADDR_MAX); + assert(len != 0); + assert(is_power_of_2(align)); + assert_memory_lock(); + + len_m1 = len - 1; + align_m1 = align - 1; + + /* Iteratively narrow the search region. */ + while (1) { + PageFlagsNode *p; + + /* Align min and double-check there's enough space remaining. */ + min = (min + align_m1) & ~align_m1; + if (min > max) { + return -1; + } + if (len_m1 > max - min) { + return -1; + } + + p = pageflags_find(min, min + len_m1); + if (p == NULL) { + /* Found! */ + return min; + } + if (max <= p->itree.last) { + /* Existing allocation fills the remainder of the search region. */ + return -1; + } + /* Skip across existing allocation. */ + min = p->itree.last + 1; + } +} + void page_protect(tb_page_addr_t address) { PageFlagsNode *p; From patchwork Sat Jul 15 13:53:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 703215 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e4d:0:b0:314:25da:8dc4 with SMTP id r13csp157082wrt; Sat, 15 Jul 2023 06:55:19 -0700 (PDT) X-Google-Smtp-Source: APBJJlFBicW5JVmcN0IBT6oultO7wiQ/gCQN9iif5xcymMSVl2rxDC+4BfqpvFRAmgb29sQ0+A3W X-Received: by 2002:a05:620a:574:b0:765:aac1:100c with SMTP id p20-20020a05620a057400b00765aac1100cmr5889780qkp.78.1689429319379; Sat, 15 Jul 2023 06:55:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689429319; cv=none; d=google.com; s=arc-20160816; b=o3KskTFt7SfwXwymfFB7312m9O7oMiDjcD0DneQQrhhB1wpl77nXuWPAd7DdDyugMh ZR0MCMMZMcGUkMH4c3rsNP1PtqujoXeqgXaSe/hWN4mw8BVmXbkYNqLA4UBFUjl82uRI VdakP2Yj7M4/Su5pJaY9XgfkfSNuBSQehJjNbMEx7cURwSt8p1V/Yzp4iib1qgEvt5Cl qVmVN90A5w5Q9yOC1M68X2bRxQUBewL9LbocqR9mTRNwvu/6PfOCzKrlovwQi99vFcR+ 7ngk0JkjoZGe1XSIHiM3lZRcLST3NboY2BYPJADg/FFEeAVDXE5C9MMz7/S5dktdTypU vMvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=QRxmyw2NI294w3E1OCW/a4A3Z0jUfk7Gsk9X8Q/8iho=; fh=n5QY4Tpv4/lI7qJJHJjODuMehB6ug+e1S/4zpncWpMY=; b=VlHVcBhocvoxeQiPgEnv30ls0vReSrj+eLGCpW5VNwC7ng6LyTCl9S5qtgsg9oe4FV VE/oAvgAx1IFkp/FM4b2fXAn8JCGUTPw/fYory3+JVhSvB3/kA/TsRhsjWqkUzFTNXn6 gPox1QGa6JqmQWLKwmTJxxoP8XkDJgCVEsfTfwleX3E0ZYN3nM88ErY21YXe5xANTD8x oV+HK2FprLjJvJ1TvGROS628lDna9g59eYpry/F/mEK4dvwSQxhgq83I7mWbL9oiWIG7 iNgOSA/KC+ygyMYoW+O4hZEHNSpP7QX9/WV9vj5O7BU15Ys9pmwKQslEY7i1Ux6VhtdF ZoAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VC7koQuy; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id h9-20020a05620a284900b0076255907cf3si5985912qkp.339.2023.07.15.06.55.19 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 15 Jul 2023 06:55:19 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VC7koQuy; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qKfjS-0004yk-Gt; Sat, 15 Jul 2023 09:54:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qKfib-00048t-R6 for qemu-devel@nongnu.org; Sat, 15 Jul 2023 09:53:59 -0400 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qKfiX-0001KM-JM for qemu-devel@nongnu.org; Sat, 15 Jul 2023 09:53:53 -0400 Received: by mail-wr1-x433.google.com with SMTP id ffacd0b85a97d-316f4abb1e1so479560f8f.3 for ; Sat, 15 Jul 2023 06:53:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689429226; x=1692021226; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=QRxmyw2NI294w3E1OCW/a4A3Z0jUfk7Gsk9X8Q/8iho=; b=VC7koQuyjgHQXSPTy9LGtOYxd4WOq0UBnxDbFmrTkJ1ArlrRJmJKREDoqfluyEGd4r ScyyC4ah3Js1nFT2XsJFxD38bp9bSl1aMfnN3tdcED6nfWmfgz/x16ADJ6q7YC1T3VeJ +mLirTAqWA+Fq8GWt4Qq4MMD/toG7i+MUoyrPqTJQvmI7QTUF4xkyvgIEzGJBYruqyZq JnGzePNAkPtha6kRgjfCeaY41uQaq5yi9jLYqepNb9BMlyucj5K33v5xV+8adjt8uOzV Ga9ZUIkPCFQSFgacXQF4z45sNFS6E/D/2sY9PEb5Ety7wduhAS8GDsVvTnNqQGHTbSdk g0fQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689429226; x=1692021226; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=QRxmyw2NI294w3E1OCW/a4A3Z0jUfk7Gsk9X8Q/8iho=; b=MSWKHpTzpUsaUZI/Ftq7cQutz7+/uoSEgknbXGv3l8zml7YdBUuGWcPKXMv7Q7702r 0Xj1/eWVfVQuPbyIdr6wxdSws4slpruIjK2OrCi2x86r4QPBq+rYQxEXQxFSVrOThDwQ ImxvUCsU+WTG+wjK4rT1tgGL37C43MBvLTG0X5YB0JeSbgNUMsiECDZlXKjtsNJ4XYP0 Ap5nNumEuR4C66v3q69RLwZaYE4xqbPqzIEoAKD8We48y6XHTN1YTB6uZlJEMnf10gVb n3RW2Ae8RCOQxaa0BtzF/T0XCTL6eiCd8dRJMj75S04TJB8Uzi2J35OMy+TXY9ZMkKTe UtzA== X-Gm-Message-State: ABy/qLa7/i7QZa/E6YZMKI7BIVwGedmiv3kesSj7oi0llppreZt4IYAQ yHrQQkO+2Oa1kLJw7Znhx/+Cl/PD8bux4r6xbjKhcA== X-Received: by 2002:a5d:4564:0:b0:306:46c4:d313 with SMTP id a4-20020a5d4564000000b0030646c4d313mr6321855wrc.28.1689429226122; Sat, 15 Jul 2023 06:53:46 -0700 (PDT) Received: from stoup.lan ([51.219.12.49]) by smtp.gmail.com with ESMTPSA id k10-20020a5d66ca000000b00313f9085119sm13838014wrw.113.2023.07.15.06.53.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Jul 2023 06:53:45 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Warner Losh , Kyle Evans Subject: [PULL 34/47] bsd-user: Use page_find_range_empty for mmap_find_vma_reserved Date: Sat, 15 Jul 2023 14:53:04 +0100 Message-Id: <20230715135317.7219-35-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230715135317.7219-1-richard.henderson@linaro.org> References: <20230715135317.7219-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::433; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x433.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Use the interval tree to find empty space, rather than probing each page in turn. Cc: Warner Losh Cc: Kyle Evans Signed-off-by: Richard Henderson Reviewed-bt: Warner Losh Message-Id: <20230707204054.8792-18-richard.henderson@linaro.org> --- bsd-user/mmap.c | 48 +++++++----------------------------------------- 1 file changed, 7 insertions(+), 41 deletions(-) diff --git a/bsd-user/mmap.c b/bsd-user/mmap.c index 07b5b8055e..aca8764356 100644 --- a/bsd-user/mmap.c +++ b/bsd-user/mmap.c @@ -222,50 +222,16 @@ unsigned long last_brk; static abi_ulong mmap_find_vma_reserved(abi_ulong start, abi_ulong size, abi_ulong alignment) { - abi_ulong addr; - abi_ulong end_addr; - int prot; - int looped = 0; + abi_ulong ret; - if (size > reserved_va) { - return (abi_ulong)-1; + ret = page_find_range_empty(start, reserved_va, size, alignment); + if (ret == -1 && start > TARGET_PAGE_SIZE) { + /* Restart at the beginning of the address space. */ + ret = page_find_range_empty(TARGET_PAGE_SIZE, start - 1, + size, alignment); } - size = HOST_PAGE_ALIGN(size) + alignment; - end_addr = start + size; - if (end_addr > reserved_va) { - end_addr = reserved_va + 1; - } - addr = end_addr - qemu_host_page_size; - - while (1) { - if (addr > end_addr) { - if (looped) { - return (abi_ulong)-1; - } - end_addr = reserved_va + 1; - addr = end_addr - qemu_host_page_size; - looped = 1; - continue; - } - prot = page_get_flags(addr); - if (prot) { - end_addr = addr; - } - if (end_addr - addr >= size) { - break; - } - addr -= qemu_host_page_size; - } - - if (start == mmap_next_start) { - mmap_next_start = addr; - } - /* addr is sufficiently low to align it up */ - if (alignment != 0) { - addr = (addr + alignment) & ~(alignment - 1); - } - return addr; + return ret; } /* From patchwork Sat Jul 15 13:53:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 703212 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e4d:0:b0:314:25da:8dc4 with SMTP id r13csp156904wrt; Sat, 15 Jul 2023 06:54:57 -0700 (PDT) X-Google-Smtp-Source: APBJJlFVmPxPes22kwAEBlGQ6u+HcQs9zpsBmSg5bXosvpvt7FaX4Rvy1TVOUUTon/TgAYom3/cr X-Received: by 2002:a05:622a:507:b0:3f8:4905:9533 with SMTP id l7-20020a05622a050700b003f849059533mr9468599qtx.50.1689429297025; Sat, 15 Jul 2023 06:54:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689429297; cv=none; d=google.com; s=arc-20160816; b=tnMKzHP6icm/EcEq6TdKniF5BYjTXMMMxboTz8qkEdHDD7pXuCbT+ynn4PCmKUB5Tx Lq9x/ENfNuQNbt0QwZVNOf4SDQDCG4QjeuzIgmbxf/7bSw9pvQ866n+gCWxi7bctGjV7 zExus6ErRHJaSjO3/0Yqx08UhzKKP1S+7mKpQiakHcOJycfm6Z7N6WhfoZCHSm1ZhBDg HJlNgtC01PGJIoF55NKg8C7jp4Kfufh0QGXspbJBFcXlhfVhqs+TnuMlqBH/ogzWaOxl nEIxtXt9ecAfhEPxJxirIZtDSHYrWihU6dhvywOKGcVNxJ4OGJ4jQNq1Z4DbxJzjQd2q VgTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=5+vFU351RDeVAwRNg/WDopVOnzTmK+ZtjZmF1Bh7abU=; fh=oYAd+8Lj9FKlReeF9hgENQXa3P4LhBP5C4njRBbobDA=; b=a9lVa07l8gh4MpSCl2vH1jjczS/qyA5RqcsfraDZrLU0SNl3/JnYcJn9cBwbx6sTkR 0uRfulc3KdFlI5nVhgpCLncIQysbtXBPOKH2ikALmm1eFP4Ht/46Z7cSgy5rts4TN95a s7Me8/YHfbVOphsLLX1pD9FLgkmmQqnBfTNImeaMm+1Femerx+NLiGbivjyuIj1z0ZKy Cz3x3F9dBuDrC2rHF5pRYTALKjTVQsd+c7acJtyT0M+7wbVCYCzg/zLvFcUTVGfSuXjs CPnlPmmxOIg3gW3XgQmis1//DmowtOHYlvzhhntew9zJMLBasbH4+btIcKQOjjWo9iXV S7nw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gl8UCtly; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id u41-20020a05622a19a900b00403a9229a02si5827805qtc.377.2023.07.15.06.54.56 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 15 Jul 2023 06:54:57 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gl8UCtly; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qKfjS-0004oW-HQ; Sat, 15 Jul 2023 09:54:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qKfib-00048s-R0 for qemu-devel@nongnu.org; Sat, 15 Jul 2023 09:53:59 -0400 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qKfiX-0001KV-JP for qemu-devel@nongnu.org; Sat, 15 Jul 2023 09:53:52 -0400 Received: by mail-wr1-x429.google.com with SMTP id ffacd0b85a97d-3158a5e64b6so2838277f8f.0 for ; Sat, 15 Jul 2023 06:53:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689429226; x=1692021226; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=5+vFU351RDeVAwRNg/WDopVOnzTmK+ZtjZmF1Bh7abU=; b=gl8UCtlyjZ+44cSU46EvsZ6D3W6fUiGFIVosIPmVY/yq5QzH+2yS8TzW9HJHyQhhX5 ctlh4pp4E9CrrLkMEOLYlop9lsHZAnxryhpCPMrClNS5W4xhM2+ChL6a3mxtOF48mTx8 HlwPsnmYNwy7rfbKwx8mbKXO+JsX3LDSIOP+3uKUhYabJKw7GtdMCUb4+Ry8N2reRgJg abA5Ss+WF8Hn334/cwEX/a2QIn2iY7K09eCn90X2Et8ZC96shSdkODyiv+3AXCbrmkCY EcjQ+5QkUJvht470p0uHXG5KRRhvkyF+LHYouag0xGI+6K8iYcWSEVqLRC3L7b/M/4SK a+Ew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689429226; x=1692021226; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5+vFU351RDeVAwRNg/WDopVOnzTmK+ZtjZmF1Bh7abU=; b=GynDokG/71TfYCp0VmTg0G1KsWmZATXA8D+FtR3Bhd7qoQUaQkW1KjcsRcYCSDniNU kG97H7PoC59Yx84Zq7ua9pHtNofgoWs6uUbhr8qdfNSPO/LBsiZd2WHk27zWxSxBVr5P kz7S4tYpqOjfu4RrIE6ue2mrA+VqCwwz6lBc7DrG5aV8iyFh8lFGNnSSzBbzLfXTIbQK XnY4Fr7gKiMwkVqLyNjN7g+y+gYqIUZPU/ydXDoKnnrcuwOXlBlni7NrhmhhvNQX0b3t L/K+69yE3dS5XC3lws66lb+TaIr+AxoM+d6WW/R/9mpyUyUU+tCPgMGXLnkFkh9Exq18 Py/w== X-Gm-Message-State: ABy/qLZGPUMoQcP6iSFhcnf6Avhhhlt5ggXfLko4atPWUO48iOGAFhao owxm7v3BOji7WZkLzqCgrJJXcR9QUECko7gj0/fkEQ== X-Received: by 2002:a5d:698a:0:b0:314:35e2:e28d with SMTP id g10-20020a5d698a000000b0031435e2e28dmr5522907wru.13.1689429226689; Sat, 15 Jul 2023 06:53:46 -0700 (PDT) Received: from stoup.lan ([51.219.12.49]) by smtp.gmail.com with ESMTPSA id k10-20020a5d66ca000000b00313f9085119sm13838014wrw.113.2023.07.15.06.53.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Jul 2023 06:53:46 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 35/47] linux-user: Use page_find_range_empty for mmap_find_vma_reserved Date: Sat, 15 Jul 2023 14:53:05 +0100 Message-Id: <20230715135317.7219-36-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230715135317.7219-1-richard.henderson@linaro.org> References: <20230715135317.7219-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::429; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x429.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Use the interval tree to find empty space, rather than probing each page in turn. Signed-off-by: Richard Henderson Message-Id: <20230707204054.8792-19-richard.henderson@linaro.org> --- linux-user/mmap.c | 52 ++++++----------------------------------------- 1 file changed, 6 insertions(+), 46 deletions(-) diff --git a/linux-user/mmap.c b/linux-user/mmap.c index c4b2515271..738b9b797d 100644 --- a/linux-user/mmap.c +++ b/linux-user/mmap.c @@ -318,55 +318,15 @@ unsigned long last_brk; static abi_ulong mmap_find_vma_reserved(abi_ulong start, abi_ulong size, abi_ulong align) { - abi_ulong addr, end_addr, incr = qemu_host_page_size; - int prot; - bool looped = false; + target_ulong ret; - if (size > reserved_va) { - return (abi_ulong)-1; + ret = page_find_range_empty(start, reserved_va, size, align); + if (ret == -1 && start > mmap_min_addr) { + /* Restart at the beginning of the address space. */ + ret = page_find_range_empty(mmap_min_addr, start - 1, size, align); } - /* Note that start and size have already been aligned by mmap_find_vma. */ - - end_addr = start + size; - /* - * Start at the top of the address space, ignoring the last page. - * If reserved_va == UINT32_MAX, then end_addr wraps to 0, - * throwing the rest of the calculations off. - * TODO: rewrite using last_addr instead. - * TODO: use the interval tree instead of probing every page. - */ - if (start > reserved_va - size) { - end_addr = ((reserved_va - size) & -align) + size; - looped = true; - } - - /* Search downward from END_ADDR, checking to see if a page is in use. */ - addr = end_addr; - while (1) { - addr -= incr; - if (addr > end_addr) { - if (looped) { - /* Failure. The entire address space has been searched. */ - return (abi_ulong)-1; - } - /* Re-start at the top of the address space (see above). */ - addr = end_addr = ((reserved_va - size) & -align) + size; - looped = true; - } else { - prot = page_get_flags(addr); - if (prot) { - /* Page in use. Restart below this page. */ - addr = end_addr = ((addr - size) & -align) + size; - } else if (addr && addr + size == end_addr) { - /* Success! All pages between ADDR and END_ADDR are free. */ - if (start == mmap_next_start) { - mmap_next_start = addr; - } - return addr; - } - } - } + return ret; } /* From patchwork Sat Jul 15 13:53:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 703252 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e4d:0:b0:314:25da:8dc4 with SMTP id r13csp160961wrt; Sat, 15 Jul 2023 07:03:25 -0700 (PDT) X-Google-Smtp-Source: APBJJlHMDgpQlNJ8N0MyBz7kNQqS+DJg5f+fdf8P7qUfvavT2TQ0Zunv3RAhnKBwk0p75JvBbkNM X-Received: by 2002:a05:622a:104a:b0:3ec:490b:ce6e with SMTP id f10-20020a05622a104a00b003ec490bce6emr9844140qte.48.1689429805452; Sat, 15 Jul 2023 07:03:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689429805; cv=none; d=google.com; s=arc-20160816; b=dbTBzjyyFLZ71FI0FnA4snlji0uHR4hbpoEGcUL6VjNLhNKUAa6thY3hZl19Ltserq VCWZ4LF3hE9QamVOsEW2N5cVLgwJKstiVh8En6+qAdqT6ZA2nkDMBmDHgNRi9cvt+qfu FQ4Mwc/K9wwzKDCPoUCsgk0R+fClhGFufHkUDQzQpQ9TN2SCx/o8urqURZbK37z4F7u2 Iw6fvuJauMcKvYyL/MkDgyHbtUPG8ZOMcprBWkYWM0kyYnNKPXd5iJUwisXvRHJY2TZ5 0tehDQ+4sBqCMzc+L2KMwnuxiH76WDN/egH0IELxoGSJilZk0DOdreccF8uca74Fp5Cq doCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=jfvLV6T2p9fP56/v/Xia6iQ7yK2dQ6zBkNiykDOKhfw=; fh=i1mkeM7bD/ppus3C3v+92ltBBCUUU0zBXrpbYjAjHqE=; b=cbdLy7BA0SPtu4+aj+jV8wJJa1O3cQwffp8SKthNnGB1JpVPcGp63nfdpG1jZd8LeH MvzPLMztYvgU68m6qyvR+uwXJp6Nyym8OLd4G5eJfMHzz1IY4PejOaWZ8Pieot2c+D4m 4NCuCkvQUVPdVtaWvRCIDhmHMJjanVtEYws2jMpAgN5xgDZ/bWNEaoRZvsewW4dmz74B WkWt32PQ4XDD5nJMWfwVOZpCQpBumAq7DYFj2xXFBxXNy0Uf2SXm1hgZEqAOf6hlmoiu XgEwVUh/JJEFjTtPgrAZ0Ea+u59cPcR+IA7hUfvwKMgl93SHnvTG9m23Z18m6+6w6uws Jrbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EMQyNSae; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id m20-20020a05622a055400b00403aa8095aesi6191951qtx.665.2023.07.15.07.03.25 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 15 Jul 2023 07:03:25 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EMQyNSae; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qKfis-0004Ea-Dr; Sat, 15 Jul 2023 09:54:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qKfif-00049O-Ch for qemu-devel@nongnu.org; Sat, 15 Jul 2023 09:54:00 -0400 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qKfiX-0001Kb-JH for qemu-devel@nongnu.org; Sat, 15 Jul 2023 09:53:54 -0400 Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-3110ab7110aso3044055f8f.3 for ; Sat, 15 Jul 2023 06:53:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689429227; x=1692021227; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=jfvLV6T2p9fP56/v/Xia6iQ7yK2dQ6zBkNiykDOKhfw=; b=EMQyNSaeIKeDjVFlaVD5gqYRd55tk+AR81ac1OEKLIKnmiUvIb0xX9oVRez+CgM8NC xNnQkgiPfbsL0cKC+eJRVn8ON5pi6jh1MBH1tpM0NB9485xXe2hrwuDzsJ/JMGXRJkYb vlQphrJbOXT5RB8FkrSdlbxweMEpcwlh38UVd0kVsyR39n4JT10rBub3z9V6AZYlahgt S0O5DJl19Wb9dUelScpBh0bL4hCE4bEmMXKs/nnC/rJpa6wsWnDV/qULyXzQQoPpbvKQ ASp9GG0ahV4n5php7HBCBCJ0rxHqCk0YfaMGjsAbxvLfSgDb8AoyMjD5Brgp8D3bTVjy AjfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689429227; x=1692021227; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jfvLV6T2p9fP56/v/Xia6iQ7yK2dQ6zBkNiykDOKhfw=; b=RP22RhbOWUbkrhiMk9JDuCme8FOv2AIPzwzt7hXI+8f7XwmenR/ExfiFnkPSJF/qoI Oe4wG34q1xwtbbRM2oMiOwJqNFaS4omExysW1sofKikLTfaw4FAFAf4VOOml//2qa5wo Ma5RHi7RK9MLfyrS968ZgZ4DVPYROW8HVQ7L9OfJy73c487gvZ3DfISIydCpQ7oo77Xb +LxiXOR0zsgoaiUJvjfcVOYKWvJ565N3aOTg3I1r09xiBymAblSnSgcOBkd0s8ecc0gf eofDgdynGWUwdgWVtssNB9mh0f8SEofiMlJSYhpFacFSSaXhnTxi7CASAg+IHUjr61Ez Z73w== X-Gm-Message-State: ABy/qLYQ9MBhF8oBRisE5M4c0wGiqOmIuQQtlhYThCRLQrIw2DuH3zvB htscNUEmHWiHuOd4FNplp2lptUXT+CCEXAVTGMCHeg== X-Received: by 2002:a5d:5651:0:b0:314:3a3d:5d1f with SMTP id j17-20020a5d5651000000b003143a3d5d1fmr7217201wrw.19.1689429227461; Sat, 15 Jul 2023 06:53:47 -0700 (PDT) Received: from stoup.lan ([51.219.12.49]) by smtp.gmail.com with ESMTPSA id k10-20020a5d66ca000000b00313f9085119sm13838014wrw.113.2023.07.15.06.53.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Jul 2023 06:53:47 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL 36/47] linux-user: Use 'last' instead of 'end' in target_mmap Date: Sat, 15 Jul 2023 14:53:06 +0100 Message-Id: <20230715135317.7219-37-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230715135317.7219-1-richard.henderson@linaro.org> References: <20230715135317.7219-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42c; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x42c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Complete the transition within the mmap functions to a formulation that does not overflow at the end of the address space. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20230707204054.8792-20-richard.henderson@linaro.org> --- linux-user/mmap.c | 45 +++++++++++++++++++++++---------------------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/linux-user/mmap.c b/linux-user/mmap.c index 738b9b797d..bb9cbe52cd 100644 --- a/linux-user/mmap.c +++ b/linux-user/mmap.c @@ -456,8 +456,8 @@ abi_ulong mmap_find_vma(abi_ulong start, abi_ulong size, abi_ulong align) abi_long target_mmap(abi_ulong start, abi_ulong len, int target_prot, int flags, int fd, off_t offset) { - abi_ulong ret, end, real_start, real_end, retaddr, host_len, - passthrough_start = -1, passthrough_end = -1; + abi_ulong ret, last, real_start, real_last, retaddr, host_len; + abi_ulong passthrough_start = -1, passthrough_last = 0; int page_flags; off_t host_offset; @@ -581,29 +581,30 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int target_prot, host_start += offset - host_offset; } start = h2g(host_start); + last = start + len - 1; passthrough_start = start; - passthrough_end = start + len; + passthrough_last = last; } else { if (start & ~TARGET_PAGE_MASK) { errno = EINVAL; goto fail; } - end = start + len; - real_end = HOST_PAGE_ALIGN(end); + last = start + len - 1; + real_last = HOST_PAGE_ALIGN(last) - 1; /* * Test if requested memory area fits target address space * It can fail only on 64-bit host with 32-bit target. * On any other target/host host mmap() handles this error correctly. */ - if (end < start || !guest_range_valid_untagged(start, len)) { + if (last < start || !guest_range_valid_untagged(start, len)) { errno = ENOMEM; goto fail; } /* Validate that the chosen range is empty. */ if ((flags & MAP_FIXED_NOREPLACE) - && !page_check_range_empty(start, end - 1)) { + && !page_check_range_empty(start, last)) { errno = EEXIST; goto fail; } @@ -642,9 +643,9 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int target_prot, /* handle the start of the mapping */ if (start > real_start) { - if (real_end == real_start + qemu_host_page_size) { + if (real_last == real_start + qemu_host_page_size - 1) { /* one single host page */ - if (!mmap_frag(real_start, start, end - 1, + if (!mmap_frag(real_start, start, last, target_prot, flags, fd, offset)) { goto fail; } @@ -658,18 +659,18 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int target_prot, real_start += qemu_host_page_size; } /* handle the end of the mapping */ - if (end < real_end) { - if (!mmap_frag(real_end - qemu_host_page_size, - real_end - qemu_host_page_size, end - 1, + if (last < real_last) { + abi_ulong real_page = real_last - qemu_host_page_size + 1; + if (!mmap_frag(real_page, real_page, last, target_prot, flags, fd, - offset + real_end - qemu_host_page_size - start)) { + offset + real_page - start)) { goto fail; } - real_end -= qemu_host_page_size; + real_last -= qemu_host_page_size; } /* map the middle (easier) */ - if (real_start < real_end) { + if (real_start < real_last) { void *p; off_t offset1; @@ -678,13 +679,13 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int target_prot, } else { offset1 = offset + real_start - start; } - p = mmap(g2h_untagged(real_start), real_end - real_start, + p = mmap(g2h_untagged(real_start), real_last - real_start + 1, target_to_host_prot(target_prot), flags, fd, offset1); if (p == MAP_FAILED) { goto fail; } passthrough_start = real_start; - passthrough_end = real_end; + passthrough_last = real_last; } } the_end1: @@ -692,16 +693,16 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int target_prot, page_flags |= PAGE_ANON; } page_flags |= PAGE_RESET; - if (passthrough_start == passthrough_end) { - page_set_flags(start, start + len - 1, page_flags); + if (passthrough_start > passthrough_last) { + page_set_flags(start, last, page_flags); } else { if (start < passthrough_start) { page_set_flags(start, passthrough_start - 1, page_flags); } - page_set_flags(passthrough_start, passthrough_end - 1, + page_set_flags(passthrough_start, passthrough_last, page_flags | PAGE_PASSTHROUGH); - if (passthrough_end < start + len) { - page_set_flags(passthrough_end, start + len - 1, page_flags); + if (passthrough_last < last) { + page_set_flags(passthrough_last + 1, last, page_flags); } } the_end: From patchwork Sat Jul 15 13:53:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 703235 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e4d:0:b0:314:25da:8dc4 with SMTP id r13csp157924wrt; Sat, 15 Jul 2023 06:57:39 -0700 (PDT) X-Google-Smtp-Source: APBJJlGtEOu3QLF3ub9pwivp2YrPBfMxjHYQW5uhN47MZJ/XBtdakpGBtiTT/tdC0IyZCXIYOGbo X-Received: by 2002:ac8:5984:0:b0:3f0:ac80:1ed7 with SMTP id e4-20020ac85984000000b003f0ac801ed7mr9929243qte.45.1689429459600; Sat, 15 Jul 2023 06:57:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689429459; cv=none; d=google.com; s=arc-20160816; b=oYYIDdNQqct2kyaflaZfGEr4/E7CM+6OEoPpFe/yehnw8QVmMO/SnhI9iShXbyLeRM J8Pd5RKZQmyBh34OYPb/aLESMeJ4/Frigl5oMDDcX5Np06SlPQzClFLXMrSxyeEi+Twz CoYOImGyIlHiZ88OqLWZ9Pg7ciYHL5g+ptApoTff13C+MIqdNmggJyVCdIYOn+rvUh3O utENE7xt2yusd2+mSu+7BT9SGCGDM4L4RwWYIzPxtA0BRnpgWSz8iMmdXSBrzY1vDpA/ u6HkCsnS50avrteG8kbKxxNbtqktZ/bnz39dq0R7DVerrWDekiaoUg9CS1VKN61SpkYM 8VwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=LwsEQEgJb6LbDaZv4vgO4Dp17xTKrnyDcX9Cf57n7+Y=; fh=oYAd+8Lj9FKlReeF9hgENQXa3P4LhBP5C4njRBbobDA=; b=QekTXDWyGQAFiWc4hM7STGBZMsjG8DnVNoXr9LyqaZbS1SsYXSQ1NxxBeLeMd67EMe 66y0OvxSWjYLcX4d2hvtyD05Gh8JoBHVKsuSFIy6ALsd+LEbtNqSm74UuNiJ0VFuIQnl SFKOxBwDk9DHCEplMJQEJ06t1JbVQZOUTXgAwhK7VXb0UTnXfyi3YvVCtD+b2qE0Xx/F do32eJ4IpjB2PUuDvqZwKny9PJcbrIBDhLGQwDBF2Sj5Leiy5IEHpJwxAa7DSuv9Bh6G UVP5aL18NoQBjaA2IuTyVr625i9YQLLIQ+HQyqk7K+jftjF9TtPZUjdRTkA0/ydomCdb IreA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PK6NCBQ1; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id v34-20020a05622a18a200b004033b097693si5893276qtc.400.2023.07.15.06.57.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 15 Jul 2023 06:57:39 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PK6NCBQ1; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qKfjm-000738-5e; Sat, 15 Jul 2023 09:55:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qKfid-000497-Su for qemu-devel@nongnu.org; Sat, 15 Jul 2023 09:53:59 -0400 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qKfiZ-0001Kh-OQ for qemu-devel@nongnu.org; Sat, 15 Jul 2023 09:53:54 -0400 Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-307d20548adso2876698f8f.0 for ; Sat, 15 Jul 2023 06:53:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689429228; x=1692021228; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=LwsEQEgJb6LbDaZv4vgO4Dp17xTKrnyDcX9Cf57n7+Y=; b=PK6NCBQ11EP0lR00GNVRNRVEUJBe5UKTgcyP6kURdm3MgvaUhca6ycc8EhwpbZDq7v KGeu0WpGDi/3/9XMmdVS6ljII9JqQUHtZBBCsVAoT8HurlsX26Y+MDjxCVlyQIsWwWez ayIr6bF22eZaRW6vnCJMla6TQePATSgLW78WntuU00w+qoWqZkNPEDRXwGNGBQMlwSeS knkz4xq3/+RRvI+juKG/pGTXrV2n9wXjY8QJsrst2abcC7hrOfLZg1uJUnDeMqMjix1c LrbrFly5WQm384Ngq80AoIruqea93BGwkvizffz2aa6i82E2DJpaQaQEqiFXLBpNPlkC PcLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689429228; x=1692021228; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LwsEQEgJb6LbDaZv4vgO4Dp17xTKrnyDcX9Cf57n7+Y=; b=VxmFLdZEPyf9Dlx5cPbLG5hol5eKoE9AMw0C37ys+3MOlFuYlH4DO/F0uZvtlY/m/H RPz++NSLGk6l84QOruNIXU9jFpa5wpdlENO9ZwBI302I6ACVw+5hKYlizE8a9Fl2QAwv czCKAxzy/hPcmrxd6yZzGx6I4rC+DDLx9pb9nQE5hUnzKRv9N0Agsd16YZdVOxZoEnjb HRgq0EwdsCbydKG3Rn94uQ/P7/PxTIP1xc3x+22hmAW56WdbvkRQ8jXH+1Lhd+55BsDD DpfbhzGq8sFxEJiusew66Gxg9YynTyFfeyIqUgz3T/hh20bPJZi5LND9vsxmpCrA2yLg kDvA== X-Gm-Message-State: ABy/qLb94hOFwQMvIMzDbR9lpmqpmcPC6QbCddEFth+COAm+QmObQ7Gb OE5tpy+v8vwE2G1anMQOSWEz+PxnORNKoIrML3ywzA== X-Received: by 2002:adf:de8e:0:b0:30f:c56c:b5b3 with SMTP id w14-20020adfde8e000000b0030fc56cb5b3mr6760789wrl.4.1689429228141; Sat, 15 Jul 2023 06:53:48 -0700 (PDT) Received: from stoup.lan ([51.219.12.49]) by smtp.gmail.com with ESMTPSA id k10-20020a5d66ca000000b00313f9085119sm13838014wrw.113.2023.07.15.06.53.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Jul 2023 06:53:47 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 37/47] linux-user: Rewrite mmap_reserve Date: Sat, 15 Jul 2023 14:53:07 +0100 Message-Id: <20230715135317.7219-38-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230715135317.7219-1-richard.henderson@linaro.org> References: <20230715135317.7219-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42c; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x42c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Use 'last' variables instead of 'end' variables; be careful about avoiding overflow. Assert that the mmap succeeded. Signed-off-by: Richard Henderson Message-Id: <20230707204054.8792-21-richard.henderson@linaro.org> --- linux-user/mmap.c | 68 +++++++++++++++++++++++++++++------------------ 1 file changed, 42 insertions(+), 26 deletions(-) diff --git a/linux-user/mmap.c b/linux-user/mmap.c index bb9cbe52cd..6308787942 100644 --- a/linux-user/mmap.c +++ b/linux-user/mmap.c @@ -722,47 +722,63 @@ fail: return -1; } -static void mmap_reserve(abi_ulong start, abi_ulong size) +static void mmap_reserve(abi_ulong start, abi_ulong len) { abi_ulong real_start; - abi_ulong real_end; - abi_ulong addr; - abi_ulong end; + abi_ulong real_last; + abi_ulong real_len; + abi_ulong last; + abi_ulong a; + void *host_start, *ptr; int prot; + last = start + len - 1; real_start = start & qemu_host_page_mask; - real_end = HOST_PAGE_ALIGN(start + size); - end = start + size; - if (start > real_start) { - /* handle host page containing start */ + real_last = HOST_PAGE_ALIGN(last) - 1; + + /* + * If guest pages remain on the first or last host pages, + * adjust the deallocation to retain those guest pages. + * The single page special case is required for the last page, + * lest real_start overflow to zero. + */ + if (real_last - real_start < qemu_host_page_size) { prot = 0; - for (addr = real_start; addr < start; addr += TARGET_PAGE_SIZE) { - prot |= page_get_flags(addr); + for (a = real_start; a < start; a += TARGET_PAGE_SIZE) { + prot |= page_get_flags(a); } - if (real_end == real_start + qemu_host_page_size) { - for (addr = end; addr < real_end; addr += TARGET_PAGE_SIZE) { - prot |= page_get_flags(addr); - } - end = real_end; + for (a = last; a < real_last; a += TARGET_PAGE_SIZE) { + prot |= page_get_flags(a + 1); + } + if (prot != 0) { + return; + } + } else { + for (prot = 0, a = real_start; a < start; a += TARGET_PAGE_SIZE) { + prot |= page_get_flags(a); } if (prot != 0) { real_start += qemu_host_page_size; } - } - if (end < real_end) { - prot = 0; - for (addr = end; addr < real_end; addr += TARGET_PAGE_SIZE) { - prot |= page_get_flags(addr); + + for (prot = 0, a = last; a < real_last; a += TARGET_PAGE_SIZE) { + prot |= page_get_flags(a + 1); } if (prot != 0) { - real_end -= qemu_host_page_size; + real_last -= qemu_host_page_size; + } + + if (real_last < real_start) { + return; } } - if (real_start != real_end) { - mmap(g2h_untagged(real_start), real_end - real_start, PROT_NONE, - MAP_FIXED | MAP_ANONYMOUS | MAP_PRIVATE | MAP_NORESERVE, - -1, 0); - } + + real_len = real_last - real_start + 1; + host_start = g2h_untagged(real_start); + + ptr = mmap(host_start, real_len, PROT_NONE, + MAP_FIXED | MAP_ANONYMOUS | MAP_PRIVATE | MAP_NORESERVE, -1, 0); + assert(ptr == host_start); } int target_munmap(abi_ulong start, abi_ulong len) From patchwork Sat Jul 15 13:53:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 703237 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e4d:0:b0:314:25da:8dc4 with SMTP id r13csp158101wrt; Sat, 15 Jul 2023 06:58:07 -0700 (PDT) X-Google-Smtp-Source: APBJJlG1emLk5i1/T/z6hkBL+m97vW3NeGGZ3aSHa8btLvTtno624h3fPZgF5LqZF2qXZ0e9gaE7 X-Received: by 2002:a05:622a:446:b0:403:3af1:367a with SMTP id o6-20020a05622a044600b004033af1367amr8972502qtx.2.1689429487335; Sat, 15 Jul 2023 06:58:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689429487; cv=none; d=google.com; s=arc-20160816; b=F4OLXLXQ6FE58hm1345ETTew7rkg58DVxbGX7TuGb8fPmVdo3dS2WpCLA7sFNHTyCr icNY7UgQs9MGahvUpDXuB3zbVvdB5cwELZS4MYZJ0ha1OlqppiBj2GRSO97bZ2nStbux lsP+oeONZxfE9WahhUXI8jkf0kvMD9aIC7NYUmcAK8cYHEGFB/7bNqmHeAQrQBfPTJfr 22vwB1fZUXPjXSm7TdZMtizEczUDx4JhQnw9+g5WM/LeA3soJglERp9vN4fH7WfIr4py a+X39a0bINAvXk++mk1XutDeaz8B6jPVAIG6/jXv5dUkNYCRlgAw/9ETFMzMBn4VzT7a qL3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=PG65sHHMcFZxBzSd8xJSgpPdsxuZoeu52o+OB1adTRg=; fh=oYAd+8Lj9FKlReeF9hgENQXa3P4LhBP5C4njRBbobDA=; b=vxzt4Oei5mruZVvK/T3XUPFi7iwXm0fVWHBUOijFt4SfbzdY7jDUGoxeod6eDhDT1v 2fblxqYSb2YbP4KTqk51oInU0C17s9kOpXsHmLnUtstCbBlndTojfKATXlqEMIcQf6Gp a9+we6JUUqHqHpnnuwZQ+jZcPa0EX5UN7rKn8uHqTXRMNlG/cxi3sEiJu82agVmD9n2C 7rBiLvJje2YIfLSeTuR+gp0ce/fI1cnuHs4e6GP6dke1Jrsudkubw6DfhRRIcozVuI7G GM3bMVAdZpoYloak953W1xFqDsktpadscPmZcbiJ1LIMiM94R0h00WsjDT4ekDG1hPPp hnpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KsEzQ2CI; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id f38-20020a05622a1a2600b00403b395b43dsi5926069qtb.583.2023.07.15.06.58.07 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 15 Jul 2023 06:58:07 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KsEzQ2CI; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qKfjm-00072z-4g; Sat, 15 Jul 2023 09:55:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qKfid-000499-TC for qemu-devel@nongnu.org; Sat, 15 Jul 2023 09:53:59 -0400 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qKfiZ-0001Km-QG for qemu-devel@nongnu.org; Sat, 15 Jul 2023 09:53:54 -0400 Received: by mail-wr1-x432.google.com with SMTP id ffacd0b85a97d-314319c0d3eso3008516f8f.0 for ; Sat, 15 Jul 2023 06:53:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689429229; x=1692021229; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=PG65sHHMcFZxBzSd8xJSgpPdsxuZoeu52o+OB1adTRg=; b=KsEzQ2CILNo2bUkSWMRMbIrnUJtdSLfnFKitW97iizEnnzxrHyVe0xaupU5K9GUrEI XsRXSDIwY9s9pmSbE7NuaPmxsTV3kIB1M0j5h49vWeI5fHBnovoL6HDXs3JXPS5LPWCF qXjtdfTIy0HxjVeVy5DT73z30AojyRYUK2mBtEAsJIhejhzXGrclLVczgoWM1MMlMEX4 kLYjog0sBS9m7klgyi2XohQPm8dLY17qGRYBaEGmlYuR8zHnQZpGLIefJgG00WFk4qmR PamL9aRdtMkCzPTIP8EoaBneFbxkV5+oYcXqunEFsnZAyYcxUMdmXePRCElqrnAO3eFI ze2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689429229; x=1692021229; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=PG65sHHMcFZxBzSd8xJSgpPdsxuZoeu52o+OB1adTRg=; b=d+4e0dMapynzNKrCVUyyLlrRhwXZ7O/Koyt3AxVS+xhudwtcgpBotLp5GKMWjqL8Jd h0+IIkzUvkUx0GS28DVjV21ybQxcWKm5P/AOIC3t91focGkGQYnv3IiWXNT2B0kpiKJD Q3OG0sN7uSCNstCLmJA0VU6NjesxO18DElZ+hFZWdbnKWWCD4ltGJUqnuMR4SY5LVu+y VtoFZc1c+O7nUe+WBfLE6J9npstA6QJkDA5oCwGwsyWLJ5nLBg/DhGmp99Wq8RjQ3MsF aRZmxESRR0QdoUiGHVLojsIGSfUSHXAH7YjXMgmJFQYa8zf21M5WBnPF82w8lzLguHpX W7Jg== X-Gm-Message-State: ABy/qLYflgu7zfg4bGUEZxMaKb2Pn9HhNnxT6ZFb2V6tIt2hAm9ZYqZK YaVDsUcdBJZWwbLNJ5v1rnraMvLy7ZxZYMS4t9lRTw== X-Received: by 2002:a5d:66c3:0:b0:313:ffdd:a707 with SMTP id k3-20020a5d66c3000000b00313ffdda707mr6758890wrw.35.1689429228812; Sat, 15 Jul 2023 06:53:48 -0700 (PDT) Received: from stoup.lan ([51.219.12.49]) by smtp.gmail.com with ESMTPSA id k10-20020a5d66ca000000b00313f9085119sm13838014wrw.113.2023.07.15.06.53.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Jul 2023 06:53:48 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 38/47] linux-user: Rename mmap_reserve to mmap_reserve_or_unmap Date: Sat, 15 Jul 2023 14:53:08 +0100 Message-Id: <20230715135317.7219-39-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230715135317.7219-1-richard.henderson@linaro.org> References: <20230715135317.7219-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::432; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x432.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org If !reserved_va, munmap instead and assert success. Update all callers. Signed-off-by: Richard Henderson Message-Id: <20230707204054.8792-22-richard.henderson@linaro.org> --- linux-user/mmap.c | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/linux-user/mmap.c b/linux-user/mmap.c index 6308787942..22c2869be8 100644 --- a/linux-user/mmap.c +++ b/linux-user/mmap.c @@ -722,14 +722,14 @@ fail: return -1; } -static void mmap_reserve(abi_ulong start, abi_ulong len) +static void mmap_reserve_or_unmap(abi_ulong start, abi_ulong len) { abi_ulong real_start; abi_ulong real_last; abi_ulong real_len; abi_ulong last; abi_ulong a; - void *host_start, *ptr; + void *host_start; int prot; last = start + len - 1; @@ -776,9 +776,15 @@ static void mmap_reserve(abi_ulong start, abi_ulong len) real_len = real_last - real_start + 1; host_start = g2h_untagged(real_start); - ptr = mmap(host_start, real_len, PROT_NONE, - MAP_FIXED | MAP_ANONYMOUS | MAP_PRIVATE | MAP_NORESERVE, -1, 0); - assert(ptr == host_start); + if (reserved_va) { + void *ptr = mmap(host_start, real_len, PROT_NONE, + MAP_FIXED | MAP_ANONYMOUS + | MAP_PRIVATE | MAP_NORESERVE, -1, 0); + assert(ptr == host_start); + } else { + int ret = munmap(host_start, real_len); + assert(ret == 0); + } } int target_munmap(abi_ulong start, abi_ulong len) @@ -830,11 +836,7 @@ int target_munmap(abi_ulong start, abi_ulong len) ret = 0; /* unmap what we can */ if (real_start < real_end) { - if (reserved_va) { - mmap_reserve(real_start, real_end - real_start); - } else { - ret = munmap(g2h_untagged(real_start), real_end - real_start); - } + mmap_reserve_or_unmap(real_start, real_end - real_start); } if (ret == 0) { @@ -871,7 +873,7 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size, * If new and old addresses overlap then the above mremap will * already have failed with EINVAL. */ - mmap_reserve(old_addr, old_size); + mmap_reserve_or_unmap(old_addr, old_size); } } else if (flags & MREMAP_MAYMOVE) { abi_ulong mmap_start; @@ -886,7 +888,7 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size, flags | MREMAP_FIXED, g2h_untagged(mmap_start)); if (reserved_va) { - mmap_reserve(old_addr, old_size); + mmap_reserve_or_unmap(old_addr, old_size); } } } else { @@ -912,7 +914,8 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size, errno = ENOMEM; host_addr = MAP_FAILED; } else if (reserved_va && old_size > new_size) { - mmap_reserve(old_addr + old_size, old_size - new_size); + mmap_reserve_or_unmap(old_addr + old_size, + old_size - new_size); } } } else { From patchwork Sat Jul 15 13:53:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 703218 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e4d:0:b0:314:25da:8dc4 with SMTP id r13csp157210wrt; Sat, 15 Jul 2023 06:55:41 -0700 (PDT) X-Google-Smtp-Source: APBJJlHMQsebMfnfHnN4Bwj8rZ475fkzDKKQUnhNIaqEMkWTZvqIRIm0eNIbXArWbCi4p565x1Sf X-Received: by 2002:a0c:b25c:0:b0:635:e2c1:99e9 with SMTP id k28-20020a0cb25c000000b00635e2c199e9mr5712487qve.17.1689429341750; Sat, 15 Jul 2023 06:55:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689429341; cv=none; d=google.com; s=arc-20160816; b=qubVOY+Dn3Mxe52Kg2wM4Ysdxj5Dm7I61SHnW+RykYzE5TtVqOjWjKfHKTo7Qh9E/P TkxHqLLpEL/kOhsYTQqHThxb2apdzHntzJi8KiMAeKXXZKtommLf/OdmbyMMypRMP+DD 5l9EkftiuNAblFRCgAkJ5jBMcBM9UsjS3Uq6qV1OOfovc92vcneTM9q8RGBwlVORjud/ 9aViZq2X2AUeq2mlZkegC+nV+913APyR+3IqxVeiHljnNZ7bMRUlxagoft7zO9CEqT6d 6GHbHRjIL5o96RIPmNNcJeMDUOMblcdHAyaGsUzwwx0r/iXTA8r0xyS/VayI81YGzYcy 7CtA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=t83L6VQqehKor298fA996V/rrvqxT+XEe+3FbTWkw4k=; fh=oYAd+8Lj9FKlReeF9hgENQXa3P4LhBP5C4njRBbobDA=; b=QSI8nNI8McOvT3lrtsIG5fBB4xER8QOC9s1eVs7MhBP8RsDZcmVj7MsNJMynE5C0a0 fKoULb2cmHIafy01T5f3qtwsuXhbt86UuAik4NPmFnsFgJPptxFdfK/iJb/coi+Nf3h0 3Vy5YqcQFxPPg65YgstJXJoriihp6ZWoeip2N0RU0ZPhxQarCDhuAA00CBevxRLJ15YE 2QTGJq49ogEwwXNxUvTITdWSEOVZ4BcY4IULl3UEhFORzzKitDKkYw1MC2gyOlo7X3He Y2uq0EpAySPDoFmMZiKewocIYThNtfE/ztyJ1EMnSdsaBcOwGjiu0froEGB2GnCkl2Jl qjEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="N/4R3GDo"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id w14-20020a0cdf8e000000b006366264487bsi5885360qvl.359.2023.07.15.06.55.41 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 15 Jul 2023 06:55:41 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="N/4R3GDo"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qKfjX-0005g9-DI; Sat, 15 Jul 2023 09:54:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qKfid-00049A-TC for qemu-devel@nongnu.org; Sat, 15 Jul 2023 09:53:59 -0400 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qKfiZ-0001LE-Pq for qemu-devel@nongnu.org; Sat, 15 Jul 2023 09:53:54 -0400 Received: by mail-wr1-x42d.google.com with SMTP id ffacd0b85a97d-3143b88faebso3164980f8f.3 for ; Sat, 15 Jul 2023 06:53:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689429229; x=1692021229; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=t83L6VQqehKor298fA996V/rrvqxT+XEe+3FbTWkw4k=; b=N/4R3GDos6flYUkfDXuuINj+MwWeqSLkmO5dPE6Qw/ip5eF2hKewx4fUpm0D+RT+FI El4+RwMrBc0aBICbCRZyF7VOkipYBfN1KcdYSWRJL6pX5DQjxlgrv+mYxvwoMAG5Pxpd zaVl3udtP82F/HdLFvgWCWPP1S/2laQ4X22wzLsIOOFA6AE+M6c3/gO5qAWQwEB1/GM/ h/kWjKJWeqm2lHKXNT17rud7xFjPiJXMGV1aSVEsAWekmT8Moy+HdAFYSe9rmJ58L7U+ 86LGEmXBdDannawlg68H3OiYgVFpg/3Os9CKqDuIz+RjKqDgZKcOYT9OEAU3PB2UaQ+Q /Kmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689429229; x=1692021229; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=t83L6VQqehKor298fA996V/rrvqxT+XEe+3FbTWkw4k=; b=KzLNTD7h6d9pnEzLyKPwHjNBAQUkoAHT7/g+jGquy6S7E2T8nK5ATFM4Zlpnws5dlu OQZ97LDgu3eXKtohzqo4w+CVqm7n3P2c3uRVwRhwO+u6PYquWIHj8bi8BBr9MNw/W+5i Bfgznxv7AeJepG9tvAtgSMzIVdWridrLDy4bAiWr2m1AJ2qEeH+AIPWgD2znq/bfhqjM YoZtFYzBehwahv0EfM2eD4bmaN3Lmb3nErwMUPKZx16SwmQCTqLRoEzyimkWqJVXnuX6 Dp23RgluYn8Ta6No70SoJiRsZkqg2BMr8VT8oxy69n/xGERANanXEPJrZtMkR2uH1BzF aZ3Q== X-Gm-Message-State: ABy/qLav4yV0Qmgv6y1ZzUMSeKl0f/agXGgYQVgfDOil6p4fWtMIkjzb 0ASMTwW3JSn97llDXOK6cFxSZqqu7DLgSq5hWTX7UA== X-Received: by 2002:a5d:4844:0:b0:314:10d6:8910 with SMTP id n4-20020a5d4844000000b0031410d68910mr6581195wrs.63.1689429229392; Sat, 15 Jul 2023 06:53:49 -0700 (PDT) Received: from stoup.lan ([51.219.12.49]) by smtp.gmail.com with ESMTPSA id k10-20020a5d66ca000000b00313f9085119sm13838014wrw.113.2023.07.15.06.53.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Jul 2023 06:53:49 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 39/47] linux-user: Simplify target_munmap Date: Sat, 15 Jul 2023 14:53:09 +0100 Message-Id: <20230715135317.7219-40-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230715135317.7219-1-richard.henderson@linaro.org> References: <20230715135317.7219-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42d; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x42d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org All of the guest to host page adjustment is handled by mmap_reserve_or_unmap; there is no need to duplicate that. There are no failure modes for munmap after alignment and guest address range have been validated. Signed-off-by: Richard Henderson Message-Id: <20230707204054.8792-23-richard.henderson@linaro.org> --- linux-user/mmap.c | 47 ++++------------------------------------------- 1 file changed, 4 insertions(+), 43 deletions(-) diff --git a/linux-user/mmap.c b/linux-user/mmap.c index 22c2869be8..c0946322fb 100644 --- a/linux-user/mmap.c +++ b/linux-user/mmap.c @@ -789,9 +789,6 @@ static void mmap_reserve_or_unmap(abi_ulong start, abi_ulong len) int target_munmap(abi_ulong start, abi_ulong len) { - abi_ulong end, real_start, real_end, addr; - int prot, ret; - trace_target_munmap(start, len); if (start & ~TARGET_PAGE_MASK) { @@ -803,47 +800,11 @@ int target_munmap(abi_ulong start, abi_ulong len) } mmap_lock(); - end = start + len; - real_start = start & qemu_host_page_mask; - real_end = HOST_PAGE_ALIGN(end); - - if (start > real_start) { - /* handle host page containing start */ - prot = 0; - 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) { - prot |= page_get_flags(addr); - } - end = real_end; - } - if (prot != 0) { - real_start += qemu_host_page_size; - } - } - if (end < real_end) { - prot = 0; - for (addr = end; addr < real_end; addr += TARGET_PAGE_SIZE) { - prot |= page_get_flags(addr); - } - if (prot != 0) { - real_end -= qemu_host_page_size; - } - } - - ret = 0; - /* unmap what we can */ - if (real_start < real_end) { - mmap_reserve_or_unmap(real_start, real_end - real_start); - } - - if (ret == 0) { - page_set_flags(start, start + len - 1, 0); - } + mmap_reserve_or_unmap(start, len); + page_set_flags(start, start + len - 1, 0); mmap_unlock(); - return ret; + + return 0; } abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size, From patchwork Sat Jul 15 13:53:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 703236 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e4d:0:b0:314:25da:8dc4 with SMTP id r13csp158072wrt; Sat, 15 Jul 2023 06:57:59 -0700 (PDT) X-Google-Smtp-Source: APBJJlGiwR3aJh9Xo23/WNQ72EwyW1Bjj89QgI0qXtP6GUbOpRQC/n3cpWzPrrg767XbTVDgEuq6 X-Received: by 2002:a05:622a:1cb:b0:3f1:f599:c259 with SMTP id t11-20020a05622a01cb00b003f1f599c259mr9893848qtw.24.1689429479144; Sat, 15 Jul 2023 06:57:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689429479; cv=none; d=google.com; s=arc-20160816; b=laJ2BdSD3g5x7ielj29GOy16cS049jjmOJsWdYdPh2eVAmF+DdnpVJfbD67ijEg8/B ZsVugrkrsPtUvzLXR854WqM4al9Z5DSuk2MwRrVKXEOQY3TzSDmpjAMsUFCrazqGMcDd mM4qUiqdClLGT1GfoLoL7CRWQa553oet7iTVFCZIlwJKTr6OZSFSfyxyyeVkYXFVKjig UO8/hym2f0HuMQ8Oz5sp6MA8akIUSa4/H3v60kKkUBuESJkJb4SJ+h0BsERI734r2Yvm UcY50EbfatIS/C7qdGGlB6pgXEiLqhkT448NHS6cKCRgwb6kkm8ZLrZYlPiYJGkT1mGr FYzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+u+6sqOJ5iK1/8L4kug7OWcFShgptBBIOzAjdLQUcYU=; fh=i1mkeM7bD/ppus3C3v+92ltBBCUUU0zBXrpbYjAjHqE=; b=OjMrbC1au6O5jofo1cgZ+4iuBhEwQkdO83JzoM20InsuUO40hVGKcgn2HWMmjFGBUo xcXb12Lk49u3UGDDmfCmOBm8CQmAKsavbsBBFZD0qtHmRdxQfWGgXblgVIDAlREeqjkh IqaXHkYx7vxTJ17HzXSHCggzrXagQfJS7Ps9M8gEfThZTsMGGRrWh4ObXv6gfGgRniOH JhA1BFhycPBUChCevsdO4jd28Qd9vOxtN035qUZ6mwFgEf8wf7bEb/OQaV7Pg9axkJjm 8tw6ejkLLWRlwQHBCCh2yrnnpmEFiPzWSQX2+4ikMCkhLHdpmk0pA5gSCD9z53q9+myu 9f5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DPBwGA4c; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id y14-20020ac85f4e000000b00403cecf35bfsi3689837qta.297.2023.07.15.06.57.59 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 15 Jul 2023 06:57:59 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DPBwGA4c; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qKflc-00018A-5c; Sat, 15 Jul 2023 09:57:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qKflV-00012Q-La for qemu-devel@nongnu.org; Sat, 15 Jul 2023 09:56:54 -0400 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qKflU-0003Sv-26 for qemu-devel@nongnu.org; Sat, 15 Jul 2023 09:56:53 -0400 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-3fbd33a57ddso26493365e9.1 for ; Sat, 15 Jul 2023 06:56:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689429410; x=1692021410; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=+u+6sqOJ5iK1/8L4kug7OWcFShgptBBIOzAjdLQUcYU=; b=DPBwGA4ccsQTRo8BKtrDj302fkjletRdaai5a2Xo4Hpu2BFUOKCnGiOTazMZlDIyLR pmP8N/Uu15QenSIZKpUPw5B7xZkvy2opUk1lPLDwk+SW+Lr7sFwd7Of/pSLSnK8Dmq3I HK4pMOtVI6l20fkfk0rra2NA4Tj6kW8Na6IhwOlwQtdryNMx/fnwWVWdDIwEMmDETtWD e6WZvpK04VaLeF+fCdc/1C3sQ2UX9P8BpzNxI6wpK9OYZ8y9Fr2Ubh3bIUwZnZLBkfUg tdl5h/gJWYMgH49sPzxpyFYM4YI2oB9SRF/j//+9I2gKlKJvX3gJ951ECj1q6/h6O2Qq jURQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689429410; x=1692021410; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+u+6sqOJ5iK1/8L4kug7OWcFShgptBBIOzAjdLQUcYU=; b=kG9CqRvkds/8EDeiU7H4e64lJYe/yIkqpkH/r8qYQt2sVmMwXn7rXvwCze+tpyLB8l +hfVwBAIce4uni1/EMzw9jHQE/yE4/jY3mDDCQZMwj+LwW2Vw84MTWLBT8PCeMfK5RKL S0mN9EFmoKw/TCTxApKR6MNV3KQ4EPKsLhB5FeTCPvCnBygHQMoniQVjNWVFHITh4pex FjMQawslemN4qDOK4fVRRR/+7Tl6Fw7jiWv3E4n6D9AD+aqmAOm+H02j6N8DjnmnXVlA FcZ1mWR+g2viHK3WPwK4O7cx8dLjF5XTFA0r6uPed7fZePOiWDR5BTBn8xM3IPtiw+d0 fgFg== X-Gm-Message-State: ABy/qLbnKoJMYJbozpxAQD+3K08oi0W0MC0Le0jYgmXri/qwWtIsGD9x Ovqv/w1l4JeeZ0QwxILqWJsDBqwt6/H1Qvqmr5QueQ== X-Received: by 2002:adf:dcca:0:b0:313:ed1d:39d5 with SMTP id x10-20020adfdcca000000b00313ed1d39d5mr5749577wrm.35.1689429410475; Sat, 15 Jul 2023 06:56:50 -0700 (PDT) Received: from stoup.lan ([51.219.12.49]) by smtp.gmail.com with ESMTPSA id r8-20020a056000014800b0030fa3567541sm13866651wrx.48.2023.07.15.06.56.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Jul 2023 06:56:50 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL 40/47] accel/tcg: Accept more page flags in page_check_range Date: Sat, 15 Jul 2023 14:53:10 +0100 Message-Id: <20230715135317.7219-41-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230715135317.7219-1-richard.henderson@linaro.org> References: <20230715135317.7219-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32c; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x32c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Only PAGE_WRITE needs special attention, all others can be handled as we do for PAGE_READ. Adjust the mask. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20230707204054.8792-24-richard.henderson@linaro.org> --- accel/tcg/user-exec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/accel/tcg/user-exec.c b/accel/tcg/user-exec.c index e4f9563730..1e8fcaf6b0 100644 --- a/accel/tcg/user-exec.c +++ b/accel/tcg/user-exec.c @@ -561,8 +561,8 @@ int page_check_range(target_ulong start, target_ulong len, int flags) } missing = flags & ~p->flags; - if (missing & PAGE_READ) { - ret = -1; /* page not readable */ + if (missing & ~PAGE_WRITE) { + ret = -1; /* page doesn't match */ break; } if (missing & PAGE_WRITE) { From patchwork Sat Jul 15 13:53:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 703246 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e4d:0:b0:314:25da:8dc4 with SMTP id r13csp158857wrt; Sat, 15 Jul 2023 07:00:09 -0700 (PDT) X-Google-Smtp-Source: APBJJlG5NHkoLkUWPaPMVWI3qcqrOS/v7RvDNNKQun6h7ySzyZiaQF9OBSKyjI7GrEnWWreVP653 X-Received: by 2002:a37:2c41:0:b0:765:a651:a11d with SMTP id s62-20020a372c41000000b00765a651a11dmr8131675qkh.36.1689429609024; Sat, 15 Jul 2023 07:00:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689429609; cv=none; d=google.com; s=arc-20160816; b=NJssfQ+/CikSnbn0h4ESY8eoTnxOomvJzXWWBdY4TofCLf7TM3B78bsOi0Zdb8AiyR JQxUH//9XKfp2xJHOcC2D6S7rvD/3/v8GNKW9xn72vz28qxlGHRNjEn/3Ca5181hebwo 6/kr7dilvOdZyxf+WSXSIifGBOU3HIbMZt0dd52vnv/nokNF/b9c1DELf211apgcPQHj BFUCgOuSsvObtdcieNndk8jUlyORbG8G+qMx1ZVWYqDq0CidX5WEgP9O2eTdWehNnpoZ 9yBLnCRXR1A8uVu2amGE3SSeufZ32hnObFFb0kgJ1At8i8azdFPh42XBPym0+xKfknFn eFQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=QEksHbEIGb/dJkEjI61KH8a3okCUPZ4jhF0donX/Zds=; fh=oYAd+8Lj9FKlReeF9hgENQXa3P4LhBP5C4njRBbobDA=; b=XItWuiXGG+hnaNOcgo44y5+KBOz3PQPVc2LlimF4zk6lJzRxyXib5T1jAo0N9Sgz0+ UzcrePCWp58uQ7Xls2e9vlq7SaQQEsqGfyUT3XMSvBpbaPKmre01uebsOOVcOet8P8a9 tylBBP7nwIdd0OceY50uSFuMOke9C9n3z2NI6meDc99VoSvoV0OlQmzC5C6MboagCNKV SoQNgIi40IRXNVYQJVoCyf5wUjNpkZRdglfurqMGvvXuEXopIxHSDMasRHctqVzezBJm OWebUWHtjI9ag5HN25edOoR7WdlqsxUduM1ACp31VrzzGTru6rQkIkFK0r7Sghxa2wtB kGqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VJQtlDHz; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id dt26-20020a05620a479a00b007675349e7d2si5711354qkb.127.2023.07.15.07.00.08 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 15 Jul 2023 07:00:09 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VJQtlDHz; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qKflg-0001IA-QO; Sat, 15 Jul 2023 09:57:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qKflW-00013G-N6 for qemu-devel@nongnu.org; Sat, 15 Jul 2023 09:56:55 -0400 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qKflU-0003T0-Ov for qemu-devel@nongnu.org; Sat, 15 Jul 2023 09:56:54 -0400 Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-307d58b3efbso2973729f8f.0 for ; Sat, 15 Jul 2023 06:56:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689429411; x=1692021411; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=QEksHbEIGb/dJkEjI61KH8a3okCUPZ4jhF0donX/Zds=; b=VJQtlDHz1o3uWZNhsB/HhhOF3v4c3YAWYK3rFR4+1v9HT+rls8WzStPRiZq5MToIz9 +u/xHhkWhRp9bT9UEXclJvpbroLq8lWDV5hlBSXf1xsJGUCeY5NauKNBAtBAcd1yi/rX GA78ryVBJuHuXKF09n7PUAXUiuCgZoJ32GiD+xCoyZ4u7q9GdIZoqnRvS23HslIw+krL CzOTMA1m3awyjv+QkzRbs3cP1EeSY/5YZ42I4+kVwFMjproqvVmgBEL7OD1SBbCOdHxM 05tA3fOeSWgWgnUG1196WSCu1DMRBB5FQruBv3hGAyQsRxFxnDCfA4LdFRLw33RP9zS+ gCDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689429411; x=1692021411; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=QEksHbEIGb/dJkEjI61KH8a3okCUPZ4jhF0donX/Zds=; b=ii93gO5l25rhgT+xSLEZVQKrNB968skncd3m4bCnJChtr+Qi5WHKJ1YIi9HR5r4hvZ cU6Hd+2alAcDhA6dCk1UnhyVbNvHH6xgmqWLOOqzB6uF9Ygl7S6DPzAnZS2zun5B9qmr hckQCtIodRJr/qfnrhJDFa78ewwWqYgQwM/3sgTbst50qmAI9PsxvSK02S16uEzBVABY ApehGoISPG1olvPNTItghBSmChWukR+2nYUhY57WLEO/i5XOwP06Wvhqv7qGRHH15Z4x 0XJBC/XGK6ZxghJ0TH+ncIYsdtbMw1Ei5t3k/FBqR0JAzUo/MPt+S4EdCmnvdL4hCahm 6dQQ== X-Gm-Message-State: ABy/qLapI79F6ybguLOZ6q8G9iQcDLIuKajt/WcCffzPTgR/W/ON9ma/ raAz5NIImpgG0b+NBQGeOVn5UUygbr57WWt76bwxwg== X-Received: by 2002:a05:6000:92:b0:314:35c2:c4aa with SMTP id m18-20020a056000009200b0031435c2c4aamr5737694wrx.8.1689429411179; Sat, 15 Jul 2023 06:56:51 -0700 (PDT) Received: from stoup.lan ([51.219.12.49]) by smtp.gmail.com with ESMTPSA id r8-20020a056000014800b0030fa3567541sm13866651wrx.48.2023.07.15.06.56.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Jul 2023 06:56:50 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 41/47] accel/tcg: Return bool from page_check_range Date: Sat, 15 Jul 2023 14:53:11 +0100 Message-Id: <20230715135317.7219-42-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230715135317.7219-1-richard.henderson@linaro.org> References: <20230715135317.7219-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::436; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x436.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Replace the 0/-1 result with true/false. Invert the sense of the test of all callers. Document the function. Signed-off-by: Richard Henderson Message-Id: <20230707204054.8792-25-richard.henderson@linaro.org> --- bsd-user/qemu.h | 2 +- include/exec/cpu-all.h | 13 ++++++++++++- linux-user/qemu.h | 2 +- accel/tcg/user-exec.c | 22 +++++++++++----------- linux-user/syscall.c | 2 +- target/hppa/op_helper.c | 2 +- target/riscv/vector_helper.c | 2 +- target/sparc/ldst_helper.c | 2 +- accel/tcg/ldst_atomicity.c.inc | 4 ++-- 9 files changed, 31 insertions(+), 20 deletions(-) diff --git a/bsd-user/qemu.h b/bsd-user/qemu.h index 41d84e0b81..edf9602f9b 100644 --- a/bsd-user/qemu.h +++ b/bsd-user/qemu.h @@ -267,7 +267,7 @@ abi_long do_freebsd_sysarch(void *cpu_env, abi_long arg1, abi_long arg2); static inline bool access_ok(int type, abi_ulong addr, abi_ulong size) { - return page_check_range((target_ulong)addr, size, type) == 0; + return page_check_range((target_ulong)addr, size, type); } /* diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h index eb1c54701a..94f44f1f59 100644 --- a/include/exec/cpu-all.h +++ b/include/exec/cpu-all.h @@ -222,7 +222,18 @@ int walk_memory_regions(void *, walk_memory_regions_fn); int page_get_flags(target_ulong address); void page_set_flags(target_ulong start, target_ulong last, int flags); void page_reset_target_data(target_ulong start, target_ulong last); -int page_check_range(target_ulong start, target_ulong len, int flags); + +/** + * page_check_range + * @start: first byte of range + * @len: length of range + * @flags: flags required for each page + * + * Return true if every page in [@start, @start+@len) has @flags set. + * Return false if any page is unmapped. Thus testing flags == 0 is + * equivalent to testing for flags == PAGE_VALID. + */ +bool page_check_range(target_ulong start, target_ulong last, int flags); /** * page_check_range_empty: diff --git a/linux-user/qemu.h b/linux-user/qemu.h index 9b8e0860d7..802794db63 100644 --- a/linux-user/qemu.h +++ b/linux-user/qemu.h @@ -182,7 +182,7 @@ static inline bool access_ok_untagged(int type, abi_ulong addr, abi_ulong size) : !guest_range_valid_untagged(addr, size)) { return false; } - return page_check_range((target_ulong)addr, size, type) == 0; + return page_check_range((target_ulong)addr, size, type); } static inline bool access_ok(CPUState *cpu, int type, diff --git a/accel/tcg/user-exec.c b/accel/tcg/user-exec.c index 1e8fcaf6b0..df60c7d673 100644 --- a/accel/tcg/user-exec.c +++ b/accel/tcg/user-exec.c @@ -520,19 +520,19 @@ void page_set_flags(target_ulong start, target_ulong last, int flags) } } -int page_check_range(target_ulong start, target_ulong len, int flags) +bool page_check_range(target_ulong start, target_ulong len, int flags) { target_ulong last; int locked; /* tri-state: =0: unlocked, +1: global, -1: local */ - int ret; + bool ret; if (len == 0) { - return 0; /* trivial length */ + return true; /* trivial length */ } last = start + len - 1; if (last < start) { - return -1; /* wrap around */ + return false; /* wrap around */ } locked = have_mmap_lock(); @@ -551,33 +551,33 @@ int page_check_range(target_ulong start, target_ulong len, int flags) p = pageflags_find(start, last); } if (!p) { - ret = -1; /* entire region invalid */ + ret = false; /* entire region invalid */ break; } } if (start < p->itree.start) { - ret = -1; /* initial bytes invalid */ + ret = false; /* initial bytes invalid */ break; } missing = flags & ~p->flags; if (missing & ~PAGE_WRITE) { - ret = -1; /* page doesn't match */ + ret = false; /* page doesn't match */ break; } if (missing & PAGE_WRITE) { if (!(p->flags & PAGE_WRITE_ORG)) { - ret = -1; /* page not writable */ + ret = false; /* page not writable */ break; } /* Asking about writable, but has been protected: undo. */ if (!page_unprotect(start, 0)) { - ret = -1; + ret = false; break; } /* TODO: page_unprotect should take a range, not a single page. */ if (last - start < TARGET_PAGE_SIZE) { - ret = 0; /* ok */ + ret = true; /* ok */ break; } start += TARGET_PAGE_SIZE; @@ -585,7 +585,7 @@ int page_check_range(target_ulong start, target_ulong len, int flags) } if (last <= p->itree.last) { - ret = 0; /* ok */ + ret = true; /* ok */ break; } start = p->itree.last + 1; diff --git a/linux-user/syscall.c b/linux-user/syscall.c index a80d33ecf2..33bc242e6a 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -8122,7 +8122,7 @@ static int open_self_maps_1(CPUArchState *cpu_env, int fd, bool smaps) max = h2g_valid(max - 1) ? max : (uintptr_t) g2h_untagged(GUEST_ADDR_MAX) + 1; - if (page_check_range(h2g(min), max - min, flags) == -1) { + if (!page_check_range(h2g(min), max - min, flags)) { continue; } diff --git a/target/hppa/op_helper.c b/target/hppa/op_helper.c index 32c27c66b2..f25a5a72aa 100644 --- a/target/hppa/op_helper.c +++ b/target/hppa/op_helper.c @@ -168,7 +168,7 @@ target_ureg HELPER(probe)(CPUHPPAState *env, target_ulong addr, uint32_t level, uint32_t want) { #ifdef CONFIG_USER_ONLY - return (page_check_range(addr, 1, want) == 0) ? 1 : 0; + return page_check_range(addr, 1, want); #else int prot, excp; hwaddr phys; diff --git a/target/riscv/vector_helper.c b/target/riscv/vector_helper.c index 71bb9b4457..cfacf2ebba 100644 --- a/target/riscv/vector_helper.c +++ b/target/riscv/vector_helper.c @@ -583,7 +583,7 @@ vext_ldff(void *vd, void *v0, target_ulong base, cpu_mmu_index(env, false)); if (host) { #ifdef CONFIG_USER_ONLY - if (page_check_range(addr, offset, PAGE_READ) < 0) { + if (page_check_range(addr, offset, PAGE_READ)) { vl = i; goto ProbeSuccess; } diff --git a/target/sparc/ldst_helper.c b/target/sparc/ldst_helper.c index 981a47d8bb..78b03308ae 100644 --- a/target/sparc/ldst_helper.c +++ b/target/sparc/ldst_helper.c @@ -1191,7 +1191,7 @@ uint64_t helper_ld_asi(CPUSPARCState *env, target_ulong addr, case ASI_PNFL: /* Primary no-fault LE */ case ASI_SNF: /* Secondary no-fault */ case ASI_SNFL: /* Secondary no-fault LE */ - if (page_check_range(addr, size, PAGE_READ) == -1) { + if (!page_check_range(addr, size, PAGE_READ)) { ret = 0; break; } diff --git a/accel/tcg/ldst_atomicity.c.inc b/accel/tcg/ldst_atomicity.c.inc index de70531a7a..4de0a80492 100644 --- a/accel/tcg/ldst_atomicity.c.inc +++ b/accel/tcg/ldst_atomicity.c.inc @@ -159,7 +159,7 @@ static uint64_t load_atomic8_or_exit(CPUArchState *env, uintptr_t ra, void *pv) * another process, because the fallback start_exclusive solution * provides no protection across processes. */ - if (!page_check_range(h2g(pv), 8, PAGE_WRITE_ORG)) { + if (page_check_range(h2g(pv), 8, PAGE_WRITE_ORG)) { uint64_t *p = __builtin_assume_aligned(pv, 8); return *p; } @@ -194,7 +194,7 @@ static Int128 load_atomic16_or_exit(CPUArchState *env, uintptr_t ra, void *pv) * another process, because the fallback start_exclusive solution * provides no protection across processes. */ - if (!page_check_range(h2g(p), 16, PAGE_WRITE_ORG)) { + if (page_check_range(h2g(p), 16, PAGE_WRITE_ORG)) { return *p; } #endif From patchwork Sat Jul 15 13:53:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 703251 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e4d:0:b0:314:25da:8dc4 with SMTP id r13csp160945wrt; Sat, 15 Jul 2023 07:03:23 -0700 (PDT) X-Google-Smtp-Source: APBJJlFE/F8i8umURAVJSpIS7VoyHbJCVVQWd4K2ToAk1GbZgnmg+pVaX1dZ5KwYFYOPoQSf+7Dh X-Received: by 2002:a05:620a:8004:b0:768:158a:bc0 with SMTP id ee4-20020a05620a800400b00768158a0bc0mr459249qkb.39.1689429802768; Sat, 15 Jul 2023 07:03:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689429802; cv=none; d=google.com; s=arc-20160816; b=UdJciiSVtfovnfeCsgJ+kDN0VFJmxF2d43I125DFTC/kIvhxNJtT94BC3Y+d7ySW4h VA7YuGXu7mjCioBaUHMQMHitiah11ZS0kYytDhGZ4hfuT1F7ekg9Q1CMRuZLB+oOh7h6 MIiHHekzQ9bkdOrcH5/MQEAPqrWX8OZ1axWNPRD73jrZ9nigkJu3hscC6Nn1d5TtOJ2v EWFOd8Swt0K0Aelgu9J041P3uekjxMwO6ptpq8lFDn+sQcvi02WCDZFl3k7FsDFL1Gb8 kLeyswfaFMO+LNFDZ+oztw0i3F0E38ZgseHzZZvYpjL7twcmIeUZQtG+dSRvEajvi8ZN UMGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=ZRHsYp/A8D0Uk3Tfg/o0B0POYY0J/63KdYiHo0geXzY=; fh=oYAd+8Lj9FKlReeF9hgENQXa3P4LhBP5C4njRBbobDA=; b=nlGRdkF6/TcP9qwdvR8QhIjFgJBeCIMVwoWJp1sYC+cpscoYmtdkjdhPAAnoS05dST wdFnYcwSWprFw2TJHd7yMs4LBqX+MGwJa+mup4l+uYyyfYeoZo9wYyIrN4VRz135hWO/ Js5XStWW9N4yLWHWswm2xd6D2wmrrE6NQJmfc9OYACUkgChXd05xDWWSuZIih6fNBUGB Wh1edoBa3brKE18eDqj6MdYh1GsWIaV0cl5/xWdT5BeugCGfI+7FrE0jAZzuPwmx2tJl og0CgT3nSi3wlcQ7ViNy9WXMXc6nxzL2bNyz/3B/BsrnmqYxkhys8a7GYGkTrrI5/IY1 rXyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pte+MOtV; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id bm25-20020a05620a199900b00763978e06f7si5983041qkb.384.2023.07.15.07.03.22 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 15 Jul 2023 07:03:22 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pte+MOtV; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qKfm6-0001tb-9g; Sat, 15 Jul 2023 09:57:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qKflX-00013Y-0J for qemu-devel@nongnu.org; Sat, 15 Jul 2023 09:56:55 -0400 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qKflV-0003T7-Ck for qemu-devel@nongnu.org; Sat, 15 Jul 2023 09:56:54 -0400 Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-3159d75606dso2883846f8f.1 for ; Sat, 15 Jul 2023 06:56:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689429412; x=1692021412; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=ZRHsYp/A8D0Uk3Tfg/o0B0POYY0J/63KdYiHo0geXzY=; b=pte+MOtVN42ENbTAwjy/o/ISczktsK61lv990xKkvP8IQfOWMuPIHkUanVVmBeVwms xzH1v0wDwHRfv0H3oUF/apw6KkvdbPlq4g1sYs3mmg4dtOu8Bfe00fsst2yYDBrUWU18 gwKAUqKHAC2UCRfJgS2cYLOXLIWVoaj33Ea42d2mQIFGZQcl+SagZafh7qfAzeIMAAUd 31tdMFfWNnaw/p1xwqDcoAB0Hx2nTG63uVbfxiWhFpE/Ptux2q6DqARU/tUryK1W+2pV 7X5HhGO5GGWDB8sVwnhiq1o5r7wCfxHQdTltYRCEVVryOfmMo8zf9f+gLPsP3ez1PyzT rJxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689429412; x=1692021412; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ZRHsYp/A8D0Uk3Tfg/o0B0POYY0J/63KdYiHo0geXzY=; b=KikzR9R3zgQ/E5aigE+rjOPFj1qlJjGwIyaQMOlwHvXkBvlysoP/vcQEb+NssPvaSU CTyui6ZZVZbwP/G9NjUNrcqgTu5cVTcJE7/aAT1JHYXWO68Us0qR33KzuJ0ns8h+kMV5 zzGwWSY0rS/jaqebOQgiQNkffP0+X+d9RXWAMj1C2oCnt8OMAyw1Th4LT3zoLRcQnP0S VXMwS4ybFPQkNRfSHab8YbQPTlOJ6QHS3bNUlAVssver/+WBu3zxCPOsXbxhvrpXwRZW 0/uFHK3y/ugqcm8IxdnzMvMxrOw/iLeKlZtliibunsIiL2n+/FfNRWxyxaoxOg09y24W xzeQ== X-Gm-Message-State: ABy/qLa1BA0JINbt1PmU7eRvW2hv6dQLGUDAIX0idjqLXNHh1iGo23Yr APXcIgPQnf0eU0snJmN1KHf06IA+3veI71kka50FVA== X-Received: by 2002:adf:e111:0:b0:316:f25c:d0b3 with SMTP id t17-20020adfe111000000b00316f25cd0b3mr2600437wrz.22.1689429411936; Sat, 15 Jul 2023 06:56:51 -0700 (PDT) Received: from stoup.lan ([51.219.12.49]) by smtp.gmail.com with ESMTPSA id r8-20020a056000014800b0030fa3567541sm13866651wrx.48.2023.07.15.06.56.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Jul 2023 06:56:51 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 42/47] linux-user: Remove can_passthrough_madvise Date: Sat, 15 Jul 2023 14:53:12 +0100 Message-Id: <20230715135317.7219-43-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230715135317.7219-1-richard.henderson@linaro.org> References: <20230715135317.7219-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::430; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x430.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Use page_check_range instead, which uses the interval tree instead of checking each page individually. Signed-off-by: Richard Henderson Message-Id: <20230707204054.8792-26-richard.henderson@linaro.org> --- linux-user/mmap.c | 24 +++--------------------- 1 file changed, 3 insertions(+), 21 deletions(-) diff --git a/linux-user/mmap.c b/linux-user/mmap.c index c0946322fb..49cfa873e0 100644 --- a/linux-user/mmap.c +++ b/linux-user/mmap.c @@ -898,23 +898,6 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size, return new_addr; } -static bool can_passthrough_madvise(abi_ulong start, abi_ulong end) -{ - ulong addr; - - if ((start | end) & ~qemu_host_page_mask) { - return false; - } - - for (addr = start; addr < end; addr += TARGET_PAGE_SIZE) { - if (!(page_get_flags(addr) & PAGE_PASSTHROUGH)) { - return false; - } - } - - return true; -} - abi_long target_madvise(abi_ulong start, abi_ulong len_in, int advice) { abi_ulong len, end; @@ -964,9 +947,8 @@ abi_long target_madvise(abi_ulong start, abi_ulong len_in, int advice) * * A straight passthrough for those may not be safe because qemu sometimes * turns private file-backed mappings into anonymous mappings. - * can_passthrough_madvise() helps to check if a passthrough is possible by - * comparing mappings that are known to have the same semantics in the host - * and the guest. In this case passthrough is safe. + * If all guest pages have PAGE_PASSTHROUGH set, mappings have the + * same semantics for the host as for the guest. * * We pass through MADV_WIPEONFORK and MADV_KEEPONFORK if possible and * return failure if not. @@ -984,7 +966,7 @@ abi_long target_madvise(abi_ulong start, abi_ulong len_in, int advice) ret = -EINVAL; /* fall through */ case MADV_DONTNEED: - if (can_passthrough_madvise(start, end)) { + if (page_check_range(start, len, PAGE_PASSTHROUGH)) { ret = get_errno(madvise(g2h_untagged(start), len, advice)); if ((advice == MADV_DONTNEED) && (ret == 0)) { page_reset_target_data(start, start + len - 1); From patchwork Sat Jul 15 13:53:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 703248 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e4d:0:b0:314:25da:8dc4 with SMTP id r13csp160036wrt; Sat, 15 Jul 2023 07:01:59 -0700 (PDT) X-Google-Smtp-Source: APBJJlHKJ4Q+x1B9rokOHKUq+PIt7fOvY2Sy8HOuotHhcjcNU+pLAL6YFmwmAdGoAaaMfdR7py/E X-Received: by 2002:a05:620a:4107:b0:767:fd59:f6a5 with SMTP id j7-20020a05620a410700b00767fd59f6a5mr7397709qko.65.1689429719387; Sat, 15 Jul 2023 07:01:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689429719; cv=none; d=google.com; s=arc-20160816; b=GS99GmCpAJS+ja9Hk6L3UJNK5cbAFwTxyjlCz7DcN4BX/FfqAy7C5IrM8J3Ez8YLTo aF1o+4WgWL6KTHnLZRjghok6qcvYadRvS3BCNWcVu4+eutdmOawoR3p8tsCQhnAd5ioh io7DzYkpxAVOXVumGyfsAcBU+xwN3vY4b2OH4EZpzRwNg0sY9J+FNjyVeH/E+Htgf9PS HVeiow8PLA7gJtEtYOUh+E+MczXRVM1z2YC/KPdQvkQTQsIqDA5T0zFzsC0VBa2Spk7u JPUyNI6D3fxzjB3r1jYc34v1fvH4fvQ+nU5TV2J6/OvToOfILmFinzuy4tp3LKJxUiIb aZ0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=vXDNUHkoHKMJOTYkZxcm9eNGIwvNIgvNekBczYJkm1c=; fh=oYAd+8Lj9FKlReeF9hgENQXa3P4LhBP5C4njRBbobDA=; b=Au8u8waubu4jv3YofqQdWegaRfQbDANmRZF3XiT5adFjOYV/Iq1Q9PcKE1AAdtWtKe T5u5FRMxiNzYyMYwmC4uKQV3j3nsr/4Blia2RCFLKuJrsJcixRVm5r/vKgk/XbXVbUrv 7rQLzrnl2vGevK/DE4G2xTqFmgaKjv725YKf3iQV9bch35tek4iEIu8QFpHBtOz1KaVX kPY0WcnXQHqA38yqeW87pZBuIpt8RlNWtlZDffW+mhCELCkyRCrOOjrnOF7okU9BaB/2 X4fmlmgvHZl79s0ZbNRdpk5YRz+OlVc4pvVN+xwglvEI00gY111LxWwg7X9HUnHmB4hE B4tA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Kdbenx9r; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id u16-20020a05620a455000b00767f12b2820si4594392qkp.161.2023.07.15.07.01.59 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 15 Jul 2023 07:01:59 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Kdbenx9r; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qKflr-0001aj-6u; Sat, 15 Jul 2023 09:57:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qKflX-00013r-Ax for qemu-devel@nongnu.org; Sat, 15 Jul 2023 09:56:55 -0400 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qKflV-0003TE-RU for qemu-devel@nongnu.org; Sat, 15 Jul 2023 09:56:55 -0400 Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-3142970df44so2816286f8f.3 for ; Sat, 15 Jul 2023 06:56:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689429412; x=1692021412; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=vXDNUHkoHKMJOTYkZxcm9eNGIwvNIgvNekBczYJkm1c=; b=Kdbenx9rp9VTw4UAtVag07OENdIbBrGtxM74t2QdmZdaD01IPFtbiJ3AwsoNmWIJNJ vwB2OTOwxpCPPR3oXul96NOG248wt7TQaseKm5XtMs0XvbXkb5vlkP37TKydr2sEXctP fql3NP5DxlyccmSnslCOx0/ZwF02aJKlO6xi7a1tyVPbX0qGyuUcqxTftiTdypjsOjMx 1SrKwQLQx2+JCqkLBohJUeLczSb0lc1OzIMHW6jtgJQ8xxjCD/wJEIOzpJbM950wnJZl W42F3N04k0J3zJ6H/Il1IofyFkF+Mke6lFp8Zd9/k1M7xR2FC2MTG8QLxzdJK+rbwWlj kPbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689429412; x=1692021412; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vXDNUHkoHKMJOTYkZxcm9eNGIwvNIgvNekBczYJkm1c=; b=le6Y8KDD6VVrRGjjqhMM9EUKOs3tPkCF/2AdU+0+CYm5biGFhXJfmf+AGAfQBedkVP tpGQPNVAV/iOqL9Ne3q/EAi9ot4GdEDCjwdOjjza4yk7fc1WmgLYU054LrrA2DapiWNe pJlInC+lozCgZ54zt3+0Gg+ukKYekT1IG3ws4cdXM74ZBy0rKC1qhLwq6I7CMypHnUVI eZuAHvt3/aZyBIsOeo4xKKpBJDKQkKmfplCnzp7C+FsWU07+s1sxkqg9R/kvkZIVlkME nqWyPSzNLXbz1m1btQh6Qi8/S50M1yCie4CBt1voB46xsYEFSi1PreHqxVGPur0QVrUR Iwcg== X-Gm-Message-State: ABy/qLYZuRaLb4+WRCQ0T6u1UxwqPsTYZQW1R7wwhueRDGbRaPbI17nd hgpLR7ENQ8Ry2V1g0RSkTNWSDMS/T7B9bZrpZnPycg== X-Received: by 2002:a5d:424a:0:b0:30e:3f54:f8c9 with SMTP id s10-20020a5d424a000000b0030e3f54f8c9mr6059908wrr.10.1689429412591; Sat, 15 Jul 2023 06:56:52 -0700 (PDT) Received: from stoup.lan ([51.219.12.49]) by smtp.gmail.com with ESMTPSA id r8-20020a056000014800b0030fa3567541sm13866651wrx.48.2023.07.15.06.56.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Jul 2023 06:56:52 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 43/47] linux-user: Simplify target_madvise Date: Sat, 15 Jul 2023 14:53:13 +0100 Message-Id: <20230715135317.7219-44-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230715135317.7219-1-richard.henderson@linaro.org> References: <20230715135317.7219-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::430; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x430.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org The trivial length 0 check can be moved up, simplifying some of the other cases. The end < start test is handled by guest_range_valid_untagged. Signed-off-by: Richard Henderson Message-Id: <20230707204054.8792-27-richard.henderson@linaro.org> --- linux-user/mmap.c | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/linux-user/mmap.c b/linux-user/mmap.c index 49cfa873e0..44b53bd446 100644 --- a/linux-user/mmap.c +++ b/linux-user/mmap.c @@ -900,28 +900,17 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size, abi_long target_madvise(abi_ulong start, abi_ulong len_in, int advice) { - abi_ulong len, end; + abi_ulong len; int ret = 0; if (start & ~TARGET_PAGE_MASK) { return -TARGET_EINVAL; } - len = TARGET_PAGE_ALIGN(len_in); - - if (len_in && !len) { - return -TARGET_EINVAL; - } - - end = start + len; - if (end < start) { - return -TARGET_EINVAL; - } - - if (end == start) { + if (len_in == 0) { return 0; } - - if (!guest_range_valid_untagged(start, len)) { + len = TARGET_PAGE_ALIGN(len_in); + if (len == 0 || !guest_range_valid_untagged(start, len)) { return -TARGET_EINVAL; } From patchwork Sat Jul 15 13:53:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 703247 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e4d:0:b0:314:25da:8dc4 with SMTP id r13csp158882wrt; Sat, 15 Jul 2023 07:00:12 -0700 (PDT) X-Google-Smtp-Source: APBJJlH+BJJO1T1A9ugX/xGrelAyhUf7HmDJ1DURc2pJ9eZ5gBmtI+I5GCzPI79vpuAP4LwJwKey X-Received: by 2002:a05:620a:4503:b0:767:f1de:293c with SMTP id t3-20020a05620a450300b00767f1de293cmr10341696qkp.59.1689429611866; Sat, 15 Jul 2023 07:00:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689429611; cv=none; d=google.com; s=arc-20160816; b=VV/qWBAFeTWJgW27Z4jNMEM4YGYpcji4TSz5Go/AgcCeAx0gzSVqx+HWyBeKY4mLVZ yIpeWdnM6L6iK4beM1vAbDDSDSB1+8JJrzwEeak6V8kDhtylcZNmEjoEJqJXtLV7/Vpb 6aY+3KAZ1JGq21zOejkAOjZGADjSNklqjFlQRnSFozZf0Q6JbWJdSTTuqI4Tx/BtjaJz osdBAGShwLjzExBimchfACAa3fs2yny9UFPPjk46XehOTrcSQkUuLYSOCLJvYPHpJd4L Y/+FMll8h/Xo/VvaI2ek6KU6C+pIrg/wRmR+z8wvR8OiKOYWlZjEEoXSDtrs8fO4rExV FGqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=GxD0O4grkQ8OinpyCeKP/3HLPLmkFCEiNXIpS5ZyOiE=; fh=4Qh9A+FU7lVZCEyvfgfzMHGjUqEPgEqRxj4xstQLl7o=; b=SI901W4iWOGdzOO5sHoLzy2QRaSSnNrytTuFiyNH/mR8dVP/iWmY0r5fF6kUKL/EHg 8NAvPb/uNrLR/3ZyBAYszTMeywl30wyh4Grw16JnIqGtEEkjxrkQ6WSpd+nKl15OgmtO /H0MtrI2+qq65EqlpHmzRQnr6P2OydfhIuhTDqACCIBjdgPmFW3pi5vZOqriidAI5RIO i+WLHENvat6XBs2qhMH92MIL+jO3CjErP7JLUvUX2169vZM7WzyoFbRIX3Ubgq0tE0zF CIoEwlN2XZ1fjdygSXs/vZQ0pdblOqZM+oT3xXoVuV5tZ1LZv3z/FE8m5nLArtdgFxDt 1vqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Urm2+Pzf; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id q8-20020a05620a0d8800b007673d7d2cc5si5925579qkl.1.2023.07.15.07.00.11 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 15 Jul 2023 07:00:11 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Urm2+Pzf; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qKfli-0001QQ-36; Sat, 15 Jul 2023 09:57:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qKflY-00014o-GC for qemu-devel@nongnu.org; Sat, 15 Jul 2023 09:56:57 -0400 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qKflW-0003TS-Vy for qemu-devel@nongnu.org; Sat, 15 Jul 2023 09:56:56 -0400 Received: by mail-wr1-x431.google.com with SMTP id ffacd0b85a97d-3090d3e9c92so3055696f8f.2 for ; Sat, 15 Jul 2023 06:56:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689429413; x=1692021413; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=GxD0O4grkQ8OinpyCeKP/3HLPLmkFCEiNXIpS5ZyOiE=; b=Urm2+Pzf5cJoCZypvWz2GQ96EIZ+cr+s340R01E/qvquJkOysghVaNYEKjHz/Kmrd/ SH7U3EyAVofJaAoTJYQkx2WH3kYBYEA344ut00DKtJx0Xy73HhDl6c19UpZTBPDjUw8Q LQ2kfhVkyZxoT67GZaaSKaV5VJOQs59c5SknfQsKtJtPY2TMq2ZthUV3b/y/a+5H1Jkj Ilpzl+AYplYYMM6AvLDUoxXFmYMKDZFrJ5nM3DsaIzCqNH6vCFuDZRHk3YAuauCUGRLV 3jQb+Hhd70WflTnvI8DrpQ0YbXZY5hp/xp3l/hR0mK1VUgckVYi/rTuiNE7pOtx5LJxE VEQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689429413; x=1692021413; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=GxD0O4grkQ8OinpyCeKP/3HLPLmkFCEiNXIpS5ZyOiE=; b=gY2PtQKD2Ga5yuryJ7/xY65WJuO5LmyJGo92OTTex7gkq6InkA53sbvh6EfUqbG0JI jVZaFv+6rmToybonoeGPcXjPNU4phY+H3u+POw9DTKP9zCxBo/zxfABLfDMfgwmONTn8 j0iEL1KErKYEbpCWAG9R9drdN1JpRz6ytnzzT/YoxFdw8y40hcHkhWq8m/H4ziwFkQ/S lJkLTacG28lLBaUcDsxPxLVWE5DsDeWeZJG7Cb2W9dJK3rOCmvunOtpYheM+vKrRN/K4 +JAxEcjxJEKTfFAWgS12xJDBHHiquPvbnwUpiyzEVVtGAOb382/vHQJlyiHN5rmCkGd1 44Xg== X-Gm-Message-State: ABy/qLaEmwOLlu55xAnoMOtc0alaiOPpgoB19f7OfZsbwPtblllur0Fd KwjfdLvySlEwQthfATv+HV9iPIwVnjVAIPxs1dTgUw== X-Received: by 2002:adf:e644:0:b0:316:ef23:9276 with SMTP id b4-20020adfe644000000b00316ef239276mr4886194wrn.52.1689429413496; Sat, 15 Jul 2023 06:56:53 -0700 (PDT) Received: from stoup.lan ([51.219.12.49]) by smtp.gmail.com with ESMTPSA id r8-20020a056000014800b0030fa3567541sm13866651wrx.48.2023.07.15.06.56.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Jul 2023 06:56:53 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Juan Quintela , Laurent Vivier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL 44/47] linux-user: Drop uint and ulong Date: Sat, 15 Jul 2023 14:53:14 +0100 Message-Id: <20230715135317.7219-45-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230715135317.7219-1-richard.henderson@linaro.org> References: <20230715135317.7219-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::431; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x431.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Juan Quintela These are types not used anymore anywhere else. Signed-off-by: Juan Quintela Reviewed-by: Richard Henderson Reviewed-by: Laurent Vivier Reviewed-by: Philippe Mathieu-Daudé Message-id: <20230511085056.13809-1-quintela@redhat.com> Signed-off-by: Richard Henderson --- linux-user/syscall.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 33bc242e6a..1464151826 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -309,16 +309,16 @@ _syscall0(int, sys_gettid) #endif #if defined(TARGET_NR_getdents) && defined(EMULATE_GETDENTS_WITH_GETDENTS) -_syscall3(int, sys_getdents, uint, fd, struct linux_dirent *, dirp, uint, count); +_syscall3(int, sys_getdents, unsigned int, fd, struct linux_dirent *, dirp, unsigned int, count); #endif #if (defined(TARGET_NR_getdents) && \ !defined(EMULATE_GETDENTS_WITH_GETDENTS)) || \ (defined(TARGET_NR_getdents64) && defined(__NR_getdents64)) -_syscall3(int, sys_getdents64, uint, fd, struct linux_dirent64 *, dirp, uint, count); +_syscall3(int, sys_getdents64, unsigned int, fd, struct linux_dirent64 *, dirp, unsigned int, count); #endif #if defined(TARGET_NR__llseek) && defined(__NR_llseek) -_syscall5(int, _llseek, uint, fd, ulong, hi, ulong, lo, - loff_t *, res, uint, wh); +_syscall5(int, _llseek, unsigned int, fd, unsigned long, hi, unsigned long, lo, + loff_t *, res, unsigned int, wh); #endif _syscall3(int, sys_rt_sigqueueinfo, pid_t, pid, int, sig, siginfo_t *, uinfo) _syscall4(int, sys_rt_tgsigqueueinfo, pid_t, pid, pid_t, tid, int, sig, From patchwork Sat Jul 15 13:53:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 703241 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e4d:0:b0:314:25da:8dc4 with SMTP id r13csp158329wrt; Sat, 15 Jul 2023 06:58:39 -0700 (PDT) X-Google-Smtp-Source: APBJJlEN5t4zEjzlSUgsoShD2XBguLHAMxNlIR3Aw57Ps9izu99XzJKyohG0x3Llj0PjJK8KY69+ X-Received: by 2002:a0c:ea50:0:b0:62f:fe67:7372 with SMTP id u16-20020a0cea50000000b0062ffe677372mr7191428qvp.14.1689429519514; Sat, 15 Jul 2023 06:58:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689429519; cv=none; d=google.com; s=arc-20160816; b=M7YN8MXDe9iomRS2F5CktFUrNmlqoBq/fsU8MOiAqpKZ36c07KT32GXaI6h81YRnsE qaa1Q6PEIutpptmX5eXaLUCuxzB5d1CpWQlUftjEZgAjpodhOvo+u/NithWj0pTtlae3 Za5oXKZnNeKwZ2kD3Y/xr4MQa2fkg64UNhMGN//85wgGnU/1KJsoA5uEeOpu7zE1DC22 3MlEV7AXH1wcN1YZsOKN38XK42E0CFEWitxylIoySlt/NhvweDNN/TkafEgViR26pMxc J7l6Ve0FxrN0vAK3UZojhqeQdIYtgz7EztNT8tDBNIYFv3DxGkm1uZFdDlqIEYdeWKQT qfeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=vpPPTc1J6EP9QJbzcPqiBEK5MSOQgGdVVPldReJi1XE=; fh=B5F1zNWozCRIKzcS+ZgfrKlXPkLIO2qXFqx+dMecEQE=; b=mAIKbR9uT3YsRePn7ky+hKg9cKBcLYwiYPD0VbkrFC8CZrF+cLh8nSLaY6G/4n0NoO 2lx1GB2aDyTXyj60CbUZGlv5DloGWvYeEuSVoU1zSV0VNd87+XuhSU24aC5o/IY5pZ7n Xt8MZSl4oS3Hxupj+hMHe4/PIVT+W2vSYcU1TgY3LOSwRCY4GJBK7XPVSIRCB+fLwWlD 9GbIzx6nGEDX4fpRPnh01oWdh/pdAzDZ9qX3FzYd+gTujFgxTQKiEz/m37KOvTkcF1Ts brYh5d2npXyEcE7cy8WZ7+mSmSydAuxsDPgdKrNzmzc14NTcVGxQugRmBAl3Mdk1vgQb LrLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rajLt5A5; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id a13-20020a0cb34d000000b006261e6b4780si5812384qvf.197.2023.07.15.06.58.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 15 Jul 2023 06:58:39 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rajLt5A5; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qKflf-0001Fb-Mv; Sat, 15 Jul 2023 09:57:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qKfla-000188-0U for qemu-devel@nongnu.org; Sat, 15 Jul 2023 09:56:59 -0400 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qKflX-0003Tk-S1 for qemu-devel@nongnu.org; Sat, 15 Jul 2023 09:56:57 -0400 Received: by mail-wr1-x431.google.com with SMTP id ffacd0b85a97d-3159da54e95so2757167f8f.3 for ; Sat, 15 Jul 2023 06:56:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689429414; x=1692021414; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=vpPPTc1J6EP9QJbzcPqiBEK5MSOQgGdVVPldReJi1XE=; b=rajLt5A5MmhNh/+wdqsWpQwhP5NTf9/u5UUI/uim6z5O4eJUd2bfqb3tffHQT5F96u sB65n24brOrqcm3y5xRd1ud4rqLcZ0piF4bKtNnxX9JJF0bPd791D4lHtwKObrkbVdJw qoZgBwHu7rThPa7lhhyVjbt9y7cAtKpLWCPA4nAlu14RA7iEis4qHm5dSmmFHrk8fvTa qbk2uPgI/y2HELfXMOwO0xmb1ko8kP+e08IB15jvKJqWcTeJVKkYhRV0s8FpN8e/2E95 44+F5e6ofOxqS5FLZlZ2gJtngcCCGrNzaQxRyiKTjIF0GRtug/iZLAxT0A9IAd38cuGS 2UHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689429414; x=1692021414; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vpPPTc1J6EP9QJbzcPqiBEK5MSOQgGdVVPldReJi1XE=; b=T3OheNS7Il8EtSJK47GvGKZlAERyKEGu7e9s5+kfyYxaS3gURRiongv9YejER/XwMu pEKi9ogY1nfBzFJqiKkeE7eJB7sygvD1ZM842tKy+E8MLtrqCXsdopbwg9RE4FakAQDg w/yMyWQ7GbRQtZ0t0xlIp08ebb14ZftZPRGdiNfTqV2BvGK2fWhFsu6GHq9+OGceABRd vBZyiTCpcD5oSHH3MAkFw128dHehpWYwxGSA/UQNvyY3xSs9siIrq3t2rbN+pcJsBP8u yLqw/kLaZ9gPEcZVLbMbdgPAgrtedkmOFSiJWd+wvwoh8vH+TU0nCeZJsb4rwdj3cD9A ODTA== X-Gm-Message-State: ABy/qLZwBzHGZOKRnlhddjGmK0eY4yhM47U77rAguxlyB69cB5OuCC5H DnqQEaSpvPpKmcnF+b2CtrAX6HsHIdx8PpkoJkOlbg== X-Received: by 2002:adf:d852:0:b0:314:13e2:2f78 with SMTP id k18-20020adfd852000000b0031413e22f78mr6444223wrl.44.1689429414638; Sat, 15 Jul 2023 06:56:54 -0700 (PDT) Received: from stoup.lan ([51.219.12.49]) by smtp.gmail.com with ESMTPSA id r8-20020a056000014800b0030fa3567541sm13866651wrx.48.2023.07.15.06.56.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Jul 2023 06:56:54 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Christophe Lyon , Anton Johansson Subject: [PULL 45/47] linux-user/arm: Do not allocate a commpage at all for M-profile CPUs Date: Sat, 15 Jul 2023 14:53:15 +0100 Message-Id: <20230715135317.7219-46-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230715135317.7219-1-richard.henderson@linaro.org> References: <20230715135317.7219-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::431; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x431.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Philippe Mathieu-Daudé Since commit fbd3c4cff6 ("linux-user/arm: Mark the commpage executable") executing bare-metal (linked with rdimon.specs) cortex-M code fails as: $ qemu-arm -cpu cortex-m3 ~/hello.exe.m3 qemu-arm: ../../accel/tcg/user-exec.c:492: page_set_flags: Assertion `last <= GUEST_ADDR_MAX' failed. Aborted (core dumped) Commit 4f5c67f8df ("linux-user/arm: Take more care allocating commpage") already took care of not allocating a commpage for M-profile CPUs, however it had to be reverted as commit 6cda41daa2. Re-introduce the M-profile fix from commit 4f5c67f8df. Fixes: fbd3c4cff6 ("linux-user/arm: Mark the commpage executable") Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1755 Reported-by: Christophe Lyon Suggested-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Anton Johansson Reviewed-by: Richard Henderson Message-Id: <20230711153408.68389-1-philmd@linaro.org> Signed-off-by: Richard Henderson --- linux-user/elfload.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/linux-user/elfload.c b/linux-user/elfload.c index d3d1352c4e..a26200d9f3 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -424,10 +424,23 @@ enum { static bool init_guest_commpage(void) { - abi_ptr commpage = HI_COMMPAGE & -qemu_host_page_size; - void *want = g2h_untagged(commpage); - void *addr = mmap(want, qemu_host_page_size, PROT_READ | PROT_WRITE, - MAP_ANONYMOUS | MAP_PRIVATE | MAP_FIXED, -1, 0); + ARMCPU *cpu = ARM_CPU(thread_cpu); + abi_ptr commpage; + void *want; + void *addr; + + /* + * M-profile allocates maximum of 2GB address space, so can never + * allocate the commpage. Skip it. + */ + if (arm_feature(&cpu->env, ARM_FEATURE_M)) { + return true; + } + + commpage = HI_COMMPAGE & -qemu_host_page_size; + want = g2h_untagged(commpage); + addr = mmap(want, qemu_host_page_size, PROT_READ | PROT_WRITE, + MAP_ANONYMOUS | MAP_PRIVATE | MAP_FIXED, -1, 0); if (addr == MAP_FAILED) { perror("Allocating guest commpage"); From patchwork Sat Jul 15 13:53:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 703234 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e4d:0:b0:314:25da:8dc4 with SMTP id r13csp157898wrt; Sat, 15 Jul 2023 06:57:36 -0700 (PDT) X-Google-Smtp-Source: APBJJlHtXNCDMMN/go77jbssMbjB3AtoTeYPrlst5eheDlibGmH25l07ujJQTOSgOovZCDTD1TEC X-Received: by 2002:a05:622a:1703:b0:3ff:3013:d2aa with SMTP id h3-20020a05622a170300b003ff3013d2aamr11249200qtk.12.1689429455924; Sat, 15 Jul 2023 06:57:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689429455; cv=none; d=google.com; s=arc-20160816; b=0HHMg6mRDOs24pckyHE3b+jtg6k69xPUuNJz4/F48ALQhoylgeM4TNk5iqNvU1PNIP juCRU+dUtrjgNeMrRbANu1Cw1l4335QgL7CQud+ISP1kC/ELiffbJ0KZjbkLYNBNsfAJ hiGidACaM3siySg6ndQUg4tpQYf9mtkyqAaz2DZbzKTfXFn7fYmSd99NZRp0lplO48mp xxOauHdR89AFdIfppFuyDJrm9pCyGWA2MkO6ZLQmKmy1FV87lu2UJwPLaHYzDiMyzA/A k5RtMT+7VQdWG+Y7xpJiQYAUmpQNRHKoXf/todzkN1zoKifaIsJbUXWvO5QLd8XmLnAr odbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=VAtnLNi/uv6ezOFoKAO0LnFsL79vAg3ew3PZjo4G9rg=; fh=AvNvtKoalf5nwB9drarz4PGghWTTvVOcFdJTwcOIpgk=; b=l0RhIGqorX8g0TIykdXBifsnKVJdmBflx+zdUU+i32ASnAx5bMdzP0bO49ge01Gro9 FtuRaipwiQQII5aVFABQSpyUxgJ7MpchWa2Vq+3Ll7AHotQBBgSf0Fd/LivK3zN58kmV ifP/Gh1vmfDYaNdJSj7Lto7XJgie5dJsayv6XQIJsdDi+f6tFsBcvYP1FHudSO5ytFnn ADUsgbb1db3cbRnazFiBDKgrtN3pcgwv05u07l39eX81LZeIo3su5T7XAmGVQrTsW+sJ Tulybni2NzZqHcxcMNow3/OFW6vl45pWmdtqBD0H2iEWHaiu1p0Drhe9X/hyPAI6PLG1 yPcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Swpa0kmo; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d9-20020a05622a100900b003e389c10fd6si5675038qte.742.2023.07.15.06.57.35 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 15 Jul 2023 06:57:35 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Swpa0kmo; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qKfm5-0001si-Ow; Sat, 15 Jul 2023 09:57:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qKflb-00018H-9x for qemu-devel@nongnu.org; Sat, 15 Jul 2023 09:56:59 -0400 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qKflY-0003U0-K2 for qemu-devel@nongnu.org; Sat, 15 Jul 2023 09:56:59 -0400 Received: by mail-wr1-x42b.google.com with SMTP id ffacd0b85a97d-314417861b9so2779861f8f.0 for ; Sat, 15 Jul 2023 06:56:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689429415; x=1692021415; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=VAtnLNi/uv6ezOFoKAO0LnFsL79vAg3ew3PZjo4G9rg=; b=Swpa0kmoQHtSkXu7QT/ZL0Qn8xVs0oHO0mNmI+u3acZ2YvwiJsb1lW3UghUvBTcB55 7i/ln9r9klikrqBxweQ00G55fDq18cP0LTjGbkbyt2OcifKF0797msc7AMDLHdTtFTi7 2xWHdPCJ3Cfvsml0h5IQvlZ6GoKXI6S+gvCNom2vrODCqCICO870NPIdxZDW5VGEQD+A XLFJX12wzED7dokH9ieFClMtaCpRphCoTikcLU0HXEpJPok7Sj2ih9D2cne0MQrvrJPE yPc+aa3gHCRcpR7L+We1mDe5Z3HvkmENO+OP+hd5N9/uLQgCeilNnwNb/4tAEE5pJL4H j/aw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689429415; x=1692021415; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=VAtnLNi/uv6ezOFoKAO0LnFsL79vAg3ew3PZjo4G9rg=; b=jv57XmMxZBgHb/nNWTfeDIxYIyDtpEZKMpisL5RFyZXAInoJB7ysNxw2qCMcA/bZts pRpfG3/6G/E7zYTjxyhy2hmV+v1MbrLFTwBtxgPNa0kBZ8KcQuLKg7VzRNUkK6YXREVQ E6RrvxYqITQ/4JkUk5ZefcCX/efYU46F/Q5g7XFfENrhOQPd9Lq/TlO3OqZAeYUtpBEU vzaWxZ+e/pZbBv8FW0OYqq8W/fspCGl2VDe3Ryzq+9cxnqqTYGzHC2v9ji3x927FVHkk RxNGwmSYgF1vwq9hVD5BHNzWDlQAShnoVClKmNUPCI7E+N5slxuqAWLqK1ERAexICGK1 lkQw== X-Gm-Message-State: ABy/qLZf2+M5seIMJRh3t+QB7UeaLD+a6q5LpQ2GH7waECflYcWzfHe5 XMRunEXKakAyn9mNSlyG0ERNJrgpX1BDCp83ZNCmlA== X-Received: by 2002:a05:6000:8a:b0:313:fdbb:422 with SMTP id m10-20020a056000008a00b00313fdbb0422mr6964614wrx.43.1689429415281; Sat, 15 Jul 2023 06:56:55 -0700 (PDT) Received: from stoup.lan ([51.219.12.49]) by smtp.gmail.com with ESMTPSA id r8-20020a056000014800b0030fa3567541sm13866651wrx.48.2023.07.15.06.56.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Jul 2023 06:56:54 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Liren Wei , "Richard W . M . Jones" Subject: [PULL 46/47] accel/tcg: Always lock pages before translation Date: Sat, 15 Jul 2023 14:53:16 +0100 Message-Id: <20230715135317.7219-47-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230715135317.7219-1-richard.henderson@linaro.org> References: <20230715135317.7219-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42b; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x42b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org We had done this for user-mode by invoking page_protect within the translator loop. Extend this to handle system mode as well. Move page locking out of tb_link_page. Reported-by: Liren Wei Reported-by: Richard W.M. Jones Signed-off-by: Richard Henderson Tested-by: Richard W.M. Jones --- accel/tcg/internal.h | 30 ++++- accel/tcg/cpu-exec.c | 20 ++++ accel/tcg/tb-maint.c | 242 ++++++++++++++++++++------------------ accel/tcg/translate-all.c | 43 ++++++- accel/tcg/translator.c | 34 ++++-- 5 files changed, 236 insertions(+), 133 deletions(-) diff --git a/accel/tcg/internal.h b/accel/tcg/internal.h index 650c3ac53f..e8cbbde581 100644 --- a/accel/tcg/internal.h +++ b/accel/tcg/internal.h @@ -10,6 +10,7 @@ #define ACCEL_TCG_INTERNAL_H #include "exec/exec-all.h" +#include "exec/translate-all.h" /* * Access to the various translations structures need to be serialised @@ -35,6 +36,32 @@ static inline void page_table_config_init(void) { } void page_table_config_init(void); #endif +#ifdef CONFIG_USER_ONLY +/* + * For user-only, page_protect sets the page read-only. + * Since most execution is already on read-only pages, and we'd need to + * account for other TBs on the same page, defer undoing any page protection + * until we receive the write fault. + */ +static inline void tb_lock_page0(tb_page_addr_t p0) +{ + page_protect(p0); +} + +static inline void tb_lock_page1(tb_page_addr_t p0, tb_page_addr_t p1) +{ + page_protect(p1); +} + +static inline void tb_unlock_page1(tb_page_addr_t p0, tb_page_addr_t p1) { } +static inline void tb_unlock_pages(TranslationBlock *tb) { } +#else +void tb_lock_page0(tb_page_addr_t); +void tb_lock_page1(tb_page_addr_t, tb_page_addr_t); +void tb_unlock_page1(tb_page_addr_t, tb_page_addr_t); +void tb_unlock_pages(TranslationBlock *); +#endif + #ifdef CONFIG_SOFTMMU void tb_invalidate_phys_range_fast(ram_addr_t ram_addr, unsigned size, @@ -48,8 +75,7 @@ TranslationBlock *tb_gen_code(CPUState *cpu, vaddr pc, void page_init(void); void tb_htable_init(void); void tb_reset_jump(TranslationBlock *tb, int n); -TranslationBlock *tb_link_page(TranslationBlock *tb, tb_page_addr_t phys_pc, - tb_page_addr_t phys_page2); +TranslationBlock *tb_link_page(TranslationBlock *tb); bool tb_invalidate_phys_page_unwind(tb_page_addr_t addr, uintptr_t pc); void cpu_restore_state_from_tb(CPUState *cpu, TranslationBlock *tb, uintptr_t host_pc); diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index 31aa320513..fdd6d3e0e4 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -536,6 +536,26 @@ static void cpu_exec_longjmp_cleanup(CPUState *cpu) if (have_mmap_lock()) { mmap_unlock(); } +#else + /* + * For softmmu, a tlb_fill fault during translation will land here, + * and we need to release any page locks held. In system mode we + * have one tcg_ctx per thread, so we know it was this cpu doing + * the translation. + * + * Alternative 1: Install a cleanup to be called via an exception + * handling safe longjmp. It seems plausible that all our hosts + * support such a thing. We'd have to properly register unwind info + * for the JIT for EH, rather that just for GDB. + * + * Alternative 2: Set and restore cpu->jmp_env in tb_gen_code to + * capture the cpu_loop_exit longjmp, perform the cleanup, and + * jump again to arrive here. + */ + if (tcg_ctx->gen_tb) { + tb_unlock_pages(tcg_ctx->gen_tb); + tcg_ctx->gen_tb = NULL; + } #endif if (qemu_mutex_iothread_locked()) { qemu_mutex_unlock_iothread(); diff --git a/accel/tcg/tb-maint.c b/accel/tcg/tb-maint.c index 9566224d18..c406b2f7b7 100644 --- a/accel/tcg/tb-maint.c +++ b/accel/tcg/tb-maint.c @@ -70,17 +70,7 @@ typedef struct PageDesc PageDesc; */ #define assert_page_locked(pd) tcg_debug_assert(have_mmap_lock()) -static inline void page_lock_pair(PageDesc **ret_p1, tb_page_addr_t phys1, - PageDesc **ret_p2, tb_page_addr_t phys2, - bool alloc) -{ - *ret_p1 = NULL; - *ret_p2 = NULL; -} - -static inline void page_unlock(PageDesc *pd) { } -static inline void page_lock_tb(const TranslationBlock *tb) { } -static inline void page_unlock_tb(const TranslationBlock *tb) { } +static inline void tb_lock_pages(const TranslationBlock *tb) { } /* * For user-only, since we are protecting all of memory with a single lock, @@ -96,7 +86,7 @@ static void tb_remove_all(void) } /* Call with mmap_lock held. */ -static void tb_record(TranslationBlock *tb, PageDesc *p1, PageDesc *p2) +static void tb_record(TranslationBlock *tb) { vaddr addr; int flags; @@ -391,12 +381,108 @@ static void page_lock(PageDesc *pd) qemu_spin_lock(&pd->lock); } +/* Like qemu_spin_trylock, returns false on success */ +static bool page_trylock(PageDesc *pd) +{ + bool busy = qemu_spin_trylock(&pd->lock); + if (!busy) { + page_lock__debug(pd); + } + return busy; +} + static void page_unlock(PageDesc *pd) { qemu_spin_unlock(&pd->lock); page_unlock__debug(pd); } +void tb_lock_page0(tb_page_addr_t paddr) +{ + page_lock(page_find_alloc(paddr >> TARGET_PAGE_BITS, true)); +} + +void tb_lock_page1(tb_page_addr_t paddr0, tb_page_addr_t paddr1) +{ + tb_page_addr_t pindex0 = paddr0 >> TARGET_PAGE_BITS; + tb_page_addr_t pindex1 = paddr1 >> TARGET_PAGE_BITS; + PageDesc *pd0, *pd1; + + if (pindex0 == pindex1) { + /* Identical pages, and the first page is already locked. */ + return; + } + + pd1 = page_find_alloc(pindex1, true); + if (pindex0 < pindex1) { + /* Correct locking order, we may block. */ + page_lock(pd1); + return; + } + + /* Incorrect locking order, we cannot block lest we deadlock. */ + if (!page_trylock(pd1)) { + return; + } + + /* + * Drop the lock on page0 and get both page locks in the right order. + * Restart translation via longjmp. + */ + pd0 = page_find_alloc(pindex0, false); + page_unlock(pd0); + page_lock(pd1); + page_lock(pd0); + siglongjmp(tcg_ctx->jmp_trans, -3); +} + +void tb_unlock_page1(tb_page_addr_t paddr0, tb_page_addr_t paddr1) +{ + tb_page_addr_t pindex0 = paddr0 >> TARGET_PAGE_BITS; + tb_page_addr_t pindex1 = paddr1 >> TARGET_PAGE_BITS; + + if (pindex0 != pindex1) { + page_unlock(page_find_alloc(pindex1, false)); + } +} + +static void tb_lock_pages(TranslationBlock *tb) +{ + tb_page_addr_t paddr0 = tb_page_addr0(tb); + tb_page_addr_t paddr1 = tb_page_addr1(tb); + tb_page_addr_t pindex0 = paddr0 >> TARGET_PAGE_BITS; + tb_page_addr_t pindex1 = paddr1 >> TARGET_PAGE_BITS; + + if (unlikely(paddr0 == -1)) { + return; + } + if (unlikely(paddr1 != -1) && pindex0 != pindex1) { + if (pindex0 < pindex1) { + page_lock(page_find_alloc(pindex0, true)); + page_lock(page_find_alloc(pindex1, true)); + return; + } + page_lock(page_find_alloc(pindex1, true)); + } + page_lock(page_find_alloc(pindex0, true)); +} + +void tb_unlock_pages(TranslationBlock *tb) +{ + tb_page_addr_t paddr0 = tb_page_addr0(tb); + tb_page_addr_t paddr1 = tb_page_addr1(tb); + tb_page_addr_t pindex0 = paddr0 >> TARGET_PAGE_BITS; + tb_page_addr_t pindex1 = paddr1 >> TARGET_PAGE_BITS; + + if (unlikely(paddr0 == -1)) { + return; + } + if (unlikely(paddr1 != -1) && pindex0 != pindex1) { + page_unlock(page_find_alloc(pindex1, false)); + } + page_unlock(page_find_alloc(pindex0, false)); +} + static inline struct page_entry * page_entry_new(PageDesc *pd, tb_page_addr_t index) { @@ -420,13 +506,10 @@ static void page_entry_destroy(gpointer p) /* returns false on success */ static bool page_entry_trylock(struct page_entry *pe) { - bool busy; - - busy = qemu_spin_trylock(&pe->pd->lock); + bool busy = page_trylock(pe->pd); if (!busy) { g_assert(!pe->locked); pe->locked = true; - page_lock__debug(pe->pd); } return busy; } @@ -604,8 +687,7 @@ static void tb_remove_all(void) * Add the tb in the target page and protect it if necessary. * Called with @p->lock held. */ -static inline void tb_page_add(PageDesc *p, TranslationBlock *tb, - unsigned int n) +static void tb_page_add(PageDesc *p, TranslationBlock *tb, unsigned int n) { bool page_already_protected; @@ -625,15 +707,21 @@ static inline void tb_page_add(PageDesc *p, TranslationBlock *tb, } } -static void tb_record(TranslationBlock *tb, PageDesc *p1, PageDesc *p2) +static void tb_record(TranslationBlock *tb) { - tb_page_add(p1, tb, 0); - if (unlikely(p2)) { - tb_page_add(p2, tb, 1); + tb_page_addr_t paddr0 = tb_page_addr0(tb); + tb_page_addr_t paddr1 = tb_page_addr1(tb); + tb_page_addr_t pindex0 = paddr0 >> TARGET_PAGE_BITS; + tb_page_addr_t pindex1 = paddr0 >> TARGET_PAGE_BITS; + + assert(paddr0 != -1); + if (unlikely(paddr1 != -1) && pindex0 != pindex1) { + tb_page_add(page_find_alloc(pindex1, false), tb, 1); } + tb_page_add(page_find_alloc(pindex0, false), tb, 0); } -static inline void tb_page_remove(PageDesc *pd, TranslationBlock *tb) +static void tb_page_remove(PageDesc *pd, TranslationBlock *tb) { TranslationBlock *tb1; uintptr_t *pprev; @@ -653,74 +741,16 @@ static inline void tb_page_remove(PageDesc *pd, TranslationBlock *tb) static void tb_remove(TranslationBlock *tb) { - PageDesc *pd; + tb_page_addr_t paddr0 = tb_page_addr0(tb); + tb_page_addr_t paddr1 = tb_page_addr1(tb); + tb_page_addr_t pindex0 = paddr0 >> TARGET_PAGE_BITS; + tb_page_addr_t pindex1 = paddr0 >> TARGET_PAGE_BITS; - pd = page_find(tb->page_addr[0] >> TARGET_PAGE_BITS); - tb_page_remove(pd, tb); - if (unlikely(tb->page_addr[1] != -1)) { - pd = page_find(tb->page_addr[1] >> TARGET_PAGE_BITS); - tb_page_remove(pd, tb); - } -} - -static void page_lock_pair(PageDesc **ret_p1, tb_page_addr_t phys1, - PageDesc **ret_p2, tb_page_addr_t phys2, bool alloc) -{ - PageDesc *p1, *p2; - tb_page_addr_t page1; - tb_page_addr_t page2; - - assert_memory_lock(); - g_assert(phys1 != -1); - - page1 = phys1 >> TARGET_PAGE_BITS; - page2 = phys2 >> TARGET_PAGE_BITS; - - p1 = page_find_alloc(page1, alloc); - if (ret_p1) { - *ret_p1 = p1; - } - if (likely(phys2 == -1)) { - page_lock(p1); - return; - } else if (page1 == page2) { - page_lock(p1); - if (ret_p2) { - *ret_p2 = p1; - } - return; - } - p2 = page_find_alloc(page2, alloc); - if (ret_p2) { - *ret_p2 = p2; - } - if (page1 < page2) { - page_lock(p1); - page_lock(p2); - } else { - page_lock(p2); - page_lock(p1); - } -} - -/* lock the page(s) of a TB in the correct acquisition order */ -static void page_lock_tb(const TranslationBlock *tb) -{ - page_lock_pair(NULL, tb_page_addr0(tb), NULL, tb_page_addr1(tb), false); -} - -static void page_unlock_tb(const TranslationBlock *tb) -{ - PageDesc *p1 = page_find(tb_page_addr0(tb) >> TARGET_PAGE_BITS); - - page_unlock(p1); - if (unlikely(tb_page_addr1(tb) != -1)) { - PageDesc *p2 = page_find(tb_page_addr1(tb) >> TARGET_PAGE_BITS); - - if (p2 != p1) { - page_unlock(p2); - } + assert(paddr0 != -1); + if (unlikely(paddr1 != -1) && pindex0 != pindex1) { + tb_page_remove(page_find_alloc(pindex1, false), tb); } + tb_page_remove(page_find_alloc(pindex0, false), tb); } #endif /* CONFIG_USER_ONLY */ @@ -925,18 +955,16 @@ static void tb_phys_invalidate__locked(TranslationBlock *tb) void tb_phys_invalidate(TranslationBlock *tb, tb_page_addr_t page_addr) { if (page_addr == -1 && tb_page_addr0(tb) != -1) { - page_lock_tb(tb); + tb_lock_pages(tb); do_tb_phys_invalidate(tb, true); - page_unlock_tb(tb); + tb_unlock_pages(tb); } else { do_tb_phys_invalidate(tb, false); } } /* - * Add a new TB and link it to the physical page tables. phys_page2 is - * (-1) to indicate that only one page contains the TB. - * + * Add a new TB and link it to the physical page tables. * Called with mmap_lock held for user-mode emulation. * * Returns a pointer @tb, or a pointer to an existing TB that matches @tb. @@ -944,43 +972,29 @@ void tb_phys_invalidate(TranslationBlock *tb, tb_page_addr_t page_addr) * for the same block of guest code that @tb corresponds to. In that case, * the caller should discard the original @tb, and use instead the returned TB. */ -TranslationBlock *tb_link_page(TranslationBlock *tb, tb_page_addr_t phys_pc, - tb_page_addr_t phys_page2) +TranslationBlock *tb_link_page(TranslationBlock *tb) { - PageDesc *p; - PageDesc *p2 = NULL; void *existing_tb = NULL; uint32_t h; assert_memory_lock(); tcg_debug_assert(!(tb->cflags & CF_INVALID)); - /* - * Add the TB to the page list, acquiring first the pages's locks. - * We keep the locks held until after inserting the TB in the hash table, - * so that if the insertion fails we know for sure that the TBs are still - * in the page descriptors. - * Note that inserting into the hash table first isn't an option, since - * we can only insert TBs that are fully initialized. - */ - page_lock_pair(&p, phys_pc, &p2, phys_page2, true); - tb_record(tb, p, p2); + tb_record(tb); /* add in the hash table */ - h = tb_hash_func(phys_pc, (tb->cflags & CF_PCREL ? 0 : tb->pc), + h = tb_hash_func(tb_page_addr0(tb), (tb->cflags & CF_PCREL ? 0 : tb->pc), tb->flags, tb->cs_base, tb->cflags); qht_insert(&tb_ctx.htable, tb, h, &existing_tb); /* remove TB from the page(s) if we couldn't insert it */ if (unlikely(existing_tb)) { tb_remove(tb); - tb = existing_tb; + tb_unlock_pages(tb); + return existing_tb; } - if (p2 && p2 != p) { - page_unlock(p2); - } - page_unlock(p); + tb_unlock_pages(tb); return tb; } diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index d3d4fbc1a4..4c17474fa2 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -290,7 +290,7 @@ TranslationBlock *tb_gen_code(CPUState *cpu, { CPUArchState *env = cpu->env_ptr; TranslationBlock *tb, *existing_tb; - tb_page_addr_t phys_pc; + tb_page_addr_t phys_pc, phys_p2; tcg_insn_unit *gen_code_buf; int gen_code_size, search_size, max_insns; int64_t ti; @@ -313,6 +313,7 @@ TranslationBlock *tb_gen_code(CPUState *cpu, QEMU_BUILD_BUG_ON(CF_COUNT_MASK + 1 != TCG_MAX_INSNS); buffer_overflow: + assert_no_pages_locked(); tb = tcg_tb_alloc(tcg_ctx); if (unlikely(!tb)) { /* flush must be done */ @@ -333,6 +334,10 @@ TranslationBlock *tb_gen_code(CPUState *cpu, tb->cflags = cflags; tb_set_page_addr0(tb, phys_pc); tb_set_page_addr1(tb, -1); + if (phys_pc != -1) { + tb_lock_page0(phys_pc); + } + tcg_ctx->gen_tb = tb; tcg_ctx->addr_type = TARGET_LONG_BITS == 32 ? TCG_TYPE_I32 : TCG_TYPE_I64; #ifdef CONFIG_SOFTMMU @@ -349,8 +354,7 @@ TranslationBlock *tb_gen_code(CPUState *cpu, tcg_ctx->guest_mo = TCG_MO_ALL; #endif - tb_overflow: - + restart_translate: trace_translate_block(tb, pc, tb->tc.ptr); gen_code_size = setjmp_gen_code(env, tb, pc, host_pc, &max_insns, &ti); @@ -369,6 +373,7 @@ TranslationBlock *tb_gen_code(CPUState *cpu, qemu_log_mask(CPU_LOG_TB_OP | CPU_LOG_TB_OP_OPT, "Restarting code generation for " "code_gen_buffer overflow\n"); + tb_unlock_pages(tb); goto buffer_overflow; case -2: @@ -387,14 +392,39 @@ TranslationBlock *tb_gen_code(CPUState *cpu, "Restarting code generation with " "smaller translation block (max %d insns)\n", max_insns); - goto tb_overflow; + + /* + * The half-sized TB may not cross pages. + * TODO: Fix all targets that cross pages except with + * the first insn, at which point this can't be reached. + */ + phys_p2 = tb_page_addr1(tb); + if (unlikely(phys_p2 != -1)) { + tb_unlock_page1(phys_pc, phys_p2); + tb_set_page_addr1(tb, -1); + } + goto restart_translate; + + case -3: + /* + * We had a page lock ordering problem. In order to avoid + * deadlock we had to drop the lock on page0, which means + * that everything we translated so far is compromised. + * Restart with locks held on both pages. + */ + qemu_log_mask(CPU_LOG_TB_OP | CPU_LOG_TB_OP_OPT, + "Restarting code generation with re-locked pages"); + goto restart_translate; default: g_assert_not_reached(); } } + tcg_ctx->gen_tb = NULL; + search_size = encode_search(tb, (void *)gen_code_buf + gen_code_size); if (unlikely(search_size < 0)) { + tb_unlock_pages(tb); goto buffer_overflow; } tb->tc.size = gen_code_size; @@ -504,6 +534,7 @@ TranslationBlock *tb_gen_code(CPUState *cpu, * before attempting to link to other TBs or add to the lookup table. */ if (tb_page_addr0(tb) == -1) { + assert_no_pages_locked(); return tb; } @@ -518,7 +549,9 @@ TranslationBlock *tb_gen_code(CPUState *cpu, * No explicit memory barrier is required -- tb_link_page() makes the * TB visible in a consistent state. */ - existing_tb = tb_link_page(tb, tb_page_addr0(tb), tb_page_addr1(tb)); + existing_tb = tb_link_page(tb); + assert_no_pages_locked(); + /* if the TB already exists, discard what we just translated */ if (unlikely(existing_tb != tb)) { uintptr_t orig_aligned = (uintptr_t)gen_code_buf; diff --git a/accel/tcg/translator.c b/accel/tcg/translator.c index 0fd9efceba..1a6a5448c8 100644 --- a/accel/tcg/translator.c +++ b/accel/tcg/translator.c @@ -12,9 +12,9 @@ #include "qemu/error-report.h" #include "exec/exec-all.h" #include "exec/translator.h" -#include "exec/translate-all.h" #include "exec/plugin-gen.h" #include "tcg/tcg-op-common.h" +#include "internal.h" static void gen_io_start(void) { @@ -147,10 +147,6 @@ void translator_loop(CPUState *cpu, TranslationBlock *tb, int *max_insns, db->host_addr[0] = host_pc; db->host_addr[1] = NULL; -#ifdef CONFIG_USER_ONLY - page_protect(pc); -#endif - ops->init_disas_context(db, cpu); tcg_debug_assert(db->is_jmp == DISAS_NEXT); /* no early exit */ @@ -256,22 +252,36 @@ static void *translator_access(CPUArchState *env, DisasContextBase *db, host = db->host_addr[1]; base = TARGET_PAGE_ALIGN(db->pc_first); if (host == NULL) { - tb_page_addr_t phys_page = - get_page_addr_code_hostp(env, base, &db->host_addr[1]); + tb_page_addr_t page0, old_page1, new_page1; + + new_page1 = get_page_addr_code_hostp(env, base, &db->host_addr[1]); /* * If the second page is MMIO, treat as if the first page * was MMIO as well, so that we do not cache the TB. */ - if (unlikely(phys_page == -1)) { + if (unlikely(new_page1 == -1)) { + tb_unlock_pages(tb); tb_set_page_addr0(tb, -1); return NULL; } - tb_set_page_addr1(tb, phys_page); -#ifdef CONFIG_USER_ONLY - page_protect(end); -#endif + /* + * If this is not the first time around, and page1 matches, + * then we already have the page locked. Alternately, we're + * not doing anything to prevent the PTE from changing, so + * we might wind up with a different page, requiring us to + * re-do the locking. + */ + old_page1 = tb_page_addr1(tb); + if (likely(new_page1 != old_page1)) { + page0 = tb_page_addr0(tb); + if (unlikely(old_page1 != -1)) { + tb_unlock_page1(page0, old_page1); + } + tb_set_page_addr1(tb, new_page1); + tb_lock_page1(page0, new_page1); + } host = db->host_addr[1]; } From patchwork Sat Jul 15 13:53:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 703233 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e4d:0:b0:314:25da:8dc4 with SMTP id r13csp157882wrt; Sat, 15 Jul 2023 06:57:34 -0700 (PDT) X-Google-Smtp-Source: APBJJlEuuWxesVuO7kWncX6JLg2GtEr5AmFS4/Nu+r06nkcpJhHEiAvZnZCmnx6Rhb0kPO5FMhWt X-Received: by 2002:a0c:f20c:0:b0:635:dc38:f6d6 with SMTP id h12-20020a0cf20c000000b00635dc38f6d6mr7150364qvk.21.1689429454290; Sat, 15 Jul 2023 06:57:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689429454; cv=none; d=google.com; s=arc-20160816; b=JAsuVYDD21sEVHUVU/vZZGXI8NvkD3VW3yjeoztDC7kTX+WEAxxAmCbW837V7egC7c APRHWUofX5FW8idAAjHlfJq/YY2Qdoy0t/pHqxSZResRNkY2T2+fXD9dCtBy0+h8x07G oTSg+Ryu3Lqjm5BC/R9wu4nNyeNVZ4f2dGaDLKlIS9Spwun4WE+fUWLtPhIp4YDKtrYc Wbe3c4a4bX2Lgx3OIQh/p0l1r5C6YA9x3bXdDBni3LqLf+T74nu3VfTtk8jTQGZrK5VE MCu9sTNlDHp8yBp9uMPV1scsY45CeH3Dqdq+/2fb3r3PM9eWCkBRVALNfdC5mBfT+n9e TCqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=/qx14gk5I4WzFXUubYo3gGMTlVb0WZhBx/ntAFiHBZ8=; fh=exhpOcIcC0vGFDagsg3ldbYWYFKMrGchVSllK9BlNPw=; b=QcX1cKf5C/7B9mfVhILsmxhYzRD1a1GVFRsS+Ko0R6LpKXm/dYecFyxpITEFn78oU3 TqZtgK+IK+U9gE/dTj0s1KQMAGUrsN0H/0Q3DG27am63SxOHxRgJomoe2g12My0xdhVz JtqEOlrN4JamcjWZSYBMlDh6Hy0h+e1ilfObLp70tQpENjgu1fKVMxDy+cSKP8ySpT0+ hR4VgKQUIzcyi38MERXQlPfjJbyse5Sk9tLMGy/CEh5YaaUU5Tzk/fXEs0SKAe4Kb4Fw 6O744GywN/xkKcIxTEZu2zfheEWSQIX3QW95Tbcn6fejhRRVbGBzF5myeqHdRb4mtDT1 0xyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UKL0sVkP; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id y1-20020a0ce041000000b00635fb8442a1si5820351qvk.314.2023.07.15.06.57.34 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 15 Jul 2023 06:57:34 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UKL0sVkP; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qKfll-0001OQ-1x; Sat, 15 Jul 2023 09:57:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qKflb-00018I-D1 for qemu-devel@nongnu.org; Sat, 15 Jul 2023 09:56:59 -0400 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qKflZ-0003UC-OK for qemu-devel@nongnu.org; Sat, 15 Jul 2023 09:56:59 -0400 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-3fbc244d384so26670805e9.0 for ; Sat, 15 Jul 2023 06:56:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689429416; x=1692021416; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=/qx14gk5I4WzFXUubYo3gGMTlVb0WZhBx/ntAFiHBZ8=; b=UKL0sVkPD5MSqpKA1oiDlkuHHXXIAaxMiwtf13zBQfJXzIYKZbTj6fAfHocoKqzs1a YWenrtWmrIHZsd8ddf0urAvr11i3iMBf7/M9SKdWUtLUjf716o7wnxjH/TKAcB2o62gq 0o9lWjLXqaRVuT52Jjw7g7g09s91sSGBynEjIpSLGelOGbqE7No+XIfIcF6Vt7t1svuS 5egGcuchWQ51tLrF+TsUxd4wFxa/7e9Lz0Gw6u9TmqVIZ3rFYFDGUoBMuqlxtyCsws8s 3Go2QsqJhHQMLmNCms4NTTQMP/XVWtE4a4Y6/Fvw38g929cazieJ5N599wBXRpLvhiVg JhFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689429416; x=1692021416; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/qx14gk5I4WzFXUubYo3gGMTlVb0WZhBx/ntAFiHBZ8=; b=HVF/iTdwmSdYOL28P/2FVvp2wcKfNQ6edIvs+2TZplG9/tdO/WbHBYfvnb9gK+lQkg uYsQi6/MkEvMEYo5ydIFaYnduspBuXoRQynMHWydx7vb8OlGeOh3Gma6tU74Qr40fW/g SAA5afyBpHf2WazFKx0vANGux2ti5+GHSxKV4NmZn912bc56i3XNueI1OHK8EuzubFBR MQAsI5z9daSpUkoht7fNQproalE1zX7MHK1xKobLXG4y7piGpqLmHi2Aerb5UieU2VV1 wEtm2PsWi1vn+Fhu21QaP5/LJrKUPBnO9uxTWubYAuucuZKf48nIwmd0x3xD5ZEDdTNm sLXw== X-Gm-Message-State: ABy/qLZQE8T7jQuF2LIsKQgUGqealmey6SEyzW8CjUteJSS0bvEZetEB QbejFU5IR6IqaLoW2nxF26N3C9o4Wi05+NF5MEqgnw== X-Received: by 2002:a5d:664d:0:b0:314:3954:7ff6 with SMTP id f13-20020a5d664d000000b0031439547ff6mr5781995wrw.56.1689429415852; Sat, 15 Jul 2023 06:56:55 -0700 (PDT) Received: from stoup.lan ([51.219.12.49]) by smtp.gmail.com with ESMTPSA id r8-20020a056000014800b0030fa3567541sm13866651wrx.48.2023.07.15.06.56.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Jul 2023 06:56:55 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Thomas Huth Subject: [PULL 47/47] tcg: Use HAVE_CMPXCHG128 instead of CONFIG_CMPXCHG128 Date: Sat, 15 Jul 2023 14:53:17 +0100 Message-Id: <20230715135317.7219-48-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230715135317.7219-1-richard.henderson@linaro.org> References: <20230715135317.7219-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32b; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x32b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org We adjust CONFIG_ATOMIC128 and CONFIG_CMPXCHG128 with CONFIG_ATOMIC128_OPT in atomic128.h. It is difficult to tell when those changes have been applied with the ifdef we must use with CONFIG_CMPXCHG128. So instead use HAVE_CMPXCHG128, which triggers -Werror-undef when the proper header has not been included. Improves tcg_gen_atomic_cmpxchg_i128 for s390x host, which requires CONFIG_ATOMIC128_OPT. Without this we fall back to EXCP_ATOMIC to single-step 128-bit atomics, which is slow enough to cause some tests to time out. Reported-by: Thomas Huth Tested-by: Thomas Huth Signed-off-by: Richard Henderson --- accel/tcg/tcg-runtime.h | 2 +- include/exec/helper-proto-common.h | 2 ++ accel/tcg/cputlb.c | 2 +- accel/tcg/user-exec.c | 2 +- tcg/tcg-op-ldst.c | 2 +- accel/tcg/atomic_common.c.inc | 2 +- 6 files changed, 7 insertions(+), 5 deletions(-) diff --git a/accel/tcg/tcg-runtime.h b/accel/tcg/tcg-runtime.h index 39e68007f9..186899a2c7 100644 --- a/accel/tcg/tcg-runtime.h +++ b/accel/tcg/tcg-runtime.h @@ -58,7 +58,7 @@ DEF_HELPER_FLAGS_5(atomic_cmpxchgq_be, TCG_CALL_NO_WG, DEF_HELPER_FLAGS_5(atomic_cmpxchgq_le, TCG_CALL_NO_WG, i64, env, i64, i64, i64, i32) #endif -#ifdef CONFIG_CMPXCHG128 +#if HAVE_CMPXCHG128 DEF_HELPER_FLAGS_5(atomic_cmpxchgo_be, TCG_CALL_NO_WG, i128, env, i64, i128, i128, i32) DEF_HELPER_FLAGS_5(atomic_cmpxchgo_le, TCG_CALL_NO_WG, diff --git a/include/exec/helper-proto-common.h b/include/exec/helper-proto-common.h index 4d4b022668..8b67170a22 100644 --- a/include/exec/helper-proto-common.h +++ b/include/exec/helper-proto-common.h @@ -7,6 +7,8 @@ #ifndef HELPER_PROTO_COMMON_H #define HELPER_PROTO_COMMON_H +#include "qemu/atomic128.h" /* for HAVE_CMPXCHG128 */ + #define HELPER_H "accel/tcg/tcg-runtime.h" #include "exec/helper-proto.h.inc" #undef HELPER_H diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index c2b81ec569..e0079c9a9d 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -3105,7 +3105,7 @@ void cpu_st16_mmu(CPUArchState *env, target_ulong addr, Int128 val, #include "atomic_template.h" #endif -#if defined(CONFIG_ATOMIC128) || defined(CONFIG_CMPXCHG128) +#if defined(CONFIG_ATOMIC128) || HAVE_CMPXCHG128 #define DATA_SIZE 16 #include "atomic_template.h" #endif diff --git a/accel/tcg/user-exec.c b/accel/tcg/user-exec.c index df60c7d673..ac38c2bf96 100644 --- a/accel/tcg/user-exec.c +++ b/accel/tcg/user-exec.c @@ -1433,7 +1433,7 @@ static void *atomic_mmu_lookup(CPUArchState *env, vaddr addr, MemOpIdx oi, #include "atomic_template.h" #endif -#if defined(CONFIG_ATOMIC128) || defined(CONFIG_CMPXCHG128) +#if defined(CONFIG_ATOMIC128) || HAVE_CMPXCHG128 #define DATA_SIZE 16 #include "atomic_template.h" #endif diff --git a/tcg/tcg-op-ldst.c b/tcg/tcg-op-ldst.c index 0fcc1618e5..d54c305598 100644 --- a/tcg/tcg-op-ldst.c +++ b/tcg/tcg-op-ldst.c @@ -778,7 +778,7 @@ typedef void (*gen_atomic_op_i64)(TCGv_i64, TCGv_env, TCGv_i64, #else # define WITH_ATOMIC64(X) #endif -#ifdef CONFIG_CMPXCHG128 +#if HAVE_CMPXCHG128 # define WITH_ATOMIC128(X) X, #else # define WITH_ATOMIC128(X) diff --git a/accel/tcg/atomic_common.c.inc b/accel/tcg/atomic_common.c.inc index ee222fd7e7..95a5c5ff12 100644 --- a/accel/tcg/atomic_common.c.inc +++ b/accel/tcg/atomic_common.c.inc @@ -41,7 +41,7 @@ CMPXCHG_HELPER(cmpxchgq_be, uint64_t) CMPXCHG_HELPER(cmpxchgq_le, uint64_t) #endif -#ifdef CONFIG_CMPXCHG128 +#if HAVE_CMPXCHG128 CMPXCHG_HELPER(cmpxchgo_be, Int128) CMPXCHG_HELPER(cmpxchgo_le, Int128) #endif