Implement membarrier, SO_RCVTIMEO and SO_SNDTIMEO

Disable by default build of fdt, slirp and tools with linux-user
 Improve strace and use qemu_log to send trace to a file
 Add partial ALSA ioctl supports
 -----BEGIN PGP SIGNATURE-----
 
 iQJGBAABCAAwFiEEzS913cjjpNwuT1Fz8ww4vT8vvjwFAl5OT1QSHGxhdXJlbnRA
 dml2aWVyLmV1AAoJEPMMOL0/L748i9kQAJYbShtYQNoNhSf/joKtQbxJ6vtQPryU
 8J85wD2RShYpX2qi86WZ4IGFhSE+wFQ+Lfi1Z0SPs/VUgTSaiOYYEZBfROiKzY/M
 hbpXlfzWGOLxfzgP17QR5eoSxbVA81N7ruyTiUxFGUTeVbowIXR+/v5Ek8GOJCuu
 pAA/07NHxuP/YP2MkrlfAolFte5riQgfQT+QrJwpVwygdRwMx0Ed+gDWJosl8zL/
 qEOzyZlXI/Mm+5bKCUQknSqpL3yQibmYfqM0XLhxjfvZ4vJDYk3Vet7ww39Je9Rz
 7eAmXU7ERzzuFBTA7HEJjAjy+BrPkPMJINczfYcahUrt3TYS36DxinTre0TJbkMV
 1np1Snn4LhSbvcAY/gFpO6X+lS5siYKZC9Ki2chBfl7AygjfswSl1wqE4cNwEyma
 ycjdYnlzo8JvuPPI7qploFAPr0hDgloAVfIzTlz+LC7dhsAhHtpf0vq0xC717z98
 qOTO1MVoZa0WserrnyAFDaNkBwwYGwhm9WKcd23/9XO6gjc5yZWF98oc31Z1KpT4
 ya+qqpcy++FNM3K+74BC403pdoda75N7sl0HYsxJWnhRjUOAPjEwHRo69iGzO/ku
 8AOcjws/wf2BnoR7KO/KLQrkpc+EAGY/ulndTqUEyC1MdsMoF6VOB5aTFiBgJBMO
 GlsvTkt+05i4
 =WAH+
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/vivier2/tags/linux-user-for-5.0-pull-request' into staging

Implement membarrier, SO_RCVTIMEO and SO_SNDTIMEO
Disable by default build of fdt, slirp and tools with linux-user
Improve strace and use qemu_log to send trace to a file
Add partial ALSA ioctl supports

# gpg: Signature made Thu 20 Feb 2020 09:20:20 GMT
# gpg:                using RSA key CD2F75DDC8E3A4DC2E4F5173F30C38BD3F2FBE3C
# gpg:                issuer "laurent@vivier.eu"
# gpg: Good signature from "Laurent Vivier <lvivier@redhat.com>" [full]
# gpg:                 aka "Laurent Vivier <laurent@vivier.eu>" [full]
# gpg:                 aka "Laurent Vivier (Red Hat) <lvivier@redhat.com>" [full]
# Primary key fingerprint: CD2F 75DD C8E3 A4DC 2E4F  5173 F30C 38BD 3F2F BE3C

* remotes/vivier2/tags/linux-user-for-5.0-pull-request:
  linux-user: Add support for selected alsa timer instructions using ioctls
  linux-user: Add support for getting/setting selected alsa timer parameters using ioctls
  linux-user: Add support for selecting alsa timer using ioctl
  linux-user: Add support for getting/setting specified alsa timer parameters using ioctls
  linux-user: Add support for getting alsa timer version and id
  linux-user: remove gemu_log from the linux-user tree
  linux-user: Use `qemu_log' for strace
  linux-user: Use `qemu_log' for non-strace logging
  configure: Avoid compiling system tools on user build by default
  linux-user/strace: Improve output of various syscalls
  configure: linux-user doesn't need neither fdt nor slirp
  linux-user: implement getsockopt SO_RCVTIMEO and SO_SNDTIMEO
  linux-user: Implement membarrier syscall

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2020-02-20 17:35:42 +00:00
commit b651b80822
15 changed files with 600 additions and 326 deletions

22
configure vendored
View File

@ -455,7 +455,7 @@ guest_agent_ntddscsi="no"
guest_agent_msi=""
vss_win32_sdk=""
win_sdk="no"
want_tools="yes"
want_tools=""
libiscsi=""
libnfs=""
coroutine=""
@ -2213,6 +2213,16 @@ else
echo big/little test failed
fi
##########################################
# system tools
if test -z "$want_tools"; then
if test "$softmmu" = "no"; then
want_tools=no
else
want_tools=yes
fi
fi
##########################################
# cocoa implies not SDL or GTK
# (the cocoa UI code currently assumes it is always the active UI
@ -4135,6 +4145,11 @@ elif test "$fdt" != "yes" ; then
fdt=no
fi
# fdt is only required when building softmmu targets
if test -z "$fdt" -a "$softmmu" != "yes" ; then
fdt="no"
fi
if test "$fdt" != "no" ; then
fdt_libs="-lfdt"
# explicitly check for libfdt_env.h as it is missing in some stable installs
@ -6078,6 +6093,11 @@ fi
##########################################
# check for slirp
# slirp is only required when building softmmu targets
if test -z "$slirp" -a "$softmmu" != "yes" ; then
slirp="no"
fi
case "$slirp" in
"" | yes)
if $pkg_config slirp; then

