Projectname
large_stringclasses
15 values
Filepath
large_stringlengths
4
106
Function
large_stringlengths
11
3.45k
Label
list
qemu
block/qcow2-cluster.c
static int qcow2_set_key(BlockDriverState *bs, const char *key) { BDRVQcow2State *s = bs->opaque; uint8_t keybuf[16]; int len, i; Error *err = NULL; memset(keybuf, 0, 16); len = strlen(key); if (len > 16) len = 16; /* XXX: we could compress the chars to 7 bits to increase entropy */ ...
[ 1, 1 ]
qemu
block/block-backend.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(bdrv_get_stats(s->bs), &s->acct, 4 * BDRV_SECTOR_SIZE, BLOCK_ACCT_READ); ret = bdrv_read(s->bs, (int64_t)lba << 2, buf, 4); block_ac...
[ 0, 0 ]
qemu
HACKING
static uint32_t intel_hda_mmio_readl(void *opaque, target_phys_addr_t addr) { IntelHDAState *d = opaque; const IntelHDAReg *reg = intel_hda_reg_find(d, addr); return intel_hda_reg_read(d, reg, 0xffffffff); }
[ 0, 0 ]
qemu
block/raw-posix.c
int unix_start_incoming_migration(const char *path) { struct sockaddr_un un; int sock; dprintf("Attempting to start an incoming migration\n"); sock = socket(PF_UNIX, SOCK_STREAM, 0); if (sock < 0) { fprintf(stderr, "Could not open unix socket: %s\n", strerror(errno)); return -EINVAL; } me...
[ 1, 0 ]
qemu
include/qemu-common.h
static void print_type_size(Visitor *v, const char *name, uint64_t *obj, Error **errp) { StringOutputVisitor *sov = to_sov(v); static const char suffixes[] = {'B', 'K', 'M', 'G', 'T', 'P', 'E'}; uint64_t div, val; char *out; int i; if (!sov->human) { out = g_strdup_p...
[ 1, 0 ]
FFmpeg
libavcodec/alac.c
static void reconstruct_stereo_16(int32_t *buffer[MAX_CHANNELS], int16_t *buffer_out, int numchannels, int numsamples, uint8_t interlacing_shift, uint8_t interlacing_leftweight) {...
[ 0, 0 ]
qemu
hw/block/virtio-blk.c
static int vhost_net_set_vnet_endian(VirtIODevice *dev, NetClientState *peer, bool set) { int r = 0; if (virtio_has_feature(dev, VIRTIO_F_VERSION_1) || (virtio_legacy_is_cross_endian(dev) && !virtio_is_big_endian(dev))) { r = qemu_set_vnet_le(peer, set); if ...
[ 0, 0 ]
qemu
hw/net/virtio-net.c
static void virtio_net_add_queue(VirtIONet *n, int index) { VirtIODevice *vdev = VIRTIO_DEVICE(n); n->vqs[index].rx_vq = virtio_add_queue(vdev, n->net_conf.rx_queue_size, virtio_net_handle_rx); if (n->net_conf.tx && !strcmp(n->net_conf.tx, "timer")) { n->vqs[inde...
[ 0, 0 ]
qemu
arch_init.c
static void blk_mig_cleanup(Monitor *mon) { BlkMigDevState *bmds; BlkMigBlock *blk; set_dirty_tracking(0); while ((bmds = QSIMPLEQ_FIRST(&block_mig_state.bmds_list)) != NULL) { QSIMPLEQ_REMOVE_HEAD(&block_mig_state.bmds_list, entry); bdrv_set_in_use(bmds->bs, 0); drive_put_ref(drive_get_by_b...
[ 0, 0 ]
qemu
savevm.c
void ram_control_load_hook(QEMUFile *f, uint64_t flags) { int ret = 0; if (f->ops->hook_ram_load) { ret = f->ops->hook_ram_load(f, f->opaque, flags); if (ret < 0) { qemu_file_set_error(f, ret); } } else { qemu_file_set_error(f, ret); } }
[ 0, 0 ]
qemu
hw/ac97.c
static uint32_t nabm_readw(void *opaque, uint32_t addr) { PCIAC97LinkState *d = opaque; AC97LinkState *s = &d->ac97; AC97BusMasterRegs *r = NULL; uint32_t index = addr - s->base[1]; uint32_t val = ~0U; switch (index) { case PI_SR: case PO_SR: case MC_SR: r = &s->bm_regs[GET_BM(index)]; ...
[ 0, 0 ]
qemu
hw/usb-ehci.c
static int ehci_state_executing(EHCIQueue *q, int async) { int again = 0; int reload, nakcnt; ehci_execute_complete(q); if (q->usb_status == USB_RET_ASYNC) { goto out; } if (q->usb_status == USB_RET_PROCERR) { again = -1; goto out; } // 4.10.3 if (!async) { int transactCtr ...
[ 0, 0 ]
qemu
ui/gtk.c
static void gd_change_page(GtkNotebook *nb, gpointer arg1, guint arg2, gpointer data) { GtkDisplayState *s = data; VirtualConsole *vc; gboolean on_vga; if (!gtk_widget_get_realized(s->notebook)) { return; } vc = gd_vc_find_by_page(s, arg2); if (!vc) { return; ...
[ 0, 0 ]
qemu
memory.c
static void address_space_update_topology(AddressSpace *as) { FlatView *old_view = as->current_map; FlatView *new_view = generate_memory_topology(as->root); address_space_update_topology_pass(as, old_view, new_view, false); address_space_update_topology_pass(as, old_view, new_view, true); as->current_ma...
[ 0, 0 ]
FFmpeg
libavfilter/avfiltergraph.c
static int init(AVFilterContext *ctx, const char *args, void *opaque) { GraphContext *gctx = ctx->priv; if (!args) return 0; if (!(gctx->link_filter = avfilter_open(&vf_graph_dummy, NULL))) return -1; if (avfilter_init_filter(gctx->link_filter, NULL, ctx)) goto fail; return graph_load_cha...
[ 0, 0 ]
qemu
HACKING
int rom_load_all(void) { target_phys_addr_t addr = 0; MemoryRegionSection section; Rom *rom; QTAILQ_FOREACH(rom, &roms, next) { if (rom->fw_file) { continue; } if (addr > rom->addr) { fprintf(stderr, "rom: requested regions overlap " "(rom %s. free=0...
[ 0, 0 ]
qemu
hw/nvram/spapr_nvram.c
static void rtas_power_off(sPAPREnvironment *spapr, uint32_t token, uint32_t nargs, target_ulong args, uint32_t nret, target_ulong rets) { if (nargs != 2 || nret != 1) { rtas_st(rets, 0, -3); return; } qemu_system_shutdown_request(); rtas_st(...
[ 1, 0 ]
qemu
HACKING
static uint64_t omap_id_read(void *opaque, target_phys_addr_t addr, unsigned size) { struct omap_mpu_state_s *s = (struct omap_mpu_state_s *)opaque; if (size != 4) { return omap_badwidth_read32(opaque, addr); } switch (addr) { case 0xfffe1800: /* DIE_ID_LSB */ retu...
[ 0, 0 ]
qemu
HACKING
static void hpdmc_write(void *opaque, target_phys_addr_t addr, uint64_t value, unsigned size) { MilkymistHpdmcState *s = opaque; trace_milkymist_hpdmc_memory_write(addr, value); addr >>= 2; switch (addr) { case R_SYSTEM: case R_BYPASS: case R_TIMING: s->regs[addr] = v...
[ 1, 0 ]
qemu
HACKING
static int write_elf32_note(DumpState *s) { target_phys_addr_t begin = s->memory_offset - s->note_size; Elf32_Phdr phdr; int endian = s->dump_info.d_endian; int ret; memset(&phdr, 0, sizeof(Elf32_Phdr)); phdr.p_type = cpu_convert_to_target32(PT_NOTE, endian); phdr.p_offset = cpu_convert_to_target3...
[ 1, 0 ]
qemu
HACKING
static void fw_cfg_data_mem_write(void *opaque, target_phys_addr_t addr, uint64_t value, unsigned size) { fw_cfg_write(opaque, (uint8_t)value); }
[ 0, 0 ]
qemu
block/qapi.c
Visitor *qmp_input_visitor_new(QObject *obj, bool strict) { QmpInputVisitor *v; assert(obj); v = g_malloc0(sizeof(*v)); v->visitor.type = VISITOR_INPUT; v->visitor.start_struct = qmp_input_start_struct; v->visitor.check_struct = qmp_input_check_struct; v->visitor.end_struct = qmp_input_pop; v->...
[ 0, 0 ]
qemu
hw/arm/boot.c
static void do_cpu_reset(void *opaque) { ARMCPU *cpu = opaque; CPUARMState *env = &cpu->env; const struct arm_boot_info *info = env->boot_info; cpu_reset(CPU(cpu)); if (info) { if (!info->is_linux) { /* Jump to the entry point. */ env->regs[15] = info->entry & 0xfffffffe; env-...
[ 1, 0 ]
FFmpeg
libavfilter/buffersrc.c
static void return_frame(AVFilterContext *ctx, int is_second) { YADIFContext *yadif = ctx->priv; AVFilterLink *link = ctx->outputs[0]; int tff; if (yadif->parity == -1) { tff = yadif->cur->video->interlaced ? yadif->cur->video->top_field_first ...
[ 1, 0 ]
qemu
hw/scsi-bus.c
static void scsi_generic_purge_requests(SCSIGenericState *s) { SCSIGenericReq *r; while (!QTAILQ_EMPTY(&s->qdev.requests)) { r = DO_UPCAST(SCSIGenericReq, req, QTAILQ_FIRST(&s->qdev.requests)); if (r->req.aiocb) { bdrv_aio_cancel(r->req.aiocb); } scsi_remove_request(r); } }
[ 1, 0 ]
FFmpeg
libavformat/nutdec.c
static int nut_read_close(AVFormatContext *s) { NUTContext *nut = s->priv_data; av_freep(&nut->time_base); av_freep(&nut->stream); return 0; }
[ 1, 0 ]
FFmpeg
libavformat/pva.c
static int64_t pva_read_timestamp(struct AVFormatContext *s, int stream_index, int64_t *pos, int64_t pos_limit) { ByteIOContext *pb = s->pb; PVAContext *pvactx = s->priv_data; int length, streamid; int64_t res; pos_limit = FFMIN(*pos + PVA_MAX_PAYLOAD_LENGTH * 8, ...
[ 1, 0 ]
qemu
hw/display/vga.c
static void vga_get_text_resolution(VGACommonState *s, int *pwidth, int *pheight, int *pcwidth, int *pcheight) { int width, cwidth, height, cheight; /* total width & height */ cheight = (s->cr[VGA_CRTC_MAX_SCAN] & 0x1f) + 1; cwidth = ...
[ 1, 1 ]
FFmpeg
libavcodec/hapdec.c
static int parse_section_header(GetByteContext *gbc, int *section_size, enum HapSectionType *section_type) { if (bytestream2_get_bytes_left(gbc) < 4) return AVERROR_INVALIDDATA; *section_size = bytestream2_get_le24(gbc); *section_type = bytestream2_get_byte(gbc); if (*...
[ 0, 0 ]
FFmpeg
libavcodec/libopencore-amr.c
static int amr_nb_decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; AMRContext *s = avctx->priv_data; static const uint8_t block_size[16] = {12, 13, 15, 17, 19, 20, 26, 31, ...
[ 1, 0 ]
FFmpeg
libavcodec/indeo3.c
static void copy_cell(Indeo3DecodeContext *ctx, Plane *plane, Cell *cell) { int h, w, mv_x, mv_y, offset, offset_dst; uint8_t *src, *dst; /* setup output and reference pointers */ offset_dst = (cell->ypos << 2) * plane->pitch + (cell->xpos << 2); dst = plane->pixels[ctx->buf_sel] + offset_dst; mv_y =...
[ 1, 0 ]
qemu
qom/object.c
static void object_set_link_property(Object *obj, Visitor *v, void *opaque, const char *name, Error **errp) { Object **child = opaque; bool ambiguous = false; const char *type; char *path; type = object_property_get_type(obj, name, NULL); visit_type_str(v, &path,...
[ 1, 0 ]
FFmpeg
libavcodec/rv34.c
static AVRational update_sar(int old_w, int old_h, AVRational sar, int new_w, int new_h) { // attempt to keep aspect during typical resolution switches if (!sar.num) sar = (AVRational){1, 1}; sar = av_mul_q(sar, (AVRational){new_h * old_w, new_w * old_h}); return sar; }
[ 1, 0 ]
qemu
qobject/json-streamer.c
static void json_message_process_token(JSONLexer *lexer, GString *input, JSONTokenType type, int x, int y) { JSONMessageParser *parser = container_of(lexer, JSONMessageParser, lexer); JSONToken *token; switch (type) { case JSON_LCURLY: parser->brace_count++; ...
[ 1, 0 ]
qemu
hw/tmp105.c
static int tmp105_tx(I2CSlave *i2c, uint8_t data) { TMP105State *s = (TMP105State *)i2c; if (!s->len++) s->pointer = data; else { if (s->len <= 2) s->buf[s->len - 1] = data; tmp105_write(s); } return 0; }
[ 1, 0 ]
FFmpeg
libavformat/avio.c
static struct URLProtocol *url_find_protocol(const char *filename) { URLProtocol *up = NULL; char proto_str[128], proto_nested[128], *ptr; size_t proto_len = strspn(filename, URL_SCHEME_CHARS); if (filename[proto_len] != ':' && (filename[proto_len] != ',' || !strchr(filename + proto_l...
[ 1, 0 ]
qemu
target-ppc/translate_init.c
int ppc_find_by_name(const unsigned char *name, ppc_def_t **def) { int i, ret; ret = -1; *def = NULL; for (i = 0; strcmp(ppc_defs[i].name, "default") != 0; i++) { if (strcasecmp(name, ppc_defs[i].name) == 0) { *def = &ppc_defs[i]; ret = 0; break; } } return ret; }
[ 1, 0 ]
qemu
hw/arm/omap1.c
static void spitz_gpio_setup(PXA2xxState *cpu, int slots) { qemu_irq lcd_hsync; /* * Bad hack: We toggle the LCD hsync GPIO on every GPIO status * read to satisfy broken guests that poll-wait for hsync. * Simulating a real hsync event would be less practical and * wouldn't guarantee that a guest ...
[ 1, 1 ]
qemu
ui/vnc.c
int vnc_display_pw_expire(DisplayState *ds, time_t expires) { VncDisplay *vs = ds ? (VncDisplay *)ds->opaque : vnc_display; vs->expires = expires; return 0;
[ 1, 0 ]
qemu
target-sparc/translate.c
static void do_fbranch(DisasContext *dc, int32_t offset, uint32_t insn, int cc, TCGv r_cond) { unsigned int cond = GET_FIELD(insn, 3, 6), a = (insn & (1 << 29)); target_ulong target = dc->pc + offset; if (cond == 0x0) { /* unconditional not taken */ if (a) { dc->pc = d...
[ 1, 1 ]
qemu
block/dirty-bitmap.c
static int load_bitmap_data(BlockDriverState *bs, const uint64_t *bitmap_table, uint32_t bitmap_table_size, BdrvDirtyBitmap *bitmap) { int ret = 0; BDRVQcow2State *s = bs->opaque; uint64_t sector, sbc; uint64_t bm_size =...
[ 1, 0 ]
qemu
block.c
void bdrv_io_plug(BlockDriverState *bs) { BlockDriver *drv = bs->drv; if (drv && drv->bdrv_io_plug) { drv->bdrv_io_plug(bs); } else if (bs->file) { bdrv_io_plug(bs->file); } }
[ 1, 0 ]
qemu
acl.c
void cpu_watchpoint_remove_all(CPUState *env, int mask) { CPUWatchpoint *wp, *next; TAILQ_FOREACH_SAFE(wp, &env->watchpoints, entry, next) { if (wp->flags & mask) cpu_watchpoint_remove_by_ref(env, wp); } }
[ 0, 0 ]
qemu
hw/net/virtio-net.c
void qemu_peer_set_vnet_hdr_len(NetClientState *nc, int len) { if (!nc->peer || !nc->peer->info->set_vnet_hdr_len) { return; } nc->peer->info->set_vnet_hdr_len(nc->peer, len); }
[ 1, 0 ]
FFmpeg
libavcodec/hevc.c
static void luma_mc(HEVCContext *s, int16_t *dst, ptrdiff_t dststride, AVFrame *ref, const Mv *mv, int x_off, int y_off, int block_w, int block_h) { HEVCLocalContext *lc = &s->HEVClc; uint8_t *src = ref->data[0]; ptrdiff_t srcstride = ref->linesize[0]; int pic_widt...
[ 1, 0 ]
qemu
target-s390x/cpu.h
static int load_normal_reset(S390CPU *cpu) { S390CPUClass *scc = S390_CPU_GET_CLASS(cpu); pause_all_vcpus(); cpu_synchronize_all_states(); cpu_reset_all(); io_subsystem_reset(); scc->initial_cpu_reset(CPU(cpu)); scc->load_normal(CPU(cpu)); cpu_synchronize_all_post_reset(); resume_all_vcpus()...
[ 1, 0 ]
qemu
target-ppc/excp_helper.c
void helper_rfi(CPUPPCState *env) { do_rfi(env, env->spr[SPR_SRR0], env->spr[SPR_SRR1], ~((target_ulong)0x783F0000), 1); }
[ 1, 0 ]
qemu
linux-user/signal.c
static inline void host_to_target_siginfo_noswap(target_siginfo_t *tinfo, const siginfo_t *info) { int sig = host_to_target_signal(info->si_signo); tinfo->si_signo = sig; tinfo->si_errno = 0; tinfo->si_code = info->si_code; if (sig == TARGET_SIGILL || si...
[ 1, 1 ]
FFmpeg
doc/APIchanges
static av_cold int twolame_encode_init(AVCodecContext *avctx) { TWOLAMEContext *s = avctx->priv_data; int ret; avctx->frame_size = TWOLAME_SAMPLES_PER_FRAME; avctx->delay = 512 - 32 + 1; s->glopts = twolame_init(); if (!s->glopts) return AVERROR(ENOMEM); twolame_set_verbosity(s->glopts, s->ve...
[ 1, 0 ]
FFmpeg
libavcodec/utils.c
static int add_metadata_from_side_data(AVCodecContext *avctx, AVFrame *frame) { int size, ret = 0; const uint8_t *side_metadata; const uint8_t *end; side_metadata = av_packet_get_side_data(avctx->pkt, AV_PKT_DATA_STRINGS_METADATA, &size); if (!side_metadata) ...
[ 1, 0 ]
qemu
qapi/opts-visitor.c
static void parse_type_str(Visitor *v, const char *name, char **obj, Error **errp) { StringInputVisitor *siv = to_siv(v); if (siv->string) { *obj = g_strdup(siv->string); } else { *obj = NULL; error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null", ...
[ 1, 0 ]
qemu
hw/input/Makefile.objs
static void adb_mouse_event(void *opaque, int dx1, int dy1, int dz1, int buttons_state) { MouseState *s = opaque; s->dx += dx1; s->dy += dy1; s->dz += dz1; s->buttons_state = buttons_state; }
[ 1, 0 ]
qemu
page_cache.c
void cache_insert(PageCache *cache, uint64_t addr, uint8_t *pdata) { CacheItem *it = NULL; g_assert(cache); g_assert(cache->page_cache); /* actual update of entry */ it = cache_get_by_addr(cache, addr); if (!it->it_data) { cache->num_items++; } it->it_data = pdata; it->it_age = ++cache->max_item_a...
[ 1, 0 ]
qemu
hw/dp8393x.c
static void usb_net_handle_destroy(USBDevice *dev) { USBNetState *s = (USBNetState *)dev; /* TODO: remove the nd_table[] entry */ qemu_del_vlan_client(s->vc); rndis_clear_responsequeue(s); qemu_free(s); }
[ 1, 1 ]
qemu
hw/mips_malta.c
void qemu_check_nic_model(NICInfo *nd, const char *model) { const char *models[2]; models[0] = model; models[1] = NULL; qemu_check_nic_model_list(nd, models, model); }
[ 1, 0 ]
qemu
bsd-user/main.c
static PowerPCCPU *ppc440_init_xilinx(ram_addr_t *ram_size, int do_init, const char *cpu_model, uint32_t sysclk) { PowerPCCPU *cpu; CPUPPCState *env; qemu_irq *irqs; cpu = POWERPC_CPU(cpu_ge...
[ 1, 0 ]
FFmpeg
libavcodec/h264pred_template.c
static void FUNCC(pred8x8_vertical)(uint8_t *_src, int _stride) { int i; pixel *src = (pixel *)_src; int stride = _stride / sizeof(pixel); const pixel4 a = ((pixel4 *)(src - stride))[0]; const pixel4 b = ((pixel4 *)(src - stride))[1]; for (i = 0; i < 8; i++) { ((pixel4 *)(src + i * stride))[0] = ...
[ 1, 0 ]
qemu
linux-user/signal.c
restore_fpu_state(CPUSPARCState *env, qemu_siginfo_fpu_t *fpu) { int err; #if 0 #ifdef CONFIG_SMP if (current->flags & PF_USEDFPU) regs->psr &= ~PSR_EF; #else if (current == last_task_used_math) { last_task_used_math = 0; regs->psr &= ~PSR_EF; ...
[ 1, 1 ]
qemu
target-arm/translate.c
static void gen_vfp_msr(TCGv tmp) { tcg_gen_mov_i32(cpu_F0s, tmp); dead_tmp(tmp); }
[ 1, 0 ]
FFmpeg
configure
void checkasm_check_blockdsp(void) { LOCAL_ALIGNED_16(uint16_t, buf0, [6 * 8 * 8]); LOCAL_ALIGNED_16(uint16_t, buf1, [6 * 8 * 8]); AVCodecContext avctx = {0}; BlockDSPContext h; ff_blockdsp_init(&h, &avctx); check_clear(clear_block, 8 * 8); check_clear(clear_blocks, 8 * 8 * 6); report("blockdsp...
[ 0, 0 ]
qemu
hw/virtio/virtio.c
static inline void vring_set_avail_event(VirtQueue *vq, uint16_t val) { VRingMemoryRegionCaches *caches; hwaddr pa; if (!vq->notification) { return; } caches = atomic_rcu_read(&vq->vring.caches); pa = offsetof(VRingUsed, ring[vq->vring.num]); virtio_stw_phys_cached(vq->vdev, &caches->used, pa,...
[ 1, 0 ]
FFmpeg
libavcodec/audio_frame_queue.c
void ff_af_queue_close(AudioFrameQueue *afq) { /* remove/free any remaining frames */ while (afq->frame_queue) delete_next_frame(afq); memset(afq, 0, sizeof(*afq)); }
[ 1, 0 ]
FFmpeg
doc/APIchanges
static int io_open_default(AVFormatContext *s, AVIOContext **pb, const char *url, int flags, AVDictionary **options) { return avio_open2(pb, url, flags, &s->interrupt_callback, options); }
[ 1, 0 ]
qemu
hw/9pfs/9p-proxy.c
static int v9fs_receive_status(V9fsProxy *proxy, struct iovec *reply, int *status) { int retval; ProxyHeader header; *status = 0; reply->iov_len = 0; retval = socket_read(proxy->sockfd, reply->iov_base, PROXY_HDR_SZ); if (retval < 0) { return retval; } reply-...
[ 1, 0 ]
qemu
monitor.c
static target_long monitor_get_xer(const struct MonitorDef *md, int val) { CPUState *env = mon_get_cpu(); if (!env) return 0; return env->xer; }
[ 1, 0 ]
FFmpeg
Changelog
static SchroFrame *libschroedinger_frame_from_data(AVCodecContext *avctx, const AVFrame *frame) { SchroEncoderParams *p_schro_params = avctx->priv_data; SchroFrame *in_frame = ff_create_schro_frame(avctx, p_schro_...
[ 1, 0 ]
qemu
linux-user/syscall.c
static inline abi_long target_to_host_semarray(int semid, unsigned short **host_array, abi_ulong target_addr) { int nsems; unsigned short *array; union semun semun; struct semid_ds semid_ds; int i, ret; sem...
[ 1, 0 ]
qemu
block.c
void qemu_opts_print(QemuOpts *opts) { QemuOpt *opt; QemuOptDesc *desc = opts->list->desc; if (desc[0].name == NULL) { QTAILQ_FOREACH(opt, &opts->head, next) { printf("%s=\"%s\" ", opt->name, opt->str); } return; } for (; desc && desc->name; desc++) { const char *value; Qem...
[ 1, 0 ]
qemu
hw/acpi/aml-build.c
static void build_fadt(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms, unsigned dsdt_tbl_offset) { AcpiFadtDescriptorRev5_1 *fadt = acpi_data_push(table_data, sizeof(*fadt)); unsigned dsdt_entry_offset = (char *)&fadt->dsdt - table_data->data; uint16_t bootflags; swit...
[ 1, 0 ]
qemu
hw/vt82c686.c
static int vt82c686b_initfn(PCIDevice *d) { uint8_t *pci_conf; uint8_t *wmask; int i; isa_bus_new(&d->qdev); pci_conf = d->config; pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_VIA); pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_VIA_ISA_BRIDGE); pci_config_set_class(pci_conf, PCI_CLASS_BR...
[ 1, 0 ]
qemu
target-i386/kvm.c
static void kvm_do_inject_x86_mce(void *_data) { struct kvm_x86_mce_data *data = _data; int r; /* If there is an MCE exception being processed, ignore this SRAO MCE */ if ((data->env->mcg_cap & MCG_SER_P) && !(data->mce->status & MCI_STATUS_AR)) { r = kvm_mce_in_exception(data->env); if (r...
[ 1, 0 ]
qemu
block/raw-posix.c
static int posix_aio_init(void) { struct sigaction act; PosixAioState *s; int fds[2]; struct qemu_paioinit ai; if (posix_aio_state) return 0; s = qemu_malloc(sizeof(PosixAioState)); sigfillset(&act.sa_mask); act.sa_flags = 0; /* do not restart syscalls to interrupt select() */ act.sa_ha...
[ 1, 0 ]
FFmpeg
doc/filters.texi
static int config_props(AVFilterLink *link) { UnsharpContext *unsharp = link->dst->priv; const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(link->format); unsharp->hsub = desc->log2_chroma_w; unsharp->vsub = desc->log2_chroma_h; init_filter_param(link->dst, &unsharp->luma, "luma", link->w); init_fi...
[ 1, 0 ]
FFmpeg
libavcodec/hap.h
static int hap_encode(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *frame, int *got_packet) { HapContext *ctx = avctx->priv_data; int header_length = hap_header_length(ctx); int final_data_size, ret; int pktsize = FFMAX(ctx->tex_size, ctx->max_snappy * ctx->chunk_count) ...
[ 1, 0 ]
FFmpeg
libavcodec/mips/h264qpel_msa.c
void ff_put_h264_qpel8_mc32_msa(uint8_t *dst, const uint8_t *src, ptrdiff_t stride) { avc_luma_midh_qrt_8w_msa(src - (2 * stride) - 2, stride, dst, stride, 8, 1); }
[ 0, 0 ]
FFmpeg
libavformat/rtpdec.c
static int rtcp_parse_packet(RTPDemuxContext *s, const unsigned char *buf, int len) { int payload_len; while (len >= 4) { payload_len = FFMIN(len, (AV_RB16(buf + 2) + 1) * 4); switch (buf[1]) { case RTCP_SR: if (payload_len < 20) { av_log(NULL, AV_LOG_...
[ 1, 0 ]
qemu
hw/acpi/Makefile.objs
static bool acpi_has_nvdimm(void) { PCMachineState *pcms = PC_MACHINE(qdev_get_machine()); return pcms->nvdimm; }
[ 0, 0 ]
qemu
block.c
static void strongarm_ppc_handler_update(StrongARMPPCInfo *s) { uint32_t level, diff; int bit; level = s->olevel & s->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
block/qcow2-refcount.c
static int64_t alloc_clusters_noref(BlockDriverState *bs, int64_t size) { BDRVQcowState *s = bs->opaque; int i, nb_clusters; nb_clusters = size_to_clusters(s, size); retry: for (i = 0; i < nb_clusters; i++) { int64_t i = s->free_cluster_index++; if (get_refcount(bs, i) != 0) goto retry; ...
[ 0, 0 ]
qemu
qemu-char.c
static int io_channel_send_full(QIOChannel *ioc, const void *buf, size_t len, int *fds, size_t nfds) { size_t offset = 0; while (offset < len) { ssize_t ret = 0; struct iovec iov = {.iov_base = (char *)buf + offset, ...
[ 0, 0 ]
qemu
include/qapi/visitor-impl.h
void visit_type_uint8(Visitor *v, uint8_t *obj, const char *name, Error **errp) { int64_t value; if (v->type_uint8) { v->type_uint8(v, obj, name, errp); } else { value = *obj; v->type_int64(v, &value, name, errp); if (value < 0 || value > UINT8_MAX) { /* FIXME questionable reuse of ...
[ 1, 1 ]
qemu
exec.c
void *qemu_anon_ram_alloc(size_t size) { void *ptr; /* FIXME: this is not exactly optimal solution since VirtualAlloc has 64Kb granularity, but at least it guarantees us that the memory is page aligned. */ ptr = VirtualAlloc(NULL, size, MEM_COMMIT, PAGE_READWRITE); trace_qemu_anon_ram_alloc(siz...
[ 0, 1 ]
qemu
block/qcow2-cluster.c
static bool coroutine_fn do_perform_cow_encrypt(BlockDriverState *bs, uint64_t src_cluster_offset, unsigned offset_in_cluster, uint8_t *buffer, ...
[ 1, 0 ]
qemu
tests/ahci-test.c
static void test_identify(void) { AHCIQState *ahci; ahci = ahci_boot_and_enable(); ahci_test_identify(ahci); ahci_shutdown(ahci); }
[ 0, 0 ]
qemu
HACKING
static void apic_send_msi(target_phys_addr_t addr, uint32_t data) { uint8_t dest = (addr & MSI_ADDR_DEST_ID_MASK) >> MSI_ADDR_DEST_ID_SHIFT; uint8_t vector = (data & MSI_DATA_VECTOR_MASK) >> MSI_DATA_VECTOR_SHIFT; uint8_t dest_mode = (addr >> MSI_ADDR_DEST_MODE_SHIFT) & 0x1; uint8_t trigger_mode = (data >>...
[ 1, 1 ]
qemu
target-lm32/translate.c
static void dec_sr(DisasContext *dc) { if (dc->format == OP_FMT_RI) { LOG_DIS("sri r%d, r%d, %d\n", dc->r1, dc->r0, dc->imm5); } else { LOG_DIS("sr r%d, r%d, r%d\n", dc->r2, dc->r0, dc->r1); } if (!(dc->env->features & LM32_FEATURE_SHIFT)) { if (dc->format == OP_FMT_RI) { /* TODO: chec...
[ 1, 1 ]
qemu
target-i386/kvm.c
int kvm_arch_on_sigbus(int code, void *addr) { #ifdef KVM_CAP_MCE if ((first_cpu->mcg_cap & MCG_SER_P) && addr && code == BUS_MCEERR_AO) { ram_addr_t ram_addr; target_phys_addr_t paddr; /* Hope we are lucky for AO MCE */ if (qemu_ram_addr_from_host(addr, &ram_addr) || !kvm_physical_mem...
[ 1, 0 ]
qemu
block/block-backend.c
static void qemu_aio_complete(void *opaque, int ret) { struct ioreq *ioreq = opaque; if (ret != 0) { xen_be_printf(&ioreq->blkdev->xendev, 0, "%s I/O error\n", ioreq->req.operation == BLKIF_OP_READ ? "read" : "write"); ioreq->aio_errors++; } ioreq->aio_inflight--; if (ioreq->...
[ 0, 0 ]
qemu
qemu-img.c
static int img_info(int argc, char **argv) { int c; OutputFormat output_format = OFORMAT_HUMAN; const char *filename, *fmt, *output; BlockDriverState *bs; ImageInfo *info; fmt = NULL; output = NULL; for (;;) { int option_index = 0; static const struct option long_options[] = { ...
[ 1, 0 ]
qemu
target-i386/cpu.c
static int cpu_x86_find_by_name(X86CPU *cpu, x86_def_t *x86_cpu_def, const char *name) { x86_def_t *def; int i; if (name == NULL) { return -1; } if (kvm_enabled() && strcmp(name, "host") == 0) { kvm_cpu_fill_host(x86_cpu_def); object_property_set_bool(OBJEC...
[ 1, 0 ]
qemu
docs/specs/vhost-user.txt
static int net_vhost_user_init(NetClientState *peer, const char *device, const char *name, CharDriverState *chr) { NetClientState *nc; VhostUserState *s; nc = qemu_new_net_client(&net_vhost_user_info, peer, device, name); snprintf(nc->info_str, sizeof(nc->info_str), "vhost-u...
[ 1, 0 ]
qemu
hw/arm/virt-acpi-build.c
MemoryRegion *rom_add_blob(const char *name, const void *blob, size_t len, size_t max_len, hwaddr addr, const char *fw_file_name, FWCfgReadCallback fw_callback, void *callback_opaque) { MachineClass *mc = MACHINE_GET_CLASS(qdev_get_m...
[ 1, 0 ]
qemu
HACKING
static uint64_t sysctl_read(void *opaque, target_phys_addr_t addr, unsigned size) { MilkymistSysctlState *s = opaque; uint32_t r = 0; addr >>= 2; switch (addr) { case R_TIMER0_COUNTER: r = (uint32_t)ptimer_get_count(s->ptimer0); /* milkymist timer counts up */ ...
[ 1, 0 ]
FFmpeg
libavcodec/mpeg4videodec.c
static int mpeg4_decode_gop_header(MpegEncContext *s, GetBitContext *gb) { int hours, minutes, seconds; if (!show_bits(gb, 23)) { av_log(s->avctx, AV_LOG_WARNING, "GOP header invalid\n"); return -1; } hours = get_bits(gb, 5); minutes = get_bits(gb, 6); skip_bits1(gb); seconds = get_bits(g...
[ 0, 0 ]
qemu
hw/core/qdev.c
static void virtio_ccw_rng_instance_init(Object *obj) { VirtIORNGCcw *dev = VIRTIO_RNG_CCW(obj); object_initialize(&dev->vdev, sizeof(dev->vdev), TYPE_VIRTIO_RNG); object_property_add_child(obj, "virtio-backend", OBJECT(&dev->vdev), NULL); object_property_add_link(obj, "rng", TYPE_RNG_BACKEND, ...
[ 1, 0 ]
qemu
hw/xen_disk.c
static void ioreq_release(struct ioreq *ioreq, bool finish) { struct XenBlkDev *blkdev = ioreq->blkdev; QLIST_REMOVE(ioreq, list); memset(ioreq, 0, sizeof(*ioreq)); ioreq->blkdev = blkdev; QLIST_INSERT_HEAD(&blkdev->freelist, ioreq, list); if (finish) { blkdev->requests_finished--; } else { ...
[ 1, 0 ]
qemu
monitor.c
static void monitor_qapi_event_emit(QAPIEvent event, QDict *qdict) { Monitor *mon; trace_monitor_protocol_event_emit(event, qdict); QLIST_FOREACH(mon, &mon_list, entry) { if (monitor_is_qmp(mon) && mon->qmp.in_command_mode) { monitor_json_emitter(mon, QOBJECT(qdict)); } } }
[ 1, 0 ]
qemu
net.c
int check_params(const char *const *params, const char *str) { int name_buf_size = 1; const char *p; char *name_buf; int i, len; int ret = 0; for (i = 0; params[i] != NULL; i++) { len = strlen(params[i]) + 1; if (len > name_buf_size) { name_buf_size = len; } } name_buf = qem...
[ 0, 0 ]
qemu
exec-i386.c
void cpu_x86_fsave(CPUX86State *s, uint8_t *ptr, int data32) { CPUX86State *saved_env; saved_env = env; env = s; helper_fsave(ptr, data32); env = saved_env; }
[ 0, 0 ]
qemu
buffered_file.c
int do_migrate_set_speed(Monitor *mon, const QDict *qdict, QObject **ret_data) { int64_t d; FdMigrationState *s; d = qdict_get_int(qdict, "value"); d = MAX(0, MIN(UINT32_MAX, d)); max_throttle = d; s = migrate_to_fms(current_migration); if (s && s->file) { qemu_file_set_rate_limit(s->file, ma...
[ 1, 0 ]