linux-user: patch roundup
Subsystems (3)
cover linux-user: patch roundup
I think this is all of the linux-user patches from the list that are outstanding, except for
[email protected] "linux-user/i386: Properly align signal frame"
which failed testing under cross-i386-tci. I'll have another look at that later this week, as it's a bug fix. If I've missed any, please shout.
Patches lacking review:
03-linux-user-Use-abi_uint-not-uint32_t-in-syscall_defs.patch 07-linux-user-Use-abi_uint-not-unsigned-int-in-syscall_.patch 10-linux-user-Use-abi_int-not-int-in-syscall_defs.h.patch 12-host-include-i386-Implement-aes-round.h.patch 13-host-include-aarch64-Implement-aes-round.h.patch 14-include-exec-user-Set-ABI_LLONG_ALIGNMENT-to-4-for-m.patch 15-include-exec-user-Set-ABI_LLONG_ALIGNMENT-to-4-for-n.patch 28-linux-user-Implement-MAP_FIXED_NOREPLACE.patch 31-linux-user-Rewrite-target_mprotect.patch 32-linux-user-Rewrite-mmap_frag.patch 33-accel-tcg-Introduce-page_find_range_empty.patch 34-bsd-user-Use-page_find_range_empty-for-mmap_find_vma.patch 35-linux-user-Use-page_find_range_empty-for-mmap_find_v.patch 37-linux-user-Rewrite-mmap_reserve.patch 38-linux-user-Rename-mmap_reserve-to-mmap_reserve_or_un.patch 39-linux-user-Simplify-target_munmap.patch 41-accel-tcg-Return-bool-from-page_check_range.patch 42-linux-user-Remove-can_passthrough_madvise.patch 43-linux-user-Simplify-target_madvise.patch
r~
Andreas Schwab (1):
linux-user: Make sure initial brk(0) is page-aligned
Juan Quintela (1):
linux-user: Drop uint and ulong
Pierrick Bouvier (1):
linux-user/syscall: Implement execve without execveat
Richard Henderson (41):
linux-user: Reformat syscall_defs.h
linux-user: Remove #if 0 block in syscall_defs.h
linux-user: Use abi_uint not uint32_t in syscall_defs.h
linux-user: Use abi_int not int32_t in syscall_defs.h
linux-user: Use abi_ullong not uint64_t in syscall_defs.h
linux-user: Use abi_llong not int64_t in syscall_defs.h
linux-user: Use abi_uint not unsigned int in syscall_defs.h
linux-user: Use abi_ullong not unsigned long long in syscall_defs.h
linux-user: Use abi_llong not long long in syscall_defs.h
linux-user: Use abi_int not int in syscall_defs.h
linux-user: Use abi_ushort not unsigned short in syscall_defs.h
linux-user: Use abi_short not short in syscall_defs.h
linux-user: Use abi_uint not unsigned in syscall_defs.h include/exec/user: Set ABI_LLONG_ALIGNMENT to 4 for microblaze include/exec/user: Set ABI_LLONG_ALIGNMENT to 4 for nios2
linux-user: Fix do_shmat type errors
accel/tcg: Split out cpu_exec_longjmp_cleanup
tcg: Fix info_in_idx increment in layout_arg_by_ref
linux-user: Fix formatting of mmap.c
linux-user/strace: Expand struct flags to hold a mask
linux-user: Split TARGET_MAP_* out of syscall_defs.h
linux-user: Split TARGET_PROT_* out of syscall_defs.h
linux-user: Populate more bits in mmap_flags_tbl accel/tcg: Introduce page_check_range_empty
bsd-user: Use page_check_range_empty for MAP_EXCL
linux-user: Implement MAP_FIXED_NOREPLACE
linux-user: Split out target_to_host_prot
linux-user: Widen target_mmap offset argument to off_t
linux-user: Rewrite target_mprotect
linux-user: Rewrite mmap_frag
accel/tcg: Introduce page_find_range_empty
bsd-user: Use page_find_range_empty for mmap_find_vma_reserved
linux-user: Use page_find_range_empty for mmap_find_vma_reserved
linux-user: Use 'last' instead of 'end' in target_mmap
linux-user: Rewrite mmap_reserve
linux-user: Rename mmap_reserve to mmap_reserve_or_unmap
linux-user: Simplify target_munmap
accel/tcg: Accept more page flags in page_check_range accel/tcg: Return bool from page_check_range
linux-user: Remove can_passthrough_madvise
linux-user: Simplify target_madvise
Robbin Ehn (1):
linux-user/riscv: Add syscall riscv_hwprobe
bsd-user/qemu.h | 2 +- include/exec/cpu-all.h | 40 +- include/exec/user/abitypes.h | 5 +- linux-user/aarch64/target_mman.h | 8 + linux-user/alpha/target_mman.h | 13 + linux-user/generic/target_mman.h | 58 + linux-user/hppa/target_mman.h | 10 + linux-user/mips/target_mman.h | 18 + linux-user/mips64/target_mman.h | 2 +- linux-user/ppc/target_mman.h | 8 + linux-user/qemu.h | 2 +- linux-user/riscv/syscall32_nr.h | 1 + linux-user/riscv/syscall64_nr.h | 1 + linux-user/sparc/target_mman.h | 9 + linux-user/syscall_defs.h | 2260 ++++++++++++++---------------- linux-user/user-mmap.h | 2 +- linux-user/xtensa/target_mman.h | 18 + accel/tcg/cpu-exec.c | 43 +- accel/tcg/user-exec.c | 72 +- bsd-user/mmap.c | 50 +- linux-user/mmap.c | 704 +++++----- linux-user/strace.c | 61 +- linux-user/syscall.c | 214 ++- target/hppa/op_helper.c | 2 +- target/riscv/vector_helper.c | 2 +- target/sparc/ldst_helper.c | 2 +- tcg/tcg.c | 2 +- accel/tcg/ldst_atomicity.c.inc | 4 +- 28 files changed, 1931 insertions(+), 1682 deletions(-)
Signature · 1 line
2.34.1
[PULL 01/37] util: Add cpuinfo-ppc.c
Move the code from tcg/. Fix a bug in that PPC_FEATURE2_ARCH_3_10 is actually spelled PPC_FEATURE2_ARCH_3_1.
--- host/include/ppc/host/cpuinfo.h | 29 ++++++++++++++++ host/include/ppc64/host/cpuinfo.h | 1 + tcg/ppc/tcg-target.h | 16 ++++----- util/cpuinfo-ppc.c | 56 +++++++++++++++++++++++++++++++ tcg/ppc/tcg-target.c.inc | 44 +----------------------- util/meson.build | 2 ++ 6 files changed, 97 insertions(+), 51 deletions(-) create mode 100644 host/include/ppc/host/cpuinfo.h create mode 100644 host/include/ppc64/host/cpuinfo.h create mode 100644 util/cpuinfo-ppc.c
host/include/ppc/host/cpuinfo.h new file +29 -0
@@ -0,0 +1,29 @@ +/* +* SPDX-License-Identifier: GPL-2.0-or-later +* Host specific cpu indentification for ppc. +*/ + +#ifndef HOST_CPUINFO_H +#define HOST_CPUINFO_H + +/* Digested version of <cpuid.h> */ + +#define CPUINFO_ALWAYS (1u << 0)/* so cpuinfo is nonzero */ +#define CPUINFO_V2_06 (1u << 1) +#define CPUINFO_V2_07 (1u << 2) +#define CPUINFO_V3_0 (1u << 3) +#define CPUINFO_V3_1 (1u << 4) +#define CPUINFO_ISEL (1u << 5) +#define CPUINFO_ALTIVEC (1u << 6) +#define CPUINFO_VSX (1u << 7) + +/* Initialized with a constructor. */ +extern unsigned cpuinfo; + +/* +* We cannot rely on constructor ordering, so other constructors must +* use the function interface rather than the variable above. +*/ +unsigned cpuinfo_init (void ); + +#endif /* HOST_CPUINFO_H */
host/include/ppc64/host/cpuinfo.h new file +1 -0
@@ -0,0 +1 @@ +#include "host/include/ppc/host/cpuinfo.h"
tcg/ppc/tcg-target.h +8 -8
@@ -25,6 +25,8 @@#ifndef PPC_TCG_TARGET_H #define PPC_TCG_TARGET_H +#include "host/cpuinfo.h" +#define MAX_CODE_GEN_BUFFER_SIZE ((size_t)-1)#define TCG_TARGET_NB_REGS 64
@@ -61,14 +63,12 @@ typedef enum { tcg_isa_3_10, } TCGPowerISA; -extern TCGPowerISA have_isa; -extern bool have_altivec; -extern bool have_vsx; - -#define have_isa_2_06 (have_isa >= tcg_isa_2_06) -#define have_isa_2_07 (have_isa >= tcg_isa_2_07) -#define have_isa_3_00 (have_isa >= tcg_isa_3_00) -#define have_isa_3_10 (have_isa >= tcg_isa_3_10) +#define have_isa_2_06 (cpuinfo & CPUINFO_V2_06) +#define have_isa_2_07 (cpuinfo & CPUINFO_V2_07) +#define have_isa_3_00 (cpuinfo & CPUINFO_V3_0) +#define have_isa_3_10 (cpuinfo & CPUINFO_V3_1) +#define have_altivec (cpuinfo & CPUINFO_ALTIVEC) +#define have_vsx (cpuinfo & CPUINFO_VSX)/* optional instructions automatically implemented */ #define TCG_TARGET_HAS_ext8u_i32 0/* andi */
util/cpuinfo-ppc.c new file +56 -0
56 lines not on this page · raw message
tcg/ppc/tcg-target.c.inc +1 -43
56 lines not on this page · raw message
util/meson.build +2 -0
@@ -113,4 +113,6 @@ if cpu == 'aarch64' util_ss.add(files('cpuinfo-aarch64.c')) elif cpu in ['x86', 'x86_64'] util_ss.add(files('cpuinfo-i386.c')) +elif cpu in ['ppc', 'ppc64'] + util_ss.add(files('cpuinfo-ppc.c')) endif
Signature · 1 line
2.34.1
[PULL 08/37] crypto: Add aesdec_IMC
In reply to Richard HendersonAdd a primitive for InvMixColumns.
--- host/include/generic/host/crypto/aes-round.h | 2 + include/crypto/aes-round.h | 18 ++++++ crypto/aes.c | 59 ++++++++++++++++++++ 3 files changed, 79 insertions(+)
host/include/generic/host/crypto/aes-round.h +2 -0
@@ -15,6 +15,8 @@ void aesenc_SB_SR_AK_accel(AESState *, const AESState *, const AESState *, bool) QEMU_ERROR("unsupported accel"); +void aesdec_IMC_accel(AESState *, const AESState *, bool) + QEMU_ERROR("unsupported accel"); void aesdec_ISB_ISR_AK_accel(AESState *, const AESState *, const AESState *, bool) QEMU_ERROR("unsupported accel");
include/crypto/aes-round.h +18 -0
@@ -59,6 +59,24 @@ static inline void aesenc_SB_SR_AK(AESState *r, const AESState *st, } } +/* +* Perform InvMixColumns. +*/ + +void aesdec_IMC_gen (AESState *ret,const AESState *st); +void aesdec_IMC_genrev (AESState *ret,const AESState *st); + +static inline void aesdec_IMC (AESState *r,const AESState *st,bool be) +{ +if (HAVE_AES_ACCEL ) { +aesdec_IMC_accel (r, st, be); + }else if (HOST_BIG_ENDIAN == be) { +aesdec_IMC_gen (r, st); + }else { +aesdec_IMC_genrev (r, st); + } +} +/* * Perform InvSubBytes + InvShiftRows + AddRoundKey. */
crypto/aes.c +59 -0
65 lines not on this page · raw message
Signature · 1 line
2.34.1
[PULL 10/37] crypto: Add aesdec_ISB_ISR_IMC_AK
In reply to Richard HendersonAdd a primitive for InvSubBytes + InvShiftRows +
InvMixColumns + AddRoundKey.
--- host/include/generic/host/crypto/aes-round.h | 3 + include/crypto/aes-round.h | 21 +++++++ crypto/aes.c | 58 ++++++++++++++++++++ 3 files changed, 82 insertions(+)
host/include/generic/host/crypto/aes-round.h +3 -0
@@ -23,5 +23,8 @@ void aesdec_IMC_accel(AESState *, const AESState *, bool) void aesdec_ISB_ISR_AK_accel(AESState *, const AESState *, const AESState *, bool) QEMU_ERROR("unsupported accel"); +void aesdec_ISB_ISR_IMC_AK_accel(AESState *, const AESState *, + const AESState *, bool) + QEMU_ERROR("unsupported accel");#endif /* GENERIC_HOST_CRYPTO_AES_ROUND_H */
include/crypto/aes-round.h +21 -0
@@ -119,4 +119,25 @@ static inline void aesdec_ISB_ISR_AK(AESState *r, const AESState *st, } } +/* +* Perform InvSubBytes + InvShiftRows + InvMixColumns + AddRoundKey. +*/ + +void aesdec_ISB_ISR_IMC_AK_gen (AESState *ret,const AESState *st, +const AESState *rk); +void aesdec_ISB_ISR_IMC_AK_genrev (AESState *ret,const AESState *st, +const AESState *rk); + +static inline void aesdec_ISB_ISR_IMC_AK (AESState *r,const AESState *st, +const AESState *rk,bool be) +{ +if (HAVE_AES_ACCEL ) { +aesdec_ISB_ISR_IMC_AK_accel (r, st, rk, be); + }else if (HOST_BIG_ENDIAN == be) { +aesdec_ISB_ISR_IMC_AK_gen (r, st, rk); + }else { +aesdec_ISB_ISR_IMC_AK_genrev (r, st, rk); + } +} +#endif /* CRYPTO_AES_ROUND_H */
crypto/aes.c +58 -0
64 lines not on this page · raw message
Signature · 1 line
2.34.1
[PULL 18/37] target/ppc: Use aesdec_ISB_ISR_AK_IMC
In reply to Richard HendersonThis implements the VNCIPHER instruction.
--- target/ppc/int_helper.c | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-)
target/ppc/int_helper.c +4 -15
@@ -2947,22 +2947,11 @@ void helper_vcipherlast(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b)void helper_vncipher (ppc_avr_t *r,ppc_avr_t *a,ppc_avr_t *b) { -/* This differs from what is written in ISA V2.07. The RTL is */ -/* incorrect and will be fixed in V2.07B. */ -int i; -ppc_avr_t tmp; +AESState *ad = (AESState *)r; +AESState *st = (AESState *)a; +AESState *rk = (AESState *)b; - VECTOR_FOR_INORDER_I(i, u8) { - tmp.VsrB (i) = b->VsrB (i) ^ AES_isbox[a->VsrB (AES_ishifts[i])]; - } - - VECTOR_FOR_INORDER_I(i, u32) { - r->VsrW (i) = - AES_imc[tmp.VsrB (4 * i +0 )][0 ] ^ - AES_imc[tmp.VsrB (4 * i +1 )][1 ] ^ - AES_imc[tmp.VsrB (4 * i +2 )][2 ] ^ - AES_imc[tmp.VsrB (4 * i +3 )][3 ]; - } +aesdec_ISB_ISR_AK_IMC (ad, st, rk, true); }void helper_vncipherlast (ppc_avr_t *r,ppc_avr_t *a,ppc_avr_t *b)
Signature · 1 line
2.34.1
[PULL 04/37] crypto/aes: Add AES_SH, AES_ISH macros
In reply to Richard HendersonThese macros will constant fold and avoid the indirection through memory when fully unrolling some new primitives.
--- crypto/aes.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-)
crypto/aes.c +14 -2
@@ -108,12 +108,24 @@ const uint8_t AES_isbox[256] = { 0xE1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0C, 0x7D, }; +/* AES ShiftRows, for complete unrolling. */ +#define AES_SH (X ) (((X) * 5) & 15) +const uint8_t AES_shifts[16 ] = { -0 ,5 ,10 ,15 ,4 ,9 ,14 ,3 ,8 ,13 ,2 ,7 ,12 ,1 ,6 ,11 +AES_SH (0x0 ),AES_SH (0x1 ),AES_SH (0x2 ),AES_SH (0x3 ), +AES_SH (0x4 ),AES_SH (0x5 ),AES_SH (0x6 ),AES_SH (0x7 ), +AES_SH (0x8 ),AES_SH (0x9 ),AES_SH (0xA ),AES_SH (0xB ), +AES_SH (0xC ),AES_SH (0xD ),AES_SH (0xE ),AES_SH (0xF ), }; +/* AES InvShiftRows, for complete unrolling. */ +#define AES_ISH (X ) (((X) * 13) & 15) +const uint8_t AES_ishifts[16 ] = { -0 ,13 ,10 ,7 ,4 ,1 ,14 ,11 ,8 ,5 ,2 ,15 ,12 ,9 ,6 ,3 +AES_ISH (0x0 ),AES_ISH (0x1 ),AES_ISH (0x2 ),AES_ISH (0x3 ), +AES_ISH (0x4 ),AES_ISH (0x5 ),AES_ISH (0x6 ),AES_ISH (0x7 ), +AES_ISH (0x8 ),AES_ISH (0x9 ),AES_ISH (0xA ),AES_ISH (0xB ), +AES_ISH (0xC ),AES_ISH (0xD ),AES_ISH (0xE ),AES_ISH (0xF ), };/*
Signature · 1 line
2.34.1
PATCH 1/45 linux-user: Reformat syscall_defs.h
In reply to Richard HendersonUntabify and re-indent.
We had a mix of 2, 3, 4, and 8 space indentation.
--- linux-user/syscall_defs.h | 1948 ++++++++++++++++++------------------- 1 file changed, 974 insertions(+), 974 deletions(-)
linux-user/syscall_defs.h +974 -974
@@ -33,18 +33,18 @@#define TARGET_SYS_SENDMMSG 20/* sendmmsg() */ #define IPCOP_CALL (VERSION ,OP ) ((VERSION) << 16 | (OP)) -#define IPCOP_semop 1 -#define IPCOP_semget 2 -#define IPCOP_semctl 3 -#define IPCOP_semtimedop 4 -#define IPCOP_msgsnd 11 -#define IPCOP_msgrcv 12 -#define IPCOP_msgget 13 -#define IPCOP_msgctl 14 -#define IPCOP_shmat 21 -#define IPCOP_shmdt 22 -#define IPCOP_shmget 23 -#define IPCOP_shmctl 24 +#define IPCOP_semop 1 +#define IPCOP_semget 2 +#define IPCOP_semctl 3 +#define IPCOP_semtimedop 4 +#define IPCOP_msgsnd 11 +#define IPCOP_msgrcv 12 +#define IPCOP_msgget 13 +#define IPCOP_msgctl 14 +#define IPCOP_shmat 21 +#define IPCOP_shmdt 22 +#define IPCOP_shmget 23 +#define IPCOP_shmctl 24#define TARGET_SEMOPM 500
@@ -56,42 +56,42 @@* this explicit here. Please be sure to use the decoding macros * below from now on. */ -#define TARGET_IOC_NRBITS 8 -#define TARGET_IOC_TYPEBITS 8 +#define TARGET_IOC_NRBITS 8 +#define TARGET_IOC_TYPEBITS 8 -#if (defined(TARGET_I386 ) && defined(TARGET_ABI32 )) \ - || (defined(TARGET_ARM ) && defined(TARGET_ABI32 )) \ - || (defined(TARGET_SPARC ) && defined(TARGET_ABI32 )) \ +#if (defined(TARGET_I386 ) && defined(TARGET_ABI32 )) \ + || (defined(TARGET_ARM ) && defined(TARGET_ABI32 )) \ + || (defined(TARGET_SPARC ) && defined(TARGET_ABI32 )) \ || defined(TARGET_M68K ) || defined(TARGET_SH4 ) || defined(TARGET_CRIS ) -/* 16 bit uid wrappers emulation */ +/* 16 bit uid wrappers emulation */ #define USE_UID16 #define target_id uint16_t#else #define target_id uint32_t#endif -#if defined(TARGET_I386 ) || defined(TARGET_ARM ) || defined(TARGET_SH4 ) \ - || defined(TARGET_M68K ) || defined(TARGET_CRIS ) \ - || defined(TARGET_S390X ) || defined(TARGET_OPENRISC ) \ - || defined(TARGET_NIOS2 ) || defined(TARGET_RISCV ) \ +#if defined(TARGET_I386 ) || defined(TARGET_ARM ) || defined(TARGET_SH4 ) \ + || defined(TARGET_M68K ) || defined(TARGET_CRIS ) \ + || defined(TARGET_S390X ) || defined(TARGET_OPENRISC ) \ + || defined(TARGET_NIOS2 ) || defined(TARGET_RISCV ) \ || defined(TARGET_XTENSA ) || defined(TARGET_LOONGARCH64 ) -#define TARGET_IOC_SIZEBITS 14 -#define TARGET_IOC_DIRBITS 2 +#define TARGET_IOC_SIZEBITS 14 +#define TARGET_IOC_DIRBITS 2 -#define TARGET_IOC_NONE 0U +#define TARGET_IOC_NONE 0U#define TARGET_IOC_WRITE 1U -#define TARGET_IOC_READ 2U +#define TARGET_IOC_READ 2U -#elif defined(TARGET_PPC ) || defined(TARGET_ALPHA ) || \ - defined(TARGET_SPARC ) || defined(TARGET_MICROBLAZE ) || \ - defined(TARGET_MIPS ) +#elif defined(TARGET_PPC ) || defined(TARGET_ALPHA ) || \ + defined(TARGET_SPARC ) || defined(TARGET_MICROBLAZE ) || \ + defined(TARGET_MIPS ) -#define TARGET_IOC_SIZEBITS 13 -#define TARGET_IOC_DIRBITS 3 +#define TARGET_IOC_SIZEBITS 13 +#define TARGET_IOC_DIRBITS 3 -#define TARGET_IOC_NONE 1U -#define TARGET_IOC_READ 2U +#define TARGET_IOC_NONE 1U +#define TARGET_IOC_READ 2U#define TARGET_IOC_WRITE 4U#elif defined(TARGET_HPPA )
@@ -115,32 +115,32 @@#error unsupported CPU#endif -#define TARGET_IOC_NRMASK ((1 << TARGET_IOC_NRBITS)-1) -#define TARGET_IOC_TYPEMASK ((1 << TARGET_IOC_TYPEBITS)-1) -#define TARGET_IOC_SIZEMASK ((1 << TARGET_IOC_SIZEBITS)-1) -#define TARGET_IOC_DIRMASK ((1 << TARGET_IOC_DIRBITS)-1) +#define TARGET_IOC_NRMASK ((1 << TARGET_IOC_NRBITS)-1) +#define TARGET_IOC_TYPEMASK ((1 << TARGET_IOC_TYPEBITS)-1) +#define TARGET_IOC_SIZEMASK ((1 << TARGET_IOC_SIZEBITS)-1) +#define TARGET_IOC_DIRMASK ((1 << TARGET_IOC_DIRBITS)-1) -#define TARGET_IOC_NRSHIFT 0 -#define TARGET_IOC_TYPESHIFT (TARGET_IOC_NRSHIFT+TARGET_IOC_NRBITS) -#define TARGET_IOC_SIZESHIFT (TARGET_IOC_TYPESHIFT+TARGET_IOC_TYPEBITS) -#define TARGET_IOC_DIRSHIFT (TARGET_IOC_SIZESHIFT+TARGET_IOC_SIZEBITS) +#define TARGET_IOC_NRSHIFT 0 +#define TARGET_IOC_TYPESHIFT (TARGET_IOC_NRSHIFT+TARGET_IOC_NRBITS) +#define TARGET_IOC_SIZESHIFT (TARGET_IOC_TYPESHIFT+TARGET_IOC_TYPEBITS) +#define TARGET_IOC_DIRSHIFT (TARGET_IOC_SIZESHIFT+TARGET_IOC_SIZEBITS) -#define TARGET_IOC (dir,type,nr,size) \ - (((dir) << TARGET_IOC_DIRSHIFT) | \ - ((type) << TARGET_IOC_TYPESHIFT) | \ - ((nr) << TARGET_IOC_NRSHIFT) | \ - ((size) << TARGET_IOC_SIZESHIFT)) +#define TARGET_IOC (dir,type,nr,size) \ + (((dir) << TARGET_IOC_DIRSHIFT) | \ + ((type) << TARGET_IOC_TYPESHIFT) | \ + ((nr) << TARGET_IOC_NRSHIFT) | \ + ((size) << TARGET_IOC_SIZESHIFT))/* used to create numbers */ -#define TARGET_IO (type,nr) TARGET_IOC(TARGET_IOC_NONE,(type),(nr),0) -#define TARGET_IOR (type,nr,size) TARGET_IOC(TARGET_IOC_READ,(type),(nr),sizeof(size)) -#define TARGET_IOW (type,nr,size) TARGET_IOC(TARGET_IOC_WRITE,(type),(nr),sizeof(size)) -#define TARGET_IOWR (type,nr,size) TARGET_IOC(TARGET_IOC_READ|TARGET_IOC_WRITE,(type),(nr),sizeof(size)) +#define TARGET_IO (type,nr) TARGET_IOC(TARGET_IOC_NONE,(type),(nr),0) +#define TARGET_IOR (type,nr,size) TARGET_IOC(TARGET_IOC_READ,(type),(nr),sizeof(size)) +#define TARGET_IOW (type,nr,size) TARGET_IOC(TARGET_IOC_WRITE,(type),(nr),sizeof(size)) +#define TARGET_IOWR (type,nr,size) TARGET_IOC(TARGET_IOC_READ|TARGET_IOC_WRITE,(type),(nr),sizeof(size))/* the size is automatically computed for these defines */ -#define TARGET_IORU (type,nr) TARGET_IOC(TARGET_IOC_READ,(type),(nr),TARGET_IOC_SIZEMASK) -#define TARGET_IOWU (type,nr) TARGET_IOC(TARGET_IOC_WRITE,(type),(nr),TARGET_IOC_SIZEMASK) -#define TARGET_IOWRU (type,nr) TARGET_IOC(TARGET_IOC_READ|TARGET_IOC_WRITE,(type),(nr),TARGET_IOC_SIZEMASK) +#define TARGET_IORU (type,nr) TARGET_IOC(TARGET_IOC_READ,(type),(nr),TARGET_IOC_SIZEMASK) +#define TARGET_IOWU (type,nr) TARGET_IOC(TARGET_IOC_WRITE,(type),(nr),TARGET_IOC_SIZEMASK) +#define TARGET_IOWRU (type,nr) TARGET_IOC(TARGET_IOC_READ|TARGET_IOC_WRITE,(type),(nr),TARGET_IOC_SIZEMASK)struct target_sockaddr {abi_ushort sa_family;
@@ -174,12 +174,12 @@ struct target_in_addr { };struct target_sockaddr_in { -abi_ushort sin_family; -abi_short sin_port;/* big endian */ -struct target_in_addr sin_addr; -uint8_t __pad[sizeof (struct target_sockaddr ) - -sizeof (abi_ushort) -sizeof (abi_short) - -sizeof (struct target_in_addr )]; +abi_ushort sin_family; +abi_short sin_port;/* big endian */ +struct target_in_addr sin_addr; +uint8_t __pad[sizeof (struct target_sockaddr ) - +sizeof (abi_ushort) -sizeof (abi_short) - +sizeof (struct target_in_addr )]; };struct target_sockaddr_in6 {
@@ -360,12 +360,12 @@ struct target_iovec { };struct target_msghdr { -abi_long msg_name;/* Socket name */ -int msg_namelen;/* Length of name */ -abi_long msg_iov;/* Data blocks */ -abi_long msg_iovlen;/* Number of blocks */ -abi_long msg_control;/* Per protocol magic (eg BSD file descriptor passing) */ -abi_long msg_controllen;/* Length of cmsg list */ +abi_long msg_name;/* Socket name */ +int msg_namelen;/* Length of name */ +abi_long msg_iov;/* Data blocks */ +abi_long msg_iovlen;/* Number of blocks */ +abi_long msg_control;/* Per protocol magic (eg BSD file descriptor passing) */ +abi_long msg_controllen;/* Length of cmsg list */ unsigned int msg_flags; };
@@ -376,10 +376,10 @@ struct target_cmsghdr { };#define TARGET_CMSG_DATA (cmsg) ((unsigned char *) ((struct target_cmsghdr *) (cmsg) + 1)) -#define TARGET_CMSG_NXTHDR (mhdr, cmsg, cmsg_start) \ - __target_cmsg_nxthdr(mhdr, cmsg, cmsg_start) -#define TARGET_CMSG_ALIGN (len) (((len) + sizeof (abi_long) - 1) \ - & (size_t) ~(sizeof (abi_long) - 1)) +#define TARGET_CMSG_NXTHDR (mhdr, cmsg, cmsg_start) \ + __target_cmsg_nxthdr(mhdr, cmsg, cmsg_start) +#define TARGET_CMSG_ALIGN (len) (((len) + sizeof (abi_long) - 1) \ + & (size_t) ~(sizeof (abi_long) - 1))#define TARGET_CMSG_SPACE (len) (sizeof(struct target_cmsghdr) + \ TARGET_CMSG_ALIGN(len))#define TARGET_CMSG_LEN (len) (sizeof(struct target_cmsghdr) + (len))
@@ -389,16 +389,16 @@ __target_cmsg_nxthdr(struct target_msghdr *__mhdr,struct target_cmsghdr *__cmsg, struct target_cmsghdr *__cmsg_start) { - struct target_cmsghdr *__ptr; + struct target_cmsghdr *__ptr; - __ptr = (struct target_cmsghdr *)((unsigned char *) __cmsg - +TARGET_CMSG_ALIGN (tswapal (__cmsg->cmsg_len))); -if ((unsigned long )((char *)(__ptr+1 ) - (char *)__cmsg_start) - >tswapal (__mhdr->msg_controllen)) { -/* No more entries. */ -return (struct target_cmsghdr *)0 ; - } -return __ptr; + __ptr = (struct target_cmsghdr *)((unsigned char *) __cmsg + +TARGET_CMSG_ALIGN (tswapal (__cmsg->cmsg_len))); +if ((unsigned long )((char *)(__ptr+1 ) - (char *)__cmsg_start) + >tswapal (__mhdr->msg_controllen)) { +/* No more entries. */ +return (struct target_cmsghdr *)0 ; + } +return __ptr; } struct target_mmsghdr {
@@ -407,55 +407,55 @@ struct target_mmsghdr { };struct target_rusage { -struct target_timeval ru_utime;/* user time used */ -struct target_timeval ru_stime;/* system time used */ -abi_long ru_maxrss;/* maximum resident set size */ -abi_long ru_ixrss;/* integral shared memory size */ -abi_long ru_idrss;/* integral unshared data size */ -abi_long ru_isrss;/* integral unshared stack size */ -abi_long ru_minflt;/* page reclaims */ -abi_long ru_majflt;/* page faults */ -abi_long ru_nswap;/* swaps */ -abi_long ru_inblock;/* block input operations */ -abi_long ru_oublock;/* block output operations */ -abi_long ru_msgsnd;/* messages sent */ -abi_long ru_msgrcv;/* messages received */ -abi_long ru_nsignals;/* signals received */ -abi_long ru_nvcsw;/* voluntary context switches */ -abi_long ru_nivcsw;/* involuntary " */ +struct target_timeval ru_utime;/* user time used */ +struct target_timeval ru_stime;/* system time used */ +abi_long ru_maxrss;/* maximum resident set size */ +abi_long ru_ixrss;/* integral shared memory size */ +abi_long ru_idrss;/* integral unshared data size */ +abi_long ru_isrss;/* integral unshared stack size */ +abi_long ru_minflt;/* page reclaims */ +abi_long ru_majflt;/* page faults */ +abi_long ru_nswap;/* swaps */ +abi_long ru_inblock;/* block input operations */ +abi_long ru_oublock;/* block output operations */ +abi_long ru_msgsnd;/* messages sent */ +abi_long ru_msgrcv;/* messages received */ +abi_long ru_nsignals;/* signals received */ +abi_long ru_nvcsw;/* voluntary context switches */ +abi_long ru_nivcsw;/* involuntary " */ };typedef struct { -int val[2 ]; +int val[2 ]; }kernel_fsid_t ;struct target_dirent { -abi_long d_ino; -abi_long d_off; -unsigned short d_reclen; -char d_name[]; +abi_long d_ino; +abi_long d_off; +unsigned short d_reclen; +char d_name[]; };struct target_dirent64 { -abi_ullong d_ino; -abi_llong d_off; -abi_ushort d_reclen; -unsigned char d_type; -char d_name[]; +abi_ullong d_ino; +abi_llong d_off; +abi_ushort d_reclen; +unsigned char d_type; +char d_name[]; };/* mostly generic signal stuff */ -#define TARGET_SIG_DFL ((abi_long)0)/* default signal handling */ -#define TARGET_SIG_IGN ((abi_long)1)/* ignore signal */ -#define TARGET_SIG_ERR ((abi_long)-1)/* error return from signal */ +#define TARGET_SIG_DFL ((abi_long)0)/* default signal handling */ +#define TARGET_SIG_IGN ((abi_long)1)/* ignore signal */ +#define TARGET_SIG_ERR ((abi_long)-1)/* error return from signal */ #ifdef TARGET_MIPS -#define TARGET_NSIG 128 +#define TARGET_NSIG 128#else -#define TARGET_NSIG 64 +#define TARGET_NSIG 64#endif -#define TARGET_NSIG_BPW TARGET_ABI_BITS +#define TARGET_NSIG_BPW TARGET_ABI_BITS#define TARGET_NSIG_WORDS (TARGET_NSIG / TARGET_NSIG_BPW) typedef struct {
@@ -508,71 +508,71 @@ typedef abi_ulong target_old_sa_flags;#if defined(TARGET_MIPS )struct target_sigaction { -uint32_t sa_flags; +uint32_t sa_flags;#if defined(TARGET_ABI_MIPSN32 ) -uint32_t _sa_handler; +uint32_t _sa_handler;#else -abi_ulong _sa_handler; +abi_ulong _sa_handler;#endif -target_sigset_t sa_mask; +target_sigset_t sa_mask;#ifdef TARGET_ARCH_HAS_SA_RESTORER -/* ??? This is always present, but ignored unless O32. */ -abi_ulong sa_restorer; +/* ??? This is always present, but ignored unless O32. */ +abi_ulong sa_restorer;#endif };#else struct target_old_sigaction { -abi_ulong _sa_handler; -abi_ulong sa_mask; -target_old_sa_flags sa_flags; +abi_ulong _sa_handler; +abi_ulong sa_mask; +target_old_sa_flags sa_flags;#ifdef TARGET_ARCH_HAS_SA_RESTORER -abi_ulong sa_restorer; +abi_ulong sa_restorer;#endif };struct target_sigaction { -abi_ulong _sa_handler; -abi_ulong sa_flags; +abi_ulong _sa_handler; +abi_ulong sa_flags;#ifdef TARGET_ARCH_HAS_SA_RESTORER -abi_ulong sa_restorer; +abi_ulong sa_restorer;#endif -target_sigset_t sa_mask; +target_sigset_t sa_mask;#ifdef TARGET_ARCH_HAS_KA_RESTORER -abi_ulong ka_restorer; +abi_ulong ka_restorer;#endif };#endif typedef union target_sigval { -int sival_int; -abi_ulong sival_ptr; +int sival_int; +abi_ulong sival_ptr; }target_sigval_t ;#if 0 #if defined (TARGET_SPARC )typedef struct { -struct { -abi_ulong psr; -abi_ulong pc; -abi_ulong npc; -abi_ulong y; -abi_ulong u_regs[16 ];/* globals and ins */ - } si_regs; -int si_mask; +struct { +abi_ulong psr; +abi_ulong pc; +abi_ulong npc; +abi_ulong y; +abi_ulong u_regs[16 ];/* globals and ins */ + } si_regs; +int si_mask; }__siginfo_t ;typedef struct { -unsigned long si_float_regs [32 ]; -unsigned long si_fsr; -unsigned long si_fpqdepth; -struct { -unsigned long *insn_addr; -unsigned long insn; - } si_fpqueue [16 ]; +unsigned long si_float_regs [32 ]; +unsigned long si_fsr; +unsigned long si_fpqdepth; +struct { +unsigned long *insn_addr; +unsigned long insn; + } si_fpqueue [16 ]; }__siginfo_fpu_t ;#endif #endif -#define TARGET_SI_MAX_SIZE 128 +#define TARGET_SI_MAX_SIZE 128#if TARGET_ABI_BITS ==32 #define TARGET_SI_PREAMBLE_SIZE (3 * sizeof(int))
@@ -599,82 +599,82 @@ typedef struct {typedef struct target_siginfo {#ifdef TARGET_MIPS -int si_signo; -int si_code; -int si_errno; +int si_signo; +int si_code; +int si_errno;#else -int si_signo; -int si_errno; -int si_code; +int si_signo; +int si_errno; +int si_code;#endif -union { -int _pad[TARGET_SI_PAD_SIZE ]; +union { +int _pad[TARGET_SI_PAD_SIZE ]; -/* kill() */ -struct { -pid_t _pid;/* sender's pid */ -uid_t _uid;/* sender's uid */ - } _kill; +/* kill() */ +struct { +pid_t _pid;/* sender's pid */ +uid_t _uid;/* sender's uid */ + } _kill; -/* POSIX.1b timers */ -struct { -unsigned int _timer1; -unsigned int _timer2; - } _timer; +/* POSIX.1b timers */ +struct { +unsigned int _timer1; +unsigned int _timer2; + } _timer; -/* POSIX.1b signals */ -struct { -pid_t _pid;/* sender's pid */ -uid_t _uid;/* sender's uid */ -target_sigval_t _sigval; - } _rt; +/* POSIX.1b signals */ +struct { +pid_t _pid;/* sender's pid */ +uid_t _uid;/* sender's uid */ +target_sigval_t _sigval; + } _rt; -/* SIGCHLD */ -struct { -pid_t _pid;/* which child */ -uid_t _uid;/* sender's uid */ -int _status;/* exit code */ -target_clock_t _utime; -target_clock_t _stime; - } _sigchld; +/* SIGCHLD */ +struct { +pid_t _pid;/* which child */ +uid_t _uid;/* sender's uid */ +int _status;/* exit code */ +target_clock_t _utime; +target_clock_t _stime; + } _sigchld; -/* SIGILL, SIGFPE, SIGSEGV, SIGBUS */ -struct { -abi_ulong _addr;/* faulting insn/memory ref. */ - } _sigfault; +/* SIGILL, SIGFPE, SIGSEGV, SIGBUS */ +struct { +abi_ulong _addr;/* faulting insn/memory ref. */ + } _sigfault; -/* SIGPOLL */ -struct { -int _band;/* POLL_IN, POLL_OUT, POLL_MSG */ -int _fd; - } _sigpoll; - } _sifields; +/* SIGPOLL */ +struct { +int _band;/* POLL_IN, POLL_OUT, POLL_MSG */ +int _fd; + } _sigpoll; + } _sifields; }target_siginfo_t ;/* * si_code values * Digital reserves positive values for kernel-generated signals. */ -#define TARGET_SI_USER 0/* sent by kill, sigsend, raise */ -#define TARGET_SI_KERNEL 0x80/* sent by the kernel from somewhere */ -#define TARGET_SI_QUEUE -1/* sent by sigqueue */ +#define TARGET_SI_USER 0/* sent by kill, sigsend, raise */ +#define TARGET_SI_KERNEL 0x80/* sent by the kernel from somewhere */ +#define TARGET_SI_QUEUE -1/* sent by sigqueue */ #define TARGET_SI_TIMER -2/* sent by timer expiration */ -#define TARGET_SI_MESGQ -3/* sent by real time mesq state change */ -#define TARGET_SI_ASYNCIO -4/* sent by AIO completion */ -#define TARGET_SI_SIGIO -5/* sent by queued SIGIO */ +#define TARGET_SI_MESGQ -3/* sent by real time mesq state change */ +#define TARGET_SI_ASYNCIO -4/* sent by AIO completion */ +#define TARGET_SI_SIGIO -5/* sent by queued SIGIO */ /* * SIGILL si_codes */ -#define TARGET_ILL_ILLOPC (1)/* illegal opcode */ -#define TARGET_ILL_ILLOPN (2)/* illegal operand */ -#define TARGET_ILL_ILLADR (3)/* illegal addressing mode */ -#define TARGET_ILL_ILLTRP (4)/* illegal trap */ -#define TARGET_ILL_PRVOPC (5)/* privileged opcode */ -#define TARGET_ILL_PRVREG (6)/* privileged register */ -#define TARGET_ILL_COPROC (7)/* coprocessor error */ -#define TARGET_ILL_BADSTK (8)/* internal stack error */ +#define TARGET_ILL_ILLOPC (1)/* illegal opcode */ +#define TARGET_ILL_ILLOPN (2)/* illegal operand */ +#define TARGET_ILL_ILLADR (3)/* illegal addressing mode */ +#define TARGET_ILL_ILLTRP (4)/* illegal trap */ +#define TARGET_ILL_PRVOPC (5)/* privileged opcode */ +#define TARGET_ILL_PRVREG (6)/* privileged register */ +#define TARGET_ILL_COPROC (7)/* coprocessor error */ +#define TARGET_ILL_BADSTK (8)/* internal stack error */ /* * SIGFPE si_codes
@@ -700,9 +700,9 @@ typedef struct target_siginfo {/* * SIGBUS si_codes */ -#define TARGET_BUS_ADRALN (1)/* invalid address alignment */ -#define TARGET_BUS_ADRERR (2)/* non-existent physical address */ -#define TARGET_BUS_OBJERR (3)/* object specific hardware error */ +#define TARGET_BUS_ADRALN (1)/* invalid address alignment */ +#define TARGET_BUS_ADRERR (2)/* non-existent physical address */ +#define TARGET_BUS_OBJERR (3)/* object specific hardware error */ /* hardware memory error consumed on a machine check: action required */ #define TARGET_BUS_MCEERR_AR (4)/* hardware memory error detected in process but not consumed: action optional*/
@@ -711,8 +711,8 @@ typedef struct target_siginfo {/* * SIGTRAP si_codes */ -#define TARGET_TRAP_BRKPT (1)/* process breakpoint */ -#define TARGET_TRAP_TRACE (2)/* process trace trap */ +#define TARGET_TRAP_BRKPT (1)/* process breakpoint */ +#define TARGET_TRAP_TRACE (2)/* process trace trap */ #define TARGET_TRAP_BRANCH (3)/* process taken branch trap */ #define TARGET_TRAP_HWBKPT (4)/* hardware breakpoint/watchpoint */ #define TARGET_TRAP_UNK (5)/* undiagnosed trap */
@@ -731,18 +731,18 @@ struct target_pollfd { };/* virtual terminal ioctls */ -#define TARGET_KIOCSOUND 0x4B2F/* start sound generation (0 for off) */ -#define TARGET_KDMKTONE 0x4B30/* generate tone */ +#define TARGET_KIOCSOUND 0x4B2F/* start sound generation (0 for off) */ +#define TARGET_KDMKTONE 0x4B30/* generate tone */ #define TARGET_KDGKBTYPE 0x4b33#define TARGET_KDSETMODE 0x4b3a#define TARGET_KDGKBMODE 0x4b44#define TARGET_KDSKBMODE 0x4b45 -#define TARGET_KDGKBENT 0x4B46/* gets one entry in translation table */ -#define TARGET_KDGKBSENT 0x4B48/* gets one function key string entry */ -#define TARGET_KDGKBLED 0x4B64/* get led flags (not lights) */ -#define TARGET_KDSKBLED 0x4B65/* set led flags (not lights) */ -#define TARGET_KDGETLED 0x4B31/* return current led state */ -#define TARGET_KDSETLED 0x4B32/* set led state [lights, not flags] */ +#define TARGET_KDGKBENT 0x4B46/* gets one entry in translation table */ +#define TARGET_KDGKBSENT 0x4B48/* gets one function key string entry */ +#define TARGET_KDGKBLED 0x4B64/* get led flags (not lights) */ +#define TARGET_KDSKBLED 0x4B65/* set led flags (not lights) */ +#define TARGET_KDGETLED 0x4B31/* return current led state */ +#define TARGET_KDSETLED 0x4B32/* set led state [lights, not flags] */ #define TARGET_KDSIGACCEPT 0x4B4Estruct target_rtc_pll_info {
@@ -774,15 +774,15 @@ struct target_rtc_pll_info {#define TARGET_RTC_EPOCH_SET TARGET_IOW('p', 0x0e, abi_ulong)#define TARGET_RTC_WKALM_RD TARGET_IOR('p', 0x10, struct rtc_wkalrm)#define TARGET_RTC_WKALM_SET TARGET_IOW('p', 0x0f, struct rtc_wkalrm) -#define TARGET_RTC_PLL_GET TARGET_IOR('p', 0x11, \ +#define TARGET_RTC_PLL_GET TARGET_IOR('p', 0x11, \ struct target_rtc_pll_info) -#define TARGET_RTC_PLL_SET TARGET_IOW('p', 0x12, \ +#define TARGET_RTC_PLL_SET TARGET_IOW('p', 0x12, \ struct target_rtc_pll_info)#define TARGET_RTC_VL_READ TARGET_IOR('p', 0x13, int)#define TARGET_RTC_VL_CLR TARGET_IO('p', 0x14) -#if defined(TARGET_ALPHA ) || defined(TARGET_MIPS ) || defined(TARGET_SH4 ) || \ - defined(TARGET_XTENSA ) +#if defined(TARGET_ALPHA ) || defined(TARGET_MIPS ) || defined(TARGET_SH4 ) || \ + defined(TARGET_XTENSA )#define TARGET_FIOGETOWN TARGET_IOR('f', 123, int)#define TARGET_FIOSETOWN TARGET_IOW('f', 124, int)#define TARGET_SIOCATMARK TARGET_IOR('s', 7, int)
@@ -932,8 +932,8 @@ struct target_rtc_pll_info {#define TARGET_BLKBSZGET TARGET_IOR(0x12, 112, abi_ulong)#define TARGET_BLKBSZSET TARGET_IOW(0x12, 113, abi_ulong)#define TARGET_BLKGETSIZE64 TARGET_IOR(0x12,114,abi_ulong) -/* return device size in bytes -(u64 *arg) */ +/* return device size in bytes +(u64 *arg) */ #define TARGET_BLKDISCARD TARGET_IO(0x12, 119)#define TARGET_BLKIOMIN TARGET_IO(0x12, 120)
@@ -991,11 +991,11 @@ struct target_rtc_pll_info {#define TARGET_BTRFS_IOC_SUBVOL_CREATE TARGET_IOWU(BTRFS_IOCTL_MAGIC, 14)#define TARGET_BTRFS_IOC_SNAP_DESTROY TARGET_IOWU(BTRFS_IOCTL_MAGIC, 15)#define TARGET_BTRFS_IOC_INO_LOOKUP TARGET_IOWRU(BTRFS_IOCTL_MAGIC, 18) -#define TARGET_BTRFS_IOC_DEFAULT_SUBVOL TARGET_IOW(BTRFS_IOCTL_MAGIC, 19,\ +#define TARGET_BTRFS_IOC_DEFAULT_SUBVOL TARGET_IOW(BTRFS_IOCTL_MAGIC, 19, \ abi_ullong) -#define TARGET_BTRFS_IOC_SUBVOL_GETFLAGS TARGET_IOR(BTRFS_IOCTL_MAGIC, 25,\ +#define TARGET_BTRFS_IOC_SUBVOL_GETFLAGS TARGET_IOR(BTRFS_IOCTL_MAGIC, 25, \ abi_ullong) -#define TARGET_BTRFS_IOC_SUBVOL_SETFLAGS TARGET_IOW(BTRFS_IOCTL_MAGIC, 26,\ +#define TARGET_BTRFS_IOC_SUBVOL_SETFLAGS TARGET_IOW(BTRFS_IOCTL_MAGIC, 26, \ abi_ullong)#define TARGET_BTRFS_IOC_SCRUB TARGET_IOWRU(BTRFS_IOCTL_MAGIC, 27)#define TARGET_BTRFS_IOC_SCRUB_CANCEL TARGET_IO(BTRFS_IOCTL_MAGIC, 28)
@@ -1049,56 +1049,56 @@ struct target_rtc_pll_info {#define TARGET_USBDEVFS_GET_SPEED TARGET_IO('U', 31)/* cdrom commands */ -#define TARGET_CDROMPAUSE 0x5301/* Pause Audio Operation */ -#define TARGET_CDROMRESUME 0x5302/* Resume paused Audio Operation */ -#define TARGET_CDROMPLAYMSF 0x5303/* Play Audio MSF (struct cdrom_msf) */ -#define TARGET_CDROMPLAYTRKIND 0x5304/* Play Audio Track/index -(struct cdrom_ti) */ -#define TARGET_CDROMREADTOCHDR 0x5305/* Read TOC header -(struct cdrom_tochdr) */ -#define TARGET_CDROMREADTOCENTRY 0x5306/* Read TOC entry -(struct cdrom_tocentry) */ -#define TARGET_CDROMSTOP 0x5307/* Stop the cdrom drive */ -#define TARGET_CDROMSTART 0x5308/* Start the cdrom drive */ -#define TARGET_CDROMEJECT 0x5309/* Ejects the cdrom media */ -#define TARGET_CDROMVOLCTRL 0x530a/* Control output volume -(struct cdrom_volctrl) */ -#define TARGET_CDROMSUBCHNL 0x530b/* Read subchannel data -(struct cdrom_subchnl) */ -#define TARGET_CDROMREADMODE2 0x530c/* Read TARGET_CDROM mode 2 data (2336 Bytes) -(struct cdrom_read) */ -#define TARGET_CDROMREADMODE1 0x530d/* Read TARGET_CDROM mode 1 data (2048 Bytes) -(struct cdrom_read) */ -#define TARGET_CDROMREADAUDIO 0x530e/* (struct cdrom_read_audio) */ -#define TARGET_CDROMEJECT_SW 0x530f/* enable(1)/disable(0) auto-ejecting */ -#define TARGET_CDROMMULTISESSION 0x5310/* Obtain the start-of-last-session -address of multi session disks -(struct cdrom_multisession) */ -#define TARGET_CDROM_GET_MCN 0x5311/* Obtain the "Universal Product Code" -if available (struct cdrom_mcn) */ -#define TARGET_CDROM_GET_UPC TARGET_CDROM_GET_MCN/* This one is deprecated, -but here anyway for compatibility */ -#define TARGET_CDROMRESET 0x5312/* hard-reset the drive */ -#define TARGET_CDROMVOLREAD 0x5313/* Get the drive's volume setting -(struct cdrom_volctrl) */ -#define TARGET_CDROMREADRAW 0x5314/* read data in raw mode (2352 Bytes) -(struct cdrom_read) */ +#define TARGET_CDROMPAUSE 0x5301/* Pause Audio Operation */ +#define TARGET_CDROMRESUME 0x5302/* Resume paused Audio Operation */ +#define TARGET_CDROMPLAYMSF 0x5303/* Play Audio MSF (struct cdrom_msf) */ +#define TARGET_CDROMPLAYTRKIND 0x5304/* Play Audio Track/index +(struct cdrom_ti) */ +#define TARGET_CDROMREADTOCHDR 0x5305/* Read TOC header +(struct cdrom_tochdr) */ +#define TARGET_CDROMREADTOCENTRY 0x5306/* Read TOC entry +(struct cdrom_tocentry) */ +#define TARGET_CDROMSTOP 0x5307/* Stop the cdrom drive */ +#define TARGET_CDROMSTART 0x5308/* Start the cdrom drive */ +#define TARGET_CDROMEJECT 0x5309/* Ejects the cdrom media */ +#define TARGET_CDROMVOLCTRL 0x530a/* Control output volume +(struct cdrom_volctrl) */ +#define TARGET_CDROMSUBCHNL 0x530b/* Read subchannel data +(struct cdrom_subchnl) */ +#define TARGET_CDROMREADMODE2 0x530c/* Read TARGET_CDROM mode 2 data (2336 Bytes) +(struct cdrom_read) */ +#define TARGET_CDROMREADMODE1 0x530d/* Read TARGET_CDROM mode 1 data (2048 Bytes) +(struct cdrom_read) */ +#define TARGET_CDROMREADAUDIO 0x530e/* (struct cdrom_read_audio) */ +#define TARGET_CDROMEJECT_SW 0x530f/* enable(1)/disable(0) auto-ejecting */ +#define TARGET_CDROMMULTISESSION 0x5310/* Obtain the start-of-last-session +address of multi session disks +(struct cdrom_multisession) */ +#define TARGET_CDROM_GET_MCN 0x5311/* Obtain the "Universal Product Code" +if available (struct cdrom_mcn) */ +#define TARGET_CDROM_GET_UPC TARGET_CDROM_GET_MCN/* This one is deprecated, +but here anyway for compatibility */ +#define TARGET_CDROMRESET 0x5312/* hard-reset the drive */ +#define TARGET_CDROMVOLREAD 0x5313/* Get the drive's volume setting +(struct cdrom_volctrl) */ +#define TARGET_CDROMREADRAW 0x5314/* read data in raw mode (2352 Bytes) +(struct cdrom_read) */ /* * These ioctls are used only used in aztcd.c and optcd.c */ -#define TARGET_CDROMREADCOOKED 0x5315/* read data in cooked mode */ -#define TARGET_CDROMSEEK 0x5316/* seek msf address */ +#define TARGET_CDROMREADCOOKED 0x5315/* read data in cooked mode */ +#define TARGET_CDROMSEEK 0x5316/* seek msf address */ /* * This ioctl is only used by the scsi-cd driver. -It is for playing audio in logical block addressing mode. -*/ -#define TARGET_CDROMPLAYBLK 0x5317/* (struct cdrom_blk) */ +It is for playing audio in logical block addressing mode. +*/ +#define TARGET_CDROMPLAYBLK 0x5317/* (struct cdrom_blk) */ /* * These ioctls are only used in optcd.c */ -#define TARGET_CDROMREADALL 0x5318/* read all 2646 bytes */ +#define TARGET_CDROMREADALL 0x5318/* read all 2646 bytes */ /* * These ioctls are (now) only in ide-cd.c for controlling
@@ -1115,35 +1115,35 @@ struct target_rtc_pll_info {* They _will_ be adopted by all CD-ROM drivers, when all the CD-ROM * drivers are eventually ported to the uniform CD-ROM driver interface. */ -#define TARGET_CDROMCLOSETRAY 0x5319/* pendant of CDROMEJECT */ -#define TARGET_CDROM_SET_OPTIONS 0x5320/* Set behavior options */ -#define TARGET_CDROM_CLEAR_OPTIONS 0x5321/* Clear behavior options */ -#define TARGET_CDROM_SELECT_SPEED 0x5322/* Set the CD-ROM speed */ -#define TARGET_CDROM_SELECT_DISC 0x5323/* Select disc (for juke-boxes) */ -#define TARGET_CDROM_MEDIA_CHANGED 0x5325/* Check is media changed */ -#define TARGET_CDROM_DRIVE_STATUS 0x5326/* Get tray position, etc. */ -#define TARGET_CDROM_DISC_STATUS 0x5327/* Get disc type, etc. */ +#define TARGET_CDROMCLOSETRAY 0x5319/* pendant of CDROMEJECT */ +#define TARGET_CDROM_SET_OPTIONS 0x5320/* Set behavior options */ +#define TARGET_CDROM_CLEAR_OPTIONS 0x5321/* Clear behavior options */ +#define TARGET_CDROM_SELECT_SPEED 0x5322/* Set the CD-ROM speed */ +#define TARGET_CDROM_SELECT_DISC 0x5323/* Select disc (for juke-boxes) */ +#define TARGET_CDROM_MEDIA_CHANGED 0x5325/* Check is media changed */ +#define TARGET_CDROM_DRIVE_STATUS 0x5326/* Get tray position, etc. */ +#define TARGET_CDROM_DISC_STATUS 0x5327/* Get disc type, etc. */ #define TARGET_CDROM_CHANGER_NSLOTS 0x5328/* Get number of slots */ -#define TARGET_CDROM_LOCKDOOR 0x5329/* lock or unlock door */ -#define TARGET_CDROM_DEBUG 0x5330/* Turn debug messages on/off */ -#define TARGET_CDROM_GET_CAPABILITY 0x5331/* get capabilities */ +#define TARGET_CDROM_LOCKDOOR 0x5329/* lock or unlock door */ +#define TARGET_CDROM_DEBUG 0x5330/* Turn debug messages on/off */ +#define TARGET_CDROM_GET_CAPABILITY 0x5331/* get capabilities */ /* Note that scsi/scsi_ioctl.h also uses 0x5382 - 0x5386. * Future CDROM ioctls should be kept below 0x537F */ /* This ioctl is only used by sbpcd at the moment */ -#define TARGET_CDROMAUDIOBUFSIZ 0x5382/* set the audio buffer size */ -/* conflict with SCSI_IOCTL_GET_IDLUN */ +#define TARGET_CDROMAUDIOBUFSIZ 0x5382/* set the audio buffer size */ +/* conflict with SCSI_IOCTL_GET_IDLUN */ /* DVD-ROM Specific ioctls */ -#define TARGET_DVD_READ_STRUCT 0x5390/* Read structure */ -#define TARGET_DVD_WRITE_STRUCT 0x5391/* Write structure */ -#define TARGET_DVD_AUTH 0x5392/* Authentication */ +#define TARGET_DVD_READ_STRUCT 0x5390/* Read structure */ +#define TARGET_DVD_WRITE_STRUCT 0x5391/* Write structure */ +#define TARGET_DVD_AUTH 0x5392/* Authentication */ -#define TARGET_CDROM_SEND_PACKET 0x5393/* send a packet to the drive */ -#define TARGET_CDROM_NEXT_WRITABLE 0x5394/* get next writable block */ -#define TARGET_CDROM_LAST_WRITTEN 0x5395/* get last block written on disc */ +#define TARGET_CDROM_SEND_PACKET 0x5393/* send a packet to the drive */ +#define TARGET_CDROM_NEXT_WRITABLE 0x5394/* get next writable block */ +#define TARGET_CDROM_LAST_WRITTEN 0x5395/* get last block written on disc */ /* HD commands */
@@ -1234,19 +1234,19 @@ struct target_rtc_pll_info {#define TARGET_NCC 8struct target_termio { -unsigned short c_iflag;/* input mode flags */ -unsigned short c_oflag;/* output mode flags */ -unsigned short c_cflag;/* control mode flags */ -unsigned short c_lflag;/* local mode flags */ -unsigned char c_line;/* line discipline */ -unsigned char c_cc[TARGET_NCC ];/* control characters */ +unsigned short c_iflag;/* input mode flags */ +unsigned short c_oflag;/* output mode flags */ +unsigned short c_cflag;/* control mode flags */ +unsigned short c_lflag;/* local mode flags */ +unsigned char c_line;/* line discipline */ +unsigned char c_cc[TARGET_NCC ];/* control characters */ };struct target_winsize { -unsigned short ws_row; -unsigned short ws_col; -unsigned short ws_xpixel; -unsigned short ws_ypixel; +unsigned short ws_row; +unsigned short ws_col; +unsigned short ws_xpixel; +unsigned short ws_ypixel; };#include "termbits.h"
@@ -1263,115 +1263,115 @@ struct target_winsize {#endif /* Common */ -#define TARGET_MAP_SHARED 0x01/* Share changes */ -#define TARGET_MAP_PRIVATE 0x02/* Changes are private */ +#define TARGET_MAP_SHARED 0x01/* Share changes */ +#define TARGET_MAP_PRIVATE 0x02/* Changes are private */ #if defined(TARGET_HPPA ) -#define TARGET_MAP_TYPE 0x03/* Mask for type of mapping */ +#define TARGET_MAP_TYPE 0x03/* Mask for type of mapping */ #else -#define TARGET_MAP_TYPE 0x0f/* Mask for type of mapping */ +#define TARGET_MAP_TYPE 0x0f/* Mask for type of mapping */ #endif /* Target specific */ #if defined(TARGET_MIPS ) -#define TARGET_MAP_FIXED 0x10/* Interpret addr exactly */ -#define TARGET_MAP_ANONYMOUS 0x0800/* don't use a file */ -#define TARGET_MAP_GROWSDOWN 0x1000/* stack-like segment */ -#define TARGET_MAP_DENYWRITE 0x2000/* ETXTBSY */ -#define TARGET_MAP_EXECUTABLE 0x4000/* mark it as an executable */ -#define TARGET_MAP_LOCKED 0x8000/* pages are locked */ -#define TARGET_MAP_NORESERVE 0x0400/* don't check for reservations */ -#define TARGET_MAP_POPULATE 0x10000/* populate (prefault) pagetables */ -#define TARGET_MAP_NONBLOCK 0x20000/* do not block on IO */ +#define TARGET_MAP_FIXED 0x10/* Interpret addr exactly */ +#define TARGET_MAP_ANONYMOUS 0x0800/* don't use a file */ +#define TARGET_MAP_GROWSDOWN 0x1000/* stack-like segment */ +#define TARGET_MAP_DENYWRITE 0x2000/* ETXTBSY */ +#define TARGET_MAP_EXECUTABLE 0x4000/* mark it as an executable */ +#define TARGET_MAP_LOCKED 0x8000/* pages are locked */ +#define TARGET_MAP_NORESERVE 0x0400/* don't check for reservations */ +#define TARGET_MAP_POPULATE 0x10000/* populate (prefault) pagetables */ +#define TARGET_MAP_NONBLOCK 0x20000/* do not block on IO */ #define TARGET_MAP_STACK 0x40000/* ignored */ #define TARGET_MAP_HUGETLB 0x80000/* create a huge page mapping */ #elif defined(TARGET_PPC ) -#define TARGET_MAP_FIXED 0x10/* Interpret addr exactly */ -#define TARGET_MAP_ANONYMOUS 0x20/* don't use a file */ -#define TARGET_MAP_GROWSDOWN 0x0100/* stack-like segment */ -#define TARGET_MAP_DENYWRITE 0x0800/* ETXTBSY */ -#define TARGET_MAP_EXECUTABLE 0x1000/* mark it as an executable */ -#define TARGET_MAP_LOCKED 0x0080/* pages are locked */ -#define TARGET_MAP_NORESERVE 0x0040/* don't check for reservations */ -#define TARGET_MAP_POPULATE 0x8000/* populate (prefault) pagetables */ -#define TARGET_MAP_NONBLOCK 0x10000/* do not block on IO */ +#define TARGET_MAP_FIXED 0x10/* Interpret addr exactly */ +#define TARGET_MAP_ANONYMOUS 0x20/* don't use a file */ +#define TARGET_MAP_GROWSDOWN 0x0100/* stack-like segment */ +#define TARGET_MAP_DENYWRITE 0x0800/* ETXTBSY */ +#define TARGET_MAP_EXECUTABLE 0x1000/* mark it as an executable */ +#define TARGET_MAP_LOCKED 0x0080/* pages are locked */ +#define TARGET_MAP_NORESERVE 0x0040/* don't check for reservations */ +#define TARGET_MAP_POPULATE 0x8000/* populate (prefault) pagetables */ +#define TARGET_MAP_NONBLOCK 0x10000/* do not block on IO */ #define TARGET_MAP_STACK 0x20000/* ignored */ #define TARGET_MAP_HUGETLB 0x40000/* create a huge page mapping */ #elif defined(TARGET_ALPHA ) -#define TARGET_MAP_ANONYMOUS 0x10/* don't use a file */ -#define TARGET_MAP_FIXED 0x100/* Interpret addr exactly */ -#define TARGET_MAP_GROWSDOWN 0x01000/* stack-like segment */ -#define TARGET_MAP_DENYWRITE 0x02000/* ETXTBSY */ -#define TARGET_MAP_EXECUTABLE 0x04000/* mark it as an executable */ -#define TARGET_MAP_LOCKED 0x08000/* lock the mapping */ -#define TARGET_MAP_NORESERVE 0x10000/* no check for reservations */ -#define TARGET_MAP_POPULATE 0x20000/* pop (prefault) pagetables */ -#define TARGET_MAP_NONBLOCK 0x40000/* do not block on IO */ +#define TARGET_MAP_ANONYMOUS 0x10/* don't use a file */ +#define TARGET_MAP_FIXED 0x100/* Interpret addr exactly */ +#define TARGET_MAP_GROWSDOWN 0x01000/* stack-like segment */ +#define TARGET_MAP_DENYWRITE 0x02000/* ETXTBSY */ +#define TARGET_MAP_EXECUTABLE 0x04000/* mark it as an executable */ +#define TARGET_MAP_LOCKED 0x08000/* lock the mapping */ +#define TARGET_MAP_NORESERVE 0x10000/* no check for reservations */ +#define TARGET_MAP_POPULATE 0x20000/* pop (prefault) pagetables */ +#define TARGET_MAP_NONBLOCK 0x40000/* do not block on IO */ #define TARGET_MAP_STACK 0x80000/* ignored */ #define TARGET_MAP_HUGETLB 0x100000/* create a huge page mapping */ #elif defined(TARGET_HPPA ) -#define TARGET_MAP_ANONYMOUS 0x10/* don't use a file */ -#define TARGET_MAP_FIXED 0x04/* Interpret addr exactly */ -#define TARGET_MAP_GROWSDOWN 0x08000/* stack-like segment */ -#define TARGET_MAP_DENYWRITE 0x00800/* ETXTBSY */ -#define TARGET_MAP_EXECUTABLE 0x01000/* mark it as an executable */ -#define TARGET_MAP_LOCKED 0x02000/* lock the mapping */ -#define TARGET_MAP_NORESERVE 0x04000/* no check for reservations */ -#define TARGET_MAP_POPULATE 0x10000/* pop (prefault) pagetables */ -#define TARGET_MAP_NONBLOCK 0x20000/* do not block on IO */ +#define TARGET_MAP_ANONYMOUS 0x10/* don't use a file */ +#define TARGET_MAP_FIXED 0x04/* Interpret addr exactly */ +#define TARGET_MAP_GROWSDOWN 0x08000/* stack-like segment */ +#define TARGET_MAP_DENYWRITE 0x00800/* ETXTBSY */ +#define TARGET_MAP_EXECUTABLE 0x01000/* mark it as an executable */ +#define TARGET_MAP_LOCKED 0x02000/* lock the mapping */ +#define TARGET_MAP_NORESERVE 0x04000/* no check for reservations */ +#define TARGET_MAP_POPULATE 0x10000/* pop (prefault) pagetables */ +#define TARGET_MAP_NONBLOCK 0x20000/* do not block on IO */ #define TARGET_MAP_STACK 0x40000/* ignored */ #define TARGET_MAP_HUGETLB 0x80000/* create a huge page mapping */ #elif defined(TARGET_XTENSA ) -#define TARGET_MAP_FIXED 0x10/* Interpret addr exactly */ -#define TARGET_MAP_ANONYMOUS 0x0800/* don't use a file */ -#define TARGET_MAP_GROWSDOWN 0x1000/* stack-like segment */ -#define TARGET_MAP_DENYWRITE 0x2000/* ETXTBSY */ -#define TARGET_MAP_EXECUTABLE 0x4000/* mark it as an executable */ -#define TARGET_MAP_LOCKED 0x8000/* pages are locked */ -#define TARGET_MAP_NORESERVE 0x0400/* don't check for reservations */ -#define TARGET_MAP_POPULATE 0x10000/* populate (prefault) pagetables */ -#define TARGET_MAP_NONBLOCK 0x20000/* do not block on IO */ -#define TARGET_MAP_STACK 0x40000 +#define TARGET_MAP_FIXED 0x10/* Interpret addr exactly */ +#define TARGET_MAP_ANONYMOUS 0x0800/* don't use a file */ +#define TARGET_MAP_GROWSDOWN 0x1000/* stack-like segment */ +#define TARGET_MAP_DENYWRITE 0x2000/* ETXTBSY */ +#define TARGET_MAP_EXECUTABLE 0x4000/* mark it as an executable */ +#define TARGET_MAP_LOCKED 0x8000/* pages are locked */ +#define TARGET_MAP_NORESERVE 0x0400/* don't check for reservations */ +#define TARGET_MAP_POPULATE 0x10000/* populate (prefault) pagetables */ +#define TARGET_MAP_NONBLOCK 0x20000/* do not block on IO */ +#define TARGET_MAP_STACK 0x40000#define TARGET_MAP_HUGETLB 0x80000/* create a huge page mapping */ #else -#define TARGET_MAP_FIXED 0x10/* Interpret addr exactly */ -#define TARGET_MAP_ANONYMOUS 0x20/* don't use a file */ -#define TARGET_MAP_GROWSDOWN 0x0100/* stack-like segment */ -#define TARGET_MAP_DENYWRITE 0x0800/* ETXTBSY */ -#define TARGET_MAP_EXECUTABLE 0x1000/* mark it as an executable */ -#define TARGET_MAP_LOCKED 0x2000/* pages are locked */ -#define TARGET_MAP_NORESERVE 0x4000/* don't check for reservations */ -#define TARGET_MAP_POPULATE 0x8000/* populate (prefault) pagetables */ -#define TARGET_MAP_NONBLOCK 0x10000/* do not block on IO */ +#define TARGET_MAP_FIXED 0x10/* Interpret addr exactly */ +#define TARGET_MAP_ANONYMOUS 0x20/* don't use a file */ +#define TARGET_MAP_GROWSDOWN 0x0100/* stack-like segment */ +#define TARGET_MAP_DENYWRITE 0x0800/* ETXTBSY */ +#define TARGET_MAP_EXECUTABLE 0x1000/* mark it as an executable */ +#define TARGET_MAP_LOCKED 0x2000/* pages are locked */ +#define TARGET_MAP_NORESERVE 0x4000/* don't check for reservations */ +#define TARGET_MAP_POPULATE 0x8000/* populate (prefault) pagetables */ +#define TARGET_MAP_NONBLOCK 0x10000/* do not block on IO */ #define TARGET_MAP_STACK 0x20000/* ignored */ #define TARGET_MAP_HUGETLB 0x40000/* create a huge page mapping */ -#define TARGET_MAP_UNINITIALIZED 0x4000000/* for anonymous mmap, memory could be uninitialized */ +#define TARGET_MAP_UNINITIALIZED 0x4000000/* for anonymous mmap, memory could be uninitialized */ #endif -#if (defined(TARGET_I386 ) && defined(TARGET_ABI32 )) \ - || (defined(TARGET_ARM ) && defined(TARGET_ABI32 )) \ +#if (defined(TARGET_I386 ) && defined(TARGET_ABI32 )) \ + || (defined(TARGET_ARM ) && defined(TARGET_ABI32 )) \ || defined(TARGET_CRIS )#define TARGET_STAT_HAVE_NSEC struct target_stat { -unsigned short st_dev; -unsigned short __pad1; -abi_ulong st_ino; -unsigned short st_mode; -unsigned short st_nlink; -unsigned short st_uid; -unsigned short st_gid; -unsigned short st_rdev; -unsigned short __pad2; -abi_ulong st_size; -abi_ulong st_blksize; -abi_ulong st_blocks; -abi_ulong target_st_atime; -abi_ulong target_st_atime_nsec; -abi_ulong target_st_mtime; -abi_ulong target_st_mtime_nsec; -abi_ulong target_st_ctime; -abi_ulong target_st_ctime_nsec; -abi_ulong __unused4; -abi_ulong __unused5; +unsigned short st_dev; +unsigned short __pad1; +abi_ulong st_ino; +unsigned short st_mode; +unsigned short st_nlink; +unsigned short st_uid; +unsigned short st_gid; +unsigned short st_rdev; +unsigned short __pad2; +abi_ulong st_size; +abi_ulong st_blksize; +abi_ulong st_blocks; +abi_ulong target_st_atime; +abi_ulong target_st_atime_nsec; +abi_ulong target_st_mtime; +abi_ulong target_st_mtime_nsec; +abi_ulong target_st_ctime; +abi_ulong target_st_ctime_nsec; +abi_ulong __unused4; +abi_ulong __unused5; };/* This matches struct stat64 in glibc2.1, hence the absolutely
@@ -1379,239 +1379,239 @@ struct target_stat {*/ #define TARGET_HAS_STRUCT_STAT64 struct target_stat64 { -unsigned short st_dev; -unsigned char __pad0[10 ]; +unsigned short st_dev; +unsigned char __pad0[10 ]; -#define TARGET_STAT64_HAS_BROKEN_ST_INO 1 -abi_ulong __st_ino; +#define TARGET_STAT64_HAS_BROKEN_ST_INO 1 +abi_ulong __st_ino; -unsigned int st_mode; -unsigned int st_nlink; +unsigned int st_mode; +unsigned int st_nlink; -abi_ulong st_uid; -abi_ulong st_gid; +abi_ulong st_uid; +abi_ulong st_gid; -unsigned short st_rdev; -unsigned char __pad3[10 ]; +unsigned short st_rdev; +unsigned char __pad3[10 ]; -long long st_size; -abi_ulong st_blksize; +long long st_size; +abi_ulong st_blksize; -abi_ulong st_blocks;/* Number 512-byte blocks allocated. */ -abi_ulong __pad4;/* future possible st_blocks high bits */ +abi_ulong st_blocks;/* Number 512-byte blocks allocated. */ +abi_ulong __pad4;/* future possible st_blocks high bits */ -abi_ulong target_st_atime; -abi_ulong target_st_atime_nsec; +abi_ulong target_st_atime; +abi_ulong target_st_atime_nsec; -abi_ulong target_st_mtime; -abi_ulong target_st_mtime_nsec; +abi_ulong target_st_mtime; +abi_ulong target_st_mtime_nsec; -abi_ulong target_st_ctime; -abi_ulong target_st_ctime_nsec; +abi_ulong target_st_ctime; +abi_ulong target_st_ctime_nsec; -unsigned long long st_ino; +unsigned long long st_ino; }QEMU_PACKED ;#ifdef TARGET_ARM #define TARGET_HAS_STRUCT_STAT64 struct target_eabi_stat64 { -unsigned long long st_dev; -unsigned int __pad1; -abi_ulong __st_ino; -unsigned int st_mode; -unsigned int st_nlink; +unsigned long long st_dev; +unsigned int __pad1; +abi_ulong __st_ino; +unsigned int st_mode; +unsigned int st_nlink; -abi_ulong st_uid; -abi_ulong st_gid; +abi_ulong st_uid; +abi_ulong st_gid; -unsigned long long st_rdev; -unsigned int __pad2[2 ]; +unsigned long long st_rdev; +unsigned int __pad2[2 ]; -long long st_size; -abi_ulong st_blksize; -unsigned int __pad3; -unsigned long long st_blocks; +long long st_size; +abi_ulong st_blksize; +unsigned int __pad3; +unsigned long long st_blocks; -abi_ulong target_st_atime; -abi_ulong target_st_atime_nsec; +abi_ulong target_st_atime; +abi_ulong target_st_atime_nsec; -abi_ulong target_st_mtime; -abi_ulong target_st_mtime_nsec; +abi_ulong target_st_mtime; +abi_ulong target_st_mtime_nsec; -abi_ulong target_st_ctime; -abi_ulong target_st_ctime_nsec; +abi_ulong target_st_ctime; +abi_ulong target_st_ctime_nsec; -unsigned long long st_ino; +unsigned long long st_ino; }QEMU_PACKED ;#endif #elif defined(TARGET_SPARC64 ) && !defined(TARGET_ABI32 )struct target_stat { -unsigned int st_dev; -abi_ulong st_ino; -unsigned int st_mode; -unsigned int st_nlink; -unsigned int st_uid; -unsigned int st_gid; -unsigned int st_rdev; -abi_long st_size; -abi_long target_st_atime; -abi_long target_st_mtime; -abi_long target_st_ctime; -abi_long st_blksize; -abi_long st_blocks; -abi_ulong __unused4[2 ]; +unsigned int st_dev; +abi_ulong st_ino; +unsigned int st_mode; +unsigned int st_nlink; +unsigned int st_uid; +unsigned int st_gid; +unsigned int st_rdev; +abi_long st_size; +abi_long target_st_atime; +abi_long target_st_mtime; +abi_long target_st_ctime; +abi_long st_blksize; +abi_long st_blocks; +abi_ulong __unused4[2 ]; };#define TARGET_HAS_STRUCT_STAT64 struct target_stat64 { -unsigned char __pad0[6 ]; -unsigned short st_dev; +unsigned char __pad0[6 ]; +unsigned short st_dev; -uint64_t st_ino; -uint64_t st_nlink; +uint64_t st_ino; +uint64_t st_nlink; -unsigned int st_mode; +unsigned int st_mode; -unsigned int st_uid; -unsigned int st_gid; +unsigned int st_uid; +unsigned int st_gid; -unsigned char __pad2[6 ]; -unsigned short st_rdev; +unsigned char __pad2[6 ]; +unsigned short st_rdev; -int64_t st_size; -int64_t st_blksize; +int64_t st_size; +int64_t st_blksize; -unsigned char __pad4[4 ]; -unsigned int st_blocks; +unsigned char __pad4[4 ]; +unsigned int st_blocks; -abi_ulong target_st_atime; -abi_ulong target_st_atime_nsec; +abi_ulong target_st_atime; +abi_ulong target_st_atime_nsec; -abi_ulong target_st_mtime; -abi_ulong target_st_mtime_nsec; +abi_ulong target_st_mtime; +abi_ulong target_st_mtime_nsec; -abi_ulong target_st_ctime; -abi_ulong target_st_ctime_nsec; +abi_ulong target_st_ctime; +abi_ulong target_st_ctime_nsec; -abi_ulong __unused4[3 ]; +abi_ulong __unused4[3 ]; };#elif defined(TARGET_SPARC )#define TARGET_STAT_HAVE_NSEC struct target_stat { -unsigned short st_dev; -abi_ulong st_ino; -unsigned short st_mode; -short st_nlink; -unsigned short st_uid; -unsigned short st_gid; -unsigned short st_rdev; -abi_long st_size; -abi_long target_st_atime; -abi_ulong target_st_atime_nsec; -abi_long target_st_mtime; -abi_ulong target_st_mtime_nsec; -abi_long target_st_ctime; -abi_ulong target_st_ctime_nsec; -abi_long st_blksize; -abi_long st_blocks; -abi_ulong __unused1[2 ]; +unsigned short st_dev; +abi_ulong st_ino; +unsigned short st_mode; +short st_nlink; +unsigned short st_uid; +unsigned short st_gid; +unsigned short st_rdev; +abi_long st_size; +abi_long target_st_atime; +abi_ulong target_st_atime_nsec; +abi_long target_st_mtime; +abi_ulong target_st_mtime_nsec; +abi_long target_st_ctime; +abi_ulong target_st_ctime_nsec; +abi_long st_blksize; +abi_long st_blocks; +abi_ulong __unused1[2 ]; };#define TARGET_HAS_STRUCT_STAT64 struct target_stat64 { -unsigned char __pad0[6 ]; -unsigned short st_dev; +unsigned char __pad0[6 ]; +unsigned short st_dev; -uint64_t st_ino; +uint64_t st_ino; -unsigned int st_mode; -unsigned int st_nlink; +unsigned int st_mode; +unsigned int st_nlink; -unsigned int st_uid; -unsigned int st_gid; +unsigned int st_uid; +unsigned int st_gid; -unsigned char __pad2[6 ]; -unsigned short st_rdev; +unsigned char __pad2[6 ]; +unsigned short st_rdev; -unsigned char __pad3[8 ]; +unsigned char __pad3[8 ]; -int64_t st_size; -unsigned int st_blksize; +int64_t st_size; +unsigned int st_blksize; -unsigned char __pad4[8 ]; -unsigned int st_blocks; +unsigned char __pad4[8 ]; +unsigned int st_blocks; -unsigned int target_st_atime; -unsigned int target_st_atime_nsec; +unsigned int target_st_atime; +unsigned int target_st_atime_nsec; -unsigned int target_st_mtime; -unsigned int target_st_mtime_nsec; +unsigned int target_st_mtime; +unsigned int target_st_mtime_nsec; -unsigned int target_st_ctime; -unsigned int target_st_ctime_nsec; +unsigned int target_st_ctime; +unsigned int target_st_ctime_nsec; -unsigned int __unused1; -unsigned int __unused2; +unsigned int __unused1; +unsigned int __unused2; };#elif defined(TARGET_PPC )#define TARGET_STAT_HAVE_NSEC struct target_stat { -abi_ulong st_dev; -abi_ulong st_ino; +abi_ulong st_dev; +abi_ulong st_ino;#if defined(TARGET_PPC64 ) -abi_ulong st_nlink; -unsigned int st_mode; +abi_ulong st_nlink; +unsigned int st_mode;#else -unsigned int st_mode; -unsigned short st_nlink; +unsigned int st_mode; +unsigned short st_nlink;#endif -unsigned int st_uid; -unsigned int st_gid; -abi_ulong st_rdev; -abi_ulong st_size; -abi_ulong st_blksize; -abi_ulong st_blocks; -abi_ulong target_st_atime; -abi_ulong target_st_atime_nsec; -abi_ulong target_st_mtime; -abi_ulong target_st_mtime_nsec; -abi_ulong target_st_ctime; -abi_ulong target_st_ctime_nsec; -abi_ulong __unused4; -abi_ulong __unused5; +unsigned int st_uid; +unsigned int st_gid; +abi_ulong st_rdev; +abi_ulong st_size; +abi_ulong st_blksize; +abi_ulong st_blocks; +abi_ulong target_st_atime; +abi_ulong target_st_atime_nsec; +abi_ulong target_st_mtime; +abi_ulong target_st_mtime_nsec; +abi_ulong target_st_ctime; +abi_ulong target_st_ctime_nsec; +abi_ulong __unused4; +abi_ulong __unused5;#if defined(TARGET_PPC64 ) -abi_ulong __unused6; +abi_ulong __unused6;#endif };#if !defined(TARGET_PPC64 )#define TARGET_HAS_STRUCT_STAT64 struct QEMU_PACKED target_stat64 { -unsigned long long st_dev; -unsigned long long st_ino; -unsigned int st_mode; -unsigned int st_nlink; -unsigned int st_uid; -unsigned int st_gid; -unsigned long long st_rdev; -unsigned long long __pad0; -long long st_size; -int st_blksize; -unsigned int __pad1; -long long st_blocks;/* Number 512-byte blocks allocated. */ -int target_st_atime; -unsigned int target_st_atime_nsec; -int target_st_mtime; -unsigned int target_st_mtime_nsec; -int target_st_ctime; -unsigned int target_st_ctime_nsec; -unsigned int __unused4; -unsigned int __unused5; +unsigned long long st_dev; +unsigned long long st_ino; +unsigned int st_mode; +unsigned int st_nlink; +unsigned int st_uid; +unsigned int st_gid; +unsigned long long st_rdev; +unsigned long long __pad0; +long long st_size; +int st_blksize; +unsigned int __pad1; +long long st_blocks;/* Number 512-byte blocks allocated. */ +int target_st_atime; +unsigned int target_st_atime_nsec; +int target_st_mtime; +unsigned int target_st_mtime_nsec; +int target_st_ctime; +unsigned int target_st_ctime_nsec; +unsigned int __unused4; +unsigned int __unused5; };#endif
@@ -1619,78 +1619,78 @@ struct QEMU_PACKED target_stat64 {#define TARGET_STAT_HAVE_NSEC struct target_stat { -abi_ulong st_dev; -abi_ulong st_ino; -unsigned int st_mode; -unsigned short st_nlink; -unsigned int st_uid; -unsigned int st_gid; -abi_ulong st_rdev; -abi_ulong st_size; -abi_ulong st_blksize; -abi_ulong st_blocks; -abi_ulong target_st_atime; -abi_ulong target_st_atime_nsec; -abi_ulong target_st_mtime; -abi_ulong target_st_mtime_nsec; -abi_ulong target_st_ctime; -abi_ulong target_st_ctime_nsec; -abi_ulong __unused4; -abi_ulong __unused5; +abi_ulong st_dev; +abi_ulong st_ino; +unsigned int st_mode; +unsigned short st_nlink; +unsigned int st_uid; +unsigned int st_gid; +abi_ulong st_rdev; +abi_ulong st_size; +abi_ulong st_blksize; +abi_ulong st_blocks; +abi_ulong target_st_atime; +abi_ulong target_st_atime_nsec; +abi_ulong target_st_mtime; +abi_ulong target_st_mtime_nsec; +abi_ulong target_st_ctime; +abi_ulong target_st_ctime_nsec; +abi_ulong __unused4; +abi_ulong __unused5; };/* FIXME: Microblaze no-mmu user-space has a difference stat64 layout... */ #define TARGET_HAS_STRUCT_STAT64 struct QEMU_PACKED target_stat64 { -uint64_t st_dev; +uint64_t st_dev;#define TARGET_STAT64_HAS_BROKEN_ST_INO 1 -uint32_t pad0; -uint32_t __st_ino; +uint32_t pad0; +uint32_t __st_ino; -uint32_t st_mode; -uint32_t st_nlink; -uint32_t st_uid; -uint32_t st_gid; -uint64_t st_rdev; -uint64_t __pad1; +uint32_t st_mode; +uint32_t st_nlink; +uint32_t st_uid; +uint32_t st_gid; +uint64_t st_rdev; +uint64_t __pad1; -int64_t st_size; -int32_t st_blksize; -uint32_t __pad2; -int64_t st_blocks;/* Number 512-byte blocks allocated. */ +int64_t st_size; +int32_t st_blksize; +uint32_t __pad2; +int64_t st_blocks;/* Number 512-byte blocks allocated. */ -int target_st_atime; -unsigned int target_st_atime_nsec; -int target_st_mtime; -unsigned int target_st_mtime_nsec; -int target_st_ctime; -unsigned int target_st_ctime_nsec; -uint64_t st_ino; +int target_st_atime; +unsigned int target_st_atime_nsec; +int target_st_mtime; +unsigned int target_st_mtime_nsec; +int target_st_ctime; +unsigned int target_st_ctime_nsec; +uint64_t st_ino; };#elif defined(TARGET_M68K )struct target_stat { -unsigned short st_dev; -unsigned short __pad1; -abi_ulong st_ino; -unsigned short st_mode; -unsigned short st_nlink; -unsigned short st_uid; -unsigned short st_gid; -unsigned short st_rdev; -unsigned short __pad2; -abi_ulong st_size; -abi_ulong st_blksize; -abi_ulong st_blocks; -abi_ulong target_st_atime; -abi_ulong __unused1; -abi_ulong target_st_mtime; -abi_ulong __unused2; -abi_ulong target_st_ctime; -abi_ulong __unused3; -abi_ulong __unused4; -abi_ulong __unused5; +unsigned short st_dev; +unsigned short __pad1; +abi_ulong st_ino; +unsigned short st_mode; +unsigned short st_nlink; +unsigned short st_uid; +unsigned short st_gid; +unsigned short st_rdev; +unsigned short __pad2; +abi_ulong st_size; +abi_ulong st_blksize; +abi_ulong st_blocks; +abi_ulong target_st_atime; +abi_ulong __unused1; +abi_ulong target_st_mtime; +abi_ulong __unused2; +abi_ulong target_st_ctime; +abi_ulong __unused3; +abi_ulong __unused4; +abi_ulong __unused5; };/* This matches struct stat64 in glibc2.1, hence the absolutely
@@ -1698,37 +1698,37 @@ struct target_stat {*/ #define TARGET_HAS_STRUCT_STAT64 struct target_stat64 { -unsigned long long st_dev; -unsigned char __pad1[2 ]; +unsigned long long st_dev; +unsigned char __pad1[2 ]; -#define TARGET_STAT64_HAS_BROKEN_ST_INO 1 -abi_ulong __st_ino; +#define TARGET_STAT64_HAS_BROKEN_ST_INO 1 +abi_ulong __st_ino; -unsigned int st_mode; -unsigned int st_nlink; +unsigned int st_mode; +unsigned int st_nlink; -abi_ulong st_uid; -abi_ulong st_gid; +abi_ulong st_uid; +abi_ulong st_gid; -unsigned long long st_rdev; -unsigned char __pad3[2 ]; +unsigned long long st_rdev; +unsigned char __pad3[2 ]; -long long st_size; -abi_ulong st_blksize; +long long st_size; +abi_ulong st_blksize; -abi_ulong __pad4;/* future possible st_blocks high bits */ -abi_ulong st_blocks;/* Number 512-byte blocks allocated. */ +abi_ulong __pad4;/* future possible st_blocks high bits */ +abi_ulong st_blocks;/* Number 512-byte blocks allocated. */ -abi_ulong target_st_atime; -abi_ulong target_st_atime_nsec; +abi_ulong target_st_atime; +abi_ulong target_st_atime_nsec; -abi_ulong target_st_mtime; -abi_ulong target_st_mtime_nsec; +abi_ulong target_st_mtime; +abi_ulong target_st_mtime_nsec; -abi_ulong target_st_ctime; -abi_ulong target_st_ctime_nsec; +abi_ulong target_st_ctime; +abi_ulong target_st_ctime_nsec; -unsigned long long st_ino; +unsigned long long st_ino; }QEMU_PACKED ;#elif defined(TARGET_ABI_MIPSN64 )
@@ -1736,94 +1736,94 @@ struct target_stat64 {#define TARGET_STAT_HAVE_NSEC /* The memory layout is the same as of struct stat64 of the 32-bit kernel. */ struct target_stat { -unsigned int st_dev; -unsigned int st_pad0[3 ];/* Reserved for st_dev expansion */ +unsigned int st_dev; +unsigned int st_pad0[3 ];/* Reserved for st_dev expansion */ -abi_ulong st_ino; +abi_ulong st_ino; -unsigned int st_mode; -unsigned int st_nlink; +unsigned int st_mode; +unsigned int st_nlink; -int st_uid; -int st_gid; +int st_uid; +int st_gid; -unsigned int st_rdev; -unsigned int st_pad1[3 ];/* Reserved for st_rdev expansion */ +unsigned int st_rdev; +unsigned int st_pad1[3 ];/* Reserved for st_rdev expansion */ -abi_ulong st_size; +abi_ulong st_size; -/* -* Actually this should be timestruc_t st_atime, st_mtime and st_ctime -* but we don't have it under Linux. -*/ -unsigned int target_st_atime; -unsigned int target_st_atime_nsec; +/* +* Actually this should be timestruc_t st_atime, st_mtime and st_ctime +* but we don't have it under Linux. +*/ +unsigned int target_st_atime; +unsigned int target_st_atime_nsec; -unsigned int target_st_mtime; -unsigned int target_st_mtime_nsec; +unsigned int target_st_mtime; +unsigned int target_st_mtime_nsec; -unsigned int target_st_ctime; -unsigned int target_st_ctime_nsec; +unsigned int target_st_ctime; +unsigned int target_st_ctime_nsec; -unsigned int st_blksize; -unsigned int st_pad2; +unsigned int st_blksize; +unsigned int st_pad2; -abi_ulong st_blocks; +abi_ulong st_blocks; };#elif defined(TARGET_ABI_MIPSN32 )#define TARGET_STAT_HAVE_NSEC struct target_stat { -abi_ulong st_dev; -abi_ulong st_pad0[3 ];/* Reserved for st_dev expansion */ -uint64_t st_ino; -unsigned int st_mode; -unsigned int st_nlink; -int st_uid; -int st_gid; -abi_ulong st_rdev; -abi_ulong st_pad1[3 ];/* Reserved for st_rdev expansion */ -int64_t st_size; -abi_long target_st_atime; -abi_ulong target_st_atime_nsec;/* Reserved for st_atime expansion */ -abi_long target_st_mtime; -abi_ulong target_st_mtime_nsec;/* Reserved for st_mtime expansion */ -abi_long target_st_ctime; -abi_ulong target_st_ctime_nsec;/* Reserved for st_ctime expansion */ -abi_ulong st_blksize; -abi_ulong st_pad2; -int64_t st_blocks; +abi_ulong st_dev; +abi_ulong st_pad0[3 ];/* Reserved for st_dev expansion */ +uint64_t st_ino; +unsigned int st_mode; +unsigned int st_nlink; +int st_uid; +int st_gid; +abi_ulong st_rdev; +abi_ulong st_pad1[3 ];/* Reserved for st_rdev expansion */ +int64_t st_size; +abi_long target_st_atime; +abi_ulong target_st_atime_nsec;/* Reserved for st_atime expansion */ +abi_long target_st_mtime; +abi_ulong target_st_mtime_nsec;/* Reserved for st_mtime expansion */ +abi_long target_st_ctime; +abi_ulong target_st_ctime_nsec;/* Reserved for st_ctime expansion */ +abi_ulong st_blksize; +abi_ulong st_pad2; +int64_t st_blocks; };#elif defined(TARGET_ABI_MIPSO32 )#define TARGET_STAT_HAVE_NSEC struct target_stat { -unsigned st_dev; -abi_long st_pad1[3 ];/* Reserved for network id */ -abi_ulong st_ino; -unsigned int st_mode; -unsigned int st_nlink; -int st_uid; -int st_gid; -unsigned st_rdev; -abi_long st_pad2[2 ]; -abi_long st_size; -abi_long st_pad3; -/* -* Actually this should be timestruc_t st_atime, st_mtime and st_ctime -* but we don't have it under Linux. -*/ -abi_long target_st_atime; -abi_long target_st_atime_nsec; -abi_long target_st_mtime; -abi_long target_st_mtime_nsec; -abi_long target_st_ctime; -abi_long target_st_ctime_nsec; -abi_long st_blksize; -abi_long st_blocks; -abi_long st_pad4[14 ]; +unsigned st_dev; +abi_long st_pad1[3 ];/* Reserved for network id */ +abi_ulong st_ino; +unsigned int st_mode; +unsigned int st_nlink; +int st_uid; +int st_gid; +unsigned st_rdev; +abi_long st_pad2[2 ]; +abi_long st_size; +abi_long st_pad3; +/* +* Actually this should be timestruc_t st_atime, st_mtime and st_ctime +* but we don't have it under Linux. +*/ +abi_long target_st_atime; +abi_long target_st_atime_nsec; +abi_long target_st_mtime; +abi_long target_st_mtime_nsec; +abi_long target_st_ctime; +abi_long target_st_ctime_nsec; +abi_long st_blksize; +abi_long st_blocks; +abi_long st_pad4[14 ]; };/*
@@ -1834,107 +1834,107 @@ struct target_stat {#define TARGET_HAS_STRUCT_STAT64 struct target_stat64 { -abi_ulong st_dev; -abi_ulong st_pad0[3 ];/* Reserved for st_dev expansion */ +abi_ulong st_dev; +abi_ulong st_pad0[3 ];/* Reserved for st_dev expansion */ -uint64_t st_ino; +uint64_t st_ino; -unsigned int st_mode; -unsigned int st_nlink; +unsigned int st_mode; +unsigned int st_nlink; -int st_uid; -int st_gid; +int st_uid; +int st_gid; -abi_ulong st_rdev; -abi_ulong st_pad1[3 ];/* Reserved for st_rdev expansion */ +abi_ulong st_rdev; +abi_ulong st_pad1[3 ];/* Reserved for st_rdev expansion */ -int64_t st_size; +int64_t st_size; -/* -* Actually this should be timestruc_t st_atime, st_mtime and st_ctime -* but we don't have it under Linux. -*/ -abi_long target_st_atime; -abi_ulong target_st_atime_nsec;/* Reserved for st_atime expansion */ +/* +* Actually this should be timestruc_t st_atime, st_mtime and st_ctime +* but we don't have it under Linux. +*/ +abi_long target_st_atime; +abi_ulong target_st_atime_nsec;/* Reserved for st_atime expansion */ -abi_long target_st_mtime; -abi_ulong target_st_mtime_nsec;/* Reserved for st_mtime expansion */ +abi_long target_st_mtime; +abi_ulong target_st_mtime_nsec;/* Reserved for st_mtime expansion */ -abi_long target_st_ctime; -abi_ulong target_st_ctime_nsec;/* Reserved for st_ctime expansion */ +abi_long target_st_ctime; +abi_ulong target_st_ctime_nsec;/* Reserved for st_ctime expansion */ -abi_ulong st_blksize; -abi_ulong st_pad2; +abi_ulong st_blksize; +abi_ulong st_pad2; -int64_t st_blocks; +int64_t st_blocks; };#elif defined(TARGET_ALPHA )struct target_stat { -unsigned int st_dev; -unsigned int st_ino; -unsigned int st_mode; -unsigned int st_nlink; -unsigned int st_uid; -unsigned int st_gid; -unsigned int st_rdev; -abi_long st_size; -abi_ulong target_st_atime; -abi_ulong target_st_mtime; -abi_ulong target_st_ctime; -unsigned int st_blksize; -unsigned int st_blocks; -unsigned int st_flags; -unsigned int st_gen; +unsigned int st_dev; +unsigned int st_ino; +unsigned int st_mode; +unsigned int st_nlink; +unsigned int st_uid; +unsigned int st_gid; +unsigned int st_rdev; +abi_long st_size; +abi_ulong target_st_atime; +abi_ulong target_st_mtime; +abi_ulong target_st_ctime; +unsigned int st_blksize; +unsigned int st_blocks; +unsigned int st_flags; +unsigned int st_gen; };#define TARGET_HAS_STRUCT_STAT64 struct target_stat64 { -abi_ulong st_dev; -abi_ulong st_ino; -abi_ulong st_rdev; -abi_long st_size; -abi_ulong st_blocks; +abi_ulong st_dev; +abi_ulong st_ino; +abi_ulong st_rdev; +abi_long st_size; +abi_ulong st_blocks; -unsigned int st_mode; -unsigned int st_uid; -unsigned int st_gid; -unsigned int st_blksize; -unsigned int st_nlink; -unsigned int __pad0; +unsigned int st_mode; +unsigned int st_uid; +unsigned int st_gid; +unsigned int st_blksize; +unsigned int st_nlink; +unsigned int __pad0; -abi_ulong target_st_atime; -abi_ulong target_st_atime_nsec; -abi_ulong target_st_mtime; -abi_ulong target_st_mtime_nsec; -abi_ulong target_st_ctime; -abi_ulong target_st_ctime_nsec; -abi_long __unused[3 ]; +abi_ulong target_st_atime; +abi_ulong target_st_atime_nsec; +abi_ulong target_st_mtime; +abi_ulong target_st_mtime_nsec; +abi_ulong target_st_ctime; +abi_ulong target_st_ctime_nsec; +abi_long __unused[3 ]; };#elif defined(TARGET_SH4 )#define TARGET_STAT_HAVE_NSEC struct target_stat { -abi_ulong st_dev; -abi_ulong st_ino; -unsigned short st_mode; -unsigned short st_nlink; -unsigned short st_uid; -unsigned short st_gid; -abi_ulong st_rdev; -abi_ulong st_size; -abi_ulong st_blksize; -abi_ulong st_blocks; -abi_ulong target_st_atime; -abi_ulong target_st_atime_nsec; -abi_ulong target_st_mtime; -abi_ulong target_st_mtime_nsec; -abi_ulong target_st_ctime; -abi_ulong target_st_ctime_nsec; -abi_ulong __unused4; -abi_ulong __unused5; +abi_ulong st_dev; +abi_ulong st_ino; +unsigned short st_mode; +unsigned short st_nlink; +unsigned short st_uid; +unsigned short st_gid; +abi_ulong st_rdev; +abi_ulong st_size; +abi_ulong st_blksize; +abi_ulong st_blocks; +abi_ulong target_st_atime; +abi_ulong target_st_atime_nsec; +abi_ulong target_st_mtime; +abi_ulong target_st_mtime_nsec; +abi_ulong target_st_ctime; +abi_ulong target_st_ctime_nsec; +abi_ulong __unused4; +abi_ulong __unused5; };/* This matches struct stat64 in glibc2.1, hence the absolutely
@@ -1942,62 +1942,62 @@ struct target_stat {*/ #define TARGET_HAS_STRUCT_STAT64 struct QEMU_PACKED target_stat64 { -unsigned long long st_dev; -unsigned char __pad0[4 ]; +unsigned long long st_dev; +unsigned char __pad0[4 ]; -#define TARGET_STAT64_HAS_BROKEN_ST_INO 1 -abi_ulong __st_ino; +#define TARGET_STAT64_HAS_BROKEN_ST_INO 1 +abi_ulong __st_ino; -unsigned int st_mode; -unsigned int st_nlink; +unsigned int st_mode; +unsigned int st_nlink; -abi_ulong st_uid; -abi_ulong st_gid; +abi_ulong st_uid; +abi_ulong st_gid; -unsigned long long st_rdev; -unsigned char __pad3[4 ]; +unsigned long long st_rdev; +unsigned char __pad3[4 ]; -long long st_size; -abi_ulong st_blksize; +long long st_size; +abi_ulong st_blksize; -unsigned long long st_blocks;/* Number 512-byte blocks allocated. */ +unsigned long long st_blocks;/* Number 512-byte blocks allocated. */ -abi_ulong target_st_atime; -abi_ulong target_st_atime_nsec; +abi_ulong target_st_atime; +abi_ulong target_st_atime_nsec; -abi_ulong target_st_mtime; -abi_ulong target_st_mtime_nsec; +abi_ulong target_st_mtime; +abi_ulong target_st_mtime_nsec; -abi_ulong target_st_ctime; -abi_ulong target_st_ctime_nsec; +abi_ulong target_st_ctime; +abi_ulong target_st_ctime_nsec; -unsigned long long st_ino; +unsigned long long st_ino; };#elif defined(TARGET_I386 ) && !defined(TARGET_ABI32 )#define TARGET_STAT_HAVE_NSEC struct target_stat { -abi_ulong st_dev; -abi_ulong st_ino; -abi_ulong st_nlink; +abi_ulong st_dev; +abi_ulong st_ino; +abi_ulong st_nlink; -unsigned int st_mode; -unsigned int st_uid; -unsigned int st_gid; -unsigned int __pad0; -abi_ulong st_rdev; -abi_long st_size; -abi_long st_blksize; -abi_long st_blocks;/* Number 512-byte blocks allocated. */ +unsigned int st_mode; +unsigned int st_uid; +unsigned int st_gid; +unsigned int __pad0; +abi_ulong st_rdev; +abi_long st_size; +abi_long st_blksize; +abi_long st_blocks;/* Number 512-byte blocks allocated. */ -abi_ulong target_st_atime; -abi_ulong target_st_atime_nsec; -abi_ulong target_st_mtime; -abi_ulong target_st_mtime_nsec; -abi_ulong target_st_ctime; -abi_ulong target_st_ctime_nsec; +abi_ulong target_st_atime; +abi_ulong target_st_atime_nsec; +abi_ulong target_st_mtime; +abi_ulong target_st_mtime_nsec; +abi_ulong target_st_ctime; +abi_ulong target_st_ctime_nsec; -abi_long __unused[3 ]; +abi_long __unused[3 ]; };#elif defined(TARGET_S390X ) struct target_stat {
@@ -2090,7 +2090,7 @@ struct target_stat64 { };#elif defined(TARGET_OPENRISC) || defined(TARGET_NIOS2) \ - || defined(TARGET_RISCV) || defined(TARGET_HEXAGON) + || defined(TARGET_RISCV) || defined(TARGET_HEXAGON)/* These are the asm-generic versions of the stat and stat64 structures */
@@ -2210,93 +2210,93 @@ struct target_stat64 {#endif typedef struct { -int val[2 ]; +int val[2 ]; }target_fsid_t ;#ifdef TARGET_MIPS #ifdef TARGET_ABI_MIPSN32 struct target_statfs { -int32_t f_type; -int32_t f_bsize; -int32_t f_frsize;/* Fragment size - unsupported */ -int32_t f_blocks; -int32_t f_bfree; -int32_t f_files; -int32_t f_ffree; -int32_t f_bavail; +int32_t f_type; +int32_t f_bsize; +int32_t f_frsize;/* Fragment size - unsupported */ +int32_t f_blocks; +int32_t f_bfree; +int32_t f_files; +int32_t f_ffree; +int32_t f_bavail; -/* Linux specials */ -target_fsid_t f_fsid; -int32_t f_namelen; -int32_t f_flags; -int32_t f_spare[5 ]; +/* Linux specials */ +target_fsid_t f_fsid; +int32_t f_namelen; +int32_t f_flags; +int32_t f_spare[5 ]; };#else struct target_statfs { -abi_long f_type; -abi_long f_bsize; -abi_long f_frsize;/* Fragment size - unsupported */ -abi_long f_blocks; -abi_long f_bfree; -abi_long f_files; -abi_long f_ffree; -abi_long f_bavail; +abi_long f_type; +abi_long f_bsize; +abi_long f_frsize;/* Fragment size - unsupported */ +abi_long f_blocks; +abi_long f_bfree; +abi_long f_files; +abi_long f_ffree; +abi_long f_bavail; -/* Linux specials */ -target_fsid_t f_fsid; -abi_long f_namelen; -abi_long f_flags; -abi_long f_spare[5 ]; +/* Linux specials */ +target_fsid_t f_fsid; +abi_long f_namelen; +abi_long f_flags; +abi_long f_spare[5 ]; };#endif struct target_statfs64 { -uint32_t f_type; -uint32_t f_bsize; -uint32_t f_frsize;/* Fragment size - unsupported */ -uint32_t __pad; -uint64_t f_blocks; -uint64_t f_bfree; -uint64_t f_files; -uint64_t f_ffree; -uint64_t f_bavail; -target_fsid_t f_fsid; -uint32_t f_namelen; -uint32_t f_flags; -uint32_t f_spare[5 ]; +uint32_t f_type; +uint32_t f_bsize; +uint32_t f_frsize;/* Fragment size - unsupported */ +uint32_t __pad; +uint64_t f_blocks; +uint64_t f_bfree; +uint64_t f_files; +uint64_t f_ffree; +uint64_t f_bavail; +target_fsid_t f_fsid; +uint32_t f_namelen; +uint32_t f_flags; +uint32_t f_spare[5 ]; }; -#elif (defined(TARGET_PPC64 ) || defined(TARGET_X86_64 ) || \ - defined(TARGET_SPARC64 ) || defined(TARGET_AARCH64 ) || \ +#elif (defined(TARGET_PPC64 ) || defined(TARGET_X86_64 ) || \ + defined(TARGET_SPARC64 ) || defined(TARGET_AARCH64 ) || \ defined(TARGET_RISCV ) || defined(TARGET_LOONGARCH64 )) && \ - !defined(TARGET_ABI32 ) + !defined(TARGET_ABI32 )struct target_statfs { -abi_long f_type; -abi_long f_bsize; -abi_long f_blocks; -abi_long f_bfree; -abi_long f_bavail; -abi_long f_files; -abi_long f_ffree; -target_fsid_t f_fsid; -abi_long f_namelen; -abi_long f_frsize; -abi_long f_flags; -abi_long f_spare[4 ]; +abi_long f_type; +abi_long f_bsize; +abi_long f_blocks; +abi_long f_bfree; +abi_long f_bavail; +abi_long f_files; +abi_long f_ffree; +target_fsid_t f_fsid; +abi_long f_namelen; +abi_long f_frsize; +abi_long f_flags; +abi_long f_spare[4 ]; };struct target_statfs64 { -abi_long f_type; -abi_long f_bsize; -abi_long f_blocks; -abi_long f_bfree; -abi_long f_bavail; -abi_long f_files; -abi_long f_ffree; -target_fsid_t f_fsid; -abi_long f_namelen; -abi_long f_frsize; -abi_long f_flags; -abi_long f_spare[4 ]; +abi_long f_type; +abi_long f_bsize; +abi_long f_blocks; +abi_long f_bfree; +abi_long f_bavail; +abi_long f_files; +abi_long f_ffree; +target_fsid_t f_fsid; +abi_long f_namelen; +abi_long f_frsize; +abi_long f_flags; +abi_long f_spare[4 ]; };#elif defined(TARGET_S390X ) struct target_statfs {
@@ -2331,33 +2331,33 @@ struct target_statfs64 { };#else struct target_statfs { -uint32_t f_type; -uint32_t f_bsize; -uint32_t f_blocks; -uint32_t f_bfree; -uint32_t f_bavail; -uint32_t f_files; -uint32_t f_ffree; -target_fsid_t f_fsid; -uint32_t f_namelen; -uint32_t f_frsize; -uint32_t f_flags; -uint32_t f_spare[4 ]; +uint32_t f_type; +uint32_t f_bsize; +uint32_t f_blocks; +uint32_t f_bfree; +uint32_t f_bavail; +uint32_t f_files; +uint32_t f_ffree; +target_fsid_t f_fsid; +uint32_t f_namelen; +uint32_t f_frsize; +uint32_t f_flags; +uint32_t f_spare[4 ]; };struct target_statfs64 { -uint32_t f_type; -uint32_t f_bsize; -uint64_t f_blocks; -uint64_t f_bfree; -uint64_t f_bavail; -uint64_t f_files; -uint64_t f_ffree; -target_fsid_t f_fsid; -uint32_t f_namelen; -uint32_t f_frsize; -uint32_t f_flags; -uint32_t f_spare[4 ]; +uint32_t f_type; +uint32_t f_bsize; +uint64_t f_blocks; +uint64_t f_bfree; +uint64_t f_bavail; +uint64_t f_files; +uint64_t f_ffree; +target_fsid_t f_fsid; +uint32_t f_namelen; +uint32_t f_frsize; +uint32_t f_flags; +uint32_t f_spare[4 ]; };#endif
@@ -2454,63 +2454,63 @@ struct target_statfs64 {#define TARGET_SOUND_MIXER_PRIVATE4 TARGET_IOWR('M', 114, int)#define TARGET_SOUND_MIXER_PRIVATE5 TARGET_IOWR('M', 115, int) -#define TARGET_MIXER_READ (dev) TARGET_IOR('M', dev, int) +#define TARGET_MIXER_READ (dev) TARGET_IOR('M', dev, int) -#define TARGET_SOUND_MIXER_READ_VOLUME TARGET_MIXER_READ(SOUND_MIXER_VOLUME) -#define TARGET_SOUND_MIXER_READ_BASS TARGET_MIXER_READ(SOUND_MIXER_BASS) -#define TARGET_SOUND_MIXER_READ_TREBLE TARGET_MIXER_READ(SOUND_MIXER_TREBLE) -#define TARGET_SOUND_MIXER_READ_SYNTH TARGET_MIXER_READ(SOUND_MIXER_SYNTH) -#define TARGET_SOUND_MIXER_READ_PCM TARGET_MIXER_READ(SOUND_MIXER_PCM) -#define TARGET_SOUND_MIXER_READ_SPEAKER TARGET_MIXER_READ(SOUND_MIXER_SPEAKER) -#define TARGET_SOUND_MIXER_READ_LINE TARGET_MIXER_READ(SOUND_MIXER_LINE) -#define TARGET_SOUND_MIXER_READ_MIC TARGET_MIXER_READ(SOUND_MIXER_MIC) -#define TARGET_SOUND_MIXER_READ_CD TARGET_MIXER_READ(SOUND_MIXER_CD) -#define TARGET_SOUND_MIXER_READ_IMIX TARGET_MIXER_READ(SOUND_MIXER_IMIX) -#define TARGET_SOUND_MIXER_READ_ALTPCM TARGET_MIXER_READ(SOUND_MIXER_ALTPCM) -#define TARGET_SOUND_MIXER_READ_RECLEV TARGET_MIXER_READ(SOUND_MIXER_RECLEV) -#define TARGET_SOUND_MIXER_READ_IGAIN TARGET_MIXER_READ(SOUND_MIXER_IGAIN) -#define TARGET_SOUND_MIXER_READ_OGAIN TARGET_MIXER_READ(SOUND_MIXER_OGAIN) -#define TARGET_SOUND_MIXER_READ_LINE1 TARGET_MIXER_READ(SOUND_MIXER_LINE1) -#define TARGET_SOUND_MIXER_READ_LINE2 TARGET_MIXER_READ(SOUND_MIXER_LINE2) -#define TARGET_SOUND_MIXER_READ_LINE3 TARGET_MIXER_READ(SOUND_MIXER_LINE3) +#define TARGET_SOUND_MIXER_READ_VOLUME TARGET_MIXER_READ(SOUND_MIXER_VOLUME) +#define TARGET_SOUND_MIXER_READ_BASS TARGET_MIXER_READ(SOUND_MIXER_BASS) +#define TARGET_SOUND_MIXER_READ_TREBLE TARGET_MIXER_READ(SOUND_MIXER_TREBLE) +#define TARGET_SOUND_MIXER_READ_SYNTH TARGET_MIXER_READ(SOUND_MIXER_SYNTH) +#define TARGET_SOUND_MIXER_READ_PCM TARGET_MIXER_READ(SOUND_MIXER_PCM) +#define TARGET_SOUND_MIXER_READ_SPEAKER TARGET_MIXER_READ(SOUND_MIXER_SPEAKER) +#define TARGET_SOUND_MIXER_READ_LINE TARGET_MIXER_READ(SOUND_MIXER_LINE) +#define TARGET_SOUND_MIXER_READ_MIC TARGET_MIXER_READ(SOUND_MIXER_MIC) +#define TARGET_SOUND_MIXER_READ_CD TARGET_MIXER_READ(SOUND_MIXER_CD) +#define TARGET_SOUND_MIXER_READ_IMIX TARGET_MIXER_READ(SOUND_MIXER_IMIX) +#define TARGET_SOUND_MIXER_READ_ALTPCM TARGET_MIXER_READ(SOUND_MIXER_ALTPCM) +#define TARGET_SOUND_MIXER_READ_RECLEV TARGET_MIXER_READ(SOUND_MIXER_RECLEV) +#define TARGET_SOUND_MIXER_READ_IGAIN TARGET_MIXER_READ(SOUND_MIXER_IGAIN) +#define TARGET_SOUND_MIXER_READ_OGAIN TARGET_MIXER_READ(SOUND_MIXER_OGAIN) +#define TARGET_SOUND_MIXER_READ_LINE1 TARGET_MIXER_READ(SOUND_MIXER_LINE1) +#define TARGET_SOUND_MIXER_READ_LINE2 TARGET_MIXER_READ(SOUND_MIXER_LINE2) +#define TARGET_SOUND_MIXER_READ_LINE3 TARGET_MIXER_READ(SOUND_MIXER_LINE3)/* Obsolete macros */ -#define TARGET_SOUND_MIXER_READ_MUTE TARGET_MIXER_READ(SOUND_MIXER_MUTE) -#define TARGET_SOUND_MIXER_READ_ENHANCE TARGET_MIXER_READ(SOUND_MIXER_ENHANCE) -#define TARGET_SOUND_MIXER_READ_LOUD TARGET_MIXER_READ(SOUND_MIXER_LOUD) +#define TARGET_SOUND_MIXER_READ_MUTE TARGET_MIXER_READ(SOUND_MIXER_MUTE) +#define TARGET_SOUND_MIXER_READ_ENHANCE TARGET_MIXER_READ(SOUND_MIXER_ENHANCE) +#define TARGET_SOUND_MIXER_READ_LOUD TARGET_MIXER_READ(SOUND_MIXER_LOUD) -#define TARGET_SOUND_MIXER_READ_RECSRC TARGET_MIXER_READ(SOUND_MIXER_RECSRC) -#define TARGET_SOUND_MIXER_READ_DEVMASK TARGET_MIXER_READ(SOUND_MIXER_DEVMASK) -#define TARGET_SOUND_MIXER_READ_RECMASK TARGET_MIXER_READ(SOUND_MIXER_RECMASK) -#define TARGET_SOUND_MIXER_READ_STEREODEVS TARGET_MIXER_READ(SOUND_MIXER_STEREODEVS) -#define TARGET_SOUND_MIXER_READ_CAPS TARGET_MIXER_READ(SOUND_MIXER_CAPS) +#define TARGET_SOUND_MIXER_READ_RECSRC TARGET_MIXER_READ(SOUND_MIXER_RECSRC) +#define TARGET_SOUND_MIXER_READ_DEVMASK TARGET_MIXER_READ(SOUND_MIXER_DEVMASK) +#define TARGET_SOUND_MIXER_READ_RECMASK TARGET_MIXER_READ(SOUND_MIXER_RECMASK) +#define TARGET_SOUND_MIXER_READ_STEREODEVS TARGET_MIXER_READ(SOUND_MIXER_STEREODEVS) +#define TARGET_SOUND_MIXER_READ_CAPS TARGET_MIXER_READ(SOUND_MIXER_CAPS) -#define TARGET_MIXER_WRITE (dev) TARGET_IOWR('M', dev, int) +#define TARGET_MIXER_WRITE (dev) TARGET_IOWR('M', dev, int) -#define TARGET_SOUND_MIXER_WRITE_VOLUME TARGET_MIXER_WRITE(SOUND_MIXER_VOLUME) -#define TARGET_SOUND_MIXER_WRITE_BASS TARGET_MIXER_WRITE(SOUND_MIXER_BASS) -#define TARGET_SOUND_MIXER_WRITE_TREBLE TARGET_MIXER_WRITE(SOUND_MIXER_TREBLE) -#define TARGET_SOUND_MIXER_WRITE_SYNTH TARGET_MIXER_WRITE(SOUND_MIXER_SYNTH) -#define TARGET_SOUND_MIXER_WRITE_PCM TARGET_MIXER_WRITE(SOUND_MIXER_PCM) -#define TARGET_SOUND_MIXER_WRITE_SPEAKER TARGET_MIXER_WRITE(SOUND_MIXER_SPEAKER) -#define TARGET_SOUND_MIXER_WRITE_LINE TARGET_MIXER_WRITE(SOUND_MIXER_LINE) -#define TARGET_SOUND_MIXER_WRITE_MIC TARGET_MIXER_WRITE(SOUND_MIXER_MIC) -#define TARGET_SOUND_MIXER_WRITE_CD TARGET_MIXER_WRITE(SOUND_MIXER_CD) -#define TARGET_SOUND_MIXER_WRITE_IMIX TARGET_MIXER_WRITE(SOUND_MIXER_IMIX) -#define TARGET_SOUND_MIXER_WRITE_ALTPCM TARGET_MIXER_WRITE(SOUND_MIXER_ALTPCM) -#define TARGET_SOUND_MIXER_WRITE_RECLEV TARGET_MIXER_WRITE(SOUND_MIXER_RECLEV) -#define TARGET_SOUND_MIXER_WRITE_IGAIN TARGET_MIXER_WRITE(SOUND_MIXER_IGAIN) -#define TARGET_SOUND_MIXER_WRITE_OGAIN TARGET_MIXER_WRITE(SOUND_MIXER_OGAIN) -#define TARGET_SOUND_MIXER_WRITE_LINE1 TARGET_MIXER_WRITE(SOUND_MIXER_LINE1) -#define TARGET_SOUND_MIXER_WRITE_LINE2 TARGET_MIXER_WRITE(SOUND_MIXER_LINE2) -#define TARGET_SOUND_MIXER_WRITE_LINE3 TARGET_MIXER_WRITE(SOUND_MIXER_LINE3) +#define TARGET_SOUND_MIXER_WRITE_VOLUME TARGET_MIXER_WRITE(SOUND_MIXER_VOLUME) +#define TARGET_SOUND_MIXER_WRITE_BASS TARGET_MIXER_WRITE(SOUND_MIXER_BASS) +#define TARGET_SOUND_MIXER_WRITE_TREBLE TARGET_MIXER_WRITE(SOUND_MIXER_TREBLE) +#define TARGET_SOUND_MIXER_WRITE_SYNTH TARGET_MIXER_WRITE(SOUND_MIXER_SYNTH) +#define TARGET_SOUND_MIXER_WRITE_PCM TARGET_MIXER_WRITE(SOUND_MIXER_PCM) +#define TARGET_SOUND_MIXER_WRITE_SPEAKER TARGET_MIXER_WRITE(SOUND_MIXER_SPEAKER) +#define TARGET_SOUND_MIXER_WRITE_LINE TARGET_MIXER_WRITE(SOUND_MIXER_LINE) +#define TARGET_SOUND_MIXER_WRITE_MIC TARGET_MIXER_WRITE(SOUND_MIXER_MIC) +#define TARGET_SOUND_MIXER_WRITE_CD TARGET_MIXER_WRITE(SOUND_MIXER_CD) +#define TARGET_SOUND_MIXER_WRITE_IMIX TARGET_MIXER_WRITE(SOUND_MIXER_IMIX) +#define TARGET_SOUND_MIXER_WRITE_ALTPCM TARGET_MIXER_WRITE(SOUND_MIXER_ALTPCM) +#define TARGET_SOUND_MIXER_WRITE_RECLEV TARGET_MIXER_WRITE(SOUND_MIXER_RECLEV) +#define TARGET_SOUND_MIXER_WRITE_IGAIN TARGET_MIXER_WRITE(SOUND_MIXER_IGAIN) +#define TARGET_SOUND_MIXER_WRITE_OGAIN TARGET_MIXER_WRITE(SOUND_MIXER_OGAIN) +#define TARGET_SOUND_MIXER_WRITE_LINE1 TARGET_MIXER_WRITE(SOUND_MIXER_LINE1) +#define TARGET_SOUND_MIXER_WRITE_LINE2 TARGET_MIXER_WRITE(SOUND_MIXER_LINE2) +#define TARGET_SOUND_MIXER_WRITE_LINE3 TARGET_MIXER_WRITE(SOUND_MIXER_LINE3)/* Obsolete macros */ -#define TARGET_SOUND_MIXER_WRITE_MUTE TARGET_MIXER_WRITE(SOUND_MIXER_MUTE) -#define TARGET_SOUND_MIXER_WRITE_ENHANCE TARGET_MIXER_WRITE(SOUND_MIXER_ENHANCE) -#define TARGET_SOUND_MIXER_WRITE_LOUD TARGET_MIXER_WRITE(SOUND_MIXER_LOUD) +#define TARGET_SOUND_MIXER_WRITE_MUTE TARGET_MIXER_WRITE(SOUND_MIXER_MUTE) +#define TARGET_SOUND_MIXER_WRITE_ENHANCE TARGET_MIXER_WRITE(SOUND_MIXER_ENHANCE) +#define TARGET_SOUND_MIXER_WRITE_LOUD TARGET_MIXER_WRITE(SOUND_MIXER_LOUD) -#define TARGET_SOUND_MIXER_WRITE_RECSRC TARGET_MIXER_WRITE(SOUND_MIXER_RECSRC) +#define TARGET_SOUND_MIXER_WRITE_RECSRC TARGET_MIXER_WRITE(SOUND_MIXER_RECSRC)struct target_snd_timer_id {int dev_class;
@@ -2575,22 +2575,22 @@ struct target_snd_timer_status {/* alsa timer ioctls */ #define TARGET_SNDRV_TIMER_IOCTL_PVERSION TARGET_IOR('T', 0x00, int) -#define TARGET_SNDRV_TIMER_IOCTL_NEXT_DEVICE TARGET_IOWR('T', 0x01, \ - struct snd_timer_id) -#define TARGET_SNDRV_TIMER_IOCTL_GINFO TARGET_IOWR('T', 0x03, \ - struct target_snd_timer_ginfo) -#define TARGET_SNDRV_TIMER_IOCTL_GPARAMS TARGET_IOW('T', 0x04, \ - struct target_snd_timer_gparams) -#define TARGET_SNDRV_TIMER_IOCTL_GSTATUS TARGET_IOWR('T', 0x05, \ - struct target_snd_timer_gstatus) -#define TARGET_SNDRV_TIMER_IOCTL_SELECT TARGET_IOW('T', 0x10, \ - struct target_snd_timer_select) -#define TARGET_SNDRV_TIMER_IOCTL_INFO TARGET_IOR('T', 0x11, \ - struct target_snd_timer_info) -#define TARGET_SNDRV_TIMER_IOCTL_PARAMS TARGET_IOW('T', 0x12, \ - struct snd_timer_params) -#define TARGET_SNDRV_TIMER_IOCTL_STATUS TARGET_IOR('T', 0x14, \ - struct target_snd_timer_status) +#define TARGET_SNDRV_TIMER_IOCTL_NEXT_DEVICE TARGET_IOWR('T', 0x01, \ + struct snd_timer_id) +#define TARGET_SNDRV_TIMER_IOCTL_GINFO TARGET_IOWR('T', 0x03, \ + struct target_snd_timer_ginfo) +#define TARGET_SNDRV_TIMER_IOCTL_GPARAMS TARGET_IOW('T', 0x04, \ + struct target_snd_timer_gparams) +#define TARGET_SNDRV_TIMER_IOCTL_GSTATUS TARGET_IOWR('T', 0x05, \ + struct target_snd_timer_gstatus) +#define TARGET_SNDRV_TIMER_IOCTL_SELECT TARGET_IOW('T', 0x10, \ + struct target_snd_timer_select) +#define TARGET_SNDRV_TIMER_IOCTL_INFO TARGET_IOR('T', 0x11, \ + struct target_snd_timer_info) +#define TARGET_SNDRV_TIMER_IOCTL_PARAMS TARGET_IOW('T', 0x12, \ + struct snd_timer_params) +#define TARGET_SNDRV_TIMER_IOCTL_STATUS TARGET_IOR('T', 0x14, \ + struct target_snd_timer_status)#define TARGET_SNDRV_TIMER_IOCTL_START TARGET_IO('T', 0xa0)#define TARGET_SNDRV_TIMER_IOCTL_STOP TARGET_IO('T', 0xa1)#define TARGET_SNDRV_TIMER_IOCTL_CONTINUE TARGET_IO('T', 0xa2)
@@ -2750,12 +2750,12 @@ typedef int32_t target_timer_t;#ifdef TARGET_MIPS #define TARGET_SIGEV_PREAMBLE_SIZE (sizeof(int32_t) * 2 + sizeof(abi_long))#else -#define TARGET_SIGEV_PREAMBLE_SIZE (sizeof(int32_t) * 2 \ +#define TARGET_SIGEV_PREAMBLE_SIZE (sizeof(int32_t) * 2 \ + sizeof(target_sigval_t))#endif -#define TARGET_SIGEV_PAD_SIZE ((TARGET_SIGEV_MAX_SIZE \ - - TARGET_SIGEV_PREAMBLE_SIZE) \ +#define TARGET_SIGEV_PAD_SIZE ((TARGET_SIGEV_MAX_SIZE \ + - TARGET_SIGEV_PREAMBLE_SIZE) \ / sizeof(int32_t))struct target_sigevent {
@@ -2814,40 +2814,40 @@ struct target_user_cap_data {#define TARGET_SYSLOG_ACTION_SIZE_BUFFER 10struct target_statx_timestamp { -int64_t tv_sec; -uint32_t tv_nsec; -int32_t __reserved; +int64_t tv_sec; +uint32_t tv_nsec; +int32_t __reserved; };struct target_statx { -/* 0x00 */ -uint32_t stx_mask;/* What results were written [uncond] */ -uint32_t stx_blksize;/* Preferred general I/O size [uncond] */ -uint64_t stx_attributes;/* Flags conveying information about the file */ -/* 0x10 */ -uint32_t stx_nlink;/* Number of hard links */ -uint32_t stx_uid;/* User ID of owner */ -uint32_t stx_gid;/* Group ID of owner */ -uint16_t stx_mode;/* File mode */ -uint16_t __spare0[1 ]; -/* 0x20 */ -uint64_t stx_ino;/* Inode number */ -uint64_t stx_size;/* File size */ -uint64_t stx_blocks;/* Number of 512-byte blocks allocated */ -uint64_t stx_attributes_mask;/* Mask to show what is supported */ -/* 0x40 */ -struct target_statx_timestamp stx_atime;/* Last access time */ -struct target_statx_timestamp stx_btime;/* File creation time */ -struct target_statx_timestamp stx_ctime;/* Last attribute change time */ -struct target_statx_timestamp stx_mtime;/* Last data modification time */ -/* 0x80 */ -uint32_t stx_rdev_major;/* Device ID of special file [if bdev/cdev] */ -uint32_t stx_rdev_minor; -uint32_t stx_dev_major;/* ID of device containing file [uncond] */ -uint32_t stx_dev_minor; -/* 0x90 */ -uint64_t __spare2[14 ];/* Spare space for future expansion */ -/* 0x100 */ +/* 0x00 */ +uint32_t stx_mask;/* What results were written [uncond] */ +uint32_t stx_blksize;/* Preferred general I/O size [uncond] */ +uint64_t stx_attributes;/* Flags conveying information about the file */ +/* 0x10 */ +uint32_t stx_nlink;/* Number of hard links */ +uint32_t stx_uid;/* User ID of owner */ +uint32_t stx_gid;/* Group ID of owner */ +uint16_t stx_mode;/* File mode */ +uint16_t __spare0[1 ]; +/* 0x20 */ +uint64_t stx_ino;/* Inode number */ +uint64_t stx_size;/* File size */ +uint64_t stx_blocks;/* Number of 512-byte blocks allocated */ +uint64_t stx_attributes_mask;/* Mask to show what is supported */ +/* 0x40 */ +struct target_statx_timestamp stx_atime;/* Last access time */ +struct target_statx_timestamp stx_btime;/* File creation time */ +struct target_statx_timestamp stx_ctime;/* Last attribute change time */ +struct target_statx_timestamp stx_mtime;/* Last data modification time */ +/* 0x80 */ +uint32_t stx_rdev_major;/* Device ID of special file [if bdev/cdev] */ +uint32_t stx_rdev_minor; +uint32_t stx_dev_major;/* ID of device containing file [uncond] */ +uint32_t stx_dev_minor; +/* 0x90 */ +uint64_t __spare2[14 ];/* Spare space for future expansion */ +/* 0x100 */ };/* from kernel's include/linux/sched/types.h */
Signature · 1 line
2.34.1
PATCH 2/45 linux-user: Remove #if 0 block in syscall_defs.h
In reply to Richard HendersonThese definitions are in sparc/signal.c.
--- linux-user/syscall_defs.h | 24 ------------------------ 1 file changed, 24 deletions(-)
linux-user/syscall_defs.h +0 -24
@@ -547,30 +547,6 @@ typedef union target_sigval {int sival_int;abi_ulong sival_ptr; } target_sigval_t; -#if 0 -#if defined (TARGET_SPARC ) -typedef struct { -struct { -abi_ulong psr; -abi_ulong pc; -abi_ulong npc; -abi_ulong y; -abi_ulong u_regs[16 ];/* globals and ins */ - } si_regs; -int si_mask; -}__siginfo_t ; - -typedef struct { -unsigned long si_float_regs [32 ]; -unsigned long si_fsr; -unsigned long si_fpqdepth; -struct { -unsigned long *insn_addr; -unsigned long insn; - } si_fpqueue [16 ]; -}__siginfo_fpu_t ; -#endif -#endif #define TARGET_SI_MAX_SIZE 128
Signature · 1 line
2.34.1
PATCH 3/45 linux-user: Use abi_uint not uint32_t in syscall_defs.h
In reply to Richard Henderson--- linux-user/syscall_defs.h | 108 +++++++++++++++++++------------------- 1 file changed, 54 insertions(+), 54 deletions(-)
linux-user/syscall_defs.h +54 -54
@@ -67,7 +67,7 @@#define USE_UID16 #define target_id uint16_t#else -#define target_id uint32_t +#define target_id abi_uint#endif #if defined(TARGET_I386 ) || defined(TARGET_ARM ) || defined(TARGET_SH4 ) \
@@ -215,9 +215,9 @@ struct target_ip_mreqn {struct target_ip_mreq_source {/* big endian */ -uint32_t imr_multiaddr; -uint32_t imr_interface; -uint32_t imr_sourceaddr; +abi_uint imr_multiaddr; +abi_uint imr_interface; +abi_uint imr_sourceaddr; };struct target_linger {
@@ -508,9 +508,9 @@ typedef abi_ulong target_old_sa_flags; #if defined(TARGET_MIPS) struct target_sigaction { - uint32_t sa_flags; + abi_uint sa_flags; #if defined(TARGET_ABI_MIPSN32) - uint32_t _sa_handler; + abi_uint _sa_handler; #else abi_ulong _sa_handler; #endif
@@ -1620,19 +1620,19 @@ struct target_stat {struct QEMU_PACKED target_stat64 {uint64_t st_dev;#define TARGET_STAT64_HAS_BROKEN_ST_INO 1 -uint32_t pad0; -uint32_t __st_ino; +abi_uint pad0; +abi_uint __st_ino; -uint32_t st_mode; -uint32_t st_nlink; -uint32_t st_uid; -uint32_t st_gid; +abi_uint st_mode; +abi_uint st_nlink; +abi_uint st_uid; +abi_uint st_gid;uint64_t st_rdev;uint64_t __pad1;int64_t st_size;int32_t st_blksize; -uint32_t __pad2; +abi_uint __pad2;int64_t st_blocks;/* Number 512-byte blocks allocated. */ int target_st_atime;
@@ -2227,19 +2227,19 @@ struct target_statfs {#endif struct target_statfs64 { -uint32_t f_type; -uint32_t f_bsize; -uint32_t f_frsize;/* Fragment size - unsupported */ -uint32_t __pad; +abi_uint f_type; +abi_uint f_bsize; +abi_uint f_frsize;/* Fragment size - unsupported */ +abi_uint __pad;uint64_t f_blocks;uint64_t f_bfree;uint64_t f_files;uint64_t f_ffree;uint64_t f_bavail;target_fsid_t f_fsid; -uint32_t f_namelen; -uint32_t f_flags; -uint32_t f_spare[5 ]; +abi_uint f_namelen; +abi_uint f_flags; +abi_uint f_spare[5 ]; };#elif (defined(TARGET_PPC64) || defined(TARGET_X86_64) || \ defined(TARGET_SPARC64) || defined(TARGET_AARCH64) || \
@@ -2307,33 +2307,33 @@ struct target_statfs64 { };#else struct target_statfs { -uint32_t f_type; -uint32_t f_bsize; -uint32_t f_blocks; -uint32_t f_bfree; -uint32_t f_bavail; -uint32_t f_files; -uint32_t f_ffree; +abi_uint f_type; +abi_uint f_bsize; +abi_uint f_blocks; +abi_uint f_bfree; +abi_uint f_bavail; +abi_uint f_files; +abi_uint f_ffree;target_fsid_t f_fsid; -uint32_t f_namelen; -uint32_t f_frsize; -uint32_t f_flags; -uint32_t f_spare[4 ]; +abi_uint f_namelen; +abi_uint f_frsize; +abi_uint f_flags; +abi_uint f_spare[4 ]; };struct target_statfs64 { -uint32_t f_type; -uint32_t f_bsize; +abi_uint f_type; +abi_uint f_bsize;uint64_t f_blocks;uint64_t f_bfree;uint64_t f_bavail;uint64_t f_files;uint64_t f_ffree;target_fsid_t f_fsid; -uint32_t f_namelen; -uint32_t f_frsize; -uint32_t f_flags; -uint32_t f_spare[4 ]; +abi_uint f_namelen; +abi_uint f_frsize; +abi_uint f_flags; +abi_uint f_spare[4 ]; };#endif
@@ -2713,9 +2713,9 @@ struct target_epoll_event {#endif struct target_ucred { -uint32_t pid; -uint32_t uid; -uint32_t gid; +abi_uint pid; +abi_uint uid; +abi_uint gid; };typedef int32_t target_timer_t ;
@@ -2754,14 +2754,14 @@ struct target_sigevent { };struct target_user_cap_header { -uint32_t version; +abi_uint version;int pid; };struct target_user_cap_data { -uint32_t effective; -uint32_t permitted; -uint32_t inheritable; +abi_uint effective; +abi_uint permitted; +abi_uint inheritable; };/* from kernel's include/linux/syslog.h */
@@ -2791,19 +2791,19 @@ struct target_user_cap_data {struct target_statx_timestamp {int64_t tv_sec; -uint32_t tv_nsec; +abi_uint tv_nsec;int32_t __reserved; };struct target_statx {/* 0x00 */ -uint32_t stx_mask;/* What results were written [uncond] */ -uint32_t stx_blksize;/* Preferred general I/O size [uncond] */ +abi_uint stx_mask;/* What results were written [uncond] */ +abi_uint stx_blksize;/* Preferred general I/O size [uncond] */ uint64_t stx_attributes;/* Flags conveying information about the file */ /* 0x10 */ -uint32_t stx_nlink;/* Number of hard links */ -uint32_t stx_uid;/* User ID of owner */ -uint32_t stx_gid;/* Group ID of owner */ +abi_uint stx_nlink;/* Number of hard links */ +abi_uint stx_uid;/* User ID of owner */ +abi_uint stx_gid;/* Group ID of owner */ uint16_t stx_mode;/* File mode */ uint16_t __spare0[1 ];/* 0x20 */
@@ -2817,10 +2817,10 @@ struct target_statx {struct target_statx_timestamp stx_ctime;/* Last attribute change time */ struct target_statx_timestamp stx_mtime;/* Last data modification time */ /* 0x80 */ -uint32_t stx_rdev_major;/* Device ID of special file [if bdev/cdev] */ -uint32_t stx_rdev_minor; -uint32_t stx_dev_major;/* ID of device containing file [uncond] */ -uint32_t stx_dev_minor; +abi_uint stx_rdev_major;/* Device ID of special file [if bdev/cdev] */ +abi_uint stx_rdev_minor; +abi_uint stx_dev_major;/* ID of device containing file [uncond] */ +abi_uint stx_dev_minor;/* 0x90 */ uint64_t __spare2[14 ];/* Spare space for future expansion */ /* 0x100 */
Signature · 1 line
2.34.1
Re: [PATCH 03/45] linux-user: Use abi_uint not uint32_t in syscall_defs.h
Quoted 4 lines · Richard Henderson
Signed-off-by Richard Henderson <[email protected]>--- linux-user/syscall_defs.h | 108 +++++++++++++++++++------------------- 1 file changed, 54 insertions(+), 54 deletions(-)
[PULL 02/37] tests/multiarch: Add test-aes
In reply to Richard HendersonUse a shared driver and backends for i386, aarch64, ppc64, riscv64.
--- tests/tcg/aarch64/test-aes.c | 58 ++++++++ tests/tcg/i386/test-aes.c | 68 +++++++++ tests/tcg/ppc64/test-aes.c | 116 +++++++++++++++ tests/tcg/riscv64/test-aes.c | 81 +++++++++++ tests/tcg/multiarch/test-aes-main.c.inc | 183 ++++++++++++++++++++++++ tests/tcg/aarch64/Makefile.target | 4 + tests/tcg/i386/Makefile.target | 4 + tests/tcg/ppc64/Makefile.target | 1 + tests/tcg/riscv64/Makefile.target | 3 + 9 files changed, 518 insertions(+) create mode 100644 tests/tcg/aarch64/test-aes.c create mode 100644 tests/tcg/i386/test-aes.c create mode 100644 tests/tcg/ppc64/test-aes.c create mode 100644 tests/tcg/riscv64/test-aes.c create mode 100644 tests/tcg/multiarch/test-aes-main.c.inc
tests/tcg/aarch64/test-aes.c new file +58 -0
@@ -0,0 +1,58 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#include "../multiarch/test-aes-main.c.inc" + +bool test_SB_SR (uint8_t *o,const uint8_t *i) +{ +/* aese also adds round key, so supply zero. */ + asm("ld1 { v0.16b }, [%1]\n\t" +"movi v1.16b, #0\n\t" +"aese v0.16b, v1.16b\n\t" +"st1 { v0.16b }, [%0]" + : :"r" (o),"r" (i) :"v0" ,"v1" ,"memory" ); +return true; +} + +bool test_MC (uint8_t *o,const uint8_t *i) +{ + asm("ld1 { v0.16b }, [%1]\n\t" +"aesmc v0.16b, v0.16b\n\t" +"st1 { v0.16b }, [%0]" + : :"r" (o),"r" (i) :"v0" ,"memory" ); +return true; +} + +bool test_SB_SR_MC_AK (uint8_t *o,const uint8_t *i,const uint8_t *k) +{ +return false; +} + +bool test_ISB_ISR (uint8_t *o,const uint8_t *i) +{ +/* aesd also adds round key, so supply zero. */ + asm("ld1 { v0.16b }, [%1]\n\t" +"movi v1.16b, #0\n\t" +"aesd v0.16b, v1.16b\n\t" +"st1 { v0.16b }, [%0]" + : :"r" (o),"r" (i) :"v0" ,"v1" ,"memory" ); +return true; +} + +bool test_IMC (uint8_t *o,const uint8_t *i) +{ + asm("ld1 { v0.16b }, [%1]\n\t" +"aesimc v0.16b, v0.16b\n\t" +"st1 { v0.16b }, [%0]" + : :"r" (o),"r" (i) :"v0" ,"memory" ); +return true; +} + +bool test_ISB_ISR_AK_IMC (uint8_t *o,const uint8_t *i,const uint8_t *k) +{ +return false; +} + +bool test_ISB_ISR_IMC_AK (uint8_t *o,const uint8_t *i,const uint8_t *k) +{ +return false; +}
tests/tcg/i386/test-aes.c new file +68 -0
68 lines not on this page · raw message
tests/tcg/ppc64/test-aes.c new file +116 -0
116 lines not on this page · raw message
tests/tcg/riscv64/test-aes.c new file +81 -0
81 lines not on this page · raw message
tests/tcg/multiarch/test-aes-main.c.inc new file +183 -0
183 lines not on this page · raw message
tests/tcg/aarch64/Makefile.target +4 -0
@@ -74,6 +74,10 @@ ifneq ($(CROSS_CC_HAS_SVE),) AARCH64_TESTS += sve-ioctls sve-ioctls: CFLAGS+=-march=armv8.1-a+sve +AARCH64_TESTS += test-aes +test-aes: CFLAGS += -O -march=armv8-a+aes +test-aes: test-aes-main.c.inc + # Vector SHA1 sha1-vector: CFLAGS=-O3 sha1-vector: sha1.c
tests/tcg/i386/Makefile.target +4 -0
@@ -28,6 +28,10 @@ run-test-i386-bmi2: QEMU_OPTS += -cpu max test-i386-adcox: CFLAGS=-O2 run-test-i386-adcox: QEMU_OPTS += -cpu max +test-aes: CFLAGS += -O -msse2 -maes +test-aes: test-aes-main.c.inc +run-test-aes: QEMU_OPTS += -cpu max + # # hello-i386 is a barebones app #
tests/tcg/ppc64/Makefile.target +1 -0
@@ -36,5 +36,6 @@ run-vector: QEMU_OPTS += -cpu POWER10 PPC64_TESTS += signal_save_restore_xer PPC64_TESTS += xxspltw +PPC64_TESTS += test-aes TESTS += $(PPC64_TESTS)
tests/tcg/riscv64/Makefile.target +3 -0
@@ -9,3 +9,6 @@ TESTS += noexec TESTS += test-noc test-noc: LDFLAGS = -nostdlib -static run-test-noc: QEMU_OPTS += -cpu rv64,c=false + +TESTS += test-aes +run-test-aes: QEMU_OPTS += -cpu rv64,zk=on
Signature · 1 line
2.34.1
[PULL 07/37] crypto: Add aesenc_MC
In reply to Richard HendersonAdd a primitive for MixColumns.
--- host/include/generic/host/crypto/aes-round.h | 2 + include/crypto/aes-round.h | 18 ++++++ crypto/aes.c | 61 ++++++++++++++++++++ 3 files changed, 81 insertions(+)
host/include/generic/host/crypto/aes-round.h +2 -0
@@ -9,6 +9,8 @@#define HAVE_AES_ACCEL false#define ATTR_AES_ACCEL +void aesenc_MC_accel(AESState *, const AESState *, bool) + QEMU_ERROR("unsupported accel"); void aesenc_SB_SR_AK_accel(AESState *, const AESState *, const AESState *, bool) QEMU_ERROR("unsupported accel");
include/crypto/aes-round.h +18 -0
@@ -20,6 +20,24 @@ typedef union {#include "host/crypto/aes-round.h" +/* +* Perform MixColumns. +*/ + +void aesenc_MC_gen (AESState *ret,const AESState *st); +void aesenc_MC_genrev (AESState *ret,const AESState *st); + +static inline void aesenc_MC (AESState *r,const AESState *st,bool be) +{ +if (HAVE_AES_ACCEL ) { +aesenc_MC_accel (r, st, be); + }else if (HOST_BIG_ENDIAN == be) { +aesenc_MC_gen (r, st); + }else { +aesenc_MC_genrev (r, st); + } +} +/* * Perform SubBytes + ShiftRows + AddRoundKey. */
crypto/aes.c +61 -0
73 lines not on this page · raw message
Signature · 1 line
2.34.1
PATCH 4/45 linux-user: Use abi_int not int32_t in syscall_defs.h
In reply to Richard Henderson--- linux-user/syscall_defs.h | 60 +++++++++++++++++++-------------------- 1 file changed, 30 insertions(+), 30 deletions(-)
linux-user/syscall_defs.h +30 -30
@@ -501,7 +501,7 @@ int do_sigaction(int sig, const struct target_sigaction *act,#endif #if defined(TARGET_ALPHA ) -typedef int32_t target_old_sa_flags ; +typedef abi_int target_old_sa_flags ;#else typedef abi_ulong target_old_sa_flags ;#endif
@@ -1631,7 +1631,7 @@ struct QEMU_PACKED target_stat64 {uint64_t __pad1;int64_t st_size; -int32_t st_blksize; +abi_int st_blksize;abi_uint __pad2;int64_t st_blocks;/* Number 512-byte blocks allocated. */
@@ -2192,20 +2192,20 @@ typedef struct {#ifdef TARGET_MIPS #ifdef TARGET_ABI_MIPSN32 struct target_statfs { -int32_t f_type; -int32_t f_bsize; -int32_t f_frsize;/* Fragment size - unsupported */ -int32_t f_blocks; -int32_t f_bfree; -int32_t f_files; -int32_t f_ffree; -int32_t f_bavail; +abi_int f_type; +abi_int f_bsize; +abi_int f_frsize;/* Fragment size - unsupported */ +abi_int f_blocks; +abi_int f_bfree; +abi_int f_files; +abi_int f_ffree; +abi_int f_bavail;/* Linux specials */ target_fsid_t f_fsid; -int32_t f_namelen; -int32_t f_flags; -int32_t f_spare[5 ]; +abi_int f_namelen; +abi_int f_flags; +abi_int f_spare[5 ]; };#else struct target_statfs {
@@ -2276,34 +2276,34 @@ struct target_statfs64 { };#elif defined(TARGET_S390X )struct target_statfs { -int32_t f_type; -int32_t f_bsize; +abi_int f_type; +abi_int f_bsize;abi_long f_blocks;abi_long f_bfree;abi_long f_bavail;abi_long f_files;abi_long f_ffree;kernel_fsid_t f_fsid; -int32_t f_namelen; -int32_t f_frsize; -int32_t f_flags; -int32_t f_spare[4 ]; +abi_int f_namelen; +abi_int f_frsize; +abi_int f_flags; +abi_int f_spare[4 ]; };struct target_statfs64 { -int32_t f_type; -int32_t f_bsize; +abi_int f_type; +abi_int f_bsize;abi_long f_blocks;abi_long f_bfree;abi_long f_bavail;abi_long f_files;abi_long f_ffree;kernel_fsid_t f_fsid; -int32_t f_namelen; -int32_t f_frsize; -int32_t f_flags; -int32_t f_spare[4 ]; +abi_int f_namelen; +abi_int f_frsize; +abi_int f_flags; +abi_int f_spare[4 ]; };#else struct target_statfs {
@@ -2718,21 +2718,21 @@ struct target_ucred {abi_uint gid; }; -typedef int32_t target_timer_t ; +typedef abi_int target_timer_t ;#define TARGET_SIGEV_MAX_SIZE 64/* This is architecture-specific but most architectures use the default */ #ifdef TARGET_MIPS -#define TARGET_SIGEV_PREAMBLE_SIZE (sizeof(int32_t) * 2 + sizeof(abi_long)) +#define TARGET_SIGEV_PREAMBLE_SIZE (sizeof(abi_int) * 2 + sizeof(abi_long))#else -#define TARGET_SIGEV_PREAMBLE_SIZE (sizeof(int32_t) * 2 \ +#define TARGET_SIGEV_PREAMBLE_SIZE (sizeof(abi_int) * 2 \ + sizeof(target_sigval_t))#endif #define TARGET_SIGEV_PAD_SIZE ((TARGET_SIGEV_MAX_SIZE \ - TARGET_SIGEV_PREAMBLE_SIZE) \ - / sizeof(int32_t)) + / sizeof(abi_int))struct target_sigevent {target_sigval_t sigev_value;
@@ -2792,7 +2792,7 @@ struct target_user_cap_data {struct target_statx_timestamp {int64_t tv_sec;abi_uint tv_nsec; -int32_t __reserved; +abi_int __reserved; };struct target_statx {
Signature · 1 line
2.34.1
[PULL 15/37] target/ppc: Use aesenc_SB_SR_AK
In reply to Richard HendersonThis implements the VCIPHERLAST instruction.
--- target/ppc/int_helper.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
target/ppc/int_helper.c +2 -7
@@ -25,6 +25,7 @@#include "qemu/log.h" #include "exec/helper-proto.h" #include "crypto/aes.h" +#include "crypto/aes-round.h" #include "fpu/softfloat.h" #include "qapi/error.h" #include "qemu/guest-random.h"
@@ -2947,13 +2948,7 @@ void helper_vcipher(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b)void helper_vcipherlast (ppc_avr_t *r,ppc_avr_t *a,ppc_avr_t *b) { -ppc_avr_t result; -int i; - - VECTOR_FOR_INORDER_I(i, u8) { - result.VsrB (i) = b->VsrB (i) ^ (AES_sbox[a->VsrB (AES_shifts[i])]); - } - *r = result; +aesenc_SB_SR_AK ((AESState *)r, (AESState *)a, (AESState *)b, true); }void helper_vncipher (ppc_avr_t *r,ppc_avr_t *a,ppc_avr_t *b)
Signature · 1 line
2.34.1
PATCH 5/45 linux-user: Use abi_ullong not uint64_t in syscall_defs.h
In reply to Richard HendersonBe careful not to change linux_dirent64, which is a host structure.
--- linux-user/syscall_defs.h | 72 +++++++++++++++++++-------------------- 1 file changed, 36 insertions(+), 36 deletions(-)
linux-user/syscall_defs.h +36 -36
@@ -1444,8 +1444,8 @@ struct target_stat64 {unsigned char __pad0[6 ];unsigned short st_dev; -uint64_t st_ino; -uint64_t st_nlink; +abi_ullong st_ino; +abi_ullong st_nlink;unsigned int st_mode;
@@ -1501,7 +1501,7 @@ struct target_stat64 {unsigned char __pad0[6 ];unsigned short st_dev; -uint64_t st_ino; +abi_ullong st_ino;unsigned int st_mode;unsigned int st_nlink;
@@ -1618,7 +1618,7 @@ struct target_stat {/* FIXME: Microblaze no-mmu user-space has a difference stat64 layout... */ #define TARGET_HAS_STRUCT_STAT64 struct QEMU_PACKED target_stat64 { -uint64_t st_dev; +abi_ullong st_dev;#define TARGET_STAT64_HAS_BROKEN_ST_INO 1abi_uint pad0;abi_uint __st_ino;
@@ -1627,8 +1627,8 @@ struct QEMU_PACKED target_stat64 {abi_uint st_nlink;abi_uint st_uid;abi_uint st_gid; -uint64_t st_rdev; -uint64_t __pad1; +abi_ullong st_rdev; +abi_ullong __pad1;int64_t st_size;abi_int st_blksize;
@@ -1641,7 +1641,7 @@ struct QEMU_PACKED target_stat64 {unsigned int target_st_mtime_nsec;int target_st_ctime;unsigned int target_st_ctime_nsec; - uint64_t st_ino; + abi_ullong st_ino; };#elif defined(TARGET_M68K)
@@ -1753,7 +1753,7 @@ struct target_stat {struct target_stat {abi_ulong st_dev;abi_ulong st_pad0[3 ];/* Reserved for st_dev expansion */ -uint64_t st_ino; +abi_ullong st_ino;unsigned int st_mode;unsigned int st_nlink;int st_uid;
@@ -1813,7 +1813,7 @@ struct target_stat64 {abi_ulong st_dev;abi_ulong st_pad0[3 ];/* Reserved for st_dev expansion */ -uint64_t st_ino; +abi_ullong st_ino;unsigned int st_mode;unsigned int st_nlink;
@@ -2044,17 +2044,17 @@ struct target_stat {#define TARGET_HAS_STRUCT_STAT64 struct target_stat64 { -uint64_t st_dev;/* Device */ -uint64_t st_ino;/* File serial number */ +abi_ullong st_dev;/* Device */ +abi_ullong st_ino;/* File serial number */ unsigned int st_mode;/* File mode. */ unsigned int st_nlink;/* Link count. */ unsigned int st_uid;/* User ID of the file's owner. */ unsigned int st_gid;/* Group ID of the file's group. */ -uint64_t st_rdev;/* Device number, if device. */ +abi_ullong st_rdev;/* Device number, if device. */ int64_t st_size;/* Size of file, in bytes. */ abi_ulong st_blksize;/* Optimal block size for I/O. */ abi_ulong __unused2; -uint64_t st_blocks;/* Number 512-byte blocks allocated. */ +abi_ullong st_blocks;/* Number 512-byte blocks allocated. */ abi_ulong target_st_atime;/* Time of last access. */ abi_ulong target_st_atime_nsec;abi_ulong target_st_mtime;/* Time of last modification. */
@@ -2097,14 +2097,14 @@ struct target_stat { #if !defined(TARGET_RISCV64) #define TARGET_HAS_STRUCT_STAT64 struct target_stat64 { - uint64_t st_dev; - uint64_t st_ino; + abi_ullong st_dev; + abi_ullong st_ino; unsigned int st_mode; unsigned int st_nlink; unsigned int st_uid; unsigned int st_gid; - uint64_t st_rdev; - uint64_t __pad1; + abi_ullong st_rdev; + abi_ullong __pad1; int64_t st_size; int st_blksize; int __pad2;
@@ -2156,14 +2156,14 @@ struct target_stat {#define TARGET_HAS_STRUCT_STAT64 struct target_stat64 { -uint64_t st_dev; +abi_ullong st_dev;abi_uint _pad1;abi_uint _res1;abi_uint st_mode;abi_uint st_nlink;abi_uint st_uid;abi_uint st_gid; -uint64_t st_rdev; +abi_ullong st_rdev;abi_uint _pad2;int64_t st_size;abi_int st_blksize;
@@ -2174,7 +2174,7 @@ struct target_stat64 {abi_uint target_st_mtime_nsec;abi_int target_st_ctime;abi_uint target_st_ctime_nsec; - uint64_t st_ino; + abi_ullong st_ino; };#elif defined(TARGET_LOONGARCH64)
@@ -2231,11 +2231,11 @@ struct target_statfs64 {abi_uint f_bsize;abi_uint f_frsize;/* Fragment size - unsupported */ abi_uint __pad; -uint64_t f_blocks; -uint64_t f_bfree; -uint64_t f_files; -uint64_t f_ffree; -uint64_t f_bavail; +abi_ullong f_blocks; +abi_ullong f_bfree; +abi_ullong f_files; +abi_ullong f_ffree; +abi_ullong f_bavail;target_fsid_t f_fsid;abi_uint f_namelen;abi_uint f_flags;
@@ -2324,11 +2324,11 @@ struct target_statfs {struct target_statfs64 {abi_uint f_type;abi_uint f_bsize; -uint64_t f_blocks; -uint64_t f_bfree; -uint64_t f_bavail; -uint64_t f_files; -uint64_t f_ffree; +abi_ullong f_blocks; +abi_ullong f_bfree; +abi_ullong f_bavail; +abi_ullong f_files; +abi_ullong f_ffree;target_fsid_t f_fsid;abi_uint f_namelen;abi_uint f_frsize;
@@ -2799,7 +2799,7 @@ struct target_statx {/* 0x00 */ abi_uint stx_mask;/* What results were written [uncond] */ abi_uint stx_blksize;/* Preferred general I/O size [uncond] */ -uint64_t stx_attributes;/* Flags conveying information about the file */ +abi_ullong stx_attributes;/* Flags conveying information about the file */ /* 0x10 */ abi_uint stx_nlink;/* Number of hard links */ abi_uint stx_uid;/* User ID of owner */
@@ -2807,10 +2807,10 @@ struct target_statx {uint16_t stx_mode;/* File mode */ uint16_t __spare0[1 ];/* 0x20 */ -uint64_t stx_ino;/* Inode number */ -uint64_t stx_size;/* File size */ -uint64_t stx_blocks;/* Number of 512-byte blocks allocated */ -uint64_t stx_attributes_mask;/* Mask to show what is supported */ +abi_ullong stx_ino;/* Inode number */ +abi_ullong stx_size;/* File size */ +abi_ullong stx_blocks;/* Number of 512-byte blocks allocated */ +abi_ullong stx_attributes_mask;/* Mask to show what is supported */ /* 0x40 */ struct target_statx_timestamp stx_atime;/* Last access time */ struct target_statx_timestamp stx_btime;/* File creation time */
@@ -2822,7 +2822,7 @@ struct target_statx {abi_uint stx_dev_major;/* ID of device containing file [uncond] */ abi_uint stx_dev_minor;/* 0x90 */ -uint64_t __spare2[14 ];/* Spare space for future expansion */ +abi_ullong __spare2[14 ];/* Spare space for future expansion */ /* 0x100 */ };
Signature · 1 line
2.34.1
PATCH 6/45 linux-user: Use abi_llong not int64_t in syscall_defs.h
In reply to Richard HendersonBe careful not to change linux_dirent64, which is a host structure.
--- linux-user/syscall_defs.h | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-)
linux-user/syscall_defs.h +15 -15
@@ -1455,8 +1455,8 @@ struct target_stat64 {unsigned char __pad2[6 ];unsigned short st_rdev; -int64_t st_size; -int64_t st_blksize; +abi_llong st_size; +abi_llong st_blksize;unsigned char __pad4[4 ];unsigned int st_blocks;
@@ -1514,7 +1514,7 @@ struct target_stat64 {unsigned char __pad3[8 ]; -int64_t st_size; +abi_llong st_size;unsigned int st_blksize;unsigned char __pad4[8 ];
@@ -1630,10 +1630,10 @@ struct QEMU_PACKED target_stat64 {abi_ullong st_rdev;abi_ullong __pad1; -int64_t st_size; +abi_llong st_size;abi_int st_blksize;abi_uint __pad2; -int64_t st_blocks;/* Number 512-byte blocks allocated. */ +abi_llong st_blocks;int target_st_atime;unsigned int target_st_atime_nsec;
@@ -1760,7 +1760,7 @@ struct target_stat {int st_gid;abi_ulong st_rdev;abi_ulong st_pad1[3 ];/* Reserved for st_rdev expansion */ -int64_t st_size; +abi_llong st_size;abi_long target_st_atime;abi_ulong target_st_atime_nsec;/* Reserved for st_atime expansion */ abi_long target_st_mtime;
@@ -1769,7 +1769,7 @@ struct target_stat {abi_ulong target_st_ctime_nsec;/* Reserved for st_ctime expansion */ abi_ulong st_blksize;abi_ulong st_pad2; - int64_t st_blocks; + abi_llong st_blocks; };#elif defined(TARGET_ABI_MIPSO32)
@@ -1824,7 +1824,7 @@ struct target_stat64 {abi_ulong st_rdev;abi_ulong st_pad1[3 ];/* Reserved for st_rdev expansion */ -int64_t st_size; +abi_llong st_size;/* * Actually this should be timestruc_t st_atime, st_mtime and st_ctime
@@ -1842,7 +1842,7 @@ struct target_stat64 {abi_ulong st_blksize;abi_ulong st_pad2; - int64_t st_blocks; + abi_llong st_blocks; };#elif defined(TARGET_ALPHA)
@@ -2051,7 +2051,7 @@ struct target_stat64 {unsigned int st_uid;/* User ID of the file's owner. */ unsigned int st_gid;/* Group ID of the file's group. */ abi_ullong st_rdev;/* Device number, if device. */ -int64_t st_size;/* Size of file, in bytes. */ +abi_llong st_size;/* Size of file, in bytes. */ abi_ulong st_blksize;/* Optimal block size for I/O. */ abi_ulong __unused2;abi_ullong st_blocks;/* Number 512-byte blocks allocated. */
@@ -2105,10 +2105,10 @@ struct target_stat64 {unsigned int st_gid;abi_ullong st_rdev;abi_ullong __pad1; -int64_t st_size; +abi_llong st_size;int st_blksize;int __pad2; -int64_t st_blocks; +abi_llong st_blocks;int target_st_atime;unsigned int target_st_atime_nsec;int target_st_mtime;
@@ -2165,9 +2165,9 @@ struct target_stat64 {abi_uint st_gid;abi_ullong st_rdev;abi_uint _pad2; -int64_t st_size; +abi_llong st_size;abi_int st_blksize; -int64_t st_blocks; +abi_llong st_blocks;abi_int target_st_atime;abi_uint target_st_atime_nsec;abi_int target_st_mtime;
@@ -2790,7 +2790,7 @@ struct target_user_cap_data {#define TARGET_SYSLOG_ACTION_SIZE_BUFFER 10struct target_statx_timestamp { -int64_t tv_sec; +abi_llong tv_sec;abi_uint tv_nsec;abi_int __reserved; };
Signature · 1 line
2.34.1
[PULL 19/37] target/i386: Use aesenc_SB_SR_AK
In reply to Richard HendersonThis implements the AESENCLAST instruction.
--- target/i386/ops_sse.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
target/i386/ops_sse.h +6 -5
@@ -19,6 +19,7 @@*/ #include "crypto/aes.h" +#include "crypto/aes-round.h" #if SHIFT ==0 #define Reg MMXReg
@@ -2202,12 +2203,12 @@ void glue(helper_aesenc, SUFFIX)(CPUX86State *env, Reg *d, Reg *v, Reg *s)void glue (helper_aesenclast ,SUFFIX )(CPUX86State *env,Reg *d,Reg *v,Reg *s) { -int i; -Reg st = *v; -Reg rk = *s; +for (int i =0 ; i <SHIFT ; i++) { +AESState *ad = (AESState *)&d->ZMM_X (i); +AESState *st = (AESState *)&v->ZMM_X (i); +AESState *rk = (AESState *)&s->ZMM_X (i); -for (i =0 ; i <8 <<SHIFT ; i++) { - d->B (i) = rk.B (i) ^ (AES_sbox[st.B (AES_shifts[i &15 ] + (i & ~15 ))]); +aesenc_SB_SR_AK (ad, st, rk, false); } }
Signature · 1 line
2.34.1
[PULL 16/37] target/ppc: Use aesdec_ISB_ISR_AK
In reply to Richard HendersonThis implements the VNCIPHERLAST instruction.
--- target/ppc/int_helper.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
target/ppc/int_helper.c +1 -7
@@ -2973,13 +2973,7 @@ void helper_vncipher(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b)void helper_vncipherlast (ppc_avr_t *r,ppc_avr_t *a,ppc_avr_t *b) { -ppc_avr_t result; -int i; - - VECTOR_FOR_INORDER_I(i, u8) { - result.VsrB (i) = b->VsrB (i) ^ (AES_isbox[a->VsrB (AES_ishifts[i])]); - } - *r = result; +aesdec_ISB_ISR_AK ((AESState *)r, (AESState *)a, (AESState *)b, true); }void helper_vshasigmaw (ppc_avr_t *r,ppc_avr_t *a,uint32_t st_six)
Signature · 1 line
2.34.1
PATCH 7/45 linux-user: Use abi_uint not unsigned int in syscall_defs.h
In reply to Richard Henderson--- linux-user/syscall_defs.h | 290 +++++++++++++++++++------------------- 1 file changed, 145 insertions(+), 145 deletions(-)
linux-user/syscall_defs.h +145 -145
@@ -366,7 +366,7 @@ struct target_msghdr {abi_long msg_iovlen;/* Number of blocks */ abi_long msg_control;/* Per protocol magic (eg BSD file descriptor passing) */ abi_long msg_controllen;/* Length of cmsg list */ -unsigned int msg_flags; +abi_uint msg_flags; };struct target_cmsghdr {
@@ -403,7 +403,7 @@ __target_cmsg_nxthdr(struct target_msghdr *__mhdr,struct target_mmsghdr {struct target_msghdr msg_hdr;/* Message header */ -unsigned int msg_len;/* Number of bytes transmitted */ +abi_uint msg_len;/* Number of bytes transmitted */ };struct target_rusage {
@@ -595,8 +595,8 @@ typedef struct target_siginfo {/* POSIX.1b timers */ struct { -unsigned int _timer1; -unsigned int _timer2; +abi_uint _timer1; +abi_uint _timer2; } _timer;/* POSIX.1b signals */
@@ -857,10 +857,10 @@ struct target_rtc_pll_info {#define TARGET_TUNSETOWNER TARGET_IOW('T', 204, int)#define TARGET_TUNSETLINK TARGET_IOW('T', 205, int)#define TARGET_TUNSETGROUP TARGET_IOW('T', 206, int) -#define TARGET_TUNGETFEATURES TARGET_IOR('T', 207, unsigned int) -#define TARGET_TUNSETOFFLOAD TARGET_IOW('T', 208, unsigned int) -#define TARGET_TUNSETTXFILTER TARGET_IOW('T', 209, unsigned int) -#define TARGET_TUNGETIFF TARGET_IOR('T', 210, unsigned int) +#define TARGET_TUNGETFEATURES TARGET_IOR('T', 207, abi_uint) +#define TARGET_TUNSETOFFLOAD TARGET_IOW('T', 208, abi_uint) +#define TARGET_TUNSETTXFILTER TARGET_IOW('T', 209, abi_uint) +#define TARGET_TUNGETIFF TARGET_IOR('T', 210, abi_uint)#define TARGET_TUNGETSNDBUF TARGET_IOR('T', 211, int)#define TARGET_TUNSETSNDBUF TARGET_IOW('T', 212, int)/*
@@ -870,7 +870,7 @@ struct target_rtc_pll_info {#define TARGET_TUNGETVNETHDRSZ TARGET_IOR('T', 215, int)#define TARGET_TUNSETVNETHDRSZ TARGET_IOW('T', 216, int)#define TARGET_TUNSETQUEUE TARGET_IOW('T', 217, int) -#define TARGET_TUNSETIFINDEX TARGET_IOW('T', 218, unsigned int) +#define TARGET_TUNSETIFINDEX TARGET_IOW('T', 218, abi_uint)/* TUNGETFILTER is not supported: see TUNATTACHFILTER. */ #define TARGET_TUNSETVNETLE TARGET_IOW('T', 220, int)#define TARGET_TUNGETVNETLE TARGET_IOR('T', 221, int)
@@ -1361,8 +1361,8 @@ struct target_stat64 {#define TARGET_STAT64_HAS_BROKEN_ST_INO 1abi_ulong __st_ino; -unsigned int st_mode; -unsigned int st_nlink; +abi_uint st_mode; +abi_uint st_nlink;abi_ulong st_uid;abi_ulong st_gid;
@@ -1392,20 +1392,20 @@ struct target_stat64 {#define TARGET_HAS_STRUCT_STAT64 struct target_eabi_stat64 {unsigned long long st_dev; -unsigned int __pad1; +abi_uint __pad1;abi_ulong __st_ino; -unsigned int st_mode; -unsigned int st_nlink; +abi_uint st_mode; +abi_uint st_nlink;abi_ulong st_uid;abi_ulong st_gid;unsigned long long st_rdev; -unsigned int __pad2[2 ]; +abi_uint __pad2[2 ];long long st_size;abi_ulong st_blksize; -unsigned int __pad3; +abi_uint __pad3;unsigned long long st_blocks;abi_ulong target_st_atime;
@@ -1423,13 +1423,13 @@ struct target_eabi_stat64 { #elif defined(TARGET_SPARC64) && !defined(TARGET_ABI32) struct target_stat { - unsigned int st_dev; + abi_uint st_dev; abi_ulong st_ino; - unsigned int st_mode; - unsigned int st_nlink; - unsigned int st_uid; - unsigned int st_gid; - unsigned int st_rdev; + abi_uint st_mode; + abi_uint st_nlink; + abi_uint st_uid; + abi_uint st_gid; + abi_uint st_rdev; abi_long st_size; abi_long target_st_atime; abi_long target_st_mtime;
@@ -1447,10 +1447,10 @@ struct target_stat64 {abi_ullong st_ino;abi_ullong st_nlink; -unsigned int st_mode; +abi_uint st_mode; -unsigned int st_uid; -unsigned int st_gid; +abi_uint st_uid; +abi_uint st_gid;unsigned char __pad2[6 ];unsigned short st_rdev;
@@ -1459,7 +1459,7 @@ struct target_stat64 {abi_llong st_blksize;unsigned char __pad4[4 ]; -unsigned int st_blocks; +abi_uint st_blocks;abi_ulong target_st_atime;abi_ulong target_st_atime_nsec;
@@ -1503,11 +1503,11 @@ struct target_stat64 {abi_ullong st_ino; -unsigned int st_mode; -unsigned int st_nlink; +abi_uint st_mode; +abi_uint st_nlink; -unsigned int st_uid; -unsigned int st_gid; +abi_uint st_uid; +abi_uint st_gid;unsigned char __pad2[6 ];unsigned short st_rdev;
@@ -1515,22 +1515,22 @@ struct target_stat64 {unsigned char __pad3[8 ];abi_llong st_size; -unsigned int st_blksize; +abi_uint st_blksize;unsigned char __pad4[8 ]; -unsigned int st_blocks; +abi_uint st_blocks; -unsigned int target_st_atime; -unsigned int target_st_atime_nsec; +abi_uint target_st_atime; +abi_uint target_st_atime_nsec; -unsigned int target_st_mtime; -unsigned int target_st_mtime_nsec; +abi_uint target_st_mtime; +abi_uint target_st_mtime_nsec; -unsigned int target_st_ctime; -unsigned int target_st_ctime_nsec; +abi_uint target_st_ctime; +abi_uint target_st_ctime_nsec; -unsigned int __unused1; - unsigned int __unused2; +abi_uint __unused1; + abi_uint __unused2; };#elif defined(TARGET_PPC)
@@ -1541,13 +1541,13 @@ struct target_stat {abi_ulong st_ino;#if defined(TARGET_PPC64 )abi_ulong st_nlink; -unsigned int st_mode; +abi_uint st_mode;#else -unsigned int st_mode; +abi_uint st_mode;unsigned short st_nlink;#endif -unsigned int st_uid; -unsigned int st_gid; +abi_uint st_uid; +abi_uint st_gid;abi_ulong st_rdev;abi_ulong st_size;abi_ulong st_blksize;
@@ -1570,24 +1570,24 @@ struct target_stat {struct QEMU_PACKED target_stat64 {unsigned long long st_dev;unsigned long long st_ino; -unsigned int st_mode; -unsigned int st_nlink; -unsigned int st_uid; -unsigned int st_gid; +abi_uint st_mode; +abi_uint st_nlink; +abi_uint st_uid; +abi_uint st_gid;unsigned long long st_rdev;unsigned long long __pad0;long long st_size;int st_blksize; -unsigned int __pad1; +abi_uint __pad1;long long st_blocks;/* Number 512-byte blocks allocated. */ int target_st_atime; -unsigned int target_st_atime_nsec; +abi_uint target_st_atime_nsec;int target_st_mtime; -unsigned int target_st_mtime_nsec; +abi_uint target_st_mtime_nsec;int target_st_ctime; -unsigned int target_st_ctime_nsec; -unsigned int __unused4; -unsigned int __unused5; +abi_uint target_st_ctime_nsec; +abi_uint __unused4; +abi_uint __unused5; };#endif
@@ -1597,10 +1597,10 @@ struct QEMU_PACKED target_stat64 {struct target_stat {abi_ulong st_dev;abi_ulong st_ino; -unsigned int st_mode; +abi_uint st_mode;unsigned short st_nlink; -unsigned int st_uid; -unsigned int st_gid; +abi_uint st_uid; +abi_uint st_gid;abi_ulong st_rdev;abi_ulong st_size;abi_ulong st_blksize;
@@ -1636,11 +1636,11 @@ struct QEMU_PACKED target_stat64 {abi_llong st_blocks;int target_st_atime; -unsigned int target_st_atime_nsec; +abi_uint target_st_atime_nsec;int target_st_mtime; -unsigned int target_st_mtime_nsec; +abi_uint target_st_mtime_nsec;int target_st_ctime; -unsigned int target_st_ctime_nsec; +abi_uint target_st_ctime_nsec;abi_ullong st_ino; };
@@ -1680,8 +1680,8 @@ struct target_stat64 {#define TARGET_STAT64_HAS_BROKEN_ST_INO 1abi_ulong __st_ino; -unsigned int st_mode; -unsigned int st_nlink; +abi_uint st_mode; +abi_uint st_nlink;abi_ulong st_uid;abi_ulong st_gid;
@@ -1712,19 +1712,19 @@ struct target_stat64 {#define TARGET_STAT_HAVE_NSEC /* The memory layout is the same as of struct stat64 of the 32-bit kernel. */ struct target_stat { -unsigned int st_dev; -unsigned int st_pad0[3 ];/* Reserved for st_dev expansion */ +abi_uint st_dev; +abi_uint st_pad0[3 ];/* Reserved for st_dev expansion */ abi_ulong st_ino; -unsigned int st_mode; -unsigned int st_nlink; +abi_uint st_mode; +abi_uint st_nlink;int st_uid;int st_gid; -unsigned int st_rdev; -unsigned int st_pad1[3 ];/* Reserved for st_rdev expansion */ +abi_uint st_rdev; +abi_uint st_pad1[3 ];/* Reserved for st_rdev expansion */ abi_ulong st_size;
@@ -1732,17 +1732,17 @@ struct target_stat {* Actually this should be timestruc_t st_atime, st_mtime and st_ctime * but we don't have it under Linux. */ -unsigned int target_st_atime; -unsigned int target_st_atime_nsec; +abi_uint target_st_atime; +abi_uint target_st_atime_nsec; -unsigned int target_st_mtime; -unsigned int target_st_mtime_nsec; +abi_uint target_st_mtime; +abi_uint target_st_mtime_nsec; -unsigned int target_st_ctime; -unsigned int target_st_ctime_nsec; +abi_uint target_st_ctime; +abi_uint target_st_ctime_nsec; -unsigned int st_blksize; -unsigned int st_pad2; +abi_uint st_blksize; +abi_uint st_pad2;abi_ulong st_blocks; };
@@ -1754,8 +1754,8 @@ struct target_stat {abi_ulong st_dev;abi_ulong st_pad0[3 ];/* Reserved for st_dev expansion */ abi_ullong st_ino; -unsigned int st_mode; -unsigned int st_nlink; +abi_uint st_mode; +abi_uint st_nlink;int st_uid;int st_gid;abi_ulong st_rdev;
@@ -1779,8 +1779,8 @@ struct target_stat {unsigned st_dev;abi_long st_pad1[3 ];/* Reserved for network id */ abi_ulong st_ino; -unsigned int st_mode; -unsigned int st_nlink; +abi_uint st_mode; +abi_uint st_nlink;int st_uid;int st_gid;unsigned st_rdev;
@@ -1815,8 +1815,8 @@ struct target_stat64 {abi_ullong st_ino; -unsigned int st_mode; -unsigned int st_nlink; +abi_uint st_mode; +abi_uint st_nlink;int st_uid;int st_gid;
@@ -1848,21 +1848,21 @@ struct target_stat64 {#elif defined(TARGET_ALPHA )struct target_stat { -unsigned int st_dev; -unsigned int st_ino; -unsigned int st_mode; -unsigned int st_nlink; -unsigned int st_uid; -unsigned int st_gid; -unsigned int st_rdev; +abi_uint st_dev; +abi_uint st_ino; +abi_uint st_mode; +abi_uint st_nlink; +abi_uint st_uid; +abi_uint st_gid; +abi_uint st_rdev;abi_long st_size;abi_ulong target_st_atime;abi_ulong target_st_mtime;abi_ulong target_st_ctime; -unsigned int st_blksize; -unsigned int st_blocks; -unsigned int st_flags; -unsigned int st_gen; +abi_uint st_blksize; +abi_uint st_blocks; +abi_uint st_flags; +abi_uint st_gen; };#define TARGET_HAS_STRUCT_STAT64
@@ -1873,12 +1873,12 @@ struct target_stat64 {abi_long st_size;abi_ulong st_blocks; -unsigned int st_mode; -unsigned int st_uid; -unsigned int st_gid; -unsigned int st_blksize; -unsigned int st_nlink; -unsigned int __pad0; +abi_uint st_mode; +abi_uint st_uid; +abi_uint st_gid; +abi_uint st_blksize; +abi_uint st_nlink; +abi_uint __pad0;abi_ulong target_st_atime;abi_ulong target_st_atime_nsec;
@@ -1924,8 +1924,8 @@ struct QEMU_PACKED target_stat64 {#define TARGET_STAT64_HAS_BROKEN_ST_INO 1abi_ulong __st_ino; -unsigned int st_mode; -unsigned int st_nlink; +abi_uint st_mode; +abi_uint st_nlink;abi_ulong st_uid;abi_ulong st_gid;
@@ -1957,10 +1957,10 @@ struct target_stat {abi_ulong st_ino;abi_ulong st_nlink; -unsigned int st_mode; -unsigned int st_uid; -unsigned int st_gid; -unsigned int __pad0; +abi_uint st_mode; +abi_uint st_uid; +abi_uint st_gid; +abi_uint __pad0;abi_ulong st_rdev;abi_long st_size;abi_long st_blksize;
@@ -1980,10 +1980,10 @@ struct target_stat {abi_ulong st_dev;abi_ulong st_ino;abi_ulong st_nlink; -unsigned int st_mode; -unsigned int st_uid; -unsigned int st_gid; -unsigned int __pad1; +abi_uint st_mode; +abi_uint st_uid; +abi_uint st_gid; +abi_uint __pad1;abi_ulong st_rdev;abi_ulong st_size;abi_ulong target_st_atime;
@@ -2001,10 +2001,10 @@ struct target_stat {struct target_stat {abi_ulong st_dev;abi_ulong st_ino; -unsigned int st_mode; -unsigned int st_nlink; -unsigned int st_uid; -unsigned int st_gid; +abi_uint st_mode; +abi_uint st_nlink; +abi_uint st_uid; +abi_uint st_gid;abi_ulong st_rdev;abi_ulong _pad1;abi_long st_size;
@@ -2017,17 +2017,17 @@ struct target_stat { abi_ulong target_st_mtime_nsec; abi_long target_st_ctime; abi_ulong target_st_ctime_nsec; - unsigned int __unused[2]; + abi_uint __unused[2]; }; #elif defined(TARGET_XTENSA) #define TARGET_STAT_HAVE_NSEC struct target_stat { abi_ulong st_dev; abi_ulong st_ino; - unsigned int st_mode; - unsigned int st_nlink; - unsigned int st_uid; - unsigned int st_gid; + abi_uint st_mode; + abi_uint st_nlink; + abi_uint st_uid; + abi_uint st_gid; abi_ulong st_rdev; abi_long st_size; abi_ulong st_blksize;
@@ -2046,10 +2046,10 @@ struct target_stat {struct target_stat64 {abi_ullong st_dev;/* Device */ abi_ullong st_ino;/* File serial number */ -unsigned int st_mode;/* File mode. */ -unsigned int st_nlink;/* Link count. */ -unsigned int st_uid;/* User ID of the file's owner. */ -unsigned int st_gid;/* Group ID of the file's group. */ +abi_uint st_mode;/* File mode. */ +abi_uint st_nlink;/* Link count. */ +abi_uint st_uid;/* User ID of the file's owner. */ +abi_uint st_gid;/* Group ID of the file's group. */ abi_ullong st_rdev;/* Device number, if device. */ abi_llong st_size;/* Size of file, in bytes. */ abi_ulong st_blksize;/* Optimal block size for I/O. */
@@ -2074,10 +2074,10 @@ struct target_stat64 {struct target_stat {abi_ulong st_dev;abi_ulong st_ino; -unsigned int st_mode; -unsigned int st_nlink; -unsigned int st_uid; -unsigned int st_gid; +abi_uint st_mode; +abi_uint st_nlink; +abi_uint st_uid; +abi_uint st_gid;abi_ulong st_rdev;abi_ulong __pad1;abi_long st_size;
@@ -2090,8 +2090,8 @@ struct target_stat {abi_ulong target_st_mtime_nsec;abi_long target_st_ctime;abi_ulong target_st_ctime_nsec; -unsigned int __unused4; -unsigned int __unused5; +abi_uint __unused4; +abi_uint __unused5; };#if !defined(TARGET_RISCV64 )
@@ -2099,10 +2099,10 @@ struct target_stat {struct target_stat64 {abi_ullong st_dev;abi_ullong st_ino; -unsigned int st_mode; -unsigned int st_nlink; -unsigned int st_uid; -unsigned int st_gid; +abi_uint st_mode; +abi_uint st_nlink; +abi_uint st_uid; +abi_uint st_gid;abi_ullong st_rdev;abi_ullong __pad1;abi_llong st_size;
@@ -2110,13 +2110,13 @@ struct target_stat64 {int __pad2;abi_llong st_blocks;int target_st_atime; -unsigned int target_st_atime_nsec; +abi_uint target_st_atime_nsec;int target_st_mtime; -unsigned int target_st_mtime_nsec; +abi_uint target_st_mtime_nsec;int target_st_ctime; -unsigned int target_st_ctime_nsec; -unsigned int __unused4; - unsigned int __unused5; +abi_uint target_st_ctime_nsec; +abi_uint __unused4; + abi_uint __unused5; };#endif
@@ -2498,7 +2498,7 @@ struct target_snd_timer_id {struct target_snd_timer_ginfo {struct target_snd_timer_id tid; -unsigned int flags; +abi_uint flags;int card;unsigned char id[64 ];unsigned char name[80 ];
@@ -2506,7 +2506,7 @@ struct target_snd_timer_ginfo {abi_ulong resolution;abi_ulong resolution_min;abi_ulong resolution_max; -unsigned int clients; +abi_uint clients;unsigned char reserved[32 ]; };
@@ -2531,7 +2531,7 @@ struct target_snd_timer_select { };struct target_snd_timer_info { -unsigned int flags; +abi_uint flags;int card;unsigned char id[64 ];unsigned char name[80 ];
@@ -2542,10 +2542,10 @@ struct target_snd_timer_info {struct target_snd_timer_status {struct target_timespec tstamp; -unsigned int resolution; -unsigned int lost; -unsigned int overrun; -unsigned int queue; +abi_uint resolution; +abi_uint lost; +abi_uint overrun; +abi_uint queue;unsigned char reserved[64 ]; };
@@ -2623,7 +2623,7 @@ struct target_sysinfo {unsigned short pad;/* explicit padding for m68k */ abi_ulong totalhigh;/* Total high memory size */ abi_ulong freehigh;/* Available high memory size */ -unsigned int mem_unit;/* Memory unit size in bytes */ +abi_uint mem_unit;/* Memory unit size in bytes */ char _f[20 -2 *sizeof (abi_long)-sizeof (int )];/* Padding: libc5 uses this.. */ };
Signature · 1 line
2.34.1
PATCH 8/45 linux-user: Use abi_ullong not unsigned long long in syscall_defs.h
In reply to Richard Henderson--- linux-user/syscall_defs.h | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-)
linux-user/syscall_defs.h +16 -16
@@ -1385,13 +1385,13 @@ struct target_stat64 {abi_ulong target_st_ctime;abi_ulong target_st_ctime_nsec; -unsigned long long st_ino; +abi_ullong st_ino; }QEMU_PACKED ; #ifdef TARGET_ARM #define TARGET_HAS_STRUCT_STAT64 struct target_eabi_stat64 { - unsigned long long st_dev; + abi_ullong st_dev; abi_uint __pad1; abi_ulong __st_ino; abi_uint st_mode;
@@ -1400,13 +1400,13 @@ struct target_eabi_stat64 {abi_ulong st_uid;abi_ulong st_gid; -unsigned long long st_rdev; +abi_ullong st_rdev;abi_uint __pad2[2 ];long long st_size;abi_ulong st_blksize;abi_uint __pad3; -unsigned long long st_blocks; +abi_ullong st_blocks;abi_ulong target_st_atime;abi_ulong target_st_atime_nsec;
@@ -1417,7 +1417,7 @@ struct target_eabi_stat64 {abi_ulong target_st_ctime;abi_ulong target_st_ctime_nsec; - unsigned long long st_ino; + abi_ullong st_ino; }QEMU_PACKED ;#endif
@@ -1568,14 +1568,14 @@ struct target_stat {#if !defined(TARGET_PPC64 )#define TARGET_HAS_STRUCT_STAT64 struct QEMU_PACKED target_stat64 { -unsigned long long st_dev; -unsigned long long st_ino; +abi_ullong st_dev; +abi_ullong st_ino;abi_uint st_mode;abi_uint st_nlink;abi_uint st_uid;abi_uint st_gid; -unsigned long long st_rdev; -unsigned long long __pad0; +abi_ullong st_rdev; +abi_ullong __pad0;long long st_size;int st_blksize;abi_uint __pad1;
@@ -1674,7 +1674,7 @@ struct target_stat {*/ #define TARGET_HAS_STRUCT_STAT64 struct target_stat64 { -unsigned long long st_dev; +abi_ullong st_dev;unsigned char __pad1[2 ];#define TARGET_STAT64_HAS_BROKEN_ST_INO 1
@@ -1686,7 +1686,7 @@ struct target_stat64 {abi_ulong st_uid;abi_ulong st_gid; -unsigned long long st_rdev; +abi_ullong st_rdev;unsigned char __pad3[2 ];long long st_size;
@@ -1704,7 +1704,7 @@ struct target_stat64 {abi_ulong target_st_ctime;abi_ulong target_st_ctime_nsec; - unsigned long long st_ino; + abi_ullong st_ino; }QEMU_PACKED ;#elif defined(TARGET_ABI_MIPSN64)
@@ -1918,7 +1918,7 @@ struct target_stat {*/ #define TARGET_HAS_STRUCT_STAT64 struct QEMU_PACKED target_stat64 { -unsigned long long st_dev; +abi_ullong st_dev;unsigned char __pad0[4 ];#define TARGET_STAT64_HAS_BROKEN_ST_INO 1
@@ -1930,13 +1930,13 @@ struct QEMU_PACKED target_stat64 {abi_ulong st_uid;abi_ulong st_gid; -unsigned long long st_rdev; +abi_ullong st_rdev;unsigned char __pad3[4 ];long long st_size;abi_ulong st_blksize; -unsigned long long st_blocks;/* Number 512-byte blocks allocated. */ +abi_ullong st_blocks;/* Number 512-byte blocks allocated. */ abi_ulong target_st_atime;abi_ulong target_st_atime_nsec;
@@ -1947,7 +1947,7 @@ struct QEMU_PACKED target_stat64 {abi_ulong target_st_ctime;abi_ulong target_st_ctime_nsec; - unsigned long long st_ino; + abi_ullong st_ino; };#elif defined(TARGET_I386) && !defined(TARGET_ABI32)
Signature · 1 line
2.34.1
[PULL 09/37] crypto: Add aesenc_SB_SR_MC_AK
In reply to Richard HendersonAdd a primitive for SubBytes + ShiftRows + MixColumns + AddRoundKey.
--- host/include/generic/host/crypto/aes-round.h | 3 + include/crypto/aes-round.h | 21 +++++++ crypto/aes.c | 58 ++++++++++++++++++++ 3 files changed, 82 insertions(+)
host/include/generic/host/crypto/aes-round.h +3 -0
@@ -14,6 +14,9 @@ void aesenc_MC_accel(AESState *, const AESState *, bool) void aesenc_SB_SR_AK_accel(AESState *, const AESState *, const AESState *, bool) QEMU_ERROR("unsupported accel"); +void aesenc_SB_SR_MC_AK_accel(AESState *, const AESState *, + const AESState *, bool) + QEMU_ERROR("unsupported accel"); void aesdec_IMC_accel(AESState *, const AESState *, bool) QEMU_ERROR("unsupported accel");
include/crypto/aes-round.h +21 -0
@@ -59,6 +59,27 @@ static inline void aesenc_SB_SR_AK(AESState *r, const AESState *st, } } +/* +* Perform SubBytes + ShiftRows + MixColumns + AddRoundKey. +*/ + +void aesenc_SB_SR_MC_AK_gen (AESState *ret,const AESState *st, +const AESState *rk); +void aesenc_SB_SR_MC_AK_genrev (AESState *ret,const AESState *st, +const AESState *rk); + +static inline void aesenc_SB_SR_MC_AK (AESState *r,const AESState *st, +const AESState *rk,bool be) +{ +if (HAVE_AES_ACCEL ) { +aesenc_SB_SR_MC_AK_accel (r, st, rk, be); + }else if (HOST_BIG_ENDIAN == be) { +aesenc_SB_SR_MC_AK_gen (r, st, rk); + }else { +aesenc_SB_SR_MC_AK_genrev (r, st, rk); + } +} +/* * Perform InvMixColumns. */
crypto/aes.c +58 -0
64 lines not on this page · raw message
Signature · 1 line
2.34.1
PATCH 9/45 linux-user: Use abi_llong not long long in syscall_defs.h
In reply to Richard Henderson--- linux-user/syscall_defs.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
linux-user/syscall_defs.h +6 -6
@@ -1370,7 +1370,7 @@ struct target_stat64 {unsigned short st_rdev;unsigned char __pad3[10 ]; -long long st_size; +abi_llong st_size;abi_ulong st_blksize;abi_ulong st_blocks;/* Number 512-byte blocks allocated. */
@@ -1403,7 +1403,7 @@ struct target_eabi_stat64 {abi_ullong st_rdev;abi_uint __pad2[2 ]; -long long st_size; +abi_llong st_size;abi_ulong st_blksize;abi_uint __pad3;abi_ullong st_blocks;
@@ -1576,10 +1576,10 @@ struct QEMU_PACKED target_stat64 {abi_uint st_gid;abi_ullong st_rdev;abi_ullong __pad0; -long long st_size; +abi_llong st_size;int st_blksize;abi_uint __pad1; -long long st_blocks;/* Number 512-byte blocks allocated. */ +abi_llong st_blocks;/* Number 512-byte blocks allocated. */ int target_st_atime;abi_uint target_st_atime_nsec;int target_st_mtime;
@@ -1689,7 +1689,7 @@ struct target_stat64 {abi_ullong st_rdev;unsigned char __pad3[2 ]; -long long st_size; +abi_llong st_size;abi_ulong st_blksize;abi_ulong __pad4;/* future possible st_blocks high bits */
@@ -1933,7 +1933,7 @@ struct QEMU_PACKED target_stat64 {abi_ullong st_rdev;unsigned char __pad3[4 ]; -long long st_size; +abi_llong st_size;abi_ulong st_blksize;abi_ullong st_blocks;/* Number 512-byte blocks allocated. */
Signature · 1 line
2.34.1
[PULL 13/37] host/include/aarch64: Implement aes-round.h
In reply to Richard HendersonDetect AES in cpuinfo; implement the accel hooks.
--- meson.build | 9 + host/include/aarch64/host/cpuinfo.h | 1 + host/include/aarch64/host/crypto/aes-round.h | 205 +++++++++++++++++++ util/cpuinfo-aarch64.c | 2 + 4 files changed, 217 insertions(+) create mode 100644 host/include/aarch64/host/crypto/aes-round.h
meson.build +9 -0
@@ -2665,6 +2665,15 @@ config_host_data.set('CONFIG_AVX512BW_OPT', get_option('avx512bw') \ int main(int argc, char *argv[]) { return bar(argv[0]); } '''), error_message: 'AVX512BW not available').allowed()) +# For both AArch64 and AArch32, detect if builtins are available. +config_host_data.set('CONFIG_ARM_AES_BUILTIN', cc.compiles(''' + #include <arm_neon.h> + #ifndef __ARM_FEATURE_AES + __attribute__((target("+crypto"))) + #endif + void foo(uint8x16_t *p) { *p = vaesmcq_u8(*p); } + ''')) + have_pvrdma = get_option('pvrdma') \ .require(rdma.found(), error_message: 'PVRDMA requires OpenFabrics libraries') \ .require(cc.compiles(gnu_source_prefix + '''
host/include/aarch64/host/cpuinfo.h +1 -0
@@ -9,6 +9,7 @@#define CPUINFO_ALWAYS (1u << 0)/* so cpuinfo is nonzero */ #define CPUINFO_LSE (1u << 1)#define CPUINFO_LSE2 (1u << 2) +#define CPUINFO_AES (1u << 3)/* Initialized with a constructor. */ extern unsigned cpuinfo;
host/include/aarch64/host/crypto/aes-round.h new file +205 -0
205 lines not on this page · raw message
util/cpuinfo-aarch64.c +2 -0
@@ -56,10 +56,12 @@ unsigned __attribute__((constructor)) cpuinfo_init(void)unsigned long hwcap =qemu_getauxval (AT_HWCAP ); info |= (hwcap &HWCAP_ATOMICS ?CPUINFO_LSE :0 ); info |= (hwcap &HWCAP_USCAT ?CPUINFO_LSE2 :0 ); + info |= (hwcap &HWCAP_AES ?CPUINFO_AES :0 );#endif #ifdef CONFIG_DARWIN info |=sysctl_for_bool ("hw.optional.arm.FEAT_LSE" ) *CPUINFO_LSE ; info |=sysctl_for_bool ("hw.optional.arm.FEAT_LSE2" ) *CPUINFO_LSE2 ; + info |=sysctl_for_bool ("hw.optional.arm.FEAT_AES" ) *CPUINFO_AES ;#endif cpuinfo = info;
Signature · 1 line
2.34.1
PATCH 10/45 linux-user: Use abi_int not int in syscall_defs.h
In reply to Richard Henderson--- linux-user/syscall_defs.h | 216 +++++++++++++++++++------------------- 1 file changed, 108 insertions(+), 108 deletions(-)
linux-user/syscall_defs.h +108 -108
@@ -361,7 +361,7 @@ struct target_iovec {struct target_msghdr {abi_long msg_name;/* Socket name */ -int msg_namelen;/* Length of name */ +abi_int msg_namelen;/* Length of name */ abi_long msg_iov;/* Data blocks */ abi_long msg_iovlen;/* Number of blocks */ abi_long msg_control;/* Per protocol magic (eg BSD file descriptor passing) */
@@ -371,8 +371,8 @@ struct target_msghdr {struct target_cmsghdr {abi_long cmsg_len; -int cmsg_level; -int cmsg_type; +abi_int cmsg_level; +abi_int cmsg_type; };#define TARGET_CMSG_DATA (cmsg) ((unsigned char *) ((struct target_cmsghdr *) (cmsg) + 1))
@@ -426,7 +426,7 @@ struct target_rusage { };typedef struct { -int val[2 ]; +abi_int val[2 ]; }kernel_fsid_t ;struct target_dirent {
@@ -544,7 +544,7 @@ struct target_sigaction {#endif typedef union target_sigval { -int sival_int; +abi_int sival_int;abi_ulong sival_ptr; }target_sigval_t ;
@@ -575,17 +575,17 @@ typedef union target_sigval { typedef struct target_siginfo { #ifdef TARGET_MIPS - int si_signo; - int si_code; - int si_errno; + abi_int si_signo; + abi_int si_code; + abi_int si_errno; #else - int si_signo; - int si_errno; - int si_code; + abi_int si_signo; + abi_int si_errno; + abi_int si_code; #endif union { - int _pad[TARGET_SI_PAD_SIZE]; + abi_int _pad[TARGET_SI_PAD_SIZE]; /* kill() */ struct {
@@ -610,7 +610,7 @@ typedef struct target_siginfo {struct {pid_t _pid;/* which child */ uid_t _uid;/* sender's uid */ -int _status;/* exit code */ +abi_int _status;/* exit code */ target_clock_t _utime;target_clock_t _stime; } _sigchld;
@@ -622,8 +622,8 @@ typedef struct target_siginfo {/* SIGPOLL */ struct { -int _band;/* POLL_IN, POLL_OUT, POLL_MSG */ -int _fd; +abi_int _band;/* POLL_IN, POLL_OUT, POLL_MSG */ +abi_int _fd; } _sigpoll; } _sifields; } target_siginfo_t;
@@ -701,7 +701,7 @@ typedef struct target_siginfo {#include "target_resource.h" struct target_pollfd { -int fd;/* file descriptor */ +abi_int fd;/* file descriptor */ short events;/* requested events */ short revents;/* returned events */ };
@@ -722,12 +722,12 @@ struct target_pollfd {#define TARGET_KDSIGACCEPT 0x4B4Estruct target_rtc_pll_info { -int pll_ctrl; -int pll_value; -int pll_max; -int pll_min; -int pll_posmult; -int pll_negmult; +abi_int pll_ctrl; +abi_int pll_value; +abi_int pll_max; +abi_int pll_min; +abi_int pll_posmult; +abi_int pll_negmult;abi_long pll_clock; };
@@ -754,14 +754,14 @@ struct target_rtc_pll_info { struct target_rtc_pll_info)#define TARGET_RTC_PLL_SET TARGET_IOW('p', 0x12, \ struct target_rtc_pll_info) -#define TARGET_RTC_VL_READ TARGET_IOR('p', 0x13, int) +#define TARGET_RTC_VL_READ TARGET_IOR('p', 0x13, abi_int)#define TARGET_RTC_VL_CLR TARGET_IO('p', 0x14)#if defined(TARGET_ALPHA ) || defined(TARGET_MIPS ) || defined(TARGET_SH4 ) || \ defined(TARGET_XTENSA ) -#define TARGET_FIOGETOWN TARGET_IOR('f', 123, int) -#define TARGET_FIOSETOWN TARGET_IOW('f', 124, int) -#define TARGET_SIOCATMARK TARGET_IOR('s', 7, int) +#define TARGET_FIOGETOWN TARGET_IOR('f', 123, abi_int) +#define TARGET_FIOSETOWN TARGET_IOW('f', 124, abi_int) +#define TARGET_SIOCATMARK TARGET_IOR('s', 7, abi_int)#define TARGET_SIOCSPGRP TARGET_IOW('s', 8, pid_t)#define TARGET_SIOCGPGRP TARGET_IOR('s', 9, pid_t)#else
@@ -851,40 +851,40 @@ struct target_rtc_pll_info {/* From <linux/if_tun.h> */ -#define TARGET_TUNSETDEBUG TARGET_IOW('T', 201, int) -#define TARGET_TUNSETIFF TARGET_IOW('T', 202, int) -#define TARGET_TUNSETPERSIST TARGET_IOW('T', 203, int) -#define TARGET_TUNSETOWNER TARGET_IOW('T', 204, int) -#define TARGET_TUNSETLINK TARGET_IOW('T', 205, int) -#define TARGET_TUNSETGROUP TARGET_IOW('T', 206, int) +#define TARGET_TUNSETDEBUG TARGET_IOW('T', 201, abi_int) +#define TARGET_TUNSETIFF TARGET_IOW('T', 202, abi_int) +#define TARGET_TUNSETPERSIST TARGET_IOW('T', 203, abi_int) +#define TARGET_TUNSETOWNER TARGET_IOW('T', 204, abi_int) +#define TARGET_TUNSETLINK TARGET_IOW('T', 205, abi_int) +#define TARGET_TUNSETGROUP TARGET_IOW('T', 206, abi_int)#define TARGET_TUNGETFEATURES TARGET_IOR('T', 207, abi_uint)#define TARGET_TUNSETOFFLOAD TARGET_IOW('T', 208, abi_uint)#define TARGET_TUNSETTXFILTER TARGET_IOW('T', 209, abi_uint)#define TARGET_TUNGETIFF TARGET_IOR('T', 210, abi_uint) -#define TARGET_TUNGETSNDBUF TARGET_IOR('T', 211, int) -#define TARGET_TUNSETSNDBUF TARGET_IOW('T', 212, int) +#define TARGET_TUNGETSNDBUF TARGET_IOR('T', 211, abi_int) +#define TARGET_TUNSETSNDBUF TARGET_IOW('T', 212, abi_int)/* * TUNATTACHFILTER and TUNDETACHFILTER are not supported. Linux kernel keeps a * user pointer in TUNATTACHFILTER, which we are not able to correctly handle. */ -#define TARGET_TUNGETVNETHDRSZ TARGET_IOR('T', 215, int) -#define TARGET_TUNSETVNETHDRSZ TARGET_IOW('T', 216, int) -#define TARGET_TUNSETQUEUE TARGET_IOW('T', 217, int) +#define TARGET_TUNGETVNETHDRSZ TARGET_IOR('T', 215, abi_int) +#define TARGET_TUNSETVNETHDRSZ TARGET_IOW('T', 216, abi_int) +#define TARGET_TUNSETQUEUE TARGET_IOW('T', 217, abi_int)#define TARGET_TUNSETIFINDEX TARGET_IOW('T', 218, abi_uint)/* TUNGETFILTER is not supported: see TUNATTACHFILTER. */ -#define TARGET_TUNSETVNETLE TARGET_IOW('T', 220, int) -#define TARGET_TUNGETVNETLE TARGET_IOR('T', 221, int) -#define TARGET_TUNSETVNETBE TARGET_IOW('T', 222, int) -#define TARGET_TUNGETVNETBE TARGET_IOR('T', 223, int) -#define TARGET_TUNSETSTEERINGEBPF TARGET_IOR('T', 224, int) -#define TARGET_TUNSETFILTEREBPF TARGET_IOR('T', 225, int) -#define TARGET_TUNSETCARRIER TARGET_IOW('T', 226, int) +#define TARGET_TUNSETVNETLE TARGET_IOW('T', 220, abi_int) +#define TARGET_TUNGETVNETLE TARGET_IOR('T', 221, abi_int) +#define TARGET_TUNSETVNETBE TARGET_IOW('T', 222, abi_int) +#define TARGET_TUNGETVNETBE TARGET_IOR('T', 223, abi_int) +#define TARGET_TUNSETSTEERINGEBPF TARGET_IOR('T', 224, abi_int) +#define TARGET_TUNSETFILTEREBPF TARGET_IOR('T', 225, abi_int) +#define TARGET_TUNSETCARRIER TARGET_IOW('T', 226, abi_int)#define TARGET_TUNGETDEVNETNS TARGET_IO('T', 227)/* From <linux/random.h> */ -#define TARGET_RNDGETENTCNT TARGET_IOR('R', 0x00, int) -#define TARGET_RNDADDTOENTCNT TARGET_IOW('R', 0x01, int) +#define TARGET_RNDGETENTCNT TARGET_IOR('R', 0x00, abi_int) +#define TARGET_RNDADDTOENTCNT TARGET_IOW('R', 0x01, abi_int)#define TARGET_RNDZAPENTCNT TARGET_IO('R', 0x04)#define TARGET_RNDCLEARPOOL TARGET_IO('R', 0x06)#define TARGET_RNDRESEEDCRNG TARGET_IO('R', 0x07)
@@ -940,7 +940,7 @@ struct target_rtc_pll_info {#define TARGET_FIBMAP TARGET_IO(0x00,1)/* bmap access */ #define TARGET_FIGETBSZ TARGET_IO(0x00,2)/* get the block size used for bmap */ -#define TARGET_FICLONE TARGET_IOW(0x94, 9, int) +#define TARGET_FICLONE TARGET_IOW(0x94, 9, abi_int)#define TARGET_FICLONERANGE TARGET_IOW(0x94, 13, struct file_clone_range)/*
@@ -952,10 +952,10 @@ struct target_rtc_pll_info {#define TARGET_FS_IOC_GETVERSION TARGET_IOR('v', 1, abi_long)#define TARGET_FS_IOC_SETVERSION TARGET_IOW('v', 2, abi_long)#define TARGET_FS_IOC_FIEMAP TARGET_IOWR('f',11,struct fiemap) -#define TARGET_FS_IOC32_GETFLAGS TARGET_IOR('f', 1, int) -#define TARGET_FS_IOC32_SETFLAGS TARGET_IOW('f', 2, int) -#define TARGET_FS_IOC32_GETVERSION TARGET_IOR('v', 1, int) -#define TARGET_FS_IOC32_SETVERSION TARGET_IOW('v', 2, int) +#define TARGET_FS_IOC32_GETFLAGS TARGET_IOR('f', 1, abi_int) +#define TARGET_FS_IOC32_SETFLAGS TARGET_IOW('f', 2, abi_int) +#define TARGET_FS_IOC32_GETVERSION TARGET_IOR('v', 1, abi_int) +#define TARGET_FS_IOC32_SETVERSION TARGET_IOW('v', 2, abi_int)/* btrfs ioctls */ #ifdef HAVE_BTRFS_H
@@ -1577,14 +1577,14 @@ struct QEMU_PACKED target_stat64 {abi_ullong st_rdev;abi_ullong __pad0;abi_llong st_size; -int st_blksize; +abi_int st_blksize;abi_uint __pad1;abi_llong st_blocks;/* Number 512-byte blocks allocated. */ -int target_st_atime; +abi_int target_st_atime;abi_uint target_st_atime_nsec; -int target_st_mtime; +abi_int target_st_mtime;abi_uint target_st_mtime_nsec; -int target_st_ctime; +abi_int target_st_ctime;abi_uint target_st_ctime_nsec;abi_uint __unused4;abi_uint __unused5;
@@ -1635,11 +1635,11 @@ struct QEMU_PACKED target_stat64 {abi_uint __pad2;abi_llong st_blocks; -int target_st_atime; +abi_int target_st_atime;abi_uint target_st_atime_nsec; -int target_st_mtime; +abi_int target_st_mtime;abi_uint target_st_mtime_nsec; -int target_st_ctime; +abi_int target_st_ctime;abi_uint target_st_ctime_nsec;abi_ullong st_ino; };
@@ -1720,8 +1720,8 @@ struct target_stat {abi_uint st_mode;abi_uint st_nlink; -int st_uid; -int st_gid; +abi_int st_uid; +abi_int st_gid;abi_uint st_rdev;abi_uint st_pad1[3 ];/* Reserved for st_rdev expansion */
@@ -1756,8 +1756,8 @@ struct target_stat {abi_ullong st_ino;abi_uint st_mode;abi_uint st_nlink; -int st_uid; -int st_gid; +abi_int st_uid; +abi_int st_gid;abi_ulong st_rdev;abi_ulong st_pad1[3 ];/* Reserved for st_rdev expansion */ abi_llong st_size;
@@ -1781,8 +1781,8 @@ struct target_stat {abi_ulong st_ino;abi_uint st_mode;abi_uint st_nlink; -int st_uid; -int st_gid; +abi_int st_uid; +abi_int st_gid;unsigned st_rdev;abi_long st_pad2[2 ];abi_long st_size;
@@ -1818,8 +1818,8 @@ struct target_stat64 {abi_uint st_mode;abi_uint st_nlink; -int st_uid; -int st_gid; +abi_int st_uid; +abi_int st_gid;abi_ulong st_rdev;abi_ulong st_pad1[3 ];/* Reserved for st_rdev expansion */
@@ -2008,8 +2008,8 @@ struct target_stat {abi_ulong st_rdev;abi_ulong _pad1;abi_long st_size; -int st_blksize; -int __pad2; +abi_int st_blksize; +abi_int __pad2;abi_long st_blocks;abi_long target_st_atime;abi_ulong target_st_atime_nsec;
@@ -2081,8 +2081,8 @@ struct target_stat {abi_ulong st_rdev;abi_ulong __pad1;abi_long st_size; -int st_blksize; -int __pad2; +abi_int st_blksize; +abi_int __pad2;abi_long st_blocks;abi_long target_st_atime;abi_ulong target_st_atime_nsec;
@@ -2106,14 +2106,14 @@ struct target_stat64 {abi_ullong st_rdev;abi_ullong __pad1;abi_llong st_size; -int st_blksize; -int __pad2; +abi_int st_blksize; +abi_int __pad2;abi_llong st_blocks; -int target_st_atime; +abi_int target_st_atime;abi_uint target_st_atime_nsec; -int target_st_mtime; +abi_int target_st_mtime;abi_uint target_st_mtime_nsec; -int target_st_ctime; +abi_int target_st_ctime;abi_uint target_st_ctime_nsec;abi_uint __unused4;abi_uint __unused5;
@@ -2186,7 +2186,7 @@ struct target_stat64 {#endif typedef struct { -int val[2 ]; +abi_int val[2 ]; }target_fsid_t ;#ifdef TARGET_MIPS
@@ -2351,7 +2351,7 @@ struct target_statfs64 {/* soundcard defines */ /* XXX: convert them all to arch independent entries */ -#define TARGET_SNDCTL_COPR_HALT TARGET_IOWR('C', 7, int); +#define TARGET_SNDCTL_COPR_HALT TARGET_IOWR('C', 7, abi_int);#define TARGET_SNDCTL_COPR_LOAD 0xcfb04301#define TARGET_SNDCTL_COPR_RCODE 0xc0144303#define TARGET_SNDCTL_COPR_RCVMSG 0x8fa44309
@@ -2363,20 +2363,20 @@ struct target_statfs64 {#define TARGET_SNDCTL_COPR_WDATA 0x40144304#define TARGET_SNDCTL_DSP_RESET TARGET_IO('P', 0)#define TARGET_SNDCTL_DSP_SYNC TARGET_IO('P', 1) -#define TARGET_SNDCTL_DSP_SPEED TARGET_IOWR('P', 2, int) -#define TARGET_SNDCTL_DSP_STEREO TARGET_IOWR('P', 3, int) -#define TARGET_SNDCTL_DSP_GETBLKSIZE TARGET_IOWR('P', 4, int) -#define TARGET_SNDCTL_DSP_SETFMT TARGET_IOWR('P', 5, int) -#define TARGET_SNDCTL_DSP_CHANNELS TARGET_IOWR('P', 6, int) -#define TARGET_SOUND_PCM_WRITE_FILTER TARGET_IOWR('P', 7, int) +#define TARGET_SNDCTL_DSP_SPEED TARGET_IOWR('P', 2, abi_int) +#define TARGET_SNDCTL_DSP_STEREO TARGET_IOWR('P', 3, abi_int) +#define TARGET_SNDCTL_DSP_GETBLKSIZE TARGET_IOWR('P', 4, abi_int) +#define TARGET_SNDCTL_DSP_SETFMT TARGET_IOWR('P', 5, abi_int) +#define TARGET_SNDCTL_DSP_CHANNELS TARGET_IOWR('P', 6, abi_int) +#define TARGET_SOUND_PCM_WRITE_FILTER TARGET_IOWR('P', 7, abi_int)#define TARGET_SNDCTL_DSP_POST TARGET_IO('P', 8) -#define TARGET_SNDCTL_DSP_SUBDIVIDE TARGET_IOWR('P', 9, int) -#define TARGET_SNDCTL_DSP_SETFRAGMENT TARGET_IOWR('P',10, int) -#define TARGET_SNDCTL_DSP_GETFMTS TARGET_IOR('P', 11, int) +#define TARGET_SNDCTL_DSP_SUBDIVIDE TARGET_IOWR('P', 9, abi_int) +#define TARGET_SNDCTL_DSP_SETFRAGMENT TARGET_IOWR('P',10, abi_int) +#define TARGET_SNDCTL_DSP_GETFMTS TARGET_IOR('P', 11, abi_int)#define TARGET_SNDCTL_DSP_GETOSPACE TARGET_IORU('P',12)#define TARGET_SNDCTL_DSP_GETISPACE TARGET_IORU('P',13) -#define TARGET_SNDCTL_DSP_GETCAPS TARGET_IOR('P', 15, int) -#define TARGET_SNDCTL_DSP_GETTRIGGER TARGET_IOR('P',16, int) +#define TARGET_SNDCTL_DSP_GETCAPS TARGET_IOR('P', 15, abi_int) +#define TARGET_SNDCTL_DSP_GETTRIGGER TARGET_IOR('P',16, abi_int)#define TARGET_SNDCTL_DSP_GETIPTR TARGET_IORU('P',17)#define TARGET_SNDCTL_DSP_GETOPTR TARGET_IORU('P',18)#define TARGET_SNDCTL_DSP_MAPINBUF TARGET_IORU('P', 19)
@@ -2424,13 +2424,13 @@ struct target_statfs64 {#define TARGET_SOUND_PCM_READ_FILTER 0x80045007#define TARGET_SOUND_MIXER_INFO TARGET_IOR ('M', 101, mixer_info)#define TARGET_SOUND_MIXER_ACCESS 0xc0804d66 -#define TARGET_SOUND_MIXER_PRIVATE1 TARGET_IOWR('M', 111, int) -#define TARGET_SOUND_MIXER_PRIVATE2 TARGET_IOWR('M', 112, int) -#define TARGET_SOUND_MIXER_PRIVATE3 TARGET_IOWR('M', 113, int) -#define TARGET_SOUND_MIXER_PRIVATE4 TARGET_IOWR('M', 114, int) -#define TARGET_SOUND_MIXER_PRIVATE5 TARGET_IOWR('M', 115, int) +#define TARGET_SOUND_MIXER_PRIVATE1 TARGET_IOWR('M', 111, abi_int) +#define TARGET_SOUND_MIXER_PRIVATE2 TARGET_IOWR('M', 112, abi_int) +#define TARGET_SOUND_MIXER_PRIVATE3 TARGET_IOWR('M', 113, abi_int) +#define TARGET_SOUND_MIXER_PRIVATE4 TARGET_IOWR('M', 114, abi_int) +#define TARGET_SOUND_MIXER_PRIVATE5 TARGET_IOWR('M', 115, abi_int) -#define TARGET_MIXER_READ (dev) TARGET_IOR('M', dev, int) +#define TARGET_MIXER_READ (dev) TARGET_IOR('M', dev, abi_int)#define TARGET_SOUND_MIXER_READ_VOLUME TARGET_MIXER_READ(SOUND_MIXER_VOLUME)#define TARGET_SOUND_MIXER_READ_BASS TARGET_MIXER_READ(SOUND_MIXER_BASS)
@@ -2461,7 +2461,7 @@ struct target_statfs64 {#define TARGET_SOUND_MIXER_READ_STEREODEVS TARGET_MIXER_READ(SOUND_MIXER_STEREODEVS)#define TARGET_SOUND_MIXER_READ_CAPS TARGET_MIXER_READ(SOUND_MIXER_CAPS) -#define TARGET_MIXER_WRITE (dev) TARGET_IOWR('M', dev, int) +#define TARGET_MIXER_WRITE (dev) TARGET_IOWR('M', dev, abi_int)#define TARGET_SOUND_MIXER_WRITE_VOLUME TARGET_MIXER_WRITE(SOUND_MIXER_VOLUME)#define TARGET_SOUND_MIXER_WRITE_BASS TARGET_MIXER_WRITE(SOUND_MIXER_BASS)
@@ -2489,17 +2489,17 @@ struct target_statfs64 {#define TARGET_SOUND_MIXER_WRITE_RECSRC TARGET_MIXER_WRITE(SOUND_MIXER_RECSRC)struct target_snd_timer_id { -int dev_class; -int dev_sclass; -int card; -int device; -int subdevice; +abi_int dev_class; +abi_int dev_sclass; +abi_int card; +abi_int device; +abi_int subdevice; };struct target_snd_timer_ginfo {struct target_snd_timer_id tid;abi_uint flags; -int card; +abi_int card;unsigned char id[64 ];unsigned char name[80 ];abi_ulong reserved0;
@@ -2532,7 +2532,7 @@ struct target_snd_timer_select {struct target_snd_timer_info {abi_uint flags; -int card; +abi_int card;unsigned char id[64 ];unsigned char name[80 ];abi_ulong reserved0;
@@ -2550,7 +2550,7 @@ struct target_snd_timer_status { };/* alsa timer ioctls */ -#define TARGET_SNDRV_TIMER_IOCTL_PVERSION TARGET_IOR('T', 0x00, int) +#define TARGET_SNDRV_TIMER_IOCTL_PVERSION TARGET_IOR('T', 0x00, abi_int)#define TARGET_SNDRV_TIMER_IOCTL_NEXT_DEVICE TARGET_IOWR('T', 0x01, \ struct snd_timer_id)#define TARGET_SNDRV_TIMER_IOCTL_GINFO TARGET_IOWR('T', 0x03, \
@@ -2650,9 +2650,9 @@ struct target_mq_attr { };struct target_drm_version { -int version_major; -int version_minor; -int version_patchlevel; +abi_int version_major; +abi_int version_minor; +abi_int version_patchlevel;abi_ulong name_len;abi_ulong name;abi_ulong date_len;
@@ -2662,7 +2662,7 @@ struct target_drm_version { };struct target_drm_i915_getparam { -int param; +abi_int param;abi_ulong value; };
@@ -2755,7 +2755,7 @@ struct target_sigevent {struct target_user_cap_header {abi_uint version; -int pid; +abi_int pid; };struct target_user_cap_data {
Signature · 1 line
2.34.1
Re: [PATCH 10/45] linux-user: Use abi_int not int in syscall_defs.h
Quoted 4 lines · Richard Henderson
Signed-off-by Richard Henderson <[email protected]>--- linux-user/syscall_defs.h | 216 +++++++++++++++++++------------------- 1 file changed, 108 insertions(+), 108 deletions(-)
[PULL 03/37] target/arm: Move aesmc and aesimc tables to crypto/aes.c
In reply to Richard HendersonWe do not currently have a table in crypto/ for just MixColumns. Move both tables for consistency.
--- include/crypto/aes.h | 6 ++ crypto/aes.c | 140 ++++++++++++++++++++++++++++++++ target/arm/tcg/crypto_helper.c | 143 ++------------------------------- 3 files changed, 151 insertions(+), 138 deletions(-)
include/crypto/aes.h +6 -0
@@ -34,6 +34,12 @@ extern const uint8_t AES_isbox[256];extern const uint8_t AES_shifts[16 ];extern const uint8_t AES_ishifts[16 ]; +/* AES MixColumns, for use with rot32. */ +extern const uint32_t AES_mc_rot[256 ]; + +/* AES InvMixColumns, for use with rot32. */ +extern const uint32_t AES_imc_rot[256 ]; +/* AES InvMixColumns */ /* AES_imc[x][0] = [x].[0e, 09, 0d, 0b]; */ /* AES_imc[x][1] = [x].[0b, 0e, 09, 0d]; */
crypto/aes.c +140 -0
146 lines not on this page · raw message
target/arm/tcg/crypto_helper.c +5 -138
154 lines not on this page · raw message
Signature · 1 line
2.34.1
[PULL 11/37] crypto: Add aesdec_ISB_ISR_AK_IMC
In reply to Richard HendersonAdd a primitive for InvSubBytes + InvShiftRows +
AddRoundKey + InvMixColumns.
--- host/include/generic/host/crypto/aes-round.h | 3 +++ include/crypto/aes-round.h | 21 ++++++++++++++++++++ crypto/aes.c | 14 +++++++++++++ 3 files changed, 38 insertions(+)
host/include/generic/host/crypto/aes-round.h +3 -0
@@ -23,6 +23,9 @@ void aesdec_IMC_accel(AESState *, const AESState *, bool) void aesdec_ISB_ISR_AK_accel(AESState *, const AESState *, const AESState *, bool) QEMU_ERROR("unsupported accel"); +void aesdec_ISB_ISR_AK_IMC_accel(AESState *, const AESState *, + const AESState *, bool) + QEMU_ERROR("unsupported accel"); void aesdec_ISB_ISR_IMC_AK_accel(AESState *, const AESState *, const AESState *, bool) QEMU_ERROR("unsupported accel");
include/crypto/aes-round.h +21 -0
@@ -119,6 +119,27 @@ static inline void aesdec_ISB_ISR_AK(AESState *r, const AESState *st, } } +/* +* Perform InvSubBytes + InvShiftRows + AddRoundKey + InvMixColumns. +*/ + +void aesdec_ISB_ISR_AK_IMC_gen (AESState *ret,const AESState *st, +const AESState *rk); +void aesdec_ISB_ISR_AK_IMC_genrev (AESState *ret,const AESState *st, +const AESState *rk); + +static inline void aesdec_ISB_ISR_AK_IMC (AESState *r,const AESState *st, +const AESState *rk,bool be) +{ +if (HAVE_AES_ACCEL ) { +aesdec_ISB_ISR_AK_IMC_accel (r, st, rk, be); + }else if (HOST_BIG_ENDIAN == be) { +aesdec_ISB_ISR_AK_IMC_gen (r, st, rk); + }else { +aesdec_ISB_ISR_AK_IMC_genrev (r, st, rk); + } +} +/* * Perform InvSubBytes + InvShiftRows + InvMixColumns + AddRoundKey. */
crypto/aes.c +14 -0
@@ -1542,6 +1542,20 @@ void aesdec_ISB_ISR_IMC_AK_genrev(AESState *r, const AESState *st,aesdec_ISB_ISR_IMC_AK_swap (r, st, rk, true); } +void aesdec_ISB_ISR_AK_IMC_gen (AESState *ret,const AESState *st, +const AESState *rk) +{ +aesdec_ISB_ISR_AK_gen (ret, st, rk); +aesdec_IMC_gen (ret, ret); +} + +void aesdec_ISB_ISR_AK_IMC_genrev (AESState *ret,const AESState *st, +const AESState *rk) +{ +aesdec_ISB_ISR_AK_genrev (ret, st, rk); +aesdec_IMC_genrev (ret, ret); +} +/** * Expand the cipher key into the encryption key schedule. */
Signature · 1 line
2.34.1
PATCH 11/45 linux-user: Use abi_ushort not unsigned short in syscall_defs.h
In reply to Richard Henderson--- linux-user/syscall_defs.h | 90 +++++++++++++++++++-------------------- 1 file changed, 45 insertions(+), 45 deletions(-)
linux-user/syscall_defs.h +45 -45
@@ -432,7 +432,7 @@ typedef struct {struct target_dirent {abi_long d_ino;abi_long d_off; -unsigned short d_reclen; +abi_ushort d_reclen;char d_name[]; };
@@ -1210,19 +1210,19 @@ struct target_rtc_pll_info {#define TARGET_NCC 8struct target_termio { -unsigned short c_iflag;/* input mode flags */ -unsigned short c_oflag;/* output mode flags */ -unsigned short c_cflag;/* control mode flags */ -unsigned short c_lflag;/* local mode flags */ +abi_ushort c_iflag;/* input mode flags */ +abi_ushort c_oflag;/* output mode flags */ +abi_ushort c_cflag;/* control mode flags */ +abi_ushort c_lflag;/* local mode flags */ unsigned char c_line;/* line discipline */ unsigned char c_cc[TARGET_NCC ];/* control characters */ };struct target_winsize { -unsigned short ws_row; -unsigned short ws_col; -unsigned short ws_xpixel; -unsigned short ws_ypixel; +abi_ushort ws_row; +abi_ushort ws_col; +abi_ushort ws_xpixel; +abi_ushort ws_ypixel; };#include "termbits.h"
@@ -1328,15 +1328,15 @@ struct target_winsize { || defined(TARGET_CRIS)#define TARGET_STAT_HAVE_NSEC struct target_stat { -unsigned short st_dev; -unsigned short __pad1; +abi_ushort st_dev; +abi_ushort __pad1;abi_ulong st_ino; -unsigned short st_mode; -unsigned short st_nlink; -unsigned short st_uid; -unsigned short st_gid; -unsigned short st_rdev; -unsigned short __pad2; +abi_ushort st_mode; +abi_ushort st_nlink; +abi_ushort st_uid; +abi_ushort st_gid; +abi_ushort st_rdev; +abi_ushort __pad2;abi_ulong st_size;abi_ulong st_blksize;abi_ulong st_blocks;
@@ -1355,7 +1355,7 @@ struct target_stat {*/ #define TARGET_HAS_STRUCT_STAT64 struct target_stat64 { -unsigned short st_dev; +abi_ushort st_dev;unsigned char __pad0[10 ];#define TARGET_STAT64_HAS_BROKEN_ST_INO 1
@@ -1367,7 +1367,7 @@ struct target_stat64 {abi_ulong st_uid;abi_ulong st_gid; -unsigned short st_rdev; +abi_ushort st_rdev;unsigned char __pad3[10 ];abi_llong st_size;
@@ -1442,7 +1442,7 @@ struct target_stat {#define TARGET_HAS_STRUCT_STAT64 struct target_stat64 {unsigned char __pad0[6 ]; -unsigned short st_dev; +abi_ushort st_dev;abi_ullong st_ino;abi_ullong st_nlink;
@@ -1453,7 +1453,7 @@ struct target_stat64 {abi_uint st_gid;unsigned char __pad2[6 ]; -unsigned short st_rdev; +abi_ushort st_rdev;abi_llong st_size;abi_llong st_blksize;
@@ -1477,13 +1477,13 @@ struct target_stat64 {#define TARGET_STAT_HAVE_NSEC struct target_stat { -unsigned short st_dev; +abi_ushort st_dev;abi_ulong st_ino; -unsigned short st_mode; +abi_ushort st_mode;short st_nlink; -unsigned short st_uid; -unsigned short st_gid; -unsigned short st_rdev; +abi_ushort st_uid; +abi_ushort st_gid; +abi_ushort st_rdev;abi_long st_size;abi_long target_st_atime;abi_ulong target_st_atime_nsec;
@@ -1499,7 +1499,7 @@ struct target_stat {#define TARGET_HAS_STRUCT_STAT64 struct target_stat64 {unsigned char __pad0[6 ]; -unsigned short st_dev; +abi_ushort st_dev;abi_ullong st_ino;
@@ -1510,7 +1510,7 @@ struct target_stat64 {abi_uint st_gid;unsigned char __pad2[6 ]; -unsigned short st_rdev; +abi_ushort st_rdev;unsigned char __pad3[8 ];
@@ -1544,7 +1544,7 @@ struct target_stat {abi_uint st_mode;#else abi_uint st_mode; -unsigned short st_nlink; +abi_ushort st_nlink;#endif abi_uint st_uid;abi_uint st_gid;
@@ -1598,7 +1598,7 @@ struct target_stat {abi_ulong st_dev;abi_ulong st_ino;abi_uint st_mode; -unsigned short st_nlink; +abi_ushort st_nlink;abi_uint st_uid;abi_uint st_gid;abi_ulong st_rdev;
@@ -1647,15 +1647,15 @@ struct QEMU_PACKED target_stat64 { #elif defined(TARGET_M68K) struct target_stat { - unsigned short st_dev; - unsigned short __pad1; - abi_ulong st_ino; - unsigned short st_mode; - unsigned short st_nlink; - unsigned short st_uid; - unsigned short st_gid; - unsigned short st_rdev; - unsigned short __pad2; + abi_ushort st_dev; + abi_ushort __pad1; + abi_ulong st_ino; + abi_ushort st_mode; + abi_ushort st_nlink; + abi_ushort st_uid; + abi_ushort st_gid; + abi_ushort st_rdev; + abi_ushort __pad2; abi_ulong st_size; abi_ulong st_blksize; abi_ulong st_blocks;
@@ -1895,10 +1895,10 @@ struct target_stat64 {struct target_stat {abi_ulong st_dev;abi_ulong st_ino; -unsigned short st_mode; -unsigned short st_nlink; -unsigned short st_uid; -unsigned short st_gid; +abi_ushort st_mode; +abi_ushort st_nlink; +abi_ushort st_uid; +abi_ushort st_gid;abi_ulong st_rdev;abi_ulong st_size;abi_ulong st_blksize;
@@ -2619,8 +2619,8 @@ struct target_sysinfo {abi_ulong bufferram;/* Memory used by buffers */ abi_ulong totalswap;/* Total swap space size */ abi_ulong freeswap;/* swap space still available */ -unsigned short procs;/* Number of current processes */ -unsigned short pad;/* explicit padding for m68k */ +abi_ushort procs;/* Number of current processes */ +abi_ushort pad;/* explicit padding for m68k */ abi_ulong totalhigh;/* Total high memory size */ abi_ulong freehigh;/* Available high memory size */ abi_uint mem_unit;/* Memory unit size in bytes */
Signature · 1 line
2.34.1
PATCH 12/45 linux-user: Use abi_short not short in syscall_defs.h
In reply to Richard Henderson--- linux-user/syscall_defs.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
linux-user/syscall_defs.h +3 -3
@@ -702,8 +702,8 @@ typedef struct target_siginfo {struct target_pollfd {abi_int fd;/* file descriptor */ -short events;/* requested events */ -short revents;/* returned events */ +abi_short events;/* requested events */ +abi_short revents;/* returned events */ };/* virtual terminal ioctls */
@@ -1480,7 +1480,7 @@ struct target_stat {abi_ushort st_dev;abi_ulong st_ino;abi_ushort st_mode; -short st_nlink; +abi_short st_nlink;abi_ushort st_uid;abi_ushort st_gid;abi_ushort st_rdev;
Signature · 1 line
2.34.1
PATCH 13/45 linux-user: Use abi_uint not unsigned in syscall_defs.h
In reply to Richard Henderson--- linux-user/syscall_defs.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
linux-user/syscall_defs.h +2 -2
@@ -1776,14 +1776,14 @@ struct target_stat {#define TARGET_STAT_HAVE_NSEC struct target_stat { -unsigned st_dev; +abi_uint st_dev;abi_long st_pad1[3 ];/* Reserved for network id */ abi_ulong st_ino;abi_uint st_mode;abi_uint st_nlink;abi_int st_uid;abi_int st_gid; -unsigned st_rdev; +abi_uint st_rdev;abi_long st_pad2[2 ];abi_long st_size;abi_long st_pad3;
Signature · 1 line
2.34.1
PATCH 14/45 include/exec/user: Set ABI_LLONG_ALIGNMENT to 4 for microblaze
In reply to Richard HendersonBased on gcc's microblaze.h setting BIGGEST_ALIGNMENT to 32 bits.
--- include/exec/user/abitypes.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
include/exec/user/abitypes.h +3 -1
@@ -15,7 +15,9 @@#define ABI_LLONG_ALIGNMENT 2#endif -#if (defined(TARGET_I386 ) && !defined(TARGET_X86_64 )) || defined(TARGET_SH4 ) +#if (defined(TARGET_I386 ) && !defined(TARGET_X86_64 )) \ + || defined(TARGET_SH4 ) \ + || defined(TARGET_MICROBLAZE )#define ABI_LLONG_ALIGNMENT 4#endif
Signature · 1 line
2.34.1
PATCH 15/45 include/exec/user: Set ABI_LLONG_ALIGNMENT to 4 for nios2
In reply to Richard HendersonBased on gcc's nios2.h setting BIGGEST_ALIGNMENT to 32 bits.
--- include/exec/user/abitypes.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
include/exec/user/abitypes.h +2 -1
@@ -17,7 +17,8 @@#if (defined(TARGET_I386 ) && !defined(TARGET_X86_64 )) \ || defined(TARGET_SH4 ) \ - || defined(TARGET_MICROBLAZE ) + || defined(TARGET_MICROBLAZE ) \ + || defined(TARGET_NIOS2 )#define ABI_LLONG_ALIGNMENT 4#endif
Signature · 1 line
2.34.1
PATCH 16/45 linux-user/syscall: Implement execve without execveat
In reply to Richard HendersonFrom: Pierrick Bouvier <[email protected]>
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/
Message-Id: <[email protected]>
--- linux-user/syscall.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-)
linux-user/syscall.c +12 -8
@@ -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) || \
@@ -8615,9 +8616,9 @@ ssize_t do_guest_readlink(const char *pathname, char *buf, size_t bufsiz)return ret; } -static int do_execveat (CPUArchState *cpu_env,int dirfd, -abi_long pathname,abi_long guest_argp, -abi_long guest_envp,int flags) +static int do_execv (CPUArchState *cpu_env,int dirfd, +abi_long pathname,abi_long guest_argp, +abi_long guest_envp,int flags,bool is_execveat) {int ret;char **argp, **envp;
@@ -8696,11 +8697,14 @@ static int do_execveat(CPUArchState *cpu_env, int dirfd, goto execve_efault; } +const char *exe = p;if (is_proc_myself (p,"exe" )) { - ret =get_errno (safe_execveat (dirfd, exec_path, argp, envp, flags)); - }else { - ret =get_errno (safe_execveat (dirfd, p, argp, envp, flags)); + exe = exec_path; } + ret = is_execveat + ?safe_execveat (dirfd, exe, argp, envp, flags) + :safe_execve (exe, argp, envp); + ret =get_errno (ret);unlock_user (p, pathname,0 );
@@ -9251,9 +9255,9 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1,return ret;#endif case TARGET_NR_execveat: -return do_execveat (cpu_env, arg1, arg2, arg3, arg4, arg5); +return do_execv (cpu_env, arg1, arg2, arg3, arg4, arg5, true);case TARGET_NR_execve: -return do_execveat (cpu_env,AT_FDCWD , arg1, arg2, arg3,0 ); +return do_execv (cpu_env,AT_FDCWD , arg1, arg2, arg3,0 , false);case TARGET_NR_chdir:if (!(p =lock_user_string (arg1)))return -TARGET_EFAULT ;
Signature · 1 line
2.34.1
[PULL 23/37] target/i386: Use aesdec_ISB_ISR_IMC_AK
In reply to Richard HendersonThis implements the AESDEC instruction.
--- target/i386/ops_sse.h | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-)
target/i386/ops_sse.h +5 -9
@@ -2162,16 +2162,12 @@ void glue(helper_pclmulqdq, SUFFIX)(CPUX86State *env, Reg *d, Reg *v, Reg *s,void glue (helper_aesdec ,SUFFIX )(CPUX86State *env,Reg *d,Reg *v,Reg *s) { -int i; -Reg st = *v; -Reg rk = *s; +for (int i =0 ; i <SHIFT ; i++) { +AESState *ad = (AESState *)&d->ZMM_X (i); +AESState *st = (AESState *)&v->ZMM_X (i); +AESState *rk = (AESState *)&s->ZMM_X (i); -for (i =0 ; i <2 <<SHIFT ; i++) { -int j = i &3 ; - d->L (i) = rk.L (i) ^bswap32 (AES_Td0[st.B (AES_ishifts[4 * j +0 ])] ^ - AES_Td1[st.B (AES_ishifts[4 * j +1 ])] ^ - AES_Td2[st.B (AES_ishifts[4 * j +2 ])] ^ - AES_Td3[st.B (AES_ishifts[4 * j +3 ])]); +aesdec_ISB_ISR_IMC_AK (ad, st, rk, false); } }
Signature · 1 line
2.34.1
[PULL 12/37] host/include/i386: Implement aes-round.h
In reply to Richard HendersonDetect AES in cpuinfo; implement the accel hooks.
--- host/include/i386/host/cpuinfo.h | 1 + host/include/i386/host/crypto/aes-round.h | 152 ++++++++++++++++++++ host/include/x86_64/host/crypto/aes-round.h | 1 + util/cpuinfo-i386.c | 3 + 4 files changed, 157 insertions(+) create mode 100644 host/include/i386/host/crypto/aes-round.h create mode 100644 host/include/x86_64/host/crypto/aes-round.h
host/include/i386/host/cpuinfo.h +1 -0
@@ -26,6 +26,7 @@#define CPUINFO_AVX512VBMI2 (1u << 15)#define CPUINFO_ATOMIC_VMOVDQA (1u << 16)#define CPUINFO_ATOMIC_VMOVDQU (1u << 17) +#define CPUINFO_AES (1u << 18)/* Initialized with a constructor. */ extern unsigned cpuinfo;
host/include/i386/host/crypto/aes-round.h new file +152 -0
152 lines not on this page · raw message
host/include/x86_64/host/crypto/aes-round.h new file +1 -0
@@ -0,0 +1 @@ +#include "host/include/i386/host/crypto/aes-round.h"
util/cpuinfo-i386.c +3 -0
@@ -40,6 +40,9 @@ unsigned __attribute__((constructor)) cpuinfo_init(void) info |= (c & bit_MOVBE ?CPUINFO_MOVBE :0 ); info |= (c & bit_POPCNT ?CPUINFO_POPCNT :0 ); +/* Our AES support requires PSHUFB as well. */ + info |= ((c & bit_AES) && (c & bit_SSSE3) ?CPUINFO_AES :0 ); +/* For AVX features, we must check available and usable. */ if ((c & bit_AVX) && (c & bit_OSXSAVE)) {unsigned bv =xgetbv_low (0 );
Signature · 1 line
2.34.1
[PULL 17/37] target/ppc: Use aesenc_SB_SR_MC_AK
In reply to Richard HendersonThis implements the VCIPHER instruction.
--- target/ppc/int_helper.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-)
target/ppc/int_helper.c +4 -10
@@ -2933,17 +2933,11 @@ void helper_vsbox(ppc_avr_t *r, ppc_avr_t *a)void helper_vcipher (ppc_avr_t *r,ppc_avr_t *a,ppc_avr_t *b) { -ppc_avr_t result; -int i; +AESState *ad = (AESState *)r; +AESState *st = (AESState *)a; +AESState *rk = (AESState *)b; - VECTOR_FOR_INORDER_I(i, u32) { - result.VsrW (i) = b->VsrW (i) ^ - (AES_Te0[a->VsrB (AES_shifts[4 * i +0 ])] ^ - AES_Te1[a->VsrB (AES_shifts[4 * i +1 ])] ^ - AES_Te2[a->VsrB (AES_shifts[4 * i +2 ])] ^ - AES_Te3[a->VsrB (AES_shifts[4 * i +3 ])]); - } - *r = result; +aesenc_SB_SR_MC_AK (ad, st, rk, true); }void helper_vcipherlast (ppc_avr_t *r,ppc_avr_t *a,ppc_avr_t *b)
Signature · 1 line
2.34.1
[PULL 14/37] host/include/ppc: Implement aes-round.h
In reply to Richard HendersonDetect CRYPTO in cpuinfo; implement the accel hooks.
--- host/include/ppc/host/cpuinfo.h | 1 + host/include/ppc/host/crypto/aes-round.h | 182 +++++++++++++++++++++ host/include/ppc64/host/crypto/aes-round.h | 1 + util/cpuinfo-ppc.c | 8 + 4 files changed, 192 insertions(+) create mode 100644 host/include/ppc/host/crypto/aes-round.h create mode 100644 host/include/ppc64/host/crypto/aes-round.h
host/include/ppc/host/cpuinfo.h +1 -0
@@ -16,6 +16,7 @@#define CPUINFO_ISEL (1u << 5)#define CPUINFO_ALTIVEC (1u << 6)#define CPUINFO_VSX (1u << 7) +#define CPUINFO_CRYPTO (1u << 8)/* Initialized with a constructor. */ extern unsigned cpuinfo;
host/include/ppc/host/crypto/aes-round.h new file +182 -0
182 lines not on this page · raw message
host/include/ppc64/host/crypto/aes-round.h new file +1 -0
@@ -0,0 +1 @@ +#include "host/include/ppc/host/crypto/aes-round.h"
util/cpuinfo-ppc.c +8 -0
@@ -48,6 +48,14 @@ unsigned __attribute__((constructor)) cpuinfo_init(void)/* We only care about the portion of VSX that overlaps Altivec. */ if (hwcap &PPC_FEATURE_HAS_VSX ) { info |=CPUINFO_VSX ; +/* +* We use VSX especially for little-endian, but we should +* always have both anyway, since VSX came with Power7 +* and crypto came with Power8. +*/ +if (hwcap2 &PPC_FEATURE2_HAS_VEC_CRYPTO ) { + info |=CPUINFO_CRYPTO ; + } } }
Signature · 1 line
2.34.1
PATCH 17/45 linux-user: Fix do_shmat type errors
In reply to Richard HendersonThe 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.
Message-Id: <[email protected]>
--- linux-user/syscall.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
linux-user/syscall.c +6 -7
@@ -4529,14 +4529,14 @@ static inline abi_ulong target_shmlba(CPUArchState *cpu_env) }#endif -static inline abi_ulong do_shmat (CPUArchState *cpu_env, -int shmid,abi_ulong shmaddr,int shmflg) +static abi_ulong do_shmat (CPUArchState *cpu_env,int shmid, +abi_ulong shmaddr,int shmflg) {CPUState *cpu =env_cpu (cpu_env); -abi_long raddr; +abi_ulong raddr;void *host_raddr;struct shmid_ds shm_info; -int i,ret; +int i, ret;abi_ulong shmlba;/* shmat pointers are always untagged */
@@ -4592,9 +4592,9 @@ static inline abi_ulong do_shmat(CPUArchState *cpu_env,if (host_raddr == (void *)-1 ) {mmap_unlock (); -return get_errno ((long )host_raddr); +return get_errno ((intptr_t )host_raddr); } - raddr=h2g ((unsigned long )host_raddr); + raddr =h2g ((uintptr_t )host_raddr); page_set_flags(raddr, raddr + shm_info.shm_segsz - 1, PAGE_VALID | PAGE_RESET | PAGE_READ |
@@ -4611,7 +4611,6 @@ static inline abi_ulong do_shmat(CPUArchState *cpu_env,mmap_unlock ();return raddr; - }static inline abi_long do_shmdt (abi_ulong shmaddr)
Signature · 1 line
2.34.1
[PULL 34/37] crypto: Remove AES_shifts, AES_ishifts
In reply to Richard HendersonThese arrays are no longer used, replaced by AES_SH_*, AES_ISH_*.
--- include/crypto/aes.h | 4 ---- crypto/aes.c | 14 -------------- 2 files changed, 18 deletions(-)
include/crypto/aes.h +0 -4
@@ -30,10 +30,6 @@ void AES_decrypt(const unsigned char *in, unsigned char *out,extern const uint8_t AES_sbox[256 ];extern const uint8_t AES_isbox[256 ]; -/* AES ShiftRows and InvShiftRows */ -extern const uint8_t AES_shifts[16 ]; -extern const uint8_t AES_ishifts[16 ]; -/* AES MixColumns, for use with rot32. */ extern const uint32_t AES_mc_rot[256 ];
crypto/aes.c +0 -14
@@ -114,23 +114,9 @@ const uint8_t AES_isbox[256] = {/* AES ShiftRows, for complete unrolling. */ #define AES_SH (X ) (((X) * 5) & 15) -const uint8_t AES_shifts[16 ] = { -AES_SH (0x0 ),AES_SH (0x1 ),AES_SH (0x2 ),AES_SH (0x3 ), -AES_SH (0x4 ),AES_SH (0x5 ),AES_SH (0x6 ),AES_SH (0x7 ), -AES_SH (0x8 ),AES_SH (0x9 ),AES_SH (0xA ),AES_SH (0xB ), -AES_SH (0xC ),AES_SH (0xD ),AES_SH (0xE ),AES_SH (0xF ), -}; -/* AES InvShiftRows, for complete unrolling. */ #define AES_ISH (X ) (((X) * 13) & 15) -const uint8_t AES_ishifts[16 ] = { -AES_ISH (0x0 ),AES_ISH (0x1 ),AES_ISH (0x2 ),AES_ISH (0x3 ), -AES_ISH (0x4 ),AES_ISH (0x5 ),AES_ISH (0x6 ),AES_ISH (0x7 ), -AES_ISH (0x8 ),AES_ISH (0x9 ),AES_ISH (0xA ),AES_ISH (0xB ), -AES_ISH (0xC ),AES_ISH (0xD ),AES_ISH (0xE ),AES_ISH (0xF ), -}; -/* * MixColumns lookup table, for use with rot32. */
Signature · 1 line
2.34.1
PATCH 18/45 accel/tcg: Split out cpu_exec_longjmp_cleanup
In reply to Richard HendersonShare the setjmp cleanup between cpu_exec_step_atomic and cpu_exec_setjmp.
--- accel/tcg/cpu-exec.c | 43 +++++++++++++++++++------------------------ 1 file changed, 19 insertions(+), 24 deletions(-)
accel/tcg/cpu-exec.c +19 -24
@@ -526,6 +526,23 @@ static void cpu_exec_exit(CPUState *cpu) } } +static void cpu_exec_longjmp_cleanup (CPUState *cpu) +{ +/* Non-buggy compilers preserve this; assert the correct value. */ +g_assert (cpu == current_cpu); + +#ifdef CONFIG_USER_ONLY +clear_helper_retaddr (); +if (have_mmap_lock ()) { +mmap_unlock (); + } +#endif +if (qemu_mutex_iothread_locked ()) { +qemu_mutex_unlock_iothread (); + } +assert_no_pages_locked (); +} +void cpu_exec_step_atomic (CPUState *cpu) {CPUArchState *env = cpu->env_ptr;
@@ -568,16 +585,7 @@ void cpu_exec_step_atomic(CPUState *cpu)cpu_tb_exec (cpu, tb, &tb_exit);cpu_exec_exit (cpu); }else { -#ifdef CONFIG_USER_ONLY -clear_helper_retaddr (); -if (have_mmap_lock ()) { -mmap_unlock (); - } -#endif -if (qemu_mutex_iothread_locked ()) { -qemu_mutex_unlock_iothread (); - } -assert_no_pages_locked (); +cpu_exec_longjmp_cleanup (cpu); }/*
@@ -1023,20 +1031,7 @@ static int cpu_exec_setjmp(CPUState *cpu, SyncClocks *sc) {/* Prepare setjmp context for exception handling. */ if (unlikely (sigsetjmp (cpu->jmp_env,0 ) !=0 )) { -/* Non-buggy compilers preserve this; assert the correct value. */ -g_assert (cpu == current_cpu); - -#ifdef CONFIG_USER_ONLY -clear_helper_retaddr (); -if (have_mmap_lock ()) { -mmap_unlock (); - } -#endif -if (qemu_mutex_iothread_locked ()) { -qemu_mutex_unlock_iothread (); - } - -assert_no_pages_locked (); +cpu_exec_longjmp_cleanup (cpu); }return cpu_exec_loop (cpu, sc);
Signature · 1 line
2.34.1
PATCH 19/45 tcg: Fix info_in_idx increment in layout_arg_by_ref
In reply to Richard HendersonOff 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.
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1751
--- tcg/tcg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tcg/tcg.c +1 -1
@@ -1083,7 +1083,7 @@ static void layout_arg_by_ref(TCGCumulativeArgs *cum, TCGHelperInfo *info) .ref_slot = cum->ref_slot + i, }; } - cum->info_in_idx += n; + cum->info_in_idx += n -1 ;/* i=0 accounted for in layout_arg_1 */ cum->ref_slot += n; }
Signature · 1 line
2.34.1
PATCH 20/45 linux-user: Make sure initial brk(0) is page-aligned
In reply to Richard HendersonFrom: Andreas Schwab <[email protected]>
Message-Id: <[email protected]>
--- linux-user/syscall.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
linux-user/syscall.c +1 -1
@@ -806,7 +806,7 @@ static abi_ulong brk_page;void target_set_brk (abi_ulong new_brk) { - target_brk = new_brk; + target_brk =TARGET_PAGE_ALIGN (new_brk); brk_page =HOST_PAGE_ALIGN (target_brk); }
Signature · 1 line
2.34.1
[PULL 32/37] target/riscv: Use aesenc_SB_SR_MC_AK
In reply to Richard HendersonThis implements the AES64ESM instruction.
--- target/riscv/crypto_helper.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
target/riscv/crypto_helper.c +6 -1
@@ -198,7 +198,12 @@ static inline target_ulong aes64_operation(target_ulong rs1, target_ulong rs2,target_ulong HELPER (aes64esm )(target_ulong rs1,target_ulong rs2) { -return aes64_operation (rs1, rs2, true, true); +AESState t; + + t.d[HOST_BIG_ENDIAN ] = rs1; + t.d[!HOST_BIG_ENDIAN ] = rs2; +aesenc_SB_SR_MC_AK (&t, &t, &aes_zero, false); +return t.d[HOST_BIG_ENDIAN ]; }target_ulong HELPER (aes64es )(target_ulong rs1,target_ulong rs2)
Signature · 1 line
2.34.1
PATCH 21/45 linux-user: Fix formatting of mmap.c
In reply to Richard HendersonFix all checkpatch.pl errors within mmap.c.
Message-Id: <[email protected]>
--- linux-user/mmap.c | 199 ++++++++++++++++++++++++++++------------------ 1 file changed, 122 insertions(+), 77 deletions(-)
linux-user/mmap.c +122 -77
@@ -56,10 +56,11 @@ void mmap_fork_start(void)void mmap_fork_end (int child) { -if (child) +if (child) {pthread_mutex_init (&mmap_mutex,NULL ); -else + }else {pthread_mutex_unlock (&mmap_mutex); + } }/*
@@ -203,40 +204,47 @@ static int mmap_frag(abi_ulong real_start,/* get the protection of the target pages outside the mapping */ prot1 =0 ; -for (addr = real_start; addr < real_end; addr++) { -if (addr < start || addr >= end) +for (addr = real_start; addr < real_end; addr++) { +if (addr < start || addr >= end) { prot1 |=page_get_flags (addr); + } }if (prot1 ==0 ) {/* no page was there, so we allocate one */ void *p =mmap (host_start, qemu_host_page_size, prot, flags |MAP_ANONYMOUS ,-1 ,0 ); -if (p ==MAP_FAILED ) +if (p ==MAP_FAILED ) {return -1 ; + } prot1 = prot; } prot1 &=PAGE_BITS ; prot_new = prot | prot1;if (!(flags &MAP_ANONYMOUS )) { -/* msync() won't work here, so we return an error if write is -possible while it is a shared mapping */ -if ((flags &MAP_TYPE ) ==MAP_SHARED && - (prot &PROT_WRITE )) +/* +* msync() won't work here, so we return an error if write is +* possible while it is a shared mapping. +*/ +if ((flags &MAP_TYPE ) ==MAP_SHARED && (prot &PROT_WRITE )) {return -1 ; + }/* adjust protection to be able to read */ -if (!(prot1 &PROT_WRITE )) +if (!(prot1 &PROT_WRITE )) {mprotect (host_start, qemu_host_page_size, prot1 |PROT_WRITE ); + }/* read the corresponding file data */ -if (pread (fd,g2h_untagged (start), end - start, offset) ==-1 ) +if (pread (fd,g2h_untagged (start), end - start, offset) ==-1 ) {return -1 ; + }/* put final protection */ -if (prot_new != (prot1 |PROT_WRITE )) +if (prot_new != (prot1 |PROT_WRITE )) {mprotect (host_start, qemu_host_page_size, prot_new); + } }else {if (prot_new != prot1) {mprotect (host_start, qemu_host_page_size, prot_new);
@@ -265,8 +273,10 @@ abi_ulong mmap_next_start = TASK_UNMAPPED_BASE;unsigned long last_brk; -/* Subroutine of mmap_find_vma, used when we have pre-allocated a chunk -of guest address space. */ +/* +* Subroutine of mmap_find_vma, used when we have pre-allocated +* a chunk of guest address space. +*/ static abi_ulong mmap_find_vma_reserved (abi_ulong start,abi_ulong size,abi_ulong align) {
@@ -362,15 +372,17 @@ abi_ulong mmap_find_vma(abi_ulong start, abi_ulong size, abi_ulong align)* - shmat() with SHM_REMAP flag */ ptr =mmap (g2h_untagged (addr), size,PROT_NONE , -MAP_ANONYMOUS |MAP_PRIVATE |MAP_NORESERVE ,-1 ,0 ); +MAP_ANONYMOUS |MAP_PRIVATE |MAP_NORESERVE ,-1 ,0 );/* ENOMEM, if host address space has no memory */ if (ptr ==MAP_FAILED ) {return (abi_ulong)-1 ; } -/* Count the number of sequential returns of the same address. -This is used to modify the search algorithm below. */ +/* +* Count the number of sequential returns of the same address. +* This is used to modify the search algorithm below. +*/ repeat = (ptr == prev ? repeat +1 :0 );if (h2g_valid (ptr + size -1 )) {
@@ -387,14 +399,18 @@ abi_ulong mmap_find_vma(abi_ulong start, abi_ulong size, abi_ulong align)/* The address is not properly aligned for the target. */ switch (repeat) {case 0 : -/* Assume the result that the kernel gave us is the -first with enough free space, so start again at the -next higher target page. */ +/* +* Assume the result that the kernel gave us is the +* first with enough free space, so start again at the +* next higher target page. +*/ addr =ROUND_UP (addr, align);break ;case 1 : -/* Sometimes the kernel decides to perform the allocation -at the top end of memory instead. */ +/* +* Sometimes the kernel decides to perform the allocation +* at the top end of memory instead. +*/ addr &= -align;break ;case 2 :
@@ -407,8 +423,10 @@ abi_ulong mmap_find_vma(abi_ulong start, abi_ulong size, abi_ulong align)break ; } }else { -/* Since the result the kernel gave didn't fit, start -again at low memory. If any repetition, fail. */ +/* +* Since the result the kernel gave didn't fit, start +* again at low memory. If any repetition, fail. +*/ addr = (repeat ?-1 :0 ); }
@@ -423,8 +441,10 @@ abi_ulong mmap_find_vma(abi_ulong start, abi_ulong size, abi_ulong align)return (abi_ulong)-1 ; } wrapped =1 ; -/* Don't actually use 0 when wrapping, instead indicate -that we'd truly like an allocation in low memory. */ +/* +* Don't actually use 0 when wrapping, instead indicate +* that we'd truly like an allocation in low memory. +*/ addr = (mmap_min_addr >TARGET_PAGE_SIZE ?TARGET_PAGE_ALIGN (mmap_min_addr) :TARGET_PAGE_SIZE );
@@ -485,8 +505,10 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int target_prot, real_start = start & qemu_host_page_mask; host_offset = offset & qemu_host_page_mask; -/* If the user is asking for the kernel to find a location, do that -before we truncate the length for mapping files below. */ +/* +* If the user is asking for the kernel to find a location, do that +* before we truncate the length for mapping files below. +*/ if (!(flags &MAP_FIXED )) { host_len = len + offset - host_offset; host_len =HOST_PAGE_ALIGN (host_len);
@@ -497,32 +519,36 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int target_prot, } } -/* When mapping files into a memory area larger than the file, accesses -to pages beyond the file size will cause a SIGBUS. - -For example, if mmaping a file of 100 bytes on a host with 4K pages -emulating a target with 8K pages, the target expects to be able to -access the first 8K. But the host will trap us on any access beyond -4K. - -When emulating a target with a larger page-size than the hosts, we -may need to truncate file maps at EOF and add extra anonymous pages -up to the targets page boundary. */ - +/* +* When mapping files into a memory area larger than the file, accesses +* to pages beyond the file size will cause a SIGBUS. +* +* For example, if mmaping a file of 100 bytes on a host with 4K pages +* emulating a target with 8K pages, the target expects to be able to +* access the first 8K. But the host will trap us on any access beyond +* 4K. +* +* When emulating a target with a larger page-size than the hosts, we +* may need to truncate file maps at EOF and add extra anonymous pages +* up to the targets page boundary. +*/ if ((qemu_real_host_page_size () < qemu_host_page_size) && !(flags &MAP_ANONYMOUS )) {struct stat sb; -if (fstat (fd, &sb) ==-1 ) - goto fail; +if (fstat (fd, &sb) ==-1 ) { + goto fail; + } -/* Are we trying to create a map beyond EOF?. */ -if (offset + len > sb.st_size) { -/* If so, truncate the file map at eof aligned with -the hosts real pagesize. Additional anonymous maps -will be created beyond EOF. */ - len =REAL_HOST_PAGE_ALIGN (sb.st_size - offset); - } +/* Are we trying to create a map beyond EOF?. */ +if (offset + len > sb.st_size) { +/* +* If so, truncate the file map at eof aligned with +* the hosts real pagesize. Additional anonymous maps +* will be created beyond EOF. +*/ + len =REAL_HOST_PAGE_ALIGN (sb.st_size - offset); + } }if (!(flags &MAP_FIXED )) {
@@ -532,9 +558,11 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int target_prot, host_len = len + offset - host_offset; host_len =HOST_PAGE_ALIGN (host_len); -/* Note: we prefer to control the mapping address. It is -especially important if qemu_host_page_size > -qemu_real_host_page_size */ +/* +* Note: we prefer to control the mapping address. It is +* especially important if qemu_host_page_size > +* qemu_real_host_page_size. +*/ p =mmap (g2h_untagged (start), host_len, host_prot, flags |MAP_FIXED |MAP_ANONYMOUS ,-1 ,0 );if (p ==MAP_FAILED ) {
@@ -572,45 +600,52 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int target_prot, goto fail; } -/* worst case: we cannot map the file because the offset is not -aligned, so we read it */ +/* +* worst case: we cannot map the file because the offset is not +* aligned, so we read it +*/ if (!(flags &MAP_ANONYMOUS ) && (offset & ~qemu_host_page_mask) != (start & ~qemu_host_page_mask)) { -/* msync() won't work here, so we return an error if write is -possible while it is a shared mapping */ -if ((flags &MAP_TYPE ) ==MAP_SHARED && - (host_prot &PROT_WRITE )) { +/* +* msync() won't work here, so we return an error if write is +* possible while it is a shared mapping +*/ +if ((flags &MAP_TYPE ) ==MAP_SHARED && (host_prot &PROT_WRITE )) { errno =EINVAL ; goto fail; } retaddr =target_mmap (start, len, target_prot |PROT_WRITE ,MAP_FIXED |MAP_PRIVATE |MAP_ANONYMOUS ,-1 ,0 ); -if (retaddr ==-1 ) +if (retaddr ==-1 ) { goto fail; -if (pread (fd,g2h_untagged (start), len, offset) ==-1 ) + } +if (pread (fd,g2h_untagged (start), len, offset) ==-1 ) { goto fail; + }if (!(host_prot &PROT_WRITE )) { ret =target_mprotect (start, len, target_prot);assert (ret ==0 ); } goto the_end; } - +/* handle the start of the mapping */ if (start > real_start) {if (real_end == real_start + qemu_host_page_size) {/* one single host page */ ret =mmap_frag (real_start, start, end, host_prot, flags, fd, offset); -if (ret ==-1 ) +if (ret ==-1 ) { goto fail; + } goto the_end1; } ret =mmap_frag (real_start, start, real_start + qemu_host_page_size, host_prot, flags, fd, offset); -if (ret ==-1 ) +if (ret ==-1 ) { goto fail; + } real_start += qemu_host_page_size; }/* handle the end of the mapping */
@@ -619,8 +654,9 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int target_prot, real_end - qemu_host_page_size, end, host_prot, flags, fd, offset + real_end - qemu_host_page_size - start); -if (ret ==-1 ) +if (ret ==-1 ) { goto fail; + } real_end -= qemu_host_page_size; }
@@ -628,14 +664,16 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int target_prot,if (real_start < real_end) {void *p;unsigned long offset1; -if (flags &MAP_ANONYMOUS ) +if (flags &MAP_ANONYMOUS ) { offset1 =0 ; -else + }else { offset1 = offset + real_start - start; + } p =mmap (g2h_untagged (real_start), real_end - real_start, host_prot, flags, fd, offset1); -if (p ==MAP_FAILED ) +if (p ==MAP_FAILED ) { goto fail; + } passthrough_start = real_start; passthrough_end = real_end; }
@@ -697,16 +735,18 @@ static void mmap_reserve(abi_ulong start, abi_ulong size) } end = real_end; } -if (prot !=0 ) +if (prot !=0 ) { real_start += qemu_host_page_size; + } }if (end < real_end) { prot =0 ;for (addr = end; addr < real_end; addr +=TARGET_PAGE_SIZE ) { prot |=page_get_flags (addr); } -if (prot !=0 ) +if (prot !=0 ) { real_end -= qemu_host_page_size; + } }if (real_start != real_end) { mmap(g2h_untagged(real_start), real_end - real_start, PROT_NONE,
@@ -722,8 +762,9 @@ int target_munmap(abi_ulong start, abi_ulong len)trace_target_munmap (start, len); -if (start & ~TARGET_PAGE_MASK ) +if (start & ~TARGET_PAGE_MASK ) {return -TARGET_EINVAL ; + } len =TARGET_PAGE_ALIGN (len);if (len ==0 || !guest_range_valid_untagged (start, len)) {return -TARGET_EINVAL ;
@@ -737,25 +778,27 @@ int target_munmap(abi_ulong start, abi_ulong len)if (start > real_start) {/* handle host page containing start */ prot =0 ; -for (addr = real_start; addr < start; addr +=TARGET_PAGE_SIZE ) { +for (addr = real_start; addr < start; addr +=TARGET_PAGE_SIZE ) { prot |=page_get_flags (addr); }if (real_end == real_start + qemu_host_page_size) { -for (addr = end; addr < real_end; addr +=TARGET_PAGE_SIZE ) { +for (addr = end; addr < real_end; addr +=TARGET_PAGE_SIZE ) { prot |=page_get_flags (addr); } end = real_end; } -if (prot !=0 ) +if (prot !=0 ) { real_start += qemu_host_page_size; + } }if (end < real_end) { prot =0 ; -for (addr = end; addr < real_end; addr +=TARGET_PAGE_SIZE ) { +for (addr = end; addr < real_end; addr +=TARGET_PAGE_SIZE ) { prot |=page_get_flags (addr); } -if (prot !=0 ) +if (prot !=0 ) { real_end -= qemu_host_page_size; + } } ret =0 ;
@@ -798,8 +841,10 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size, flags, g2h_untagged(new_addr));if (reserved_va && host_addr !=MAP_FAILED ) { -/* If new and old addresses overlap then the above mremap will -already have failed with EINVAL. */ +/* +* If new and old addresses overlap then the above mremap will +* already have failed with EINVAL. +*/ mmap_reserve (old_addr, old_size); } }else if (flags &MREMAP_MAYMOVE ) {
Signature · 1 line
2.34.1
PATCH 22/45 linux-user/strace: Expand struct flags to hold a mask
In reply to Richard HendersonA 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.
Message-Id: <[email protected]>
--- linux-user/strace.c | 40 ++++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 18 deletions(-)
linux-user/strace.c +22 -18
@@ -46,15 +46,21 @@ struct syscallname {*/ struct flags {abi_long f_value;/* flag */ +abi_long f_mask;/* mask */ const char *f_string;/* stringified flag */ }; +/* No 'struct flags' element should have a zero mask. */ +#define FLAG_BASIC (V ,M ,N ) { V, M | QEMU_BUILD_BUG_ON_ZERO(!(M)), N } +/* common flags for all architectures */ -#define FLAG_GENERIC (name) { name, #name } +#define FLAG_GENERIC_MASK (V ,M ) FLAG_BASIC(V, M, #V) +#define FLAG_GENERIC (V ) FLAG_BASIC(V, V, #V)/* target specific flags (syscall_defs.h has TARGET_<flag>) */ -#define FLAG_TARGET (name) { TARGET_ ## name, #name } +#define FLAG_TARGET_MASK (V ,M ) FLAG_BASIC(TARGET_##V, TARGET_##M, #V) +#define FLAG_TARGET (V ) FLAG_BASIC(TARGET_##V, TARGET_##V, #V)/* end of flags array */ -#define FLAG_END { 0, NULL } +#define FLAG_END { 0, 0, NULL }/* Structure used to translate enumerated values into strings */ struct enums {
@@ -963,7 +969,7 @@ print_syscall_ret_ioctl(CPUArchState *cpu_env, const struct syscallname *name,#endif UNUSED static const struct flags access_flags[] = { -FLAG_GENERIC (F_OK ), +FLAG_GENERIC_MASK (F_OK ,R_OK |W_OK |X_OK ),FLAG_GENERIC (R_OK ),FLAG_GENERIC (W_OK ),FLAG_GENERIC (X_OK ),
@@ -999,9 +1005,9 @@ UNUSED static const struct flags mode_flags[] = { }; UNUSED static const struct flags open_access_flags[] = { -FLAG_TARGET (O_RDONLY ), -FLAG_TARGET (O_WRONLY ), -FLAG_TARGET (O_RDWR ), +FLAG_TARGET_MASK (O_RDONLY ,O_ACCMODE ), +FLAG_TARGET_MASK (O_WRONLY ,O_ACCMODE ), +FLAG_TARGET_MASK (O_RDWR ,O_ACCMODE ),FLAG_END , };
@@ -1010,7 +1016,9 @@ UNUSED static const struct flags open_flags[] = {FLAG_TARGET (O_CREAT ),FLAG_TARGET (O_DIRECTORY ),FLAG_TARGET (O_EXCL ), +#if TARGET_O_LARGEFILE != 0FLAG_TARGET (O_LARGEFILE ), +#endifFLAG_TARGET (O_NOCTTY ),FLAG_TARGET (O_NOFOLLOW ), FLAG_TARGET(O_NONBLOCK), /* also O_NDELAY */
@@ -1075,7 +1083,7 @@ UNUSED static const struct flags umount2_flags[] = { }; UNUSED static const struct flags mmap_prot_flags[] = { -FLAG_GENERIC (PROT_NONE ), +FLAG_GENERIC_MASK (PROT_NONE ,PROT_READ |PROT_WRITE |PROT_EXEC ),FLAG_GENERIC (PROT_EXEC ),FLAG_GENERIC (PROT_READ ),FLAG_GENERIC (PROT_WRITE ),
@@ -1103,7 +1111,7 @@ UNUSED static const struct flags mmap_flags[] = {#ifdef MAP_POPULATE FLAG_TARGET(MAP_POPULATE),#endif -#ifdef TARGET_MAP_UNINITIALIZED +#if defined(TARGET_MAP_UNINITIALIZED ) &&TARGET_MAP_UNINITIALIZED !=0 FLAG_TARGET (MAP_UNINITIALIZED ), #endif FLAG_TARGET(MAP_HUGETLB),
@@ -1201,13 +1209,13 @@ UNUSED static const struct flags statx_flags[] = { FLAG_GENERIC(AT_SYMLINK_NOFOLLOW),#endif #ifdef AT_STATX_SYNC_AS_STAT - FLAG_GENERIC(AT_STATX_SYNC_AS_STAT), + FLAG_GENERIC_MASK(AT_STATX_SYNC_AS_STAT, AT_STATX_SYNC_TYPE),#endif #ifdef AT_STATX_FORCE_SYNC - FLAG_GENERIC(AT_STATX_FORCE_SYNC), + FLAG_GENERIC_MASK(AT_STATX_FORCE_SYNC, AT_STATX_SYNC_TYPE),#endif #ifdef AT_STATX_DONT_SYNC -FLAG_GENERIC (AT_STATX_DONT_SYNC ), +FLAG_GENERIC_MASK (AT_STATX_DONT_SYNC ,AT_STATX_SYNC_TYPE ), #endif FLAG_END, };
@@ -1481,14 +1489,10 @@ print_flags(const struct flags *f, abi_long flags, int last)const char *sep ="" ;int n; -if ((flags ==0 ) && (f->f_value ==0 )) { -qemu_log ("%s%s" , f->f_string,get_comma (last)); -return ; - }for (n =0 ; f->f_string !=NULL ; f++) { -if ((f->f_value !=0 ) && ((flags & f->f_value) == f->f_value)) { +if ((flags & f->f_mask) == f->f_value) {qemu_log ("%s%s" , sep, f->f_string); - flags &= ~f->f_value; + flags &= ~f->f_mask; sep ="|" ; n++; }
Signature · 1 line
2.34.1
PATCH 23/45 linux-user: Split TARGET_MAP_* out of syscall_defs.h
In reply to Richard HendersonMove the values into the per-target target_mman.h headers
Message-Id: <[email protected]>
--- 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(-)
linux-user/alpha/target_mman.h +13 -0
@@ -1,6 +1,19 @@#ifndef ALPHA_TARGET_MMAN_H #define ALPHA_TARGET_MMAN_H +#define TARGET_MAP_ANONYMOUS 0x10 +#define TARGET_MAP_FIXED 0x100 +#define TARGET_MAP_GROWSDOWN 0x01000 +#define TARGET_MAP_DENYWRITE 0x02000 +#define TARGET_MAP_EXECUTABLE 0x04000 +#define TARGET_MAP_LOCKED 0x08000 +#define TARGET_MAP_NORESERVE 0x10000 +#define TARGET_MAP_POPULATE 0x20000 +#define TARGET_MAP_NONBLOCK 0x40000 +#define TARGET_MAP_STACK 0x80000 +#define TARGET_MAP_HUGETLB 0x100000 +#define TARGET_MAP_FIXED_NOREPLACE 0x200000 +#define TARGET_MADV_DONTNEED 6#define TARGET_MS_ASYNC 1
linux-user/generic/target_mman.h +54 -0
60 lines not on this page · raw message
linux-user/hppa/target_mman.h +10 -0
@@ -1,6 +1,16 @@#ifndef HPPA_TARGET_MMAN_H #define HPPA_TARGET_MMAN_H +#define TARGET_MAP_TYPE 0x2b +#define TARGET_MAP_FIXED 0x04 +#define TARGET_MAP_ANONYMOUS 0x10 +#define TARGET_MAP_GROWSDOWN 0x8000 +#define TARGET_MAP_POPULATE 0x10000 +#define TARGET_MAP_NONBLOCK 0x20000 +#define TARGET_MAP_STACK 0x40000 +#define TARGET_MAP_HUGETLB 0x80000 +#define TARGET_MAP_UNINITIALIZED 0 +#define TARGET_MADV_MERGEABLE 65#define TARGET_MADV_UNMERGEABLE 66#define TARGET_MADV_HUGEPAGE 67
linux-user/mips/target_mman.h +16 -0
@@ -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
linux-user/mips64/target_mman.h +1 -1
@@ -1 +1 @@ -#include "../generic/target_mman.h" +#include "../mips/target_mman.h"
linux-user/ppc/target_mman.h +8 -0
@@ -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
linux-user/sparc/target_mman.h +9 -0
@@ -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
linux-user/syscall_defs.h +1 -84
91 lines not on this page · raw message
linux-user/xtensa/target_mman.h +16 -0
@@ -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
Signature · 1 line
2.34.1
[PULL 28/37] target/arm: Use aesdec_IMC
In reply to Richard HendersonThis implements the AESIMC instruction. We have converted everything to crypto/aes-round.h; crypto/aes.h is no longer needed.
--- target/arm/tcg/crypto_helper.c | 33 ++++++++++++++------------------- 1 file changed, 14 insertions(+), 19 deletions(-)
target/arm/tcg/crypto_helper.c +14 -19
@@ -14,7 +14,6 @@#include "cpu.h" #include "exec/helper-proto.h" #include "tcg/tcg-gvec-desc.h" -#include "crypto/aes.h" #include "crypto/aes-round.h" #include "crypto/sm4.h" #include "vec_internal.h"
@@ -102,23 +101,6 @@ void HELPER(crypto_aesd)(void *vd, void *vn, void *vm, uint32_t desc)clear_tail (vd, opr_sz,simd_maxsz (desc)); } -static void do_crypto_aesmc (uint64_t *rd,uint64_t *rm,const uint32_t *mc) -{ -union CRYPTO_STATE st = { .l = { rm[0 ], rm[1 ] } }; -int i; - -for (i =0 ; i <16 ; i +=4 ) { -CR_ST_WORD (st, i >>2 ) = - mc[CR_ST_BYTE (st, i)] ^ -rol32 (mc[CR_ST_BYTE (st, i +1 )],8 ) ^ -rol32 (mc[CR_ST_BYTE (st, i +2 )],16 ) ^ -rol32 (mc[CR_ST_BYTE (st, i +3 )],24 ); - } - - rd[0 ] = st.l[0 ]; - rd[1 ] = st.l[1 ]; -} -void HELPER (crypto_aesmc )(void *vd,void *vm,uint32_t desc) {intptr_t i, opr_sz =simd_oprsz (desc);
@@ -147,7 +129,20 @@ void HELPER(crypto_aesimc)(void *vd, void *vm, uint32_t desc)intptr_t i, opr_sz =simd_oprsz (desc);for (i =0 ; i < opr_sz; i +=16 ) { -do_crypto_aesmc (vd + i, vm + i, AES_imc_rot); +AESState *ad = (AESState *)(vd + i); +AESState *st = (AESState *)(vm + i); +AESState t; + +/* Our uint64_t are in the wrong order for big-endian. */ +if (HOST_BIG_ENDIAN ) { + t.d[0 ] = st->d[1 ]; + t.d[1 ] = st->d[0 ]; +aesdec_IMC (&t, &t, false); + ad->d[0 ] = t.d[1 ]; + ad->d[1 ] = t.d[0 ]; + }else { +aesdec_IMC (ad, st, false); + } }clear_tail (vd, opr_sz,simd_maxsz (desc)); }
Signature · 1 line
2.34.1
PATCH 24/45 linux-user: Split TARGET_PROT_* out of syscall_defs.h
In reply to Richard HendersonMove the values into the per-target target_mman.h headers
Message-Id: <[email protected]>
--- 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(-)
linux-user/aarch64/target_mman.h +8 -0
@@ -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
linux-user/generic/target_mman.h +5 -1
@@ -23,7 +23,11 @@#define TARGET_MAP_NORESERVE 0x4000#endif -/* Other MAP flags are defined in asm-generic/mman-common.h */ +/* Defined in asm-generic/mman-common.h */ +#ifndef TARGET_PROT_SEM +#define TARGET_PROT_SEM 0x08 +#endif +#ifndef TARGET_MAP_TYPE #define TARGET_MAP_TYPE 0x0f#endif
linux-user/mips/target_mman.h +2 -0
@@ -1,6 +1,8 @@#ifndef MIPS_TARGET_MMAN_H #define MIPS_TARGET_MMAN_H +#define TARGET_PROT_SEM 0x10 +#define TARGET_MAP_NORESERVE 0x0400#define TARGET_MAP_ANONYMOUS 0x0800#define TARGET_MAP_GROWSDOWN 0x1000
linux-user/syscall_defs.h +0 -11
@@ -1227,17 +1227,6 @@ struct target_winsize {#include "termbits.h" -#if defined(TARGET_MIPS ) || defined(TARGET_XTENSA ) -#define TARGET_PROT_SEM 0x10 -#else -#define TARGET_PROT_SEM 0x08 -#endif - -#ifdef TARGET_AARCH64 -#define TARGET_PROT_BTI 0x10 -#define TARGET_PROT_MTE 0x20 -#endif -#include "target_mman.h" #if (defined(TARGET_I386 ) && defined(TARGET_ABI32 )) \
linux-user/xtensa/target_mman.h +2 -0
@@ -1,6 +1,8 @@#ifndef XTENSA_TARGET_MMAN_H #define XTENSA_TARGET_MMAN_H +#define TARGET_PROT_SEM 0x10 +#define TARGET_MAP_NORESERVE 0x0400#define TARGET_MAP_ANONYMOUS 0x0800#define TARGET_MAP_GROWSDOWN 0x1000
Signature · 1 line
2.34.1
PATCH 25/45 linux-user: Populate more bits in mmap_flags_tbl
In reply to Richard HendersonFix 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.
Message-Id: <[email protected]>
--- linux-user/strace.c | 23 ++++++++++------------- linux-user/syscall.c | 21 +++++++++++++++++++-- 2 files changed, 29 insertions(+), 15 deletions(-)
linux-user/strace.c +10 -13
@@ -1094,28 +1094,25 @@ UNUSED static const struct flags mmap_prot_flags[] = { }; UNUSED static const struct flags mmap_flags[] = { -FLAG_TARGET (MAP_SHARED ), -FLAG_TARGET (MAP_PRIVATE ), +FLAG_TARGET_MASK (MAP_SHARED ,MAP_TYPE ), +FLAG_TARGET_MASK (MAP_PRIVATE ,MAP_TYPE ), +FLAG_TARGET_MASK (MAP_SHARED_VALIDATE ,MAP_TYPE ),FLAG_TARGET (MAP_ANONYMOUS ),FLAG_TARGET (MAP_DENYWRITE ), -FLAG_TARGET (MAP_FIXED ), -FLAG_TARGET (MAP_GROWSDOWN ),FLAG_TARGET (MAP_EXECUTABLE ), -#ifdef MAP_LOCKED +FLAG_TARGET (MAP_FIXED ), +FLAG_TARGET (MAP_FIXED_NOREPLACE ), +FLAG_TARGET (MAP_GROWSDOWN ), +FLAG_TARGET (MAP_HUGETLB ),FLAG_TARGET (MAP_LOCKED ), -#endif -#ifdef MAP_NONBLOCKFLAG_TARGET (MAP_NONBLOCK ), -#endifFLAG_TARGET (MAP_NORESERVE ), -#ifdef MAP_POPULATEFLAG_TARGET (MAP_POPULATE ), -#endif -#if defined(TARGET_MAP_UNINITIALIZED) && TARGET_MAP_UNINITIALIZED != 0 +FLAG_TARGET (MAP_STACK ), +FLAG_TARGET (MAP_SYNC ), +#if TARGET_MAP_UNINITIALIZED != 0FLAG_TARGET (MAP_UNINITIALIZED ), #endif -FLAG_TARGET (MAP_HUGETLB ), -FLAG_TARGET (MAP_STACK ),FLAG_END , };
linux-user/syscall.c +19 -2
@@ -6002,9 +6002,19 @@ static const StructEntry struct_termios_def = { .print = print_termios, }; +/* If the host does not provide these bits, they may be safely discarded. */ +#ifndef MAP_SYNC +#define MAP_SYNC 0 +#endif +#ifndef MAP_UNINITIALIZED +#define MAP_UNINITIALIZED 0 +#endif +static const bitmask_transtbl mmap_flags_tbl[] = { - {TARGET_MAP_SHARED ,TARGET_MAP_SHARED ,MAP_SHARED ,MAP_SHARED }, - {TARGET_MAP_PRIVATE ,TARGET_MAP_PRIVATE ,MAP_PRIVATE ,MAP_PRIVATE }, + {TARGET_MAP_TYPE ,TARGET_MAP_SHARED ,MAP_TYPE ,MAP_SHARED }, + {TARGET_MAP_TYPE ,TARGET_MAP_PRIVATE ,MAP_TYPE ,MAP_PRIVATE }, + {TARGET_MAP_TYPE ,TARGET_MAP_SHARED_VALIDATE , +MAP_TYPE ,MAP_SHARED_VALIDATE }, {TARGET_MAP_FIXED ,TARGET_MAP_FIXED ,MAP_FIXED ,MAP_FIXED }, {TARGET_MAP_ANONYMOUS ,TARGET_MAP_ANONYMOUS ,MAP_ANONYMOUS ,MAP_ANONYMOUS },
@@ -6022,6 +6032,13 @@ static const bitmask_transtbl mmap_flags_tbl[] = {Recognize it for the target insofar as we do not want to pass it through to the host. */ { TARGET_MAP_STACK, TARGET_MAP_STACK, 0, 0 }, + { TARGET_MAP_SYNC, TARGET_MAP_SYNC, MAP_SYNC, MAP_SYNC }, + { TARGET_MAP_NONBLOCK, TARGET_MAP_NONBLOCK, MAP_NONBLOCK, MAP_NONBLOCK }, + { TARGET_MAP_POPULATE, TARGET_MAP_POPULATE, MAP_POPULATE, MAP_POPULATE }, + { TARGET_MAP_FIXED_NOREPLACE, TARGET_MAP_FIXED_NOREPLACE, + MAP_FIXED_NOREPLACE, MAP_FIXED_NOREPLACE }, + { TARGET_MAP_UNINITIALIZED, TARGET_MAP_UNINITIALIZED, + MAP_UNINITIALIZED, MAP_UNINITIALIZED }, { 0, 0, 0, 0 } };
Signature · 1 line
2.34.1
[PULL 25/37] target/arm: Use aesenc_SB_SR_AK
In reply to Richard HendersonThis implements the AESE instruction.
--- target/arm/tcg/crypto_helper.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-)
target/arm/tcg/crypto_helper.c +23 -1
@@ -15,6 +15,7 @@#include "exec/helper-proto.h" #include "tcg/tcg-gvec-desc.h" #include "crypto/aes.h" +#include "crypto/aes-round.h" #include "crypto/sm4.h" #include "vec_internal.h"
@@ -45,6 +46,8 @@ static void clear_tail_16(void *vd, uint32_t desc)clear_tail (vd, opr_sz, max_sz); } +static const AESState aes_zero = { }; +static void do_crypto_aese (uint64_t *rd,uint64_t *rn,uint64_t *rm,const uint8_t *sbox,const uint8_t *shift) {
@@ -70,7 +73,26 @@ void HELPER(crypto_aese)(void *vd, void *vn, void *vm, uint32_t desc)intptr_t i, opr_sz =simd_oprsz (desc);for (i =0 ; i < opr_sz; i +=16 ) { -do_crypto_aese (vd + i, vn + i, vm + i, AES_sbox, AES_shifts); +AESState *ad = (AESState *)(vd + i); +AESState *st = (AESState *)(vn + i); +AESState *rk = (AESState *)(vm + i); +AESState t; + +/* +* Our uint64_t are in the wrong order for big-endian. +* The Arm AddRoundKey comes first, while the API AddRoundKey +* comes last: perform the xor here, and provide zero to API. +*/ +if (HOST_BIG_ENDIAN ) { + t.d[0 ] = st->d[1 ] ^ rk->d[1 ]; + t.d[1 ] = st->d[0 ] ^ rk->d[0 ]; +aesenc_SB_SR_AK (&t, &t, &aes_zero, false); + ad->d[0 ] = t.d[1 ]; + ad->d[1 ] = t.d[0 ]; + }else { + t.v = st->v ^ rk->v; +aesenc_SB_SR_AK (ad, &t, &aes_zero, false); + } }clear_tail (vd, opr_sz,simd_maxsz (desc)); }
Signature · 1 line
2.34.1
PATCH 26/45 accel/tcg: Introduce page_check_range_empty
In reply to Richard HendersonExamine the interval tree to validate that a region has no existing mappings.
Message-Id: <[email protected]>
--- include/exec/cpu-all.h | 12 ++++++++++++ accel/tcg/user-exec.c | 7 +++++++ 2 files changed, 19 insertions(+)
include/exec/cpu-all.h +12 -0
@@ -224,6 +224,18 @@ void page_set_flags(target_ulong start, target_ulong last, int flags);void page_reset_target_data (target_ulong start,target_ulong last);int page_check_range (target_ulong start,target_ulong len,int flags); +/** +* page_check_range_empty: +* @start: first byte of range +* @last: last byte of range +* Context: holding mmap lock +* +* Return true if the entire range [@start, @last] is unmapped. +* The memory lock must be held so that the caller will can ensure +* the result stays true until a new mapping can be installed. +*/ +bool page_check_range_empty (target_ulong start,target_ulong last); +/** * page_get_target_data(address) * @address: guest virtual address
accel/tcg/user-exec.c +7 -0
@@ -598,6 +598,13 @@ int page_check_range(target_ulong start, target_ulong len, int flags)return ret; } +bool page_check_range_empty (target_ulong start,target_ulong last) +{ +assert (last >= start); +assert_memory_lock (); +return pageflags_find (start, last) ==NULL ; +} +void page_protect (tb_page_addr_t address) {PageFlagsNode *p;
Signature · 1 line
2.34.1
[PULL 33/37] target/riscv: Use aesdec_ISB_ISR_IMC_AK
In reply to Richard HendersonThis implements the AES64DSM instruction. This was the last use of aes64_operation and its support macros, so remove them all.
--- target/riscv/crypto_helper.c | 101 ++++------------------------------- 1 file changed, 10 insertions(+), 91 deletions(-)
target/riscv/crypto_helper.c +10 -91
@@ -104,98 +104,8 @@ target_ulong HELPER(aes32dsi)(target_ulong rs1, target_ulong rs2,return aes32_operation (shamt, rs1, rs2, false, false); } -#define BY (X ,I ) ((X >> (8 * I)) & 0xFF) - -#define AES_SHIFROWS_LO (RS1 ,RS2 ) ( \ - (((RS1 >> 24) & 0xFF) << 56) | (((RS2 >> 48) & 0xFF) << 48) | \ - (((RS2 >> 8) & 0xFF) << 40) | (((RS1 >> 32) & 0xFF) << 32) | \ - (((RS2 >> 56) & 0xFF) << 24) | (((RS2 >> 16) & 0xFF) << 16) | \ - (((RS1 >> 40) & 0xFF) << 8) | (((RS1 >> 0) & 0xFF) << 0)) - -#define AES_INVSHIFROWS_LO (RS1 ,RS2 ) ( \ - (((RS2 >> 24) & 0xFF) << 56) | (((RS2 >> 48) & 0xFF) << 48) | \ - (((RS1 >> 8) & 0xFF) << 40) | (((RS1 >> 32) & 0xFF) << 32) | \ - (((RS1 >> 56) & 0xFF) << 24) | (((RS2 >> 16) & 0xFF) << 16) | \ - (((RS2 >> 40) & 0xFF) << 8) | (((RS1 >> 0) & 0xFF) << 0)) - -#define AES_MIXBYTE (COL ,B0 ,B1 ,B2 ,B3 ) ( \ - BY(COL, B3) ^ BY(COL, B2) ^ AES_GFMUL(BY(COL, B1), 3) ^ \ - AES_GFMUL(BY(COL, B0), 2)) - -#define AES_MIXCOLUMN (COL ) ( \ - AES_MIXBYTE(COL, 3, 0, 1, 2) << 24 | \ - AES_MIXBYTE(COL, 2, 3, 0, 1) << 16 | \ - AES_MIXBYTE(COL, 1, 2, 3, 0) << 8 | AES_MIXBYTE(COL, 0, 1, 2, 3) << 0) - -#define AES_INVMIXBYTE (COL ,B0 ,B1 ,B2 ,B3 ) ( \ - AES_GFMUL(BY(COL, B3), 0x9) ^ AES_GFMUL(BY(COL, B2), 0xd) ^ \ - AES_GFMUL(BY(COL, B1), 0xb) ^ AES_GFMUL(BY(COL, B0), 0xe)) - -#define AES_INVMIXCOLUMN (COL ) ( \ - AES_INVMIXBYTE(COL, 3, 0, 1, 2) << 24 | \ - AES_INVMIXBYTE(COL, 2, 3, 0, 1) << 16 | \ - AES_INVMIXBYTE(COL, 1, 2, 3, 0) << 8 | \ - AES_INVMIXBYTE(COL, 0, 1, 2, 3) << 0) -static const AESState aes_zero = { }; -static inline target_ulong aes64_operation (target_ulong rs1,target_ulong rs2, -bool enc,bool mix) -{ -uint64_t RS1 = rs1; -uint64_t RS2 = rs2; -uint64_t result; -uint64_t temp; -uint32_t col_0; -uint32_t col_1; - -if (enc) { - temp =AES_SHIFROWS_LO (RS1 ,RS2 ); - temp = (((uint64_t )AES_sbox[(temp >>0 ) &0xFF ] <<0 ) | - ((uint64_t )AES_sbox[(temp >>8 ) &0xFF ] <<8 ) | - ((uint64_t )AES_sbox[(temp >>16 ) &0xFF ] <<16 ) | - ((uint64_t )AES_sbox[(temp >>24 ) &0xFF ] <<24 ) | - ((uint64_t )AES_sbox[(temp >>32 ) &0xFF ] <<32 ) | - ((uint64_t )AES_sbox[(temp >>40 ) &0xFF ] <<40 ) | - ((uint64_t )AES_sbox[(temp >>48 ) &0xFF ] <<48 ) | - ((uint64_t )AES_sbox[(temp >>56 ) &0xFF ] <<56 )); -if (mix) { - col_0 = temp &0xFFFFFFFF ; - col_1 = temp >>32 ; - - col_0 =AES_MIXCOLUMN (col_0); - col_1 =AES_MIXCOLUMN (col_1); - - result = ((uint64_t )col_1 <<32 ) | col_0; - }else { - result = temp; - } - }else { - temp =AES_INVSHIFROWS_LO (RS1 ,RS2 ); - temp = (((uint64_t )AES_isbox[(temp >>0 ) &0xFF ] <<0 ) | - ((uint64_t )AES_isbox[(temp >>8 ) &0xFF ] <<8 ) | - ((uint64_t )AES_isbox[(temp >>16 ) &0xFF ] <<16 ) | - ((uint64_t )AES_isbox[(temp >>24 ) &0xFF ] <<24 ) | - ((uint64_t )AES_isbox[(temp >>32 ) &0xFF ] <<32 ) | - ((uint64_t )AES_isbox[(temp >>40 ) &0xFF ] <<40 ) | - ((uint64_t )AES_isbox[(temp >>48 ) &0xFF ] <<48 ) | - ((uint64_t )AES_isbox[(temp >>56 ) &0xFF ] <<56 )); -if (mix) { - col_0 = temp &0xFFFFFFFF ; - col_1 = temp >>32 ; - - col_0 =AES_INVMIXCOLUMN (col_0); - col_1 =AES_INVMIXCOLUMN (col_1); - - result = ((uint64_t )col_1 <<32 ) | col_0; - }else { - result = temp; - } - } - -return result; -} -target_ulong HELPER (aes64esm )(target_ulong rs1,target_ulong rs2) {AESState t;
@@ -228,7 +138,16 @@ target_ulong HELPER(aes64ds)(target_ulong rs1, target_ulong rs2)target_ulong HELPER (aes64dsm )(target_ulong rs1,target_ulong rs2) { -return aes64_operation (rs1, rs2, false, true); +AESState t, z = { }; + +/* +* This instruction does not include a round key, +* so supply a zero to our primitive. +*/ + t.d[HOST_BIG_ENDIAN ] = rs1; + t.d[!HOST_BIG_ENDIAN ] = rs2; +aesdec_ISB_ISR_IMC_AK (&t, &t, &z, false); +return t.d[HOST_BIG_ENDIAN ]; }target_ulong HELPER (aes64ks2 )(target_ulong rs1,target_ulong rs2)
Signature · 1 line
2.34.1
PATCH 27/45 bsd-user: Use page_check_range_empty for MAP_EXCL
In reply to Richard HendersonThe previous check returned -1 when any page within [start, start+len) is unmapped, not when all are unmapped.
Message-Id: <[email protected]>
--- bsd-user/mmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
bsd-user/mmap.c +1 -1
@@ -609,7 +609,7 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int prot, }/* Reject the mapping if any page within the range is mapped */ -if ((flags &MAP_EXCL ) &&page_check_range (start, len,0 ) <0 ) { +if ((flags &MAP_EXCL ) && !page_check_range_empty (start, end -1 )) { errno =EINVAL ; goto fail; }
Signature · 1 line
2.34.1
[PULL 31/37] target/riscv: Use aesdec_IMC
In reply to Richard HendersonThis implements the AES64IM instruction.
--- target/riscv/crypto_helper.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-)
target/riscv/crypto_helper.c +5 -10
@@ -272,17 +272,12 @@ target_ulong HELPER(aes64ks1i)(target_ulong rs1, target_ulong rnum)target_ulong HELPER (aes64im )(target_ulong rs1) { -uint64_t RS1 = rs1; -uint32_t col_0 =RS1 &0xFFFFFFFF ; -uint32_t col_1 =RS1 >>32 ; -target_ulong result; +AESState t; - col_0 =AES_INVMIXCOLUMN (col_0); - col_1 =AES_INVMIXCOLUMN (col_1); - - result = ((uint64_t )col_1 <<32 ) | col_0; - -return result; + t.d[HOST_BIG_ENDIAN ] = rs1; + t.d[!HOST_BIG_ENDIAN ] =0 ; +aesdec_IMC (&t, &t, false); +return t.d[HOST_BIG_ENDIAN ]; } target_ulong HELPER(sm4ed)(target_ulong rs1, target_ulong rs2,
Signature · 1 line
2.34.1
[PULL 27/37] target/arm: Use aesenc_MC
In reply to Richard HendersonThis implements the AESMC instruction.
--- target/arm/tcg/crypto_helper.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)
target/arm/tcg/crypto_helper.c +14 -1
@@ -124,7 +124,20 @@ void HELPER(crypto_aesmc)(void *vd, void *vm, uint32_t desc)intptr_t i, opr_sz =simd_oprsz (desc);for (i =0 ; i < opr_sz; i +=16 ) { -do_crypto_aesmc (vd + i, vm + i, AES_mc_rot); +AESState *ad = (AESState *)(vd + i); +AESState *st = (AESState *)(vm + i); +AESState t; + +/* Our uint64_t are in the wrong order for big-endian. */ +if (HOST_BIG_ENDIAN ) { + t.d[0 ] = st->d[1 ]; + t.d[1 ] = st->d[0 ]; +aesenc_MC (&t, &t, false); + ad->d[0 ] = t.d[1 ]; + ad->d[1 ] = t.d[0 ]; + }else { +aesenc_MC (ad, st, false); + } }clear_tail (vd, opr_sz,simd_maxsz (desc)); }
Signature · 1 line
2.34.1
PATCH 28/45 linux-user: Implement MAP_FIXED_NOREPLACE
In reply to Richard HendersonMessage-Id: <[email protected]>
--- linux-user/mmap.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
linux-user/mmap.c +11 -3
@@ -509,7 +509,7 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int target_prot,* If the user is asking for the kernel to find a location, do that * before we truncate the length for mapping files below. */ -if (!(flags &MAP_FIXED )) { +if (!(flags & (MAP_FIXED |MAP_FIXED_NOREPLACE ))) { host_len = len + offset - host_offset; host_len =HOST_PAGE_ALIGN (host_len); start =mmap_find_vma (real_start, host_len,TARGET_PAGE_SIZE );
@@ -551,7 +551,7 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int target_prot, } } -if (!(flags &MAP_FIXED )) { +if (!(flags & (MAP_FIXED |MAP_FIXED_NOREPLACE ))) {unsigned long host_start;void *p;
@@ -600,6 +600,13 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int target_prot, goto fail; } +/* Validate that the chosen range is empty. */ +if ((flags &MAP_FIXED_NOREPLACE ) + && !page_check_range_empty (start, end -1 )) { + errno =EEXIST ; + goto fail; + } +/* * worst case: we cannot map the file because the offset is not * aligned, so we read it
@@ -615,7 +622,8 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int target_prot, goto fail; } retaddr =target_mmap (start, len, target_prot |PROT_WRITE , -MAP_FIXED |MAP_PRIVATE |MAP_ANONYMOUS , + (flags & (MAP_FIXED |MAP_FIXED_NOREPLACE )) + |MAP_PRIVATE |MAP_ANONYMOUS ,-1 ,0 );if (retaddr ==-1 ) { goto fail;
Signature · 1 line
2.34.1
PATCH 29/45 linux-user: Split out target_to_host_prot
In reply to Richard HendersonSplit 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.
Message-Id: <[email protected]>
--- linux-user/mmap.c | 78 ++++++++++++++++++++++++++--------------------- 1 file changed, 44 insertions(+), 34 deletions(-)
linux-user/mmap.c +44 -34
@@ -69,24 +69,11 @@ void mmap_fork_end(int child)* Return 0 if the target prot bitmask is invalid, otherwise * the internal qemu page_flags (which will include PAGE_VALID). */ -static int validate_prot_to_pageflags (int *host_prot,int prot) +static int validate_prot_to_pageflags (int prot) {int valid =PROT_READ |PROT_WRITE |PROT_EXEC |TARGET_PROT_SEM ;int page_flags = (prot &PAGE_BITS ) |PAGE_VALID ; -/* -* For the host, we need not pass anything except read/write/exec. -* While PROT_SEM is allowed by all hosts, it is also ignored, so -* don't bother transforming guest bit to host bit. Any other -* target-specific prot bits will not be understood by the host -* and will need to be encoded into page_flags for qemu emulation. -* -* Pages that are executable by the guest will never be executed -* by the host, but the host will need to be able to read them. -*/ - *host_prot = (prot & (PROT_READ |PROT_WRITE )) - | (prot &PROT_EXEC ?PROT_READ :0 ); -#ifdef TARGET_AARCH64 {ARMCPU *cpu =ARM_CPU (thread_cpu);
@@ -114,18 +101,34 @@ static int validate_prot_to_pageflags(int *host_prot, int prot)return prot & ~valid ?0 : page_flags; } +/* +* For the host, we need not pass anything except read/write/exec. +* While PROT_SEM is allowed by all hosts, it is also ignored, so +* don't bother transforming guest bit to host bit. Any other +* target-specific prot bits will not be understood by the host +* and will need to be encoded into page_flags for qemu emulation. +* +* Pages that are executable by the guest will never be executed +* by the host, but the host will need to be able to read them. +*/ +static int target_to_host_prot (int prot) +{ +return (prot & (PROT_READ |PROT_WRITE )) | + (prot &PROT_EXEC ?PROT_READ :0 ); +} +/* NOTE: all the constants are the HOST ones, but addresses are target. */ int target_mprotect (abi_ulong start,abi_ulong len,int target_prot) {abi_ulong end, host_start, host_end, addr; -int prot1, ret, page_flags, host_prot; +int prot1, ret, page_flags;trace_target_mprotect (start, len, target_prot);if ((start & ~TARGET_PAGE_MASK ) !=0 ) {return -TARGET_EINVAL ; } - page_flags =validate_prot_to_pageflags (&host_prot, target_prot); + page_flags =validate_prot_to_pageflags (target_prot);if (!page_flags) {return -TARGET_EINVAL ; }
@@ -143,7 +146,7 @@ int target_mprotect(abi_ulong start, abi_ulong len, int target_prot) host_end =HOST_PAGE_ALIGN (end);if (start > host_start) {/* handle host page containing start */ - prot1 = host_prot; + prot1 = target_prot;for (addr = host_start; addr < start; addr +=TARGET_PAGE_SIZE ) { prot1 |=page_get_flags (addr); }
@@ -154,19 +157,19 @@ int target_mprotect(abi_ulong start, abi_ulong len, int target_prot) end = host_end; } ret =mprotect (g2h_untagged (host_start), qemu_host_page_size, - prot1 &PAGE_BITS ); +target_to_host_prot (prot1));if (ret !=0 ) { goto error; } host_start += qemu_host_page_size; }if (end < host_end) { - prot1 = host_prot; + prot1 = target_prot;for (addr = end; addr < host_end; addr +=TARGET_PAGE_SIZE ) { prot1 |=page_get_flags (addr); } ret =mprotect (g2h_untagged (host_end - qemu_host_page_size), - qemu_host_page_size, prot1 &PAGE_BITS ); + qemu_host_page_size,target_to_host_prot (prot1));if (ret !=0 ) { goto error; }
@@ -175,8 +178,8 @@ int target_mprotect(abi_ulong start, abi_ulong len, int target_prot)/* handle the pages in the middle */ if (host_start < host_end) { - ret =mprotect (g2h_untagged (host_start), - host_end - host_start, host_prot); + ret =mprotect (g2h_untagged (host_start), host_end - host_start, +target_to_host_prot (target_prot));if (ret !=0 ) { goto error; }
@@ -212,7 +215,8 @@ static int mmap_frag(abi_ulong real_start,if (prot1 ==0 ) {/* no page was there, so we allocate one */ -void *p =mmap (host_start, qemu_host_page_size, prot, +void *p =mmap (host_start, qemu_host_page_size, +target_to_host_prot (prot), flags |MAP_ANONYMOUS ,-1 ,0 );if (p ==MAP_FAILED ) {return -1 ;
@@ -233,7 +237,8 @@ static int mmap_frag(abi_ulong real_start,/* adjust protection to be able to read */ if (!(prot1 &PROT_WRITE )) { -mprotect (host_start, qemu_host_page_size, prot1 |PROT_WRITE ); +mprotect (host_start, qemu_host_page_size, +target_to_host_prot (prot1) |PROT_WRITE ); }/* read the corresponding file data */
@@ -243,11 +248,13 @@ static int mmap_frag(abi_ulong real_start,/* put final protection */ if (prot_new != (prot1 |PROT_WRITE )) { -mprotect (host_start, qemu_host_page_size, prot_new); +mprotect (host_start, qemu_host_page_size, +target_to_host_prot (prot_new)); } }else {if (prot_new != prot1) { -mprotect (host_start, qemu_host_page_size, prot_new); +mprotect (host_start, qemu_host_page_size, +target_to_host_prot (prot_new)); }if (prot_new &PROT_WRITE ) {memset (g2h_untagged (start),0 , end - start);
@@ -460,7 +467,7 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int target_prot, {abi_ulong ret, end, real_start, real_end, retaddr, host_offset, host_len, passthrough_start =-1 , passthrough_end =-1 ; -int page_flags, host_prot; +int page_flags;mmap_lock ();trace_target_mmap (start, len, target_prot, flags, fd, offset);
@@ -470,7 +477,7 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int target_prot, goto fail; } - page_flags =validate_prot_to_pageflags (&host_prot, target_prot); + page_flags =validate_prot_to_pageflags (target_prot);if (!page_flags) { errno =EINVAL ; goto fail;
@@ -553,10 +560,12 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int target_prot,if (!(flags & (MAP_FIXED |MAP_FIXED_NOREPLACE ))) {unsigned long host_start; +int host_prot;void *p; host_len = len + offset - host_offset; host_len =HOST_PAGE_ALIGN (host_len); + host_prot =target_to_host_prot (target_prot);/* * Note: we prefer to control the mapping address. It is
@@ -617,7 +626,8 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int target_prot,* msync() won't work here, so we return an error if write is * possible while it is a shared mapping */ -if ((flags &MAP_TYPE ) ==MAP_SHARED && (host_prot &PROT_WRITE )) { +if ((flags &MAP_TYPE ) ==MAP_SHARED + && (target_prot &PROT_WRITE )) { errno =EINVAL ; goto fail; }
@@ -631,7 +641,7 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int target_prot,if (pread (fd,g2h_untagged (start), len, offset) ==-1 ) { goto fail; } -if (!(host_prot &PROT_WRITE )) { +if (!(target_prot &PROT_WRITE )) { ret =target_mprotect (start, len, target_prot);assert (ret ==0 ); }
@@ -643,14 +653,14 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int target_prot,if (real_end == real_start + qemu_host_page_size) {/* one single host page */ ret =mmap_frag (real_start, start, end, - host_prot, flags, fd, offset); + target_prot, flags, fd, offset);if (ret ==-1 ) { goto fail; } goto the_end1; } ret =mmap_frag (real_start, start, real_start + qemu_host_page_size, - host_prot, flags, fd, offset); + target_prot, flags, fd, offset);if (ret ==-1 ) { goto fail; }
@@ -660,7 +670,7 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int target_prot,if (end < real_end) { ret =mmap_frag (real_end - qemu_host_page_size, real_end - qemu_host_page_size, end, - host_prot, flags, fd, + target_prot, flags, fd, offset + real_end - qemu_host_page_size - start);if (ret ==-1 ) { goto fail;
@@ -678,7 +688,7 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int target_prot, offset1 = offset + real_start - start; } p =mmap (g2h_untagged (real_start), real_end - real_start, - host_prot, flags, fd, offset1); +target_to_host_prot (target_prot), flags, fd, offset1);if (p ==MAP_FAILED ) { goto fail; }
Signature · 1 line
2.34.1
[PULL 37/37] crypto: Unexport AES_*_rot, AES_TeN, AES_TdN
In reply to Richard HendersonThese arrays are no longer used outside of aes.c.
--- include/crypto/aes.h | 25 ------------------------- crypto/aes.c | 33 +++++++++++++++++++++------------ 2 files changed, 21 insertions(+), 37 deletions(-)
include/crypto/aes.h +0 -25
@@ -30,29 +30,4 @@ void AES_decrypt(const unsigned char *in, unsigned char *out,extern const uint8_t AES_sbox[256 ];extern const uint8_t AES_isbox[256 ]; -/* AES MixColumns, for use with rot32. */ -extern const uint32_t AES_mc_rot[256 ]; - -/* AES InvMixColumns, for use with rot32. */ -extern const uint32_t AES_imc_rot[256 ]; - -/* -AES_Te0[x] = S [x].[02, 01, 01, 03]; -AES_Te1[x] = S [x].[03, 02, 01, 01]; -AES_Te2[x] = S [x].[01, 03, 02, 01]; -AES_Te3[x] = S [x].[01, 01, 03, 02]; -AES_Te4[x] = S [x].[01, 01, 01, 01]; - -AES_Td0[x] = Si[x].[0e, 09, 0d, 0b]; -AES_Td1[x] = Si[x].[0b, 0e, 09, 0d]; -AES_Td2[x] = Si[x].[0d, 0b, 0e, 09]; -AES_Td3[x] = Si[x].[09, 0d, 0b, 0e]; -AES_Td4[x] = Si[x].[01, 01, 01, 01]; -*/ - -extern const uint32_t AES_Te0[256 ], AES_Te1[256 ], AES_Te2[256 ], - AES_Te3[256 ], AES_Te4[256 ]; -extern const uint32_t AES_Td0[256 ], AES_Td1[256 ], AES_Td2[256 ], - AES_Td3[256 ], AES_Td4[256 ]; -#endif
crypto/aes.c +21 -12
@@ -120,7 +120,7 @@ const uint8_t AES_isbox[256] = {/* * MixColumns lookup table, for use with rot32. */ -const uint32_t AES_mc_rot[256 ] = { +static const uint32_t AES_mc_rot[256 ] = {0x00000000 ,0x03010102 ,0x06020204 ,0x05030306 ,0x0c040408 ,0x0f05050a ,0x0a06060c ,0x0907070e ,0x18080810 ,0x1b090912 ,0x1e0a0a14 ,0x1d0b0b16 ,
@@ -190,7 +190,7 @@ const uint32_t AES_mc_rot[256] = {/* * Inverse MixColumns lookup table, for use with rot32. */ -const uint32_t AES_imc_rot[256 ] = { +static const uint32_t AES_imc_rot[256 ] = {0x00000000 ,0x0b0d090e ,0x161a121c ,0x1d171b12 ,0x2c342438 ,0x27392d36 ,0x3a2e3624 ,0x31233f2a ,0x58684870 ,0x5365417e ,0x4e725a6c ,0x457f5362 ,
@@ -272,7 +272,7 @@ AES_Td3[x] = Si[x].[09, 0d, 0b, 0e];AES_Td4[x] = Si[x].[01, 01, 01, 01]; */ -const uint32_t AES_Te0[256 ] = { +static const uint32_t AES_Te0[256 ] = {0xc66363a5U ,0xf87c7c84U ,0xee777799U ,0xf67b7b8dU ,0xfff2f20dU ,0xd66b6bbdU ,0xde6f6fb1U ,0x91c5c554U ,0x60303050U ,0x02010103U ,0xce6767a9U ,0x562b2b7dU ,
@@ -338,7 +338,8 @@ const uint32_t AES_Te0[256] = {0x824141c3U ,0x299999b0U ,0x5a2d2d77U ,0x1e0f0f11U , 0x7bb0b0cbU, 0xa85454fcU, 0x6dbbbbd6U, 0x2c16163aU, }; -const uint32_t AES_Te1[256 ] = { + +static const uint32_t AES_Te1[256 ] = {0xa5c66363U ,0x84f87c7cU ,0x99ee7777U ,0x8df67b7bU ,0x0dfff2f2U ,0xbdd66b6bU ,0xb1de6f6fU ,0x5491c5c5U , 0x50603030U, 0x03020101U, 0xa9ce6767U, 0x7d562b2bU,
@@ -404,7 +405,8 @@ const uint32_t AES_Te1[256] = {0xc3824141U ,0xb0299999U ,0x775a2d2dU ,0x111e0f0fU , 0xcb7bb0b0U, 0xfca85454U, 0xd66dbbbbU, 0x3a2c1616U, }; -const uint32_t AES_Te2[256 ] = { + +static const uint32_t AES_Te2[256 ] = {0x63a5c663U ,0x7c84f87cU ,0x7799ee77U ,0x7b8df67bU ,0xf20dfff2U ,0x6bbdd66bU ,0x6fb1de6fU ,0xc55491c5U , 0x30506030U, 0x01030201U, 0x67a9ce67U, 0x2b7d562bU,
@@ -470,8 +472,8 @@ const uint32_t AES_Te2[256] = {0x41c38241U ,0x99b02999U ,0x2d775a2dU ,0x0f111e0fU , 0xb0cb7bb0U, 0x54fca854U, 0xbbd66dbbU, 0x163a2c16U, }; -const uint32_t AES_Te3[256 ] = { +static const uint32_t AES_Te3[256 ] = {0x6363a5c6U ,0x7c7c84f8U ,0x777799eeU ,0x7b7b8df6U ,0xf2f20dffU ,0x6b6bbdd6U ,0x6f6fb1deU ,0xc5c55491U , 0x30305060U, 0x01010302U, 0x6767a9ceU, 0x2b2b7d56U,
@@ -537,7 +539,8 @@ const uint32_t AES_Te3[256] = {0x4141c382U ,0x9999b029U ,0x2d2d775aU ,0x0f0f111eU , 0xb0b0cb7bU, 0x5454fca8U, 0xbbbbd66dU, 0x16163a2cU, }; -const uint32_t AES_Te4[256 ] = { + +static const uint32_t AES_Te4[256 ] = {0x63636363U ,0x7c7c7c7cU ,0x77777777U ,0x7b7b7b7bU ,0xf2f2f2f2U ,0x6b6b6b6bU ,0x6f6f6f6fU ,0xc5c5c5c5U , 0x30303030U, 0x01010101U, 0x67676767U, 0x2b2b2b2bU,
@@ -603,7 +606,8 @@ const uint32_t AES_Te4[256] = {0x41414141U ,0x99999999U ,0x2d2d2d2dU ,0x0f0f0f0fU , 0xb0b0b0b0U, 0x54545454U, 0xbbbbbbbbU, 0x16161616U, }; -const uint32_t AES_Td0[256 ] = { + +static const uint32_t AES_Td0[256 ] = {0x51f4a750U ,0x7e416553U ,0x1a17a4c3U ,0x3a275e96U ,0x3bab6bcbU ,0x1f9d45f1U ,0xacfa58abU ,0x4be30393U , 0x2030fa55U, 0xad766df6U, 0x88cc7691U, 0xf5024c25U,
@@ -669,7 +673,8 @@ const uint32_t AES_Td0[256] = {0x39a80171U ,0x080cb3deU ,0xd8b4e49cU ,0x6456c190U , 0x7bcb8461U, 0xd532b670U, 0x486c5c74U, 0xd0b85742U, }; -const uint32_t AES_Td1[256 ] = { + +static const uint32_t AES_Td1[256 ] = {0x5051f4a7U ,0x537e4165U ,0xc31a17a4U ,0x963a275eU ,0xcb3bab6bU ,0xf11f9d45U ,0xabacfa58U ,0x934be303U , 0x552030faU, 0xf6ad766dU, 0x9188cc76U, 0x25f5024cU,
@@ -735,7 +740,8 @@ const uint32_t AES_Td1[256] = {0x7139a801U ,0xde080cb3U ,0x9cd8b4e4U ,0x906456c1U , 0x617bcb84U, 0x70d532b6U, 0x74486c5cU, 0x42d0b857U, }; -const uint32_t AES_Td2[256 ] = { + +static const uint32_t AES_Td2[256 ] = {0xa75051f4U ,0x65537e41U ,0xa4c31a17U ,0x5e963a27U ,0x6bcb3babU ,0x45f11f9dU ,0x58abacfaU ,0x03934be3U , 0xfa552030U, 0x6df6ad76U, 0x769188ccU, 0x4c25f502U,
@@ -802,7 +808,8 @@ const uint32_t AES_Td2[256] = {0x017139a8U ,0xb3de080cU ,0xe49cd8b4U ,0xc1906456U , 0x84617bcbU, 0xb670d532U, 0x5c74486cU, 0x5742d0b8U, }; -const uint32_t AES_Td3[256 ] = { + +static const uint32_t AES_Td3[256 ] = {0xf4a75051U ,0x4165537eU ,0x17a4c31aU ,0x275e963aU ,0xab6bcb3bU ,0x9d45f11fU ,0xfa58abacU ,0xe303934bU , 0x30fa5520U, 0x766df6adU, 0xcc769188U, 0x024c25f5U,
@@ -868,7 +875,8 @@ const uint32_t AES_Td3[256] = {0xa8017139U ,0x0cb3de08U ,0xb4e49cd8U ,0x56c19064U , 0xcb84617bU, 0x32b670d5U, 0x6c5c7448U, 0xb85742d0U, }; -const uint32_t AES_Td4[256 ] = { + +static const uint32_t AES_Td4[256 ] = {0x52525252U ,0x09090909U ,0x6a6a6a6aU ,0xd5d5d5d5U ,0x30303030U ,0x36363636U ,0xa5a5a5a5U ,0x38383838U , 0xbfbfbfbfU, 0x40404040U, 0xa3a3a3a3U, 0x9e9e9e9eU,
@@ -934,6 +942,7 @@ const uint32_t AES_Td4[256] = {0xe1e1e1e1U ,0x69696969U ,0x14141414U ,0x63636363U , 0x55555555U, 0x21212121U, 0x0c0c0c0cU, 0x7d7d7d7dU, }; +static const u32 rcon[] = {0x01000000 ,0x02000000 ,0x04000000 ,0x08000000 , 0x10000000, 0x20000000, 0x40000000, 0x80000000,
Signature · 1 line
2.34.1
PATCH 30/45 linux-user: Widen target_mmap offset argument to off_t
In reply to Richard HendersonWe build with _FILE_OFFSET_BITS=64, so off_t = off64_t = uint64_t. With an extra cast, this fixes emulation of mmap2, which could overflow the computation of the full value of offset.
Message-Id: <[email protected]>
--- linux-user/user-mmap.h | 2 +- linux-user/mmap.c | 14 ++++++++------ linux-user/syscall.c | 2 +- 3 files changed, 10 insertions(+), 8 deletions(-)
linux-user/user-mmap.h +1 -1
@@ -20,7 +20,7 @@int target_mprotect (abi_ulong start,abi_ulong len,int prot);abi_long target_mmap (abi_ulong start,abi_ulong len,int prot, -int flags,int fd,abi_ulong offset); +int flags,int fd,off_t offset);int target_munmap (abi_ulong start,abi_ulong len); abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size, abi_ulong new_size, unsigned long flags,
linux-user/mmap.c +8 -6
@@ -196,7 +196,7 @@ error:/* map an incomplete host page */ static int mmap_frag (abi_ulong real_start,abi_ulong start,abi_ulong end, -int prot,int flags,int fd,abi_ulong offset) +int prot,int flags,int fd,off_t offset) {abi_ulong real_end, addr;void *host_start;
@@ -463,11 +463,12 @@ abi_ulong mmap_find_vma(abi_ulong start, abi_ulong size, abi_ulong align)/* NOTE: all the constants are the HOST ones */ abi_long target_mmap (abi_ulong start,abi_ulong len,int target_prot, -int flags,int fd,abi_ulong offset) +int flags,int fd,off_t offset) { -abi_ulong ret, end, real_start, real_end, retaddr, host_offset, host_len, +abi_ulong ret, end, real_start, real_end, retaddr, host_len, passthrough_start =-1 , passthrough_end =-1 ;int page_flags; +off_t host_offset;mmap_lock ();trace_target_mmap (start, len, target_prot, flags, fd, offset);
@@ -559,7 +560,7 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int target_prot, }if (!(flags & (MAP_FIXED |MAP_FIXED_NOREPLACE ))) { -unsigned long host_start; +uintptr_t host_start;int host_prot;void *p;
@@ -578,7 +579,7 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int target_prot, goto fail; }/* update start so that it points to the file position at 'offset' */ - host_start = (unsigned long )p; + host_start = (uintptr_t )p;if (!(flags &MAP_ANONYMOUS )) { p =mmap (g2h_untagged (start), len, host_prot, flags |MAP_FIXED , fd, host_offset);
@@ -681,7 +682,8 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int target_prot,/* map the middle (easier) */ if (real_start < real_end) {void *p; -unsigned long offset1; +off_t offset1; +if (flags &MAP_ANONYMOUS ) { offset1 =0 ; }else {
linux-user/syscall.c +1 -1
@@ -10436,7 +10436,7 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1,#endif ret =target_mmap (arg1, arg2, arg3,target_to_host_bitmask (arg4, mmap_flags_tbl), - arg5, arg6 <<MMAP_SHIFT ); + arg5, (off_t )(abi_ulong )arg6 <<MMAP_SHIFT );return get_errno (ret);#endif case TARGET_NR_munmap:
Signature · 1 line
2.34.1
[PULL 20/37] target/i386: Use aesdec_ISB_ISR_AK
In reply to Richard HendersonThis implements the AESDECLAST instruction.
--- target/i386/ops_sse.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
target/i386/ops_sse.h +5 -5
@@ -2177,12 +2177,12 @@ void glue(helper_aesdec, SUFFIX)(CPUX86State *env, Reg *d, Reg *v, Reg *s)void glue (helper_aesdeclast ,SUFFIX )(CPUX86State *env,Reg *d,Reg *v,Reg *s) { -int i; -Reg st = *v; -Reg rk = *s; +for (int i =0 ; i <SHIFT ; i++) { +AESState *ad = (AESState *)&d->ZMM_X (i); +AESState *st = (AESState *)&v->ZMM_X (i); +AESState *rk = (AESState *)&s->ZMM_X (i); -for (i =0 ; i <8 <<SHIFT ; i++) { - d->B (i) = rk.B (i) ^ (AES_isbox[st.B (AES_ishifts[i &15 ] + (i & ~15 ))]); +aesdec_ISB_ISR_AK (ad, st, rk, false); } }
Signature · 1 line
2.34.1
[PULL 22/37] target/i386: Use aesenc_SB_SR_MC_AK
In reply to Richard HendersonThis implements the AESENC instruction.
--- target/i386/ops_sse.h | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-)
target/i386/ops_sse.h +5 -9
@@ -2188,16 +2188,12 @@ void glue(helper_aesdeclast, SUFFIX)(CPUX86State *env, Reg *d, Reg *v, Reg *s)void glue (helper_aesenc ,SUFFIX )(CPUX86State *env,Reg *d,Reg *v,Reg *s) { -int i; -Reg st = *v; -Reg rk = *s; +for (int i =0 ; i <SHIFT ; i++) { +AESState *ad = (AESState *)&d->ZMM_X (i); +AESState *st = (AESState *)&v->ZMM_X (i); +AESState *rk = (AESState *)&s->ZMM_X (i); -for (i =0 ; i <2 <<SHIFT ; i++) { -int j = i &3 ; - d->L (i) = rk.L (i) ^bswap32 (AES_Te0[st.B (AES_shifts[4 * j +0 ])] ^ - AES_Te1[st.B (AES_shifts[4 * j +1 ])] ^ - AES_Te2[st.B (AES_shifts[4 * j +2 ])] ^ - AES_Te3[st.B (AES_shifts[4 * j +3 ])]); +aesenc_SB_SR_MC_AK (ad, st, rk, false); } }
Signature · 1 line
2.34.1
PATCH 31/45 linux-user: Rewrite target_mprotect
In reply to Richard HendersonUse '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.
Message-Id: <[email protected]>
--- linux-user/mmap.c | 106 +++++++++++++++++++++++++++++----------------- 1 file changed, 67 insertions(+), 39 deletions(-)
linux-user/mmap.c +67 -39
@@ -120,8 +120,11 @@ static int target_to_host_prot(int prot)/* NOTE: all the constants are the HOST ones, but addresses are target. */ int target_mprotect (abi_ulong start,abi_ulong len,int target_prot) { -abi_ulong end, host_start, host_end, addr; -int prot1, ret, page_flags; +abi_ulong starts[3 ]; +abi_ulong lens[3 ]; +int prots[3 ]; +abi_ulong host_start, host_last, last; +int prot1, ret, page_flags, nranges;trace_target_mprotect (start, len, target_prot);
@@ -132,63 +135,88 @@ int target_mprotect(abi_ulong start, abi_ulong len, int target_prot)if (!page_flags) {return -TARGET_EINVAL ; } - len =TARGET_PAGE_ALIGN (len); - end = start + len; -if (!guest_range_valid_untagged (start, len)) { -return -TARGET_ENOMEM ; - }if (len ==0 ) {return 0 ; } + len =TARGET_PAGE_ALIGN (len); +if (!guest_range_valid_untagged (start, len)) { +return -TARGET_ENOMEM ; + } + + last = start + len -1 ; + host_start = start & qemu_host_page_mask; + host_last =HOST_PAGE_ALIGN (last) -1 ; + nranges =0 ;mmap_lock (); - host_start = start & qemu_host_page_mask; - host_end =HOST_PAGE_ALIGN (end); -if (start > host_start) { -/* handle host page containing start */ + +if (host_last - host_start < qemu_host_page_size) { +/* Single host page contains all guest pages: sum the prot. */ prot1 = target_prot; -for (addr = host_start; addr < start; addr +=TARGET_PAGE_SIZE ) { - prot1 |=page_get_flags (addr); +for (abi_ulong a = host_start; a < start; a +=TARGET_PAGE_SIZE ) { + prot1 |=page_get_flags (a); } -if (host_end == host_start + qemu_host_page_size) { -for (addr = end; addr < host_end; addr +=TARGET_PAGE_SIZE ) { - prot1 |=page_get_flags (addr); +for (abi_ulong a = last; a < host_last; a +=TARGET_PAGE_SIZE ) { + prot1 |=page_get_flags (a +1 ); + } + starts[nranges] = host_start; + lens[nranges] = qemu_host_page_size; + prots[nranges] = prot1; + nranges++; + }else { +if (host_start < start) { +/* Host page contains more than one guest page: sum the prot. */ + prot1 = target_prot; +for (abi_ulong a = host_start; a < start; a +=TARGET_PAGE_SIZE ) { + prot1 |=page_get_flags (a); + } +/* If the resulting sum differs, create a new range. */ +if (prot1 != target_prot) { + starts[nranges] = host_start; + lens[nranges] = qemu_host_page_size; + prots[nranges] = prot1; + nranges++; + host_start += qemu_host_page_size; } - end = host_end; } - ret =mprotect (g2h_untagged (host_start), qemu_host_page_size, -target_to_host_prot (prot1)); -if (ret !=0 ) { - goto error; + +if (last < host_last) { +/* Host page contains more than one guest page: sum the prot. */ + prot1 = target_prot; +for (abi_ulong a = last; a < host_last; a +=TARGET_PAGE_SIZE ) { + prot1 |=page_get_flags (a +1 ); + } +/* If the resulting sum differs, create a new range. */ +if (prot1 != target_prot) { + host_last -= qemu_host_page_size; + starts[nranges] = host_last +1 ; + lens[nranges] = qemu_host_page_size; + prots[nranges] = prot1; + nranges++; + } } - host_start += qemu_host_page_size; - } -if (end < host_end) { - prot1 = target_prot; -for (addr = end; addr < host_end; addr +=TARGET_PAGE_SIZE ) { - prot1 |=page_get_flags (addr); + +/* Create a range for the middle, if any remains. */ +if (host_start < host_last) { + starts[nranges] = host_start; + lens[nranges] = host_last - host_start +1 ; + prots[nranges] = target_prot; + nranges++; } - ret =mprotect (g2h_untagged (host_end - qemu_host_page_size), - qemu_host_page_size,target_to_host_prot (prot1)); -if (ret !=0 ) { - goto error; - } - host_end -= qemu_host_page_size; } -/* handle the pages in the middle */ -if (host_start < host_end) { - ret =mprotect (g2h_untagged (host_start), host_end - host_start, -target_to_host_prot (target_prot)); +for (int i =0 ; i < nranges; ++i) { + ret =mprotect (g2h_untagged (starts[i]), lens[i], +target_to_host_prot (prots[i]));if (ret !=0 ) { goto error; } } -page_set_flags (start, start + len -1 , page_flags); +page_set_flags (start, last, page_flags); ret =0 ; -error: + error:mmap_unlock ();return ret; }
Signature · 1 line
2.34.1
PATCH 32/45 linux-user: Rewrite mmap_frag
In reply to Richard HendersonUse '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.
Message-Id: <[email protected]>
--- linux-user/mmap.c | 123 +++++++++++++++++++++++----------------------- 1 file changed, 62 insertions(+), 61 deletions(-)
linux-user/mmap.c +62 -61
@@ -222,73 +222,76 @@ int target_mprotect(abi_ulong start, abi_ulong len, int target_prot) }/* map an incomplete host page */ -static int mmap_frag (abi_ulong real_start, -abi_ulong start,abi_ulong end, -int prot,int flags,int fd,off_t offset) +static bool mmap_frag (abi_ulong real_start,abi_ulong start,abi_ulong last, +int prot,int flags,int fd,off_t offset) { -abi_ulong real_end, addr; +abi_ulong real_last;void *host_start; -int prot1, prot_new; +int prot_old, prot_new; +int host_prot_old, host_prot_new; - real_end = real_start + qemu_host_page_size; - host_start =g2h_untagged (real_start); - -/* get the protection of the target pages outside the mapping */ - prot1 =0 ; -for (addr = real_start; addr < real_end; addr++) { -if (addr < start || addr >= end) { - prot1 |=page_get_flags (addr); - } +if (!(flags &MAP_ANONYMOUS ) + && (flags &MAP_TYPE ) ==MAP_SHARED + && (prot &PROT_WRITE )) { +/* +* msync() won't work with the partial page, so we return an +* error if write is possible while it is a shared mapping. +*/ + errno =EINVAL ; +return false; } -if (prot1 ==0 ) { -/* no page was there, so we allocate one */ + real_last = real_start + qemu_host_page_size -1 ; + host_start =g2h_untagged (real_start); + +/* Get the protection of the target pages outside the mapping. */ + prot_old =0 ; +for (abi_ulong a = real_start; a < start; a +=TARGET_PAGE_SIZE ) { + prot_old |=page_get_flags (a); + } +for (abi_ulong a = real_last; a > last; a -=TARGET_PAGE_SIZE ) { + prot_old |=page_get_flags (a); + } + +if (prot_old ==0 ) { +/* +* Since !(prot_old & PAGE_VALID), there were no guest pages +* outside of the fragment we need to map. Allocate a new host +* page to cover, discarding whatever else may have been present. +*/ void *p =mmap (host_start, qemu_host_page_size,target_to_host_prot (prot), flags |MAP_ANONYMOUS ,-1 ,0 );if (p ==MAP_FAILED ) { -return -1 ; +return false; } - prot1 = prot; + prot_old = prot; } - prot1 &=PAGE_BITS ; + prot_new = prot | prot_old; - prot_new = prot | prot1; -if (!(flags &MAP_ANONYMOUS )) { -/* -* msync() won't work here, so we return an error if write is -* possible while it is a shared mapping. -*/ -if ((flags &MAP_TYPE ) ==MAP_SHARED && (prot &PROT_WRITE )) { -return -1 ; - } + host_prot_old =target_to_host_prot (prot_old); + host_prot_new =target_to_host_prot (prot_new); -/* adjust protection to be able to read */ -if (!(prot1 &PROT_WRITE )) { -mprotect (host_start, qemu_host_page_size, -target_to_host_prot (prot1) |PROT_WRITE ); - } +/* Adjust protection to be able to write. */ +if (!(host_prot_old &PROT_WRITE )) { + host_prot_old |=PROT_WRITE ; +mprotect (host_start, qemu_host_page_size, host_prot_old); + } -/* read the corresponding file data */ -if (pread (fd,g2h_untagged (start), end - start, offset) ==-1 ) { -return -1 ; - } - -/* put final protection */ -if (prot_new != (prot1 |PROT_WRITE )) { -mprotect (host_start, qemu_host_page_size, -target_to_host_prot (prot_new)); - } +/* Read or zero the new guest pages. */ +if (flags &MAP_ANONYMOUS ) { +memset (g2h_untagged (start),0 , last - start +1 ); }else { -if (prot_new != prot1) { -mprotect (host_start, qemu_host_page_size, -target_to_host_prot (prot_new)); - } -if (prot_new &PROT_WRITE ) { -memset (g2h_untagged (start),0 , end - start); +if (pread (fd,g2h_untagged (start), last - start +1 , offset) ==-1 ) { +return false; } } -return 0 ; + +/* Put final protection */ +if (host_prot_new != host_prot_old) { +mprotect (host_start, qemu_host_page_size, host_prot_new); + } +return true; }#if HOST_LONG_BITS ==64 &&TARGET_ABI_BITS ==64
@@ -681,27 +684,25 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int target_prot,if (start > real_start) {if (real_end == real_start + qemu_host_page_size) {/* one single host page */ - ret =mmap_frag (real_start, start, end, - target_prot, flags, fd, offset); -if (ret ==-1 ) { +if (!mmap_frag (real_start, start, end -1 , + target_prot, flags, fd, offset)) { goto fail; } goto the_end1; } - ret =mmap_frag (real_start, start, real_start + qemu_host_page_size, - target_prot, flags, fd, offset); -if (ret ==-1 ) { +if (!mmap_frag (real_start, start, + real_start + qemu_host_page_size -1 , + target_prot, flags, fd, offset)) { goto fail; } real_start += qemu_host_page_size; }/* handle the end of the mapping */ if (end < real_end) { - ret =mmap_frag (real_end - qemu_host_page_size, - real_end - qemu_host_page_size, end, - target_prot, flags, fd, - offset + real_end - qemu_host_page_size - start); -if (ret ==-1 ) { +if (!mmap_frag (real_end - qemu_host_page_size, + real_end - qemu_host_page_size, end -1 , + target_prot, flags, fd, + offset + real_end - qemu_host_page_size - start)) { goto fail; } real_end -= qemu_host_page_size;
Signature · 1 line
2.34.1
[PULL 24/37] target/arm: Demultiplex AESE and AESMC
In reply to Richard HendersonSplit these helpers so that we are not passing 'decrypt' within the simd descriptor.
--- target/arm/helper.h | 2 ++ target/arm/tcg/sve.decode | 4 ++-- target/arm/tcg/crypto_helper.c | 37 +++++++++++++++++++++++---------- target/arm/tcg/translate-a64.c | 13 ++++-------- target/arm/tcg/translate-neon.c | 4 ++-- target/arm/tcg/translate-sve.c | 8 ++++--- 6 files changed, 41 insertions(+), 27 deletions(-)
target/arm/helper.h +2 -0
@@ -552,7 +552,9 @@ DEF_HELPER_FLAGS_2(neon_qzip16, TCG_CALL_NO_RWG, void, ptr, ptr) DEF_HELPER_FLAGS_2(neon_qzip32, TCG_CALL_NO_RWG, void, ptr, ptr) DEF_HELPER_FLAGS_4(crypto_aese, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(crypto_aesd, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_3(crypto_aesmc, TCG_CALL_NO_RWG, void, ptr, ptr, i32) +DEF_HELPER_FLAGS_3(crypto_aesimc, TCG_CALL_NO_RWG, void, ptr, ptr, i32) DEF_HELPER_FLAGS_4(crypto_sha1su0, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)DEF_HELPER_FLAGS_4 (crypto_sha1c,TCG_CALL_NO_RWG , void, ptr, ptr, ptr, i32)
target/arm/tcg/sve.decode +2 -2
@@ -1629,8 +1629,8 @@ STNT1_zprz 1110010 .. 10 ..... 001 ... ..... ..... \ ### SVE2 Crypto Extensions # SVE2 crypto unary operations -# AESMC and AESIMC -AESMC 01000101 00 10000011100 decrypt:1 00000 rd:5 +AESMC 01000101 00 10000011100 0 00000 rd:5 +AESIMC 01000101 00 10000011100 1 00000 rd:5 # SVE2 crypto destructive binary operations AESE 01000101 00 10001 0 11100 0 ..... ..... @rdn_rm_e0
target/arm/tcg/crypto_helper.c +26 -11
@@ -45,11 +45,9 @@ static void clear_tail_16(void *vd, uint32_t desc)clear_tail (vd, opr_sz, max_sz); } -static void do_crypto_aese (uint64_t *rd,uint64_t *rn, -uint64_t *rm,bool decrypt) +static void do_crypto_aese (uint64_t *rd,uint64_t *rn,uint64_t *rm, +const uint8_t *sbox,const uint8_t *shift) { -static uint8_t const *const sbox[2 ] = { AES_sbox, AES_isbox }; -static uint8_t const *const shift[2 ] = { AES_shifts, AES_ishifts };union CRYPTO_STATE rk = { .l = { rm[0 ], rm[1 ] } };union CRYPTO_STATE st = { .l = { rn[0 ], rn[1 ] } };int i;
@@ -60,7 +58,7 @@ static void do_crypto_aese(uint64_t *rd, uint64_t *rn,/* combine ShiftRows operation and sbox substitution */ for (i =0 ; i <16 ; i++) { -CR_ST_BYTE (st, i) = sbox[decrypt][CR_ST_BYTE (rk, shift[decrypt][i])]; +CR_ST_BYTE (st, i) = sbox[CR_ST_BYTE (rk, shift[i])]; } rd[0 ] = st.l[0 ];
@@ -70,18 +68,26 @@ static void do_crypto_aese(uint64_t *rd, uint64_t *rn,void HELPER (crypto_aese )(void *vd,void *vn,void *vm,uint32_t desc) {intptr_t i, opr_sz =simd_oprsz (desc); -bool decrypt =simd_data (desc);for (i =0 ; i < opr_sz; i +=16 ) { -do_crypto_aese (vd + i, vn + i, vm + i, decrypt); +do_crypto_aese (vd + i, vn + i, vm + i, AES_sbox, AES_shifts); }clear_tail (vd, opr_sz,simd_maxsz (desc)); } -static void do_crypto_aesmc (uint64_t *rd,uint64_t *rm,bool decrypt) +void HELPER (crypto_aesd )(void *vd,void *vn,void *vm,uint32_t desc) +{ +intptr_t i, opr_sz =simd_oprsz (desc); + +for (i =0 ; i < opr_sz; i +=16 ) { +do_crypto_aese (vd + i, vn + i, vm + i, AES_isbox, AES_ishifts); + } +clear_tail (vd, opr_sz,simd_maxsz (desc)); +} + +static void do_crypto_aesmc (uint64_t *rd,uint64_t *rm,const uint32_t *mc) {union CRYPTO_STATE st = { .l = { rm[0 ], rm[1 ] } }; -const uint32_t *mc = decrypt ? AES_imc_rot : AES_mc_rot;int i;for (i =0 ; i <16 ; i +=4 ) {
@@ -99,10 +105,19 @@ static void do_crypto_aesmc(uint64_t *rd, uint64_t *rm, bool decrypt)void HELPER (crypto_aesmc )(void *vd,void *vm,uint32_t desc) {intptr_t i, opr_sz =simd_oprsz (desc); -bool decrypt =simd_data (desc);for (i =0 ; i < opr_sz; i +=16 ) { -do_crypto_aesmc (vd + i, vm + i, decrypt); +do_crypto_aesmc (vd + i, vm + i, AES_mc_rot); + } +clear_tail (vd, opr_sz,simd_maxsz (desc)); +} + +void HELPER (crypto_aesimc )(void *vd,void *vm,uint32_t desc) +{ +intptr_t i, opr_sz =simd_oprsz (desc); + +for (i =0 ; i < opr_sz; i +=16 ) { +do_crypto_aesmc (vd + i, vm + i, AES_imc_rot); }clear_tail (vd, opr_sz,simd_maxsz (desc)); }
target/arm/tcg/translate-a64.c +4 -9
@@ -13210,7 +13210,6 @@ static void disas_crypto_aes(DisasContext *s, uint32_t insn)int opcode =extract32 (insn,12 ,5 );int rn =extract32 (insn,5 ,5 );int rd =extract32 (insn,0 ,5 ); -int decrypt;gen_helper_gvec_2 *genfn2 =NULL ;gen_helper_gvec_3 *genfn3 =NULL ;
@@ -13221,20 +13220,16 @@ static void disas_crypto_aes(DisasContext *s, uint32_t insn)switch (opcode) {case 0x4 :/* AESE */ - decrypt =0 ; genfn3 = gen_helper_crypto_aese;break ;case 0x6 :/* AESMC */ - decrypt =0 ; genfn2 = gen_helper_crypto_aesmc;break ;case 0x5 :/* AESD */ - decrypt =1 ; - genfn3 = gen_helper_crypto_aese; + genfn3 = gen_helper_crypto_aesd;break ;case 0x7 :/* AESIMC */ - decrypt =1 ; - genfn2 = gen_helper_crypto_aesmc; + genfn2 = gen_helper_crypto_aesimc;break ;default :unallocated_encoding (s);
@@ -13245,9 +13240,9 @@ static void disas_crypto_aes(DisasContext *s, uint32_t insn)return ; }if (genfn2) { -gen_gvec_op2_ool (s, true, rd, rn, decrypt, genfn2); +gen_gvec_op2_ool (s, true, rd, rn,0 , genfn2); }else { -gen_gvec_op3_ool (s, true, rd, rd, rn, decrypt, genfn3); +gen_gvec_op3_ool (s, true, rd, rd, rn,0 , genfn3); } }
target/arm/tcg/translate-neon.c +2 -2
@@ -3451,9 +3451,9 @@ static bool trans_VMVN(DisasContext *s, arg_2misc *a) } WRAP_2M_3_OOL_FN(gen_AESE, gen_helper_crypto_aese, 0) -WRAP_2M_3_OOL_FN(gen_AESD, gen_helper_crypto_aese, 1) +WRAP_2M_3_OOL_FN(gen_AESD, gen_helper_crypto_aesd, 0) WRAP_2M_2_OOL_FN(gen_AESMC, gen_helper_crypto_aesmc, 0) -WRAP_2M_2_OOL_FN(gen_AESIMC, gen_helper_crypto_aesmc, 1) +WRAP_2M_2_OOL_FN(gen_AESIMC, gen_helper_crypto_aesimc, 0) WRAP_2M_2_OOL_FN(gen_SHA1H, gen_helper_crypto_sha1h, 0) WRAP_2M_2_OOL_FN(gen_SHA1SU1, gen_helper_crypto_sha1su1, 0)WRAP_2M_2_OOL_FN (gen_SHA256SU0, gen_helper_crypto_sha256su0,0 )
target/arm/tcg/translate-sve.c +5 -3
@@ -7151,12 +7151,14 @@ TRANS_FEAT(USDOT_zzzz, aa64_sve_i8mm, gen_gvec_ool_arg_zzzz, a->esz == 2 ? gen_helper_gvec_usdot_b : NULL, a, 0) TRANS_FEAT_NONSTREAMING(AESMC, aa64_sve2_aes, gen_gvec_ool_zz, - gen_helper_crypto_aesmc, a->rd, a->rd, a->decrypt) + gen_helper_crypto_aesmc, a->rd, a->rd, 0) +TRANS_FEAT_NONSTREAMING(AESIMC, aa64_sve2_aes, gen_gvec_ool_zz, + gen_helper_crypto_aesimc, a->rd, a->rd, 0) TRANS_FEAT_NONSTREAMING(AESE, aa64_sve2_aes, gen_gvec_ool_arg_zzz, - gen_helper_crypto_aese, a, false) + gen_helper_crypto_aese, a, 0) TRANS_FEAT_NONSTREAMING(AESD, aa64_sve2_aes, gen_gvec_ool_arg_zzz, - gen_helper_crypto_aese, a, true) + gen_helper_crypto_aesd, a, 0)TRANS_FEAT_NONSTREAMING (SM4E , aa64_sve2_sm4, gen_gvec_ool_arg_zzz, gen_helper_crypto_sm4e, a,0 )
Signature · 1 line
2.34.1
PATCH 33/45 accel/tcg: Introduce page_find_range_empty
In reply to Richard HendersonUse the interval tree to locate an unused range in the VM.
Message-Id: <[email protected]>
--- include/exec/cpu-all.h | 15 +++++++++++++++ accel/tcg/user-exec.c | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+)
include/exec/cpu-all.h +15 -0
@@ -236,6 +236,21 @@ int page_check_range(target_ulong start, target_ulong len, int flags);*/ bool page_check_range_empty (target_ulong start,target_ulong last); +/** +* page_find_range_empty +* @min: first byte of search range +* @max: last byte of search range +* @len: size of the hole required +* @align: alignment of the hole required (power of 2) +* +* If there is a range [x, x+@len) within [@min, @max] such that +* x % @align == 0, then return x. Otherwise return -1. +* The memory lock must be held, as the caller will want to ensure +* the returned range stays empty until a new mapping can be installed. +*/ +target_ulong page_find_range_empty (target_ulong min,target_ulong max, +target_ulong len,target_ulong align); +/** * page_get_target_data(address) * @address: guest virtual address
accel/tcg/user-exec.c +41 -0
47 lines not on this page · raw message
Signature · 1 line
2.34.1
PATCH 34/45 bsd-user: Use page_find_range_empty for mmap_find_vma_reserved
In reply to Richard HendersonUse the interval tree to find empty space, rather than probing each page in turn.
Reviewed-bt: Warner Losh <[email protected]>
Message-Id: <[email protected]>
--- bsd-user/mmap.c | 48 +++++++----------------------------------------- 1 file changed, 7 insertions(+), 41 deletions(-)
bsd-user/mmap.c +7 -41
@@ -222,50 +222,16 @@ unsigned long last_brk;static abi_ulong mmap_find_vma_reserved (abi_ulong start,abi_ulong size,abi_ulong alignment) { -abi_ulong addr; -abi_ulong end_addr; -int prot; -int looped =0 ; +abi_ulong ret; -if (size > reserved_va) { -return (abi_ulong)-1 ; + ret =page_find_range_empty (start, reserved_va, size, alignment); +if (ret ==-1 && start >TARGET_PAGE_SIZE ) { +/* Restart at the beginning of the address space. */ + ret =page_find_range_empty (TARGET_PAGE_SIZE , start -1 , + size, alignment); } - size =HOST_PAGE_ALIGN (size) + alignment; - end_addr = start + size; -if (end_addr > reserved_va) { - end_addr = reserved_va +1 ; - } - addr = end_addr - qemu_host_page_size; - -while (1 ) { -if (addr > end_addr) { -if (looped) { -return (abi_ulong)-1 ; - } - end_addr = reserved_va +1 ; - addr = end_addr - qemu_host_page_size; - looped =1 ; -continue ; - } - prot =page_get_flags (addr); -if (prot) { - end_addr = addr; - } -if (end_addr - addr >= size) { -break ; - } - addr -= qemu_host_page_size; - } - -if (start == mmap_next_start) { - mmap_next_start = addr; - } -/* addr is sufficiently low to align it up */ -if (alignment !=0 ) { - addr = (addr + alignment) & ~(alignment -1 ); - } -return addr; +return ret; }/*
Signature · 1 line
2.34.1
PATCH 35/45 linux-user: Use page_find_range_empty for mmap_find_vma_reserved
In reply to Richard HendersonUse the interval tree to find empty space, rather than probing each page in turn.
Message-Id: <[email protected]>
--- linux-user/mmap.c | 52 ++++++----------------------------------------- 1 file changed, 6 insertions(+), 46 deletions(-)
linux-user/mmap.c +6 -46
@@ -318,55 +318,15 @@ unsigned long last_brk;static abi_ulong mmap_find_vma_reserved (abi_ulong start,abi_ulong size,abi_ulong align) { -abi_ulong addr, end_addr, incr = qemu_host_page_size; -int prot; -bool looped = false; +target_ulong ret; -if (size > reserved_va) { -return (abi_ulong)-1 ; + ret =page_find_range_empty (start, reserved_va, size, align); +if (ret ==-1 && start > mmap_min_addr) { +/* Restart at the beginning of the address space. */ + ret =page_find_range_empty (mmap_min_addr, start -1 , size, align); } -/* Note that start and size have already been aligned by mmap_find_vma. */ - - end_addr = start + size; -/* -* Start at the top of the address space, ignoring the last page. -* If reserved_va == UINT32_MAX, then end_addr wraps to 0, -* throwing the rest of the calculations off. -* TODO: rewrite using last_addr instead. -* TODO: use the interval tree instead of probing every page. -*/ -if (start > reserved_va - size) { - end_addr = ((reserved_va - size) & -align) + size; - looped = true; - } - -/* Search downward from END_ADDR, checking to see if a page is in use. */ - addr = end_addr; -while (1 ) { - addr -= incr; -if (addr > end_addr) { -if (looped) { -/* Failure. The entire address space has been searched. */ -return (abi_ulong)-1 ; - } -/* Re-start at the top of the address space (see above). */ - addr = end_addr = ((reserved_va - size) & -align) + size; - looped = true; - }else { - prot =page_get_flags (addr); -if (prot) { -/* Page in use. Restart below this page. */ - addr = end_addr = ((addr - size) & -align) + size; - }else if (addr && addr + size == end_addr) { -/* Success! All pages between ADDR and END_ADDR are free. */ -if (start == mmap_next_start) { - mmap_next_start = addr; - } -return addr; - } - } - } +return ret; }/*
Signature · 1 line
2.34.1
[PULL 21/37] target/i386: Use aesdec_IMC
In reply to Richard HendersonThis implements the AESIMC instruction.
--- target/i386/ops_sse.h | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)
target/i386/ops_sse.h +3 -8
@@ -2215,15 +2215,10 @@ void glue(helper_aesenclast, SUFFIX)(CPUX86State *env, Reg *d, Reg *v, Reg *s)#if SHIFT ==1 void glue (helper_aesimc ,SUFFIX )(CPUX86State *env,Reg *d,Reg *s) { -int i; -Reg tmp = *s; +AESState *ad = (AESState *)&d->ZMM_X (0 ); +AESState *st = (AESState *)&s->ZMM_X (0 ); -for (i =0 ; i <4 ; i++) { - d->L (i) =bswap32 (AES_imc[tmp.B (4 * i +0 )][0 ] ^ - AES_imc[tmp.B (4 * i +1 )][1 ] ^ - AES_imc[tmp.B (4 * i +2 )][2 ] ^ - AES_imc[tmp.B (4 * i +3 )][3 ]); - } +aesdec_IMC (ad, st, false); } void glue(helper_aeskeygenassist, SUFFIX)(CPUX86State *env, Reg *d, Reg *s,
Signature · 1 line
2.34.1
PATCH 36/45 linux-user: Use 'last' instead of 'end' in target_mmap
In reply to Richard HendersonComplete the transition within the mmap functions to a formulation that does not overflow at the end of the address space.
Message-Id: <[email protected]>
--- linux-user/mmap.c | 45 +++++++++++++++++++++++---------------------- 1 file changed, 23 insertions(+), 22 deletions(-)
linux-user/mmap.c +23 -22
@@ -456,8 +456,8 @@ abi_ulong mmap_find_vma(abi_ulong start, abi_ulong size, abi_ulong align)abi_long target_mmap (abi_ulong start,abi_ulong len,int target_prot,int flags,int fd,off_t offset) { -abi_ulong ret, end, real_start, real_end, retaddr, host_len, - passthrough_start =-1 , passthrough_end =-1 ; +abi_ulong ret, last, real_start, real_last, retaddr, host_len; +abi_ulong passthrough_start =-1 , passthrough_last =0 ;int page_flags;off_t host_offset;
@@ -581,29 +581,30 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int target_prot, host_start += offset - host_offset; } start =h2g (host_start); + last = start + len -1 ; passthrough_start = start; - passthrough_end = start + len; + passthrough_last = last; }else {if (start & ~TARGET_PAGE_MASK ) { errno =EINVAL ; goto fail; } - end = start + len; - real_end =HOST_PAGE_ALIGN (end); + last = start + len -1 ; + real_last =HOST_PAGE_ALIGN (last) -1 ;/* * Test if requested memory area fits target address space * It can fail only on 64-bit host with 32-bit target. * On any other target/host host mmap() handles this error correctly. */ -if (end < start || !guest_range_valid_untagged (start, len)) { +if (last < start || !guest_range_valid_untagged (start, len)) { errno =ENOMEM ; goto fail; }/* Validate that the chosen range is empty. */ if ((flags &MAP_FIXED_NOREPLACE ) - && !page_check_range_empty (start, end -1 )) { + && !page_check_range_empty (start, last)) { errno =EEXIST ; goto fail; }
@@ -642,9 +643,9 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int target_prot,/* handle the start of the mapping */ if (start > real_start) { -if (real_end == real_start + qemu_host_page_size) { +if (real_last == real_start + qemu_host_page_size -1 ) {/* one single host page */ -if (!mmap_frag (real_start, start, end -1 , +if (!mmap_frag (real_start, start, last, target_prot, flags, fd, offset)) { goto fail; }
@@ -658,18 +659,18 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int target_prot, real_start += qemu_host_page_size; }/* handle the end of the mapping */ -if (end < real_end) { -if (!mmap_frag (real_end - qemu_host_page_size, - real_end - qemu_host_page_size, end -1 , +if (last < real_last) { +abi_ulong real_page = real_last - qemu_host_page_size +1 ; +if (!mmap_frag (real_page, real_page, last, target_prot, flags, fd, - offset + real_end - qemu_host_page_size - start)) { + offset + real_page - start)) { goto fail; } - real_end -= qemu_host_page_size; + real_last -= qemu_host_page_size; }/* map the middle (easier) */ -if (real_start < real_end) { +if (real_start < real_last) {void *p;off_t offset1;
@@ -678,13 +679,13 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int target_prot, }else { offset1 = offset + real_start - start; } - p =mmap (g2h_untagged (real_start), real_end - real_start, + p =mmap (g2h_untagged (real_start), real_last - real_start +1 ,target_to_host_prot (target_prot), flags, fd, offset1);if (p ==MAP_FAILED ) { goto fail; } passthrough_start = real_start; - passthrough_end = real_end; + passthrough_last = real_last; } } the_end1:
@@ -692,16 +693,16 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int target_prot, page_flags |=PAGE_ANON ; } page_flags |=PAGE_RESET ; -if (passthrough_start == passthrough_end) { -page_set_flags (start, start + len -1 , page_flags); +if (passthrough_start > passthrough_last) { +page_set_flags (start, last, page_flags); }else {if (start < passthrough_start) {page_set_flags (start, passthrough_start -1 , page_flags); } -page_set_flags (passthrough_start, passthrough_end -1 , +page_set_flags (passthrough_start, passthrough_last, page_flags |PAGE_PASSTHROUGH ); -if (passthrough_end < start + len) { -page_set_flags (passthrough_end, start + len -1 , page_flags); +if (passthrough_last < last) { +page_set_flags (passthrough_last +1 , last, page_flags); } } the_end:
Signature · 1 line
2.34.1
[PULL 26/37] target/arm: Use aesdec_ISB_ISR_AK
In reply to Richard HendersonThis implements the AESD instruction.
--- target/arm/tcg/crypto_helper.c | 37 +++++++++++++++------------------- 1 file changed, 16 insertions(+), 21 deletions(-)
target/arm/tcg/crypto_helper.c +16 -21
@@ -48,26 +48,6 @@ static void clear_tail_16(void *vd, uint32_t desc)static const AESState aes_zero = { }; -static void do_crypto_aese (uint64_t *rd,uint64_t *rn,uint64_t *rm, -const uint8_t *sbox,const uint8_t *shift) -{ -union CRYPTO_STATE rk = { .l = { rm[0 ], rm[1 ] } }; -union CRYPTO_STATE st = { .l = { rn[0 ], rn[1 ] } }; -int i; - -/* xor state vector with round key */ - rk.l[0 ] ^= st.l[0 ]; - rk.l[1 ] ^= st.l[1 ]; - -/* combine ShiftRows operation and sbox substitution */ -for (i =0 ; i <16 ; i++) { -CR_ST_BYTE (st, i) = sbox[CR_ST_BYTE (rk, shift[i])]; - } - - rd[0 ] = st.l[0 ]; - rd[1 ] = st.l[1 ]; -} -void HELPER (crypto_aese )(void *vd,void *vn,void *vm,uint32_t desc) {intptr_t i, opr_sz =simd_oprsz (desc);
@@ -102,7 +82,22 @@ void HELPER(crypto_aesd)(void *vd, void *vn, void *vm, uint32_t desc)intptr_t i, opr_sz =simd_oprsz (desc);for (i =0 ; i < opr_sz; i +=16 ) { -do_crypto_aese (vd + i, vn + i, vm + i, AES_isbox, AES_ishifts); +AESState *ad = (AESState *)(vd + i); +AESState *st = (AESState *)(vn + i); +AESState *rk = (AESState *)(vm + i); +AESState t; + +/* Our uint64_t are in the wrong order for big-endian. */ +if (HOST_BIG_ENDIAN ) { + t.d[0 ] = st->d[1 ] ^ rk->d[1 ]; + t.d[1 ] = st->d[0 ] ^ rk->d[0 ]; +aesdec_ISB_ISR_AK (&t, &t, &aes_zero, false); + ad->d[0 ] = t.d[1 ]; + ad->d[1 ] = t.d[0 ]; + }else { + t.v = st->v ^ rk->v; +aesdec_ISB_ISR_AK (ad, &t, &aes_zero, false); + } }clear_tail (vd, opr_sz,simd_maxsz (desc)); }
Signature · 1 line
2.34.1
PATCH 37/45 linux-user: Rewrite mmap_reserve
In reply to Richard HendersonUse 'last' variables instead of 'end' variables; be careful about avoiding overflow. Assert that the mmap succeeded.
Message-Id: <[email protected]>
--- linux-user/mmap.c | 68 +++++++++++++++++++++++++++++------------------ 1 file changed, 42 insertions(+), 26 deletions(-)
linux-user/mmap.c +42 -26
@@ -722,47 +722,63 @@ fail:return -1 ; } -static void mmap_reserve (abi_ulong start,abi_ulong size) +static void mmap_reserve (abi_ulong start,abi_ulong len) {abi_ulong real_start; -abi_ulong real_end; -abi_ulong addr; -abi_ulong end; +abi_ulong real_last; +abi_ulong real_len; +abi_ulong last; +abi_ulong a; +void *host_start, *ptr;int prot; + last = start + len -1 ; real_start = start & qemu_host_page_mask; - real_end =HOST_PAGE_ALIGN (start + size); - end = start + size; -if (start > real_start) { -/* handle host page containing start */ + real_last =HOST_PAGE_ALIGN (last) -1 ; + +/* +* If guest pages remain on the first or last host pages, +* adjust the deallocation to retain those guest pages. +* The single page special case is required for the last page, +* lest real_start overflow to zero. +*/ +if (real_last - real_start < qemu_host_page_size) { prot =0 ; -for (addr = real_start; addr < start; addr +=TARGET_PAGE_SIZE ) { - prot |=page_get_flags (addr); +for (a = real_start; a < start; a +=TARGET_PAGE_SIZE ) { + prot |=page_get_flags (a); } -if (real_end == real_start + qemu_host_page_size) { -for (addr = end; addr < real_end; addr +=TARGET_PAGE_SIZE ) { - prot |=page_get_flags (addr); - } - end = real_end; +for (a = last; a < real_last; a +=TARGET_PAGE_SIZE ) { + prot |=page_get_flags (a +1 ); + } +if (prot !=0 ) { +return ; + } + }else { +for (prot =0 , a = real_start; a < start; a +=TARGET_PAGE_SIZE ) { + prot |=page_get_flags (a); }if (prot !=0 ) { real_start += qemu_host_page_size; } - } -if (end < real_end) { - prot =0 ; -for (addr = end; addr < real_end; addr +=TARGET_PAGE_SIZE ) { - prot |=page_get_flags (addr); + +for (prot =0 , a = last; a < real_last; a +=TARGET_PAGE_SIZE ) { + prot |=page_get_flags (a +1 ); }if (prot !=0 ) { - real_end -= qemu_host_page_size; + real_last -= qemu_host_page_size; + } + +if (real_last < real_start) { +return ; } } -if (real_start != real_end) { -mmap (g2h_untagged (real_start), real_end - real_start,PROT_NONE , -MAP_FIXED |MAP_ANONYMOUS |MAP_PRIVATE |MAP_NORESERVE , --1 ,0 ); - } + + real_len = real_last - real_start +1 ; + host_start =g2h_untagged (real_start); + + ptr =mmap (host_start, real_len,PROT_NONE , +MAP_FIXED |MAP_ANONYMOUS |MAP_PRIVATE |MAP_NORESERVE ,-1 ,0 ); +assert (ptr == host_start); }int target_munmap (abi_ulong start,abi_ulong len)
Signature · 1 line
2.34.1
PATCH 38/45 linux-user: Rename mmap_reserve to mmap_reserve_or_unmap
In reply to Richard HendersonIf !reserved_va, munmap instead and assert success. Update all callers.
Message-Id: <[email protected]>
--- linux-user/mmap.c | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-)
linux-user/mmap.c +16 -13
@@ -722,14 +722,14 @@ fail:return -1 ; } -static void mmap_reserve (abi_ulong start,abi_ulong len) +static void mmap_reserve_or_unmap (abi_ulong start,abi_ulong len) {abi_ulong real_start;abi_ulong real_last;abi_ulong real_len;abi_ulong last;abi_ulong a; -void *host_start, *ptr; +void *host_start;int prot; last = start + len -1 ;
@@ -776,9 +776,15 @@ static void mmap_reserve(abi_ulong start, abi_ulong len) real_len = real_last - real_start +1 ; host_start =g2h_untagged (real_start); - ptr =mmap (host_start, real_len,PROT_NONE , -MAP_FIXED |MAP_ANONYMOUS |MAP_PRIVATE |MAP_NORESERVE ,-1 ,0 ); -assert (ptr == host_start); +if (reserved_va) { +void *ptr =mmap (host_start, real_len,PROT_NONE , +MAP_FIXED |MAP_ANONYMOUS + |MAP_PRIVATE |MAP_NORESERVE ,-1 ,0 ); +assert (ptr == host_start); + }else { +int ret =munmap (host_start, real_len); +assert (ret ==0 ); + } }int target_munmap (abi_ulong start,abi_ulong len)
@@ -830,11 +836,7 @@ int target_munmap(abi_ulong start, abi_ulong len) ret =0 ;/* unmap what we can */ if (real_start < real_end) { -if (reserved_va) { -mmap_reserve (real_start, real_end - real_start); - }else { - ret =munmap (g2h_untagged (real_start), real_end - real_start); - } +mmap_reserve_or_unmap (real_start, real_end - real_start); }if (ret ==0 ) {
@@ -871,7 +873,7 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size,* If new and old addresses overlap then the above mremap will * already have failed with EINVAL. */ -mmap_reserve (old_addr, old_size); +mmap_reserve_or_unmap (old_addr, old_size); } }else if (flags &MREMAP_MAYMOVE ) {abi_ulong mmap_start;
@@ -886,7 +888,7 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size, flags |MREMAP_FIXED , g2h_untagged(mmap_start));if (reserved_va) { -mmap_reserve (old_addr, old_size); +mmap_reserve_or_unmap (old_addr, old_size); } } }else {
@@ -912,7 +914,8 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size, errno =ENOMEM ; host_addr =MAP_FAILED ; }else if (reserved_va && old_size > new_size) { -mmap_reserve (old_addr + old_size, old_size - new_size); +mmap_reserve_or_unmap (old_addr + old_size, + old_size - new_size); } } }else {
Signature · 1 line
2.34.1
[PULL 06/37] crypto: Add aesdec_ISB_ISR_AK
In reply to Richard HendersonAdd a primitive for InvSubBytes + InvShiftRows + AddRoundKey.
--- host/include/generic/host/crypto/aes-round.h | 4 ++ include/crypto/aes-round.h | 21 +++++++++ crypto/aes.c | 45 ++++++++++++++++++++ 3 files changed, 70 insertions(+)
host/include/generic/host/crypto/aes-round.h +4 -0
@@ -13,4 +13,8 @@ void aesenc_SB_SR_AK_accel(AESState *, const AESState *, const AESState *, bool) QEMU_ERROR("unsupported accel"); +void aesdec_ISB_ISR_AK_accel(AESState *, const AESState *, + const AESState *, bool) + QEMU_ERROR("unsupported accel"); +#endif /* GENERIC_HOST_CRYPTO_AES_ROUND_H */
include/crypto/aes-round.h +21 -0
@@ -41,4 +41,25 @@ static inline void aesenc_SB_SR_AK(AESState *r, const AESState *st, } } +/* +* Perform InvSubBytes + InvShiftRows + AddRoundKey. +*/ + +void aesdec_ISB_ISR_AK_gen (AESState *ret,const AESState *st, +const AESState *rk); +void aesdec_ISB_ISR_AK_genrev (AESState *ret,const AESState *st, +const AESState *rk); + +static inline void aesdec_ISB_ISR_AK (AESState *r,const AESState *st, +const AESState *rk,bool be) +{ +if (HAVE_AES_ACCEL ) { +aesdec_ISB_ISR_AK_accel (r, st, rk, be); + }else if (HOST_BIG_ENDIAN == be) { +aesdec_ISB_ISR_AK_gen (r, st, rk); + }else { +aesdec_ISB_ISR_AK_genrev (r, st, rk); + } +} +#endif /* CRYPTO_AES_ROUND_H */
crypto/aes.c +45 -0
51 lines not on this page · raw message
Signature · 1 line
2.34.1
PATCH 39/45 linux-user: Simplify target_munmap
In reply to Richard HendersonAll 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.
Message-Id: <[email protected]>
--- linux-user/mmap.c | 47 ++++------------------------------------------- 1 file changed, 4 insertions(+), 43 deletions(-)
linux-user/mmap.c +4 -43
@@ -789,9 +789,6 @@ static void mmap_reserve_or_unmap(abi_ulong start, abi_ulong len)int target_munmap (abi_ulong start,abi_ulong len) { -abi_ulong end, real_start, real_end, addr; -int prot, ret; -trace_target_munmap (start, len);if (start & ~TARGET_PAGE_MASK ) {
@@ -803,47 +800,11 @@ int target_munmap(abi_ulong start, abi_ulong len) }mmap_lock (); - end = start + len; - real_start = start & qemu_host_page_mask; - real_end =HOST_PAGE_ALIGN (end); - -if (start > real_start) { -/* handle host page containing start */ - prot =0 ; -for (addr = real_start; addr < start; addr +=TARGET_PAGE_SIZE ) { - prot |=page_get_flags (addr); - } -if (real_end == real_start + qemu_host_page_size) { -for (addr = end; addr < real_end; addr +=TARGET_PAGE_SIZE ) { - prot |=page_get_flags (addr); - } - end = real_end; - } -if (prot !=0 ) { - real_start += qemu_host_page_size; - } - } -if (end < real_end) { - prot =0 ; -for (addr = end; addr < real_end; addr +=TARGET_PAGE_SIZE ) { - prot |=page_get_flags (addr); - } -if (prot !=0 ) { - real_end -= qemu_host_page_size; - } - } - - ret =0 ; -/* unmap what we can */ -if (real_start < real_end) { -mmap_reserve_or_unmap (real_start, real_end - real_start); - } - -if (ret ==0 ) { -page_set_flags (start, start + len -1 ,0 ); - } +mmap_reserve_or_unmap (start, len); +page_set_flags (start, start + len -1 ,0 );mmap_unlock (); -return ret; + +return 0 ; } abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size,
Signature · 1 line
2.34.1
PATCH 40/45 accel/tcg: Accept more page flags in page_check_range
In reply to Richard HendersonOnly PAGE_WRITE needs special attention, all others can be handled as we do for PAGE_READ. Adjust the mask.
Message-Id: <[email protected]>
--- accel/tcg/user-exec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
accel/tcg/user-exec.c +2 -2
@@ -561,8 +561,8 @@ int page_check_range(target_ulong start, target_ulong len, int flags) } missing = flags & ~p->flags; -if (missing &PAGE_READ ) { - ret =-1 ;/* page not readable */ +if (missing & ~PAGE_WRITE ) { + ret =-1 ;/* page doesn't match */ break ; }if (missing &PAGE_WRITE ) {
Signature · 1 line
2.34.1
PATCH 41/45 accel/tcg: Return bool from page_check_range
In reply to Richard HendersonReplace the 0/-1 result with true/false.
Invert the sense of the test of all callers.
Document the function.
Message-Id: <[email protected]>
--- 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(-)
bsd-user/qemu.h +1 -1
@@ -267,7 +267,7 @@ abi_long do_freebsd_sysarch(void *cpu_env, abi_long arg1, abi_long arg2);static inline bool access_ok (int type,abi_ulong addr,abi_ulong size) { -return page_check_range ((target_ulong )addr, size, type) ==0 ; +return page_check_range ((target_ulong )addr, size, type); }/*
include/exec/cpu-all.h +12 -1
@@ -222,7 +222,18 @@ int walk_memory_regions(void *, walk_memory_regions_fn);int page_get_flags (target_ulong address);void page_set_flags (target_ulong start,target_ulong last,int flags);void page_reset_target_data (target_ulong start,target_ulong last); -int page_check_range (target_ulong start,target_ulong len,int flags); + +/** +* page_check_range +* @start: first byte of range +* @len: length of range +* @flags: flags required for each page +* +* Return true if every page in [@start, @start+@len) has @flags set. +* Return false if any page is unmapped. Thus testing flags == 0 is +* equivalent to testing for flags == PAGE_VALID. +*/ +bool page_check_range (target_ulong start,target_ulong last,int flags);/** * page_check_range_empty:
linux-user/qemu.h +1 -1
@@ -182,7 +182,7 @@ static inline bool access_ok_untagged(int type, abi_ulong addr, abi_ulong size) : !guest_range_valid_untagged(addr, size)) {return false; } -return page_check_range ((target_ulong )addr, size, type) ==0 ; +return page_check_range ((target_ulong )addr, size, type); } static inline bool access_ok(CPUState *cpu, int type,
accel/tcg/user-exec.c +11 -11
@@ -520,19 +520,19 @@ void page_set_flags(target_ulong start, target_ulong last, int flags) } } -int page_check_range (target_ulong start,target_ulong len,int flags) +bool page_check_range (target_ulong start,target_ulong len,int flags) {target_ulong last;int locked;/* tri-state: =0: unlocked, +1: global, -1: local */ -int ret; +bool ret;if (len ==0 ) { -return 0 ;/* trivial length */ +return true;/* trivial length */ } last = start + len -1 ;if (last < start) { -return -1 ;/* wrap around */ +return false;/* wrap around */ } locked =have_mmap_lock ();
@@ -551,33 +551,33 @@ int page_check_range(target_ulong start, target_ulong len, int flags) p =pageflags_find (start, last); }if (!p) { - ret =-1 ;/* entire region invalid */ + ret = false;/* entire region invalid */ break ; } }if (start < p->itree.start) { - ret =-1 ;/* initial bytes invalid */ + ret = false;/* initial bytes invalid */ break ; } missing = flags & ~p->flags;if (missing & ~PAGE_WRITE ) { - ret =-1 ;/* page doesn't match */ + ret = false;/* page doesn't match */ break ; }if (missing &PAGE_WRITE ) {if (!(p->flags &PAGE_WRITE_ORG )) { - ret =-1 ;/* page not writable */ + ret = false;/* page not writable */ break ; }/* Asking about writable, but has been protected: undo. */ if (!page_unprotect (start,0 )) { - ret =-1 ; + ret = false;break ; }/* TODO: page_unprotect should take a range, not a single page. */ if (last - start <TARGET_PAGE_SIZE ) { - ret =0 ;/* ok */ + ret = true;/* ok */ break ; } start +=TARGET_PAGE_SIZE ;
@@ -585,7 +585,7 @@ int page_check_range(target_ulong start, target_ulong len, int flags) }if (last <= p->itree.last) { - ret =0 ;/* ok */ + ret = true;/* ok */ break ; } start = p->itree.last +1 ;
linux-user/syscall.c +1 -1
@@ -8108,7 +8108,7 @@ static int open_self_maps_1(CPUArchState *cpu_env, int fd, bool smaps) max =h2g_valid (max -1 ) ? max : (uintptr_t )g2h_untagged (GUEST_ADDR_MAX ) +1 ; -if (page_check_range (h2g (min), max - min, flags) ==-1 ) { +if (!page_check_range (h2g (min), max - min, flags)) {continue ; }
target/hppa/op_helper.c +1 -1
@@ -168,7 +168,7 @@ target_ureg HELPER(probe)(CPUHPPAState *env, target_ulong addr, uint32_t level, uint32_t want) {#ifdef CONFIG_USER_ONLY -return (page_check_range (addr,1 , want) ==0 ) ?1 :0 ; +return page_check_range (addr,1 , want);#else int prot, excp;hwaddr phys;
target/riscv/vector_helper.c +1 -1
@@ -583,7 +583,7 @@ vext_ldff(void *vd, void *v0, target_ulong base, cpu_mmu_index(env, false));if (host) {#ifdef CONFIG_USER_ONLY -if (page_check_range (addr, offset,PAGE_READ ) <0 ) { +if (page_check_range (addr, offset,PAGE_READ )) { vl = i; goto ProbeSuccess; }
target/sparc/ldst_helper.c +1 -1
@@ -1191,7 +1191,7 @@ uint64_t helper_ld_asi(CPUSPARCState *env, target_ulong addr,case ASI_PNFL :/* Primary no-fault LE */ case ASI_SNF :/* Secondary no-fault */ case ASI_SNFL :/* Secondary no-fault LE */ -if (page_check_range (addr, size,PAGE_READ ) ==-1 ) { +if (!page_check_range (addr, size,PAGE_READ )) { ret =0 ;break ; }
accel/tcg/ldst_atomicity.c.inc +2 -2
@@ -159,7 +159,7 @@ static uint64_t load_atomic8_or_exit(CPUArchState *env, uintptr_t ra, void *pv) * another process, because the fallback start_exclusive solution * provides no protection across processes. */ - if (!page_check_range(h2g(pv), 8, PAGE_WRITE_ORG)) { + if (page_check_range(h2g(pv), 8, PAGE_WRITE_ORG)) { uint64_t *p = __builtin_assume_aligned(pv, 8); return *p; }
@@ -194,7 +194,7 @@ static Int128 load_atomic16_or_exit(CPUArchState *env, uintptr_t ra, void *pv) * another process, because the fallback start_exclusive solution * provides no protection across processes. */ - if (!page_check_range(h2g(p), 16, PAGE_WRITE_ORG)) { + if (page_check_range(h2g(p), 16, PAGE_WRITE_ORG)) { return *p; } #endif
Signature · 1 line
2.34.1
PATCH 42/45 linux-user: Remove can_passthrough_madvise
In reply to Richard HendersonUse page_check_range instead, which uses the interval tree instead of checking each page individually.
Message-Id: <[email protected]>
--- linux-user/mmap.c | 24 +++--------------------- 1 file changed, 3 insertions(+), 21 deletions(-)
linux-user/mmap.c +3 -21
@@ -898,23 +898,6 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size,return new_addr; } -static bool can_passthrough_madvise (abi_ulong start,abi_ulong end) -{ -ulong addr; - -if ((start | end) & ~qemu_host_page_mask) { -return false; - } - -for (addr = start; addr < end; addr +=TARGET_PAGE_SIZE ) { -if (!(page_get_flags (addr) &PAGE_PASSTHROUGH )) { -return false; - } - } - -return true; -} -abi_long target_madvise (abi_ulong start,abi_ulong len_in,int advice) {abi_ulong len, end;
@@ -964,9 +947,8 @@ abi_long target_madvise(abi_ulong start, abi_ulong len_in, int advice)* * A straight passthrough for those may not be safe because qemu sometimes * turns private file-backed mappings into anonymous mappings. -* can_passthrough_madvise() helps to check if a passthrough is possible by -* comparing mappings that are known to have the same semantics in the host -* and the guest. In this case passthrough is safe. +* If all guest pages have PAGE_PASSTHROUGH set, mappings have the +* same semantics for the host as for the guest. * * We pass through MADV_WIPEONFORK and MADV_KEEPONFORK if possible and * return failure if not.
@@ -984,7 +966,7 @@ abi_long target_madvise(abi_ulong start, abi_ulong len_in, int advice) ret = -EINVAL ;/* fall through */ case MADV_DONTNEED : -if (can_passthrough_madvise (start, end)) { +if (page_check_range (start, len,PAGE_PASSTHROUGH )) { ret =get_errno (madvise (g2h_untagged (start), len, advice));if ((advice ==MADV_DONTNEED ) && (ret ==0 )) {page_reset_target_data (start, start + len -1 );
Signature · 1 line
2.34.1
PATCH 43/45 linux-user: Simplify target_madvise
In reply to Richard HendersonThe 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.
Message-Id: <[email protected]>
--- linux-user/mmap.c | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-)
linux-user/mmap.c +4 -15
@@ -900,28 +900,17 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size,abi_long target_madvise (abi_ulong start,abi_ulong len_in,int advice) { -abi_ulong len, end; +abi_ulong len;int ret =0 ;if (start & ~TARGET_PAGE_MASK ) {return -TARGET_EINVAL ; } - len =TARGET_PAGE_ALIGN (len_in); - -if (len_in && !len) { -return -TARGET_EINVAL ; - } - - end = start + len; -if (end < start) { -return -TARGET_EINVAL ; - } - -if (end == start) { +if (len_in ==0 ) {return 0 ; } - -if (!guest_range_valid_untagged (start, len)) { + len =TARGET_PAGE_ALIGN (len_in); +if (len ==0 || !guest_range_valid_untagged (start, len)) {return -TARGET_EINVAL ; }
Signature · 1 line
2.34.1
[PULL 35/37] crypto: Implement aesdec_IMC with AES_imc_rot
In reply to Richard HendersonThis method uses one uint32_t * 256 table instead of 4, which means its data cache overhead is less.
--- crypto/aes.c | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-)
crypto/aes.c +21 -21
@@ -1377,39 +1377,39 @@ aesdec_IMC_swap(AESState *r, const AESState *st, bool swap)bool be =HOST_BIG_ENDIAN ^ swap;uint32_t t; -/* Note that AES_imc is encoded for big-endian. */ - t = (AES_imc[st->b[swap_b ^0x0 ]][0 ] ^ - AES_imc[st->b[swap_b ^0x1 ]][1 ] ^ - AES_imc[st->b[swap_b ^0x2 ]][2 ] ^ - AES_imc[st->b[swap_b ^0x3 ]][3 ]); -if (!be) { +/* Note that AES_imc_rot is encoded for little-endian. */ + t = ( AES_imc_rot[st->b[swap_b ^0x0 ]] ^ +rol32 (AES_imc_rot[st->b[swap_b ^0x1 ]],8 ) ^ +rol32 (AES_imc_rot[st->b[swap_b ^0x2 ]],16 ) ^ +rol32 (AES_imc_rot[st->b[swap_b ^0x3 ]],24 )); +if (be) { t =bswap32 (t); } r->w[swap_w ^0 ] = t; - t = (AES_imc[st->b[swap_b ^0x4 ]][0 ] ^ - AES_imc[st->b[swap_b ^0x5 ]][1 ] ^ - AES_imc[st->b[swap_b ^0x6 ]][2 ] ^ - AES_imc[st->b[swap_b ^0x7 ]][3 ]); -if (!be) { + t = ( AES_imc_rot[st->b[swap_b ^0x4 ]] ^ +rol32 (AES_imc_rot[st->b[swap_b ^0x5 ]],8 ) ^ +rol32 (AES_imc_rot[st->b[swap_b ^0x6 ]],16 ) ^ +rol32 (AES_imc_rot[st->b[swap_b ^0x7 ]],24 )); +if (be) { t =bswap32 (t); } r->w[swap_w ^1 ] = t; - t = (AES_imc[st->b[swap_b ^0x8 ]][0 ] ^ - AES_imc[st->b[swap_b ^0x9 ]][1 ] ^ - AES_imc[st->b[swap_b ^0xA ]][2 ] ^ - AES_imc[st->b[swap_b ^0xB ]][3 ]); -if (!be) { + t = ( AES_imc_rot[st->b[swap_b ^0x8 ]] ^ +rol32 (AES_imc_rot[st->b[swap_b ^0x9 ]],8 ) ^ +rol32 (AES_imc_rot[st->b[swap_b ^0xA ]],16 ) ^ +rol32 (AES_imc_rot[st->b[swap_b ^0xB ]],24 )); +if (be) { t =bswap32 (t); } r->w[swap_w ^2 ] = t; - t = (AES_imc[st->b[swap_b ^0xC ]][0 ] ^ - AES_imc[st->b[swap_b ^0xD ]][1 ] ^ - AES_imc[st->b[swap_b ^0xE ]][2 ] ^ - AES_imc[st->b[swap_b ^0xF ]][3 ]); -if (!be) { + t = ( AES_imc_rot[st->b[swap_b ^0xC ]] ^ +rol32 (AES_imc_rot[st->b[swap_b ^0xD ]],8 ) ^ +rol32 (AES_imc_rot[st->b[swap_b ^0xE ]],16 ) ^ +rol32 (AES_imc_rot[st->b[swap_b ^0xF ]],24 )); +if (be) { t =bswap32 (t); } r->w[swap_w ^3 ] = t;
Signature · 1 line
2.34.1
[PULL 30/37] target/riscv: Use aesdec_ISB_ISR_AK
In reply to Richard HendersonThis implements the AES64DS instruction.
--- target/riscv/crypto_helper.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
target/riscv/crypto_helper.c +6 -1
@@ -213,7 +213,12 @@ target_ulong HELPER(aes64es)(target_ulong rs1, target_ulong rs2)target_ulong HELPER (aes64ds )(target_ulong rs1,target_ulong rs2) { -return aes64_operation (rs1, rs2, false, false); +AESState t; + + t.d[HOST_BIG_ENDIAN ] = rs1; + t.d[!HOST_BIG_ENDIAN ] = rs2; +aesdec_ISB_ISR_AK (&t, &t, &aes_zero, false); +return t.d[HOST_BIG_ENDIAN ]; }target_ulong HELPER (aes64dsm )(target_ulong rs1,target_ulong rs2)
Signature · 1 line
2.34.1
PATCH 44/45 linux-user: Drop uint and ulong
In reply to Richard HendersonFrom: Juan Quintela <[email protected]>
These are types not used anymore anywhere else.
Message-id: <[email protected]>
--- linux-user/syscall.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
linux-user/syscall.c +4 -4
@@ -309,16 +309,16 @@ _syscall0(int, sys_gettid)#endif #if defined(TARGET_NR_getdents) && defined(EMULATE_GETDENTS_WITH_GETDENTS ) -_syscall3(int, sys_getdents, uint, fd, struct linux_dirent *, dirp, uint, count); +_syscall3(int, sys_getdents, unsigned int, fd, struct linux_dirent *, dirp, unsigned int, count);#endif #if (defined(TARGET_NR_getdents) && \ !defined(EMULATE_GETDENTS_WITH_GETDENTS )) || \ (defined(TARGET_NR_getdents64) && defined(__NR_getdents64)) -_syscall3(int, sys_getdents64, uint, fd, struct linux_dirent64 *, dirp, uint, count); +_syscall3(int, sys_getdents64, unsigned int, fd, struct linux_dirent64 *, dirp, unsigned int, count);#endif #if defined(TARGET_NR__llseek) && defined(__NR_llseek) -_syscall5 (int, _llseek, uint, fd, ulong, hi, ulong, lo, - loff_t *, res, uint, wh); +_syscall5(int, _llseek, unsigned int, fd, unsigned long, hi, unsigned long, lo, + loff_t *, res, unsigned int, wh);#endif _syscall3(int, sys_rt_sigqueueinfo, pid_t, pid, int, sig, siginfo_t *, uinfo) _syscall4(int, sys_rt_tgsigqueueinfo, pid_t, pid, pid_t, tid, int, sig,
Signature · 1 line
2.34.1
[PULL 29/37] target/riscv: Use aesenc_SB_SR_AK
In reply to Richard HendersonThis implements the AES64ES instruction.
--- target/riscv/crypto_helper.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
target/riscv/crypto_helper.c +9 -1
@@ -22,6 +22,7 @@#include "exec/exec-all.h" #include "exec/helper-proto.h" #include "crypto/aes.h" +#include "crypto/aes-round.h" #include "crypto/sm4.h" #define AES_XTIME (a) \
@@ -136,6 +137,8 @@ target_ulong HELPER(aes32dsi)(target_ulong rs1, target_ulong rs2, AES_INVMIXBYTE(COL, 1, 2, 3, 0) << 8 | \ AES_INVMIXBYTE(COL, 0, 1, 2, 3) << 0) +static const AESState aes_zero = { }; +static inline target_ulong aes64_operation (target_ulong rs1,target_ulong rs2,bool enc,bool mix) {
@@ -200,7 +203,12 @@ target_ulong HELPER(aes64esm)(target_ulong rs1, target_ulong rs2)target_ulong HELPER (aes64es )(target_ulong rs1,target_ulong rs2) { -return aes64_operation (rs1, rs2, true, false); +AESState t; + + t.d[HOST_BIG_ENDIAN ] = rs1; + t.d[!HOST_BIG_ENDIAN ] = rs2; +aesenc_SB_SR_AK (&t, &t, &aes_zero, false); +return t.d[HOST_BIG_ENDIAN ]; }target_ulong HELPER (aes64ds )(target_ulong rs1,target_ulong rs2)
Signature · 1 line
2.34.1
PATCH 45/45 linux-user/riscv: Add syscall riscv_hwprobe
In reply to Richard HendersonFrom: Robbin Ehn <[email protected]>
This patch adds the new syscall for the
"RISC-V Hardware Probing Interface"
(https://docs.kernel.org/riscv/hwprobe.html).
Message-Id: <[email protected]>
--- linux-user/riscv/syscall32_nr.h | 1 + linux-user/riscv/syscall64_nr.h | 1 + linux-user/syscall.c | 146 ++++++++++++++++++++++++++++++++ 3 files changed, 148 insertions(+)
linux-user/riscv/syscall32_nr.h +1 -0
@@ -228,6 +228,7 @@#define TARGET_NR_accept4 242#define TARGET_NR_arch_specific_syscall 244#define TARGET_NR_riscv_flush_icache (TARGET_NR_arch_specific_syscall + 15) +#define TARGET_NR_riscv_hwprobe (TARGET_NR_arch_specific_syscall + 14)#define TARGET_NR_prlimit64 261#define TARGET_NR_fanotify_init 262#define TARGET_NR_fanotify_mark 263
linux-user/riscv/syscall64_nr.h +1 -0
@@ -251,6 +251,7 @@#define TARGET_NR_recvmmsg 243#define TARGET_NR_arch_specific_syscall 244#define TARGET_NR_riscv_flush_icache (TARGET_NR_arch_specific_syscall + 15) +#define TARGET_NR_riscv_hwprobe (TARGET_NR_arch_specific_syscall + 14)#define TARGET_NR_wait4 260#define TARGET_NR_prlimit64 261#define TARGET_NR_fanotify_init 262
linux-user/syscall.c +146 -0
158 lines not on this page · raw message
Signature · 1 line
2.34.1
[PULL 36/37] crypto: Remove AES_imc
In reply to Richard HendersonThis array is no longer used.
--- include/crypto/aes.h | 7 -- crypto/aes.c | 264 ------------------------------------------- 2 files changed, 271 deletions(-)
include/crypto/aes.h +0 -7
@@ -36,13 +36,6 @@ extern const uint32_t AES_mc_rot[256];/* AES InvMixColumns, for use with rot32. */ extern const uint32_t AES_imc_rot[256 ]; -/* AES InvMixColumns */ -/* AES_imc[x][0] = [x].[0e, 09, 0d, 0b]; */ -/* AES_imc[x][1] = [x].[0b, 0e, 09, 0d]; */ -/* AES_imc[x][2] = [x].[0d, 0b, 0e, 09]; */ -/* AES_imc[x][3] = [x].[09, 0d, 0b, 0e]; */ -extern const uint32_t AES_imc[256 ][4 ]; -/* AES_Te0[x] = S [x].[02, 01, 01, 03]; AES_Te1[x] = S [x].[03, 02, 01, 01];
crypto/aes.c +0 -264
270 lines not on this page · raw message
Signature · 1 line
2.34.1
[PULL 05/37] crypto: Add aesenc_SB_SR_AK
In reply to Richard HendersonStart adding infrastructure for accelerating guest AES. Begin with a SubBytes + ShiftRows + AddRoundKey primitive.
--- MAINTAINERS | 1 + host/include/generic/host/crypto/aes-round.h | 16 +++++++ include/crypto/aes-round.h | 44 +++++++++++++++++++ crypto/aes.c | 46 ++++++++++++++++++++ 4 files changed, 107 insertions(+) create mode 100644 host/include/generic/host/crypto/aes-round.h create mode 100644 include/crypto/aes-round.h
MAINTAINERS +1 -0
@@ -3224,6 +3224,7 @@ M: Daniel P. Berrange <[email protected]> S: Maintained F: crypto/ F: include/crypto/ +F: host/include/*/host/crypto/ F: qapi/crypto.json F: tests/unit/test-crypto-* F: tests/bench/benchmark-crypto-*
host/include/generic/host/crypto/aes-round.h new file +16 -0
@@ -0,0 +1,16 @@ +/* +* No host specific aes acceleration. +* SPDX-License-Identifier: GPL-2.0-or-later +*/ + +#ifndef GENERIC_HOST_CRYPTO_AES_ROUND_H +#define GENERIC_HOST_CRYPTO_AES_ROUND_H + +#define HAVE_AES_ACCEL false +#define ATTR_AES_ACCEL + +void aesenc_SB_SR_AK_accel(AESState *, const AESState *, + const AESState *, bool) + QEMU_ERROR("unsupported accel"); + +#endif /* GENERIC_HOST_CRYPTO_AES_ROUND_H */
include/crypto/aes-round.h new file +44 -0
44 lines not on this page · raw message
crypto/aes.c +46 -0
58 lines not on this page · raw message
Signature · 1 line
2.34.1