View File

@ -62,6 +62,8 @@ static inline bool qemu_log_separate(void)
#define CPU_LOG_TB_OP_IND (1 << 16)
#define CPU_LOG_TB_FPU (1 << 17)
#define CPU_LOG_PLUGIN (1 << 18)
/* LOG_STRACE is used for user-mode strace logging. */
#define LOG_STRACE (1 << 19)
/* Lock output for a series of related logs. Since this is not needed
* for a single qemu_log / qemu_log_mask / qemu_log_mask_and_addr, we

View File

@ -349,8 +349,9 @@ void cpu_loop(CPUARMState *env)
env->regs[0] = cpu_get_tls(env);
break;
default:
gemu_log("qemu: Unsupported ARM syscall: 0x%x\n",
n);
qemu_log_mask(LOG_UNIMP,
"qemu: Unsupported ARM syscall: 0x%x\n",
n);
env->regs[0] = -TARGET_ENOSYS;
break;
}

View File

@ -514,7 +514,8 @@ static abi_long host_to_target_data_bridge_nlattr(struct nlattr *nlattr,
u32[1] = tswap32(u32[1]); /* optmask */
break;
default:
gemu_log("Unknown QEMU_IFLA_BR type %d\n", nlattr->nla_type);
qemu_log_mask(LOG_UNIMP, "Unknown QEMU_IFLA_BR type %d\n",
nlattr->nla_type);
break;
}
return 0;
@ -577,7 +578,8 @@ static abi_long host_to_target_slave_data_bridge_nlattr(struct nlattr *nlattr,
case QEMU_IFLA_BRPORT_BRIDGE_ID:
break;
default:
gemu_log("Unknown QEMU_IFLA_BRPORT type %d\n", nlattr->nla_type);
qemu_log_mask(LOG_UNIMP, "Unknown QEMU_IFLA_BRPORT type %d\n",
nlattr->nla_type);
break;
}
return 0;
@ -605,7 +607,8 @@ static abi_long host_to_target_data_tun_nlattr(struct nlattr *nlattr,
*u32 = tswap32(*u32);
break;
default:
gemu_log("Unknown QEMU_IFLA_TUN type %d\n", nlattr->nla_type);
qemu_log_mask(LOG_UNIMP, "Unknown QEMU_IFLA_TUN type %d\n",
nlattr->nla_type);
break;
}
return 0;
@ -652,7 +655,8 @@ static abi_long host_to_target_data_linkinfo_nlattr(struct nlattr *nlattr,
NULL,
host_to_target_data_tun_nlattr);
} else {
gemu_log("Unknown QEMU_IFLA_INFO_KIND %s\n", li_context->name);
qemu_log_mask(LOG_UNIMP, "Unknown QEMU_IFLA_INFO_KIND %s\n",
li_context->name);
}
break;
case QEMU_IFLA_INFO_SLAVE_DATA:
@ -663,12 +667,13 @@ static abi_long host_to_target_data_linkinfo_nlattr(struct nlattr *nlattr,
NULL,
host_to_target_slave_data_bridge_nlattr);
} else {
gemu_log("Unknown QEMU_IFLA_INFO_SLAVE_KIND %s\n",
qemu_log_mask(LOG_UNIMP, "Unknown QEMU_IFLA_INFO_SLAVE_KIND %s\n",
li_context->slave_name);
}
break;
default:
gemu_log("Unknown host QEMU_IFLA_INFO type: %d\n", nlattr->nla_type);
qemu_log_mask(LOG_UNIMP, "Unknown host QEMU_IFLA_INFO type: %d\n",
nlattr->nla_type);
break;
}
@ -690,7 +695,8 @@ static abi_long host_to_target_data_inet_nlattr(struct nlattr *nlattr,
}
break;
default:
gemu_log("Unknown host AF_INET type: %d\n", nlattr->nla_type);
qemu_log_mask(LOG_UNIMP, "Unknown host AF_INET type: %d\n",
nlattr->nla_type);
}
return 0;
}
@ -741,7 +747,8 @@ static abi_long host_to_target_data_inet6_nlattr(struct nlattr *nlattr,
}
break;
default:
gemu_log("Unknown host AF_INET6 type: %d\n", nlattr->nla_type);
qemu_log_mask(LOG_UNIMP, "Unknown host AF_INET6 type: %d\n",
nlattr->nla_type);
}
return 0;
}
@ -759,7 +766,8 @@ static abi_long host_to_target_data_spec_nlattr(struct nlattr *nlattr,
NULL,
host_to_target_data_inet6_nlattr);
default:
gemu_log("Unknown host AF_SPEC type: %d\n", nlattr->nla_type);
qemu_log_mask(LOG_UNIMP, "Unknown host AF_SPEC type: %d\n",
nlattr->nla_type);
break;
}
return 0;
@ -780,7 +788,8 @@ static abi_long host_to_target_data_xdp_nlattr(struct nlattr *nlattr,
*u32 = tswap32(*u32);
break;
default:
gemu_log("Unknown host XDP type: %d\n", nlattr->nla_type);
qemu_log_mask(
LOG_UNIMP, "Unknown host XDP type: %d\n", nlattr->nla_type);
break;
}
return 0;
@ -920,7 +929,8 @@ static abi_long host_to_target_data_link_rtattr(struct rtattr *rtattr)
NULL,
host_to_target_data_xdp_nlattr);
default:
gemu_log("Unknown host QEMU_IFLA type: %d\n", rtattr->rta_type);
qemu_log_mask(LOG_UNIMP, "Unknown host QEMU_IFLA type: %d\n",
rtattr->rta_type);
break;
}
return 0;
@ -954,7 +964,8 @@ static abi_long host_to_target_data_addr_rtattr(struct rtattr *rtattr)
ci->tstamp = tswap32(ci->tstamp);
break;
default:
gemu_log("Unknown host IFA type: %d\n", rtattr->rta_type);
qemu_log_mask(
LOG_UNIMP, "Unknown host IFA type: %d\n", rtattr->rta_type);
break;
}
return 0;
@ -996,7 +1007,8 @@ static abi_long host_to_target_data_route_rtattr(struct rtattr *rtattr)
#endif
break;
default:
gemu_log("Unknown host RTA type: %d\n", rtattr->rta_type);
qemu_log_mask(
LOG_UNIMP, "Unknown host RTA type: %d\n", rtattr->rta_type);
break;
}
return 0;
@ -1111,7 +1123,8 @@ static abi_long target_to_host_data_link_rtattr(struct rtattr *rtattr)
{
switch (rtattr->rta_type) {
default:
gemu_log("Unknown target QEMU_IFLA type: %d\n", rtattr->rta_type);
qemu_log_mask(LOG_UNIMP, "Unknown target QEMU_IFLA type: %d\n",
rtattr->rta_type);
break;
}
return 0;
@ -1125,7 +1138,8 @@ static abi_long target_to_host_data_addr_rtattr(struct rtattr *rtattr)
case IFA_ADDRESS:
break;
default:
gemu_log("Unknown target IFA type: %d\n", rtattr->rta_type);
qemu_log_mask(LOG_UNIMP, "Unknown target IFA type: %d\n",
rtattr->rta_type);
break;
}
return 0;
@ -1147,7 +1161,8 @@ static abi_long target_to_host_data_route_rtattr(struct rtattr *rtattr)
*u32 = tswap32(*u32);
break;
default:
gemu_log("Unknown target RTA type: %d\n", rtattr->rta_type);
qemu_log_mask(LOG_UNIMP, "Unknown target RTA type: %d\n",
rtattr->rta_type);
break;
}
return 0;
@ -1232,8 +1247,8 @@ static abi_long host_to_target_data_audit(struct nlmsghdr *nlh)
{
switch (nlh->nlmsg_type) {
default:
gemu_log("Unknown host audit message type %d\n",
nlh->nlmsg_type);
qemu_log_mask(LOG_UNIMP, "Unknown host audit message type %d\n",
nlh->nlmsg_type);
return -TARGET_EINVAL;
}
return 0;
@ -1253,8 +1268,8 @@ static abi_long target_to_host_data_audit(struct nlmsghdr *nlh)
case AUDIT_FIRST_USER_MSG2 ... AUDIT_LAST_USER_MSG2:
break;
default:
gemu_log("Unknown target audit message type %d\n",
nlh->nlmsg_type);
qemu_log_mask(LOG_UNIMP, "Unknown target audit message type %d\n",
nlh->nlmsg_type);
return -TARGET_EINVAL;
}

