Projectname
large_stringclasses
15 values
Filepath
large_stringlengths
4
106
Function
large_stringlengths
11
3.45k
Label
list
qemu
block/nbd-client.c
int nbd_client_session_co_flush(NbdClientSession *client) { struct nbd_request request; struct nbd_reply reply; ssize_t ret; if (!(client->nbdflags & NBD_FLAG_SEND_FLUSH)) { return 0; } request.type = NBD_CMD_FLUSH; if (client->nbdflags & NBD_FLAG_SEND_FUA) { request.type |= NBD_CMD_FLAG_...
[ 1, 0 ]
FFmpeg
libavcodec/bitstream.c
static void *ff_realloc_static(void *ptr, unsigned int size) { int i; if (!ptr) return av_mallocz_static(size); /* Look for the old ptr */ for (i = 0; i < last_static; i++) { if (array_static[i] == ptr) { array_static[i] = av_realloc(array_static[i], size); return array_static[i]; ...
[ 1, 0 ]
qemu
block/vhdx-log.c
static int vhdx_log_read_desc(BlockDriverState *bs, BDRVVHDXState *s, VHDXLogEntries *log, VHDXLogDescEntries **buffer, bool convert_endian) { int ret = 0; uint32_t desc_sectors; uint32_t sectors_read; VHDXLogEntryHeader hdr; VHDXLogDescEntri...
[ 1, 0 ]
qemu
hw/s390x/sclpcpu.c
static int irq_cpu_hotplug_init(SCLPEvent *event) { irq_cpu_hotplug = *qemu_allocate_irqs(trigger_signal, event, 1); return 0; }
[ 1, 0 ]
qemu
hw/lm4549.c
uint32_t lm4549_write_samples(lm4549_state *s, uint32_t left, uint32_t right) { /* The left and right samples are in 20-bit resolution. The LM4549 has 18-bit resolution and only uses the bits [19:2]. This model supports 16-bit playback. */ if (s->buffer_level >= LM4549_BUFFER_SIZE) { DPRINTF(...
[ 1, 0 ]
qemu
qapi-schema.json
void qmp_stop(Error **errp) { vm_stop(RUN_STATE_PAUSED); }
[ 1, 0 ]
FFmpeg
libavfilter/avfilter.c
int avfilter_open(AVFilterContext **filter_ctx, AVFilter *filter, const char *inst_name) { AVFilterContext *ret; *filter_ctx = NULL; if (!filter) return AVERROR(EINVAL); ret = av_mallocz(sizeof(AVFilterContext)); ret->av_class = &avfilter_class; ret->filter = filter; ret->na...
[ 1, 0 ]
FFmpeg
libavcodec/truemotion1.c
static int make_cdt15_entry(int p1, int p2, int16_t *cdt) { int r, b, lo; b = cdt[p2]; r = cdt[p1] * 1024; lo = b + r; return (lo + (lo * (1 << 16))) * 2; }
[ 1, 0 ]
qemu
translate-all.c
static inline void code_gen_alloc(size_t tb_size) { tcg_ctx.code_gen_buffer_size = size_code_gen_buffer(tb_size); tcg_ctx.code_gen_buffer = alloc_code_gen_buffer(); if (tcg_ctx.code_gen_buffer == NULL) { fprintf(stderr, "Could not allocate dynamic translator buffer\n"); exit(1); } qemu_madvise(...
[ 1, 0 ]
qemu
block/rbd.c
static void rbd_finish_aiocb(rbd_completion_t c, RADOSCB *rcb) { int ret; rcb->ret = rbd_aio_get_return_value(c); rbd_aio_release(c); ret = qemu_rbd_send_pipe(rcb->s, rcb); if (ret < 0) { error_report("failed writing to acb->s->fds"); g_free(rcb); } }
[ 1, 0 ]
qemu
Makefile.objs
void qemu_file_set_rate_limit(QEMUFile *f, int64_t limit) { f->xfer_limit = limit; }
[ 1, 0 ]
qemu
docs/specs/acpi_pci_hotplug.txt
static void pcihotplug_write(void *opaque, uint32_t addr, uint32_t val) { struct pci_status *g = opaque; switch (addr) { case PCI_BASE: g->up = val; break; case PCI_BASE + 4: g->down = val; break; } PIIX4_DPRINTF("pcihotplug write %x <== %d\n", addr, val); }
[ 1, 0 ]
qemu
Makefile.objs
bool qemu_file_is_writable(QEMUFile *f) { return f->ops->writev_buffer || f->ops->put_buffer; }
[ 1, 0 ]
FFmpeg
libavcodec/oggvorbis.c
int oggvorbis_init_encoder(vorbis_info *vi, AVCodecContext *avccontext) { if (avccontext->coded_frame->quality) /* VBR requested */ return vorbis_encode_init_vbr(vi, avccontext->channels, avccontext->sample_rate, (float)avccontext->coded_frame...
[ 1, 0 ]
qemu
target-arm/helper.c
static void gt_ctl_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value) { ARMCPU *cpu = arm_env_get_cpu(env); int timeridx = ri->crm & 1; uint32_t oldval = env->cp15.c14_timer[timeridx].ctl; env->cp15.c14_timer[timeridx].ctl = value & 3; if ((oldval ^ value) & 1) { ...
[ 1, 0 ]
FFmpeg
libavformat/a64.c
static int a64_write_header(AVFormatContext *s) { AVCodecContext *avctx = s->streams[0]->codec; uint8_t header[5] = { 0x00, // load 0x40, // address 0x00, // mode 0x00, // charset_lifetime (multi only) 0x00 // fps in 50/fps; }; if (avctx->extradata_size < 4) { av_log...
[ 1, 0 ]
qemu
slirp/slirp.c
static void slirp_bootp_save(QEMUFile *f, Slirp *slirp) { int i; for (i = 0; i < NB_BOOTP_CLIENTS; i++) { qemu_put_be16(f, slirp->bootp_clients[i].allocated); qemu_put_buffer(f, slirp->bootp_clients[i].macaddr, 6); } }
[ 0, 0 ]
qemu
block.c
int qemu_opts_id_wellformed(const char *id) { int i; if (!qemu_isalpha(id[0])) { return 0; } for (i = 1; id[i]; i++) { if (!qemu_isalnum(id[i]) && !strchr("-._", id[i])) { return 0; } } return 1; }
[ 0, 0 ]
qemu
Makefile.objs
QEMUTimerList *qemu_clock_get_main_loop_timerlist(QEMUClockType type) { return main_loop_tlg.tl[type]; }
[ 0, 0 ]
qemu
hw/openpic.c
static void openpic_update_irq(openpic_t *opp, int n_IRQ) { IRQ_src_t *src; int i; src = &opp->src[n_IRQ]; if (!src->pending) { /* no irq pending */ DPRINTF("%s: IRQ %d is not pending\n", __func__, n_IRQ); return; } if (test_bit(&src->ipvp, IPVP_MASK)) { /* Interrupt source is disa...
[ 1, 0 ]
qemu
MAINTAINERS
static void kqemu_reset_modified_ram_pages(void) { int i; unsigned long page_index; for (i = 0; i < nb_modified_ram_pages; i++) { page_index = modified_ram_pages[i] >> TARGET_PAGE_BITS; modified_ram_pages_table[page_index] = 0; } nb_modified_ram_pages = 0; }
[ 0, 0 ]
qemu
monitor.c
static void term_insert_char(int ch) { if (term_cmd_buf_index < TERM_CMD_BUF_SIZE) { memmove(term_cmd_buf + term_cmd_buf_index + 1, term_cmd_buf + term_cmd_buf_index, term_cmd_buf_size - term_cmd_buf_index); term_cmd_buf[term_cmd_buf_index] = ch; term_cmd_buf_size++; te...
[ 1, 0 ]
qemu
blockdev.c
static void pc_fw_add_pflash_drv(void) { QemuOpts *opts; QEMUMachine *machine; char *filename; if (bios_name == NULL) { bios_name = BIOS_FILENAME; } filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); opts = drive_add(IF_PFLASH, -1, filename, "readonly=on"); g_free(filename); if (...
[ 0, 0 ]
FFmpeg
libavformat/mxfdec.c
static int mxf_read_primer_pack(void *arg, AVIOContext *pb, int tag, int size, UID uid) { MXFContext *mxf = arg; int item_num = avio_rb32(pb); int item_len = avio_rb32(pb); if (item_len != 18) { av_log(mxf->fc, AV_LOG_ERROR, "unsupported primer pack item length\n"); ...
[ 1, 0 ]
FFmpeg
libavcodec/svq1.c
static void skip_block(uint8_t *current, uint8_t *previous, int pitch, int x, int y) { uint8_t *src; uint8_t *dst; int i; src = &previous[x + y * pitch]; dst = current; for (i = 0; i < 16; i++) { memcpy(dst, src, 16); src += pitch; dst += pitch; } }
[ 1, 0 ]
qemu
qemu-char.c
static void tcp_chr_close(CharDriverState *chr) { TCPCharDriver *s = chr->opaque; if (s->fd >= 0) { if (s->tag) { g_source_remove(s->tag); s->tag = 0; } if (s->chan) { g_io_channel_unref(s->chan); } closesocket(s->fd); } if (s->listen_fd >= 0) { if (s->listen...
[ 1, 0 ]
qemu
tests/e1000e-test.c
void qusb_pci_init_one(QPCIBus *pcibus, struct qhc *hc, uint32_t devfn, int bar) { hc->dev = qpci_device_find(pcibus, devfn); g_assert(hc->dev != NULL); qpci_device_enable(hc->dev); hc->base = qpci_iomap(hc->dev, bar, NULL); g_assert(hc->base != NULL); }
[ 1, 0 ]
qemu
include/exec/memory.h
const char *memory_region_name(const MemoryRegion *mr) { return object_get_canonical_path_component(OBJECT(mr)); }
[ 1, 0 ]
qemu
hmp.c
void migrate_fd_error(MigrationState *s) { trace_migrate_fd_error(); assert(s->to_dst_file == NULL); migrate_set_state(&s->state, MIGRATION_STATUS_SETUP, MIGRATION_STATUS_FAILED); notifier_list_notify(&migration_state_notifiers, s); }
[ 1, 0 ]
FFmpeg
libavcodec/mjpegdec.c
static inline int mjpeg_decode_dc(MJpegDecodeContext *s, int dc_index) { int code; code = get_vlc2(&s->gb, s->vlcs[0][dc_index].table, 9, 2); if (code < 0) { av_log(s->avctx, AV_LOG_WARNING, "mjpeg_decode_dc: bad vlc: %d:%d (%p)\n", 0, dc_index, &s->vlcs[0][dc_index]); return...
[ 1, 0 ]
FFmpeg
libavcodec/flacenc.c
static uint32_t calc_optimal_rice_params(RiceContext *rc, int porder, uint32_t *sums, int n, int pred_order) { int i; int k, cnt, part; uint32_t all_bits; part = (1 << porder); all_bits = 4 * part; cnt = (n >> porder) - pred_order; for (i = 0; i < part; i+...
[ 1, 0 ]
qemu
linux-user/syscall.c
static inline abi_long host_to_target_sockaddr(abi_ulong target_addr, struct sockaddr *addr, socklen_t len) { struct target_sockaddr *target_saddr; if (len == 0) { return 0; } target_saddr = lock_user(VERIFY...
[ 1, 0 ]
qemu
block.c
static void external_snapshot_commit(BlkActionState *common) { ExternalSnapshotState *state = DO_UPCAST(ExternalSnapshotState, common, common); bdrv_set_aio_context(state->new_bs, state->aio_context); /* This removes our old bs and adds the new bs */ bdrv_append(state->new_bs, state->old_bs); /* ...
[ 1, 0 ]
FFmpeg
doc/APIchanges
int av_image_alloc(uint8_t *pointers[4], int linesizes[4], int w, int h, enum PixelFormat pix_fmt, int align) { int i, ret; uint8_t *buf; if ((ret = av_image_check_size(w, h, 0, NULL)) < 0) return ret; if ((ret = av_image_fill_linesizes(linesizes, pix_fmt, w)) < 0) return ret;...
[ 1, 0 ]
qemu
hw/dma/rc4030.c
static void rc4030_dma_as_update_one(rc4030State *s, int index, uint32_t frame) { if (index < MAX_TL_ENTRIES) { memory_region_set_enabled(&s->dma_mrs[index], false); } if (!frame) { return; } if (index >= MAX_TL_ENTRIES) { qemu_log_mask(LOG_UNIMP, "rc4030: trying to use t...
[ 1, 0 ]
qemu
dump.c
void hmp_dump_guest_memory(Monitor *mon, const QDict *qdict) { Error *errp = NULL; int paging = qdict_get_try_bool(qdict, "paging", 0); const char *file = qdict_get_str(qdict, "filename"); bool has_begin = qdict_haskey(qdict, "begin"); bool has_length = qdict_haskey(qdict, "length"); int64_t begin = ...
[ 1, 0 ]
FFmpeg
libavcodec/dsputil.c
static inline void idct4row(DCTELEM *row) { int c0, c1, c2, c3, a0, a1, a2, a3; // const uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; a0 = row[0]; a1 = row[1]; a2 = row[2]; a3 = row[3]; c0 = (a0 + a2) * R3 + (1 << (R_SHIFT - 1)); c2 = (a0 - a2) * R3 + (1 << (R_SHIFT - 1)); c1 = a1 * R1 + a3 * R2...
[ 1, 0 ]
FFmpeg
libavformat/Makefile
void ff_rtp_send_hevc(AVFormatContext *ctx, const uint8_t *frame_buf, int frame_size) { const uint8_t *next_NAL_unit; const uint8_t *buf_ptr, *buf_end = frame_buf + frame_size; RTPMuxContext *rtp_ctx = ctx->priv_data; /* use the default 90 KHz time stamp */ rtp_ctx->timestamp = rtp...
[ 1, 0 ]
FFmpeg
libavdevice/dshow_filter.c
libAVFilter_QueryVendorInfo(libAVFilter *this, wchar_t **info) { dshowdebug("libAVFilter_QueryVendorInfo(%p)\n", this); if (!info) return E_POINTER; *info = wcsdup(L"libAV"); return S_OK; }
[ 1, 0 ]
FFmpeg
libavcodec/cinepakenc.c
static int compute_mb_distortion(CinepakEncContext *s, AVPicture *a, AVPicture *b) { int x, y, p, d, ret = 0; for (y = 0; y < MB_SIZE; y++) { for (x = 0; x < MB_SIZE; x++) { d = a->data[0][x + y * a->linesize[0]] - b->data[0][x + y * b->linesize[0]]; ...
[ 1, 0 ]
FFmpeg
Changelog
static int vp8_decode_mb_row_sliced(AVCodecContext *avctx, void *tdata, int jobnr, int threadnr) { VP8Context *s = avctx->priv_data; VP8ThreadData *td = &s->thread_data[jobnr]; VP8ThreadData *next_td = NULL, *prev_td = NULL; VP8Frame *curframe = s->curframe; int mb_y...
[ 1, 0 ]
FFmpeg
libavformat/rtpproto.c
static void build_udp_url(char *buf, int buf_size, const char *hostname, int port, int local_port, int ttl) { snprintf(buf, buf_size, "udp://%s:%d", hostname, port); if (local_port >= 0) url_add_option(buf, buf_size, "localport=%d", local_port); if (t...
[ 0, 0 ]
FFmpeg
ffmpeg_filter.c
static int sub2video_prepare(InputStream *ist) { AVFormatContext *avf = input_files[ist->file_index]->ctx; int i, w, h; /* Compute the size of the canvas for the subtitles stream. If the subtitles codec has set a size, use it. Otherwise use the maximum dimensions of the video streams in the same f...
[ 1, 0 ]
qemu
target-arm/helper.c
static int arm946_prbs_read(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t *value) { if (ri->crm > 8) { return EXCP_UDEF; } *value = env->cp15.c6_region[ri->crm]; return 0; }
[ 1, 0 ]
FFmpeg
libavutil/file.c
int av_tempfile(const char *prefix, char **filename, int log_offset, void *log_ctx) { FileLogContext file_log_ctx = {&file_log_ctx_class, log_offset, log_ctx}; int fd = -1; #if !HAVE_MKSTEMP void *ptr = tempnam(NULL, prefix); if (!ptr) ptr = tempnam(".", prefix); *filename = av_strd...
[ 1, 0 ]
qemu
hw/nvram/mac_nvram.c
static uint64_t unin_data_read(void *opaque, hwaddr addr, unsigned len) { UNINState *s = opaque; PCIHostState *phb = PCI_HOST_BRIDGE(s); uint32_t val; val = pci_data_read(phb->bus, unin_get_config_reg(phb->config_reg, addr), len)...
[ 1, 0 ]
qemu
hw/ipmi/ipmi_bmc_sim.c
static void set_sel_time(IPMIBmcSim *ibs, uint8_t *cmd, unsigned int cmd_len, uint8_t *rsp, unsigned int *rsp_len, unsigned int max_rsp_len) { uint32_t val; struct ipmi_time now; IPMI_CHECK_CMD_LEN(6); val = cmd[2] | (cmd[3] << 8...
[ 1, 0 ]
qemu
hw/virtio/virtio.c
static inline void vring_used_write(VirtQueue *vq, VRingUsedElem *uelem, int i) { VRingMemoryRegionCaches *caches = atomic_rcu_read(&vq->vring.caches); hwaddr pa = offsetof(VRingUsed, ring[i]); virtio_tswap32s(vq->vdev, &uelem->id); virtio_tswap32s(vq->vdev, &uelem->len...
[ 1, 0 ]
FFmpeg
libavformat/movenc.c
static void find_compressor(char *compressor_name, int len, MOVTrack *track) { AVDictionaryEntry *encoder; int xdcam_res = (track->par->width == 1280 && track->par->height == 720) || (track->par->width == 1440 && track->par->height == 1080) || (track->par->width == 1920 && t...
[ 1, 0 ]
qemu
fpu/softfloat.c
floatx80 floatx80_scalbn(floatx80 a, int n STATUS_PARAM) { flag aSign; int16 aExp; uint64_t aSig; aSig = extractFloatx80Frac(a); aExp = extractFloatx80Exp(a); aSign = extractFloatx80Sign(a); if (aExp == 0x7FF) { return a; } if (aExp == 0 && aSig == 0) return a; aExp += n; retu...
[ 1, 0 ]
qemu
hw/display/virtio-gpu.c
int virtio_gpu_create_mapping_iov(struct virtio_gpu_resource_attach_backing *ab, struct virtio_gpu_ctrl_command *cmd, struct iovec **iov) { struct virtio_gpu_mem_entry *ents; size_t esize, s; int i; if (ab->nr_entries > 16384) { qem...
[ 1, 0 ]
qemu
block.c
static int bdrv_check_byte_request(BlockDriverState *bs, int64_t offset, size_t size) { int64_t len; if (!bdrv_is_inserted(bs)) return -ENOMEDIUM; if (bs->growable) return 0; len = bdrv_getlength(bs); if ((offset + size) > len) return -EIO; return 0;...
[ 1, 0 ]
qemu
hw/char/xen_console.c
static void xen_remap_bucket(MapCacheEntry *entry, hwaddr size, hwaddr address_index) { uint8_t *vaddr_base; xen_pfn_t *pfns; int *err; unsigned int i; hwaddr nb_pfn = size >> XC_PAGE_SHIFT; trace_xen_remap_bucket(address_index); pfns = g...
[ 1, 0 ]
qemu
hw/usb.h
void usb_packet_complete(USBDevice *dev, USBPacket *p) { USBEndpoint *ep = p->ep; int ret; assert(p->state == USB_PACKET_ASYNC); assert(QTAILQ_FIRST(&ep->queue) == p); usb_packet_set_state(p, USB_PACKET_COMPLETE); QTAILQ_REMOVE(&ep->queue, p, queue); dev->port->ops->complete(dev->port, p); whil...
[ 1, 0 ]
qemu
hw/device-hotplug.c
void destroy_nic(dev_match_fn *match_fn, void *arg) { int i; NICInfo *nic; for (i = 0; i < MAX_NICS; i++) { nic = &nd_table[i]; if (nic->used) { if (nic->private && match_fn(nic->private, arg)) { if (nic->vlan) { VLANClientState *vc; vc = qemu_find_vlan_client(n...
[ 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...
[ 1, 0 ]
qemu
hw/sd.c
static void sd_reset(SDState *sd, BlockDriverState *bdrv) { uint64_t size; uint64_t sect; if (bdrv) { bdrv_get_geometry(bdrv, &sect); } else { sect = 0; } sect <<= 9; size = sect + 1; sect = (size >> (HWBLOCK_SHIFT + SECTOR_SHIFT + WPGROUP_SHIFT)) + 1; sd->state = sd_idle_state; ...
[ 1, 0 ]
FFmpeg
libavcodec/ffv1dec.c
static inline av_flatten int get_symbol_inline(RangeCoder *c, uint8_t *state, int is_signed) { if (get_rac(c, state + 0)) return 0; else { int i, e, a; e = 0; while (get_rac(c, state + 1 + FFMIN(e, 9))) // 1..10 e++; a = 1; for ...
[ 1, 0 ]
FFmpeg
libavformat/utils.c
AVStream *avformat_new_stream(AVFormatContext *s, const AVCodec *c) { AVStream *st; int i; if (av_reallocp_array(&s->streams, s->nb_streams + 1, sizeof(*s->streams)) < 0) { s->nb_streams = 0; return NULL; } st = av_mallocz(sizeof(AVStream)); if (!st) return NULL...
[ 1, 0 ]
FFmpeg
libavformat/rtsp.c
static void rtsp_send_cmd(AVFormatContext *s, const char *cmd, RTSPMessageHeader *reply, unsigned char **content_ptr) { rtsp_send_cmd_async(s, cmd, reply, content_ptr); rtsp_read_reply(s, reply, content_ptr, 0); }
[ 0, 0 ]
FFmpeg
libavformat/rtspdec.c
static int rtsp_read_header(AVFormatContext *s, AVFormatParameters *ap) { RTSPState *rt = s->priv_data; int ret; ret = ff_rtsp_connect(s); if (ret) return ret; rt->real_setup_cache = av_mallocz(2 * s->nb_streams * sizeof(*rt->real_setup_cache)); if (!rt->real_s...
[ 1, 0 ]
qemu
hw/usb/hcd-ehci.c
static void ehci_advance_state(EHCIState *ehci, int async) { EHCIQueue *q = NULL; int again; do { switch (ehci_get_state(ehci, async)) { case EST_WAITLISTHEAD: again = ehci_state_waitlisthead(ehci, async); break; case EST_FETCHENTRY: again = ehci_state_fetchentry(ehci, asyn...
[ 1, 0 ]
qemu
hw/qdev.c
void do_device_add(Monitor *mon, const QDict *qdict) { QemuOpts *opts; opts = qemu_opts_parse(&qemu_device_opts, qdict_get_str(qdict, "config"), "driver"); if (opts && !qdev_device_help(opts)) qdev_device_add(opts); }
[ 1, 0 ]
qemu
ui/spice-display.c
static void interface_get_init_info(QXLInstance *sin, QXLDevInitInfo *info) { SimpleSpiceDisplay *ssd = container_of(sin, SimpleSpiceDisplay, qxl); info->memslot_gen_bits = MEMSLOT_GENERATION_BITS; info->memslot_id_bits = MEMSLOT_SLOT_BITS; info->num_memslots = NUM_MEMSLOTS; info->num_memslots_groups = ...
[ 1, 0 ]
FFmpeg
libavformat/mpc8.c
static void mpc8_parse_seektable(AVFormatContext *s, int64_t off) { MPCContext *c = s->priv_data; int tag; int64_t size, pos, ppos[2]; uint8_t *buf; int i, t, seekd; GetBitContext gb; avio_seek(s->pb, off, SEEK_SET); mpc8_get_chunk_header(s->pb, &tag, &size); if (tag != TAG_SEEKTABLE) { ...
[ 1, 0 ]
qemu
hw/ide/core.c
void ide_sector_write(IDEState *s) { int64_t sector_num; int n; s->status = READY_STAT | SEEK_STAT | BUSY_STAT; sector_num = ide_get_sector(s); #if defined(DEBUG_IDE) printf("sector=%" PRId64 "\n", sector_num); #endif n = s->nsector; if (n > s->req_nb_sectors) { n = s->req_nb_sectors; s->iov.iov_b...
[ 1, 0 ]
qemu
bsd-user/main.c
static void openrisc_sim_init(MachineState *machine) { ram_addr_t ram_size = machine->ram_size; const char *cpu_model = machine->cpu_model; const char *kernel_filename = machine->kernel_filename; OpenRISCCPU *cpu = NULL; MemoryRegion *ram; int n; if (!cpu_model) { cpu_model = "or1200"; } ...
[ 1, 0 ]
qemu
target-xtensa/translate.c
static void gen_window_check3(DisasContext *dc, unsigned r1, unsigned r2, unsigned r3) { gen_window_check2(dc, r1, r2 > r3 ? r2 : r3); }
[ 1, 0 ]
qemu
tests/check-qjson.c
static void simple_string(void) { 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; test...
[ 1, 0 ]
qemu
accel/tcg/translator.c
static void spr_write_tbu(DisasContext *ctx, int sprn, int gprn) { if (ctx->tb->cflags & CF_USE_ICOUNT) { gen_io_start(); } gen_helper_store_tbu(cpu_env, cpu_gpr[gprn]); if (ctx->tb->cflags & CF_USE_ICOUNT) { gen_io_end(); gen_stop_exception(ctx); } }
[ 1, 0 ]
FFmpeg
ffmpeg.c
static int ftp_passive_mode_epsv(FTPContext *s) { char *res = NULL, *start = NULL, *end = NULL; int i; static const char d = '|'; static const char *command = "EPSV\r\n"; static const int epsv_codes[] = {229, 0}; if (ftp_send_command(s, command, epsv_codes, &res) != 229 || !res) goto fail; fo...
[ 1, 0 ]
qemu
hw/s390x/css.c
static void css_inject_io_interrupt(SubchDev *sch) { S390CPU *cpu = s390_cpu_addr2state(0); uint8_t isc = (sch->curr_status.pmcw.flags & PMCW_FLAGS_MASK_ISC) >> 11; trace_css_io_interrupt(sch->cssid, sch->ssid, sch->schid, sch->curr_status.pmcw.intparm, isc, ""); s390_io_interrupt...
[ 0, 0 ]
qemu
net-checksum.c
uint16_t net_checksum_tcpudp(uint16_t length, uint16_t proto, uint8_t *addrs, uint8_t *buf) { uint32_t sum = 0; sum += net_checksum_add(length, buf); // payload sum += net_checksum_add(8, addrs); // src + dst address sum += proto + length; // protocol & length return net_ch...
[ 0, 0 ]
qemu
cputlb.c
void *address_space_map(AddressSpace *as, hwaddr addr, hwaddr *plen, bool is_write) { AddressSpaceDispatch *d = as->dispatch; hwaddr len = *plen; hwaddr todo = 0; int l; hwaddr page; MemoryRegionSection *section; ram_addr_t...
[ 0, 0 ]
qemu
block.c
static void loadvm_postcopy_handle_run_bh(void *opaque) { Error *local_err = NULL; HandleRunBhData *data = opaque; /* TODO we should move all of this lot into postcopy_ram.c or a shared code * in migration.c */ cpu_synchronize_all_post_init(); qemu_announce_self(); /* Make sure all file forma...
[ 0, 1 ]
qemu
Makefile.target
void cpu_loop_exit(CPUState *env1) { env1->current_tb = NULL; longjmp(env1->jmp_env, 1); }
[ 0, 0 ]
qemu
block/block-backend.c
static void scsi_aio_complete(void *opaque, int ret) { SCSIDiskReq *r = (SCSIDiskReq *)opaque; SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, r->req.dev); assert(r->req.aiocb != NULL); r->req.aiocb = NULL; block_acct_done(bdrv_get_stats(s->qdev.conf.bs), &r->acct); if (r->req.io_canceled) { s...
[ 0, 0 ]
FFmpeg
libavformat/mtv.c
static int mtv_read_packet(AVFormatContext *s, AVPacket *pkt) { MTVDemuxContext *mtv = s->priv_data; ByteIOContext *pb = s->pb; int ret; #if !HAVE_BIGENDIAN int i; #endif if ((url_ftell(pb) - s->data_offset + mtv->img_segment_size) % mtv->full_segment_size) { url_fskip(pb, MTV_AUDIO_PADD...
[ 1, 0 ]
qemu
hw/s390x/sclpcpu.c
static void cpu_class_init(ObjectClass *oc, void *data) { SCLPEventClass *k = SCLP_EVENT_CLASS(oc); DeviceClass *dc = DEVICE_CLASS(oc); k->get_send_mask = send_mask; k->get_receive_mask = receive_mask; k->read_event_data = read_event_data; set_bit(DEVICE_CATEGORY_MISC, dc->categories); }
[ 1, 0 ]
qemu
dma-helpers.c
BlockDriverAIOCB *dma_bdrv_io( BlockDriverState *bs, QEMUSGList *sg, uint64_t sector_num, DMAIOFunc *io_func, BlockDriverCompletionFunc *cb, void *opaque, DMADirection dir) { DMAAIOCB *dbs = qemu_aio_get(&dma_aiocb_info, bs, cb, opaque); trace_dma_bdrv_io(dbs, bs, sector_num, (dir == DMA_DIRECTION...
[ 1, 0 ]
FFmpeg
libavcodec/dcaadpcm.c
static int64_t find_best_filter(const DCAADPCMEncContext *s, const int32_t *in, int len) { const premultiplied_coeffs *precalc_data = s->private_data; int i, j, k = 0; int vq; int64_t err; int64_t min_err = 1ll << 62; int64_t corr[15]; for (i = 0; i <= DCA_ADPCM_COE...
[ 1, 0 ]
FFmpeg
libavformat/format.c
void av_register_output_format(AVOutputFormat *format) { AVOutputFormat **p = last_oformat; format->next = NULL; while (*p || avpriv_atomic_ptr_cas((void *volatile *)p, NULL, format)) p = &(*p)->next; last_oformat = &format->next; }
[ 1, 0 ]
FFmpeg
libavformat/hls.c
static int recheck_discard_flags(AVFormatContext *s, int first) { HLSContext *c = s->priv_data; int i, changed = 0; /* Check if any new streams are needed */ for (i = 0; i < c->n_playlists; i++) c->playlists[i]->cur_needed = 0; for (i = 0; i < s->nb_streams; i++) { AVStream *st = s->streams[i]...
[ 1, 0 ]
qemu
hw/net/ne2000.c
static inline uint32_t ne2000_mem_readl(NE2000State *s, uint32_t addr) { addr &= ~1; /* XXX: check exact behaviour if not even */ if (addr < 32 || (addr >= NE2000_PMEM_START && addr < NE2000_MEM_SIZE)) { return ldl_le_p(s->mem + addr); } else { return 0xffffffff; } }
[ 1, 1 ]
qemu
ui/gtk.c
static void gd_grab_pointer(GtkDisplayState *s) { #if GTK_CHECK_VERSION(3, 0, 0) GdkDisplay *display = gtk_widget_get_display(s->drawing_area); GdkDeviceManager *mgr = gdk_display_get_device_manager(display); GList *devices = gdk_device_manager_list_devices(mgr, ...
[ 0, 0 ]
qemu
Makefile.target
static int pci_unin_agp_init_device(SysBusDevice *dev) { UNINState *s; int pci_mem_config, pci_mem_data; /* Uninorth AGP bus */ s = FROM_SYSBUS(UNINState, dev); pci_mem_config = cpu_register_io_memory(pci_unin_config_read, pci_unin_config_write, s); pci_mem_...
[ 0, 0 ]
qemu
HACKING
nand_write(void *opaque, target_phys_addr_t addr, uint64_t value, unsigned size) { struct nand_state_t *s = opaque; int rdy; DNAND(printf("%s addr=%x v=%x\n", __func__, addr, (unsigned)value)); nand_setpins(s->nand, s->cle, s->ale, s->ce, 1, 0); nand_setio(s->nand, value); nand_getpins(s-...
[ 1, 0 ]
qemu
block/iscsi.c
iscsi_aio_read16_cb(struct iscsi_context *iscsi, int status, void *command_data, void *opaque) { IscsiAIOCB *acb = opaque; trace_iscsi_aio_read16_cb(iscsi, status, acb, acb->canceled); if (acb->canceled != 0) { return; } acb->status = 0; if (status != 0) { if (status == ...
[ 1, 0 ]
qemu
hw/apic.c
void apic_sipi(CPUState *env) { APICState *s = env->apic_state; cpu_reset_interrupt(env, CPU_INTERRUPT_SIPI); if (!s->wait_for_sipi) return; env->eip = 0; cpu_x86_load_seg_cache(env, R_CS, s->sipi_vector << 8, s->sipi_vector << 12, 0xffff, 0); env->halted = 0; s->wai...
[ 1, 0 ]
qemu
block_int.h
static int print_drive(DeviceState *dev, Property *prop, char *dest, size_t len) { DriveInfo **ptr = qdev_get_prop_ptr(dev, prop); return snprintf(dest, len, "%s", (*ptr) ? (*ptr)->id : "<null>"); }
[ 0, 0 ]
qemu
darwin-user/main.c
void do_tw(int flags) { if (!likely(!(((int32_t)T0 < (int32_t)T1 && (flags & 0x10)) || ((int32_t)T0 > (int32_t)T1 && (flags & 0x08)) || ((int32_t)T0 == (int32_t)T1 && (flags & 0x04)) || ((uint32_t)T0 < (uint32_t)T1 && (flags & 0x02)) || ((uint32_t)...
[ 0, 0 ]
qemu
hw/intc/armv7m_nvic.c
static void nvic_systick_trigger(void *opaque, int n, int level) { NVICState *s = opaque; if (level) { /* SysTick just asked us to pend its exception. * (This is different from an external interrupt line's * behaviour.) */ armv7m_nvic_set_pending(s, ARMV7M_EXCP_SYSTICK); } }
[ 0, 0 ]
qemu
hw/pci.c
PCIINTxRoute pci_device_route_intx_to_irq(PCIDevice *dev, int pin) { PCIBus *bus; do { bus = dev->bus; pin = bus->map_irq(dev, pin); dev = bus->parent_dev; } while (dev); assert(bus->route_intx_to_irq); return bus->route_intx_to_irq(bus->irq_opaque, pin); }
[ 0, 0 ]
FFmpeg
libavformat/matroskadec.c
static int ebml_read_ascii(AVIOContext *pb, int size, char **str) { av_free(*str); /* EBML strings are usually not 0-terminated, so we allocate one * byte more, read the string and NULL-terminate it ourselves. */ if (!(*str = av_malloc(size + 1))) return AVERROR(ENOMEM); if (avio_read(pb, (uint8_t...
[ 1, 0 ]
qemu
target-alpha/helper.h
ARITH3(addlv) ARITH3(sublv) ARITH3(addqv) ARITH3(subqv) ARITH3(umulh) ARITH3(mullv) ARITH3(mulqv) ARITH3(minub8) ARITH3(minsb8) ARITH3(minuw4) ARITH3(minsw4) ARITH3(maxub8) ARITH3(maxsb8) ARITH3(maxuw4) ARITH3(maxsw4) ARITH3(perr) #define MVIOP2(name) static inline void glue(gen_, name)(int rb, int rc)...
[ 1, 0 ]
qemu
hw/ppc/spapr.c
void ppc_store_sdr1(CPUPPCState *env, target_ulong value) { LOG_MMU("%s: " TARGET_FMT_lx "\n", __func__, value); if (env->spr[SPR_SDR1] != value) { env->spr[SPR_SDR1] = value; #if defined(TARGET_PPC64) if (env->mmu_model & POWERPC_MMU_64) { target_ulong htabsize = value & SDR_64_HTABSIZE; ...
[ 1, 1 ]
qemu
hw/ipmi/ipmi_bmc_sim.c
static void clear_sel(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(8); IPMI_CHECK_RESERVATION(2, ibs->sel.reservation); if (cmd[4] != 'C' || cmd[5] !...
[ 1, 0 ]
qemu
hw/acpi_piix4.c
static void piix4_acpi_system_hot_add_init(PCIBus *bus, PIIX4PMState *s) { register_ioport_write(GPE_BASE, GPE_LEN, 1, gpe_writeb, s); register_ioport_read(GPE_BASE, GPE_LEN, 1, gpe_readb, s); acpi_gpe_blk(&s->ar, GPE_BASE); register_ioport_read(PCI_UP_BASE, 4, 4, pci_up_read, s); register_ioport_read(P...
[ 1, 0 ]
FFmpeg
output_example.c
AVStream *add_audio_stream(AVFormatContext *oc, int codec_id) { AVCodec *codec; AVCodecContext *c; AVStream *st; st = av_new_stream(oc, 1); if (!st) { fprintf(stderr, "Could not alloc stream\n"); exit(1); } /* find the MP2 encoder */ codec = avcodec_find_encoder(codec_id); if (!code...
[ 1, 1 ]
qemu
hw/usb/ccid-card-emulated.c
static uint32_t parse_enumeration(char *str, EnumTable *table, uint32_t not_found_value) { uint32_t ret = not_found_value; while (table->name != NULL) { if (strcmp(table->name, str) == 0) { ret = table->value; break; } table++; } return ret; }
[ 1, 0 ]