Projectname
large_stringclasses
15 values
Filepath
large_stringlengths
4
106
Function
large_stringlengths
11
3.45k
Label
list
qemu
block_int.h
static USBDevice *usb_msd_init(const char *filename) { static int nr = 0; char id[8]; QemuOpts *opts; DriveInfo *dinfo; USBDevice *dev; int fatal_error; const char *p1; char fmt[32]; /* parse -usbdevice disk: syntax into drive opts */ snprintf(id, sizeof(id), "usb%d", nr++); opts = qem...
[ 1, 1 ]
qemu
target-ppc/translate.c
static inline void gen_evmergelo(DisasContext *ctx) { if (unlikely(!ctx->spe_enabled)) { gen_exception(ctx, POWERPC_EXCP_APU); return; } #if defined(TARGET_PPC64) TCGv t0 = tcg_temp_new(); TCGv t1 = tcg_temp_new(); tcg_gen_ext32u_tl(t0, cpu_gpr[rB(ctx->opcode)]); tcg_gen_shli_tl(t1, cpu_gpr...
[ 0, 0 ]
qemu
target-unicore32/Makefile.objs
void HELPER(ucf64_set_fpscr)(CPUUniCore32State *env, uint32_t val) { int i; uint32_t changed; changed = env->ucf64.xregs[UC32_UCF64_FPSCR]; env->ucf64.xregs[UC32_UCF64_FPSCR] = (val & UCF64_FPSCR_MASK); changed ^= val; if (changed & (UCF64_FPSCR_RND_MASK)) { i = UCF64_FPSCR_RND(val); switch...
[ 0, 0 ]
FFmpeg
libavformat/cache.c
static int64_t cache_seek(URLContext *h, int64_t pos, int whence) { Context *c = h->priv_data; if (whence == AVSEEK_SIZE) { pos = ffurl_seek(c->inner, pos, whence); if (pos <= 0) { pos = ffurl_seek(c->inner, -1, SEEK_END); ffurl_seek(c->inner, c->end, SEEK_SET); if (pos <= 0) ...
[ 0, 0 ]
qemu
include/sysemu/tpm_backend.h
int tpm_register_driver(const TPMDriverOps *tdo) { int i; for (i = 0; i < TPM_MAX_DRIVERS; i++) { if (!be_drivers[i]) { be_drivers[i] = tdo; return 0; } } error_report("Could not register TPM driver"); return 1; }
[ 1, 0 ]
FFmpeg
libavcodec/hevc_cabac.c
int ff_hevc_cu_qp_delta_abs(HEVCContext *s) { int prefix_val = 0; int suffix_val = 0; int inc = 0; while (prefix_val < 5 && GET_CABAC(elem_offset[CU_QP_DELTA] + inc)) { prefix_val++; inc = 1; } if (prefix_val >= 5) { int k = 0; while (k < CABAC_MAX_BIN && get_cabac_bypass(&s->HEVCl...
[ 1, 0 ]
qemu
configure
static ssize_t vnc_client_read_tls(gnutls_session_t *session, uint8_t *data, size_t datalen) { ssize_t ret = gnutls_read(*session, data, datalen); if (ret < 0) { if (ret == GNUTLS_E_AGAIN) { errno = EAGAIN; } else { errno = EIO; } ret = -1; }...
[ 1, 0 ]
qemu
gdbstub.c
static inline void gdb_continue(GDBState *s) { #ifdef CONFIG_USER_ONLY s->running_state = 1; #else vm_start(); #endif }
[ 1, 0 ]
FFmpeg
libavcodec/dxva2_mpeg2.c
static int slice_end(AVCodecContext *avctx, AVFrame *pict) { Mpeg1Context *s1 = avctx->priv_data; MpegEncContext *s = &s1->mpeg_enc_ctx; if (!s1->mpeg_enc_ctx_allocated || !s->current_picture_ptr) return 0; if (s->avctx->hwaccel) { if (s->avctx->hwaccel->end_frame(s->avctx) < 0) av_log(avc...
[ 1, 1 ]
qemu
hw/char/sclpconsole-lm.c
static void trigger_console_data(void *opaque, int n, int level) { sclp_service_interrupt(0); }
[ 1, 0 ]
FFmpeg
libavcodec/vdpau.c
MAKE_ACCESSORS(AVVDPAUContext, vdpau_hwaccel, AVVDPAU_Render2, render2) int ff_vdpau_common_init(AVCodecContext *avctx, VdpDecoderProfile profile, int level) { VDPAUHWContext *hwctx = avctx->hwaccel_context; VDPAUContext *vdctx = avctx->internal->hwaccel_priv_data; VdpDecoderCreate *creat...
[ 1, 0 ]
qemu
target-ppc/kvm.c
void kvmppc_set_papr(CPUPPCState *env) { struct kvm_enable_cap cap = {}; struct kvm_one_reg reg = {}; struct kvm_sregs sregs = {}; int ret; uint64_t hior = env->spr[SPR_HIOR]; cap.cap = KVM_CAP_PPC_PAPR; ret = kvm_vcpu_ioctl(env, KVM_ENABLE_CAP, &cap); if (ret) { goto fail; } /* *...
[ 1, 1 ]
qemu
hw/loader.c
int load_image_targphys(const char *filename, target_phys_addr_t addr, int max_sz) { int size; size = get_image_size(filename); if (size > 0) rom_add_file_fixed(filename, addr, -1); return size; }
[ 1, 0 ]
FFmpeg
ffplay.c
static void stream_close(VideoState *is) { VideoPicture *vp; int i; /* XXX: use a special url_shutdown call to abort parse cleanly */ is->abort_request = 1; SDL_WaitThread(is->read_tid, NULL); SDL_WaitThread(is->refresh_tid, NULL); packet_queue_destroy(&is->videoq); packet_queue_destroy(&is->au...
[ 0, 1 ]
FFmpeg
libavcodec/cook.c
static void init_gain_table(COOKContext *q) { int i; q->gain_size_factor = q->samples_per_channel / 8; for (i = 0; i < 23; i++) { q->gain_table[i] = pow((double)q->pow2tab[i + 52], (1.0 / (double)q->gain_size_factor)); } memset(&q->gain_copy, 0, sizeof(COOKgain)); memse...
[ 1, 0 ]
qemu
qom/object.c
char *object_property_print(Object *obj, const char *name, bool human, Error **errp) { StringOutputVisitor *mo; char *string; mo = string_output_visitor_new(human); object_property_get(obj, string_output_get_visitor(mo), name, errp); string = string_output_get_string(mo); ...
[ 1, 0 ]
qemu
hw/display/virtio-gpu.c
static void virtio_gpu_resource_create_2d(VirtIOGPU *g, struct virtio_gpu_ctrl_command *cmd) { pixman_format_code_t pformat; struct virtio_gpu_simple_resource *res; struct virtio_gpu_resource_create_2d c2d; VIRTIO_GPU_FILL_CMD(c2d); trace_virtio_gpu_cmd_res_cre...
[ 1, 0 ]
qemu
audio/paaudio.c
static void qpa_fini_out(HWVoiceOut *hw) { void *ret; PAVoiceOut *pa = (PAVoiceOut *)hw; audio_pt_lock(&pa->pt, AUDIO_FUNC); pa->done = 1; audio_pt_unlock_and_signal(&pa->pt, AUDIO_FUNC); audio_pt_join(&pa->pt, &ret, AUDIO_FUNC); if (pa->s) { pa_simple_free(pa->s); pa->s = NULL; } a...
[ 1, 0 ]
qemu
hw/i386/pc.c
static void pc_dimm_unplug_request(HotplugHandler *hotplug_dev, DeviceState *dev, Error **errp) { HotplugHandlerClass *hhc; Error *local_err = NULL; PCMachineState *pcms = PC_MACHINE(hotplug_dev); if (!pcms->acpi_dev) { error_setg(&local_err, "memory...
[ 1, 0 ]
qemu
hw/pci-hotplug.c
SCSIDevice *scsi_bus_legacy_add_drive(SCSIBus *bus, BlockDriverState *bdrv, int unit) { const char *driver; DeviceState *dev; driver = bdrv_is_sg(bdrv) ? "scsi-generic" : "scsi-disk"; dev = qdev_create(&bus->qbus, driver); qdev_prop_set_uint32(dev, "scsi-id", unit);...
[ 0, 0 ]
qemu
block/nbd-client.h
NBDExport *nbd_export_new(BlockBackend *blk, off_t dev_offset, off_t size, uint32_t nbdflags, void (*close)(NBDExport *), Error **errp) { NBDExport *exp = g_malloc0(sizeof(NBDExport)); exp->refcount = 1; QTAILQ_INIT(&exp->clients); exp->blk = blk; ex...
[ 0, 0 ]
qemu
block/qapi.c
static void test_visitor_in_native_list_bool(TestInputVisitorData *data, const void *unused) { UserDefNativeListUnion *cvalue = NULL; boolList *elem = NULL; Visitor *v; GString *gstr_list = g_string_new(""); GString *gstr_union = g_string_new(""); int i; ...
[ 1, 0 ]
FFmpeg
libavcodec/qdm2.c
static void init_quantized_coeffs_elem0(int8_t *quantized_coeffs, GetBitContext *gb, int length) { int i, k, run, level, diff; if (BITS_LEFT(length, gb) < 16) return; level = qdm2_get_vlc(gb, &vlc_tab_level, 0, 2); quantized_coeffs[0] = level; for (i = 0; i <...
[ 0, 0 ]
qemu
target-arm/translate-a64.c
static void handle_fmov(DisasContext *s, int rd, int rn, int type, bool itof) { /* FMOV: gpr to or from float, double, or top half of quad fp reg, * without conversion. */ if (itof) { TCGv_i64 tcg_rn = cpu_reg(s, rn); switch (type) { case 0: { /* 32 bit */ TCGv_i64 tmp =...
[ 1, 0 ]
qemu
block.c
static void set_dirty_bitmap(BlockDriverState *bs, int64_t sector_num, int nb_sectors, int dirty) { int64_t start, end; unsigned long val, idx, bit; start = sector_num / BDRV_SECTORS_PER_DIRTY_CHUNK; end = (sector_num + nb_sectors - 1) / BDRV_SECTORS_PER_DIRTY_CHUNK; for (;...
[ 1, 0 ]
qemu
fsdev/virtfs-proxy-helper.c
static int proxy_parse_opts(QemuOpts *opts, struct FsDriverEntry *fs) { const char *socket = qemu_opt_get(opts, "socket"); const char *sock_fd = qemu_opt_get(opts, "sock_fd"); if (!socket && !sock_fd) { fprintf(stderr, "socket and sock_fd none of the option specified\n"); return -1; } if (socke...
[ 0, 0 ]
qemu
HACKING
static void lsi_ram_write(void *opaque, target_phys_addr_t addr, uint64_t val, unsigned size) { LSIState *s = opaque; uint32_t newval; uint32_t mask; int shift; newval = s->script_ram[addr >> 2]; shift = (addr & 3) * 8; mask = ((uint64_t)1 << (size * 8)) - 1; newval &...
[ 0, 0 ]
qemu
kvm-all.c
void kvm_cpu_synchronize_state(CPUState *env) { if (!env->kvm_vcpu_dirty) run_on_cpu(env, do_kvm_cpu_synchronize_state, env); }
[ 0, 0 ]
qemu
cpu-exec-common.c
void breakpoint_handler(CPUState *cs) { X86CPU *cpu = X86_CPU(cs); CPUX86State *env = &cpu->env; CPUBreakpoint *bp; if (cs->watchpoint_hit) { if (cs->watchpoint_hit->flags & BP_CPU) { cs->watchpoint_hit = NULL; if (check_hw_breakpoints(env, false)) { raise_exception(env, EXCP01_...
[ 1, 0 ]
qemu
hw/mac_dbdma.c
static void start_output(DBDMA_channel *ch, int key, uint32_t addr, uint16_t req_count, int is_last) { DBDMA_DPRINTF("start_output\n"); /* KEY_REGS, KEY_DEVICE and KEY_STREAM * are not implemented in the mac-io chip */ DBDMA_DPRINTF("addr 0x%x key 0x%x\n", addr, key); if (...
[ 1, 0 ]
qemu
hw/qdev-properties.c
static int print_int32(DeviceState *dev, Property *prop, char *dest, size_t len) { int32_t *ptr = qdev_get_prop_ptr(dev, prop); return snprintf(dest, len, "%" PRId32, *ptr); }
[ 1, 0 ]
FFmpeg
postproc/rgb2rgb.c
static inline void RENAME(uyvyToY)(uint8_t *dst, uint8_t *src, int width) { #ifdef HAVE_MMX asm volatile( "mov %0, %%" REG_a " \n\t" "1: \n\t" "movq (%1, %%" REG_a ",2), %%mm0 \n\t" "movq 8(%1, %%" REG_a ",2), %%mm1 \n\t" "psrlw $8, %%mm0 \n\t" "psrlw $8, %%mm1 \n\t"...
[ 1, 0 ]
qemu
hw/usb-ehci.c
static void ehci_queues_rip_unused(EHCIState *ehci, int async) { EHCIQueueHead *head = async ? &ehci->aqueues : &ehci->pqueues; EHCIQueue *q, *tmp; QTAILQ_FOREACH_SAFE(q, head, next, tmp) { if (q->seen) { q->seen = 0; q->ts = ehci->last_run_ns; continue; } if (ehci->last_run...
[ 1, 0 ]
qemu
target-i386/kvm.c
void kvm_arch_pre_run(CPUState *env, struct kvm_run *run) { /* Inject NMI */ if (env->interrupt_request & CPU_INTERRUPT_NMI) { env->interrupt_request &= ~CPU_INTERRUPT_NMI; DPRINTF("injected NMI\n"); kvm_vcpu_ioctl(env, KVM_NMI); } if (!kvm_irqchip_in_kernel()) { /* Force the VCPU out of...
[ 1, 1 ]
qemu
tests/bios-tables-test.c
static void test_acpi_one(const char *params, test_data *data) { char *args; uint8_t signature_low; uint8_t signature_high; uint16_t signature; int i; const char *device = ""; if (!g_strcmp0(data->machine, MACHINE_Q35)) { device = ",id=hd -device ide-hd,drive=hd"; } args = g_strdup_print...
[ 1, 1 ]
qemu
exec.c
static void destroy_page_desc(uint16_t section_index) { MemoryRegionSection *section = &phys_sections[section_index]; MemoryRegion *mr = section->mr; if (mr->subpage) { subpage_t *subpage = container_of(mr, subpage_t, iomem); memory_region_destroy(&subpage->iomem); g_free(subpage); } }
[ 1, 0 ]
qemu
hw/core/ptimer.c
static void replay_save_event(Event *event, int checkpoint) { if (replay_mode != REPLAY_MODE_PLAY) { /* put the event into the file */ replay_put_event(EVENT_ASYNC); replay_put_byte(checkpoint); replay_put_byte(event->event_kind); /* save event-specific data */ switch (event->event_kin...
[ 0, 0 ]
qemu
posix-aio-compat.c
static size_t handle_aiocb_flush(struct qemu_paiocb *aiocb) { int ret; ret = qemu_fdatasync(aiocb->aio_fildes); if (ret == -1) return -errno; return 0; }
[ 0, 0 ]
qemu
include/qapi/qmp/json-streamer.h
static QObject *parse_literal(JSONParserContext *ctxt) { QObject *token; token = parser_context_pop_token(ctxt); assert(token); switch (token_get_type(token)) { case JSON_STRING: return QOBJECT(qstring_from_escaped_str(ctxt, token)); case JSON_INTEGER: { /* A possibility exists that this is...
[ 0, 1 ]
qemu
hw/pci/msix.c
int msix_init_exclusive_bar(PCIDevice *dev, unsigned short nentries, uint8_t bar_nr) { int ret; char *name; /* * Migration compatibility dictates that this remains a 4k * BAR with the vector table in the lower half and PBA in * the upper half. Do not use these elsewhe...
[ 0, 0 ]
qemu
hw/file-op-9p.h
static int v9fs_do_mkdir(V9fsState *s, V9fsString *path, mode_t mode) { return s->ops->mkdir(&s->ctx, path->data, mode); }
[ 0, 0 ]
qemu
HACKING
static uint32_t slow_bar_readb(void *opaque, target_phys_addr_t addr) { AssignedDevRegion *d = opaque; uint8_t *in = d->u.r_virtbase + addr; uint32_t r; r = *in; DEBUG("slow_bar_readl addr=0x" TARGET_FMT_plx " val=0x%08x\n", addr, r); return r; }
[ 0, 0 ]
qemu
target/s390x/helper.h
uint32_t HELPER(tprot)(uint64_t a1, uint64_t a2) { /* XXX implement */ return 0; }
[ 0, 1 ]
qemu
hw/arm/pxa2xx.c
static void ds1338_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); I2CSlaveClass *k = I2C_SLAVE_CLASS(klass); k->init = ds1338_init; k->event = ds1338_event; k->recv = ds1338_recv; k->send = ds1338_send; dc->reset = ds1338_reset; dc->vmsd = &vmstate_ds1338; }
[ 0, 0 ]
qemu
Makefile.objs
static void extend_solid_area(VncState *vs, int x, int y, int w, int h, uint32_t color, int *x_ptr, int *y_ptr, int *w_ptr, int *h_ptr) { int cx, cy; /* Try to extend the area upwards. */ for (cy = *y_ptr - 1; cy >= y && check_solid_tile(vs...
[ 1, 0 ]
qemu
darwin-user/main.c
static inline void RET_CHG_FLOW(DisasContext *ctx) { ctx->exception = EXCP_MTMSR; }
[ 0, 0 ]
qemu
linux-user/signal.c
static void setup_sigframe_v2(struct target_ucontext_v2 *uc, target_sigset_t *set, CPUState *env) { struct target_sigaltstack stack; int i; /* Clear all the bits of the ucontext we don't use. */ memset(uc, 0, offsetof(struct target_ucontext_v2, tuc_mcontext)); memset(&sta...
[ 1, 1 ]
qemu
hw/pci/pci.c
void pci_bridge_write_config(PCIDevice *d, uint32_t address, uint32_t val, int len) { PCIBridge *s = PCI_BRIDGE(d); uint16_t oldctl = pci_get_word(d->config + PCI_BRIDGE_CONTROL); uint16_t newctl; pci_default_write_config(d, address, val, len); if (ranges_overlap(address, l...
[ 0, 0 ]
qemu
target-unicore32/Makefile.objs
static inline int ucf64_exceptbits_to_host(int target_bits) { int host_bits = 0; if (target_bits & UCF64_FPSCR_FLAG_INVALID) { host_bits |= float_flag_invalid; } if (target_bits & UCF64_FPSCR_FLAG_DIVZERO) { host_bits |= float_flag_divbyzero; } if (target_bits & UCF64_FPSCR_FLAG_OVERFLOW) { ...
[ 0, 0 ]
qemu
docs/qapi-code-gen.txt
static void qmp_output_start_list(Visitor *v, const char *name, Error **errp) { QmpOutputVisitor *qov = to_qov(v); QList *list = qlist_new(); qmp_output_add(qov, name, list); qmp_output_push(qov, list); }
[ 0, 0 ]
qemu
fpu/softfloat-specialize.h
float64 float64_round_to_int(float64 a STATUS_PARAM) { flag aSign; int16 aExp; bits64 lastBitMask, roundBitsMask; int8 roundingMode; float64 z; aExp = extractFloat64Exp(a); if (0x433 <= aExp) { if ((aExp == 0x7FF) && extractFloat64Frac(a)) { return propagateFloat64NaN(a, a STATUS_VAR);...
[ 1, 0 ]
qemu
hw/scsi/lsi53c895a.c
static void scsi_cd_class_initfn(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); SCSIDeviceClass *sc = SCSI_DEVICE_CLASS(klass); sc->init = scsi_cd_initfn; sc->destroy = scsi_destroy; sc->alloc_req = scsi_new_request; sc->unit_attention_reported = scsi_disk_unit_attention_rep...
[ 0, 0 ]
qemu
exec.c
uint8_t cpu_inb(pio_addr_t addr) { uint8_t val; val = ioport_read(0, addr); trace_cpu_in(addr, val); LOG_IOPORT("inb : %04" FMT_pioaddr " %02" PRIx8 "\n", addr, val); return val; }
[ 0, 0 ]
qemu
block/nbd.c
static void vnc_init_basic_info_from_remote_addr(QIOChannelSocket *ioc, VncBasicInfo *info, Error **errp) { SocketAddress *addr = NULL; addr = qio_channel_socket_get_remote_address(ioc, errp); if (!addr) { ...
[ 0, 0 ]
qemu
Makefile
static void vnc_write_u8(VncState *vs, uint8_t value) { vnc_write(vs, (char *)&value, 1); }
[ 0, 0 ]
qemu
cpu-exec.c
static inline void gen_neon_addl_saturate(TCGv op0, TCGv op1, int size) { switch (size) { case 1: gen_helper_neon_addl_saturate_s32(op0, cpu_env, op0, op1); break; case 2: gen_helper_neon_addl_saturate_s64(op0, cpu_env, op0, op1); break; default: abort(); } }
[ 0, 0 ]
FFmpeg
libavcodec/utvideodec.c
static int build_huff(const uint8_t *src, VLC *vlc, int *fsym) { int i; HuffEntry he[256]; int last; uint32_t codes[256]; uint8_t bits[256]; uint8_t syms[256]; uint32_t code; *fsym = -1; for (i = 0; i < 256; i++) { he[i].sym = i; he[i].len = *src++; } qsort(he, 256, sizeof(*he...
[ 1, 0 ]
FFmpeg
libavformat/pcmdec.c
static int pcm_read_header(AVFormatContext *s) { PCMAudioDemuxerContext *s1 = s->priv_data; AVStream *st; uint8_t *mime_type = NULL; st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO; st->codecpar->codec_id = s->iformat->raw_code...
[ 1, 0 ]
qemu
configure
static void qemu_tcg_init_cpu_signals(void) { #ifdef CONFIG_IOTHREAD sigset_t set; struct sigaction sigact; memset(&sigact, 0, sizeof(sigact)); sigact.sa_handler = cpu_signal; sigaction(SIG_IPI, &sigact, NULL); sigemptyset(&set); sigaddset(&set, SIG_IPI); pthread_sigmask(SIG_UNBLOCK, &set, NUL...
[ 1, 0 ]
qemu
ui/console.c
static QemuConsole *new_console(DisplayState *ds, console_type_t console_type) { Error *local_err = NULL; Object *obj; QemuConsole *s; int i; if (nb_consoles >= MAX_CONSOLES) return NULL; obj = object_new(TYPE_QEMU_CONSOLE); s = QEMU_CONSOLE(obj); object_property_add_link(obj, "device", TY...
[ 1, 1 ]
FFmpeg
doc/APIchanges
int avio_open2(AVIOContext **s, const char *filename, int flags, const AVIOInterruptCB *int_cb, AVDictionary **options) { AVIOInternal *internal; const URLProtocol **protocols; URLContext *h; int err; protocols = ffurl_get_protocols(NULL, NULL); if (!protocols) return AVERROR(ENO...
[ 1, 0 ]
qemu
Makefile.objs
static void result_to_network(RDMARegisterResult *result) { result->rkey = htonl(result->rkey); result->host_addr = htonll(result->host_addr); };
[ 1, 0 ]
FFmpeg
libavformat/omadec.c
static int nprobe(AVFormatContext *s, uint8_t *enc_header, int size, const uint8_t *n_val) { OMAContext *oc = s->priv_data; uint32_t pos, taglen, datalen; struct AVDES av_des; if (!enc_header || !n_val) return -1; pos = OMA_ENC_HEADER_SIZE + oc->k_size; if (!memcmp(&enc_header...
[ 1, 0 ]
qemu
block/sheepdog.c
static coroutine_fn void reconnect_to_sdog(void *opaque) { Error *local_err = NULL; BDRVSheepdogState *s = opaque; AIOReq *aio_req, *next; aio_set_fd_handler(s->aio_context, s->fd, NULL, NULL, NULL); close(s->fd); s->fd = -1; /* Wait for outstanding write requests to be completed. */ while (s->...
[ 1, 0 ]
qemu
hw/block/onenand.c
static inline int onenand_erase(OneNANDState *s, int sec, int num) { uint8_t *blankbuf, *tmpbuf; blankbuf = g_malloc(512); tmpbuf = g_malloc(512); memset(blankbuf, 0xff, 512); for (; num > 0; num--, sec++) { if (s->blk_cur) { int erasesec = s->secs_cur + (sec >> 5); if (blk_write(s->b...
[ 1, 0 ]
qemu
default-configs/i386-softmmu.mak
static PCIDevice *qemu_pci_hot_add_nic(Monitor *mon, const char *devaddr, const char *opts_str) { Error *local_err = NULL; QemuOpts *opts; PCIBus *root = pci_find_primary_bus(); PCIBus *bus; int ret, devfn; if (!root) { ...
[ 1, 0 ]
qemu
hmp.c
void rdma_start_outgoing_migration(void *opaque, const char *host_port, Error **errp) { MigrationState *s = opaque; Error *local_err = NULL, **temp = &local_err; RDMAContext *rdma = qemu_rdma_data_init(host_port, &local_err); int ret = 0; if (rdma == NULL) { ERRO...
[ 1, 0 ]
qemu
memory.c
static void memory_region_update_coalesced_range(MemoryRegion *mr) { FlatRange *fr; CoalescedMemoryRange *cmr; AddrRange tmp; FOR_EACH_FLAT_RANGE(fr, &address_space_memory.current_map) { if (fr->mr == mr) { qemu_unregister_coalesced_mmio(int128_get64(fr->addr.start), ...
[ 1, 0 ]
qemu
hw/intc/exynos4210_gic.c
void exynos4210_init_board_irqs(Exynos4210Irq *s) { uint32_t grp, bit, irq_id, n; for (n = 0; n < EXYNOS4210_MAX_EXT_COMBINER_IN_IRQ; n++) { s->board_irqs[n] = qemu_irq_split(s->int_combiner_irq[n], s->ext_combiner_irq[n]); irq_id = 0; if (n == EXYNOS4210_COM...
[ 1, 0 ]
FFmpeg
libavcodec/internal.h
int ff_lock_avcodec(AVCodecContext *log_ctx, const AVCodec *codec) { if (codec->caps_internal & FF_CODEC_CAP_INIT_THREADSAFE || !codec->init) return 0; if (ff_mutex_lock(&codec_mutex)) return -1; if (atomic_fetch_add(&entangled_thread_counter, 1)) { av_log(log_ctx, AV_LOG_ERROR, "In...
[ 1, 0 ]
FFmpeg
libavformat/mpeg.c
static int check_pes(uint8_t *p, uint8_t *end) { int pes1; int pes2 = (p[3] & 0xC0) == 0x80 && (p[4] & 0xC0) != 0x40 && ((p[4] & 0xC0) == 0x00 || (p[4] & 0xC0) >> 2 == (p[6] & 0xF0)); for (p += 3; p < end && *p == 0xFF; p++) ; if ((*p & 0xC0) == 0x40) p += 2; if ((*p &...
[ 1, 0 ]
qemu
hw/block/pc_sysfw.c
void pc_system_firmware_init(MemoryRegion *rom_memory) { DriveInfo *pflash_drv; PcSysFwDevice *sysfw_dev; /* * TODO This device exists only so that users can switch between * use of flash and ROM for the BIOS. The ability to switch was * created because flash doesn't work with KVM. Once it does,...
[ 1, 1 ]
qemu
hw/intc/xics.c
static int spapr_nvram_init(VIOsPAPRDevice *dev) { sPAPRNVRAM *nvram = VIO_SPAPR_NVRAM(dev); if (nvram->drive) { nvram->size = bdrv_getlength(nvram->drive); } else { nvram->size = DEFAULT_NVRAM_SIZE; nvram->buf = g_malloc0(nvram->size); } if ((nvram->size < MIN_NVRAM_SIZE) || (nvram->size ...
[ 1, 0 ]
qemu
qemu-char.c
static CharDriverState *qemu_chr_open_pp(QemuOpts *opts) { const char *filename = qemu_opt_get(opts, "path"); CharDriverState *chr; int fd; fd = open(filename, O_RDWR); if (fd < 0) return NULL; chr = g_malloc0(sizeof(CharDriverState)); chr->opaque = (void *)(intptr_t)fd; chr->chr_write = n...
[ 1, 0 ]
FFmpeg
libavcodec/eacmv.c
static void cmv_decode_intra(CmvContext *s, const uint8_t *buf, const uint8_t *buf_end) { unsigned char *dst = s->frame.data[0]; int i; for (i = 0; i < s->avctx->height && buf + s->avctx->width <= buf_end; i++) { memcpy(dst, buf, s->avctx->width); dst += s->frame.linesize...
[ 1, 0 ]
qemu
include/qemu/mmap-alloc.h
void os_mem_prealloc(int fd, char *area, size_t memory) { int ret; struct sigaction act, oldact; sigset_t set, oldset; memset(&act, 0, sizeof(act)); act.sa_handler = &sigbus_handler; act.sa_flags = 0; ret = sigaction(SIGBUS, &act, &oldact); if (ret) { perror("os_mem_prealloc: failed to ins...
[ 1, 0 ]
qemu
hw/vmware_vga.c
static inline uint32_t vmsvga_fifo_read_raw(struct vmsvga_state_s *s) { uint32_t cmd = s->fifo[CMD(stop) >> 2]; s->cmd->stop = cpu_to_le32(CMD(stop) + 4); if (CMD(stop) >= CMD(max)) s->cmd->stop = s->cmd->min; return cmd; }
[ 1, 0 ]
qemu
blockjob.c
static int block_job_finish_sync(BlockJob *job, void (*finish)(BlockJob *, Error **errp), Error **errp) { BlockDriverState *bs = job->bs; Error *local_err = NULL; int ret; assert(bs->job == job); block_job_ref(job); finish(job, &loca...
[ 1, 0 ]
FFmpeg
libavformat/movenc.c
static int mov_write_stbl_tag(ByteIOContext *pb, MOVTrack *track) { offset_t pos = url_ftell(pb); put_be32(pb, 0); /* size */ put_tag(pb, "stbl"); mov_write_stsd_tag(pb, track); mov_write_stts_tag(pb, track); if (track->enc->codec_type == CODEC_TYPE_VIDEO && track->hasKeyframes < track->entry)...
[ 1, 0 ]
qemu
target-arm/translate-a64.c
static inline int fp_reg_offset(int regno, TCGMemOp size) { int offs = offsetof(CPUARMState, vfp.regs[regno * 2]); #ifdef HOST_WORDS_BIGENDIAN offs += (8 - (1 << size)); #endif return offs; }
[ 0, 0 ]
qemu
crypto/pbkdf.c
uint64_t qcrypto_pbkdf2_count_iters(QCryptoHashAlgorithm hash, const uint8_t *key, size_t nkey, const uint8_t *salt, size_t nsalt, Error **errp) { uint8_t out[32]; uint64_t iterations = (1 << 15); un...
[ 1, 0 ]
FFmpeg
libavcodec/v4l2_buffers.c
static inline uint64_t v4l2_get_pts(V4L2Buffer *avbuf) { V4L2m2mContext *s = buf_to_m2mctx(avbuf); AVRational v4l2_timebase = {1, USEC_PER_SEC}; int64_t v4l2_pts; /* convert pts back to encoder timebase */ v4l2_pts = avbuf->buf.timestamp.tv_sec * USEC_PER_SEC + avbuf->buf.timestamp.tv_usec; ret...
[ 1, 0 ]
FFmpeg
libavformat/id3v2.c
static void read_ttag(AVFormatContext *s, int taglen, const char *key) { char *q, dst[512]; int len, dstlen = sizeof(dst) - 1; unsigned genre; dst[0] = 0; if (taglen < 1) return; taglen--; /* account for encoding type byte */ switch (get_byte(s->pb)) { /* encoding type */ case 0: /* ISO-88...
[ 1, 0 ]
qemu
target-ppc/helper.c
void ppc_slb_invalidate_all(CPUPPCState *env) { target_phys_addr_t sr_base; uint64_t tmp64; int n, do_invalidate; do_invalidate = 0; sr_base = env->spr[SPR_ASR]; for (n = 0; n < env->slb_nr; n++) { tmp64 = ldq_phys(sr_base); if (slb_is_valid(tmp64)) { slb_invalidate(&tmp64); s...
[ 1, 1 ]
FFmpeg
libavformat/rtsp.c
static void sdp_parse_fmtp(AVStream *st, const char *p) { char attr[256]; /* Vorbis setup headers can be up to 12KB and are sent base64 * encoded, giving a 12KB * (4/3) = 16KB FMTP line. */ char value[16384]; int i; RTSPStream *rtsp_st = st->priv_data; AVCodecContext *codec = st->codec; RTPPay...
[ 1, 0 ]
qemu
ui/vnc-enc-tight.c
static int send_sub_rect_jpeg(VncState *vs, int x, int y, int w, int h, int bg, int fg, int colors, VncPalette *palette) { int ret; if (colors == 0) { if (tight_detect_smooth_image(vs, w, h)) { int quality = tight_conf[vs->tight.quality].j...
[ 1, 0 ]
qemu
target-mips/op.c
void op_addo(void) { target_ulong tmp; tmp = T0; T0 += T1; if ((T0 >> 31) ^ (T1 >> 31) ^ (tmp >> 31)) { CALL_FROM_TB1(do_raise_exception_direct, EXCP_OVERFLOW); } RETURN(); }
[ 1, 0 ]
FFmpeg
libavcodec/adpcm.c
static av_cold int adpcm_decode_init(AVCodecContext *avctx) { ADPCMDecodeContext *c = avctx->priv_data; unsigned int max_channels = 2; switch (avctx->codec->id) { case CODEC_ID_ADPCM_EA_R1: case CODEC_ID_ADPCM_EA_R2: case CODEC_ID_ADPCM_EA_R3: case CODEC_ID_ADPCM_EA_XAS: max_channels = 6; ...
[ 1, 0 ]
qemu
tests/test-cutils.c
static void test_qemu_strtol_max(void) { const char *str = g_strdup_printf("%ld", LONG_MAX); char f = 'X'; const char *endptr = &f; long res = 999; int err; err = qemu_strtol(str, &endptr, 0, &res); g_assert_cmpint(err, ==, 0); g_assert_cmpint(res, ==, LONG_MAX); g_assert(endptr == str + str...
[ 1, 0 ]
FFmpeg
libavcodec/ylc.c
static int build_vlc(AVCodecContext *avctx, VLC *vlc, const uint32_t *table) { Node nodes[512]; uint32_t bits[256]; int16_t lens[256]; uint8_t xlat[256]; int cur_node, i, j, pos = 0; ff_free_vlc(vlc); for (i = 0; i < 256; i++) { nodes[i].count = table[i]; nodes[i].sym = i; nodes[i]....
[ 1, 0 ]
FFmpeg
libavformat/avio.c
offset_t url_filesize(URLContext *h) { offset_t pos, size; size = url_seek(h, 0, AVSEEK_SIZE); if (size < 0) { pos = url_seek(h, 0, SEEK_CUR); size = url_seek(h, -1, SEEK_END) + 1; url_seek(h, pos, SEEK_SET); } return size; }
[ 0, 0 ]
FFmpeg
libavfilter/vf_paletteuse.c
static int load_apply_palette(FFFrameSync *fs) { AVFilterContext *ctx = fs->parent; AVFilterLink *inlink = ctx->inputs[0]; PaletteUseContext *s = ctx->priv; AVFrame *master, *second, *out; int ret; // writable for error diffusal dithering ret = ff_framesync_dualinput_get_writable(fs, &master, &sec...
[ 0, 0 ]
qemu
bsd-user/main.c
static void test_parse_invalid_path(void) { g_test_trap_subprocess("/logging/parse_invalid_path/subprocess", 0, 0); g_test_trap_assert_passed(); g_test_trap_assert_stdout(""); g_test_trap_assert_stderr("Bad logfile format: /tmp/qemu-%d%d.log\n"); }
[ 1, 0 ]
qemu
block-migration.c
void bdrv_iterate_format(void (*it)(void *opaque, const char *name), void *opaque) { BlockDriver *drv; int count = 0; const char **formats = NULL; QLIST_FOREACH(drv, &bdrv_drivers, list) { if (drv->format_name) { bool found = false; int i = count; while (...
[ 1, 0 ]
qemu
hw/display/cirrus_vga.c
static int cirrus_bitblt_cputovideo(CirrusVGAState *s) { int w; if (blit_is_unsafe(s, true)) { return 0; } s->cirrus_blt_mode &= ~CIRRUS_BLTMODE_MEMSYSSRC; s->cirrus_srcptr = &s->cirrus_bltbuf[0]; s->cirrus_srcptr_end = &s->cirrus_bltbuf[0]; if (s->cirrus_blt_mode & CIRRUS_BLTMODE_PATTERNCOPY) { i...
[ 1, 1 ]
qemu
hw/hw.h
static int qemu_savevm_state(QEMUFile *f) { SaveStateEntry *se; int len, ret; int64_t cur_pos, len_pos, total_len_pos; qemu_put_be32(f, QEMU_VM_FILE_MAGIC); qemu_put_be32(f, QEMU_VM_FILE_VERSION); total_len_pos = qemu_ftell(f); qemu_put_be64(f, 0); /* total size */ for (se = first_se; se != NUL...
[ 1, 0 ]
qemu
include/exec/def-helper.h
void tcg_context_init(TCGContext *s) { int op, total_args, n; TCGOpDef *def; TCGArgConstraint *args_ct; int *sorted_args; memset(s, 0, sizeof(*s)); s->nb_globals = 0; /* Count total number of arguments and allocate the corresponding space */ total_args = 0; for (op = 0; op < NB_OPS; op...
[ 1, 0 ]
qemu
hmp.c
static void legacy_kbd_event(DeviceState *dev, QemuConsole *src, InputEvent *evt) { QEMUPutKbdEntry *entry = (QEMUPutKbdEntry *)dev; int scancodes[3], i, count; if (!entry || !entry->put_kbd) { return; } count = qemu_input_key_value_to_scancode(evt->key->key, ...
[ 0, 0 ]
qemu
slirp/ip6_icmp.c
void ip6_input(struct mbuf *m) { struct ip6 *ip6; DEBUG_CALL("ip6_input"); DEBUG_ARG("m = %lx", (long)m); DEBUG_ARG("m_len = %d", m->m_len); if (m->m_len < sizeof(struct ip6)) { goto bad; } ip6 = mtod(m, struct ip6 *); if (ip6->ip_v != IP6VERSION) { goto bad; } /* check ip_ttl for...
[ 1, 0 ]
qemu
exec-all.h
CPUPPCState *cpu_ppc_init(void) { CPUPPCState *env; cpu_exec_init(); env = qemu_mallocz(sizeof(CPUPPCState)); if (!env) return NULL; #if !defined(CONFIG_USER_ONLY) && defined(USE_OPEN_FIRMWARE) setup_machine(env, 0); #else // env->spr[PVR] = 0; /* Basic PPC */ env->spr[PVR] = 0x00080100;...
[ 1, 0 ]