View File

@ -461,6 +461,27 @@
IOCTL(SOUND_MIXER_WRITE_LOUD, IOC_W, MK_PTR(TYPE_INT))
IOCTL(SOUND_MIXER_WRITE_RECSRC, IOC_W, MK_PTR(TYPE_INT))
IOCTL(SNDRV_TIMER_IOCTL_PVERSION, IOC_R, MK_PTR(TYPE_INT))
IOCTL(SNDRV_TIMER_IOCTL_NEXT_DEVICE, IOC_RW,
MK_PTR(MK_STRUCT(STRUCT_snd_timer_id)))
IOCTL(SNDRV_TIMER_IOCTL_GINFO, IOC_RW,
MK_PTR(MK_STRUCT(STRUCT_snd_timer_ginfo)))
IOCTL(SNDRV_TIMER_IOCTL_GPARAMS, IOC_W,
MK_PTR(MK_STRUCT(STRUCT_snd_timer_gparams)))
IOCTL(SNDRV_TIMER_IOCTL_GSTATUS, IOC_RW,
MK_PTR(MK_STRUCT(STRUCT_snd_timer_gstatus)))
IOCTL(SNDRV_TIMER_IOCTL_SELECT, IOC_W,
MK_PTR(MK_STRUCT(STRUCT_snd_timer_select)))
IOCTL(SNDRV_TIMER_IOCTL_INFO, IOC_R, MK_PTR(MK_STRUCT(STRUCT_snd_timer_info)))
IOCTL(SNDRV_TIMER_IOCTL_PARAMS, IOC_W,
MK_PTR(MK_STRUCT(STRUCT_snd_timer_params)))
IOCTL(SNDRV_TIMER_IOCTL_STATUS, IOC_R,
MK_PTR(MK_STRUCT(STRUCT_snd_timer_status)))
IOCTL(SNDRV_TIMER_IOCTL_START, 0, TYPE_NULL)
IOCTL(SNDRV_TIMER_IOCTL_STOP, 0, TYPE_NULL)
IOCTL(SNDRV_TIMER_IOCTL_CONTINUE, 0, TYPE_NULL)
IOCTL(SNDRV_TIMER_IOCTL_PAUSE, 0, TYPE_NULL)
IOCTL(HDIO_GETGEO, IOC_R, MK_PTR(MK_STRUCT(STRUCT_hd_geometry)))
IOCTL(HDIO_GET_UNMASKINTR, IOC_R, MK_PTR(TYPE_INT))
IOCTL(HDIO_GET_MULTCOUNT, IOC_R, MK_PTR(TYPE_INT))

