Projectname
large_stringclasses
15 values
Filepath
large_stringlengths
4
106
Function
large_stringlengths
11
3.45k
Label
list
qemu
linux-user/main.c
static void gen_cli(DisasContext *ctx) { /* Cache line invalidate: privileged and treated as no-op */ #if defined(CONFIG_USER_ONLY) gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC); #else if (unlikely(ctx->pr)) { gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC); return; } #endif }
[ 1, 0 ]
FFmpeg
postproc/rgb2rgb.c
void palette8tobgr15(const uint8_t *src, uint8_t *dst, unsigned num_pixels, const uint8_t *palette) { unsigned i; for (i = 0; i < num_pixels; i++) ((uint16_t *)dst)[i] = bswap_16(((uint16_t *)palette)[src[i]]); }
[ 1, 0 ]
FFmpeg
libavformat/mxfdec.c
static int mxf_read_content_storage(void *arg, AVIOContext *pb, int tag, int size, UID uid, int64_t klv_offset) { MXFContext *mxf = arg; switch (tag) { case 0x1901: mxf->packages_count = avio_rb32(pb); mxf->packages_refs = av_calloc(mxf->packages_count, sizeof(UID...
[ 1, 0 ]
FFmpeg
libavcodec/eamad.c
static int decode_mb(MadContext *s, AVFrame *frame, int inter) { int mv_map = 0; int mv_x, mv_y; int j; if (inter) { int v = decode210(&s->gb); if (v < 2) { mv_map = v ? get_bits(&s->gb, 6) : 63; mv_x = decode_motion(&s->gb); mv_y = decode_motion(&s->gb); } } for (j ...
[ 1, 0 ]
qemu
tests/libqos/virtio-pci.c
static void qvirtio_pci_foreach_callback( QPCIDevice *dev, int devfn, void *data) { QVirtioPCIForeachData *d = data; QVirtioPCIDevice *vpcidev = qpcidevice_to_qvirtiodevice(dev); if (vpcidev->vdev.device_type == d->device_type && (!d->has_slot || vpcidev->pdev->devfn == d->slot << 3)) { d->fu...
[ 1, 0 ]
qemu
hw/scsi/virtio-scsi-dataplane.c
static void virtio_scsi_handle_event(VirtIODevice *vdev, VirtQueue *vq) { VirtIOSCSI *s = VIRTIO_SCSI(vdev); if (s->ctx && !s->dataplane_started) { virtio_scsi_dataplane_start(s); return; } if (s->events_dropped) { virtio_scsi_push_event(s, NULL, VIRTIO_SCSI_T_NO_EVENT, 0); } }
[ 1, 0 ]
qemu
qga/commands-posix.c
int64_t qmp_guest_file_open(const char *path, bool has_mode, const char *mode, Error **errp) { FILE *fh; Error *local_err = NULL; int fd; int64_t ret = -1, handle; if (!has_mode) { mode = "r"; } slog("guest-file-open called, filepath: %s, mode: %s", path, mode); ...
[ 1, 0 ]
FFmpeg
libavcodec/ac3dec.c
static void decode_band_structure(GetBitContext *gbc, int blk, int eac3, int ecpl, int start_subband, int end_subband, const uint8_t *default_band_struct, uint8_t *band_struct, int *num_subbands, ...
[ 1, 0 ]
qemu
hw/ppc/spapr.c
int kvmppc_get_htab_fd(bool write) { struct kvm_get_htab_fd s = { .flags = write ? KVM_GET_HTAB_WRITE : 0, .start_index = 0, }; if (!cap_htab_fd) { fprintf(stderr, "KVM version doesn't support saving the hash table\n"); return -1; } return kvm_vm_ioctl(kvm_state, KVM_PPC_GET_HTAB_...
[ 1, 0 ]
qemu
block/qcow2-cluster.c
static int count_contiguous_clusters(uint64_t nb_clusters, int cluster_size, uint64_t *l2_table, uint64_t start, uint64_t mask) { int i; uint64_t offset = be64_to_cpu(l2_table[0]) & ~mask; if (!offset) return 0; for (i = start;...
[ 1, 0 ]
FFmpeg
libavcodec/tak.c
void avpriv_tak_parse_streaminfo(GetBitContext *gb, TAKStreamInfo *s) { uint64_t channel_mask = 0; int frame_type, i; s->codec = get_bits(gb, TAK_ENCODER_CODEC_BITS); skip_bits(gb, TAK_ENCODER_PROFILE_BITS); frame_type = get_bits(gb, TAK_SIZE_FRAME_DURATION_BITS); s->samples = get_bits64(gb, TAK_SIZE...
[ 0, 0 ]
FFmpeg
libavformat/rtsp.c
static void rtsp_send_cmd(AVFormatContext *s, const char *cmd, RTSPMessageHeader *reply, unsigned char **content_ptr) { RTSPState *rt = s->priv_data; char buf[4096], buf1[1024]; rt->seq++; av_strlcpy(buf, cmd, sizeof(buf)); snprintf(buf1, sizeof(buf1...
[ 1, 0 ]
qemu
hw/file-op-9p.h
static int local_post_create_passthrough(FsContext *fs_ctx, const char *path, FsCred *credp) { if (chmod(rpath(fs_ctx, path), credp->fc_mode & 07777) < 0) { return -1; } if (chown(rpath(fs_ctx, path), credp->fc_uid, credp->fc_gid) < 0) { return -1; } ret...
[ 1, 0 ]
qemu
hw/acpi_piix4.c
static int piix4_device_hotplug(DeviceState *qdev, PCIDevice *dev, PCIHotplugState state) { int slot = PCI_SLOT(dev->devfn); PIIX4PMState *s = DO_UPCAST(PIIX4PMState, dev, PCI_DEVICE(qdev)); /* Don't send event when device is enabled during qemu ...
[ 1, 0 ]
FFmpeg
avconv.c
int opt_loglevel(void *optctx, const char *opt, const char *arg) { const struct { const char *name; int level; } log_levels[] = { {"quiet", AV_LOG_QUIET}, {"panic", AV_LOG_PANIC}, {"fatal", AV_LOG_FATAL}, {"error", AV_LOG_ERROR}, {"warning", AV_LOG_WARNING}, {"inf...
[ 1, 0 ]
FFmpeg
libavutil/opt.c
const AVOption *av_opt_next(void *obj, const AVOption *last) { AVClass *class = *(AVClass **)obj; if (!last && class->option && class->option[0].name) return class->option; if (last && last[1].name) return ++last; return NULL; }
[ 1, 0 ]
qemu
target-ppc/mmu_helper.c
static void mmubooke_dump_mmu(FILE *f, fprintf_function cpu_fprintf, CPUPPCState *env) { ppcemb_tlb_t *entry; int i; if (kvm_enabled() && !env->kvm_sw_tlb) { cpu_fprintf(f, "Cannot access KVM TLB\n"); return; } cpu_fprintf(f, "\nTLB:\n"); cpu_fprintf(f, "Effect...
[ 1, 0 ]
qemu
hw/apb_pci.c
static void slavio_timer_init_all(target_phys_addr_t addr, qemu_irq master_irq, qemu_irq *cpu_irqs, unsigned int num_cpus) { DeviceState *dev; SysBusDevice *s; unsigned int i; dev = qdev_create(NULL, "slavio_timer"); qdev_prop_set_uint32(dev, "num_cpus", num_cpus); ...
[ 1, 0 ]
FFmpeg
libavcodec/dxva2_mpeg2.c
static int mpeg_decode_frame(AVCodecContext *avctx, void *data, int *got_output, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; Mpeg1Context *s = avctx->priv_data; AVFrame *picture = data; MpegEncContext *s2 = &s->mpeg_enc_ctx; av_dlog(a...
[ 1, 0 ]
FFmpeg
libavformat/tee.c
static int parse_bsfs(void *log_ctx, const char *bsfs_spec, AVBitStreamFilterContext **bsfs) { char *bsf_name, *buf, *saveptr; int ret = 0; if (!(buf = av_strdup(bsfs_spec))) return AVERROR(ENOMEM); while (bsf_name = av_strtok(buf, ",", &saveptr)) { AVBitStreamFilterContext...
[ 1, 0 ]
FFmpeg
libavcodec/ivi_common.c
void ff_ivi_output_plane(IVIPlaneDesc *plane, uint8_t *dst, int dst_pitch) { int x, y; const int16_t *src = plane->bands[0].buf; uint32_t pitch = plane->bands[0].pitch; for (y = 0; y < plane->height; y++) { for (x = 0; x < plane->width; x++) dst[x] = av_clip_uint8(src[x] + 128); src += pitch; ...
[ 1, 0 ]
qemu
include/ui/console.h
static void vnc_dpy_update(DisplayChangeListener *dcl, DisplayState *ds, int x, int y, int w, int h) { int i; VncDisplay *vd = ds->opaque; struct VncSurface *s = &vd->guest; int width = ds_get_width(ds); int height = ds_get_height(ds); h += y; ...
[ 1, 0 ]
qemu
Makefile.objs
int64_t qemu_ftell(QEMUFile *f) { qemu_fflush(f); return f->pos; }
[ 1, 0 ]
FFmpeg
libavformat/format.c
enum AVCodecID av_guess_codec(AVOutputFormat *fmt, const char *short_name, const char *filename, const char *mime_type, enum AVMediaType type) { if (av_match_name("segment", fmt->name) || av_match_name("ssegment", fmt->name)) { fmt = av_guess_...
[ 1, 0 ]
qemu
disas.c
static void do_screen_dump(int argc, const char **argv) { if (argc != 2) { help_cmd(argv[0]); return; } vga_screen_dump(argv[1]); }
[ 0, 0 ]
qemu
Makefile.objs
static bool aio_epoll_check_poll(AioContext *ctx, GPollFD *pfds, unsigned npfd, int64_t timeout) { return false; }
[ 0, 0 ]
qemu
check-qjson.c
START_TEST(single_quote_string) { int i; struct { const char *encoded; const char *decoded; } test_cases[] = { {"'hello world'", "hello world"}, {"'the quick brown fox \\' jumped over the fence'", "the quick brown fox ' jumped over the fence"}, {} }; for (i = 0; te...
[ 0, 0 ]
qemu
hw/9pfs/9p.c
static void handle_9p_output(VirtIODevice *vdev, VirtQueue *vq) { V9fsVirtioState *v = (V9fsVirtioState *)vdev; V9fsState *s = &v->state; V9fsPDU *pdu; ssize_t len; while ((pdu = pdu_alloc(s))) { struct { uint32_t size_le; uint8_t id; uint16_t tag_le; } QEMU_PACKED out; ...
[ 1, 0 ]
FFmpeg
libavfilter/vf_frei0r.c
static int source_config_props(AVFilterLink *outlink) { AVFilterContext *ctx = outlink->src; Frei0rContext *s = ctx->priv; if (av_image_check_size(s->w, s->h, 0, ctx) < 0) return AVERROR(EINVAL); outlink->w = s->w; outlink->h = s->h; outlink->time_base = s->time_base; if (!(s->instance = s->c...
[ 1, 0 ]
qemu
hw/pci.c
static void put_pci_irq_state(QEMUFile *f, void *pv, size_t size) { int i; PCIDevice *s = container_of(pv, PCIDevice, config); for (i = 0; i < PCI_NUM_PINS; ++i) { qemu_put_be32(f, pci_irq_state(s, i)); } }
[ 0, 0 ]
qemu
block/nbd-client.c
static int nbd_co_send_request(NbdClientSession *s, struct nbd_request *request, QEMUIOVector *qiov, int offset) { AioContext *aio_context; int rc, ret; qemu_co_mutex_lock(&s->send_mutex); s->send_coroutine = qemu_coroutine_self(); aio_cont...
[ 0, 0 ]
qemu
qemu-nbd.c
static int find_partition(BlockBackend *blk, int partition, off_t *offset, off_t *size) { struct partition_record mbr[4]; uint8_t data[512]; int i; int ext_partnum = 4; int ret; if ((ret = blk_read(blk, 0, data, 1)) < 0) { error_report("error while reading: %s", strerr...
[ 1, 0 ]
qemu
hw/block/virtio-blk.c
static void virtio_blk_handle_write(VirtIOBlockReq *req, MultiReqBuffer *mrb) { BlockRequest *blkreq; uint64_t sector; sector = virtio_ldq_p(VIRTIO_DEVICE(req->dev), &req->out.sector); bdrv_acct_start(req->dev->bs, &req->acct, req->qiov.size, BDRV_ACCT_WRITE); trace_virtio_blk_handle_write(req, sector, ...
[ 1, 0 ]
qemu
hmp.c
void hmp_info_local_apic(Monitor *mon, const QDict *qdict) { x86_cpu_dump_local_apic_state(mon_get_cpu(), (FILE *)mon, monitor_fprintf, CPU_DUMP_FPU); }
[ 1, 0 ]
qemu
monitor.c
void monitor_vprintf(Monitor *mon, const char *fmt, va_list ap) { if (!mon) return; if (mon->mc && !mon->mc->print_enabled) { qemu_error_new(QERR_UNDEFINED_ERROR); } else { char buf[4096]; vsnprintf(buf, sizeof(buf), fmt, ap); monitor_puts(mon, buf); } }
[ 1, 0 ]
qemu
block/backup.c
void do_blockdev_backup(BlockdevBackup *backup, BlockJobTxn *txn, Error **errp) { BlockDriverState *bs; BlockDriverState *target_bs; Error *local_err = NULL; AioContext *aio_context; if (!backup->has_speed) { backup->speed = 0; } if (!backup->has_on_source_error) { backup->on_source_error...
[ 0, 0 ]
FFmpeg
libavcodec/dvdata.c
const DVprofile *ff_dv_frame_profile2(AVCodecContext *codec, const DVprofile *sys, const uint8_t *frame, unsigned buf_size) { int i; int dsf = (frame[3] & 0x80) >> 7; int stype = frame[80 * 5 + 48 + 3] & 0x1f; /* 576i50 25Mbps 4:1...
[ 1, 0 ]
qemu
block.c
int bdrv_is_snapshot(BlockDriverState *bs) { return !!(bs->open_flags & BDRV_O_SNAPSHOT); }
[ 0, 0 ]
qemu
tests/test-crypto-cipher.c
static void test_cipher(const void *opaque) { const QCryptoCipherTestData *data = opaque; QCryptoCipher *cipher; Error *err = NULL; uint8_t *key, *iv, *ciphertext, *plaintext, *outtext; size_t nkey, niv, nciphertext, nplaintext; char *outtexthex; g_test_message("foo"); nkey = unhex_string(data-...
[ 1, 0 ]
FFmpeg
libavcodec/roqvideodec.c
static av_cold int roq_decode_init(AVCodecContext *avctx) { RoqContext *s = avctx->priv_data; s->avctx = avctx; if (avctx->width % 16 || avctx->height % 16) { av_log(avctx, AV_LOG_ERROR, "Dimensions must be a multiple of 16\n"); return AVERROR_PATCHWELCOME; } s->width = avctx->width...
[ 1, 0 ]
FFmpeg
libavcodec/mips/h264qpel_msa.c
void ff_put_h264_qpel8_mc01_msa(uint8_t *dst, const uint8_t *src, ptrdiff_t stride) { avc_luma_vt_qrt_8w_msa(src - (stride * 2), stride, dst, stride, 8, 0); }
[ 0, 0 ]
qemu
block.c
static void tracked_request_begin(BdrvTrackedRequest *req, BlockDriverState *bs, int64_t sector_num, int nb_sectors, bool is_write) { *req = (BdrvTrackedRequest){ .bs = bs, .sector_num = sector_num...
[ 1, 0 ]
qemu
hw/i386/kvmvapic.c
static void patch_call(VAPICROMState *s, X86CPU *cpu, target_ulong ip, uint32_t target) { uint32_t offset; offset = cpu_to_le32(target - ip - 5); patch_byte(cpu, ip, 0xe8); /* call near */ cpu_memory_rw_debug(CPU(cpu), ip + 1, (void *)&offset, sizeof(offset), 1); }
[ 1, 0 ]
qemu
target-ppc/mmu-hash64.c
static int ppc_hash64_pte_prot(CPUPPCState *env, ppc_slb_t *slb, ppc_hash_pte64_t pte) { 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) ...
[ 1, 0 ]
qemu
HACKING
static void omap_sysctl_write8(void *opaque, target_phys_addr_t addr, uint32_t value) { struct omap_sysctl_s *s = (struct omap_sysctl_s *)opaque; int pad_offset, byte_offset; int prev_value; switch (addr) { case 0x030 ... 0x140: /* CONTROL_PADCONF - only used in the POP *...
[ 1, 0 ]
qemu
crypto/block-luks.c
int qcrypto_pbkdf2(QCryptoHashAlgorithm hash G_GNUC_UNUSED, const uint8_t *key G_GNUC_UNUSED, size_t nkey G_GNUC_UNUSED, const uint8_t *salt G_GNUC_UNUSED, size_t nsalt G_GNUC_UNUSED, unsigned int iterations G_GNUC_UNUSE...
[ 0, 0 ]
qemu
hw/scsi/virtio-scsi.c
static void *virtio_scsi_load_request(QEMUFile *f, SCSIRequest *sreq) { SCSIBus *bus = sreq->bus; VirtIOSCSI *s = container_of(bus, VirtIOSCSI, bus); VirtIOSCSICommon *vs = VIRTIO_SCSI_COMMON(s); VirtIOSCSIReq *req; uint32_t n; req = g_malloc(sizeof(*req)); qemu_get_be32s(f, &n); assert(n < vs-...
[ 1, 1 ]
FFmpeg
ffmpeg.c
static int opt_streamid(const char *opt, const char *arg) { int idx; char *p; char idx_str[16]; av_strlcpy(idx_str, arg, sizeof(idx_str)); p = strchr(idx_str, ':'); if (!p) { fprintf(stderr, "Invalid value '%s' for option '%s', required syntax is " "'index:value'\n", ...
[ 1, 0 ]
FFmpeg
libavcodec/mips/h264qpel_msa.c
static void avc_luma_midv_qrt_16w_msa(const uint8_t *src, int32_t src_stride, uint8_t *dst, int32_t dst_stride, int32_t height, uint8_t vert_offset) { uint32_t multiple8_cnt; for (multiple8_cnt = 2; multiple8_cnt--;) { avc_luma_mi...
[ 0, 0 ]
qemu
hw/net/vmware_utils.h
static inline void vmxnet3_ring_read_curr_cell(Vmxnet3Ring *ring, void *buff) { vmw_shmem_read(vmxnet3_ring_curr_cell_pa(ring), buff, ring->cell_size); }
[ 1, 0 ]
FFmpeg
libavutil/rational.c
AVRational av_d2q(double d, int max) { AVRational a; int exponent; int64_t den; if (isnan(d)) return (AVRational){0, 0}; if (fabs(d) > INT_MAX + 3LL) return (AVRational){d < 0 ? -1 : 1, 0}; frexp(d, &exponent); exponent = FFMAX(exponent - 1, 0); den = 1LL << (61 - exponent); // (in...
[ 0, 0 ]
qemu
translate-all.c
static void tb_invalidate_phys_page(tb_page_addr_t addr, uintptr_t pc, void *puc) { TranslationBlock *tb; PageDesc *p; int n; #ifdef TARGET_HAS_PRECISE_SMC TranslationBlock *current_tb = NULL; CPUState *cpu = current_cpu; CPUArchState *env = NULL; int current_...
[ 1, 0 ]
FFmpeg
libavformat/rtpdec_mpeg4.c
static int rtp_parse_mp4_au(PayloadContext *data, const uint8_t *buf) { int au_headers_length, au_header_size, i; GetBitContext getbitcontext; /* decode the first 2 bytes where the AUHeader sections are stored length in bits */ au_headers_length = AV_RB16(buf); if (au_headers_length > RTP_MAX_PACK...
[ 1, 1 ]
qemu
block.c
void bdrv_set_on_error(BlockDriverState *bs, BlockdevOnError on_read_error, BlockdevOnError on_write_error) { bs->on_read_error = on_read_error; bs->on_write_error = on_write_error; }
[ 0, 0 ]
qemu
hw/acpi/aml-build.c
build_rsdt(GArray *table_data, GArray *linker, GArray *table_offsets) { AcpiRsdtDescriptorRev1 *rsdt; size_t rsdt_len; int i; const int table_data_len = (sizeof(uint32_t) * table_offsets->len); rsdt_len = sizeof(*rsdt) + table_data_len; rsdt = acpi_data_push(table_data, rsdt_len); memcpy(rsdt->tab...
[ 1, 0 ]
FFmpeg
libavformat/mov.c
static int mov_read_stts(MOVContext *c, ByteIOContext *pb, MOVAtom atom) { AVStream *st = c->fc->streams[c->fc->nb_streams - 1]; MOVStreamContext *sc = st->priv_data; unsigned int i, entries; int64_t duration = 0; int64_t total_sample_count = 0; get_byte(pb); /* version */ get_be24(pb); /* flags *...
[ 1, 0 ]
qemu
hw/arm/nseries.c
static void bt_submit_sco(struct HCIInfo *info, const uint8_t *data, int length) { struct bt_hci_s *hci = hci_from_info(info); uint16_t handle; int datalen; if (length < 3) return; handle = acl_handle((data[1] << 8) | data[0]); datalen = data[2]; length -= 3; if ...
[ 1, 1 ]
qemu
block/nbd.c
static SocketAddressLegacy *tcp_build_address(const char *host_port, Error **errp) { InetSocketAddress *iaddr = g_new(InetSocketAddress, 1); SocketAddressLegacy *saddr; if (inet_parse(iaddr, host_port, errp)) { qapi_free_InetSocketAddress(iaddr); return ...
[ 0, 0 ]
qemu
hw/vfio/pci.c
static void vfio_bar_quirk_teardown(VFIOPCIDevice *vdev, int nr) { VFIOBAR *bar = &vdev->bars[nr]; while (!QLIST_EMPTY(&bar->quirks)) { VFIOQuirk *quirk = QLIST_FIRST(&bar->quirks); memory_region_del_subregion(&bar->region.mem, &quirk->mem); object_unparent(OBJECT(&quirk->mem)); QLIST_REMOVE(...
[ 0, 0 ]
qemu
hw/lance.c
static int ne2000_can_receive(void *opaque) { NE2000State *s = opaque; int avail, index, boundary; if (s->cmd & E8390_STOP) return 0; index = s->curpag << 8; boundary = s->boundary << 8; if (index < boundary) avail = boundary - index; else avail = (s->stop - s->start) - (index - bou...
[ 1, 0 ]
qemu
Makefile
void qemu_aio_init(void) { struct sigaction act; aio_initialized = 1; sigfillset(&act.sa_mask); act.sa_flags = 0; /* do not restart syscalls to interrupt select() */ act.sa_handler = aio_signal_handler; sigaction(aio_sig_num, &act, NULL); #if defined(__GLIBC__) && defined(__linux__) { /* XXX...
[ 1, 1 ]
qemu
block.c
static void iscsi_retry_timer_expired(void *opaque) { struct IscsiTask *iTask = opaque; iTask->complete = 1; if (iTask->co) { qemu_coroutine_enter(iTask->co, NULL); } }
[ 1, 0 ]
FFmpeg
libavcodec/vorbis.c
static void render_line(int x0, uint8_t y0, int x1, int y1, float *buf) { int dy = y1 - y0; int adx = x1 - x0; int ady = FFABS(dy); int sy = dy < 0 ? -1 : 1; buf[x0] = ff_vorbis_floor1_inverse_db_table[y0]; if (ady * 2 <= adx) { // optimized common case render_line_unrolled(x0, y0, x1, sy, ady, ...
[ 1, 0 ]
qemu
block/cow.c
static inline int is_bit_set(BlockDriverState *bs, int64_t bitnum) { uint64_t offset = sizeof(struct cow_header_v2) + bitnum / 8; uint8_t bitmap; if (bdrv_pread(bs->file, offset, &bitmap, sizeof(bitmap)) != sizeof(bitmap)) { return -errno; } return !!(bitmap & (1 << (bitnum % 8))); }
[ 1, 0 ]
FFmpeg
libavcodec/mpegaudiodec_template.c
static void switch_buffer(MPADecodeContext *s, int *pos, int *end_pos, int *end_pos2) { if (s->in_gb.buffer && *pos >= s->gb.size_in_bits) { s->gb = s->in_gb; s->in_gb.buffer = NULL; assert((get_bits_count(&s->gb) & 7) == 0); skip_bits_long(&s->gb, *pos - *end_pos); ...
[ 1, 0 ]
qemu
hw/apb_pci.c
static void *iommu_init(target_phys_addr_t addr, uint32_t version, qemu_irq irq) { DeviceState *dev; SysBusDevice *s; dev = qdev_create(NULL, "iommu"); qdev_prop_set_uint32(dev, "version", version); qdev_init(dev); s = sysbus_from_qdev(dev); sysbus_connect_irq(s, 0, irq); sysbus_mmio_map(s, 0, ...
[ 1, 0 ]
qemu
tests/test-cutils.c
static void test_qemu_strtoull_full_empty(void) { const char *str = ""; uint64_t res = 999; int err; err = qemu_strtoull(str, NULL, 0, &res); g_assert_cmpint(err, ==, 0); g_assert_cmpint(res, ==, 0); }
[ 1, 0 ]
qemu
HACKING
static uint64_t jazz_led_read(void *opaque, target_phys_addr_t addr, unsigned int size) { LedState *s = opaque; uint8_t val; val = s->segments; trace_jazz_led_read(addr, val); return val; }
[ 0, 0 ]
qemu
Makefile
static void vnc_client_read(void *opaque) { VncState *vs = opaque; long ret; buffer_reserve(&vs->input, 4096); #ifdef CONFIG_VNC_TLS if (vs->tls_session) { ret = gnutls_read(vs->tls_session, buffer_end(&vs->input), 4096); if (ret < 0) { if (ret == GNUTLS_E_AGAIN) errno = EAGAIN; ...
[ 1, 0 ]
qemu
target-ppc/cpu.h
POWERPC_FAMILY(e5500)(ObjectClass *oc, void *data) { DeviceClass *dc = DEVICE_CLASS(oc); PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc); dc->desc = "e5500 core"; pcc->init_proc = init_proc_e5500; pcc->check_pow = check_pow_none; pcc->insns_flags = PPC_INSNS_BASE | PPC_ISEL | PPC_W...
[ 0, 1 ]
qemu
hmp.c
void hmp_change(Monitor *mon, const QDict *qdict) { const char *device = qdict_get_str(qdict, "device"); const char *target = qdict_get_str(qdict, "target"); const char *arg = qdict_get_try_str(qdict, "arg"); Error *err = NULL; if (strcmp(device, "vnc") == 0 && (strcmp(target, "passwd") == 0 || ...
[ 0, 0 ]
qemu
Makefile.objs
static void tight_send_compact_size(VncState *vs, size_t len) { int lpc = 0; int bytes = 0; char buf[3] = {0, 0, 0}; buf[bytes++] = len & 0x7F; if (len > 0x7F) { buf[bytes - 1] |= 0x80; buf[bytes++] = (len >> 7) & 0x7F; if (len > 0x3FFF) { buf[bytes - 1] |= 0x80; buf[bytes++...
[ 1, 0 ]
qemu
block-migration.c
static int sd_snapshot_goto(BlockDriverState *bs, const char *snapshot_id) { BDRVSheepdogState *s = bs->opaque; BDRVSheepdogState *old_s; char tag[SD_MAX_VDI_TAG_LEN]; uint32_t snapid = 0; int ret = 0; old_s = g_malloc(sizeof(BDRVSheepdogState)); memcpy(old_s, s, sizeof(BDRVSheepdogState)); sna...
[ 1, 0 ]
qemu
block/parallels.c
static int64_t allocate_clusters(BlockDriverState *bs, int64_t sector_num, int nb_sectors, int *pnum) { BDRVParallelsState *s = bs->opaque; uint32_t idx, to_allocate, i; int64_t pos, space; pos = block_status(s, sector_num, nb_sectors, pnum); if (pos > 0) { return ...
[ 1, 0 ]
qemu
tests/e1000e-test.c
static void send_scsi_cdb_read10(QPCIDevice *dev, void *ide_base, uint64_t lba, int nblocks) { Read10CDB pkt = {.padding = 0}; int i; g_assert_cmpint(lba, <=, UINT32_MAX); g_assert_cmpint(nblocks, <=, UINT16_MAX); g_assert_cmpint(nblocks, >=, 0); /* Construct SCSI CD...
[ 1, 0 ]
qemu
hw/i386/kvmvapic.c
static int vapic_prepare(VAPICROMState *s) { vapic_map_rom_writable(s); if (patch_hypercalls(s) < 0) { return -1; } vapic_enable_tpr_reporting(true); return 0; }
[ 1, 0 ]
FFmpeg
libavcodec/alsdec.c
static int read_channel_data(ALSDecContext *ctx, ALSChannelData *cd, int c) { GetBitContext *gb = &ctx->gb; ALSChannelData *current = cd; unsigned int channels = ctx->avctx->channels; int entries = 0; while (entries < channels && !(current->stop_flag = get_bits1(gb))) { current->master_channel = ge...
[ 1, 0 ]
FFmpeg
libavcodec/rv34.c
static int rv34_decoder_alloc(RV34DecContext *r) { r->intra_types_stride = r->s.mb_width * 4 + 4; r->cbp_chroma = av_malloc(r->s.mb_stride * r->s.mb_height * sizeof(*r->cbp_chroma)); r->cbp_luma = av_malloc(r->s.mb_stride * r->s.mb_height * sizeof(*r->cb...
[ 1, 0 ]
qemu
dump.c
static void dump_iterate(DumpState *s, Error **errp) { GuestPhysBlock *block; int64_t size; int ret; Error *local_err = NULL; while (1) { block = s->next_block; size = block->target_end - block->target_start; if (s->has_filter) { size -= s->start; if (s->begin + s->length < ...
[ 1, 0 ]
qemu
hw/apb_pci.c
fdctrl_t *fdctrl_init_sysbus(qemu_irq irq, int dma_chann, target_phys_addr_t mmio_base, DriveInfo **fds) { fdctrl_t *fdctrl; DeviceState *dev; fdctrl_sysbus_t *sys; dev = qdev_create(NULL, "sysbus-fdc"); sys = DO_UPCAST(fdctrl_sysbus_t, busdev....
[ 1, 1 ]
qemu
hw/usb/hcd-uhci.c
static void uhci_async_complete(USBPort *port, USBPacket *packet) { UHCIAsync *async = container_of(packet, UHCIAsync, packet); UHCIState *s = async->queue->uhci; if (async->isoc) { UHCI_TD td; uint32_t link = async->td; uint32_t int_mask = 0, val; pci_dma_read(&s->dev, link & ~0xf, &td, s...
[ 1, 0 ]
qemu
hw/9pfs/9p.c
static void virtio_input_handle_sts(VirtIODevice *vdev, VirtQueue *vq) { VirtIOInputClass *vic = VIRTIO_INPUT_GET_CLASS(vdev); VirtIOInput *vinput = VIRTIO_INPUT(vdev); virtio_input_event event; VirtQueueElement elem; int len; while (virtqueue_pop(vinput->sts, &elem)) { memset(&event, 0, sizeof(...
[ 1, 0 ]
qemu
qga/commands-posix.c
void qmp_guest_file_close(int64_t handle, Error **err) { GuestFileHandle *gfh = guest_file_handle_find(handle, err); int ret; slog("guest-file-close called, handle: %ld", handle); if (!gfh) { return; } ret = fclose(gfh->fh); if (ret == -1) { error_set(err, QERR_QGA_COMMAND_FAILED, "fclose...
[ 1, 0 ]
qemu
qemu-img.c
static int convert_read(ImgConvertState *s, int64_t sector_num, int nb_sectors, uint8_t *buf) { int n; int ret; if (s->status == BLK_ZERO || s->status == BLK_BACKING_FILE) { return 0; } assert(nb_sectors <= s->buf_sectors); while (nb_sectors > 0) { BlockBackend *blk;...
[ 1, 0 ]
qemu
MAINTAINERS
static int raw_co_ioctl(BlockDriverState *bs, unsigned long int req, void *buf) { BDRVRawState *s = bs->opaque; if (s->offset || s->has_size) { return -ENOTSUP; } return bdrv_co_ioctl(bs->file->bs, req, buf); }
[ 1, 0 ]
qemu
qemu-img.c
static void dump_map_entry(OutputFormat output_format, MapEntry *e, MapEntry *next) { switch (output_format) { case OFORMAT_HUMAN: if ((e->flags & BDRV_BLOCK_DATA) && !(e->flags & BDRV_BLOCK_OFFSET_VALID)) { error_report("File contains external, encrypted or compr...
[ 1, 0 ]
qemu
hw/tc58128.c
static void init_dev(tc58128_dev *dev, const char *filename) { int ret, blocks; dev->state = WAIT; dev->flash_contents = g_malloc0(FLASH_SIZE); memset(dev->flash_contents, 0xff, FLASH_SIZE); if (!dev->flash_contents) { fprintf(stderr, "could not alloc memory for flash\n"); exit(1); } if (...
[ 1, 0 ]
qemu
monitor.c
static int tcp_get_msgfd(CharDriverState *chr) { TCPCharDriver *s = chr->opaque; return s->msgfd; }
[ 1, 0 ]
qemu
block/qcow.c
static int qcow_make_empty(BlockDriverState *bs) { BDRVQcowState *s = bs->opaque; uint32_t l1_length = s->l1_size * sizeof(uint64_t); int ret; memset(s->l1_table, 0, l1_length); if (bdrv_pwrite(bs->file, s->l1_table_offset, s->l1_table, l1_length) < 0) return -1; ret = bdrv_truncate(bs->file, s-...
[ 1, 0 ]
FFmpeg
libavcodec/wmalosslessdec.c
static void decode_cdlms(WmallDecodeCtx *s) { int c, i; int cdlms_send_coef = get_bits1(&s->gb); for (c = 0; c < s->num_channels; c++) { s->cdlms_ttl[c] = get_bits(&s->gb, 3) + 1; for (i = 0; i < s->cdlms_ttl[c]; i++) { s->cdlms[c][i].order = (get_bits(&s->gb, 7) + 1) * 8; } for (i =...
[ 1, 0 ]
FFmpeg
libavcodec/diracdec.c
static void decode_block_params(DiracContext *s, DiracArith arith[8], DiracBlock *block, int stride, int x, int y) { int i; block->ref = pred_block_mode(block, stride, x, y, DIRAC_REF_MASK_REF1); block->ref ^= dirac_get_arith_bit(arith, CTX_PMOD...
[ 1, 0 ]
qemu
hw/input/Makefile.objs
static void adb_mouse_class_init(ObjectClass *oc, void *data) { DeviceClass *dc = DEVICE_CLASS(oc); ADBDeviceClass *adc = ADB_DEVICE_CLASS(oc); ADBMouseClass *amc = ADB_MOUSE_CLASS(oc); amc->parent_realize = dc->realize; dc->realize = adb_mouse_realizefn; set_bit(DEVICE_CATEGORY_INPUT, dc->categories...
[ 1, 0 ]
qemu
tests/ahci-test.c
static void test_dma_fragmented(void) { AHCIQState *ahci; AHCICommand *cmd; uint8_t px; size_t bufsize = 4096; unsigned char *tx = g_malloc(bufsize); unsigned char *rx = g_malloc0(bufsize); uint64_t ptr; ahci = ahci_boot_and_enable(NULL); px = ahci_port_select(ahci); ahci_port_clear(ahci,...
[ 1, 0 ]
qemu
docs/specs/acpi_pci_hotplug.txt
static uint32_t pcihotplug_read(void *opaque, uint32_t addr) { uint32_t val = 0; struct pci_status *g = opaque; switch (addr) { case PCI_BASE: val = g->up; break; case PCI_BASE + 4: val = g->down; break; default: break; } PIIX4_DPRINTF("pcihotplug read %x == %x\n", addr,...
[ 1, 0 ]
FFmpeg
libavformat/asfdec.c
static int w64_read_header(AVFormatContext *s, AVFormatParameters *ap) { int64_t size; AVIOContext *pb = s->pb; WAVContext *wav = s->priv_data; AVStream *st; uint8_t guid[16]; avio_read(pb, guid, 16); if (memcmp(guid, guid_riff, 16)) return -1; if (avio_rl64(pb) < 16 + 8 + 16 + 8 + 16 + 8)...
[ 1, 0 ]
FFmpeg
libavformat/asf.c
int av_read_pause(AVFormatContext *s) { if (s->iformat->read_pause) return s->iformat->read_pause(s); if (s->pb && s->pb->read_pause) return av_url_read_fpause(s->pb, 1); return AVERROR(ENOSYS); }
[ 1, 0 ]
qemu
tests/vhost-user-test.c
static void *thread_function(void *data) { GMainLoop *loop; loop = g_main_loop_new(NULL, FALSE); g_main_loop_run(loop); return NULL; }
[ 1, 0 ]
FFmpeg
libavcodec/apedec.c
static void decode_array_0000(APEContext *ctx, GetBitContext *gb, int32_t *out, APERice *rice, int blockstodecode) { int i; int ksummax, ksummin; rice->ksum = 0; for (i = 0; i < 5; i++) { out[i] = get_rice_ook(&ctx->gb, 10); rice->ksum += out[i]; } rice->k = av...
[ 1, 0 ]
qemu
kvm-all.c
int kvm_irqchip_send_msi(KVMState *s, MSIMessage msg) { struct kvm_msi msi; KVMMSIRoute *route; if (s->direct_msi) { msi.address_lo = (uint32_t)msg.address; msi.address_hi = msg.address >> 32; msi.data = le32_to_cpu(msg.data); msi.flags = 0; memset(msi.pad, 0, sizeof(msi.pad)); r...
[ 1, 0 ]
FFmpeg
libavcodec/mpegaudiodec.c
static void imdct12(int *out, int *in) { int in0, in1, in2, in3, in4, in5, t1, t2; in0 = in[0 * 3] << 5; in1 = (in[1 * 3] + in[0 * 3]) << 5; in2 = (in[2 * 3] + in[1 * 3]) << 5; in3 = (in[3 * 3] + in[2 * 3]) << 5; in4 = (in[4 * 3] + in[3 * 3]) << 5; in5 = (in[5 * 3] + in[4 * 3]) << 5; in5 += in3...
[ 1, 0 ]