Skip to content

Commit

Permalink
Merge branch 'with_tcti_vectors' into utm-edition
Browse files Browse the repository at this point in the history
  • Loading branch information
osy committed Mar 6, 2023
2 parents 80c0e30 + 550af33 commit bd2fc47
Show file tree
Hide file tree
Showing 10 changed files with 1,775 additions and 439 deletions.
21 changes: 21 additions & 0 deletions block/file-posix.c
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,13 @@ static int raw_normalize_devicepath(const char **filename, Error **errp)
}
#endif

#if defined(CONFIG_IOS)
static int probe_logical_blocksize(int fd, unsigned int *sector_size_p)
{
return -ENOTSUP; /* not supported on iOS */
}
#else /* CONFIG_IOS */

/*
* Get logical block size via ioctl. On success store it in @sector_size_p.
*/
Expand Down Expand Up @@ -313,6 +320,8 @@ static int probe_logical_blocksize(int fd, unsigned int *sector_size_p)
return success ? 0 : -errno;
}

#endif

/**
* Get physical block size of @fd.
* On success, store it in @blk_size and return 0.
Expand Down Expand Up @@ -1449,12 +1458,24 @@ static bool preadv_present = true;
static ssize_t
qemu_preadv(int fd, const struct iovec *iov, int nr_iov, off_t offset)
{
#ifdef CONFIG_DARWIN /* preadv introduced in macOS 11 */
if (!__builtin_available(macOS 11, iOS 14, watchOS 7, tvOS 14, *)) {
preadv_present = false;
return -ENOSYS;
} else
#endif
return preadv(fd, iov, nr_iov, offset);
}

static ssize_t
qemu_pwritev(int fd, const struct iovec *iov, int nr_iov, off_t offset)
{
#ifdef CONFIG_DARWIN /* pwritev introduced in macOS 11 */
if (!__builtin_available(macOS 11, iOS 14, watchOS 7, tvOS 14, *)) {
preadv_present = false;
return -ENOSYS;
} else
#endif
return pwritev(fd, iov, nr_iov, offset);
}

