Projectname
large_stringclasses
15 values
Filepath
large_stringlengths
4
106
Function
large_stringlengths
11
3.45k
Label
list
qemu
hw/net/virtio-net.c
static void vmxnet3_net_init(VMXNET3State *s) { DeviceState *d = DEVICE(s); VMW_CBPRN("vmxnet3_net_init called..."); qemu_macaddr_default_if_unset(&s->conf.macaddr); /* Windows guest will query the address that was set on init */ memcpy(&s->perm_mac.a, &s->conf.macaddr.a, sizeof(s->perm_mac.a)); s->m...
[ 1, 0 ]
qemu
hw/scsi/virtio-scsi.c
static void virtio_scsi_bad_req(void) { error_report("wrong size for virtio-scsi headers"); exit(1); }
[ 1, 0 ]
qemu
hw/openpic.c
static void IRQ_check(OpenPICState *opp, IRQ_queue_t *q) { int next, i; int priority; next = -1; priority = -1; if (!q->pending) { /* IRQ bitmap is empty */ goto out; } for (i = 0; i < opp->max_irq; i++) { if (IRQ_testbit(q, i)) { DPRINTF("IRQ_check: irq %d set ipvp_pr=%d pr=%...
[ 1, 0 ]
FFmpeg
libavfilter/af_compand.c
static double get_volume(CompandContext *s, double in_lin) { CompandSegment *cs; double in_log, out_log; int i; if (in_lin < s->in_min_lin) return s->out_min_lin; in_log = log(in_lin); for (i = 1;; i++) if (in_log <= s->segments[i + 1].x) break; cs = &s->segments[i]; in_log -= ...
[ 1, 0 ]
qemu
tests/check-qjson.c
static void unterminated_literal(void) { QObject *obj = qobject_from_json("nul", NULL); g_assert(obj == NULL); }
[ 1, 0 ]
qemu
docs/tracing.txt
static void flush_trace_file(void) { /* If the trace file is not open yet, open it now */ if (!trace_fp) { trace_fp = fopen(trace_file_name, "w"); if (!trace_fp) { /* Avoid repeatedly trying to open file on failure */ trace_file_enabled = false; return; } write_header(trac...
[ 1, 0 ]
qemu
hw/s390-virtio-bus.c
static void virtio_net_handle_tx(VirtIODevice *vdev, VirtQueue *vq) { VirtIONet *n = to_virtio_net(vdev); if (n->tx_waiting) { virtio_queue_set_notification(vq, 1); qemu_del_timer(n->tx_timer); n->tx_waiting = 0; virtio_net_flush_tx(n, vq); } else { qemu_mod_timer(n->tx_timer, ...
[ 1, 0 ]
qemu
target-sparc/fop_helper.c
void helper_fxtoq(CPUSPARCState *env, int64_t src) { /* No possible exceptions converting long long to long double. */ QT0 = int64_to_float128(src, &env->fp_status); }
[ 0, 0 ]
qemu
acl.c
void module_call_init(module_init_type type) { ModuleTypeList *l; ModuleEntry *e; l = find_type(type); TAILQ_FOREACH(e, l, node) { e->init(); } }
[ 0, 0 ]
qemu
hw/arm/xilinx_zynq.c
static void gem_init(NICInfo *nd, uint32_t base, qemu_irq irq) { DeviceState *dev; SysBusDevice *s; qemu_check_nic_model(nd, "cadence_gem"); dev = qdev_create(NULL, "cadence_gem"); qdev_set_nic_properties(dev, nd); qdev_init_nofail(dev); s = SYS_BUS_DEVICE(dev); sysbus_mmio_map(s, 0, base); ...
[ 0, 0 ]
qemu
block/blkreplay.c
static int coroutine_fn blkreplay_co_pwritev(BlockDriverState *bs, uint64_t offset, uint64_t bytes, QEMUIOVector *qiov, int flags) { uint64_t reqid = request_id++; int ret = bdrv_co_pwritev(bs->file->bs, offset, bytes, qio...
[ 0, 0 ]
qemu
block.c
void bdrv_detach_aio_context(BlockDriverState *bs) { BdrvAioNotifier *baf; if (!bs->drv) { return; } QLIST_FOREACH(baf, &bs->aio_notifiers, list) { baf->detach_aio_context(baf->opaque); } if (bs->io_limits_enabled) { throttle_timers_detach_aio_context(&bs->throttle_timers); } if (bs...
[ 0, 0 ]
qemu
hw/virtio/virtio-rng.c
static int virtio_rng_load(QEMUFile *f, void *opaque, int version_id) { VirtIORNG *vrng = opaque; VirtIODevice *vdev = VIRTIO_DEVICE(vrng); if (version_id != 1) { return -EINVAL; } virtio_load(vdev, f, version_id); /* We may have an element ready but couldn't process it due to a quota * limit...
[ 0, 0 ]
qemu
hw/ppc/spapr.c
void ppc_hash64_set_external_hpt(PowerPCCPU *cpu, void *hpt, int shift, Error **errp) { CPUPPCState *env = &cpu->env; Error *local_err = NULL; cpu_synchronize_state(CPU(cpu)); env->external_htab = hpt; ppc_hash64_set_sdr1(cpu, (target_ulong)(uintptr_t)hpt | (shift - 18)...
[ 0, 0 ]
qemu
acl.c
void *paio_init(void) { struct sigaction act; PosixAioState *s; int fds[2]; int ret; if (posix_aio_state) return posix_aio_state; s = qemu_malloc(sizeof(PosixAioState)); sigfillset(&act.sa_mask); act.sa_flags = 0; /* do not restart syscalls to interrupt select() */ act.sa_handler = aio_...
[ 0, 0 ]
FFmpeg
libavcodec/pthread.c
static int update_context_from_thread(AVCodecContext *dst, AVCodecContext *src, int for_user) { int err = 0; if (dst != src) { dst->sub_id = src->sub_id; dst->time_base = src->time_base; dst->width = src->width; dst->height = src->height; dst->pix_fm...
[ 1, 0 ]
qemu
block/curl.c
static void curl_multi_check_completion(BDRVCURLState *s) { int msgs_in_queue; /* Try to find done transfers, so we can free the easy * handle again. */ do { CURLMsg *msg; msg = curl_multi_info_read(s->multi, &msgs_in_queue); if (!msg) break; if (msg->msg == CURLMSG_NONE) ...
[ 1, 0 ]
qemu
block.c
BlockDriverState *bdrv_find_backing_image(BlockDriverState *bs, const char *backing_file) { char *filename_full = NULL; char *backing_file_full = NULL; char *filename_tmp = NULL; int is_protocol = 0; BlockDriverState *curr_bs = NULL; BlockDriverState *retval...
[ 0, 0 ]
qemu
hw/scsi/virtio-scsi.c
static void virtio_scsi_push_event(VirtIOSCSI *s, SCSIDevice *dev, uint32_t event, uint32_t reason) { VirtIOSCSICommon *vs = VIRTIO_SCSI_COMMON(s); VirtIOSCSIReq *req; VirtIOSCSIEvent *evt; VirtIODevice *vdev = VIRTIO_DEVICE(s); int in_size; if (!(vdev->status & VI...
[ 1, 0 ]
qemu
block/block-backend.c
static void raw_refresh_limits(BlockDriverState *bs, Error **errp) { BDRVRawState *s = bs->opaque; struct stat st; if (!fstat(s->fd, &st)) { if (S_ISBLK(st.st_mode)) { int ret = hdev_get_max_transfer_length(s->fd); if (ret >= 0) { bs->bl.max_transfer_length = ret; } } }...
[ 0, 0 ]
qemu
hw/block/dataplane/virtio-blk.c
void virtio_blk_data_plane_stop(VirtIOBlockDataPlane *s) { BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(s->vdev))); VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus); VirtIOBlock *vblk = VIRTIO_BLK(s->vdev); unsigned i; unsigned nvqs = s->conf->num_queues; if (!vblk->dataplane_started || s->stopping)...
[ 1, 0 ]
qemu
util/cutils.c
int qemu_strtou64(const char *nptr, const char **endptr, int base, uint64_t *result) { char *p; int err = 0; if (!nptr) { if (endptr) { *endptr = nptr; } err = -EINVAL; } else { errno = 0; /* FIXME This assumes uint64_t is unsigned long long */ *result...
[ 0, 1 ]
FFmpeg
avconv.c
static void get_default_channel_layouts(OutputStream *ost, InputStream *ist) { char layout_name[256]; AVCodecContext *enc = ost->st->codec; AVCodecContext *dec = ist->st->codec; if (!dec->channel_layout) { if (enc->channel_layout && dec->channels == enc->channels) { dec->channel_layout = enc->c...
[ 1, 0 ]
FFmpeg
libavcodec/twinvq.c
static int twin_decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; TwinContext *tctx = avctx->priv_data; GetBitContext gb; const ModeTab *mtab = tctx->mtab; float *out = data; ...
[ 1, 0 ]
qemu
hw/i386/intel_iommu.c
static VTDIOTLBEntry *vtd_lookup_iotlb(IntelIOMMUState *s, uint16_t source_id, hwaddr addr) { uint64_t key; key = (addr >> VTD_PAGE_SHIFT_4K) | ((uint64_t)(source_id) << VTD_IOTLB_SID_SHIFT); return g_hash_table_lookup(s->iotlb, &key); }
[ 0, 0 ]
qemu
Makefile.objs
static void do_spawn_thread(ThreadPool *pool) { QemuThread t; /* Runs with lock taken. */ if (!pool->new_threads) { return; } pool->new_threads--; pool->pending_threads++; qemu_thread_create(&t, "worker", worker_thread, pool, QEMU_THREAD_DETACHED); }
[ 0, 0 ]
qemu
xen-hvm.c
static void xen_io_add(MemoryListener *listener, MemoryRegionSection *section) { XenIOState *state = container_of(listener, XenIOState, io_listener); memory_region_ref(section->mr); xen_map_io_section(xen_xc, xen_domid, state->ioservid, section); }
[ 0, 0 ]
qemu
target-i386/kvm.c
static void kvm_supported_msrs(CPUState *env) { static int kvm_supported_msrs; int ret; /* first time */ if (kvm_supported_msrs == 0) { struct kvm_msr_list msr_list, *kvm_msr_list; kvm_supported_msrs = -1; /* Obtain MSR list from KVM. These are the MSRs that we must * save/restore */ ...
[ 1, 0 ]
qemu
configure
void kvm_setup_guest_memory(void *start, size_t size) { #ifdef CONFIG_VALGRIND_H VALGRIND_MAKE_MEM_DEFINED(start, size); #endif if (!kvm_has_sync_mmu()) { int ret = qemu_madvise(start, size, QEMU_MADV_DONTFORK); if (ret) { perror("qemu_madvise"); fprintf(stderr, "Need MAD...
[ 0, 0 ]
qemu
hw/acpi/aml-build.c
build_facs(GArray *table_data, GArray *linker) { AcpiFacsDescriptorRev1 *facs = acpi_data_push(table_data, sizeof *facs); memcpy(&facs->signature, "FACS", 4); facs->length = cpu_to_le32(sizeof(*facs)); }
[ 1, 0 ]
qemu
async.c
AioContext *aio_context_new(void) { AioContext *ctx; ctx = (AioContext *)g_source_new(&aio_source_funcs, sizeof(AioContext)); ctx->pollfds = g_array_new(FALSE, FALSE, sizeof(GPollFD)); ctx->thread_pool = NULL; qemu_mutex_init(&ctx->bh_lock); rfifolock_init(&ctx->lock, aio_rfifolock_cb, ctx); event...
[ 1, 0 ]
qemu
linux-user/main.c
static int do_break(CPUMIPSState *env, target_siginfo_t *info, unsigned int code) { int ret = -1; switch (code) { case BRK_OVERFLOW: case BRK_DIVZERO: info->si_signo = TARGET_SIGFPE; info->si_code = (code == BRK_OVERFLOW) ? FPE_INTOVF : FPE_INTDIV; break; default: ...
[ 1, 0 ]
qemu
tests/libqos/pci-pc.c
static uint16_t qpci_pc_config_readw(QPCIBus *bus, int devfn, uint8_t offset) { outl(0xcf8, (1 << 31) | (devfn << 8) | offset); return inw(0xcfc); }
[ 1, 0 ]
FFmpeg
libavformat/srtdec.c
static int64_t get_pts(const char **buf, int *duration, int32_t *x1, int32_t *y1, int32_t *x2, int32_t *y2) { int i; for (i = 0; i < 2; i++) { int hh1, mm1, ss1, ms1; int hh2, mm2, ss2, ms2; if (sscanf(*buf, "%d:%2d:%2d%*1[,.]%3d --> %d:%2d:%2d%*1[,.]%3d" ...
[ 1, 0 ]
FFmpeg
libavcodec/hevc_parser.c
static int hevc_find_frame_end(AVCodecParserContext *s, const uint8_t *buf, int buf_size) { HEVCParserContext *ctx = s->priv_data; ParseContext *pc = &ctx->pc; int i; for (i = 0; i < buf_size; i++) { int nut; pc->state64 = (pc->state64 << 8) | buf[i]; if (((pc...
[ 1, 0 ]
qemu
configure
static void vnc_debug_gnutls_log(int level, const char *str) { VNC_DEBUG("%d %s", level, str); }
[ 1, 0 ]
qemu
target-ppc/cpu.h
PPC_OP(test_ctr_false) { T0 = (regs->ctr != 0 && (T0 & PARAM(1)) == 0); RETURN(); }
[ 1, 0 ]
qemu
hw/ide/atapi.c
static int cd_read_sector(IDEState *s, int lba, uint8_t *buf, int sector_size) { int ret; switch (sector_size) { case 2048: block_acct_start(blk_get_stats(s->blk), &s->acct, 4 * BDRV_SECTOR_SIZE, BLOCK_ACCT_READ); ret = blk_read(s->blk, (int64_t)lba << 2, buf, 4); block_ac...
[ 1, 0 ]
qemu
ui/vnc-auth-sasl.c
void vnc_jobs_consume_buffer(VncState *vs) { bool flush; vnc_lock_output(vs); if (vs->jobs_buffer.offset) { if (vs->ioc != NULL && buffer_empty(&vs->output)) { if (vs->ioc_tag) { g_source_remove(vs->ioc_tag); vs->ioc_tag = qio_channel_add_watch(vs->ioc, G_IO_IN | G_IO_OUT, ...
[ 1, 0 ]
qemu
hw/block/virtio-blk.c
void *qemu_get_virtqueue_element(QEMUFile *f, size_t sz) { VirtQueueElement *elem; VirtQueueElementOld data; int i; qemu_get_buffer(f, (uint8_t *)&data, sizeof(VirtQueueElementOld)); elem = virtqueue_alloc_element(sz, data.out_num, data.in_num); elem->index = data.index; for (i = 0; i < elem->in_n...
[ 1, 0 ]
qemu
hw/qdev.c
void qdev_property_add_child(DeviceState *dev, const char *name, DeviceState *child, Error **errp) { gchar *type; type = g_strdup_printf("child<%s>", child->info->name); qdev_property_add(dev, name, type, qdev_get_child_property, NULL, NULL, child, errp); ...
[ 1, 0 ]
qemu
block/qcow2-cluster.c
static int copy_sectors(BlockDriverState *bs, uint64_t start_sect, uint64_t cluster_offset, int n_start, int n_end) { BDRVQcowState *s = bs->opaque; int n, ret; n = n_end - n_start; if (n <= 0) return 0; ret = qcow_read(bs, start_sect + n_start, s->cluster_data, n); if (...
[ 0, 0 ]
qemu
tcg/aarch64/tcg-target.inc.c
static void tcg_out_insn_3405(TCGContext *s, AArch64Insn insn, TCGType ext, TCGReg rd, uint16_t half, unsigned shift) { assert((shift & ~0x30) == 0); tcg_out32(s, insn | ext << 31 | shift << (21 - 4) | half << 5 | rd); }
[ 1, 0 ]
qemu
hw/9pfs/9p.c
static void coroutine_fn v9fs_xattrcreate(void *opaque) { int flags; int32_t fid; int64_t size; ssize_t err = 0; V9fsString name; size_t offset = 7; V9fsFidState *file_fidp; V9fsFidState *xattr_fidp; V9fsPDU *pdu = opaque; v9fs_string_init(&name); err = pdu_unmarshal(pdu, offset, "dsqd...
[ 0, 0 ]
qemu
target-cris/helper.h
static void cris_evaluate_flags(DisasContext *dc) { if (!dc->flags_uptodate) { cris_flush_cc_state(dc); switch (dc->cc_op) { case CC_OP_MCP: gen_helper_evaluate_flags_mcp(); break; case CC_OP_MULS: gen_helper_evaluate_flags_muls(); break; case CC_OP_MULU: ...
[ 0, 0 ]
qemu
block/nbd.c
int nbd_disconnect(int fd) { errno = ENOTSUP; return -1; }
[ 0, 0 ]
FFmpeg
libavfilter/defaults.c
AVFilterBufferRef *avfilter_default_get_video_buffer(AVFilterLink *link, int perms, int w, int h) { AVFilterBuffer *pic = av_mallocz(sizeof(AVFilterBuffer)); AVFilterBufferRef *ref = av_mallocz(sizeof(AVFilterBufferRef)); int i, tempsize; char *buf; r...
[ 1, 1 ]
qemu
hw/virtio-blk.c
static void virtio_blk_handle_write(BlockRequest *blkreq, int *num_writes, VirtIOBlockReq *req) { if (req->out->sector & req->dev->sector_mask) { virtio_blk_rw_complete(req, -EIO); return; } if (*num_writes == 32) { do_multiwrite(req->dev->bs, blkreq, *num_wr...
[ 1, 0 ]
qemu
block/nbd-client.c
static void nbd_restart_write(void *opaque) { NbdClientSession *s = opaque; qemu_coroutine_enter(s->send_coroutine, NULL); }
[ 0, 0 ]
qemu
buffered_file.c
static void xen_domain_poll(void *opaque) { struct xc_dominfo info; int rc; rc = xc_domain_getinfo(xen_xc, xen_domid, 1, &info); if ((rc != 1) || (info.domid != xen_domid)) { qemu_log("xen: domain %d is gone\n", xen_domid); goto quit; } if (info.dying) { qemu_log("xen: domain %d is dyin...
[ 1, 0 ]
qemu
fsdev/virtio-9p-marshal.c
static void v9fs_unlinkat(void *opaque) { int err = 0; V9fsString name; int32_t dfid, flags; size_t offset = 7; V9fsPath path; V9fsFidState *dfidp; V9fsPDU *pdu = opaque; pdu_unmarshal(pdu, offset, "dsd", &dfid, &name, &flags); dfidp = get_fid(pdu, dfid); if (dfidp == NULL) { err = -...
[ 0, 0 ]
FFmpeg
libavcodec/ac3dec.c
static int decode_exponents(GetBitContext *gbc, int exp_strategy, int ngrps, uint8_t absexp, int8_t *dexps) { int i, j, grp, group_size; int dexp[256]; int expacc, prevexp; /* unpack groups */ group_size = exp_strategy + (exp_strategy == EXP_D45); for (grp = 0, i = 0; grp...
[ 1, 0 ]
qemu
block.c
static inline void scoop_gpio_handler_update(ScoopInfo *s) { uint32_t level, diff; int bit; level = s->gpio_level & s->gpio_dir; for (diff = s->prev_level ^ level; diff; diff ^= 1 << bit) { bit = ffs(diff) - 1; qemu_set_irq(s->handler[bit], (level >> bit) & 1); } s->prev_level = level; }
[ 1, 0 ]
qemu
pc-bios/s390-ccw/virtio.c
static int run_ccw(struct subchannel_id schid, int cmd, void *ptr, int len) { struct ccw1 ccw = {}; struct cmd_orb orb = {}; struct schib schib; int r; /* start command processing */ stsch_err(schid, &schib); schib.scsw.ctrl = SCSW_FCTL_START_FUNC; msch(schid, &schib); /* start subchannel co...
[ 1, 1 ]
qemu
hw/arm_gic.c
void *pl080_init(uint32_t base, qemu_irq irq, int nchannels) { int iomemtype; pl080_state *s; s = (pl080_state *)qemu_mallocz(sizeof(pl080_state)); iomemtype = cpu_register_io_memory(0, pl080_readfn, pl080_writefn, s); cpu_register_physical_memory(base, 0x00000fff, ...
[ 1, 0 ]
FFmpeg
libavcodec/wma.c
static av_cold void init_coef_vlc(VLC *vlc, uint16_t **prun_table, float **plevel_table, uint16_t **pint_table, const CoefVLCTable *vlc_table) { int n = vlc_table->n; const uint8_t *table_bits = vlc_table->huffbits; const uint32_t *table_co...
[ 1, 1 ]
FFmpeg
libavformat/yop.c
static int yop_probe(AVProbeData *probe_packet) { if (AV_RB16(probe_packet->buf) == AV_RB16("YO") && probe_packet->buf[6] && probe_packet->buf[7] && !(probe_packet->buf[8] & 1) && !(probe_packet->buf[10] & 1)) return AVPROBE_SCORE_MAX * 3 / 4; return 0; }
[ 1, 0 ]
FFmpeg
libavcodec/arm/vp8dsp.h
av_cold int ff_vp8_decode_init(AVCodecContext *avctx) { VP8Context *s = avctx->priv_data; int ret; s->avctx = avctx; avctx->pix_fmt = AV_PIX_FMT_YUV420P; avctx->internal->allocate_progress = 1; ff_videodsp_init(&s->vdsp, 8); ff_h264_pred_init(&s->hpc, AV_CODEC_ID_VP8, 8, 1); ff_vp8dsp_init(&s->...
[ 0, 0 ]
FFmpeg
libavcodec/dfa.c
static int decode_unk6(uint8_t *frame, int width, int height, const uint8_t *src, const uint8_t *src_end) { return -1; }
[ 1, 0 ]
qemu
include/qemu/thread-posix.h
void qemu_sem_post(QemuSemaphore *sem) { int rc; #if defined(__APPLE__) || defined(__NetBSD__) pthread_mutex_lock(&sem->lock); if (sem->count == INT_MAX) { rc = EINVAL; } else if (sem->count++ < 0) { rc = pthread_cond_signal(&sem->cond); } else { rc = 0; } pthread_mutex_unlock(&sem-...
[ 1, 0 ]
FFmpeg
libavcodec/cinepakenc.c
static int encode_codebook(CinepakEncContext *s, int *codebook, int size, int chunk_type_yuv, int chunk_type_gray, unsigned char *buf) { int x, y, ret, entry_size = s->pix_fmt == AV_PIX_FMT_YUV420P ? 6 : 4; ret = write_chunk_header( buf, s->pix_fmt == A...
[ 1, 0 ]
qemu
hw/arm/omap1.c
void stellaris_gamepad_init(int n, qemu_irq *irq, const int *keycode) { gamepad_state *s; int i; s = (gamepad_state *)g_malloc0(sizeof(gamepad_state)); s->buttons = (gamepad_button *)g_malloc0(n * sizeof(gamepad_button)); for (i = 0; i < n; i++) { s->buttons[i].irq = irq[i]; s->buttons[i].keyc...
[ 1, 0 ]
FFmpeg
libavformat/jvdec.c
static int read_probe(AVProbeData *pd) { if (pd->buf[0] == 'J' && pd->buf[1] == 'V' && strlen(MAGIC) <= pd->buf_size - 4 && !memcmp(pd->buf + 4, MAGIC, strlen(MAGIC))) return AVPROBE_SCORE_MAX; return 0; }
[ 1, 0 ]
qemu
cpu-all.h
void cpu_reset(CPUCRISState *env) { memset(env, 0, offsetof(CPUCRISState, breakpoints)); tlb_flush(env, 1); env->pregs[PR_VR] = 32; #if defined(CONFIG_USER_ONLY) /* start in user mode with interrupts enabled. */ env->pregs[PR_CCS] |= U_FLAG | I_FLAG; #else env->pregs[PR_CCS] = 0; #endif
[ 1, 0 ]
FFmpeg
libavcodec/wavpack.c
static void update_error_limit(WavpackFrameContext *ctx) { int i, br[2], sl[2]; for (i = 0; i <= ctx->stereo_in; i++) { ctx->ch[i].bitrate_acc += ctx->ch[i].bitrate_delta; br[i] = ctx->ch[i].bitrate_acc >> 16; sl[i] = LEVEL_DECAY(ctx->ch[i].slow_level); } if (ctx->stereo_in && ctx->hybrid_bit...
[ 1, 0 ]
qemu
hw/usb.c
static int do_token_setup(USBDevice *s, USBPacket *p) { int request, value, index; int ret = 0; if (p->len != 8) memcpy(s->setup_buf, p->data, 8); s->setup_len = (s->setup_buf[7] << 8) | s->setup_buf[6]; s->setup_index = 0; request = (s->setup_buf[0] << 8) | s->setup_buf[1]; value = (s->setup...
[ 1, 0 ]
qemu
docs/devel/tracing.txt
static int colo_packet_compare_common(Packet *ppkt, Packet *spkt, int offset) { if (trace_event_get_state(TRACE_COLO_COMPARE_MISCOMPARE)) { char pri_ip_src[20], pri_ip_dst[20], sec_ip_src[20], sec_ip_dst[20]; strcpy(pri_ip_src, inet_ntoa(ppkt->ip->ip_src)); strcpy(pri_ip_dst, inet_ntoa(ppkt->ip->ip_d...
[ 1, 0 ]
FFmpeg
libavcodec/bsf.c
int av_bsf_list_parse_str(const char *str, AVBSFContext **bsf_lst) { AVBSFList *lst; char *bsf_str, *buf, *dup, *saveptr; int ret; if (!str) return av_bsf_get_null_filter(bsf_lst); lst = av_bsf_list_alloc(); if (!lst) return AVERROR(ENOMEM); if (!(dup = buf = av_strdup(str))) return...
[ 1, 0 ]
FFmpeg
libavfilter/vf_tile.c
static void end_last_frame(AVFilterContext *ctx) { TileContext *tile = ctx->priv; AVFilterLink *outlink = ctx->outputs[0]; AVFilterBufferRef *out_buf = outlink->out_buf; outlink->out_buf = NULL; ff_start_frame(outlink, out_buf); while (tile->current < tile->nb_frames) draw_blank_frame(ctx, out_b...
[ 0, 0 ]
FFmpeg
libavcodec/alac.c
static av_cold int alac_decode_close(AVCodecContext *avctx) { ALACContext *alac = avctx->priv_data; int chan; for (chan = 0; chan < alac->numchannels; chan++) { av_freep(&alac->predicterror_buffer[chan]); av_freep(&alac->outputsamples_buffer[chan]); av_freep(&alac->wasted_bits_buffer[chan]); ...
[ 1, 0 ]
qemu
target-ppc/helper.c
void OPPROTO op_divw(void) { if (unlikely(((int32_t)T0 == INT32_MIN && (int32_t)T1 == -1) || (int32_t)T1 == 0)) { T0 = (int32_t)((-1) * ((uint32_t)T0 >> 31)); } else { T0 = (int32_t)T0 / (int32_t)T1; } RETURN(); }
[ 1, 0 ]
qemu
hw/misc/vfio.c
static void vfio_disable_msix(VFIODevice *vdev) { msix_unset_vector_notifiers(&vdev->pdev); if (vdev->nr_vectors) { vfio_disable_irqindex(vdev, VFIO_PCI_MSIX_IRQ_INDEX); vfio_disable_msi_common(vdev); DPRINTF("%s(%04x:%02x:%02x.%x)\n", __func__, vdev->host.domain, vdev->host.bus, vdev->host....
[ 1, 0 ]
FFmpeg
libswscale/utils.c
SwsVector *sws_getGaussianVec(double variance, double quality) { const int length = (int)(variance * quality + 0.5) | 1; int i; double middle = (length - 1) * 0.5; SwsVector *vec = sws_allocVec(length); if (!vec) return NULL; for (i = 0; i < length; i++) { double dist = i - middle; vec...
[ 1, 0 ]
qemu
net.c
static void print_net_client(Monitor *mon, VLANClientState *vc) { monitor_printf(mon, "%s: type=%s,%s\n", vc->name, net_client_types[vc->info->type].type, vc->info_str); }
[ 1, 0 ]
qemu
target/nios2/translate.c
static void br(DisasContext *dc, uint32_t code, uint32_t flags) { I_TYPE(instr, code); gen_goto_tb(dc, 0, dc->pc + 4 + (instr.imm16s & -4)); dc->is_jmp = DISAS_TB_JUMP; }
[ 1, 0 ]
FFmpeg
libavcodec/dnxhdenc.c
static int dnxhd_write_header(AVCodecContext *avctx, uint8_t *buf) { DNXHDEncContext *ctx = avctx->priv_data; const uint8_t header_prefix[5] = {0x00, 0x00, 0x02, 0x80, 0x01}; memcpy(buf, header_prefix, 5); buf[5] = ctx->interlaced ? ctx->cur_field + 2 : 0x01; buf[6] = 0x80; // crc flag of...
[ 1, 1 ]
qemu
Makefile.objs
static int qemu_rdma_reg_control(RDMAContext *rdma, int idx) { rdma->wr_data[idx].control_mr = ibv_reg_mr(rdma->pd, rdma->wr_data[idx].control, RDMA_CONTROL_MAX_BUFFER, IBV_ACCESS_LOCAL_WRITE | IBV_ACCESS_REMOTE_WRITE); if (rdma->wr_data[idx].control_mr) { rdma->tot...
[ 1, 0 ]
qemu
hw/dp8393x.c
int tap_win32_init(VLANState *vlan, const char *model, const char *name, const char *ifname) { TAPState *s; s = qemu_mallocz(sizeof(TAPState)); if (!s) return -1; if (tap_win32_open(&s->handle, ifname) < 0) { printf("tap: Could not open '%s'\n", ifname); return -1; } ...
[ 1, 0 ]
qemu
hw/core/qdev-properties-system.c
static int parse_netdev(DeviceState *dev, const char *str, void **ptr) { NICPeers *peers_ptr = (NICPeers *)ptr; NICConf *conf = container_of(peers_ptr, NICConf, peers); NetClientState **ncs = peers_ptr->ncs; NetClientState *peers[MAX_QUEUE_NUM]; int queues, i = 0; int ret; queues = qemu_find_net_clients_e...
[ 1, 0 ]
qemu
Makefile.objs
static void ehci_async_complete_packet(USBPort *port, USBPacket *packet) { EHCIQueue *q; EHCIState *s = port->opaque; uint32_t portsc = s->portsc[port->index]; if (portsc & PORTSC_POWNER) { USBPort *companion = s->companion_ports[port->index]; companion->ops->complete(companion, packet); ret...
[ 1, 0 ]
qemu
hw/virtio.c
void virtio_queue_set_notification(VirtQueue *vq, int enable) { vq->notification = enable; if (vq->vdev->guest_features & (1 << VIRTIO_RING_F_EVENT_IDX)) { vring_avail_event(vq, vring_avail_idx(vq)); } else if (enable) { vring_used_flags_unset_bit(vq, VRING_USED_F_NO_NOTIFY); } else { vring_...
[ 1, 0 ]
qemu
hw/i82374.c
static void i82378_init(DeviceState *dev, I82378State *s) { ISABus *isabus = DO_UPCAST(ISABus, qbus, qdev_get_child_bus(dev, "isa.0")); ISADevice *pit; qemu_irq *out0_irq; /* This device has: 2 82C59 (irq) 1 82C54 (pit) 2 82C37 (dma) NMI Utility Bus Support Registers A...
[ 1, 0 ]
qemu
cpu-exec.c
int cpu_gen_code(CPUState *env, TranslationBlock *tb, int max_code_size, int *gen_code_size_ptr) { uint8_t *gen_code_buf; int gen_code_size; if (gen_intermediate_code(env, tb) < 0) return -1; /* generate machine code */ tb->tb_next_offset[0] = 0xffff; tb->tb_next_offset[1] = 0x...
[ 1, 0 ]
FFmpeg
libavcodec/mpegaudiodec_template.c
static inline int l3_unscale(int value, int exponent) { unsigned int m; int e; e = table_4_3_exp[4 * value + (exponent & 3)]; m = table_4_3_value[4 * value + (exponent & 3)]; e -= exponent >> 2; #ifdef DEBUG if (e < 1) av_log(NULL, AV_LOG_WARNING, "l3_unscale: e is %d\n", e); #endif if (e >...
[ 1, 0 ]
FFmpeg
libavformat/wavenc.c
static av_cold int peak_init_writer(AVFormatContext *s) { WAVMuxContext *wav = s->priv_data; AVCodecContext *enc = s->streams[0]->codec; if (enc->codec_id != AV_CODEC_ID_PCM_S8 && enc->codec_id != AV_CODEC_ID_PCM_S16LE && enc->codec_id != AV_CODEC_ID_PCM_U8 && enc->codec_id != AV_CODEC_ID...
[ 1, 0 ]
qemu
ui/vnc.c
static void vnc_dpy_switch(DisplayChangeListener *dcl, DisplaySurface *surface) { VncDisplay *vd = container_of(dcl, VncDisplay, dcl); VncState *vs; vnc_abort_display_jobs(vd); /* server surface */ qemu_pixman_image_unref(vd->server); vd->ds = surface; vd->server = pixm...
[ 1, 1 ]
FFmpeg
libavformat/hls.c
static int url_connect(struct variant *var, AVDictionary *opts) { AVDictionary *tmp = NULL; int ret; av_dict_copy(&tmp, opts, 0); av_opt_set_dict(var->input, &tmp); if ((ret = ffurl_connect(var->input, NULL)) < 0) { ffurl_close(var->input); var->input = NULL; } av_dict_free(&tmp); retu...
[ 0, 0 ]
qemu
tests/test-i386.c
void test_self_modifying_code(void) { int (*func)(void); func = (void *)code; printf("self modifying code:\n"); printf("func1 = 0x%x\n", func()); code[1] = 0x2; printf("func1 = 0x%x\n", func()); }
[ 1, 0 ]
qemu
hw/arm/virt.c
static void fdt_add_psci_node(const VirtBoardInfo *vbi) { void *fdt = vbi->fdt; ARMCPU *armcpu = ARM_CPU(qemu_get_cpu(0)); /* No PSCI for TCG yet */ if (kvm_enabled()) { qemu_fdt_add_subnode(fdt, "/psci"); if (armcpu->psci_version == 2) { const char comp[] = "arm,psci-0.2\0arm,psci"; ...
[ 1, 0 ]
qemu
HACKING
static uint32_t m5206_mbar_readb(void *opaque, target_phys_addr_t offset) { m5206_mbar_state *s = (m5206_mbar_state *)opaque; offset &= 0x3ff; if (offset >= 0x200) { hw_error("Bad MBAR read offset 0x%x", (int)offset); } if (m5206_mbar_width[offset >> 2] > 1) { uint16_t val; val = m5206_mba...
[ 1, 0 ]
qemu
target-s390x/mem_helper.c
void HELPER(mvpg)(CPUS390XState *env, uint64_t r0, uint64_t r1, uint64_t r2) { /* XXX missing r0 handling */ env->cc_op = 0; #ifdef CONFIG_USER_ONLY memmove(g2h(r1), g2h(r2), TARGET_PAGE_SIZE); #else mvc_fast_memmove(env, TARGET_PAGE_SIZE, r1, r2); #endif }
[ 1, 1 ]
FFmpeg
libavcodec/a64multienc.c
static av_cold int xwd_encode_init(AVCodecContext *avctx) { avctx->coded_frame = av_frame_alloc(); if (!avctx->coded_frame) return AVERROR(ENOMEM); return 0; }
[ 0, 0 ]
qemu
tests/test-aio.c
static void test_source_wait_event_notifier(void) { EventNotifierTestData data = {.n = 0, .active = 1}; event_notifier_init(&data.e, false); aio_set_event_notifier(ctx, &data.e, event_ready_cb); g_assert(g_main_context_iteration(NULL, false)); g_assert_cmpint(data.n, ==, 0); g_assert_cmpint(data.acti...
[ 0, 0 ]
qemu
block.c
void get_tmp_filename(char *filename, int size) { char temp_dir[MAX_PATH]; GetTempPath(MAX_PATH, temp_dir); GetTempFileName(temp_dir, "qem", 0, filename); }
[ 1, 0 ]
qemu
HACKING
static uint64_t grlib_gptimer_read(void *opaque, target_phys_addr_t addr, unsigned size) { GPTimerUnit *unit = opaque; target_phys_addr_t timer_addr; int id; uint32_t value = 0; addr &= 0xff; /* Unit registers */ switch (addr) { case SCALER_OFFSET: trace...
[ 1, 0 ]
qemu
hw/i386/intel_iommu.c
static uint64_t vtd_context_cache_invalidate(IntelIOMMUState *s, uint64_t val) { uint64_t caig; uint64_t type = val & VTD_CCMD_CIRG_MASK; switch (type) { case VTD_CCMD_GLOBAL_INVL: VTD_DPRINTF(INV, "Global invalidation request"); caig = VTD_CCMD_GLOBAL_INVL_A; break; case VTD_CCMD_DOMAIN_...
[ 0, 0 ]
qemu
hw/i2c.c
i2c_bus *i2c_init_bus(DeviceState *parent, const char *name) { i2c_bus *bus; bus = FROM_QBUS(i2c_bus, qbus_create(BUS_TYPE_I2C, sizeof(i2c_bus), parent, name)); register_savevm("i2c_bus", -1, 1, i2c_bus_save, i2c_bus_load, bus); return bus; }
[ 1, 0 ]
qemu
hw/msi.c
int msix_uninit(PCIDevice *dev, MemoryRegion *bar) { if (!(dev->cap_present & QEMU_PCI_CAP_MSIX)) return 0; pci_del_capability(dev, PCI_CAP_ID_MSIX, MSIX_CAP_LENGTH); dev->msix_cap = 0; msix_free_irq_entries(dev); dev->msix_entries_nr = 0; memory_region_del_subregion(bar, &dev->msix_mmio); me...
[ 0, 0 ]
qemu
qapi/qmp-input-visitor.c
void qmp_input_visitor_cleanup(QmpInputVisitor *v) { qobject_decref(v->stack[0].obj); g_free(v); }
[ 0, 0 ]
qemu
block/qcow2-cache.c
uint64_t qcow2_alloc_compressed_cluster_offset(BlockDriverState *bs, uint64_t offset, int compressed_size) { BDRVQcowState *s = bs->opaque; int l2_index, ret; uint64_t *l2_table; int64_t cluster_offset; int n...
[ 1, 0 ]