label
int64
0
1
func
stringlengths
21
96.3k
0
static int ehci_state_waitlisthead(EHCIState *ehci, int async){ EHCIqh qh; int i = 0; int again = 0; uint32_t entry = ehci->asynclistaddr; /* set reclamation flag at start event (4.8.6) */ if (async) { ehci_set_usbsts(ehci, USBSTS_REC); } ehci_queues_rip_unused(ehci, async, 0); /* Find the head of the list (4.9.1.1) */...
0
static void gen_rdhwr(DisasContext *ctx, int rt, int rd){ TCGv t0;#if !defined(CONFIG_USER_ONLY) /* The Linux kernel will emulate rdhwr if it's not supported natively. Therefore only check the ISA in system mode. */ check_insn(ctx, ISA_MIPS32R2);#endif t0 = tcg_temp_new(); switch (rd) { case 0: gen_helper_rdhwr_cpunum(...
0
Aml *aml_shiftright(Aml *arg1, Aml *count){ Aml *var = aml_opcode(0x7A /* ShiftRightOp */); aml_append(var, arg1); aml_append(var, count); build_append_byte(var->buf, 0x00); /* NullNameOp */ return var;}
0
static ssize_t handle_aiocb_write_zeroes(RawPosixAIOData *aiocb){ int ret = -EOPNOTSUPP; BDRVRawState *s = aiocb->bs->opaque; if (s->has_write_zeroes == 0) { return -ENOTSUP; } if (aiocb->aio_type & QEMU_AIO_BLKDEV) {#ifdef BLKZEROOUT do { uint64_t range[2] = { aiocb->aio_offset, aiocb->aio_nbytes }; if (ioctl(aiocb->a...
0
int bdrv_open(BlockDriverState *bs, const char *filename, QDict *options, int flags, BlockDriver *drv, Error **errp){ int ret; /* TODO: extra byte is a hack to ensure MAX_PATH space on Windows. */ char tmp_filename[PATH_MAX + 1]; BlockDriverState *file = NULL; QDict *file_options = NULL; const char *drvname; Error *loc...
0
static void filter(struct vf_priv_s *p, uint8_t *dst[3], uint8_t *src[3], int dst_stride[3], int src_stride[3], int width, int height){ int x, y, i; for(i=0; i<3; i++){ p->frame->data[i]= src[i]; p->frame->linesize[i]= src_stride[i]; } p->avctx_enc->me_cmp= p->avctx_enc->me_sub_cmp= FF_CMP_SAD /*| (p->parity ? FF_CMP_O...
1
static void test_qga_config(gconstpointer data){ GError *error = NULL; char *cwd, *cmd, *out, *err, *str, **strv, **argv = NULL; char *env[2]; int status; gsize n; GKeyFile *kf; cwd = g_get_current_dir(); cmd = g_strdup_printf("%s%cqemu-ga -D", cwd, G_DIR_SEPARATOR); g_shell_parse_argv(cmd, NULL, &argv, &error); g_asse...
1
static int apc_read_packet(AVFormatContext *s, AVPacket *pkt){ if (av_get_packet(s->pb, pkt, MAX_READ_SIZE) <= 0) return AVERROR(EIO); pkt->stream_index = 0; return 0;}
0
void helper_fitoq(CPUSPARCState *env, int32_t src){ /* No possible exceptions converting int to long double. */ QT0 = int32_to_float128(src, &env->fp_status);}
0
int gdbserver_start(const char *device){ GDBState *s; char gdbstub_device_name[128]; CharDriverState *chr = NULL; CharDriverState *mon_chr; if (!device) return -1; if (strcmp(device, "none") != 0) { if (strstart(device, "tcp:", NULL)) { /* enforce required TCP attributes */ snprintf(gdbstub_device_name, sizeof(gdbstub_...
0
net_checksum_add_iov(const struct iovec *iov, const unsigned int iov_cnt, uint32_t iov_off, uint32_t size){ size_t iovec_off, buf_off; unsigned int i; uint32_t res = 0; uint32_t seq = 0; iovec_off = 0; buf_off = 0; for (i = 0; i < iov_cnt && size; i++) { if (iov_off < (iovec_off + iov[i].iov_len)) { size_t len = MIN((i...
0
static inline int get_phys_addr(CPUARMState *env, target_ulong address, int access_type, int is_user, hwaddr *phys_ptr, int *prot, target_ulong *page_size){ /* This is not entirely correct as get_phys_addr() can also be called * from ats_write() for an address translation of a specific regime. */ uint32_t sctlr = A32_B...
0
DriveInfo *drive_init(QemuOpts *opts, int default_to_scsi, int *fatal_error){ const char *buf; const char *file = NULL; char devname[128]; const char *serial; const char *mediastr = ""; BlockInterfaceType type; enum { MEDIA_DISK, MEDIA_CDROM } media; int bus_id, unit_id; int cyls, heads, secs, translation; BlockDriver ...
0
static void test_visitor_in_struct(TestInputVisitorData *data, const void *unused){ TestStruct *p = NULL; Visitor *v; v = visitor_input_test_init(data, "{ 'integer': -42, 'boolean': true, 'string': 'foo' }"); visit_type_TestStruct(v, NULL, &p, &error_abort); g_assert_cmpint(p->integer, ==, -42); g_assert(p->boolean == ...
0
static int msix_add_config(struct PCIDevice *pdev, unsigned short nentries, unsigned bar_nr, unsigned bar_size){ int config_offset; uint8_t *config; uint32_t new_size; if (nentries < 1 || nentries > PCI_MSIX_FLAGS_QSIZE + 1) return -EINVAL; if (bar_size > 0x80000000) return -ENOSPC; /* Add space for MSI-X structures */...
0
void qmp_memsave(int64_t addr, int64_t size, const char *filename, bool has_cpu, int64_t cpu_index, Error **errp){ FILE *f; uint32_t l; CPUState *cpu; uint8_t buf[1024]; if (!has_cpu) { cpu_index = 0; } cpu = qemu_get_cpu(cpu_index); if (cpu == NULL) { error_set(errp, QERR_INVALID_PARAMETER_VALUE, "cpu-index", "a CPU n...
0
static void xen_platform_class_init(ObjectClass *klass, void *data){ DeviceClass *dc = DEVICE_CLASS(klass); PCIDeviceClass *k = PCI_DEVICE_CLASS(klass); k->init = xen_platform_initfn; k->vendor_id = PCI_VENDOR_ID_XEN; k->device_id = PCI_DEVICE_ID_XEN_PLATFORM; k->class_id = PCI_CLASS_OTHERS << 8 | 0x80; k->subsystem_ve...
0
int net_init_slirp(QemuOpts *opts, Monitor *mon, const char *name, VLANState *vlan){ struct slirp_config_str *config; const char *vhost; const char *vhostname; const char *vdhcp_start; const char *vnamesrv; const char *tftp_export; const char *bootfile; const char *smb_export; const char *vsmbsrv; char *vnet = NULL; in...
0
static QOSState *qvirtio_9p_start(void){ const char *cmd = "-fsdev local,id=fsdev0,security_model=none,path=%s " "-device virtio-9p-pci,fsdev=fsdev0,mount_tag=%s"; test_share = g_strdup("/tmp/qtest.XXXXXX"); g_assert_nonnull(mkdtemp(test_share)); return qtest_pc_boot(cmd, test_share, mount_tag);}
1
static void test_read_without_media(void){ uint8_t ret; ret = send_read_command(); g_assert(ret == 0);}
1
static void set_acpi_power_state(IPMIBmcSim *ibs, uint8_t *cmd, unsigned int cmd_len, uint8_t *rsp, unsigned int *rsp_len, unsigned int max_rsp_len){ IPMI_CHECK_CMD_LEN(4); ibs->acpi_power_state[0] = cmd[2]; ibs->acpi_power_state[1] = cmd[3];}
1
static void usb_uas_unrealize(USBDevice *dev, Error **errp){ UASDevice *uas = USB_UAS(dev); qemu_bh_delete(uas->status_bh);}
0
static int sdp_parse(AVFormatContext *s, const char *content){ const char *p; int letter; /* Some SDP lines, particularly for Realmedia or ASF RTSP streams, * contain long SDP lines containing complete ASF Headers (several * kB) or arrays of MDPR (RM stream descriptor) headers plus * "rulebooks" describing their proper...
1
static void flush_change(H264Context *h){ h->outputed_poc = h->next_outputed_poc = INT_MIN; h->prev_interlaced_frame = 1; idr(h); h->prev_frame_num = -1; if (h->s.current_picture_ptr) h->s.current_picture_ptr->f.reference = 0; h->s.first_field = 0; memset(h->ref_list[0], 0, sizeof(h->ref_list[0])); memset(h->ref_list[1...
1
int qcrypto_cipher_decrypt(QCryptoCipher *cipher, const void *in, void *out, size_t len, Error **errp){ QCryptoCipherNettle *ctx = cipher->opaque; switch (cipher->mode) { case QCRYPTO_CIPHER_MODE_ECB: ctx->alg_decrypt(ctx->ctx_decrypt ? ctx->ctx_decrypt : ctx->ctx_encrypt, len, out, in); break; case QCRYPTO_CIPHER_MODE...
1
static void ahci_migrate(AHCIQState *from, AHCIQState *to, const char *uri){ QOSState *tmp = to->parent; QPCIDevice *dev = to->dev; char *uri_local = NULL; if (uri == NULL) { uri_local = g_strdup_printf("%s%s", "unix:", mig_socket); uri = uri_local; } /* context will be 'to' after completion. */ migrate(from->parent, t...
1
static int kvm_virtio_pci_vq_vector_unmask(VirtIOPCIProxy *proxy, unsigned int queue_no, unsigned int vector, MSIMessage msg){ VirtQueue *vq = virtio_get_queue(proxy->vdev, queue_no); EventNotifier *n = virtio_queue_get_guest_notifier(vq); VirtIOIRQFD *irqfd = &proxy->vector_irqfd[vector]; int ret; if (irqfd->msg.data ...
1
static int vvfat_open(BlockDriverState *bs, const char* dirname, int flags){ BDRVVVFATState *s = bs->opaque; int floppy = 0; int i;#ifdef DEBUG vvv = s;#endifDLOG(if (stderr == NULL) { stderr = fopen("vvfat.log", "a"); setbuf(stderr, NULL);}) s->bs = bs; s->fat_type=16; /* LATER TODO: if FAT32, adjust */ s->sectors_per...
1
VirtIODevice *virtio_scsi_init(DeviceState *dev, VirtIOSCSIConf *proxyconf){ VirtIOSCSI *s; static int virtio_scsi_id; size_t sz; int i; sz = sizeof(VirtIOSCSI) + proxyconf->num_queues * sizeof(VirtQueue *); s = (VirtIOSCSI *)virtio_common_init("virtio-scsi", VIRTIO_ID_SCSI, sizeof(VirtIOSCSIConfig), sz); s->qdev = dev...
1
static ResampleContext *resample_init(ResampleContext *c, int out_rate, int in_rate, int filter_size, int phase_shift, int linear, double cutoff0, enum AVSampleFormat format, enum SwrFilterType filter_type, int kaiser_beta, double precision, int cheby){ double cutoff = cutoff0? cutoff0 : 0.97; double factor= FFMIN(out_...
1
static void test_properties(const char *path){ char *child_path; QDict *response, *tuple; QList *list; QListEntry *entry; g_test_message("Obtaining properties of %s", path); response = qmp("{ 'execute': 'qom-list'," " 'arguments': { 'path': '%s' } }", path); g_assert(response); g_assert(qdict_haskey(response, "return")...
1
static int decode_packet(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket* avpkt){ WmallDecodeCtx *s = avctx->priv_data; GetBitContext* gb = &s->pgb; const uint8_t* buf = avpkt->data; int buf_size = avpkt->size; int num_bits_prev_frame, packet_sequence_number, spliced_packet; s->frame.nb_samples = 0; if ...
1
static void mpegts_write_pes(AVFormatContext *s, AVStream *st, const uint8_t *payload, int payload_size, int64_t pts, int64_t dts, int key){ MpegTSWriteStream *ts_st = st->priv_data; MpegTSWrite *ts = s->priv_data; uint8_t buf[TS_PACKET_SIZE]; uint8_t *q; int val, is_start, len, header_len, write_pcr, is_dvb_subtitle, ...
0
static void RENAME(postProcess)(const uint8_t src[], int srcStride, uint8_t dst[], int dstStride, int width, int height, const QP_STORE_T QPs[], int QPStride, int isColor, PPContext *c2){ DECLARE_ALIGNED(8, PPContext, c)= *c2; //copy to stack for faster access int x,y;#ifdef TEMPLATE_PP_TIME_MODE const int mode= TEMPLA...
1
static char *choose_pix_fmts(OutputStream *ost){ if (ost->keep_pix_fmt) { if (ost->filter) avfilter_graph_set_auto_convert(ost->filter->graph->graph, AVFILTER_AUTO_CONVERT_NONE); if (ost->st->codec->pix_fmt == PIX_FMT_NONE) return NULL; return av_strdup(av_get_pix_fmt_name(ost->st->codec->pix_fmt)); } if (ost->st->code...
0
static int xiph_handle_packet(AVFormatContext *ctx, PayloadContext *data, AVStream *st, AVPacket *pkt, uint32_t *timestamp, const uint8_t *buf, int len, uint16_t seq, int flags){ int ident, fragmented, tdt, num_pkts, pkt_len; if (!buf) { if (!data->split_buf || data->split_pos + 2 > data->split_buf_len || data->split_p...
0
static int check_image_pointers(uint8_t *data[4], enum AVPixelFormat pix_fmt, const int linesizes[4]){ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt); int i; for (i = 0; i < 4; i++) { int plane = desc->comp[i].plane; if (!data[plane] || !linesizes[plane]) return 0; } return 1;}
0
static void vc1_mc_4mv_luma(VC1Context *v, int n, int dir){ MpegEncContext *s = &v->s; DSPContext *dsp = &v->s.dsp; uint8_t *srcY; int dxy, mx, my, src_x, src_y; int off; int fieldmv = (v->fcm == ILACE_FRAME) ? v->blk_mv_type[s->block_index[n]] : 0; int v_edge_pos = s->v_edge_pos >> v->field_mode; if (!v->field_mode &&...
0
int coroutine_fn blk_co_pwritev(BlockBackend *blk, int64_t offset, unsigned int bytes, QEMUIOVector *qiov, BdrvRequestFlags flags){ int ret; trace_blk_co_pwritev(blk, blk_bs(blk), offset, bytes, flags); ret = blk_check_byte_request(blk, offset, bytes); if (ret < 0) { return ret; } /* throttling disk I/O */ if (blk->pub...
0
void monitor_protocol_event(MonitorEvent event, QObject *data){ QDict *qmp; const char *event_name; Monitor *mon; assert(event < QEVENT_MAX); switch (event) { case QEVENT_DEBUG: event_name = "DEBUG"; break; case QEVENT_SHUTDOWN: event_name = "SHUTDOWN"; break; case QEVENT_RESET: event_name = "RESET"; break; case QEVENT...
0
static int ppce500_prep_device_tree(MachineState *machine, PPCE500Params *params, hwaddr addr, hwaddr initrd_base, hwaddr initrd_size){ DeviceTreeParams *p = g_new(DeviceTreeParams, 1); p->machine = machine; p->params = *params; p->addr = addr; p->initrd_base = initrd_base; p->initrd_size = initrd_size; qemu_register_r...
0
int bdrv_ioctl(BlockDriverState *bs, unsigned long int req, void *buf){ BlockDriver *drv = bs->drv; if (drv && drv->bdrv_ioctl) return drv->bdrv_ioctl(bs, req, buf); return -ENOTSUP;}
0
void tb_invalidate_phys_addr(target_phys_addr_t addr){ ram_addr_t ram_addr; MemoryRegionSection *section; section = phys_page_find(addr >> TARGET_PAGE_BITS); if (!(memory_region_is_ram(section->mr) || (section->mr->rom_device && section->mr->readable))) { return; } ram_addr = (memory_region_get_ram_addr(section->mr) & ...
0
static void scsi_generic_realize(SCSIDevice *s, Error **errp){ int rc; int sg_version; struct sg_scsi_id scsiid; if (!s->conf.bs) { error_setg(errp, "drive property not set"); return; } if (bdrv_get_on_error(s->conf.bs, 0) != BLOCKDEV_ON_ERROR_ENOSPC) { error_setg(errp, "Device doesn't support drive option werror"); re...
0
static void pool_release_buffer(void *opaque, uint8_t *data){ BufferPoolEntry *buf = opaque; AVBufferPool *pool = buf->pool; if(CONFIG_MEMORY_POISONING) memset(buf->data, 0x2a, pool->size); add_to_pool(buf); if (!avpriv_atomic_int_add_and_fetch(&pool->refcount, -1)) buffer_pool_free(pool);}
0
static void dec_load(DisasContext *dc){ TCGv t, *addr; unsigned int size; size = 1 << (dc->opcode & 3); LOG_DIS("l %x %d\n", dc->opcode, size); t_sync_flags(dc); addr = compute_ldst_addr(dc, &t); /* If we get a fault on a dslot, the jmpstate better be in sync. */ sync_jmpstate(dc); /* Verify alignment if needed. */ if ...
0
void ich9_lpc_pm_init(PCIDevice *lpc_pci, bool smm_enabled){ ICH9LPCState *lpc = ICH9_LPC_DEVICE(lpc_pci); qemu_irq sci_irq; sci_irq = qemu_allocate_irq(ich9_set_sci, lpc, 0); ich9_pm_init(lpc_pci, &lpc->pm, smm_enabled, sci_irq); ich9_lpc_reset(&lpc->d.qdev);}
0
uint64_t helper_fctiw (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...
0
static int ppc_hash64_pte_prot(PowerPCCPU *cpu, ppc_slb_t *slb, ppc_hash_pte64_t pte){ CPUPPCState *env = &cpu->env; unsigned pp, key; /* Some pp bit combinations have undefined behaviour, so default * to no access in those cases */ int prot = 0; key = !!(msr_pr ? (slb->vsid & SLB_VSID_KP) : (slb->vsid & SLB_VSID_KS));...
0
static void exynos4210_mct_write(void *opaque, target_phys_addr_t offset, uint64_t value, unsigned size){ Exynos4210MCTState *s = (Exynos4210MCTState *)opaque; int index; /* index in buffer which represents register set */ int shift; int lt_i; uint64_t new_frc; uint32_t i; uint32_t old_val;#ifdef DEBUG_MCT static uint3...
0
static int no_init_in (HWVoiceIn *hw, audsettings_t *as){ audio_pcm_init_info (&hw->info, as); hw->samples = 1024; return 0;}
0
uint32_t HELPER(stfle)(CPUS390XState *env, uint64_t addr){ uint64_t words[MAX_STFL_WORDS]; unsigned count_m1 = env->regs[0] & 0xff; unsigned max_m1 = do_stfle(env, words); unsigned i; for (i = 0; i <= count_m1; ++i) { cpu_stq_data(env, addr + 8 * i, words[i]); } env->regs[0] = deposit64(env->regs[0], 0, 8, max_m1); ret...
0
static void pxa2xx_fir_write(void *opaque, hwaddr addr, uint64_t value64, unsigned size){ PXA2xxFIrState *s = (PXA2xxFIrState *) opaque; uint32_t value = value64; uint8_t ch; switch (addr) { case ICCR0: s->control[0] = value; if (!(value & (1 << 4)))/* RXE */ s->rx_len = s->rx_start = 0; if (!(value & (1 << 3))) { /* T...
0
static void disas_thumb_insn(CPUARMState *env, DisasContext *s){ uint32_t val, insn, op, rm, rn, rd, shift, cond; int32_t offset; int i; TCGv_i32 tmp; TCGv_i32 tmp2; TCGv_i32 addr; if (s->condexec_mask) { cond = s->condexec_cond; if (cond != 0x0e) { /* Skip conditional when condition is AL. */ s->condlabel = gen_new_la...