Compare commits
40 Commits
qemu-0888a
...
pull-usb-3
Author | SHA1 | Date | |
---|---|---|---|
|
d6bb65fcd2 | ||
|
4f9cc73422 | ||
|
cc03ff9d0a | ||
|
786ad214c7 | ||
|
c348e48175 | ||
|
f6969b9fef | ||
|
bd93976a1a | ||
|
46eef33b89 | ||
|
0dbcf95a1e | ||
|
078a1c37ca | ||
|
44e3a39f30 | ||
|
90ce3d76eb | ||
|
a50f98b066 | ||
|
88c1ee73d3 | ||
|
5556332aba | ||
|
b33276a7a8 | ||
|
24c84e687e | ||
|
262471794d | ||
|
62dc90c668 | ||
|
21684af023 | ||
|
3f281822b2 | ||
|
c1570e2a1f | ||
|
a63e5e0c0d | ||
|
0c5e94ee83 | ||
|
dd67fa5052 | ||
|
57b6bdf37c | ||
|
cc67f4d1f9 | ||
|
2aa4a86f59 | ||
|
18968ca1a3 | ||
|
e001807847 | ||
|
39a611a3e0 | ||
|
28f106afb3 | ||
|
ee13ed1cbc | ||
|
1a838745b8 | ||
|
933b19ea97 | ||
|
5631e69c26 | ||
|
736d120af4 | ||
|
b4dd99a363 | ||
|
b4160af160 | ||
|
e527526d35 |
150
.gitignore
vendored
150
.gitignore
vendored
@@ -1,64 +1,64 @@
|
||||
config-devices.*
|
||||
config-all-devices.*
|
||||
config-all-disas.*
|
||||
config-host.*
|
||||
config-target.*
|
||||
config.status
|
||||
trace/generated-tracers.h
|
||||
trace/generated-tracers.c
|
||||
trace/generated-tracers-dtrace.h
|
||||
trace/generated-tracers.dtrace
|
||||
trace/generated-events.h
|
||||
trace/generated-events.c
|
||||
libcacard/trace/generated-tracers.c
|
||||
/config-devices.*
|
||||
/config-all-devices.*
|
||||
/config-all-disas.*
|
||||
/config-host.*
|
||||
/config-target.*
|
||||
/config.status
|
||||
/trace/generated-tracers.h
|
||||
/trace/generated-tracers.c
|
||||
/trace/generated-tracers-dtrace.h
|
||||
/trace/generated-tracers.dtrace
|
||||
/trace/generated-events.h
|
||||
/trace/generated-events.c
|
||||
/libcacard/trace/generated-tracers.c
|
||||
*-timestamp
|
||||
*-softmmu
|
||||
*-darwin-user
|
||||
*-linux-user
|
||||
*-bsd-user
|
||||
/*-softmmu
|
||||
/*-darwin-user
|
||||
/*-linux-user
|
||||
/*-bsd-user
|
||||
libdis*
|
||||
libuser
|
||||
linux-headers/asm
|
||||
qapi-generated
|
||||
qapi-types.[ch]
|
||||
qapi-visit.[ch]
|
||||
qmp-commands.h
|
||||
qmp-marshal.c
|
||||
qemu-doc.html
|
||||
qemu-tech.html
|
||||
qemu-doc.info
|
||||
qemu-tech.info
|
||||
qemu.1
|
||||
qemu.pod
|
||||
qemu-img.1
|
||||
qemu-img.pod
|
||||
qemu-img
|
||||
qemu-nbd
|
||||
qemu-nbd.8
|
||||
qemu-nbd.pod
|
||||
qemu-options.def
|
||||
qemu-options.texi
|
||||
qemu-img-cmds.texi
|
||||
qemu-img-cmds.h
|
||||
qemu-io
|
||||
qemu-ga
|
||||
qemu-bridge-helper
|
||||
qemu-monitor.texi
|
||||
vscclient
|
||||
qmp-commands.txt
|
||||
test-bitops
|
||||
test-coroutine
|
||||
test-int128
|
||||
test-opts-visitor
|
||||
test-qmp-input-visitor
|
||||
test-qmp-output-visitor
|
||||
test-string-input-visitor
|
||||
test-string-output-visitor
|
||||
test-visitor-serialization
|
||||
fsdev/virtfs-proxy-helper
|
||||
fsdev/virtfs-proxy-helper.1
|
||||
fsdev/virtfs-proxy-helper.pod
|
||||
.gdbinit
|
||||
/linux-headers/asm
|
||||
/qapi-generated
|
||||
/qapi-types.[ch]
|
||||
/qapi-visit.[ch]
|
||||
/qmp-commands.h
|
||||
/qmp-marshal.c
|
||||
/qemu-doc.html
|
||||
/qemu-tech.html
|
||||
/qemu-doc.info
|
||||
/qemu-tech.info
|
||||
/qemu.1
|
||||
/qemu.pod
|
||||
/qemu-img.1
|
||||
/qemu-img.pod
|
||||
/qemu-img
|
||||
/qemu-nbd
|
||||
/qemu-nbd.8
|
||||
/qemu-nbd.pod
|
||||
/qemu-options.def
|
||||
/qemu-options.texi
|
||||
/qemu-img-cmds.texi
|
||||
/qemu-img-cmds.h
|
||||
/qemu-io
|
||||
/qemu-ga
|
||||
/qemu-bridge-helper
|
||||
/qemu-monitor.texi
|
||||
/qmp-commands.txt
|
||||
/vscclient
|
||||
/test-bitops
|
||||
/test-coroutine
|
||||
/test-int128
|
||||
/test-opts-visitor
|
||||
/test-qmp-input-visitor
|
||||
/test-qmp-output-visitor
|
||||
/test-string-input-visitor
|
||||
/test-string-output-visitor
|
||||
/test-visitor-serialization
|
||||
/fsdev/virtfs-proxy-helper
|
||||
/fsdev/virtfs-proxy-helper.1
|
||||
/fsdev/virtfs-proxy-helper.pod
|
||||
/.gdbinit
|
||||
*.a
|
||||
*.aux
|
||||
*.cp
|
||||
@@ -77,7 +77,7 @@ fsdev/virtfs-proxy-helper.pod
|
||||
*.tp
|
||||
*.vr
|
||||
*.d
|
||||
!scripts/qemu-guest-agent/fsfreeze-hook.d
|
||||
!/scripts/qemu-guest-agent/fsfreeze-hook.d
|
||||
*.o
|
||||
*.lo
|
||||
*.la
|
||||
@@ -90,22 +90,22 @@ fsdev/virtfs-proxy-helper.pod
|
||||
*.gcda
|
||||
*.gcno
|
||||
patches
|
||||
pc-bios/bios-pq/status
|
||||
pc-bios/vgabios-pq/status
|
||||
pc-bios/optionrom/linuxboot.asm
|
||||
pc-bios/optionrom/linuxboot.bin
|
||||
pc-bios/optionrom/linuxboot.raw
|
||||
pc-bios/optionrom/linuxboot.img
|
||||
pc-bios/optionrom/multiboot.asm
|
||||
pc-bios/optionrom/multiboot.bin
|
||||
pc-bios/optionrom/multiboot.raw
|
||||
pc-bios/optionrom/multiboot.img
|
||||
pc-bios/optionrom/kvmvapic.asm
|
||||
pc-bios/optionrom/kvmvapic.bin
|
||||
pc-bios/optionrom/kvmvapic.raw
|
||||
pc-bios/optionrom/kvmvapic.img
|
||||
pc-bios/s390-ccw/s390-ccw.elf
|
||||
pc-bios/s390-ccw/s390-ccw.img
|
||||
/pc-bios/bios-pq/status
|
||||
/pc-bios/vgabios-pq/status
|
||||
/pc-bios/optionrom/linuxboot.asm
|
||||
/pc-bios/optionrom/linuxboot.bin
|
||||
/pc-bios/optionrom/linuxboot.raw
|
||||
/pc-bios/optionrom/linuxboot.img
|
||||
/pc-bios/optionrom/multiboot.asm
|
||||
/pc-bios/optionrom/multiboot.bin
|
||||
/pc-bios/optionrom/multiboot.raw
|
||||
/pc-bios/optionrom/multiboot.img
|
||||
/pc-bios/optionrom/kvmvapic.asm
|
||||
/pc-bios/optionrom/kvmvapic.bin
|
||||
/pc-bios/optionrom/kvmvapic.raw
|
||||
/pc-bios/optionrom/kvmvapic.img
|
||||
/pc-bios/s390-ccw/s390-ccw.elf
|
||||
/pc-bios/s390-ccw/s390-ccw.img
|
||||
.stgit-*
|
||||
cscope.*
|
||||
tags
|
||||
|
36
block.c
36
block.c
@@ -796,6 +796,13 @@ static int bdrv_assign_node_name(BlockDriverState *bs,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* takes care of avoiding namespaces collisions */
|
||||
if (bdrv_find(node_name)) {
|
||||
error_setg(errp, "node-name=%s is conflicting with a device id",
|
||||
node_name);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* takes care of avoiding duplicates node names */
|
||||
if (bdrv_find_node(node_name)) {
|
||||
error_setg(errp, "Duplicate node name");
|
||||
@@ -977,9 +984,8 @@ int bdrv_file_open(BlockDriverState **pbs, const char *filename,
|
||||
}
|
||||
QDECREF(options);
|
||||
|
||||
bs = bdrv_find(reference);
|
||||
bs = bdrv_lookup_bs(reference, reference, errp);
|
||||
if (!bs) {
|
||||
error_setg(errp, "Cannot find block device '%s'", reference);
|
||||
return -ENODEV;
|
||||
}
|
||||
bdrv_ref(bs);
|
||||
@@ -3574,30 +3580,26 @@ BlockDriverState *bdrv_lookup_bs(const char *device,
|
||||
{
|
||||
BlockDriverState *bs = NULL;
|
||||
|
||||
if ((!device && !node_name) || (device && node_name)) {
|
||||
error_setg(errp, "Use either device or node-name but not both");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (device) {
|
||||
bs = bdrv_find(device);
|
||||
|
||||
if (!bs) {
|
||||
error_set(errp, QERR_DEVICE_NOT_FOUND, device);
|
||||
return NULL;
|
||||
if (bs) {
|
||||
return bs;
|
||||
}
|
||||
|
||||
return bs;
|
||||
}
|
||||
|
||||
bs = bdrv_find_node(node_name);
|
||||
if (node_name) {
|
||||
bs = bdrv_find_node(node_name);
|
||||
|
||||
if (!bs) {
|
||||
error_set(errp, QERR_DEVICE_NOT_FOUND, node_name);
|
||||
return NULL;
|
||||
if (bs) {
|
||||
return bs;
|
||||
}
|
||||
}
|
||||
|
||||
return bs;
|
||||
error_setg(errp, "Cannot find device=%s nor node_name=%s",
|
||||
device ? device : "",
|
||||
node_name ? node_name : "");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
BlockDriverState *bdrv_next(BlockDriverState *bs)
|
||||
|
@@ -1099,6 +1099,10 @@ fail:
|
||||
/*
|
||||
* We support iscsi url's on the form
|
||||
* iscsi://[<username>%<password>@]<host>[:<port>]/<targetname>/<lun>
|
||||
*
|
||||
* Note: flags are currently not used by iscsi_open. If this function
|
||||
* is changed such that flags are used, please examine iscsi_reopen_prepare()
|
||||
* to see if needs to be changed as well.
|
||||
*/
|
||||
static int iscsi_open(BlockDriverState *bs, QDict *options, int flags,
|
||||
Error **errp)
|
||||
@@ -1336,11 +1340,13 @@ static int iscsi_refresh_limits(BlockDriverState *bs)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* We have nothing to do for iSCSI reopen, stub just returns
|
||||
* success */
|
||||
/* Since iscsi_open() ignores bdrv_flags, there is nothing to do here in
|
||||
* prepare. Note that this will not re-establish a connection with an iSCSI
|
||||
* target - it is effectively a NOP. */
|
||||
static int iscsi_reopen_prepare(BDRVReopenState *state,
|
||||
BlockReopenQueue *queue, Error **errp)
|
||||
{
|
||||
/* NOP */
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@@ -633,6 +633,8 @@ void commit_active_start(BlockDriverState *bs, BlockDriverState *base,
|
||||
{
|
||||
int64_t length, base_length;
|
||||
int orig_base_flags;
|
||||
int ret;
|
||||
Error *local_err = NULL;
|
||||
|
||||
orig_base_flags = bdrv_get_flags(base);
|
||||
|
||||
@@ -642,19 +644,23 @@ void commit_active_start(BlockDriverState *bs, BlockDriverState *base,
|
||||
|
||||
length = bdrv_getlength(bs);
|
||||
if (length < 0) {
|
||||
error_setg(errp, "Unable to determine length of %s", bs->filename);
|
||||
error_setg_errno(errp, -length,
|
||||
"Unable to determine length of %s", bs->filename);
|
||||
goto error_restore_flags;
|
||||
}
|
||||
|
||||
base_length = bdrv_getlength(base);
|
||||
if (base_length < 0) {
|
||||
error_setg(errp, "Unable to determine length of %s", base->filename);
|
||||
error_setg_errno(errp, -base_length,
|
||||
"Unable to determine length of %s", base->filename);
|
||||
goto error_restore_flags;
|
||||
}
|
||||
|
||||
if (length > base_length) {
|
||||
if (bdrv_truncate(base, length) < 0) {
|
||||
error_setg(errp, "Top image %s is larger than base image %s, and "
|
||||
ret = bdrv_truncate(base, length);
|
||||
if (ret < 0) {
|
||||
error_setg_errno(errp, -ret,
|
||||
"Top image %s is larger than base image %s, and "
|
||||
"resize of base image failed",
|
||||
bs->filename, base->filename);
|
||||
goto error_restore_flags;
|
||||
@@ -663,9 +669,10 @@ void commit_active_start(BlockDriverState *bs, BlockDriverState *base,
|
||||
|
||||
bdrv_ref(base);
|
||||
mirror_start_job(bs, base, speed, 0, 0,
|
||||
on_error, on_error, cb, opaque, errp,
|
||||
on_error, on_error, cb, opaque, &local_err,
|
||||
&commit_active_job_driver, false, base);
|
||||
if (error_is_set(errp)) {
|
||||
if (error_is_set(&local_err)) {
|
||||
error_propagate(errp, local_err);
|
||||
goto error_restore_flags;
|
||||
}
|
||||
|
||||
|
@@ -606,7 +606,8 @@ int qcow2_snapshot_delete(BlockDriverState *bs,
|
||||
s->nb_snapshots--;
|
||||
ret = qcow2_write_snapshots(bs);
|
||||
if (ret < 0) {
|
||||
error_setg(errp, "Failed to remove snapshot from snapshot list");
|
||||
error_setg_errno(errp, -ret,
|
||||
"Failed to remove snapshot from snapshot list");
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -624,7 +625,7 @@ int qcow2_snapshot_delete(BlockDriverState *bs,
|
||||
ret = qcow2_update_snapshot_refcount(bs, sn.l1_table_offset,
|
||||
sn.l1_size, -1);
|
||||
if (ret < 0) {
|
||||
error_setg(errp, "Failed to free the cluster and L1 table");
|
||||
error_setg_errno(errp, -ret, "Failed to free the cluster and L1 table");
|
||||
return ret;
|
||||
}
|
||||
qcow2_free_clusters(bs, sn.l1_table_offset, sn.l1_size * sizeof(uint64_t),
|
||||
@@ -633,7 +634,8 @@ int qcow2_snapshot_delete(BlockDriverState *bs,
|
||||
/* must update the copied flag on the current cluster offsets */
|
||||
ret = qcow2_update_snapshot_refcount(bs, s->l1_table_offset, s->l1_size, 0);
|
||||
if (ret < 0) {
|
||||
error_setg(errp, "Failed to update snapshot status in disk");
|
||||
error_setg_errno(errp, -ret,
|
||||
"Failed to update snapshot status in disk");
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@@ -1502,7 +1502,7 @@ static int vmdk_create_extent(const char *filename, int64_t filesize,
|
||||
if (flat) {
|
||||
ret = bdrv_truncate(bs, filesize);
|
||||
if (ret < 0) {
|
||||
error_setg(errp, "Could not truncate file");
|
||||
error_setg_errno(errp, -ret, "Could not truncate file");
|
||||
}
|
||||
goto exit;
|
||||
}
|
||||
@@ -1562,7 +1562,7 @@ static int vmdk_create_extent(const char *filename, int64_t filesize,
|
||||
|
||||
ret = bdrv_truncate(bs, le64_to_cpu(header.grain_offset) << 9);
|
||||
if (ret < 0) {
|
||||
error_setg(errp, "Could not truncate file");
|
||||
error_setg_errno(errp, -ret, "Could not truncate file");
|
||||
goto exit;
|
||||
}
|
||||
|
||||
@@ -1846,7 +1846,7 @@ static int vmdk_create(const char *filename, QEMUOptionParameter *options,
|
||||
if (desc_offset == 0) {
|
||||
ret = bdrv_truncate(new_bs, desc_len);
|
||||
if (ret < 0) {
|
||||
error_setg(errp, "Could not truncate file");
|
||||
error_setg_errno(errp, -ret, "Could not truncate file");
|
||||
}
|
||||
}
|
||||
exit:
|
||||
|
55
blockdev.c
55
blockdev.c
@@ -308,7 +308,6 @@ typedef enum { MEDIA_DISK, MEDIA_CDROM } DriveMediaType;
|
||||
|
||||
/* Takes the ownership of bs_opts */
|
||||
static DriveInfo *blockdev_init(const char *file, QDict *bs_opts,
|
||||
BlockInterfaceType type,
|
||||
Error **errp)
|
||||
{
|
||||
const char *buf;
|
||||
@@ -437,11 +436,6 @@ static DriveInfo *blockdev_init(const char *file, QDict *bs_opts,
|
||||
|
||||
on_write_error = BLOCKDEV_ON_ERROR_ENOSPC;
|
||||
if ((buf = qemu_opt_get(opts, "werror")) != NULL) {
|
||||
if (type != IF_IDE && type != IF_SCSI && type != IF_VIRTIO && type != IF_NONE) {
|
||||
error_setg(errp, "werror is not supported by this bus type");
|
||||
goto early_err;
|
||||
}
|
||||
|
||||
on_write_error = parse_block_error_action(buf, 0, &error);
|
||||
if (error_is_set(&error)) {
|
||||
error_propagate(errp, error);
|
||||
@@ -451,11 +445,6 @@ static DriveInfo *blockdev_init(const char *file, QDict *bs_opts,
|
||||
|
||||
on_read_error = BLOCKDEV_ON_ERROR_REPORT;
|
||||
if ((buf = qemu_opt_get(opts, "rerror")) != NULL) {
|
||||
if (type != IF_IDE && type != IF_VIRTIO && type != IF_SCSI && type != IF_NONE) {
|
||||
error_report("rerror is not supported by this bus type");
|
||||
goto early_err;
|
||||
}
|
||||
|
||||
on_read_error = parse_block_error_action(buf, 1, &error);
|
||||
if (error_is_set(&error)) {
|
||||
error_propagate(errp, error);
|
||||
@@ -463,13 +452,18 @@ static DriveInfo *blockdev_init(const char *file, QDict *bs_opts,
|
||||
}
|
||||
}
|
||||
|
||||
if (bdrv_find_node(qemu_opts_id(opts))) {
|
||||
error_setg(errp, "device id=%s is conflicting with a node-name",
|
||||
qemu_opts_id(opts));
|
||||
goto early_err;
|
||||
}
|
||||
|
||||
/* init */
|
||||
dinfo = g_malloc0(sizeof(*dinfo));
|
||||
dinfo->id = g_strdup(qemu_opts_id(opts));
|
||||
dinfo->bdrv = bdrv_new(dinfo->id);
|
||||
dinfo->bdrv->open_flags = snapshot ? BDRV_O_SNAPSHOT : 0;
|
||||
dinfo->bdrv->read_only = ro;
|
||||
dinfo->type = type;
|
||||
dinfo->refcount = 1;
|
||||
if (serial != NULL) {
|
||||
dinfo->serial = g_strdup(serial);
|
||||
@@ -608,6 +602,14 @@ QemuOptsList qemu_legacy_drive_opts = {
|
||||
.name = "read-only",
|
||||
.type = QEMU_OPT_BOOL,
|
||||
.help = "open drive file as read-only",
|
||||
},{
|
||||
.name = "rerror",
|
||||
.type = QEMU_OPT_STRING,
|
||||
.help = "read error action",
|
||||
},{
|
||||
.name = "werror",
|
||||
.type = QEMU_OPT_STRING,
|
||||
.help = "write error action",
|
||||
},{
|
||||
.name = "copy-on-read",
|
||||
.type = QEMU_OPT_BOOL,
|
||||
@@ -629,6 +631,7 @@ DriveInfo *drive_init(QemuOpts *all_opts, BlockInterfaceType block_default_type)
|
||||
int cyls, heads, secs, translation;
|
||||
int max_devs, bus_id, unit_id, index;
|
||||
const char *devaddr;
|
||||
const char *werror, *rerror;
|
||||
bool read_only = false;
|
||||
bool copy_on_read;
|
||||
const char *filename;
|
||||
@@ -872,8 +875,29 @@ DriveInfo *drive_init(QemuOpts *all_opts, BlockInterfaceType block_default_type)
|
||||
|
||||
filename = qemu_opt_get(legacy_opts, "file");
|
||||
|
||||
/* Check werror/rerror compatibility with if=... */
|
||||
werror = qemu_opt_get(legacy_opts, "werror");
|
||||
if (werror != NULL) {
|
||||
if (type != IF_IDE && type != IF_SCSI && type != IF_VIRTIO &&
|
||||
type != IF_NONE) {
|
||||
error_report("werror is not supported by this bus type");
|
||||
goto fail;
|
||||
}
|
||||
qdict_put(bs_opts, "werror", qstring_from_str(werror));
|
||||
}
|
||||
|
||||
rerror = qemu_opt_get(legacy_opts, "rerror");
|
||||
if (rerror != NULL) {
|
||||
if (type != IF_IDE && type != IF_VIRTIO && type != IF_SCSI &&
|
||||
type != IF_NONE) {
|
||||
error_report("rerror is not supported by this bus type");
|
||||
goto fail;
|
||||
}
|
||||
qdict_put(bs_opts, "rerror", qstring_from_str(rerror));
|
||||
}
|
||||
|
||||
/* Actual block device init: Functionality shared with blockdev-add */
|
||||
dinfo = blockdev_init(filename, bs_opts, type, &local_err);
|
||||
dinfo = blockdev_init(filename, bs_opts, &local_err);
|
||||
if (dinfo == NULL) {
|
||||
if (error_is_set(&local_err)) {
|
||||
qerror_report_err(local_err);
|
||||
@@ -893,6 +917,7 @@ DriveInfo *drive_init(QemuOpts *all_opts, BlockInterfaceType block_default_type)
|
||||
dinfo->secs = secs;
|
||||
dinfo->trans = translation;
|
||||
|
||||
dinfo->type = type;
|
||||
dinfo->bus = bus_id;
|
||||
dinfo->unit = unit_id;
|
||||
dinfo->devaddr = devaddr;
|
||||
@@ -1310,8 +1335,6 @@ static void external_snapshot_prepare(BlkTransactionState *common,
|
||||
if (ret != 0) {
|
||||
error_propagate(errp, local_err);
|
||||
}
|
||||
|
||||
QDECREF(options);
|
||||
}
|
||||
|
||||
static void external_snapshot_commit(BlkTransactionState *common)
|
||||
@@ -2276,7 +2299,7 @@ void qmp_blockdev_add(BlockdevOptions *options, Error **errp)
|
||||
|
||||
qdict_flatten(qdict);
|
||||
|
||||
blockdev_init(NULL, qdict, IF_NONE, &local_err);
|
||||
blockdev_init(NULL, qdict, &local_err);
|
||||
if (error_is_set(&local_err)) {
|
||||
error_propagate(errp, local_err);
|
||||
goto fail;
|
||||
|
79
configure
vendored
79
configure
vendored
@@ -1392,6 +1392,11 @@ EOF
|
||||
pie="no"
|
||||
fi
|
||||
fi
|
||||
|
||||
if compile_prog "-fno-pie" "-nopie"; then
|
||||
CFLAGS_NOPIE="-fno-pie"
|
||||
LDFLAGS_NOPIE="-nopie"
|
||||
fi
|
||||
fi
|
||||
|
||||
##########################################
|
||||
@@ -1474,9 +1479,11 @@ esac
|
||||
|
||||
feature_not_found() {
|
||||
feature=$1
|
||||
remedy=$2
|
||||
|
||||
error_exit "User requested feature $feature" \
|
||||
"configure was not able to find it"
|
||||
"configure was not able to find it." \
|
||||
"$remedy"
|
||||
}
|
||||
|
||||
# ---
|
||||
@@ -1524,7 +1531,7 @@ int main(void) {
|
||||
}
|
||||
EOF
|
||||
if ! compile_object ; then
|
||||
feature_not_found "nptl"
|
||||
feature_not_found "nptl" "Install glibc and linux kernel headers."
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -1555,7 +1562,7 @@ if test "$seccomp" != "no" ; then
|
||||
seccomp="yes"
|
||||
else
|
||||
if test "$seccomp" = "yes"; then
|
||||
feature_not_found "libseccomp"
|
||||
feature_not_found "libseccomp" "Install libseccomp devel >= 2.1.0"
|
||||
fi
|
||||
seccomp="no"
|
||||
fi
|
||||
@@ -1580,7 +1587,7 @@ EOF
|
||||
if ! compile_prog "" "$xen_libs" ; then
|
||||
# Xen not found
|
||||
if test "$xen" = "yes" ; then
|
||||
feature_not_found "xen"
|
||||
feature_not_found "xen" "Install xen devel"
|
||||
fi
|
||||
xen=no
|
||||
|
||||
@@ -1703,7 +1710,7 @@ EOF
|
||||
# Xen version unsupported
|
||||
else
|
||||
if test "$xen" = "yes" ; then
|
||||
feature_not_found "xen (unsupported version)"
|
||||
feature_not_found "xen (unsupported version)" "Install supported xen (e.g. 4.0, 3.4, 3.3)"
|
||||
fi
|
||||
xen=no
|
||||
fi
|
||||
@@ -1752,7 +1759,7 @@ if test "$sparse" != "no" ; then
|
||||
sparse=yes
|
||||
else
|
||||
if test "$sparse" = "yes" ; then
|
||||
feature_not_found "sparse"
|
||||
feature_not_found "sparse" "Install sparse binary"
|
||||
fi
|
||||
sparse=no
|
||||
fi
|
||||
@@ -1774,7 +1781,7 @@ if test "$gtk" != "no"; then
|
||||
fi
|
||||
if ! $pkg_config --exists "$gtkpackage >= $gtkversion"; then
|
||||
if test "$gtk" = "yes" ; then
|
||||
feature_not_found "gtk"
|
||||
feature_not_found "gtk" "Install gtk2 or gtk3 (requires --with-gtkabi=3.0 option to configure) devel"
|
||||
fi
|
||||
gtk="no"
|
||||
elif ! $pkg_config --exists "$vtepackage >= $vteversion"; then
|
||||
@@ -1809,7 +1816,7 @@ elif has ${sdl_config}; then
|
||||
_sdlversion=`$sdlconfig --version | sed 's/[^0-9]//g'`
|
||||
else
|
||||
if test "$sdl" = "yes" ; then
|
||||
feature_not_found "sdl"
|
||||
feature_not_found "sdl" "Install SDL devel"
|
||||
fi
|
||||
sdl=no
|
||||
fi
|
||||
@@ -1853,7 +1860,7 @@ EOF
|
||||
fi # static link
|
||||
else # sdl not found
|
||||
if test "$sdl" = "yes" ; then
|
||||
feature_not_found "sdl"
|
||||
feature_not_found "sdl" "Install SDL devel"
|
||||
fi
|
||||
sdl=no
|
||||
fi # sdl compile test
|
||||
@@ -1919,10 +1926,10 @@ EOF
|
||||
QEMU_CFLAGS="$QEMU_CFLAGS $vnc_tls_cflags"
|
||||
else
|
||||
if test "$vnc_tls" = "yes" ; then
|
||||
feature_not_found "vnc-tls"
|
||||
feature_not_found "vnc-tls" "Install gnutls devel"
|
||||
fi
|
||||
if test "$vnc_ws" = "yes" ; then
|
||||
feature_not_found "vnc-ws"
|
||||
feature_not_found "vnc-ws" "Install gnutls devel"
|
||||
fi
|
||||
vnc_tls=no
|
||||
vnc_ws=no
|
||||
@@ -1946,7 +1953,7 @@ EOF
|
||||
QEMU_CFLAGS="$QEMU_CFLAGS $vnc_sasl_cflags"
|
||||
else
|
||||
if test "$vnc_sasl" = "yes" ; then
|
||||
feature_not_found "vnc-sasl"
|
||||
feature_not_found "vnc-sasl" "Install Cyrus SASL devel"
|
||||
fi
|
||||
vnc_sasl=no
|
||||
fi
|
||||
@@ -1968,7 +1975,7 @@ EOF
|
||||
QEMU_CFLAGS="$QEMU_CFLAGS $vnc_jpeg_cflags"
|
||||
else
|
||||
if test "$vnc_jpeg" = "yes" ; then
|
||||
feature_not_found "vnc-jpeg"
|
||||
feature_not_found "vnc-jpeg" "Install libjpeg-turbo devel"
|
||||
fi
|
||||
vnc_jpeg=no
|
||||
fi
|
||||
@@ -2000,7 +2007,7 @@ EOF
|
||||
QEMU_CFLAGS="$QEMU_CFLAGS $vnc_png_cflags"
|
||||
else
|
||||
if test "$vnc_png" = "yes" ; then
|
||||
feature_not_found "vnc-png"
|
||||
feature_not_found "vnc-png" "Install libpng devel"
|
||||
fi
|
||||
vnc_png=no
|
||||
fi
|
||||
@@ -2044,7 +2051,7 @@ EOF
|
||||
libs_tools="$uuid_libs $libs_tools"
|
||||
else
|
||||
if test "$uuid" = "yes" ; then
|
||||
feature_not_found "uuid"
|
||||
feature_not_found "uuid" "Install libuuid devel"
|
||||
fi
|
||||
uuid=no
|
||||
fi
|
||||
@@ -2078,7 +2085,7 @@ EOF
|
||||
xfs="yes"
|
||||
else
|
||||
if test "$xfs" = "yes" ; then
|
||||
feature_not_found "xfs"
|
||||
feature_not_found "xfs" "Instal xfsprogs/xfslibs devel"
|
||||
fi
|
||||
xfs=no
|
||||
fi
|
||||
@@ -2104,7 +2111,7 @@ EOF
|
||||
libs_tools="$vde_libs $libs_tools"
|
||||
else
|
||||
if test "$vde" = "yes" ; then
|
||||
feature_not_found "vde"
|
||||
feature_not_found "vde" "Install vde (Virtual Distributed Ethernet) devel"
|
||||
fi
|
||||
vde=no
|
||||
fi
|
||||
@@ -2147,7 +2154,7 @@ EOF
|
||||
libs_tools="$cap_libs $libs_tools"
|
||||
else
|
||||
if test "$cap_ng" = "yes" ; then
|
||||
feature_not_found "cap_ng"
|
||||
feature_not_found "cap_ng" "Install libcap-ng devel"
|
||||
fi
|
||||
cap_ng=no
|
||||
fi
|
||||
@@ -2252,7 +2259,7 @@ EOF
|
||||
libs_softmmu="$brlapi_libs $libs_softmmu"
|
||||
else
|
||||
if test "$brlapi" = "yes" ; then
|
||||
feature_not_found "brlapi"
|
||||
feature_not_found "brlapi" "Install brlapi devel"
|
||||
fi
|
||||
brlapi=no
|
||||
fi
|
||||
@@ -2289,7 +2296,7 @@ EOF
|
||||
curses=yes
|
||||
else
|
||||
if test "$curses" = "yes" ; then
|
||||
feature_not_found "curses"
|
||||
feature_not_found "curses" "Install ncurses devel"
|
||||
fi
|
||||
curses=no
|
||||
fi
|
||||
@@ -2315,7 +2322,7 @@ EOF
|
||||
libs_softmmu="$curl_libs $libs_softmmu"
|
||||
else
|
||||
if test "$curl" = "yes" ; then
|
||||
feature_not_found "curl"
|
||||
feature_not_found "curl" "Install libcurl devel"
|
||||
fi
|
||||
curl=no
|
||||
fi
|
||||
@@ -2335,7 +2342,7 @@ EOF
|
||||
libs_softmmu="$bluez_libs $libs_softmmu"
|
||||
else
|
||||
if test "$bluez" = "yes" ; then
|
||||
feature_not_found "bluez"
|
||||
feature_not_found "bluez" "Install bluez-libs/libbluetooth devel"
|
||||
fi
|
||||
bluez="no"
|
||||
fi
|
||||
@@ -2471,7 +2478,7 @@ EOF
|
||||
libs_softmmu="$rbd_libs $libs_softmmu"
|
||||
else
|
||||
if test "$rbd" = "yes" ; then
|
||||
feature_not_found "rados block device"
|
||||
feature_not_found "rados block device" "Install librbd/ceph devel"
|
||||
fi
|
||||
rbd=no
|
||||
fi
|
||||
@@ -2537,7 +2544,7 @@ EOF
|
||||
libs_tools="$libs_tools -laio"
|
||||
else
|
||||
if test "$linux_aio" = "yes" ; then
|
||||
feature_not_found "linux AIO"
|
||||
feature_not_found "linux AIO" "Install libaio devel"
|
||||
fi
|
||||
linux_aio=no
|
||||
fi
|
||||
@@ -2585,7 +2592,7 @@ EOF
|
||||
libattr=yes
|
||||
else
|
||||
if test "$attr" = "yes" ; then
|
||||
feature_not_found "ATTR"
|
||||
feature_not_found "ATTR" "Install libc6 or libattr devel"
|
||||
fi
|
||||
attr=no
|
||||
fi
|
||||
@@ -2662,8 +2669,8 @@ EOF
|
||||
fdt_libs="-L\$(BUILD_DIR)/dtc/libfdt $fdt_libs"
|
||||
elif test "$fdt" = "yes" ; then
|
||||
# have neither and want - prompt for system/submodule install
|
||||
error_exit "DTC not present. Your options:" \
|
||||
" (1) Preferred: Install the DTC devel package" \
|
||||
error_exit "DTC (libfdt) not present. Your options:" \
|
||||
" (1) Preferred: Install the DTC (libfdt) devel package" \
|
||||
" (2) Fetch the DTC submodule, using:" \
|
||||
" git submodule update --init dtc"
|
||||
else
|
||||
@@ -2689,7 +2696,7 @@ EOF
|
||||
glx=yes
|
||||
else
|
||||
if test "$glx" = "yes" ; then
|
||||
feature_not_found "glx"
|
||||
feature_not_found "glx" "Install GL devel (e.g. MESA)"
|
||||
fi
|
||||
glx_libs=
|
||||
glx=no
|
||||
@@ -2714,7 +2721,7 @@ if test "$glusterfs" != "no" ; then
|
||||
fi
|
||||
else
|
||||
if test "$glusterfs" = "yes" ; then
|
||||
feature_not_found "GlusterFS backend support"
|
||||
feature_not_found "GlusterFS backend support" "Install glusterfs-api devel"
|
||||
fi
|
||||
glusterfs="no"
|
||||
fi
|
||||
@@ -3034,7 +3041,7 @@ if test "$docs" != "no" ; then
|
||||
docs=yes
|
||||
else
|
||||
if test "$docs" = "yes" ; then
|
||||
feature_not_found "docs"
|
||||
feature_not_found "docs" "Install texinfo and Perl/perl-podlators"
|
||||
fi
|
||||
docs=no
|
||||
fi
|
||||
@@ -3083,7 +3090,7 @@ EOF
|
||||
LIBS="$LIBS -liscsi"
|
||||
else
|
||||
if test "$libiscsi" = "yes" ; then
|
||||
feature_not_found "libiscsi"
|
||||
feature_not_found "libiscsi" "Install libiscsi devel"
|
||||
fi
|
||||
libiscsi="no"
|
||||
fi
|
||||
@@ -3167,7 +3174,7 @@ EOF
|
||||
spice_server_version=$($pkg_config --modversion spice-server)
|
||||
else
|
||||
if test "$spice" = "yes" ; then
|
||||
feature_not_found "spice"
|
||||
feature_not_found "spice" "Install spice-server and spice-protocol devel"
|
||||
fi
|
||||
spice="no"
|
||||
fi
|
||||
@@ -3217,7 +3224,7 @@ if test "$libusb" != "no" ; then
|
||||
libs_softmmu="$libs_softmmu $libusb_libs"
|
||||
else
|
||||
if test "$libusb" = "yes"; then
|
||||
feature_not_found "libusb"
|
||||
feature_not_found "libusb" "Install libusb devel"
|
||||
fi
|
||||
libusb="no"
|
||||
fi
|
||||
@@ -3233,7 +3240,7 @@ if test "$usb_redir" != "no" ; then
|
||||
libs_softmmu="$libs_softmmu $usb_redir_libs"
|
||||
else
|
||||
if test "$usb_redir" = "yes"; then
|
||||
feature_not_found "usb-redir"
|
||||
feature_not_found "usb-redir" "Install usbredir devel"
|
||||
fi
|
||||
usb_redir="no"
|
||||
fi
|
||||
@@ -4320,7 +4327,7 @@ if test "$trace_backend" = "ftrace"; then
|
||||
echo "CONFIG_TRACE_FTRACE=y" >> $config_host_mak
|
||||
trace_default=no
|
||||
else
|
||||
feature_not_found "ftrace(trace backend)"
|
||||
feature_not_found "ftrace(trace backend)" "ftrace requires Linux"
|
||||
fi
|
||||
fi
|
||||
echo "CONFIG_TRACE_FILE=$trace_file" >> $config_host_mak
|
||||
@@ -4376,6 +4383,7 @@ echo "LD=$ld" >> $config_host_mak
|
||||
echo "WINDRES=$windres" >> $config_host_mak
|
||||
echo "LIBTOOL=$libtool" >> $config_host_mak
|
||||
echo "CFLAGS=$CFLAGS" >> $config_host_mak
|
||||
echo "CFLAGS_NOPIE=$CFLAGS_NOPIE" >> $config_host_mak
|
||||
echo "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak
|
||||
echo "QEMU_INCLUDES=$QEMU_INCLUDES" >> $config_host_mak
|
||||
if test "$sparse" = "yes" ; then
|
||||
@@ -4389,6 +4397,7 @@ else
|
||||
echo "AUTOCONF_HOST := " >> $config_host_mak
|
||||
fi
|
||||
echo "LDFLAGS=$LDFLAGS" >> $config_host_mak
|
||||
echo "LDFLAGS_NOPIE=$LDFLAGS_NOPIE" >> $config_host_mak
|
||||
echo "LIBTOOLFLAGS=$LIBTOOLFLAGS" >> $config_host_mak
|
||||
echo "LIBS+=$LIBS" >> $config_host_mak
|
||||
echo "LIBS_TOOLS+=$libs_tools" >> $config_host_mak
|
||||
|
@@ -269,19 +269,19 @@ bool Disassembler::IsMovzMovnImm(unsigned reg_size, uint64_t value) {
|
||||
((reg_size == kWRegSize) && (value <= 0xffffffff)));
|
||||
|
||||
// Test for movz: 16 bits set at positions 0, 16, 32 or 48.
|
||||
if (((value & 0xffffffffffff0000UL) == 0UL) ||
|
||||
((value & 0xffffffff0000ffffUL) == 0UL) ||
|
||||
((value & 0xffff0000ffffffffUL) == 0UL) ||
|
||||
((value & 0x0000ffffffffffffUL) == 0UL)) {
|
||||
if (((value & 0xffffffffffff0000ULL) == 0ULL) ||
|
||||
((value & 0xffffffff0000ffffULL) == 0ULL) ||
|
||||
((value & 0xffff0000ffffffffULL) == 0ULL) ||
|
||||
((value & 0x0000ffffffffffffULL) == 0ULL)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Test for movn: NOT(16 bits set at positions 0, 16, 32 or 48).
|
||||
if ((reg_size == kXRegSize) &&
|
||||
(((value & 0xffffffffffff0000UL) == 0xffffffffffff0000UL) ||
|
||||
((value & 0xffffffff0000ffffUL) == 0xffffffff0000ffffUL) ||
|
||||
((value & 0xffff0000ffffffffUL) == 0xffff0000ffffffffUL) ||
|
||||
((value & 0x0000ffffffffffffUL) == 0x0000ffffffffffffUL))) {
|
||||
(((value & 0xffffffffffff0000ULL) == 0xffffffffffff0000ULL) ||
|
||||
((value & 0xffffffff0000ffffULL) == 0xffffffff0000ffffULL) ||
|
||||
((value & 0xffff0000ffffffffULL) == 0xffff0000ffffffffULL) ||
|
||||
((value & 0x0000ffffffffffffULL) == 0x0000ffffffffffffULL))) {
|
||||
return true;
|
||||
}
|
||||
if ((reg_size == kWRegSize) &&
|
||||
|
@@ -95,7 +95,7 @@ int CountSetBits(uint64_t value, int width) {
|
||||
ASSERT((width == 32) || (width == 64));
|
||||
|
||||
// Mask out unused bits to ensure that they are not counted.
|
||||
value &= (0xffffffffffffffffUL >> (64-width));
|
||||
value &= (0xffffffffffffffffULL >> (64-width));
|
||||
|
||||
// Add up the set bits.
|
||||
// The algorithm works by adding pairs of bit fields together iteratively,
|
||||
@@ -108,12 +108,18 @@ int CountSetBits(uint64_t value, int width) {
|
||||
// value = h+g+f+e d+c+b+a
|
||||
// \ |
|
||||
// value = h+g+f+e+d+c+b+a
|
||||
value = ((value >> 1) & 0x5555555555555555) + (value & 0x5555555555555555);
|
||||
value = ((value >> 2) & 0x3333333333333333) + (value & 0x3333333333333333);
|
||||
value = ((value >> 4) & 0x0f0f0f0f0f0f0f0f) + (value & 0x0f0f0f0f0f0f0f0f);
|
||||
value = ((value >> 8) & 0x00ff00ff00ff00ff) + (value & 0x00ff00ff00ff00ff);
|
||||
value = ((value >> 16) & 0x0000ffff0000ffff) + (value & 0x0000ffff0000ffff);
|
||||
value = ((value >> 32) & 0x00000000ffffffff) + (value & 0x00000000ffffffff);
|
||||
value = ((value >> 1) & 0x5555555555555555ULL) +
|
||||
(value & 0x5555555555555555ULL);
|
||||
value = ((value >> 2) & 0x3333333333333333ULL) +
|
||||
(value & 0x3333333333333333ULL);
|
||||
value = ((value >> 4) & 0x0f0f0f0f0f0f0f0fULL) +
|
||||
(value & 0x0f0f0f0f0f0f0f0fULL);
|
||||
value = ((value >> 8) & 0x00ff00ff00ff00ffULL) +
|
||||
(value & 0x00ff00ff00ff00ffULL);
|
||||
value = ((value >> 16) & 0x0000ffff0000ffffULL) +
|
||||
(value & 0x0000ffff0000ffffULL);
|
||||
value = ((value >> 32) & 0x00000000ffffffffULL) +
|
||||
(value & 0x00000000ffffffffULL);
|
||||
|
||||
return value;
|
||||
}
|
||||
|
@@ -225,7 +225,7 @@ static gboolean serial_xmit(GIOChannel *chan, GIOCondition cond, void *opaque)
|
||||
|
||||
if (s->tsr_retry <= 0) {
|
||||
if (s->fcr & UART_FCR_FE) {
|
||||
s->tsr = fifo8_is_full(&s->xmit_fifo) ?
|
||||
s->tsr = fifo8_is_empty(&s->xmit_fifo) ?
|
||||
0 : fifo8_pop(&s->xmit_fifo);
|
||||
if (!s->xmit_fifo.num) {
|
||||
s->lsr |= UART_LSR_THRE;
|
||||
|
@@ -26,7 +26,6 @@
|
||||
#include "sysemu/blockdev.h"
|
||||
#include "sysemu/dma.h"
|
||||
#include "qemu/timer.h"
|
||||
#include "block/block_int.h"
|
||||
#include "qemu/bitops.h"
|
||||
|
||||
#include "sdhci.h"
|
||||
|
@@ -45,6 +45,7 @@
|
||||
typedef struct ResetData {
|
||||
SPARCCPU *cpu;
|
||||
uint32_t entry; /* save kernel entry in case of reset */
|
||||
target_ulong sp; /* initial stack pointer */
|
||||
} ResetData;
|
||||
|
||||
static void main_cpu_reset(void *opaque)
|
||||
@@ -58,6 +59,7 @@ static void main_cpu_reset(void *opaque)
|
||||
cpu->halted = 0;
|
||||
env->pc = s->entry;
|
||||
env->npc = s->entry + 4;
|
||||
env->regbase[6] = s->sp;
|
||||
}
|
||||
|
||||
void leon3_irq_ack(void *irq_manager, int intno)
|
||||
@@ -133,6 +135,7 @@ static void leon3_generic_hw_init(QEMUMachineInitArgs *args)
|
||||
/* Reset data */
|
||||
reset_info = g_malloc0(sizeof(ResetData));
|
||||
reset_info->cpu = cpu;
|
||||
reset_info->sp = 0x40000000 + ram_size;
|
||||
qemu_register_reset(main_cpu_reset, reset_info);
|
||||
|
||||
/* Allocate IRQ manager */
|
||||
|
@@ -759,7 +759,7 @@ int usb_desc_handle_control(USBDevice *dev, USBPacket *p,
|
||||
* We return the same value that a configured device would return if
|
||||
* it used the first configuration.
|
||||
*/
|
||||
if (config->bmAttributes & 0x40) {
|
||||
if (config->bmAttributes & USB_CFG_ATT_SELFPOWER) {
|
||||
data[0] |= 1 << USB_DEVICE_SELF_POWERED;
|
||||
}
|
||||
if (dev->remote_wakeup) {
|
||||
|
@@ -224,7 +224,7 @@ static const USBDescDevice desc_device = {
|
||||
.bNumInterfaces = 2,
|
||||
.bConfigurationValue = DEV_CONFIG_VALUE,
|
||||
.iConfiguration = STRING_CONFIG,
|
||||
.bmAttributes = 0xc0,
|
||||
.bmAttributes = USB_CFG_ATT_ONE | USB_CFG_ATT_SELFPOWER,
|
||||
.bMaxPower = 0x32,
|
||||
.nif = ARRAY_SIZE(desc_iface),
|
||||
.ifs = desc_iface,
|
||||
|
@@ -229,7 +229,7 @@ static const USBDescDevice desc_device_bluetooth = {
|
||||
{
|
||||
.bNumInterfaces = 2,
|
||||
.bConfigurationValue = 1,
|
||||
.bmAttributes = 0xc0,
|
||||
.bmAttributes = USB_CFG_ATT_ONE | USB_CFG_ATT_SELFPOWER,
|
||||
.bMaxPower = 0,
|
||||
.nif = ARRAY_SIZE(desc_iface_bluetooth),
|
||||
.ifs = desc_iface_bluetooth,
|
||||
|
@@ -202,7 +202,7 @@ static const USBDescDevice desc_device_mouse = {
|
||||
.bNumInterfaces = 1,
|
||||
.bConfigurationValue = 1,
|
||||
.iConfiguration = STR_CONFIG_MOUSE,
|
||||
.bmAttributes = 0xa0,
|
||||
.bmAttributes = USB_CFG_ATT_ONE | USB_CFG_ATT_WAKEUP,
|
||||
.bMaxPower = 50,
|
||||
.nif = 1,
|
||||
.ifs = &desc_iface_mouse,
|
||||
@@ -219,7 +219,7 @@ static const USBDescDevice desc_device_tablet = {
|
||||
.bNumInterfaces = 1,
|
||||
.bConfigurationValue = 1,
|
||||
.iConfiguration = STR_CONFIG_TABLET,
|
||||
.bmAttributes = 0xa0,
|
||||
.bmAttributes = USB_CFG_ATT_ONE | USB_CFG_ATT_WAKEUP,
|
||||
.bMaxPower = 50,
|
||||
.nif = 1,
|
||||
.ifs = &desc_iface_tablet,
|
||||
@@ -236,7 +236,7 @@ static const USBDescDevice desc_device_tablet2 = {
|
||||
.bNumInterfaces = 1,
|
||||
.bConfigurationValue = 1,
|
||||
.iConfiguration = STR_CONFIG_TABLET,
|
||||
.bmAttributes = 0xa0,
|
||||
.bmAttributes = USB_CFG_ATT_ONE | USB_CFG_ATT_WAKEUP,
|
||||
.bMaxPower = 50,
|
||||
.nif = 1,
|
||||
.ifs = &desc_iface_tablet2,
|
||||
@@ -253,7 +253,7 @@ static const USBDescDevice desc_device_keyboard = {
|
||||
.bNumInterfaces = 1,
|
||||
.bConfigurationValue = 1,
|
||||
.iConfiguration = STR_CONFIG_KEYBOARD,
|
||||
.bmAttributes = 0xa0,
|
||||
.bmAttributes = USB_CFG_ATT_ONE | USB_CFG_ATT_WAKEUP,
|
||||
.bMaxPower = 50,
|
||||
.nif = 1,
|
||||
.ifs = &desc_iface_keyboard,
|
||||
|
@@ -119,7 +119,8 @@ static const USBDescDevice desc_device_hub = {
|
||||
{
|
||||
.bNumInterfaces = 1,
|
||||
.bConfigurationValue = 1,
|
||||
.bmAttributes = 0xe0,
|
||||
.bmAttributes = USB_CFG_ATT_ONE | USB_CFG_ATT_SELFPOWER |
|
||||
USB_CFG_ATT_WAKEUP,
|
||||
.nif = 1,
|
||||
.ifs = &desc_iface_hub,
|
||||
},
|
||||
|
@@ -266,7 +266,7 @@ static const USBDescDevice desc_device_net = {
|
||||
.bNumInterfaces = 2,
|
||||
.bConfigurationValue = DEV_RNDIS_CONFIG_VALUE,
|
||||
.iConfiguration = STRING_RNDIS,
|
||||
.bmAttributes = 0xc0,
|
||||
.bmAttributes = USB_CFG_ATT_ONE | USB_CFG_ATT_SELFPOWER,
|
||||
.bMaxPower = 0x32,
|
||||
.nif = ARRAY_SIZE(desc_iface_rndis),
|
||||
.ifs = desc_iface_rndis,
|
||||
@@ -274,7 +274,7 @@ static const USBDescDevice desc_device_net = {
|
||||
.bNumInterfaces = 2,
|
||||
.bConfigurationValue = DEV_CONFIG_VALUE,
|
||||
.iConfiguration = STRING_CDC,
|
||||
.bmAttributes = 0xc0,
|
||||
.bmAttributes = USB_CFG_ATT_ONE | USB_CFG_ATT_SELFPOWER,
|
||||
.bMaxPower = 0x32,
|
||||
.nif = ARRAY_SIZE(desc_iface_cdc),
|
||||
.ifs = desc_iface_cdc,
|
||||
|
@@ -144,7 +144,7 @@ static const USBDescDevice desc_device = {
|
||||
{
|
||||
.bNumInterfaces = 1,
|
||||
.bConfigurationValue = 1,
|
||||
.bmAttributes = 0x80,
|
||||
.bmAttributes = USB_CFG_ATT_ONE,
|
||||
.bMaxPower = 50,
|
||||
.nif = 1,
|
||||
.ifs = &desc_iface0,
|
||||
|
@@ -463,7 +463,8 @@ static const USBDescDevice desc_device = {
|
||||
{
|
||||
.bNumInterfaces = 1,
|
||||
.bConfigurationValue = 1,
|
||||
.bmAttributes = 0xe0,
|
||||
.bmAttributes = USB_CFG_ATT_ONE | USB_CFG_ATT_SELFPOWER |
|
||||
USB_CFG_ATT_WAKEUP,
|
||||
.bMaxPower = 50,
|
||||
.nif = 1,
|
||||
.ifs = &desc_iface0,
|
||||
|
@@ -117,7 +117,7 @@ static const USBDescDevice desc_device_full = {
|
||||
.bNumInterfaces = 1,
|
||||
.bConfigurationValue = 1,
|
||||
.iConfiguration = STR_CONFIG_FULL,
|
||||
.bmAttributes = 0xc0,
|
||||
.bmAttributes = USB_CFG_ATT_ONE | USB_CFG_ATT_SELFPOWER,
|
||||
.nif = 1,
|
||||
.ifs = &desc_iface_full,
|
||||
},
|
||||
@@ -152,7 +152,7 @@ static const USBDescDevice desc_device_high = {
|
||||
.bNumInterfaces = 1,
|
||||
.bConfigurationValue = 1,
|
||||
.iConfiguration = STR_CONFIG_HIGH,
|
||||
.bmAttributes = 0xc0,
|
||||
.bmAttributes = USB_CFG_ATT_ONE | USB_CFG_ATT_SELFPOWER,
|
||||
.nif = 1,
|
||||
.ifs = &desc_iface_high,
|
||||
},
|
||||
@@ -189,7 +189,7 @@ static const USBDescDevice desc_device_super = {
|
||||
.bNumInterfaces = 1,
|
||||
.bConfigurationValue = 1,
|
||||
.iConfiguration = STR_CONFIG_SUPER,
|
||||
.bmAttributes = 0xc0,
|
||||
.bmAttributes = USB_CFG_ATT_ONE | USB_CFG_ATT_SELFPOWER,
|
||||
.nif = 1,
|
||||
.ifs = &desc_iface_super,
|
||||
},
|
||||
|
@@ -286,7 +286,7 @@ static const USBDescDevice desc_device_high = {
|
||||
.bNumInterfaces = 1,
|
||||
.bConfigurationValue = 1,
|
||||
.iConfiguration = STR_CONFIG_HIGH,
|
||||
.bmAttributes = 0xc0,
|
||||
.bmAttributes = USB_CFG_ATT_ONE | USB_CFG_ATT_SELFPOWER,
|
||||
.nif = 1,
|
||||
.ifs = &desc_iface_high,
|
||||
},
|
||||
@@ -302,7 +302,7 @@ static const USBDescDevice desc_device_super = {
|
||||
.bNumInterfaces = 1,
|
||||
.bConfigurationValue = 1,
|
||||
.iConfiguration = STR_CONFIG_SUPER,
|
||||
.bmAttributes = 0xc0,
|
||||
.bmAttributes = USB_CFG_ATT_ONE | USB_CFG_ATT_SELFPOWER,
|
||||
.nif = 1,
|
||||
.ifs = &desc_iface_super,
|
||||
},
|
||||
|
@@ -107,7 +107,7 @@ static const USBDescDevice desc_device_wacom = {
|
||||
{
|
||||
.bNumInterfaces = 1,
|
||||
.bConfigurationValue = 1,
|
||||
.bmAttributes = 0x80,
|
||||
.bmAttributes = USB_CFG_ATT_ONE,
|
||||
.bMaxPower = 40,
|
||||
.nif = 1,
|
||||
.ifs = &desc_iface_wacom,
|
||||
|
@@ -252,9 +252,11 @@ static bool uhci_queue_verify(UHCIQueue *queue, uint32_t qh_addr, UHCI_TD *td,
|
||||
uint32_t td_addr, bool queuing)
|
||||
{
|
||||
UHCIAsync *first = QTAILQ_FIRST(&queue->asyncs);
|
||||
uint32_t queue_token_addr = (queue->token >> 8) & 0x7f;
|
||||
|
||||
return queue->qh_addr == qh_addr &&
|
||||
queue->token == uhci_queue_token(td) &&
|
||||
queue_token_addr == queue->ep->dev->addr &&
|
||||
(queuing || !(td->ctrl & TD_CTRL_ACTIVE) || first == NULL ||
|
||||
first->td_addr == td_addr);
|
||||
}
|
||||
|
@@ -807,7 +807,7 @@ static inline int xhci_running(XHCIState *xhci)
|
||||
static void xhci_die(XHCIState *xhci)
|
||||
{
|
||||
xhci->usbsts |= USBSTS_HCE;
|
||||
fprintf(stderr, "xhci: asserted controller error\n");
|
||||
DPRINTF("xhci: asserted controller error\n");
|
||||
}
|
||||
|
||||
static void xhci_write_event(XHCIState *xhci, XHCIEvent *event, int v)
|
||||
@@ -854,8 +854,8 @@ static void xhci_events_update(XHCIState *xhci, int v)
|
||||
erdp = xhci_addr64(intr->erdp_low, intr->erdp_high);
|
||||
if (erdp < intr->er_start ||
|
||||
erdp >= (intr->er_start + TRB_SIZE*intr->er_size)) {
|
||||
fprintf(stderr, "xhci: ERDP out of bounds: "DMA_ADDR_FMT"\n", erdp);
|
||||
fprintf(stderr, "xhci: ER[%d] at "DMA_ADDR_FMT" len %d\n",
|
||||
DPRINTF("xhci: ERDP out of bounds: "DMA_ADDR_FMT"\n", erdp);
|
||||
DPRINTF("xhci: ER[%d] at "DMA_ADDR_FMT" len %d\n",
|
||||
v, intr->er_start, intr->er_size);
|
||||
xhci_die(xhci);
|
||||
return;
|
||||
@@ -923,7 +923,7 @@ static void xhci_event(XHCIState *xhci, XHCIEvent *event, int v)
|
||||
if (intr->er_full) {
|
||||
DPRINTF("xhci_event(): ER full, queueing\n");
|
||||
if (((intr->ev_buffer_put+1) % EV_QUEUE) == intr->ev_buffer_get) {
|
||||
fprintf(stderr, "xhci: event queue full, dropping event!\n");
|
||||
DPRINTF("xhci: event queue full, dropping event!\n");
|
||||
return;
|
||||
}
|
||||
intr->ev_buffer[intr->ev_buffer_put++] = *event;
|
||||
@@ -936,8 +936,8 @@ static void xhci_event(XHCIState *xhci, XHCIEvent *event, int v)
|
||||
erdp = xhci_addr64(intr->erdp_low, intr->erdp_high);
|
||||
if (erdp < intr->er_start ||
|
||||
erdp >= (intr->er_start + TRB_SIZE*intr->er_size)) {
|
||||
fprintf(stderr, "xhci: ERDP out of bounds: "DMA_ADDR_FMT"\n", erdp);
|
||||
fprintf(stderr, "xhci: ER[%d] at "DMA_ADDR_FMT" len %d\n",
|
||||
DPRINTF("xhci: ERDP out of bounds: "DMA_ADDR_FMT"\n", erdp);
|
||||
DPRINTF("xhci: ER[%d] at "DMA_ADDR_FMT" len %d\n",
|
||||
v, intr->er_start, intr->er_size);
|
||||
xhci_die(xhci);
|
||||
return;
|
||||
@@ -954,7 +954,7 @@ static void xhci_event(XHCIState *xhci, XHCIEvent *event, int v)
|
||||
#endif
|
||||
intr->er_full = 1;
|
||||
if (((intr->ev_buffer_put+1) % EV_QUEUE) == intr->ev_buffer_get) {
|
||||
fprintf(stderr, "xhci: event queue full, dropping event!\n");
|
||||
DPRINTF("xhci: event queue full, dropping event!\n");
|
||||
return;
|
||||
}
|
||||
intr->ev_buffer[intr->ev_buffer_put++] = *event;
|
||||
@@ -1072,7 +1072,7 @@ static void xhci_er_reset(XHCIState *xhci, int v)
|
||||
}
|
||||
/* cache the (sole) event ring segment location */
|
||||
if (intr->erstsz != 1) {
|
||||
fprintf(stderr, "xhci: invalid value for ERSTSZ: %d\n", intr->erstsz);
|
||||
DPRINTF("xhci: invalid value for ERSTSZ: %d\n", intr->erstsz);
|
||||
xhci_die(xhci);
|
||||
return;
|
||||
}
|
||||
@@ -1082,7 +1082,7 @@ static void xhci_er_reset(XHCIState *xhci, int v)
|
||||
le32_to_cpus(&seg.addr_high);
|
||||
le32_to_cpus(&seg.size);
|
||||
if (seg.size < 16 || seg.size > 4096) {
|
||||
fprintf(stderr, "xhci: invalid value for segment size: %d\n", seg.size);
|
||||
DPRINTF("xhci: invalid value for segment size: %d\n", seg.size);
|
||||
xhci_die(xhci);
|
||||
return;
|
||||
}
|
||||
@@ -1248,7 +1248,7 @@ static TRBCCode xhci_alloc_device_streams(XHCIState *xhci, unsigned int slotid,
|
||||
|
||||
r = usb_device_alloc_streams(eps[0]->dev, eps, nr_eps, req_nr_streams);
|
||||
if (r != 0) {
|
||||
fprintf(stderr, "xhci: alloc streams failed\n");
|
||||
DPRINTF("xhci: alloc streams failed\n");
|
||||
return CC_RESOURCE_ERROR;
|
||||
}
|
||||
|
||||
@@ -1532,7 +1532,7 @@ static TRBCCode xhci_stop_ep(XHCIState *xhci, unsigned int slotid,
|
||||
assert(slotid >= 1 && slotid <= xhci->numslots);
|
||||
|
||||
if (epid < 1 || epid > 31) {
|
||||
fprintf(stderr, "xhci: bad ep %d\n", epid);
|
||||
DPRINTF("xhci: bad ep %d\n", epid);
|
||||
return CC_TRB_ERROR;
|
||||
}
|
||||
|
||||
@@ -1544,7 +1544,7 @@ static TRBCCode xhci_stop_ep(XHCIState *xhci, unsigned int slotid,
|
||||
}
|
||||
|
||||
if (xhci_ep_nuke_xfers(xhci, slotid, epid, CC_STOPPED) > 0) {
|
||||
fprintf(stderr, "xhci: FIXME: endpoint stopped w/ xfers running, "
|
||||
DPRINTF("xhci: FIXME: endpoint stopped w/ xfers running, "
|
||||
"data might be lost\n");
|
||||
}
|
||||
|
||||
@@ -1569,7 +1569,7 @@ static TRBCCode xhci_reset_ep(XHCIState *xhci, unsigned int slotid,
|
||||
assert(slotid >= 1 && slotid <= xhci->numslots);
|
||||
|
||||
if (epid < 1 || epid > 31) {
|
||||
fprintf(stderr, "xhci: bad ep %d\n", epid);
|
||||
DPRINTF("xhci: bad ep %d\n", epid);
|
||||
return CC_TRB_ERROR;
|
||||
}
|
||||
|
||||
@@ -1583,13 +1583,13 @@ static TRBCCode xhci_reset_ep(XHCIState *xhci, unsigned int slotid,
|
||||
epctx = slot->eps[epid-1];
|
||||
|
||||
if (epctx->state != EP_HALTED) {
|
||||
fprintf(stderr, "xhci: reset EP while EP %d not halted (%d)\n",
|
||||
DPRINTF("xhci: reset EP while EP %d not halted (%d)\n",
|
||||
epid, epctx->state);
|
||||
return CC_CONTEXT_STATE_ERROR;
|
||||
}
|
||||
|
||||
if (xhci_ep_nuke_xfers(xhci, slotid, epid, 0) > 0) {
|
||||
fprintf(stderr, "xhci: FIXME: endpoint reset w/ xfers running, "
|
||||
DPRINTF("xhci: FIXME: endpoint reset w/ xfers running, "
|
||||
"data might be lost\n");
|
||||
}
|
||||
|
||||
@@ -1626,7 +1626,7 @@ static TRBCCode xhci_set_ep_dequeue(XHCIState *xhci, unsigned int slotid,
|
||||
assert(slotid >= 1 && slotid <= xhci->numslots);
|
||||
|
||||
if (epid < 1 || epid > 31) {
|
||||
fprintf(stderr, "xhci: bad ep %d\n", epid);
|
||||
DPRINTF("xhci: bad ep %d\n", epid);
|
||||
return CC_TRB_ERROR;
|
||||
}
|
||||
|
||||
@@ -1643,7 +1643,7 @@ static TRBCCode xhci_set_ep_dequeue(XHCIState *xhci, unsigned int slotid,
|
||||
epctx = slot->eps[epid-1];
|
||||
|
||||
if (epctx->state != EP_STOPPED) {
|
||||
fprintf(stderr, "xhci: set EP dequeue pointer while EP %d not stopped\n", epid);
|
||||
DPRINTF("xhci: set EP dequeue pointer while EP %d not stopped\n", epid);
|
||||
return CC_CONTEXT_STATE_ERROR;
|
||||
}
|
||||
|
||||
@@ -1685,7 +1685,7 @@ static int xhci_xfer_create_sgl(XHCITransfer *xfer, int in_xfer)
|
||||
switch (TRB_TYPE(*trb)) {
|
||||
case TR_DATA:
|
||||
if ((!(trb->control & TRB_TR_DIR)) != (!in_xfer)) {
|
||||
fprintf(stderr, "xhci: data direction mismatch for TR_DATA\n");
|
||||
DPRINTF("xhci: data direction mismatch for TR_DATA\n");
|
||||
goto err;
|
||||
}
|
||||
/* fallthrough */
|
||||
@@ -1695,7 +1695,7 @@ static int xhci_xfer_create_sgl(XHCITransfer *xfer, int in_xfer)
|
||||
chunk = trb->status & 0x1ffff;
|
||||
if (trb->control & TRB_TR_IDT) {
|
||||
if (chunk > 8 || in_xfer) {
|
||||
fprintf(stderr, "xhci: invalid immediate data TRB\n");
|
||||
DPRINTF("xhci: invalid immediate data TRB\n");
|
||||
goto err;
|
||||
}
|
||||
qemu_sglist_add(&xfer->sgl, trb->addr, chunk);
|
||||
@@ -1824,7 +1824,7 @@ static int xhci_setup_packet(XHCITransfer *xfer)
|
||||
} else {
|
||||
ep = xhci_epid_to_usbep(xhci, xfer->slotid, xfer->epid);
|
||||
if (!ep) {
|
||||
fprintf(stderr, "xhci: slot %d has no device\n",
|
||||
DPRINTF("xhci: slot %d has no device\n",
|
||||
xfer->slotid);
|
||||
return -1;
|
||||
}
|
||||
@@ -1887,7 +1887,7 @@ static int xhci_complete_packet(XHCITransfer *xfer)
|
||||
xhci_stall_ep(xfer);
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "%s: FIXME: status = %d\n", __func__,
|
||||
DPRINTF("%s: FIXME: status = %d\n", __func__,
|
||||
xfer->packet.status);
|
||||
FIXME("unhandled USB_RET_*");
|
||||
}
|
||||
@@ -1911,21 +1911,21 @@ static int xhci_fire_ctl_transfer(XHCIState *xhci, XHCITransfer *xfer)
|
||||
|
||||
/* do some sanity checks */
|
||||
if (TRB_TYPE(*trb_setup) != TR_SETUP) {
|
||||
fprintf(stderr, "xhci: ep0 first TD not SETUP: %d\n",
|
||||
DPRINTF("xhci: ep0 first TD not SETUP: %d\n",
|
||||
TRB_TYPE(*trb_setup));
|
||||
return -1;
|
||||
}
|
||||
if (TRB_TYPE(*trb_status) != TR_STATUS) {
|
||||
fprintf(stderr, "xhci: ep0 last TD not STATUS: %d\n",
|
||||
DPRINTF("xhci: ep0 last TD not STATUS: %d\n",
|
||||
TRB_TYPE(*trb_status));
|
||||
return -1;
|
||||
}
|
||||
if (!(trb_setup->control & TRB_TR_IDT)) {
|
||||
fprintf(stderr, "xhci: Setup TRB doesn't have IDT set\n");
|
||||
DPRINTF("xhci: Setup TRB doesn't have IDT set\n");
|
||||
return -1;
|
||||
}
|
||||
if ((trb_setup->status & 0x1ffff) != 8) {
|
||||
fprintf(stderr, "xhci: Setup TRB has bad length (%d)\n",
|
||||
DPRINTF("xhci: Setup TRB has bad length (%d)\n",
|
||||
(trb_setup->status & 0x1ffff));
|
||||
return -1;
|
||||
}
|
||||
@@ -1974,10 +1974,10 @@ static void xhci_calc_iso_kick(XHCIState *xhci, XHCITransfer *xfer,
|
||||
xfer->mfindex_kick = asap;
|
||||
}
|
||||
} else {
|
||||
xfer->mfindex_kick = (xfer->trbs[0].control >> TRB_TR_FRAMEID_SHIFT)
|
||||
& TRB_TR_FRAMEID_MASK;
|
||||
xfer->mfindex_kick = ((xfer->trbs[0].control >> TRB_TR_FRAMEID_SHIFT)
|
||||
& TRB_TR_FRAMEID_MASK) << 3;
|
||||
xfer->mfindex_kick |= mfindex & ~0x3fff;
|
||||
if (xfer->mfindex_kick < mfindex) {
|
||||
if (xfer->mfindex_kick + 0x100 < mfindex) {
|
||||
xfer->mfindex_kick += 0x4000;
|
||||
}
|
||||
}
|
||||
@@ -2038,9 +2038,7 @@ static int xhci_submit(XHCIState *xhci, XHCITransfer *xfer, XHCIEPContext *epctx
|
||||
}
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "xhci: unknown or unhandled EP "
|
||||
"(type %d, in %d, ep %02x)\n",
|
||||
epctx->type, xfer->in_xfer, xfer->epid);
|
||||
trace_usb_xhci_unimplemented("endpoint type", epctx->type);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -2078,12 +2076,12 @@ static void xhci_kick_ep(XHCIState *xhci, unsigned int slotid,
|
||||
assert(epid >= 1 && epid <= 31);
|
||||
|
||||
if (!xhci->slots[slotid-1].enabled) {
|
||||
fprintf(stderr, "xhci: xhci_kick_ep for disabled slot %d\n", slotid);
|
||||
DPRINTF("xhci: xhci_kick_ep for disabled slot %d\n", slotid);
|
||||
return;
|
||||
}
|
||||
epctx = xhci->slots[slotid-1].eps[epid-1];
|
||||
if (!epctx) {
|
||||
fprintf(stderr, "xhci: xhci_kick_ep for disabled endpoint %d,%d\n",
|
||||
DPRINTF("xhci: xhci_kick_ep for disabled endpoint %d,%d\n",
|
||||
epid, slotid);
|
||||
return;
|
||||
}
|
||||
@@ -2188,14 +2186,14 @@ static void xhci_kick_ep(XHCIState *xhci, unsigned int slotid,
|
||||
epctx->next_xfer = (epctx->next_xfer + 1) % TD_QUEUE;
|
||||
ep = xfer->packet.ep;
|
||||
} else {
|
||||
fprintf(stderr, "xhci: error firing CTL transfer\n");
|
||||
DPRINTF("xhci: error firing CTL transfer\n");
|
||||
}
|
||||
} else {
|
||||
if (xhci_fire_transfer(xhci, xfer, epctx) >= 0) {
|
||||
epctx->next_xfer = (epctx->next_xfer + 1) % TD_QUEUE;
|
||||
} else {
|
||||
if (!xfer->timed_xfer) {
|
||||
fprintf(stderr, "xhci: error firing data transfer\n");
|
||||
DPRINTF("xhci: error firing data transfer\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2298,7 +2296,7 @@ static TRBCCode xhci_address_slot(XHCIState *xhci, unsigned int slotid,
|
||||
xhci_dma_read_u32s(xhci, ictx, ictl_ctx, sizeof(ictl_ctx));
|
||||
|
||||
if (ictl_ctx[0] != 0x0 || ictl_ctx[1] != 0x3) {
|
||||
fprintf(stderr, "xhci: invalid input context control %08x %08x\n",
|
||||
DPRINTF("xhci: invalid input context control %08x %08x\n",
|
||||
ictl_ctx[0], ictl_ctx[1]);
|
||||
return CC_TRB_ERROR;
|
||||
}
|
||||
@@ -2314,14 +2312,14 @@ static TRBCCode xhci_address_slot(XHCIState *xhci, unsigned int slotid,
|
||||
|
||||
uport = xhci_lookup_uport(xhci, slot_ctx);
|
||||
if (uport == NULL) {
|
||||
fprintf(stderr, "xhci: port not found\n");
|
||||
DPRINTF("xhci: port not found\n");
|
||||
return CC_TRB_ERROR;
|
||||
}
|
||||
trace_usb_xhci_slot_address(slotid, uport->path);
|
||||
|
||||
dev = uport->dev;
|
||||
if (!dev || !dev->attached) {
|
||||
fprintf(stderr, "xhci: port %s not connected\n", uport->path);
|
||||
DPRINTF("xhci: port %s not connected\n", uport->path);
|
||||
return CC_USB_TRANSACTION_ERROR;
|
||||
}
|
||||
|
||||
@@ -2330,7 +2328,7 @@ static TRBCCode xhci_address_slot(XHCIState *xhci, unsigned int slotid,
|
||||
continue;
|
||||
}
|
||||
if (xhci->slots[i].uport == uport) {
|
||||
fprintf(stderr, "xhci: port %s already assigned to slot %d\n",
|
||||
DPRINTF("xhci: port %s already assigned to slot %d\n",
|
||||
uport->path, i+1);
|
||||
return CC_TRB_ERROR;
|
||||
}
|
||||
@@ -2414,7 +2412,7 @@ static TRBCCode xhci_configure_slot(XHCIState *xhci, unsigned int slotid,
|
||||
xhci_dma_read_u32s(xhci, ictx, ictl_ctx, sizeof(ictl_ctx));
|
||||
|
||||
if ((ictl_ctx[0] & 0x3) != 0x0 || (ictl_ctx[1] & 0x3) != 0x1) {
|
||||
fprintf(stderr, "xhci: invalid input context control %08x %08x\n",
|
||||
DPRINTF("xhci: invalid input context control %08x %08x\n",
|
||||
ictl_ctx[0], ictl_ctx[1]);
|
||||
return CC_TRB_ERROR;
|
||||
}
|
||||
@@ -2423,7 +2421,7 @@ static TRBCCode xhci_configure_slot(XHCIState *xhci, unsigned int slotid,
|
||||
xhci_dma_read_u32s(xhci, octx, slot_ctx, sizeof(slot_ctx));
|
||||
|
||||
if (SLOT_STATE(slot_ctx[3]) < SLOT_ADDRESSED) {
|
||||
fprintf(stderr, "xhci: invalid slot state %08x\n", slot_ctx[3]);
|
||||
DPRINTF("xhci: invalid slot state %08x\n", slot_ctx[3]);
|
||||
return CC_CONTEXT_STATE_ERROR;
|
||||
}
|
||||
|
||||
@@ -2496,7 +2494,7 @@ static TRBCCode xhci_evaluate_slot(XHCIState *xhci, unsigned int slotid,
|
||||
xhci_dma_read_u32s(xhci, ictx, ictl_ctx, sizeof(ictl_ctx));
|
||||
|
||||
if (ictl_ctx[0] != 0x0 || ictl_ctx[1] & ~0x3) {
|
||||
fprintf(stderr, "xhci: invalid input context control %08x %08x\n",
|
||||
DPRINTF("xhci: invalid input context control %08x %08x\n",
|
||||
ictl_ctx[0], ictl_ctx[1]);
|
||||
return CC_TRB_ERROR;
|
||||
}
|
||||
@@ -2575,11 +2573,11 @@ static unsigned int xhci_get_slot(XHCIState *xhci, XHCIEvent *event, XHCITRB *tr
|
||||
unsigned int slotid;
|
||||
slotid = (trb->control >> TRB_CR_SLOTID_SHIFT) & TRB_CR_SLOTID_MASK;
|
||||
if (slotid < 1 || slotid > xhci->numslots) {
|
||||
fprintf(stderr, "xhci: bad slot id %d\n", slotid);
|
||||
DPRINTF("xhci: bad slot id %d\n", slotid);
|
||||
event->ccode = CC_TRB_ERROR;
|
||||
return 0;
|
||||
} else if (!xhci->slots[slotid-1].enabled) {
|
||||
fprintf(stderr, "xhci: slot id %d not enabled\n", slotid);
|
||||
DPRINTF("xhci: slot id %d not enabled\n", slotid);
|
||||
event->ccode = CC_SLOT_NOT_ENABLED_ERROR;
|
||||
return 0;
|
||||
}
|
||||
@@ -2695,7 +2693,7 @@ static void xhci_process_commands(XHCIState *xhci)
|
||||
}
|
||||
}
|
||||
if (i >= xhci->numslots) {
|
||||
fprintf(stderr, "xhci: no device slots available\n");
|
||||
DPRINTF("xhci: no device slots available\n");
|
||||
event.ccode = CC_NO_SLOTS_ERROR;
|
||||
} else {
|
||||
slotid = i+1;
|
||||
@@ -2887,7 +2885,7 @@ static void xhci_reset(DeviceState *dev)
|
||||
|
||||
trace_usb_xhci_reset();
|
||||
if (!(xhci->usbsts & USBSTS_HCH)) {
|
||||
fprintf(stderr, "xhci: reset while running!\n");
|
||||
DPRINTF("xhci: reset while running!\n");
|
||||
}
|
||||
|
||||
xhci->usbcmd = 0;
|
||||
@@ -3065,7 +3063,7 @@ static void xhci_port_write(void *ptr, hwaddr reg,
|
||||
/* windows does this for some reason, don't spam stderr */
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "%s: ignore pls write (old %d, new %d)\n",
|
||||
DPRINTF("%s: ignore pls write (old %d, new %d)\n",
|
||||
__func__, old_pls, new_pls);
|
||||
break;
|
||||
}
|
||||
@@ -3316,7 +3314,7 @@ static void xhci_doorbell_write(void *ptr, hwaddr reg,
|
||||
trace_usb_xhci_doorbell_write(reg, val);
|
||||
|
||||
if (!xhci_running(xhci)) {
|
||||
fprintf(stderr, "xhci: wrote doorbell while xHC stopped or paused\n");
|
||||
DPRINTF("xhci: wrote doorbell while xHC stopped or paused\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -3326,16 +3324,16 @@ static void xhci_doorbell_write(void *ptr, hwaddr reg,
|
||||
if (val == 0) {
|
||||
xhci_process_commands(xhci);
|
||||
} else {
|
||||
fprintf(stderr, "xhci: bad doorbell 0 write: 0x%x\n",
|
||||
DPRINTF("xhci: bad doorbell 0 write: 0x%x\n",
|
||||
(uint32_t)val);
|
||||
}
|
||||
} else {
|
||||
epid = val & 0xff;
|
||||
streamid = (val >> 16) & 0xffff;
|
||||
if (reg > xhci->numslots) {
|
||||
fprintf(stderr, "xhci: bad doorbell %d\n", (int)reg);
|
||||
DPRINTF("xhci: bad doorbell %d\n", (int)reg);
|
||||
} else if (epid > 31) {
|
||||
fprintf(stderr, "xhci: bad doorbell %d write: 0x%x\n",
|
||||
DPRINTF("xhci: bad doorbell %d write: 0x%x\n",
|
||||
(int)reg, (uint32_t)val);
|
||||
} else {
|
||||
xhci_kick_ep(xhci, reg, epid, streamid);
|
||||
@@ -3636,7 +3634,7 @@ static int usb_xhci_post_load(void *opaque, int version_id)
|
||||
slot->uport = xhci_lookup_uport(xhci, slot_ctx);
|
||||
assert(slot->uport && slot->uport->dev);
|
||||
|
||||
for (epid = 1; epid <= 32; epid++) {
|
||||
for (epid = 1; epid <= 31; epid++) {
|
||||
pctx = slot->ctx + 32 * epid;
|
||||
xhci_dma_read_u32s(xhci, pctx, ep_ctx, sizeof(ep_ctx));
|
||||
state = ep_ctx[0] & EP_STATE_MASK;
|
||||
|
@@ -157,6 +157,11 @@
|
||||
#define USB_DEV_CAP_USB2_EXT 0x02
|
||||
#define USB_DEV_CAP_SUPERSPEED 0x03
|
||||
|
||||
#define USB_CFG_ATT_ONE (1 << 7) /* should always be set */
|
||||
#define USB_CFG_ATT_SELFPOWER (1 << 6)
|
||||
#define USB_CFG_ATT_WAKEUP (1 << 5)
|
||||
#define USB_CFG_ATT_BATTERY (1 << 4)
|
||||
|
||||
#define USB_ENDPOINT_XFER_CONTROL 0
|
||||
#define USB_ENDPOINT_XFER_ISOC 1
|
||||
#define USB_ENDPOINT_XFER_BULK 2
|
||||
|
@@ -19,6 +19,7 @@
|
||||
#define QEMU_NET_CHECKSUM_H
|
||||
|
||||
#include <stdint.h>
|
||||
struct iovec;
|
||||
|
||||
uint32_t net_checksum_add_cont(int len, uint8_t *buf, int seq);
|
||||
uint16_t net_checksum_finish(uint32_t sum);
|
||||
|
@@ -2177,271 +2177,81 @@ fail:
|
||||
/* do_socketcall() Must return target values and target errnos. */
|
||||
static abi_long do_socketcall(int num, abi_ulong vptr)
|
||||
{
|
||||
abi_long ret;
|
||||
const int n = sizeof(abi_ulong);
|
||||
static const unsigned ac[] = { /* number of arguments per call */
|
||||
[SOCKOP_socket] = 3, /* domain, type, protocol */
|
||||
[SOCKOP_bind] = 3, /* sockfd, addr, addrlen */
|
||||
[SOCKOP_connect] = 3, /* sockfd, addr, addrlen */
|
||||
[SOCKOP_listen] = 2, /* sockfd, backlog */
|
||||
[SOCKOP_accept] = 3, /* sockfd, addr, addrlen */
|
||||
[SOCKOP_accept4] = 4, /* sockfd, addr, addrlen, flags */
|
||||
[SOCKOP_getsockname] = 3, /* sockfd, addr, addrlen */
|
||||
[SOCKOP_getpeername] = 3, /* sockfd, addr, addrlen */
|
||||
[SOCKOP_socketpair] = 4, /* domain, type, protocol, tab */
|
||||
[SOCKOP_send] = 4, /* sockfd, msg, len, flags */
|
||||
[SOCKOP_recv] = 4, /* sockfd, msg, len, flags */
|
||||
[SOCKOP_sendto] = 6, /* sockfd, msg, len, flags, addr, addrlen */
|
||||
[SOCKOP_recvfrom] = 6, /* sockfd, msg, len, flags, addr, addrlen */
|
||||
[SOCKOP_shutdown] = 2, /* sockfd, how */
|
||||
[SOCKOP_sendmsg] = 3, /* sockfd, msg, flags */
|
||||
[SOCKOP_recvmsg] = 3, /* sockfd, msg, flags */
|
||||
[SOCKOP_setsockopt] = 5, /* sockfd, level, optname, optval, optlen */
|
||||
[SOCKOP_getsockopt] = 5, /* sockfd, level, optname, optval, optlen */
|
||||
};
|
||||
abi_long a[6]; /* max 6 args */
|
||||
|
||||
switch(num) {
|
||||
case SOCKOP_socket:
|
||||
{
|
||||
abi_ulong domain, type, protocol;
|
||||
|
||||
if (get_user_ual(domain, vptr)
|
||||
|| get_user_ual(type, vptr + n)
|
||||
|| get_user_ual(protocol, vptr + 2 * n))
|
||||
return -TARGET_EFAULT;
|
||||
|
||||
ret = do_socket(domain, type, protocol);
|
||||
}
|
||||
break;
|
||||
case SOCKOP_bind:
|
||||
{
|
||||
abi_ulong sockfd;
|
||||
abi_ulong target_addr;
|
||||
socklen_t addrlen;
|
||||
|
||||
if (get_user_ual(sockfd, vptr)
|
||||
|| get_user_ual(target_addr, vptr + n)
|
||||
|| get_user_ual(addrlen, vptr + 2 * n))
|
||||
return -TARGET_EFAULT;
|
||||
|
||||
ret = do_bind(sockfd, target_addr, addrlen);
|
||||
}
|
||||
break;
|
||||
case SOCKOP_connect:
|
||||
{
|
||||
abi_ulong sockfd;
|
||||
abi_ulong target_addr;
|
||||
socklen_t addrlen;
|
||||
|
||||
if (get_user_ual(sockfd, vptr)
|
||||
|| get_user_ual(target_addr, vptr + n)
|
||||
|| get_user_ual(addrlen, vptr + 2 * n))
|
||||
return -TARGET_EFAULT;
|
||||
|
||||
ret = do_connect(sockfd, target_addr, addrlen);
|
||||
}
|
||||
break;
|
||||
case SOCKOP_listen:
|
||||
{
|
||||
abi_ulong sockfd, backlog;
|
||||
|
||||
if (get_user_ual(sockfd, vptr)
|
||||
|| get_user_ual(backlog, vptr + n))
|
||||
return -TARGET_EFAULT;
|
||||
|
||||
ret = get_errno(listen(sockfd, backlog));
|
||||
}
|
||||
break;
|
||||
case SOCKOP_accept:
|
||||
{
|
||||
abi_ulong sockfd;
|
||||
abi_ulong target_addr, target_addrlen;
|
||||
|
||||
if (get_user_ual(sockfd, vptr)
|
||||
|| get_user_ual(target_addr, vptr + n)
|
||||
|| get_user_ual(target_addrlen, vptr + 2 * n))
|
||||
return -TARGET_EFAULT;
|
||||
|
||||
ret = do_accept4(sockfd, target_addr, target_addrlen, 0);
|
||||
}
|
||||
break;
|
||||
case SOCKOP_accept4:
|
||||
{
|
||||
abi_ulong sockfd;
|
||||
abi_ulong target_addr, target_addrlen;
|
||||
abi_ulong flags;
|
||||
|
||||
if (get_user_ual(sockfd, vptr)
|
||||
|| get_user_ual(target_addr, vptr + n)
|
||||
|| get_user_ual(target_addrlen, vptr + 2 * n)
|
||||
|| get_user_ual(flags, vptr + 3 * n)) {
|
||||
/* first, collect the arguments in a[] according to ac[] */
|
||||
if (num >= 0 && num < ARRAY_SIZE(ac)) {
|
||||
unsigned i;
|
||||
assert(ARRAY_SIZE(a) >= ac[num]); /* ensure we have space for args */
|
||||
for (i = 0; i < ac[num]; ++i) {
|
||||
if (get_user_ual(a[i], vptr + i * sizeof(abi_long)) != 0) {
|
||||
return -TARGET_EFAULT;
|
||||
}
|
||||
|
||||
ret = do_accept4(sockfd, target_addr, target_addrlen, flags);
|
||||
}
|
||||
break;
|
||||
case SOCKOP_getsockname:
|
||||
{
|
||||
abi_ulong sockfd;
|
||||
abi_ulong target_addr, target_addrlen;
|
||||
}
|
||||
|
||||
if (get_user_ual(sockfd, vptr)
|
||||
|| get_user_ual(target_addr, vptr + n)
|
||||
|| get_user_ual(target_addrlen, vptr + 2 * n))
|
||||
return -TARGET_EFAULT;
|
||||
|
||||
ret = do_getsockname(sockfd, target_addr, target_addrlen);
|
||||
}
|
||||
break;
|
||||
case SOCKOP_getpeername:
|
||||
{
|
||||
abi_ulong sockfd;
|
||||
abi_ulong target_addr, target_addrlen;
|
||||
|
||||
if (get_user_ual(sockfd, vptr)
|
||||
|| get_user_ual(target_addr, vptr + n)
|
||||
|| get_user_ual(target_addrlen, vptr + 2 * n))
|
||||
return -TARGET_EFAULT;
|
||||
|
||||
ret = do_getpeername(sockfd, target_addr, target_addrlen);
|
||||
}
|
||||
break;
|
||||
case SOCKOP_socketpair:
|
||||
{
|
||||
abi_ulong domain, type, protocol;
|
||||
abi_ulong tab;
|
||||
|
||||
if (get_user_ual(domain, vptr)
|
||||
|| get_user_ual(type, vptr + n)
|
||||
|| get_user_ual(protocol, vptr + 2 * n)
|
||||
|| get_user_ual(tab, vptr + 3 * n))
|
||||
return -TARGET_EFAULT;
|
||||
|
||||
ret = do_socketpair(domain, type, protocol, tab);
|
||||
}
|
||||
break;
|
||||
case SOCKOP_send:
|
||||
{
|
||||
abi_ulong sockfd;
|
||||
abi_ulong msg;
|
||||
size_t len;
|
||||
abi_ulong flags;
|
||||
|
||||
if (get_user_ual(sockfd, vptr)
|
||||
|| get_user_ual(msg, vptr + n)
|
||||
|| get_user_ual(len, vptr + 2 * n)
|
||||
|| get_user_ual(flags, vptr + 3 * n))
|
||||
return -TARGET_EFAULT;
|
||||
|
||||
ret = do_sendto(sockfd, msg, len, flags, 0, 0);
|
||||
}
|
||||
break;
|
||||
case SOCKOP_recv:
|
||||
{
|
||||
abi_ulong sockfd;
|
||||
abi_ulong msg;
|
||||
size_t len;
|
||||
abi_ulong flags;
|
||||
|
||||
if (get_user_ual(sockfd, vptr)
|
||||
|| get_user_ual(msg, vptr + n)
|
||||
|| get_user_ual(len, vptr + 2 * n)
|
||||
|| get_user_ual(flags, vptr + 3 * n))
|
||||
return -TARGET_EFAULT;
|
||||
|
||||
ret = do_recvfrom(sockfd, msg, len, flags, 0, 0);
|
||||
}
|
||||
break;
|
||||
case SOCKOP_sendto:
|
||||
{
|
||||
abi_ulong sockfd;
|
||||
abi_ulong msg;
|
||||
size_t len;
|
||||
abi_ulong flags;
|
||||
abi_ulong addr;
|
||||
abi_ulong addrlen;
|
||||
|
||||
if (get_user_ual(sockfd, vptr)
|
||||
|| get_user_ual(msg, vptr + n)
|
||||
|| get_user_ual(len, vptr + 2 * n)
|
||||
|| get_user_ual(flags, vptr + 3 * n)
|
||||
|| get_user_ual(addr, vptr + 4 * n)
|
||||
|| get_user_ual(addrlen, vptr + 5 * n))
|
||||
return -TARGET_EFAULT;
|
||||
|
||||
ret = do_sendto(sockfd, msg, len, flags, addr, addrlen);
|
||||
}
|
||||
break;
|
||||
case SOCKOP_recvfrom:
|
||||
{
|
||||
abi_ulong sockfd;
|
||||
abi_ulong msg;
|
||||
size_t len;
|
||||
abi_ulong flags;
|
||||
abi_ulong addr;
|
||||
socklen_t addrlen;
|
||||
|
||||
if (get_user_ual(sockfd, vptr)
|
||||
|| get_user_ual(msg, vptr + n)
|
||||
|| get_user_ual(len, vptr + 2 * n)
|
||||
|| get_user_ual(flags, vptr + 3 * n)
|
||||
|| get_user_ual(addr, vptr + 4 * n)
|
||||
|| get_user_ual(addrlen, vptr + 5 * n))
|
||||
return -TARGET_EFAULT;
|
||||
|
||||
ret = do_recvfrom(sockfd, msg, len, flags, addr, addrlen);
|
||||
}
|
||||
break;
|
||||
case SOCKOP_shutdown:
|
||||
{
|
||||
abi_ulong sockfd, how;
|
||||
|
||||
if (get_user_ual(sockfd, vptr)
|
||||
|| get_user_ual(how, vptr + n))
|
||||
return -TARGET_EFAULT;
|
||||
|
||||
ret = get_errno(shutdown(sockfd, how));
|
||||
}
|
||||
break;
|
||||
case SOCKOP_sendmsg:
|
||||
case SOCKOP_recvmsg:
|
||||
{
|
||||
abi_ulong fd;
|
||||
abi_ulong target_msg;
|
||||
abi_ulong flags;
|
||||
|
||||
if (get_user_ual(fd, vptr)
|
||||
|| get_user_ual(target_msg, vptr + n)
|
||||
|| get_user_ual(flags, vptr + 2 * n))
|
||||
return -TARGET_EFAULT;
|
||||
|
||||
ret = do_sendrecvmsg(fd, target_msg, flags,
|
||||
(num == SOCKOP_sendmsg));
|
||||
}
|
||||
break;
|
||||
case SOCKOP_setsockopt:
|
||||
{
|
||||
abi_ulong sockfd;
|
||||
abi_ulong level;
|
||||
abi_ulong optname;
|
||||
abi_ulong optval;
|
||||
abi_ulong optlen;
|
||||
|
||||
if (get_user_ual(sockfd, vptr)
|
||||
|| get_user_ual(level, vptr + n)
|
||||
|| get_user_ual(optname, vptr + 2 * n)
|
||||
|| get_user_ual(optval, vptr + 3 * n)
|
||||
|| get_user_ual(optlen, vptr + 4 * n))
|
||||
return -TARGET_EFAULT;
|
||||
|
||||
ret = do_setsockopt(sockfd, level, optname, optval, optlen);
|
||||
}
|
||||
break;
|
||||
case SOCKOP_getsockopt:
|
||||
{
|
||||
abi_ulong sockfd;
|
||||
abi_ulong level;
|
||||
abi_ulong optname;
|
||||
abi_ulong optval;
|
||||
socklen_t optlen;
|
||||
|
||||
if (get_user_ual(sockfd, vptr)
|
||||
|| get_user_ual(level, vptr + n)
|
||||
|| get_user_ual(optname, vptr + 2 * n)
|
||||
|| get_user_ual(optval, vptr + 3 * n)
|
||||
|| get_user_ual(optlen, vptr + 4 * n))
|
||||
return -TARGET_EFAULT;
|
||||
|
||||
ret = do_getsockopt(sockfd, level, optname, optval, optlen);
|
||||
}
|
||||
break;
|
||||
/* now when we have the args, actually handle the call */
|
||||
switch (num) {
|
||||
case SOCKOP_socket: /* domain, type, protocol */
|
||||
return do_socket(a[0], a[1], a[2]);
|
||||
case SOCKOP_bind: /* sockfd, addr, addrlen */
|
||||
return do_bind(a[0], a[1], a[2]);
|
||||
case SOCKOP_connect: /* sockfd, addr, addrlen */
|
||||
return do_connect(a[0], a[1], a[2]);
|
||||
case SOCKOP_listen: /* sockfd, backlog */
|
||||
return get_errno(listen(a[0], a[1]));
|
||||
case SOCKOP_accept: /* sockfd, addr, addrlen */
|
||||
return do_accept4(a[0], a[1], a[2], 0);
|
||||
case SOCKOP_accept4: /* sockfd, addr, addrlen, flags */
|
||||
return do_accept4(a[0], a[1], a[2], a[3]);
|
||||
case SOCKOP_getsockname: /* sockfd, addr, addrlen */
|
||||
return do_getsockname(a[0], a[1], a[2]);
|
||||
case SOCKOP_getpeername: /* sockfd, addr, addrlen */
|
||||
return do_getpeername(a[0], a[1], a[2]);
|
||||
case SOCKOP_socketpair: /* domain, type, protocol, tab */
|
||||
return do_socketpair(a[0], a[1], a[2], a[3]);
|
||||
case SOCKOP_send: /* sockfd, msg, len, flags */
|
||||
return do_sendto(a[0], a[1], a[2], a[3], 0, 0);
|
||||
case SOCKOP_recv: /* sockfd, msg, len, flags */
|
||||
return do_recvfrom(a[0], a[1], a[2], a[3], 0, 0);
|
||||
case SOCKOP_sendto: /* sockfd, msg, len, flags, addr, addrlen */
|
||||
return do_sendto(a[0], a[1], a[2], a[3], a[4], a[5]);
|
||||
case SOCKOP_recvfrom: /* sockfd, msg, len, flags, addr, addrlen */
|
||||
return do_recvfrom(a[0], a[1], a[2], a[3], a[4], a[5]);
|
||||
case SOCKOP_shutdown: /* sockfd, how */
|
||||
return get_errno(shutdown(a[0], a[1]));
|
||||
case SOCKOP_sendmsg: /* sockfd, msg, flags */
|
||||
return do_sendrecvmsg(a[0], a[1], a[2], 1);
|
||||
case SOCKOP_recvmsg: /* sockfd, msg, flags */
|
||||
return do_sendrecvmsg(a[0], a[1], a[2], 0);
|
||||
case SOCKOP_setsockopt: /* sockfd, level, optname, optval, optlen */
|
||||
return do_setsockopt(a[0], a[1], a[2], a[3], a[4]);
|
||||
case SOCKOP_getsockopt: /* sockfd, level, optname, optval, optlen */
|
||||
return do_getsockopt(a[0], a[1], a[2], a[3], a[4]);
|
||||
default:
|
||||
gemu_log("Unsupported socketcall: %d\n", num);
|
||||
ret = -TARGET_ENOSYS;
|
||||
break;
|
||||
return -TARGET_ENOSYS;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@@ -12,6 +12,7 @@ $(call set-vpath, $(SRC_PATH)/pc-bios/optionrom)
|
||||
CFLAGS := -Wall -Wstrict-prototypes -Werror -fomit-frame-pointer -fno-builtin
|
||||
CFLAGS += -I$(SRC_PATH)
|
||||
CFLAGS += $(call cc-option, $(CFLAGS), -fno-stack-protector)
|
||||
CFLAGS += $(CFLAGS_NOPIE)
|
||||
QEMU_CFLAGS = $(CFLAGS)
|
||||
|
||||
build-all: multiboot.bin linuxboot.bin kvmvapic.bin
|
||||
@@ -20,7 +21,7 @@ build-all: multiboot.bin linuxboot.bin kvmvapic.bin
|
||||
.SECONDARY:
|
||||
|
||||
%.img: %.o
|
||||
$(call quiet-command,$(LD) -Ttext 0 -e _start -s -o $@ $<," Building $(TARGET_DIR)$@")
|
||||
$(call quiet-command,$(LD) $(LDFLAGS_NOPIE) -Ttext 0 -e _start -s -o $@ $<," Building $(TARGET_DIR)$@")
|
||||
|
||||
%.raw: %.img
|
||||
$(call quiet-command,$(OBJCOPY) -O binary -j .text $< $@," Building $(TARGET_DIR)$@")
|
||||
|
@@ -20,7 +20,7 @@ sub Syntax
|
||||
print STDERR <<STOP;
|
||||
Usage: $FindBin::Script [options] FILE ...
|
||||
|
||||
Translate each FILE to the new Qemu timer API. If no files
|
||||
Translate each FILE to the new QEMU timer API. If no files
|
||||
are passed, a reasonable guess is taken.
|
||||
|
||||
Options:
|
||||
|
@@ -73,6 +73,7 @@ struct CPUMIPSFPUContext {
|
||||
float_status fp_status;
|
||||
/* fpu implementation/revision register (fir) */
|
||||
uint32_t fcr0;
|
||||
#define FCR0_UFRP 28
|
||||
#define FCR0_F64 22
|
||||
#define FCR0_L 21
|
||||
#define FCR0_W 20
|
||||
@@ -368,6 +369,18 @@ struct CPUMIPSState {
|
||||
#define CP0C3_MT 2
|
||||
#define CP0C3_SM 1
|
||||
#define CP0C3_TL 0
|
||||
uint32_t CP0_Config4;
|
||||
uint32_t CP0_Config4_rw_bitmask;
|
||||
#define CP0C4_M 31
|
||||
uint32_t CP0_Config5;
|
||||
uint32_t CP0_Config5_rw_bitmask;
|
||||
#define CP0C5_M 31
|
||||
#define CP0C5_K 30
|
||||
#define CP0C5_CV 29
|
||||
#define CP0C5_EVA 28
|
||||
#define CP0C5_MSAEn 27
|
||||
#define CP0C5_UFR 2
|
||||
#define CP0C5_NFExists 0
|
||||
int32_t CP0_Config6;
|
||||
int32_t CP0_Config7;
|
||||
/* XXX: Maybe make LLAddr per-TC? */
|
||||
|
@@ -134,6 +134,8 @@ DEF_HELPER_2(mtc0_ebase, void, env, tl)
|
||||
DEF_HELPER_2(mttc0_ebase, void, env, tl)
|
||||
DEF_HELPER_2(mtc0_config0, void, env, tl)
|
||||
DEF_HELPER_2(mtc0_config2, void, env, tl)
|
||||
DEF_HELPER_2(mtc0_config4, void, env, tl)
|
||||
DEF_HELPER_2(mtc0_config5, void, env, tl)
|
||||
DEF_HELPER_2(mtc0_lladdr, void, env, tl)
|
||||
DEF_HELPER_3(mtc0_watchlo, void, env, tl, i32)
|
||||
DEF_HELPER_3(mtc0_watchhi, void, env, tl, i32)
|
||||
@@ -177,7 +179,7 @@ DEF_HELPER_2(yield, tl, env, tl)
|
||||
|
||||
/* CP1 functions */
|
||||
DEF_HELPER_2(cfc1, tl, env, i32)
|
||||
DEF_HELPER_3(ctc1, void, env, tl, i32)
|
||||
DEF_HELPER_4(ctc1, void, env, tl, i32, i32)
|
||||
|
||||
DEF_HELPER_2(float_cvtd_s, i64, env, i32)
|
||||
DEF_HELPER_2(float_cvtd_w, i64, env, i32)
|
||||
|
@@ -29,6 +29,8 @@
|
||||
#define ISA_MIPS32R2 0x00000040
|
||||
#define ISA_MIPS64 0x00000080
|
||||
#define ISA_MIPS64R2 0x00000100
|
||||
#define ISA_MIPS32R3 0x00000200
|
||||
#define ISA_MIPS32R5 0x00000400
|
||||
|
||||
/* MIPS ASEs. */
|
||||
#define ASE_MIPS16 0x00001000
|
||||
@@ -64,6 +66,12 @@
|
||||
#define CPU_MIPS32R2 (CPU_MIPS32 | ISA_MIPS32R2)
|
||||
#define CPU_MIPS64R2 (CPU_MIPS64 | CPU_MIPS32R2 | ISA_MIPS64R2)
|
||||
|
||||
/* MIPS Technologies "Release 3" */
|
||||
#define CPU_MIPS32R3 (CPU_MIPS32R2 | ISA_MIPS32R3)
|
||||
|
||||
/* MIPS Technologies "Release 5" */
|
||||
#define CPU_MIPS32R5 (CPU_MIPS32R3 | ISA_MIPS32R5)
|
||||
|
||||
/* Strictly follow the architecture standard:
|
||||
- Disallow "special" instruction handling for PMON/SPIM.
|
||||
Note that we still maintain Count/Compare to match the host clock. */
|
||||
|
@@ -1489,6 +1489,18 @@ void helper_mtc0_config2(CPUMIPSState *env, target_ulong arg1)
|
||||
env->CP0_Config2 = (env->CP0_Config2 & 0x8FFF0FFF);
|
||||
}
|
||||
|
||||
void helper_mtc0_config4(CPUMIPSState *env, target_ulong arg1)
|
||||
{
|
||||
env->CP0_Config4 = (env->CP0_Config4 & (~env->CP0_Config4_rw_bitmask)) |
|
||||
(arg1 & env->CP0_Config4_rw_bitmask);
|
||||
}
|
||||
|
||||
void helper_mtc0_config5(CPUMIPSState *env, target_ulong arg1)
|
||||
{
|
||||
env->CP0_Config5 = (env->CP0_Config5 & (~env->CP0_Config5_rw_bitmask)) |
|
||||
(arg1 & env->CP0_Config5_rw_bitmask);
|
||||
}
|
||||
|
||||
void helper_mtc0_lladdr(CPUMIPSState *env, target_ulong arg1)
|
||||
{
|
||||
target_long mask = env->CP0_LLAddr_rw_bitmask;
|
||||
@@ -2187,12 +2199,23 @@ static inline void restore_flush_mode(CPUMIPSState *env)
|
||||
|
||||
target_ulong helper_cfc1(CPUMIPSState *env, uint32_t reg)
|
||||
{
|
||||
target_ulong arg1;
|
||||
target_ulong arg1 = 0;
|
||||
|
||||
switch (reg) {
|
||||
case 0:
|
||||
arg1 = (int32_t)env->active_fpu.fcr0;
|
||||
break;
|
||||
case 1:
|
||||
/* UFR Support - Read Status FR */
|
||||
if (env->active_fpu.fcr0 & (1 << FCR0_UFRP)) {
|
||||
if (env->CP0_Config5 & (1 << CP0C5_UFR)) {
|
||||
arg1 = (int32_t)
|
||||
((env->CP0_Status & (1 << CP0St_FR)) >> CP0St_FR);
|
||||
} else {
|
||||
helper_raise_exception(env, EXCP_RI);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 25:
|
||||
arg1 = ((env->active_fpu.fcr31 >> 24) & 0xfe) | ((env->active_fpu.fcr31 >> 23) & 0x1);
|
||||
break;
|
||||
@@ -2210,9 +2233,33 @@ target_ulong helper_cfc1(CPUMIPSState *env, uint32_t reg)
|
||||
return arg1;
|
||||
}
|
||||
|
||||
void helper_ctc1(CPUMIPSState *env, target_ulong arg1, uint32_t reg)
|
||||
void helper_ctc1(CPUMIPSState *env, target_ulong arg1, uint32_t fs, uint32_t rt)
|
||||
{
|
||||
switch(reg) {
|
||||
switch (fs) {
|
||||
case 1:
|
||||
/* UFR Alias - Reset Status FR */
|
||||
if (!((env->active_fpu.fcr0 & (1 << FCR0_UFRP)) && (rt == 0))) {
|
||||
return;
|
||||
}
|
||||
if (env->CP0_Config5 & (1 << CP0C5_UFR)) {
|
||||
env->CP0_Status &= ~(1 << CP0St_FR);
|
||||
compute_hflags(env);
|
||||
} else {
|
||||
helper_raise_exception(env, EXCP_RI);
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
/* UNFR Alias - Set Status FR */
|
||||
if (!((env->active_fpu.fcr0 & (1 << FCR0_UFRP)) && (rt == 0))) {
|
||||
return;
|
||||
}
|
||||
if (env->CP0_Config5 & (1 << CP0C5_UFR)) {
|
||||
env->CP0_Status |= (1 << CP0St_FR);
|
||||
compute_hflags(env);
|
||||
} else {
|
||||
helper_raise_exception(env, EXCP_RI);
|
||||
}
|
||||
break;
|
||||
case 25:
|
||||
if (arg1 & 0xffffff00)
|
||||
return;
|
||||
|
@@ -4405,7 +4405,14 @@ static void gen_mfc0(DisasContext *ctx, TCGv arg, int reg, int sel)
|
||||
gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_Config3));
|
||||
rn = "Config3";
|
||||
break;
|
||||
/* 4,5 are reserved */
|
||||
case 4:
|
||||
gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_Config4));
|
||||
rn = "Config4";
|
||||
break;
|
||||
case 5:
|
||||
gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_Config5));
|
||||
rn = "Config5";
|
||||
break;
|
||||
/* 6,7 are implementation dependent */
|
||||
case 6:
|
||||
gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_Config6));
|
||||
@@ -4982,7 +4989,17 @@ static void gen_mtc0(DisasContext *ctx, TCGv arg, int reg, int sel)
|
||||
/* ignored, read only */
|
||||
rn = "Config3";
|
||||
break;
|
||||
/* 4,5 are reserved */
|
||||
case 4:
|
||||
gen_helper_mtc0_config4(cpu_env, arg);
|
||||
rn = "Config4";
|
||||
ctx->bstate = BS_STOP;
|
||||
break;
|
||||
case 5:
|
||||
gen_helper_mtc0_config5(cpu_env, arg);
|
||||
rn = "Config5";
|
||||
/* Stop translation as we may have switched the execution mode */
|
||||
ctx->bstate = BS_STOP;
|
||||
break;
|
||||
/* 6,7 are implementation dependent */
|
||||
case 6:
|
||||
/* ignored */
|
||||
@@ -6801,7 +6818,12 @@ static void gen_mttr(CPUMIPSState *env, DisasContext *ctx, int rd, int rt,
|
||||
break;
|
||||
case 3:
|
||||
/* XXX: For now we support only a single FPU context. */
|
||||
gen_helper_0e1i(ctc1, t0, rd);
|
||||
{
|
||||
TCGv_i32 fs_tmp = tcg_const_i32(rd);
|
||||
|
||||
gen_helper_0e2i(ctc1, t0, fs_tmp, rt);
|
||||
tcg_temp_free_i32(fs_tmp);
|
||||
}
|
||||
break;
|
||||
/* COP2: Not implemented. */
|
||||
case 4:
|
||||
@@ -7237,7 +7259,12 @@ static void gen_cp1 (DisasContext *ctx, uint32_t opc, int rt, int fs)
|
||||
break;
|
||||
case OPC_CTC1:
|
||||
gen_load_gpr(t0, rt);
|
||||
gen_helper_0e1i(ctc1, t0, fs);
|
||||
{
|
||||
TCGv_i32 fs_tmp = tcg_const_i32(fs);
|
||||
|
||||
gen_helper_0e2i(ctc1, t0, fs_tmp, rt);
|
||||
tcg_temp_free_i32(fs_tmp);
|
||||
}
|
||||
opn = "ctc1";
|
||||
break;
|
||||
#if defined(TARGET_MIPS64)
|
||||
@@ -15916,6 +15943,10 @@ void cpu_state_reset(CPUMIPSState *env)
|
||||
env->CP0_Config1 = env->cpu_model->CP0_Config1;
|
||||
env->CP0_Config2 = env->cpu_model->CP0_Config2;
|
||||
env->CP0_Config3 = env->cpu_model->CP0_Config3;
|
||||
env->CP0_Config4 = env->cpu_model->CP0_Config4;
|
||||
env->CP0_Config4_rw_bitmask = env->cpu_model->CP0_Config4_rw_bitmask;
|
||||
env->CP0_Config5 = env->cpu_model->CP0_Config5;
|
||||
env->CP0_Config5_rw_bitmask = env->cpu_model->CP0_Config5_rw_bitmask;
|
||||
env->CP0_Config6 = env->cpu_model->CP0_Config6;
|
||||
env->CP0_Config7 = env->cpu_model->CP0_Config7;
|
||||
env->CP0_LLAddr_rw_bitmask = env->cpu_model->CP0_LLAddr_rw_bitmask
|
||||
|
@@ -45,6 +45,12 @@
|
||||
(0 << CP0C3_VEIC) | (0 << CP0C3_VInt) | (0 << CP0C3_SP) | \
|
||||
(0 << CP0C3_SM) | (0 << CP0C3_TL))
|
||||
|
||||
#define MIPS_CONFIG4 \
|
||||
((0 << CP0C4_M))
|
||||
|
||||
#define MIPS_CONFIG5 \
|
||||
((0 << CP0C5_M))
|
||||
|
||||
/* MMU types, the first four entries have the same layout as the
|
||||
CP0C0_MT field. */
|
||||
enum mips_mmu_types {
|
||||
@@ -64,6 +70,10 @@ struct mips_def_t {
|
||||
int32_t CP0_Config1;
|
||||
int32_t CP0_Config2;
|
||||
int32_t CP0_Config3;
|
||||
int32_t CP0_Config4;
|
||||
int32_t CP0_Config4_rw_bitmask;
|
||||
int32_t CP0_Config5;
|
||||
int32_t CP0_Config5_rw_bitmask;
|
||||
int32_t CP0_Config6;
|
||||
int32_t CP0_Config7;
|
||||
target_ulong CP0_LLAddr_rw_bitmask;
|
||||
@@ -333,6 +343,39 @@ static const mips_def_t mips_defs[] =
|
||||
.insn_flags = CPU_MIPS32R2 | ASE_MIPS16 | ASE_DSP | ASE_DSPR2,
|
||||
.mmu_type = MMU_TYPE_R4000,
|
||||
},
|
||||
{
|
||||
/* A generic CPU providing MIPS32 Release 5 features.
|
||||
FIXME: Eventually this should be replaced by a real CPU model. */
|
||||
.name = "mips32r5-generic",
|
||||
.CP0_PRid = 0x00019700,
|
||||
.CP0_Config0 = MIPS_CONFIG0 | (0x1 << CP0C0_AR) |
|
||||
(MMU_TYPE_R4000 << CP0C0_MT),
|
||||
.CP0_Config1 = MIPS_CONFIG1 | (1 << CP0C1_FP) | (15 << CP0C1_MMU) |
|
||||
(0 << CP0C1_IS) | (3 << CP0C1_IL) | (1 << CP0C1_IA) |
|
||||
(0 << CP0C1_DS) | (3 << CP0C1_DL) | (1 << CP0C1_DA) |
|
||||
(1 << CP0C1_CA),
|
||||
.CP0_Config2 = MIPS_CONFIG2,
|
||||
.CP0_Config3 = MIPS_CONFIG3 | (1 << CP0C3_M),
|
||||
.CP0_Config4 = MIPS_CONFIG4 | (1 << CP0C4_M),
|
||||
.CP0_Config4_rw_bitmask = 0,
|
||||
.CP0_Config5 = MIPS_CONFIG5 | (1 << CP0C5_UFR),
|
||||
.CP0_Config5_rw_bitmask = (0 << CP0C5_M) | (1 << CP0C5_K) |
|
||||
(1 << CP0C5_CV) | (0 << CP0C5_EVA) |
|
||||
(1 << CP0C5_MSAEn) | (1 << CP0C5_UFR) |
|
||||
(0 << CP0C5_NFExists),
|
||||
.CP0_LLAddr_rw_bitmask = 0,
|
||||
.CP0_LLAddr_shift = 4,
|
||||
.SYNCI_Step = 32,
|
||||
.CCRes = 2,
|
||||
.CP0_Status_rw_bitmask = 0x3778FF1F,
|
||||
.CP1_fcr0 = (1 << FCR0_UFRP) | (1 << FCR0_F64) | (1 << FCR0_L) |
|
||||
(1 << FCR0_W) | (1 << FCR0_D) | (1 << FCR0_S) |
|
||||
(0x93 << FCR0_PRID),
|
||||
.SEGBITS = 32,
|
||||
.PABITS = 32,
|
||||
.insn_flags = CPU_MIPS32R5 | ASE_MIPS16 | ASE_DSP | ASE_DSPR2,
|
||||
.mmu_type = MMU_TYPE_R4000,
|
||||
},
|
||||
#if defined(TARGET_MIPS64)
|
||||
{
|
||||
.name = "R4000",
|
||||
|
@@ -707,6 +707,8 @@ static void dec_misc(DisasContext *dc, uint32_t insn)
|
||||
uint32_t L6, K5;
|
||||
#endif
|
||||
uint32_t I16, I5, I11, N26, tmp;
|
||||
TCGMemOp mop;
|
||||
|
||||
op0 = extract32(insn, 26, 6);
|
||||
op1 = extract32(insn, 24, 2);
|
||||
ra = extract32(insn, 16, 5);
|
||||
@@ -838,72 +840,46 @@ static void dec_misc(DisasContext *dc, uint32_t insn)
|
||||
/*#ifdef TARGET_OPENRISC64
|
||||
case 0x20: l.ld
|
||||
LOG_DIS("l.ld r%d, r%d, %d\n", rd, ra, I16);
|
||||
{
|
||||
check_ob64s(dc);
|
||||
TCGv_i64 t0 = tcg_temp_new_i64();
|
||||
tcg_gen_addi_i64(t0, cpu_R[ra], sign_extend(I16, 16));
|
||||
tcg_gen_qemu_ld64(cpu_R[rd], t0, dc->mem_idx);
|
||||
tcg_temp_free_i64(t0);
|
||||
}
|
||||
break;
|
||||
check_ob64s(dc);
|
||||
mop = MO_TEQ;
|
||||
goto do_load;
|
||||
#endif*/
|
||||
|
||||
case 0x21: /* l.lwz */
|
||||
LOG_DIS("l.lwz r%d, r%d, %d\n", rd, ra, I16);
|
||||
{
|
||||
TCGv t0 = tcg_temp_new();
|
||||
tcg_gen_addi_tl(t0, cpu_R[ra], sign_extend(I16, 16));
|
||||
tcg_gen_qemu_ld32u(cpu_R[rd], t0, dc->mem_idx);
|
||||
tcg_temp_free(t0);
|
||||
}
|
||||
break;
|
||||
mop = MO_TEUL;
|
||||
goto do_load;
|
||||
|
||||
case 0x22: /* l.lws */
|
||||
LOG_DIS("l.lws r%d, r%d, %d\n", rd, ra, I16);
|
||||
{
|
||||
TCGv t0 = tcg_temp_new();
|
||||
tcg_gen_addi_tl(t0, cpu_R[ra], sign_extend(I16, 16));
|
||||
tcg_gen_qemu_ld32s(cpu_R[rd], t0, dc->mem_idx);
|
||||
tcg_temp_free(t0);
|
||||
}
|
||||
break;
|
||||
mop = MO_TESL;
|
||||
goto do_load;
|
||||
|
||||
case 0x23: /* l.lbz */
|
||||
LOG_DIS("l.lbz r%d, r%d, %d\n", rd, ra, I16);
|
||||
{
|
||||
TCGv t0 = tcg_temp_new();
|
||||
tcg_gen_addi_tl(t0, cpu_R[ra], sign_extend(I16, 16));
|
||||
tcg_gen_qemu_ld8u(cpu_R[rd], t0, dc->mem_idx);
|
||||
tcg_temp_free(t0);
|
||||
}
|
||||
break;
|
||||
mop = MO_UB;
|
||||
goto do_load;
|
||||
|
||||
case 0x24: /* l.lbs */
|
||||
LOG_DIS("l.lbs r%d, r%d, %d\n", rd, ra, I16);
|
||||
{
|
||||
TCGv t0 = tcg_temp_new();
|
||||
tcg_gen_addi_tl(t0, cpu_R[ra], sign_extend(I16, 16));
|
||||
tcg_gen_qemu_ld8s(cpu_R[rd], t0, dc->mem_idx);
|
||||
tcg_temp_free(t0);
|
||||
}
|
||||
break;
|
||||
mop = MO_SB;
|
||||
goto do_load;
|
||||
|
||||
case 0x25: /* l.lhz */
|
||||
LOG_DIS("l.lhz r%d, r%d, %d\n", rd, ra, I16);
|
||||
{
|
||||
TCGv t0 = tcg_temp_new();
|
||||
tcg_gen_addi_tl(t0, cpu_R[ra], sign_extend(I16, 16));
|
||||
tcg_gen_qemu_ld16u(cpu_R[rd], t0, dc->mem_idx);
|
||||
tcg_temp_free(t0);
|
||||
}
|
||||
break;
|
||||
mop = MO_TEUW;
|
||||
goto do_load;
|
||||
|
||||
case 0x26: /* l.lhs */
|
||||
LOG_DIS("l.lhs r%d, r%d, %d\n", rd, ra, I16);
|
||||
mop = MO_TESW;
|
||||
goto do_load;
|
||||
|
||||
do_load:
|
||||
{
|
||||
TCGv t0 = tcg_temp_new();
|
||||
tcg_gen_addi_tl(t0, cpu_R[ra], sign_extend(I16, 16));
|
||||
tcg_gen_qemu_ld16s(cpu_R[rd], t0, dc->mem_idx);
|
||||
tcg_gen_qemu_ld_tl(cpu_R[rd], t0, dc->mem_idx, mop);
|
||||
tcg_temp_free(t0);
|
||||
}
|
||||
break;
|
||||
@@ -1042,42 +1018,31 @@ static void dec_misc(DisasContext *dc, uint32_t insn)
|
||||
/*#ifdef TARGET_OPENRISC64
|
||||
case 0x34: l.sd
|
||||
LOG_DIS("l.sd %d, r%d, r%d, %d\n", I5, ra, rb, I11);
|
||||
{
|
||||
check_ob64s(dc);
|
||||
TCGv_i64 t0 = tcg_temp_new_i64();
|
||||
tcg_gen_addi_tl(t0, cpu_R[ra], sign_extend(tmp, 16));
|
||||
tcg_gen_qemu_st64(cpu_R[rb], t0, dc->mem_idx);
|
||||
tcg_temp_free_i64(t0);
|
||||
}
|
||||
break;
|
||||
check_ob64s(dc);
|
||||
mop = MO_TEQ;
|
||||
goto do_store;
|
||||
#endif*/
|
||||
|
||||
case 0x35: /* l.sw */
|
||||
LOG_DIS("l.sw %d, r%d, r%d, %d\n", I5, ra, rb, I11);
|
||||
{
|
||||
TCGv t0 = tcg_temp_new();
|
||||
tcg_gen_addi_tl(t0, cpu_R[ra], sign_extend(tmp, 16));
|
||||
tcg_gen_qemu_st32(cpu_R[rb], t0, dc->mem_idx);
|
||||
tcg_temp_free(t0);
|
||||
}
|
||||
break;
|
||||
mop = MO_TEUL;
|
||||
goto do_store;
|
||||
|
||||
case 0x36: /* l.sb */
|
||||
LOG_DIS("l.sb %d, r%d, r%d, %d\n", I5, ra, rb, I11);
|
||||
{
|
||||
TCGv t0 = tcg_temp_new();
|
||||
tcg_gen_addi_tl(t0, cpu_R[ra], sign_extend(tmp, 16));
|
||||
tcg_gen_qemu_st8(cpu_R[rb], t0, dc->mem_idx);
|
||||
tcg_temp_free(t0);
|
||||
}
|
||||
break;
|
||||
mop = MO_UB;
|
||||
goto do_store;
|
||||
|
||||
case 0x37: /* l.sh */
|
||||
LOG_DIS("l.sh %d, r%d, r%d, %d\n", I5, ra, rb, I11);
|
||||
mop = MO_TEUW;
|
||||
goto do_store;
|
||||
|
||||
do_store:
|
||||
{
|
||||
TCGv t0 = tcg_temp_new();
|
||||
tcg_gen_addi_tl(t0, cpu_R[ra], sign_extend(tmp, 16));
|
||||
tcg_gen_qemu_st16(cpu_R[rb], t0, dc->mem_idx);
|
||||
tcg_gen_qemu_st_tl(cpu_R[rb], t0, dc->mem_idx, mop);
|
||||
tcg_temp_free(t0);
|
||||
}
|
||||
break;
|
||||
|
@@ -1228,7 +1228,7 @@ int kvm_arch_handle_exit(CPUState *cs, struct kvm_run *run)
|
||||
#endif
|
||||
case KVM_EXIT_EPR:
|
||||
DPRINTF("handle epr\n");
|
||||
run->epr.epr = ldl_phys(env->mpic_iack);
|
||||
run->epr.epr = ldl_phys(cs->as, env->mpic_iack);
|
||||
ret = 0;
|
||||
break;
|
||||
case KVM_EXIT_WATCHDOG:
|
||||
|
@@ -350,7 +350,7 @@ static void test_i440fx_firmware(FirmwareTestFixture *fixture,
|
||||
qtest_start(cmdline);
|
||||
g_free(cmdline);
|
||||
|
||||
/* Qemu has loaded the firmware (because qtest_start() only returns after
|
||||
/* QEMU has loaded the firmware (because qtest_start() only returns after
|
||||
* the QMP handshake completes). We must unlink the firmware blob right
|
||||
* here, because any assertion firing below would leak it in the
|
||||
* filesystem. This is also the reason why we recreate the blob every time
|
||||
|
@@ -44,6 +44,8 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
|
||||
_supported_fmt generic
|
||||
_supported_proto generic
|
||||
_supported_os Linux
|
||||
_unsupported_imgopts "subformat=twoGbMaxExtentFlat" \
|
||||
"subformat=twoGbMaxExtentSparse"
|
||||
|
||||
# vpc is limited to 127GB, so we can't test it here
|
||||
if [ "$IMGFMT" = "vpc" ]; then
|
||||
|
@@ -56,11 +56,22 @@ _use_sample_img iotest-dirtylog-10G-4M.vhdx.bz2
|
||||
|
||||
echo
|
||||
echo "=== Verify open image read-only fails, due to dirty log ==="
|
||||
$QEMU_IO -r -c "read -pP 0xa5 0 18M" "$TEST_IMG" 2>&1 | grep -o "Permission denied"
|
||||
$QEMU_IO -r -c "read -pP 0xa5 0 18M" "$TEST_IMG" 2>&1 | _filter_testdir \
|
||||
| _filter_qemu_io
|
||||
|
||||
echo "=== Verify open image replays log ==="
|
||||
$QEMU_IO -c "read -pP 0xa5 0 18M" "$TEST_IMG" | _filter_qemu_io
|
||||
|
||||
# extract fresh sample image again
|
||||
_use_sample_img iotest-dirtylog-10G-4M.vhdx.bz2
|
||||
|
||||
echo "=== Verify qemu-img check -r all replays log ==="
|
||||
$QEMU_IMG check -r all "$TEST_IMG" 2>&1 | _filter_testdir | _filter_qemu
|
||||
|
||||
echo "=== Verify open image read-only succeeds after log replay ==="
|
||||
$QEMU_IO -r -c "read -pP 0xa5 0 18M" "$TEST_IMG" 2>&1 | _filter_testdir \
|
||||
| _filter_qemu_io
|
||||
|
||||
# success, all done
|
||||
echo "*** done"
|
||||
rm -f $seq.full
|
||||
|
@@ -1,8 +1,21 @@
|
||||
QA output created by 070
|
||||
|
||||
=== Verify open image read-only fails, due to dirty log ===
|
||||
Permission denied
|
||||
qemu-io: can't open device TEST_DIR/iotest-dirtylog-10G-4M.vhdx: VHDX image file 'TEST_DIR/iotest-dirtylog-10G-4M.vhdx' opened read-only, but contains a log that needs to be replayed. To replay the log, execute:
|
||||
qemu-img check -r all 'TEST_DIR/iotest-dirtylog-10G-4M.vhdx': Operation not permitted
|
||||
no file open, try 'help open'
|
||||
=== Verify open image replays log ===
|
||||
read 18874368/18874368 bytes at offset 0
|
||||
18 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
||||
=== Verify qemu-img check -r all replays log ===
|
||||
The following inconsistencies were found and repaired:
|
||||
|
||||
0 leaked clusters
|
||||
1 corruptions
|
||||
|
||||
Double checking the fixed image now...
|
||||
No errors were found on the image.
|
||||
=== Verify open image read-only succeeds after log replay ===
|
||||
read 18874368/18874368 bytes at offset 0
|
||||
18 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
||||
*** done
|
||||
|
55
vl.c
55
vl.c
@@ -27,64 +27,13 @@
|
||||
#include <time.h>
|
||||
#include <errno.h>
|
||||
#include <sys/time.h>
|
||||
#include <zlib.h>
|
||||
#include "qemu/bitmap.h"
|
||||
|
||||
/* Needed early for CONFIG_BSD etc. */
|
||||
#include "config-host.h"
|
||||
|
||||
#ifndef _WIN32
|
||||
#include <libgen.h>
|
||||
#include <sys/times.h>
|
||||
#include <sys/wait.h>
|
||||
#include <termios.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/resource.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <net/if.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <dirent.h>
|
||||
#include <netdb.h>
|
||||
#include <sys/select.h>
|
||||
|
||||
#ifdef CONFIG_BSD
|
||||
#include <sys/stat.h>
|
||||
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
|
||||
#include <sys/sysctl.h>
|
||||
#else
|
||||
#include <util.h>
|
||||
#endif
|
||||
#else
|
||||
#ifdef __linux__
|
||||
#include <malloc.h>
|
||||
|
||||
#include <linux/ppdev.h>
|
||||
#include <linux/parport.h>
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SECCOMP
|
||||
#include "sysemu/seccomp.h"
|
||||
#endif
|
||||
|
||||
#ifdef __sun__
|
||||
#include <sys/stat.h>
|
||||
#include <sys/ethernet.h>
|
||||
#include <sys/sockio.h>
|
||||
#include <netinet/arp.h>
|
||||
#include <netinet/in_systm.h>
|
||||
#include <netinet/ip.h>
|
||||
#include <netinet/ip_icmp.h> // must come after ip.h
|
||||
#include <netinet/udp.h>
|
||||
#include <netinet/tcp.h>
|
||||
#include <net/if.h>
|
||||
#include <syslog.h>
|
||||
#include <stropts.h>
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_VDE)
|
||||
#include <libvdeplug.h>
|
||||
#endif
|
||||
@@ -135,6 +84,7 @@ int main(int argc, char **argv)
|
||||
#include "exec/gdbstub.h"
|
||||
#include "qemu/timer.h"
|
||||
#include "sysemu/char.h"
|
||||
#include "qemu/bitmap.h"
|
||||
#include "qemu/cache-utils.h"
|
||||
#include "sysemu/blockdev.h"
|
||||
#include "hw/block/block.h"
|
||||
@@ -172,9 +122,6 @@ int main(int argc, char **argv)
|
||||
#include "qapi/string-input-visitor.h"
|
||||
#include "qom/object_interfaces.h"
|
||||
|
||||
//#define DEBUG_NET
|
||||
//#define DEBUG_SLIRP
|
||||
|
||||
#define DEFAULT_RAM_SIZE 128
|
||||
|
||||
#define MAX_VIRTIO_CONSOLES 1
|
||||
|
Reference in New Issue
Block a user