View File

@ -60,6 +60,19 @@ unsigned long mmap_min_addr;
unsigned long guest_base;
int have_guest_base;
/*
* Used to implement backwards-compatibility for the `-strace`, and
* QEMU_STRACE options. Without this, the QEMU_LOG can be overwritten by
* -strace, or vice versa.
*/
static bool enable_strace;
/*
* The last log mask given by the user in an environment variable or argument.
* Used to support command line arguments overriding environment variables.
*/
static int last_log_mask;
/*
* When running 32-on-64 we should make sure we can fit all of the possible
* guest address space into a contiguous chunk of virtual host memory.
@ -99,15 +112,6 @@ const char *qemu_uname_release;
by remapping the process stack directly at the right place */
unsigned long guest_stack_size = 8 * 1024 * 1024UL;
void gemu_log(const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
vfprintf(stderr, fmt, ap);
va_end(ap);
}
#if defined(TARGET_I386)
int cpu_get_pic_interrupt(CPUX86State *env)
{
@ -223,15 +227,11 @@ static void handle_arg_help(const char *arg)
static void handle_arg_log(const char *arg)
{
int mask;
mask = qemu_str_to_log_mask(arg);
if (!mask) {
last_log_mask = qemu_str_to_log_mask(arg);
if (!last_log_mask) {
qemu_print_log_usage(stdout);
exit(EXIT_FAILURE);
}
qemu_log_needs_buffers();
qemu_set_log(mask);
}
static void handle_arg_dfilter(const char *arg)
@ -375,7 +375,7 @@ static void handle_arg_singlestep(const char *arg)
static void handle_arg_strace(const char *arg)
{
do_strace = 1;
enable_strace = true;
}
static void handle_arg_version(const char *arg)
@ -629,6 +629,7 @@ int main(int argc, char **argv, char **envp)
int i;
int ret;
int execfd;
int log_mask;
unsigned long max_reserved_va;
error_init(argv[0]);
@ -661,6 +662,12 @@ int main(int argc, char **argv, char **envp)
optind = parse_args(argc, argv);
log_mask = last_log_mask | (enable_strace ? LOG_STRACE : 0);
if (log_mask) {
qemu_log_needs_buffers();
qemu_set_log(log_mask);
}
if (!trace_init_backends()) {
exit(1);
}

View File

@ -211,7 +211,6 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
abi_long arg2, abi_long arg3, abi_long arg4,
abi_long arg5, abi_long arg6, abi_long arg7,
abi_long arg8);
void gemu_log(const char *fmt, ...) GCC_FMT_ATTR(1, 2);
extern __thread CPUState *thread_cpu;
void cpu_loop(CPUArchState *env);
const char *target_strerror(int err);
@ -386,7 +385,6 @@ void print_syscall_ret(int num, abi_long arg1);
* --- SIGSEGV {si_signo=SIGSEGV, si_code=SI_KERNEL, si_addr=0} ---
*/
void print_taken_signal(int target_signum, const target_siginfo_t *tinfo);
extern int do_strace;
/* signal.c */
void process_pending_signals(CPUArchState *cpu_env);

View File

@ -934,7 +934,7 @@ static void handle_pending_signal(CPUArchState *cpu_env, int sig,
handler = sa->_sa_handler;
}
if (do_strace) {
if (unlikely(qemu_loglevel_mask(LOG_STRACE))) {
print_taken_signal(sig, &k->info);
}

File diff suppressed because it is too large Load Diff

View File

@ -26,7 +26,7 @@
{ TARGET_NR_afs_syscall, "afs_syscall" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_alarm
{ TARGET_NR_alarm, "alarm" , NULL, NULL, NULL },
{ TARGET_NR_alarm, "alarm" , "%s(%u)", NULL, NULL },
#endif
#ifdef TARGET_NR_aplib
{ TARGET_NR_aplib, "aplib" , NULL, NULL, NULL },
@ -116,19 +116,19 @@
{ TARGET_NR_dipc, "dipc" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_dup
{ TARGET_NR_dup, "dup" , NULL, NULL, NULL },
{ TARGET_NR_dup, "dup" , "%s(%d)", NULL, NULL },
#endif
#ifdef TARGET_NR_dup2
{ TARGET_NR_dup2, "dup2" , NULL, NULL, NULL },
{ TARGET_NR_dup2, "dup2" , "%s(%d,%d)", NULL, NULL },
#endif
#ifdef TARGET_NR_dup3
{ TARGET_NR_dup3, "dup3" , NULL, NULL, NULL },
{ TARGET_NR_dup3, "dup3" , "%s(%d,%d,%d)", NULL, NULL },
#endif
#ifdef TARGET_NR_epoll_create
{ TARGET_NR_epoll_create, "epoll_create" , NULL, NULL, NULL },
{ TARGET_NR_epoll_create, "%s(%d)", NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_epoll_create1
{ TARGET_NR_epoll_create1, "epoll_create1" , NULL, NULL, NULL },
{ TARGET_NR_epoll_create1, "%s(%d)", NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_epoll_ctl
{ TARGET_NR_epoll_ctl, "epoll_ctl" , NULL, NULL, NULL },
@ -146,10 +146,10 @@
{ TARGET_NR_epoll_wait_old, "epoll_wait_old" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_eventfd
{ TARGET_NR_eventfd, "eventfd" , NULL, NULL, NULL },
{ TARGET_NR_eventfd, "eventfd", "%s(%d)", NULL, NULL },
#endif
#ifdef TARGET_NR_eventfd2
{ TARGET_NR_eventfd2, "eventfd2" , NULL, NULL, NULL },
{ TARGET_NR_eventfd2, "eventfd2" , "%s(%d,%d)", NULL, NULL },
#endif
#ifdef TARGET_NR_execv
{ TARGET_NR_execv, "execv" , NULL, print_execv, NULL },
@ -191,7 +191,7 @@
{ TARGET_NR_fanotify_mark, "fanotify_mark" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_fchdir
{ TARGET_NR_fchdir, "fchdir" , NULL, NULL, NULL },
{ TARGET_NR_fchdir, "fchdir" , "%s(%d)", NULL, NULL },
#endif
#ifdef TARGET_NR_fchmod
{ TARGET_NR_fchmod, "fchmod" , "%s(%d,%#o)", NULL, NULL },
@ -287,7 +287,7 @@
{ TARGET_NR_getdtablesize, "getdtablesize" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_getegid
{ TARGET_NR_getegid, "getegid" , NULL, NULL, NULL },
{ TARGET_NR_getegid, "getegid" , "%s()", NULL, NULL },
#endif
#ifdef TARGET_NR_getegid32
{ TARGET_NR_getegid32, "getegid32" , NULL, NULL, NULL },
@ -299,7 +299,7 @@
{ TARGET_NR_geteuid32, "geteuid32" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_getgid
{ TARGET_NR_getgid, "getgid" , NULL, NULL, NULL },
{ TARGET_NR_getgid, "getgid" , "%s()", NULL, NULL },
#endif
#ifdef TARGET_NR_getgid32
{ TARGET_NR_getgid32, "getgid32" , NULL, NULL, NULL },
@ -329,10 +329,10 @@
{ TARGET_NR_getpeername, "getpeername" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_getpgid
{ TARGET_NR_getpgid, "getpgid" , NULL, NULL, NULL },
{ TARGET_NR_getpgid, "getpgid" , "%s(%u)", NULL, NULL },
#endif
#ifdef TARGET_NR_getpgrp
{ TARGET_NR_getpgrp, "getpgrp" , NULL, NULL, NULL },
{ TARGET_NR_getpgrp, "getpgrp" , "%s()", NULL, NULL },
#endif
#ifdef TARGET_NR_getpid
{ TARGET_NR_getpid, "getpid" , "%s()", NULL, NULL },
@ -432,7 +432,7 @@
{ TARGET_NR_io_cancel, "io_cancel" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_ioctl
{ TARGET_NR_ioctl, "ioctl" , NULL, NULL, NULL },
{ TARGET_NR_ioctl, "ioctl" , "%s(%d,%#x,%#x)", NULL, NULL },
#endif
#ifdef TARGET_NR_io_destroy
{ TARGET_NR_io_destroy, "io_destroy" , NULL, NULL, NULL },
@ -1257,22 +1257,22 @@
{ TARGET_NR_setdomainname, "setdomainname" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_setfsgid
{ TARGET_NR_setfsgid, "setfsgid" , NULL, NULL, NULL },
{ TARGET_NR_setfsgid, "setfsgid" , "%s(%u)", NULL, NULL },
#endif
#ifdef TARGET_NR_setfsgid32
{ TARGET_NR_setfsgid32, "setfsgid32" , NULL, NULL, NULL },
{ TARGET_NR_setfsgid32, "setfsgid32" , "%s(%u)" , NULL, NULL },
#endif
#ifdef TARGET_NR_setfsuid
{ TARGET_NR_setfsuid, "setfsuid" , NULL, NULL, NULL },
{ TARGET_NR_setfsuid, "setfsuid" , "%s(%u)" , NULL, NULL },
#endif
#ifdef TARGET_NR_setfsuid32
{ TARGET_NR_setfsuid32, "setfsuid32" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_setgid
{ TARGET_NR_setgid, "setgid" , NULL, NULL, NULL },
{ TARGET_NR_setgid, "setgid" , "%s(%u)", NULL, NULL },
#endif
#ifdef TARGET_NR_setgid32
{ TARGET_NR_setgid32, "setgid32" , NULL, NULL, NULL },
{ TARGET_NR_setgid32, "setgid32" , "%s(%u)", NULL, NULL },
#endif
#ifdef TARGET_NR_setgroups
{ TARGET_NR_setgroups, "setgroups" , NULL, NULL, NULL },
@ -1296,7 +1296,7 @@
{ TARGET_NR_setns, "setns" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_setpgid
{ TARGET_NR_setpgid, "setpgid" , NULL, NULL, NULL },
{ TARGET_NR_setpgid, "setpgid" , "%s(%u,%u)", NULL, NULL },
#endif
#ifdef TARGET_NR_setpgrp
{ TARGET_NR_setpgrp, "setpgrp" , NULL, NULL, NULL },
@ -1311,22 +1311,22 @@
{ TARGET_NR_setregid32, "setregid32" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_setresgid
{ TARGET_NR_setresgid, "setresgid" , NULL, NULL, NULL },
{ TARGET_NR_setresgid, "setresgid" , "%s(%u,%u,%u)", NULL, NULL },
#endif
#ifdef TARGET_NR_setresgid32
{ TARGET_NR_setresgid32, "setresgid32" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_setresuid
{ TARGET_NR_setresuid, "setresuid" , NULL, NULL, NULL },
{ TARGET_NR_setresuid, "setresuid" , "%s(%u,%u,%u)", NULL, NULL },
#endif
#ifdef TARGET_NR_setresuid32
{ TARGET_NR_setresuid32, "setresuid32" , NULL, NULL, NULL },
{ TARGET_NR_setresuid32, "setresuid32" , "%s(%u,%u,%u)", NULL, NULL },
#endif
#ifdef TARGET_NR_setreuid
{ TARGET_NR_setreuid, "setreuid" , NULL, NULL, NULL },
{ TARGET_NR_setreuid, "setreuid" , "%s(%u,%u)", NULL, NULL },
#endif
#ifdef TARGET_NR_setreuid32
{ TARGET_NR_setreuid32, "setreuid32" , NULL, NULL, NULL },
{ TARGET_NR_setreuid32, "setreuid32" , "%s(%u,%u)", NULL, NULL },
#endif
#ifdef TARGET_NR_setrlimit
{ TARGET_NR_setrlimit, "setrlimit" , NULL, NULL, NULL },
@ -1335,7 +1335,7 @@
{ TARGET_NR_set_robust_list, "set_robust_list" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_setsid
{ TARGET_NR_setsid, "setsid" , NULL, NULL, NULL },
{ TARGET_NR_setsid, "setsid" , "%s()", NULL, NULL },
#endif
#ifdef TARGET_NR_setsockopt
{ TARGET_NR_setsockopt, "setsockopt" , NULL, NULL, NULL },

View File

@ -111,6 +111,7 @@
#include <linux/netlink.h>
#include <linux/if_alg.h>
#include <linux/rtc.h>
#include <sound/asound.h>
#include "linux_loop.h"
#include "uname.h"
@ -334,6 +335,9 @@ _syscall5(int, kcmp, pid_t, pid1, pid_t, pid2, int, type,
_syscall5(int, sys_statx, int, dirfd, const char *, pathname, int, flags,
unsigned int, mask, struct target_statx *, statxbuf)
#endif
#if defined(TARGET_NR_membarrier) && defined(__NR_membarrier)
_syscall2(int, membarrier, int, cmd, int, flags)
#endif
static bitmask_transtbl fcntl_flags_tbl[] = {
{ TARGET_O_ACCMODE, TARGET_O_WRONLY, O_ACCMODE, O_WRONLY, },
@ -1560,7 +1564,11 @@ static inline abi_long target_to_host_cmsg(struct msghdr *msgh,
* something more intelligent than "twice the size of the
* target buffer we're reading from".
*/
gemu_log("Host cmsg overflow\n");
qemu_log_mask(LOG_UNIMP,
("Unsupported ancillary data %d/%d: "
"unhandled msg size\n"),
tswap32(target_cmsg->cmsg_level),
tswap32(target_cmsg->cmsg_type));
break;
}
@ -1590,8 +1598,8 @@ static inline abi_long target_to_host_cmsg(struct msghdr *msgh,
__get_user(cred->uid, &target_cred->uid);
__get_user(cred->gid, &target_cred->gid);
} else {
gemu_log("Unsupported ancillary data: %d/%d\n",
cmsg->cmsg_level, cmsg->cmsg_type);
qemu_log_mask(LOG_UNIMP, "Unsupported ancillary data: %d/%d\n",
cmsg->cmsg_level, cmsg->cmsg_type);
memcpy(data, target_data, len);
}
@ -1812,8 +1820,8 @@ static inline abi_long host_to_target_cmsg(struct target_msghdr *target_msgh,
default:
unimplemented:
gemu_log("Unsupported ancillary data: %d/%d\n",
cmsg->cmsg_level, cmsg->cmsg_type);
qemu_log_mask(LOG_UNIMP, "Unsupported ancillary data: %d/%d\n",
cmsg->cmsg_level, cmsg->cmsg_type);
memcpy(target_data, data, MIN(len, tgt_len));
if (tgt_len > len) {
memset(target_data + len, 0, tgt_len - len);
@ -2288,7 +2296,8 @@ set_timeout:
#endif /* SOL_NETLINK */
default:
unimplemented:
gemu_log("Unsupported setsockopt level=%d optname=%d\n", level, optname);
qemu_log_mask(LOG_UNIMP, "Unsupported setsockopt level=%d optname=%d\n",
level, optname);
ret = -TARGET_ENOPROTOOPT;
}
return ret;
@ -2307,10 +2316,42 @@ static abi_long do_getsockopt(int sockfd, int level, int optname,
level = SOL_SOCKET;
switch (optname) {
/* These don't just return a single integer */
case TARGET_SO_RCVTIMEO:
case TARGET_SO_SNDTIMEO:
case TARGET_SO_PEERNAME:
goto unimplemented;
case TARGET_SO_RCVTIMEO: {
struct timeval tv;
socklen_t tvlen;
optname = SO_RCVTIMEO;
get_timeout:
if (get_user_u32(len, optlen)) {
return -TARGET_EFAULT;
}
if (len < 0) {
return -TARGET_EINVAL;
}
tvlen = sizeof(tv);
ret = get_errno(getsockopt(sockfd, level, optname,
&tv, &tvlen));
if (ret < 0) {
return ret;
}
if (len > sizeof(struct target_timeval)) {
len = sizeof(struct target_timeval);
}
if (copy_to_user_timeval(optval_addr, &tv)) {
return -TARGET_EFAULT;
}
if (put_user_u32(len, optlen)) {
return -TARGET_EFAULT;
}
break;
}
case TARGET_SO_SNDTIMEO:
optname = SO_SNDTIMEO;
goto get_timeout;
case TARGET_SO_PEERCRED: {
struct ucred cr;
socklen_t crlen;
@ -2663,8 +2704,9 @@ static abi_long do_getsockopt(int sockfd, int level, int optname,
#endif /* SOL_NETLINK */
default:
unimplemented:
gemu_log("getsockopt level=%d optname=%d not yet supported\n",
level, optname);
qemu_log_mask(LOG_UNIMP,
"getsockopt level=%d optname=%d not yet supported\n",
level, optname);
ret = -TARGET_EOPNOTSUPP;
break;
}
@ -3419,7 +3461,7 @@ static abi_long do_socketcall(int num, abi_ulong vptr)
case TARGET_SYS_SENDMMSG: /* sockfd, msgvec, vlen, flags */
return do_sendrecvmmsg(a[0], a[1], a[2], a[3], 1);
default:
gemu_log("Unsupported socketcall: %d\n", num);
qemu_log_mask(LOG_UNIMP, "Unsupported socketcall: %d\n", num);
return -TARGET_EINVAL;
}
}
@ -4330,7 +4372,8 @@ static abi_long do_ipc(CPUArchState *cpu_env,
ret = do_shmctl(first, second, ptr);
break;
default:
gemu_log("Unsupported ipc call: %d (version %d)\n", call, version);
qemu_log_mask(LOG_UNIMP, "Unsupported ipc call: %d (version %d)\n",
call, version);
ret = -TARGET_ENOSYS;
break;
}
@ -5178,7 +5221,8 @@ static abi_long do_ioctl(int fd, int cmd, abi_long arg)
ie = ioctl_entries;
for(;;) {
if (ie->target_cmd == 0) {
gemu_log("Unsupported ioctl: cmd=0x%04lx\n", (long)cmd);
qemu_log_mask(
LOG_UNIMP, "Unsupported ioctl: cmd=0x%04lx\n", (long)cmd);
return -TARGET_ENOSYS;
}
if (ie->target_cmd == cmd)
@ -5246,8 +5290,9 @@ static abi_long do_ioctl(int fd, int cmd, abi_long arg)
}
break;
default:
gemu_log("Unsupported ioctl type: cmd=0x%04lx type=%d\n",
(long)cmd, arg_type[0]);
qemu_log_mask(LOG_UNIMP,
"Unsupported ioctl type: cmd=0x%04lx type=%d\n",
(long)cmd, arg_type[0]);
ret = -TARGET_ENOSYS;
break;
}
@ -12090,6 +12135,10 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,
unlock_user(p, arg1, 0);
return ret;
#endif
#if defined TARGET_NR_membarrier && defined __NR_membarrier
case TARGET_NR_membarrier:
return get_errno(membarrier(arg1, arg2));
#endif
default:
qemu_log_mask(LOG_UNIMP, "Unsupported syscall: %d\n", num);
@ -12123,14 +12172,15 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
record_syscall_start(cpu, num, arg1,
arg2, arg3, arg4, arg5, arg6, arg7, arg8);
if (unlikely(do_strace)) {
if (unlikely(qemu_loglevel_mask(LOG_STRACE))) {
print_syscall(num, arg1, arg2, arg3, arg4, arg5, arg6);
ret = do_syscall1(cpu_env, num, arg1, arg2, arg3, arg4,
arg5, arg6, arg7, arg8);
}
ret = do_syscall1(cpu_env, num, arg1, arg2, arg3, arg4,
arg5, arg6, arg7, arg8);
if (unlikely(qemu_loglevel_mask(LOG_STRACE))) {
print_syscall_ret(num, ret);
} else {
ret = do_syscall1(cpu_env, num, arg1, arg2, arg3, arg4,
arg5, arg6, arg7, arg8);
}
record_syscall_return(cpu, num, ret);

View File

@ -2437,6 +2437,90 @@ 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;
};
struct target_snd_timer_ginfo {
struct target_snd_timer_id tid;
unsigned int flags;
int card;
unsigned char id[64];
unsigned char name[80];
abi_ulong reserved0;
abi_ulong resolution;
abi_ulong resolution_min;
abi_ulong resolution_max;
unsigned int clients;
unsigned char reserved[32];
};
struct target_snd_timer_gparams {
struct target_snd_timer_id tid;
abi_ulong period_num;
abi_ulong period_den;
unsigned char reserved[32];
};
struct target_snd_timer_gstatus {
struct target_snd_timer_id tid;
abi_ulong resolution;
abi_ulong resolution_num;
abi_ulong resolution_den;
unsigned char reserved[32];
};
struct target_snd_timer_select {
struct target_snd_timer_id id;
unsigned char reserved[32];
};
struct target_snd_timer_info {
unsigned int flags;
int card;
unsigned char id[64];
unsigned char name[80];
abi_ulong reserved0;
abi_ulong resolution;
unsigned char reserved[64];
};
struct target_snd_timer_status {
struct target_timespec tstamp;
unsigned int resolution;
unsigned int lost;
unsigned int overrun;
unsigned int queue;
unsigned char reserved[64];
};
/* 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_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)
#define TARGET_SNDRV_TIMER_IOCTL_PAUSE TARGET_IO('T', 0xa3)
/* vfat ioctls */
#define TARGET_VFAT_IOCTL_READDIR_BOTH TARGET_IORU('r', 1)
#define TARGET_VFAT_IOCTL_READDIR_SHORT TARGET_IORU('r', 2)

View File

@ -83,6 +83,72 @@ STRUCT(buffmem_desc,
STRUCT(mixer_info,
MK_ARRAY(TYPE_CHAR, 16), MK_ARRAY(TYPE_CHAR, 32), TYPE_INT, MK_ARRAY(TYPE_INT, 10))
STRUCT(snd_timer_id,
TYPE_INT, /* dev_class */
TYPE_INT, /* dev_sclass */
TYPE_INT, /* card */
TYPE_INT, /* device */
TYPE_INT) /* subdevice */
STRUCT(snd_timer_ginfo,
MK_STRUCT(STRUCT_snd_timer_id), /* tid */
TYPE_INT, /* flags */
TYPE_INT, /* card */
MK_ARRAY(TYPE_CHAR, 64), /* id */
MK_ARRAY(TYPE_CHAR, 80), /* name */
TYPE_ULONG, /* reserved0 */
TYPE_ULONG, /* resolution */
TYPE_ULONG, /* resolution_min */
TYPE_ULONG, /* resolution_max */
TYPE_INT, /* clients */
MK_ARRAY(TYPE_CHAR, 32)) /* reserved */
STRUCT(snd_timer_gparams,
MK_STRUCT(STRUCT_snd_timer_id), /* tid */
TYPE_ULONG, /* period_num */
TYPE_ULONG, /* period_den */
MK_ARRAY(TYPE_CHAR, 32)) /* reserved */
STRUCT(snd_timer_gstatus,
MK_STRUCT(STRUCT_snd_timer_id), /* tid */
TYPE_ULONG, /* resolution */
TYPE_ULONG, /* resolution_num */
TYPE_ULONG, /* resolution_den */
MK_ARRAY(TYPE_CHAR, 32)) /* reserved */
STRUCT(snd_timer_select,
MK_STRUCT(STRUCT_snd_timer_id), /* id */
MK_ARRAY(TYPE_CHAR, 32)) /* reserved */
STRUCT(snd_timer_info,
TYPE_INT, /* flags */
TYPE_INT, /* card */
MK_ARRAY(TYPE_CHAR, 64), /* id */
MK_ARRAY(TYPE_CHAR, 80), /* name */
TYPE_ULONG, /* reserved0 */
TYPE_ULONG, /* resolution */
MK_ARRAY(TYPE_CHAR, 64)) /* reserved */
STRUCT(snd_timer_params,
TYPE_INT, /* flags */
TYPE_INT, /* ticks */
TYPE_INT, /* queue_size */
TYPE_INT, /* reserved0 */
TYPE_INT, /* filter */
MK_ARRAY(TYPE_CHAR, 60)) /* reserved */
STRUCT(timespec,
TYPE_LONG, /* tv_sec */
TYPE_LONG) /* tv_nsec */
STRUCT(snd_timer_status,
MK_STRUCT(STRUCT_timespec), /* tstamp */
TYPE_INT, /* resolution */
TYPE_INT, /* lost */
TYPE_INT, /* overrun */
TYPE_INT, /* queue */
MK_ARRAY(TYPE_CHAR, 64)) /* reserved */
/* loop device ioctls */
STRUCT(loop_info,
TYPE_INT, /* lo_number */

View File

@ -402,7 +402,8 @@ int do_vm86(CPUX86State *env, long subfunction, abi_ulong vm86_addr)
case TARGET_VM86_FREE_IRQ:
case TARGET_VM86_GET_IRQ_BITS:
case TARGET_VM86_GET_AND_RESET_IRQ:
gemu_log("qemu: unsupported vm86 subfunction (%ld)\n", subfunction);
qemu_log_mask(LOG_UNIMP, "qemu: unsupported vm86 subfunction (%ld)\n",
subfunction);
ret = -TARGET_EINVAL;
goto out;
case TARGET_VM86_PLUS_INSTALL_CHECK:

View File

@ -332,6 +332,8 @@ const QEMULogItem qemu_log_items[] = {
#ifdef CONFIG_PLUGIN
{ CPU_LOG_PLUGIN, "plugin", "output from TCG plugins\n"},
#endif
{ LOG_STRACE, "strace",
"log every user-mode syscall, its input, and its result" },
{ 0, NULL, NULL },
};