id
int32
0
27.3k
func
stringlengths
26
142k
target
bool
2 classes
project
stringclasses
2 values
commit_id
stringlengths
40
40
func_clean
stringlengths
26
131k
vul_lines
dict
normalized_func
stringlengths
24
132k
lines
sequencelengths
1
2.8k
label
sequencelengths
1
2.8k
line_no
sequencelengths
1
2.8k
19,988
static int32_t virtio_net_flush_tx(VirtIONet *n, VirtQueue *vq) { VirtQueueElement elem; int32_t num_packets = 0; if (!(n->vdev.status & VIRTIO_CONFIG_S_DRIVER_OK)) { return num_packets; } if (n->async_tx.elem.out_num) { virtio_queue_set_notification(n->tx_vq, 0); return num_packets; } while (virtqueue_pop(vq, &elem)) { ssize_t ret, len = 0; unsigned int out_num = elem.out_num; struct iovec *out_sg = &elem.out_sg[0]; unsigned hdr_len; /* hdr_len refers to the header received from the guest */ hdr_len = n->mergeable_rx_bufs ? sizeof(struct virtio_net_hdr_mrg_rxbuf) : sizeof(struct virtio_net_hdr); if (out_num < 1 || out_sg->iov_len != hdr_len) { error_report("virtio-net header not in first element"); exit(1); } /* ignore the header if GSO is not supported */ if (!n->has_vnet_hdr) { out_num--; out_sg++; len += hdr_len; } else if (n->mergeable_rx_bufs) { /* tapfd expects a struct virtio_net_hdr */ hdr_len -= sizeof(struct virtio_net_hdr); out_sg->iov_len -= hdr_len; len += hdr_len; } ret = qemu_sendv_packet_async(&n->nic->nc, out_sg, out_num, virtio_net_tx_complete); if (ret == 0) { virtio_queue_set_notification(n->tx_vq, 0); n->async_tx.elem = elem; n->async_tx.len = len; return -EBUSY; } len += ret; virtqueue_push(vq, &elem, len); virtio_notify(&n->vdev, vq); if (++num_packets >= n->tx_burst) { break; } } return num_packets; }
true
qemu
783e7706937fe15523b609b545587a028a2bdd03
static int32_t virtio_net_flush_tx(VirtIONet *n, VirtQueue *vq) { VirtQueueElement elem; int32_t num_packets = 0; if (!(n->vdev.status & VIRTIO_CONFIG_S_DRIVER_OK)) { return num_packets; } if (n->async_tx.elem.out_num) { virtio_queue_set_notification(n->tx_vq, 0); return num_packets; } while (virtqueue_pop(vq, &elem)) { ssize_t ret, len = 0; unsigned int out_num = elem.out_num; struct iovec *out_sg = &elem.out_sg[0]; unsigned hdr_len; hdr_len = n->mergeable_rx_bufs ? sizeof(struct virtio_net_hdr_mrg_rxbuf) : sizeof(struct virtio_net_hdr); if (out_num < 1 || out_sg->iov_len != hdr_len) { error_report("virtio-net header not in first element"); exit(1); } if (!n->has_vnet_hdr) { out_num--; out_sg++; len += hdr_len; } else if (n->mergeable_rx_bufs) { hdr_len -= sizeof(struct virtio_net_hdr); out_sg->iov_len -= hdr_len; len += hdr_len; } ret = qemu_sendv_packet_async(&n->nic->nc, out_sg, out_num, virtio_net_tx_complete); if (ret == 0) { virtio_queue_set_notification(n->tx_vq, 0); n->async_tx.elem = elem; n->async_tx.len = len; return -EBUSY; } len += ret; virtqueue_push(vq, &elem, len); virtio_notify(&n->vdev, vq); if (++num_packets >= n->tx_burst) { break; } } return num_packets; }
{ "code": [], "line_no": [] }
static int32_t FUNC_0(VirtIONet *n, VirtQueue *vq) { VirtQueueElement elem; int32_t num_packets = 0; if (!(n->vdev.status & VIRTIO_CONFIG_S_DRIVER_OK)) { return num_packets; } if (n->async_tx.elem.VAR_0) { virtio_queue_set_notification(n->tx_vq, 0); return num_packets; } while (virtqueue_pop(vq, &elem)) { ssize_t ret, len = 0; unsigned int VAR_0 = elem.VAR_0; struct iovec *VAR_1 = &elem.VAR_1[0]; unsigned VAR_2; VAR_2 = n->mergeable_rx_bufs ? sizeof(struct virtio_net_hdr_mrg_rxbuf) : sizeof(struct virtio_net_hdr); if (VAR_0 < 1 || VAR_1->iov_len != VAR_2) { error_report("virtio-net header not in first element"); exit(1); } if (!n->has_vnet_hdr) { VAR_0--; VAR_1++; len += VAR_2; } else if (n->mergeable_rx_bufs) { VAR_2 -= sizeof(struct virtio_net_hdr); VAR_1->iov_len -= VAR_2; len += VAR_2; } ret = qemu_sendv_packet_async(&n->nic->nc, VAR_1, VAR_0, virtio_net_tx_complete); if (ret == 0) { virtio_queue_set_notification(n->tx_vq, 0); n->async_tx.elem = elem; n->async_tx.len = len; return -EBUSY; } len += ret; virtqueue_push(vq, &elem, len); virtio_notify(&n->vdev, vq); if (++num_packets >= n->tx_burst) { break; } } return num_packets; }
[ "static int32_t FUNC_0(VirtIONet *n, VirtQueue *vq)\n{", "VirtQueueElement elem;", "int32_t num_packets = 0;", "if (!(n->vdev.status & VIRTIO_CONFIG_S_DRIVER_OK)) {", "return num_packets;", "}", "if (n->async_tx.elem.VAR_0) {", "virtio_queue_set_notification(n->tx_vq, 0);", "return num_packets;", "}", "while (virtqueue_pop(vq, &elem)) {", "ssize_t ret, len = 0;", "unsigned int VAR_0 = elem.VAR_0;", "struct iovec *VAR_1 = &elem.VAR_1[0];", "unsigned VAR_2;", "VAR_2 = n->mergeable_rx_bufs ?\nsizeof(struct virtio_net_hdr_mrg_rxbuf) :\nsizeof(struct virtio_net_hdr);", "if (VAR_0 < 1 || VAR_1->iov_len != VAR_2) {", "error_report(\"virtio-net header not in first element\");", "exit(1);", "}", "if (!n->has_vnet_hdr) {", "VAR_0--;", "VAR_1++;", "len += VAR_2;", "} else if (n->mergeable_rx_bufs) {", "VAR_2 -= sizeof(struct virtio_net_hdr);", "VAR_1->iov_len -= VAR_2;", "len += VAR_2;", "}", "ret = qemu_sendv_packet_async(&n->nic->nc, VAR_1, VAR_0,\nvirtio_net_tx_complete);", "if (ret == 0) {", "virtio_queue_set_notification(n->tx_vq, 0);", "n->async_tx.elem = elem;", "n->async_tx.len = len;", "return -EBUSY;", "}", "len += ret;", "virtqueue_push(vq, &elem, len);", "virtio_notify(&n->vdev, vq);", "if (++num_packets >= n->tx_burst) {", "break;", "}", "}", "return num_packets;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 43, 45, 47 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 85, 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 103 ], [ 107 ], [ 109 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ] ]
19,989
static int vmdk_read(BlockDriverState *bs, int64_t sector_num, uint8_t *buf, int nb_sectors) { BDRVVmdkState *s = bs->opaque; int ret; uint64_t n, index_in_cluster; VmdkExtent *extent = NULL; uint64_t cluster_offset; while (nb_sectors > 0) { extent = find_extent(s, sector_num, extent); if (!extent) { return -EIO; } ret = get_cluster_offset( bs, extent, NULL, sector_num << 9, 0, &cluster_offset); index_in_cluster = sector_num % extent->cluster_sectors; n = extent->cluster_sectors - index_in_cluster; if (n > nb_sectors) { n = nb_sectors; } if (ret) { /* if not allocated, try to read from parent image, if exist */ if (bs->backing_hd) { if (!vmdk_is_cid_valid(bs)) { return -EINVAL; } ret = bdrv_read(bs->backing_hd, sector_num, buf, n); if (ret < 0) { return ret; } } else { memset(buf, 0, 512 * n); } } else { ret = vmdk_read_extent(extent, cluster_offset, index_in_cluster * 512, buf, n); if (ret) { return ret; } } nb_sectors -= n; sector_num += n; buf += n * 512; } return 0; }
true
qemu
b1649fae49a899a222c3ac53c5009dd6f23349e1
static int vmdk_read(BlockDriverState *bs, int64_t sector_num, uint8_t *buf, int nb_sectors) { BDRVVmdkState *s = bs->opaque; int ret; uint64_t n, index_in_cluster; VmdkExtent *extent = NULL; uint64_t cluster_offset; while (nb_sectors > 0) { extent = find_extent(s, sector_num, extent); if (!extent) { return -EIO; } ret = get_cluster_offset( bs, extent, NULL, sector_num << 9, 0, &cluster_offset); index_in_cluster = sector_num % extent->cluster_sectors; n = extent->cluster_sectors - index_in_cluster; if (n > nb_sectors) { n = nb_sectors; } if (ret) { if (bs->backing_hd) { if (!vmdk_is_cid_valid(bs)) { return -EINVAL; } ret = bdrv_read(bs->backing_hd, sector_num, buf, n); if (ret < 0) { return ret; } } else { memset(buf, 0, 512 * n); } } else { ret = vmdk_read_extent(extent, cluster_offset, index_in_cluster * 512, buf, n); if (ret) { return ret; } } nb_sectors -= n; sector_num += n; buf += n * 512; } return 0; }
{ "code": [ " index_in_cluster = sector_num % extent->cluster_sectors;", " index_in_cluster = sector_num % extent->cluster_sectors;" ], "line_no": [ 35, 35 ] }
static int FUNC_0(BlockDriverState *VAR_0, int64_t VAR_1, uint8_t *VAR_2, int VAR_3) { BDRVVmdkState *s = VAR_0->opaque; int VAR_4; uint64_t n, index_in_cluster; VmdkExtent *extent = NULL; uint64_t cluster_offset; while (VAR_3 > 0) { extent = find_extent(s, VAR_1, extent); if (!extent) { return -EIO; } VAR_4 = get_cluster_offset( VAR_0, extent, NULL, VAR_1 << 9, 0, &cluster_offset); index_in_cluster = VAR_1 % extent->cluster_sectors; n = extent->cluster_sectors - index_in_cluster; if (n > VAR_3) { n = VAR_3; } if (VAR_4) { if (VAR_0->backing_hd) { if (!vmdk_is_cid_valid(VAR_0)) { return -EINVAL; } VAR_4 = bdrv_read(VAR_0->backing_hd, VAR_1, VAR_2, n); if (VAR_4 < 0) { return VAR_4; } } else { memset(VAR_2, 0, 512 * n); } } else { VAR_4 = vmdk_read_extent(extent, cluster_offset, index_in_cluster * 512, VAR_2, n); if (VAR_4) { return VAR_4; } } VAR_3 -= n; VAR_1 += n; VAR_2 += n * 512; } return 0; }
[ "static int FUNC_0(BlockDriverState *VAR_0, int64_t VAR_1,\nuint8_t *VAR_2, int VAR_3)\n{", "BDRVVmdkState *s = VAR_0->opaque;", "int VAR_4;", "uint64_t n, index_in_cluster;", "VmdkExtent *extent = NULL;", "uint64_t cluster_offset;", "while (VAR_3 > 0) {", "extent = find_extent(s, VAR_1, extent);", "if (!extent) {", "return -EIO;", "}", "VAR_4 = get_cluster_offset(\nVAR_0, extent, NULL,\nVAR_1 << 9, 0, &cluster_offset);", "index_in_cluster = VAR_1 % extent->cluster_sectors;", "n = extent->cluster_sectors - index_in_cluster;", "if (n > VAR_3) {", "n = VAR_3;", "}", "if (VAR_4) {", "if (VAR_0->backing_hd) {", "if (!vmdk_is_cid_valid(VAR_0)) {", "return -EINVAL;", "}", "VAR_4 = bdrv_read(VAR_0->backing_hd, VAR_1, VAR_2, n);", "if (VAR_4 < 0) {", "return VAR_4;", "}", "} else {", "memset(VAR_2, 0, 512 * n);", "}", "} else {", "VAR_4 = vmdk_read_extent(extent,\ncluster_offset, index_in_cluster * 512,\nVAR_2, n);", "if (VAR_4) {", "return VAR_4;", "}", "}", "VAR_3 -= n;", "VAR_1 += n;", "VAR_2 += n * 512;", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29, 31, 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73, 75, 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ] ]
19,990
static void gen_mfsr(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG); #else TCGv t0; if (unlikely(ctx->pr)) { gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG); return; } t0 = tcg_const_tl(SR(ctx->opcode)); gen_helper_load_sr(cpu_gpr[rD(ctx->opcode)], cpu_env, t0); tcg_temp_free(t0); #endif }
true
qemu
9b2fadda3e0196ffd485adde4fe9cdd6fae35300
static void gen_mfsr(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG); #else TCGv t0; if (unlikely(ctx->pr)) { gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG); return; } t0 = tcg_const_tl(SR(ctx->opcode)); gen_helper_load_sr(cpu_gpr[rD(ctx->opcode)], cpu_env, t0); tcg_temp_free(t0); #endif }
{ "code": [ " if (unlikely(ctx->pr)) {", " if (unlikely(ctx->pr)) {", "#if defined(CONFIG_USER_ONLY)", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", "#else", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", "#endif", "#if defined(CONFIG_USER_ONLY)", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", "#else", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", "#endif", "#endif", "#if defined(CONFIG_USER_ONLY)", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", "#else", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", " if (unlikely(ctx->pr)) {", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", "#endif", "#endif", " if (unlikely(ctx->pr)) {", "#endif", "#endif", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", "#endif", "#if defined(CONFIG_USER_ONLY)", "#else", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", "#if defined(CONFIG_USER_ONLY)", "#else", " if (unlikely(ctx->pr)) {", "#endif", "#if defined(CONFIG_USER_ONLY)", "#else", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", "#if defined(CONFIG_USER_ONLY)", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif" ], "line_no": [ 13, 13, 5, 7, 9, 13, 15, 27, 5, 7, 9, 13, 15, 27, 27, 5, 7, 9, 13, 15, 13, 27, 7, 13, 15, 27, 7, 13, 15, 27, 7, 13, 15, 27, 7, 13, 15, 27, 7, 13, 15, 27, 7, 13, 15, 27, 7, 13, 15, 27, 7, 13, 15, 27, 7, 13, 15, 27, 7, 13, 15, 27, 7, 13, 15, 27, 27, 13, 27, 27, 27, 13, 27, 13, 27, 27, 13, 27, 13, 27, 13, 27, 13, 27, 13, 27, 13, 27, 13, 27, 13, 27, 13, 27, 13, 27, 7, 13, 15, 27, 7, 13, 15, 27, 7, 13, 15, 27, 7, 13, 15, 27, 5, 9, 13, 27, 13, 27, 5, 9, 13, 27, 5, 9, 13, 27, 13, 27, 13, 27, 13, 27, 13, 27, 13, 27, 13, 27, 13, 27, 13, 27, 13, 27, 13, 27, 5, 13, 27, 13, 27, 13, 27, 13, 27, 13, 27, 13, 27, 13, 27, 13, 27, 13, 27 ] }
static void FUNC_0(DisasContext *VAR_0) { #if defined(CONFIG_USER_ONLY) gen_inval_exception(VAR_0, POWERPC_EXCP_PRIV_REG); #else TCGv t0; if (unlikely(VAR_0->pr)) { gen_inval_exception(VAR_0, POWERPC_EXCP_PRIV_REG); return; } t0 = tcg_const_tl(SR(VAR_0->opcode)); gen_helper_load_sr(cpu_gpr[rD(VAR_0->opcode)], cpu_env, t0); tcg_temp_free(t0); #endif }
[ "static void FUNC_0(DisasContext *VAR_0)\n{", "#if defined(CONFIG_USER_ONLY)\ngen_inval_exception(VAR_0, POWERPC_EXCP_PRIV_REG);", "#else\nTCGv t0;", "if (unlikely(VAR_0->pr)) {", "gen_inval_exception(VAR_0, POWERPC_EXCP_PRIV_REG);", "return;", "}", "t0 = tcg_const_tl(SR(VAR_0->opcode));", "gen_helper_load_sr(cpu_gpr[rD(VAR_0->opcode)], cpu_env, t0);", "tcg_temp_free(t0);", "#endif\n}" ]
[ 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1 ]
[ [ 1, 3 ], [ 5, 7 ], [ 9, 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27, 29 ] ]
19,992
void fd_start_incoming_migration(const char *infd, Error **errp) { int fd; QEMUFile *f; DPRINTF("Attempting to start an incoming migration via fd\n"); fd = strtol(infd, NULL, 0); f = qemu_fdopen(fd, "rb"); if(f == NULL) { error_setg_errno(errp, errno, "failed to open the source descriptor"); return; } qemu_set_fd_handler2(fd, NULL, fd_accept_incoming_migration, NULL, f); }
true
qemu
60fe637bf0e4d7989e21e50f52526444765c63b4
void fd_start_incoming_migration(const char *infd, Error **errp) { int fd; QEMUFile *f; DPRINTF("Attempting to start an incoming migration via fd\n"); fd = strtol(infd, NULL, 0); f = qemu_fdopen(fd, "rb"); if(f == NULL) { error_setg_errno(errp, errno, "failed to open the source descriptor"); return; } qemu_set_fd_handler2(fd, NULL, fd_accept_incoming_migration, NULL, f); }
{ "code": [], "line_no": [] }
void FUNC_0(const char *VAR_0, Error **VAR_1) { int VAR_2; QEMUFile *f; DPRINTF("Attempting to start an incoming migration via VAR_2\n"); VAR_2 = strtol(VAR_0, NULL, 0); f = qemu_fdopen(VAR_2, "rb"); if(f == NULL) { error_setg_errno(VAR_1, errno, "failed to open the source descriptor"); return; } qemu_set_fd_handler2(VAR_2, NULL, fd_accept_incoming_migration, NULL, f); }
[ "void FUNC_0(const char *VAR_0, Error **VAR_1)\n{", "int VAR_2;", "QEMUFile *f;", "DPRINTF(\"Attempting to start an incoming migration via VAR_2\\n\");", "VAR_2 = strtol(VAR_0, NULL, 0);", "f = qemu_fdopen(VAR_2, \"rb\");", "if(f == NULL) {", "error_setg_errno(VAR_1, errno, \"failed to open the source descriptor\");", "return;", "}", "qemu_set_fd_handler2(VAR_2, NULL, fd_accept_incoming_migration, NULL, f);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ] ]
19,994
int cpu_ppc_handle_mmu_fault (CPUState *env, target_ulong address, int rw, int mmu_idx, int is_softmmu) { mmu_ctx_t ctx; int access_type; int ret = 0; if (rw == 2) { /* code access */ rw = 0; access_type = ACCESS_CODE; } else { /* data access */ /* XXX: put correct access by using cpu_restore_state() correctly */ access_type = ACCESS_INT; // access_type = env->access_type; } ret = get_physical_address(env, &ctx, address, rw, access_type, 1); if (ret == 0) { ret = tlb_set_page_exec(env, address & TARGET_PAGE_MASK, ctx.raddr & TARGET_PAGE_MASK, ctx.prot, mmu_idx, is_softmmu); } else if (ret < 0) { #if defined (DEBUG_MMU) if (loglevel != 0) cpu_dump_state(env, logfile, fprintf, 0); #endif if (access_type == ACCESS_CODE) { switch (ret) { case -1: /* No matches in page tables or TLB */ switch (env->mmu_model) { case POWERPC_MMU_SOFT_6xx: env->exception_index = POWERPC_EXCP_IFTLB; env->error_code = 1 << 18; env->spr[SPR_IMISS] = address; env->spr[SPR_ICMP] = 0x80000000 | ctx.ptem; goto tlb_miss; case POWERPC_MMU_SOFT_74xx: env->exception_index = POWERPC_EXCP_IFTLB; goto tlb_miss_74xx; case POWERPC_MMU_SOFT_4xx: case POWERPC_MMU_SOFT_4xx_Z: env->exception_index = POWERPC_EXCP_ITLB; env->error_code = 0; env->spr[SPR_40x_DEAR] = address; env->spr[SPR_40x_ESR] = 0x00000000; break; case POWERPC_MMU_32B: #if defined(TARGET_PPC64) case POWERPC_MMU_64B: #endif env->exception_index = POWERPC_EXCP_ISI; env->error_code = 0x40000000; break; case POWERPC_MMU_BOOKE: /* XXX: TODO */ cpu_abort(env, "MMU model not implemented\n"); return -1; case POWERPC_MMU_BOOKE_FSL: /* XXX: TODO */ cpu_abort(env, "MMU model not implemented\n"); return -1; case POWERPC_MMU_REAL_4xx: cpu_abort(env, "PowerPC 401 should never raise any MMU " "exceptions\n"); return -1; default: cpu_abort(env, "Unknown or invalid MMU model\n"); return -1; } break; case -2: /* Access rights violation */ env->exception_index = POWERPC_EXCP_ISI; env->error_code = 0x08000000; break; case -3: /* No execute protection violation */ env->exception_index = POWERPC_EXCP_ISI; env->error_code = 0x10000000; break; case -4: /* Direct store exception */ /* No code fetch is allowed in direct-store areas */ env->exception_index = POWERPC_EXCP_ISI; env->error_code = 0x10000000; break; #if defined(TARGET_PPC64) case -5: /* No match in segment table */ env->exception_index = POWERPC_EXCP_ISEG; env->error_code = 0; break; #endif } } else { switch (ret) { case -1: /* No matches in page tables or TLB */ switch (env->mmu_model) { case POWERPC_MMU_SOFT_6xx: if (rw == 1) { env->exception_index = POWERPC_EXCP_DSTLB; env->error_code = 1 << 16; } else { env->exception_index = POWERPC_EXCP_DLTLB; env->error_code = 0; } env->spr[SPR_DMISS] = address; env->spr[SPR_DCMP] = 0x80000000 | ctx.ptem; tlb_miss: env->error_code |= ctx.key << 19; env->spr[SPR_HASH1] = ctx.pg_addr[0]; env->spr[SPR_HASH2] = ctx.pg_addr[1]; break; case POWERPC_MMU_SOFT_74xx: if (rw == 1) { env->exception_index = POWERPC_EXCP_DSTLB; } else { env->exception_index = POWERPC_EXCP_DLTLB; } tlb_miss_74xx: /* Implement LRU algorithm */ env->error_code = ctx.key << 19; env->spr[SPR_TLBMISS] = (address & ~((target_ulong)0x3)) | ((env->last_way + 1) & (env->nb_ways - 1)); env->spr[SPR_PTEHI] = 0x80000000 | ctx.ptem; break; case POWERPC_MMU_SOFT_4xx: case POWERPC_MMU_SOFT_4xx_Z: env->exception_index = POWERPC_EXCP_DTLB; env->error_code = 0; env->spr[SPR_40x_DEAR] = address; if (rw) env->spr[SPR_40x_ESR] = 0x00800000; else env->spr[SPR_40x_ESR] = 0x00000000; break; case POWERPC_MMU_32B: #if defined(TARGET_PPC64) case POWERPC_MMU_64B: #endif env->exception_index = POWERPC_EXCP_DSI; env->error_code = 0; env->spr[SPR_DAR] = address; if (rw == 1) env->spr[SPR_DSISR] = 0x42000000; else env->spr[SPR_DSISR] = 0x40000000; break; case POWERPC_MMU_BOOKE: /* XXX: TODO */ cpu_abort(env, "MMU model not implemented\n"); return -1; case POWERPC_MMU_BOOKE_FSL: /* XXX: TODO */ cpu_abort(env, "MMU model not implemented\n"); return -1; case POWERPC_MMU_REAL_4xx: cpu_abort(env, "PowerPC 401 should never raise any MMU " "exceptions\n"); return -1; default: cpu_abort(env, "Unknown or invalid MMU model\n"); return -1; } break; case -2: /* Access rights violation */ env->exception_index = POWERPC_EXCP_DSI; env->error_code = 0; env->spr[SPR_DAR] = address; if (rw == 1) env->spr[SPR_DSISR] = 0x0A000000; else env->spr[SPR_DSISR] = 0x08000000; break; case -4: /* Direct store exception */ switch (access_type) { case ACCESS_FLOAT: /* Floating point load/store */ env->exception_index = POWERPC_EXCP_ALIGN; env->error_code = POWERPC_EXCP_ALIGN_FP; env->spr[SPR_DAR] = address; break; case ACCESS_RES: /* lwarx, ldarx or stwcx. */ env->exception_index = POWERPC_EXCP_DSI; env->error_code = 0; env->spr[SPR_DAR] = address; if (rw == 1) env->spr[SPR_DSISR] = 0x06000000; else env->spr[SPR_DSISR] = 0x04000000; break; case ACCESS_EXT: /* eciwx or ecowx */ env->exception_index = POWERPC_EXCP_DSI; env->error_code = 0; env->spr[SPR_DAR] = address; if (rw == 1) env->spr[SPR_DSISR] = 0x06100000; else env->spr[SPR_DSISR] = 0x04100000; break; default: printf("DSI: invalid exception (%d)\n", ret); env->exception_index = POWERPC_EXCP_PROGRAM; env->error_code = POWERPC_EXCP_INVAL | POWERPC_EXCP_INVAL_INVAL; env->spr[SPR_DAR] = address; break; } break; #if defined(TARGET_PPC64) case -5: /* No match in segment table */ env->exception_index = POWERPC_EXCP_DSEG; env->error_code = 0; env->spr[SPR_DAR] = address; break; #endif } } #if 0 printf("%s: set exception to %d %02x\n", __func__, env->exception, env->error_code); #endif ret = 1; } return ret; }
true
qemu
faadf50e2962dd54175647a80bd6fc4319c91973
int cpu_ppc_handle_mmu_fault (CPUState *env, target_ulong address, int rw, int mmu_idx, int is_softmmu) { mmu_ctx_t ctx; int access_type; int ret = 0; if (rw == 2) { rw = 0; access_type = ACCESS_CODE; } else { access_type = ACCESS_INT; } ret = get_physical_address(env, &ctx, address, rw, access_type, 1); if (ret == 0) { ret = tlb_set_page_exec(env, address & TARGET_PAGE_MASK, ctx.raddr & TARGET_PAGE_MASK, ctx.prot, mmu_idx, is_softmmu); } else if (ret < 0) { #if defined (DEBUG_MMU) if (loglevel != 0) cpu_dump_state(env, logfile, fprintf, 0); #endif if (access_type == ACCESS_CODE) { switch (ret) { case -1: switch (env->mmu_model) { case POWERPC_MMU_SOFT_6xx: env->exception_index = POWERPC_EXCP_IFTLB; env->error_code = 1 << 18; env->spr[SPR_IMISS] = address; env->spr[SPR_ICMP] = 0x80000000 | ctx.ptem; goto tlb_miss; case POWERPC_MMU_SOFT_74xx: env->exception_index = POWERPC_EXCP_IFTLB; goto tlb_miss_74xx; case POWERPC_MMU_SOFT_4xx: case POWERPC_MMU_SOFT_4xx_Z: env->exception_index = POWERPC_EXCP_ITLB; env->error_code = 0; env->spr[SPR_40x_DEAR] = address; env->spr[SPR_40x_ESR] = 0x00000000; break; case POWERPC_MMU_32B: #if defined(TARGET_PPC64) case POWERPC_MMU_64B: #endif env->exception_index = POWERPC_EXCP_ISI; env->error_code = 0x40000000; break; case POWERPC_MMU_BOOKE: cpu_abort(env, "MMU model not implemented\n"); return -1; case POWERPC_MMU_BOOKE_FSL: cpu_abort(env, "MMU model not implemented\n"); return -1; case POWERPC_MMU_REAL_4xx: cpu_abort(env, "PowerPC 401 should never raise any MMU " "exceptions\n"); return -1; default: cpu_abort(env, "Unknown or invalid MMU model\n"); return -1; } break; case -2: env->exception_index = POWERPC_EXCP_ISI; env->error_code = 0x08000000; break; case -3: env->exception_index = POWERPC_EXCP_ISI; env->error_code = 0x10000000; break; case -4: env->exception_index = POWERPC_EXCP_ISI; env->error_code = 0x10000000; break; #if defined(TARGET_PPC64) case -5: env->exception_index = POWERPC_EXCP_ISEG; env->error_code = 0; break; #endif } } else { switch (ret) { case -1: switch (env->mmu_model) { case POWERPC_MMU_SOFT_6xx: if (rw == 1) { env->exception_index = POWERPC_EXCP_DSTLB; env->error_code = 1 << 16; } else { env->exception_index = POWERPC_EXCP_DLTLB; env->error_code = 0; } env->spr[SPR_DMISS] = address; env->spr[SPR_DCMP] = 0x80000000 | ctx.ptem; tlb_miss: env->error_code |= ctx.key << 19; env->spr[SPR_HASH1] = ctx.pg_addr[0]; env->spr[SPR_HASH2] = ctx.pg_addr[1]; break; case POWERPC_MMU_SOFT_74xx: if (rw == 1) { env->exception_index = POWERPC_EXCP_DSTLB; } else { env->exception_index = POWERPC_EXCP_DLTLB; } tlb_miss_74xx: env->error_code = ctx.key << 19; env->spr[SPR_TLBMISS] = (address & ~((target_ulong)0x3)) | ((env->last_way + 1) & (env->nb_ways - 1)); env->spr[SPR_PTEHI] = 0x80000000 | ctx.ptem; break; case POWERPC_MMU_SOFT_4xx: case POWERPC_MMU_SOFT_4xx_Z: env->exception_index = POWERPC_EXCP_DTLB; env->error_code = 0; env->spr[SPR_40x_DEAR] = address; if (rw) env->spr[SPR_40x_ESR] = 0x00800000; else env->spr[SPR_40x_ESR] = 0x00000000; break; case POWERPC_MMU_32B: #if defined(TARGET_PPC64) case POWERPC_MMU_64B: #endif env->exception_index = POWERPC_EXCP_DSI; env->error_code = 0; env->spr[SPR_DAR] = address; if (rw == 1) env->spr[SPR_DSISR] = 0x42000000; else env->spr[SPR_DSISR] = 0x40000000; break; case POWERPC_MMU_BOOKE: cpu_abort(env, "MMU model not implemented\n"); return -1; case POWERPC_MMU_BOOKE_FSL: cpu_abort(env, "MMU model not implemented\n"); return -1; case POWERPC_MMU_REAL_4xx: cpu_abort(env, "PowerPC 401 should never raise any MMU " "exceptions\n"); return -1; default: cpu_abort(env, "Unknown or invalid MMU model\n"); return -1; } break; case -2: env->exception_index = POWERPC_EXCP_DSI; env->error_code = 0; env->spr[SPR_DAR] = address; if (rw == 1) env->spr[SPR_DSISR] = 0x0A000000; else env->spr[SPR_DSISR] = 0x08000000; break; case -4: switch (access_type) { case ACCESS_FLOAT: env->exception_index = POWERPC_EXCP_ALIGN; env->error_code = POWERPC_EXCP_ALIGN_FP; env->spr[SPR_DAR] = address; break; case ACCESS_RES: env->exception_index = POWERPC_EXCP_DSI; env->error_code = 0; env->spr[SPR_DAR] = address; if (rw == 1) env->spr[SPR_DSISR] = 0x06000000; else env->spr[SPR_DSISR] = 0x04000000; break; case ACCESS_EXT: env->exception_index = POWERPC_EXCP_DSI; env->error_code = 0; env->spr[SPR_DAR] = address; if (rw == 1) env->spr[SPR_DSISR] = 0x06100000; else env->spr[SPR_DSISR] = 0x04100000; break; default: printf("DSI: invalid exception (%d)\n", ret); env->exception_index = POWERPC_EXCP_PROGRAM; env->error_code = POWERPC_EXCP_INVAL | POWERPC_EXCP_INVAL_INVAL; env->spr[SPR_DAR] = address; break; } break; #if defined(TARGET_PPC64) case -5: env->exception_index = POWERPC_EXCP_DSEG; env->error_code = 0; env->spr[SPR_DAR] = address; break; #endif } } #if 0 printf("%s: set exception to %d %02x\n", __func__, env->exception, env->error_code); #endif ret = 1; } return ret; }
{ "code": [ " ret = get_physical_address(env, &ctx, address, rw, access_type, 1);", "#if 0", "#endif", "#endif", "#endif", "#endif", "#endif", "#endif" ], "line_no": [ 37, 455, 55, 55, 55, 55, 55, 55 ] }
int FUNC_0 (CPUState *VAR_0, target_ulong VAR_1, int VAR_2, int VAR_3, int VAR_4) { mmu_ctx_t ctx; int VAR_5; int VAR_6 = 0; if (VAR_2 == 2) { VAR_2 = 0; VAR_5 = ACCESS_CODE; } else { VAR_5 = ACCESS_INT; } VAR_6 = get_physical_address(VAR_0, &ctx, VAR_1, VAR_2, VAR_5, 1); if (VAR_6 == 0) { VAR_6 = tlb_set_page_exec(VAR_0, VAR_1 & TARGET_PAGE_MASK, ctx.raddr & TARGET_PAGE_MASK, ctx.prot, VAR_3, VAR_4); } else if (VAR_6 < 0) { #if defined (DEBUG_MMU) if (loglevel != 0) cpu_dump_state(VAR_0, logfile, fprintf, 0); #endif if (VAR_5 == ACCESS_CODE) { switch (VAR_6) { case -1: switch (VAR_0->mmu_model) { case POWERPC_MMU_SOFT_6xx: VAR_0->exception_index = POWERPC_EXCP_IFTLB; VAR_0->error_code = 1 << 18; VAR_0->spr[SPR_IMISS] = VAR_1; VAR_0->spr[SPR_ICMP] = 0x80000000 | ctx.ptem; goto tlb_miss; case POWERPC_MMU_SOFT_74xx: VAR_0->exception_index = POWERPC_EXCP_IFTLB; goto tlb_miss_74xx; case POWERPC_MMU_SOFT_4xx: case POWERPC_MMU_SOFT_4xx_Z: VAR_0->exception_index = POWERPC_EXCP_ITLB; VAR_0->error_code = 0; VAR_0->spr[SPR_40x_DEAR] = VAR_1; VAR_0->spr[SPR_40x_ESR] = 0x00000000; break; case POWERPC_MMU_32B: #if defined(TARGET_PPC64) case POWERPC_MMU_64B: #endif VAR_0->exception_index = POWERPC_EXCP_ISI; VAR_0->error_code = 0x40000000; break; case POWERPC_MMU_BOOKE: cpu_abort(VAR_0, "MMU model not implemented\n"); return -1; case POWERPC_MMU_BOOKE_FSL: cpu_abort(VAR_0, "MMU model not implemented\n"); return -1; case POWERPC_MMU_REAL_4xx: cpu_abort(VAR_0, "PowerPC 401 should never raise any MMU " "exceptions\n"); return -1; default: cpu_abort(VAR_0, "Unknown or invalid MMU model\n"); return -1; } break; case -2: VAR_0->exception_index = POWERPC_EXCP_ISI; VAR_0->error_code = 0x08000000; break; case -3: VAR_0->exception_index = POWERPC_EXCP_ISI; VAR_0->error_code = 0x10000000; break; case -4: VAR_0->exception_index = POWERPC_EXCP_ISI; VAR_0->error_code = 0x10000000; break; #if defined(TARGET_PPC64) case -5: VAR_0->exception_index = POWERPC_EXCP_ISEG; VAR_0->error_code = 0; break; #endif } } else { switch (VAR_6) { case -1: switch (VAR_0->mmu_model) { case POWERPC_MMU_SOFT_6xx: if (VAR_2 == 1) { VAR_0->exception_index = POWERPC_EXCP_DSTLB; VAR_0->error_code = 1 << 16; } else { VAR_0->exception_index = POWERPC_EXCP_DLTLB; VAR_0->error_code = 0; } VAR_0->spr[SPR_DMISS] = VAR_1; VAR_0->spr[SPR_DCMP] = 0x80000000 | ctx.ptem; tlb_miss: VAR_0->error_code |= ctx.key << 19; VAR_0->spr[SPR_HASH1] = ctx.pg_addr[0]; VAR_0->spr[SPR_HASH2] = ctx.pg_addr[1]; break; case POWERPC_MMU_SOFT_74xx: if (VAR_2 == 1) { VAR_0->exception_index = POWERPC_EXCP_DSTLB; } else { VAR_0->exception_index = POWERPC_EXCP_DLTLB; } tlb_miss_74xx: VAR_0->error_code = ctx.key << 19; VAR_0->spr[SPR_TLBMISS] = (VAR_1 & ~((target_ulong)0x3)) | ((VAR_0->last_way + 1) & (VAR_0->nb_ways - 1)); VAR_0->spr[SPR_PTEHI] = 0x80000000 | ctx.ptem; break; case POWERPC_MMU_SOFT_4xx: case POWERPC_MMU_SOFT_4xx_Z: VAR_0->exception_index = POWERPC_EXCP_DTLB; VAR_0->error_code = 0; VAR_0->spr[SPR_40x_DEAR] = VAR_1; if (VAR_2) VAR_0->spr[SPR_40x_ESR] = 0x00800000; else VAR_0->spr[SPR_40x_ESR] = 0x00000000; break; case POWERPC_MMU_32B: #if defined(TARGET_PPC64) case POWERPC_MMU_64B: #endif VAR_0->exception_index = POWERPC_EXCP_DSI; VAR_0->error_code = 0; VAR_0->spr[SPR_DAR] = VAR_1; if (VAR_2 == 1) VAR_0->spr[SPR_DSISR] = 0x42000000; else VAR_0->spr[SPR_DSISR] = 0x40000000; break; case POWERPC_MMU_BOOKE: cpu_abort(VAR_0, "MMU model not implemented\n"); return -1; case POWERPC_MMU_BOOKE_FSL: cpu_abort(VAR_0, "MMU model not implemented\n"); return -1; case POWERPC_MMU_REAL_4xx: cpu_abort(VAR_0, "PowerPC 401 should never raise any MMU " "exceptions\n"); return -1; default: cpu_abort(VAR_0, "Unknown or invalid MMU model\n"); return -1; } break; case -2: VAR_0->exception_index = POWERPC_EXCP_DSI; VAR_0->error_code = 0; VAR_0->spr[SPR_DAR] = VAR_1; if (VAR_2 == 1) VAR_0->spr[SPR_DSISR] = 0x0A000000; else VAR_0->spr[SPR_DSISR] = 0x08000000; break; case -4: switch (VAR_5) { case ACCESS_FLOAT: VAR_0->exception_index = POWERPC_EXCP_ALIGN; VAR_0->error_code = POWERPC_EXCP_ALIGN_FP; VAR_0->spr[SPR_DAR] = VAR_1; break; case ACCESS_RES: VAR_0->exception_index = POWERPC_EXCP_DSI; VAR_0->error_code = 0; VAR_0->spr[SPR_DAR] = VAR_1; if (VAR_2 == 1) VAR_0->spr[SPR_DSISR] = 0x06000000; else VAR_0->spr[SPR_DSISR] = 0x04000000; break; case ACCESS_EXT: VAR_0->exception_index = POWERPC_EXCP_DSI; VAR_0->error_code = 0; VAR_0->spr[SPR_DAR] = VAR_1; if (VAR_2 == 1) VAR_0->spr[SPR_DSISR] = 0x06100000; else VAR_0->spr[SPR_DSISR] = 0x04100000; break; default: printf("DSI: invalid exception (%d)\n", VAR_6); VAR_0->exception_index = POWERPC_EXCP_PROGRAM; VAR_0->error_code = POWERPC_EXCP_INVAL | POWERPC_EXCP_INVAL_INVAL; VAR_0->spr[SPR_DAR] = VAR_1; break; } break; #if defined(TARGET_PPC64) case -5: VAR_0->exception_index = POWERPC_EXCP_DSEG; VAR_0->error_code = 0; VAR_0->spr[SPR_DAR] = VAR_1; break; #endif } } #if 0 printf("%s: set exception to %d %02x\n", __func__, VAR_0->exception, VAR_0->error_code); #endif VAR_6 = 1; } return VAR_6; }
[ "int FUNC_0 (CPUState *VAR_0, target_ulong VAR_1, int VAR_2,\nint VAR_3, int VAR_4)\n{", "mmu_ctx_t ctx;", "int VAR_5;", "int VAR_6 = 0;", "if (VAR_2 == 2) {", "VAR_2 = 0;", "VAR_5 = ACCESS_CODE;", "} else {", "VAR_5 = ACCESS_INT;", "}", "VAR_6 = get_physical_address(VAR_0, &ctx, VAR_1, VAR_2, VAR_5, 1);", "if (VAR_6 == 0) {", "VAR_6 = tlb_set_page_exec(VAR_0, VAR_1 & TARGET_PAGE_MASK,\nctx.raddr & TARGET_PAGE_MASK, ctx.prot,\nVAR_3, VAR_4);", "} else if (VAR_6 < 0) {", "#if defined (DEBUG_MMU)\nif (loglevel != 0)\ncpu_dump_state(VAR_0, logfile, fprintf, 0);", "#endif\nif (VAR_5 == ACCESS_CODE) {", "switch (VAR_6) {", "case -1:\nswitch (VAR_0->mmu_model) {", "case POWERPC_MMU_SOFT_6xx:\nVAR_0->exception_index = POWERPC_EXCP_IFTLB;", "VAR_0->error_code = 1 << 18;", "VAR_0->spr[SPR_IMISS] = VAR_1;", "VAR_0->spr[SPR_ICMP] = 0x80000000 | ctx.ptem;", "goto tlb_miss;", "case POWERPC_MMU_SOFT_74xx:\nVAR_0->exception_index = POWERPC_EXCP_IFTLB;", "goto tlb_miss_74xx;", "case POWERPC_MMU_SOFT_4xx:\ncase POWERPC_MMU_SOFT_4xx_Z:\nVAR_0->exception_index = POWERPC_EXCP_ITLB;", "VAR_0->error_code = 0;", "VAR_0->spr[SPR_40x_DEAR] = VAR_1;", "VAR_0->spr[SPR_40x_ESR] = 0x00000000;", "break;", "case POWERPC_MMU_32B:\n#if defined(TARGET_PPC64)\ncase POWERPC_MMU_64B:\n#endif\nVAR_0->exception_index = POWERPC_EXCP_ISI;", "VAR_0->error_code = 0x40000000;", "break;", "case POWERPC_MMU_BOOKE:\ncpu_abort(VAR_0, \"MMU model not implemented\\n\");", "return -1;", "case POWERPC_MMU_BOOKE_FSL:\ncpu_abort(VAR_0, \"MMU model not implemented\\n\");", "return -1;", "case POWERPC_MMU_REAL_4xx:\ncpu_abort(VAR_0, \"PowerPC 401 should never raise any MMU \"\n\"exceptions\\n\");", "return -1;", "default:\ncpu_abort(VAR_0, \"Unknown or invalid MMU model\\n\");", "return -1;", "}", "break;", "case -2:\nVAR_0->exception_index = POWERPC_EXCP_ISI;", "VAR_0->error_code = 0x08000000;", "break;", "case -3:\nVAR_0->exception_index = POWERPC_EXCP_ISI;", "VAR_0->error_code = 0x10000000;", "break;", "case -4:\nVAR_0->exception_index = POWERPC_EXCP_ISI;", "VAR_0->error_code = 0x10000000;", "break;", "#if defined(TARGET_PPC64)\ncase -5:\nVAR_0->exception_index = POWERPC_EXCP_ISEG;", "VAR_0->error_code = 0;", "break;", "#endif\n}", "} else {", "switch (VAR_6) {", "case -1:\nswitch (VAR_0->mmu_model) {", "case POWERPC_MMU_SOFT_6xx:\nif (VAR_2 == 1) {", "VAR_0->exception_index = POWERPC_EXCP_DSTLB;", "VAR_0->error_code = 1 << 16;", "} else {", "VAR_0->exception_index = POWERPC_EXCP_DLTLB;", "VAR_0->error_code = 0;", "}", "VAR_0->spr[SPR_DMISS] = VAR_1;", "VAR_0->spr[SPR_DCMP] = 0x80000000 | ctx.ptem;", "tlb_miss:\nVAR_0->error_code |= ctx.key << 19;", "VAR_0->spr[SPR_HASH1] = ctx.pg_addr[0];", "VAR_0->spr[SPR_HASH2] = ctx.pg_addr[1];", "break;", "case POWERPC_MMU_SOFT_74xx:\nif (VAR_2 == 1) {", "VAR_0->exception_index = POWERPC_EXCP_DSTLB;", "} else {", "VAR_0->exception_index = POWERPC_EXCP_DLTLB;", "}", "tlb_miss_74xx:\nVAR_0->error_code = ctx.key << 19;", "VAR_0->spr[SPR_TLBMISS] = (VAR_1 & ~((target_ulong)0x3)) |\n((VAR_0->last_way + 1) & (VAR_0->nb_ways - 1));", "VAR_0->spr[SPR_PTEHI] = 0x80000000 | ctx.ptem;", "break;", "case POWERPC_MMU_SOFT_4xx:\ncase POWERPC_MMU_SOFT_4xx_Z:\nVAR_0->exception_index = POWERPC_EXCP_DTLB;", "VAR_0->error_code = 0;", "VAR_0->spr[SPR_40x_DEAR] = VAR_1;", "if (VAR_2)\nVAR_0->spr[SPR_40x_ESR] = 0x00800000;", "else\nVAR_0->spr[SPR_40x_ESR] = 0x00000000;", "break;", "case POWERPC_MMU_32B:\n#if defined(TARGET_PPC64)\ncase POWERPC_MMU_64B:\n#endif\nVAR_0->exception_index = POWERPC_EXCP_DSI;", "VAR_0->error_code = 0;", "VAR_0->spr[SPR_DAR] = VAR_1;", "if (VAR_2 == 1)\nVAR_0->spr[SPR_DSISR] = 0x42000000;", "else\nVAR_0->spr[SPR_DSISR] = 0x40000000;", "break;", "case POWERPC_MMU_BOOKE:\ncpu_abort(VAR_0, \"MMU model not implemented\\n\");", "return -1;", "case POWERPC_MMU_BOOKE_FSL:\ncpu_abort(VAR_0, \"MMU model not implemented\\n\");", "return -1;", "case POWERPC_MMU_REAL_4xx:\ncpu_abort(VAR_0, \"PowerPC 401 should never raise any MMU \"\n\"exceptions\\n\");", "return -1;", "default:\ncpu_abort(VAR_0, \"Unknown or invalid MMU model\\n\");", "return -1;", "}", "break;", "case -2:\nVAR_0->exception_index = POWERPC_EXCP_DSI;", "VAR_0->error_code = 0;", "VAR_0->spr[SPR_DAR] = VAR_1;", "if (VAR_2 == 1)\nVAR_0->spr[SPR_DSISR] = 0x0A000000;", "else\nVAR_0->spr[SPR_DSISR] = 0x08000000;", "break;", "case -4:\nswitch (VAR_5) {", "case ACCESS_FLOAT:\nVAR_0->exception_index = POWERPC_EXCP_ALIGN;", "VAR_0->error_code = POWERPC_EXCP_ALIGN_FP;", "VAR_0->spr[SPR_DAR] = VAR_1;", "break;", "case ACCESS_RES:\nVAR_0->exception_index = POWERPC_EXCP_DSI;", "VAR_0->error_code = 0;", "VAR_0->spr[SPR_DAR] = VAR_1;", "if (VAR_2 == 1)\nVAR_0->spr[SPR_DSISR] = 0x06000000;", "else\nVAR_0->spr[SPR_DSISR] = 0x04000000;", "break;", "case ACCESS_EXT:\nVAR_0->exception_index = POWERPC_EXCP_DSI;", "VAR_0->error_code = 0;", "VAR_0->spr[SPR_DAR] = VAR_1;", "if (VAR_2 == 1)\nVAR_0->spr[SPR_DSISR] = 0x06100000;", "else\nVAR_0->spr[SPR_DSISR] = 0x04100000;", "break;", "default:\nprintf(\"DSI: invalid exception (%d)\\n\", VAR_6);", "VAR_0->exception_index = POWERPC_EXCP_PROGRAM;", "VAR_0->error_code =\nPOWERPC_EXCP_INVAL | POWERPC_EXCP_INVAL_INVAL;", "VAR_0->spr[SPR_DAR] = VAR_1;", "break;", "}", "break;", "#if defined(TARGET_PPC64)\ncase -5:\nVAR_0->exception_index = POWERPC_EXCP_DSEG;", "VAR_0->error_code = 0;", "VAR_0->spr[SPR_DAR] = VAR_1;", "break;", "#endif\n}", "}", "#if 0\nprintf(\"%s: set exception to %d %02x\\n\", __func__,\nVAR_0->exception, VAR_0->error_code);", "#endif\nVAR_6 = 1;", "}", "return VAR_6;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41, 43, 45 ], [ 47 ], [ 49, 51, 53 ], [ 55, 57 ], [ 59 ], [ 61, 65 ], [ 67, 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79, 81 ], [ 83 ], [ 85, 87, 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99, 101, 103, 105, 107 ], [ 109 ], [ 111 ], [ 113, 117 ], [ 119 ], [ 121, 125 ], [ 127 ], [ 129, 131, 133 ], [ 135 ], [ 137, 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147, 151 ], [ 153 ], [ 155 ], [ 157, 161 ], [ 163 ], [ 165 ], [ 167, 173 ], [ 175 ], [ 177 ], [ 179, 181, 185 ], [ 187 ], [ 189 ], [ 191, 193 ], [ 195 ], [ 197 ], [ 199, 203 ], [ 205, 207 ], [ 209 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ], [ 225, 227 ], [ 229 ], [ 231 ], [ 233 ], [ 235, 237 ], [ 239 ], [ 241 ], [ 243 ], [ 245 ], [ 247, 251 ], [ 253, 255 ], [ 257 ], [ 259 ], [ 261, 263, 265 ], [ 267 ], [ 269 ], [ 271, 273 ], [ 275, 277 ], [ 279 ], [ 281, 283, 285, 287, 289 ], [ 291 ], [ 293 ], [ 295, 297 ], [ 299, 301 ], [ 303 ], [ 305, 309 ], [ 311 ], [ 313, 317 ], [ 319 ], [ 321, 323, 325 ], [ 327 ], [ 329, 331 ], [ 333 ], [ 335 ], [ 337 ], [ 339, 343 ], [ 345 ], [ 347 ], [ 349, 351 ], [ 353, 355 ], [ 357 ], [ 359, 363 ], [ 365, 369 ], [ 371 ], [ 373 ], [ 375 ], [ 377, 381 ], [ 383 ], [ 385 ], [ 387, 389 ], [ 391, 393 ], [ 395 ], [ 397, 401 ], [ 403 ], [ 405 ], [ 407, 409 ], [ 411, 413 ], [ 415 ], [ 417, 419 ], [ 421 ], [ 423, 425 ], [ 427 ], [ 429 ], [ 431 ], [ 433 ], [ 435, 437, 441 ], [ 443 ], [ 445 ], [ 447 ], [ 449, 451 ], [ 453 ], [ 455, 457, 459 ], [ 461, 463 ], [ 465 ], [ 469 ], [ 471 ] ]
19,995
void do_POWER_rac (void) { #if 0 mmu_ctx_t ctx; /* We don't have to generate many instances of this instruction, * as rac is supervisor only. */ if (get_physical_address(env, &ctx, T0, 0, ACCESS_INT, 1) == 0) T0 = ctx.raddr; #endif }
true
qemu
faadf50e2962dd54175647a80bd6fc4319c91973
void do_POWER_rac (void) { #if 0 mmu_ctx_t ctx; if (get_physical_address(env, &ctx, T0, 0, ACCESS_INT, 1) == 0) T0 = ctx.raddr; #endif }
{ "code": [ "#if 0", " if (get_physical_address(env, &ctx, T0, 0, ACCESS_INT, 1) == 0)", "#endif", "#endif", "#endif", "#endif", "#endif", "#endif" ], "line_no": [ 5, 17, 21, 21, 21, 21, 21, 21 ] }
void FUNC_0 (void) { #if 0 mmu_ctx_t ctx; if (get_physical_address(env, &ctx, T0, 0, ACCESS_INT, 1) == 0) T0 = ctx.raddr; #endif }
[ "void FUNC_0 (void)\n{", "#if 0\nmmu_ctx_t ctx;", "if (get_physical_address(env, &ctx, T0, 0, ACCESS_INT, 1) == 0)\nT0 = ctx.raddr;", "#endif\n}" ]
[ 0, 1, 1, 1 ]
[ [ 1, 3 ], [ 5, 7 ], [ 17, 19 ], [ 21, 23 ] ]
19,997
hwaddr s390_cpu_get_phys_page_debug(CPUState *cs, vaddr vaddr) { S390CPU *cpu = S390_CPU(cs); CPUS390XState *env = &cpu->env; target_ulong raddr; int prot; uint64_t asc = env->psw.mask & PSW_MASK_ASC; /* 31-Bit mode */ if (!(env->psw.mask & PSW_MASK_64)) { vaddr &= 0x7fffffff; } mmu_translate(env, vaddr, MMU_INST_FETCH, asc, &raddr, &prot, false); return raddr; }
true
qemu
234779a2b9141d9386289ba5ed86c9d617567646
hwaddr s390_cpu_get_phys_page_debug(CPUState *cs, vaddr vaddr) { S390CPU *cpu = S390_CPU(cs); CPUS390XState *env = &cpu->env; target_ulong raddr; int prot; uint64_t asc = env->psw.mask & PSW_MASK_ASC; if (!(env->psw.mask & PSW_MASK_64)) { vaddr &= 0x7fffffff; } mmu_translate(env, vaddr, MMU_INST_FETCH, asc, &raddr, &prot, false); return raddr; }
{ "code": [ " mmu_translate(env, vaddr, MMU_INST_FETCH, asc, &raddr, &prot, false);" ], "line_no": [ 27 ] }
hwaddr FUNC_0(CPUState *cs, vaddr vaddr) { S390CPU *cpu = S390_CPU(cs); CPUS390XState *env = &cpu->env; target_ulong raddr; int VAR_0; uint64_t asc = env->psw.mask & PSW_MASK_ASC; if (!(env->psw.mask & PSW_MASK_64)) { vaddr &= 0x7fffffff; } mmu_translate(env, vaddr, MMU_INST_FETCH, asc, &raddr, &VAR_0, false); return raddr; }
[ "hwaddr FUNC_0(CPUState *cs, vaddr vaddr)\n{", "S390CPU *cpu = S390_CPU(cs);", "CPUS390XState *env = &cpu->env;", "target_ulong raddr;", "int VAR_0;", "uint64_t asc = env->psw.mask & PSW_MASK_ASC;", "if (!(env->psw.mask & PSW_MASK_64)) {", "vaddr &= 0x7fffffff;", "}", "mmu_translate(env, vaddr, MMU_INST_FETCH, asc, &raddr, &VAR_0, false);", "return raddr;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 31 ], [ 33 ] ]
20,001
static void msix_handle_mask_update(PCIDevice *dev, int vector) { if (!msix_is_masked(dev, vector) && msix_is_pending(dev, vector)) { msix_clr_pending(dev, vector); msix_notify(dev, vector); } }
true
qemu
ae392c416c69a020226c768d9c3af08b29dd6d96
static void msix_handle_mask_update(PCIDevice *dev, int vector) { if (!msix_is_masked(dev, vector) && msix_is_pending(dev, vector)) { msix_clr_pending(dev, vector); msix_notify(dev, vector); } }
{ "code": [ "static void msix_handle_mask_update(PCIDevice *dev, int vector)", " if (!msix_is_masked(dev, vector) && msix_is_pending(dev, vector)) {" ], "line_no": [ 1, 5 ] }
static void FUNC_0(PCIDevice *VAR_0, int VAR_1) { if (!msix_is_masked(VAR_0, VAR_1) && msix_is_pending(VAR_0, VAR_1)) { msix_clr_pending(VAR_0, VAR_1); msix_notify(VAR_0, VAR_1); } }
[ "static void FUNC_0(PCIDevice *VAR_0, int VAR_1)\n{", "if (!msix_is_masked(VAR_0, VAR_1) && msix_is_pending(VAR_0, VAR_1)) {", "msix_clr_pending(VAR_0, VAR_1);", "msix_notify(VAR_0, VAR_1);", "}", "}" ]
[ 1, 1, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ] ]
20,002
static int dct_quantize_c(MpegEncContext *s, DCTELEM *block, int n, int qscale, int *overflow) { int i, j, level, last_non_zero, q; const int *qmat; int bias; int max=0; unsigned int threshold1, threshold2; av_fdct (block); /* we need this permutation so that we correct the IDCT permutation. will be moved into DCT code */ block_permute(block); if (s->mb_intra) { if (!s->h263_aic) { if (n < 4) q = s->y_dc_scale; else q = s->c_dc_scale; q = q << 3; } else /* For AIC we skip quant/dequant of INTRADC */ q = 1 << 3; /* note: block[0] is assumed to be positive */ block[0] = (block[0] + (q >> 1)) / q; i = 1; last_non_zero = 0; qmat = s->q_intra_matrix[qscale]; bias= s->intra_quant_bias<<(QMAT_SHIFT - 3 - QUANT_BIAS_SHIFT); } else { i = 0; last_non_zero = -1; qmat = s->q_inter_matrix[qscale]; bias= s->inter_quant_bias<<(QMAT_SHIFT - 3 - QUANT_BIAS_SHIFT); } threshold1= (1<<(QMAT_SHIFT - 3)) - bias - 1; threshold2= threshold1<<1; for(;i<64;i++) { j = zigzag_direct[i]; level = block[j]; level = level * qmat[j]; // if( bias+level >= (1<<(QMAT_SHIFT - 3)) // || bias-level >= (1<<(QMAT_SHIFT - 3))){ if(((unsigned)(level+threshold1))>threshold2){ if(level>0){ level= (bias + level)>>(QMAT_SHIFT - 3); block[j]= level; }else{ level= (bias - level)>>(QMAT_SHIFT - 3); block[j]= -level; } max |=level; last_non_zero = i; }else{ block[j]=0; } } *overflow= s->max_qcoeff < max; //overflow might have happend return last_non_zero; }
false
FFmpeg
7f2fe444a39bca733d390b6608801c5f002bfd31
static int dct_quantize_c(MpegEncContext *s, DCTELEM *block, int n, int qscale, int *overflow) { int i, j, level, last_non_zero, q; const int *qmat; int bias; int max=0; unsigned int threshold1, threshold2; av_fdct (block); block_permute(block); if (s->mb_intra) { if (!s->h263_aic) { if (n < 4) q = s->y_dc_scale; else q = s->c_dc_scale; q = q << 3; } else q = 1 << 3; block[0] = (block[0] + (q >> 1)) / q; i = 1; last_non_zero = 0; qmat = s->q_intra_matrix[qscale]; bias= s->intra_quant_bias<<(QMAT_SHIFT - 3 - QUANT_BIAS_SHIFT); } else { i = 0; last_non_zero = -1; qmat = s->q_inter_matrix[qscale]; bias= s->inter_quant_bias<<(QMAT_SHIFT - 3 - QUANT_BIAS_SHIFT); } threshold1= (1<<(QMAT_SHIFT - 3)) - bias - 1; threshold2= threshold1<<1; for(;i<64;i++) { j = zigzag_direct[i]; level = block[j]; level = level * qmat[j]; if(((unsigned)(level+threshold1))>threshold2){ if(level>0){ level= (bias + level)>>(QMAT_SHIFT - 3); block[j]= level; }else{ level= (bias - level)>>(QMAT_SHIFT - 3); block[j]= -level; } max |=level; last_non_zero = i; }else{ block[j]=0; } } *overflow= s->max_qcoeff < max; return last_non_zero; }
{ "code": [], "line_no": [] }
static int FUNC_0(MpegEncContext *VAR_0, DCTELEM *VAR_1, int VAR_2, int VAR_3, int *VAR_4) { int VAR_5, VAR_6, VAR_7, VAR_8, VAR_9; const int *VAR_10; int VAR_11; int VAR_12=0; unsigned int VAR_13, VAR_14; av_fdct (VAR_1); block_permute(VAR_1); if (VAR_0->mb_intra) { if (!VAR_0->h263_aic) { if (VAR_2 < 4) VAR_9 = VAR_0->y_dc_scale; else VAR_9 = VAR_0->c_dc_scale; VAR_9 = VAR_9 << 3; } else VAR_9 = 1 << 3; VAR_1[0] = (VAR_1[0] + (VAR_9 >> 1)) / VAR_9; VAR_5 = 1; VAR_8 = 0; VAR_10 = VAR_0->q_intra_matrix[VAR_3]; VAR_11= VAR_0->intra_quant_bias<<(QMAT_SHIFT - 3 - QUANT_BIAS_SHIFT); } else { VAR_5 = 0; VAR_8 = -1; VAR_10 = VAR_0->q_inter_matrix[VAR_3]; VAR_11= VAR_0->inter_quant_bias<<(QMAT_SHIFT - 3 - QUANT_BIAS_SHIFT); } VAR_13= (1<<(QMAT_SHIFT - 3)) - VAR_11 - 1; VAR_14= VAR_13<<1; for(;VAR_5<64;VAR_5++) { VAR_6 = zigzag_direct[VAR_5]; VAR_7 = VAR_1[VAR_6]; VAR_7 = VAR_7 * VAR_10[VAR_6]; if(((unsigned)(VAR_7+VAR_13))>VAR_14){ if(VAR_7>0){ VAR_7= (VAR_11 + VAR_7)>>(QMAT_SHIFT - 3); VAR_1[VAR_6]= VAR_7; }else{ VAR_7= (VAR_11 - VAR_7)>>(QMAT_SHIFT - 3); VAR_1[VAR_6]= -VAR_7; } VAR_12 |=VAR_7; VAR_8 = VAR_5; }else{ VAR_1[VAR_6]=0; } } *VAR_4= VAR_0->max_qcoeff < VAR_12; return VAR_8; }
[ "static int FUNC_0(MpegEncContext *VAR_0,\nDCTELEM *VAR_1, int VAR_2,\nint VAR_3, int *VAR_4)\n{", "int VAR_5, VAR_6, VAR_7, VAR_8, VAR_9;", "const int *VAR_10;", "int VAR_11;", "int VAR_12=0;", "unsigned int VAR_13, VAR_14;", "av_fdct (VAR_1);", "block_permute(VAR_1);", "if (VAR_0->mb_intra) {", "if (!VAR_0->h263_aic) {", "if (VAR_2 < 4)\nVAR_9 = VAR_0->y_dc_scale;", "else\nVAR_9 = VAR_0->c_dc_scale;", "VAR_9 = VAR_9 << 3;", "} else", "VAR_9 = 1 << 3;", "VAR_1[0] = (VAR_1[0] + (VAR_9 >> 1)) / VAR_9;", "VAR_5 = 1;", "VAR_8 = 0;", "VAR_10 = VAR_0->q_intra_matrix[VAR_3];", "VAR_11= VAR_0->intra_quant_bias<<(QMAT_SHIFT - 3 - QUANT_BIAS_SHIFT);", "} else {", "VAR_5 = 0;", "VAR_8 = -1;", "VAR_10 = VAR_0->q_inter_matrix[VAR_3];", "VAR_11= VAR_0->inter_quant_bias<<(QMAT_SHIFT - 3 - QUANT_BIAS_SHIFT);", "}", "VAR_13= (1<<(QMAT_SHIFT - 3)) - VAR_11 - 1;", "VAR_14= VAR_13<<1;", "for(;VAR_5<64;VAR_5++) {", "VAR_6 = zigzag_direct[VAR_5];", "VAR_7 = VAR_1[VAR_6];", "VAR_7 = VAR_7 * VAR_10[VAR_6];", "if(((unsigned)(VAR_7+VAR_13))>VAR_14){", "if(VAR_7>0){", "VAR_7= (VAR_11 + VAR_7)>>(QMAT_SHIFT - 3);", "VAR_1[VAR_6]= VAR_7;", "}else{", "VAR_7= (VAR_11 - VAR_7)>>(QMAT_SHIFT - 3);", "VAR_1[VAR_6]= -VAR_7;", "}", "VAR_12 |=VAR_7;", "VAR_8 = VAR_5;", "}else{", "VAR_1[VAR_6]=0;", "}", "}", "*VAR_4= VAR_0->max_qcoeff < VAR_12;", "return VAR_8;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 29 ], [ 33 ], [ 35 ], [ 37, 39 ], [ 41, 43 ], [ 45 ], [ 47 ], [ 51 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 131 ], [ 133 ] ]
20,003
static void radix_sort(RCCMPEntry *data, int size) { int buckets[RADIX_PASSES][NBUCKETS]; RCCMPEntry *tmp = av_malloc_array(size, sizeof(*tmp)); radix_count(data, size, buckets); radix_sort_pass(tmp, data, size, buckets[0], 0); radix_sort_pass(data, tmp, size, buckets[1], 1); if (buckets[2][NBUCKETS - 1] || buckets[3][NBUCKETS - 1]) { radix_sort_pass(tmp, data, size, buckets[2], 2); radix_sort_pass(data, tmp, size, buckets[3], 3); } av_free(tmp); }
false
FFmpeg
6c5b98d40b8eeec14174fb9602acbf4b0c924981
static void radix_sort(RCCMPEntry *data, int size) { int buckets[RADIX_PASSES][NBUCKETS]; RCCMPEntry *tmp = av_malloc_array(size, sizeof(*tmp)); radix_count(data, size, buckets); radix_sort_pass(tmp, data, size, buckets[0], 0); radix_sort_pass(data, tmp, size, buckets[1], 1); if (buckets[2][NBUCKETS - 1] || buckets[3][NBUCKETS - 1]) { radix_sort_pass(tmp, data, size, buckets[2], 2); radix_sort_pass(data, tmp, size, buckets[3], 3); } av_free(tmp); }
{ "code": [], "line_no": [] }
static void FUNC_0(RCCMPEntry *VAR_0, int VAR_1) { int VAR_2[RADIX_PASSES][NBUCKETS]; RCCMPEntry *tmp = av_malloc_array(VAR_1, sizeof(*tmp)); radix_count(VAR_0, VAR_1, VAR_2); radix_sort_pass(tmp, VAR_0, VAR_1, VAR_2[0], 0); radix_sort_pass(VAR_0, tmp, VAR_1, VAR_2[1], 1); if (VAR_2[2][NBUCKETS - 1] || VAR_2[3][NBUCKETS - 1]) { radix_sort_pass(tmp, VAR_0, VAR_1, VAR_2[2], 2); radix_sort_pass(VAR_0, tmp, VAR_1, VAR_2[3], 3); } av_free(tmp); }
[ "static void FUNC_0(RCCMPEntry *VAR_0, int VAR_1)\n{", "int VAR_2[RADIX_PASSES][NBUCKETS];", "RCCMPEntry *tmp = av_malloc_array(VAR_1, sizeof(*tmp));", "radix_count(VAR_0, VAR_1, VAR_2);", "radix_sort_pass(tmp, VAR_0, VAR_1, VAR_2[0], 0);", "radix_sort_pass(VAR_0, tmp, VAR_1, VAR_2[1], 1);", "if (VAR_2[2][NBUCKETS - 1] || VAR_2[3][NBUCKETS - 1]) {", "radix_sort_pass(tmp, VAR_0, VAR_1, VAR_2[2], 2);", "radix_sort_pass(VAR_0, tmp, VAR_1, VAR_2[3], 3);", "}", "av_free(tmp);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ] ]
20,004
static inline void mix_3f_1r_to_stereo(AC3DecodeContext *ctx) { int i; float (*output)[256] = ctx->audio_block.block_output; for (i = 0; i < 256; i++) { output[1][i] += (output[2][i] + output[4][i]); output[2][i] += (output[3][i] + output[4][i]); } memset(output[3], 0, sizeof(output[3])); memset(output[4], 0, sizeof(output[4])); }
false
FFmpeg
486637af8ef29ec215e0e0b7ecd3b5470f0e04e5
static inline void mix_3f_1r_to_stereo(AC3DecodeContext *ctx) { int i; float (*output)[256] = ctx->audio_block.block_output; for (i = 0; i < 256; i++) { output[1][i] += (output[2][i] + output[4][i]); output[2][i] += (output[3][i] + output[4][i]); } memset(output[3], 0, sizeof(output[3])); memset(output[4], 0, sizeof(output[4])); }
{ "code": [], "line_no": [] }
static inline void FUNC_0(AC3DecodeContext *VAR_0) { int VAR_1; float (*VAR_2)[256] = VAR_0->audio_block.block_output; for (VAR_1 = 0; VAR_1 < 256; VAR_1++) { VAR_2[1][VAR_1] += (VAR_2[2][VAR_1] + VAR_2[4][VAR_1]); VAR_2[2][VAR_1] += (VAR_2[3][VAR_1] + VAR_2[4][VAR_1]); } memset(VAR_2[3], 0, sizeof(VAR_2[3])); memset(VAR_2[4], 0, sizeof(VAR_2[4])); }
[ "static inline void FUNC_0(AC3DecodeContext *VAR_0)\n{", "int VAR_1;", "float (*VAR_2)[256] = VAR_0->audio_block.block_output;", "for (VAR_1 = 0; VAR_1 < 256; VAR_1++) {", "VAR_2[1][VAR_1] += (VAR_2[2][VAR_1] + VAR_2[4][VAR_1]);", "VAR_2[2][VAR_1] += (VAR_2[3][VAR_1] + VAR_2[4][VAR_1]);", "}", "memset(VAR_2[3], 0, sizeof(VAR_2[3]));", "memset(VAR_2[4], 0, sizeof(VAR_2[4]));", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ] ]
20,006
static int check(AVIOContext *pb, int64_t pos, uint32_t *ret_header) { int64_t ret = avio_seek(pb, pos, SEEK_SET); unsigned header; MPADecodeHeader sd; if (ret < 0) return ret; header = avio_rb32(pb); if (ff_mpa_check_header(header) < 0) return -1; if (avpriv_mpegaudio_decode_header(&sd, header) == 1) return -1; if (ret_header) *ret_header = header; return sd.frame_size; }
false
FFmpeg
1c9215e580b6436d1aff3c0118ef01269712ebd9
static int check(AVIOContext *pb, int64_t pos, uint32_t *ret_header) { int64_t ret = avio_seek(pb, pos, SEEK_SET); unsigned header; MPADecodeHeader sd; if (ret < 0) return ret; header = avio_rb32(pb); if (ff_mpa_check_header(header) < 0) return -1; if (avpriv_mpegaudio_decode_header(&sd, header) == 1) return -1; if (ret_header) *ret_header = header; return sd.frame_size; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVIOContext *VAR_0, int64_t VAR_1, uint32_t *VAR_2) { int64_t ret = avio_seek(VAR_0, VAR_1, SEEK_SET); unsigned VAR_3; MPADecodeHeader sd; if (ret < 0) return ret; VAR_3 = avio_rb32(VAR_0); if (ff_mpa_check_header(VAR_3) < 0) return -1; if (avpriv_mpegaudio_decode_header(&sd, VAR_3) == 1) return -1; if (VAR_2) *VAR_2 = VAR_3; return sd.frame_size; }
[ "static int FUNC_0(AVIOContext *VAR_0, int64_t VAR_1, uint32_t *VAR_2)\n{", "int64_t ret = avio_seek(VAR_0, VAR_1, SEEK_SET);", "unsigned VAR_3;", "MPADecodeHeader sd;", "if (ret < 0)\nreturn ret;", "VAR_3 = avio_rb32(VAR_0);", "if (ff_mpa_check_header(VAR_3) < 0)\nreturn -1;", "if (avpriv_mpegaudio_decode_header(&sd, VAR_3) == 1)\nreturn -1;", "if (VAR_2)\n*VAR_2 = VAR_3;", "return sd.frame_size;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11, 13 ], [ 17 ], [ 19, 21 ], [ 23, 25 ], [ 29, 31 ], [ 33 ], [ 35 ] ]
20,007
void ff_put_h264_qpel4_mc30_msa(uint8_t *dst, const uint8_t *src, ptrdiff_t stride) { avc_luma_hz_qrt_4w_msa(src - 2, stride, dst, stride, 4, 1); }
false
FFmpeg
b5da07d4340a8e8e40dcd1900977a76ff31fbb84
void ff_put_h264_qpel4_mc30_msa(uint8_t *dst, const uint8_t *src, ptrdiff_t stride) { avc_luma_hz_qrt_4w_msa(src - 2, stride, dst, stride, 4, 1); }
{ "code": [], "line_no": [] }
void FUNC_0(uint8_t *VAR_0, const uint8_t *VAR_1, ptrdiff_t VAR_2) { avc_luma_hz_qrt_4w_msa(VAR_1 - 2, VAR_2, VAR_0, VAR_2, 4, 1); }
[ "void FUNC_0(uint8_t *VAR_0, const uint8_t *VAR_1,\nptrdiff_t VAR_2)\n{", "avc_luma_hz_qrt_4w_msa(VAR_1 - 2, VAR_2, VAR_0, VAR_2, 4, 1);", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ] ]
20,008
void ff_h264_pred_init_x86(H264PredContext *h, int codec_id, const int bit_depth, const int chroma_format_idc) { #if HAVE_YASM int mm_flags = av_get_cpu_flags(); if (bit_depth == 8) { if (mm_flags & AV_CPU_FLAG_MMX) { h->pred16x16[VERT_PRED8x8 ] = ff_pred16x16_vertical_mmx; h->pred16x16[HOR_PRED8x8 ] = ff_pred16x16_horizontal_mmx; if (chroma_format_idc == 1) { h->pred8x8 [VERT_PRED8x8 ] = ff_pred8x8_vertical_mmx; h->pred8x8 [HOR_PRED8x8 ] = ff_pred8x8_horizontal_mmx; } if (codec_id == AV_CODEC_ID_VP8) { h->pred16x16[PLANE_PRED8x8 ] = ff_pred16x16_tm_vp8_mmx; h->pred8x8 [PLANE_PRED8x8 ] = ff_pred8x8_tm_vp8_mmx; h->pred4x4 [TM_VP8_PRED ] = ff_pred4x4_tm_vp8_mmx; } else { if (chroma_format_idc == 1) h->pred8x8 [PLANE_PRED8x8] = ff_pred8x8_plane_mmx; if (codec_id == AV_CODEC_ID_SVQ3) { if (mm_flags & AV_CPU_FLAG_CMOV) h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_svq3_mmx; } else if (codec_id == AV_CODEC_ID_RV40) { h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_rv40_mmx; } else { h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_h264_mmx; } } } if (mm_flags & AV_CPU_FLAG_MMXEXT) { h->pred16x16[HOR_PRED8x8 ] = ff_pred16x16_horizontal_mmx2; h->pred16x16[DC_PRED8x8 ] = ff_pred16x16_dc_mmx2; if (chroma_format_idc == 1) h->pred8x8[HOR_PRED8x8 ] = ff_pred8x8_horizontal_mmx2; h->pred8x8l [TOP_DC_PRED ] = ff_pred8x8l_top_dc_mmxext; h->pred8x8l [DC_PRED ] = ff_pred8x8l_dc_mmxext; h->pred8x8l [HOR_PRED ] = ff_pred8x8l_horizontal_mmxext; h->pred8x8l [VERT_PRED ] = ff_pred8x8l_vertical_mmxext; h->pred8x8l [DIAG_DOWN_RIGHT_PRED ] = ff_pred8x8l_down_right_mmxext; h->pred8x8l [VERT_RIGHT_PRED ] = ff_pred8x8l_vertical_right_mmxext; h->pred8x8l [HOR_UP_PRED ] = ff_pred8x8l_horizontal_up_mmxext; h->pred8x8l [DIAG_DOWN_LEFT_PRED ] = ff_pred8x8l_down_left_mmxext; h->pred8x8l [HOR_DOWN_PRED ] = ff_pred8x8l_horizontal_down_mmxext; h->pred4x4 [DIAG_DOWN_RIGHT_PRED ] = ff_pred4x4_down_right_mmxext; h->pred4x4 [VERT_RIGHT_PRED ] = ff_pred4x4_vertical_right_mmxext; h->pred4x4 [HOR_DOWN_PRED ] = ff_pred4x4_horizontal_down_mmxext; h->pred4x4 [DC_PRED ] = ff_pred4x4_dc_mmxext; if (codec_id == AV_CODEC_ID_VP8 || codec_id == AV_CODEC_ID_H264) { h->pred4x4 [DIAG_DOWN_LEFT_PRED] = ff_pred4x4_down_left_mmxext; } if (codec_id == AV_CODEC_ID_SVQ3 || codec_id == AV_CODEC_ID_H264) { h->pred4x4 [VERT_LEFT_PRED ] = ff_pred4x4_vertical_left_mmxext; } if (codec_id != AV_CODEC_ID_RV40) { h->pred4x4 [HOR_UP_PRED ] = ff_pred4x4_horizontal_up_mmxext; } if (codec_id == AV_CODEC_ID_SVQ3 || codec_id == AV_CODEC_ID_H264) { if (chroma_format_idc == 1) { h->pred8x8[TOP_DC_PRED8x8 ] = ff_pred8x8_top_dc_mmxext; h->pred8x8[DC_PRED8x8 ] = ff_pred8x8_dc_mmxext; } } if (codec_id == AV_CODEC_ID_VP8) { h->pred16x16[PLANE_PRED8x8 ] = ff_pred16x16_tm_vp8_mmx2; h->pred8x8 [DC_PRED8x8 ] = ff_pred8x8_dc_rv40_mmxext; h->pred8x8 [PLANE_PRED8x8 ] = ff_pred8x8_tm_vp8_mmx2; h->pred4x4 [TM_VP8_PRED ] = ff_pred4x4_tm_vp8_mmx2; h->pred4x4 [VERT_PRED ] = ff_pred4x4_vertical_vp8_mmxext; } else { if (chroma_format_idc == 1) h->pred8x8 [PLANE_PRED8x8] = ff_pred8x8_plane_mmx2; if (codec_id == AV_CODEC_ID_SVQ3) { h->pred16x16[PLANE_PRED8x8 ] = ff_pred16x16_plane_svq3_mmx2; } else if (codec_id == AV_CODEC_ID_RV40) { h->pred16x16[PLANE_PRED8x8 ] = ff_pred16x16_plane_rv40_mmx2; } else { h->pred16x16[PLANE_PRED8x8 ] = ff_pred16x16_plane_h264_mmx2; } } } if (mm_flags & AV_CPU_FLAG_SSE) { h->pred16x16[VERT_PRED8x8] = ff_pred16x16_vertical_sse; } if (mm_flags & AV_CPU_FLAG_SSE2) { h->pred16x16[DC_PRED8x8 ] = ff_pred16x16_dc_sse2; h->pred8x8l [DIAG_DOWN_LEFT_PRED ] = ff_pred8x8l_down_left_sse2; h->pred8x8l [DIAG_DOWN_RIGHT_PRED ] = ff_pred8x8l_down_right_sse2; h->pred8x8l [VERT_RIGHT_PRED ] = ff_pred8x8l_vertical_right_sse2; h->pred8x8l [VERT_LEFT_PRED ] = ff_pred8x8l_vertical_left_sse2; h->pred8x8l [HOR_DOWN_PRED ] = ff_pred8x8l_horizontal_down_sse2; if (codec_id == AV_CODEC_ID_VP8) { h->pred16x16[PLANE_PRED8x8 ] = ff_pred16x16_tm_vp8_sse2; h->pred8x8 [PLANE_PRED8x8 ] = ff_pred8x8_tm_vp8_sse2; } else { if (chroma_format_idc == 1) h->pred8x8 [PLANE_PRED8x8] = ff_pred8x8_plane_sse2; if (codec_id == AV_CODEC_ID_SVQ3) { h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_svq3_sse2; } else if (codec_id == AV_CODEC_ID_RV40) { h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_rv40_sse2; } else { h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_h264_sse2; } } } if (mm_flags & AV_CPU_FLAG_SSSE3) { h->pred16x16[HOR_PRED8x8 ] = ff_pred16x16_horizontal_ssse3; h->pred16x16[DC_PRED8x8 ] = ff_pred16x16_dc_ssse3; if (chroma_format_idc == 1) h->pred8x8 [HOR_PRED8x8 ] = ff_pred8x8_horizontal_ssse3; h->pred8x8l [TOP_DC_PRED ] = ff_pred8x8l_top_dc_ssse3; h->pred8x8l [DC_PRED ] = ff_pred8x8l_dc_ssse3; h->pred8x8l [HOR_PRED ] = ff_pred8x8l_horizontal_ssse3; h->pred8x8l [VERT_PRED ] = ff_pred8x8l_vertical_ssse3; h->pred8x8l [DIAG_DOWN_LEFT_PRED ] = ff_pred8x8l_down_left_ssse3; h->pred8x8l [DIAG_DOWN_RIGHT_PRED ] = ff_pred8x8l_down_right_ssse3; h->pred8x8l [VERT_RIGHT_PRED ] = ff_pred8x8l_vertical_right_ssse3; h->pred8x8l [VERT_LEFT_PRED ] = ff_pred8x8l_vertical_left_ssse3; h->pred8x8l [HOR_UP_PRED ] = ff_pred8x8l_horizontal_up_ssse3; h->pred8x8l [HOR_DOWN_PRED ] = ff_pred8x8l_horizontal_down_ssse3; if (codec_id == AV_CODEC_ID_VP8) { h->pred8x8 [PLANE_PRED8x8 ] = ff_pred8x8_tm_vp8_ssse3; h->pred4x4 [TM_VP8_PRED ] = ff_pred4x4_tm_vp8_ssse3; } else { if (chroma_format_idc == 1) h->pred8x8 [PLANE_PRED8x8] = ff_pred8x8_plane_ssse3; if (codec_id == AV_CODEC_ID_SVQ3) { h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_svq3_ssse3; } else if (codec_id == AV_CODEC_ID_RV40) { h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_rv40_ssse3; } else { h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_h264_ssse3; } } } } else if (bit_depth == 10) { if (mm_flags & AV_CPU_FLAG_MMXEXT) { h->pred4x4[DC_PRED ] = ff_pred4x4_dc_10_mmxext; h->pred4x4[HOR_UP_PRED ] = ff_pred4x4_horizontal_up_10_mmxext; if (chroma_format_idc == 1) h->pred8x8[DC_PRED8x8 ] = ff_pred8x8_dc_10_mmxext; h->pred8x8l[DC_128_PRED ] = ff_pred8x8l_128_dc_10_mmxext; h->pred16x16[DC_PRED8x8 ] = ff_pred16x16_dc_10_mmxext; h->pred16x16[TOP_DC_PRED8x8 ] = ff_pred16x16_top_dc_10_mmxext; h->pred16x16[DC_128_PRED8x8 ] = ff_pred16x16_128_dc_10_mmxext; h->pred16x16[LEFT_DC_PRED8x8 ] = ff_pred16x16_left_dc_10_mmxext; h->pred16x16[VERT_PRED8x8 ] = ff_pred16x16_vertical_10_mmxext; h->pred16x16[HOR_PRED8x8 ] = ff_pred16x16_horizontal_10_mmxext; } if (mm_flags & AV_CPU_FLAG_SSE2) { h->pred4x4[DIAG_DOWN_LEFT_PRED ] = ff_pred4x4_down_left_10_sse2; h->pred4x4[DIAG_DOWN_RIGHT_PRED] = ff_pred4x4_down_right_10_sse2; h->pred4x4[VERT_LEFT_PRED ] = ff_pred4x4_vertical_left_10_sse2; h->pred4x4[VERT_RIGHT_PRED ] = ff_pred4x4_vertical_right_10_sse2; h->pred4x4[HOR_DOWN_PRED ] = ff_pred4x4_horizontal_down_10_sse2; if (chroma_format_idc == 1) { h->pred8x8[DC_PRED8x8 ] = ff_pred8x8_dc_10_sse2; h->pred8x8[TOP_DC_PRED8x8 ] = ff_pred8x8_top_dc_10_sse2; h->pred8x8[PLANE_PRED8x8 ] = ff_pred8x8_plane_10_sse2; h->pred8x8[VERT_PRED8x8 ] = ff_pred8x8_vertical_10_sse2; h->pred8x8[HOR_PRED8x8 ] = ff_pred8x8_horizontal_10_sse2; } h->pred8x8l[VERT_PRED ] = ff_pred8x8l_vertical_10_sse2; h->pred8x8l[HOR_PRED ] = ff_pred8x8l_horizontal_10_sse2; h->pred8x8l[DC_PRED ] = ff_pred8x8l_dc_10_sse2; h->pred8x8l[DC_128_PRED ] = ff_pred8x8l_128_dc_10_sse2; h->pred8x8l[TOP_DC_PRED ] = ff_pred8x8l_top_dc_10_sse2; h->pred8x8l[DIAG_DOWN_LEFT_PRED ] = ff_pred8x8l_down_left_10_sse2; h->pred8x8l[DIAG_DOWN_RIGHT_PRED] = ff_pred8x8l_down_right_10_sse2; h->pred8x8l[VERT_RIGHT_PRED ] = ff_pred8x8l_vertical_right_10_sse2; h->pred8x8l[HOR_UP_PRED ] = ff_pred8x8l_horizontal_up_10_sse2; h->pred16x16[DC_PRED8x8 ] = ff_pred16x16_dc_10_sse2; h->pred16x16[TOP_DC_PRED8x8 ] = ff_pred16x16_top_dc_10_sse2; h->pred16x16[DC_128_PRED8x8 ] = ff_pred16x16_128_dc_10_sse2; h->pred16x16[LEFT_DC_PRED8x8 ] = ff_pred16x16_left_dc_10_sse2; h->pred16x16[VERT_PRED8x8 ] = ff_pred16x16_vertical_10_sse2; h->pred16x16[HOR_PRED8x8 ] = ff_pred16x16_horizontal_10_sse2; } if (mm_flags & AV_CPU_FLAG_SSSE3) { h->pred4x4[DIAG_DOWN_RIGHT_PRED] = ff_pred4x4_down_right_10_ssse3; h->pred4x4[VERT_RIGHT_PRED ] = ff_pred4x4_vertical_right_10_ssse3; h->pred4x4[HOR_DOWN_PRED ] = ff_pred4x4_horizontal_down_10_ssse3; h->pred8x8l[HOR_PRED ] = ff_pred8x8l_horizontal_10_ssse3; h->pred8x8l[DIAG_DOWN_LEFT_PRED ] = ff_pred8x8l_down_left_10_ssse3; h->pred8x8l[DIAG_DOWN_RIGHT_PRED] = ff_pred8x8l_down_right_10_ssse3; h->pred8x8l[VERT_RIGHT_PRED ] = ff_pred8x8l_vertical_right_10_ssse3; h->pred8x8l[HOR_UP_PRED ] = ff_pred8x8l_horizontal_up_10_ssse3; } #if HAVE_AVX if (mm_flags & AV_CPU_FLAG_AVX) { h->pred4x4[DIAG_DOWN_LEFT_PRED ] = ff_pred4x4_down_left_10_avx; h->pred4x4[DIAG_DOWN_RIGHT_PRED] = ff_pred4x4_down_right_10_avx; h->pred4x4[VERT_LEFT_PRED ] = ff_pred4x4_vertical_left_10_avx; h->pred4x4[VERT_RIGHT_PRED ] = ff_pred4x4_vertical_right_10_avx; h->pred4x4[HOR_DOWN_PRED ] = ff_pred4x4_horizontal_down_10_avx; h->pred8x8l[VERT_PRED ] = ff_pred8x8l_vertical_10_avx; h->pred8x8l[HOR_PRED ] = ff_pred8x8l_horizontal_10_avx; h->pred8x8l[DC_PRED ] = ff_pred8x8l_dc_10_avx; h->pred8x8l[TOP_DC_PRED ] = ff_pred8x8l_top_dc_10_avx; h->pred8x8l[DIAG_DOWN_RIGHT_PRED] = ff_pred8x8l_down_right_10_avx; h->pred8x8l[DIAG_DOWN_LEFT_PRED ] = ff_pred8x8l_down_left_10_avx; h->pred8x8l[VERT_RIGHT_PRED ] = ff_pred8x8l_vertical_right_10_avx; h->pred8x8l[HOR_UP_PRED ] = ff_pred8x8l_horizontal_up_10_avx; } #endif /* HAVE_AVX */ } #endif /* HAVE_YASM */ }
false
FFmpeg
e0c6cce44729d94e2a5507a4b6d031f23e8bd7b6
void ff_h264_pred_init_x86(H264PredContext *h, int codec_id, const int bit_depth, const int chroma_format_idc) { #if HAVE_YASM int mm_flags = av_get_cpu_flags(); if (bit_depth == 8) { if (mm_flags & AV_CPU_FLAG_MMX) { h->pred16x16[VERT_PRED8x8 ] = ff_pred16x16_vertical_mmx; h->pred16x16[HOR_PRED8x8 ] = ff_pred16x16_horizontal_mmx; if (chroma_format_idc == 1) { h->pred8x8 [VERT_PRED8x8 ] = ff_pred8x8_vertical_mmx; h->pred8x8 [HOR_PRED8x8 ] = ff_pred8x8_horizontal_mmx; } if (codec_id == AV_CODEC_ID_VP8) { h->pred16x16[PLANE_PRED8x8 ] = ff_pred16x16_tm_vp8_mmx; h->pred8x8 [PLANE_PRED8x8 ] = ff_pred8x8_tm_vp8_mmx; h->pred4x4 [TM_VP8_PRED ] = ff_pred4x4_tm_vp8_mmx; } else { if (chroma_format_idc == 1) h->pred8x8 [PLANE_PRED8x8] = ff_pred8x8_plane_mmx; if (codec_id == AV_CODEC_ID_SVQ3) { if (mm_flags & AV_CPU_FLAG_CMOV) h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_svq3_mmx; } else if (codec_id == AV_CODEC_ID_RV40) { h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_rv40_mmx; } else { h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_h264_mmx; } } } if (mm_flags & AV_CPU_FLAG_MMXEXT) { h->pred16x16[HOR_PRED8x8 ] = ff_pred16x16_horizontal_mmx2; h->pred16x16[DC_PRED8x8 ] = ff_pred16x16_dc_mmx2; if (chroma_format_idc == 1) h->pred8x8[HOR_PRED8x8 ] = ff_pred8x8_horizontal_mmx2; h->pred8x8l [TOP_DC_PRED ] = ff_pred8x8l_top_dc_mmxext; h->pred8x8l [DC_PRED ] = ff_pred8x8l_dc_mmxext; h->pred8x8l [HOR_PRED ] = ff_pred8x8l_horizontal_mmxext; h->pred8x8l [VERT_PRED ] = ff_pred8x8l_vertical_mmxext; h->pred8x8l [DIAG_DOWN_RIGHT_PRED ] = ff_pred8x8l_down_right_mmxext; h->pred8x8l [VERT_RIGHT_PRED ] = ff_pred8x8l_vertical_right_mmxext; h->pred8x8l [HOR_UP_PRED ] = ff_pred8x8l_horizontal_up_mmxext; h->pred8x8l [DIAG_DOWN_LEFT_PRED ] = ff_pred8x8l_down_left_mmxext; h->pred8x8l [HOR_DOWN_PRED ] = ff_pred8x8l_horizontal_down_mmxext; h->pred4x4 [DIAG_DOWN_RIGHT_PRED ] = ff_pred4x4_down_right_mmxext; h->pred4x4 [VERT_RIGHT_PRED ] = ff_pred4x4_vertical_right_mmxext; h->pred4x4 [HOR_DOWN_PRED ] = ff_pred4x4_horizontal_down_mmxext; h->pred4x4 [DC_PRED ] = ff_pred4x4_dc_mmxext; if (codec_id == AV_CODEC_ID_VP8 || codec_id == AV_CODEC_ID_H264) { h->pred4x4 [DIAG_DOWN_LEFT_PRED] = ff_pred4x4_down_left_mmxext; } if (codec_id == AV_CODEC_ID_SVQ3 || codec_id == AV_CODEC_ID_H264) { h->pred4x4 [VERT_LEFT_PRED ] = ff_pred4x4_vertical_left_mmxext; } if (codec_id != AV_CODEC_ID_RV40) { h->pred4x4 [HOR_UP_PRED ] = ff_pred4x4_horizontal_up_mmxext; } if (codec_id == AV_CODEC_ID_SVQ3 || codec_id == AV_CODEC_ID_H264) { if (chroma_format_idc == 1) { h->pred8x8[TOP_DC_PRED8x8 ] = ff_pred8x8_top_dc_mmxext; h->pred8x8[DC_PRED8x8 ] = ff_pred8x8_dc_mmxext; } } if (codec_id == AV_CODEC_ID_VP8) { h->pred16x16[PLANE_PRED8x8 ] = ff_pred16x16_tm_vp8_mmx2; h->pred8x8 [DC_PRED8x8 ] = ff_pred8x8_dc_rv40_mmxext; h->pred8x8 [PLANE_PRED8x8 ] = ff_pred8x8_tm_vp8_mmx2; h->pred4x4 [TM_VP8_PRED ] = ff_pred4x4_tm_vp8_mmx2; h->pred4x4 [VERT_PRED ] = ff_pred4x4_vertical_vp8_mmxext; } else { if (chroma_format_idc == 1) h->pred8x8 [PLANE_PRED8x8] = ff_pred8x8_plane_mmx2; if (codec_id == AV_CODEC_ID_SVQ3) { h->pred16x16[PLANE_PRED8x8 ] = ff_pred16x16_plane_svq3_mmx2; } else if (codec_id == AV_CODEC_ID_RV40) { h->pred16x16[PLANE_PRED8x8 ] = ff_pred16x16_plane_rv40_mmx2; } else { h->pred16x16[PLANE_PRED8x8 ] = ff_pred16x16_plane_h264_mmx2; } } } if (mm_flags & AV_CPU_FLAG_SSE) { h->pred16x16[VERT_PRED8x8] = ff_pred16x16_vertical_sse; } if (mm_flags & AV_CPU_FLAG_SSE2) { h->pred16x16[DC_PRED8x8 ] = ff_pred16x16_dc_sse2; h->pred8x8l [DIAG_DOWN_LEFT_PRED ] = ff_pred8x8l_down_left_sse2; h->pred8x8l [DIAG_DOWN_RIGHT_PRED ] = ff_pred8x8l_down_right_sse2; h->pred8x8l [VERT_RIGHT_PRED ] = ff_pred8x8l_vertical_right_sse2; h->pred8x8l [VERT_LEFT_PRED ] = ff_pred8x8l_vertical_left_sse2; h->pred8x8l [HOR_DOWN_PRED ] = ff_pred8x8l_horizontal_down_sse2; if (codec_id == AV_CODEC_ID_VP8) { h->pred16x16[PLANE_PRED8x8 ] = ff_pred16x16_tm_vp8_sse2; h->pred8x8 [PLANE_PRED8x8 ] = ff_pred8x8_tm_vp8_sse2; } else { if (chroma_format_idc == 1) h->pred8x8 [PLANE_PRED8x8] = ff_pred8x8_plane_sse2; if (codec_id == AV_CODEC_ID_SVQ3) { h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_svq3_sse2; } else if (codec_id == AV_CODEC_ID_RV40) { h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_rv40_sse2; } else { h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_h264_sse2; } } } if (mm_flags & AV_CPU_FLAG_SSSE3) { h->pred16x16[HOR_PRED8x8 ] = ff_pred16x16_horizontal_ssse3; h->pred16x16[DC_PRED8x8 ] = ff_pred16x16_dc_ssse3; if (chroma_format_idc == 1) h->pred8x8 [HOR_PRED8x8 ] = ff_pred8x8_horizontal_ssse3; h->pred8x8l [TOP_DC_PRED ] = ff_pred8x8l_top_dc_ssse3; h->pred8x8l [DC_PRED ] = ff_pred8x8l_dc_ssse3; h->pred8x8l [HOR_PRED ] = ff_pred8x8l_horizontal_ssse3; h->pred8x8l [VERT_PRED ] = ff_pred8x8l_vertical_ssse3; h->pred8x8l [DIAG_DOWN_LEFT_PRED ] = ff_pred8x8l_down_left_ssse3; h->pred8x8l [DIAG_DOWN_RIGHT_PRED ] = ff_pred8x8l_down_right_ssse3; h->pred8x8l [VERT_RIGHT_PRED ] = ff_pred8x8l_vertical_right_ssse3; h->pred8x8l [VERT_LEFT_PRED ] = ff_pred8x8l_vertical_left_ssse3; h->pred8x8l [HOR_UP_PRED ] = ff_pred8x8l_horizontal_up_ssse3; h->pred8x8l [HOR_DOWN_PRED ] = ff_pred8x8l_horizontal_down_ssse3; if (codec_id == AV_CODEC_ID_VP8) { h->pred8x8 [PLANE_PRED8x8 ] = ff_pred8x8_tm_vp8_ssse3; h->pred4x4 [TM_VP8_PRED ] = ff_pred4x4_tm_vp8_ssse3; } else { if (chroma_format_idc == 1) h->pred8x8 [PLANE_PRED8x8] = ff_pred8x8_plane_ssse3; if (codec_id == AV_CODEC_ID_SVQ3) { h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_svq3_ssse3; } else if (codec_id == AV_CODEC_ID_RV40) { h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_rv40_ssse3; } else { h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_h264_ssse3; } } } } else if (bit_depth == 10) { if (mm_flags & AV_CPU_FLAG_MMXEXT) { h->pred4x4[DC_PRED ] = ff_pred4x4_dc_10_mmxext; h->pred4x4[HOR_UP_PRED ] = ff_pred4x4_horizontal_up_10_mmxext; if (chroma_format_idc == 1) h->pred8x8[DC_PRED8x8 ] = ff_pred8x8_dc_10_mmxext; h->pred8x8l[DC_128_PRED ] = ff_pred8x8l_128_dc_10_mmxext; h->pred16x16[DC_PRED8x8 ] = ff_pred16x16_dc_10_mmxext; h->pred16x16[TOP_DC_PRED8x8 ] = ff_pred16x16_top_dc_10_mmxext; h->pred16x16[DC_128_PRED8x8 ] = ff_pred16x16_128_dc_10_mmxext; h->pred16x16[LEFT_DC_PRED8x8 ] = ff_pred16x16_left_dc_10_mmxext; h->pred16x16[VERT_PRED8x8 ] = ff_pred16x16_vertical_10_mmxext; h->pred16x16[HOR_PRED8x8 ] = ff_pred16x16_horizontal_10_mmxext; } if (mm_flags & AV_CPU_FLAG_SSE2) { h->pred4x4[DIAG_DOWN_LEFT_PRED ] = ff_pred4x4_down_left_10_sse2; h->pred4x4[DIAG_DOWN_RIGHT_PRED] = ff_pred4x4_down_right_10_sse2; h->pred4x4[VERT_LEFT_PRED ] = ff_pred4x4_vertical_left_10_sse2; h->pred4x4[VERT_RIGHT_PRED ] = ff_pred4x4_vertical_right_10_sse2; h->pred4x4[HOR_DOWN_PRED ] = ff_pred4x4_horizontal_down_10_sse2; if (chroma_format_idc == 1) { h->pred8x8[DC_PRED8x8 ] = ff_pred8x8_dc_10_sse2; h->pred8x8[TOP_DC_PRED8x8 ] = ff_pred8x8_top_dc_10_sse2; h->pred8x8[PLANE_PRED8x8 ] = ff_pred8x8_plane_10_sse2; h->pred8x8[VERT_PRED8x8 ] = ff_pred8x8_vertical_10_sse2; h->pred8x8[HOR_PRED8x8 ] = ff_pred8x8_horizontal_10_sse2; } h->pred8x8l[VERT_PRED ] = ff_pred8x8l_vertical_10_sse2; h->pred8x8l[HOR_PRED ] = ff_pred8x8l_horizontal_10_sse2; h->pred8x8l[DC_PRED ] = ff_pred8x8l_dc_10_sse2; h->pred8x8l[DC_128_PRED ] = ff_pred8x8l_128_dc_10_sse2; h->pred8x8l[TOP_DC_PRED ] = ff_pred8x8l_top_dc_10_sse2; h->pred8x8l[DIAG_DOWN_LEFT_PRED ] = ff_pred8x8l_down_left_10_sse2; h->pred8x8l[DIAG_DOWN_RIGHT_PRED] = ff_pred8x8l_down_right_10_sse2; h->pred8x8l[VERT_RIGHT_PRED ] = ff_pred8x8l_vertical_right_10_sse2; h->pred8x8l[HOR_UP_PRED ] = ff_pred8x8l_horizontal_up_10_sse2; h->pred16x16[DC_PRED8x8 ] = ff_pred16x16_dc_10_sse2; h->pred16x16[TOP_DC_PRED8x8 ] = ff_pred16x16_top_dc_10_sse2; h->pred16x16[DC_128_PRED8x8 ] = ff_pred16x16_128_dc_10_sse2; h->pred16x16[LEFT_DC_PRED8x8 ] = ff_pred16x16_left_dc_10_sse2; h->pred16x16[VERT_PRED8x8 ] = ff_pred16x16_vertical_10_sse2; h->pred16x16[HOR_PRED8x8 ] = ff_pred16x16_horizontal_10_sse2; } if (mm_flags & AV_CPU_FLAG_SSSE3) { h->pred4x4[DIAG_DOWN_RIGHT_PRED] = ff_pred4x4_down_right_10_ssse3; h->pred4x4[VERT_RIGHT_PRED ] = ff_pred4x4_vertical_right_10_ssse3; h->pred4x4[HOR_DOWN_PRED ] = ff_pred4x4_horizontal_down_10_ssse3; h->pred8x8l[HOR_PRED ] = ff_pred8x8l_horizontal_10_ssse3; h->pred8x8l[DIAG_DOWN_LEFT_PRED ] = ff_pred8x8l_down_left_10_ssse3; h->pred8x8l[DIAG_DOWN_RIGHT_PRED] = ff_pred8x8l_down_right_10_ssse3; h->pred8x8l[VERT_RIGHT_PRED ] = ff_pred8x8l_vertical_right_10_ssse3; h->pred8x8l[HOR_UP_PRED ] = ff_pred8x8l_horizontal_up_10_ssse3; } #if HAVE_AVX if (mm_flags & AV_CPU_FLAG_AVX) { h->pred4x4[DIAG_DOWN_LEFT_PRED ] = ff_pred4x4_down_left_10_avx; h->pred4x4[DIAG_DOWN_RIGHT_PRED] = ff_pred4x4_down_right_10_avx; h->pred4x4[VERT_LEFT_PRED ] = ff_pred4x4_vertical_left_10_avx; h->pred4x4[VERT_RIGHT_PRED ] = ff_pred4x4_vertical_right_10_avx; h->pred4x4[HOR_DOWN_PRED ] = ff_pred4x4_horizontal_down_10_avx; h->pred8x8l[VERT_PRED ] = ff_pred8x8l_vertical_10_avx; h->pred8x8l[HOR_PRED ] = ff_pred8x8l_horizontal_10_avx; h->pred8x8l[DC_PRED ] = ff_pred8x8l_dc_10_avx; h->pred8x8l[TOP_DC_PRED ] = ff_pred8x8l_top_dc_10_avx; h->pred8x8l[DIAG_DOWN_RIGHT_PRED] = ff_pred8x8l_down_right_10_avx; h->pred8x8l[DIAG_DOWN_LEFT_PRED ] = ff_pred8x8l_down_left_10_avx; h->pred8x8l[VERT_RIGHT_PRED ] = ff_pred8x8l_vertical_right_10_avx; h->pred8x8l[HOR_UP_PRED ] = ff_pred8x8l_horizontal_up_10_avx; } #endif } #endif }
{ "code": [], "line_no": [] }
void FUNC_0(H264PredContext *VAR_0, int VAR_1, const int VAR_2, const int VAR_3) { #if HAVE_YASM int mm_flags = av_get_cpu_flags(); if (VAR_2 == 8) { if (mm_flags & AV_CPU_FLAG_MMX) { VAR_0->pred16x16[VERT_PRED8x8 ] = ff_pred16x16_vertical_mmx; VAR_0->pred16x16[HOR_PRED8x8 ] = ff_pred16x16_horizontal_mmx; if (VAR_3 == 1) { VAR_0->pred8x8 [VERT_PRED8x8 ] = ff_pred8x8_vertical_mmx; VAR_0->pred8x8 [HOR_PRED8x8 ] = ff_pred8x8_horizontal_mmx; } if (VAR_1 == AV_CODEC_ID_VP8) { VAR_0->pred16x16[PLANE_PRED8x8 ] = ff_pred16x16_tm_vp8_mmx; VAR_0->pred8x8 [PLANE_PRED8x8 ] = ff_pred8x8_tm_vp8_mmx; VAR_0->pred4x4 [TM_VP8_PRED ] = ff_pred4x4_tm_vp8_mmx; } else { if (VAR_3 == 1) VAR_0->pred8x8 [PLANE_PRED8x8] = ff_pred8x8_plane_mmx; if (VAR_1 == AV_CODEC_ID_SVQ3) { if (mm_flags & AV_CPU_FLAG_CMOV) VAR_0->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_svq3_mmx; } else if (VAR_1 == AV_CODEC_ID_RV40) { VAR_0->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_rv40_mmx; } else { VAR_0->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_h264_mmx; } } } if (mm_flags & AV_CPU_FLAG_MMXEXT) { VAR_0->pred16x16[HOR_PRED8x8 ] = ff_pred16x16_horizontal_mmx2; VAR_0->pred16x16[DC_PRED8x8 ] = ff_pred16x16_dc_mmx2; if (VAR_3 == 1) VAR_0->pred8x8[HOR_PRED8x8 ] = ff_pred8x8_horizontal_mmx2; VAR_0->pred8x8l [TOP_DC_PRED ] = ff_pred8x8l_top_dc_mmxext; VAR_0->pred8x8l [DC_PRED ] = ff_pred8x8l_dc_mmxext; VAR_0->pred8x8l [HOR_PRED ] = ff_pred8x8l_horizontal_mmxext; VAR_0->pred8x8l [VERT_PRED ] = ff_pred8x8l_vertical_mmxext; VAR_0->pred8x8l [DIAG_DOWN_RIGHT_PRED ] = ff_pred8x8l_down_right_mmxext; VAR_0->pred8x8l [VERT_RIGHT_PRED ] = ff_pred8x8l_vertical_right_mmxext; VAR_0->pred8x8l [HOR_UP_PRED ] = ff_pred8x8l_horizontal_up_mmxext; VAR_0->pred8x8l [DIAG_DOWN_LEFT_PRED ] = ff_pred8x8l_down_left_mmxext; VAR_0->pred8x8l [HOR_DOWN_PRED ] = ff_pred8x8l_horizontal_down_mmxext; VAR_0->pred4x4 [DIAG_DOWN_RIGHT_PRED ] = ff_pred4x4_down_right_mmxext; VAR_0->pred4x4 [VERT_RIGHT_PRED ] = ff_pred4x4_vertical_right_mmxext; VAR_0->pred4x4 [HOR_DOWN_PRED ] = ff_pred4x4_horizontal_down_mmxext; VAR_0->pred4x4 [DC_PRED ] = ff_pred4x4_dc_mmxext; if (VAR_1 == AV_CODEC_ID_VP8 || VAR_1 == AV_CODEC_ID_H264) { VAR_0->pred4x4 [DIAG_DOWN_LEFT_PRED] = ff_pred4x4_down_left_mmxext; } if (VAR_1 == AV_CODEC_ID_SVQ3 || VAR_1 == AV_CODEC_ID_H264) { VAR_0->pred4x4 [VERT_LEFT_PRED ] = ff_pred4x4_vertical_left_mmxext; } if (VAR_1 != AV_CODEC_ID_RV40) { VAR_0->pred4x4 [HOR_UP_PRED ] = ff_pred4x4_horizontal_up_mmxext; } if (VAR_1 == AV_CODEC_ID_SVQ3 || VAR_1 == AV_CODEC_ID_H264) { if (VAR_3 == 1) { VAR_0->pred8x8[TOP_DC_PRED8x8 ] = ff_pred8x8_top_dc_mmxext; VAR_0->pred8x8[DC_PRED8x8 ] = ff_pred8x8_dc_mmxext; } } if (VAR_1 == AV_CODEC_ID_VP8) { VAR_0->pred16x16[PLANE_PRED8x8 ] = ff_pred16x16_tm_vp8_mmx2; VAR_0->pred8x8 [DC_PRED8x8 ] = ff_pred8x8_dc_rv40_mmxext; VAR_0->pred8x8 [PLANE_PRED8x8 ] = ff_pred8x8_tm_vp8_mmx2; VAR_0->pred4x4 [TM_VP8_PRED ] = ff_pred4x4_tm_vp8_mmx2; VAR_0->pred4x4 [VERT_PRED ] = ff_pred4x4_vertical_vp8_mmxext; } else { if (VAR_3 == 1) VAR_0->pred8x8 [PLANE_PRED8x8] = ff_pred8x8_plane_mmx2; if (VAR_1 == AV_CODEC_ID_SVQ3) { VAR_0->pred16x16[PLANE_PRED8x8 ] = ff_pred16x16_plane_svq3_mmx2; } else if (VAR_1 == AV_CODEC_ID_RV40) { VAR_0->pred16x16[PLANE_PRED8x8 ] = ff_pred16x16_plane_rv40_mmx2; } else { VAR_0->pred16x16[PLANE_PRED8x8 ] = ff_pred16x16_plane_h264_mmx2; } } } if (mm_flags & AV_CPU_FLAG_SSE) { VAR_0->pred16x16[VERT_PRED8x8] = ff_pred16x16_vertical_sse; } if (mm_flags & AV_CPU_FLAG_SSE2) { VAR_0->pred16x16[DC_PRED8x8 ] = ff_pred16x16_dc_sse2; VAR_0->pred8x8l [DIAG_DOWN_LEFT_PRED ] = ff_pred8x8l_down_left_sse2; VAR_0->pred8x8l [DIAG_DOWN_RIGHT_PRED ] = ff_pred8x8l_down_right_sse2; VAR_0->pred8x8l [VERT_RIGHT_PRED ] = ff_pred8x8l_vertical_right_sse2; VAR_0->pred8x8l [VERT_LEFT_PRED ] = ff_pred8x8l_vertical_left_sse2; VAR_0->pred8x8l [HOR_DOWN_PRED ] = ff_pred8x8l_horizontal_down_sse2; if (VAR_1 == AV_CODEC_ID_VP8) { VAR_0->pred16x16[PLANE_PRED8x8 ] = ff_pred16x16_tm_vp8_sse2; VAR_0->pred8x8 [PLANE_PRED8x8 ] = ff_pred8x8_tm_vp8_sse2; } else { if (VAR_3 == 1) VAR_0->pred8x8 [PLANE_PRED8x8] = ff_pred8x8_plane_sse2; if (VAR_1 == AV_CODEC_ID_SVQ3) { VAR_0->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_svq3_sse2; } else if (VAR_1 == AV_CODEC_ID_RV40) { VAR_0->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_rv40_sse2; } else { VAR_0->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_h264_sse2; } } } if (mm_flags & AV_CPU_FLAG_SSSE3) { VAR_0->pred16x16[HOR_PRED8x8 ] = ff_pred16x16_horizontal_ssse3; VAR_0->pred16x16[DC_PRED8x8 ] = ff_pred16x16_dc_ssse3; if (VAR_3 == 1) VAR_0->pred8x8 [HOR_PRED8x8 ] = ff_pred8x8_horizontal_ssse3; VAR_0->pred8x8l [TOP_DC_PRED ] = ff_pred8x8l_top_dc_ssse3; VAR_0->pred8x8l [DC_PRED ] = ff_pred8x8l_dc_ssse3; VAR_0->pred8x8l [HOR_PRED ] = ff_pred8x8l_horizontal_ssse3; VAR_0->pred8x8l [VERT_PRED ] = ff_pred8x8l_vertical_ssse3; VAR_0->pred8x8l [DIAG_DOWN_LEFT_PRED ] = ff_pred8x8l_down_left_ssse3; VAR_0->pred8x8l [DIAG_DOWN_RIGHT_PRED ] = ff_pred8x8l_down_right_ssse3; VAR_0->pred8x8l [VERT_RIGHT_PRED ] = ff_pred8x8l_vertical_right_ssse3; VAR_0->pred8x8l [VERT_LEFT_PRED ] = ff_pred8x8l_vertical_left_ssse3; VAR_0->pred8x8l [HOR_UP_PRED ] = ff_pred8x8l_horizontal_up_ssse3; VAR_0->pred8x8l [HOR_DOWN_PRED ] = ff_pred8x8l_horizontal_down_ssse3; if (VAR_1 == AV_CODEC_ID_VP8) { VAR_0->pred8x8 [PLANE_PRED8x8 ] = ff_pred8x8_tm_vp8_ssse3; VAR_0->pred4x4 [TM_VP8_PRED ] = ff_pred4x4_tm_vp8_ssse3; } else { if (VAR_3 == 1) VAR_0->pred8x8 [PLANE_PRED8x8] = ff_pred8x8_plane_ssse3; if (VAR_1 == AV_CODEC_ID_SVQ3) { VAR_0->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_svq3_ssse3; } else if (VAR_1 == AV_CODEC_ID_RV40) { VAR_0->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_rv40_ssse3; } else { VAR_0->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_h264_ssse3; } } } } else if (VAR_2 == 10) { if (mm_flags & AV_CPU_FLAG_MMXEXT) { VAR_0->pred4x4[DC_PRED ] = ff_pred4x4_dc_10_mmxext; VAR_0->pred4x4[HOR_UP_PRED ] = ff_pred4x4_horizontal_up_10_mmxext; if (VAR_3 == 1) VAR_0->pred8x8[DC_PRED8x8 ] = ff_pred8x8_dc_10_mmxext; VAR_0->pred8x8l[DC_128_PRED ] = ff_pred8x8l_128_dc_10_mmxext; VAR_0->pred16x16[DC_PRED8x8 ] = ff_pred16x16_dc_10_mmxext; VAR_0->pred16x16[TOP_DC_PRED8x8 ] = ff_pred16x16_top_dc_10_mmxext; VAR_0->pred16x16[DC_128_PRED8x8 ] = ff_pred16x16_128_dc_10_mmxext; VAR_0->pred16x16[LEFT_DC_PRED8x8 ] = ff_pred16x16_left_dc_10_mmxext; VAR_0->pred16x16[VERT_PRED8x8 ] = ff_pred16x16_vertical_10_mmxext; VAR_0->pred16x16[HOR_PRED8x8 ] = ff_pred16x16_horizontal_10_mmxext; } if (mm_flags & AV_CPU_FLAG_SSE2) { VAR_0->pred4x4[DIAG_DOWN_LEFT_PRED ] = ff_pred4x4_down_left_10_sse2; VAR_0->pred4x4[DIAG_DOWN_RIGHT_PRED] = ff_pred4x4_down_right_10_sse2; VAR_0->pred4x4[VERT_LEFT_PRED ] = ff_pred4x4_vertical_left_10_sse2; VAR_0->pred4x4[VERT_RIGHT_PRED ] = ff_pred4x4_vertical_right_10_sse2; VAR_0->pred4x4[HOR_DOWN_PRED ] = ff_pred4x4_horizontal_down_10_sse2; if (VAR_3 == 1) { VAR_0->pred8x8[DC_PRED8x8 ] = ff_pred8x8_dc_10_sse2; VAR_0->pred8x8[TOP_DC_PRED8x8 ] = ff_pred8x8_top_dc_10_sse2; VAR_0->pred8x8[PLANE_PRED8x8 ] = ff_pred8x8_plane_10_sse2; VAR_0->pred8x8[VERT_PRED8x8 ] = ff_pred8x8_vertical_10_sse2; VAR_0->pred8x8[HOR_PRED8x8 ] = ff_pred8x8_horizontal_10_sse2; } VAR_0->pred8x8l[VERT_PRED ] = ff_pred8x8l_vertical_10_sse2; VAR_0->pred8x8l[HOR_PRED ] = ff_pred8x8l_horizontal_10_sse2; VAR_0->pred8x8l[DC_PRED ] = ff_pred8x8l_dc_10_sse2; VAR_0->pred8x8l[DC_128_PRED ] = ff_pred8x8l_128_dc_10_sse2; VAR_0->pred8x8l[TOP_DC_PRED ] = ff_pred8x8l_top_dc_10_sse2; VAR_0->pred8x8l[DIAG_DOWN_LEFT_PRED ] = ff_pred8x8l_down_left_10_sse2; VAR_0->pred8x8l[DIAG_DOWN_RIGHT_PRED] = ff_pred8x8l_down_right_10_sse2; VAR_0->pred8x8l[VERT_RIGHT_PRED ] = ff_pred8x8l_vertical_right_10_sse2; VAR_0->pred8x8l[HOR_UP_PRED ] = ff_pred8x8l_horizontal_up_10_sse2; VAR_0->pred16x16[DC_PRED8x8 ] = ff_pred16x16_dc_10_sse2; VAR_0->pred16x16[TOP_DC_PRED8x8 ] = ff_pred16x16_top_dc_10_sse2; VAR_0->pred16x16[DC_128_PRED8x8 ] = ff_pred16x16_128_dc_10_sse2; VAR_0->pred16x16[LEFT_DC_PRED8x8 ] = ff_pred16x16_left_dc_10_sse2; VAR_0->pred16x16[VERT_PRED8x8 ] = ff_pred16x16_vertical_10_sse2; VAR_0->pred16x16[HOR_PRED8x8 ] = ff_pred16x16_horizontal_10_sse2; } if (mm_flags & AV_CPU_FLAG_SSSE3) { VAR_0->pred4x4[DIAG_DOWN_RIGHT_PRED] = ff_pred4x4_down_right_10_ssse3; VAR_0->pred4x4[VERT_RIGHT_PRED ] = ff_pred4x4_vertical_right_10_ssse3; VAR_0->pred4x4[HOR_DOWN_PRED ] = ff_pred4x4_horizontal_down_10_ssse3; VAR_0->pred8x8l[HOR_PRED ] = ff_pred8x8l_horizontal_10_ssse3; VAR_0->pred8x8l[DIAG_DOWN_LEFT_PRED ] = ff_pred8x8l_down_left_10_ssse3; VAR_0->pred8x8l[DIAG_DOWN_RIGHT_PRED] = ff_pred8x8l_down_right_10_ssse3; VAR_0->pred8x8l[VERT_RIGHT_PRED ] = ff_pred8x8l_vertical_right_10_ssse3; VAR_0->pred8x8l[HOR_UP_PRED ] = ff_pred8x8l_horizontal_up_10_ssse3; } #if HAVE_AVX if (mm_flags & AV_CPU_FLAG_AVX) { VAR_0->pred4x4[DIAG_DOWN_LEFT_PRED ] = ff_pred4x4_down_left_10_avx; VAR_0->pred4x4[DIAG_DOWN_RIGHT_PRED] = ff_pred4x4_down_right_10_avx; VAR_0->pred4x4[VERT_LEFT_PRED ] = ff_pred4x4_vertical_left_10_avx; VAR_0->pred4x4[VERT_RIGHT_PRED ] = ff_pred4x4_vertical_right_10_avx; VAR_0->pred4x4[HOR_DOWN_PRED ] = ff_pred4x4_horizontal_down_10_avx; VAR_0->pred8x8l[VERT_PRED ] = ff_pred8x8l_vertical_10_avx; VAR_0->pred8x8l[HOR_PRED ] = ff_pred8x8l_horizontal_10_avx; VAR_0->pred8x8l[DC_PRED ] = ff_pred8x8l_dc_10_avx; VAR_0->pred8x8l[TOP_DC_PRED ] = ff_pred8x8l_top_dc_10_avx; VAR_0->pred8x8l[DIAG_DOWN_RIGHT_PRED] = ff_pred8x8l_down_right_10_avx; VAR_0->pred8x8l[DIAG_DOWN_LEFT_PRED ] = ff_pred8x8l_down_left_10_avx; VAR_0->pred8x8l[VERT_RIGHT_PRED ] = ff_pred8x8l_vertical_right_10_avx; VAR_0->pred8x8l[HOR_UP_PRED ] = ff_pred8x8l_horizontal_up_10_avx; } #endif } #endif }
[ "void FUNC_0(H264PredContext *VAR_0, int VAR_1, const int VAR_2, const int VAR_3)\n{", "#if HAVE_YASM\nint mm_flags = av_get_cpu_flags();", "if (VAR_2 == 8) {", "if (mm_flags & AV_CPU_FLAG_MMX) {", "VAR_0->pred16x16[VERT_PRED8x8 ] = ff_pred16x16_vertical_mmx;", "VAR_0->pred16x16[HOR_PRED8x8 ] = ff_pred16x16_horizontal_mmx;", "if (VAR_3 == 1) {", "VAR_0->pred8x8 [VERT_PRED8x8 ] = ff_pred8x8_vertical_mmx;", "VAR_0->pred8x8 [HOR_PRED8x8 ] = ff_pred8x8_horizontal_mmx;", "}", "if (VAR_1 == AV_CODEC_ID_VP8) {", "VAR_0->pred16x16[PLANE_PRED8x8 ] = ff_pred16x16_tm_vp8_mmx;", "VAR_0->pred8x8 [PLANE_PRED8x8 ] = ff_pred8x8_tm_vp8_mmx;", "VAR_0->pred4x4 [TM_VP8_PRED ] = ff_pred4x4_tm_vp8_mmx;", "} else {", "if (VAR_3 == 1)\nVAR_0->pred8x8 [PLANE_PRED8x8] = ff_pred8x8_plane_mmx;", "if (VAR_1 == AV_CODEC_ID_SVQ3) {", "if (mm_flags & AV_CPU_FLAG_CMOV)\nVAR_0->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_svq3_mmx;", "} else if (VAR_1 == AV_CODEC_ID_RV40) {", "VAR_0->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_rv40_mmx;", "} else {", "VAR_0->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_h264_mmx;", "}", "}", "}", "if (mm_flags & AV_CPU_FLAG_MMXEXT) {", "VAR_0->pred16x16[HOR_PRED8x8 ] = ff_pred16x16_horizontal_mmx2;", "VAR_0->pred16x16[DC_PRED8x8 ] = ff_pred16x16_dc_mmx2;", "if (VAR_3 == 1)\nVAR_0->pred8x8[HOR_PRED8x8 ] = ff_pred8x8_horizontal_mmx2;", "VAR_0->pred8x8l [TOP_DC_PRED ] = ff_pred8x8l_top_dc_mmxext;", "VAR_0->pred8x8l [DC_PRED ] = ff_pred8x8l_dc_mmxext;", "VAR_0->pred8x8l [HOR_PRED ] = ff_pred8x8l_horizontal_mmxext;", "VAR_0->pred8x8l [VERT_PRED ] = ff_pred8x8l_vertical_mmxext;", "VAR_0->pred8x8l [DIAG_DOWN_RIGHT_PRED ] = ff_pred8x8l_down_right_mmxext;", "VAR_0->pred8x8l [VERT_RIGHT_PRED ] = ff_pred8x8l_vertical_right_mmxext;", "VAR_0->pred8x8l [HOR_UP_PRED ] = ff_pred8x8l_horizontal_up_mmxext;", "VAR_0->pred8x8l [DIAG_DOWN_LEFT_PRED ] = ff_pred8x8l_down_left_mmxext;", "VAR_0->pred8x8l [HOR_DOWN_PRED ] = ff_pred8x8l_horizontal_down_mmxext;", "VAR_0->pred4x4 [DIAG_DOWN_RIGHT_PRED ] = ff_pred4x4_down_right_mmxext;", "VAR_0->pred4x4 [VERT_RIGHT_PRED ] = ff_pred4x4_vertical_right_mmxext;", "VAR_0->pred4x4 [HOR_DOWN_PRED ] = ff_pred4x4_horizontal_down_mmxext;", "VAR_0->pred4x4 [DC_PRED ] = ff_pred4x4_dc_mmxext;", "if (VAR_1 == AV_CODEC_ID_VP8 || VAR_1 == AV_CODEC_ID_H264) {", "VAR_0->pred4x4 [DIAG_DOWN_LEFT_PRED] = ff_pred4x4_down_left_mmxext;", "}", "if (VAR_1 == AV_CODEC_ID_SVQ3 || VAR_1 == AV_CODEC_ID_H264) {", "VAR_0->pred4x4 [VERT_LEFT_PRED ] = ff_pred4x4_vertical_left_mmxext;", "}", "if (VAR_1 != AV_CODEC_ID_RV40) {", "VAR_0->pred4x4 [HOR_UP_PRED ] = ff_pred4x4_horizontal_up_mmxext;", "}", "if (VAR_1 == AV_CODEC_ID_SVQ3 || VAR_1 == AV_CODEC_ID_H264) {", "if (VAR_3 == 1) {", "VAR_0->pred8x8[TOP_DC_PRED8x8 ] = ff_pred8x8_top_dc_mmxext;", "VAR_0->pred8x8[DC_PRED8x8 ] = ff_pred8x8_dc_mmxext;", "}", "}", "if (VAR_1 == AV_CODEC_ID_VP8) {", "VAR_0->pred16x16[PLANE_PRED8x8 ] = ff_pred16x16_tm_vp8_mmx2;", "VAR_0->pred8x8 [DC_PRED8x8 ] = ff_pred8x8_dc_rv40_mmxext;", "VAR_0->pred8x8 [PLANE_PRED8x8 ] = ff_pred8x8_tm_vp8_mmx2;", "VAR_0->pred4x4 [TM_VP8_PRED ] = ff_pred4x4_tm_vp8_mmx2;", "VAR_0->pred4x4 [VERT_PRED ] = ff_pred4x4_vertical_vp8_mmxext;", "} else {", "if (VAR_3 == 1)\nVAR_0->pred8x8 [PLANE_PRED8x8] = ff_pred8x8_plane_mmx2;", "if (VAR_1 == AV_CODEC_ID_SVQ3) {", "VAR_0->pred16x16[PLANE_PRED8x8 ] = ff_pred16x16_plane_svq3_mmx2;", "} else if (VAR_1 == AV_CODEC_ID_RV40) {", "VAR_0->pred16x16[PLANE_PRED8x8 ] = ff_pred16x16_plane_rv40_mmx2;", "} else {", "VAR_0->pred16x16[PLANE_PRED8x8 ] = ff_pred16x16_plane_h264_mmx2;", "}", "}", "}", "if (mm_flags & AV_CPU_FLAG_SSE) {", "VAR_0->pred16x16[VERT_PRED8x8] = ff_pred16x16_vertical_sse;", "}", "if (mm_flags & AV_CPU_FLAG_SSE2) {", "VAR_0->pred16x16[DC_PRED8x8 ] = ff_pred16x16_dc_sse2;", "VAR_0->pred8x8l [DIAG_DOWN_LEFT_PRED ] = ff_pred8x8l_down_left_sse2;", "VAR_0->pred8x8l [DIAG_DOWN_RIGHT_PRED ] = ff_pred8x8l_down_right_sse2;", "VAR_0->pred8x8l [VERT_RIGHT_PRED ] = ff_pred8x8l_vertical_right_sse2;", "VAR_0->pred8x8l [VERT_LEFT_PRED ] = ff_pred8x8l_vertical_left_sse2;", "VAR_0->pred8x8l [HOR_DOWN_PRED ] = ff_pred8x8l_horizontal_down_sse2;", "if (VAR_1 == AV_CODEC_ID_VP8) {", "VAR_0->pred16x16[PLANE_PRED8x8 ] = ff_pred16x16_tm_vp8_sse2;", "VAR_0->pred8x8 [PLANE_PRED8x8 ] = ff_pred8x8_tm_vp8_sse2;", "} else {", "if (VAR_3 == 1)\nVAR_0->pred8x8 [PLANE_PRED8x8] = ff_pred8x8_plane_sse2;", "if (VAR_1 == AV_CODEC_ID_SVQ3) {", "VAR_0->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_svq3_sse2;", "} else if (VAR_1 == AV_CODEC_ID_RV40) {", "VAR_0->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_rv40_sse2;", "} else {", "VAR_0->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_h264_sse2;", "}", "}", "}", "if (mm_flags & AV_CPU_FLAG_SSSE3) {", "VAR_0->pred16x16[HOR_PRED8x8 ] = ff_pred16x16_horizontal_ssse3;", "VAR_0->pred16x16[DC_PRED8x8 ] = ff_pred16x16_dc_ssse3;", "if (VAR_3 == 1)\nVAR_0->pred8x8 [HOR_PRED8x8 ] = ff_pred8x8_horizontal_ssse3;", "VAR_0->pred8x8l [TOP_DC_PRED ] = ff_pred8x8l_top_dc_ssse3;", "VAR_0->pred8x8l [DC_PRED ] = ff_pred8x8l_dc_ssse3;", "VAR_0->pred8x8l [HOR_PRED ] = ff_pred8x8l_horizontal_ssse3;", "VAR_0->pred8x8l [VERT_PRED ] = ff_pred8x8l_vertical_ssse3;", "VAR_0->pred8x8l [DIAG_DOWN_LEFT_PRED ] = ff_pred8x8l_down_left_ssse3;", "VAR_0->pred8x8l [DIAG_DOWN_RIGHT_PRED ] = ff_pred8x8l_down_right_ssse3;", "VAR_0->pred8x8l [VERT_RIGHT_PRED ] = ff_pred8x8l_vertical_right_ssse3;", "VAR_0->pred8x8l [VERT_LEFT_PRED ] = ff_pred8x8l_vertical_left_ssse3;", "VAR_0->pred8x8l [HOR_UP_PRED ] = ff_pred8x8l_horizontal_up_ssse3;", "VAR_0->pred8x8l [HOR_DOWN_PRED ] = ff_pred8x8l_horizontal_down_ssse3;", "if (VAR_1 == AV_CODEC_ID_VP8) {", "VAR_0->pred8x8 [PLANE_PRED8x8 ] = ff_pred8x8_tm_vp8_ssse3;", "VAR_0->pred4x4 [TM_VP8_PRED ] = ff_pred4x4_tm_vp8_ssse3;", "} else {", "if (VAR_3 == 1)\nVAR_0->pred8x8 [PLANE_PRED8x8] = ff_pred8x8_plane_ssse3;", "if (VAR_1 == AV_CODEC_ID_SVQ3) {", "VAR_0->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_svq3_ssse3;", "} else if (VAR_1 == AV_CODEC_ID_RV40) {", "VAR_0->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_rv40_ssse3;", "} else {", "VAR_0->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_h264_ssse3;", "}", "}", "}", "} else if (VAR_2 == 10) {", "if (mm_flags & AV_CPU_FLAG_MMXEXT) {", "VAR_0->pred4x4[DC_PRED ] = ff_pred4x4_dc_10_mmxext;", "VAR_0->pred4x4[HOR_UP_PRED ] = ff_pred4x4_horizontal_up_10_mmxext;", "if (VAR_3 == 1)\nVAR_0->pred8x8[DC_PRED8x8 ] = ff_pred8x8_dc_10_mmxext;", "VAR_0->pred8x8l[DC_128_PRED ] = ff_pred8x8l_128_dc_10_mmxext;", "VAR_0->pred16x16[DC_PRED8x8 ] = ff_pred16x16_dc_10_mmxext;", "VAR_0->pred16x16[TOP_DC_PRED8x8 ] = ff_pred16x16_top_dc_10_mmxext;", "VAR_0->pred16x16[DC_128_PRED8x8 ] = ff_pred16x16_128_dc_10_mmxext;", "VAR_0->pred16x16[LEFT_DC_PRED8x8 ] = ff_pred16x16_left_dc_10_mmxext;", "VAR_0->pred16x16[VERT_PRED8x8 ] = ff_pred16x16_vertical_10_mmxext;", "VAR_0->pred16x16[HOR_PRED8x8 ] = ff_pred16x16_horizontal_10_mmxext;", "}", "if (mm_flags & AV_CPU_FLAG_SSE2) {", "VAR_0->pred4x4[DIAG_DOWN_LEFT_PRED ] = ff_pred4x4_down_left_10_sse2;", "VAR_0->pred4x4[DIAG_DOWN_RIGHT_PRED] = ff_pred4x4_down_right_10_sse2;", "VAR_0->pred4x4[VERT_LEFT_PRED ] = ff_pred4x4_vertical_left_10_sse2;", "VAR_0->pred4x4[VERT_RIGHT_PRED ] = ff_pred4x4_vertical_right_10_sse2;", "VAR_0->pred4x4[HOR_DOWN_PRED ] = ff_pred4x4_horizontal_down_10_sse2;", "if (VAR_3 == 1) {", "VAR_0->pred8x8[DC_PRED8x8 ] = ff_pred8x8_dc_10_sse2;", "VAR_0->pred8x8[TOP_DC_PRED8x8 ] = ff_pred8x8_top_dc_10_sse2;", "VAR_0->pred8x8[PLANE_PRED8x8 ] = ff_pred8x8_plane_10_sse2;", "VAR_0->pred8x8[VERT_PRED8x8 ] = ff_pred8x8_vertical_10_sse2;", "VAR_0->pred8x8[HOR_PRED8x8 ] = ff_pred8x8_horizontal_10_sse2;", "}", "VAR_0->pred8x8l[VERT_PRED ] = ff_pred8x8l_vertical_10_sse2;", "VAR_0->pred8x8l[HOR_PRED ] = ff_pred8x8l_horizontal_10_sse2;", "VAR_0->pred8x8l[DC_PRED ] = ff_pred8x8l_dc_10_sse2;", "VAR_0->pred8x8l[DC_128_PRED ] = ff_pred8x8l_128_dc_10_sse2;", "VAR_0->pred8x8l[TOP_DC_PRED ] = ff_pred8x8l_top_dc_10_sse2;", "VAR_0->pred8x8l[DIAG_DOWN_LEFT_PRED ] = ff_pred8x8l_down_left_10_sse2;", "VAR_0->pred8x8l[DIAG_DOWN_RIGHT_PRED] = ff_pred8x8l_down_right_10_sse2;", "VAR_0->pred8x8l[VERT_RIGHT_PRED ] = ff_pred8x8l_vertical_right_10_sse2;", "VAR_0->pred8x8l[HOR_UP_PRED ] = ff_pred8x8l_horizontal_up_10_sse2;", "VAR_0->pred16x16[DC_PRED8x8 ] = ff_pred16x16_dc_10_sse2;", "VAR_0->pred16x16[TOP_DC_PRED8x8 ] = ff_pred16x16_top_dc_10_sse2;", "VAR_0->pred16x16[DC_128_PRED8x8 ] = ff_pred16x16_128_dc_10_sse2;", "VAR_0->pred16x16[LEFT_DC_PRED8x8 ] = ff_pred16x16_left_dc_10_sse2;", "VAR_0->pred16x16[VERT_PRED8x8 ] = ff_pred16x16_vertical_10_sse2;", "VAR_0->pred16x16[HOR_PRED8x8 ] = ff_pred16x16_horizontal_10_sse2;", "}", "if (mm_flags & AV_CPU_FLAG_SSSE3) {", "VAR_0->pred4x4[DIAG_DOWN_RIGHT_PRED] = ff_pred4x4_down_right_10_ssse3;", "VAR_0->pred4x4[VERT_RIGHT_PRED ] = ff_pred4x4_vertical_right_10_ssse3;", "VAR_0->pred4x4[HOR_DOWN_PRED ] = ff_pred4x4_horizontal_down_10_ssse3;", "VAR_0->pred8x8l[HOR_PRED ] = ff_pred8x8l_horizontal_10_ssse3;", "VAR_0->pred8x8l[DIAG_DOWN_LEFT_PRED ] = ff_pred8x8l_down_left_10_ssse3;", "VAR_0->pred8x8l[DIAG_DOWN_RIGHT_PRED] = ff_pred8x8l_down_right_10_ssse3;", "VAR_0->pred8x8l[VERT_RIGHT_PRED ] = ff_pred8x8l_vertical_right_10_ssse3;", "VAR_0->pred8x8l[HOR_UP_PRED ] = ff_pred8x8l_horizontal_up_10_ssse3;", "}", "#if HAVE_AVX\nif (mm_flags & AV_CPU_FLAG_AVX) {", "VAR_0->pred4x4[DIAG_DOWN_LEFT_PRED ] = ff_pred4x4_down_left_10_avx;", "VAR_0->pred4x4[DIAG_DOWN_RIGHT_PRED] = ff_pred4x4_down_right_10_avx;", "VAR_0->pred4x4[VERT_LEFT_PRED ] = ff_pred4x4_vertical_left_10_avx;", "VAR_0->pred4x4[VERT_RIGHT_PRED ] = ff_pred4x4_vertical_right_10_avx;", "VAR_0->pred4x4[HOR_DOWN_PRED ] = ff_pred4x4_horizontal_down_10_avx;", "VAR_0->pred8x8l[VERT_PRED ] = ff_pred8x8l_vertical_10_avx;", "VAR_0->pred8x8l[HOR_PRED ] = ff_pred8x8l_horizontal_10_avx;", "VAR_0->pred8x8l[DC_PRED ] = ff_pred8x8l_dc_10_avx;", "VAR_0->pred8x8l[TOP_DC_PRED ] = ff_pred8x8l_top_dc_10_avx;", "VAR_0->pred8x8l[DIAG_DOWN_RIGHT_PRED] = ff_pred8x8l_down_right_10_avx;", "VAR_0->pred8x8l[DIAG_DOWN_LEFT_PRED ] = ff_pred8x8l_down_left_10_avx;", "VAR_0->pred8x8l[VERT_RIGHT_PRED ] = ff_pred8x8l_vertical_right_10_avx;", "VAR_0->pred8x8l[HOR_UP_PRED ] = ff_pred8x8l_horizontal_up_10_avx;", "}", "#endif\n}", "#endif\n}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5, 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37, 39 ], [ 41 ], [ 43, 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ], [ 67 ], [ 69, 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143, 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 167 ], [ 169 ], [ 171 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197, 199 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 221 ], [ 223 ], [ 225 ], [ 227, 229 ], [ 231 ], [ 233 ], [ 235 ], [ 237 ], [ 239 ], [ 241 ], [ 243 ], [ 245 ], [ 247 ], [ 249 ], [ 251 ], [ 253 ], [ 255 ], [ 257 ], [ 259, 261 ], [ 263 ], [ 265 ], [ 267 ], [ 269 ], [ 271 ], [ 273 ], [ 275 ], [ 277 ], [ 279 ], [ 281 ], [ 283 ], [ 285 ], [ 287 ], [ 291, 293 ], [ 297 ], [ 301 ], [ 303 ], [ 305 ], [ 307 ], [ 309 ], [ 311 ], [ 313 ], [ 315 ], [ 317 ], [ 319 ], [ 321 ], [ 323 ], [ 325 ], [ 329 ], [ 331 ], [ 333 ], [ 335 ], [ 337 ], [ 339 ], [ 341 ], [ 345 ], [ 347 ], [ 349 ], [ 351 ], [ 353 ], [ 355 ], [ 357 ], [ 359 ], [ 361 ], [ 365 ], [ 367 ], [ 369 ], [ 371 ], [ 373 ], [ 375 ], [ 377 ], [ 379 ], [ 381 ], [ 383 ], [ 385 ], [ 389 ], [ 391 ], [ 393 ], [ 395 ], [ 397 ], [ 399 ], [ 401, 403 ], [ 405 ], [ 407 ], [ 409 ], [ 411 ], [ 413 ], [ 417 ], [ 419 ], [ 421 ], [ 423 ], [ 425 ], [ 427 ], [ 429 ], [ 431 ], [ 433 ], [ 435, 437 ], [ 439, 441 ] ]
20,010
static void qobject_input_optional(Visitor *v, const char *name, bool *present) { QObjectInputVisitor *qiv = to_qiv(v); QObject *qobj = qobject_input_get_object(qiv, name, false, NULL); if (!qobj) { *present = false; return; } *present = true; }
true
qemu
a9fc37f6bc3f2ab90585cb16493da9f6dcfbfbcf
static void qobject_input_optional(Visitor *v, const char *name, bool *present) { QObjectInputVisitor *qiv = to_qiv(v); QObject *qobj = qobject_input_get_object(qiv, name, false, NULL); if (!qobj) { *present = false; return; } *present = true; }
{ "code": [ " QObject *qobj = qobject_input_get_object(qiv, name, false, NULL);" ], "line_no": [ 7 ] }
static void FUNC_0(Visitor *VAR_0, const char *VAR_1, bool *VAR_2) { QObjectInputVisitor *qiv = to_qiv(VAR_0); QObject *qobj = qobject_input_get_object(qiv, VAR_1, false, NULL); if (!qobj) { *VAR_2 = false; return; } *VAR_2 = true; }
[ "static void FUNC_0(Visitor *VAR_0, const char *VAR_1, bool *VAR_2)\n{", "QObjectInputVisitor *qiv = to_qiv(VAR_0);", "QObject *qobj = qobject_input_get_object(qiv, VAR_1, false, NULL);", "if (!qobj) {", "*VAR_2 = false;", "return;", "}", "*VAR_2 = true;", "}" ]
[ 0, 0, 1, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ] ]
20,011
static int coroutine_fn copy_sectors(BlockDriverState *bs, uint64_t start_sect, uint64_t cluster_offset, int n_start, int n_end) { BDRVQcowState *s = bs->opaque; QEMUIOVector qiov; struct iovec iov; int n, ret; n = n_end - n_start; if (n <= 0) { return 0; } iov.iov_len = n * BDRV_SECTOR_SIZE; iov.iov_base = qemu_blockalign(bs, iov.iov_len); qemu_iovec_init_external(&qiov, &iov, 1); BLKDBG_EVENT(bs->file, BLKDBG_COW_READ); if (!bs->drv) { return -ENOMEDIUM; } /* Call .bdrv_co_readv() directly instead of using the public block-layer * interface. This avoids double I/O throttling and request tracking, * which can lead to deadlock when block layer copy-on-read is enabled. */ ret = bs->drv->bdrv_co_readv(bs, start_sect + n_start, n, &qiov); if (ret < 0) { goto out; } if (s->crypt_method) { qcow2_encrypt_sectors(s, start_sect + n_start, iov.iov_base, iov.iov_base, n, 1, &s->aes_encrypt_key); } ret = qcow2_pre_write_overlap_check(bs, 0, cluster_offset + n_start * BDRV_SECTOR_SIZE, n * BDRV_SECTOR_SIZE); if (ret < 0) { goto out; } BLKDBG_EVENT(bs->file, BLKDBG_COW_WRITE); ret = bdrv_co_writev(bs->file, (cluster_offset >> 9) + n_start, n, &qiov); if (ret < 0) { goto out; } ret = 0; out: qemu_vfree(iov.iov_base); return ret; }
true
qemu
bd60436936ecebf2c683eef9ea561f2b949700f3
static int coroutine_fn copy_sectors(BlockDriverState *bs, uint64_t start_sect, uint64_t cluster_offset, int n_start, int n_end) { BDRVQcowState *s = bs->opaque; QEMUIOVector qiov; struct iovec iov; int n, ret; n = n_end - n_start; if (n <= 0) { return 0; } iov.iov_len = n * BDRV_SECTOR_SIZE; iov.iov_base = qemu_blockalign(bs, iov.iov_len); qemu_iovec_init_external(&qiov, &iov, 1); BLKDBG_EVENT(bs->file, BLKDBG_COW_READ); if (!bs->drv) { return -ENOMEDIUM; } ret = bs->drv->bdrv_co_readv(bs, start_sect + n_start, n, &qiov); if (ret < 0) { goto out; } if (s->crypt_method) { qcow2_encrypt_sectors(s, start_sect + n_start, iov.iov_base, iov.iov_base, n, 1, &s->aes_encrypt_key); } ret = qcow2_pre_write_overlap_check(bs, 0, cluster_offset + n_start * BDRV_SECTOR_SIZE, n * BDRV_SECTOR_SIZE); if (ret < 0) { goto out; } BLKDBG_EVENT(bs->file, BLKDBG_COW_WRITE); ret = bdrv_co_writev(bs->file, (cluster_offset >> 9) + n_start, n, &qiov); if (ret < 0) { goto out; } ret = 0; out: qemu_vfree(iov.iov_base); return ret; }
{ "code": [ " return -ENOMEDIUM;" ], "line_no": [ 47 ] }
static int VAR_0 copy_sectors(BlockDriverState *bs, uint64_t start_sect, uint64_t cluster_offset, int n_start, int n_end) { BDRVQcowState *s = bs->opaque; QEMUIOVector qiov; struct iovec iov; int n, ret; n = n_end - n_start; if (n <= 0) { return 0; } iov.iov_len = n * BDRV_SECTOR_SIZE; iov.iov_base = qemu_blockalign(bs, iov.iov_len); qemu_iovec_init_external(&qiov, &iov, 1); BLKDBG_EVENT(bs->file, BLKDBG_COW_READ); if (!bs->drv) { return -ENOMEDIUM; } ret = bs->drv->bdrv_co_readv(bs, start_sect + n_start, n, &qiov); if (ret < 0) { goto out; } if (s->crypt_method) { qcow2_encrypt_sectors(s, start_sect + n_start, iov.iov_base, iov.iov_base, n, 1, &s->aes_encrypt_key); } ret = qcow2_pre_write_overlap_check(bs, 0, cluster_offset + n_start * BDRV_SECTOR_SIZE, n * BDRV_SECTOR_SIZE); if (ret < 0) { goto out; } BLKDBG_EVENT(bs->file, BLKDBG_COW_WRITE); ret = bdrv_co_writev(bs->file, (cluster_offset >> 9) + n_start, n, &qiov); if (ret < 0) { goto out; } ret = 0; out: qemu_vfree(iov.iov_base); return ret; }
[ "static int VAR_0 copy_sectors(BlockDriverState *bs,\nuint64_t start_sect,\nuint64_t cluster_offset,\nint n_start, int n_end)\n{", "BDRVQcowState *s = bs->opaque;", "QEMUIOVector qiov;", "struct iovec iov;", "int n, ret;", "n = n_end - n_start;", "if (n <= 0) {", "return 0;", "}", "iov.iov_len = n * BDRV_SECTOR_SIZE;", "iov.iov_base = qemu_blockalign(bs, iov.iov_len);", "qemu_iovec_init_external(&qiov, &iov, 1);", "BLKDBG_EVENT(bs->file, BLKDBG_COW_READ);", "if (!bs->drv) {", "return -ENOMEDIUM;", "}", "ret = bs->drv->bdrv_co_readv(bs, start_sect + n_start, n, &qiov);", "if (ret < 0) {", "goto out;", "}", "if (s->crypt_method) {", "qcow2_encrypt_sectors(s, start_sect + n_start,\niov.iov_base, iov.iov_base, n, 1,\n&s->aes_encrypt_key);", "}", "ret = qcow2_pre_write_overlap_check(bs, 0,\ncluster_offset + n_start * BDRV_SECTOR_SIZE, n * BDRV_SECTOR_SIZE);", "if (ret < 0) {", "goto out;", "}", "BLKDBG_EVENT(bs->file, BLKDBG_COW_WRITE);", "ret = bdrv_co_writev(bs->file, (cluster_offset >> 9) + n_start, n, &qiov);", "if (ret < 0) {", "goto out;", "}", "ret = 0;", "out:\nqemu_vfree(iov.iov_base);", "return ret;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 37 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 71 ], [ 73, 75, 77 ], [ 79 ], [ 83, 85 ], [ 87 ], [ 89 ], [ 91 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 107 ], [ 109, 111 ], [ 113 ], [ 115 ] ]
20,012
static uint32_t ahci_port_read(AHCIState *s, int port, int offset) { uint32_t val; AHCIPortRegs *pr; pr = &s->dev[port].port_regs; switch (offset) { case PORT_LST_ADDR: val = pr->lst_addr; break; case PORT_LST_ADDR_HI: val = pr->lst_addr_hi; break; case PORT_FIS_ADDR: val = pr->fis_addr; break; case PORT_FIS_ADDR_HI: val = pr->fis_addr_hi; break; case PORT_IRQ_STAT: val = pr->irq_stat; break; case PORT_IRQ_MASK: val = pr->irq_mask; break; case PORT_CMD: val = pr->cmd; break; case PORT_TFDATA: val = ((uint16_t)s->dev[port].port.ifs[0].error << 8) | s->dev[port].port.ifs[0].status; break; case PORT_SIG: val = pr->sig; break; case PORT_SCR_STAT: if (s->dev[port].port.ifs[0].bs) { val = SATA_SCR_SSTATUS_DET_DEV_PRESENT_PHY_UP | SATA_SCR_SSTATUS_SPD_GEN1 | SATA_SCR_SSTATUS_IPM_ACTIVE; } else { val = SATA_SCR_SSTATUS_DET_NODEV; } break; case PORT_SCR_CTL: val = pr->scr_ctl; break; case PORT_SCR_ERR: val = pr->scr_err; break; case PORT_SCR_ACT: pr->scr_act &= ~s->dev[port].finished; s->dev[port].finished = 0; val = pr->scr_act; break; case PORT_CMD_ISSUE: val = pr->cmd_issue; break; case PORT_RESERVED: default: val = 0; } DPRINTF(port, "offset: 0x%x val: 0x%x\n", offset, val); return val; }
true
qemu
fac7aa7fc2ebc26803b0a7b44b010f47ce3e1dd8
static uint32_t ahci_port_read(AHCIState *s, int port, int offset) { uint32_t val; AHCIPortRegs *pr; pr = &s->dev[port].port_regs; switch (offset) { case PORT_LST_ADDR: val = pr->lst_addr; break; case PORT_LST_ADDR_HI: val = pr->lst_addr_hi; break; case PORT_FIS_ADDR: val = pr->fis_addr; break; case PORT_FIS_ADDR_HI: val = pr->fis_addr_hi; break; case PORT_IRQ_STAT: val = pr->irq_stat; break; case PORT_IRQ_MASK: val = pr->irq_mask; break; case PORT_CMD: val = pr->cmd; break; case PORT_TFDATA: val = ((uint16_t)s->dev[port].port.ifs[0].error << 8) | s->dev[port].port.ifs[0].status; break; case PORT_SIG: val = pr->sig; break; case PORT_SCR_STAT: if (s->dev[port].port.ifs[0].bs) { val = SATA_SCR_SSTATUS_DET_DEV_PRESENT_PHY_UP | SATA_SCR_SSTATUS_SPD_GEN1 | SATA_SCR_SSTATUS_IPM_ACTIVE; } else { val = SATA_SCR_SSTATUS_DET_NODEV; } break; case PORT_SCR_CTL: val = pr->scr_ctl; break; case PORT_SCR_ERR: val = pr->scr_err; break; case PORT_SCR_ACT: pr->scr_act &= ~s->dev[port].finished; s->dev[port].finished = 0; val = pr->scr_act; break; case PORT_CMD_ISSUE: val = pr->cmd_issue; break; case PORT_RESERVED: default: val = 0; } DPRINTF(port, "offset: 0x%x val: 0x%x\n", offset, val); return val; }
{ "code": [ " val = ((uint16_t)s->dev[port].port.ifs[0].error << 8) |", " s->dev[port].port.ifs[0].status;" ], "line_no": [ 59, 61 ] }
static uint32_t FUNC_0(AHCIState *s, int port, int offset) { uint32_t val; AHCIPortRegs *pr; pr = &s->dev[port].port_regs; switch (offset) { case PORT_LST_ADDR: val = pr->lst_addr; break; case PORT_LST_ADDR_HI: val = pr->lst_addr_hi; break; case PORT_FIS_ADDR: val = pr->fis_addr; break; case PORT_FIS_ADDR_HI: val = pr->fis_addr_hi; break; case PORT_IRQ_STAT: val = pr->irq_stat; break; case PORT_IRQ_MASK: val = pr->irq_mask; break; case PORT_CMD: val = pr->cmd; break; case PORT_TFDATA: val = ((uint16_t)s->dev[port].port.ifs[0].error << 8) | s->dev[port].port.ifs[0].status; break; case PORT_SIG: val = pr->sig; break; case PORT_SCR_STAT: if (s->dev[port].port.ifs[0].bs) { val = SATA_SCR_SSTATUS_DET_DEV_PRESENT_PHY_UP | SATA_SCR_SSTATUS_SPD_GEN1 | SATA_SCR_SSTATUS_IPM_ACTIVE; } else { val = SATA_SCR_SSTATUS_DET_NODEV; } break; case PORT_SCR_CTL: val = pr->scr_ctl; break; case PORT_SCR_ERR: val = pr->scr_err; break; case PORT_SCR_ACT: pr->scr_act &= ~s->dev[port].finished; s->dev[port].finished = 0; val = pr->scr_act; break; case PORT_CMD_ISSUE: val = pr->cmd_issue; break; case PORT_RESERVED: default: val = 0; } DPRINTF(port, "offset: 0x%x val: 0x%x\n", offset, val); return val; }
[ "static uint32_t FUNC_0(AHCIState *s, int port, int offset)\n{", "uint32_t val;", "AHCIPortRegs *pr;", "pr = &s->dev[port].port_regs;", "switch (offset) {", "case PORT_LST_ADDR:\nval = pr->lst_addr;", "break;", "case PORT_LST_ADDR_HI:\nval = pr->lst_addr_hi;", "break;", "case PORT_FIS_ADDR:\nval = pr->fis_addr;", "break;", "case PORT_FIS_ADDR_HI:\nval = pr->fis_addr_hi;", "break;", "case PORT_IRQ_STAT:\nval = pr->irq_stat;", "break;", "case PORT_IRQ_MASK:\nval = pr->irq_mask;", "break;", "case PORT_CMD:\nval = pr->cmd;", "break;", "case PORT_TFDATA:\nval = ((uint16_t)s->dev[port].port.ifs[0].error << 8) |\ns->dev[port].port.ifs[0].status;", "break;", "case PORT_SIG:\nval = pr->sig;", "break;", "case PORT_SCR_STAT:\nif (s->dev[port].port.ifs[0].bs) {", "val = SATA_SCR_SSTATUS_DET_DEV_PRESENT_PHY_UP |\nSATA_SCR_SSTATUS_SPD_GEN1 | SATA_SCR_SSTATUS_IPM_ACTIVE;", "} else {", "val = SATA_SCR_SSTATUS_DET_NODEV;", "}", "break;", "case PORT_SCR_CTL:\nval = pr->scr_ctl;", "break;", "case PORT_SCR_ERR:\nval = pr->scr_err;", "break;", "case PORT_SCR_ACT:\npr->scr_act &= ~s->dev[port].finished;", "s->dev[port].finished = 0;", "val = pr->scr_act;", "break;", "case PORT_CMD_ISSUE:\nval = pr->cmd_issue;", "break;", "case PORT_RESERVED:\ndefault:\nval = 0;", "}", "DPRINTF(port, \"offset: 0x%x val: 0x%x\\n\", offset, val);", "return val;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15, 17 ], [ 19 ], [ 21, 23 ], [ 25 ], [ 27, 29 ], [ 31 ], [ 33, 35 ], [ 37 ], [ 39, 41 ], [ 43 ], [ 45, 47 ], [ 49 ], [ 51, 53 ], [ 55 ], [ 57, 59, 61 ], [ 63 ], [ 65, 67 ], [ 69 ], [ 71, 73 ], [ 75, 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87, 89 ], [ 91 ], [ 93, 95 ], [ 97 ], [ 99, 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109, 111 ], [ 113 ], [ 115, 117, 119 ], [ 121 ], [ 123 ], [ 125 ], [ 129 ] ]
20,013
av_cold void ff_wmv2_common_init(Wmv2Context *w) { MpegEncContext *const s = &w->s; ff_blockdsp_init(&s->bdsp, s->avctx); ff_wmv2dsp_init(&w->wdsp); s->idsp.perm_type = w->wdsp.idct_perm; ff_init_scantable_permutation(s->idsp.idct_permutation, w->wdsp.idct_perm); ff_init_scantable(s->idsp.idct_permutation, &w->abt_scantable[0], ff_wmv2_scantableA); ff_init_scantable(s->idsp.idct_permutation, &w->abt_scantable[1], ff_wmv2_scantableB); ff_init_scantable(s->idsp.idct_permutation, &s->intra_scantable, ff_wmv1_scantable[1]); ff_init_scantable(s->idsp.idct_permutation, &s->intra_h_scantable, ff_wmv1_scantable[2]); ff_init_scantable(s->idsp.idct_permutation, &s->intra_v_scantable, ff_wmv1_scantable[3]); ff_init_scantable(s->idsp.idct_permutation, &s->inter_scantable, ff_wmv1_scantable[0]); s->idsp.idct_put = w->wdsp.idct_put; s->idsp.idct_add = w->wdsp.idct_add; s->idsp.idct = NULL; }
false
FFmpeg
dcc39ee10e82833ce24aa57926c00ffeb1948198
av_cold void ff_wmv2_common_init(Wmv2Context *w) { MpegEncContext *const s = &w->s; ff_blockdsp_init(&s->bdsp, s->avctx); ff_wmv2dsp_init(&w->wdsp); s->idsp.perm_type = w->wdsp.idct_perm; ff_init_scantable_permutation(s->idsp.idct_permutation, w->wdsp.idct_perm); ff_init_scantable(s->idsp.idct_permutation, &w->abt_scantable[0], ff_wmv2_scantableA); ff_init_scantable(s->idsp.idct_permutation, &w->abt_scantable[1], ff_wmv2_scantableB); ff_init_scantable(s->idsp.idct_permutation, &s->intra_scantable, ff_wmv1_scantable[1]); ff_init_scantable(s->idsp.idct_permutation, &s->intra_h_scantable, ff_wmv1_scantable[2]); ff_init_scantable(s->idsp.idct_permutation, &s->intra_v_scantable, ff_wmv1_scantable[3]); ff_init_scantable(s->idsp.idct_permutation, &s->inter_scantable, ff_wmv1_scantable[0]); s->idsp.idct_put = w->wdsp.idct_put; s->idsp.idct_add = w->wdsp.idct_add; s->idsp.idct = NULL; }
{ "code": [], "line_no": [] }
av_cold void FUNC_0(Wmv2Context *w) { MpegEncContext *const s = &w->s; ff_blockdsp_init(&s->bdsp, s->avctx); ff_wmv2dsp_init(&w->wdsp); s->idsp.perm_type = w->wdsp.idct_perm; ff_init_scantable_permutation(s->idsp.idct_permutation, w->wdsp.idct_perm); ff_init_scantable(s->idsp.idct_permutation, &w->abt_scantable[0], ff_wmv2_scantableA); ff_init_scantable(s->idsp.idct_permutation, &w->abt_scantable[1], ff_wmv2_scantableB); ff_init_scantable(s->idsp.idct_permutation, &s->intra_scantable, ff_wmv1_scantable[1]); ff_init_scantable(s->idsp.idct_permutation, &s->intra_h_scantable, ff_wmv1_scantable[2]); ff_init_scantable(s->idsp.idct_permutation, &s->intra_v_scantable, ff_wmv1_scantable[3]); ff_init_scantable(s->idsp.idct_permutation, &s->inter_scantable, ff_wmv1_scantable[0]); s->idsp.idct_put = w->wdsp.idct_put; s->idsp.idct_add = w->wdsp.idct_add; s->idsp.idct = NULL; }
[ "av_cold void FUNC_0(Wmv2Context *w)\n{", "MpegEncContext *const s = &w->s;", "ff_blockdsp_init(&s->bdsp, s->avctx);", "ff_wmv2dsp_init(&w->wdsp);", "s->idsp.perm_type = w->wdsp.idct_perm;", "ff_init_scantable_permutation(s->idsp.idct_permutation,\nw->wdsp.idct_perm);", "ff_init_scantable(s->idsp.idct_permutation, &w->abt_scantable[0],\nff_wmv2_scantableA);", "ff_init_scantable(s->idsp.idct_permutation, &w->abt_scantable[1],\nff_wmv2_scantableB);", "ff_init_scantable(s->idsp.idct_permutation, &s->intra_scantable,\nff_wmv1_scantable[1]);", "ff_init_scantable(s->idsp.idct_permutation, &s->intra_h_scantable,\nff_wmv1_scantable[2]);", "ff_init_scantable(s->idsp.idct_permutation, &s->intra_v_scantable,\nff_wmv1_scantable[3]);", "ff_init_scantable(s->idsp.idct_permutation, &s->inter_scantable,\nff_wmv1_scantable[0]);", "s->idsp.idct_put = w->wdsp.idct_put;", "s->idsp.idct_add = w->wdsp.idct_add;", "s->idsp.idct = NULL;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15, 17 ], [ 19, 21 ], [ 23, 25 ], [ 27, 29 ], [ 31, 33 ], [ 35, 37 ], [ 39, 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ] ]
20,014
static int decode_subpacket(COOKContext *q, uint8_t *inbuffer, int sub_packet_size, int16_t *outbuffer) { int i,j; int value; float* tmp_ptr; /* packet dump */ // for (i=0 ; i<sub_packet_size ; i++) { // av_log(NULL, AV_LOG_ERROR, "%02x", inbuffer[i]); // } // av_log(NULL, AV_LOG_ERROR, "\n"); decode_bytes(inbuffer, q->decoded_bytes_buffer, sub_packet_size); init_get_bits(&q->gb, q->decoded_bytes_buffer, sub_packet_size*8); decode_gain_info(&q->gb, &q->gain_current); memcpy(&q->gain_copy, &q->gain_current ,sizeof(COOKgain)); //This copy does not seem to be used. FIXME if(q->nb_channels==2 && q->joint_stereo==1){ joint_decode(q, q->decode_buf_ptr[0], q->decode_buf_ptr[2]); /* Swap buffer pointers. */ tmp_ptr = q->decode_buf_ptr[1]; q->decode_buf_ptr[1] = q->decode_buf_ptr[0]; q->decode_buf_ptr[0] = tmp_ptr; tmp_ptr = q->decode_buf_ptr[3]; q->decode_buf_ptr[3] = q->decode_buf_ptr[2]; q->decode_buf_ptr[2] = tmp_ptr; /* FIXME: Rethink the gainbuffer handling, maybe a rename? now/previous swap */ q->gain_now_ptr = &q->gain_now; q->gain_previous_ptr = &q->gain_previous; for (i=0 ; i<q->nb_channels ; i++){ cook_imlt(q, q->decode_buf_ptr[i*2], q->mono_mdct_output, q->mlt_tmp); gain_compensate(q, q->mono_mdct_output, q->gain_now_ptr, q->gain_previous_ptr, q->previous_buffer_ptr[0]); /* Swap out the previous buffer. */ tmp_ptr = q->previous_buffer_ptr[0]; q->previous_buffer_ptr[0] = q->previous_buffer_ptr[1]; q->previous_buffer_ptr[1] = tmp_ptr; /* Clip and convert the floats to 16 bits. */ for (j=0 ; j<q->samples_per_frame ; j++){ value = lrintf(q->mono_mdct_output[j]); if(value < -32768) value = -32768; else if(value > 32767) value = 32767; outbuffer[2*j+i] = value; } } memcpy(&q->gain_now, &q->gain_previous, sizeof(COOKgain)); memcpy(&q->gain_previous, &q->gain_current, sizeof(COOKgain)); } else if (q->nb_channels==2 && q->joint_stereo==0) { /* channel 0 */ mono_decode(q, q->decode_buf_ptr[0]); tmp_ptr = q->decode_buf_ptr[0]; q->decode_buf_ptr[0] = q->decode_buf_ptr[1]; q->decode_buf_ptr[1] = q->decode_buf_ptr[2]; q->decode_buf_ptr[2] = q->decode_buf_ptr[3]; q->decode_buf_ptr[3] = tmp_ptr; q->gain_now_ptr = &q->gain_now; q->gain_previous_ptr = &q->gain_previous; cook_imlt(q, q->decode_buf_ptr[0], q->mono_mdct_output,q->mlt_tmp); gain_compensate(q, q->mono_mdct_output, q->gain_now_ptr, q->gain_previous_ptr, q->previous_buffer_ptr[0]); /* Swap out the previous buffer. */ tmp_ptr = q->previous_buffer_ptr[0]; q->previous_buffer_ptr[0] = q->previous_buffer_ptr[1]; q->previous_buffer_ptr[1] = tmp_ptr; for (j=0 ; j<q->samples_per_frame ; j++){ value = lrintf(q->mono_mdct_output[j]); if(value < -32768) value = -32768; else if(value > 32767) value = 32767; outbuffer[2*j+1] = value; } /* channel 1 */ //av_log(NULL,AV_LOG_ERROR,"bits = %d\n",get_bits_count(&q->gb)); init_get_bits(&q->gb, q->decoded_bytes_buffer, sub_packet_size*8+q->bits_per_subpacket); decode_gain_info(&q->gb, &q->gain_current); //memcpy(&q->gain_copy, &q->gain_current ,sizeof(COOKgain)); mono_decode(q, q->decode_buf_ptr[0]); tmp_ptr = q->decode_buf_ptr[0]; q->decode_buf_ptr[1] = q->decode_buf_ptr[2]; q->decode_buf_ptr[2] = q->decode_buf_ptr[3]; q->decode_buf_ptr[3] = tmp_ptr; q->gain_now_ptr = &q->gain_now; q->gain_previous_ptr = &q->gain_previous; cook_imlt(q, q->decode_buf_ptr[0], q->mono_mdct_output,q->mlt_tmp); gain_compensate(q, q->mono_mdct_output, q->gain_now_ptr, q->gain_previous_ptr, q->previous_buffer_ptr[0]); /* Swap out the previous buffer. */ tmp_ptr = q->previous_buffer_ptr[0]; q->previous_buffer_ptr[0] = q->previous_buffer_ptr[1]; q->previous_buffer_ptr[1] = tmp_ptr; for (j=0 ; j<q->samples_per_frame ; j++){ value = lrintf(q->mono_mdct_output[j]); if(value < -32768) value = -32768; else if(value > 32767) value = 32767; outbuffer[2*j] = value; } /* Swap out the previous buffer. */ memcpy(&q->gain_now, &q->gain_previous, sizeof(COOKgain)); memcpy(&q->gain_previous, &q->gain_current, sizeof(COOKgain)); } else { mono_decode(q, q->decode_buf_ptr[0]); /* Swap buffer pointers. */ tmp_ptr = q->decode_buf_ptr[1]; q->decode_buf_ptr[1] = q->decode_buf_ptr[0]; q->decode_buf_ptr[0] = tmp_ptr; /* FIXME: Rethink the gainbuffer handling, maybe a rename? now/previous swap */ q->gain_now_ptr = &q->gain_now; q->gain_previous_ptr = &q->gain_previous; cook_imlt(q, q->decode_buf_ptr[0], q->mono_mdct_output,q->mlt_tmp); gain_compensate(q, q->mono_mdct_output, q->gain_now_ptr, q->gain_previous_ptr, q->mono_previous_buffer1); /* Clip and convert the floats to 16 bits */ for (j=0 ; j<q->samples_per_frame ; j++){ value = lrintf(q->mono_mdct_output[j]); if(value < -32768) value = -32768; else if(value > 32767) value = 32767; outbuffer[j] = value; } memcpy(&q->gain_now, &q->gain_previous, sizeof(COOKgain)); memcpy(&q->gain_previous, &q->gain_current, sizeof(COOKgain)); } return q->samples_per_frame * sizeof(int16_t); }
true
FFmpeg
560b10a6c3627cccf6735170d370cf9e3d38e805
static int decode_subpacket(COOKContext *q, uint8_t *inbuffer, int sub_packet_size, int16_t *outbuffer) { int i,j; int value; float* tmp_ptr; decode_bytes(inbuffer, q->decoded_bytes_buffer, sub_packet_size); init_get_bits(&q->gb, q->decoded_bytes_buffer, sub_packet_size*8); decode_gain_info(&q->gb, &q->gain_current); memcpy(&q->gain_copy, &q->gain_current ,sizeof(COOKgain)); if(q->nb_channels==2 && q->joint_stereo==1){ joint_decode(q, q->decode_buf_ptr[0], q->decode_buf_ptr[2]); tmp_ptr = q->decode_buf_ptr[1]; q->decode_buf_ptr[1] = q->decode_buf_ptr[0]; q->decode_buf_ptr[0] = tmp_ptr; tmp_ptr = q->decode_buf_ptr[3]; q->decode_buf_ptr[3] = q->decode_buf_ptr[2]; q->decode_buf_ptr[2] = tmp_ptr; q->gain_now_ptr = &q->gain_now; q->gain_previous_ptr = &q->gain_previous; for (i=0 ; i<q->nb_channels ; i++){ cook_imlt(q, q->decode_buf_ptr[i*2], q->mono_mdct_output, q->mlt_tmp); gain_compensate(q, q->mono_mdct_output, q->gain_now_ptr, q->gain_previous_ptr, q->previous_buffer_ptr[0]); tmp_ptr = q->previous_buffer_ptr[0]; q->previous_buffer_ptr[0] = q->previous_buffer_ptr[1]; q->previous_buffer_ptr[1] = tmp_ptr; for (j=0 ; j<q->samples_per_frame ; j++){ value = lrintf(q->mono_mdct_output[j]); if(value < -32768) value = -32768; else if(value > 32767) value = 32767; outbuffer[2*j+i] = value; } } memcpy(&q->gain_now, &q->gain_previous, sizeof(COOKgain)); memcpy(&q->gain_previous, &q->gain_current, sizeof(COOKgain)); } else if (q->nb_channels==2 && q->joint_stereo==0) { mono_decode(q, q->decode_buf_ptr[0]); tmp_ptr = q->decode_buf_ptr[0]; q->decode_buf_ptr[0] = q->decode_buf_ptr[1]; q->decode_buf_ptr[1] = q->decode_buf_ptr[2]; q->decode_buf_ptr[2] = q->decode_buf_ptr[3]; q->decode_buf_ptr[3] = tmp_ptr; q->gain_now_ptr = &q->gain_now; q->gain_previous_ptr = &q->gain_previous; cook_imlt(q, q->decode_buf_ptr[0], q->mono_mdct_output,q->mlt_tmp); gain_compensate(q, q->mono_mdct_output, q->gain_now_ptr, q->gain_previous_ptr, q->previous_buffer_ptr[0]); tmp_ptr = q->previous_buffer_ptr[0]; q->previous_buffer_ptr[0] = q->previous_buffer_ptr[1]; q->previous_buffer_ptr[1] = tmp_ptr; for (j=0 ; j<q->samples_per_frame ; j++){ value = lrintf(q->mono_mdct_output[j]); if(value < -32768) value = -32768; else if(value > 32767) value = 32767; outbuffer[2*j+1] = value; } init_get_bits(&q->gb, q->decoded_bytes_buffer, sub_packet_size*8+q->bits_per_subpacket); decode_gain_info(&q->gb, &q->gain_current); mono_decode(q, q->decode_buf_ptr[0]); tmp_ptr = q->decode_buf_ptr[0]; q->decode_buf_ptr[1] = q->decode_buf_ptr[2]; q->decode_buf_ptr[2] = q->decode_buf_ptr[3]; q->decode_buf_ptr[3] = tmp_ptr; q->gain_now_ptr = &q->gain_now; q->gain_previous_ptr = &q->gain_previous; cook_imlt(q, q->decode_buf_ptr[0], q->mono_mdct_output,q->mlt_tmp); gain_compensate(q, q->mono_mdct_output, q->gain_now_ptr, q->gain_previous_ptr, q->previous_buffer_ptr[0]); tmp_ptr = q->previous_buffer_ptr[0]; q->previous_buffer_ptr[0] = q->previous_buffer_ptr[1]; q->previous_buffer_ptr[1] = tmp_ptr; for (j=0 ; j<q->samples_per_frame ; j++){ value = lrintf(q->mono_mdct_output[j]); if(value < -32768) value = -32768; else if(value > 32767) value = 32767; outbuffer[2*j] = value; } memcpy(&q->gain_now, &q->gain_previous, sizeof(COOKgain)); memcpy(&q->gain_previous, &q->gain_current, sizeof(COOKgain)); } else { mono_decode(q, q->decode_buf_ptr[0]); tmp_ptr = q->decode_buf_ptr[1]; q->decode_buf_ptr[1] = q->decode_buf_ptr[0]; q->decode_buf_ptr[0] = tmp_ptr; q->gain_now_ptr = &q->gain_now; q->gain_previous_ptr = &q->gain_previous; cook_imlt(q, q->decode_buf_ptr[0], q->mono_mdct_output,q->mlt_tmp); gain_compensate(q, q->mono_mdct_output, q->gain_now_ptr, q->gain_previous_ptr, q->mono_previous_buffer1); for (j=0 ; j<q->samples_per_frame ; j++){ value = lrintf(q->mono_mdct_output[j]); if(value < -32768) value = -32768; else if(value > 32767) value = 32767; outbuffer[j] = value; } memcpy(&q->gain_now, &q->gain_previous, sizeof(COOKgain)); memcpy(&q->gain_previous, &q->gain_current, sizeof(COOKgain)); } return q->samples_per_frame * sizeof(int16_t); }
{ "code": [ " mono_decode(q, q->decode_buf_ptr[0]);", " tmp_ptr = q->decode_buf_ptr[0];", " q->decode_buf_ptr[0] = q->decode_buf_ptr[1];", " q->decode_buf_ptr[1] = q->decode_buf_ptr[2];", " q->decode_buf_ptr[2] = q->decode_buf_ptr[3];", " q->decode_buf_ptr[3] = tmp_ptr;", " q->gain_now_ptr = &q->gain_now;", " q->gain_previous_ptr = &q->gain_previous;", " cook_imlt(q, q->decode_buf_ptr[0], q->mono_mdct_output,q->mlt_tmp);", " q->gain_previous_ptr, q->previous_buffer_ptr[0]);", " tmp_ptr = q->previous_buffer_ptr[0];", " q->previous_buffer_ptr[0] = q->previous_buffer_ptr[1];", " q->previous_buffer_ptr[1] = tmp_ptr;", " decode_gain_info(&q->gb, &q->gain_current);", " tmp_ptr = q->decode_buf_ptr[0];", " q->decode_buf_ptr[1] = q->decode_buf_ptr[2];", " q->decode_buf_ptr[2] = q->decode_buf_ptr[3];", " q->decode_buf_ptr[3] = tmp_ptr;", " q->gain_now_ptr = &q->gain_now;", " q->gain_previous_ptr = &q->gain_previous;", " gain_compensate(q, q->mono_mdct_output, q->gain_now_ptr, q->gain_previous_ptr, q->previous_buffer_ptr[0]);", " memcpy(&q->gain_now, &q->gain_previous, sizeof(COOKgain));", " memcpy(&q->gain_previous, &q->gain_current, sizeof(COOKgain));" ], "line_no": [ 115, 119, 121, 123, 125, 127, 131, 133, 137, 73, 79, 81, 83, 173, 119, 123, 125, 127, 131, 133, 197, 229, 231 ] }
static int FUNC_0(COOKContext *VAR_0, uint8_t *VAR_1, int VAR_2, int16_t *VAR_3) { int VAR_4,VAR_5; int VAR_6; float* VAR_7; decode_bytes(VAR_1, VAR_0->decoded_bytes_buffer, VAR_2); init_get_bits(&VAR_0->gb, VAR_0->decoded_bytes_buffer, VAR_2*8); decode_gain_info(&VAR_0->gb, &VAR_0->gain_current); memcpy(&VAR_0->gain_copy, &VAR_0->gain_current ,sizeof(COOKgain)); if(VAR_0->nb_channels==2 && VAR_0->joint_stereo==1){ joint_decode(VAR_0, VAR_0->decode_buf_ptr[0], VAR_0->decode_buf_ptr[2]); VAR_7 = VAR_0->decode_buf_ptr[1]; VAR_0->decode_buf_ptr[1] = VAR_0->decode_buf_ptr[0]; VAR_0->decode_buf_ptr[0] = VAR_7; VAR_7 = VAR_0->decode_buf_ptr[3]; VAR_0->decode_buf_ptr[3] = VAR_0->decode_buf_ptr[2]; VAR_0->decode_buf_ptr[2] = VAR_7; VAR_0->gain_now_ptr = &VAR_0->gain_now; VAR_0->gain_previous_ptr = &VAR_0->gain_previous; for (VAR_4=0 ; VAR_4<VAR_0->nb_channels ; VAR_4++){ cook_imlt(VAR_0, VAR_0->decode_buf_ptr[VAR_4*2], VAR_0->mono_mdct_output, VAR_0->mlt_tmp); gain_compensate(VAR_0, VAR_0->mono_mdct_output, VAR_0->gain_now_ptr, VAR_0->gain_previous_ptr, VAR_0->previous_buffer_ptr[0]); VAR_7 = VAR_0->previous_buffer_ptr[0]; VAR_0->previous_buffer_ptr[0] = VAR_0->previous_buffer_ptr[1]; VAR_0->previous_buffer_ptr[1] = VAR_7; for (VAR_5=0 ; VAR_5<VAR_0->samples_per_frame ; VAR_5++){ VAR_6 = lrintf(VAR_0->mono_mdct_output[VAR_5]); if(VAR_6 < -32768) VAR_6 = -32768; else if(VAR_6 > 32767) VAR_6 = 32767; VAR_3[2*VAR_5+VAR_4] = VAR_6; } } memcpy(&VAR_0->gain_now, &VAR_0->gain_previous, sizeof(COOKgain)); memcpy(&VAR_0->gain_previous, &VAR_0->gain_current, sizeof(COOKgain)); } else if (VAR_0->nb_channels==2 && VAR_0->joint_stereo==0) { mono_decode(VAR_0, VAR_0->decode_buf_ptr[0]); VAR_7 = VAR_0->decode_buf_ptr[0]; VAR_0->decode_buf_ptr[0] = VAR_0->decode_buf_ptr[1]; VAR_0->decode_buf_ptr[1] = VAR_0->decode_buf_ptr[2]; VAR_0->decode_buf_ptr[2] = VAR_0->decode_buf_ptr[3]; VAR_0->decode_buf_ptr[3] = VAR_7; VAR_0->gain_now_ptr = &VAR_0->gain_now; VAR_0->gain_previous_ptr = &VAR_0->gain_previous; cook_imlt(VAR_0, VAR_0->decode_buf_ptr[0], VAR_0->mono_mdct_output,VAR_0->mlt_tmp); gain_compensate(VAR_0, VAR_0->mono_mdct_output, VAR_0->gain_now_ptr, VAR_0->gain_previous_ptr, VAR_0->previous_buffer_ptr[0]); VAR_7 = VAR_0->previous_buffer_ptr[0]; VAR_0->previous_buffer_ptr[0] = VAR_0->previous_buffer_ptr[1]; VAR_0->previous_buffer_ptr[1] = VAR_7; for (VAR_5=0 ; VAR_5<VAR_0->samples_per_frame ; VAR_5++){ VAR_6 = lrintf(VAR_0->mono_mdct_output[VAR_5]); if(VAR_6 < -32768) VAR_6 = -32768; else if(VAR_6 > 32767) VAR_6 = 32767; VAR_3[2*VAR_5+1] = VAR_6; } init_get_bits(&VAR_0->gb, VAR_0->decoded_bytes_buffer, VAR_2*8+VAR_0->bits_per_subpacket); decode_gain_info(&VAR_0->gb, &VAR_0->gain_current); mono_decode(VAR_0, VAR_0->decode_buf_ptr[0]); VAR_7 = VAR_0->decode_buf_ptr[0]; VAR_0->decode_buf_ptr[1] = VAR_0->decode_buf_ptr[2]; VAR_0->decode_buf_ptr[2] = VAR_0->decode_buf_ptr[3]; VAR_0->decode_buf_ptr[3] = VAR_7; VAR_0->gain_now_ptr = &VAR_0->gain_now; VAR_0->gain_previous_ptr = &VAR_0->gain_previous; cook_imlt(VAR_0, VAR_0->decode_buf_ptr[0], VAR_0->mono_mdct_output,VAR_0->mlt_tmp); gain_compensate(VAR_0, VAR_0->mono_mdct_output, VAR_0->gain_now_ptr, VAR_0->gain_previous_ptr, VAR_0->previous_buffer_ptr[0]); VAR_7 = VAR_0->previous_buffer_ptr[0]; VAR_0->previous_buffer_ptr[0] = VAR_0->previous_buffer_ptr[1]; VAR_0->previous_buffer_ptr[1] = VAR_7; for (VAR_5=0 ; VAR_5<VAR_0->samples_per_frame ; VAR_5++){ VAR_6 = lrintf(VAR_0->mono_mdct_output[VAR_5]); if(VAR_6 < -32768) VAR_6 = -32768; else if(VAR_6 > 32767) VAR_6 = 32767; VAR_3[2*VAR_5] = VAR_6; } memcpy(&VAR_0->gain_now, &VAR_0->gain_previous, sizeof(COOKgain)); memcpy(&VAR_0->gain_previous, &VAR_0->gain_current, sizeof(COOKgain)); } else { mono_decode(VAR_0, VAR_0->decode_buf_ptr[0]); VAR_7 = VAR_0->decode_buf_ptr[1]; VAR_0->decode_buf_ptr[1] = VAR_0->decode_buf_ptr[0]; VAR_0->decode_buf_ptr[0] = VAR_7; VAR_0->gain_now_ptr = &VAR_0->gain_now; VAR_0->gain_previous_ptr = &VAR_0->gain_previous; cook_imlt(VAR_0, VAR_0->decode_buf_ptr[0], VAR_0->mono_mdct_output,VAR_0->mlt_tmp); gain_compensate(VAR_0, VAR_0->mono_mdct_output, VAR_0->gain_now_ptr, VAR_0->gain_previous_ptr, VAR_0->mono_previous_buffer1); for (VAR_5=0 ; VAR_5<VAR_0->samples_per_frame ; VAR_5++){ VAR_6 = lrintf(VAR_0->mono_mdct_output[VAR_5]); if(VAR_6 < -32768) VAR_6 = -32768; else if(VAR_6 > 32767) VAR_6 = 32767; VAR_3[VAR_5] = VAR_6; } memcpy(&VAR_0->gain_now, &VAR_0->gain_previous, sizeof(COOKgain)); memcpy(&VAR_0->gain_previous, &VAR_0->gain_current, sizeof(COOKgain)); } return VAR_0->samples_per_frame * sizeof(int16_t); }
[ "static int FUNC_0(COOKContext *VAR_0, uint8_t *VAR_1,\nint VAR_2, int16_t *VAR_3) {", "int VAR_4,VAR_5;", "int VAR_6;", "float* VAR_7;", "decode_bytes(VAR_1, VAR_0->decoded_bytes_buffer, VAR_2);", "init_get_bits(&VAR_0->gb, VAR_0->decoded_bytes_buffer, VAR_2*8);", "decode_gain_info(&VAR_0->gb, &VAR_0->gain_current);", "memcpy(&VAR_0->gain_copy, &VAR_0->gain_current ,sizeof(COOKgain));", "if(VAR_0->nb_channels==2 && VAR_0->joint_stereo==1){", "joint_decode(VAR_0, VAR_0->decode_buf_ptr[0], VAR_0->decode_buf_ptr[2]);", "VAR_7 = VAR_0->decode_buf_ptr[1];", "VAR_0->decode_buf_ptr[1] = VAR_0->decode_buf_ptr[0];", "VAR_0->decode_buf_ptr[0] = VAR_7;", "VAR_7 = VAR_0->decode_buf_ptr[3];", "VAR_0->decode_buf_ptr[3] = VAR_0->decode_buf_ptr[2];", "VAR_0->decode_buf_ptr[2] = VAR_7;", "VAR_0->gain_now_ptr = &VAR_0->gain_now;", "VAR_0->gain_previous_ptr = &VAR_0->gain_previous;", "for (VAR_4=0 ; VAR_4<VAR_0->nb_channels ; VAR_4++){", "cook_imlt(VAR_0, VAR_0->decode_buf_ptr[VAR_4*2], VAR_0->mono_mdct_output, VAR_0->mlt_tmp);", "gain_compensate(VAR_0, VAR_0->mono_mdct_output, VAR_0->gain_now_ptr,\nVAR_0->gain_previous_ptr, VAR_0->previous_buffer_ptr[0]);", "VAR_7 = VAR_0->previous_buffer_ptr[0];", "VAR_0->previous_buffer_ptr[0] = VAR_0->previous_buffer_ptr[1];", "VAR_0->previous_buffer_ptr[1] = VAR_7;", "for (VAR_5=0 ; VAR_5<VAR_0->samples_per_frame ; VAR_5++){", "VAR_6 = lrintf(VAR_0->mono_mdct_output[VAR_5]);", "if(VAR_6 < -32768) VAR_6 = -32768;", "else if(VAR_6 > 32767) VAR_6 = 32767;", "VAR_3[2*VAR_5+VAR_4] = VAR_6;", "}", "}", "memcpy(&VAR_0->gain_now, &VAR_0->gain_previous, sizeof(COOKgain));", "memcpy(&VAR_0->gain_previous, &VAR_0->gain_current, sizeof(COOKgain));", "} else if (VAR_0->nb_channels==2 && VAR_0->joint_stereo==0) {", "mono_decode(VAR_0, VAR_0->decode_buf_ptr[0]);", "VAR_7 = VAR_0->decode_buf_ptr[0];", "VAR_0->decode_buf_ptr[0] = VAR_0->decode_buf_ptr[1];", "VAR_0->decode_buf_ptr[1] = VAR_0->decode_buf_ptr[2];", "VAR_0->decode_buf_ptr[2] = VAR_0->decode_buf_ptr[3];", "VAR_0->decode_buf_ptr[3] = VAR_7;", "VAR_0->gain_now_ptr = &VAR_0->gain_now;", "VAR_0->gain_previous_ptr = &VAR_0->gain_previous;", "cook_imlt(VAR_0, VAR_0->decode_buf_ptr[0], VAR_0->mono_mdct_output,VAR_0->mlt_tmp);", "gain_compensate(VAR_0, VAR_0->mono_mdct_output, VAR_0->gain_now_ptr,\nVAR_0->gain_previous_ptr, VAR_0->previous_buffer_ptr[0]);", "VAR_7 = VAR_0->previous_buffer_ptr[0];", "VAR_0->previous_buffer_ptr[0] = VAR_0->previous_buffer_ptr[1];", "VAR_0->previous_buffer_ptr[1] = VAR_7;", "for (VAR_5=0 ; VAR_5<VAR_0->samples_per_frame ; VAR_5++){", "VAR_6 = lrintf(VAR_0->mono_mdct_output[VAR_5]);", "if(VAR_6 < -32768) VAR_6 = -32768;", "else if(VAR_6 > 32767) VAR_6 = 32767;", "VAR_3[2*VAR_5+1] = VAR_6;", "}", "init_get_bits(&VAR_0->gb, VAR_0->decoded_bytes_buffer, VAR_2*8+VAR_0->bits_per_subpacket);", "decode_gain_info(&VAR_0->gb, &VAR_0->gain_current);", "mono_decode(VAR_0, VAR_0->decode_buf_ptr[0]);", "VAR_7 = VAR_0->decode_buf_ptr[0];", "VAR_0->decode_buf_ptr[1] = VAR_0->decode_buf_ptr[2];", "VAR_0->decode_buf_ptr[2] = VAR_0->decode_buf_ptr[3];", "VAR_0->decode_buf_ptr[3] = VAR_7;", "VAR_0->gain_now_ptr = &VAR_0->gain_now;", "VAR_0->gain_previous_ptr = &VAR_0->gain_previous;", "cook_imlt(VAR_0, VAR_0->decode_buf_ptr[0], VAR_0->mono_mdct_output,VAR_0->mlt_tmp);", "gain_compensate(VAR_0, VAR_0->mono_mdct_output, VAR_0->gain_now_ptr, VAR_0->gain_previous_ptr, VAR_0->previous_buffer_ptr[0]);", "VAR_7 = VAR_0->previous_buffer_ptr[0];", "VAR_0->previous_buffer_ptr[0] = VAR_0->previous_buffer_ptr[1];", "VAR_0->previous_buffer_ptr[1] = VAR_7;", "for (VAR_5=0 ; VAR_5<VAR_0->samples_per_frame ; VAR_5++){", "VAR_6 = lrintf(VAR_0->mono_mdct_output[VAR_5]);", "if(VAR_6 < -32768) VAR_6 = -32768;", "else if(VAR_6 > 32767) VAR_6 = 32767;", "VAR_3[2*VAR_5] = VAR_6;", "}", "memcpy(&VAR_0->gain_now, &VAR_0->gain_previous, sizeof(COOKgain));", "memcpy(&VAR_0->gain_previous, &VAR_0->gain_current, sizeof(COOKgain));", "} else {", "mono_decode(VAR_0, VAR_0->decode_buf_ptr[0]);", "VAR_7 = VAR_0->decode_buf_ptr[1];", "VAR_0->decode_buf_ptr[1] = VAR_0->decode_buf_ptr[0];", "VAR_0->decode_buf_ptr[0] = VAR_7;", "VAR_0->gain_now_ptr = &VAR_0->gain_now;", "VAR_0->gain_previous_ptr = &VAR_0->gain_previous;", "cook_imlt(VAR_0, VAR_0->decode_buf_ptr[0], VAR_0->mono_mdct_output,VAR_0->mlt_tmp);", "gain_compensate(VAR_0, VAR_0->mono_mdct_output, VAR_0->gain_now_ptr,\nVAR_0->gain_previous_ptr, VAR_0->mono_previous_buffer1);", "for (VAR_5=0 ; VAR_5<VAR_0->samples_per_frame ; VAR_5++){", "VAR_6 = lrintf(VAR_0->mono_mdct_output[VAR_5]);", "if(VAR_6 < -32768) VAR_6 = -32768;", "else if(VAR_6 > 32767) VAR_6 = 32767;", "VAR_3[VAR_5] = VAR_6;", "}", "memcpy(&VAR_0->gain_now, &VAR_0->gain_previous, sizeof(COOKgain));", "memcpy(&VAR_0->gain_previous, &VAR_0->gain_current, sizeof(COOKgain));", "}", "return VAR_0->samples_per_frame * sizeof(int16_t);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 61 ], [ 63 ], [ 65 ], [ 69 ], [ 71, 73 ], [ 79 ], [ 81 ], [ 83 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 105 ], [ 107 ], [ 111 ], [ 115 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 131 ], [ 133 ], [ 137 ], [ 139, 141 ], [ 145 ], [ 147 ], [ 149 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 171 ], [ 173 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 189 ], [ 191 ], [ 195 ], [ 197 ], [ 203 ], [ 205 ], [ 207 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 229 ], [ 231 ], [ 235 ], [ 237 ], [ 243 ], [ 245 ], [ 247 ], [ 255 ], [ 257 ], [ 261 ], [ 263, 265 ], [ 271 ], [ 273 ], [ 275 ], [ 277 ], [ 279 ], [ 281 ], [ 283 ], [ 285 ], [ 287 ], [ 289 ], [ 291 ] ]
20,015
void ff_put_h264_qpel16_mc00_msa(uint8_t *dst, const uint8_t *src, ptrdiff_t stride) { copy_width16_msa(src, stride, dst, stride, 16); }
false
FFmpeg
0105ed551cb9610c62b6920a301125781e1161a0
void ff_put_h264_qpel16_mc00_msa(uint8_t *dst, const uint8_t *src, ptrdiff_t stride) { copy_width16_msa(src, stride, dst, stride, 16); }
{ "code": [], "line_no": [] }
void FUNC_0(uint8_t *VAR_0, const uint8_t *VAR_1, ptrdiff_t VAR_2) { copy_width16_msa(VAR_1, VAR_2, VAR_0, VAR_2, 16); }
[ "void FUNC_0(uint8_t *VAR_0, const uint8_t *VAR_1,\nptrdiff_t VAR_2)\n{", "copy_width16_msa(VAR_1, VAR_2, VAR_0, VAR_2, 16);", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ] ]
20,016
static int process_output_surface(AVCodecContext *avctx, AVPacket *pkt, NvencSurface *tmpoutsurf) { NvencContext *ctx = avctx->priv_data; NvencDynLoadFunctions *dl_fn = &ctx->nvenc_dload_funcs; NV_ENCODE_API_FUNCTION_LIST *p_nvenc = &dl_fn->nvenc_funcs; uint32_t slice_mode_data; uint32_t *slice_offsets = NULL; NV_ENC_LOCK_BITSTREAM lock_params = { 0 }; NVENCSTATUS nv_status; int res = 0; enum AVPictureType pict_type; switch (avctx->codec->id) { case AV_CODEC_ID_H264: slice_mode_data = ctx->encode_config.encodeCodecConfig.h264Config.sliceModeData; break; case AV_CODEC_ID_H265: slice_mode_data = ctx->encode_config.encodeCodecConfig.hevcConfig.sliceModeData; break; default: av_log(avctx, AV_LOG_ERROR, "Unknown codec name\n"); res = AVERROR(EINVAL); goto error; } slice_offsets = av_mallocz(slice_mode_data * sizeof(*slice_offsets)); if (!slice_offsets) { res = AVERROR(ENOMEM); goto error; } lock_params.version = NV_ENC_LOCK_BITSTREAM_VER; lock_params.doNotWait = 0; lock_params.outputBitstream = tmpoutsurf->output_surface; lock_params.sliceOffsets = slice_offsets; nv_status = p_nvenc->nvEncLockBitstream(ctx->nvencoder, &lock_params); if (nv_status != NV_ENC_SUCCESS) { res = nvenc_print_error(avctx, nv_status, "Failed locking bitstream buffer"); goto error; } if (res = ff_alloc_packet2(avctx, pkt, lock_params.bitstreamSizeInBytes,0)) { p_nvenc->nvEncUnlockBitstream(ctx->nvencoder, tmpoutsurf->output_surface); goto error; } memcpy(pkt->data, lock_params.bitstreamBufferPtr, lock_params.bitstreamSizeInBytes); nv_status = p_nvenc->nvEncUnlockBitstream(ctx->nvencoder, tmpoutsurf->output_surface); if (nv_status != NV_ENC_SUCCESS) nvenc_print_error(avctx, nv_status, "Failed unlocking bitstream buffer, expect the gates of mordor to open"); if (avctx->pix_fmt == AV_PIX_FMT_CUDA || avctx->pix_fmt == AV_PIX_FMT_D3D11) { ctx->registered_frames[tmpoutsurf->reg_idx].mapped -= 1; if (ctx->registered_frames[tmpoutsurf->reg_idx].mapped == 0) { p_nvenc->nvEncUnmapInputResource(ctx->nvencoder, ctx->registered_frames[tmpoutsurf->reg_idx].in_map.mappedResource); p_nvenc->nvEncUnregisterResource(ctx->nvencoder, ctx->registered_frames[tmpoutsurf->reg_idx].regptr); ctx->registered_frames[tmpoutsurf->reg_idx].regptr = NULL; } else if (ctx->registered_frames[tmpoutsurf->reg_idx].mapped < 0) { res = AVERROR_BUG; goto error; } av_frame_unref(tmpoutsurf->in_ref); tmpoutsurf->input_surface = NULL; } switch (lock_params.pictureType) { case NV_ENC_PIC_TYPE_IDR: pkt->flags |= AV_PKT_FLAG_KEY; case NV_ENC_PIC_TYPE_I: pict_type = AV_PICTURE_TYPE_I; break; case NV_ENC_PIC_TYPE_P: pict_type = AV_PICTURE_TYPE_P; break; case NV_ENC_PIC_TYPE_B: pict_type = AV_PICTURE_TYPE_B; break; case NV_ENC_PIC_TYPE_BI: pict_type = AV_PICTURE_TYPE_BI; break; default: av_log(avctx, AV_LOG_ERROR, "Unknown picture type encountered, expect the output to be broken.\n"); av_log(avctx, AV_LOG_ERROR, "Please report this error and include as much information on how to reproduce it as possible.\n"); res = AVERROR_EXTERNAL; goto error; } #if FF_API_CODED_FRAME FF_DISABLE_DEPRECATION_WARNINGS avctx->coded_frame->pict_type = pict_type; FF_ENABLE_DEPRECATION_WARNINGS #endif ff_side_data_set_encoder_stats(pkt, (lock_params.frameAvgQP - 1) * FF_QP2LAMBDA, NULL, 0, pict_type); res = nvenc_set_timestamp(avctx, &lock_params, pkt); if (res < 0) goto error2; av_free(slice_offsets); return 0; error: timestamp_queue_dequeue(ctx->timestamp_list); error2: av_free(slice_offsets); return res; }
false
FFmpeg
48e52e4edd12adbc36eee0eebe1b97ffe0255be3
static int process_output_surface(AVCodecContext *avctx, AVPacket *pkt, NvencSurface *tmpoutsurf) { NvencContext *ctx = avctx->priv_data; NvencDynLoadFunctions *dl_fn = &ctx->nvenc_dload_funcs; NV_ENCODE_API_FUNCTION_LIST *p_nvenc = &dl_fn->nvenc_funcs; uint32_t slice_mode_data; uint32_t *slice_offsets = NULL; NV_ENC_LOCK_BITSTREAM lock_params = { 0 }; NVENCSTATUS nv_status; int res = 0; enum AVPictureType pict_type; switch (avctx->codec->id) { case AV_CODEC_ID_H264: slice_mode_data = ctx->encode_config.encodeCodecConfig.h264Config.sliceModeData; break; case AV_CODEC_ID_H265: slice_mode_data = ctx->encode_config.encodeCodecConfig.hevcConfig.sliceModeData; break; default: av_log(avctx, AV_LOG_ERROR, "Unknown codec name\n"); res = AVERROR(EINVAL); goto error; } slice_offsets = av_mallocz(slice_mode_data * sizeof(*slice_offsets)); if (!slice_offsets) { res = AVERROR(ENOMEM); goto error; } lock_params.version = NV_ENC_LOCK_BITSTREAM_VER; lock_params.doNotWait = 0; lock_params.outputBitstream = tmpoutsurf->output_surface; lock_params.sliceOffsets = slice_offsets; nv_status = p_nvenc->nvEncLockBitstream(ctx->nvencoder, &lock_params); if (nv_status != NV_ENC_SUCCESS) { res = nvenc_print_error(avctx, nv_status, "Failed locking bitstream buffer"); goto error; } if (res = ff_alloc_packet2(avctx, pkt, lock_params.bitstreamSizeInBytes,0)) { p_nvenc->nvEncUnlockBitstream(ctx->nvencoder, tmpoutsurf->output_surface); goto error; } memcpy(pkt->data, lock_params.bitstreamBufferPtr, lock_params.bitstreamSizeInBytes); nv_status = p_nvenc->nvEncUnlockBitstream(ctx->nvencoder, tmpoutsurf->output_surface); if (nv_status != NV_ENC_SUCCESS) nvenc_print_error(avctx, nv_status, "Failed unlocking bitstream buffer, expect the gates of mordor to open"); if (avctx->pix_fmt == AV_PIX_FMT_CUDA || avctx->pix_fmt == AV_PIX_FMT_D3D11) { ctx->registered_frames[tmpoutsurf->reg_idx].mapped -= 1; if (ctx->registered_frames[tmpoutsurf->reg_idx].mapped == 0) { p_nvenc->nvEncUnmapInputResource(ctx->nvencoder, ctx->registered_frames[tmpoutsurf->reg_idx].in_map.mappedResource); p_nvenc->nvEncUnregisterResource(ctx->nvencoder, ctx->registered_frames[tmpoutsurf->reg_idx].regptr); ctx->registered_frames[tmpoutsurf->reg_idx].regptr = NULL; } else if (ctx->registered_frames[tmpoutsurf->reg_idx].mapped < 0) { res = AVERROR_BUG; goto error; } av_frame_unref(tmpoutsurf->in_ref); tmpoutsurf->input_surface = NULL; } switch (lock_params.pictureType) { case NV_ENC_PIC_TYPE_IDR: pkt->flags |= AV_PKT_FLAG_KEY; case NV_ENC_PIC_TYPE_I: pict_type = AV_PICTURE_TYPE_I; break; case NV_ENC_PIC_TYPE_P: pict_type = AV_PICTURE_TYPE_P; break; case NV_ENC_PIC_TYPE_B: pict_type = AV_PICTURE_TYPE_B; break; case NV_ENC_PIC_TYPE_BI: pict_type = AV_PICTURE_TYPE_BI; break; default: av_log(avctx, AV_LOG_ERROR, "Unknown picture type encountered, expect the output to be broken.\n"); av_log(avctx, AV_LOG_ERROR, "Please report this error and include as much information on how to reproduce it as possible.\n"); res = AVERROR_EXTERNAL; goto error; } #if FF_API_CODED_FRAME FF_DISABLE_DEPRECATION_WARNINGS avctx->coded_frame->pict_type = pict_type; FF_ENABLE_DEPRECATION_WARNINGS #endif ff_side_data_set_encoder_stats(pkt, (lock_params.frameAvgQP - 1) * FF_QP2LAMBDA, NULL, 0, pict_type); res = nvenc_set_timestamp(avctx, &lock_params, pkt); if (res < 0) goto error2; av_free(slice_offsets); return 0; error: timestamp_queue_dequeue(ctx->timestamp_list); error2: av_free(slice_offsets); return res; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecContext *VAR_0, AVPacket *VAR_1, NvencSurface *VAR_2) { NvencContext *ctx = VAR_0->priv_data; NvencDynLoadFunctions *dl_fn = &ctx->nvenc_dload_funcs; NV_ENCODE_API_FUNCTION_LIST *p_nvenc = &dl_fn->nvenc_funcs; uint32_t slice_mode_data; uint32_t *slice_offsets = NULL; NV_ENC_LOCK_BITSTREAM lock_params = { 0 }; NVENCSTATUS nv_status; int VAR_3 = 0; enum AVPictureType VAR_4; switch (VAR_0->codec->id) { case AV_CODEC_ID_H264: slice_mode_data = ctx->encode_config.encodeCodecConfig.h264Config.sliceModeData; break; case AV_CODEC_ID_H265: slice_mode_data = ctx->encode_config.encodeCodecConfig.hevcConfig.sliceModeData; break; default: av_log(VAR_0, AV_LOG_ERROR, "Unknown codec name\n"); VAR_3 = AVERROR(EINVAL); goto error; } slice_offsets = av_mallocz(slice_mode_data * sizeof(*slice_offsets)); if (!slice_offsets) { VAR_3 = AVERROR(ENOMEM); goto error; } lock_params.version = NV_ENC_LOCK_BITSTREAM_VER; lock_params.doNotWait = 0; lock_params.outputBitstream = VAR_2->output_surface; lock_params.sliceOffsets = slice_offsets; nv_status = p_nvenc->nvEncLockBitstream(ctx->nvencoder, &lock_params); if (nv_status != NV_ENC_SUCCESS) { VAR_3 = nvenc_print_error(VAR_0, nv_status, "Failed locking bitstream buffer"); goto error; } if (VAR_3 = ff_alloc_packet2(VAR_0, VAR_1, lock_params.bitstreamSizeInBytes,0)) { p_nvenc->nvEncUnlockBitstream(ctx->nvencoder, VAR_2->output_surface); goto error; } memcpy(VAR_1->data, lock_params.bitstreamBufferPtr, lock_params.bitstreamSizeInBytes); nv_status = p_nvenc->nvEncUnlockBitstream(ctx->nvencoder, VAR_2->output_surface); if (nv_status != NV_ENC_SUCCESS) nvenc_print_error(VAR_0, nv_status, "Failed unlocking bitstream buffer, expect the gates of mordor to open"); if (VAR_0->pix_fmt == AV_PIX_FMT_CUDA || VAR_0->pix_fmt == AV_PIX_FMT_D3D11) { ctx->registered_frames[VAR_2->reg_idx].mapped -= 1; if (ctx->registered_frames[VAR_2->reg_idx].mapped == 0) { p_nvenc->nvEncUnmapInputResource(ctx->nvencoder, ctx->registered_frames[VAR_2->reg_idx].in_map.mappedResource); p_nvenc->nvEncUnregisterResource(ctx->nvencoder, ctx->registered_frames[VAR_2->reg_idx].regptr); ctx->registered_frames[VAR_2->reg_idx].regptr = NULL; } else if (ctx->registered_frames[VAR_2->reg_idx].mapped < 0) { VAR_3 = AVERROR_BUG; goto error; } av_frame_unref(VAR_2->in_ref); VAR_2->input_surface = NULL; } switch (lock_params.pictureType) { case NV_ENC_PIC_TYPE_IDR: VAR_1->flags |= AV_PKT_FLAG_KEY; case NV_ENC_PIC_TYPE_I: VAR_4 = AV_PICTURE_TYPE_I; break; case NV_ENC_PIC_TYPE_P: VAR_4 = AV_PICTURE_TYPE_P; break; case NV_ENC_PIC_TYPE_B: VAR_4 = AV_PICTURE_TYPE_B; break; case NV_ENC_PIC_TYPE_BI: VAR_4 = AV_PICTURE_TYPE_BI; break; default: av_log(VAR_0, AV_LOG_ERROR, "Unknown picture type encountered, expect the output to be broken.\n"); av_log(VAR_0, AV_LOG_ERROR, "Please report this error and include as much information on how to reproduce it as possible.\n"); VAR_3 = AVERROR_EXTERNAL; goto error; } #if FF_API_CODED_FRAME FF_DISABLE_DEPRECATION_WARNINGS VAR_0->coded_frame->VAR_4 = VAR_4; FF_ENABLE_DEPRECATION_WARNINGS #endif ff_side_data_set_encoder_stats(VAR_1, (lock_params.frameAvgQP - 1) * FF_QP2LAMBDA, NULL, 0, VAR_4); VAR_3 = nvenc_set_timestamp(VAR_0, &lock_params, VAR_1); if (VAR_3 < 0) goto error2; av_free(slice_offsets); return 0; error: timestamp_queue_dequeue(ctx->timestamp_list); error2: av_free(slice_offsets); return VAR_3; }
[ "static int FUNC_0(AVCodecContext *VAR_0, AVPacket *VAR_1, NvencSurface *VAR_2)\n{", "NvencContext *ctx = VAR_0->priv_data;", "NvencDynLoadFunctions *dl_fn = &ctx->nvenc_dload_funcs;", "NV_ENCODE_API_FUNCTION_LIST *p_nvenc = &dl_fn->nvenc_funcs;", "uint32_t slice_mode_data;", "uint32_t *slice_offsets = NULL;", "NV_ENC_LOCK_BITSTREAM lock_params = { 0 };", "NVENCSTATUS nv_status;", "int VAR_3 = 0;", "enum AVPictureType VAR_4;", "switch (VAR_0->codec->id) {", "case AV_CODEC_ID_H264:\nslice_mode_data = ctx->encode_config.encodeCodecConfig.h264Config.sliceModeData;", "break;", "case AV_CODEC_ID_H265:\nslice_mode_data = ctx->encode_config.encodeCodecConfig.hevcConfig.sliceModeData;", "break;", "default:\nav_log(VAR_0, AV_LOG_ERROR, \"Unknown codec name\\n\");", "VAR_3 = AVERROR(EINVAL);", "goto error;", "}", "slice_offsets = av_mallocz(slice_mode_data * sizeof(*slice_offsets));", "if (!slice_offsets) {", "VAR_3 = AVERROR(ENOMEM);", "goto error;", "}", "lock_params.version = NV_ENC_LOCK_BITSTREAM_VER;", "lock_params.doNotWait = 0;", "lock_params.outputBitstream = VAR_2->output_surface;", "lock_params.sliceOffsets = slice_offsets;", "nv_status = p_nvenc->nvEncLockBitstream(ctx->nvencoder, &lock_params);", "if (nv_status != NV_ENC_SUCCESS) {", "VAR_3 = nvenc_print_error(VAR_0, nv_status, \"Failed locking bitstream buffer\");", "goto error;", "}", "if (VAR_3 = ff_alloc_packet2(VAR_0, VAR_1, lock_params.bitstreamSizeInBytes,0)) {", "p_nvenc->nvEncUnlockBitstream(ctx->nvencoder, VAR_2->output_surface);", "goto error;", "}", "memcpy(VAR_1->data, lock_params.bitstreamBufferPtr, lock_params.bitstreamSizeInBytes);", "nv_status = p_nvenc->nvEncUnlockBitstream(ctx->nvencoder, VAR_2->output_surface);", "if (nv_status != NV_ENC_SUCCESS)\nnvenc_print_error(VAR_0, nv_status, \"Failed unlocking bitstream buffer, expect the gates of mordor to open\");", "if (VAR_0->pix_fmt == AV_PIX_FMT_CUDA || VAR_0->pix_fmt == AV_PIX_FMT_D3D11) {", "ctx->registered_frames[VAR_2->reg_idx].mapped -= 1;", "if (ctx->registered_frames[VAR_2->reg_idx].mapped == 0) {", "p_nvenc->nvEncUnmapInputResource(ctx->nvencoder, ctx->registered_frames[VAR_2->reg_idx].in_map.mappedResource);", "p_nvenc->nvEncUnregisterResource(ctx->nvencoder, ctx->registered_frames[VAR_2->reg_idx].regptr);", "ctx->registered_frames[VAR_2->reg_idx].regptr = NULL;", "} else if (ctx->registered_frames[VAR_2->reg_idx].mapped < 0) {", "VAR_3 = AVERROR_BUG;", "goto error;", "}", "av_frame_unref(VAR_2->in_ref);", "VAR_2->input_surface = NULL;", "}", "switch (lock_params.pictureType) {", "case NV_ENC_PIC_TYPE_IDR:\nVAR_1->flags |= AV_PKT_FLAG_KEY;", "case NV_ENC_PIC_TYPE_I:\nVAR_4 = AV_PICTURE_TYPE_I;", "break;", "case NV_ENC_PIC_TYPE_P:\nVAR_4 = AV_PICTURE_TYPE_P;", "break;", "case NV_ENC_PIC_TYPE_B:\nVAR_4 = AV_PICTURE_TYPE_B;", "break;", "case NV_ENC_PIC_TYPE_BI:\nVAR_4 = AV_PICTURE_TYPE_BI;", "break;", "default:\nav_log(VAR_0, AV_LOG_ERROR, \"Unknown picture type encountered, expect the output to be broken.\\n\");", "av_log(VAR_0, AV_LOG_ERROR, \"Please report this error and include as much information on how to reproduce it as possible.\\n\");", "VAR_3 = AVERROR_EXTERNAL;", "goto error;", "}", "#if FF_API_CODED_FRAME\nFF_DISABLE_DEPRECATION_WARNINGS\nVAR_0->coded_frame->VAR_4 = VAR_4;", "FF_ENABLE_DEPRECATION_WARNINGS\n#endif\nff_side_data_set_encoder_stats(VAR_1,\n(lock_params.frameAvgQP - 1) * FF_QP2LAMBDA, NULL, 0, VAR_4);", "VAR_3 = nvenc_set_timestamp(VAR_0, &lock_params, VAR_1);", "if (VAR_3 < 0)\ngoto error2;", "av_free(slice_offsets);", "return 0;", "error:\ntimestamp_queue_dequeue(ctx->timestamp_list);", "error2:\nav_free(slice_offsets);", "return VAR_3;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 29 ], [ 31, 33 ], [ 35 ], [ 37, 39 ], [ 41 ], [ 43, 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 67 ], [ 71 ], [ 73 ], [ 75 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 101 ], [ 105 ], [ 107, 109 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 137 ], [ 141 ], [ 143 ], [ 147 ], [ 149, 151 ], [ 153, 155 ], [ 157 ], [ 159, 161 ], [ 163 ], [ 165, 167 ], [ 169 ], [ 171, 173 ], [ 175 ], [ 177, 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 191, 193, 195 ], [ 197, 199, 203, 205 ], [ 209 ], [ 211, 213 ], [ 217 ], [ 221 ], [ 225, 227 ], [ 231, 233 ], [ 237 ], [ 239 ] ]
20,018
static int img_read_header(AVFormatContext *s1) { VideoDemuxData *s = s1->priv_data; int first_index, last_index; AVStream *st; enum AVPixelFormat pix_fmt = AV_PIX_FMT_NONE; s1->ctx_flags |= AVFMTCTX_NOHEADER; st = avformat_new_stream(s1, NULL); if (!st) { return AVERROR(ENOMEM); } if (s->pixel_format && (pix_fmt = av_get_pix_fmt(s->pixel_format)) == AV_PIX_FMT_NONE) { av_log(s1, AV_LOG_ERROR, "No such pixel format: %s.\n", s->pixel_format); return AVERROR(EINVAL); } av_strlcpy(s->path, s1->filename, sizeof(s->path)); s->img_number = 0; s->img_count = 0; /* find format */ if (s1->iformat->flags & AVFMT_NOFILE) s->is_pipe = 0; else { s->is_pipe = 1; st->need_parsing = AVSTREAM_PARSE_FULL; } if (s->ts_from_file) avpriv_set_pts_info(st, 60, 1, 1); else avpriv_set_pts_info(st, 60, s->framerate.den, s->framerate.num); if (s->width && s->height) { st->codec->width = s->width; st->codec->height = s->height; } if (!s->is_pipe) { if (s->pattern_type == PT_GLOB_SEQUENCE) { s->use_glob = is_glob(s->path); if (s->use_glob) { char *p = s->path, *q, *dup; int gerr; av_log(s1, AV_LOG_WARNING, "Pattern type 'glob_sequence' is deprecated: " "use pattern_type 'glob' instead\n"); #if HAVE_GLOB dup = q = av_strdup(p); while (*q) { /* Do we have room for the next char and a \ insertion? */ if ((p - s->path) >= (sizeof(s->path) - 2)) break; if (*q == '%' && strspn(q + 1, "%*?[]{}")) ++q; else if (strspn(q, "\\*?[]{}")) *p++ = '\\'; *p++ = *q++; } *p = 0; av_free(dup); gerr = glob(s->path, GLOB_NOCHECK|GLOB_BRACE|GLOB_NOMAGIC, NULL, &s->globstate); if (gerr != 0) { return AVERROR(ENOENT); } first_index = 0; last_index = s->globstate.gl_pathc - 1; #endif } } if ((s->pattern_type == PT_GLOB_SEQUENCE && !s->use_glob) || s->pattern_type == PT_SEQUENCE) { if (find_image_range(&first_index, &last_index, s->path, s->start_number, s->start_number_range) < 0) { av_log(s1, AV_LOG_ERROR, "Could find no file with with path '%s' and index in the range %d-%d\n", s->path, s->start_number, s->start_number + s->start_number_range - 1); return AVERROR(ENOENT); } } else if (s->pattern_type == PT_GLOB) { #if HAVE_GLOB int gerr; gerr = glob(s->path, GLOB_NOCHECK|GLOB_BRACE|GLOB_NOMAGIC, NULL, &s->globstate); if (gerr != 0) { return AVERROR(ENOENT); } first_index = 0; last_index = s->globstate.gl_pathc - 1; s->use_glob = 1; #else av_log(s1, AV_LOG_ERROR, "Pattern type 'glob' was selected but globbing " "is not supported by this libavformat build\n"); return AVERROR(ENOSYS); #endif } else if (s->pattern_type != PT_GLOB_SEQUENCE) { av_log(s1, AV_LOG_ERROR, "Unknown value '%d' for pattern_type option\n", s->pattern_type); return AVERROR(EINVAL); } s->img_first = first_index; s->img_last = last_index; s->img_number = first_index; /* compute duration */ st->start_time = 0; st->duration = last_index - first_index + 1; } if (s1->video_codec_id) { st->codec->codec_type = AVMEDIA_TYPE_VIDEO; st->codec->codec_id = s1->video_codec_id; } else if (s1->audio_codec_id) { st->codec->codec_type = AVMEDIA_TYPE_AUDIO; st->codec->codec_id = s1->audio_codec_id; } else { const char *str = strrchr(s->path, '.'); s->split_planes = str && !av_strcasecmp(str + 1, "y"); st->codec->codec_type = AVMEDIA_TYPE_VIDEO; st->codec->codec_id = ff_guess_image2_codec(s->path); if (st->codec->codec_id == AV_CODEC_ID_LJPEG) st->codec->codec_id = AV_CODEC_ID_MJPEG; } if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO && pix_fmt != AV_PIX_FMT_NONE) st->codec->pix_fmt = pix_fmt; return 0; }
false
FFmpeg
a753776ff5d85994952f0abcb77fa49faf76b475
static int img_read_header(AVFormatContext *s1) { VideoDemuxData *s = s1->priv_data; int first_index, last_index; AVStream *st; enum AVPixelFormat pix_fmt = AV_PIX_FMT_NONE; s1->ctx_flags |= AVFMTCTX_NOHEADER; st = avformat_new_stream(s1, NULL); if (!st) { return AVERROR(ENOMEM); } if (s->pixel_format && (pix_fmt = av_get_pix_fmt(s->pixel_format)) == AV_PIX_FMT_NONE) { av_log(s1, AV_LOG_ERROR, "No such pixel format: %s.\n", s->pixel_format); return AVERROR(EINVAL); } av_strlcpy(s->path, s1->filename, sizeof(s->path)); s->img_number = 0; s->img_count = 0; if (s1->iformat->flags & AVFMT_NOFILE) s->is_pipe = 0; else { s->is_pipe = 1; st->need_parsing = AVSTREAM_PARSE_FULL; } if (s->ts_from_file) avpriv_set_pts_info(st, 60, 1, 1); else avpriv_set_pts_info(st, 60, s->framerate.den, s->framerate.num); if (s->width && s->height) { st->codec->width = s->width; st->codec->height = s->height; } if (!s->is_pipe) { if (s->pattern_type == PT_GLOB_SEQUENCE) { s->use_glob = is_glob(s->path); if (s->use_glob) { char *p = s->path, *q, *dup; int gerr; av_log(s1, AV_LOG_WARNING, "Pattern type 'glob_sequence' is deprecated: " "use pattern_type 'glob' instead\n"); #if HAVE_GLOB dup = q = av_strdup(p); while (*q) { if ((p - s->path) >= (sizeof(s->path) - 2)) break; if (*q == '%' && strspn(q + 1, "%*?[]{}")) ++q; else if (strspn(q, "\\*?[]{}")) *p++ = '\\'; *p++ = *q++; } *p = 0; av_free(dup); gerr = glob(s->path, GLOB_NOCHECK|GLOB_BRACE|GLOB_NOMAGIC, NULL, &s->globstate); if (gerr != 0) { return AVERROR(ENOENT); } first_index = 0; last_index = s->globstate.gl_pathc - 1; #endif } } if ((s->pattern_type == PT_GLOB_SEQUENCE && !s->use_glob) || s->pattern_type == PT_SEQUENCE) { if (find_image_range(&first_index, &last_index, s->path, s->start_number, s->start_number_range) < 0) { av_log(s1, AV_LOG_ERROR, "Could find no file with with path '%s' and index in the range %d-%d\n", s->path, s->start_number, s->start_number + s->start_number_range - 1); return AVERROR(ENOENT); } } else if (s->pattern_type == PT_GLOB) { #if HAVE_GLOB int gerr; gerr = glob(s->path, GLOB_NOCHECK|GLOB_BRACE|GLOB_NOMAGIC, NULL, &s->globstate); if (gerr != 0) { return AVERROR(ENOENT); } first_index = 0; last_index = s->globstate.gl_pathc - 1; s->use_glob = 1; #else av_log(s1, AV_LOG_ERROR, "Pattern type 'glob' was selected but globbing " "is not supported by this libavformat build\n"); return AVERROR(ENOSYS); #endif } else if (s->pattern_type != PT_GLOB_SEQUENCE) { av_log(s1, AV_LOG_ERROR, "Unknown value '%d' for pattern_type option\n", s->pattern_type); return AVERROR(EINVAL); } s->img_first = first_index; s->img_last = last_index; s->img_number = first_index; st->start_time = 0; st->duration = last_index - first_index + 1; } if (s1->video_codec_id) { st->codec->codec_type = AVMEDIA_TYPE_VIDEO; st->codec->codec_id = s1->video_codec_id; } else if (s1->audio_codec_id) { st->codec->codec_type = AVMEDIA_TYPE_AUDIO; st->codec->codec_id = s1->audio_codec_id; } else { const char *str = strrchr(s->path, '.'); s->split_planes = str && !av_strcasecmp(str + 1, "y"); st->codec->codec_type = AVMEDIA_TYPE_VIDEO; st->codec->codec_id = ff_guess_image2_codec(s->path); if (st->codec->codec_id == AV_CODEC_ID_LJPEG) st->codec->codec_id = AV_CODEC_ID_MJPEG; } if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO && pix_fmt != AV_PIX_FMT_NONE) st->codec->pix_fmt = pix_fmt; return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVFormatContext *VAR_0) { VideoDemuxData *s = VAR_0->priv_data; int VAR_1, VAR_2; AVStream *st; enum AVPixelFormat VAR_3 = AV_PIX_FMT_NONE; VAR_0->ctx_flags |= AVFMTCTX_NOHEADER; st = avformat_new_stream(VAR_0, NULL); if (!st) { return AVERROR(ENOMEM); } if (s->pixel_format && (VAR_3 = av_get_pix_fmt(s->pixel_format)) == AV_PIX_FMT_NONE) { av_log(VAR_0, AV_LOG_ERROR, "No such pixel format: %s.\n", s->pixel_format); return AVERROR(EINVAL); } av_strlcpy(s->path, VAR_0->filename, sizeof(s->path)); s->img_number = 0; s->img_count = 0; if (VAR_0->iformat->flags & AVFMT_NOFILE) s->is_pipe = 0; else { s->is_pipe = 1; st->need_parsing = AVSTREAM_PARSE_FULL; } if (s->ts_from_file) avpriv_set_pts_info(st, 60, 1, 1); else avpriv_set_pts_info(st, 60, s->framerate.den, s->framerate.num); if (s->width && s->height) { st->codec->width = s->width; st->codec->height = s->height; } if (!s->is_pipe) { if (s->pattern_type == PT_GLOB_SEQUENCE) { s->use_glob = is_glob(s->path); if (s->use_glob) { char *VAR_4 = s->path, *VAR_5, *VAR_6; int VAR_7; av_log(VAR_0, AV_LOG_WARNING, "Pattern type 'glob_sequence' is deprecated: " "use pattern_type 'glob' instead\n"); #if HAVE_GLOB VAR_6 = VAR_5 = av_strdup(VAR_4); while (*VAR_5) { if ((VAR_4 - s->path) >= (sizeof(s->path) - 2)) break; if (*VAR_5 == '%' && strspn(VAR_5 + 1, "%*?[]{}")) ++VAR_5; else if (strspn(VAR_5, "\\*?[]{}")) *VAR_4++ = '\\'; *VAR_4++ = *VAR_5++; } *VAR_4 = 0; av_free(VAR_6); VAR_7 = glob(s->path, GLOB_NOCHECK|GLOB_BRACE|GLOB_NOMAGIC, NULL, &s->globstate); if (VAR_7 != 0) { return AVERROR(ENOENT); } VAR_1 = 0; VAR_2 = s->globstate.gl_pathc - 1; #endif } } if ((s->pattern_type == PT_GLOB_SEQUENCE && !s->use_glob) || s->pattern_type == PT_SEQUENCE) { if (find_image_range(&VAR_1, &VAR_2, s->path, s->start_number, s->start_number_range) < 0) { av_log(VAR_0, AV_LOG_ERROR, "Could find no file with with path '%s' and index in the range %d-%d\n", s->path, s->start_number, s->start_number + s->start_number_range - 1); return AVERROR(ENOENT); } } else if (s->pattern_type == PT_GLOB) { #if HAVE_GLOB int VAR_7; VAR_7 = glob(s->path, GLOB_NOCHECK|GLOB_BRACE|GLOB_NOMAGIC, NULL, &s->globstate); if (VAR_7 != 0) { return AVERROR(ENOENT); } VAR_1 = 0; VAR_2 = s->globstate.gl_pathc - 1; s->use_glob = 1; #else av_log(VAR_0, AV_LOG_ERROR, "Pattern type 'glob' was selected but globbing " "is not supported by this libavformat build\n"); return AVERROR(ENOSYS); #endif } else if (s->pattern_type != PT_GLOB_SEQUENCE) { av_log(VAR_0, AV_LOG_ERROR, "Unknown value '%d' for pattern_type option\n", s->pattern_type); return AVERROR(EINVAL); } s->img_first = VAR_1; s->img_last = VAR_2; s->img_number = VAR_1; st->start_time = 0; st->duration = VAR_2 - VAR_1 + 1; } if (VAR_0->video_codec_id) { st->codec->codec_type = AVMEDIA_TYPE_VIDEO; st->codec->codec_id = VAR_0->video_codec_id; } else if (VAR_0->audio_codec_id) { st->codec->codec_type = AVMEDIA_TYPE_AUDIO; st->codec->codec_id = VAR_0->audio_codec_id; } else { const char *VAR_8 = strrchr(s->path, '.'); s->split_planes = VAR_8 && !av_strcasecmp(VAR_8 + 1, "y"); st->codec->codec_type = AVMEDIA_TYPE_VIDEO; st->codec->codec_id = ff_guess_image2_codec(s->path); if (st->codec->codec_id == AV_CODEC_ID_LJPEG) st->codec->codec_id = AV_CODEC_ID_MJPEG; } if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO && VAR_3 != AV_PIX_FMT_NONE) st->codec->VAR_3 = VAR_3; return 0; }
[ "static int FUNC_0(AVFormatContext *VAR_0)\n{", "VideoDemuxData *s = VAR_0->priv_data;", "int VAR_1, VAR_2;", "AVStream *st;", "enum AVPixelFormat VAR_3 = AV_PIX_FMT_NONE;", "VAR_0->ctx_flags |= AVFMTCTX_NOHEADER;", "st = avformat_new_stream(VAR_0, NULL);", "if (!st) {", "return AVERROR(ENOMEM);", "}", "if (s->pixel_format &&\n(VAR_3 = av_get_pix_fmt(s->pixel_format)) == AV_PIX_FMT_NONE) {", "av_log(VAR_0, AV_LOG_ERROR, \"No such pixel format: %s.\\n\",\ns->pixel_format);", "return AVERROR(EINVAL);", "}", "av_strlcpy(s->path, VAR_0->filename, sizeof(s->path));", "s->img_number = 0;", "s->img_count = 0;", "if (VAR_0->iformat->flags & AVFMT_NOFILE)\ns->is_pipe = 0;", "else {", "s->is_pipe = 1;", "st->need_parsing = AVSTREAM_PARSE_FULL;", "}", "if (s->ts_from_file)\navpriv_set_pts_info(st, 60, 1, 1);", "else\navpriv_set_pts_info(st, 60, s->framerate.den, s->framerate.num);", "if (s->width && s->height) {", "st->codec->width = s->width;", "st->codec->height = s->height;", "}", "if (!s->is_pipe) {", "if (s->pattern_type == PT_GLOB_SEQUENCE) {", "s->use_glob = is_glob(s->path);", "if (s->use_glob) {", "char *VAR_4 = s->path, *VAR_5, *VAR_6;", "int VAR_7;", "av_log(VAR_0, AV_LOG_WARNING, \"Pattern type 'glob_sequence' is deprecated: \"\n\"use pattern_type 'glob' instead\\n\");", "#if HAVE_GLOB\nVAR_6 = VAR_5 = av_strdup(VAR_4);", "while (*VAR_5) {", "if ((VAR_4 - s->path) >= (sizeof(s->path) - 2))\nbreak;", "if (*VAR_5 == '%' && strspn(VAR_5 + 1, \"%*?[]{}\"))", "++VAR_5;", "else if (strspn(VAR_5, \"\\\\*?[]{}\"))", "*VAR_4++ = '\\\\';", "*VAR_4++ = *VAR_5++;", "}", "*VAR_4 = 0;", "av_free(VAR_6);", "VAR_7 = glob(s->path, GLOB_NOCHECK|GLOB_BRACE|GLOB_NOMAGIC, NULL, &s->globstate);", "if (VAR_7 != 0) {", "return AVERROR(ENOENT);", "}", "VAR_1 = 0;", "VAR_2 = s->globstate.gl_pathc - 1;", "#endif\n}", "}", "if ((s->pattern_type == PT_GLOB_SEQUENCE && !s->use_glob) || s->pattern_type == PT_SEQUENCE) {", "if (find_image_range(&VAR_1, &VAR_2, s->path,\ns->start_number, s->start_number_range) < 0) {", "av_log(VAR_0, AV_LOG_ERROR,\n\"Could find no file with with path '%s' and index in the range %d-%d\\n\",\ns->path, s->start_number, s->start_number + s->start_number_range - 1);", "return AVERROR(ENOENT);", "}", "} else if (s->pattern_type == PT_GLOB) {", "#if HAVE_GLOB\nint VAR_7;", "VAR_7 = glob(s->path, GLOB_NOCHECK|GLOB_BRACE|GLOB_NOMAGIC, NULL, &s->globstate);", "if (VAR_7 != 0) {", "return AVERROR(ENOENT);", "}", "VAR_1 = 0;", "VAR_2 = s->globstate.gl_pathc - 1;", "s->use_glob = 1;", "#else\nav_log(VAR_0, AV_LOG_ERROR,\n\"Pattern type 'glob' was selected but globbing \"\n\"is not supported by this libavformat build\\n\");", "return AVERROR(ENOSYS);", "#endif\n} else if (s->pattern_type != PT_GLOB_SEQUENCE) {", "av_log(VAR_0, AV_LOG_ERROR,\n\"Unknown value '%d' for pattern_type option\\n\", s->pattern_type);", "return AVERROR(EINVAL);", "}", "s->img_first = VAR_1;", "s->img_last = VAR_2;", "s->img_number = VAR_1;", "st->start_time = 0;", "st->duration = VAR_2 - VAR_1 + 1;", "}", "if (VAR_0->video_codec_id) {", "st->codec->codec_type = AVMEDIA_TYPE_VIDEO;", "st->codec->codec_id = VAR_0->video_codec_id;", "} else if (VAR_0->audio_codec_id) {", "st->codec->codec_type = AVMEDIA_TYPE_AUDIO;", "st->codec->codec_id = VAR_0->audio_codec_id;", "} else {", "const char *VAR_8 = strrchr(s->path, '.');", "s->split_planes = VAR_8 && !av_strcasecmp(VAR_8 + 1, \"y\");", "st->codec->codec_type = AVMEDIA_TYPE_VIDEO;", "st->codec->codec_id = ff_guess_image2_codec(s->path);", "if (st->codec->codec_id == AV_CODEC_ID_LJPEG)\nst->codec->codec_id = AV_CODEC_ID_MJPEG;", "}", "if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO &&\nVAR_3 != AV_PIX_FMT_NONE)\nst->codec->VAR_3 = VAR_3;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29, 31 ], [ 33, 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ], [ 47 ], [ 53, 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 67, 69 ], [ 71, 73 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 101, 103 ], [ 105, 107 ], [ 109 ], [ 113, 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147, 149 ], [ 151 ], [ 153 ], [ 155, 157 ], [ 159, 161, 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171, 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189, 191, 193, 195 ], [ 197 ], [ 199, 201 ], [ 203, 205 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ], [ 215 ], [ 219 ], [ 221 ], [ 223 ], [ 227 ], [ 229 ], [ 231 ], [ 233 ], [ 235 ], [ 237 ], [ 239 ], [ 241 ], [ 243 ], [ 245 ], [ 247 ], [ 249, 251 ], [ 253 ], [ 255, 257, 259 ], [ 263 ], [ 265 ] ]
20,020
static void rgba32_to_rgb24(AVPicture *dst, AVPicture *src, int width, int height) { const uint8_t *s; uint8_t *d; int src_wrap, dst_wrap, j, y; unsigned int v; s = src->data[0]; src_wrap = src->linesize[0] - width * 4; d = dst->data[0]; dst_wrap = dst->linesize[0] - width * 3; for(y=0;y<height;y++) { for(j = 0;j < width; j++) { v = *(uint32_t *)s; s += 4; d[0] = v >> 16; d[1] = v >> 8; d[2] = v; d += 3; } s += src_wrap; d += dst_wrap; } }
false
FFmpeg
7e7e59409294af9caa63808e56c5cc824c98b4fc
static void rgba32_to_rgb24(AVPicture *dst, AVPicture *src, int width, int height) { const uint8_t *s; uint8_t *d; int src_wrap, dst_wrap, j, y; unsigned int v; s = src->data[0]; src_wrap = src->linesize[0] - width * 4; d = dst->data[0]; dst_wrap = dst->linesize[0] - width * 3; for(y=0;y<height;y++) { for(j = 0;j < width; j++) { v = *(uint32_t *)s; s += 4; d[0] = v >> 16; d[1] = v >> 8; d[2] = v; d += 3; } s += src_wrap; d += dst_wrap; } }
{ "code": [], "line_no": [] }
static void FUNC_0(AVPicture *VAR_0, AVPicture *VAR_1, int VAR_2, int VAR_3) { const uint8_t *VAR_4; uint8_t *d; int VAR_5, VAR_6, VAR_7, VAR_8; unsigned int VAR_9; VAR_4 = VAR_1->data[0]; VAR_5 = VAR_1->linesize[0] - VAR_2 * 4; d = VAR_0->data[0]; VAR_6 = VAR_0->linesize[0] - VAR_2 * 3; for(VAR_8=0;VAR_8<VAR_3;VAR_8++) { for(VAR_7 = 0;VAR_7 < VAR_2; VAR_7++) { VAR_9 = *(uint32_t *)VAR_4; VAR_4 += 4; d[0] = VAR_9 >> 16; d[1] = VAR_9 >> 8; d[2] = VAR_9; d += 3; } VAR_4 += VAR_5; d += VAR_6; } }
[ "static void FUNC_0(AVPicture *VAR_0, AVPicture *VAR_1,\nint VAR_2, int VAR_3)\n{", "const uint8_t *VAR_4;", "uint8_t *d;", "int VAR_5, VAR_6, VAR_7, VAR_8;", "unsigned int VAR_9;", "VAR_4 = VAR_1->data[0];", "VAR_5 = VAR_1->linesize[0] - VAR_2 * 4;", "d = VAR_0->data[0];", "VAR_6 = VAR_0->linesize[0] - VAR_2 * 3;", "for(VAR_8=0;VAR_8<VAR_3;VAR_8++) {", "for(VAR_7 = 0;VAR_7 < VAR_2; VAR_7++) {", "VAR_9 = *(uint32_t *)VAR_4;", "VAR_4 += 4;", "d[0] = VAR_9 >> 16;", "d[1] = VAR_9 >> 8;", "d[2] = VAR_9;", "d += 3;", "}", "VAR_4 += VAR_5;", "d += VAR_6;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ] ]
20,021
int opt_codec_debug(void *optctx, const char *opt, const char *arg) { av_log_set_level(AV_LOG_DEBUG); return opt_default(NULL, opt, arg); }
false
FFmpeg
ba4bcb191aa8b5fa66131544bf9ebf1f17ff7d9a
int opt_codec_debug(void *optctx, const char *opt, const char *arg) { av_log_set_level(AV_LOG_DEBUG); return opt_default(NULL, opt, arg); }
{ "code": [], "line_no": [] }
int FUNC_0(void *VAR_0, const char *VAR_1, const char *VAR_2) { av_log_set_level(AV_LOG_DEBUG); return opt_default(NULL, VAR_1, VAR_2); }
[ "int FUNC_0(void *VAR_0, const char *VAR_1, const char *VAR_2)\n{", "av_log_set_level(AV_LOG_DEBUG);", "return opt_default(NULL, VAR_1, VAR_2);", "}" ]
[ 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ] ]
20,024
void mips_r4k_init(MachineState *machine) { ram_addr_t ram_size = machine->ram_size; const char *cpu_model = machine->cpu_model; const char *kernel_filename = machine->kernel_filename; const char *kernel_cmdline = machine->kernel_cmdline; const char *initrd_filename = machine->initrd_filename; char *filename; MemoryRegion *address_space_mem = get_system_memory(); MemoryRegion *ram = g_new(MemoryRegion, 1); MemoryRegion *bios; MemoryRegion *iomem = g_new(MemoryRegion, 1); MemoryRegion *isa_io = g_new(MemoryRegion, 1); MemoryRegion *isa_mem = g_new(MemoryRegion, 1); int bios_size; MIPSCPU *cpu; CPUMIPSState *env; ResetData *reset_info; int i; qemu_irq *i8259; ISABus *isa_bus; DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; DriveInfo *dinfo; int be; /* init CPUs */ if (cpu_model == NULL) { #ifdef TARGET_MIPS64 cpu_model = "R4000"; #else cpu_model = "24Kf"; #endif } cpu = cpu_mips_init(cpu_model); if (cpu == NULL) { fprintf(stderr, "Unable to find CPU definition\n"); exit(1); } env = &cpu->env; reset_info = g_malloc0(sizeof(ResetData)); reset_info->cpu = cpu; reset_info->vector = env->active_tc.PC; qemu_register_reset(main_cpu_reset, reset_info); /* allocate RAM */ if (ram_size > (256 << 20)) { fprintf(stderr, "qemu: Too much memory for this machine: %d MB, maximum 256 MB\n", ((unsigned int)ram_size / (1 << 20))); exit(1); } memory_region_allocate_system_memory(ram, NULL, "mips_r4k.ram", ram_size); memory_region_add_subregion(address_space_mem, 0, ram); memory_region_init_io(iomem, NULL, &mips_qemu_ops, NULL, "mips-qemu", 0x10000); memory_region_add_subregion(address_space_mem, 0x1fbf0000, iomem); /* Try to load a BIOS image. If this fails, we continue regardless, but initialize the hardware ourselves. When a kernel gets preloaded we also initialize the hardware, since the BIOS wasn't run. */ if (bios_name == NULL) bios_name = BIOS_FILENAME; filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); if (filename) { bios_size = get_image_size(filename); } else { bios_size = -1; } #ifdef TARGET_WORDS_BIGENDIAN be = 1; #else be = 0; #endif if ((bios_size > 0) && (bios_size <= BIOS_SIZE)) { bios = g_new(MemoryRegion, 1); memory_region_init_ram(bios, NULL, "mips_r4k.bios", BIOS_SIZE, &error_abort); vmstate_register_ram_global(bios); memory_region_set_readonly(bios, true); memory_region_add_subregion(get_system_memory(), 0x1fc00000, bios); load_image_targphys(filename, 0x1fc00000, BIOS_SIZE); } else if ((dinfo = drive_get(IF_PFLASH, 0, 0)) != NULL) { uint32_t mips_rom = 0x00400000; if (!pflash_cfi01_register(0x1fc00000, NULL, "mips_r4k.bios", mips_rom, blk_by_legacy_dinfo(dinfo), sector_len, mips_rom / sector_len, 4, 0, 0, 0, 0, be)) { fprintf(stderr, "qemu: Error registering flash memory.\n"); } } else if (!qtest_enabled()) { /* not fatal */ fprintf(stderr, "qemu: Warning, could not load MIPS bios '%s'\n", bios_name); } g_free(filename); if (kernel_filename) { loaderparams.ram_size = ram_size; loaderparams.kernel_filename = kernel_filename; loaderparams.kernel_cmdline = kernel_cmdline; loaderparams.initrd_filename = initrd_filename; reset_info->vector = load_kernel(); } /* Init CPU internal devices */ cpu_mips_irq_init_cpu(env); cpu_mips_clock_init(env); /* ISA bus: IO space at 0x14000000, mem space at 0x10000000 */ memory_region_init_alias(isa_io, NULL, "isa-io", get_system_io(), 0, 0x00010000); memory_region_init(isa_mem, NULL, "isa-mem", 0x01000000); memory_region_add_subregion(get_system_memory(), 0x14000000, isa_io); memory_region_add_subregion(get_system_memory(), 0x10000000, isa_mem); isa_bus = isa_bus_new(NULL, isa_mem, get_system_io()); /* The PIC is attached to the MIPS CPU INT0 pin */ i8259 = i8259_init(isa_bus, env->irq[2]); isa_bus_irqs(isa_bus, i8259); rtc_init(isa_bus, 2000, NULL); pit = pit_init(isa_bus, 0x40, 0, NULL); serial_hds_isa_init(isa_bus, MAX_SERIAL_PORTS); isa_vga_init(isa_bus); if (nd_table[0].used) isa_ne2000_init(isa_bus, 0x300, 9, &nd_table[0]); ide_drive_get(hd, ARRAY_SIZE(hd)); for(i = 0; i < MAX_IDE_BUS; i++) isa_ide_init(isa_bus, ide_iobase[i], ide_iobase2[i], ide_irq[i], hd[MAX_IDE_DEVS * i], hd[MAX_IDE_DEVS * i + 1]); isa_create_simple(isa_bus, "i8042"); }
true
qemu
f8ed85ac992c48814d916d5df4d44f9a971c5de4
void mips_r4k_init(MachineState *machine) { ram_addr_t ram_size = machine->ram_size; const char *cpu_model = machine->cpu_model; const char *kernel_filename = machine->kernel_filename; const char *kernel_cmdline = machine->kernel_cmdline; const char *initrd_filename = machine->initrd_filename; char *filename; MemoryRegion *address_space_mem = get_system_memory(); MemoryRegion *ram = g_new(MemoryRegion, 1); MemoryRegion *bios; MemoryRegion *iomem = g_new(MemoryRegion, 1); MemoryRegion *isa_io = g_new(MemoryRegion, 1); MemoryRegion *isa_mem = g_new(MemoryRegion, 1); int bios_size; MIPSCPU *cpu; CPUMIPSState *env; ResetData *reset_info; int i; qemu_irq *i8259; ISABus *isa_bus; DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; DriveInfo *dinfo; int be; if (cpu_model == NULL) { #ifdef TARGET_MIPS64 cpu_model = "R4000"; #else cpu_model = "24Kf"; #endif } cpu = cpu_mips_init(cpu_model); if (cpu == NULL) { fprintf(stderr, "Unable to find CPU definition\n"); exit(1); } env = &cpu->env; reset_info = g_malloc0(sizeof(ResetData)); reset_info->cpu = cpu; reset_info->vector = env->active_tc.PC; qemu_register_reset(main_cpu_reset, reset_info); if (ram_size > (256 << 20)) { fprintf(stderr, "qemu: Too much memory for this machine: %d MB, maximum 256 MB\n", ((unsigned int)ram_size / (1 << 20))); exit(1); } memory_region_allocate_system_memory(ram, NULL, "mips_r4k.ram", ram_size); memory_region_add_subregion(address_space_mem, 0, ram); memory_region_init_io(iomem, NULL, &mips_qemu_ops, NULL, "mips-qemu", 0x10000); memory_region_add_subregion(address_space_mem, 0x1fbf0000, iomem); if (bios_name == NULL) bios_name = BIOS_FILENAME; filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); if (filename) { bios_size = get_image_size(filename); } else { bios_size = -1; } #ifdef TARGET_WORDS_BIGENDIAN be = 1; #else be = 0; #endif if ((bios_size > 0) && (bios_size <= BIOS_SIZE)) { bios = g_new(MemoryRegion, 1); memory_region_init_ram(bios, NULL, "mips_r4k.bios", BIOS_SIZE, &error_abort); vmstate_register_ram_global(bios); memory_region_set_readonly(bios, true); memory_region_add_subregion(get_system_memory(), 0x1fc00000, bios); load_image_targphys(filename, 0x1fc00000, BIOS_SIZE); } else if ((dinfo = drive_get(IF_PFLASH, 0, 0)) != NULL) { uint32_t mips_rom = 0x00400000; if (!pflash_cfi01_register(0x1fc00000, NULL, "mips_r4k.bios", mips_rom, blk_by_legacy_dinfo(dinfo), sector_len, mips_rom / sector_len, 4, 0, 0, 0, 0, be)) { fprintf(stderr, "qemu: Error registering flash memory.\n"); } } else if (!qtest_enabled()) { fprintf(stderr, "qemu: Warning, could not load MIPS bios '%s'\n", bios_name); } g_free(filename); if (kernel_filename) { loaderparams.ram_size = ram_size; loaderparams.kernel_filename = kernel_filename; loaderparams.kernel_cmdline = kernel_cmdline; loaderparams.initrd_filename = initrd_filename; reset_info->vector = load_kernel(); } cpu_mips_irq_init_cpu(env); cpu_mips_clock_init(env); memory_region_init_alias(isa_io, NULL, "isa-io", get_system_io(), 0, 0x00010000); memory_region_init(isa_mem, NULL, "isa-mem", 0x01000000); memory_region_add_subregion(get_system_memory(), 0x14000000, isa_io); memory_region_add_subregion(get_system_memory(), 0x10000000, isa_mem); isa_bus = isa_bus_new(NULL, isa_mem, get_system_io()); i8259 = i8259_init(isa_bus, env->irq[2]); isa_bus_irqs(isa_bus, i8259); rtc_init(isa_bus, 2000, NULL); pit = pit_init(isa_bus, 0x40, 0, NULL); serial_hds_isa_init(isa_bus, MAX_SERIAL_PORTS); isa_vga_init(isa_bus); if (nd_table[0].used) isa_ne2000_init(isa_bus, 0x300, 9, &nd_table[0]); ide_drive_get(hd, ARRAY_SIZE(hd)); for(i = 0; i < MAX_IDE_BUS; i++) isa_ide_init(isa_bus, ide_iobase[i], ide_iobase2[i], ide_irq[i], hd[MAX_IDE_DEVS * i], hd[MAX_IDE_DEVS * i + 1]); isa_create_simple(isa_bus, "i8042"); }
{ "code": [ " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);" ], "line_no": [ 159, 159, 159, 159, 159, 159 ] }
void FUNC_0(MachineState *VAR_0) { ram_addr_t ram_size = VAR_0->ram_size; const char *VAR_1 = VAR_0->VAR_1; const char *VAR_2 = VAR_0->VAR_2; const char *VAR_3 = VAR_0->VAR_3; const char *VAR_4 = VAR_0->VAR_4; char *VAR_5; MemoryRegion *address_space_mem = get_system_memory(); MemoryRegion *ram = g_new(MemoryRegion, 1); MemoryRegion *bios; MemoryRegion *iomem = g_new(MemoryRegion, 1); MemoryRegion *isa_io = g_new(MemoryRegion, 1); MemoryRegion *isa_mem = g_new(MemoryRegion, 1); int VAR_6; MIPSCPU *cpu; CPUMIPSState *env; ResetData *reset_info; int VAR_7; qemu_irq *i8259; ISABus *isa_bus; DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; DriveInfo *dinfo; int VAR_8; if (VAR_1 == NULL) { #ifdef TARGET_MIPS64 VAR_1 = "R4000"; #else VAR_1 = "24Kf"; #endif } cpu = cpu_mips_init(VAR_1); if (cpu == NULL) { fprintf(stderr, "Unable to find CPU definition\n"); exit(1); } env = &cpu->env; reset_info = g_malloc0(sizeof(ResetData)); reset_info->cpu = cpu; reset_info->vector = env->active_tc.PC; qemu_register_reset(main_cpu_reset, reset_info); if (ram_size > (256 << 20)) { fprintf(stderr, "qemu: Too much memory for this VAR_0: %d MB, maximum 256 MB\n", ((unsigned int)ram_size / (1 << 20))); exit(1); } memory_region_allocate_system_memory(ram, NULL, "mips_r4k.ram", ram_size); memory_region_add_subregion(address_space_mem, 0, ram); memory_region_init_io(iomem, NULL, &mips_qemu_ops, NULL, "mips-qemu", 0x10000); memory_region_add_subregion(address_space_mem, 0x1fbf0000, iomem); if (bios_name == NULL) bios_name = BIOS_FILENAME; VAR_5 = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); if (VAR_5) { VAR_6 = get_image_size(VAR_5); } else { VAR_6 = -1; } #ifdef TARGET_WORDS_BIGENDIAN VAR_8 = 1; #else VAR_8 = 0; #endif if ((VAR_6 > 0) && (VAR_6 <= BIOS_SIZE)) { bios = g_new(MemoryRegion, 1); memory_region_init_ram(bios, NULL, "mips_r4k.bios", BIOS_SIZE, &error_abort); vmstate_register_ram_global(bios); memory_region_set_readonly(bios, true); memory_region_add_subregion(get_system_memory(), 0x1fc00000, bios); load_image_targphys(VAR_5, 0x1fc00000, BIOS_SIZE); } else if ((dinfo = drive_get(IF_PFLASH, 0, 0)) != NULL) { uint32_t mips_rom = 0x00400000; if (!pflash_cfi01_register(0x1fc00000, NULL, "mips_r4k.bios", mips_rom, blk_by_legacy_dinfo(dinfo), sector_len, mips_rom / sector_len, 4, 0, 0, 0, 0, VAR_8)) { fprintf(stderr, "qemu: Error registering flash memory.\n"); } } else if (!qtest_enabled()) { fprintf(stderr, "qemu: Warning, could not load MIPS bios '%s'\n", bios_name); } g_free(VAR_5); if (VAR_2) { loaderparams.ram_size = ram_size; loaderparams.VAR_2 = VAR_2; loaderparams.VAR_3 = VAR_3; loaderparams.VAR_4 = VAR_4; reset_info->vector = load_kernel(); } cpu_mips_irq_init_cpu(env); cpu_mips_clock_init(env); memory_region_init_alias(isa_io, NULL, "isa-io", get_system_io(), 0, 0x00010000); memory_region_init(isa_mem, NULL, "isa-mem", 0x01000000); memory_region_add_subregion(get_system_memory(), 0x14000000, isa_io); memory_region_add_subregion(get_system_memory(), 0x10000000, isa_mem); isa_bus = isa_bus_new(NULL, isa_mem, get_system_io()); i8259 = i8259_init(isa_bus, env->irq[2]); isa_bus_irqs(isa_bus, i8259); rtc_init(isa_bus, 2000, NULL); pit = pit_init(isa_bus, 0x40, 0, NULL); serial_hds_isa_init(isa_bus, MAX_SERIAL_PORTS); isa_vga_init(isa_bus); if (nd_table[0].used) isa_ne2000_init(isa_bus, 0x300, 9, &nd_table[0]); ide_drive_get(hd, ARRAY_SIZE(hd)); for(VAR_7 = 0; VAR_7 < MAX_IDE_BUS; VAR_7++) isa_ide_init(isa_bus, ide_iobase[VAR_7], ide_iobase2[VAR_7], ide_irq[VAR_7], hd[MAX_IDE_DEVS * VAR_7], hd[MAX_IDE_DEVS * VAR_7 + 1]); isa_create_simple(isa_bus, "i8042"); }
[ "void FUNC_0(MachineState *VAR_0)\n{", "ram_addr_t ram_size = VAR_0->ram_size;", "const char *VAR_1 = VAR_0->VAR_1;", "const char *VAR_2 = VAR_0->VAR_2;", "const char *VAR_3 = VAR_0->VAR_3;", "const char *VAR_4 = VAR_0->VAR_4;", "char *VAR_5;", "MemoryRegion *address_space_mem = get_system_memory();", "MemoryRegion *ram = g_new(MemoryRegion, 1);", "MemoryRegion *bios;", "MemoryRegion *iomem = g_new(MemoryRegion, 1);", "MemoryRegion *isa_io = g_new(MemoryRegion, 1);", "MemoryRegion *isa_mem = g_new(MemoryRegion, 1);", "int VAR_6;", "MIPSCPU *cpu;", "CPUMIPSState *env;", "ResetData *reset_info;", "int VAR_7;", "qemu_irq *i8259;", "ISABus *isa_bus;", "DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS];", "DriveInfo *dinfo;", "int VAR_8;", "if (VAR_1 == NULL) {", "#ifdef TARGET_MIPS64\nVAR_1 = \"R4000\";", "#else\nVAR_1 = \"24Kf\";", "#endif\n}", "cpu = cpu_mips_init(VAR_1);", "if (cpu == NULL) {", "fprintf(stderr, \"Unable to find CPU definition\\n\");", "exit(1);", "}", "env = &cpu->env;", "reset_info = g_malloc0(sizeof(ResetData));", "reset_info->cpu = cpu;", "reset_info->vector = env->active_tc.PC;", "qemu_register_reset(main_cpu_reset, reset_info);", "if (ram_size > (256 << 20)) {", "fprintf(stderr,\n\"qemu: Too much memory for this VAR_0: %d MB, maximum 256 MB\\n\",\n((unsigned int)ram_size / (1 << 20)));", "exit(1);", "}", "memory_region_allocate_system_memory(ram, NULL, \"mips_r4k.ram\", ram_size);", "memory_region_add_subregion(address_space_mem, 0, ram);", "memory_region_init_io(iomem, NULL, &mips_qemu_ops, NULL, \"mips-qemu\", 0x10000);", "memory_region_add_subregion(address_space_mem, 0x1fbf0000, iomem);", "if (bios_name == NULL)\nbios_name = BIOS_FILENAME;", "VAR_5 = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);", "if (VAR_5) {", "VAR_6 = get_image_size(VAR_5);", "} else {", "VAR_6 = -1;", "}", "#ifdef TARGET_WORDS_BIGENDIAN\nVAR_8 = 1;", "#else\nVAR_8 = 0;", "#endif\nif ((VAR_6 > 0) && (VAR_6 <= BIOS_SIZE)) {", "bios = g_new(MemoryRegion, 1);", "memory_region_init_ram(bios, NULL, \"mips_r4k.bios\", BIOS_SIZE,\n&error_abort);", "vmstate_register_ram_global(bios);", "memory_region_set_readonly(bios, true);", "memory_region_add_subregion(get_system_memory(), 0x1fc00000, bios);", "load_image_targphys(VAR_5, 0x1fc00000, BIOS_SIZE);", "} else if ((dinfo = drive_get(IF_PFLASH, 0, 0)) != NULL) {", "uint32_t mips_rom = 0x00400000;", "if (!pflash_cfi01_register(0x1fc00000, NULL, \"mips_r4k.bios\", mips_rom,\nblk_by_legacy_dinfo(dinfo),\nsector_len, mips_rom / sector_len,\n4, 0, 0, 0, 0, VAR_8)) {", "fprintf(stderr, \"qemu: Error registering flash memory.\\n\");", "}", "} else if (!qtest_enabled()) {", "fprintf(stderr, \"qemu: Warning, could not load MIPS bios '%s'\\n\",\nbios_name);", "}", "g_free(VAR_5);", "if (VAR_2) {", "loaderparams.ram_size = ram_size;", "loaderparams.VAR_2 = VAR_2;", "loaderparams.VAR_3 = VAR_3;", "loaderparams.VAR_4 = VAR_4;", "reset_info->vector = load_kernel();", "}", "cpu_mips_irq_init_cpu(env);", "cpu_mips_clock_init(env);", "memory_region_init_alias(isa_io, NULL, \"isa-io\",\nget_system_io(), 0, 0x00010000);", "memory_region_init(isa_mem, NULL, \"isa-mem\", 0x01000000);", "memory_region_add_subregion(get_system_memory(), 0x14000000, isa_io);", "memory_region_add_subregion(get_system_memory(), 0x10000000, isa_mem);", "isa_bus = isa_bus_new(NULL, isa_mem, get_system_io());", "i8259 = i8259_init(isa_bus, env->irq[2]);", "isa_bus_irqs(isa_bus, i8259);", "rtc_init(isa_bus, 2000, NULL);", "pit = pit_init(isa_bus, 0x40, 0, NULL);", "serial_hds_isa_init(isa_bus, MAX_SERIAL_PORTS);", "isa_vga_init(isa_bus);", "if (nd_table[0].used)\nisa_ne2000_init(isa_bus, 0x300, 9, &nd_table[0]);", "ide_drive_get(hd, ARRAY_SIZE(hd));", "for(VAR_7 = 0; VAR_7 < MAX_IDE_BUS; VAR_7++)", "isa_ide_init(isa_bus, ide_iobase[VAR_7], ide_iobase2[VAR_7], ide_irq[VAR_7],\nhd[MAX_IDE_DEVS * VAR_7],\nhd[MAX_IDE_DEVS * VAR_7 + 1]);", "isa_create_simple(isa_bus, \"i8042\");", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 53 ], [ 55, 57 ], [ 59, 61 ], [ 63, 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 93 ], [ 95, 97, 99 ], [ 101 ], [ 103 ], [ 105 ], [ 109 ], [ 113 ], [ 115 ], [ 127, 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143, 145 ], [ 147, 149 ], [ 151, 153 ], [ 155 ], [ 157, 159 ], [ 161 ], [ 163 ], [ 165 ], [ 169 ], [ 171 ], [ 173 ], [ 175, 177, 179, 181 ], [ 183 ], [ 185 ], [ 187 ], [ 191, 193 ], [ 195 ], [ 197 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ], [ 219 ], [ 221 ], [ 227, 229 ], [ 231 ], [ 233 ], [ 235 ], [ 237 ], [ 243 ], [ 245 ], [ 249 ], [ 253 ], [ 257 ], [ 261 ], [ 265, 267 ], [ 271 ], [ 273 ], [ 275, 277, 279 ], [ 283 ], [ 285 ] ]
20,025
static int get_packetheader(NUTContext *nut, ByteIOContext *bc, int calculate_checksum) { int64_t start, size; // start= url_ftell(bc) - 8; size= get_v(bc); init_checksum(bc, calculate_checksum ? av_crc04C11DB7_update : NULL, 1); // nut->packet_start[2] = start; // nut->written_packet_size= size; return size; }
true
FFmpeg
5d97d9d53ea1cc2c28411ad734565372ddeccc32
static int get_packetheader(NUTContext *nut, ByteIOContext *bc, int calculate_checksum) { int64_t start, size; size= get_v(bc); init_checksum(bc, calculate_checksum ? av_crc04C11DB7_update : NULL, 1); return size; }
{ "code": [ " init_checksum(bc, calculate_checksum ? av_crc04C11DB7_update : NULL, 1);" ], "line_no": [ 15 ] }
static int FUNC_0(NUTContext *VAR_0, ByteIOContext *VAR_1, int VAR_2) { int64_t start, size; size= get_v(VAR_1); init_checksum(VAR_1, VAR_2 ? av_crc04C11DB7_update : NULL, 1); return size; }
[ "static int FUNC_0(NUTContext *VAR_0, ByteIOContext *VAR_1, int VAR_2)\n{", "int64_t start, size;", "size= get_v(VAR_1);", "init_checksum(VAR_1, VAR_2 ? av_crc04C11DB7_update : NULL, 1);", "return size;", "}" ]
[ 0, 0, 0, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 11 ], [ 15 ], [ 25 ], [ 27 ] ]
20,027
static int decode_slice(AVCodecContext *avctx, void *tdata) { ProresThreadData *td = tdata; ProresContext *ctx = avctx->priv_data; int mb_x_pos = td->x_pos; int mb_y_pos = td->y_pos; int pic_num = ctx->pic_num; int slice_num = td->slice_num; int mbs_per_slice = td->slice_width; const uint8_t *buf; uint8_t *y_data, *u_data, *v_data, *a_data; AVFrame *pic = ctx->frame; int i, sf, slice_width_factor; int slice_data_size, hdr_size; int y_data_size, u_data_size, v_data_size, a_data_size; int y_linesize, u_linesize, v_linesize, a_linesize; int coff[4]; int ret; buf = ctx->slice_data[slice_num].index; slice_data_size = ctx->slice_data[slice_num + 1].index - buf; slice_width_factor = av_log2(mbs_per_slice); y_data = pic->data[0]; u_data = pic->data[1]; v_data = pic->data[2]; a_data = pic->data[3]; y_linesize = pic->linesize[0]; u_linesize = pic->linesize[1]; v_linesize = pic->linesize[2]; a_linesize = pic->linesize[3]; if (pic->interlaced_frame) { if (!(pic_num ^ pic->top_field_first)) { y_data += y_linesize; u_data += u_linesize; v_data += v_linesize; if (a_data) a_data += a_linesize; } y_linesize <<= 1; u_linesize <<= 1; v_linesize <<= 1; a_linesize <<= 1; } y_data += (mb_y_pos << 4) * y_linesize + (mb_x_pos << 5); u_data += (mb_y_pos << 4) * u_linesize + (mb_x_pos << ctx->mb_chroma_factor); v_data += (mb_y_pos << 4) * v_linesize + (mb_x_pos << ctx->mb_chroma_factor); if (a_data) a_data += (mb_y_pos << 4) * a_linesize + (mb_x_pos << 5); if (slice_data_size < 6) { av_log(avctx, AV_LOG_ERROR, "slice data too small\n"); return AVERROR_INVALIDDATA; } /* parse slice header */ hdr_size = buf[0] >> 3; coff[0] = hdr_size; y_data_size = AV_RB16(buf + 2); coff[1] = coff[0] + y_data_size; u_data_size = AV_RB16(buf + 4); coff[2] = coff[1] + u_data_size; v_data_size = hdr_size > 7 ? AV_RB16(buf + 6) : slice_data_size - coff[2]; coff[3] = coff[2] + v_data_size; a_data_size = ctx->alpha_info ? slice_data_size - coff[3] : 0; /* if V or alpha component size is negative that means that previous component sizes are too large */ if (v_data_size < 0 || a_data_size < 0 || hdr_size < 6) { av_log(avctx, AV_LOG_ERROR, "invalid data size\n"); return AVERROR_INVALIDDATA; } sf = av_clip(buf[1], 1, 224); sf = sf > 128 ? (sf - 96) << 2 : sf; /* scale quantization matrixes according with slice's scale factor */ /* TODO: this can be SIMD-optimized a lot */ if (ctx->qmat_changed || sf != td->prev_slice_sf) { td->prev_slice_sf = sf; for (i = 0; i < 64; i++) { td->qmat_luma_scaled[ctx->dsp.idct_permutation[i]] = ctx->qmat_luma[i] * sf; td->qmat_chroma_scaled[ctx->dsp.idct_permutation[i]] = ctx->qmat_chroma[i] * sf; } } /* decode luma plane */ ret = decode_slice_plane(ctx, td, buf + coff[0], y_data_size, (uint16_t*) y_data, y_linesize, mbs_per_slice, 4, slice_width_factor + 2, td->qmat_luma_scaled, 0); if (ret < 0) return ret; /* decode U chroma plane */ ret = decode_slice_plane(ctx, td, buf + coff[1], u_data_size, (uint16_t*) u_data, u_linesize, mbs_per_slice, ctx->num_chroma_blocks, slice_width_factor + ctx->chroma_factor - 1, td->qmat_chroma_scaled, 1); if (ret < 0) return ret; /* decode V chroma plane */ ret = decode_slice_plane(ctx, td, buf + coff[2], v_data_size, (uint16_t*) v_data, v_linesize, mbs_per_slice, ctx->num_chroma_blocks, slice_width_factor + ctx->chroma_factor - 1, td->qmat_chroma_scaled, 1); if (ret < 0) return ret; /* decode alpha plane if available */ if (a_data && a_data_size) decode_alpha_plane(ctx, td, buf + coff[3], a_data_size, (uint16_t*) a_data, a_linesize, mbs_per_slice); return 0; }
true
FFmpeg
1e33035ee7a8d9fb7a4b8b6cc54842e72b36ed70
static int decode_slice(AVCodecContext *avctx, void *tdata) { ProresThreadData *td = tdata; ProresContext *ctx = avctx->priv_data; int mb_x_pos = td->x_pos; int mb_y_pos = td->y_pos; int pic_num = ctx->pic_num; int slice_num = td->slice_num; int mbs_per_slice = td->slice_width; const uint8_t *buf; uint8_t *y_data, *u_data, *v_data, *a_data; AVFrame *pic = ctx->frame; int i, sf, slice_width_factor; int slice_data_size, hdr_size; int y_data_size, u_data_size, v_data_size, a_data_size; int y_linesize, u_linesize, v_linesize, a_linesize; int coff[4]; int ret; buf = ctx->slice_data[slice_num].index; slice_data_size = ctx->slice_data[slice_num + 1].index - buf; slice_width_factor = av_log2(mbs_per_slice); y_data = pic->data[0]; u_data = pic->data[1]; v_data = pic->data[2]; a_data = pic->data[3]; y_linesize = pic->linesize[0]; u_linesize = pic->linesize[1]; v_linesize = pic->linesize[2]; a_linesize = pic->linesize[3]; if (pic->interlaced_frame) { if (!(pic_num ^ pic->top_field_first)) { y_data += y_linesize; u_data += u_linesize; v_data += v_linesize; if (a_data) a_data += a_linesize; } y_linesize <<= 1; u_linesize <<= 1; v_linesize <<= 1; a_linesize <<= 1; } y_data += (mb_y_pos << 4) * y_linesize + (mb_x_pos << 5); u_data += (mb_y_pos << 4) * u_linesize + (mb_x_pos << ctx->mb_chroma_factor); v_data += (mb_y_pos << 4) * v_linesize + (mb_x_pos << ctx->mb_chroma_factor); if (a_data) a_data += (mb_y_pos << 4) * a_linesize + (mb_x_pos << 5); if (slice_data_size < 6) { av_log(avctx, AV_LOG_ERROR, "slice data too small\n"); return AVERROR_INVALIDDATA; } hdr_size = buf[0] >> 3; coff[0] = hdr_size; y_data_size = AV_RB16(buf + 2); coff[1] = coff[0] + y_data_size; u_data_size = AV_RB16(buf + 4); coff[2] = coff[1] + u_data_size; v_data_size = hdr_size > 7 ? AV_RB16(buf + 6) : slice_data_size - coff[2]; coff[3] = coff[2] + v_data_size; a_data_size = ctx->alpha_info ? slice_data_size - coff[3] : 0; if (v_data_size < 0 || a_data_size < 0 || hdr_size < 6) { av_log(avctx, AV_LOG_ERROR, "invalid data size\n"); return AVERROR_INVALIDDATA; } sf = av_clip(buf[1], 1, 224); sf = sf > 128 ? (sf - 96) << 2 : sf; if (ctx->qmat_changed || sf != td->prev_slice_sf) { td->prev_slice_sf = sf; for (i = 0; i < 64; i++) { td->qmat_luma_scaled[ctx->dsp.idct_permutation[i]] = ctx->qmat_luma[i] * sf; td->qmat_chroma_scaled[ctx->dsp.idct_permutation[i]] = ctx->qmat_chroma[i] * sf; } } ret = decode_slice_plane(ctx, td, buf + coff[0], y_data_size, (uint16_t*) y_data, y_linesize, mbs_per_slice, 4, slice_width_factor + 2, td->qmat_luma_scaled, 0); if (ret < 0) return ret; ret = decode_slice_plane(ctx, td, buf + coff[1], u_data_size, (uint16_t*) u_data, u_linesize, mbs_per_slice, ctx->num_chroma_blocks, slice_width_factor + ctx->chroma_factor - 1, td->qmat_chroma_scaled, 1); if (ret < 0) return ret; ret = decode_slice_plane(ctx, td, buf + coff[2], v_data_size, (uint16_t*) v_data, v_linesize, mbs_per_slice, ctx->num_chroma_blocks, slice_width_factor + ctx->chroma_factor - 1, td->qmat_chroma_scaled, 1); if (ret < 0) return ret; if (a_data && a_data_size) decode_alpha_plane(ctx, td, buf + coff[3], a_data_size, (uint16_t*) a_data, a_linesize, mbs_per_slice); return 0; }
{ "code": [ " if (v_data_size < 0 || a_data_size < 0 || hdr_size < 6) {" ], "line_no": [ 141 ] }
static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1) { ProresThreadData *td = VAR_1; ProresContext *ctx = VAR_0->priv_data; int VAR_2 = td->x_pos; int VAR_3 = td->y_pos; int VAR_4 = ctx->VAR_4; int VAR_5 = td->VAR_5; int VAR_6 = td->slice_width; const uint8_t *VAR_7; uint8_t *y_data, *u_data, *v_data, *a_data; AVFrame *pic = ctx->frame; int VAR_8, VAR_9, VAR_10; int VAR_11, VAR_12; int VAR_13, VAR_14, VAR_15, VAR_16; int VAR_17, VAR_18, VAR_19, VAR_20; int VAR_21[4]; int VAR_22; VAR_7 = ctx->slice_data[VAR_5].index; VAR_11 = ctx->slice_data[VAR_5 + 1].index - VAR_7; VAR_10 = av_log2(VAR_6); y_data = pic->data[0]; u_data = pic->data[1]; v_data = pic->data[2]; a_data = pic->data[3]; VAR_17 = pic->linesize[0]; VAR_18 = pic->linesize[1]; VAR_19 = pic->linesize[2]; VAR_20 = pic->linesize[3]; if (pic->interlaced_frame) { if (!(VAR_4 ^ pic->top_field_first)) { y_data += VAR_17; u_data += VAR_18; v_data += VAR_19; if (a_data) a_data += VAR_20; } VAR_17 <<= 1; VAR_18 <<= 1; VAR_19 <<= 1; VAR_20 <<= 1; } y_data += (VAR_3 << 4) * VAR_17 + (VAR_2 << 5); u_data += (VAR_3 << 4) * VAR_18 + (VAR_2 << ctx->mb_chroma_factor); v_data += (VAR_3 << 4) * VAR_19 + (VAR_2 << ctx->mb_chroma_factor); if (a_data) a_data += (VAR_3 << 4) * VAR_20 + (VAR_2 << 5); if (VAR_11 < 6) { av_log(VAR_0, AV_LOG_ERROR, "slice data too small\n"); return AVERROR_INVALIDDATA; } VAR_12 = VAR_7[0] >> 3; VAR_21[0] = VAR_12; VAR_13 = AV_RB16(VAR_7 + 2); VAR_21[1] = VAR_21[0] + VAR_13; VAR_14 = AV_RB16(VAR_7 + 4); VAR_21[2] = VAR_21[1] + VAR_14; VAR_15 = VAR_12 > 7 ? AV_RB16(VAR_7 + 6) : VAR_11 - VAR_21[2]; VAR_21[3] = VAR_21[2] + VAR_15; VAR_16 = ctx->alpha_info ? VAR_11 - VAR_21[3] : 0; if (VAR_15 < 0 || VAR_16 < 0 || VAR_12 < 6) { av_log(VAR_0, AV_LOG_ERROR, "invalid data size\n"); return AVERROR_INVALIDDATA; } VAR_9 = av_clip(VAR_7[1], 1, 224); VAR_9 = VAR_9 > 128 ? (VAR_9 - 96) << 2 : VAR_9; if (ctx->qmat_changed || VAR_9 != td->prev_slice_sf) { td->prev_slice_sf = VAR_9; for (VAR_8 = 0; VAR_8 < 64; VAR_8++) { td->qmat_luma_scaled[ctx->dsp.idct_permutation[VAR_8]] = ctx->qmat_luma[VAR_8] * VAR_9; td->qmat_chroma_scaled[ctx->dsp.idct_permutation[VAR_8]] = ctx->qmat_chroma[VAR_8] * VAR_9; } } VAR_22 = decode_slice_plane(ctx, td, VAR_7 + VAR_21[0], VAR_13, (uint16_t*) y_data, VAR_17, VAR_6, 4, VAR_10 + 2, td->qmat_luma_scaled, 0); if (VAR_22 < 0) return VAR_22; VAR_22 = decode_slice_plane(ctx, td, VAR_7 + VAR_21[1], VAR_14, (uint16_t*) u_data, VAR_18, VAR_6, ctx->num_chroma_blocks, VAR_10 + ctx->chroma_factor - 1, td->qmat_chroma_scaled, 1); if (VAR_22 < 0) return VAR_22; VAR_22 = decode_slice_plane(ctx, td, VAR_7 + VAR_21[2], VAR_15, (uint16_t*) v_data, VAR_19, VAR_6, ctx->num_chroma_blocks, VAR_10 + ctx->chroma_factor - 1, td->qmat_chroma_scaled, 1); if (VAR_22 < 0) return VAR_22; if (a_data && VAR_16) decode_alpha_plane(ctx, td, VAR_7 + VAR_21[3], VAR_16, (uint16_t*) a_data, VAR_20, VAR_6); return 0; }
[ "static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1)\n{", "ProresThreadData *td = VAR_1;", "ProresContext *ctx = VAR_0->priv_data;", "int VAR_2 = td->x_pos;", "int VAR_3 = td->y_pos;", "int VAR_4 = ctx->VAR_4;", "int VAR_5 = td->VAR_5;", "int VAR_6 = td->slice_width;", "const uint8_t *VAR_7;", "uint8_t *y_data, *u_data, *v_data, *a_data;", "AVFrame *pic = ctx->frame;", "int VAR_8, VAR_9, VAR_10;", "int VAR_11, VAR_12;", "int VAR_13, VAR_14, VAR_15, VAR_16;", "int VAR_17, VAR_18, VAR_19, VAR_20;", "int VAR_21[4];", "int VAR_22;", "VAR_7 = ctx->slice_data[VAR_5].index;", "VAR_11 = ctx->slice_data[VAR_5 + 1].index - VAR_7;", "VAR_10 = av_log2(VAR_6);", "y_data = pic->data[0];", "u_data = pic->data[1];", "v_data = pic->data[2];", "a_data = pic->data[3];", "VAR_17 = pic->linesize[0];", "VAR_18 = pic->linesize[1];", "VAR_19 = pic->linesize[2];", "VAR_20 = pic->linesize[3];", "if (pic->interlaced_frame) {", "if (!(VAR_4 ^ pic->top_field_first)) {", "y_data += VAR_17;", "u_data += VAR_18;", "v_data += VAR_19;", "if (a_data)\na_data += VAR_20;", "}", "VAR_17 <<= 1;", "VAR_18 <<= 1;", "VAR_19 <<= 1;", "VAR_20 <<= 1;", "}", "y_data += (VAR_3 << 4) * VAR_17 + (VAR_2 << 5);", "u_data += (VAR_3 << 4) * VAR_18 + (VAR_2 << ctx->mb_chroma_factor);", "v_data += (VAR_3 << 4) * VAR_19 + (VAR_2 << ctx->mb_chroma_factor);", "if (a_data)\na_data += (VAR_3 << 4) * VAR_20 + (VAR_2 << 5);", "if (VAR_11 < 6) {", "av_log(VAR_0, AV_LOG_ERROR, \"slice data too small\\n\");", "return AVERROR_INVALIDDATA;", "}", "VAR_12 = VAR_7[0] >> 3;", "VAR_21[0] = VAR_12;", "VAR_13 = AV_RB16(VAR_7 + 2);", "VAR_21[1] = VAR_21[0] + VAR_13;", "VAR_14 = AV_RB16(VAR_7 + 4);", "VAR_21[2] = VAR_21[1] + VAR_14;", "VAR_15 = VAR_12 > 7 ? AV_RB16(VAR_7 + 6) : VAR_11 - VAR_21[2];", "VAR_21[3] = VAR_21[2] + VAR_15;", "VAR_16 = ctx->alpha_info ? VAR_11 - VAR_21[3] : 0;", "if (VAR_15 < 0 || VAR_16 < 0 || VAR_12 < 6) {", "av_log(VAR_0, AV_LOG_ERROR, \"invalid data size\\n\");", "return AVERROR_INVALIDDATA;", "}", "VAR_9 = av_clip(VAR_7[1], 1, 224);", "VAR_9 = VAR_9 > 128 ? (VAR_9 - 96) << 2 : VAR_9;", "if (ctx->qmat_changed || VAR_9 != td->prev_slice_sf) {", "td->prev_slice_sf = VAR_9;", "for (VAR_8 = 0; VAR_8 < 64; VAR_8++) {", "td->qmat_luma_scaled[ctx->dsp.idct_permutation[VAR_8]] = ctx->qmat_luma[VAR_8] * VAR_9;", "td->qmat_chroma_scaled[ctx->dsp.idct_permutation[VAR_8]] = ctx->qmat_chroma[VAR_8] * VAR_9;", "}", "}", "VAR_22 = decode_slice_plane(ctx, td, VAR_7 + VAR_21[0], VAR_13,\n(uint16_t*) y_data, VAR_17,\nVAR_6, 4, VAR_10 + 2,\ntd->qmat_luma_scaled, 0);", "if (VAR_22 < 0)\nreturn VAR_22;", "VAR_22 = decode_slice_plane(ctx, td, VAR_7 + VAR_21[1], VAR_14,\n(uint16_t*) u_data, VAR_18,\nVAR_6, ctx->num_chroma_blocks,\nVAR_10 + ctx->chroma_factor - 1,\ntd->qmat_chroma_scaled, 1);", "if (VAR_22 < 0)\nreturn VAR_22;", "VAR_22 = decode_slice_plane(ctx, td, VAR_7 + VAR_21[2], VAR_15,\n(uint16_t*) v_data, VAR_19,\nVAR_6, ctx->num_chroma_blocks,\nVAR_10 + ctx->chroma_factor - 1,\ntd->qmat_chroma_scaled, 1);", "if (VAR_22 < 0)\nreturn VAR_22;", "if (a_data && VAR_16)\ndecode_alpha_plane(ctx, td, VAR_7 + VAR_21[3], VAR_16,\n(uint16_t*) a_data, VAR_20,\nVAR_6);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 45 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77, 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99, 101 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 151 ], [ 153 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 179, 181, 183, 185 ], [ 189, 191 ], [ 197, 199, 201, 203, 205 ], [ 207, 209 ], [ 215, 217, 219, 221, 223 ], [ 225, 227 ], [ 233, 235, 237, 239 ], [ 243 ], [ 245 ] ]
20,028
static int put_v(ByteIOContext *bc, uint64_t val) { int i; // if (bytes_left(s)*8 < 9) // return -1; if (bytes_left(bc) < 1) return -1; val &= 0x7FFFFFFFFFFFFFFFULL; // FIXME can only encode upto 63 bits currently i= get_length(val); for (i-=7; i>0; i-=7){ put_byte(bc, 0x80 | (val>>i)); } put_byte(bc, val&0x7f); return 0; }
false
FFmpeg
465e1dadbef7596a3eb87089a66bb4ecdc26d3c4
static int put_v(ByteIOContext *bc, uint64_t val) { int i; if (bytes_left(bc) < 1) return -1; val &= 0x7FFFFFFFFFFFFFFFULL; i= get_length(val); for (i-=7; i>0; i-=7){ put_byte(bc, 0x80 | (val>>i)); } put_byte(bc, val&0x7f); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(ByteIOContext *VAR_0, uint64_t VAR_1) { int VAR_2; if (bytes_left(VAR_0) < 1) return -1; VAR_1 &= 0x7FFFFFFFFFFFFFFFULL; VAR_2= get_length(VAR_1); for (VAR_2-=7; VAR_2>0; VAR_2-=7){ put_byte(VAR_0, 0x80 | (VAR_1>>VAR_2)); } put_byte(VAR_0, VAR_1&0x7f); return 0; }
[ "static int FUNC_0(ByteIOContext *VAR_0, uint64_t VAR_1)\n{", "int VAR_2;", "if (bytes_left(VAR_0) < 1)\nreturn -1;", "VAR_1 &= 0x7FFFFFFFFFFFFFFFULL;", "VAR_2= get_length(VAR_1);", "for (VAR_2-=7; VAR_2>0; VAR_2-=7){", "put_byte(VAR_0, 0x80 | (VAR_1>>VAR_2));", "}", "put_byte(VAR_0, VAR_1&0x7f);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 13, 15 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 37 ], [ 39 ] ]
20,029
static inline void gen_bcond(DisasContext *ctx, int type) { uint32_t bo = BO(ctx->opcode); int l1; TCGv target; ctx->exception = POWERPC_EXCP_BRANCH; if (type == BCOND_LR || type == BCOND_CTR || type == BCOND_TAR) { target = tcg_temp_local_new(); if (type == BCOND_CTR) tcg_gen_mov_tl(target, cpu_ctr); else if (type == BCOND_TAR) gen_load_spr(target, SPR_TAR); else tcg_gen_mov_tl(target, cpu_lr); } else { TCGV_UNUSED(target); } if (LK(ctx->opcode)) gen_setlr(ctx, ctx->nip); l1 = gen_new_label(); if ((bo & 0x4) == 0) { /* Decrement and test CTR */ TCGv temp = tcg_temp_new(); if (unlikely(type == BCOND_CTR)) { gen_inval_exception(ctx, POWERPC_EXCP_INVAL_INVAL); return; } tcg_gen_subi_tl(cpu_ctr, cpu_ctr, 1); if (NARROW_MODE(ctx)) { tcg_gen_ext32u_tl(temp, cpu_ctr); } else { tcg_gen_mov_tl(temp, cpu_ctr); } if (bo & 0x2) { tcg_gen_brcondi_tl(TCG_COND_NE, temp, 0, l1); } else { tcg_gen_brcondi_tl(TCG_COND_EQ, temp, 0, l1); } tcg_temp_free(temp); } if ((bo & 0x10) == 0) { /* Test CR */ uint32_t bi = BI(ctx->opcode); uint32_t mask = 1 << (3 - (bi & 0x03)); TCGv_i32 temp = tcg_temp_new_i32(); if (bo & 0x8) { tcg_gen_andi_i32(temp, cpu_crf[bi >> 2], mask); tcg_gen_brcondi_i32(TCG_COND_EQ, temp, 0, l1); } else { tcg_gen_andi_i32(temp, cpu_crf[bi >> 2], mask); tcg_gen_brcondi_i32(TCG_COND_NE, temp, 0, l1); } tcg_temp_free_i32(temp); } gen_update_cfar(ctx, ctx->nip); if (type == BCOND_IM) { target_ulong li = (target_long)((int16_t)(BD(ctx->opcode))); if (likely(AA(ctx->opcode) == 0)) { gen_goto_tb(ctx, 0, ctx->nip + li - 4); } else { gen_goto_tb(ctx, 0, li); } gen_set_label(l1); gen_goto_tb(ctx, 1, ctx->nip); } else { if (NARROW_MODE(ctx)) { tcg_gen_andi_tl(cpu_nip, target, (uint32_t)~3); } else { tcg_gen_andi_tl(cpu_nip, target, ~3); } tcg_gen_exit_tb(0); gen_set_label(l1); gen_update_nip(ctx, ctx->nip); tcg_gen_exit_tb(0); } if (type == BCOND_LR || type == BCOND_CTR) { tcg_temp_free(target); } }
true
qemu
a9e8f4e7df385a6c704527d9c5b562f42566d491
static inline void gen_bcond(DisasContext *ctx, int type) { uint32_t bo = BO(ctx->opcode); int l1; TCGv target; ctx->exception = POWERPC_EXCP_BRANCH; if (type == BCOND_LR || type == BCOND_CTR || type == BCOND_TAR) { target = tcg_temp_local_new(); if (type == BCOND_CTR) tcg_gen_mov_tl(target, cpu_ctr); else if (type == BCOND_TAR) gen_load_spr(target, SPR_TAR); else tcg_gen_mov_tl(target, cpu_lr); } else { TCGV_UNUSED(target); } if (LK(ctx->opcode)) gen_setlr(ctx, ctx->nip); l1 = gen_new_label(); if ((bo & 0x4) == 0) { TCGv temp = tcg_temp_new(); if (unlikely(type == BCOND_CTR)) { gen_inval_exception(ctx, POWERPC_EXCP_INVAL_INVAL); return; } tcg_gen_subi_tl(cpu_ctr, cpu_ctr, 1); if (NARROW_MODE(ctx)) { tcg_gen_ext32u_tl(temp, cpu_ctr); } else { tcg_gen_mov_tl(temp, cpu_ctr); } if (bo & 0x2) { tcg_gen_brcondi_tl(TCG_COND_NE, temp, 0, l1); } else { tcg_gen_brcondi_tl(TCG_COND_EQ, temp, 0, l1); } tcg_temp_free(temp); } if ((bo & 0x10) == 0) { uint32_t bi = BI(ctx->opcode); uint32_t mask = 1 << (3 - (bi & 0x03)); TCGv_i32 temp = tcg_temp_new_i32(); if (bo & 0x8) { tcg_gen_andi_i32(temp, cpu_crf[bi >> 2], mask); tcg_gen_brcondi_i32(TCG_COND_EQ, temp, 0, l1); } else { tcg_gen_andi_i32(temp, cpu_crf[bi >> 2], mask); tcg_gen_brcondi_i32(TCG_COND_NE, temp, 0, l1); } tcg_temp_free_i32(temp); } gen_update_cfar(ctx, ctx->nip); if (type == BCOND_IM) { target_ulong li = (target_long)((int16_t)(BD(ctx->opcode))); if (likely(AA(ctx->opcode) == 0)) { gen_goto_tb(ctx, 0, ctx->nip + li - 4); } else { gen_goto_tb(ctx, 0, li); } gen_set_label(l1); gen_goto_tb(ctx, 1, ctx->nip); } else { if (NARROW_MODE(ctx)) { tcg_gen_andi_tl(cpu_nip, target, (uint32_t)~3); } else { tcg_gen_andi_tl(cpu_nip, target, ~3); } tcg_gen_exit_tb(0); gen_set_label(l1); gen_update_nip(ctx, ctx->nip); tcg_gen_exit_tb(0); } if (type == BCOND_LR || type == BCOND_CTR) { tcg_temp_free(target); } }
{ "code": [ " if (type == BCOND_LR || type == BCOND_CTR) {" ], "line_no": [ 155 ] }
static inline void FUNC_0(DisasContext *VAR_0, int VAR_1) { uint32_t bo = BO(VAR_0->opcode); int VAR_2; TCGv target; VAR_0->exception = POWERPC_EXCP_BRANCH; if (VAR_1 == BCOND_LR || VAR_1 == BCOND_CTR || VAR_1 == BCOND_TAR) { target = tcg_temp_local_new(); if (VAR_1 == BCOND_CTR) tcg_gen_mov_tl(target, cpu_ctr); else if (VAR_1 == BCOND_TAR) gen_load_spr(target, SPR_TAR); else tcg_gen_mov_tl(target, cpu_lr); } else { TCGV_UNUSED(target); } if (LK(VAR_0->opcode)) gen_setlr(VAR_0, VAR_0->nip); VAR_2 = gen_new_label(); if ((bo & 0x4) == 0) { TCGv temp = tcg_temp_new(); if (unlikely(VAR_1 == BCOND_CTR)) { gen_inval_exception(VAR_0, POWERPC_EXCP_INVAL_INVAL); return; } tcg_gen_subi_tl(cpu_ctr, cpu_ctr, 1); if (NARROW_MODE(VAR_0)) { tcg_gen_ext32u_tl(temp, cpu_ctr); } else { tcg_gen_mov_tl(temp, cpu_ctr); } if (bo & 0x2) { tcg_gen_brcondi_tl(TCG_COND_NE, temp, 0, VAR_2); } else { tcg_gen_brcondi_tl(TCG_COND_EQ, temp, 0, VAR_2); } tcg_temp_free(temp); } if ((bo & 0x10) == 0) { uint32_t bi = BI(VAR_0->opcode); uint32_t mask = 1 << (3 - (bi & 0x03)); TCGv_i32 temp = tcg_temp_new_i32(); if (bo & 0x8) { tcg_gen_andi_i32(temp, cpu_crf[bi >> 2], mask); tcg_gen_brcondi_i32(TCG_COND_EQ, temp, 0, VAR_2); } else { tcg_gen_andi_i32(temp, cpu_crf[bi >> 2], mask); tcg_gen_brcondi_i32(TCG_COND_NE, temp, 0, VAR_2); } tcg_temp_free_i32(temp); } gen_update_cfar(VAR_0, VAR_0->nip); if (VAR_1 == BCOND_IM) { target_ulong li = (target_long)((int16_t)(BD(VAR_0->opcode))); if (likely(AA(VAR_0->opcode) == 0)) { gen_goto_tb(VAR_0, 0, VAR_0->nip + li - 4); } else { gen_goto_tb(VAR_0, 0, li); } gen_set_label(VAR_2); gen_goto_tb(VAR_0, 1, VAR_0->nip); } else { if (NARROW_MODE(VAR_0)) { tcg_gen_andi_tl(cpu_nip, target, (uint32_t)~3); } else { tcg_gen_andi_tl(cpu_nip, target, ~3); } tcg_gen_exit_tb(0); gen_set_label(VAR_2); gen_update_nip(VAR_0, VAR_0->nip); tcg_gen_exit_tb(0); } if (VAR_1 == BCOND_LR || VAR_1 == BCOND_CTR) { tcg_temp_free(target); } }
[ "static inline void FUNC_0(DisasContext *VAR_0, int VAR_1)\n{", "uint32_t bo = BO(VAR_0->opcode);", "int VAR_2;", "TCGv target;", "VAR_0->exception = POWERPC_EXCP_BRANCH;", "if (VAR_1 == BCOND_LR || VAR_1 == BCOND_CTR || VAR_1 == BCOND_TAR) {", "target = tcg_temp_local_new();", "if (VAR_1 == BCOND_CTR)\ntcg_gen_mov_tl(target, cpu_ctr);", "else if (VAR_1 == BCOND_TAR)\ngen_load_spr(target, SPR_TAR);", "else\ntcg_gen_mov_tl(target, cpu_lr);", "} else {", "TCGV_UNUSED(target);", "}", "if (LK(VAR_0->opcode))\ngen_setlr(VAR_0, VAR_0->nip);", "VAR_2 = gen_new_label();", "if ((bo & 0x4) == 0) {", "TCGv temp = tcg_temp_new();", "if (unlikely(VAR_1 == BCOND_CTR)) {", "gen_inval_exception(VAR_0, POWERPC_EXCP_INVAL_INVAL);", "return;", "}", "tcg_gen_subi_tl(cpu_ctr, cpu_ctr, 1);", "if (NARROW_MODE(VAR_0)) {", "tcg_gen_ext32u_tl(temp, cpu_ctr);", "} else {", "tcg_gen_mov_tl(temp, cpu_ctr);", "}", "if (bo & 0x2) {", "tcg_gen_brcondi_tl(TCG_COND_NE, temp, 0, VAR_2);", "} else {", "tcg_gen_brcondi_tl(TCG_COND_EQ, temp, 0, VAR_2);", "}", "tcg_temp_free(temp);", "}", "if ((bo & 0x10) == 0) {", "uint32_t bi = BI(VAR_0->opcode);", "uint32_t mask = 1 << (3 - (bi & 0x03));", "TCGv_i32 temp = tcg_temp_new_i32();", "if (bo & 0x8) {", "tcg_gen_andi_i32(temp, cpu_crf[bi >> 2], mask);", "tcg_gen_brcondi_i32(TCG_COND_EQ, temp, 0, VAR_2);", "} else {", "tcg_gen_andi_i32(temp, cpu_crf[bi >> 2], mask);", "tcg_gen_brcondi_i32(TCG_COND_NE, temp, 0, VAR_2);", "}", "tcg_temp_free_i32(temp);", "}", "gen_update_cfar(VAR_0, VAR_0->nip);", "if (VAR_1 == BCOND_IM) {", "target_ulong li = (target_long)((int16_t)(BD(VAR_0->opcode)));", "if (likely(AA(VAR_0->opcode) == 0)) {", "gen_goto_tb(VAR_0, 0, VAR_0->nip + li - 4);", "} else {", "gen_goto_tb(VAR_0, 0, li);", "}", "gen_set_label(VAR_2);", "gen_goto_tb(VAR_0, 1, VAR_0->nip);", "} else {", "if (NARROW_MODE(VAR_0)) {", "tcg_gen_andi_tl(cpu_nip, target, (uint32_t)~3);", "} else {", "tcg_gen_andi_tl(cpu_nip, target, ~3);", "}", "tcg_gen_exit_tb(0);", "gen_set_label(VAR_2);", "gen_update_nip(VAR_0, VAR_0->nip);", "tcg_gen_exit_tb(0);", "}", "if (VAR_1 == BCOND_LR || VAR_1 == BCOND_CTR) {", "tcg_temp_free(target);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19, 21 ], [ 23, 25 ], [ 27, 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37, 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 87 ], [ 89 ], [ 91 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ] ]
20,030
void arm_handle_psci_call(ARMCPU *cpu) { /* * This function partially implements the logic for dispatching Power State * Coordination Interface (PSCI) calls (as described in ARM DEN 0022B.b), * to the extent required for bringing up and taking down secondary cores, * and for handling reset and poweroff requests. * Additional information about the calling convention used is available in * the document 'SMC Calling Convention' (ARM DEN 0028) */ CPUARMState *env = &cpu->env; uint64_t param[4]; uint64_t context_id, mpidr; target_ulong entry; int32_t ret = 0; int i; for (i = 0; i < 4; i++) { /* * All PSCI functions take explicit 32-bit or native int sized * arguments so we can simply zero-extend all arguments regardless * of which exact function we are about to call. */ param[i] = is_a64(env) ? env->xregs[i] : env->regs[i]; } if ((param[0] & QEMU_PSCI_0_2_64BIT) && !is_a64(env)) { ret = QEMU_PSCI_RET_INVALID_PARAMS; goto err; } switch (param[0]) { CPUState *target_cpu_state; ARMCPU *target_cpu; case QEMU_PSCI_0_2_FN_PSCI_VERSION: ret = QEMU_PSCI_0_2_RET_VERSION_0_2; break; case QEMU_PSCI_0_2_FN_MIGRATE_INFO_TYPE: ret = QEMU_PSCI_0_2_RET_TOS_MIGRATION_NOT_REQUIRED; /* No trusted OS */ break; case QEMU_PSCI_0_2_FN_AFFINITY_INFO: case QEMU_PSCI_0_2_FN64_AFFINITY_INFO: mpidr = param[1]; switch (param[2]) { case 0: target_cpu_state = arm_get_cpu_by_id(mpidr); if (!target_cpu_state) { ret = QEMU_PSCI_RET_INVALID_PARAMS; break; } target_cpu = ARM_CPU(target_cpu_state); ret = target_cpu->powered_off ? 1 : 0; break; default: /* Everything above affinity level 0 is always on. */ ret = 0; } break; case QEMU_PSCI_0_2_FN_SYSTEM_RESET: qemu_system_reset_request(); /* QEMU reset and shutdown are async requests, but PSCI * mandates that we never return from the reset/shutdown * call, so power the CPU off now so it doesn't execute * anything further. */ goto cpu_off; case QEMU_PSCI_0_2_FN_SYSTEM_OFF: qemu_system_shutdown_request(); goto cpu_off; case QEMU_PSCI_0_1_FN_CPU_ON: case QEMU_PSCI_0_2_FN_CPU_ON: case QEMU_PSCI_0_2_FN64_CPU_ON: { /* The PSCI spec mandates that newly brought up CPUs start * in the highest exception level which exists and is enabled * on the calling CPU. Since the QEMU PSCI implementation is * acting as a "fake EL3" or "fake EL2" firmware, this for us * means that we want to start at the highest NS exception level * that we are providing to the guest. * The execution mode should be that which is currently in use * by the same exception level on the calling CPU. * The CPU should be started with the context_id value * in x0 (if AArch64) or r0 (if AArch32). */ int target_el = arm_feature(env, ARM_FEATURE_EL2) ? 2 : 1; bool target_aarch64 = arm_el_is_aa64(env, target_el); mpidr = param[1]; entry = param[2]; context_id = param[3]; ret = arm_set_cpu_on(mpidr, entry, context_id, target_el, target_aarch64); break; } case QEMU_PSCI_0_1_FN_CPU_OFF: case QEMU_PSCI_0_2_FN_CPU_OFF: goto cpu_off; case QEMU_PSCI_0_1_FN_CPU_SUSPEND: case QEMU_PSCI_0_2_FN_CPU_SUSPEND: case QEMU_PSCI_0_2_FN64_CPU_SUSPEND: /* Affinity levels are not supported in QEMU */ if (param[1] & 0xfffe0000) { ret = QEMU_PSCI_RET_INVALID_PARAMS; break; } /* Powerdown is not supported, we always go into WFI */ if (is_a64(env)) { env->xregs[0] = 0; } else { env->regs[0] = 0; } helper_wfi(env); break; case QEMU_PSCI_0_1_FN_MIGRATE: case QEMU_PSCI_0_2_FN_MIGRATE: ret = QEMU_PSCI_RET_NOT_SUPPORTED; break; default: g_assert_not_reached(); } err: if (is_a64(env)) { env->xregs[0] = ret; } else { env->regs[0] = ret; } return; cpu_off: ret = arm_set_cpu_off(cpu->mp_affinity); /* notreached */ /* sanity check in case something failed */ assert(ret == QEMU_ARM_POWERCTL_RET_SUCCESS); }
true
qemu
062ba099e01ff1474be98c0a4f3da351efab5d9d
void arm_handle_psci_call(ARMCPU *cpu) { CPUARMState *env = &cpu->env; uint64_t param[4]; uint64_t context_id, mpidr; target_ulong entry; int32_t ret = 0; int i; for (i = 0; i < 4; i++) { param[i] = is_a64(env) ? env->xregs[i] : env->regs[i]; } if ((param[0] & QEMU_PSCI_0_2_64BIT) && !is_a64(env)) { ret = QEMU_PSCI_RET_INVALID_PARAMS; goto err; } switch (param[0]) { CPUState *target_cpu_state; ARMCPU *target_cpu; case QEMU_PSCI_0_2_FN_PSCI_VERSION: ret = QEMU_PSCI_0_2_RET_VERSION_0_2; break; case QEMU_PSCI_0_2_FN_MIGRATE_INFO_TYPE: ret = QEMU_PSCI_0_2_RET_TOS_MIGRATION_NOT_REQUIRED; break; case QEMU_PSCI_0_2_FN_AFFINITY_INFO: case QEMU_PSCI_0_2_FN64_AFFINITY_INFO: mpidr = param[1]; switch (param[2]) { case 0: target_cpu_state = arm_get_cpu_by_id(mpidr); if (!target_cpu_state) { ret = QEMU_PSCI_RET_INVALID_PARAMS; break; } target_cpu = ARM_CPU(target_cpu_state); ret = target_cpu->powered_off ? 1 : 0; break; default: ret = 0; } break; case QEMU_PSCI_0_2_FN_SYSTEM_RESET: qemu_system_reset_request(); goto cpu_off; case QEMU_PSCI_0_2_FN_SYSTEM_OFF: qemu_system_shutdown_request(); goto cpu_off; case QEMU_PSCI_0_1_FN_CPU_ON: case QEMU_PSCI_0_2_FN_CPU_ON: case QEMU_PSCI_0_2_FN64_CPU_ON: { int target_el = arm_feature(env, ARM_FEATURE_EL2) ? 2 : 1; bool target_aarch64 = arm_el_is_aa64(env, target_el); mpidr = param[1]; entry = param[2]; context_id = param[3]; ret = arm_set_cpu_on(mpidr, entry, context_id, target_el, target_aarch64); break; } case QEMU_PSCI_0_1_FN_CPU_OFF: case QEMU_PSCI_0_2_FN_CPU_OFF: goto cpu_off; case QEMU_PSCI_0_1_FN_CPU_SUSPEND: case QEMU_PSCI_0_2_FN_CPU_SUSPEND: case QEMU_PSCI_0_2_FN64_CPU_SUSPEND: if (param[1] & 0xfffe0000) { ret = QEMU_PSCI_RET_INVALID_PARAMS; break; } if (is_a64(env)) { env->xregs[0] = 0; } else { env->regs[0] = 0; } helper_wfi(env); break; case QEMU_PSCI_0_1_FN_MIGRATE: case QEMU_PSCI_0_2_FN_MIGRATE: ret = QEMU_PSCI_RET_NOT_SUPPORTED; break; default: g_assert_not_reached(); } err: if (is_a64(env)) { env->xregs[0] = ret; } else { env->regs[0] = ret; } return; cpu_off: ret = arm_set_cpu_off(cpu->mp_affinity); assert(ret == QEMU_ARM_POWERCTL_RET_SUCCESS); }
{ "code": [ " } else {", " } else {", " } else {", " ret = target_cpu->powered_off ? 1 : 0;" ], "line_no": [ 253, 253, 253, 107 ] }
void FUNC_0(ARMCPU *VAR_0) { CPUARMState *env = &VAR_0->env; uint64_t param[4]; uint64_t context_id, mpidr; target_ulong entry; int32_t ret = 0; int VAR_1; for (VAR_1 = 0; VAR_1 < 4; VAR_1++) { param[VAR_1] = is_a64(env) ? env->xregs[VAR_1] : env->regs[VAR_1]; } if ((param[0] & QEMU_PSCI_0_2_64BIT) && !is_a64(env)) { ret = QEMU_PSCI_RET_INVALID_PARAMS; goto err; } switch (param[0]) { CPUState *target_cpu_state; ARMCPU *target_cpu; case QEMU_PSCI_0_2_FN_PSCI_VERSION: ret = QEMU_PSCI_0_2_RET_VERSION_0_2; break; case QEMU_PSCI_0_2_FN_MIGRATE_INFO_TYPE: ret = QEMU_PSCI_0_2_RET_TOS_MIGRATION_NOT_REQUIRED; break; case QEMU_PSCI_0_2_FN_AFFINITY_INFO: case QEMU_PSCI_0_2_FN64_AFFINITY_INFO: mpidr = param[1]; switch (param[2]) { case 0: target_cpu_state = arm_get_cpu_by_id(mpidr); if (!target_cpu_state) { ret = QEMU_PSCI_RET_INVALID_PARAMS; break; } target_cpu = ARM_CPU(target_cpu_state); ret = target_cpu->powered_off ? 1 : 0; break; default: ret = 0; } break; case QEMU_PSCI_0_2_FN_SYSTEM_RESET: qemu_system_reset_request(); goto cpu_off; case QEMU_PSCI_0_2_FN_SYSTEM_OFF: qemu_system_shutdown_request(); goto cpu_off; case QEMU_PSCI_0_1_FN_CPU_ON: case QEMU_PSCI_0_2_FN_CPU_ON: case QEMU_PSCI_0_2_FN64_CPU_ON: { int VAR_2 = arm_feature(env, ARM_FEATURE_EL2) ? 2 : 1; bool target_aarch64 = arm_el_is_aa64(env, VAR_2); mpidr = param[1]; entry = param[2]; context_id = param[3]; ret = arm_set_cpu_on(mpidr, entry, context_id, VAR_2, target_aarch64); break; } case QEMU_PSCI_0_1_FN_CPU_OFF: case QEMU_PSCI_0_2_FN_CPU_OFF: goto cpu_off; case QEMU_PSCI_0_1_FN_CPU_SUSPEND: case QEMU_PSCI_0_2_FN_CPU_SUSPEND: case QEMU_PSCI_0_2_FN64_CPU_SUSPEND: if (param[1] & 0xfffe0000) { ret = QEMU_PSCI_RET_INVALID_PARAMS; break; } if (is_a64(env)) { env->xregs[0] = 0; } else { env->regs[0] = 0; } helper_wfi(env); break; case QEMU_PSCI_0_1_FN_MIGRATE: case QEMU_PSCI_0_2_FN_MIGRATE: ret = QEMU_PSCI_RET_NOT_SUPPORTED; break; default: g_assert_not_reached(); } err: if (is_a64(env)) { env->xregs[0] = ret; } else { env->regs[0] = ret; } return; cpu_off: ret = arm_set_cpu_off(VAR_0->mp_affinity); assert(ret == QEMU_ARM_POWERCTL_RET_SUCCESS); }
[ "void FUNC_0(ARMCPU *VAR_0)\n{", "CPUARMState *env = &VAR_0->env;", "uint64_t param[4];", "uint64_t context_id, mpidr;", "target_ulong entry;", "int32_t ret = 0;", "int VAR_1;", "for (VAR_1 = 0; VAR_1 < 4; VAR_1++) {", "param[VAR_1] = is_a64(env) ? env->xregs[VAR_1] : env->regs[VAR_1];", "}", "if ((param[0] & QEMU_PSCI_0_2_64BIT) && !is_a64(env)) {", "ret = QEMU_PSCI_RET_INVALID_PARAMS;", "goto err;", "}", "switch (param[0]) {", "CPUState *target_cpu_state;", "ARMCPU *target_cpu;", "case QEMU_PSCI_0_2_FN_PSCI_VERSION:\nret = QEMU_PSCI_0_2_RET_VERSION_0_2;", "break;", "case QEMU_PSCI_0_2_FN_MIGRATE_INFO_TYPE:\nret = QEMU_PSCI_0_2_RET_TOS_MIGRATION_NOT_REQUIRED;", "break;", "case QEMU_PSCI_0_2_FN_AFFINITY_INFO:\ncase QEMU_PSCI_0_2_FN64_AFFINITY_INFO:\nmpidr = param[1];", "switch (param[2]) {", "case 0:\ntarget_cpu_state = arm_get_cpu_by_id(mpidr);", "if (!target_cpu_state) {", "ret = QEMU_PSCI_RET_INVALID_PARAMS;", "break;", "}", "target_cpu = ARM_CPU(target_cpu_state);", "ret = target_cpu->powered_off ? 1 : 0;", "break;", "default:\nret = 0;", "}", "break;", "case QEMU_PSCI_0_2_FN_SYSTEM_RESET:\nqemu_system_reset_request();", "goto cpu_off;", "case QEMU_PSCI_0_2_FN_SYSTEM_OFF:\nqemu_system_shutdown_request();", "goto cpu_off;", "case QEMU_PSCI_0_1_FN_CPU_ON:\ncase QEMU_PSCI_0_2_FN_CPU_ON:\ncase QEMU_PSCI_0_2_FN64_CPU_ON:\n{", "int VAR_2 = arm_feature(env, ARM_FEATURE_EL2) ? 2 : 1;", "bool target_aarch64 = arm_el_is_aa64(env, VAR_2);", "mpidr = param[1];", "entry = param[2];", "context_id = param[3];", "ret = arm_set_cpu_on(mpidr, entry, context_id,\nVAR_2, target_aarch64);", "break;", "}", "case QEMU_PSCI_0_1_FN_CPU_OFF:\ncase QEMU_PSCI_0_2_FN_CPU_OFF:\ngoto cpu_off;", "case QEMU_PSCI_0_1_FN_CPU_SUSPEND:\ncase QEMU_PSCI_0_2_FN_CPU_SUSPEND:\ncase QEMU_PSCI_0_2_FN64_CPU_SUSPEND:\nif (param[1] & 0xfffe0000) {", "ret = QEMU_PSCI_RET_INVALID_PARAMS;", "break;", "}", "if (is_a64(env)) {", "env->xregs[0] = 0;", "} else {", "env->regs[0] = 0;", "}", "helper_wfi(env);", "break;", "case QEMU_PSCI_0_1_FN_MIGRATE:\ncase QEMU_PSCI_0_2_FN_MIGRATE:\nret = QEMU_PSCI_RET_NOT_SUPPORTED;", "break;", "default:\ng_assert_not_reached();", "}", "err:\nif (is_a64(env)) {", "env->xregs[0] = ret;", "} else {", "env->regs[0] = ret;", "}", "return;", "cpu_off:\nret = arm_set_cpu_off(VAR_0->mp_affinity);", "assert(ret == QEMU_ARM_POWERCTL_RET_SUCCESS);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ], [ 67 ], [ 71, 73 ], [ 75 ], [ 77, 79 ], [ 81 ], [ 83, 85, 87 ], [ 91 ], [ 93, 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111, 115 ], [ 117 ], [ 119 ], [ 121, 123 ], [ 135 ], [ 137, 139 ], [ 141 ], [ 143, 145, 147, 149 ], [ 173 ], [ 175 ], [ 179 ], [ 181 ], [ 183 ], [ 185, 187 ], [ 189 ], [ 191 ], [ 193, 195, 197 ], [ 199, 201, 203, 207 ], [ 209 ], [ 211 ], [ 213 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ], [ 225 ], [ 227 ], [ 229 ], [ 231, 233, 235 ], [ 237 ], [ 239, 241 ], [ 243 ], [ 247, 249 ], [ 251 ], [ 253 ], [ 255 ], [ 257 ], [ 259 ], [ 263, 265 ], [ 271 ], [ 273 ] ]
20,031
static inline int gen_iwmmxt_address(DisasContext *s, uint32_t insn, TCGv dest) { int rd; uint32_t offset; TCGv tmp; rd = (insn >> 16) & 0xf; tmp = load_reg(s, rd); offset = (insn & 0xff) << ((insn >> 7) & 2); if (insn & (1 << 24)) { /* Pre indexed */ if (insn & (1 << 23)) tcg_gen_addi_i32(tmp, tmp, offset); else tcg_gen_addi_i32(tmp, tmp, -offset); tcg_gen_mov_i32(dest, tmp); if (insn & (1 << 21)) store_reg(s, rd, tmp); else dead_tmp(tmp); } else if (insn & (1 << 21)) { /* Post indexed */ tcg_gen_mov_i32(dest, tmp); if (insn & (1 << 23)) tcg_gen_addi_i32(tmp, tmp, offset); else tcg_gen_addi_i32(tmp, tmp, -offset); store_reg(s, rd, tmp); } else if (!(insn & (1 << 23))) return 1; return 0; }
true
qemu
7d1b0095bff7157e856d1d0e6c4295641ced2752
static inline int gen_iwmmxt_address(DisasContext *s, uint32_t insn, TCGv dest) { int rd; uint32_t offset; TCGv tmp; rd = (insn >> 16) & 0xf; tmp = load_reg(s, rd); offset = (insn & 0xff) << ((insn >> 7) & 2); if (insn & (1 << 24)) { if (insn & (1 << 23)) tcg_gen_addi_i32(tmp, tmp, offset); else tcg_gen_addi_i32(tmp, tmp, -offset); tcg_gen_mov_i32(dest, tmp); if (insn & (1 << 21)) store_reg(s, rd, tmp); else dead_tmp(tmp); } else if (insn & (1 << 21)) { tcg_gen_mov_i32(dest, tmp); if (insn & (1 << 23)) tcg_gen_addi_i32(tmp, tmp, offset); else tcg_gen_addi_i32(tmp, tmp, -offset); store_reg(s, rd, tmp); } else if (!(insn & (1 << 23))) return 1; return 0; }
{ "code": [ " dead_tmp(tmp);", " dead_tmp(tmp);", " dead_tmp(tmp);", " dead_tmp(tmp);", " dead_tmp(tmp);", " dead_tmp(tmp);", " dead_tmp(tmp);", " dead_tmp(tmp);", " dead_tmp(tmp);", " dead_tmp(tmp);", " dead_tmp(tmp);", " dead_tmp(tmp);", " dead_tmp(tmp);", " dead_tmp(tmp);", " dead_tmp(tmp);" ], "line_no": [ 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41 ] }
static inline int FUNC_0(DisasContext *VAR_0, uint32_t VAR_1, TCGv VAR_2) { int VAR_3; uint32_t offset; TCGv tmp; VAR_3 = (VAR_1 >> 16) & 0xf; tmp = load_reg(VAR_0, VAR_3); offset = (VAR_1 & 0xff) << ((VAR_1 >> 7) & 2); if (VAR_1 & (1 << 24)) { if (VAR_1 & (1 << 23)) tcg_gen_addi_i32(tmp, tmp, offset); else tcg_gen_addi_i32(tmp, tmp, -offset); tcg_gen_mov_i32(VAR_2, tmp); if (VAR_1 & (1 << 21)) store_reg(VAR_0, VAR_3, tmp); else dead_tmp(tmp); } else if (VAR_1 & (1 << 21)) { tcg_gen_mov_i32(VAR_2, tmp); if (VAR_1 & (1 << 23)) tcg_gen_addi_i32(tmp, tmp, offset); else tcg_gen_addi_i32(tmp, tmp, -offset); store_reg(VAR_0, VAR_3, tmp); } else if (!(VAR_1 & (1 << 23))) return 1; return 0; }
[ "static inline int FUNC_0(DisasContext *VAR_0, uint32_t VAR_1, TCGv VAR_2)\n{", "int VAR_3;", "uint32_t offset;", "TCGv tmp;", "VAR_3 = (VAR_1 >> 16) & 0xf;", "tmp = load_reg(VAR_0, VAR_3);", "offset = (VAR_1 & 0xff) << ((VAR_1 >> 7) & 2);", "if (VAR_1 & (1 << 24)) {", "if (VAR_1 & (1 << 23))\ntcg_gen_addi_i32(tmp, tmp, offset);", "else\ntcg_gen_addi_i32(tmp, tmp, -offset);", "tcg_gen_mov_i32(VAR_2, tmp);", "if (VAR_1 & (1 << 21))\nstore_reg(VAR_0, VAR_3, tmp);", "else\ndead_tmp(tmp);", "} else if (VAR_1 & (1 << 21)) {", "tcg_gen_mov_i32(VAR_2, tmp);", "if (VAR_1 & (1 << 23))\ntcg_gen_addi_i32(tmp, tmp, offset);", "else\ntcg_gen_addi_i32(tmp, tmp, -offset);", "store_reg(VAR_0, VAR_3, tmp);", "} else if (!(VAR_1 & (1 << 23)))", "return 1;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 25, 27 ], [ 29, 31 ], [ 33 ], [ 35, 37 ], [ 39, 41 ], [ 43 ], [ 47 ], [ 49, 51 ], [ 53, 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ] ]
20,033
static MOVFragmentStreamInfo * get_current_frag_stream_info( MOVFragmentIndex *frag_index) { MOVFragmentIndexItem * item = &frag_index->item[frag_index->current]; if (item->current >= 0 && item->current < item->nb_stream_info) return &item->stream_info[item->current]; // This shouldn't happen }
true
FFmpeg
20c38f2e7085ce02c19df965d02ecdf5628f11b8
static MOVFragmentStreamInfo * get_current_frag_stream_info( MOVFragmentIndex *frag_index) { MOVFragmentIndexItem * item = &frag_index->item[frag_index->current]; if (item->current >= 0 && item->current < item->nb_stream_info) return &item->stream_info[item->current]; }
{ "code": [], "line_no": [] }
static MOVFragmentStreamInfo * FUNC_0( MOVFragmentIndex *frag_index) { MOVFragmentIndexItem * item = &frag_index->item[frag_index->current]; if (item->current >= 0 && item->current < item->nb_stream_info) return &item->stream_info[item->current]; }
[ "static MOVFragmentStreamInfo * FUNC_0(\nMOVFragmentIndex *frag_index)\n{", "MOVFragmentIndexItem * item = &frag_index->item[frag_index->current];", "if (item->current >= 0 && item->current < item->nb_stream_info)\nreturn &item->stream_info[item->current];", "}" ]
[ 0, 0, 0, 0 ]
[ [ 1, 2, 3 ], [ 4 ], [ 5, 6 ], [ 8 ] ]
20,037
static void v9fs_wstat(void *opaque) { int32_t fid; int err = 0; int16_t unused; V9fsStat v9stat; size_t offset = 7; struct stat stbuf; V9fsFidState *fidp; V9fsPDU *pdu = opaque; V9fsState *s = pdu->s; pdu_unmarshal(pdu, offset, "dwS", &fid, &unused, &v9stat); fidp = get_fid(pdu, fid); if (fidp == NULL) { err = -EINVAL; goto out_nofid; } /* do we need to sync the file? */ if (donttouch_stat(&v9stat)) { err = v9fs_co_fsync(pdu, fidp, 0); goto out; } if (v9stat.mode != -1) { uint32_t v9_mode; err = v9fs_co_lstat(pdu, &fidp->path, &stbuf); if (err < 0) { goto out; } v9_mode = stat_to_v9mode(&stbuf); if ((v9stat.mode & P9_STAT_MODE_TYPE_BITS) != (v9_mode & P9_STAT_MODE_TYPE_BITS)) { /* Attempting to change the type */ err = -EIO; goto out; } err = v9fs_co_chmod(pdu, &fidp->path, v9mode_to_mode(v9stat.mode, &v9stat.extension)); if (err < 0) { goto out; } } if (v9stat.mtime != -1 || v9stat.atime != -1) { struct timespec times[2]; if (v9stat.atime != -1) { times[0].tv_sec = v9stat.atime; times[0].tv_nsec = 0; } else { times[0].tv_nsec = UTIME_OMIT; } if (v9stat.mtime != -1) { times[1].tv_sec = v9stat.mtime; times[1].tv_nsec = 0; } else { times[1].tv_nsec = UTIME_OMIT; } err = v9fs_co_utimensat(pdu, &fidp->path, times); if (err < 0) { goto out; } } if (v9stat.n_gid != -1 || v9stat.n_uid != -1) { err = v9fs_co_chown(pdu, &fidp->path, v9stat.n_uid, v9stat.n_gid); if (err < 0) { goto out; } } if (v9stat.name.size != 0) { err = v9fs_complete_rename(pdu, fidp, -1, &v9stat.name); if (err < 0) { goto out; } } if (v9stat.length != -1) { err = v9fs_co_truncate(pdu, &fidp->path, v9stat.length); if (err < 0) { goto out; } } err = offset; out: put_fid(pdu, fidp); out_nofid: v9fs_stat_free(&v9stat); complete_pdu(s, pdu, err); }
true
qemu
c572f23a3e7180dbeab5e86583e43ea2afed6271
static void v9fs_wstat(void *opaque) { int32_t fid; int err = 0; int16_t unused; V9fsStat v9stat; size_t offset = 7; struct stat stbuf; V9fsFidState *fidp; V9fsPDU *pdu = opaque; V9fsState *s = pdu->s; pdu_unmarshal(pdu, offset, "dwS", &fid, &unused, &v9stat); fidp = get_fid(pdu, fid); if (fidp == NULL) { err = -EINVAL; goto out_nofid; } if (donttouch_stat(&v9stat)) { err = v9fs_co_fsync(pdu, fidp, 0); goto out; } if (v9stat.mode != -1) { uint32_t v9_mode; err = v9fs_co_lstat(pdu, &fidp->path, &stbuf); if (err < 0) { goto out; } v9_mode = stat_to_v9mode(&stbuf); if ((v9stat.mode & P9_STAT_MODE_TYPE_BITS) != (v9_mode & P9_STAT_MODE_TYPE_BITS)) { err = -EIO; goto out; } err = v9fs_co_chmod(pdu, &fidp->path, v9mode_to_mode(v9stat.mode, &v9stat.extension)); if (err < 0) { goto out; } } if (v9stat.mtime != -1 || v9stat.atime != -1) { struct timespec times[2]; if (v9stat.atime != -1) { times[0].tv_sec = v9stat.atime; times[0].tv_nsec = 0; } else { times[0].tv_nsec = UTIME_OMIT; } if (v9stat.mtime != -1) { times[1].tv_sec = v9stat.mtime; times[1].tv_nsec = 0; } else { times[1].tv_nsec = UTIME_OMIT; } err = v9fs_co_utimensat(pdu, &fidp->path, times); if (err < 0) { goto out; } } if (v9stat.n_gid != -1 || v9stat.n_uid != -1) { err = v9fs_co_chown(pdu, &fidp->path, v9stat.n_uid, v9stat.n_gid); if (err < 0) { goto out; } } if (v9stat.name.size != 0) { err = v9fs_complete_rename(pdu, fidp, -1, &v9stat.name); if (err < 0) { goto out; } } if (v9stat.length != -1) { err = v9fs_co_truncate(pdu, &fidp->path, v9stat.length); if (err < 0) { goto out; } } err = offset; out: put_fid(pdu, fidp); out_nofid: v9fs_stat_free(&v9stat); complete_pdu(s, pdu, err); }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0) { int32_t fid; int VAR_1 = 0; int16_t unused; V9fsStat v9stat; size_t offset = 7; struct stat VAR_2; V9fsFidState *fidp; V9fsPDU *pdu = VAR_0; V9fsState *s = pdu->s; pdu_unmarshal(pdu, offset, "dwS", &fid, &unused, &v9stat); fidp = get_fid(pdu, fid); if (fidp == NULL) { VAR_1 = -EINVAL; goto out_nofid; } if (donttouch_stat(&v9stat)) { VAR_1 = v9fs_co_fsync(pdu, fidp, 0); goto out; } if (v9stat.mode != -1) { uint32_t v9_mode; VAR_1 = v9fs_co_lstat(pdu, &fidp->path, &VAR_2); if (VAR_1 < 0) { goto out; } v9_mode = stat_to_v9mode(&VAR_2); if ((v9stat.mode & P9_STAT_MODE_TYPE_BITS) != (v9_mode & P9_STAT_MODE_TYPE_BITS)) { VAR_1 = -EIO; goto out; } VAR_1 = v9fs_co_chmod(pdu, &fidp->path, v9mode_to_mode(v9stat.mode, &v9stat.extension)); if (VAR_1 < 0) { goto out; } } if (v9stat.mtime != -1 || v9stat.atime != -1) { struct timespec VAR_3[2]; if (v9stat.atime != -1) { VAR_3[0].tv_sec = v9stat.atime; VAR_3[0].tv_nsec = 0; } else { VAR_3[0].tv_nsec = UTIME_OMIT; } if (v9stat.mtime != -1) { VAR_3[1].tv_sec = v9stat.mtime; VAR_3[1].tv_nsec = 0; } else { VAR_3[1].tv_nsec = UTIME_OMIT; } VAR_1 = v9fs_co_utimensat(pdu, &fidp->path, VAR_3); if (VAR_1 < 0) { goto out; } } if (v9stat.n_gid != -1 || v9stat.n_uid != -1) { VAR_1 = v9fs_co_chown(pdu, &fidp->path, v9stat.n_uid, v9stat.n_gid); if (VAR_1 < 0) { goto out; } } if (v9stat.name.size != 0) { VAR_1 = v9fs_complete_rename(pdu, fidp, -1, &v9stat.name); if (VAR_1 < 0) { goto out; } } if (v9stat.length != -1) { VAR_1 = v9fs_co_truncate(pdu, &fidp->path, v9stat.length); if (VAR_1 < 0) { goto out; } } VAR_1 = offset; out: put_fid(pdu, fidp); out_nofid: v9fs_stat_free(&v9stat); complete_pdu(s, pdu, VAR_1); }
[ "static void FUNC_0(void *VAR_0)\n{", "int32_t fid;", "int VAR_1 = 0;", "int16_t unused;", "V9fsStat v9stat;", "size_t offset = 7;", "struct stat VAR_2;", "V9fsFidState *fidp;", "V9fsPDU *pdu = VAR_0;", "V9fsState *s = pdu->s;", "pdu_unmarshal(pdu, offset, \"dwS\", &fid, &unused, &v9stat);", "fidp = get_fid(pdu, fid);", "if (fidp == NULL) {", "VAR_1 = -EINVAL;", "goto out_nofid;", "}", "if (donttouch_stat(&v9stat)) {", "VAR_1 = v9fs_co_fsync(pdu, fidp, 0);", "goto out;", "}", "if (v9stat.mode != -1) {", "uint32_t v9_mode;", "VAR_1 = v9fs_co_lstat(pdu, &fidp->path, &VAR_2);", "if (VAR_1 < 0) {", "goto out;", "}", "v9_mode = stat_to_v9mode(&VAR_2);", "if ((v9stat.mode & P9_STAT_MODE_TYPE_BITS) !=\n(v9_mode & P9_STAT_MODE_TYPE_BITS)) {", "VAR_1 = -EIO;", "goto out;", "}", "VAR_1 = v9fs_co_chmod(pdu, &fidp->path,\nv9mode_to_mode(v9stat.mode,\n&v9stat.extension));", "if (VAR_1 < 0) {", "goto out;", "}", "}", "if (v9stat.mtime != -1 || v9stat.atime != -1) {", "struct timespec VAR_3[2];", "if (v9stat.atime != -1) {", "VAR_3[0].tv_sec = v9stat.atime;", "VAR_3[0].tv_nsec = 0;", "} else {", "VAR_3[0].tv_nsec = UTIME_OMIT;", "}", "if (v9stat.mtime != -1) {", "VAR_3[1].tv_sec = v9stat.mtime;", "VAR_3[1].tv_nsec = 0;", "} else {", "VAR_3[1].tv_nsec = UTIME_OMIT;", "}", "VAR_1 = v9fs_co_utimensat(pdu, &fidp->path, VAR_3);", "if (VAR_1 < 0) {", "goto out;", "}", "}", "if (v9stat.n_gid != -1 || v9stat.n_uid != -1) {", "VAR_1 = v9fs_co_chown(pdu, &fidp->path, v9stat.n_uid, v9stat.n_gid);", "if (VAR_1 < 0) {", "goto out;", "}", "}", "if (v9stat.name.size != 0) {", "VAR_1 = v9fs_complete_rename(pdu, fidp, -1, &v9stat.name);", "if (VAR_1 < 0) {", "goto out;", "}", "}", "if (v9stat.length != -1) {", "VAR_1 = v9fs_co_truncate(pdu, &fidp->path, v9stat.length);", "if (VAR_1 < 0) {", "goto out;", "}", "}", "VAR_1 = offset;", "out:\nput_fid(pdu, fidp);", "out_nofid:\nv9fs_stat_free(&v9stat);", "complete_pdu(s, pdu, VAR_1);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65, 67 ], [ 71 ], [ 73 ], [ 75 ], [ 77, 79, 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167, 169 ], [ 171, 173 ], [ 175 ], [ 177 ] ]
20,038
static void vnc_colordepth(VncState *vs) { if (vnc_has_feature(vs, VNC_FEATURE_WMVI)) { /* Sending a WMVi message to notify the client*/ vnc_lock_output(vs); vnc_write_u8(vs, VNC_MSG_SERVER_FRAMEBUFFER_UPDATE); vnc_write_u8(vs, 0); vnc_write_u16(vs, 1); /* number of rects */ vnc_framebuffer_update(vs, 0, 0, surface_width(vs->vd->ds), surface_height(vs->vd->ds), VNC_ENCODING_WMVi); pixel_format_message(vs); vnc_unlock_output(vs); vnc_flush(vs); } else { set_pixel_conversion(vs); } }
true
qemu
bea60dd7679364493a0d7f5b54316c767cf894ef
static void vnc_colordepth(VncState *vs) { if (vnc_has_feature(vs, VNC_FEATURE_WMVI)) { vnc_lock_output(vs); vnc_write_u8(vs, VNC_MSG_SERVER_FRAMEBUFFER_UPDATE); vnc_write_u8(vs, 0); vnc_write_u16(vs, 1); vnc_framebuffer_update(vs, 0, 0, surface_width(vs->vd->ds), surface_height(vs->vd->ds), VNC_ENCODING_WMVi); pixel_format_message(vs); vnc_unlock_output(vs); vnc_flush(vs); } else { set_pixel_conversion(vs); } }
{ "code": [ " surface_width(vs->vd->ds),", " surface_height(vs->vd->ds),", " surface_width(vs->vd->ds),", " surface_height(vs->vd->ds)," ], "line_no": [ 19, 21, 19, 21 ] }
static void FUNC_0(VncState *VAR_0) { if (vnc_has_feature(VAR_0, VNC_FEATURE_WMVI)) { vnc_lock_output(VAR_0); vnc_write_u8(VAR_0, VNC_MSG_SERVER_FRAMEBUFFER_UPDATE); vnc_write_u8(VAR_0, 0); vnc_write_u16(VAR_0, 1); vnc_framebuffer_update(VAR_0, 0, 0, surface_width(VAR_0->vd->ds), surface_height(VAR_0->vd->ds), VNC_ENCODING_WMVi); pixel_format_message(VAR_0); vnc_unlock_output(VAR_0); vnc_flush(VAR_0); } else { set_pixel_conversion(VAR_0); } }
[ "static void FUNC_0(VncState *VAR_0)\n{", "if (vnc_has_feature(VAR_0, VNC_FEATURE_WMVI)) {", "vnc_lock_output(VAR_0);", "vnc_write_u8(VAR_0, VNC_MSG_SERVER_FRAMEBUFFER_UPDATE);", "vnc_write_u8(VAR_0, 0);", "vnc_write_u16(VAR_0, 1);", "vnc_framebuffer_update(VAR_0, 0, 0,\nsurface_width(VAR_0->vd->ds),\nsurface_height(VAR_0->vd->ds),\nVNC_ENCODING_WMVi);", "pixel_format_message(VAR_0);", "vnc_unlock_output(VAR_0);", "vnc_flush(VAR_0);", "} else {", "set_pixel_conversion(VAR_0);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17, 19, 21, 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ] ]
20,039
static void output_audio_block(AC3EncodeContext *s, int blk) { int ch, i, baie, bnd, got_cpl, ch0; AC3Block *block = &s->blocks[blk]; /* block switching */ if (!s->eac3) { for (ch = 0; ch < s->fbw_channels; ch++) put_bits(&s->pb, 1, 0); } /* dither flags */ if (!s->eac3) { for (ch = 0; ch < s->fbw_channels; ch++) put_bits(&s->pb, 1, 1); } /* dynamic range codes */ put_bits(&s->pb, 1, 0); /* spectral extension */ if (s->eac3) put_bits(&s->pb, 1, 0); /* channel coupling */ if (!s->eac3) put_bits(&s->pb, 1, block->new_cpl_strategy); if (block->new_cpl_strategy) { if (!s->eac3) put_bits(&s->pb, 1, block->cpl_in_use); if (block->cpl_in_use) { int start_sub, end_sub; if (s->eac3) put_bits(&s->pb, 1, 0); /* enhanced coupling */ if (!s->eac3 || s->channel_mode != AC3_CHMODE_STEREO) { for (ch = 1; ch <= s->fbw_channels; ch++) put_bits(&s->pb, 1, block->channel_in_cpl[ch]); } if (s->channel_mode == AC3_CHMODE_STEREO) put_bits(&s->pb, 1, 0); /* phase flags in use */ start_sub = (s->start_freq[CPL_CH] - 37) / 12; end_sub = (s->cpl_end_freq - 37) / 12; put_bits(&s->pb, 4, start_sub); put_bits(&s->pb, 4, end_sub - 3); /* coupling band structure */ if (s->eac3) { put_bits(&s->pb, 1, 0); /* use default */ } else { for (bnd = start_sub+1; bnd < end_sub; bnd++) put_bits(&s->pb, 1, ff_eac3_default_cpl_band_struct[bnd]); } } } /* coupling coordinates */ if (block->cpl_in_use) { for (ch = 1; ch <= s->fbw_channels; ch++) { if (block->channel_in_cpl[ch]) { if (!s->eac3 || block->new_cpl_coords[ch] != 2) put_bits(&s->pb, 1, block->new_cpl_coords[ch]); if (block->new_cpl_coords[ch]) { put_bits(&s->pb, 2, block->cpl_master_exp[ch]); for (bnd = 0; bnd < s->num_cpl_bands; bnd++) { put_bits(&s->pb, 4, block->cpl_coord_exp [ch][bnd]); put_bits(&s->pb, 4, block->cpl_coord_mant[ch][bnd]); } } } } } /* stereo rematrixing */ if (s->channel_mode == AC3_CHMODE_STEREO) { if (!s->eac3 || blk > 0) put_bits(&s->pb, 1, block->new_rematrixing_strategy); if (block->new_rematrixing_strategy) { /* rematrixing flags */ for (bnd = 0; bnd < block->num_rematrixing_bands; bnd++) put_bits(&s->pb, 1, block->rematrixing_flags[bnd]); } } /* exponent strategy */ if (!s->eac3) { for (ch = !block->cpl_in_use; ch <= s->fbw_channels; ch++) put_bits(&s->pb, 2, s->exp_strategy[ch][blk]); if (s->lfe_on) put_bits(&s->pb, 1, s->exp_strategy[s->lfe_channel][blk]); } /* bandwidth */ for (ch = 1; ch <= s->fbw_channels; ch++) { if (s->exp_strategy[ch][blk] != EXP_REUSE && !block->channel_in_cpl[ch]) put_bits(&s->pb, 6, s->bandwidth_code); } /* exponents */ for (ch = !block->cpl_in_use; ch <= s->channels; ch++) { int nb_groups; int cpl = (ch == CPL_CH); if (s->exp_strategy[ch][blk] == EXP_REUSE) continue; /* DC exponent */ put_bits(&s->pb, 4, block->grouped_exp[ch][0] >> cpl); /* exponent groups */ nb_groups = exponent_group_tab[cpl][s->exp_strategy[ch][blk]-1][block->end_freq[ch]-s->start_freq[ch]]; for (i = 1; i <= nb_groups; i++) put_bits(&s->pb, 7, block->grouped_exp[ch][i]); /* gain range info */ if (ch != s->lfe_channel && !cpl) put_bits(&s->pb, 2, 0); } /* bit allocation info */ if (!s->eac3) { baie = (blk == 0); put_bits(&s->pb, 1, baie); if (baie) { put_bits(&s->pb, 2, s->slow_decay_code); put_bits(&s->pb, 2, s->fast_decay_code); put_bits(&s->pb, 2, s->slow_gain_code); put_bits(&s->pb, 2, s->db_per_bit_code); put_bits(&s->pb, 3, s->floor_code); } } /* snr offset */ if (!s->eac3) { put_bits(&s->pb, 1, block->new_snr_offsets); if (block->new_snr_offsets) { put_bits(&s->pb, 6, s->coarse_snr_offset); for (ch = !block->cpl_in_use; ch <= s->channels; ch++) { put_bits(&s->pb, 4, s->fine_snr_offset[ch]); put_bits(&s->pb, 3, s->fast_gain_code[ch]); } } } else { put_bits(&s->pb, 1, 0); /* no converter snr offset */ } /* coupling leak */ if (block->cpl_in_use) { if (!s->eac3 || block->new_cpl_leak != 2) put_bits(&s->pb, 1, block->new_cpl_leak); if (block->new_cpl_leak) { put_bits(&s->pb, 3, s->bit_alloc.cpl_fast_leak); put_bits(&s->pb, 3, s->bit_alloc.cpl_slow_leak); } } if (!s->eac3) { put_bits(&s->pb, 1, 0); /* no delta bit allocation */ put_bits(&s->pb, 1, 0); /* no data to skip */ } /* mantissas */ got_cpl = !block->cpl_in_use; for (ch = 1; ch <= s->channels; ch++) { int b, q; if (!got_cpl && ch > 1 && block->channel_in_cpl[ch-1]) { ch0 = ch - 1; ch = CPL_CH; got_cpl = 1; } for (i = s->start_freq[ch]; i < block->end_freq[ch]; i++) { q = block->qmant[ch][i]; b = s->ref_bap[ch][blk][i]; switch (b) { case 0: break; case 1: if (q != 128) put_bits (&s->pb, 5, q); break; case 2: if (q != 128) put_bits (&s->pb, 7, q); break; case 3: put_sbits(&s->pb, 3, q); break; case 4: if (q != 128) put_bits (&s->pb, 7, q); break; case 14: put_sbits(&s->pb, 14, q); break; case 15: put_sbits(&s->pb, 16, q); break; default: put_sbits(&s->pb, b-1, q); break; } } if (ch == CPL_CH) ch = ch0; } }
true
FFmpeg
eeb48353abaab335a1fc9cc448a5691330325a09
static void output_audio_block(AC3EncodeContext *s, int blk) { int ch, i, baie, bnd, got_cpl, ch0; AC3Block *block = &s->blocks[blk]; if (!s->eac3) { for (ch = 0; ch < s->fbw_channels; ch++) put_bits(&s->pb, 1, 0); } if (!s->eac3) { for (ch = 0; ch < s->fbw_channels; ch++) put_bits(&s->pb, 1, 1); } put_bits(&s->pb, 1, 0); if (s->eac3) put_bits(&s->pb, 1, 0); if (!s->eac3) put_bits(&s->pb, 1, block->new_cpl_strategy); if (block->new_cpl_strategy) { if (!s->eac3) put_bits(&s->pb, 1, block->cpl_in_use); if (block->cpl_in_use) { int start_sub, end_sub; if (s->eac3) put_bits(&s->pb, 1, 0); if (!s->eac3 || s->channel_mode != AC3_CHMODE_STEREO) { for (ch = 1; ch <= s->fbw_channels; ch++) put_bits(&s->pb, 1, block->channel_in_cpl[ch]); } if (s->channel_mode == AC3_CHMODE_STEREO) put_bits(&s->pb, 1, 0); start_sub = (s->start_freq[CPL_CH] - 37) / 12; end_sub = (s->cpl_end_freq - 37) / 12; put_bits(&s->pb, 4, start_sub); put_bits(&s->pb, 4, end_sub - 3); if (s->eac3) { put_bits(&s->pb, 1, 0); } else { for (bnd = start_sub+1; bnd < end_sub; bnd++) put_bits(&s->pb, 1, ff_eac3_default_cpl_band_struct[bnd]); } } } if (block->cpl_in_use) { for (ch = 1; ch <= s->fbw_channels; ch++) { if (block->channel_in_cpl[ch]) { if (!s->eac3 || block->new_cpl_coords[ch] != 2) put_bits(&s->pb, 1, block->new_cpl_coords[ch]); if (block->new_cpl_coords[ch]) { put_bits(&s->pb, 2, block->cpl_master_exp[ch]); for (bnd = 0; bnd < s->num_cpl_bands; bnd++) { put_bits(&s->pb, 4, block->cpl_coord_exp [ch][bnd]); put_bits(&s->pb, 4, block->cpl_coord_mant[ch][bnd]); } } } } } if (s->channel_mode == AC3_CHMODE_STEREO) { if (!s->eac3 || blk > 0) put_bits(&s->pb, 1, block->new_rematrixing_strategy); if (block->new_rematrixing_strategy) { for (bnd = 0; bnd < block->num_rematrixing_bands; bnd++) put_bits(&s->pb, 1, block->rematrixing_flags[bnd]); } } if (!s->eac3) { for (ch = !block->cpl_in_use; ch <= s->fbw_channels; ch++) put_bits(&s->pb, 2, s->exp_strategy[ch][blk]); if (s->lfe_on) put_bits(&s->pb, 1, s->exp_strategy[s->lfe_channel][blk]); } for (ch = 1; ch <= s->fbw_channels; ch++) { if (s->exp_strategy[ch][blk] != EXP_REUSE && !block->channel_in_cpl[ch]) put_bits(&s->pb, 6, s->bandwidth_code); } for (ch = !block->cpl_in_use; ch <= s->channels; ch++) { int nb_groups; int cpl = (ch == CPL_CH); if (s->exp_strategy[ch][blk] == EXP_REUSE) continue; put_bits(&s->pb, 4, block->grouped_exp[ch][0] >> cpl); nb_groups = exponent_group_tab[cpl][s->exp_strategy[ch][blk]-1][block->end_freq[ch]-s->start_freq[ch]]; for (i = 1; i <= nb_groups; i++) put_bits(&s->pb, 7, block->grouped_exp[ch][i]); if (ch != s->lfe_channel && !cpl) put_bits(&s->pb, 2, 0); } if (!s->eac3) { baie = (blk == 0); put_bits(&s->pb, 1, baie); if (baie) { put_bits(&s->pb, 2, s->slow_decay_code); put_bits(&s->pb, 2, s->fast_decay_code); put_bits(&s->pb, 2, s->slow_gain_code); put_bits(&s->pb, 2, s->db_per_bit_code); put_bits(&s->pb, 3, s->floor_code); } } if (!s->eac3) { put_bits(&s->pb, 1, block->new_snr_offsets); if (block->new_snr_offsets) { put_bits(&s->pb, 6, s->coarse_snr_offset); for (ch = !block->cpl_in_use; ch <= s->channels; ch++) { put_bits(&s->pb, 4, s->fine_snr_offset[ch]); put_bits(&s->pb, 3, s->fast_gain_code[ch]); } } } else { put_bits(&s->pb, 1, 0); } if (block->cpl_in_use) { if (!s->eac3 || block->new_cpl_leak != 2) put_bits(&s->pb, 1, block->new_cpl_leak); if (block->new_cpl_leak) { put_bits(&s->pb, 3, s->bit_alloc.cpl_fast_leak); put_bits(&s->pb, 3, s->bit_alloc.cpl_slow_leak); } } if (!s->eac3) { put_bits(&s->pb, 1, 0); put_bits(&s->pb, 1, 0); } got_cpl = !block->cpl_in_use; for (ch = 1; ch <= s->channels; ch++) { int b, q; if (!got_cpl && ch > 1 && block->channel_in_cpl[ch-1]) { ch0 = ch - 1; ch = CPL_CH; got_cpl = 1; } for (i = s->start_freq[ch]; i < block->end_freq[ch]; i++) { q = block->qmant[ch][i]; b = s->ref_bap[ch][blk][i]; switch (b) { case 0: break; case 1: if (q != 128) put_bits (&s->pb, 5, q); break; case 2: if (q != 128) put_bits (&s->pb, 7, q); break; case 3: put_sbits(&s->pb, 3, q); break; case 4: if (q != 128) put_bits (&s->pb, 7, q); break; case 14: put_sbits(&s->pb, 14, q); break; case 15: put_sbits(&s->pb, 16, q); break; default: put_sbits(&s->pb, b-1, q); break; } } if (ch == CPL_CH) ch = ch0; } }
{ "code": [ " int ch, i, baie, bnd, got_cpl, ch0;" ], "line_no": [ 5 ] }
static void FUNC_0(AC3EncodeContext *VAR_0, int VAR_1) { int VAR_2, VAR_3, VAR_4, VAR_5, VAR_6, VAR_7; AC3Block *block = &VAR_0->blocks[VAR_1]; if (!VAR_0->eac3) { for (VAR_2 = 0; VAR_2 < VAR_0->fbw_channels; VAR_2++) put_bits(&VAR_0->pb, 1, 0); } if (!VAR_0->eac3) { for (VAR_2 = 0; VAR_2 < VAR_0->fbw_channels; VAR_2++) put_bits(&VAR_0->pb, 1, 1); } put_bits(&VAR_0->pb, 1, 0); if (VAR_0->eac3) put_bits(&VAR_0->pb, 1, 0); if (!VAR_0->eac3) put_bits(&VAR_0->pb, 1, block->new_cpl_strategy); if (block->new_cpl_strategy) { if (!VAR_0->eac3) put_bits(&VAR_0->pb, 1, block->cpl_in_use); if (block->cpl_in_use) { int VAR_8, VAR_9; if (VAR_0->eac3) put_bits(&VAR_0->pb, 1, 0); if (!VAR_0->eac3 || VAR_0->channel_mode != AC3_CHMODE_STEREO) { for (VAR_2 = 1; VAR_2 <= VAR_0->fbw_channels; VAR_2++) put_bits(&VAR_0->pb, 1, block->channel_in_cpl[VAR_2]); } if (VAR_0->channel_mode == AC3_CHMODE_STEREO) put_bits(&VAR_0->pb, 1, 0); VAR_8 = (VAR_0->start_freq[CPL_CH] - 37) / 12; VAR_9 = (VAR_0->cpl_end_freq - 37) / 12; put_bits(&VAR_0->pb, 4, VAR_8); put_bits(&VAR_0->pb, 4, VAR_9 - 3); if (VAR_0->eac3) { put_bits(&VAR_0->pb, 1, 0); } else { for (VAR_5 = VAR_8+1; VAR_5 < VAR_9; VAR_5++) put_bits(&VAR_0->pb, 1, ff_eac3_default_cpl_band_struct[VAR_5]); } } } if (block->cpl_in_use) { for (VAR_2 = 1; VAR_2 <= VAR_0->fbw_channels; VAR_2++) { if (block->channel_in_cpl[VAR_2]) { if (!VAR_0->eac3 || block->new_cpl_coords[VAR_2] != 2) put_bits(&VAR_0->pb, 1, block->new_cpl_coords[VAR_2]); if (block->new_cpl_coords[VAR_2]) { put_bits(&VAR_0->pb, 2, block->cpl_master_exp[VAR_2]); for (VAR_5 = 0; VAR_5 < VAR_0->num_cpl_bands; VAR_5++) { put_bits(&VAR_0->pb, 4, block->cpl_coord_exp [VAR_2][VAR_5]); put_bits(&VAR_0->pb, 4, block->cpl_coord_mant[VAR_2][VAR_5]); } } } } } if (VAR_0->channel_mode == AC3_CHMODE_STEREO) { if (!VAR_0->eac3 || VAR_1 > 0) put_bits(&VAR_0->pb, 1, block->new_rematrixing_strategy); if (block->new_rematrixing_strategy) { for (VAR_5 = 0; VAR_5 < block->num_rematrixing_bands; VAR_5++) put_bits(&VAR_0->pb, 1, block->rematrixing_flags[VAR_5]); } } if (!VAR_0->eac3) { for (VAR_2 = !block->cpl_in_use; VAR_2 <= VAR_0->fbw_channels; VAR_2++) put_bits(&VAR_0->pb, 2, VAR_0->exp_strategy[VAR_2][VAR_1]); if (VAR_0->lfe_on) put_bits(&VAR_0->pb, 1, VAR_0->exp_strategy[VAR_0->lfe_channel][VAR_1]); } for (VAR_2 = 1; VAR_2 <= VAR_0->fbw_channels; VAR_2++) { if (VAR_0->exp_strategy[VAR_2][VAR_1] != EXP_REUSE && !block->channel_in_cpl[VAR_2]) put_bits(&VAR_0->pb, 6, VAR_0->bandwidth_code); } for (VAR_2 = !block->cpl_in_use; VAR_2 <= VAR_0->channels; VAR_2++) { int nb_groups; int cpl = (VAR_2 == CPL_CH); if (VAR_0->exp_strategy[VAR_2][VAR_1] == EXP_REUSE) continue; put_bits(&VAR_0->pb, 4, block->grouped_exp[VAR_2][0] >> cpl); nb_groups = exponent_group_tab[cpl][VAR_0->exp_strategy[VAR_2][VAR_1]-1][block->end_freq[VAR_2]-VAR_0->start_freq[VAR_2]]; for (VAR_3 = 1; VAR_3 <= nb_groups; VAR_3++) put_bits(&VAR_0->pb, 7, block->grouped_exp[VAR_2][VAR_3]); if (VAR_2 != VAR_0->lfe_channel && !cpl) put_bits(&VAR_0->pb, 2, 0); } if (!VAR_0->eac3) { VAR_4 = (VAR_1 == 0); put_bits(&VAR_0->pb, 1, VAR_4); if (VAR_4) { put_bits(&VAR_0->pb, 2, VAR_0->slow_decay_code); put_bits(&VAR_0->pb, 2, VAR_0->fast_decay_code); put_bits(&VAR_0->pb, 2, VAR_0->slow_gain_code); put_bits(&VAR_0->pb, 2, VAR_0->db_per_bit_code); put_bits(&VAR_0->pb, 3, VAR_0->floor_code); } } if (!VAR_0->eac3) { put_bits(&VAR_0->pb, 1, block->new_snr_offsets); if (block->new_snr_offsets) { put_bits(&VAR_0->pb, 6, VAR_0->coarse_snr_offset); for (VAR_2 = !block->cpl_in_use; VAR_2 <= VAR_0->channels; VAR_2++) { put_bits(&VAR_0->pb, 4, VAR_0->fine_snr_offset[VAR_2]); put_bits(&VAR_0->pb, 3, VAR_0->fast_gain_code[VAR_2]); } } } else { put_bits(&VAR_0->pb, 1, 0); } if (block->cpl_in_use) { if (!VAR_0->eac3 || block->new_cpl_leak != 2) put_bits(&VAR_0->pb, 1, block->new_cpl_leak); if (block->new_cpl_leak) { put_bits(&VAR_0->pb, 3, VAR_0->bit_alloc.cpl_fast_leak); put_bits(&VAR_0->pb, 3, VAR_0->bit_alloc.cpl_slow_leak); } } if (!VAR_0->eac3) { put_bits(&VAR_0->pb, 1, 0); put_bits(&VAR_0->pb, 1, 0); } VAR_6 = !block->cpl_in_use; for (VAR_2 = 1; VAR_2 <= VAR_0->channels; VAR_2++) { int b, q; if (!VAR_6 && VAR_2 > 1 && block->channel_in_cpl[VAR_2-1]) { VAR_7 = VAR_2 - 1; VAR_2 = CPL_CH; VAR_6 = 1; } for (VAR_3 = VAR_0->start_freq[VAR_2]; VAR_3 < block->end_freq[VAR_2]; VAR_3++) { q = block->qmant[VAR_2][VAR_3]; b = VAR_0->ref_bap[VAR_2][VAR_1][VAR_3]; switch (b) { case 0: break; case 1: if (q != 128) put_bits (&VAR_0->pb, 5, q); break; case 2: if (q != 128) put_bits (&VAR_0->pb, 7, q); break; case 3: put_sbits(&VAR_0->pb, 3, q); break; case 4: if (q != 128) put_bits (&VAR_0->pb, 7, q); break; case 14: put_sbits(&VAR_0->pb, 14, q); break; case 15: put_sbits(&VAR_0->pb, 16, q); break; default: put_sbits(&VAR_0->pb, b-1, q); break; } } if (VAR_2 == CPL_CH) VAR_2 = VAR_7; } }
[ "static void FUNC_0(AC3EncodeContext *VAR_0, int VAR_1)\n{", "int VAR_2, VAR_3, VAR_4, VAR_5, VAR_6, VAR_7;", "AC3Block *block = &VAR_0->blocks[VAR_1];", "if (!VAR_0->eac3) {", "for (VAR_2 = 0; VAR_2 < VAR_0->fbw_channels; VAR_2++)", "put_bits(&VAR_0->pb, 1, 0);", "}", "if (!VAR_0->eac3) {", "for (VAR_2 = 0; VAR_2 < VAR_0->fbw_channels; VAR_2++)", "put_bits(&VAR_0->pb, 1, 1);", "}", "put_bits(&VAR_0->pb, 1, 0);", "if (VAR_0->eac3)\nput_bits(&VAR_0->pb, 1, 0);", "if (!VAR_0->eac3)\nput_bits(&VAR_0->pb, 1, block->new_cpl_strategy);", "if (block->new_cpl_strategy) {", "if (!VAR_0->eac3)\nput_bits(&VAR_0->pb, 1, block->cpl_in_use);", "if (block->cpl_in_use) {", "int VAR_8, VAR_9;", "if (VAR_0->eac3)\nput_bits(&VAR_0->pb, 1, 0);", "if (!VAR_0->eac3 || VAR_0->channel_mode != AC3_CHMODE_STEREO) {", "for (VAR_2 = 1; VAR_2 <= VAR_0->fbw_channels; VAR_2++)", "put_bits(&VAR_0->pb, 1, block->channel_in_cpl[VAR_2]);", "}", "if (VAR_0->channel_mode == AC3_CHMODE_STEREO)\nput_bits(&VAR_0->pb, 1, 0);", "VAR_8 = (VAR_0->start_freq[CPL_CH] - 37) / 12;", "VAR_9 = (VAR_0->cpl_end_freq - 37) / 12;", "put_bits(&VAR_0->pb, 4, VAR_8);", "put_bits(&VAR_0->pb, 4, VAR_9 - 3);", "if (VAR_0->eac3) {", "put_bits(&VAR_0->pb, 1, 0);", "} else {", "for (VAR_5 = VAR_8+1; VAR_5 < VAR_9; VAR_5++)", "put_bits(&VAR_0->pb, 1, ff_eac3_default_cpl_band_struct[VAR_5]);", "}", "}", "}", "if (block->cpl_in_use) {", "for (VAR_2 = 1; VAR_2 <= VAR_0->fbw_channels; VAR_2++) {", "if (block->channel_in_cpl[VAR_2]) {", "if (!VAR_0->eac3 || block->new_cpl_coords[VAR_2] != 2)\nput_bits(&VAR_0->pb, 1, block->new_cpl_coords[VAR_2]);", "if (block->new_cpl_coords[VAR_2]) {", "put_bits(&VAR_0->pb, 2, block->cpl_master_exp[VAR_2]);", "for (VAR_5 = 0; VAR_5 < VAR_0->num_cpl_bands; VAR_5++) {", "put_bits(&VAR_0->pb, 4, block->cpl_coord_exp [VAR_2][VAR_5]);", "put_bits(&VAR_0->pb, 4, block->cpl_coord_mant[VAR_2][VAR_5]);", "}", "}", "}", "}", "}", "if (VAR_0->channel_mode == AC3_CHMODE_STEREO) {", "if (!VAR_0->eac3 || VAR_1 > 0)\nput_bits(&VAR_0->pb, 1, block->new_rematrixing_strategy);", "if (block->new_rematrixing_strategy) {", "for (VAR_5 = 0; VAR_5 < block->num_rematrixing_bands; VAR_5++)", "put_bits(&VAR_0->pb, 1, block->rematrixing_flags[VAR_5]);", "}", "}", "if (!VAR_0->eac3) {", "for (VAR_2 = !block->cpl_in_use; VAR_2 <= VAR_0->fbw_channels; VAR_2++)", "put_bits(&VAR_0->pb, 2, VAR_0->exp_strategy[VAR_2][VAR_1]);", "if (VAR_0->lfe_on)\nput_bits(&VAR_0->pb, 1, VAR_0->exp_strategy[VAR_0->lfe_channel][VAR_1]);", "}", "for (VAR_2 = 1; VAR_2 <= VAR_0->fbw_channels; VAR_2++) {", "if (VAR_0->exp_strategy[VAR_2][VAR_1] != EXP_REUSE && !block->channel_in_cpl[VAR_2])\nput_bits(&VAR_0->pb, 6, VAR_0->bandwidth_code);", "}", "for (VAR_2 = !block->cpl_in_use; VAR_2 <= VAR_0->channels; VAR_2++) {", "int nb_groups;", "int cpl = (VAR_2 == CPL_CH);", "if (VAR_0->exp_strategy[VAR_2][VAR_1] == EXP_REUSE)\ncontinue;", "put_bits(&VAR_0->pb, 4, block->grouped_exp[VAR_2][0] >> cpl);", "nb_groups = exponent_group_tab[cpl][VAR_0->exp_strategy[VAR_2][VAR_1]-1][block->end_freq[VAR_2]-VAR_0->start_freq[VAR_2]];", "for (VAR_3 = 1; VAR_3 <= nb_groups; VAR_3++)", "put_bits(&VAR_0->pb, 7, block->grouped_exp[VAR_2][VAR_3]);", "if (VAR_2 != VAR_0->lfe_channel && !cpl)\nput_bits(&VAR_0->pb, 2, 0);", "}", "if (!VAR_0->eac3) {", "VAR_4 = (VAR_1 == 0);", "put_bits(&VAR_0->pb, 1, VAR_4);", "if (VAR_4) {", "put_bits(&VAR_0->pb, 2, VAR_0->slow_decay_code);", "put_bits(&VAR_0->pb, 2, VAR_0->fast_decay_code);", "put_bits(&VAR_0->pb, 2, VAR_0->slow_gain_code);", "put_bits(&VAR_0->pb, 2, VAR_0->db_per_bit_code);", "put_bits(&VAR_0->pb, 3, VAR_0->floor_code);", "}", "}", "if (!VAR_0->eac3) {", "put_bits(&VAR_0->pb, 1, block->new_snr_offsets);", "if (block->new_snr_offsets) {", "put_bits(&VAR_0->pb, 6, VAR_0->coarse_snr_offset);", "for (VAR_2 = !block->cpl_in_use; VAR_2 <= VAR_0->channels; VAR_2++) {", "put_bits(&VAR_0->pb, 4, VAR_0->fine_snr_offset[VAR_2]);", "put_bits(&VAR_0->pb, 3, VAR_0->fast_gain_code[VAR_2]);", "}", "}", "} else {", "put_bits(&VAR_0->pb, 1, 0);", "}", "if (block->cpl_in_use) {", "if (!VAR_0->eac3 || block->new_cpl_leak != 2)\nput_bits(&VAR_0->pb, 1, block->new_cpl_leak);", "if (block->new_cpl_leak) {", "put_bits(&VAR_0->pb, 3, VAR_0->bit_alloc.cpl_fast_leak);", "put_bits(&VAR_0->pb, 3, VAR_0->bit_alloc.cpl_slow_leak);", "}", "}", "if (!VAR_0->eac3) {", "put_bits(&VAR_0->pb, 1, 0);", "put_bits(&VAR_0->pb, 1, 0);", "}", "VAR_6 = !block->cpl_in_use;", "for (VAR_2 = 1; VAR_2 <= VAR_0->channels; VAR_2++) {", "int b, q;", "if (!VAR_6 && VAR_2 > 1 && block->channel_in_cpl[VAR_2-1]) {", "VAR_7 = VAR_2 - 1;", "VAR_2 = CPL_CH;", "VAR_6 = 1;", "}", "for (VAR_3 = VAR_0->start_freq[VAR_2]; VAR_3 < block->end_freq[VAR_2]; VAR_3++) {", "q = block->qmant[VAR_2][VAR_3];", "b = VAR_0->ref_bap[VAR_2][VAR_1][VAR_3];", "switch (b) {", "case 0: break;", "case 1: if (q != 128) put_bits (&VAR_0->pb, 5, q); break;", "case 2: if (q != 128) put_bits (&VAR_0->pb, 7, q); break;", "case 3: put_sbits(&VAR_0->pb, 3, q); break;", "case 4: if (q != 128) put_bits (&VAR_0->pb, 7, q); break;", "case 14: put_sbits(&VAR_0->pb, 14, q); break;", "case 15: put_sbits(&VAR_0->pb, 16, q); break;", "default: put_sbits(&VAR_0->pb, b-1, q); break;", "}", "}", "if (VAR_2 == CPL_CH)\nVAR_2 = VAR_7;", "}", "}" ]
[ 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 37 ], [ 43, 45 ], [ 51, 53 ], [ 55 ], [ 57, 59 ], [ 61 ], [ 63 ], [ 65, 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77, 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 111 ], [ 113 ], [ 115 ], [ 117, 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 145 ], [ 147, 149 ], [ 151 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 167 ], [ 169 ], [ 171 ], [ 173, 175 ], [ 177 ], [ 183 ], [ 185, 187 ], [ 189 ], [ 195 ], [ 197 ], [ 199 ], [ 203, 205 ], [ 211 ], [ 217 ], [ 219 ], [ 221 ], [ 227, 229 ], [ 231 ], [ 237 ], [ 239 ], [ 241 ], [ 243 ], [ 245 ], [ 247 ], [ 249 ], [ 251 ], [ 253 ], [ 255 ], [ 257 ], [ 263 ], [ 265 ], [ 267 ], [ 269 ], [ 271 ], [ 273 ], [ 275 ], [ 277 ], [ 279 ], [ 281 ], [ 283 ], [ 285 ], [ 291 ], [ 293, 295 ], [ 297 ], [ 299 ], [ 301 ], [ 303 ], [ 305 ], [ 309 ], [ 311 ], [ 313 ], [ 315 ], [ 321 ], [ 323 ], [ 325 ], [ 329 ], [ 331 ], [ 333 ], [ 335 ], [ 337 ], [ 339 ], [ 341 ], [ 343 ], [ 345 ], [ 347 ], [ 349 ], [ 351 ], [ 353 ], [ 355 ], [ 357 ], [ 359 ], [ 361 ], [ 363 ], [ 365 ], [ 367, 369 ], [ 371 ], [ 373 ] ]
20,041
void virtio_blk_data_plane_create(VirtIODevice *vdev, VirtIOBlkConf *conf, VirtIOBlockDataPlane **dataplane, Error **errp) { VirtIOBlockDataPlane *s; Error *local_err = NULL; BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(vdev))); VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus); *dataplane = NULL; if (!conf->data_plane && !conf->iothread) { return; } /* Don't try if transport does not support notifiers. */ if (!k->set_guest_notifiers || !k->set_host_notifier) { error_setg(errp, "device is incompatible with x-data-plane " "(transport does not support notifiers)"); return; } /* If dataplane is (re-)enabled while the guest is running there could be * block jobs that can conflict. */ if (blk_op_is_blocked(conf->conf.blk, BLOCK_OP_TYPE_DATAPLANE, &local_err)) { error_setg(errp, "cannot start dataplane thread: %s", error_get_pretty(local_err)); error_free(local_err); return; } s = g_new0(VirtIOBlockDataPlane, 1); s->vdev = vdev; s->conf = conf; if (conf->iothread) { s->iothread = conf->iothread; object_ref(OBJECT(s->iothread)); } else { /* Create per-device IOThread if none specified. This is for * x-data-plane option compatibility. If x-data-plane is removed we * can drop this. */ object_initialize(&s->internal_iothread_obj, sizeof(s->internal_iothread_obj), TYPE_IOTHREAD); user_creatable_complete(OBJECT(&s->internal_iothread_obj), &error_abort); s->iothread = &s->internal_iothread_obj; } s->ctx = iothread_get_aio_context(s->iothread); s->bh = aio_bh_new(s->ctx, notify_guest_bh, s); error_setg(&s->blocker, "block device is in use by data plane"); blk_op_block_all(conf->conf.blk, s->blocker); blk_op_unblock(conf->conf.blk, BLOCK_OP_TYPE_RESIZE, s->blocker); blk_op_unblock(conf->conf.blk, BLOCK_OP_TYPE_DRIVE_DEL, s->blocker); blk_op_unblock(conf->conf.blk, BLOCK_OP_TYPE_BACKUP_SOURCE, s->blocker); blk_op_unblock(conf->conf.blk, BLOCK_OP_TYPE_COMMIT, s->blocker); blk_op_unblock(conf->conf.blk, BLOCK_OP_TYPE_MIRROR, s->blocker); blk_op_unblock(conf->conf.blk, BLOCK_OP_TYPE_STREAM, s->blocker); blk_op_unblock(conf->conf.blk, BLOCK_OP_TYPE_REPLACE, s->blocker); *dataplane = s; }
true
qemu
4ef3982a99f9d2634588b4785c8d841605517946
void virtio_blk_data_plane_create(VirtIODevice *vdev, VirtIOBlkConf *conf, VirtIOBlockDataPlane **dataplane, Error **errp) { VirtIOBlockDataPlane *s; Error *local_err = NULL; BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(vdev))); VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus); *dataplane = NULL; if (!conf->data_plane && !conf->iothread) { return; } if (!k->set_guest_notifiers || !k->set_host_notifier) { error_setg(errp, "device is incompatible with x-data-plane " "(transport does not support notifiers)"); return; } if (blk_op_is_blocked(conf->conf.blk, BLOCK_OP_TYPE_DATAPLANE, &local_err)) { error_setg(errp, "cannot start dataplane thread: %s", error_get_pretty(local_err)); error_free(local_err); return; } s = g_new0(VirtIOBlockDataPlane, 1); s->vdev = vdev; s->conf = conf; if (conf->iothread) { s->iothread = conf->iothread; object_ref(OBJECT(s->iothread)); } else { object_initialize(&s->internal_iothread_obj, sizeof(s->internal_iothread_obj), TYPE_IOTHREAD); user_creatable_complete(OBJECT(&s->internal_iothread_obj), &error_abort); s->iothread = &s->internal_iothread_obj; } s->ctx = iothread_get_aio_context(s->iothread); s->bh = aio_bh_new(s->ctx, notify_guest_bh, s); error_setg(&s->blocker, "block device is in use by data plane"); blk_op_block_all(conf->conf.blk, s->blocker); blk_op_unblock(conf->conf.blk, BLOCK_OP_TYPE_RESIZE, s->blocker); blk_op_unblock(conf->conf.blk, BLOCK_OP_TYPE_DRIVE_DEL, s->blocker); blk_op_unblock(conf->conf.blk, BLOCK_OP_TYPE_BACKUP_SOURCE, s->blocker); blk_op_unblock(conf->conf.blk, BLOCK_OP_TYPE_COMMIT, s->blocker); blk_op_unblock(conf->conf.blk, BLOCK_OP_TYPE_MIRROR, s->blocker); blk_op_unblock(conf->conf.blk, BLOCK_OP_TYPE_STREAM, s->blocker); blk_op_unblock(conf->conf.blk, BLOCK_OP_TYPE_REPLACE, s->blocker); *dataplane = s; }
{ "code": [], "line_no": [] }
void FUNC_0(VirtIODevice *VAR_0, VirtIOBlkConf *VAR_1, VirtIOBlockDataPlane **VAR_2, Error **VAR_3) { VirtIOBlockDataPlane *s; Error *local_err = NULL; BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(VAR_0))); VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus); *VAR_2 = NULL; if (!VAR_1->data_plane && !VAR_1->iothread) { return; } if (!k->set_guest_notifiers || !k->set_host_notifier) { error_setg(VAR_3, "device is incompatible with x-data-plane " "(transport does not support notifiers)"); return; } if (blk_op_is_blocked(VAR_1->VAR_1.blk, BLOCK_OP_TYPE_DATAPLANE, &local_err)) { error_setg(VAR_3, "cannot start VAR_2 thread: %s", error_get_pretty(local_err)); error_free(local_err); return; } s = g_new0(VirtIOBlockDataPlane, 1); s->VAR_0 = VAR_0; s->VAR_1 = VAR_1; if (VAR_1->iothread) { s->iothread = VAR_1->iothread; object_ref(OBJECT(s->iothread)); } else { object_initialize(&s->internal_iothread_obj, sizeof(s->internal_iothread_obj), TYPE_IOTHREAD); user_creatable_complete(OBJECT(&s->internal_iothread_obj), &error_abort); s->iothread = &s->internal_iothread_obj; } s->ctx = iothread_get_aio_context(s->iothread); s->bh = aio_bh_new(s->ctx, notify_guest_bh, s); error_setg(&s->blocker, "block device is in use by data plane"); blk_op_block_all(VAR_1->VAR_1.blk, s->blocker); blk_op_unblock(VAR_1->VAR_1.blk, BLOCK_OP_TYPE_RESIZE, s->blocker); blk_op_unblock(VAR_1->VAR_1.blk, BLOCK_OP_TYPE_DRIVE_DEL, s->blocker); blk_op_unblock(VAR_1->VAR_1.blk, BLOCK_OP_TYPE_BACKUP_SOURCE, s->blocker); blk_op_unblock(VAR_1->VAR_1.blk, BLOCK_OP_TYPE_COMMIT, s->blocker); blk_op_unblock(VAR_1->VAR_1.blk, BLOCK_OP_TYPE_MIRROR, s->blocker); blk_op_unblock(VAR_1->VAR_1.blk, BLOCK_OP_TYPE_STREAM, s->blocker); blk_op_unblock(VAR_1->VAR_1.blk, BLOCK_OP_TYPE_REPLACE, s->blocker); *VAR_2 = s; }
[ "void FUNC_0(VirtIODevice *VAR_0, VirtIOBlkConf *VAR_1,\nVirtIOBlockDataPlane **VAR_2,\nError **VAR_3)\n{", "VirtIOBlockDataPlane *s;", "Error *local_err = NULL;", "BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(VAR_0)));", "VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus);", "*VAR_2 = NULL;", "if (!VAR_1->data_plane && !VAR_1->iothread) {", "return;", "}", "if (!k->set_guest_notifiers || !k->set_host_notifier) {", "error_setg(VAR_3,\n\"device is incompatible with x-data-plane \"\n\"(transport does not support notifiers)\");", "return;", "}", "if (blk_op_is_blocked(VAR_1->VAR_1.blk, BLOCK_OP_TYPE_DATAPLANE,\n&local_err)) {", "error_setg(VAR_3, \"cannot start VAR_2 thread: %s\",\nerror_get_pretty(local_err));", "error_free(local_err);", "return;", "}", "s = g_new0(VirtIOBlockDataPlane, 1);", "s->VAR_0 = VAR_0;", "s->VAR_1 = VAR_1;", "if (VAR_1->iothread) {", "s->iothread = VAR_1->iothread;", "object_ref(OBJECT(s->iothread));", "} else {", "object_initialize(&s->internal_iothread_obj,\nsizeof(s->internal_iothread_obj),\nTYPE_IOTHREAD);", "user_creatable_complete(OBJECT(&s->internal_iothread_obj), &error_abort);", "s->iothread = &s->internal_iothread_obj;", "}", "s->ctx = iothread_get_aio_context(s->iothread);", "s->bh = aio_bh_new(s->ctx, notify_guest_bh, s);", "error_setg(&s->blocker, \"block device is in use by data plane\");", "blk_op_block_all(VAR_1->VAR_1.blk, s->blocker);", "blk_op_unblock(VAR_1->VAR_1.blk, BLOCK_OP_TYPE_RESIZE, s->blocker);", "blk_op_unblock(VAR_1->VAR_1.blk, BLOCK_OP_TYPE_DRIVE_DEL, s->blocker);", "blk_op_unblock(VAR_1->VAR_1.blk, BLOCK_OP_TYPE_BACKUP_SOURCE, s->blocker);", "blk_op_unblock(VAR_1->VAR_1.blk, BLOCK_OP_TYPE_COMMIT, s->blocker);", "blk_op_unblock(VAR_1->VAR_1.blk, BLOCK_OP_TYPE_MIRROR, s->blocker);", "blk_op_unblock(VAR_1->VAR_1.blk, BLOCK_OP_TYPE_STREAM, s->blocker);", "blk_op_unblock(VAR_1->VAR_1.blk, BLOCK_OP_TYPE_REPLACE, s->blocker);", "*VAR_2 = s;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 33 ], [ 35, 37, 39 ], [ 41 ], [ 43 ], [ 53, 55 ], [ 57, 59 ], [ 61 ], [ 63 ], [ 65 ], [ 69 ], [ 71 ], [ 73 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 93, 95, 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 125 ], [ 127 ], [ 129 ], [ 133 ], [ 135 ] ]
20,042
static inline int parse_nal_units(AVCodecParserContext *s, AVCodecContext *avctx, const uint8_t *buf, int buf_size) { HEVCContext *h = &((HEVCParseContext *)s->priv_data)->h; GetBitContext *gb = &h->HEVClc->gb; SliceHeader *sh = &h->sh; const uint8_t *buf_end = buf + buf_size; int state = -1, i; HEVCNAL *nal; /* set some sane default values */ s->pict_type = AV_PICTURE_TYPE_I; s->key_frame = 0; s->picture_structure = AV_PICTURE_STRUCTURE_UNKNOWN; h->avctx = avctx; if (!buf_size) return 0; if (h->nals_allocated < 1) { HEVCNAL *tmp = av_realloc_array(h->nals, 1, sizeof(*tmp)); if (!tmp) return AVERROR(ENOMEM); h->nals = tmp; memset(h->nals, 0, sizeof(*tmp)); h->nals_allocated = 1; } nal = &h->nals[0]; for (;;) { int src_length, consumed; buf = avpriv_find_start_code(buf, buf_end, &state); if (--buf + 2 >= buf_end) break; src_length = buf_end - buf; h->nal_unit_type = (*buf >> 1) & 0x3f; h->temporal_id = (*(buf + 1) & 0x07) - 1; if (h->nal_unit_type <= NAL_CRA_NUT) { // Do not walk the whole buffer just to decode slice segment header if (src_length > 20) src_length = 20; } consumed = ff_hevc_extract_rbsp(h, buf, src_length, nal); if (consumed < 0) return consumed; init_get_bits8(gb, nal->data + 2, nal->size); switch (h->nal_unit_type) { case NAL_VPS: ff_hevc_decode_nal_vps(h); break; case NAL_SPS: ff_hevc_decode_nal_sps(h); break; case NAL_PPS: ff_hevc_decode_nal_pps(h); break; case NAL_SEI_PREFIX: case NAL_SEI_SUFFIX: ff_hevc_decode_nal_sei(h); break; case NAL_TRAIL_N: case NAL_TRAIL_R: case NAL_TSA_N: case NAL_TSA_R: case NAL_STSA_N: case NAL_STSA_R: case NAL_RADL_N: case NAL_RADL_R: case NAL_RASL_N: case NAL_RASL_R: case NAL_BLA_W_LP: case NAL_BLA_W_RADL: case NAL_BLA_N_LP: case NAL_IDR_W_RADL: case NAL_IDR_N_LP: case NAL_CRA_NUT: sh->first_slice_in_pic_flag = get_bits1(gb); s->picture_structure = h->picture_struct; s->field_order = h->picture_struct; if (IS_IRAP(h)) { s->key_frame = 1; sh->no_output_of_prior_pics_flag = get_bits1(gb); } sh->pps_id = get_ue_golomb(gb); if (sh->pps_id >= MAX_PPS_COUNT || !h->pps_list[sh->pps_id]) { av_log(h->avctx, AV_LOG_ERROR, "PPS id out of range: %d\n", sh->pps_id); return AVERROR_INVALIDDATA; } h->pps = (HEVCPPS*)h->pps_list[sh->pps_id]->data; if (h->pps->sps_id >= MAX_SPS_COUNT || !h->sps_list[h->pps->sps_id]) { av_log(h->avctx, AV_LOG_ERROR, "SPS id out of range: %d\n", h->pps->sps_id); return AVERROR_INVALIDDATA; } if (h->sps != (HEVCSPS*)h->sps_list[h->pps->sps_id]->data) { h->sps = (HEVCSPS*)h->sps_list[h->pps->sps_id]->data; h->vps = (HEVCVPS*)h->vps_list[h->sps->vps_id]->data; } if (!sh->first_slice_in_pic_flag) { int slice_address_length; if (h->pps->dependent_slice_segments_enabled_flag) sh->dependent_slice_segment_flag = get_bits1(gb); else sh->dependent_slice_segment_flag = 0; slice_address_length = av_ceil_log2_c(h->sps->ctb_width * h->sps->ctb_height); sh->slice_segment_addr = get_bits(gb, slice_address_length); if (sh->slice_segment_addr >= h->sps->ctb_width * h->sps->ctb_height) { av_log(h->avctx, AV_LOG_ERROR, "Invalid slice segment address: %u.\n", sh->slice_segment_addr); return AVERROR_INVALIDDATA; } } else sh->dependent_slice_segment_flag = 0; if (sh->dependent_slice_segment_flag) break; for (i = 0; i < h->pps->num_extra_slice_header_bits; i++) skip_bits(gb, 1); // slice_reserved_undetermined_flag[] sh->slice_type = get_ue_golomb(gb); if (!(sh->slice_type == I_SLICE || sh->slice_type == P_SLICE || sh->slice_type == B_SLICE)) { av_log(h->avctx, AV_LOG_ERROR, "Unknown slice type: %d.\n", sh->slice_type); return AVERROR_INVALIDDATA; } s->pict_type = sh->slice_type == B_SLICE ? AV_PICTURE_TYPE_B : sh->slice_type == P_SLICE ? AV_PICTURE_TYPE_P : AV_PICTURE_TYPE_I; if (h->pps->output_flag_present_flag) sh->pic_output_flag = get_bits1(gb); if (h->sps->separate_colour_plane_flag) sh->colour_plane_id = get_bits(gb, 2); if (!IS_IDR(h)) { sh->pic_order_cnt_lsb = get_bits(gb, h->sps->log2_max_poc_lsb); s->output_picture_number = h->poc = ff_hevc_compute_poc(h, sh->pic_order_cnt_lsb); } else s->output_picture_number = h->poc = 0; if (h->temporal_id == 0 && h->nal_unit_type != NAL_TRAIL_N && h->nal_unit_type != NAL_TSA_N && h->nal_unit_type != NAL_STSA_N && h->nal_unit_type != NAL_RADL_N && h->nal_unit_type != NAL_RASL_N && h->nal_unit_type != NAL_RADL_R && h->nal_unit_type != NAL_RASL_R) h->pocTid0 = h->poc; return 0; /* no need to evaluate the rest */ } buf += consumed; } /* didn't find a picture! */ av_log(h->avctx, AV_LOG_ERROR, "missing picture in access unit\n"); return -1; }
false
FFmpeg
05cc8c8e4b7008ff3be8ec477c901b2ceca4b16b
static inline int parse_nal_units(AVCodecParserContext *s, AVCodecContext *avctx, const uint8_t *buf, int buf_size) { HEVCContext *h = &((HEVCParseContext *)s->priv_data)->h; GetBitContext *gb = &h->HEVClc->gb; SliceHeader *sh = &h->sh; const uint8_t *buf_end = buf + buf_size; int state = -1, i; HEVCNAL *nal; s->pict_type = AV_PICTURE_TYPE_I; s->key_frame = 0; s->picture_structure = AV_PICTURE_STRUCTURE_UNKNOWN; h->avctx = avctx; if (!buf_size) return 0; if (h->nals_allocated < 1) { HEVCNAL *tmp = av_realloc_array(h->nals, 1, sizeof(*tmp)); if (!tmp) return AVERROR(ENOMEM); h->nals = tmp; memset(h->nals, 0, sizeof(*tmp)); h->nals_allocated = 1; } nal = &h->nals[0]; for (;;) { int src_length, consumed; buf = avpriv_find_start_code(buf, buf_end, &state); if (--buf + 2 >= buf_end) break; src_length = buf_end - buf; h->nal_unit_type = (*buf >> 1) & 0x3f; h->temporal_id = (*(buf + 1) & 0x07) - 1; if (h->nal_unit_type <= NAL_CRA_NUT) { if (src_length > 20) src_length = 20; } consumed = ff_hevc_extract_rbsp(h, buf, src_length, nal); if (consumed < 0) return consumed; init_get_bits8(gb, nal->data + 2, nal->size); switch (h->nal_unit_type) { case NAL_VPS: ff_hevc_decode_nal_vps(h); break; case NAL_SPS: ff_hevc_decode_nal_sps(h); break; case NAL_PPS: ff_hevc_decode_nal_pps(h); break; case NAL_SEI_PREFIX: case NAL_SEI_SUFFIX: ff_hevc_decode_nal_sei(h); break; case NAL_TRAIL_N: case NAL_TRAIL_R: case NAL_TSA_N: case NAL_TSA_R: case NAL_STSA_N: case NAL_STSA_R: case NAL_RADL_N: case NAL_RADL_R: case NAL_RASL_N: case NAL_RASL_R: case NAL_BLA_W_LP: case NAL_BLA_W_RADL: case NAL_BLA_N_LP: case NAL_IDR_W_RADL: case NAL_IDR_N_LP: case NAL_CRA_NUT: sh->first_slice_in_pic_flag = get_bits1(gb); s->picture_structure = h->picture_struct; s->field_order = h->picture_struct; if (IS_IRAP(h)) { s->key_frame = 1; sh->no_output_of_prior_pics_flag = get_bits1(gb); } sh->pps_id = get_ue_golomb(gb); if (sh->pps_id >= MAX_PPS_COUNT || !h->pps_list[sh->pps_id]) { av_log(h->avctx, AV_LOG_ERROR, "PPS id out of range: %d\n", sh->pps_id); return AVERROR_INVALIDDATA; } h->pps = (HEVCPPS*)h->pps_list[sh->pps_id]->data; if (h->pps->sps_id >= MAX_SPS_COUNT || !h->sps_list[h->pps->sps_id]) { av_log(h->avctx, AV_LOG_ERROR, "SPS id out of range: %d\n", h->pps->sps_id); return AVERROR_INVALIDDATA; } if (h->sps != (HEVCSPS*)h->sps_list[h->pps->sps_id]->data) { h->sps = (HEVCSPS*)h->sps_list[h->pps->sps_id]->data; h->vps = (HEVCVPS*)h->vps_list[h->sps->vps_id]->data; } if (!sh->first_slice_in_pic_flag) { int slice_address_length; if (h->pps->dependent_slice_segments_enabled_flag) sh->dependent_slice_segment_flag = get_bits1(gb); else sh->dependent_slice_segment_flag = 0; slice_address_length = av_ceil_log2_c(h->sps->ctb_width * h->sps->ctb_height); sh->slice_segment_addr = get_bits(gb, slice_address_length); if (sh->slice_segment_addr >= h->sps->ctb_width * h->sps->ctb_height) { av_log(h->avctx, AV_LOG_ERROR, "Invalid slice segment address: %u.\n", sh->slice_segment_addr); return AVERROR_INVALIDDATA; } } else sh->dependent_slice_segment_flag = 0; if (sh->dependent_slice_segment_flag) break; for (i = 0; i < h->pps->num_extra_slice_header_bits; i++) skip_bits(gb, 1); sh->slice_type = get_ue_golomb(gb); if (!(sh->slice_type == I_SLICE || sh->slice_type == P_SLICE || sh->slice_type == B_SLICE)) { av_log(h->avctx, AV_LOG_ERROR, "Unknown slice type: %d.\n", sh->slice_type); return AVERROR_INVALIDDATA; } s->pict_type = sh->slice_type == B_SLICE ? AV_PICTURE_TYPE_B : sh->slice_type == P_SLICE ? AV_PICTURE_TYPE_P : AV_PICTURE_TYPE_I; if (h->pps->output_flag_present_flag) sh->pic_output_flag = get_bits1(gb); if (h->sps->separate_colour_plane_flag) sh->colour_plane_id = get_bits(gb, 2); if (!IS_IDR(h)) { sh->pic_order_cnt_lsb = get_bits(gb, h->sps->log2_max_poc_lsb); s->output_picture_number = h->poc = ff_hevc_compute_poc(h, sh->pic_order_cnt_lsb); } else s->output_picture_number = h->poc = 0; if (h->temporal_id == 0 && h->nal_unit_type != NAL_TRAIL_N && h->nal_unit_type != NAL_TSA_N && h->nal_unit_type != NAL_STSA_N && h->nal_unit_type != NAL_RADL_N && h->nal_unit_type != NAL_RASL_N && h->nal_unit_type != NAL_RADL_R && h->nal_unit_type != NAL_RASL_R) h->pocTid0 = h->poc; return 0; } buf += consumed; } av_log(h->avctx, AV_LOG_ERROR, "missing picture in access unit\n"); return -1; }
{ "code": [], "line_no": [] }
static inline int FUNC_0(AVCodecParserContext *VAR_0, AVCodecContext *VAR_1, const uint8_t *VAR_2, int VAR_3) { HEVCContext *h = &((HEVCParseContext *)VAR_0->priv_data)->h; GetBitContext *gb = &h->HEVClc->gb; SliceHeader *sh = &h->sh; const uint8_t *VAR_4 = VAR_2 + VAR_3; int VAR_5 = -1, VAR_6; HEVCNAL *nal; VAR_0->pict_type = AV_PICTURE_TYPE_I; VAR_0->key_frame = 0; VAR_0->picture_structure = AV_PICTURE_STRUCTURE_UNKNOWN; h->VAR_1 = VAR_1; if (!VAR_3) return 0; if (h->nals_allocated < 1) { HEVCNAL *tmp = av_realloc_array(h->nals, 1, sizeof(*tmp)); if (!tmp) return AVERROR(ENOMEM); h->nals = tmp; memset(h->nals, 0, sizeof(*tmp)); h->nals_allocated = 1; } nal = &h->nals[0]; for (;;) { int VAR_7, VAR_8; VAR_2 = avpriv_find_start_code(VAR_2, VAR_4, &VAR_5); if (--VAR_2 + 2 >= VAR_4) break; VAR_7 = VAR_4 - VAR_2; h->nal_unit_type = (*VAR_2 >> 1) & 0x3f; h->temporal_id = (*(VAR_2 + 1) & 0x07) - 1; if (h->nal_unit_type <= NAL_CRA_NUT) { if (VAR_7 > 20) VAR_7 = 20; } VAR_8 = ff_hevc_extract_rbsp(h, VAR_2, VAR_7, nal); if (VAR_8 < 0) return VAR_8; init_get_bits8(gb, nal->data + 2, nal->size); switch (h->nal_unit_type) { case NAL_VPS: ff_hevc_decode_nal_vps(h); break; case NAL_SPS: ff_hevc_decode_nal_sps(h); break; case NAL_PPS: ff_hevc_decode_nal_pps(h); break; case NAL_SEI_PREFIX: case NAL_SEI_SUFFIX: ff_hevc_decode_nal_sei(h); break; case NAL_TRAIL_N: case NAL_TRAIL_R: case NAL_TSA_N: case NAL_TSA_R: case NAL_STSA_N: case NAL_STSA_R: case NAL_RADL_N: case NAL_RADL_R: case NAL_RASL_N: case NAL_RASL_R: case NAL_BLA_W_LP: case NAL_BLA_W_RADL: case NAL_BLA_N_LP: case NAL_IDR_W_RADL: case NAL_IDR_N_LP: case NAL_CRA_NUT: sh->first_slice_in_pic_flag = get_bits1(gb); VAR_0->picture_structure = h->picture_struct; VAR_0->field_order = h->picture_struct; if (IS_IRAP(h)) { VAR_0->key_frame = 1; sh->no_output_of_prior_pics_flag = get_bits1(gb); } sh->pps_id = get_ue_golomb(gb); if (sh->pps_id >= MAX_PPS_COUNT || !h->pps_list[sh->pps_id]) { av_log(h->VAR_1, AV_LOG_ERROR, "PPS id out of range: %d\n", sh->pps_id); return AVERROR_INVALIDDATA; } h->pps = (HEVCPPS*)h->pps_list[sh->pps_id]->data; if (h->pps->sps_id >= MAX_SPS_COUNT || !h->sps_list[h->pps->sps_id]) { av_log(h->VAR_1, AV_LOG_ERROR, "SPS id out of range: %d\n", h->pps->sps_id); return AVERROR_INVALIDDATA; } if (h->sps != (HEVCSPS*)h->sps_list[h->pps->sps_id]->data) { h->sps = (HEVCSPS*)h->sps_list[h->pps->sps_id]->data; h->vps = (HEVCVPS*)h->vps_list[h->sps->vps_id]->data; } if (!sh->first_slice_in_pic_flag) { int VAR_9; if (h->pps->dependent_slice_segments_enabled_flag) sh->dependent_slice_segment_flag = get_bits1(gb); else sh->dependent_slice_segment_flag = 0; VAR_9 = av_ceil_log2_c(h->sps->ctb_width * h->sps->ctb_height); sh->slice_segment_addr = get_bits(gb, VAR_9); if (sh->slice_segment_addr >= h->sps->ctb_width * h->sps->ctb_height) { av_log(h->VAR_1, AV_LOG_ERROR, "Invalid slice segment address: %u.\n", sh->slice_segment_addr); return AVERROR_INVALIDDATA; } } else sh->dependent_slice_segment_flag = 0; if (sh->dependent_slice_segment_flag) break; for (VAR_6 = 0; VAR_6 < h->pps->num_extra_slice_header_bits; VAR_6++) skip_bits(gb, 1); sh->slice_type = get_ue_golomb(gb); if (!(sh->slice_type == I_SLICE || sh->slice_type == P_SLICE || sh->slice_type == B_SLICE)) { av_log(h->VAR_1, AV_LOG_ERROR, "Unknown slice type: %d.\n", sh->slice_type); return AVERROR_INVALIDDATA; } VAR_0->pict_type = sh->slice_type == B_SLICE ? AV_PICTURE_TYPE_B : sh->slice_type == P_SLICE ? AV_PICTURE_TYPE_P : AV_PICTURE_TYPE_I; if (h->pps->output_flag_present_flag) sh->pic_output_flag = get_bits1(gb); if (h->sps->separate_colour_plane_flag) sh->colour_plane_id = get_bits(gb, 2); if (!IS_IDR(h)) { sh->pic_order_cnt_lsb = get_bits(gb, h->sps->log2_max_poc_lsb); VAR_0->output_picture_number = h->poc = ff_hevc_compute_poc(h, sh->pic_order_cnt_lsb); } else VAR_0->output_picture_number = h->poc = 0; if (h->temporal_id == 0 && h->nal_unit_type != NAL_TRAIL_N && h->nal_unit_type != NAL_TSA_N && h->nal_unit_type != NAL_STSA_N && h->nal_unit_type != NAL_RADL_N && h->nal_unit_type != NAL_RASL_N && h->nal_unit_type != NAL_RADL_R && h->nal_unit_type != NAL_RASL_R) h->pocTid0 = h->poc; return 0; } VAR_2 += VAR_8; } av_log(h->VAR_1, AV_LOG_ERROR, "missing picture in access unit\n"); return -1; }
[ "static inline int FUNC_0(AVCodecParserContext *VAR_0, AVCodecContext *VAR_1,\nconst uint8_t *VAR_2, int VAR_3)\n{", "HEVCContext *h = &((HEVCParseContext *)VAR_0->priv_data)->h;", "GetBitContext *gb = &h->HEVClc->gb;", "SliceHeader *sh = &h->sh;", "const uint8_t *VAR_4 = VAR_2 + VAR_3;", "int VAR_5 = -1, VAR_6;", "HEVCNAL *nal;", "VAR_0->pict_type = AV_PICTURE_TYPE_I;", "VAR_0->key_frame = 0;", "VAR_0->picture_structure = AV_PICTURE_STRUCTURE_UNKNOWN;", "h->VAR_1 = VAR_1;", "if (!VAR_3)\nreturn 0;", "if (h->nals_allocated < 1) {", "HEVCNAL *tmp = av_realloc_array(h->nals, 1, sizeof(*tmp));", "if (!tmp)\nreturn AVERROR(ENOMEM);", "h->nals = tmp;", "memset(h->nals, 0, sizeof(*tmp));", "h->nals_allocated = 1;", "}", "nal = &h->nals[0];", "for (;;) {", "int VAR_7, VAR_8;", "VAR_2 = avpriv_find_start_code(VAR_2, VAR_4, &VAR_5);", "if (--VAR_2 + 2 >= VAR_4)\nbreak;", "VAR_7 = VAR_4 - VAR_2;", "h->nal_unit_type = (*VAR_2 >> 1) & 0x3f;", "h->temporal_id = (*(VAR_2 + 1) & 0x07) - 1;", "if (h->nal_unit_type <= NAL_CRA_NUT) {", "if (VAR_7 > 20)\nVAR_7 = 20;", "}", "VAR_8 = ff_hevc_extract_rbsp(h, VAR_2, VAR_7, nal);", "if (VAR_8 < 0)\nreturn VAR_8;", "init_get_bits8(gb, nal->data + 2, nal->size);", "switch (h->nal_unit_type) {", "case NAL_VPS:\nff_hevc_decode_nal_vps(h);", "break;", "case NAL_SPS:\nff_hevc_decode_nal_sps(h);", "break;", "case NAL_PPS:\nff_hevc_decode_nal_pps(h);", "break;", "case NAL_SEI_PREFIX:\ncase NAL_SEI_SUFFIX:\nff_hevc_decode_nal_sei(h);", "break;", "case NAL_TRAIL_N:\ncase NAL_TRAIL_R:\ncase NAL_TSA_N:\ncase NAL_TSA_R:\ncase NAL_STSA_N:\ncase NAL_STSA_R:\ncase NAL_RADL_N:\ncase NAL_RADL_R:\ncase NAL_RASL_N:\ncase NAL_RASL_R:\ncase NAL_BLA_W_LP:\ncase NAL_BLA_W_RADL:\ncase NAL_BLA_N_LP:\ncase NAL_IDR_W_RADL:\ncase NAL_IDR_N_LP:\ncase NAL_CRA_NUT:\nsh->first_slice_in_pic_flag = get_bits1(gb);", "VAR_0->picture_structure = h->picture_struct;", "VAR_0->field_order = h->picture_struct;", "if (IS_IRAP(h)) {", "VAR_0->key_frame = 1;", "sh->no_output_of_prior_pics_flag = get_bits1(gb);", "}", "sh->pps_id = get_ue_golomb(gb);", "if (sh->pps_id >= MAX_PPS_COUNT || !h->pps_list[sh->pps_id]) {", "av_log(h->VAR_1, AV_LOG_ERROR, \"PPS id out of range: %d\\n\", sh->pps_id);", "return AVERROR_INVALIDDATA;", "}", "h->pps = (HEVCPPS*)h->pps_list[sh->pps_id]->data;", "if (h->pps->sps_id >= MAX_SPS_COUNT || !h->sps_list[h->pps->sps_id]) {", "av_log(h->VAR_1, AV_LOG_ERROR, \"SPS id out of range: %d\\n\", h->pps->sps_id);", "return AVERROR_INVALIDDATA;", "}", "if (h->sps != (HEVCSPS*)h->sps_list[h->pps->sps_id]->data) {", "h->sps = (HEVCSPS*)h->sps_list[h->pps->sps_id]->data;", "h->vps = (HEVCVPS*)h->vps_list[h->sps->vps_id]->data;", "}", "if (!sh->first_slice_in_pic_flag) {", "int VAR_9;", "if (h->pps->dependent_slice_segments_enabled_flag)\nsh->dependent_slice_segment_flag = get_bits1(gb);", "else\nsh->dependent_slice_segment_flag = 0;", "VAR_9 = av_ceil_log2_c(h->sps->ctb_width *\nh->sps->ctb_height);", "sh->slice_segment_addr = get_bits(gb, VAR_9);", "if (sh->slice_segment_addr >= h->sps->ctb_width * h->sps->ctb_height) {", "av_log(h->VAR_1, AV_LOG_ERROR, \"Invalid slice segment address: %u.\\n\",\nsh->slice_segment_addr);", "return AVERROR_INVALIDDATA;", "}", "} else", "sh->dependent_slice_segment_flag = 0;", "if (sh->dependent_slice_segment_flag)\nbreak;", "for (VAR_6 = 0; VAR_6 < h->pps->num_extra_slice_header_bits; VAR_6++)", "skip_bits(gb, 1);", "sh->slice_type = get_ue_golomb(gb);", "if (!(sh->slice_type == I_SLICE || sh->slice_type == P_SLICE ||\nsh->slice_type == B_SLICE)) {", "av_log(h->VAR_1, AV_LOG_ERROR, \"Unknown slice type: %d.\\n\",\nsh->slice_type);", "return AVERROR_INVALIDDATA;", "}", "VAR_0->pict_type = sh->slice_type == B_SLICE ? AV_PICTURE_TYPE_B :\nsh->slice_type == P_SLICE ? AV_PICTURE_TYPE_P :\nAV_PICTURE_TYPE_I;", "if (h->pps->output_flag_present_flag)\nsh->pic_output_flag = get_bits1(gb);", "if (h->sps->separate_colour_plane_flag)\nsh->colour_plane_id = get_bits(gb, 2);", "if (!IS_IDR(h)) {", "sh->pic_order_cnt_lsb = get_bits(gb, h->sps->log2_max_poc_lsb);", "VAR_0->output_picture_number = h->poc = ff_hevc_compute_poc(h, sh->pic_order_cnt_lsb);", "} else", "VAR_0->output_picture_number = h->poc = 0;", "if (h->temporal_id == 0 &&\nh->nal_unit_type != NAL_TRAIL_N &&\nh->nal_unit_type != NAL_TSA_N &&\nh->nal_unit_type != NAL_STSA_N &&\nh->nal_unit_type != NAL_RADL_N &&\nh->nal_unit_type != NAL_RASL_N &&\nh->nal_unit_type != NAL_RADL_R &&\nh->nal_unit_type != NAL_RASL_R)\nh->pocTid0 = h->poc;", "return 0;", "}", "VAR_2 += VAR_8;", "}", "av_log(h->VAR_1, AV_LOG_ERROR, \"missing picture in access unit\\n\");", "return -1;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 35, 37 ], [ 41 ], [ 43 ], [ 45, 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 59 ], [ 63 ], [ 65 ], [ 67 ], [ 69, 71 ], [ 73 ], [ 77 ], [ 79 ], [ 81 ], [ 85, 87 ], [ 89 ], [ 93 ], [ 95, 97 ], [ 101 ], [ 103 ], [ 105, 107 ], [ 109 ], [ 111, 113 ], [ 115 ], [ 117, 119 ], [ 121 ], [ 123, 125, 127 ], [ 129 ], [ 131, 133, 135, 137, 139, 141, 143, 145, 147, 149, 151, 153, 155, 157, 159, 161, 163 ], [ 165 ], [ 167 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ], [ 213 ], [ 215 ], [ 219, 221 ], [ 223, 225 ], [ 229, 231 ], [ 233 ], [ 235 ], [ 237, 239 ], [ 241 ], [ 243 ], [ 245 ], [ 247 ], [ 251, 253 ], [ 257 ], [ 259 ], [ 263 ], [ 265, 267 ], [ 269, 271 ], [ 273 ], [ 275 ], [ 277, 279, 281 ], [ 285, 287 ], [ 291, 293 ], [ 297 ], [ 299 ], [ 301 ], [ 303 ], [ 305 ], [ 309, 311, 313, 315, 317, 319, 321, 323, 325 ], [ 329 ], [ 331 ], [ 333 ], [ 335 ], [ 339 ], [ 341 ], [ 343 ] ]
20,043
static void filter_mb_fast( H264Context *h, int mb_x, int mb_y, uint8_t *img_y, uint8_t *img_cb, uint8_t *img_cr, unsigned int linesize, unsigned int uvlinesize) { MpegEncContext * const s = &h->s; int mb_xy, mb_type; int qp, qp0, qp1, qpc, qpc0, qpc1, qp_thresh; mb_xy = mb_x + mb_y*s->mb_stride; if(mb_x==0 || mb_y==0 || !s->dsp.h264_loop_filter_strength || (h->deblocking_filter == 2 && (h->slice_table[mb_xy] != h->slice_table[h->top_mb_xy] || h->slice_table[mb_xy] != h->slice_table[mb_xy - 1]))) { filter_mb(h, mb_x, mb_y, img_y, img_cb, img_cr, linesize, uvlinesize); return; } assert(!FRAME_MBAFF); mb_type = s->current_picture.mb_type[mb_xy]; qp = s->current_picture.qscale_table[mb_xy]; qp0 = s->current_picture.qscale_table[mb_xy-1]; qp1 = s->current_picture.qscale_table[h->top_mb_xy]; qpc = get_chroma_qp( h, qp ); qpc0 = get_chroma_qp( h, qp0 ); qpc1 = get_chroma_qp( h, qp1 ); qp0 = (qp + qp0 + 1) >> 1; qp1 = (qp + qp1 + 1) >> 1; qpc0 = (qpc + qpc0 + 1) >> 1; qpc1 = (qpc + qpc1 + 1) >> 1; qp_thresh = 15 - h->slice_alpha_c0_offset; if(qp <= qp_thresh && qp0 <= qp_thresh && qp1 <= qp_thresh && qpc <= qp_thresh && qpc0 <= qp_thresh && qpc1 <= qp_thresh) return; if( IS_INTRA(mb_type) ) { int16_t bS4[4] = {4,4,4,4}; int16_t bS3[4] = {3,3,3,3}; if( IS_8x8DCT(mb_type) ) { filter_mb_edgev( h, &img_y[4*0], linesize, bS4, qp0 ); filter_mb_edgev( h, &img_y[4*2], linesize, bS3, qp ); filter_mb_edgeh( h, &img_y[4*0*linesize], linesize, bS4, qp1 ); filter_mb_edgeh( h, &img_y[4*2*linesize], linesize, bS3, qp ); } else { filter_mb_edgev( h, &img_y[4*0], linesize, bS4, qp0 ); filter_mb_edgev( h, &img_y[4*1], linesize, bS3, qp ); filter_mb_edgev( h, &img_y[4*2], linesize, bS3, qp ); filter_mb_edgev( h, &img_y[4*3], linesize, bS3, qp ); filter_mb_edgeh( h, &img_y[4*0*linesize], linesize, bS4, qp1 ); filter_mb_edgeh( h, &img_y[4*1*linesize], linesize, bS3, qp ); filter_mb_edgeh( h, &img_y[4*2*linesize], linesize, bS3, qp ); filter_mb_edgeh( h, &img_y[4*3*linesize], linesize, bS3, qp ); } filter_mb_edgecv( h, &img_cb[2*0], uvlinesize, bS4, qpc0 ); filter_mb_edgecv( h, &img_cb[2*2], uvlinesize, bS3, qpc ); filter_mb_edgecv( h, &img_cr[2*0], uvlinesize, bS4, qpc0 ); filter_mb_edgecv( h, &img_cr[2*2], uvlinesize, bS3, qpc ); filter_mb_edgech( h, &img_cb[2*0*uvlinesize], uvlinesize, bS4, qpc1 ); filter_mb_edgech( h, &img_cb[2*2*uvlinesize], uvlinesize, bS3, qpc ); filter_mb_edgech( h, &img_cr[2*0*uvlinesize], uvlinesize, bS4, qpc1 ); filter_mb_edgech( h, &img_cr[2*2*uvlinesize], uvlinesize, bS3, qpc ); return; } else { DECLARE_ALIGNED_8(int16_t, bS[2][4][4]); uint64_t (*bSv)[4] = (uint64_t(*)[4])bS; int edges; if( IS_8x8DCT(mb_type) && (h->cbp&7) == 7 ) { edges = 4; bSv[0][0] = bSv[0][2] = bSv[1][0] = bSv[1][2] = 0x0002000200020002ULL; } else { int mask_edge1 = (mb_type & (MB_TYPE_16x16 | MB_TYPE_8x16)) ? 3 : (mb_type & MB_TYPE_16x8) ? 1 : 0; int mask_edge0 = (mb_type & (MB_TYPE_16x16 | MB_TYPE_8x16)) && (s->current_picture.mb_type[mb_xy-1] & (MB_TYPE_16x16 | MB_TYPE_8x16)) ? 3 : 0; int step = IS_8x8DCT(mb_type) ? 2 : 1; edges = (mb_type & MB_TYPE_16x16) && !(h->cbp & 15) ? 1 : 4; s->dsp.h264_loop_filter_strength( bS, h->non_zero_count_cache, h->ref_cache, h->mv_cache, (h->slice_type == B_TYPE), edges, step, mask_edge0, mask_edge1 ); } if( IS_INTRA(s->current_picture.mb_type[mb_xy-1]) ) bSv[0][0] = 0x0004000400040004ULL; if( IS_INTRA(s->current_picture.mb_type[h->top_mb_xy]) ) bSv[1][0] = 0x0004000400040004ULL; #define FILTER(hv,dir,edge)\ if(bSv[dir][edge]) {\ filter_mb_edge##hv( h, &img_y[4*edge*(dir?linesize:1)], linesize, bS[dir][edge], edge ? qp : qp##dir );\ if(!(edge&1)) {\ filter_mb_edgec##hv( h, &img_cb[2*edge*(dir?uvlinesize:1)], uvlinesize, bS[dir][edge], edge ? qpc : qpc##dir );\ filter_mb_edgec##hv( h, &img_cr[2*edge*(dir?uvlinesize:1)], uvlinesize, bS[dir][edge], edge ? qpc : qpc##dir );\ }\ } if( edges == 1 ) { FILTER(v,0,0); FILTER(h,1,0); } else if( IS_8x8DCT(mb_type) ) { FILTER(v,0,0); FILTER(v,0,2); FILTER(h,1,0); FILTER(h,1,2); } else { FILTER(v,0,0); FILTER(v,0,1); FILTER(v,0,2); FILTER(v,0,3); FILTER(h,1,0); FILTER(h,1,1); FILTER(h,1,2); FILTER(h,1,3); } #undef FILTER } }
true
FFmpeg
4691a77db4672026d62d524fd292fb17db6514b4
static void filter_mb_fast( H264Context *h, int mb_x, int mb_y, uint8_t *img_y, uint8_t *img_cb, uint8_t *img_cr, unsigned int linesize, unsigned int uvlinesize) { MpegEncContext * const s = &h->s; int mb_xy, mb_type; int qp, qp0, qp1, qpc, qpc0, qpc1, qp_thresh; mb_xy = mb_x + mb_y*s->mb_stride; if(mb_x==0 || mb_y==0 || !s->dsp.h264_loop_filter_strength || (h->deblocking_filter == 2 && (h->slice_table[mb_xy] != h->slice_table[h->top_mb_xy] || h->slice_table[mb_xy] != h->slice_table[mb_xy - 1]))) { filter_mb(h, mb_x, mb_y, img_y, img_cb, img_cr, linesize, uvlinesize); return; } assert(!FRAME_MBAFF); mb_type = s->current_picture.mb_type[mb_xy]; qp = s->current_picture.qscale_table[mb_xy]; qp0 = s->current_picture.qscale_table[mb_xy-1]; qp1 = s->current_picture.qscale_table[h->top_mb_xy]; qpc = get_chroma_qp( h, qp ); qpc0 = get_chroma_qp( h, qp0 ); qpc1 = get_chroma_qp( h, qp1 ); qp0 = (qp + qp0 + 1) >> 1; qp1 = (qp + qp1 + 1) >> 1; qpc0 = (qpc + qpc0 + 1) >> 1; qpc1 = (qpc + qpc1 + 1) >> 1; qp_thresh = 15 - h->slice_alpha_c0_offset; if(qp <= qp_thresh && qp0 <= qp_thresh && qp1 <= qp_thresh && qpc <= qp_thresh && qpc0 <= qp_thresh && qpc1 <= qp_thresh) return; if( IS_INTRA(mb_type) ) { int16_t bS4[4] = {4,4,4,4}; int16_t bS3[4] = {3,3,3,3}; if( IS_8x8DCT(mb_type) ) { filter_mb_edgev( h, &img_y[4*0], linesize, bS4, qp0 ); filter_mb_edgev( h, &img_y[4*2], linesize, bS3, qp ); filter_mb_edgeh( h, &img_y[4*0*linesize], linesize, bS4, qp1 ); filter_mb_edgeh( h, &img_y[4*2*linesize], linesize, bS3, qp ); } else { filter_mb_edgev( h, &img_y[4*0], linesize, bS4, qp0 ); filter_mb_edgev( h, &img_y[4*1], linesize, bS3, qp ); filter_mb_edgev( h, &img_y[4*2], linesize, bS3, qp ); filter_mb_edgev( h, &img_y[4*3], linesize, bS3, qp ); filter_mb_edgeh( h, &img_y[4*0*linesize], linesize, bS4, qp1 ); filter_mb_edgeh( h, &img_y[4*1*linesize], linesize, bS3, qp ); filter_mb_edgeh( h, &img_y[4*2*linesize], linesize, bS3, qp ); filter_mb_edgeh( h, &img_y[4*3*linesize], linesize, bS3, qp ); } filter_mb_edgecv( h, &img_cb[2*0], uvlinesize, bS4, qpc0 ); filter_mb_edgecv( h, &img_cb[2*2], uvlinesize, bS3, qpc ); filter_mb_edgecv( h, &img_cr[2*0], uvlinesize, bS4, qpc0 ); filter_mb_edgecv( h, &img_cr[2*2], uvlinesize, bS3, qpc ); filter_mb_edgech( h, &img_cb[2*0*uvlinesize], uvlinesize, bS4, qpc1 ); filter_mb_edgech( h, &img_cb[2*2*uvlinesize], uvlinesize, bS3, qpc ); filter_mb_edgech( h, &img_cr[2*0*uvlinesize], uvlinesize, bS4, qpc1 ); filter_mb_edgech( h, &img_cr[2*2*uvlinesize], uvlinesize, bS3, qpc ); return; } else { DECLARE_ALIGNED_8(int16_t, bS[2][4][4]); uint64_t (*bSv)[4] = (uint64_t(*)[4])bS; int edges; if( IS_8x8DCT(mb_type) && (h->cbp&7) == 7 ) { edges = 4; bSv[0][0] = bSv[0][2] = bSv[1][0] = bSv[1][2] = 0x0002000200020002ULL; } else { int mask_edge1 = (mb_type & (MB_TYPE_16x16 | MB_TYPE_8x16)) ? 3 : (mb_type & MB_TYPE_16x8) ? 1 : 0; int mask_edge0 = (mb_type & (MB_TYPE_16x16 | MB_TYPE_8x16)) && (s->current_picture.mb_type[mb_xy-1] & (MB_TYPE_16x16 | MB_TYPE_8x16)) ? 3 : 0; int step = IS_8x8DCT(mb_type) ? 2 : 1; edges = (mb_type & MB_TYPE_16x16) && !(h->cbp & 15) ? 1 : 4; s->dsp.h264_loop_filter_strength( bS, h->non_zero_count_cache, h->ref_cache, h->mv_cache, (h->slice_type == B_TYPE), edges, step, mask_edge0, mask_edge1 ); } if( IS_INTRA(s->current_picture.mb_type[mb_xy-1]) ) bSv[0][0] = 0x0004000400040004ULL; if( IS_INTRA(s->current_picture.mb_type[h->top_mb_xy]) ) bSv[1][0] = 0x0004000400040004ULL; #define FILTER(hv,dir,edge)\ if(bSv[dir][edge]) {\ filter_mb_edge##hv( h, &img_y[4*edge*(dir?linesize:1)], linesize, bS[dir][edge], edge ? qp : qp##dir );\ if(!(edge&1)) {\ filter_mb_edgec##hv( h, &img_cb[2*edge*(dir?uvlinesize:1)], uvlinesize, bS[dir][edge], edge ? qpc : qpc##dir );\ filter_mb_edgec##hv( h, &img_cr[2*edge*(dir?uvlinesize:1)], uvlinesize, bS[dir][edge], edge ? qpc : qpc##dir );\ }\ } if( edges == 1 ) { FILTER(v,0,0); FILTER(h,1,0); } else if( IS_8x8DCT(mb_type) ) { FILTER(v,0,0); FILTER(v,0,2); FILTER(h,1,0); FILTER(h,1,2); } else { FILTER(v,0,0); FILTER(v,0,1); FILTER(v,0,2); FILTER(v,0,3); FILTER(h,1,0); FILTER(h,1,1); FILTER(h,1,2); FILTER(h,1,3); } #undef FILTER } }
{ "code": [ " if(mb_x==0 || mb_y==0 || !s->dsp.h264_loop_filter_strength ||", " qpc = get_chroma_qp( h, qp );", " qpc0 = get_chroma_qp( h, qp0 );", " qpc1 = get_chroma_qp( h, qp1 );" ], "line_no": [ 15, 39, 41, 43 ] }
static void FUNC_0( H264Context *VAR_0, int VAR_1, int VAR_2, uint8_t *VAR_3, uint8_t *VAR_4, uint8_t *VAR_5, unsigned int VAR_6, unsigned int VAR_7) { MpegEncContext * const s = &VAR_0->s; int VAR_8, VAR_9; int VAR_10, VAR_11, VAR_12, VAR_13, VAR_14, VAR_15, VAR_16; VAR_8 = VAR_1 + VAR_2*s->mb_stride; if(VAR_1==0 || VAR_2==0 || !s->dsp.h264_loop_filter_strength || (VAR_0->deblocking_filter == 2 && (VAR_0->slice_table[VAR_8] != VAR_0->slice_table[VAR_0->top_mb_xy] || VAR_0->slice_table[VAR_8] != VAR_0->slice_table[VAR_8 - 1]))) { filter_mb(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4, VAR_5, VAR_6, VAR_7); return; } assert(!FRAME_MBAFF); VAR_9 = s->current_picture.VAR_9[VAR_8]; VAR_10 = s->current_picture.qscale_table[VAR_8]; VAR_11 = s->current_picture.qscale_table[VAR_8-1]; VAR_12 = s->current_picture.qscale_table[VAR_0->top_mb_xy]; VAR_13 = get_chroma_qp( VAR_0, VAR_10 ); VAR_14 = get_chroma_qp( VAR_0, VAR_11 ); VAR_15 = get_chroma_qp( VAR_0, VAR_12 ); VAR_11 = (VAR_10 + VAR_11 + 1) >> 1; VAR_12 = (VAR_10 + VAR_12 + 1) >> 1; VAR_14 = (VAR_13 + VAR_14 + 1) >> 1; VAR_15 = (VAR_13 + VAR_15 + 1) >> 1; VAR_16 = 15 - VAR_0->slice_alpha_c0_offset; if(VAR_10 <= VAR_16 && VAR_11 <= VAR_16 && VAR_12 <= VAR_16 && VAR_13 <= VAR_16 && VAR_14 <= VAR_16 && VAR_15 <= VAR_16) return; if( IS_INTRA(VAR_9) ) { int16_t bS4[4] = {4,4,4,4}; int16_t bS3[4] = {3,3,3,3}; if( IS_8x8DCT(VAR_9) ) { filter_mb_edgev( VAR_0, &VAR_3[4*0], VAR_6, bS4, VAR_11 ); filter_mb_edgev( VAR_0, &VAR_3[4*2], VAR_6, bS3, VAR_10 ); filter_mb_edgeh( VAR_0, &VAR_3[4*0*VAR_6], VAR_6, bS4, VAR_12 ); filter_mb_edgeh( VAR_0, &VAR_3[4*2*VAR_6], VAR_6, bS3, VAR_10 ); } else { filter_mb_edgev( VAR_0, &VAR_3[4*0], VAR_6, bS4, VAR_11 ); filter_mb_edgev( VAR_0, &VAR_3[4*1], VAR_6, bS3, VAR_10 ); filter_mb_edgev( VAR_0, &VAR_3[4*2], VAR_6, bS3, VAR_10 ); filter_mb_edgev( VAR_0, &VAR_3[4*3], VAR_6, bS3, VAR_10 ); filter_mb_edgeh( VAR_0, &VAR_3[4*0*VAR_6], VAR_6, bS4, VAR_12 ); filter_mb_edgeh( VAR_0, &VAR_3[4*1*VAR_6], VAR_6, bS3, VAR_10 ); filter_mb_edgeh( VAR_0, &VAR_3[4*2*VAR_6], VAR_6, bS3, VAR_10 ); filter_mb_edgeh( VAR_0, &VAR_3[4*3*VAR_6], VAR_6, bS3, VAR_10 ); } filter_mb_edgecv( VAR_0, &VAR_4[2*0], VAR_7, bS4, VAR_14 ); filter_mb_edgecv( VAR_0, &VAR_4[2*2], VAR_7, bS3, VAR_13 ); filter_mb_edgecv( VAR_0, &VAR_5[2*0], VAR_7, bS4, VAR_14 ); filter_mb_edgecv( VAR_0, &VAR_5[2*2], VAR_7, bS3, VAR_13 ); filter_mb_edgech( VAR_0, &VAR_4[2*0*VAR_7], VAR_7, bS4, VAR_15 ); filter_mb_edgech( VAR_0, &VAR_4[2*2*VAR_7], VAR_7, bS3, VAR_13 ); filter_mb_edgech( VAR_0, &VAR_5[2*0*VAR_7], VAR_7, bS4, VAR_15 ); filter_mb_edgech( VAR_0, &VAR_5[2*2*VAR_7], VAR_7, bS3, VAR_13 ); return; } else { DECLARE_ALIGNED_8(int16_t, bS[2][4][4]); uint64_t (*bSv)[4] = (uint64_t(*)[4])bS; int VAR_17; if( IS_8x8DCT(VAR_9) && (VAR_0->cbp&7) == 7 ) { VAR_17 = 4; bSv[0][0] = bSv[0][2] = bSv[1][0] = bSv[1][2] = 0x0002000200020002ULL; } else { int VAR_18 = (VAR_9 & (MB_TYPE_16x16 | MB_TYPE_8x16)) ? 3 : (VAR_9 & MB_TYPE_16x8) ? 1 : 0; int VAR_19 = (VAR_9 & (MB_TYPE_16x16 | MB_TYPE_8x16)) && (s->current_picture.VAR_9[VAR_8-1] & (MB_TYPE_16x16 | MB_TYPE_8x16)) ? 3 : 0; int VAR_20 = IS_8x8DCT(VAR_9) ? 2 : 1; VAR_17 = (VAR_9 & MB_TYPE_16x16) && !(VAR_0->cbp & 15) ? 1 : 4; s->dsp.h264_loop_filter_strength( bS, VAR_0->non_zero_count_cache, VAR_0->ref_cache, VAR_0->mv_cache, (VAR_0->slice_type == B_TYPE), VAR_17, VAR_20, VAR_19, VAR_18 ); } if( IS_INTRA(s->current_picture.VAR_9[VAR_8-1]) ) bSv[0][0] = 0x0004000400040004ULL; if( IS_INTRA(s->current_picture.VAR_9[VAR_0->top_mb_xy]) ) bSv[1][0] = 0x0004000400040004ULL; #define FILTER(hv,dir,edge)\ if(bSv[dir][edge]) {\ filter_mb_edge##hv( VAR_0, &VAR_3[4*edge*(dir?VAR_6:1)], VAR_6, bS[dir][edge], edge ? VAR_10 : VAR_10##dir );\ if(!(edge&1)) {\ filter_mb_edgec##hv( VAR_0, &VAR_4[2*edge*(dir?VAR_7:1)], VAR_7, bS[dir][edge], edge ? VAR_13 : VAR_13##dir );\ filter_mb_edgec##hv( VAR_0, &VAR_5[2*edge*(dir?VAR_7:1)], VAR_7, bS[dir][edge], edge ? VAR_13 : VAR_13##dir );\ }\ } if( VAR_17 == 1 ) { FILTER(v,0,0); FILTER(VAR_0,1,0); } else if( IS_8x8DCT(VAR_9) ) { FILTER(v,0,0); FILTER(v,0,2); FILTER(VAR_0,1,0); FILTER(VAR_0,1,2); } else { FILTER(v,0,0); FILTER(v,0,1); FILTER(v,0,2); FILTER(v,0,3); FILTER(VAR_0,1,0); FILTER(VAR_0,1,1); FILTER(VAR_0,1,2); FILTER(VAR_0,1,3); } #undef FILTER } }
[ "static void FUNC_0( H264Context *VAR_0, int VAR_1, int VAR_2, uint8_t *VAR_3, uint8_t *VAR_4, uint8_t *VAR_5, unsigned int VAR_6, unsigned int VAR_7) {", "MpegEncContext * const s = &VAR_0->s;", "int VAR_8, VAR_9;", "int VAR_10, VAR_11, VAR_12, VAR_13, VAR_14, VAR_15, VAR_16;", "VAR_8 = VAR_1 + VAR_2*s->mb_stride;", "if(VAR_1==0 || VAR_2==0 || !s->dsp.h264_loop_filter_strength ||\n(VAR_0->deblocking_filter == 2 && (VAR_0->slice_table[VAR_8] != VAR_0->slice_table[VAR_0->top_mb_xy] ||\nVAR_0->slice_table[VAR_8] != VAR_0->slice_table[VAR_8 - 1]))) {", "filter_mb(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4, VAR_5, VAR_6, VAR_7);", "return;", "}", "assert(!FRAME_MBAFF);", "VAR_9 = s->current_picture.VAR_9[VAR_8];", "VAR_10 = s->current_picture.qscale_table[VAR_8];", "VAR_11 = s->current_picture.qscale_table[VAR_8-1];", "VAR_12 = s->current_picture.qscale_table[VAR_0->top_mb_xy];", "VAR_13 = get_chroma_qp( VAR_0, VAR_10 );", "VAR_14 = get_chroma_qp( VAR_0, VAR_11 );", "VAR_15 = get_chroma_qp( VAR_0, VAR_12 );", "VAR_11 = (VAR_10 + VAR_11 + 1) >> 1;", "VAR_12 = (VAR_10 + VAR_12 + 1) >> 1;", "VAR_14 = (VAR_13 + VAR_14 + 1) >> 1;", "VAR_15 = (VAR_13 + VAR_15 + 1) >> 1;", "VAR_16 = 15 - VAR_0->slice_alpha_c0_offset;", "if(VAR_10 <= VAR_16 && VAR_11 <= VAR_16 && VAR_12 <= VAR_16 &&\nVAR_13 <= VAR_16 && VAR_14 <= VAR_16 && VAR_15 <= VAR_16)\nreturn;", "if( IS_INTRA(VAR_9) ) {", "int16_t bS4[4] = {4,4,4,4};", "int16_t bS3[4] = {3,3,3,3};", "if( IS_8x8DCT(VAR_9) ) {", "filter_mb_edgev( VAR_0, &VAR_3[4*0], VAR_6, bS4, VAR_11 );", "filter_mb_edgev( VAR_0, &VAR_3[4*2], VAR_6, bS3, VAR_10 );", "filter_mb_edgeh( VAR_0, &VAR_3[4*0*VAR_6], VAR_6, bS4, VAR_12 );", "filter_mb_edgeh( VAR_0, &VAR_3[4*2*VAR_6], VAR_6, bS3, VAR_10 );", "} else {", "filter_mb_edgev( VAR_0, &VAR_3[4*0], VAR_6, bS4, VAR_11 );", "filter_mb_edgev( VAR_0, &VAR_3[4*1], VAR_6, bS3, VAR_10 );", "filter_mb_edgev( VAR_0, &VAR_3[4*2], VAR_6, bS3, VAR_10 );", "filter_mb_edgev( VAR_0, &VAR_3[4*3], VAR_6, bS3, VAR_10 );", "filter_mb_edgeh( VAR_0, &VAR_3[4*0*VAR_6], VAR_6, bS4, VAR_12 );", "filter_mb_edgeh( VAR_0, &VAR_3[4*1*VAR_6], VAR_6, bS3, VAR_10 );", "filter_mb_edgeh( VAR_0, &VAR_3[4*2*VAR_6], VAR_6, bS3, VAR_10 );", "filter_mb_edgeh( VAR_0, &VAR_3[4*3*VAR_6], VAR_6, bS3, VAR_10 );", "}", "filter_mb_edgecv( VAR_0, &VAR_4[2*0], VAR_7, bS4, VAR_14 );", "filter_mb_edgecv( VAR_0, &VAR_4[2*2], VAR_7, bS3, VAR_13 );", "filter_mb_edgecv( VAR_0, &VAR_5[2*0], VAR_7, bS4, VAR_14 );", "filter_mb_edgecv( VAR_0, &VAR_5[2*2], VAR_7, bS3, VAR_13 );", "filter_mb_edgech( VAR_0, &VAR_4[2*0*VAR_7], VAR_7, bS4, VAR_15 );", "filter_mb_edgech( VAR_0, &VAR_4[2*2*VAR_7], VAR_7, bS3, VAR_13 );", "filter_mb_edgech( VAR_0, &VAR_5[2*0*VAR_7], VAR_7, bS4, VAR_15 );", "filter_mb_edgech( VAR_0, &VAR_5[2*2*VAR_7], VAR_7, bS3, VAR_13 );", "return;", "} else {", "DECLARE_ALIGNED_8(int16_t, bS[2][4][4]);", "uint64_t (*bSv)[4] = (uint64_t(*)[4])bS;", "int VAR_17;", "if( IS_8x8DCT(VAR_9) && (VAR_0->cbp&7) == 7 ) {", "VAR_17 = 4;", "bSv[0][0] = bSv[0][2] = bSv[1][0] = bSv[1][2] = 0x0002000200020002ULL;", "} else {", "int VAR_18 = (VAR_9 & (MB_TYPE_16x16 | MB_TYPE_8x16)) ? 3 :\n(VAR_9 & MB_TYPE_16x8) ? 1 : 0;", "int VAR_19 = (VAR_9 & (MB_TYPE_16x16 | MB_TYPE_8x16))\n&& (s->current_picture.VAR_9[VAR_8-1] & (MB_TYPE_16x16 | MB_TYPE_8x16))\n? 3 : 0;", "int VAR_20 = IS_8x8DCT(VAR_9) ? 2 : 1;", "VAR_17 = (VAR_9 & MB_TYPE_16x16) && !(VAR_0->cbp & 15) ? 1 : 4;", "s->dsp.h264_loop_filter_strength( bS, VAR_0->non_zero_count_cache, VAR_0->ref_cache, VAR_0->mv_cache,\n(VAR_0->slice_type == B_TYPE), VAR_17, VAR_20, VAR_19, VAR_18 );", "}", "if( IS_INTRA(s->current_picture.VAR_9[VAR_8-1]) )\nbSv[0][0] = 0x0004000400040004ULL;", "if( IS_INTRA(s->current_picture.VAR_9[VAR_0->top_mb_xy]) )\nbSv[1][0] = 0x0004000400040004ULL;", "#define FILTER(hv,dir,edge)\\\nif(bSv[dir][edge]) {\\", "filter_mb_edge##hv( VAR_0, &VAR_3[4*edge*(dir?VAR_6:1)], VAR_6, bS[dir][edge], edge ? VAR_10 : VAR_10##dir );\\", "if(!(edge&1)) {\\", "filter_mb_edgec##hv( VAR_0, &VAR_4[2*edge*(dir?VAR_7:1)], VAR_7, bS[dir][edge], edge ? VAR_13 : VAR_13##dir );\\", "filter_mb_edgec##hv( VAR_0, &VAR_5[2*edge*(dir?VAR_7:1)], VAR_7, bS[dir][edge], edge ? VAR_13 : VAR_13##dir );\\", "}\\", "}", "if( VAR_17 == 1 ) {", "FILTER(v,0,0);", "FILTER(VAR_0,1,0);", "} else if( IS_8x8DCT(VAR_9) ) {", "FILTER(v,0,0);", "FILTER(v,0,2);", "FILTER(VAR_0,1,0);", "FILTER(VAR_0,1,2);", "} else {", "FILTER(v,0,0);", "FILTER(v,0,1);", "FILTER(v,0,2);", "FILTER(v,0,3);", "FILTER(VAR_0,1,0);", "FILTER(VAR_0,1,1);", "FILTER(VAR_0,1,2);", "FILTER(VAR_0,1,3);", "}", "#undef FILTER\n}", "}" ]
[ 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1 ], [ 3 ], [ 5 ], [ 7 ], [ 11 ], [ 15, 17, 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55, 57, 59 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133, 135 ], [ 137, 139, 141 ], [ 143 ], [ 145 ], [ 147, 149 ], [ 151 ], [ 153, 155 ], [ 157, 159 ], [ 163, 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ], [ 215, 217 ], [ 219 ] ]
20,044
static int decode_frame_header(NUTContext *nut, int64_t *pts, int *stream_id, uint8_t *header_idx, int frame_code) { AVFormatContext *s = nut->avf; AVIOContext *bc = s->pb; StreamContext *stc; int size, flags, size_mul, pts_delta, i, reserved_count; uint64_t tmp; if (avio_tell(bc) > nut->last_syncpoint_pos + nut->max_distance) { av_log(s, AV_LOG_ERROR, "Last frame must have been damaged %"PRId64" > %"PRId64" + %d\n", avio_tell(bc), nut->last_syncpoint_pos, nut->max_distance); return AVERROR_INVALIDDATA; } flags = nut->frame_code[frame_code].flags; size_mul = nut->frame_code[frame_code].size_mul; size = nut->frame_code[frame_code].size_lsb; *stream_id = nut->frame_code[frame_code].stream_id; pts_delta = nut->frame_code[frame_code].pts_delta; reserved_count = nut->frame_code[frame_code].reserved_count; *header_idx = nut->frame_code[frame_code].header_idx; if (flags & FLAG_INVALID) return AVERROR_INVALIDDATA; if (flags & FLAG_CODED) flags ^= ffio_read_varlen(bc); if (flags & FLAG_STREAM_ID) { GET_V(*stream_id, tmp < s->nb_streams); } stc = &nut->stream[*stream_id]; if (flags & FLAG_CODED_PTS) { int coded_pts = ffio_read_varlen(bc); // FIXME check last_pts validity? if (coded_pts < (1 << stc->msb_pts_shift)) { *pts = ff_lsb2full(stc, coded_pts); } else *pts = coded_pts - (1 << stc->msb_pts_shift); } else *pts = stc->last_pts + pts_delta; if (flags & FLAG_SIZE_MSB) size += size_mul * ffio_read_varlen(bc); if (flags & FLAG_MATCH_TIME) get_s(bc); if (flags & FLAG_HEADER_IDX) *header_idx = ffio_read_varlen(bc); if (flags & FLAG_RESERVED) reserved_count = ffio_read_varlen(bc); for (i = 0; i < reserved_count; i++) ffio_read_varlen(bc); if (*header_idx >= (unsigned)nut->header_count) { av_log(s, AV_LOG_ERROR, "header_idx invalid\n"); return AVERROR_INVALIDDATA; } if (size > 4096) *header_idx = 0; size -= nut->header_len[*header_idx]; if (flags & FLAG_CHECKSUM) { avio_rb32(bc); // FIXME check this } else if (size > 2 * nut->max_distance || FFABS(stc->last_pts - *pts) > stc->max_pts_distance) { av_log(s, AV_LOG_ERROR, "frame size > 2max_distance and no checksum\n"); return AVERROR_INVALIDDATA; } stc->last_pts = *pts; stc->last_flags = flags; return size; }
true
FFmpeg
73581afe01b41d0028afb6b14f5493568cf1be3d
static int decode_frame_header(NUTContext *nut, int64_t *pts, int *stream_id, uint8_t *header_idx, int frame_code) { AVFormatContext *s = nut->avf; AVIOContext *bc = s->pb; StreamContext *stc; int size, flags, size_mul, pts_delta, i, reserved_count; uint64_t tmp; if (avio_tell(bc) > nut->last_syncpoint_pos + nut->max_distance) { av_log(s, AV_LOG_ERROR, "Last frame must have been damaged %"PRId64" > %"PRId64" + %d\n", avio_tell(bc), nut->last_syncpoint_pos, nut->max_distance); return AVERROR_INVALIDDATA; } flags = nut->frame_code[frame_code].flags; size_mul = nut->frame_code[frame_code].size_mul; size = nut->frame_code[frame_code].size_lsb; *stream_id = nut->frame_code[frame_code].stream_id; pts_delta = nut->frame_code[frame_code].pts_delta; reserved_count = nut->frame_code[frame_code].reserved_count; *header_idx = nut->frame_code[frame_code].header_idx; if (flags & FLAG_INVALID) return AVERROR_INVALIDDATA; if (flags & FLAG_CODED) flags ^= ffio_read_varlen(bc); if (flags & FLAG_STREAM_ID) { GET_V(*stream_id, tmp < s->nb_streams); } stc = &nut->stream[*stream_id]; if (flags & FLAG_CODED_PTS) { int coded_pts = ffio_read_varlen(bc); if (coded_pts < (1 << stc->msb_pts_shift)) { *pts = ff_lsb2full(stc, coded_pts); } else *pts = coded_pts - (1 << stc->msb_pts_shift); } else *pts = stc->last_pts + pts_delta; if (flags & FLAG_SIZE_MSB) size += size_mul * ffio_read_varlen(bc); if (flags & FLAG_MATCH_TIME) get_s(bc); if (flags & FLAG_HEADER_IDX) *header_idx = ffio_read_varlen(bc); if (flags & FLAG_RESERVED) reserved_count = ffio_read_varlen(bc); for (i = 0; i < reserved_count; i++) ffio_read_varlen(bc); if (*header_idx >= (unsigned)nut->header_count) { av_log(s, AV_LOG_ERROR, "header_idx invalid\n"); return AVERROR_INVALIDDATA; } if (size > 4096) *header_idx = 0; size -= nut->header_len[*header_idx]; if (flags & FLAG_CHECKSUM) { avio_rb32(bc); } else if (size > 2 * nut->max_distance || FFABS(stc->last_pts - *pts) > stc->max_pts_distance) { av_log(s, AV_LOG_ERROR, "frame size > 2max_distance and no checksum\n"); return AVERROR_INVALIDDATA; } stc->last_pts = *pts; stc->last_flags = flags; return size; }
{ "code": [ " *pts = coded_pts - (1 << stc->msb_pts_shift);" ], "line_no": [ 77 ] }
static int FUNC_0(NUTContext *VAR_0, int64_t *VAR_1, int *VAR_2, uint8_t *VAR_3, int VAR_4) { AVFormatContext *s = VAR_0->avf; AVIOContext *bc = s->pb; StreamContext *stc; int VAR_5, VAR_6, VAR_7, VAR_8, VAR_9, VAR_10; uint64_t tmp; if (avio_tell(bc) > VAR_0->last_syncpoint_pos + VAR_0->max_distance) { av_log(s, AV_LOG_ERROR, "Last frame must have been damaged %"PRId64" > %"PRId64" + %d\n", avio_tell(bc), VAR_0->last_syncpoint_pos, VAR_0->max_distance); return AVERROR_INVALIDDATA; } VAR_6 = VAR_0->VAR_4[VAR_4].VAR_6; VAR_7 = VAR_0->VAR_4[VAR_4].VAR_7; VAR_5 = VAR_0->VAR_4[VAR_4].size_lsb; *VAR_2 = VAR_0->VAR_4[VAR_4].VAR_2; VAR_8 = VAR_0->VAR_4[VAR_4].VAR_8; VAR_10 = VAR_0->VAR_4[VAR_4].VAR_10; *VAR_3 = VAR_0->VAR_4[VAR_4].VAR_3; if (VAR_6 & FLAG_INVALID) return AVERROR_INVALIDDATA; if (VAR_6 & FLAG_CODED) VAR_6 ^= ffio_read_varlen(bc); if (VAR_6 & FLAG_STREAM_ID) { GET_V(*VAR_2, tmp < s->nb_streams); } stc = &VAR_0->stream[*VAR_2]; if (VAR_6 & FLAG_CODED_PTS) { int VAR_11 = ffio_read_varlen(bc); if (VAR_11 < (1 << stc->msb_pts_shift)) { *VAR_1 = ff_lsb2full(stc, VAR_11); } else *VAR_1 = VAR_11 - (1 << stc->msb_pts_shift); } else *VAR_1 = stc->last_pts + VAR_8; if (VAR_6 & FLAG_SIZE_MSB) VAR_5 += VAR_7 * ffio_read_varlen(bc); if (VAR_6 & FLAG_MATCH_TIME) get_s(bc); if (VAR_6 & FLAG_HEADER_IDX) *VAR_3 = ffio_read_varlen(bc); if (VAR_6 & FLAG_RESERVED) VAR_10 = ffio_read_varlen(bc); for (VAR_9 = 0; VAR_9 < VAR_10; VAR_9++) ffio_read_varlen(bc); if (*VAR_3 >= (unsigned)VAR_0->header_count) { av_log(s, AV_LOG_ERROR, "VAR_3 invalid\n"); return AVERROR_INVALIDDATA; } if (VAR_5 > 4096) *VAR_3 = 0; VAR_5 -= VAR_0->header_len[*VAR_3]; if (VAR_6 & FLAG_CHECKSUM) { avio_rb32(bc); } else if (VAR_5 > 2 * VAR_0->max_distance || FFABS(stc->last_pts - *VAR_1) > stc->max_pts_distance) { av_log(s, AV_LOG_ERROR, "frame VAR_5 > 2max_distance and no checksum\n"); return AVERROR_INVALIDDATA; } stc->last_pts = *VAR_1; stc->last_flags = VAR_6; return VAR_5; }
[ "static int FUNC_0(NUTContext *VAR_0, int64_t *VAR_1, int *VAR_2,\nuint8_t *VAR_3, int VAR_4)\n{", "AVFormatContext *s = VAR_0->avf;", "AVIOContext *bc = s->pb;", "StreamContext *stc;", "int VAR_5, VAR_6, VAR_7, VAR_8, VAR_9, VAR_10;", "uint64_t tmp;", "if (avio_tell(bc) > VAR_0->last_syncpoint_pos + VAR_0->max_distance) {", "av_log(s, AV_LOG_ERROR,\n\"Last frame must have been damaged %\"PRId64\" > %\"PRId64\" + %d\\n\",\navio_tell(bc), VAR_0->last_syncpoint_pos, VAR_0->max_distance);", "return AVERROR_INVALIDDATA;", "}", "VAR_6 = VAR_0->VAR_4[VAR_4].VAR_6;", "VAR_7 = VAR_0->VAR_4[VAR_4].VAR_7;", "VAR_5 = VAR_0->VAR_4[VAR_4].size_lsb;", "*VAR_2 = VAR_0->VAR_4[VAR_4].VAR_2;", "VAR_8 = VAR_0->VAR_4[VAR_4].VAR_8;", "VAR_10 = VAR_0->VAR_4[VAR_4].VAR_10;", "*VAR_3 = VAR_0->VAR_4[VAR_4].VAR_3;", "if (VAR_6 & FLAG_INVALID)\nreturn AVERROR_INVALIDDATA;", "if (VAR_6 & FLAG_CODED)\nVAR_6 ^= ffio_read_varlen(bc);", "if (VAR_6 & FLAG_STREAM_ID) {", "GET_V(*VAR_2, tmp < s->nb_streams);", "}", "stc = &VAR_0->stream[*VAR_2];", "if (VAR_6 & FLAG_CODED_PTS) {", "int VAR_11 = ffio_read_varlen(bc);", "if (VAR_11 < (1 << stc->msb_pts_shift)) {", "*VAR_1 = ff_lsb2full(stc, VAR_11);", "} else", "*VAR_1 = VAR_11 - (1 << stc->msb_pts_shift);", "} else", "*VAR_1 = stc->last_pts + VAR_8;", "if (VAR_6 & FLAG_SIZE_MSB)\nVAR_5 += VAR_7 * ffio_read_varlen(bc);", "if (VAR_6 & FLAG_MATCH_TIME)\nget_s(bc);", "if (VAR_6 & FLAG_HEADER_IDX)\n*VAR_3 = ffio_read_varlen(bc);", "if (VAR_6 & FLAG_RESERVED)\nVAR_10 = ffio_read_varlen(bc);", "for (VAR_9 = 0; VAR_9 < VAR_10; VAR_9++)", "ffio_read_varlen(bc);", "if (*VAR_3 >= (unsigned)VAR_0->header_count) {", "av_log(s, AV_LOG_ERROR, \"VAR_3 invalid\\n\");", "return AVERROR_INVALIDDATA;", "}", "if (VAR_5 > 4096)\n*VAR_3 = 0;", "VAR_5 -= VAR_0->header_len[*VAR_3];", "if (VAR_6 & FLAG_CHECKSUM) {", "avio_rb32(bc);", "} else if (VAR_5 > 2 * VAR_0->max_distance || FFABS(stc->last_pts - *VAR_1) >", "stc->max_pts_distance) {", "av_log(s, AV_LOG_ERROR, \"frame VAR_5 > 2max_distance and no checksum\\n\");", "return AVERROR_INVALIDDATA;", "}", "stc->last_pts = *VAR_1;", "stc->last_flags = VAR_6;", "return VAR_5;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21, 23, 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 49, 51 ], [ 53, 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83, 85 ], [ 87, 89 ], [ 91, 93 ], [ 95, 97 ], [ 99 ], [ 101 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113, 115 ], [ 117 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 137 ], [ 139 ], [ 143 ], [ 145 ] ]
20,045
static int vmstate_n_elems(void *opaque, VMStateField *field) { int n_elems = 1; if (field->flags & VMS_ARRAY) { n_elems = field->num; } else if (field->flags & VMS_VARRAY_INT32) { n_elems = *(int32_t *)(opaque+field->num_offset); } else if (field->flags & VMS_VARRAY_UINT32) { n_elems = *(uint32_t *)(opaque+field->num_offset); } else if (field->flags & VMS_VARRAY_UINT16) { n_elems = *(uint16_t *)(opaque+field->num_offset); } else if (field->flags & VMS_VARRAY_UINT8) { n_elems = *(uint8_t *)(opaque+field->num_offset); } return n_elems; }
true
qemu
60fe637bf0e4d7989e21e50f52526444765c63b4
static int vmstate_n_elems(void *opaque, VMStateField *field) { int n_elems = 1; if (field->flags & VMS_ARRAY) { n_elems = field->num; } else if (field->flags & VMS_VARRAY_INT32) { n_elems = *(int32_t *)(opaque+field->num_offset); } else if (field->flags & VMS_VARRAY_UINT32) { n_elems = *(uint32_t *)(opaque+field->num_offset); } else if (field->flags & VMS_VARRAY_UINT16) { n_elems = *(uint16_t *)(opaque+field->num_offset); } else if (field->flags & VMS_VARRAY_UINT8) { n_elems = *(uint8_t *)(opaque+field->num_offset); } return n_elems; }
{ "code": [], "line_no": [] }
static int FUNC_0(void *VAR_0, VMStateField *VAR_1) { int VAR_2 = 1; if (VAR_1->flags & VMS_ARRAY) { VAR_2 = VAR_1->num; } else if (VAR_1->flags & VMS_VARRAY_INT32) { VAR_2 = *(int32_t *)(VAR_0+VAR_1->num_offset); } else if (VAR_1->flags & VMS_VARRAY_UINT32) { VAR_2 = *(uint32_t *)(VAR_0+VAR_1->num_offset); } else if (VAR_1->flags & VMS_VARRAY_UINT16) { VAR_2 = *(uint16_t *)(VAR_0+VAR_1->num_offset); } else if (VAR_1->flags & VMS_VARRAY_UINT8) { VAR_2 = *(uint8_t *)(VAR_0+VAR_1->num_offset); } return VAR_2; }
[ "static int FUNC_0(void *VAR_0, VMStateField *VAR_1)\n{", "int VAR_2 = 1;", "if (VAR_1->flags & VMS_ARRAY) {", "VAR_2 = VAR_1->num;", "} else if (VAR_1->flags & VMS_VARRAY_INT32) {", "VAR_2 = *(int32_t *)(VAR_0+VAR_1->num_offset);", "} else if (VAR_1->flags & VMS_VARRAY_UINT32) {", "VAR_2 = *(uint32_t *)(VAR_0+VAR_1->num_offset);", "} else if (VAR_1->flags & VMS_VARRAY_UINT16) {", "VAR_2 = *(uint16_t *)(VAR_0+VAR_1->num_offset);", "} else if (VAR_1->flags & VMS_VARRAY_UINT8) {", "VAR_2 = *(uint8_t *)(VAR_0+VAR_1->num_offset);", "}", "return VAR_2;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ] ]
20,046
static void mm_decode_intra(MmContext * s, int half_horiz, int half_vert, const uint8_t *buf, int buf_size) { int i, x, y; i=0; x=0; y=0; while(i<buf_size) { int run_length, color; if (buf[i] & 0x80) { run_length = 1; color = buf[i]; i++; }else{ run_length = (buf[i] & 0x7f) + 2; color = buf[i+1]; i+=2; } if (half_horiz) run_length *=2; if (color) { memset(s->frame.data[0] + y*s->frame.linesize[0] + x, color, run_length); if (half_vert) memset(s->frame.data[0] + (y+1)*s->frame.linesize[0] + x, color, run_length); } x+= run_length; if (x >= s->avctx->width) { x=0; y += 1 + half_vert; } } }
true
FFmpeg
94e58e5770d2a2295a13240f51ddba583e6d5360
static void mm_decode_intra(MmContext * s, int half_horiz, int half_vert, const uint8_t *buf, int buf_size) { int i, x, y; i=0; x=0; y=0; while(i<buf_size) { int run_length, color; if (buf[i] & 0x80) { run_length = 1; color = buf[i]; i++; }else{ run_length = (buf[i] & 0x7f) + 2; color = buf[i+1]; i+=2; } if (half_horiz) run_length *=2; if (color) { memset(s->frame.data[0] + y*s->frame.linesize[0] + x, color, run_length); if (half_vert) memset(s->frame.data[0] + (y+1)*s->frame.linesize[0] + x, color, run_length); } x+= run_length; if (x >= s->avctx->width) { x=0; y += 1 + half_vert; } } }
{ "code": [], "line_no": [] }
static void FUNC_0(MmContext * VAR_0, int VAR_1, int VAR_2, const uint8_t *VAR_3, int VAR_4) { int VAR_5, VAR_6, VAR_7; VAR_5=0; VAR_6=0; VAR_7=0; while(VAR_5<VAR_4) { int VAR_8, VAR_9; if (VAR_3[VAR_5] & 0x80) { VAR_8 = 1; VAR_9 = VAR_3[VAR_5]; VAR_5++; }else{ VAR_8 = (VAR_3[VAR_5] & 0x7f) + 2; VAR_9 = VAR_3[VAR_5+1]; VAR_5+=2; } if (VAR_1) VAR_8 *=2; if (VAR_9) { memset(VAR_0->frame.data[0] + VAR_7*VAR_0->frame.linesize[0] + VAR_6, VAR_9, VAR_8); if (VAR_2) memset(VAR_0->frame.data[0] + (VAR_7+1)*VAR_0->frame.linesize[0] + VAR_6, VAR_9, VAR_8); } VAR_6+= VAR_8; if (VAR_6 >= VAR_0->avctx->width) { VAR_6=0; VAR_7 += 1 + VAR_2; } } }
[ "static void FUNC_0(MmContext * VAR_0, int VAR_1, int VAR_2, const uint8_t *VAR_3, int VAR_4)\n{", "int VAR_5, VAR_6, VAR_7;", "VAR_5=0; VAR_6=0; VAR_7=0;", "while(VAR_5<VAR_4) {", "int VAR_8, VAR_9;", "if (VAR_3[VAR_5] & 0x80) {", "VAR_8 = 1;", "VAR_9 = VAR_3[VAR_5];", "VAR_5++;", "}else{", "VAR_8 = (VAR_3[VAR_5] & 0x7f) + 2;", "VAR_9 = VAR_3[VAR_5+1];", "VAR_5+=2;", "}", "if (VAR_1)\nVAR_8 *=2;", "if (VAR_9) {", "memset(VAR_0->frame.data[0] + VAR_7*VAR_0->frame.linesize[0] + VAR_6, VAR_9, VAR_8);", "if (VAR_2)\nmemset(VAR_0->frame.data[0] + (VAR_7+1)*VAR_0->frame.linesize[0] + VAR_6, VAR_9, VAR_8);", "}", "VAR_6+= VAR_8;", "if (VAR_6 >= VAR_0->avctx->width) {", "VAR_6=0;", "VAR_7 += 1 + VAR_2;", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 2 ], [ 3 ], [ 4 ], [ 5 ], [ 6 ], [ 7 ], [ 8 ], [ 9 ], [ 10 ], [ 11 ], [ 12 ], [ 13 ], [ 14 ], [ 15 ], [ 16, 17 ], [ 18 ], [ 19 ], [ 20, 21 ], [ 22 ], [ 23 ], [ 24 ], [ 25 ], [ 26 ], [ 27 ], [ 28 ], [ 29 ] ]
20,047
static void dnxhd_decode_dct_block_10_444(const DNXHDContext *ctx, RowContext *row, int n) { dnxhd_decode_dct_block(ctx, row, n, 6, 32, 6); }
true
FFmpeg
b8b8e82ea14016b2cb04b49ecea57f836e6ee7f8
static void dnxhd_decode_dct_block_10_444(const DNXHDContext *ctx, RowContext *row, int n) { dnxhd_decode_dct_block(ctx, row, n, 6, 32, 6); }
{ "code": [ "static void dnxhd_decode_dct_block_10_444(const DNXHDContext *ctx,", "static void dnxhd_decode_dct_block_10_444(const DNXHDContext *ctx,", " dnxhd_decode_dct_block(ctx, row, n, 6, 32, 6);" ], "line_no": [ 1, 1, 7 ] }
static void FUNC_0(const DNXHDContext *VAR_0, RowContext *VAR_1, int VAR_2) { dnxhd_decode_dct_block(VAR_0, VAR_1, VAR_2, 6, 32, 6); }
[ "static void FUNC_0(const DNXHDContext *VAR_0,\nRowContext *VAR_1, int VAR_2)\n{", "dnxhd_decode_dct_block(VAR_0, VAR_1, VAR_2, 6, 32, 6);", "}" ]
[ 1, 1, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ] ]
20,048
int qemu_accept(int s, struct sockaddr *addr, socklen_t *addrlen) { int ret; #ifdef CONFIG_ACCEPT4 ret = accept4(s, addr, addrlen, SOCK_CLOEXEC); #else ret = accept(s, addr, addrlen); if (ret >= 0) { qemu_set_cloexec(ret); } #endif return ret; }
true
qemu
3a03bfa5a219fe06779706315f2555622b51193c
int qemu_accept(int s, struct sockaddr *addr, socklen_t *addrlen) { int ret; #ifdef CONFIG_ACCEPT4 ret = accept4(s, addr, addrlen, SOCK_CLOEXEC); #else ret = accept(s, addr, addrlen); if (ret >= 0) { qemu_set_cloexec(ret); } #endif return ret; }
{ "code": [ "#else", "#endif", "#else", "#endif", "#else", "#endif" ], "line_no": [ 13, 23, 13, 23, 13, 23 ] }
int FUNC_0(int VAR_0, struct sockaddr *VAR_1, socklen_t *VAR_2) { int VAR_3; #ifdef CONFIG_ACCEPT4 VAR_3 = accept4(VAR_0, VAR_1, VAR_2, SOCK_CLOEXEC); #else VAR_3 = accept(VAR_0, VAR_1, VAR_2); if (VAR_3 >= 0) { qemu_set_cloexec(VAR_3); } #endif return VAR_3; }
[ "int FUNC_0(int VAR_0, struct sockaddr *VAR_1, socklen_t *VAR_2)\n{", "int VAR_3;", "#ifdef CONFIG_ACCEPT4\nVAR_3 = accept4(VAR_0, VAR_1, VAR_2, SOCK_CLOEXEC);", "#else\nVAR_3 = accept(VAR_0, VAR_1, VAR_2);", "if (VAR_3 >= 0) {", "qemu_set_cloexec(VAR_3);", "}", "#endif\nreturn VAR_3;", "}" ]
[ 0, 0, 0, 1, 0, 0, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9, 11 ], [ 13, 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23, 27 ], [ 29 ] ]
20,049
static int aac_decode_frame(AVCodecContext * avccontext, void * data, int * data_size, const uint8_t * buf, int buf_size) { AACContext * ac = avccontext->priv_data; GetBitContext gb; enum RawDataBlockType elem_type; int err, elem_id, data_size_tmp; init_get_bits(&gb, buf, buf_size*8); if (show_bits(&gb, 12) == 0xfff) { if ((err = parse_adts_frame_header(ac, &gb)) < 0) { av_log(avccontext, AV_LOG_ERROR, "Error decoding AAC frame header.\n"); return -1; } if (ac->m4ac.sampling_index > 11) { av_log(ac->avccontext, AV_LOG_ERROR, "invalid sampling rate index %d\n", ac->m4ac.sampling_index); return -1; } } // parse while ((elem_type = get_bits(&gb, 3)) != TYPE_END) { elem_id = get_bits(&gb, 4); err = -1; if(elem_type == TYPE_SCE && elem_id == 1 && !ac->che[TYPE_SCE][elem_id] && ac->che[TYPE_LFE][0]) { /* Some streams incorrectly code 5.1 audio as SCE[0] CPE[0] CPE[1] SCE[1] instead of SCE[0] CPE[0] CPE[0] LFE[0]. If we seem to have encountered such a stream, transfer the LFE[0] element to SCE[1] */ ac->che[TYPE_SCE][elem_id] = ac->che[TYPE_LFE][0]; ac->che[TYPE_LFE][0] = NULL; } if(elem_type < TYPE_DSE) { if(!ac->che[elem_type][elem_id]) return -1; if(elem_type != TYPE_CCE) ac->che[elem_type][elem_id]->coup.coupling_point = 4; } switch (elem_type) { case TYPE_SCE: err = decode_ics(ac, &ac->che[TYPE_SCE][elem_id]->ch[0], &gb, 0, 0); break; case TYPE_CPE: err = decode_cpe(ac, &gb, elem_id); break; case TYPE_CCE: err = decode_cce(ac, &gb, ac->che[TYPE_CCE][elem_id]); break; case TYPE_LFE: err = decode_ics(ac, &ac->che[TYPE_LFE][elem_id]->ch[0], &gb, 0, 0); break; case TYPE_DSE: skip_data_stream_element(&gb); err = 0; break; case TYPE_PCE: { enum ChannelPosition new_che_pos[4][MAX_ELEM_ID]; memset(new_che_pos, 0, 4 * MAX_ELEM_ID * sizeof(new_che_pos[0][0])); if((err = decode_pce(ac, new_che_pos, &gb))) break; err = output_configure(ac, ac->che_pos, new_che_pos); break; } case TYPE_FIL: if (elem_id == 15) elem_id += get_bits(&gb, 8) - 1; while (elem_id > 0) elem_id -= decode_extension_payload(ac, &gb, elem_id); err = 0; /* FIXME */ break; default: err = -1; /* should not happen, but keeps compiler happy */ break; } if(err) return err; } spectral_to_sample(ac); if (!ac->is_saved) { ac->is_saved = 1; *data_size = 0; return buf_size; } data_size_tmp = 1024 * avccontext->channels * sizeof(int16_t); if(*data_size < data_size_tmp) { av_log(avccontext, AV_LOG_ERROR, "Output buffer too small (%d) or trying to output too many samples (%d) for this frame.\n", *data_size, data_size_tmp); return -1; } *data_size = data_size_tmp; ac->dsp.float_to_int16_interleave(data, (const float **)ac->output_data, 1024, avccontext->channels); return buf_size; }
false
FFmpeg
ff587009ae60f6cf76d70879986125696490f99c
static int aac_decode_frame(AVCodecContext * avccontext, void * data, int * data_size, const uint8_t * buf, int buf_size) { AACContext * ac = avccontext->priv_data; GetBitContext gb; enum RawDataBlockType elem_type; int err, elem_id, data_size_tmp; init_get_bits(&gb, buf, buf_size*8); if (show_bits(&gb, 12) == 0xfff) { if ((err = parse_adts_frame_header(ac, &gb)) < 0) { av_log(avccontext, AV_LOG_ERROR, "Error decoding AAC frame header.\n"); return -1; } if (ac->m4ac.sampling_index > 11) { av_log(ac->avccontext, AV_LOG_ERROR, "invalid sampling rate index %d\n", ac->m4ac.sampling_index); return -1; } } while ((elem_type = get_bits(&gb, 3)) != TYPE_END) { elem_id = get_bits(&gb, 4); err = -1; if(elem_type == TYPE_SCE && elem_id == 1 && !ac->che[TYPE_SCE][elem_id] && ac->che[TYPE_LFE][0]) { ac->che[TYPE_SCE][elem_id] = ac->che[TYPE_LFE][0]; ac->che[TYPE_LFE][0] = NULL; } if(elem_type < TYPE_DSE) { if(!ac->che[elem_type][elem_id]) return -1; if(elem_type != TYPE_CCE) ac->che[elem_type][elem_id]->coup.coupling_point = 4; } switch (elem_type) { case TYPE_SCE: err = decode_ics(ac, &ac->che[TYPE_SCE][elem_id]->ch[0], &gb, 0, 0); break; case TYPE_CPE: err = decode_cpe(ac, &gb, elem_id); break; case TYPE_CCE: err = decode_cce(ac, &gb, ac->che[TYPE_CCE][elem_id]); break; case TYPE_LFE: err = decode_ics(ac, &ac->che[TYPE_LFE][elem_id]->ch[0], &gb, 0, 0); break; case TYPE_DSE: skip_data_stream_element(&gb); err = 0; break; case TYPE_PCE: { enum ChannelPosition new_che_pos[4][MAX_ELEM_ID]; memset(new_che_pos, 0, 4 * MAX_ELEM_ID * sizeof(new_che_pos[0][0])); if((err = decode_pce(ac, new_che_pos, &gb))) break; err = output_configure(ac, ac->che_pos, new_che_pos); break; } case TYPE_FIL: if (elem_id == 15) elem_id += get_bits(&gb, 8) - 1; while (elem_id > 0) elem_id -= decode_extension_payload(ac, &gb, elem_id); err = 0; break; default: err = -1; break; } if(err) return err; } spectral_to_sample(ac); if (!ac->is_saved) { ac->is_saved = 1; *data_size = 0; return buf_size; } data_size_tmp = 1024 * avccontext->channels * sizeof(int16_t); if(*data_size < data_size_tmp) { av_log(avccontext, AV_LOG_ERROR, "Output buffer too small (%d) or trying to output too many samples (%d) for this frame.\n", *data_size, data_size_tmp); return -1; } *data_size = data_size_tmp; ac->dsp.float_to_int16_interleave(data, (const float **)ac->output_data, 1024, avccontext->channels); return buf_size; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecContext * VAR_0, void * VAR_1, int * VAR_2, const uint8_t * VAR_3, int VAR_4) { AACContext * ac = VAR_0->priv_data; GetBitContext gb; enum RawDataBlockType VAR_5; int VAR_6, VAR_7, VAR_8; init_get_bits(&gb, VAR_3, VAR_4*8); if (show_bits(&gb, 12) == 0xfff) { if ((VAR_6 = parse_adts_frame_header(ac, &gb)) < 0) { av_log(VAR_0, AV_LOG_ERROR, "Error decoding AAC frame header.\n"); return -1; } if (ac->m4ac.sampling_index > 11) { av_log(ac->VAR_0, AV_LOG_ERROR, "invalid sampling rate index %d\n", ac->m4ac.sampling_index); return -1; } } while ((VAR_5 = get_bits(&gb, 3)) != TYPE_END) { VAR_7 = get_bits(&gb, 4); VAR_6 = -1; if(VAR_5 == TYPE_SCE && VAR_7 == 1 && !ac->che[TYPE_SCE][VAR_7] && ac->che[TYPE_LFE][0]) { ac->che[TYPE_SCE][VAR_7] = ac->che[TYPE_LFE][0]; ac->che[TYPE_LFE][0] = NULL; } if(VAR_5 < TYPE_DSE) { if(!ac->che[VAR_5][VAR_7]) return -1; if(VAR_5 != TYPE_CCE) ac->che[VAR_5][VAR_7]->coup.coupling_point = 4; } switch (VAR_5) { case TYPE_SCE: VAR_6 = decode_ics(ac, &ac->che[TYPE_SCE][VAR_7]->ch[0], &gb, 0, 0); break; case TYPE_CPE: VAR_6 = decode_cpe(ac, &gb, VAR_7); break; case TYPE_CCE: VAR_6 = decode_cce(ac, &gb, ac->che[TYPE_CCE][VAR_7]); break; case TYPE_LFE: VAR_6 = decode_ics(ac, &ac->che[TYPE_LFE][VAR_7]->ch[0], &gb, 0, 0); break; case TYPE_DSE: skip_data_stream_element(&gb); VAR_6 = 0; break; case TYPE_PCE: { enum ChannelPosition VAR_9[4][MAX_ELEM_ID]; memset(VAR_9, 0, 4 * MAX_ELEM_ID * sizeof(VAR_9[0][0])); if((VAR_6 = decode_pce(ac, VAR_9, &gb))) break; VAR_6 = output_configure(ac, ac->che_pos, VAR_9); break; } case TYPE_FIL: if (VAR_7 == 15) VAR_7 += get_bits(&gb, 8) - 1; while (VAR_7 > 0) VAR_7 -= decode_extension_payload(ac, &gb, VAR_7); VAR_6 = 0; break; default: VAR_6 = -1; break; } if(VAR_6) return VAR_6; } spectral_to_sample(ac); if (!ac->is_saved) { ac->is_saved = 1; *VAR_2 = 0; return VAR_4; } VAR_8 = 1024 * VAR_0->channels * sizeof(int16_t); if(*VAR_2 < VAR_8) { av_log(VAR_0, AV_LOG_ERROR, "Output buffer too small (%d) or trying to output too many samples (%d) for this frame.\n", *VAR_2, VAR_8); return -1; } *VAR_2 = VAR_8; ac->dsp.float_to_int16_interleave(VAR_1, (const float **)ac->output_data, 1024, VAR_0->channels); return VAR_4; }
[ "static int FUNC_0(AVCodecContext * VAR_0, void * VAR_1, int * VAR_2, const uint8_t * VAR_3, int VAR_4) {", "AACContext * ac = VAR_0->priv_data;", "GetBitContext gb;", "enum RawDataBlockType VAR_5;", "int VAR_6, VAR_7, VAR_8;", "init_get_bits(&gb, VAR_3, VAR_4*8);", "if (show_bits(&gb, 12) == 0xfff) {", "if ((VAR_6 = parse_adts_frame_header(ac, &gb)) < 0) {", "av_log(VAR_0, AV_LOG_ERROR, \"Error decoding AAC frame header.\\n\");", "return -1;", "}", "if (ac->m4ac.sampling_index > 11) {", "av_log(ac->VAR_0, AV_LOG_ERROR, \"invalid sampling rate index %d\\n\", ac->m4ac.sampling_index);", "return -1;", "}", "}", "while ((VAR_5 = get_bits(&gb, 3)) != TYPE_END) {", "VAR_7 = get_bits(&gb, 4);", "VAR_6 = -1;", "if(VAR_5 == TYPE_SCE && VAR_7 == 1 &&\n!ac->che[TYPE_SCE][VAR_7] && ac->che[TYPE_LFE][0]) {", "ac->che[TYPE_SCE][VAR_7] = ac->che[TYPE_LFE][0];", "ac->che[TYPE_LFE][0] = NULL;", "}", "if(VAR_5 < TYPE_DSE) {", "if(!ac->che[VAR_5][VAR_7])\nreturn -1;", "if(VAR_5 != TYPE_CCE)\nac->che[VAR_5][VAR_7]->coup.coupling_point = 4;", "}", "switch (VAR_5) {", "case TYPE_SCE:\nVAR_6 = decode_ics(ac, &ac->che[TYPE_SCE][VAR_7]->ch[0], &gb, 0, 0);", "break;", "case TYPE_CPE:\nVAR_6 = decode_cpe(ac, &gb, VAR_7);", "break;", "case TYPE_CCE:\nVAR_6 = decode_cce(ac, &gb, ac->che[TYPE_CCE][VAR_7]);", "break;", "case TYPE_LFE:\nVAR_6 = decode_ics(ac, &ac->che[TYPE_LFE][VAR_7]->ch[0], &gb, 0, 0);", "break;", "case TYPE_DSE:\nskip_data_stream_element(&gb);", "VAR_6 = 0;", "break;", "case TYPE_PCE:\n{", "enum ChannelPosition VAR_9[4][MAX_ELEM_ID];", "memset(VAR_9, 0, 4 * MAX_ELEM_ID * sizeof(VAR_9[0][0]));", "if((VAR_6 = decode_pce(ac, VAR_9, &gb)))\nbreak;", "VAR_6 = output_configure(ac, ac->che_pos, VAR_9);", "break;", "}", "case TYPE_FIL:\nif (VAR_7 == 15)\nVAR_7 += get_bits(&gb, 8) - 1;", "while (VAR_7 > 0)\nVAR_7 -= decode_extension_payload(ac, &gb, VAR_7);", "VAR_6 = 0;", "break;", "default:\nVAR_6 = -1;", "break;", "}", "if(VAR_6)\nreturn VAR_6;", "}", "spectral_to_sample(ac);", "if (!ac->is_saved) {", "ac->is_saved = 1;", "*VAR_2 = 0;", "return VAR_4;", "}", "VAR_8 = 1024 * VAR_0->channels * sizeof(int16_t);", "if(*VAR_2 < VAR_8) {", "av_log(VAR_0, AV_LOG_ERROR,\n\"Output buffer too small (%d) or trying to output too many samples (%d) for this frame.\\n\",\n*VAR_2, VAR_8);", "return -1;", "}", "*VAR_2 = VAR_8;", "ac->dsp.float_to_int16_interleave(VAR_1, (const float **)ac->output_data, 1024, VAR_0->channels);", "return VAR_4;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1 ], [ 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 41 ], [ 43 ], [ 45 ], [ 49, 51 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67, 69 ], [ 71, 73 ], [ 75 ], [ 79 ], [ 83, 85 ], [ 87 ], [ 91, 93 ], [ 95 ], [ 99, 101 ], [ 103 ], [ 107, 109 ], [ 111 ], [ 115, 117 ], [ 119 ], [ 121 ], [ 125, 127 ], [ 129 ], [ 131 ], [ 133, 135 ], [ 137 ], [ 139 ], [ 141 ], [ 145, 147, 149 ], [ 151, 153 ], [ 155 ], [ 157 ], [ 161, 163 ], [ 165 ], [ 167 ], [ 171, 173 ], [ 175 ], [ 179 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 195 ], [ 197 ], [ 199, 201, 203 ], [ 205 ], [ 207 ], [ 209 ], [ 213 ], [ 217 ], [ 219 ] ]
20,050
void ff_h264dsp_init(H264DSPContext *c, const int bit_depth, const int chroma_format_idc) { #undef FUNC #define FUNC(a, depth) a ## _ ## depth ## _c #define ADDPX_DSP(depth) \ c->h264_add_pixels4 = FUNC(ff_h264_add_pixels4, depth);\ c->h264_add_pixels8 = FUNC(ff_h264_add_pixels8, depth) if (bit_depth > 8 && bit_depth <= 16) { ADDPX_DSP(16); } else { ADDPX_DSP(8); } #define H264_DSP(depth) \ c->h264_idct_add= FUNC(ff_h264_idct_add, depth);\ c->h264_idct8_add= FUNC(ff_h264_idct8_add, depth);\ c->h264_idct_dc_add= FUNC(ff_h264_idct_dc_add, depth);\ c->h264_idct8_dc_add= FUNC(ff_h264_idct8_dc_add, depth);\ c->h264_idct_add16 = FUNC(ff_h264_idct_add16, depth);\ c->h264_idct8_add4 = FUNC(ff_h264_idct8_add4, depth);\ if (chroma_format_idc == 1)\ c->h264_idct_add8 = FUNC(ff_h264_idct_add8, depth);\ else\ c->h264_idct_add8 = FUNC(ff_h264_idct_add8_422, depth);\ c->h264_idct_add16intra= FUNC(ff_h264_idct_add16intra, depth);\ c->h264_luma_dc_dequant_idct= FUNC(ff_h264_luma_dc_dequant_idct, depth);\ if (chroma_format_idc == 1)\ c->h264_chroma_dc_dequant_idct= FUNC(ff_h264_chroma_dc_dequant_idct, depth);\ else\ c->h264_chroma_dc_dequant_idct= FUNC(ff_h264_chroma422_dc_dequant_idct, depth);\ \ c->weight_h264_pixels_tab[0]= FUNC(weight_h264_pixels16, depth);\ c->weight_h264_pixels_tab[1]= FUNC(weight_h264_pixels8, depth);\ c->weight_h264_pixels_tab[2]= FUNC(weight_h264_pixels4, depth);\ c->weight_h264_pixels_tab[3]= FUNC(weight_h264_pixels2, depth);\ c->biweight_h264_pixels_tab[0]= FUNC(biweight_h264_pixels16, depth);\ c->biweight_h264_pixels_tab[1]= FUNC(biweight_h264_pixels8, depth);\ c->biweight_h264_pixels_tab[2]= FUNC(biweight_h264_pixels4, depth);\ c->biweight_h264_pixels_tab[3]= FUNC(biweight_h264_pixels2, depth);\ \ c->h264_v_loop_filter_luma= FUNC(h264_v_loop_filter_luma, depth);\ c->h264_h_loop_filter_luma= FUNC(h264_h_loop_filter_luma, depth);\ c->h264_h_loop_filter_luma_mbaff= FUNC(h264_h_loop_filter_luma_mbaff, depth);\ c->h264_v_loop_filter_luma_intra= FUNC(h264_v_loop_filter_luma_intra, depth);\ c->h264_h_loop_filter_luma_intra= FUNC(h264_h_loop_filter_luma_intra, depth);\ c->h264_h_loop_filter_luma_mbaff_intra= FUNC(h264_h_loop_filter_luma_mbaff_intra, depth);\ c->h264_v_loop_filter_chroma= FUNC(h264_v_loop_filter_chroma, depth);\ if (chroma_format_idc == 1)\ c->h264_h_loop_filter_chroma= FUNC(h264_h_loop_filter_chroma, depth);\ else\ c->h264_h_loop_filter_chroma= FUNC(h264_h_loop_filter_chroma422, depth);\ if (chroma_format_idc == 1)\ c->h264_h_loop_filter_chroma_mbaff= FUNC(h264_h_loop_filter_chroma_mbaff, depth);\ else\ c->h264_h_loop_filter_chroma_mbaff= FUNC(h264_h_loop_filter_chroma422_mbaff, depth);\ c->h264_v_loop_filter_chroma_intra= FUNC(h264_v_loop_filter_chroma_intra, depth);\ if (chroma_format_idc == 1)\ c->h264_h_loop_filter_chroma_intra= FUNC(h264_h_loop_filter_chroma_intra, depth);\ else\ c->h264_h_loop_filter_chroma_intra= FUNC(h264_h_loop_filter_chroma422_intra, depth);\ if (chroma_format_idc == 1)\ c->h264_h_loop_filter_chroma_mbaff_intra= FUNC(h264_h_loop_filter_chroma_mbaff_intra, depth);\ else\ c->h264_h_loop_filter_chroma_mbaff_intra= FUNC(h264_h_loop_filter_chroma422_mbaff_intra, depth);\ c->h264_loop_filter_strength= NULL; switch (bit_depth) { case 9: H264_DSP(9); break; case 10: H264_DSP(10); break; case 12: H264_DSP(12); break; case 14: H264_DSP(14); break; default: av_assert0(bit_depth<=8); H264_DSP(8); break; } if (ARCH_ARM) ff_h264dsp_init_arm(c, bit_depth, chroma_format_idc); if (HAVE_ALTIVEC) ff_h264dsp_init_ppc(c, bit_depth, chroma_format_idc); if (ARCH_X86) ff_h264dsp_init_x86(c, bit_depth, chroma_format_idc); }
false
FFmpeg
1acd7d594c15aa491729c837ad3519d3469e620a
void ff_h264dsp_init(H264DSPContext *c, const int bit_depth, const int chroma_format_idc) { #undef FUNC #define FUNC(a, depth) a ## _ ## depth ## _c #define ADDPX_DSP(depth) \ c->h264_add_pixels4 = FUNC(ff_h264_add_pixels4, depth);\ c->h264_add_pixels8 = FUNC(ff_h264_add_pixels8, depth) if (bit_depth > 8 && bit_depth <= 16) { ADDPX_DSP(16); } else { ADDPX_DSP(8); } #define H264_DSP(depth) \ c->h264_idct_add= FUNC(ff_h264_idct_add, depth);\ c->h264_idct8_add= FUNC(ff_h264_idct8_add, depth);\ c->h264_idct_dc_add= FUNC(ff_h264_idct_dc_add, depth);\ c->h264_idct8_dc_add= FUNC(ff_h264_idct8_dc_add, depth);\ c->h264_idct_add16 = FUNC(ff_h264_idct_add16, depth);\ c->h264_idct8_add4 = FUNC(ff_h264_idct8_add4, depth);\ if (chroma_format_idc == 1)\ c->h264_idct_add8 = FUNC(ff_h264_idct_add8, depth);\ else\ c->h264_idct_add8 = FUNC(ff_h264_idct_add8_422, depth);\ c->h264_idct_add16intra= FUNC(ff_h264_idct_add16intra, depth);\ c->h264_luma_dc_dequant_idct= FUNC(ff_h264_luma_dc_dequant_idct, depth);\ if (chroma_format_idc == 1)\ c->h264_chroma_dc_dequant_idct= FUNC(ff_h264_chroma_dc_dequant_idct, depth);\ else\ c->h264_chroma_dc_dequant_idct= FUNC(ff_h264_chroma422_dc_dequant_idct, depth);\ \ c->weight_h264_pixels_tab[0]= FUNC(weight_h264_pixels16, depth);\ c->weight_h264_pixels_tab[1]= FUNC(weight_h264_pixels8, depth);\ c->weight_h264_pixels_tab[2]= FUNC(weight_h264_pixels4, depth);\ c->weight_h264_pixels_tab[3]= FUNC(weight_h264_pixels2, depth);\ c->biweight_h264_pixels_tab[0]= FUNC(biweight_h264_pixels16, depth);\ c->biweight_h264_pixels_tab[1]= FUNC(biweight_h264_pixels8, depth);\ c->biweight_h264_pixels_tab[2]= FUNC(biweight_h264_pixels4, depth);\ c->biweight_h264_pixels_tab[3]= FUNC(biweight_h264_pixels2, depth);\ \ c->h264_v_loop_filter_luma= FUNC(h264_v_loop_filter_luma, depth);\ c->h264_h_loop_filter_luma= FUNC(h264_h_loop_filter_luma, depth);\ c->h264_h_loop_filter_luma_mbaff= FUNC(h264_h_loop_filter_luma_mbaff, depth);\ c->h264_v_loop_filter_luma_intra= FUNC(h264_v_loop_filter_luma_intra, depth);\ c->h264_h_loop_filter_luma_intra= FUNC(h264_h_loop_filter_luma_intra, depth);\ c->h264_h_loop_filter_luma_mbaff_intra= FUNC(h264_h_loop_filter_luma_mbaff_intra, depth);\ c->h264_v_loop_filter_chroma= FUNC(h264_v_loop_filter_chroma, depth);\ if (chroma_format_idc == 1)\ c->h264_h_loop_filter_chroma= FUNC(h264_h_loop_filter_chroma, depth);\ else\ c->h264_h_loop_filter_chroma= FUNC(h264_h_loop_filter_chroma422, depth);\ if (chroma_format_idc == 1)\ c->h264_h_loop_filter_chroma_mbaff= FUNC(h264_h_loop_filter_chroma_mbaff, depth);\ else\ c->h264_h_loop_filter_chroma_mbaff= FUNC(h264_h_loop_filter_chroma422_mbaff, depth);\ c->h264_v_loop_filter_chroma_intra= FUNC(h264_v_loop_filter_chroma_intra, depth);\ if (chroma_format_idc == 1)\ c->h264_h_loop_filter_chroma_intra= FUNC(h264_h_loop_filter_chroma_intra, depth);\ else\ c->h264_h_loop_filter_chroma_intra= FUNC(h264_h_loop_filter_chroma422_intra, depth);\ if (chroma_format_idc == 1)\ c->h264_h_loop_filter_chroma_mbaff_intra= FUNC(h264_h_loop_filter_chroma_mbaff_intra, depth);\ else\ c->h264_h_loop_filter_chroma_mbaff_intra= FUNC(h264_h_loop_filter_chroma422_mbaff_intra, depth);\ c->h264_loop_filter_strength= NULL; switch (bit_depth) { case 9: H264_DSP(9); break; case 10: H264_DSP(10); break; case 12: H264_DSP(12); break; case 14: H264_DSP(14); break; default: av_assert0(bit_depth<=8); H264_DSP(8); break; } if (ARCH_ARM) ff_h264dsp_init_arm(c, bit_depth, chroma_format_idc); if (HAVE_ALTIVEC) ff_h264dsp_init_ppc(c, bit_depth, chroma_format_idc); if (ARCH_X86) ff_h264dsp_init_x86(c, bit_depth, chroma_format_idc); }
{ "code": [], "line_no": [] }
void FUNC_0(H264DSPContext *VAR_0, const int VAR_1, const int VAR_2) { #undef FUNC #define FUNC(a, depth) a ## _ ## depth ## _c #define ADDPX_DSP(depth) \ VAR_0->h264_add_pixels4 = FUNC(ff_h264_add_pixels4, depth);\ VAR_0->h264_add_pixels8 = FUNC(ff_h264_add_pixels8, depth) if (VAR_1 > 8 && VAR_1 <= 16) { ADDPX_DSP(16); } else { ADDPX_DSP(8); } #define H264_DSP(depth) \ VAR_0->h264_idct_add= FUNC(ff_h264_idct_add, depth);\ VAR_0->h264_idct8_add= FUNC(ff_h264_idct8_add, depth);\ VAR_0->h264_idct_dc_add= FUNC(ff_h264_idct_dc_add, depth);\ VAR_0->h264_idct8_dc_add= FUNC(ff_h264_idct8_dc_add, depth);\ VAR_0->h264_idct_add16 = FUNC(ff_h264_idct_add16, depth);\ VAR_0->h264_idct8_add4 = FUNC(ff_h264_idct8_add4, depth);\ if (VAR_2 == 1)\ VAR_0->h264_idct_add8 = FUNC(ff_h264_idct_add8, depth);\ else\ VAR_0->h264_idct_add8 = FUNC(ff_h264_idct_add8_422, depth);\ VAR_0->h264_idct_add16intra= FUNC(ff_h264_idct_add16intra, depth);\ VAR_0->h264_luma_dc_dequant_idct= FUNC(ff_h264_luma_dc_dequant_idct, depth);\ if (VAR_2 == 1)\ VAR_0->h264_chroma_dc_dequant_idct= FUNC(ff_h264_chroma_dc_dequant_idct, depth);\ else\ VAR_0->h264_chroma_dc_dequant_idct= FUNC(ff_h264_chroma422_dc_dequant_idct, depth);\ \ VAR_0->weight_h264_pixels_tab[0]= FUNC(weight_h264_pixels16, depth);\ VAR_0->weight_h264_pixels_tab[1]= FUNC(weight_h264_pixels8, depth);\ VAR_0->weight_h264_pixels_tab[2]= FUNC(weight_h264_pixels4, depth);\ VAR_0->weight_h264_pixels_tab[3]= FUNC(weight_h264_pixels2, depth);\ VAR_0->biweight_h264_pixels_tab[0]= FUNC(biweight_h264_pixels16, depth);\ VAR_0->biweight_h264_pixels_tab[1]= FUNC(biweight_h264_pixels8, depth);\ VAR_0->biweight_h264_pixels_tab[2]= FUNC(biweight_h264_pixels4, depth);\ VAR_0->biweight_h264_pixels_tab[3]= FUNC(biweight_h264_pixels2, depth);\ \ VAR_0->h264_v_loop_filter_luma= FUNC(h264_v_loop_filter_luma, depth);\ VAR_0->h264_h_loop_filter_luma= FUNC(h264_h_loop_filter_luma, depth);\ VAR_0->h264_h_loop_filter_luma_mbaff= FUNC(h264_h_loop_filter_luma_mbaff, depth);\ VAR_0->h264_v_loop_filter_luma_intra= FUNC(h264_v_loop_filter_luma_intra, depth);\ VAR_0->h264_h_loop_filter_luma_intra= FUNC(h264_h_loop_filter_luma_intra, depth);\ VAR_0->h264_h_loop_filter_luma_mbaff_intra= FUNC(h264_h_loop_filter_luma_mbaff_intra, depth);\ VAR_0->h264_v_loop_filter_chroma= FUNC(h264_v_loop_filter_chroma, depth);\ if (VAR_2 == 1)\ VAR_0->h264_h_loop_filter_chroma= FUNC(h264_h_loop_filter_chroma, depth);\ else\ VAR_0->h264_h_loop_filter_chroma= FUNC(h264_h_loop_filter_chroma422, depth);\ if (VAR_2 == 1)\ VAR_0->h264_h_loop_filter_chroma_mbaff= FUNC(h264_h_loop_filter_chroma_mbaff, depth);\ else\ VAR_0->h264_h_loop_filter_chroma_mbaff= FUNC(h264_h_loop_filter_chroma422_mbaff, depth);\ VAR_0->h264_v_loop_filter_chroma_intra= FUNC(h264_v_loop_filter_chroma_intra, depth);\ if (VAR_2 == 1)\ VAR_0->h264_h_loop_filter_chroma_intra= FUNC(h264_h_loop_filter_chroma_intra, depth);\ else\ VAR_0->h264_h_loop_filter_chroma_intra= FUNC(h264_h_loop_filter_chroma422_intra, depth);\ if (VAR_2 == 1)\ VAR_0->h264_h_loop_filter_chroma_mbaff_intra= FUNC(h264_h_loop_filter_chroma_mbaff_intra, depth);\ else\ VAR_0->h264_h_loop_filter_chroma_mbaff_intra= FUNC(h264_h_loop_filter_chroma422_mbaff_intra, depth);\ VAR_0->h264_loop_filter_strength= NULL; switch (VAR_1) { case 9: H264_DSP(9); break; case 10: H264_DSP(10); break; case 12: H264_DSP(12); break; case 14: H264_DSP(14); break; default: av_assert0(VAR_1<=8); H264_DSP(8); break; } if (ARCH_ARM) ff_h264dsp_init_arm(VAR_0, VAR_1, VAR_2); if (HAVE_ALTIVEC) ff_h264dsp_init_ppc(VAR_0, VAR_1, VAR_2); if (ARCH_X86) ff_h264dsp_init_x86(VAR_0, VAR_1, VAR_2); }
[ "void FUNC_0(H264DSPContext *VAR_0, const int VAR_1, const int VAR_2)\n{", "#undef FUNC\n#define FUNC(a, depth) a ## _ ## depth ## _c\n#define ADDPX_DSP(depth) \\\nVAR_0->h264_add_pixels4 = FUNC(ff_h264_add_pixels4, depth);\\", "VAR_0->h264_add_pixels8 = FUNC(ff_h264_add_pixels8, depth)\nif (VAR_1 > 8 && VAR_1 <= 16) {", "ADDPX_DSP(16);", "} else {", "ADDPX_DSP(8);", "}", "#define H264_DSP(depth) \\\nVAR_0->h264_idct_add= FUNC(ff_h264_idct_add, depth);\\", "VAR_0->h264_idct8_add= FUNC(ff_h264_idct8_add, depth);\\", "VAR_0->h264_idct_dc_add= FUNC(ff_h264_idct_dc_add, depth);\\", "VAR_0->h264_idct8_dc_add= FUNC(ff_h264_idct8_dc_add, depth);\\", "VAR_0->h264_idct_add16 = FUNC(ff_h264_idct_add16, depth);\\", "VAR_0->h264_idct8_add4 = FUNC(ff_h264_idct8_add4, depth);\\", "if (VAR_2 == 1)\\\nVAR_0->h264_idct_add8 = FUNC(ff_h264_idct_add8, depth);\\", "else\\\nVAR_0->h264_idct_add8 = FUNC(ff_h264_idct_add8_422, depth);\\", "VAR_0->h264_idct_add16intra= FUNC(ff_h264_idct_add16intra, depth);\\", "VAR_0->h264_luma_dc_dequant_idct= FUNC(ff_h264_luma_dc_dequant_idct, depth);\\", "if (VAR_2 == 1)\\\nVAR_0->h264_chroma_dc_dequant_idct= FUNC(ff_h264_chroma_dc_dequant_idct, depth);\\", "else\\\nVAR_0->h264_chroma_dc_dequant_idct= FUNC(ff_h264_chroma422_dc_dequant_idct, depth);\\", "\\\nVAR_0->weight_h264_pixels_tab[0]= FUNC(weight_h264_pixels16, depth);\\", "VAR_0->weight_h264_pixels_tab[1]= FUNC(weight_h264_pixels8, depth);\\", "VAR_0->weight_h264_pixels_tab[2]= FUNC(weight_h264_pixels4, depth);\\", "VAR_0->weight_h264_pixels_tab[3]= FUNC(weight_h264_pixels2, depth);\\", "VAR_0->biweight_h264_pixels_tab[0]= FUNC(biweight_h264_pixels16, depth);\\", "VAR_0->biweight_h264_pixels_tab[1]= FUNC(biweight_h264_pixels8, depth);\\", "VAR_0->biweight_h264_pixels_tab[2]= FUNC(biweight_h264_pixels4, depth);\\", "VAR_0->biweight_h264_pixels_tab[3]= FUNC(biweight_h264_pixels2, depth);\\", "\\\nVAR_0->h264_v_loop_filter_luma= FUNC(h264_v_loop_filter_luma, depth);\\", "VAR_0->h264_h_loop_filter_luma= FUNC(h264_h_loop_filter_luma, depth);\\", "VAR_0->h264_h_loop_filter_luma_mbaff= FUNC(h264_h_loop_filter_luma_mbaff, depth);\\", "VAR_0->h264_v_loop_filter_luma_intra= FUNC(h264_v_loop_filter_luma_intra, depth);\\", "VAR_0->h264_h_loop_filter_luma_intra= FUNC(h264_h_loop_filter_luma_intra, depth);\\", "VAR_0->h264_h_loop_filter_luma_mbaff_intra= FUNC(h264_h_loop_filter_luma_mbaff_intra, depth);\\", "VAR_0->h264_v_loop_filter_chroma= FUNC(h264_v_loop_filter_chroma, depth);\\", "if (VAR_2 == 1)\\\nVAR_0->h264_h_loop_filter_chroma= FUNC(h264_h_loop_filter_chroma, depth);\\", "else\\\nVAR_0->h264_h_loop_filter_chroma= FUNC(h264_h_loop_filter_chroma422, depth);\\", "if (VAR_2 == 1)\\\nVAR_0->h264_h_loop_filter_chroma_mbaff= FUNC(h264_h_loop_filter_chroma_mbaff, depth);\\", "else\\\nVAR_0->h264_h_loop_filter_chroma_mbaff= FUNC(h264_h_loop_filter_chroma422_mbaff, depth);\\", "VAR_0->h264_v_loop_filter_chroma_intra= FUNC(h264_v_loop_filter_chroma_intra, depth);\\", "if (VAR_2 == 1)\\\nVAR_0->h264_h_loop_filter_chroma_intra= FUNC(h264_h_loop_filter_chroma_intra, depth);\\", "else\\\nVAR_0->h264_h_loop_filter_chroma_intra= FUNC(h264_h_loop_filter_chroma422_intra, depth);\\", "if (VAR_2 == 1)\\\nVAR_0->h264_h_loop_filter_chroma_mbaff_intra= FUNC(h264_h_loop_filter_chroma_mbaff_intra, depth);\\", "else\\\nVAR_0->h264_h_loop_filter_chroma_mbaff_intra= FUNC(h264_h_loop_filter_chroma422_mbaff_intra, depth);\\", "VAR_0->h264_loop_filter_strength= NULL;", "switch (VAR_1) {", "case 9:\nH264_DSP(9);", "break;", "case 10:\nH264_DSP(10);", "break;", "case 12:\nH264_DSP(12);", "break;", "case 14:\nH264_DSP(14);", "break;", "default:\nav_assert0(VAR_1<=8);", "H264_DSP(8);", "break;", "}", "if (ARCH_ARM) ff_h264dsp_init_arm(VAR_0, VAR_1, VAR_2);", "if (HAVE_ALTIVEC) ff_h264dsp_init_ppc(VAR_0, VAR_1, VAR_2);", "if (ARCH_X86) ff_h264dsp_init_x86(VAR_0, VAR_1, VAR_2);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5, 7, 11, 13 ], [ 15, 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31, 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45, 47 ], [ 49, 51 ], [ 53 ], [ 55 ], [ 57, 59 ], [ 61, 63 ], [ 65, 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83, 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99, 101 ], [ 103, 105 ], [ 107, 109 ], [ 111, 113 ], [ 115 ], [ 117, 119 ], [ 121, 123 ], [ 125, 127 ], [ 129, 131 ], [ 133 ], [ 137 ], [ 139, 141 ], [ 143 ], [ 145, 147 ], [ 149 ], [ 151, 153 ], [ 155 ], [ 157, 159 ], [ 161 ], [ 163, 165 ], [ 167 ], [ 169 ], [ 171 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ] ]
20,051
int redir_open(AVFormatContext **ic_ptr, ByteIOContext *f) { char buf[4096], *q; int c; AVFormatContext *ic = NULL; /* parse each URL and try to open it */ c = url_fgetc(f); while (c != URL_EOF) { /* skip spaces */ for(;;) { if (!redir_isspace(c)) break; c = url_fgetc(f); } if (c == URL_EOF) break; /* record url */ q = buf; for(;;) { if (c == URL_EOF || redir_isspace(c)) break; if ((q - buf) < sizeof(buf) - 1) *q++ = c; c = url_fgetc(f); } *q = '\0'; //printf("URL='%s'\n", buf); /* try to open the media file */ if (av_open_input_file(&ic, buf, NULL, 0, NULL) == 0) break; } *ic_ptr = ic; if (!ic) return AVERROR(EIO); else return 0; }
false
FFmpeg
e8acf0edeae0b5ef53233c49015b07cc9711f20c
int redir_open(AVFormatContext **ic_ptr, ByteIOContext *f) { char buf[4096], *q; int c; AVFormatContext *ic = NULL; c = url_fgetc(f); while (c != URL_EOF) { for(;;) { if (!redir_isspace(c)) break; c = url_fgetc(f); } if (c == URL_EOF) break; q = buf; for(;;) { if (c == URL_EOF || redir_isspace(c)) break; if ((q - buf) < sizeof(buf) - 1) *q++ = c; c = url_fgetc(f); } *q = '\0'; if (av_open_input_file(&ic, buf, NULL, 0, NULL) == 0) break; } *ic_ptr = ic; if (!ic) return AVERROR(EIO); else return 0; }
{ "code": [], "line_no": [] }
int FUNC_0(AVFormatContext **VAR_0, ByteIOContext *VAR_1) { char VAR_2[4096], *VAR_3; int VAR_4; AVFormatContext *ic = NULL; VAR_4 = url_fgetc(VAR_1); while (VAR_4 != URL_EOF) { for(;;) { if (!redir_isspace(VAR_4)) break; VAR_4 = url_fgetc(VAR_1); } if (VAR_4 == URL_EOF) break; VAR_3 = VAR_2; for(;;) { if (VAR_4 == URL_EOF || redir_isspace(VAR_4)) break; if ((VAR_3 - VAR_2) < sizeof(VAR_2) - 1) *VAR_3++ = VAR_4; VAR_4 = url_fgetc(VAR_1); } *VAR_3 = '\0'; if (av_open_input_file(&ic, VAR_2, NULL, 0, NULL) == 0) break; } *VAR_0 = ic; if (!ic) return AVERROR(EIO); else return 0; }
[ "int FUNC_0(AVFormatContext **VAR_0, ByteIOContext *VAR_1)\n{", "char VAR_2[4096], *VAR_3;", "int VAR_4;", "AVFormatContext *ic = NULL;", "VAR_4 = url_fgetc(VAR_1);", "while (VAR_4 != URL_EOF) {", "for(;;) {", "if (!redir_isspace(VAR_4))\nbreak;", "VAR_4 = url_fgetc(VAR_1);", "}", "if (VAR_4 == URL_EOF)\nbreak;", "VAR_3 = VAR_2;", "for(;;) {", "if (VAR_4 == URL_EOF || redir_isspace(VAR_4))\nbreak;", "if ((VAR_3 - VAR_2) < sizeof(VAR_2) - 1)\n*VAR_3++ = VAR_4;", "VAR_4 = url_fgetc(VAR_1);", "}", "*VAR_3 = '\\0';", "if (av_open_input_file(&ic, VAR_2, NULL, 0, NULL) == 0)\nbreak;", "}", "*VAR_0 = ic;", "if (!ic)\nreturn AVERROR(EIO);", "else\nreturn 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 15 ], [ 17 ], [ 21 ], [ 23, 25 ], [ 27 ], [ 29 ], [ 31, 33 ], [ 37 ], [ 39 ], [ 41, 43 ], [ 45, 47 ], [ 49 ], [ 51 ], [ 53 ], [ 59, 61 ], [ 63 ], [ 65 ], [ 67, 69 ], [ 71, 73 ], [ 75 ] ]
20,052
static int common_init(AVCodecContext *avctx){ SnowContext *s = avctx->priv_data; int width, height; int level, orientation, plane_index, dec; s->avctx= avctx; dsputil_init(&s->dsp, avctx); #define mcf(dx,dy)\ s->dsp.put_qpel_pixels_tab [0][dy+dx/4]=\ s->dsp.put_no_rnd_qpel_pixels_tab[0][dy+dx/4]=\ mc_block ## dx ## dy; mcf( 0, 0) mcf( 4, 0) mcf( 8, 0) mcf(12, 0) mcf( 0, 4) mcf( 4, 4) mcf( 8, 4) mcf(12, 4) mcf( 0, 8) mcf( 4, 8) mcf( 8, 8) mcf(12, 8) mcf( 0,12) mcf( 4,12) mcf( 8,12) mcf(12,12) #define mcfh(dx,dy)\ s->dsp.put_pixels_tab [0][dy/4+dx/8]=\ s->dsp.put_no_rnd_pixels_tab[0][dy/4+dx/8]=\ mc_block_hpel ## dx ## dy; mcfh(0, 0) mcfh(8, 0) mcfh(0, 8) mcfh(8, 8) dec= s->spatial_decomposition_count= 5; s->spatial_decomposition_type= avctx->prediction_method; //FIXME add decorrelator type r transform_type s->chroma_h_shift= 1; //FIXME XXX s->chroma_v_shift= 1; // dec += FFMAX(s->chroma_h_shift, s->chroma_v_shift); s->b_width = (s->avctx->width +(1<<dec)-1)>>dec; s->b_height= (s->avctx->height+(1<<dec)-1)>>dec; s->spatial_dwt_buffer= av_mallocz(s->b_width*s->b_height*sizeof(DWTELEM)<<(2*dec)); s->pred_buffer= av_mallocz(s->b_width*s->b_height*sizeof(DWTELEM)<<(2*dec)); s->mv_scale= (s->avctx->flags & CODEC_FLAG_QPEL) ? 2 : 4; for(plane_index=0; plane_index<3; plane_index++){ int w= s->avctx->width; int h= s->avctx->height; if(plane_index){ w>>= s->chroma_h_shift; h>>= s->chroma_v_shift; } s->plane[plane_index].width = w; s->plane[plane_index].height= h; //av_log(NULL, AV_LOG_DEBUG, "%d %d\n", w, h); for(level=s->spatial_decomposition_count-1; level>=0; level--){ for(orientation=level ? 1 : 0; orientation<4; orientation++){ SubBand *b= &s->plane[plane_index].band[level][orientation]; b->buf= s->spatial_dwt_buffer; b->level= level; b->stride= s->plane[plane_index].width << (s->spatial_decomposition_count - level); b->width = (w + !(orientation&1))>>1; b->height= (h + !(orientation>1))>>1; if(orientation&1) b->buf += (w+1)>>1; if(orientation>1) b->buf += b->stride>>1; if(level) b->parent= &s->plane[plane_index].band[level-1][orientation]; } w= (w+1)>>1; h= (h+1)>>1; } } //FIXME init_subband() ? s->mb_band.stride= s->mv_band[0].stride= s->mv_band[1].stride= s->mb_band.width = s->mv_band[0].width = s->mv_band[1].width = (s->avctx->width + 15)>>4; s->mb_band.height= s->mv_band[0].height= s->mv_band[1].height= (s->avctx->height+ 15)>>4; s->mb_band .buf= av_mallocz(s->mb_band .stride * s->mb_band .height*sizeof(DWTELEM)); s->mv_band[0].buf= av_mallocz(s->mv_band[0].stride * s->mv_band[0].height*sizeof(DWTELEM)); s->mv_band[1].buf= av_mallocz(s->mv_band[1].stride * s->mv_band[1].height*sizeof(DWTELEM)); reset_contexts(s); /* width= s->width= avctx->width; height= s->height= avctx->height; assert(width && height); */ s->avctx->get_buffer(s->avctx, &s->mconly_picture); return 0; }
false
FFmpeg
155ec6edf82692bcf3a5f87d2bc697404f4e5aaf
static int common_init(AVCodecContext *avctx){ SnowContext *s = avctx->priv_data; int width, height; int level, orientation, plane_index, dec; s->avctx= avctx; dsputil_init(&s->dsp, avctx); #define mcf(dx,dy)\ s->dsp.put_qpel_pixels_tab [0][dy+dx/4]=\ s->dsp.put_no_rnd_qpel_pixels_tab[0][dy+dx/4]=\ mc_block ## dx ## dy; mcf( 0, 0) mcf( 4, 0) mcf( 8, 0) mcf(12, 0) mcf( 0, 4) mcf( 4, 4) mcf( 8, 4) mcf(12, 4) mcf( 0, 8) mcf( 4, 8) mcf( 8, 8) mcf(12, 8) mcf( 0,12) mcf( 4,12) mcf( 8,12) mcf(12,12) #define mcfh(dx,dy)\ s->dsp.put_pixels_tab [0][dy/4+dx/8]=\ s->dsp.put_no_rnd_pixels_tab[0][dy/4+dx/8]=\ mc_block_hpel ## dx ## dy; mcfh(0, 0) mcfh(8, 0) mcfh(0, 8) mcfh(8, 8) dec= s->spatial_decomposition_count= 5; s->spatial_decomposition_type= avctx->prediction_method; s->chroma_h_shift= 1; s->chroma_v_shift= 1; s->b_width = (s->avctx->width +(1<<dec)-1)>>dec; s->b_height= (s->avctx->height+(1<<dec)-1)>>dec; s->spatial_dwt_buffer= av_mallocz(s->b_width*s->b_height*sizeof(DWTELEM)<<(2*dec)); s->pred_buffer= av_mallocz(s->b_width*s->b_height*sizeof(DWTELEM)<<(2*dec)); s->mv_scale= (s->avctx->flags & CODEC_FLAG_QPEL) ? 2 : 4; for(plane_index=0; plane_index<3; plane_index++){ int w= s->avctx->width; int h= s->avctx->height; if(plane_index){ w>>= s->chroma_h_shift; h>>= s->chroma_v_shift; } s->plane[plane_index].width = w; s->plane[plane_index].height= h; for(level=s->spatial_decomposition_count-1; level>=0; level--){ for(orientation=level ? 1 : 0; orientation<4; orientation++){ SubBand *b= &s->plane[plane_index].band[level][orientation]; b->buf= s->spatial_dwt_buffer; b->level= level; b->stride= s->plane[plane_index].width << (s->spatial_decomposition_count - level); b->width = (w + !(orientation&1))>>1; b->height= (h + !(orientation>1))>>1; if(orientation&1) b->buf += (w+1)>>1; if(orientation>1) b->buf += b->stride>>1; if(level) b->parent= &s->plane[plane_index].band[level-1][orientation]; } w= (w+1)>>1; h= (h+1)>>1; } } s->mb_band.stride= s->mv_band[0].stride= s->mv_band[1].stride= s->mb_band.width = s->mv_band[0].width = s->mv_band[1].width = (s->avctx->width + 15)>>4; s->mb_band.height= s->mv_band[0].height= s->mv_band[1].height= (s->avctx->height+ 15)>>4; s->mb_band .buf= av_mallocz(s->mb_band .stride * s->mb_band .height*sizeof(DWTELEM)); s->mv_band[0].buf= av_mallocz(s->mv_band[0].stride * s->mv_band[0].height*sizeof(DWTELEM)); s->mv_band[1].buf= av_mallocz(s->mv_band[1].stride * s->mv_band[1].height*sizeof(DWTELEM)); reset_contexts(s); s->avctx->get_buffer(s->avctx, &s->mconly_picture); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecContext *VAR_0){ SnowContext *s = VAR_0->priv_data; int VAR_1, VAR_2; int VAR_3, VAR_4, VAR_5, VAR_6; s->VAR_0= VAR_0; dsputil_init(&s->dsp, VAR_0); #define mcf(dx,dy)\ s->dsp.put_qpel_pixels_tab [0][dy+dx/4]=\ s->dsp.put_no_rnd_qpel_pixels_tab[0][dy+dx/4]=\ mc_block ## dx ## dy; mcf( 0, 0) mcf( 4, 0) mcf( 8, 0) mcf(12, 0) mcf( 0, 4) mcf( 4, 4) mcf( 8, 4) mcf(12, 4) mcf( 0, 8) mcf( 4, 8) mcf( 8, 8) mcf(12, 8) mcf( 0,12) mcf( 4,12) mcf( 8,12) mcf(12,12) #define mcfh(dx,dy)\ s->dsp.put_pixels_tab [0][dy/4+dx/8]=\ s->dsp.put_no_rnd_pixels_tab[0][dy/4+dx/8]=\ mc_block_hpel ## dx ## dy; mcfh(0, 0) mcfh(8, 0) mcfh(0, 8) mcfh(8, 8) VAR_6= s->spatial_decomposition_count= 5; s->spatial_decomposition_type= VAR_0->prediction_method; s->chroma_h_shift= 1; s->chroma_v_shift= 1; s->b_width = (s->VAR_0->VAR_1 +(1<<VAR_6)-1)>>VAR_6; s->b_height= (s->VAR_0->VAR_2+(1<<VAR_6)-1)>>VAR_6; s->spatial_dwt_buffer= av_mallocz(s->b_width*s->b_height*sizeof(DWTELEM)<<(2*VAR_6)); s->pred_buffer= av_mallocz(s->b_width*s->b_height*sizeof(DWTELEM)<<(2*VAR_6)); s->mv_scale= (s->VAR_0->flags & CODEC_FLAG_QPEL) ? 2 : 4; for(VAR_5=0; VAR_5<3; VAR_5++){ int VAR_7= s->VAR_0->VAR_1; int VAR_8= s->VAR_0->VAR_2; if(VAR_5){ VAR_7>>= s->chroma_h_shift; VAR_8>>= s->chroma_v_shift; } s->plane[VAR_5].VAR_1 = VAR_7; s->plane[VAR_5].VAR_2= VAR_8; for(VAR_3=s->spatial_decomposition_count-1; VAR_3>=0; VAR_3--){ for(VAR_4=VAR_3 ? 1 : 0; VAR_4<4; VAR_4++){ SubBand *b= &s->plane[VAR_5].band[VAR_3][VAR_4]; b->buf= s->spatial_dwt_buffer; b->VAR_3= VAR_3; b->stride= s->plane[VAR_5].VAR_1 << (s->spatial_decomposition_count - VAR_3); b->VAR_1 = (VAR_7 + !(VAR_4&1))>>1; b->VAR_2= (VAR_8 + !(VAR_4>1))>>1; if(VAR_4&1) b->buf += (VAR_7+1)>>1; if(VAR_4>1) b->buf += b->stride>>1; if(VAR_3) b->parent= &s->plane[VAR_5].band[VAR_3-1][VAR_4]; } VAR_7= (VAR_7+1)>>1; VAR_8= (VAR_8+1)>>1; } } s->mb_band.stride= s->mv_band[0].stride= s->mv_band[1].stride= s->mb_band.VAR_1 = s->mv_band[0].VAR_1 = s->mv_band[1].VAR_1 = (s->VAR_0->VAR_1 + 15)>>4; s->mb_band.VAR_2= s->mv_band[0].VAR_2= s->mv_band[1].VAR_2= (s->VAR_0->VAR_2+ 15)>>4; s->mb_band .buf= av_mallocz(s->mb_band .stride * s->mb_band .VAR_2*sizeof(DWTELEM)); s->mv_band[0].buf= av_mallocz(s->mv_band[0].stride * s->mv_band[0].VAR_2*sizeof(DWTELEM)); s->mv_band[1].buf= av_mallocz(s->mv_band[1].stride * s->mv_band[1].VAR_2*sizeof(DWTELEM)); reset_contexts(s); s->VAR_0->get_buffer(s->VAR_0, &s->mconly_picture); return 0; }
[ "static int FUNC_0(AVCodecContext *VAR_0){", "SnowContext *s = VAR_0->priv_data;", "int VAR_1, VAR_2;", "int VAR_3, VAR_4, VAR_5, VAR_6;", "s->VAR_0= VAR_0;", "dsputil_init(&s->dsp, VAR_0);", "#define mcf(dx,dy)\\\ns->dsp.put_qpel_pixels_tab [0][dy+dx/4]=\\\ns->dsp.put_no_rnd_qpel_pixels_tab[0][dy+dx/4]=\\\nmc_block ## dx ## dy;", "mcf( 0, 0)\nmcf( 4, 0)\nmcf( 8, 0)\nmcf(12, 0)\nmcf( 0, 4)\nmcf( 4, 4)\nmcf( 8, 4)\nmcf(12, 4)\nmcf( 0, 8)\nmcf( 4, 8)\nmcf( 8, 8)\nmcf(12, 8)\nmcf( 0,12)\nmcf( 4,12)\nmcf( 8,12)\nmcf(12,12)\n#define mcfh(dx,dy)\\\ns->dsp.put_pixels_tab [0][dy/4+dx/8]=\\\ns->dsp.put_no_rnd_pixels_tab[0][dy/4+dx/8]=\\\nmc_block_hpel ## dx ## dy;", "mcfh(0, 0)\nmcfh(8, 0)\nmcfh(0, 8)\nmcfh(8, 8)\nVAR_6= s->spatial_decomposition_count= 5;", "s->spatial_decomposition_type= VAR_0->prediction_method;", "s->chroma_h_shift= 1;", "s->chroma_v_shift= 1;", "s->b_width = (s->VAR_0->VAR_1 +(1<<VAR_6)-1)>>VAR_6;", "s->b_height= (s->VAR_0->VAR_2+(1<<VAR_6)-1)>>VAR_6;", "s->spatial_dwt_buffer= av_mallocz(s->b_width*s->b_height*sizeof(DWTELEM)<<(2*VAR_6));", "s->pred_buffer= av_mallocz(s->b_width*s->b_height*sizeof(DWTELEM)<<(2*VAR_6));", "s->mv_scale= (s->VAR_0->flags & CODEC_FLAG_QPEL) ? 2 : 4;", "for(VAR_5=0; VAR_5<3; VAR_5++){", "int VAR_7= s->VAR_0->VAR_1;", "int VAR_8= s->VAR_0->VAR_2;", "if(VAR_5){", "VAR_7>>= s->chroma_h_shift;", "VAR_8>>= s->chroma_v_shift;", "}", "s->plane[VAR_5].VAR_1 = VAR_7;", "s->plane[VAR_5].VAR_2= VAR_8;", "for(VAR_3=s->spatial_decomposition_count-1; VAR_3>=0; VAR_3--){", "for(VAR_4=VAR_3 ? 1 : 0; VAR_4<4; VAR_4++){", "SubBand *b= &s->plane[VAR_5].band[VAR_3][VAR_4];", "b->buf= s->spatial_dwt_buffer;", "b->VAR_3= VAR_3;", "b->stride= s->plane[VAR_5].VAR_1 << (s->spatial_decomposition_count - VAR_3);", "b->VAR_1 = (VAR_7 + !(VAR_4&1))>>1;", "b->VAR_2= (VAR_8 + !(VAR_4>1))>>1;", "if(VAR_4&1) b->buf += (VAR_7+1)>>1;", "if(VAR_4>1) b->buf += b->stride>>1;", "if(VAR_3)\nb->parent= &s->plane[VAR_5].band[VAR_3-1][VAR_4];", "}", "VAR_7= (VAR_7+1)>>1;", "VAR_8= (VAR_8+1)>>1;", "}", "}", "s->mb_band.stride= s->mv_band[0].stride= s->mv_band[1].stride=\ns->mb_band.VAR_1 = s->mv_band[0].VAR_1 = s->mv_band[1].VAR_1 = (s->VAR_0->VAR_1 + 15)>>4;", "s->mb_band.VAR_2= s->mv_band[0].VAR_2= s->mv_band[1].VAR_2= (s->VAR_0->VAR_2+ 15)>>4;", "s->mb_band .buf= av_mallocz(s->mb_band .stride * s->mb_band .VAR_2*sizeof(DWTELEM));", "s->mv_band[0].buf= av_mallocz(s->mv_band[0].stride * s->mv_band[0].VAR_2*sizeof(DWTELEM));", "s->mv_band[1].buf= av_mallocz(s->mv_band[1].stride * s->mv_band[1].VAR_2*sizeof(DWTELEM));", "reset_contexts(s);", "s->VAR_0->get_buffer(s->VAR_0, &s->mconly_picture);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1 ], [ 3 ], [ 5 ], [ 7 ], [ 11 ], [ 15 ], [ 19, 21, 23, 25 ], [ 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59, 63, 65, 67, 69 ], [ 73, 75, 77, 79, 83 ], [ 85 ], [ 89 ], [ 91 ], [ 99 ], [ 101 ], [ 105 ], [ 107 ], [ 111 ], [ 115 ], [ 117 ], [ 119 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 137 ], [ 139 ], [ 141 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 157 ], [ 159 ], [ 163, 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 181, 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 195 ], [ 209 ], [ 213 ], [ 215 ] ]
20,053
USBDevice *usbdevice_create(const char *cmdline) { USBBus *bus = usb_bus_find(-1 /* any */); DeviceInfo *info; USBDeviceInfo *usb; char driver[32]; const char *params; int len; params = strchr(cmdline,':'); if (params) { params++; len = params - cmdline; if (len > sizeof(driver)) len = sizeof(driver); pstrcpy(driver, len, cmdline); } else { params = ""; pstrcpy(driver, sizeof(driver), cmdline); } for (info = device_info_list; info != NULL; info = info->next) { if (info->bus_info != &usb_bus_info) continue; usb = DO_UPCAST(USBDeviceInfo, qdev, info); if (usb->usbdevice_name == NULL) continue; if (strcmp(usb->usbdevice_name, driver) != 0) continue; break; } if (info == NULL) { #if 0 /* no error because some drivers are not converted (yet) */ error_report("usbdevice %s not found", driver); #endif return NULL; } if (!usb->usbdevice_init) { if (params) { error_report("usbdevice %s accepts no params", driver); return NULL; } return usb_create_simple(bus, usb->qdev.name); } return usb->usbdevice_init(params); }
false
qemu
98f22dc172e1ebd5341da3de0d67666442566f72
USBDevice *usbdevice_create(const char *cmdline) { USBBus *bus = usb_bus_find(-1 ); DeviceInfo *info; USBDeviceInfo *usb; char driver[32]; const char *params; int len; params = strchr(cmdline,':'); if (params) { params++; len = params - cmdline; if (len > sizeof(driver)) len = sizeof(driver); pstrcpy(driver, len, cmdline); } else { params = ""; pstrcpy(driver, sizeof(driver), cmdline); } for (info = device_info_list; info != NULL; info = info->next) { if (info->bus_info != &usb_bus_info) continue; usb = DO_UPCAST(USBDeviceInfo, qdev, info); if (usb->usbdevice_name == NULL) continue; if (strcmp(usb->usbdevice_name, driver) != 0) continue; break; } if (info == NULL) { #if 0 error_report("usbdevice %s not found", driver); #endif return NULL; } if (!usb->usbdevice_init) { if (params) { error_report("usbdevice %s accepts no params", driver); return NULL; } return usb_create_simple(bus, usb->qdev.name); } return usb->usbdevice_init(params); }
{ "code": [], "line_no": [] }
USBDevice *FUNC_0(const char *cmdline) { USBBus *bus = usb_bus_find(-1 ); DeviceInfo *info; USBDeviceInfo *usb; char VAR_0[32]; const char *VAR_1; int VAR_2; VAR_1 = strchr(cmdline,':'); if (VAR_1) { VAR_1++; VAR_2 = VAR_1 - cmdline; if (VAR_2 > sizeof(VAR_0)) VAR_2 = sizeof(VAR_0); pstrcpy(VAR_0, VAR_2, cmdline); } else { VAR_1 = ""; pstrcpy(VAR_0, sizeof(VAR_0), cmdline); } for (info = device_info_list; info != NULL; info = info->next) { if (info->bus_info != &usb_bus_info) continue; usb = DO_UPCAST(USBDeviceInfo, qdev, info); if (usb->usbdevice_name == NULL) continue; if (strcmp(usb->usbdevice_name, VAR_0) != 0) continue; break; } if (info == NULL) { #if 0 error_report("usbdevice %s not found", VAR_0); #endif return NULL; } if (!usb->usbdevice_init) { if (VAR_1) { error_report("usbdevice %s accepts no VAR_1", VAR_0); return NULL; } return usb_create_simple(bus, usb->qdev.name); } return usb->usbdevice_init(VAR_1); }
[ "USBDevice *FUNC_0(const char *cmdline)\n{", "USBBus *bus = usb_bus_find(-1 );", "DeviceInfo *info;", "USBDeviceInfo *usb;", "char VAR_0[32];", "const char *VAR_1;", "int VAR_2;", "VAR_1 = strchr(cmdline,':');", "if (VAR_1) {", "VAR_1++;", "VAR_2 = VAR_1 - cmdline;", "if (VAR_2 > sizeof(VAR_0))\nVAR_2 = sizeof(VAR_0);", "pstrcpy(VAR_0, VAR_2, cmdline);", "} else {", "VAR_1 = \"\";", "pstrcpy(VAR_0, sizeof(VAR_0), cmdline);", "}", "for (info = device_info_list; info != NULL; info = info->next) {", "if (info->bus_info != &usb_bus_info)\ncontinue;", "usb = DO_UPCAST(USBDeviceInfo, qdev, info);", "if (usb->usbdevice_name == NULL)\ncontinue;", "if (strcmp(usb->usbdevice_name, VAR_0) != 0)\ncontinue;", "break;", "}", "if (info == NULL) {", "#if 0\nerror_report(\"usbdevice %s not found\", VAR_0);", "#endif\nreturn NULL;", "}", "if (!usb->usbdevice_init) {", "if (VAR_1) {", "error_report(\"usbdevice %s accepts no VAR_1\", VAR_0);", "return NULL;", "}", "return usb_create_simple(bus, usb->qdev.name);", "}", "return usb->usbdevice_init(VAR_1);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27, 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45, 47 ], [ 49 ], [ 51, 53 ], [ 55, 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65, 69 ], [ 71, 73 ], [ 75 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ] ]
20,057
static int net_init_nic(QemuOpts *opts, Monitor *mon, const char *name, VLANState *vlan) { int idx; NICInfo *nd; const char *netdev; idx = nic_get_free_idx(); if (idx == -1 || nb_nics >= MAX_NICS) { qemu_error("Too Many NICs\n"); return -1; } nd = &nd_table[idx]; memset(nd, 0, sizeof(*nd)); if ((netdev = qemu_opt_get(opts, "netdev"))) { nd->netdev = qemu_find_netdev(netdev); if (!nd->netdev) { qemu_error("netdev '%s' not found\n", netdev); return -1; } } else { assert(vlan); nd->vlan = vlan; } if (name) { nd->name = qemu_strdup(name); } if (qemu_opt_get(opts, "model")) { nd->model = qemu_strdup(qemu_opt_get(opts, "model")); } if (qemu_opt_get(opts, "addr")) { nd->devaddr = qemu_strdup(qemu_opt_get(opts, "addr")); } nd->macaddr[0] = 0x52; nd->macaddr[1] = 0x54; nd->macaddr[2] = 0x00; nd->macaddr[3] = 0x12; nd->macaddr[4] = 0x34; nd->macaddr[5] = 0x56 + idx; if (qemu_opt_get(opts, "macaddr") && net_parse_macaddr(nd->macaddr, qemu_opt_get(opts, "macaddr")) < 0) { qemu_error("invalid syntax for ethernet address\n"); return -1; } nd->nvectors = qemu_opt_get_number(opts, "vectors", NIC_NVECTORS_UNSPECIFIED); if (nd->nvectors != NIC_NVECTORS_UNSPECIFIED && (nd->nvectors < 0 || nd->nvectors > 0x7ffffff)) { qemu_error("invalid # of vectors: %d\n", nd->nvectors); return -1; } nd->used = 1; if (vlan) { nd->vlan->nb_guest_devs++; } nb_nics++; return idx; }
false
qemu
62112d181ca33fea976100c4335dfc3e2f727e6c
static int net_init_nic(QemuOpts *opts, Monitor *mon, const char *name, VLANState *vlan) { int idx; NICInfo *nd; const char *netdev; idx = nic_get_free_idx(); if (idx == -1 || nb_nics >= MAX_NICS) { qemu_error("Too Many NICs\n"); return -1; } nd = &nd_table[idx]; memset(nd, 0, sizeof(*nd)); if ((netdev = qemu_opt_get(opts, "netdev"))) { nd->netdev = qemu_find_netdev(netdev); if (!nd->netdev) { qemu_error("netdev '%s' not found\n", netdev); return -1; } } else { assert(vlan); nd->vlan = vlan; } if (name) { nd->name = qemu_strdup(name); } if (qemu_opt_get(opts, "model")) { nd->model = qemu_strdup(qemu_opt_get(opts, "model")); } if (qemu_opt_get(opts, "addr")) { nd->devaddr = qemu_strdup(qemu_opt_get(opts, "addr")); } nd->macaddr[0] = 0x52; nd->macaddr[1] = 0x54; nd->macaddr[2] = 0x00; nd->macaddr[3] = 0x12; nd->macaddr[4] = 0x34; nd->macaddr[5] = 0x56 + idx; if (qemu_opt_get(opts, "macaddr") && net_parse_macaddr(nd->macaddr, qemu_opt_get(opts, "macaddr")) < 0) { qemu_error("invalid syntax for ethernet address\n"); return -1; } nd->nvectors = qemu_opt_get_number(opts, "vectors", NIC_NVECTORS_UNSPECIFIED); if (nd->nvectors != NIC_NVECTORS_UNSPECIFIED && (nd->nvectors < 0 || nd->nvectors > 0x7ffffff)) { qemu_error("invalid # of vectors: %d\n", nd->nvectors); return -1; } nd->used = 1; if (vlan) { nd->vlan->nb_guest_devs++; } nb_nics++; return idx; }
{ "code": [], "line_no": [] }
static int FUNC_0(QemuOpts *VAR_0, Monitor *VAR_1, const char *VAR_2, VLANState *VAR_3) { int VAR_4; NICInfo *nd; const char *VAR_5; VAR_4 = nic_get_free_idx(); if (VAR_4 == -1 || nb_nics >= MAX_NICS) { qemu_error("Too Many NICs\n"); return -1; } nd = &nd_table[VAR_4]; memset(nd, 0, sizeof(*nd)); if ((VAR_5 = qemu_opt_get(VAR_0, "VAR_5"))) { nd->VAR_5 = qemu_find_netdev(VAR_5); if (!nd->VAR_5) { qemu_error("VAR_5 '%s' not found\n", VAR_5); return -1; } } else { assert(VAR_3); nd->VAR_3 = VAR_3; } if (VAR_2) { nd->VAR_2 = qemu_strdup(VAR_2); } if (qemu_opt_get(VAR_0, "model")) { nd->model = qemu_strdup(qemu_opt_get(VAR_0, "model")); } if (qemu_opt_get(VAR_0, "addr")) { nd->devaddr = qemu_strdup(qemu_opt_get(VAR_0, "addr")); } nd->macaddr[0] = 0x52; nd->macaddr[1] = 0x54; nd->macaddr[2] = 0x00; nd->macaddr[3] = 0x12; nd->macaddr[4] = 0x34; nd->macaddr[5] = 0x56 + VAR_4; if (qemu_opt_get(VAR_0, "macaddr") && net_parse_macaddr(nd->macaddr, qemu_opt_get(VAR_0, "macaddr")) < 0) { qemu_error("invalid syntax for ethernet address\n"); return -1; } nd->nvectors = qemu_opt_get_number(VAR_0, "vectors", NIC_NVECTORS_UNSPECIFIED); if (nd->nvectors != NIC_NVECTORS_UNSPECIFIED && (nd->nvectors < 0 || nd->nvectors > 0x7ffffff)) { qemu_error("invalid # of vectors: %d\n", nd->nvectors); return -1; } nd->used = 1; if (VAR_3) { nd->VAR_3->nb_guest_devs++; } nb_nics++; return VAR_4; }
[ "static int FUNC_0(QemuOpts *VAR_0,\nMonitor *VAR_1,\nconst char *VAR_2,\nVLANState *VAR_3)\n{", "int VAR_4;", "NICInfo *nd;", "const char *VAR_5;", "VAR_4 = nic_get_free_idx();", "if (VAR_4 == -1 || nb_nics >= MAX_NICS) {", "qemu_error(\"Too Many NICs\\n\");", "return -1;", "}", "nd = &nd_table[VAR_4];", "memset(nd, 0, sizeof(*nd));", "if ((VAR_5 = qemu_opt_get(VAR_0, \"VAR_5\"))) {", "nd->VAR_5 = qemu_find_netdev(VAR_5);", "if (!nd->VAR_5) {", "qemu_error(\"VAR_5 '%s' not found\\n\", VAR_5);", "return -1;", "}", "} else {", "assert(VAR_3);", "nd->VAR_3 = VAR_3;", "}", "if (VAR_2) {", "nd->VAR_2 = qemu_strdup(VAR_2);", "}", "if (qemu_opt_get(VAR_0, \"model\")) {", "nd->model = qemu_strdup(qemu_opt_get(VAR_0, \"model\"));", "}", "if (qemu_opt_get(VAR_0, \"addr\")) {", "nd->devaddr = qemu_strdup(qemu_opt_get(VAR_0, \"addr\"));", "}", "nd->macaddr[0] = 0x52;", "nd->macaddr[1] = 0x54;", "nd->macaddr[2] = 0x00;", "nd->macaddr[3] = 0x12;", "nd->macaddr[4] = 0x34;", "nd->macaddr[5] = 0x56 + VAR_4;", "if (qemu_opt_get(VAR_0, \"macaddr\") &&\nnet_parse_macaddr(nd->macaddr, qemu_opt_get(VAR_0, \"macaddr\")) < 0) {", "qemu_error(\"invalid syntax for ethernet address\\n\");", "return -1;", "}", "nd->nvectors = qemu_opt_get_number(VAR_0, \"vectors\", NIC_NVECTORS_UNSPECIFIED);", "if (nd->nvectors != NIC_NVECTORS_UNSPECIFIED &&\n(nd->nvectors < 0 || nd->nvectors > 0x7ffffff)) {", "qemu_error(\"invalid # of vectors: %d\\n\", nd->nvectors);", "return -1;", "}", "nd->used = 1;", "if (VAR_3) {", "nd->VAR_3->nb_guest_devs++;", "}", "nb_nics++;", "return VAR_4;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 93, 95 ], [ 97 ], [ 99 ], [ 101 ], [ 105 ], [ 107, 109 ], [ 111 ], [ 113 ], [ 115 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 131 ], [ 133 ] ]
20,058
print_insn_sparc (bfd_vma memaddr, disassemble_info *info) { FILE *stream = info->stream; bfd_byte buffer[4]; unsigned long insn; sparc_opcode_hash *op; /* Nonzero of opcode table has been initialized. */ static int opcodes_initialized = 0; /* bfd mach number of last call. */ static unsigned long current_mach = 0; bfd_vma (*getword) (const unsigned char *); if (!opcodes_initialized || info->mach != current_mach) { int i; current_arch_mask = compute_arch_mask (info->mach); if (!opcodes_initialized) sorted_opcodes = malloc (sparc_num_opcodes * sizeof (sparc_opcode *)); /* Reset the sorted table so we can resort it. */ for (i = 0; i < sparc_num_opcodes; ++i) sorted_opcodes[i] = &sparc_opcodes[i]; qsort ((char *) sorted_opcodes, sparc_num_opcodes, sizeof (sorted_opcodes[0]), compare_opcodes); build_hash_table (sorted_opcodes, opcode_hash_table, sparc_num_opcodes); current_mach = info->mach; opcodes_initialized = 1; } { int status = (*info->read_memory_func) (memaddr, buffer, sizeof (buffer), info); if (status != 0) { (*info->memory_error_func) (status, memaddr, info); return -1; } } /* On SPARClite variants such as DANlite (sparc86x), instructions are always big-endian even when the machine is in little-endian mode. */ if (info->endian == BFD_ENDIAN_BIG || info->mach == bfd_mach_sparc_sparclite) getword = bfd_getb32; else getword = bfd_getl32; insn = getword (buffer); info->insn_info_valid = 1; /* We do return this info. */ info->insn_type = dis_nonbranch; /* Assume non branch insn. */ info->branch_delay_insns = 0; /* Assume no delay. */ info->target = 0; /* Assume no target known. */ for (op = opcode_hash_table[HASH_INSN (insn)]; op; op = op->next) { const sparc_opcode *opcode = op->opcode; /* If the insn isn't supported by the current architecture, skip it. */ if (! (opcode->architecture & current_arch_mask)) continue; if ((opcode->match & insn) == opcode->match && (opcode->lose & insn) == 0) { /* Nonzero means that we have found an instruction which has the effect of adding or or'ing the imm13 field to rs1. */ int imm_added_to_rs1 = 0; int imm_ored_to_rs1 = 0; /* Nonzero means that we have found a plus sign in the args field of the opcode table. */ int found_plus = 0; /* Nonzero means we have an annulled branch. */ /* int is_annulled = 0; */ /* see FIXME below */ /* Do we have an `add' or `or' instruction combining an immediate with rs1? */ if (opcode->match == 0x80102000) /* or */ imm_ored_to_rs1 = 1; if (opcode->match == 0x80002000) /* add */ imm_added_to_rs1 = 1; if (X_RS1 (insn) != X_RD (insn) && strchr (opcode->args, 'r') != NULL) /* Can't do simple format if source and dest are different. */ continue; if (X_RS2 (insn) != X_RD (insn) && strchr (opcode->args, 'O') != NULL) /* Can't do simple format if source and dest are different. */ continue; (*info->fprintf_func) (stream, opcode->name); { const char *s; if (opcode->args[0] != ',') (*info->fprintf_func) (stream, " "); for (s = opcode->args; *s != '\0'; ++s) { while (*s == ',') { (*info->fprintf_func) (stream, ","); ++s; switch (*s) { case 'a': (*info->fprintf_func) (stream, "a"); /* is_annulled = 1; */ /* see FIXME below */ ++s; continue; case 'N': (*info->fprintf_func) (stream, "pn"); ++s; continue; case 'T': (*info->fprintf_func) (stream, "pt"); ++s; continue; default: break; } } (*info->fprintf_func) (stream, " "); switch (*s) { case '+': found_plus = 1; /* Fall through. */ default: (*info->fprintf_func) (stream, "%c", *s); break; case '#': (*info->fprintf_func) (stream, "0"); break; #define reg(n) (*info->fprintf_func) (stream, "%%%s", reg_names[n]) case '1': case 'r': reg (X_RS1 (insn)); break; case '2': case 'O': reg (X_RS2 (insn)); break; case 'd': reg (X_RD (insn)); break; #undef reg #define freg(n) (*info->fprintf_func) (stream, "%%%s", freg_names[n]) #define fregx(n) (*info->fprintf_func) (stream, "%%%s", freg_names[((n) & ~1) | (((n) & 1) << 5)]) case 'e': freg (X_RS1 (insn)); break; case 'v': /* Double/even. */ case 'V': /* Quad/multiple of 4. */ fregx (X_RS1 (insn)); break; case 'f': freg (X_RS2 (insn)); break; case 'B': /* Double/even. */ case 'R': /* Quad/multiple of 4. */ fregx (X_RS2 (insn)); break; case 'g': freg (X_RD (insn)); break; case 'H': /* Double/even. */ case 'J': /* Quad/multiple of 4. */ fregx (X_RD (insn)); break; #undef freg #undef fregx #define creg(n) (*info->fprintf_func) (stream, "%%c%u", (unsigned int) (n)) case 'b': creg (X_RS1 (insn)); break; case 'c': creg (X_RS2 (insn)); break; case 'D': creg (X_RD (insn)); break; #undef creg case 'h': (*info->fprintf_func) (stream, "%%hi(%#x)", ((unsigned) 0xFFFFFFFF & ((int) X_IMM22 (insn) << 10))); break; case 'i': /* 13 bit immediate. */ case 'I': /* 11 bit immediate. */ case 'j': /* 10 bit immediate. */ { int imm; if (*s == 'i') imm = X_SIMM (insn, 13); else if (*s == 'I') imm = X_SIMM (insn, 11); else imm = X_SIMM (insn, 10); /* Check to see whether we have a 1+i, and take note of that fact. Note: because of the way we sort the table, we will be matching 1+i rather than i+1, so it is OK to assume that i is after +, not before it. */ if (found_plus) imm_added_to_rs1 = 1; if (imm <= 9) (*info->fprintf_func) (stream, "%d", imm); else (*info->fprintf_func) (stream, "%#x", imm); } break; case 'X': /* 5 bit unsigned immediate. */ case 'Y': /* 6 bit unsigned immediate. */ { int imm = X_IMM (insn, *s == 'X' ? 5 : 6); if (imm <= 9) (info->fprintf_func) (stream, "%d", imm); else (info->fprintf_func) (stream, "%#x", (unsigned) imm); } break; case '3': (info->fprintf_func) (stream, "%ld", X_IMM (insn, 3)); break; case 'K': { int mask = X_MEMBAR (insn); int bit = 0x40, printed_one = 0; const char *name; if (mask == 0) (info->fprintf_func) (stream, "0"); else while (bit) { if (mask & bit) { if (printed_one) (info->fprintf_func) (stream, "|"); name = sparc_decode_membar (bit); (info->fprintf_func) (stream, "%s", name); printed_one = 1; } bit >>= 1; } break; } case 'k': info->target = memaddr + SEX (X_DISP16 (insn), 16) * 4; (*info->print_address_func) (info->target, info); break; case 'G': info->target = memaddr + SEX (X_DISP19 (insn), 19) * 4; (*info->print_address_func) (info->target, info); break; case '6': case '7': case '8': case '9': (*info->fprintf_func) (stream, "%%fcc%c", *s - '6' + '0'); break; case 'z': (*info->fprintf_func) (stream, "%%icc"); break; case 'Z': (*info->fprintf_func) (stream, "%%xcc"); break; case 'E': (*info->fprintf_func) (stream, "%%ccr"); break; case 's': (*info->fprintf_func) (stream, "%%fprs"); break; case 'o': (*info->fprintf_func) (stream, "%%asi"); break; case 'W': (*info->fprintf_func) (stream, "%%tick"); break; case 'P': (*info->fprintf_func) (stream, "%%pc"); break; case '?': if (X_RS1 (insn) == 31) (*info->fprintf_func) (stream, "%%ver"); else if ((unsigned) X_RS1 (insn) < 17) (*info->fprintf_func) (stream, "%%%s", v9_priv_reg_names[X_RS1 (insn)]); else (*info->fprintf_func) (stream, "%%reserved"); break; case '!': if ((unsigned) X_RD (insn) < 17) (*info->fprintf_func) (stream, "%%%s", v9_priv_reg_names[X_RD (insn)]); else (*info->fprintf_func) (stream, "%%reserved"); break; case '$': if ((unsigned) X_RS1 (insn) < 32) (*info->fprintf_func) (stream, "%%%s", v9_hpriv_reg_names[X_RS1 (insn)]); else (*info->fprintf_func) (stream, "%%reserved"); break; case '%': if ((unsigned) X_RD (insn) < 32) (*info->fprintf_func) (stream, "%%%s", v9_hpriv_reg_names[X_RD (insn)]); else (*info->fprintf_func) (stream, "%%reserved"); break; case '/': if (X_RS1 (insn) < 16 || X_RS1 (insn) > 25) (*info->fprintf_func) (stream, "%%reserved"); else (*info->fprintf_func) (stream, "%%%s", v9a_asr_reg_names[X_RS1 (insn)-16]); break; case '_': if (X_RD (insn) < 16 || X_RD (insn) > 25) (*info->fprintf_func) (stream, "%%reserved"); else (*info->fprintf_func) (stream, "%%%s", v9a_asr_reg_names[X_RD (insn)-16]); break; case '*': { const char *name = sparc_decode_prefetch (X_RD (insn)); if (name) (*info->fprintf_func) (stream, "%s", name); else (*info->fprintf_func) (stream, "%ld", X_RD (insn)); break; } case 'M': (*info->fprintf_func) (stream, "%%asr%ld", X_RS1 (insn)); break; case 'm': (*info->fprintf_func) (stream, "%%asr%ld", X_RD (insn)); break; case 'L': info->target = memaddr + SEX (X_DISP30 (insn), 30) * 4; (*info->print_address_func) (info->target, info); break; case 'n': (*info->fprintf_func) (stream, "%#x", SEX (X_DISP22 (insn), 22)); break; case 'l': info->target = memaddr + SEX (X_DISP22 (insn), 22) * 4; (*info->print_address_func) (info->target, info); break; case 'A': { const char *name; if ((info->mach == bfd_mach_sparc_v8plusa) || ((info->mach >= bfd_mach_sparc_v9) && (info->mach <= bfd_mach_sparc_v9b))) name = sparc_decode_asi_v9 (X_ASI (insn)); else name = sparc_decode_asi_v8 (X_ASI (insn)); if (name) (*info->fprintf_func) (stream, "%s", name); else (*info->fprintf_func) (stream, "(%ld)", X_ASI (insn)); break; } case 'C': (*info->fprintf_func) (stream, "%%csr"); break; case 'F': (*info->fprintf_func) (stream, "%%fsr"); break; case 'p': (*info->fprintf_func) (stream, "%%psr"); break; case 'q': (*info->fprintf_func) (stream, "%%fq"); break; case 'Q': (*info->fprintf_func) (stream, "%%cq"); break; case 't': (*info->fprintf_func) (stream, "%%tbr"); break; case 'w': (*info->fprintf_func) (stream, "%%wim"); break; case 'x': (*info->fprintf_func) (stream, "%ld", ((X_LDST_I (insn) << 8) + X_ASI (insn))); break; case 'y': (*info->fprintf_func) (stream, "%%y"); break; case 'u': case 'U': { int val = *s == 'U' ? X_RS1 (insn) : X_RD (insn); const char *name = sparc_decode_sparclet_cpreg (val); if (name) (*info->fprintf_func) (stream, "%s", name); else (*info->fprintf_func) (stream, "%%cpreg(%d)", val); break; } } } } /* If we are adding or or'ing something to rs1, then check to see whether the previous instruction was a sethi to the same register as in the sethi. If so, attempt to print the result of the add or or (in this context add and or do the same thing) and its symbolic value. */ if (imm_ored_to_rs1 || imm_added_to_rs1) { unsigned long prev_insn; int errcode; if (memaddr >= 4) errcode = (*info->read_memory_func) (memaddr - 4, buffer, sizeof (buffer), info); else errcode = 1; prev_insn = getword (buffer); if (errcode == 0) { /* If it is a delayed branch, we need to look at the instruction before the delayed branch. This handles sequences such as: sethi %o1, %hi(_foo), %o1 call _printf or %o1, %lo(_foo), %o1 */ if (is_delayed_branch (prev_insn)) { if (memaddr >= 8) errcode = (*info->read_memory_func) (memaddr - 8, buffer, sizeof (buffer), info); else errcode = 1; prev_insn = getword (buffer); } } /* If there was a problem reading memory, then assume the previous instruction was not sethi. */ if (errcode == 0) { /* Is it sethi to the same register? */ if ((prev_insn & 0xc1c00000) == 0x01000000 && X_RD (prev_insn) == X_RS1 (insn)) { (*info->fprintf_func) (stream, "\t! "); info->target = ((unsigned) 0xFFFFFFFF & ((int) X_IMM22 (prev_insn) << 10)); if (imm_added_to_rs1) info->target += X_SIMM (insn, 13); else info->target |= X_SIMM (insn, 13); (*info->print_address_func) (info->target, info); info->insn_type = dis_dref; info->data_size = 4; /* FIXME!!! */ } } } if (opcode->flags & (F_UNBR|F_CONDBR|F_JSR)) { /* FIXME -- check is_annulled flag. */ if (opcode->flags & F_UNBR) info->insn_type = dis_branch; if (opcode->flags & F_CONDBR) info->insn_type = dis_condbranch; if (opcode->flags & F_JSR) info->insn_type = dis_jsr; if (opcode->flags & F_DELAYED) info->branch_delay_insns = 1; } return sizeof (buffer); } } info->insn_type = dis_noninsn; /* Mark as non-valid instruction. */ (*info->fprintf_func) (stream, _("unknown")); return sizeof (buffer); }
false
qemu
452f58eb4966de0d957e9314383cf490fcb69064
print_insn_sparc (bfd_vma memaddr, disassemble_info *info) { FILE *stream = info->stream; bfd_byte buffer[4]; unsigned long insn; sparc_opcode_hash *op; static int opcodes_initialized = 0; static unsigned long current_mach = 0; bfd_vma (*getword) (const unsigned char *); if (!opcodes_initialized || info->mach != current_mach) { int i; current_arch_mask = compute_arch_mask (info->mach); if (!opcodes_initialized) sorted_opcodes = malloc (sparc_num_opcodes * sizeof (sparc_opcode *)); for (i = 0; i < sparc_num_opcodes; ++i) sorted_opcodes[i] = &sparc_opcodes[i]; qsort ((char *) sorted_opcodes, sparc_num_opcodes, sizeof (sorted_opcodes[0]), compare_opcodes); build_hash_table (sorted_opcodes, opcode_hash_table, sparc_num_opcodes); current_mach = info->mach; opcodes_initialized = 1; } { int status = (*info->read_memory_func) (memaddr, buffer, sizeof (buffer), info); if (status != 0) { (*info->memory_error_func) (status, memaddr, info); return -1; } } if (info->endian == BFD_ENDIAN_BIG || info->mach == bfd_mach_sparc_sparclite) getword = bfd_getb32; else getword = bfd_getl32; insn = getword (buffer); info->insn_info_valid = 1; info->insn_type = dis_nonbranch; info->branch_delay_insns = 0; info->target = 0; for (op = opcode_hash_table[HASH_INSN (insn)]; op; op = op->next) { const sparc_opcode *opcode = op->opcode; if (! (opcode->architecture & current_arch_mask)) continue; if ((opcode->match & insn) == opcode->match && (opcode->lose & insn) == 0) { int imm_added_to_rs1 = 0; int imm_ored_to_rs1 = 0; int found_plus = 0; if (opcode->match == 0x80102000) imm_ored_to_rs1 = 1; if (opcode->match == 0x80002000) imm_added_to_rs1 = 1; if (X_RS1 (insn) != X_RD (insn) && strchr (opcode->args, 'r') != NULL) continue; if (X_RS2 (insn) != X_RD (insn) && strchr (opcode->args, 'O') != NULL) continue; (*info->fprintf_func) (stream, opcode->name); { const char *s; if (opcode->args[0] != ',') (*info->fprintf_func) (stream, " "); for (s = opcode->args; *s != '\0'; ++s) { while (*s == ',') { (*info->fprintf_func) (stream, ","); ++s; switch (*s) { case 'a': (*info->fprintf_func) (stream, "a"); ++s; continue; case 'N': (*info->fprintf_func) (stream, "pn"); ++s; continue; case 'T': (*info->fprintf_func) (stream, "pt"); ++s; continue; default: break; } } (*info->fprintf_func) (stream, " "); switch (*s) { case '+': found_plus = 1; default: (*info->fprintf_func) (stream, "%c", *s); break; case '#': (*info->fprintf_func) (stream, "0"); break; #define reg(n) (*info->fprintf_func) (stream, "%%%s", reg_names[n]) case '1': case 'r': reg (X_RS1 (insn)); break; case '2': case 'O': reg (X_RS2 (insn)); break; case 'd': reg (X_RD (insn)); break; #undef reg #define freg(n) (*info->fprintf_func) (stream, "%%%s", freg_names[n]) #define fregx(n) (*info->fprintf_func) (stream, "%%%s", freg_names[((n) & ~1) | (((n) & 1) << 5)]) case 'e': freg (X_RS1 (insn)); break; case 'v': case 'V': fregx (X_RS1 (insn)); break; case 'f': freg (X_RS2 (insn)); break; case 'B': case 'R': fregx (X_RS2 (insn)); break; case 'g': freg (X_RD (insn)); break; case 'H': case 'J': fregx (X_RD (insn)); break; #undef freg #undef fregx #define creg(n) (*info->fprintf_func) (stream, "%%c%u", (unsigned int) (n)) case 'b': creg (X_RS1 (insn)); break; case 'c': creg (X_RS2 (insn)); break; case 'D': creg (X_RD (insn)); break; #undef creg case 'h': (*info->fprintf_func) (stream, "%%hi(%#x)", ((unsigned) 0xFFFFFFFF & ((int) X_IMM22 (insn) << 10))); break; case 'i': case 'I': case 'j': { int imm; if (*s == 'i') imm = X_SIMM (insn, 13); else if (*s == 'I') imm = X_SIMM (insn, 11); else imm = X_SIMM (insn, 10); if (found_plus) imm_added_to_rs1 = 1; if (imm <= 9) (*info->fprintf_func) (stream, "%d", imm); else (*info->fprintf_func) (stream, "%#x", imm); } break; case 'X': case 'Y': { int imm = X_IMM (insn, *s == 'X' ? 5 : 6); if (imm <= 9) (info->fprintf_func) (stream, "%d", imm); else (info->fprintf_func) (stream, "%#x", (unsigned) imm); } break; case '3': (info->fprintf_func) (stream, "%ld", X_IMM (insn, 3)); break; case 'K': { int mask = X_MEMBAR (insn); int bit = 0x40, printed_one = 0; const char *name; if (mask == 0) (info->fprintf_func) (stream, "0"); else while (bit) { if (mask & bit) { if (printed_one) (info->fprintf_func) (stream, "|"); name = sparc_decode_membar (bit); (info->fprintf_func) (stream, "%s", name); printed_one = 1; } bit >>= 1; } break; } case 'k': info->target = memaddr + SEX (X_DISP16 (insn), 16) * 4; (*info->print_address_func) (info->target, info); break; case 'G': info->target = memaddr + SEX (X_DISP19 (insn), 19) * 4; (*info->print_address_func) (info->target, info); break; case '6': case '7': case '8': case '9': (*info->fprintf_func) (stream, "%%fcc%c", *s - '6' + '0'); break; case 'z': (*info->fprintf_func) (stream, "%%icc"); break; case 'Z': (*info->fprintf_func) (stream, "%%xcc"); break; case 'E': (*info->fprintf_func) (stream, "%%ccr"); break; case 's': (*info->fprintf_func) (stream, "%%fprs"); break; case 'o': (*info->fprintf_func) (stream, "%%asi"); break; case 'W': (*info->fprintf_func) (stream, "%%tick"); break; case 'P': (*info->fprintf_func) (stream, "%%pc"); break; case '?': if (X_RS1 (insn) == 31) (*info->fprintf_func) (stream, "%%ver"); else if ((unsigned) X_RS1 (insn) < 17) (*info->fprintf_func) (stream, "%%%s", v9_priv_reg_names[X_RS1 (insn)]); else (*info->fprintf_func) (stream, "%%reserved"); break; case '!': if ((unsigned) X_RD (insn) < 17) (*info->fprintf_func) (stream, "%%%s", v9_priv_reg_names[X_RD (insn)]); else (*info->fprintf_func) (stream, "%%reserved"); break; case '$': if ((unsigned) X_RS1 (insn) < 32) (*info->fprintf_func) (stream, "%%%s", v9_hpriv_reg_names[X_RS1 (insn)]); else (*info->fprintf_func) (stream, "%%reserved"); break; case '%': if ((unsigned) X_RD (insn) < 32) (*info->fprintf_func) (stream, "%%%s", v9_hpriv_reg_names[X_RD (insn)]); else (*info->fprintf_func) (stream, "%%reserved"); break; case '/': if (X_RS1 (insn) < 16 || X_RS1 (insn) > 25) (*info->fprintf_func) (stream, "%%reserved"); else (*info->fprintf_func) (stream, "%%%s", v9a_asr_reg_names[X_RS1 (insn)-16]); break; case '_': if (X_RD (insn) < 16 || X_RD (insn) > 25) (*info->fprintf_func) (stream, "%%reserved"); else (*info->fprintf_func) (stream, "%%%s", v9a_asr_reg_names[X_RD (insn)-16]); break; case '*': { const char *name = sparc_decode_prefetch (X_RD (insn)); if (name) (*info->fprintf_func) (stream, "%s", name); else (*info->fprintf_func) (stream, "%ld", X_RD (insn)); break; } case 'M': (*info->fprintf_func) (stream, "%%asr%ld", X_RS1 (insn)); break; case 'm': (*info->fprintf_func) (stream, "%%asr%ld", X_RD (insn)); break; case 'L': info->target = memaddr + SEX (X_DISP30 (insn), 30) * 4; (*info->print_address_func) (info->target, info); break; case 'n': (*info->fprintf_func) (stream, "%#x", SEX (X_DISP22 (insn), 22)); break; case 'l': info->target = memaddr + SEX (X_DISP22 (insn), 22) * 4; (*info->print_address_func) (info->target, info); break; case 'A': { const char *name; if ((info->mach == bfd_mach_sparc_v8plusa) || ((info->mach >= bfd_mach_sparc_v9) && (info->mach <= bfd_mach_sparc_v9b))) name = sparc_decode_asi_v9 (X_ASI (insn)); else name = sparc_decode_asi_v8 (X_ASI (insn)); if (name) (*info->fprintf_func) (stream, "%s", name); else (*info->fprintf_func) (stream, "(%ld)", X_ASI (insn)); break; } case 'C': (*info->fprintf_func) (stream, "%%csr"); break; case 'F': (*info->fprintf_func) (stream, "%%fsr"); break; case 'p': (*info->fprintf_func) (stream, "%%psr"); break; case 'q': (*info->fprintf_func) (stream, "%%fq"); break; case 'Q': (*info->fprintf_func) (stream, "%%cq"); break; case 't': (*info->fprintf_func) (stream, "%%tbr"); break; case 'w': (*info->fprintf_func) (stream, "%%wim"); break; case 'x': (*info->fprintf_func) (stream, "%ld", ((X_LDST_I (insn) << 8) + X_ASI (insn))); break; case 'y': (*info->fprintf_func) (stream, "%%y"); break; case 'u': case 'U': { int val = *s == 'U' ? X_RS1 (insn) : X_RD (insn); const char *name = sparc_decode_sparclet_cpreg (val); if (name) (*info->fprintf_func) (stream, "%s", name); else (*info->fprintf_func) (stream, "%%cpreg(%d)", val); break; } } } } if (imm_ored_to_rs1 || imm_added_to_rs1) { unsigned long prev_insn; int errcode; if (memaddr >= 4) errcode = (*info->read_memory_func) (memaddr - 4, buffer, sizeof (buffer), info); else errcode = 1; prev_insn = getword (buffer); if (errcode == 0) { if (is_delayed_branch (prev_insn)) { if (memaddr >= 8) errcode = (*info->read_memory_func) (memaddr - 8, buffer, sizeof (buffer), info); else errcode = 1; prev_insn = getword (buffer); } } if (errcode == 0) { if ((prev_insn & 0xc1c00000) == 0x01000000 && X_RD (prev_insn) == X_RS1 (insn)) { (*info->fprintf_func) (stream, "\t! "); info->target = ((unsigned) 0xFFFFFFFF & ((int) X_IMM22 (prev_insn) << 10)); if (imm_added_to_rs1) info->target += X_SIMM (insn, 13); else info->target |= X_SIMM (insn, 13); (*info->print_address_func) (info->target, info); info->insn_type = dis_dref; info->data_size = 4; } } } if (opcode->flags & (F_UNBR|F_CONDBR|F_JSR)) { if (opcode->flags & F_UNBR) info->insn_type = dis_branch; if (opcode->flags & F_CONDBR) info->insn_type = dis_condbranch; if (opcode->flags & F_JSR) info->insn_type = dis_jsr; if (opcode->flags & F_DELAYED) info->branch_delay_insns = 1; } return sizeof (buffer); } } info->insn_type = dis_noninsn; (*info->fprintf_func) (stream, _("unknown")); return sizeof (buffer); }
{ "code": [], "line_no": [] }
FUNC_0 (bfd_vma VAR_0, disassemble_info *VAR_1) { FILE *stream = VAR_1->stream; bfd_byte buffer[4]; unsigned long VAR_2; sparc_opcode_hash *op; static int VAR_3 = 0; static unsigned long VAR_4 = 0; bfd_vma (*getword) (const unsigned char *); if (!VAR_3 || VAR_1->mach != VAR_4) { int VAR_5; current_arch_mask = compute_arch_mask (VAR_1->mach); if (!VAR_3) sorted_opcodes = malloc (sparc_num_opcodes * sizeof (sparc_opcode *)); for (VAR_5 = 0; VAR_5 < sparc_num_opcodes; ++VAR_5) sorted_opcodes[VAR_5] = &sparc_opcodes[VAR_5]; qsort ((char *) sorted_opcodes, sparc_num_opcodes, sizeof (sorted_opcodes[0]), compare_opcodes); build_hash_table (sorted_opcodes, opcode_hash_table, sparc_num_opcodes); VAR_4 = VAR_1->mach; VAR_3 = 1; } { int VAR_6 = (*VAR_1->read_memory_func) (VAR_0, buffer, sizeof (buffer), VAR_1); if (VAR_6 != 0) { (*VAR_1->memory_error_func) (VAR_6, VAR_0, VAR_1); return -1; } } if (VAR_1->endian == BFD_ENDIAN_BIG || VAR_1->mach == bfd_mach_sparc_sparclite) getword = bfd_getb32; else getword = bfd_getl32; VAR_2 = getword (buffer); VAR_1->insn_info_valid = 1; VAR_1->insn_type = dis_nonbranch; VAR_1->branch_delay_insns = 0; VAR_1->target = 0; for (op = opcode_hash_table[HASH_INSN (VAR_2)]; op; op = op->next) { const sparc_opcode *opcode = op->opcode; if (! (opcode->architecture & current_arch_mask)) continue; if ((opcode->match & VAR_2) == opcode->match && (opcode->lose & VAR_2) == 0) { int imm_added_to_rs1 = 0; int imm_ored_to_rs1 = 0; int found_plus = 0; if (opcode->match == 0x80102000) imm_ored_to_rs1 = 1; if (opcode->match == 0x80002000) imm_added_to_rs1 = 1; if (X_RS1 (VAR_2) != X_RD (VAR_2) && strchr (opcode->args, 'r') != NULL) continue; if (X_RS2 (VAR_2) != X_RD (VAR_2) && strchr (opcode->args, 'O') != NULL) continue; (*VAR_1->fprintf_func) (stream, opcode->name); { const char *s; if (opcode->args[0] != ',') (*VAR_1->fprintf_func) (stream, " "); for (s = opcode->args; *s != '\0'; ++s) { while (*s == ',') { (*VAR_1->fprintf_func) (stream, ","); ++s; switch (*s) { case 'a': (*VAR_1->fprintf_func) (stream, "a"); ++s; continue; case 'N': (*VAR_1->fprintf_func) (stream, "pn"); ++s; continue; case 'T': (*VAR_1->fprintf_func) (stream, "pt"); ++s; continue; default: break; } } (*VAR_1->fprintf_func) (stream, " "); switch (*s) { case '+': found_plus = 1; default: (*VAR_1->fprintf_func) (stream, "%c", *s); break; case '#': (*VAR_1->fprintf_func) (stream, "0"); break; #define reg(n) (*VAR_1->fprintf_func) (stream, "%%%s", reg_names[n]) case '1': case 'r': reg (X_RS1 (VAR_2)); break; case '2': case 'O': reg (X_RS2 (VAR_2)); break; case 'd': reg (X_RD (VAR_2)); break; #undef reg #define freg(n) (*VAR_1->fprintf_func) (stream, "%%%s", freg_names[n]) #define fregx(n) (*VAR_1->fprintf_func) (stream, "%%%s", freg_names[((n) & ~1) | (((n) & 1) << 5)]) case 'e': freg (X_RS1 (VAR_2)); break; case 'v': case 'V': fregx (X_RS1 (VAR_2)); break; case 'f': freg (X_RS2 (VAR_2)); break; case 'B': case 'R': fregx (X_RS2 (VAR_2)); break; case 'g': freg (X_RD (VAR_2)); break; case 'H': case 'J': fregx (X_RD (VAR_2)); break; #undef freg #undef fregx #define creg(n) (*VAR_1->fprintf_func) (stream, "%%c%u", (unsigned int) (n)) case 'b': creg (X_RS1 (VAR_2)); break; case 'c': creg (X_RS2 (VAR_2)); break; case 'D': creg (X_RD (VAR_2)); break; #undef creg case 'h': (*VAR_1->fprintf_func) (stream, "%%hi(%#x)", ((unsigned) 0xFFFFFFFF & ((int) X_IMM22 (VAR_2) << 10))); break; case 'VAR_5': case 'I': case 'j': { int imm; if (*s == 'VAR_5') imm = X_SIMM (VAR_2, 13); else if (*s == 'I') imm = X_SIMM (VAR_2, 11); else imm = X_SIMM (VAR_2, 10); if (found_plus) imm_added_to_rs1 = 1; if (imm <= 9) (*VAR_1->fprintf_func) (stream, "%d", imm); else (*VAR_1->fprintf_func) (stream, "%#x", imm); } break; case 'X': case 'Y': { int imm = X_IMM (VAR_2, *s == 'X' ? 5 : 6); if (imm <= 9) (VAR_1->fprintf_func) (stream, "%d", imm); else (VAR_1->fprintf_func) (stream, "%#x", (unsigned) imm); } break; case '3': (VAR_1->fprintf_func) (stream, "%ld", X_IMM (VAR_2, 3)); break; case 'K': { int mask = X_MEMBAR (VAR_2); int bit = 0x40, printed_one = 0; const char *name; if (mask == 0) (VAR_1->fprintf_func) (stream, "0"); else while (bit) { if (mask & bit) { if (printed_one) (VAR_1->fprintf_func) (stream, "|"); name = sparc_decode_membar (bit); (VAR_1->fprintf_func) (stream, "%s", name); printed_one = 1; } bit >>= 1; } break; } case 'k': VAR_1->target = VAR_0 + SEX (X_DISP16 (VAR_2), 16) * 4; (*VAR_1->print_address_func) (VAR_1->target, VAR_1); break; case 'G': VAR_1->target = VAR_0 + SEX (X_DISP19 (VAR_2), 19) * 4; (*VAR_1->print_address_func) (VAR_1->target, VAR_1); break; case '6': case '7': case '8': case '9': (*VAR_1->fprintf_func) (stream, "%%fcc%c", *s - '6' + '0'); break; case 'z': (*VAR_1->fprintf_func) (stream, "%%icc"); break; case 'Z': (*VAR_1->fprintf_func) (stream, "%%xcc"); break; case 'E': (*VAR_1->fprintf_func) (stream, "%%ccr"); break; case 's': (*VAR_1->fprintf_func) (stream, "%%fprs"); break; case 'o': (*VAR_1->fprintf_func) (stream, "%%asi"); break; case 'W': (*VAR_1->fprintf_func) (stream, "%%tick"); break; case 'P': (*VAR_1->fprintf_func) (stream, "%%pc"); break; case '?': if (X_RS1 (VAR_2) == 31) (*VAR_1->fprintf_func) (stream, "%%ver"); else if ((unsigned) X_RS1 (VAR_2) < 17) (*VAR_1->fprintf_func) (stream, "%%%s", v9_priv_reg_names[X_RS1 (VAR_2)]); else (*VAR_1->fprintf_func) (stream, "%%reserved"); break; case '!': if ((unsigned) X_RD (VAR_2) < 17) (*VAR_1->fprintf_func) (stream, "%%%s", v9_priv_reg_names[X_RD (VAR_2)]); else (*VAR_1->fprintf_func) (stream, "%%reserved"); break; case '$': if ((unsigned) X_RS1 (VAR_2) < 32) (*VAR_1->fprintf_func) (stream, "%%%s", v9_hpriv_reg_names[X_RS1 (VAR_2)]); else (*VAR_1->fprintf_func) (stream, "%%reserved"); break; case '%': if ((unsigned) X_RD (VAR_2) < 32) (*VAR_1->fprintf_func) (stream, "%%%s", v9_hpriv_reg_names[X_RD (VAR_2)]); else (*VAR_1->fprintf_func) (stream, "%%reserved"); break; case '/': if (X_RS1 (VAR_2) < 16 || X_RS1 (VAR_2) > 25) (*VAR_1->fprintf_func) (stream, "%%reserved"); else (*VAR_1->fprintf_func) (stream, "%%%s", v9a_asr_reg_names[X_RS1 (VAR_2)-16]); break; case '_': if (X_RD (VAR_2) < 16 || X_RD (VAR_2) > 25) (*VAR_1->fprintf_func) (stream, "%%reserved"); else (*VAR_1->fprintf_func) (stream, "%%%s", v9a_asr_reg_names[X_RD (VAR_2)-16]); break; case '*': { const char *name = sparc_decode_prefetch (X_RD (VAR_2)); if (name) (*VAR_1->fprintf_func) (stream, "%s", name); else (*VAR_1->fprintf_func) (stream, "%ld", X_RD (VAR_2)); break; } case 'M': (*VAR_1->fprintf_func) (stream, "%%asr%ld", X_RS1 (VAR_2)); break; case 'm': (*VAR_1->fprintf_func) (stream, "%%asr%ld", X_RD (VAR_2)); break; case 'L': VAR_1->target = VAR_0 + SEX (X_DISP30 (VAR_2), 30) * 4; (*VAR_1->print_address_func) (VAR_1->target, VAR_1); break; case 'n': (*VAR_1->fprintf_func) (stream, "%#x", SEX (X_DISP22 (VAR_2), 22)); break; case 'l': VAR_1->target = VAR_0 + SEX (X_DISP22 (VAR_2), 22) * 4; (*VAR_1->print_address_func) (VAR_1->target, VAR_1); break; case 'A': { const char *name; if ((VAR_1->mach == bfd_mach_sparc_v8plusa) || ((VAR_1->mach >= bfd_mach_sparc_v9) && (VAR_1->mach <= bfd_mach_sparc_v9b))) name = sparc_decode_asi_v9 (X_ASI (VAR_2)); else name = sparc_decode_asi_v8 (X_ASI (VAR_2)); if (name) (*VAR_1->fprintf_func) (stream, "%s", name); else (*VAR_1->fprintf_func) (stream, "(%ld)", X_ASI (VAR_2)); break; } case 'C': (*VAR_1->fprintf_func) (stream, "%%csr"); break; case 'F': (*VAR_1->fprintf_func) (stream, "%%fsr"); break; case 'p': (*VAR_1->fprintf_func) (stream, "%%psr"); break; case 'q': (*VAR_1->fprintf_func) (stream, "%%fq"); break; case 'Q': (*VAR_1->fprintf_func) (stream, "%%cq"); break; case 't': (*VAR_1->fprintf_func) (stream, "%%tbr"); break; case 'w': (*VAR_1->fprintf_func) (stream, "%%wim"); break; case 'x': (*VAR_1->fprintf_func) (stream, "%ld", ((X_LDST_I (VAR_2) << 8) + X_ASI (VAR_2))); break; case 'y': (*VAR_1->fprintf_func) (stream, "%%y"); break; case 'u': case 'U': { int val = *s == 'U' ? X_RS1 (VAR_2) : X_RD (VAR_2); const char *name = sparc_decode_sparclet_cpreg (val); if (name) (*VAR_1->fprintf_func) (stream, "%s", name); else (*VAR_1->fprintf_func) (stream, "%%cpreg(%d)", val); break; } } } } if (imm_ored_to_rs1 || imm_added_to_rs1) { unsigned long prev_insn; int errcode; if (VAR_0 >= 4) errcode = (*VAR_1->read_memory_func) (VAR_0 - 4, buffer, sizeof (buffer), VAR_1); else errcode = 1; prev_insn = getword (buffer); if (errcode == 0) { if (is_delayed_branch (prev_insn)) { if (VAR_0 >= 8) errcode = (*VAR_1->read_memory_func) (VAR_0 - 8, buffer, sizeof (buffer), VAR_1); else errcode = 1; prev_insn = getword (buffer); } } if (errcode == 0) { if ((prev_insn & 0xc1c00000) == 0x01000000 && X_RD (prev_insn) == X_RS1 (VAR_2)) { (*VAR_1->fprintf_func) (stream, "\t! "); VAR_1->target = ((unsigned) 0xFFFFFFFF & ((int) X_IMM22 (prev_insn) << 10)); if (imm_added_to_rs1) VAR_1->target += X_SIMM (VAR_2, 13); else VAR_1->target |= X_SIMM (VAR_2, 13); (*VAR_1->print_address_func) (VAR_1->target, VAR_1); VAR_1->insn_type = dis_dref; VAR_1->data_size = 4; } } } if (opcode->flags & (F_UNBR|F_CONDBR|F_JSR)) { if (opcode->flags & F_UNBR) VAR_1->insn_type = dis_branch; if (opcode->flags & F_CONDBR) VAR_1->insn_type = dis_condbranch; if (opcode->flags & F_JSR) VAR_1->insn_type = dis_jsr; if (opcode->flags & F_DELAYED) VAR_1->branch_delay_insns = 1; } return sizeof (buffer); } } VAR_1->insn_type = dis_noninsn; (*VAR_1->fprintf_func) (stream, _("unknown")); return sizeof (buffer); }
[ "FUNC_0 (bfd_vma VAR_0, disassemble_info *VAR_1)\n{", "FILE *stream = VAR_1->stream;", "bfd_byte buffer[4];", "unsigned long VAR_2;", "sparc_opcode_hash *op;", "static int VAR_3 = 0;", "static unsigned long VAR_4 = 0;", "bfd_vma (*getword) (const unsigned char *);", "if (!VAR_3\n|| VAR_1->mach != VAR_4)\n{", "int VAR_5;", "current_arch_mask = compute_arch_mask (VAR_1->mach);", "if (!VAR_3)\nsorted_opcodes =\nmalloc (sparc_num_opcodes * sizeof (sparc_opcode *));", "for (VAR_5 = 0; VAR_5 < sparc_num_opcodes; ++VAR_5)", "sorted_opcodes[VAR_5] = &sparc_opcodes[VAR_5];", "qsort ((char *) sorted_opcodes, sparc_num_opcodes,\nsizeof (sorted_opcodes[0]), compare_opcodes);", "build_hash_table (sorted_opcodes, opcode_hash_table, sparc_num_opcodes);", "VAR_4 = VAR_1->mach;", "VAR_3 = 1;", "}", "{", "int VAR_6 =\n(*VAR_1->read_memory_func) (VAR_0, buffer, sizeof (buffer), VAR_1);", "if (VAR_6 != 0)\n{", "(*VAR_1->memory_error_func) (VAR_6, VAR_0, VAR_1);", "return -1;", "}", "}", "if (VAR_1->endian == BFD_ENDIAN_BIG || VAR_1->mach == bfd_mach_sparc_sparclite)\ngetword = bfd_getb32;", "else\ngetword = bfd_getl32;", "VAR_2 = getword (buffer);", "VAR_1->insn_info_valid = 1;", "VAR_1->insn_type = dis_nonbranch;", "VAR_1->branch_delay_insns = 0;", "VAR_1->target = 0;", "for (op = opcode_hash_table[HASH_INSN (VAR_2)]; op; op = op->next)", "{", "const sparc_opcode *opcode = op->opcode;", "if (! (opcode->architecture & current_arch_mask))\ncontinue;", "if ((opcode->match & VAR_2) == opcode->match\n&& (opcode->lose & VAR_2) == 0)\n{", "int imm_added_to_rs1 = 0;", "int imm_ored_to_rs1 = 0;", "int found_plus = 0;", "if (opcode->match == 0x80102000)\nimm_ored_to_rs1 = 1;", "if (opcode->match == 0x80002000)\nimm_added_to_rs1 = 1;", "if (X_RS1 (VAR_2) != X_RD (VAR_2)\n&& strchr (opcode->args, 'r') != NULL)\ncontinue;", "if (X_RS2 (VAR_2) != X_RD (VAR_2)\n&& strchr (opcode->args, 'O') != NULL)\ncontinue;", "(*VAR_1->fprintf_func) (stream, opcode->name);", "{", "const char *s;", "if (opcode->args[0] != ',')\n(*VAR_1->fprintf_func) (stream, \" \");", "for (s = opcode->args; *s != '\\0'; ++s)", "{", "while (*s == ',')\n{", "(*VAR_1->fprintf_func) (stream, \",\");", "++s;", "switch (*s)\n{", "case 'a':\n(*VAR_1->fprintf_func) (stream, \"a\");", "++s;", "continue;", "case 'N':\n(*VAR_1->fprintf_func) (stream, \"pn\");", "++s;", "continue;", "case 'T':\n(*VAR_1->fprintf_func) (stream, \"pt\");", "++s;", "continue;", "default:\nbreak;", "}", "}", "(*VAR_1->fprintf_func) (stream, \" \");", "switch (*s)\n{", "case '+':\nfound_plus = 1;", "default:\n(*VAR_1->fprintf_func) (stream, \"%c\", *s);", "break;", "case '#':\n(*VAR_1->fprintf_func) (stream, \"0\");", "break;", "#define reg(n) (*VAR_1->fprintf_func) (stream, \"%%%s\", reg_names[n])\ncase '1':\ncase 'r':\nreg (X_RS1 (VAR_2));", "break;", "case '2':\ncase 'O':\nreg (X_RS2 (VAR_2));", "break;", "case 'd':\nreg (X_RD (VAR_2));", "break;", "#undef reg\n#define freg(n) (*VAR_1->fprintf_func) (stream, \"%%%s\", freg_names[n])\n#define fregx(n) (*VAR_1->fprintf_func) (stream, \"%%%s\", freg_names[((n) & ~1) | (((n) & 1) << 5)])\ncase 'e':\nfreg (X_RS1 (VAR_2));", "break;", "case 'v':\ncase 'V':\nfregx (X_RS1 (VAR_2));", "break;", "case 'f':\nfreg (X_RS2 (VAR_2));", "break;", "case 'B':\ncase 'R':\nfregx (X_RS2 (VAR_2));", "break;", "case 'g':\nfreg (X_RD (VAR_2));", "break;", "case 'H':\ncase 'J':\nfregx (X_RD (VAR_2));", "break;", "#undef freg\n#undef fregx\n#define creg(n) (*VAR_1->fprintf_func) (stream, \"%%c%u\", (unsigned int) (n))\ncase 'b':\ncreg (X_RS1 (VAR_2));", "break;", "case 'c':\ncreg (X_RS2 (VAR_2));", "break;", "case 'D':\ncreg (X_RD (VAR_2));", "break;", "#undef creg\ncase 'h':\n(*VAR_1->fprintf_func) (stream, \"%%hi(%#x)\",\n((unsigned) 0xFFFFFFFF\n& ((int) X_IMM22 (VAR_2) << 10)));", "break;", "case 'VAR_5':\ncase 'I':\ncase 'j':\n{", "int imm;", "if (*s == 'VAR_5')\nimm = X_SIMM (VAR_2, 13);", "else if (*s == 'I')\nimm = X_SIMM (VAR_2, 11);", "else\nimm = X_SIMM (VAR_2, 10);", "if (found_plus)\nimm_added_to_rs1 = 1;", "if (imm <= 9)\n(*VAR_1->fprintf_func) (stream, \"%d\", imm);", "else\n(*VAR_1->fprintf_func) (stream, \"%#x\", imm);", "}", "break;", "case 'X':\ncase 'Y':\n{", "int imm = X_IMM (VAR_2, *s == 'X' ? 5 : 6);", "if (imm <= 9)\n(VAR_1->fprintf_func) (stream, \"%d\", imm);", "else\n(VAR_1->fprintf_func) (stream, \"%#x\", (unsigned) imm);", "}", "break;", "case '3':\n(VAR_1->fprintf_func) (stream, \"%ld\", X_IMM (VAR_2, 3));", "break;", "case 'K':\n{", "int mask = X_MEMBAR (VAR_2);", "int bit = 0x40, printed_one = 0;", "const char *name;", "if (mask == 0)\n(VAR_1->fprintf_func) (stream, \"0\");", "else\nwhile (bit)\n{", "if (mask & bit)\n{", "if (printed_one)\n(VAR_1->fprintf_func) (stream, \"|\");", "name = sparc_decode_membar (bit);", "(VAR_1->fprintf_func) (stream, \"%s\", name);", "printed_one = 1;", "}", "bit >>= 1;", "}", "break;", "}", "case 'k':\nVAR_1->target = VAR_0 + SEX (X_DISP16 (VAR_2), 16) * 4;", "(*VAR_1->print_address_func) (VAR_1->target, VAR_1);", "break;", "case 'G':\nVAR_1->target = VAR_0 + SEX (X_DISP19 (VAR_2), 19) * 4;", "(*VAR_1->print_address_func) (VAR_1->target, VAR_1);", "break;", "case '6':\ncase '7':\ncase '8':\ncase '9':\n(*VAR_1->fprintf_func) (stream, \"%%fcc%c\", *s - '6' + '0');", "break;", "case 'z':\n(*VAR_1->fprintf_func) (stream, \"%%icc\");", "break;", "case 'Z':\n(*VAR_1->fprintf_func) (stream, \"%%xcc\");", "break;", "case 'E':\n(*VAR_1->fprintf_func) (stream, \"%%ccr\");", "break;", "case 's':\n(*VAR_1->fprintf_func) (stream, \"%%fprs\");", "break;", "case 'o':\n(*VAR_1->fprintf_func) (stream, \"%%asi\");", "break;", "case 'W':\n(*VAR_1->fprintf_func) (stream, \"%%tick\");", "break;", "case 'P':\n(*VAR_1->fprintf_func) (stream, \"%%pc\");", "break;", "case '?':\nif (X_RS1 (VAR_2) == 31)\n(*VAR_1->fprintf_func) (stream, \"%%ver\");", "else if ((unsigned) X_RS1 (VAR_2) < 17)\n(*VAR_1->fprintf_func) (stream, \"%%%s\",\nv9_priv_reg_names[X_RS1 (VAR_2)]);", "else\n(*VAR_1->fprintf_func) (stream, \"%%reserved\");", "break;", "case '!':\nif ((unsigned) X_RD (VAR_2) < 17)\n(*VAR_1->fprintf_func) (stream, \"%%%s\",\nv9_priv_reg_names[X_RD (VAR_2)]);", "else\n(*VAR_1->fprintf_func) (stream, \"%%reserved\");", "break;", "case '$':\nif ((unsigned) X_RS1 (VAR_2) < 32)\n(*VAR_1->fprintf_func) (stream, \"%%%s\",\nv9_hpriv_reg_names[X_RS1 (VAR_2)]);", "else\n(*VAR_1->fprintf_func) (stream, \"%%reserved\");", "break;", "case '%':\nif ((unsigned) X_RD (VAR_2) < 32)\n(*VAR_1->fprintf_func) (stream, \"%%%s\",\nv9_hpriv_reg_names[X_RD (VAR_2)]);", "else\n(*VAR_1->fprintf_func) (stream, \"%%reserved\");", "break;", "case '/':\nif (X_RS1 (VAR_2) < 16 || X_RS1 (VAR_2) > 25)\n(*VAR_1->fprintf_func) (stream, \"%%reserved\");", "else\n(*VAR_1->fprintf_func) (stream, \"%%%s\",\nv9a_asr_reg_names[X_RS1 (VAR_2)-16]);", "break;", "case '_':\nif (X_RD (VAR_2) < 16 || X_RD (VAR_2) > 25)\n(*VAR_1->fprintf_func) (stream, \"%%reserved\");", "else\n(*VAR_1->fprintf_func) (stream, \"%%%s\",\nv9a_asr_reg_names[X_RD (VAR_2)-16]);", "break;", "case '*':\n{", "const char *name = sparc_decode_prefetch (X_RD (VAR_2));", "if (name)\n(*VAR_1->fprintf_func) (stream, \"%s\", name);", "else\n(*VAR_1->fprintf_func) (stream, \"%ld\", X_RD (VAR_2));", "break;", "}", "case 'M':\n(*VAR_1->fprintf_func) (stream, \"%%asr%ld\", X_RS1 (VAR_2));", "break;", "case 'm':\n(*VAR_1->fprintf_func) (stream, \"%%asr%ld\", X_RD (VAR_2));", "break;", "case 'L':\nVAR_1->target = VAR_0 + SEX (X_DISP30 (VAR_2), 30) * 4;", "(*VAR_1->print_address_func) (VAR_1->target, VAR_1);", "break;", "case 'n':\n(*VAR_1->fprintf_func)\n(stream, \"%#x\", SEX (X_DISP22 (VAR_2), 22));", "break;", "case 'l':\nVAR_1->target = VAR_0 + SEX (X_DISP22 (VAR_2), 22) * 4;", "(*VAR_1->print_address_func) (VAR_1->target, VAR_1);", "break;", "case 'A':\n{", "const char *name;", "if ((VAR_1->mach == bfd_mach_sparc_v8plusa) ||\n((VAR_1->mach >= bfd_mach_sparc_v9) &&\n(VAR_1->mach <= bfd_mach_sparc_v9b)))\nname = sparc_decode_asi_v9 (X_ASI (VAR_2));", "else\nname = sparc_decode_asi_v8 (X_ASI (VAR_2));", "if (name)\n(*VAR_1->fprintf_func) (stream, \"%s\", name);", "else\n(*VAR_1->fprintf_func) (stream, \"(%ld)\", X_ASI (VAR_2));", "break;", "}", "case 'C':\n(*VAR_1->fprintf_func) (stream, \"%%csr\");", "break;", "case 'F':\n(*VAR_1->fprintf_func) (stream, \"%%fsr\");", "break;", "case 'p':\n(*VAR_1->fprintf_func) (stream, \"%%psr\");", "break;", "case 'q':\n(*VAR_1->fprintf_func) (stream, \"%%fq\");", "break;", "case 'Q':\n(*VAR_1->fprintf_func) (stream, \"%%cq\");", "break;", "case 't':\n(*VAR_1->fprintf_func) (stream, \"%%tbr\");", "break;", "case 'w':\n(*VAR_1->fprintf_func) (stream, \"%%wim\");", "break;", "case 'x':\n(*VAR_1->fprintf_func) (stream, \"%ld\",\n((X_LDST_I (VAR_2) << 8)\n+ X_ASI (VAR_2)));", "break;", "case 'y':\n(*VAR_1->fprintf_func) (stream, \"%%y\");", "break;", "case 'u':\ncase 'U':\n{", "int val = *s == 'U' ? X_RS1 (VAR_2) : X_RD (VAR_2);", "const char *name = sparc_decode_sparclet_cpreg (val);", "if (name)\n(*VAR_1->fprintf_func) (stream, \"%s\", name);", "else\n(*VAR_1->fprintf_func) (stream, \"%%cpreg(%d)\", val);", "break;", "}", "}", "}", "}", "if (imm_ored_to_rs1 || imm_added_to_rs1)\n{", "unsigned long prev_insn;", "int errcode;", "if (VAR_0 >= 4)\nerrcode =\n(*VAR_1->read_memory_func)\n(VAR_0 - 4, buffer, sizeof (buffer), VAR_1);", "else\nerrcode = 1;", "prev_insn = getword (buffer);", "if (errcode == 0)\n{", "if (is_delayed_branch (prev_insn))\n{", "if (VAR_0 >= 8)\nerrcode = (*VAR_1->read_memory_func)\n(VAR_0 - 8, buffer, sizeof (buffer), VAR_1);", "else\nerrcode = 1;", "prev_insn = getword (buffer);", "}", "}", "if (errcode == 0)\n{", "if ((prev_insn & 0xc1c00000) == 0x01000000\n&& X_RD (prev_insn) == X_RS1 (VAR_2))\n{", "(*VAR_1->fprintf_func) (stream, \"\\t! \");", "VAR_1->target =\n((unsigned) 0xFFFFFFFF\n& ((int) X_IMM22 (prev_insn) << 10));", "if (imm_added_to_rs1)\nVAR_1->target += X_SIMM (VAR_2, 13);", "else\nVAR_1->target |= X_SIMM (VAR_2, 13);", "(*VAR_1->print_address_func) (VAR_1->target, VAR_1);", "VAR_1->insn_type = dis_dref;", "VAR_1->data_size = 4;", "}", "}", "}", "if (opcode->flags & (F_UNBR|F_CONDBR|F_JSR))\n{", "if (opcode->flags & F_UNBR)\nVAR_1->insn_type = dis_branch;", "if (opcode->flags & F_CONDBR)\nVAR_1->insn_type = dis_condbranch;", "if (opcode->flags & F_JSR)\nVAR_1->insn_type = dis_jsr;", "if (opcode->flags & F_DELAYED)\nVAR_1->branch_delay_insns = 1;", "}", "return sizeof (buffer);", "}", "}", "VAR_1->insn_type = dis_noninsn;", "(*VAR_1->fprintf_func) (stream, _(\"unknown\"));", "return sizeof (buffer);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 19 ], [ 21 ], [ 25, 27, 29 ], [ 31 ], [ 35 ], [ 39, 41, 43 ], [ 47 ], [ 49 ], [ 51, 53 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 67 ], [ 69, 71 ], [ 75, 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 93, 95 ], [ 97, 99 ], [ 103 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 117 ], [ 119 ], [ 121 ], [ 127, 129 ], [ 133, 135, 137 ], [ 143 ], [ 145 ], [ 153 ], [ 167, 169 ], [ 171, 173 ], [ 177, 179, 183 ], [ 185, 187, 191 ], [ 195 ], [ 199 ], [ 201 ], [ 205, 207 ], [ 211 ], [ 213 ], [ 215, 217 ], [ 219 ], [ 221 ], [ 223, 225 ], [ 227, 229 ], [ 233 ], [ 235 ], [ 237, 239 ], [ 241 ], [ 243 ], [ 247, 249 ], [ 251 ], [ 253 ], [ 257, 259 ], [ 261 ], [ 263 ], [ 267 ], [ 271, 273 ], [ 275, 277 ], [ 283, 285 ], [ 287 ], [ 291, 293 ], [ 295 ], [ 299, 301, 303, 305 ], [ 307 ], [ 311, 313, 315 ], [ 317 ], [ 321, 323 ], [ 325 ], [ 327, 331, 333, 335, 337 ], [ 339 ], [ 341, 343, 345 ], [ 347 ], [ 351, 353 ], [ 355 ], [ 357, 359, 361 ], [ 363 ], [ 367, 369 ], [ 371 ], [ 373, 375, 377 ], [ 379 ], [ 381, 383, 387, 389, 391 ], [ 393 ], [ 397, 399 ], [ 401 ], [ 405, 407 ], [ 409 ], [ 411, 415, 417, 419, 421 ], [ 423 ], [ 427, 429, 431, 433 ], [ 435 ], [ 439, 441 ], [ 443, 445 ], [ 447, 449 ], [ 467, 469 ], [ 473, 475 ], [ 477, 479 ], [ 481 ], [ 483 ], [ 487, 489, 491 ], [ 493 ], [ 497, 499 ], [ 501, 503 ], [ 505 ], [ 507 ], [ 511, 513 ], [ 515 ], [ 519, 521 ], [ 523 ], [ 525 ], [ 527 ], [ 531, 533 ], [ 535, 537, 539 ], [ 541, 543 ], [ 545, 547 ], [ 549 ], [ 551 ], [ 553 ], [ 555 ], [ 557 ], [ 559 ], [ 561 ], [ 563 ], [ 567, 569 ], [ 571 ], [ 573 ], [ 577, 579 ], [ 581 ], [ 583 ], [ 587, 589, 591, 593, 595 ], [ 597 ], [ 601, 603 ], [ 605 ], [ 609, 611 ], [ 613 ], [ 617, 619 ], [ 621 ], [ 625, 627 ], [ 629 ], [ 633, 635 ], [ 637 ], [ 641, 643 ], [ 645 ], [ 649, 651 ], [ 653 ], [ 657, 659, 661 ], [ 663, 665, 667 ], [ 669, 671 ], [ 673 ], [ 677, 679, 681, 683 ], [ 685, 687 ], [ 689 ], [ 693, 695, 697, 699 ], [ 701, 703 ], [ 705 ], [ 709, 711, 713, 715 ], [ 717, 719 ], [ 721 ], [ 725, 727, 729 ], [ 731, 733, 735 ], [ 737 ], [ 741, 743, 745 ], [ 747, 749, 751 ], [ 753 ], [ 757, 759 ], [ 761 ], [ 765, 767 ], [ 769, 771 ], [ 773 ], [ 775 ], [ 779, 781 ], [ 783 ], [ 787, 789 ], [ 791 ], [ 795, 797 ], [ 799 ], [ 801 ], [ 805, 807, 809 ], [ 811 ], [ 815, 817 ], [ 819 ], [ 821 ], [ 825, 827 ], [ 829 ], [ 833, 835, 837, 839 ], [ 841, 843 ], [ 847, 849 ], [ 851, 853 ], [ 855 ], [ 857 ], [ 861, 863 ], [ 865 ], [ 869, 871 ], [ 873 ], [ 877, 879 ], [ 881 ], [ 885, 887 ], [ 889 ], [ 893, 895 ], [ 897 ], [ 901, 903 ], [ 905 ], [ 909, 911 ], [ 913 ], [ 917, 919, 921, 923 ], [ 925 ], [ 929, 931 ], [ 933 ], [ 937, 939, 941 ], [ 943 ], [ 945 ], [ 949, 951 ], [ 953, 955 ], [ 957 ], [ 959 ], [ 961 ], [ 963 ], [ 965 ], [ 981, 983 ], [ 985 ], [ 987 ], [ 991, 993, 995, 997 ], [ 999, 1001 ], [ 1005 ], [ 1009, 1011 ], [ 1029, 1031 ], [ 1033, 1035, 1037 ], [ 1039, 1041 ], [ 1045 ], [ 1047 ], [ 1049 ], [ 1057, 1059 ], [ 1063, 1065, 1067 ], [ 1069 ], [ 1071, 1073, 1075 ], [ 1077, 1079 ], [ 1081, 1083 ], [ 1085 ], [ 1087 ], [ 1089 ], [ 1091 ], [ 1093 ], [ 1095 ], [ 1099, 1101 ], [ 1105, 1107 ], [ 1109, 1111 ], [ 1113, 1115 ], [ 1117, 1119 ], [ 1121 ], [ 1125 ], [ 1127 ], [ 1129 ], [ 1133 ], [ 1135 ], [ 1137 ], [ 1139 ] ]
20,059
static int max7310_tx(I2CSlave *i2c, uint8_t data) { MAX7310State *s = MAX7310(i2c); uint8_t diff; int line; if (s->len ++ > 1) { #ifdef VERBOSE printf("%s: message too long (%i bytes)\n", __FUNCTION__, s->len); #endif return 1; } if (s->i2c_command_byte) { s->command = data; s->i2c_command_byte = 0; return 0; } switch (s->command) { case 0x01: /* Output port */ for (diff = (data ^ s->level) & ~s->direction; diff; diff &= ~(1 << line)) { line = ffs(diff) - 1; if (s->handler[line]) qemu_set_irq(s->handler[line], (data >> line) & 1); } s->level = (s->level & s->direction) | (data & ~s->direction); break; case 0x02: /* Polarity inversion */ s->polarity = data; break; case 0x03: /* Configuration */ s->level &= ~(s->direction ^ data); s->direction = data; break; case 0x04: /* Timeout */ s->status = data; break; case 0x00: /* Input port - ignore writes */ break; default: #ifdef VERBOSE printf("%s: unknown register %02x\n", __FUNCTION__, s->command); #endif return 1; } return 0; }
false
qemu
786a4ea82ec9c87e3a895cf41081029b285a5fe5
static int max7310_tx(I2CSlave *i2c, uint8_t data) { MAX7310State *s = MAX7310(i2c); uint8_t diff; int line; if (s->len ++ > 1) { #ifdef VERBOSE printf("%s: message too long (%i bytes)\n", __FUNCTION__, s->len); #endif return 1; } if (s->i2c_command_byte) { s->command = data; s->i2c_command_byte = 0; return 0; } switch (s->command) { case 0x01: for (diff = (data ^ s->level) & ~s->direction; diff; diff &= ~(1 << line)) { line = ffs(diff) - 1; if (s->handler[line]) qemu_set_irq(s->handler[line], (data >> line) & 1); } s->level = (s->level & s->direction) | (data & ~s->direction); break; case 0x02: s->polarity = data; break; case 0x03: s->level &= ~(s->direction ^ data); s->direction = data; break; case 0x04: s->status = data; break; case 0x00: break; default: #ifdef VERBOSE printf("%s: unknown register %02x\n", __FUNCTION__, s->command); #endif return 1; } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(I2CSlave *VAR_0, uint8_t VAR_1) { MAX7310State *s = MAX7310(VAR_0); uint8_t diff; int VAR_2; if (s->len ++ > 1) { #ifdef VERBOSE printf("%s: message too long (%i bytes)\n", __FUNCTION__, s->len); #endif return 1; } if (s->i2c_command_byte) { s->command = VAR_1; s->i2c_command_byte = 0; return 0; } switch (s->command) { case 0x01: for (diff = (VAR_1 ^ s->level) & ~s->direction; diff; diff &= ~(1 << VAR_2)) { VAR_2 = ffs(diff) - 1; if (s->handler[VAR_2]) qemu_set_irq(s->handler[VAR_2], (VAR_1 >> VAR_2) & 1); } s->level = (s->level & s->direction) | (VAR_1 & ~s->direction); break; case 0x02: s->polarity = VAR_1; break; case 0x03: s->level &= ~(s->direction ^ VAR_1); s->direction = VAR_1; break; case 0x04: s->status = VAR_1; break; case 0x00: break; default: #ifdef VERBOSE printf("%s: unknown register %02x\n", __FUNCTION__, s->command); #endif return 1; } return 0; }
[ "static int FUNC_0(I2CSlave *VAR_0, uint8_t VAR_1)\n{", "MAX7310State *s = MAX7310(VAR_0);", "uint8_t diff;", "int VAR_2;", "if (s->len ++ > 1) {", "#ifdef VERBOSE\nprintf(\"%s: message too long (%i bytes)\\n\", __FUNCTION__, s->len);", "#endif\nreturn 1;", "}", "if (s->i2c_command_byte) {", "s->command = VAR_1;", "s->i2c_command_byte = 0;", "return 0;", "}", "switch (s->command) {", "case 0x01:\nfor (diff = (VAR_1 ^ s->level) & ~s->direction; diff;", "diff &= ~(1 << VAR_2)) {", "VAR_2 = ffs(diff) - 1;", "if (s->handler[VAR_2])\nqemu_set_irq(s->handler[VAR_2], (VAR_1 >> VAR_2) & 1);", "}", "s->level = (s->level & s->direction) | (VAR_1 & ~s->direction);", "break;", "case 0x02:\ns->polarity = VAR_1;", "break;", "case 0x03:\ns->level &= ~(s->direction ^ VAR_1);", "s->direction = VAR_1;", "break;", "case 0x04:\ns->status = VAR_1;", "break;", "case 0x00:\nbreak;", "default:\n#ifdef VERBOSE\nprintf(\"%s: unknown register %02x\\n\", __FUNCTION__, s->command);", "#endif\nreturn 1;", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15, 17 ], [ 19, 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41, 43 ], [ 45 ], [ 47 ], [ 49, 51 ], [ 53 ], [ 55 ], [ 57 ], [ 61, 63 ], [ 65 ], [ 69, 71 ], [ 73 ], [ 75 ], [ 79, 81 ], [ 83 ], [ 87, 89 ], [ 91, 93, 95 ], [ 97, 99 ], [ 101 ], [ 105 ], [ 107 ] ]
20,061
BlockInterfaceErrorAction drive_get_onerror(BlockDriverState *bdrv) { DriveInfo *dinfo; TAILQ_FOREACH(dinfo, &drives, next) { if (dinfo->bdrv == bdrv) return dinfo->onerror; } return BLOCK_ERR_STOP_ENOSPC; }
false
qemu
72cf2d4f0e181d0d3a3122e04129c58a95da713e
BlockInterfaceErrorAction drive_get_onerror(BlockDriverState *bdrv) { DriveInfo *dinfo; TAILQ_FOREACH(dinfo, &drives, next) { if (dinfo->bdrv == bdrv) return dinfo->onerror; } return BLOCK_ERR_STOP_ENOSPC; }
{ "code": [], "line_no": [] }
BlockInterfaceErrorAction FUNC_0(BlockDriverState *bdrv) { DriveInfo *dinfo; TAILQ_FOREACH(dinfo, &drives, next) { if (dinfo->bdrv == bdrv) return dinfo->onerror; } return BLOCK_ERR_STOP_ENOSPC; }
[ "BlockInterfaceErrorAction FUNC_0(BlockDriverState *bdrv)\n{", "DriveInfo *dinfo;", "TAILQ_FOREACH(dinfo, &drives, next) {", "if (dinfo->bdrv == bdrv)\nreturn dinfo->onerror;", "}", "return BLOCK_ERR_STOP_ENOSPC;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11, 13 ], [ 15 ], [ 19 ], [ 21 ] ]
20,062
static inline void tcg_out_movi_imm32(TCGContext *s, int ret, uint32_t arg) { if (check_fit_tl(arg, 12)) tcg_out_movi_imm13(s, ret, arg); else { tcg_out_sethi(s, ret, arg); if (arg & 0x3ff) tcg_out_arithi(s, ret, ret, arg & 0x3ff, ARITH_OR); } }
false
qemu
4a09aa895e7cd82192e47ede9cde8ab7da4a96ba
static inline void tcg_out_movi_imm32(TCGContext *s, int ret, uint32_t arg) { if (check_fit_tl(arg, 12)) tcg_out_movi_imm13(s, ret, arg); else { tcg_out_sethi(s, ret, arg); if (arg & 0x3ff) tcg_out_arithi(s, ret, ret, arg & 0x3ff, ARITH_OR); } }
{ "code": [], "line_no": [] }
static inline void FUNC_0(TCGContext *VAR_0, int VAR_1, uint32_t VAR_2) { if (check_fit_tl(VAR_2, 12)) tcg_out_movi_imm13(VAR_0, VAR_1, VAR_2); else { tcg_out_sethi(VAR_0, VAR_1, VAR_2); if (VAR_2 & 0x3ff) tcg_out_arithi(VAR_0, VAR_1, VAR_1, VAR_2 & 0x3ff, ARITH_OR); } }
[ "static inline void FUNC_0(TCGContext *VAR_0, int VAR_1, uint32_t VAR_2)\n{", "if (check_fit_tl(VAR_2, 12))\ntcg_out_movi_imm13(VAR_0, VAR_1, VAR_2);", "else {", "tcg_out_sethi(VAR_0, VAR_1, VAR_2);", "if (VAR_2 & 0x3ff)\ntcg_out_arithi(VAR_0, VAR_1, VAR_1, VAR_2 & 0x3ff, ARITH_OR);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5, 7 ], [ 9 ], [ 11 ], [ 13, 15 ], [ 17 ], [ 19 ] ]
20,063
static void pcie_aer_msg(PCIDevice *dev, const PCIEAERMsg *msg) { uint8_t type; while (dev) { if (!pci_is_express(dev)) { /* just ignore it */ /* TODO: Shouldn't we set PCI_STATUS_SIG_SYSTEM_ERROR? * Consider e.g. a PCI bridge above a PCI Express device. */ return; } type = pcie_cap_get_type(dev); if ((type == PCI_EXP_TYPE_ROOT_PORT || type == PCI_EXP_TYPE_UPSTREAM || type == PCI_EXP_TYPE_DOWNSTREAM) && !pcie_aer_msg_vbridge(dev, msg)) { return; } if (!pcie_aer_msg_alldev(dev, msg)) { return; } if (type == PCI_EXP_TYPE_ROOT_PORT) { pcie_aer_msg_root_port(dev, msg); /* Root port can notify system itself, or send the error message to root complex event collector. */ /* * if root port is associated with an event collector, * return the root complex event collector here. * For now root complex event collector isn't supported. */ return; } dev = pci_bridge_get_device(dev->bus); } }
false
qemu
40f8f0c31b6009e802175463c97f3b9e6f7c5d0f
static void pcie_aer_msg(PCIDevice *dev, const PCIEAERMsg *msg) { uint8_t type; while (dev) { if (!pci_is_express(dev)) { return; } type = pcie_cap_get_type(dev); if ((type == PCI_EXP_TYPE_ROOT_PORT || type == PCI_EXP_TYPE_UPSTREAM || type == PCI_EXP_TYPE_DOWNSTREAM) && !pcie_aer_msg_vbridge(dev, msg)) { return; } if (!pcie_aer_msg_alldev(dev, msg)) { return; } if (type == PCI_EXP_TYPE_ROOT_PORT) { pcie_aer_msg_root_port(dev, msg); return; } dev = pci_bridge_get_device(dev->bus); } }
{ "code": [], "line_no": [] }
static void FUNC_0(PCIDevice *VAR_0, const PCIEAERMsg *VAR_1) { uint8_t type; while (VAR_0) { if (!pci_is_express(VAR_0)) { return; } type = pcie_cap_get_type(VAR_0); if ((type == PCI_EXP_TYPE_ROOT_PORT || type == PCI_EXP_TYPE_UPSTREAM || type == PCI_EXP_TYPE_DOWNSTREAM) && !pcie_aer_msg_vbridge(VAR_0, VAR_1)) { return; } if (!pcie_aer_msg_alldev(VAR_0, VAR_1)) { return; } if (type == PCI_EXP_TYPE_ROOT_PORT) { pcie_aer_msg_root_port(VAR_0, VAR_1); return; } VAR_0 = pci_bridge_get_device(VAR_0->bus); } }
[ "static void FUNC_0(PCIDevice *VAR_0, const PCIEAERMsg *VAR_1)\n{", "uint8_t type;", "while (VAR_0) {", "if (!pci_is_express(VAR_0)) {", "return;", "}", "type = pcie_cap_get_type(VAR_0);", "if ((type == PCI_EXP_TYPE_ROOT_PORT ||\ntype == PCI_EXP_TYPE_UPSTREAM ||\ntype == PCI_EXP_TYPE_DOWNSTREAM) &&\n!pcie_aer_msg_vbridge(VAR_0, VAR_1)) {", "return;", "}", "if (!pcie_aer_msg_alldev(VAR_0, VAR_1)) {", "return;", "}", "if (type == PCI_EXP_TYPE_ROOT_PORT) {", "pcie_aer_msg_root_port(VAR_0, VAR_1);", "return;", "}", "VAR_0 = pci_bridge_get_device(VAR_0->bus);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 19 ], [ 21 ], [ 25 ], [ 27, 29, 31, 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ] ]
20,065
static int ide_drive_pio_post_load(void *opaque, int version_id) { IDEState *s = opaque; if (s->end_transfer_fn_idx < 0 || s->end_transfer_fn_idx > ARRAY_SIZE(transfer_end_table)) { return -EINVAL; } s->end_transfer_func = transfer_end_table[s->end_transfer_fn_idx]; s->data_ptr = s->io_buffer + s->cur_io_buffer_offset; s->data_end = s->data_ptr + s->cur_io_buffer_len; return 0; }
false
qemu
7bccf57383cca60a778d5c543ac80c9f62d89ef2
static int ide_drive_pio_post_load(void *opaque, int version_id) { IDEState *s = opaque; if (s->end_transfer_fn_idx < 0 || s->end_transfer_fn_idx > ARRAY_SIZE(transfer_end_table)) { return -EINVAL; } s->end_transfer_func = transfer_end_table[s->end_transfer_fn_idx]; s->data_ptr = s->io_buffer + s->cur_io_buffer_offset; s->data_end = s->data_ptr + s->cur_io_buffer_len; return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(void *VAR_0, int VAR_1) { IDEState *s = VAR_0; if (s->end_transfer_fn_idx < 0 || s->end_transfer_fn_idx > ARRAY_SIZE(transfer_end_table)) { return -EINVAL; } s->end_transfer_func = transfer_end_table[s->end_transfer_fn_idx]; s->data_ptr = s->io_buffer + s->cur_io_buffer_offset; s->data_end = s->data_ptr + s->cur_io_buffer_len; return 0; }
[ "static int FUNC_0(void *VAR_0, int VAR_1)\n{", "IDEState *s = VAR_0;", "if (s->end_transfer_fn_idx < 0 ||\ns->end_transfer_fn_idx > ARRAY_SIZE(transfer_end_table)) {", "return -EINVAL;", "}", "s->end_transfer_func = transfer_end_table[s->end_transfer_fn_idx];", "s->data_ptr = s->io_buffer + s->cur_io_buffer_offset;", "s->data_end = s->data_ptr + s->cur_io_buffer_len;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9, 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ] ]
20,066
void timer_del(QEMUTimer *ts) { QEMUTimer **pt, *t; pt = &ts->timer_list->active_timers; for(;;) { t = *pt; if (!t) break; if (t == ts) { *pt = t->next; break; } pt = &t->next; } }
false
qemu
978f2205c791de0e02c8802a645bea657408abfd
void timer_del(QEMUTimer *ts) { QEMUTimer **pt, *t; pt = &ts->timer_list->active_timers; for(;;) { t = *pt; if (!t) break; if (t == ts) { *pt = t->next; break; } pt = &t->next; } }
{ "code": [], "line_no": [] }
void FUNC_0(QEMUTimer *VAR_0) { QEMUTimer **pt, *t; pt = &VAR_0->timer_list->active_timers; for(;;) { t = *pt; if (!t) break; if (t == VAR_0) { *pt = t->next; break; } pt = &t->next; } }
[ "void FUNC_0(QEMUTimer *VAR_0)\n{", "QEMUTimer **pt, *t;", "pt = &VAR_0->timer_list->active_timers;", "for(;;) {", "t = *pt;", "if (!t)\nbreak;", "if (t == VAR_0) {", "*pt = t->next;", "break;", "}", "pt = &t->next;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15, 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ] ]
20,069
static int xen_host_pci_get_value(XenHostPCIDevice *d, const char *name, unsigned int *pvalue, int base) { char path[PATH_MAX]; char buf[XEN_HOST_PCI_GET_VALUE_BUFFER_SIZE]; int fd, rc; unsigned long value; char *endptr; xen_host_pci_sysfs_path(d, name, path, sizeof(path)); fd = open(path, O_RDONLY); if (fd == -1) { XEN_HOST_PCI_LOG("Error: Can't open %s: %s\n", path, strerror(errno)); return -errno; } do { rc = read(fd, &buf, sizeof (buf) - 1); if (rc < 0 && errno != EINTR) { rc = -errno; goto out; } } while (rc < 0); buf[rc] = 0; value = strtol(buf, &endptr, base); if (endptr == buf || *endptr != '\n') { rc = -1; } else if ((value == LONG_MIN || value == LONG_MAX) && errno == ERANGE) { rc = -errno; } else { rc = 0; *pvalue = value; } out: close(fd); return rc; }
false
qemu
f524bc3b3da5bd595840fca93d43a9852b8d066f
static int xen_host_pci_get_value(XenHostPCIDevice *d, const char *name, unsigned int *pvalue, int base) { char path[PATH_MAX]; char buf[XEN_HOST_PCI_GET_VALUE_BUFFER_SIZE]; int fd, rc; unsigned long value; char *endptr; xen_host_pci_sysfs_path(d, name, path, sizeof(path)); fd = open(path, O_RDONLY); if (fd == -1) { XEN_HOST_PCI_LOG("Error: Can't open %s: %s\n", path, strerror(errno)); return -errno; } do { rc = read(fd, &buf, sizeof (buf) - 1); if (rc < 0 && errno != EINTR) { rc = -errno; goto out; } } while (rc < 0); buf[rc] = 0; value = strtol(buf, &endptr, base); if (endptr == buf || *endptr != '\n') { rc = -1; } else if ((value == LONG_MIN || value == LONG_MAX) && errno == ERANGE) { rc = -errno; } else { rc = 0; *pvalue = value; } out: close(fd); return rc; }
{ "code": [], "line_no": [] }
static int FUNC_0(XenHostPCIDevice *VAR_0, const char *VAR_1, unsigned int *VAR_2, int VAR_3) { char VAR_4[PATH_MAX]; char VAR_5[XEN_HOST_PCI_GET_VALUE_BUFFER_SIZE]; int VAR_6, VAR_7; unsigned long VAR_8; char *VAR_9; xen_host_pci_sysfs_path(VAR_0, VAR_1, VAR_4, sizeof(VAR_4)); VAR_6 = open(VAR_4, O_RDONLY); if (VAR_6 == -1) { XEN_HOST_PCI_LOG("Error: Can't open %s: %s\n", VAR_4, strerror(errno)); return -errno; } do { VAR_7 = read(VAR_6, &VAR_5, sizeof (VAR_5) - 1); if (VAR_7 < 0 && errno != EINTR) { VAR_7 = -errno; goto out; } } while (VAR_7 < 0); VAR_5[VAR_7] = 0; VAR_8 = strtol(VAR_5, &VAR_9, VAR_3); if (VAR_9 == VAR_5 || *VAR_9 != '\n') { VAR_7 = -1; } else if ((VAR_8 == LONG_MIN || VAR_8 == LONG_MAX) && errno == ERANGE) { VAR_7 = -errno; } else { VAR_7 = 0; *VAR_2 = VAR_8; } out: close(VAR_6); return VAR_7; }
[ "static int FUNC_0(XenHostPCIDevice *VAR_0, const char *VAR_1,\nunsigned int *VAR_2, int VAR_3)\n{", "char VAR_4[PATH_MAX];", "char VAR_5[XEN_HOST_PCI_GET_VALUE_BUFFER_SIZE];", "int VAR_6, VAR_7;", "unsigned long VAR_8;", "char *VAR_9;", "xen_host_pci_sysfs_path(VAR_0, VAR_1, VAR_4, sizeof(VAR_4));", "VAR_6 = open(VAR_4, O_RDONLY);", "if (VAR_6 == -1) {", "XEN_HOST_PCI_LOG(\"Error: Can't open %s: %s\\n\", VAR_4, strerror(errno));", "return -errno;", "}", "do {", "VAR_7 = read(VAR_6, &VAR_5, sizeof (VAR_5) - 1);", "if (VAR_7 < 0 && errno != EINTR) {", "VAR_7 = -errno;", "goto out;", "}", "} while (VAR_7 < 0);", "VAR_5[VAR_7] = 0;", "VAR_8 = strtol(VAR_5, &VAR_9, VAR_3);", "if (VAR_9 == VAR_5 || *VAR_9 != '\\n') {", "VAR_7 = -1;", "} else if ((VAR_8 == LONG_MIN || VAR_8 == LONG_MAX) && errno == ERANGE) {", "VAR_7 = -errno;", "} else {", "VAR_7 = 0;", "*VAR_2 = VAR_8;", "}", "out:\nclose(VAR_6);", "return VAR_7;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67, 69 ], [ 71 ], [ 73 ] ]
20,071
uint32_t helper_float_cvtw_s(CPUMIPSState *env, uint32_t fst0) { uint32_t wt2; wt2 = float32_to_int32(fst0, &env->active_fpu.fp_status); update_fcr31(env, GETPC()); if (get_float_exception_flags(&env->active_fpu.fp_status) & (float_flag_invalid | float_flag_overflow)) { wt2 = FP_TO_INT32_OVERFLOW; } return wt2; }
false
qemu
2b09f94cdbf5c54e2278d7f3aed2eceff3494790
uint32_t helper_float_cvtw_s(CPUMIPSState *env, uint32_t fst0) { uint32_t wt2; wt2 = float32_to_int32(fst0, &env->active_fpu.fp_status); update_fcr31(env, GETPC()); if (get_float_exception_flags(&env->active_fpu.fp_status) & (float_flag_invalid | float_flag_overflow)) { wt2 = FP_TO_INT32_OVERFLOW; } return wt2; }
{ "code": [], "line_no": [] }
uint32_t FUNC_0(CPUMIPSState *env, uint32_t fst0) { uint32_t wt2; wt2 = float32_to_int32(fst0, &env->active_fpu.fp_status); update_fcr31(env, GETPC()); if (get_float_exception_flags(&env->active_fpu.fp_status) & (float_flag_invalid | float_flag_overflow)) { wt2 = FP_TO_INT32_OVERFLOW; } return wt2; }
[ "uint32_t FUNC_0(CPUMIPSState *env, uint32_t fst0)\n{", "uint32_t wt2;", "wt2 = float32_to_int32(fst0, &env->active_fpu.fp_status);", "update_fcr31(env, GETPC());", "if (get_float_exception_flags(&env->active_fpu.fp_status)\n& (float_flag_invalid | float_flag_overflow)) {", "wt2 = FP_TO_INT32_OVERFLOW;", "}", "return wt2;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13, 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ] ]
20,072
static void test_visitor_in_native_list_int16(TestInputVisitorData *data, const void *unused) { test_native_list_integer_helper(data, unused, USER_DEF_NATIVE_LIST_UNION_KIND_S16); }
false
qemu
b3db211f3c80bb996a704d665fe275619f728bd4
static void test_visitor_in_native_list_int16(TestInputVisitorData *data, const void *unused) { test_native_list_integer_helper(data, unused, USER_DEF_NATIVE_LIST_UNION_KIND_S16); }
{ "code": [], "line_no": [] }
static void FUNC_0(TestInputVisitorData *VAR_0, const void *VAR_1) { test_native_list_integer_helper(VAR_0, VAR_1, USER_DEF_NATIVE_LIST_UNION_KIND_S16); }
[ "static void FUNC_0(TestInputVisitorData *VAR_0,\nconst void *VAR_1)\n{", "test_native_list_integer_helper(VAR_0, VAR_1,\nUSER_DEF_NATIVE_LIST_UNION_KIND_S16);", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7, 9 ], [ 11 ] ]
20,073
int get_osversion(void) { static int osversion; struct new_utsname buf; const char *s; int i, n, tmp; if (osversion) return osversion; if (qemu_uname_release && *qemu_uname_release) { s = qemu_uname_release; } else { if (sys_uname(&buf)) return 0; s = buf.release; } tmp = 0; for (i = 0; i < 3; i++) { n = 0; while (*s >= '0' && *s <= '9') { n *= 10; n += *s - '0'; s++; } tmp = (tmp << 8) + n; if (*s == '.') s++; } osversion = tmp; return osversion; }
false
qemu
4a24a758101ff726c9bd3b867e12d5580c793af0
int get_osversion(void) { static int osversion; struct new_utsname buf; const char *s; int i, n, tmp; if (osversion) return osversion; if (qemu_uname_release && *qemu_uname_release) { s = qemu_uname_release; } else { if (sys_uname(&buf)) return 0; s = buf.release; } tmp = 0; for (i = 0; i < 3; i++) { n = 0; while (*s >= '0' && *s <= '9') { n *= 10; n += *s - '0'; s++; } tmp = (tmp << 8) + n; if (*s == '.') s++; } osversion = tmp; return osversion; }
{ "code": [], "line_no": [] }
int FUNC_0(void) { static int VAR_0; struct new_utsname VAR_1; const char *VAR_2; int VAR_3, VAR_4, VAR_5; if (VAR_0) return VAR_0; if (qemu_uname_release && *qemu_uname_release) { VAR_2 = qemu_uname_release; } else { if (sys_uname(&VAR_1)) return 0; VAR_2 = VAR_1.release; } VAR_5 = 0; for (VAR_3 = 0; VAR_3 < 3; VAR_3++) { VAR_4 = 0; while (*VAR_2 >= '0' && *VAR_2 <= '9') { VAR_4 *= 10; VAR_4 += *VAR_2 - '0'; VAR_2++; } VAR_5 = (VAR_5 << 8) + VAR_4; if (*VAR_2 == '.') VAR_2++; } VAR_0 = VAR_5; return VAR_0; }
[ "int FUNC_0(void)\n{", "static int VAR_0;", "struct new_utsname VAR_1;", "const char *VAR_2;", "int VAR_3, VAR_4, VAR_5;", "if (VAR_0)\nreturn VAR_0;", "if (qemu_uname_release && *qemu_uname_release) {", "VAR_2 = qemu_uname_release;", "} else {", "if (sys_uname(&VAR_1))\nreturn 0;", "VAR_2 = VAR_1.release;", "}", "VAR_5 = 0;", "for (VAR_3 = 0; VAR_3 < 3; VAR_3++) {", "VAR_4 = 0;", "while (*VAR_2 >= '0' && *VAR_2 <= '9') {", "VAR_4 *= 10;", "VAR_4 += *VAR_2 - '0';", "VAR_2++;", "}", "VAR_5 = (VAR_5 << 8) + VAR_4;", "if (*VAR_2 == '.')\nVAR_2++;", "}", "VAR_0 = VAR_5;", "return VAR_0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13, 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23, 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49, 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ] ]
20,074
static int colo_packet_compare_common(Packet *ppkt, Packet *spkt) { trace_colo_compare_ip_info(ppkt->size, inet_ntoa(ppkt->ip->ip_src), inet_ntoa(ppkt->ip->ip_dst), spkt->size, inet_ntoa(spkt->ip->ip_src), inet_ntoa(spkt->ip->ip_dst)); if (ppkt->size == spkt->size) { return memcmp(ppkt->data, spkt->data, spkt->size); } else { trace_colo_compare_main("Net packet size are not the same"); return -1; } }
false
qemu
6efeb3286dd80c8c943f50fbb5f611d525cd6f8a
static int colo_packet_compare_common(Packet *ppkt, Packet *spkt) { trace_colo_compare_ip_info(ppkt->size, inet_ntoa(ppkt->ip->ip_src), inet_ntoa(ppkt->ip->ip_dst), spkt->size, inet_ntoa(spkt->ip->ip_src), inet_ntoa(spkt->ip->ip_dst)); if (ppkt->size == spkt->size) { return memcmp(ppkt->data, spkt->data, spkt->size); } else { trace_colo_compare_main("Net packet size are not the same"); return -1; } }
{ "code": [], "line_no": [] }
static int FUNC_0(Packet *VAR_0, Packet *VAR_1) { trace_colo_compare_ip_info(VAR_0->size, inet_ntoa(VAR_0->ip->ip_src), inet_ntoa(VAR_0->ip->ip_dst), VAR_1->size, inet_ntoa(VAR_1->ip->ip_src), inet_ntoa(VAR_1->ip->ip_dst)); if (VAR_0->size == VAR_1->size) { return memcmp(VAR_0->data, VAR_1->data, VAR_1->size); } else { trace_colo_compare_main("Net packet size are not the same"); return -1; } }
[ "static int FUNC_0(Packet *VAR_0, Packet *VAR_1)\n{", "trace_colo_compare_ip_info(VAR_0->size, inet_ntoa(VAR_0->ip->ip_src),\ninet_ntoa(VAR_0->ip->ip_dst), VAR_1->size,\ninet_ntoa(VAR_1->ip->ip_src),\ninet_ntoa(VAR_1->ip->ip_dst));", "if (VAR_0->size == VAR_1->size) {", "return memcmp(VAR_0->data, VAR_1->data, VAR_1->size);", "} else {", "trace_colo_compare_main(\"Net packet size are not the same\");", "return -1;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5, 7, 9, 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ] ]
20,075
static int gdb_handle_packet(GDBState *s, const char *line_buf) { CPUState *env; const char *p; int ch, reg_size, type, res, thread; char buf[MAX_PACKET_LENGTH]; uint8_t mem_buf[MAX_PACKET_LENGTH]; uint8_t *registers; target_ulong addr, len; #ifdef DEBUG_GDB printf("command='%s'\n", line_buf); #endif p = line_buf; ch = *p++; switch(ch) { case '?': /* TODO: Make this return the correct value for user-mode. */ snprintf(buf, sizeof(buf), "T%02xthread:%02x;", GDB_SIGNAL_TRAP, s->c_cpu->cpu_index+1); put_packet(s, buf); /* Remove all the breakpoints when this query is issued, * because gdb is doing and initial connect and the state * should be cleaned up. */ gdb_breakpoint_remove_all(); break; case 'c': if (*p != '\0') { addr = strtoull(p, (char **)&p, 16); #if defined(TARGET_I386) s->c_cpu->eip = addr; #elif defined (TARGET_PPC) s->c_cpu->nip = addr; #elif defined (TARGET_SPARC) s->c_cpu->pc = addr; s->c_cpu->npc = addr + 4; #elif defined (TARGET_ARM) s->c_cpu->regs[15] = addr; #elif defined (TARGET_SH4) s->c_cpu->pc = addr; #elif defined (TARGET_MIPS) s->c_cpu->active_tc.PC = addr; #elif defined (TARGET_CRIS) s->c_cpu->pc = addr; #elif defined (TARGET_ALPHA) s->c_cpu->pc = addr; #endif } s->signal = 0; gdb_continue(s); return RS_IDLE; case 'C': s->signal = gdb_signal_to_target (strtoul(p, (char **)&p, 16)); if (s->signal == -1) s->signal = 0; gdb_continue(s); return RS_IDLE; case 'k': /* Kill the target */ fprintf(stderr, "\nQEMU: Terminated via GDBstub\n"); exit(0); case 'D': /* Detach packet */ gdb_breakpoint_remove_all(); gdb_continue(s); put_packet(s, "OK"); break; case 's': if (*p != '\0') { addr = strtoull(p, (char **)&p, 16); #if defined(TARGET_I386) s->c_cpu->eip = addr; #elif defined (TARGET_PPC) s->c_cpu->nip = addr; #elif defined (TARGET_SPARC) s->c_cpu->pc = addr; s->c_cpu->npc = addr + 4; #elif defined (TARGET_ARM) s->c_cpu->regs[15] = addr; #elif defined (TARGET_SH4) s->c_cpu->pc = addr; #elif defined (TARGET_MIPS) s->c_cpu->active_tc.PC = addr; #elif defined (TARGET_CRIS) s->c_cpu->pc = addr; #elif defined (TARGET_ALPHA) s->c_cpu->pc = addr; #endif } cpu_single_step(s->c_cpu, sstep_flags); gdb_continue(s); return RS_IDLE; case 'F': { target_ulong ret; target_ulong err; ret = strtoull(p, (char **)&p, 16); if (*p == ',') { p++; err = strtoull(p, (char **)&p, 16); } else { err = 0; } if (*p == ',') p++; type = *p; if (gdb_current_syscall_cb) gdb_current_syscall_cb(s->c_cpu, ret, err); if (type == 'C') { put_packet(s, "T02"); } else { gdb_continue(s); } } break; case 'g': len = 0; for (addr = 0; addr < num_g_regs; addr++) { reg_size = gdb_read_register(s->g_cpu, mem_buf + len, addr); len += reg_size; } memtohex(buf, mem_buf, len); put_packet(s, buf); break; case 'G': registers = mem_buf; len = strlen(p) / 2; hextomem((uint8_t *)registers, p, len); for (addr = 0; addr < num_g_regs && len > 0; addr++) { reg_size = gdb_write_register(s->g_cpu, registers, addr); len -= reg_size; registers += reg_size; } put_packet(s, "OK"); break; case 'm': addr = strtoull(p, (char **)&p, 16); if (*p == ',') p++; len = strtoull(p, NULL, 16); if (cpu_memory_rw_debug(s->g_cpu, addr, mem_buf, len, 0) != 0) { put_packet (s, "E14"); } else { memtohex(buf, mem_buf, len); put_packet(s, buf); } break; case 'M': addr = strtoull(p, (char **)&p, 16); if (*p == ',') p++; len = strtoull(p, (char **)&p, 16); if (*p == ':') p++; hextomem(mem_buf, p, len); if (cpu_memory_rw_debug(s->g_cpu, addr, mem_buf, len, 1) != 0) put_packet(s, "E14"); else put_packet(s, "OK"); break; case 'p': /* Older gdb are really dumb, and don't use 'g' if 'p' is avaialable. This works, but can be very slow. Anything new enough to understand XML also knows how to use this properly. */ if (!gdb_has_xml) goto unknown_command; addr = strtoull(p, (char **)&p, 16); reg_size = gdb_read_register(s->g_cpu, mem_buf, addr); if (reg_size) { memtohex(buf, mem_buf, reg_size); put_packet(s, buf); } else { put_packet(s, "E14"); } break; case 'P': if (!gdb_has_xml) goto unknown_command; addr = strtoull(p, (char **)&p, 16); if (*p == '=') p++; reg_size = strlen(p) / 2; hextomem(mem_buf, p, reg_size); gdb_write_register(s->g_cpu, mem_buf, addr); put_packet(s, "OK"); break; case 'Z': case 'z': type = strtoul(p, (char **)&p, 16); if (*p == ',') p++; addr = strtoull(p, (char **)&p, 16); if (*p == ',') p++; len = strtoull(p, (char **)&p, 16); if (ch == 'Z') res = gdb_breakpoint_insert(addr, len, type); else res = gdb_breakpoint_remove(addr, len, type); if (res >= 0) put_packet(s, "OK"); else if (res == -ENOSYS) put_packet(s, ""); else put_packet(s, "E22"); break; case 'H': type = *p++; thread = strtoull(p, (char **)&p, 16); if (thread == -1 || thread == 0) { put_packet(s, "OK"); break; } for (env = first_cpu; env != NULL; env = env->next_cpu) if (env->cpu_index + 1 == thread) break; if (env == NULL) { put_packet(s, "E22"); break; } switch (type) { case 'c': s->c_cpu = env; put_packet(s, "OK"); break; case 'g': s->g_cpu = env; put_packet(s, "OK"); break; default: put_packet(s, "E22"); break; } break; case 'T': thread = strtoull(p, (char **)&p, 16); #ifndef CONFIG_USER_ONLY if (thread > 0 && thread < smp_cpus + 1) #else if (thread == 1) #endif put_packet(s, "OK"); else put_packet(s, "E22"); break; case 'q': case 'Q': /* parse any 'q' packets here */ if (!strcmp(p,"qemu.sstepbits")) { /* Query Breakpoint bit definitions */ snprintf(buf, sizeof(buf), "ENABLE=%x,NOIRQ=%x,NOTIMER=%x", SSTEP_ENABLE, SSTEP_NOIRQ, SSTEP_NOTIMER); put_packet(s, buf); break; } else if (strncmp(p,"qemu.sstep",10) == 0) { /* Display or change the sstep_flags */ p += 10; if (*p != '=') { /* Display current setting */ snprintf(buf, sizeof(buf), "0x%x", sstep_flags); put_packet(s, buf); break; } p++; type = strtoul(p, (char **)&p, 16); sstep_flags = type; put_packet(s, "OK"); break; } else if (strcmp(p,"C") == 0) { /* "Current thread" remains vague in the spec, so always return * the first CPU (gdb returns the first thread). */ put_packet(s, "QC1"); break; } else if (strcmp(p,"fThreadInfo") == 0) { s->query_cpu = first_cpu; goto report_cpuinfo; } else if (strcmp(p,"sThreadInfo") == 0) { report_cpuinfo: if (s->query_cpu) { snprintf(buf, sizeof(buf), "m%x", s->query_cpu->cpu_index+1); put_packet(s, buf); s->query_cpu = s->query_cpu->next_cpu; } else put_packet(s, "l"); break; } else if (strncmp(p,"ThreadExtraInfo,", 16) == 0) { thread = strtoull(p+16, (char **)&p, 16); for (env = first_cpu; env != NULL; env = env->next_cpu) if (env->cpu_index + 1 == thread) { len = snprintf((char *)mem_buf, sizeof(mem_buf), "CPU#%d [%s]", env->cpu_index, env->halted ? "halted " : "running"); memtohex(buf, mem_buf, len); put_packet(s, buf); break; } break; } #ifdef CONFIG_LINUX_USER else if (strncmp(p, "Offsets", 7) == 0) { TaskState *ts = s->c_cpu->opaque; snprintf(buf, sizeof(buf), "Text=" TARGET_ABI_FMT_lx ";Data=" TARGET_ABI_FMT_lx ";Bss=" TARGET_ABI_FMT_lx, ts->info->code_offset, ts->info->data_offset, ts->info->data_offset); put_packet(s, buf); break; } #endif if (strncmp(p, "Supported", 9) == 0) { snprintf(buf, sizeof(buf), "PacketSize=%x", MAX_PACKET_LENGTH); #ifdef GDB_CORE_XML strcat(buf, ";qXfer:features:read+"); #endif put_packet(s, buf); break; } #ifdef GDB_CORE_XML if (strncmp(p, "Xfer:features:read:", 19) == 0) { const char *xml; target_ulong total_len; gdb_has_xml = 1; p += 19; xml = get_feature_xml(p, &p); if (!xml) { snprintf(buf, sizeof(buf), "E00"); put_packet(s, buf); break; } if (*p == ':') p++; addr = strtoul(p, (char **)&p, 16); if (*p == ',') p++; len = strtoul(p, (char **)&p, 16); total_len = strlen(xml); if (addr > total_len) { snprintf(buf, sizeof(buf), "E00"); put_packet(s, buf); break; } if (len > (MAX_PACKET_LENGTH - 5) / 2) len = (MAX_PACKET_LENGTH - 5) / 2; if (len < total_len - addr) { buf[0] = 'm'; len = memtox(buf + 1, xml + addr, len); } else { buf[0] = 'l'; len = memtox(buf + 1, xml + addr, total_len - addr); } put_packet_binary(s, buf, len + 1); break; } #endif /* Unrecognised 'q' command. */ goto unknown_command; default: unknown_command: /* put empty packet */ buf[0] = '\0'; put_packet(s, buf); break; } return RS_IDLE; }
false
qemu
8a34a0fb03191770a77026da164f3ad589c61407
static int gdb_handle_packet(GDBState *s, const char *line_buf) { CPUState *env; const char *p; int ch, reg_size, type, res, thread; char buf[MAX_PACKET_LENGTH]; uint8_t mem_buf[MAX_PACKET_LENGTH]; uint8_t *registers; target_ulong addr, len; #ifdef DEBUG_GDB printf("command='%s'\n", line_buf); #endif p = line_buf; ch = *p++; switch(ch) { case '?': snprintf(buf, sizeof(buf), "T%02xthread:%02x;", GDB_SIGNAL_TRAP, s->c_cpu->cpu_index+1); put_packet(s, buf); gdb_breakpoint_remove_all(); break; case 'c': if (*p != '\0') { addr = strtoull(p, (char **)&p, 16); #if defined(TARGET_I386) s->c_cpu->eip = addr; #elif defined (TARGET_PPC) s->c_cpu->nip = addr; #elif defined (TARGET_SPARC) s->c_cpu->pc = addr; s->c_cpu->npc = addr + 4; #elif defined (TARGET_ARM) s->c_cpu->regs[15] = addr; #elif defined (TARGET_SH4) s->c_cpu->pc = addr; #elif defined (TARGET_MIPS) s->c_cpu->active_tc.PC = addr; #elif defined (TARGET_CRIS) s->c_cpu->pc = addr; #elif defined (TARGET_ALPHA) s->c_cpu->pc = addr; #endif } s->signal = 0; gdb_continue(s); return RS_IDLE; case 'C': s->signal = gdb_signal_to_target (strtoul(p, (char **)&p, 16)); if (s->signal == -1) s->signal = 0; gdb_continue(s); return RS_IDLE; case 'k': fprintf(stderr, "\nQEMU: Terminated via GDBstub\n"); exit(0); case 'D': gdb_breakpoint_remove_all(); gdb_continue(s); put_packet(s, "OK"); break; case 's': if (*p != '\0') { addr = strtoull(p, (char **)&p, 16); #if defined(TARGET_I386) s->c_cpu->eip = addr; #elif defined (TARGET_PPC) s->c_cpu->nip = addr; #elif defined (TARGET_SPARC) s->c_cpu->pc = addr; s->c_cpu->npc = addr + 4; #elif defined (TARGET_ARM) s->c_cpu->regs[15] = addr; #elif defined (TARGET_SH4) s->c_cpu->pc = addr; #elif defined (TARGET_MIPS) s->c_cpu->active_tc.PC = addr; #elif defined (TARGET_CRIS) s->c_cpu->pc = addr; #elif defined (TARGET_ALPHA) s->c_cpu->pc = addr; #endif } cpu_single_step(s->c_cpu, sstep_flags); gdb_continue(s); return RS_IDLE; case 'F': { target_ulong ret; target_ulong err; ret = strtoull(p, (char **)&p, 16); if (*p == ',') { p++; err = strtoull(p, (char **)&p, 16); } else { err = 0; } if (*p == ',') p++; type = *p; if (gdb_current_syscall_cb) gdb_current_syscall_cb(s->c_cpu, ret, err); if (type == 'C') { put_packet(s, "T02"); } else { gdb_continue(s); } } break; case 'g': len = 0; for (addr = 0; addr < num_g_regs; addr++) { reg_size = gdb_read_register(s->g_cpu, mem_buf + len, addr); len += reg_size; } memtohex(buf, mem_buf, len); put_packet(s, buf); break; case 'G': registers = mem_buf; len = strlen(p) / 2; hextomem((uint8_t *)registers, p, len); for (addr = 0; addr < num_g_regs && len > 0; addr++) { reg_size = gdb_write_register(s->g_cpu, registers, addr); len -= reg_size; registers += reg_size; } put_packet(s, "OK"); break; case 'm': addr = strtoull(p, (char **)&p, 16); if (*p == ',') p++; len = strtoull(p, NULL, 16); if (cpu_memory_rw_debug(s->g_cpu, addr, mem_buf, len, 0) != 0) { put_packet (s, "E14"); } else { memtohex(buf, mem_buf, len); put_packet(s, buf); } break; case 'M': addr = strtoull(p, (char **)&p, 16); if (*p == ',') p++; len = strtoull(p, (char **)&p, 16); if (*p == ':') p++; hextomem(mem_buf, p, len); if (cpu_memory_rw_debug(s->g_cpu, addr, mem_buf, len, 1) != 0) put_packet(s, "E14"); else put_packet(s, "OK"); break; case 'p': if (!gdb_has_xml) goto unknown_command; addr = strtoull(p, (char **)&p, 16); reg_size = gdb_read_register(s->g_cpu, mem_buf, addr); if (reg_size) { memtohex(buf, mem_buf, reg_size); put_packet(s, buf); } else { put_packet(s, "E14"); } break; case 'P': if (!gdb_has_xml) goto unknown_command; addr = strtoull(p, (char **)&p, 16); if (*p == '=') p++; reg_size = strlen(p) / 2; hextomem(mem_buf, p, reg_size); gdb_write_register(s->g_cpu, mem_buf, addr); put_packet(s, "OK"); break; case 'Z': case 'z': type = strtoul(p, (char **)&p, 16); if (*p == ',') p++; addr = strtoull(p, (char **)&p, 16); if (*p == ',') p++; len = strtoull(p, (char **)&p, 16); if (ch == 'Z') res = gdb_breakpoint_insert(addr, len, type); else res = gdb_breakpoint_remove(addr, len, type); if (res >= 0) put_packet(s, "OK"); else if (res == -ENOSYS) put_packet(s, ""); else put_packet(s, "E22"); break; case 'H': type = *p++; thread = strtoull(p, (char **)&p, 16); if (thread == -1 || thread == 0) { put_packet(s, "OK"); break; } for (env = first_cpu; env != NULL; env = env->next_cpu) if (env->cpu_index + 1 == thread) break; if (env == NULL) { put_packet(s, "E22"); break; } switch (type) { case 'c': s->c_cpu = env; put_packet(s, "OK"); break; case 'g': s->g_cpu = env; put_packet(s, "OK"); break; default: put_packet(s, "E22"); break; } break; case 'T': thread = strtoull(p, (char **)&p, 16); #ifndef CONFIG_USER_ONLY if (thread > 0 && thread < smp_cpus + 1) #else if (thread == 1) #endif put_packet(s, "OK"); else put_packet(s, "E22"); break; case 'q': case 'Q': if (!strcmp(p,"qemu.sstepbits")) { snprintf(buf, sizeof(buf), "ENABLE=%x,NOIRQ=%x,NOTIMER=%x", SSTEP_ENABLE, SSTEP_NOIRQ, SSTEP_NOTIMER); put_packet(s, buf); break; } else if (strncmp(p,"qemu.sstep",10) == 0) { p += 10; if (*p != '=') { snprintf(buf, sizeof(buf), "0x%x", sstep_flags); put_packet(s, buf); break; } p++; type = strtoul(p, (char **)&p, 16); sstep_flags = type; put_packet(s, "OK"); break; } else if (strcmp(p,"C") == 0) { put_packet(s, "QC1"); break; } else if (strcmp(p,"fThreadInfo") == 0) { s->query_cpu = first_cpu; goto report_cpuinfo; } else if (strcmp(p,"sThreadInfo") == 0) { report_cpuinfo: if (s->query_cpu) { snprintf(buf, sizeof(buf), "m%x", s->query_cpu->cpu_index+1); put_packet(s, buf); s->query_cpu = s->query_cpu->next_cpu; } else put_packet(s, "l"); break; } else if (strncmp(p,"ThreadExtraInfo,", 16) == 0) { thread = strtoull(p+16, (char **)&p, 16); for (env = first_cpu; env != NULL; env = env->next_cpu) if (env->cpu_index + 1 == thread) { len = snprintf((char *)mem_buf, sizeof(mem_buf), "CPU#%d [%s]", env->cpu_index, env->halted ? "halted " : "running"); memtohex(buf, mem_buf, len); put_packet(s, buf); break; } break; } #ifdef CONFIG_LINUX_USER else if (strncmp(p, "Offsets", 7) == 0) { TaskState *ts = s->c_cpu->opaque; snprintf(buf, sizeof(buf), "Text=" TARGET_ABI_FMT_lx ";Data=" TARGET_ABI_FMT_lx ";Bss=" TARGET_ABI_FMT_lx, ts->info->code_offset, ts->info->data_offset, ts->info->data_offset); put_packet(s, buf); break; } #endif if (strncmp(p, "Supported", 9) == 0) { snprintf(buf, sizeof(buf), "PacketSize=%x", MAX_PACKET_LENGTH); #ifdef GDB_CORE_XML strcat(buf, ";qXfer:features:read+"); #endif put_packet(s, buf); break; } #ifdef GDB_CORE_XML if (strncmp(p, "Xfer:features:read:", 19) == 0) { const char *xml; target_ulong total_len; gdb_has_xml = 1; p += 19; xml = get_feature_xml(p, &p); if (!xml) { snprintf(buf, sizeof(buf), "E00"); put_packet(s, buf); break; } if (*p == ':') p++; addr = strtoul(p, (char **)&p, 16); if (*p == ',') p++; len = strtoul(p, (char **)&p, 16); total_len = strlen(xml); if (addr > total_len) { snprintf(buf, sizeof(buf), "E00"); put_packet(s, buf); break; } if (len > (MAX_PACKET_LENGTH - 5) / 2) len = (MAX_PACKET_LENGTH - 5) / 2; if (len < total_len - addr) { buf[0] = 'm'; len = memtox(buf + 1, xml + addr, len); } else { buf[0] = 'l'; len = memtox(buf + 1, xml + addr, total_len - addr); } put_packet_binary(s, buf, len + 1); break; } #endif goto unknown_command; default: unknown_command: buf[0] = '\0'; put_packet(s, buf); break; } return RS_IDLE; }
{ "code": [], "line_no": [] }
static int FUNC_0(GDBState *VAR_0, const char *VAR_1) { CPUState *env; const char *VAR_2; int VAR_3, VAR_4, VAR_5, VAR_6, VAR_7; char VAR_8[MAX_PACKET_LENGTH]; uint8_t mem_buf[MAX_PACKET_LENGTH]; uint8_t *registers; target_ulong addr, len; #ifdef DEBUG_GDB printf("command='%VAR_0'\n", VAR_1); #endif VAR_2 = VAR_1; VAR_3 = *VAR_2++; switch(VAR_3) { case '?': snprintf(VAR_8, sizeof(VAR_8), "T%02xthread:%02x;", GDB_SIGNAL_TRAP, VAR_0->c_cpu->cpu_index+1); put_packet(VAR_0, VAR_8); gdb_breakpoint_remove_all(); break; case 'c': if (*VAR_2 != '\0') { addr = strtoull(VAR_2, (char **)&VAR_2, 16); #if defined(TARGET_I386) VAR_0->c_cpu->eip = addr; #elif defined (TARGET_PPC) VAR_0->c_cpu->nip = addr; #elif defined (TARGET_SPARC) VAR_0->c_cpu->pc = addr; VAR_0->c_cpu->npc = addr + 4; #elif defined (TARGET_ARM) VAR_0->c_cpu->regs[15] = addr; #elif defined (TARGET_SH4) VAR_0->c_cpu->pc = addr; #elif defined (TARGET_MIPS) VAR_0->c_cpu->active_tc.PC = addr; #elif defined (TARGET_CRIS) VAR_0->c_cpu->pc = addr; #elif defined (TARGET_ALPHA) VAR_0->c_cpu->pc = addr; #endif } VAR_0->signal = 0; gdb_continue(VAR_0); return RS_IDLE; case 'C': VAR_0->signal = gdb_signal_to_target (strtoul(VAR_2, (char **)&VAR_2, 16)); if (VAR_0->signal == -1) VAR_0->signal = 0; gdb_continue(VAR_0); return RS_IDLE; case 'k': fprintf(stderr, "\nQEMU: Terminated via GDBstub\n"); exit(0); case 'D': gdb_breakpoint_remove_all(); gdb_continue(VAR_0); put_packet(VAR_0, "OK"); break; case 'VAR_0': if (*VAR_2 != '\0') { addr = strtoull(VAR_2, (char **)&VAR_2, 16); #if defined(TARGET_I386) VAR_0->c_cpu->eip = addr; #elif defined (TARGET_PPC) VAR_0->c_cpu->nip = addr; #elif defined (TARGET_SPARC) VAR_0->c_cpu->pc = addr; VAR_0->c_cpu->npc = addr + 4; #elif defined (TARGET_ARM) VAR_0->c_cpu->regs[15] = addr; #elif defined (TARGET_SH4) VAR_0->c_cpu->pc = addr; #elif defined (TARGET_MIPS) VAR_0->c_cpu->active_tc.PC = addr; #elif defined (TARGET_CRIS) VAR_0->c_cpu->pc = addr; #elif defined (TARGET_ALPHA) VAR_0->c_cpu->pc = addr; #endif } cpu_single_step(VAR_0->c_cpu, sstep_flags); gdb_continue(VAR_0); return RS_IDLE; case 'F': { target_ulong ret; target_ulong err; ret = strtoull(VAR_2, (char **)&VAR_2, 16); if (*VAR_2 == ',') { VAR_2++; err = strtoull(VAR_2, (char **)&VAR_2, 16); } else { err = 0; } if (*VAR_2 == ',') VAR_2++; VAR_5 = *VAR_2; if (gdb_current_syscall_cb) gdb_current_syscall_cb(VAR_0->c_cpu, ret, err); if (VAR_5 == 'C') { put_packet(VAR_0, "T02"); } else { gdb_continue(VAR_0); } } break; case 'g': len = 0; for (addr = 0; addr < num_g_regs; addr++) { VAR_4 = gdb_read_register(VAR_0->g_cpu, mem_buf + len, addr); len += VAR_4; } memtohex(VAR_8, mem_buf, len); put_packet(VAR_0, VAR_8); break; case 'G': registers = mem_buf; len = strlen(VAR_2) / 2; hextomem((uint8_t *)registers, VAR_2, len); for (addr = 0; addr < num_g_regs && len > 0; addr++) { VAR_4 = gdb_write_register(VAR_0->g_cpu, registers, addr); len -= VAR_4; registers += VAR_4; } put_packet(VAR_0, "OK"); break; case 'm': addr = strtoull(VAR_2, (char **)&VAR_2, 16); if (*VAR_2 == ',') VAR_2++; len = strtoull(VAR_2, NULL, 16); if (cpu_memory_rw_debug(VAR_0->g_cpu, addr, mem_buf, len, 0) != 0) { put_packet (VAR_0, "E14"); } else { memtohex(VAR_8, mem_buf, len); put_packet(VAR_0, VAR_8); } break; case 'M': addr = strtoull(VAR_2, (char **)&VAR_2, 16); if (*VAR_2 == ',') VAR_2++; len = strtoull(VAR_2, (char **)&VAR_2, 16); if (*VAR_2 == ':') VAR_2++; hextomem(mem_buf, VAR_2, len); if (cpu_memory_rw_debug(VAR_0->g_cpu, addr, mem_buf, len, 1) != 0) put_packet(VAR_0, "E14"); else put_packet(VAR_0, "OK"); break; case 'VAR_2': if (!gdb_has_xml) goto unknown_command; addr = strtoull(VAR_2, (char **)&VAR_2, 16); VAR_4 = gdb_read_register(VAR_0->g_cpu, mem_buf, addr); if (VAR_4) { memtohex(VAR_8, mem_buf, VAR_4); put_packet(VAR_0, VAR_8); } else { put_packet(VAR_0, "E14"); } break; case 'P': if (!gdb_has_xml) goto unknown_command; addr = strtoull(VAR_2, (char **)&VAR_2, 16); if (*VAR_2 == '=') VAR_2++; VAR_4 = strlen(VAR_2) / 2; hextomem(mem_buf, VAR_2, VAR_4); gdb_write_register(VAR_0->g_cpu, mem_buf, addr); put_packet(VAR_0, "OK"); break; case 'Z': case 'z': VAR_5 = strtoul(VAR_2, (char **)&VAR_2, 16); if (*VAR_2 == ',') VAR_2++; addr = strtoull(VAR_2, (char **)&VAR_2, 16); if (*VAR_2 == ',') VAR_2++; len = strtoull(VAR_2, (char **)&VAR_2, 16); if (VAR_3 == 'Z') VAR_6 = gdb_breakpoint_insert(addr, len, VAR_5); else VAR_6 = gdb_breakpoint_remove(addr, len, VAR_5); if (VAR_6 >= 0) put_packet(VAR_0, "OK"); else if (VAR_6 == -ENOSYS) put_packet(VAR_0, ""); else put_packet(VAR_0, "E22"); break; case 'H': VAR_5 = *VAR_2++; VAR_7 = strtoull(VAR_2, (char **)&VAR_2, 16); if (VAR_7 == -1 || VAR_7 == 0) { put_packet(VAR_0, "OK"); break; } for (env = first_cpu; env != NULL; env = env->next_cpu) if (env->cpu_index + 1 == VAR_7) break; if (env == NULL) { put_packet(VAR_0, "E22"); break; } switch (VAR_5) { case 'c': VAR_0->c_cpu = env; put_packet(VAR_0, "OK"); break; case 'g': VAR_0->g_cpu = env; put_packet(VAR_0, "OK"); break; default: put_packet(VAR_0, "E22"); break; } break; case 'T': VAR_7 = strtoull(VAR_2, (char **)&VAR_2, 16); #ifndef CONFIG_USER_ONLY if (VAR_7 > 0 && VAR_7 < smp_cpus + 1) #else if (VAR_7 == 1) #endif put_packet(VAR_0, "OK"); else put_packet(VAR_0, "E22"); break; case 'q': case 'Q': if (!strcmp(VAR_2,"qemu.sstepbits")) { snprintf(VAR_8, sizeof(VAR_8), "ENABLE=%x,NOIRQ=%x,NOTIMER=%x", SSTEP_ENABLE, SSTEP_NOIRQ, SSTEP_NOTIMER); put_packet(VAR_0, VAR_8); break; } else if (strncmp(VAR_2,"qemu.sstep",10) == 0) { VAR_2 += 10; if (*VAR_2 != '=') { snprintf(VAR_8, sizeof(VAR_8), "0x%x", sstep_flags); put_packet(VAR_0, VAR_8); break; } VAR_2++; VAR_5 = strtoul(VAR_2, (char **)&VAR_2, 16); sstep_flags = VAR_5; put_packet(VAR_0, "OK"); break; } else if (strcmp(VAR_2,"C") == 0) { put_packet(VAR_0, "QC1"); break; } else if (strcmp(VAR_2,"fThreadInfo") == 0) { VAR_0->query_cpu = first_cpu; goto report_cpuinfo; } else if (strcmp(VAR_2,"sThreadInfo") == 0) { report_cpuinfo: if (VAR_0->query_cpu) { snprintf(VAR_8, sizeof(VAR_8), "m%x", VAR_0->query_cpu->cpu_index+1); put_packet(VAR_0, VAR_8); VAR_0->query_cpu = VAR_0->query_cpu->next_cpu; } else put_packet(VAR_0, "l"); break; } else if (strncmp(VAR_2,"ThreadExtraInfo,", 16) == 0) { VAR_7 = strtoull(VAR_2+16, (char **)&VAR_2, 16); for (env = first_cpu; env != NULL; env = env->next_cpu) if (env->cpu_index + 1 == VAR_7) { len = snprintf((char *)mem_buf, sizeof(mem_buf), "CPU#%d [%VAR_0]", env->cpu_index, env->halted ? "halted " : "running"); memtohex(VAR_8, mem_buf, len); put_packet(VAR_0, VAR_8); break; } break; } #ifdef CONFIG_LINUX_USER else if (strncmp(VAR_2, "Offsets", 7) == 0) { TaskState *ts = VAR_0->c_cpu->opaque; snprintf(VAR_8, sizeof(VAR_8), "Text=" TARGET_ABI_FMT_lx ";Data=" TARGET_ABI_FMT_lx ";Bss=" TARGET_ABI_FMT_lx, ts->info->code_offset, ts->info->data_offset, ts->info->data_offset); put_packet(VAR_0, VAR_8); break; } #endif if (strncmp(VAR_2, "Supported", 9) == 0) { snprintf(VAR_8, sizeof(VAR_8), "PacketSize=%x", MAX_PACKET_LENGTH); #ifdef GDB_CORE_XML strcat(VAR_8, ";qXfer:features:read+"); #endif put_packet(VAR_0, VAR_8); break; } #ifdef GDB_CORE_XML if (strncmp(VAR_2, "Xfer:features:read:", 19) == 0) { const char *xml; target_ulong total_len; gdb_has_xml = 1; VAR_2 += 19; xml = get_feature_xml(VAR_2, &VAR_2); if (!xml) { snprintf(VAR_8, sizeof(VAR_8), "E00"); put_packet(VAR_0, VAR_8); break; } if (*VAR_2 == ':') VAR_2++; addr = strtoul(VAR_2, (char **)&VAR_2, 16); if (*VAR_2 == ',') VAR_2++; len = strtoul(VAR_2, (char **)&VAR_2, 16); total_len = strlen(xml); if (addr > total_len) { snprintf(VAR_8, sizeof(VAR_8), "E00"); put_packet(VAR_0, VAR_8); break; } if (len > (MAX_PACKET_LENGTH - 5) / 2) len = (MAX_PACKET_LENGTH - 5) / 2; if (len < total_len - addr) { VAR_8[0] = 'm'; len = memtox(VAR_8 + 1, xml + addr, len); } else { VAR_8[0] = 'l'; len = memtox(VAR_8 + 1, xml + addr, total_len - addr); } put_packet_binary(VAR_0, VAR_8, len + 1); break; } #endif goto unknown_command; default: unknown_command: VAR_8[0] = '\0'; put_packet(VAR_0, VAR_8); break; } return RS_IDLE; }
[ "static int FUNC_0(GDBState *VAR_0, const char *VAR_1)\n{", "CPUState *env;", "const char *VAR_2;", "int VAR_3, VAR_4, VAR_5, VAR_6, VAR_7;", "char VAR_8[MAX_PACKET_LENGTH];", "uint8_t mem_buf[MAX_PACKET_LENGTH];", "uint8_t *registers;", "target_ulong addr, len;", "#ifdef DEBUG_GDB\nprintf(\"command='%VAR_0'\\n\", VAR_1);", "#endif\nVAR_2 = VAR_1;", "VAR_3 = *VAR_2++;", "switch(VAR_3) {", "case '?':\nsnprintf(VAR_8, sizeof(VAR_8), \"T%02xthread:%02x;\", GDB_SIGNAL_TRAP,", "VAR_0->c_cpu->cpu_index+1);", "put_packet(VAR_0, VAR_8);", "gdb_breakpoint_remove_all();", "break;", "case 'c':\nif (*VAR_2 != '\\0') {", "addr = strtoull(VAR_2, (char **)&VAR_2, 16);", "#if defined(TARGET_I386)\nVAR_0->c_cpu->eip = addr;", "#elif defined (TARGET_PPC)\nVAR_0->c_cpu->nip = addr;", "#elif defined (TARGET_SPARC)\nVAR_0->c_cpu->pc = addr;", "VAR_0->c_cpu->npc = addr + 4;", "#elif defined (TARGET_ARM)\nVAR_0->c_cpu->regs[15] = addr;", "#elif defined (TARGET_SH4)\nVAR_0->c_cpu->pc = addr;", "#elif defined (TARGET_MIPS)\nVAR_0->c_cpu->active_tc.PC = addr;", "#elif defined (TARGET_CRIS)\nVAR_0->c_cpu->pc = addr;", "#elif defined (TARGET_ALPHA)\nVAR_0->c_cpu->pc = addr;", "#endif\n}", "VAR_0->signal = 0;", "gdb_continue(VAR_0);", "return RS_IDLE;", "case 'C':\nVAR_0->signal = gdb_signal_to_target (strtoul(VAR_2, (char **)&VAR_2, 16));", "if (VAR_0->signal == -1)\nVAR_0->signal = 0;", "gdb_continue(VAR_0);", "return RS_IDLE;", "case 'k':\nfprintf(stderr, \"\\nQEMU: Terminated via GDBstub\\n\");", "exit(0);", "case 'D':\ngdb_breakpoint_remove_all();", "gdb_continue(VAR_0);", "put_packet(VAR_0, \"OK\");", "break;", "case 'VAR_0':\nif (*VAR_2 != '\\0') {", "addr = strtoull(VAR_2, (char **)&VAR_2, 16);", "#if defined(TARGET_I386)\nVAR_0->c_cpu->eip = addr;", "#elif defined (TARGET_PPC)\nVAR_0->c_cpu->nip = addr;", "#elif defined (TARGET_SPARC)\nVAR_0->c_cpu->pc = addr;", "VAR_0->c_cpu->npc = addr + 4;", "#elif defined (TARGET_ARM)\nVAR_0->c_cpu->regs[15] = addr;", "#elif defined (TARGET_SH4)\nVAR_0->c_cpu->pc = addr;", "#elif defined (TARGET_MIPS)\nVAR_0->c_cpu->active_tc.PC = addr;", "#elif defined (TARGET_CRIS)\nVAR_0->c_cpu->pc = addr;", "#elif defined (TARGET_ALPHA)\nVAR_0->c_cpu->pc = addr;", "#endif\n}", "cpu_single_step(VAR_0->c_cpu, sstep_flags);", "gdb_continue(VAR_0);", "return RS_IDLE;", "case 'F':\n{", "target_ulong ret;", "target_ulong err;", "ret = strtoull(VAR_2, (char **)&VAR_2, 16);", "if (*VAR_2 == ',') {", "VAR_2++;", "err = strtoull(VAR_2, (char **)&VAR_2, 16);", "} else {", "err = 0;", "}", "if (*VAR_2 == ',')\nVAR_2++;", "VAR_5 = *VAR_2;", "if (gdb_current_syscall_cb)\ngdb_current_syscall_cb(VAR_0->c_cpu, ret, err);", "if (VAR_5 == 'C') {", "put_packet(VAR_0, \"T02\");", "} else {", "gdb_continue(VAR_0);", "}", "}", "break;", "case 'g':\nlen = 0;", "for (addr = 0; addr < num_g_regs; addr++) {", "VAR_4 = gdb_read_register(VAR_0->g_cpu, mem_buf + len, addr);", "len += VAR_4;", "}", "memtohex(VAR_8, mem_buf, len);", "put_packet(VAR_0, VAR_8);", "break;", "case 'G':\nregisters = mem_buf;", "len = strlen(VAR_2) / 2;", "hextomem((uint8_t *)registers, VAR_2, len);", "for (addr = 0; addr < num_g_regs && len > 0; addr++) {", "VAR_4 = gdb_write_register(VAR_0->g_cpu, registers, addr);", "len -= VAR_4;", "registers += VAR_4;", "}", "put_packet(VAR_0, \"OK\");", "break;", "case 'm':\naddr = strtoull(VAR_2, (char **)&VAR_2, 16);", "if (*VAR_2 == ',')\nVAR_2++;", "len = strtoull(VAR_2, NULL, 16);", "if (cpu_memory_rw_debug(VAR_0->g_cpu, addr, mem_buf, len, 0) != 0) {", "put_packet (VAR_0, \"E14\");", "} else {", "memtohex(VAR_8, mem_buf, len);", "put_packet(VAR_0, VAR_8);", "}", "break;", "case 'M':\naddr = strtoull(VAR_2, (char **)&VAR_2, 16);", "if (*VAR_2 == ',')\nVAR_2++;", "len = strtoull(VAR_2, (char **)&VAR_2, 16);", "if (*VAR_2 == ':')\nVAR_2++;", "hextomem(mem_buf, VAR_2, len);", "if (cpu_memory_rw_debug(VAR_0->g_cpu, addr, mem_buf, len, 1) != 0)\nput_packet(VAR_0, \"E14\");", "else\nput_packet(VAR_0, \"OK\");", "break;", "case 'VAR_2':\nif (!gdb_has_xml)\ngoto unknown_command;", "addr = strtoull(VAR_2, (char **)&VAR_2, 16);", "VAR_4 = gdb_read_register(VAR_0->g_cpu, mem_buf, addr);", "if (VAR_4) {", "memtohex(VAR_8, mem_buf, VAR_4);", "put_packet(VAR_0, VAR_8);", "} else {", "put_packet(VAR_0, \"E14\");", "}", "break;", "case 'P':\nif (!gdb_has_xml)\ngoto unknown_command;", "addr = strtoull(VAR_2, (char **)&VAR_2, 16);", "if (*VAR_2 == '=')\nVAR_2++;", "VAR_4 = strlen(VAR_2) / 2;", "hextomem(mem_buf, VAR_2, VAR_4);", "gdb_write_register(VAR_0->g_cpu, mem_buf, addr);", "put_packet(VAR_0, \"OK\");", "break;", "case 'Z':\ncase 'z':\nVAR_5 = strtoul(VAR_2, (char **)&VAR_2, 16);", "if (*VAR_2 == ',')\nVAR_2++;", "addr = strtoull(VAR_2, (char **)&VAR_2, 16);", "if (*VAR_2 == ',')\nVAR_2++;", "len = strtoull(VAR_2, (char **)&VAR_2, 16);", "if (VAR_3 == 'Z')\nVAR_6 = gdb_breakpoint_insert(addr, len, VAR_5);", "else\nVAR_6 = gdb_breakpoint_remove(addr, len, VAR_5);", "if (VAR_6 >= 0)\nput_packet(VAR_0, \"OK\");", "else if (VAR_6 == -ENOSYS)\nput_packet(VAR_0, \"\");", "else\nput_packet(VAR_0, \"E22\");", "break;", "case 'H':\nVAR_5 = *VAR_2++;", "VAR_7 = strtoull(VAR_2, (char **)&VAR_2, 16);", "if (VAR_7 == -1 || VAR_7 == 0) {", "put_packet(VAR_0, \"OK\");", "break;", "}", "for (env = first_cpu; env != NULL; env = env->next_cpu)", "if (env->cpu_index + 1 == VAR_7)\nbreak;", "if (env == NULL) {", "put_packet(VAR_0, \"E22\");", "break;", "}", "switch (VAR_5) {", "case 'c':\nVAR_0->c_cpu = env;", "put_packet(VAR_0, \"OK\");", "break;", "case 'g':\nVAR_0->g_cpu = env;", "put_packet(VAR_0, \"OK\");", "break;", "default:\nput_packet(VAR_0, \"E22\");", "break;", "}", "break;", "case 'T':\nVAR_7 = strtoull(VAR_2, (char **)&VAR_2, 16);", "#ifndef CONFIG_USER_ONLY\nif (VAR_7 > 0 && VAR_7 < smp_cpus + 1)\n#else\nif (VAR_7 == 1)\n#endif\nput_packet(VAR_0, \"OK\");", "else\nput_packet(VAR_0, \"E22\");", "break;", "case 'q':\ncase 'Q':\nif (!strcmp(VAR_2,\"qemu.sstepbits\")) {", "snprintf(VAR_8, sizeof(VAR_8), \"ENABLE=%x,NOIRQ=%x,NOTIMER=%x\",\nSSTEP_ENABLE,\nSSTEP_NOIRQ,\nSSTEP_NOTIMER);", "put_packet(VAR_0, VAR_8);", "break;", "} else if (strncmp(VAR_2,\"qemu.sstep\",10) == 0) {", "VAR_2 += 10;", "if (*VAR_2 != '=') {", "snprintf(VAR_8, sizeof(VAR_8), \"0x%x\", sstep_flags);", "put_packet(VAR_0, VAR_8);", "break;", "}", "VAR_2++;", "VAR_5 = strtoul(VAR_2, (char **)&VAR_2, 16);", "sstep_flags = VAR_5;", "put_packet(VAR_0, \"OK\");", "break;", "} else if (strcmp(VAR_2,\"C\") == 0) {", "put_packet(VAR_0, \"QC1\");", "break;", "} else if (strcmp(VAR_2,\"fThreadInfo\") == 0) {", "VAR_0->query_cpu = first_cpu;", "goto report_cpuinfo;", "} else if (strcmp(VAR_2,\"sThreadInfo\") == 0) {", "report_cpuinfo:\nif (VAR_0->query_cpu) {", "snprintf(VAR_8, sizeof(VAR_8), \"m%x\", VAR_0->query_cpu->cpu_index+1);", "put_packet(VAR_0, VAR_8);", "VAR_0->query_cpu = VAR_0->query_cpu->next_cpu;", "} else", "put_packet(VAR_0, \"l\");", "break;", "} else if (strncmp(VAR_2,\"ThreadExtraInfo,\", 16) == 0) {", "VAR_7 = strtoull(VAR_2+16, (char **)&VAR_2, 16);", "for (env = first_cpu; env != NULL; env = env->next_cpu)", "if (env->cpu_index + 1 == VAR_7) {", "len = snprintf((char *)mem_buf, sizeof(mem_buf),\n\"CPU#%d [%VAR_0]\", env->cpu_index,\nenv->halted ? \"halted \" : \"running\");", "memtohex(VAR_8, mem_buf, len);", "put_packet(VAR_0, VAR_8);", "break;", "}", "break;", "}", "#ifdef CONFIG_LINUX_USER\nelse if (strncmp(VAR_2, \"Offsets\", 7) == 0) {", "TaskState *ts = VAR_0->c_cpu->opaque;", "snprintf(VAR_8, sizeof(VAR_8),\n\"Text=\" TARGET_ABI_FMT_lx \";Data=\" TARGET_ABI_FMT_lx", "\";Bss=\" TARGET_ABI_FMT_lx,", "ts->info->code_offset,\nts->info->data_offset,\nts->info->data_offset);", "put_packet(VAR_0, VAR_8);", "break;", "}", "#endif\nif (strncmp(VAR_2, \"Supported\", 9) == 0) {", "snprintf(VAR_8, sizeof(VAR_8), \"PacketSize=%x\", MAX_PACKET_LENGTH);", "#ifdef GDB_CORE_XML\nstrcat(VAR_8, \";qXfer:features:read+\");", "#endif\nput_packet(VAR_0, VAR_8);", "break;", "}", "#ifdef GDB_CORE_XML\nif (strncmp(VAR_2, \"Xfer:features:read:\", 19) == 0) {", "const char *xml;", "target_ulong total_len;", "gdb_has_xml = 1;", "VAR_2 += 19;", "xml = get_feature_xml(VAR_2, &VAR_2);", "if (!xml) {", "snprintf(VAR_8, sizeof(VAR_8), \"E00\");", "put_packet(VAR_0, VAR_8);", "break;", "}", "if (*VAR_2 == ':')\nVAR_2++;", "addr = strtoul(VAR_2, (char **)&VAR_2, 16);", "if (*VAR_2 == ',')\nVAR_2++;", "len = strtoul(VAR_2, (char **)&VAR_2, 16);", "total_len = strlen(xml);", "if (addr > total_len) {", "snprintf(VAR_8, sizeof(VAR_8), \"E00\");", "put_packet(VAR_0, VAR_8);", "break;", "}", "if (len > (MAX_PACKET_LENGTH - 5) / 2)\nlen = (MAX_PACKET_LENGTH - 5) / 2;", "if (len < total_len - addr) {", "VAR_8[0] = 'm';", "len = memtox(VAR_8 + 1, xml + addr, len);", "} else {", "VAR_8[0] = 'l';", "len = memtox(VAR_8 + 1, xml + addr, total_len - addr);", "}", "put_packet_binary(VAR_0, VAR_8, len + 1);", "break;", "}", "#endif\ngoto unknown_command;", "default:\nunknown_command:\nVAR_8[0] = '\\0';", "put_packet(VAR_0, VAR_8);", "break;", "}", "return RS_IDLE;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21, 23 ], [ 25, 27 ], [ 29 ], [ 31 ], [ 33, 37 ], [ 39 ], [ 41 ], [ 51 ], [ 53 ], [ 55, 57 ], [ 59 ], [ 61, 63 ], [ 65, 67 ], [ 69, 71 ], [ 73 ], [ 75, 77 ], [ 79, 81 ], [ 83, 85 ], [ 87, 89 ], [ 91, 93 ], [ 95, 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105, 107 ], [ 109, 111 ], [ 113 ], [ 115 ], [ 117, 121 ], [ 123 ], [ 125, 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137, 139 ], [ 141 ], [ 143, 145 ], [ 147, 149 ], [ 151, 153 ], [ 155 ], [ 157, 159 ], [ 161, 163 ], [ 165, 167 ], [ 169, 171 ], [ 173, 175 ], [ 177, 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187, 189 ], [ 191 ], [ 193 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ], [ 211, 213 ], [ 215 ], [ 217, 219 ], [ 221 ], [ 223 ], [ 225 ], [ 227 ], [ 229 ], [ 231 ], [ 233 ], [ 235, 237 ], [ 239 ], [ 241 ], [ 243 ], [ 245 ], [ 247 ], [ 249 ], [ 251 ], [ 253, 255 ], [ 257 ], [ 259 ], [ 261 ], [ 263 ], [ 265 ], [ 267 ], [ 269 ], [ 271 ], [ 273 ], [ 275, 277 ], [ 279, 281 ], [ 283 ], [ 285 ], [ 287 ], [ 289 ], [ 291 ], [ 293 ], [ 295 ], [ 297 ], [ 299, 301 ], [ 303, 305 ], [ 307 ], [ 309, 311 ], [ 313 ], [ 315, 317 ], [ 319, 321 ], [ 323 ], [ 325, 333, 335 ], [ 337 ], [ 339 ], [ 341 ], [ 343 ], [ 345 ], [ 347 ], [ 349 ], [ 351 ], [ 353 ], [ 355, 357, 359 ], [ 361 ], [ 363, 365 ], [ 367 ], [ 369 ], [ 371 ], [ 373 ], [ 375 ], [ 377, 379, 381 ], [ 383, 385 ], [ 387 ], [ 389, 391 ], [ 393 ], [ 395, 397 ], [ 399, 401 ], [ 403, 405 ], [ 407, 409 ], [ 411, 413 ], [ 415 ], [ 417, 419 ], [ 421 ], [ 423 ], [ 425 ], [ 427 ], [ 429 ], [ 431 ], [ 433, 435 ], [ 437 ], [ 439 ], [ 441 ], [ 443 ], [ 445 ], [ 447, 449 ], [ 451 ], [ 453 ], [ 455, 457 ], [ 459 ], [ 461 ], [ 463, 465 ], [ 467 ], [ 469 ], [ 471 ], [ 473, 475 ], [ 477, 479, 481, 483, 485, 487 ], [ 489, 491 ], [ 493 ], [ 495, 497, 501 ], [ 505, 507, 509, 511 ], [ 513 ], [ 515 ], [ 517 ], [ 521 ], [ 523 ], [ 527 ], [ 529 ], [ 531 ], [ 533 ], [ 535 ], [ 537 ], [ 539 ], [ 541 ], [ 543 ], [ 545 ], [ 551 ], [ 553 ], [ 555 ], [ 557 ], [ 559 ], [ 561 ], [ 563, 565 ], [ 567 ], [ 569 ], [ 571 ], [ 573 ], [ 575 ], [ 577 ], [ 579 ], [ 581 ], [ 583 ], [ 585 ], [ 587, 589, 591 ], [ 593 ], [ 595 ], [ 597 ], [ 599 ], [ 601 ], [ 603 ], [ 605, 607 ], [ 609 ], [ 613, 615 ], [ 617 ], [ 619, 621, 623 ], [ 625 ], [ 627 ], [ 629 ], [ 631, 633 ], [ 635 ], [ 637, 639 ], [ 641, 643 ], [ 645 ], [ 647 ], [ 649, 651 ], [ 653 ], [ 655 ], [ 659 ], [ 661 ], [ 663 ], [ 665 ], [ 667 ], [ 669 ], [ 671 ], [ 673 ], [ 677, 679 ], [ 681 ], [ 683, 685 ], [ 687 ], [ 691 ], [ 693 ], [ 695 ], [ 697 ], [ 699 ], [ 701 ], [ 703, 705 ], [ 707 ], [ 709 ], [ 711 ], [ 713 ], [ 715 ], [ 717 ], [ 719 ], [ 721 ], [ 723 ], [ 725 ], [ 727, 731 ], [ 735, 737, 741 ], [ 743 ], [ 745 ], [ 747 ], [ 749 ], [ 751 ] ]
20,076
static void s390_memory_init(ram_addr_t mem_size) { MemoryRegion *sysmem = get_system_memory(); MemoryRegion *ram = g_new(MemoryRegion, 1); /* allocate RAM for core */ memory_region_allocate_system_memory(ram, NULL, "s390.ram", mem_size); memory_region_add_subregion(sysmem, 0, ram); /* Initialize storage key device */ s390_skeys_init(); /* Initialize storage attributes device */ s390_stattrib_init(); }
false
qemu
bb223055b9b327ec66e1f6d2fbaebaee0b8f3dbe
static void s390_memory_init(ram_addr_t mem_size) { MemoryRegion *sysmem = get_system_memory(); MemoryRegion *ram = g_new(MemoryRegion, 1); memory_region_allocate_system_memory(ram, NULL, "s390.ram", mem_size); memory_region_add_subregion(sysmem, 0, ram); s390_skeys_init(); s390_stattrib_init(); }
{ "code": [], "line_no": [] }
static void FUNC_0(ram_addr_t VAR_0) { MemoryRegion *sysmem = get_system_memory(); MemoryRegion *ram = g_new(MemoryRegion, 1); memory_region_allocate_system_memory(ram, NULL, "s390.ram", VAR_0); memory_region_add_subregion(sysmem, 0, ram); s390_skeys_init(); s390_stattrib_init(); }
[ "static void FUNC_0(ram_addr_t VAR_0)\n{", "MemoryRegion *sysmem = get_system_memory();", "MemoryRegion *ram = g_new(MemoryRegion, 1);", "memory_region_allocate_system_memory(ram, NULL, \"s390.ram\", VAR_0);", "memory_region_add_subregion(sysmem, 0, ram);", "s390_skeys_init();", "s390_stattrib_init();", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 13 ], [ 15 ], [ 21 ], [ 25 ], [ 27 ] ]
20,078
static int read_braindead_odml_indx(AVFormatContext *s, int frame_num){ AVIContext *avi = s->priv_data; AVIOContext *pb = s->pb; int longs_pre_entry= avio_rl16(pb); int index_sub_type = avio_r8(pb); int index_type = avio_r8(pb); int entries_in_use = avio_rl32(pb); int chunk_id = avio_rl32(pb); int64_t base = avio_rl64(pb); int stream_id= 10*((chunk_id&0xFF) - '0') + (((chunk_id>>8)&0xFF) - '0'); AVStream *st; AVIStream *ast; int i; int64_t last_pos= -1; int64_t filesize= avio_size(s->pb); av_dlog(s, "longs_pre_entry:%d index_type:%d entries_in_use:%d chunk_id:%X base:%16"PRIX64"\n", longs_pre_entry,index_type, entries_in_use, chunk_id, base); if(stream_id >= s->nb_streams || stream_id < 0) return -1; st= s->streams[stream_id]; ast = st->priv_data; if(index_sub_type) return -1; avio_rl32(pb); if(index_type && longs_pre_entry != 2) return -1; if(index_type>1) return -1; if(filesize > 0 && base >= filesize){ av_log(s, AV_LOG_ERROR, "ODML index invalid\n"); if(base>>32 == (base & 0xFFFFFFFF) && (base & 0xFFFFFFFF) < filesize && filesize <= 0xFFFFFFFF) base &= 0xFFFFFFFF; else return -1; } for(i=0; i<entries_in_use; i++){ if(index_type){ int64_t pos= avio_rl32(pb) + base - 8; int len = avio_rl32(pb); int key= len >= 0; len &= 0x7FFFFFFF; av_dlog(s, "pos:%"PRId64", len:%X\n", pos, len); if(pb->eof_reached) return -1; if(last_pos == pos || pos == base - 8) avi->non_interleaved= 1; if(last_pos != pos && (len || !ast->sample_size)) av_add_index_entry(st, pos, ast->cum_len, len, 0, key ? AVINDEX_KEYFRAME : 0); ast->cum_len += get_duration(ast, len); last_pos= pos; }else{ int64_t offset, pos; int duration; offset = avio_rl64(pb); avio_rl32(pb); /* size */ duration = avio_rl32(pb); if(pb->eof_reached) return -1; pos = avio_tell(pb); if(avi->odml_depth > MAX_ODML_DEPTH){ av_log(s, AV_LOG_ERROR, "Too deeply nested ODML indexes\n"); return -1; } avio_seek(pb, offset+8, SEEK_SET); avi->odml_depth++; read_braindead_odml_indx(s, frame_num); avi->odml_depth--; frame_num += duration; avio_seek(pb, pos, SEEK_SET); } } avi->index_loaded=1; return 0; }
false
FFmpeg
570a4a0189946c2c983da41d37fdd67fa13266e7
static int read_braindead_odml_indx(AVFormatContext *s, int frame_num){ AVIContext *avi = s->priv_data; AVIOContext *pb = s->pb; int longs_pre_entry= avio_rl16(pb); int index_sub_type = avio_r8(pb); int index_type = avio_r8(pb); int entries_in_use = avio_rl32(pb); int chunk_id = avio_rl32(pb); int64_t base = avio_rl64(pb); int stream_id= 10*((chunk_id&0xFF) - '0') + (((chunk_id>>8)&0xFF) - '0'); AVStream *st; AVIStream *ast; int i; int64_t last_pos= -1; int64_t filesize= avio_size(s->pb); av_dlog(s, "longs_pre_entry:%d index_type:%d entries_in_use:%d chunk_id:%X base:%16"PRIX64"\n", longs_pre_entry,index_type, entries_in_use, chunk_id, base); if(stream_id >= s->nb_streams || stream_id < 0) return -1; st= s->streams[stream_id]; ast = st->priv_data; if(index_sub_type) return -1; avio_rl32(pb); if(index_type && longs_pre_entry != 2) return -1; if(index_type>1) return -1; if(filesize > 0 && base >= filesize){ av_log(s, AV_LOG_ERROR, "ODML index invalid\n"); if(base>>32 == (base & 0xFFFFFFFF) && (base & 0xFFFFFFFF) < filesize && filesize <= 0xFFFFFFFF) base &= 0xFFFFFFFF; else return -1; } for(i=0; i<entries_in_use; i++){ if(index_type){ int64_t pos= avio_rl32(pb) + base - 8; int len = avio_rl32(pb); int key= len >= 0; len &= 0x7FFFFFFF; av_dlog(s, "pos:%"PRId64", len:%X\n", pos, len); if(pb->eof_reached) return -1; if(last_pos == pos || pos == base - 8) avi->non_interleaved= 1; if(last_pos != pos && (len || !ast->sample_size)) av_add_index_entry(st, pos, ast->cum_len, len, 0, key ? AVINDEX_KEYFRAME : 0); ast->cum_len += get_duration(ast, len); last_pos= pos; }else{ int64_t offset, pos; int duration; offset = avio_rl64(pb); avio_rl32(pb); duration = avio_rl32(pb); if(pb->eof_reached) return -1; pos = avio_tell(pb); if(avi->odml_depth > MAX_ODML_DEPTH){ av_log(s, AV_LOG_ERROR, "Too deeply nested ODML indexes\n"); return -1; } avio_seek(pb, offset+8, SEEK_SET); avi->odml_depth++; read_braindead_odml_indx(s, frame_num); avi->odml_depth--; frame_num += duration; avio_seek(pb, pos, SEEK_SET); } } avi->index_loaded=1; return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVFormatContext *VAR_0, int VAR_1){ AVIContext *avi = VAR_0->priv_data; AVIOContext *pb = VAR_0->pb; int VAR_2= avio_rl16(pb); int VAR_3 = avio_r8(pb); int VAR_4 = avio_r8(pb); int VAR_5 = avio_rl32(pb); int VAR_6 = avio_rl32(pb); int64_t base = avio_rl64(pb); int VAR_7= 10*((VAR_6&0xFF) - '0') + (((VAR_6>>8)&0xFF) - '0'); AVStream *st; AVIStream *ast; int VAR_8; int64_t last_pos= -1; int64_t filesize= avio_size(VAR_0->pb); av_dlog(VAR_0, "VAR_2:%d VAR_4:%d VAR_5:%d VAR_6:%X base:%16"PRIX64"\n", VAR_2,VAR_4, VAR_5, VAR_6, base); if(VAR_7 >= VAR_0->nb_streams || VAR_7 < 0) return -1; st= VAR_0->streams[VAR_7]; ast = st->priv_data; if(VAR_3) return -1; avio_rl32(pb); if(VAR_4 && VAR_2 != 2) return -1; if(VAR_4>1) return -1; if(filesize > 0 && base >= filesize){ av_log(VAR_0, AV_LOG_ERROR, "ODML index invalid\n"); if(base>>32 == (base & 0xFFFFFFFF) && (base & 0xFFFFFFFF) < filesize && filesize <= 0xFFFFFFFF) base &= 0xFFFFFFFF; else return -1; } for(VAR_8=0; VAR_8<VAR_5; VAR_8++){ if(VAR_4){ int64_t pos= avio_rl32(pb) + base - 8; int VAR_9 = avio_rl32(pb); int VAR_10= VAR_9 >= 0; VAR_9 &= 0x7FFFFFFF; av_dlog(VAR_0, "pos:%"PRId64", VAR_9:%X\n", pos, VAR_9); if(pb->eof_reached) return -1; if(last_pos == pos || pos == base - 8) avi->non_interleaved= 1; if(last_pos != pos && (VAR_9 || !ast->sample_size)) av_add_index_entry(st, pos, ast->cum_len, VAR_9, 0, VAR_10 ? AVINDEX_KEYFRAME : 0); ast->cum_len += get_duration(ast, VAR_9); last_pos= pos; }else{ int64_t offset, pos; int VAR_11; offset = avio_rl64(pb); avio_rl32(pb); VAR_11 = avio_rl32(pb); if(pb->eof_reached) return -1; pos = avio_tell(pb); if(avi->odml_depth > MAX_ODML_DEPTH){ av_log(VAR_0, AV_LOG_ERROR, "Too deeply nested ODML indexes\n"); return -1; } avio_seek(pb, offset+8, SEEK_SET); avi->odml_depth++; FUNC_0(VAR_0, VAR_1); avi->odml_depth--; VAR_1 += VAR_11; avio_seek(pb, pos, SEEK_SET); } } avi->index_loaded=1; return 0; }
[ "static int FUNC_0(AVFormatContext *VAR_0, int VAR_1){", "AVIContext *avi = VAR_0->priv_data;", "AVIOContext *pb = VAR_0->pb;", "int VAR_2= avio_rl16(pb);", "int VAR_3 = avio_r8(pb);", "int VAR_4 = avio_r8(pb);", "int VAR_5 = avio_rl32(pb);", "int VAR_6 = avio_rl32(pb);", "int64_t base = avio_rl64(pb);", "int VAR_7= 10*((VAR_6&0xFF) - '0') + (((VAR_6>>8)&0xFF) - '0');", "AVStream *st;", "AVIStream *ast;", "int VAR_8;", "int64_t last_pos= -1;", "int64_t filesize= avio_size(VAR_0->pb);", "av_dlog(VAR_0, \"VAR_2:%d VAR_4:%d VAR_5:%d VAR_6:%X base:%16\"PRIX64\"\\n\",\nVAR_2,VAR_4, VAR_5, VAR_6, base);", "if(VAR_7 >= VAR_0->nb_streams || VAR_7 < 0)\nreturn -1;", "st= VAR_0->streams[VAR_7];", "ast = st->priv_data;", "if(VAR_3)\nreturn -1;", "avio_rl32(pb);", "if(VAR_4 && VAR_2 != 2)\nreturn -1;", "if(VAR_4>1)\nreturn -1;", "if(filesize > 0 && base >= filesize){", "av_log(VAR_0, AV_LOG_ERROR, \"ODML index invalid\\n\");", "if(base>>32 == (base & 0xFFFFFFFF) && (base & 0xFFFFFFFF) < filesize && filesize <= 0xFFFFFFFF)\nbase &= 0xFFFFFFFF;", "else\nreturn -1;", "}", "for(VAR_8=0; VAR_8<VAR_5; VAR_8++){", "if(VAR_4){", "int64_t pos= avio_rl32(pb) + base - 8;", "int VAR_9 = avio_rl32(pb);", "int VAR_10= VAR_9 >= 0;", "VAR_9 &= 0x7FFFFFFF;", "av_dlog(VAR_0, \"pos:%\"PRId64\", VAR_9:%X\\n\", pos, VAR_9);", "if(pb->eof_reached)\nreturn -1;", "if(last_pos == pos || pos == base - 8)\navi->non_interleaved= 1;", "if(last_pos != pos && (VAR_9 || !ast->sample_size))\nav_add_index_entry(st, pos, ast->cum_len, VAR_9, 0, VAR_10 ? AVINDEX_KEYFRAME : 0);", "ast->cum_len += get_duration(ast, VAR_9);", "last_pos= pos;", "}else{", "int64_t offset, pos;", "int VAR_11;", "offset = avio_rl64(pb);", "avio_rl32(pb);", "VAR_11 = avio_rl32(pb);", "if(pb->eof_reached)\nreturn -1;", "pos = avio_tell(pb);", "if(avi->odml_depth > MAX_ODML_DEPTH){", "av_log(VAR_0, AV_LOG_ERROR, \"Too deeply nested ODML indexes\\n\");", "return -1;", "}", "avio_seek(pb, offset+8, SEEK_SET);", "avi->odml_depth++;", "FUNC_0(VAR_0, VAR_1);", "avi->odml_depth--;", "VAR_1 += VAR_11;", "avio_seek(pb, pos, SEEK_SET);", "}", "}", "avi->index_loaded=1;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1 ], [ 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33, 35 ], [ 39, 41 ], [ 43 ], [ 45 ], [ 49, 51 ], [ 55 ], [ 59, 61 ], [ 63, 65 ], [ 69 ], [ 71 ], [ 73, 75 ], [ 77, 79 ], [ 81 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 99 ], [ 103, 105 ], [ 109, 111 ], [ 113, 115 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 137, 139 ], [ 143 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ] ]
20,079
static void qapi_dealloc_start_list(Visitor *v, const char *name, Error **errp) { QapiDeallocVisitor *qov = to_qov(v); qapi_dealloc_push(qov, NULL); }
false
qemu
d9f62dde1303286b24ac8ce88be27e2b9b9c5f46
static void qapi_dealloc_start_list(Visitor *v, const char *name, Error **errp) { QapiDeallocVisitor *qov = to_qov(v); qapi_dealloc_push(qov, NULL); }
{ "code": [], "line_no": [] }
static void FUNC_0(Visitor *VAR_0, const char *VAR_1, Error **VAR_2) { QapiDeallocVisitor *qov = to_qov(VAR_0); qapi_dealloc_push(qov, NULL); }
[ "static void FUNC_0(Visitor *VAR_0, const char *VAR_1, Error **VAR_2)\n{", "QapiDeallocVisitor *qov = to_qov(VAR_0);", "qapi_dealloc_push(qov, NULL);", "}" ]
[ 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ] ]
20,080
int event_notifier_set_handler(EventNotifier *e, EventNotifierHandler *handler) { return qemu_set_fd_handler(e->fd, (IOHandler *)handler, NULL, e); }
false
qemu
d0cc2fbfa607678866475383c508be84818ceb64
int event_notifier_set_handler(EventNotifier *e, EventNotifierHandler *handler) { return qemu_set_fd_handler(e->fd, (IOHandler *)handler, NULL, e); }
{ "code": [], "line_no": [] }
int FUNC_0(EventNotifier *VAR_0, EventNotifierHandler *VAR_1) { return qemu_set_fd_handler(VAR_0->fd, (IOHandler *)VAR_1, NULL, VAR_0); }
[ "int FUNC_0(EventNotifier *VAR_0,\nEventNotifierHandler *VAR_1)\n{", "return qemu_set_fd_handler(VAR_0->fd, (IOHandler *)VAR_1, NULL, VAR_0);", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ] ]
20,081
static ObjectClass *alpha_cpu_class_by_name(const char *cpu_model) { ObjectClass *oc = NULL; char *typename; int i; if (cpu_model == NULL) { return NULL; } oc = object_class_by_name(cpu_model); if (oc != NULL && object_class_dynamic_cast(oc, TYPE_ALPHA_CPU) != NULL && !object_class_is_abstract(oc)) { return oc; } for (i = 0; i < ARRAY_SIZE(alpha_cpu_aliases); i++) { if (strcmp(cpu_model, alpha_cpu_aliases[i].alias) == 0) { oc = object_class_by_name(alpha_cpu_aliases[i].typename); assert(oc != NULL && !object_class_is_abstract(oc)); return oc; } } typename = g_strdup_printf("%s-" TYPE_ALPHA_CPU, cpu_model); oc = object_class_by_name(typename); g_free(typename); if (oc != NULL && object_class_is_abstract(oc)) { oc = NULL; } return oc; }
false
qemu
82a3d1f81f8e401c6c34cba541970197aba2bb9a
static ObjectClass *alpha_cpu_class_by_name(const char *cpu_model) { ObjectClass *oc = NULL; char *typename; int i; if (cpu_model == NULL) { return NULL; } oc = object_class_by_name(cpu_model); if (oc != NULL && object_class_dynamic_cast(oc, TYPE_ALPHA_CPU) != NULL && !object_class_is_abstract(oc)) { return oc; } for (i = 0; i < ARRAY_SIZE(alpha_cpu_aliases); i++) { if (strcmp(cpu_model, alpha_cpu_aliases[i].alias) == 0) { oc = object_class_by_name(alpha_cpu_aliases[i].typename); assert(oc != NULL && !object_class_is_abstract(oc)); return oc; } } typename = g_strdup_printf("%s-" TYPE_ALPHA_CPU, cpu_model); oc = object_class_by_name(typename); g_free(typename); if (oc != NULL && object_class_is_abstract(oc)) { oc = NULL; } return oc; }
{ "code": [], "line_no": [] }
static ObjectClass *FUNC_0(const char *cpu_model) { ObjectClass *oc = NULL; char *VAR_0; int VAR_1; if (cpu_model == NULL) { return NULL; } oc = object_class_by_name(cpu_model); if (oc != NULL && object_class_dynamic_cast(oc, TYPE_ALPHA_CPU) != NULL && !object_class_is_abstract(oc)) { return oc; } for (VAR_1 = 0; VAR_1 < ARRAY_SIZE(alpha_cpu_aliases); VAR_1++) { if (strcmp(cpu_model, alpha_cpu_aliases[VAR_1].alias) == 0) { oc = object_class_by_name(alpha_cpu_aliases[VAR_1].VAR_0); assert(oc != NULL && !object_class_is_abstract(oc)); return oc; } } VAR_0 = g_strdup_printf("%s-" TYPE_ALPHA_CPU, cpu_model); oc = object_class_by_name(VAR_0); g_free(VAR_0); if (oc != NULL && object_class_is_abstract(oc)) { oc = NULL; } return oc; }
[ "static ObjectClass *FUNC_0(const char *cpu_model)\n{", "ObjectClass *oc = NULL;", "char *VAR_0;", "int VAR_1;", "if (cpu_model == NULL) {", "return NULL;", "}", "oc = object_class_by_name(cpu_model);", "if (oc != NULL && object_class_dynamic_cast(oc, TYPE_ALPHA_CPU) != NULL &&\n!object_class_is_abstract(oc)) {", "return oc;", "}", "for (VAR_1 = 0; VAR_1 < ARRAY_SIZE(alpha_cpu_aliases); VAR_1++) {", "if (strcmp(cpu_model, alpha_cpu_aliases[VAR_1].alias) == 0) {", "oc = object_class_by_name(alpha_cpu_aliases[VAR_1].VAR_0);", "assert(oc != NULL && !object_class_is_abstract(oc));", "return oc;", "}", "}", "VAR_0 = g_strdup_printf(\"%s-\" TYPE_ALPHA_CPU, cpu_model);", "oc = object_class_by_name(VAR_0);", "g_free(VAR_0);", "if (oc != NULL && object_class_is_abstract(oc)) {", "oc = NULL;", "}", "return oc;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23, 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ] ]
20,082
void qmp_migrate(const char *uri, bool has_blk, bool blk, bool has_inc, bool inc, bool has_detach, bool detach, Error **errp) { Error *local_err = NULL; MigrationState *s = migrate_get_current(); MigrationParams params; const char *p; params.blk = has_blk && blk; params.shared = has_inc && inc; if (migration_is_setup_or_active(s->state) || s->state == MIGRATION_STATUS_CANCELLING) { error_setg(errp, QERR_MIGRATION_ACTIVE); return; } if (runstate_check(RUN_STATE_INMIGRATE)) { error_setg(errp, "Guest is waiting for an incoming migration"); return; } if (migration_is_blocked(errp)) { return; } s = migrate_init(&params); if (strstart(uri, "tcp:", &p)) { tcp_start_outgoing_migration(s, p, &local_err); #ifdef CONFIG_RDMA } else if (strstart(uri, "rdma:", &p)) { rdma_start_outgoing_migration(s, p, &local_err); #endif } else if (strstart(uri, "exec:", &p)) { exec_start_outgoing_migration(s, p, &local_err); } else if (strstart(uri, "unix:", &p)) { unix_start_outgoing_migration(s, p, &local_err); } else if (strstart(uri, "fd:", &p)) { fd_start_outgoing_migration(s, p, &local_err); } else { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "uri", "a valid migration protocol"); migrate_set_state(&s->state, MIGRATION_STATUS_SETUP, MIGRATION_STATUS_FAILED); return; } if (local_err) { migrate_fd_error(s, local_err); error_propagate(errp, local_err); return; } }
false
qemu
0b827d5e7291193887d22d058bc20c12b423047c
void qmp_migrate(const char *uri, bool has_blk, bool blk, bool has_inc, bool inc, bool has_detach, bool detach, Error **errp) { Error *local_err = NULL; MigrationState *s = migrate_get_current(); MigrationParams params; const char *p; params.blk = has_blk && blk; params.shared = has_inc && inc; if (migration_is_setup_or_active(s->state) || s->state == MIGRATION_STATUS_CANCELLING) { error_setg(errp, QERR_MIGRATION_ACTIVE); return; } if (runstate_check(RUN_STATE_INMIGRATE)) { error_setg(errp, "Guest is waiting for an incoming migration"); return; } if (migration_is_blocked(errp)) { return; } s = migrate_init(&params); if (strstart(uri, "tcp:", &p)) { tcp_start_outgoing_migration(s, p, &local_err); #ifdef CONFIG_RDMA } else if (strstart(uri, "rdma:", &p)) { rdma_start_outgoing_migration(s, p, &local_err); #endif } else if (strstart(uri, "exec:", &p)) { exec_start_outgoing_migration(s, p, &local_err); } else if (strstart(uri, "unix:", &p)) { unix_start_outgoing_migration(s, p, &local_err); } else if (strstart(uri, "fd:", &p)) { fd_start_outgoing_migration(s, p, &local_err); } else { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "uri", "a valid migration protocol"); migrate_set_state(&s->state, MIGRATION_STATUS_SETUP, MIGRATION_STATUS_FAILED); return; } if (local_err) { migrate_fd_error(s, local_err); error_propagate(errp, local_err); return; } }
{ "code": [], "line_no": [] }
void FUNC_0(const char *VAR_0, bool VAR_1, bool VAR_2, bool VAR_3, bool VAR_4, bool VAR_5, bool VAR_6, Error **VAR_7) { Error *local_err = NULL; MigrationState *s = migrate_get_current(); MigrationParams params; const char *VAR_8; params.VAR_2 = VAR_1 && VAR_2; params.shared = VAR_3 && VAR_4; if (migration_is_setup_or_active(s->state) || s->state == MIGRATION_STATUS_CANCELLING) { error_setg(VAR_7, QERR_MIGRATION_ACTIVE); return; } if (runstate_check(RUN_STATE_INMIGRATE)) { error_setg(VAR_7, "Guest is waiting for an incoming migration"); return; } if (migration_is_blocked(VAR_7)) { return; } s = migrate_init(&params); if (strstart(VAR_0, "tcp:", &VAR_8)) { tcp_start_outgoing_migration(s, VAR_8, &local_err); #ifdef CONFIG_RDMA } else if (strstart(VAR_0, "rdma:", &VAR_8)) { rdma_start_outgoing_migration(s, VAR_8, &local_err); #endif } else if (strstart(VAR_0, "exec:", &VAR_8)) { exec_start_outgoing_migration(s, VAR_8, &local_err); } else if (strstart(VAR_0, "unix:", &VAR_8)) { unix_start_outgoing_migration(s, VAR_8, &local_err); } else if (strstart(VAR_0, "fd:", &VAR_8)) { fd_start_outgoing_migration(s, VAR_8, &local_err); } else { error_setg(VAR_7, QERR_INVALID_PARAMETER_VALUE, "VAR_0", "a valid migration protocol"); migrate_set_state(&s->state, MIGRATION_STATUS_SETUP, MIGRATION_STATUS_FAILED); return; } if (local_err) { migrate_fd_error(s, local_err); error_propagate(VAR_7, local_err); return; } }
[ "void FUNC_0(const char *VAR_0, bool VAR_1, bool VAR_2,\nbool VAR_3, bool VAR_4, bool VAR_5, bool VAR_6,\nError **VAR_7)\n{", "Error *local_err = NULL;", "MigrationState *s = migrate_get_current();", "MigrationParams params;", "const char *VAR_8;", "params.VAR_2 = VAR_1 && VAR_2;", "params.shared = VAR_3 && VAR_4;", "if (migration_is_setup_or_active(s->state) ||\ns->state == MIGRATION_STATUS_CANCELLING) {", "error_setg(VAR_7, QERR_MIGRATION_ACTIVE);", "return;", "}", "if (runstate_check(RUN_STATE_INMIGRATE)) {", "error_setg(VAR_7, \"Guest is waiting for an incoming migration\");", "return;", "}", "if (migration_is_blocked(VAR_7)) {", "return;", "}", "s = migrate_init(&params);", "if (strstart(VAR_0, \"tcp:\", &VAR_8)) {", "tcp_start_outgoing_migration(s, VAR_8, &local_err);", "#ifdef CONFIG_RDMA\n} else if (strstart(VAR_0, \"rdma:\", &VAR_8)) {", "rdma_start_outgoing_migration(s, VAR_8, &local_err);", "#endif\n} else if (strstart(VAR_0, \"exec:\", &VAR_8)) {", "exec_start_outgoing_migration(s, VAR_8, &local_err);", "} else if (strstart(VAR_0, \"unix:\", &VAR_8)) {", "unix_start_outgoing_migration(s, VAR_8, &local_err);", "} else if (strstart(VAR_0, \"fd:\", &VAR_8)) {", "fd_start_outgoing_migration(s, VAR_8, &local_err);", "} else {", "error_setg(VAR_7, QERR_INVALID_PARAMETER_VALUE, \"VAR_0\",\n\"a valid migration protocol\");", "migrate_set_state(&s->state, MIGRATION_STATUS_SETUP,\nMIGRATION_STATUS_FAILED);", "return;", "}", "if (local_err) {", "migrate_fd_error(s, local_err);", "error_propagate(VAR_7, local_err);", "return;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 25, 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [ 57 ], [ 59 ], [ 61, 63 ], [ 65 ], [ 67, 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83, 85 ], [ 87, 89 ], [ 91 ], [ 93 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ] ]
20,083
static void imx_avic_write(void *opaque, target_phys_addr_t offset, uint64_t val, unsigned size) { IMXAVICState *s = (IMXAVICState *)opaque; /* Vector Registers not yet supported */ if (offset >= 0x100 && offset <= 0x2fc) { IPRINTF("imx_avic_write to vector register %d ignored\n", (unsigned int)((offset - 0x100) >> 2)); return; } DPRINTF("imx_avic_write(0x%x) = %x\n", (unsigned int)offset>>2, (unsigned int)val); switch (offset >> 2) { case 0: /* Interrupt Control Register, INTCNTL */ s->intcntl = val & (ABFEN | NIDIS | FIDIS | NIAD | FIAD | NM); if (s->intcntl & ABFEN) { s->intcntl &= ~(val & ABFLAG); } break; case 1: /* Normal Interrupt Mask Register, NIMASK */ s->intmask = val & 0x1f; break; case 2: /* Interrupt Enable Number Register, INTENNUM */ DPRINTF("enable(%d)\n", (int)val); val &= 0x3f; s->enabled |= (1ULL << val); break; case 3: /* Interrupt Disable Number Register, INTDISNUM */ DPRINTF("disable(%d)\n", (int)val); val &= 0x3f; s->enabled &= ~(1ULL << val); break; case 4: /* Interrupt Enable Number Register High */ s->enabled = (s->enabled & 0xffffffffULL) | (val << 32); break; case 5: /* Interrupt Enable Number Register Low */ s->enabled = (s->enabled & 0xffffffff00000000ULL) | val; break; case 6: /* Interrupt Type Register High */ s->is_fiq = (s->is_fiq & 0xffffffffULL) | (val << 32); break; case 7: /* Interrupt Type Register Low */ s->is_fiq = (s->is_fiq & 0xffffffff00000000ULL) | val; break; case 8: /* Normal Interrupt Priority Register 7 */ case 9: /* Normal Interrupt Priority Register 6 */ case 10:/* Normal Interrupt Priority Register 5 */ case 11:/* Normal Interrupt Priority Register 4 */ case 12:/* Normal Interrupt Priority Register 3 */ case 13:/* Normal Interrupt Priority Register 2 */ case 14:/* Normal Interrupt Priority Register 1 */ case 15:/* Normal Interrupt Priority Register 0 */ s->prio[15-(offset>>2)] = val; break; /* Read-only registers, writes ignored */ case 16:/* Normal Interrupt Vector and Status register */ case 17:/* Fast Interrupt vector and status register */ case 18:/* Interrupt source register high */ case 19:/* Interrupt source register low */ return; case 20:/* Interrupt Force Register high */ s->pending = (s->pending & 0xffffffffULL) | (val << 32); break; case 21:/* Interrupt Force Register low */ s->pending = (s->pending & 0xffffffff00000000ULL) | val; break; case 22:/* Normal Interrupt Pending Register High */ case 23:/* Normal Interrupt Pending Register Low */ case 24: /* Fast Interrupt Pending Register High */ case 25: /* Fast Interrupt Pending Register Low */ return; default: IPRINTF("imx_avic_write: Bad offset %x\n", (int)offset); } imx_avic_update(s); }
false
qemu
a8170e5e97ad17ca169c64ba87ae2f53850dab4c
static void imx_avic_write(void *opaque, target_phys_addr_t offset, uint64_t val, unsigned size) { IMXAVICState *s = (IMXAVICState *)opaque; if (offset >= 0x100 && offset <= 0x2fc) { IPRINTF("imx_avic_write to vector register %d ignored\n", (unsigned int)((offset - 0x100) >> 2)); return; } DPRINTF("imx_avic_write(0x%x) = %x\n", (unsigned int)offset>>2, (unsigned int)val); switch (offset >> 2) { case 0: s->intcntl = val & (ABFEN | NIDIS | FIDIS | NIAD | FIAD | NM); if (s->intcntl & ABFEN) { s->intcntl &= ~(val & ABFLAG); } break; case 1: s->intmask = val & 0x1f; break; case 2: DPRINTF("enable(%d)\n", (int)val); val &= 0x3f; s->enabled |= (1ULL << val); break; case 3: DPRINTF("disable(%d)\n", (int)val); val &= 0x3f; s->enabled &= ~(1ULL << val); break; case 4: s->enabled = (s->enabled & 0xffffffffULL) | (val << 32); break; case 5: s->enabled = (s->enabled & 0xffffffff00000000ULL) | val; break; case 6: s->is_fiq = (s->is_fiq & 0xffffffffULL) | (val << 32); break; case 7: s->is_fiq = (s->is_fiq & 0xffffffff00000000ULL) | val; break; case 8: case 9: case 10: case 11: case 12: case 13: case 14: case 15: s->prio[15-(offset>>2)] = val; break; case 16: case 17: case 18: case 19: return; case 20: s->pending = (s->pending & 0xffffffffULL) | (val << 32); break; case 21: s->pending = (s->pending & 0xffffffff00000000ULL) | val; break; case 22: case 23: case 24: case 25: return; default: IPRINTF("imx_avic_write: Bad offset %x\n", (int)offset); } imx_avic_update(s); }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0, target_phys_addr_t VAR_1, uint64_t VAR_2, unsigned VAR_3) { IMXAVICState *s = (IMXAVICState *)VAR_0; if (VAR_1 >= 0x100 && VAR_1 <= 0x2fc) { IPRINTF("FUNC_0 to vector register %d ignored\n", (unsigned int)((VAR_1 - 0x100) >> 2)); return; } DPRINTF("FUNC_0(0x%x) = %x\n", (unsigned int)VAR_1>>2, (unsigned int)VAR_2); switch (VAR_1 >> 2) { case 0: s->intcntl = VAR_2 & (ABFEN | NIDIS | FIDIS | NIAD | FIAD | NM); if (s->intcntl & ABFEN) { s->intcntl &= ~(VAR_2 & ABFLAG); } break; case 1: s->intmask = VAR_2 & 0x1f; break; case 2: DPRINTF("enable(%d)\n", (int)VAR_2); VAR_2 &= 0x3f; s->enabled |= (1ULL << VAR_2); break; case 3: DPRINTF("disable(%d)\n", (int)VAR_2); VAR_2 &= 0x3f; s->enabled &= ~(1ULL << VAR_2); break; case 4: s->enabled = (s->enabled & 0xffffffffULL) | (VAR_2 << 32); break; case 5: s->enabled = (s->enabled & 0xffffffff00000000ULL) | VAR_2; break; case 6: s->is_fiq = (s->is_fiq & 0xffffffffULL) | (VAR_2 << 32); break; case 7: s->is_fiq = (s->is_fiq & 0xffffffff00000000ULL) | VAR_2; break; case 8: case 9: case 10: case 11: case 12: case 13: case 14: case 15: s->prio[15-(VAR_1>>2)] = VAR_2; break; case 16: case 17: case 18: case 19: return; case 20: s->pending = (s->pending & 0xffffffffULL) | (VAR_2 << 32); break; case 21: s->pending = (s->pending & 0xffffffff00000000ULL) | VAR_2; break; case 22: case 23: case 24: case 25: return; default: IPRINTF("FUNC_0: Bad VAR_1 %x\n", (int)VAR_1); } imx_avic_update(s); }
[ "static void FUNC_0(void *VAR_0, target_phys_addr_t VAR_1,\nuint64_t VAR_2, unsigned VAR_3)\n{", "IMXAVICState *s = (IMXAVICState *)VAR_0;", "if (VAR_1 >= 0x100 && VAR_1 <= 0x2fc) {", "IPRINTF(\"FUNC_0 to vector register %d ignored\\n\",\n(unsigned int)((VAR_1 - 0x100) >> 2));", "return;", "}", "DPRINTF(\"FUNC_0(0x%x) = %x\\n\",\n(unsigned int)VAR_1>>2, (unsigned int)VAR_2);", "switch (VAR_1 >> 2) {", "case 0:\ns->intcntl = VAR_2 & (ABFEN | NIDIS | FIDIS | NIAD | FIAD | NM);", "if (s->intcntl & ABFEN) {", "s->intcntl &= ~(VAR_2 & ABFLAG);", "}", "break;", "case 1:\ns->intmask = VAR_2 & 0x1f;", "break;", "case 2:\nDPRINTF(\"enable(%d)\\n\", (int)VAR_2);", "VAR_2 &= 0x3f;", "s->enabled |= (1ULL << VAR_2);", "break;", "case 3:\nDPRINTF(\"disable(%d)\\n\", (int)VAR_2);", "VAR_2 &= 0x3f;", "s->enabled &= ~(1ULL << VAR_2);", "break;", "case 4:\ns->enabled = (s->enabled & 0xffffffffULL) | (VAR_2 << 32);", "break;", "case 5:\ns->enabled = (s->enabled & 0xffffffff00000000ULL) | VAR_2;", "break;", "case 6:\ns->is_fiq = (s->is_fiq & 0xffffffffULL) | (VAR_2 << 32);", "break;", "case 7:\ns->is_fiq = (s->is_fiq & 0xffffffff00000000ULL) | VAR_2;", "break;", "case 8:\ncase 9:\ncase 10:\ncase 11:\ncase 12:\ncase 13:\ncase 14:\ncase 15:\ns->prio[15-(VAR_1>>2)] = VAR_2;", "break;", "case 16:\ncase 17:\ncase 18:\ncase 19:\nreturn;", "case 20:\ns->pending = (s->pending & 0xffffffffULL) | (VAR_2 << 32);", "break;", "case 21:\ns->pending = (s->pending & 0xffffffff00000000ULL) | VAR_2;", "break;", "case 22:\ncase 23:\ncase 24:\ncase 25:\nreturn;", "default:\nIPRINTF(\"FUNC_0: Bad VAR_1 %x\\n\", (int)VAR_1);", "}", "imx_avic_update(s);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 13 ], [ 15, 17 ], [ 19 ], [ 21 ], [ 25, 27 ], [ 29 ], [ 31, 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 45, 47 ], [ 49 ], [ 53, 55 ], [ 57 ], [ 59 ], [ 61 ], [ 65, 67 ], [ 69 ], [ 71 ], [ 73 ], [ 77, 79 ], [ 81 ], [ 85, 87 ], [ 89 ], [ 93, 95 ], [ 97 ], [ 101, 103 ], [ 105 ], [ 109, 111, 113, 115, 117, 119, 121, 123, 125 ], [ 127 ], [ 133, 135, 137, 139, 141 ], [ 145, 147 ], [ 149 ], [ 153, 155 ], [ 157 ], [ 161, 163, 165, 167, 169 ], [ 173, 175 ], [ 177 ], [ 179 ], [ 181 ] ]
20,084
QemuOpts *qemu_opts_create(QemuOptsList *list, const char *id, int fail_if_exists) { QemuOpts *opts = NULL; if (id) { opts = qemu_opts_find(list, id); if (opts != NULL) { if (fail_if_exists) { fprintf(stderr, "tried to create id \"%s\" twice for \"%s\"\n", id, list->name); return NULL; } else { return opts; } } } opts = qemu_mallocz(sizeof(*opts)); if (id) { opts->id = qemu_strdup(id); } opts->list = list; TAILQ_INIT(&opts->head); TAILQ_INSERT_TAIL(&list->head, opts, next); return opts; }
false
qemu
72cf2d4f0e181d0d3a3122e04129c58a95da713e
QemuOpts *qemu_opts_create(QemuOptsList *list, const char *id, int fail_if_exists) { QemuOpts *opts = NULL; if (id) { opts = qemu_opts_find(list, id); if (opts != NULL) { if (fail_if_exists) { fprintf(stderr, "tried to create id \"%s\" twice for \"%s\"\n", id, list->name); return NULL; } else { return opts; } } } opts = qemu_mallocz(sizeof(*opts)); if (id) { opts->id = qemu_strdup(id); } opts->list = list; TAILQ_INIT(&opts->head); TAILQ_INSERT_TAIL(&list->head, opts, next); return opts; }
{ "code": [], "line_no": [] }
QemuOpts *FUNC_0(QemuOptsList *list, const char *id, int fail_if_exists) { QemuOpts *opts = NULL; if (id) { opts = qemu_opts_find(list, id); if (opts != NULL) { if (fail_if_exists) { fprintf(stderr, "tried to create id \"%s\" twice for \"%s\"\n", id, list->name); return NULL; } else { return opts; } } } opts = qemu_mallocz(sizeof(*opts)); if (id) { opts->id = qemu_strdup(id); } opts->list = list; TAILQ_INIT(&opts->head); TAILQ_INSERT_TAIL(&list->head, opts, next); return opts; }
[ "QemuOpts *FUNC_0(QemuOptsList *list, const char *id, int fail_if_exists)\n{", "QemuOpts *opts = NULL;", "if (id) {", "opts = qemu_opts_find(list, id);", "if (opts != NULL) {", "if (fail_if_exists) {", "fprintf(stderr, \"tried to create id \\\"%s\\\" twice for \\\"%s\\\"\\n\",\nid, list->name);", "return NULL;", "} else {", "return opts;", "}", "}", "}", "opts = qemu_mallocz(sizeof(*opts));", "if (id) {", "opts->id = qemu_strdup(id);", "}", "opts->list = list;", "TAILQ_INIT(&opts->head);", "TAILQ_INSERT_TAIL(&list->head, opts, next);", "return opts;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17, 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ] ]
20,085
static void tco_timer_expired(void *opaque) { TCOIORegs *tr = opaque; ICH9LPCPMRegs *pm = container_of(tr, ICH9LPCPMRegs, tco_regs); ICH9LPCState *lpc = container_of(pm, ICH9LPCState, pm); uint32_t gcs = pci_get_long(lpc->chip_config + ICH9_CC_GCS); tr->tco.rld = 0; tr->tco.sts1 |= TCO_TIMEOUT; if (++tr->timeouts_no == 2) { tr->tco.sts2 |= TCO_SECOND_TO_STS; tr->tco.sts2 |= TCO_BOOT_STS; tr->timeouts_no = 0; if (!(gcs & ICH9_CC_GCS_NO_REBOOT)) { watchdog_perform_action(); tco_timer_stop(tr); return; } } if (pm->smi_en & ICH9_PMIO_SMI_EN_TCO_EN) { ich9_generate_smi(); } else { ich9_generate_nmi(); } tr->tco.rld = tr->tco.tmr; tco_timer_reload(tr); }
false
qemu
5add35bec1e249bb5345a47008c8f298d4760be4
static void tco_timer_expired(void *opaque) { TCOIORegs *tr = opaque; ICH9LPCPMRegs *pm = container_of(tr, ICH9LPCPMRegs, tco_regs); ICH9LPCState *lpc = container_of(pm, ICH9LPCState, pm); uint32_t gcs = pci_get_long(lpc->chip_config + ICH9_CC_GCS); tr->tco.rld = 0; tr->tco.sts1 |= TCO_TIMEOUT; if (++tr->timeouts_no == 2) { tr->tco.sts2 |= TCO_SECOND_TO_STS; tr->tco.sts2 |= TCO_BOOT_STS; tr->timeouts_no = 0; if (!(gcs & ICH9_CC_GCS_NO_REBOOT)) { watchdog_perform_action(); tco_timer_stop(tr); return; } } if (pm->smi_en & ICH9_PMIO_SMI_EN_TCO_EN) { ich9_generate_smi(); } else { ich9_generate_nmi(); } tr->tco.rld = tr->tco.tmr; tco_timer_reload(tr); }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0) { TCOIORegs *tr = VAR_0; ICH9LPCPMRegs *pm = container_of(tr, ICH9LPCPMRegs, tco_regs); ICH9LPCState *lpc = container_of(pm, ICH9LPCState, pm); uint32_t gcs = pci_get_long(lpc->chip_config + ICH9_CC_GCS); tr->tco.rld = 0; tr->tco.sts1 |= TCO_TIMEOUT; if (++tr->timeouts_no == 2) { tr->tco.sts2 |= TCO_SECOND_TO_STS; tr->tco.sts2 |= TCO_BOOT_STS; tr->timeouts_no = 0; if (!(gcs & ICH9_CC_GCS_NO_REBOOT)) { watchdog_perform_action(); tco_timer_stop(tr); return; } } if (pm->smi_en & ICH9_PMIO_SMI_EN_TCO_EN) { ich9_generate_smi(); } else { ich9_generate_nmi(); } tr->tco.rld = tr->tco.tmr; tco_timer_reload(tr); }
[ "static void FUNC_0(void *VAR_0)\n{", "TCOIORegs *tr = VAR_0;", "ICH9LPCPMRegs *pm = container_of(tr, ICH9LPCPMRegs, tco_regs);", "ICH9LPCState *lpc = container_of(pm, ICH9LPCState, pm);", "uint32_t gcs = pci_get_long(lpc->chip_config + ICH9_CC_GCS);", "tr->tco.rld = 0;", "tr->tco.sts1 |= TCO_TIMEOUT;", "if (++tr->timeouts_no == 2) {", "tr->tco.sts2 |= TCO_SECOND_TO_STS;", "tr->tco.sts2 |= TCO_BOOT_STS;", "tr->timeouts_no = 0;", "if (!(gcs & ICH9_CC_GCS_NO_REBOOT)) {", "watchdog_perform_action();", "tco_timer_stop(tr);", "return;", "}", "}", "if (pm->smi_en & ICH9_PMIO_SMI_EN_TCO_EN) {", "ich9_generate_smi();", "} else {", "ich9_generate_nmi();", "}", "tr->tco.rld = tr->tco.tmr;", "tco_timer_reload(tr);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ] ]
20,087
static void access_with_adjusted_size(hwaddr addr, uint64_t *value, unsigned size, unsigned access_size_min, unsigned access_size_max, void (*access)(MemoryRegion *mr, hwaddr addr, uint64_t *value, unsigned size, unsigned shift, uint64_t mask), MemoryRegion *mr) { uint64_t access_mask; unsigned access_size; unsigned i; if (!access_size_min) { access_size_min = 1; } if (!access_size_max) { access_size_max = 4; } /* FIXME: support unaligned access? */ access_size = MAX(MIN(size, access_size_max), access_size_min); access_mask = -1ULL >> (64 - access_size * 8); for (i = 0; i < size; i += access_size) { #ifdef TARGET_WORDS_BIGENDIAN access(mr, addr + i, value, access_size, (size - access_size - i) * 8, access_mask); #else access(mr, addr + i, value, access_size, i * 8, access_mask); #endif } }
false
qemu
e7342aa39b3193473ded24cbf2233930665796e9
static void access_with_adjusted_size(hwaddr addr, uint64_t *value, unsigned size, unsigned access_size_min, unsigned access_size_max, void (*access)(MemoryRegion *mr, hwaddr addr, uint64_t *value, unsigned size, unsigned shift, uint64_t mask), MemoryRegion *mr) { uint64_t access_mask; unsigned access_size; unsigned i; if (!access_size_min) { access_size_min = 1; } if (!access_size_max) { access_size_max = 4; } access_size = MAX(MIN(size, access_size_max), access_size_min); access_mask = -1ULL >> (64 - access_size * 8); for (i = 0; i < size; i += access_size) { #ifdef TARGET_WORDS_BIGENDIAN access(mr, addr + i, value, access_size, (size - access_size - i) * 8, access_mask); #else access(mr, addr + i, value, access_size, i * 8, access_mask); #endif } }
{ "code": [], "line_no": [] }
static void FUNC_0(hwaddr VAR_7, uint64_t *VAR_7, unsigned VAR_7, unsigned VAR_3, unsigned VAR_4, void (*VAR_5)(MemoryRegion *VAR_9, hwaddr VAR_7, uint64_t *VAR_7, unsigned VAR_7, unsigned VAR_7, uint64_t VAR_8), MemoryRegion *VAR_9) { uint64_t access_mask; unsigned VAR_9; unsigned VAR_10; if (!VAR_3) { VAR_3 = 1; } if (!VAR_4) { VAR_4 = 4; } VAR_9 = MAX(MIN(VAR_7, VAR_4), VAR_3); access_mask = -1ULL >> (64 - VAR_9 * 8); for (VAR_10 = 0; VAR_10 < VAR_7; VAR_10 += VAR_9) { #ifdef TARGET_WORDS_BIGENDIAN VAR_5(VAR_9, VAR_7 + VAR_10, VAR_7, VAR_9, (VAR_7 - VAR_9 - VAR_10) * 8, access_mask); #else VAR_5(VAR_9, VAR_7 + VAR_10, VAR_7, VAR_9, VAR_10 * 8, access_mask); #endif } }
[ "static void FUNC_0(hwaddr VAR_7,\nuint64_t *VAR_7,\nunsigned VAR_7,\nunsigned VAR_3,\nunsigned VAR_4,\nvoid (*VAR_5)(MemoryRegion *VAR_9,\nhwaddr VAR_7,\nuint64_t *VAR_7,\nunsigned VAR_7,\nunsigned VAR_7,\nuint64_t VAR_8),\nMemoryRegion *VAR_9)\n{", "uint64_t access_mask;", "unsigned VAR_9;", "unsigned VAR_10;", "if (!VAR_3) {", "VAR_3 = 1;", "}", "if (!VAR_4) {", "VAR_4 = 4;", "}", "VAR_9 = MAX(MIN(VAR_7, VAR_4), VAR_3);", "access_mask = -1ULL >> (64 - VAR_9 * 8);", "for (VAR_10 = 0; VAR_10 < VAR_7; VAR_10 += VAR_9) {", "#ifdef TARGET_WORDS_BIGENDIAN\nVAR_5(VAR_9, VAR_7 + VAR_10, VAR_7, VAR_9,\n(VAR_7 - VAR_9 - VAR_10) * 8, access_mask);", "#else\nVAR_5(VAR_9, VAR_7 + VAR_10, VAR_7, VAR_9, VAR_10 * 8, access_mask);", "#endif\n}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 51 ], [ 53 ], [ 55 ], [ 57, 59, 61 ], [ 63, 65 ], [ 67, 69 ], [ 71 ] ]
20,088
static void scsi_disk_emulate_write_same(SCSIDiskReq *r, uint8_t *inbuf) { SCSIRequest *req = &r->req; SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, req->dev); uint32_t nb_sectors = scsi_data_cdb_length(r->req.cmd.buf); WriteSameCBData *data; uint8_t *buf; int i; /* Fail if PBDATA=1 or LBDATA=1 or ANCHOR=1. */ if (nb_sectors == 0 || (req->cmd.buf[1] & 0x16)) { scsi_check_condition(r, SENSE_CODE(INVALID_FIELD)); return; } if (bdrv_is_read_only(s->qdev.conf.bs)) { scsi_check_condition(r, SENSE_CODE(WRITE_PROTECTED)); return; } if (!check_lba_range(s, r->req.cmd.lba, nb_sectors)) { scsi_check_condition(r, SENSE_CODE(LBA_OUT_OF_RANGE)); return; } if (buffer_is_zero(inbuf, s->qdev.blocksize)) { int flags = (req->cmd.buf[1] & 0x8) ? BDRV_REQ_MAY_UNMAP : 0; /* The request is used as the AIO opaque value, so add a ref. */ scsi_req_ref(&r->req); block_acct_start(bdrv_get_stats(s->qdev.conf.bs), &r->acct, nb_sectors * s->qdev.blocksize, BLOCK_ACCT_WRITE); r->req.aiocb = bdrv_aio_write_zeroes(s->qdev.conf.bs, r->req.cmd.lba * (s->qdev.blocksize / 512), nb_sectors * (s->qdev.blocksize / 512), flags, scsi_aio_complete, r); return; } data = g_new0(WriteSameCBData, 1); data->r = r; data->sector = r->req.cmd.lba * (s->qdev.blocksize / 512); data->nb_sectors = nb_sectors * (s->qdev.blocksize / 512); data->iov.iov_len = MIN(data->nb_sectors * 512, SCSI_WRITE_SAME_MAX); data->iov.iov_base = buf = qemu_blockalign(s->qdev.conf.bs, data->iov.iov_len); qemu_iovec_init_external(&data->qiov, &data->iov, 1); for (i = 0; i < data->iov.iov_len; i += s->qdev.blocksize) { memcpy(&buf[i], inbuf, s->qdev.blocksize); } scsi_req_ref(&r->req); block_acct_start(bdrv_get_stats(s->qdev.conf.bs), &r->acct, data->iov.iov_len, BLOCK_ACCT_WRITE); r->req.aiocb = bdrv_aio_writev(s->qdev.conf.bs, data->sector, &data->qiov, data->iov.iov_len / 512, scsi_write_same_complete, data); }
false
qemu
4be746345f13e99e468c60acbd3a355e8183e3ce
static void scsi_disk_emulate_write_same(SCSIDiskReq *r, uint8_t *inbuf) { SCSIRequest *req = &r->req; SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, req->dev); uint32_t nb_sectors = scsi_data_cdb_length(r->req.cmd.buf); WriteSameCBData *data; uint8_t *buf; int i; if (nb_sectors == 0 || (req->cmd.buf[1] & 0x16)) { scsi_check_condition(r, SENSE_CODE(INVALID_FIELD)); return; } if (bdrv_is_read_only(s->qdev.conf.bs)) { scsi_check_condition(r, SENSE_CODE(WRITE_PROTECTED)); return; } if (!check_lba_range(s, r->req.cmd.lba, nb_sectors)) { scsi_check_condition(r, SENSE_CODE(LBA_OUT_OF_RANGE)); return; } if (buffer_is_zero(inbuf, s->qdev.blocksize)) { int flags = (req->cmd.buf[1] & 0x8) ? BDRV_REQ_MAY_UNMAP : 0; scsi_req_ref(&r->req); block_acct_start(bdrv_get_stats(s->qdev.conf.bs), &r->acct, nb_sectors * s->qdev.blocksize, BLOCK_ACCT_WRITE); r->req.aiocb = bdrv_aio_write_zeroes(s->qdev.conf.bs, r->req.cmd.lba * (s->qdev.blocksize / 512), nb_sectors * (s->qdev.blocksize / 512), flags, scsi_aio_complete, r); return; } data = g_new0(WriteSameCBData, 1); data->r = r; data->sector = r->req.cmd.lba * (s->qdev.blocksize / 512); data->nb_sectors = nb_sectors * (s->qdev.blocksize / 512); data->iov.iov_len = MIN(data->nb_sectors * 512, SCSI_WRITE_SAME_MAX); data->iov.iov_base = buf = qemu_blockalign(s->qdev.conf.bs, data->iov.iov_len); qemu_iovec_init_external(&data->qiov, &data->iov, 1); for (i = 0; i < data->iov.iov_len; i += s->qdev.blocksize) { memcpy(&buf[i], inbuf, s->qdev.blocksize); } scsi_req_ref(&r->req); block_acct_start(bdrv_get_stats(s->qdev.conf.bs), &r->acct, data->iov.iov_len, BLOCK_ACCT_WRITE); r->req.aiocb = bdrv_aio_writev(s->qdev.conf.bs, data->sector, &data->qiov, data->iov.iov_len / 512, scsi_write_same_complete, data); }
{ "code": [], "line_no": [] }
static void FUNC_0(SCSIDiskReq *VAR_0, uint8_t *VAR_1) { SCSIRequest *req = &VAR_0->req; SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, req->dev); uint32_t nb_sectors = scsi_data_cdb_length(VAR_0->req.cmd.buf); WriteSameCBData *data; uint8_t *buf; int VAR_2; if (nb_sectors == 0 || (req->cmd.buf[1] & 0x16)) { scsi_check_condition(VAR_0, SENSE_CODE(INVALID_FIELD)); return; } if (bdrv_is_read_only(s->qdev.conf.bs)) { scsi_check_condition(VAR_0, SENSE_CODE(WRITE_PROTECTED)); return; } if (!check_lba_range(s, VAR_0->req.cmd.lba, nb_sectors)) { scsi_check_condition(VAR_0, SENSE_CODE(LBA_OUT_OF_RANGE)); return; } if (buffer_is_zero(VAR_1, s->qdev.blocksize)) { int VAR_3 = (req->cmd.buf[1] & 0x8) ? BDRV_REQ_MAY_UNMAP : 0; scsi_req_ref(&VAR_0->req); block_acct_start(bdrv_get_stats(s->qdev.conf.bs), &VAR_0->acct, nb_sectors * s->qdev.blocksize, BLOCK_ACCT_WRITE); VAR_0->req.aiocb = bdrv_aio_write_zeroes(s->qdev.conf.bs, VAR_0->req.cmd.lba * (s->qdev.blocksize / 512), nb_sectors * (s->qdev.blocksize / 512), VAR_3, scsi_aio_complete, VAR_0); return; } data = g_new0(WriteSameCBData, 1); data->VAR_0 = VAR_0; data->sector = VAR_0->req.cmd.lba * (s->qdev.blocksize / 512); data->nb_sectors = nb_sectors * (s->qdev.blocksize / 512); data->iov.iov_len = MIN(data->nb_sectors * 512, SCSI_WRITE_SAME_MAX); data->iov.iov_base = buf = qemu_blockalign(s->qdev.conf.bs, data->iov.iov_len); qemu_iovec_init_external(&data->qiov, &data->iov, 1); for (VAR_2 = 0; VAR_2 < data->iov.iov_len; VAR_2 += s->qdev.blocksize) { memcpy(&buf[VAR_2], VAR_1, s->qdev.blocksize); } scsi_req_ref(&VAR_0->req); block_acct_start(bdrv_get_stats(s->qdev.conf.bs), &VAR_0->acct, data->iov.iov_len, BLOCK_ACCT_WRITE); VAR_0->req.aiocb = bdrv_aio_writev(s->qdev.conf.bs, data->sector, &data->qiov, data->iov.iov_len / 512, scsi_write_same_complete, data); }
[ "static void FUNC_0(SCSIDiskReq *VAR_0, uint8_t *VAR_1)\n{", "SCSIRequest *req = &VAR_0->req;", "SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, req->dev);", "uint32_t nb_sectors = scsi_data_cdb_length(VAR_0->req.cmd.buf);", "WriteSameCBData *data;", "uint8_t *buf;", "int VAR_2;", "if (nb_sectors == 0 || (req->cmd.buf[1] & 0x16)) {", "scsi_check_condition(VAR_0, SENSE_CODE(INVALID_FIELD));", "return;", "}", "if (bdrv_is_read_only(s->qdev.conf.bs)) {", "scsi_check_condition(VAR_0, SENSE_CODE(WRITE_PROTECTED));", "return;", "}", "if (!check_lba_range(s, VAR_0->req.cmd.lba, nb_sectors)) {", "scsi_check_condition(VAR_0, SENSE_CODE(LBA_OUT_OF_RANGE));", "return;", "}", "if (buffer_is_zero(VAR_1, s->qdev.blocksize)) {", "int VAR_3 = (req->cmd.buf[1] & 0x8) ? BDRV_REQ_MAY_UNMAP : 0;", "scsi_req_ref(&VAR_0->req);", "block_acct_start(bdrv_get_stats(s->qdev.conf.bs), &VAR_0->acct,\nnb_sectors * s->qdev.blocksize,\nBLOCK_ACCT_WRITE);", "VAR_0->req.aiocb = bdrv_aio_write_zeroes(s->qdev.conf.bs,\nVAR_0->req.cmd.lba * (s->qdev.blocksize / 512),\nnb_sectors * (s->qdev.blocksize / 512),\nVAR_3, scsi_aio_complete, VAR_0);", "return;", "}", "data = g_new0(WriteSameCBData, 1);", "data->VAR_0 = VAR_0;", "data->sector = VAR_0->req.cmd.lba * (s->qdev.blocksize / 512);", "data->nb_sectors = nb_sectors * (s->qdev.blocksize / 512);", "data->iov.iov_len = MIN(data->nb_sectors * 512, SCSI_WRITE_SAME_MAX);", "data->iov.iov_base = buf = qemu_blockalign(s->qdev.conf.bs, data->iov.iov_len);", "qemu_iovec_init_external(&data->qiov, &data->iov, 1);", "for (VAR_2 = 0; VAR_2 < data->iov.iov_len; VAR_2 += s->qdev.blocksize) {", "memcpy(&buf[VAR_2], VAR_1, s->qdev.blocksize);", "}", "scsi_req_ref(&VAR_0->req);", "block_acct_start(bdrv_get_stats(s->qdev.conf.bs), &VAR_0->acct,\ndata->iov.iov_len, BLOCK_ACCT_WRITE);", "VAR_0->req.aiocb = bdrv_aio_writev(s->qdev.conf.bs, data->sector,\n&data->qiov, data->iov.iov_len / 512,\nscsi_write_same_complete, data);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 49 ], [ 51 ], [ 57 ], [ 59, 61, 63 ], [ 65, 67, 69, 71 ], [ 73 ], [ 75 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 95 ], [ 97 ], [ 99 ], [ 103 ], [ 105, 107 ], [ 109, 111, 113 ], [ 115 ] ]
20,089
static int kvm_put_msr_feature_control(X86CPU *cpu) { struct { struct kvm_msrs info; struct kvm_msr_entry entry; } msr_data; kvm_msr_entry_set(&msr_data.entry, MSR_IA32_FEATURE_CONTROL, cpu->env.msr_ia32_feature_control); msr_data.info.nmsrs = 1; return kvm_vcpu_ioctl(CPU(cpu), KVM_SET_MSRS, &msr_data); }
false
qemu
c7fe4b12984a36b87438080e48aff5e8f6d48ac9
static int kvm_put_msr_feature_control(X86CPU *cpu) { struct { struct kvm_msrs info; struct kvm_msr_entry entry; } msr_data; kvm_msr_entry_set(&msr_data.entry, MSR_IA32_FEATURE_CONTROL, cpu->env.msr_ia32_feature_control); msr_data.info.nmsrs = 1; return kvm_vcpu_ioctl(CPU(cpu), KVM_SET_MSRS, &msr_data); }
{ "code": [], "line_no": [] }
static int FUNC_0(X86CPU *VAR_0) { struct { struct kvm_msrs info; struct kvm_msr_entry entry; } VAR_1; kvm_msr_entry_set(&VAR_1.entry, MSR_IA32_FEATURE_CONTROL, VAR_0->env.msr_ia32_feature_control); VAR_1.info.nmsrs = 1; return kvm_vcpu_ioctl(CPU(VAR_0), KVM_SET_MSRS, &VAR_1); }
[ "static int FUNC_0(X86CPU *VAR_0)\n{", "struct {", "struct kvm_msrs info;", "struct kvm_msr_entry entry;", "} VAR_1;", "kvm_msr_entry_set(&VAR_1.entry, MSR_IA32_FEATURE_CONTROL,\nVAR_0->env.msr_ia32_feature_control);", "VAR_1.info.nmsrs = 1;", "return kvm_vcpu_ioctl(CPU(VAR_0), KVM_SET_MSRS, &VAR_1);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15, 17 ], [ 19 ], [ 21 ], [ 23 ] ]
20,090
static void ppc_prep_init (int ram_size, int vga_ram_size, const char *boot_device, DisplayState *ds, const char *kernel_filename, const char *kernel_cmdline, const char *initrd_filename, const char *cpu_model) { CPUState *env = NULL, *envs[MAX_CPUS]; char buf[1024]; nvram_t nvram; m48t59_t *m48t59; int PPC_io_memory; int linux_boot, i, nb_nics1, bios_size; unsigned long bios_offset; uint32_t kernel_base, kernel_size, initrd_base, initrd_size; PCIBus *pci_bus; qemu_irq *i8259; int ppc_boot_device; sysctrl = qemu_mallocz(sizeof(sysctrl_t)); if (sysctrl == NULL) return; linux_boot = (kernel_filename != NULL); /* init CPUs */ if (cpu_model == NULL) cpu_model = "default"; for (i = 0; i < smp_cpus; i++) { env = cpu_init(cpu_model); if (!env) { fprintf(stderr, "Unable to find PowerPC CPU definition\n"); exit(1); } /* Set time-base frequency to 100 Mhz */ cpu_ppc_tb_init(env, 100UL * 1000UL * 1000UL); qemu_register_reset(&cpu_ppc_reset, env); register_savevm("cpu", 0, 3, cpu_save, cpu_load, env); envs[i] = env; } /* allocate RAM */ cpu_register_physical_memory(0, ram_size, IO_MEM_RAM); /* allocate and load BIOS */ bios_offset = ram_size + vga_ram_size; if (bios_name == NULL) bios_name = BIOS_FILENAME; snprintf(buf, sizeof(buf), "%s/%s", bios_dir, bios_name); bios_size = load_image(buf, phys_ram_base + bios_offset); if (bios_size < 0 || bios_size > BIOS_SIZE) { cpu_abort(env, "qemu: could not load PPC PREP bios '%s'\n", buf); exit(1); } if (env->nip < 0xFFF80000 && bios_size < 0x00100000) { cpu_abort(env, "PowerPC 601 / 620 / 970 need a 1MB BIOS\n"); } bios_size = (bios_size + 0xfff) & ~0xfff; cpu_register_physical_memory((uint32_t)(-bios_size), bios_size, bios_offset | IO_MEM_ROM); if (linux_boot) { kernel_base = KERNEL_LOAD_ADDR; /* now we can load the kernel */ kernel_size = load_image(kernel_filename, phys_ram_base + kernel_base); if (kernel_size < 0) { cpu_abort(env, "qemu: could not load kernel '%s'\n", kernel_filename); exit(1); } /* load initrd */ if (initrd_filename) { initrd_base = INITRD_LOAD_ADDR; initrd_size = load_image(initrd_filename, phys_ram_base + initrd_base); if (initrd_size < 0) { cpu_abort(env, "qemu: could not load initial ram disk '%s'\n", initrd_filename); exit(1); } } else { initrd_base = 0; initrd_size = 0; } ppc_boot_device = 'm'; } else { kernel_base = 0; kernel_size = 0; initrd_base = 0; initrd_size = 0; ppc_boot_device = '\0'; /* For now, OHW cannot boot from the network. */ for (i = 0; boot_device[i] != '\0'; i++) { if (boot_device[i] >= 'a' && boot_device[i] <= 'f') { ppc_boot_device = boot_device[i]; break; } } if (ppc_boot_device == '\0') { fprintf(stderr, "No valid boot device for Mac99 machine\n"); exit(1); } } isa_mem_base = 0xc0000000; if (PPC_INPUT(env) != PPC_FLAGS_INPUT_6xx) { cpu_abort(env, "Only 6xx bus is supported on PREP machine\n"); exit(1); } i8259 = i8259_init(first_cpu->irq_inputs[PPC6xx_INPUT_INT]); pci_bus = pci_prep_init(i8259); // pci_bus = i440fx_init(); /* Register 8 MB of ISA IO space (needed for non-contiguous map) */ PPC_io_memory = cpu_register_io_memory(0, PPC_prep_io_read, PPC_prep_io_write, sysctrl); cpu_register_physical_memory(0x80000000, 0x00800000, PPC_io_memory); /* init basic PC hardware */ pci_vga_init(pci_bus, ds, phys_ram_base + ram_size, ram_size, vga_ram_size, 0, 0); // openpic = openpic_init(0x00000000, 0xF0000000, 1); // pit = pit_init(0x40, i8259[0]); rtc_init(0x70, i8259[8]); serial_init(0x3f8, i8259[4], serial_hds[0]); nb_nics1 = nb_nics; if (nb_nics1 > NE2000_NB_MAX) nb_nics1 = NE2000_NB_MAX; for(i = 0; i < nb_nics1; i++) { if (nd_table[i].model == NULL || strcmp(nd_table[i].model, "ne2k_isa") == 0) { isa_ne2000_init(ne2000_io[i], i8259[ne2000_irq[i]], &nd_table[i]); } else { pci_nic_init(pci_bus, &nd_table[i], -1); } } for(i = 0; i < 2; i++) { isa_ide_init(ide_iobase[i], ide_iobase2[i], i8259[ide_irq[i]], bs_table[2 * i], bs_table[2 * i + 1]); } i8042_init(i8259[1], i8259[12], 0x60); DMA_init(1); // AUD_init(); // SB16_init(); fdctrl_init(i8259[6], 2, 0, 0x3f0, fd_table); /* Register speaker port */ register_ioport_read(0x61, 1, 1, speaker_ioport_read, NULL); register_ioport_write(0x61, 1, 1, speaker_ioport_write, NULL); /* Register fake IO ports for PREP */ sysctrl->reset_irq = first_cpu->irq_inputs[PPC6xx_INPUT_HRESET]; register_ioport_read(0x398, 2, 1, &PREP_io_read, sysctrl); register_ioport_write(0x398, 2, 1, &PREP_io_write, sysctrl); /* System control ports */ register_ioport_read(0x0092, 0x01, 1, &PREP_io_800_readb, sysctrl); register_ioport_write(0x0092, 0x01, 1, &PREP_io_800_writeb, sysctrl); register_ioport_read(0x0800, 0x52, 1, &PREP_io_800_readb, sysctrl); register_ioport_write(0x0800, 0x52, 1, &PREP_io_800_writeb, sysctrl); /* PCI intack location */ PPC_io_memory = cpu_register_io_memory(0, PPC_intack_read, PPC_intack_write, NULL); cpu_register_physical_memory(0xBFFFFFF0, 0x4, PPC_io_memory); /* PowerPC control and status register group */ #if 0 PPC_io_memory = cpu_register_io_memory(0, PPC_XCSR_read, PPC_XCSR_write, NULL); cpu_register_physical_memory(0xFEFF0000, 0x1000, PPC_io_memory); #endif if (usb_enabled) { usb_ohci_init_pci(pci_bus, 3, -1); } m48t59 = m48t59_init(i8259[8], 0, 0x0074, NVRAM_SIZE, 59); if (m48t59 == NULL) return; sysctrl->nvram = m48t59; /* Initialise NVRAM */ nvram.opaque = m48t59; nvram.read_fn = &m48t59_read; nvram.write_fn = &m48t59_write; PPC_NVRAM_set_params(&nvram, NVRAM_SIZE, "PREP", ram_size, ppc_boot_device, kernel_base, kernel_size, kernel_cmdline, initrd_base, initrd_size, /* XXX: need an option to load a NVRAM image */ 0, graphic_width, graphic_height, graphic_depth); /* Special port to get debug messages from Open-Firmware */ register_ioport_write(0x0F00, 4, 1, &PPC_debug_write, NULL); }
false
qemu
4018bae91649e8e38e371dc00cb5ac8f9e40089e
static void ppc_prep_init (int ram_size, int vga_ram_size, const char *boot_device, DisplayState *ds, const char *kernel_filename, const char *kernel_cmdline, const char *initrd_filename, const char *cpu_model) { CPUState *env = NULL, *envs[MAX_CPUS]; char buf[1024]; nvram_t nvram; m48t59_t *m48t59; int PPC_io_memory; int linux_boot, i, nb_nics1, bios_size; unsigned long bios_offset; uint32_t kernel_base, kernel_size, initrd_base, initrd_size; PCIBus *pci_bus; qemu_irq *i8259; int ppc_boot_device; sysctrl = qemu_mallocz(sizeof(sysctrl_t)); if (sysctrl == NULL) return; linux_boot = (kernel_filename != NULL); if (cpu_model == NULL) cpu_model = "default"; for (i = 0; i < smp_cpus; i++) { env = cpu_init(cpu_model); if (!env) { fprintf(stderr, "Unable to find PowerPC CPU definition\n"); exit(1); } cpu_ppc_tb_init(env, 100UL * 1000UL * 1000UL); qemu_register_reset(&cpu_ppc_reset, env); register_savevm("cpu", 0, 3, cpu_save, cpu_load, env); envs[i] = env; } cpu_register_physical_memory(0, ram_size, IO_MEM_RAM); bios_offset = ram_size + vga_ram_size; if (bios_name == NULL) bios_name = BIOS_FILENAME; snprintf(buf, sizeof(buf), "%s/%s", bios_dir, bios_name); bios_size = load_image(buf, phys_ram_base + bios_offset); if (bios_size < 0 || bios_size > BIOS_SIZE) { cpu_abort(env, "qemu: could not load PPC PREP bios '%s'\n", buf); exit(1); } if (env->nip < 0xFFF80000 && bios_size < 0x00100000) { cpu_abort(env, "PowerPC 601 / 620 / 970 need a 1MB BIOS\n"); } bios_size = (bios_size + 0xfff) & ~0xfff; cpu_register_physical_memory((uint32_t)(-bios_size), bios_size, bios_offset | IO_MEM_ROM); if (linux_boot) { kernel_base = KERNEL_LOAD_ADDR; kernel_size = load_image(kernel_filename, phys_ram_base + kernel_base); if (kernel_size < 0) { cpu_abort(env, "qemu: could not load kernel '%s'\n", kernel_filename); exit(1); } if (initrd_filename) { initrd_base = INITRD_LOAD_ADDR; initrd_size = load_image(initrd_filename, phys_ram_base + initrd_base); if (initrd_size < 0) { cpu_abort(env, "qemu: could not load initial ram disk '%s'\n", initrd_filename); exit(1); } } else { initrd_base = 0; initrd_size = 0; } ppc_boot_device = 'm'; } else { kernel_base = 0; kernel_size = 0; initrd_base = 0; initrd_size = 0; ppc_boot_device = '\0'; for (i = 0; boot_device[i] != '\0'; i++) { if (boot_device[i] >= 'a' && boot_device[i] <= 'f') { ppc_boot_device = boot_device[i]; break; } } if (ppc_boot_device == '\0') { fprintf(stderr, "No valid boot device for Mac99 machine\n"); exit(1); } } isa_mem_base = 0xc0000000; if (PPC_INPUT(env) != PPC_FLAGS_INPUT_6xx) { cpu_abort(env, "Only 6xx bus is supported on PREP machine\n"); exit(1); } i8259 = i8259_init(first_cpu->irq_inputs[PPC6xx_INPUT_INT]); pci_bus = pci_prep_init(i8259); PPC_io_memory = cpu_register_io_memory(0, PPC_prep_io_read, PPC_prep_io_write, sysctrl); cpu_register_physical_memory(0x80000000, 0x00800000, PPC_io_memory); pci_vga_init(pci_bus, ds, phys_ram_base + ram_size, ram_size, vga_ram_size, 0, 0); rtc_init(0x70, i8259[8]); serial_init(0x3f8, i8259[4], serial_hds[0]); nb_nics1 = nb_nics; if (nb_nics1 > NE2000_NB_MAX) nb_nics1 = NE2000_NB_MAX; for(i = 0; i < nb_nics1; i++) { if (nd_table[i].model == NULL || strcmp(nd_table[i].model, "ne2k_isa") == 0) { isa_ne2000_init(ne2000_io[i], i8259[ne2000_irq[i]], &nd_table[i]); } else { pci_nic_init(pci_bus, &nd_table[i], -1); } } for(i = 0; i < 2; i++) { isa_ide_init(ide_iobase[i], ide_iobase2[i], i8259[ide_irq[i]], bs_table[2 * i], bs_table[2 * i + 1]); } i8042_init(i8259[1], i8259[12], 0x60); DMA_init(1); fdctrl_init(i8259[6], 2, 0, 0x3f0, fd_table); register_ioport_read(0x61, 1, 1, speaker_ioport_read, NULL); register_ioport_write(0x61, 1, 1, speaker_ioport_write, NULL); sysctrl->reset_irq = first_cpu->irq_inputs[PPC6xx_INPUT_HRESET]; register_ioport_read(0x398, 2, 1, &PREP_io_read, sysctrl); register_ioport_write(0x398, 2, 1, &PREP_io_write, sysctrl); register_ioport_read(0x0092, 0x01, 1, &PREP_io_800_readb, sysctrl); register_ioport_write(0x0092, 0x01, 1, &PREP_io_800_writeb, sysctrl); register_ioport_read(0x0800, 0x52, 1, &PREP_io_800_readb, sysctrl); register_ioport_write(0x0800, 0x52, 1, &PREP_io_800_writeb, sysctrl); PPC_io_memory = cpu_register_io_memory(0, PPC_intack_read, PPC_intack_write, NULL); cpu_register_physical_memory(0xBFFFFFF0, 0x4, PPC_io_memory); #if 0 PPC_io_memory = cpu_register_io_memory(0, PPC_XCSR_read, PPC_XCSR_write, NULL); cpu_register_physical_memory(0xFEFF0000, 0x1000, PPC_io_memory); #endif if (usb_enabled) { usb_ohci_init_pci(pci_bus, 3, -1); } m48t59 = m48t59_init(i8259[8], 0, 0x0074, NVRAM_SIZE, 59); if (m48t59 == NULL) return; sysctrl->nvram = m48t59; nvram.opaque = m48t59; nvram.read_fn = &m48t59_read; nvram.write_fn = &m48t59_write; PPC_NVRAM_set_params(&nvram, NVRAM_SIZE, "PREP", ram_size, ppc_boot_device, kernel_base, kernel_size, kernel_cmdline, initrd_base, initrd_size, 0, graphic_width, graphic_height, graphic_depth); register_ioport_write(0x0F00, 4, 1, &PPC_debug_write, NULL); }
{ "code": [], "line_no": [] }
static void FUNC_0 (int VAR_0, int VAR_1, const char *VAR_2, DisplayState *VAR_3, const char *VAR_4, const char *VAR_5, const char *VAR_6, const char *VAR_7) { CPUState *env = NULL, *envs[MAX_CPUS]; char VAR_8[1024]; nvram_t nvram; m48t59_t *m48t59; int VAR_9; int VAR_10, VAR_11, VAR_12, VAR_13; unsigned long VAR_14; uint32_t kernel_base, kernel_size, initrd_base, initrd_size; PCIBus *pci_bus; qemu_irq *i8259; int VAR_15; sysctrl = qemu_mallocz(sizeof(sysctrl_t)); if (sysctrl == NULL) return; VAR_10 = (VAR_4 != NULL); if (VAR_7 == NULL) VAR_7 = "default"; for (VAR_11 = 0; VAR_11 < smp_cpus; VAR_11++) { env = cpu_init(VAR_7); if (!env) { fprintf(stderr, "Unable to find PowerPC CPU definition\n"); exit(1); } cpu_ppc_tb_init(env, 100UL * 1000UL * 1000UL); qemu_register_reset(&cpu_ppc_reset, env); register_savevm("cpu", 0, 3, cpu_save, cpu_load, env); envs[VAR_11] = env; } cpu_register_physical_memory(0, VAR_0, IO_MEM_RAM); VAR_14 = VAR_0 + VAR_1; if (bios_name == NULL) bios_name = BIOS_FILENAME; snprintf(VAR_8, sizeof(VAR_8), "%s/%s", bios_dir, bios_name); VAR_13 = load_image(VAR_8, phys_ram_base + VAR_14); if (VAR_13 < 0 || VAR_13 > BIOS_SIZE) { cpu_abort(env, "qemu: could not load PPC PREP bios '%s'\n", VAR_8); exit(1); } if (env->nip < 0xFFF80000 && VAR_13 < 0x00100000) { cpu_abort(env, "PowerPC 601 / 620 / 970 need a 1MB BIOS\n"); } VAR_13 = (VAR_13 + 0xfff) & ~0xfff; cpu_register_physical_memory((uint32_t)(-VAR_13), VAR_13, VAR_14 | IO_MEM_ROM); if (VAR_10) { kernel_base = KERNEL_LOAD_ADDR; kernel_size = load_image(VAR_4, phys_ram_base + kernel_base); if (kernel_size < 0) { cpu_abort(env, "qemu: could not load kernel '%s'\n", VAR_4); exit(1); } if (VAR_6) { initrd_base = INITRD_LOAD_ADDR; initrd_size = load_image(VAR_6, phys_ram_base + initrd_base); if (initrd_size < 0) { cpu_abort(env, "qemu: could not load initial ram disk '%s'\n", VAR_6); exit(1); } } else { initrd_base = 0; initrd_size = 0; } VAR_15 = 'm'; } else { kernel_base = 0; kernel_size = 0; initrd_base = 0; initrd_size = 0; VAR_15 = '\0'; for (VAR_11 = 0; VAR_2[VAR_11] != '\0'; VAR_11++) { if (VAR_2[VAR_11] >= 'a' && VAR_2[VAR_11] <= 'f') { VAR_15 = VAR_2[VAR_11]; break; } } if (VAR_15 == '\0') { fprintf(stderr, "No valid boot device for Mac99 machine\n"); exit(1); } } isa_mem_base = 0xc0000000; if (PPC_INPUT(env) != PPC_FLAGS_INPUT_6xx) { cpu_abort(env, "Only 6xx bus is supported on PREP machine\n"); exit(1); } i8259 = i8259_init(first_cpu->irq_inputs[PPC6xx_INPUT_INT]); pci_bus = pci_prep_init(i8259); VAR_9 = cpu_register_io_memory(0, PPC_prep_io_read, PPC_prep_io_write, sysctrl); cpu_register_physical_memory(0x80000000, 0x00800000, VAR_9); pci_vga_init(pci_bus, VAR_3, phys_ram_base + VAR_0, VAR_0, VAR_1, 0, 0); rtc_init(0x70, i8259[8]); serial_init(0x3f8, i8259[4], serial_hds[0]); VAR_12 = nb_nics; if (VAR_12 > NE2000_NB_MAX) VAR_12 = NE2000_NB_MAX; for(VAR_11 = 0; VAR_11 < VAR_12; VAR_11++) { if (nd_table[VAR_11].model == NULL || strcmp(nd_table[VAR_11].model, "ne2k_isa") == 0) { isa_ne2000_init(ne2000_io[VAR_11], i8259[ne2000_irq[VAR_11]], &nd_table[VAR_11]); } else { pci_nic_init(pci_bus, &nd_table[VAR_11], -1); } } for(VAR_11 = 0; VAR_11 < 2; VAR_11++) { isa_ide_init(ide_iobase[VAR_11], ide_iobase2[VAR_11], i8259[ide_irq[VAR_11]], bs_table[2 * VAR_11], bs_table[2 * VAR_11 + 1]); } i8042_init(i8259[1], i8259[12], 0x60); DMA_init(1); fdctrl_init(i8259[6], 2, 0, 0x3f0, fd_table); register_ioport_read(0x61, 1, 1, speaker_ioport_read, NULL); register_ioport_write(0x61, 1, 1, speaker_ioport_write, NULL); sysctrl->reset_irq = first_cpu->irq_inputs[PPC6xx_INPUT_HRESET]; register_ioport_read(0x398, 2, 1, &PREP_io_read, sysctrl); register_ioport_write(0x398, 2, 1, &PREP_io_write, sysctrl); register_ioport_read(0x0092, 0x01, 1, &PREP_io_800_readb, sysctrl); register_ioport_write(0x0092, 0x01, 1, &PREP_io_800_writeb, sysctrl); register_ioport_read(0x0800, 0x52, 1, &PREP_io_800_readb, sysctrl); register_ioport_write(0x0800, 0x52, 1, &PREP_io_800_writeb, sysctrl); VAR_9 = cpu_register_io_memory(0, PPC_intack_read, PPC_intack_write, NULL); cpu_register_physical_memory(0xBFFFFFF0, 0x4, VAR_9); #if 0 VAR_9 = cpu_register_io_memory(0, PPC_XCSR_read, PPC_XCSR_write, NULL); cpu_register_physical_memory(0xFEFF0000, 0x1000, VAR_9); #endif if (usb_enabled) { usb_ohci_init_pci(pci_bus, 3, -1); } m48t59 = m48t59_init(i8259[8], 0, 0x0074, NVRAM_SIZE, 59); if (m48t59 == NULL) return; sysctrl->nvram = m48t59; nvram.opaque = m48t59; nvram.read_fn = &m48t59_read; nvram.write_fn = &m48t59_write; PPC_NVRAM_set_params(&nvram, NVRAM_SIZE, "PREP", VAR_0, VAR_15, kernel_base, kernel_size, VAR_5, initrd_base, initrd_size, 0, graphic_width, graphic_height, graphic_depth); register_ioport_write(0x0F00, 4, 1, &PPC_debug_write, NULL); }
[ "static void FUNC_0 (int VAR_0, int VAR_1,\nconst char *VAR_2, DisplayState *VAR_3,\nconst char *VAR_4,\nconst char *VAR_5,\nconst char *VAR_6,\nconst char *VAR_7)\n{", "CPUState *env = NULL, *envs[MAX_CPUS];", "char VAR_8[1024];", "nvram_t nvram;", "m48t59_t *m48t59;", "int VAR_9;", "int VAR_10, VAR_11, VAR_12, VAR_13;", "unsigned long VAR_14;", "uint32_t kernel_base, kernel_size, initrd_base, initrd_size;", "PCIBus *pci_bus;", "qemu_irq *i8259;", "int VAR_15;", "sysctrl = qemu_mallocz(sizeof(sysctrl_t));", "if (sysctrl == NULL)\nreturn;", "VAR_10 = (VAR_4 != NULL);", "if (VAR_7 == NULL)\nVAR_7 = \"default\";", "for (VAR_11 = 0; VAR_11 < smp_cpus; VAR_11++) {", "env = cpu_init(VAR_7);", "if (!env) {", "fprintf(stderr, \"Unable to find PowerPC CPU definition\\n\");", "exit(1);", "}", "cpu_ppc_tb_init(env, 100UL * 1000UL * 1000UL);", "qemu_register_reset(&cpu_ppc_reset, env);", "register_savevm(\"cpu\", 0, 3, cpu_save, cpu_load, env);", "envs[VAR_11] = env;", "}", "cpu_register_physical_memory(0, VAR_0, IO_MEM_RAM);", "VAR_14 = VAR_0 + VAR_1;", "if (bios_name == NULL)\nbios_name = BIOS_FILENAME;", "snprintf(VAR_8, sizeof(VAR_8), \"%s/%s\", bios_dir, bios_name);", "VAR_13 = load_image(VAR_8, phys_ram_base + VAR_14);", "if (VAR_13 < 0 || VAR_13 > BIOS_SIZE) {", "cpu_abort(env, \"qemu: could not load PPC PREP bios '%s'\\n\", VAR_8);", "exit(1);", "}", "if (env->nip < 0xFFF80000 && VAR_13 < 0x00100000) {", "cpu_abort(env, \"PowerPC 601 / 620 / 970 need a 1MB BIOS\\n\");", "}", "VAR_13 = (VAR_13 + 0xfff) & ~0xfff;", "cpu_register_physical_memory((uint32_t)(-VAR_13),\nVAR_13, VAR_14 | IO_MEM_ROM);", "if (VAR_10) {", "kernel_base = KERNEL_LOAD_ADDR;", "kernel_size = load_image(VAR_4, phys_ram_base + kernel_base);", "if (kernel_size < 0) {", "cpu_abort(env, \"qemu: could not load kernel '%s'\\n\",\nVAR_4);", "exit(1);", "}", "if (VAR_6) {", "initrd_base = INITRD_LOAD_ADDR;", "initrd_size = load_image(VAR_6,\nphys_ram_base + initrd_base);", "if (initrd_size < 0) {", "cpu_abort(env, \"qemu: could not load initial ram disk '%s'\\n\",\nVAR_6);", "exit(1);", "}", "} else {", "initrd_base = 0;", "initrd_size = 0;", "}", "VAR_15 = 'm';", "} else {", "kernel_base = 0;", "kernel_size = 0;", "initrd_base = 0;", "initrd_size = 0;", "VAR_15 = '\\0';", "for (VAR_11 = 0; VAR_2[VAR_11] != '\\0'; VAR_11++) {", "if (VAR_2[VAR_11] >= 'a' && VAR_2[VAR_11] <= 'f') {", "VAR_15 = VAR_2[VAR_11];", "break;", "}", "}", "if (VAR_15 == '\\0') {", "fprintf(stderr, \"No valid boot device for Mac99 machine\\n\");", "exit(1);", "}", "}", "isa_mem_base = 0xc0000000;", "if (PPC_INPUT(env) != PPC_FLAGS_INPUT_6xx) {", "cpu_abort(env, \"Only 6xx bus is supported on PREP machine\\n\");", "exit(1);", "}", "i8259 = i8259_init(first_cpu->irq_inputs[PPC6xx_INPUT_INT]);", "pci_bus = pci_prep_init(i8259);", "VAR_9 = cpu_register_io_memory(0, PPC_prep_io_read,\nPPC_prep_io_write, sysctrl);", "cpu_register_physical_memory(0x80000000, 0x00800000, VAR_9);", "pci_vga_init(pci_bus, VAR_3, phys_ram_base + VAR_0, VAR_0,\nVAR_1, 0, 0);", "rtc_init(0x70, i8259[8]);", "serial_init(0x3f8, i8259[4], serial_hds[0]);", "VAR_12 = nb_nics;", "if (VAR_12 > NE2000_NB_MAX)\nVAR_12 = NE2000_NB_MAX;", "for(VAR_11 = 0; VAR_11 < VAR_12; VAR_11++) {", "if (nd_table[VAR_11].model == NULL\n|| strcmp(nd_table[VAR_11].model, \"ne2k_isa\") == 0) {", "isa_ne2000_init(ne2000_io[VAR_11], i8259[ne2000_irq[VAR_11]], &nd_table[VAR_11]);", "} else {", "pci_nic_init(pci_bus, &nd_table[VAR_11], -1);", "}", "}", "for(VAR_11 = 0; VAR_11 < 2; VAR_11++) {", "isa_ide_init(ide_iobase[VAR_11], ide_iobase2[VAR_11], i8259[ide_irq[VAR_11]],\nbs_table[2 * VAR_11], bs_table[2 * VAR_11 + 1]);", "}", "i8042_init(i8259[1], i8259[12], 0x60);", "DMA_init(1);", "fdctrl_init(i8259[6], 2, 0, 0x3f0, fd_table);", "register_ioport_read(0x61, 1, 1, speaker_ioport_read, NULL);", "register_ioport_write(0x61, 1, 1, speaker_ioport_write, NULL);", "sysctrl->reset_irq = first_cpu->irq_inputs[PPC6xx_INPUT_HRESET];", "register_ioport_read(0x398, 2, 1, &PREP_io_read, sysctrl);", "register_ioport_write(0x398, 2, 1, &PREP_io_write, sysctrl);", "register_ioport_read(0x0092, 0x01, 1, &PREP_io_800_readb, sysctrl);", "register_ioport_write(0x0092, 0x01, 1, &PREP_io_800_writeb, sysctrl);", "register_ioport_read(0x0800, 0x52, 1, &PREP_io_800_readb, sysctrl);", "register_ioport_write(0x0800, 0x52, 1, &PREP_io_800_writeb, sysctrl);", "VAR_9 = cpu_register_io_memory(0, PPC_intack_read,\nPPC_intack_write, NULL);", "cpu_register_physical_memory(0xBFFFFFF0, 0x4, VAR_9);", "#if 0\nVAR_9 = cpu_register_io_memory(0, PPC_XCSR_read, PPC_XCSR_write,\nNULL);", "cpu_register_physical_memory(0xFEFF0000, 0x1000, VAR_9);", "#endif\nif (usb_enabled) {", "usb_ohci_init_pci(pci_bus, 3, -1);", "}", "m48t59 = m48t59_init(i8259[8], 0, 0x0074, NVRAM_SIZE, 59);", "if (m48t59 == NULL)\nreturn;", "sysctrl->nvram = m48t59;", "nvram.opaque = m48t59;", "nvram.read_fn = &m48t59_read;", "nvram.write_fn = &m48t59_write;", "PPC_NVRAM_set_params(&nvram, NVRAM_SIZE, \"PREP\", VAR_0, VAR_15,\nkernel_base, kernel_size,\nVAR_5,\ninitrd_base, initrd_size,\n0,\ngraphic_width, graphic_height, graphic_depth);", "register_ioport_write(0x0F00, 4, 1, &PPC_debug_write, NULL);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9, 11, 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41, 43 ], [ 47 ], [ 53, 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 85 ], [ 91 ], [ 93, 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117, 119 ], [ 123 ], [ 125 ], [ 129 ], [ 131 ], [ 133, 135 ], [ 137 ], [ 139 ], [ 143 ], [ 145 ], [ 147, 149 ], [ 151 ], [ 153, 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 209 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 227, 229 ], [ 231 ], [ 237, 239 ], [ 245 ], [ 249 ], [ 251 ], [ 253, 255 ], [ 257 ], [ 259, 261 ], [ 263 ], [ 265 ], [ 267 ], [ 269 ], [ 271 ], [ 275 ], [ 277, 279 ], [ 281 ], [ 283 ], [ 285 ], [ 293 ], [ 299 ], [ 301 ], [ 305 ], [ 307 ], [ 309 ], [ 313 ], [ 315 ], [ 317 ], [ 319 ], [ 323, 325 ], [ 327 ], [ 331, 333, 335 ], [ 337 ], [ 339, 343 ], [ 345 ], [ 347 ], [ 351 ], [ 353, 355 ], [ 357 ], [ 363 ], [ 365 ], [ 367 ], [ 369, 371, 373, 375, 379, 381 ], [ 387 ], [ 389 ] ]
20,091
static void mpeg1_skip_picture(MpegEncContext *s, int pict_num) { assert(s->codec_id == CODEC_ID_MPEG1VIDEO); // mpeg2 can do these repeat things /* mpeg1 picture header */ put_header(s, PICTURE_START_CODE); /* temporal reference */ put_bits(&s->pb, 10, pict_num & 0x3ff); put_bits(&s->pb, 3, P_TYPE); put_bits(&s->pb, 16, 0xffff); /* non constant bit rate */ put_bits(&s->pb, 1, 1); /* integer coordinates */ put_bits(&s->pb, 3, 1); /* forward_f_code */ put_bits(&s->pb, 1, 0); /* extra bit picture */ /* only one slice */ put_header(s, SLICE_MIN_START_CODE); put_bits(&s->pb, 5, 1); /* quantizer scale */ put_bits(&s->pb, 1, 0); /* slice extra information */ encode_mb_skip_run(s, 0); /* empty macroblock */ put_bits(&s->pb, 3, 1); /* motion only */ /* zero motion x & y */ put_bits(&s->pb, 1, 1); put_bits(&s->pb, 1, 1); /* output a number of empty slice */ encode_mb_skip_run(s, s->mb_width * s->mb_height - 2); /* empty macroblock */ put_bits(&s->pb, 3, 1); /* motion only */ /* zero motion x & y */ put_bits(&s->pb, 1, 1); put_bits(&s->pb, 1, 1); }
false
FFmpeg
2c492e94fc9d8a5e998b25f4d0390c95f2d4674f
static void mpeg1_skip_picture(MpegEncContext *s, int pict_num) { assert(s->codec_id == CODEC_ID_MPEG1VIDEO); put_header(s, PICTURE_START_CODE); put_bits(&s->pb, 10, pict_num & 0x3ff); put_bits(&s->pb, 3, P_TYPE); put_bits(&s->pb, 16, 0xffff); put_bits(&s->pb, 1, 1); put_bits(&s->pb, 3, 1); put_bits(&s->pb, 1, 0); put_header(s, SLICE_MIN_START_CODE); put_bits(&s->pb, 5, 1); put_bits(&s->pb, 1, 0); encode_mb_skip_run(s, 0); put_bits(&s->pb, 3, 1); put_bits(&s->pb, 1, 1); put_bits(&s->pb, 1, 1); encode_mb_skip_run(s, s->mb_width * s->mb_height - 2); put_bits(&s->pb, 3, 1); put_bits(&s->pb, 1, 1); put_bits(&s->pb, 1, 1); }
{ "code": [], "line_no": [] }
static void FUNC_0(MpegEncContext *VAR_0, int VAR_1) { assert(VAR_0->codec_id == CODEC_ID_MPEG1VIDEO); put_header(VAR_0, PICTURE_START_CODE); put_bits(&VAR_0->pb, 10, VAR_1 & 0x3ff); put_bits(&VAR_0->pb, 3, P_TYPE); put_bits(&VAR_0->pb, 16, 0xffff); put_bits(&VAR_0->pb, 1, 1); put_bits(&VAR_0->pb, 3, 1); put_bits(&VAR_0->pb, 1, 0); put_header(VAR_0, SLICE_MIN_START_CODE); put_bits(&VAR_0->pb, 5, 1); put_bits(&VAR_0->pb, 1, 0); encode_mb_skip_run(VAR_0, 0); put_bits(&VAR_0->pb, 3, 1); put_bits(&VAR_0->pb, 1, 1); put_bits(&VAR_0->pb, 1, 1); encode_mb_skip_run(VAR_0, VAR_0->mb_width * VAR_0->mb_height - 2); put_bits(&VAR_0->pb, 3, 1); put_bits(&VAR_0->pb, 1, 1); put_bits(&VAR_0->pb, 1, 1); }
[ "static void FUNC_0(MpegEncContext *VAR_0, int VAR_1)\n{", "assert(VAR_0->codec_id == CODEC_ID_MPEG1VIDEO);", "put_header(VAR_0, PICTURE_START_CODE);", "put_bits(&VAR_0->pb, 10, VAR_1 & 0x3ff);", "put_bits(&VAR_0->pb, 3, P_TYPE);", "put_bits(&VAR_0->pb, 16, 0xffff);", "put_bits(&VAR_0->pb, 1, 1);", "put_bits(&VAR_0->pb, 3, 1);", "put_bits(&VAR_0->pb, 1, 0);", "put_header(VAR_0, SLICE_MIN_START_CODE);", "put_bits(&VAR_0->pb, 5, 1);", "put_bits(&VAR_0->pb, 1, 0);", "encode_mb_skip_run(VAR_0, 0);", "put_bits(&VAR_0->pb, 3, 1);", "put_bits(&VAR_0->pb, 1, 1);", "put_bits(&VAR_0->pb, 1, 1);", "encode_mb_skip_run(VAR_0, VAR_0->mb_width * VAR_0->mb_height - 2);", "put_bits(&VAR_0->pb, 3, 1);", "put_bits(&VAR_0->pb, 1, 1);", "put_bits(&VAR_0->pb, 1, 1);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 11 ], [ 15 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 31 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 51 ], [ 57 ], [ 59 ], [ 65 ], [ 71 ], [ 77 ], [ 79 ], [ 81 ] ]
20,092
static int ehci_process_itd(EHCIState *ehci, EHCIitd *itd, uint32_t addr) { USBDevice *dev; USBEndpoint *ep; uint32_t i, len, pid, dir, devaddr, endp; uint32_t pg, off, ptr1, ptr2, max, mult; ehci->periodic_sched_active = PERIODIC_ACTIVE; dir =(itd->bufptr[1] & ITD_BUFPTR_DIRECTION); devaddr = get_field(itd->bufptr[0], ITD_BUFPTR_DEVADDR); endp = get_field(itd->bufptr[0], ITD_BUFPTR_EP); max = get_field(itd->bufptr[1], ITD_BUFPTR_MAXPKT); mult = get_field(itd->bufptr[2], ITD_BUFPTR_MULT); for(i = 0; i < 8; i++) { if (itd->transact[i] & ITD_XACT_ACTIVE) { pg = get_field(itd->transact[i], ITD_XACT_PGSEL); off = itd->transact[i] & ITD_XACT_OFFSET_MASK; ptr1 = (itd->bufptr[pg] & ITD_BUFPTR_MASK); ptr2 = (itd->bufptr[pg+1] & ITD_BUFPTR_MASK); len = get_field(itd->transact[i], ITD_XACT_LENGTH); if (len > max * mult) { len = max * mult; } if (len > BUFF_SIZE) { return -1; } qemu_sglist_init(&ehci->isgl, DEVICE(ehci), 2, ehci->as); if (off + len > 4096) { /* transfer crosses page border */ uint32_t len2 = off + len - 4096; uint32_t len1 = len - len2; qemu_sglist_add(&ehci->isgl, ptr1 + off, len1); qemu_sglist_add(&ehci->isgl, ptr2, len2); } else { qemu_sglist_add(&ehci->isgl, ptr1 + off, len); } pid = dir ? USB_TOKEN_IN : USB_TOKEN_OUT; dev = ehci_find_device(ehci, devaddr); ep = usb_ep_get(dev, pid, endp); if (ep && ep->type == USB_ENDPOINT_XFER_ISOC) { usb_packet_setup(&ehci->ipacket, pid, ep, 0, addr, false, (itd->transact[i] & ITD_XACT_IOC) != 0); usb_packet_map(&ehci->ipacket, &ehci->isgl); usb_handle_packet(dev, &ehci->ipacket); usb_packet_unmap(&ehci->ipacket, &ehci->isgl); } else { DPRINTF("ISOCH: attempt to addess non-iso endpoint\n"); ehci->ipacket.status = USB_RET_NAK; ehci->ipacket.actual_length = 0; } qemu_sglist_destroy(&ehci->isgl); switch (ehci->ipacket.status) { case USB_RET_SUCCESS: break; default: fprintf(stderr, "Unexpected iso usb result: %d\n", ehci->ipacket.status); /* Fall through */ case USB_RET_IOERROR: case USB_RET_NODEV: /* 3.3.2: XACTERR is only allowed on IN transactions */ if (dir) { itd->transact[i] |= ITD_XACT_XACTERR; ehci_raise_irq(ehci, USBSTS_ERRINT); } break; case USB_RET_BABBLE: itd->transact[i] |= ITD_XACT_BABBLE; ehci_raise_irq(ehci, USBSTS_ERRINT); break; case USB_RET_NAK: /* no data for us, so do a zero-length transfer */ ehci->ipacket.actual_length = 0; break; } if (!dir) { set_field(&itd->transact[i], len - ehci->ipacket.actual_length, ITD_XACT_LENGTH); /* OUT */ } else { set_field(&itd->transact[i], ehci->ipacket.actual_length, ITD_XACT_LENGTH); /* IN */ } if (itd->transact[i] & ITD_XACT_IOC) { ehci_raise_irq(ehci, USBSTS_INT); } itd->transact[i] &= ~ITD_XACT_ACTIVE; } } return 0; }
false
qemu
adbecc89731cf3e0ae656d50ea9fa58c589c4bdc
static int ehci_process_itd(EHCIState *ehci, EHCIitd *itd, uint32_t addr) { USBDevice *dev; USBEndpoint *ep; uint32_t i, len, pid, dir, devaddr, endp; uint32_t pg, off, ptr1, ptr2, max, mult; ehci->periodic_sched_active = PERIODIC_ACTIVE; dir =(itd->bufptr[1] & ITD_BUFPTR_DIRECTION); devaddr = get_field(itd->bufptr[0], ITD_BUFPTR_DEVADDR); endp = get_field(itd->bufptr[0], ITD_BUFPTR_EP); max = get_field(itd->bufptr[1], ITD_BUFPTR_MAXPKT); mult = get_field(itd->bufptr[2], ITD_BUFPTR_MULT); for(i = 0; i < 8; i++) { if (itd->transact[i] & ITD_XACT_ACTIVE) { pg = get_field(itd->transact[i], ITD_XACT_PGSEL); off = itd->transact[i] & ITD_XACT_OFFSET_MASK; ptr1 = (itd->bufptr[pg] & ITD_BUFPTR_MASK); ptr2 = (itd->bufptr[pg+1] & ITD_BUFPTR_MASK); len = get_field(itd->transact[i], ITD_XACT_LENGTH); if (len > max * mult) { len = max * mult; } if (len > BUFF_SIZE) { return -1; } qemu_sglist_init(&ehci->isgl, DEVICE(ehci), 2, ehci->as); if (off + len > 4096) { uint32_t len2 = off + len - 4096; uint32_t len1 = len - len2; qemu_sglist_add(&ehci->isgl, ptr1 + off, len1); qemu_sglist_add(&ehci->isgl, ptr2, len2); } else { qemu_sglist_add(&ehci->isgl, ptr1 + off, len); } pid = dir ? USB_TOKEN_IN : USB_TOKEN_OUT; dev = ehci_find_device(ehci, devaddr); ep = usb_ep_get(dev, pid, endp); if (ep && ep->type == USB_ENDPOINT_XFER_ISOC) { usb_packet_setup(&ehci->ipacket, pid, ep, 0, addr, false, (itd->transact[i] & ITD_XACT_IOC) != 0); usb_packet_map(&ehci->ipacket, &ehci->isgl); usb_handle_packet(dev, &ehci->ipacket); usb_packet_unmap(&ehci->ipacket, &ehci->isgl); } else { DPRINTF("ISOCH: attempt to addess non-iso endpoint\n"); ehci->ipacket.status = USB_RET_NAK; ehci->ipacket.actual_length = 0; } qemu_sglist_destroy(&ehci->isgl); switch (ehci->ipacket.status) { case USB_RET_SUCCESS: break; default: fprintf(stderr, "Unexpected iso usb result: %d\n", ehci->ipacket.status); case USB_RET_IOERROR: case USB_RET_NODEV: if (dir) { itd->transact[i] |= ITD_XACT_XACTERR; ehci_raise_irq(ehci, USBSTS_ERRINT); } break; case USB_RET_BABBLE: itd->transact[i] |= ITD_XACT_BABBLE; ehci_raise_irq(ehci, USBSTS_ERRINT); break; case USB_RET_NAK: ehci->ipacket.actual_length = 0; break; } if (!dir) { set_field(&itd->transact[i], len - ehci->ipacket.actual_length, ITD_XACT_LENGTH); } else { set_field(&itd->transact[i], ehci->ipacket.actual_length, ITD_XACT_LENGTH); } if (itd->transact[i] & ITD_XACT_IOC) { ehci_raise_irq(ehci, USBSTS_INT); } itd->transact[i] &= ~ITD_XACT_ACTIVE; } } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(EHCIState *VAR_0, EHCIitd *VAR_1, uint32_t VAR_2) { USBDevice *dev; USBEndpoint *ep; uint32_t i, len, pid, dir, devaddr, endp; uint32_t pg, off, ptr1, ptr2, max, mult; VAR_0->periodic_sched_active = PERIODIC_ACTIVE; dir =(VAR_1->bufptr[1] & ITD_BUFPTR_DIRECTION); devaddr = get_field(VAR_1->bufptr[0], ITD_BUFPTR_DEVADDR); endp = get_field(VAR_1->bufptr[0], ITD_BUFPTR_EP); max = get_field(VAR_1->bufptr[1], ITD_BUFPTR_MAXPKT); mult = get_field(VAR_1->bufptr[2], ITD_BUFPTR_MULT); for(i = 0; i < 8; i++) { if (VAR_1->transact[i] & ITD_XACT_ACTIVE) { pg = get_field(VAR_1->transact[i], ITD_XACT_PGSEL); off = VAR_1->transact[i] & ITD_XACT_OFFSET_MASK; ptr1 = (VAR_1->bufptr[pg] & ITD_BUFPTR_MASK); ptr2 = (VAR_1->bufptr[pg+1] & ITD_BUFPTR_MASK); len = get_field(VAR_1->transact[i], ITD_XACT_LENGTH); if (len > max * mult) { len = max * mult; } if (len > BUFF_SIZE) { return -1; } qemu_sglist_init(&VAR_0->isgl, DEVICE(VAR_0), 2, VAR_0->as); if (off + len > 4096) { uint32_t len2 = off + len - 4096; uint32_t len1 = len - len2; qemu_sglist_add(&VAR_0->isgl, ptr1 + off, len1); qemu_sglist_add(&VAR_0->isgl, ptr2, len2); } else { qemu_sglist_add(&VAR_0->isgl, ptr1 + off, len); } pid = dir ? USB_TOKEN_IN : USB_TOKEN_OUT; dev = ehci_find_device(VAR_0, devaddr); ep = usb_ep_get(dev, pid, endp); if (ep && ep->type == USB_ENDPOINT_XFER_ISOC) { usb_packet_setup(&VAR_0->ipacket, pid, ep, 0, VAR_2, false, (VAR_1->transact[i] & ITD_XACT_IOC) != 0); usb_packet_map(&VAR_0->ipacket, &VAR_0->isgl); usb_handle_packet(dev, &VAR_0->ipacket); usb_packet_unmap(&VAR_0->ipacket, &VAR_0->isgl); } else { DPRINTF("ISOCH: attempt to addess non-iso endpoint\n"); VAR_0->ipacket.status = USB_RET_NAK; VAR_0->ipacket.actual_length = 0; } qemu_sglist_destroy(&VAR_0->isgl); switch (VAR_0->ipacket.status) { case USB_RET_SUCCESS: break; default: fprintf(stderr, "Unexpected iso usb result: %d\n", VAR_0->ipacket.status); case USB_RET_IOERROR: case USB_RET_NODEV: if (dir) { VAR_1->transact[i] |= ITD_XACT_XACTERR; ehci_raise_irq(VAR_0, USBSTS_ERRINT); } break; case USB_RET_BABBLE: VAR_1->transact[i] |= ITD_XACT_BABBLE; ehci_raise_irq(VAR_0, USBSTS_ERRINT); break; case USB_RET_NAK: VAR_0->ipacket.actual_length = 0; break; } if (!dir) { set_field(&VAR_1->transact[i], len - VAR_0->ipacket.actual_length, ITD_XACT_LENGTH); } else { set_field(&VAR_1->transact[i], VAR_0->ipacket.actual_length, ITD_XACT_LENGTH); } if (VAR_1->transact[i] & ITD_XACT_IOC) { ehci_raise_irq(VAR_0, USBSTS_INT); } VAR_1->transact[i] &= ~ITD_XACT_ACTIVE; } } return 0; }
[ "static int FUNC_0(EHCIState *VAR_0,\nEHCIitd *VAR_1,\nuint32_t VAR_2)\n{", "USBDevice *dev;", "USBEndpoint *ep;", "uint32_t i, len, pid, dir, devaddr, endp;", "uint32_t pg, off, ptr1, ptr2, max, mult;", "VAR_0->periodic_sched_active = PERIODIC_ACTIVE;", "dir =(VAR_1->bufptr[1] & ITD_BUFPTR_DIRECTION);", "devaddr = get_field(VAR_1->bufptr[0], ITD_BUFPTR_DEVADDR);", "endp = get_field(VAR_1->bufptr[0], ITD_BUFPTR_EP);", "max = get_field(VAR_1->bufptr[1], ITD_BUFPTR_MAXPKT);", "mult = get_field(VAR_1->bufptr[2], ITD_BUFPTR_MULT);", "for(i = 0; i < 8; i++) {", "if (VAR_1->transact[i] & ITD_XACT_ACTIVE) {", "pg = get_field(VAR_1->transact[i], ITD_XACT_PGSEL);", "off = VAR_1->transact[i] & ITD_XACT_OFFSET_MASK;", "ptr1 = (VAR_1->bufptr[pg] & ITD_BUFPTR_MASK);", "ptr2 = (VAR_1->bufptr[pg+1] & ITD_BUFPTR_MASK);", "len = get_field(VAR_1->transact[i], ITD_XACT_LENGTH);", "if (len > max * mult) {", "len = max * mult;", "}", "if (len > BUFF_SIZE) {", "return -1;", "}", "qemu_sglist_init(&VAR_0->isgl, DEVICE(VAR_0), 2, VAR_0->as);", "if (off + len > 4096) {", "uint32_t len2 = off + len - 4096;", "uint32_t len1 = len - len2;", "qemu_sglist_add(&VAR_0->isgl, ptr1 + off, len1);", "qemu_sglist_add(&VAR_0->isgl, ptr2, len2);", "} else {", "qemu_sglist_add(&VAR_0->isgl, ptr1 + off, len);", "}", "pid = dir ? USB_TOKEN_IN : USB_TOKEN_OUT;", "dev = ehci_find_device(VAR_0, devaddr);", "ep = usb_ep_get(dev, pid, endp);", "if (ep && ep->type == USB_ENDPOINT_XFER_ISOC) {", "usb_packet_setup(&VAR_0->ipacket, pid, ep, 0, VAR_2, false,\n(VAR_1->transact[i] & ITD_XACT_IOC) != 0);", "usb_packet_map(&VAR_0->ipacket, &VAR_0->isgl);", "usb_handle_packet(dev, &VAR_0->ipacket);", "usb_packet_unmap(&VAR_0->ipacket, &VAR_0->isgl);", "} else {", "DPRINTF(\"ISOCH: attempt to addess non-iso endpoint\\n\");", "VAR_0->ipacket.status = USB_RET_NAK;", "VAR_0->ipacket.actual_length = 0;", "}", "qemu_sglist_destroy(&VAR_0->isgl);", "switch (VAR_0->ipacket.status) {", "case USB_RET_SUCCESS:\nbreak;", "default:\nfprintf(stderr, \"Unexpected iso usb result: %d\\n\",\nVAR_0->ipacket.status);", "case USB_RET_IOERROR:\ncase USB_RET_NODEV:\nif (dir) {", "VAR_1->transact[i] |= ITD_XACT_XACTERR;", "ehci_raise_irq(VAR_0, USBSTS_ERRINT);", "}", "break;", "case USB_RET_BABBLE:\nVAR_1->transact[i] |= ITD_XACT_BABBLE;", "ehci_raise_irq(VAR_0, USBSTS_ERRINT);", "break;", "case USB_RET_NAK:\nVAR_0->ipacket.actual_length = 0;", "break;", "}", "if (!dir) {", "set_field(&VAR_1->transact[i], len - VAR_0->ipacket.actual_length,\nITD_XACT_LENGTH);", "} else {", "set_field(&VAR_1->transact[i], VAR_0->ipacket.actual_length,\nITD_XACT_LENGTH);", "}", "if (VAR_1->transact[i] & ITD_XACT_IOC) {", "ehci_raise_irq(VAR_0, USBSTS_INT);", "}", "VAR_1->transact[i] &= ~ITD_XACT_ACTIVE;", "}", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ], [ 55 ], [ 59 ], [ 61 ], [ 63 ], [ 67 ], [ 69 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 89 ], [ 93 ], [ 95 ], [ 97 ], [ 99, 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 123 ], [ 125, 127 ], [ 129, 131, 133 ], [ 137, 139, 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153, 155 ], [ 157 ], [ 159 ], [ 161, 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173, 175 ], [ 177 ], [ 179, 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ] ]
20,093
uint64_t helper_fctid (uint64_t arg) { CPU_DoubleU farg; farg.ll = arg; if (unlikely(float64_is_signaling_nan(farg.d))) { /* sNaN conversion */ farg.ll = fload_invalid_op_excp(POWERPC_EXCP_FP_VXSNAN | POWERPC_EXCP_FP_VXCVI); } else if (unlikely(float64_is_nan(farg.d) || float64_is_infinity(farg.d))) { /* qNan / infinity conversion */ farg.ll = fload_invalid_op_excp(POWERPC_EXCP_FP_VXCVI); } else { farg.ll = float64_to_int64(farg.d, &env->fp_status); } return farg.ll; }
false
qemu
185698715dfb18c82ad2a5dbc169908602d43e81
uint64_t helper_fctid (uint64_t arg) { CPU_DoubleU farg; farg.ll = arg; if (unlikely(float64_is_signaling_nan(farg.d))) { farg.ll = fload_invalid_op_excp(POWERPC_EXCP_FP_VXSNAN | POWERPC_EXCP_FP_VXCVI); } else if (unlikely(float64_is_nan(farg.d) || float64_is_infinity(farg.d))) { farg.ll = fload_invalid_op_excp(POWERPC_EXCP_FP_VXCVI); } else { farg.ll = float64_to_int64(farg.d, &env->fp_status); } return farg.ll; }
{ "code": [], "line_no": [] }
uint64_t FUNC_0 (uint64_t arg) { CPU_DoubleU farg; farg.ll = arg; if (unlikely(float64_is_signaling_nan(farg.d))) { farg.ll = fload_invalid_op_excp(POWERPC_EXCP_FP_VXSNAN | POWERPC_EXCP_FP_VXCVI); } else if (unlikely(float64_is_nan(farg.d) || float64_is_infinity(farg.d))) { farg.ll = fload_invalid_op_excp(POWERPC_EXCP_FP_VXCVI); } else { farg.ll = float64_to_int64(farg.d, &env->fp_status); } return farg.ll; }
[ "uint64_t FUNC_0 (uint64_t arg)\n{", "CPU_DoubleU farg;", "farg.ll = arg;", "if (unlikely(float64_is_signaling_nan(farg.d))) {", "farg.ll = fload_invalid_op_excp(POWERPC_EXCP_FP_VXSNAN | POWERPC_EXCP_FP_VXCVI);", "} else if (unlikely(float64_is_nan(farg.d) || float64_is_infinity(farg.d))) {", "farg.ll = fload_invalid_op_excp(POWERPC_EXCP_FP_VXCVI);", "} else {", "farg.ll = float64_to_int64(farg.d, &env->fp_status);", "}", "return farg.ll;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ] ]
20,094
static void pc_q35_init(MachineState *machine) { PCMachineState *pcms = PC_MACHINE(machine); Q35PCIHost *q35_host; PCIHostState *phb; PCIBus *host_bus; PCIDevice *lpc; BusState *idebus[MAX_SATA_PORTS]; ISADevice *rtc_state; MemoryRegion *pci_memory; MemoryRegion *rom_memory; MemoryRegion *ram_memory; GSIState *gsi_state; ISABus *isa_bus; int pci_enabled = 1; qemu_irq *gsi; qemu_irq *i8259; int i; ICH9LPCState *ich9_lpc; PCIDevice *ahci; DeviceState *icc_bridge; PcGuestInfo *guest_info; ram_addr_t lowmem; DriveInfo *hd[MAX_SATA_PORTS]; MachineClass *mc = MACHINE_GET_CLASS(machine); /* Check whether RAM fits below 4G (leaving 1/2 GByte for IO memory * and 256 Mbytes for PCI Express Enhanced Configuration Access Mapping * also known as MMCFG). * If it doesn't, we need to split it in chunks below and above 4G. * In any case, try to make sure that guest addresses aligned at * 1G boundaries get mapped to host addresses aligned at 1G boundaries. * For old machine types, use whatever split we used historically to avoid * breaking migration. */ if (machine->ram_size >= 0xb0000000) { lowmem = gigabyte_align ? 0x80000000 : 0xb0000000; } else { lowmem = 0xb0000000; } /* Handle the machine opt max-ram-below-4g. It is basically doing * min(qemu limit, user limit). */ if (lowmem > pcms->max_ram_below_4g) { lowmem = pcms->max_ram_below_4g; if (machine->ram_size - lowmem > lowmem && lowmem & ((1ULL << 30) - 1)) { error_report("Warning: Large machine and max_ram_below_4g(%"PRIu64 ") not a multiple of 1G; possible bad performance.", pcms->max_ram_below_4g); } } if (machine->ram_size >= lowmem) { pcms->above_4g_mem_size = machine->ram_size - lowmem; pcms->below_4g_mem_size = lowmem; } else { pcms->above_4g_mem_size = 0; pcms->below_4g_mem_size = machine->ram_size; } if (xen_enabled() && xen_hvm_init(pcms, &ram_memory) != 0) { fprintf(stderr, "xen hardware virtual machine initialisation failed\n"); exit(1); } icc_bridge = qdev_create(NULL, TYPE_ICC_BRIDGE); object_property_add_child(qdev_get_machine(), "icc-bridge", OBJECT(icc_bridge), NULL); pc_cpus_init(machine->cpu_model, icc_bridge); pc_acpi_init("q35-acpi-dsdt.aml"); kvmclock_create(); /* pci enabled */ if (pci_enabled) { pci_memory = g_new(MemoryRegion, 1); memory_region_init(pci_memory, NULL, "pci", UINT64_MAX); rom_memory = pci_memory; } else { pci_memory = NULL; rom_memory = get_system_memory(); } guest_info = pc_guest_info_init(pcms); guest_info->isapc_ram_fw = false; guest_info->has_acpi_build = has_acpi_build; guest_info->has_reserved_memory = has_reserved_memory; guest_info->rsdp_in_ram = rsdp_in_ram; /* Migration was not supported in 2.0 for Q35, so do not bother * with this hack (see hw/i386/acpi-build.c). */ guest_info->legacy_acpi_table_size = 0; if (smbios_defaults) { /* These values are guest ABI, do not change */ smbios_set_defaults("QEMU", "Standard PC (Q35 + ICH9, 2009)", mc->name, smbios_legacy_mode, smbios_uuid_encoded, SMBIOS_ENTRY_POINT_21); } /* allocate ram and load rom/bios */ if (!xen_enabled()) { pc_memory_init(pcms, get_system_memory(), rom_memory, &ram_memory, guest_info); } /* irq lines */ gsi_state = g_malloc0(sizeof(*gsi_state)); if (kvm_irqchip_in_kernel()) { kvm_pc_setup_irq_routing(pci_enabled); gsi = qemu_allocate_irqs(kvm_pc_gsi_handler, gsi_state, GSI_NUM_PINS); } else { gsi = qemu_allocate_irqs(gsi_handler, gsi_state, GSI_NUM_PINS); } /* create pci host bus */ q35_host = Q35_HOST_DEVICE(qdev_create(NULL, TYPE_Q35_HOST_DEVICE)); object_property_add_child(qdev_get_machine(), "q35", OBJECT(q35_host), NULL); q35_host->mch.ram_memory = ram_memory; q35_host->mch.pci_address_space = pci_memory; q35_host->mch.system_memory = get_system_memory(); q35_host->mch.address_space_io = get_system_io(); q35_host->mch.below_4g_mem_size = pcms->below_4g_mem_size; q35_host->mch.above_4g_mem_size = pcms->above_4g_mem_size; q35_host->mch.guest_info = guest_info; /* pci */ qdev_init_nofail(DEVICE(q35_host)); phb = PCI_HOST_BRIDGE(q35_host); host_bus = phb->bus; /* create ISA bus */ lpc = pci_create_simple_multifunction(host_bus, PCI_DEVFN(ICH9_LPC_DEV, ICH9_LPC_FUNC), true, TYPE_ICH9_LPC_DEVICE); object_property_add_link(OBJECT(machine), PC_MACHINE_ACPI_DEVICE_PROP, TYPE_HOTPLUG_HANDLER, (Object **)&pcms->acpi_dev, object_property_allow_set_link, OBJ_PROP_LINK_UNREF_ON_RELEASE, &error_abort); object_property_set_link(OBJECT(machine), OBJECT(lpc), PC_MACHINE_ACPI_DEVICE_PROP, &error_abort); ich9_lpc = ICH9_LPC_DEVICE(lpc); ich9_lpc->pic = gsi; ich9_lpc->ioapic = gsi_state->ioapic_irq; pci_bus_irqs(host_bus, ich9_lpc_set_irq, ich9_lpc_map_irq, ich9_lpc, ICH9_LPC_NB_PIRQS); pci_bus_set_route_irq_fn(host_bus, ich9_route_intx_pin_to_irq); isa_bus = ich9_lpc->isa_bus; /*end early*/ isa_bus_irqs(isa_bus, gsi); if (kvm_irqchip_in_kernel()) { i8259 = kvm_i8259_init(isa_bus); } else if (xen_enabled()) { i8259 = xen_interrupt_controller_init(); } else { i8259 = i8259_init(isa_bus, pc_allocate_cpu_irq()); } for (i = 0; i < ISA_NUM_IRQS; i++) { gsi_state->i8259_irq[i] = i8259[i]; } if (pci_enabled) { ioapic_init_gsi(gsi_state, "q35"); } qdev_init_nofail(icc_bridge); pc_register_ferr_irq(gsi[13]); assert(pcms->vmport != ON_OFF_AUTO_MAX); if (pcms->vmport == ON_OFF_AUTO_AUTO) { pcms->vmport = xen_enabled() ? ON_OFF_AUTO_OFF : ON_OFF_AUTO_ON; } /* init basic PC hardware */ pc_basic_device_init(isa_bus, gsi, &rtc_state, !mc->no_floppy, (pcms->vmport != ON_OFF_AUTO_ON), 0xff0104); /* connect pm stuff to lpc */ ich9_lpc_pm_init(lpc, pc_machine_is_smm_enabled(pcms), !mc->no_tco); /* ahci and SATA device, for q35 1 ahci controller is built-in */ ahci = pci_create_simple_multifunction(host_bus, PCI_DEVFN(ICH9_SATA1_DEV, ICH9_SATA1_FUNC), true, "ich9-ahci"); idebus[0] = qdev_get_child_bus(&ahci->qdev, "ide.0"); idebus[1] = qdev_get_child_bus(&ahci->qdev, "ide.1"); g_assert(MAX_SATA_PORTS == ICH_AHCI(ahci)->ahci.ports); ide_drive_get(hd, ICH_AHCI(ahci)->ahci.ports); ahci_ide_create_devs(ahci, hd); if (usb_enabled()) { /* Should we create 6 UHCI according to ich9 spec? */ ehci_create_ich9_with_companions(host_bus, 0x1d); } /* TODO: Populate SPD eeprom data. */ smbus_eeprom_init(ich9_smb_init(host_bus, PCI_DEVFN(ICH9_SMB_DEV, ICH9_SMB_FUNC), 0xb100), 8, NULL, 0); pc_cmos_init(pcms, idebus[0], idebus[1], rtc_state); /* the rest devices to which pci devfn is automatically assigned */ pc_vga_init(isa_bus, host_bus); pc_nic_init(isa_bus, host_bus); if (pci_enabled) { pc_pci_device_init(host_bus); } }
false
qemu
46232aaacb66733d3e16dcbd0d26c32ec388801d
static void pc_q35_init(MachineState *machine) { PCMachineState *pcms = PC_MACHINE(machine); Q35PCIHost *q35_host; PCIHostState *phb; PCIBus *host_bus; PCIDevice *lpc; BusState *idebus[MAX_SATA_PORTS]; ISADevice *rtc_state; MemoryRegion *pci_memory; MemoryRegion *rom_memory; MemoryRegion *ram_memory; GSIState *gsi_state; ISABus *isa_bus; int pci_enabled = 1; qemu_irq *gsi; qemu_irq *i8259; int i; ICH9LPCState *ich9_lpc; PCIDevice *ahci; DeviceState *icc_bridge; PcGuestInfo *guest_info; ram_addr_t lowmem; DriveInfo *hd[MAX_SATA_PORTS]; MachineClass *mc = MACHINE_GET_CLASS(machine); if (machine->ram_size >= 0xb0000000) { lowmem = gigabyte_align ? 0x80000000 : 0xb0000000; } else { lowmem = 0xb0000000; } if (lowmem > pcms->max_ram_below_4g) { lowmem = pcms->max_ram_below_4g; if (machine->ram_size - lowmem > lowmem && lowmem & ((1ULL << 30) - 1)) { error_report("Warning: Large machine and max_ram_below_4g(%"PRIu64 ") not a multiple of 1G; possible bad performance.", pcms->max_ram_below_4g); } } if (machine->ram_size >= lowmem) { pcms->above_4g_mem_size = machine->ram_size - lowmem; pcms->below_4g_mem_size = lowmem; } else { pcms->above_4g_mem_size = 0; pcms->below_4g_mem_size = machine->ram_size; } if (xen_enabled() && xen_hvm_init(pcms, &ram_memory) != 0) { fprintf(stderr, "xen hardware virtual machine initialisation failed\n"); exit(1); } icc_bridge = qdev_create(NULL, TYPE_ICC_BRIDGE); object_property_add_child(qdev_get_machine(), "icc-bridge", OBJECT(icc_bridge), NULL); pc_cpus_init(machine->cpu_model, icc_bridge); pc_acpi_init("q35-acpi-dsdt.aml"); kvmclock_create(); if (pci_enabled) { pci_memory = g_new(MemoryRegion, 1); memory_region_init(pci_memory, NULL, "pci", UINT64_MAX); rom_memory = pci_memory; } else { pci_memory = NULL; rom_memory = get_system_memory(); } guest_info = pc_guest_info_init(pcms); guest_info->isapc_ram_fw = false; guest_info->has_acpi_build = has_acpi_build; guest_info->has_reserved_memory = has_reserved_memory; guest_info->rsdp_in_ram = rsdp_in_ram; guest_info->legacy_acpi_table_size = 0; if (smbios_defaults) { smbios_set_defaults("QEMU", "Standard PC (Q35 + ICH9, 2009)", mc->name, smbios_legacy_mode, smbios_uuid_encoded, SMBIOS_ENTRY_POINT_21); } if (!xen_enabled()) { pc_memory_init(pcms, get_system_memory(), rom_memory, &ram_memory, guest_info); } gsi_state = g_malloc0(sizeof(*gsi_state)); if (kvm_irqchip_in_kernel()) { kvm_pc_setup_irq_routing(pci_enabled); gsi = qemu_allocate_irqs(kvm_pc_gsi_handler, gsi_state, GSI_NUM_PINS); } else { gsi = qemu_allocate_irqs(gsi_handler, gsi_state, GSI_NUM_PINS); } q35_host = Q35_HOST_DEVICE(qdev_create(NULL, TYPE_Q35_HOST_DEVICE)); object_property_add_child(qdev_get_machine(), "q35", OBJECT(q35_host), NULL); q35_host->mch.ram_memory = ram_memory; q35_host->mch.pci_address_space = pci_memory; q35_host->mch.system_memory = get_system_memory(); q35_host->mch.address_space_io = get_system_io(); q35_host->mch.below_4g_mem_size = pcms->below_4g_mem_size; q35_host->mch.above_4g_mem_size = pcms->above_4g_mem_size; q35_host->mch.guest_info = guest_info; qdev_init_nofail(DEVICE(q35_host)); phb = PCI_HOST_BRIDGE(q35_host); host_bus = phb->bus; lpc = pci_create_simple_multifunction(host_bus, PCI_DEVFN(ICH9_LPC_DEV, ICH9_LPC_FUNC), true, TYPE_ICH9_LPC_DEVICE); object_property_add_link(OBJECT(machine), PC_MACHINE_ACPI_DEVICE_PROP, TYPE_HOTPLUG_HANDLER, (Object **)&pcms->acpi_dev, object_property_allow_set_link, OBJ_PROP_LINK_UNREF_ON_RELEASE, &error_abort); object_property_set_link(OBJECT(machine), OBJECT(lpc), PC_MACHINE_ACPI_DEVICE_PROP, &error_abort); ich9_lpc = ICH9_LPC_DEVICE(lpc); ich9_lpc->pic = gsi; ich9_lpc->ioapic = gsi_state->ioapic_irq; pci_bus_irqs(host_bus, ich9_lpc_set_irq, ich9_lpc_map_irq, ich9_lpc, ICH9_LPC_NB_PIRQS); pci_bus_set_route_irq_fn(host_bus, ich9_route_intx_pin_to_irq); isa_bus = ich9_lpc->isa_bus; isa_bus_irqs(isa_bus, gsi); if (kvm_irqchip_in_kernel()) { i8259 = kvm_i8259_init(isa_bus); } else if (xen_enabled()) { i8259 = xen_interrupt_controller_init(); } else { i8259 = i8259_init(isa_bus, pc_allocate_cpu_irq()); } for (i = 0; i < ISA_NUM_IRQS; i++) { gsi_state->i8259_irq[i] = i8259[i]; } if (pci_enabled) { ioapic_init_gsi(gsi_state, "q35"); } qdev_init_nofail(icc_bridge); pc_register_ferr_irq(gsi[13]); assert(pcms->vmport != ON_OFF_AUTO_MAX); if (pcms->vmport == ON_OFF_AUTO_AUTO) { pcms->vmport = xen_enabled() ? ON_OFF_AUTO_OFF : ON_OFF_AUTO_ON; } pc_basic_device_init(isa_bus, gsi, &rtc_state, !mc->no_floppy, (pcms->vmport != ON_OFF_AUTO_ON), 0xff0104); ich9_lpc_pm_init(lpc, pc_machine_is_smm_enabled(pcms), !mc->no_tco); ahci = pci_create_simple_multifunction(host_bus, PCI_DEVFN(ICH9_SATA1_DEV, ICH9_SATA1_FUNC), true, "ich9-ahci"); idebus[0] = qdev_get_child_bus(&ahci->qdev, "ide.0"); idebus[1] = qdev_get_child_bus(&ahci->qdev, "ide.1"); g_assert(MAX_SATA_PORTS == ICH_AHCI(ahci)->ahci.ports); ide_drive_get(hd, ICH_AHCI(ahci)->ahci.ports); ahci_ide_create_devs(ahci, hd); if (usb_enabled()) { ehci_create_ich9_with_companions(host_bus, 0x1d); } smbus_eeprom_init(ich9_smb_init(host_bus, PCI_DEVFN(ICH9_SMB_DEV, ICH9_SMB_FUNC), 0xb100), 8, NULL, 0); pc_cmos_init(pcms, idebus[0], idebus[1], rtc_state); pc_vga_init(isa_bus, host_bus); pc_nic_init(isa_bus, host_bus); if (pci_enabled) { pc_pci_device_init(host_bus); } }
{ "code": [], "line_no": [] }
static void FUNC_0(MachineState *VAR_0) { PCMachineState *pcms = PC_MACHINE(VAR_0); Q35PCIHost *q35_host; PCIHostState *phb; PCIBus *host_bus; PCIDevice *lpc; BusState *idebus[MAX_SATA_PORTS]; ISADevice *rtc_state; MemoryRegion *pci_memory; MemoryRegion *rom_memory; MemoryRegion *ram_memory; GSIState *gsi_state; ISABus *isa_bus; int VAR_1 = 1; qemu_irq *gsi; qemu_irq *i8259; int VAR_2; ICH9LPCState *ich9_lpc; PCIDevice *ahci; DeviceState *icc_bridge; PcGuestInfo *guest_info; ram_addr_t lowmem; DriveInfo *hd[MAX_SATA_PORTS]; MachineClass *mc = MACHINE_GET_CLASS(VAR_0); if (VAR_0->ram_size >= 0xb0000000) { lowmem = gigabyte_align ? 0x80000000 : 0xb0000000; } else { lowmem = 0xb0000000; } if (lowmem > pcms->max_ram_below_4g) { lowmem = pcms->max_ram_below_4g; if (VAR_0->ram_size - lowmem > lowmem && lowmem & ((1ULL << 30) - 1)) { error_report("Warning: Large VAR_0 and max_ram_below_4g(%"PRIu64 ") not a multiple of 1G; possible bad performance.", pcms->max_ram_below_4g); } } if (VAR_0->ram_size >= lowmem) { pcms->above_4g_mem_size = VAR_0->ram_size - lowmem; pcms->below_4g_mem_size = lowmem; } else { pcms->above_4g_mem_size = 0; pcms->below_4g_mem_size = VAR_0->ram_size; } if (xen_enabled() && xen_hvm_init(pcms, &ram_memory) != 0) { fprintf(stderr, "xen hardware virtual VAR_0 initialisation failed\n"); exit(1); } icc_bridge = qdev_create(NULL, TYPE_ICC_BRIDGE); object_property_add_child(qdev_get_machine(), "icc-bridge", OBJECT(icc_bridge), NULL); pc_cpus_init(VAR_0->cpu_model, icc_bridge); pc_acpi_init("q35-acpi-dsdt.aml"); kvmclock_create(); if (VAR_1) { pci_memory = g_new(MemoryRegion, 1); memory_region_init(pci_memory, NULL, "pci", UINT64_MAX); rom_memory = pci_memory; } else { pci_memory = NULL; rom_memory = get_system_memory(); } guest_info = pc_guest_info_init(pcms); guest_info->isapc_ram_fw = false; guest_info->has_acpi_build = has_acpi_build; guest_info->has_reserved_memory = has_reserved_memory; guest_info->rsdp_in_ram = rsdp_in_ram; guest_info->legacy_acpi_table_size = 0; if (smbios_defaults) { smbios_set_defaults("QEMU", "Standard PC (Q35 + ICH9, 2009)", mc->name, smbios_legacy_mode, smbios_uuid_encoded, SMBIOS_ENTRY_POINT_21); } if (!xen_enabled()) { pc_memory_init(pcms, get_system_memory(), rom_memory, &ram_memory, guest_info); } gsi_state = g_malloc0(sizeof(*gsi_state)); if (kvm_irqchip_in_kernel()) { kvm_pc_setup_irq_routing(VAR_1); gsi = qemu_allocate_irqs(kvm_pc_gsi_handler, gsi_state, GSI_NUM_PINS); } else { gsi = qemu_allocate_irqs(gsi_handler, gsi_state, GSI_NUM_PINS); } q35_host = Q35_HOST_DEVICE(qdev_create(NULL, TYPE_Q35_HOST_DEVICE)); object_property_add_child(qdev_get_machine(), "q35", OBJECT(q35_host), NULL); q35_host->mch.ram_memory = ram_memory; q35_host->mch.pci_address_space = pci_memory; q35_host->mch.system_memory = get_system_memory(); q35_host->mch.address_space_io = get_system_io(); q35_host->mch.below_4g_mem_size = pcms->below_4g_mem_size; q35_host->mch.above_4g_mem_size = pcms->above_4g_mem_size; q35_host->mch.guest_info = guest_info; qdev_init_nofail(DEVICE(q35_host)); phb = PCI_HOST_BRIDGE(q35_host); host_bus = phb->bus; lpc = pci_create_simple_multifunction(host_bus, PCI_DEVFN(ICH9_LPC_DEV, ICH9_LPC_FUNC), true, TYPE_ICH9_LPC_DEVICE); object_property_add_link(OBJECT(VAR_0), PC_MACHINE_ACPI_DEVICE_PROP, TYPE_HOTPLUG_HANDLER, (Object **)&pcms->acpi_dev, object_property_allow_set_link, OBJ_PROP_LINK_UNREF_ON_RELEASE, &error_abort); object_property_set_link(OBJECT(VAR_0), OBJECT(lpc), PC_MACHINE_ACPI_DEVICE_PROP, &error_abort); ich9_lpc = ICH9_LPC_DEVICE(lpc); ich9_lpc->pic = gsi; ich9_lpc->ioapic = gsi_state->ioapic_irq; pci_bus_irqs(host_bus, ich9_lpc_set_irq, ich9_lpc_map_irq, ich9_lpc, ICH9_LPC_NB_PIRQS); pci_bus_set_route_irq_fn(host_bus, ich9_route_intx_pin_to_irq); isa_bus = ich9_lpc->isa_bus; isa_bus_irqs(isa_bus, gsi); if (kvm_irqchip_in_kernel()) { i8259 = kvm_i8259_init(isa_bus); } else if (xen_enabled()) { i8259 = xen_interrupt_controller_init(); } else { i8259 = i8259_init(isa_bus, pc_allocate_cpu_irq()); } for (VAR_2 = 0; VAR_2 < ISA_NUM_IRQS; VAR_2++) { gsi_state->i8259_irq[VAR_2] = i8259[VAR_2]; } if (VAR_1) { ioapic_init_gsi(gsi_state, "q35"); } qdev_init_nofail(icc_bridge); pc_register_ferr_irq(gsi[13]); assert(pcms->vmport != ON_OFF_AUTO_MAX); if (pcms->vmport == ON_OFF_AUTO_AUTO) { pcms->vmport = xen_enabled() ? ON_OFF_AUTO_OFF : ON_OFF_AUTO_ON; } pc_basic_device_init(isa_bus, gsi, &rtc_state, !mc->no_floppy, (pcms->vmport != ON_OFF_AUTO_ON), 0xff0104); ich9_lpc_pm_init(lpc, pc_machine_is_smm_enabled(pcms), !mc->no_tco); ahci = pci_create_simple_multifunction(host_bus, PCI_DEVFN(ICH9_SATA1_DEV, ICH9_SATA1_FUNC), true, "ich9-ahci"); idebus[0] = qdev_get_child_bus(&ahci->qdev, "ide.0"); idebus[1] = qdev_get_child_bus(&ahci->qdev, "ide.1"); g_assert(MAX_SATA_PORTS == ICH_AHCI(ahci)->ahci.ports); ide_drive_get(hd, ICH_AHCI(ahci)->ahci.ports); ahci_ide_create_devs(ahci, hd); if (usb_enabled()) { ehci_create_ich9_with_companions(host_bus, 0x1d); } smbus_eeprom_init(ich9_smb_init(host_bus, PCI_DEVFN(ICH9_SMB_DEV, ICH9_SMB_FUNC), 0xb100), 8, NULL, 0); pc_cmos_init(pcms, idebus[0], idebus[1], rtc_state); pc_vga_init(isa_bus, host_bus); pc_nic_init(isa_bus, host_bus); if (VAR_1) { pc_pci_device_init(host_bus); } }
[ "static void FUNC_0(MachineState *VAR_0)\n{", "PCMachineState *pcms = PC_MACHINE(VAR_0);", "Q35PCIHost *q35_host;", "PCIHostState *phb;", "PCIBus *host_bus;", "PCIDevice *lpc;", "BusState *idebus[MAX_SATA_PORTS];", "ISADevice *rtc_state;", "MemoryRegion *pci_memory;", "MemoryRegion *rom_memory;", "MemoryRegion *ram_memory;", "GSIState *gsi_state;", "ISABus *isa_bus;", "int VAR_1 = 1;", "qemu_irq *gsi;", "qemu_irq *i8259;", "int VAR_2;", "ICH9LPCState *ich9_lpc;", "PCIDevice *ahci;", "DeviceState *icc_bridge;", "PcGuestInfo *guest_info;", "ram_addr_t lowmem;", "DriveInfo *hd[MAX_SATA_PORTS];", "MachineClass *mc = MACHINE_GET_CLASS(VAR_0);", "if (VAR_0->ram_size >= 0xb0000000) {", "lowmem = gigabyte_align ? 0x80000000 : 0xb0000000;", "} else {", "lowmem = 0xb0000000;", "}", "if (lowmem > pcms->max_ram_below_4g) {", "lowmem = pcms->max_ram_below_4g;", "if (VAR_0->ram_size - lowmem > lowmem &&\nlowmem & ((1ULL << 30) - 1)) {", "error_report(\"Warning: Large VAR_0 and max_ram_below_4g(%\"PRIu64\n\") not a multiple of 1G; possible bad performance.\",", "pcms->max_ram_below_4g);", "}", "}", "if (VAR_0->ram_size >= lowmem) {", "pcms->above_4g_mem_size = VAR_0->ram_size - lowmem;", "pcms->below_4g_mem_size = lowmem;", "} else {", "pcms->above_4g_mem_size = 0;", "pcms->below_4g_mem_size = VAR_0->ram_size;", "}", "if (xen_enabled() && xen_hvm_init(pcms, &ram_memory) != 0) {", "fprintf(stderr, \"xen hardware virtual VAR_0 initialisation failed\\n\");", "exit(1);", "}", "icc_bridge = qdev_create(NULL, TYPE_ICC_BRIDGE);", "object_property_add_child(qdev_get_machine(), \"icc-bridge\",\nOBJECT(icc_bridge), NULL);", "pc_cpus_init(VAR_0->cpu_model, icc_bridge);", "pc_acpi_init(\"q35-acpi-dsdt.aml\");", "kvmclock_create();", "if (VAR_1) {", "pci_memory = g_new(MemoryRegion, 1);", "memory_region_init(pci_memory, NULL, \"pci\", UINT64_MAX);", "rom_memory = pci_memory;", "} else {", "pci_memory = NULL;", "rom_memory = get_system_memory();", "}", "guest_info = pc_guest_info_init(pcms);", "guest_info->isapc_ram_fw = false;", "guest_info->has_acpi_build = has_acpi_build;", "guest_info->has_reserved_memory = has_reserved_memory;", "guest_info->rsdp_in_ram = rsdp_in_ram;", "guest_info->legacy_acpi_table_size = 0;", "if (smbios_defaults) {", "smbios_set_defaults(\"QEMU\", \"Standard PC (Q35 + ICH9, 2009)\",\nmc->name, smbios_legacy_mode, smbios_uuid_encoded,\nSMBIOS_ENTRY_POINT_21);", "}", "if (!xen_enabled()) {", "pc_memory_init(pcms, get_system_memory(),\nrom_memory, &ram_memory, guest_info);", "}", "gsi_state = g_malloc0(sizeof(*gsi_state));", "if (kvm_irqchip_in_kernel()) {", "kvm_pc_setup_irq_routing(VAR_1);", "gsi = qemu_allocate_irqs(kvm_pc_gsi_handler, gsi_state,\nGSI_NUM_PINS);", "} else {", "gsi = qemu_allocate_irqs(gsi_handler, gsi_state, GSI_NUM_PINS);", "}", "q35_host = Q35_HOST_DEVICE(qdev_create(NULL, TYPE_Q35_HOST_DEVICE));", "object_property_add_child(qdev_get_machine(), \"q35\", OBJECT(q35_host), NULL);", "q35_host->mch.ram_memory = ram_memory;", "q35_host->mch.pci_address_space = pci_memory;", "q35_host->mch.system_memory = get_system_memory();", "q35_host->mch.address_space_io = get_system_io();", "q35_host->mch.below_4g_mem_size = pcms->below_4g_mem_size;", "q35_host->mch.above_4g_mem_size = pcms->above_4g_mem_size;", "q35_host->mch.guest_info = guest_info;", "qdev_init_nofail(DEVICE(q35_host));", "phb = PCI_HOST_BRIDGE(q35_host);", "host_bus = phb->bus;", "lpc = pci_create_simple_multifunction(host_bus, PCI_DEVFN(ICH9_LPC_DEV,\nICH9_LPC_FUNC), true,\nTYPE_ICH9_LPC_DEVICE);", "object_property_add_link(OBJECT(VAR_0), PC_MACHINE_ACPI_DEVICE_PROP,\nTYPE_HOTPLUG_HANDLER,\n(Object **)&pcms->acpi_dev,\nobject_property_allow_set_link,\nOBJ_PROP_LINK_UNREF_ON_RELEASE, &error_abort);", "object_property_set_link(OBJECT(VAR_0), OBJECT(lpc),\nPC_MACHINE_ACPI_DEVICE_PROP, &error_abort);", "ich9_lpc = ICH9_LPC_DEVICE(lpc);", "ich9_lpc->pic = gsi;", "ich9_lpc->ioapic = gsi_state->ioapic_irq;", "pci_bus_irqs(host_bus, ich9_lpc_set_irq, ich9_lpc_map_irq, ich9_lpc,\nICH9_LPC_NB_PIRQS);", "pci_bus_set_route_irq_fn(host_bus, ich9_route_intx_pin_to_irq);", "isa_bus = ich9_lpc->isa_bus;", "isa_bus_irqs(isa_bus, gsi);", "if (kvm_irqchip_in_kernel()) {", "i8259 = kvm_i8259_init(isa_bus);", "} else if (xen_enabled()) {", "i8259 = xen_interrupt_controller_init();", "} else {", "i8259 = i8259_init(isa_bus, pc_allocate_cpu_irq());", "}", "for (VAR_2 = 0; VAR_2 < ISA_NUM_IRQS; VAR_2++) {", "gsi_state->i8259_irq[VAR_2] = i8259[VAR_2];", "}", "if (VAR_1) {", "ioapic_init_gsi(gsi_state, \"q35\");", "}", "qdev_init_nofail(icc_bridge);", "pc_register_ferr_irq(gsi[13]);", "assert(pcms->vmport != ON_OFF_AUTO_MAX);", "if (pcms->vmport == ON_OFF_AUTO_AUTO) {", "pcms->vmport = xen_enabled() ? ON_OFF_AUTO_OFF : ON_OFF_AUTO_ON;", "}", "pc_basic_device_init(isa_bus, gsi, &rtc_state, !mc->no_floppy,\n(pcms->vmport != ON_OFF_AUTO_ON), 0xff0104);", "ich9_lpc_pm_init(lpc, pc_machine_is_smm_enabled(pcms), !mc->no_tco);", "ahci = pci_create_simple_multifunction(host_bus,\nPCI_DEVFN(ICH9_SATA1_DEV,\nICH9_SATA1_FUNC),\ntrue, \"ich9-ahci\");", "idebus[0] = qdev_get_child_bus(&ahci->qdev, \"ide.0\");", "idebus[1] = qdev_get_child_bus(&ahci->qdev, \"ide.1\");", "g_assert(MAX_SATA_PORTS == ICH_AHCI(ahci)->ahci.ports);", "ide_drive_get(hd, ICH_AHCI(ahci)->ahci.ports);", "ahci_ide_create_devs(ahci, hd);", "if (usb_enabled()) {", "ehci_create_ich9_with_companions(host_bus, 0x1d);", "}", "smbus_eeprom_init(ich9_smb_init(host_bus,\nPCI_DEVFN(ICH9_SMB_DEV, ICH9_SMB_FUNC),\n0xb100),\n8, NULL, 0);", "pc_cmos_init(pcms, idebus[0], idebus[1], rtc_state);", "pc_vga_init(isa_bus, host_bus);", "pc_nic_init(isa_bus, host_bus);", "if (VAR_1) {", "pc_pci_device_init(host_bus);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 89 ], [ 91 ], [ 93, 95 ], [ 97, 99 ], [ 101 ], [ 103 ], [ 105 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 135 ], [ 137, 139 ], [ 143 ], [ 145 ], [ 149 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 191 ], [ 195 ], [ 199, 201, 203 ], [ 205 ], [ 211 ], [ 213, 215 ], [ 217 ], [ 223 ], [ 225 ], [ 227 ], [ 229, 231 ], [ 233 ], [ 235 ], [ 237 ], [ 243 ], [ 247 ], [ 249 ], [ 251 ], [ 253 ], [ 255 ], [ 257 ], [ 259 ], [ 261 ], [ 265 ], [ 267 ], [ 269 ], [ 273, 275, 277 ], [ 281, 283, 285, 287, 289 ], [ 291, 293 ], [ 297 ], [ 299 ], [ 301 ], [ 303, 305 ], [ 307 ], [ 309 ], [ 315 ], [ 319 ], [ 321 ], [ 323 ], [ 325 ], [ 327 ], [ 329 ], [ 331 ], [ 335 ], [ 337 ], [ 339 ], [ 341 ], [ 343 ], [ 345 ], [ 347 ], [ 351 ], [ 355 ], [ 357 ], [ 359 ], [ 361 ], [ 367, 369 ], [ 375 ], [ 381, 383, 385, 387 ], [ 389 ], [ 391 ], [ 393 ], [ 395 ], [ 397 ], [ 401 ], [ 405 ], [ 407 ], [ 413, 415, 417, 419 ], [ 423 ], [ 429 ], [ 431 ], [ 433 ], [ 435 ], [ 437 ], [ 439 ] ]
20,096
static uint32_t nvram_readl (void *opaque, target_phys_addr_t addr) { M48t59State *NVRAM = opaque; uint32_t retval; retval = m48t59_read(NVRAM, addr) << 24; retval |= m48t59_read(NVRAM, addr + 1) << 16; retval |= m48t59_read(NVRAM, addr + 2) << 8; retval |= m48t59_read(NVRAM, addr + 3); return retval; }
false
qemu
a8170e5e97ad17ca169c64ba87ae2f53850dab4c
static uint32_t nvram_readl (void *opaque, target_phys_addr_t addr) { M48t59State *NVRAM = opaque; uint32_t retval; retval = m48t59_read(NVRAM, addr) << 24; retval |= m48t59_read(NVRAM, addr + 1) << 16; retval |= m48t59_read(NVRAM, addr + 2) << 8; retval |= m48t59_read(NVRAM, addr + 3); return retval; }
{ "code": [], "line_no": [] }
static uint32_t FUNC_0 (void *opaque, target_phys_addr_t addr) { M48t59State *NVRAM = opaque; uint32_t retval; retval = m48t59_read(NVRAM, addr) << 24; retval |= m48t59_read(NVRAM, addr + 1) << 16; retval |= m48t59_read(NVRAM, addr + 2) << 8; retval |= m48t59_read(NVRAM, addr + 3); return retval; }
[ "static uint32_t FUNC_0 (void *opaque, target_phys_addr_t addr)\n{", "M48t59State *NVRAM = opaque;", "uint32_t retval;", "retval = m48t59_read(NVRAM, addr) << 24;", "retval |= m48t59_read(NVRAM, addr + 1) << 16;", "retval |= m48t59_read(NVRAM, addr + 2) << 8;", "retval |= m48t59_read(NVRAM, addr + 3);", "return retval;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ] ]
20,097
static void tcg_out_label(TCGContext *s, int label_index, tcg_insn_unit *ptr) { TCGLabel *l = &s->labels[label_index]; intptr_t value = (intptr_t)ptr; TCGRelocation *r; assert(!l->has_value); for (r = l->u.first_reloc; r != NULL; r = r->next) { patch_reloc(r->ptr, r->type, value, r->addend); } l->has_value = 1; l->u.value_ptr = ptr; }
false
qemu
bec1631100323fac0900aea71043d5c4e22fc2fa
static void tcg_out_label(TCGContext *s, int label_index, tcg_insn_unit *ptr) { TCGLabel *l = &s->labels[label_index]; intptr_t value = (intptr_t)ptr; TCGRelocation *r; assert(!l->has_value); for (r = l->u.first_reloc; r != NULL; r = r->next) { patch_reloc(r->ptr, r->type, value, r->addend); } l->has_value = 1; l->u.value_ptr = ptr; }
{ "code": [], "line_no": [] }
static void FUNC_0(TCGContext *VAR_0, int VAR_1, tcg_insn_unit *VAR_2) { TCGLabel *l = &VAR_0->labels[VAR_1]; intptr_t value = (intptr_t)VAR_2; TCGRelocation *r; assert(!l->has_value); for (r = l->u.first_reloc; r != NULL; r = r->next) { patch_reloc(r->VAR_2, r->type, value, r->addend); } l->has_value = 1; l->u.value_ptr = VAR_2; }
[ "static void FUNC_0(TCGContext *VAR_0, int VAR_1, tcg_insn_unit *VAR_2)\n{", "TCGLabel *l = &VAR_0->labels[VAR_1];", "intptr_t value = (intptr_t)VAR_2;", "TCGRelocation *r;", "assert(!l->has_value);", "for (r = l->u.first_reloc; r != NULL; r = r->next) {", "patch_reloc(r->VAR_2, r->type, value, r->addend);", "}", "l->has_value = 1;", "l->u.value_ptr = VAR_2;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ] ]
20,099
static CharDriverState *qemu_chr_open_mux(CharDriverState *drv) { CharDriverState *chr; MuxDriver *d; chr = g_malloc0(sizeof(CharDriverState)); d = g_malloc0(sizeof(MuxDriver)); chr->opaque = d; d->drv = drv; d->focus = -1; chr->chr_write = mux_chr_write; chr->chr_update_read_handler = mux_chr_update_read_handler; chr->chr_accept_input = mux_chr_accept_input; /* Frontend guest-open / -close notification is not support with muxes */ chr->chr_set_fe_open = NULL; /* only default to opened state if we've realized the initial * set of muxes */ chr->explicit_be_open = muxes_realized ? 0 : 1; chr->is_mux = 1; return chr; }
false
qemu
db39fcf1f690b02d612e2bfc00980700887abe03
static CharDriverState *qemu_chr_open_mux(CharDriverState *drv) { CharDriverState *chr; MuxDriver *d; chr = g_malloc0(sizeof(CharDriverState)); d = g_malloc0(sizeof(MuxDriver)); chr->opaque = d; d->drv = drv; d->focus = -1; chr->chr_write = mux_chr_write; chr->chr_update_read_handler = mux_chr_update_read_handler; chr->chr_accept_input = mux_chr_accept_input; chr->chr_set_fe_open = NULL; chr->explicit_be_open = muxes_realized ? 0 : 1; chr->is_mux = 1; return chr; }
{ "code": [], "line_no": [] }
static CharDriverState *FUNC_0(CharDriverState *drv) { CharDriverState *chr; MuxDriver *d; chr = g_malloc0(sizeof(CharDriverState)); d = g_malloc0(sizeof(MuxDriver)); chr->opaque = d; d->drv = drv; d->focus = -1; chr->chr_write = mux_chr_write; chr->chr_update_read_handler = mux_chr_update_read_handler; chr->chr_accept_input = mux_chr_accept_input; chr->chr_set_fe_open = NULL; chr->explicit_be_open = muxes_realized ? 0 : 1; chr->is_mux = 1; return chr; }
[ "static CharDriverState *FUNC_0(CharDriverState *drv)\n{", "CharDriverState *chr;", "MuxDriver *d;", "chr = g_malloc0(sizeof(CharDriverState));", "d = g_malloc0(sizeof(MuxDriver));", "chr->opaque = d;", "d->drv = drv;", "d->focus = -1;", "chr->chr_write = mux_chr_write;", "chr->chr_update_read_handler = mux_chr_update_read_handler;", "chr->chr_accept_input = mux_chr_accept_input;", "chr->chr_set_fe_open = NULL;", "chr->explicit_be_open = muxes_realized ? 0 : 1;", "chr->is_mux = 1;", "return chr;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ] ]
20,100
static int xen_domain_watcher(void) { int qemu_running = 1; int fd[2], i, n, rc; char byte; if (pipe(fd) != 0) { qemu_log("%s: Huh? pipe error: %s\n", __FUNCTION__, strerror(errno)); return -1; } if (fork() != 0) return 0; /* not child */ /* close all file handles, except stdio/out/err, * our watch pipe and the xen interface handle */ n = getdtablesize(); for (i = 3; i < n; i++) { if (i == fd[0]) continue; if (i == xen_xc) continue; close(i); } /* ignore term signals */ signal(SIGINT, SIG_IGN); signal(SIGTERM, SIG_IGN); /* wait for qemu exiting */ while (qemu_running) { rc = read(fd[0], &byte, 1); switch (rc) { case -1: if (errno == EINTR) continue; qemu_log("%s: Huh? read error: %s\n", __FUNCTION__, strerror(errno)); qemu_running = 0; break; case 0: /* EOF -> qemu exited */ qemu_running = 0; break; default: qemu_log("%s: Huh? data on the watch pipe?\n", __FUNCTION__); break; } } /* cleanup */ qemu_log("%s: destroy domain %d\n", __FUNCTION__, xen_domid); xc_domain_destroy(xen_xc, xen_domid); _exit(0); }
false
qemu
d5b93ddfefe63d5869a8eb97ea3474867d3b105b
static int xen_domain_watcher(void) { int qemu_running = 1; int fd[2], i, n, rc; char byte; if (pipe(fd) != 0) { qemu_log("%s: Huh? pipe error: %s\n", __FUNCTION__, strerror(errno)); return -1; } if (fork() != 0) return 0; n = getdtablesize(); for (i = 3; i < n; i++) { if (i == fd[0]) continue; if (i == xen_xc) continue; close(i); } signal(SIGINT, SIG_IGN); signal(SIGTERM, SIG_IGN); while (qemu_running) { rc = read(fd[0], &byte, 1); switch (rc) { case -1: if (errno == EINTR) continue; qemu_log("%s: Huh? read error: %s\n", __FUNCTION__, strerror(errno)); qemu_running = 0; break; case 0: qemu_running = 0; break; default: qemu_log("%s: Huh? data on the watch pipe?\n", __FUNCTION__); break; } } qemu_log("%s: destroy domain %d\n", __FUNCTION__, xen_domid); xc_domain_destroy(xen_xc, xen_domid); _exit(0); }
{ "code": [], "line_no": [] }
static int FUNC_0(void) { int VAR_0 = 1; int VAR_1[2], VAR_2, VAR_3, VAR_4; char VAR_5; if (pipe(VAR_1) != 0) { qemu_log("%s: Huh? pipe error: %s\VAR_3", __FUNCTION__, strerror(errno)); return -1; } if (fork() != 0) return 0; VAR_3 = getdtablesize(); for (VAR_2 = 3; VAR_2 < VAR_3; VAR_2++) { if (VAR_2 == VAR_1[0]) continue; if (VAR_2 == xen_xc) continue; close(VAR_2); } signal(SIGINT, SIG_IGN); signal(SIGTERM, SIG_IGN); while (VAR_0) { VAR_4 = read(VAR_1[0], &VAR_5, 1); switch (VAR_4) { case -1: if (errno == EINTR) continue; qemu_log("%s: Huh? read error: %s\VAR_3", __FUNCTION__, strerror(errno)); VAR_0 = 0; break; case 0: VAR_0 = 0; break; default: qemu_log("%s: Huh? data on the watch pipe?\VAR_3", __FUNCTION__); break; } } qemu_log("%s: destroy domain %d\VAR_3", __FUNCTION__, xen_domid); xc_domain_destroy(xen_xc, xen_domid); _exit(0); }
[ "static int FUNC_0(void)\n{", "int VAR_0 = 1;", "int VAR_1[2], VAR_2, VAR_3, VAR_4;", "char VAR_5;", "if (pipe(VAR_1) != 0) {", "qemu_log(\"%s: Huh? pipe error: %s\\VAR_3\", __FUNCTION__, strerror(errno));", "return -1;", "}", "if (fork() != 0)\nreturn 0;", "VAR_3 = getdtablesize();", "for (VAR_2 = 3; VAR_2 < VAR_3; VAR_2++) {", "if (VAR_2 == VAR_1[0])\ncontinue;", "if (VAR_2 == xen_xc)\ncontinue;", "close(VAR_2);", "}", "signal(SIGINT, SIG_IGN);", "signal(SIGTERM, SIG_IGN);", "while (VAR_0) {", "VAR_4 = read(VAR_1[0], &VAR_5, 1);", "switch (VAR_4) {", "case -1:\nif (errno == EINTR)\ncontinue;", "qemu_log(\"%s: Huh? read error: %s\\VAR_3\", __FUNCTION__, strerror(errno));", "VAR_0 = 0;", "break;", "case 0:\nVAR_0 = 0;", "break;", "default:\nqemu_log(\"%s: Huh? data on the watch pipe?\\VAR_3\", __FUNCTION__);", "break;", "}", "}", "qemu_log(\"%s: destroy domain %d\\VAR_3\", __FUNCTION__, xen_domid);", "xc_domain_destroy(xen_xc, xen_domid);", "_exit(0);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21, 23 ], [ 31 ], [ 33 ], [ 35, 37 ], [ 39, 41 ], [ 43 ], [ 45 ], [ 51 ], [ 53 ], [ 59 ], [ 61 ], [ 63 ], [ 65, 67, 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77, 81 ], [ 83 ], [ 85, 87 ], [ 89 ], [ 91 ], [ 93 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ] ]
20,101
static int vnc_update_client(VncState *vs, int has_dirty, bool sync) { if (vs->need_update && vs->csock != -1) { VncDisplay *vd = vs->vd; VncJob *job; int y; int height; int n = 0; if (vs->output.offset && !vs->audio_cap && !vs->force_update) /* kernel send buffers are full -> drop frames to throttle */ return 0; if (!has_dirty && !vs->audio_cap && !vs->force_update) return 0; /* * Send screen updates to the vnc client using the server * surface and server dirty map. guest surface updates * happening in parallel don't disturb us, the next pass will * send them to the client. */ job = vnc_job_new(vs); height = MIN(pixman_image_get_height(vd->server), vs->client_height); y = 0; for (;;) { int x, h; unsigned long x2; unsigned long offset = find_next_bit((unsigned long *) &vs->dirty, height * VNC_DIRTY_BPL(vs), y * VNC_DIRTY_BPL(vs)); if (offset == height * VNC_DIRTY_BPL(vs)) { /* no more dirty bits */ break; } y = offset / VNC_DIRTY_BPL(vs); x = offset % VNC_DIRTY_BPL(vs); x2 = find_next_zero_bit((unsigned long *) &vs->dirty[y], VNC_DIRTY_BPL(vs), x); bitmap_clear(vs->dirty[y], x, x2 - x); h = find_and_clear_dirty_height(vs, y, x, x2, height); n += vnc_job_add_rect(job, x * VNC_DIRTY_PIXELS_PER_BIT, y, (x2 - x) * VNC_DIRTY_PIXELS_PER_BIT, h); } vnc_job_push(job); vs->force_update = 0; return n; } if (vs->csock == -1) { vnc_disconnect_finish(vs); } else if (sync) { vnc_jobs_join(vs); } return 0; }
false
qemu
2f487a3d40faff1772e14da6b921900915501f9a
static int vnc_update_client(VncState *vs, int has_dirty, bool sync) { if (vs->need_update && vs->csock != -1) { VncDisplay *vd = vs->vd; VncJob *job; int y; int height; int n = 0; if (vs->output.offset && !vs->audio_cap && !vs->force_update) return 0; if (!has_dirty && !vs->audio_cap && !vs->force_update) return 0; job = vnc_job_new(vs); height = MIN(pixman_image_get_height(vd->server), vs->client_height); y = 0; for (;;) { int x, h; unsigned long x2; unsigned long offset = find_next_bit((unsigned long *) &vs->dirty, height * VNC_DIRTY_BPL(vs), y * VNC_DIRTY_BPL(vs)); if (offset == height * VNC_DIRTY_BPL(vs)) { break; } y = offset / VNC_DIRTY_BPL(vs); x = offset % VNC_DIRTY_BPL(vs); x2 = find_next_zero_bit((unsigned long *) &vs->dirty[y], VNC_DIRTY_BPL(vs), x); bitmap_clear(vs->dirty[y], x, x2 - x); h = find_and_clear_dirty_height(vs, y, x, x2, height); n += vnc_job_add_rect(job, x * VNC_DIRTY_PIXELS_PER_BIT, y, (x2 - x) * VNC_DIRTY_PIXELS_PER_BIT, h); } vnc_job_push(job); vs->force_update = 0; return n; } if (vs->csock == -1) { vnc_disconnect_finish(vs); } else if (sync) { vnc_jobs_join(vs); } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(VncState *VAR_0, int VAR_1, bool VAR_2) { if (VAR_0->need_update && VAR_0->csock != -1) { VncDisplay *vd = VAR_0->vd; VncJob *job; int VAR_3; int VAR_4; int VAR_5 = 0; if (VAR_0->output.VAR_9 && !VAR_0->audio_cap && !VAR_0->force_update) return 0; if (!VAR_1 && !VAR_0->audio_cap && !VAR_0->force_update) return 0; job = vnc_job_new(VAR_0); VAR_4 = MIN(pixman_image_get_height(vd->server), VAR_0->client_height); VAR_3 = 0; for (;;) { int VAR_6, VAR_7; unsigned long VAR_8; unsigned long VAR_9 = find_next_bit((unsigned long *) &VAR_0->dirty, VAR_4 * VNC_DIRTY_BPL(VAR_0), VAR_3 * VNC_DIRTY_BPL(VAR_0)); if (VAR_9 == VAR_4 * VNC_DIRTY_BPL(VAR_0)) { break; } VAR_3 = VAR_9 / VNC_DIRTY_BPL(VAR_0); VAR_6 = VAR_9 % VNC_DIRTY_BPL(VAR_0); VAR_8 = find_next_zero_bit((unsigned long *) &VAR_0->dirty[VAR_3], VNC_DIRTY_BPL(VAR_0), VAR_6); bitmap_clear(VAR_0->dirty[VAR_3], VAR_6, VAR_8 - VAR_6); VAR_7 = find_and_clear_dirty_height(VAR_0, VAR_3, VAR_6, VAR_8, VAR_4); VAR_5 += vnc_job_add_rect(job, VAR_6 * VNC_DIRTY_PIXELS_PER_BIT, VAR_3, (VAR_8 - VAR_6) * VNC_DIRTY_PIXELS_PER_BIT, VAR_7); } vnc_job_push(job); VAR_0->force_update = 0; return VAR_5; } if (VAR_0->csock == -1) { vnc_disconnect_finish(VAR_0); } else if (VAR_2) { vnc_jobs_join(VAR_0); } return 0; }
[ "static int FUNC_0(VncState *VAR_0, int VAR_1, bool VAR_2)\n{", "if (VAR_0->need_update && VAR_0->csock != -1) {", "VncDisplay *vd = VAR_0->vd;", "VncJob *job;", "int VAR_3;", "int VAR_4;", "int VAR_5 = 0;", "if (VAR_0->output.VAR_9 && !VAR_0->audio_cap && !VAR_0->force_update)\nreturn 0;", "if (!VAR_1 && !VAR_0->audio_cap && !VAR_0->force_update)\nreturn 0;", "job = vnc_job_new(VAR_0);", "VAR_4 = MIN(pixman_image_get_height(vd->server), VAR_0->client_height);", "VAR_3 = 0;", "for (;;) {", "int VAR_6, VAR_7;", "unsigned long VAR_8;", "unsigned long VAR_9 = find_next_bit((unsigned long *) &VAR_0->dirty,\nVAR_4 * VNC_DIRTY_BPL(VAR_0),\nVAR_3 * VNC_DIRTY_BPL(VAR_0));", "if (VAR_9 == VAR_4 * VNC_DIRTY_BPL(VAR_0)) {", "break;", "}", "VAR_3 = VAR_9 / VNC_DIRTY_BPL(VAR_0);", "VAR_6 = VAR_9 % VNC_DIRTY_BPL(VAR_0);", "VAR_8 = find_next_zero_bit((unsigned long *) &VAR_0->dirty[VAR_3],\nVNC_DIRTY_BPL(VAR_0), VAR_6);", "bitmap_clear(VAR_0->dirty[VAR_3], VAR_6, VAR_8 - VAR_6);", "VAR_7 = find_and_clear_dirty_height(VAR_0, VAR_3, VAR_6, VAR_8, VAR_4);", "VAR_5 += vnc_job_add_rect(job, VAR_6 * VNC_DIRTY_PIXELS_PER_BIT, VAR_3,\n(VAR_8 - VAR_6) * VNC_DIRTY_PIXELS_PER_BIT, VAR_7);", "}", "vnc_job_push(job);", "VAR_0->force_update = 0;", "return VAR_5;", "}", "if (VAR_0->csock == -1) {", "vnc_disconnect_finish(VAR_0);", "} else if (VAR_2) {", "vnc_jobs_join(VAR_0);", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19, 23 ], [ 27, 29 ], [ 45 ], [ 49 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61, 63, 65 ], [ 67 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79, 81 ], [ 83 ], [ 85 ], [ 87, 89 ], [ 91 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 117 ], [ 119 ] ]
20,103
static int input_init(struct XenDevice *xendev) { struct XenInput *in = container_of(xendev, struct XenInput, c.xendev); if (!in->c.ds) { xen_be_printf(xendev, 1, "ds not set (yet)\n"); return -1; } xenstore_write_be_int(xendev, "feature-abs-pointer", 1); return 0; }
false
qemu
37cdfcf194825d03334542297bee3a3a4723e6e3
static int input_init(struct XenDevice *xendev) { struct XenInput *in = container_of(xendev, struct XenInput, c.xendev); if (!in->c.ds) { xen_be_printf(xendev, 1, "ds not set (yet)\n"); return -1; } xenstore_write_be_int(xendev, "feature-abs-pointer", 1); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(struct XenDevice *VAR_0) { struct XenInput *VAR_1 = container_of(VAR_0, struct XenInput, c.VAR_0); if (!VAR_1->c.ds) { xen_be_printf(VAR_0, 1, "ds not set (yet)\n"); return -1; } xenstore_write_be_int(VAR_0, "feature-abs-pointer", 1); return 0; }
[ "static int FUNC_0(struct XenDevice *VAR_0)\n{", "struct XenInput *VAR_1 = container_of(VAR_0, struct XenInput, c.VAR_0);", "if (!VAR_1->c.ds) {", "xen_be_printf(VAR_0, 1, \"ds not set (yet)\\n\");", "return -1;", "}", "xenstore_write_be_int(VAR_0, \"feature-abs-pointer\", 1);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ] ]
20,104
static int start_auth_vnc(VncState *vs) { make_challenge(vs); /* Send client a 'random' challenge */ vnc_write(vs, vs->challenge, sizeof(vs->challenge)); vnc_flush(vs); vnc_read_when(vs, protocol_client_auth_vnc, sizeof(vs->challenge)); return 0; }
false
qemu
5fb6c7a8b26eab1a22207d24b4784bd2b39ab54b
static int start_auth_vnc(VncState *vs) { make_challenge(vs); vnc_write(vs, vs->challenge, sizeof(vs->challenge)); vnc_flush(vs); vnc_read_when(vs, protocol_client_auth_vnc, sizeof(vs->challenge)); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(VncState *VAR_0) { make_challenge(VAR_0); vnc_write(VAR_0, VAR_0->challenge, sizeof(VAR_0->challenge)); vnc_flush(VAR_0); vnc_read_when(VAR_0, protocol_client_auth_vnc, sizeof(VAR_0->challenge)); return 0; }
[ "static int FUNC_0(VncState *VAR_0)\n{", "make_challenge(VAR_0);", "vnc_write(VAR_0, VAR_0->challenge, sizeof(VAR_0->challenge));", "vnc_flush(VAR_0);", "vnc_read_when(VAR_0, protocol_client_auth_vnc, sizeof(VAR_0->challenge));", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ] ]
20,107
static void io_region_del(MemoryListener *listener, MemoryRegionSection *section) { isa_unassign_ioport(section->offset_within_address_space, int128_get64(section->size)); }
false
qemu
b40acf99bef69fa8ab0f9092ff162fde945eec12
static void io_region_del(MemoryListener *listener, MemoryRegionSection *section) { isa_unassign_ioport(section->offset_within_address_space, int128_get64(section->size)); }
{ "code": [], "line_no": [] }
static void FUNC_0(MemoryListener *VAR_0, MemoryRegionSection *VAR_1) { isa_unassign_ioport(VAR_1->offset_within_address_space, int128_get64(VAR_1->size)); }
[ "static void FUNC_0(MemoryListener *VAR_0,\nMemoryRegionSection *VAR_1)\n{", "isa_unassign_ioport(VAR_1->offset_within_address_space,\nint128_get64(VAR_1->size));", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7, 9 ], [ 11 ] ]
20,108
static void disas_thumb_insn(CPUState *env, DisasContext *s) { uint32_t val, insn, op, rm, rn, rd, shift, cond; int32_t offset; int i; TCGv tmp; TCGv tmp2; TCGv addr; if (s->condexec_mask) { cond = s->condexec_cond; if (cond != 0x0e) { /* Skip conditional when condition is AL. */ s->condlabel = gen_new_label(); gen_test_cc(cond ^ 1, s->condlabel); s->condjmp = 1; } } insn = lduw_code(s->pc); s->pc += 2; switch (insn >> 12) { case 0: case 1: rd = insn & 7; op = (insn >> 11) & 3; if (op == 3) { /* add/subtract */ rn = (insn >> 3) & 7; tmp = load_reg(s, rn); if (insn & (1 << 10)) { /* immediate */ tmp2 = tcg_temp_new_i32(); tcg_gen_movi_i32(tmp2, (insn >> 6) & 7); } else { /* reg */ rm = (insn >> 6) & 7; tmp2 = load_reg(s, rm); } if (insn & (1 << 9)) { if (s->condexec_mask) tcg_gen_sub_i32(tmp, tmp, tmp2); else gen_helper_sub_cc(tmp, tmp, tmp2); } else { if (s->condexec_mask) tcg_gen_add_i32(tmp, tmp, tmp2); else gen_helper_add_cc(tmp, tmp, tmp2); } tcg_temp_free_i32(tmp2); store_reg(s, rd, tmp); } else { /* shift immediate */ rm = (insn >> 3) & 7; shift = (insn >> 6) & 0x1f; tmp = load_reg(s, rm); gen_arm_shift_im(tmp, op, shift, s->condexec_mask == 0); if (!s->condexec_mask) gen_logic_CC(tmp); store_reg(s, rd, tmp); } break; case 2: case 3: /* arithmetic large immediate */ op = (insn >> 11) & 3; rd = (insn >> 8) & 0x7; if (op == 0) { /* mov */ tmp = tcg_temp_new_i32(); tcg_gen_movi_i32(tmp, insn & 0xff); if (!s->condexec_mask) gen_logic_CC(tmp); store_reg(s, rd, tmp); } else { tmp = load_reg(s, rd); tmp2 = tcg_temp_new_i32(); tcg_gen_movi_i32(tmp2, insn & 0xff); switch (op) { case 1: /* cmp */ gen_helper_sub_cc(tmp, tmp, tmp2); tcg_temp_free_i32(tmp); tcg_temp_free_i32(tmp2); break; case 2: /* add */ if (s->condexec_mask) tcg_gen_add_i32(tmp, tmp, tmp2); else gen_helper_add_cc(tmp, tmp, tmp2); tcg_temp_free_i32(tmp2); store_reg(s, rd, tmp); break; case 3: /* sub */ if (s->condexec_mask) tcg_gen_sub_i32(tmp, tmp, tmp2); else gen_helper_sub_cc(tmp, tmp, tmp2); tcg_temp_free_i32(tmp2); store_reg(s, rd, tmp); break; } } break; case 4: if (insn & (1 << 11)) { rd = (insn >> 8) & 7; /* load pc-relative. Bit 1 of PC is ignored. */ val = s->pc + 2 + ((insn & 0xff) * 4); val &= ~(uint32_t)2; addr = tcg_temp_new_i32(); tcg_gen_movi_i32(addr, val); tmp = gen_ld32(addr, IS_USER(s)); tcg_temp_free_i32(addr); store_reg(s, rd, tmp); break; } if (insn & (1 << 10)) { /* data processing extended or blx */ rd = (insn & 7) | ((insn >> 4) & 8); rm = (insn >> 3) & 0xf; op = (insn >> 8) & 3; switch (op) { case 0: /* add */ tmp = load_reg(s, rd); tmp2 = load_reg(s, rm); tcg_gen_add_i32(tmp, tmp, tmp2); tcg_temp_free_i32(tmp2); store_reg(s, rd, tmp); break; case 1: /* cmp */ tmp = load_reg(s, rd); tmp2 = load_reg(s, rm); gen_helper_sub_cc(tmp, tmp, tmp2); tcg_temp_free_i32(tmp2); tcg_temp_free_i32(tmp); break; case 2: /* mov/cpy */ tmp = load_reg(s, rm); store_reg(s, rd, tmp); break; case 3:/* branch [and link] exchange thumb register */ tmp = load_reg(s, rm); if (insn & (1 << 7)) { val = (uint32_t)s->pc | 1; tmp2 = tcg_temp_new_i32(); tcg_gen_movi_i32(tmp2, val); store_reg(s, 14, tmp2); } gen_bx(s, tmp); break; } break; } /* data processing register */ rd = insn & 7; rm = (insn >> 3) & 7; op = (insn >> 6) & 0xf; if (op == 2 || op == 3 || op == 4 || op == 7) { /* the shift/rotate ops want the operands backwards */ val = rm; rm = rd; rd = val; val = 1; } else { val = 0; } if (op == 9) { /* neg */ tmp = tcg_temp_new_i32(); tcg_gen_movi_i32(tmp, 0); } else if (op != 0xf) { /* mvn doesn't read its first operand */ tmp = load_reg(s, rd); } else { TCGV_UNUSED(tmp); } tmp2 = load_reg(s, rm); switch (op) { case 0x0: /* and */ tcg_gen_and_i32(tmp, tmp, tmp2); if (!s->condexec_mask) gen_logic_CC(tmp); break; case 0x1: /* eor */ tcg_gen_xor_i32(tmp, tmp, tmp2); if (!s->condexec_mask) gen_logic_CC(tmp); break; case 0x2: /* lsl */ if (s->condexec_mask) { gen_helper_shl(tmp2, tmp2, tmp); } else { gen_helper_shl_cc(tmp2, tmp2, tmp); gen_logic_CC(tmp2); } break; case 0x3: /* lsr */ if (s->condexec_mask) { gen_helper_shr(tmp2, tmp2, tmp); } else { gen_helper_shr_cc(tmp2, tmp2, tmp); gen_logic_CC(tmp2); } break; case 0x4: /* asr */ if (s->condexec_mask) { gen_helper_sar(tmp2, tmp2, tmp); } else { gen_helper_sar_cc(tmp2, tmp2, tmp); gen_logic_CC(tmp2); } break; case 0x5: /* adc */ if (s->condexec_mask) gen_adc(tmp, tmp2); else gen_helper_adc_cc(tmp, tmp, tmp2); break; case 0x6: /* sbc */ if (s->condexec_mask) gen_sub_carry(tmp, tmp, tmp2); else gen_helper_sbc_cc(tmp, tmp, tmp2); break; case 0x7: /* ror */ if (s->condexec_mask) { tcg_gen_andi_i32(tmp, tmp, 0x1f); tcg_gen_rotr_i32(tmp2, tmp2, tmp); } else { gen_helper_ror_cc(tmp2, tmp2, tmp); gen_logic_CC(tmp2); } break; case 0x8: /* tst */ tcg_gen_and_i32(tmp, tmp, tmp2); gen_logic_CC(tmp); rd = 16; break; case 0x9: /* neg */ if (s->condexec_mask) tcg_gen_neg_i32(tmp, tmp2); else gen_helper_sub_cc(tmp, tmp, tmp2); break; case 0xa: /* cmp */ gen_helper_sub_cc(tmp, tmp, tmp2); rd = 16; break; case 0xb: /* cmn */ gen_helper_add_cc(tmp, tmp, tmp2); rd = 16; break; case 0xc: /* orr */ tcg_gen_or_i32(tmp, tmp, tmp2); if (!s->condexec_mask) gen_logic_CC(tmp); break; case 0xd: /* mul */ tcg_gen_mul_i32(tmp, tmp, tmp2); if (!s->condexec_mask) gen_logic_CC(tmp); break; case 0xe: /* bic */ tcg_gen_andc_i32(tmp, tmp, tmp2); if (!s->condexec_mask) gen_logic_CC(tmp); break; case 0xf: /* mvn */ tcg_gen_not_i32(tmp2, tmp2); if (!s->condexec_mask) gen_logic_CC(tmp2); val = 1; rm = rd; break; } if (rd != 16) { if (val) { store_reg(s, rm, tmp2); if (op != 0xf) tcg_temp_free_i32(tmp); } else { store_reg(s, rd, tmp); tcg_temp_free_i32(tmp2); } } else { tcg_temp_free_i32(tmp); tcg_temp_free_i32(tmp2); } break; case 5: /* load/store register offset. */ rd = insn & 7; rn = (insn >> 3) & 7; rm = (insn >> 6) & 7; op = (insn >> 9) & 7; addr = load_reg(s, rn); tmp = load_reg(s, rm); tcg_gen_add_i32(addr, addr, tmp); tcg_temp_free_i32(tmp); if (op < 3) /* store */ tmp = load_reg(s, rd); switch (op) { case 0: /* str */ gen_st32(tmp, addr, IS_USER(s)); break; case 1: /* strh */ gen_st16(tmp, addr, IS_USER(s)); break; case 2: /* strb */ gen_st8(tmp, addr, IS_USER(s)); break; case 3: /* ldrsb */ tmp = gen_ld8s(addr, IS_USER(s)); break; case 4: /* ldr */ tmp = gen_ld32(addr, IS_USER(s)); break; case 5: /* ldrh */ tmp = gen_ld16u(addr, IS_USER(s)); break; case 6: /* ldrb */ tmp = gen_ld8u(addr, IS_USER(s)); break; case 7: /* ldrsh */ tmp = gen_ld16s(addr, IS_USER(s)); break; } if (op >= 3) /* load */ store_reg(s, rd, tmp); tcg_temp_free_i32(addr); break; case 6: /* load/store word immediate offset */ rd = insn & 7; rn = (insn >> 3) & 7; addr = load_reg(s, rn); val = (insn >> 4) & 0x7c; tcg_gen_addi_i32(addr, addr, val); if (insn & (1 << 11)) { /* load */ tmp = gen_ld32(addr, IS_USER(s)); store_reg(s, rd, tmp); } else { /* store */ tmp = load_reg(s, rd); gen_st32(tmp, addr, IS_USER(s)); } tcg_temp_free_i32(addr); break; case 7: /* load/store byte immediate offset */ rd = insn & 7; rn = (insn >> 3) & 7; addr = load_reg(s, rn); val = (insn >> 6) & 0x1f; tcg_gen_addi_i32(addr, addr, val); if (insn & (1 << 11)) { /* load */ tmp = gen_ld8u(addr, IS_USER(s)); store_reg(s, rd, tmp); } else { /* store */ tmp = load_reg(s, rd); gen_st8(tmp, addr, IS_USER(s)); } tcg_temp_free_i32(addr); break; case 8: /* load/store halfword immediate offset */ rd = insn & 7; rn = (insn >> 3) & 7; addr = load_reg(s, rn); val = (insn >> 5) & 0x3e; tcg_gen_addi_i32(addr, addr, val); if (insn & (1 << 11)) { /* load */ tmp = gen_ld16u(addr, IS_USER(s)); store_reg(s, rd, tmp); } else { /* store */ tmp = load_reg(s, rd); gen_st16(tmp, addr, IS_USER(s)); } tcg_temp_free_i32(addr); break; case 9: /* load/store from stack */ rd = (insn >> 8) & 7; addr = load_reg(s, 13); val = (insn & 0xff) * 4; tcg_gen_addi_i32(addr, addr, val); if (insn & (1 << 11)) { /* load */ tmp = gen_ld32(addr, IS_USER(s)); store_reg(s, rd, tmp); } else { /* store */ tmp = load_reg(s, rd); gen_st32(tmp, addr, IS_USER(s)); } tcg_temp_free_i32(addr); break; case 10: /* add to high reg */ rd = (insn >> 8) & 7; if (insn & (1 << 11)) { /* SP */ tmp = load_reg(s, 13); } else { /* PC. bit 1 is ignored. */ tmp = tcg_temp_new_i32(); tcg_gen_movi_i32(tmp, (s->pc + 2) & ~(uint32_t)2); } val = (insn & 0xff) * 4; tcg_gen_addi_i32(tmp, tmp, val); store_reg(s, rd, tmp); break; case 11: /* misc */ op = (insn >> 8) & 0xf; switch (op) { case 0: /* adjust stack pointer */ tmp = load_reg(s, 13); val = (insn & 0x7f) * 4; if (insn & (1 << 7)) val = -(int32_t)val; tcg_gen_addi_i32(tmp, tmp, val); store_reg(s, 13, tmp); break; case 2: /* sign/zero extend. */ ARCH(6); rd = insn & 7; rm = (insn >> 3) & 7; tmp = load_reg(s, rm); switch ((insn >> 6) & 3) { case 0: gen_sxth(tmp); break; case 1: gen_sxtb(tmp); break; case 2: gen_uxth(tmp); break; case 3: gen_uxtb(tmp); break; } store_reg(s, rd, tmp); break; case 4: case 5: case 0xc: case 0xd: /* push/pop */ addr = load_reg(s, 13); if (insn & (1 << 8)) offset = 4; else offset = 0; for (i = 0; i < 8; i++) { if (insn & (1 << i)) offset += 4; } if ((insn & (1 << 11)) == 0) { tcg_gen_addi_i32(addr, addr, -offset); } for (i = 0; i < 8; i++) { if (insn & (1 << i)) { if (insn & (1 << 11)) { /* pop */ tmp = gen_ld32(addr, IS_USER(s)); store_reg(s, i, tmp); } else { /* push */ tmp = load_reg(s, i); gen_st32(tmp, addr, IS_USER(s)); } /* advance to the next address. */ tcg_gen_addi_i32(addr, addr, 4); } } TCGV_UNUSED(tmp); if (insn & (1 << 8)) { if (insn & (1 << 11)) { /* pop pc */ tmp = gen_ld32(addr, IS_USER(s)); /* don't set the pc until the rest of the instruction has completed */ } else { /* push lr */ tmp = load_reg(s, 14); gen_st32(tmp, addr, IS_USER(s)); } tcg_gen_addi_i32(addr, addr, 4); } if ((insn & (1 << 11)) == 0) { tcg_gen_addi_i32(addr, addr, -offset); } /* write back the new stack pointer */ store_reg(s, 13, addr); /* set the new PC value */ if ((insn & 0x0900) == 0x0900) gen_bx(s, tmp); break; case 1: case 3: case 9: case 11: /* czb */ rm = insn & 7; tmp = load_reg(s, rm); s->condlabel = gen_new_label(); s->condjmp = 1; if (insn & (1 << 11)) tcg_gen_brcondi_i32(TCG_COND_EQ, tmp, 0, s->condlabel); else tcg_gen_brcondi_i32(TCG_COND_NE, tmp, 0, s->condlabel); tcg_temp_free_i32(tmp); offset = ((insn & 0xf8) >> 2) | (insn & 0x200) >> 3; val = (uint32_t)s->pc + 2; val += offset; gen_jmp(s, val); break; case 15: /* IT, nop-hint. */ if ((insn & 0xf) == 0) { gen_nop_hint(s, (insn >> 4) & 0xf); break; } /* If Then. */ s->condexec_cond = (insn >> 4) & 0xe; s->condexec_mask = insn & 0x1f; /* No actual code generated for this insn, just setup state. */ break; case 0xe: /* bkpt */ gen_exception_insn(s, 2, EXCP_BKPT); break; case 0xa: /* rev */ ARCH(6); rn = (insn >> 3) & 0x7; rd = insn & 0x7; tmp = load_reg(s, rn); switch ((insn >> 6) & 3) { case 0: tcg_gen_bswap32_i32(tmp, tmp); break; case 1: gen_rev16(tmp); break; case 3: gen_revsh(tmp); break; default: goto illegal_op; } store_reg(s, rd, tmp); break; case 6: /* cps */ ARCH(6); if (IS_USER(s)) break; if (IS_M(env)) { tmp = tcg_const_i32((insn & (1 << 4)) != 0); /* PRIMASK */ if (insn & 1) { addr = tcg_const_i32(16); gen_helper_v7m_msr(cpu_env, addr, tmp); tcg_temp_free_i32(addr); } /* FAULTMASK */ if (insn & 2) { addr = tcg_const_i32(17); gen_helper_v7m_msr(cpu_env, addr, tmp); tcg_temp_free_i32(addr); } tcg_temp_free_i32(tmp); gen_lookup_tb(s); } else { if (insn & (1 << 4)) shift = CPSR_A | CPSR_I | CPSR_F; else shift = 0; gen_set_psr_im(s, ((insn & 7) << 6), 0, shift); } break; default: goto undef; } break; case 12: /* load/store multiple */ rn = (insn >> 8) & 0x7; addr = load_reg(s, rn); for (i = 0; i < 8; i++) { if (insn & (1 << i)) { if (insn & (1 << 11)) { /* load */ tmp = gen_ld32(addr, IS_USER(s)); store_reg(s, i, tmp); } else { /* store */ tmp = load_reg(s, i); gen_st32(tmp, addr, IS_USER(s)); } /* advance to the next address */ tcg_gen_addi_i32(addr, addr, 4); } } /* Base register writeback. */ if ((insn & (1 << rn)) == 0) { store_reg(s, rn, addr); } else { tcg_temp_free_i32(addr); } break; case 13: /* conditional branch or swi */ cond = (insn >> 8) & 0xf; if (cond == 0xe) goto undef; if (cond == 0xf) { /* swi */ gen_set_pc_im(s->pc); s->is_jmp = DISAS_SWI; break; } /* generate a conditional jump to next instruction */ s->condlabel = gen_new_label(); gen_test_cc(cond ^ 1, s->condlabel); s->condjmp = 1; /* jump to the offset */ val = (uint32_t)s->pc + 2; offset = ((int32_t)insn << 24) >> 24; val += offset << 1; gen_jmp(s, val); break; case 14: if (insn & (1 << 11)) { if (disas_thumb2_insn(env, s, insn)) goto undef32; break; } /* unconditional branch */ val = (uint32_t)s->pc; offset = ((int32_t)insn << 21) >> 21; val += (offset << 1) + 2; gen_jmp(s, val); break; case 15: if (disas_thumb2_insn(env, s, insn)) goto undef32; break; } return; undef32: gen_exception_insn(s, 4, EXCP_UDEF); return; illegal_op: undef: gen_exception_insn(s, 2, EXCP_UDEF); }
false
qemu
be5e7a76010bd14d09f74504ed6368782e701888
static void disas_thumb_insn(CPUState *env, DisasContext *s) { uint32_t val, insn, op, rm, rn, rd, shift, cond; int32_t offset; int i; TCGv tmp; TCGv tmp2; TCGv addr; if (s->condexec_mask) { cond = s->condexec_cond; if (cond != 0x0e) { s->condlabel = gen_new_label(); gen_test_cc(cond ^ 1, s->condlabel); s->condjmp = 1; } } insn = lduw_code(s->pc); s->pc += 2; switch (insn >> 12) { case 0: case 1: rd = insn & 7; op = (insn >> 11) & 3; if (op == 3) { rn = (insn >> 3) & 7; tmp = load_reg(s, rn); if (insn & (1 << 10)) { tmp2 = tcg_temp_new_i32(); tcg_gen_movi_i32(tmp2, (insn >> 6) & 7); } else { rm = (insn >> 6) & 7; tmp2 = load_reg(s, rm); } if (insn & (1 << 9)) { if (s->condexec_mask) tcg_gen_sub_i32(tmp, tmp, tmp2); else gen_helper_sub_cc(tmp, tmp, tmp2); } else { if (s->condexec_mask) tcg_gen_add_i32(tmp, tmp, tmp2); else gen_helper_add_cc(tmp, tmp, tmp2); } tcg_temp_free_i32(tmp2); store_reg(s, rd, tmp); } else { rm = (insn >> 3) & 7; shift = (insn >> 6) & 0x1f; tmp = load_reg(s, rm); gen_arm_shift_im(tmp, op, shift, s->condexec_mask == 0); if (!s->condexec_mask) gen_logic_CC(tmp); store_reg(s, rd, tmp); } break; case 2: case 3: op = (insn >> 11) & 3; rd = (insn >> 8) & 0x7; if (op == 0) { tmp = tcg_temp_new_i32(); tcg_gen_movi_i32(tmp, insn & 0xff); if (!s->condexec_mask) gen_logic_CC(tmp); store_reg(s, rd, tmp); } else { tmp = load_reg(s, rd); tmp2 = tcg_temp_new_i32(); tcg_gen_movi_i32(tmp2, insn & 0xff); switch (op) { case 1: gen_helper_sub_cc(tmp, tmp, tmp2); tcg_temp_free_i32(tmp); tcg_temp_free_i32(tmp2); break; case 2: if (s->condexec_mask) tcg_gen_add_i32(tmp, tmp, tmp2); else gen_helper_add_cc(tmp, tmp, tmp2); tcg_temp_free_i32(tmp2); store_reg(s, rd, tmp); break; case 3: if (s->condexec_mask) tcg_gen_sub_i32(tmp, tmp, tmp2); else gen_helper_sub_cc(tmp, tmp, tmp2); tcg_temp_free_i32(tmp2); store_reg(s, rd, tmp); break; } } break; case 4: if (insn & (1 << 11)) { rd = (insn >> 8) & 7; val = s->pc + 2 + ((insn & 0xff) * 4); val &= ~(uint32_t)2; addr = tcg_temp_new_i32(); tcg_gen_movi_i32(addr, val); tmp = gen_ld32(addr, IS_USER(s)); tcg_temp_free_i32(addr); store_reg(s, rd, tmp); break; } if (insn & (1 << 10)) { rd = (insn & 7) | ((insn >> 4) & 8); rm = (insn >> 3) & 0xf; op = (insn >> 8) & 3; switch (op) { case 0: tmp = load_reg(s, rd); tmp2 = load_reg(s, rm); tcg_gen_add_i32(tmp, tmp, tmp2); tcg_temp_free_i32(tmp2); store_reg(s, rd, tmp); break; case 1: tmp = load_reg(s, rd); tmp2 = load_reg(s, rm); gen_helper_sub_cc(tmp, tmp, tmp2); tcg_temp_free_i32(tmp2); tcg_temp_free_i32(tmp); break; case 2: tmp = load_reg(s, rm); store_reg(s, rd, tmp); break; case 3: tmp = load_reg(s, rm); if (insn & (1 << 7)) { val = (uint32_t)s->pc | 1; tmp2 = tcg_temp_new_i32(); tcg_gen_movi_i32(tmp2, val); store_reg(s, 14, tmp2); } gen_bx(s, tmp); break; } break; } rd = insn & 7; rm = (insn >> 3) & 7; op = (insn >> 6) & 0xf; if (op == 2 || op == 3 || op == 4 || op == 7) { val = rm; rm = rd; rd = val; val = 1; } else { val = 0; } if (op == 9) { tmp = tcg_temp_new_i32(); tcg_gen_movi_i32(tmp, 0); } else if (op != 0xf) { tmp = load_reg(s, rd); } else { TCGV_UNUSED(tmp); } tmp2 = load_reg(s, rm); switch (op) { case 0x0: tcg_gen_and_i32(tmp, tmp, tmp2); if (!s->condexec_mask) gen_logic_CC(tmp); break; case 0x1: tcg_gen_xor_i32(tmp, tmp, tmp2); if (!s->condexec_mask) gen_logic_CC(tmp); break; case 0x2: if (s->condexec_mask) { gen_helper_shl(tmp2, tmp2, tmp); } else { gen_helper_shl_cc(tmp2, tmp2, tmp); gen_logic_CC(tmp2); } break; case 0x3: if (s->condexec_mask) { gen_helper_shr(tmp2, tmp2, tmp); } else { gen_helper_shr_cc(tmp2, tmp2, tmp); gen_logic_CC(tmp2); } break; case 0x4: if (s->condexec_mask) { gen_helper_sar(tmp2, tmp2, tmp); } else { gen_helper_sar_cc(tmp2, tmp2, tmp); gen_logic_CC(tmp2); } break; case 0x5: if (s->condexec_mask) gen_adc(tmp, tmp2); else gen_helper_adc_cc(tmp, tmp, tmp2); break; case 0x6: if (s->condexec_mask) gen_sub_carry(tmp, tmp, tmp2); else gen_helper_sbc_cc(tmp, tmp, tmp2); break; case 0x7: if (s->condexec_mask) { tcg_gen_andi_i32(tmp, tmp, 0x1f); tcg_gen_rotr_i32(tmp2, tmp2, tmp); } else { gen_helper_ror_cc(tmp2, tmp2, tmp); gen_logic_CC(tmp2); } break; case 0x8: tcg_gen_and_i32(tmp, tmp, tmp2); gen_logic_CC(tmp); rd = 16; break; case 0x9: if (s->condexec_mask) tcg_gen_neg_i32(tmp, tmp2); else gen_helper_sub_cc(tmp, tmp, tmp2); break; case 0xa: gen_helper_sub_cc(tmp, tmp, tmp2); rd = 16; break; case 0xb: gen_helper_add_cc(tmp, tmp, tmp2); rd = 16; break; case 0xc: tcg_gen_or_i32(tmp, tmp, tmp2); if (!s->condexec_mask) gen_logic_CC(tmp); break; case 0xd: tcg_gen_mul_i32(tmp, tmp, tmp2); if (!s->condexec_mask) gen_logic_CC(tmp); break; case 0xe: tcg_gen_andc_i32(tmp, tmp, tmp2); if (!s->condexec_mask) gen_logic_CC(tmp); break; case 0xf: tcg_gen_not_i32(tmp2, tmp2); if (!s->condexec_mask) gen_logic_CC(tmp2); val = 1; rm = rd; break; } if (rd != 16) { if (val) { store_reg(s, rm, tmp2); if (op != 0xf) tcg_temp_free_i32(tmp); } else { store_reg(s, rd, tmp); tcg_temp_free_i32(tmp2); } } else { tcg_temp_free_i32(tmp); tcg_temp_free_i32(tmp2); } break; case 5: rd = insn & 7; rn = (insn >> 3) & 7; rm = (insn >> 6) & 7; op = (insn >> 9) & 7; addr = load_reg(s, rn); tmp = load_reg(s, rm); tcg_gen_add_i32(addr, addr, tmp); tcg_temp_free_i32(tmp); if (op < 3) tmp = load_reg(s, rd); switch (op) { case 0: gen_st32(tmp, addr, IS_USER(s)); break; case 1: gen_st16(tmp, addr, IS_USER(s)); break; case 2: gen_st8(tmp, addr, IS_USER(s)); break; case 3: tmp = gen_ld8s(addr, IS_USER(s)); break; case 4: tmp = gen_ld32(addr, IS_USER(s)); break; case 5: tmp = gen_ld16u(addr, IS_USER(s)); break; case 6: tmp = gen_ld8u(addr, IS_USER(s)); break; case 7: tmp = gen_ld16s(addr, IS_USER(s)); break; } if (op >= 3) store_reg(s, rd, tmp); tcg_temp_free_i32(addr); break; case 6: rd = insn & 7; rn = (insn >> 3) & 7; addr = load_reg(s, rn); val = (insn >> 4) & 0x7c; tcg_gen_addi_i32(addr, addr, val); if (insn & (1 << 11)) { tmp = gen_ld32(addr, IS_USER(s)); store_reg(s, rd, tmp); } else { tmp = load_reg(s, rd); gen_st32(tmp, addr, IS_USER(s)); } tcg_temp_free_i32(addr); break; case 7: rd = insn & 7; rn = (insn >> 3) & 7; addr = load_reg(s, rn); val = (insn >> 6) & 0x1f; tcg_gen_addi_i32(addr, addr, val); if (insn & (1 << 11)) { tmp = gen_ld8u(addr, IS_USER(s)); store_reg(s, rd, tmp); } else { tmp = load_reg(s, rd); gen_st8(tmp, addr, IS_USER(s)); } tcg_temp_free_i32(addr); break; case 8: rd = insn & 7; rn = (insn >> 3) & 7; addr = load_reg(s, rn); val = (insn >> 5) & 0x3e; tcg_gen_addi_i32(addr, addr, val); if (insn & (1 << 11)) { tmp = gen_ld16u(addr, IS_USER(s)); store_reg(s, rd, tmp); } else { tmp = load_reg(s, rd); gen_st16(tmp, addr, IS_USER(s)); } tcg_temp_free_i32(addr); break; case 9: rd = (insn >> 8) & 7; addr = load_reg(s, 13); val = (insn & 0xff) * 4; tcg_gen_addi_i32(addr, addr, val); if (insn & (1 << 11)) { tmp = gen_ld32(addr, IS_USER(s)); store_reg(s, rd, tmp); } else { tmp = load_reg(s, rd); gen_st32(tmp, addr, IS_USER(s)); } tcg_temp_free_i32(addr); break; case 10: rd = (insn >> 8) & 7; if (insn & (1 << 11)) { tmp = load_reg(s, 13); } else { tmp = tcg_temp_new_i32(); tcg_gen_movi_i32(tmp, (s->pc + 2) & ~(uint32_t)2); } val = (insn & 0xff) * 4; tcg_gen_addi_i32(tmp, tmp, val); store_reg(s, rd, tmp); break; case 11: op = (insn >> 8) & 0xf; switch (op) { case 0: tmp = load_reg(s, 13); val = (insn & 0x7f) * 4; if (insn & (1 << 7)) val = -(int32_t)val; tcg_gen_addi_i32(tmp, tmp, val); store_reg(s, 13, tmp); break; case 2: ARCH(6); rd = insn & 7; rm = (insn >> 3) & 7; tmp = load_reg(s, rm); switch ((insn >> 6) & 3) { case 0: gen_sxth(tmp); break; case 1: gen_sxtb(tmp); break; case 2: gen_uxth(tmp); break; case 3: gen_uxtb(tmp); break; } store_reg(s, rd, tmp); break; case 4: case 5: case 0xc: case 0xd: addr = load_reg(s, 13); if (insn & (1 << 8)) offset = 4; else offset = 0; for (i = 0; i < 8; i++) { if (insn & (1 << i)) offset += 4; } if ((insn & (1 << 11)) == 0) { tcg_gen_addi_i32(addr, addr, -offset); } for (i = 0; i < 8; i++) { if (insn & (1 << i)) { if (insn & (1 << 11)) { tmp = gen_ld32(addr, IS_USER(s)); store_reg(s, i, tmp); } else { tmp = load_reg(s, i); gen_st32(tmp, addr, IS_USER(s)); } tcg_gen_addi_i32(addr, addr, 4); } } TCGV_UNUSED(tmp); if (insn & (1 << 8)) { if (insn & (1 << 11)) { tmp = gen_ld32(addr, IS_USER(s)); } else { tmp = load_reg(s, 14); gen_st32(tmp, addr, IS_USER(s)); } tcg_gen_addi_i32(addr, addr, 4); } if ((insn & (1 << 11)) == 0) { tcg_gen_addi_i32(addr, addr, -offset); } store_reg(s, 13, addr); if ((insn & 0x0900) == 0x0900) gen_bx(s, tmp); break; case 1: case 3: case 9: case 11: rm = insn & 7; tmp = load_reg(s, rm); s->condlabel = gen_new_label(); s->condjmp = 1; if (insn & (1 << 11)) tcg_gen_brcondi_i32(TCG_COND_EQ, tmp, 0, s->condlabel); else tcg_gen_brcondi_i32(TCG_COND_NE, tmp, 0, s->condlabel); tcg_temp_free_i32(tmp); offset = ((insn & 0xf8) >> 2) | (insn & 0x200) >> 3; val = (uint32_t)s->pc + 2; val += offset; gen_jmp(s, val); break; case 15: if ((insn & 0xf) == 0) { gen_nop_hint(s, (insn >> 4) & 0xf); break; } s->condexec_cond = (insn >> 4) & 0xe; s->condexec_mask = insn & 0x1f; break; case 0xe: gen_exception_insn(s, 2, EXCP_BKPT); break; case 0xa: ARCH(6); rn = (insn >> 3) & 0x7; rd = insn & 0x7; tmp = load_reg(s, rn); switch ((insn >> 6) & 3) { case 0: tcg_gen_bswap32_i32(tmp, tmp); break; case 1: gen_rev16(tmp); break; case 3: gen_revsh(tmp); break; default: goto illegal_op; } store_reg(s, rd, tmp); break; case 6: ARCH(6); if (IS_USER(s)) break; if (IS_M(env)) { tmp = tcg_const_i32((insn & (1 << 4)) != 0); if (insn & 1) { addr = tcg_const_i32(16); gen_helper_v7m_msr(cpu_env, addr, tmp); tcg_temp_free_i32(addr); } if (insn & 2) { addr = tcg_const_i32(17); gen_helper_v7m_msr(cpu_env, addr, tmp); tcg_temp_free_i32(addr); } tcg_temp_free_i32(tmp); gen_lookup_tb(s); } else { if (insn & (1 << 4)) shift = CPSR_A | CPSR_I | CPSR_F; else shift = 0; gen_set_psr_im(s, ((insn & 7) << 6), 0, shift); } break; default: goto undef; } break; case 12: rn = (insn >> 8) & 0x7; addr = load_reg(s, rn); for (i = 0; i < 8; i++) { if (insn & (1 << i)) { if (insn & (1 << 11)) { tmp = gen_ld32(addr, IS_USER(s)); store_reg(s, i, tmp); } else { tmp = load_reg(s, i); gen_st32(tmp, addr, IS_USER(s)); } tcg_gen_addi_i32(addr, addr, 4); } } if ((insn & (1 << rn)) == 0) { store_reg(s, rn, addr); } else { tcg_temp_free_i32(addr); } break; case 13: cond = (insn >> 8) & 0xf; if (cond == 0xe) goto undef; if (cond == 0xf) { gen_set_pc_im(s->pc); s->is_jmp = DISAS_SWI; break; } s->condlabel = gen_new_label(); gen_test_cc(cond ^ 1, s->condlabel); s->condjmp = 1; val = (uint32_t)s->pc + 2; offset = ((int32_t)insn << 24) >> 24; val += offset << 1; gen_jmp(s, val); break; case 14: if (insn & (1 << 11)) { if (disas_thumb2_insn(env, s, insn)) goto undef32; break; } val = (uint32_t)s->pc; offset = ((int32_t)insn << 21) >> 21; val += (offset << 1) + 2; gen_jmp(s, val); break; case 15: if (disas_thumb2_insn(env, s, insn)) goto undef32; break; } return; undef32: gen_exception_insn(s, 4, EXCP_UDEF); return; illegal_op: undef: gen_exception_insn(s, 2, EXCP_UDEF); }
{ "code": [], "line_no": [] }
static void FUNC_0(CPUState *VAR_0, DisasContext *VAR_1) { uint32_t val, insn, op, rm, rn, rd, shift, cond; int32_t offset; int VAR_2; TCGv tmp; TCGv tmp2; TCGv addr; if (VAR_1->condexec_mask) { cond = VAR_1->condexec_cond; if (cond != 0x0e) { VAR_1->condlabel = gen_new_label(); gen_test_cc(cond ^ 1, VAR_1->condlabel); VAR_1->condjmp = 1; } } insn = lduw_code(VAR_1->pc); VAR_1->pc += 2; switch (insn >> 12) { case 0: case 1: rd = insn & 7; op = (insn >> 11) & 3; if (op == 3) { rn = (insn >> 3) & 7; tmp = load_reg(VAR_1, rn); if (insn & (1 << 10)) { tmp2 = tcg_temp_new_i32(); tcg_gen_movi_i32(tmp2, (insn >> 6) & 7); } else { rm = (insn >> 6) & 7; tmp2 = load_reg(VAR_1, rm); } if (insn & (1 << 9)) { if (VAR_1->condexec_mask) tcg_gen_sub_i32(tmp, tmp, tmp2); else gen_helper_sub_cc(tmp, tmp, tmp2); } else { if (VAR_1->condexec_mask) tcg_gen_add_i32(tmp, tmp, tmp2); else gen_helper_add_cc(tmp, tmp, tmp2); } tcg_temp_free_i32(tmp2); store_reg(VAR_1, rd, tmp); } else { rm = (insn >> 3) & 7; shift = (insn >> 6) & 0x1f; tmp = load_reg(VAR_1, rm); gen_arm_shift_im(tmp, op, shift, VAR_1->condexec_mask == 0); if (!VAR_1->condexec_mask) gen_logic_CC(tmp); store_reg(VAR_1, rd, tmp); } break; case 2: case 3: op = (insn >> 11) & 3; rd = (insn >> 8) & 0x7; if (op == 0) { tmp = tcg_temp_new_i32(); tcg_gen_movi_i32(tmp, insn & 0xff); if (!VAR_1->condexec_mask) gen_logic_CC(tmp); store_reg(VAR_1, rd, tmp); } else { tmp = load_reg(VAR_1, rd); tmp2 = tcg_temp_new_i32(); tcg_gen_movi_i32(tmp2, insn & 0xff); switch (op) { case 1: gen_helper_sub_cc(tmp, tmp, tmp2); tcg_temp_free_i32(tmp); tcg_temp_free_i32(tmp2); break; case 2: if (VAR_1->condexec_mask) tcg_gen_add_i32(tmp, tmp, tmp2); else gen_helper_add_cc(tmp, tmp, tmp2); tcg_temp_free_i32(tmp2); store_reg(VAR_1, rd, tmp); break; case 3: if (VAR_1->condexec_mask) tcg_gen_sub_i32(tmp, tmp, tmp2); else gen_helper_sub_cc(tmp, tmp, tmp2); tcg_temp_free_i32(tmp2); store_reg(VAR_1, rd, tmp); break; } } break; case 4: if (insn & (1 << 11)) { rd = (insn >> 8) & 7; val = VAR_1->pc + 2 + ((insn & 0xff) * 4); val &= ~(uint32_t)2; addr = tcg_temp_new_i32(); tcg_gen_movi_i32(addr, val); tmp = gen_ld32(addr, IS_USER(VAR_1)); tcg_temp_free_i32(addr); store_reg(VAR_1, rd, tmp); break; } if (insn & (1 << 10)) { rd = (insn & 7) | ((insn >> 4) & 8); rm = (insn >> 3) & 0xf; op = (insn >> 8) & 3; switch (op) { case 0: tmp = load_reg(VAR_1, rd); tmp2 = load_reg(VAR_1, rm); tcg_gen_add_i32(tmp, tmp, tmp2); tcg_temp_free_i32(tmp2); store_reg(VAR_1, rd, tmp); break; case 1: tmp = load_reg(VAR_1, rd); tmp2 = load_reg(VAR_1, rm); gen_helper_sub_cc(tmp, tmp, tmp2); tcg_temp_free_i32(tmp2); tcg_temp_free_i32(tmp); break; case 2: tmp = load_reg(VAR_1, rm); store_reg(VAR_1, rd, tmp); break; case 3: tmp = load_reg(VAR_1, rm); if (insn & (1 << 7)) { val = (uint32_t)VAR_1->pc | 1; tmp2 = tcg_temp_new_i32(); tcg_gen_movi_i32(tmp2, val); store_reg(VAR_1, 14, tmp2); } gen_bx(VAR_1, tmp); break; } break; } rd = insn & 7; rm = (insn >> 3) & 7; op = (insn >> 6) & 0xf; if (op == 2 || op == 3 || op == 4 || op == 7) { val = rm; rm = rd; rd = val; val = 1; } else { val = 0; } if (op == 9) { tmp = tcg_temp_new_i32(); tcg_gen_movi_i32(tmp, 0); } else if (op != 0xf) { tmp = load_reg(VAR_1, rd); } else { TCGV_UNUSED(tmp); } tmp2 = load_reg(VAR_1, rm); switch (op) { case 0x0: tcg_gen_and_i32(tmp, tmp, tmp2); if (!VAR_1->condexec_mask) gen_logic_CC(tmp); break; case 0x1: tcg_gen_xor_i32(tmp, tmp, tmp2); if (!VAR_1->condexec_mask) gen_logic_CC(tmp); break; case 0x2: if (VAR_1->condexec_mask) { gen_helper_shl(tmp2, tmp2, tmp); } else { gen_helper_shl_cc(tmp2, tmp2, tmp); gen_logic_CC(tmp2); } break; case 0x3: if (VAR_1->condexec_mask) { gen_helper_shr(tmp2, tmp2, tmp); } else { gen_helper_shr_cc(tmp2, tmp2, tmp); gen_logic_CC(tmp2); } break; case 0x4: if (VAR_1->condexec_mask) { gen_helper_sar(tmp2, tmp2, tmp); } else { gen_helper_sar_cc(tmp2, tmp2, tmp); gen_logic_CC(tmp2); } break; case 0x5: if (VAR_1->condexec_mask) gen_adc(tmp, tmp2); else gen_helper_adc_cc(tmp, tmp, tmp2); break; case 0x6: if (VAR_1->condexec_mask) gen_sub_carry(tmp, tmp, tmp2); else gen_helper_sbc_cc(tmp, tmp, tmp2); break; case 0x7: if (VAR_1->condexec_mask) { tcg_gen_andi_i32(tmp, tmp, 0x1f); tcg_gen_rotr_i32(tmp2, tmp2, tmp); } else { gen_helper_ror_cc(tmp2, tmp2, tmp); gen_logic_CC(tmp2); } break; case 0x8: tcg_gen_and_i32(tmp, tmp, tmp2); gen_logic_CC(tmp); rd = 16; break; case 0x9: if (VAR_1->condexec_mask) tcg_gen_neg_i32(tmp, tmp2); else gen_helper_sub_cc(tmp, tmp, tmp2); break; case 0xa: gen_helper_sub_cc(tmp, tmp, tmp2); rd = 16; break; case 0xb: gen_helper_add_cc(tmp, tmp, tmp2); rd = 16; break; case 0xc: tcg_gen_or_i32(tmp, tmp, tmp2); if (!VAR_1->condexec_mask) gen_logic_CC(tmp); break; case 0xd: tcg_gen_mul_i32(tmp, tmp, tmp2); if (!VAR_1->condexec_mask) gen_logic_CC(tmp); break; case 0xe: tcg_gen_andc_i32(tmp, tmp, tmp2); if (!VAR_1->condexec_mask) gen_logic_CC(tmp); break; case 0xf: tcg_gen_not_i32(tmp2, tmp2); if (!VAR_1->condexec_mask) gen_logic_CC(tmp2); val = 1; rm = rd; break; } if (rd != 16) { if (val) { store_reg(VAR_1, rm, tmp2); if (op != 0xf) tcg_temp_free_i32(tmp); } else { store_reg(VAR_1, rd, tmp); tcg_temp_free_i32(tmp2); } } else { tcg_temp_free_i32(tmp); tcg_temp_free_i32(tmp2); } break; case 5: rd = insn & 7; rn = (insn >> 3) & 7; rm = (insn >> 6) & 7; op = (insn >> 9) & 7; addr = load_reg(VAR_1, rn); tmp = load_reg(VAR_1, rm); tcg_gen_add_i32(addr, addr, tmp); tcg_temp_free_i32(tmp); if (op < 3) tmp = load_reg(VAR_1, rd); switch (op) { case 0: gen_st32(tmp, addr, IS_USER(VAR_1)); break; case 1: gen_st16(tmp, addr, IS_USER(VAR_1)); break; case 2: gen_st8(tmp, addr, IS_USER(VAR_1)); break; case 3: tmp = gen_ld8s(addr, IS_USER(VAR_1)); break; case 4: tmp = gen_ld32(addr, IS_USER(VAR_1)); break; case 5: tmp = gen_ld16u(addr, IS_USER(VAR_1)); break; case 6: tmp = gen_ld8u(addr, IS_USER(VAR_1)); break; case 7: tmp = gen_ld16s(addr, IS_USER(VAR_1)); break; } if (op >= 3) store_reg(VAR_1, rd, tmp); tcg_temp_free_i32(addr); break; case 6: rd = insn & 7; rn = (insn >> 3) & 7; addr = load_reg(VAR_1, rn); val = (insn >> 4) & 0x7c; tcg_gen_addi_i32(addr, addr, val); if (insn & (1 << 11)) { tmp = gen_ld32(addr, IS_USER(VAR_1)); store_reg(VAR_1, rd, tmp); } else { tmp = load_reg(VAR_1, rd); gen_st32(tmp, addr, IS_USER(VAR_1)); } tcg_temp_free_i32(addr); break; case 7: rd = insn & 7; rn = (insn >> 3) & 7; addr = load_reg(VAR_1, rn); val = (insn >> 6) & 0x1f; tcg_gen_addi_i32(addr, addr, val); if (insn & (1 << 11)) { tmp = gen_ld8u(addr, IS_USER(VAR_1)); store_reg(VAR_1, rd, tmp); } else { tmp = load_reg(VAR_1, rd); gen_st8(tmp, addr, IS_USER(VAR_1)); } tcg_temp_free_i32(addr); break; case 8: rd = insn & 7; rn = (insn >> 3) & 7; addr = load_reg(VAR_1, rn); val = (insn >> 5) & 0x3e; tcg_gen_addi_i32(addr, addr, val); if (insn & (1 << 11)) { tmp = gen_ld16u(addr, IS_USER(VAR_1)); store_reg(VAR_1, rd, tmp); } else { tmp = load_reg(VAR_1, rd); gen_st16(tmp, addr, IS_USER(VAR_1)); } tcg_temp_free_i32(addr); break; case 9: rd = (insn >> 8) & 7; addr = load_reg(VAR_1, 13); val = (insn & 0xff) * 4; tcg_gen_addi_i32(addr, addr, val); if (insn & (1 << 11)) { tmp = gen_ld32(addr, IS_USER(VAR_1)); store_reg(VAR_1, rd, tmp); } else { tmp = load_reg(VAR_1, rd); gen_st32(tmp, addr, IS_USER(VAR_1)); } tcg_temp_free_i32(addr); break; case 10: rd = (insn >> 8) & 7; if (insn & (1 << 11)) { tmp = load_reg(VAR_1, 13); } else { tmp = tcg_temp_new_i32(); tcg_gen_movi_i32(tmp, (VAR_1->pc + 2) & ~(uint32_t)2); } val = (insn & 0xff) * 4; tcg_gen_addi_i32(tmp, tmp, val); store_reg(VAR_1, rd, tmp); break; case 11: op = (insn >> 8) & 0xf; switch (op) { case 0: tmp = load_reg(VAR_1, 13); val = (insn & 0x7f) * 4; if (insn & (1 << 7)) val = -(int32_t)val; tcg_gen_addi_i32(tmp, tmp, val); store_reg(VAR_1, 13, tmp); break; case 2: ARCH(6); rd = insn & 7; rm = (insn >> 3) & 7; tmp = load_reg(VAR_1, rm); switch ((insn >> 6) & 3) { case 0: gen_sxth(tmp); break; case 1: gen_sxtb(tmp); break; case 2: gen_uxth(tmp); break; case 3: gen_uxtb(tmp); break; } store_reg(VAR_1, rd, tmp); break; case 4: case 5: case 0xc: case 0xd: addr = load_reg(VAR_1, 13); if (insn & (1 << 8)) offset = 4; else offset = 0; for (VAR_2 = 0; VAR_2 < 8; VAR_2++) { if (insn & (1 << VAR_2)) offset += 4; } if ((insn & (1 << 11)) == 0) { tcg_gen_addi_i32(addr, addr, -offset); } for (VAR_2 = 0; VAR_2 < 8; VAR_2++) { if (insn & (1 << VAR_2)) { if (insn & (1 << 11)) { tmp = gen_ld32(addr, IS_USER(VAR_1)); store_reg(VAR_1, VAR_2, tmp); } else { tmp = load_reg(VAR_1, VAR_2); gen_st32(tmp, addr, IS_USER(VAR_1)); } tcg_gen_addi_i32(addr, addr, 4); } } TCGV_UNUSED(tmp); if (insn & (1 << 8)) { if (insn & (1 << 11)) { tmp = gen_ld32(addr, IS_USER(VAR_1)); } else { tmp = load_reg(VAR_1, 14); gen_st32(tmp, addr, IS_USER(VAR_1)); } tcg_gen_addi_i32(addr, addr, 4); } if ((insn & (1 << 11)) == 0) { tcg_gen_addi_i32(addr, addr, -offset); } store_reg(VAR_1, 13, addr); if ((insn & 0x0900) == 0x0900) gen_bx(VAR_1, tmp); break; case 1: case 3: case 9: case 11: rm = insn & 7; tmp = load_reg(VAR_1, rm); VAR_1->condlabel = gen_new_label(); VAR_1->condjmp = 1; if (insn & (1 << 11)) tcg_gen_brcondi_i32(TCG_COND_EQ, tmp, 0, VAR_1->condlabel); else tcg_gen_brcondi_i32(TCG_COND_NE, tmp, 0, VAR_1->condlabel); tcg_temp_free_i32(tmp); offset = ((insn & 0xf8) >> 2) | (insn & 0x200) >> 3; val = (uint32_t)VAR_1->pc + 2; val += offset; gen_jmp(VAR_1, val); break; case 15: if ((insn & 0xf) == 0) { gen_nop_hint(VAR_1, (insn >> 4) & 0xf); break; } VAR_1->condexec_cond = (insn >> 4) & 0xe; VAR_1->condexec_mask = insn & 0x1f; break; case 0xe: gen_exception_insn(VAR_1, 2, EXCP_BKPT); break; case 0xa: ARCH(6); rn = (insn >> 3) & 0x7; rd = insn & 0x7; tmp = load_reg(VAR_1, rn); switch ((insn >> 6) & 3) { case 0: tcg_gen_bswap32_i32(tmp, tmp); break; case 1: gen_rev16(tmp); break; case 3: gen_revsh(tmp); break; default: goto illegal_op; } store_reg(VAR_1, rd, tmp); break; case 6: ARCH(6); if (IS_USER(VAR_1)) break; if (IS_M(VAR_0)) { tmp = tcg_const_i32((insn & (1 << 4)) != 0); if (insn & 1) { addr = tcg_const_i32(16); gen_helper_v7m_msr(cpu_env, addr, tmp); tcg_temp_free_i32(addr); } if (insn & 2) { addr = tcg_const_i32(17); gen_helper_v7m_msr(cpu_env, addr, tmp); tcg_temp_free_i32(addr); } tcg_temp_free_i32(tmp); gen_lookup_tb(VAR_1); } else { if (insn & (1 << 4)) shift = CPSR_A | CPSR_I | CPSR_F; else shift = 0; gen_set_psr_im(VAR_1, ((insn & 7) << 6), 0, shift); } break; default: goto undef; } break; case 12: rn = (insn >> 8) & 0x7; addr = load_reg(VAR_1, rn); for (VAR_2 = 0; VAR_2 < 8; VAR_2++) { if (insn & (1 << VAR_2)) { if (insn & (1 << 11)) { tmp = gen_ld32(addr, IS_USER(VAR_1)); store_reg(VAR_1, VAR_2, tmp); } else { tmp = load_reg(VAR_1, VAR_2); gen_st32(tmp, addr, IS_USER(VAR_1)); } tcg_gen_addi_i32(addr, addr, 4); } } if ((insn & (1 << rn)) == 0) { store_reg(VAR_1, rn, addr); } else { tcg_temp_free_i32(addr); } break; case 13: cond = (insn >> 8) & 0xf; if (cond == 0xe) goto undef; if (cond == 0xf) { gen_set_pc_im(VAR_1->pc); VAR_1->is_jmp = DISAS_SWI; break; } VAR_1->condlabel = gen_new_label(); gen_test_cc(cond ^ 1, VAR_1->condlabel); VAR_1->condjmp = 1; val = (uint32_t)VAR_1->pc + 2; offset = ((int32_t)insn << 24) >> 24; val += offset << 1; gen_jmp(VAR_1, val); break; case 14: if (insn & (1 << 11)) { if (disas_thumb2_insn(VAR_0, VAR_1, insn)) goto undef32; break; } val = (uint32_t)VAR_1->pc; offset = ((int32_t)insn << 21) >> 21; val += (offset << 1) + 2; gen_jmp(VAR_1, val); break; case 15: if (disas_thumb2_insn(VAR_0, VAR_1, insn)) goto undef32; break; } return; undef32: gen_exception_insn(VAR_1, 4, EXCP_UDEF); return; illegal_op: undef: gen_exception_insn(VAR_1, 2, EXCP_UDEF); }
[ "static void FUNC_0(CPUState *VAR_0, DisasContext *VAR_1)\n{", "uint32_t val, insn, op, rm, rn, rd, shift, cond;", "int32_t offset;", "int VAR_2;", "TCGv tmp;", "TCGv tmp2;", "TCGv addr;", "if (VAR_1->condexec_mask) {", "cond = VAR_1->condexec_cond;", "if (cond != 0x0e) {", "VAR_1->condlabel = gen_new_label();", "gen_test_cc(cond ^ 1, VAR_1->condlabel);", "VAR_1->condjmp = 1;", "}", "}", "insn = lduw_code(VAR_1->pc);", "VAR_1->pc += 2;", "switch (insn >> 12) {", "case 0: case 1:\nrd = insn & 7;", "op = (insn >> 11) & 3;", "if (op == 3) {", "rn = (insn >> 3) & 7;", "tmp = load_reg(VAR_1, rn);", "if (insn & (1 << 10)) {", "tmp2 = tcg_temp_new_i32();", "tcg_gen_movi_i32(tmp2, (insn >> 6) & 7);", "} else {", "rm = (insn >> 6) & 7;", "tmp2 = load_reg(VAR_1, rm);", "}", "if (insn & (1 << 9)) {", "if (VAR_1->condexec_mask)\ntcg_gen_sub_i32(tmp, tmp, tmp2);", "else\ngen_helper_sub_cc(tmp, tmp, tmp2);", "} else {", "if (VAR_1->condexec_mask)\ntcg_gen_add_i32(tmp, tmp, tmp2);", "else\ngen_helper_add_cc(tmp, tmp, tmp2);", "}", "tcg_temp_free_i32(tmp2);", "store_reg(VAR_1, rd, tmp);", "} else {", "rm = (insn >> 3) & 7;", "shift = (insn >> 6) & 0x1f;", "tmp = load_reg(VAR_1, rm);", "gen_arm_shift_im(tmp, op, shift, VAR_1->condexec_mask == 0);", "if (!VAR_1->condexec_mask)\ngen_logic_CC(tmp);", "store_reg(VAR_1, rd, tmp);", "}", "break;", "case 2: case 3:\nop = (insn >> 11) & 3;", "rd = (insn >> 8) & 0x7;", "if (op == 0) {", "tmp = tcg_temp_new_i32();", "tcg_gen_movi_i32(tmp, insn & 0xff);", "if (!VAR_1->condexec_mask)\ngen_logic_CC(tmp);", "store_reg(VAR_1, rd, tmp);", "} else {", "tmp = load_reg(VAR_1, rd);", "tmp2 = tcg_temp_new_i32();", "tcg_gen_movi_i32(tmp2, insn & 0xff);", "switch (op) {", "case 1:\ngen_helper_sub_cc(tmp, tmp, tmp2);", "tcg_temp_free_i32(tmp);", "tcg_temp_free_i32(tmp2);", "break;", "case 2:\nif (VAR_1->condexec_mask)\ntcg_gen_add_i32(tmp, tmp, tmp2);", "else\ngen_helper_add_cc(tmp, tmp, tmp2);", "tcg_temp_free_i32(tmp2);", "store_reg(VAR_1, rd, tmp);", "break;", "case 3:\nif (VAR_1->condexec_mask)\ntcg_gen_sub_i32(tmp, tmp, tmp2);", "else\ngen_helper_sub_cc(tmp, tmp, tmp2);", "tcg_temp_free_i32(tmp2);", "store_reg(VAR_1, rd, tmp);", "break;", "}", "}", "break;", "case 4:\nif (insn & (1 << 11)) {", "rd = (insn >> 8) & 7;", "val = VAR_1->pc + 2 + ((insn & 0xff) * 4);", "val &= ~(uint32_t)2;", "addr = tcg_temp_new_i32();", "tcg_gen_movi_i32(addr, val);", "tmp = gen_ld32(addr, IS_USER(VAR_1));", "tcg_temp_free_i32(addr);", "store_reg(VAR_1, rd, tmp);", "break;", "}", "if (insn & (1 << 10)) {", "rd = (insn & 7) | ((insn >> 4) & 8);", "rm = (insn >> 3) & 0xf;", "op = (insn >> 8) & 3;", "switch (op) {", "case 0:\ntmp = load_reg(VAR_1, rd);", "tmp2 = load_reg(VAR_1, rm);", "tcg_gen_add_i32(tmp, tmp, tmp2);", "tcg_temp_free_i32(tmp2);", "store_reg(VAR_1, rd, tmp);", "break;", "case 1:\ntmp = load_reg(VAR_1, rd);", "tmp2 = load_reg(VAR_1, rm);", "gen_helper_sub_cc(tmp, tmp, tmp2);", "tcg_temp_free_i32(tmp2);", "tcg_temp_free_i32(tmp);", "break;", "case 2:\ntmp = load_reg(VAR_1, rm);", "store_reg(VAR_1, rd, tmp);", "break;", "case 3:\ntmp = load_reg(VAR_1, rm);", "if (insn & (1 << 7)) {", "val = (uint32_t)VAR_1->pc | 1;", "tmp2 = tcg_temp_new_i32();", "tcg_gen_movi_i32(tmp2, val);", "store_reg(VAR_1, 14, tmp2);", "}", "gen_bx(VAR_1, tmp);", "break;", "}", "break;", "}", "rd = insn & 7;", "rm = (insn >> 3) & 7;", "op = (insn >> 6) & 0xf;", "if (op == 2 || op == 3 || op == 4 || op == 7) {", "val = rm;", "rm = rd;", "rd = val;", "val = 1;", "} else {", "val = 0;", "}", "if (op == 9) {", "tmp = tcg_temp_new_i32();", "tcg_gen_movi_i32(tmp, 0);", "} else if (op != 0xf) {", "tmp = load_reg(VAR_1, rd);", "} else {", "TCGV_UNUSED(tmp);", "}", "tmp2 = load_reg(VAR_1, rm);", "switch (op) {", "case 0x0:\ntcg_gen_and_i32(tmp, tmp, tmp2);", "if (!VAR_1->condexec_mask)\ngen_logic_CC(tmp);", "break;", "case 0x1:\ntcg_gen_xor_i32(tmp, tmp, tmp2);", "if (!VAR_1->condexec_mask)\ngen_logic_CC(tmp);", "break;", "case 0x2:\nif (VAR_1->condexec_mask) {", "gen_helper_shl(tmp2, tmp2, tmp);", "} else {", "gen_helper_shl_cc(tmp2, tmp2, tmp);", "gen_logic_CC(tmp2);", "}", "break;", "case 0x3:\nif (VAR_1->condexec_mask) {", "gen_helper_shr(tmp2, tmp2, tmp);", "} else {", "gen_helper_shr_cc(tmp2, tmp2, tmp);", "gen_logic_CC(tmp2);", "}", "break;", "case 0x4:\nif (VAR_1->condexec_mask) {", "gen_helper_sar(tmp2, tmp2, tmp);", "} else {", "gen_helper_sar_cc(tmp2, tmp2, tmp);", "gen_logic_CC(tmp2);", "}", "break;", "case 0x5:\nif (VAR_1->condexec_mask)\ngen_adc(tmp, tmp2);", "else\ngen_helper_adc_cc(tmp, tmp, tmp2);", "break;", "case 0x6:\nif (VAR_1->condexec_mask)\ngen_sub_carry(tmp, tmp, tmp2);", "else\ngen_helper_sbc_cc(tmp, tmp, tmp2);", "break;", "case 0x7:\nif (VAR_1->condexec_mask) {", "tcg_gen_andi_i32(tmp, tmp, 0x1f);", "tcg_gen_rotr_i32(tmp2, tmp2, tmp);", "} else {", "gen_helper_ror_cc(tmp2, tmp2, tmp);", "gen_logic_CC(tmp2);", "}", "break;", "case 0x8:\ntcg_gen_and_i32(tmp, tmp, tmp2);", "gen_logic_CC(tmp);", "rd = 16;", "break;", "case 0x9:\nif (VAR_1->condexec_mask)\ntcg_gen_neg_i32(tmp, tmp2);", "else\ngen_helper_sub_cc(tmp, tmp, tmp2);", "break;", "case 0xa:\ngen_helper_sub_cc(tmp, tmp, tmp2);", "rd = 16;", "break;", "case 0xb:\ngen_helper_add_cc(tmp, tmp, tmp2);", "rd = 16;", "break;", "case 0xc:\ntcg_gen_or_i32(tmp, tmp, tmp2);", "if (!VAR_1->condexec_mask)\ngen_logic_CC(tmp);", "break;", "case 0xd:\ntcg_gen_mul_i32(tmp, tmp, tmp2);", "if (!VAR_1->condexec_mask)\ngen_logic_CC(tmp);", "break;", "case 0xe:\ntcg_gen_andc_i32(tmp, tmp, tmp2);", "if (!VAR_1->condexec_mask)\ngen_logic_CC(tmp);", "break;", "case 0xf:\ntcg_gen_not_i32(tmp2, tmp2);", "if (!VAR_1->condexec_mask)\ngen_logic_CC(tmp2);", "val = 1;", "rm = rd;", "break;", "}", "if (rd != 16) {", "if (val) {", "store_reg(VAR_1, rm, tmp2);", "if (op != 0xf)\ntcg_temp_free_i32(tmp);", "} else {", "store_reg(VAR_1, rd, tmp);", "tcg_temp_free_i32(tmp2);", "}", "} else {", "tcg_temp_free_i32(tmp);", "tcg_temp_free_i32(tmp2);", "}", "break;", "case 5:\nrd = insn & 7;", "rn = (insn >> 3) & 7;", "rm = (insn >> 6) & 7;", "op = (insn >> 9) & 7;", "addr = load_reg(VAR_1, rn);", "tmp = load_reg(VAR_1, rm);", "tcg_gen_add_i32(addr, addr, tmp);", "tcg_temp_free_i32(tmp);", "if (op < 3)\ntmp = load_reg(VAR_1, rd);", "switch (op) {", "case 0:\ngen_st32(tmp, addr, IS_USER(VAR_1));", "break;", "case 1:\ngen_st16(tmp, addr, IS_USER(VAR_1));", "break;", "case 2:\ngen_st8(tmp, addr, IS_USER(VAR_1));", "break;", "case 3:\ntmp = gen_ld8s(addr, IS_USER(VAR_1));", "break;", "case 4:\ntmp = gen_ld32(addr, IS_USER(VAR_1));", "break;", "case 5:\ntmp = gen_ld16u(addr, IS_USER(VAR_1));", "break;", "case 6:\ntmp = gen_ld8u(addr, IS_USER(VAR_1));", "break;", "case 7:\ntmp = gen_ld16s(addr, IS_USER(VAR_1));", "break;", "}", "if (op >= 3)\nstore_reg(VAR_1, rd, tmp);", "tcg_temp_free_i32(addr);", "break;", "case 6:\nrd = insn & 7;", "rn = (insn >> 3) & 7;", "addr = load_reg(VAR_1, rn);", "val = (insn >> 4) & 0x7c;", "tcg_gen_addi_i32(addr, addr, val);", "if (insn & (1 << 11)) {", "tmp = gen_ld32(addr, IS_USER(VAR_1));", "store_reg(VAR_1, rd, tmp);", "} else {", "tmp = load_reg(VAR_1, rd);", "gen_st32(tmp, addr, IS_USER(VAR_1));", "}", "tcg_temp_free_i32(addr);", "break;", "case 7:\nrd = insn & 7;", "rn = (insn >> 3) & 7;", "addr = load_reg(VAR_1, rn);", "val = (insn >> 6) & 0x1f;", "tcg_gen_addi_i32(addr, addr, val);", "if (insn & (1 << 11)) {", "tmp = gen_ld8u(addr, IS_USER(VAR_1));", "store_reg(VAR_1, rd, tmp);", "} else {", "tmp = load_reg(VAR_1, rd);", "gen_st8(tmp, addr, IS_USER(VAR_1));", "}", "tcg_temp_free_i32(addr);", "break;", "case 8:\nrd = insn & 7;", "rn = (insn >> 3) & 7;", "addr = load_reg(VAR_1, rn);", "val = (insn >> 5) & 0x3e;", "tcg_gen_addi_i32(addr, addr, val);", "if (insn & (1 << 11)) {", "tmp = gen_ld16u(addr, IS_USER(VAR_1));", "store_reg(VAR_1, rd, tmp);", "} else {", "tmp = load_reg(VAR_1, rd);", "gen_st16(tmp, addr, IS_USER(VAR_1));", "}", "tcg_temp_free_i32(addr);", "break;", "case 9:\nrd = (insn >> 8) & 7;", "addr = load_reg(VAR_1, 13);", "val = (insn & 0xff) * 4;", "tcg_gen_addi_i32(addr, addr, val);", "if (insn & (1 << 11)) {", "tmp = gen_ld32(addr, IS_USER(VAR_1));", "store_reg(VAR_1, rd, tmp);", "} else {", "tmp = load_reg(VAR_1, rd);", "gen_st32(tmp, addr, IS_USER(VAR_1));", "}", "tcg_temp_free_i32(addr);", "break;", "case 10:\nrd = (insn >> 8) & 7;", "if (insn & (1 << 11)) {", "tmp = load_reg(VAR_1, 13);", "} else {", "tmp = tcg_temp_new_i32();", "tcg_gen_movi_i32(tmp, (VAR_1->pc + 2) & ~(uint32_t)2);", "}", "val = (insn & 0xff) * 4;", "tcg_gen_addi_i32(tmp, tmp, val);", "store_reg(VAR_1, rd, tmp);", "break;", "case 11:\nop = (insn >> 8) & 0xf;", "switch (op) {", "case 0:\ntmp = load_reg(VAR_1, 13);", "val = (insn & 0x7f) * 4;", "if (insn & (1 << 7))\nval = -(int32_t)val;", "tcg_gen_addi_i32(tmp, tmp, val);", "store_reg(VAR_1, 13, tmp);", "break;", "case 2:\nARCH(6);", "rd = insn & 7;", "rm = (insn >> 3) & 7;", "tmp = load_reg(VAR_1, rm);", "switch ((insn >> 6) & 3) {", "case 0: gen_sxth(tmp); break;", "case 1: gen_sxtb(tmp); break;", "case 2: gen_uxth(tmp); break;", "case 3: gen_uxtb(tmp); break;", "}", "store_reg(VAR_1, rd, tmp);", "break;", "case 4: case 5: case 0xc: case 0xd:\naddr = load_reg(VAR_1, 13);", "if (insn & (1 << 8))\noffset = 4;", "else\noffset = 0;", "for (VAR_2 = 0; VAR_2 < 8; VAR_2++) {", "if (insn & (1 << VAR_2))\noffset += 4;", "}", "if ((insn & (1 << 11)) == 0) {", "tcg_gen_addi_i32(addr, addr, -offset);", "}", "for (VAR_2 = 0; VAR_2 < 8; VAR_2++) {", "if (insn & (1 << VAR_2)) {", "if (insn & (1 << 11)) {", "tmp = gen_ld32(addr, IS_USER(VAR_1));", "store_reg(VAR_1, VAR_2, tmp);", "} else {", "tmp = load_reg(VAR_1, VAR_2);", "gen_st32(tmp, addr, IS_USER(VAR_1));", "}", "tcg_gen_addi_i32(addr, addr, 4);", "}", "}", "TCGV_UNUSED(tmp);", "if (insn & (1 << 8)) {", "if (insn & (1 << 11)) {", "tmp = gen_ld32(addr, IS_USER(VAR_1));", "} else {", "tmp = load_reg(VAR_1, 14);", "gen_st32(tmp, addr, IS_USER(VAR_1));", "}", "tcg_gen_addi_i32(addr, addr, 4);", "}", "if ((insn & (1 << 11)) == 0) {", "tcg_gen_addi_i32(addr, addr, -offset);", "}", "store_reg(VAR_1, 13, addr);", "if ((insn & 0x0900) == 0x0900)\ngen_bx(VAR_1, tmp);", "break;", "case 1: case 3: case 9: case 11:\nrm = insn & 7;", "tmp = load_reg(VAR_1, rm);", "VAR_1->condlabel = gen_new_label();", "VAR_1->condjmp = 1;", "if (insn & (1 << 11))\ntcg_gen_brcondi_i32(TCG_COND_EQ, tmp, 0, VAR_1->condlabel);", "else\ntcg_gen_brcondi_i32(TCG_COND_NE, tmp, 0, VAR_1->condlabel);", "tcg_temp_free_i32(tmp);", "offset = ((insn & 0xf8) >> 2) | (insn & 0x200) >> 3;", "val = (uint32_t)VAR_1->pc + 2;", "val += offset;", "gen_jmp(VAR_1, val);", "break;", "case 15:\nif ((insn & 0xf) == 0) {", "gen_nop_hint(VAR_1, (insn >> 4) & 0xf);", "break;", "}", "VAR_1->condexec_cond = (insn >> 4) & 0xe;", "VAR_1->condexec_mask = insn & 0x1f;", "break;", "case 0xe:\ngen_exception_insn(VAR_1, 2, EXCP_BKPT);", "break;", "case 0xa:\nARCH(6);", "rn = (insn >> 3) & 0x7;", "rd = insn & 0x7;", "tmp = load_reg(VAR_1, rn);", "switch ((insn >> 6) & 3) {", "case 0: tcg_gen_bswap32_i32(tmp, tmp); break;", "case 1: gen_rev16(tmp); break;", "case 3: gen_revsh(tmp); break;", "default: goto illegal_op;", "}", "store_reg(VAR_1, rd, tmp);", "break;", "case 6:\nARCH(6);", "if (IS_USER(VAR_1))\nbreak;", "if (IS_M(VAR_0)) {", "tmp = tcg_const_i32((insn & (1 << 4)) != 0);", "if (insn & 1) {", "addr = tcg_const_i32(16);", "gen_helper_v7m_msr(cpu_env, addr, tmp);", "tcg_temp_free_i32(addr);", "}", "if (insn & 2) {", "addr = tcg_const_i32(17);", "gen_helper_v7m_msr(cpu_env, addr, tmp);", "tcg_temp_free_i32(addr);", "}", "tcg_temp_free_i32(tmp);", "gen_lookup_tb(VAR_1);", "} else {", "if (insn & (1 << 4))\nshift = CPSR_A | CPSR_I | CPSR_F;", "else\nshift = 0;", "gen_set_psr_im(VAR_1, ((insn & 7) << 6), 0, shift);", "}", "break;", "default:\ngoto undef;", "}", "break;", "case 12:\nrn = (insn >> 8) & 0x7;", "addr = load_reg(VAR_1, rn);", "for (VAR_2 = 0; VAR_2 < 8; VAR_2++) {", "if (insn & (1 << VAR_2)) {", "if (insn & (1 << 11)) {", "tmp = gen_ld32(addr, IS_USER(VAR_1));", "store_reg(VAR_1, VAR_2, tmp);", "} else {", "tmp = load_reg(VAR_1, VAR_2);", "gen_st32(tmp, addr, IS_USER(VAR_1));", "}", "tcg_gen_addi_i32(addr, addr, 4);", "}", "}", "if ((insn & (1 << rn)) == 0) {", "store_reg(VAR_1, rn, addr);", "} else {", "tcg_temp_free_i32(addr);", "}", "break;", "case 13:\ncond = (insn >> 8) & 0xf;", "if (cond == 0xe)\ngoto undef;", "if (cond == 0xf) {", "gen_set_pc_im(VAR_1->pc);", "VAR_1->is_jmp = DISAS_SWI;", "break;", "}", "VAR_1->condlabel = gen_new_label();", "gen_test_cc(cond ^ 1, VAR_1->condlabel);", "VAR_1->condjmp = 1;", "val = (uint32_t)VAR_1->pc + 2;", "offset = ((int32_t)insn << 24) >> 24;", "val += offset << 1;", "gen_jmp(VAR_1, val);", "break;", "case 14:\nif (insn & (1 << 11)) {", "if (disas_thumb2_insn(VAR_0, VAR_1, insn))\ngoto undef32;", "break;", "}", "val = (uint32_t)VAR_1->pc;", "offset = ((int32_t)insn << 21) >> 21;", "val += (offset << 1) + 2;", "gen_jmp(VAR_1, val);", "break;", "case 15:\nif (disas_thumb2_insn(VAR_0, VAR_1, insn))\ngoto undef32;", "break;", "}", "return;", "undef32:\ngen_exception_insn(VAR_1, 4, EXCP_UDEF);", "return;", "illegal_op:\nundef:\ngen_exception_insn(VAR_1, 2, EXCP_UDEF);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 43 ], [ 45, 49 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ], [ 61 ], [ 65 ], [ 67 ], [ 69 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81, 83 ], [ 85, 87 ], [ 89 ], [ 91, 93 ], [ 95, 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117, 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127, 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141, 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157, 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167, 169, 171 ], [ 173, 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183, 185, 187 ], [ 189, 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205, 207 ], [ 209 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ], [ 225 ], [ 227 ], [ 229 ], [ 231 ], [ 235 ], [ 237 ], [ 239 ], [ 241 ], [ 243, 245 ], [ 247 ], [ 249 ], [ 251 ], [ 253 ], [ 255 ], [ 257, 259 ], [ 261 ], [ 263 ], [ 265 ], [ 267 ], [ 269 ], [ 271, 273 ], [ 275 ], [ 277 ], [ 279, 281 ], [ 283 ], [ 285 ], [ 287 ], [ 289 ], [ 291 ], [ 293 ], [ 295 ], [ 297 ], [ 299 ], [ 301 ], [ 303 ], [ 309 ], [ 311 ], [ 313 ], [ 315 ], [ 319 ], [ 321 ], [ 323 ], [ 325 ], [ 327 ], [ 329 ], [ 331 ], [ 335 ], [ 337 ], [ 339 ], [ 341 ], [ 343 ], [ 345 ], [ 347 ], [ 349 ], [ 353 ], [ 355 ], [ 357, 359 ], [ 361, 363 ], [ 365 ], [ 367, 369 ], [ 371, 373 ], [ 375 ], [ 377, 379 ], [ 381 ], [ 383 ], [ 385 ], [ 387 ], [ 389 ], [ 391 ], [ 393, 395 ], [ 397 ], [ 399 ], [ 401 ], [ 403 ], [ 405 ], [ 407 ], [ 409, 411 ], [ 413 ], [ 415 ], [ 417 ], [ 419 ], [ 421 ], [ 423 ], [ 425, 427, 429 ], [ 431, 433 ], [ 435 ], [ 437, 439, 441 ], [ 443, 445 ], [ 447 ], [ 449, 451 ], [ 453 ], [ 455 ], [ 457 ], [ 459 ], [ 461 ], [ 463 ], [ 465 ], [ 467, 469 ], [ 471 ], [ 473 ], [ 475 ], [ 477, 479, 481 ], [ 483, 485 ], [ 487 ], [ 489, 491 ], [ 493 ], [ 495 ], [ 497, 499 ], [ 501 ], [ 503 ], [ 505, 507 ], [ 509, 511 ], [ 513 ], [ 515, 517 ], [ 519, 521 ], [ 523 ], [ 525, 527 ], [ 529, 531 ], [ 533 ], [ 535, 537 ], [ 539, 541 ], [ 543 ], [ 545 ], [ 547 ], [ 549 ], [ 551 ], [ 553 ], [ 555 ], [ 557, 559 ], [ 561 ], [ 563 ], [ 565 ], [ 567 ], [ 569 ], [ 571 ], [ 573 ], [ 575 ], [ 577 ], [ 581, 585 ], [ 587 ], [ 589 ], [ 591 ], [ 593 ], [ 595 ], [ 597 ], [ 599 ], [ 603, 605 ], [ 609 ], [ 611, 613 ], [ 615 ], [ 617, 619 ], [ 621 ], [ 623, 625 ], [ 627 ], [ 629, 631 ], [ 633 ], [ 635, 637 ], [ 639 ], [ 641, 643 ], [ 645 ], [ 647, 649 ], [ 651 ], [ 653, 655 ], [ 657 ], [ 659 ], [ 661, 663 ], [ 665 ], [ 667 ], [ 671, 675 ], [ 677 ], [ 679 ], [ 681 ], [ 683 ], [ 687 ], [ 691 ], [ 693 ], [ 695 ], [ 699 ], [ 701 ], [ 703 ], [ 705 ], [ 707 ], [ 711, 715 ], [ 717 ], [ 719 ], [ 721 ], [ 723 ], [ 727 ], [ 731 ], [ 733 ], [ 735 ], [ 739 ], [ 741 ], [ 743 ], [ 745 ], [ 747 ], [ 751, 755 ], [ 757 ], [ 759 ], [ 761 ], [ 763 ], [ 767 ], [ 771 ], [ 773 ], [ 775 ], [ 779 ], [ 781 ], [ 783 ], [ 785 ], [ 787 ], [ 791, 795 ], [ 797 ], [ 799 ], [ 801 ], [ 805 ], [ 809 ], [ 811 ], [ 813 ], [ 817 ], [ 819 ], [ 821 ], [ 823 ], [ 825 ], [ 829, 833 ], [ 835 ], [ 839 ], [ 841 ], [ 845 ], [ 847 ], [ 849 ], [ 851 ], [ 853 ], [ 855 ], [ 857 ], [ 861, 865 ], [ 867 ], [ 869, 873 ], [ 875 ], [ 877, 879 ], [ 881 ], [ 883 ], [ 885 ], [ 889, 891 ], [ 893 ], [ 895 ], [ 897 ], [ 899 ], [ 901 ], [ 903 ], [ 905 ], [ 907 ], [ 909 ], [ 911 ], [ 913 ], [ 915, 919 ], [ 921, 923 ], [ 925, 927 ], [ 929 ], [ 931, 933 ], [ 935 ], [ 937 ], [ 939 ], [ 941 ], [ 943 ], [ 945 ], [ 947 ], [ 951 ], [ 953 ], [ 955 ], [ 959 ], [ 961 ], [ 963 ], [ 967 ], [ 969 ], [ 971 ], [ 973 ], [ 975 ], [ 977 ], [ 981 ], [ 987 ], [ 991 ], [ 993 ], [ 995 ], [ 997 ], [ 999 ], [ 1001 ], [ 1003 ], [ 1005 ], [ 1009 ], [ 1013, 1015 ], [ 1017 ], [ 1021, 1023 ], [ 1025 ], [ 1027 ], [ 1029 ], [ 1031, 1033 ], [ 1035, 1037 ], [ 1039 ], [ 1041 ], [ 1043 ], [ 1045 ], [ 1047 ], [ 1049 ], [ 1053, 1055 ], [ 1057 ], [ 1059 ], [ 1061 ], [ 1065 ], [ 1067 ], [ 1071 ], [ 1075, 1077 ], [ 1079 ], [ 1083, 1085 ], [ 1087 ], [ 1089 ], [ 1091 ], [ 1093 ], [ 1095 ], [ 1097 ], [ 1099 ], [ 1101 ], [ 1103 ], [ 1105 ], [ 1107 ], [ 1111, 1113 ], [ 1115, 1117 ], [ 1119 ], [ 1121 ], [ 1125 ], [ 1127 ], [ 1129 ], [ 1131 ], [ 1133 ], [ 1137 ], [ 1139 ], [ 1141 ], [ 1143 ], [ 1145 ], [ 1147 ], [ 1149 ], [ 1151 ], [ 1153, 1155 ], [ 1157, 1159 ], [ 1161 ], [ 1163 ], [ 1165 ], [ 1169, 1171 ], [ 1173 ], [ 1175 ], [ 1179, 1183 ], [ 1185 ], [ 1187 ], [ 1189 ], [ 1191 ], [ 1195 ], [ 1197 ], [ 1199 ], [ 1203 ], [ 1205 ], [ 1207 ], [ 1211 ], [ 1213 ], [ 1215 ], [ 1219 ], [ 1221 ], [ 1223 ], [ 1225 ], [ 1227 ], [ 1229 ], [ 1233, 1237 ], [ 1239, 1241 ], [ 1245 ], [ 1249 ], [ 1251 ], [ 1253 ], [ 1255 ], [ 1259 ], [ 1261 ], [ 1263 ], [ 1269 ], [ 1271 ], [ 1273 ], [ 1275 ], [ 1277 ], [ 1281, 1283 ], [ 1285, 1287 ], [ 1289 ], [ 1291 ], [ 1295 ], [ 1297 ], [ 1299 ], [ 1301 ], [ 1303 ], [ 1307, 1309, 1311 ], [ 1313 ], [ 1315 ], [ 1317 ], [ 1319, 1321 ], [ 1323 ], [ 1325, 1327, 1329 ], [ 1331 ] ]
20,111
static int ape_decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; APEContext *s = avctx->priv_data; int16_t *samples = data; int nblocks; int i, n; int blockstodecode; int bytes_used; /* should not happen but who knows */ if (BLOCKS_PER_LOOP * 2 * avctx->channels > *data_size) { av_log (avctx, AV_LOG_ERROR, "Output buffer is too small.\n"); return AVERROR(EINVAL); } if(!s->samples){ void *tmp_data = av_realloc(s->data, (buf_size + 3) & ~3); if (!tmp_data) return AVERROR(ENOMEM); s->data = tmp_data; s->dsp.bswap_buf((uint32_t*)s->data, (const uint32_t*)buf, buf_size >> 2); s->ptr = s->last_ptr = s->data; s->data_end = s->data + buf_size; nblocks = s->samples = bytestream_get_be32(&s->ptr); n = bytestream_get_be32(&s->ptr); if(n < 0 || n > 3){ av_log(avctx, AV_LOG_ERROR, "Incorrect offset passed\n"); s->data = NULL; return AVERROR_INVALIDDATA; } s->ptr += n; s->currentframeblocks = nblocks; buf += 4; if (s->samples <= 0) { *data_size = 0; return buf_size; } memset(s->decoded0, 0, sizeof(s->decoded0)); memset(s->decoded1, 0, sizeof(s->decoded1)); /* Initialize the frame decoder */ init_frame_decoder(s); } if (!s->data) { *data_size = 0; return buf_size; } nblocks = s->samples; blockstodecode = FFMIN(BLOCKS_PER_LOOP, nblocks); s->error=0; if ((s->channels == 1) || (s->frameflags & APE_FRAMECODE_PSEUDO_STEREO)) ape_unpack_mono(s, blockstodecode); else ape_unpack_stereo(s, blockstodecode); emms_c(); if(s->error || s->ptr > s->data_end){ s->samples=0; av_log(avctx, AV_LOG_ERROR, "Error decoding frame\n"); return AVERROR_INVALIDDATA; } for (i = 0; i < blockstodecode; i++) { *samples++ = s->decoded0[i]; if(s->channels == 2) *samples++ = s->decoded1[i]; } s->samples -= blockstodecode; *data_size = blockstodecode * 2 * s->channels; bytes_used = s->samples ? s->ptr - s->last_ptr : buf_size; s->last_ptr = s->ptr; return bytes_used; }
true
FFmpeg
b7e514575982fd2f5db5ea4f3b466d6dd6a08aa7
static int ape_decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; APEContext *s = avctx->priv_data; int16_t *samples = data; int nblocks; int i, n; int blockstodecode; int bytes_used; if (BLOCKS_PER_LOOP * 2 * avctx->channels > *data_size) { av_log (avctx, AV_LOG_ERROR, "Output buffer is too small.\n"); return AVERROR(EINVAL); } if(!s->samples){ void *tmp_data = av_realloc(s->data, (buf_size + 3) & ~3); if (!tmp_data) return AVERROR(ENOMEM); s->data = tmp_data; s->dsp.bswap_buf((uint32_t*)s->data, (const uint32_t*)buf, buf_size >> 2); s->ptr = s->last_ptr = s->data; s->data_end = s->data + buf_size; nblocks = s->samples = bytestream_get_be32(&s->ptr); n = bytestream_get_be32(&s->ptr); if(n < 0 || n > 3){ av_log(avctx, AV_LOG_ERROR, "Incorrect offset passed\n"); s->data = NULL; return AVERROR_INVALIDDATA; } s->ptr += n; s->currentframeblocks = nblocks; buf += 4; if (s->samples <= 0) { *data_size = 0; return buf_size; } memset(s->decoded0, 0, sizeof(s->decoded0)); memset(s->decoded1, 0, sizeof(s->decoded1)); init_frame_decoder(s); } if (!s->data) { *data_size = 0; return buf_size; } nblocks = s->samples; blockstodecode = FFMIN(BLOCKS_PER_LOOP, nblocks); s->error=0; if ((s->channels == 1) || (s->frameflags & APE_FRAMECODE_PSEUDO_STEREO)) ape_unpack_mono(s, blockstodecode); else ape_unpack_stereo(s, blockstodecode); emms_c(); if(s->error || s->ptr > s->data_end){ s->samples=0; av_log(avctx, AV_LOG_ERROR, "Error decoding frame\n"); return AVERROR_INVALIDDATA; } for (i = 0; i < blockstodecode; i++) { *samples++ = s->decoded0[i]; if(s->channels == 2) *samples++ = s->decoded1[i]; } s->samples -= blockstodecode; *data_size = blockstodecode * 2 * s->channels; bytes_used = s->samples ? s->ptr - s->last_ptr : buf_size; s->last_ptr = s->ptr; return bytes_used; }
{ "code": [ " nblocks = s->samples = bytestream_get_be32(&s->ptr);", " if (s->samples <= 0) {" ], "line_no": [ 57, 79 ] }
static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1, int *VAR_2, AVPacket *VAR_3) { const uint8_t *VAR_4 = VAR_3->VAR_1; int VAR_5 = VAR_3->size; APEContext *s = VAR_0->priv_data; int16_t *samples = VAR_1; int VAR_6; int VAR_7, VAR_8; int VAR_9; int VAR_10; if (BLOCKS_PER_LOOP * 2 * VAR_0->channels > *VAR_2) { av_log (VAR_0, AV_LOG_ERROR, "Output buffer is too small.\VAR_8"); return AVERROR(EINVAL); } if(!s->samples){ void *VAR_11 = av_realloc(s->VAR_1, (VAR_5 + 3) & ~3); if (!VAR_11) return AVERROR(ENOMEM); s->VAR_1 = VAR_11; s->dsp.bswap_buf((uint32_t*)s->VAR_1, (const uint32_t*)VAR_4, VAR_5 >> 2); s->ptr = s->last_ptr = s->VAR_1; s->data_end = s->VAR_1 + VAR_5; VAR_6 = s->samples = bytestream_get_be32(&s->ptr); VAR_8 = bytestream_get_be32(&s->ptr); if(VAR_8 < 0 || VAR_8 > 3){ av_log(VAR_0, AV_LOG_ERROR, "Incorrect offset passed\VAR_8"); s->VAR_1 = NULL; return AVERROR_INVALIDDATA; } s->ptr += VAR_8; s->currentframeblocks = VAR_6; VAR_4 += 4; if (s->samples <= 0) { *VAR_2 = 0; return VAR_5; } memset(s->decoded0, 0, sizeof(s->decoded0)); memset(s->decoded1, 0, sizeof(s->decoded1)); init_frame_decoder(s); } if (!s->VAR_1) { *VAR_2 = 0; return VAR_5; } VAR_6 = s->samples; VAR_9 = FFMIN(BLOCKS_PER_LOOP, VAR_6); s->error=0; if ((s->channels == 1) || (s->frameflags & APE_FRAMECODE_PSEUDO_STEREO)) ape_unpack_mono(s, VAR_9); else ape_unpack_stereo(s, VAR_9); emms_c(); if(s->error || s->ptr > s->data_end){ s->samples=0; av_log(VAR_0, AV_LOG_ERROR, "Error decoding frame\VAR_8"); return AVERROR_INVALIDDATA; } for (VAR_7 = 0; VAR_7 < VAR_9; VAR_7++) { *samples++ = s->decoded0[VAR_7]; if(s->channels == 2) *samples++ = s->decoded1[VAR_7]; } s->samples -= VAR_9; *VAR_2 = VAR_9 * 2 * s->channels; VAR_10 = s->samples ? s->ptr - s->last_ptr : VAR_5; s->last_ptr = s->ptr; return VAR_10; }
[ "static int FUNC_0(AVCodecContext *VAR_0,\nvoid *VAR_1, int *VAR_2,\nAVPacket *VAR_3)\n{", "const uint8_t *VAR_4 = VAR_3->VAR_1;", "int VAR_5 = VAR_3->size;", "APEContext *s = VAR_0->priv_data;", "int16_t *samples = VAR_1;", "int VAR_6;", "int VAR_7, VAR_8;", "int VAR_9;", "int VAR_10;", "if (BLOCKS_PER_LOOP * 2 * VAR_0->channels > *VAR_2) {", "av_log (VAR_0, AV_LOG_ERROR, \"Output buffer is too small.\\VAR_8\");", "return AVERROR(EINVAL);", "}", "if(!s->samples){", "void *VAR_11 = av_realloc(s->VAR_1, (VAR_5 + 3) & ~3);", "if (!VAR_11)\nreturn AVERROR(ENOMEM);", "s->VAR_1 = VAR_11;", "s->dsp.bswap_buf((uint32_t*)s->VAR_1, (const uint32_t*)VAR_4, VAR_5 >> 2);", "s->ptr = s->last_ptr = s->VAR_1;", "s->data_end = s->VAR_1 + VAR_5;", "VAR_6 = s->samples = bytestream_get_be32(&s->ptr);", "VAR_8 = bytestream_get_be32(&s->ptr);", "if(VAR_8 < 0 || VAR_8 > 3){", "av_log(VAR_0, AV_LOG_ERROR, \"Incorrect offset passed\\VAR_8\");", "s->VAR_1 = NULL;", "return AVERROR_INVALIDDATA;", "}", "s->ptr += VAR_8;", "s->currentframeblocks = VAR_6;", "VAR_4 += 4;", "if (s->samples <= 0) {", "*VAR_2 = 0;", "return VAR_5;", "}", "memset(s->decoded0, 0, sizeof(s->decoded0));", "memset(s->decoded1, 0, sizeof(s->decoded1));", "init_frame_decoder(s);", "}", "if (!s->VAR_1) {", "*VAR_2 = 0;", "return VAR_5;", "}", "VAR_6 = s->samples;", "VAR_9 = FFMIN(BLOCKS_PER_LOOP, VAR_6);", "s->error=0;", "if ((s->channels == 1) || (s->frameflags & APE_FRAMECODE_PSEUDO_STEREO))\nape_unpack_mono(s, VAR_9);", "else\nape_unpack_stereo(s, VAR_9);", "emms_c();", "if(s->error || s->ptr > s->data_end){", "s->samples=0;", "av_log(VAR_0, AV_LOG_ERROR, \"Error decoding frame\\VAR_8\");", "return AVERROR_INVALIDDATA;", "}", "for (VAR_7 = 0; VAR_7 < VAR_9; VAR_7++) {", "*samples++ = s->decoded0[VAR_7];", "if(s->channels == 2)\n*samples++ = s->decoded1[VAR_7];", "}", "s->samples -= VAR_9;", "*VAR_2 = VAR_9 * 2 * s->channels;", "VAR_10 = s->samples ? s->ptr - s->last_ptr : VAR_5;", "s->last_ptr = s->ptr;", "return VAR_10;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 43, 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 89 ], [ 91 ], [ 97 ], [ 99 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 113 ], [ 115 ], [ 119 ], [ 123, 125 ], [ 127, 129 ], [ 131 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 147 ], [ 149 ], [ 151, 153 ], [ 155 ], [ 159 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ] ]
20,112
static void aarch64_numa_cpu(const void *data) { char *cli; QDict *resp; QList *cpus; const QObject *e; cli = make_cli(data, "-smp 2 " "-numa node,nodeid=0 -numa node,nodeid=1 " "-numa cpu,node-id=1,thread-id=0 " "-numa cpu,node-id=0,thread-id=1"); qtest_start(cli); cpus = get_cpus(&resp); g_assert(cpus); while ((e = qlist_pop(cpus))) { QDict *cpu, *props; int64_t thread, node; cpu = qobject_to_qdict(e); g_assert(qdict_haskey(cpu, "props")); props = qdict_get_qdict(cpu, "props"); g_assert(qdict_haskey(props, "node-id")); node = qdict_get_int(props, "node-id"); g_assert(qdict_haskey(props, "thread-id")); thread = qdict_get_int(props, "thread-id"); if (thread == 0) { g_assert_cmpint(node, ==, 1); } else if (thread == 1) { g_assert_cmpint(node, ==, 0); } else { g_assert(false); } } QDECREF(resp); qtest_end(); g_free(cli); }
true
qemu
5e39d89d20b17cf6fb7f09d181d34f17b2ae2160
static void aarch64_numa_cpu(const void *data) { char *cli; QDict *resp; QList *cpus; const QObject *e; cli = make_cli(data, "-smp 2 " "-numa node,nodeid=0 -numa node,nodeid=1 " "-numa cpu,node-id=1,thread-id=0 " "-numa cpu,node-id=0,thread-id=1"); qtest_start(cli); cpus = get_cpus(&resp); g_assert(cpus); while ((e = qlist_pop(cpus))) { QDict *cpu, *props; int64_t thread, node; cpu = qobject_to_qdict(e); g_assert(qdict_haskey(cpu, "props")); props = qdict_get_qdict(cpu, "props"); g_assert(qdict_haskey(props, "node-id")); node = qdict_get_int(props, "node-id"); g_assert(qdict_haskey(props, "thread-id")); thread = qdict_get_int(props, "thread-id"); if (thread == 0) { g_assert_cmpint(node, ==, 1); } else if (thread == 1) { g_assert_cmpint(node, ==, 0); } else { g_assert(false); } } QDECREF(resp); qtest_end(); g_free(cli); }
{ "code": [ " const QObject *e;", " const QObject *e;", " const QObject *e;", " const QObject *e;" ], "line_no": [ 11, 11, 11, 11 ] }
static void FUNC_0(const void *VAR_0) { char *VAR_1; QDict *resp; QList *cpus; const QObject *VAR_2; VAR_1 = make_cli(VAR_0, "-smp 2 " "-numa node,nodeid=0 -numa node,nodeid=1 " "-numa cpu,node-id=1,thread-id=0 " "-numa cpu,node-id=0,thread-id=1"); qtest_start(VAR_1); cpus = get_cpus(&resp); g_assert(cpus); while ((VAR_2 = qlist_pop(cpus))) { QDict *cpu, *props; int64_t thread, node; cpu = qobject_to_qdict(VAR_2); g_assert(qdict_haskey(cpu, "props")); props = qdict_get_qdict(cpu, "props"); g_assert(qdict_haskey(props, "node-id")); node = qdict_get_int(props, "node-id"); g_assert(qdict_haskey(props, "thread-id")); thread = qdict_get_int(props, "thread-id"); if (thread == 0) { g_assert_cmpint(node, ==, 1); } else if (thread == 1) { g_assert_cmpint(node, ==, 0); } else { g_assert(false); } } QDECREF(resp); qtest_end(); g_free(VAR_1); }
[ "static void FUNC_0(const void *VAR_0)\n{", "char *VAR_1;", "QDict *resp;", "QList *cpus;", "const QObject *VAR_2;", "VAR_1 = make_cli(VAR_0, \"-smp 2 \"\n\"-numa node,nodeid=0 -numa node,nodeid=1 \"\n\"-numa cpu,node-id=1,thread-id=0 \"\n\"-numa cpu,node-id=0,thread-id=1\");", "qtest_start(VAR_1);", "cpus = get_cpus(&resp);", "g_assert(cpus);", "while ((VAR_2 = qlist_pop(cpus))) {", "QDict *cpu, *props;", "int64_t thread, node;", "cpu = qobject_to_qdict(VAR_2);", "g_assert(qdict_haskey(cpu, \"props\"));", "props = qdict_get_qdict(cpu, \"props\");", "g_assert(qdict_haskey(props, \"node-id\"));", "node = qdict_get_int(props, \"node-id\");", "g_assert(qdict_haskey(props, \"thread-id\"));", "thread = qdict_get_int(props, \"thread-id\");", "if (thread == 0) {", "g_assert_cmpint(node, ==, 1);", "} else if (thread == 1) {", "g_assert_cmpint(node, ==, 0);", "} else {", "g_assert(false);", "}", "}", "QDECREF(resp);", "qtest_end();", "g_free(VAR_1);", "}" ]
[ 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15, 17, 19, 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ] ]
20,113
static int unpack_vlcs(Vp3DecodeContext *s, GetBitContext *gb, VLC *table, int coeff_index, int first_fragment, int last_fragment, int eob_run) { int i; int token; int zero_run = 0; DCTELEM coeff = 0; Vp3Fragment *fragment; uint8_t *perm= s->scantable.permutated; int bits_to_get; if ((first_fragment >= s->fragment_count) || (last_fragment >= s->fragment_count)) { av_log(s->avctx, AV_LOG_ERROR, " vp3:unpack_vlcs(): bad fragment number (%d -> %d ?)\n", first_fragment, last_fragment); return 0; } for (i = first_fragment; i <= last_fragment; i++) { int fragment_num = s->coded_fragment_list[i]; if (s->coeff_counts[fragment_num] > coeff_index) continue; fragment = &s->all_fragments[fragment_num]; if (!eob_run) { /* decode a VLC into a token */ token = get_vlc2(gb, table->table, 5, 3); /* use the token to get a zero run, a coefficient, and an eob run */ if (token <= 6) { eob_run = eob_run_base[token]; if (eob_run_get_bits[token]) eob_run += get_bits(gb, eob_run_get_bits[token]); coeff = zero_run = 0; } else { bits_to_get = coeff_get_bits[token]; if (!bits_to_get) coeff = coeff_tables[token][0]; else coeff = coeff_tables[token][get_bits(gb, bits_to_get)]; zero_run = zero_run_base[token]; if (zero_run_get_bits[token]) zero_run += get_bits(gb, zero_run_get_bits[token]); } } if (!eob_run) { s->coeff_counts[fragment_num] += zero_run; if (s->coeff_counts[fragment_num] < 64){ fragment->next_coeff->coeff= coeff; fragment->next_coeff->index= perm[s->coeff_counts[fragment_num]++]; //FIXME perm here already? fragment->next_coeff->next= s->next_coeff; s->next_coeff->next=NULL; fragment->next_coeff= s->next_coeff++; } } else { s->coeff_counts[fragment_num] |= 128; eob_run--; } } return eob_run; }
false
FFmpeg
ee3d7f585215458246c2dd971c2afdd2642a5ca8
static int unpack_vlcs(Vp3DecodeContext *s, GetBitContext *gb, VLC *table, int coeff_index, int first_fragment, int last_fragment, int eob_run) { int i; int token; int zero_run = 0; DCTELEM coeff = 0; Vp3Fragment *fragment; uint8_t *perm= s->scantable.permutated; int bits_to_get; if ((first_fragment >= s->fragment_count) || (last_fragment >= s->fragment_count)) { av_log(s->avctx, AV_LOG_ERROR, " vp3:unpack_vlcs(): bad fragment number (%d -> %d ?)\n", first_fragment, last_fragment); return 0; } for (i = first_fragment; i <= last_fragment; i++) { int fragment_num = s->coded_fragment_list[i]; if (s->coeff_counts[fragment_num] > coeff_index) continue; fragment = &s->all_fragments[fragment_num]; if (!eob_run) { token = get_vlc2(gb, table->table, 5, 3); if (token <= 6) { eob_run = eob_run_base[token]; if (eob_run_get_bits[token]) eob_run += get_bits(gb, eob_run_get_bits[token]); coeff = zero_run = 0; } else { bits_to_get = coeff_get_bits[token]; if (!bits_to_get) coeff = coeff_tables[token][0]; else coeff = coeff_tables[token][get_bits(gb, bits_to_get)]; zero_run = zero_run_base[token]; if (zero_run_get_bits[token]) zero_run += get_bits(gb, zero_run_get_bits[token]); } } if (!eob_run) { s->coeff_counts[fragment_num] += zero_run; if (s->coeff_counts[fragment_num] < 64){ fragment->next_coeff->coeff= coeff; fragment->next_coeff->index= perm[s->coeff_counts[fragment_num]++]; fragment->next_coeff->next= s->next_coeff; s->next_coeff->next=NULL; fragment->next_coeff= s->next_coeff++; } } else { s->coeff_counts[fragment_num] |= 128; eob_run--; } } return eob_run; }
{ "code": [], "line_no": [] }
static int FUNC_0(Vp3DecodeContext *VAR_0, GetBitContext *VAR_1, VLC *VAR_2, int VAR_3, int VAR_4, int VAR_5, int VAR_6) { int VAR_7; int VAR_8; int VAR_9 = 0; DCTELEM coeff = 0; Vp3Fragment *fragment; uint8_t *perm= VAR_0->scantable.permutated; int VAR_10; if ((VAR_4 >= VAR_0->fragment_count) || (VAR_5 >= VAR_0->fragment_count)) { av_log(VAR_0->avctx, AV_LOG_ERROR, " vp3:FUNC_0(): bad fragment number (%d -> %d ?)\n", VAR_4, VAR_5); return 0; } for (VAR_7 = VAR_4; VAR_7 <= VAR_5; VAR_7++) { int VAR_11 = VAR_0->coded_fragment_list[VAR_7]; if (VAR_0->coeff_counts[VAR_11] > VAR_3) continue; fragment = &VAR_0->all_fragments[VAR_11]; if (!VAR_6) { VAR_8 = get_vlc2(VAR_1, VAR_2->VAR_2, 5, 3); if (VAR_8 <= 6) { VAR_6 = eob_run_base[VAR_8]; if (eob_run_get_bits[VAR_8]) VAR_6 += get_bits(VAR_1, eob_run_get_bits[VAR_8]); coeff = VAR_9 = 0; } else { VAR_10 = coeff_get_bits[VAR_8]; if (!VAR_10) coeff = coeff_tables[VAR_8][0]; else coeff = coeff_tables[VAR_8][get_bits(VAR_1, VAR_10)]; VAR_9 = zero_run_base[VAR_8]; if (zero_run_get_bits[VAR_8]) VAR_9 += get_bits(VAR_1, zero_run_get_bits[VAR_8]); } } if (!VAR_6) { VAR_0->coeff_counts[VAR_11] += VAR_9; if (VAR_0->coeff_counts[VAR_11] < 64){ fragment->next_coeff->coeff= coeff; fragment->next_coeff->index= perm[VAR_0->coeff_counts[VAR_11]++]; fragment->next_coeff->next= VAR_0->next_coeff; VAR_0->next_coeff->next=NULL; fragment->next_coeff= VAR_0->next_coeff++; } } else { VAR_0->coeff_counts[VAR_11] |= 128; VAR_6--; } } return VAR_6; }
[ "static int FUNC_0(Vp3DecodeContext *VAR_0, GetBitContext *VAR_1,\nVLC *VAR_2, int VAR_3,\nint VAR_4, int VAR_5,\nint VAR_6)\n{", "int VAR_7;", "int VAR_8;", "int VAR_9 = 0;", "DCTELEM coeff = 0;", "Vp3Fragment *fragment;", "uint8_t *perm= VAR_0->scantable.permutated;", "int VAR_10;", "if ((VAR_4 >= VAR_0->fragment_count) ||\n(VAR_5 >= VAR_0->fragment_count)) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \" vp3:FUNC_0(): bad fragment number (%d -> %d ?)\\n\",\nVAR_4, VAR_5);", "return 0;", "}", "for (VAR_7 = VAR_4; VAR_7 <= VAR_5; VAR_7++) {", "int VAR_11 = VAR_0->coded_fragment_list[VAR_7];", "if (VAR_0->coeff_counts[VAR_11] > VAR_3)\ncontinue;", "fragment = &VAR_0->all_fragments[VAR_11];", "if (!VAR_6) {", "VAR_8 = get_vlc2(VAR_1, VAR_2->VAR_2, 5, 3);", "if (VAR_8 <= 6) {", "VAR_6 = eob_run_base[VAR_8];", "if (eob_run_get_bits[VAR_8])\nVAR_6 += get_bits(VAR_1, eob_run_get_bits[VAR_8]);", "coeff = VAR_9 = 0;", "} else {", "VAR_10 = coeff_get_bits[VAR_8];", "if (!VAR_10)\ncoeff = coeff_tables[VAR_8][0];", "else\ncoeff = coeff_tables[VAR_8][get_bits(VAR_1, VAR_10)];", "VAR_9 = zero_run_base[VAR_8];", "if (zero_run_get_bits[VAR_8])\nVAR_9 += get_bits(VAR_1, zero_run_get_bits[VAR_8]);", "}", "}", "if (!VAR_6) {", "VAR_0->coeff_counts[VAR_11] += VAR_9;", "if (VAR_0->coeff_counts[VAR_11] < 64){", "fragment->next_coeff->coeff= coeff;", "fragment->next_coeff->index= perm[VAR_0->coeff_counts[VAR_11]++];", "fragment->next_coeff->next= VAR_0->next_coeff;", "VAR_0->next_coeff->next=NULL;", "fragment->next_coeff= VAR_0->next_coeff++;", "}", "} else {", "VAR_0->coeff_counts[VAR_11] |= 128;", "VAR_6--;", "}", "}", "return VAR_6;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27, 29 ], [ 33, 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ], [ 49, 51 ], [ 53 ], [ 57 ], [ 61 ], [ 65 ], [ 67 ], [ 69, 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79, 81 ], [ 83, 85 ], [ 89 ], [ 91, 93 ], [ 95 ], [ 97 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 131 ], [ 133 ] ]
20,114
static inline void vmxnet3_ring_init(Vmxnet3Ring *ring, hwaddr pa, size_t size, size_t cell_size, bool zero_region) { ring->pa = pa; ring->size = size; ring->cell_size = cell_size; ring->gen = VMXNET3_INIT_GEN; ring->next = 0; if (zero_region) { vmw_shmem_set(pa, 0, size * cell_size); } }
true
qemu
c508277335e3b6b20cf18e6ea3a35c1fa835c64a
static inline void vmxnet3_ring_init(Vmxnet3Ring *ring, hwaddr pa, size_t size, size_t cell_size, bool zero_region) { ring->pa = pa; ring->size = size; ring->cell_size = cell_size; ring->gen = VMXNET3_INIT_GEN; ring->next = 0; if (zero_region) { vmw_shmem_set(pa, 0, size * cell_size); } }
{ "code": [ "static inline void vmxnet3_ring_init(Vmxnet3Ring *ring,", " vmw_shmem_set(pa, 0, size * cell_size);" ], "line_no": [ 1, 27 ] }
static inline void FUNC_0(Vmxnet3Ring *VAR_0, hwaddr VAR_1, size_t VAR_2, size_t VAR_3, bool VAR_4) { VAR_0->VAR_1 = VAR_1; VAR_0->VAR_2 = VAR_2; VAR_0->VAR_3 = VAR_3; VAR_0->gen = VMXNET3_INIT_GEN; VAR_0->next = 0; if (VAR_4) { vmw_shmem_set(VAR_1, 0, VAR_2 * VAR_3); } }
[ "static inline void FUNC_0(Vmxnet3Ring *VAR_0,\nhwaddr VAR_1,\nsize_t VAR_2,\nsize_t VAR_3,\nbool VAR_4)\n{", "VAR_0->VAR_1 = VAR_1;", "VAR_0->VAR_2 = VAR_2;", "VAR_0->VAR_3 = VAR_3;", "VAR_0->gen = VMXNET3_INIT_GEN;", "VAR_0->next = 0;", "if (VAR_4) {", "vmw_shmem_set(VAR_1, 0, VAR_2 * VAR_3);", "}", "}" ]
[ 1, 0, 0, 0, 0, 0, 0, 1, 0, 0 ]
[ [ 1, 3, 5, 7, 9, 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ] ]
20,115
uint32_t virtio_config_readw(VirtIODevice *vdev, uint32_t addr) { VirtioDeviceClass *k = VIRTIO_DEVICE_GET_CLASS(vdev); uint16_t val; k->get_config(vdev, vdev->config); if (addr > (vdev->config_len - sizeof(val))) return (uint32_t)-1; val = lduw_p(vdev->config + addr); return val; }
true
qemu
5f5a1318653c08e435cfa52f60b6a712815b659d
uint32_t virtio_config_readw(VirtIODevice *vdev, uint32_t addr) { VirtioDeviceClass *k = VIRTIO_DEVICE_GET_CLASS(vdev); uint16_t val; k->get_config(vdev, vdev->config); if (addr > (vdev->config_len - sizeof(val))) return (uint32_t)-1; val = lduw_p(vdev->config + addr); return val; }
{ "code": [ " k->get_config(vdev, vdev->config);", " if (addr > (vdev->config_len - sizeof(val)))", " k->get_config(vdev, vdev->config);", " if (addr > (vdev->config_len - sizeof(val)))", " k->get_config(vdev, vdev->config);", " if (addr > (vdev->config_len - sizeof(val)))", " if (addr > (vdev->config_len - sizeof(val)))", " if (addr > (vdev->config_len - sizeof(val)))", " if (addr > (vdev->config_len - sizeof(val)))" ], "line_no": [ 11, 15, 11, 15, 11, 15, 15, 15, 15 ] }
uint32_t FUNC_0(VirtIODevice *vdev, uint32_t addr) { VirtioDeviceClass *k = VIRTIO_DEVICE_GET_CLASS(vdev); uint16_t val; k->get_config(vdev, vdev->config); if (addr > (vdev->config_len - sizeof(val))) return (uint32_t)-1; val = lduw_p(vdev->config + addr); return val; }
[ "uint32_t FUNC_0(VirtIODevice *vdev, uint32_t addr)\n{", "VirtioDeviceClass *k = VIRTIO_DEVICE_GET_CLASS(vdev);", "uint16_t val;", "k->get_config(vdev, vdev->config);", "if (addr > (vdev->config_len - sizeof(val)))\nreturn (uint32_t)-1;", "val = lduw_p(vdev->config + addr);", "return val;", "}" ]
[ 0, 0, 0, 1, 1, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 15, 17 ], [ 21 ], [ 23 ], [ 25 ] ]
20,116
static int get_qcx(Jpeg2000DecoderContext *s, int n, Jpeg2000QuantStyle *q) { int i, x; if (s->buf_end - s->buf < 1) return AVERROR_INVALIDDATA; x = bytestream_get_byte(&s->buf); // Sqcd q->nguardbits = x >> 5; q->quantsty = x & 0x1f; if (q->quantsty == JPEG2000_QSTY_NONE) { n -= 3; if (s->buf_end - s->buf < n) return AVERROR_INVALIDDATA; for (i = 0; i < n; i++) q->expn[i] = bytestream_get_byte(&s->buf) >> 3; } else if (q->quantsty == JPEG2000_QSTY_SI) { if (s->buf_end - s->buf < 2) return AVERROR_INVALIDDATA; x = bytestream_get_be16(&s->buf); q->expn[0] = x >> 11; q->mant[0] = x & 0x7ff; for (i = 1; i < JPEG2000_MAX_DECLEVELS * 3; i++) { int curexpn = FFMAX(0, q->expn[0] - (i - 1) / 3); q->expn[i] = curexpn; q->mant[i] = q->mant[0]; } } else { n = (n - 3) >> 1; if (s->buf_end - s->buf < n) return AVERROR_INVALIDDATA; for (i = 0; i < n; i++) { x = bytestream_get_be16(&s->buf); q->expn[i] = x >> 11; q->mant[i] = x & 0x7ff; } } return 0; }
true
FFmpeg
1a3598aae768465a8efc8475b6df5a8261bc62fc
static int get_qcx(Jpeg2000DecoderContext *s, int n, Jpeg2000QuantStyle *q) { int i, x; if (s->buf_end - s->buf < 1) return AVERROR_INVALIDDATA; x = bytestream_get_byte(&s->buf); q->nguardbits = x >> 5; q->quantsty = x & 0x1f; if (q->quantsty == JPEG2000_QSTY_NONE) { n -= 3; if (s->buf_end - s->buf < n) return AVERROR_INVALIDDATA; for (i = 0; i < n; i++) q->expn[i] = bytestream_get_byte(&s->buf) >> 3; } else if (q->quantsty == JPEG2000_QSTY_SI) { if (s->buf_end - s->buf < 2) return AVERROR_INVALIDDATA; x = bytestream_get_be16(&s->buf); q->expn[0] = x >> 11; q->mant[0] = x & 0x7ff; for (i = 1; i < JPEG2000_MAX_DECLEVELS * 3; i++) { int curexpn = FFMAX(0, q->expn[0] - (i - 1) / 3); q->expn[i] = curexpn; q->mant[i] = q->mant[0]; } } else { n = (n - 3) >> 1; if (s->buf_end - s->buf < n) return AVERROR_INVALIDDATA; for (i = 0; i < n; i++) { x = bytestream_get_be16(&s->buf); q->expn[i] = x >> 11; q->mant[i] = x & 0x7ff; } } return 0; }
{ "code": [ " return AVERROR_INVALIDDATA;", " if (s->buf_end - s->buf < 1)", " if (s->buf_end - s->buf < n)", " q->expn[i] = bytestream_get_byte(&s->buf) >> 3;", " if (s->buf_end - s->buf < 2)", " x = bytestream_get_be16(&s->buf);", " if (s->buf_end - s->buf < n)", " x = bytestream_get_be16(&s->buf);", " if (s->buf_end - s->buf < 1)", " if (s->buf_end - s->buf < 2)" ], "line_no": [ 11, 9, 29, 35, 39, 43, 29, 69, 9, 39 ] }
static int FUNC_0(Jpeg2000DecoderContext *VAR_0, int VAR_1, Jpeg2000QuantStyle *VAR_2) { int VAR_3, VAR_4; if (VAR_0->buf_end - VAR_0->buf < 1) return AVERROR_INVALIDDATA; VAR_4 = bytestream_get_byte(&VAR_0->buf); VAR_2->nguardbits = VAR_4 >> 5; VAR_2->quantsty = VAR_4 & 0x1f; if (VAR_2->quantsty == JPEG2000_QSTY_NONE) { VAR_1 -= 3; if (VAR_0->buf_end - VAR_0->buf < VAR_1) return AVERROR_INVALIDDATA; for (VAR_3 = 0; VAR_3 < VAR_1; VAR_3++) VAR_2->expn[VAR_3] = bytestream_get_byte(&VAR_0->buf) >> 3; } else if (VAR_2->quantsty == JPEG2000_QSTY_SI) { if (VAR_0->buf_end - VAR_0->buf < 2) return AVERROR_INVALIDDATA; VAR_4 = bytestream_get_be16(&VAR_0->buf); VAR_2->expn[0] = VAR_4 >> 11; VAR_2->mant[0] = VAR_4 & 0x7ff; for (VAR_3 = 1; VAR_3 < JPEG2000_MAX_DECLEVELS * 3; VAR_3++) { int curexpn = FFMAX(0, VAR_2->expn[0] - (VAR_3 - 1) / 3); VAR_2->expn[VAR_3] = curexpn; VAR_2->mant[VAR_3] = VAR_2->mant[0]; } } else { VAR_1 = (VAR_1 - 3) >> 1; if (VAR_0->buf_end - VAR_0->buf < VAR_1) return AVERROR_INVALIDDATA; for (VAR_3 = 0; VAR_3 < VAR_1; VAR_3++) { VAR_4 = bytestream_get_be16(&VAR_0->buf); VAR_2->expn[VAR_3] = VAR_4 >> 11; VAR_2->mant[VAR_3] = VAR_4 & 0x7ff; } } return 0; }
[ "static int FUNC_0(Jpeg2000DecoderContext *VAR_0, int VAR_1, Jpeg2000QuantStyle *VAR_2)\n{", "int VAR_3, VAR_4;", "if (VAR_0->buf_end - VAR_0->buf < 1)\nreturn AVERROR_INVALIDDATA;", "VAR_4 = bytestream_get_byte(&VAR_0->buf);", "VAR_2->nguardbits = VAR_4 >> 5;", "VAR_2->quantsty = VAR_4 & 0x1f;", "if (VAR_2->quantsty == JPEG2000_QSTY_NONE) {", "VAR_1 -= 3;", "if (VAR_0->buf_end - VAR_0->buf < VAR_1)\nreturn AVERROR_INVALIDDATA;", "for (VAR_3 = 0; VAR_3 < VAR_1; VAR_3++)", "VAR_2->expn[VAR_3] = bytestream_get_byte(&VAR_0->buf) >> 3;", "} else if (VAR_2->quantsty == JPEG2000_QSTY_SI) {", "if (VAR_0->buf_end - VAR_0->buf < 2)\nreturn AVERROR_INVALIDDATA;", "VAR_4 = bytestream_get_be16(&VAR_0->buf);", "VAR_2->expn[0] = VAR_4 >> 11;", "VAR_2->mant[0] = VAR_4 & 0x7ff;", "for (VAR_3 = 1; VAR_3 < JPEG2000_MAX_DECLEVELS * 3; VAR_3++) {", "int curexpn = FFMAX(0, VAR_2->expn[0] - (VAR_3 - 1) / 3);", "VAR_2->expn[VAR_3] = curexpn;", "VAR_2->mant[VAR_3] = VAR_2->mant[0];", "}", "} else {", "VAR_1 = (VAR_1 - 3) >> 1;", "if (VAR_0->buf_end - VAR_0->buf < VAR_1)\nreturn AVERROR_INVALIDDATA;", "for (VAR_3 = 0; VAR_3 < VAR_1; VAR_3++) {", "VAR_4 = bytestream_get_be16(&VAR_0->buf);", "VAR_2->expn[VAR_3] = VAR_4 >> 11;", "VAR_2->mant[VAR_3] = VAR_4 & 0x7ff;", "}", "}", "return 0;", "}" ]
[ 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9, 11 ], [ 15 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29, 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39, 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63, 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ] ]
20,117
static void qemu_kvm_eat_signals(CPUState *env) { struct timespec ts = { 0, 0 }; siginfo_t siginfo; sigset_t waitset; sigset_t chkset; int r; sigemptyset(&waitset); sigaddset(&waitset, SIG_IPI); sigaddset(&waitset, SIGBUS); do { r = sigtimedwait(&waitset, &siginfo, &ts); if (r == -1 && !(errno == EAGAIN || errno == EINTR)) { perror("sigtimedwait"); exit(1); } switch (r) { case SIGBUS: if (kvm_on_sigbus_vcpu(env, siginfo.si_code, siginfo.si_addr)) { sigbus_reraise(); } break; default: break; } r = sigpending(&chkset); if (r == -1) { perror("sigpending"); exit(1); } } while (sigismember(&chkset, SIG_IPI) || sigismember(&chkset, SIGBUS)); #ifndef CONFIG_IOTHREAD if (sigismember(&chkset, SIGIO) || sigismember(&chkset, SIGALRM)) { qemu_notify_event(); } #endif }
true
qemu
12d4536f7d911b6d87a766ad7300482ea663cea2
static void qemu_kvm_eat_signals(CPUState *env) { struct timespec ts = { 0, 0 }; siginfo_t siginfo; sigset_t waitset; sigset_t chkset; int r; sigemptyset(&waitset); sigaddset(&waitset, SIG_IPI); sigaddset(&waitset, SIGBUS); do { r = sigtimedwait(&waitset, &siginfo, &ts); if (r == -1 && !(errno == EAGAIN || errno == EINTR)) { perror("sigtimedwait"); exit(1); } switch (r) { case SIGBUS: if (kvm_on_sigbus_vcpu(env, siginfo.si_code, siginfo.si_addr)) { sigbus_reraise(); } break; default: break; } r = sigpending(&chkset); if (r == -1) { perror("sigpending"); exit(1); } } while (sigismember(&chkset, SIG_IPI) || sigismember(&chkset, SIGBUS)); #ifndef CONFIG_IOTHREAD if (sigismember(&chkset, SIGIO) || sigismember(&chkset, SIGALRM)) { qemu_notify_event(); } #endif }
{ "code": [ "#endif", "#endif", "#ifndef CONFIG_IOTHREAD", " if (sigismember(&chkset, SIGIO) || sigismember(&chkset, SIGALRM)) {", " qemu_notify_event();", "#endif", "#endif", "#endif", "#endif", "#ifndef CONFIG_IOTHREAD", " int r;", " exit(1);", "#endif", "#endif", "#ifndef CONFIG_IOTHREAD", " break;", "#endif", "#endif", "#ifndef CONFIG_IOTHREAD", "#endif", "#endif", "#ifndef CONFIG_IOTHREAD", "#endif", "#ifndef CONFIG_IOTHREAD", "#endif", "#endif" ], "line_no": [ 81, 81, 73, 75, 77, 81, 81, 81, 81, 73, 13, 33, 81, 81, 73, 49, 81, 81, 73, 81, 81, 73, 81, 73, 81, 81 ] }
static void FUNC_0(CPUState *VAR_0) { struct timespec VAR_1 = { 0, 0 }; siginfo_t siginfo; sigset_t waitset; sigset_t chkset; int VAR_2; sigemptyset(&waitset); sigaddset(&waitset, SIG_IPI); sigaddset(&waitset, SIGBUS); do { VAR_2 = sigtimedwait(&waitset, &siginfo, &VAR_1); if (VAR_2 == -1 && !(errno == EAGAIN || errno == EINTR)) { perror("sigtimedwait"); exit(1); } switch (VAR_2) { case SIGBUS: if (kvm_on_sigbus_vcpu(VAR_0, siginfo.si_code, siginfo.si_addr)) { sigbus_reraise(); } break; default: break; } VAR_2 = sigpending(&chkset); if (VAR_2 == -1) { perror("sigpending"); exit(1); } } while (sigismember(&chkset, SIG_IPI) || sigismember(&chkset, SIGBUS)); #ifndef CONFIG_IOTHREAD if (sigismember(&chkset, SIGIO) || sigismember(&chkset, SIGALRM)) { qemu_notify_event(); } #endif }
[ "static void FUNC_0(CPUState *VAR_0)\n{", "struct timespec VAR_1 = { 0, 0 };", "siginfo_t siginfo;", "sigset_t waitset;", "sigset_t chkset;", "int VAR_2;", "sigemptyset(&waitset);", "sigaddset(&waitset, SIG_IPI);", "sigaddset(&waitset, SIGBUS);", "do {", "VAR_2 = sigtimedwait(&waitset, &siginfo, &VAR_1);", "if (VAR_2 == -1 && !(errno == EAGAIN || errno == EINTR)) {", "perror(\"sigtimedwait\");", "exit(1);", "}", "switch (VAR_2) {", "case SIGBUS:\nif (kvm_on_sigbus_vcpu(VAR_0, siginfo.si_code, siginfo.si_addr)) {", "sigbus_reraise();", "}", "break;", "default:\nbreak;", "}", "VAR_2 = sigpending(&chkset);", "if (VAR_2 == -1) {", "perror(\"sigpending\");", "exit(1);", "}", "} while (sigismember(&chkset, SIG_IPI) || sigismember(&chkset, SIGBUS));", "#ifndef CONFIG_IOTHREAD\nif (sigismember(&chkset, SIGIO) || sigismember(&chkset, SIGALRM)) {", "qemu_notify_event();", "}", "#endif\n}" ]
[ 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41, 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51, 53 ], [ 55 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 73, 75 ], [ 77 ], [ 79 ], [ 81, 83 ] ]
20,118
static int mov_read_default(MOVContext *c, AVIOContext *pb, MOVAtom atom) { int64_t total_size = 0; MOVAtom a; int i; if (atom.size < 0) atom.size = INT64_MAX; while (total_size + 8 <= atom.size && !url_feof(pb)) { int (*parse)(MOVContext*, AVIOContext*, MOVAtom) = NULL; a.size = atom.size; a.type=0; if (atom.size >= 8) { a.size = avio_rb32(pb); a.type = avio_rl32(pb); total_size += 8; if (a.size == 1) { /* 64 bit extended size */ a.size = avio_rb64(pb) - 8; total_size += 8; } } av_dlog(c->fc, "type: %08x '%.4s' parent:'%.4s' sz: %"PRId64" %"PRId64" %"PRId64"\n", a.type, (char*)&a.type, (char*)&atom.type, a.size, total_size, atom.size); if (a.size == 0) { a.size = atom.size - total_size + 8; if (a.size <= 8) break; } a.size -= 8; if (a.size < 0) break; a.size = FFMIN(a.size, atom.size - total_size); for (i = 0; mov_default_parse_table[i].type; i++) if (mov_default_parse_table[i].type == a.type) { parse = mov_default_parse_table[i].parse; break; } // container is user data if (!parse && (atom.type == MKTAG('u','d','t','a') || atom.type == MKTAG('i','l','s','t'))) parse = mov_read_udta_string; if (!parse) { /* skip leaf atoms data */ avio_skip(pb, a.size); } else { int64_t start_pos = avio_tell(pb); int64_t left; int err = parse(c, pb, a); if (err < 0) return err; if (c->found_moov && c->found_mdat && (!pb->seekable || start_pos + a.size == avio_size(pb))) return 0; left = a.size - avio_tell(pb) + start_pos; if (left > 0) /* skip garbage at atom end */ avio_skip(pb, left); } total_size += a.size; } if (total_size < atom.size && atom.size < 0x7ffff) avio_skip(pb, atom.size - total_size); return 0; }
false
FFmpeg
e1ccc9216b5d2bfa0074c208aa5dfa2b05b5ad2a
static int mov_read_default(MOVContext *c, AVIOContext *pb, MOVAtom atom) { int64_t total_size = 0; MOVAtom a; int i; if (atom.size < 0) atom.size = INT64_MAX; while (total_size + 8 <= atom.size && !url_feof(pb)) { int (*parse)(MOVContext*, AVIOContext*, MOVAtom) = NULL; a.size = atom.size; a.type=0; if (atom.size >= 8) { a.size = avio_rb32(pb); a.type = avio_rl32(pb); total_size += 8; if (a.size == 1) { a.size = avio_rb64(pb) - 8; total_size += 8; } } av_dlog(c->fc, "type: %08x '%.4s' parent:'%.4s' sz: %"PRId64" %"PRId64" %"PRId64"\n", a.type, (char*)&a.type, (char*)&atom.type, a.size, total_size, atom.size); if (a.size == 0) { a.size = atom.size - total_size + 8; if (a.size <= 8) break; } a.size -= 8; if (a.size < 0) break; a.size = FFMIN(a.size, atom.size - total_size); for (i = 0; mov_default_parse_table[i].type; i++) if (mov_default_parse_table[i].type == a.type) { parse = mov_default_parse_table[i].parse; break; } if (!parse && (atom.type == MKTAG('u','d','t','a') || atom.type == MKTAG('i','l','s','t'))) parse = mov_read_udta_string; if (!parse) { avio_skip(pb, a.size); } else { int64_t start_pos = avio_tell(pb); int64_t left; int err = parse(c, pb, a); if (err < 0) return err; if (c->found_moov && c->found_mdat && (!pb->seekable || start_pos + a.size == avio_size(pb))) return 0; left = a.size - avio_tell(pb) + start_pos; if (left > 0) avio_skip(pb, left); } total_size += a.size; } if (total_size < atom.size && atom.size < 0x7ffff) avio_skip(pb, atom.size - total_size); return 0; }
{ "code": [], "line_no": [] }
VAR_6staticVAR_6 VAR_6intVAR_6 VAR_6mov_read_defaultVAR_6(VAR_6MOVContextVAR_6 *VAR_6VAR_0VAR_6, VAR_6AVIOContextVAR_6 *VAR_6VAR_1VAR_6, VAR_6MOVAtomVAR_6 VAR_6VAR_2VAR_6) { VAR_6int64_tVAR_6 VAR_6total_sizeVAR_6 = VAR_60VAR_6; VAR_6MOVAtomVAR_6 VAR_6aVAR_6; VAR_6intVAR_6 VAR_6VAR_3VAR_6; VAR_6ifVAR_6 (VAR_6VAR_2VAR_6.VAR_6sizeVAR_6 < VAR_60VAR_6) VAR_6VAR_2VAR_6.VAR_6sizeVAR_6 = VAR_6INT64_MAXVAR_6; VAR_6whileVAR_6 (VAR_6total_sizeVAR_6 + VAR_68VAR_6 <= VAR_6VAR_2VAR_6.VAR_6sizeVAR_6 && !VAR_6url_feofVAR_6(VAR_6VAR_1VAR_6)) { VAR_6intVAR_6 (*VAR_6VAR_4VAR_6)(VAR_6MOVContextVAR_6*, VAR_6AVIOContextVAR_6*, VAR_6MOVAtomVAR_6) = VAR_6NULLVAR_6; VAR_6aVAR_6.VAR_6sizeVAR_6 = VAR_6VAR_2VAR_6.VAR_6sizeVAR_6; VAR_6aVAR_6.VAR_6typeVAR_6=VAR_60VAR_6; VAR_6ifVAR_6 (VAR_6VAR_2VAR_6.VAR_6sizeVAR_6 >= VAR_68VAR_6) { VAR_6aVAR_6.VAR_6sizeVAR_6 = VAR_6avio_rb32VAR_6(VAR_6VAR_1VAR_6); VAR_6aVAR_6.VAR_6typeVAR_6 = VAR_6avio_rl32VAR_6(VAR_6VAR_1VAR_6); VAR_6total_sizeVAR_6 += VAR_68VAR_6; VAR_6ifVAR_6 (VAR_6aVAR_6.VAR_6sizeVAR_6 == VAR_61VAR_6) { VAR_6aVAR_6.VAR_6sizeVAR_6 = VAR_6avio_rb64VAR_6(VAR_6VAR_1VAR_6) - VAR_68VAR_6; VAR_6total_sizeVAR_6 += VAR_68VAR_6; } } VAR_6av_dlogVAR_6(VAR_6VAR_0VAR_6->VAR_6fcVAR_6, "VAR_6typeVAR_6: %VAR_608xVAR_6 '%.VAR_64sVAR_6' VAR_6parentVAR_6:'%.VAR_64sVAR_6' VAR_6szVAR_6: %"VAR_6PRId64VAR_6" %"VAR_6PRId64VAR_6" %"VAR_6PRId64VAR_6"\VAR_6nVAR_6", VAR_6aVAR_6.VAR_6typeVAR_6, (VAR_6charVAR_6*)&VAR_6aVAR_6.VAR_6typeVAR_6, (VAR_6charVAR_6*)&VAR_6VAR_2VAR_6.VAR_6typeVAR_6, VAR_6aVAR_6.VAR_6sizeVAR_6, VAR_6total_sizeVAR_6, VAR_6VAR_2VAR_6.VAR_6sizeVAR_6); VAR_6ifVAR_6 (VAR_6aVAR_6.VAR_6sizeVAR_6 == VAR_60VAR_6) { VAR_6aVAR_6.VAR_6sizeVAR_6 = VAR_6VAR_2VAR_6.VAR_6sizeVAR_6 - VAR_6total_sizeVAR_6 + VAR_68VAR_6; VAR_6ifVAR_6 (VAR_6aVAR_6.VAR_6sizeVAR_6 <= VAR_68VAR_6) VAR_6breakVAR_6; } VAR_6aVAR_6.VAR_6sizeVAR_6 -= VAR_68VAR_6; VAR_6ifVAR_6 (VAR_6aVAR_6.VAR_6sizeVAR_6 < VAR_60VAR_6) VAR_6breakVAR_6; VAR_6aVAR_6.VAR_6sizeVAR_6 = VAR_6FFMINVAR_6(VAR_6aVAR_6.VAR_6sizeVAR_6, VAR_6VAR_2VAR_6.VAR_6sizeVAR_6 - VAR_6total_sizeVAR_6); VAR_6forVAR_6 (VAR_6VAR_3VAR_6 = VAR_60VAR_6; VAR_6mov_default_parse_tableVAR_6[VAR_6VAR_3VAR_6].VAR_6typeVAR_6; VAR_6VAR_3VAR_6++) VAR_6ifVAR_6 (VAR_6mov_default_parse_tableVAR_6[VAR_6VAR_3VAR_6].VAR_6typeVAR_6 == VAR_6aVAR_6.VAR_6typeVAR_6) { VAR_6VAR_4VAR_6 = VAR_6mov_default_parse_tableVAR_6[VAR_6VAR_3VAR_6].VAR_6VAR_4VAR_6; VAR_6breakVAR_6; } VAR_6ifVAR_6 (!VAR_6VAR_4VAR_6 && (VAR_6VAR_2VAR_6.VAR_6typeVAR_6 == VAR_6MKTAGVAR_6('VAR_6uVAR_6','VAR_6dVAR_6','VAR_6tVAR_6','VAR_6aVAR_6') || VAR_6VAR_2VAR_6.VAR_6typeVAR_6 == VAR_6MKTAGVAR_6('VAR_6VAR_3VAR_6','VAR_6lVAR_6','VAR_6sVAR_6','VAR_6tVAR_6'))) VAR_6VAR_4VAR_6 = VAR_6mov_read_udta_stringVAR_6; VAR_6ifVAR_6 (!VAR_6VAR_4VAR_6) { VAR_6avio_skipVAR_6(VAR_6VAR_1VAR_6, VAR_6aVAR_6.VAR_6sizeVAR_6); } VAR_6elseVAR_6 { VAR_6int64_tVAR_6 VAR_6start_posVAR_6 = VAR_6avio_tellVAR_6(VAR_6VAR_1VAR_6); VAR_6int64_tVAR_6 VAR_6leftVAR_6; VAR_6intVAR_6 VAR_6errVAR_6 = VAR_6VAR_4VAR_6(VAR_6VAR_0VAR_6, VAR_6VAR_1VAR_6, VAR_6aVAR_6); VAR_6ifVAR_6 (VAR_6errVAR_6 < VAR_60VAR_6) VAR_6returnVAR_6 VAR_6errVAR_6; VAR_6ifVAR_6 (VAR_6VAR_0VAR_6->VAR_6found_moovVAR_6 && VAR_6VAR_0VAR_6->VAR_6found_mdatVAR_6 && (!VAR_6VAR_1VAR_6->VAR_6seekableVAR_6 || VAR_6start_posVAR_6 + VAR_6aVAR_6.VAR_6sizeVAR_6 == VAR_6avio_sizeVAR_6(VAR_6VAR_1VAR_6))) VAR_6returnVAR_6 VAR_60VAR_6; VAR_6leftVAR_6 = VAR_6aVAR_6.VAR_6sizeVAR_6 - VAR_6avio_tellVAR_6(VAR_6VAR_1VAR_6) + VAR_6start_posVAR_6; VAR_6ifVAR_6 (VAR_6leftVAR_6 > VAR_60VAR_6) VAR_6avio_skipVAR_6(VAR_6VAR_1VAR_6, VAR_6leftVAR_6); } VAR_6total_sizeVAR_6 += VAR_6aVAR_6.VAR_6sizeVAR_6; } VAR_6ifVAR_6 (VAR_6total_sizeVAR_6 < VAR_6VAR_2VAR_6.VAR_6sizeVAR_6 && VAR_6VAR_2VAR_6.VAR_6sizeVAR_6 < VAR_60x7ffffVAR_6) VAR_6avio_skipVAR_6(VAR_6VAR_1VAR_6, VAR_6VAR_2VAR_6.VAR_6sizeVAR_6 - VAR_6total_sizeVAR_6); VAR_6returnVAR_6 VAR_60VAR_6; }
[ "VAR_6staticVAR_6 VAR_6intVAR_6 VAR_6mov_read_defaultVAR_6(VAR_6MOVContextVAR_6 *VAR_6VAR_0VAR_6, VAR_6AVIOContextVAR_6 *VAR_6VAR_1VAR_6, VAR_6MOVAtomVAR_6 VAR_6VAR_2VAR_6)\n{", "VAR_6int64_tVAR_6 VAR_6total_sizeVAR_6 = VAR_60VAR_6;", "VAR_6MOVAtomVAR_6 VAR_6aVAR_6;", "VAR_6intVAR_6 VAR_6VAR_3VAR_6;", "VAR_6ifVAR_6 (VAR_6VAR_2VAR_6.VAR_6sizeVAR_6 < VAR_60VAR_6)\nVAR_6VAR_2VAR_6.VAR_6sizeVAR_6 = VAR_6INT64_MAXVAR_6;", "VAR_6whileVAR_6 (VAR_6total_sizeVAR_6 + VAR_68VAR_6 <= VAR_6VAR_2VAR_6.VAR_6sizeVAR_6 && !VAR_6url_feofVAR_6(VAR_6VAR_1VAR_6)) {", "VAR_6intVAR_6 (*VAR_6VAR_4VAR_6)(VAR_6MOVContextVAR_6*, VAR_6AVIOContextVAR_6*, VAR_6MOVAtomVAR_6) = VAR_6NULLVAR_6;", "VAR_6aVAR_6.VAR_6sizeVAR_6 = VAR_6VAR_2VAR_6.VAR_6sizeVAR_6;", "VAR_6aVAR_6.VAR_6typeVAR_6=VAR_60VAR_6;", "VAR_6ifVAR_6 (VAR_6VAR_2VAR_6.VAR_6sizeVAR_6 >= VAR_68VAR_6) {", "VAR_6aVAR_6.VAR_6sizeVAR_6 = VAR_6avio_rb32VAR_6(VAR_6VAR_1VAR_6);", "VAR_6aVAR_6.VAR_6typeVAR_6 = VAR_6avio_rl32VAR_6(VAR_6VAR_1VAR_6);", "VAR_6total_sizeVAR_6 += VAR_68VAR_6;", "VAR_6ifVAR_6 (VAR_6aVAR_6.VAR_6sizeVAR_6 == VAR_61VAR_6) {", "VAR_6aVAR_6.VAR_6sizeVAR_6 = VAR_6avio_rb64VAR_6(VAR_6VAR_1VAR_6) - VAR_68VAR_6;", "VAR_6total_sizeVAR_6 += VAR_68VAR_6;", "}", "}", "VAR_6av_dlogVAR_6(VAR_6VAR_0VAR_6->VAR_6fcVAR_6, \"VAR_6typeVAR_6: %VAR_608xVAR_6 '%.VAR_64sVAR_6' VAR_6parentVAR_6:'%.VAR_64sVAR_6' VAR_6szVAR_6: %\"VAR_6PRId64VAR_6\" %\"VAR_6PRId64VAR_6\" %\"VAR_6PRId64VAR_6\"\\VAR_6nVAR_6\",\nVAR_6aVAR_6.VAR_6typeVAR_6, (VAR_6charVAR_6*)&VAR_6aVAR_6.VAR_6typeVAR_6, (VAR_6charVAR_6*)&VAR_6VAR_2VAR_6.VAR_6typeVAR_6, VAR_6aVAR_6.VAR_6sizeVAR_6, VAR_6total_sizeVAR_6, VAR_6VAR_2VAR_6.VAR_6sizeVAR_6);", "VAR_6ifVAR_6 (VAR_6aVAR_6.VAR_6sizeVAR_6 == VAR_60VAR_6) {", "VAR_6aVAR_6.VAR_6sizeVAR_6 = VAR_6VAR_2VAR_6.VAR_6sizeVAR_6 - VAR_6total_sizeVAR_6 + VAR_68VAR_6;", "VAR_6ifVAR_6 (VAR_6aVAR_6.VAR_6sizeVAR_6 <= VAR_68VAR_6)\nVAR_6breakVAR_6;", "}", "VAR_6aVAR_6.VAR_6sizeVAR_6 -= VAR_68VAR_6;", "VAR_6ifVAR_6 (VAR_6aVAR_6.VAR_6sizeVAR_6 < VAR_60VAR_6)\nVAR_6breakVAR_6;", "VAR_6aVAR_6.VAR_6sizeVAR_6 = VAR_6FFMINVAR_6(VAR_6aVAR_6.VAR_6sizeVAR_6, VAR_6VAR_2VAR_6.VAR_6sizeVAR_6 - VAR_6total_sizeVAR_6);", "VAR_6forVAR_6 (VAR_6VAR_3VAR_6 = VAR_60VAR_6; VAR_6mov_default_parse_tableVAR_6[VAR_6VAR_3VAR_6].VAR_6typeVAR_6; VAR_6VAR_3VAR_6++)", "VAR_6ifVAR_6 (VAR_6mov_default_parse_tableVAR_6[VAR_6VAR_3VAR_6].VAR_6typeVAR_6 == VAR_6aVAR_6.VAR_6typeVAR_6) {", "VAR_6VAR_4VAR_6 = VAR_6mov_default_parse_tableVAR_6[VAR_6VAR_3VAR_6].VAR_6VAR_4VAR_6;", "VAR_6breakVAR_6;", "}", "VAR_6ifVAR_6 (!VAR_6VAR_4VAR_6 && (VAR_6VAR_2VAR_6.VAR_6typeVAR_6 == VAR_6MKTAGVAR_6('VAR_6uVAR_6','VAR_6dVAR_6','VAR_6tVAR_6','VAR_6aVAR_6') ||\nVAR_6VAR_2VAR_6.VAR_6typeVAR_6 == VAR_6MKTAGVAR_6('VAR_6VAR_3VAR_6','VAR_6lVAR_6','VAR_6sVAR_6','VAR_6tVAR_6')))\nVAR_6VAR_4VAR_6 = VAR_6mov_read_udta_stringVAR_6;", "VAR_6ifVAR_6 (!VAR_6VAR_4VAR_6) {", "VAR_6avio_skipVAR_6(VAR_6VAR_1VAR_6, VAR_6aVAR_6.VAR_6sizeVAR_6);", "} VAR_6elseVAR_6 {", "VAR_6int64_tVAR_6 VAR_6start_posVAR_6 = VAR_6avio_tellVAR_6(VAR_6VAR_1VAR_6);", "VAR_6int64_tVAR_6 VAR_6leftVAR_6;", "VAR_6intVAR_6 VAR_6errVAR_6 = VAR_6VAR_4VAR_6(VAR_6VAR_0VAR_6, VAR_6VAR_1VAR_6, VAR_6aVAR_6);", "VAR_6ifVAR_6 (VAR_6errVAR_6 < VAR_60VAR_6)\nVAR_6returnVAR_6 VAR_6errVAR_6;", "VAR_6ifVAR_6 (VAR_6VAR_0VAR_6->VAR_6found_moovVAR_6 && VAR_6VAR_0VAR_6->VAR_6found_mdatVAR_6 &&\n(!VAR_6VAR_1VAR_6->VAR_6seekableVAR_6 || VAR_6start_posVAR_6 + VAR_6aVAR_6.VAR_6sizeVAR_6 == VAR_6avio_sizeVAR_6(VAR_6VAR_1VAR_6)))\nVAR_6returnVAR_6 VAR_60VAR_6;", "VAR_6leftVAR_6 = VAR_6aVAR_6.VAR_6sizeVAR_6 - VAR_6avio_tellVAR_6(VAR_6VAR_1VAR_6) + VAR_6start_posVAR_6;", "VAR_6ifVAR_6 (VAR_6leftVAR_6 > VAR_60VAR_6)\nVAR_6avio_skipVAR_6(VAR_6VAR_1VAR_6, VAR_6leftVAR_6);", "}", "VAR_6total_sizeVAR_6 += VAR_6aVAR_6.VAR_6sizeVAR_6;", "}", "VAR_6ifVAR_6 (VAR_6total_sizeVAR_6 < VAR_6VAR_2VAR_6.VAR_6sizeVAR_6 && VAR_6VAR_2VAR_6.VAR_6sizeVAR_6 < VAR_60x7ffffVAR_6)\nVAR_6avio_skipVAR_6(VAR_6VAR_1VAR_6, VAR_6VAR_2VAR_6.VAR_6sizeVAR_6 - VAR_6total_sizeVAR_6);", "VAR_6returnVAR_6 VAR_60VAR_6;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13, 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43, 45 ], [ 47 ], [ 49 ], [ 51, 53 ], [ 55 ], [ 57 ], [ 59, 61 ], [ 63 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 81, 83, 85 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101, 103 ], [ 105, 107, 109 ], [ 111 ], [ 113, 115 ], [ 117 ], [ 121 ], [ 123 ], [ 127, 129 ], [ 133 ], [ 135 ] ]
20,119
int check_intra_pred8x8_mode_emuedge(int mode, int mb_x, int mb_y) { switch (mode) { case DC_PRED8x8: return check_dc_pred8x8_mode(mode, mb_x, mb_y); case VERT_PRED8x8: return !mb_y ? DC_127_PRED8x8 : mode; case HOR_PRED8x8: return !mb_x ? DC_129_PRED8x8 : mode; case PLANE_PRED8x8: /* TM */ return check_tm_pred8x8_mode(mode, mb_x, mb_y); } return mode; }
true
FFmpeg
ac4b32df71bd932838043a4838b86d11e169707f
int check_intra_pred8x8_mode_emuedge(int mode, int mb_x, int mb_y) { switch (mode) { case DC_PRED8x8: return check_dc_pred8x8_mode(mode, mb_x, mb_y); case VERT_PRED8x8: return !mb_y ? DC_127_PRED8x8 : mode; case HOR_PRED8x8: return !mb_x ? DC_129_PRED8x8 : mode; case PLANE_PRED8x8: return check_tm_pred8x8_mode(mode, mb_x, mb_y); } return mode; }
{ "code": [ "int check_intra_pred8x8_mode_emuedge(int mode, int mb_x, int mb_y)", " return !mb_y ? DC_127_PRED8x8 : mode;", " return !mb_x ? DC_129_PRED8x8 : mode;", " return check_tm_pred8x8_mode(mode, mb_x, mb_y);" ], "line_no": [ 1, 13, 17, 21 ] }
int FUNC_0(int VAR_0, int VAR_1, int VAR_2) { switch (VAR_0) { case DC_PRED8x8: return check_dc_pred8x8_mode(VAR_0, VAR_1, VAR_2); case VERT_PRED8x8: return !VAR_2 ? DC_127_PRED8x8 : VAR_0; case HOR_PRED8x8: return !VAR_1 ? DC_129_PRED8x8 : VAR_0; case PLANE_PRED8x8: return check_tm_pred8x8_mode(VAR_0, VAR_1, VAR_2); } return VAR_0; }
[ "int FUNC_0(int VAR_0, int VAR_1, int VAR_2)\n{", "switch (VAR_0) {", "case DC_PRED8x8:\nreturn check_dc_pred8x8_mode(VAR_0, VAR_1, VAR_2);", "case VERT_PRED8x8:\nreturn !VAR_2 ? DC_127_PRED8x8 : VAR_0;", "case HOR_PRED8x8:\nreturn !VAR_1 ? DC_129_PRED8x8 : VAR_0;", "case PLANE_PRED8x8:\nreturn check_tm_pred8x8_mode(VAR_0, VAR_1, VAR_2);", "}", "return VAR_0;", "}" ]
[ 1, 0, 0, 1, 1, 1, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7, 9 ], [ 11, 13 ], [ 15, 17 ], [ 19, 21 ], [ 23 ], [ 25 ], [ 27 ] ]
20,120
static int jpeg_write_trailer(AVFormatContext *s1) { JpegContext *s = s1->priv_data; av_free(s); return 0; }
true
FFmpeg
0726b2d1ea4343698ff603cc32b824f5bce952c5
static int jpeg_write_trailer(AVFormatContext *s1) { JpegContext *s = s1->priv_data; av_free(s); return 0; }
{ "code": [ " JpegContext *s = s1->priv_data;", " av_free(s);", " JpegContext *s = s1->priv_data;", " av_free(s);" ], "line_no": [ 5, 7, 5, 7 ] }
static int FUNC_0(AVFormatContext *VAR_0) { JpegContext *s = VAR_0->priv_data; av_free(s); return 0; }
[ "static int FUNC_0(AVFormatContext *VAR_0)\n{", "JpegContext *s = VAR_0->priv_data;", "av_free(s);", "return 0;", "}" ]
[ 0, 1, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ] ]
20,121
static int ljpeg_decode_yuv_scan(MJpegDecodeContext *s, int predictor, int point_transform){ int i, mb_x, mb_y; const int nb_components=3; for(mb_y = 0; mb_y < s->mb_height; mb_y++) { for(mb_x = 0; mb_x < s->mb_width; mb_x++) { if (s->restart_interval && !s->restart_count) s->restart_count = s->restart_interval; if(mb_x==0 || mb_y==0 || s->interlaced){ for(i=0;i<nb_components;i++) { uint8_t *ptr; int n, h, v, x, y, c, j, linesize; n = s->nb_blocks[i]; c = s->comp_index[i]; h = s->h_scount[i]; v = s->v_scount[i]; x = 0; y = 0; linesize= s->linesize[c]; for(j=0; j<n; j++) { int pred; ptr = s->picture.data[c] + (linesize * (v * mb_y + y)) + (h * mb_x + x); //FIXME optimize this crap if(y==0 && mb_y==0){ if(x==0 && mb_x==0){ pred= 128 << point_transform; }else{ pred= ptr[-1]; } }else{ if(x==0 && mb_x==0){ pred= ptr[-linesize]; }else{ PREDICT(pred, ptr[-linesize-1], ptr[-linesize], ptr[-1], predictor); } } if (s->interlaced && s->bottom_field) ptr += linesize >> 1; *ptr= pred + (mjpeg_decode_dc(s, s->dc_index[i]) << point_transform); if (++x == h) { x = 0; y++; } } } }else{ for(i=0;i<nb_components;i++) { uint8_t *ptr; int n, h, v, x, y, c, j, linesize; n = s->nb_blocks[i]; c = s->comp_index[i]; h = s->h_scount[i]; v = s->v_scount[i]; x = 0; y = 0; linesize= s->linesize[c]; for(j=0; j<n; j++) { int pred; ptr = s->picture.data[c] + (linesize * (v * mb_y + y)) + (h * mb_x + x); //FIXME optimize this crap PREDICT(pred, ptr[-linesize-1], ptr[-linesize], ptr[-1], predictor); *ptr= pred + (mjpeg_decode_dc(s, s->dc_index[i]) << point_transform); if (++x == h) { x = 0; y++; } } } } if (s->restart_interval && !--s->restart_count) { align_get_bits(&s->gb); skip_bits(&s->gb, 16); /* skip RSTn */ } } } return 0; }
false
FFmpeg
484b1cdd5303771447e15d0067a2034b0c17fdc8
static int ljpeg_decode_yuv_scan(MJpegDecodeContext *s, int predictor, int point_transform){ int i, mb_x, mb_y; const int nb_components=3; for(mb_y = 0; mb_y < s->mb_height; mb_y++) { for(mb_x = 0; mb_x < s->mb_width; mb_x++) { if (s->restart_interval && !s->restart_count) s->restart_count = s->restart_interval; if(mb_x==0 || mb_y==0 || s->interlaced){ for(i=0;i<nb_components;i++) { uint8_t *ptr; int n, h, v, x, y, c, j, linesize; n = s->nb_blocks[i]; c = s->comp_index[i]; h = s->h_scount[i]; v = s->v_scount[i]; x = 0; y = 0; linesize= s->linesize[c]; for(j=0; j<n; j++) { int pred; ptr = s->picture.data[c] + (linesize * (v * mb_y + y)) + (h * mb_x + x); if(y==0 && mb_y==0){ if(x==0 && mb_x==0){ pred= 128 << point_transform; }else{ pred= ptr[-1]; } }else{ if(x==0 && mb_x==0){ pred= ptr[-linesize]; }else{ PREDICT(pred, ptr[-linesize-1], ptr[-linesize], ptr[-1], predictor); } } if (s->interlaced && s->bottom_field) ptr += linesize >> 1; *ptr= pred + (mjpeg_decode_dc(s, s->dc_index[i]) << point_transform); if (++x == h) { x = 0; y++; } } } }else{ for(i=0;i<nb_components;i++) { uint8_t *ptr; int n, h, v, x, y, c, j, linesize; n = s->nb_blocks[i]; c = s->comp_index[i]; h = s->h_scount[i]; v = s->v_scount[i]; x = 0; y = 0; linesize= s->linesize[c]; for(j=0; j<n; j++) { int pred; ptr = s->picture.data[c] + (linesize * (v * mb_y + y)) + (h * mb_x + x); PREDICT(pred, ptr[-linesize-1], ptr[-linesize], ptr[-1], predictor); *ptr= pred + (mjpeg_decode_dc(s, s->dc_index[i]) << point_transform); if (++x == h) { x = 0; y++; } } } } if (s->restart_interval && !--s->restart_count) { align_get_bits(&s->gb); skip_bits(&s->gb, 16); } } } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(MJpegDecodeContext *VAR_0, int VAR_1, int VAR_2){ int VAR_3, VAR_4, VAR_5; const int VAR_6=3; for(VAR_5 = 0; VAR_5 < VAR_0->mb_height; VAR_5++) { for(VAR_4 = 0; VAR_4 < VAR_0->mb_width; VAR_4++) { if (VAR_0->restart_interval && !VAR_0->restart_count) VAR_0->restart_count = VAR_0->restart_interval; if(VAR_4==0 || VAR_5==0 || VAR_0->interlaced){ for(VAR_3=0;VAR_3<VAR_6;VAR_3++) { uint8_t *ptr; int n, h, v, x, y, c, j, linesize; n = VAR_0->nb_blocks[VAR_3]; c = VAR_0->comp_index[VAR_3]; h = VAR_0->h_scount[VAR_3]; v = VAR_0->v_scount[VAR_3]; x = 0; y = 0; linesize= VAR_0->linesize[c]; for(j=0; j<n; j++) { int pred; ptr = VAR_0->picture.data[c] + (linesize * (v * VAR_5 + y)) + (h * VAR_4 + x); if(y==0 && VAR_5==0){ if(x==0 && VAR_4==0){ pred= 128 << VAR_2; }else{ pred= ptr[-1]; } }else{ if(x==0 && VAR_4==0){ pred= ptr[-linesize]; }else{ PREDICT(pred, ptr[-linesize-1], ptr[-linesize], ptr[-1], VAR_1); } } if (VAR_0->interlaced && VAR_0->bottom_field) ptr += linesize >> 1; *ptr= pred + (mjpeg_decode_dc(VAR_0, VAR_0->dc_index[VAR_3]) << VAR_2); if (++x == h) { x = 0; y++; } } } }else{ for(VAR_3=0;VAR_3<VAR_6;VAR_3++) { uint8_t *ptr; int n, h, v, x, y, c, j, linesize; n = VAR_0->nb_blocks[VAR_3]; c = VAR_0->comp_index[VAR_3]; h = VAR_0->h_scount[VAR_3]; v = VAR_0->v_scount[VAR_3]; x = 0; y = 0; linesize= VAR_0->linesize[c]; for(j=0; j<n; j++) { int pred; ptr = VAR_0->picture.data[c] + (linesize * (v * VAR_5 + y)) + (h * VAR_4 + x); PREDICT(pred, ptr[-linesize-1], ptr[-linesize], ptr[-1], VAR_1); *ptr= pred + (mjpeg_decode_dc(VAR_0, VAR_0->dc_index[VAR_3]) << VAR_2); if (++x == h) { x = 0; y++; } } } } if (VAR_0->restart_interval && !--VAR_0->restart_count) { align_get_bits(&VAR_0->gb); skip_bits(&VAR_0->gb, 16); } } } return 0; }
[ "static int FUNC_0(MJpegDecodeContext *VAR_0, int VAR_1, int VAR_2){", "int VAR_3, VAR_4, VAR_5;", "const int VAR_6=3;", "for(VAR_5 = 0; VAR_5 < VAR_0->mb_height; VAR_5++) {", "for(VAR_4 = 0; VAR_4 < VAR_0->mb_width; VAR_4++) {", "if (VAR_0->restart_interval && !VAR_0->restart_count)\nVAR_0->restart_count = VAR_0->restart_interval;", "if(VAR_4==0 || VAR_5==0 || VAR_0->interlaced){", "for(VAR_3=0;VAR_3<VAR_6;VAR_3++) {", "uint8_t *ptr;", "int n, h, v, x, y, c, j, linesize;", "n = VAR_0->nb_blocks[VAR_3];", "c = VAR_0->comp_index[VAR_3];", "h = VAR_0->h_scount[VAR_3];", "v = VAR_0->v_scount[VAR_3];", "x = 0;", "y = 0;", "linesize= VAR_0->linesize[c];", "for(j=0; j<n; j++) {", "int pred;", "ptr = VAR_0->picture.data[c] + (linesize * (v * VAR_5 + y)) + (h * VAR_4 + x);", "if(y==0 && VAR_5==0){", "if(x==0 && VAR_4==0){", "pred= 128 << VAR_2;", "}else{", "pred= ptr[-1];", "}", "}else{", "if(x==0 && VAR_4==0){", "pred= ptr[-linesize];", "}else{", "PREDICT(pred, ptr[-linesize-1], ptr[-linesize], ptr[-1], VAR_1);", "}", "}", "if (VAR_0->interlaced && VAR_0->bottom_field)\nptr += linesize >> 1;", "*ptr= pred + (mjpeg_decode_dc(VAR_0, VAR_0->dc_index[VAR_3]) << VAR_2);", "if (++x == h) {", "x = 0;", "y++;", "}", "}", "}", "}else{", "for(VAR_3=0;VAR_3<VAR_6;VAR_3++) {", "uint8_t *ptr;", "int n, h, v, x, y, c, j, linesize;", "n = VAR_0->nb_blocks[VAR_3];", "c = VAR_0->comp_index[VAR_3];", "h = VAR_0->h_scount[VAR_3];", "v = VAR_0->v_scount[VAR_3];", "x = 0;", "y = 0;", "linesize= VAR_0->linesize[c];", "for(j=0; j<n; j++) {", "int pred;", "ptr = VAR_0->picture.data[c] + (linesize * (v * VAR_5 + y)) + (h * VAR_4 + x);", "PREDICT(pred, ptr[-linesize-1], ptr[-linesize], ptr[-1], VAR_1);", "*ptr= pred + (mjpeg_decode_dc(VAR_0, VAR_0->dc_index[VAR_3]) << VAR_2);", "if (++x == h) {", "x = 0;", "y++;", "}", "}", "}", "}", "if (VAR_0->restart_interval && !--VAR_0->restart_count) {", "align_get_bits(&VAR_0->gb);", "skip_bits(&VAR_0->gb, 16);", "}", "}", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1 ], [ 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13, 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 79, 81 ], [ 83 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 123 ], [ 125 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ] ]
20,122
static void filter_mb_mbaff_edgecv( H264Context *h, uint8_t *pix, int stride, const int16_t bS[7], int bsi, int qp ) { const int qp_bd_offset = 6 * (h->sps.bit_depth_luma - 8); int index_a = qp - qp_bd_offset + h->slice_alpha_c0_offset; int alpha = alpha_table[index_a]; int beta = beta_table[qp - qp_bd_offset + h->slice_beta_offset]; if (alpha ==0 || beta == 0) return; if( bS[0] < 4 ) { int8_t tc[4]; tc[0] = tc0_table[index_a][bS[0*bsi]] + 1; tc[1] = tc0_table[index_a][bS[1*bsi]] + 1; tc[2] = tc0_table[index_a][bS[2*bsi]] + 1; tc[3] = tc0_table[index_a][bS[3*bsi]] + 1; h->h264dsp.h264_h_loop_filter_chroma_mbaff(pix, stride, alpha, beta, tc); } else { h->h264dsp.h264_h_loop_filter_chroma_mbaff_intra(pix, stride, alpha, beta); } }
false
FFmpeg
a4f6be86d67ae30d494fbe8a470bc32b715d75a9
static void filter_mb_mbaff_edgecv( H264Context *h, uint8_t *pix, int stride, const int16_t bS[7], int bsi, int qp ) { const int qp_bd_offset = 6 * (h->sps.bit_depth_luma - 8); int index_a = qp - qp_bd_offset + h->slice_alpha_c0_offset; int alpha = alpha_table[index_a]; int beta = beta_table[qp - qp_bd_offset + h->slice_beta_offset]; if (alpha ==0 || beta == 0) return; if( bS[0] < 4 ) { int8_t tc[4]; tc[0] = tc0_table[index_a][bS[0*bsi]] + 1; tc[1] = tc0_table[index_a][bS[1*bsi]] + 1; tc[2] = tc0_table[index_a][bS[2*bsi]] + 1; tc[3] = tc0_table[index_a][bS[3*bsi]] + 1; h->h264dsp.h264_h_loop_filter_chroma_mbaff(pix, stride, alpha, beta, tc); } else { h->h264dsp.h264_h_loop_filter_chroma_mbaff_intra(pix, stride, alpha, beta); } }
{ "code": [], "line_no": [] }
static void FUNC_0( H264Context *VAR_0, uint8_t *VAR_1, int VAR_2, const int16_t VAR_3[7], int VAR_4, int VAR_5 ) { const int VAR_6 = 6 * (VAR_0->sps.bit_depth_luma - 8); int VAR_7 = VAR_5 - VAR_6 + VAR_0->slice_alpha_c0_offset; int VAR_8 = alpha_table[VAR_7]; int VAR_9 = beta_table[VAR_5 - VAR_6 + VAR_0->slice_beta_offset]; if (VAR_8 ==0 || VAR_9 == 0) return; if( VAR_3[0] < 4 ) { int8_t tc[4]; tc[0] = tc0_table[VAR_7][VAR_3[0*VAR_4]] + 1; tc[1] = tc0_table[VAR_7][VAR_3[1*VAR_4]] + 1; tc[2] = tc0_table[VAR_7][VAR_3[2*VAR_4]] + 1; tc[3] = tc0_table[VAR_7][VAR_3[3*VAR_4]] + 1; VAR_0->h264dsp.h264_h_loop_filter_chroma_mbaff(VAR_1, VAR_2, VAR_8, VAR_9, tc); } else { VAR_0->h264dsp.h264_h_loop_filter_chroma_mbaff_intra(VAR_1, VAR_2, VAR_8, VAR_9); } }
[ "static void FUNC_0( H264Context *VAR_0, uint8_t *VAR_1, int VAR_2, const int16_t VAR_3[7], int VAR_4, int VAR_5 ) {", "const int VAR_6 = 6 * (VAR_0->sps.bit_depth_luma - 8);", "int VAR_7 = VAR_5 - VAR_6 + VAR_0->slice_alpha_c0_offset;", "int VAR_8 = alpha_table[VAR_7];", "int VAR_9 = beta_table[VAR_5 - VAR_6 + VAR_0->slice_beta_offset];", "if (VAR_8 ==0 || VAR_9 == 0) return;", "if( VAR_3[0] < 4 ) {", "int8_t tc[4];", "tc[0] = tc0_table[VAR_7][VAR_3[0*VAR_4]] + 1;", "tc[1] = tc0_table[VAR_7][VAR_3[1*VAR_4]] + 1;", "tc[2] = tc0_table[VAR_7][VAR_3[2*VAR_4]] + 1;", "tc[3] = tc0_table[VAR_7][VAR_3[3*VAR_4]] + 1;", "VAR_0->h264dsp.h264_h_loop_filter_chroma_mbaff(VAR_1, VAR_2, VAR_8, VAR_9, tc);", "} else {", "VAR_0->h264dsp.h264_h_loop_filter_chroma_mbaff_intra(VAR_1, VAR_2, VAR_8, VAR_9);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1 ], [ 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ] ]