Projectname
large_stringclasses
15 values
Filepath
large_stringlengths
4
106
Function
large_stringlengths
11
3.45k
Label
list
qemu
backends/baum.c
static int net_init_nic(const NetClientOptions *opts, const char *name, NetClientState *peer, Error **errp) { int idx; NICInfo *nd; const NetLegacyNicOptions *nic; assert(opts->type == NET_CLIENT_OPTIONS_KIND_NIC); nic = opts->u.nic; idx = nic_get_free_idx(); if (idx == -1...
[ 1, 0 ]
qemu
ui/gtk.c
static gboolean gd_button_event(GtkWidget *widget, GdkEventButton *button, void *opaque) { VirtualConsole *vc = opaque; GtkDisplayState *s = vc->s; InputButton btn; /* implicitly grab the input at the first click in the relative mode */ if (button->button == 1 && button-...
[ 1, 0 ]
FFmpeg
libavformat/crypto.c
static int crypto_close(URLContext *h) { CryptoContext *c = h->priv_data; if (c->hd) ffurl_close(c->hd); av_freep(&c->aes); av_freep(&c->key); av_freep(&c->iv); return 0; }
[ 1, 0 ]
qemu
tests/Makefile.include
static void vmgenid_set_guid_auto_test(void) { const char *cmd; QemuUUID measured; cmd = "-machine accel=tcg -device vmgenid,id=testvgid," "guid=auto"; qtest_start(cmd); read_guid_from_memory(&measured); /* Just check that the GUID is non-null */ g_assert(!qemu_uuid_is_null(&measured)); ...
[ 1, 0 ]
FFmpeg
libswresample/swresample_frame.c
int swr_convert_frame(SwrContext *s, AVFrame *out, const AVFrame *in) { int ret, setup = 0; if (!swr_is_initialized(s)) { if ((ret = swr_config_frame(s, out, in)) < 0) return ret; if ((ret = swr_init(s)) < 0) return ret; setup = 1; } else { // return as...
[ 1, 0 ]
FFmpeg
libavcodec/utils.c
int avcodec_decode_audio(AVCodecContext *avctx, int16_t *samples, int *frame_size_ptr, uint8_t *buf, int buf_size) { int ret; *frame_size_ptr = 0; ret = avctx->codec->decode(avctx, samples, frame_size_ptr, buf, buf_size); avc...
[ 0, 0 ]
qemu
hw/block/m25p80.c
static uint32_t m25p80_transfer8(SSISlave *ss, uint32_t tx) { Flash *s = M25P80(ss); uint32_t r = 0; switch (s->state) { case STATE_PAGE_PROGRAM: DB_PRINT_L(1, "page program cur_addr=%#" PRIx64 " data=%" PRIx8 "\n", s->cur_addr, (uint8_t)tx); flash_write8(s, s->cur_addr, (uint8_t)...
[ 1, 0 ]
FFmpeg
libavformat/utils.c
static int init_input(AVFormatContext *s, const char *filename, AVDictionary **options) { int ret; AVProbeData pd = {filename, NULL, 0}; if (s->iformat && !strlen(filename)) return 0; if (s->pb) { s->flags |= AVFMT_FLAG_CUSTOM_IO; if (!s->iformat) return av_probe...
[ 1, 0 ]
qemu
target-arm/translate.c
static inline void gen_add_data_offset(DisasContext *s, unsigned int insn, TCGv var) { int val, rm, shift, shiftop; TCGv offset; if (!(insn & (1 << 25))) { /* immediate */ val = insn & 0xfff; if (!(insn & (1 << 23))) val = -val; if (val != 0) ...
[ 1, 0 ]
qemu
ui/vnc-jobs-async.c
static void vnc_async_encoding_end(VncState *orig, VncState *local) { orig->tight = local->tight; orig->zlib = local->zlib; orig->hextile = local->hextile; orig->zrle = local->zrle; orig->lossy_rect = local->lossy_rect; }
[ 1, 0 ]
qemu
qemu-char.c
static gboolean tcp_chr_read(GIOChannel *chan, GIOCondition cond, void *opaque) { CharDriverState *chr = opaque; TCPCharDriver *s = chr->opaque; uint8_t buf[READ_BUF_LEN]; int len, size; if (!s->connected || s->max_size <= 0) { return FALSE; } len = sizeof(buf); if (len > s->max_size) ...
[ 1, 0 ]
qemu
target-ppc/cpu.h
static void gen_lwarx(DisasContext *ctx) { TCGv t0; gen_set_access_type(ctx, ACCESS_RES); t0 = tcg_temp_local_new(); gen_addr_reg_index(ctx, t0); gen_check_align(ctx, t0, 0x03); gen_qemu_ld32u(ctx, cpu_gpr[rD(ctx->opcode)], t0); tcg_gen_mov_tl(cpu_reserve, t0); tcg_temp_free(t0); }
[ 0, 0 ]
qemu
hw/i386/acpi-build.c
static void vtd_iommu_replay(IOMMUMemoryRegion *iommu_mr, IOMMUNotifier *n) { VTDAddressSpace *vtd_as = container_of(iommu_mr, VTDAddressSpace, iommu); IntelIOMMUState *s = vtd_as->iommu_state; uint8_t bus_n = pci_bus_num(vtd_as->bus); VTDContextEntry ce; /* * The replay can be triggered by either a...
[ 0, 0 ]
qemu
block/qcow2-cluster.c
static int count_contiguous_clusters(int nb_clusters, int cluster_size, uint64_t *l2_table, uint64_t stop_flags) { int i; QCow2ClusterType first_cluster_type; uint64_t mask = stop_flags | L2E_OFFSET_MASK | QCOW_OFLAG_COMPRESSED; uint64_t first_entry = be64_to_cpu(l2_ta...
[ 1, 0 ]
qemu
hw/ide/core.c
static void ide_init1(IDEBus *bus, int unit, DriveInfo *dinfo) { static int drive_serial = 1; IDEState *s = &bus->ifs[unit]; s->bus = bus; s->unit = unit; s->drive_serial = drive_serial++; s->io_buffer = qemu_blockalign(s->bs, IDE_DMA_BUF_SECTORS * 512 + 4); s->io_buffer_total_len = IDE_DMA_BUF_SE...
[ 1, 0 ]
FFmpeg
libavutil/opt.c
int av_opt_set_dict2(void *obj, AVDictionary **options, int search_flags) { AVDictionaryEntry *t = NULL; AVDictionary *tmp = NULL; int ret = 0; if (!options) return 0; while ((t = av_dict_get(*options, "", t, AV_DICT_IGNORE_SUFFIX))) { ret = av_opt_set(obj, t->key, t->value, search_flags); ...
[ 1, 0 ]
qemu
check-qjson.c
START_TEST(empty_input) { const char *empty = ""; QObject *obj = qobject_from_json(empty); fail_unless(obj == NULL); }
[ 0, 0 ]
qemu
hw/sd.c
static inline int sd_wp_addr(SDState *sd, uint32_t addr) { return sd->wp_groups[addr >> (HWBLOCK_SHIFT + SECTOR_SHIFT + WPGROUP_SHIFT)]; }
[ 0, 0 ]
qemu
hw/ppc/spapr_drc.c
void spapr_drc_detach(sPAPRDRConnector *drc) { trace_spapr_drc_detach(spapr_drc_index(drc)); drc->unplug_requested = true; if (drc->isolation_state != SPAPR_DR_ISOLATION_STATE_ISOLATED) { trace_spapr_drc_awaiting_isolated(spapr_drc_index(drc)); return; } if (spapr_drc_type(drc) != SPAPR_DR_CONN...
[ 1, 0 ]
qemu
tests/rcutorture.c
static void *rcu_q_reader(void *arg) { long long j, n_reads_local = 0; struct list_element *el; *(struct rcu_reader_data **)arg = &rcu_reader; atomic_inc(&nthreadsrunning); while (goflag == GOFLAG_INIT) { g_usleep(1000); } while (goflag == GOFLAG_RUN) { rcu_read_lock(); QLIST_FOREACH...
[ 0, 0 ]
qemu
vnc.c
static int protocol_client_auth(VncState *vs, char *data, size_t len) { /* We only advertise 1 auth scheme at a time, so client * must pick the one we sent. Verify this */ if (data[0] != vs->auth) { /* Reject auth */ VNC_DEBUG("Reject auth %d\n", (int)data[0]); vnc_write_u32(vs, 1); if (vs->mi...
[ 1, 0 ]
qemu
memory.c
void address_space_init(AddressSpace *as, MemoryRegion *root) { memory_region_transaction_begin(); as->root = root; as->current_map = g_new(FlatView, 1); flatview_init(as->current_map); as->ioeventfd_nb = 0; as->ioeventfds = NULL; QTAILQ_INSERT_TAIL(&address_spaces, as, address_spaces_link); as...
[ 0, 0 ]
FFmpeg
libavcodec/ra288.c
static int ra288_decode_frame(AVCodecContext *avctx, void *data, int *data_size, const uint8_t *buf, int buf_size) { int16_t *out = data; int i, j; RA288Context *ractx = avctx->priv_data; GetBitContext gb; if (buf_size < avctx->block_align) {...
[ 1, 0 ]
FFmpeg
libavcodec/h264.c
static void filter_mb_edgech(H264Context *h, uint8_t *pix, int stride, int16_t bS[4], int qp) { int i; const int index_a = qp + h->slice_alpha_c0_offset; const int alpha = (alpha_table + 52)[index_a]; const int beta = (beta_table + 52)[qp + h->slice_beta_offset]; if (bS[0] < ...
[ 0, 0 ]
qemu
HACKING
dma_write(void *opaque, target_phys_addr_t addr, uint64_t val64, unsigned int size) { struct fs_dma_ctrl *ctrl = opaque; uint32_t value = val64; int c; if (size != 4) { dma_winvalid(opaque, addr, value); } /* Make addr relative to this channel and bounded to nr regs. */ c = fs_chan...
[ 1, 0 ]
qemu
Makefile.objs
static int qemu_event_init(void) { int err; int fds[2]; err = qemu_eventfd(fds); if (err == -1) { return -errno; } err = fcntl_setfl(fds[0], O_NONBLOCK); if (err < 0) { goto fail; } err = fcntl_setfl(fds[1], O_NONBLOCK); if (err < 0) { goto fail; } qemu_set_fd_handler2(f...
[ 0, 0 ]
qemu
hw/core/machine.c
static void machine_set_kernel_irqchip(Object *obj, bool value, Error **errp) { MachineState *ms = MACHINE(obj); ms->kernel_irqchip = value; }
[ 0, 0 ]
qemu
exec.c
static void x86_cpu_unrealizefn(DeviceState *dev, Error **errp) { X86CPU *cpu = X86_CPU(dev); #ifndef CONFIG_USER_ONLY cpu_remove_sync(CPU(dev)); qemu_unregister_reset(x86_cpu_machine_reset_cb, dev); #endif if (cpu->apic_state) { object_unparent(OBJECT(cpu->apic_state)); cpu->apic_state = NULL;...
[ 1, 0 ]
qemu
hw/ppc/spapr_ovec.c
int spapr_ovec_populate_dt(void *fdt, int fdt_offset, sPAPROptionVector *ov, const char *name) { uint8_t vec[OV_MAXBYTES + 1]; uint16_t vec_len; unsigned long lastbit; int i; g_assert(ov); lastbit = find_last_bit(ov->bitmap, OV_MAXBITS); /* if no bits are set, include a...
[ 1, 0 ]
FFmpeg
libavcodec/aac.c
static int decode_tns(AACContext *ac, TemporalNoiseShaping *tns, GetBitContext *gb, const IndividualChannelStream *ics) { int w, filt, i, coef_len, coef_res, coef_compress; const int is8 = ics->window_sequence[0] == EIGHT_SHORT_SEQUENCE; const int tns_max_order = is8 ...
[ 1, 0 ]
qemu
configure
static int net_client_init1(const void *object, int is_netdev, Error **errp) { union { const Netdev *netdev; const NetLegacy *net; } u; const NetClientOptions *opts; const char *name; if (is_netdev) { u.netdev = object; opts = u.netdev->opts; name = u.netdev->id; switch (op...
[ 1, 1 ]
qemu
hw/core/qdev-properties.c
static void xilinx_enet_realize(DeviceState *dev, Error **errp) { XilinxAXIEnet *s = XILINX_AXI_ENET(dev); XilinxAXIEnetStreamSlave *ds = XILINX_AXI_ENET_DATA_STREAM(&s->rx_data_dev); XilinxAXIEnetStreamSlave *cs = XILINX_AXI_ENET_CONTROL_STREAM( &s->rx_control_dev); Error *local_errp = NULL; obj...
[ 1, 0 ]
qemu
block/nbd.c
static int nbd_open(BlockDriverState *bs, QDict *options, int flags, Error **errp) { BDRVNBDState *s = bs->opaque; char *export = NULL; int result, sock; Error *local_err = NULL; /* Pop the config into our state object. Exit if invalid. */ nbd_config(s, options, &export, &local_e...
[ 1, 1 ]
FFmpeg
libswscale/ppc/swscale_altivec.c
static av_always_inline void hyscale(SwsContext *c, int16_t *dst, int dstWidth, const uint8_t *src_in[4], int srcW, int xInc, const int16_t *hLumFilter, const int16_t *hLumFilterPos, int hLumFilterSize, uint8_t *formatConvBuffer, uint32_t *pal, int isAlpha) { void (*toYV...
[ 1, 0 ]
FFmpeg
libavfilter/defaults.c
int avfilter_default_query_formats(AVFilterContext *ctx) { enum AVMediaType type = ctx->inputs[0] ? ctx->inputs[0]->type : ctx->outputs[0] ? ctx->outputs[0]->type : AVMEDIA_TYPE_VIDEO; avfilter_set_com...
[ 1, 0 ]
FFmpeg
libswscale/swscale_template.c
static inline void RENAME(yuv2yuv1)(int16_t *lumSrc, int16_t *chrSrc, uint8_t *dest, uint8_t *uDest, uint8_t *vDest, long dstW, long chrDstW) { #ifdef HAVE_MMX if (uDest != NULL) { asm volatile( YSCALEYUV2YV121 ::"r"...
[ 1, 0 ]
qemu
kvm-all.c
static int kvm_physical_sync_dirty_bitmap(MemoryRegionSection *section) { KVMState *s = kvm_state; unsigned long size, allocated_size = 0; KVMDirtyLog d; KVMSlot *mem; int ret = 0; hwaddr start_addr = section->offset_within_address_space; hwaddr end_addr = start_addr + int128_get64(section->size);...
[ 1, 1 ]
qemu
block.c
int bdrv_check(BlockDriverState *bs) { if (bs->drv->bdrv_check == NULL) { return -ENOTSUP; } return bs->drv->bdrv_check(bs); }
[ 1, 0 ]
FFmpeg
libavcodec/motionpixels.c
static av_cold int mp_decode_init(AVCodecContext *avctx) { MotionPixelsContext *mp = avctx->priv_data; int w4 = (avctx->width + 3) & ~3; int h4 = (avctx->height + 3) & ~3; if (avctx->extradata_size < 2) { av_log(avctx, AV_LOG_ERROR, "extradata too small\n"); return AVERROR_INVALIDDATA; } mot...
[ 1, 0 ]
qemu
target-ppc/op.c
void OPPROTO op_subfme_64(void) { T0 = ~T0 + xer_ca - 1; if (likely((uint64_t)T0 != (uint64_t)-1)) xer_ca = 1; RETURN(); }
[ 1, 0 ]
qemu
block/qapi.c
void qmp_block_set_io_throttle(const char *device, int64_t bps, int64_t bps_rd, int64_t bps_wr, int64_t iops, int64_t iops_rd, int64_t iops_wr, Error **errp) { ThrottleConfig cfg; BlockDriverState *bs; bs = bdrv_find(device); if (!bs) { e...
[ 1, 0 ]
FFmpeg
libavcodec/vorbis.c
void ff_vorbis_ready_floor1_list(vorbis_floor1_entry *list, int values) { int i; list[0].sort = 0; list[1].sort = 1; for (i = 2; i < values; i++) { int j; list[i].low = 0; list[i].high = 1; list[i].sort = i; for (j = 2; j < i; j++) { int tmp = list[j].x; if (tmp < lis...
[ 1, 0 ]
FFmpeg
libavcodec/ffv1.c
static int read_quant_table(RangeCoder *c, int16_t *quant_table, int scale) { int v; int i = 0; uint8_t state[CONTEXT_SIZE]; memset(state, 128, sizeof(state)); for (v = 0; i < 128; v++) { int len = get_symbol(c, state, 0) + 1; if (len + i > 128) return -1; while (len--) { quan...
[ 1, 0 ]
qemu
linux-user/signal.c
static void setup_rt_frame_v1(int usig, struct target_sigaction *ka, target_siginfo_t *info, target_sigset_t *set, CPUARMState *env) { struct rt_sigframe_v1 *frame; abi_ulong frame_addr = get_sigframe(ka, env, sizeof(*frame)); struct target_sigalts...
[ 1, 0 ]
qemu
block.c
static int do_co_pwrite_zeroes(BlockBackend *blk, int64_t offset, int64_t count, int flags, int64_t *total) { Coroutine *co; CoWriteZeroes data = { .blk = blk, .offset = offset, .count = count, .total = total, .flags = flags, .done = false...
[ 1, 0 ]
qemu
hw/apb_pci.c
static void idreg_init(target_phys_addr_t addr) { DeviceState *dev; SysBusDevice *s; dev = qdev_create(NULL, "macio_idreg"); qdev_init(dev); s = sysbus_from_qdev(dev); sysbus_mmio_map(s, 0, addr); cpu_physical_memory_write_rom(addr, idreg_data, sizeof(idreg_data)); }
[ 1, 0 ]
qemu
ui/vnc.c
static int vnc_display_listen_addr(VncDisplay *vd, SocketAddress *addr, const char *name, QIOChannelSocket ***lsock, guint **lsock_tag, size...
[ 1, 0 ]
qemu
tests/tcg/cris/check_abs.c
static inline void cris_ftag_i(unsigned int x) { register unsigned int v asm("$r10") = x; asm("ftagi\t[%0]\n" : : "r"(v)); }
[ 1, 0 ]
qemu
target-ppc/kvm.c
int kvm_arch_insert_sw_breakpoint(CPUState *cpu, struct kvm_sw_breakpoint *bp) { return -EINVAL; }
[ 1, 0 ]
qemu
hmp-commands.hx
void pcmcia_socket_register(PCMCIASocket *socket) { struct pcmcia_socket_entry_s *entry; entry = g_malloc(sizeof(struct pcmcia_socket_entry_s)); entry->socket = socket; entry->next = pcmcia_sockets; pcmcia_sockets = entry; }
[ 1, 0 ]
FFmpeg
libavcodec/h264_cavlc.c
static av_cold void init_cavlc_level_tab(void) { int suffix_length, mask; unsigned int i; for (suffix_length = 0; suffix_length < 7; suffix_length++) { for (i = 0; i < (1 << LEVEL_TAB_BITS); i++) { int prefix = LEVEL_TAB_BITS - av_log2(2 * i); int level_code = (prefix << suffix_length) + ...
[ 1, 0 ]
qemu
hw/9pfs/9p-local.c
static int local_link(FsContext *ctx, V9fsPath *oldpath, V9fsPath *dirpath, const char *name) { int ret; V9fsString newpath; char *buffer, *buffer1; int serrno; v9fs_string_init(&newpath); v9fs_string_sprintf(&newpath, "%s/%s", dirpath->data, name); buffer = rpath(ctx, oldpa...
[ 1, 0 ]
qemu
hw/bt/core.c
static uint8_t *csrhci_out_packet(struct csrhci_s *s, int len) { int off = s->out_start + s->out_len; /* TODO: do the padding here, i.e. align len */ s->out_len += len; if (off < FIFO_LEN) { if (off + len > FIFO_LEN && (s->out_size = off + len) > FIFO_LEN * 2) { fprintf(stderr, "%s: can't alloc...
[ 1, 1 ]
qemu
qom/object_interfaces.c
static void test_dummy_createcmdl(void) { QemuOpts *opts; DummyObject *dobj; Error *err = NULL; const char *params = TYPE_DUMMY ",id=dev0," "bv=yes,sv=Hiss hiss hiss,av=platypus"; qemu_add_opts(&qemu_object_opts); opts = qemu_opts_parse(&qemu_object_opts, params, true, &err); g_asser...
[ 0, 1 ]
FFmpeg
libavcodec/h261.c
static int h261_find_frame_end(ParseContext *pc, AVCodecContext *avctx, const uint8_t *buf, int buf_size) { int vop_found, i, j, bits_left, last_bits; uint32_t state; H261Context *h = avctx->priv_data; if (h) { bits_left = h->bits_left; last_bits = h->last_bits; }...
[ 1, 1 ]
qemu
hw/net/ne2000-isa.c
int ne2000_can_receive(NetClientState *nc) { NE2000State *s = qemu_get_nic_opaque(nc); if (s->cmd & E8390_STOP) return 1; return !ne2000_buffer_full(s); }
[ 0, 0 ]
FFmpeg
ffserver.c
static int ffm_write_write_index(int fd, int64_t pos) { uint8_t buf[8]; int i; for (i = 0; i < 8; i++) buf[i] = (pos >> (56 - i * 8)) & 0xff; lseek(fd, 8, SEEK_SET); if (write(fd, buf, 8) != 8) return AVERROR(EIO); return 8; }
[ 1, 0 ]
FFmpeg
libavcodec/atrac1.c
static int atrac1_decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; AT1Ctx *q = avctx->priv_data; int ch, ret, i; GetBitContext gb; float *samples = data; if (buf_size < 2...
[ 1, 1 ]
qemu
qemu-char.c
CharDriverState *qemu_chr_alloc(void) { CharDriverState *chr = g_malloc0(sizeof(CharDriverState)); return chr; }
[ 1, 0 ]
qemu
block/vmdk.c
static int vmdk_is_cid_valid(BlockDriverState *bs) { BDRVVmdkState *s = bs->opaque; uint32_t cur_pcid; if (!s->cid_checked && bs->backing) { BlockDriverState *p_bs = bs->backing->bs; cur_pcid = vmdk_read_cid(p_bs, 0); if (s->parent_cid != cur_pcid) { /* CID not valid */ return 0; ...
[ 1, 0 ]
FFmpeg
libavformat/isom.h
static inline int mov_stsc_index_valid(int index, int count) { return index + 1 < count; }
[ 1, 0 ]
qemu
hw/apb_pci.c
static void ecc_init(target_phys_addr_t base, qemu_irq irq, uint32_t version) { DeviceState *dev; SysBusDevice *s; dev = qdev_create(NULL, "eccmemctl"); 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 ]
FFmpeg
libavcodec/snow.c
static void correlate_slice_buffered(SnowContext *s, slice_buffer *sb, SubBand *b, DWTELEM *src, int stride, int inverse, int use_median, int start_y, int end_y) { const int w = b->width; int x, y; //...
[ 1, 0 ]
FFmpeg
libavcodec/srtdec.c
static void srt_to_ass(AVCodecContext *avctx, AVBPrint *dst, const char *in, int x1, int y1, int x2, int y2) { if (x1 >= 0 && y1 >= 0) { /* XXX: here we rescale coordinate assuming they are in DVD resolution * (720x480) since we don't have anything better */ if (x2 >= 0 && y2...
[ 1, 1 ]
FFmpeg
libavcodec/rv34dsp.c
static void rv34_idct_add_c(uint8_t *dst, ptrdiff_t stride, DCTELEM *block) { int temp[16]; uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; int i; rv34_row_transform(temp, block); memset(block, 0, 16 * sizeof(DCTELEM)); for (i = 0; i < 4; i++) { const int z0 = 13 * (temp[4 * 0 + i] + temp[4 * 2 + i]) + ...
[ 1, 0 ]
qemu
block/vmdk.c
static int vmdk_init_tables(BlockDriverState *bs, VmdkExtent *extent, Error **errp) { int ret; int l1_size, i; /* read the L1 table */ l1_size = extent->l1_size * sizeof(uint32_t); extent->l1_table = g_try_malloc(l1_size); if (l1_size && extent->l1_table == NULL) { r...
[ 1, 0 ]
qemu
block.c
static int bdrv_inactivate_recurse(BlockDriverState *bs, bool setting_flag) { BdrvChild *child, *parent; int ret; if (!setting_flag && bs->drv->bdrv_inactivate) { ret = bs->drv->bdrv_inactivate(bs); if (ret < 0) { return ret; } } if (setting_flag) ...
[ 1, 0 ]
qemu
fsdev/virtio-9p-marshal.c
static size_t v9fs_unpack(void *dst, struct iovec *out_sg, int out_num, size_t offset, size_t size) { return v9fs_packunpack(dst, out_sg, out_num, offset, size, 0); }
[ 0, 0 ]
qemu
block/nbd.c
static void socket_start_outgoing_migration(MigrationState *s, SocketAddressLegacy *saddr, Error **errp) { QIOChannelSocket *sioc = qio_channel_socket_new(); struct SocketConnectData *data = g_new0(struct SocketConnectData,...
[ 0, 0 ]
qemu
event_notifier-posix.c
void event_notifier_cleanup(EventNotifier *e) { close(e->fd); }
[ 0, 0 ]
qemu
cpu-exec.c
static void alpha_translate_init(void) { int i; char *p; static int done_init = 0; if (done_init) return; cpu_env = tcg_global_reg_new(TCG_TYPE_PTR, TCG_AREG0, "env"); p = cpu_reg_names; for (i = 0; i < 31; i++) { sprintf(p, "ir%d", i); cpu_ir[i] = tcg_global_mem_new(TCG_TYPE_I64, T...
[ 1, 0 ]
qemu
HACKING
static void bw_conf1_write(void *opaque, target_phys_addr_t addr, uint64_t val, unsigned size) { PCIBus *b = opaque; pci_data_write(b, addr, val, size); }
[ 0, 0 ]
qemu
HACKING
static uint64_t a9_scu_read(void *opaque, target_phys_addr_t offset, unsigned size) { a9mp_priv_state *s = (a9mp_priv_state *)opaque; switch (offset) { case 0x00: /* Control */ return s->scu_control; case 0x04: /* Configuration */ return (((1 << s->num_cpu) - 1) << 4)...
[ 1, 0 ]
qemu
Makefile.objs
bool qemu_clock_use_for_deadline(QEMUClockType type) { return !(use_icount && (type == QEMU_CLOCK_VIRTUAL)); }
[ 0, 0 ]
qemu
audio/alsaaudio.c
int audio_pcm_sw_read(SWVoiceIn *sw, void *buf, int size) { HWVoiceIn *hw = sw->hw; int samples, live, ret = 0, swlim, isamp, osamp, rpos, total = 0; st_sample_t *src, *dst = sw->buf; rpos = audio_pcm_sw_get_rpos_in(sw) % hw->samples; live = hw->total_samples_captured - sw->total_hw_samples_acquired; ...
[ 1, 1 ]
qemu
hw/dp8393x.c
static void vde_from_qemu(void *opaque, const uint8_t *buf, int size) { VDEState *s = opaque; int ret; for (;;) { ret = vde_send(s->vde, (const char *)buf, size, 0); if (ret < 0 && errno == EINTR) { } else { break; } } }
[ 1, 0 ]
FFmpeg
libavutil/mem.c
void *av_malloc(unsigned int size) { void *ptr = NULL; #if CONFIG_MEMALIGN_HACK long diff; #endif /* let's disallow possible ambiguous cases */ if (size > (INT_MAX - 16)) return NULL; #if CONFIG_MEMALIGN_HACK ptr = malloc(size + 16); if (!ptr) return ptr; diff = ((-(long)ptr - 1) & 15...
[ 1, 0 ]
qemu
tests/e1000e-test.c
static void test_tco1_status_bits(void) { TestData d; uint16_t ticks = 8; uint16_t val; int ret; d.args = NULL; d.noreboot = true; test_init(&d); stop_tco(&d); clear_tco_status(&d); reset_on_second_timeout(false); set_tco_timeout(&d, ticks); load_tco(&d); start_tco(&d); clock_...
[ 1, 0 ]
qemu
block/crypto.c
block_crypto_create_opts_init(QCryptoBlockFormat format, QemuOpts *opts, Error **errp) { OptsVisitor *ov; QCryptoBlockCreateOptions *ret = NULL; Error *local_err = NULL; ret = g_new0(QCryptoBlockCreateOptions, 1); ret->format = format; ov ...
[ 1, 0 ]
FFmpeg
libavcodec/mpegaudiodec.c
static inline int l2_unscale_group(int steps, int mant, int scale_factor) { int shift, mod, val; shift = scale_factor_modshift[scale_factor]; mod = shift & 3; shift >>= 2; /* XXX: store the result directly */ val = (2 * (mant - (steps >> 1))) * scale_factor_mult2[steps >> 2][mod]; return (val + (1...
[ 1, 1 ]
FFmpeg
libavcodec/mss2.c
static void arith2_normalise(ArithCoder *c) { while ((c->high >> 15) - (c->low >> 15) < 2) { if ((c->low ^ c->high) & 0x10000) { c->high ^= 0x8000; c->value ^= 0x8000; c->low ^= 0x8000; } c->high = c->high << 8 & 0xFFFFFF | 0xFF; c->value = c->value << 8 & 0xFFFFFF | bytestre...
[ 1, 0 ]
qemu
hw/usb-bus.c
static int usb_qdev_init(DeviceState *qdev, DeviceInfo *base) { USBDevice *dev = DO_UPCAST(USBDevice, qdev, qdev); USBDeviceInfo *info = DO_UPCAST(USBDeviceInfo, qdev, base); int rc; pstrcpy(dev->product_desc, sizeof(dev->product_desc), info->product_desc); dev->info = info; dev->auto_attach = 1; ...
[ 1, 0 ]
qemu
Makefile.objs
static int usb_net_handle_data(USBDevice *dev, USBPacket *p) { USBNetState *s = (USBNetState *)dev; int ret = 0; switch (p->pid) { case USB_TOKEN_IN: switch (p->devep) { case 1: ret = usb_net_handle_statusin(s, p); break; case 2: ret = usb_net_handle_datain(s, p); ...
[ 1, 0 ]
FFmpeg
libavformat/nsvdec.c
static int nsv_read_close(AVFormatContext *s) { /* int i; */ NSVContext *nsv = s->priv_data; av_freep(&nsv->nsvs_file_offset); av_freep(&nsv->nsvs_timestamps); #if 0 for(i=0;i<s->nb_streams;i++) { AVStream *st = s->streams[i]; NSVStream *ast = st->priv_data; if(ast){ ...
[ 1, 0 ]
qemu
hw/qdev-properties.c
static void bit_prop_set(DeviceState *dev, Property *props, bool val) { uint32_t *p = qdev_get_prop_ptr(dev, props); uint32_t mask = qdev_get_prop_mask(props); if (val) *p |= ~mask; else *p &= ~mask; }
[ 1, 0 ]
qemu
hw/net/vmware_utils.h
static void vmxnet3_adjust_by_guest_type(VMXNET3State *s) { struct Vmxnet3_GOSInfo gos; VMXNET3_READ_DRV_SHARED(s->drv_shmem, devRead.misc.driverInfo.gos, &gos, sizeof(gos)); s->rx_packets_compound = (gos.gosType == VMXNET3_GOS_TYPE_WIN) ? false : true; VMW_CFPRN("Guest ty...
[ 1, 0 ]
FFmpeg
libavcodec/avpacket.c
int av_grow_packet(AVPacket *pkt, int grow_by) { int new_size; av_assert0((unsigned)pkt->size <= INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE); if ((unsigned)grow_by > INT_MAX - (pkt->size + AV_INPUT_BUFFER_PADDING_SIZE)) return -1; new_size = pkt->size + grow_by + AV_INPUT_BUFFER_PADDING_SIZE; if...
[ 1, 0 ]
qemu
Makefile.objs
bool migration_in_setup(MigrationState *s) { return s->state == MIG_STATE_SETUP; }
[ 1, 0 ]
qemu
exec-all.h
static void unassigned_mem_writew(void *opaque, target_phys_addr_t addr, uint32_t val) { #ifdef DEBUG_UNASSIGNED printf("Unassigned mem write " TARGET_FMT_plx " = 0x%x\n", addr, val); #endif #if defined(TARGET_ALPHA) || defined(TARGET_SPARC) || defined(TARGET_MICROBLAZE) do_u...
[ 1, 0 ]
qemu
exec.c
static void phys_page_compact_all(AddressSpaceDispatch *d, int nodes_nb) { DECLARE_BITMAP(compacted, nodes_nb); if (d->phys_map.skip) { phys_page_compact(&d->phys_map, d->nodes, compacted); } }
[ 0, 0 ]
qemu
exec.c
int walk_memory_regions(void *priv, walk_memory_regions_fn fn) { struct walk_memory_regions_data data; uintptr_t i; data.fn = fn; data.priv = priv; data.start = -1ul; data.prot = 0; for (i = 0; i < V_L1_SIZE; i++) { int rc = walk_memory_regions_1(&data, (abi_ulong)i << V_L1_SHIFT, ...
[ 1, 0 ]
qemu
HACKING
static uint32_t apic_mem_readw(void *opaque, target_phys_addr_t addr) { return 0; }
[ 0, 0 ]
qemu
hw/net/e1000.c
mac_writereg(E1000State *s, int index, uint32_t val) { uint32_t macaddr[2]; s->mac_reg[index] = val; if (index == RA || index == RA + 1) { macaddr[0] = cpu_to_le32(s->mac_reg[RA]); macaddr[1] = cpu_to_le32(s->mac_reg[RA + 1]); qemu_format_nic_info_str(qemu_get_queue(s->nic), (uint8_t *)macaddr)...
[ 0, 0 ]
qemu
hw/xen/xen_pt.h
static int xen_pt_pmcsr_reg_write(XenPCIPassthroughState *s, XenPTReg *cfg_entry, uint16_t *val, uint16_t dev_value, uint16_t valid_mask) { XenPTRegInfo *reg = cfg_entry->reg; uint16_t writable_mask = 0; uint16_t throughable_mask = get_thro...
[ 0, 0 ]
qemu
target-arm/cpu.h
static void add_cpreg_to_list(gpointer key, gpointer opaque) { ARMCPU *cpu = opaque; uint64_t regidx; const ARMCPRegInfo *ri; regidx = *(uint32_t *)key; ri = get_arm_cp_reginfo(cpu->cp_regs, regidx); if (!(ri->type & ARM_CP_NO_MIGRATE)) { cpu->cpreg_indexes[cpu->cpreg_array_len] = cpreg_to_kvm_i...
[ 0, 0 ]
qemu
hw/usb.h
static int usb_device_del(const char *devname) { USBPort *port; USBPort **lastp; USBDevice *dev; int bus_num, addr; const char *p; if (!used_usb_ports) return -1; p = strchr(devname, '.'); if (!p) return -1; bus_num = strtoul(devname, NULL, 0); addr = strtoul(p + 1, NULL, 0); ...
[ 1, 0 ]
FFmpeg
libavformat/ftp.c
static int ftp_status(FTPContext *s, char **line, const int response_codes[]) { int err, i, dash = 0, result = 0, code_found = 0; char buf[CONTROL_BUFFER_SIZE]; AVBPrint line_buffer; if (line) av_bprint_init(&line_buffer, 0, AV_BPRINT_SIZE_AUTOMATIC); while (!code_found || dash) { if ((err = f...
[ 1, 0 ]
qemu
target-alpha/helper.h
uint64_t helper_sublv(CPUAlphaState *env, uint64_t op1, uint64_t op2) { uint32_t res; res = op1 - op2; if (unlikely((op1 ^ op2) & (res ^ op1) & (1UL << 31))) { arith_excp(env, GETPC(), EXC_M_IOV, 0); } return res; }
[ 1, 0 ]
qemu
qemu-io.c
static int alloc_f(int argc, char **argv) { int64_t offset; int nb_sectors, remaining; char s1[64]; int num, sum_alloc; int ret; offset = cvtnum(argv[1]); if (offset & 0x1ff) { printf("offset %" PRId64 " is not sector aligned\n", offset); return 0; } if (argc == 3) { ...
[ 1, 0 ]
qemu
hw/usb-hid.c
static void usb_keyboard_class_initfn(ObjectClass *klass, void *data) { USBDeviceClass *uc = USB_DEVICE_CLASS(klass); uc->init = usb_keyboard_initfn; uc->product_desc = "QEMU USB Keyboard"; uc->usb_desc = &desc_keyboard; uc->handle_packet = usb_generic_handle_packet; uc->handle_reset = usb_hid_handle...
[ 0, 0 ]