From nobody Mon May 20 16:07:49 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1689429358; cv=none; d=zohomail.com; s=zohoarc; b=DWvPh3RbdkErBWUErgtCuw8SxgxfZqXxRFgcGdH261npcVC/FufL70+GerH0wttFGoynizMVOkVCUYM+0Bm0pn/XKCkZ12jf7HvRttzFPlaP8jUEqvhh2na9YIsc8I9VBKBenA3EjIlwibqzAtDQrNjau7+Rg67WNwTW7dQsGU4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689429358; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ucetWZKQxGf1H8/69kqF4wjbJkZDEr6t/e7SdhPKj/g=; b=P/tman/TA/SaYanMELhl1tt1GG9+mpLqG8KfynKlaXko6Z1U7Dtn1sd3HnbnRRI63tZp1ben21HHqxToPD8gOodzVgEBh7iQg0XZqRmo3MdVlcOCFqgC0jWHd466cgBwo4YHIbbK/azIxGU5mnGnc4zci+E+8FN10o15PlsP1Dg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 168942935845561.84942379085294; Sat, 15 Jul 2023 06:55:58 -0700 (PDT) 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) 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) 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-Google-Smtp-Source: APBJJlGELdJRivOetUmPAZidBb+TNT6wZSSX0kzNi0sp4bmPX47ORVsd2nz546pLO/wHcRtng3P00g== 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) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1689429360302100004 Untabify and re-indent. We had a mix of 2, 3, 4, and 8 space indentation. Reviewed-by: Philippe Mathieu-Daud=C3=A9 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() */ =20 #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 =20 #define TARGET_SEMOPM 500 =20 @@ -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 =20 -#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 =20 -#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) =20 -#define TARGET_IOC_SIZEBITS 14 -#define TARGET_IOC_DIRBITS 2 +#define TARGET_IOC_SIZEBITS 14 +#define TARGET_IOC_DIRBITS 2 =20 -#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 =20 -#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) =20 -#define TARGET_IOC_SIZEBITS 13 -#define TARGET_IOC_DIRBITS 3 +#define TARGET_IOC_SIZEBITS 13 +#define TARGET_IOC_DIRBITS 3 =20 -#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 =20 #elif defined(TARGET_HPPA) @@ -115,32 +115,32 @@ #error unsupported CPU #endif =20 -#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) =20 -#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) =20 -#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)) =20 /* 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),si= zeof(size)) -#define TARGET_IOW(type,nr,size) TARGET_IOC(TARGET_IOC_WRITE,(type),(nr),s= izeof(size)) -#define TARGET_IOWR(type,nr,size) TARGET_IOC(TARGET_IOC_READ|TARGET_IOC_WR= ITE,(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)) =20 /* 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),TARGE= T_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),TAR= GET_IOC_SIZEMASK) +#define TARGET_IOWU(type,nr) TARGET_IOC(TARGET_IOC_WRITE,(type),(nr),TA= RGET_IOC_SIZEMASK) +#define TARGET_IOWRU(type,nr) TARGET_IOC(TARGET_IOC_READ|TARGET_IOC_WRIT= E,(type),(nr),TARGET_IOC_SIZEMASK) =20 struct target_sockaddr { abi_ushort sa_family; @@ -174,12 +174,12 @@ struct target_in_addr { }; =20 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)]; }; =20 struct target_sockaddr_in6 { @@ -360,12 +360,12 @@ struct target_iovec { }; =20 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 descript= or 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 descri= ptor passing) */ + abi_long msg_controllen; /* Length of cmsg list */ unsigned int msg_flags; }; =20 @@ -376,10 +376,10 @@ struct target_cmsghdr { }; =20 #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; =20 - __ptr =3D (struct target_cmsghdr *)((unsigned char *) __cmsg - + TARGET_CMSG_ALIGN (tswapal(__cmsg->c= msg_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 =3D (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; } =20 struct target_mmsghdr { @@ -407,55 +407,55 @@ struct target_mmsghdr { }; =20 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 siz= e */ - abi_long ru_ixrss; /* integral shared memory s= ize */ - abi_long ru_idrss; /* integral unshared data s= ize */ - 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 switch= es */ - 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 " */ }; =20 typedef struct { - int val[2]; + int val[2]; } kernel_fsid_t; =20 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[]; }; =20 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[]; }; =20 =20 /* 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 */ =20 #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) =20 typedef struct { @@ -508,71 +508,71 @@ typedef abi_ulong target_old_sa_flags; =20 #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 }; =20 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 =20 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; =20 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 =20 -#define TARGET_SI_MAX_SIZE 128 +#define TARGET_SI_MAX_SIZE 128 =20 #if TARGET_ABI_BITS =3D=3D 32 #define TARGET_SI_PREAMBLE_SIZE (3 * sizeof(int)) @@ -599,82 +599,82 @@ typedef struct { =20 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 =20 - union { - int _pad[TARGET_SI_PAD_SIZE]; + union { + int _pad[TARGET_SI_PAD_SIZE]; =20 - /* 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; =20 - /* POSIX.1b timers */ - struct { - unsigned int _timer1; - unsigned int _timer2; - } _timer; + /* POSIX.1b timers */ + struct { + unsigned int _timer1; + unsigned int _timer2; + } _timer; =20 - /* 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; =20 - /* 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; =20 - /* 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; =20 - /* 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; =20 /* * 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 somewhe= re */ +#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 ch= ange */ +#define TARGET_SI_ASYNCIO -4 /* sent by AIO completion */ +#define TARGET_SI_SIGIO -5 /* sent by queued SIGIO */ =20 /* * 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 */ =20 /* * 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 opti= onal*/ @@ -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 { }; =20 /* 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 o= ff) */ +#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 tab= le */ -#define TARGET_KDGKBSENT 0x4B48 /* gets one function key string entr= y */ -#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 t= able */ +#define TARGET_KDGKBSENT 0x4B48 /* gets one function key string en= try */ +#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 flag= s] */ #define TARGET_KDSIGACCEPT 0x4B4E =20 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_wkalr= m) #define TARGET_RTC_WKALM_SET TARGET_IOW('p', 0x0f, struct rtc_wkalr= m) -#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) =20 -#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) */ =20 #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_MA= GIC, 14) #define TARGET_BTRFS_IOC_SNAP_DESTROY TARGET_IOWU(BTRFS_IOCTL_MA= GIC, 15) #define TARGET_BTRFS_IOC_INO_LOOKUP TARGET_IOWRU(BTRFS_IOCTL_M= AGIC, 18) -#define TARGET_BTRFS_IOC_DEFAULT_SUBVOL TARGET_IOW(BTRFS_IOCTL_MAG= IC, 19,\ +#define TARGET_BTRFS_IOC_DEFAULT_SUBVOL TARGET_IOW(BTRFS_IOCTL_MAG= IC, 19, \ abi_ullong) -#define TARGET_BTRFS_IOC_SUBVOL_GETFLAGS TARGET_IOR(BTRFS_IOCTL_MAG= IC, 25,\ +#define TARGET_BTRFS_IOC_SUBVOL_GETFLAGS TARGET_IOR(BTRFS_IOCTL_MAG= IC, 25, \ abi_ullong) -#define TARGET_BTRFS_IOC_SUBVOL_SETFLAGS TARGET_IOW(BTRFS_IOCTL_MAG= IC, 26,\ +#define TARGET_BTRFS_IOC_SUBVOL_SETFLAGS TARGET_IOW(BTRFS_IOCTL_MAG= IC, 26, \ abi_ullong) #define TARGET_BTRFS_IOC_SCRUB TARGET_IOWRU(BTRFS_IOCTL_M= AGIC, 27) #define TARGET_BTRFS_IOC_SCRUB_CANCEL TARGET_IO(BTRFS_IOCTL_MAGI= C, 28) @@ -1049,56 +1049,56 @@ struct target_rtc_pll_info { #define TARGET_USBDEVFS_GET_SPEED TARGET_IO('U', 31) =20 /* 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 (23= 36 Bytes) - (struct cdrom_read) */ -#define TARGET_CDROMREADMODE1 0x530d /* Read TARGET_CDROM mode 1 data (20= 48 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 depreca= ted, - but here anyway for compatibilit= y */ -#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 Oper= ation */ +#define TARGET_CDROMPLAYMSF 0x5303 /* Play Audio MSF (struct c= drom_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) aut= o-ejecting */ +#define TARGET_CDROMMULTISESSION 0x5310 /* Obtain the start-of-last= -session + address of multi session= disks + (struct cdrom_multisessi= on) */ +#define TARGET_CDROM_GET_MCN 0x5311 /* Obtain the "Universal Pr= oduct Code" + if available (struct cdr= om_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 s= etting + (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 mod= e */ +#define TARGET_CDROMSEEK 0x5316 /* seek msf address */ =20 /* * 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) */ =20 /* * These ioctls are only used in optcd.c */ -#define TARGET_CDROMREADALL 0x5318 /* read all 2646 bytes */ +#define TARGET_CDROMREADALL 0x5318 /* read all 2646 bytes */ =20 /* * 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-b= oxes) */ +#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 */ =20 /* Note that scsi/scsi_ioctl.h also uses 0x5382 - 0x5386. * Future CDROM ioctls should be kept below 0x537F */ =20 /* 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 si= ze */ +/* conflict with SCSI_IOCTL_GET_IDLUN */ =20 /* 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 */ =20 -#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 dr= ive */ +#define TARGET_CDROM_NEXT_WRITABLE 0x5394 /* get next writable block= */ +#define TARGET_CDROM_LAST_WRITTEN 0x5395 /* get last block written = on disc */ =20 /* HD commands */ =20 @@ -1234,19 +1234,19 @@ struct target_rtc_pll_info { =20 #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 */ }; =20 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; }; =20 #include "termbits.h" @@ -1263,115 +1263,115 @@ struct target_winsize { #endif =20 /* 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 mappin= g */ #else -#define TARGET_MAP_TYPE 0x0f /* Mask for type of mapping */ +#define TARGET_MAP_TYPE 0x0f /* Mask for type of mappin= g */ #endif =20 /* 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 executabl= e */ +#define TARGET_MAP_LOCKED 0x8000 /* pages are locked */ +#define TARGET_MAP_NORESERVE 0x0400 /* don't check for reserva= tions */ +#define TARGET_MAP_POPULATE 0x10000 /* populate (prefault) pag= etables */ +#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 mapp= ing */ #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 executabl= e */ +#define TARGET_MAP_LOCKED 0x0080 /* pages are locked */ +#define TARGET_MAP_NORESERVE 0x0040 /* don't check for reserva= tions */ +#define TARGET_MAP_POPULATE 0x8000 /* populate (prefault) pag= etables */ +#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 mapp= ing */ #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 executabl= e */ +#define TARGET_MAP_LOCKED 0x08000 /* lock the mapping */ +#define TARGET_MAP_NORESERVE 0x10000 /* no check for reservatio= ns */ +#define TARGET_MAP_POPULATE 0x20000 /* pop (prefault) pagetabl= es */ +#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 mapp= ing */ #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 executabl= e */ +#define TARGET_MAP_LOCKED 0x02000 /* lock the mapping */ +#define TARGET_MAP_NORESERVE 0x04000 /* no check for reservatio= ns */ +#define TARGET_MAP_POPULATE 0x10000 /* pop (prefault) pagetabl= es */ +#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 mapp= ing */ #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 executabl= e */ +#define TARGET_MAP_LOCKED 0x8000 /* pages are locked */ +#define TARGET_MAP_NORESERVE 0x0400 /* don't check for reserva= tions */ +#define TARGET_MAP_POPULATE 0x10000 /* populate (prefault) pag= etables */ +#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 executabl= e */ +#define TARGET_MAP_LOCKED 0x2000 /* pages are locked */ +#define TARGET_MAP_NORESERVE 0x4000 /* don't check for reserva= tions */ +#define TARGET_MAP_POPULATE 0x8000 /* populate (prefault) pag= etables */ +#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 mapp= ing */ -#define TARGET_MAP_UNINITIALIZED 0x4000000 /* for anonymous mmap, memory c= ould be uninitialized */ +#define TARGET_MAP_UNINITIALIZED 0x4000000 /* for anonymous mmap, mem= ory could be uninitialized */ #endif =20 -#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; }; =20 /* 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]; =20 -#define TARGET_STAT64_HAS_BROKEN_ST_INO 1 - abi_ulong __st_ino; +#define TARGET_STAT64_HAS_BROKEN_ST_INO 1 + abi_ulong __st_ino; =20 - unsigned int st_mode; - unsigned int st_nlink; + unsigned int st_mode; + unsigned int st_nlink; =20 - abi_ulong st_uid; - abi_ulong st_gid; + abi_ulong st_uid; + abi_ulong st_gid; =20 - unsigned short st_rdev; - unsigned char __pad3[10]; + unsigned short st_rdev; + unsigned char __pad3[10]; =20 - long long st_size; - abi_ulong st_blksize; + long long st_size; + abi_ulong st_blksize; =20 - 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= */ =20 - abi_ulong target_st_atime; - abi_ulong target_st_atime_nsec; + abi_ulong target_st_atime; + abi_ulong target_st_atime_nsec; =20 - abi_ulong target_st_mtime; - abi_ulong target_st_mtime_nsec; + abi_ulong target_st_mtime; + abi_ulong target_st_mtime_nsec; =20 - abi_ulong target_st_ctime; - abi_ulong target_st_ctime_nsec; + abi_ulong target_st_ctime; + abi_ulong target_st_ctime_nsec; =20 - unsigned long long st_ino; + unsigned long long st_ino; } QEMU_PACKED; =20 #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; =20 - abi_ulong st_uid; - abi_ulong st_gid; + abi_ulong st_uid; + abi_ulong st_gid; =20 - unsigned long long st_rdev; - unsigned int __pad2[2]; + unsigned long long st_rdev; + unsigned int __pad2[2]; =20 - 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; =20 - abi_ulong target_st_atime; - abi_ulong target_st_atime_nsec; + abi_ulong target_st_atime; + abi_ulong target_st_atime_nsec; =20 - abi_ulong target_st_mtime; - abi_ulong target_st_mtime_nsec; + abi_ulong target_st_mtime; + abi_ulong target_st_mtime_nsec; =20 - abi_ulong target_st_ctime; - abi_ulong target_st_ctime_nsec; + abi_ulong target_st_ctime; + abi_ulong target_st_ctime_nsec; =20 - unsigned long long st_ino; + unsigned long long st_ino; } QEMU_PACKED; #endif =20 #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]; }; =20 #define TARGET_HAS_STRUCT_STAT64 struct target_stat64 { - unsigned char __pad0[6]; - unsigned short st_dev; + unsigned char __pad0[6]; + unsigned short st_dev; =20 - uint64_t st_ino; - uint64_t st_nlink; + uint64_t st_ino; + uint64_t st_nlink; =20 - unsigned int st_mode; + unsigned int st_mode; =20 - unsigned int st_uid; - unsigned int st_gid; + unsigned int st_uid; + unsigned int st_gid; =20 - unsigned char __pad2[6]; - unsigned short st_rdev; + unsigned char __pad2[6]; + unsigned short st_rdev; =20 - int64_t st_size; - int64_t st_blksize; + int64_t st_size; + int64_t st_blksize; =20 - unsigned char __pad4[4]; - unsigned int st_blocks; + unsigned char __pad4[4]; + unsigned int st_blocks; =20 - abi_ulong target_st_atime; - abi_ulong target_st_atime_nsec; + abi_ulong target_st_atime; + abi_ulong target_st_atime_nsec; =20 - abi_ulong target_st_mtime; - abi_ulong target_st_mtime_nsec; + abi_ulong target_st_mtime; + abi_ulong target_st_mtime_nsec; =20 - abi_ulong target_st_ctime; - abi_ulong target_st_ctime_nsec; + abi_ulong target_st_ctime; + abi_ulong target_st_ctime_nsec; =20 - abi_ulong __unused4[3]; + abi_ulong __unused4[3]; }; =20 #elif defined(TARGET_SPARC) =20 #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]; }; =20 #define TARGET_HAS_STRUCT_STAT64 struct target_stat64 { - unsigned char __pad0[6]; - unsigned short st_dev; + unsigned char __pad0[6]; + unsigned short st_dev; =20 - uint64_t st_ino; + uint64_t st_ino; =20 - unsigned int st_mode; - unsigned int st_nlink; + unsigned int st_mode; + unsigned int st_nlink; =20 - unsigned int st_uid; - unsigned int st_gid; + unsigned int st_uid; + unsigned int st_gid; =20 - unsigned char __pad2[6]; - unsigned short st_rdev; + unsigned char __pad2[6]; + unsigned short st_rdev; =20 - unsigned char __pad3[8]; + unsigned char __pad3[8]; =20 - int64_t st_size; - unsigned int st_blksize; + int64_t st_size; + unsigned int st_blksize; =20 - unsigned char __pad4[8]; - unsigned int st_blocks; + unsigned char __pad4[8]; + unsigned int st_blocks; =20 - unsigned int target_st_atime; - unsigned int target_st_atime_nsec; + unsigned int target_st_atime; + unsigned int target_st_atime_nsec; =20 - unsigned int target_st_mtime; - unsigned int target_st_mtime_nsec; + unsigned int target_st_mtime; + unsigned int target_st_mtime_nsec; =20 - unsigned int target_st_ctime; - unsigned int target_st_ctime_nsec; + unsigned int target_st_ctime; + unsigned int target_st_ctime_nsec; =20 - unsigned int __unused1; - unsigned int __unused2; + unsigned int __unused1; + unsigned int __unused2; }; =20 #elif defined(TARGET_PPC) =20 #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 }; =20 #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 =20 @@ -1619,78 +1619,78 @@ struct QEMU_PACKED target_stat64 { =20 #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; }; =20 /* 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; =20 - 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; =20 - 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. */ =20 - 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; }; =20 #elif defined(TARGET_M68K) =20 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; }; =20 /* 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]; =20 -#define TARGET_STAT64_HAS_BROKEN_ST_INO 1 - abi_ulong __st_ino; +#define TARGET_STAT64_HAS_BROKEN_ST_INO 1 + abi_ulong __st_ino; =20 - unsigned int st_mode; - unsigned int st_nlink; + unsigned int st_mode; + unsigned int st_nlink; =20 - abi_ulong st_uid; - abi_ulong st_gid; + abi_ulong st_uid; + abi_ulong st_gid; =20 - unsigned long long st_rdev; - unsigned char __pad3[2]; + unsigned long long st_rdev; + unsigned char __pad3[2]; =20 - long long st_size; - abi_ulong st_blksize; + long long st_size; + abi_ulong st_blksize; =20 - 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. */ =20 - abi_ulong target_st_atime; - abi_ulong target_st_atime_nsec; + abi_ulong target_st_atime; + abi_ulong target_st_atime_nsec; =20 - abi_ulong target_st_mtime; - abi_ulong target_st_mtime_nsec; + abi_ulong target_st_mtime; + abi_ulong target_st_mtime_nsec; =20 - abi_ulong target_st_ctime; - abi_ulong target_st_ctime_nsec; + abi_ulong target_st_ctime; + abi_ulong target_st_ctime_nsec; =20 - unsigned long long st_ino; + unsigned long long st_ino; } QEMU_PACKED; =20 #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 */ =20 - abi_ulong st_ino; + abi_ulong st_ino; =20 - unsigned int st_mode; - unsigned int st_nlink; + unsigned int st_mode; + unsigned int st_nlink; =20 - int st_uid; - int st_gid; + int st_uid; + int st_gid; =20 - 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 = */ =20 - abi_ulong st_size; + abi_ulong st_size; =20 - /* - * 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; =20 - unsigned int target_st_mtime; - unsigned int target_st_mtime_nsec; + unsigned int target_st_mtime; + unsigned int target_st_mtime_nsec; =20 - unsigned int target_st_ctime; - unsigned int target_st_ctime_nsec; + unsigned int target_st_ctime; + unsigned int target_st_ctime_nsec; =20 - unsigned int st_blksize; - unsigned int st_pad2; + unsigned int st_blksize; + unsigned int st_pad2; =20 - abi_ulong st_blocks; + abi_ulong st_blocks; }; =20 #elif defined(TARGET_ABI_MIPSN32) =20 #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 expans= ion */ - abi_long target_st_mtime; - abi_ulong target_st_mtime_nsec; /* Reserved for st_mtime expans= ion */ - abi_long target_st_ctime; - abi_ulong target_st_ctime_nsec; /* Reserved for st_ctime expans= ion */ - 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; }; =20 #elif defined(TARGET_ABI_MIPSO32) =20 #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]; }; =20 /* @@ -1834,107 +1834,107 @@ struct target_stat { =20 #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 */ =20 - uint64_t st_ino; + uint64_t st_ino; =20 - unsigned int st_mode; - unsigned int st_nlink; + unsigned int st_mode; + unsigned int st_nlink; =20 - int st_uid; - int st_gid; + int st_uid; + int st_gid; =20 - 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 */ =20 - int64_t st_size; + int64_t st_size; =20 - /* - * 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 expan= sion */ =20 - 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 expan= sion */ =20 - 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 expan= sion */ =20 - abi_ulong st_blksize; - abi_ulong st_pad2; + abi_ulong st_blksize; + abi_ulong st_pad2; =20 - int64_t st_blocks; + int64_t st_blocks; }; =20 #elif defined(TARGET_ALPHA) =20 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; }; =20 #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; =20 - 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; =20 - 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]; }; =20 #elif defined(TARGET_SH4) =20 #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; }; =20 /* 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]; =20 -#define TARGET_STAT64_HAS_BROKEN_ST_INO 1 - abi_ulong __st_ino; +#define TARGET_STAT64_HAS_BROKEN_ST_INO 1 + abi_ulong __st_ino; =20 - unsigned int st_mode; - unsigned int st_nlink; + unsigned int st_mode; + unsigned int st_nlink; =20 - abi_ulong st_uid; - abi_ulong st_gid; + abi_ulong st_uid; + abi_ulong st_gid; =20 - unsigned long long st_rdev; - unsigned char __pad3[4]; + unsigned long long st_rdev; + unsigned char __pad3[4]; =20 - long long st_size; - abi_ulong st_blksize; + long long st_size; + abi_ulong st_blksize; =20 - unsigned long long st_blocks; /* Number 512-byte blocks allocated. */ + unsigned long long st_blocks; /* Number 512-byte blocks allo= cated. */ =20 - abi_ulong target_st_atime; - abi_ulong target_st_atime_nsec; + abi_ulong target_st_atime; + abi_ulong target_st_atime_nsec; =20 - abi_ulong target_st_mtime; - abi_ulong target_st_mtime_nsec; + abi_ulong target_st_mtime; + abi_ulong target_st_mtime_nsec; =20 - abi_ulong target_st_ctime; - abi_ulong target_st_ctime_nsec; + abi_ulong target_st_ctime; + abi_ulong target_st_ctime_nsec; =20 - unsigned long long st_ino; + unsigned long long st_ino; }; =20 #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; =20 - 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. */ =20 - abi_ulong target_st_atime; - abi_ulong target_st_atime_nsec;=20 - 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; =20 - abi_long __unused[3]; + abi_long __unused[3]; }; #elif defined(TARGET_S390X) struct target_stat { @@ -2090,7 +2090,7 @@ struct target_stat64 { }; =20 #elif defined(TARGET_OPENRISC) || defined(TARGET_NIOS2) \ - || defined(TARGET_RISCV) || defined(TARGET_HEXAGON) + || defined(TARGET_RISCV) || defined(TARGET_HEXAGON) =20 /* These are the asm-generic versions of the stat and stat64 structures */ =20 @@ -2210,93 +2210,93 @@ struct target_stat64 { #endif =20 typedef struct { - int val[2]; + int val[2]; } target_fsid_t; =20 #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; =20 - /* 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; =20 - /* 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 =20 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]; }; =20 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]; }; =20 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 =20 @@ -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) =20 -#define TARGET_MIXER_READ(dev) TARGET_IOR('M', dev, int) +#define TARGET_MIXER_READ(dev) TARGET_IOR('M', dev, int) =20 -#define TARGET_SOUND_MIXER_READ_VOLUME TARGET_MIXER_READ(SOUND_MIXER_VOLU= ME) -#define TARGET_SOUND_MIXER_READ_BASS TARGET_MIXER_READ(SOUND_MIXER_BASS) -#define TARGET_SOUND_MIXER_READ_TREBLE TARGET_MIXER_READ(SOUND_MIXER_TREB= LE) -#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_MI= XER_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_ALTP= CM) -#define TARGET_SOUND_MIXER_READ_RECLEV TARGET_MIXER_READ(SOUND_MIXER_RECL= EV) -#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_MI= XER_VOLUME) +#define TARGET_SOUND_MIXER_READ_BASS TARGET_MIXER_READ(SOUND_MI= XER_BASS) +#define TARGET_SOUND_MIXER_READ_TREBLE TARGET_MIXER_READ(SOUND_MI= XER_TREBLE) +#define TARGET_SOUND_MIXER_READ_SYNTH TARGET_MIXER_READ(SOUND_MI= XER_SYNTH) +#define TARGET_SOUND_MIXER_READ_PCM TARGET_MIXER_READ(SOUND_MI= XER_PCM) +#define TARGET_SOUND_MIXER_READ_SPEAKER TARGET_MIXER_READ(SOUND_MI= XER_SPEAKER) +#define TARGET_SOUND_MIXER_READ_LINE TARGET_MIXER_READ(SOUND_MI= XER_LINE) +#define TARGET_SOUND_MIXER_READ_MIC TARGET_MIXER_READ(SOUND_MI= XER_MIC) +#define TARGET_SOUND_MIXER_READ_CD TARGET_MIXER_READ(SOUND_MI= XER_CD) +#define TARGET_SOUND_MIXER_READ_IMIX TARGET_MIXER_READ(SOUND_MI= XER_IMIX) +#define TARGET_SOUND_MIXER_READ_ALTPCM TARGET_MIXER_READ(SOUND_MI= XER_ALTPCM) +#define TARGET_SOUND_MIXER_READ_RECLEV TARGET_MIXER_READ(SOUND_MI= XER_RECLEV) +#define TARGET_SOUND_MIXER_READ_IGAIN TARGET_MIXER_READ(SOUND_MI= XER_IGAIN) +#define TARGET_SOUND_MIXER_READ_OGAIN TARGET_MIXER_READ(SOUND_MI= XER_OGAIN) +#define TARGET_SOUND_MIXER_READ_LINE1 TARGET_MIXER_READ(SOUND_MI= XER_LINE1) +#define TARGET_SOUND_MIXER_READ_LINE2 TARGET_MIXER_READ(SOUND_MI= XER_LINE2) +#define TARGET_SOUND_MIXER_READ_LINE3 TARGET_MIXER_READ(SOUND_MI= XER_LINE3) =20 /* Obsolete macros */ -#define TARGET_SOUND_MIXER_READ_MUTE TARGET_MIXER_READ(SOUND_MIXER_MUTE) -#define TARGET_SOUND_MIXER_READ_ENHANCE TARGET_MIXER_READ(SOUND_MI= XER_ENHANCE) -#define TARGET_SOUND_MIXER_READ_LOUD TARGET_MIXER_READ(SOUND_MIXER_LOUD) +#define TARGET_SOUND_MIXER_READ_MUTE TARGET_MIXER_READ(SOUND_MI= XER_MUTE) +#define TARGET_SOUND_MIXER_READ_ENHANCE TARGET_MIXER_READ(SOUND_MI= XER_ENHANCE) +#define TARGET_SOUND_MIXER_READ_LOUD TARGET_MIXER_READ(SOUND_MI= XER_LOUD) =20 -#define TARGET_SOUND_MIXER_READ_RECSRC TARGET_MIXER_READ(SOUND_MIXER_RECS= RC) -#define TARGET_SOUND_MIXER_READ_DEVMASK TARGET_MIXER_READ(SOUND_MI= XER_DEVMASK) -#define TARGET_SOUND_MIXER_READ_RECMASK TARGET_MIXER_READ(SOUND_MI= XER_RECMASK) -#define TARGET_SOUND_MIXER_READ_STEREODEVS TARGET_MIXER_READ(SOUND_MIXER_S= TEREODEVS) -#define TARGET_SOUND_MIXER_READ_CAPS TARGET_MIXER_READ(SOUND_MIXER_CAPS) +#define TARGET_SOUND_MIXER_READ_RECSRC TARGET_MIXER_READ(SOUND_MI= XER_RECSRC) +#define TARGET_SOUND_MIXER_READ_DEVMASK TARGET_MIXER_READ(SOUND_MI= XER_DEVMASK) +#define TARGET_SOUND_MIXER_READ_RECMASK TARGET_MIXER_READ(SOUND_MI= XER_RECMASK) +#define TARGET_SOUND_MIXER_READ_STEREODEVS TARGET_MIXER_READ(SOUND_MI= XER_STEREODEVS) +#define TARGET_SOUND_MIXER_READ_CAPS TARGET_MIXER_READ(SOUND_MI= XER_CAPS) =20 -#define TARGET_MIXER_WRITE(dev) TARGET_IOWR('M', dev, int) +#define TARGET_MIXER_WRITE(dev) TARGET_IOWR('M', dev, int) =20 -#define TARGET_SOUND_MIXER_WRITE_VOLUME TARGET_MIXER_WRITE(SOUND_MIXER_VOL= UME) -#define TARGET_SOUND_MIXER_WRITE_BASS TARGET_MIXER_WRITE(SOUND_MIXER_BASS) -#define TARGET_SOUND_MIXER_WRITE_TREBLE TARGET_MIXER_WRITE(SOUND_MIXER_TRE= BLE) -#define TARGET_SOUND_MIXER_WRITE_SYNTH TARGET_MIXER_WRITE(SOUND_MIXER_SYN= TH) -#define TARGET_SOUND_MIXER_WRITE_PCM TARGET_MIXER_WRITE(SOUND_MIXER_PCM) -#define TARGET_SOUND_MIXER_WRITE_SPEAKER TARGET_MIXER_WRITE(SOUND_MIXER_SP= EAKER) -#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_ALT= PCM) -#define TARGET_SOUND_MIXER_WRITE_RECLEV TARGET_MIXER_WRITE(SOUND_MIXER_REC= LEV) -#define TARGET_SOUND_MIXER_WRITE_IGAIN TARGET_MIXER_WRITE(SOUND_MIXER_IGA= IN) -#define TARGET_SOUND_MIXER_WRITE_OGAIN TARGET_MIXER_WRITE(SOUND_MIXER_OGA= IN) -#define TARGET_SOUND_MIXER_WRITE_LINE1 TARGET_MIXER_WRITE(SOUND_MIXER_LIN= E1) -#define TARGET_SOUND_MIXER_WRITE_LINE2 TARGET_MIXER_WRITE(SOUND_MIXER_LIN= E2) -#define TARGET_SOUND_MIXER_WRITE_LINE3 TARGET_MIXER_WRITE(SOUND_MIXER_LIN= E3) +#define TARGET_SOUND_MIXER_WRITE_VOLUME TARGET_MIXER_WRITE(SOUND_MIXER_VOL= UME) +#define TARGET_SOUND_MIXER_WRITE_BASS TARGET_MIXER_WRITE(SOUND_M= IXER_BASS) +#define TARGET_SOUND_MIXER_WRITE_TREBLE TARGET_MIXER_WRITE(SOUND_MIXER_TRE= BLE) +#define TARGET_SOUND_MIXER_WRITE_SYNTH TARGET_MIXER_WRITE(SOUND_M= IXER_SYNTH) +#define TARGET_SOUND_MIXER_WRITE_PCM TARGET_MIXER_WRITE(SOUND_M= IXER_PCM) +#define TARGET_SOUND_MIXER_WRITE_SPEAKER TARGET_MIXER_WRITE(SOUND_M= IXER_SPEAKER) +#define TARGET_SOUND_MIXER_WRITE_LINE TARGET_MIXER_WRITE(SOUND_M= IXER_LINE) +#define TARGET_SOUND_MIXER_WRITE_MIC TARGET_MIXER_WRITE(SOUND_M= IXER_MIC) +#define TARGET_SOUND_MIXER_WRITE_CD TARGET_MIXER_WRITE(SOUND_M= IXER_CD) +#define TARGET_SOUND_MIXER_WRITE_IMIX TARGET_MIXER_WRITE(SOUND_M= IXER_IMIX) +#define TARGET_SOUND_MIXER_WRITE_ALTPCM TARGET_MIXER_WRITE(SOUND_MIXER_ALT= PCM) +#define TARGET_SOUND_MIXER_WRITE_RECLEV TARGET_MIXER_WRITE(SOUND_MIXER_REC= LEV) +#define TARGET_SOUND_MIXER_WRITE_IGAIN TARGET_MIXER_WRITE(SOUND_M= IXER_IGAIN) +#define TARGET_SOUND_MIXER_WRITE_OGAIN TARGET_MIXER_WRITE(SOUND_M= IXER_OGAIN) +#define TARGET_SOUND_MIXER_WRITE_LINE1 TARGET_MIXER_WRITE(SOUND_M= IXER_LINE1) +#define TARGET_SOUND_MIXER_WRITE_LINE2 TARGET_MIXER_WRITE(SOUND_M= IXER_LINE2) +#define TARGET_SOUND_MIXER_WRITE_LINE3 TARGET_MIXER_WRITE(SOUND_M= IXER_LINE3) =20 /* 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_EN= HANCE) -#define TARGET_SOUND_MIXER_WRITE_LOUD TARGET_MIXER_WRITE(SOUND_MIXER_LOUD) +#define TARGET_SOUND_MIXER_WRITE_MUTE TARGET_MIXER_WRITE(SOUND_M= IXER_MUTE) +#define TARGET_SOUND_MIXER_WRITE_ENHANCE TARGET_MIXER_WRITE(SOUND_M= IXER_ENHANCE) +#define TARGET_SOUND_MIXER_WRITE_LOUD TARGET_MIXER_WRITE(SOUND_M= IXER_LOUD) =20 -#define TARGET_SOUND_MIXER_WRITE_RECSRC TARGET_MIXER_WRITE(SOUND_MIXER_REC= SRC) +#define TARGET_SOUND_MIXER_WRITE_RECSRC TARGET_MIXER_WRITE(SOUND_MIXER_REC= SRC) =20 struct target_snd_timer_id { int dev_class; @@ -2575,22 +2575,22 @@ struct target_snd_timer_status { =20 /* 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_gi= nfo) -#define TARGET_SNDRV_TIMER_IOCTL_GPARAMS TARGET_IOW('T', 0x04, = \ - struct target_snd_timer_gp= arams) -#define TARGET_SNDRV_TIMER_IOCTL_GSTATUS TARGET_IOWR('T', 0x05, = \ - struct target_snd_timer_gs= tatus) -#define TARGET_SNDRV_TIMER_IOCTL_SELECT TARGET_IOW('T', 0x10, = \ - struct target_snd_timer_se= lect) -#define TARGET_SNDRV_TIMER_IOCTL_INFO TARGET_IOR('T', 0x11, = \ - struct target_snd_timer_in= fo) -#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_st= atus) +#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_sn= d_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_sn= d_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 =20 -#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)) =20 struct target_sigevent { @@ -2814,40 +2814,40 @@ struct target_user_cap_data { #define TARGET_SYSLOG_ACTION_SIZE_BUFFER 10 =20 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; }; =20 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 tim= e */ - struct target_statx_timestamp stx_mtime; /* Last data modification ti= me */ - /* 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 ti= me */ + struct target_statx_timestamp stx_mtime; /* Last data modification t= ime */ + /* 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 */ }; =20 /* from kernel's include/linux/sched/types.h */ --=20 2.34.1 From nobody Mon May 20 16:07:49 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1689429251; cv=none; d=zohomail.com; s=zohoarc; b=Se3FyzwawkBRr6dYpF2QRtLKTPfQM8f97UH/o53ErAbBPsrKD11oK3imhOw0bX4fEfajdxTIbBsLPdtgcWmJ7knm95ljBnInxthF4LLhW0KfPCM0SHXuQwbE8ZP972QC0jW/SC1+KdnZay3GVzfDgoYAGToJzR2Wuad5jMuxw3E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689429251; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=dfPcEEmBTn/D8MUOuhUDyuANxxowzTkGOvS1jQDZcxE=; b=esSyOmDrKc4RjYEBLg2P32rZm8VXR/UhHJ/P+kSL0WAL3TCeKPg2vjZlbvaLN3BPPb84T2i0KqOASwowS8MCQamjgIbZhnn4PIdrgGKrOpwfG1a3uZtFxOK08AXB42I/jDDHB0C2jJ/NNPZ1oFSluiv1rhNBs3wsB/pUHiERO7U= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1689429251205150.56964412608932; Sat, 15 Jul 2023 06:54:11 -0700 (PDT) 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) 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) 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-Google-Smtp-Source: APBJJlF8ZrgLNdYZUaBRUsdBzu64bm1Vzu0PAsMrHFwQkOywWdaTuUbOF8V+JuHCJjHULx2KD4U0iQ== 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) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1689429252073100005 These definitions are in sparc/signal.c. Reviewed-by: Philippe Mathieu-Daud=C3=A9 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 =20 #define TARGET_SI_MAX_SIZE 128 =20 --=20 2.34.1 From nobody Mon May 20 16:07:49 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1689429382; cv=none; d=zohomail.com; s=zohoarc; b=A6bKDd3a2yCFlSNi3MvskSMYeTE22IQXa3Njnf3UaNdxd0YlFX+CFnC481RqtP5HspAOjkmLdRuXYhRxdg9IUGoAjmCGf8/3tfkU9Ay1c0bQr5sgTUbZJQ1aVI+HpsujgBonwg7kCtlWTatO8QJS/SgUvmof8kS0K0ezpwkRdw4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689429382; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=y5HDzepAQyRVnixawY50vCjdQyLm/QL5xJqPsc4X3Xg=; b=JaT/kd4EhtbB+qZk+5BJZSV1QREsKUIGar73GNBxNtXppqJslE1vJu30cYrhhQfvQVOvSjOKNuDvxT8w2ZzucbDcVqg/Xt2eJGKVbWjny7m35Dw3Dq7pCv0QCkeHlQxRVsudVBfRtlq0hMJclf5ZfkfuTymJab7uWLsRz6c6knw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1689429382591413.71131969017006; Sat, 15 Jul 2023 06:56:22 -0700 (PDT) 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) 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) 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-Google-Smtp-Source: APBJJlEKt5b5JIZQ0FMnk07zlyKPGmd+xt9M7+4cvuVYAztfnFTWQs7iW063SWmM4y2CGHWzv3Kt+w== 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) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1689429383938100007 Reviewed-by: Philippe Mathieu-Daud=C3=A9 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 =20 #if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_SH4) \ @@ -215,9 +215,9 @@ struct target_ip_mreqn { =20 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; }; =20 struct target_linger { @@ -508,9 +508,9 @@ typedef abi_ulong target_old_sa_flags; =20 #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; =20 - 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; =20 int64_t st_size; int32_t st_blksize; - uint32_t __pad2; + abi_uint __pad2; int64_t st_blocks; /* Number 512-byte blocks allocated. */ =20 int target_st_atime; @@ -2227,19 +2227,19 @@ struct target_statfs { #endif =20 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]; }; =20 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 =20 @@ -2713,9 +2713,9 @@ struct target_epoll_event { #endif =20 struct target_ucred { - uint32_t pid; - uint32_t uid; - uint32_t gid; + abi_uint pid; + abi_uint uid; + abi_uint gid; }; =20 typedef int32_t target_timer_t; @@ -2754,14 +2754,14 @@ struct target_sigevent { }; =20 struct target_user_cap_header { - uint32_t version; + abi_uint version; int pid; }; =20 struct target_user_cap_data { - uint32_t effective; - uint32_t permitted; - uint32_t inheritable; + abi_uint effective; + abi_uint permitted; + abi_uint inheritable; }; =20 /* from kernel's include/linux/syslog.h */ @@ -2791,19 +2791,19 @@ struct target_user_cap_data { =20 struct target_statx_timestamp { int64_t tv_sec; - uint32_t tv_nsec; + abi_uint tv_nsec; int32_t __reserved; }; =20 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 ti= me */ struct target_statx_timestamp stx_mtime; /* Last data modification t= ime */ /* 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 */ --=20 2.34.1 From nobody Mon May 20 16:07:49 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1689429251; cv=none; d=zohomail.com; s=zohoarc; b=QxjHyG4mcOQkaV1HMjAx2cvBDU1/RzIJ4LuFtg3gOSXhrA/LE7OJc1ZL+R5lZHceBZdNCHYeQg9KZr0jX3bGf0utEcM4pAYFrwrFGeH/dI88I2XrvZVVoZDl45JiZaoz27EBaLhHKIL4kgLU+dkkG4BF4y8rXSlrwUpNnX7WfbI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689429251; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=aow7z7inlkO3pr/eTAXJ2bbplOH1xZ+KdEP0VBoCQXI=; b=TN3qTcs5EKq3sJk4YskRyMrU5mPLGXTecDovynhf6Wo6DRocJxKX6RZ3GOQD80zFfxSEJv4C3v4JKTVjjIuKGSVkeAFGDO+Oyez5fvT1Gb210+lgHTvxDk35Xg9m03XS5NjaoxG+hdU0LSxr71tGRFdRlzrPWUND3iFUAjY9wng= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1689429251459973.1197591113881; Sat, 15 Jul 2023 06:54:11 -0700 (PDT) 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) 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) 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-Google-Smtp-Source: APBJJlHPJhKX/KpxZl0JkbTJJcwjZnycX3rzHUi1IHAlBSMOQTJWNRtkwFhvVEhkeLpLTmz+N0MtYA== 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) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1689429251961100001 Reviewed-by: Philippe Mathieu-Daud=C3=A9 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 =20 #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; =20 int64_t st_size; - int32_t st_blksize; + abi_int st_blksize; abi_uint __pad2; int64_t st_blocks; /* Number 512-byte blocks allocated. */ =20 @@ -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; =20 /* 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]; =20 }; =20 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; }; =20 -typedef int32_t target_timer_t; +typedef abi_int target_timer_t; =20 #define TARGET_SIGEV_MAX_SIZE 64 =20 /* 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 =20 #define TARGET_SIGEV_PAD_SIZE ((TARGET_SIGEV_MAX_SIZE \ - TARGET_SIGEV_PREAMBLE_SIZE) \ - / sizeof(int32_t)) + / sizeof(abi_int)) =20 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; }; =20 struct target_statx { --=20 2.34.1 From nobody Mon May 20 16:07:49 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1689429318; cv=none; d=zohomail.com; s=zohoarc; b=UgOeHVX3Wvz8YozUNv5id0IDjHmYwfaj/kYiiB9LE5G//+zrNRqVxp7jKlDZquazxvWoZIc0wp8waGiTb+bq5F5WJGq6lFuU3x3CTylfQ0q63VTBUTqs9IgpMuzlVV+f7LwCf1lUreg1/mNEImGjDKwup35txZlbe6tIRdpGqc0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689429318; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=LO73AWeIHAR2oL9a8MGDntKx1EKSzMSEdZSpHf3WsVU=; b=UpwOFLqLrhQOsjC56ZHMEuBXxyksgd7GJM1QslqGT6vwAiLFiZ2ZMId/inXxqoJkVtyTTmFxcsjGKj10CTzMRNlU1Xaj5U8A91esJLgWpmbbv9icC2UzBtnl5QDegvRWQ1R94dd2ZwKbFtPpGgCbeJjOnz/aIYvTjInbr4vsKG8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1689429318599408.2116340169854; Sat, 15 Jul 2023 06:55:18 -0700 (PDT) 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) 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) 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-Google-Smtp-Source: APBJJlFJewjvhq/MogzPrf4dYLIYrI3p2aaW3gXUQPPvaZihrOM7XQD2/C12O2jJud5MdOQtasOCsA== 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) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1689429320394100008 Be careful not to change linux_dirent64, which is a host structure. Reviewed-by: Philippe Mathieu-Daud=C3=A9 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; =20 - uint64_t st_ino; - uint64_t st_nlink; + abi_ullong st_ino; + abi_ullong st_nlink; =20 unsigned int st_mode; =20 @@ -1501,7 +1501,7 @@ struct target_stat64 { unsigned char __pad0[6]; unsigned short st_dev; =20 - uint64_t st_ino; + abi_ullong st_ino; =20 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; =20 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; }; =20 #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 */ =20 - uint64_t st_ino; + abi_ullong st_ino; =20 unsigned int st_mode; unsigned int st_nlink; @@ -2044,17 +2044,17 @@ struct target_stat { =20 #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 { =20 #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; }; =20 #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 fi= le */ /* 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 */ }; =20 --=20 2.34.1 From nobody Mon May 20 16:07:49 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1689429251; cv=none; d=zohomail.com; s=zohoarc; b=BVRYvuvCR1EOwl889PZ4pa+ORbhlEVwwI0P+7prgZAbJZ4+Q1i7xVnK0i5Ba3wwCogoHPQRI8FHEyvg+X5GQCI0lgQoVUbTPma64nUzhkHcvyPfEA1B6wDPv+Smq/9AKFimZCMB2F/uDsSau81bI9cMR2ramjzJWlKMlAsHCCFk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689429251; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=IDhKHcH/mNT2yQDdOveHYCYG5DGoM6IQc0ARd1bSGIA=; b=dAEsFSQyWBP8FdnIvDVeWy5WHr+UGEhLu1sRyUSENVBl337Xb18ByTP0YYu2hO5IsPKGRBHTnVbQc3NykC5E3Gh91HXtOux6sEQYswhOxFtKXfcHKUv437b4ZFCwQZ84ietBgUwdAmkIeQK2iSdohOCBLrcl0csPrtk580IjhR4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1689429251200543.1964131579435; Sat, 15 Jul 2023 06:54:11 -0700 (PDT) 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) 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) 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-Google-Smtp-Source: APBJJlEpVR8XDxlFGWnKRv0afGXQ0/Sw9+52Hpw0hIbsNuFr/QATu0SlQMIQ/J7DQV5K3IhczAbt+g== 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) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1689429252100100007 Be careful not to change linux_dirent64, which is a host structure. Reviewed-by: Philippe Mathieu-Daud=C3=A9 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; =20 - int64_t st_size; - int64_t st_blksize; + abi_llong st_size; + abi_llong st_blksize; =20 unsigned char __pad4[4]; unsigned int st_blocks; @@ -1514,7 +1514,7 @@ struct target_stat64 { =20 unsigned char __pad3[8]; =20 - int64_t st_size; + abi_llong st_size; unsigned int st_blksize; =20 unsigned char __pad4[8]; @@ -1630,10 +1630,10 @@ struct QEMU_PACKED target_stat64 { abi_ullong st_rdev; abi_ullong __pad1; =20 - 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; =20 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; }; =20 #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 */ =20 - int64_t st_size; + abi_llong st_size; =20 /* * 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; =20 - int64_t st_blocks; + abi_llong st_blocks; }; =20 #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 =20 struct target_statx_timestamp { - int64_t tv_sec; + abi_llong tv_sec; abi_uint tv_nsec; abi_int __reserved; }; --=20 2.34.1 From nobody Mon May 20 16:07:49 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1689429607; cv=none; d=zohomail.com; s=zohoarc; b=L/qZkBMd3vnjJ/yCZNR+EZMFb9TFxa130Qtaup+hrGRaCvrTxy3fDAaBSCQRO+UYgYwQUSHn+4z/wTdJ/QBCJXh+aB/d5mLjOkeFGT3Q4zStb3rT/Q9CDzEB4tlW7qi9ZfCFei9Hzgq4YGVSnxhJOBxJEW/fO77MxPZgeYNngSQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689429607; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=WZowV46RDd4UZGFRJaWN3kYV5vNiK42zQttdiJYmLHk=; b=JA2Fn4EpBR5H+paVWbGXMRHujxa5H1G0GWtbd39UiUmIQFYCsMriQ7bAUn+84gQQVb8NkfjEdLCaTt84C6V0gsTiPZEFI2NZ+a8HF/9PC1sB9PWwvr/4JhYBLZbg1OmxPj2379A/5z5qPzeIPUGd/L/aUKWEhk182XmOQX6m0Vg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1689429607232608.072888865932; Sat, 15 Jul 2023 07:00:07 -0700 (PDT) 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) 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) 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-Google-Smtp-Source: APBJJlH1XWeTxJY6TUGKtGG6ZPiBiG3+CSje/tmKqoks82krR50ACqX4OKbetGNQBPIoytSZCIpIXA== 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) 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 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1689429609189100009 Content-Type: text/plain; charset="utf-8" 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 descri= ptor passing) */ abi_long msg_controllen; /* Length of cmsg list */ - unsigned int msg_flags; + abi_uint msg_flags; }; =20 struct target_cmsghdr { @@ -403,7 +403,7 @@ __target_cmsg_nxthdr(struct target_msghdr *__mhdr, =20 struct target_mmsghdr { struct target_msghdr msg_hdr; /* Message header */ - unsigned int msg_len; /* Number of bytes transmit= ted */ + abi_uint msg_len; /* Number of bytes transmit= ted */ }; =20 struct target_rusage { @@ -595,8 +595,8 @@ typedef struct target_siginfo { =20 /* POSIX.1b timers */ struct { - unsigned int _timer1; - unsigned int _timer2; + abi_uint _timer1; + abi_uint _timer2; } _timer; =20 /* 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; =20 - unsigned int st_mode; - unsigned int st_nlink; + abi_uint st_mode; + abi_uint st_nlink; =20 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; =20 abi_ulong st_uid; abi_ulong st_gid; =20 unsigned long long st_rdev; - unsigned int __pad2[2]; + abi_uint __pad2[2]; =20 long long st_size; abi_ulong st_blksize; - unsigned int __pad3; + abi_uint __pad3; unsigned long long st_blocks; =20 abi_ulong target_st_atime; @@ -1423,13 +1423,13 @@ struct target_eabi_stat64 { =20 #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; =20 - unsigned int st_mode; + abi_uint st_mode; =20 - unsigned int st_uid; - unsigned int st_gid; + abi_uint st_uid; + abi_uint st_gid; =20 unsigned char __pad2[6]; unsigned short st_rdev; @@ -1459,7 +1459,7 @@ struct target_stat64 { abi_llong st_blksize; =20 unsigned char __pad4[4]; - unsigned int st_blocks; + abi_uint st_blocks; =20 abi_ulong target_st_atime; abi_ulong target_st_atime_nsec; @@ -1503,11 +1503,11 @@ struct target_stat64 { =20 abi_ullong st_ino; =20 - unsigned int st_mode; - unsigned int st_nlink; + abi_uint st_mode; + abi_uint st_nlink; =20 - unsigned int st_uid; - unsigned int st_gid; + abi_uint st_uid; + abi_uint st_gid; =20 unsigned char __pad2[6]; unsigned short st_rdev; @@ -1515,22 +1515,22 @@ struct target_stat64 { unsigned char __pad3[8]; =20 abi_llong st_size; - unsigned int st_blksize; + abi_uint st_blksize; =20 unsigned char __pad4[8]; - unsigned int st_blocks; + abi_uint st_blocks; =20 - unsigned int target_st_atime; - unsigned int target_st_atime_nsec; + abi_uint target_st_atime; + abi_uint target_st_atime_nsec; =20 - unsigned int target_st_mtime; - unsigned int target_st_mtime_nsec; + abi_uint target_st_mtime; + abi_uint target_st_mtime_nsec; =20 - unsigned int target_st_ctime; - unsigned int target_st_ctime_nsec; + abi_uint target_st_ctime; + abi_uint target_st_ctime_nsec; =20 - unsigned int __unused1; - unsigned int __unused2; + abi_uint __unused1; + abi_uint __unused2; }; =20 #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 =20 @@ -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; =20 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; }; =20 @@ -1680,8 +1680,8 @@ struct target_stat64 { #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 abi_ulong __st_ino; =20 - unsigned int st_mode; - unsigned int st_nlink; + abi_uint st_mode; + abi_uint st_nlink; =20 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 */ =20 abi_ulong st_ino; =20 - unsigned int st_mode; - unsigned int st_nlink; + abi_uint st_mode; + abi_uint st_nlink; =20 int st_uid; int st_gid; =20 - 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 = */ =20 abi_ulong st_size; =20 @@ -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; =20 - unsigned int target_st_mtime; - unsigned int target_st_mtime_nsec; + abi_uint target_st_mtime; + abi_uint target_st_mtime_nsec; =20 - unsigned int target_st_ctime; - unsigned int target_st_ctime_nsec; + abi_uint target_st_ctime; + abi_uint target_st_ctime_nsec; =20 - unsigned int st_blksize; - unsigned int st_pad2; + abi_uint st_blksize; + abi_uint st_pad2; =20 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 { =20 abi_ullong st_ino; =20 - unsigned int st_mode; - unsigned int st_nlink; + abi_uint st_mode; + abi_uint st_nlink; =20 int st_uid; int st_gid; @@ -1848,21 +1848,21 @@ struct target_stat64 { #elif defined(TARGET_ALPHA) =20 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; }; =20 #define TARGET_HAS_STRUCT_STAT64 @@ -1873,12 +1873,12 @@ struct target_stat64 { abi_long st_size; abi_ulong st_blocks; =20 - 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; =20 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; =20 - unsigned int st_mode; - unsigned int st_nlink; + abi_uint st_mode; + abi_uint st_nlink; =20 abi_ulong st_uid; abi_ulong st_gid; @@ -1957,10 +1957,10 @@ struct target_stat { abi_ulong st_ino; abi_ulong st_nlink; =20 - 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; }; =20 #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 =20 @@ -2498,7 +2498,7 @@ struct target_snd_timer_id { =20 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]; }; =20 @@ -2531,7 +2531,7 @@ struct target_snd_timer_select { }; =20 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 { =20 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]; }; =20 @@ -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 thi= s.. */ }; =20 --=20 2.34.1 From nobody Mon May 20 16:07:49 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1689429383; cv=none; d=zohomail.com; s=zohoarc; b=l6CZYhGpXAwMbmr2svmAE8sJy/LLJCW7XRFU537JiTbREXjgYH64LE9spF26iq1nW9PDdFxZYdM0/5L4YXl1wVHkpGAu49V7OZKAQgqA9aD2Wb6vHbXJimn2ngc+A+GopC/lDm4sy2Ed2iE49ch0Muzmv9oYRxZwEBFKbPNdyP0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689429383; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Bny+QrSk9kOHXY9n7JH/neknIRvMmyCuxL4ghWqdlbg=; b=eHL5cGL/e3XXP6OCcYX/qcjZ1OpG5Szu/8PRXwK+7Ol5qcAex/EemBwab9djJuVPsK6RUE+Lnq+Frb7QeHpSc2acRe8W/+t4adAa/7K7SThXX9O4hshX5MQSjDkAB5Wl62e2K0evUkmc9VEXnY2/M7yFkISCQ/f2bVg8xYVeGUI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1689429383373350.2931332835651; Sat, 15 Jul 2023 06:56:23 -0700 (PDT) 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) 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) 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-Google-Smtp-Source: APBJJlG6zCMFJLNgy8eU0dfa5sz/MSU/NFG3f7SJz703zKZ8j+yHNr2OwOcyFc1f5rY8r1RVihh/aw== 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) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1689429384207100009 Reviewed-by: Philippe Mathieu-Daud=C3=A9 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; =20 - unsigned long long st_ino; + abi_ullong st_ino; } QEMU_PACKED; =20 #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; =20 - unsigned long long st_rdev; + abi_ullong st_rdev; abi_uint __pad2[2]; =20 long long st_size; abi_ulong st_blksize; abi_uint __pad3; - unsigned long long st_blocks; + abi_ullong st_blocks; =20 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; =20 - unsigned long long st_ino; + abi_ullong st_ino; } QEMU_PACKED; #endif =20 @@ -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]; =20 #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 @@ -1686,7 +1686,7 @@ struct target_stat64 { abi_ulong st_uid; abi_ulong st_gid; =20 - unsigned long long st_rdev; + abi_ullong st_rdev; unsigned char __pad3[2]; =20 long long st_size; @@ -1704,7 +1704,7 @@ struct target_stat64 { abi_ulong target_st_ctime; abi_ulong target_st_ctime_nsec; =20 - unsigned long long st_ino; + abi_ullong st_ino; } QEMU_PACKED; =20 #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]; =20 #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; =20 - unsigned long long st_rdev; + abi_ullong st_rdev; unsigned char __pad3[4]; =20 long long st_size; abi_ulong st_blksize; =20 - unsigned long long st_blocks; /* Number 512-byte blocks allo= cated. */ + abi_ullong st_blocks; /* Number 512-byte blocks allocated. */ =20 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; =20 - unsigned long long st_ino; + abi_ullong st_ino; }; =20 #elif defined(TARGET_I386) && !defined(TARGET_ABI32) --=20 2.34.1 From nobody Mon May 20 16:07:49 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1689429501; cv=none; d=zohomail.com; s=zohoarc; b=DTarbmZZFirf1g/4J+HjKo9/CNzhsXhrO3La4D4nJm4IzHbSmJhhL7rypbX8QPdXCrDe7BqaLN7rpKE/WNp0cfgrYQH6IhE7itLnLj6ZcMI+3mjhjULpkC0y5xdXqE9zlh3mlW9G0zwdrV0+Qs3RzLFnlolCNBcfVBRhgZawjbQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689429501; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=gtm9LlPfPfRyjkKrgBvN2xo7wsnPpDSqZNVUjufgcPA=; b=SyDxXWl4JIxVuBvTXKNxGo6znAksaOjmkfvbnnxzxMGxVAXBg4nax97ds5lqw47Y8bK4hOEX3PaF3kjuZV3MiDNpO7GCexorR+J6oVN/DZnUKy/jA8wosqkCn19q7aT7J3spgUtjPHhPx8sMG6dDtX/tAAftIpoWvd/A+awuf9s= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1689429501576535.1760470359459; Sat, 15 Jul 2023 06:58:21 -0700 (PDT) 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) 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) 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-Google-Smtp-Source: APBJJlEGio/N24RxDZKsxK6RB8wzeEJB0WLwh1wmJ+hRAZtwFqhoJC/sPJD0jGyP4uzb3fNX5Juv3g== 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) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1689429503062100001 Reviewed-by: Philippe Mathieu-Daud=C3=A9 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]; =20 - long long st_size; + abi_llong st_size; abi_ulong st_blksize; =20 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]; =20 - 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]; =20 - long long st_size; + abi_llong st_size; abi_ulong st_blksize; =20 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]; =20 - long long st_size; + abi_llong st_size; abi_ulong st_blksize; =20 abi_ullong st_blocks; /* Number 512-byte blocks allocated. */ --=20 2.34.1 From nobody Mon May 20 16:07:49 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1689429329; cv=none; d=zohomail.com; s=zohoarc; b=SX1f3ICal8iL+XuH8c7/4Qlnne8o3d1q7OEoPpcsITZyZR0B8MkKcWj38rwMcLbBL3SxdPhks1Mk5m2Q3ZXtTpqxF63WWofQI/X0mJ+DZoD4ojOutOBVd+TE2Pz6x/FZdMBHYeLQjqi15fmujyP53navQzp0e49zSAQzJ7cFT40= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689429329; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=vXgUJPpmGDw6aWrzATIglyuAQTPw9nlDBqSS3HfZd1c=; b=Mnt7ix9YybHYExGEW7uj0ZOkT8mP6y/jpOu9TUljvn8oDhrUhc3nt+0JAZV4mT7D7YdRfdRDvaOXnUgEue893t4cKo6jTzrYJeC9rzY/DUrffF9+TUvuCK8/sgylI5AXaXcv6PNWmgrGR1UOgb6O67f0fmgb3lNKcAW/hRK5osE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1689429329910174.13823184494777; Sat, 15 Jul 2023 06:55:29 -0700 (PDT) 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) 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) 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-Google-Smtp-Source: APBJJlGRGdYf3d/z7C826TG94dv5/6ikjmmILqCMRufUujMamfu6cgb0pQLxwRtPByxMzWtn7C1dhg== 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) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1689429330514100003 Reviewed-by: Philippe Mathieu-Daud=C3=A9 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 { =20 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 descri= ptor passing) */ @@ -371,8 +371,8 @@ struct target_msghdr { =20 struct target_cmsghdr { abi_long cmsg_len; - int cmsg_level; - int cmsg_type; + abi_int cmsg_level; + abi_int cmsg_type; }; =20 #define TARGET_CMSG_DATA(cmsg) ((unsigned char *) ((struct target_cmsghdr = *) (cmsg) + 1)) @@ -426,7 +426,7 @@ struct target_rusage { }; =20 typedef struct { - int val[2]; + abi_int val[2]; } kernel_fsid_t; =20 struct target_dirent { @@ -544,7 +544,7 @@ struct target_sigaction { #endif =20 typedef union target_sigval { - int sival_int; + abi_int sival_int; abi_ulong sival_ptr; } target_sigval_t; =20 @@ -575,17 +575,17 @@ typedef union target_sigval { =20 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 =20 union { - int _pad[TARGET_SI_PAD_SIZE]; + abi_int _pad[TARGET_SI_PAD_SIZE]; =20 /* 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 { =20 /* 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" =20 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 =20 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; }; =20 @@ -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) =20 #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 { =20 /* From */ =20 -#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 kee= ps a * user pointer in TUNATTACHFILTER, which we are not able to correctly han= dle. */ -#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) =20 /* From */ =20 -#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 fo= r bmap */ =20 -#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) =20 /* @@ -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) =20 /* 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; =20 - 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; =20 - int st_uid; - int st_gid; + abi_int st_uid; + abi_int st_gid; =20 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; =20 - int st_uid; - int st_gid; + abi_int st_uid; + abi_int st_gid; =20 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 =20 typedef struct { - int val[2]; + abi_int val[2]; } target_fsid_t; =20 #ifdef TARGET_MIPS @@ -2351,7 +2351,7 @@ struct target_statfs64 { =20 /* 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) =20 -#define TARGET_MIXER_READ(dev) TARGET_IOR('M', dev, int) +#define TARGET_MIXER_READ(dev) TARGET_IOR('M', dev, abi_int) =20 #define TARGET_SOUND_MIXER_READ_VOLUME TARGET_MIXER_READ(SOUND_MI= XER_VOLUME) #define TARGET_SOUND_MIXER_READ_BASS TARGET_MIXER_READ(SOUND_MI= XER_BASS) @@ -2461,7 +2461,7 @@ struct target_statfs64 { #define TARGET_SOUND_MIXER_READ_STEREODEVS TARGET_MIXER_READ(SOUND_MI= XER_STEREODEVS) #define TARGET_SOUND_MIXER_READ_CAPS TARGET_MIXER_READ(SOUND_MI= XER_CAPS) =20 -#define TARGET_MIXER_WRITE(dev) TARGET_IOWR('M', dev, int) +#define TARGET_MIXER_WRITE(dev) TARGET_IOWR('M', dev, abi_int) =20 #define TARGET_SOUND_MIXER_WRITE_VOLUME TARGET_MIXER_WRITE(SOUND_MIXER_VOL= UME) #define TARGET_SOUND_MIXER_WRITE_BASS TARGET_MIXER_WRITE(SOUND_M= IXER_BASS) @@ -2489,17 +2489,17 @@ struct target_statfs64 { #define TARGET_SOUND_MIXER_WRITE_RECSRC TARGET_MIXER_WRITE(SOUND_MIXER_REC= SRC) =20 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; }; =20 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 { =20 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 { }; =20 /* 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_in= t) #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 { }; =20 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 { }; =20 struct target_drm_i915_getparam { - int param; + abi_int param; abi_ulong value; }; =20 @@ -2755,7 +2755,7 @@ struct target_sigevent { =20 struct target_user_cap_header { abi_uint version; - int pid; + abi_int pid; }; =20 struct target_user_cap_data { --=20 2.34.1 From nobody Mon May 20 16:07:49 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1689429347; cv=none; d=zohomail.com; s=zohoarc; b=QvYSxGszmxtZM50M8xsLHOGd3BDW7zVqiFo5u8ta5IDfWZvO52EqdDjHcE3Mr8nfCsS+gnb4+rXpZsupmyNQ+s1r1aV74griyO66AubgODti/m05cvaTzOAABUZ97Q7hWXyYoBXdJvyETDh3dGrubiJWGXBWoCPf177C83sRHBo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689429347; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=0axJfNA+Z363BLcyj9VA5KZ1tFbJa96aH9vwiYFI9Ic=; b=JCT9PboTiZN40KTqYNPaw/tqJ0Z7fkfXNLZ+PhXkSg/ET4OBVKd52dnyqsOUH94+vIxqAknI/A0W8NrCoTl/7WyINL6LXDILL2vQnE1Li4QqfbAoAy65u1QHIqx0L50fhZBxQeVDPjo2WAS5GHVIVcRTExs6sSukW3bOkmqaEUY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1689429347554815.089400261934; Sat, 15 Jul 2023 06:55:47 -0700 (PDT) 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) 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) 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-Google-Smtp-Source: APBJJlHFOgDEW3QCgSeVSjfAduO+OquECWdkjPQ83yOFDRJcCCxAeZjprG6mwZ6+hEqyqjDl0sJReQ== 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) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1689429348598100005 Reviewed-by: Philippe Mathieu-Daud=C3=A9 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[]; }; =20 @@ -1210,19 +1210,19 @@ struct target_rtc_pll_info { =20 #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 */ }; =20 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; }; =20 #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]; =20 #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 @@ -1367,7 +1367,7 @@ struct target_stat64 { abi_ulong st_uid; abi_ulong st_gid; =20 - unsigned short st_rdev; + abi_ushort st_rdev; unsigned char __pad3[10]; =20 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; =20 abi_ullong st_ino; abi_ullong st_nlink; @@ -1453,7 +1453,7 @@ struct target_stat64 { abi_uint st_gid; =20 unsigned char __pad2[6]; - unsigned short st_rdev; + abi_ushort st_rdev; =20 abi_llong st_size; abi_llong st_blksize; @@ -1477,13 +1477,13 @@ struct target_stat64 { =20 #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; =20 abi_ullong st_ino; =20 @@ -1510,7 +1510,7 @@ struct target_stat64 { abi_uint st_gid; =20 unsigned char __pad2[6]; - unsigned short st_rdev; + abi_ushort st_rdev; =20 unsigned char __pad3[8]; =20 @@ -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) =20 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 */ --=20 2.34.1 From nobody Mon May 20 16:07:49 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1689429801; cv=none; d=zohomail.com; s=zohoarc; b=cogBOFh//V7cGvkGKwUhA6l1GjkomE6XreSy3keHRah0tIrrwO8gOkpFJYh3mPcU58jEFjMQfXvbUwY16R/DKbMWvCRGFckwcR8AXrhgTunPvPu/57jwptdKfZwAKzMz12/Nhrsk35x2wL971yXzwVKGlpzjQKKYSlz+WNum3oU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689429801; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=gQ2Bxu/rilowTJXaihrKCWkhFlHMy8pQmQA827CvuAY=; b=Z6bd7FftLZ2AJuZ5jCrUBPSW6FyM8Awv2LDDjeY6Z+4LVW0PsJmGmEmjUe6W0JSH1bLz2JEw2c2A+5l8Wep07WNhdBBEbImkMflbBNV5lKeLuMNxYiTnB+pVcMzvoohwcPVl1EfixO5oCF7H5ojAi1NpcMxgQK++TiD76yPDMm0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1689429801670960.0866424586233; Sat, 15 Jul 2023 07:03:21 -0700 (PDT) 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) 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) 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-Google-Smtp-Source: APBJJlEdRN059aQVqrSs6mH/WUQ6qu/xuT7UO4WvdCnN06V+WVPbYF8X1lw8kgEgC4YaYsfN09WnRg== 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) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1689429803281100011 Reviewed-by: Philippe Mathieu-Daud=C3=A9 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 { =20 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 */ }; =20 /* 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; --=20 2.34.1 From nobody Mon May 20 16:07:49 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1689429370; cv=none; d=zohomail.com; s=zohoarc; b=aQW7yK0jxKN3jIeQI/uEYvygh9ZIY2n4iBDhiPiu0E43o12bImfXMOQyDr5h9y6L24/S/Hq12t2pYA2uT/FdMWP966kedjwiiTwo56U74wrKrQH0iaSPkRD5WF39O5/Hs9zXGEcJbr3l02Iechy+4l1YJxA3Om/TSm8huRZ7BaQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689429370; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=NM1xXL81EtFD9ExbvPk3EQKQbkl//TA55SFLIHfjSWw=; b=E/txwPY/5nh2P0fp/FNzHuoTe9+Aj0aj0E1bR2sGM4gfalFEgAxVBcWnAuYuZAyjZNWiH2P6lFcGxdjYk112tCS9weCRBbWZJ2HEHtDi4hmdV8hfQsQygh0Y+GFC/iUu4Ke9txnjmXEWZcNTKNjQhZ88hNwjVexUVfNOAkpCr9s= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1689429370965701.09962077915; Sat, 15 Jul 2023 06:56:10 -0700 (PDT) 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) 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) 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-Google-Smtp-Source: APBJJlEloWOI4ocrvfPGgLjAHMRgWcLD25fj4r4N/25lC1GaMeFB69psyWciPtLjmlIR0mrNKqK5Pg== 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) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1689429372118100001 Reviewed-by: Philippe Mathieu-Daud=C3=A9 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 { =20 #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; --=20 2.34.1 From nobody Mon May 20 16:07:49 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1689429493; cv=none; d=zohomail.com; s=zohoarc; b=Yf7ffeFWSTaK5BfZSWd15ef2EYzlTYrWn3NnHr5/XALf6BIuSoaIcVFU9Gn9R+aZy5MtesNmOnwiXfyqEx8O70ALtxsTnujfLj6ev6B9W/9gI/gpdtW/a9PBS+h7ibshfvO4e6LKpDQ1Vdx6CbFucRl83QuJOqQQQjWpod3/OQs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689429493; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=TsEvG+VWvCxR8wzqDIyWaXPHqC8uQbp4ZRAeyYSrQhw=; b=eRDdCWxKIRXpPE5bpI6DPXRXD0A5raR5OtBrUHh2ybbKNnVZq2MBB9nmAUHKZL3iIRuTMujeUAfIUKVTcIbcQzZg1Kpmg9fp9ch+DROsqqI8+uS42XGTw7AJYdijV2BRkgsWRTHlJdCN4MlVA9SQ3O/ny17/+Nhkk2xdNPiqWY8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1689429493982443.6039495574479; Sat, 15 Jul 2023 06:58:13 -0700 (PDT) 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) 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) 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-Google-Smtp-Source: APBJJlFY8Aq95pSsHrxC+pSoQRTVxMMDftD/I6abyXp10epvk1IICtxhsCzq8V5ARMV2hPPyrSTOWg== 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) 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 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1689429495893100007 Content-Type: text/plain; charset="utf-8" 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 =20 -#if (defined(TARGET_I386) && !defined(TARGET_X86_64)) || defined(TARGET_SH= 4) +#if (defined(TARGET_I386) && !defined(TARGET_X86_64)) \ + || defined(TARGET_SH4) \ + || defined(TARGET_MICROBLAZE) #define ABI_LLONG_ALIGNMENT 4 #endif =20 --=20 2.34.1 From nobody Mon May 20 16:07:49 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1689429346; cv=none; d=zohomail.com; s=zohoarc; b=IUdHWErNbkwD2fIJSHsgWtYX7iD5Ga9TBi2wWiwyqhPXbAnasV+6WAs9BaTsLL40Lem01K1qxOxifjv121QyZz5rqx7EVFsbWtmOO2GlKTWtyO07QEAf4fd+uoY0r3zffXp85x1B2HSEAmkftG3v08rl4eUlAkCuZA0nvkIDSao= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689429346; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=HWNck64Rdzbsq9/3XcWJpVmBPzEh5+xH4mb3RyYLiec=; b=XneFXCzYYmHO9DWpYoQRLPRwO3BdkWt6toJuWsf/UlhcOpyAJKrGHi+vqk7dSPNJPmSXjt8xPwsMxtmaImLKwO+dhfsNYtQAxRjU9n/FsjA1gqnc5B1UsebvSJaH1adYtABFn4kEdvucMux7UFE/qcr/dtPKBeUYYd+yjfhPy7Y= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1689429346479837.4845949342183; Sat, 15 Jul 2023 06:55:46 -0700 (PDT) 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) 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) 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-Google-Smtp-Source: APBJJlFSAr2Jbg783bkhwFTchGzNT7qyRxN7lO+xs1hXn/CkfWM61gVz9fl8SuKWM9+qMfn0IRVCVA== 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) 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 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1689429348180100002 Content-Type: text/plain; charset="utf-8" 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 @@ =20 #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 =20 --=20 2.34.1 From nobody Mon May 20 16:07:49 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1689429342; cv=none; d=zohomail.com; s=zohoarc; b=j7adU+p0eNEknWsq23fEA4JPEhkLFGn+bppLanKMk3lmVu7bfTTG5rcjCxo30h4NhVzoPGZ7Q5DXbyQ1oyNBc9zcl/N8+FiF3n7X9oI6bFfan+Rp0XX/VCUmnU5m6QR2YKKq2t365LLblr/a4bBTVvMrxn1s+X1zIHG7UduIKhI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689429342; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=WkQYBTdmbAtTnWW2W9s3BK95MSziKUcKtiWY2RX73t0=; b=FkSopRnQRSzT3MrJlNQbx54Y+oA02IT6RBZEGNdbdsW1hYS+Ks89sNis7HDTFVTY6w2RWLESMKqsyw+HfnHZ6m1LjbHxCmDxWqD67kFwUZvyhzSsu40yF78YSHY/ju6OPhq9aCINIR12RRS9VETWRDW/gv9sFoujFOoiEsLv43Y= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1689429341992653.7877543027755; Sat, 15 Jul 2023 06:55:41 -0700 (PDT) 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) 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) 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-Google-Smtp-Source: APBJJlEt1xGF9soNsuuH/EiAMLfEA/8PMzdoYLjrJt7UJZILjdxOJnWU8G5ckhsVVkzXgh5zQIE1JA== 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) 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 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1689429343818100003 Content-Type: text/plain; charset="utf-8" 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; } =20 -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 d= irfd, goto execve_efault; } =20 + const char *exe =3D p; if (is_proc_myself(p, "exe")) { - ret =3D get_errno(safe_execveat(dirfd, exec_path, argp, envp, flag= s)); - } else { - ret =3D get_errno(safe_execveat(dirfd, p, argp, envp, flags)); + exe =3D exec_path; } + ret =3D is_execveat + ? safe_execveat(dirfd, exe, argp, envp, flags) + : safe_execve(exe, argp, envp); + ret =3D get_errno(ret); =20 unlock_user(p, pathname, 0); =20 @@ -9406,9 +9410,9 @@ static abi_long do_syscall1(CPUArchState *cpu_env, in= t 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 =3D lock_user_string(arg1))) return -TARGET_EFAULT; --=20 2.34.1 From nobody Mon May 20 16:07:49 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1689429407; cv=none; d=zohomail.com; s=zohoarc; b=UuarGEZg6BeQ15HOH23BUEiM43aGt5xefzKQqgxZldewnHD/LgUIn08GAu27rg+Ea8DsWrer9mMw2cBsoBIctvAV0MAv98hWOxVmbWu7m6LgUZjJzE5qdoqgo6jNCp5zit6hOo6Fnxte0dXGEKn0BhhU6T2Eep12KdG7U3u+Zgg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689429407; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Lr74WqM5fLrf+RSkbW96g9irEI/4kt9CeJO9GueF4Ho=; b=PVM3ND2bA1eTBiGPVB/bcio4GnaQevebMzPpFpCEHHAF4Uw4As4UBCXlOFqsSDSYVaRIf7Bx2wcRXvx72CBQvKM1a28y1VchH3ayqpxsQuMeGfwutsOMt0cMBTXjW8hRprXpdUzMWQbsjYHfom5Q6Bl9Cy7Zt3NAzXtpMrQazC8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1689429407439654.7783938280514; Sat, 15 Jul 2023 06:56:47 -0700 (PDT) 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) 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) 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-Google-Smtp-Source: APBJJlG5FOsOZSzkS2B+ejEe8Db5eUc4muDJUwGi20lpFVsVfVbL+fn5OmzQGdx7M305FbPUgg7+Gw== 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) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1689429408414100001 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=C3=A9 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 =20 -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 =3D 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; =20 /* shmat pointers are always untagged */ @@ -4602,9 +4602,9 @@ static inline abi_ulong do_shmat(CPUArchState *cpu_en= v, =20 if (host_raddr =3D=3D (void *)-1) { mmap_unlock(); - return get_errno((long)host_raddr); + return get_errno((intptr_t)host_raddr); } - raddr=3Dh2g((unsigned long)host_raddr); + raddr =3D h2g((uintptr_t)host_raddr); =20 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_en= v, =20 mmap_unlock(); return raddr; - } =20 static inline abi_long do_shmdt(abi_ulong shmaddr) --=20 2.34.1 From nobody Mon May 20 16:07:49 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1689429422; cv=none; d=zohomail.com; s=zohoarc; b=Mx3z8mXK0eFaTJ7iVW0Nmu7S/kW5EephwdMDhJq84a6vP/uoFxq7baOJgn4TQUVluIyN3FxsGXoAxJhWmtod7f8NHjMfF6RBG1TjuUShJNB4ajo3GAOoyZX6RGZghrUGyQ2SG4pEMDl7yfwh9bJ6wGeUCFXmvmWKlbmRYVAw+ZA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689429422; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=KPSt9c/ngpAMvKxksu2NUPKStpNSLJ8TjY6ZtwR8h/Q=; b=VXtUGtBN32miD5eaU9E6ZVD12ua4qG+yEK483OsH/GmAMPUKsj0ikr49uZV5F9Nt/uQqyLL1w8ym5W8ez+NB9ZJEWYAIyF0HGpMNGQLZc1Y5J0O59AuhSe0DiivGoprlg1psSiZ/ypRWeMKxKotI0SosoTSwxF/Pk7c70EK1Blk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1689429422002830.2223990345004; Sat, 15 Jul 2023 06:57:02 -0700 (PDT) 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) 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) 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-Google-Smtp-Source: APBJJlHPfAtmLxUgRx1KXnllskaahA2u0E42lJ/RIEITz3uNqBVXJ2zdLGlwgg0nSi3ev8YjNn+2Vg== 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) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Philippe=20Mathieu-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1689429422912100003 Share the setjmp cleanup between cpu_exec_step_atomic and cpu_exec_setjmp. Reviewed-by: Alex Benn=C3=A9e Reviewed-by: Philippe Mathieu-Daud=C3=A9 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) } } =20 +static void cpu_exec_longjmp_cleanup(CPUState *cpu) +{ + /* Non-buggy compilers preserve this; assert the correct value. */ + g_assert(cpu =3D=3D 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 =3D 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); } =20 /* @@ -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) !=3D 0)) { - /* Non-buggy compilers preserve this; assert the correct value. */ - g_assert(cpu =3D=3D 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); } =20 return cpu_exec_loop(cpu, sc); --=20 2.34.1 From nobody Mon May 20 16:07:49 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1689429410; cv=none; d=zohomail.com; s=zohoarc; b=OPTKqWylVaAIQezGa+c/oSM1jDKSOEDGn+ztx5Px4CCGo3b9pXpH8/KGG//JpVIbflBAMN/lk7vywcVHDyguVHw+oNSGw+gc635mEfF5aYVji0KJtTtUT0jDSWClxwjyIuEjqpti981SyYuYu+yXB1SbAEsrbKIGqvk+xEhj9uY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689429410; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=jzyDMcbYQjI8gvZN9VCzZxgmLv/k9AezEb13MRPeL3k=; b=L6me1ZSOFcFwGRHeIRe9jTtMikzu4YiHRj8g3M1rXlnuVaee+5w15lYtGFKp85rzVoptkzhVqF87e44PJdAGigj5N+bneFH4uKyT8NCt7vUij5Q4nZztpGC54EctZt8AmopXUm5534o9ZLOyAaro/4GA70MVZeP7NUjpeikw8L0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1689429410361323.3720894394269; Sat, 15 Jul 2023 06:56:50 -0700 (PDT) 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) 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) 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-Google-Smtp-Source: APBJJlECIOfqfGfLSSA4iIohKKxR3C205RYMCiFOtP2LchuSopAZKWyuAJlXXCYA3k3DWIecFGDRTQ== 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) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-stable@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1689429412503100002 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=C3=A9 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 =3D cum->ref_slot + i, }; } - cum->info_in_idx +=3D n; + cum->info_in_idx +=3D n - 1; /* i=3D0 accounted for in layout_arg_1 */ cum->ref_slot +=3D n; } =20 --=20 2.34.1 From nobody Mon May 20 16:07:49 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1689429358; cv=none; d=zohomail.com; s=zohoarc; b=nQOhTJFPRDXZ+gvz/NIlRzE4kcuXr8Sl6bSvTqibpdbMlxpkcBzS2DwAj2dJW4ccXQqYM/cmluMudoHGHni5tALIhv5zSCp8OBpPMrvXfvakn6OxCf09KVaIyY7iHDMX1p8jUAVxJBL50NGDe3R+uZ1IMLOayUk7ZljX4D9AMJM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689429358; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=GYIDC6C9sVxFY0DlBpogq7e8qtq1Fq4gc1frrPqq0IQ=; b=lshFGs0Tguiwku8CMW9wEkX399olGapPlI18rS6EsrYRti5jULhb9CDWAN1T/cKFK9ktKQHvFO7i1A4Cn+5L2Ipdhd2xvAU6cy+tTNBrveubvPe5BWb3xV3FqezYL/XJUMyQ+1unFfyOTfqn6mgGFDxwQ3iqxo88hupmlPo9k5U= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 168942935829071.2946573127748; Sat, 15 Jul 2023 06:55:58 -0700 (PDT) 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) 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) 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-Google-Smtp-Source: APBJJlEi01WudE9tNs+kjNB7ANaBpj1TOXXQOxxUJ/ctF2+XASN+GCVhgAEBfUxGARuY6AgH/PuZzQ== 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) 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 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1689429358531100001 Content-Type: text/plain; charset="utf-8" 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; =20 void target_set_brk(abi_ulong new_brk) { - target_brk =3D new_brk; + target_brk =3D TARGET_PAGE_ALIGN(new_brk); brk_page =3D HOST_PAGE_ALIGN(target_brk); } =20 --=20 2.34.1 From nobody Mon May 20 16:07:49 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1689429380; cv=none; d=zohomail.com; s=zohoarc; b=MD/PsOGL5rl2c2wQNUpkVmOxJRDLd6guhSukh7bHLi4CcfWjYVU4K0UV9+Bcsx73YK0/GVI7IYdoDUFoMS+YyBrGeGOn/NMKu4dlKlJZQoHmxZLMJJ8RcT3dbpyD8HnmkdWe8WqA2WIK6Q7u37cl9hTIuNEf1hWvYLvMr0lxglE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689429380; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=2MU6soREEIeWjjQLlmK8RHmCnAP0c3qo3FFfRalqkkk=; b=KJk95cyCuNCLs0fKKKWZqrLpIr3v1LQDZAZQeoRF49Etfq5U5cjwHhWyVKjuwW5V6mv8suiXtfQPxRaQ8sUIeaV1gJgk4Ib+fvi9G6sMUKdZ+jDUhfCYCCXN6+zUu8M+bhLMXaSFdazEj9wUYbozkEV+xBY9mTjdQ2JPkoLJUOE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1689429380600948.7894771487581; Sat, 15 Jul 2023 06:56:20 -0700 (PDT) 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) 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) 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-Google-Smtp-Source: APBJJlErrT4YP9L89rAFJxtYFbvYWRtJcV1Xp1oJOYtFukyLB/KNHJibM7szv9p0+ty2rSwhe6VOKw== 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) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Philippe=20Mathieu-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1689429382317100001 Fix all checkpatch.pl errors within mmap.c. Reviewed-by: Alex Benn=C3=A9e Reviewed-by: Philippe Mathieu-Daud=C3=A9 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) =20 void mmap_fork_end(int child) { - if (child) + if (child) { pthread_mutex_init(&mmap_mutex, NULL); - else + } else { pthread_mutex_unlock(&mmap_mutex); + } } =20 /* @@ -203,40 +204,47 @@ static int mmap_frag(abi_ulong real_start, =20 /* get the protection of the target pages outside the mapping */ prot1 =3D 0; - for(addr =3D real_start; addr < real_end; addr++) { - if (addr < start || addr >=3D end) + for (addr =3D real_start; addr < real_end; addr++) { + if (addr < start || addr >=3D end) { prot1 |=3D page_get_flags(addr); + } } =20 if (prot1 =3D=3D 0) { /* no page was there, so we allocate one */ void *p =3D mmap(host_start, qemu_host_page_size, prot, flags | MAP_ANONYMOUS, -1, 0); - if (p =3D=3D MAP_FAILED) + if (p =3D=3D MAP_FAILED) { return -1; + } prot1 =3D prot; } prot1 &=3D PAGE_BITS; =20 prot_new =3D 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) =3D=3D 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) =3D=3D MAP_SHARED && (prot & PROT_WRITE)) { return -1; + } =20 /* 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); + } =20 /* read the corresponding file data */ - if (pread(fd, g2h_untagged(start), end - start, offset) =3D=3D -1) + if (pread(fd, g2h_untagged(start), end - start, offset) =3D=3D -1)= { return -1; + } =20 /* put final protection */ - if (prot_new !=3D (prot1 | PROT_WRITE)) + if (prot_new !=3D (prot1 | PROT_WRITE)) { mprotect(host_start, qemu_host_page_size, prot_new); + } } else { if (prot_new !=3D prot1) { mprotect(host_start, qemu_host_page_size, prot_new); @@ -265,8 +273,10 @@ abi_ulong mmap_next_start =3D TASK_UNMAPPED_BASE; =20 unsigned long last_brk; =20 -/* 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 si= ze, abi_ulong align) * - shmat() with SHM_REMAP flag */ ptr =3D mmap(g2h_untagged(addr), size, PROT_NONE, - MAP_ANONYMOUS|MAP_PRIVATE|MAP_NORESERVE, -1, 0); + MAP_ANONYMOUS | MAP_PRIVATE | MAP_NORESERVE, -1, 0); =20 /* ENOMEM, if host address space has no memory */ if (ptr =3D=3D MAP_FAILED) { return (abi_ulong)-1; } =20 - /* 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 =3D (ptr =3D=3D prev ? repeat + 1 : 0); =20 if (h2g_valid(ptr + size - 1)) { @@ -387,14 +399,18 @@ abi_ulong mmap_find_vma(abi_ulong start, abi_ulong si= ze, 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 =3D 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 &=3D -align; break; case 2: @@ -407,8 +423,10 @@ abi_ulong mmap_find_vma(abi_ulong start, abi_ulong siz= e, 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 =3D (repeat ? -1 : 0); } =20 @@ -423,8 +441,10 @@ abi_ulong mmap_find_vma(abi_ulong start, abi_ulong siz= e, abi_ulong align) return (abi_ulong)-1; } wrapped =3D 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 =3D (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, i= nt target_prot, real_start =3D start & qemu_host_page_mask; host_offset =3D offset & qemu_host_page_mask; =20 - /* 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 =3D len + offset - host_offset; host_len =3D HOST_PAGE_ALIGN(host_len); @@ -497,32 +519,36 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, = int target_prot, } } =20 - /* When mapping files into a memory area larger than the file, accesses - to pages beyond the file size will cause a SIGBUS.=20 - - 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. =20 - - 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; =20 - if (fstat (fd, &sb) =3D=3D -1) - goto fail; + if (fstat(fd, &sb) =3D=3D -1) { + goto fail; + } =20 - /* 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=20 - the hosts real pagesize. Additional anonymous maps - will be created beyond EOF. */ - len =3D 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 =3D REAL_HOST_PAGE_ALIGN(sb.st_size - offset); + } } =20 if (!(flags & MAP_FIXED)) { @@ -532,9 +558,11 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, i= nt target_prot, host_len =3D len + offset - host_offset; host_len =3D HOST_PAGE_ALIGN(host_len); =20 - /* 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 =3D mmap(g2h_untagged(start), host_len, host_prot, flags | MAP_FIXED | MAP_ANONYMOUS, -1, 0); if (p =3D=3D MAP_FAILED) { @@ -572,45 +600,52 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, = int target_prot, goto fail; } =20 - /* 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) !=3D (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) =3D=3D 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) =3D=3D MAP_SHARED && (host_prot & PROT_= WRITE)) { errno =3D EINVAL; goto fail; } retaddr =3D target_mmap(start, len, target_prot | PROT_WRITE, MAP_FIXED | MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); - if (retaddr =3D=3D -1) + if (retaddr =3D=3D -1) { goto fail; - if (pread(fd, g2h_untagged(start), len, offset) =3D=3D -1) + } + if (pread(fd, g2h_untagged(start), len, offset) =3D=3D -1) { goto fail; + } if (!(host_prot & PROT_WRITE)) { ret =3D target_mprotect(start, len, target_prot); assert(ret =3D=3D 0); } goto the_end; } - =20 + /* handle the start of the mapping */ if (start > real_start) { if (real_end =3D=3D real_start + qemu_host_page_size) { /* one single host page */ ret =3D mmap_frag(real_start, start, end, host_prot, flags, fd, offset); - if (ret =3D=3D -1) + if (ret =3D=3D -1) { goto fail; + } goto the_end1; } ret =3D mmap_frag(real_start, start, real_start + qemu_host_pa= ge_size, host_prot, flags, fd, offset); - if (ret =3D=3D -1) + if (ret =3D=3D -1) { goto fail; + } real_start +=3D qemu_host_page_size; } /* handle the end of the mapping */ @@ -619,8 +654,9 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, in= t target_prot, real_end - qemu_host_page_size, end, host_prot, flags, fd, offset + real_end - qemu_host_page_size - star= t); - if (ret =3D=3D -1) + if (ret =3D=3D -1) { goto fail; + } real_end -=3D qemu_host_page_size; } =20 @@ -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 =3D 0; - else + } else { offset1 =3D offset + real_start - start; + } p =3D mmap(g2h_untagged(real_start), real_end - real_start, host_prot, flags, fd, offset1); - if (p =3D=3D MAP_FAILED) + if (p =3D=3D MAP_FAILED) { goto fail; + } passthrough_start =3D real_start; passthrough_end =3D real_end; } @@ -697,16 +735,18 @@ static void mmap_reserve(abi_ulong start, abi_ulong s= ize) } end =3D real_end; } - if (prot !=3D 0) + if (prot !=3D 0) { real_start +=3D qemu_host_page_size; + } } if (end < real_end) { prot =3D 0; for (addr =3D end; addr < real_end; addr +=3D TARGET_PAGE_SIZE) { prot |=3D page_get_flags(addr); } - if (prot !=3D 0) + if (prot !=3D 0) { real_end -=3D qemu_host_page_size; + } } if (real_start !=3D 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) =20 trace_target_munmap(start, len); =20 - if (start & ~TARGET_PAGE_MASK) + if (start & ~TARGET_PAGE_MASK) { return -TARGET_EINVAL; + } len =3D TARGET_PAGE_ALIGN(len); if (len =3D=3D 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 =3D 0; - for(addr =3D real_start; addr < start; addr +=3D TARGET_PAGE_SIZE)= { + for (addr =3D real_start; addr < start; addr +=3D TARGET_PAGE_SIZE= ) { prot |=3D page_get_flags(addr); } if (real_end =3D=3D real_start + qemu_host_page_size) { - for(addr =3D end; addr < real_end; addr +=3D TARGET_PAGE_SIZE)= { + for (addr =3D end; addr < real_end; addr +=3D TARGET_PAGE_SIZE= ) { prot |=3D page_get_flags(addr); } end =3D real_end; } - if (prot !=3D 0) + if (prot !=3D 0) { real_start +=3D qemu_host_page_size; + } } if (end < real_end) { prot =3D 0; - for(addr =3D end; addr < real_end; addr +=3D TARGET_PAGE_SIZE) { + for (addr =3D end; addr < real_end; addr +=3D TARGET_PAGE_SIZE) { prot |=3D page_get_flags(addr); } - if (prot !=3D 0) + if (prot !=3D 0) { real_end -=3D qemu_host_page_size; + } } =20 ret =3D 0; @@ -798,8 +841,10 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong o= ld_size, flags, g2h_untagged(new_addr)); =20 if (reserved_va && host_addr !=3D 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) { --=20 2.34.1 From nobody Mon May 20 16:07:49 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1689429268; cv=none; d=zohomail.com; s=zohoarc; b=cz1dUdwK/r+EreBTBpOmGYtjfHRTa+hAuBkgSH29GqR01pJoOyqlU26W/ZE1NFnGAWdjHtDqLwcXUvZ4MdoGfB0xDeNHxoxe0IORyj6VnsfXky7q0byyrJXJwfJw3wHGTPkQGLNV/9hHPz3iPda6BSnWxOtFjm2GYlsC2mOZvys= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689429268; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=0PrN0L5Atjyx6hFnGJcyTHnWGq2syM21Wu73egPOuXw=; b=Zg0GfYFxsvAcXpQ1mTikG3C+gBbIQINXpBIig3AIAHBDu51oRz24RE7CAJ9/3GfOxFdFJbUamxtg7IdNqBwk9U7qLJizOKn0+eaF9UySiStX9Htg5YqmGw3IL2qvTSxKdm27LC1l33ElgDY6qKQh5NFfkHQO7HUi8xkyE2r9z80= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1689429268799223.43062557136273; Sat, 15 Jul 2023 06:54:28 -0700 (PDT) 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) 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) 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-Google-Smtp-Source: APBJJlEr7a8J/IK7ZP8tzKKS76I+JLVKcZ7xlaWT0rmnSD0V+w5kU6h/ooli1NKTGjVtnhf5rLqpOA== 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) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Alex=20Benn=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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1689429269878100003 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=C3=A9e 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 */ }; =20 +/* 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 } =20 /* Structure used to translate enumerated values into strings */ struct enums { @@ -963,7 +969,7 @@ print_syscall_ret_ioctl(CPUArchState *cpu_env, const st= ruct syscallname *name, #endif =20 UNUSED static const struct flags access_flags[] =3D { - 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[] =3D { }; =20 UNUSED static const struct flags open_access_flags[] =3D { - 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, }; =20 @@ -1010,7 +1016,9 @@ UNUSED static const struct flags open_flags[] =3D { FLAG_TARGET(O_CREAT), FLAG_TARGET(O_DIRECTORY), FLAG_TARGET(O_EXCL), +#if TARGET_O_LARGEFILE !=3D 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[] =3D { }; =20 UNUSED static const struct flags mmap_prot_flags[] =3D { - 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[] =3D { #ifdef MAP_POPULATE FLAG_TARGET(MAP_POPULATE), #endif -#ifdef TARGET_MAP_UNINITIALIZED +#if defined(TARGET_MAP_UNINITIALIZED) && TARGET_MAP_UNINITIALIZED !=3D 0 FLAG_TARGET(MAP_UNINITIALIZED), #endif FLAG_TARGET(MAP_HUGETLB), @@ -1201,13 +1209,13 @@ UNUSED static const struct flags statx_flags[] =3D { 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 =3D ""; int n; =20 - if ((flags =3D=3D 0) && (f->f_value =3D=3D 0)) { - qemu_log("%s%s", f->f_string, get_comma(last)); - return; - } for (n =3D 0; f->f_string !=3D NULL; f++) { - if ((f->f_value !=3D 0) && ((flags & f->f_value) =3D=3D f->f_value= )) { + if ((flags & f->f_mask) =3D=3D f->f_value) { qemu_log("%s%s", sep, f->f_string); - flags &=3D ~f->f_value; + flags &=3D ~f->f_mask; sep =3D "|"; n++; } --=20 2.34.1 From nobody Mon May 20 16:07:49 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1689429317; cv=none; d=zohomail.com; s=zohoarc; b=IxxR0RuBIf7b+2lHoNfw7x0aarlkOkIXX0apMxiWWBCBIcCvTbfGruh2WkUb67Cwf4vwUFiyXtqpy3zjeVkJDb863DwFDUdeiFjxbVgbmA4E805Sar9hCBsp3sytfbJisvNvsyneETUowTjtoY+dOMX6w6wPCruze7Og0ADQ5XQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689429317; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=v53BpocOSkZq13xiAuKy1Z69SsuVPyzPYM9KNeUZOtU=; b=ic7WZJmVBqsgLUrAV9Wax4MsjAYAaDshEphFte8c7WIAckgGYiSuAn6ju3qTReQsbe1ipvOxuYFFBPvqJi+jNIuxslhOd8hDOjfguquSvN7VRFIBzE5MEdki6x+zfHvk6ml6RBGaFZTGhyPWIoXyfQjCfUsutu3vOUKhuimya3s= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1689429317675772.9345904654274; Sat, 15 Jul 2023 06:55:17 -0700 (PDT) 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) 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) 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-Google-Smtp-Source: APBJJlEiQncf1N2ehbLCFPIQQLvnCQZF8jZ/rJCl6T58OS+lGhw+hGfe+F64ZBL4KtVzB1UreN/IIQ== 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) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Alex=20Benn=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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1689429318179100002 Move the values into the per-target target_mman.h headers Reviewed-by: Alex Benn=C3=A9e 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 =20 +#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 =20 #define TARGET_MS_ASYNC 1 diff --git a/linux-user/generic/target_mman.h b/linux-user/generic/target_m= man.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 =20 +/* 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 =20 +#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_mma= n.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 =20 -/* 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 mappin= g */ -#else -#define TARGET_MAP_TYPE 0x0f /* Mask for type of mappin= g */ -#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 executabl= e */ -#define TARGET_MAP_LOCKED 0x8000 /* pages are locked */ -#define TARGET_MAP_NORESERVE 0x0400 /* don't check for reserva= tions */ -#define TARGET_MAP_POPULATE 0x10000 /* populate (prefault) pag= etables */ -#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 mapp= ing */ -#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 executabl= e */ -#define TARGET_MAP_LOCKED 0x0080 /* pages are locked */ -#define TARGET_MAP_NORESERVE 0x0040 /* don't check for reserva= tions */ -#define TARGET_MAP_POPULATE 0x8000 /* populate (prefault) pag= etables */ -#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 mapp= ing */ -#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 executabl= e */ -#define TARGET_MAP_LOCKED 0x08000 /* lock the mapping */ -#define TARGET_MAP_NORESERVE 0x10000 /* no check for reservatio= ns */ -#define TARGET_MAP_POPULATE 0x20000 /* pop (prefault) pagetabl= es */ -#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 mapp= ing */ -#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 executabl= e */ -#define TARGET_MAP_LOCKED 0x02000 /* lock the mapping */ -#define TARGET_MAP_NORESERVE 0x04000 /* no check for reservatio= ns */ -#define TARGET_MAP_POPULATE 0x10000 /* pop (prefault) pagetabl= es */ -#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 mapp= ing */ -#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 executabl= e */ -#define TARGET_MAP_LOCKED 0x8000 /* pages are locked */ -#define TARGET_MAP_NORESERVE 0x0400 /* don't check for reserva= tions */ -#define TARGET_MAP_POPULATE 0x10000 /* populate (prefault) pag= etables */ -#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 executabl= e */ -#define TARGET_MAP_LOCKED 0x2000 /* pages are locked */ -#define TARGET_MAP_NORESERVE 0x4000 /* don't check for reserva= tions */ -#define TARGET_MAP_POPULATE 0x8000 /* populate (prefault) pag= etables */ -#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 mapp= ing */ -#define TARGET_MAP_UNINITIALIZED 0x4000000 /* for anonymous mmap, mem= ory could be uninitialized */ -#endif +#include "target_mman.h" =20 #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_mma= n.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 --=20 2.34.1 From nobody Mon May 20 16:07:49 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1689429800; cv=none; d=zohomail.com; s=zohoarc; b=P30r5UxSxNQ+OsDKoUCkACpxuhtu0J9n01xcoC1bD1Ojj1D+Tya/aav0hQ8PwPIDXENK7j1BmUBcbUGvXXlsNsK+wo1QuOJqqJ0ZAknTnRj9RmdWusnTN7tSwc58CD/DPbVeu++xzHE7RMMmjG20BPs0SahU+oZTVaBBX1zaz6c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689429800; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=7XT7/zvTpZMeqxSdbndcDLpIQTRXhkVJ5EOXRYsTIYQ=; b=jbrEFY3a/bHBBqB49+5V4NHUabqDiViKpoaIJS6pBYptvFT9mYcDG1ujIi0wfI3lwCztTHuBCC/MthQBvSk8gC87tkVba98Z+LEVUEJayfhOSdUPbkikoWr4GBbhRFjzRKm/Ga/HHK1zbI96nwbVXlWaPEi/UjjrRIkiuHXOf+w= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1689429800491842.6442451506666; Sat, 15 Jul 2023 07:03:20 -0700 (PDT) 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) 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) 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-Google-Smtp-Source: APBJJlEh+YAcgXCDrtePIrcwq7d0MMRvOO5OUiRbtunUuXiG39r9YqeadZIE9l2EJhEBn1ZsJQLb4Q== 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) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Philippe=20Mathieu-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1689429800898100001 Move the values into the per-target target_mman.h headers Reviewed-by: Alex Benn=C3=A9e Reviewed-by: Philippe Mathieu-Daud=C3=A9 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_m= man.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_m= man.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 =20 -/* 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 =20 +#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 { =20 #include "termbits.h" =20 -#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" =20 #if (defined(TARGET_I386) && defined(TARGET_ABI32)) \ diff --git a/linux-user/xtensa/target_mman.h b/linux-user/xtensa/target_mma= n.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 =20 +#define TARGET_PROT_SEM 0x10 + #define TARGET_MAP_NORESERVE 0x0400 #define TARGET_MAP_ANONYMOUS 0x0800 #define TARGET_MAP_GROWSDOWN 0x1000 --=20 2.34.1 From nobody Mon May 20 16:07:49 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1689429285; cv=none; d=zohomail.com; s=zohoarc; b=QkWvndxWUuwMWYoMGwoM85owfhC6ReGCu5Wf6acvUc0Ot7pnHoAkziG7MibtYspYrflmCBplwL6G0HZPbPy8LhmYzwXW33JvC314Ix/xTyaq4auTRYx6n6FXlC9phfK3YPQb2axU0EPfa4vjHXYdE4AhCh3AVM1TGQOCdfrC1jE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689429285; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=4EchJl5hjgKZgeWYuYg1q+jxNR3MablBrvDvJkqZmCU=; b=By42KbiON4FgcPZGieaOVJu3/uFzNgOFq6IoAR8EeokXjJbjacZLLJATse64n4sU074mLglQdS4MluPOKoMClg1I16DnRfORne3bVZYxyO0RDKtL1v236Hy4ltuUvqfPTXTXJ1HuXF1Lsyd6tYuD8EqDLILr6R3wMjRPWAdZGF4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1689429285579736.9800448794654; Sat, 15 Jul 2023 06:54:45 -0700 (PDT) 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) 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) 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-Google-Smtp-Source: APBJJlHTcm+vm/IvK7TCIwERWmnXfXvAYLhzbie20HUteHf+IyFimDi5SF2alttYkp5wlDqQpFGqlw== 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) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Alex=20Benn=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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1689429286022100002 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=C3=A9e 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[] = =3D { }; =20 UNUSED static const struct flags mmap_flags[] =3D { - 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 !=3D 0 + FLAG_TARGET(MAP_STACK), + FLAG_TARGET(MAP_SYNC), +#if TARGET_MAP_UNINITIALIZED !=3D 0 FLAG_TARGET(MAP_UNINITIALIZED), #endif - FLAG_TARGET(MAP_HUGETLB), - FLAG_TARGET(MAP_STACK), FLAG_END, }; =20 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 =3D { .print =3D print_termios, }; =20 +/* 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[] =3D { - { 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[] =3D { 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 } }; =20 --=20 2.34.1 From nobody Mon May 20 16:07:49 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1689429607; cv=none; d=zohomail.com; s=zohoarc; b=mHDAsIUa8/WkEelns/mFQZ0HBFocVqK6uQok8F4hhUdokDkOx6Ooc4sSlqf+Umfw2wuu//egcHnhSj0NXMp1LkZTZ/TvJMdtgCS58FokJ+Q9jCWukWzr22Pr3TIlkTIhiVu92SD4X7vZet8G6u7wOFzVMtM63j1a+gTjZ7s50DU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689429607; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=viFchcHGsP+nKMHrpwcA4jNmykwjrSvjDrmv/nDVIvw=; b=SxRzmmIZfvywaWvLo5xBiUhwnchrde66a2EOaZhRZRNwnVJqNXFXoLUZUNRhlZNb0VZgTJjzXywiB8eByMm3YA11/2zxHUA/5TuyhGbgGtY5nwwhTHUiASoHJbLZYHxwR3YYa5D8nCwBy6C2Ksdx9HRPKzcFg5az9M2+JL2qLPg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1689429607209325.79962875445005; Sat, 15 Jul 2023 07:00:07 -0700 (PDT) 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) 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) 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-Google-Smtp-Source: APBJJlEtlD66+UJnk1/e99zleawxN6EJ1OnDFoaA/HmgIR5aX/TxXo3XdC8Mi3+YPttOGCWggnUJIA== 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) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Alex=20Benn=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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1689429609500100011 Examine the interval tree to validate that a region has no existing mappings. Reviewed-by: Alex Benn=C3=A9e 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 l= ast, 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); =20 +/** + * 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; } =20 +bool page_check_range_empty(target_ulong start, target_ulong last) +{ + assert(last >=3D start); + assert_memory_lock(); + return pageflags_find(start, last) =3D=3D NULL; +} + void page_protect(tb_page_addr_t address) { PageFlagsNode *p; --=20 2.34.1 From nobody Mon May 20 16:07:49 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1689429331; cv=none; d=zohomail.com; s=zohoarc; b=lwU4Cgkp87+CGnIyG4gQoQ3HJtxzgGlox7G64EAsz5I0QD900lL66/5jjkGLdV4JwOCWbfAuRM0+Ek0nKxFWhCILq+2FEVtjxAlMNxMhnpSM513R25DXC4JwzQvpkQU9pTwmxr+O1IA9hqjE9Z28cr8vWW+i1vUCR8YsxkdjPo4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689429331; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ZraICE1rSSuyJwFU+r8vOCOFS1v3NI7u5DpDqpVSLj4=; b=eY1KUMGl257UgZiuN/Gjbw+Ls6eY2t1NW/bPXyguaceQFf1WYRQocxcnaViDsNku35uqVdgHt6JHkMIg7NdX3XnmATUYANsEbSXujNmq2ac1o386iU10skuYuYe5Fl3mzgFEGJT/rMdtN910giHhmj2agLrazZCZ+C14ojE1yjA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1689429331782541.2024809240303; Sat, 15 Jul 2023 06:55:31 -0700 (PDT) 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) 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) 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-Google-Smtp-Source: APBJJlGBOjmPIoPOF7PolnDREFTMqnFdMNLEcCKlgf8NNd8CoSnT2/9TzzZEzyw5QrIYGd6lrTtZow== 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) 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 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1689429333703100007 Content-Type: text/plain; charset="utf-8" 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, in= t prot, } =20 /* 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 =3D EINVAL; goto fail; } --=20 2.34.1 From nobody Mon May 20 16:07:49 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1689429607; cv=none; d=zohomail.com; s=zohoarc; b=SoRzJ1QgpJkGrd2g8nTGTV++pYDaxyD88erMOYl58u8zVlrp2I8lhM96tcChtpgOXfKcl0qbei3Jd/kGymaKtgfWJkSyUN+NWLoHE36cZAdrEHn3mEM5FjOnVvuPMkiaJNKq2WkRSmCoFqDTcXGsjK6Mz46isd2t2uLx+xQBqKY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689429607; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=QVp7bvOVNX9kOQlZjcnMWNBhc4o39/6I/4Tb+lJViFc=; b=UCeyAoaahBSOVEVJT6iAldwV4Srtz6/5sWGyCPO4XooAz28vYFljPjw5FFby32rn/7cZaeUCZxEy/anRvRKrdgplERTQZzfpTYFMtFsKVcROHCrKgKzZvrtXNpQNTAygwCkEjjBOMvDkGoNr3lMOVbhRwd2Pw9x05lfnehwNPZ4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1689429607253483.7718227609229; Sat, 15 Jul 2023 07:00:07 -0700 (PDT) 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) 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) 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-Google-Smtp-Source: APBJJlGSCr2CCquuP7eEWPGNXinkfP4tEbeVzXIWvV/6oMRj5XXHXa0DGhc7Ti3fhAJfQziAMVaAhQ== 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) 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 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1689429609103100007 Content-Type: text/plain; charset="utf-8" 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, in= t 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 =3D len + offset - host_offset; host_len =3D HOST_PAGE_ALIGN(host_len); start =3D mmap_find_vma(real_start, host_len, TARGET_PAGE_SIZE); @@ -551,7 +551,7 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, in= t target_prot, } } =20 - if (!(flags & MAP_FIXED)) { + if (!(flags & (MAP_FIXED | MAP_FIXED_NOREPLACE))) { unsigned long host_start; void *p; =20 @@ -600,6 +600,13 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, i= nt target_prot, goto fail; } =20 + /* Validate that the chosen range is empty. */ + if ((flags & MAP_FIXED_NOREPLACE) + && !page_check_range_empty(start, end - 1)) { + errno =3D 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, in= t target_prot, goto fail; } retaddr =3D target_mmap(start, len, target_prot | PROT_WRITE, - MAP_FIXED | MAP_PRIVATE | MAP_ANONYMOUS, + (flags & (MAP_FIXED | MAP_FIXED_NOREPLAC= E)) + | MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); if (retaddr =3D=3D -1) { goto fail; --=20 2.34.1 From nobody Mon May 20 16:07:49 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1689429254; cv=none; d=zohomail.com; s=zohoarc; b=K57B9d27j4Eq9JInubQo8yzdncn0ZgkBf+BmaB/HONNxFAK4nwhKGhqLQa/GHmBGpC8K+m5hXxJoOnoSSRmRBCTSxUEXc7/EDIlzxwRHchYDFcmxKlIzITmKvVyQkPZ0rKz1HghGJsJh4KPQbD39ipbIHio9yRRjda7/Fb1/QJA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689429254; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=7S8fJjWsfM8/RKnCcasDShb0DLhg94fNTjj77rs37DE=; b=G+vC+LsWpx527ntnHTh6lUWiWzVrVfCAdydeNAUnNR5p4tG3ymoDdQTS6eHyn2fj3yEJKgvH2H4RstHVMdWVXyz9qK0EGHoORpLX/YNzwdLLn/qlXYd/56UfETmqO8kNMvYlsa6yQD+91BOi6fUkNdeALvcwHtw6OvUWse0TnC4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 168942925446011.381357929703313; Sat, 15 Jul 2023 06:54:14 -0700 (PDT) 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) 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) 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-Google-Smtp-Source: APBJJlGymt+cLcWAWmPBr8mbWcebG05LqEUoSvWwDtSKyiMnZt6QdI9Tj7qSlWgKAnvdrUJnzl81Gw== 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) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Alex=20Benn=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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1689429255948100003 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=C3=A9e 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 =3D PROT_READ | PROT_WRITE | PROT_EXEC | TARGET_PROT_SEM; int page_flags =3D (prot & PAGE_BITS) | PAGE_VALID; =20 - /* - * 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 =3D (prot & (PROT_READ | PROT_WRITE)) - | (prot & PROT_EXEC ? PROT_READ : 0); - #ifdef TARGET_AARCH64 { ARMCPU *cpu =3D 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; } =20 +/* + * 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; =20 trace_target_mprotect(start, len, target_prot); =20 if ((start & ~TARGET_PAGE_MASK) !=3D 0) { return -TARGET_EINVAL; } - page_flags =3D validate_prot_to_pageflags(&host_prot, target_prot); + page_flags =3D 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 =3D HOST_PAGE_ALIGN(end); if (start > host_start) { /* handle host page containing start */ - prot1 =3D host_prot; + prot1 =3D target_prot; for (addr =3D host_start; addr < start; addr +=3D TARGET_PAGE_SIZE= ) { prot1 |=3D page_get_flags(addr); } @@ -154,19 +157,19 @@ int target_mprotect(abi_ulong start, abi_ulong len, i= nt target_prot) end =3D host_end; } ret =3D mprotect(g2h_untagged(host_start), qemu_host_page_size, - prot1 & PAGE_BITS); + target_to_host_prot(prot1)); if (ret !=3D 0) { goto error; } host_start +=3D qemu_host_page_size; } if (end < host_end) { - prot1 =3D host_prot; + prot1 =3D target_prot; for (addr =3D end; addr < host_end; addr +=3D TARGET_PAGE_SIZE) { prot1 |=3D page_get_flags(addr); } ret =3D 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 !=3D 0) { goto error; } @@ -175,8 +178,8 @@ int target_mprotect(abi_ulong start, abi_ulong len, int= target_prot) =20 /* handle the pages in the middle */ if (host_start < host_end) { - ret =3D mprotect(g2h_untagged(host_start), - host_end - host_start, host_prot); + ret =3D mprotect(g2h_untagged(host_start), host_end - host_start, + target_to_host_prot(target_prot)); if (ret !=3D 0) { goto error; } @@ -212,7 +215,8 @@ static int mmap_frag(abi_ulong real_start, =20 if (prot1 =3D=3D 0) { /* no page was there, so we allocate one */ - void *p =3D mmap(host_start, qemu_host_page_size, prot, + void *p =3D mmap(host_start, qemu_host_page_size, + target_to_host_prot(prot), flags | MAP_ANONYMOUS, -1, 0); if (p =3D=3D MAP_FAILED) { return -1; @@ -233,7 +237,8 @@ static int mmap_frag(abi_ulong real_start, =20 /* 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); } =20 /* read the corresponding file data */ @@ -243,11 +248,13 @@ static int mmap_frag(abi_ulong real_start, =20 /* put final protection */ if (prot_new !=3D (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 !=3D 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, in= t target_prot, { abi_ulong ret, end, real_start, real_end, retaddr, host_offset, host_l= en, passthrough_start =3D -1, passthrough_end =3D -1; - int page_flags, host_prot; + int page_flags; =20 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, in= t target_prot, goto fail; } =20 - page_flags =3D validate_prot_to_pageflags(&host_prot, target_prot); + page_flags =3D validate_prot_to_pageflags(target_prot); if (!page_flags) { errno =3D EINVAL; goto fail; @@ -553,10 +560,12 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, = int target_prot, =20 if (!(flags & (MAP_FIXED | MAP_FIXED_NOREPLACE))) { unsigned long host_start; + int host_prot; void *p; =20 host_len =3D len + offset - host_offset; host_len =3D HOST_PAGE_ALIGN(host_len); + host_prot =3D target_to_host_prot(target_prot); =20 /* * Note: we prefer to control the mapping address. It is @@ -617,7 +626,8 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, in= t 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) =3D=3D MAP_SHARED && (host_prot & PROT_= WRITE)) { + if ((flags & MAP_TYPE) =3D=3D MAP_SHARED + && (target_prot & PROT_WRITE)) { errno =3D EINVAL; goto fail; } @@ -631,7 +641,7 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, in= t target_prot, if (pread(fd, g2h_untagged(start), len, offset) =3D=3D -1) { goto fail; } - if (!(host_prot & PROT_WRITE)) { + if (!(target_prot & PROT_WRITE)) { ret =3D target_mprotect(start, len, target_prot); assert(ret =3D=3D 0); } @@ -643,14 +653,14 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, = int target_prot, if (real_end =3D=3D real_start + qemu_host_page_size) { /* one single host page */ ret =3D mmap_frag(real_start, start, end, - host_prot, flags, fd, offset); + target_prot, flags, fd, offset); if (ret =3D=3D -1) { goto fail; } goto the_end1; } ret =3D mmap_frag(real_start, start, real_start + qemu_host_pa= ge_size, - host_prot, flags, fd, offset); + target_prot, flags, fd, offset); if (ret =3D=3D -1) { goto fail; } @@ -660,7 +670,7 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, in= t target_prot, if (end < real_end) { ret =3D 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 - star= t); if (ret =3D=3D -1) { goto fail; @@ -678,7 +688,7 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, in= t target_prot, offset1 =3D offset + real_start - start; } p =3D 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 =3D=3D MAP_FAILED) { goto fail; } --=20 2.34.1 From nobody Mon May 20 16:07:49 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1689429351; cv=none; d=zohomail.com; s=zohoarc; b=gU6eXkPf9P71phcXz5wsDbpqU0kJqOml5eEHXESoobUKksOqHBIpu9oDdPSmU/etuf9/78hNq3aW7+aZP3Y12/ebxhI1mzW0lKfb0MQPOA8TtoJQutaOHSfxQBXbtRdQbnMIP3fJWT8JIL199amBm5nTwK/U2rY/DHzX1c5qR6k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689429351; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Fokkd6so43K12JUZOnDmBsniw0YcAJ7z1i5mex4l2TY=; b=lcxFLxYOeOyLQQgypxjgqn9ePQRaRMIikkRL1el2cFEGu9zHiZhmTqj8Db8oDj+QV9wbTWQhBtGpyJtLyBNv9VUJP9GukKP6cnfg6dOnSw4sKUa4mkQ8UZwArRp0pMAsy2OIeYTJdhRSSsaNr2K6x/jXDpQ3cUrRacpIAqG0BCc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1689429351466328.35220218241; Sat, 15 Jul 2023 06:55:51 -0700 (PDT) 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) 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) 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-Google-Smtp-Source: APBJJlFFLI1ZdWaVYddmJUbrpmALukJ2qbn20AgJVcC1ftZtpPjWMwy3mwiY7/xUjcJajLQm+Mp7LA== 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) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Alex=20Benn=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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1689429351852100001 We build with _FILE_OFFSET_BITS=3D64, so off_t =3D off64_t =3D 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=C3=A9e 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 @@ =20 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 si= ze, abi_ulong align) =20 /* 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_l= en, + abi_ulong ret, end, real_start, real_end, retaddr, host_len, passthrough_start =3D -1, passthrough_end =3D -1; int page_flags; + off_t host_offset; =20 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, in= t target_prot, } =20 if (!(flags & (MAP_FIXED | MAP_FIXED_NOREPLACE))) { - unsigned long host_start; + uintptr_t host_start; int host_prot; void *p; =20 @@ -578,7 +579,7 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, in= t target_prot, goto fail; } /* update start so that it points to the file position at 'offset'= */ - host_start =3D (unsigned long)p; + host_start =3D (uintptr_t)p; if (!(flags & MAP_ANONYMOUS)) { p =3D 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, in= t target_prot, /* map the middle (easier) */ if (real_start < real_end) { void *p; - unsigned long offset1; + off_t offset1; + if (flags & MAP_ANONYMOUS) { offset1 =3D 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 =3D 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: --=20 2.34.1 From nobody Mon May 20 16:07:49 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1689429566; cv=none; d=zohomail.com; s=zohoarc; b=m9JjmQURzBBPh8D/ff8ovEcXRzFaSC9EXRX4MCOIVuAwDWbS50HQknst95Lfy002i/7pTZ5IHjSq7gujjsUrWDth29dRfogo1o0oTJ9ATbkw2XZhb/d5Rsb6y+VLOE5e9eKaJlo+b7tSGY3pJ7jtU8jo3AdWa6Y8gfarEOZbuio= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689429566; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=N9gguT3TBruptKaq1lWfbF+0g4+LhgVIPeZNOW/uhRg=; b=cwPpHW0uNI/8aIHJDJv77zhYFLBF9ZR4+d1Ig9rQBdLoaCjEvz8HFaKCpnF6vO4/ATVpaI++DhBx7kbapVPKOUNaBXGLle2HoDF3bZMTL56ZnnHN5sLq+yj4cmQoTb7o+UAcoEjOf3edM0KaKkC58EgoDIotSN3b7o//4XCx/3g= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1689429566001602.851723528282; Sat, 15 Jul 2023 06:59:26 -0700 (PDT) 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) 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) 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-Google-Smtp-Source: APBJJlGnUOt1T5iu4GEE0ax4gkebh8CNhnLsjmHKRyIlUd/sFZne1vNQzIjruSC+9d9y7E/D/5P4DQ== 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) 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 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1689429568234100003 Content-Type: text/plain; charset="utf-8" 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; =20 trace_target_mprotect(start, len, target_prot); =20 @@ -132,63 +135,88 @@ int target_mprotect(abi_ulong start, abi_ulong len, i= nt target_prot) if (!page_flags) { return -TARGET_EINVAL; } - len =3D TARGET_PAGE_ALIGN(len); - end =3D start + len; - if (!guest_range_valid_untagged(start, len)) { - return -TARGET_ENOMEM; - } if (len =3D=3D 0) { return 0; } + len =3D TARGET_PAGE_ALIGN(len); + if (!guest_range_valid_untagged(start, len)) { + return -TARGET_ENOMEM; + } + + last =3D start + len - 1; + host_start =3D start & qemu_host_page_mask; + host_last =3D HOST_PAGE_ALIGN(last) - 1; + nranges =3D 0; =20 mmap_lock(); - host_start =3D start & qemu_host_page_mask; - host_end =3D 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 =3D target_prot; - for (addr =3D host_start; addr < start; addr +=3D TARGET_PAGE_SIZE= ) { - prot1 |=3D page_get_flags(addr); + for (abi_ulong a =3D host_start; a < start; a +=3D TARGET_PAGE_SIZ= E) { + prot1 |=3D page_get_flags(a); } - if (host_end =3D=3D host_start + qemu_host_page_size) { - for (addr =3D end; addr < host_end; addr +=3D TARGET_PAGE_SIZE= ) { - prot1 |=3D page_get_flags(addr); + for (abi_ulong a =3D last; a < host_last; a +=3D TARGET_PAGE_SIZE)= { + prot1 |=3D page_get_flags(a + 1); + } + starts[nranges] =3D host_start; + lens[nranges] =3D qemu_host_page_size; + prots[nranges] =3D prot1; + nranges++; + } else { + if (host_start < start) { + /* Host page contains more than one guest page: sum the prot. = */ + prot1 =3D target_prot; + for (abi_ulong a =3D host_start; a < start; a +=3D TARGET_PAGE= _SIZE) { + prot1 |=3D page_get_flags(a); + } + /* If the resulting sum differs, create a new range. */ + if (prot1 !=3D target_prot) { + starts[nranges] =3D host_start; + lens[nranges] =3D qemu_host_page_size; + prots[nranges] =3D prot1; + nranges++; + host_start +=3D qemu_host_page_size; } - end =3D host_end; } - ret =3D mprotect(g2h_untagged(host_start), qemu_host_page_size, - target_to_host_prot(prot1)); - if (ret !=3D 0) { - goto error; + + if (last < host_last) { + /* Host page contains more than one guest page: sum the prot. = */ + prot1 =3D target_prot; + for (abi_ulong a =3D last; a < host_last; a +=3D TARGET_PAGE_S= IZE) { + prot1 |=3D page_get_flags(a + 1); + } + /* If the resulting sum differs, create a new range. */ + if (prot1 !=3D target_prot) { + host_last -=3D qemu_host_page_size; + starts[nranges] =3D host_last + 1; + lens[nranges] =3D qemu_host_page_size; + prots[nranges] =3D prot1; + nranges++; + } } - host_start +=3D qemu_host_page_size; - } - if (end < host_end) { - prot1 =3D target_prot; - for (addr =3D end; addr < host_end; addr +=3D TARGET_PAGE_SIZE) { - prot1 |=3D page_get_flags(addr); + + /* Create a range for the middle, if any remains. */ + if (host_start < host_last) { + starts[nranges] =3D host_start; + lens[nranges] =3D host_last - host_start + 1; + prots[nranges] =3D target_prot; + nranges++; } - ret =3D mprotect(g2h_untagged(host_end - qemu_host_page_size), - qemu_host_page_size, target_to_host_prot(prot1)); - if (ret !=3D 0) { - goto error; - } - host_end -=3D qemu_host_page_size; } =20 - /* handle the pages in the middle */ - if (host_start < host_end) { - ret =3D mprotect(g2h_untagged(host_start), host_end - host_start, - target_to_host_prot(target_prot)); + for (int i =3D 0; i < nranges; ++i) { + ret =3D mprotect(g2h_untagged(starts[i]), lens[i], + target_to_host_prot(prots[i])); if (ret !=3D 0) { goto error; } } =20 - page_set_flags(start, start + len - 1, page_flags); + page_set_flags(start, last, page_flags); ret =3D 0; =20 -error: + error: mmap_unlock(); return ret; } --=20 2.34.1 From nobody Mon May 20 16:07:49 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1689429367; cv=none; d=zohomail.com; s=zohoarc; b=kRj0wfBlJkK4gq/1oEajO4lXU5kTqa0ciOlemfJ6X8qUN6FyYhtHulmGHn6xC3v9btzXfyi+ptS7sru2GSk1p2ZgESRKbCtjF99hDfyvqQ7SVMmMW6LcNg3GOUSaJpqqK0TgWe2fHAMj+yTlgZpoHfNeZYMGGIvmf13HjvXkpQk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689429367; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=aO8i+PWWEj2wFULENv6+H9RCy3N3UL0z2bpJ1K4Mi2s=; b=aITDyzRqTRAVD0SGh+elXYzKqB4FpT2ri3vRP2iFKxJ4pHeOEOeUSKX9j4tgPkrJMGq5bXZgaHxoogpfTzTs++xz4U5agOmGbT4Ut3RFl0bvobc2b0lfcG1Q2VX1fyWYAh7JmP635U+7jqBFie9W/fsd7IJMUtx2SUI0h8THN1k= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1689429367521212.68410449560815; Sat, 15 Jul 2023 06:56:07 -0700 (PDT) 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) 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) 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-Google-Smtp-Source: APBJJlHOZkgsoNINbGjpQ2VG+qhjQ9Xaaak80NB5eST1fQoYz3bMOSC6OWFoTyhR3Ch24uFPc/3YDQ== 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) 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 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1689429368170100001 Content-Type: text/plain; charset="utf-8" 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, i= nt target_prot) } =20 /* 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 las= t, + 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; =20 - real_end =3D real_start + qemu_host_page_size; - host_start =3D g2h_untagged(real_start); - - /* get the protection of the target pages outside the mapping */ - prot1 =3D 0; - for (addr =3D real_start; addr < real_end; addr++) { - if (addr < start || addr >=3D end) { - prot1 |=3D page_get_flags(addr); - } + if (!(flags & MAP_ANONYMOUS) + && (flags & MAP_TYPE) =3D=3D 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 =3D EINVAL; + return false; } =20 - if (prot1 =3D=3D 0) { - /* no page was there, so we allocate one */ + real_last =3D real_start + qemu_host_page_size - 1; + host_start =3D g2h_untagged(real_start); + + /* Get the protection of the target pages outside the mapping. */ + prot_old =3D 0; + for (abi_ulong a =3D real_start; a < start; a +=3D TARGET_PAGE_SIZE) { + prot_old |=3D page_get_flags(a); + } + for (abi_ulong a =3D real_last; a > last; a -=3D TARGET_PAGE_SIZE) { + prot_old |=3D page_get_flags(a); + } + + if (prot_old =3D=3D 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 =3D mmap(host_start, qemu_host_page_size, target_to_host_prot(prot), flags | MAP_ANONYMOUS, -1, 0); if (p =3D=3D MAP_FAILED) { - return -1; + return false; } - prot1 =3D prot; + prot_old =3D prot; } - prot1 &=3D PAGE_BITS; + prot_new =3D prot | prot_old; =20 - prot_new =3D 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) =3D=3D MAP_SHARED && (prot & PROT_WRITE)) { - return -1; - } + host_prot_old =3D target_to_host_prot(prot_old); + host_prot_new =3D target_to_host_prot(prot_new); =20 - /* 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 |=3D PROT_WRITE; + mprotect(host_start, qemu_host_page_size, host_prot_old); + } =20 - /* read the corresponding file data */ - if (pread(fd, g2h_untagged(start), end - start, offset) =3D=3D -1)= { - return -1; - } - - /* put final protection */ - if (prot_new !=3D (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 !=3D 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) =3D= =3D -1) { + return false; } } - return 0; + + /* Put final protection */ + if (host_prot_new !=3D host_prot_old) { + mprotect(host_start, qemu_host_page_size, host_prot_new); + } + return true; } =20 #if HOST_LONG_BITS =3D=3D 64 && TARGET_ABI_BITS =3D=3D 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 =3D=3D real_start + qemu_host_page_size) { /* one single host page */ - ret =3D mmap_frag(real_start, start, end, - target_prot, flags, fd, offset); - if (ret =3D=3D -1) { + if (!mmap_frag(real_start, start, end - 1, + target_prot, flags, fd, offset)) { goto fail; } goto the_end1; } - ret =3D mmap_frag(real_start, start, real_start + qemu_host_pa= ge_size, - target_prot, flags, fd, offset); - if (ret =3D=3D -1) { + if (!mmap_frag(real_start, start, + real_start + qemu_host_page_size - 1, + target_prot, flags, fd, offset)) { goto fail; } real_start +=3D qemu_host_page_size; } /* handle the end of the mapping */ if (end < real_end) { - ret =3D 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 - star= t); - if (ret =3D=3D -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 -=3D qemu_host_page_size; --=20 2.34.1 From nobody Mon May 20 16:07:50 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1689429493; cv=none; d=zohomail.com; s=zohoarc; b=PEhWkqEK1+14XrWFjuFNYdgif4Ah65Z8VVUBKeJ+EVLPyarDygmNqatEO1C6CheN1EUKE3BzlAz6bSe6mdspU2+S6u0roqyx67lvQ16hqjAgr4d8mSU7av5VhhXu/bfz20Y+NeiLRwgYcZ/ZUSUFsvJ4mASH1yklZm/KeLmnkxI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689429493; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Tw+lHuhQDkl8BHlJVK/TymddlbqOTxzC1UGZ1En8Tes=; b=jikzcn2UEC/ckONDgpMC+c9/j2wWP/VnJNbg5goLOIewgkfCL5kkDN9jz1jz86avN5i3YemtKH9C7Rhs/g5exFwLuSlQKxx746ptruWU5lIiy7pfNzzComBYJMSUeSshiCXUEjEVU47ZCLXEB81MFcA9gt0bS3XpEmrP1WMwjVI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1689429493327666.1123783263695; Sat, 15 Jul 2023 06:58:13 -0700 (PDT) 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) 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) 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-Google-Smtp-Source: APBJJlEDZTNTdBaY3aN71pQZRP06Wza0w9mzyIo20G4c2INKoC3fXCtkxxaGe3/YpfPXVLO7YOWyCA== 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) 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 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1689429495142100003 Content-Type: text/plain; charset="utf-8" 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); =20 +/** + * 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 =3D=3D 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) =3D=3D NULL; } =20 +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 <=3D max); + assert(max <=3D GUEST_ADDR_MAX); + assert(len !=3D 0); + assert(is_power_of_2(align)); + assert_memory_lock(); + + len_m1 =3D len - 1; + align_m1 =3D align - 1; + + /* Iteratively narrow the search region. */ + while (1) { + PageFlagsNode *p; + + /* Align min and double-check there's enough space remaining. */ + min =3D (min + align_m1) & ~align_m1; + if (min > max) { + return -1; + } + if (len_m1 > max - min) { + return -1; + } + + p =3D pageflags_find(min, min + len_m1); + if (p =3D=3D NULL) { + /* Found! */ + return min; + } + if (max <=3D p->itree.last) { + /* Existing allocation fills the remainder of the search regio= n. */ + return -1; + } + /* Skip across existing allocation. */ + min =3D p->itree.last + 1; + } +} + void page_protect(tb_page_addr_t address) { PageFlagsNode *p; --=20 2.34.1 From nobody Mon May 20 16:07:50 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1689429319; cv=none; d=zohomail.com; s=zohoarc; b=NWKAE31B0Yj1kE9QlP2XCvquqg/gXl66460KbID2x0gTTMeTj7fDqZHfBxjEaHDnNI4+QQD4Nfbe1agovCcKSriBKGq06reZ5Iq0h5k8HCzN4nmTkxDQoF9TV3kK42Y1ny6GicP6B78BObN+dsamCOo83zV83nti/HAcbU9XoSo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689429319; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=QRxmyw2NI294w3E1OCW/a4A3Z0jUfk7Gsk9X8Q/8iho=; b=fgJ12gcXf6eUCobXH4EDbVIqwAeS8mswKISQPXNHH6fnrFYYWDTNswDsEBobgQzW3mgD2PrfNcbOjoHbCxQIfYaYpPKTY8dEa/KjGUtufS41X5+fIsuVW2hxYr4zjGkhVhXql0wC47zyOciOFkx6TDLShlktCOxtYa4/3ns7/aU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1689429319429914.4237988239553; Sat, 15 Jul 2023 06:55:19 -0700 (PDT) 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) 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) 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-Google-Smtp-Source: APBJJlEa6lpCIO9vXY66exIpPkjThliDqiC7C8AOOVxEIEjKORbQO5yR6oVg337ZP5ozFP1LN2lEPA== 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) 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 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1689429320269100007 Content-Type: text/plain; charset="utf-8" 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 =3D 0; + abi_ulong ret; =20 - if (size > reserved_va) { - return (abi_ulong)-1; + ret =3D page_find_range_empty(start, reserved_va, size, alignment); + if (ret =3D=3D -1 && start > TARGET_PAGE_SIZE) { + /* Restart at the beginning of the address space. */ + ret =3D page_find_range_empty(TARGET_PAGE_SIZE, start - 1, + size, alignment); } =20 - size =3D HOST_PAGE_ALIGN(size) + alignment; - end_addr =3D start + size; - if (end_addr > reserved_va) { - end_addr =3D reserved_va + 1; - } - addr =3D end_addr - qemu_host_page_size; - - while (1) { - if (addr > end_addr) { - if (looped) { - return (abi_ulong)-1; - } - end_addr =3D reserved_va + 1; - addr =3D end_addr - qemu_host_page_size; - looped =3D 1; - continue; - } - prot =3D page_get_flags(addr); - if (prot) { - end_addr =3D addr; - } - if (end_addr - addr >=3D size) { - break; - } - addr -=3D qemu_host_page_size; - } - - if (start =3D=3D mmap_next_start) { - mmap_next_start =3D addr; - } - /* addr is sufficiently low to align it up */ - if (alignment !=3D 0) { - addr =3D (addr + alignment) & ~(alignment - 1); - } - return addr; + return ret; } =20 /* --=20 2.34.1 From nobody Mon May 20 16:07:50 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1689429297; cv=none; d=zohomail.com; s=zohoarc; b=jG7Q03aGfS8xvmhQnHrqOAvpbsOL5FL0RCBiQoEdRuoJBm8tEiJirE7Dm+IQ7sbnoVsCKQVAJKA/+eWRnIi1LvkpSwX5zkJrvs2yigNYoFNsormVJgljtQQPtLDxauEqlD5Ez8tfT5sfSDiu0VEfu8T2J600bP6+HWikKPd+H4A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689429297; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=5+vFU351RDeVAwRNg/WDopVOnzTmK+ZtjZmF1Bh7abU=; b=TRSeX7OA3P0u5JbBfj7i+SNT3JHKYgmbLnIDeyNxYQN6Mpite8ra8+2tVJNgCq8k0EFAzmCH67NK41tacQaEkh+F5U3OlQGNy0RE8xWyHAJwyLT9pOsiBns802/XpFicUF4kGALvXGo59X1iucgFQC9u+ty2rTg3V5iYp/QmQvo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1689429297388607.7722567844418; Sat, 15 Jul 2023 06:54:57 -0700 (PDT) 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) 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) 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-Google-Smtp-Source: APBJJlHNxc4ln2nstts4VI3tWYxsa05SYU+4h9W/BAwW+ltLppYPwe4OTdFE4g1nnBZ1RnYXYnWKig== 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) 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 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1689429297960100002 Content-Type: text/plain; charset="utf-8" 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 =3D qemu_host_page_size; - int prot; - bool looped =3D false; + target_ulong ret; =20 - if (size > reserved_va) { - return (abi_ulong)-1; + ret =3D page_find_range_empty(start, reserved_va, size, align); + if (ret =3D=3D -1 && start > mmap_min_addr) { + /* Restart at the beginning of the address space. */ + ret =3D page_find_range_empty(mmap_min_addr, start - 1, size, alig= n); } =20 - /* Note that start and size have already been aligned by mmap_find_vma= . */ - - end_addr =3D start + size; - /* - * Start at the top of the address space, ignoring the last page. - * If reserved_va =3D=3D 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 =3D ((reserved_va - size) & -align) + size; - looped =3D true; - } - - /* Search downward from END_ADDR, checking to see if a page is in use.= */ - addr =3D end_addr; - while (1) { - addr -=3D 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 =3D end_addr =3D ((reserved_va - size) & -align) + size; - looped =3D true; - } else { - prot =3D page_get_flags(addr); - if (prot) { - /* Page in use. Restart below this page. */ - addr =3D end_addr =3D ((addr - size) & -align) + size; - } else if (addr && addr + size =3D=3D end_addr) { - /* Success! All pages between ADDR and END_ADDR are free.= */ - if (start =3D=3D mmap_next_start) { - mmap_next_start =3D addr; - } - return addr; - } - } - } + return ret; } =20 /* --=20 2.34.1 From nobody Mon May 20 16:07:50 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1689429805; cv=none; d=zohomail.com; s=zohoarc; b=M5EaR5YFbVhS5u7/AmQUXTRDGGVbg6KVlhRW6T5f3vUjdH91FVykXYHCFFTCgftV2z5YMMp14lZjqA4FdYm75Yi8L9usYvgR24TEJQOc0EH2AhYppIDy4vBlKxSG/xd8EaBd5hZ72yiBN8VL5OBq+jnCufO8JyBpkU0pOrUGu2Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689429805; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=jfvLV6T2p9fP56/v/Xia6iQ7yK2dQ6zBkNiykDOKhfw=; b=eGel2twCgSnMrq9j6xuEOAbak31W76CCpk1zMDOrZ0ZJeDJdEDQXQesGWg2FSLB4hbOdo+4Qkl13QuSMK9sEFNyLOjRKAlB/c9HuPFGQ/4Sl9uPJMZcXNXVAcosQhRmHdD896ZpkB71QFGfwNkK0eiOQRhqDMZCDdordh3g2Q2w= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1689429805445694.9829743579633; Sat, 15 Jul 2023 07:03:25 -0700 (PDT) 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) 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) 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-Google-Smtp-Source: APBJJlE/DwK53V37TtkYSQjc3adoVzPqzNSyPMQAQJdfbdlCgyqqSq3tOc8oahHwv19lEE6QKZYpYA== 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) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1689429807277100003 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=C3=A9 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 =3D -1, passthrough_end =3D -1; + abi_ulong ret, last, real_start, real_last, retaddr, host_len; + abi_ulong passthrough_start =3D -1, passthrough_last =3D 0; int page_flags; off_t host_offset; =20 @@ -581,29 +581,30 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, = int target_prot, host_start +=3D offset - host_offset; } start =3D h2g(host_start); + last =3D start + len - 1; passthrough_start =3D start; - passthrough_end =3D start + len; + passthrough_last =3D last; } else { if (start & ~TARGET_PAGE_MASK) { errno =3D EINVAL; goto fail; } - end =3D start + len; - real_end =3D HOST_PAGE_ALIGN(end); + last =3D start + len - 1; + real_last =3D HOST_PAGE_ALIGN(last) - 1; =20 /* * 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 correct= ly. */ - if (end < start || !guest_range_valid_untagged(start, len)) { + if (last < start || !guest_range_valid_untagged(start, len)) { errno =3D ENOMEM; goto fail; } =20 /* 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 =3D EEXIST; goto fail; } @@ -642,9 +643,9 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, in= t target_prot, =20 /* handle the start of the mapping */ if (start > real_start) { - if (real_end =3D=3D real_start + qemu_host_page_size) { + if (real_last =3D=3D 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 +=3D 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 =3D 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 -=3D qemu_host_page_size; + real_last -=3D qemu_host_page_size; } =20 /* map the middle (easier) */ - if (real_start < real_end) { + if (real_start < real_last) { void *p; off_t offset1; =20 @@ -678,13 +679,13 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, = int target_prot, } else { offset1 =3D offset + real_start - start; } - p =3D mmap(g2h_untagged(real_start), real_end - real_start, + p =3D mmap(g2h_untagged(real_start), real_last - real_start + = 1, target_to_host_prot(target_prot), flags, fd, offset1); if (p =3D=3D MAP_FAILED) { goto fail; } passthrough_start =3D real_start; - passthrough_end =3D real_end; + passthrough_last =3D real_last; } } the_end1: @@ -692,16 +693,16 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, = int target_prot, page_flags |=3D PAGE_ANON; } page_flags |=3D PAGE_RESET; - if (passthrough_start =3D=3D 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: --=20 2.34.1 From nobody Mon May 20 16:07:50 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1689429460; cv=none; d=zohomail.com; s=zohoarc; b=i3p91PIsUu26VWiR0X/P98qO5CjfUtXUAh1q4HfSf+OzNUZ+zZKhM0GlixzSaDi2UQCwhDrjh57vOw1urnJAdJe81LLlM4MVU8PUzgvaWPgnpHXAtOYS+dLzcFHP2QWCoF1TXmPdn+mVWt8nsMfQJWfNWapDDU0yqMuHK+Io4qo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689429460; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=LwsEQEgJb6LbDaZv4vgO4Dp17xTKrnyDcX9Cf57n7+Y=; b=F25gkLHUwWU1af7ofx9YLgjmtNkqj9x/Wmg26l8YCX6omGDKaYDCXt8sKJU58IRazij1OqCimk9j9vxRxT0/iCcBfuGDzOHTWaUsWp4Fhi/Xayxx8/yl3C4QkHPYTTubLtb8oZ7Vcm9om9fudQgErLtmp72PByKpWrS2JrGnbqw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1689429459997966.86461424839; Sat, 15 Jul 2023 06:57:39 -0700 (PDT) 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) 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) 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-Google-Smtp-Source: APBJJlEbdwWb+lpGM3JTsDErOePndQgWtFQcJXuZEZ/MP5bOn29kKPDPAXbwQ/dGbASrvwlfYjZVpA== 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) 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 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1689429460313100001 Content-Type: text/plain; charset="utf-8" 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; } =20 -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; =20 + last =3D start + len - 1; real_start =3D start & qemu_host_page_mask; - real_end =3D HOST_PAGE_ALIGN(start + size); - end =3D start + size; - if (start > real_start) { - /* handle host page containing start */ + real_last =3D 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 =3D 0; - for (addr =3D real_start; addr < start; addr +=3D TARGET_PAGE_SIZE= ) { - prot |=3D page_get_flags(addr); + for (a =3D real_start; a < start; a +=3D TARGET_PAGE_SIZE) { + prot |=3D page_get_flags(a); } - if (real_end =3D=3D real_start + qemu_host_page_size) { - for (addr =3D end; addr < real_end; addr +=3D TARGET_PAGE_SIZE= ) { - prot |=3D page_get_flags(addr); - } - end =3D real_end; + for (a =3D last; a < real_last; a +=3D TARGET_PAGE_SIZE) { + prot |=3D page_get_flags(a + 1); + } + if (prot !=3D 0) { + return; + } + } else { + for (prot =3D 0, a =3D real_start; a < start; a +=3D TARGET_PAGE_S= IZE) { + prot |=3D page_get_flags(a); } if (prot !=3D 0) { real_start +=3D qemu_host_page_size; } - } - if (end < real_end) { - prot =3D 0; - for (addr =3D end; addr < real_end; addr +=3D TARGET_PAGE_SIZE) { - prot |=3D page_get_flags(addr); + + for (prot =3D 0, a =3D last; a < real_last; a +=3D TARGET_PAGE_SIZ= E) { + prot |=3D page_get_flags(a + 1); } if (prot !=3D 0) { - real_end -=3D qemu_host_page_size; + real_last -=3D qemu_host_page_size; + } + + if (real_last < real_start) { + return; } } - if (real_start !=3D 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 =3D real_last - real_start + 1; + host_start =3D g2h_untagged(real_start); + + ptr =3D mmap(host_start, real_len, PROT_NONE, + MAP_FIXED | MAP_ANONYMOUS | MAP_PRIVATE | MAP_NORESERVE, -1= , 0); + assert(ptr =3D=3D host_start); } =20 int target_munmap(abi_ulong start, abi_ulong len) --=20 2.34.1 From nobody Mon May 20 16:07:50 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1689429487; cv=none; d=zohomail.com; s=zohoarc; b=PM5lXuLHW8+zLMV5eshVULOtewuLASiGch2XD1XmiiAf9fZjNQmgAEMvFRQe+IlASP2y9zsz9bO9NupOfDBbUd8b7swK2CRyBWDI4PS8vidrhQSa7XjVUmcdMwrog1SreXRpdnjvUOM4NeXivSVuf7jFLtegg1RNvcpOYCJQqkY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689429487; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=PG65sHHMcFZxBzSd8xJSgpPdsxuZoeu52o+OB1adTRg=; b=Y6yXn4BXhdwLeb2egijIXDGlu7dbT+t4esxCGStvEpZPPOZH6KECQedB77fR/zaDu1/H0r81hykvMhNhy4Te4pyljFkL1jKSahgbqJUgsg3waf/nB1e1VC5GqwxMQlbBfZW2DsdKvMj6SGY0ILJoiy+aknHFXRPZajkm+kPUghU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 168942948746842.3462199792001; Sat, 15 Jul 2023 06:58:07 -0700 (PDT) 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) 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) 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-Google-Smtp-Source: APBJJlHJO520EMnjPldNz8csnCuchsbYXIeZ5M0qbj8hMDfzbQcaNHvi8G1529AdMuxUQFgef9lwvQ== 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) 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 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1689429488410100001 Content-Type: text/plain; charset="utf-8" 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; } =20 -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; =20 last =3D start + len - 1; @@ -776,9 +776,15 @@ static void mmap_reserve(abi_ulong start, abi_ulong le= n) real_len =3D real_last - real_start + 1; host_start =3D g2h_untagged(real_start); =20 - ptr =3D mmap(host_start, real_len, PROT_NONE, - MAP_FIXED | MAP_ANONYMOUS | MAP_PRIVATE | MAP_NORESERVE, -1= , 0); - assert(ptr =3D=3D host_start); + if (reserved_va) { + void *ptr =3D mmap(host_start, real_len, PROT_NONE, + MAP_FIXED | MAP_ANONYMOUS + | MAP_PRIVATE | MAP_NORESERVE, -1, 0); + assert(ptr =3D=3D host_start); + } else { + int ret =3D munmap(host_start, real_len); + assert(ret =3D=3D 0); + } } =20 int target_munmap(abi_ulong start, abi_ulong len) @@ -830,11 +836,7 @@ int target_munmap(abi_ulong start, abi_ulong len) ret =3D 0; /* unmap what we can */ if (real_start < real_end) { - if (reserved_va) { - mmap_reserve(real_start, real_end - real_start); - } else { - ret =3D munmap(g2h_untagged(real_start), real_end - real_start= ); - } + mmap_reserve_or_unmap(real_start, real_end - real_start); } =20 if (ret =3D=3D 0) { @@ -871,7 +873,7 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong ol= d_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 ol= d_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 ol= d_size, errno =3D ENOMEM; host_addr =3D 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 { --=20 2.34.1 From nobody Mon May 20 16:07:50 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1689429341; cv=none; d=zohomail.com; s=zohoarc; b=YSYrWDlbdu9sYdEWO/6+kcgloiwQ7P/bTCYDN9M6DQnkDjVxBCKKgUqBFWqYeZmCFxLwzc1UcK5r18edW1W3e7GF/hN6GHKf5I5eensny2maoljOiiC0oWQ2aqs678PHBJfI/+3ID7pOiez8J7UfkreW3IwVxEKjJd+RBs1pULk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689429341; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=t83L6VQqehKor298fA996V/rrvqxT+XEe+3FbTWkw4k=; b=aWoPhl3NlXb9l2/sVADXF/bkhk+iYIlpTKOVaK8Ymv1xtGDGsIuoQ5HvV99NYb7jd7cHUEIniSJWWjhMS843jpwPKojdwDcz0QnrJFYUzaZCbFL1m17OAckQGAQ2fvQvgG5MIvHkhRnfcewpPbDpgmFjFqbe6d3tGmcYdcjrKoI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1689429341910625.6747747805135; Sat, 15 Jul 2023 06:55:41 -0700 (PDT) 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) 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) 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-Google-Smtp-Source: APBJJlFlBVdGFQ9CS9QCnSp9ZLiTk/ZdPS6Y2dKpx5abb35fM6flj0IAv/B3Jk+5YsIc8SVQXQegVw== 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) 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 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1689429343996100005 Content-Type: text/plain; charset="utf-8" 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) =20 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); =20 if (start & ~TARGET_PAGE_MASK) { @@ -803,47 +800,11 @@ int target_munmap(abi_ulong start, abi_ulong len) } =20 mmap_lock(); - end =3D start + len; - real_start =3D start & qemu_host_page_mask; - real_end =3D HOST_PAGE_ALIGN(end); - - if (start > real_start) { - /* handle host page containing start */ - prot =3D 0; - for (addr =3D real_start; addr < start; addr +=3D TARGET_PAGE_SIZE= ) { - prot |=3D page_get_flags(addr); - } - if (real_end =3D=3D real_start + qemu_host_page_size) { - for (addr =3D end; addr < real_end; addr +=3D TARGET_PAGE_SIZE= ) { - prot |=3D page_get_flags(addr); - } - end =3D real_end; - } - if (prot !=3D 0) { - real_start +=3D qemu_host_page_size; - } - } - if (end < real_end) { - prot =3D 0; - for (addr =3D end; addr < real_end; addr +=3D TARGET_PAGE_SIZE) { - prot |=3D page_get_flags(addr); - } - if (prot !=3D 0) { - real_end -=3D qemu_host_page_size; - } - } - - ret =3D 0; - /* unmap what we can */ - if (real_start < real_end) { - mmap_reserve_or_unmap(real_start, real_end - real_start); - } - - if (ret =3D=3D 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; } =20 abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size, --=20 2.34.1 From nobody Mon May 20 16:07:50 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1689429479; cv=none; d=zohomail.com; s=zohoarc; b=iJpQTNp9CSnusugOxLUXAupahZjewTJ3qZTTgUYziEXvi/iWQ6MZVl7MOnxqZg6tSff5Yhrtz39Qfah2F37ODAb7/YBtVAqITkUdywmryA8jNxvUDPA9sFXz8/u9JLuqDPB70TA5/sWaknPGK/QRh7pgaMwtBY43TQamDLM8Gzg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689429479; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=+u+6sqOJ5iK1/8L4kug7OWcFShgptBBIOzAjdLQUcYU=; b=VPnIuB5VHseLq1Hgiqx+WipIM8/xNRJ0jQZJhlFQp4j9sEF4eWCSWcu/+fgq6U1fO/nVcWDeCpIUAZPyzq6FHJ+3l8sbesgfT6s492Tsrd5a+1s5/x4M9WVp/U3MOGDXKaNHnDfJLGPcoUrHNNDHg3AJYcpap/bDme0TyNblqk4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1689429479496705.085283516574; Sat, 15 Jul 2023 06:57:59 -0700 (PDT) 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) 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) 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-Google-Smtp-Source: APBJJlF0J090zJ6FPOkKfDl6oAnXAZBCmSz+XhRYdeDPQqGdFhWF223528Dv8JwZL25+extDZBKSsg== 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) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1689429481137100003 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=C3=A9 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 l= en, int flags) } =20 missing =3D flags & ~p->flags; - if (missing & PAGE_READ) { - ret =3D -1; /* page not readable */ + if (missing & ~PAGE_WRITE) { + ret =3D -1; /* page doesn't match */ break; } if (missing & PAGE_WRITE) { --=20 2.34.1 From nobody Mon May 20 16:07:50 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1689429609; cv=none; d=zohomail.com; s=zohoarc; b=TGEsldL5Mg0bGGs5RILot3d71jU/5gzOou6rQHUMudNaUG9XFQd4piCIi102pS0lr7XxIdsPisUK1Y8Da+9UpyEFakYntxZCdg1v0HyDnZHRPjHVk3IuiY9e+QevrtR6ta5tAvPmS7D2PYUij/GBkI0b1zMSIp8yHr9VNbTjnZ0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689429609; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=QEksHbEIGb/dJkEjI61KH8a3okCUPZ4jhF0donX/Zds=; b=PfzyP5Dj9JZl02pChzZwzr7yycufxjTmyTXPozl1Is2cAMTtL6UmBsC3yOUpW0eFgmDx+vu+Ghu6MTt3TBuTts+SDtgbac2JwxslTZ9umVkOQqJWlefHd4mdctYWKt5qrMrpRt+hAmDSi7cg6CQe7TTducGD4SrWnN2/sl6CpPc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1689429609099379.7459119189192; Sat, 15 Jul 2023 07:00:09 -0700 (PDT) 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) 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) 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-Google-Smtp-Source: APBJJlFN50MZHr6hEB5FXC1xFZrwlc3bmim8PfssqpFYf2HlIoaw9uCzazkwV379zhHpcMzxCCZlhw== 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) 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 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1689429611404100015 Content-Type: text/plain; charset="utf-8" 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 arg= 1, abi_long arg2); =20 static inline bool access_ok(int type, abi_ulong addr, abi_ulong size) { - return page_check_range((target_ulong)addr, size, type) =3D=3D 0; + return page_check_range((target_ulong)addr, size, type); } =20 /* 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 =3D=3D 0 is + * equivalent to testing for flags =3D=3D PAGE_VALID. + */ +bool page_check_range(target_ulong start, target_ulong last, int flags); =20 /** * 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_ulo= ng addr, abi_ulong size) : !guest_range_valid_untagged(addr, size)) { return false; } - return page_check_range((target_ulong)addr, size, type) =3D=3D 0; + return page_check_range((target_ulong)addr, size, type); } =20 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) } } =20 -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: =3D0: unlocked, +1: global, -1: local */ - int ret; + bool ret; =20 if (len =3D=3D 0) { - return 0; /* trivial length */ + return true; /* trivial length */ } =20 last =3D start + len - 1; if (last < start) { - return -1; /* wrap around */ + return false; /* wrap around */ } =20 locked =3D have_mmap_lock(); @@ -551,33 +551,33 @@ int page_check_range(target_ulong start, target_ulong= len, int flags) p =3D pageflags_find(start, last); } if (!p) { - ret =3D -1; /* entire region invalid */ + ret =3D false; /* entire region invalid */ break; } } if (start < p->itree.start) { - ret =3D -1; /* initial bytes invalid */ + ret =3D false; /* initial bytes invalid */ break; } =20 missing =3D flags & ~p->flags; if (missing & ~PAGE_WRITE) { - ret =3D -1; /* page doesn't match */ + ret =3D false; /* page doesn't match */ break; } if (missing & PAGE_WRITE) { if (!(p->flags & PAGE_WRITE_ORG)) { - ret =3D -1; /* page not writable */ + ret =3D false; /* page not writable */ break; } /* Asking about writable, but has been protected: undo. */ if (!page_unprotect(start, 0)) { - ret =3D -1; + ret =3D false; break; } /* TODO: page_unprotect should take a range, not a single page= . */ if (last - start < TARGET_PAGE_SIZE) { - ret =3D 0; /* ok */ + ret =3D true; /* ok */ break; } start +=3D TARGET_PAGE_SIZE; @@ -585,7 +585,7 @@ int page_check_range(target_ulong start, target_ulong l= en, int flags) } =20 if (last <=3D p->itree.last) { - ret =3D 0; /* ok */ + ret =3D true; /* ok */ break; } start =3D 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, in= t fd, bool smaps) max =3D h2g_valid(max - 1) ? max : (uintptr_t) g2h_untagged(GUEST_ADDR_MAX) + 1; =20 - if (page_check_range(h2g(min), max - min, flags) =3D=3D -1) { + if (!page_check_range(h2g(min), max - min, flags)) { continue; } =20 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_ulo= ng addr, uint32_t level, uint32_t want) { #ifdef CONFIG_USER_ONLY - return (page_check_range(addr, 1, want) =3D=3D 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 =3D 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_ulo= ng 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) =3D=3D -1) { + if (!page_check_range(addr, size, PAGE_READ)) { ret =3D 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 =3D __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 --=20 2.34.1 From nobody Mon May 20 16:07:50 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1689429801; cv=none; d=zohomail.com; s=zohoarc; b=kUc95bcwOs2eJmmukryU3ihd/3Fh/ruZ7h/8mQBKb8U7QfoKholsXrOVBVE+fRYO2pT9Qvb2i70EpbH61wElT9vlaJ1n+RcP6LqzMTKB1TnWGUC+ttSF53ODK2DxVd70hzPry5wsaaVkYoUsPOfADhthfbVkDdbrxG/6u5RaIuI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689429801; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ZRHsYp/A8D0Uk3Tfg/o0B0POYY0J/63KdYiHo0geXzY=; b=VYowl63bgbLsttxx7VcyUsj66MkaNDq+IcpR0FmZPR9BNKeNwT5BcQywFZa5TYdy/F5Z21Fh+6YqSIoFTcTqJ3VIez0VuVJbswPKs5knQXV/lbbfy5XrSN6Ybtnvsp1uiWicHK+e2Shxs0qhXTq1zzLAqCyKL/FMT6zQ9HrwtuM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1689429801412849.5968747905496; Sat, 15 Jul 2023 07:03:21 -0700 (PDT) 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) 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) 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-Google-Smtp-Source: APBJJlEp9c/8MuR9FAlZlfkr1sFCIGMgyynXRCOKzepFwx0EiDZX1W6UIWsh4eF2zLG6G7pTe/rY7A== 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) 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 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1689429801955100003 Content-Type: text/plain; charset="utf-8" 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 o= ld_size, return new_addr; } =20 -static bool can_passthrough_madvise(abi_ulong start, abi_ulong end) -{ - ulong addr; - - if ((start | end) & ~qemu_host_page_mask) { - return false; - } - - for (addr =3D start; addr < end; addr +=3D 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 somet= imes * turns private file-backed mappings into anonymous mappings. - * can_passthrough_madvise() helps to check if a passthrough is possib= le 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 =3D -EINVAL; /* fall through */ case MADV_DONTNEED: - if (can_passthrough_madvise(start, end)) { + if (page_check_range(start, len, PAGE_PASSTHROUGH)) { ret =3D get_errno(madvise(g2h_untagged(start), len, advice)); if ((advice =3D=3D MADV_DONTNEED) && (ret =3D=3D 0)) { page_reset_target_data(start, start + len - 1); --=20 2.34.1 From nobody Mon May 20 16:07:50 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1689429712; cv=none; d=zohomail.com; s=zohoarc; b=KcP7bnDqHHJfjcNXrBxsEImsnNSjEkXyqbn5Rg+dx/74S2010RWw492xppPjx3e1zDHxao6KnaA9n7PsRYod0Z1X12YNj/NsMOdTnCpeAz5cJdbHGxepY2UYQ5oLswcne/oyCSP7O0Qewryzp6a8MlqlBN39+0n/sN4Qr6dqLKI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689429712; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=vXDNUHkoHKMJOTYkZxcm9eNGIwvNIgvNekBczYJkm1c=; b=Rh63H20TIoYdlbfn0aDzjYmonXYyFDm26USx19dzySz7jZ7nokY6Wh/LM3kOklpdAdOwJSszFp/HB3f03Ca7kReIPKy3HRd4uaGxAdPAH6371xCP52tiG40FNJOOCbkMoU80iOUx1Dgd4ySNX8bt/O4RyutopabJo3UhZWwDus4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1689429712243596.451619728188; Sat, 15 Jul 2023 07:01:52 -0700 (PDT) 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) 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) 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-Google-Smtp-Source: APBJJlEZ2DsvqdTwWpqp132AR2wkvwoPT9GEcqDW8epL1JTZCtEFiIHJH2788Vbu7Zd0D+ZB/V+XPA== 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) 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 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1689429713968100001 Content-Type: text/plain; charset="utf-8" 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, =20 abi_long target_madvise(abi_ulong start, abi_ulong len_in, int advice) { - abi_ulong len, end; + abi_ulong len; int ret =3D 0; =20 if (start & ~TARGET_PAGE_MASK) { return -TARGET_EINVAL; } - len =3D TARGET_PAGE_ALIGN(len_in); - - if (len_in && !len) { - return -TARGET_EINVAL; - } - - end =3D start + len; - if (end < start) { - return -TARGET_EINVAL; - } - - if (end =3D=3D start) { + if (len_in =3D=3D 0) { return 0; } - - if (!guest_range_valid_untagged(start, len)) { + len =3D TARGET_PAGE_ALIGN(len_in); + if (len =3D=3D 0 || !guest_range_valid_untagged(start, len)) { return -TARGET_EINVAL; } =20 --=20 2.34.1 From nobody Mon May 20 16:07:50 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1689429610; cv=none; d=zohomail.com; s=zohoarc; b=JtnP/II3j56cFYzwNONv8GEoM6VaOvEB2jg9cvgtU1cevv/J6/oWhMM0bisNTjq5Ld5kXR5zIuPNC6662nwgz9x4H7tIpAtkKKRuelL7j52VK0ZIQygfeuUVK2sttzSVbr4oRSWQQskHEdRtS2JMVimIT4ECYvtIDbz3ZBxJCLI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689429610; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=GxD0O4grkQ8OinpyCeKP/3HLPLmkFCEiNXIpS5ZyOiE=; b=Z3xZ7UoyN6EBgHS/bSYfok79fKqTE02/lS97zV7V5kKwPiPhgHgmJzewKqIevZMGW1Jgh31iOxfHKVX5XOcvfU+mC5q+hRRxpK3QrsnQdQO6husDH9CFMGOcvASb9+W+NfnX0JL7Sed8uYHq1Al7XQN5K1+5HlC4JyRXT5iVrXo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1689429610961850.8953256996082; Sat, 15 Jul 2023 07:00:10 -0700 (PDT) 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) 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) 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-Google-Smtp-Source: APBJJlHfgrE4yBqdTLzFcPH46Xo9OAQBwgKEBH+H2x4A5so0IeZFII3yD064LJPlW2Im3Z+aYDcGrg== 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) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Juan Quintela , Laurent Vivier , =?UTF-8?q?Philippe=20Mathieu-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1689429611769100017 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=C3=A9 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 =20 #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, ui= nt, 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 lo= ng, lo, + loff_t *, res, unsigned int, wh); #endif _syscall3(int, sys_rt_sigqueueinfo, pid_t, pid, int, sig, siginfo_t *, uin= fo) _syscall4(int, sys_rt_tgsigqueueinfo, pid_t, pid, pid_t, tid, int, sig, --=20 2.34.1 From nobody Mon May 20 16:07:50 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1689429520; cv=none; d=zohomail.com; s=zohoarc; b=bo0tW7Uha42GyWeTtmq8ReLBsk6Z2H+5LsVmyVG2JzrCYXuB404mk+dKCtcWo6jiYhCPP001Llr8FIgr09BZLEzIe7L2+hu7PFX2Sxfmu1zvGwPsT7pnAY37MbtdQJtIKn/DFCU16xGbCFufDPMK4TZ4s/UApkurpP/hilGOvQA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689429520; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=vpPPTc1J6EP9QJbzcPqiBEK5MSOQgGdVVPldReJi1XE=; b=Q3uSitGvy/+31veD4lqIxTnKhZkE8GVAFNm0lzimdP2e9DYKt2orw7YMGKFhequGsnpsbCaJxaVVOLtMaxmIyYygjUwX4JV4U62l6xY3J6RYrxyo2srNVDr8WQ3ZXR2B+DFittE05E26EABSgrKcmSQYOa5qeaC4EekB2kzGdXg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1689429520102207.93376152884582; Sat, 15 Jul 2023 06:58:40 -0700 (PDT) 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) 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) 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-Google-Smtp-Source: APBJJlFfw+CQXEgYtcp1dpabmpOfcc0+kHHfXe6uTB/1SmBE4E9NChQ5jZb6WKte+33QdswCiDzSHA== 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) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1689429520959100003 From: Philippe Mathieu-Daud=C3=A9 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 `las= t <=3D 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=C3=A9 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 { =20 static bool init_guest_commpage(void) { - abi_ptr commpage =3D HI_COMMPAGE & -qemu_host_page_size; - void *want =3D g2h_untagged(commpage); - void *addr =3D mmap(want, qemu_host_page_size, PROT_READ | PROT_WRITE, - MAP_ANONYMOUS | MAP_PRIVATE | MAP_FIXED, -1, 0); + ARMCPU *cpu =3D 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 =3D HI_COMMPAGE & -qemu_host_page_size; + want =3D g2h_untagged(commpage); + addr =3D mmap(want, qemu_host_page_size, PROT_READ | PROT_WRITE, + MAP_ANONYMOUS | MAP_PRIVATE | MAP_FIXED, -1, 0); =20 if (addr =3D=3D MAP_FAILED) { perror("Allocating guest commpage"); --=20 2.34.1 From nobody Mon May 20 16:07:50 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1689429456; cv=none; d=zohomail.com; s=zohoarc; b=MHNJ3Wf4RcmrvgMk/JTFBB7DmT2w3t6jeJHNOvW09isvf6DoKzll2shTqFBq/z4G/ULwk1dB3/SXTV/45CeBMQ5UR9cCyMgwqA3YStMJww0FnOL1+SjnIIVLsYt4dX9B8Xd27I6Z3akgvE2yGrHPOlM4AdIK3cszqW54ODTARhE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689429456; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=VAtnLNi/uv6ezOFoKAO0LnFsL79vAg3ew3PZjo4G9rg=; b=Il4etU/z6SnwjQzEzorh5a0MKv7hN+iwaWrXGST3PcWWGKQ16t1BBlM7ItmyFe6MDkW8q+1qG57gigWRL/eZbOwOScw382/kqfG/8CJVTP1vAJ1zSAFilhfZfY+br+uRZOUYx704NJv8Vvu7NRbw4LfrwOongxd7JvSm/aLx7hc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1689429456312454.48718316157124; Sat, 15 Jul 2023 06:57:36 -0700 (PDT) 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) 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) 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-Google-Smtp-Source: APBJJlGGeEkp3kegwhrz6elGSbgZGQazc5mpKDP4Mn6dY/zG3OG9SPlhnlCk/fX29WH3+GdlUZ6Cbw== 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) 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 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1689429458019100007 Content-Type: text/plain; charset="utf-8" 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 =20 #include "exec/exec-all.h" +#include "exec/translate-all.h" =20 /* * 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 =20 +#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 protecti= on + * 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_p= c, - 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 =3D 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()) =20 -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 =3D NULL; - *ret_p2 =3D 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) { } =20 /* * For user-only, since we are protecting all of memory with a single lock, @@ -96,7 +86,7 @@ static void tb_remove_all(void) } =20 /* 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); } =20 +/* Like qemu_spin_trylock, returns false on success */ +static bool page_trylock(PageDesc *pd) +{ + bool busy =3D 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); } =20 +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 =3D paddr0 >> TARGET_PAGE_BITS; + tb_page_addr_t pindex1 =3D paddr1 >> TARGET_PAGE_BITS; + PageDesc *pd0, *pd1; + + if (pindex0 =3D=3D pindex1) { + /* Identical pages, and the first page is already locked. */ + return; + } + + pd1 =3D 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 =3D 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 =3D paddr0 >> TARGET_PAGE_BITS; + tb_page_addr_t pindex1 =3D paddr1 >> TARGET_PAGE_BITS; + + if (pindex0 !=3D pindex1) { + page_unlock(page_find_alloc(pindex1, false)); + } +} + +static void tb_lock_pages(TranslationBlock *tb) +{ + tb_page_addr_t paddr0 =3D tb_page_addr0(tb); + tb_page_addr_t paddr1 =3D tb_page_addr1(tb); + tb_page_addr_t pindex0 =3D paddr0 >> TARGET_PAGE_BITS; + tb_page_addr_t pindex1 =3D paddr1 >> TARGET_PAGE_BITS; + + if (unlikely(paddr0 =3D=3D -1)) { + return; + } + if (unlikely(paddr1 !=3D -1) && pindex0 !=3D 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 =3D tb_page_addr0(tb); + tb_page_addr_t paddr1 =3D tb_page_addr1(tb); + tb_page_addr_t pindex0 =3D paddr0 >> TARGET_PAGE_BITS; + tb_page_addr_t pindex1 =3D paddr1 >> TARGET_PAGE_BITS; + + if (unlikely(paddr0 =3D=3D -1)) { + return; + } + if (unlikely(paddr1 !=3D -1) && pindex0 !=3D 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 =3D qemu_spin_trylock(&pe->pd->lock); + bool busy =3D page_trylock(pe->pd); if (!busy) { g_assert(!pe->locked); pe->locked =3D 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; =20 @@ -625,15 +707,21 @@ static inline void tb_page_add(PageDesc *p, Translati= onBlock *tb, } } =20 -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 =3D tb_page_addr0(tb); + tb_page_addr_t paddr1 =3D tb_page_addr1(tb); + tb_page_addr_t pindex0 =3D paddr0 >> TARGET_PAGE_BITS; + tb_page_addr_t pindex1 =3D paddr0 >> TARGET_PAGE_BITS; + + assert(paddr0 !=3D -1); + if (unlikely(paddr1 !=3D -1) && pindex0 !=3D pindex1) { + tb_page_add(page_find_alloc(pindex1, false), tb, 1); } + tb_page_add(page_find_alloc(pindex0, false), tb, 0); } =20 -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, Trans= lationBlock *tb) =20 static void tb_remove(TranslationBlock *tb) { - PageDesc *pd; + tb_page_addr_t paddr0 =3D tb_page_addr0(tb); + tb_page_addr_t paddr1 =3D tb_page_addr1(tb); + tb_page_addr_t pindex0 =3D paddr0 >> TARGET_PAGE_BITS; + tb_page_addr_t pindex1 =3D paddr0 >> TARGET_PAGE_BITS; =20 - pd =3D page_find(tb->page_addr[0] >> TARGET_PAGE_BITS); - tb_page_remove(pd, tb); - if (unlikely(tb->page_addr[1] !=3D -1)) { - pd =3D 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 a= lloc) -{ - PageDesc *p1, *p2; - tb_page_addr_t page1; - tb_page_addr_t page2; - - assert_memory_lock(); - g_assert(phys1 !=3D -1); - - page1 =3D phys1 >> TARGET_PAGE_BITS; - page2 =3D phys2 >> TARGET_PAGE_BITS; - - p1 =3D page_find_alloc(page1, alloc); - if (ret_p1) { - *ret_p1 =3D p1; - } - if (likely(phys2 =3D=3D -1)) { - page_lock(p1); - return; - } else if (page1 =3D=3D page2) { - page_lock(p1); - if (ret_p2) { - *ret_p2 =3D p1; - } - return; - } - p2 =3D page_find_alloc(page2, alloc); - if (ret_p2) { - *ret_p2 =3D 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 =3D page_find(tb_page_addr0(tb) >> TARGET_PAGE_BITS); - - page_unlock(p1); - if (unlikely(tb_page_addr1(tb) !=3D -1)) { - PageDesc *p2 =3D page_find(tb_page_addr1(tb) >> TARGET_PAGE_BITS); - - if (p2 !=3D p1) { - page_unlock(p2); - } + assert(paddr0 !=3D -1); + if (unlikely(paddr1 !=3D -1) && pindex0 !=3D pindex1) { + tb_page_remove(page_find_alloc(pindex1, false), tb); } + tb_page_remove(page_find_alloc(pindex0, false), tb); } #endif /* CONFIG_USER_ONLY */ =20 @@ -925,18 +955,16 @@ static void tb_phys_invalidate__locked(TranslationBlo= ck *tb) void tb_phys_invalidate(TranslationBlock *tb, tb_page_addr_t page_addr) { if (page_addr =3D=3D -1 && tb_page_addr0(tb) !=3D -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); } } =20 /* - * 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 returne= d TB. */ -TranslationBlock *tb_link_page(TranslationBlock *tb, tb_page_addr_t phys_p= c, - tb_page_addr_t phys_page2) +TranslationBlock *tb_link_page(TranslationBlock *tb) { - PageDesc *p; - PageDesc *p2 =3D NULL; void *existing_tb =3D NULL; uint32_t h; =20 assert_memory_lock(); tcg_debug_assert(!(tb->cflags & CF_INVALID)); =20 - /* - * 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 tab= le, - * so that if the insertion fails we know for sure that the TBs are st= ill - * 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); =20 /* add in the hash table */ - h =3D tb_hash_func(phys_pc, (tb->cflags & CF_PCREL ? 0 : tb->pc), + h =3D 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); =20 /* remove TB from the page(s) if we couldn't insert it */ if (unlikely(existing_tb)) { tb_remove(tb); - tb =3D existing_tb; + tb_unlock_pages(tb); + return existing_tb; } =20 - if (p2 && p2 !=3D p) { - page_unlock(p2); - } - page_unlock(p); + tb_unlock_pages(tb); return tb; } =20 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 =3D 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 !=3D TCG_MAX_INSNS); =20 buffer_overflow: + assert_no_pages_locked(); tb =3D tcg_tb_alloc(tcg_ctx); if (unlikely(!tb)) { /* flush must be done */ @@ -333,6 +334,10 @@ TranslationBlock *tb_gen_code(CPUState *cpu, tb->cflags =3D cflags; tb_set_page_addr0(tb, phys_pc); tb_set_page_addr1(tb, -1); + if (phys_pc !=3D -1) { + tb_lock_page0(phys_pc); + } + tcg_ctx->gen_tb =3D tb; tcg_ctx->addr_type =3D TARGET_LONG_BITS =3D=3D 32 ? TCG_TYPE_I32 : TCG= _TYPE_I64; #ifdef CONFIG_SOFTMMU @@ -349,8 +354,7 @@ TranslationBlock *tb_gen_code(CPUState *cpu, tcg_ctx->guest_mo =3D TCG_MO_ALL; #endif =20 - tb_overflow: - + restart_translate: trace_translate_block(tb, pc, tb->tc.ptr); =20 gen_code_size =3D setjmp_gen_code(env, tb, pc, host_pc, &max_insns, &t= i); @@ -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; =20 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 =3D tb_page_addr1(tb); + if (unlikely(phys_p2 !=3D -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; =20 default: g_assert_not_reached(); } } + tcg_ctx->gen_tb =3D NULL; + search_size =3D 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 =3D 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) =3D=3D -1) { + assert_no_pages_locked(); return tb; } =20 @@ -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 =3D tb_link_page(tb, tb_page_addr0(tb), tb_page_addr1(tb)); + existing_tb =3D tb_link_page(tb); + assert_no_pages_locked(); + /* if the TB already exists, discard what we just translated */ if (unlikely(existing_tb !=3D tb)) { uintptr_t orig_aligned =3D (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" =20 static void gen_io_start(void) { @@ -147,10 +147,6 @@ void translator_loop(CPUState *cpu, TranslationBlock *= tb, int *max_insns, db->host_addr[0] =3D host_pc; db->host_addr[1] =3D NULL; =20 -#ifdef CONFIG_USER_ONLY - page_protect(pc); -#endif - ops->init_disas_context(db, cpu); tcg_debug_assert(db->is_jmp =3D=3D DISAS_NEXT); /* no early exit */ =20 @@ -256,22 +252,36 @@ static void *translator_access(CPUArchState *env, Dis= asContextBase *db, host =3D db->host_addr[1]; base =3D TARGET_PAGE_ALIGN(db->pc_first); if (host =3D=3D NULL) { - tb_page_addr_t phys_page =3D - get_page_addr_code_hostp(env, base, &db->host_addr[1]); + tb_page_addr_t page0, old_page1, new_page1; + + new_page1 =3D get_page_addr_code_hostp(env, base, &db->host_ad= dr[1]); =20 /* * 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 =3D=3D -1)) { + if (unlikely(new_page1 =3D=3D -1)) { + tb_unlock_pages(tb); tb_set_page_addr0(tb, -1); return NULL; } =20 - 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 =3D tb_page_addr1(tb); + if (likely(new_page1 !=3D old_page1)) { + page0 =3D tb_page_addr0(tb); + if (unlikely(old_page1 !=3D -1)) { + tb_unlock_page1(page0, old_page1); + } + tb_set_page_addr1(tb, new_page1); + tb_lock_page1(page0, new_page1); + } host =3D db->host_addr[1]; } =20 --=20 2.34.1 From nobody Mon May 20 16:07:50 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1689429454; cv=none; d=zohomail.com; s=zohoarc; b=KpL0ZRvfg04I3CXSmhw/wo/piTKab/bluEvpnIdH9VHXRQy1HLSolucegJ4MHgnE/OSRXjhZX/hrbX0rh5coCuy788DkH7sBP16LJb0P19idZPU35zGHbhhHdIw1g/skp/CVCtBA73E/4s/h9l1AOHzFyn8nYtDt/Ho9Ne+t8e4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689429454; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=/qx14gk5I4WzFXUubYo3gGMTlVb0WZhBx/ntAFiHBZ8=; b=FQVtEodktqbBbKi3u8ORB395rUH1c0DD2i0681Zt9VVYpKOfdl/7epe5WjYQHXaVwmuLFEl6gpZDo2AsJfDDVYNCARv7uuyp/GKb0n/Bh2qp9qnnrgsTLSg+ji5zHdUdScL67sA4saj7Og6tfVOMnEYSej5k/lpJfg07pEEKYvA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1689429454583334.03997804514654; Sat, 15 Jul 2023 06:57:34 -0700 (PDT) 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) 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) 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-Google-Smtp-Source: APBJJlGKmER7/TI6qjt7vGx6SQj7U7QXYvwS65fJFGyQe8v2otgqBd5ep8+9rlfzdsuto6hxwKGzxA== 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) 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 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1689429455117100001 Content-Type: text/plain; charset="utf-8" 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 =20 +#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 add= r, Int128 val, #include "atomic_template.h" #endif =20 -#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, vad= dr addr, MemOpIdx oi, #include "atomic_template.h" #endif =20 -#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, T= CGv_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 =20 -#ifdef CONFIG_CMPXCHG128 +#if HAVE_CMPXCHG128 CMPXCHG_HELPER(cmpxchgo_be, Int128) CMPXCHG_HELPER(cmpxchgo_le, Int128) #endif --=20 2.34.1