Expand Down
2 changes: 1 addition & 1 deletion include/qemu/osdep.h
Original file line number Diff line number Diff line change
Expand Up @@ -676,7 +676,7 @@ size_t qemu_get_host_physmem(void);
/**
* Platforms which do not support system() return ENOSYS
*/
#ifndef HAVE_SYSTEM_FUNCTION
#if !defined(HAVE_SYSTEM_FUNCTION) || defined(CONFIG_IOS)
#define system platform_does_not_support_system
static inline int platform_does_not_support_system(const char *command)
{
Expand Down
87 changes: 79 additions & 8 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@ add_project_arguments('-iquote', '.',

if host_machine.system() == 'darwin'
add_languages('objc', required: false, native: false)
add_project_link_arguments(['-fvisibility-inlines-hidden', '-Xlinker', '-no_deduplicate'], native: false, language: ['c', 'cpp', 'objc'])
endif

sparse = find_program('cgcc', required: get_option('sparse'))
Expand Down Expand Up @@ -455,6 +456,8 @@ if targetos == 'netbsd'
endif
endif

tcti_gadgets = files()

tcg_arch = host_arch
if get_option('tcg').allowed()
if host_arch == 'unknown'
Expand Down Expand Up @@ -483,14 +486,77 @@ if get_option('tcg').allowed()

# Tell our compiler how to generate our TCTI gadgets.
gadget_generator = 'tcg/@0@/tcti-gadget-gen.py'.format(tcg_arch)
tcti_gadgets = custom_target('tcti-gadgets.c.inc',
output: 'tcti-gadgets.c.inc',
input: gadget_generator,
command: [find_program(gadget_generator), '@OUTPUT@'],
build_by_default: true,
build_always_stale: false)

genh += tcti_gadgets
tcti_sources = [
'tcti_gadgets.h',
'tcti_misc_gadgets.c',
'tcti_misc_gadgets.h',
'tcti_setcond_gadgets.c',
'tcti_setcond_gadgets.h',
'tcti_brcond_gadgets.c',
'tcti_brcond_gadgets.h',
'tcti_mov_gadgets.c',
'tcti_mov_gadgets.h',
'tcti_load_signed_gadgets.c',
'tcti_load_signed_gadgets.h',
'tcti_load_unsigned_gadgets.c',
'tcti_load_unsigned_gadgets.h',
'tcti_store_gadgets.c',
'tcti_store_gadgets.h',
'tcti_arithmetic_gadgets.c',
'tcti_arithmetic_gadgets.h',
'tcti_logical_gadgets.c',
'tcti_logical_gadgets.h',
'tcti_extension_gadgets.c',
'tcti_extension_gadgets.h',
'tcti_bitwise_gadgets.c',
'tcti_bitwise_gadgets.h',
'tcti_byteswap_gadgets.c',
'tcti_byteswap_gadgets.h',
'tcti_qemu_ld_aligned_signed_le_gadgets.c',
'tcti_qemu_ld_aligned_signed_le_gadgets.h',
'tcti_qemu_ld_unaligned_signed_le_gadgets.c',
'tcti_qemu_ld_unaligned_signed_le_gadgets.h',
'tcti_qemu_ld_slowpath_signed_le_gadgets.c',
'tcti_qemu_ld_slowpath_signed_le_gadgets.h',
'tcti_qemu_ld_aligned_unsigned_le_gadgets.c',
'tcti_qemu_ld_aligned_unsigned_le_gadgets.h',
'tcti_qemu_ld_unaligned_unsigned_le_gadgets.c',
'tcti_qemu_ld_unaligned_unsigned_le_gadgets.h',
'tcti_qemu_ld_slowpath_unsigned_le_gadgets.c',
'tcti_qemu_ld_slowpath_unsigned_le_gadgets.h',
'tcti_qemu_ld_aligned_be_gadgets.c',
'tcti_qemu_ld_aligned_be_gadgets.h',
'tcti_qemu_ld_unaligned_be_gadgets.c',
'tcti_qemu_ld_unaligned_be_gadgets.h',
'tcti_qemu_ld_slowpath_be_gadgets.c',
'tcti_qemu_ld_slowpath_be_gadgets.h',
'tcti_qemu_st_aligned_le_gadgets.c',
'tcti_qemu_st_aligned_le_gadgets.h',
'tcti_qemu_st_unaligned_le_gadgets.c',
'tcti_qemu_st_unaligned_le_gadgets.h',
'tcti_qemu_st_slowpath_le_gadgets.c',
'tcti_qemu_st_slowpath_le_gadgets.h',
'tcti_qemu_st_aligned_be_gadgets.c',
'tcti_qemu_st_aligned_be_gadgets.h',
'tcti_qemu_st_unaligned_be_gadgets.c',
'tcti_qemu_st_unaligned_be_gadgets.h',
'tcti_qemu_st_slowpath_be_gadgets.c',
'tcti_qemu_st_slowpath_be_gadgets.h',
'tcti_simd_base_gadgets.c',
'tcti_simd_base_gadgets.h',
'tcti_simd_arithmetic_gadgets.c',
'tcti_simd_arithmetic_gadgets.h',
'tcti_simd_logical_gadgets.c',
'tcti_simd_logical_gadgets.h',
'tcti_simd_immediate_gadgets.c',
'tcti_simd_immediate_gadgets.h',
]
tcti_gadgets = custom_target('tcti-gadgets.h',
output: tcti_sources,
input: gadget_generator,
command: [find_program(gadget_generator)],
build_by_default: true,
build_always_stale: false)
elif host_arch == 'x86_64'
tcg_arch = 'i386'
elif host_arch == 'ppc64'
Expand Down Expand Up @@ -3157,6 +3223,11 @@ if get_option('b_lto')
endif
common_ss.add(pagevary)
specific_ss.add(files('page-vary.c'))
specific_ss.add(when: 'CONFIG_TCG_INTERPRETER', if_true: files('tcg/tci.c'))

# FIXME: This is being used for now for development quickness, but these realy should be
# added to a gadget-specific shared library (tcti_ss).
specific_ss.add(when: 'CONFIG_TCG_THREADED_INTERPRETER', if_true: tcti_gadgets)

subdir('backends')
subdir('disas')
Expand Down
23 changes: 17 additions & 6 deletions tcg/aarch64-tcti/tcg-target-con-set.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,24 @@
* Each operand should be a sequence of constraint letters as defined by
* tcg-target-con-str.h; the constraint combination is inclusive or.
*/

// Simple register functions.
C_O0_I1(r)
C_O0_I2(r, r)
C_O0_I3(r, r, r)
C_O0_I4(r, r, r, r)
//C_O0_I4(r, r, r, r)
C_O1_I1(r, r)
C_O1_I2(r, 0, r)
C_O1_I2(r, r, r)
C_O1_I4(r, r, r, r, r)
C_O2_I1(r, r, r)
C_O2_I2(r, r, r, r)
C_O2_I4(r, r, r, r, r, r)
//C_O1_I4(r, r, r, r, r)
//C_O2_I1(r, r, r)
//C_O2_I2(r, r, r, r)
//C_O2_I4(r, r, r, r, r, r)

// Vector functions.
C_O1_I1(w, w)
C_O1_I1(w, r)
C_O0_I2(w, r)
C_O1_I1(w, wr)
C_O1_I2(w, w, w)
C_O1_I3(w, w, w, w)
C_O1_I2(w, 0, w)
11 changes: 10 additions & 1 deletion tcg/aarch64-tcti/tcg-target-con-str.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,13 @@
* Define constraint letters for register sets:
* REGS(letter, register_mask)
*/
REGS('r', MAKE_64BIT_MASK(0, TCG_TARGET_NB_REGS))
REGS('r', TCG_MASK_GP_REGISTERS)
REGS('w', TCG_MASK_VECTOR_REGISTERS)

/*
* Define constraint letters for constants:
* CONST(letter, TCG_CT_CONST_* bit set)
*/

// Simple 64-bit immediates.
CONST('I', 0xFFFFFFFFFFFFFFFF)
Loading

0 comments on commit bd2fc47

Please sign in to comment.