label
int64
0
1
func1
stringlengths
23
97k
id
int64
0
27.3k
0
static int coroutine_fn blkreplay_co_discard(BlockDriverState *bs, int64_t sector_num, int nb_sectors) { uint64_t reqid = request_id++; int ret = bdrv_co_discard(bs->file->bs, sector_num, nb_sectors); block_request_create(reqid, bs, qemu_coroutine_self()); qemu_coroutine_yield(); return ret; }
20,748
0
static inline uint32_t ldl_phys_internal(hwaddr addr, enum device_endian endian) { uint8_t *ptr; uint32_t val; MemoryRegionSection *section; section = phys_page_find(address_space_memory.dispatch, addr >> TARGET_PAGE_BITS); if (!(memory_region_is_ram(section->mr) || memory_region_is_romd(section->mr))) { /* I/O case */...
20,749
0
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); }
20,750
0
static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *pic, int *got_packet) { ProresContext *ctx = avctx->priv_data; uint8_t *orig_buf, *buf, *slice_hdr, *slice_sizes, *tmp; uint8_t *picture_size_pos; PutBitContext pb; int x, y, i, mb, q = 0; int sizes[4] = { 0 }; int slice_hdr_size = 2 + 2 * (ct...
20,752
0
static int epzs_motion_search4(MpegEncContext * s, int block, int *mx_ptr, int *my_ptr, int P[6][2], int pred_x, int pred_y, int xmin, int ymin, int xmax, int ymax, uint8_t *ref_picture) { int best[2]={0, 0}; int d, dmin; UINT8 *new_pic, *old_pic; const int pic_stride= s->linesize; const int pic_xy= ((s->mb_y*2 + (bloc...
20,753
0
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; }
20,754
0
static void rv34_output_i16x16(RV34DecContext *r, int8_t *intra_types, int cbp) { LOCAL_ALIGNED_16(DCTELEM, block16, [16]); MpegEncContext *s = &r->s; GetBitContext *gb = &s->gb; int q_dc = rv34_qscale_tab[ r->luma_dc_quant_i[s->qscale] ], q_ac = rv34_qscale_tab[s->qscale]; uint8_t *dst = s->dest[0]; DCTELEM *ptr = s->...
20,755
0
STATIC void DEF(put, pixels8_xy2)(uint8_t *block, const uint8_t *pixels, ptrdiff_t line_size, int h) { MOVQ_ZERO(mm7); SET_RND(mm6); // =2 for rnd and =1 for no_rnd version __asm__ volatile( "movq (%1), %%mm0 \n\t" "movq 1(%1), %%mm4 \n\t" "movq %%mm0, %%mm1 \n\t" "movq %%mm4, %%mm5 \n\t" "punpcklbw %%mm7, %%mm0 \n\t" ...
20,756
0
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 < 212 * q->channels) { av_log(q,AV_LOG_ERROR,"Not enought...
20,757
1
static void virgl_cmd_submit_3d(VirtIOGPU *g, struct virtio_gpu_ctrl_command *cmd) { struct virtio_gpu_cmd_submit cs; void *buf; size_t s; VIRTIO_GPU_FILL_CMD(cs); trace_virtio_gpu_cmd_ctx_submit(cs.hdr.ctx_id, cs.size); buf = g_malloc(cs.size); s = iov_to_buf(cmd->elem.out_sg, cmd->elem.out_num, sizeof(cs), buf, cs.si...
20,758
1
static int scsi_write_data(SCSIRequest *req) { SCSIDiskReq *r = DO_UPCAST(SCSIDiskReq, req, req); SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, r->req.dev); uint32_t n; /* No data transfer may already be in progress */ assert(r->req.aiocb == NULL); n = r->iov.iov_len / 512; if (n) { qemu_iovec_init_external(&r->qio...
20,759
1
static int create_dynamic_disk(BlockBackend *blk, uint8_t *buf, int64_t total_sectors) { VHDDynDiskHeader *dyndisk_header = (VHDDynDiskHeader *) buf; size_t block_size, num_bat_entries; int i; int ret; int64_t offset = 0; // Write the footer (twice: at the beginning and at the end) block_size = 0x200000; num_bat_entrie...
20,760
1
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; } } s->cid_checked = true; /* CID valid...
20,762
1
static inline int mpeg2_decode_block_intra(MpegEncContext *s, int16_t *block, int n) { int level, dc, diff, i, j, run; int component; RLTable *rl; uint8_t * const scantable = s->intra_scantable.permutated; const uint16_t *quant_matrix; const int qscale = s->qscale; int mismatch; /* DC coefficient */ if (n < 4) { quant_...
20,763
1
PPC_OP(test_ctr_true) { T0 = (regs->ctr != 0 && (T0 & PARAM(1)) != 0); RETURN(); }
20,764
1
static inline int mov_stsc_index_valid(int index, int count) { return index + 1 < count; }
20,765
1
static void init_proc_POWER7 (CPUPPCState *env) { gen_spr_ne_601(env); gen_spr_7xx(env); /* Time base */ gen_tbl(env); /* Processor identification */ spr_register(env, SPR_PIR, "PIR", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_pir, 0x00000000); #if !defined(CONFIG_USER_ONLY) /* PURR & SPURR: Hack - treat...
20,767
1
void spapr_events_init(sPAPREnvironment *spapr) { spapr->epow_irq = spapr_allocate_msi(0); spapr->epow_notifier.notify = spapr_powerdown_req; qemu_register_powerdown_notifier(&spapr->epow_notifier); spapr_rtas_register("check-exception", check_exception); }
20,768
1
target_ulong helper_add_suov(CPUTriCoreState *env, target_ulong r1, target_ulong r2) { int64_t t1 = extract64(r1, 0, 32); int64_t t2 = extract64(r2, 0, 32); int64_t result = t1 + t2; return suov32(env, result); }
20,769
1
static void pcspk_class_initfn(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); dc->realize = pcspk_realizefn; set_bit(DEVICE_CATEGORY_SOUND, dc->categories); dc->no_user = 1; dc->props = pcspk_properties; }
20,770
0
static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { AVFrame *frame = data; const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; ZmbvContext * const c = avctx->priv_data; int zret = Z_OK; // Zlib return code int len = buf_size; int hi_ver, lo_ver, ret; uint8_t *tmp; if ...
20,771
0
static int build_filter(ResampleContext *c, void *filter, double factor, int tap_count, int alloc, int phase_count, int scale, int filter_type, double kaiser_beta){ int ph, i; double x, y, w, t; double *tab = av_malloc_array(tap_count+1, sizeof(*tab)); const int center= (tap_count-1)/2; if (!tab) return AVERROR(ENOMEM)...
20,774
0
static void fft_test(AC3MDCTContext *mdct, AVLFG *lfg) { IComplex in[FN], in1[FN]; int k, n, i; float sum_re, sum_im, a; for (i = 0; i < FN; i++) { in[i].re = av_lfg_get(lfg) % 65535 - 32767; in[i].im = av_lfg_get(lfg) % 65535 - 32767; in1[i] = in[i]; } fft(mdct, in, 7); /* do it by hand */ for (k = 0; k < FN; k++) { s...
20,775
0
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; // START_TIMER DWTELEM * line; DWTELEM * prev; if (start_y != 0) line = slice_buffer_get_line(sb, ((start_y - 1) * b->stride...
20,776
0
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]) + 0x200; const int z1 = 13*(temp[4*0+i] ...
20,778
1
int ff_vc1_parse_frame_header(VC1Context *v, GetBitContext* gb) { int pqindex, lowquant, status; if (v->finterpflag) v->interpfrm = get_bits1(gb); if (!v->s.avctx->codec) return -1; if (v->s.avctx->codec_id == AV_CODEC_ID_MSS2) v->respic = v->rangered = v->multires = get_bits(gb, 2) == 1; else skip_bits(gb, 2); //frame...
20,780
1
static int mov_preroll_write_stbl_atoms(AVIOContext *pb, MOVTrack *track) { struct sgpd_entry { int count; int16_t roll_distance; int group_description_index; }; struct sgpd_entry *sgpd_entries = NULL; int entries = -1; int group = 0; int i, j; const int OPUS_SEEK_PREROLL_MS = 80; int roll_samples = av_rescale_q(OPUS_S...
20,781
1
static av_always_inline void emulated_edge_mc(uint8_t *buf, const uint8_t *src, ptrdiff_t linesize_arg, int block_w, int block_h, int src_x, int src_y, int w, int h, emu_edge_core_func *core_fn) { int start_y, start_x, end_y, end_x, src_y_add = 0; int linesize = linesize_arg; if(!w || !h) return; if (src_y >= h) { src ...
20,782
1
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) { return -ENOMEM; } ret = bdrv_pread(extent->file, exten...
20,783
1
static void bdrv_password_cb(void *opaque, const char *password, void *readline_opaque) { Monitor *mon = opaque; BlockDriverState *bs = readline_opaque; int ret = 0; Error *local_err = NULL; bdrv_add_key(bs, password, &local_err); if (local_err) { error_report_err(local_err); ret = -EPERM; } if (mon->password_completio...
20,784
1
static int vmdk_L2update(BlockDriverState *bs, VmdkMetaData *m_data) { BDRVVmdkState *s = bs->opaque; /* update L2 table */ if (bdrv_pwrite(bs->file, ((int64_t)m_data->l2_offset * 512) + (m_data->l2_index * sizeof(m_data->offset)), &(m_data->offset), sizeof(m_data->offset)) != sizeof(m_data->offset)) return -1; /* upda...
20,785
1
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) { uint64_t perm, shared_perm; bs->open_flags |= BDRV_O_INACTIVE; QLIST_F...
20,786
1
int qcow2_read_snapshots(BlockDriverState *bs) { BDRVQcowState *s = bs->opaque; QCowSnapshotHeader h; QCowSnapshotExtraData extra; QCowSnapshot *sn; int i, id_str_size, name_size; int64_t offset; uint32_t extra_data_size; int ret; if (!s->nb_snapshots) { s->snapshots = NULL; s->snapshots_size = 0; return 0; } offset = ...
20,787
0
static abi_long do_fcntl(int fd, int cmd, abi_ulong arg) { struct flock fl; struct target_flock *target_fl; struct flock64 fl64; struct target_flock64 *target_fl64; #ifdef F_GETOWN_EX struct f_owner_ex fox; struct target_f_owner_ex *target_fox; #endif abi_long ret; int host_cmd = target_to_host_fcntl_cmd(cmd); if (host...
20,788
0
const uint8_t *avpriv_find_start_code(const uint8_t *av_restrict p, const uint8_t *end, uint32_t *av_restrict state) { int i; assert(p <= end); if (p >= end) return end; for (i = 0; i < 3; i++) { uint32_t tmp = *state << 8; *state = tmp + *(p++); if (tmp == 0x100 || p == end) return p; } while (p < end) { if (p[-1] > 1...
20,789
0
static int bdrv_open_common(BlockDriverState *bs, BdrvChild *file, QDict *options, Error **errp) { int ret, open_flags; const char *filename; const char *driver_name = NULL; const char *node_name = NULL; QemuOpts *opts; BlockDriver *drv; Error *local_err = NULL; assert(bs->file == NULL); assert(options != NULL && bs->o...
20,790
0
static void test_visitor_out_enum_errors(TestOutputVisitorData *data, const void *unused) { EnumOne i, bad_values[] = { ENUM_ONE__MAX, -1 }; Error *err; for (i = 0; i < ARRAY_SIZE(bad_values) ; i++) { err = NULL; visit_type_EnumOne(data->ov, "unused", &bad_values[i], &err); g_assert(err); error_free(err); visitor_reset...
20,791
0
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); }
20,792
0
print_with_operands (const struct cris_opcode *opcodep, unsigned int insn, unsigned char *buffer, bfd_vma addr, disassemble_info *info, /* If a prefix insn was before this insn (and is supposed to be output as an address), here is a description of it. */ const struct cris_opcode *prefix_opcodep, unsigned int prefix_ins...
20,793
0
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, 1); data->s = s; if (saddr->type == SOCKET_ADDRESS_LEGACY_KIND_INET) { data->hostname = g_strdup...
20,794
0
static void define_aarch64_debug_regs(ARMCPU *cpu) { /* Define breakpoint and watchpoint registers. These do nothing * but read as written, for now. */ int i; for (i = 0; i < 16; i++) { ARMCPRegInfo dbgregs[] = { { .name = "DBGBVR", .state = ARM_CP_STATE_AA64, .opc0 = 2, .opc1 = 0, .crn = 0, .crm = i, .opc2 = 4, .acces...
20,795
0
static void add_pc_test_case(const char *mname) { char *path; PlugTestData *data; if (!g_str_has_prefix(mname, "pc-")) { return; } data = g_new(PlugTestData, 1); data->machine = g_strdup(mname); data->cpu_model = "Haswell"; /* 1.3+ theoretically */ data->sockets = 1; data->cores = 3; data->threads = 2; data->maxcpus = ...
20,796
0
void event_notifier_cleanup(EventNotifier *e) { close(e->fd); }
20,798
0
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, TCG_AREG0, offsetof(CPUState, ir[i]), ...
20,799
0
static int raw_decode(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt); RawVideoContext *context = avctx->priv_data; const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; int need_copy = !avpkt->buf || context->is_2_4_bpp ...
20,800
0
static void *data_plane_thread(void *opaque) { VirtIOBlockDataPlane *s = opaque; do { aio_poll(s->ctx, true); } while (!s->stopping || s->num_reqs > 0); return NULL; }
20,801
0
static int ppc_hash32_check_prot(int prot, int rwx) { int ret; if (rwx == 2) { if (prot & PAGE_EXEC) { ret = 0; } else { ret = -2; } } else if (rwx) { if (prot & PAGE_WRITE) { ret = 0; } else { ret = -2; } } else { if (prot & PAGE_READ) { ret = 0; } else { ret = -2; } } return ret; }
20,804
0
static void do_inject_mce(Monitor *mon, const QDict *qdict) { CPUState *cenv; int cpu_index = qdict_get_int(qdict, "cpu_index"); int bank = qdict_get_int(qdict, "bank"); uint64_t status = qdict_get_int(qdict, "status"); uint64_t mcg_status = qdict_get_int(qdict, "mcg_status"); uint64_t addr = qdict_get_int(qdict, "addr...
20,805
0
static void spice_register_types(void) { qemu_spice_init(); }
20,806
0
static int pci_grackle_init_device(SysBusDevice *dev) { GrackleState *s; int pci_mem_config, pci_mem_data; s = FROM_SYSBUS(GrackleState, dev); pci_mem_config = cpu_register_io_memory(pci_grackle_config_read, pci_grackle_config_write, s); pci_mem_data = cpu_register_io_memory(pci_grackle_read, pci_grackle_write, &s->hos...
20,807
0
int qemu_strtoul(const char *nptr, const char **endptr, int base, unsigned long *result) { char *ep; int err = 0; if (!nptr) { if (endptr) { *endptr = nptr; } err = -EINVAL; } else { errno = 0; *result = strtoul(nptr, &ep, base); /* Windows returns 1 for negative out-of-range values. */ if (errno == ERANGE) { *result =...
20,808
0
static void rtl8139_cleanup(NetClientState *nc) { RTL8139State *s = qemu_get_nic_opaque(nc); s->nic = NULL; }
20,809
0
static int uhci_handle_td(UHCIState *s, UHCI_TD *td, uint32_t *int_mask, int completion) { uint8_t pid; int len = 0, max_len, err, ret = 0; /* ??? This is wrong for async completion. */ if (td->ctrl & TD_CTRL_IOC) { *int_mask |= 0x01; } if (!(td->ctrl & TD_CTRL_ACTIVE)) return 1; /* TD is active */ max_len = ((td->toke...
20,810
0
static void option_rom_reset(void *_rrd) { RomResetData *rrd = _rrd; cpu_physical_memory_write_rom(rrd->addr, rrd->data, rrd->size); }
20,813
0
static int v9fs_synth_lremovexattr(FsContext *ctx, V9fsPath *path, const char *name) { errno = ENOTSUP; return -1; }
20,814
0
static inline int get_phys_addr(CPUState *env, uint32_t address, int access_type, int is_user, uint32_t *phys_ptr, int *prot, target_ulong *page_size) { /* Fast Context Switch Extension. */ if (address < 0x02000000) address += env->cp15.c13_fcse; if ((env->cp15.c1_sys & 1) == 0) { /* MMU/MPU disabled. */ *phys_ptr = ad...
20,815
0
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) | (s->num_cpu - 1); case 0x08: /* CPU Power Status ...
20,816
0
uint32_t ldl_phys(target_phys_addr_t addr) { return ldl_phys_internal(addr, DEVICE_NATIVE_ENDIAN); }
20,817
0
void virtio_queue_set_host_notifier_fd_handler(VirtQueue *vq, bool assign, bool set_handler) { if (assign && set_handler) { event_notifier_set_handler(&vq->host_notifier, true, virtio_queue_host_notifier_read); } else { event_notifier_set_handler(&vq->host_notifier, true, NULL); } if (!assign) { /* Test and clear notif...
20,818
0
bool qemu_clock_use_for_deadline(QEMUClockType type) { return !(use_icount && (type == QEMU_CLOCK_VIRTUAL)); }
20,819
0
static void term_forward_char(void) { if (term_cmd_buf_index < term_cmd_buf_size) { term_cmd_buf_index++; } }
20,820
0
static int input_initialise(struct XenDevice *xendev) { struct XenInput *in = container_of(xendev, struct XenInput, c.xendev); int rc; if (!in->c.con) { xen_pv_printf(xendev, 1, "ds not set (yet)\n"); return -1; } rc = common_bind(&in->c); if (rc != 0) return rc; qemu_add_kbd_event_handler(xenfb_key_event, in); return ...
20,821
0
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; if (audio_bug (A...
20,822
0
static void v9fs_wstat_post_chown(V9fsState *s, V9fsWstatState *vs, int err) { V9fsFidState *fidp; if (err < 0) { goto out; } if (vs->v9stat.name.size != 0) { char *old_name, *new_name; char *end; old_name = vs->fidp->path.data; end = strrchr(old_name, '/'); if (end) { end++; } else { end = old_name; } new_name = qemu_...
20,824
0
static int mpeg4video_probe(AVProbeData *probe_packet) { uint32_t temp_buffer= -1; int VO=0, VOL=0, VOP = 0, VISO = 0, res=0; int i; for(i=0; i<probe_packet->buf_size; i++){ temp_buffer = (temp_buffer<<8) + probe_packet->buf[i]; if ((temp_buffer & 0xffffff00) != 0x100) continue; if (temp_buffer == VOP_START_CODE) VOP++...
20,825
0
static BlockDriverAIOCB *raw_aio_writev(BlockDriverState *bs, int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, BlockDriverCompletionFunc *cb, void *opaque) { BDRVRawState *s = bs->opaque; return paio_submit(bs, s->hfile, sector_num, qiov, nb_sectors, cb, opaque, QEMU_AIO_WRITE); }
20,827
0
static int usb_serial_handle_control(USBDevice *dev, int request, int value, int index, int length, uint8_t *data) { USBSerialState *s = (USBSerialState *)dev; int ret; DPRINTF("got control %x, value %x\n",request, value); ret = usb_desc_handle_control(dev, request, value, index, length, data); if (ret >= 0) { return r...
20,828
0
static void test_acpi_piix4_tcg_cphp(void) { test_data data; memset(&data, 0, sizeof(data)); data.machine = MACHINE_PC; data.variant = ".cphp"; test_acpi_one("-smp 2,cores=3,sockets=2,maxcpus=6" " -numa node -numa node", &data); free_test_data(&data); }
20,829
0
static void ide_dev_set_bootindex(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { IDEDevice *d = IDE_DEVICE(obj); int32_t boot_index; Error *local_err = NULL; visit_type_int32(v, name, &boot_index, &local_err); if (local_err) { goto out; } /* check whether bootindex is present in fw_boot_order ...
20,830
0
static void virtser_port_device_realize(DeviceState *dev, Error **errp) { VirtIOSerialPort *port = VIRTIO_SERIAL_PORT(dev); VirtIOSerialPortClass *vsc = VIRTIO_SERIAL_PORT_GET_CLASS(port); VirtIOSerialBus *bus = VIRTIO_SERIAL_BUS(qdev_get_parent_bus(dev)); int max_nr_ports; bool plugging_port0; Error *err = NULL; port-...
20,832
1
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; ptr = (char*)ptr + diff; ((char*)ptr...
20,833
1
static int do_token_in(USBDevice *s, USBPacket *p) { int request, value, index; int ret = 0; if (p->devep != 0) return s->info->handle_data(s, p); request = (s->setup_buf[0] << 8) | s->setup_buf[1]; value = (s->setup_buf[3] << 8) | s->setup_buf[2]; index = (s->setup_buf[5] << 8) | s->setup_buf[4]; switch(s->setup_state...
20,834
1
static int qemu_chr_open_socket(QemuOpts *opts, CharDriverState **_chr) { CharDriverState *chr = NULL; TCPCharDriver *s = NULL; int fd = -1; int is_listen; int is_waitconnect; int do_nodelay; int is_unix; int is_telnet; int ret; is_listen = qemu_opt_get_bool(opts, "server", 0); is_waitconnect = qemu_opt_get_bool(opts, ...
20,836
1
static void imx_serial_write(void *opaque, hwaddr offset, uint64_t value, unsigned size) { IMXSerialState *s = (IMXSerialState *)opaque; unsigned char ch; DPRINTF("write(offset=0x%" HWADDR_PRIx ", value = 0x%x) to %s\n", offset, (unsigned int)value, s->chr ? s->chr->label : "NODEV"); switch (offset >> 2) { case 0x10: /...
20,837
1
static void numa_add(const char *optarg) { char option[128]; char *endptr; unsigned long long value, endvalue; unsigned long long nodenr; value = endvalue = 0ULL; optarg = get_opt_name(option, 128, optarg, ','); if (*optarg == ',') { optarg++; } if (!strcmp(option, "node")) { if (nb_numa_nodes >= MAX_NODES) { fprintf(s...
20,838
1
static int sap_read_header(AVFormatContext *s) { struct SAPState *sap = s->priv_data; char host[1024], path[1024], url[1024]; uint8_t recvbuf[RTP_MAX_PACKET_LENGTH]; int port; int ret, i; AVInputFormat* infmt; if (!ff_network_init()) return AVERROR(EIO); av_url_split(NULL, 0, NULL, 0, host, sizeof(host), &port, path, s...
20,839
1
static void arm_gic_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); SysBusDeviceClass *sbc = SYS_BUS_DEVICE_CLASS(klass); ARMGICClass *agc = ARM_GIC_CLASS(klass); agc->parent_init = sbc->init; sbc->init = arm_gic_init; dc->no_user = 1; }
20,841
1
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 << (shift - 1))) >> s...
20,842
1
static void init_proc_970 (CPUPPCState *env) { gen_spr_ne_601(env); gen_spr_7xx(env); /* Time base */ gen_tbl(env); /* Hardware implementation registers */ /* XXX : not implemented */ spr_register(env, SPR_HID0, "HID0", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_clear, 0x60000000); /* XXX : not implement...
20,843
1
static int mov_write_header(AVFormatContext *s) { AVIOContext *pb = s->pb; MOVMuxContext *mov = s->priv_data; AVDictionaryEntry *t; int i, hint_track = 0; /* Default mode == MP4 */ mov->mode = MODE_MP4; if (s->oformat != NULL) { if (!strcmp("3gp", s->oformat->name)) mov->mode = MODE_3GP; else if (!strcmp("3g2", s->ofor...
20,844
1
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 | bytestream2_get_byte(c->gbc.gB); c->low = c->low << ...
20,845
1
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; QLIST_INIT(&dev->strin...
20,846
1
void ff_eval_coefs(int *coefs, const int *refl) { int buffer[LPC_ORDER]; int *b1 = buffer; int *b2 = coefs; int i, j; for (i=0; i < LPC_ORDER; i++) { b1[i] = refl[i] * 16; for (j=0; j < i; j++) b1[j] = ((refl[i] * b2[i-j-1]) >> 12) + b2[j]; FFSWAP(int *, b1, b2); } for (i=0; i < LPC_ORDER; i++) coefs[i] >>= 4; }
20,847
1
static int decode_hq_slice(DiracContext *s, DiracSlice *slice, uint8_t *tmp_buf) { int i, level, orientation, quant_idx; int qfactor[MAX_DWT_LEVELS][4], qoffset[MAX_DWT_LEVELS][4]; GetBitContext *gb = &slice->gb; SliceCoeffs coeffs_num[MAX_DWT_LEVELS]; skip_bits_long(gb, 8*s->highquality.prefix_bytes); quant_idx = get_...
20,848
1
static int ff_h261_resync(H261Context *h){ MpegEncContext * const s = &h->s; int left, ret; if(show_bits(&s->gb, 15)==0){ ret= h261_decode_gob_header(h); if(ret>=0) return 0; } //ok, its not where its supposed to be ... s->gb= s->last_resync_gb; align_get_bits(&s->gb); left= s->gb.size_in_bits - get_bits_count(&s->gb);...
20,849
1
static int epic_decode_tile(ePICContext *dc, uint8_t *out, int tile_height, int tile_width, int stride) { int x, y; uint32_t pix; uint32_t *curr_row = NULL, *above_row = NULL, *above2_row; for (y = 0; y < tile_height; y++, out += stride) { above2_row = above_row; above_row = curr_row; curr_row = (uint32_t *) out; for (...
20,850
0
int ff_h264_context_init(H264Context *h) { ERContext *er = &h->er; int mb_array_size = h->mb_height * h->mb_stride; int y_size = (2 * h->mb_width + 1) * (2 * h->mb_height + 1); int c_size = h->mb_stride * (h->mb_height + 1); int yc_size = y_size + 2 * c_size; int x, y, i; FF_ALLOCZ_OR_GOTO(h->avctx, h->top_borders[0], ...
20,851
0
static int thp_read_packet(AVFormatContext *s, AVPacket *pkt) { ThpDemuxContext *thp = s->priv_data; AVIOContext *pb = s->pb; unsigned int size; int ret; if (thp->audiosize == 0) { /* Terminate when last frame is reached. */ if (thp->frame >= thp->framecnt) return AVERROR_EOF; avio_seek(pb, thp->next_frame, SEEK_SET); ...
20,852
0
static int execute_code(AVCodecContext * avctx, int c) { AnsiContext *s = avctx->priv_data; int ret, i, width, height; switch(c) { case 'A': //Cursor Up s->y = FFMAX(s->y - (s->nb_args > 0 ? s->args[0]*s->font_height : s->font_height), 0); break; case 'B': //Cursor Down s->y = FFMIN(s->y + (s->nb_args > 0 ? s->args[0]*...
20,853
0
void ff_h264_filter_mb(H264Context *h, H264SliceContext *sl, int mb_x, int mb_y, uint8_t *img_y, uint8_t *img_cb, uint8_t *img_cr, unsigned int linesize, unsigned int uvlinesize) { const int mb_xy= mb_x + mb_y*h->mb_stride; const int mb_type = h->cur_pic.mb_type[mb_xy]; const int mvy_limit = IS_INTERLACED(mb_type) ? 2 ...
20,854
1
e1000_set_link_status(VLANClientState *nc) { E1000State *s = DO_UPCAST(NICState, nc, nc)->opaque; uint32_t old_status = s->mac_reg[STATUS]; if (nc->link_down) s->mac_reg[STATUS] &= ~E1000_STATUS_LU; else s->mac_reg[STATUS] |= E1000_STATUS_LU; if (s->mac_reg[STATUS] != old_status) set_ics(s, 0, E1000_ICR_LSC); }
20,855
1
static void tcx_initfn(Object *obj) { SysBusDevice *sbd = SYS_BUS_DEVICE(obj); TCXState *s = TCX(obj); memory_region_init_ram(&s->rom, NULL, "tcx.prom", FCODE_MAX_ROM_SIZE, &error_abort); memory_region_set_readonly(&s->rom, true); sysbus_init_mmio(sbd, &s->rom); /* 2/STIP : Stippler */ memory_region_init_io(&s->stip, O...
20,857
1
static int alloc_buffer(AVCodecContext *s, InputStream *ist, FrameBuffer **pbuf) { FrameBuffer *buf = av_mallocz(sizeof(*buf)); int i, ret; const int pixel_size = av_pix_fmt_descriptors[s->pix_fmt].comp[0].step_minus1+1; int h_chroma_shift, v_chroma_shift; int edge = 32; // XXX should be avcodec_get_edge_width(), but t...
20,858
1
static void x86_cpu_initfn(Object *obj) { CPUState *cs = CPU(obj); X86CPU *cpu = X86_CPU(obj); X86CPUClass *xcc = X86_CPU_GET_CLASS(obj); CPUX86State *env = &cpu->env; FeatureWord w; cs->env_ptr = env; object_property_add(obj, "family", "int", x86_cpuid_version_get_family, x86_cpuid_version_set_family, NULL, NULL, NULL...
20,859
1
static void video_refresh_timer(void *opaque) { VideoState *is = opaque; VideoPicture *vp; SubPicture *sp, *sp2; if (is->video_st) { if (is->pictq_size == 0) { /* if no picture, need to wait */ schedule_refresh(is, 1); } else { /* dequeue the picture */ vp = &is->pictq[is->pictq_rindex]; /* update current video pts */ ...
20,860
1
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); break; default: goto fail; } break; case USB_TOKEN_OUT:...
20,861
1
int net_init_bridge(QemuOpts *opts, const char *name, VLANState *vlan) { TAPState *s; int fd, vnet_hdr; if (!qemu_opt_get(opts, "br")) { qemu_opt_set(opts, "br", DEFAULT_BRIDGE_INTERFACE); } if (!qemu_opt_get(opts, "helper")) { qemu_opt_set(opts, "helper", DEFAULT_BRIDGE_HELPER); } fd = net_bridge_run_helper(qemu_opt_g...
20,862
1
static int vfio_setup_pcie_cap(VFIOPCIDevice *vdev, int pos, uint8_t size, Error **errp) { uint16_t flags; uint8_t type; flags = pci_get_word(vdev->pdev.config + pos + PCI_CAP_FLAGS); type = (flags & PCI_EXP_FLAGS_TYPE) >> 4; if (type != PCI_EXP_TYPE_ENDPOINT && type != PCI_EXP_TYPE_LEG_END && type != PCI_EXP_TYPE_RC_E...
20,863
1
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){ av_free(ast->index_entries); av_free(ast); } av_free...
20,864
1
static int create_vorbis_context(vorbis_enc_context *venc, AVCodecContext *avctx) { vorbis_enc_floor *fc; vorbis_enc_residue *rc; vorbis_enc_mapping *mc; int i, book, ret; venc->channels = avctx->channels; venc->sample_rate = avctx->sample_rate; venc->log2_blocksize[0] = venc->log2_blocksize[1] = 11; venc->ncodebooks =...
20,865