id
int32
0
27.3k
func
stringlengths
26
142k
target
bool
2 classes
project
stringclasses
2 values
commit_id
stringlengths
40
40
func_clean
stringlengths
26
131k
vul_lines
dict
normalized_func
stringlengths
24
132k
lines
listlengths
1
2.8k
label
listlengths
1
2.8k
line_no
listlengths
1
2.8k
11,206
static av_cold int ffat_close_encoder(AVCodecContext *avctx) { ATDecodeContext *at = avctx->priv_data; AudioConverterDispose(at->converter); av_frame_unref(&at->new_in_frame); av_frame_unref(&at->in_frame); ff_af_queue_close(&at->afq); return 0; }
false
FFmpeg
143685a42bbc8861b626457ce4cb8b1ce4b0c436
static av_cold int ffat_close_encoder(AVCodecContext *avctx) { ATDecodeContext *at = avctx->priv_data; AudioConverterDispose(at->converter); av_frame_unref(&at->new_in_frame); av_frame_unref(&at->in_frame); ff_af_queue_close(&at->afq); return 0; }
{ "code": [], "line_no": [] }
static av_cold int FUNC_0(AVCodecContext *avctx) { ATDecodeContext *at = avctx->priv_data; AudioConverterDispose(at->converter); av_frame_unref(&at->new_in_frame); av_frame_unref(&at->in_frame); ff_af_queue_close(&at->afq); return 0; }
[ "static av_cold int FUNC_0(AVCodecContext *avctx)\n{", "ATDecodeContext *at = avctx->priv_data;", "AudioConverterDispose(at->converter);", "av_frame_unref(&at->new_in_frame);", "av_frame_unref(&at->in_frame);", "ff_af_queue_close(&at->afq);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ] ]
11,207
static int udp_read_packet(AVFormatContext *s, RTSPStream **prtsp_st, uint8_t *buf, int buf_size, int64_t wait_end) { RTSPState *rt = s->priv_data; RTSPStream *rtsp_st; int n, i, ret, timeout_cnt = 0; struct pollfd *p = rt->p; int *fds = NULL, fdsnum, fdsidx; if (!p) { p = rt->p = av_malloc_array(2 * (rt->nb_rtsp_streams + 1), sizeof(struct pollfd)); if (!p) return AVERROR(ENOMEM); if (rt->rtsp_hd) { p[rt->max_p].fd = ffurl_get_file_handle(rt->rtsp_hd); p[rt->max_p++].events = POLLIN; } for (i = 0; i < rt->nb_rtsp_streams; i++) { rtsp_st = rt->rtsp_streams[i]; if (rtsp_st->rtp_handle) { if (ret = ffurl_get_multi_file_handle(rtsp_st->rtp_handle, &fds, &fdsnum)) { av_log(s, AV_LOG_ERROR, "Unable to recover rtp ports\n"); return ret; } if (fdsnum != 2) { av_log(s, AV_LOG_ERROR, "Number of fds %d not supported\n", fdsnum); return AVERROR_INVALIDDATA; } for (fdsidx = 0; fdsidx < fdsnum; fdsidx++) { p[rt->max_p].fd = fds[fdsidx]; p[rt->max_p++].events = POLLIN; } av_free(fds); } } } for (;;) { if (ff_check_interrupt(&s->interrupt_callback)) return AVERROR_EXIT; if (wait_end && wait_end - av_gettime_relative() < 0) return AVERROR(EAGAIN); n = poll(p, rt->max_p, POLL_TIMEOUT_MS); if (n > 0) { int j = rt->rtsp_hd ? 1 : 0; timeout_cnt = 0; for (i = 0; i < rt->nb_rtsp_streams; i++) { rtsp_st = rt->rtsp_streams[i]; if (rtsp_st->rtp_handle) { if (p[j].revents & POLLIN || p[j+1].revents & POLLIN) { ret = ffurl_read(rtsp_st->rtp_handle, buf, buf_size); if (ret > 0) { *prtsp_st = rtsp_st; return ret; } } j+=2; } } #if CONFIG_RTSP_DEMUXER if (rt->rtsp_hd && p[0].revents & POLLIN) { return parse_rtsp_message(s); } #endif } else if (n == 0 && ++timeout_cnt >= MAX_TIMEOUTS) { return AVERROR(ETIMEDOUT); } else if (n < 0 && errno != EINTR) return AVERROR(errno); } }
false
FFmpeg
f6161fccf8c5720ceac1ed1df8ba60ff8fed69f5
static int udp_read_packet(AVFormatContext *s, RTSPStream **prtsp_st, uint8_t *buf, int buf_size, int64_t wait_end) { RTSPState *rt = s->priv_data; RTSPStream *rtsp_st; int n, i, ret, timeout_cnt = 0; struct pollfd *p = rt->p; int *fds = NULL, fdsnum, fdsidx; if (!p) { p = rt->p = av_malloc_array(2 * (rt->nb_rtsp_streams + 1), sizeof(struct pollfd)); if (!p) return AVERROR(ENOMEM); if (rt->rtsp_hd) { p[rt->max_p].fd = ffurl_get_file_handle(rt->rtsp_hd); p[rt->max_p++].events = POLLIN; } for (i = 0; i < rt->nb_rtsp_streams; i++) { rtsp_st = rt->rtsp_streams[i]; if (rtsp_st->rtp_handle) { if (ret = ffurl_get_multi_file_handle(rtsp_st->rtp_handle, &fds, &fdsnum)) { av_log(s, AV_LOG_ERROR, "Unable to recover rtp ports\n"); return ret; } if (fdsnum != 2) { av_log(s, AV_LOG_ERROR, "Number of fds %d not supported\n", fdsnum); return AVERROR_INVALIDDATA; } for (fdsidx = 0; fdsidx < fdsnum; fdsidx++) { p[rt->max_p].fd = fds[fdsidx]; p[rt->max_p++].events = POLLIN; } av_free(fds); } } } for (;;) { if (ff_check_interrupt(&s->interrupt_callback)) return AVERROR_EXIT; if (wait_end && wait_end - av_gettime_relative() < 0) return AVERROR(EAGAIN); n = poll(p, rt->max_p, POLL_TIMEOUT_MS); if (n > 0) { int j = rt->rtsp_hd ? 1 : 0; timeout_cnt = 0; for (i = 0; i < rt->nb_rtsp_streams; i++) { rtsp_st = rt->rtsp_streams[i]; if (rtsp_st->rtp_handle) { if (p[j].revents & POLLIN || p[j+1].revents & POLLIN) { ret = ffurl_read(rtsp_st->rtp_handle, buf, buf_size); if (ret > 0) { *prtsp_st = rtsp_st; return ret; } } j+=2; } } #if CONFIG_RTSP_DEMUXER if (rt->rtsp_hd && p[0].revents & POLLIN) { return parse_rtsp_message(s); } #endif } else if (n == 0 && ++timeout_cnt >= MAX_TIMEOUTS) { return AVERROR(ETIMEDOUT); } else if (n < 0 && errno != EINTR) return AVERROR(errno); } }
{ "code": [], "line_no": [] }
static int FUNC_0(AVFormatContext *VAR_0, RTSPStream **VAR_1, uint8_t *VAR_2, int VAR_3, int64_t VAR_4) { RTSPState *rt = VAR_0->priv_data; RTSPStream *rtsp_st; int VAR_5, VAR_6, VAR_7, VAR_8 = 0; struct pollfd *VAR_9 = rt->VAR_9; int *VAR_10 = NULL, VAR_11, VAR_12; if (!VAR_9) { VAR_9 = rt->VAR_9 = av_malloc_array(2 * (rt->nb_rtsp_streams + 1), sizeof(struct pollfd)); if (!VAR_9) return AVERROR(ENOMEM); if (rt->rtsp_hd) { VAR_9[rt->max_p].fd = ffurl_get_file_handle(rt->rtsp_hd); VAR_9[rt->max_p++].events = POLLIN; } for (VAR_6 = 0; VAR_6 < rt->nb_rtsp_streams; VAR_6++) { rtsp_st = rt->rtsp_streams[VAR_6]; if (rtsp_st->rtp_handle) { if (VAR_7 = ffurl_get_multi_file_handle(rtsp_st->rtp_handle, &VAR_10, &VAR_11)) { av_log(VAR_0, AV_LOG_ERROR, "Unable to recover rtp ports\VAR_5"); return VAR_7; } if (VAR_11 != 2) { av_log(VAR_0, AV_LOG_ERROR, "Number of VAR_10 %d not supported\VAR_5", VAR_11); return AVERROR_INVALIDDATA; } for (VAR_12 = 0; VAR_12 < VAR_11; VAR_12++) { VAR_9[rt->max_p].fd = VAR_10[VAR_12]; VAR_9[rt->max_p++].events = POLLIN; } av_free(VAR_10); } } } for (;;) { if (ff_check_interrupt(&VAR_0->interrupt_callback)) return AVERROR_EXIT; if (VAR_4 && VAR_4 - av_gettime_relative() < 0) return AVERROR(EAGAIN); VAR_5 = poll(VAR_9, rt->max_p, POLL_TIMEOUT_MS); if (VAR_5 > 0) { int VAR_13 = rt->rtsp_hd ? 1 : 0; VAR_8 = 0; for (VAR_6 = 0; VAR_6 < rt->nb_rtsp_streams; VAR_6++) { rtsp_st = rt->rtsp_streams[VAR_6]; if (rtsp_st->rtp_handle) { if (VAR_9[VAR_13].revents & POLLIN || VAR_9[VAR_13+1].revents & POLLIN) { VAR_7 = ffurl_read(rtsp_st->rtp_handle, VAR_2, VAR_3); if (VAR_7 > 0) { *VAR_1 = rtsp_st; return VAR_7; } } VAR_13+=2; } } #if CONFIG_RTSP_DEMUXER if (rt->rtsp_hd && VAR_9[0].revents & POLLIN) { return parse_rtsp_message(VAR_0); } #endif } else if (VAR_5 == 0 && ++VAR_8 >= MAX_TIMEOUTS) { return AVERROR(ETIMEDOUT); } else if (VAR_5 < 0 && errno != EINTR) return AVERROR(errno); } }
[ "static int FUNC_0(AVFormatContext *VAR_0, RTSPStream **VAR_1,\nuint8_t *VAR_2, int VAR_3, int64_t VAR_4)\n{", "RTSPState *rt = VAR_0->priv_data;", "RTSPStream *rtsp_st;", "int VAR_5, VAR_6, VAR_7, VAR_8 = 0;", "struct pollfd *VAR_9 = rt->VAR_9;", "int *VAR_10 = NULL, VAR_11, VAR_12;", "if (!VAR_9) {", "VAR_9 = rt->VAR_9 = av_malloc_array(2 * (rt->nb_rtsp_streams + 1), sizeof(struct pollfd));", "if (!VAR_9)\nreturn AVERROR(ENOMEM);", "if (rt->rtsp_hd) {", "VAR_9[rt->max_p].fd = ffurl_get_file_handle(rt->rtsp_hd);", "VAR_9[rt->max_p++].events = POLLIN;", "}", "for (VAR_6 = 0; VAR_6 < rt->nb_rtsp_streams; VAR_6++) {", "rtsp_st = rt->rtsp_streams[VAR_6];", "if (rtsp_st->rtp_handle) {", "if (VAR_7 = ffurl_get_multi_file_handle(rtsp_st->rtp_handle,\n&VAR_10, &VAR_11)) {", "av_log(VAR_0, AV_LOG_ERROR, \"Unable to recover rtp ports\\VAR_5\");", "return VAR_7;", "}", "if (VAR_11 != 2) {", "av_log(VAR_0, AV_LOG_ERROR,\n\"Number of VAR_10 %d not supported\\VAR_5\", VAR_11);", "return AVERROR_INVALIDDATA;", "}", "for (VAR_12 = 0; VAR_12 < VAR_11; VAR_12++) {", "VAR_9[rt->max_p].fd = VAR_10[VAR_12];", "VAR_9[rt->max_p++].events = POLLIN;", "}", "av_free(VAR_10);", "}", "}", "}", "for (;;) {", "if (ff_check_interrupt(&VAR_0->interrupt_callback))\nreturn AVERROR_EXIT;", "if (VAR_4 && VAR_4 - av_gettime_relative() < 0)\nreturn AVERROR(EAGAIN);", "VAR_5 = poll(VAR_9, rt->max_p, POLL_TIMEOUT_MS);", "if (VAR_5 > 0) {", "int VAR_13 = rt->rtsp_hd ? 1 : 0;", "VAR_8 = 0;", "for (VAR_6 = 0; VAR_6 < rt->nb_rtsp_streams; VAR_6++) {", "rtsp_st = rt->rtsp_streams[VAR_6];", "if (rtsp_st->rtp_handle) {", "if (VAR_9[VAR_13].revents & POLLIN || VAR_9[VAR_13+1].revents & POLLIN) {", "VAR_7 = ffurl_read(rtsp_st->rtp_handle, VAR_2, VAR_3);", "if (VAR_7 > 0) {", "*VAR_1 = rtsp_st;", "return VAR_7;", "}", "}", "VAR_13+=2;", "}", "}", "#if CONFIG_RTSP_DEMUXER\nif (rt->rtsp_hd && VAR_9[0].revents & POLLIN) {", "return parse_rtsp_message(VAR_0);", "}", "#endif\n} else if (VAR_5 == 0 && ++VAR_8 >= MAX_TIMEOUTS) {", "return AVERROR(ETIMEDOUT);", "} else if (VAR_5 < 0 && errno != EINTR)", "return AVERROR(errno);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23, 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43, 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55, 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 81 ], [ 83, 85 ], [ 87, 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125, 127 ], [ 129 ], [ 131 ], [ 133, 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ] ]
11,208
static void booke_update_fixed_timer(CPUPPCState *env, uint8_t target_bit, uint64_t *next, struct QEMUTimer *timer) { ppc_tb_t *tb_env = env->tb_env; uint64_t lapse; uint64_t tb; uint64_t period = 1 << (target_bit + 1); uint64_t now; now = qemu_get_clock_ns(vm_clock); tb = cpu_ppc_get_tb(tb_env, now, tb_env->tb_offset); lapse = period - ((tb - (1 << target_bit)) & (period - 1)); *next = now + muldiv64(lapse, get_ticks_per_sec(), tb_env->tb_freq); /* XXX: If expire time is now. We can't run the callback because we don't * have access to it. So we just set the timer one nanosecond later. */ if (*next == now) { (*next)++; } qemu_mod_timer(timer, *next); }
true
qemu
ab8131afee34d6aa427bd56ac18c4d3b6df80728
static void booke_update_fixed_timer(CPUPPCState *env, uint8_t target_bit, uint64_t *next, struct QEMUTimer *timer) { ppc_tb_t *tb_env = env->tb_env; uint64_t lapse; uint64_t tb; uint64_t period = 1 << (target_bit + 1); uint64_t now; now = qemu_get_clock_ns(vm_clock); tb = cpu_ppc_get_tb(tb_env, now, tb_env->tb_offset); lapse = period - ((tb - (1 << target_bit)) & (period - 1)); *next = now + muldiv64(lapse, get_ticks_per_sec(), tb_env->tb_freq); if (*next == now) { (*next)++; } qemu_mod_timer(timer, *next); }
{ "code": [ " uint64_t lapse;", " uint64_t period = 1 << (target_bit + 1);", " lapse = period - ((tb - (1 << target_bit)) & (period - 1));", " *next = now + muldiv64(lapse, get_ticks_per_sec(), tb_env->tb_freq);" ], "line_no": [ 13, 17, 29, 33 ] }
static void FUNC_0(CPUPPCState *VAR_0, uint8_t VAR_1, uint64_t *VAR_2, struct QEMUTimer *VAR_3) { ppc_tb_t *tb_env = VAR_0->tb_env; uint64_t lapse; uint64_t tb; uint64_t period = 1 << (VAR_1 + 1); uint64_t now; now = qemu_get_clock_ns(vm_clock); tb = cpu_ppc_get_tb(tb_env, now, tb_env->tb_offset); lapse = period - ((tb - (1 << VAR_1)) & (period - 1)); *VAR_2 = now + muldiv64(lapse, get_ticks_per_sec(), tb_env->tb_freq); if (*VAR_2 == now) { (*VAR_2)++; } qemu_mod_timer(VAR_3, *VAR_2); }
[ "static void FUNC_0(CPUPPCState *VAR_0,\nuint8_t VAR_1,\nuint64_t *VAR_2,\nstruct QEMUTimer *VAR_3)\n{", "ppc_tb_t *tb_env = VAR_0->tb_env;", "uint64_t lapse;", "uint64_t tb;", "uint64_t period = 1 << (VAR_1 + 1);", "uint64_t now;", "now = qemu_get_clock_ns(vm_clock);", "tb = cpu_ppc_get_tb(tb_env, now, tb_env->tb_offset);", "lapse = period - ((tb - (1 << VAR_1)) & (period - 1));", "*VAR_2 = now + muldiv64(lapse, get_ticks_per_sec(), tb_env->tb_freq);", "if (*VAR_2 == now) {", "(*VAR_2)++;", "}", "qemu_mod_timer(VAR_3, *VAR_2);", "}" ]
[ 0, 0, 1, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 29 ], [ 33 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ] ]
11,209
static void spapr_machine_init(MachineState *machine) { sPAPRMachineState *spapr = SPAPR_MACHINE(machine); sPAPRMachineClass *smc = SPAPR_MACHINE_GET_CLASS(machine); const char *kernel_filename = machine->kernel_filename; const char *initrd_filename = machine->initrd_filename; PCIHostState *phb; int i; MemoryRegion *sysmem = get_system_memory(); MemoryRegion *ram = g_new(MemoryRegion, 1); MemoryRegion *rma_region; void *rma = NULL; hwaddr rma_alloc_size; hwaddr node0_size = spapr_node0_size(machine); long load_limit, fw_size; char *filename; Error *resize_hpt_err = NULL; msi_nonbroken = true; QLIST_INIT(&spapr->phbs); QTAILQ_INIT(&spapr->pending_dimm_unplugs); /* Check HPT resizing availability */ kvmppc_check_papr_resize_hpt(&resize_hpt_err); if (spapr->resize_hpt == SPAPR_RESIZE_HPT_DEFAULT) { /* * If the user explicitly requested a mode we should either * supply it, or fail completely (which we do below). But if * it's not set explicitly, we reset our mode to something * that works */ if (resize_hpt_err) { spapr->resize_hpt = SPAPR_RESIZE_HPT_DISABLED; error_free(resize_hpt_err); resize_hpt_err = NULL; } else { spapr->resize_hpt = smc->resize_hpt_default; } } assert(spapr->resize_hpt != SPAPR_RESIZE_HPT_DEFAULT); if ((spapr->resize_hpt != SPAPR_RESIZE_HPT_DISABLED) && resize_hpt_err) { /* * User requested HPT resize, but this host can't supply it. Bail out */ error_report_err(resize_hpt_err); exit(1); } /* Allocate RMA if necessary */ rma_alloc_size = kvmppc_alloc_rma(&rma); if (rma_alloc_size == -1) { error_report("Unable to create RMA"); exit(1); } if (rma_alloc_size && (rma_alloc_size < node0_size)) { spapr->rma_size = rma_alloc_size; } else { spapr->rma_size = node0_size; /* With KVM, we don't actually know whether KVM supports an * unbounded RMA (PR KVM) or is limited by the hash table size * (HV KVM using VRMA), so we always assume the latter * * In that case, we also limit the initial allocations for RTAS * etc... to 256M since we have no way to know what the VRMA size * is going to be as it depends on the size of the hash table * isn't determined yet. */ if (kvm_enabled()) { spapr->vrma_adjust = 1; spapr->rma_size = MIN(spapr->rma_size, 0x10000000); } /* Actually we don't support unbounded RMA anymore since we * added proper emulation of HV mode. The max we can get is * 16G which also happens to be what we configure for PAPR * mode so make sure we don't do anything bigger than that */ spapr->rma_size = MIN(spapr->rma_size, 0x400000000ull); } if (spapr->rma_size > node0_size) { error_report("Numa node 0 has to span the RMA (%#08"HWADDR_PRIx")", spapr->rma_size); exit(1); } /* Setup a load limit for the ramdisk leaving room for SLOF and FDT */ load_limit = MIN(spapr->rma_size, RTAS_MAX_ADDR) - FW_OVERHEAD; /* Set up Interrupt Controller before we create the VCPUs */ xics_system_init(machine, XICS_IRQS_SPAPR, &error_fatal); /* Set up containers for ibm,client-architecture-support negotiated options */ spapr->ov5 = spapr_ovec_new(); spapr->ov5_cas = spapr_ovec_new(); if (smc->dr_lmb_enabled) { spapr_ovec_set(spapr->ov5, OV5_DRCONF_MEMORY); spapr_validate_node_memory(machine, &error_fatal); } spapr_ovec_set(spapr->ov5, OV5_FORM1_AFFINITY); if (!kvm_enabled() || kvmppc_has_cap_mmu_radix()) { /* KVM and TCG always allow GTSE with radix... */ spapr_ovec_set(spapr->ov5, OV5_MMU_RADIX_GTSE); } /* ... but not with hash (currently). */ /* advertise support for dedicated HP event source to guests */ if (spapr->use_hotplug_event_source) { spapr_ovec_set(spapr->ov5, OV5_HP_EVT); } /* advertise support for HPT resizing */ if (spapr->resize_hpt != SPAPR_RESIZE_HPT_DISABLED) { spapr_ovec_set(spapr->ov5, OV5_HPT_RESIZE); } /* init CPUs */ spapr_set_vsmt_mode(spapr, &error_fatal); spapr_init_cpus(spapr); if (kvm_enabled()) { /* Enable H_LOGICAL_CI_* so SLOF can talk to in-kernel devices */ kvmppc_enable_logical_ci_hcalls(); kvmppc_enable_set_mode_hcall(); /* H_CLEAR_MOD/_REF are mandatory in PAPR, but off by default */ kvmppc_enable_clear_ref_mod_hcalls(); } /* allocate RAM */ memory_region_allocate_system_memory(ram, NULL, "ppc_spapr.ram", machine->ram_size); memory_region_add_subregion(sysmem, 0, ram); if (rma_alloc_size && rma) { rma_region = g_new(MemoryRegion, 1); memory_region_init_ram_ptr(rma_region, NULL, "ppc_spapr.rma", rma_alloc_size, rma); vmstate_register_ram_global(rma_region); memory_region_add_subregion(sysmem, 0, rma_region); } /* initialize hotplug memory address space */ if (machine->ram_size < machine->maxram_size) { ram_addr_t hotplug_mem_size = machine->maxram_size - machine->ram_size; /* * Limit the number of hotpluggable memory slots to half the number * slots that KVM supports, leaving the other half for PCI and other * devices. However ensure that number of slots doesn't drop below 32. */ int max_memslots = kvm_enabled() ? kvm_get_max_memslots() / 2 : SPAPR_MAX_RAM_SLOTS; if (max_memslots < SPAPR_MAX_RAM_SLOTS) { max_memslots = SPAPR_MAX_RAM_SLOTS; } if (machine->ram_slots > max_memslots) { error_report("Specified number of memory slots %" PRIu64" exceeds max supported %d", machine->ram_slots, max_memslots); exit(1); } spapr->hotplug_memory.base = ROUND_UP(machine->ram_size, SPAPR_HOTPLUG_MEM_ALIGN); memory_region_init(&spapr->hotplug_memory.mr, OBJECT(spapr), "hotplug-memory", hotplug_mem_size); memory_region_add_subregion(sysmem, spapr->hotplug_memory.base, &spapr->hotplug_memory.mr); } if (smc->dr_lmb_enabled) { spapr_create_lmb_dr_connectors(spapr); } filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, "spapr-rtas.bin"); if (!filename) { error_report("Could not find LPAR rtas '%s'", "spapr-rtas.bin"); exit(1); } spapr->rtas_size = get_image_size(filename); if (spapr->rtas_size < 0) { error_report("Could not get size of LPAR rtas '%s'", filename); exit(1); } spapr->rtas_blob = g_malloc(spapr->rtas_size); if (load_image_size(filename, spapr->rtas_blob, spapr->rtas_size) < 0) { error_report("Could not load LPAR rtas '%s'", filename); exit(1); } if (spapr->rtas_size > RTAS_MAX_SIZE) { error_report("RTAS too big ! 0x%zx bytes (max is 0x%x)", (size_t)spapr->rtas_size, RTAS_MAX_SIZE); exit(1); } g_free(filename); /* Set up RTAS event infrastructure */ spapr_events_init(spapr); /* Set up the RTC RTAS interfaces */ spapr_rtc_create(spapr); /* Set up VIO bus */ spapr->vio_bus = spapr_vio_bus_init(); for (i = 0; i < MAX_SERIAL_PORTS; i++) { if (serial_hds[i]) { spapr_vty_create(spapr->vio_bus, serial_hds[i]); } } /* We always have at least the nvram device on VIO */ spapr_create_nvram(spapr); /* Set up PCI */ spapr_pci_rtas_init(); phb = spapr_create_phb(spapr, 0); for (i = 0; i < nb_nics; i++) { NICInfo *nd = &nd_table[i]; if (!nd->model) { nd->model = g_strdup("ibmveth"); } if (strcmp(nd->model, "ibmveth") == 0) { spapr_vlan_create(spapr->vio_bus, nd); } else { pci_nic_init_nofail(&nd_table[i], phb->bus, nd->model, NULL); } } for (i = 0; i <= drive_get_max_bus(IF_SCSI); i++) { spapr_vscsi_create(spapr->vio_bus); } /* Graphics */ if (spapr_vga_init(phb->bus, &error_fatal)) { spapr->has_graphics = true; machine->usb |= defaults_enabled() && !machine->usb_disabled; } if (machine->usb) { if (smc->use_ohci_by_default) { pci_create_simple(phb->bus, -1, "pci-ohci"); } else { pci_create_simple(phb->bus, -1, "nec-usb-xhci"); } if (spapr->has_graphics) { USBBus *usb_bus = usb_bus_find(-1); usb_create_simple(usb_bus, "usb-kbd"); usb_create_simple(usb_bus, "usb-mouse"); } } if (spapr->rma_size < (MIN_RMA_SLOF << 20)) { error_report( "pSeries SLOF firmware requires >= %ldM guest RMA (Real Mode Area memory)", MIN_RMA_SLOF); exit(1); } if (kernel_filename) { uint64_t lowaddr = 0; spapr->kernel_size = load_elf(kernel_filename, translate_kernel_address, NULL, NULL, &lowaddr, NULL, 1, PPC_ELF_MACHINE, 0, 0); if (spapr->kernel_size == ELF_LOAD_WRONG_ENDIAN) { spapr->kernel_size = load_elf(kernel_filename, translate_kernel_address, NULL, NULL, &lowaddr, NULL, 0, PPC_ELF_MACHINE, 0, 0); spapr->kernel_le = spapr->kernel_size > 0; } if (spapr->kernel_size < 0) { error_report("error loading %s: %s", kernel_filename, load_elf_strerror(spapr->kernel_size)); exit(1); } /* load initrd */ if (initrd_filename) { /* Try to locate the initrd in the gap between the kernel * and the firmware. Add a bit of space just in case */ spapr->initrd_base = (KERNEL_LOAD_ADDR + spapr->kernel_size + 0x1ffff) & ~0xffff; spapr->initrd_size = load_image_targphys(initrd_filename, spapr->initrd_base, load_limit - spapr->initrd_base); if (spapr->initrd_size < 0) { error_report("could not load initial ram disk '%s'", initrd_filename); exit(1); } } } if (bios_name == NULL) { bios_name = FW_FILE_NAME; } filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); if (!filename) { error_report("Could not find LPAR firmware '%s'", bios_name); exit(1); } fw_size = load_image_targphys(filename, 0, FW_MAX_SIZE); if (fw_size <= 0) { error_report("Could not load LPAR firmware '%s'", filename); exit(1); } g_free(filename); /* FIXME: Should register things through the MachineState's qdev * interface, this is a legacy from the sPAPREnvironment structure * which predated MachineState but had a similar function */ vmstate_register(NULL, 0, &vmstate_spapr, spapr); register_savevm_live(NULL, "spapr/htab", -1, 1, &savevm_htab_handlers, spapr); qemu_register_boot_set(spapr_boot_set, spapr); if (kvm_enabled()) { /* to stop and start vmclock */ qemu_add_vm_change_state_handler(cpu_ppc_clock_vm_state_change, &spapr->tb); kvmppc_spapr_enable_inkernel_multitce(); } }
true
qemu
33face6b8981add8eba1f7cdaf4cf6cede415d2e
static void spapr_machine_init(MachineState *machine) { sPAPRMachineState *spapr = SPAPR_MACHINE(machine); sPAPRMachineClass *smc = SPAPR_MACHINE_GET_CLASS(machine); const char *kernel_filename = machine->kernel_filename; const char *initrd_filename = machine->initrd_filename; PCIHostState *phb; int i; MemoryRegion *sysmem = get_system_memory(); MemoryRegion *ram = g_new(MemoryRegion, 1); MemoryRegion *rma_region; void *rma = NULL; hwaddr rma_alloc_size; hwaddr node0_size = spapr_node0_size(machine); long load_limit, fw_size; char *filename; Error *resize_hpt_err = NULL; msi_nonbroken = true; QLIST_INIT(&spapr->phbs); QTAILQ_INIT(&spapr->pending_dimm_unplugs); kvmppc_check_papr_resize_hpt(&resize_hpt_err); if (spapr->resize_hpt == SPAPR_RESIZE_HPT_DEFAULT) { if (resize_hpt_err) { spapr->resize_hpt = SPAPR_RESIZE_HPT_DISABLED; error_free(resize_hpt_err); resize_hpt_err = NULL; } else { spapr->resize_hpt = smc->resize_hpt_default; } } assert(spapr->resize_hpt != SPAPR_RESIZE_HPT_DEFAULT); if ((spapr->resize_hpt != SPAPR_RESIZE_HPT_DISABLED) && resize_hpt_err) { error_report_err(resize_hpt_err); exit(1); } rma_alloc_size = kvmppc_alloc_rma(&rma); if (rma_alloc_size == -1) { error_report("Unable to create RMA"); exit(1); } if (rma_alloc_size && (rma_alloc_size < node0_size)) { spapr->rma_size = rma_alloc_size; } else { spapr->rma_size = node0_size; if (kvm_enabled()) { spapr->vrma_adjust = 1; spapr->rma_size = MIN(spapr->rma_size, 0x10000000); } spapr->rma_size = MIN(spapr->rma_size, 0x400000000ull); } if (spapr->rma_size > node0_size) { error_report("Numa node 0 has to span the RMA (%#08"HWADDR_PRIx")", spapr->rma_size); exit(1); } load_limit = MIN(spapr->rma_size, RTAS_MAX_ADDR) - FW_OVERHEAD; xics_system_init(machine, XICS_IRQS_SPAPR, &error_fatal); spapr->ov5 = spapr_ovec_new(); spapr->ov5_cas = spapr_ovec_new(); if (smc->dr_lmb_enabled) { spapr_ovec_set(spapr->ov5, OV5_DRCONF_MEMORY); spapr_validate_node_memory(machine, &error_fatal); } spapr_ovec_set(spapr->ov5, OV5_FORM1_AFFINITY); if (!kvm_enabled() || kvmppc_has_cap_mmu_radix()) { spapr_ovec_set(spapr->ov5, OV5_MMU_RADIX_GTSE); } if (spapr->use_hotplug_event_source) { spapr_ovec_set(spapr->ov5, OV5_HP_EVT); } if (spapr->resize_hpt != SPAPR_RESIZE_HPT_DISABLED) { spapr_ovec_set(spapr->ov5, OV5_HPT_RESIZE); } spapr_set_vsmt_mode(spapr, &error_fatal); spapr_init_cpus(spapr); if (kvm_enabled()) { kvmppc_enable_logical_ci_hcalls(); kvmppc_enable_set_mode_hcall(); kvmppc_enable_clear_ref_mod_hcalls(); } memory_region_allocate_system_memory(ram, NULL, "ppc_spapr.ram", machine->ram_size); memory_region_add_subregion(sysmem, 0, ram); if (rma_alloc_size && rma) { rma_region = g_new(MemoryRegion, 1); memory_region_init_ram_ptr(rma_region, NULL, "ppc_spapr.rma", rma_alloc_size, rma); vmstate_register_ram_global(rma_region); memory_region_add_subregion(sysmem, 0, rma_region); } if (machine->ram_size < machine->maxram_size) { ram_addr_t hotplug_mem_size = machine->maxram_size - machine->ram_size; int max_memslots = kvm_enabled() ? kvm_get_max_memslots() / 2 : SPAPR_MAX_RAM_SLOTS; if (max_memslots < SPAPR_MAX_RAM_SLOTS) { max_memslots = SPAPR_MAX_RAM_SLOTS; } if (machine->ram_slots > max_memslots) { error_report("Specified number of memory slots %" PRIu64" exceeds max supported %d", machine->ram_slots, max_memslots); exit(1); } spapr->hotplug_memory.base = ROUND_UP(machine->ram_size, SPAPR_HOTPLUG_MEM_ALIGN); memory_region_init(&spapr->hotplug_memory.mr, OBJECT(spapr), "hotplug-memory", hotplug_mem_size); memory_region_add_subregion(sysmem, spapr->hotplug_memory.base, &spapr->hotplug_memory.mr); } if (smc->dr_lmb_enabled) { spapr_create_lmb_dr_connectors(spapr); } filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, "spapr-rtas.bin"); if (!filename) { error_report("Could not find LPAR rtas '%s'", "spapr-rtas.bin"); exit(1); } spapr->rtas_size = get_image_size(filename); if (spapr->rtas_size < 0) { error_report("Could not get size of LPAR rtas '%s'", filename); exit(1); } spapr->rtas_blob = g_malloc(spapr->rtas_size); if (load_image_size(filename, spapr->rtas_blob, spapr->rtas_size) < 0) { error_report("Could not load LPAR rtas '%s'", filename); exit(1); } if (spapr->rtas_size > RTAS_MAX_SIZE) { error_report("RTAS too big ! 0x%zx bytes (max is 0x%x)", (size_t)spapr->rtas_size, RTAS_MAX_SIZE); exit(1); } g_free(filename); spapr_events_init(spapr); spapr_rtc_create(spapr); spapr->vio_bus = spapr_vio_bus_init(); for (i = 0; i < MAX_SERIAL_PORTS; i++) { if (serial_hds[i]) { spapr_vty_create(spapr->vio_bus, serial_hds[i]); } } spapr_create_nvram(spapr); spapr_pci_rtas_init(); phb = spapr_create_phb(spapr, 0); for (i = 0; i < nb_nics; i++) { NICInfo *nd = &nd_table[i]; if (!nd->model) { nd->model = g_strdup("ibmveth"); } if (strcmp(nd->model, "ibmveth") == 0) { spapr_vlan_create(spapr->vio_bus, nd); } else { pci_nic_init_nofail(&nd_table[i], phb->bus, nd->model, NULL); } } for (i = 0; i <= drive_get_max_bus(IF_SCSI); i++) { spapr_vscsi_create(spapr->vio_bus); } if (spapr_vga_init(phb->bus, &error_fatal)) { spapr->has_graphics = true; machine->usb |= defaults_enabled() && !machine->usb_disabled; } if (machine->usb) { if (smc->use_ohci_by_default) { pci_create_simple(phb->bus, -1, "pci-ohci"); } else { pci_create_simple(phb->bus, -1, "nec-usb-xhci"); } if (spapr->has_graphics) { USBBus *usb_bus = usb_bus_find(-1); usb_create_simple(usb_bus, "usb-kbd"); usb_create_simple(usb_bus, "usb-mouse"); } } if (spapr->rma_size < (MIN_RMA_SLOF << 20)) { error_report( "pSeries SLOF firmware requires >= %ldM guest RMA (Real Mode Area memory)", MIN_RMA_SLOF); exit(1); } if (kernel_filename) { uint64_t lowaddr = 0; spapr->kernel_size = load_elf(kernel_filename, translate_kernel_address, NULL, NULL, &lowaddr, NULL, 1, PPC_ELF_MACHINE, 0, 0); if (spapr->kernel_size == ELF_LOAD_WRONG_ENDIAN) { spapr->kernel_size = load_elf(kernel_filename, translate_kernel_address, NULL, NULL, &lowaddr, NULL, 0, PPC_ELF_MACHINE, 0, 0); spapr->kernel_le = spapr->kernel_size > 0; } if (spapr->kernel_size < 0) { error_report("error loading %s: %s", kernel_filename, load_elf_strerror(spapr->kernel_size)); exit(1); } if (initrd_filename) { spapr->initrd_base = (KERNEL_LOAD_ADDR + spapr->kernel_size + 0x1ffff) & ~0xffff; spapr->initrd_size = load_image_targphys(initrd_filename, spapr->initrd_base, load_limit - spapr->initrd_base); if (spapr->initrd_size < 0) { error_report("could not load initial ram disk '%s'", initrd_filename); exit(1); } } } if (bios_name == NULL) { bios_name = FW_FILE_NAME; } filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); if (!filename) { error_report("Could not find LPAR firmware '%s'", bios_name); exit(1); } fw_size = load_image_targphys(filename, 0, FW_MAX_SIZE); if (fw_size <= 0) { error_report("Could not load LPAR firmware '%s'", filename); exit(1); } g_free(filename); vmstate_register(NULL, 0, &vmstate_spapr, spapr); register_savevm_live(NULL, "spapr/htab", -1, 1, &savevm_htab_handlers, spapr); qemu_register_boot_set(spapr_boot_set, spapr); if (kvm_enabled()) { qemu_add_vm_change_state_handler(cpu_ppc_clock_vm_state_change, &spapr->tb); kvmppc_spapr_enable_inkernel_multitce(); } }
{ "code": [], "line_no": [] }
static void FUNC_0(MachineState *VAR_0) { sPAPRMachineState *spapr = SPAPR_MACHINE(VAR_0); sPAPRMachineClass *smc = SPAPR_MACHINE_GET_CLASS(VAR_0); const char *VAR_1 = VAR_0->VAR_1; const char *VAR_2 = VAR_0->VAR_2; PCIHostState *phb; int VAR_3; MemoryRegion *sysmem = get_system_memory(); MemoryRegion *ram = g_new(MemoryRegion, 1); MemoryRegion *rma_region; void *VAR_4 = NULL; hwaddr rma_alloc_size; hwaddr node0_size = spapr_node0_size(VAR_0); long VAR_5, VAR_6; char *VAR_7; Error *resize_hpt_err = NULL; msi_nonbroken = true; QLIST_INIT(&spapr->phbs); QTAILQ_INIT(&spapr->pending_dimm_unplugs); kvmppc_check_papr_resize_hpt(&resize_hpt_err); if (spapr->resize_hpt == SPAPR_RESIZE_HPT_DEFAULT) { if (resize_hpt_err) { spapr->resize_hpt = SPAPR_RESIZE_HPT_DISABLED; error_free(resize_hpt_err); resize_hpt_err = NULL; } else { spapr->resize_hpt = smc->resize_hpt_default; } } assert(spapr->resize_hpt != SPAPR_RESIZE_HPT_DEFAULT); if ((spapr->resize_hpt != SPAPR_RESIZE_HPT_DISABLED) && resize_hpt_err) { error_report_err(resize_hpt_err); exit(1); } rma_alloc_size = kvmppc_alloc_rma(&VAR_4); if (rma_alloc_size == -1) { error_report("Unable to create RMA"); exit(1); } if (rma_alloc_size && (rma_alloc_size < node0_size)) { spapr->rma_size = rma_alloc_size; } else { spapr->rma_size = node0_size; if (kvm_enabled()) { spapr->vrma_adjust = 1; spapr->rma_size = MIN(spapr->rma_size, 0x10000000); } spapr->rma_size = MIN(spapr->rma_size, 0x400000000ull); } if (spapr->rma_size > node0_size) { error_report("Numa node 0 has to span the RMA (%#08"HWADDR_PRIx")", spapr->rma_size); exit(1); } VAR_5 = MIN(spapr->rma_size, RTAS_MAX_ADDR) - FW_OVERHEAD; xics_system_init(VAR_0, XICS_IRQS_SPAPR, &error_fatal); spapr->ov5 = spapr_ovec_new(); spapr->ov5_cas = spapr_ovec_new(); if (smc->dr_lmb_enabled) { spapr_ovec_set(spapr->ov5, OV5_DRCONF_MEMORY); spapr_validate_node_memory(VAR_0, &error_fatal); } spapr_ovec_set(spapr->ov5, OV5_FORM1_AFFINITY); if (!kvm_enabled() || kvmppc_has_cap_mmu_radix()) { spapr_ovec_set(spapr->ov5, OV5_MMU_RADIX_GTSE); } if (spapr->use_hotplug_event_source) { spapr_ovec_set(spapr->ov5, OV5_HP_EVT); } if (spapr->resize_hpt != SPAPR_RESIZE_HPT_DISABLED) { spapr_ovec_set(spapr->ov5, OV5_HPT_RESIZE); } spapr_set_vsmt_mode(spapr, &error_fatal); spapr_init_cpus(spapr); if (kvm_enabled()) { kvmppc_enable_logical_ci_hcalls(); kvmppc_enable_set_mode_hcall(); kvmppc_enable_clear_ref_mod_hcalls(); } memory_region_allocate_system_memory(ram, NULL, "ppc_spapr.ram", VAR_0->ram_size); memory_region_add_subregion(sysmem, 0, ram); if (rma_alloc_size && VAR_4) { rma_region = g_new(MemoryRegion, 1); memory_region_init_ram_ptr(rma_region, NULL, "ppc_spapr.VAR_4", rma_alloc_size, VAR_4); vmstate_register_ram_global(rma_region); memory_region_add_subregion(sysmem, 0, rma_region); } if (VAR_0->ram_size < VAR_0->maxram_size) { ram_addr_t hotplug_mem_size = VAR_0->maxram_size - VAR_0->ram_size; int VAR_8 = kvm_enabled() ? kvm_get_max_memslots() / 2 : SPAPR_MAX_RAM_SLOTS; if (VAR_8 < SPAPR_MAX_RAM_SLOTS) { VAR_8 = SPAPR_MAX_RAM_SLOTS; } if (VAR_0->ram_slots > VAR_8) { error_report("Specified number of memory slots %" PRIu64" exceeds max supported %d", VAR_0->ram_slots, VAR_8); exit(1); } spapr->hotplug_memory.base = ROUND_UP(VAR_0->ram_size, SPAPR_HOTPLUG_MEM_ALIGN); memory_region_init(&spapr->hotplug_memory.mr, OBJECT(spapr), "hotplug-memory", hotplug_mem_size); memory_region_add_subregion(sysmem, spapr->hotplug_memory.base, &spapr->hotplug_memory.mr); } if (smc->dr_lmb_enabled) { spapr_create_lmb_dr_connectors(spapr); } VAR_7 = qemu_find_file(QEMU_FILE_TYPE_BIOS, "spapr-rtas.bin"); if (!VAR_7) { error_report("Could not find LPAR rtas '%s'", "spapr-rtas.bin"); exit(1); } spapr->rtas_size = get_image_size(VAR_7); if (spapr->rtas_size < 0) { error_report("Could not get size of LPAR rtas '%s'", VAR_7); exit(1); } spapr->rtas_blob = g_malloc(spapr->rtas_size); if (load_image_size(VAR_7, spapr->rtas_blob, spapr->rtas_size) < 0) { error_report("Could not load LPAR rtas '%s'", VAR_7); exit(1); } if (spapr->rtas_size > RTAS_MAX_SIZE) { error_report("RTAS too big ! 0x%zx bytes (max is 0x%x)", (size_t)spapr->rtas_size, RTAS_MAX_SIZE); exit(1); } g_free(VAR_7); spapr_events_init(spapr); spapr_rtc_create(spapr); spapr->vio_bus = spapr_vio_bus_init(); for (VAR_3 = 0; VAR_3 < MAX_SERIAL_PORTS; VAR_3++) { if (serial_hds[VAR_3]) { spapr_vty_create(spapr->vio_bus, serial_hds[VAR_3]); } } spapr_create_nvram(spapr); spapr_pci_rtas_init(); phb = spapr_create_phb(spapr, 0); for (VAR_3 = 0; VAR_3 < nb_nics; VAR_3++) { NICInfo *nd = &nd_table[VAR_3]; if (!nd->model) { nd->model = g_strdup("ibmveth"); } if (strcmp(nd->model, "ibmveth") == 0) { spapr_vlan_create(spapr->vio_bus, nd); } else { pci_nic_init_nofail(&nd_table[VAR_3], phb->bus, nd->model, NULL); } } for (VAR_3 = 0; VAR_3 <= drive_get_max_bus(IF_SCSI); VAR_3++) { spapr_vscsi_create(spapr->vio_bus); } if (spapr_vga_init(phb->bus, &error_fatal)) { spapr->has_graphics = true; VAR_0->usb |= defaults_enabled() && !VAR_0->usb_disabled; } if (VAR_0->usb) { if (smc->use_ohci_by_default) { pci_create_simple(phb->bus, -1, "pci-ohci"); } else { pci_create_simple(phb->bus, -1, "nec-usb-xhci"); } if (spapr->has_graphics) { USBBus *usb_bus = usb_bus_find(-1); usb_create_simple(usb_bus, "usb-kbd"); usb_create_simple(usb_bus, "usb-mouse"); } } if (spapr->rma_size < (MIN_RMA_SLOF << 20)) { error_report( "pSeries SLOF firmware requires >= %ldM guest RMA (Real Mode Area memory)", MIN_RMA_SLOF); exit(1); } if (VAR_1) { uint64_t lowaddr = 0; spapr->kernel_size = load_elf(VAR_1, translate_kernel_address, NULL, NULL, &lowaddr, NULL, 1, PPC_ELF_MACHINE, 0, 0); if (spapr->kernel_size == ELF_LOAD_WRONG_ENDIAN) { spapr->kernel_size = load_elf(VAR_1, translate_kernel_address, NULL, NULL, &lowaddr, NULL, 0, PPC_ELF_MACHINE, 0, 0); spapr->kernel_le = spapr->kernel_size > 0; } if (spapr->kernel_size < 0) { error_report("error loading %s: %s", VAR_1, load_elf_strerror(spapr->kernel_size)); exit(1); } if (VAR_2) { spapr->initrd_base = (KERNEL_LOAD_ADDR + spapr->kernel_size + 0x1ffff) & ~0xffff; spapr->initrd_size = load_image_targphys(VAR_2, spapr->initrd_base, VAR_5 - spapr->initrd_base); if (spapr->initrd_size < 0) { error_report("could not load initial ram disk '%s'", VAR_2); exit(1); } } } if (bios_name == NULL) { bios_name = FW_FILE_NAME; } VAR_7 = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); if (!VAR_7) { error_report("Could not find LPAR firmware '%s'", bios_name); exit(1); } VAR_6 = load_image_targphys(VAR_7, 0, FW_MAX_SIZE); if (VAR_6 <= 0) { error_report("Could not load LPAR firmware '%s'", VAR_7); exit(1); } g_free(VAR_7); vmstate_register(NULL, 0, &vmstate_spapr, spapr); register_savevm_live(NULL, "spapr/htab", -1, 1, &savevm_htab_handlers, spapr); qemu_register_boot_set(spapr_boot_set, spapr); if (kvm_enabled()) { qemu_add_vm_change_state_handler(cpu_ppc_clock_vm_state_change, &spapr->tb); kvmppc_spapr_enable_inkernel_multitce(); } }
[ "static void FUNC_0(MachineState *VAR_0)\n{", "sPAPRMachineState *spapr = SPAPR_MACHINE(VAR_0);", "sPAPRMachineClass *smc = SPAPR_MACHINE_GET_CLASS(VAR_0);", "const char *VAR_1 = VAR_0->VAR_1;", "const char *VAR_2 = VAR_0->VAR_2;", "PCIHostState *phb;", "int VAR_3;", "MemoryRegion *sysmem = get_system_memory();", "MemoryRegion *ram = g_new(MemoryRegion, 1);", "MemoryRegion *rma_region;", "void *VAR_4 = NULL;", "hwaddr rma_alloc_size;", "hwaddr node0_size = spapr_node0_size(VAR_0);", "long VAR_5, VAR_6;", "char *VAR_7;", "Error *resize_hpt_err = NULL;", "msi_nonbroken = true;", "QLIST_INIT(&spapr->phbs);", "QTAILQ_INIT(&spapr->pending_dimm_unplugs);", "kvmppc_check_papr_resize_hpt(&resize_hpt_err);", "if (spapr->resize_hpt == SPAPR_RESIZE_HPT_DEFAULT) {", "if (resize_hpt_err) {", "spapr->resize_hpt = SPAPR_RESIZE_HPT_DISABLED;", "error_free(resize_hpt_err);", "resize_hpt_err = NULL;", "} else {", "spapr->resize_hpt = smc->resize_hpt_default;", "}", "}", "assert(spapr->resize_hpt != SPAPR_RESIZE_HPT_DEFAULT);", "if ((spapr->resize_hpt != SPAPR_RESIZE_HPT_DISABLED) && resize_hpt_err) {", "error_report_err(resize_hpt_err);", "exit(1);", "}", "rma_alloc_size = kvmppc_alloc_rma(&VAR_4);", "if (rma_alloc_size == -1) {", "error_report(\"Unable to create RMA\");", "exit(1);", "}", "if (rma_alloc_size && (rma_alloc_size < node0_size)) {", "spapr->rma_size = rma_alloc_size;", "} else {", "spapr->rma_size = node0_size;", "if (kvm_enabled()) {", "spapr->vrma_adjust = 1;", "spapr->rma_size = MIN(spapr->rma_size, 0x10000000);", "}", "spapr->rma_size = MIN(spapr->rma_size, 0x400000000ull);", "}", "if (spapr->rma_size > node0_size) {", "error_report(\"Numa node 0 has to span the RMA (%#08\"HWADDR_PRIx\")\",\nspapr->rma_size);", "exit(1);", "}", "VAR_5 = MIN(spapr->rma_size, RTAS_MAX_ADDR) - FW_OVERHEAD;", "xics_system_init(VAR_0, XICS_IRQS_SPAPR, &error_fatal);", "spapr->ov5 = spapr_ovec_new();", "spapr->ov5_cas = spapr_ovec_new();", "if (smc->dr_lmb_enabled) {", "spapr_ovec_set(spapr->ov5, OV5_DRCONF_MEMORY);", "spapr_validate_node_memory(VAR_0, &error_fatal);", "}", "spapr_ovec_set(spapr->ov5, OV5_FORM1_AFFINITY);", "if (!kvm_enabled() || kvmppc_has_cap_mmu_radix()) {", "spapr_ovec_set(spapr->ov5, OV5_MMU_RADIX_GTSE);", "}", "if (spapr->use_hotplug_event_source) {", "spapr_ovec_set(spapr->ov5, OV5_HP_EVT);", "}", "if (spapr->resize_hpt != SPAPR_RESIZE_HPT_DISABLED) {", "spapr_ovec_set(spapr->ov5, OV5_HPT_RESIZE);", "}", "spapr_set_vsmt_mode(spapr, &error_fatal);", "spapr_init_cpus(spapr);", "if (kvm_enabled()) {", "kvmppc_enable_logical_ci_hcalls();", "kvmppc_enable_set_mode_hcall();", "kvmppc_enable_clear_ref_mod_hcalls();", "}", "memory_region_allocate_system_memory(ram, NULL, \"ppc_spapr.ram\",\nVAR_0->ram_size);", "memory_region_add_subregion(sysmem, 0, ram);", "if (rma_alloc_size && VAR_4) {", "rma_region = g_new(MemoryRegion, 1);", "memory_region_init_ram_ptr(rma_region, NULL, \"ppc_spapr.VAR_4\",\nrma_alloc_size, VAR_4);", "vmstate_register_ram_global(rma_region);", "memory_region_add_subregion(sysmem, 0, rma_region);", "}", "if (VAR_0->ram_size < VAR_0->maxram_size) {", "ram_addr_t hotplug_mem_size = VAR_0->maxram_size - VAR_0->ram_size;", "int VAR_8 = kvm_enabled() ? kvm_get_max_memslots() / 2 :\nSPAPR_MAX_RAM_SLOTS;", "if (VAR_8 < SPAPR_MAX_RAM_SLOTS) {", "VAR_8 = SPAPR_MAX_RAM_SLOTS;", "}", "if (VAR_0->ram_slots > VAR_8) {", "error_report(\"Specified number of memory slots %\"\nPRIu64\" exceeds max supported %d\",\nVAR_0->ram_slots, VAR_8);", "exit(1);", "}", "spapr->hotplug_memory.base = ROUND_UP(VAR_0->ram_size,\nSPAPR_HOTPLUG_MEM_ALIGN);", "memory_region_init(&spapr->hotplug_memory.mr, OBJECT(spapr),\n\"hotplug-memory\", hotplug_mem_size);", "memory_region_add_subregion(sysmem, spapr->hotplug_memory.base,\n&spapr->hotplug_memory.mr);", "}", "if (smc->dr_lmb_enabled) {", "spapr_create_lmb_dr_connectors(spapr);", "}", "VAR_7 = qemu_find_file(QEMU_FILE_TYPE_BIOS, \"spapr-rtas.bin\");", "if (!VAR_7) {", "error_report(\"Could not find LPAR rtas '%s'\", \"spapr-rtas.bin\");", "exit(1);", "}", "spapr->rtas_size = get_image_size(VAR_7);", "if (spapr->rtas_size < 0) {", "error_report(\"Could not get size of LPAR rtas '%s'\", VAR_7);", "exit(1);", "}", "spapr->rtas_blob = g_malloc(spapr->rtas_size);", "if (load_image_size(VAR_7, spapr->rtas_blob, spapr->rtas_size) < 0) {", "error_report(\"Could not load LPAR rtas '%s'\", VAR_7);", "exit(1);", "}", "if (spapr->rtas_size > RTAS_MAX_SIZE) {", "error_report(\"RTAS too big ! 0x%zx bytes (max is 0x%x)\",\n(size_t)spapr->rtas_size, RTAS_MAX_SIZE);", "exit(1);", "}", "g_free(VAR_7);", "spapr_events_init(spapr);", "spapr_rtc_create(spapr);", "spapr->vio_bus = spapr_vio_bus_init();", "for (VAR_3 = 0; VAR_3 < MAX_SERIAL_PORTS; VAR_3++) {", "if (serial_hds[VAR_3]) {", "spapr_vty_create(spapr->vio_bus, serial_hds[VAR_3]);", "}", "}", "spapr_create_nvram(spapr);", "spapr_pci_rtas_init();", "phb = spapr_create_phb(spapr, 0);", "for (VAR_3 = 0; VAR_3 < nb_nics; VAR_3++) {", "NICInfo *nd = &nd_table[VAR_3];", "if (!nd->model) {", "nd->model = g_strdup(\"ibmveth\");", "}", "if (strcmp(nd->model, \"ibmveth\") == 0) {", "spapr_vlan_create(spapr->vio_bus, nd);", "} else {", "pci_nic_init_nofail(&nd_table[VAR_3], phb->bus, nd->model, NULL);", "}", "}", "for (VAR_3 = 0; VAR_3 <= drive_get_max_bus(IF_SCSI); VAR_3++) {", "spapr_vscsi_create(spapr->vio_bus);", "}", "if (spapr_vga_init(phb->bus, &error_fatal)) {", "spapr->has_graphics = true;", "VAR_0->usb |= defaults_enabled() && !VAR_0->usb_disabled;", "}", "if (VAR_0->usb) {", "if (smc->use_ohci_by_default) {", "pci_create_simple(phb->bus, -1, \"pci-ohci\");", "} else {", "pci_create_simple(phb->bus, -1, \"nec-usb-xhci\");", "}", "if (spapr->has_graphics) {", "USBBus *usb_bus = usb_bus_find(-1);", "usb_create_simple(usb_bus, \"usb-kbd\");", "usb_create_simple(usb_bus, \"usb-mouse\");", "}", "}", "if (spapr->rma_size < (MIN_RMA_SLOF << 20)) {", "error_report(\n\"pSeries SLOF firmware requires >= %ldM guest RMA (Real Mode Area memory)\",\nMIN_RMA_SLOF);", "exit(1);", "}", "if (VAR_1) {", "uint64_t lowaddr = 0;", "spapr->kernel_size = load_elf(VAR_1, translate_kernel_address,\nNULL, NULL, &lowaddr, NULL, 1,\nPPC_ELF_MACHINE, 0, 0);", "if (spapr->kernel_size == ELF_LOAD_WRONG_ENDIAN) {", "spapr->kernel_size = load_elf(VAR_1,\ntranslate_kernel_address, NULL, NULL,\n&lowaddr, NULL, 0, PPC_ELF_MACHINE,\n0, 0);", "spapr->kernel_le = spapr->kernel_size > 0;", "}", "if (spapr->kernel_size < 0) {", "error_report(\"error loading %s: %s\", VAR_1,\nload_elf_strerror(spapr->kernel_size));", "exit(1);", "}", "if (VAR_2) {", "spapr->initrd_base = (KERNEL_LOAD_ADDR + spapr->kernel_size\n+ 0x1ffff) & ~0xffff;", "spapr->initrd_size = load_image_targphys(VAR_2,\nspapr->initrd_base,\nVAR_5\n- spapr->initrd_base);", "if (spapr->initrd_size < 0) {", "error_report(\"could not load initial ram disk '%s'\",\nVAR_2);", "exit(1);", "}", "}", "}", "if (bios_name == NULL) {", "bios_name = FW_FILE_NAME;", "}", "VAR_7 = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);", "if (!VAR_7) {", "error_report(\"Could not find LPAR firmware '%s'\", bios_name);", "exit(1);", "}", "VAR_6 = load_image_targphys(VAR_7, 0, FW_MAX_SIZE);", "if (VAR_6 <= 0) {", "error_report(\"Could not load LPAR firmware '%s'\", VAR_7);", "exit(1);", "}", "g_free(VAR_7);", "vmstate_register(NULL, 0, &vmstate_spapr, spapr);", "register_savevm_live(NULL, \"spapr/htab\", -1, 1,\n&savevm_htab_handlers, spapr);", "qemu_register_boot_set(spapr_boot_set, spapr);", "if (kvm_enabled()) {", "qemu_add_vm_change_state_handler(cpu_ppc_clock_vm_state_change,\n&spapr->tb);", "kvmppc_spapr_enable_inkernel_multitce();", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 2 ], [ 3 ], [ 4 ], [ 5 ], [ 6 ], [ 7 ], [ 8 ], [ 9 ], [ 10 ], [ 11 ], [ 12 ], [ 13 ], [ 14 ], [ 15 ], [ 16 ], [ 17 ], [ 18 ], [ 19 ], [ 20 ], [ 22 ], [ 23 ], [ 30 ], [ 31 ], [ 32 ], [ 33 ], [ 34 ], [ 35 ], [ 36 ], [ 37 ], [ 38 ], [ 39 ], [ 43 ], [ 44 ], [ 45 ], [ 47 ], [ 48 ], [ 49 ], [ 50 ], [ 51 ], [ 52 ], [ 53 ], [ 54 ], [ 55 ], [ 65 ], [ 66 ], [ 67 ], [ 68 ], [ 74 ], [ 75 ], [ 76 ], [ 77, 78 ], [ 79 ], [ 80 ], [ 82 ], [ 84 ], [ 87 ], [ 88 ], [ 89 ], [ 90 ], [ 91 ], [ 92 ], [ 93 ], [ 94 ], [ 96 ], [ 97 ], [ 100 ], [ 101 ], [ 102 ], [ 104 ], [ 105 ], [ 106 ], [ 108 ], [ 109 ], [ 110 ], [ 112 ], [ 113 ], [ 115 ], [ 116 ], [ 118, 119 ], [ 120 ], [ 121 ], [ 122 ], [ 123, 124 ], [ 125 ], [ 126 ], [ 127 ], [ 129 ], [ 130 ], [ 136, 137 ], [ 138 ], [ 139 ], [ 140 ], [ 141 ], [ 142, 143, 144 ], [ 145 ], [ 146 ], [ 147, 148 ], [ 149, 150 ], [ 151, 152 ], [ 153 ], [ 154 ], [ 155 ], [ 156 ], [ 157 ], [ 158 ], [ 159 ], [ 160 ], [ 161 ], [ 162 ], [ 163 ], [ 164 ], [ 165 ], [ 166 ], [ 167 ], [ 168 ], [ 169 ], [ 170 ], [ 171 ], [ 172 ], [ 173, 174 ], [ 175 ], [ 176 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 184 ], [ 185 ], [ 186 ], [ 187 ], [ 188 ], [ 190 ], [ 192 ], [ 193 ], [ 194 ], [ 195 ], [ 196 ], [ 197 ], [ 198 ], [ 199 ], [ 200 ], [ 201 ], [ 202 ], [ 203 ], [ 204 ], [ 205 ], [ 206 ], [ 207 ], [ 209 ], [ 210 ], [ 211 ], [ 212 ], [ 213 ], [ 214 ], [ 215 ], [ 216 ], [ 217 ], [ 218 ], [ 219 ], [ 220 ], [ 221 ], [ 222 ], [ 223 ], [ 224 ], [ 225 ], [ 226, 227, 228 ], [ 229 ], [ 230 ], [ 231 ], [ 232 ], [ 233, 234, 235 ], [ 236 ], [ 237, 238, 239, 240 ], [ 241 ], [ 242 ], [ 243 ], [ 244, 245 ], [ 246 ], [ 247 ], [ 249 ], [ 253, 254 ], [ 255, 256, 257, 258 ], [ 259 ], [ 260, 261 ], [ 262 ], [ 263 ], [ 264 ], [ 265 ], [ 266 ], [ 267 ], [ 268 ], [ 269 ], [ 270 ], [ 271 ], [ 272 ], [ 273 ], [ 274 ], [ 275 ], [ 276 ], [ 277 ], [ 278 ], [ 279 ], [ 283 ], [ 284, 285 ], [ 286 ], [ 287 ], [ 289, 290 ], [ 291 ], [ 292 ], [ 293 ] ]
11,210
static int append_flv_data(RTMPContext *rt, RTMPPacket *pkt, int skip) { int old_flv_size, ret; PutByteContext pbc; const uint8_t *data = pkt->data + skip; const int size = pkt->size - skip; uint32_t ts = pkt->timestamp; if (pkt->type == RTMP_PT_AUDIO) { rt->has_audio = 1; } else if (pkt->type == RTMP_PT_VIDEO) { rt->has_video = 1; } old_flv_size = update_offset(rt, size + 15); if ((ret = av_reallocp(&rt->flv_data, rt->flv_size)) < 0) { rt->flv_size = rt->flv_off = 0; return ret; } bytestream2_init_writer(&pbc, rt->flv_data, rt->flv_size); bytestream2_skip_p(&pbc, old_flv_size); bytestream2_put_byte(&pbc, pkt->type); bytestream2_put_be24(&pbc, size); bytestream2_put_be24(&pbc, ts); bytestream2_put_byte(&pbc, ts >> 24); bytestream2_put_be24(&pbc, 0); bytestream2_put_buffer(&pbc, data, size); bytestream2_put_be32(&pbc, 0); return 0; }
true
FFmpeg
e55376a1fd5abebbb0a082aa20739d58c2260a37
static int append_flv_data(RTMPContext *rt, RTMPPacket *pkt, int skip) { int old_flv_size, ret; PutByteContext pbc; const uint8_t *data = pkt->data + skip; const int size = pkt->size - skip; uint32_t ts = pkt->timestamp; if (pkt->type == RTMP_PT_AUDIO) { rt->has_audio = 1; } else if (pkt->type == RTMP_PT_VIDEO) { rt->has_video = 1; } old_flv_size = update_offset(rt, size + 15); if ((ret = av_reallocp(&rt->flv_data, rt->flv_size)) < 0) { rt->flv_size = rt->flv_off = 0; return ret; } bytestream2_init_writer(&pbc, rt->flv_data, rt->flv_size); bytestream2_skip_p(&pbc, old_flv_size); bytestream2_put_byte(&pbc, pkt->type); bytestream2_put_be24(&pbc, size); bytestream2_put_be24(&pbc, ts); bytestream2_put_byte(&pbc, ts >> 24); bytestream2_put_be24(&pbc, 0); bytestream2_put_buffer(&pbc, data, size); bytestream2_put_be32(&pbc, 0); return 0; }
{ "code": [ " bytestream2_put_be32(&pbc, 0);" ], "line_no": [ 57 ] }
static int FUNC_0(RTMPContext *VAR_0, RTMPPacket *VAR_1, int VAR_2) { int VAR_3, VAR_4; PutByteContext pbc; const uint8_t *VAR_5 = VAR_1->VAR_5 + VAR_2; const int VAR_6 = VAR_1->VAR_6 - VAR_2; uint32_t ts = VAR_1->timestamp; if (VAR_1->type == RTMP_PT_AUDIO) { VAR_0->has_audio = 1; } else if (VAR_1->type == RTMP_PT_VIDEO) { VAR_0->has_video = 1; } VAR_3 = update_offset(VAR_0, VAR_6 + 15); if ((VAR_4 = av_reallocp(&VAR_0->flv_data, VAR_0->flv_size)) < 0) { VAR_0->flv_size = VAR_0->flv_off = 0; return VAR_4; } bytestream2_init_writer(&pbc, VAR_0->flv_data, VAR_0->flv_size); bytestream2_skip_p(&pbc, VAR_3); bytestream2_put_byte(&pbc, VAR_1->type); bytestream2_put_be24(&pbc, VAR_6); bytestream2_put_be24(&pbc, ts); bytestream2_put_byte(&pbc, ts >> 24); bytestream2_put_be24(&pbc, 0); bytestream2_put_buffer(&pbc, VAR_5, VAR_6); bytestream2_put_be32(&pbc, 0); return 0; }
[ "static int FUNC_0(RTMPContext *VAR_0, RTMPPacket *VAR_1, int VAR_2)\n{", "int VAR_3, VAR_4;", "PutByteContext pbc;", "const uint8_t *VAR_5 = VAR_1->VAR_5 + VAR_2;", "const int VAR_6 = VAR_1->VAR_6 - VAR_2;", "uint32_t ts = VAR_1->timestamp;", "if (VAR_1->type == RTMP_PT_AUDIO) {", "VAR_0->has_audio = 1;", "} else if (VAR_1->type == RTMP_PT_VIDEO) {", "VAR_0->has_video = 1;", "}", "VAR_3 = update_offset(VAR_0, VAR_6 + 15);", "if ((VAR_4 = av_reallocp(&VAR_0->flv_data, VAR_0->flv_size)) < 0) {", "VAR_0->flv_size = VAR_0->flv_off = 0;", "return VAR_4;", "}", "bytestream2_init_writer(&pbc, VAR_0->flv_data, VAR_0->flv_size);", "bytestream2_skip_p(&pbc, VAR_3);", "bytestream2_put_byte(&pbc, VAR_1->type);", "bytestream2_put_be24(&pbc, VAR_6);", "bytestream2_put_be24(&pbc, ts);", "bytestream2_put_byte(&pbc, ts >> 24);", "bytestream2_put_be24(&pbc, 0);", "bytestream2_put_buffer(&pbc, VAR_5, VAR_6);", "bytestream2_put_be32(&pbc, 0);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 63 ] ]
11,211
static void decode_b(AVCodecContext *ctx, int row, int col, struct VP9Filter *lflvl, ptrdiff_t yoff, ptrdiff_t uvoff, enum BlockLevel bl, enum BlockPartition bp) { VP9Context *s = ctx->priv_data; VP9Block *b = s->b; enum BlockSize bs = bl * 3 + bp; int bytesperpixel = s->bytesperpixel; int w4 = bwh_tab[1][bs][0], h4 = bwh_tab[1][bs][1], lvl; int emu[2]; AVFrame *f = s->frames[CUR_FRAME].tf.f; s->row = row; s->row7 = row & 7; s->col = col; s->col7 = col & 7; s->min_mv.x = -(128 + col * 64); s->min_mv.y = -(128 + row * 64); s->max_mv.x = 128 + (s->cols - col - w4) * 64; s->max_mv.y = 128 + (s->rows - row - h4) * 64; if (s->pass < 2) { b->bs = bs; b->bl = bl; b->bp = bp; decode_mode(ctx); b->uvtx = b->tx - ((s->ss_h && w4 * 2 == (1 << b->tx)) || (s->ss_v && h4 * 2 == (1 << b->tx))); if (!b->skip) { int has_coeffs; if (bytesperpixel == 1) { has_coeffs = decode_coeffs_8bpp(ctx); } else { has_coeffs = decode_coeffs_16bpp(ctx); } if (!has_coeffs && b->bs <= BS_8x8 && !b->intra) { b->skip = 1; memset(&s->above_skip_ctx[col], 1, w4); memset(&s->left_skip_ctx[s->row7], 1, h4); } } else { int row7 = s->row7; #define SPLAT_ZERO_CTX(v, n) \ switch (n) { \ case 1: v = 0; break; \ case 2: AV_ZERO16(&v); break; \ case 4: AV_ZERO32(&v); break; \ case 8: AV_ZERO64(&v); break; \ case 16: AV_ZERO128(&v); break; \ } #define SPLAT_ZERO_YUV(dir, var, off, n, dir2) \ do { \ SPLAT_ZERO_CTX(s->dir##_y_##var[off * 2], n * 2); \ if (s->ss_##dir2) { \ SPLAT_ZERO_CTX(s->dir##_uv_##var[0][off], n); \ SPLAT_ZERO_CTX(s->dir##_uv_##var[1][off], n); \ } else { \ SPLAT_ZERO_CTX(s->dir##_uv_##var[0][off * 2], n * 2); \ SPLAT_ZERO_CTX(s->dir##_uv_##var[1][off * 2], n * 2); \ } \ } while (0) switch (w4) { case 1: SPLAT_ZERO_YUV(above, nnz_ctx, col, 1, h); break; case 2: SPLAT_ZERO_YUV(above, nnz_ctx, col, 2, h); break; case 4: SPLAT_ZERO_YUV(above, nnz_ctx, col, 4, h); break; case 8: SPLAT_ZERO_YUV(above, nnz_ctx, col, 8, h); break; } switch (h4) { case 1: SPLAT_ZERO_YUV(left, nnz_ctx, row7, 1, v); break; case 2: SPLAT_ZERO_YUV(left, nnz_ctx, row7, 2, v); break; case 4: SPLAT_ZERO_YUV(left, nnz_ctx, row7, 4, v); break; case 8: SPLAT_ZERO_YUV(left, nnz_ctx, row7, 8, v); break; } } if (s->pass == 1) { s->b++; s->block += w4 * h4 * 64 * bytesperpixel; s->uvblock[0] += w4 * h4 * 64 * bytesperpixel >> (s->ss_h + s->ss_v); s->uvblock[1] += w4 * h4 * 64 * bytesperpixel >> (s->ss_h + s->ss_v); s->eob += 4 * w4 * h4; s->uveob[0] += 4 * w4 * h4 >> (s->ss_h + s->ss_v); s->uveob[1] += 4 * w4 * h4 >> (s->ss_h + s->ss_v); return; } } // emulated overhangs if the stride of the target buffer can't hold. This // makes it possible to support emu-edge and so on even if we have large block // overhangs emu[0] = (col + w4) * 8 > f->linesize[0] || (row + h4) > s->rows; emu[1] = (col + w4) * 4 > f->linesize[1] || (row + h4) > s->rows; if (emu[0]) { s->dst[0] = s->tmp_y; s->y_stride = 128; } else { s->dst[0] = f->data[0] + yoff; s->y_stride = f->linesize[0]; } if (emu[1]) { s->dst[1] = s->tmp_uv[0]; s->dst[2] = s->tmp_uv[1]; s->uv_stride = 128; } else { s->dst[1] = f->data[1] + uvoff; s->dst[2] = f->data[2] + uvoff; s->uv_stride = f->linesize[1]; } if (b->intra) { if (s->bpp > 8) { intra_recon_16bpp(ctx, yoff, uvoff); } else { intra_recon_8bpp(ctx, yoff, uvoff); } } else { if (s->bpp > 8) { inter_recon_16bpp(ctx); } else { inter_recon_8bpp(ctx); } } if (emu[0]) { int w = FFMIN(s->cols - col, w4) * 8, h = FFMIN(s->rows - row, h4) * 8, n, o = 0; for (n = 0; o < w; n++) { int bw = 64 >> n; av_assert2(n <= 4); if (w & bw) { s->dsp.mc[n][0][0][0][0](f->data[0] + yoff + o * bytesperpixel, f->linesize[0], s->tmp_y + o * bytesperpixel, 128, h, 0, 0); o += bw; } } } if (emu[1]) { int w = FFMIN(s->cols - col, w4) * 8 >> s->ss_h; int h = FFMIN(s->rows - row, h4) * 8 >> s->ss_v, n, o = 0; for (n = s->ss_h; o < w; n++) { int bw = 64 >> n; av_assert2(n <= 4); if (w & bw) { s->dsp.mc[n][0][0][0][0](f->data[1] + uvoff + o * bytesperpixel, f->linesize[1], s->tmp_uv[0] + o * bytesperpixel, 128, h, 0, 0); s->dsp.mc[n][0][0][0][0](f->data[2] + uvoff + o * bytesperpixel, f->linesize[2], s->tmp_uv[1] + o * bytesperpixel, 128, h, 0, 0); o += bw; } } } // pick filter level and find edges to apply filter to if (s->filter.level && (lvl = s->segmentation.feat[b->seg_id].lflvl[b->intra ? 0 : b->ref[0] + 1] [b->mode[3] != ZEROMV]) > 0) { int x_end = FFMIN(s->cols - col, w4), y_end = FFMIN(s->rows - row, h4); int skip_inter = !b->intra && b->skip, col7 = s->col7, row7 = s->row7; setctx_2d(&lflvl->level[row7 * 8 + col7], w4, h4, 8, lvl); mask_edges(lflvl->mask[0], 0, 0, row7, col7, x_end, y_end, 0, 0, b->tx, skip_inter); if (s->ss_h || s->ss_v) mask_edges(lflvl->mask[1], s->ss_h, s->ss_v, row7, col7, x_end, y_end, s->cols & 1 && col + w4 >= s->cols ? s->cols & 7 : 0, s->rows & 1 && row + h4 >= s->rows ? s->rows & 7 : 0, b->uvtx, skip_inter); if (!s->filter.lim_lut[lvl]) { int sharp = s->filter.sharpness; int limit = lvl; if (sharp > 0) { limit >>= (sharp + 3) >> 2; limit = FFMIN(limit, 9 - sharp); } limit = FFMAX(limit, 1); s->filter.lim_lut[lvl] = limit; s->filter.mblim_lut[lvl] = 2 * (lvl + 2) + limit; } } if (s->pass == 2) { s->b++; s->block += w4 * h4 * 64 * bytesperpixel; s->uvblock[0] += w4 * h4 * 64 * bytesperpixel >> (s->ss_v + s->ss_h); s->uvblock[1] += w4 * h4 * 64 * bytesperpixel >> (s->ss_v + s->ss_h); s->eob += 4 * w4 * h4; s->uveob[0] += 4 * w4 * h4 >> (s->ss_v + s->ss_h); s->uveob[1] += 4 * w4 * h4 >> (s->ss_v + s->ss_h); } }
true
FFmpeg
a30a8beeb3dc44b666d0e1aefbd823752f321ac1
static void decode_b(AVCodecContext *ctx, int row, int col, struct VP9Filter *lflvl, ptrdiff_t yoff, ptrdiff_t uvoff, enum BlockLevel bl, enum BlockPartition bp) { VP9Context *s = ctx->priv_data; VP9Block *b = s->b; enum BlockSize bs = bl * 3 + bp; int bytesperpixel = s->bytesperpixel; int w4 = bwh_tab[1][bs][0], h4 = bwh_tab[1][bs][1], lvl; int emu[2]; AVFrame *f = s->frames[CUR_FRAME].tf.f; s->row = row; s->row7 = row & 7; s->col = col; s->col7 = col & 7; s->min_mv.x = -(128 + col * 64); s->min_mv.y = -(128 + row * 64); s->max_mv.x = 128 + (s->cols - col - w4) * 64; s->max_mv.y = 128 + (s->rows - row - h4) * 64; if (s->pass < 2) { b->bs = bs; b->bl = bl; b->bp = bp; decode_mode(ctx); b->uvtx = b->tx - ((s->ss_h && w4 * 2 == (1 << b->tx)) || (s->ss_v && h4 * 2 == (1 << b->tx))); if (!b->skip) { int has_coeffs; if (bytesperpixel == 1) { has_coeffs = decode_coeffs_8bpp(ctx); } else { has_coeffs = decode_coeffs_16bpp(ctx); } if (!has_coeffs && b->bs <= BS_8x8 && !b->intra) { b->skip = 1; memset(&s->above_skip_ctx[col], 1, w4); memset(&s->left_skip_ctx[s->row7], 1, h4); } } else { int row7 = s->row7; #define SPLAT_ZERO_CTX(v, n) \ switch (n) { \ case 1: v = 0; break; \ case 2: AV_ZERO16(&v); break; \ case 4: AV_ZERO32(&v); break; \ case 8: AV_ZERO64(&v); break; \ case 16: AV_ZERO128(&v); break; \ } #define SPLAT_ZERO_YUV(dir, var, off, n, dir2) \ do { \ SPLAT_ZERO_CTX(s->dir##_y_##var[off * 2], n * 2); \ if (s->ss_##dir2) { \ SPLAT_ZERO_CTX(s->dir##_uv_##var[0][off], n); \ SPLAT_ZERO_CTX(s->dir##_uv_##var[1][off], n); \ } else { \ SPLAT_ZERO_CTX(s->dir##_uv_##var[0][off * 2], n * 2); \ SPLAT_ZERO_CTX(s->dir##_uv_##var[1][off * 2], n * 2); \ } \ } while (0) switch (w4) { case 1: SPLAT_ZERO_YUV(above, nnz_ctx, col, 1, h); break; case 2: SPLAT_ZERO_YUV(above, nnz_ctx, col, 2, h); break; case 4: SPLAT_ZERO_YUV(above, nnz_ctx, col, 4, h); break; case 8: SPLAT_ZERO_YUV(above, nnz_ctx, col, 8, h); break; } switch (h4) { case 1: SPLAT_ZERO_YUV(left, nnz_ctx, row7, 1, v); break; case 2: SPLAT_ZERO_YUV(left, nnz_ctx, row7, 2, v); break; case 4: SPLAT_ZERO_YUV(left, nnz_ctx, row7, 4, v); break; case 8: SPLAT_ZERO_YUV(left, nnz_ctx, row7, 8, v); break; } } if (s->pass == 1) { s->b++; s->block += w4 * h4 * 64 * bytesperpixel; s->uvblock[0] += w4 * h4 * 64 * bytesperpixel >> (s->ss_h + s->ss_v); s->uvblock[1] += w4 * h4 * 64 * bytesperpixel >> (s->ss_h + s->ss_v); s->eob += 4 * w4 * h4; s->uveob[0] += 4 * w4 * h4 >> (s->ss_h + s->ss_v); s->uveob[1] += 4 * w4 * h4 >> (s->ss_h + s->ss_v); return; } } emu[0] = (col + w4) * 8 > f->linesize[0] || (row + h4) > s->rows; emu[1] = (col + w4) * 4 > f->linesize[1] || (row + h4) > s->rows; if (emu[0]) { s->dst[0] = s->tmp_y; s->y_stride = 128; } else { s->dst[0] = f->data[0] + yoff; s->y_stride = f->linesize[0]; } if (emu[1]) { s->dst[1] = s->tmp_uv[0]; s->dst[2] = s->tmp_uv[1]; s->uv_stride = 128; } else { s->dst[1] = f->data[1] + uvoff; s->dst[2] = f->data[2] + uvoff; s->uv_stride = f->linesize[1]; } if (b->intra) { if (s->bpp > 8) { intra_recon_16bpp(ctx, yoff, uvoff); } else { intra_recon_8bpp(ctx, yoff, uvoff); } } else { if (s->bpp > 8) { inter_recon_16bpp(ctx); } else { inter_recon_8bpp(ctx); } } if (emu[0]) { int w = FFMIN(s->cols - col, w4) * 8, h = FFMIN(s->rows - row, h4) * 8, n, o = 0; for (n = 0; o < w; n++) { int bw = 64 >> n; av_assert2(n <= 4); if (w & bw) { s->dsp.mc[n][0][0][0][0](f->data[0] + yoff + o * bytesperpixel, f->linesize[0], s->tmp_y + o * bytesperpixel, 128, h, 0, 0); o += bw; } } } if (emu[1]) { int w = FFMIN(s->cols - col, w4) * 8 >> s->ss_h; int h = FFMIN(s->rows - row, h4) * 8 >> s->ss_v, n, o = 0; for (n = s->ss_h; o < w; n++) { int bw = 64 >> n; av_assert2(n <= 4); if (w & bw) { s->dsp.mc[n][0][0][0][0](f->data[1] + uvoff + o * bytesperpixel, f->linesize[1], s->tmp_uv[0] + o * bytesperpixel, 128, h, 0, 0); s->dsp.mc[n][0][0][0][0](f->data[2] + uvoff + o * bytesperpixel, f->linesize[2], s->tmp_uv[1] + o * bytesperpixel, 128, h, 0, 0); o += bw; } } } if (s->filter.level && (lvl = s->segmentation.feat[b->seg_id].lflvl[b->intra ? 0 : b->ref[0] + 1] [b->mode[3] != ZEROMV]) > 0) { int x_end = FFMIN(s->cols - col, w4), y_end = FFMIN(s->rows - row, h4); int skip_inter = !b->intra && b->skip, col7 = s->col7, row7 = s->row7; setctx_2d(&lflvl->level[row7 * 8 + col7], w4, h4, 8, lvl); mask_edges(lflvl->mask[0], 0, 0, row7, col7, x_end, y_end, 0, 0, b->tx, skip_inter); if (s->ss_h || s->ss_v) mask_edges(lflvl->mask[1], s->ss_h, s->ss_v, row7, col7, x_end, y_end, s->cols & 1 && col + w4 >= s->cols ? s->cols & 7 : 0, s->rows & 1 && row + h4 >= s->rows ? s->rows & 7 : 0, b->uvtx, skip_inter); if (!s->filter.lim_lut[lvl]) { int sharp = s->filter.sharpness; int limit = lvl; if (sharp > 0) { limit >>= (sharp + 3) >> 2; limit = FFMIN(limit, 9 - sharp); } limit = FFMAX(limit, 1); s->filter.lim_lut[lvl] = limit; s->filter.mblim_lut[lvl] = 2 * (lvl + 2) + limit; } } if (s->pass == 2) { s->b++; s->block += w4 * h4 * 64 * bytesperpixel; s->uvblock[0] += w4 * h4 * 64 * bytesperpixel >> (s->ss_v + s->ss_h); s->uvblock[1] += w4 * h4 * 64 * bytesperpixel >> (s->ss_v + s->ss_h); s->eob += 4 * w4 * h4; s->uveob[0] += 4 * w4 * h4 >> (s->ss_v + s->ss_h); s->uveob[1] += 4 * w4 * h4 >> (s->ss_v + s->ss_h); } }
{ "code": [ " emu[0] = (col + w4) * 8 > f->linesize[0] ||", " emu[1] = (col + w4) * 4 > f->linesize[1] ||" ], "line_no": [ 187, 191 ] }
static void FUNC_0(AVCodecContext *VAR_0, int VAR_1, int VAR_2, struct VP9Filter *VAR_3, ptrdiff_t VAR_4, ptrdiff_t VAR_5, enum BlockLevel VAR_6, enum BlockPartition VAR_7) { VP9Context *s = VAR_0->priv_data; VP9Block *b = s->b; enum BlockSize VAR_8 = VAR_6 * 3 + VAR_7; int VAR_9 = s->VAR_9; int VAR_10 = bwh_tab[1][VAR_8][0], VAR_11 = bwh_tab[1][VAR_8][1], VAR_12; int VAR_13[2]; AVFrame *f = s->frames[CUR_FRAME].tf.f; s->VAR_1 = VAR_1; s->VAR_25 = VAR_1 & 7; s->VAR_2 = VAR_2; s->VAR_24 = VAR_2 & 7; s->min_mv.x = -(128 + VAR_2 * 64); s->min_mv.y = -(128 + VAR_1 * 64); s->max_mv.x = 128 + (s->cols - VAR_2 - VAR_10) * 64; s->max_mv.y = 128 + (s->rows - VAR_1 - VAR_11) * 64; if (s->pass < 2) { b->VAR_8 = VAR_8; b->VAR_6 = VAR_6; b->VAR_7 = VAR_7; decode_mode(VAR_0); b->uvtx = b->tx - ((s->ss_h && VAR_10 * 2 == (1 << b->tx)) || (s->ss_v && VAR_11 * 2 == (1 << b->tx))); if (!b->skip) { int VAR_14; if (VAR_9 == 1) { VAR_14 = decode_coeffs_8bpp(VAR_0); } else { VAR_14 = decode_coeffs_16bpp(VAR_0); } if (!VAR_14 && b->VAR_8 <= BS_8x8 && !b->intra) { b->skip = 1; memset(&s->above_skip_ctx[VAR_2], 1, VAR_10); memset(&s->left_skip_ctx[s->VAR_25], 1, VAR_11); } } else { int VAR_25 = s->VAR_25; #define SPLAT_ZERO_CTX(v, VAR_21) \ switch (VAR_21) { \ case 1: v = 0; break; \ case 2: AV_ZERO16(&v); break; \ case 4: AV_ZERO32(&v); break; \ case 8: AV_ZERO64(&v); break; \ case 16: AV_ZERO128(&v); break; \ } #define SPLAT_ZERO_YUV(dir, var, off, VAR_21, dir2) \ do { \ SPLAT_ZERO_CTX(s->dir##_y_##var[off * 2], VAR_21 * 2); \ if (s->ss_##dir2) { \ SPLAT_ZERO_CTX(s->dir##_uv_##var[0][off], VAR_21); \ SPLAT_ZERO_CTX(s->dir##_uv_##var[1][off], VAR_21); \ } else { \ SPLAT_ZERO_CTX(s->dir##_uv_##var[0][off * 2], VAR_21 * 2); \ SPLAT_ZERO_CTX(s->dir##_uv_##var[1][off * 2], VAR_21 * 2); \ } \ } while (0) switch (VAR_10) { case 1: SPLAT_ZERO_YUV(above, nnz_ctx, VAR_2, 1, VAR_21); break; case 2: SPLAT_ZERO_YUV(above, nnz_ctx, VAR_2, 2, VAR_21); break; case 4: SPLAT_ZERO_YUV(above, nnz_ctx, VAR_2, 4, VAR_21); break; case 8: SPLAT_ZERO_YUV(above, nnz_ctx, VAR_2, 8, VAR_21); break; } switch (VAR_11) { case 1: SPLAT_ZERO_YUV(left, nnz_ctx, VAR_25, 1, v); break; case 2: SPLAT_ZERO_YUV(left, nnz_ctx, VAR_25, 2, v); break; case 4: SPLAT_ZERO_YUV(left, nnz_ctx, VAR_25, 4, v); break; case 8: SPLAT_ZERO_YUV(left, nnz_ctx, VAR_25, 8, v); break; } } if (s->pass == 1) { s->b++; s->block += VAR_10 * VAR_11 * 64 * VAR_9; s->uvblock[0] += VAR_10 * VAR_11 * 64 * VAR_9 >> (s->ss_h + s->ss_v); s->uvblock[1] += VAR_10 * VAR_11 * 64 * VAR_9 >> (s->ss_h + s->ss_v); s->eob += 4 * VAR_10 * VAR_11; s->uveob[0] += 4 * VAR_10 * VAR_11 >> (s->ss_h + s->ss_v); s->uveob[1] += 4 * VAR_10 * VAR_11 >> (s->ss_h + s->ss_v); return; } } VAR_13[0] = (VAR_2 + VAR_10) * 8 > f->linesize[0] || (VAR_1 + VAR_11) > s->rows; VAR_13[1] = (VAR_2 + VAR_10) * 4 > f->linesize[1] || (VAR_1 + VAR_11) > s->rows; if (VAR_13[0]) { s->dst[0] = s->tmp_y; s->y_stride = 128; } else { s->dst[0] = f->data[0] + VAR_4; s->y_stride = f->linesize[0]; } if (VAR_13[1]) { s->dst[1] = s->tmp_uv[0]; s->dst[2] = s->tmp_uv[1]; s->uv_stride = 128; } else { s->dst[1] = f->data[1] + VAR_5; s->dst[2] = f->data[2] + VAR_5; s->uv_stride = f->linesize[1]; } if (b->intra) { if (s->bpp > 8) { intra_recon_16bpp(VAR_0, VAR_4, VAR_5); } else { intra_recon_8bpp(VAR_0, VAR_4, VAR_5); } } else { if (s->bpp > 8) { inter_recon_16bpp(VAR_0); } else { inter_recon_8bpp(VAR_0); } } if (VAR_13[0]) { int VAR_21 = FFMIN(s->cols - VAR_2, VAR_10) * 8, VAR_21 = FFMIN(s->rows - VAR_1, VAR_11) * 8, VAR_21, VAR_21 = 0; for (VAR_21 = 0; VAR_21 < VAR_21; VAR_21++) { int VAR_21 = 64 >> VAR_21; av_assert2(VAR_21 <= 4); if (VAR_21 & VAR_21) { s->dsp.mc[VAR_21][0][0][0][0](f->data[0] + VAR_4 + VAR_21 * VAR_9, f->linesize[0], s->tmp_y + VAR_21 * VAR_9, 128, VAR_21, 0, 0); VAR_21 += VAR_21; } } } if (VAR_13[1]) { int VAR_21 = FFMIN(s->cols - VAR_2, VAR_10) * 8 >> s->ss_h; int VAR_21 = FFMIN(s->rows - VAR_1, VAR_11) * 8 >> s->ss_v, VAR_21, VAR_21 = 0; for (VAR_21 = s->ss_h; VAR_21 < VAR_21; VAR_21++) { int VAR_21 = 64 >> VAR_21; av_assert2(VAR_21 <= 4); if (VAR_21 & VAR_21) { s->dsp.mc[VAR_21][0][0][0][0](f->data[1] + VAR_5 + VAR_21 * VAR_9, f->linesize[1], s->tmp_uv[0] + VAR_21 * VAR_9, 128, VAR_21, 0, 0); s->dsp.mc[VAR_21][0][0][0][0](f->data[2] + VAR_5 + VAR_21 * VAR_9, f->linesize[2], s->tmp_uv[1] + VAR_21 * VAR_9, 128, VAR_21, 0, 0); VAR_21 += VAR_21; } } } if (s->filter.level && (VAR_12 = s->segmentation.feat[b->seg_id].VAR_3[b->intra ? 0 : b->ref[0] + 1] [b->mode[3] != ZEROMV]) > 0) { int VAR_21 = FFMIN(s->cols - VAR_2, VAR_10), VAR_22 = FFMIN(s->rows - VAR_1, VAR_11); int VAR_23 = !b->intra && b->skip, VAR_24 = s->VAR_24, VAR_25 = s->VAR_25; setctx_2d(&VAR_3->level[VAR_25 * 8 + VAR_24], VAR_10, VAR_11, 8, VAR_12); mask_edges(VAR_3->mask[0], 0, 0, VAR_25, VAR_24, VAR_21, VAR_22, 0, 0, b->tx, VAR_23); if (s->ss_h || s->ss_v) mask_edges(VAR_3->mask[1], s->ss_h, s->ss_v, VAR_25, VAR_24, VAR_21, VAR_22, s->cols & 1 && VAR_2 + VAR_10 >= s->cols ? s->cols & 7 : 0, s->rows & 1 && VAR_1 + VAR_11 >= s->rows ? s->rows & 7 : 0, b->uvtx, VAR_23); if (!s->filter.lim_lut[VAR_12]) { int VAR_25 = s->filter.sharpness; int VAR_26 = VAR_12; if (VAR_25 > 0) { VAR_26 >>= (VAR_25 + 3) >> 2; VAR_26 = FFMIN(VAR_26, 9 - VAR_25); } VAR_26 = FFMAX(VAR_26, 1); s->filter.lim_lut[VAR_12] = VAR_26; s->filter.mblim_lut[VAR_12] = 2 * (VAR_12 + 2) + VAR_26; } } if (s->pass == 2) { s->b++; s->block += VAR_10 * VAR_11 * 64 * VAR_9; s->uvblock[0] += VAR_10 * VAR_11 * 64 * VAR_9 >> (s->ss_v + s->ss_h); s->uvblock[1] += VAR_10 * VAR_11 * 64 * VAR_9 >> (s->ss_v + s->ss_h); s->eob += 4 * VAR_10 * VAR_11; s->uveob[0] += 4 * VAR_10 * VAR_11 >> (s->ss_v + s->ss_h); s->uveob[1] += 4 * VAR_10 * VAR_11 >> (s->ss_v + s->ss_h); } }
[ "static void FUNC_0(AVCodecContext *VAR_0, int VAR_1, int VAR_2,\nstruct VP9Filter *VAR_3, ptrdiff_t VAR_4, ptrdiff_t VAR_5,\nenum BlockLevel VAR_6, enum BlockPartition VAR_7)\n{", "VP9Context *s = VAR_0->priv_data;", "VP9Block *b = s->b;", "enum BlockSize VAR_8 = VAR_6 * 3 + VAR_7;", "int VAR_9 = s->VAR_9;", "int VAR_10 = bwh_tab[1][VAR_8][0], VAR_11 = bwh_tab[1][VAR_8][1], VAR_12;", "int VAR_13[2];", "AVFrame *f = s->frames[CUR_FRAME].tf.f;", "s->VAR_1 = VAR_1;", "s->VAR_25 = VAR_1 & 7;", "s->VAR_2 = VAR_2;", "s->VAR_24 = VAR_2 & 7;", "s->min_mv.x = -(128 + VAR_2 * 64);", "s->min_mv.y = -(128 + VAR_1 * 64);", "s->max_mv.x = 128 + (s->cols - VAR_2 - VAR_10) * 64;", "s->max_mv.y = 128 + (s->rows - VAR_1 - VAR_11) * 64;", "if (s->pass < 2) {", "b->VAR_8 = VAR_8;", "b->VAR_6 = VAR_6;", "b->VAR_7 = VAR_7;", "decode_mode(VAR_0);", "b->uvtx = b->tx - ((s->ss_h && VAR_10 * 2 == (1 << b->tx)) ||\n(s->ss_v && VAR_11 * 2 == (1 << b->tx)));", "if (!b->skip) {", "int VAR_14;", "if (VAR_9 == 1) {", "VAR_14 = decode_coeffs_8bpp(VAR_0);", "} else {", "VAR_14 = decode_coeffs_16bpp(VAR_0);", "}", "if (!VAR_14 && b->VAR_8 <= BS_8x8 && !b->intra) {", "b->skip = 1;", "memset(&s->above_skip_ctx[VAR_2], 1, VAR_10);", "memset(&s->left_skip_ctx[s->VAR_25], 1, VAR_11);", "}", "} else {", "int VAR_25 = s->VAR_25;", "#define SPLAT_ZERO_CTX(v, VAR_21) \\\nswitch (VAR_21) { \\", "case 1: v = 0; break; \\", "case 2: AV_ZERO16(&v); break; \\", "case 4: AV_ZERO32(&v); break; \\", "case 8: AV_ZERO64(&v); break; \\", "case 16: AV_ZERO128(&v); break; \\", "}", "#define SPLAT_ZERO_YUV(dir, var, off, VAR_21, dir2) \\\ndo { \\", "SPLAT_ZERO_CTX(s->dir##_y_##var[off * 2], VAR_21 * 2); \\", "if (s->ss_##dir2) { \\", "SPLAT_ZERO_CTX(s->dir##_uv_##var[0][off], VAR_21); \\", "SPLAT_ZERO_CTX(s->dir##_uv_##var[1][off], VAR_21); \\", "} else { \\", "SPLAT_ZERO_CTX(s->dir##_uv_##var[0][off * 2], VAR_21 * 2); \\", "SPLAT_ZERO_CTX(s->dir##_uv_##var[1][off * 2], VAR_21 * 2); \\", "} \\", "} while (0)", "switch (VAR_10) {", "case 1: SPLAT_ZERO_YUV(above, nnz_ctx, VAR_2, 1, VAR_21); break;", "case 2: SPLAT_ZERO_YUV(above, nnz_ctx, VAR_2, 2, VAR_21); break;", "case 4: SPLAT_ZERO_YUV(above, nnz_ctx, VAR_2, 4, VAR_21); break;", "case 8: SPLAT_ZERO_YUV(above, nnz_ctx, VAR_2, 8, VAR_21); break;", "}", "switch (VAR_11) {", "case 1: SPLAT_ZERO_YUV(left, nnz_ctx, VAR_25, 1, v); break;", "case 2: SPLAT_ZERO_YUV(left, nnz_ctx, VAR_25, 2, v); break;", "case 4: SPLAT_ZERO_YUV(left, nnz_ctx, VAR_25, 4, v); break;", "case 8: SPLAT_ZERO_YUV(left, nnz_ctx, VAR_25, 8, v); break;", "}", "}", "if (s->pass == 1) {", "s->b++;", "s->block += VAR_10 * VAR_11 * 64 * VAR_9;", "s->uvblock[0] += VAR_10 * VAR_11 * 64 * VAR_9 >> (s->ss_h + s->ss_v);", "s->uvblock[1] += VAR_10 * VAR_11 * 64 * VAR_9 >> (s->ss_h + s->ss_v);", "s->eob += 4 * VAR_10 * VAR_11;", "s->uveob[0] += 4 * VAR_10 * VAR_11 >> (s->ss_h + s->ss_v);", "s->uveob[1] += 4 * VAR_10 * VAR_11 >> (s->ss_h + s->ss_v);", "return;", "}", "}", "VAR_13[0] = (VAR_2 + VAR_10) * 8 > f->linesize[0] ||\n(VAR_1 + VAR_11) > s->rows;", "VAR_13[1] = (VAR_2 + VAR_10) * 4 > f->linesize[1] ||\n(VAR_1 + VAR_11) > s->rows;", "if (VAR_13[0]) {", "s->dst[0] = s->tmp_y;", "s->y_stride = 128;", "} else {", "s->dst[0] = f->data[0] + VAR_4;", "s->y_stride = f->linesize[0];", "}", "if (VAR_13[1]) {", "s->dst[1] = s->tmp_uv[0];", "s->dst[2] = s->tmp_uv[1];", "s->uv_stride = 128;", "} else {", "s->dst[1] = f->data[1] + VAR_5;", "s->dst[2] = f->data[2] + VAR_5;", "s->uv_stride = f->linesize[1];", "}", "if (b->intra) {", "if (s->bpp > 8) {", "intra_recon_16bpp(VAR_0, VAR_4, VAR_5);", "} else {", "intra_recon_8bpp(VAR_0, VAR_4, VAR_5);", "}", "} else {", "if (s->bpp > 8) {", "inter_recon_16bpp(VAR_0);", "} else {", "inter_recon_8bpp(VAR_0);", "}", "}", "if (VAR_13[0]) {", "int VAR_21 = FFMIN(s->cols - VAR_2, VAR_10) * 8, VAR_21 = FFMIN(s->rows - VAR_1, VAR_11) * 8, VAR_21, VAR_21 = 0;", "for (VAR_21 = 0; VAR_21 < VAR_21; VAR_21++) {", "int VAR_21 = 64 >> VAR_21;", "av_assert2(VAR_21 <= 4);", "if (VAR_21 & VAR_21) {", "s->dsp.mc[VAR_21][0][0][0][0](f->data[0] + VAR_4 + VAR_21 * VAR_9, f->linesize[0],\ns->tmp_y + VAR_21 * VAR_9, 128, VAR_21, 0, 0);", "VAR_21 += VAR_21;", "}", "}", "}", "if (VAR_13[1]) {", "int VAR_21 = FFMIN(s->cols - VAR_2, VAR_10) * 8 >> s->ss_h;", "int VAR_21 = FFMIN(s->rows - VAR_1, VAR_11) * 8 >> s->ss_v, VAR_21, VAR_21 = 0;", "for (VAR_21 = s->ss_h; VAR_21 < VAR_21; VAR_21++) {", "int VAR_21 = 64 >> VAR_21;", "av_assert2(VAR_21 <= 4);", "if (VAR_21 & VAR_21) {", "s->dsp.mc[VAR_21][0][0][0][0](f->data[1] + VAR_5 + VAR_21 * VAR_9, f->linesize[1],\ns->tmp_uv[0] + VAR_21 * VAR_9, 128, VAR_21, 0, 0);", "s->dsp.mc[VAR_21][0][0][0][0](f->data[2] + VAR_5 + VAR_21 * VAR_9, f->linesize[2],\ns->tmp_uv[1] + VAR_21 * VAR_9, 128, VAR_21, 0, 0);", "VAR_21 += VAR_21;", "}", "}", "}", "if (s->filter.level &&\n(VAR_12 = s->segmentation.feat[b->seg_id].VAR_3[b->intra ? 0 : b->ref[0] + 1]\n[b->mode[3] != ZEROMV]) > 0) {", "int VAR_21 = FFMIN(s->cols - VAR_2, VAR_10), VAR_22 = FFMIN(s->rows - VAR_1, VAR_11);", "int VAR_23 = !b->intra && b->skip, VAR_24 = s->VAR_24, VAR_25 = s->VAR_25;", "setctx_2d(&VAR_3->level[VAR_25 * 8 + VAR_24], VAR_10, VAR_11, 8, VAR_12);", "mask_edges(VAR_3->mask[0], 0, 0, VAR_25, VAR_24, VAR_21, VAR_22, 0, 0, b->tx, VAR_23);", "if (s->ss_h || s->ss_v)\nmask_edges(VAR_3->mask[1], s->ss_h, s->ss_v, VAR_25, VAR_24, VAR_21, VAR_22,\ns->cols & 1 && VAR_2 + VAR_10 >= s->cols ? s->cols & 7 : 0,\ns->rows & 1 && VAR_1 + VAR_11 >= s->rows ? s->rows & 7 : 0,\nb->uvtx, VAR_23);", "if (!s->filter.lim_lut[VAR_12]) {", "int VAR_25 = s->filter.sharpness;", "int VAR_26 = VAR_12;", "if (VAR_25 > 0) {", "VAR_26 >>= (VAR_25 + 3) >> 2;", "VAR_26 = FFMIN(VAR_26, 9 - VAR_25);", "}", "VAR_26 = FFMAX(VAR_26, 1);", "s->filter.lim_lut[VAR_12] = VAR_26;", "s->filter.mblim_lut[VAR_12] = 2 * (VAR_12 + 2) + VAR_26;", "}", "}", "if (s->pass == 2) {", "s->b++;", "s->block += VAR_10 * VAR_11 * 64 * VAR_9;", "s->uvblock[0] += VAR_10 * VAR_11 * 64 * VAR_9 >> (s->ss_v + s->ss_h);", "s->uvblock[1] += VAR_10 * VAR_11 * 64 * VAR_9 >> (s->ss_v + s->ss_h);", "s->eob += 4 * VAR_10 * VAR_11;", "s->uveob[0] += 4 * VAR_10 * VAR_11 >> (s->ss_v + s->ss_h);", "s->uveob[1] += 4 * VAR_10 * VAR_11 >> (s->ss_v + s->ss_h);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51, 53 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 89, 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105, 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 173 ], [ 175 ], [ 177 ], [ 187, 189 ], [ 191, 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ], [ 225 ], [ 227 ], [ 229 ], [ 231 ], [ 233 ], [ 235 ], [ 237 ], [ 239 ], [ 241 ], [ 243 ], [ 245 ], [ 247 ], [ 249 ], [ 251 ], [ 253 ], [ 255 ], [ 259 ], [ 261 ], [ 265 ], [ 267 ], [ 269, 271 ], [ 273 ], [ 275 ], [ 277 ], [ 279 ], [ 281 ], [ 283 ], [ 285 ], [ 289 ], [ 291 ], [ 295 ], [ 297 ], [ 299, 301 ], [ 303, 305 ], [ 307 ], [ 309 ], [ 311 ], [ 313 ], [ 319, 321, 323 ], [ 325 ], [ 327 ], [ 331 ], [ 333 ], [ 335, 337, 339, 341, 343 ], [ 347 ], [ 349 ], [ 351 ], [ 355 ], [ 357 ], [ 359 ], [ 361 ], [ 363 ], [ 367 ], [ 369 ], [ 371 ], [ 373 ], [ 377 ], [ 379 ], [ 381 ], [ 383 ], [ 385 ], [ 387 ], [ 389 ], [ 391 ], [ 393 ], [ 395 ] ]
11,212
static void unset_dirty_tracking(void) { BlkMigDevState *bmds; QSIMPLEQ_FOREACH(bmds, &block_mig_state.bmds_list, entry) { bdrv_release_dirty_bitmap(bmds->bs, bmds->dirty_bitmap); } }
true
qemu
60fe637bf0e4d7989e21e50f52526444765c63b4
static void unset_dirty_tracking(void) { BlkMigDevState *bmds; QSIMPLEQ_FOREACH(bmds, &block_mig_state.bmds_list, entry) { bdrv_release_dirty_bitmap(bmds->bs, bmds->dirty_bitmap); } }
{ "code": [], "line_no": [] }
static void FUNC_0(void) { BlkMigDevState *bmds; QSIMPLEQ_FOREACH(bmds, &block_mig_state.bmds_list, entry) { bdrv_release_dirty_bitmap(bmds->bs, bmds->dirty_bitmap); } }
[ "static void FUNC_0(void)\n{", "BlkMigDevState *bmds;", "QSIMPLEQ_FOREACH(bmds, &block_mig_state.bmds_list, entry) {", "bdrv_release_dirty_bitmap(bmds->bs, bmds->dirty_bitmap);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ] ]
11,213
static void get_sel_entry(IPMIBmcSim *ibs, uint8_t *cmd, unsigned int cmd_len, uint8_t *rsp, unsigned int *rsp_len, unsigned int max_rsp_len) { unsigned int val; IPMI_CHECK_CMD_LEN(8); if (cmd[6]) { IPMI_CHECK_RESERVATION(2, ibs->sel.reservation); } if (ibs->sel.next_free == 0) { rsp[2] = IPMI_CC_REQ_ENTRY_NOT_PRESENT; return; } if (cmd[6] > 15) { rsp[2] = IPMI_CC_INVALID_DATA_FIELD; return; } if (cmd[7] == 0xff) { cmd[7] = 16; } else if ((cmd[7] + cmd[6]) > 16) { rsp[2] = IPMI_CC_INVALID_DATA_FIELD; return; } else { cmd[7] += cmd[6]; } val = cmd[4] | (cmd[5] << 8); if (val == 0xffff) { val = ibs->sel.next_free - 1; } else if (val >= ibs->sel.next_free) { rsp[2] = IPMI_CC_REQ_ENTRY_NOT_PRESENT; return; } if ((val + 1) == ibs->sel.next_free) { IPMI_ADD_RSP_DATA(0xff); IPMI_ADD_RSP_DATA(0xff); } else { IPMI_ADD_RSP_DATA((val + 1) & 0xff); IPMI_ADD_RSP_DATA(((val + 1) >> 8) & 0xff); } for (; cmd[6] < cmd[7]; cmd[6]++) { IPMI_ADD_RSP_DATA(ibs->sel.sel[val][cmd[6]]); } }
true
qemu
4f298a4b2957b7833bc607c951ca27c458d98d88
static void get_sel_entry(IPMIBmcSim *ibs, uint8_t *cmd, unsigned int cmd_len, uint8_t *rsp, unsigned int *rsp_len, unsigned int max_rsp_len) { unsigned int val; IPMI_CHECK_CMD_LEN(8); if (cmd[6]) { IPMI_CHECK_RESERVATION(2, ibs->sel.reservation); } if (ibs->sel.next_free == 0) { rsp[2] = IPMI_CC_REQ_ENTRY_NOT_PRESENT; return; } if (cmd[6] > 15) { rsp[2] = IPMI_CC_INVALID_DATA_FIELD; return; } if (cmd[7] == 0xff) { cmd[7] = 16; } else if ((cmd[7] + cmd[6]) > 16) { rsp[2] = IPMI_CC_INVALID_DATA_FIELD; return; } else { cmd[7] += cmd[6]; } val = cmd[4] | (cmd[5] << 8); if (val == 0xffff) { val = ibs->sel.next_free - 1; } else if (val >= ibs->sel.next_free) { rsp[2] = IPMI_CC_REQ_ENTRY_NOT_PRESENT; return; } if ((val + 1) == ibs->sel.next_free) { IPMI_ADD_RSP_DATA(0xff); IPMI_ADD_RSP_DATA(0xff); } else { IPMI_ADD_RSP_DATA((val + 1) & 0xff); IPMI_ADD_RSP_DATA(((val + 1) >> 8) & 0xff); } for (; cmd[6] < cmd[7]; cmd[6]++) { IPMI_ADD_RSP_DATA(ibs->sel.sel[val][cmd[6]]); } }
{ "code": [ " IPMI_CHECK_CMD_LEN(8);", " IPMI_CHECK_CMD_LEN(8);", " IPMI_CHECK_CMD_LEN(8);", " IPMI_CHECK_CMD_LEN(8);", " IPMI_CHECK_CMD_LEN(8);" ], "line_no": [ 15, 15, 15, 15, 15 ] }
static void FUNC_0(IPMIBmcSim *VAR_0, uint8_t *VAR_1, unsigned int VAR_2, uint8_t *VAR_3, unsigned int *VAR_4, unsigned int VAR_5) { unsigned int VAR_6; IPMI_CHECK_CMD_LEN(8); if (VAR_1[6]) { IPMI_CHECK_RESERVATION(2, VAR_0->sel.reservation); } if (VAR_0->sel.next_free == 0) { VAR_3[2] = IPMI_CC_REQ_ENTRY_NOT_PRESENT; return; } if (VAR_1[6] > 15) { VAR_3[2] = IPMI_CC_INVALID_DATA_FIELD; return; } if (VAR_1[7] == 0xff) { VAR_1[7] = 16; } else if ((VAR_1[7] + VAR_1[6]) > 16) { VAR_3[2] = IPMI_CC_INVALID_DATA_FIELD; return; } else { VAR_1[7] += VAR_1[6]; } VAR_6 = VAR_1[4] | (VAR_1[5] << 8); if (VAR_6 == 0xffff) { VAR_6 = VAR_0->sel.next_free - 1; } else if (VAR_6 >= VAR_0->sel.next_free) { VAR_3[2] = IPMI_CC_REQ_ENTRY_NOT_PRESENT; return; } if ((VAR_6 + 1) == VAR_0->sel.next_free) { IPMI_ADD_RSP_DATA(0xff); IPMI_ADD_RSP_DATA(0xff); } else { IPMI_ADD_RSP_DATA((VAR_6 + 1) & 0xff); IPMI_ADD_RSP_DATA(((VAR_6 + 1) >> 8) & 0xff); } for (; VAR_1[6] < VAR_1[7]; VAR_1[6]++) { IPMI_ADD_RSP_DATA(VAR_0->sel.sel[VAR_6][VAR_1[6]]); } }
[ "static void FUNC_0(IPMIBmcSim *VAR_0,\nuint8_t *VAR_1, unsigned int VAR_2,\nuint8_t *VAR_3, unsigned int *VAR_4,\nunsigned int VAR_5)\n{", "unsigned int VAR_6;", "IPMI_CHECK_CMD_LEN(8);", "if (VAR_1[6]) {", "IPMI_CHECK_RESERVATION(2, VAR_0->sel.reservation);", "}", "if (VAR_0->sel.next_free == 0) {", "VAR_3[2] = IPMI_CC_REQ_ENTRY_NOT_PRESENT;", "return;", "}", "if (VAR_1[6] > 15) {", "VAR_3[2] = IPMI_CC_INVALID_DATA_FIELD;", "return;", "}", "if (VAR_1[7] == 0xff) {", "VAR_1[7] = 16;", "} else if ((VAR_1[7] + VAR_1[6]) > 16) {", "VAR_3[2] = IPMI_CC_INVALID_DATA_FIELD;", "return;", "} else {", "VAR_1[7] += VAR_1[6];", "}", "VAR_6 = VAR_1[4] | (VAR_1[5] << 8);", "if (VAR_6 == 0xffff) {", "VAR_6 = VAR_0->sel.next_free - 1;", "} else if (VAR_6 >= VAR_0->sel.next_free) {", "VAR_3[2] = IPMI_CC_REQ_ENTRY_NOT_PRESENT;", "return;", "}", "if ((VAR_6 + 1) == VAR_0->sel.next_free) {", "IPMI_ADD_RSP_DATA(0xff);", "IPMI_ADD_RSP_DATA(0xff);", "} else {", "IPMI_ADD_RSP_DATA((VAR_6 + 1) & 0xff);", "IPMI_ADD_RSP_DATA(((VAR_6 + 1) >> 8) & 0xff);", "}", "for (; VAR_1[6] < VAR_1[7]; VAR_1[6]++) {", "IPMI_ADD_RSP_DATA(VAR_0->sel.sel[VAR_6][VAR_1[6]]);", "}", "}" ]
[ 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ] ]
11,214
int inet_dgram_opts(QemuOpts *opts, Error **errp) { struct addrinfo ai, *peer = NULL, *local = NULL; const char *addr; const char *port; int sock = -1, rc; /* lookup peer addr */ memset(&ai,0, sizeof(ai)); ai.ai_flags = AI_CANONNAME | AI_ADDRCONFIG; ai.ai_family = PF_UNSPEC; ai.ai_socktype = SOCK_DGRAM; addr = qemu_opt_get(opts, "host"); port = qemu_opt_get(opts, "port"); if (addr == NULL || strlen(addr) == 0) { addr = "localhost"; } if (port == NULL || strlen(port) == 0) { error_setg(errp, "remote port not specified"); return -1; } if (qemu_opt_get_bool(opts, "ipv4", 0)) ai.ai_family = PF_INET; if (qemu_opt_get_bool(opts, "ipv6", 0)) ai.ai_family = PF_INET6; if (0 != (rc = getaddrinfo(addr, port, &ai, &peer))) { error_setg(errp, "address resolution failed for %s:%s: %s", addr, port, gai_strerror(rc)); return -1; } /* lookup local addr */ memset(&ai,0, sizeof(ai)); ai.ai_flags = AI_PASSIVE; ai.ai_family = peer->ai_family; ai.ai_socktype = SOCK_DGRAM; addr = qemu_opt_get(opts, "localaddr"); port = qemu_opt_get(opts, "localport"); if (addr == NULL || strlen(addr) == 0) { addr = NULL; } if (!port || strlen(port) == 0) port = "0"; if (0 != (rc = getaddrinfo(addr, port, &ai, &local))) { error_setg(errp, "address resolution failed for %s:%s: %s", addr, port, gai_strerror(rc)); goto err; } /* create socket */ sock = qemu_socket(peer->ai_family, peer->ai_socktype, peer->ai_protocol); if (sock < 0) { error_setg_errno(errp, errno, "Failed to create socket"); goto err; } socket_set_fast_reuse(sock); /* bind socket */ if (bind(sock, local->ai_addr, local->ai_addrlen) < 0) { error_setg_errno(errp, errno, "Failed to bind socket"); goto err; } /* connect to peer */ if (connect(sock,peer->ai_addr,peer->ai_addrlen) < 0) { error_setg_errno(errp, errno, "Failed to connect socket"); goto err; } freeaddrinfo(local); freeaddrinfo(peer); return sock; err: if (-1 != sock) closesocket(sock); if (local) freeaddrinfo(local); if (peer) freeaddrinfo(peer); return -1; }
true
qemu
3de3d698d942d1116152417f882c897b26b44e41
int inet_dgram_opts(QemuOpts *opts, Error **errp) { struct addrinfo ai, *peer = NULL, *local = NULL; const char *addr; const char *port; int sock = -1, rc; memset(&ai,0, sizeof(ai)); ai.ai_flags = AI_CANONNAME | AI_ADDRCONFIG; ai.ai_family = PF_UNSPEC; ai.ai_socktype = SOCK_DGRAM; addr = qemu_opt_get(opts, "host"); port = qemu_opt_get(opts, "port"); if (addr == NULL || strlen(addr) == 0) { addr = "localhost"; } if (port == NULL || strlen(port) == 0) { error_setg(errp, "remote port not specified"); return -1; } if (qemu_opt_get_bool(opts, "ipv4", 0)) ai.ai_family = PF_INET; if (qemu_opt_get_bool(opts, "ipv6", 0)) ai.ai_family = PF_INET6; if (0 != (rc = getaddrinfo(addr, port, &ai, &peer))) { error_setg(errp, "address resolution failed for %s:%s: %s", addr, port, gai_strerror(rc)); return -1; } memset(&ai,0, sizeof(ai)); ai.ai_flags = AI_PASSIVE; ai.ai_family = peer->ai_family; ai.ai_socktype = SOCK_DGRAM; addr = qemu_opt_get(opts, "localaddr"); port = qemu_opt_get(opts, "localport"); if (addr == NULL || strlen(addr) == 0) { addr = NULL; } if (!port || strlen(port) == 0) port = "0"; if (0 != (rc = getaddrinfo(addr, port, &ai, &local))) { error_setg(errp, "address resolution failed for %s:%s: %s", addr, port, gai_strerror(rc)); goto err; } sock = qemu_socket(peer->ai_family, peer->ai_socktype, peer->ai_protocol); if (sock < 0) { error_setg_errno(errp, errno, "Failed to create socket"); goto err; } socket_set_fast_reuse(sock); if (bind(sock, local->ai_addr, local->ai_addrlen) < 0) { error_setg_errno(errp, errno, "Failed to bind socket"); goto err; } if (connect(sock,peer->ai_addr,peer->ai_addrlen) < 0) { error_setg_errno(errp, errno, "Failed to connect socket"); goto err; } freeaddrinfo(local); freeaddrinfo(peer); return sock; err: if (-1 != sock) closesocket(sock); if (local) freeaddrinfo(local); if (peer) freeaddrinfo(peer); return -1; }
{ "code": [ " ai.ai_flags = AI_CANONNAME | AI_ADDRCONFIG;", " ai.ai_flags = AI_CANONNAME | AI_ADDRCONFIG;" ], "line_no": [ 19, 19 ] }
int FUNC_0(QemuOpts *VAR_0, Error **VAR_1) { struct addrinfo VAR_2, *VAR_3 = NULL, *VAR_4 = NULL; const char *VAR_5; const char *VAR_6; int VAR_7 = -1, VAR_8; memset(&VAR_2,0, sizeof(VAR_2)); VAR_2.ai_flags = AI_CANONNAME | AI_ADDRCONFIG; VAR_2.ai_family = PF_UNSPEC; VAR_2.ai_socktype = SOCK_DGRAM; VAR_5 = qemu_opt_get(VAR_0, "host"); VAR_6 = qemu_opt_get(VAR_0, "VAR_6"); if (VAR_5 == NULL || strlen(VAR_5) == 0) { VAR_5 = "localhost"; } if (VAR_6 == NULL || strlen(VAR_6) == 0) { error_setg(VAR_1, "remote VAR_6 not specified"); return -1; } if (qemu_opt_get_bool(VAR_0, "ipv4", 0)) VAR_2.ai_family = PF_INET; if (qemu_opt_get_bool(VAR_0, "ipv6", 0)) VAR_2.ai_family = PF_INET6; if (0 != (VAR_8 = getaddrinfo(VAR_5, VAR_6, &VAR_2, &VAR_3))) { error_setg(VAR_1, "address resolution failed for %s:%s: %s", VAR_5, VAR_6, gai_strerror(VAR_8)); return -1; } memset(&VAR_2,0, sizeof(VAR_2)); VAR_2.ai_flags = AI_PASSIVE; VAR_2.ai_family = VAR_3->ai_family; VAR_2.ai_socktype = SOCK_DGRAM; VAR_5 = qemu_opt_get(VAR_0, "localaddr"); VAR_6 = qemu_opt_get(VAR_0, "localport"); if (VAR_5 == NULL || strlen(VAR_5) == 0) { VAR_5 = NULL; } if (!VAR_6 || strlen(VAR_6) == 0) VAR_6 = "0"; if (0 != (VAR_8 = getaddrinfo(VAR_5, VAR_6, &VAR_2, &VAR_4))) { error_setg(VAR_1, "address resolution failed for %s:%s: %s", VAR_5, VAR_6, gai_strerror(VAR_8)); goto err; } VAR_7 = qemu_socket(VAR_3->ai_family, VAR_3->ai_socktype, VAR_3->ai_protocol); if (VAR_7 < 0) { error_setg_errno(VAR_1, errno, "Failed to create socket"); goto err; } socket_set_fast_reuse(VAR_7); if (bind(VAR_7, VAR_4->ai_addr, VAR_4->ai_addrlen) < 0) { error_setg_errno(VAR_1, errno, "Failed to bind socket"); goto err; } if (connect(VAR_7,VAR_3->ai_addr,VAR_3->ai_addrlen) < 0) { error_setg_errno(VAR_1, errno, "Failed to connect socket"); goto err; } freeaddrinfo(VAR_4); freeaddrinfo(VAR_3); return VAR_7; err: if (-1 != VAR_7) closesocket(VAR_7); if (VAR_4) freeaddrinfo(VAR_4); if (VAR_3) freeaddrinfo(VAR_3); return -1; }
[ "int FUNC_0(QemuOpts *VAR_0, Error **VAR_1)\n{", "struct addrinfo VAR_2, *VAR_3 = NULL, *VAR_4 = NULL;", "const char *VAR_5;", "const char *VAR_6;", "int VAR_7 = -1, VAR_8;", "memset(&VAR_2,0, sizeof(VAR_2));", "VAR_2.ai_flags = AI_CANONNAME | AI_ADDRCONFIG;", "VAR_2.ai_family = PF_UNSPEC;", "VAR_2.ai_socktype = SOCK_DGRAM;", "VAR_5 = qemu_opt_get(VAR_0, \"host\");", "VAR_6 = qemu_opt_get(VAR_0, \"VAR_6\");", "if (VAR_5 == NULL || strlen(VAR_5) == 0) {", "VAR_5 = \"localhost\";", "}", "if (VAR_6 == NULL || strlen(VAR_6) == 0) {", "error_setg(VAR_1, \"remote VAR_6 not specified\");", "return -1;", "}", "if (qemu_opt_get_bool(VAR_0, \"ipv4\", 0))\nVAR_2.ai_family = PF_INET;", "if (qemu_opt_get_bool(VAR_0, \"ipv6\", 0))\nVAR_2.ai_family = PF_INET6;", "if (0 != (VAR_8 = getaddrinfo(VAR_5, VAR_6, &VAR_2, &VAR_3))) {", "error_setg(VAR_1, \"address resolution failed for %s:%s: %s\", VAR_5, VAR_6,\ngai_strerror(VAR_8));", "return -1;", "}", "memset(&VAR_2,0, sizeof(VAR_2));", "VAR_2.ai_flags = AI_PASSIVE;", "VAR_2.ai_family = VAR_3->ai_family;", "VAR_2.ai_socktype = SOCK_DGRAM;", "VAR_5 = qemu_opt_get(VAR_0, \"localaddr\");", "VAR_6 = qemu_opt_get(VAR_0, \"localport\");", "if (VAR_5 == NULL || strlen(VAR_5) == 0) {", "VAR_5 = NULL;", "}", "if (!VAR_6 || strlen(VAR_6) == 0)\nVAR_6 = \"0\";", "if (0 != (VAR_8 = getaddrinfo(VAR_5, VAR_6, &VAR_2, &VAR_4))) {", "error_setg(VAR_1, \"address resolution failed for %s:%s: %s\", VAR_5, VAR_6,\ngai_strerror(VAR_8));", "goto err;", "}", "VAR_7 = qemu_socket(VAR_3->ai_family, VAR_3->ai_socktype, VAR_3->ai_protocol);", "if (VAR_7 < 0) {", "error_setg_errno(VAR_1, errno, \"Failed to create socket\");", "goto err;", "}", "socket_set_fast_reuse(VAR_7);", "if (bind(VAR_7, VAR_4->ai_addr, VAR_4->ai_addrlen) < 0) {", "error_setg_errno(VAR_1, errno, \"Failed to bind socket\");", "goto err;", "}", "if (connect(VAR_7,VAR_3->ai_addr,VAR_3->ai_addrlen) < 0) {", "error_setg_errno(VAR_1, errno, \"Failed to connect socket\");", "goto err;", "}", "freeaddrinfo(VAR_4);", "freeaddrinfo(VAR_3);", "return VAR_7;", "err:\nif (-1 != VAR_7)\nclosesocket(VAR_7);", "if (VAR_4)\nfreeaddrinfo(VAR_4);", "if (VAR_3)\nfreeaddrinfo(VAR_3);", "return -1;", "}" ]
[ 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47, 49 ], [ 51, 53 ], [ 57 ], [ 59, 61 ], [ 63 ], [ 65 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91, 93 ], [ 97 ], [ 99, 101 ], [ 103 ], [ 105 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 149 ], [ 151 ], [ 153 ], [ 157, 159, 161 ], [ 163, 165 ], [ 167, 169 ], [ 171 ], [ 173 ] ]
11,215
e1000e_io_write(void *opaque, hwaddr addr, uint64_t val, unsigned size) { E1000EState *s = opaque; uint32_t idx; switch (addr) { case E1000_IOADDR: trace_e1000e_io_write_addr(val); s->ioaddr = (uint32_t) val; return; case E1000_IODATA: if (e1000e_io_get_reg_index(s, &idx)) { trace_e1000e_io_write_data(idx, val); e1000e_core_write(&s->core, idx, val, sizeof(val)); } return; default: trace_e1000e_wrn_io_write_unknown(addr); return; } }
true
qemu
de5dca1b792ada25c29a95c8f84e01f4300aef9c
e1000e_io_write(void *opaque, hwaddr addr, uint64_t val, unsigned size) { E1000EState *s = opaque; uint32_t idx; switch (addr) { case E1000_IOADDR: trace_e1000e_io_write_addr(val); s->ioaddr = (uint32_t) val; return; case E1000_IODATA: if (e1000e_io_get_reg_index(s, &idx)) { trace_e1000e_io_write_data(idx, val); e1000e_core_write(&s->core, idx, val, sizeof(val)); } return; default: trace_e1000e_wrn_io_write_unknown(addr); return; } }
{ "code": [ " uint32_t idx;", " uint32_t idx;" ], "line_no": [ 9, 9 ] }
FUNC_0(void *VAR_0, hwaddr VAR_1, uint64_t VAR_2, unsigned VAR_3) { E1000EState *s = VAR_0; uint32_t idx; switch (VAR_1) { case E1000_IOADDR: trace_e1000e_io_write_addr(VAR_2); s->ioaddr = (uint32_t) VAR_2; return; case E1000_IODATA: if (e1000e_io_get_reg_index(s, &idx)) { trace_e1000e_io_write_data(idx, VAR_2); e1000e_core_write(&s->core, idx, VAR_2, sizeof(VAR_2)); } return; default: trace_e1000e_wrn_io_write_unknown(VAR_1); return; } }
[ "FUNC_0(void *VAR_0, hwaddr VAR_1,\nuint64_t VAR_2, unsigned VAR_3)\n{", "E1000EState *s = VAR_0;", "uint32_t idx;", "switch (VAR_1) {", "case E1000_IOADDR:\ntrace_e1000e_io_write_addr(VAR_2);", "s->ioaddr = (uint32_t) VAR_2;", "return;", "case E1000_IODATA:\nif (e1000e_io_get_reg_index(s, &idx)) {", "trace_e1000e_io_write_data(idx, VAR_2);", "e1000e_core_write(&s->core, idx, VAR_2, sizeof(VAR_2));", "}", "return;", "default:\ntrace_e1000e_wrn_io_write_unknown(VAR_1);", "return;", "}", "}" ]
[ 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15, 17 ], [ 19 ], [ 21 ], [ 23, 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35, 37 ], [ 39 ], [ 41 ], [ 43 ] ]
11,216
static int find_partition(BlockDriverState *bs, int partition, off_t *offset, off_t *size) { struct partition_record mbr[4]; uint8_t data[512]; int i; int ext_partnum = 4; if (bdrv_read(bs, 0, data, 1)) errx(EINVAL, "error while reading"); if (data[510] != 0x55 || data[511] != 0xaa) { errno = -EINVAL; return -1; } for (i = 0; i < 4; i++) { read_partition(&data[446 + 16 * i], &mbr[i]); if (!mbr[i].nb_sectors_abs) continue; if (mbr[i].system == 0xF || mbr[i].system == 0x5) { struct partition_record ext[4]; uint8_t data1[512]; int j; if (bdrv_read(bs, mbr[i].start_sector_abs, data1, 1)) errx(EINVAL, "error while reading"); for (j = 0; j < 4; j++) { read_partition(&data1[446 + 16 * j], &ext[j]); if (!ext[j].nb_sectors_abs) continue; if ((ext_partnum + j + 1) == partition) { *offset = (uint64_t)ext[j].start_sector_abs << 9; *size = (uint64_t)ext[j].nb_sectors_abs << 9; return 0; } } ext_partnum += 4; } else if ((i + 1) == partition) { *offset = (uint64_t)mbr[i].start_sector_abs << 9; *size = (uint64_t)mbr[i].nb_sectors_abs << 9; return 0; } } errno = -ENOENT; return -1; }
true
qemu
b6353bea572f8cc0f35fb7dc438ce74c08dda9e7
static int find_partition(BlockDriverState *bs, int partition, off_t *offset, off_t *size) { struct partition_record mbr[4]; uint8_t data[512]; int i; int ext_partnum = 4; if (bdrv_read(bs, 0, data, 1)) errx(EINVAL, "error while reading"); if (data[510] != 0x55 || data[511] != 0xaa) { errno = -EINVAL; return -1; } for (i = 0; i < 4; i++) { read_partition(&data[446 + 16 * i], &mbr[i]); if (!mbr[i].nb_sectors_abs) continue; if (mbr[i].system == 0xF || mbr[i].system == 0x5) { struct partition_record ext[4]; uint8_t data1[512]; int j; if (bdrv_read(bs, mbr[i].start_sector_abs, data1, 1)) errx(EINVAL, "error while reading"); for (j = 0; j < 4; j++) { read_partition(&data1[446 + 16 * j], &ext[j]); if (!ext[j].nb_sectors_abs) continue; if ((ext_partnum + j + 1) == partition) { *offset = (uint64_t)ext[j].start_sector_abs << 9; *size = (uint64_t)ext[j].nb_sectors_abs << 9; return 0; } } ext_partnum += 4; } else if ((i + 1) == partition) { *offset = (uint64_t)mbr[i].start_sector_abs << 9; *size = (uint64_t)mbr[i].nb_sectors_abs << 9; return 0; } } errno = -ENOENT; return -1; }
{ "code": [ " errx(EINVAL, \"error while reading\");", " errx(EINVAL, \"error while reading\");" ], "line_no": [ 19, 57 ] }
static int FUNC_0(BlockDriverState *VAR_0, int VAR_1, off_t *VAR_2, off_t *VAR_3) { struct partition_record VAR_4[4]; uint8_t data[512]; int VAR_5; int VAR_6 = 4; if (bdrv_read(VAR_0, 0, data, 1)) errx(EINVAL, "error while reading"); if (data[510] != 0x55 || data[511] != 0xaa) { errno = -EINVAL; return -1; } for (VAR_5 = 0; VAR_5 < 4; VAR_5++) { read_partition(&data[446 + 16 * VAR_5], &VAR_4[VAR_5]); if (!VAR_4[VAR_5].nb_sectors_abs) continue; if (VAR_4[VAR_5].system == 0xF || VAR_4[VAR_5].system == 0x5) { struct partition_record VAR_7[4]; uint8_t data1[512]; int VAR_8; if (bdrv_read(VAR_0, VAR_4[VAR_5].start_sector_abs, data1, 1)) errx(EINVAL, "error while reading"); for (VAR_8 = 0; VAR_8 < 4; VAR_8++) { read_partition(&data1[446 + 16 * VAR_8], &VAR_7[VAR_8]); if (!VAR_7[VAR_8].nb_sectors_abs) continue; if ((VAR_6 + VAR_8 + 1) == VAR_1) { *VAR_2 = (uint64_t)VAR_7[VAR_8].start_sector_abs << 9; *VAR_3 = (uint64_t)VAR_7[VAR_8].nb_sectors_abs << 9; return 0; } } VAR_6 += 4; } else if ((VAR_5 + 1) == VAR_1) { *VAR_2 = (uint64_t)VAR_4[VAR_5].start_sector_abs << 9; *VAR_3 = (uint64_t)VAR_4[VAR_5].nb_sectors_abs << 9; return 0; } } errno = -ENOENT; return -1; }
[ "static int FUNC_0(BlockDriverState *VAR_0, int VAR_1,\noff_t *VAR_2, off_t *VAR_3)\n{", "struct partition_record VAR_4[4];", "uint8_t data[512];", "int VAR_5;", "int VAR_6 = 4;", "if (bdrv_read(VAR_0, 0, data, 1))\nerrx(EINVAL, \"error while reading\");", "if (data[510] != 0x55 || data[511] != 0xaa) {", "errno = -EINVAL;", "return -1;", "}", "for (VAR_5 = 0; VAR_5 < 4; VAR_5++) {", "read_partition(&data[446 + 16 * VAR_5], &VAR_4[VAR_5]);", "if (!VAR_4[VAR_5].nb_sectors_abs)\ncontinue;", "if (VAR_4[VAR_5].system == 0xF || VAR_4[VAR_5].system == 0x5) {", "struct partition_record VAR_7[4];", "uint8_t data1[512];", "int VAR_8;", "if (bdrv_read(VAR_0, VAR_4[VAR_5].start_sector_abs, data1, 1))\nerrx(EINVAL, \"error while reading\");", "for (VAR_8 = 0; VAR_8 < 4; VAR_8++) {", "read_partition(&data1[446 + 16 * VAR_8], &VAR_7[VAR_8]);", "if (!VAR_7[VAR_8].nb_sectors_abs)\ncontinue;", "if ((VAR_6 + VAR_8 + 1) == VAR_1) {", "*VAR_2 = (uint64_t)VAR_7[VAR_8].start_sector_abs << 9;", "*VAR_3 = (uint64_t)VAR_7[VAR_8].nb_sectors_abs << 9;", "return 0;", "}", "}", "VAR_6 += 4;", "} else if ((VAR_5 + 1) == VAR_1) {", "*VAR_2 = (uint64_t)VAR_4[VAR_5].start_sector_abs << 9;", "*VAR_3 = (uint64_t)VAR_4[VAR_5].nb_sectors_abs << 9;", "return 0;", "}", "}", "errno = -ENOENT;", "return -1;", "}" ]
[ 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17, 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 39, 41 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 55, 57 ], [ 61 ], [ 63 ], [ 65, 67 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 99 ], [ 101 ], [ 103 ] ]
11,217
int register_savevm_live(DeviceState *dev, const char *idstr, int instance_id, int version_id, SaveVMHandlers *ops, void *opaque) { SaveStateEntry *se; se = g_malloc0(sizeof(SaveStateEntry)); se->version_id = version_id; se->section_id = savevm_state.global_section_id++; se->ops = ops; se->opaque = opaque; se->vmsd = NULL; /* if this is a live_savem then set is_ram */ if (ops->save_live_setup != NULL) { se->is_ram = 1; } if (dev) { char *id = qdev_get_dev_path(dev); if (id) { pstrcpy(se->idstr, sizeof(se->idstr), id); pstrcat(se->idstr, sizeof(se->idstr), "/"); g_free(id); se->compat = g_malloc0(sizeof(CompatEntry)); pstrcpy(se->compat->idstr, sizeof(se->compat->idstr), idstr); se->compat->instance_id = instance_id == -1 ? calculate_compat_instance_id(idstr) : instance_id; instance_id = -1; } } pstrcat(se->idstr, sizeof(se->idstr), idstr); if (instance_id == -1) { se->instance_id = calculate_new_instance_id(se->idstr); } else { se->instance_id = instance_id; } assert(!se->compat || se->instance_id == 0); /* add at the end of list */ QTAILQ_INSERT_TAIL(&savevm_state.handlers, se, entry); return 0; }
true
qemu
97f3ad35517e0d02c0149637d1bb10713c52b057
int register_savevm_live(DeviceState *dev, const char *idstr, int instance_id, int version_id, SaveVMHandlers *ops, void *opaque) { SaveStateEntry *se; se = g_malloc0(sizeof(SaveStateEntry)); se->version_id = version_id; se->section_id = savevm_state.global_section_id++; se->ops = ops; se->opaque = opaque; se->vmsd = NULL; if (ops->save_live_setup != NULL) { se->is_ram = 1; } if (dev) { char *id = qdev_get_dev_path(dev); if (id) { pstrcpy(se->idstr, sizeof(se->idstr), id); pstrcat(se->idstr, sizeof(se->idstr), "/"); g_free(id); se->compat = g_malloc0(sizeof(CompatEntry)); pstrcpy(se->compat->idstr, sizeof(se->compat->idstr), idstr); se->compat->instance_id = instance_id == -1 ? calculate_compat_instance_id(idstr) : instance_id; instance_id = -1; } } pstrcat(se->idstr, sizeof(se->idstr), idstr); if (instance_id == -1) { se->instance_id = calculate_new_instance_id(se->idstr); } else { se->instance_id = instance_id; } assert(!se->compat || se->instance_id == 0); QTAILQ_INSERT_TAIL(&savevm_state.handlers, se, entry); return 0; }
{ "code": [ " se = g_malloc0(sizeof(SaveStateEntry));", " se->compat = g_malloc0(sizeof(CompatEntry));", " se = g_malloc0(sizeof(SaveStateEntry));", " se->compat = g_malloc0(sizeof(CompatEntry));" ], "line_no": [ 19, 55, 19, 55 ] }
int FUNC_0(DeviceState *VAR_0, const char *VAR_1, int VAR_2, int VAR_3, SaveVMHandlers *VAR_4, void *VAR_5) { SaveStateEntry *se; se = g_malloc0(sizeof(SaveStateEntry)); se->VAR_3 = VAR_3; se->section_id = savevm_state.global_section_id++; se->VAR_4 = VAR_4; se->VAR_5 = VAR_5; se->vmsd = NULL; if (VAR_4->save_live_setup != NULL) { se->is_ram = 1; } if (VAR_0) { char *VAR_6 = qdev_get_dev_path(VAR_0); if (VAR_6) { pstrcpy(se->VAR_1, sizeof(se->VAR_1), VAR_6); pstrcat(se->VAR_1, sizeof(se->VAR_1), "/"); g_free(VAR_6); se->compat = g_malloc0(sizeof(CompatEntry)); pstrcpy(se->compat->VAR_1, sizeof(se->compat->VAR_1), VAR_1); se->compat->VAR_2 = VAR_2 == -1 ? calculate_compat_instance_id(VAR_1) : VAR_2; VAR_2 = -1; } } pstrcat(se->VAR_1, sizeof(se->VAR_1), VAR_1); if (VAR_2 == -1) { se->VAR_2 = calculate_new_instance_id(se->VAR_1); } else { se->VAR_2 = VAR_2; } assert(!se->compat || se->VAR_2 == 0); QTAILQ_INSERT_TAIL(&savevm_state.handlers, se, entry); return 0; }
[ "int FUNC_0(DeviceState *VAR_0,\nconst char *VAR_1,\nint VAR_2,\nint VAR_3,\nSaveVMHandlers *VAR_4,\nvoid *VAR_5)\n{", "SaveStateEntry *se;", "se = g_malloc0(sizeof(SaveStateEntry));", "se->VAR_3 = VAR_3;", "se->section_id = savevm_state.global_section_id++;", "se->VAR_4 = VAR_4;", "se->VAR_5 = VAR_5;", "se->vmsd = NULL;", "if (VAR_4->save_live_setup != NULL) {", "se->is_ram = 1;", "}", "if (VAR_0) {", "char *VAR_6 = qdev_get_dev_path(VAR_0);", "if (VAR_6) {", "pstrcpy(se->VAR_1, sizeof(se->VAR_1), VAR_6);", "pstrcat(se->VAR_1, sizeof(se->VAR_1), \"/\");", "g_free(VAR_6);", "se->compat = g_malloc0(sizeof(CompatEntry));", "pstrcpy(se->compat->VAR_1, sizeof(se->compat->VAR_1), VAR_1);", "se->compat->VAR_2 = VAR_2 == -1 ?\ncalculate_compat_instance_id(VAR_1) : VAR_2;", "VAR_2 = -1;", "}", "}", "pstrcat(se->VAR_1, sizeof(se->VAR_1), VAR_1);", "if (VAR_2 == -1) {", "se->VAR_2 = calculate_new_instance_id(se->VAR_1);", "} else {", "se->VAR_2 = VAR_2;", "}", "assert(!se->compat || se->VAR_2 == 0);", "QTAILQ_INSERT_TAIL(&savevm_state.handlers, se, entry);", "return 0;", "}" ]
[ 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9, 11, 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 55 ], [ 57 ], [ 59, 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 87 ], [ 89 ], [ 91 ] ]
11,218
static int l2_load(BlockDriverState *bs, uint64_t l2_offset, uint64_t **l2_table) { BDRVQcowState *s = bs->opaque; int min_index; int ret; /* seek if the table for the given offset is in the cache */ *l2_table = seek_l2_table(s, l2_offset); if (*l2_table != NULL) { return 0; } /* not found: load a new entry in the least used one */ min_index = l2_cache_new_entry(bs); *l2_table = s->l2_cache + (min_index << s->l2_bits); BLKDBG_EVENT(bs->file, BLKDBG_L2_LOAD); ret = bdrv_pread(bs->file, l2_offset, *l2_table, s->l2_size * sizeof(uint64_t)); if (ret < 0) { return ret; } s->l2_cache_offsets[min_index] = l2_offset; s->l2_cache_counts[min_index] = 1; return 0; }
true
qemu
1c02e2a17104fe7fc11893125864dc0daf1e6d5b
static int l2_load(BlockDriverState *bs, uint64_t l2_offset, uint64_t **l2_table) { BDRVQcowState *s = bs->opaque; int min_index; int ret; *l2_table = seek_l2_table(s, l2_offset); if (*l2_table != NULL) { return 0; } min_index = l2_cache_new_entry(bs); *l2_table = s->l2_cache + (min_index << s->l2_bits); BLKDBG_EVENT(bs->file, BLKDBG_L2_LOAD); ret = bdrv_pread(bs->file, l2_offset, *l2_table, s->l2_size * sizeof(uint64_t)); if (ret < 0) { return ret; } s->l2_cache_offsets[min_index] = l2_offset; s->l2_cache_counts[min_index] = 1; return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(BlockDriverState *VAR_0, uint64_t VAR_1, uint64_t **VAR_2) { BDRVQcowState *s = VAR_0->opaque; int VAR_3; int VAR_4; *VAR_2 = seek_l2_table(s, VAR_1); if (*VAR_2 != NULL) { return 0; } VAR_3 = l2_cache_new_entry(VAR_0); *VAR_2 = s->l2_cache + (VAR_3 << s->l2_bits); BLKDBG_EVENT(VAR_0->file, BLKDBG_L2_LOAD); VAR_4 = bdrv_pread(VAR_0->file, VAR_1, *VAR_2, s->l2_size * sizeof(uint64_t)); if (VAR_4 < 0) { return VAR_4; } s->l2_cache_offsets[VAR_3] = VAR_1; s->l2_cache_counts[VAR_3] = 1; return 0; }
[ "static int FUNC_0(BlockDriverState *VAR_0, uint64_t VAR_1,\nuint64_t **VAR_2)\n{", "BDRVQcowState *s = VAR_0->opaque;", "int VAR_3;", "int VAR_4;", "*VAR_2 = seek_l2_table(s, VAR_1);", "if (*VAR_2 != NULL) {", "return 0;", "}", "VAR_3 = l2_cache_new_entry(VAR_0);", "*VAR_2 = s->l2_cache + (VAR_3 << s->l2_bits);", "BLKDBG_EVENT(VAR_0->file, BLKDBG_L2_LOAD);", "VAR_4 = bdrv_pread(VAR_0->file, VAR_1, *VAR_2,\ns->l2_size * sizeof(uint64_t));", "if (VAR_4 < 0) {", "return VAR_4;", "}", "s->l2_cache_offsets[VAR_3] = VAR_1;", "s->l2_cache_counts[VAR_3] = 1;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 33 ], [ 35 ], [ 39 ], [ 41, 43 ], [ 45 ], [ 48 ], [ 50 ], [ 54 ], [ 56 ], [ 60 ], [ 62 ] ]
11,219
print_operand_value (char *buf, size_t bufsize, int hex, bfd_vma disp) { if (address_mode == mode_64bit) { if (hex) { char tmp[30]; int i; buf[0] = '0'; buf[1] = 'x'; snprintf_vma (tmp, sizeof(tmp), disp); for (i = 0; tmp[i] == '0' && tmp[i + 1]; i++); pstrcpy (buf + 2, bufsize - 2, tmp + i); } else { bfd_signed_vma v = disp; char tmp[30]; int i; if (v < 0) { *(buf++) = '-'; v = -disp; /* Check for possible overflow on 0x8000000000000000. */ if (v < 0) { pstrcpy (buf, bufsize, "9223372036854775808"); return; } } if (!v) { pstrcpy (buf, bufsize, "0"); return; } i = 0; tmp[29] = 0; while (v) { tmp[28 - i] = (v % 10) + '0'; v /= 10; i++; } pstrcpy (buf, bufsize, tmp + 29 - i); } } else { if (hex) snprintf (buf, bufsize, "0x%x", (unsigned int) disp); else snprintf (buf, bufsize, "%d", (int) disp); } }
true
qemu
af18078d8057203b1ed26ac5534d233aabb36886
print_operand_value (char *buf, size_t bufsize, int hex, bfd_vma disp) { if (address_mode == mode_64bit) { if (hex) { char tmp[30]; int i; buf[0] = '0'; buf[1] = 'x'; snprintf_vma (tmp, sizeof(tmp), disp); for (i = 0; tmp[i] == '0' && tmp[i + 1]; i++); pstrcpy (buf + 2, bufsize - 2, tmp + i); } else { bfd_signed_vma v = disp; char tmp[30]; int i; if (v < 0) { *(buf++) = '-'; v = -disp; if (v < 0) { pstrcpy (buf, bufsize, "9223372036854775808"); return; } } if (!v) { pstrcpy (buf, bufsize, "0"); return; } i = 0; tmp[29] = 0; while (v) { tmp[28 - i] = (v % 10) + '0'; v /= 10; i++; } pstrcpy (buf, bufsize, tmp + 29 - i); } } else { if (hex) snprintf (buf, bufsize, "0x%x", (unsigned int) disp); else snprintf (buf, bufsize, "%d", (int) disp); } }
{ "code": [ "\t for (i = 0; tmp[i] == '0' && tmp[i + 1]; i++);" ], "line_no": [ 23 ] }
FUNC_0 (char *VAR_0, size_t VAR_1, int VAR_2, bfd_vma VAR_3) { if (address_mode == mode_64bit) { if (VAR_2) { char VAR_6[30]; int VAR_6; VAR_0[0] = '0'; VAR_0[1] = 'x'; snprintf_vma (VAR_6, sizeof(VAR_6), VAR_3); for (VAR_6 = 0; VAR_6[VAR_6] == '0' && VAR_6[VAR_6 + 1]; VAR_6++); pstrcpy (VAR_0 + 2, VAR_1 - 2, VAR_6 + VAR_6); } else { bfd_signed_vma v = VAR_3; char VAR_6[30]; int VAR_6; if (v < 0) { *(VAR_0++) = '-'; v = -VAR_3; if (v < 0) { pstrcpy (VAR_0, VAR_1, "9223372036854775808"); return; } } if (!v) { pstrcpy (VAR_0, VAR_1, "0"); return; } VAR_6 = 0; VAR_6[29] = 0; while (v) { VAR_6[28 - VAR_6] = (v % 10) + '0'; v /= 10; VAR_6++; } pstrcpy (VAR_0, VAR_1, VAR_6 + 29 - VAR_6); } } else { if (VAR_2) snprintf (VAR_0, VAR_1, "0x%x", (unsigned int) VAR_3); else snprintf (VAR_0, VAR_1, "%d", (int) VAR_3); } }
[ "FUNC_0 (char *VAR_0, size_t VAR_1, int VAR_2, bfd_vma VAR_3)\n{", "if (address_mode == mode_64bit)\n{", "if (VAR_2)\n{", "char VAR_6[30];", "int VAR_6;", "VAR_0[0] = '0';", "VAR_0[1] = 'x';", "snprintf_vma (VAR_6, sizeof(VAR_6), VAR_3);", "for (VAR_6 = 0; VAR_6[VAR_6] == '0' && VAR_6[VAR_6 + 1]; VAR_6++);", "pstrcpy (VAR_0 + 2, VAR_1 - 2, VAR_6 + VAR_6);", "}", "else\n{", "bfd_signed_vma v = VAR_3;", "char VAR_6[30];", "int VAR_6;", "if (v < 0)\n{", "*(VAR_0++) = '-';", "v = -VAR_3;", "if (v < 0)\n{", "pstrcpy (VAR_0, VAR_1, \"9223372036854775808\");", "return;", "}", "}", "if (!v)\n{", "pstrcpy (VAR_0, VAR_1, \"0\");", "return;", "}", "VAR_6 = 0;", "VAR_6[29] = 0;", "while (v)\n{", "VAR_6[28 - VAR_6] = (v % 10) + '0';", "v /= 10;", "VAR_6++;", "}", "pstrcpy (VAR_0, VAR_1, VAR_6 + 29 - VAR_6);", "}", "}", "else\n{", "if (VAR_2)\nsnprintf (VAR_0, VAR_1, \"0x%x\", (unsigned int) VAR_3);", "else\nsnprintf (VAR_0, VAR_1, \"%d\", (int) VAR_3);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5, 7 ], [ 9, 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29, 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39, 41 ], [ 43 ], [ 45 ], [ 49, 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61, 63 ], [ 65 ], [ 67 ], [ 69 ], [ 73 ], [ 75 ], [ 77, 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95, 97 ], [ 99, 101 ], [ 103, 105 ], [ 107 ], [ 109 ] ]
11,220
void OPPROTO op_4xx_tlbsx_check (void) { int tmp; tmp = xer_so; if (T0 != -1) tmp |= 0x02; env->crf[0] = tmp; RETURN(); }
true
qemu
6f2d8978728c48ca46f5c01835438508aace5c64
void OPPROTO op_4xx_tlbsx_check (void) { int tmp; tmp = xer_so; if (T0 != -1) tmp |= 0x02; env->crf[0] = tmp; RETURN(); }
{ "code": [ " if (T0 != -1)" ], "line_no": [ 11 ] }
void VAR_0 op_4xx_tlbsx_check (void) { int tmp; tmp = xer_so; if (T0 != -1) tmp |= 0x02; env->crf[0] = tmp; RETURN(); }
[ "void VAR_0 op_4xx_tlbsx_check (void)\n{", "int tmp;", "tmp = xer_so;", "if (T0 != -1)\ntmp |= 0x02;", "env->crf[0] = tmp;", "RETURN();", "}" ]
[ 0, 0, 0, 1, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11, 13 ], [ 15 ], [ 17 ], [ 19 ] ]
11,221
type_init(boston_register_types) static void gen_firmware(uint32_t *p, hwaddr kernel_entry, hwaddr fdt_addr, bool is_64b) { const uint32_t cm_base = 0x16100000; const uint32_t gic_base = 0x16120000; const uint32_t cpc_base = 0x16200000; /* Move CM GCRs */ if (is_64b) { stl_p(p++, 0x40287803); /* dmfc0 $8, CMGCRBase */ stl_p(p++, 0x00084138); /* dsll $8, $8, 4 */ } else { stl_p(p++, 0x40087803); /* mfc0 $8, CMGCRBase */ stl_p(p++, 0x00084100); /* sll $8, $8, 4 */ } stl_p(p++, 0x3c09a000); /* lui $9, 0xa000 */ stl_p(p++, 0x01094025); /* or $8, $9 */ stl_p(p++, 0x3c0a0000 | (cm_base >> 16)); /* lui $10, cm_base >> 16 */ if (is_64b) { stl_p(p++, 0xfd0a0008); /* sd $10, 0x8($8) */ } else { stl_p(p++, 0xad0a0008); /* sw $10, 0x8($8) */ } stl_p(p++, 0x012a4025); /* or $8, $10 */ /* Move & enable GIC GCRs */ stl_p(p++, 0x3c090000 | (gic_base >> 16)); /* lui $9, gic_base >> 16 */ stl_p(p++, 0x35290001); /* ori $9, 0x1 */ if (is_64b) { stl_p(p++, 0xfd090080); /* sd $9, 0x80($8) */ } else { stl_p(p++, 0xad090080); /* sw $9, 0x80($8) */ } /* Move & enable CPC GCRs */ stl_p(p++, 0x3c090000 | (cpc_base >> 16)); /* lui $9, cpc_base >> 16 */ stl_p(p++, 0x35290001); /* ori $9, 0x1 */ if (is_64b) { stl_p(p++, 0xfd090088); /* sd $9, 0x88($8) */ } else { stl_p(p++, 0xad090088); /* sw $9, 0x88($8) */ } /* * Setup argument registers to follow the UHI boot protocol: * * a0/$4 = -2 * a1/$5 = virtual address of FDT * a2/$6 = 0 * a3/$7 = 0 */ stl_p(p++, 0x2404fffe); /* li $4, -2 */ /* lui $5, hi(fdt_addr) */ stl_p(p++, 0x3c050000 | ((fdt_addr >> 16) & 0xffff)); if (fdt_addr & 0xffff) { /* ori $5, lo(fdt_addr) */ stl_p(p++, 0x34a50000 | (fdt_addr & 0xffff)); } stl_p(p++, 0x34060000); /* li $6, 0 */ stl_p(p++, 0x34070000); /* li $7, 0 */ /* Load kernel entry address & jump to it */ /* lui $25, hi(kernel_entry) */ stl_p(p++, 0x3c190000 | ((kernel_entry >> 16) & 0xffff)); /* ori $25, lo(kernel_entry) */ stl_p(p++, 0x37390000 | (kernel_entry & 0xffff)); stl_p(p++, 0x03200009); /* jr $25 */ }
true
qemu
2d896b454a0e19ec4c1ddbb0e0b65b7e54fcedf3
type_init(boston_register_types) static void gen_firmware(uint32_t *p, hwaddr kernel_entry, hwaddr fdt_addr, bool is_64b) { const uint32_t cm_base = 0x16100000; const uint32_t gic_base = 0x16120000; const uint32_t cpc_base = 0x16200000; if (is_64b) { stl_p(p++, 0x40287803); stl_p(p++, 0x00084138); } else { stl_p(p++, 0x40087803); stl_p(p++, 0x00084100); } stl_p(p++, 0x3c09a000); stl_p(p++, 0x01094025); stl_p(p++, 0x3c0a0000 | (cm_base >> 16)); if (is_64b) { stl_p(p++, 0xfd0a0008); } else { stl_p(p++, 0xad0a0008); } stl_p(p++, 0x012a4025); stl_p(p++, 0x3c090000 | (gic_base >> 16)); stl_p(p++, 0x35290001); if (is_64b) { stl_p(p++, 0xfd090080); } else { stl_p(p++, 0xad090080); } stl_p(p++, 0x3c090000 | (cpc_base >> 16)); stl_p(p++, 0x35290001); if (is_64b) { stl_p(p++, 0xfd090088); } else { stl_p(p++, 0xad090088); } stl_p(p++, 0x2404fffe); stl_p(p++, 0x3c050000 | ((fdt_addr >> 16) & 0xffff)); if (fdt_addr & 0xffff) { stl_p(p++, 0x34a50000 | (fdt_addr & 0xffff)); } stl_p(p++, 0x34060000); stl_p(p++, 0x34070000); stl_p(p++, 0x3c190000 | ((kernel_entry >> 16) & 0xffff)); stl_p(p++, 0x37390000 | (kernel_entry & 0xffff)); stl_p(p++, 0x03200009); }
{ "code": [ "type_init(boston_register_types)", "static void gen_firmware(uint32_t *p, hwaddr kernel_entry, hwaddr fdt_addr,", " bool is_64b)", " const uint32_t cm_base = 0x16100000;", " const uint32_t gic_base = 0x16120000;", " const uint32_t cpc_base = 0x16200000;", " if (is_64b) {", " } else {", " if (is_64b) {", " } else {", " if (is_64b) {", " } else {", " if (is_64b) {", " } else {", " stl_p(p++, 0x3c050000 | ((fdt_addr >> 16) & 0xffff));", " stl_p(p++, 0x34a50000 | (fdt_addr & 0xffff));", " stl_p(p++, 0x3c190000 | ((kernel_entry >> 16) & 0xffff));", " stl_p(p++, 0x37390000 | (kernel_entry & 0xffff));" ], "line_no": [ 1, 5, 7, 11, 13, 15, 21, 27, 21, 27, 21, 27, 21, 27, 111, 115, 129, 133 ] }
FUNC_0(VAR_0) static void gen_firmware(uint32_t *p, hwaddr kernel_entry, hwaddr fdt_addr, bool is_64b) { const uint32_t VAR_1 = 0x16100000; const uint32_t VAR_2 = 0x16120000; const uint32_t VAR_3 = 0x16200000; if (is_64b) { stl_p(p++, 0x40287803); stl_p(p++, 0x00084138); } else { stl_p(p++, 0x40087803); stl_p(p++, 0x00084100); } stl_p(p++, 0x3c09a000); stl_p(p++, 0x01094025); stl_p(p++, 0x3c0a0000 | (VAR_1 >> 16)); if (is_64b) { stl_p(p++, 0xfd0a0008); } else { stl_p(p++, 0xad0a0008); } stl_p(p++, 0x012a4025); stl_p(p++, 0x3c090000 | (VAR_2 >> 16)); stl_p(p++, 0x35290001); if (is_64b) { stl_p(p++, 0xfd090080); } else { stl_p(p++, 0xad090080); } stl_p(p++, 0x3c090000 | (VAR_3 >> 16)); stl_p(p++, 0x35290001); if (is_64b) { stl_p(p++, 0xfd090088); } else { stl_p(p++, 0xad090088); } stl_p(p++, 0x2404fffe); stl_p(p++, 0x3c050000 | ((fdt_addr >> 16) & 0xffff)); if (fdt_addr & 0xffff) { stl_p(p++, 0x34a50000 | (fdt_addr & 0xffff)); } stl_p(p++, 0x34060000); stl_p(p++, 0x34070000); stl_p(p++, 0x3c190000 | ((kernel_entry >> 16) & 0xffff)); stl_p(p++, 0x37390000 | (kernel_entry & 0xffff)); stl_p(p++, 0x03200009); }
[ "FUNC_0(VAR_0)\nstatic void gen_firmware(uint32_t *p, hwaddr kernel_entry, hwaddr fdt_addr,\nbool is_64b)\n{", "const uint32_t VAR_1 = 0x16100000;", "const uint32_t VAR_2 = 0x16120000;", "const uint32_t VAR_3 = 0x16200000;", "if (is_64b) {", "stl_p(p++, 0x40287803);", "stl_p(p++, 0x00084138);", "} else {", "stl_p(p++, 0x40087803);", "stl_p(p++, 0x00084100);", "}", "stl_p(p++, 0x3c09a000);", "stl_p(p++, 0x01094025);", "stl_p(p++, 0x3c0a0000 | (VAR_1 >> 16));", "if (is_64b) {", "stl_p(p++, 0xfd0a0008);", "} else {", "stl_p(p++, 0xad0a0008);", "}", "stl_p(p++, 0x012a4025);", "stl_p(p++, 0x3c090000 | (VAR_2 >> 16));", "stl_p(p++, 0x35290001);", "if (is_64b) {", "stl_p(p++, 0xfd090080);", "} else {", "stl_p(p++, 0xad090080);", "}", "stl_p(p++, 0x3c090000 | (VAR_3 >> 16));", "stl_p(p++, 0x35290001);", "if (is_64b) {", "stl_p(p++, 0xfd090088);", "} else {", "stl_p(p++, 0xad090088);", "}", "stl_p(p++, 0x2404fffe);", "stl_p(p++, 0x3c050000 | ((fdt_addr >> 16) & 0xffff));", "if (fdt_addr & 0xffff) {", "stl_p(p++, 0x34a50000 | (fdt_addr & 0xffff));", "}", "stl_p(p++, 0x34060000);", "stl_p(p++, 0x34070000);", "stl_p(p++, 0x3c190000 | ((kernel_entry >> 16) & 0xffff));", "stl_p(p++, 0x37390000 | (kernel_entry & 0xffff));", "stl_p(p++, 0x03200009);", "}" ]
[ 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 1, 0, 0 ]
[ [ 1, 5, 7, 9 ], [ 11 ], [ 13 ], [ 15 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 107 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 129 ], [ 133 ], [ 135 ], [ 137 ] ]
11,222
Jpeg2000TgtNode *ff_j2k_tag_tree_init(int w, int h) { int pw = w, ph = h; Jpeg2000TgtNode *res, *t, *t2; int32_t tt_size; tt_size = tag_tree_size(w, h); t = res = av_mallocz(tt_size, sizeof(*t)); if (!res) return NULL; while (w > 1 || h > 1) { int i, j; pw = w; ph = h; w = (w + 1) >> 1; h = (h + 1) >> 1; t2 = t + pw * ph; for (i = 0; i < ph; i++) for (j = 0; j < pw; j++) t[i * pw + j].parent = &t2[(i >> 1) * w + (j >> 1)]; t = t2; } t[0].parent = NULL; return res; }
true
FFmpeg
9ea242962c4093a5523deef124a98193bbb36730
Jpeg2000TgtNode *ff_j2k_tag_tree_init(int w, int h) { int pw = w, ph = h; Jpeg2000TgtNode *res, *t, *t2; int32_t tt_size; tt_size = tag_tree_size(w, h); t = res = av_mallocz(tt_size, sizeof(*t)); if (!res) return NULL; while (w > 1 || h > 1) { int i, j; pw = w; ph = h; w = (w + 1) >> 1; h = (h + 1) >> 1; t2 = t + pw * ph; for (i = 0; i < ph; i++) for (j = 0; j < pw; j++) t[i * pw + j].parent = &t2[(i >> 1) * w + (j >> 1)]; t = t2; } t[0].parent = NULL; return res; }
{ "code": [ " t = res = av_mallocz(tt_size, sizeof(*t));" ], "line_no": [ 17 ] }
Jpeg2000TgtNode *FUNC_0(int w, int h) { int VAR_0 = w, VAR_1 = h; Jpeg2000TgtNode *res, *t, *t2; int32_t tt_size; tt_size = tag_tree_size(w, h); t = res = av_mallocz(tt_size, sizeof(*t)); if (!res) return NULL; while (w > 1 || h > 1) { int VAR_2, VAR_3; VAR_0 = w; VAR_1 = h; w = (w + 1) >> 1; h = (h + 1) >> 1; t2 = t + VAR_0 * VAR_1; for (VAR_2 = 0; VAR_2 < VAR_1; VAR_2++) for (VAR_3 = 0; VAR_3 < VAR_0; VAR_3++) t[VAR_2 * VAR_0 + VAR_3].parent = &t2[(VAR_2 >> 1) * w + (VAR_3 >> 1)]; t = t2; } t[0].parent = NULL; return res; }
[ "Jpeg2000TgtNode *FUNC_0(int w, int h)\n{", "int VAR_0 = w, VAR_1 = h;", "Jpeg2000TgtNode *res, *t, *t2;", "int32_t tt_size;", "tt_size = tag_tree_size(w, h);", "t = res = av_mallocz(tt_size, sizeof(*t));", "if (!res)\nreturn NULL;", "while (w > 1 || h > 1) {", "int VAR_2, VAR_3;", "VAR_0 = w;", "VAR_1 = h;", "w = (w + 1) >> 1;", "h = (h + 1) >> 1;", "t2 = t + VAR_0 * VAR_1;", "for (VAR_2 = 0; VAR_2 < VAR_1; VAR_2++)", "for (VAR_3 = 0; VAR_3 < VAR_0; VAR_3++)", "t[VAR_2 * VAR_0 + VAR_3].parent = &t2[(VAR_2 >> 1) * w + (VAR_3 >> 1)];", "t = t2;", "}", "t[0].parent = NULL;", "return res;", "}" ]
[ 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 17 ], [ 19, 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ] ]
11,223
static void test_hmac_speed(const void *opaque) { size_t chunk_size = (size_t)opaque; QCryptoHmac *hmac = NULL; uint8_t *in = NULL, *out = NULL; size_t out_len = 0; double total = 0.0; struct iovec iov; Error *err = NULL; int ret; if (!qcrypto_hmac_supports(QCRYPTO_HASH_ALG_SHA256)) { return; } in = g_new0(uint8_t, chunk_size); memset(in, g_test_rand_int(), chunk_size); iov.iov_base = (char *)in; iov.iov_len = chunk_size; g_test_timer_start(); do { hmac = qcrypto_hmac_new(QCRYPTO_HASH_ALG_SHA256, (const uint8_t *)KEY, strlen(KEY), &err); g_assert(err == NULL); g_assert(hmac != NULL); ret = qcrypto_hmac_bytesv(hmac, &iov, 1, &out, &out_len, &err); g_assert(ret == 0); g_assert(err == NULL); qcrypto_hmac_free(hmac); total += chunk_size; } while (g_test_timer_elapsed() < 5.0); total /= 1024 * 1024; /* to MB */ g_print("hmac(sha256): "); g_print("Testing chunk_size %ld bytes ", chunk_size); g_print("done: %.2f MB in %.2f secs: ", total, g_test_timer_last()); g_print("%.2f MB/sec\n", total / g_test_timer_last()); g_free(out); g_free(in); }
true
qemu
8c0a6dc96cd14c48da4a61fe35431f36d6e6e467
static void test_hmac_speed(const void *opaque) { size_t chunk_size = (size_t)opaque; QCryptoHmac *hmac = NULL; uint8_t *in = NULL, *out = NULL; size_t out_len = 0; double total = 0.0; struct iovec iov; Error *err = NULL; int ret; if (!qcrypto_hmac_supports(QCRYPTO_HASH_ALG_SHA256)) { return; } in = g_new0(uint8_t, chunk_size); memset(in, g_test_rand_int(), chunk_size); iov.iov_base = (char *)in; iov.iov_len = chunk_size; g_test_timer_start(); do { hmac = qcrypto_hmac_new(QCRYPTO_HASH_ALG_SHA256, (const uint8_t *)KEY, strlen(KEY), &err); g_assert(err == NULL); g_assert(hmac != NULL); ret = qcrypto_hmac_bytesv(hmac, &iov, 1, &out, &out_len, &err); g_assert(ret == 0); g_assert(err == NULL); qcrypto_hmac_free(hmac); total += chunk_size; } while (g_test_timer_elapsed() < 5.0); total /= 1024 * 1024; g_print("hmac(sha256): "); g_print("Testing chunk_size %ld bytes ", chunk_size); g_print("done: %.2f MB in %.2f secs: ", total, g_test_timer_last()); g_print("%.2f MB/sec\n", total / g_test_timer_last()); g_free(out); g_free(in); }
{ "code": [ " g_print(\"Testing chunk_size %ld bytes \", chunk_size);", " g_print(\"Testing chunk_size %ld bytes \", chunk_size);", " g_print(\"Testing chunk_size %ld bytes \", chunk_size);" ], "line_no": [ 81, 81, 81 ] }
static void FUNC_0(const void *VAR_0) { size_t chunk_size = (size_t)VAR_0; QCryptoHmac *hmac = NULL; uint8_t *in = NULL, *out = NULL; size_t out_len = 0; double VAR_1 = 0.0; struct iovec VAR_2; Error *err = NULL; int VAR_3; if (!qcrypto_hmac_supports(QCRYPTO_HASH_ALG_SHA256)) { return; } in = g_new0(uint8_t, chunk_size); memset(in, g_test_rand_int(), chunk_size); VAR_2.iov_base = (char *)in; VAR_2.iov_len = chunk_size; g_test_timer_start(); do { hmac = qcrypto_hmac_new(QCRYPTO_HASH_ALG_SHA256, (const uint8_t *)KEY, strlen(KEY), &err); g_assert(err == NULL); g_assert(hmac != NULL); VAR_3 = qcrypto_hmac_bytesv(hmac, &VAR_2, 1, &out, &out_len, &err); g_assert(VAR_3 == 0); g_assert(err == NULL); qcrypto_hmac_free(hmac); VAR_1 += chunk_size; } while (g_test_timer_elapsed() < 5.0); VAR_1 /= 1024 * 1024; g_print("hmac(sha256): "); g_print("Testing chunk_size %ld bytes ", chunk_size); g_print("done: %.2f MB in %.2f secs: ", VAR_1, g_test_timer_last()); g_print("%.2f MB/sec\n", VAR_1 / g_test_timer_last()); g_free(out); g_free(in); }
[ "static void FUNC_0(const void *VAR_0)\n{", "size_t chunk_size = (size_t)VAR_0;", "QCryptoHmac *hmac = NULL;", "uint8_t *in = NULL, *out = NULL;", "size_t out_len = 0;", "double VAR_1 = 0.0;", "struct iovec VAR_2;", "Error *err = NULL;", "int VAR_3;", "if (!qcrypto_hmac_supports(QCRYPTO_HASH_ALG_SHA256)) {", "return;", "}", "in = g_new0(uint8_t, chunk_size);", "memset(in, g_test_rand_int(), chunk_size);", "VAR_2.iov_base = (char *)in;", "VAR_2.iov_len = chunk_size;", "g_test_timer_start();", "do {", "hmac = qcrypto_hmac_new(QCRYPTO_HASH_ALG_SHA256,\n(const uint8_t *)KEY, strlen(KEY), &err);", "g_assert(err == NULL);", "g_assert(hmac != NULL);", "VAR_3 = qcrypto_hmac_bytesv(hmac, &VAR_2, 1, &out, &out_len, &err);", "g_assert(VAR_3 == 0);", "g_assert(err == NULL);", "qcrypto_hmac_free(hmac);", "VAR_1 += chunk_size;", "} while (g_test_timer_elapsed() < 5.0);", "VAR_1 /= 1024 * 1024;", "g_print(\"hmac(sha256): \");", "g_print(\"Testing chunk_size %ld bytes \", chunk_size);", "g_print(\"done: %.2f MB in %.2f secs: \", VAR_1, g_test_timer_last());", "g_print(\"%.2f MB/sec\\n\", VAR_1 / g_test_timer_last());", "g_free(out);", "g_free(in);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ], [ 47, 49 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ], [ 61 ], [ 65 ], [ 69 ], [ 71 ], [ 75 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 89 ], [ 91 ], [ 93 ] ]
11,224
static int smush_read_packet(AVFormatContext *ctx, AVPacket *pkt) { SMUSHContext *smush = ctx->priv_data; AVIOContext *pb = ctx->pb; int done = 0; while (!done) { uint32_t sig, size; if (url_feof(pb)) return AVERROR_EOF; sig = avio_rb32(pb); size = avio_rb32(pb); switch (sig) { case MKBETAG('F', 'R', 'M', 'E'): if (smush->version) break; if (av_get_packet(pb, pkt, size) < 0) return AVERROR(EIO); pkt->stream_index = smush->video_stream_index; done = 1; break; case MKBETAG('B', 'l', '1', '6'): if (av_get_packet(pb, pkt, size) < 0) return AVERROR(EIO); pkt->stream_index = smush->video_stream_index; pkt->duration = 1; done = 1; break; case MKBETAG('W', 'a', 'v', 'e'): if (size < 13) return AVERROR_INVALIDDATA; if (av_get_packet(pb, pkt, size) < 0) return AVERROR(EIO); pkt->stream_index = smush->audio_stream_index; pkt->flags |= AV_PKT_FLAG_KEY; pkt->duration = AV_RB32(pkt->data); if (pkt->duration == 0xFFFFFFFFu) pkt->duration = AV_RB32(pkt->data + 8); done = 1; break; default: avio_skip(pb, size); break; } } return 0; }
true
FFmpeg
d98364edcedb71662cb1761bd30d67053d60a3c6
static int smush_read_packet(AVFormatContext *ctx, AVPacket *pkt) { SMUSHContext *smush = ctx->priv_data; AVIOContext *pb = ctx->pb; int done = 0; while (!done) { uint32_t sig, size; if (url_feof(pb)) return AVERROR_EOF; sig = avio_rb32(pb); size = avio_rb32(pb); switch (sig) { case MKBETAG('F', 'R', 'M', 'E'): if (smush->version) break; if (av_get_packet(pb, pkt, size) < 0) return AVERROR(EIO); pkt->stream_index = smush->video_stream_index; done = 1; break; case MKBETAG('B', 'l', '1', '6'): if (av_get_packet(pb, pkt, size) < 0) return AVERROR(EIO); pkt->stream_index = smush->video_stream_index; pkt->duration = 1; done = 1; break; case MKBETAG('W', 'a', 'v', 'e'): if (size < 13) return AVERROR_INVALIDDATA; if (av_get_packet(pb, pkt, size) < 0) return AVERROR(EIO); pkt->stream_index = smush->audio_stream_index; pkt->flags |= AV_PKT_FLAG_KEY; pkt->duration = AV_RB32(pkt->data); if (pkt->duration == 0xFFFFFFFFu) pkt->duration = AV_RB32(pkt->data + 8); done = 1; break; default: avio_skip(pb, size); break; } } return 0; }
{ "code": [ " if (av_get_packet(pb, pkt, size) < 0)" ], "line_no": [ 39 ] }
static int FUNC_0(AVFormatContext *VAR_0, AVPacket *VAR_1) { SMUSHContext *smush = VAR_0->priv_data; AVIOContext *pb = VAR_0->pb; int VAR_2 = 0; while (!VAR_2) { uint32_t sig, size; if (url_feof(pb)) return AVERROR_EOF; sig = avio_rb32(pb); size = avio_rb32(pb); switch (sig) { case MKBETAG('F', 'R', 'M', 'E'): if (smush->version) break; if (av_get_packet(pb, VAR_1, size) < 0) return AVERROR(EIO); VAR_1->stream_index = smush->video_stream_index; VAR_2 = 1; break; case MKBETAG('B', 'l', '1', '6'): if (av_get_packet(pb, VAR_1, size) < 0) return AVERROR(EIO); VAR_1->stream_index = smush->video_stream_index; VAR_1->duration = 1; VAR_2 = 1; break; case MKBETAG('W', 'a', 'v', 'e'): if (size < 13) return AVERROR_INVALIDDATA; if (av_get_packet(pb, VAR_1, size) < 0) return AVERROR(EIO); VAR_1->stream_index = smush->audio_stream_index; VAR_1->flags |= AV_PKT_FLAG_KEY; VAR_1->duration = AV_RB32(VAR_1->data); if (VAR_1->duration == 0xFFFFFFFFu) VAR_1->duration = AV_RB32(VAR_1->data + 8); VAR_2 = 1; break; default: avio_skip(pb, size); break; } } return 0; }
[ "static int FUNC_0(AVFormatContext *VAR_0, AVPacket *VAR_1)\n{", "SMUSHContext *smush = VAR_0->priv_data;", "AVIOContext *pb = VAR_0->pb;", "int VAR_2 = 0;", "while (!VAR_2) {", "uint32_t sig, size;", "if (url_feof(pb))\nreturn AVERROR_EOF;", "sig = avio_rb32(pb);", "size = avio_rb32(pb);", "switch (sig) {", "case MKBETAG('F', 'R', 'M', 'E'):\nif (smush->version)\nbreak;", "if (av_get_packet(pb, VAR_1, size) < 0)\nreturn AVERROR(EIO);", "VAR_1->stream_index = smush->video_stream_index;", "VAR_2 = 1;", "break;", "case MKBETAG('B', 'l', '1', '6'):\nif (av_get_packet(pb, VAR_1, size) < 0)\nreturn AVERROR(EIO);", "VAR_1->stream_index = smush->video_stream_index;", "VAR_1->duration = 1;", "VAR_2 = 1;", "break;", "case MKBETAG('W', 'a', 'v', 'e'):\nif (size < 13)\nreturn AVERROR_INVALIDDATA;", "if (av_get_packet(pb, VAR_1, size) < 0)\nreturn AVERROR(EIO);", "VAR_1->stream_index = smush->audio_stream_index;", "VAR_1->flags |= AV_PKT_FLAG_KEY;", "VAR_1->duration = AV_RB32(VAR_1->data);", "if (VAR_1->duration == 0xFFFFFFFFu)\nVAR_1->duration = AV_RB32(VAR_1->data + 8);", "VAR_2 = 1;", "break;", "default:\navio_skip(pb, size);", "break;", "}", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 19, 21 ], [ 25 ], [ 27 ], [ 31 ], [ 33, 35, 37 ], [ 39, 41 ], [ 45 ], [ 47 ], [ 49 ], [ 51, 53, 55 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67, 69, 71 ], [ 73, 75 ], [ 79 ], [ 81 ], [ 83 ], [ 85, 87 ], [ 89 ], [ 91 ], [ 93, 95 ], [ 97 ], [ 99 ], [ 101 ], [ 105 ], [ 107 ] ]
11,225
static inline void mix_dualmono_to_stereo(AC3DecodeContext *ctx) { int i; float tmp; float (*output)[256] = ctx->audio_block.block_output; for (i = 0; i < 256; i++) { tmp = output[1][i] + output[2][i]; output[1][i] = output[2][i] = tmp; } }
false
FFmpeg
486637af8ef29ec215e0e0b7ecd3b5470f0e04e5
static inline void mix_dualmono_to_stereo(AC3DecodeContext *ctx) { int i; float tmp; float (*output)[256] = ctx->audio_block.block_output; for (i = 0; i < 256; i++) { tmp = output[1][i] + output[2][i]; output[1][i] = output[2][i] = tmp; } }
{ "code": [], "line_no": [] }
static inline void FUNC_0(AC3DecodeContext *VAR_0) { int VAR_1; float VAR_2; float (*VAR_3)[256] = VAR_0->audio_block.block_output; for (VAR_1 = 0; VAR_1 < 256; VAR_1++) { VAR_2 = VAR_3[1][VAR_1] + VAR_3[2][VAR_1]; VAR_3[1][VAR_1] = VAR_3[2][VAR_1] = VAR_2; } }
[ "static inline void FUNC_0(AC3DecodeContext *VAR_0)\n{", "int VAR_1;", "float VAR_2;", "float (*VAR_3)[256] = VAR_0->audio_block.block_output;", "for (VAR_1 = 0; VAR_1 < 256; VAR_1++) {", "VAR_2 = VAR_3[1][VAR_1] + VAR_3[2][VAR_1];", "VAR_3[1][VAR_1] = VAR_3[2][VAR_1] = VAR_2;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ] ]
11,226
static OSStatus ffat_encode_callback(AudioConverterRef converter, UInt32 *nb_packets, AudioBufferList *data, AudioStreamPacketDescription **packets, void *inctx) { AVCodecContext *avctx = inctx; ATDecodeContext *at = avctx->priv_data; if (at->eof) { *nb_packets = 0; return 0; } av_frame_unref(&at->in_frame); av_frame_move_ref(&at->in_frame, &at->new_in_frame); if (!at->in_frame.data[0]) { *nb_packets = 0; return 1; } data->mNumberBuffers = 1; data->mBuffers[0].mNumberChannels = avctx->channels; data->mBuffers[0].mDataByteSize = at->in_frame.nb_samples * av_get_bytes_per_sample(avctx->sample_fmt) * avctx->channels; data->mBuffers[0].mData = at->in_frame.data[0]; if (*nb_packets > at->in_frame.nb_samples) *nb_packets = at->in_frame.nb_samples; return 0; }
false
FFmpeg
143685a42bbc8861b626457ce4cb8b1ce4b0c436
static OSStatus ffat_encode_callback(AudioConverterRef converter, UInt32 *nb_packets, AudioBufferList *data, AudioStreamPacketDescription **packets, void *inctx) { AVCodecContext *avctx = inctx; ATDecodeContext *at = avctx->priv_data; if (at->eof) { *nb_packets = 0; return 0; } av_frame_unref(&at->in_frame); av_frame_move_ref(&at->in_frame, &at->new_in_frame); if (!at->in_frame.data[0]) { *nb_packets = 0; return 1; } data->mNumberBuffers = 1; data->mBuffers[0].mNumberChannels = avctx->channels; data->mBuffers[0].mDataByteSize = at->in_frame.nb_samples * av_get_bytes_per_sample(avctx->sample_fmt) * avctx->channels; data->mBuffers[0].mData = at->in_frame.data[0]; if (*nb_packets > at->in_frame.nb_samples) *nb_packets = at->in_frame.nb_samples; return 0; }
{ "code": [], "line_no": [] }
static OSStatus FUNC_0(AudioConverterRef converter, UInt32 *nb_packets, AudioBufferList *data, AudioStreamPacketDescription **packets, void *inctx) { AVCodecContext *avctx = inctx; ATDecodeContext *at = avctx->priv_data; if (at->eof) { *nb_packets = 0; return 0; } av_frame_unref(&at->in_frame); av_frame_move_ref(&at->in_frame, &at->new_in_frame); if (!at->in_frame.data[0]) { *nb_packets = 0; return 1; } data->mNumberBuffers = 1; data->mBuffers[0].mNumberChannels = avctx->channels; data->mBuffers[0].mDataByteSize = at->in_frame.nb_samples * av_get_bytes_per_sample(avctx->sample_fmt) * avctx->channels; data->mBuffers[0].mData = at->in_frame.data[0]; if (*nb_packets > at->in_frame.nb_samples) *nb_packets = at->in_frame.nb_samples; return 0; }
[ "static OSStatus FUNC_0(AudioConverterRef converter, UInt32 *nb_packets,\nAudioBufferList *data,\nAudioStreamPacketDescription **packets,\nvoid *inctx)\n{", "AVCodecContext *avctx = inctx;", "ATDecodeContext *at = avctx->priv_data;", "if (at->eof) {", "*nb_packets = 0;", "return 0;", "}", "av_frame_unref(&at->in_frame);", "av_frame_move_ref(&at->in_frame, &at->new_in_frame);", "if (!at->in_frame.data[0]) {", "*nb_packets = 0;", "return 1;", "}", "data->mNumberBuffers = 1;", "data->mBuffers[0].mNumberChannels = avctx->channels;", "data->mBuffers[0].mDataByteSize = at->in_frame.nb_samples *\nav_get_bytes_per_sample(avctx->sample_fmt) *\navctx->channels;", "data->mBuffers[0].mData = at->in_frame.data[0];", "if (*nb_packets > at->in_frame.nb_samples)\n*nb_packets = at->in_frame.nb_samples;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ], [ 47, 49, 51 ], [ 53 ], [ 55, 57 ], [ 61 ], [ 63 ] ]
11,227
void rgb16tobgr16(const uint8_t *src, uint8_t *dst, long src_size) { long i; long num_pixels = src_size >> 1; for(i=0; i<num_pixels; i++) { unsigned b,g,r; register uint16_t rgb; rgb = src[2*i]; r = rgb&0x1F; g = (rgb&0x7E0)>>5; b = (rgb&0xF800)>>11; dst[2*i] = (b&0x1F) | ((g&0x3F)<<5) | ((r&0x1F)<<11); } }
true
FFmpeg
6e42e6c4b410dbef8b593c2d796a5dad95f89ee4
void rgb16tobgr16(const uint8_t *src, uint8_t *dst, long src_size) { long i; long num_pixels = src_size >> 1; for(i=0; i<num_pixels; i++) { unsigned b,g,r; register uint16_t rgb; rgb = src[2*i]; r = rgb&0x1F; g = (rgb&0x7E0)>>5; b = (rgb&0xF800)>>11; dst[2*i] = (b&0x1F) | ((g&0x3F)<<5) | ((r&0x1F)<<11); } }
{ "code": [ "\tlong i;", "\tfor(i=0; i<num_pixels; i++)", "\tfor(i=0; i<num_pixels; i++)", "\tlong i;", "\tfor(i=0; i<num_pixels; i++)", "\tlong i;", "\tfor(i=0; i<num_pixels; i++)", "\tfor(i=0; i<num_pixels; i++)", "\tlong i;", "\tfor(i=0; i<num_pixels; i++)", "\tfor(i=0; i<num_pixels; i++)", "\tlong i;", "\tfor(i=0; i<num_pixels; i++)", "\tlong i;", "\tfor(i=0; i<num_pixels; i++)", "\tlong i;", "\tfor(i=0; i<num_pixels; i++)", "\tlong i;", "\tfor(i=0; i<num_pixels; i++)", "\tlong i;", "\tfor(i=0; i<num_pixels; i++)", "\tlong i;", "\tlong i;", "\tlong num_pixels = src_size >> 1;", "\tfor(i=0; i<num_pixels; i++)", "\t unsigned b,g,r;", "\t register uint16_t rgb;", "\t rgb = src[2*i];", "\t r = rgb&0x1F;", "\t g = (rgb&0x7E0)>>5;", "\t b = (rgb&0xF800)>>11;", "\t dst[2*i] = (b&0x1F) | ((g&0x3F)<<5) | ((r&0x1F)<<11);", "\tlong i;", "\tlong num_pixels = src_size >> 1;", "\tfor(i=0; i<num_pixels; i++)", "\t unsigned b,g,r;", "\t register uint16_t rgb;", "\t rgb = src[2*i];", "\t r = rgb&0x1F;", "\t g = (rgb&0x7E0)>>5;", "\t b = (rgb&0xF800)>>11;", "\tlong i;", "\tlong num_pixels = src_size >> 1;", "\tfor(i=0; i<num_pixels; i++)", "\t unsigned b,g,r;", "\t register uint16_t rgb;", "\t rgb = src[2*i];", "\t r = rgb&0x1F;", "\t dst[2*i] = (b&0x1F) | ((g&0x3F)<<5) | ((r&0x1F)<<11);", "\tlong i;", "\tlong num_pixels = src_size >> 1;", "\tfor(i=0; i<num_pixels; i++)", "\t unsigned b,g,r;", "\t register uint16_t rgb;", "\t rgb = src[2*i];", "\t r = rgb&0x1F;", "\tlong i;", "\tfor(i=0; i<num_pixels; i++)", "\t unsigned b,g,r;" ], "line_no": [ 5, 11, 11, 5, 11, 5, 11, 11, 5, 11, 11, 5, 11, 5, 11, 5, 11, 5, 11, 5, 11, 5, 5, 7, 11, 15, 17, 19, 21, 23, 25, 27, 5, 7, 11, 15, 17, 19, 21, 23, 25, 5, 7, 11, 15, 17, 19, 21, 27, 5, 7, 11, 15, 17, 19, 21, 5, 11, 15 ] }
void FUNC_0(const uint8_t *VAR_0, uint8_t *VAR_1, long VAR_2) { long VAR_3; long VAR_4 = VAR_2 >> 1; for(VAR_3=0; VAR_3<VAR_4; VAR_3++) { unsigned VAR_5,VAR_6,VAR_7; register uint16_t VAR_8; VAR_8 = VAR_0[2*VAR_3]; VAR_7 = VAR_8&0x1F; VAR_6 = (VAR_8&0x7E0)>>5; VAR_5 = (VAR_8&0xF800)>>11; VAR_1[2*VAR_3] = (VAR_5&0x1F) | ((VAR_6&0x3F)<<5) | ((VAR_7&0x1F)<<11); } }
[ "void FUNC_0(const uint8_t *VAR_0, uint8_t *VAR_1, long VAR_2)\n{", "long VAR_3;", "long VAR_4 = VAR_2 >> 1;", "for(VAR_3=0; VAR_3<VAR_4; VAR_3++)", "{", "unsigned VAR_5,VAR_6,VAR_7;", "register uint16_t VAR_8;", "VAR_8 = VAR_0[2*VAR_3];", "VAR_7 = VAR_8&0x1F;", "VAR_6 = (VAR_8&0x7E0)>>5;", "VAR_5 = (VAR_8&0xF800)>>11;", "VAR_1[2*VAR_3] = (VAR_5&0x1F) | ((VAR_6&0x3F)<<5) | ((VAR_7&0x1F)<<11);", "}", "}" ]
[ 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ] ]
11,228
static uint32_t ehci_mem_readl(void *ptr, target_phys_addr_t addr) { EHCIState *s = ptr; uint32_t val; val = s->mmio[addr] | (s->mmio[addr+1] << 8) | (s->mmio[addr+2] << 16) | (s->mmio[addr+3] << 24); trace_usb_ehci_mmio_readl(addr, addr2str(addr), val); return val; }
true
qemu
3e4f910c8d490a1490409a7e381dbbb229f9d272
static uint32_t ehci_mem_readl(void *ptr, target_phys_addr_t addr) { EHCIState *s = ptr; uint32_t val; val = s->mmio[addr] | (s->mmio[addr+1] << 8) | (s->mmio[addr+2] << 16) | (s->mmio[addr+3] << 24); trace_usb_ehci_mmio_readl(addr, addr2str(addr), val); return val; }
{ "code": [ " uint32_t val;", " return val;", "static uint32_t ehci_mem_readl(void *ptr, target_phys_addr_t addr)", " val = s->mmio[addr] | (s->mmio[addr+1] << 8) |", " (s->mmio[addr+2] << 16) | (s->mmio[addr+3] << 24);", " trace_usb_ehci_mmio_readl(addr, addr2str(addr), val);" ], "line_no": [ 7, 19, 1, 11, 13, 17 ] }
static uint32_t FUNC_0(void *ptr, target_phys_addr_t addr) { EHCIState *s = ptr; uint32_t val; val = s->mmio[addr] | (s->mmio[addr+1] << 8) | (s->mmio[addr+2] << 16) | (s->mmio[addr+3] << 24); trace_usb_ehci_mmio_readl(addr, addr2str(addr), val); return val; }
[ "static uint32_t FUNC_0(void *ptr, target_phys_addr_t addr)\n{", "EHCIState *s = ptr;", "uint32_t val;", "val = s->mmio[addr] | (s->mmio[addr+1] << 8) |\n(s->mmio[addr+2] << 16) | (s->mmio[addr+3] << 24);", "trace_usb_ehci_mmio_readl(addr, addr2str(addr), val);", "return val;", "}" ]
[ 1, 0, 1, 1, 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11, 13 ], [ 17 ], [ 19 ], [ 21 ] ]
11,229
static void qmp_input_type_number(Visitor *v, double *obj, const char *name, Error **errp) { QmpInputVisitor *qiv = to_qiv(v); QObject *qobj = qmp_input_get_object(qiv, name, true); if (!qobj || (qobject_type(qobj) != QTYPE_QFLOAT && qobject_type(qobj) != QTYPE_QINT)) { error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null", "number"); return; } if (qobject_type(qobj) == QTYPE_QINT) { *obj = qint_get_int(qobject_to_qint(qobj)); } else { *obj = qfloat_get_double(qobject_to_qfloat(qobj)); } }
true
qemu
fcf73f66a67f5e58c18216f8c8651e38cf4d90af
static void qmp_input_type_number(Visitor *v, double *obj, const char *name, Error **errp) { QmpInputVisitor *qiv = to_qiv(v); QObject *qobj = qmp_input_get_object(qiv, name, true); if (!qobj || (qobject_type(qobj) != QTYPE_QFLOAT && qobject_type(qobj) != QTYPE_QINT)) { error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null", "number"); return; } if (qobject_type(qobj) == QTYPE_QINT) { *obj = qint_get_int(qobject_to_qint(qobj)); } else { *obj = qfloat_get_double(qobject_to_qfloat(qobj)); } }
{ "code": [ " QObject *qobj = qmp_input_get_object(qiv, name, true);", " if (!qobj || (qobject_type(qobj) != QTYPE_QFLOAT &&", " qobject_type(qobj) != QTYPE_QINT)) {", " error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : \"null\",", " \"number\");", " if (qobject_type(qobj) == QTYPE_QINT) {", " *obj = qint_get_int(qobject_to_qint(qobj));", " } else {" ], "line_no": [ 9, 13, 15, 17, 19, 27, 29, 31 ] }
static void FUNC_0(Visitor *VAR_0, double *VAR_1, const char *VAR_2, Error **VAR_3) { QmpInputVisitor *qiv = to_qiv(VAR_0); QObject *qobj = qmp_input_get_object(qiv, VAR_2, true); if (!qobj || (qobject_type(qobj) != QTYPE_QFLOAT && qobject_type(qobj) != QTYPE_QINT)) { error_setg(VAR_3, QERR_INVALID_PARAMETER_TYPE, VAR_2 ? VAR_2 : "null", "number"); return; } if (qobject_type(qobj) == QTYPE_QINT) { *VAR_1 = qint_get_int(qobject_to_qint(qobj)); } else { *VAR_1 = qfloat_get_double(qobject_to_qfloat(qobj)); } }
[ "static void FUNC_0(Visitor *VAR_0, double *VAR_1, const char *VAR_2,\nError **VAR_3)\n{", "QmpInputVisitor *qiv = to_qiv(VAR_0);", "QObject *qobj = qmp_input_get_object(qiv, VAR_2, true);", "if (!qobj || (qobject_type(qobj) != QTYPE_QFLOAT &&\nqobject_type(qobj) != QTYPE_QINT)) {", "error_setg(VAR_3, QERR_INVALID_PARAMETER_TYPE, VAR_2 ? VAR_2 : \"null\",\n\"number\");", "return;", "}", "if (qobject_type(qobj) == QTYPE_QINT) {", "*VAR_1 = qint_get_int(qobject_to_qint(qobj));", "} else {", "*VAR_1 = qfloat_get_double(qobject_to_qfloat(qobj));", "}", "}" ]
[ 0, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13, 15 ], [ 17, 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ] ]
11,230
int bdrv_all_find_snapshot(const char *name, BlockDriverState **first_bad_bs) { QEMUSnapshotInfo sn; int err = 0; BlockDriverState *bs; BdrvNextIterator *it = NULL; while (err == 0 && (it = bdrv_next(it, &bs))) { AioContext *ctx = bdrv_get_aio_context(bs); aio_context_acquire(ctx); if (bdrv_can_snapshot(bs)) { err = bdrv_snapshot_find(bs, &sn, name); } aio_context_release(ctx); } *first_bad_bs = bs; return err; }
true
qemu
88be7b4be4aa17c88247e162bdd7577ea79db94f
int bdrv_all_find_snapshot(const char *name, BlockDriverState **first_bad_bs) { QEMUSnapshotInfo sn; int err = 0; BlockDriverState *bs; BdrvNextIterator *it = NULL; while (err == 0 && (it = bdrv_next(it, &bs))) { AioContext *ctx = bdrv_get_aio_context(bs); aio_context_acquire(ctx); if (bdrv_can_snapshot(bs)) { err = bdrv_snapshot_find(bs, &sn, name); } aio_context_release(ctx); } *first_bad_bs = bs; return err; }
{ "code": [ " BdrvNextIterator *it = NULL;", " BdrvNextIterator *it = NULL;", " BdrvNextIterator *it = NULL;", " BlockDriverState *bs;", " BdrvNextIterator *it = NULL;", " BdrvNextIterator *it = NULL;", " BdrvNextIterator *it = NULL;", " BdrvNextIterator *it = NULL;", " while (err == 0 && (it = bdrv_next(it, &bs))) {", " BdrvNextIterator *it = NULL;", " while (err == 0 && (it = bdrv_next(it, &bs))) {", " BdrvNextIterator *it = NULL;", " while (err == 0 && (it = bdrv_next(it, &bs))) {", " BdrvNextIterator *it = NULL;", " BdrvNextIterator *it = NULL;", " BdrvNextIterator *it = NULL;", " BdrvNextIterator *it = NULL;" ], "line_no": [ 11, 11, 11, 9, 11, 11, 11, 11, 15, 11, 15, 11, 15, 11, 11, 11, 11 ] }
int FUNC_0(const char *VAR_0, BlockDriverState **VAR_1) { QEMUSnapshotInfo sn; int VAR_2 = 0; BlockDriverState *bs; BdrvNextIterator *it = NULL; while (VAR_2 == 0 && (it = bdrv_next(it, &bs))) { AioContext *ctx = bdrv_get_aio_context(bs); aio_context_acquire(ctx); if (bdrv_can_snapshot(bs)) { VAR_2 = bdrv_snapshot_find(bs, &sn, VAR_0); } aio_context_release(ctx); } *VAR_1 = bs; return VAR_2; }
[ "int FUNC_0(const char *VAR_0, BlockDriverState **VAR_1)\n{", "QEMUSnapshotInfo sn;", "int VAR_2 = 0;", "BlockDriverState *bs;", "BdrvNextIterator *it = NULL;", "while (VAR_2 == 0 && (it = bdrv_next(it, &bs))) {", "AioContext *ctx = bdrv_get_aio_context(bs);", "aio_context_acquire(ctx);", "if (bdrv_can_snapshot(bs)) {", "VAR_2 = bdrv_snapshot_find(bs, &sn, VAR_0);", "}", "aio_context_release(ctx);", "}", "*VAR_1 = bs;", "return VAR_2;", "}" ]
[ 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ] ]
11,231
static int cow_is_allocated(BlockDriverState *bs, int64_t sector_num, int nb_sectors, int *num_same) { int changed; if (nb_sectors == 0) { *num_same = nb_sectors; return 0; } changed = is_bit_set(bs, sector_num); if (changed < 0) { return 0; /* XXX: how to return I/O errors? */ } for (*num_same = 1; *num_same < nb_sectors; (*num_same)++) { if (is_bit_set(bs, sector_num + *num_same) != changed) break; } return changed; }
true
qemu
81145834d39897c6f153ac26a4077f90f269c5fc
static int cow_is_allocated(BlockDriverState *bs, int64_t sector_num, int nb_sectors, int *num_same) { int changed; if (nb_sectors == 0) { *num_same = nb_sectors; return 0; } changed = is_bit_set(bs, sector_num); if (changed < 0) { return 0; } for (*num_same = 1; *num_same < nb_sectors; (*num_same)++) { if (is_bit_set(bs, sector_num + *num_same) != changed) break; } return changed; }
{ "code": [ "static int cow_is_allocated(BlockDriverState *bs, int64_t sector_num,", " int nb_sectors, int *num_same)" ], "line_no": [ 1, 3 ] }
static int FUNC_0(BlockDriverState *VAR_0, int64_t VAR_1, int VAR_2, int *VAR_3) { int VAR_4; if (VAR_2 == 0) { *VAR_3 = VAR_2; return 0; } VAR_4 = is_bit_set(VAR_0, VAR_1); if (VAR_4 < 0) { return 0; } for (*VAR_3 = 1; *VAR_3 < VAR_2; (*VAR_3)++) { if (is_bit_set(VAR_0, VAR_1 + *VAR_3) != VAR_4) break; } return VAR_4; }
[ "static int FUNC_0(BlockDriverState *VAR_0, int64_t VAR_1,\nint VAR_2, int *VAR_3)\n{", "int VAR_4;", "if (VAR_2 == 0) {", "*VAR_3 = VAR_2;", "return 0;", "}", "VAR_4 = is_bit_set(VAR_0, VAR_1);", "if (VAR_4 < 0) {", "return 0;", "}", "for (*VAR_3 = 1; *VAR_3 < VAR_2; (*VAR_3)++) {", "if (is_bit_set(VAR_0, VAR_1 + *VAR_3) != VAR_4)\nbreak;", "}", "return VAR_4;", "}" ]
[ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33, 35 ], [ 37 ], [ 41 ], [ 43 ] ]
11,232
static inline void gen_goto_tb(DisasContext *ctx, int n, target_ulong dest) { TranslationBlock *tb; tb = ctx->tb; if ((tb->pc & TARGET_PAGE_MASK) == (dest & TARGET_PAGE_MASK)) { if (n == 0) gen_op_goto_tb0(TBPARAM(tb)); else gen_op_goto_tb1(TBPARAM(tb)); gen_op_set_T1(dest); gen_op_b_T1(); gen_op_set_T0((long)tb + n); if (ctx->singlestep_enabled) gen_op_debug(); gen_op_exit_tb(); } else { gen_op_set_T1(dest); gen_op_b_T1(); gen_op_reset_T0(); if (ctx->singlestep_enabled) gen_op_debug(); gen_op_exit_tb(); } }
true
qemu
d9bce9d99f4656ae0b0127f7472db9067b8f84ab
static inline void gen_goto_tb(DisasContext *ctx, int n, target_ulong dest) { TranslationBlock *tb; tb = ctx->tb; if ((tb->pc & TARGET_PAGE_MASK) == (dest & TARGET_PAGE_MASK)) { if (n == 0) gen_op_goto_tb0(TBPARAM(tb)); else gen_op_goto_tb1(TBPARAM(tb)); gen_op_set_T1(dest); gen_op_b_T1(); gen_op_set_T0((long)tb + n); if (ctx->singlestep_enabled) gen_op_debug(); gen_op_exit_tb(); } else { gen_op_set_T1(dest); gen_op_b_T1(); gen_op_reset_T0(); if (ctx->singlestep_enabled) gen_op_debug(); gen_op_exit_tb(); } }
{ "code": [ " } else {", " } else {", " } else {", " } else {", " } else {", " } else {", " } else {", " } else {", " } else {", " } else {", " gen_op_set_T1(dest);", " gen_op_b_T1();", " gen_op_set_T1(dest);", " gen_op_b_T1();" ], "line_no": [ 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 19, 21, 19, 21 ] }
static inline void FUNC_0(DisasContext *VAR_0, int VAR_1, target_ulong VAR_2) { TranslationBlock *tb; tb = VAR_0->tb; if ((tb->pc & TARGET_PAGE_MASK) == (VAR_2 & TARGET_PAGE_MASK)) { if (VAR_1 == 0) gen_op_goto_tb0(TBPARAM(tb)); else gen_op_goto_tb1(TBPARAM(tb)); gen_op_set_T1(VAR_2); gen_op_b_T1(); gen_op_set_T0((long)tb + VAR_1); if (VAR_0->singlestep_enabled) gen_op_debug(); gen_op_exit_tb(); } else { gen_op_set_T1(VAR_2); gen_op_b_T1(); gen_op_reset_T0(); if (VAR_0->singlestep_enabled) gen_op_debug(); gen_op_exit_tb(); } }
[ "static inline void FUNC_0(DisasContext *VAR_0, int VAR_1, target_ulong VAR_2)\n{", "TranslationBlock *tb;", "tb = VAR_0->tb;", "if ((tb->pc & TARGET_PAGE_MASK) == (VAR_2 & TARGET_PAGE_MASK)) {", "if (VAR_1 == 0)\ngen_op_goto_tb0(TBPARAM(tb));", "else\ngen_op_goto_tb1(TBPARAM(tb));", "gen_op_set_T1(VAR_2);", "gen_op_b_T1();", "gen_op_set_T0((long)tb + VAR_1);", "if (VAR_0->singlestep_enabled)\ngen_op_debug();", "gen_op_exit_tb();", "} else {", "gen_op_set_T1(VAR_2);", "gen_op_b_T1();", "gen_op_reset_T0();", "if (VAR_0->singlestep_enabled)\ngen_op_debug();", "gen_op_exit_tb();", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11, 13 ], [ 15, 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25, 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39, 41 ], [ 43 ], [ 45 ], [ 47 ] ]
11,233
int qcow2_alloc_cluster_link_l2(BlockDriverState *bs, QCowL2Meta *m) { BDRVQcowState *s = bs->opaque; int i, j = 0, l2_index, ret; uint64_t *old_cluster, *l2_table; uint64_t cluster_offset = m->alloc_offset; trace_qcow2_cluster_link_l2(qemu_coroutine_self(), m->nb_clusters); assert(m->nb_clusters > 0); old_cluster = g_malloc(m->nb_clusters * sizeof(uint64_t)); /* copy content of unmodified sectors */ ret = perform_cow(bs, m, &m->cow_start); if (ret < 0) { goto err; } ret = perform_cow(bs, m, &m->cow_end); if (ret < 0) { goto err; } /* Update L2 table. */ if (s->use_lazy_refcounts) { qcow2_mark_dirty(bs); } if (qcow2_need_accurate_refcounts(s)) { qcow2_cache_set_dependency(bs, s->l2_table_cache, s->refcount_block_cache); } ret = get_cluster_table(bs, m->offset, &l2_table, &l2_index); if (ret < 0) { goto err; } qcow2_cache_entry_mark_dirty(s->l2_table_cache, l2_table); for (i = 0; i < m->nb_clusters; i++) { /* if two concurrent writes happen to the same unallocated cluster * each write allocates separate cluster and writes data concurrently. * The first one to complete updates l2 table with pointer to its * cluster the second one has to do RMW (which is done above by * copy_sectors()), update l2 table with its cluster pointer and free * old cluster. This is what this loop does */ if(l2_table[l2_index + i] != 0) old_cluster[j++] = l2_table[l2_index + i]; l2_table[l2_index + i] = cpu_to_be64((cluster_offset + (i << s->cluster_bits)) | QCOW_OFLAG_COPIED); } ret = qcow2_cache_put(bs, s->l2_table_cache, (void**) &l2_table); if (ret < 0) { goto err; } /* * If this was a COW, we need to decrease the refcount of the old cluster. * Also flush bs->file to get the right order for L2 and refcount update. * * Don't discard clusters that reach a refcount of 0 (e.g. compressed * clusters), the next write will reuse them anyway. */ if (j != 0) { for (i = 0; i < j; i++) { qcow2_free_any_clusters(bs, be64_to_cpu(old_cluster[i]), 1, QCOW2_DISCARD_NEVER); } } ret = 0; err: g_free(old_cluster); return ret; }
true
qemu
c01dbccbad647be5784be39eb8fa0144732295db
int qcow2_alloc_cluster_link_l2(BlockDriverState *bs, QCowL2Meta *m) { BDRVQcowState *s = bs->opaque; int i, j = 0, l2_index, ret; uint64_t *old_cluster, *l2_table; uint64_t cluster_offset = m->alloc_offset; trace_qcow2_cluster_link_l2(qemu_coroutine_self(), m->nb_clusters); assert(m->nb_clusters > 0); old_cluster = g_malloc(m->nb_clusters * sizeof(uint64_t)); ret = perform_cow(bs, m, &m->cow_start); if (ret < 0) { goto err; } ret = perform_cow(bs, m, &m->cow_end); if (ret < 0) { goto err; } if (s->use_lazy_refcounts) { qcow2_mark_dirty(bs); } if (qcow2_need_accurate_refcounts(s)) { qcow2_cache_set_dependency(bs, s->l2_table_cache, s->refcount_block_cache); } ret = get_cluster_table(bs, m->offset, &l2_table, &l2_index); if (ret < 0) { goto err; } qcow2_cache_entry_mark_dirty(s->l2_table_cache, l2_table); for (i = 0; i < m->nb_clusters; i++) { if(l2_table[l2_index + i] != 0) old_cluster[j++] = l2_table[l2_index + i]; l2_table[l2_index + i] = cpu_to_be64((cluster_offset + (i << s->cluster_bits)) | QCOW_OFLAG_COPIED); } ret = qcow2_cache_put(bs, s->l2_table_cache, (void**) &l2_table); if (ret < 0) { goto err; } if (j != 0) { for (i = 0; i < j; i++) { qcow2_free_any_clusters(bs, be64_to_cpu(old_cluster[i]), 1, QCOW2_DISCARD_NEVER); } } ret = 0; err: g_free(old_cluster); return ret; }
{ "code": [], "line_no": [] }
int FUNC_0(BlockDriverState *VAR_0, QCowL2Meta *VAR_1) { BDRVQcowState *s = VAR_0->opaque; int VAR_2, VAR_3 = 0, VAR_4, VAR_5; uint64_t *old_cluster, *l2_table; uint64_t cluster_offset = VAR_1->alloc_offset; trace_qcow2_cluster_link_l2(qemu_coroutine_self(), VAR_1->nb_clusters); assert(VAR_1->nb_clusters > 0); old_cluster = g_malloc(VAR_1->nb_clusters * sizeof(uint64_t)); VAR_5 = perform_cow(VAR_0, VAR_1, &VAR_1->cow_start); if (VAR_5 < 0) { goto err; } VAR_5 = perform_cow(VAR_0, VAR_1, &VAR_1->cow_end); if (VAR_5 < 0) { goto err; } if (s->use_lazy_refcounts) { qcow2_mark_dirty(VAR_0); } if (qcow2_need_accurate_refcounts(s)) { qcow2_cache_set_dependency(VAR_0, s->l2_table_cache, s->refcount_block_cache); } VAR_5 = get_cluster_table(VAR_0, VAR_1->offset, &l2_table, &VAR_4); if (VAR_5 < 0) { goto err; } qcow2_cache_entry_mark_dirty(s->l2_table_cache, l2_table); for (VAR_2 = 0; VAR_2 < VAR_1->nb_clusters; VAR_2++) { if(l2_table[VAR_4 + VAR_2] != 0) old_cluster[VAR_3++] = l2_table[VAR_4 + VAR_2]; l2_table[VAR_4 + VAR_2] = cpu_to_be64((cluster_offset + (VAR_2 << s->cluster_bits)) | QCOW_OFLAG_COPIED); } VAR_5 = qcow2_cache_put(VAR_0, s->l2_table_cache, (void**) &l2_table); if (VAR_5 < 0) { goto err; } if (VAR_3 != 0) { for (VAR_2 = 0; VAR_2 < VAR_3; VAR_2++) { qcow2_free_any_clusters(VAR_0, be64_to_cpu(old_cluster[VAR_2]), 1, QCOW2_DISCARD_NEVER); } } VAR_5 = 0; err: g_free(old_cluster); return VAR_5; }
[ "int FUNC_0(BlockDriverState *VAR_0, QCowL2Meta *VAR_1)\n{", "BDRVQcowState *s = VAR_0->opaque;", "int VAR_2, VAR_3 = 0, VAR_4, VAR_5;", "uint64_t *old_cluster, *l2_table;", "uint64_t cluster_offset = VAR_1->alloc_offset;", "trace_qcow2_cluster_link_l2(qemu_coroutine_self(), VAR_1->nb_clusters);", "assert(VAR_1->nb_clusters > 0);", "old_cluster = g_malloc(VAR_1->nb_clusters * sizeof(uint64_t));", "VAR_5 = perform_cow(VAR_0, VAR_1, &VAR_1->cow_start);", "if (VAR_5 < 0) {", "goto err;", "}", "VAR_5 = perform_cow(VAR_0, VAR_1, &VAR_1->cow_end);", "if (VAR_5 < 0) {", "goto err;", "}", "if (s->use_lazy_refcounts) {", "qcow2_mark_dirty(VAR_0);", "}", "if (qcow2_need_accurate_refcounts(s)) {", "qcow2_cache_set_dependency(VAR_0, s->l2_table_cache,\ns->refcount_block_cache);", "}", "VAR_5 = get_cluster_table(VAR_0, VAR_1->offset, &l2_table, &VAR_4);", "if (VAR_5 < 0) {", "goto err;", "}", "qcow2_cache_entry_mark_dirty(s->l2_table_cache, l2_table);", "for (VAR_2 = 0; VAR_2 < VAR_1->nb_clusters; VAR_2++) {", "if(l2_table[VAR_4 + VAR_2] != 0)\nold_cluster[VAR_3++] = l2_table[VAR_4 + VAR_2];", "l2_table[VAR_4 + VAR_2] = cpu_to_be64((cluster_offset +\n(VAR_2 << s->cluster_bits)) | QCOW_OFLAG_COPIED);", "}", "VAR_5 = qcow2_cache_put(VAR_0, s->l2_table_cache, (void**) &l2_table);", "if (VAR_5 < 0) {", "goto err;", "}", "if (VAR_3 != 0) {", "for (VAR_2 = 0; VAR_2 < VAR_3; VAR_2++) {", "qcow2_free_any_clusters(VAR_0, be64_to_cpu(old_cluster[VAR_2]), 1,\nQCOW2_DISCARD_NEVER);", "}", "}", "VAR_5 = 0;", "err:\ng_free(old_cluster);", "return VAR_5;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 21 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57, 59 ], [ 61 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 78 ], [ 92, 94 ], [ 98, 100 ], [ 102 ], [ 108 ], [ 110 ], [ 112 ], [ 114 ], [ 132 ], [ 134 ], [ 136, 138 ], [ 140 ], [ 142 ], [ 146 ], [ 148, 150 ], [ 152 ], [ 154 ] ]
11,234
int ff_vp8_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { VP8Context *s = avctx->priv_data; int ret, i, referenced, num_jobs; enum AVDiscard skip_thresh; VP8Frame *av_uninit(curframe), *prev_frame; if ((ret = decode_frame_header(s, avpkt->data, avpkt->size)) < 0) goto err; prev_frame = s->framep[VP56_FRAME_CURRENT]; referenced = s->update_last || s->update_golden == VP56_FRAME_CURRENT || s->update_altref == VP56_FRAME_CURRENT; skip_thresh = !referenced ? AVDISCARD_NONREF : !s->keyframe ? AVDISCARD_NONKEY : AVDISCARD_ALL; if (avctx->skip_frame >= skip_thresh) { s->invisible = 1; memcpy(&s->next_framep[0], &s->framep[0], sizeof(s->framep[0]) * 4); goto skip_decode; } s->deblock_filter = s->filter.level && avctx->skip_loop_filter < skip_thresh; // release no longer referenced frames for (i = 0; i < 5; i++) if (s->frames[i].tf.f->data[0] && &s->frames[i] != prev_frame && &s->frames[i] != s->framep[VP56_FRAME_PREVIOUS] && &s->frames[i] != s->framep[VP56_FRAME_GOLDEN] && &s->frames[i] != s->framep[VP56_FRAME_GOLDEN2]) vp8_release_frame(s, &s->frames[i]); // find a free buffer for (i = 0; i < 5; i++) if (&s->frames[i] != prev_frame && &s->frames[i] != s->framep[VP56_FRAME_PREVIOUS] && &s->frames[i] != s->framep[VP56_FRAME_GOLDEN] && &s->frames[i] != s->framep[VP56_FRAME_GOLDEN2]) { curframe = s->framep[VP56_FRAME_CURRENT] = &s->frames[i]; break; } if (i == 5) { av_log(avctx, AV_LOG_FATAL, "Ran out of free frames!\n"); abort(); } if (curframe->tf.f->data[0]) vp8_release_frame(s, curframe); /* Given that arithmetic probabilities are updated every frame, it's quite * likely that the values we have on a random interframe are complete * junk if we didn't start decode on a keyframe. So just don't display * anything rather than junk. */ if (!s->keyframe && (!s->framep[VP56_FRAME_PREVIOUS] || !s->framep[VP56_FRAME_GOLDEN] || !s->framep[VP56_FRAME_GOLDEN2])) { av_log(avctx, AV_LOG_WARNING, "Discarding interframe without a prior keyframe!\n"); ret = AVERROR_INVALIDDATA; goto err; } curframe->tf.f->key_frame = s->keyframe; curframe->tf.f->pict_type = s->keyframe ? AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_P; if ((ret = vp8_alloc_frame(s, curframe, referenced))) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed!\n"); goto err; } // check if golden and altref are swapped if (s->update_altref != VP56_FRAME_NONE) s->next_framep[VP56_FRAME_GOLDEN2] = s->framep[s->update_altref]; else s->next_framep[VP56_FRAME_GOLDEN2] = s->framep[VP56_FRAME_GOLDEN2]; if (s->update_golden != VP56_FRAME_NONE) s->next_framep[VP56_FRAME_GOLDEN] = s->framep[s->update_golden]; else s->next_framep[VP56_FRAME_GOLDEN] = s->framep[VP56_FRAME_GOLDEN]; if (s->update_last) s->next_framep[VP56_FRAME_PREVIOUS] = curframe; else s->next_framep[VP56_FRAME_PREVIOUS] = s->framep[VP56_FRAME_PREVIOUS]; s->next_framep[VP56_FRAME_CURRENT] = curframe; ff_thread_finish_setup(avctx); s->linesize = curframe->tf.f->linesize[0]; s->uvlinesize = curframe->tf.f->linesize[1]; memset(s->top_nnz, 0, s->mb_width * sizeof(*s->top_nnz)); /* Zero macroblock structures for top/top-left prediction * from outside the frame. */ if (!s->mb_layout) memset(s->macroblocks + s->mb_height * 2 - 1, 0, (s->mb_width + 1) * sizeof(*s->macroblocks)); if (!s->mb_layout && s->keyframe) memset(s->intra4x4_pred_mode_top, DC_PRED, s->mb_width * 4); memset(s->ref_count, 0, sizeof(s->ref_count)); if (s->mb_layout == 1) { // Make sure the previous frame has read its segmentation map, // if we re-use the same map. if (prev_frame && s->segmentation.enabled && !s->segmentation.update_map) ff_thread_await_progress(&prev_frame->tf, 1, 0); vp8_decode_mv_mb_modes(avctx, curframe, prev_frame); } if (avctx->active_thread_type == FF_THREAD_FRAME) num_jobs = 1; else num_jobs = FFMIN(s->num_coeff_partitions, avctx->thread_count); s->num_jobs = num_jobs; s->curframe = curframe; s->prev_frame = prev_frame; s->mv_min.y = -MARGIN; s->mv_max.y = ((s->mb_height - 1) << 6) + MARGIN; for (i = 0; i < MAX_THREADS; i++) { s->thread_data[i].thread_mb_pos = 0; s->thread_data[i].wait_mb_pos = INT_MAX; } avctx->execute2(avctx, vp8_decode_mb_row_sliced, s->thread_data, NULL, num_jobs); ff_thread_report_progress(&curframe->tf, INT_MAX, 0); memcpy(&s->framep[0], &s->next_framep[0], sizeof(s->framep[0]) * 4); skip_decode: // if future frames don't use the updated probabilities, // reset them to the values we saved if (!s->update_probabilities) s->prob[0] = s->prob[1]; if (!s->invisible) { if ((ret = av_frame_ref(data, curframe->tf.f)) < 0) return ret; *got_frame = 1; } return avpkt->size; err: memcpy(&s->next_framep[0], &s->framep[0], sizeof(s->framep[0]) * 4); return ret; }
true
FFmpeg
ac4b32df71bd932838043a4838b86d11e169707f
int ff_vp8_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { VP8Context *s = avctx->priv_data; int ret, i, referenced, num_jobs; enum AVDiscard skip_thresh; VP8Frame *av_uninit(curframe), *prev_frame; if ((ret = decode_frame_header(s, avpkt->data, avpkt->size)) < 0) goto err; prev_frame = s->framep[VP56_FRAME_CURRENT]; referenced = s->update_last || s->update_golden == VP56_FRAME_CURRENT || s->update_altref == VP56_FRAME_CURRENT; skip_thresh = !referenced ? AVDISCARD_NONREF : !s->keyframe ? AVDISCARD_NONKEY : AVDISCARD_ALL; if (avctx->skip_frame >= skip_thresh) { s->invisible = 1; memcpy(&s->next_framep[0], &s->framep[0], sizeof(s->framep[0]) * 4); goto skip_decode; } s->deblock_filter = s->filter.level && avctx->skip_loop_filter < skip_thresh; for (i = 0; i < 5; i++) if (s->frames[i].tf.f->data[0] && &s->frames[i] != prev_frame && &s->frames[i] != s->framep[VP56_FRAME_PREVIOUS] && &s->frames[i] != s->framep[VP56_FRAME_GOLDEN] && &s->frames[i] != s->framep[VP56_FRAME_GOLDEN2]) vp8_release_frame(s, &s->frames[i]); for (i = 0; i < 5; i++) if (&s->frames[i] != prev_frame && &s->frames[i] != s->framep[VP56_FRAME_PREVIOUS] && &s->frames[i] != s->framep[VP56_FRAME_GOLDEN] && &s->frames[i] != s->framep[VP56_FRAME_GOLDEN2]) { curframe = s->framep[VP56_FRAME_CURRENT] = &s->frames[i]; break; } if (i == 5) { av_log(avctx, AV_LOG_FATAL, "Ran out of free frames!\n"); abort(); } if (curframe->tf.f->data[0]) vp8_release_frame(s, curframe); if (!s->keyframe && (!s->framep[VP56_FRAME_PREVIOUS] || !s->framep[VP56_FRAME_GOLDEN] || !s->framep[VP56_FRAME_GOLDEN2])) { av_log(avctx, AV_LOG_WARNING, "Discarding interframe without a prior keyframe!\n"); ret = AVERROR_INVALIDDATA; goto err; } curframe->tf.f->key_frame = s->keyframe; curframe->tf.f->pict_type = s->keyframe ? AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_P; if ((ret = vp8_alloc_frame(s, curframe, referenced))) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed!\n"); goto err; } if (s->update_altref != VP56_FRAME_NONE) s->next_framep[VP56_FRAME_GOLDEN2] = s->framep[s->update_altref]; else s->next_framep[VP56_FRAME_GOLDEN2] = s->framep[VP56_FRAME_GOLDEN2]; if (s->update_golden != VP56_FRAME_NONE) s->next_framep[VP56_FRAME_GOLDEN] = s->framep[s->update_golden]; else s->next_framep[VP56_FRAME_GOLDEN] = s->framep[VP56_FRAME_GOLDEN]; if (s->update_last) s->next_framep[VP56_FRAME_PREVIOUS] = curframe; else s->next_framep[VP56_FRAME_PREVIOUS] = s->framep[VP56_FRAME_PREVIOUS]; s->next_framep[VP56_FRAME_CURRENT] = curframe; ff_thread_finish_setup(avctx); s->linesize = curframe->tf.f->linesize[0]; s->uvlinesize = curframe->tf.f->linesize[1]; memset(s->top_nnz, 0, s->mb_width * sizeof(*s->top_nnz)); if (!s->mb_layout) memset(s->macroblocks + s->mb_height * 2 - 1, 0, (s->mb_width + 1) * sizeof(*s->macroblocks)); if (!s->mb_layout && s->keyframe) memset(s->intra4x4_pred_mode_top, DC_PRED, s->mb_width * 4); memset(s->ref_count, 0, sizeof(s->ref_count)); if (s->mb_layout == 1) { if (prev_frame && s->segmentation.enabled && !s->segmentation.update_map) ff_thread_await_progress(&prev_frame->tf, 1, 0); vp8_decode_mv_mb_modes(avctx, curframe, prev_frame); } if (avctx->active_thread_type == FF_THREAD_FRAME) num_jobs = 1; else num_jobs = FFMIN(s->num_coeff_partitions, avctx->thread_count); s->num_jobs = num_jobs; s->curframe = curframe; s->prev_frame = prev_frame; s->mv_min.y = -MARGIN; s->mv_max.y = ((s->mb_height - 1) << 6) + MARGIN; for (i = 0; i < MAX_THREADS; i++) { s->thread_data[i].thread_mb_pos = 0; s->thread_data[i].wait_mb_pos = INT_MAX; } avctx->execute2(avctx, vp8_decode_mb_row_sliced, s->thread_data, NULL, num_jobs); ff_thread_report_progress(&curframe->tf, INT_MAX, 0); memcpy(&s->framep[0], &s->next_framep[0], sizeof(s->framep[0]) * 4); skip_decode: if (!s->update_probabilities) s->prob[0] = s->prob[1]; if (!s->invisible) { if ((ret = av_frame_ref(data, curframe->tf.f)) < 0) return ret; *got_frame = 1; } return avpkt->size; err: memcpy(&s->next_framep[0], &s->framep[0], sizeof(s->framep[0]) * 4); return ret; }
{ "code": [ "int ff_vp8_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,", " AVPacket *avpkt)", " if ((ret = decode_frame_header(s, avpkt->data, avpkt->size)) < 0)", " for (i = 0; i < 5; i++)", " if (&s->frames[i] != prev_frame &&", " &s->frames[i] != s->framep[VP56_FRAME_PREVIOUS] &&", " &s->frames[i] != s->framep[VP56_FRAME_GOLDEN] &&", " &s->frames[i] != s->framep[VP56_FRAME_GOLDEN2]) {", " curframe = s->framep[VP56_FRAME_CURRENT] = &s->frames[i];", " break;", " if (i == 5) {", " av_log(avctx, AV_LOG_FATAL, \"Ran out of free frames!\\n\");", " abort();", " if (curframe->tf.f->data[0])", " vp8_release_frame(s, curframe);", " vp8_decode_mv_mb_modes(avctx, curframe, prev_frame);", " avctx->execute2(avctx, vp8_decode_mb_row_sliced,", " s->thread_data, NULL, num_jobs);" ], "line_no": [ 1, 3, 17, 57, 77, 63, 65, 83, 85, 87, 91, 93, 95, 99, 101, 227, 259, 261 ] }
int FUNC_0(AVCodecContext *VAR_0, void *VAR_1, int *VAR_2, AVPacket *VAR_3) { VP8Context *s = VAR_0->priv_data; int VAR_4, VAR_5, VAR_6, VAR_7; enum AVDiscard VAR_8; VP8Frame *av_uninit(curframe), *prev_frame; if ((VAR_4 = decode_frame_header(s, VAR_3->VAR_1, VAR_3->size)) < 0) goto err; prev_frame = s->framep[VP56_FRAME_CURRENT]; VAR_6 = s->update_last || s->update_golden == VP56_FRAME_CURRENT || s->update_altref == VP56_FRAME_CURRENT; VAR_8 = !VAR_6 ? AVDISCARD_NONREF : !s->keyframe ? AVDISCARD_NONKEY : AVDISCARD_ALL; if (VAR_0->skip_frame >= VAR_8) { s->invisible = 1; memcpy(&s->next_framep[0], &s->framep[0], sizeof(s->framep[0]) * 4); goto skip_decode; } s->deblock_filter = s->filter.level && VAR_0->skip_loop_filter < VAR_8; for (VAR_5 = 0; VAR_5 < 5; VAR_5++) if (s->frames[VAR_5].tf.f->VAR_1[0] && &s->frames[VAR_5] != prev_frame && &s->frames[VAR_5] != s->framep[VP56_FRAME_PREVIOUS] && &s->frames[VAR_5] != s->framep[VP56_FRAME_GOLDEN] && &s->frames[VAR_5] != s->framep[VP56_FRAME_GOLDEN2]) vp8_release_frame(s, &s->frames[VAR_5]); for (VAR_5 = 0; VAR_5 < 5; VAR_5++) if (&s->frames[VAR_5] != prev_frame && &s->frames[VAR_5] != s->framep[VP56_FRAME_PREVIOUS] && &s->frames[VAR_5] != s->framep[VP56_FRAME_GOLDEN] && &s->frames[VAR_5] != s->framep[VP56_FRAME_GOLDEN2]) { curframe = s->framep[VP56_FRAME_CURRENT] = &s->frames[VAR_5]; break; } if (VAR_5 == 5) { av_log(VAR_0, AV_LOG_FATAL, "Ran out of free frames!\n"); abort(); } if (curframe->tf.f->VAR_1[0]) vp8_release_frame(s, curframe); if (!s->keyframe && (!s->framep[VP56_FRAME_PREVIOUS] || !s->framep[VP56_FRAME_GOLDEN] || !s->framep[VP56_FRAME_GOLDEN2])) { av_log(VAR_0, AV_LOG_WARNING, "Discarding interframe without a prior keyframe!\n"); VAR_4 = AVERROR_INVALIDDATA; goto err; } curframe->tf.f->key_frame = s->keyframe; curframe->tf.f->pict_type = s->keyframe ? AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_P; if ((VAR_4 = vp8_alloc_frame(s, curframe, VAR_6))) { av_log(VAR_0, AV_LOG_ERROR, "get_buffer() failed!\n"); goto err; } if (s->update_altref != VP56_FRAME_NONE) s->next_framep[VP56_FRAME_GOLDEN2] = s->framep[s->update_altref]; else s->next_framep[VP56_FRAME_GOLDEN2] = s->framep[VP56_FRAME_GOLDEN2]; if (s->update_golden != VP56_FRAME_NONE) s->next_framep[VP56_FRAME_GOLDEN] = s->framep[s->update_golden]; else s->next_framep[VP56_FRAME_GOLDEN] = s->framep[VP56_FRAME_GOLDEN]; if (s->update_last) s->next_framep[VP56_FRAME_PREVIOUS] = curframe; else s->next_framep[VP56_FRAME_PREVIOUS] = s->framep[VP56_FRAME_PREVIOUS]; s->next_framep[VP56_FRAME_CURRENT] = curframe; ff_thread_finish_setup(VAR_0); s->linesize = curframe->tf.f->linesize[0]; s->uvlinesize = curframe->tf.f->linesize[1]; memset(s->top_nnz, 0, s->mb_width * sizeof(*s->top_nnz)); if (!s->mb_layout) memset(s->macroblocks + s->mb_height * 2 - 1, 0, (s->mb_width + 1) * sizeof(*s->macroblocks)); if (!s->mb_layout && s->keyframe) memset(s->intra4x4_pred_mode_top, DC_PRED, s->mb_width * 4); memset(s->ref_count, 0, sizeof(s->ref_count)); if (s->mb_layout == 1) { if (prev_frame && s->segmentation.enabled && !s->segmentation.update_map) ff_thread_await_progress(&prev_frame->tf, 1, 0); vp8_decode_mv_mb_modes(VAR_0, curframe, prev_frame); } if (VAR_0->active_thread_type == FF_THREAD_FRAME) VAR_7 = 1; else VAR_7 = FFMIN(s->num_coeff_partitions, VAR_0->thread_count); s->VAR_7 = VAR_7; s->curframe = curframe; s->prev_frame = prev_frame; s->mv_min.y = -MARGIN; s->mv_max.y = ((s->mb_height - 1) << 6) + MARGIN; for (VAR_5 = 0; VAR_5 < MAX_THREADS; VAR_5++) { s->thread_data[VAR_5].thread_mb_pos = 0; s->thread_data[VAR_5].wait_mb_pos = INT_MAX; } VAR_0->execute2(VAR_0, vp8_decode_mb_row_sliced, s->thread_data, NULL, VAR_7); ff_thread_report_progress(&curframe->tf, INT_MAX, 0); memcpy(&s->framep[0], &s->next_framep[0], sizeof(s->framep[0]) * 4); skip_decode: if (!s->update_probabilities) s->prob[0] = s->prob[1]; if (!s->invisible) { if ((VAR_4 = av_frame_ref(VAR_1, curframe->tf.f)) < 0) return VAR_4; *VAR_2 = 1; } return VAR_3->size; err: memcpy(&s->next_framep[0], &s->framep[0], sizeof(s->framep[0]) * 4); return VAR_4; }
[ "int FUNC_0(AVCodecContext *VAR_0, void *VAR_1, int *VAR_2,\nAVPacket *VAR_3)\n{", "VP8Context *s = VAR_0->priv_data;", "int VAR_4, VAR_5, VAR_6, VAR_7;", "enum AVDiscard VAR_8;", "VP8Frame *av_uninit(curframe), *prev_frame;", "if ((VAR_4 = decode_frame_header(s, VAR_3->VAR_1, VAR_3->size)) < 0)\ngoto err;", "prev_frame = s->framep[VP56_FRAME_CURRENT];", "VAR_6 = s->update_last || s->update_golden == VP56_FRAME_CURRENT ||\ns->update_altref == VP56_FRAME_CURRENT;", "VAR_8 = !VAR_6 ? AVDISCARD_NONREF\n: !s->keyframe ? AVDISCARD_NONKEY\n: AVDISCARD_ALL;", "if (VAR_0->skip_frame >= VAR_8) {", "s->invisible = 1;", "memcpy(&s->next_framep[0], &s->framep[0], sizeof(s->framep[0]) * 4);", "goto skip_decode;", "}", "s->deblock_filter = s->filter.level && VAR_0->skip_loop_filter < VAR_8;", "for (VAR_5 = 0; VAR_5 < 5; VAR_5++)", "if (s->frames[VAR_5].tf.f->VAR_1[0] &&\n&s->frames[VAR_5] != prev_frame &&\n&s->frames[VAR_5] != s->framep[VP56_FRAME_PREVIOUS] &&\n&s->frames[VAR_5] != s->framep[VP56_FRAME_GOLDEN] &&\n&s->frames[VAR_5] != s->framep[VP56_FRAME_GOLDEN2])\nvp8_release_frame(s, &s->frames[VAR_5]);", "for (VAR_5 = 0; VAR_5 < 5; VAR_5++)", "if (&s->frames[VAR_5] != prev_frame &&\n&s->frames[VAR_5] != s->framep[VP56_FRAME_PREVIOUS] &&\n&s->frames[VAR_5] != s->framep[VP56_FRAME_GOLDEN] &&\n&s->frames[VAR_5] != s->framep[VP56_FRAME_GOLDEN2]) {", "curframe = s->framep[VP56_FRAME_CURRENT] = &s->frames[VAR_5];", "break;", "}", "if (VAR_5 == 5) {", "av_log(VAR_0, AV_LOG_FATAL, \"Ran out of free frames!\\n\");", "abort();", "}", "if (curframe->tf.f->VAR_1[0])\nvp8_release_frame(s, curframe);", "if (!s->keyframe && (!s->framep[VP56_FRAME_PREVIOUS] ||\n!s->framep[VP56_FRAME_GOLDEN] ||\n!s->framep[VP56_FRAME_GOLDEN2])) {", "av_log(VAR_0, AV_LOG_WARNING,\n\"Discarding interframe without a prior keyframe!\\n\");", "VAR_4 = AVERROR_INVALIDDATA;", "goto err;", "}", "curframe->tf.f->key_frame = s->keyframe;", "curframe->tf.f->pict_type = s->keyframe ? AV_PICTURE_TYPE_I\n: AV_PICTURE_TYPE_P;", "if ((VAR_4 = vp8_alloc_frame(s, curframe, VAR_6))) {", "av_log(VAR_0, AV_LOG_ERROR, \"get_buffer() failed!\\n\");", "goto err;", "}", "if (s->update_altref != VP56_FRAME_NONE)\ns->next_framep[VP56_FRAME_GOLDEN2] = s->framep[s->update_altref];", "else\ns->next_framep[VP56_FRAME_GOLDEN2] = s->framep[VP56_FRAME_GOLDEN2];", "if (s->update_golden != VP56_FRAME_NONE)\ns->next_framep[VP56_FRAME_GOLDEN] = s->framep[s->update_golden];", "else\ns->next_framep[VP56_FRAME_GOLDEN] = s->framep[VP56_FRAME_GOLDEN];", "if (s->update_last)\ns->next_framep[VP56_FRAME_PREVIOUS] = curframe;", "else\ns->next_framep[VP56_FRAME_PREVIOUS] = s->framep[VP56_FRAME_PREVIOUS];", "s->next_framep[VP56_FRAME_CURRENT] = curframe;", "ff_thread_finish_setup(VAR_0);", "s->linesize = curframe->tf.f->linesize[0];", "s->uvlinesize = curframe->tf.f->linesize[1];", "memset(s->top_nnz, 0, s->mb_width * sizeof(*s->top_nnz));", "if (!s->mb_layout)\nmemset(s->macroblocks + s->mb_height * 2 - 1, 0,\n(s->mb_width + 1) * sizeof(*s->macroblocks));", "if (!s->mb_layout && s->keyframe)\nmemset(s->intra4x4_pred_mode_top, DC_PRED, s->mb_width * 4);", "memset(s->ref_count, 0, sizeof(s->ref_count));", "if (s->mb_layout == 1) {", "if (prev_frame && s->segmentation.enabled &&\n!s->segmentation.update_map)\nff_thread_await_progress(&prev_frame->tf, 1, 0);", "vp8_decode_mv_mb_modes(VAR_0, curframe, prev_frame);", "}", "if (VAR_0->active_thread_type == FF_THREAD_FRAME)\nVAR_7 = 1;", "else\nVAR_7 = FFMIN(s->num_coeff_partitions, VAR_0->thread_count);", "s->VAR_7 = VAR_7;", "s->curframe = curframe;", "s->prev_frame = prev_frame;", "s->mv_min.y = -MARGIN;", "s->mv_max.y = ((s->mb_height - 1) << 6) + MARGIN;", "for (VAR_5 = 0; VAR_5 < MAX_THREADS; VAR_5++) {", "s->thread_data[VAR_5].thread_mb_pos = 0;", "s->thread_data[VAR_5].wait_mb_pos = INT_MAX;", "}", "VAR_0->execute2(VAR_0, vp8_decode_mb_row_sliced,\ns->thread_data, NULL, VAR_7);", "ff_thread_report_progress(&curframe->tf, INT_MAX, 0);", "memcpy(&s->framep[0], &s->next_framep[0], sizeof(s->framep[0]) * 4);", "skip_decode:\nif (!s->update_probabilities)\ns->prob[0] = s->prob[1];", "if (!s->invisible) {", "if ((VAR_4 = av_frame_ref(VAR_1, curframe->tf.f)) < 0)\nreturn VAR_4;", "*VAR_2 = 1;", "}", "return VAR_3->size;", "err:\nmemcpy(&s->next_framep[0], &s->framep[0], sizeof(s->framep[0]) * 4);", "return VAR_4;", "}" ]
[ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17, 19 ], [ 23 ], [ 27, 29 ], [ 33, 35, 37 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 57 ], [ 59, 61, 63, 65, 67, 69 ], [ 75 ], [ 77, 79, 81, 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99, 101 ], [ 113, 115, 117 ], [ 119, 121 ], [ 123 ], [ 125 ], [ 127 ], [ 131 ], [ 133, 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 149, 151 ], [ 153, 155 ], [ 159, 161 ], [ 163, 165 ], [ 169, 171 ], [ 173, 175 ], [ 179 ], [ 183 ], [ 187 ], [ 189 ], [ 193 ], [ 199, 201, 203 ], [ 205, 207 ], [ 211 ], [ 215 ], [ 221, 223, 225 ], [ 227 ], [ 229 ], [ 233, 235 ], [ 237, 239 ], [ 241 ], [ 243 ], [ 245 ], [ 247 ], [ 249 ], [ 251 ], [ 253 ], [ 255 ], [ 257 ], [ 259, 261 ], [ 265 ], [ 267 ], [ 271, 277, 279 ], [ 283 ], [ 285, 287 ], [ 289 ], [ 291 ], [ 295 ], [ 297, 299 ], [ 301 ], [ 303 ] ]
11,236
static void test_visitor_in_null(TestInputVisitorData *data, const void *unused) { Visitor *v; Error *err = NULL; char *tmp; /* * FIXME: Since QAPI doesn't know the 'null' type yet, we can't * test visit_type_null() by reading into a QAPI struct then * checking that it was populated correctly. The best we can do * for now is ensure that we consumed null from the input, proven * by the fact that we can't re-read the key; and that we detect * when input is not null. */ v = visitor_input_test_init(data, "{ 'a': null, 'b': '', 'c': null }"); visit_start_struct(v, NULL, NULL, 0, &error_abort); visit_type_null(v, "a", &error_abort); visit_type_null(v, "b", &err); error_free_or_abort(&err); visit_type_str(v, "c", &tmp, &err); g_assert(!tmp); error_free_or_abort(&err); visit_check_struct(v, &error_abort); visit_end_struct(v, NULL); }
true
qemu
cbd8acf38f37544b830086af840bfb1015ce10e0
static void test_visitor_in_null(TestInputVisitorData *data, const void *unused) { Visitor *v; Error *err = NULL; char *tmp; v = visitor_input_test_init(data, "{ 'a': null, 'b': '', 'c': null }"); visit_start_struct(v, NULL, NULL, 0, &error_abort); visit_type_null(v, "a", &error_abort); visit_type_null(v, "b", &err); error_free_or_abort(&err); visit_type_str(v, "c", &tmp, &err); g_assert(!tmp); error_free_or_abort(&err); visit_check_struct(v, &error_abort); visit_end_struct(v, NULL); }
{ "code": [ " v = visitor_input_test_init(data, \"{ 'a': null, 'b': '', 'c': null }\");" ], "line_no": [ 33 ] }
static void FUNC_0(TestInputVisitorData *VAR_0, const void *VAR_1) { Visitor *v; Error *err = NULL; char *VAR_2; v = visitor_input_test_init(VAR_0, "{ 'a': null, 'b': '', 'c': null }"); visit_start_struct(v, NULL, NULL, 0, &error_abort); visit_type_null(v, "a", &error_abort); visit_type_null(v, "b", &err); error_free_or_abort(&err); visit_type_str(v, "c", &VAR_2, &err); g_assert(!VAR_2); error_free_or_abort(&err); visit_check_struct(v, &error_abort); visit_end_struct(v, NULL); }
[ "static void FUNC_0(TestInputVisitorData *VAR_0,\nconst void *VAR_1)\n{", "Visitor *v;", "Error *err = NULL;", "char *VAR_2;", "v = visitor_input_test_init(VAR_0, \"{ 'a': null, 'b': '', 'c': null }\");", "visit_start_struct(v, NULL, NULL, 0, &error_abort);", "visit_type_null(v, \"a\", &error_abort);", "visit_type_null(v, \"b\", &err);", "error_free_or_abort(&err);", "visit_type_str(v, \"c\", &VAR_2, &err);", "g_assert(!VAR_2);", "error_free_or_abort(&err);", "visit_check_struct(v, &error_abort);", "visit_end_struct(v, NULL);", "}" ]
[ 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ] ]
11,237
static av_cold int dnxhd_decode_init(AVCodecContext *avctx) { DNXHDContext *ctx = avctx->priv_data; ctx->avctx = avctx; ctx->cid = -1; avctx->colorspace = AVCOL_SPC_BT709; avctx->coded_width = FFALIGN(avctx->width, 16); avctx->coded_height = FFALIGN(avctx->height, 16); ctx->rows = av_mallocz_array(avctx->thread_count, sizeof(RowContext)); if (!ctx->rows) return AVERROR(ENOMEM); return 0; }
true
FFmpeg
c6a905b91d935f78f5c33f6ce2dbe294b3353b77
static av_cold int dnxhd_decode_init(AVCodecContext *avctx) { DNXHDContext *ctx = avctx->priv_data; ctx->avctx = avctx; ctx->cid = -1; avctx->colorspace = AVCOL_SPC_BT709; avctx->coded_width = FFALIGN(avctx->width, 16); avctx->coded_height = FFALIGN(avctx->height, 16); ctx->rows = av_mallocz_array(avctx->thread_count, sizeof(RowContext)); if (!ctx->rows) return AVERROR(ENOMEM); return 0; }
{ "code": [ " avctx->colorspace = AVCOL_SPC_BT709;" ], "line_no": [ 13 ] }
static av_cold int FUNC_0(AVCodecContext *avctx) { DNXHDContext *ctx = avctx->priv_data; ctx->avctx = avctx; ctx->cid = -1; avctx->colorspace = AVCOL_SPC_BT709; avctx->coded_width = FFALIGN(avctx->width, 16); avctx->coded_height = FFALIGN(avctx->height, 16); ctx->rows = av_mallocz_array(avctx->thread_count, sizeof(RowContext)); if (!ctx->rows) return AVERROR(ENOMEM); return 0; }
[ "static av_cold int FUNC_0(AVCodecContext *avctx)\n{", "DNXHDContext *ctx = avctx->priv_data;", "ctx->avctx = avctx;", "ctx->cid = -1;", "avctx->colorspace = AVCOL_SPC_BT709;", "avctx->coded_width = FFALIGN(avctx->width, 16);", "avctx->coded_height = FFALIGN(avctx->height, 16);", "ctx->rows = av_mallocz_array(avctx->thread_count, sizeof(RowContext));", "if (!ctx->rows)\nreturn AVERROR(ENOMEM);", "return 0;", "}" ]
[ 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 23 ], [ 25, 27 ], [ 31 ], [ 33 ] ]
11,238
static int usb_net_handle_statusin(USBNetState *s, USBPacket *p) { int ret = 8; if (p->len < 8) return USB_RET_STALL; ((le32 *) p->data)[0] = cpu_to_le32(1); ((le32 *) p->data)[1] = cpu_to_le32(0); if (!s->rndis_resp.tqh_first) ret = USB_RET_NAK; #ifdef TRAFFIC_DEBUG fprintf(stderr, "usbnet: interrupt poll len %u return %d", p->len, ret); { int i; fprintf(stderr, ":"); for (i = 0; i < ret; i++) { if (!(i & 15)) fprintf(stderr, "\n%04x:", i); fprintf(stderr, " %02x", p->data[i]); } fprintf(stderr, "\n\n"); } #endif return ret; }
true
qemu
4f4321c11ff6e98583846bfd6f0e81954924b003
static int usb_net_handle_statusin(USBNetState *s, USBPacket *p) { int ret = 8; if (p->len < 8) return USB_RET_STALL; ((le32 *) p->data)[0] = cpu_to_le32(1); ((le32 *) p->data)[1] = cpu_to_le32(0); if (!s->rndis_resp.tqh_first) ret = USB_RET_NAK; #ifdef TRAFFIC_DEBUG fprintf(stderr, "usbnet: interrupt poll len %u return %d", p->len, ret); { int i; fprintf(stderr, ":"); for (i = 0; i < ret; i++) { if (!(i & 15)) fprintf(stderr, "\n%04x:", i); fprintf(stderr, " %02x", p->data[i]); } fprintf(stderr, "\n\n"); } #endif return ret; }
{ "code": [ " if (p->len < 8)", " ((le32 *) p->data)[0] = cpu_to_le32(1);", " ((le32 *) p->data)[1] = cpu_to_le32(0);", " fprintf(stderr, \"usbnet: interrupt poll len %u return %d\", p->len, ret);", " int i;", " fprintf(stderr, \":\");", " for (i = 0; i < ret; i++) {", " if (!(i & 15))", " fprintf(stderr, \"\\n%04x:\", i);", " fprintf(stderr, \" %02x\", p->data[i]);", " fprintf(stderr, \"\\n\\n\");", " int i;", " fprintf(stderr, \":\");", " for (i = 0; i < ret; i++) {", " if (!(i & 15))", " fprintf(stderr, \"\\n%04x:\", i);", " fprintf(stderr, \" %02x\", p->data[i]);", " fprintf(stderr, \"\\n\\n\");", " int i;", " fprintf(stderr, \":\");", " if (!(i & 15))", " fprintf(stderr, \"\\n%04x:\", i);", " fprintf(stderr, \" %02x\", p->data[i]);", " fprintf(stderr, \"\\n\\n\");" ], "line_no": [ 9, 15, 17, 27, 31, 33, 35, 37, 39, 41, 45, 31, 33, 35, 37, 39, 41, 45, 31, 33, 37, 39, 41, 45 ] }
static int FUNC_0(USBNetState *VAR_0, USBPacket *VAR_1) { int VAR_2 = 8; if (VAR_1->len < 8) return USB_RET_STALL; ((le32 *) VAR_1->data)[0] = cpu_to_le32(1); ((le32 *) VAR_1->data)[1] = cpu_to_le32(0); if (!VAR_0->rndis_resp.tqh_first) VAR_2 = USB_RET_NAK; #ifdef TRAFFIC_DEBUG fprintf(stderr, "usbnet: interrupt poll len %u return %d", VAR_1->len, VAR_2); { int i; fprintf(stderr, ":"); for (i = 0; i < VAR_2; i++) { if (!(i & 15)) fprintf(stderr, "\n%04x:", i); fprintf(stderr, " %02x", VAR_1->data[i]); } fprintf(stderr, "\n\n"); } #endif return VAR_2; }
[ "static int FUNC_0(USBNetState *VAR_0, USBPacket *VAR_1)\n{", "int VAR_2 = 8;", "if (VAR_1->len < 8)\nreturn USB_RET_STALL;", "((le32 *) VAR_1->data)[0] = cpu_to_le32(1);", "((le32 *) VAR_1->data)[1] = cpu_to_le32(0);", "if (!VAR_0->rndis_resp.tqh_first)\nVAR_2 = USB_RET_NAK;", "#ifdef TRAFFIC_DEBUG\nfprintf(stderr, \"usbnet: interrupt poll len %u return %d\", VAR_1->len, VAR_2);", "{", "int i;", "fprintf(stderr, \":\");", "for (i = 0; i < VAR_2; i++) {", "if (!(i & 15))\nfprintf(stderr, \"\\n%04x:\", i);", "fprintf(stderr, \" %02x\", VAR_1->data[i]);", "}", "fprintf(stderr, \"\\n\\n\");", "}", "#endif\nreturn VAR_2;", "}" ]
[ 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9, 11 ], [ 15 ], [ 17 ], [ 19, 21 ], [ 25, 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37, 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49, 53 ], [ 55 ] ]
11,239
static OutputStream *new_audio_stream(OptionsContext *o, AVFormatContext *oc, int source_index) { int n; AVStream *st; OutputStream *ost; AVCodecContext *audio_enc; ost = new_output_stream(o, oc, AVMEDIA_TYPE_AUDIO, source_index); st = ost->st; audio_enc = st->codec; audio_enc->codec_type = AVMEDIA_TYPE_AUDIO; if (!ost->stream_copy) { char *sample_fmt = NULL; MATCH_PER_STREAM_OPT(audio_channels, i, audio_enc->channels, oc, st); MATCH_PER_STREAM_OPT(sample_fmts, str, sample_fmt, oc, st); if (sample_fmt && (audio_enc->sample_fmt = av_get_sample_fmt(sample_fmt)) == AV_SAMPLE_FMT_NONE) { av_log(NULL, AV_LOG_FATAL, "Invalid sample format '%s'\n", sample_fmt); exit_program(1); } MATCH_PER_STREAM_OPT(audio_sample_rate, i, audio_enc->sample_rate, oc, st); ost->rematrix_volume=1.0; MATCH_PER_STREAM_OPT(rematrix_volume, f, ost->rematrix_volume, oc, st); } /* check for channel mapping for this audio stream */ for (n = 0; n < o->nb_audio_channel_maps; n++) { AudioChannelMap *map = &o->audio_channel_maps[n]; InputStream *ist = input_streams[ost->source_index]; if ((map->channel_idx == -1 || (ist->file_index == map->file_idx && ist->st->index == map->stream_idx)) && (map->ofile_idx == -1 || ost->file_index == map->ofile_idx) && (map->ostream_idx == -1 || ost->st->index == map->ostream_idx)) { if (ost->audio_channels_mapped < FF_ARRAY_ELEMS(ost->audio_channels_map)) ost->audio_channels_map[ost->audio_channels_mapped++] = map->channel_idx; else av_log(NULL, AV_LOG_FATAL, "Max channel mapping for output %d.%d reached\n", ost->file_index, ost->st->index); } } return ost; }
true
FFmpeg
fc49f22c3b735db5aaac5f98e40b7124a2be13b8
static OutputStream *new_audio_stream(OptionsContext *o, AVFormatContext *oc, int source_index) { int n; AVStream *st; OutputStream *ost; AVCodecContext *audio_enc; ost = new_output_stream(o, oc, AVMEDIA_TYPE_AUDIO, source_index); st = ost->st; audio_enc = st->codec; audio_enc->codec_type = AVMEDIA_TYPE_AUDIO; if (!ost->stream_copy) { char *sample_fmt = NULL; MATCH_PER_STREAM_OPT(audio_channels, i, audio_enc->channels, oc, st); MATCH_PER_STREAM_OPT(sample_fmts, str, sample_fmt, oc, st); if (sample_fmt && (audio_enc->sample_fmt = av_get_sample_fmt(sample_fmt)) == AV_SAMPLE_FMT_NONE) { av_log(NULL, AV_LOG_FATAL, "Invalid sample format '%s'\n", sample_fmt); exit_program(1); } MATCH_PER_STREAM_OPT(audio_sample_rate, i, audio_enc->sample_rate, oc, st); ost->rematrix_volume=1.0; MATCH_PER_STREAM_OPT(rematrix_volume, f, ost->rematrix_volume, oc, st); } for (n = 0; n < o->nb_audio_channel_maps; n++) { AudioChannelMap *map = &o->audio_channel_maps[n]; InputStream *ist = input_streams[ost->source_index]; if ((map->channel_idx == -1 || (ist->file_index == map->file_idx && ist->st->index == map->stream_idx)) && (map->ofile_idx == -1 || ost->file_index == map->ofile_idx) && (map->ostream_idx == -1 || ost->st->index == map->ostream_idx)) { if (ost->audio_channels_mapped < FF_ARRAY_ELEMS(ost->audio_channels_map)) ost->audio_channels_map[ost->audio_channels_mapped++] = map->channel_idx; else av_log(NULL, AV_LOG_FATAL, "Max channel mapping for output %d.%d reached\n", ost->file_index, ost->st->index); } } return ost; }
{ "code": [ " exit_program(1);", " exit_program(1);", " exit_program(1);", " exit_program(1);", " char *sample_fmt = NULL;", " ost->rematrix_volume=1.0;", " MATCH_PER_STREAM_OPT(rematrix_volume, f, ost->rematrix_volume, oc, st);", " for (n = 0; n < o->nb_audio_channel_maps; n++) {", " AudioChannelMap *map = &o->audio_channel_maps[n];", " InputStream *ist = input_streams[ost->source_index];", " if ((map->channel_idx == -1 || (ist->file_index == map->file_idx && ist->st->index == map->stream_idx)) &&", " (map->ofile_idx == -1 || ost->file_index == map->ofile_idx) &&", " (map->ostream_idx == -1 || ost->st->index == map->ostream_idx)) {", " if (ost->audio_channels_mapped < FF_ARRAY_ELEMS(ost->audio_channels_map))", " ost->audio_channels_map[ost->audio_channels_mapped++] = map->channel_idx;", " av_log(NULL, AV_LOG_FATAL, \"Max channel mapping for output %d.%d reached\\n\",", " ost->file_index, ost->st->index);" ], "line_no": [ 45, 45, 45, 45, 29, 55, 57, 65, 67, 69, 71, 73, 75, 77, 79, 83, 85 ] }
static OutputStream *FUNC_0(OptionsContext *o, AVFormatContext *oc, int source_index) { int VAR_0; AVStream *st; OutputStream *ost; AVCodecContext *audio_enc; ost = new_output_stream(o, oc, AVMEDIA_TYPE_AUDIO, source_index); st = ost->st; audio_enc = st->codec; audio_enc->codec_type = AVMEDIA_TYPE_AUDIO; if (!ost->stream_copy) { char *VAR_1 = NULL; MATCH_PER_STREAM_OPT(audio_channels, i, audio_enc->channels, oc, st); MATCH_PER_STREAM_OPT(sample_fmts, str, VAR_1, oc, st); if (VAR_1 && (audio_enc->VAR_1 = av_get_sample_fmt(VAR_1)) == AV_SAMPLE_FMT_NONE) { av_log(NULL, AV_LOG_FATAL, "Invalid sample format '%s'\VAR_0", VAR_1); exit_program(1); } MATCH_PER_STREAM_OPT(audio_sample_rate, i, audio_enc->sample_rate, oc, st); ost->rematrix_volume=1.0; MATCH_PER_STREAM_OPT(rematrix_volume, f, ost->rematrix_volume, oc, st); } for (VAR_0 = 0; VAR_0 < o->nb_audio_channel_maps; VAR_0++) { AudioChannelMap *map = &o->audio_channel_maps[VAR_0]; InputStream *ist = input_streams[ost->source_index]; if ((map->channel_idx == -1 || (ist->file_index == map->file_idx && ist->st->index == map->stream_idx)) && (map->ofile_idx == -1 || ost->file_index == map->ofile_idx) && (map->ostream_idx == -1 || ost->st->index == map->ostream_idx)) { if (ost->audio_channels_mapped < FF_ARRAY_ELEMS(ost->audio_channels_map)) ost->audio_channels_map[ost->audio_channels_mapped++] = map->channel_idx; else av_log(NULL, AV_LOG_FATAL, "Max channel mapping for output %d.%d reached\VAR_0", ost->file_index, ost->st->index); } } return ost; }
[ "static OutputStream *FUNC_0(OptionsContext *o, AVFormatContext *oc, int source_index)\n{", "int VAR_0;", "AVStream *st;", "OutputStream *ost;", "AVCodecContext *audio_enc;", "ost = new_output_stream(o, oc, AVMEDIA_TYPE_AUDIO, source_index);", "st = ost->st;", "audio_enc = st->codec;", "audio_enc->codec_type = AVMEDIA_TYPE_AUDIO;", "if (!ost->stream_copy) {", "char *VAR_1 = NULL;", "MATCH_PER_STREAM_OPT(audio_channels, i, audio_enc->channels, oc, st);", "MATCH_PER_STREAM_OPT(sample_fmts, str, VAR_1, oc, st);", "if (VAR_1 &&\n(audio_enc->VAR_1 = av_get_sample_fmt(VAR_1)) == AV_SAMPLE_FMT_NONE) {", "av_log(NULL, AV_LOG_FATAL, \"Invalid sample format '%s'\\VAR_0\", VAR_1);", "exit_program(1);", "}", "MATCH_PER_STREAM_OPT(audio_sample_rate, i, audio_enc->sample_rate, oc, st);", "ost->rematrix_volume=1.0;", "MATCH_PER_STREAM_OPT(rematrix_volume, f, ost->rematrix_volume, oc, st);", "}", "for (VAR_0 = 0; VAR_0 < o->nb_audio_channel_maps; VAR_0++) {", "AudioChannelMap *map = &o->audio_channel_maps[VAR_0];", "InputStream *ist = input_streams[ost->source_index];", "if ((map->channel_idx == -1 || (ist->file_index == map->file_idx && ist->st->index == map->stream_idx)) &&\n(map->ofile_idx == -1 || ost->file_index == map->ofile_idx) &&\n(map->ostream_idx == -1 || ost->st->index == map->ostream_idx)) {", "if (ost->audio_channels_mapped < FF_ARRAY_ELEMS(ost->audio_channels_map))\nost->audio_channels_map[ost->audio_channels_mapped++] = map->channel_idx;", "else\nav_log(NULL, AV_LOG_FATAL, \"Max channel mapping for output %d.%d reached\\VAR_0\",\nost->file_index, ost->st->index);", "}", "}", "return ost;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 33 ], [ 37 ], [ 39, 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 55 ], [ 57 ], [ 59 ], [ 65 ], [ 67 ], [ 69 ], [ 71, 73, 75 ], [ 77, 79 ], [ 81, 83, 85 ], [ 87 ], [ 89 ], [ 93 ], [ 95 ] ]
11,240
static void RENAME(uyvytoyuv422)(uint8_t *ydst, uint8_t *udst, uint8_t *vdst, const uint8_t *src, int width, int height, int lumStride, int chromStride, int srcStride) { int y; const int chromWidth = FF_CEIL_RSHIFT(width, 1); for (y=0; y<height; y++) { RENAME(extract_even)(src+1, ydst, width); RENAME(extract_even2)(src, udst, vdst, chromWidth); src += srcStride; ydst+= lumStride; udst+= chromStride; vdst+= chromStride; } __asm__( EMMS" \n\t" SFENCE" \n\t" ::: "memory" ); }
true
FFmpeg
1e3f77b53a803a6c63fa64829f1be557b8226288
static void RENAME(uyvytoyuv422)(uint8_t *ydst, uint8_t *udst, uint8_t *vdst, const uint8_t *src, int width, int height, int lumStride, int chromStride, int srcStride) { int y; const int chromWidth = FF_CEIL_RSHIFT(width, 1); for (y=0; y<height; y++) { RENAME(extract_even)(src+1, ydst, width); RENAME(extract_even2)(src, udst, vdst, chromWidth); src += srcStride; ydst+= lumStride; udst+= chromStride; vdst+= chromStride; } __asm__( EMMS" \n\t" SFENCE" \n\t" ::: "memory" ); }
{ "code": [ " RENAME(extract_even)(src+1, ydst, width);", " RENAME(extract_even)(src+1, ydst, width);" ], "line_no": [ 17, 17 ] }
static void FUNC_0(uyvytoyuv422)(uint8_t *ydst, uint8_t *udst, uint8_t *vdst, const uint8_t *src, int width, int height, int lumStride, int chromStride, int srcStride) { int VAR_0; const int VAR_1 = FF_CEIL_RSHIFT(width, 1); for (VAR_0=0; VAR_0<height; VAR_0++) { FUNC_0(extract_even)(src+1, ydst, width); FUNC_0(extract_even2)(src, udst, vdst, VAR_1); src += srcStride; ydst+= lumStride; udst+= chromStride; vdst+= chromStride; } __asm__( EMMS" \n\t" SFENCE" \n\t" ::: "memory" ); }
[ "static void FUNC_0(uyvytoyuv422)(uint8_t *ydst, uint8_t *udst, uint8_t *vdst, const uint8_t *src,\nint width, int height,\nint lumStride, int chromStride, int srcStride)\n{", "int VAR_0;", "const int VAR_1 = FF_CEIL_RSHIFT(width, 1);", "for (VAR_0=0; VAR_0<height; VAR_0++) {", "FUNC_0(extract_even)(src+1, ydst, width);", "FUNC_0(extract_even2)(src, udst, vdst, VAR_1);", "src += srcStride;", "ydst+= lumStride;", "udst+= chromStride;", "vdst+= chromStride;", "}", "__asm__(\nEMMS\" \\n\\t\"\nSFENCE\" \\n\\t\"\n::: \"memory\"\n);", "}" ]
[ 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33, 35, 37, 39, 41 ], [ 43 ] ]
11,242
uint64_t helper_subqv(CPUAlphaState *env, uint64_t op1, uint64_t op2) { uint64_t res; res = op1 - op2; if (unlikely((op1 ^ op2) & (res ^ op1) & (1ULL << 63))) { arith_excp(env, GETPC(), EXC_M_IOV, 0); } return res; }
true
qemu
4d1628e832dfc6ec02b0d196f6cc250aaa7bf3b3
uint64_t helper_subqv(CPUAlphaState *env, uint64_t op1, uint64_t op2) { uint64_t res; res = op1 - op2; if (unlikely((op1 ^ op2) & (res ^ op1) & (1ULL << 63))) { arith_excp(env, GETPC(), EXC_M_IOV, 0); } return res; }
{ "code": [ " arith_excp(env, GETPC(), EXC_M_IOV, 0);", "uint64_t helper_subqv(CPUAlphaState *env, uint64_t op1, uint64_t op2)", " uint64_t res;", " res = op1 - op2;", " if (unlikely((op1 ^ op2) & (res ^ op1) & (1ULL << 63))) {", " arith_excp(env, GETPC(), EXC_M_IOV, 0);", " return res;", " res = op1 - op2;", " arith_excp(env, GETPC(), EXC_M_IOV, 0);", " return res;", " arith_excp(env, GETPC(), EXC_M_IOV, 0);", " arith_excp(env, GETPC(), EXC_M_IOV, 0);" ], "line_no": [ 11, 1, 5, 7, 9, 11, 15, 7, 11, 15, 11, 11 ] }
uint64_t FUNC_0(CPUAlphaState *env, uint64_t op1, uint64_t op2) { uint64_t res; res = op1 - op2; if (unlikely((op1 ^ op2) & (res ^ op1) & (1ULL << 63))) { arith_excp(env, GETPC(), EXC_M_IOV, 0); } return res; }
[ "uint64_t FUNC_0(CPUAlphaState *env, uint64_t op1, uint64_t op2)\n{", "uint64_t res;", "res = op1 - op2;", "if (unlikely((op1 ^ op2) & (res ^ op1) & (1ULL << 63))) {", "arith_excp(env, GETPC(), EXC_M_IOV, 0);", "}", "return res;", "}" ]
[ 1, 1, 1, 1, 1, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ] ]
11,243
static int decode_idat_chunk(AVCodecContext *avctx, PNGDecContext *s, uint32_t length, AVFrame *p) { int ret; size_t byte_depth = s->bit_depth > 8 ? 2 : 1; if (!(s->state & PNG_IHDR)) { av_log(avctx, AV_LOG_ERROR, "IDAT without IHDR\n"); return AVERROR_INVALIDDATA; } if (!(s->state & PNG_IDAT)) { /* init image info */ avctx->width = s->width; avctx->height = s->height; s->channels = ff_png_get_nb_channels(s->color_type); s->bits_per_pixel = s->bit_depth * s->channels; s->bpp = (s->bits_per_pixel + 7) >> 3; s->row_size = (s->cur_w * s->bits_per_pixel + 7) >> 3; if ((s->bit_depth == 2 || s->bit_depth == 4 || s->bit_depth == 8) && s->color_type == PNG_COLOR_TYPE_RGB) { avctx->pix_fmt = AV_PIX_FMT_RGB24; } else if ((s->bit_depth == 2 || s->bit_depth == 4 || s->bit_depth == 8) && s->color_type == PNG_COLOR_TYPE_RGB_ALPHA) { avctx->pix_fmt = AV_PIX_FMT_RGBA; } else if ((s->bit_depth == 2 || s->bit_depth == 4 || s->bit_depth == 8) && s->color_type == PNG_COLOR_TYPE_GRAY) { avctx->pix_fmt = AV_PIX_FMT_GRAY8; } else if (s->bit_depth == 16 && s->color_type == PNG_COLOR_TYPE_GRAY) { avctx->pix_fmt = AV_PIX_FMT_GRAY16BE; } else if (s->bit_depth == 16 && s->color_type == PNG_COLOR_TYPE_RGB) { avctx->pix_fmt = AV_PIX_FMT_RGB48BE; } else if (s->bit_depth == 16 && s->color_type == PNG_COLOR_TYPE_RGB_ALPHA) { avctx->pix_fmt = AV_PIX_FMT_RGBA64BE; } else if ((s->bits_per_pixel == 1 || s->bits_per_pixel == 2 || s->bits_per_pixel == 4 || s->bits_per_pixel == 8) && s->color_type == PNG_COLOR_TYPE_PALETTE) { avctx->pix_fmt = AV_PIX_FMT_PAL8; } else if (s->bit_depth == 1 && s->bits_per_pixel == 1 && avctx->codec_id != AV_CODEC_ID_APNG) { avctx->pix_fmt = AV_PIX_FMT_MONOBLACK; } else if (s->bit_depth == 8 && s->color_type == PNG_COLOR_TYPE_GRAY_ALPHA) { avctx->pix_fmt = AV_PIX_FMT_YA8; } else if (s->bit_depth == 16 && s->color_type == PNG_COLOR_TYPE_GRAY_ALPHA) { avctx->pix_fmt = AV_PIX_FMT_YA16BE; } else { av_log(avctx, AV_LOG_ERROR, "unsupported bit depth %d " "and color type %d\n", s->bit_depth, s->color_type); return AVERROR_INVALIDDATA; } if (s->has_trns && s->color_type != PNG_COLOR_TYPE_PALETTE) { switch (avctx->pix_fmt) { case AV_PIX_FMT_RGB24: avctx->pix_fmt = AV_PIX_FMT_RGBA; break; case AV_PIX_FMT_RGB48BE: avctx->pix_fmt = AV_PIX_FMT_RGBA64BE; break; case AV_PIX_FMT_GRAY8: avctx->pix_fmt = AV_PIX_FMT_YA8; break; case AV_PIX_FMT_GRAY16BE: avctx->pix_fmt = AV_PIX_FMT_YA16BE; break; default: avpriv_request_sample(avctx, "bit depth %d " "and color type %d with TRNS", s->bit_depth, s->color_type); return AVERROR_INVALIDDATA; } s->bpp += byte_depth; } if ((ret = ff_thread_get_buffer(avctx, &s->picture, AV_GET_BUFFER_FLAG_REF)) < 0) return ret; if (avctx->codec_id == AV_CODEC_ID_APNG && s->last_dispose_op != APNG_DISPOSE_OP_PREVIOUS) { ff_thread_release_buffer(avctx, &s->previous_picture); if ((ret = ff_thread_get_buffer(avctx, &s->previous_picture, AV_GET_BUFFER_FLAG_REF)) < 0) return ret; } ff_thread_finish_setup(avctx); p->pict_type = AV_PICTURE_TYPE_I; p->key_frame = 1; p->interlaced_frame = !!s->interlace_type; /* compute the compressed row size */ if (!s->interlace_type) { s->crow_size = s->row_size + 1; } else { s->pass = 0; s->pass_row_size = ff_png_pass_row_size(s->pass, s->bits_per_pixel, s->cur_w); s->crow_size = s->pass_row_size + 1; } ff_dlog(avctx, "row_size=%d crow_size =%d\n", s->row_size, s->crow_size); s->image_buf = p->data[0]; s->image_linesize = p->linesize[0]; /* copy the palette if needed */ if (avctx->pix_fmt == AV_PIX_FMT_PAL8) memcpy(p->data[1], s->palette, 256 * sizeof(uint32_t)); /* empty row is used if differencing to the first row */ av_fast_padded_mallocz(&s->last_row, &s->last_row_size, s->row_size); if (!s->last_row) return AVERROR_INVALIDDATA; if (s->interlace_type || s->color_type == PNG_COLOR_TYPE_RGB_ALPHA) { av_fast_padded_malloc(&s->tmp_row, &s->tmp_row_size, s->row_size); if (!s->tmp_row) return AVERROR_INVALIDDATA; } /* compressed row */ av_fast_padded_malloc(&s->buffer, &s->buffer_size, s->row_size + 16); if (!s->buffer) return AVERROR(ENOMEM); /* we want crow_buf+1 to be 16-byte aligned */ s->crow_buf = s->buffer + 15; s->zstream.avail_out = s->crow_size; s->zstream.next_out = s->crow_buf; } s->state |= PNG_IDAT; /* set image to non-transparent bpp while decompressing */ if (s->has_trns && s->color_type != PNG_COLOR_TYPE_PALETTE) s->bpp -= byte_depth; ret = png_decode_idat(s, length); if (s->has_trns && s->color_type != PNG_COLOR_TYPE_PALETTE) s->bpp += byte_depth; if (ret < 0) return ret; bytestream2_skip(&s->gb, 4); /* crc */ return 0; }
true
FFmpeg
478f1c3d5e5463a284ea7efecfc62d47ba3be11a
static int decode_idat_chunk(AVCodecContext *avctx, PNGDecContext *s, uint32_t length, AVFrame *p) { int ret; size_t byte_depth = s->bit_depth > 8 ? 2 : 1; if (!(s->state & PNG_IHDR)) { av_log(avctx, AV_LOG_ERROR, "IDAT without IHDR\n"); return AVERROR_INVALIDDATA; } if (!(s->state & PNG_IDAT)) { avctx->width = s->width; avctx->height = s->height; s->channels = ff_png_get_nb_channels(s->color_type); s->bits_per_pixel = s->bit_depth * s->channels; s->bpp = (s->bits_per_pixel + 7) >> 3; s->row_size = (s->cur_w * s->bits_per_pixel + 7) >> 3; if ((s->bit_depth == 2 || s->bit_depth == 4 || s->bit_depth == 8) && s->color_type == PNG_COLOR_TYPE_RGB) { avctx->pix_fmt = AV_PIX_FMT_RGB24; } else if ((s->bit_depth == 2 || s->bit_depth == 4 || s->bit_depth == 8) && s->color_type == PNG_COLOR_TYPE_RGB_ALPHA) { avctx->pix_fmt = AV_PIX_FMT_RGBA; } else if ((s->bit_depth == 2 || s->bit_depth == 4 || s->bit_depth == 8) && s->color_type == PNG_COLOR_TYPE_GRAY) { avctx->pix_fmt = AV_PIX_FMT_GRAY8; } else if (s->bit_depth == 16 && s->color_type == PNG_COLOR_TYPE_GRAY) { avctx->pix_fmt = AV_PIX_FMT_GRAY16BE; } else if (s->bit_depth == 16 && s->color_type == PNG_COLOR_TYPE_RGB) { avctx->pix_fmt = AV_PIX_FMT_RGB48BE; } else if (s->bit_depth == 16 && s->color_type == PNG_COLOR_TYPE_RGB_ALPHA) { avctx->pix_fmt = AV_PIX_FMT_RGBA64BE; } else if ((s->bits_per_pixel == 1 || s->bits_per_pixel == 2 || s->bits_per_pixel == 4 || s->bits_per_pixel == 8) && s->color_type == PNG_COLOR_TYPE_PALETTE) { avctx->pix_fmt = AV_PIX_FMT_PAL8; } else if (s->bit_depth == 1 && s->bits_per_pixel == 1 && avctx->codec_id != AV_CODEC_ID_APNG) { avctx->pix_fmt = AV_PIX_FMT_MONOBLACK; } else if (s->bit_depth == 8 && s->color_type == PNG_COLOR_TYPE_GRAY_ALPHA) { avctx->pix_fmt = AV_PIX_FMT_YA8; } else if (s->bit_depth == 16 && s->color_type == PNG_COLOR_TYPE_GRAY_ALPHA) { avctx->pix_fmt = AV_PIX_FMT_YA16BE; } else { av_log(avctx, AV_LOG_ERROR, "unsupported bit depth %d " "and color type %d\n", s->bit_depth, s->color_type); return AVERROR_INVALIDDATA; } if (s->has_trns && s->color_type != PNG_COLOR_TYPE_PALETTE) { switch (avctx->pix_fmt) { case AV_PIX_FMT_RGB24: avctx->pix_fmt = AV_PIX_FMT_RGBA; break; case AV_PIX_FMT_RGB48BE: avctx->pix_fmt = AV_PIX_FMT_RGBA64BE; break; case AV_PIX_FMT_GRAY8: avctx->pix_fmt = AV_PIX_FMT_YA8; break; case AV_PIX_FMT_GRAY16BE: avctx->pix_fmt = AV_PIX_FMT_YA16BE; break; default: avpriv_request_sample(avctx, "bit depth %d " "and color type %d with TRNS", s->bit_depth, s->color_type); return AVERROR_INVALIDDATA; } s->bpp += byte_depth; } if ((ret = ff_thread_get_buffer(avctx, &s->picture, AV_GET_BUFFER_FLAG_REF)) < 0) return ret; if (avctx->codec_id == AV_CODEC_ID_APNG && s->last_dispose_op != APNG_DISPOSE_OP_PREVIOUS) { ff_thread_release_buffer(avctx, &s->previous_picture); if ((ret = ff_thread_get_buffer(avctx, &s->previous_picture, AV_GET_BUFFER_FLAG_REF)) < 0) return ret; } ff_thread_finish_setup(avctx); p->pict_type = AV_PICTURE_TYPE_I; p->key_frame = 1; p->interlaced_frame = !!s->interlace_type; if (!s->interlace_type) { s->crow_size = s->row_size + 1; } else { s->pass = 0; s->pass_row_size = ff_png_pass_row_size(s->pass, s->bits_per_pixel, s->cur_w); s->crow_size = s->pass_row_size + 1; } ff_dlog(avctx, "row_size=%d crow_size =%d\n", s->row_size, s->crow_size); s->image_buf = p->data[0]; s->image_linesize = p->linesize[0]; if (avctx->pix_fmt == AV_PIX_FMT_PAL8) memcpy(p->data[1], s->palette, 256 * sizeof(uint32_t)); av_fast_padded_mallocz(&s->last_row, &s->last_row_size, s->row_size); if (!s->last_row) return AVERROR_INVALIDDATA; if (s->interlace_type || s->color_type == PNG_COLOR_TYPE_RGB_ALPHA) { av_fast_padded_malloc(&s->tmp_row, &s->tmp_row_size, s->row_size); if (!s->tmp_row) return AVERROR_INVALIDDATA; } av_fast_padded_malloc(&s->buffer, &s->buffer_size, s->row_size + 16); if (!s->buffer) return AVERROR(ENOMEM); s->crow_buf = s->buffer + 15; s->zstream.avail_out = s->crow_size; s->zstream.next_out = s->crow_buf; } s->state |= PNG_IDAT; if (s->has_trns && s->color_type != PNG_COLOR_TYPE_PALETTE) s->bpp -= byte_depth; ret = png_decode_idat(s, length); if (s->has_trns && s->color_type != PNG_COLOR_TYPE_PALETTE) s->bpp += byte_depth; if (ret < 0) return ret; bytestream2_skip(&s->gb, 4); return 0; }
{ "code": [ " if (!(s->state & PNG_IHDR)) {", " if (!(s->state & PNG_IDAT)) {", " s->state |= PNG_IDAT;", " if (!(s->state & PNG_IHDR)) {", " if (!(s->state & PNG_IHDR)) {", " if (!(s->state & PNG_IHDR)) {" ], "line_no": [ 13, 21, 271, 13, 13, 13 ] }
static int FUNC_0(AVCodecContext *VAR_0, PNGDecContext *VAR_1, uint32_t VAR_2, AVFrame *VAR_3) { int VAR_4; size_t byte_depth = VAR_1->bit_depth > 8 ? 2 : 1; if (!(VAR_1->state & PNG_IHDR)) { av_log(VAR_0, AV_LOG_ERROR, "IDAT without IHDR\n"); return AVERROR_INVALIDDATA; } if (!(VAR_1->state & PNG_IDAT)) { VAR_0->width = VAR_1->width; VAR_0->height = VAR_1->height; VAR_1->channels = ff_png_get_nb_channels(VAR_1->color_type); VAR_1->bits_per_pixel = VAR_1->bit_depth * VAR_1->channels; VAR_1->bpp = (VAR_1->bits_per_pixel + 7) >> 3; VAR_1->row_size = (VAR_1->cur_w * VAR_1->bits_per_pixel + 7) >> 3; if ((VAR_1->bit_depth == 2 || VAR_1->bit_depth == 4 || VAR_1->bit_depth == 8) && VAR_1->color_type == PNG_COLOR_TYPE_RGB) { VAR_0->pix_fmt = AV_PIX_FMT_RGB24; } else if ((VAR_1->bit_depth == 2 || VAR_1->bit_depth == 4 || VAR_1->bit_depth == 8) && VAR_1->color_type == PNG_COLOR_TYPE_RGB_ALPHA) { VAR_0->pix_fmt = AV_PIX_FMT_RGBA; } else if ((VAR_1->bit_depth == 2 || VAR_1->bit_depth == 4 || VAR_1->bit_depth == 8) && VAR_1->color_type == PNG_COLOR_TYPE_GRAY) { VAR_0->pix_fmt = AV_PIX_FMT_GRAY8; } else if (VAR_1->bit_depth == 16 && VAR_1->color_type == PNG_COLOR_TYPE_GRAY) { VAR_0->pix_fmt = AV_PIX_FMT_GRAY16BE; } else if (VAR_1->bit_depth == 16 && VAR_1->color_type == PNG_COLOR_TYPE_RGB) { VAR_0->pix_fmt = AV_PIX_FMT_RGB48BE; } else if (VAR_1->bit_depth == 16 && VAR_1->color_type == PNG_COLOR_TYPE_RGB_ALPHA) { VAR_0->pix_fmt = AV_PIX_FMT_RGBA64BE; } else if ((VAR_1->bits_per_pixel == 1 || VAR_1->bits_per_pixel == 2 || VAR_1->bits_per_pixel == 4 || VAR_1->bits_per_pixel == 8) && VAR_1->color_type == PNG_COLOR_TYPE_PALETTE) { VAR_0->pix_fmt = AV_PIX_FMT_PAL8; } else if (VAR_1->bit_depth == 1 && VAR_1->bits_per_pixel == 1 && VAR_0->codec_id != AV_CODEC_ID_APNG) { VAR_0->pix_fmt = AV_PIX_FMT_MONOBLACK; } else if (VAR_1->bit_depth == 8 && VAR_1->color_type == PNG_COLOR_TYPE_GRAY_ALPHA) { VAR_0->pix_fmt = AV_PIX_FMT_YA8; } else if (VAR_1->bit_depth == 16 && VAR_1->color_type == PNG_COLOR_TYPE_GRAY_ALPHA) { VAR_0->pix_fmt = AV_PIX_FMT_YA16BE; } else { av_log(VAR_0, AV_LOG_ERROR, "unsupported bit depth %d " "and color type %d\n", VAR_1->bit_depth, VAR_1->color_type); return AVERROR_INVALIDDATA; } if (VAR_1->has_trns && VAR_1->color_type != PNG_COLOR_TYPE_PALETTE) { switch (VAR_0->pix_fmt) { case AV_PIX_FMT_RGB24: VAR_0->pix_fmt = AV_PIX_FMT_RGBA; break; case AV_PIX_FMT_RGB48BE: VAR_0->pix_fmt = AV_PIX_FMT_RGBA64BE; break; case AV_PIX_FMT_GRAY8: VAR_0->pix_fmt = AV_PIX_FMT_YA8; break; case AV_PIX_FMT_GRAY16BE: VAR_0->pix_fmt = AV_PIX_FMT_YA16BE; break; default: avpriv_request_sample(VAR_0, "bit depth %d " "and color type %d with TRNS", VAR_1->bit_depth, VAR_1->color_type); return AVERROR_INVALIDDATA; } VAR_1->bpp += byte_depth; } if ((VAR_4 = ff_thread_get_buffer(VAR_0, &VAR_1->picture, AV_GET_BUFFER_FLAG_REF)) < 0) return VAR_4; if (VAR_0->codec_id == AV_CODEC_ID_APNG && VAR_1->last_dispose_op != APNG_DISPOSE_OP_PREVIOUS) { ff_thread_release_buffer(VAR_0, &VAR_1->previous_picture); if ((VAR_4 = ff_thread_get_buffer(VAR_0, &VAR_1->previous_picture, AV_GET_BUFFER_FLAG_REF)) < 0) return VAR_4; } ff_thread_finish_setup(VAR_0); VAR_3->pict_type = AV_PICTURE_TYPE_I; VAR_3->key_frame = 1; VAR_3->interlaced_frame = !!VAR_1->interlace_type; if (!VAR_1->interlace_type) { VAR_1->crow_size = VAR_1->row_size + 1; } else { VAR_1->pass = 0; VAR_1->pass_row_size = ff_png_pass_row_size(VAR_1->pass, VAR_1->bits_per_pixel, VAR_1->cur_w); VAR_1->crow_size = VAR_1->pass_row_size + 1; } ff_dlog(VAR_0, "row_size=%d crow_size =%d\n", VAR_1->row_size, VAR_1->crow_size); VAR_1->image_buf = VAR_3->data[0]; VAR_1->image_linesize = VAR_3->linesize[0]; if (VAR_0->pix_fmt == AV_PIX_FMT_PAL8) memcpy(VAR_3->data[1], VAR_1->palette, 256 * sizeof(uint32_t)); av_fast_padded_mallocz(&VAR_1->last_row, &VAR_1->last_row_size, VAR_1->row_size); if (!VAR_1->last_row) return AVERROR_INVALIDDATA; if (VAR_1->interlace_type || VAR_1->color_type == PNG_COLOR_TYPE_RGB_ALPHA) { av_fast_padded_malloc(&VAR_1->tmp_row, &VAR_1->tmp_row_size, VAR_1->row_size); if (!VAR_1->tmp_row) return AVERROR_INVALIDDATA; } av_fast_padded_malloc(&VAR_1->buffer, &VAR_1->buffer_size, VAR_1->row_size + 16); if (!VAR_1->buffer) return AVERROR(ENOMEM); VAR_1->crow_buf = VAR_1->buffer + 15; VAR_1->zstream.avail_out = VAR_1->crow_size; VAR_1->zstream.next_out = VAR_1->crow_buf; } VAR_1->state |= PNG_IDAT; if (VAR_1->has_trns && VAR_1->color_type != PNG_COLOR_TYPE_PALETTE) VAR_1->bpp -= byte_depth; VAR_4 = png_decode_idat(VAR_1, VAR_2); if (VAR_1->has_trns && VAR_1->color_type != PNG_COLOR_TYPE_PALETTE) VAR_1->bpp += byte_depth; if (VAR_4 < 0) return VAR_4; bytestream2_skip(&VAR_1->gb, 4); return 0; }
[ "static int FUNC_0(AVCodecContext *VAR_0, PNGDecContext *VAR_1,\nuint32_t VAR_2, AVFrame *VAR_3)\n{", "int VAR_4;", "size_t byte_depth = VAR_1->bit_depth > 8 ? 2 : 1;", "if (!(VAR_1->state & PNG_IHDR)) {", "av_log(VAR_0, AV_LOG_ERROR, \"IDAT without IHDR\\n\");", "return AVERROR_INVALIDDATA;", "}", "if (!(VAR_1->state & PNG_IDAT)) {", "VAR_0->width = VAR_1->width;", "VAR_0->height = VAR_1->height;", "VAR_1->channels = ff_png_get_nb_channels(VAR_1->color_type);", "VAR_1->bits_per_pixel = VAR_1->bit_depth * VAR_1->channels;", "VAR_1->bpp = (VAR_1->bits_per_pixel + 7) >> 3;", "VAR_1->row_size = (VAR_1->cur_w * VAR_1->bits_per_pixel + 7) >> 3;", "if ((VAR_1->bit_depth == 2 || VAR_1->bit_depth == 4 || VAR_1->bit_depth == 8) &&\nVAR_1->color_type == PNG_COLOR_TYPE_RGB) {", "VAR_0->pix_fmt = AV_PIX_FMT_RGB24;", "} else if ((VAR_1->bit_depth == 2 || VAR_1->bit_depth == 4 || VAR_1->bit_depth == 8) &&", "VAR_1->color_type == PNG_COLOR_TYPE_RGB_ALPHA) {", "VAR_0->pix_fmt = AV_PIX_FMT_RGBA;", "} else if ((VAR_1->bit_depth == 2 || VAR_1->bit_depth == 4 || VAR_1->bit_depth == 8) &&", "VAR_1->color_type == PNG_COLOR_TYPE_GRAY) {", "VAR_0->pix_fmt = AV_PIX_FMT_GRAY8;", "} else if (VAR_1->bit_depth == 16 &&", "VAR_1->color_type == PNG_COLOR_TYPE_GRAY) {", "VAR_0->pix_fmt = AV_PIX_FMT_GRAY16BE;", "} else if (VAR_1->bit_depth == 16 &&", "VAR_1->color_type == PNG_COLOR_TYPE_RGB) {", "VAR_0->pix_fmt = AV_PIX_FMT_RGB48BE;", "} else if (VAR_1->bit_depth == 16 &&", "VAR_1->color_type == PNG_COLOR_TYPE_RGB_ALPHA) {", "VAR_0->pix_fmt = AV_PIX_FMT_RGBA64BE;", "} else if ((VAR_1->bits_per_pixel == 1 || VAR_1->bits_per_pixel == 2 || VAR_1->bits_per_pixel == 4 || VAR_1->bits_per_pixel == 8) &&", "VAR_1->color_type == PNG_COLOR_TYPE_PALETTE) {", "VAR_0->pix_fmt = AV_PIX_FMT_PAL8;", "} else if (VAR_1->bit_depth == 1 && VAR_1->bits_per_pixel == 1 && VAR_0->codec_id != AV_CODEC_ID_APNG) {", "VAR_0->pix_fmt = AV_PIX_FMT_MONOBLACK;", "} else if (VAR_1->bit_depth == 8 &&", "VAR_1->color_type == PNG_COLOR_TYPE_GRAY_ALPHA) {", "VAR_0->pix_fmt = AV_PIX_FMT_YA8;", "} else if (VAR_1->bit_depth == 16 &&", "VAR_1->color_type == PNG_COLOR_TYPE_GRAY_ALPHA) {", "VAR_0->pix_fmt = AV_PIX_FMT_YA16BE;", "} else {", "av_log(VAR_0, AV_LOG_ERROR, \"unsupported bit depth %d \"\n\"and color type %d\\n\",\nVAR_1->bit_depth, VAR_1->color_type);", "return AVERROR_INVALIDDATA;", "}", "if (VAR_1->has_trns && VAR_1->color_type != PNG_COLOR_TYPE_PALETTE) {", "switch (VAR_0->pix_fmt) {", "case AV_PIX_FMT_RGB24:\nVAR_0->pix_fmt = AV_PIX_FMT_RGBA;", "break;", "case AV_PIX_FMT_RGB48BE:\nVAR_0->pix_fmt = AV_PIX_FMT_RGBA64BE;", "break;", "case AV_PIX_FMT_GRAY8:\nVAR_0->pix_fmt = AV_PIX_FMT_YA8;", "break;", "case AV_PIX_FMT_GRAY16BE:\nVAR_0->pix_fmt = AV_PIX_FMT_YA16BE;", "break;", "default:\navpriv_request_sample(VAR_0, \"bit depth %d \"\n\"and color type %d with TRNS\",\nVAR_1->bit_depth, VAR_1->color_type);", "return AVERROR_INVALIDDATA;", "}", "VAR_1->bpp += byte_depth;", "}", "if ((VAR_4 = ff_thread_get_buffer(VAR_0, &VAR_1->picture, AV_GET_BUFFER_FLAG_REF)) < 0)\nreturn VAR_4;", "if (VAR_0->codec_id == AV_CODEC_ID_APNG && VAR_1->last_dispose_op != APNG_DISPOSE_OP_PREVIOUS) {", "ff_thread_release_buffer(VAR_0, &VAR_1->previous_picture);", "if ((VAR_4 = ff_thread_get_buffer(VAR_0, &VAR_1->previous_picture, AV_GET_BUFFER_FLAG_REF)) < 0)\nreturn VAR_4;", "}", "ff_thread_finish_setup(VAR_0);", "VAR_3->pict_type = AV_PICTURE_TYPE_I;", "VAR_3->key_frame = 1;", "VAR_3->interlaced_frame = !!VAR_1->interlace_type;", "if (!VAR_1->interlace_type) {", "VAR_1->crow_size = VAR_1->row_size + 1;", "} else {", "VAR_1->pass = 0;", "VAR_1->pass_row_size = ff_png_pass_row_size(VAR_1->pass,\nVAR_1->bits_per_pixel,\nVAR_1->cur_w);", "VAR_1->crow_size = VAR_1->pass_row_size + 1;", "}", "ff_dlog(VAR_0, \"row_size=%d crow_size =%d\\n\",\nVAR_1->row_size, VAR_1->crow_size);", "VAR_1->image_buf = VAR_3->data[0];", "VAR_1->image_linesize = VAR_3->linesize[0];", "if (VAR_0->pix_fmt == AV_PIX_FMT_PAL8)\nmemcpy(VAR_3->data[1], VAR_1->palette, 256 * sizeof(uint32_t));", "av_fast_padded_mallocz(&VAR_1->last_row, &VAR_1->last_row_size, VAR_1->row_size);", "if (!VAR_1->last_row)\nreturn AVERROR_INVALIDDATA;", "if (VAR_1->interlace_type ||\nVAR_1->color_type == PNG_COLOR_TYPE_RGB_ALPHA) {", "av_fast_padded_malloc(&VAR_1->tmp_row, &VAR_1->tmp_row_size, VAR_1->row_size);", "if (!VAR_1->tmp_row)\nreturn AVERROR_INVALIDDATA;", "}", "av_fast_padded_malloc(&VAR_1->buffer, &VAR_1->buffer_size, VAR_1->row_size + 16);", "if (!VAR_1->buffer)\nreturn AVERROR(ENOMEM);", "VAR_1->crow_buf = VAR_1->buffer + 15;", "VAR_1->zstream.avail_out = VAR_1->crow_size;", "VAR_1->zstream.next_out = VAR_1->crow_buf;", "}", "VAR_1->state |= PNG_IDAT;", "if (VAR_1->has_trns && VAR_1->color_type != PNG_COLOR_TYPE_PALETTE)\nVAR_1->bpp -= byte_depth;", "VAR_4 = png_decode_idat(VAR_1, VAR_2);", "if (VAR_1->has_trns && VAR_1->color_type != PNG_COLOR_TYPE_PALETTE)\nVAR_1->bpp += byte_depth;", "if (VAR_4 < 0)\nreturn VAR_4;", "bytestream2_skip(&VAR_1->gb, 4);", "return 0;", "}" ]
[ 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41, 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101, 103, 105 ], [ 107 ], [ 109 ], [ 113 ], [ 115 ], [ 117, 119 ], [ 121 ], [ 125, 127 ], [ 129 ], [ 133, 135 ], [ 137 ], [ 141, 143 ], [ 145 ], [ 149, 151, 153, 155 ], [ 157 ], [ 159 ], [ 163 ], [ 165 ], [ 169, 171 ], [ 173 ], [ 175 ], [ 177, 179 ], [ 181 ], [ 183 ], [ 187 ], [ 189 ], [ 191 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205, 207, 209 ], [ 211 ], [ 213 ], [ 215, 217 ], [ 219 ], [ 221 ], [ 225, 227 ], [ 231 ], [ 233, 235 ], [ 237, 239 ], [ 241 ], [ 243, 245 ], [ 247 ], [ 251 ], [ 253, 255 ], [ 261 ], [ 263 ], [ 265 ], [ 267 ], [ 271 ], [ 277, 279 ], [ 283 ], [ 287, 289 ], [ 293, 295 ], [ 299 ], [ 303 ], [ 305 ] ]
11,244
static void qxl_render_update_area_unlocked(PCIQXLDevice *qxl) { VGACommonState *vga = &qxl->vga; DisplaySurface *surface; int i; if (qxl->guest_primary.resized) { qxl->guest_primary.resized = 0; qxl->guest_primary.data = qxl_phys2virt(qxl, qxl->guest_primary.surface.mem, MEMSLOT_GROUP_GUEST); if (!qxl->guest_primary.data) { return; } qxl_set_rect_to_surface(qxl, &qxl->dirty[0]); qxl->num_dirty_rects = 1; trace_qxl_render_guest_primary_resized( qxl->guest_primary.surface.width, qxl->guest_primary.surface.height, qxl->guest_primary.qxl_stride, qxl->guest_primary.bytes_pp, qxl->guest_primary.bits_pp); if (qxl->guest_primary.qxl_stride > 0) { surface = qemu_create_displaysurface_from (qxl->guest_primary.surface.width, qxl->guest_primary.surface.height, qxl->guest_primary.bits_pp, qxl->guest_primary.abs_stride, qxl->guest_primary.data, false); } else { surface = qemu_create_displaysurface (qxl->guest_primary.surface.width, qxl->guest_primary.surface.height); } dpy_gfx_replace_surface(vga->con, surface); } if (!qxl->guest_primary.data) { return; } for (i = 0; i < qxl->num_dirty_rects; i++) { if (qemu_spice_rect_is_empty(qxl->dirty+i)) { break; } if (qxl->dirty[i].left > qxl->dirty[i].right || qxl->dirty[i].top > qxl->dirty[i].bottom || qxl->dirty[i].right > qxl->guest_primary.surface.width || qxl->dirty[i].bottom > qxl->guest_primary.surface.height) { continue; } qxl_blit(qxl, qxl->dirty+i); dpy_gfx_update(vga->con, qxl->dirty[i].left, qxl->dirty[i].top, qxl->dirty[i].right - qxl->dirty[i].left, qxl->dirty[i].bottom - qxl->dirty[i].top); } qxl->num_dirty_rects = 0; }
true
qemu
503b3b33feca818baa4459aba286e54a528e5567
static void qxl_render_update_area_unlocked(PCIQXLDevice *qxl) { VGACommonState *vga = &qxl->vga; DisplaySurface *surface; int i; if (qxl->guest_primary.resized) { qxl->guest_primary.resized = 0; qxl->guest_primary.data = qxl_phys2virt(qxl, qxl->guest_primary.surface.mem, MEMSLOT_GROUP_GUEST); if (!qxl->guest_primary.data) { return; } qxl_set_rect_to_surface(qxl, &qxl->dirty[0]); qxl->num_dirty_rects = 1; trace_qxl_render_guest_primary_resized( qxl->guest_primary.surface.width, qxl->guest_primary.surface.height, qxl->guest_primary.qxl_stride, qxl->guest_primary.bytes_pp, qxl->guest_primary.bits_pp); if (qxl->guest_primary.qxl_stride > 0) { surface = qemu_create_displaysurface_from (qxl->guest_primary.surface.width, qxl->guest_primary.surface.height, qxl->guest_primary.bits_pp, qxl->guest_primary.abs_stride, qxl->guest_primary.data, false); } else { surface = qemu_create_displaysurface (qxl->guest_primary.surface.width, qxl->guest_primary.surface.height); } dpy_gfx_replace_surface(vga->con, surface); } if (!qxl->guest_primary.data) { return; } for (i = 0; i < qxl->num_dirty_rects; i++) { if (qemu_spice_rect_is_empty(qxl->dirty+i)) { break; } if (qxl->dirty[i].left > qxl->dirty[i].right || qxl->dirty[i].top > qxl->dirty[i].bottom || qxl->dirty[i].right > qxl->guest_primary.surface.width || qxl->dirty[i].bottom > qxl->guest_primary.surface.height) { continue; } qxl_blit(qxl, qxl->dirty+i); dpy_gfx_update(vga->con, qxl->dirty[i].left, qxl->dirty[i].top, qxl->dirty[i].right - qxl->dirty[i].left, qxl->dirty[i].bottom - qxl->dirty[i].top); } qxl->num_dirty_rects = 0; }
{ "code": [ " if (qxl->dirty[i].left > qxl->dirty[i].right ||" ], "line_no": [ 91 ] }
static void FUNC_0(PCIQXLDevice *VAR_0) { VGACommonState *vga = &VAR_0->vga; DisplaySurface *surface; int VAR_1; if (VAR_0->guest_primary.resized) { VAR_0->guest_primary.resized = 0; VAR_0->guest_primary.data = qxl_phys2virt(VAR_0, VAR_0->guest_primary.surface.mem, MEMSLOT_GROUP_GUEST); if (!VAR_0->guest_primary.data) { return; } qxl_set_rect_to_surface(VAR_0, &VAR_0->dirty[0]); VAR_0->num_dirty_rects = 1; trace_qxl_render_guest_primary_resized( VAR_0->guest_primary.surface.width, VAR_0->guest_primary.surface.height, VAR_0->guest_primary.qxl_stride, VAR_0->guest_primary.bytes_pp, VAR_0->guest_primary.bits_pp); if (VAR_0->guest_primary.qxl_stride > 0) { surface = qemu_create_displaysurface_from (VAR_0->guest_primary.surface.width, VAR_0->guest_primary.surface.height, VAR_0->guest_primary.bits_pp, VAR_0->guest_primary.abs_stride, VAR_0->guest_primary.data, false); } else { surface = qemu_create_displaysurface (VAR_0->guest_primary.surface.width, VAR_0->guest_primary.surface.height); } dpy_gfx_replace_surface(vga->con, surface); } if (!VAR_0->guest_primary.data) { return; } for (VAR_1 = 0; VAR_1 < VAR_0->num_dirty_rects; VAR_1++) { if (qemu_spice_rect_is_empty(VAR_0->dirty+VAR_1)) { break; } if (VAR_0->dirty[VAR_1].left > VAR_0->dirty[VAR_1].right || VAR_0->dirty[VAR_1].top > VAR_0->dirty[VAR_1].bottom || VAR_0->dirty[VAR_1].right > VAR_0->guest_primary.surface.width || VAR_0->dirty[VAR_1].bottom > VAR_0->guest_primary.surface.height) { continue; } qxl_blit(VAR_0, VAR_0->dirty+VAR_1); dpy_gfx_update(vga->con, VAR_0->dirty[VAR_1].left, VAR_0->dirty[VAR_1].top, VAR_0->dirty[VAR_1].right - VAR_0->dirty[VAR_1].left, VAR_0->dirty[VAR_1].bottom - VAR_0->dirty[VAR_1].top); } VAR_0->num_dirty_rects = 0; }
[ "static void FUNC_0(PCIQXLDevice *VAR_0)\n{", "VGACommonState *vga = &VAR_0->vga;", "DisplaySurface *surface;", "int VAR_1;", "if (VAR_0->guest_primary.resized) {", "VAR_0->guest_primary.resized = 0;", "VAR_0->guest_primary.data = qxl_phys2virt(VAR_0,\nVAR_0->guest_primary.surface.mem,\nMEMSLOT_GROUP_GUEST);", "if (!VAR_0->guest_primary.data) {", "return;", "}", "qxl_set_rect_to_surface(VAR_0, &VAR_0->dirty[0]);", "VAR_0->num_dirty_rects = 1;", "trace_qxl_render_guest_primary_resized(\nVAR_0->guest_primary.surface.width,\nVAR_0->guest_primary.surface.height,\nVAR_0->guest_primary.qxl_stride,\nVAR_0->guest_primary.bytes_pp,\nVAR_0->guest_primary.bits_pp);", "if (VAR_0->guest_primary.qxl_stride > 0) {", "surface = qemu_create_displaysurface_from\n(VAR_0->guest_primary.surface.width,\nVAR_0->guest_primary.surface.height,\nVAR_0->guest_primary.bits_pp,\nVAR_0->guest_primary.abs_stride,\nVAR_0->guest_primary.data,\nfalse);", "} else {", "surface = qemu_create_displaysurface\n(VAR_0->guest_primary.surface.width,\nVAR_0->guest_primary.surface.height);", "}", "dpy_gfx_replace_surface(vga->con, surface);", "}", "if (!VAR_0->guest_primary.data) {", "return;", "}", "for (VAR_1 = 0; VAR_1 < VAR_0->num_dirty_rects; VAR_1++) {", "if (qemu_spice_rect_is_empty(VAR_0->dirty+VAR_1)) {", "break;", "}", "if (VAR_0->dirty[VAR_1].left > VAR_0->dirty[VAR_1].right ||\nVAR_0->dirty[VAR_1].top > VAR_0->dirty[VAR_1].bottom ||\nVAR_0->dirty[VAR_1].right > VAR_0->guest_primary.surface.width ||\nVAR_0->dirty[VAR_1].bottom > VAR_0->guest_primary.surface.height) {", "continue;", "}", "qxl_blit(VAR_0, VAR_0->dirty+VAR_1);", "dpy_gfx_update(vga->con,\nVAR_0->dirty[VAR_1].left, VAR_0->dirty[VAR_1].top,\nVAR_0->dirty[VAR_1].right - VAR_0->dirty[VAR_1].left,\nVAR_0->dirty[VAR_1].bottom - VAR_0->dirty[VAR_1].top);", "}", "VAR_0->num_dirty_rects = 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17, 19, 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33, 35, 37, 39, 41, 43 ], [ 45 ], [ 47, 49, 51, 53, 55, 57, 59 ], [ 61 ], [ 63, 65, 67 ], [ 69 ], [ 71 ], [ 73 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91, 93, 95, 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105, 107, 109, 111 ], [ 113 ], [ 115 ], [ 117 ] ]
11,245
void vga_common_init(VGAState *s, DisplayState *ds, uint8_t *vga_ram_base, ram_addr_t vga_ram_offset, int vga_ram_size) { int i, j, v, b; for(i = 0;i < 256; i++) { v = 0; for(j = 0; j < 8; j++) { v |= ((i >> j) & 1) << (j * 4); } expand4[i] = v; v = 0; for(j = 0; j < 4; j++) { v |= ((i >> (2 * j)) & 3) << (j * 4); } expand2[i] = v; } for(i = 0; i < 16; i++) { v = 0; for(j = 0; j < 4; j++) { b = ((i >> j) & 1); v |= b << (2 * j); v |= b << (2 * j + 1); } expand4to8[i] = v; } s->vram_ptr = vga_ram_base; s->vram_offset = vga_ram_offset; s->vram_size = vga_ram_size; s->ds = ds; s->get_bpp = vga_get_bpp; s->get_offsets = vga_get_offsets; s->get_resolution = vga_get_resolution; s->update = vga_update_display; s->invalidate = vga_invalidate_display; s->screen_dump = vga_screen_dump; s->text_update = vga_update_text; switch (vga_retrace_method) { case VGA_RETRACE_DUMB: s->retrace = vga_dumb_retrace; s->update_retrace_info = vga_dumb_update_retrace_info; break; case VGA_RETRACE_PRECISE: s->retrace = vga_precise_retrace; s->update_retrace_info = vga_precise_update_retrace_info; break; } qemu_register_reset(vga_reset, s); vga_reset(s); }
true
qemu
4abc796d41ee01a698032e74ac17c1cdc5d290c3
void vga_common_init(VGAState *s, DisplayState *ds, uint8_t *vga_ram_base, ram_addr_t vga_ram_offset, int vga_ram_size) { int i, j, v, b; for(i = 0;i < 256; i++) { v = 0; for(j = 0; j < 8; j++) { v |= ((i >> j) & 1) << (j * 4); } expand4[i] = v; v = 0; for(j = 0; j < 4; j++) { v |= ((i >> (2 * j)) & 3) << (j * 4); } expand2[i] = v; } for(i = 0; i < 16; i++) { v = 0; for(j = 0; j < 4; j++) { b = ((i >> j) & 1); v |= b << (2 * j); v |= b << (2 * j + 1); } expand4to8[i] = v; } s->vram_ptr = vga_ram_base; s->vram_offset = vga_ram_offset; s->vram_size = vga_ram_size; s->ds = ds; s->get_bpp = vga_get_bpp; s->get_offsets = vga_get_offsets; s->get_resolution = vga_get_resolution; s->update = vga_update_display; s->invalidate = vga_invalidate_display; s->screen_dump = vga_screen_dump; s->text_update = vga_update_text; switch (vga_retrace_method) { case VGA_RETRACE_DUMB: s->retrace = vga_dumb_retrace; s->update_retrace_info = vga_dumb_update_retrace_info; break; case VGA_RETRACE_PRECISE: s->retrace = vga_precise_retrace; s->update_retrace_info = vga_precise_update_retrace_info; break; } qemu_register_reset(vga_reset, s); vga_reset(s); }
{ "code": [ " qemu_register_reset(vga_reset, s);" ], "line_no": [ 101 ] }
void FUNC_0(VGAState *VAR_0, DisplayState *VAR_1, uint8_t *VAR_2, ram_addr_t VAR_3, int VAR_4) { int VAR_5, VAR_6, VAR_7, VAR_8; for(VAR_5 = 0;VAR_5 < 256; VAR_5++) { VAR_7 = 0; for(VAR_6 = 0; VAR_6 < 8; VAR_6++) { VAR_7 |= ((VAR_5 >> VAR_6) & 1) << (VAR_6 * 4); } expand4[VAR_5] = VAR_7; VAR_7 = 0; for(VAR_6 = 0; VAR_6 < 4; VAR_6++) { VAR_7 |= ((VAR_5 >> (2 * VAR_6)) & 3) << (VAR_6 * 4); } expand2[VAR_5] = VAR_7; } for(VAR_5 = 0; VAR_5 < 16; VAR_5++) { VAR_7 = 0; for(VAR_6 = 0; VAR_6 < 4; VAR_6++) { VAR_8 = ((VAR_5 >> VAR_6) & 1); VAR_7 |= VAR_8 << (2 * VAR_6); VAR_7 |= VAR_8 << (2 * VAR_6 + 1); } expand4to8[VAR_5] = VAR_7; } VAR_0->vram_ptr = VAR_2; VAR_0->vram_offset = VAR_3; VAR_0->vram_size = VAR_4; VAR_0->VAR_1 = VAR_1; VAR_0->get_bpp = vga_get_bpp; VAR_0->get_offsets = vga_get_offsets; VAR_0->get_resolution = vga_get_resolution; VAR_0->update = vga_update_display; VAR_0->invalidate = vga_invalidate_display; VAR_0->screen_dump = vga_screen_dump; VAR_0->text_update = vga_update_text; switch (vga_retrace_method) { case VGA_RETRACE_DUMB: VAR_0->retrace = vga_dumb_retrace; VAR_0->update_retrace_info = vga_dumb_update_retrace_info; break; case VGA_RETRACE_PRECISE: VAR_0->retrace = vga_precise_retrace; VAR_0->update_retrace_info = vga_precise_update_retrace_info; break; } qemu_register_reset(vga_reset, VAR_0); vga_reset(VAR_0); }
[ "void FUNC_0(VGAState *VAR_0, DisplayState *VAR_1, uint8_t *VAR_2,\nram_addr_t VAR_3, int VAR_4)\n{", "int VAR_5, VAR_6, VAR_7, VAR_8;", "for(VAR_5 = 0;VAR_5 < 256; VAR_5++) {", "VAR_7 = 0;", "for(VAR_6 = 0; VAR_6 < 8; VAR_6++) {", "VAR_7 |= ((VAR_5 >> VAR_6) & 1) << (VAR_6 * 4);", "}", "expand4[VAR_5] = VAR_7;", "VAR_7 = 0;", "for(VAR_6 = 0; VAR_6 < 4; VAR_6++) {", "VAR_7 |= ((VAR_5 >> (2 * VAR_6)) & 3) << (VAR_6 * 4);", "}", "expand2[VAR_5] = VAR_7;", "}", "for(VAR_5 = 0; VAR_5 < 16; VAR_5++) {", "VAR_7 = 0;", "for(VAR_6 = 0; VAR_6 < 4; VAR_6++) {", "VAR_8 = ((VAR_5 >> VAR_6) & 1);", "VAR_7 |= VAR_8 << (2 * VAR_6);", "VAR_7 |= VAR_8 << (2 * VAR_6 + 1);", "}", "expand4to8[VAR_5] = VAR_7;", "}", "VAR_0->vram_ptr = VAR_2;", "VAR_0->vram_offset = VAR_3;", "VAR_0->vram_size = VAR_4;", "VAR_0->VAR_1 = VAR_1;", "VAR_0->get_bpp = vga_get_bpp;", "VAR_0->get_offsets = vga_get_offsets;", "VAR_0->get_resolution = vga_get_resolution;", "VAR_0->update = vga_update_display;", "VAR_0->invalidate = vga_invalidate_display;", "VAR_0->screen_dump = vga_screen_dump;", "VAR_0->text_update = vga_update_text;", "switch (vga_retrace_method) {", "case VGA_RETRACE_DUMB:\nVAR_0->retrace = vga_dumb_retrace;", "VAR_0->update_retrace_info = vga_dumb_update_retrace_info;", "break;", "case VGA_RETRACE_PRECISE:\nVAR_0->retrace = vga_precise_retrace;", "VAR_0->update_retrace_info = vga_precise_update_retrace_info;", "break;", "}", "qemu_register_reset(vga_reset, VAR_0);", "vga_reset(VAR_0);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81, 83 ], [ 85 ], [ 87 ], [ 91, 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ] ]
11,246
static int rtp_parse_packet_internal(RTPDemuxContext *s, AVPacket *pkt, const uint8_t *buf, int len) { unsigned int ssrc, h; int payload_type, seq, ret, flags = 0; int ext; AVStream *st; uint32_t timestamp; int rv = 0; ext = buf[0] & 0x10; payload_type = buf[1] & 0x7f; if (buf[1] & 0x80) flags |= RTP_FLAG_MARKER; seq = AV_RB16(buf + 2); timestamp = AV_RB32(buf + 4); ssrc = AV_RB32(buf + 8); /* store the ssrc in the RTPDemuxContext */ s->ssrc = ssrc; /* NOTE: we can handle only one payload type */ if (s->payload_type != payload_type) return -1; st = s->st; // only do something with this if all the rtp checks pass... if (!rtp_valid_packet_in_sequence(&s->statistics, seq)) { av_log(st ? st->codec : NULL, AV_LOG_ERROR, "RTP: PT=%02x: bad cseq %04x expected=%04x\n", payload_type, seq, ((s->seq + 1) & 0xffff)); return -1; } if (buf[0] & 0x20) { int padding = buf[len - 1]; if (len >= 12 + padding) len -= padding; } s->seq = seq; len -= 12; buf += 12; /* RFC 3550 Section 5.3.1 RTP Header Extension handling */ if (ext) { if (len < 4) return -1; /* calculate the header extension length (stored as number * of 32-bit words) */ ext = (AV_RB16(buf + 2) + 1) << 2; if (len < ext) return -1; // skip past RTP header extension len -= ext; buf += ext; } if (!st) { /* specific MPEG2-TS demux support */ ret = ff_mpegts_parse_packet(s->ts, pkt, buf, len); /* The only error that can be returned from ff_mpegts_parse_packet * is "no more data to return from the provided buffer", so return * AVERROR(EAGAIN) for all errors */ if (ret < 0) return AVERROR(EAGAIN); if (ret < len) { s->read_buf_size = len - ret; memcpy(s->buf, buf + ret, s->read_buf_size); s->read_buf_index = 0; return 1; } return 0; } else if (s->parse_packet) { rv = s->parse_packet(s->ic, s->dynamic_protocol_context, s->st, pkt, &timestamp, buf, len, flags); } else { /* At this point, the RTP header has been stripped; * This is ASSUMING that there is only 1 CSRC, which isn't wise. */ switch (st->codec->codec_id) { case AV_CODEC_ID_MP2: case AV_CODEC_ID_MP3: /* better than nothing: skip MPEG audio RTP header */ if (len <= 4) return -1; h = AV_RB32(buf); len -= 4; buf += 4; av_new_packet(pkt, len); memcpy(pkt->data, buf, len); break; case AV_CODEC_ID_MPEG1VIDEO: case AV_CODEC_ID_MPEG2VIDEO: /* better than nothing: skip MPEG video RTP header */ if (len <= 4) return -1; h = AV_RB32(buf); buf += 4; len -= 4; if (h & (1 << 26)) { /* MPEG-2 */ if (len <= 4) return -1; buf += 4; len -= 4; } av_new_packet(pkt, len); memcpy(pkt->data, buf, len); break; default: av_new_packet(pkt, len); memcpy(pkt->data, buf, len); break; } pkt->stream_index = st->index; } // now perform timestamp things.... finalize_packet(s, pkt, timestamp); return rv; }
true
FFmpeg
81ef5192529dd9ff6b7dc34b6528b9d8dafdd100
static int rtp_parse_packet_internal(RTPDemuxContext *s, AVPacket *pkt, const uint8_t *buf, int len) { unsigned int ssrc, h; int payload_type, seq, ret, flags = 0; int ext; AVStream *st; uint32_t timestamp; int rv = 0; ext = buf[0] & 0x10; payload_type = buf[1] & 0x7f; if (buf[1] & 0x80) flags |= RTP_FLAG_MARKER; seq = AV_RB16(buf + 2); timestamp = AV_RB32(buf + 4); ssrc = AV_RB32(buf + 8); s->ssrc = ssrc; if (s->payload_type != payload_type) return -1; st = s->st; if (!rtp_valid_packet_in_sequence(&s->statistics, seq)) { av_log(st ? st->codec : NULL, AV_LOG_ERROR, "RTP: PT=%02x: bad cseq %04x expected=%04x\n", payload_type, seq, ((s->seq + 1) & 0xffff)); return -1; } if (buf[0] & 0x20) { int padding = buf[len - 1]; if (len >= 12 + padding) len -= padding; } s->seq = seq; len -= 12; buf += 12; if (ext) { if (len < 4) return -1; ext = (AV_RB16(buf + 2) + 1) << 2; if (len < ext) return -1; len -= ext; buf += ext; } if (!st) { ret = ff_mpegts_parse_packet(s->ts, pkt, buf, len); if (ret < 0) return AVERROR(EAGAIN); if (ret < len) { s->read_buf_size = len - ret; memcpy(s->buf, buf + ret, s->read_buf_size); s->read_buf_index = 0; return 1; } return 0; } else if (s->parse_packet) { rv = s->parse_packet(s->ic, s->dynamic_protocol_context, s->st, pkt, &timestamp, buf, len, flags); } else { switch (st->codec->codec_id) { case AV_CODEC_ID_MP2: case AV_CODEC_ID_MP3: if (len <= 4) return -1; h = AV_RB32(buf); len -= 4; buf += 4; av_new_packet(pkt, len); memcpy(pkt->data, buf, len); break; case AV_CODEC_ID_MPEG1VIDEO: case AV_CODEC_ID_MPEG2VIDEO: if (len <= 4) return -1; h = AV_RB32(buf); buf += 4; len -= 4; if (h & (1 << 26)) { if (len <= 4) return -1; buf += 4; len -= 4; } av_new_packet(pkt, len); memcpy(pkt->data, buf, len); break; default: av_new_packet(pkt, len); memcpy(pkt->data, buf, len); break; } pkt->stream_index = st->index; } finalize_packet(s, pkt, timestamp); return rv; }
{ "code": [ " s->read_buf_size = len - ret;" ], "line_no": [ 135 ] }
static int FUNC_0(RTPDemuxContext *VAR_0, AVPacket *VAR_1, const uint8_t *VAR_2, int VAR_3) { unsigned int VAR_4, VAR_5; int VAR_6, VAR_7, VAR_8, VAR_9 = 0; int VAR_10; AVStream *st; uint32_t timestamp; int VAR_11 = 0; VAR_10 = VAR_2[0] & 0x10; VAR_6 = VAR_2[1] & 0x7f; if (VAR_2[1] & 0x80) VAR_9 |= RTP_FLAG_MARKER; VAR_7 = AV_RB16(VAR_2 + 2); timestamp = AV_RB32(VAR_2 + 4); VAR_4 = AV_RB32(VAR_2 + 8); VAR_0->VAR_4 = VAR_4; if (VAR_0->VAR_6 != VAR_6) return -1; st = VAR_0->st; if (!rtp_valid_packet_in_sequence(&VAR_0->statistics, VAR_7)) { av_log(st ? st->codec : NULL, AV_LOG_ERROR, "RTP: PT=%02x: bad cseq %04x expected=%04x\n", VAR_6, VAR_7, ((VAR_0->VAR_7 + 1) & 0xffff)); return -1; } if (VAR_2[0] & 0x20) { int VAR_12 = VAR_2[VAR_3 - 1]; if (VAR_3 >= 12 + VAR_12) VAR_3 -= VAR_12; } VAR_0->VAR_7 = VAR_7; VAR_3 -= 12; VAR_2 += 12; if (VAR_10) { if (VAR_3 < 4) return -1; VAR_10 = (AV_RB16(VAR_2 + 2) + 1) << 2; if (VAR_3 < VAR_10) return -1; VAR_3 -= VAR_10; VAR_2 += VAR_10; } if (!st) { VAR_8 = ff_mpegts_parse_packet(VAR_0->ts, VAR_1, VAR_2, VAR_3); if (VAR_8 < 0) return AVERROR(EAGAIN); if (VAR_8 < VAR_3) { VAR_0->read_buf_size = VAR_3 - VAR_8; memcpy(VAR_0->VAR_2, VAR_2 + VAR_8, VAR_0->read_buf_size); VAR_0->read_buf_index = 0; return 1; } return 0; } else if (VAR_0->parse_packet) { VAR_11 = VAR_0->parse_packet(VAR_0->ic, VAR_0->dynamic_protocol_context, VAR_0->st, VAR_1, &timestamp, VAR_2, VAR_3, VAR_9); } else { switch (st->codec->codec_id) { case AV_CODEC_ID_MP2: case AV_CODEC_ID_MP3: if (VAR_3 <= 4) return -1; VAR_5 = AV_RB32(VAR_2); VAR_3 -= 4; VAR_2 += 4; av_new_packet(VAR_1, VAR_3); memcpy(VAR_1->data, VAR_2, VAR_3); break; case AV_CODEC_ID_MPEG1VIDEO: case AV_CODEC_ID_MPEG2VIDEO: if (VAR_3 <= 4) return -1; VAR_5 = AV_RB32(VAR_2); VAR_2 += 4; VAR_3 -= 4; if (VAR_5 & (1 << 26)) { if (VAR_3 <= 4) return -1; VAR_2 += 4; VAR_3 -= 4; } av_new_packet(VAR_1, VAR_3); memcpy(VAR_1->data, VAR_2, VAR_3); break; default: av_new_packet(VAR_1, VAR_3); memcpy(VAR_1->data, VAR_2, VAR_3); break; } VAR_1->stream_index = st->index; } finalize_packet(VAR_0, VAR_1, timestamp); return VAR_11; }
[ "static int FUNC_0(RTPDemuxContext *VAR_0, AVPacket *VAR_1,\nconst uint8_t *VAR_2, int VAR_3)\n{", "unsigned int VAR_4, VAR_5;", "int VAR_6, VAR_7, VAR_8, VAR_9 = 0;", "int VAR_10;", "AVStream *st;", "uint32_t timestamp;", "int VAR_11 = 0;", "VAR_10 = VAR_2[0] & 0x10;", "VAR_6 = VAR_2[1] & 0x7f;", "if (VAR_2[1] & 0x80)\nVAR_9 |= RTP_FLAG_MARKER;", "VAR_7 = AV_RB16(VAR_2 + 2);", "timestamp = AV_RB32(VAR_2 + 4);", "VAR_4 = AV_RB32(VAR_2 + 8);", "VAR_0->VAR_4 = VAR_4;", "if (VAR_0->VAR_6 != VAR_6)\nreturn -1;", "st = VAR_0->st;", "if (!rtp_valid_packet_in_sequence(&VAR_0->statistics, VAR_7)) {", "av_log(st ? st->codec : NULL, AV_LOG_ERROR,\n\"RTP: PT=%02x: bad cseq %04x expected=%04x\\n\",\nVAR_6, VAR_7, ((VAR_0->VAR_7 + 1) & 0xffff));", "return -1;", "}", "if (VAR_2[0] & 0x20) {", "int VAR_12 = VAR_2[VAR_3 - 1];", "if (VAR_3 >= 12 + VAR_12)\nVAR_3 -= VAR_12;", "}", "VAR_0->VAR_7 = VAR_7;", "VAR_3 -= 12;", "VAR_2 += 12;", "if (VAR_10) {", "if (VAR_3 < 4)\nreturn -1;", "VAR_10 = (AV_RB16(VAR_2 + 2) + 1) << 2;", "if (VAR_3 < VAR_10)\nreturn -1;", "VAR_3 -= VAR_10;", "VAR_2 += VAR_10;", "}", "if (!st) {", "VAR_8 = ff_mpegts_parse_packet(VAR_0->ts, VAR_1, VAR_2, VAR_3);", "if (VAR_8 < 0)\nreturn AVERROR(EAGAIN);", "if (VAR_8 < VAR_3) {", "VAR_0->read_buf_size = VAR_3 - VAR_8;", "memcpy(VAR_0->VAR_2, VAR_2 + VAR_8, VAR_0->read_buf_size);", "VAR_0->read_buf_index = 0;", "return 1;", "}", "return 0;", "} else if (VAR_0->parse_packet) {", "VAR_11 = VAR_0->parse_packet(VAR_0->ic, VAR_0->dynamic_protocol_context,\nVAR_0->st, VAR_1, &timestamp, VAR_2, VAR_3, VAR_9);", "} else {", "switch (st->codec->codec_id) {", "case AV_CODEC_ID_MP2:\ncase AV_CODEC_ID_MP3:\nif (VAR_3 <= 4)\nreturn -1;", "VAR_5 = AV_RB32(VAR_2);", "VAR_3 -= 4;", "VAR_2 += 4;", "av_new_packet(VAR_1, VAR_3);", "memcpy(VAR_1->data, VAR_2, VAR_3);", "break;", "case AV_CODEC_ID_MPEG1VIDEO:\ncase AV_CODEC_ID_MPEG2VIDEO:\nif (VAR_3 <= 4)\nreturn -1;", "VAR_5 = AV_RB32(VAR_2);", "VAR_2 += 4;", "VAR_3 -= 4;", "if (VAR_5 & (1 << 26)) {", "if (VAR_3 <= 4)\nreturn -1;", "VAR_2 += 4;", "VAR_3 -= 4;", "}", "av_new_packet(VAR_1, VAR_3);", "memcpy(VAR_1->data, VAR_2, VAR_3);", "break;", "default:\nav_new_packet(VAR_1, VAR_3);", "memcpy(VAR_1->data, VAR_2, VAR_3);", "break;", "}", "VAR_1->stream_index = st->index;", "}", "finalize_packet(VAR_0, VAR_1, timestamp);", "return VAR_11;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25, 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 43, 45 ], [ 49 ], [ 53 ], [ 55, 57, 59 ], [ 61 ], [ 63 ], [ 67 ], [ 69 ], [ 71, 73 ], [ 75 ], [ 79 ], [ 81 ], [ 83 ], [ 89 ], [ 91, 93 ], [ 99 ], [ 103, 105 ], [ 109 ], [ 111 ], [ 113 ], [ 117 ], [ 121 ], [ 129, 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149, 151 ], [ 153 ], [ 159 ], [ 161, 163, 167, 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183, 185, 189, 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 203, 205 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 219, 221 ], [ 223 ], [ 225 ], [ 227 ], [ 231 ], [ 233 ], [ 239 ], [ 243 ], [ 245 ] ]
11,247
static int tiff_decode_tag(TiffContext *s, const uint8_t *start, const uint8_t *buf, const uint8_t *end_buf) { int tag, type, count, off, value = 0; int i, j; uint32_t *pal; const uint8_t *rp, *gp, *bp; tag = tget_short(&buf, s->le); type = tget_short(&buf, s->le); count = tget_long(&buf, s->le); off = tget_long(&buf, s->le); if(count == 1){ switch(type){ case TIFF_BYTE: case TIFF_SHORT: buf -= 4; value = tget(&buf, type, s->le); buf = NULL; break; case TIFF_LONG: value = off; buf = NULL; break; case TIFF_STRING: if(count <= 4){ buf -= 4; break; } default: value = -1; buf = start + off; } }else if(type_sizes[type] * count <= 4){ buf -= 4; }else{ buf = start + off; } if(buf && (buf < start || buf > end_buf)){ av_log(s->avctx, AV_LOG_ERROR, "Tag referencing position outside the image\n"); return -1; } switch(tag){ case TIFF_WIDTH: s->width = value; break; case TIFF_HEIGHT: s->height = value; break; case TIFF_BPP: if(count == 1) s->bpp = value; else{ switch(type){ case TIFF_BYTE: s->bpp = (off & 0xFF) + ((off >> 8) & 0xFF) + ((off >> 16) & 0xFF) + ((off >> 24) & 0xFF); break; case TIFF_SHORT: case TIFF_LONG: s->bpp = 0; for(i = 0; i < count; i++) s->bpp += tget(&buf, type, s->le); break; default: s->bpp = -1; } } if(count > 4){ av_log(s->avctx, AV_LOG_ERROR, "This format is not supported (bpp=%d, %d components)\n", s->bpp, count); return -1; } switch(s->bpp*10 + count){ case 11: s->avctx->pix_fmt = PIX_FMT_MONOBLACK; break; case 81: s->avctx->pix_fmt = PIX_FMT_PAL8; break; case 243: s->avctx->pix_fmt = PIX_FMT_RGB24; break; case 161: s->avctx->pix_fmt = PIX_FMT_GRAY16BE; break; case 324: s->avctx->pix_fmt = PIX_FMT_RGBA; break; case 483: s->avctx->pix_fmt = s->le ? PIX_FMT_RGB48LE : PIX_FMT_RGB48BE; break; default: av_log(s->avctx, AV_LOG_ERROR, "This format is not supported (bpp=%d, %d components)\n", s->bpp, count); return -1; } if(s->width != s->avctx->width || s->height != s->avctx->height){ if(av_image_check_size(s->width, s->height, 0, s->avctx)) return -1; avcodec_set_dimensions(s->avctx, s->width, s->height); } if(s->picture.data[0]) s->avctx->release_buffer(s->avctx, &s->picture); if(s->avctx->get_buffer(s->avctx, &s->picture) < 0){ av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return -1; } if(s->bpp == 8){ /* make default grayscale pal */ pal = (uint32_t *) s->picture.data[1]; for(i = 0; i < 256; i++) pal[i] = i * 0x010101; } break; case TIFF_COMPR: s->compr = value; s->predictor = 0; switch(s->compr){ case TIFF_RAW: case TIFF_PACKBITS: case TIFF_LZW: case TIFF_CCITT_RLE: break; case TIFF_G3: case TIFF_G4: s->fax_opts = 0; break; case TIFF_DEFLATE: case TIFF_ADOBE_DEFLATE: #if CONFIG_ZLIB break; #else av_log(s->avctx, AV_LOG_ERROR, "Deflate: ZLib not compiled in\n"); return -1; #endif case TIFF_JPEG: case TIFF_NEWJPEG: av_log(s->avctx, AV_LOG_ERROR, "JPEG compression is not supported\n"); return -1; default: av_log(s->avctx, AV_LOG_ERROR, "Unknown compression method %i\n", s->compr); return -1; } break; case TIFF_ROWSPERSTRIP: if(type == TIFF_LONG && value == -1) value = s->avctx->height; if(value < 1){ av_log(s->avctx, AV_LOG_ERROR, "Incorrect value of rows per strip\n"); return -1; } s->rps = value; break; case TIFF_STRIP_OFFS: if(count == 1){ s->stripdata = NULL; s->stripoff = value; }else s->stripdata = start + off; s->strips = count; if(s->strips == 1) s->rps = s->height; s->sot = type; if(s->stripdata > end_buf){ av_log(s->avctx, AV_LOG_ERROR, "Tag referencing position outside the image\n"); return -1; } break; case TIFF_STRIP_SIZE: if(count == 1){ s->stripsizes = NULL; s->stripsize = value; s->strips = 1; }else{ s->stripsizes = start + off; } s->strips = count; s->sstype = type; if(s->stripsizes > end_buf){ av_log(s->avctx, AV_LOG_ERROR, "Tag referencing position outside the image\n"); return -1; } break; case TIFF_PREDICTOR: s->predictor = value; break; case TIFF_INVERT: switch(value){ case 0: s->invert = 1; break; case 1: s->invert = 0; break; case 2: case 3: break; default: av_log(s->avctx, AV_LOG_ERROR, "Color mode %d is not supported\n", value); return -1; } break; case TIFF_FILL_ORDER: if(value < 1 || value > 2){ av_log(s->avctx, AV_LOG_ERROR, "Unknown FillOrder value %d, trying default one\n", value); value = 1; } s->fill_order = value - 1; break; case TIFF_PAL: if(s->avctx->pix_fmt != PIX_FMT_PAL8){ av_log(s->avctx, AV_LOG_ERROR, "Palette met but this is not palettized format\n"); return -1; } pal = (uint32_t *) s->picture.data[1]; off = type_sizes[type]; rp = buf; gp = buf + count / 3 * off; bp = buf + count / 3 * off * 2; off = (type_sizes[type] - 1) << 3; for(i = 0; i < count / 3; i++){ j = (tget(&rp, type, s->le) >> off) << 16; j |= (tget(&gp, type, s->le) >> off) << 8; j |= tget(&bp, type, s->le) >> off; pal[i] = j; } break; case TIFF_PLANAR: if(value == 2){ av_log(s->avctx, AV_LOG_ERROR, "Planar format is not supported\n"); return -1; } break; case TIFF_T4OPTIONS: if(s->compr == TIFF_G3) s->fax_opts = value; break; case TIFF_T6OPTIONS: if(s->compr == TIFF_G4) s->fax_opts = value; break; } return 0; }
true
FFmpeg
d381249bb86d5a4b1a99bb292a7aed034d6d12de
static int tiff_decode_tag(TiffContext *s, const uint8_t *start, const uint8_t *buf, const uint8_t *end_buf) { int tag, type, count, off, value = 0; int i, j; uint32_t *pal; const uint8_t *rp, *gp, *bp; tag = tget_short(&buf, s->le); type = tget_short(&buf, s->le); count = tget_long(&buf, s->le); off = tget_long(&buf, s->le); if(count == 1){ switch(type){ case TIFF_BYTE: case TIFF_SHORT: buf -= 4; value = tget(&buf, type, s->le); buf = NULL; break; case TIFF_LONG: value = off; buf = NULL; break; case TIFF_STRING: if(count <= 4){ buf -= 4; break; } default: value = -1; buf = start + off; } }else if(type_sizes[type] * count <= 4){ buf -= 4; }else{ buf = start + off; } if(buf && (buf < start || buf > end_buf)){ av_log(s->avctx, AV_LOG_ERROR, "Tag referencing position outside the image\n"); return -1; } switch(tag){ case TIFF_WIDTH: s->width = value; break; case TIFF_HEIGHT: s->height = value; break; case TIFF_BPP: if(count == 1) s->bpp = value; else{ switch(type){ case TIFF_BYTE: s->bpp = (off & 0xFF) + ((off >> 8) & 0xFF) + ((off >> 16) & 0xFF) + ((off >> 24) & 0xFF); break; case TIFF_SHORT: case TIFF_LONG: s->bpp = 0; for(i = 0; i < count; i++) s->bpp += tget(&buf, type, s->le); break; default: s->bpp = -1; } } if(count > 4){ av_log(s->avctx, AV_LOG_ERROR, "This format is not supported (bpp=%d, %d components)\n", s->bpp, count); return -1; } switch(s->bpp*10 + count){ case 11: s->avctx->pix_fmt = PIX_FMT_MONOBLACK; break; case 81: s->avctx->pix_fmt = PIX_FMT_PAL8; break; case 243: s->avctx->pix_fmt = PIX_FMT_RGB24; break; case 161: s->avctx->pix_fmt = PIX_FMT_GRAY16BE; break; case 324: s->avctx->pix_fmt = PIX_FMT_RGBA; break; case 483: s->avctx->pix_fmt = s->le ? PIX_FMT_RGB48LE : PIX_FMT_RGB48BE; break; default: av_log(s->avctx, AV_LOG_ERROR, "This format is not supported (bpp=%d, %d components)\n", s->bpp, count); return -1; } if(s->width != s->avctx->width || s->height != s->avctx->height){ if(av_image_check_size(s->width, s->height, 0, s->avctx)) return -1; avcodec_set_dimensions(s->avctx, s->width, s->height); } if(s->picture.data[0]) s->avctx->release_buffer(s->avctx, &s->picture); if(s->avctx->get_buffer(s->avctx, &s->picture) < 0){ av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return -1; } if(s->bpp == 8){ pal = (uint32_t *) s->picture.data[1]; for(i = 0; i < 256; i++) pal[i] = i * 0x010101; } break; case TIFF_COMPR: s->compr = value; s->predictor = 0; switch(s->compr){ case TIFF_RAW: case TIFF_PACKBITS: case TIFF_LZW: case TIFF_CCITT_RLE: break; case TIFF_G3: case TIFF_G4: s->fax_opts = 0; break; case TIFF_DEFLATE: case TIFF_ADOBE_DEFLATE: #if CONFIG_ZLIB break; #else av_log(s->avctx, AV_LOG_ERROR, "Deflate: ZLib not compiled in\n"); return -1; #endif case TIFF_JPEG: case TIFF_NEWJPEG: av_log(s->avctx, AV_LOG_ERROR, "JPEG compression is not supported\n"); return -1; default: av_log(s->avctx, AV_LOG_ERROR, "Unknown compression method %i\n", s->compr); return -1; } break; case TIFF_ROWSPERSTRIP: if(type == TIFF_LONG && value == -1) value = s->avctx->height; if(value < 1){ av_log(s->avctx, AV_LOG_ERROR, "Incorrect value of rows per strip\n"); return -1; } s->rps = value; break; case TIFF_STRIP_OFFS: if(count == 1){ s->stripdata = NULL; s->stripoff = value; }else s->stripdata = start + off; s->strips = count; if(s->strips == 1) s->rps = s->height; s->sot = type; if(s->stripdata > end_buf){ av_log(s->avctx, AV_LOG_ERROR, "Tag referencing position outside the image\n"); return -1; } break; case TIFF_STRIP_SIZE: if(count == 1){ s->stripsizes = NULL; s->stripsize = value; s->strips = 1; }else{ s->stripsizes = start + off; } s->strips = count; s->sstype = type; if(s->stripsizes > end_buf){ av_log(s->avctx, AV_LOG_ERROR, "Tag referencing position outside the image\n"); return -1; } break; case TIFF_PREDICTOR: s->predictor = value; break; case TIFF_INVERT: switch(value){ case 0: s->invert = 1; break; case 1: s->invert = 0; break; case 2: case 3: break; default: av_log(s->avctx, AV_LOG_ERROR, "Color mode %d is not supported\n", value); return -1; } break; case TIFF_FILL_ORDER: if(value < 1 || value > 2){ av_log(s->avctx, AV_LOG_ERROR, "Unknown FillOrder value %d, trying default one\n", value); value = 1; } s->fill_order = value - 1; break; case TIFF_PAL: if(s->avctx->pix_fmt != PIX_FMT_PAL8){ av_log(s->avctx, AV_LOG_ERROR, "Palette met but this is not palettized format\n"); return -1; } pal = (uint32_t *) s->picture.data[1]; off = type_sizes[type]; rp = buf; gp = buf + count / 3 * off; bp = buf + count / 3 * off * 2; off = (type_sizes[type] - 1) << 3; for(i = 0; i < count / 3; i++){ j = (tget(&rp, type, s->le) >> off) << 16; j |= (tget(&gp, type, s->le) >> off) << 8; j |= tget(&bp, type, s->le) >> off; pal[i] = j; } break; case TIFF_PLANAR: if(value == 2){ av_log(s->avctx, AV_LOG_ERROR, "Planar format is not supported\n"); return -1; } break; case TIFF_T4OPTIONS: if(s->compr == TIFF_G3) s->fax_opts = value; break; case TIFF_T6OPTIONS: if(s->compr == TIFF_G4) s->fax_opts = value; break; } return 0; }
{ "code": [ " if(count > 4){", " av_log(s->avctx, AV_LOG_ERROR, \"This format is not supported (bpp=%d, %d components)\\n\", s->bpp, count);", " return -1;" ], "line_no": [ 135, 137, 139 ] }
static int FUNC_0(TiffContext *VAR_0, const uint8_t *VAR_1, const uint8_t *VAR_2, const uint8_t *VAR_3) { int VAR_4, VAR_5, VAR_6, VAR_7, VAR_8 = 0; int VAR_9, VAR_10; uint32_t *pal; const uint8_t *VAR_11, *gp, *bp; VAR_4 = tget_short(&VAR_2, VAR_0->le); VAR_5 = tget_short(&VAR_2, VAR_0->le); VAR_6 = tget_long(&VAR_2, VAR_0->le); VAR_7 = tget_long(&VAR_2, VAR_0->le); if(VAR_6 == 1){ switch(VAR_5){ case TIFF_BYTE: case TIFF_SHORT: VAR_2 -= 4; VAR_8 = tget(&VAR_2, VAR_5, VAR_0->le); VAR_2 = NULL; break; case TIFF_LONG: VAR_8 = VAR_7; VAR_2 = NULL; break; case TIFF_STRING: if(VAR_6 <= 4){ VAR_2 -= 4; break; } default: VAR_8 = -1; VAR_2 = VAR_1 + VAR_7; } }else if(type_sizes[VAR_5] * VAR_6 <= 4){ VAR_2 -= 4; }else{ VAR_2 = VAR_1 + VAR_7; } if(VAR_2 && (VAR_2 < VAR_1 || VAR_2 > VAR_3)){ av_log(VAR_0->avctx, AV_LOG_ERROR, "Tag referencing position outside the image\n"); return -1; } switch(VAR_4){ case TIFF_WIDTH: VAR_0->width = VAR_8; break; case TIFF_HEIGHT: VAR_0->height = VAR_8; break; case TIFF_BPP: if(VAR_6 == 1) VAR_0->bpp = VAR_8; else{ switch(VAR_5){ case TIFF_BYTE: VAR_0->bpp = (VAR_7 & 0xFF) + ((VAR_7 >> 8) & 0xFF) + ((VAR_7 >> 16) & 0xFF) + ((VAR_7 >> 24) & 0xFF); break; case TIFF_SHORT: case TIFF_LONG: VAR_0->bpp = 0; for(VAR_9 = 0; VAR_9 < VAR_6; VAR_9++) VAR_0->bpp += tget(&VAR_2, VAR_5, VAR_0->le); break; default: VAR_0->bpp = -1; } } if(VAR_6 > 4){ av_log(VAR_0->avctx, AV_LOG_ERROR, "This format is not supported (bpp=%d, %d components)\n", VAR_0->bpp, VAR_6); return -1; } switch(VAR_0->bpp*10 + VAR_6){ case 11: VAR_0->avctx->pix_fmt = PIX_FMT_MONOBLACK; break; case 81: VAR_0->avctx->pix_fmt = PIX_FMT_PAL8; break; case 243: VAR_0->avctx->pix_fmt = PIX_FMT_RGB24; break; case 161: VAR_0->avctx->pix_fmt = PIX_FMT_GRAY16BE; break; case 324: VAR_0->avctx->pix_fmt = PIX_FMT_RGBA; break; case 483: VAR_0->avctx->pix_fmt = VAR_0->le ? PIX_FMT_RGB48LE : PIX_FMT_RGB48BE; break; default: av_log(VAR_0->avctx, AV_LOG_ERROR, "This format is not supported (bpp=%d, %d components)\n", VAR_0->bpp, VAR_6); return -1; } if(VAR_0->width != VAR_0->avctx->width || VAR_0->height != VAR_0->avctx->height){ if(av_image_check_size(VAR_0->width, VAR_0->height, 0, VAR_0->avctx)) return -1; avcodec_set_dimensions(VAR_0->avctx, VAR_0->width, VAR_0->height); } if(VAR_0->picture.data[0]) VAR_0->avctx->release_buffer(VAR_0->avctx, &VAR_0->picture); if(VAR_0->avctx->get_buffer(VAR_0->avctx, &VAR_0->picture) < 0){ av_log(VAR_0->avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return -1; } if(VAR_0->bpp == 8){ pal = (uint32_t *) VAR_0->picture.data[1]; for(VAR_9 = 0; VAR_9 < 256; VAR_9++) pal[VAR_9] = VAR_9 * 0x010101; } break; case TIFF_COMPR: VAR_0->compr = VAR_8; VAR_0->predictor = 0; switch(VAR_0->compr){ case TIFF_RAW: case TIFF_PACKBITS: case TIFF_LZW: case TIFF_CCITT_RLE: break; case TIFF_G3: case TIFF_G4: VAR_0->fax_opts = 0; break; case TIFF_DEFLATE: case TIFF_ADOBE_DEFLATE: #if CONFIG_ZLIB break; #else av_log(VAR_0->avctx, AV_LOG_ERROR, "Deflate: ZLib not compiled in\n"); return -1; #endif case TIFF_JPEG: case TIFF_NEWJPEG: av_log(VAR_0->avctx, AV_LOG_ERROR, "JPEG compression is not supported\n"); return -1; default: av_log(VAR_0->avctx, AV_LOG_ERROR, "Unknown compression method %VAR_9\n", VAR_0->compr); return -1; } break; case TIFF_ROWSPERSTRIP: if(VAR_5 == TIFF_LONG && VAR_8 == -1) VAR_8 = VAR_0->avctx->height; if(VAR_8 < 1){ av_log(VAR_0->avctx, AV_LOG_ERROR, "Incorrect VAR_8 of rows per strip\n"); return -1; } VAR_0->rps = VAR_8; break; case TIFF_STRIP_OFFS: if(VAR_6 == 1){ VAR_0->stripdata = NULL; VAR_0->stripoff = VAR_8; }else VAR_0->stripdata = VAR_1 + VAR_7; VAR_0->strips = VAR_6; if(VAR_0->strips == 1) VAR_0->rps = VAR_0->height; VAR_0->sot = VAR_5; if(VAR_0->stripdata > VAR_3){ av_log(VAR_0->avctx, AV_LOG_ERROR, "Tag referencing position outside the image\n"); return -1; } break; case TIFF_STRIP_SIZE: if(VAR_6 == 1){ VAR_0->stripsizes = NULL; VAR_0->stripsize = VAR_8; VAR_0->strips = 1; }else{ VAR_0->stripsizes = VAR_1 + VAR_7; } VAR_0->strips = VAR_6; VAR_0->sstype = VAR_5; if(VAR_0->stripsizes > VAR_3){ av_log(VAR_0->avctx, AV_LOG_ERROR, "Tag referencing position outside the image\n"); return -1; } break; case TIFF_PREDICTOR: VAR_0->predictor = VAR_8; break; case TIFF_INVERT: switch(VAR_8){ case 0: VAR_0->invert = 1; break; case 1: VAR_0->invert = 0; break; case 2: case 3: break; default: av_log(VAR_0->avctx, AV_LOG_ERROR, "Color mode %d is not supported\n", VAR_8); return -1; } break; case TIFF_FILL_ORDER: if(VAR_8 < 1 || VAR_8 > 2){ av_log(VAR_0->avctx, AV_LOG_ERROR, "Unknown FillOrder VAR_8 %d, trying default one\n", VAR_8); VAR_8 = 1; } VAR_0->fill_order = VAR_8 - 1; break; case TIFF_PAL: if(VAR_0->avctx->pix_fmt != PIX_FMT_PAL8){ av_log(VAR_0->avctx, AV_LOG_ERROR, "Palette met but this is not palettized format\n"); return -1; } pal = (uint32_t *) VAR_0->picture.data[1]; VAR_7 = type_sizes[VAR_5]; VAR_11 = VAR_2; gp = VAR_2 + VAR_6 / 3 * VAR_7; bp = VAR_2 + VAR_6 / 3 * VAR_7 * 2; VAR_7 = (type_sizes[VAR_5] - 1) << 3; for(VAR_9 = 0; VAR_9 < VAR_6 / 3; VAR_9++){ VAR_10 = (tget(&VAR_11, VAR_5, VAR_0->le) >> VAR_7) << 16; VAR_10 |= (tget(&gp, VAR_5, VAR_0->le) >> VAR_7) << 8; VAR_10 |= tget(&bp, VAR_5, VAR_0->le) >> VAR_7; pal[VAR_9] = VAR_10; } break; case TIFF_PLANAR: if(VAR_8 == 2){ av_log(VAR_0->avctx, AV_LOG_ERROR, "Planar format is not supported\n"); return -1; } break; case TIFF_T4OPTIONS: if(VAR_0->compr == TIFF_G3) VAR_0->fax_opts = VAR_8; break; case TIFF_T6OPTIONS: if(VAR_0->compr == TIFF_G4) VAR_0->fax_opts = VAR_8; break; } return 0; }
[ "static int FUNC_0(TiffContext *VAR_0, const uint8_t *VAR_1, const uint8_t *VAR_2, const uint8_t *VAR_3)\n{", "int VAR_4, VAR_5, VAR_6, VAR_7, VAR_8 = 0;", "int VAR_9, VAR_10;", "uint32_t *pal;", "const uint8_t *VAR_11, *gp, *bp;", "VAR_4 = tget_short(&VAR_2, VAR_0->le);", "VAR_5 = tget_short(&VAR_2, VAR_0->le);", "VAR_6 = tget_long(&VAR_2, VAR_0->le);", "VAR_7 = tget_long(&VAR_2, VAR_0->le);", "if(VAR_6 == 1){", "switch(VAR_5){", "case TIFF_BYTE:\ncase TIFF_SHORT:\nVAR_2 -= 4;", "VAR_8 = tget(&VAR_2, VAR_5, VAR_0->le);", "VAR_2 = NULL;", "break;", "case TIFF_LONG:\nVAR_8 = VAR_7;", "VAR_2 = NULL;", "break;", "case TIFF_STRING:\nif(VAR_6 <= 4){", "VAR_2 -= 4;", "break;", "}", "default:\nVAR_8 = -1;", "VAR_2 = VAR_1 + VAR_7;", "}", "}else if(type_sizes[VAR_5] * VAR_6 <= 4){", "VAR_2 -= 4;", "}else{", "VAR_2 = VAR_1 + VAR_7;", "}", "if(VAR_2 && (VAR_2 < VAR_1 || VAR_2 > VAR_3)){", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"Tag referencing position outside the image\\n\");", "return -1;", "}", "switch(VAR_4){", "case TIFF_WIDTH:\nVAR_0->width = VAR_8;", "break;", "case TIFF_HEIGHT:\nVAR_0->height = VAR_8;", "break;", "case TIFF_BPP:\nif(VAR_6 == 1) VAR_0->bpp = VAR_8;", "else{", "switch(VAR_5){", "case TIFF_BYTE:\nVAR_0->bpp = (VAR_7 & 0xFF) + ((VAR_7 >> 8) & 0xFF) + ((VAR_7 >> 16) & 0xFF) + ((VAR_7 >> 24) & 0xFF);", "break;", "case TIFF_SHORT:\ncase TIFF_LONG:\nVAR_0->bpp = 0;", "for(VAR_9 = 0; VAR_9 < VAR_6; VAR_9++) VAR_0->bpp += tget(&VAR_2, VAR_5, VAR_0->le);", "break;", "default:\nVAR_0->bpp = -1;", "}", "}", "if(VAR_6 > 4){", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"This format is not supported (bpp=%d, %d components)\\n\", VAR_0->bpp, VAR_6);", "return -1;", "}", "switch(VAR_0->bpp*10 + VAR_6){", "case 11:\nVAR_0->avctx->pix_fmt = PIX_FMT_MONOBLACK;", "break;", "case 81:\nVAR_0->avctx->pix_fmt = PIX_FMT_PAL8;", "break;", "case 243:\nVAR_0->avctx->pix_fmt = PIX_FMT_RGB24;", "break;", "case 161:\nVAR_0->avctx->pix_fmt = PIX_FMT_GRAY16BE;", "break;", "case 324:\nVAR_0->avctx->pix_fmt = PIX_FMT_RGBA;", "break;", "case 483:\nVAR_0->avctx->pix_fmt = VAR_0->le ? PIX_FMT_RGB48LE : PIX_FMT_RGB48BE;", "break;", "default:\nav_log(VAR_0->avctx, AV_LOG_ERROR, \"This format is not supported (bpp=%d, %d components)\\n\", VAR_0->bpp, VAR_6);", "return -1;", "}", "if(VAR_0->width != VAR_0->avctx->width || VAR_0->height != VAR_0->avctx->height){", "if(av_image_check_size(VAR_0->width, VAR_0->height, 0, VAR_0->avctx))\nreturn -1;", "avcodec_set_dimensions(VAR_0->avctx, VAR_0->width, VAR_0->height);", "}", "if(VAR_0->picture.data[0])\nVAR_0->avctx->release_buffer(VAR_0->avctx, &VAR_0->picture);", "if(VAR_0->avctx->get_buffer(VAR_0->avctx, &VAR_0->picture) < 0){", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"get_buffer() failed\\n\");", "return -1;", "}", "if(VAR_0->bpp == 8){", "pal = (uint32_t *) VAR_0->picture.data[1];", "for(VAR_9 = 0; VAR_9 < 256; VAR_9++)", "pal[VAR_9] = VAR_9 * 0x010101;", "}", "break;", "case TIFF_COMPR:\nVAR_0->compr = VAR_8;", "VAR_0->predictor = 0;", "switch(VAR_0->compr){", "case TIFF_RAW:\ncase TIFF_PACKBITS:\ncase TIFF_LZW:\ncase TIFF_CCITT_RLE:\nbreak;", "case TIFF_G3:\ncase TIFF_G4:\nVAR_0->fax_opts = 0;", "break;", "case TIFF_DEFLATE:\ncase TIFF_ADOBE_DEFLATE:\n#if CONFIG_ZLIB\nbreak;", "#else\nav_log(VAR_0->avctx, AV_LOG_ERROR, \"Deflate: ZLib not compiled in\\n\");", "return -1;", "#endif\ncase TIFF_JPEG:\ncase TIFF_NEWJPEG:\nav_log(VAR_0->avctx, AV_LOG_ERROR, \"JPEG compression is not supported\\n\");", "return -1;", "default:\nav_log(VAR_0->avctx, AV_LOG_ERROR, \"Unknown compression method %VAR_9\\n\", VAR_0->compr);", "return -1;", "}", "break;", "case TIFF_ROWSPERSTRIP:\nif(VAR_5 == TIFF_LONG && VAR_8 == -1)\nVAR_8 = VAR_0->avctx->height;", "if(VAR_8 < 1){", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"Incorrect VAR_8 of rows per strip\\n\");", "return -1;", "}", "VAR_0->rps = VAR_8;", "break;", "case TIFF_STRIP_OFFS:\nif(VAR_6 == 1){", "VAR_0->stripdata = NULL;", "VAR_0->stripoff = VAR_8;", "}else", "VAR_0->stripdata = VAR_1 + VAR_7;", "VAR_0->strips = VAR_6;", "if(VAR_0->strips == 1) VAR_0->rps = VAR_0->height;", "VAR_0->sot = VAR_5;", "if(VAR_0->stripdata > VAR_3){", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"Tag referencing position outside the image\\n\");", "return -1;", "}", "break;", "case TIFF_STRIP_SIZE:\nif(VAR_6 == 1){", "VAR_0->stripsizes = NULL;", "VAR_0->stripsize = VAR_8;", "VAR_0->strips = 1;", "}else{", "VAR_0->stripsizes = VAR_1 + VAR_7;", "}", "VAR_0->strips = VAR_6;", "VAR_0->sstype = VAR_5;", "if(VAR_0->stripsizes > VAR_3){", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"Tag referencing position outside the image\\n\");", "return -1;", "}", "break;", "case TIFF_PREDICTOR:\nVAR_0->predictor = VAR_8;", "break;", "case TIFF_INVERT:\nswitch(VAR_8){", "case 0:\nVAR_0->invert = 1;", "break;", "case 1:\nVAR_0->invert = 0;", "break;", "case 2:\ncase 3:\nbreak;", "default:\nav_log(VAR_0->avctx, AV_LOG_ERROR, \"Color mode %d is not supported\\n\", VAR_8);", "return -1;", "}", "break;", "case TIFF_FILL_ORDER:\nif(VAR_8 < 1 || VAR_8 > 2){", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"Unknown FillOrder VAR_8 %d, trying default one\\n\", VAR_8);", "VAR_8 = 1;", "}", "VAR_0->fill_order = VAR_8 - 1;", "break;", "case TIFF_PAL:\nif(VAR_0->avctx->pix_fmt != PIX_FMT_PAL8){", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"Palette met but this is not palettized format\\n\");", "return -1;", "}", "pal = (uint32_t *) VAR_0->picture.data[1];", "VAR_7 = type_sizes[VAR_5];", "VAR_11 = VAR_2;", "gp = VAR_2 + VAR_6 / 3 * VAR_7;", "bp = VAR_2 + VAR_6 / 3 * VAR_7 * 2;", "VAR_7 = (type_sizes[VAR_5] - 1) << 3;", "for(VAR_9 = 0; VAR_9 < VAR_6 / 3; VAR_9++){", "VAR_10 = (tget(&VAR_11, VAR_5, VAR_0->le) >> VAR_7) << 16;", "VAR_10 |= (tget(&gp, VAR_5, VAR_0->le) >> VAR_7) << 8;", "VAR_10 |= tget(&bp, VAR_5, VAR_0->le) >> VAR_7;", "pal[VAR_9] = VAR_10;", "}", "break;", "case TIFF_PLANAR:\nif(VAR_8 == 2){", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"Planar format is not supported\\n\");", "return -1;", "}", "break;", "case TIFF_T4OPTIONS:\nif(VAR_0->compr == TIFF_G3)\nVAR_0->fax_opts = VAR_8;", "break;", "case TIFF_T6OPTIONS:\nif(VAR_0->compr == TIFF_G4)\nVAR_0->fax_opts = VAR_8;", "break;", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29, 31, 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41, 43 ], [ 45 ], [ 47 ], [ 49, 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59, 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 89 ], [ 91, 93 ], [ 95 ], [ 97, 99 ], [ 101 ], [ 103, 105 ], [ 107 ], [ 109 ], [ 111, 113 ], [ 115 ], [ 117, 119, 121 ], [ 123 ], [ 125 ], [ 127, 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145, 147 ], [ 149 ], [ 151, 153 ], [ 155 ], [ 157, 159 ], [ 161 ], [ 163, 165 ], [ 167 ], [ 169, 171 ], [ 173 ], [ 175, 177 ], [ 179 ], [ 181, 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191, 193 ], [ 195 ], [ 197 ], [ 199, 201 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ], [ 225, 227 ], [ 229 ], [ 231 ], [ 233, 235, 237, 239, 241 ], [ 243, 245, 247 ], [ 249 ], [ 251, 253, 255, 257 ], [ 259, 261 ], [ 263 ], [ 265, 267, 269, 271 ], [ 273 ], [ 275, 277 ], [ 279 ], [ 281 ], [ 283 ], [ 285, 287, 289 ], [ 291 ], [ 293 ], [ 295 ], [ 297 ], [ 299 ], [ 301 ], [ 303, 305 ], [ 307 ], [ 309 ], [ 311 ], [ 313 ], [ 315 ], [ 317 ], [ 319 ], [ 321 ], [ 323 ], [ 325 ], [ 327 ], [ 329 ], [ 331, 333 ], [ 335 ], [ 337 ], [ 339 ], [ 341 ], [ 343 ], [ 345 ], [ 347 ], [ 349 ], [ 351 ], [ 353 ], [ 355 ], [ 357 ], [ 359 ], [ 361, 363 ], [ 365 ], [ 367, 369 ], [ 371, 373 ], [ 375 ], [ 377, 379 ], [ 381 ], [ 383, 385, 387 ], [ 389, 391 ], [ 393 ], [ 395 ], [ 397 ], [ 399, 401 ], [ 403 ], [ 405 ], [ 407 ], [ 409 ], [ 411 ], [ 413, 415 ], [ 417 ], [ 419 ], [ 421 ], [ 423 ], [ 425 ], [ 427 ], [ 429 ], [ 431 ], [ 433 ], [ 435 ], [ 437 ], [ 439 ], [ 441 ], [ 443 ], [ 445 ], [ 447 ], [ 449, 451 ], [ 453 ], [ 455 ], [ 457 ], [ 459 ], [ 461, 463, 465 ], [ 467 ], [ 469, 471, 473 ], [ 475 ], [ 477 ], [ 479 ], [ 481 ] ]
11,249
static int qcow2_open(BlockDriverState *bs, QDict *options, int flags, Error **errp) { BDRVQcowState *s = bs->opaque; int len, i, ret = 0; QCowHeader header; QemuOpts *opts; Error *local_err = NULL; uint64_t ext_end; uint64_t l1_vm_state_index; const char *opt_overlap_check; int overlap_check_template = 0; ret = bdrv_pread(bs->file, 0, &header, sizeof(header)); if (ret < 0) { error_setg_errno(errp, -ret, "Could not read qcow2 header"); be32_to_cpus(&header.magic); be32_to_cpus(&header.version); be64_to_cpus(&header.backing_file_offset); be32_to_cpus(&header.backing_file_size); be64_to_cpus(&header.size); be32_to_cpus(&header.cluster_bits); be32_to_cpus(&header.crypt_method); be64_to_cpus(&header.l1_table_offset); be32_to_cpus(&header.l1_size); be64_to_cpus(&header.refcount_table_offset); be32_to_cpus(&header.refcount_table_clusters); be64_to_cpus(&header.snapshots_offset); be32_to_cpus(&header.nb_snapshots); if (header.magic != QCOW_MAGIC) { error_setg(errp, "Image is not in qcow2 format"); if (header.version < 2 || header.version > 3) { report_unsupported(bs, errp, "QCOW version %d", header.version); ret = -ENOTSUP; s->qcow_version = header.version; /* Initialise cluster size */ if (header.cluster_bits < MIN_CLUSTER_BITS || header.cluster_bits > MAX_CLUSTER_BITS) { error_setg(errp, "Unsupported cluster size: 2^%i", header.cluster_bits); s->cluster_bits = header.cluster_bits; s->cluster_size = 1 << s->cluster_bits; s->cluster_sectors = 1 << (s->cluster_bits - 9); /* Initialise version 3 header fields */ if (header.version == 2) { header.incompatible_features = 0; header.compatible_features = 0; header.autoclear_features = 0; header.refcount_order = 4; header.header_length = 72; } else { be64_to_cpus(&header.incompatible_features); be64_to_cpus(&header.compatible_features); be64_to_cpus(&header.autoclear_features); be32_to_cpus(&header.refcount_order); be32_to_cpus(&header.header_length); if (header.header_length < 104) { error_setg(errp, "qcow2 header too short"); if (header.header_length > s->cluster_size) { error_setg(errp, "qcow2 header exceeds cluster size"); if (header.header_length > sizeof(header)) { s->unknown_header_fields_size = header.header_length - sizeof(header); s->unknown_header_fields = g_malloc(s->unknown_header_fields_size); ret = bdrv_pread(bs->file, sizeof(header), s->unknown_header_fields, s->unknown_header_fields_size); if (ret < 0) { error_setg_errno(errp, -ret, "Could not read unknown qcow2 header " "fields"); if (header.backing_file_offset) { ext_end = header.backing_file_offset; } else { ext_end = 1 << header.cluster_bits; /* Handle feature bits */ s->incompatible_features = header.incompatible_features; s->compatible_features = header.compatible_features; s->autoclear_features = header.autoclear_features; if (s->incompatible_features & ~QCOW2_INCOMPAT_MASK) { void *feature_table = NULL; qcow2_read_extensions(bs, header.header_length, ext_end, &feature_table, NULL); report_unsupported_feature(bs, errp, feature_table, s->incompatible_features & ~QCOW2_INCOMPAT_MASK); ret = -ENOTSUP; g_free(feature_table); if (s->incompatible_features & QCOW2_INCOMPAT_CORRUPT) { /* Corrupt images may not be written to unless they are being repaired */ if ((flags & BDRV_O_RDWR) && !(flags & BDRV_O_CHECK)) { error_setg(errp, "qcow2: Image is corrupt; cannot be opened " "read/write"); ret = -EACCES; /* Check support for various header values */ if (header.refcount_order != 4) { report_unsupported(bs, errp, "%d bit reference counts", 1 << header.refcount_order); ret = -ENOTSUP; s->refcount_order = header.refcount_order; if (header.crypt_method > QCOW_CRYPT_AES) { error_setg(errp, "Unsupported encryption method: %i", header.crypt_method); s->crypt_method_header = header.crypt_method; if (s->crypt_method_header) { bs->encrypted = 1; s->l2_bits = s->cluster_bits - 3; /* L2 is always one cluster */ s->l2_size = 1 << s->l2_bits; bs->total_sectors = header.size / 512; s->csize_shift = (62 - (s->cluster_bits - 8)); s->csize_mask = (1 << (s->cluster_bits - 8)) - 1; s->cluster_offset_mask = (1LL << s->csize_shift) - 1; s->refcount_table_offset = header.refcount_table_offset; s->refcount_table_size = header.refcount_table_clusters << (s->cluster_bits - 3); s->snapshots_offset = header.snapshots_offset; s->nb_snapshots = header.nb_snapshots; /* read the level 1 table */ s->l1_size = header.l1_size; l1_vm_state_index = size_to_l1(s, header.size); if (l1_vm_state_index > INT_MAX) { error_setg(errp, "Image is too big"); ret = -EFBIG; s->l1_vm_state_index = l1_vm_state_index; /* the L1 table must contain at least enough entries to put header.size bytes */ if (s->l1_size < s->l1_vm_state_index) { error_setg(errp, "L1 table is too small"); s->l1_table_offset = header.l1_table_offset; if (s->l1_size > 0) { s->l1_table = g_malloc0( align_offset(s->l1_size * sizeof(uint64_t), 512)); ret = bdrv_pread(bs->file, s->l1_table_offset, s->l1_table, s->l1_size * sizeof(uint64_t)); if (ret < 0) { error_setg_errno(errp, -ret, "Could not read L1 table"); for(i = 0;i < s->l1_size; i++) { be64_to_cpus(&s->l1_table[i]); /* alloc L2 table/refcount block cache */ s->l2_table_cache = qcow2_cache_create(bs, L2_CACHE_SIZE); s->refcount_block_cache = qcow2_cache_create(bs, REFCOUNT_CACHE_SIZE); s->cluster_cache = g_malloc(s->cluster_size); /* one more sector for decompressed data alignment */ s->cluster_data = qemu_blockalign(bs, QCOW_MAX_CRYPT_CLUSTERS * s->cluster_size + 512); s->cluster_cache_offset = -1; s->flags = flags; ret = qcow2_refcount_init(bs); if (ret != 0) { error_setg_errno(errp, -ret, "Could not initialize refcount handling"); QLIST_INIT(&s->cluster_allocs); QTAILQ_INIT(&s->discards); /* read qcow2 extensions */ if (qcow2_read_extensions(bs, header.header_length, ext_end, NULL, &local_err)) { error_propagate(errp, local_err); /* read the backing file name */ if (header.backing_file_offset != 0) { len = header.backing_file_size; if (len > 1023) { len = 1023; ret = bdrv_pread(bs->file, header.backing_file_offset, bs->backing_file, len); if (ret < 0) { error_setg_errno(errp, -ret, "Could not read backing file name"); bs->backing_file[len] = '\0'; ret = qcow2_read_snapshots(bs); if (ret < 0) { error_setg_errno(errp, -ret, "Could not read snapshots"); /* Clear unknown autoclear feature bits */ if (!bs->read_only && !(flags & BDRV_O_INCOMING) && s->autoclear_features) { s->autoclear_features = 0; ret = qcow2_update_header(bs); if (ret < 0) { error_setg_errno(errp, -ret, "Could not update qcow2 header"); /* Initialise locks */ qemu_co_mutex_init(&s->lock); /* Repair image if dirty */ if (!(flags & (BDRV_O_CHECK | BDRV_O_INCOMING)) && !bs->read_only && (s->incompatible_features & QCOW2_INCOMPAT_DIRTY)) { BdrvCheckResult result = {0}; ret = qcow2_check(bs, &result, BDRV_FIX_ERRORS); if (ret < 0) { error_setg_errno(errp, -ret, "Could not repair dirty image"); /* Enable lazy_refcounts according to image and command line options */ opts = qemu_opts_create(&qcow2_runtime_opts, NULL, 0, &error_abort); qemu_opts_absorb_qdict(opts, options, &local_err); if (local_err) { error_propagate(errp, local_err); s->use_lazy_refcounts = qemu_opt_get_bool(opts, QCOW2_OPT_LAZY_REFCOUNTS, (s->compatible_features & QCOW2_COMPAT_LAZY_REFCOUNTS)); s->discard_passthrough[QCOW2_DISCARD_NEVER] = false; s->discard_passthrough[QCOW2_DISCARD_ALWAYS] = true; s->discard_passthrough[QCOW2_DISCARD_REQUEST] = qemu_opt_get_bool(opts, QCOW2_OPT_DISCARD_REQUEST, flags & BDRV_O_UNMAP); s->discard_passthrough[QCOW2_DISCARD_SNAPSHOT] = qemu_opt_get_bool(opts, QCOW2_OPT_DISCARD_SNAPSHOT, true); s->discard_passthrough[QCOW2_DISCARD_OTHER] = qemu_opt_get_bool(opts, QCOW2_OPT_DISCARD_OTHER, false); opt_overlap_check = qemu_opt_get(opts, "overlap-check") ?: "cached"; if (!strcmp(opt_overlap_check, "none")) { overlap_check_template = 0; } else if (!strcmp(opt_overlap_check, "constant")) { overlap_check_template = QCOW2_OL_CONSTANT; } else if (!strcmp(opt_overlap_check, "cached")) { overlap_check_template = QCOW2_OL_CACHED; } else if (!strcmp(opt_overlap_check, "all")) { overlap_check_template = QCOW2_OL_ALL; } else { error_setg(errp, "Unsupported value '%s' for qcow2 option " "'overlap-check'. Allowed are either of the following: " "none, constant, cached, all", opt_overlap_check); qemu_opts_del(opts); s->overlap_check = 0; for (i = 0; i < QCOW2_OL_MAX_BITNR; i++) { /* overlap-check defines a template bitmask, but every flag may be * overwritten through the associated boolean option */ s->overlap_check |= qemu_opt_get_bool(opts, overlap_bool_option_names[i], overlap_check_template & (1 << i)) << i; qemu_opts_del(opts); if (s->use_lazy_refcounts && s->qcow_version < 3) { error_setg(errp, "Lazy refcounts require a qcow2 image with at least " "qemu 1.1 compatibility level"); #ifdef DEBUG_ALLOC { BdrvCheckResult result = {0}; qcow2_check_refcounts(bs, &result, 0); #endif return ret; fail: g_free(s->unknown_header_fields); cleanup_unknown_header_ext(bs); qcow2_free_snapshots(bs); qcow2_refcount_close(bs); g_free(s->l1_table); /* else pre-write overlap checks in cache_destroy may crash */ s->l1_table = NULL; if (s->l2_table_cache) { qcow2_cache_destroy(bs, s->l2_table_cache); if (s->refcount_block_cache) { qcow2_cache_destroy(bs, s->refcount_block_cache); g_free(s->cluster_cache); qemu_vfree(s->cluster_data); return ret;
true
qemu
a1b3955c9415b1e767c130a2f59fee6aa28e575b
static int qcow2_open(BlockDriverState *bs, QDict *options, int flags, Error **errp) { BDRVQcowState *s = bs->opaque; int len, i, ret = 0; QCowHeader header; QemuOpts *opts; Error *local_err = NULL; uint64_t ext_end; uint64_t l1_vm_state_index; const char *opt_overlap_check; int overlap_check_template = 0; ret = bdrv_pread(bs->file, 0, &header, sizeof(header)); if (ret < 0) { error_setg_errno(errp, -ret, "Could not read qcow2 header"); be32_to_cpus(&header.magic); be32_to_cpus(&header.version); be64_to_cpus(&header.backing_file_offset); be32_to_cpus(&header.backing_file_size); be64_to_cpus(&header.size); be32_to_cpus(&header.cluster_bits); be32_to_cpus(&header.crypt_method); be64_to_cpus(&header.l1_table_offset); be32_to_cpus(&header.l1_size); be64_to_cpus(&header.refcount_table_offset); be32_to_cpus(&header.refcount_table_clusters); be64_to_cpus(&header.snapshots_offset); be32_to_cpus(&header.nb_snapshots); if (header.magic != QCOW_MAGIC) { error_setg(errp, "Image is not in qcow2 format"); if (header.version < 2 || header.version > 3) { report_unsupported(bs, errp, "QCOW version %d", header.version); ret = -ENOTSUP; s->qcow_version = header.version; if (header.cluster_bits < MIN_CLUSTER_BITS || header.cluster_bits > MAX_CLUSTER_BITS) { error_setg(errp, "Unsupported cluster size: 2^%i", header.cluster_bits); s->cluster_bits = header.cluster_bits; s->cluster_size = 1 << s->cluster_bits; s->cluster_sectors = 1 << (s->cluster_bits - 9); if (header.version == 2) { header.incompatible_features = 0; header.compatible_features = 0; header.autoclear_features = 0; header.refcount_order = 4; header.header_length = 72; } else { be64_to_cpus(&header.incompatible_features); be64_to_cpus(&header.compatible_features); be64_to_cpus(&header.autoclear_features); be32_to_cpus(&header.refcount_order); be32_to_cpus(&header.header_length); if (header.header_length < 104) { error_setg(errp, "qcow2 header too short"); if (header.header_length > s->cluster_size) { error_setg(errp, "qcow2 header exceeds cluster size"); if (header.header_length > sizeof(header)) { s->unknown_header_fields_size = header.header_length - sizeof(header); s->unknown_header_fields = g_malloc(s->unknown_header_fields_size); ret = bdrv_pread(bs->file, sizeof(header), s->unknown_header_fields, s->unknown_header_fields_size); if (ret < 0) { error_setg_errno(errp, -ret, "Could not read unknown qcow2 header " "fields"); if (header.backing_file_offset) { ext_end = header.backing_file_offset; } else { ext_end = 1 << header.cluster_bits; s->incompatible_features = header.incompatible_features; s->compatible_features = header.compatible_features; s->autoclear_features = header.autoclear_features; if (s->incompatible_features & ~QCOW2_INCOMPAT_MASK) { void *feature_table = NULL; qcow2_read_extensions(bs, header.header_length, ext_end, &feature_table, NULL); report_unsupported_feature(bs, errp, feature_table, s->incompatible_features & ~QCOW2_INCOMPAT_MASK); ret = -ENOTSUP; g_free(feature_table); if (s->incompatible_features & QCOW2_INCOMPAT_CORRUPT) { if ((flags & BDRV_O_RDWR) && !(flags & BDRV_O_CHECK)) { error_setg(errp, "qcow2: Image is corrupt; cannot be opened " "read/write"); ret = -EACCES; if (header.refcount_order != 4) { report_unsupported(bs, errp, "%d bit reference counts", 1 << header.refcount_order); ret = -ENOTSUP; s->refcount_order = header.refcount_order; if (header.crypt_method > QCOW_CRYPT_AES) { error_setg(errp, "Unsupported encryption method: %i", header.crypt_method); s->crypt_method_header = header.crypt_method; if (s->crypt_method_header) { bs->encrypted = 1; s->l2_bits = s->cluster_bits - 3; s->l2_size = 1 << s->l2_bits; bs->total_sectors = header.size / 512; s->csize_shift = (62 - (s->cluster_bits - 8)); s->csize_mask = (1 << (s->cluster_bits - 8)) - 1; s->cluster_offset_mask = (1LL << s->csize_shift) - 1; s->refcount_table_offset = header.refcount_table_offset; s->refcount_table_size = header.refcount_table_clusters << (s->cluster_bits - 3); s->snapshots_offset = header.snapshots_offset; s->nb_snapshots = header.nb_snapshots; s->l1_size = header.l1_size; l1_vm_state_index = size_to_l1(s, header.size); if (l1_vm_state_index > INT_MAX) { error_setg(errp, "Image is too big"); ret = -EFBIG; s->l1_vm_state_index = l1_vm_state_index; if (s->l1_size < s->l1_vm_state_index) { error_setg(errp, "L1 table is too small"); s->l1_table_offset = header.l1_table_offset; if (s->l1_size > 0) { s->l1_table = g_malloc0( align_offset(s->l1_size * sizeof(uint64_t), 512)); ret = bdrv_pread(bs->file, s->l1_table_offset, s->l1_table, s->l1_size * sizeof(uint64_t)); if (ret < 0) { error_setg_errno(errp, -ret, "Could not read L1 table"); for(i = 0;i < s->l1_size; i++) { be64_to_cpus(&s->l1_table[i]); s->l2_table_cache = qcow2_cache_create(bs, L2_CACHE_SIZE); s->refcount_block_cache = qcow2_cache_create(bs, REFCOUNT_CACHE_SIZE); s->cluster_cache = g_malloc(s->cluster_size); s->cluster_data = qemu_blockalign(bs, QCOW_MAX_CRYPT_CLUSTERS * s->cluster_size + 512); s->cluster_cache_offset = -1; s->flags = flags; ret = qcow2_refcount_init(bs); if (ret != 0) { error_setg_errno(errp, -ret, "Could not initialize refcount handling"); QLIST_INIT(&s->cluster_allocs); QTAILQ_INIT(&s->discards); if (qcow2_read_extensions(bs, header.header_length, ext_end, NULL, &local_err)) { error_propagate(errp, local_err); if (header.backing_file_offset != 0) { len = header.backing_file_size; if (len > 1023) { len = 1023; ret = bdrv_pread(bs->file, header.backing_file_offset, bs->backing_file, len); if (ret < 0) { error_setg_errno(errp, -ret, "Could not read backing file name"); bs->backing_file[len] = '\0'; ret = qcow2_read_snapshots(bs); if (ret < 0) { error_setg_errno(errp, -ret, "Could not read snapshots"); if (!bs->read_only && !(flags & BDRV_O_INCOMING) && s->autoclear_features) { s->autoclear_features = 0; ret = qcow2_update_header(bs); if (ret < 0) { error_setg_errno(errp, -ret, "Could not update qcow2 header"); qemu_co_mutex_init(&s->lock); if (!(flags & (BDRV_O_CHECK | BDRV_O_INCOMING)) && !bs->read_only && (s->incompatible_features & QCOW2_INCOMPAT_DIRTY)) { BdrvCheckResult result = {0}; ret = qcow2_check(bs, &result, BDRV_FIX_ERRORS); if (ret < 0) { error_setg_errno(errp, -ret, "Could not repair dirty image"); opts = qemu_opts_create(&qcow2_runtime_opts, NULL, 0, &error_abort); qemu_opts_absorb_qdict(opts, options, &local_err); if (local_err) { error_propagate(errp, local_err); s->use_lazy_refcounts = qemu_opt_get_bool(opts, QCOW2_OPT_LAZY_REFCOUNTS, (s->compatible_features & QCOW2_COMPAT_LAZY_REFCOUNTS)); s->discard_passthrough[QCOW2_DISCARD_NEVER] = false; s->discard_passthrough[QCOW2_DISCARD_ALWAYS] = true; s->discard_passthrough[QCOW2_DISCARD_REQUEST] = qemu_opt_get_bool(opts, QCOW2_OPT_DISCARD_REQUEST, flags & BDRV_O_UNMAP); s->discard_passthrough[QCOW2_DISCARD_SNAPSHOT] = qemu_opt_get_bool(opts, QCOW2_OPT_DISCARD_SNAPSHOT, true); s->discard_passthrough[QCOW2_DISCARD_OTHER] = qemu_opt_get_bool(opts, QCOW2_OPT_DISCARD_OTHER, false); opt_overlap_check = qemu_opt_get(opts, "overlap-check") ?: "cached"; if (!strcmp(opt_overlap_check, "none")) { overlap_check_template = 0; } else if (!strcmp(opt_overlap_check, "constant")) { overlap_check_template = QCOW2_OL_CONSTANT; } else if (!strcmp(opt_overlap_check, "cached")) { overlap_check_template = QCOW2_OL_CACHED; } else if (!strcmp(opt_overlap_check, "all")) { overlap_check_template = QCOW2_OL_ALL; } else { error_setg(errp, "Unsupported value '%s' for qcow2 option " "'overlap-check'. Allowed are either of the following: " "none, constant, cached, all", opt_overlap_check); qemu_opts_del(opts); s->overlap_check = 0; for (i = 0; i < QCOW2_OL_MAX_BITNR; i++) { s->overlap_check |= qemu_opt_get_bool(opts, overlap_bool_option_names[i], overlap_check_template & (1 << i)) << i; qemu_opts_del(opts); if (s->use_lazy_refcounts && s->qcow_version < 3) { error_setg(errp, "Lazy refcounts require a qcow2 image with at least " "qemu 1.1 compatibility level"); #ifdef DEBUG_ALLOC { BdrvCheckResult result = {0}; qcow2_check_refcounts(bs, &result, 0); #endif return ret; fail: g_free(s->unknown_header_fields); cleanup_unknown_header_ext(bs); qcow2_free_snapshots(bs); qcow2_refcount_close(bs); g_free(s->l1_table); s->l1_table = NULL; if (s->l2_table_cache) { qcow2_cache_destroy(bs, s->l2_table_cache); if (s->refcount_block_cache) { qcow2_cache_destroy(bs, s->refcount_block_cache); g_free(s->cluster_cache); qemu_vfree(s->cluster_data); return ret;
{ "code": [], "line_no": [] }
static int FUNC_0(BlockDriverState *VAR_0, QDict *VAR_1, int VAR_2, Error **VAR_3) { BDRVQcowState *s = VAR_0->opaque; int VAR_4, VAR_5, VAR_6 = 0; QCowHeader header; QemuOpts *opts; Error *local_err = NULL; uint64_t ext_end; uint64_t l1_vm_state_index; const char *VAR_7; int VAR_8 = 0; VAR_6 = bdrv_pread(VAR_0->file, 0, &header, sizeof(header)); if (VAR_6 < 0) { error_setg_errno(VAR_3, -VAR_6, "Could not read qcow2 header"); be32_to_cpus(&header.magic); be32_to_cpus(&header.version); be64_to_cpus(&header.backing_file_offset); be32_to_cpus(&header.backing_file_size); be64_to_cpus(&header.size); be32_to_cpus(&header.cluster_bits); be32_to_cpus(&header.crypt_method); be64_to_cpus(&header.l1_table_offset); be32_to_cpus(&header.l1_size); be64_to_cpus(&header.refcount_table_offset); be32_to_cpus(&header.refcount_table_clusters); be64_to_cpus(&header.snapshots_offset); be32_to_cpus(&header.nb_snapshots); if (header.magic != QCOW_MAGIC) { error_setg(VAR_3, "Image is not in qcow2 format"); if (header.version < 2 || header.version > 3) { report_unsupported(VAR_0, VAR_3, "QCOW version %d", header.version); VAR_6 = -ENOTSUP; s->qcow_version = header.version; if (header.cluster_bits < MIN_CLUSTER_BITS || header.cluster_bits > MAX_CLUSTER_BITS) { error_setg(VAR_3, "Unsupported cluster size: 2^%VAR_5", header.cluster_bits); s->cluster_bits = header.cluster_bits; s->cluster_size = 1 << s->cluster_bits; s->cluster_sectors = 1 << (s->cluster_bits - 9); if (header.version == 2) { header.incompatible_features = 0; header.compatible_features = 0; header.autoclear_features = 0; header.refcount_order = 4; header.header_length = 72; } else { be64_to_cpus(&header.incompatible_features); be64_to_cpus(&header.compatible_features); be64_to_cpus(&header.autoclear_features); be32_to_cpus(&header.refcount_order); be32_to_cpus(&header.header_length); if (header.header_length < 104) { error_setg(VAR_3, "qcow2 header too short"); if (header.header_length > s->cluster_size) { error_setg(VAR_3, "qcow2 header exceeds cluster size"); if (header.header_length > sizeof(header)) { s->unknown_header_fields_size = header.header_length - sizeof(header); s->unknown_header_fields = g_malloc(s->unknown_header_fields_size); VAR_6 = bdrv_pread(VAR_0->file, sizeof(header), s->unknown_header_fields, s->unknown_header_fields_size); if (VAR_6 < 0) { error_setg_errno(VAR_3, -VAR_6, "Could not read unknown qcow2 header " "fields"); if (header.backing_file_offset) { ext_end = header.backing_file_offset; } else { ext_end = 1 << header.cluster_bits; s->incompatible_features = header.incompatible_features; s->compatible_features = header.compatible_features; s->autoclear_features = header.autoclear_features; if (s->incompatible_features & ~QCOW2_INCOMPAT_MASK) { void *VAR_9 = NULL; qcow2_read_extensions(VAR_0, header.header_length, ext_end, &VAR_9, NULL); report_unsupported_feature(VAR_0, VAR_3, VAR_9, s->incompatible_features & ~QCOW2_INCOMPAT_MASK); VAR_6 = -ENOTSUP; g_free(VAR_9); if (s->incompatible_features & QCOW2_INCOMPAT_CORRUPT) { if ((VAR_2 & BDRV_O_RDWR) && !(VAR_2 & BDRV_O_CHECK)) { error_setg(VAR_3, "qcow2: Image is corrupt; cannot be opened " "read/write"); VAR_6 = -EACCES; if (header.refcount_order != 4) { report_unsupported(VAR_0, VAR_3, "%d bit reference counts", 1 << header.refcount_order); VAR_6 = -ENOTSUP; s->refcount_order = header.refcount_order; if (header.crypt_method > QCOW_CRYPT_AES) { error_setg(VAR_3, "Unsupported encryption method: %VAR_5", header.crypt_method); s->crypt_method_header = header.crypt_method; if (s->crypt_method_header) { VAR_0->encrypted = 1; s->l2_bits = s->cluster_bits - 3; s->l2_size = 1 << s->l2_bits; VAR_0->total_sectors = header.size / 512; s->csize_shift = (62 - (s->cluster_bits - 8)); s->csize_mask = (1 << (s->cluster_bits - 8)) - 1; s->cluster_offset_mask = (1LL << s->csize_shift) - 1; s->refcount_table_offset = header.refcount_table_offset; s->refcount_table_size = header.refcount_table_clusters << (s->cluster_bits - 3); s->snapshots_offset = header.snapshots_offset; s->nb_snapshots = header.nb_snapshots; s->l1_size = header.l1_size; l1_vm_state_index = size_to_l1(s, header.size); if (l1_vm_state_index > INT_MAX) { error_setg(VAR_3, "Image is too big"); VAR_6 = -EFBIG; s->l1_vm_state_index = l1_vm_state_index; if (s->l1_size < s->l1_vm_state_index) { error_setg(VAR_3, "L1 table is too small"); s->l1_table_offset = header.l1_table_offset; if (s->l1_size > 0) { s->l1_table = g_malloc0( align_offset(s->l1_size * sizeof(uint64_t), 512)); VAR_6 = bdrv_pread(VAR_0->file, s->l1_table_offset, s->l1_table, s->l1_size * sizeof(uint64_t)); if (VAR_6 < 0) { error_setg_errno(VAR_3, -VAR_6, "Could not read L1 table"); for(VAR_5 = 0;VAR_5 < s->l1_size; VAR_5++) { be64_to_cpus(&s->l1_table[VAR_5]); s->l2_table_cache = qcow2_cache_create(VAR_0, L2_CACHE_SIZE); s->refcount_block_cache = qcow2_cache_create(VAR_0, REFCOUNT_CACHE_SIZE); s->cluster_cache = g_malloc(s->cluster_size); s->cluster_data = qemu_blockalign(VAR_0, QCOW_MAX_CRYPT_CLUSTERS * s->cluster_size + 512); s->cluster_cache_offset = -1; s->VAR_2 = VAR_2; VAR_6 = qcow2_refcount_init(VAR_0); if (VAR_6 != 0) { error_setg_errno(VAR_3, -VAR_6, "Could not initialize refcount handling"); QLIST_INIT(&s->cluster_allocs); QTAILQ_INIT(&s->discards); if (qcow2_read_extensions(VAR_0, header.header_length, ext_end, NULL, &local_err)) { error_propagate(VAR_3, local_err); if (header.backing_file_offset != 0) { VAR_4 = header.backing_file_size; if (VAR_4 > 1023) { VAR_4 = 1023; VAR_6 = bdrv_pread(VAR_0->file, header.backing_file_offset, VAR_0->backing_file, VAR_4); if (VAR_6 < 0) { error_setg_errno(VAR_3, -VAR_6, "Could not read backing file name"); VAR_0->backing_file[VAR_4] = '\0'; VAR_6 = qcow2_read_snapshots(VAR_0); if (VAR_6 < 0) { error_setg_errno(VAR_3, -VAR_6, "Could not read snapshots"); if (!VAR_0->read_only && !(VAR_2 & BDRV_O_INCOMING) && s->autoclear_features) { s->autoclear_features = 0; VAR_6 = qcow2_update_header(VAR_0); if (VAR_6 < 0) { error_setg_errno(VAR_3, -VAR_6, "Could not update qcow2 header"); qemu_co_mutex_init(&s->lock); if (!(VAR_2 & (BDRV_O_CHECK | BDRV_O_INCOMING)) && !VAR_0->read_only && (s->incompatible_features & QCOW2_INCOMPAT_DIRTY)) { BdrvCheckResult result = {0}; VAR_6 = qcow2_check(VAR_0, &result, BDRV_FIX_ERRORS); if (VAR_6 < 0) { error_setg_errno(VAR_3, -VAR_6, "Could not repair dirty image"); opts = qemu_opts_create(&qcow2_runtime_opts, NULL, 0, &error_abort); qemu_opts_absorb_qdict(opts, VAR_1, &local_err); if (local_err) { error_propagate(VAR_3, local_err); s->use_lazy_refcounts = qemu_opt_get_bool(opts, QCOW2_OPT_LAZY_REFCOUNTS, (s->compatible_features & QCOW2_COMPAT_LAZY_REFCOUNTS)); s->discard_passthrough[QCOW2_DISCARD_NEVER] = false; s->discard_passthrough[QCOW2_DISCARD_ALWAYS] = true; s->discard_passthrough[QCOW2_DISCARD_REQUEST] = qemu_opt_get_bool(opts, QCOW2_OPT_DISCARD_REQUEST, VAR_2 & BDRV_O_UNMAP); s->discard_passthrough[QCOW2_DISCARD_SNAPSHOT] = qemu_opt_get_bool(opts, QCOW2_OPT_DISCARD_SNAPSHOT, true); s->discard_passthrough[QCOW2_DISCARD_OTHER] = qemu_opt_get_bool(opts, QCOW2_OPT_DISCARD_OTHER, false); VAR_7 = qemu_opt_get(opts, "overlap-check") ?: "cached"; if (!strcmp(VAR_7, "none")) { VAR_8 = 0; } else if (!strcmp(VAR_7, "constant")) { VAR_8 = QCOW2_OL_CONSTANT; } else if (!strcmp(VAR_7, "cached")) { VAR_8 = QCOW2_OL_CACHED; } else if (!strcmp(VAR_7, "all")) { VAR_8 = QCOW2_OL_ALL; } else { error_setg(VAR_3, "Unsupported value '%s' for qcow2 option " "'overlap-check'. Allowed are either of the following: " "none, constant, cached, all", VAR_7); qemu_opts_del(opts); s->overlap_check = 0; for (VAR_5 = 0; VAR_5 < QCOW2_OL_MAX_BITNR; VAR_5++) { s->overlap_check |= qemu_opt_get_bool(opts, overlap_bool_option_names[VAR_5], VAR_8 & (1 << VAR_5)) << VAR_5; qemu_opts_del(opts); if (s->use_lazy_refcounts && s->qcow_version < 3) { error_setg(VAR_3, "Lazy refcounts require a qcow2 image with at least " "qemu 1.1 compatibility level"); #ifdef DEBUG_ALLOC { BdrvCheckResult result = {0}; qcow2_check_refcounts(VAR_0, &result, 0); #endif return VAR_6; fail: g_free(s->unknown_header_fields); cleanup_unknown_header_ext(VAR_0); qcow2_free_snapshots(VAR_0); qcow2_refcount_close(VAR_0); g_free(s->l1_table); s->l1_table = NULL; if (s->l2_table_cache) { qcow2_cache_destroy(VAR_0, s->l2_table_cache); if (s->refcount_block_cache) { qcow2_cache_destroy(VAR_0, s->refcount_block_cache); g_free(s->cluster_cache); qemu_vfree(s->cluster_data); return VAR_6;
[ "static int FUNC_0(BlockDriverState *VAR_0, QDict *VAR_1, int VAR_2,\nError **VAR_3)\n{", "BDRVQcowState *s = VAR_0->opaque;", "int VAR_4, VAR_5, VAR_6 = 0;", "QCowHeader header;", "QemuOpts *opts;", "Error *local_err = NULL;", "uint64_t ext_end;", "uint64_t l1_vm_state_index;", "const char *VAR_7;", "int VAR_8 = 0;", "VAR_6 = bdrv_pread(VAR_0->file, 0, &header, sizeof(header));", "if (VAR_6 < 0) {", "error_setg_errno(VAR_3, -VAR_6, \"Could not read qcow2 header\");", "be32_to_cpus(&header.magic);", "be32_to_cpus(&header.version);", "be64_to_cpus(&header.backing_file_offset);", "be32_to_cpus(&header.backing_file_size);", "be64_to_cpus(&header.size);", "be32_to_cpus(&header.cluster_bits);", "be32_to_cpus(&header.crypt_method);", "be64_to_cpus(&header.l1_table_offset);", "be32_to_cpus(&header.l1_size);", "be64_to_cpus(&header.refcount_table_offset);", "be32_to_cpus(&header.refcount_table_clusters);", "be64_to_cpus(&header.snapshots_offset);", "be32_to_cpus(&header.nb_snapshots);", "if (header.magic != QCOW_MAGIC) {", "error_setg(VAR_3, \"Image is not in qcow2 format\");", "if (header.version < 2 || header.version > 3) {", "report_unsupported(VAR_0, VAR_3, \"QCOW version %d\", header.version);", "VAR_6 = -ENOTSUP;", "s->qcow_version = header.version;", "if (header.cluster_bits < MIN_CLUSTER_BITS ||\nheader.cluster_bits > MAX_CLUSTER_BITS) {", "error_setg(VAR_3, \"Unsupported cluster size: 2^%VAR_5\", header.cluster_bits);", "s->cluster_bits = header.cluster_bits;", "s->cluster_size = 1 << s->cluster_bits;", "s->cluster_sectors = 1 << (s->cluster_bits - 9);", "if (header.version == 2) {", "header.incompatible_features = 0;", "header.compatible_features = 0;", "header.autoclear_features = 0;", "header.refcount_order = 4;", "header.header_length = 72;", "} else {", "be64_to_cpus(&header.incompatible_features);", "be64_to_cpus(&header.compatible_features);", "be64_to_cpus(&header.autoclear_features);", "be32_to_cpus(&header.refcount_order);", "be32_to_cpus(&header.header_length);", "if (header.header_length < 104) {", "error_setg(VAR_3, \"qcow2 header too short\");", "if (header.header_length > s->cluster_size) {", "error_setg(VAR_3, \"qcow2 header exceeds cluster size\");", "if (header.header_length > sizeof(header)) {", "s->unknown_header_fields_size = header.header_length - sizeof(header);", "s->unknown_header_fields = g_malloc(s->unknown_header_fields_size);", "VAR_6 = bdrv_pread(VAR_0->file, sizeof(header), s->unknown_header_fields,\ns->unknown_header_fields_size);", "if (VAR_6 < 0) {", "error_setg_errno(VAR_3, -VAR_6, \"Could not read unknown qcow2 header \"\n\"fields\");", "if (header.backing_file_offset) {", "ext_end = header.backing_file_offset;", "} else {", "ext_end = 1 << header.cluster_bits;", "s->incompatible_features = header.incompatible_features;", "s->compatible_features = header.compatible_features;", "s->autoclear_features = header.autoclear_features;", "if (s->incompatible_features & ~QCOW2_INCOMPAT_MASK) {", "void *VAR_9 = NULL;", "qcow2_read_extensions(VAR_0, header.header_length, ext_end,\n&VAR_9, NULL);", "report_unsupported_feature(VAR_0, VAR_3, VAR_9,\ns->incompatible_features &\n~QCOW2_INCOMPAT_MASK);", "VAR_6 = -ENOTSUP;", "g_free(VAR_9);", "if (s->incompatible_features & QCOW2_INCOMPAT_CORRUPT) {", "if ((VAR_2 & BDRV_O_RDWR) && !(VAR_2 & BDRV_O_CHECK)) {", "error_setg(VAR_3, \"qcow2: Image is corrupt; cannot be opened \"", "\"read/write\");", "VAR_6 = -EACCES;", "if (header.refcount_order != 4) {", "report_unsupported(VAR_0, VAR_3, \"%d bit reference counts\",\n1 << header.refcount_order);", "VAR_6 = -ENOTSUP;", "s->refcount_order = header.refcount_order;", "if (header.crypt_method > QCOW_CRYPT_AES) {", "error_setg(VAR_3, \"Unsupported encryption method: %VAR_5\",\nheader.crypt_method);", "s->crypt_method_header = header.crypt_method;", "if (s->crypt_method_header) {", "VAR_0->encrypted = 1;", "s->l2_bits = s->cluster_bits - 3;", "s->l2_size = 1 << s->l2_bits;", "VAR_0->total_sectors = header.size / 512;", "s->csize_shift = (62 - (s->cluster_bits - 8));", "s->csize_mask = (1 << (s->cluster_bits - 8)) - 1;", "s->cluster_offset_mask = (1LL << s->csize_shift) - 1;", "s->refcount_table_offset = header.refcount_table_offset;", "s->refcount_table_size =\nheader.refcount_table_clusters << (s->cluster_bits - 3);", "s->snapshots_offset = header.snapshots_offset;", "s->nb_snapshots = header.nb_snapshots;", "s->l1_size = header.l1_size;", "l1_vm_state_index = size_to_l1(s, header.size);", "if (l1_vm_state_index > INT_MAX) {", "error_setg(VAR_3, \"Image is too big\");", "VAR_6 = -EFBIG;", "s->l1_vm_state_index = l1_vm_state_index;", "if (s->l1_size < s->l1_vm_state_index) {", "error_setg(VAR_3, \"L1 table is too small\");", "s->l1_table_offset = header.l1_table_offset;", "if (s->l1_size > 0) {", "s->l1_table = g_malloc0(\nalign_offset(s->l1_size * sizeof(uint64_t), 512));", "VAR_6 = bdrv_pread(VAR_0->file, s->l1_table_offset, s->l1_table,\ns->l1_size * sizeof(uint64_t));", "if (VAR_6 < 0) {", "error_setg_errno(VAR_3, -VAR_6, \"Could not read L1 table\");", "for(VAR_5 = 0;VAR_5 < s->l1_size; VAR_5++) {", "be64_to_cpus(&s->l1_table[VAR_5]);", "s->l2_table_cache = qcow2_cache_create(VAR_0, L2_CACHE_SIZE);", "s->refcount_block_cache = qcow2_cache_create(VAR_0, REFCOUNT_CACHE_SIZE);", "s->cluster_cache = g_malloc(s->cluster_size);", "s->cluster_data = qemu_blockalign(VAR_0, QCOW_MAX_CRYPT_CLUSTERS * s->cluster_size\n+ 512);", "s->cluster_cache_offset = -1;", "s->VAR_2 = VAR_2;", "VAR_6 = qcow2_refcount_init(VAR_0);", "if (VAR_6 != 0) {", "error_setg_errno(VAR_3, -VAR_6, \"Could not initialize refcount handling\");", "QLIST_INIT(&s->cluster_allocs);", "QTAILQ_INIT(&s->discards);", "if (qcow2_read_extensions(VAR_0, header.header_length, ext_end, NULL,\n&local_err)) {", "error_propagate(VAR_3, local_err);", "if (header.backing_file_offset != 0) {", "VAR_4 = header.backing_file_size;", "if (VAR_4 > 1023) {", "VAR_4 = 1023;", "VAR_6 = bdrv_pread(VAR_0->file, header.backing_file_offset,\nVAR_0->backing_file, VAR_4);", "if (VAR_6 < 0) {", "error_setg_errno(VAR_3, -VAR_6, \"Could not read backing file name\");", "VAR_0->backing_file[VAR_4] = '\\0';", "VAR_6 = qcow2_read_snapshots(VAR_0);", "if (VAR_6 < 0) {", "error_setg_errno(VAR_3, -VAR_6, \"Could not read snapshots\");", "if (!VAR_0->read_only && !(VAR_2 & BDRV_O_INCOMING) && s->autoclear_features) {", "s->autoclear_features = 0;", "VAR_6 = qcow2_update_header(VAR_0);", "if (VAR_6 < 0) {", "error_setg_errno(VAR_3, -VAR_6, \"Could not update qcow2 header\");", "qemu_co_mutex_init(&s->lock);", "if (!(VAR_2 & (BDRV_O_CHECK | BDRV_O_INCOMING)) && !VAR_0->read_only &&\n(s->incompatible_features & QCOW2_INCOMPAT_DIRTY)) {", "BdrvCheckResult result = {0};", "VAR_6 = qcow2_check(VAR_0, &result, BDRV_FIX_ERRORS);", "if (VAR_6 < 0) {", "error_setg_errno(VAR_3, -VAR_6, \"Could not repair dirty image\");", "opts = qemu_opts_create(&qcow2_runtime_opts, NULL, 0, &error_abort);", "qemu_opts_absorb_qdict(opts, VAR_1, &local_err);", "if (local_err) {", "error_propagate(VAR_3, local_err);", "s->use_lazy_refcounts = qemu_opt_get_bool(opts, QCOW2_OPT_LAZY_REFCOUNTS,\n(s->compatible_features & QCOW2_COMPAT_LAZY_REFCOUNTS));", "s->discard_passthrough[QCOW2_DISCARD_NEVER] = false;", "s->discard_passthrough[QCOW2_DISCARD_ALWAYS] = true;", "s->discard_passthrough[QCOW2_DISCARD_REQUEST] =\nqemu_opt_get_bool(opts, QCOW2_OPT_DISCARD_REQUEST,\nVAR_2 & BDRV_O_UNMAP);", "s->discard_passthrough[QCOW2_DISCARD_SNAPSHOT] =\nqemu_opt_get_bool(opts, QCOW2_OPT_DISCARD_SNAPSHOT, true);", "s->discard_passthrough[QCOW2_DISCARD_OTHER] =\nqemu_opt_get_bool(opts, QCOW2_OPT_DISCARD_OTHER, false);", "VAR_7 = qemu_opt_get(opts, \"overlap-check\") ?: \"cached\";", "if (!strcmp(VAR_7, \"none\")) {", "VAR_8 = 0;", "} else if (!strcmp(VAR_7, \"constant\")) {", "VAR_8 = QCOW2_OL_CONSTANT;", "} else if (!strcmp(VAR_7, \"cached\")) {", "VAR_8 = QCOW2_OL_CACHED;", "} else if (!strcmp(VAR_7, \"all\")) {", "VAR_8 = QCOW2_OL_ALL;", "} else {", "error_setg(VAR_3, \"Unsupported value '%s' for qcow2 option \"\n\"'overlap-check'. Allowed are either of the following: \"\n\"none, constant, cached, all\", VAR_7);", "qemu_opts_del(opts);", "s->overlap_check = 0;", "for (VAR_5 = 0; VAR_5 < QCOW2_OL_MAX_BITNR; VAR_5++) {", "s->overlap_check |=\nqemu_opt_get_bool(opts, overlap_bool_option_names[VAR_5],\nVAR_8 & (1 << VAR_5)) << VAR_5;", "qemu_opts_del(opts);", "if (s->use_lazy_refcounts && s->qcow_version < 3) {", "error_setg(VAR_3, \"Lazy refcounts require a qcow2 image with at least \"\n\"qemu 1.1 compatibility level\");", "#ifdef DEBUG_ALLOC\n{", "BdrvCheckResult result = {0};", "qcow2_check_refcounts(VAR_0, &result, 0);", "#endif\nreturn VAR_6;", "fail:\ng_free(s->unknown_header_fields);", "cleanup_unknown_header_ext(VAR_0);", "qcow2_free_snapshots(VAR_0);", "qcow2_refcount_close(VAR_0);", "g_free(s->l1_table);", "s->l1_table = NULL;", "if (s->l2_table_cache) {", "qcow2_cache_destroy(VAR_0, s->l2_table_cache);", "if (s->refcount_block_cache) {", "qcow2_cache_destroy(VAR_0, s->refcount_block_cache);", "g_free(s->cluster_cache);", "qemu_vfree(s->cluster_data);", "return VAR_6;" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 2, 3 ], [ 4 ], [ 5 ], [ 6 ], [ 7 ], [ 8 ], [ 9 ], [ 10 ], [ 11 ], [ 12 ], [ 13 ], [ 14 ], [ 15 ], [ 16 ], [ 17 ], [ 18 ], [ 19 ], [ 20 ], [ 21 ], [ 22 ], [ 23 ], [ 24 ], [ 25 ], [ 26 ], [ 27 ], [ 28 ], [ 29 ], [ 30 ], [ 31 ], [ 32 ], [ 33 ], [ 34 ], [ 36, 37 ], [ 38 ], [ 39 ], [ 40 ], [ 41 ], [ 43 ], [ 44 ], [ 45 ], [ 46 ], [ 47 ], [ 48 ], [ 49 ], [ 50 ], [ 51 ], [ 52 ], [ 53 ], [ 54 ], [ 55 ], [ 56 ], [ 57 ], [ 58 ], [ 59 ], [ 60 ], [ 61 ], [ 62, 63 ], [ 64 ], [ 65, 66 ], [ 67 ], [ 68 ], [ 69 ], [ 70 ], [ 72 ], [ 73 ], [ 74 ], [ 75 ], [ 76 ], [ 77, 78 ], [ 79, 80, 81 ], [ 82 ], [ 83 ], [ 84 ], [ 87 ], [ 88 ], [ 89 ], [ 90 ], [ 92 ], [ 93, 94 ], [ 95 ], [ 96 ], [ 97 ], [ 98, 99 ], [ 100 ], [ 101 ], [ 102 ], [ 103 ], [ 104 ], [ 105 ], [ 106 ], [ 107 ], [ 108 ], [ 109 ], [ 110, 111 ], [ 112 ], [ 113 ], [ 115 ], [ 116 ], [ 117 ], [ 118 ], [ 119 ], [ 120 ], [ 123 ], [ 124 ], [ 125 ], [ 126 ], [ 127, 128 ], [ 129, 130 ], [ 131 ], [ 132 ], [ 133 ], [ 134 ], [ 136 ], [ 137 ], [ 138 ], [ 140, 141 ], [ 142 ], [ 143 ], [ 144 ], [ 145 ], [ 146 ], [ 147 ], [ 148 ], [ 150, 151 ], [ 152 ], [ 154 ], [ 155 ], [ 156 ], [ 157 ], [ 158, 159 ], [ 160 ], [ 161 ], [ 162 ], [ 163 ], [ 164 ], [ 165 ], [ 167 ], [ 168 ], [ 169 ], [ 170 ], [ 171 ], [ 173 ], [ 175, 176 ], [ 177 ], [ 178 ], [ 179 ], [ 180 ], [ 182 ], [ 183 ], [ 184 ], [ 185 ], [ 186, 187 ], [ 188 ], [ 189 ], [ 190, 191, 192 ], [ 193, 194 ], [ 195, 196 ], [ 197 ], [ 198 ], [ 199 ], [ 200 ], [ 201 ], [ 202 ], [ 203 ], [ 204 ], [ 205 ], [ 206 ], [ 207, 208, 209 ], [ 210 ], [ 211 ], [ 212 ], [ 215, 216, 217 ], [ 218 ], [ 219 ], [ 220, 221 ], [ 222, 223 ], [ 224 ], [ 225 ], [ 226, 227 ], [ 228, 229 ], [ 230 ], [ 231 ], [ 232 ], [ 233 ], [ 235 ], [ 236 ], [ 237 ], [ 238 ], [ 239 ], [ 240 ], [ 241 ], [ 242 ] ]
11,250
static void ape_unpack_mono(APEContext *ctx, int count) { if (ctx->frameflags & APE_FRAMECODE_STEREO_SILENCE) { /* We are pure silence, so we're done. */ av_log(ctx->avctx, AV_LOG_DEBUG, "pure silence mono\n"); return; } entropy_decode(ctx, count, 0); ape_apply_filters(ctx, ctx->decoded[0], NULL, count); /* Now apply the predictor decoding */ predictor_decode_mono(ctx, count); /* Pseudo-stereo - just copy left channel to right channel */ if (ctx->channels == 2) { memcpy(ctx->decoded[1], ctx->decoded[0], count * sizeof(*ctx->decoded[1])); } }
false
FFmpeg
b164d66e35d349de414e2f0d7365a147aba8a620
static void ape_unpack_mono(APEContext *ctx, int count) { if (ctx->frameflags & APE_FRAMECODE_STEREO_SILENCE) { av_log(ctx->avctx, AV_LOG_DEBUG, "pure silence mono\n"); return; } entropy_decode(ctx, count, 0); ape_apply_filters(ctx, ctx->decoded[0], NULL, count); predictor_decode_mono(ctx, count); if (ctx->channels == 2) { memcpy(ctx->decoded[1], ctx->decoded[0], count * sizeof(*ctx->decoded[1])); } }
{ "code": [], "line_no": [] }
static void FUNC_0(APEContext *VAR_0, int VAR_1) { if (VAR_0->frameflags & APE_FRAMECODE_STEREO_SILENCE) { av_log(VAR_0->avctx, AV_LOG_DEBUG, "pure silence mono\n"); return; } entropy_decode(VAR_0, VAR_1, 0); ape_apply_filters(VAR_0, VAR_0->decoded[0], NULL, VAR_1); predictor_decode_mono(VAR_0, VAR_1); if (VAR_0->channels == 2) { memcpy(VAR_0->decoded[1], VAR_0->decoded[0], VAR_1 * sizeof(*VAR_0->decoded[1])); } }
[ "static void FUNC_0(APEContext *VAR_0, int VAR_1)\n{", "if (VAR_0->frameflags & APE_FRAMECODE_STEREO_SILENCE) {", "av_log(VAR_0->avctx, AV_LOG_DEBUG, \"pure silence mono\\n\");", "return;", "}", "entropy_decode(VAR_0, VAR_1, 0);", "ape_apply_filters(VAR_0, VAR_0->decoded[0], NULL, VAR_1);", "predictor_decode_mono(VAR_0, VAR_1);", "if (VAR_0->channels == 2) {", "memcpy(VAR_0->decoded[1], VAR_0->decoded[0], VAR_1 * sizeof(*VAR_0->decoded[1]));", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 25 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ] ]
11,251
static int _do_bit_allocation(AC3DecodeContext *ctx, int chnl) { ac3_audio_block *ab = &ctx->audio_block; int16_t sdecay, fdecay, sgain, dbknee, floor; int16_t lowcomp, fgain, snroffset, fastleak, slowleak; int16_t psd[256], bndpsd[50], excite[50], mask[50], delta; uint8_t start, end, bin, i, j, k, lastbin, bndstrt, bndend, begin, deltnseg, band, seg, address; uint8_t fscod = ctx->sync_info.fscod; uint8_t *exps, *deltoffst, *deltlen, *deltba; uint8_t *baps; int do_delta = 0; /* initialization */ sdecay = sdecaytab[ab->sdcycod]; fdecay = fdecaytab[ab->fdcycod]; sgain = sgaintab[ab->sgaincod]; dbknee = dbkneetab[ab->dbpbcod]; floor = floortab[ab->floorcod]; if (chnl == 5) { start = ab->cplstrtmant; end = ab->cplendmant; fgain = fgaintab[ab->cplfgaincod]; snroffset = (((ab->csnroffst - 15) << 4) + ab->cplfsnroffst) << 2; fastleak = (ab->cplfleak << 8) + 768; slowleak = (ab->cplsleak << 8) + 768; exps = ab->dcplexps; baps = ab->cplbap; if (ab->cpldeltbae == 0 || ab->cpldeltbae == 1) { do_delta = 1; deltnseg = ab->cpldeltnseg; deltoffst = ab->cpldeltoffst; deltlen = ab->cpldeltlen; deltba = ab->cpldeltba; } } else if (chnl == 6) { start = 0; end = 7; lowcomp = 0; fgain = fgaintab[ab->lfefgaincod]; snroffset = (((ab->csnroffst - 15) << 4) + ab->lfefsnroffst) << 2; exps = ab->dlfeexps; baps = ab->lfebap; } else { start = 0; end = ab->endmant[chnl]; lowcomp = 0; fgain = fgaintab[ab->fgaincod[chnl]]; snroffset = (((ab->csnroffst - 15) << 4) + ab->fsnroffst[chnl]) << 2; exps = ab->dexps[chnl]; baps = ab->bap[chnl]; if (ab->deltbae[chnl] == 0 || ab->deltbae[chnl] == 1) { do_delta = 1; deltnseg = ab->deltnseg[chnl]; deltoffst = ab->deltoffst[chnl]; deltlen = ab->deltlen[chnl]; deltba = ab->deltba[chnl]; } } for (bin = start; bin < end; bin++) /* exponent mapping into psd */ psd[bin] = (3072 - ((int16_t) (exps[bin] << 7))); /* psd integration */ j = start; k = masktab[start]; do { lastbin = FFMIN(bndtab[k] + bndsz[k], end); bndpsd[k] = psd[j]; j++; for (i = j; i < lastbin; i++) { bndpsd[k] = logadd(bndpsd[k], psd[j]); j++; } k++; } while (end > lastbin); /* compute the excite function */ bndstrt = masktab[start]; bndend = masktab[end - 1] + 1; if (bndstrt == 0) { lowcomp = calc_lowcomp(lowcomp, bndpsd[0], bndpsd[1], 0); excite[0] = bndpsd[0] - fgain - lowcomp; lowcomp = calc_lowcomp(lowcomp, bndpsd[1], bndpsd[2], 1); excite[1] = bndpsd[1] - fgain - lowcomp; begin = 7; for (bin = 2; bin < 7; bin++) { if (bndend != 7 || bin != 6) lowcomp = calc_lowcomp(lowcomp, bndpsd[bin], bndpsd[bin + 1], bin); fastleak = bndpsd[bin] - fgain; slowleak = bndpsd[bin] - sgain; excite[bin] = fastleak - lowcomp; if (bndend != 7 || bin != 6) if (bndpsd[bin] <= bndpsd[bin + 1]) { begin = bin + 1; break; } } for (bin = begin; bin < (FFMIN(bndend, 22)); bin++) { if (bndend != 7 || bin != 6) lowcomp = calc_lowcomp(lowcomp, bndpsd[bin], bndpsd[bin + 1], bin); fastleak -= fdecay; fastleak = FFMAX(fastleak, bndpsd[bin] - fgain); slowleak -= sdecay; slowleak = FFMAX(slowleak, bndpsd[bin] - sgain); excite[bin] = FFMAX(fastleak - lowcomp, slowleak); } begin = 22; } else { begin = bndstrt; } for (bin = begin; bin < bndend; bin++) { fastleak -= fdecay; fastleak = FFMAX(fastleak, bndpsd[bin] - fgain); slowleak -= sdecay; slowleak = FFMAX(slowleak, bndpsd[bin] - sgain); excite[bin] = FFMAX(fastleak, slowleak); } /* compute the masking curve */ for (bin = bndstrt; bin < bndend; bin++) { if (bndpsd[bin] < dbknee) excite[bin] += ((dbknee - bndpsd[bin]) >> 2); mask[bin] = FFMAX(excite[bin], hth[bin][fscod]); } /* apply the delta bit allocation */ if (do_delta) { band = 0; for (seg = 0; seg < deltnseg + 1; seg++) { band += deltoffst[seg]; if (deltba[seg] >= 4) delta = (deltba[seg] - 3) << 7; else delta = (deltba[seg] - 4) << 7; for (k = 0; k < deltlen[seg]; k++) { mask[band] += delta; band++; } } } /*compute the bit allocation */ i = start; j = masktab[start]; do { lastbin = FFMIN(bndtab[j] + bndsz[j], end); mask[j] -= snroffset; mask[j] -= floor; if (mask[j] < 0) mask[j] = 0; mask[j] &= 0x1fe0; mask[j] += floor; for (k = i; k < lastbin; k++) { address = (psd[i] - mask[j]) >> 5; address = FFMIN(63, (FFMAX(0, address))); baps[i] = baptab[address]; i++; } j++; } while (end > lastbin); return 0; }
false
FFmpeg
0058584580b87feb47898e60e4b80c7f425882ad
static int _do_bit_allocation(AC3DecodeContext *ctx, int chnl) { ac3_audio_block *ab = &ctx->audio_block; int16_t sdecay, fdecay, sgain, dbknee, floor; int16_t lowcomp, fgain, snroffset, fastleak, slowleak; int16_t psd[256], bndpsd[50], excite[50], mask[50], delta; uint8_t start, end, bin, i, j, k, lastbin, bndstrt, bndend, begin, deltnseg, band, seg, address; uint8_t fscod = ctx->sync_info.fscod; uint8_t *exps, *deltoffst, *deltlen, *deltba; uint8_t *baps; int do_delta = 0; sdecay = sdecaytab[ab->sdcycod]; fdecay = fdecaytab[ab->fdcycod]; sgain = sgaintab[ab->sgaincod]; dbknee = dbkneetab[ab->dbpbcod]; floor = floortab[ab->floorcod]; if (chnl == 5) { start = ab->cplstrtmant; end = ab->cplendmant; fgain = fgaintab[ab->cplfgaincod]; snroffset = (((ab->csnroffst - 15) << 4) + ab->cplfsnroffst) << 2; fastleak = (ab->cplfleak << 8) + 768; slowleak = (ab->cplsleak << 8) + 768; exps = ab->dcplexps; baps = ab->cplbap; if (ab->cpldeltbae == 0 || ab->cpldeltbae == 1) { do_delta = 1; deltnseg = ab->cpldeltnseg; deltoffst = ab->cpldeltoffst; deltlen = ab->cpldeltlen; deltba = ab->cpldeltba; } } else if (chnl == 6) { start = 0; end = 7; lowcomp = 0; fgain = fgaintab[ab->lfefgaincod]; snroffset = (((ab->csnroffst - 15) << 4) + ab->lfefsnroffst) << 2; exps = ab->dlfeexps; baps = ab->lfebap; } else { start = 0; end = ab->endmant[chnl]; lowcomp = 0; fgain = fgaintab[ab->fgaincod[chnl]]; snroffset = (((ab->csnroffst - 15) << 4) + ab->fsnroffst[chnl]) << 2; exps = ab->dexps[chnl]; baps = ab->bap[chnl]; if (ab->deltbae[chnl] == 0 || ab->deltbae[chnl] == 1) { do_delta = 1; deltnseg = ab->deltnseg[chnl]; deltoffst = ab->deltoffst[chnl]; deltlen = ab->deltlen[chnl]; deltba = ab->deltba[chnl]; } } for (bin = start; bin < end; bin++) psd[bin] = (3072 - ((int16_t) (exps[bin] << 7))); j = start; k = masktab[start]; do { lastbin = FFMIN(bndtab[k] + bndsz[k], end); bndpsd[k] = psd[j]; j++; for (i = j; i < lastbin; i++) { bndpsd[k] = logadd(bndpsd[k], psd[j]); j++; } k++; } while (end > lastbin); bndstrt = masktab[start]; bndend = masktab[end - 1] + 1; if (bndstrt == 0) { lowcomp = calc_lowcomp(lowcomp, bndpsd[0], bndpsd[1], 0); excite[0] = bndpsd[0] - fgain - lowcomp; lowcomp = calc_lowcomp(lowcomp, bndpsd[1], bndpsd[2], 1); excite[1] = bndpsd[1] - fgain - lowcomp; begin = 7; for (bin = 2; bin < 7; bin++) { if (bndend != 7 || bin != 6) lowcomp = calc_lowcomp(lowcomp, bndpsd[bin], bndpsd[bin + 1], bin); fastleak = bndpsd[bin] - fgain; slowleak = bndpsd[bin] - sgain; excite[bin] = fastleak - lowcomp; if (bndend != 7 || bin != 6) if (bndpsd[bin] <= bndpsd[bin + 1]) { begin = bin + 1; break; } } for (bin = begin; bin < (FFMIN(bndend, 22)); bin++) { if (bndend != 7 || bin != 6) lowcomp = calc_lowcomp(lowcomp, bndpsd[bin], bndpsd[bin + 1], bin); fastleak -= fdecay; fastleak = FFMAX(fastleak, bndpsd[bin] - fgain); slowleak -= sdecay; slowleak = FFMAX(slowleak, bndpsd[bin] - sgain); excite[bin] = FFMAX(fastleak - lowcomp, slowleak); } begin = 22; } else { begin = bndstrt; } for (bin = begin; bin < bndend; bin++) { fastleak -= fdecay; fastleak = FFMAX(fastleak, bndpsd[bin] - fgain); slowleak -= sdecay; slowleak = FFMAX(slowleak, bndpsd[bin] - sgain); excite[bin] = FFMAX(fastleak, slowleak); } for (bin = bndstrt; bin < bndend; bin++) { if (bndpsd[bin] < dbknee) excite[bin] += ((dbknee - bndpsd[bin]) >> 2); mask[bin] = FFMAX(excite[bin], hth[bin][fscod]); } if (do_delta) { band = 0; for (seg = 0; seg < deltnseg + 1; seg++) { band += deltoffst[seg]; if (deltba[seg] >= 4) delta = (deltba[seg] - 3) << 7; else delta = (deltba[seg] - 4) << 7; for (k = 0; k < deltlen[seg]; k++) { mask[band] += delta; band++; } } } i = start; j = masktab[start]; do { lastbin = FFMIN(bndtab[j] + bndsz[j], end); mask[j] -= snroffset; mask[j] -= floor; if (mask[j] < 0) mask[j] = 0; mask[j] &= 0x1fe0; mask[j] += floor; for (k = i; k < lastbin; k++) { address = (psd[i] - mask[j]) >> 5; address = FFMIN(63, (FFMAX(0, address))); baps[i] = baptab[address]; i++; } j++; } while (end > lastbin); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(AC3DecodeContext *VAR_0, int VAR_1) { ac3_audio_block *ab = &VAR_0->audio_block; int16_t sdecay, fdecay, sgain, dbknee, floor; int16_t lowcomp, fgain, snroffset, fastleak, slowleak; int16_t psd[256], bndpsd[50], excite[50], mask[50], delta; uint8_t start, end, bin, i, j, k, lastbin, bndstrt, bndend, begin, deltnseg, band, seg, address; uint8_t fscod = VAR_0->sync_info.fscod; uint8_t *exps, *deltoffst, *deltlen, *deltba; uint8_t *baps; int VAR_2 = 0; sdecay = sdecaytab[ab->sdcycod]; fdecay = fdecaytab[ab->fdcycod]; sgain = sgaintab[ab->sgaincod]; dbknee = dbkneetab[ab->dbpbcod]; floor = floortab[ab->floorcod]; if (VAR_1 == 5) { start = ab->cplstrtmant; end = ab->cplendmant; fgain = fgaintab[ab->cplfgaincod]; snroffset = (((ab->csnroffst - 15) << 4) + ab->cplfsnroffst) << 2; fastleak = (ab->cplfleak << 8) + 768; slowleak = (ab->cplsleak << 8) + 768; exps = ab->dcplexps; baps = ab->cplbap; if (ab->cpldeltbae == 0 || ab->cpldeltbae == 1) { VAR_2 = 1; deltnseg = ab->cpldeltnseg; deltoffst = ab->cpldeltoffst; deltlen = ab->cpldeltlen; deltba = ab->cpldeltba; } } else if (VAR_1 == 6) { start = 0; end = 7; lowcomp = 0; fgain = fgaintab[ab->lfefgaincod]; snroffset = (((ab->csnroffst - 15) << 4) + ab->lfefsnroffst) << 2; exps = ab->dlfeexps; baps = ab->lfebap; } else { start = 0; end = ab->endmant[VAR_1]; lowcomp = 0; fgain = fgaintab[ab->fgaincod[VAR_1]]; snroffset = (((ab->csnroffst - 15) << 4) + ab->fsnroffst[VAR_1]) << 2; exps = ab->dexps[VAR_1]; baps = ab->bap[VAR_1]; if (ab->deltbae[VAR_1] == 0 || ab->deltbae[VAR_1] == 1) { VAR_2 = 1; deltnseg = ab->deltnseg[VAR_1]; deltoffst = ab->deltoffst[VAR_1]; deltlen = ab->deltlen[VAR_1]; deltba = ab->deltba[VAR_1]; } } for (bin = start; bin < end; bin++) psd[bin] = (3072 - ((int16_t) (exps[bin] << 7))); j = start; k = masktab[start]; do { lastbin = FFMIN(bndtab[k] + bndsz[k], end); bndpsd[k] = psd[j]; j++; for (i = j; i < lastbin; i++) { bndpsd[k] = logadd(bndpsd[k], psd[j]); j++; } k++; } while (end > lastbin); bndstrt = masktab[start]; bndend = masktab[end - 1] + 1; if (bndstrt == 0) { lowcomp = calc_lowcomp(lowcomp, bndpsd[0], bndpsd[1], 0); excite[0] = bndpsd[0] - fgain - lowcomp; lowcomp = calc_lowcomp(lowcomp, bndpsd[1], bndpsd[2], 1); excite[1] = bndpsd[1] - fgain - lowcomp; begin = 7; for (bin = 2; bin < 7; bin++) { if (bndend != 7 || bin != 6) lowcomp = calc_lowcomp(lowcomp, bndpsd[bin], bndpsd[bin + 1], bin); fastleak = bndpsd[bin] - fgain; slowleak = bndpsd[bin] - sgain; excite[bin] = fastleak - lowcomp; if (bndend != 7 || bin != 6) if (bndpsd[bin] <= bndpsd[bin + 1]) { begin = bin + 1; break; } } for (bin = begin; bin < (FFMIN(bndend, 22)); bin++) { if (bndend != 7 || bin != 6) lowcomp = calc_lowcomp(lowcomp, bndpsd[bin], bndpsd[bin + 1], bin); fastleak -= fdecay; fastleak = FFMAX(fastleak, bndpsd[bin] - fgain); slowleak -= sdecay; slowleak = FFMAX(slowleak, bndpsd[bin] - sgain); excite[bin] = FFMAX(fastleak - lowcomp, slowleak); } begin = 22; } else { begin = bndstrt; } for (bin = begin; bin < bndend; bin++) { fastleak -= fdecay; fastleak = FFMAX(fastleak, bndpsd[bin] - fgain); slowleak -= sdecay; slowleak = FFMAX(slowleak, bndpsd[bin] - sgain); excite[bin] = FFMAX(fastleak, slowleak); } for (bin = bndstrt; bin < bndend; bin++) { if (bndpsd[bin] < dbknee) excite[bin] += ((dbknee - bndpsd[bin]) >> 2); mask[bin] = FFMAX(excite[bin], hth[bin][fscod]); } if (VAR_2) { band = 0; for (seg = 0; seg < deltnseg + 1; seg++) { band += deltoffst[seg]; if (deltba[seg] >= 4) delta = (deltba[seg] - 3) << 7; else delta = (deltba[seg] - 4) << 7; for (k = 0; k < deltlen[seg]; k++) { mask[band] += delta; band++; } } } i = start; j = masktab[start]; do { lastbin = FFMIN(bndtab[j] + bndsz[j], end); mask[j] -= snroffset; mask[j] -= floor; if (mask[j] < 0) mask[j] = 0; mask[j] &= 0x1fe0; mask[j] += floor; for (k = i; k < lastbin; k++) { address = (psd[i] - mask[j]) >> 5; address = FFMIN(63, (FFMAX(0, address))); baps[i] = baptab[address]; i++; } j++; } while (end > lastbin); return 0; }
[ "static int FUNC_0(AC3DecodeContext *VAR_0, int VAR_1)\n{", "ac3_audio_block *ab = &VAR_0->audio_block;", "int16_t sdecay, fdecay, sgain, dbknee, floor;", "int16_t lowcomp, fgain, snroffset, fastleak, slowleak;", "int16_t psd[256], bndpsd[50], excite[50], mask[50], delta;", "uint8_t start, end, bin, i, j, k, lastbin, bndstrt, bndend, begin, deltnseg, band, seg, address;", "uint8_t fscod = VAR_0->sync_info.fscod;", "uint8_t *exps, *deltoffst, *deltlen, *deltba;", "uint8_t *baps;", "int VAR_2 = 0;", "sdecay = sdecaytab[ab->sdcycod];", "fdecay = fdecaytab[ab->fdcycod];", "sgain = sgaintab[ab->sgaincod];", "dbknee = dbkneetab[ab->dbpbcod];", "floor = floortab[ab->floorcod];", "if (VAR_1 == 5) {", "start = ab->cplstrtmant;", "end = ab->cplendmant;", "fgain = fgaintab[ab->cplfgaincod];", "snroffset = (((ab->csnroffst - 15) << 4) + ab->cplfsnroffst) << 2;", "fastleak = (ab->cplfleak << 8) + 768;", "slowleak = (ab->cplsleak << 8) + 768;", "exps = ab->dcplexps;", "baps = ab->cplbap;", "if (ab->cpldeltbae == 0 || ab->cpldeltbae == 1) {", "VAR_2 = 1;", "deltnseg = ab->cpldeltnseg;", "deltoffst = ab->cpldeltoffst;", "deltlen = ab->cpldeltlen;", "deltba = ab->cpldeltba;", "}", "}", "else if (VAR_1 == 6) {", "start = 0;", "end = 7;", "lowcomp = 0;", "fgain = fgaintab[ab->lfefgaincod];", "snroffset = (((ab->csnroffst - 15) << 4) + ab->lfefsnroffst) << 2;", "exps = ab->dlfeexps;", "baps = ab->lfebap;", "}", "else {", "start = 0;", "end = ab->endmant[VAR_1];", "lowcomp = 0;", "fgain = fgaintab[ab->fgaincod[VAR_1]];", "snroffset = (((ab->csnroffst - 15) << 4) + ab->fsnroffst[VAR_1]) << 2;", "exps = ab->dexps[VAR_1];", "baps = ab->bap[VAR_1];", "if (ab->deltbae[VAR_1] == 0 || ab->deltbae[VAR_1] == 1) {", "VAR_2 = 1;", "deltnseg = ab->deltnseg[VAR_1];", "deltoffst = ab->deltoffst[VAR_1];", "deltlen = ab->deltlen[VAR_1];", "deltba = ab->deltba[VAR_1];", "}", "}", "for (bin = start; bin < end; bin++)", "psd[bin] = (3072 - ((int16_t) (exps[bin] << 7)));", "j = start;", "k = masktab[start];", "do {", "lastbin = FFMIN(bndtab[k] + bndsz[k], end);", "bndpsd[k] = psd[j];", "j++;", "for (i = j; i < lastbin; i++) {", "bndpsd[k] = logadd(bndpsd[k], psd[j]);", "j++;", "}", "k++;", "} while (end > lastbin);", "bndstrt = masktab[start];", "bndend = masktab[end - 1] + 1;", "if (bndstrt == 0) {", "lowcomp = calc_lowcomp(lowcomp, bndpsd[0], bndpsd[1], 0);", "excite[0] = bndpsd[0] - fgain - lowcomp;", "lowcomp = calc_lowcomp(lowcomp, bndpsd[1], bndpsd[2], 1);", "excite[1] = bndpsd[1] - fgain - lowcomp;", "begin = 7;", "for (bin = 2; bin < 7; bin++) {", "if (bndend != 7 || bin != 6)\nlowcomp = calc_lowcomp(lowcomp, bndpsd[bin], bndpsd[bin + 1], bin);", "fastleak = bndpsd[bin] - fgain;", "slowleak = bndpsd[bin] - sgain;", "excite[bin] = fastleak - lowcomp;", "if (bndend != 7 || bin != 6)\nif (bndpsd[bin] <= bndpsd[bin + 1]) {", "begin = bin + 1;", "break;", "}", "}", "for (bin = begin; bin < (FFMIN(bndend, 22)); bin++) {", "if (bndend != 7 || bin != 6)\nlowcomp = calc_lowcomp(lowcomp, bndpsd[bin], bndpsd[bin + 1], bin);", "fastleak -= fdecay;", "fastleak = FFMAX(fastleak, bndpsd[bin] - fgain);", "slowleak -= sdecay;", "slowleak = FFMAX(slowleak, bndpsd[bin] - sgain);", "excite[bin] = FFMAX(fastleak - lowcomp, slowleak);", "}", "begin = 22;", "}", "else {", "begin = bndstrt;", "}", "for (bin = begin; bin < bndend; bin++) {", "fastleak -= fdecay;", "fastleak = FFMAX(fastleak, bndpsd[bin] - fgain);", "slowleak -= sdecay;", "slowleak = FFMAX(slowleak, bndpsd[bin] - sgain);", "excite[bin] = FFMAX(fastleak, slowleak);", "}", "for (bin = bndstrt; bin < bndend; bin++) {", "if (bndpsd[bin] < dbknee)\nexcite[bin] += ((dbknee - bndpsd[bin]) >> 2);", "mask[bin] = FFMAX(excite[bin], hth[bin][fscod]);", "}", "if (VAR_2) {", "band = 0;", "for (seg = 0; seg < deltnseg + 1; seg++) {", "band += deltoffst[seg];", "if (deltba[seg] >= 4)\ndelta = (deltba[seg] - 3) << 7;", "else\ndelta = (deltba[seg] - 4) << 7;", "for (k = 0; k < deltlen[seg]; k++) {", "mask[band] += delta;", "band++;", "}", "}", "}", "i = start;", "j = masktab[start];", "do {", "lastbin = FFMIN(bndtab[j] + bndsz[j], end);", "mask[j] -= snroffset;", "mask[j] -= floor;", "if (mask[j] < 0)\nmask[j] = 0;", "mask[j] &= 0x1fe0;", "mask[j] += floor;", "for (k = i; k < lastbin; k++) {", "address = (psd[i] - mask[j]) >> 5;", "address = FFMIN(63, (FFMAX(0, address)));", "baps[i] = baptab[address];", "i++;", "}", "j++;", "} while (end > lastbin);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 125 ], [ 127 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179, 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189, 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203, 205 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ], [ 225 ], [ 227 ], [ 229 ], [ 231 ], [ 233 ], [ 235 ], [ 237 ], [ 239 ], [ 241 ], [ 247 ], [ 249, 251 ], [ 253 ], [ 255 ], [ 261 ], [ 263 ], [ 265 ], [ 267 ], [ 269, 271 ], [ 273, 275 ], [ 277 ], [ 279 ], [ 281 ], [ 283 ], [ 285 ], [ 287 ], [ 293 ], [ 295 ], [ 297 ], [ 299 ], [ 301 ], [ 303 ], [ 305, 307 ], [ 309 ], [ 311 ], [ 313 ], [ 315 ], [ 317 ], [ 319 ], [ 321 ], [ 323 ], [ 325 ], [ 327 ], [ 331 ], [ 333 ] ]
11,252
struct omap_mcspi_s *omap_mcspi_init(struct omap_target_agent_s *ta, int chnum, qemu_irq irq, qemu_irq *drq, omap_clk fclk, omap_clk iclk) { struct omap_mcspi_s *s = (struct omap_mcspi_s *) g_malloc0(sizeof(struct omap_mcspi_s)); struct omap_mcspi_ch_s *ch = s->ch; s->irq = irq; s->chnum = chnum; while (chnum --) { ch->txdrq = *drq ++; ch->rxdrq = *drq ++; ch ++; } omap_mcspi_reset(s); memory_region_init_io(&s->iomem, NULL, &omap_mcspi_ops, s, "omap.mcspi", omap_l4_region_size(ta, 0)); omap_l4_attach(ta, 0, &s->iomem); return s; }
true
qemu
b45c03f585ea9bb1af76c73e82195418c294919d
struct omap_mcspi_s *omap_mcspi_init(struct omap_target_agent_s *ta, int chnum, qemu_irq irq, qemu_irq *drq, omap_clk fclk, omap_clk iclk) { struct omap_mcspi_s *s = (struct omap_mcspi_s *) g_malloc0(sizeof(struct omap_mcspi_s)); struct omap_mcspi_ch_s *ch = s->ch; s->irq = irq; s->chnum = chnum; while (chnum --) { ch->txdrq = *drq ++; ch->rxdrq = *drq ++; ch ++; } omap_mcspi_reset(s); memory_region_init_io(&s->iomem, NULL, &omap_mcspi_ops, s, "omap.mcspi", omap_l4_region_size(ta, 0)); omap_l4_attach(ta, 0, &s->iomem); return s; }
{ "code": [ " struct omap_mcspi_s *s = (struct omap_mcspi_s *)", " g_malloc0(sizeof(struct omap_mcspi_s));" ], "line_no": [ 7, 9 ] }
struct omap_mcspi_s *FUNC_0(struct omap_target_agent_s *VAR_0, int VAR_1, qemu_irq VAR_2, qemu_irq *VAR_3, omap_clk VAR_4, omap_clk VAR_5) { struct omap_mcspi_s *VAR_6 = (struct omap_mcspi_s *) g_malloc0(sizeof(struct omap_mcspi_s)); struct omap_mcspi_ch_s *VAR_7 = VAR_6->VAR_7; VAR_6->VAR_2 = VAR_2; VAR_6->VAR_1 = VAR_1; while (VAR_1 --) { VAR_7->txdrq = *VAR_3 ++; VAR_7->rxdrq = *VAR_3 ++; VAR_7 ++; } omap_mcspi_reset(VAR_6); memory_region_init_io(&VAR_6->iomem, NULL, &omap_mcspi_ops, VAR_6, "omap.mcspi", omap_l4_region_size(VAR_0, 0)); omap_l4_attach(VAR_0, 0, &VAR_6->iomem); return VAR_6; }
[ "struct omap_mcspi_s *FUNC_0(struct omap_target_agent_s *VAR_0, int VAR_1,\nqemu_irq VAR_2, qemu_irq *VAR_3, omap_clk VAR_4, omap_clk VAR_5)\n{", "struct omap_mcspi_s *VAR_6 = (struct omap_mcspi_s *)\ng_malloc0(sizeof(struct omap_mcspi_s));", "struct omap_mcspi_ch_s *VAR_7 = VAR_6->VAR_7;", "VAR_6->VAR_2 = VAR_2;", "VAR_6->VAR_1 = VAR_1;", "while (VAR_1 --) {", "VAR_7->txdrq = *VAR_3 ++;", "VAR_7->rxdrq = *VAR_3 ++;", "VAR_7 ++;", "}", "omap_mcspi_reset(VAR_6);", "memory_region_init_io(&VAR_6->iomem, NULL, &omap_mcspi_ops, VAR_6, \"omap.mcspi\",\nomap_l4_region_size(VAR_0, 0));", "omap_l4_attach(VAR_0, 0, &VAR_6->iomem);", "return VAR_6;", "}" ]
[ 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7, 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33, 35 ], [ 37 ], [ 41 ], [ 43 ] ]
11,253
int pci_vga_init(PCIBus *bus, unsigned long vga_bios_offset, int vga_bios_size) { PCIDevice *dev; dev = pci_create(bus, -1, "VGA"); qdev_prop_set_uint32(&dev->qdev, "bios-offset", vga_bios_offset); qdev_prop_set_uint32(&dev->qdev, "bios-size", vga_bios_offset); qdev_init(&dev->qdev); return 0; }
true
qemu
e23a1b33b53d25510320b26d9f154e19c6c99725
int pci_vga_init(PCIBus *bus, unsigned long vga_bios_offset, int vga_bios_size) { PCIDevice *dev; dev = pci_create(bus, -1, "VGA"); qdev_prop_set_uint32(&dev->qdev, "bios-offset", vga_bios_offset); qdev_prop_set_uint32(&dev->qdev, "bios-size", vga_bios_offset); qdev_init(&dev->qdev); return 0; }
{ "code": [ " qdev_init(&dev->qdev);", " qdev_init(&dev->qdev);", " qdev_init(&dev->qdev);", " qdev_init(&dev->qdev);", " qdev_init(&dev->qdev);", " qdev_init(&dev->qdev);", " qdev_init(&dev->qdev);", " qdev_init(&dev->qdev);" ], "line_no": [ 17, 17, 17, 17, 17, 17, 17, 17 ] }
int FUNC_0(PCIBus *VAR_0, unsigned long VAR_1, int VAR_2) { PCIDevice *dev; dev = pci_create(VAR_0, -1, "VGA"); qdev_prop_set_uint32(&dev->qdev, "bios-offset", VAR_1); qdev_prop_set_uint32(&dev->qdev, "bios-size", VAR_1); qdev_init(&dev->qdev); return 0; }
[ "int FUNC_0(PCIBus *VAR_0,\nunsigned long VAR_1, int VAR_2)\n{", "PCIDevice *dev;", "dev = pci_create(VAR_0, -1, \"VGA\");", "qdev_prop_set_uint32(&dev->qdev, \"bios-offset\", VAR_1);", "qdev_prop_set_uint32(&dev->qdev, \"bios-size\", VAR_1);", "qdev_init(&dev->qdev);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 1, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ] ]
11,255
void vm_start(void) { RunState requested; qemu_vmstop_requested(&requested); if (runstate_is_running() && requested == RUN_STATE__MAX) { return; } /* Ensure that a STOP/RESUME pair of events is emitted if a * vmstop request was pending. The BLOCK_IO_ERROR event, for * example, according to documentation is always followed by * the STOP event. */ if (runstate_is_running()) { qapi_event_send_stop(&error_abort); } else { cpu_enable_ticks(); runstate_set(RUN_STATE_RUNNING); vm_state_notify(1, RUN_STATE_RUNNING); resume_all_vcpus(); } qapi_event_send_resume(&error_abort); }
true
qemu
6d0ceb80ffe18ad4b28aab7356f440636c0be7be
void vm_start(void) { RunState requested; qemu_vmstop_requested(&requested); if (runstate_is_running() && requested == RUN_STATE__MAX) { return; } if (runstate_is_running()) { qapi_event_send_stop(&error_abort); } else { cpu_enable_ticks(); runstate_set(RUN_STATE_RUNNING); vm_state_notify(1, RUN_STATE_RUNNING); resume_all_vcpus(); } qapi_event_send_resume(&error_abort); }
{ "code": [], "line_no": [] }
void FUNC_0(void) { RunState requested; qemu_vmstop_requested(&requested); if (runstate_is_running() && requested == RUN_STATE__MAX) { return; } if (runstate_is_running()) { qapi_event_send_stop(&error_abort); } else { cpu_enable_ticks(); runstate_set(RUN_STATE_RUNNING); vm_state_notify(1, RUN_STATE_RUNNING); resume_all_vcpus(); } qapi_event_send_resume(&error_abort); }
[ "void FUNC_0(void)\n{", "RunState requested;", "qemu_vmstop_requested(&requested);", "if (runstate_is_running() && requested == RUN_STATE__MAX) {", "return;", "}", "if (runstate_is_running()) {", "qapi_event_send_stop(&error_abort);", "} else {", "cpu_enable_ticks();", "runstate_set(RUN_STATE_RUNNING);", "vm_state_notify(1, RUN_STATE_RUNNING);", "resume_all_vcpus();", "}", "qapi_event_send_resume(&error_abort);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 29 ], [ 31 ], [ 33 ], [ 36 ], [ 38 ], [ 40 ], [ 42 ], [ 44 ], [ 48 ], [ 50 ] ]
11,256
static inline void RENAME(rgb32tobgr32)(const uint8_t *src, uint8_t *dst, unsigned int src_size) { #ifdef HAVE_MMX /* TODO: unroll this loop */ asm volatile ( "xor %%"REG_a", %%"REG_a" \n\t" ".balign 16 \n\t" "1: \n\t" PREFETCH" 32(%0, %%"REG_a") \n\t" "movq (%0, %%"REG_a"), %%mm0 \n\t" "movq %%mm0, %%mm1 \n\t" "movq %%mm0, %%mm2 \n\t" "pslld $16, %%mm0 \n\t" "psrld $16, %%mm1 \n\t" "pand "MANGLE(mask32r)", %%mm0 \n\t" "pand "MANGLE(mask32g)", %%mm2 \n\t" "pand "MANGLE(mask32b)", %%mm1 \n\t" "por %%mm0, %%mm2 \n\t" "por %%mm1, %%mm2 \n\t" MOVNTQ" %%mm2, (%1, %%"REG_a") \n\t" "add $8, %%"REG_a" \n\t" "cmp %2, %%"REG_a" \n\t" " jb 1b \n\t" :: "r" (src), "r"(dst), "r" ((long)src_size-7) : "%"REG_a ); __asm __volatile(SFENCE:::"memory"); __asm __volatile(EMMS:::"memory"); #else unsigned i; unsigned num_pixels = src_size >> 2; for(i=0; i<num_pixels; i++) { #ifdef WORDS_BIGENDIAN dst[4*i + 1] = src[4*i + 3]; dst[4*i + 2] = src[4*i + 2]; dst[4*i + 3] = src[4*i + 1]; #else dst[4*i + 0] = src[4*i + 2]; dst[4*i + 1] = src[4*i + 1]; dst[4*i + 2] = src[4*i + 0]; #endif } #endif }
true
FFmpeg
7f526efd17973ec6d2204f7a47b6923e2be31363
static inline void RENAME(rgb32tobgr32)(const uint8_t *src, uint8_t *dst, unsigned int src_size) { #ifdef HAVE_MMX asm volatile ( "xor %%"REG_a", %%"REG_a" \n\t" ".balign 16 \n\t" "1: \n\t" PREFETCH" 32(%0, %%"REG_a") \n\t" "movq (%0, %%"REG_a"), %%mm0 \n\t" "movq %%mm0, %%mm1 \n\t" "movq %%mm0, %%mm2 \n\t" "pslld $16, %%mm0 \n\t" "psrld $16, %%mm1 \n\t" "pand "MANGLE(mask32r)", %%mm0 \n\t" "pand "MANGLE(mask32g)", %%mm2 \n\t" "pand "MANGLE(mask32b)", %%mm1 \n\t" "por %%mm0, %%mm2 \n\t" "por %%mm1, %%mm2 \n\t" MOVNTQ" %%mm2, (%1, %%"REG_a") \n\t" "add $8, %%"REG_a" \n\t" "cmp %2, %%"REG_a" \n\t" " jb 1b \n\t" :: "r" (src), "r"(dst), "r" ((long)src_size-7) : "%"REG_a ); __asm __volatile(SFENCE:::"memory"); __asm __volatile(EMMS:::"memory"); #else unsigned i; unsigned num_pixels = src_size >> 2; for(i=0; i<num_pixels; i++) { #ifdef WORDS_BIGENDIAN dst[4*i + 1] = src[4*i + 3]; dst[4*i + 2] = src[4*i + 2]; dst[4*i + 3] = src[4*i + 1]; #else dst[4*i + 0] = src[4*i + 2]; dst[4*i + 1] = src[4*i + 1]; dst[4*i + 2] = src[4*i + 0]; #endif } #endif }
{ "code": [ "\tunsigned i;", "\tunsigned i;", "\tunsigned i;", "\tunsigned i;", "\tunsigned i;", "\tunsigned i;", "\tunsigned i;", "\tunsigned i;", "\tunsigned i;", "\tunsigned num_pixels = src_size >> 2;", "\tunsigned i;", "\tunsigned i;", "\tunsigned i;", "\tunsigned i;", "\tunsigned i;", "\tunsigned i;", "static inline void RENAME(rgb32tobgr32)(const uint8_t *src, uint8_t *dst, unsigned int src_size)", "\t\t:: \"r\" (src), \"r\"(dst), \"r\" ((long)src_size-7)" ], "line_no": [ 61, 61, 61, 61, 61, 61, 61, 61, 61, 63, 61, 61, 61, 61, 61, 61, 1, 47 ] }
static inline void FUNC_0(rgb32tobgr32)(const uint8_t *src, uint8_t *dst, unsigned int src_size) { #ifdef HAVE_MMX asm volatile ( "xor %%"REG_a", %%"REG_a" \n\t" ".balign 16 \n\t" "1: \n\t" PREFETCH" 32(%0, %%"REG_a") \n\t" "movq (%0, %%"REG_a"), %%mm0 \n\t" "movq %%mm0, %%mm1 \n\t" "movq %%mm0, %%mm2 \n\t" "pslld $16, %%mm0 \n\t" "psrld $16, %%mm1 \n\t" "pand "MANGLE(mask32r)", %%mm0 \n\t" "pand "MANGLE(mask32g)", %%mm2 \n\t" "pand "MANGLE(mask32b)", %%mm1 \n\t" "por %%mm0, %%mm2 \n\t" "por %%mm1, %%mm2 \n\t" MOVNTQ" %%mm2, (%1, %%"REG_a") \n\t" "add $8, %%"REG_a" \n\t" "cmp %2, %%"REG_a" \n\t" " jb 1b \n\t" :: "r" (src), "r"(dst), "r" ((long)src_size-7) : "%"REG_a ); __asm __volatile(SFENCE:::"memory"); __asm __volatile(EMMS:::"memory"); #else unsigned VAR_0; unsigned VAR_1 = src_size >> 2; for(VAR_0=0; VAR_0<VAR_1; VAR_0++) { #ifdef WORDS_BIGENDIAN dst[4*VAR_0 + 1] = src[4*VAR_0 + 3]; dst[4*VAR_0 + 2] = src[4*VAR_0 + 2]; dst[4*VAR_0 + 3] = src[4*VAR_0 + 1]; #else dst[4*VAR_0 + 0] = src[4*VAR_0 + 2]; dst[4*VAR_0 + 1] = src[4*VAR_0 + 1]; dst[4*VAR_0 + 2] = src[4*VAR_0 + 0]; #endif } #endif }
[ "static inline void FUNC_0(rgb32tobgr32)(const uint8_t *src, uint8_t *dst, unsigned int src_size)\n{", "#ifdef HAVE_MMX\nasm volatile (\n\"xor %%\"REG_a\", %%\"REG_a\"\t\\n\\t\"\n\".balign 16\t\t\t\\n\\t\"\n\"1:\t\t\t\t\\n\\t\"\nPREFETCH\" 32(%0, %%\"REG_a\")\t\\n\\t\"\n\"movq (%0, %%\"REG_a\"), %%mm0\t\\n\\t\"\n\"movq %%mm0, %%mm1\t\t\\n\\t\"\n\"movq %%mm0, %%mm2\t\t\\n\\t\"\n\"pslld $16, %%mm0\t\t\\n\\t\"\n\"psrld $16, %%mm1\t\t\\n\\t\"\n\"pand \"MANGLE(mask32r)\", %%mm0\t\\n\\t\"\n\"pand \"MANGLE(mask32g)\", %%mm2\t\\n\\t\"\n\"pand \"MANGLE(mask32b)\", %%mm1\t\\n\\t\"\n\"por %%mm0, %%mm2\t\t\\n\\t\"\n\"por %%mm1, %%mm2\t\t\\n\\t\"\nMOVNTQ\" %%mm2, (%1, %%\"REG_a\")\t\\n\\t\"\n\"add $8, %%\"REG_a\"\t\t\\n\\t\"\n\"cmp %2, %%\"REG_a\"\t\t\\n\\t\"\n\" jb 1b\t\t\t\t\\n\\t\"\n:: \"r\" (src), \"r\"(dst), \"r\" ((long)src_size-7)\n: \"%\"REG_a\n);", "__asm __volatile(SFENCE:::\"memory\");", "__asm __volatile(EMMS:::\"memory\");", "#else\nunsigned VAR_0;", "unsigned VAR_1 = src_size >> 2;", "for(VAR_0=0; VAR_0<VAR_1; VAR_0++)", "{", "#ifdef WORDS_BIGENDIAN\ndst[4*VAR_0 + 1] = src[4*VAR_0 + 3];", "dst[4*VAR_0 + 2] = src[4*VAR_0 + 2];", "dst[4*VAR_0 + 3] = src[4*VAR_0 + 1];", "#else\ndst[4*VAR_0 + 0] = src[4*VAR_0 + 2];", "dst[4*VAR_0 + 1] = src[4*VAR_0 + 1];", "dst[4*VAR_0 + 2] = src[4*VAR_0 + 0];", "#endif\n}", "#endif\n}" ]
[ 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51 ], [ 55 ], [ 57 ], [ 59, 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69, 71 ], [ 73 ], [ 75 ], [ 77, 79 ], [ 81 ], [ 83 ], [ 85, 87 ], [ 89, 91 ] ]
11,257
static void v9fs_xattrcreate(void *opaque) { int flags; int32_t fid; int64_t size; ssize_t err = 0; V9fsString name; size_t offset = 7; V9fsFidState *file_fidp; V9fsFidState *xattr_fidp; V9fsPDU *pdu = opaque; V9fsState *s = pdu->s; pdu_unmarshal(pdu, offset, "dsqd", &fid, &name, &size, &flags); file_fidp = get_fid(pdu, fid); if (file_fidp == NULL) { err = -EINVAL; goto out_nofid; } /* Make the file fid point to xattr */ xattr_fidp = file_fidp; xattr_fidp->fid_type = P9_FID_XATTR; xattr_fidp->fs.xattr.copied_len = 0; xattr_fidp->fs.xattr.len = size; xattr_fidp->fs.xattr.flags = flags; v9fs_string_init(&xattr_fidp->fs.xattr.name); v9fs_string_copy(&xattr_fidp->fs.xattr.name, &name); if (size) { xattr_fidp->fs.xattr.value = g_malloc(size); } else { xattr_fidp->fs.xattr.value = NULL; } err = offset; put_fid(pdu, file_fidp); out_nofid: complete_pdu(s, pdu, err); v9fs_string_free(&name); }
true
qemu
c572f23a3e7180dbeab5e86583e43ea2afed6271
static void v9fs_xattrcreate(void *opaque) { int flags; int32_t fid; int64_t size; ssize_t err = 0; V9fsString name; size_t offset = 7; V9fsFidState *file_fidp; V9fsFidState *xattr_fidp; V9fsPDU *pdu = opaque; V9fsState *s = pdu->s; pdu_unmarshal(pdu, offset, "dsqd", &fid, &name, &size, &flags); file_fidp = get_fid(pdu, fid); if (file_fidp == NULL) { err = -EINVAL; goto out_nofid; } xattr_fidp = file_fidp; xattr_fidp->fid_type = P9_FID_XATTR; xattr_fidp->fs.xattr.copied_len = 0; xattr_fidp->fs.xattr.len = size; xattr_fidp->fs.xattr.flags = flags; v9fs_string_init(&xattr_fidp->fs.xattr.name); v9fs_string_copy(&xattr_fidp->fs.xattr.name, &name); if (size) { xattr_fidp->fs.xattr.value = g_malloc(size); } else { xattr_fidp->fs.xattr.value = NULL; } err = offset; put_fid(pdu, file_fidp); out_nofid: complete_pdu(s, pdu, err); v9fs_string_free(&name); }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0) { int VAR_1; int32_t fid; int64_t size; ssize_t err = 0; V9fsString name; size_t offset = 7; V9fsFidState *file_fidp; V9fsFidState *xattr_fidp; V9fsPDU *pdu = VAR_0; V9fsState *s = pdu->s; pdu_unmarshal(pdu, offset, "dsqd", &fid, &name, &size, &VAR_1); file_fidp = get_fid(pdu, fid); if (file_fidp == NULL) { err = -EINVAL; goto out_nofid; } xattr_fidp = file_fidp; xattr_fidp->fid_type = P9_FID_XATTR; xattr_fidp->fs.xattr.copied_len = 0; xattr_fidp->fs.xattr.len = size; xattr_fidp->fs.xattr.VAR_1 = VAR_1; v9fs_string_init(&xattr_fidp->fs.xattr.name); v9fs_string_copy(&xattr_fidp->fs.xattr.name, &name); if (size) { xattr_fidp->fs.xattr.value = g_malloc(size); } else { xattr_fidp->fs.xattr.value = NULL; } err = offset; put_fid(pdu, file_fidp); out_nofid: complete_pdu(s, pdu, err); v9fs_string_free(&name); }
[ "static void FUNC_0(void *VAR_0)\n{", "int VAR_1;", "int32_t fid;", "int64_t size;", "ssize_t err = 0;", "V9fsString name;", "size_t offset = 7;", "V9fsFidState *file_fidp;", "V9fsFidState *xattr_fidp;", "V9fsPDU *pdu = VAR_0;", "V9fsState *s = pdu->s;", "pdu_unmarshal(pdu, offset, \"dsqd\",\n&fid, &name, &size, &VAR_1);", "file_fidp = get_fid(pdu, fid);", "if (file_fidp == NULL) {", "err = -EINVAL;", "goto out_nofid;", "}", "xattr_fidp = file_fidp;", "xattr_fidp->fid_type = P9_FID_XATTR;", "xattr_fidp->fs.xattr.copied_len = 0;", "xattr_fidp->fs.xattr.len = size;", "xattr_fidp->fs.xattr.VAR_1 = VAR_1;", "v9fs_string_init(&xattr_fidp->fs.xattr.name);", "v9fs_string_copy(&xattr_fidp->fs.xattr.name, &name);", "if (size) {", "xattr_fidp->fs.xattr.value = g_malloc(size);", "} else {", "xattr_fidp->fs.xattr.value = NULL;", "}", "err = offset;", "put_fid(pdu, file_fidp);", "out_nofid:\ncomplete_pdu(s, pdu, err);", "v9fs_string_free(&name);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27, 29 ], [ 34 ], [ 36 ], [ 38 ], [ 40 ], [ 42 ], [ 46 ], [ 48 ], [ 50 ], [ 52 ], [ 54 ], [ 56 ], [ 58 ], [ 60 ], [ 62 ], [ 64 ], [ 66 ], [ 68 ], [ 70 ], [ 72 ], [ 74, 76 ], [ 78 ], [ 80 ] ]
11,258
static void spr_read_sdr1 (void *opaque, int gprn, int sprn) { tcg_gen_ld_tl(cpu_gpr[gprn], cpu_env, offsetof(CPUState, sdr1)); }
false
qemu
bb593904c18e22ea0671dfa1b02e24982f2bf0ea
static void spr_read_sdr1 (void *opaque, int gprn, int sprn) { tcg_gen_ld_tl(cpu_gpr[gprn], cpu_env, offsetof(CPUState, sdr1)); }
{ "code": [], "line_no": [] }
static void FUNC_0 (void *VAR_0, int VAR_1, int VAR_2) { tcg_gen_ld_tl(cpu_gpr[VAR_1], cpu_env, offsetof(CPUState, sdr1)); }
[ "static void FUNC_0 (void *VAR_0, int VAR_1, int VAR_2)\n{", "tcg_gen_ld_tl(cpu_gpr[VAR_1], cpu_env, offsetof(CPUState, sdr1));", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
11,259
void isa_cirrus_vga_init(DisplayState *ds, uint8_t *vga_ram_base, unsigned long vga_ram_offset, int vga_ram_size) { CirrusVGAState *s; s = qemu_mallocz(sizeof(CirrusVGAState)); vga_common_init((VGAState *)s, ds, vga_ram_base, vga_ram_offset, vga_ram_size); cirrus_init_common(s, CIRRUS_ID_CLGD5430, 0); s->console = graphic_console_init(s->ds, s->update, s->invalidate, s->screen_dump, s->text_update, s); /* XXX ISA-LFB support */ }
false
qemu
4efe27556dea874030f1cd53a6d70452ee064fba
void isa_cirrus_vga_init(DisplayState *ds, uint8_t *vga_ram_base, unsigned long vga_ram_offset, int vga_ram_size) { CirrusVGAState *s; s = qemu_mallocz(sizeof(CirrusVGAState)); vga_common_init((VGAState *)s, ds, vga_ram_base, vga_ram_offset, vga_ram_size); cirrus_init_common(s, CIRRUS_ID_CLGD5430, 0); s->console = graphic_console_init(s->ds, s->update, s->invalidate, s->screen_dump, s->text_update, s); }
{ "code": [], "line_no": [] }
void FUNC_0(DisplayState *VAR_0, uint8_t *VAR_1, unsigned long VAR_2, int VAR_3) { CirrusVGAState *s; s = qemu_mallocz(sizeof(CirrusVGAState)); vga_common_init((VGAState *)s, VAR_0, VAR_1, VAR_2, VAR_3); cirrus_init_common(s, CIRRUS_ID_CLGD5430, 0); s->console = graphic_console_init(s->VAR_0, s->update, s->invalidate, s->screen_dump, s->text_update, s); }
[ "void FUNC_0(DisplayState *VAR_0, uint8_t *VAR_1,\nunsigned long VAR_2, int VAR_3)\n{", "CirrusVGAState *s;", "s = qemu_mallocz(sizeof(CirrusVGAState));", "vga_common_init((VGAState *)s,\nVAR_0, VAR_1, VAR_2, VAR_3);", "cirrus_init_common(s, CIRRUS_ID_CLGD5430, 0);", "s->console = graphic_console_init(s->VAR_0, s->update, s->invalidate,\ns->screen_dump, s->text_update, s);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 15, 17 ], [ 19 ], [ 21, 23 ], [ 27 ] ]
11,260
StringInputVisitor *string_input_visitor_new(const char *str) { StringInputVisitor *v; v = g_malloc0(sizeof(*v)); v->visitor.type = VISITOR_INPUT; v->visitor.type_int64 = parse_type_int64; v->visitor.type_uint64 = parse_type_uint64; v->visitor.type_size = parse_type_size; v->visitor.type_bool = parse_type_bool; v->visitor.type_str = parse_type_str; v->visitor.type_number = parse_type_number; v->visitor.start_list = start_list; v->visitor.next_list = next_list; v->visitor.end_list = end_list; v->visitor.optional = parse_optional; v->string = str; v->head = true; return v; }
false
qemu
d9f62dde1303286b24ac8ce88be27e2b9b9c5f46
StringInputVisitor *string_input_visitor_new(const char *str) { StringInputVisitor *v; v = g_malloc0(sizeof(*v)); v->visitor.type = VISITOR_INPUT; v->visitor.type_int64 = parse_type_int64; v->visitor.type_uint64 = parse_type_uint64; v->visitor.type_size = parse_type_size; v->visitor.type_bool = parse_type_bool; v->visitor.type_str = parse_type_str; v->visitor.type_number = parse_type_number; v->visitor.start_list = start_list; v->visitor.next_list = next_list; v->visitor.end_list = end_list; v->visitor.optional = parse_optional; v->string = str; v->head = true; return v; }
{ "code": [], "line_no": [] }
StringInputVisitor *FUNC_0(const char *str) { StringInputVisitor *v; v = g_malloc0(sizeof(*v)); v->visitor.type = VISITOR_INPUT; v->visitor.type_int64 = parse_type_int64; v->visitor.type_uint64 = parse_type_uint64; v->visitor.type_size = parse_type_size; v->visitor.type_bool = parse_type_bool; v->visitor.type_str = parse_type_str; v->visitor.type_number = parse_type_number; v->visitor.start_list = start_list; v->visitor.next_list = next_list; v->visitor.end_list = end_list; v->visitor.optional = parse_optional; v->string = str; v->head = true; return v; }
[ "StringInputVisitor *FUNC_0(const char *str)\n{", "StringInputVisitor *v;", "v = g_malloc0(sizeof(*v));", "v->visitor.type = VISITOR_INPUT;", "v->visitor.type_int64 = parse_type_int64;", "v->visitor.type_uint64 = parse_type_uint64;", "v->visitor.type_size = parse_type_size;", "v->visitor.type_bool = parse_type_bool;", "v->visitor.type_str = parse_type_str;", "v->visitor.type_number = parse_type_number;", "v->visitor.start_list = start_list;", "v->visitor.next_list = next_list;", "v->visitor.end_list = end_list;", "v->visitor.optional = parse_optional;", "v->string = str;", "v->head = true;", "return v;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ] ]
11,262
void spapr_vio_bus_register_withprop(VIOsPAPRDeviceInfo *info) { info->qdev.init = spapr_vio_busdev_init; info->qdev.bus_info = &spapr_vio_bus_info; assert(info->qdev.size >= sizeof(VIOsPAPRDevice)); qdev_register(&info->qdev); }
false
qemu
3954d33ab7f82f5a5fa0ced231849920265a5fec
void spapr_vio_bus_register_withprop(VIOsPAPRDeviceInfo *info) { info->qdev.init = spapr_vio_busdev_init; info->qdev.bus_info = &spapr_vio_bus_info; assert(info->qdev.size >= sizeof(VIOsPAPRDevice)); qdev_register(&info->qdev); }
{ "code": [], "line_no": [] }
void FUNC_0(VIOsPAPRDeviceInfo *VAR_0) { VAR_0->qdev.init = spapr_vio_busdev_init; VAR_0->qdev.bus_info = &spapr_vio_bus_info; assert(VAR_0->qdev.size >= sizeof(VIOsPAPRDevice)); qdev_register(&VAR_0->qdev); }
[ "void FUNC_0(VIOsPAPRDeviceInfo *VAR_0)\n{", "VAR_0->qdev.init = spapr_vio_busdev_init;", "VAR_0->qdev.bus_info = &spapr_vio_bus_info;", "assert(VAR_0->qdev.size >= sizeof(VIOsPAPRDevice));", "qdev_register(&VAR_0->qdev);", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ] ]
11,265
static inline void tcg_out_adr(TCGContext *s, TCGReg rd, void *target) { ptrdiff_t offset = tcg_pcrel_diff(s, target); assert(offset == sextract64(offset, 0, 21)); tcg_out_insn(s, 3406, ADR, rd, offset); }
false
qemu
eabb7b91b36b202b4dac2df2d59d698e3aff197a
static inline void tcg_out_adr(TCGContext *s, TCGReg rd, void *target) { ptrdiff_t offset = tcg_pcrel_diff(s, target); assert(offset == sextract64(offset, 0, 21)); tcg_out_insn(s, 3406, ADR, rd, offset); }
{ "code": [], "line_no": [] }
static inline void FUNC_0(TCGContext *VAR_0, TCGReg VAR_1, void *VAR_2) { ptrdiff_t offset = tcg_pcrel_diff(VAR_0, VAR_2); assert(offset == sextract64(offset, 0, 21)); tcg_out_insn(VAR_0, 3406, ADR, VAR_1, offset); }
[ "static inline void FUNC_0(TCGContext *VAR_0, TCGReg VAR_1, void *VAR_2)\n{", "ptrdiff_t offset = tcg_pcrel_diff(VAR_0, VAR_2);", "assert(offset == sextract64(offset, 0, 21));", "tcg_out_insn(VAR_0, 3406, ADR, VAR_1, offset);", "}" ]
[ 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ] ]
11,266
static int pc_boot_set(void *opaque, const char *boot_device) { return set_boot_dev(opaque, boot_device); }
false
qemu
ddcd55316fb2851e144e719171621ad2816487dc
static int pc_boot_set(void *opaque, const char *boot_device) { return set_boot_dev(opaque, boot_device); }
{ "code": [], "line_no": [] }
static int FUNC_0(void *VAR_0, const char *VAR_1) { return set_boot_dev(VAR_0, VAR_1); }
[ "static int FUNC_0(void *VAR_0, const char *VAR_1)\n{", "return set_boot_dev(VAR_0, VAR_1);", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
11,267
static TCGReg tcg_out_tlb_read(TCGContext *s, TCGReg addrlo, TCGReg addrhi, TCGMemOp opc, int mem_index, bool is_load) { TCGReg base = TCG_AREG0; int cmp_off = (is_load ? offsetof(CPUArchState, tlb_table[mem_index][0].addr_read) : offsetof(CPUArchState, tlb_table[mem_index][0].addr_write)); int add_off = offsetof(CPUArchState, tlb_table[mem_index][0].addend); unsigned s_bits = opc & MO_SIZE; unsigned a_bits = get_alignment_bits(opc); /* V7 generates the following: * ubfx r0, addrlo, #TARGET_PAGE_BITS, #CPU_TLB_BITS * add r2, env, #high * add r2, r2, r0, lsl #CPU_TLB_ENTRY_BITS * ldr r0, [r2, #cmp] * ldr r2, [r2, #add] * movw tmp, #page_align_mask * bic tmp, addrlo, tmp * cmp r0, tmp * * Otherwise we generate: * shr tmp, addrlo, #TARGET_PAGE_BITS * add r2, env, #high * and r0, tmp, #(CPU_TLB_SIZE - 1) * add r2, r2, r0, lsl #CPU_TLB_ENTRY_BITS * ldr r0, [r2, #cmp] * ldr r2, [r2, #add] * tst addrlo, #s_mask * cmpeq r0, tmp, lsl #TARGET_PAGE_BITS */ if (use_armv7_instructions) { tcg_out_extract(s, COND_AL, TCG_REG_R0, addrlo, TARGET_PAGE_BITS, CPU_TLB_BITS); } else { tcg_out_dat_reg(s, COND_AL, ARITH_MOV, TCG_REG_TMP, 0, addrlo, SHIFT_IMM_LSR(TARGET_PAGE_BITS)); } /* We checked that the offset is contained within 16 bits above. */ if (add_off > 0xfff || (use_armv6_instructions && cmp_off > 0xff)) { tcg_out_dat_imm(s, COND_AL, ARITH_ADD, TCG_REG_R2, base, (24 << 7) | (cmp_off >> 8)); base = TCG_REG_R2; add_off -= cmp_off & 0xff00; cmp_off &= 0xff; } if (!use_armv7_instructions) { tcg_out_dat_imm(s, COND_AL, ARITH_AND, TCG_REG_R0, TCG_REG_TMP, CPU_TLB_SIZE - 1); } tcg_out_dat_reg(s, COND_AL, ARITH_ADD, TCG_REG_R2, base, TCG_REG_R0, SHIFT_IMM_LSL(CPU_TLB_ENTRY_BITS)); /* Load the tlb comparator. Use ldrd if needed and available, but due to how the pointer needs setting up, ldm isn't useful. Base arm5 doesn't have ldrd, but armv5te does. */ if (use_armv6_instructions && TARGET_LONG_BITS == 64) { tcg_out_ldrd_8(s, COND_AL, TCG_REG_R0, TCG_REG_R2, cmp_off); } else { tcg_out_ld32_12(s, COND_AL, TCG_REG_R0, TCG_REG_R2, cmp_off); if (TARGET_LONG_BITS == 64) { tcg_out_ld32_12(s, COND_AL, TCG_REG_R1, TCG_REG_R2, cmp_off + 4); } } /* Load the tlb addend. */ tcg_out_ld32_12(s, COND_AL, TCG_REG_R2, TCG_REG_R2, add_off); /* Check alignment. We don't support inline unaligned acceses, but we can easily support overalignment checks. */ if (a_bits < s_bits) { a_bits = s_bits; } if (use_armv7_instructions) { tcg_target_ulong mask = ~(TARGET_PAGE_MASK | ((1 << a_bits) - 1)); int rot = encode_imm(mask); if (rot >= 0) { tcg_out_dat_imm(s, COND_AL, ARITH_BIC, TCG_REG_TMP, addrlo, rotl(mask, rot) | (rot << 7)); } else { tcg_out_movi32(s, COND_AL, TCG_REG_TMP, mask); tcg_out_dat_reg(s, COND_AL, ARITH_BIC, TCG_REG_TMP, addrlo, TCG_REG_TMP, 0); } tcg_out_dat_reg(s, COND_AL, ARITH_CMP, 0, TCG_REG_R0, TCG_REG_TMP, 0); } else { if (a_bits) { tcg_out_dat_imm(s, COND_AL, ARITH_TST, 0, addrlo, (1 << a_bits) - 1); } tcg_out_dat_reg(s, (a_bits ? COND_EQ : COND_AL), ARITH_CMP, 0, TCG_REG_R0, TCG_REG_TMP, SHIFT_IMM_LSL(TARGET_PAGE_BITS)); } if (TARGET_LONG_BITS == 64) { tcg_out_dat_reg(s, COND_EQ, ARITH_CMP, 0, TCG_REG_R1, addrhi, 0); } return TCG_REG_R2; }
false
qemu
95ede84f4de18747d03d79c148013cff99acd60b
static TCGReg tcg_out_tlb_read(TCGContext *s, TCGReg addrlo, TCGReg addrhi, TCGMemOp opc, int mem_index, bool is_load) { TCGReg base = TCG_AREG0; int cmp_off = (is_load ? offsetof(CPUArchState, tlb_table[mem_index][0].addr_read) : offsetof(CPUArchState, tlb_table[mem_index][0].addr_write)); int add_off = offsetof(CPUArchState, tlb_table[mem_index][0].addend); unsigned s_bits = opc & MO_SIZE; unsigned a_bits = get_alignment_bits(opc); if (use_armv7_instructions) { tcg_out_extract(s, COND_AL, TCG_REG_R0, addrlo, TARGET_PAGE_BITS, CPU_TLB_BITS); } else { tcg_out_dat_reg(s, COND_AL, ARITH_MOV, TCG_REG_TMP, 0, addrlo, SHIFT_IMM_LSR(TARGET_PAGE_BITS)); } if (add_off > 0xfff || (use_armv6_instructions && cmp_off > 0xff)) { tcg_out_dat_imm(s, COND_AL, ARITH_ADD, TCG_REG_R2, base, (24 << 7) | (cmp_off >> 8)); base = TCG_REG_R2; add_off -= cmp_off & 0xff00; cmp_off &= 0xff; } if (!use_armv7_instructions) { tcg_out_dat_imm(s, COND_AL, ARITH_AND, TCG_REG_R0, TCG_REG_TMP, CPU_TLB_SIZE - 1); } tcg_out_dat_reg(s, COND_AL, ARITH_ADD, TCG_REG_R2, base, TCG_REG_R0, SHIFT_IMM_LSL(CPU_TLB_ENTRY_BITS)); if (use_armv6_instructions && TARGET_LONG_BITS == 64) { tcg_out_ldrd_8(s, COND_AL, TCG_REG_R0, TCG_REG_R2, cmp_off); } else { tcg_out_ld32_12(s, COND_AL, TCG_REG_R0, TCG_REG_R2, cmp_off); if (TARGET_LONG_BITS == 64) { tcg_out_ld32_12(s, COND_AL, TCG_REG_R1, TCG_REG_R2, cmp_off + 4); } } tcg_out_ld32_12(s, COND_AL, TCG_REG_R2, TCG_REG_R2, add_off); if (a_bits < s_bits) { a_bits = s_bits; } if (use_armv7_instructions) { tcg_target_ulong mask = ~(TARGET_PAGE_MASK | ((1 << a_bits) - 1)); int rot = encode_imm(mask); if (rot >= 0) { tcg_out_dat_imm(s, COND_AL, ARITH_BIC, TCG_REG_TMP, addrlo, rotl(mask, rot) | (rot << 7)); } else { tcg_out_movi32(s, COND_AL, TCG_REG_TMP, mask); tcg_out_dat_reg(s, COND_AL, ARITH_BIC, TCG_REG_TMP, addrlo, TCG_REG_TMP, 0); } tcg_out_dat_reg(s, COND_AL, ARITH_CMP, 0, TCG_REG_R0, TCG_REG_TMP, 0); } else { if (a_bits) { tcg_out_dat_imm(s, COND_AL, ARITH_TST, 0, addrlo, (1 << a_bits) - 1); } tcg_out_dat_reg(s, (a_bits ? COND_EQ : COND_AL), ARITH_CMP, 0, TCG_REG_R0, TCG_REG_TMP, SHIFT_IMM_LSL(TARGET_PAGE_BITS)); } if (TARGET_LONG_BITS == 64) { tcg_out_dat_reg(s, COND_EQ, ARITH_CMP, 0, TCG_REG_R1, addrhi, 0); } return TCG_REG_R2; }
{ "code": [], "line_no": [] }
static TCGReg FUNC_0(TCGContext *s, TCGReg addrlo, TCGReg addrhi, TCGMemOp opc, int mem_index, bool is_load) { TCGReg base = TCG_AREG0; int VAR_0 = (is_load ? offsetof(CPUArchState, tlb_table[mem_index][0].addr_read) : offsetof(CPUArchState, tlb_table[mem_index][0].addr_write)); int VAR_1 = offsetof(CPUArchState, tlb_table[mem_index][0].addend); unsigned VAR_2 = opc & MO_SIZE; unsigned VAR_3 = get_alignment_bits(opc); if (use_armv7_instructions) { tcg_out_extract(s, COND_AL, TCG_REG_R0, addrlo, TARGET_PAGE_BITS, CPU_TLB_BITS); } else { tcg_out_dat_reg(s, COND_AL, ARITH_MOV, TCG_REG_TMP, 0, addrlo, SHIFT_IMM_LSR(TARGET_PAGE_BITS)); } if (VAR_1 > 0xfff || (use_armv6_instructions && VAR_0 > 0xff)) { tcg_out_dat_imm(s, COND_AL, ARITH_ADD, TCG_REG_R2, base, (24 << 7) | (VAR_0 >> 8)); base = TCG_REG_R2; VAR_1 -= VAR_0 & 0xff00; VAR_0 &= 0xff; } if (!use_armv7_instructions) { tcg_out_dat_imm(s, COND_AL, ARITH_AND, TCG_REG_R0, TCG_REG_TMP, CPU_TLB_SIZE - 1); } tcg_out_dat_reg(s, COND_AL, ARITH_ADD, TCG_REG_R2, base, TCG_REG_R0, SHIFT_IMM_LSL(CPU_TLB_ENTRY_BITS)); if (use_armv6_instructions && TARGET_LONG_BITS == 64) { tcg_out_ldrd_8(s, COND_AL, TCG_REG_R0, TCG_REG_R2, VAR_0); } else { tcg_out_ld32_12(s, COND_AL, TCG_REG_R0, TCG_REG_R2, VAR_0); if (TARGET_LONG_BITS == 64) { tcg_out_ld32_12(s, COND_AL, TCG_REG_R1, TCG_REG_R2, VAR_0 + 4); } } tcg_out_ld32_12(s, COND_AL, TCG_REG_R2, TCG_REG_R2, VAR_1); if (VAR_3 < VAR_2) { VAR_3 = VAR_2; } if (use_armv7_instructions) { tcg_target_ulong mask = ~(TARGET_PAGE_MASK | ((1 << VAR_3) - 1)); int VAR_4 = encode_imm(mask); if (VAR_4 >= 0) { tcg_out_dat_imm(s, COND_AL, ARITH_BIC, TCG_REG_TMP, addrlo, rotl(mask, VAR_4) | (VAR_4 << 7)); } else { tcg_out_movi32(s, COND_AL, TCG_REG_TMP, mask); tcg_out_dat_reg(s, COND_AL, ARITH_BIC, TCG_REG_TMP, addrlo, TCG_REG_TMP, 0); } tcg_out_dat_reg(s, COND_AL, ARITH_CMP, 0, TCG_REG_R0, TCG_REG_TMP, 0); } else { if (VAR_3) { tcg_out_dat_imm(s, COND_AL, ARITH_TST, 0, addrlo, (1 << VAR_3) - 1); } tcg_out_dat_reg(s, (VAR_3 ? COND_EQ : COND_AL), ARITH_CMP, 0, TCG_REG_R0, TCG_REG_TMP, SHIFT_IMM_LSL(TARGET_PAGE_BITS)); } if (TARGET_LONG_BITS == 64) { tcg_out_dat_reg(s, COND_EQ, ARITH_CMP, 0, TCG_REG_R1, addrhi, 0); } return TCG_REG_R2; }
[ "static TCGReg FUNC_0(TCGContext *s, TCGReg addrlo, TCGReg addrhi,\nTCGMemOp opc, int mem_index, bool is_load)\n{", "TCGReg base = TCG_AREG0;", "int VAR_0 =\n(is_load\n? offsetof(CPUArchState, tlb_table[mem_index][0].addr_read)\n: offsetof(CPUArchState, tlb_table[mem_index][0].addr_write));", "int VAR_1 = offsetof(CPUArchState, tlb_table[mem_index][0].addend);", "unsigned VAR_2 = opc & MO_SIZE;", "unsigned VAR_3 = get_alignment_bits(opc);", "if (use_armv7_instructions) {", "tcg_out_extract(s, COND_AL, TCG_REG_R0, addrlo,\nTARGET_PAGE_BITS, CPU_TLB_BITS);", "} else {", "tcg_out_dat_reg(s, COND_AL, ARITH_MOV, TCG_REG_TMP,\n0, addrlo, SHIFT_IMM_LSR(TARGET_PAGE_BITS));", "}", "if (VAR_1 > 0xfff || (use_armv6_instructions && VAR_0 > 0xff)) {", "tcg_out_dat_imm(s, COND_AL, ARITH_ADD, TCG_REG_R2, base,\n(24 << 7) | (VAR_0 >> 8));", "base = TCG_REG_R2;", "VAR_1 -= VAR_0 & 0xff00;", "VAR_0 &= 0xff;", "}", "if (!use_armv7_instructions) {", "tcg_out_dat_imm(s, COND_AL, ARITH_AND,\nTCG_REG_R0, TCG_REG_TMP, CPU_TLB_SIZE - 1);", "}", "tcg_out_dat_reg(s, COND_AL, ARITH_ADD, TCG_REG_R2, base,\nTCG_REG_R0, SHIFT_IMM_LSL(CPU_TLB_ENTRY_BITS));", "if (use_armv6_instructions && TARGET_LONG_BITS == 64) {", "tcg_out_ldrd_8(s, COND_AL, TCG_REG_R0, TCG_REG_R2, VAR_0);", "} else {", "tcg_out_ld32_12(s, COND_AL, TCG_REG_R0, TCG_REG_R2, VAR_0);", "if (TARGET_LONG_BITS == 64) {", "tcg_out_ld32_12(s, COND_AL, TCG_REG_R1, TCG_REG_R2, VAR_0 + 4);", "}", "}", "tcg_out_ld32_12(s, COND_AL, TCG_REG_R2, TCG_REG_R2, VAR_1);", "if (VAR_3 < VAR_2) {", "VAR_3 = VAR_2;", "}", "if (use_armv7_instructions) {", "tcg_target_ulong mask = ~(TARGET_PAGE_MASK | ((1 << VAR_3) - 1));", "int VAR_4 = encode_imm(mask);", "if (VAR_4 >= 0) {", "tcg_out_dat_imm(s, COND_AL, ARITH_BIC, TCG_REG_TMP, addrlo,\nrotl(mask, VAR_4) | (VAR_4 << 7));", "} else {", "tcg_out_movi32(s, COND_AL, TCG_REG_TMP, mask);", "tcg_out_dat_reg(s, COND_AL, ARITH_BIC, TCG_REG_TMP,\naddrlo, TCG_REG_TMP, 0);", "}", "tcg_out_dat_reg(s, COND_AL, ARITH_CMP, 0, TCG_REG_R0, TCG_REG_TMP, 0);", "} else {", "if (VAR_3) {", "tcg_out_dat_imm(s, COND_AL, ARITH_TST, 0, addrlo,\n(1 << VAR_3) - 1);", "}", "tcg_out_dat_reg(s, (VAR_3 ? COND_EQ : COND_AL), ARITH_CMP,\n0, TCG_REG_R0, TCG_REG_TMP,\nSHIFT_IMM_LSL(TARGET_PAGE_BITS));", "}", "if (TARGET_LONG_BITS == 64) {", "tcg_out_dat_reg(s, COND_EQ, ARITH_CMP, 0, TCG_REG_R1, addrhi, 0);", "}", "return TCG_REG_R2;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9, 11, 13, 15 ], [ 17 ], [ 19 ], [ 21 ], [ 65 ], [ 67, 69 ], [ 71 ], [ 73, 75 ], [ 77 ], [ 83 ], [ 85, 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99, 101 ], [ 103 ], [ 105, 107 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 137 ], [ 145 ], [ 147 ], [ 149 ], [ 153 ], [ 155 ], [ 157 ], [ 161 ], [ 163, 165 ], [ 167 ], [ 169 ], [ 171, 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183, 185 ], [ 187 ], [ 189, 191, 193 ], [ 195 ], [ 199 ], [ 201 ], [ 203 ], [ 207 ], [ 209 ] ]
11,269
static void tcg_opt_gen_movi(TCGContext *s, TCGOp *op, TCGArg *args, TCGArg dst, TCGArg val) { TCGOpcode new_op = op_to_movi(op->opc); tcg_target_ulong mask; op->opc = new_op; reset_temp(dst); temps[dst].state = TCG_TEMP_CONST; temps[dst].val = val; mask = val; if (TCG_TARGET_REG_BITS > 32 && new_op == INDEX_op_mov_i32) { /* High bits of the destination are now garbage. */ mask |= ~0xffffffffull; } temps[dst].mask = mask; args[0] = dst; args[1] = val; }
false
qemu
97a79eb70dd35a24fda87d86196afba5e6f21c5d
static void tcg_opt_gen_movi(TCGContext *s, TCGOp *op, TCGArg *args, TCGArg dst, TCGArg val) { TCGOpcode new_op = op_to_movi(op->opc); tcg_target_ulong mask; op->opc = new_op; reset_temp(dst); temps[dst].state = TCG_TEMP_CONST; temps[dst].val = val; mask = val; if (TCG_TARGET_REG_BITS > 32 && new_op == INDEX_op_mov_i32) { mask |= ~0xffffffffull; } temps[dst].mask = mask; args[0] = dst; args[1] = val; }
{ "code": [], "line_no": [] }
static void FUNC_0(TCGContext *VAR_0, TCGOp *VAR_1, TCGArg *VAR_2, TCGArg VAR_3, TCGArg VAR_4) { TCGOpcode new_op = op_to_movi(VAR_1->opc); tcg_target_ulong mask; VAR_1->opc = new_op; reset_temp(VAR_3); temps[VAR_3].state = TCG_TEMP_CONST; temps[VAR_3].VAR_4 = VAR_4; mask = VAR_4; if (TCG_TARGET_REG_BITS > 32 && new_op == INDEX_op_mov_i32) { mask |= ~0xffffffffull; } temps[VAR_3].mask = mask; VAR_2[0] = VAR_3; VAR_2[1] = VAR_4; }
[ "static void FUNC_0(TCGContext *VAR_0, TCGOp *VAR_1, TCGArg *VAR_2,\nTCGArg VAR_3, TCGArg VAR_4)\n{", "TCGOpcode new_op = op_to_movi(VAR_1->opc);", "tcg_target_ulong mask;", "VAR_1->opc = new_op;", "reset_temp(VAR_3);", "temps[VAR_3].state = TCG_TEMP_CONST;", "temps[VAR_3].VAR_4 = VAR_4;", "mask = VAR_4;", "if (TCG_TARGET_REG_BITS > 32 && new_op == INDEX_op_mov_i32) {", "mask |= ~0xffffffffull;", "}", "temps[VAR_3].mask = mask;", "VAR_2[0] = VAR_3;", "VAR_2[1] = VAR_4;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ] ]
11,271
static int colo_do_checkpoint_transaction(MigrationState *s) { Error *local_err = NULL; colo_send_message(s->to_dst_file, COLO_MESSAGE_CHECKPOINT_REQUEST, &local_err); if (local_err) { goto out; } colo_receive_check_message(s->rp_state.from_dst_file, COLO_MESSAGE_CHECKPOINT_REPLY, &local_err); if (local_err) { goto out; } /* TODO: suspend and save vm state to colo buffer */ colo_send_message(s->to_dst_file, COLO_MESSAGE_VMSTATE_SEND, &local_err); if (local_err) { goto out; } /* TODO: send vmstate to Secondary */ colo_receive_check_message(s->rp_state.from_dst_file, COLO_MESSAGE_VMSTATE_RECEIVED, &local_err); if (local_err) { goto out; } colo_receive_check_message(s->rp_state.from_dst_file, COLO_MESSAGE_VMSTATE_LOADED, &local_err); if (local_err) { goto out; } /* TODO: resume Primary */ return 0; out: if (local_err) { error_report_err(local_err); } return -EINVAL; }
false
qemu
a91246c95f913dc6fd391eee32f6c9796de70183
static int colo_do_checkpoint_transaction(MigrationState *s) { Error *local_err = NULL; colo_send_message(s->to_dst_file, COLO_MESSAGE_CHECKPOINT_REQUEST, &local_err); if (local_err) { goto out; } colo_receive_check_message(s->rp_state.from_dst_file, COLO_MESSAGE_CHECKPOINT_REPLY, &local_err); if (local_err) { goto out; } colo_send_message(s->to_dst_file, COLO_MESSAGE_VMSTATE_SEND, &local_err); if (local_err) { goto out; } colo_receive_check_message(s->rp_state.from_dst_file, COLO_MESSAGE_VMSTATE_RECEIVED, &local_err); if (local_err) { goto out; } colo_receive_check_message(s->rp_state.from_dst_file, COLO_MESSAGE_VMSTATE_LOADED, &local_err); if (local_err) { goto out; } return 0; out: if (local_err) { error_report_err(local_err); } return -EINVAL; }
{ "code": [], "line_no": [] }
static int FUNC_0(MigrationState *VAR_0) { Error *local_err = NULL; colo_send_message(VAR_0->to_dst_file, COLO_MESSAGE_CHECKPOINT_REQUEST, &local_err); if (local_err) { goto out; } colo_receive_check_message(VAR_0->rp_state.from_dst_file, COLO_MESSAGE_CHECKPOINT_REPLY, &local_err); if (local_err) { goto out; } colo_send_message(VAR_0->to_dst_file, COLO_MESSAGE_VMSTATE_SEND, &local_err); if (local_err) { goto out; } colo_receive_check_message(VAR_0->rp_state.from_dst_file, COLO_MESSAGE_VMSTATE_RECEIVED, &local_err); if (local_err) { goto out; } colo_receive_check_message(VAR_0->rp_state.from_dst_file, COLO_MESSAGE_VMSTATE_LOADED, &local_err); if (local_err) { goto out; } return 0; out: if (local_err) { error_report_err(local_err); } return -EINVAL; }
[ "static int FUNC_0(MigrationState *VAR_0)\n{", "Error *local_err = NULL;", "colo_send_message(VAR_0->to_dst_file, COLO_MESSAGE_CHECKPOINT_REQUEST,\n&local_err);", "if (local_err) {", "goto out;", "}", "colo_receive_check_message(VAR_0->rp_state.from_dst_file,\nCOLO_MESSAGE_CHECKPOINT_REPLY, &local_err);", "if (local_err) {", "goto out;", "}", "colo_send_message(VAR_0->to_dst_file, COLO_MESSAGE_VMSTATE_SEND, &local_err);", "if (local_err) {", "goto out;", "}", "colo_receive_check_message(VAR_0->rp_state.from_dst_file,\nCOLO_MESSAGE_VMSTATE_RECEIVED, &local_err);", "if (local_err) {", "goto out;", "}", "colo_receive_check_message(VAR_0->rp_state.from_dst_file,\nCOLO_MESSAGE_VMSTATE_LOADED, &local_err);", "if (local_err) {", "goto out;", "}", "return 0;", "out:\nif (local_err) {", "error_report_err(local_err);", "}", "return -EINVAL;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9, 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21, 23 ], [ 25 ], [ 27 ], [ 29 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 51, 53 ], [ 55 ], [ 57 ], [ 59 ], [ 63, 65 ], [ 67 ], [ 69 ], [ 71 ], [ 79 ], [ 81, 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ] ]
11,272
static int load_ipmovie_packet(IPMVEContext *s, AVIOContext *pb, AVPacket *pkt) { int chunk_type; if (s->audio_chunk_offset && s->audio_channels && s->audio_bits) { if (s->audio_type == AV_CODEC_ID_NONE) { av_log(s->avf, AV_LOG_ERROR, "Can not read audio packet before" "audio codec is known\n"); return CHUNK_BAD; } /* adjust for PCM audio by skipping chunk header */ if (s->audio_type != AV_CODEC_ID_INTERPLAY_DPCM) { s->audio_chunk_offset += 6; s->audio_chunk_size -= 6; } avio_seek(pb, s->audio_chunk_offset, SEEK_SET); s->audio_chunk_offset = 0; if (s->audio_chunk_size != av_get_packet(pb, pkt, s->audio_chunk_size)) return CHUNK_EOF; pkt->stream_index = s->audio_stream_index; pkt->pts = s->audio_frame_count; /* audio frame maintenance */ if (s->audio_type != AV_CODEC_ID_INTERPLAY_DPCM) s->audio_frame_count += (s->audio_chunk_size / s->audio_channels / (s->audio_bits / 8)); else s->audio_frame_count += (s->audio_chunk_size - 6 - s->audio_channels) / s->audio_channels; av_log(s->avf, AV_LOG_TRACE, "sending audio frame with pts %"PRId64" (%d audio frames)\n", pkt->pts, s->audio_frame_count); chunk_type = CHUNK_VIDEO; } else if (s->decode_map_chunk_offset) { /* send both the decode map and the video data together */ if (av_new_packet(pkt, 2 + s->decode_map_chunk_size + s->video_chunk_size)) return CHUNK_NOMEM; if (s->has_palette) { uint8_t *pal; pal = av_packet_new_side_data(pkt, AV_PKT_DATA_PALETTE, AVPALETTE_SIZE); if (pal) { memcpy(pal, s->palette, AVPALETTE_SIZE); s->has_palette = 0; } } if (s->changed) { ff_add_param_change(pkt, 0, 0, 0, s->video_width, s->video_height); s->changed = 0; } pkt->pos= s->decode_map_chunk_offset; avio_seek(pb, s->decode_map_chunk_offset, SEEK_SET); s->decode_map_chunk_offset = 0; AV_WL16(pkt->data, s->decode_map_chunk_size); if (avio_read(pb, pkt->data + 2, s->decode_map_chunk_size) != s->decode_map_chunk_size) { av_packet_unref(pkt); return CHUNK_EOF; } avio_seek(pb, s->video_chunk_offset, SEEK_SET); s->video_chunk_offset = 0; if (avio_read(pb, pkt->data + 2 + s->decode_map_chunk_size, s->video_chunk_size) != s->video_chunk_size) { av_packet_unref(pkt); return CHUNK_EOF; } pkt->stream_index = s->video_stream_index; pkt->pts = s->video_pts; av_log(s->avf, AV_LOG_TRACE, "sending video frame with pts %"PRId64"\n", pkt->pts); s->video_pts += s->frame_pts_inc; chunk_type = CHUNK_VIDEO; } else { avio_seek(pb, s->next_chunk_offset, SEEK_SET); chunk_type = CHUNK_DONE; } return chunk_type; }
false
FFmpeg
ba2c385006e3100d6cd506f61c53186ba054a06d
static int load_ipmovie_packet(IPMVEContext *s, AVIOContext *pb, AVPacket *pkt) { int chunk_type; if (s->audio_chunk_offset && s->audio_channels && s->audio_bits) { if (s->audio_type == AV_CODEC_ID_NONE) { av_log(s->avf, AV_LOG_ERROR, "Can not read audio packet before" "audio codec is known\n"); return CHUNK_BAD; } if (s->audio_type != AV_CODEC_ID_INTERPLAY_DPCM) { s->audio_chunk_offset += 6; s->audio_chunk_size -= 6; } avio_seek(pb, s->audio_chunk_offset, SEEK_SET); s->audio_chunk_offset = 0; if (s->audio_chunk_size != av_get_packet(pb, pkt, s->audio_chunk_size)) return CHUNK_EOF; pkt->stream_index = s->audio_stream_index; pkt->pts = s->audio_frame_count; if (s->audio_type != AV_CODEC_ID_INTERPLAY_DPCM) s->audio_frame_count += (s->audio_chunk_size / s->audio_channels / (s->audio_bits / 8)); else s->audio_frame_count += (s->audio_chunk_size - 6 - s->audio_channels) / s->audio_channels; av_log(s->avf, AV_LOG_TRACE, "sending audio frame with pts %"PRId64" (%d audio frames)\n", pkt->pts, s->audio_frame_count); chunk_type = CHUNK_VIDEO; } else if (s->decode_map_chunk_offset) { if (av_new_packet(pkt, 2 + s->decode_map_chunk_size + s->video_chunk_size)) return CHUNK_NOMEM; if (s->has_palette) { uint8_t *pal; pal = av_packet_new_side_data(pkt, AV_PKT_DATA_PALETTE, AVPALETTE_SIZE); if (pal) { memcpy(pal, s->palette, AVPALETTE_SIZE); s->has_palette = 0; } } if (s->changed) { ff_add_param_change(pkt, 0, 0, 0, s->video_width, s->video_height); s->changed = 0; } pkt->pos= s->decode_map_chunk_offset; avio_seek(pb, s->decode_map_chunk_offset, SEEK_SET); s->decode_map_chunk_offset = 0; AV_WL16(pkt->data, s->decode_map_chunk_size); if (avio_read(pb, pkt->data + 2, s->decode_map_chunk_size) != s->decode_map_chunk_size) { av_packet_unref(pkt); return CHUNK_EOF; } avio_seek(pb, s->video_chunk_offset, SEEK_SET); s->video_chunk_offset = 0; if (avio_read(pb, pkt->data + 2 + s->decode_map_chunk_size, s->video_chunk_size) != s->video_chunk_size) { av_packet_unref(pkt); return CHUNK_EOF; } pkt->stream_index = s->video_stream_index; pkt->pts = s->video_pts; av_log(s->avf, AV_LOG_TRACE, "sending video frame with pts %"PRId64"\n", pkt->pts); s->video_pts += s->frame_pts_inc; chunk_type = CHUNK_VIDEO; } else { avio_seek(pb, s->next_chunk_offset, SEEK_SET); chunk_type = CHUNK_DONE; } return chunk_type; }
{ "code": [], "line_no": [] }
static int FUNC_0(IPMVEContext *VAR_0, AVIOContext *VAR_1, AVPacket *VAR_2) { int VAR_3; if (VAR_0->audio_chunk_offset && VAR_0->audio_channels && VAR_0->audio_bits) { if (VAR_0->audio_type == AV_CODEC_ID_NONE) { av_log(VAR_0->avf, AV_LOG_ERROR, "Can not read audio packet before" "audio codec is known\n"); return CHUNK_BAD; } if (VAR_0->audio_type != AV_CODEC_ID_INTERPLAY_DPCM) { VAR_0->audio_chunk_offset += 6; VAR_0->audio_chunk_size -= 6; } avio_seek(VAR_1, VAR_0->audio_chunk_offset, SEEK_SET); VAR_0->audio_chunk_offset = 0; if (VAR_0->audio_chunk_size != av_get_packet(VAR_1, VAR_2, VAR_0->audio_chunk_size)) return CHUNK_EOF; VAR_2->stream_index = VAR_0->audio_stream_index; VAR_2->pts = VAR_0->audio_frame_count; if (VAR_0->audio_type != AV_CODEC_ID_INTERPLAY_DPCM) VAR_0->audio_frame_count += (VAR_0->audio_chunk_size / VAR_0->audio_channels / (VAR_0->audio_bits / 8)); else VAR_0->audio_frame_count += (VAR_0->audio_chunk_size - 6 - VAR_0->audio_channels) / VAR_0->audio_channels; av_log(VAR_0->avf, AV_LOG_TRACE, "sending audio frame with pts %"PRId64" (%d audio frames)\n", VAR_2->pts, VAR_0->audio_frame_count); VAR_3 = CHUNK_VIDEO; } else if (VAR_0->decode_map_chunk_offset) { if (av_new_packet(VAR_2, 2 + VAR_0->decode_map_chunk_size + VAR_0->video_chunk_size)) return CHUNK_NOMEM; if (VAR_0->has_palette) { uint8_t *pal; pal = av_packet_new_side_data(VAR_2, AV_PKT_DATA_PALETTE, AVPALETTE_SIZE); if (pal) { memcpy(pal, VAR_0->palette, AVPALETTE_SIZE); VAR_0->has_palette = 0; } } if (VAR_0->changed) { ff_add_param_change(VAR_2, 0, 0, 0, VAR_0->video_width, VAR_0->video_height); VAR_0->changed = 0; } VAR_2->pos= VAR_0->decode_map_chunk_offset; avio_seek(VAR_1, VAR_0->decode_map_chunk_offset, SEEK_SET); VAR_0->decode_map_chunk_offset = 0; AV_WL16(VAR_2->data, VAR_0->decode_map_chunk_size); if (avio_read(VAR_1, VAR_2->data + 2, VAR_0->decode_map_chunk_size) != VAR_0->decode_map_chunk_size) { av_packet_unref(VAR_2); return CHUNK_EOF; } avio_seek(VAR_1, VAR_0->video_chunk_offset, SEEK_SET); VAR_0->video_chunk_offset = 0; if (avio_read(VAR_1, VAR_2->data + 2 + VAR_0->decode_map_chunk_size, VAR_0->video_chunk_size) != VAR_0->video_chunk_size) { av_packet_unref(VAR_2); return CHUNK_EOF; } VAR_2->stream_index = VAR_0->video_stream_index; VAR_2->pts = VAR_0->video_pts; av_log(VAR_0->avf, AV_LOG_TRACE, "sending video frame with pts %"PRId64"\n", VAR_2->pts); VAR_0->video_pts += VAR_0->frame_pts_inc; VAR_3 = CHUNK_VIDEO; } else { avio_seek(VAR_1, VAR_0->next_chunk_offset, SEEK_SET); VAR_3 = CHUNK_DONE; } return VAR_3; }
[ "static int FUNC_0(IPMVEContext *VAR_0, AVIOContext *VAR_1,\nAVPacket *VAR_2) {", "int VAR_3;", "if (VAR_0->audio_chunk_offset && VAR_0->audio_channels && VAR_0->audio_bits) {", "if (VAR_0->audio_type == AV_CODEC_ID_NONE) {", "av_log(VAR_0->avf, AV_LOG_ERROR, \"Can not read audio packet before\"\n\"audio codec is known\\n\");", "return CHUNK_BAD;", "}", "if (VAR_0->audio_type != AV_CODEC_ID_INTERPLAY_DPCM) {", "VAR_0->audio_chunk_offset += 6;", "VAR_0->audio_chunk_size -= 6;", "}", "avio_seek(VAR_1, VAR_0->audio_chunk_offset, SEEK_SET);", "VAR_0->audio_chunk_offset = 0;", "if (VAR_0->audio_chunk_size != av_get_packet(VAR_1, VAR_2, VAR_0->audio_chunk_size))\nreturn CHUNK_EOF;", "VAR_2->stream_index = VAR_0->audio_stream_index;", "VAR_2->pts = VAR_0->audio_frame_count;", "if (VAR_0->audio_type != AV_CODEC_ID_INTERPLAY_DPCM)\nVAR_0->audio_frame_count +=\n(VAR_0->audio_chunk_size / VAR_0->audio_channels / (VAR_0->audio_bits / 8));", "else\nVAR_0->audio_frame_count +=\n(VAR_0->audio_chunk_size - 6 - VAR_0->audio_channels) / VAR_0->audio_channels;", "av_log(VAR_0->avf, AV_LOG_TRACE, \"sending audio frame with pts %\"PRId64\" (%d audio frames)\\n\",\nVAR_2->pts, VAR_0->audio_frame_count);", "VAR_3 = CHUNK_VIDEO;", "} else if (VAR_0->decode_map_chunk_offset) {", "if (av_new_packet(VAR_2, 2 + VAR_0->decode_map_chunk_size + VAR_0->video_chunk_size))\nreturn CHUNK_NOMEM;", "if (VAR_0->has_palette) {", "uint8_t *pal;", "pal = av_packet_new_side_data(VAR_2, AV_PKT_DATA_PALETTE,\nAVPALETTE_SIZE);", "if (pal) {", "memcpy(pal, VAR_0->palette, AVPALETTE_SIZE);", "VAR_0->has_palette = 0;", "}", "}", "if (VAR_0->changed) {", "ff_add_param_change(VAR_2, 0, 0, 0, VAR_0->video_width, VAR_0->video_height);", "VAR_0->changed = 0;", "}", "VAR_2->pos= VAR_0->decode_map_chunk_offset;", "avio_seek(VAR_1, VAR_0->decode_map_chunk_offset, SEEK_SET);", "VAR_0->decode_map_chunk_offset = 0;", "AV_WL16(VAR_2->data, VAR_0->decode_map_chunk_size);", "if (avio_read(VAR_1, VAR_2->data + 2, VAR_0->decode_map_chunk_size) !=\nVAR_0->decode_map_chunk_size) {", "av_packet_unref(VAR_2);", "return CHUNK_EOF;", "}", "avio_seek(VAR_1, VAR_0->video_chunk_offset, SEEK_SET);", "VAR_0->video_chunk_offset = 0;", "if (avio_read(VAR_1, VAR_2->data + 2 + VAR_0->decode_map_chunk_size,\nVAR_0->video_chunk_size) != VAR_0->video_chunk_size) {", "av_packet_unref(VAR_2);", "return CHUNK_EOF;", "}", "VAR_2->stream_index = VAR_0->video_stream_index;", "VAR_2->pts = VAR_0->video_pts;", "av_log(VAR_0->avf, AV_LOG_TRACE, \"sending video frame with pts %\"PRId64\"\\n\", VAR_2->pts);", "VAR_0->video_pts += VAR_0->frame_pts_inc;", "VAR_3 = CHUNK_VIDEO;", "} else {", "avio_seek(VAR_1, VAR_0->next_chunk_offset, SEEK_SET);", "VAR_3 = CHUNK_DONE;", "}", "return VAR_3;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 7 ], [ 11 ], [ 13 ], [ 15, 17 ], [ 19 ], [ 21 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 43, 45 ], [ 49 ], [ 51 ], [ 57, 59, 61 ], [ 63, 65, 67 ], [ 71, 73 ], [ 77 ], [ 81 ], [ 89, 91 ], [ 95 ], [ 97 ], [ 101, 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 133 ], [ 135, 137 ], [ 139 ], [ 141 ], [ 143 ], [ 147 ], [ 149 ], [ 153, 155 ], [ 157 ], [ 159 ], [ 161 ], [ 165 ], [ 167 ], [ 171 ], [ 175 ], [ 179 ], [ 183 ], [ 187 ], [ 189 ], [ 193 ], [ 197 ], [ 199 ] ]
11,273
static void verdex_init(ram_addr_t ram_size, int vga_ram_size, const char *boot_device, const char *kernel_filename, const char *kernel_cmdline, const char *initrd_filename, const char *cpu_model) { struct pxa2xx_state_s *cpu; int index; uint32_t verdex_rom = 0x02000000; uint32_t verdex_ram = 0x10000000; if (ram_size < (verdex_ram + verdex_rom + PXA2XX_INTERNAL_SIZE)) { fprintf(stderr, "This platform requires %i bytes of memory\n", verdex_ram + verdex_rom + PXA2XX_INTERNAL_SIZE); exit(1); } cpu = pxa270_init(verdex_ram, cpu_model ?: "pxa270-c0"); index = drive_get_index(IF_PFLASH, 0, 0); if (index == -1) { fprintf(stderr, "A flash image must be given with the " "'pflash' parameter\n"); exit(1); } if (!pflash_cfi01_register(0x00000000, qemu_ram_alloc(verdex_rom), drives_table[index].bdrv, sector_len, verdex_rom / sector_len, 2, 0, 0, 0, 0)) { fprintf(stderr, "qemu: Error registering flash memory.\n"); exit(1); } cpu->env->regs[15] = 0x00000000; /* Interrupt line of NIC is connected to GPIO line 99 */ smc91c111_init(&nd_table[0], 0x04000300, pxa2xx_gpio_in_get(cpu->gpio)[99]); }
false
qemu
a0b753dfd3920df146a5f4d05e442e3c522900c7
static void verdex_init(ram_addr_t ram_size, int vga_ram_size, const char *boot_device, const char *kernel_filename, const char *kernel_cmdline, const char *initrd_filename, const char *cpu_model) { struct pxa2xx_state_s *cpu; int index; uint32_t verdex_rom = 0x02000000; uint32_t verdex_ram = 0x10000000; if (ram_size < (verdex_ram + verdex_rom + PXA2XX_INTERNAL_SIZE)) { fprintf(stderr, "This platform requires %i bytes of memory\n", verdex_ram + verdex_rom + PXA2XX_INTERNAL_SIZE); exit(1); } cpu = pxa270_init(verdex_ram, cpu_model ?: "pxa270-c0"); index = drive_get_index(IF_PFLASH, 0, 0); if (index == -1) { fprintf(stderr, "A flash image must be given with the " "'pflash' parameter\n"); exit(1); } if (!pflash_cfi01_register(0x00000000, qemu_ram_alloc(verdex_rom), drives_table[index].bdrv, sector_len, verdex_rom / sector_len, 2, 0, 0, 0, 0)) { fprintf(stderr, "qemu: Error registering flash memory.\n"); exit(1); } cpu->env->regs[15] = 0x00000000; smc91c111_init(&nd_table[0], 0x04000300, pxa2xx_gpio_in_get(cpu->gpio)[99]); }
{ "code": [], "line_no": [] }
static void FUNC_0(ram_addr_t VAR_0, int VAR_1, const char *VAR_2, const char *VAR_3, const char *VAR_4, const char *VAR_5, const char *VAR_6) { struct pxa2xx_state_s *VAR_7; int VAR_8; uint32_t verdex_rom = 0x02000000; uint32_t verdex_ram = 0x10000000; if (VAR_0 < (verdex_ram + verdex_rom + PXA2XX_INTERNAL_SIZE)) { fprintf(stderr, "This platform requires %i bytes of memory\n", verdex_ram + verdex_rom + PXA2XX_INTERNAL_SIZE); exit(1); } VAR_7 = pxa270_init(verdex_ram, VAR_6 ?: "pxa270-c0"); VAR_8 = drive_get_index(IF_PFLASH, 0, 0); if (VAR_8 == -1) { fprintf(stderr, "A flash image must be given with the " "'pflash' parameter\n"); exit(1); } if (!pflash_cfi01_register(0x00000000, qemu_ram_alloc(verdex_rom), drives_table[VAR_8].bdrv, sector_len, verdex_rom / sector_len, 2, 0, 0, 0, 0)) { fprintf(stderr, "qemu: Error registering flash memory.\n"); exit(1); } VAR_7->env->regs[15] = 0x00000000; smc91c111_init(&nd_table[0], 0x04000300, pxa2xx_gpio_in_get(VAR_7->gpio)[99]); }
[ "static void FUNC_0(ram_addr_t VAR_0, int VAR_1,\nconst char *VAR_2,\nconst char *VAR_3, const char *VAR_4,\nconst char *VAR_5, const char *VAR_6)\n{", "struct pxa2xx_state_s *VAR_7;", "int VAR_8;", "uint32_t verdex_rom = 0x02000000;", "uint32_t verdex_ram = 0x10000000;", "if (VAR_0 < (verdex_ram + verdex_rom + PXA2XX_INTERNAL_SIZE)) {", "fprintf(stderr, \"This platform requires %i bytes of memory\\n\",\nverdex_ram + verdex_rom + PXA2XX_INTERNAL_SIZE);", "exit(1);", "}", "VAR_7 = pxa270_init(verdex_ram, VAR_6 ?: \"pxa270-c0\");", "VAR_8 = drive_get_index(IF_PFLASH, 0, 0);", "if (VAR_8 == -1) {", "fprintf(stderr, \"A flash image must be given with the \"\n\"'pflash' parameter\\n\");", "exit(1);", "}", "if (!pflash_cfi01_register(0x00000000, qemu_ram_alloc(verdex_rom),\ndrives_table[VAR_8].bdrv, sector_len, verdex_rom / sector_len,\n2, 0, 0, 0, 0)) {", "fprintf(stderr, \"qemu: Error registering flash memory.\\n\");", "exit(1);", "}", "VAR_7->env->regs[15] = 0x00000000;", "smc91c111_init(&nd_table[0], 0x04000300,\npxa2xx_gpio_in_get(VAR_7->gpio)[99]);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 23 ], [ 25, 27 ], [ 29 ], [ 31 ], [ 35 ], [ 39 ], [ 41 ], [ 43, 45 ], [ 47 ], [ 49 ], [ 53, 55, 57 ], [ 59 ], [ 61 ], [ 63 ], [ 67 ], [ 73, 75 ], [ 77 ] ]
11,274
void pci_device_save(PCIDevice *s, QEMUFile *f) { int i; qemu_put_be32(f, s->version_id); /* PCI device version */ qemu_put_buffer(f, s->config, 256); for (i = 0; i < 4; i++) qemu_put_be32(f, s->irq_state[i]); }
false
qemu
73534f2f682f2957fabb25e3890481098cc5dcee
void pci_device_save(PCIDevice *s, QEMUFile *f) { int i; qemu_put_be32(f, s->version_id); qemu_put_buffer(f, s->config, 256); for (i = 0; i < 4; i++) qemu_put_be32(f, s->irq_state[i]); }
{ "code": [], "line_no": [] }
void FUNC_0(PCIDevice *VAR_0, QEMUFile *VAR_1) { int VAR_2; qemu_put_be32(VAR_1, VAR_0->version_id); qemu_put_buffer(VAR_1, VAR_0->config, 256); for (VAR_2 = 0; VAR_2 < 4; VAR_2++) qemu_put_be32(VAR_1, VAR_0->irq_state[VAR_2]); }
[ "void FUNC_0(PCIDevice *VAR_0, QEMUFile *VAR_1)\n{", "int VAR_2;", "qemu_put_be32(VAR_1, VAR_0->version_id);", "qemu_put_buffer(VAR_1, VAR_0->config, 256);", "for (VAR_2 = 0; VAR_2 < 4; VAR_2++)", "qemu_put_be32(VAR_1, VAR_0->irq_state[VAR_2]);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ] ]
11,275
static void qxl_flip(PCIQXLDevice *qxl, QXLRect *rect) { uint8_t *src = qxl->guest_primary.data; uint8_t *dst = qxl->guest_primary.flipped; int len, i; src += (qxl->guest_primary.surface.height - rect->top - 1) * qxl->guest_primary.stride; dst += rect->top * qxl->guest_primary.stride; src += rect->left * qxl->guest_primary.bytes_pp; dst += rect->left * qxl->guest_primary.bytes_pp; len = (rect->right - rect->left) * qxl->guest_primary.bytes_pp; for (i = rect->top; i < rect->bottom; i++) { memcpy(dst, src, len); dst += qxl->guest_primary.stride; src -= qxl->guest_primary.stride; } }
false
qemu
0e2487bd6f56445b43307536a465ee2ba810aed9
static void qxl_flip(PCIQXLDevice *qxl, QXLRect *rect) { uint8_t *src = qxl->guest_primary.data; uint8_t *dst = qxl->guest_primary.flipped; int len, i; src += (qxl->guest_primary.surface.height - rect->top - 1) * qxl->guest_primary.stride; dst += rect->top * qxl->guest_primary.stride; src += rect->left * qxl->guest_primary.bytes_pp; dst += rect->left * qxl->guest_primary.bytes_pp; len = (rect->right - rect->left) * qxl->guest_primary.bytes_pp; for (i = rect->top; i < rect->bottom; i++) { memcpy(dst, src, len); dst += qxl->guest_primary.stride; src -= qxl->guest_primary.stride; } }
{ "code": [], "line_no": [] }
static void FUNC_0(PCIQXLDevice *VAR_0, QXLRect *VAR_1) { uint8_t *src = VAR_0->guest_primary.data; uint8_t *dst = VAR_0->guest_primary.flipped; int VAR_2, VAR_3; src += (VAR_0->guest_primary.surface.height - VAR_1->top - 1) * VAR_0->guest_primary.stride; dst += VAR_1->top * VAR_0->guest_primary.stride; src += VAR_1->left * VAR_0->guest_primary.bytes_pp; dst += VAR_1->left * VAR_0->guest_primary.bytes_pp; VAR_2 = (VAR_1->right - VAR_1->left) * VAR_0->guest_primary.bytes_pp; for (VAR_3 = VAR_1->top; VAR_3 < VAR_1->bottom; VAR_3++) { memcpy(dst, src, VAR_2); dst += VAR_0->guest_primary.stride; src -= VAR_0->guest_primary.stride; } }
[ "static void FUNC_0(PCIQXLDevice *VAR_0, QXLRect *VAR_1)\n{", "uint8_t *src = VAR_0->guest_primary.data;", "uint8_t *dst = VAR_0->guest_primary.flipped;", "int VAR_2, VAR_3;", "src += (VAR_0->guest_primary.surface.height - VAR_1->top - 1) *\nVAR_0->guest_primary.stride;", "dst += VAR_1->top * VAR_0->guest_primary.stride;", "src += VAR_1->left * VAR_0->guest_primary.bytes_pp;", "dst += VAR_1->left * VAR_0->guest_primary.bytes_pp;", "VAR_2 = (VAR_1->right - VAR_1->left) * VAR_0->guest_primary.bytes_pp;", "for (VAR_3 = VAR_1->top; VAR_3 < VAR_1->bottom; VAR_3++) {", "memcpy(dst, src, VAR_2);", "dst += VAR_0->guest_primary.stride;", "src -= VAR_0->guest_primary.stride;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13, 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ] ]
11,276
START_TEST(qdict_destroy_simple_test) { QDict *qdict; qdict = qdict_new(); qdict_put_obj(qdict, "num", QOBJECT(qint_from_int(0))); qdict_put_obj(qdict, "str", QOBJECT(qstring_from_str("foo"))); QDECREF(qdict); }
false
qemu
ac531cb6e542b1e61d668604adf9dc5306a948c0
START_TEST(qdict_destroy_simple_test) { QDict *qdict; qdict = qdict_new(); qdict_put_obj(qdict, "num", QOBJECT(qint_from_int(0))); qdict_put_obj(qdict, "str", QOBJECT(qstring_from_str("foo"))); QDECREF(qdict); }
{ "code": [], "line_no": [] }
FUNC_0(VAR_0) { QDict *qdict; qdict = qdict_new(); qdict_put_obj(qdict, "num", QOBJECT(qint_from_int(0))); qdict_put_obj(qdict, "str", QOBJECT(qstring_from_str("foo"))); QDECREF(qdict); }
[ "FUNC_0(VAR_0)\n{", "QDict *qdict;", "qdict = qdict_new();", "qdict_put_obj(qdict, \"num\", QOBJECT(qint_from_int(0)));", "qdict_put_obj(qdict, \"str\", QOBJECT(qstring_from_str(\"foo\")));", "QDECREF(qdict);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ] ]
11,277
static int pcibus_reset(BusState *qbus) { pci_bus_reset(DO_UPCAST(PCIBus, qbus, qbus)); /* topology traverse is done by pci_bus_reset(). Tell qbus/qdev walker not to traverse the tree */ return 1; }
false
qemu
81e3e75b6461c53724fe7c7918bc54468fcdaf9d
static int pcibus_reset(BusState *qbus) { pci_bus_reset(DO_UPCAST(PCIBus, qbus, qbus)); return 1; }
{ "code": [], "line_no": [] }
static int FUNC_0(BusState *VAR_0) { pci_bus_reset(DO_UPCAST(PCIBus, VAR_0, VAR_0)); return 1; }
[ "static int FUNC_0(BusState *VAR_0)\n{", "pci_bus_reset(DO_UPCAST(PCIBus, VAR_0, VAR_0));", "return 1;", "}" ]
[ 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 13 ], [ 15 ] ]
11,278
int AC3_NAME(encode_frame)(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr) { AC3EncodeContext *s = avctx->priv_data; int ret; if (s->options.allow_per_frame_metadata) { ret = ff_ac3_validate_metadata(s); if (ret) return ret; } if (s->bit_alloc.sr_code == 1 || s->eac3) ff_ac3_adjust_frame_size(s); copy_input_samples(s, (SampleType **)frame->extended_data); apply_mdct(s); if (s->fixed_point) scale_coefficients(s); clip_coefficients(&s->dsp, s->blocks[0].mdct_coef[1], AC3_MAX_COEFS * s->num_blocks * s->channels); s->cpl_on = s->cpl_enabled; ff_ac3_compute_coupling_strategy(s); if (s->cpl_on) apply_channel_coupling(s); compute_rematrixing_strategy(s); if (!s->fixed_point) scale_coefficients(s); ff_ac3_apply_rematrixing(s); ff_ac3_process_exponents(s); ret = ff_ac3_compute_bit_allocation(s); if (ret) { av_log(avctx, AV_LOG_ERROR, "Bit allocation failed. Try increasing the bitrate.\n"); return ret; } ff_ac3_group_exponents(s); ff_ac3_quantize_mantissas(s); if ((ret = ff_alloc_packet2(avctx, avpkt, s->frame_size))) return ret; ff_ac3_output_frame(s, avpkt->data); if (frame->pts != AV_NOPTS_VALUE) avpkt->pts = frame->pts - ff_samples_to_time_base(avctx, avctx->delay); *got_packet_ptr = 1; return 0; }
false
FFmpeg
bcaf64b605442e1622d16da89d4ec0e7730b8a8c
int AC3_NAME(encode_frame)(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr) { AC3EncodeContext *s = avctx->priv_data; int ret; if (s->options.allow_per_frame_metadata) { ret = ff_ac3_validate_metadata(s); if (ret) return ret; } if (s->bit_alloc.sr_code == 1 || s->eac3) ff_ac3_adjust_frame_size(s); copy_input_samples(s, (SampleType **)frame->extended_data); apply_mdct(s); if (s->fixed_point) scale_coefficients(s); clip_coefficients(&s->dsp, s->blocks[0].mdct_coef[1], AC3_MAX_COEFS * s->num_blocks * s->channels); s->cpl_on = s->cpl_enabled; ff_ac3_compute_coupling_strategy(s); if (s->cpl_on) apply_channel_coupling(s); compute_rematrixing_strategy(s); if (!s->fixed_point) scale_coefficients(s); ff_ac3_apply_rematrixing(s); ff_ac3_process_exponents(s); ret = ff_ac3_compute_bit_allocation(s); if (ret) { av_log(avctx, AV_LOG_ERROR, "Bit allocation failed. Try increasing the bitrate.\n"); return ret; } ff_ac3_group_exponents(s); ff_ac3_quantize_mantissas(s); if ((ret = ff_alloc_packet2(avctx, avpkt, s->frame_size))) return ret; ff_ac3_output_frame(s, avpkt->data); if (frame->pts != AV_NOPTS_VALUE) avpkt->pts = frame->pts - ff_samples_to_time_base(avctx, avctx->delay); *got_packet_ptr = 1; return 0; }
{ "code": [], "line_no": [] }
int FUNC_0(encode_frame)(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr) { AC3EncodeContext *s = avctx->priv_data; int VAR_0; if (s->options.allow_per_frame_metadata) { VAR_0 = ff_ac3_validate_metadata(s); if (VAR_0) return VAR_0; } if (s->bit_alloc.sr_code == 1 || s->eac3) ff_ac3_adjust_frame_size(s); copy_input_samples(s, (SampleType **)frame->extended_data); apply_mdct(s); if (s->fixed_point) scale_coefficients(s); clip_coefficients(&s->dsp, s->blocks[0].mdct_coef[1], AC3_MAX_COEFS * s->num_blocks * s->channels); s->cpl_on = s->cpl_enabled; ff_ac3_compute_coupling_strategy(s); if (s->cpl_on) apply_channel_coupling(s); compute_rematrixing_strategy(s); if (!s->fixed_point) scale_coefficients(s); ff_ac3_apply_rematrixing(s); ff_ac3_process_exponents(s); VAR_0 = ff_ac3_compute_bit_allocation(s); if (VAR_0) { av_log(avctx, AV_LOG_ERROR, "Bit allocation failed. Try increasing the bitrate.\n"); return VAR_0; } ff_ac3_group_exponents(s); ff_ac3_quantize_mantissas(s); if ((VAR_0 = ff_alloc_packet2(avctx, avpkt, s->frame_size))) return VAR_0; ff_ac3_output_frame(s, avpkt->data); if (frame->pts != AV_NOPTS_VALUE) avpkt->pts = frame->pts - ff_samples_to_time_base(avctx, avctx->delay); *got_packet_ptr = 1; return 0; }
[ "int FUNC_0(encode_frame)(AVCodecContext *avctx, AVPacket *avpkt,\nconst AVFrame *frame, int *got_packet_ptr)\n{", "AC3EncodeContext *s = avctx->priv_data;", "int VAR_0;", "if (s->options.allow_per_frame_metadata) {", "VAR_0 = ff_ac3_validate_metadata(s);", "if (VAR_0)\nreturn VAR_0;", "}", "if (s->bit_alloc.sr_code == 1 || s->eac3)\nff_ac3_adjust_frame_size(s);", "copy_input_samples(s, (SampleType **)frame->extended_data);", "apply_mdct(s);", "if (s->fixed_point)\nscale_coefficients(s);", "clip_coefficients(&s->dsp, s->blocks[0].mdct_coef[1],\nAC3_MAX_COEFS * s->num_blocks * s->channels);", "s->cpl_on = s->cpl_enabled;", "ff_ac3_compute_coupling_strategy(s);", "if (s->cpl_on)\napply_channel_coupling(s);", "compute_rematrixing_strategy(s);", "if (!s->fixed_point)\nscale_coefficients(s);", "ff_ac3_apply_rematrixing(s);", "ff_ac3_process_exponents(s);", "VAR_0 = ff_ac3_compute_bit_allocation(s);", "if (VAR_0) {", "av_log(avctx, AV_LOG_ERROR, \"Bit allocation failed. Try increasing the bitrate.\\n\");", "return VAR_0;", "}", "ff_ac3_group_exponents(s);", "ff_ac3_quantize_mantissas(s);", "if ((VAR_0 = ff_alloc_packet2(avctx, avpkt, s->frame_size)))\nreturn VAR_0;", "ff_ac3_output_frame(s, avpkt->data);", "if (frame->pts != AV_NOPTS_VALUE)\navpkt->pts = frame->pts - ff_samples_to_time_base(avctx, avctx->delay);", "*got_packet_ptr = 1;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17, 19 ], [ 21 ], [ 25, 27 ], [ 31 ], [ 35 ], [ 39, 41 ], [ 45, 47 ], [ 51 ], [ 53 ], [ 57, 59 ], [ 63 ], [ 67, 69 ], [ 73 ], [ 77 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 93 ], [ 97 ], [ 101, 103 ], [ 105 ], [ 109, 111 ], [ 115 ], [ 117 ], [ 119 ] ]
11,279
static int read_channel_params(MLPDecodeContext *m, unsigned int substr, GetBitContext *gbp, unsigned int ch) { ChannelParams *cp = &m->channel_params[ch]; FilterParams *fir = &cp->filter_params[FIR]; FilterParams *iir = &cp->filter_params[IIR]; SubStream *s = &m->substream[substr]; if (s->param_presence_flags & PARAM_FIR) if (get_bits1(gbp)) if (read_filter_params(m, gbp, ch, FIR) < 0) return -1; if (s->param_presence_flags & PARAM_IIR) if (get_bits1(gbp)) if (read_filter_params(m, gbp, ch, IIR) < 0) return -1; if (fir->order && iir->order && fir->shift != iir->shift) { av_log(m->avctx, AV_LOG_ERROR, "FIR and IIR filters must use the same precision.\n"); return -1; } /* The FIR and IIR filters must have the same precision. * To simplify the filtering code, only the precision of the * FIR filter is considered. If only the IIR filter is employed, * the FIR filter precision is set to that of the IIR filter, so * that the filtering code can use it. */ if (!fir->order && iir->order) fir->shift = iir->shift; if (s->param_presence_flags & PARAM_HUFFOFFSET) if (get_bits1(gbp)) cp->huff_offset = get_sbits(gbp, 15); cp->codebook = get_bits(gbp, 2); cp->huff_lsbs = get_bits(gbp, 5); cp->sign_huff_offset = calculate_sign_huff(m, substr, ch); /* TODO: validate */ return 0; }
false
FFmpeg
125cf771f6d17b9b9db7588cbf8f36619bc41f35
static int read_channel_params(MLPDecodeContext *m, unsigned int substr, GetBitContext *gbp, unsigned int ch) { ChannelParams *cp = &m->channel_params[ch]; FilterParams *fir = &cp->filter_params[FIR]; FilterParams *iir = &cp->filter_params[IIR]; SubStream *s = &m->substream[substr]; if (s->param_presence_flags & PARAM_FIR) if (get_bits1(gbp)) if (read_filter_params(m, gbp, ch, FIR) < 0) return -1; if (s->param_presence_flags & PARAM_IIR) if (get_bits1(gbp)) if (read_filter_params(m, gbp, ch, IIR) < 0) return -1; if (fir->order && iir->order && fir->shift != iir->shift) { av_log(m->avctx, AV_LOG_ERROR, "FIR and IIR filters must use the same precision.\n"); return -1; } if (!fir->order && iir->order) fir->shift = iir->shift; if (s->param_presence_flags & PARAM_HUFFOFFSET) if (get_bits1(gbp)) cp->huff_offset = get_sbits(gbp, 15); cp->codebook = get_bits(gbp, 2); cp->huff_lsbs = get_bits(gbp, 5); cp->sign_huff_offset = calculate_sign_huff(m, substr, ch); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(MLPDecodeContext *VAR_0, unsigned int VAR_1, GetBitContext *VAR_2, unsigned int VAR_3) { ChannelParams *cp = &VAR_0->channel_params[VAR_3]; FilterParams *fir = &cp->filter_params[FIR]; FilterParams *iir = &cp->filter_params[IIR]; SubStream *s = &VAR_0->substream[VAR_1]; if (s->param_presence_flags & PARAM_FIR) if (get_bits1(VAR_2)) if (read_filter_params(VAR_0, VAR_2, VAR_3, FIR) < 0) return -1; if (s->param_presence_flags & PARAM_IIR) if (get_bits1(VAR_2)) if (read_filter_params(VAR_0, VAR_2, VAR_3, IIR) < 0) return -1; if (fir->order && iir->order && fir->shift != iir->shift) { av_log(VAR_0->avctx, AV_LOG_ERROR, "FIR and IIR filters must use the same precision.\n"); return -1; } if (!fir->order && iir->order) fir->shift = iir->shift; if (s->param_presence_flags & PARAM_HUFFOFFSET) if (get_bits1(VAR_2)) cp->huff_offset = get_sbits(VAR_2, 15); cp->codebook = get_bits(VAR_2, 2); cp->huff_lsbs = get_bits(VAR_2, 5); cp->sign_huff_offset = calculate_sign_huff(VAR_0, VAR_1, VAR_3); return 0; }
[ "static int FUNC_0(MLPDecodeContext *VAR_0, unsigned int VAR_1,\nGetBitContext *VAR_2, unsigned int VAR_3)\n{", "ChannelParams *cp = &VAR_0->channel_params[VAR_3];", "FilterParams *fir = &cp->filter_params[FIR];", "FilterParams *iir = &cp->filter_params[IIR];", "SubStream *s = &VAR_0->substream[VAR_1];", "if (s->param_presence_flags & PARAM_FIR)\nif (get_bits1(VAR_2))\nif (read_filter_params(VAR_0, VAR_2, VAR_3, FIR) < 0)\nreturn -1;", "if (s->param_presence_flags & PARAM_IIR)\nif (get_bits1(VAR_2))\nif (read_filter_params(VAR_0, VAR_2, VAR_3, IIR) < 0)\nreturn -1;", "if (fir->order && iir->order &&\nfir->shift != iir->shift) {", "av_log(VAR_0->avctx, AV_LOG_ERROR,\n\"FIR and IIR filters must use the same precision.\\n\");", "return -1;", "}", "if (!fir->order && iir->order)\nfir->shift = iir->shift;", "if (s->param_presence_flags & PARAM_HUFFOFFSET)\nif (get_bits1(VAR_2))\ncp->huff_offset = get_sbits(VAR_2, 15);", "cp->codebook = get_bits(VAR_2, 2);", "cp->huff_lsbs = get_bits(VAR_2, 5);", "cp->sign_huff_offset = calculate_sign_huff(VAR_0, VAR_1, VAR_3);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17, 19, 21, 23 ], [ 27, 29, 31, 33 ], [ 37, 39 ], [ 41, 43 ], [ 45 ], [ 47 ], [ 59, 61 ], [ 65, 67, 69 ], [ 73 ], [ 75 ], [ 79 ], [ 87 ], [ 89 ] ]
11,280
static int64_t rm_read_dts(AVFormatContext *s, int stream_index, int64_t *ppos, int64_t pos_limit) { RMDemuxContext *rm = s->priv_data; int64_t pos, dts; int stream_index2, flags, len, h; pos = *ppos; if(rm->old_format) return AV_NOPTS_VALUE; avio_seek(s->pb, pos, SEEK_SET); rm->remaining_len=0; for(;;){ int seq=1; AVStream *st; len=sync(s, &dts, &flags, &stream_index2, &pos); if(len<0) return AV_NOPTS_VALUE; st = s->streams[stream_index2]; if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) { h= avio_r8(s->pb); len--; if(!(h & 0x40)){ seq = avio_r8(s->pb); len--; } } if((flags&2) && (seq&0x7F) == 1){ // av_log(s, AV_LOG_DEBUG, "%d %d-%d %"PRId64" %d\n", flags, stream_index2, stream_index, dts, seq); av_add_index_entry(st, pos, dts, 0, 0, AVINDEX_KEYFRAME); if(stream_index2 == stream_index) break; } avio_skip(s->pb, len); } *ppos = pos; return dts; }
false
FFmpeg
7e4111cfe2f5d03af8d608757e897145aa252af8
static int64_t rm_read_dts(AVFormatContext *s, int stream_index, int64_t *ppos, int64_t pos_limit) { RMDemuxContext *rm = s->priv_data; int64_t pos, dts; int stream_index2, flags, len, h; pos = *ppos; if(rm->old_format) return AV_NOPTS_VALUE; avio_seek(s->pb, pos, SEEK_SET); rm->remaining_len=0; for(;;){ int seq=1; AVStream *st; len=sync(s, &dts, &flags, &stream_index2, &pos); if(len<0) return AV_NOPTS_VALUE; st = s->streams[stream_index2]; if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) { h= avio_r8(s->pb); len--; if(!(h & 0x40)){ seq = avio_r8(s->pb); len--; } } if((flags&2) && (seq&0x7F) == 1){ av_add_index_entry(st, pos, dts, 0, 0, AVINDEX_KEYFRAME); if(stream_index2 == stream_index) break; } avio_skip(s->pb, len); } *ppos = pos; return dts; }
{ "code": [], "line_no": [] }
static int64_t FUNC_0(AVFormatContext *s, int stream_index, int64_t *ppos, int64_t pos_limit) { RMDemuxContext *rm = s->priv_data; int64_t pos, dts; int VAR_0, VAR_1, VAR_2, VAR_3; pos = *ppos; if(rm->old_format) return AV_NOPTS_VALUE; avio_seek(s->pb, pos, SEEK_SET); rm->remaining_len=0; for(;;){ int VAR_4=1; AVStream *st; VAR_2=sync(s, &dts, &VAR_1, &VAR_0, &pos); if(VAR_2<0) return AV_NOPTS_VALUE; st = s->streams[VAR_0]; if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) { VAR_3= avio_r8(s->pb); VAR_2--; if(!(VAR_3 & 0x40)){ VAR_4 = avio_r8(s->pb); VAR_2--; } } if((VAR_1&2) && (VAR_4&0x7F) == 1){ av_add_index_entry(st, pos, dts, 0, 0, AVINDEX_KEYFRAME); if(VAR_0 == stream_index) break; } avio_skip(s->pb, VAR_2); } *ppos = pos; return dts; }
[ "static int64_t FUNC_0(AVFormatContext *s, int stream_index,\nint64_t *ppos, int64_t pos_limit)\n{", "RMDemuxContext *rm = s->priv_data;", "int64_t pos, dts;", "int VAR_0, VAR_1, VAR_2, VAR_3;", "pos = *ppos;", "if(rm->old_format)\nreturn AV_NOPTS_VALUE;", "avio_seek(s->pb, pos, SEEK_SET);", "rm->remaining_len=0;", "for(;;){", "int VAR_4=1;", "AVStream *st;", "VAR_2=sync(s, &dts, &VAR_1, &VAR_0, &pos);", "if(VAR_2<0)\nreturn AV_NOPTS_VALUE;", "st = s->streams[VAR_0];", "if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {", "VAR_3= avio_r8(s->pb); VAR_2--;", "if(!(VAR_3 & 0x40)){", "VAR_4 = avio_r8(s->pb); VAR_2--;", "}", "}", "if((VAR_1&2) && (VAR_4&0x7F) == 1){", "av_add_index_entry(st, pos, dts, 0, 0, AVINDEX_KEYFRAME);", "if(VAR_0 == stream_index)\nbreak;", "}", "avio_skip(s->pb, VAR_2);", "}", "*ppos = pos;", "return dts;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 19, 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39, 41 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 65 ], [ 67, 69 ], [ 71 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ] ]
11,281
static int gif_image_write_header(AVIOContext *pb, int width, int height, int loop_count, uint32_t *palette) { int i; avio_write(pb, "GIF", 3); avio_write(pb, "89a", 3); avio_wl16(pb, width); avio_wl16(pb, height); if (palette) { avio_w8(pb, 0xf7); /* flags: global clut, 256 entries */ avio_w8(pb, 0x1f); /* background color index */ avio_w8(pb, 0); /* aspect ratio */ for (i = 0; i < 256; i++) { const uint32_t v = palette[i] & 0xffffff; avio_wb24(pb, v); } } else { avio_w8(pb, 0); /* flags */ avio_w8(pb, 0); /* background color index */ avio_w8(pb, 0); /* aspect ratio */ } /* "NETSCAPE EXTENSION" for looped animation GIF */ avio_w8(pb, 0x21); /* GIF Extension code */ avio_w8(pb, 0xff); /* Application Extension Label */ avio_w8(pb, 0x0b); /* Length of Application Block */ avio_write(pb, "NETSCAPE2.0", sizeof("NETSCAPE2.0") - 1); avio_w8(pb, 0x03); /* Length of Data Sub-Block */ avio_w8(pb, 0x01); avio_wl16(pb, (uint16_t)loop_count); avio_w8(pb, 0x00); /* Data Sub-block Terminator */ return 0; }
false
FFmpeg
09f59d6adfa19d1ad5049416c1d0fbc996f509fd
static int gif_image_write_header(AVIOContext *pb, int width, int height, int loop_count, uint32_t *palette) { int i; avio_write(pb, "GIF", 3); avio_write(pb, "89a", 3); avio_wl16(pb, width); avio_wl16(pb, height); if (palette) { avio_w8(pb, 0xf7); avio_w8(pb, 0x1f); avio_w8(pb, 0); for (i = 0; i < 256; i++) { const uint32_t v = palette[i] & 0xffffff; avio_wb24(pb, v); } } else { avio_w8(pb, 0); avio_w8(pb, 0); avio_w8(pb, 0); } avio_w8(pb, 0x21); avio_w8(pb, 0xff); avio_w8(pb, 0x0b); avio_write(pb, "NETSCAPE2.0", sizeof("NETSCAPE2.0") - 1); avio_w8(pb, 0x03); avio_w8(pb, 0x01); avio_wl16(pb, (uint16_t)loop_count); avio_w8(pb, 0x00); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVIOContext *VAR_0, int VAR_1, int VAR_2, int VAR_3, uint32_t *VAR_4) { int VAR_5; avio_write(VAR_0, "GIF", 3); avio_write(VAR_0, "89a", 3); avio_wl16(VAR_0, VAR_1); avio_wl16(VAR_0, VAR_2); if (VAR_4) { avio_w8(VAR_0, 0xf7); avio_w8(VAR_0, 0x1f); avio_w8(VAR_0, 0); for (VAR_5 = 0; VAR_5 < 256; VAR_5++) { const uint32_t VAR_6 = VAR_4[VAR_5] & 0xffffff; avio_wb24(VAR_0, VAR_6); } } else { avio_w8(VAR_0, 0); avio_w8(VAR_0, 0); avio_w8(VAR_0, 0); } avio_w8(VAR_0, 0x21); avio_w8(VAR_0, 0xff); avio_w8(VAR_0, 0x0b); avio_write(VAR_0, "NETSCAPE2.0", sizeof("NETSCAPE2.0") - 1); avio_w8(VAR_0, 0x03); avio_w8(VAR_0, 0x01); avio_wl16(VAR_0, (uint16_t)VAR_3); avio_w8(VAR_0, 0x00); return 0; }
[ "static int FUNC_0(AVIOContext *VAR_0, int VAR_1, int VAR_2,\nint VAR_3, uint32_t *VAR_4)\n{", "int VAR_5;", "avio_write(VAR_0, \"GIF\", 3);", "avio_write(VAR_0, \"89a\", 3);", "avio_wl16(VAR_0, VAR_1);", "avio_wl16(VAR_0, VAR_2);", "if (VAR_4) {", "avio_w8(VAR_0, 0xf7);", "avio_w8(VAR_0, 0x1f);", "avio_w8(VAR_0, 0);", "for (VAR_5 = 0; VAR_5 < 256; VAR_5++) {", "const uint32_t VAR_6 = VAR_4[VAR_5] & 0xffffff;", "avio_wb24(VAR_0, VAR_6);", "}", "} else {", "avio_w8(VAR_0, 0);", "avio_w8(VAR_0, 0);", "avio_w8(VAR_0, 0);", "}", "avio_w8(VAR_0, 0x21);", "avio_w8(VAR_0, 0xff);", "avio_w8(VAR_0, 0x0b);", "avio_write(VAR_0, \"NETSCAPE2.0\", sizeof(\"NETSCAPE2.0\") - 1);", "avio_w8(VAR_0, 0x03);", "avio_w8(VAR_0, 0x01);", "avio_wl16(VAR_0, (uint16_t)VAR_3);", "avio_w8(VAR_0, 0x00);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 69 ], [ 71 ] ]
11,282
static av_cold int omx_encode_init(AVCodecContext *avctx) { OMXCodecContext *s = avctx->priv_data; int ret = AVERROR_ENCODER_NOT_FOUND; const char *role; OMX_BUFFERHEADERTYPE *buffer; OMX_ERRORTYPE err; #if CONFIG_OMX_RPI s->input_zerocopy = 1; #endif s->omx_context = omx_init(avctx, s->libname, s->libprefix); if (!s->omx_context) return AVERROR_ENCODER_NOT_FOUND; pthread_mutex_init(&s->state_mutex, NULL); pthread_cond_init(&s->state_cond, NULL); pthread_mutex_init(&s->input_mutex, NULL); pthread_cond_init(&s->input_cond, NULL); pthread_mutex_init(&s->output_mutex, NULL); pthread_cond_init(&s->output_cond, NULL); s->mutex_cond_inited = 1; s->avctx = avctx; s->state = OMX_StateLoaded; s->error = OMX_ErrorNone; switch (avctx->codec->id) { case AV_CODEC_ID_MPEG4: role = "video_encoder.mpeg4"; break; case AV_CODEC_ID_H264: role = "video_encoder.avc"; break; default: return AVERROR(ENOSYS); } if ((ret = find_component(s->omx_context, avctx, role, s->component_name, sizeof(s->component_name))) < 0) goto fail; av_log(avctx, AV_LOG_INFO, "Using %s\n", s->component_name); if ((ret = omx_component_init(avctx, role)) < 0) goto fail; if (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) { while (1) { buffer = get_buffer(&s->output_mutex, &s->output_cond, &s->num_done_out_buffers, s->done_out_buffers, 1); if (buffer->nFlags & OMX_BUFFERFLAG_CODECCONFIG) { if ((ret = av_reallocp(&avctx->extradata, avctx->extradata_size + buffer->nFilledLen + AV_INPUT_BUFFER_PADDING_SIZE)) < 0) { avctx->extradata_size = 0; goto fail; } memcpy(avctx->extradata + avctx->extradata_size, buffer->pBuffer + buffer->nOffset, buffer->nFilledLen); avctx->extradata_size += buffer->nFilledLen; memset(avctx->extradata + avctx->extradata_size, 0, AV_INPUT_BUFFER_PADDING_SIZE); } err = OMX_FillThisBuffer(s->handle, buffer); if (err != OMX_ErrorNone) { append_buffer(&s->output_mutex, &s->output_cond, &s->num_done_out_buffers, s->done_out_buffers, buffer); av_log(avctx, AV_LOG_ERROR, "OMX_FillThisBuffer failed: %x\n", err); ret = AVERROR_UNKNOWN; goto fail; } if (avctx->codec->id == AV_CODEC_ID_H264) { // For H.264, the extradata can be returned in two separate buffers // (the videocore encoder on raspberry pi does this); // therefore check that we have got both SPS and PPS before continuing. int nals[32] = { 0 }; int i; for (i = 0; i + 4 < avctx->extradata_size; i++) { if (!avctx->extradata[i + 0] && !avctx->extradata[i + 1] && !avctx->extradata[i + 2] && avctx->extradata[i + 3] == 1) { nals[avctx->extradata[i + 4] & 0x1f]++; } } if (nals[NAL_SPS] && nals[NAL_PPS]) break; } else { if (avctx->extradata_size > 0) break; } } } return 0; fail: return ret; }
false
FFmpeg
5c2fb561d94fc51d76ab21d6f7cc5b6cc3aa599c
static av_cold int omx_encode_init(AVCodecContext *avctx) { OMXCodecContext *s = avctx->priv_data; int ret = AVERROR_ENCODER_NOT_FOUND; const char *role; OMX_BUFFERHEADERTYPE *buffer; OMX_ERRORTYPE err; #if CONFIG_OMX_RPI s->input_zerocopy = 1; #endif s->omx_context = omx_init(avctx, s->libname, s->libprefix); if (!s->omx_context) return AVERROR_ENCODER_NOT_FOUND; pthread_mutex_init(&s->state_mutex, NULL); pthread_cond_init(&s->state_cond, NULL); pthread_mutex_init(&s->input_mutex, NULL); pthread_cond_init(&s->input_cond, NULL); pthread_mutex_init(&s->output_mutex, NULL); pthread_cond_init(&s->output_cond, NULL); s->mutex_cond_inited = 1; s->avctx = avctx; s->state = OMX_StateLoaded; s->error = OMX_ErrorNone; switch (avctx->codec->id) { case AV_CODEC_ID_MPEG4: role = "video_encoder.mpeg4"; break; case AV_CODEC_ID_H264: role = "video_encoder.avc"; break; default: return AVERROR(ENOSYS); } if ((ret = find_component(s->omx_context, avctx, role, s->component_name, sizeof(s->component_name))) < 0) goto fail; av_log(avctx, AV_LOG_INFO, "Using %s\n", s->component_name); if ((ret = omx_component_init(avctx, role)) < 0) goto fail; if (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) { while (1) { buffer = get_buffer(&s->output_mutex, &s->output_cond, &s->num_done_out_buffers, s->done_out_buffers, 1); if (buffer->nFlags & OMX_BUFFERFLAG_CODECCONFIG) { if ((ret = av_reallocp(&avctx->extradata, avctx->extradata_size + buffer->nFilledLen + AV_INPUT_BUFFER_PADDING_SIZE)) < 0) { avctx->extradata_size = 0; goto fail; } memcpy(avctx->extradata + avctx->extradata_size, buffer->pBuffer + buffer->nOffset, buffer->nFilledLen); avctx->extradata_size += buffer->nFilledLen; memset(avctx->extradata + avctx->extradata_size, 0, AV_INPUT_BUFFER_PADDING_SIZE); } err = OMX_FillThisBuffer(s->handle, buffer); if (err != OMX_ErrorNone) { append_buffer(&s->output_mutex, &s->output_cond, &s->num_done_out_buffers, s->done_out_buffers, buffer); av_log(avctx, AV_LOG_ERROR, "OMX_FillThisBuffer failed: %x\n", err); ret = AVERROR_UNKNOWN; goto fail; } if (avctx->codec->id == AV_CODEC_ID_H264) { int nals[32] = { 0 }; int i; for (i = 0; i + 4 < avctx->extradata_size; i++) { if (!avctx->extradata[i + 0] && !avctx->extradata[i + 1] && !avctx->extradata[i + 2] && avctx->extradata[i + 3] == 1) { nals[avctx->extradata[i + 4] & 0x1f]++; } } if (nals[NAL_SPS] && nals[NAL_PPS]) break; } else { if (avctx->extradata_size > 0) break; } } } return 0; fail: return ret; }
{ "code": [], "line_no": [] }
static av_cold int FUNC_0(AVCodecContext *avctx) { OMXCodecContext *s = avctx->priv_data; int VAR_0 = AVERROR_ENCODER_NOT_FOUND; const char *VAR_1; OMX_BUFFERHEADERTYPE *buffer; OMX_ERRORTYPE err; #if CONFIG_OMX_RPI s->input_zerocopy = 1; #endif s->omx_context = omx_init(avctx, s->libname, s->libprefix); if (!s->omx_context) return AVERROR_ENCODER_NOT_FOUND; pthread_mutex_init(&s->state_mutex, NULL); pthread_cond_init(&s->state_cond, NULL); pthread_mutex_init(&s->input_mutex, NULL); pthread_cond_init(&s->input_cond, NULL); pthread_mutex_init(&s->output_mutex, NULL); pthread_cond_init(&s->output_cond, NULL); s->mutex_cond_inited = 1; s->avctx = avctx; s->state = OMX_StateLoaded; s->error = OMX_ErrorNone; switch (avctx->codec->id) { case AV_CODEC_ID_MPEG4: VAR_1 = "video_encoder.mpeg4"; break; case AV_CODEC_ID_H264: VAR_1 = "video_encoder.avc"; break; default: return AVERROR(ENOSYS); } if ((VAR_0 = find_component(s->omx_context, avctx, VAR_1, s->component_name, sizeof(s->component_name))) < 0) goto fail; av_log(avctx, AV_LOG_INFO, "Using %s\n", s->component_name); if ((VAR_0 = omx_component_init(avctx, VAR_1)) < 0) goto fail; if (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) { while (1) { buffer = get_buffer(&s->output_mutex, &s->output_cond, &s->num_done_out_buffers, s->done_out_buffers, 1); if (buffer->nFlags & OMX_BUFFERFLAG_CODECCONFIG) { if ((VAR_0 = av_reallocp(&avctx->extradata, avctx->extradata_size + buffer->nFilledLen + AV_INPUT_BUFFER_PADDING_SIZE)) < 0) { avctx->extradata_size = 0; goto fail; } memcpy(avctx->extradata + avctx->extradata_size, buffer->pBuffer + buffer->nOffset, buffer->nFilledLen); avctx->extradata_size += buffer->nFilledLen; memset(avctx->extradata + avctx->extradata_size, 0, AV_INPUT_BUFFER_PADDING_SIZE); } err = OMX_FillThisBuffer(s->handle, buffer); if (err != OMX_ErrorNone) { append_buffer(&s->output_mutex, &s->output_cond, &s->num_done_out_buffers, s->done_out_buffers, buffer); av_log(avctx, AV_LOG_ERROR, "OMX_FillThisBuffer failed: %x\n", err); VAR_0 = AVERROR_UNKNOWN; goto fail; } if (avctx->codec->id == AV_CODEC_ID_H264) { int VAR_2[32] = { 0 }; int VAR_3; for (VAR_3 = 0; VAR_3 + 4 < avctx->extradata_size; VAR_3++) { if (!avctx->extradata[VAR_3 + 0] && !avctx->extradata[VAR_3 + 1] && !avctx->extradata[VAR_3 + 2] && avctx->extradata[VAR_3 + 3] == 1) { VAR_2[avctx->extradata[VAR_3 + 4] & 0x1f]++; } } if (VAR_2[NAL_SPS] && VAR_2[NAL_PPS]) break; } else { if (avctx->extradata_size > 0) break; } } } return 0; fail: return VAR_0; }
[ "static av_cold int FUNC_0(AVCodecContext *avctx)\n{", "OMXCodecContext *s = avctx->priv_data;", "int VAR_0 = AVERROR_ENCODER_NOT_FOUND;", "const char *VAR_1;", "OMX_BUFFERHEADERTYPE *buffer;", "OMX_ERRORTYPE err;", "#if CONFIG_OMX_RPI\ns->input_zerocopy = 1;", "#endif\ns->omx_context = omx_init(avctx, s->libname, s->libprefix);", "if (!s->omx_context)\nreturn AVERROR_ENCODER_NOT_FOUND;", "pthread_mutex_init(&s->state_mutex, NULL);", "pthread_cond_init(&s->state_cond, NULL);", "pthread_mutex_init(&s->input_mutex, NULL);", "pthread_cond_init(&s->input_cond, NULL);", "pthread_mutex_init(&s->output_mutex, NULL);", "pthread_cond_init(&s->output_cond, NULL);", "s->mutex_cond_inited = 1;", "s->avctx = avctx;", "s->state = OMX_StateLoaded;", "s->error = OMX_ErrorNone;", "switch (avctx->codec->id) {", "case AV_CODEC_ID_MPEG4:\nVAR_1 = \"video_encoder.mpeg4\";", "break;", "case AV_CODEC_ID_H264:\nVAR_1 = \"video_encoder.avc\";", "break;", "default:\nreturn AVERROR(ENOSYS);", "}", "if ((VAR_0 = find_component(s->omx_context, avctx, VAR_1, s->component_name, sizeof(s->component_name))) < 0)\ngoto fail;", "av_log(avctx, AV_LOG_INFO, \"Using %s\\n\", s->component_name);", "if ((VAR_0 = omx_component_init(avctx, VAR_1)) < 0)\ngoto fail;", "if (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) {", "while (1) {", "buffer = get_buffer(&s->output_mutex, &s->output_cond,\n&s->num_done_out_buffers, s->done_out_buffers, 1);", "if (buffer->nFlags & OMX_BUFFERFLAG_CODECCONFIG) {", "if ((VAR_0 = av_reallocp(&avctx->extradata, avctx->extradata_size + buffer->nFilledLen + AV_INPUT_BUFFER_PADDING_SIZE)) < 0) {", "avctx->extradata_size = 0;", "goto fail;", "}", "memcpy(avctx->extradata + avctx->extradata_size, buffer->pBuffer + buffer->nOffset, buffer->nFilledLen);", "avctx->extradata_size += buffer->nFilledLen;", "memset(avctx->extradata + avctx->extradata_size, 0, AV_INPUT_BUFFER_PADDING_SIZE);", "}", "err = OMX_FillThisBuffer(s->handle, buffer);", "if (err != OMX_ErrorNone) {", "append_buffer(&s->output_mutex, &s->output_cond,\n&s->num_done_out_buffers, s->done_out_buffers, buffer);", "av_log(avctx, AV_LOG_ERROR, \"OMX_FillThisBuffer failed: %x\\n\", err);", "VAR_0 = AVERROR_UNKNOWN;", "goto fail;", "}", "if (avctx->codec->id == AV_CODEC_ID_H264) {", "int VAR_2[32] = { 0 };", "int VAR_3;", "for (VAR_3 = 0; VAR_3 + 4 < avctx->extradata_size; VAR_3++) {", "if (!avctx->extradata[VAR_3 + 0] &&\n!avctx->extradata[VAR_3 + 1] &&\n!avctx->extradata[VAR_3 + 2] &&\navctx->extradata[VAR_3 + 3] == 1) {", "VAR_2[avctx->extradata[VAR_3 + 4] & 0x1f]++;", "}", "}", "if (VAR_2[NAL_SPS] && VAR_2[NAL_PPS])\nbreak;", "} else {", "if (avctx->extradata_size > 0)\nbreak;", "}", "}", "}", "return 0;", "fail:\nreturn VAR_0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17, 19 ], [ 21, 25 ], [ 27, 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 55 ], [ 57, 59 ], [ 61 ], [ 63, 65 ], [ 67 ], [ 69, 71 ], [ 73 ], [ 77, 79 ], [ 83 ], [ 87, 89 ], [ 93 ], [ 95 ], [ 97, 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123, 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 143 ], [ 145 ], [ 147 ], [ 149, 151, 153, 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163, 165 ], [ 167 ], [ 169, 171 ], [ 173 ], [ 175 ], [ 177 ], [ 181 ], [ 183, 185 ], [ 187 ] ]
11,283
static int check_pkt(AVFormatContext *s, AVPacket *pkt) { MOVMuxContext *mov = s->priv_data; MOVTrack *trk = &mov->tracks[pkt->stream_index]; int64_t ref; uint64_t duration; if (trk->entry) { ref = trk->cluster[trk->entry - 1].dts; } else if ( trk->start_dts != AV_NOPTS_VALUE && !trk->frag_discont) { ref = trk->start_dts + trk->track_duration; } else ref = pkt->dts; // Skip tests for the first packet duration = pkt->dts - ref; if (pkt->dts < ref || duration >= INT_MAX) { av_log(s, AV_LOG_ERROR, "Application provided duration: %"PRId64" / timestamp: %"PRId64" is out of range for mov/mp4 format\n", duration, pkt->dts ); pkt->dts = ref + 1; pkt->pts = AV_NOPTS_VALUE; if (pkt->duration < 0 || pkt->duration > INT_MAX) { av_log(s, AV_LOG_ERROR, "Application provided duration: %"PRId64" is invalid\n", pkt->duration); return AVERROR(EINVAL); return 0;
true
FFmpeg
ffc58b2ce27e140b47900d1ead304663f7b385ae
static int check_pkt(AVFormatContext *s, AVPacket *pkt) { MOVMuxContext *mov = s->priv_data; MOVTrack *trk = &mov->tracks[pkt->stream_index]; int64_t ref; uint64_t duration; if (trk->entry) { ref = trk->cluster[trk->entry - 1].dts; } else if ( trk->start_dts != AV_NOPTS_VALUE && !trk->frag_discont) { ref = trk->start_dts + trk->track_duration; } else ref = pkt->dts; duration = pkt->dts - ref; if (pkt->dts < ref || duration >= INT_MAX) { av_log(s, AV_LOG_ERROR, "Application provided duration: %"PRId64" / timestamp: %"PRId64" is out of range for mov/mp4 format\n", duration, pkt->dts ); pkt->dts = ref + 1; pkt->pts = AV_NOPTS_VALUE; if (pkt->duration < 0 || pkt->duration > INT_MAX) { av_log(s, AV_LOG_ERROR, "Application provided duration: %"PRId64" is invalid\n", pkt->duration); return AVERROR(EINVAL); return 0;
{ "code": [], "line_no": [] }
static int FUNC_0(AVFormatContext *VAR_0, AVPacket *VAR_1) { MOVMuxContext *mov = VAR_0->priv_data; MOVTrack *trk = &mov->tracks[VAR_1->stream_index]; int64_t ref; uint64_t duration; if (trk->entry) { ref = trk->cluster[trk->entry - 1].dts; } else if ( trk->start_dts != AV_NOPTS_VALUE && !trk->frag_discont) { ref = trk->start_dts + trk->track_duration; } else ref = VAR_1->dts; duration = VAR_1->dts - ref; if (VAR_1->dts < ref || duration >= INT_MAX) { av_log(VAR_0, AV_LOG_ERROR, "Application provided duration: %"PRId64" / timestamp: %"PRId64" is out of range for mov/mp4 format\n", duration, VAR_1->dts ); VAR_1->dts = ref + 1; VAR_1->pts = AV_NOPTS_VALUE; if (VAR_1->duration < 0 || VAR_1->duration > INT_MAX) { av_log(VAR_0, AV_LOG_ERROR, "Application provided duration: %"PRId64" is invalid\n", VAR_1->duration); return AVERROR(EINVAL); return 0;
[ "static int FUNC_0(AVFormatContext *VAR_0, AVPacket *VAR_1)\n{", "MOVMuxContext *mov = VAR_0->priv_data;", "MOVTrack *trk = &mov->tracks[VAR_1->stream_index];", "int64_t ref;", "uint64_t duration;", "if (trk->entry) {", "ref = trk->cluster[trk->entry - 1].dts;", "} else if ( trk->start_dts != AV_NOPTS_VALUE", "&& !trk->frag_discont) {", "ref = trk->start_dts + trk->track_duration;", "} else", "ref = VAR_1->dts;", "duration = VAR_1->dts - ref;", "if (VAR_1->dts < ref || duration >= INT_MAX) {", "av_log(VAR_0, AV_LOG_ERROR, \"Application provided duration: %\"PRId64\" / timestamp: %\"PRId64\" is out of range for mov/mp4 format\\n\",\nduration, VAR_1->dts\n);", "VAR_1->dts = ref + 1;", "VAR_1->pts = AV_NOPTS_VALUE;", "if (VAR_1->duration < 0 || VAR_1->duration > INT_MAX) {", "av_log(VAR_0, AV_LOG_ERROR, \"Application provided duration: %\"PRId64\" is invalid\\n\", VAR_1->duration);", "return AVERROR(EINVAL);", "return 0;" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 2 ], [ 3 ], [ 4 ], [ 5 ], [ 6 ], [ 7 ], [ 8 ], [ 9 ], [ 10 ], [ 11 ], [ 12 ], [ 13 ], [ 14 ], [ 15 ], [ 16, 17, 18 ], [ 19 ], [ 20 ], [ 21 ], [ 22 ], [ 23 ], [ 24 ] ]
11,284
static int vc9_init_common(VC9Context *v) { static int done = 0; int i; /* Set the bit planes */ v->mv_type_mb_plane = (struct BitPlane) { NULL, 0, 0, 0 }; v->direct_mb_plane = (struct BitPlane) { NULL, 0, 0, 0 }; v->skip_mb_plane = (struct BitPlane) { NULL, 0, 0, 0 }; #if HAS_ADVANCED_PROFILE v->ac_pred_plane = v->over_flags_plane = (struct BitPlane) { NULL, 0, 0, 0 }; v->hrd_rate = v->hrd_buffer = NULL; #endif /* VLC tables */ #if VLC_NORM6_METH0D == 1 # if 0 // spec -> actual tables converter for(i=0; i<64; i++){ int code= (vc9_norm6_spec[i][1] << vc9_norm6_spec[i][4]) + vc9_norm6_spec[i][3]; av_log(NULL, AV_LOG_DEBUG, "0x%03X, ", code); if(i%16==15) av_log(NULL, AV_LOG_DEBUG, "\n"); } for(i=0; i<64; i++){ int code= vc9_norm6_spec[i][2] + vc9_norm6_spec[i][4]; av_log(NULL, AV_LOG_DEBUG, "%2d, ", code); if(i%16==15) av_log(NULL, AV_LOG_DEBUG, "\n"); } # endif #endif if(!done) { done = 1; INIT_VLC(&vc9_bfraction_vlc, VC9_BFRACTION_VLC_BITS, 23, vc9_bfraction_bits, 1, 1, vc9_bfraction_codes, 1, 1, 1); INIT_VLC(&vc9_norm2_vlc, VC9_NORM2_VLC_BITS, 4, vc9_norm2_bits, 1, 1, vc9_norm2_codes, 1, 1, 1); #if VLC_NORM6_METH0D == 1 INIT_VLC(&vc9_norm6_vlc, VC9_NORM6_VLC_BITS, 64, vc9_norm6_bits, 1, 1, vc9_norm6_codes, 2, 2, 1); #endif #if VLC_NORM6_METH0D == 2 INIT_VLC(&vc9_norm6_first_vlc, VC9_NORM6_FIRST_BITS, 24, &vc9_norm6_first[0][1], 1, 1, &vc9_norm6_first[0][0], 1, 1, 1); INIT_VLC(&vc9_norm6_second_vlc, VC9_NORM6_SECOND_BITS, 22, &vc9_norm6_second[0][1], 1, 1, &vc9_norm6_second[0][0], 1, 1, 1); #endif INIT_VLC(&vc9_imode_vlc, VC9_IMODE_VLC_BITS, 7, vc9_imode_bits, 1, 1, vc9_imode_codes, 1, 1, 1); for (i=0; i<3; i++) { INIT_VLC(&vc9_ttmb_vlc[i], VC9_TTMB_VLC_BITS, 16, vc9_ttmb_bits[i], 1, 1, vc9_ttmb_codes[i], 2, 2, 1); } for(i=0; i<4; i++) { INIT_VLC(&vc9_4mv_block_pattern_vlc[i], VC9_4MV_BLOCK_PATTERN_VLC_BITS, 16, vc9_4mv_block_pattern_bits[i], 1, 1, vc9_4mv_block_pattern_codes[i], 1, 1, 1); INIT_VLC(&vc9_cbpcy_p_vlc[i], VC9_CBPCY_P_VLC_BITS, 64, vc9_cbpcy_p_bits[i], 1, 1, vc9_cbpcy_p_codes[i], 2, 2, 1); INIT_VLC(&vc9_mv_diff_vlc[i], VC9_MV_DIFF_VLC_BITS, 73, vc9_mv_diff_bits[i], 1, 1, vc9_mv_diff_codes[i], 2, 2, 1); } } /* Other defaults */ v->pq = -1; v->mvrange = 0; /* 7.1.1.18, p80 */ return 0; }
true
FFmpeg
bf2bc926f04dcdde0a22c137d08a0bb546e0179e
static int vc9_init_common(VC9Context *v) { static int done = 0; int i; v->mv_type_mb_plane = (struct BitPlane) { NULL, 0, 0, 0 }; v->direct_mb_plane = (struct BitPlane) { NULL, 0, 0, 0 }; v->skip_mb_plane = (struct BitPlane) { NULL, 0, 0, 0 }; #if HAS_ADVANCED_PROFILE v->ac_pred_plane = v->over_flags_plane = (struct BitPlane) { NULL, 0, 0, 0 }; v->hrd_rate = v->hrd_buffer = NULL; #endif #if VLC_NORM6_METH0D == 1 # if 0 for(i=0; i<64; i++){ int code= (vc9_norm6_spec[i][1] << vc9_norm6_spec[i][4]) + vc9_norm6_spec[i][3]; av_log(NULL, AV_LOG_DEBUG, "0x%03X, ", code); if(i%16==15) av_log(NULL, AV_LOG_DEBUG, "\n"); } for(i=0; i<64; i++){ int code= vc9_norm6_spec[i][2] + vc9_norm6_spec[i][4]; av_log(NULL, AV_LOG_DEBUG, "%2d, ", code); if(i%16==15) av_log(NULL, AV_LOG_DEBUG, "\n"); } # endif #endif if(!done) { done = 1; INIT_VLC(&vc9_bfraction_vlc, VC9_BFRACTION_VLC_BITS, 23, vc9_bfraction_bits, 1, 1, vc9_bfraction_codes, 1, 1, 1); INIT_VLC(&vc9_norm2_vlc, VC9_NORM2_VLC_BITS, 4, vc9_norm2_bits, 1, 1, vc9_norm2_codes, 1, 1, 1); #if VLC_NORM6_METH0D == 1 INIT_VLC(&vc9_norm6_vlc, VC9_NORM6_VLC_BITS, 64, vc9_norm6_bits, 1, 1, vc9_norm6_codes, 2, 2, 1); #endif #if VLC_NORM6_METH0D == 2 INIT_VLC(&vc9_norm6_first_vlc, VC9_NORM6_FIRST_BITS, 24, &vc9_norm6_first[0][1], 1, 1, &vc9_norm6_first[0][0], 1, 1, 1); INIT_VLC(&vc9_norm6_second_vlc, VC9_NORM6_SECOND_BITS, 22, &vc9_norm6_second[0][1], 1, 1, &vc9_norm6_second[0][0], 1, 1, 1); #endif INIT_VLC(&vc9_imode_vlc, VC9_IMODE_VLC_BITS, 7, vc9_imode_bits, 1, 1, vc9_imode_codes, 1, 1, 1); for (i=0; i<3; i++) { INIT_VLC(&vc9_ttmb_vlc[i], VC9_TTMB_VLC_BITS, 16, vc9_ttmb_bits[i], 1, 1, vc9_ttmb_codes[i], 2, 2, 1); } for(i=0; i<4; i++) { INIT_VLC(&vc9_4mv_block_pattern_vlc[i], VC9_4MV_BLOCK_PATTERN_VLC_BITS, 16, vc9_4mv_block_pattern_bits[i], 1, 1, vc9_4mv_block_pattern_codes[i], 1, 1, 1); INIT_VLC(&vc9_cbpcy_p_vlc[i], VC9_CBPCY_P_VLC_BITS, 64, vc9_cbpcy_p_bits[i], 1, 1, vc9_cbpcy_p_codes[i], 2, 2, 1); INIT_VLC(&vc9_mv_diff_vlc[i], VC9_MV_DIFF_VLC_BITS, 73, vc9_mv_diff_bits[i], 1, 1, vc9_mv_diff_codes[i], 2, 2, 1); } } v->pq = -1; v->mvrange = 0; return 0; }
{ "code": [ " int i;", "#endif", "#if HAS_ADVANCED_PROFILE", "#endif", " return 0;" ], "line_no": [ 7, 25, 19, 25, 157 ] }
static int FUNC_0(VC9Context *VAR_0) { static int VAR_1 = 0; int VAR_2; VAR_0->mv_type_mb_plane = (struct BitPlane) { NULL, 0, 0, 0 }; VAR_0->direct_mb_plane = (struct BitPlane) { NULL, 0, 0, 0 }; VAR_0->skip_mb_plane = (struct BitPlane) { NULL, 0, 0, 0 }; #if HAS_ADVANCED_PROFILE VAR_0->ac_pred_plane = VAR_0->over_flags_plane = (struct BitPlane) { NULL, 0, 0, 0 }; VAR_0->hrd_rate = VAR_0->hrd_buffer = NULL; #endif #if VLC_NORM6_METH0D == 1 # if 0 for(VAR_2=0; VAR_2<64; VAR_2++){ int code= (vc9_norm6_spec[VAR_2][1] << vc9_norm6_spec[VAR_2][4]) + vc9_norm6_spec[VAR_2][3]; av_log(NULL, AV_LOG_DEBUG, "0x%03X, ", code); if(VAR_2%16==15) av_log(NULL, AV_LOG_DEBUG, "\n"); } for(VAR_2=0; VAR_2<64; VAR_2++){ int code= vc9_norm6_spec[VAR_2][2] + vc9_norm6_spec[VAR_2][4]; av_log(NULL, AV_LOG_DEBUG, "%2d, ", code); if(VAR_2%16==15) av_log(NULL, AV_LOG_DEBUG, "\n"); } # endif #endif if(!VAR_1) { VAR_1 = 1; INIT_VLC(&vc9_bfraction_vlc, VC9_BFRACTION_VLC_BITS, 23, vc9_bfraction_bits, 1, 1, vc9_bfraction_codes, 1, 1, 1); INIT_VLC(&vc9_norm2_vlc, VC9_NORM2_VLC_BITS, 4, vc9_norm2_bits, 1, 1, vc9_norm2_codes, 1, 1, 1); #if VLC_NORM6_METH0D == 1 INIT_VLC(&vc9_norm6_vlc, VC9_NORM6_VLC_BITS, 64, vc9_norm6_bits, 1, 1, vc9_norm6_codes, 2, 2, 1); #endif #if VLC_NORM6_METH0D == 2 INIT_VLC(&vc9_norm6_first_vlc, VC9_NORM6_FIRST_BITS, 24, &vc9_norm6_first[0][1], 1, 1, &vc9_norm6_first[0][0], 1, 1, 1); INIT_VLC(&vc9_norm6_second_vlc, VC9_NORM6_SECOND_BITS, 22, &vc9_norm6_second[0][1], 1, 1, &vc9_norm6_second[0][0], 1, 1, 1); #endif INIT_VLC(&vc9_imode_vlc, VC9_IMODE_VLC_BITS, 7, vc9_imode_bits, 1, 1, vc9_imode_codes, 1, 1, 1); for (VAR_2=0; VAR_2<3; VAR_2++) { INIT_VLC(&vc9_ttmb_vlc[VAR_2], VC9_TTMB_VLC_BITS, 16, vc9_ttmb_bits[VAR_2], 1, 1, vc9_ttmb_codes[VAR_2], 2, 2, 1); } for(VAR_2=0; VAR_2<4; VAR_2++) { INIT_VLC(&vc9_4mv_block_pattern_vlc[VAR_2], VC9_4MV_BLOCK_PATTERN_VLC_BITS, 16, vc9_4mv_block_pattern_bits[VAR_2], 1, 1, vc9_4mv_block_pattern_codes[VAR_2], 1, 1, 1); INIT_VLC(&vc9_cbpcy_p_vlc[VAR_2], VC9_CBPCY_P_VLC_BITS, 64, vc9_cbpcy_p_bits[VAR_2], 1, 1, vc9_cbpcy_p_codes[VAR_2], 2, 2, 1); INIT_VLC(&vc9_mv_diff_vlc[VAR_2], VC9_MV_DIFF_VLC_BITS, 73, vc9_mv_diff_bits[VAR_2], 1, 1, vc9_mv_diff_codes[VAR_2], 2, 2, 1); } } VAR_0->pq = -1; VAR_0->mvrange = 0; return 0; }
[ "static int FUNC_0(VC9Context *VAR_0)\n{", "static int VAR_1 = 0;", "int VAR_2;", "VAR_0->mv_type_mb_plane = (struct BitPlane) { NULL, 0, 0, 0 };", "VAR_0->direct_mb_plane = (struct BitPlane) { NULL, 0, 0, 0 };", "VAR_0->skip_mb_plane = (struct BitPlane) { NULL, 0, 0, 0 };", "#if HAS_ADVANCED_PROFILE\nVAR_0->ac_pred_plane = VAR_0->over_flags_plane = (struct BitPlane) { NULL, 0, 0, 0 };", "VAR_0->hrd_rate = VAR_0->hrd_buffer = NULL;", "#endif\n#if VLC_NORM6_METH0D == 1\n# if 0\nfor(VAR_2=0; VAR_2<64; VAR_2++){", "int code= (vc9_norm6_spec[VAR_2][1] << vc9_norm6_spec[VAR_2][4]) + vc9_norm6_spec[VAR_2][3];", "av_log(NULL, AV_LOG_DEBUG, \"0x%03X, \", code);", "if(VAR_2%16==15) av_log(NULL, AV_LOG_DEBUG, \"\\n\");", "}", "for(VAR_2=0; VAR_2<64; VAR_2++){", "int code= vc9_norm6_spec[VAR_2][2] + vc9_norm6_spec[VAR_2][4];", "av_log(NULL, AV_LOG_DEBUG, \"%2d, \", code);", "if(VAR_2%16==15) av_log(NULL, AV_LOG_DEBUG, \"\\n\");", "}", "# endif\n#endif\nif(!VAR_1)\n{", "VAR_1 = 1;", "INIT_VLC(&vc9_bfraction_vlc, VC9_BFRACTION_VLC_BITS, 23,\nvc9_bfraction_bits, 1, 1,\nvc9_bfraction_codes, 1, 1, 1);", "INIT_VLC(&vc9_norm2_vlc, VC9_NORM2_VLC_BITS, 4,\nvc9_norm2_bits, 1, 1,\nvc9_norm2_codes, 1, 1, 1);", "#if VLC_NORM6_METH0D == 1\nINIT_VLC(&vc9_norm6_vlc, VC9_NORM6_VLC_BITS, 64,\nvc9_norm6_bits, 1, 1,\nvc9_norm6_codes, 2, 2, 1);", "#endif\n#if VLC_NORM6_METH0D == 2\nINIT_VLC(&vc9_norm6_first_vlc, VC9_NORM6_FIRST_BITS, 24,\n&vc9_norm6_first[0][1], 1, 1,\n&vc9_norm6_first[0][0], 1, 1, 1);", "INIT_VLC(&vc9_norm6_second_vlc, VC9_NORM6_SECOND_BITS, 22,\n&vc9_norm6_second[0][1], 1, 1,\n&vc9_norm6_second[0][0], 1, 1, 1);", "#endif\nINIT_VLC(&vc9_imode_vlc, VC9_IMODE_VLC_BITS, 7,\nvc9_imode_bits, 1, 1,\nvc9_imode_codes, 1, 1, 1);", "for (VAR_2=0; VAR_2<3; VAR_2++)", "{", "INIT_VLC(&vc9_ttmb_vlc[VAR_2], VC9_TTMB_VLC_BITS, 16,\nvc9_ttmb_bits[VAR_2], 1, 1,\nvc9_ttmb_codes[VAR_2], 2, 2, 1);", "}", "for(VAR_2=0; VAR_2<4; VAR_2++)", "{", "INIT_VLC(&vc9_4mv_block_pattern_vlc[VAR_2], VC9_4MV_BLOCK_PATTERN_VLC_BITS, 16,\nvc9_4mv_block_pattern_bits[VAR_2], 1, 1,\nvc9_4mv_block_pattern_codes[VAR_2], 1, 1, 1);", "INIT_VLC(&vc9_cbpcy_p_vlc[VAR_2], VC9_CBPCY_P_VLC_BITS, 64,\nvc9_cbpcy_p_bits[VAR_2], 1, 1,\nvc9_cbpcy_p_codes[VAR_2], 2, 2, 1);", "INIT_VLC(&vc9_mv_diff_vlc[VAR_2], VC9_MV_DIFF_VLC_BITS, 73,\nvc9_mv_diff_bits[VAR_2], 1, 1,\nvc9_mv_diff_codes[VAR_2], 2, 2, 1);", "}", "}", "VAR_0->pq = -1;", "VAR_0->mvrange = 0;", "return 0;", "}" ]
[ 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 13 ], [ 15 ], [ 17 ], [ 19, 21 ], [ 23 ], [ 25, 31, 33, 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55, 57, 59, 61 ], [ 63 ], [ 65, 67, 69 ], [ 71, 73, 75 ], [ 77, 79, 81, 83 ], [ 85, 87, 89, 91, 93 ], [ 95, 97, 99 ], [ 101, 103, 105, 107 ], [ 109 ], [ 111 ], [ 113, 115, 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125, 127, 129 ], [ 131, 133, 135 ], [ 137, 139, 141 ], [ 143 ], [ 145 ], [ 151 ], [ 153 ], [ 157 ], [ 159 ] ]
11,285
int av_packet_unpack_dictionary(const uint8_t *data, int size, AVDictionary **dict) { const uint8_t *end = data + size; int ret = 0; if (!dict || !data || !size) return ret; if (size && end[-1]) return AVERROR_INVALIDDATA; while (data < end) { const uint8_t *key = data; const uint8_t *val = data + strlen(key) + 1; if (val >= end) return AVERROR_INVALIDDATA; ret = av_dict_set(dict, key, val, 0); if (ret < 0) break; data = val + strlen(val) + 1; } return ret; }
true
FFmpeg
2c00b373024054e0779ef67fc54b763d624db3e8
int av_packet_unpack_dictionary(const uint8_t *data, int size, AVDictionary **dict) { const uint8_t *end = data + size; int ret = 0; if (!dict || !data || !size) return ret; if (size && end[-1]) return AVERROR_INVALIDDATA; while (data < end) { const uint8_t *key = data; const uint8_t *val = data + strlen(key) + 1; if (val >= end) return AVERROR_INVALIDDATA; ret = av_dict_set(dict, key, val, 0); if (ret < 0) break; data = val + strlen(val) + 1; } return ret; }
{ "code": [ " if (val >= end)" ], "line_no": [ 27 ] }
int FUNC_0(const uint8_t *VAR_0, int VAR_1, AVDictionary **VAR_2) { const uint8_t *VAR_3 = VAR_0 + VAR_1; int VAR_4 = 0; if (!VAR_2 || !VAR_0 || !VAR_1) return VAR_4; if (VAR_1 && VAR_3[-1]) return AVERROR_INVALIDDATA; while (VAR_0 < VAR_3) { const uint8_t *VAR_5 = VAR_0; const uint8_t *VAR_6 = VAR_0 + strlen(VAR_5) + 1; if (VAR_6 >= VAR_3) return AVERROR_INVALIDDATA; VAR_4 = av_dict_set(VAR_2, VAR_5, VAR_6, 0); if (VAR_4 < 0) break; VAR_0 = VAR_6 + strlen(VAR_6) + 1; } return VAR_4; }
[ "int FUNC_0(const uint8_t *VAR_0, int VAR_1, AVDictionary **VAR_2)\n{", "const uint8_t *VAR_3 = VAR_0 + VAR_1;", "int VAR_4 = 0;", "if (!VAR_2 || !VAR_0 || !VAR_1)\nreturn VAR_4;", "if (VAR_1 && VAR_3[-1])\nreturn AVERROR_INVALIDDATA;", "while (VAR_0 < VAR_3) {", "const uint8_t *VAR_5 = VAR_0;", "const uint8_t *VAR_6 = VAR_0 + strlen(VAR_5) + 1;", "if (VAR_6 >= VAR_3)\nreturn AVERROR_INVALIDDATA;", "VAR_4 = av_dict_set(VAR_2, VAR_5, VAR_6, 0);", "if (VAR_4 < 0)\nbreak;", "VAR_0 = VAR_6 + strlen(VAR_6) + 1;", "}", "return VAR_4;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11, 13 ], [ 15, 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27, 29 ], [ 33 ], [ 35, 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ] ]
11,286
void cpu_interrupt(CPUState *env, int mask) { #if !defined(USE_NPTL) TranslationBlock *tb; static spinlock_t interrupt_lock = SPIN_LOCK_UNLOCKED; #endif int old_mask; old_mask = env->interrupt_request; /* FIXME: This is probably not threadsafe. A different thread could be in the middle of a read-modify-write operation. */ env->interrupt_request |= mask; #if defined(USE_NPTL) /* FIXME: TB unchaining isn't SMP safe. For now just ignore the problem and hope the cpu will stop of its own accord. For userspace emulation this often isn't actually as bad as it sounds. Often signals are used primarily to interrupt blocking syscalls. */ #else if (use_icount) { env->icount_decr.u16.high = 0xffff; #ifndef CONFIG_USER_ONLY /* CPU_INTERRUPT_EXIT isn't a real interrupt. It just means an async event happened and we need to process it. */ if (!can_do_io(env) && (mask & ~(old_mask | CPU_INTERRUPT_EXIT)) != 0) { cpu_abort(env, "Raised interrupt while not in I/O function"); } #endif } else { tb = env->current_tb; /* if the cpu is currently executing code, we must unlink it and all the potentially executing TB */ if (tb && !testandset(&interrupt_lock)) { env->current_tb = NULL; tb_reset_jump_recursive(tb); resetlock(&interrupt_lock); } } #endif }
true
qemu
be214e6c0557139ffa5551f77e339c07495bfec3
void cpu_interrupt(CPUState *env, int mask) { #if !defined(USE_NPTL) TranslationBlock *tb; static spinlock_t interrupt_lock = SPIN_LOCK_UNLOCKED; #endif int old_mask; old_mask = env->interrupt_request; env->interrupt_request |= mask; #if defined(USE_NPTL) #else if (use_icount) { env->icount_decr.u16.high = 0xffff; #ifndef CONFIG_USER_ONLY if (!can_do_io(env) && (mask & ~(old_mask | CPU_INTERRUPT_EXIT)) != 0) { cpu_abort(env, "Raised interrupt while not in I/O function"); } #endif } else { tb = env->current_tb; if (tb && !testandset(&interrupt_lock)) { env->current_tb = NULL; tb_reset_jump_recursive(tb); resetlock(&interrupt_lock); } } #endif }
{ "code": [ " && (mask & ~(old_mask | CPU_INTERRUPT_EXIT)) != 0) {" ], "line_no": [ 49 ] }
void FUNC_0(CPUState *VAR_0, int VAR_1) { #if !defined(USE_NPTL) TranslationBlock *tb; static spinlock_t VAR_2 = SPIN_LOCK_UNLOCKED; #endif int VAR_3; VAR_3 = VAR_0->interrupt_request; VAR_0->interrupt_request |= VAR_1; #if defined(USE_NPTL) #else if (use_icount) { VAR_0->icount_decr.u16.high = 0xffff; #ifndef CONFIG_USER_ONLY if (!can_do_io(VAR_0) && (VAR_1 & ~(VAR_3 | CPU_INTERRUPT_EXIT)) != 0) { cpu_abort(VAR_0, "Raised interrupt while not in I/O function"); } #endif } else { tb = VAR_0->current_tb; if (tb && !testandset(&VAR_2)) { VAR_0->current_tb = NULL; tb_reset_jump_recursive(tb); resetlock(&VAR_2); } } #endif }
[ "void FUNC_0(CPUState *VAR_0, int VAR_1)\n{", "#if !defined(USE_NPTL)\nTranslationBlock *tb;", "static spinlock_t VAR_2 = SPIN_LOCK_UNLOCKED;", "#endif\nint VAR_3;", "VAR_3 = VAR_0->interrupt_request;", "VAR_0->interrupt_request |= VAR_1;", "#if defined(USE_NPTL)\n#else\nif (use_icount) {", "VAR_0->icount_decr.u16.high = 0xffff;", "#ifndef CONFIG_USER_ONLY\nif (!can_do_io(VAR_0)\n&& (VAR_1 & ~(VAR_3 | CPU_INTERRUPT_EXIT)) != 0) {", "cpu_abort(VAR_0, \"Raised interrupt while not in I/O function\");", "}", "#endif\n} else {", "tb = VAR_0->current_tb;", "if (tb && !testandset(&VAR_2)) {", "VAR_0->current_tb = NULL;", "tb_reset_jump_recursive(tb);", "resetlock(&VAR_2);", "}", "}", "#endif\n}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5, 7 ], [ 9 ], [ 11, 13 ], [ 17 ], [ 23 ], [ 25, 35, 37 ], [ 39 ], [ 41, 47, 49 ], [ 51 ], [ 53 ], [ 55, 57 ], [ 59 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77, 79 ] ]
11,287
static always_inline int translate_one (DisasContext *ctx, uint32_t insn) { uint32_t palcode; int32_t disp21, disp16, disp12; uint16_t fn11, fn16; uint8_t opc, ra, rb, rc, sbz, fpfn, fn7, fn2, islit; uint8_t lit; int ret; /* Decode all instruction fields */ opc = insn >> 26; ra = (insn >> 21) & 0x1F; rb = (insn >> 16) & 0x1F; rc = insn & 0x1F; sbz = (insn >> 13) & 0x07; islit = (insn >> 12) & 1; if (rb == 31 && !islit) { islit = 1; lit = 0; } else lit = (insn >> 13) & 0xFF; palcode = insn & 0x03FFFFFF; disp21 = ((int32_t)((insn & 0x001FFFFF) << 11)) >> 11; disp16 = (int16_t)(insn & 0x0000FFFF); disp12 = (int32_t)((insn & 0x00000FFF) << 20) >> 20; fn16 = insn & 0x0000FFFF; fn11 = (insn >> 5) & 0x000007FF; fpfn = fn11 & 0x3F; fn7 = (insn >> 5) & 0x0000007F; fn2 = (insn >> 5) & 0x00000003; ret = 0; #if defined ALPHA_DEBUG_DISAS if (logfile != NULL) { fprintf(logfile, "opc %02x ra %d rb %d rc %d disp16 %04x\n", opc, ra, rb, rc, disp16); } #endif switch (opc) { case 0x00: /* CALL_PAL */ if (palcode >= 0x80 && palcode < 0xC0) { /* Unprivileged PAL call */ gen_excp(ctx, EXCP_CALL_PAL + ((palcode & 0x1F) << 6), 0); #if !defined (CONFIG_USER_ONLY) } else if (palcode < 0x40) { /* Privileged PAL code */ if (ctx->mem_idx & 1) goto invalid_opc; else gen_excp(ctx, EXCP_CALL_PALP + ((palcode & 0x1F) << 6), 0); #endif } else { /* Invalid PAL call */ goto invalid_opc; } ret = 3; break; case 0x01: /* OPC01 */ goto invalid_opc; case 0x02: /* OPC02 */ goto invalid_opc; case 0x03: /* OPC03 */ goto invalid_opc; case 0x04: /* OPC04 */ goto invalid_opc; case 0x05: /* OPC05 */ goto invalid_opc; case 0x06: /* OPC06 */ goto invalid_opc; case 0x07: /* OPC07 */ goto invalid_opc; case 0x08: /* LDA */ if (likely(ra != 31)) { if (rb != 31) tcg_gen_addi_i64(cpu_ir[ra], cpu_ir[rb], disp16); else tcg_gen_movi_i64(cpu_ir[ra], disp16); } break; case 0x09: /* LDAH */ if (likely(ra != 31)) { if (rb != 31) tcg_gen_addi_i64(cpu_ir[ra], cpu_ir[rb], disp16 << 16); else tcg_gen_movi_i64(cpu_ir[ra], disp16 << 16); } break; case 0x0A: /* LDBU */ if (!(ctx->amask & AMASK_BWX)) goto invalid_opc; gen_load_mem(ctx, &tcg_gen_qemu_ld8u, ra, rb, disp16, 0, 0); break; case 0x0B: /* LDQ_U */ gen_load_mem(ctx, &tcg_gen_qemu_ld64, ra, rb, disp16, 0, 1); break; case 0x0C: /* LDWU */ if (!(ctx->amask & AMASK_BWX)) goto invalid_opc; gen_load_mem(ctx, &tcg_gen_qemu_ld16u, ra, rb, disp16, 0, 1); break; case 0x0D: /* STW */ gen_store_mem(ctx, &tcg_gen_qemu_st16, ra, rb, disp16, 0, 0); break; case 0x0E: /* STB */ gen_store_mem(ctx, &tcg_gen_qemu_st8, ra, rb, disp16, 0, 0); break; case 0x0F: /* STQ_U */ gen_store_mem(ctx, &tcg_gen_qemu_st64, ra, rb, disp16, 0, 1); break; case 0x10: switch (fn7) { case 0x00: /* ADDL */ if (likely(rc != 31)) { if (ra != 31) { if (islit) { tcg_gen_addi_i64(cpu_ir[rc], cpu_ir[ra], lit); tcg_gen_ext32s_i64(cpu_ir[rc], cpu_ir[rc]); } else { tcg_gen_add_i64(cpu_ir[rc], cpu_ir[ra], cpu_ir[rb]); tcg_gen_ext32s_i64(cpu_ir[rc], cpu_ir[rc]); } } else { if (islit) tcg_gen_movi_i64(cpu_ir[rc], lit); else tcg_gen_ext32s_i64(cpu_ir[rc], cpu_ir[rb]); } } break; case 0x02: /* S4ADDL */ if (likely(rc != 31)) { if (ra != 31) { TCGv tmp = tcg_temp_new(TCG_TYPE_I64); tcg_gen_shli_i64(tmp, cpu_ir[ra], 2); if (islit) tcg_gen_addi_i64(tmp, tmp, lit); else tcg_gen_add_i64(tmp, tmp, cpu_ir[rb]); tcg_gen_ext32s_i64(cpu_ir[rc], tmp); tcg_temp_free(tmp); } else { if (islit) tcg_gen_movi_i64(cpu_ir[rc], lit); else tcg_gen_ext32s_i64(cpu_ir[rc], cpu_ir[rb]); } } break; case 0x09: /* SUBL */ if (likely(rc != 31)) { if (ra != 31) { if (islit) tcg_gen_subi_i64(cpu_ir[rc], cpu_ir[ra], lit); else tcg_gen_sub_i64(cpu_ir[rc], cpu_ir[ra], cpu_ir[rb]); tcg_gen_ext32s_i64(cpu_ir[rc], cpu_ir[rc]); } else { if (islit) tcg_gen_movi_i64(cpu_ir[rc], -lit); else { tcg_gen_neg_i64(cpu_ir[rc], cpu_ir[rb]); tcg_gen_ext32s_i64(cpu_ir[rc], cpu_ir[rc]); } } break; case 0x0B: /* S4SUBL */ if (likely(rc != 31)) { if (ra != 31) { TCGv tmp = tcg_temp_new(TCG_TYPE_I64); tcg_gen_shli_i64(tmp, cpu_ir[ra], 2); if (islit) tcg_gen_subi_i64(tmp, tmp, lit); else tcg_gen_sub_i64(tmp, tmp, cpu_ir[rb]); tcg_gen_ext32s_i64(cpu_ir[rc], tmp); tcg_temp_free(tmp); } else { if (islit) tcg_gen_movi_i64(cpu_ir[rc], -lit); else { tcg_gen_neg_i64(cpu_ir[rc], cpu_ir[rb]); tcg_gen_ext32s_i64(cpu_ir[rc], cpu_ir[rc]); } } } break; case 0x0F: /* CMPBGE */ gen_arith3(helper_cmpbge, ra, rb, rc, islit, lit); break; case 0x12: /* S8ADDL */ if (likely(rc != 31)) { if (ra != 31) { TCGv tmp = tcg_temp_new(TCG_TYPE_I64); tcg_gen_shli_i64(tmp, cpu_ir[ra], 3); if (islit) tcg_gen_addi_i64(tmp, tmp, lit); else tcg_gen_add_i64(tmp, tmp, cpu_ir[rb]); tcg_gen_ext32s_i64(cpu_ir[rc], tmp); tcg_temp_free(tmp); } else { if (islit) tcg_gen_movi_i64(cpu_ir[rc], lit); else tcg_gen_ext32s_i64(cpu_ir[rc], cpu_ir[rb]); } } break; case 0x1B: /* S8SUBL */ if (likely(rc != 31)) { if (ra != 31) { TCGv tmp = tcg_temp_new(TCG_TYPE_I64); tcg_gen_shli_i64(tmp, cpu_ir[ra], 3); if (islit) tcg_gen_subi_i64(tmp, tmp, lit); else tcg_gen_sub_i64(tmp, tmp, cpu_ir[rb]); tcg_gen_ext32s_i64(cpu_ir[rc], tmp); tcg_temp_free(tmp); } else { if (islit) tcg_gen_movi_i64(cpu_ir[rc], -lit); else tcg_gen_neg_i64(cpu_ir[rc], cpu_ir[rb]); tcg_gen_ext32s_i64(cpu_ir[rc], cpu_ir[rc]); } } } break; case 0x1D: /* CMPULT */ gen_cmp(TCG_COND_LTU, ra, rb, rc, islit, lit); break; case 0x20: /* ADDQ */ if (likely(rc != 31)) { if (ra != 31) { if (islit) tcg_gen_addi_i64(cpu_ir[rc], cpu_ir[ra], lit); else tcg_gen_add_i64(cpu_ir[rc], cpu_ir[ra], cpu_ir[rb]); } else { if (islit) tcg_gen_movi_i64(cpu_ir[rc], lit); else tcg_gen_mov_i64(cpu_ir[rc], cpu_ir[rb]); } } break; case 0x22: /* S4ADDQ */ if (likely(rc != 31)) { if (ra != 31) { TCGv tmp = tcg_temp_new(TCG_TYPE_I64); tcg_gen_shli_i64(tmp, cpu_ir[ra], 2); if (islit) tcg_gen_addi_i64(cpu_ir[rc], tmp, lit); else tcg_gen_add_i64(cpu_ir[rc], tmp, cpu_ir[rb]); tcg_temp_free(tmp); } else { if (islit) tcg_gen_movi_i64(cpu_ir[rc], lit); else tcg_gen_mov_i64(cpu_ir[rc], cpu_ir[rb]); } } break; case 0x29: /* SUBQ */ if (likely(rc != 31)) { if (ra != 31) { if (islit) tcg_gen_subi_i64(cpu_ir[rc], cpu_ir[ra], lit); else tcg_gen_sub_i64(cpu_ir[rc], cpu_ir[ra], cpu_ir[rb]); } else { if (islit) tcg_gen_movi_i64(cpu_ir[rc], -lit); else tcg_gen_neg_i64(cpu_ir[rc], cpu_ir[rb]); } } break; case 0x2B: /* S4SUBQ */ if (likely(rc != 31)) { if (ra != 31) { TCGv tmp = tcg_temp_new(TCG_TYPE_I64); tcg_gen_shli_i64(tmp, cpu_ir[ra], 2); if (islit) tcg_gen_subi_i64(cpu_ir[rc], tmp, lit); else tcg_gen_sub_i64(cpu_ir[rc], tmp, cpu_ir[rb]); tcg_temp_free(tmp); } else { if (islit) tcg_gen_movi_i64(cpu_ir[rc], -lit); else tcg_gen_neg_i64(cpu_ir[rc], cpu_ir[rb]); } } break; case 0x2D: /* CMPEQ */ gen_cmp(TCG_COND_EQ, ra, rb, rc, islit, lit); break; case 0x32: /* S8ADDQ */ if (likely(rc != 31)) { if (ra != 31) { TCGv tmp = tcg_temp_new(TCG_TYPE_I64); tcg_gen_shli_i64(tmp, cpu_ir[ra], 3); if (islit) tcg_gen_addi_i64(cpu_ir[rc], tmp, lit); else tcg_gen_add_i64(cpu_ir[rc], tmp, cpu_ir[rb]); tcg_temp_free(tmp); } else { if (islit) tcg_gen_movi_i64(cpu_ir[rc], lit); else tcg_gen_mov_i64(cpu_ir[rc], cpu_ir[rb]); } } break; case 0x3B: /* S8SUBQ */ if (likely(rc != 31)) { if (ra != 31) { TCGv tmp = tcg_temp_new(TCG_TYPE_I64); tcg_gen_shli_i64(tmp, cpu_ir[ra], 3); if (islit) tcg_gen_subi_i64(cpu_ir[rc], tmp, lit); else tcg_gen_sub_i64(cpu_ir[rc], tmp, cpu_ir[rb]); tcg_temp_free(tmp); } else { if (islit) tcg_gen_movi_i64(cpu_ir[rc], -lit); else tcg_gen_neg_i64(cpu_ir[rc], cpu_ir[rb]); } } break; case 0x3D: /* CMPULE */ gen_cmp(TCG_COND_LEU, ra, rb, rc, islit, lit); break; case 0x40: /* ADDL/V */ gen_arith3(helper_addlv, ra, rb, rc, islit, lit); break; case 0x49: /* SUBL/V */ gen_arith3(helper_sublv, ra, rb, rc, islit, lit); break; case 0x4D: /* CMPLT */ gen_cmp(TCG_COND_LT, ra, rb, rc, islit, lit); break; case 0x60: /* ADDQ/V */ gen_arith3(helper_addqv, ra, rb, rc, islit, lit); break; case 0x69: /* SUBQ/V */ gen_arith3(helper_subqv, ra, rb, rc, islit, lit); break; case 0x6D: /* CMPLE */ gen_cmp(TCG_COND_LE, ra, rb, rc, islit, lit); break; default: goto invalid_opc; } break; case 0x11: switch (fn7) { case 0x00: /* AND */ if (likely(rc != 31)) { if (ra == 31) tcg_gen_movi_i64(cpu_ir[rc], 0); else if (islit) tcg_gen_andi_i64(cpu_ir[rc], cpu_ir[ra], lit); else tcg_gen_and_i64(cpu_ir[rc], cpu_ir[ra], cpu_ir[rb]); } break; case 0x08: /* BIC */ if (likely(rc != 31)) { if (ra != 31) { if (islit) tcg_gen_andi_i64(cpu_ir[rc], cpu_ir[ra], ~lit); else tcg_gen_andc_i64(cpu_ir[rc], cpu_ir[ra], cpu_ir[rb]); } else tcg_gen_movi_i64(cpu_ir[rc], 0); } break; case 0x14: /* CMOVLBS */ gen_cmov(TCG_COND_EQ, ra, rb, rc, islit, lit, 1); break; case 0x16: /* CMOVLBC */ gen_cmov(TCG_COND_NE, ra, rb, rc, islit, lit, 1); break; case 0x20: /* BIS */ if (likely(rc != 31)) { if (ra != 31) { if (islit) tcg_gen_ori_i64(cpu_ir[rc], cpu_ir[ra], lit); else tcg_gen_or_i64(cpu_ir[rc], cpu_ir[ra], cpu_ir[rb]); } else { if (islit) tcg_gen_movi_i64(cpu_ir[rc], lit); else tcg_gen_mov_i64(cpu_ir[rc], cpu_ir[rb]); } } break; case 0x24: /* CMOVEQ */ gen_cmov(TCG_COND_NE, ra, rb, rc, islit, lit, 0); break; case 0x26: /* CMOVNE */ gen_cmov(TCG_COND_EQ, ra, rb, rc, islit, lit, 0); break; case 0x28: /* ORNOT */ if (likely(rc != 31)) { if (ra != 31) { if (islit) tcg_gen_ori_i64(cpu_ir[rc], cpu_ir[ra], ~lit); else tcg_gen_orc_i64(cpu_ir[rc], cpu_ir[ra], cpu_ir[rb]); } else { if (islit) tcg_gen_movi_i64(cpu_ir[rc], ~lit); else tcg_gen_not_i64(cpu_ir[rc], cpu_ir[rb]); } } break; case 0x40: /* XOR */ if (likely(rc != 31)) { if (ra != 31) { if (islit) tcg_gen_xori_i64(cpu_ir[rc], cpu_ir[ra], lit); else tcg_gen_xor_i64(cpu_ir[rc], cpu_ir[ra], cpu_ir[rb]); } else { if (islit) tcg_gen_movi_i64(cpu_ir[rc], lit); else tcg_gen_mov_i64(cpu_ir[rc], cpu_ir[rb]); } } break; case 0x44: /* CMOVLT */ gen_cmov(TCG_COND_GE, ra, rb, rc, islit, lit, 0); break; case 0x46: /* CMOVGE */ gen_cmov(TCG_COND_LT, ra, rb, rc, islit, lit, 0); break; case 0x48: /* EQV */ if (likely(rc != 31)) { if (ra != 31) { if (islit) tcg_gen_xori_i64(cpu_ir[rc], cpu_ir[ra], ~lit); else tcg_gen_eqv_i64(cpu_ir[rc], cpu_ir[ra], cpu_ir[rb]); } else { if (islit) tcg_gen_movi_i64(cpu_ir[rc], ~lit); else tcg_gen_not_i64(cpu_ir[rc], cpu_ir[rb]); } } break; case 0x61: /* AMASK */ if (likely(rc != 31)) { if (islit) tcg_gen_movi_i64(cpu_ir[rc], helper_amask(lit)); else tcg_gen_helper_1_1(helper_amask, cpu_ir[rc], cpu_ir[rb]); } break; case 0x64: /* CMOVLE */ gen_cmov(TCG_COND_GT, ra, rb, rc, islit, lit, 0); break; case 0x66: /* CMOVGT */ gen_cmov(TCG_COND_LE, ra, rb, rc, islit, lit, 0); break; case 0x6C: /* IMPLVER */ if (rc != 31) tcg_gen_helper_1_0(helper_load_implver, cpu_ir[rc]); break; default: goto invalid_opc; } break; case 0x12: switch (fn7) { case 0x02: /* MSKBL */ gen_arith3(helper_mskbl, ra, rb, rc, islit, lit); break; case 0x06: /* EXTBL */ gen_ext_l(&tcg_gen_ext8u_i64, ra, rb, rc, islit, lit); break; case 0x0B: /* INSBL */ gen_arith3(helper_insbl, ra, rb, rc, islit, lit); break; case 0x12: /* MSKWL */ gen_arith3(helper_mskwl, ra, rb, rc, islit, lit); break; case 0x16: /* EXTWL */ gen_ext_l(&tcg_gen_ext16u_i64, ra, rb, rc, islit, lit); break; case 0x1B: /* INSWL */ gen_arith3(helper_inswl, ra, rb, rc, islit, lit); break; case 0x22: /* MSKLL */ gen_arith3(helper_mskll, ra, rb, rc, islit, lit); break; case 0x26: /* EXTLL */ gen_ext_l(&tcg_gen_ext32u_i64, ra, rb, rc, islit, lit); break; case 0x2B: /* INSLL */ gen_arith3(helper_insll, ra, rb, rc, islit, lit); break; case 0x30: /* ZAP */ gen_arith3(helper_zap, ra, rb, rc, islit, lit); break; case 0x31: /* ZAPNOT */ gen_arith3(helper_zapnot, ra, rb, rc, islit, lit); break; case 0x32: /* MSKQL */ gen_arith3(helper_mskql, ra, rb, rc, islit, lit); break; case 0x34: /* SRL */ if (likely(rc != 31)) { if (ra != 31) { if (islit) tcg_gen_shri_i64(cpu_ir[rc], cpu_ir[ra], lit & 0x3f); else { TCGv shift = tcg_temp_new(TCG_TYPE_I64); tcg_gen_andi_i64(shift, cpu_ir[rb], 0x3f); tcg_gen_shr_i64(cpu_ir[rc], cpu_ir[ra], shift); tcg_temp_free(shift); } } else tcg_gen_movi_i64(cpu_ir[rc], 0); } break; case 0x36: /* EXTQL */ gen_ext_l(NULL, ra, rb, rc, islit, lit); break; case 0x39: /* SLL */ if (likely(rc != 31)) { if (ra != 31) { if (islit) tcg_gen_shli_i64(cpu_ir[rc], cpu_ir[ra], lit & 0x3f); else { TCGv shift = tcg_temp_new(TCG_TYPE_I64); tcg_gen_andi_i64(shift, cpu_ir[rb], 0x3f); tcg_gen_shl_i64(cpu_ir[rc], cpu_ir[ra], shift); tcg_temp_free(shift); } } else tcg_gen_movi_i64(cpu_ir[rc], 0); } break; case 0x3B: /* INSQL */ gen_arith3(helper_insql, ra, rb, rc, islit, lit); break; case 0x3C: /* SRA */ if (likely(rc != 31)) { if (ra != 31) { if (islit) tcg_gen_sari_i64(cpu_ir[rc], cpu_ir[ra], lit & 0x3f); else { TCGv shift = tcg_temp_new(TCG_TYPE_I64); tcg_gen_andi_i64(shift, cpu_ir[rb], 0x3f); tcg_gen_sar_i64(cpu_ir[rc], cpu_ir[ra], shift); tcg_temp_free(shift); } } else tcg_gen_movi_i64(cpu_ir[rc], 0); } break; case 0x52: /* MSKWH */ gen_arith3(helper_mskwh, ra, rb, rc, islit, lit); break; case 0x57: /* INSWH */ gen_arith3(helper_inswh, ra, rb, rc, islit, lit); break; case 0x5A: /* EXTWH */ gen_ext_h(&tcg_gen_ext16u_i64, ra, rb, rc, islit, lit); break; case 0x62: /* MSKLH */ gen_arith3(helper_msklh, ra, rb, rc, islit, lit); break; case 0x67: /* INSLH */ gen_arith3(helper_inslh, ra, rb, rc, islit, lit); break; case 0x6A: /* EXTLH */ gen_ext_h(&tcg_gen_ext16u_i64, ra, rb, rc, islit, lit); break; case 0x72: /* MSKQH */ gen_arith3(helper_mskqh, ra, rb, rc, islit, lit); break; case 0x77: /* INSQH */ gen_arith3(helper_insqh, ra, rb, rc, islit, lit); break; case 0x7A: /* EXTQH */ gen_ext_h(NULL, ra, rb, rc, islit, lit); break; default: goto invalid_opc; } break; case 0x13: switch (fn7) { case 0x00: /* MULL */ if (likely(rc != 31)) { if (ra == 31) tcg_gen_movi_i64(cpu_ir[rc], 0); else { if (islit) tcg_gen_muli_i64(cpu_ir[rc], cpu_ir[ra], lit); else tcg_gen_mul_i64(cpu_ir[rc], cpu_ir[ra], cpu_ir[rb]); tcg_gen_ext32s_i64(cpu_ir[rc], cpu_ir[rc]); } } break; case 0x20: /* MULQ */ if (likely(rc != 31)) { if (ra == 31) tcg_gen_movi_i64(cpu_ir[rc], 0); else if (islit) tcg_gen_muli_i64(cpu_ir[rc], cpu_ir[ra], lit); else tcg_gen_mul_i64(cpu_ir[rc], cpu_ir[ra], cpu_ir[rb]); } break; case 0x30: /* UMULH */ gen_arith3(helper_umulh, ra, rb, rc, islit, lit); break; case 0x40: /* MULL/V */ gen_arith3(helper_mullv, ra, rb, rc, islit, lit); break; case 0x60: /* MULQ/V */ gen_arith3(helper_mulqv, ra, rb, rc, islit, lit); break; default: goto invalid_opc; } break; case 0x14: switch (fpfn) { /* f11 & 0x3F */ case 0x04: /* ITOFS */ if (!(ctx->amask & AMASK_FIX)) goto invalid_opc; if (likely(rc != 31)) { if (ra != 31) { TCGv tmp = tcg_temp_new(TCG_TYPE_I32); tcg_gen_trunc_i64_i32(tmp, cpu_ir[ra]); tcg_gen_helper_1_1(helper_memory_to_s, cpu_fir[rc], tmp); tcg_temp_free(tmp); } else tcg_gen_movi_i64(cpu_fir[rc], 0); } break; case 0x0A: /* SQRTF */ if (!(ctx->amask & AMASK_FIX)) goto invalid_opc; gen_farith2(&helper_sqrtf, rb, rc); break; case 0x0B: /* SQRTS */ if (!(ctx->amask & AMASK_FIX)) goto invalid_opc; gen_farith2(&helper_sqrts, rb, rc); break; case 0x14: /* ITOFF */ if (!(ctx->amask & AMASK_FIX)) goto invalid_opc; if (likely(rc != 31)) { if (ra != 31) { TCGv tmp = tcg_temp_new(TCG_TYPE_I32); tcg_gen_trunc_i64_i32(tmp, cpu_ir[ra]); tcg_gen_helper_1_1(helper_memory_to_f, cpu_fir[rc], tmp); tcg_temp_free(tmp); } else tcg_gen_movi_i64(cpu_fir[rc], 0); } break; case 0x24: /* ITOFT */ if (!(ctx->amask & AMASK_FIX)) goto invalid_opc; if (likely(rc != 31)) { if (ra != 31) tcg_gen_mov_i64(cpu_fir[rc], cpu_ir[ra]); else tcg_gen_movi_i64(cpu_fir[rc], 0); } break; case 0x2A: /* SQRTG */ if (!(ctx->amask & AMASK_FIX)) goto invalid_opc; gen_farith2(&helper_sqrtg, rb, rc); break; case 0x02B: /* SQRTT */ if (!(ctx->amask & AMASK_FIX)) goto invalid_opc; gen_farith2(&helper_sqrtt, rb, rc); break; default: goto invalid_opc; } break; case 0x15: /* VAX floating point */ /* XXX: rounding mode and trap are ignored (!) */ switch (fpfn) { /* f11 & 0x3F */ case 0x00: /* ADDF */ gen_farith3(&helper_addf, ra, rb, rc); break; case 0x01: /* SUBF */ gen_farith3(&helper_subf, ra, rb, rc); break; case 0x02: /* MULF */ gen_farith3(&helper_mulf, ra, rb, rc); break; case 0x03: /* DIVF */ gen_farith3(&helper_divf, ra, rb, rc); break; case 0x1E: /* CVTDG */ #if 0 // TODO gen_farith2(&helper_cvtdg, rb, rc); #else goto invalid_opc; #endif break; case 0x20: /* ADDG */ gen_farith3(&helper_addg, ra, rb, rc); break; case 0x21: /* SUBG */ gen_farith3(&helper_subg, ra, rb, rc); break; case 0x22: /* MULG */ gen_farith3(&helper_mulg, ra, rb, rc); break; case 0x23: /* DIVG */ gen_farith3(&helper_divg, ra, rb, rc); break; case 0x25: /* CMPGEQ */ gen_farith3(&helper_cmpgeq, ra, rb, rc); break; case 0x26: /* CMPGLT */ gen_farith3(&helper_cmpglt, ra, rb, rc); break; case 0x27: /* CMPGLE */ gen_farith3(&helper_cmpgle, ra, rb, rc); break; case 0x2C: /* CVTGF */ gen_farith2(&helper_cvtgf, rb, rc); break; case 0x2D: /* CVTGD */ #if 0 // TODO gen_farith2(ctx, &helper_cvtgd, rb, rc); #else goto invalid_opc; #endif break; case 0x2F: /* CVTGQ */ gen_farith2(&helper_cvtgq, rb, rc); break; case 0x3C: /* CVTQF */ gen_farith2(&helper_cvtqf, rb, rc); break; case 0x3E: /* CVTQG */ gen_farith2(&helper_cvtqg, rb, rc); break; default: goto invalid_opc; } break; case 0x16: /* IEEE floating-point */ /* XXX: rounding mode and traps are ignored (!) */ switch (fpfn) { /* f11 & 0x3F */ case 0x00: /* ADDS */ gen_farith3(&helper_adds, ra, rb, rc); break; case 0x01: /* SUBS */ gen_farith3(&helper_subs, ra, rb, rc); break; case 0x02: /* MULS */ gen_farith3(&helper_muls, ra, rb, rc); break; case 0x03: /* DIVS */ gen_farith3(&helper_divs, ra, rb, rc); break; case 0x20: /* ADDT */ gen_farith3(&helper_addt, ra, rb, rc); break; case 0x21: /* SUBT */ gen_farith3(&helper_subt, ra, rb, rc); break; case 0x22: /* MULT */ gen_farith3(&helper_mult, ra, rb, rc); break; case 0x23: /* DIVT */ gen_farith3(&helper_divt, ra, rb, rc); break; case 0x24: /* CMPTUN */ gen_farith3(&helper_cmptun, ra, rb, rc); break; case 0x25: /* CMPTEQ */ gen_farith3(&helper_cmpteq, ra, rb, rc); break; case 0x26: /* CMPTLT */ gen_farith3(&helper_cmptlt, ra, rb, rc); break; case 0x27: /* CMPTLE */ gen_farith3(&helper_cmptle, ra, rb, rc); break; case 0x2C: /* XXX: incorrect */ if (fn11 == 0x2AC) { /* CVTST */ gen_farith2(&helper_cvtst, rb, rc); } else { /* CVTTS */ gen_farith2(&helper_cvtts, rb, rc); } break; case 0x2F: /* CVTTQ */ gen_farith2(&helper_cvttq, rb, rc); break; case 0x3C: /* CVTQS */ gen_farith2(&helper_cvtqs, rb, rc); break; case 0x3E: /* CVTQT */ gen_farith2(&helper_cvtqt, rb, rc); break; default: goto invalid_opc; } break; case 0x17: switch (fn11) { case 0x010: /* CVTLQ */ gen_farith2(&helper_cvtlq, rb, rc); break; case 0x020: if (likely(rc != 31)) { if (ra == rb) /* FMOV */ tcg_gen_mov_i64(cpu_fir[rc], cpu_fir[ra]); else /* CPYS */ gen_farith3(&helper_cpys, ra, rb, rc); } break; case 0x021: /* CPYSN */ gen_farith3(&helper_cpysn, ra, rb, rc); break; case 0x022: /* CPYSE */ gen_farith3(&helper_cpyse, ra, rb, rc); break; case 0x024: /* MT_FPCR */ if (likely(ra != 31)) tcg_gen_helper_0_1(helper_store_fpcr, cpu_fir[ra]); else { TCGv tmp = tcg_const_i64(0); tcg_gen_helper_0_1(helper_store_fpcr, tmp); tcg_temp_free(tmp); } break; case 0x025: /* MF_FPCR */ if (likely(ra != 31)) tcg_gen_helper_1_0(helper_load_fpcr, cpu_fir[ra]); break; case 0x02A: /* FCMOVEQ */ gen_fcmov(&helper_cmpfeq, ra, rb, rc); break; case 0x02B: /* FCMOVNE */ gen_fcmov(&helper_cmpfne, ra, rb, rc); break; case 0x02C: /* FCMOVLT */ gen_fcmov(&helper_cmpflt, ra, rb, rc); break; case 0x02D: /* FCMOVGE */ gen_fcmov(&helper_cmpfge, ra, rb, rc); break; case 0x02E: /* FCMOVLE */ gen_fcmov(&helper_cmpfle, ra, rb, rc); break; case 0x02F: /* FCMOVGT */ gen_fcmov(&helper_cmpfgt, ra, rb, rc); break; case 0x030: /* CVTQL */ gen_farith2(&helper_cvtql, rb, rc); break; case 0x130: /* CVTQL/V */ gen_farith2(&helper_cvtqlv, rb, rc); break; case 0x530: /* CVTQL/SV */ gen_farith2(&helper_cvtqlsv, rb, rc); break; default: goto invalid_opc; } break; case 0x18: switch ((uint16_t)disp16) { case 0x0000: /* TRAPB */ /* No-op. Just exit from the current tb */ ret = 2; break; case 0x0400: /* EXCB */ /* No-op. Just exit from the current tb */ ret = 2; break; case 0x4000: /* MB */ /* No-op */ break; case 0x4400: /* WMB */ /* No-op */ break; case 0x8000: /* FETCH */ /* No-op */ break; case 0xA000: /* FETCH_M */ /* No-op */ break; case 0xC000: /* RPCC */ if (ra != 31) tcg_gen_helper_1_0(helper_load_pcc, cpu_ir[ra]); break; case 0xE000: /* RC */ if (ra != 31) tcg_gen_helper_1_0(helper_rc, cpu_ir[ra]); break; case 0xE800: /* ECB */ /* XXX: TODO: evict tb cache at address rb */ #if 0 ret = 2; #else goto invalid_opc; #endif break; case 0xF000: /* RS */ if (ra != 31) tcg_gen_helper_1_0(helper_rs, cpu_ir[ra]); break; case 0xF800: /* WH64 */ /* No-op */ break; default: goto invalid_opc; } break; case 0x19: /* HW_MFPR (PALcode) */ #if defined (CONFIG_USER_ONLY) goto invalid_opc; #else if (!ctx->pal_mode) goto invalid_opc; if (ra != 31) { TCGv tmp = tcg_const_i32(insn & 0xFF); tcg_gen_helper_1_2(helper_mfpr, cpu_ir[ra], tmp, cpu_ir[ra]); tcg_temp_free(tmp); } break; #endif case 0x1A: if (ra != 31) tcg_gen_movi_i64(cpu_ir[ra], ctx->pc); if (rb != 31) tcg_gen_andi_i64(cpu_pc, cpu_ir[rb], ~3); else tcg_gen_movi_i64(cpu_pc, 0); /* Those four jumps only differ by the branch prediction hint */ switch (fn2) { case 0x0: /* JMP */ break; case 0x1: /* JSR */ break; case 0x2: /* RET */ break; case 0x3: /* JSR_COROUTINE */ break; } ret = 1; break; case 0x1B: /* HW_LD (PALcode) */ #if defined (CONFIG_USER_ONLY) goto invalid_opc; #else if (!ctx->pal_mode) goto invalid_opc; if (ra != 31) { TCGv addr = tcg_temp_new(TCG_TYPE_I64); if (rb != 31) tcg_gen_addi_i64(addr, cpu_ir[rb], disp12); else tcg_gen_movi_i64(addr, disp12); switch ((insn >> 12) & 0xF) { case 0x0: /* Longword physical access */ tcg_gen_helper_0_2(helper_ldl_raw, cpu_ir[ra], addr); break; case 0x1: /* Quadword physical access */ tcg_gen_helper_0_2(helper_ldq_raw, cpu_ir[ra], addr); break; case 0x2: /* Longword physical access with lock */ tcg_gen_helper_0_2(helper_ldl_l_raw, cpu_ir[ra], addr); break; case 0x3: /* Quadword physical access with lock */ tcg_gen_helper_0_2(helper_ldq_l_raw, cpu_ir[ra], addr); break; case 0x4: /* Longword virtual PTE fetch */ tcg_gen_helper_0_2(helper_ldl_kernel, cpu_ir[ra], addr); break; case 0x5: /* Quadword virtual PTE fetch */ tcg_gen_helper_0_2(helper_ldq_kernel, cpu_ir[ra], addr); break; case 0x6: /* Incpu_ir[ra]id */ goto incpu_ir[ra]id_opc; case 0x7: /* Incpu_ir[ra]id */ goto incpu_ir[ra]id_opc; case 0x8: /* Longword virtual access */ tcg_gen_helper_1_1(helper_st_virt_to_phys, addr, addr); tcg_gen_helper_0_2(helper_ldl_raw, cpu_ir[ra], addr); break; case 0x9: /* Quadword virtual access */ tcg_gen_helper_1_1(helper_st_virt_to_phys, addr, addr); tcg_gen_helper_0_2(helper_ldq_raw, cpu_ir[ra], addr); break; case 0xA: /* Longword virtual access with protection check */ tcg_gen_qemu_ld32s(cpu_ir[ra], addr, ctx->flags); break; case 0xB: /* Quadword virtual access with protection check */ tcg_gen_qemu_ld64(cpu_ir[ra], addr, ctx->flags); break; case 0xC: /* Longword virtual access with altenate access mode */ tcg_gen_helper_0_0(helper_set_alt_mode); tcg_gen_helper_1_1(helper_st_virt_to_phys, addr, addr); tcg_gen_helper_0_2(helper_ldl_raw, cpu_ir[ra], addr); tcg_gen_helper_0_0(helper_restore_mode); break; case 0xD: /* Quadword virtual access with altenate access mode */ tcg_gen_helper_0_0(helper_set_alt_mode); tcg_gen_helper_1_1(helper_st_virt_to_phys, addr, addr); tcg_gen_helper_0_2(helper_ldq_raw, cpu_ir[ra], addr); tcg_gen_helper_0_0(helper_restore_mode); break; case 0xE: /* Longword virtual access with alternate access mode and * protection checks */ tcg_gen_helper_0_0(helper_set_alt_mode); tcg_gen_helper_0_2(helper_ldl_data, cpu_ir[ra], addr); tcg_gen_helper_0_0(helper_restore_mode); break; case 0xF: /* Quadword virtual access with alternate access mode and * protection checks */ tcg_gen_helper_0_0(helper_set_alt_mode); tcg_gen_helper_0_2(helper_ldq_data, cpu_ir[ra], addr); tcg_gen_helper_0_0(helper_restore_mode); break; } tcg_temp_free(addr); } break; #endif case 0x1C: switch (fn7) { case 0x00: /* SEXTB */ if (!(ctx->amask & AMASK_BWX)) goto invalid_opc; if (likely(rc != 31)) { if (islit) tcg_gen_movi_i64(cpu_ir[rc], (int64_t)((int8_t)lit)); else tcg_gen_ext8s_i64(cpu_ir[rc], cpu_ir[rb]); } break; case 0x01: /* SEXTW */ if (!(ctx->amask & AMASK_BWX)) goto invalid_opc; if (likely(rc != 31)) { if (islit) tcg_gen_movi_i64(cpu_ir[rc], (int64_t)((int16_t)lit)); else tcg_gen_ext16s_i64(cpu_ir[rc], cpu_ir[rb]); } break; case 0x30: /* CTPOP */ if (!(ctx->amask & AMASK_CIX)) goto invalid_opc; if (likely(rc != 31)) { if (islit) tcg_gen_movi_i64(cpu_ir[rc], ctpop64(lit)); else tcg_gen_helper_1_1(helper_ctpop, cpu_ir[rc], cpu_ir[rb]); } break; case 0x31: /* PERR */ if (!(ctx->amask & AMASK_MVI)) goto invalid_opc; /* XXX: TODO */ goto invalid_opc; break; case 0x32: /* CTLZ */ if (!(ctx->amask & AMASK_CIX)) goto invalid_opc; if (likely(rc != 31)) { if (islit) tcg_gen_movi_i64(cpu_ir[rc], clz64(lit)); else tcg_gen_helper_1_1(helper_ctlz, cpu_ir[rc], cpu_ir[rb]); } break; case 0x33: /* CTTZ */ if (!(ctx->amask & AMASK_CIX)) goto invalid_opc; if (likely(rc != 31)) { if (islit) tcg_gen_movi_i64(cpu_ir[rc], ctz64(lit)); else tcg_gen_helper_1_1(helper_cttz, cpu_ir[rc], cpu_ir[rb]); } break; case 0x34: /* UNPKBW */ if (!(ctx->amask & AMASK_MVI)) goto invalid_opc; /* XXX: TODO */ goto invalid_opc; break; case 0x35: /* UNPKWL */ if (!(ctx->amask & AMASK_MVI)) goto invalid_opc; /* XXX: TODO */ goto invalid_opc; break; case 0x36: /* PKWB */ if (!(ctx->amask & AMASK_MVI)) goto invalid_opc; /* XXX: TODO */ goto invalid_opc; break; case 0x37: /* PKLB */ if (!(ctx->amask & AMASK_MVI)) goto invalid_opc; /* XXX: TODO */ goto invalid_opc; break; case 0x38: /* MINSB8 */ if (!(ctx->amask & AMASK_MVI)) goto invalid_opc; /* XXX: TODO */ goto invalid_opc; break; case 0x39: /* MINSW4 */ if (!(ctx->amask & AMASK_MVI)) goto invalid_opc; /* XXX: TODO */ goto invalid_opc; break; case 0x3A: /* MINUB8 */ if (!(ctx->amask & AMASK_MVI)) goto invalid_opc; /* XXX: TODO */ goto invalid_opc; break; case 0x3B: /* MINUW4 */ if (!(ctx->amask & AMASK_MVI)) goto invalid_opc; /* XXX: TODO */ goto invalid_opc; break; case 0x3C: /* MAXUB8 */ if (!(ctx->amask & AMASK_MVI)) goto invalid_opc; /* XXX: TODO */ goto invalid_opc; break; case 0x3D: /* MAXUW4 */ if (!(ctx->amask & AMASK_MVI)) goto invalid_opc; /* XXX: TODO */ goto invalid_opc; break; case 0x3E: /* MAXSB8 */ if (!(ctx->amask & AMASK_MVI)) goto invalid_opc; /* XXX: TODO */ goto invalid_opc; break; case 0x3F: /* MAXSW4 */ if (!(ctx->amask & AMASK_MVI)) goto invalid_opc; /* XXX: TODO */ goto invalid_opc; break; case 0x70: /* FTOIT */ if (!(ctx->amask & AMASK_FIX)) goto invalid_opc; if (likely(rc != 31)) { if (ra != 31) tcg_gen_mov_i64(cpu_ir[rc], cpu_fir[ra]); else tcg_gen_movi_i64(cpu_ir[rc], 0); } break; case 0x78: /* FTOIS */ if (!(ctx->amask & AMASK_FIX)) goto invalid_opc; if (rc != 31) { TCGv tmp1 = tcg_temp_new(TCG_TYPE_I32); if (ra != 31) tcg_gen_helper_1_1(helper_s_to_memory, tmp1, cpu_fir[ra]); else { TCGv tmp2 = tcg_const_i64(0); tcg_gen_helper_1_1(helper_s_to_memory, tmp1, tmp2); tcg_temp_free(tmp2); } tcg_gen_ext_i32_i64(cpu_ir[rc], tmp1); tcg_temp_free(tmp1); } break; default: goto invalid_opc; } break; case 0x1D: /* HW_MTPR (PALcode) */ #if defined (CONFIG_USER_ONLY) goto invalid_opc; #else if (!ctx->pal_mode) goto invalid_opc; else { TCGv tmp1 = tcg_const_i32(insn & 0xFF); if (ra != 31) tcg_gen_helper(helper_mtpr, tmp1, cpu_ir[ra]); else { TCGv tmp2 = tcg_const_i64(0); tcg_gen_helper(helper_mtpr, tmp1, tmp2); tcg_temp_free(tmp2); } tcg_temp_free(tmp1); ret = 2; } break; #endif case 0x1E: /* HW_REI (PALcode) */ #if defined (CONFIG_USER_ONLY) goto invalid_opc; #else if (!ctx->pal_mode) goto invalid_opc; if (rb == 31) { /* "Old" alpha */ tcg_gen_helper_0_0(helper_hw_rei); } else { TCGv tmp; if (ra != 31) { tmp = tcg_temp_new(TCG_TYPE_I64); tcg_gen_addi_i64(tmp, cpu_ir[rb], (((int64_t)insn << 51) >> 51)); } else tmp = tcg_const_i64(((int64_t)insn << 51) >> 51); tcg_gen_helper_0_1(helper_hw_ret, tmp); tcg_temp_free(tmp); } ret = 2; break; #endif case 0x1F: /* HW_ST (PALcode) */ #if defined (CONFIG_USER_ONLY) goto invalid_opc; #else if (!ctx->pal_mode) goto invalid_opc; else { TCGv addr, val; addr = tcg_temp_new(TCG_TYPE_I64); if (rb != 31) tcg_gen_addi_i64(addr, cpu_ir[rb], disp12); else tcg_gen_movi_i64(addr, disp12); if (ra != 31) val = cpu_ir[ra]; else { val = tcg_temp_new(TCG_TYPE_I64); tcg_gen_movi_i64(val, 0); } switch ((insn >> 12) & 0xF) { case 0x0: /* Longword physical access */ tcg_gen_helper_0_2(helper_stl_raw, val, addr); break; case 0x1: /* Quadword physical access */ tcg_gen_helper_0_2(helper_stq_raw, val, addr); break; case 0x2: /* Longword physical access with lock */ tcg_gen_helper_1_2(helper_stl_c_raw, val, val, addr); break; case 0x3: /* Quadword physical access with lock */ tcg_gen_helper_1_2(helper_stq_c_raw, val, val, addr); break; case 0x4: /* Longword virtual access */ tcg_gen_helper_1_1(helper_st_virt_to_phys, addr, addr); tcg_gen_helper_0_2(helper_stl_raw, val, addr); break; case 0x5: /* Quadword virtual access */ tcg_gen_helper_1_1(helper_st_virt_to_phys, addr, addr); tcg_gen_helper_0_2(helper_stq_raw, val, addr); break; case 0x6: /* Invalid */ goto invalid_opc; case 0x7: /* Invalid */ goto invalid_opc; case 0x8: /* Invalid */ goto invalid_opc; case 0x9: /* Invalid */ goto invalid_opc; case 0xA: /* Invalid */ goto invalid_opc; case 0xB: /* Invalid */ goto invalid_opc; case 0xC: /* Longword virtual access with alternate access mode */ tcg_gen_helper_0_0(helper_set_alt_mode); tcg_gen_helper_1_1(helper_st_virt_to_phys, addr, addr); tcg_gen_helper_0_2(helper_stl_raw, val, addr); tcg_gen_helper_0_0(helper_restore_mode); break; case 0xD: /* Quadword virtual access with alternate access mode */ tcg_gen_helper_0_0(helper_set_alt_mode); tcg_gen_helper_1_1(helper_st_virt_to_phys, addr, addr); tcg_gen_helper_0_2(helper_stl_raw, val, addr); tcg_gen_helper_0_0(helper_restore_mode); break; case 0xE: /* Invalid */ goto invalid_opc; case 0xF: /* Invalid */ goto invalid_opc; } if (ra != 31) tcg_temp_free(val); tcg_temp_free(addr); } ret = 2; break; #endif case 0x20: /* LDF */ gen_load_mem(ctx, &gen_qemu_ldf, ra, rb, disp16, 1, 0); break; case 0x21: /* LDG */ gen_load_mem(ctx, &gen_qemu_ldg, ra, rb, disp16, 1, 0); break; case 0x22: /* LDS */ gen_load_mem(ctx, &gen_qemu_lds, ra, rb, disp16, 1, 0); break; case 0x23: /* LDT */ gen_load_mem(ctx, &tcg_gen_qemu_ld64, ra, rb, disp16, 1, 0); break; case 0x24: /* STF */ gen_store_mem(ctx, &gen_qemu_stf, ra, rb, disp16, 1, 0); break; case 0x25: /* STG */ gen_store_mem(ctx, &gen_qemu_stg, ra, rb, disp16, 1, 0); break; case 0x26: /* STS */ gen_store_mem(ctx, &gen_qemu_sts, ra, rb, disp16, 1, 0); break; case 0x27: /* STT */ gen_store_mem(ctx, &tcg_gen_qemu_st64, ra, rb, disp16, 1, 0); break; case 0x28: /* LDL */ gen_load_mem(ctx, &tcg_gen_qemu_ld32s, ra, rb, disp16, 0, 0); break; case 0x29: /* LDQ */ gen_load_mem(ctx, &tcg_gen_qemu_ld64, ra, rb, disp16, 0, 0); break; case 0x2A: /* LDL_L */ gen_load_mem(ctx, &gen_qemu_ldl_l, ra, rb, disp16, 0, 0); break; case 0x2B: /* LDQ_L */ gen_load_mem(ctx, &gen_qemu_ldq_l, ra, rb, disp16, 0, 0); break; case 0x2C: /* STL */ gen_store_mem(ctx, &tcg_gen_qemu_st32, ra, rb, disp16, 0, 0); break; case 0x2D: /* STQ */ gen_store_mem(ctx, &tcg_gen_qemu_st64, ra, rb, disp16, 0, 0); break; case 0x2E: /* STL_C */ gen_store_mem(ctx, &gen_qemu_stl_c, ra, rb, disp16, 0, 0); break; case 0x2F: /* STQ_C */ gen_store_mem(ctx, &gen_qemu_stq_c, ra, rb, disp16, 0, 0); break; case 0x30: /* BR */ if (ra != 31) tcg_gen_movi_i64(cpu_ir[ra], ctx->pc); tcg_gen_movi_i64(cpu_pc, ctx->pc + (int64_t)(disp21 << 2)); ret = 1; break; case 0x31: /* FBEQ */ gen_fbcond(ctx, &helper_cmpfeq, ra, disp16); ret = 1; break; case 0x32: /* FBLT */ gen_fbcond(ctx, &helper_cmpflt, ra, disp16); ret = 1; break; case 0x33: /* FBLE */ gen_fbcond(ctx, &helper_cmpfle, ra, disp16); ret = 1; break; case 0x34: /* BSR */ if (ra != 31) tcg_gen_movi_i64(cpu_ir[ra], ctx->pc); tcg_gen_movi_i64(cpu_pc, ctx->pc + (int64_t)(disp21 << 2)); ret = 1; break; case 0x35: /* FBNE */ gen_fbcond(ctx, &helper_cmpfne, ra, disp16); ret = 1; break; case 0x36: /* FBGE */ gen_fbcond(ctx, &helper_cmpfge, ra, disp16); ret = 1; break; case 0x37: /* FBGT */ gen_fbcond(ctx, &helper_cmpfgt, ra, disp16); ret = 1; break; case 0x38: /* BLBC */ gen_bcond(ctx, TCG_COND_EQ, ra, disp16, 1); ret = 1; break; case 0x39: /* BEQ */ gen_bcond(ctx, TCG_COND_EQ, ra, disp16, 0); ret = 1; break; case 0x3A: /* BLT */ gen_bcond(ctx, TCG_COND_LT, ra, disp16, 0); ret = 1; break; case 0x3B: /* BLE */ gen_bcond(ctx, TCG_COND_LE, ra, disp16, 0); ret = 1; break; case 0x3C: /* BLBS */ gen_bcond(ctx, TCG_COND_NE, ra, disp16, 1); ret = 1; break; case 0x3D: /* BNE */ gen_bcond(ctx, TCG_COND_NE, ra, disp16, 0); ret = 1; break; case 0x3E: /* BGE */ gen_bcond(ctx, TCG_COND_GE, ra, disp16, 0); ret = 1; break; case 0x3F: /* BGT */ gen_bcond(ctx, TCG_COND_GT, ra, disp16, 0); ret = 1; break; invalid_opc: gen_invalid(ctx); ret = 3; break; } return ret; }
true
qemu
1304ca878a4e091c193bd4ae273e0b5cb6142237
static always_inline int translate_one (DisasContext *ctx, uint32_t insn) { uint32_t palcode; int32_t disp21, disp16, disp12; uint16_t fn11, fn16; uint8_t opc, ra, rb, rc, sbz, fpfn, fn7, fn2, islit; uint8_t lit; int ret; opc = insn >> 26; ra = (insn >> 21) & 0x1F; rb = (insn >> 16) & 0x1F; rc = insn & 0x1F; sbz = (insn >> 13) & 0x07; islit = (insn >> 12) & 1; if (rb == 31 && !islit) { islit = 1; lit = 0; } else lit = (insn >> 13) & 0xFF; palcode = insn & 0x03FFFFFF; disp21 = ((int32_t)((insn & 0x001FFFFF) << 11)) >> 11; disp16 = (int16_t)(insn & 0x0000FFFF); disp12 = (int32_t)((insn & 0x00000FFF) << 20) >> 20; fn16 = insn & 0x0000FFFF; fn11 = (insn >> 5) & 0x000007FF; fpfn = fn11 & 0x3F; fn7 = (insn >> 5) & 0x0000007F; fn2 = (insn >> 5) & 0x00000003; ret = 0; #if defined ALPHA_DEBUG_DISAS if (logfile != NULL) { fprintf(logfile, "opc %02x ra %d rb %d rc %d disp16 %04x\n", opc, ra, rb, rc, disp16); } #endif switch (opc) { case 0x00: if (palcode >= 0x80 && palcode < 0xC0) { gen_excp(ctx, EXCP_CALL_PAL + ((palcode & 0x1F) << 6), 0); #if !defined (CONFIG_USER_ONLY) } else if (palcode < 0x40) { if (ctx->mem_idx & 1) goto invalid_opc; else gen_excp(ctx, EXCP_CALL_PALP + ((palcode & 0x1F) << 6), 0); #endif } else { goto invalid_opc; } ret = 3; break; case 0x01: goto invalid_opc; case 0x02: goto invalid_opc; case 0x03: goto invalid_opc; case 0x04: goto invalid_opc; case 0x05: goto invalid_opc; case 0x06: goto invalid_opc; case 0x07: goto invalid_opc; case 0x08: if (likely(ra != 31)) { if (rb != 31) tcg_gen_addi_i64(cpu_ir[ra], cpu_ir[rb], disp16); else tcg_gen_movi_i64(cpu_ir[ra], disp16); } break; case 0x09: if (likely(ra != 31)) { if (rb != 31) tcg_gen_addi_i64(cpu_ir[ra], cpu_ir[rb], disp16 << 16); else tcg_gen_movi_i64(cpu_ir[ra], disp16 << 16); } break; case 0x0A: if (!(ctx->amask & AMASK_BWX)) goto invalid_opc; gen_load_mem(ctx, &tcg_gen_qemu_ld8u, ra, rb, disp16, 0, 0); break; case 0x0B: gen_load_mem(ctx, &tcg_gen_qemu_ld64, ra, rb, disp16, 0, 1); break; case 0x0C: if (!(ctx->amask & AMASK_BWX)) goto invalid_opc; gen_load_mem(ctx, &tcg_gen_qemu_ld16u, ra, rb, disp16, 0, 1); break; case 0x0D: gen_store_mem(ctx, &tcg_gen_qemu_st16, ra, rb, disp16, 0, 0); break; case 0x0E: gen_store_mem(ctx, &tcg_gen_qemu_st8, ra, rb, disp16, 0, 0); break; case 0x0F: gen_store_mem(ctx, &tcg_gen_qemu_st64, ra, rb, disp16, 0, 1); break; case 0x10: switch (fn7) { case 0x00: if (likely(rc != 31)) { if (ra != 31) { if (islit) { tcg_gen_addi_i64(cpu_ir[rc], cpu_ir[ra], lit); tcg_gen_ext32s_i64(cpu_ir[rc], cpu_ir[rc]); } else { tcg_gen_add_i64(cpu_ir[rc], cpu_ir[ra], cpu_ir[rb]); tcg_gen_ext32s_i64(cpu_ir[rc], cpu_ir[rc]); } } else { if (islit) tcg_gen_movi_i64(cpu_ir[rc], lit); else tcg_gen_ext32s_i64(cpu_ir[rc], cpu_ir[rb]); } } break; case 0x02: if (likely(rc != 31)) { if (ra != 31) { TCGv tmp = tcg_temp_new(TCG_TYPE_I64); tcg_gen_shli_i64(tmp, cpu_ir[ra], 2); if (islit) tcg_gen_addi_i64(tmp, tmp, lit); else tcg_gen_add_i64(tmp, tmp, cpu_ir[rb]); tcg_gen_ext32s_i64(cpu_ir[rc], tmp); tcg_temp_free(tmp); } else { if (islit) tcg_gen_movi_i64(cpu_ir[rc], lit); else tcg_gen_ext32s_i64(cpu_ir[rc], cpu_ir[rb]); } } break; case 0x09: if (likely(rc != 31)) { if (ra != 31) { if (islit) tcg_gen_subi_i64(cpu_ir[rc], cpu_ir[ra], lit); else tcg_gen_sub_i64(cpu_ir[rc], cpu_ir[ra], cpu_ir[rb]); tcg_gen_ext32s_i64(cpu_ir[rc], cpu_ir[rc]); } else { if (islit) tcg_gen_movi_i64(cpu_ir[rc], -lit); else { tcg_gen_neg_i64(cpu_ir[rc], cpu_ir[rb]); tcg_gen_ext32s_i64(cpu_ir[rc], cpu_ir[rc]); } } break; case 0x0B: if (likely(rc != 31)) { if (ra != 31) { TCGv tmp = tcg_temp_new(TCG_TYPE_I64); tcg_gen_shli_i64(tmp, cpu_ir[ra], 2); if (islit) tcg_gen_subi_i64(tmp, tmp, lit); else tcg_gen_sub_i64(tmp, tmp, cpu_ir[rb]); tcg_gen_ext32s_i64(cpu_ir[rc], tmp); tcg_temp_free(tmp); } else { if (islit) tcg_gen_movi_i64(cpu_ir[rc], -lit); else { tcg_gen_neg_i64(cpu_ir[rc], cpu_ir[rb]); tcg_gen_ext32s_i64(cpu_ir[rc], cpu_ir[rc]); } } } break; case 0x0F: gen_arith3(helper_cmpbge, ra, rb, rc, islit, lit); break; case 0x12: if (likely(rc != 31)) { if (ra != 31) { TCGv tmp = tcg_temp_new(TCG_TYPE_I64); tcg_gen_shli_i64(tmp, cpu_ir[ra], 3); if (islit) tcg_gen_addi_i64(tmp, tmp, lit); else tcg_gen_add_i64(tmp, tmp, cpu_ir[rb]); tcg_gen_ext32s_i64(cpu_ir[rc], tmp); tcg_temp_free(tmp); } else { if (islit) tcg_gen_movi_i64(cpu_ir[rc], lit); else tcg_gen_ext32s_i64(cpu_ir[rc], cpu_ir[rb]); } } break; case 0x1B: if (likely(rc != 31)) { if (ra != 31) { TCGv tmp = tcg_temp_new(TCG_TYPE_I64); tcg_gen_shli_i64(tmp, cpu_ir[ra], 3); if (islit) tcg_gen_subi_i64(tmp, tmp, lit); else tcg_gen_sub_i64(tmp, tmp, cpu_ir[rb]); tcg_gen_ext32s_i64(cpu_ir[rc], tmp); tcg_temp_free(tmp); } else { if (islit) tcg_gen_movi_i64(cpu_ir[rc], -lit); else tcg_gen_neg_i64(cpu_ir[rc], cpu_ir[rb]); tcg_gen_ext32s_i64(cpu_ir[rc], cpu_ir[rc]); } } } break; case 0x1D: gen_cmp(TCG_COND_LTU, ra, rb, rc, islit, lit); break; case 0x20: if (likely(rc != 31)) { if (ra != 31) { if (islit) tcg_gen_addi_i64(cpu_ir[rc], cpu_ir[ra], lit); else tcg_gen_add_i64(cpu_ir[rc], cpu_ir[ra], cpu_ir[rb]); } else { if (islit) tcg_gen_movi_i64(cpu_ir[rc], lit); else tcg_gen_mov_i64(cpu_ir[rc], cpu_ir[rb]); } } break; case 0x22: if (likely(rc != 31)) { if (ra != 31) { TCGv tmp = tcg_temp_new(TCG_TYPE_I64); tcg_gen_shli_i64(tmp, cpu_ir[ra], 2); if (islit) tcg_gen_addi_i64(cpu_ir[rc], tmp, lit); else tcg_gen_add_i64(cpu_ir[rc], tmp, cpu_ir[rb]); tcg_temp_free(tmp); } else { if (islit) tcg_gen_movi_i64(cpu_ir[rc], lit); else tcg_gen_mov_i64(cpu_ir[rc], cpu_ir[rb]); } } break; case 0x29: if (likely(rc != 31)) { if (ra != 31) { if (islit) tcg_gen_subi_i64(cpu_ir[rc], cpu_ir[ra], lit); else tcg_gen_sub_i64(cpu_ir[rc], cpu_ir[ra], cpu_ir[rb]); } else { if (islit) tcg_gen_movi_i64(cpu_ir[rc], -lit); else tcg_gen_neg_i64(cpu_ir[rc], cpu_ir[rb]); } } break; case 0x2B: if (likely(rc != 31)) { if (ra != 31) { TCGv tmp = tcg_temp_new(TCG_TYPE_I64); tcg_gen_shli_i64(tmp, cpu_ir[ra], 2); if (islit) tcg_gen_subi_i64(cpu_ir[rc], tmp, lit); else tcg_gen_sub_i64(cpu_ir[rc], tmp, cpu_ir[rb]); tcg_temp_free(tmp); } else { if (islit) tcg_gen_movi_i64(cpu_ir[rc], -lit); else tcg_gen_neg_i64(cpu_ir[rc], cpu_ir[rb]); } } break; case 0x2D: gen_cmp(TCG_COND_EQ, ra, rb, rc, islit, lit); break; case 0x32: if (likely(rc != 31)) { if (ra != 31) { TCGv tmp = tcg_temp_new(TCG_TYPE_I64); tcg_gen_shli_i64(tmp, cpu_ir[ra], 3); if (islit) tcg_gen_addi_i64(cpu_ir[rc], tmp, lit); else tcg_gen_add_i64(cpu_ir[rc], tmp, cpu_ir[rb]); tcg_temp_free(tmp); } else { if (islit) tcg_gen_movi_i64(cpu_ir[rc], lit); else tcg_gen_mov_i64(cpu_ir[rc], cpu_ir[rb]); } } break; case 0x3B: if (likely(rc != 31)) { if (ra != 31) { TCGv tmp = tcg_temp_new(TCG_TYPE_I64); tcg_gen_shli_i64(tmp, cpu_ir[ra], 3); if (islit) tcg_gen_subi_i64(cpu_ir[rc], tmp, lit); else tcg_gen_sub_i64(cpu_ir[rc], tmp, cpu_ir[rb]); tcg_temp_free(tmp); } else { if (islit) tcg_gen_movi_i64(cpu_ir[rc], -lit); else tcg_gen_neg_i64(cpu_ir[rc], cpu_ir[rb]); } } break; case 0x3D: gen_cmp(TCG_COND_LEU, ra, rb, rc, islit, lit); break; case 0x40: gen_arith3(helper_addlv, ra, rb, rc, islit, lit); break; case 0x49: gen_arith3(helper_sublv, ra, rb, rc, islit, lit); break; case 0x4D: gen_cmp(TCG_COND_LT, ra, rb, rc, islit, lit); break; case 0x60: gen_arith3(helper_addqv, ra, rb, rc, islit, lit); break; case 0x69: gen_arith3(helper_subqv, ra, rb, rc, islit, lit); break; case 0x6D: gen_cmp(TCG_COND_LE, ra, rb, rc, islit, lit); break; default: goto invalid_opc; } break; case 0x11: switch (fn7) { case 0x00: if (likely(rc != 31)) { if (ra == 31) tcg_gen_movi_i64(cpu_ir[rc], 0); else if (islit) tcg_gen_andi_i64(cpu_ir[rc], cpu_ir[ra], lit); else tcg_gen_and_i64(cpu_ir[rc], cpu_ir[ra], cpu_ir[rb]); } break; case 0x08: if (likely(rc != 31)) { if (ra != 31) { if (islit) tcg_gen_andi_i64(cpu_ir[rc], cpu_ir[ra], ~lit); else tcg_gen_andc_i64(cpu_ir[rc], cpu_ir[ra], cpu_ir[rb]); } else tcg_gen_movi_i64(cpu_ir[rc], 0); } break; case 0x14: gen_cmov(TCG_COND_EQ, ra, rb, rc, islit, lit, 1); break; case 0x16: gen_cmov(TCG_COND_NE, ra, rb, rc, islit, lit, 1); break; case 0x20: if (likely(rc != 31)) { if (ra != 31) { if (islit) tcg_gen_ori_i64(cpu_ir[rc], cpu_ir[ra], lit); else tcg_gen_or_i64(cpu_ir[rc], cpu_ir[ra], cpu_ir[rb]); } else { if (islit) tcg_gen_movi_i64(cpu_ir[rc], lit); else tcg_gen_mov_i64(cpu_ir[rc], cpu_ir[rb]); } } break; case 0x24: gen_cmov(TCG_COND_NE, ra, rb, rc, islit, lit, 0); break; case 0x26: gen_cmov(TCG_COND_EQ, ra, rb, rc, islit, lit, 0); break; case 0x28: if (likely(rc != 31)) { if (ra != 31) { if (islit) tcg_gen_ori_i64(cpu_ir[rc], cpu_ir[ra], ~lit); else tcg_gen_orc_i64(cpu_ir[rc], cpu_ir[ra], cpu_ir[rb]); } else { if (islit) tcg_gen_movi_i64(cpu_ir[rc], ~lit); else tcg_gen_not_i64(cpu_ir[rc], cpu_ir[rb]); } } break; case 0x40: if (likely(rc != 31)) { if (ra != 31) { if (islit) tcg_gen_xori_i64(cpu_ir[rc], cpu_ir[ra], lit); else tcg_gen_xor_i64(cpu_ir[rc], cpu_ir[ra], cpu_ir[rb]); } else { if (islit) tcg_gen_movi_i64(cpu_ir[rc], lit); else tcg_gen_mov_i64(cpu_ir[rc], cpu_ir[rb]); } } break; case 0x44: gen_cmov(TCG_COND_GE, ra, rb, rc, islit, lit, 0); break; case 0x46: gen_cmov(TCG_COND_LT, ra, rb, rc, islit, lit, 0); break; case 0x48: if (likely(rc != 31)) { if (ra != 31) { if (islit) tcg_gen_xori_i64(cpu_ir[rc], cpu_ir[ra], ~lit); else tcg_gen_eqv_i64(cpu_ir[rc], cpu_ir[ra], cpu_ir[rb]); } else { if (islit) tcg_gen_movi_i64(cpu_ir[rc], ~lit); else tcg_gen_not_i64(cpu_ir[rc], cpu_ir[rb]); } } break; case 0x61: if (likely(rc != 31)) { if (islit) tcg_gen_movi_i64(cpu_ir[rc], helper_amask(lit)); else tcg_gen_helper_1_1(helper_amask, cpu_ir[rc], cpu_ir[rb]); } break; case 0x64: gen_cmov(TCG_COND_GT, ra, rb, rc, islit, lit, 0); break; case 0x66: gen_cmov(TCG_COND_LE, ra, rb, rc, islit, lit, 0); break; case 0x6C: if (rc != 31) tcg_gen_helper_1_0(helper_load_implver, cpu_ir[rc]); break; default: goto invalid_opc; } break; case 0x12: switch (fn7) { case 0x02: gen_arith3(helper_mskbl, ra, rb, rc, islit, lit); break; case 0x06: gen_ext_l(&tcg_gen_ext8u_i64, ra, rb, rc, islit, lit); break; case 0x0B: gen_arith3(helper_insbl, ra, rb, rc, islit, lit); break; case 0x12: gen_arith3(helper_mskwl, ra, rb, rc, islit, lit); break; case 0x16: gen_ext_l(&tcg_gen_ext16u_i64, ra, rb, rc, islit, lit); break; case 0x1B: gen_arith3(helper_inswl, ra, rb, rc, islit, lit); break; case 0x22: gen_arith3(helper_mskll, ra, rb, rc, islit, lit); break; case 0x26: gen_ext_l(&tcg_gen_ext32u_i64, ra, rb, rc, islit, lit); break; case 0x2B: gen_arith3(helper_insll, ra, rb, rc, islit, lit); break; case 0x30: gen_arith3(helper_zap, ra, rb, rc, islit, lit); break; case 0x31: gen_arith3(helper_zapnot, ra, rb, rc, islit, lit); break; case 0x32: gen_arith3(helper_mskql, ra, rb, rc, islit, lit); break; case 0x34: if (likely(rc != 31)) { if (ra != 31) { if (islit) tcg_gen_shri_i64(cpu_ir[rc], cpu_ir[ra], lit & 0x3f); else { TCGv shift = tcg_temp_new(TCG_TYPE_I64); tcg_gen_andi_i64(shift, cpu_ir[rb], 0x3f); tcg_gen_shr_i64(cpu_ir[rc], cpu_ir[ra], shift); tcg_temp_free(shift); } } else tcg_gen_movi_i64(cpu_ir[rc], 0); } break; case 0x36: gen_ext_l(NULL, ra, rb, rc, islit, lit); break; case 0x39: if (likely(rc != 31)) { if (ra != 31) { if (islit) tcg_gen_shli_i64(cpu_ir[rc], cpu_ir[ra], lit & 0x3f); else { TCGv shift = tcg_temp_new(TCG_TYPE_I64); tcg_gen_andi_i64(shift, cpu_ir[rb], 0x3f); tcg_gen_shl_i64(cpu_ir[rc], cpu_ir[ra], shift); tcg_temp_free(shift); } } else tcg_gen_movi_i64(cpu_ir[rc], 0); } break; case 0x3B: gen_arith3(helper_insql, ra, rb, rc, islit, lit); break; case 0x3C: if (likely(rc != 31)) { if (ra != 31) { if (islit) tcg_gen_sari_i64(cpu_ir[rc], cpu_ir[ra], lit & 0x3f); else { TCGv shift = tcg_temp_new(TCG_TYPE_I64); tcg_gen_andi_i64(shift, cpu_ir[rb], 0x3f); tcg_gen_sar_i64(cpu_ir[rc], cpu_ir[ra], shift); tcg_temp_free(shift); } } else tcg_gen_movi_i64(cpu_ir[rc], 0); } break; case 0x52: gen_arith3(helper_mskwh, ra, rb, rc, islit, lit); break; case 0x57: gen_arith3(helper_inswh, ra, rb, rc, islit, lit); break; case 0x5A: gen_ext_h(&tcg_gen_ext16u_i64, ra, rb, rc, islit, lit); break; case 0x62: gen_arith3(helper_msklh, ra, rb, rc, islit, lit); break; case 0x67: gen_arith3(helper_inslh, ra, rb, rc, islit, lit); break; case 0x6A: gen_ext_h(&tcg_gen_ext16u_i64, ra, rb, rc, islit, lit); break; case 0x72: gen_arith3(helper_mskqh, ra, rb, rc, islit, lit); break; case 0x77: gen_arith3(helper_insqh, ra, rb, rc, islit, lit); break; case 0x7A: gen_ext_h(NULL, ra, rb, rc, islit, lit); break; default: goto invalid_opc; } break; case 0x13: switch (fn7) { case 0x00: if (likely(rc != 31)) { if (ra == 31) tcg_gen_movi_i64(cpu_ir[rc], 0); else { if (islit) tcg_gen_muli_i64(cpu_ir[rc], cpu_ir[ra], lit); else tcg_gen_mul_i64(cpu_ir[rc], cpu_ir[ra], cpu_ir[rb]); tcg_gen_ext32s_i64(cpu_ir[rc], cpu_ir[rc]); } } break; case 0x20: if (likely(rc != 31)) { if (ra == 31) tcg_gen_movi_i64(cpu_ir[rc], 0); else if (islit) tcg_gen_muli_i64(cpu_ir[rc], cpu_ir[ra], lit); else tcg_gen_mul_i64(cpu_ir[rc], cpu_ir[ra], cpu_ir[rb]); } break; case 0x30: gen_arith3(helper_umulh, ra, rb, rc, islit, lit); break; case 0x40: gen_arith3(helper_mullv, ra, rb, rc, islit, lit); break; case 0x60: gen_arith3(helper_mulqv, ra, rb, rc, islit, lit); break; default: goto invalid_opc; } break; case 0x14: switch (fpfn) { case 0x04: if (!(ctx->amask & AMASK_FIX)) goto invalid_opc; if (likely(rc != 31)) { if (ra != 31) { TCGv tmp = tcg_temp_new(TCG_TYPE_I32); tcg_gen_trunc_i64_i32(tmp, cpu_ir[ra]); tcg_gen_helper_1_1(helper_memory_to_s, cpu_fir[rc], tmp); tcg_temp_free(tmp); } else tcg_gen_movi_i64(cpu_fir[rc], 0); } break; case 0x0A: if (!(ctx->amask & AMASK_FIX)) goto invalid_opc; gen_farith2(&helper_sqrtf, rb, rc); break; case 0x0B: if (!(ctx->amask & AMASK_FIX)) goto invalid_opc; gen_farith2(&helper_sqrts, rb, rc); break; case 0x14: if (!(ctx->amask & AMASK_FIX)) goto invalid_opc; if (likely(rc != 31)) { if (ra != 31) { TCGv tmp = tcg_temp_new(TCG_TYPE_I32); tcg_gen_trunc_i64_i32(tmp, cpu_ir[ra]); tcg_gen_helper_1_1(helper_memory_to_f, cpu_fir[rc], tmp); tcg_temp_free(tmp); } else tcg_gen_movi_i64(cpu_fir[rc], 0); } break; case 0x24: if (!(ctx->amask & AMASK_FIX)) goto invalid_opc; if (likely(rc != 31)) { if (ra != 31) tcg_gen_mov_i64(cpu_fir[rc], cpu_ir[ra]); else tcg_gen_movi_i64(cpu_fir[rc], 0); } break; case 0x2A: if (!(ctx->amask & AMASK_FIX)) goto invalid_opc; gen_farith2(&helper_sqrtg, rb, rc); break; case 0x02B: if (!(ctx->amask & AMASK_FIX)) goto invalid_opc; gen_farith2(&helper_sqrtt, rb, rc); break; default: goto invalid_opc; } break; case 0x15: switch (fpfn) { case 0x00: gen_farith3(&helper_addf, ra, rb, rc); break; case 0x01: gen_farith3(&helper_subf, ra, rb, rc); break; case 0x02: gen_farith3(&helper_mulf, ra, rb, rc); break; case 0x03: gen_farith3(&helper_divf, ra, rb, rc); break; case 0x1E: #if 0 gen_farith2(&helper_cvtdg, rb, rc); #else goto invalid_opc; #endif break; case 0x20: gen_farith3(&helper_addg, ra, rb, rc); break; case 0x21: gen_farith3(&helper_subg, ra, rb, rc); break; case 0x22: gen_farith3(&helper_mulg, ra, rb, rc); break; case 0x23: gen_farith3(&helper_divg, ra, rb, rc); break; case 0x25: gen_farith3(&helper_cmpgeq, ra, rb, rc); break; case 0x26: gen_farith3(&helper_cmpglt, ra, rb, rc); break; case 0x27: gen_farith3(&helper_cmpgle, ra, rb, rc); break; case 0x2C: gen_farith2(&helper_cvtgf, rb, rc); break; case 0x2D: #if 0 gen_farith2(ctx, &helper_cvtgd, rb, rc); #else goto invalid_opc; #endif break; case 0x2F: gen_farith2(&helper_cvtgq, rb, rc); break; case 0x3C: gen_farith2(&helper_cvtqf, rb, rc); break; case 0x3E: gen_farith2(&helper_cvtqg, rb, rc); break; default: goto invalid_opc; } break; case 0x16: switch (fpfn) { case 0x00: gen_farith3(&helper_adds, ra, rb, rc); break; case 0x01: gen_farith3(&helper_subs, ra, rb, rc); break; case 0x02: gen_farith3(&helper_muls, ra, rb, rc); break; case 0x03: gen_farith3(&helper_divs, ra, rb, rc); break; case 0x20: gen_farith3(&helper_addt, ra, rb, rc); break; case 0x21: gen_farith3(&helper_subt, ra, rb, rc); break; case 0x22: gen_farith3(&helper_mult, ra, rb, rc); break; case 0x23: gen_farith3(&helper_divt, ra, rb, rc); break; case 0x24: gen_farith3(&helper_cmptun, ra, rb, rc); break; case 0x25: gen_farith3(&helper_cmpteq, ra, rb, rc); break; case 0x26: gen_farith3(&helper_cmptlt, ra, rb, rc); break; case 0x27: gen_farith3(&helper_cmptle, ra, rb, rc); break; case 0x2C: if (fn11 == 0x2AC) { gen_farith2(&helper_cvtst, rb, rc); } else { gen_farith2(&helper_cvtts, rb, rc); } break; case 0x2F: gen_farith2(&helper_cvttq, rb, rc); break; case 0x3C: gen_farith2(&helper_cvtqs, rb, rc); break; case 0x3E: gen_farith2(&helper_cvtqt, rb, rc); break; default: goto invalid_opc; } break; case 0x17: switch (fn11) { case 0x010: gen_farith2(&helper_cvtlq, rb, rc); break; case 0x020: if (likely(rc != 31)) { if (ra == rb) tcg_gen_mov_i64(cpu_fir[rc], cpu_fir[ra]); else gen_farith3(&helper_cpys, ra, rb, rc); } break; case 0x021: gen_farith3(&helper_cpysn, ra, rb, rc); break; case 0x022: gen_farith3(&helper_cpyse, ra, rb, rc); break; case 0x024: if (likely(ra != 31)) tcg_gen_helper_0_1(helper_store_fpcr, cpu_fir[ra]); else { TCGv tmp = tcg_const_i64(0); tcg_gen_helper_0_1(helper_store_fpcr, tmp); tcg_temp_free(tmp); } break; case 0x025: if (likely(ra != 31)) tcg_gen_helper_1_0(helper_load_fpcr, cpu_fir[ra]); break; case 0x02A: gen_fcmov(&helper_cmpfeq, ra, rb, rc); break; case 0x02B: gen_fcmov(&helper_cmpfne, ra, rb, rc); break; case 0x02C: gen_fcmov(&helper_cmpflt, ra, rb, rc); break; case 0x02D: gen_fcmov(&helper_cmpfge, ra, rb, rc); break; case 0x02E: gen_fcmov(&helper_cmpfle, ra, rb, rc); break; case 0x02F: gen_fcmov(&helper_cmpfgt, ra, rb, rc); break; case 0x030: gen_farith2(&helper_cvtql, rb, rc); break; case 0x130: gen_farith2(&helper_cvtqlv, rb, rc); break; case 0x530: gen_farith2(&helper_cvtqlsv, rb, rc); break; default: goto invalid_opc; } break; case 0x18: switch ((uint16_t)disp16) { case 0x0000: ret = 2; break; case 0x0400: ret = 2; break; case 0x4000: break; case 0x4400: break; case 0x8000: break; case 0xA000: break; case 0xC000: if (ra != 31) tcg_gen_helper_1_0(helper_load_pcc, cpu_ir[ra]); break; case 0xE000: if (ra != 31) tcg_gen_helper_1_0(helper_rc, cpu_ir[ra]); break; case 0xE800: #if 0 ret = 2; #else goto invalid_opc; #endif break; case 0xF000: if (ra != 31) tcg_gen_helper_1_0(helper_rs, cpu_ir[ra]); break; case 0xF800: break; default: goto invalid_opc; } break; case 0x19: #if defined (CONFIG_USER_ONLY) goto invalid_opc; #else if (!ctx->pal_mode) goto invalid_opc; if (ra != 31) { TCGv tmp = tcg_const_i32(insn & 0xFF); tcg_gen_helper_1_2(helper_mfpr, cpu_ir[ra], tmp, cpu_ir[ra]); tcg_temp_free(tmp); } break; #endif case 0x1A: if (ra != 31) tcg_gen_movi_i64(cpu_ir[ra], ctx->pc); if (rb != 31) tcg_gen_andi_i64(cpu_pc, cpu_ir[rb], ~3); else tcg_gen_movi_i64(cpu_pc, 0); switch (fn2) { case 0x0: break; case 0x1: break; case 0x2: break; case 0x3: break; } ret = 1; break; case 0x1B: #if defined (CONFIG_USER_ONLY) goto invalid_opc; #else if (!ctx->pal_mode) goto invalid_opc; if (ra != 31) { TCGv addr = tcg_temp_new(TCG_TYPE_I64); if (rb != 31) tcg_gen_addi_i64(addr, cpu_ir[rb], disp12); else tcg_gen_movi_i64(addr, disp12); switch ((insn >> 12) & 0xF) { case 0x0: tcg_gen_helper_0_2(helper_ldl_raw, cpu_ir[ra], addr); break; case 0x1: tcg_gen_helper_0_2(helper_ldq_raw, cpu_ir[ra], addr); break; case 0x2: tcg_gen_helper_0_2(helper_ldl_l_raw, cpu_ir[ra], addr); break; case 0x3: tcg_gen_helper_0_2(helper_ldq_l_raw, cpu_ir[ra], addr); break; case 0x4: tcg_gen_helper_0_2(helper_ldl_kernel, cpu_ir[ra], addr); break; case 0x5: tcg_gen_helper_0_2(helper_ldq_kernel, cpu_ir[ra], addr); break; case 0x6: goto incpu_ir[ra]id_opc; case 0x7: goto incpu_ir[ra]id_opc; case 0x8: tcg_gen_helper_1_1(helper_st_virt_to_phys, addr, addr); tcg_gen_helper_0_2(helper_ldl_raw, cpu_ir[ra], addr); break; case 0x9: tcg_gen_helper_1_1(helper_st_virt_to_phys, addr, addr); tcg_gen_helper_0_2(helper_ldq_raw, cpu_ir[ra], addr); break; case 0xA: tcg_gen_qemu_ld32s(cpu_ir[ra], addr, ctx->flags); break; case 0xB: tcg_gen_qemu_ld64(cpu_ir[ra], addr, ctx->flags); break; case 0xC: tcg_gen_helper_0_0(helper_set_alt_mode); tcg_gen_helper_1_1(helper_st_virt_to_phys, addr, addr); tcg_gen_helper_0_2(helper_ldl_raw, cpu_ir[ra], addr); tcg_gen_helper_0_0(helper_restore_mode); break; case 0xD: tcg_gen_helper_0_0(helper_set_alt_mode); tcg_gen_helper_1_1(helper_st_virt_to_phys, addr, addr); tcg_gen_helper_0_2(helper_ldq_raw, cpu_ir[ra], addr); tcg_gen_helper_0_0(helper_restore_mode); break; case 0xE: tcg_gen_helper_0_0(helper_set_alt_mode); tcg_gen_helper_0_2(helper_ldl_data, cpu_ir[ra], addr); tcg_gen_helper_0_0(helper_restore_mode); break; case 0xF: tcg_gen_helper_0_0(helper_set_alt_mode); tcg_gen_helper_0_2(helper_ldq_data, cpu_ir[ra], addr); tcg_gen_helper_0_0(helper_restore_mode); break; } tcg_temp_free(addr); } break; #endif case 0x1C: switch (fn7) { case 0x00: if (!(ctx->amask & AMASK_BWX)) goto invalid_opc; if (likely(rc != 31)) { if (islit) tcg_gen_movi_i64(cpu_ir[rc], (int64_t)((int8_t)lit)); else tcg_gen_ext8s_i64(cpu_ir[rc], cpu_ir[rb]); } break; case 0x01: if (!(ctx->amask & AMASK_BWX)) goto invalid_opc; if (likely(rc != 31)) { if (islit) tcg_gen_movi_i64(cpu_ir[rc], (int64_t)((int16_t)lit)); else tcg_gen_ext16s_i64(cpu_ir[rc], cpu_ir[rb]); } break; case 0x30: if (!(ctx->amask & AMASK_CIX)) goto invalid_opc; if (likely(rc != 31)) { if (islit) tcg_gen_movi_i64(cpu_ir[rc], ctpop64(lit)); else tcg_gen_helper_1_1(helper_ctpop, cpu_ir[rc], cpu_ir[rb]); } break; case 0x31: if (!(ctx->amask & AMASK_MVI)) goto invalid_opc; goto invalid_opc; break; case 0x32: if (!(ctx->amask & AMASK_CIX)) goto invalid_opc; if (likely(rc != 31)) { if (islit) tcg_gen_movi_i64(cpu_ir[rc], clz64(lit)); else tcg_gen_helper_1_1(helper_ctlz, cpu_ir[rc], cpu_ir[rb]); } break; case 0x33: if (!(ctx->amask & AMASK_CIX)) goto invalid_opc; if (likely(rc != 31)) { if (islit) tcg_gen_movi_i64(cpu_ir[rc], ctz64(lit)); else tcg_gen_helper_1_1(helper_cttz, cpu_ir[rc], cpu_ir[rb]); } break; case 0x34: if (!(ctx->amask & AMASK_MVI)) goto invalid_opc; goto invalid_opc; break; case 0x35: if (!(ctx->amask & AMASK_MVI)) goto invalid_opc; goto invalid_opc; break; case 0x36: if (!(ctx->amask & AMASK_MVI)) goto invalid_opc; goto invalid_opc; break; case 0x37: if (!(ctx->amask & AMASK_MVI)) goto invalid_opc; goto invalid_opc; break; case 0x38: if (!(ctx->amask & AMASK_MVI)) goto invalid_opc; goto invalid_opc; break; case 0x39: if (!(ctx->amask & AMASK_MVI)) goto invalid_opc; goto invalid_opc; break; case 0x3A: if (!(ctx->amask & AMASK_MVI)) goto invalid_opc; goto invalid_opc; break; case 0x3B: if (!(ctx->amask & AMASK_MVI)) goto invalid_opc; goto invalid_opc; break; case 0x3C: if (!(ctx->amask & AMASK_MVI)) goto invalid_opc; goto invalid_opc; break; case 0x3D: if (!(ctx->amask & AMASK_MVI)) goto invalid_opc; goto invalid_opc; break; case 0x3E: if (!(ctx->amask & AMASK_MVI)) goto invalid_opc; goto invalid_opc; break; case 0x3F: if (!(ctx->amask & AMASK_MVI)) goto invalid_opc; goto invalid_opc; break; case 0x70: if (!(ctx->amask & AMASK_FIX)) goto invalid_opc; if (likely(rc != 31)) { if (ra != 31) tcg_gen_mov_i64(cpu_ir[rc], cpu_fir[ra]); else tcg_gen_movi_i64(cpu_ir[rc], 0); } break; case 0x78: if (!(ctx->amask & AMASK_FIX)) goto invalid_opc; if (rc != 31) { TCGv tmp1 = tcg_temp_new(TCG_TYPE_I32); if (ra != 31) tcg_gen_helper_1_1(helper_s_to_memory, tmp1, cpu_fir[ra]); else { TCGv tmp2 = tcg_const_i64(0); tcg_gen_helper_1_1(helper_s_to_memory, tmp1, tmp2); tcg_temp_free(tmp2); } tcg_gen_ext_i32_i64(cpu_ir[rc], tmp1); tcg_temp_free(tmp1); } break; default: goto invalid_opc; } break; case 0x1D: #if defined (CONFIG_USER_ONLY) goto invalid_opc; #else if (!ctx->pal_mode) goto invalid_opc; else { TCGv tmp1 = tcg_const_i32(insn & 0xFF); if (ra != 31) tcg_gen_helper(helper_mtpr, tmp1, cpu_ir[ra]); else { TCGv tmp2 = tcg_const_i64(0); tcg_gen_helper(helper_mtpr, tmp1, tmp2); tcg_temp_free(tmp2); } tcg_temp_free(tmp1); ret = 2; } break; #endif case 0x1E: #if defined (CONFIG_USER_ONLY) goto invalid_opc; #else if (!ctx->pal_mode) goto invalid_opc; if (rb == 31) { tcg_gen_helper_0_0(helper_hw_rei); } else { TCGv tmp; if (ra != 31) { tmp = tcg_temp_new(TCG_TYPE_I64); tcg_gen_addi_i64(tmp, cpu_ir[rb], (((int64_t)insn << 51) >> 51)); } else tmp = tcg_const_i64(((int64_t)insn << 51) >> 51); tcg_gen_helper_0_1(helper_hw_ret, tmp); tcg_temp_free(tmp); } ret = 2; break; #endif case 0x1F: #if defined (CONFIG_USER_ONLY) goto invalid_opc; #else if (!ctx->pal_mode) goto invalid_opc; else { TCGv addr, val; addr = tcg_temp_new(TCG_TYPE_I64); if (rb != 31) tcg_gen_addi_i64(addr, cpu_ir[rb], disp12); else tcg_gen_movi_i64(addr, disp12); if (ra != 31) val = cpu_ir[ra]; else { val = tcg_temp_new(TCG_TYPE_I64); tcg_gen_movi_i64(val, 0); } switch ((insn >> 12) & 0xF) { case 0x0: tcg_gen_helper_0_2(helper_stl_raw, val, addr); break; case 0x1: tcg_gen_helper_0_2(helper_stq_raw, val, addr); break; case 0x2: tcg_gen_helper_1_2(helper_stl_c_raw, val, val, addr); break; case 0x3: tcg_gen_helper_1_2(helper_stq_c_raw, val, val, addr); break; case 0x4: tcg_gen_helper_1_1(helper_st_virt_to_phys, addr, addr); tcg_gen_helper_0_2(helper_stl_raw, val, addr); break; case 0x5: tcg_gen_helper_1_1(helper_st_virt_to_phys, addr, addr); tcg_gen_helper_0_2(helper_stq_raw, val, addr); break; case 0x6: goto invalid_opc; case 0x7: goto invalid_opc; case 0x8: goto invalid_opc; case 0x9: goto invalid_opc; case 0xA: goto invalid_opc; case 0xB: goto invalid_opc; case 0xC: tcg_gen_helper_0_0(helper_set_alt_mode); tcg_gen_helper_1_1(helper_st_virt_to_phys, addr, addr); tcg_gen_helper_0_2(helper_stl_raw, val, addr); tcg_gen_helper_0_0(helper_restore_mode); break; case 0xD: tcg_gen_helper_0_0(helper_set_alt_mode); tcg_gen_helper_1_1(helper_st_virt_to_phys, addr, addr); tcg_gen_helper_0_2(helper_stl_raw, val, addr); tcg_gen_helper_0_0(helper_restore_mode); break; case 0xE: goto invalid_opc; case 0xF: goto invalid_opc; } if (ra != 31) tcg_temp_free(val); tcg_temp_free(addr); } ret = 2; break; #endif case 0x20: gen_load_mem(ctx, &gen_qemu_ldf, ra, rb, disp16, 1, 0); break; case 0x21: gen_load_mem(ctx, &gen_qemu_ldg, ra, rb, disp16, 1, 0); break; case 0x22: gen_load_mem(ctx, &gen_qemu_lds, ra, rb, disp16, 1, 0); break; case 0x23: gen_load_mem(ctx, &tcg_gen_qemu_ld64, ra, rb, disp16, 1, 0); break; case 0x24: gen_store_mem(ctx, &gen_qemu_stf, ra, rb, disp16, 1, 0); break; case 0x25: gen_store_mem(ctx, &gen_qemu_stg, ra, rb, disp16, 1, 0); break; case 0x26: gen_store_mem(ctx, &gen_qemu_sts, ra, rb, disp16, 1, 0); break; case 0x27: gen_store_mem(ctx, &tcg_gen_qemu_st64, ra, rb, disp16, 1, 0); break; case 0x28: gen_load_mem(ctx, &tcg_gen_qemu_ld32s, ra, rb, disp16, 0, 0); break; case 0x29: gen_load_mem(ctx, &tcg_gen_qemu_ld64, ra, rb, disp16, 0, 0); break; case 0x2A: gen_load_mem(ctx, &gen_qemu_ldl_l, ra, rb, disp16, 0, 0); break; case 0x2B: gen_load_mem(ctx, &gen_qemu_ldq_l, ra, rb, disp16, 0, 0); break; case 0x2C: gen_store_mem(ctx, &tcg_gen_qemu_st32, ra, rb, disp16, 0, 0); break; case 0x2D: gen_store_mem(ctx, &tcg_gen_qemu_st64, ra, rb, disp16, 0, 0); break; case 0x2E: gen_store_mem(ctx, &gen_qemu_stl_c, ra, rb, disp16, 0, 0); break; case 0x2F: gen_store_mem(ctx, &gen_qemu_stq_c, ra, rb, disp16, 0, 0); break; case 0x30: if (ra != 31) tcg_gen_movi_i64(cpu_ir[ra], ctx->pc); tcg_gen_movi_i64(cpu_pc, ctx->pc + (int64_t)(disp21 << 2)); ret = 1; break; case 0x31: gen_fbcond(ctx, &helper_cmpfeq, ra, disp16); ret = 1; break; case 0x32: gen_fbcond(ctx, &helper_cmpflt, ra, disp16); ret = 1; break; case 0x33: gen_fbcond(ctx, &helper_cmpfle, ra, disp16); ret = 1; break; case 0x34: if (ra != 31) tcg_gen_movi_i64(cpu_ir[ra], ctx->pc); tcg_gen_movi_i64(cpu_pc, ctx->pc + (int64_t)(disp21 << 2)); ret = 1; break; case 0x35: gen_fbcond(ctx, &helper_cmpfne, ra, disp16); ret = 1; break; case 0x36: gen_fbcond(ctx, &helper_cmpfge, ra, disp16); ret = 1; break; case 0x37: gen_fbcond(ctx, &helper_cmpfgt, ra, disp16); ret = 1; break; case 0x38: gen_bcond(ctx, TCG_COND_EQ, ra, disp16, 1); ret = 1; break; case 0x39: gen_bcond(ctx, TCG_COND_EQ, ra, disp16, 0); ret = 1; break; case 0x3A: gen_bcond(ctx, TCG_COND_LT, ra, disp16, 0); ret = 1; break; case 0x3B: gen_bcond(ctx, TCG_COND_LE, ra, disp16, 0); ret = 1; break; case 0x3C: gen_bcond(ctx, TCG_COND_NE, ra, disp16, 1); ret = 1; break; case 0x3D: gen_bcond(ctx, TCG_COND_NE, ra, disp16, 0); ret = 1; break; case 0x3E: gen_bcond(ctx, TCG_COND_GE, ra, disp16, 0); ret = 1; break; case 0x3F: gen_bcond(ctx, TCG_COND_GT, ra, disp16, 0); ret = 1; break; invalid_opc: gen_invalid(ctx); ret = 3; break; } return ret; }
{ "code": [ " if (ra != 31)", " tcg_gen_movi_i64(cpu_ir[ra], ctx->pc);" ], "line_no": [ 2225, 2227 ] }
static always_inline int FUNC_0 (DisasContext *ctx, uint32_t insn) { uint32_t palcode; int32_t disp21, disp16, disp12; uint16_t fn11, fn16; uint8_t opc, ra, rb, rc, sbz, fpfn, fn7, fn2, islit; uint8_t lit; int VAR_0; opc = insn >> 26; ra = (insn >> 21) & 0x1F; rb = (insn >> 16) & 0x1F; rc = insn & 0x1F; sbz = (insn >> 13) & 0x07; islit = (insn >> 12) & 1; if (rb == 31 && !islit) { islit = 1; lit = 0; } else lit = (insn >> 13) & 0xFF; palcode = insn & 0x03FFFFFF; disp21 = ((int32_t)((insn & 0x001FFFFF) << 11)) >> 11; disp16 = (int16_t)(insn & 0x0000FFFF); disp12 = (int32_t)((insn & 0x00000FFF) << 20) >> 20; fn16 = insn & 0x0000FFFF; fn11 = (insn >> 5) & 0x000007FF; fpfn = fn11 & 0x3F; fn7 = (insn >> 5) & 0x0000007F; fn2 = (insn >> 5) & 0x00000003; VAR_0 = 0; #if defined ALPHA_DEBUG_DISAS if (logfile != NULL) { fprintf(logfile, "opc %02x ra %d rb %d rc %d disp16 %04x\n", opc, ra, rb, rc, disp16); } #endif switch (opc) { case 0x00: if (palcode >= 0x80 && palcode < 0xC0) { gen_excp(ctx, EXCP_CALL_PAL + ((palcode & 0x1F) << 6), 0); #if !defined (CONFIG_USER_ONLY) } else if (palcode < 0x40) { if (ctx->mem_idx & 1) goto invalid_opc; else gen_excp(ctx, EXCP_CALL_PALP + ((palcode & 0x1F) << 6), 0); #endif } else { goto invalid_opc; } VAR_0 = 3; break; case 0x01: goto invalid_opc; case 0x02: goto invalid_opc; case 0x03: goto invalid_opc; case 0x04: goto invalid_opc; case 0x05: goto invalid_opc; case 0x06: goto invalid_opc; case 0x07: goto invalid_opc; case 0x08: if (likely(ra != 31)) { if (rb != 31) tcg_gen_addi_i64(cpu_ir[ra], cpu_ir[rb], disp16); else tcg_gen_movi_i64(cpu_ir[ra], disp16); } break; case 0x09: if (likely(ra != 31)) { if (rb != 31) tcg_gen_addi_i64(cpu_ir[ra], cpu_ir[rb], disp16 << 16); else tcg_gen_movi_i64(cpu_ir[ra], disp16 << 16); } break; case 0x0A: if (!(ctx->amask & AMASK_BWX)) goto invalid_opc; gen_load_mem(ctx, &tcg_gen_qemu_ld8u, ra, rb, disp16, 0, 0); break; case 0x0B: gen_load_mem(ctx, &tcg_gen_qemu_ld64, ra, rb, disp16, 0, 1); break; case 0x0C: if (!(ctx->amask & AMASK_BWX)) goto invalid_opc; gen_load_mem(ctx, &tcg_gen_qemu_ld16u, ra, rb, disp16, 0, 1); break; case 0x0D: gen_store_mem(ctx, &tcg_gen_qemu_st16, ra, rb, disp16, 0, 0); break; case 0x0E: gen_store_mem(ctx, &tcg_gen_qemu_st8, ra, rb, disp16, 0, 0); break; case 0x0F: gen_store_mem(ctx, &tcg_gen_qemu_st64, ra, rb, disp16, 0, 1); break; case 0x10: switch (fn7) { case 0x00: if (likely(rc != 31)) { if (ra != 31) { if (islit) { tcg_gen_addi_i64(cpu_ir[rc], cpu_ir[ra], lit); tcg_gen_ext32s_i64(cpu_ir[rc], cpu_ir[rc]); } else { tcg_gen_add_i64(cpu_ir[rc], cpu_ir[ra], cpu_ir[rb]); tcg_gen_ext32s_i64(cpu_ir[rc], cpu_ir[rc]); } } else { if (islit) tcg_gen_movi_i64(cpu_ir[rc], lit); else tcg_gen_ext32s_i64(cpu_ir[rc], cpu_ir[rb]); } } break; case 0x02: if (likely(rc != 31)) { if (ra != 31) { TCGv tmp = tcg_temp_new(TCG_TYPE_I64); tcg_gen_shli_i64(tmp, cpu_ir[ra], 2); if (islit) tcg_gen_addi_i64(tmp, tmp, lit); else tcg_gen_add_i64(tmp, tmp, cpu_ir[rb]); tcg_gen_ext32s_i64(cpu_ir[rc], tmp); tcg_temp_free(tmp); } else { if (islit) tcg_gen_movi_i64(cpu_ir[rc], lit); else tcg_gen_ext32s_i64(cpu_ir[rc], cpu_ir[rb]); } } break; case 0x09: if (likely(rc != 31)) { if (ra != 31) { if (islit) tcg_gen_subi_i64(cpu_ir[rc], cpu_ir[ra], lit); else tcg_gen_sub_i64(cpu_ir[rc], cpu_ir[ra], cpu_ir[rb]); tcg_gen_ext32s_i64(cpu_ir[rc], cpu_ir[rc]); } else { if (islit) tcg_gen_movi_i64(cpu_ir[rc], -lit); else { tcg_gen_neg_i64(cpu_ir[rc], cpu_ir[rb]); tcg_gen_ext32s_i64(cpu_ir[rc], cpu_ir[rc]); } } break; case 0x0B: if (likely(rc != 31)) { if (ra != 31) { TCGv tmp = tcg_temp_new(TCG_TYPE_I64); tcg_gen_shli_i64(tmp, cpu_ir[ra], 2); if (islit) tcg_gen_subi_i64(tmp, tmp, lit); else tcg_gen_sub_i64(tmp, tmp, cpu_ir[rb]); tcg_gen_ext32s_i64(cpu_ir[rc], tmp); tcg_temp_free(tmp); } else { if (islit) tcg_gen_movi_i64(cpu_ir[rc], -lit); else { tcg_gen_neg_i64(cpu_ir[rc], cpu_ir[rb]); tcg_gen_ext32s_i64(cpu_ir[rc], cpu_ir[rc]); } } } break; case 0x0F: gen_arith3(helper_cmpbge, ra, rb, rc, islit, lit); break; case 0x12: if (likely(rc != 31)) { if (ra != 31) { TCGv tmp = tcg_temp_new(TCG_TYPE_I64); tcg_gen_shli_i64(tmp, cpu_ir[ra], 3); if (islit) tcg_gen_addi_i64(tmp, tmp, lit); else tcg_gen_add_i64(tmp, tmp, cpu_ir[rb]); tcg_gen_ext32s_i64(cpu_ir[rc], tmp); tcg_temp_free(tmp); } else { if (islit) tcg_gen_movi_i64(cpu_ir[rc], lit); else tcg_gen_ext32s_i64(cpu_ir[rc], cpu_ir[rb]); } } break; case 0x1B: if (likely(rc != 31)) { if (ra != 31) { TCGv tmp = tcg_temp_new(TCG_TYPE_I64); tcg_gen_shli_i64(tmp, cpu_ir[ra], 3); if (islit) tcg_gen_subi_i64(tmp, tmp, lit); else tcg_gen_sub_i64(tmp, tmp, cpu_ir[rb]); tcg_gen_ext32s_i64(cpu_ir[rc], tmp); tcg_temp_free(tmp); } else { if (islit) tcg_gen_movi_i64(cpu_ir[rc], -lit); else tcg_gen_neg_i64(cpu_ir[rc], cpu_ir[rb]); tcg_gen_ext32s_i64(cpu_ir[rc], cpu_ir[rc]); } } } break; case 0x1D: gen_cmp(TCG_COND_LTU, ra, rb, rc, islit, lit); break; case 0x20: if (likely(rc != 31)) { if (ra != 31) { if (islit) tcg_gen_addi_i64(cpu_ir[rc], cpu_ir[ra], lit); else tcg_gen_add_i64(cpu_ir[rc], cpu_ir[ra], cpu_ir[rb]); } else { if (islit) tcg_gen_movi_i64(cpu_ir[rc], lit); else tcg_gen_mov_i64(cpu_ir[rc], cpu_ir[rb]); } } break; case 0x22: if (likely(rc != 31)) { if (ra != 31) { TCGv tmp = tcg_temp_new(TCG_TYPE_I64); tcg_gen_shli_i64(tmp, cpu_ir[ra], 2); if (islit) tcg_gen_addi_i64(cpu_ir[rc], tmp, lit); else tcg_gen_add_i64(cpu_ir[rc], tmp, cpu_ir[rb]); tcg_temp_free(tmp); } else { if (islit) tcg_gen_movi_i64(cpu_ir[rc], lit); else tcg_gen_mov_i64(cpu_ir[rc], cpu_ir[rb]); } } break; case 0x29: if (likely(rc != 31)) { if (ra != 31) { if (islit) tcg_gen_subi_i64(cpu_ir[rc], cpu_ir[ra], lit); else tcg_gen_sub_i64(cpu_ir[rc], cpu_ir[ra], cpu_ir[rb]); } else { if (islit) tcg_gen_movi_i64(cpu_ir[rc], -lit); else tcg_gen_neg_i64(cpu_ir[rc], cpu_ir[rb]); } } break; case 0x2B: if (likely(rc != 31)) { if (ra != 31) { TCGv tmp = tcg_temp_new(TCG_TYPE_I64); tcg_gen_shli_i64(tmp, cpu_ir[ra], 2); if (islit) tcg_gen_subi_i64(cpu_ir[rc], tmp, lit); else tcg_gen_sub_i64(cpu_ir[rc], tmp, cpu_ir[rb]); tcg_temp_free(tmp); } else { if (islit) tcg_gen_movi_i64(cpu_ir[rc], -lit); else tcg_gen_neg_i64(cpu_ir[rc], cpu_ir[rb]); } } break; case 0x2D: gen_cmp(TCG_COND_EQ, ra, rb, rc, islit, lit); break; case 0x32: if (likely(rc != 31)) { if (ra != 31) { TCGv tmp = tcg_temp_new(TCG_TYPE_I64); tcg_gen_shli_i64(tmp, cpu_ir[ra], 3); if (islit) tcg_gen_addi_i64(cpu_ir[rc], tmp, lit); else tcg_gen_add_i64(cpu_ir[rc], tmp, cpu_ir[rb]); tcg_temp_free(tmp); } else { if (islit) tcg_gen_movi_i64(cpu_ir[rc], lit); else tcg_gen_mov_i64(cpu_ir[rc], cpu_ir[rb]); } } break; case 0x3B: if (likely(rc != 31)) { if (ra != 31) { TCGv tmp = tcg_temp_new(TCG_TYPE_I64); tcg_gen_shli_i64(tmp, cpu_ir[ra], 3); if (islit) tcg_gen_subi_i64(cpu_ir[rc], tmp, lit); else tcg_gen_sub_i64(cpu_ir[rc], tmp, cpu_ir[rb]); tcg_temp_free(tmp); } else { if (islit) tcg_gen_movi_i64(cpu_ir[rc], -lit); else tcg_gen_neg_i64(cpu_ir[rc], cpu_ir[rb]); } } break; case 0x3D: gen_cmp(TCG_COND_LEU, ra, rb, rc, islit, lit); break; case 0x40: gen_arith3(helper_addlv, ra, rb, rc, islit, lit); break; case 0x49: gen_arith3(helper_sublv, ra, rb, rc, islit, lit); break; case 0x4D: gen_cmp(TCG_COND_LT, ra, rb, rc, islit, lit); break; case 0x60: gen_arith3(helper_addqv, ra, rb, rc, islit, lit); break; case 0x69: gen_arith3(helper_subqv, ra, rb, rc, islit, lit); break; case 0x6D: gen_cmp(TCG_COND_LE, ra, rb, rc, islit, lit); break; default: goto invalid_opc; } break; case 0x11: switch (fn7) { case 0x00: if (likely(rc != 31)) { if (ra == 31) tcg_gen_movi_i64(cpu_ir[rc], 0); else if (islit) tcg_gen_andi_i64(cpu_ir[rc], cpu_ir[ra], lit); else tcg_gen_and_i64(cpu_ir[rc], cpu_ir[ra], cpu_ir[rb]); } break; case 0x08: if (likely(rc != 31)) { if (ra != 31) { if (islit) tcg_gen_andi_i64(cpu_ir[rc], cpu_ir[ra], ~lit); else tcg_gen_andc_i64(cpu_ir[rc], cpu_ir[ra], cpu_ir[rb]); } else tcg_gen_movi_i64(cpu_ir[rc], 0); } break; case 0x14: gen_cmov(TCG_COND_EQ, ra, rb, rc, islit, lit, 1); break; case 0x16: gen_cmov(TCG_COND_NE, ra, rb, rc, islit, lit, 1); break; case 0x20: if (likely(rc != 31)) { if (ra != 31) { if (islit) tcg_gen_ori_i64(cpu_ir[rc], cpu_ir[ra], lit); else tcg_gen_or_i64(cpu_ir[rc], cpu_ir[ra], cpu_ir[rb]); } else { if (islit) tcg_gen_movi_i64(cpu_ir[rc], lit); else tcg_gen_mov_i64(cpu_ir[rc], cpu_ir[rb]); } } break; case 0x24: gen_cmov(TCG_COND_NE, ra, rb, rc, islit, lit, 0); break; case 0x26: gen_cmov(TCG_COND_EQ, ra, rb, rc, islit, lit, 0); break; case 0x28: if (likely(rc != 31)) { if (ra != 31) { if (islit) tcg_gen_ori_i64(cpu_ir[rc], cpu_ir[ra], ~lit); else tcg_gen_orc_i64(cpu_ir[rc], cpu_ir[ra], cpu_ir[rb]); } else { if (islit) tcg_gen_movi_i64(cpu_ir[rc], ~lit); else tcg_gen_not_i64(cpu_ir[rc], cpu_ir[rb]); } } break; case 0x40: if (likely(rc != 31)) { if (ra != 31) { if (islit) tcg_gen_xori_i64(cpu_ir[rc], cpu_ir[ra], lit); else tcg_gen_xor_i64(cpu_ir[rc], cpu_ir[ra], cpu_ir[rb]); } else { if (islit) tcg_gen_movi_i64(cpu_ir[rc], lit); else tcg_gen_mov_i64(cpu_ir[rc], cpu_ir[rb]); } } break; case 0x44: gen_cmov(TCG_COND_GE, ra, rb, rc, islit, lit, 0); break; case 0x46: gen_cmov(TCG_COND_LT, ra, rb, rc, islit, lit, 0); break; case 0x48: if (likely(rc != 31)) { if (ra != 31) { if (islit) tcg_gen_xori_i64(cpu_ir[rc], cpu_ir[ra], ~lit); else tcg_gen_eqv_i64(cpu_ir[rc], cpu_ir[ra], cpu_ir[rb]); } else { if (islit) tcg_gen_movi_i64(cpu_ir[rc], ~lit); else tcg_gen_not_i64(cpu_ir[rc], cpu_ir[rb]); } } break; case 0x61: if (likely(rc != 31)) { if (islit) tcg_gen_movi_i64(cpu_ir[rc], helper_amask(lit)); else tcg_gen_helper_1_1(helper_amask, cpu_ir[rc], cpu_ir[rb]); } break; case 0x64: gen_cmov(TCG_COND_GT, ra, rb, rc, islit, lit, 0); break; case 0x66: gen_cmov(TCG_COND_LE, ra, rb, rc, islit, lit, 0); break; case 0x6C: if (rc != 31) tcg_gen_helper_1_0(helper_load_implver, cpu_ir[rc]); break; default: goto invalid_opc; } break; case 0x12: switch (fn7) { case 0x02: gen_arith3(helper_mskbl, ra, rb, rc, islit, lit); break; case 0x06: gen_ext_l(&tcg_gen_ext8u_i64, ra, rb, rc, islit, lit); break; case 0x0B: gen_arith3(helper_insbl, ra, rb, rc, islit, lit); break; case 0x12: gen_arith3(helper_mskwl, ra, rb, rc, islit, lit); break; case 0x16: gen_ext_l(&tcg_gen_ext16u_i64, ra, rb, rc, islit, lit); break; case 0x1B: gen_arith3(helper_inswl, ra, rb, rc, islit, lit); break; case 0x22: gen_arith3(helper_mskll, ra, rb, rc, islit, lit); break; case 0x26: gen_ext_l(&tcg_gen_ext32u_i64, ra, rb, rc, islit, lit); break; case 0x2B: gen_arith3(helper_insll, ra, rb, rc, islit, lit); break; case 0x30: gen_arith3(helper_zap, ra, rb, rc, islit, lit); break; case 0x31: gen_arith3(helper_zapnot, ra, rb, rc, islit, lit); break; case 0x32: gen_arith3(helper_mskql, ra, rb, rc, islit, lit); break; case 0x34: if (likely(rc != 31)) { if (ra != 31) { if (islit) tcg_gen_shri_i64(cpu_ir[rc], cpu_ir[ra], lit & 0x3f); else { TCGv shift = tcg_temp_new(TCG_TYPE_I64); tcg_gen_andi_i64(shift, cpu_ir[rb], 0x3f); tcg_gen_shr_i64(cpu_ir[rc], cpu_ir[ra], shift); tcg_temp_free(shift); } } else tcg_gen_movi_i64(cpu_ir[rc], 0); } break; case 0x36: gen_ext_l(NULL, ra, rb, rc, islit, lit); break; case 0x39: if (likely(rc != 31)) { if (ra != 31) { if (islit) tcg_gen_shli_i64(cpu_ir[rc], cpu_ir[ra], lit & 0x3f); else { TCGv shift = tcg_temp_new(TCG_TYPE_I64); tcg_gen_andi_i64(shift, cpu_ir[rb], 0x3f); tcg_gen_shl_i64(cpu_ir[rc], cpu_ir[ra], shift); tcg_temp_free(shift); } } else tcg_gen_movi_i64(cpu_ir[rc], 0); } break; case 0x3B: gen_arith3(helper_insql, ra, rb, rc, islit, lit); break; case 0x3C: if (likely(rc != 31)) { if (ra != 31) { if (islit) tcg_gen_sari_i64(cpu_ir[rc], cpu_ir[ra], lit & 0x3f); else { TCGv shift = tcg_temp_new(TCG_TYPE_I64); tcg_gen_andi_i64(shift, cpu_ir[rb], 0x3f); tcg_gen_sar_i64(cpu_ir[rc], cpu_ir[ra], shift); tcg_temp_free(shift); } } else tcg_gen_movi_i64(cpu_ir[rc], 0); } break; case 0x52: gen_arith3(helper_mskwh, ra, rb, rc, islit, lit); break; case 0x57: gen_arith3(helper_inswh, ra, rb, rc, islit, lit); break; case 0x5A: gen_ext_h(&tcg_gen_ext16u_i64, ra, rb, rc, islit, lit); break; case 0x62: gen_arith3(helper_msklh, ra, rb, rc, islit, lit); break; case 0x67: gen_arith3(helper_inslh, ra, rb, rc, islit, lit); break; case 0x6A: gen_ext_h(&tcg_gen_ext16u_i64, ra, rb, rc, islit, lit); break; case 0x72: gen_arith3(helper_mskqh, ra, rb, rc, islit, lit); break; case 0x77: gen_arith3(helper_insqh, ra, rb, rc, islit, lit); break; case 0x7A: gen_ext_h(NULL, ra, rb, rc, islit, lit); break; default: goto invalid_opc; } break; case 0x13: switch (fn7) { case 0x00: if (likely(rc != 31)) { if (ra == 31) tcg_gen_movi_i64(cpu_ir[rc], 0); else { if (islit) tcg_gen_muli_i64(cpu_ir[rc], cpu_ir[ra], lit); else tcg_gen_mul_i64(cpu_ir[rc], cpu_ir[ra], cpu_ir[rb]); tcg_gen_ext32s_i64(cpu_ir[rc], cpu_ir[rc]); } } break; case 0x20: if (likely(rc != 31)) { if (ra == 31) tcg_gen_movi_i64(cpu_ir[rc], 0); else if (islit) tcg_gen_muli_i64(cpu_ir[rc], cpu_ir[ra], lit); else tcg_gen_mul_i64(cpu_ir[rc], cpu_ir[ra], cpu_ir[rb]); } break; case 0x30: gen_arith3(helper_umulh, ra, rb, rc, islit, lit); break; case 0x40: gen_arith3(helper_mullv, ra, rb, rc, islit, lit); break; case 0x60: gen_arith3(helper_mulqv, ra, rb, rc, islit, lit); break; default: goto invalid_opc; } break; case 0x14: switch (fpfn) { case 0x04: if (!(ctx->amask & AMASK_FIX)) goto invalid_opc; if (likely(rc != 31)) { if (ra != 31) { TCGv tmp = tcg_temp_new(TCG_TYPE_I32); tcg_gen_trunc_i64_i32(tmp, cpu_ir[ra]); tcg_gen_helper_1_1(helper_memory_to_s, cpu_fir[rc], tmp); tcg_temp_free(tmp); } else tcg_gen_movi_i64(cpu_fir[rc], 0); } break; case 0x0A: if (!(ctx->amask & AMASK_FIX)) goto invalid_opc; gen_farith2(&helper_sqrtf, rb, rc); break; case 0x0B: if (!(ctx->amask & AMASK_FIX)) goto invalid_opc; gen_farith2(&helper_sqrts, rb, rc); break; case 0x14: if (!(ctx->amask & AMASK_FIX)) goto invalid_opc; if (likely(rc != 31)) { if (ra != 31) { TCGv tmp = tcg_temp_new(TCG_TYPE_I32); tcg_gen_trunc_i64_i32(tmp, cpu_ir[ra]); tcg_gen_helper_1_1(helper_memory_to_f, cpu_fir[rc], tmp); tcg_temp_free(tmp); } else tcg_gen_movi_i64(cpu_fir[rc], 0); } break; case 0x24: if (!(ctx->amask & AMASK_FIX)) goto invalid_opc; if (likely(rc != 31)) { if (ra != 31) tcg_gen_mov_i64(cpu_fir[rc], cpu_ir[ra]); else tcg_gen_movi_i64(cpu_fir[rc], 0); } break; case 0x2A: if (!(ctx->amask & AMASK_FIX)) goto invalid_opc; gen_farith2(&helper_sqrtg, rb, rc); break; case 0x02B: if (!(ctx->amask & AMASK_FIX)) goto invalid_opc; gen_farith2(&helper_sqrtt, rb, rc); break; default: goto invalid_opc; } break; case 0x15: switch (fpfn) { case 0x00: gen_farith3(&helper_addf, ra, rb, rc); break; case 0x01: gen_farith3(&helper_subf, ra, rb, rc); break; case 0x02: gen_farith3(&helper_mulf, ra, rb, rc); break; case 0x03: gen_farith3(&helper_divf, ra, rb, rc); break; case 0x1E: #if 0 gen_farith2(&helper_cvtdg, rb, rc); #else goto invalid_opc; #endif break; case 0x20: gen_farith3(&helper_addg, ra, rb, rc); break; case 0x21: gen_farith3(&helper_subg, ra, rb, rc); break; case 0x22: gen_farith3(&helper_mulg, ra, rb, rc); break; case 0x23: gen_farith3(&helper_divg, ra, rb, rc); break; case 0x25: gen_farith3(&helper_cmpgeq, ra, rb, rc); break; case 0x26: gen_farith3(&helper_cmpglt, ra, rb, rc); break; case 0x27: gen_farith3(&helper_cmpgle, ra, rb, rc); break; case 0x2C: gen_farith2(&helper_cvtgf, rb, rc); break; case 0x2D: #if 0 gen_farith2(ctx, &helper_cvtgd, rb, rc); #else goto invalid_opc; #endif break; case 0x2F: gen_farith2(&helper_cvtgq, rb, rc); break; case 0x3C: gen_farith2(&helper_cvtqf, rb, rc); break; case 0x3E: gen_farith2(&helper_cvtqg, rb, rc); break; default: goto invalid_opc; } break; case 0x16: switch (fpfn) { case 0x00: gen_farith3(&helper_adds, ra, rb, rc); break; case 0x01: gen_farith3(&helper_subs, ra, rb, rc); break; case 0x02: gen_farith3(&helper_muls, ra, rb, rc); break; case 0x03: gen_farith3(&helper_divs, ra, rb, rc); break; case 0x20: gen_farith3(&helper_addt, ra, rb, rc); break; case 0x21: gen_farith3(&helper_subt, ra, rb, rc); break; case 0x22: gen_farith3(&helper_mult, ra, rb, rc); break; case 0x23: gen_farith3(&helper_divt, ra, rb, rc); break; case 0x24: gen_farith3(&helper_cmptun, ra, rb, rc); break; case 0x25: gen_farith3(&helper_cmpteq, ra, rb, rc); break; case 0x26: gen_farith3(&helper_cmptlt, ra, rb, rc); break; case 0x27: gen_farith3(&helper_cmptle, ra, rb, rc); break; case 0x2C: if (fn11 == 0x2AC) { gen_farith2(&helper_cvtst, rb, rc); } else { gen_farith2(&helper_cvtts, rb, rc); } break; case 0x2F: gen_farith2(&helper_cvttq, rb, rc); break; case 0x3C: gen_farith2(&helper_cvtqs, rb, rc); break; case 0x3E: gen_farith2(&helper_cvtqt, rb, rc); break; default: goto invalid_opc; } break; case 0x17: switch (fn11) { case 0x010: gen_farith2(&helper_cvtlq, rb, rc); break; case 0x020: if (likely(rc != 31)) { if (ra == rb) tcg_gen_mov_i64(cpu_fir[rc], cpu_fir[ra]); else gen_farith3(&helper_cpys, ra, rb, rc); } break; case 0x021: gen_farith3(&helper_cpysn, ra, rb, rc); break; case 0x022: gen_farith3(&helper_cpyse, ra, rb, rc); break; case 0x024: if (likely(ra != 31)) tcg_gen_helper_0_1(helper_store_fpcr, cpu_fir[ra]); else { TCGv tmp = tcg_const_i64(0); tcg_gen_helper_0_1(helper_store_fpcr, tmp); tcg_temp_free(tmp); } break; case 0x025: if (likely(ra != 31)) tcg_gen_helper_1_0(helper_load_fpcr, cpu_fir[ra]); break; case 0x02A: gen_fcmov(&helper_cmpfeq, ra, rb, rc); break; case 0x02B: gen_fcmov(&helper_cmpfne, ra, rb, rc); break; case 0x02C: gen_fcmov(&helper_cmpflt, ra, rb, rc); break; case 0x02D: gen_fcmov(&helper_cmpfge, ra, rb, rc); break; case 0x02E: gen_fcmov(&helper_cmpfle, ra, rb, rc); break; case 0x02F: gen_fcmov(&helper_cmpfgt, ra, rb, rc); break; case 0x030: gen_farith2(&helper_cvtql, rb, rc); break; case 0x130: gen_farith2(&helper_cvtqlv, rb, rc); break; case 0x530: gen_farith2(&helper_cvtqlsv, rb, rc); break; default: goto invalid_opc; } break; case 0x18: switch ((uint16_t)disp16) { case 0x0000: VAR_0 = 2; break; case 0x0400: VAR_0 = 2; break; case 0x4000: break; case 0x4400: break; case 0x8000: break; case 0xA000: break; case 0xC000: if (ra != 31) tcg_gen_helper_1_0(helper_load_pcc, cpu_ir[ra]); break; case 0xE000: if (ra != 31) tcg_gen_helper_1_0(helper_rc, cpu_ir[ra]); break; case 0xE800: #if 0 VAR_0 = 2; #else goto invalid_opc; #endif break; case 0xF000: if (ra != 31) tcg_gen_helper_1_0(helper_rs, cpu_ir[ra]); break; case 0xF800: break; default: goto invalid_opc; } break; case 0x19: #if defined (CONFIG_USER_ONLY) goto invalid_opc; #else if (!ctx->pal_mode) goto invalid_opc; if (ra != 31) { TCGv tmp = tcg_const_i32(insn & 0xFF); tcg_gen_helper_1_2(helper_mfpr, cpu_ir[ra], tmp, cpu_ir[ra]); tcg_temp_free(tmp); } break; #endif case 0x1A: if (ra != 31) tcg_gen_movi_i64(cpu_ir[ra], ctx->pc); if (rb != 31) tcg_gen_andi_i64(cpu_pc, cpu_ir[rb], ~3); else tcg_gen_movi_i64(cpu_pc, 0); switch (fn2) { case 0x0: break; case 0x1: break; case 0x2: break; case 0x3: break; } VAR_0 = 1; break; case 0x1B: #if defined (CONFIG_USER_ONLY) goto invalid_opc; #else if (!ctx->pal_mode) goto invalid_opc; if (ra != 31) { TCGv addr = tcg_temp_new(TCG_TYPE_I64); if (rb != 31) tcg_gen_addi_i64(addr, cpu_ir[rb], disp12); else tcg_gen_movi_i64(addr, disp12); switch ((insn >> 12) & 0xF) { case 0x0: tcg_gen_helper_0_2(helper_ldl_raw, cpu_ir[ra], addr); break; case 0x1: tcg_gen_helper_0_2(helper_ldq_raw, cpu_ir[ra], addr); break; case 0x2: tcg_gen_helper_0_2(helper_ldl_l_raw, cpu_ir[ra], addr); break; case 0x3: tcg_gen_helper_0_2(helper_ldq_l_raw, cpu_ir[ra], addr); break; case 0x4: tcg_gen_helper_0_2(helper_ldl_kernel, cpu_ir[ra], addr); break; case 0x5: tcg_gen_helper_0_2(helper_ldq_kernel, cpu_ir[ra], addr); break; case 0x6: goto incpu_ir[ra]id_opc; case 0x7: goto incpu_ir[ra]id_opc; case 0x8: tcg_gen_helper_1_1(helper_st_virt_to_phys, addr, addr); tcg_gen_helper_0_2(helper_ldl_raw, cpu_ir[ra], addr); break; case 0x9: tcg_gen_helper_1_1(helper_st_virt_to_phys, addr, addr); tcg_gen_helper_0_2(helper_ldq_raw, cpu_ir[ra], addr); break; case 0xA: tcg_gen_qemu_ld32s(cpu_ir[ra], addr, ctx->flags); break; case 0xB: tcg_gen_qemu_ld64(cpu_ir[ra], addr, ctx->flags); break; case 0xC: tcg_gen_helper_0_0(helper_set_alt_mode); tcg_gen_helper_1_1(helper_st_virt_to_phys, addr, addr); tcg_gen_helper_0_2(helper_ldl_raw, cpu_ir[ra], addr); tcg_gen_helper_0_0(helper_restore_mode); break; case 0xD: tcg_gen_helper_0_0(helper_set_alt_mode); tcg_gen_helper_1_1(helper_st_virt_to_phys, addr, addr); tcg_gen_helper_0_2(helper_ldq_raw, cpu_ir[ra], addr); tcg_gen_helper_0_0(helper_restore_mode); break; case 0xE: tcg_gen_helper_0_0(helper_set_alt_mode); tcg_gen_helper_0_2(helper_ldl_data, cpu_ir[ra], addr); tcg_gen_helper_0_0(helper_restore_mode); break; case 0xF: tcg_gen_helper_0_0(helper_set_alt_mode); tcg_gen_helper_0_2(helper_ldq_data, cpu_ir[ra], addr); tcg_gen_helper_0_0(helper_restore_mode); break; } tcg_temp_free(addr); } break; #endif case 0x1C: switch (fn7) { case 0x00: if (!(ctx->amask & AMASK_BWX)) goto invalid_opc; if (likely(rc != 31)) { if (islit) tcg_gen_movi_i64(cpu_ir[rc], (int64_t)((int8_t)lit)); else tcg_gen_ext8s_i64(cpu_ir[rc], cpu_ir[rb]); } break; case 0x01: if (!(ctx->amask & AMASK_BWX)) goto invalid_opc; if (likely(rc != 31)) { if (islit) tcg_gen_movi_i64(cpu_ir[rc], (int64_t)((int16_t)lit)); else tcg_gen_ext16s_i64(cpu_ir[rc], cpu_ir[rb]); } break; case 0x30: if (!(ctx->amask & AMASK_CIX)) goto invalid_opc; if (likely(rc != 31)) { if (islit) tcg_gen_movi_i64(cpu_ir[rc], ctpop64(lit)); else tcg_gen_helper_1_1(helper_ctpop, cpu_ir[rc], cpu_ir[rb]); } break; case 0x31: if (!(ctx->amask & AMASK_MVI)) goto invalid_opc; goto invalid_opc; break; case 0x32: if (!(ctx->amask & AMASK_CIX)) goto invalid_opc; if (likely(rc != 31)) { if (islit) tcg_gen_movi_i64(cpu_ir[rc], clz64(lit)); else tcg_gen_helper_1_1(helper_ctlz, cpu_ir[rc], cpu_ir[rb]); } break; case 0x33: if (!(ctx->amask & AMASK_CIX)) goto invalid_opc; if (likely(rc != 31)) { if (islit) tcg_gen_movi_i64(cpu_ir[rc], ctz64(lit)); else tcg_gen_helper_1_1(helper_cttz, cpu_ir[rc], cpu_ir[rb]); } break; case 0x34: if (!(ctx->amask & AMASK_MVI)) goto invalid_opc; goto invalid_opc; break; case 0x35: if (!(ctx->amask & AMASK_MVI)) goto invalid_opc; goto invalid_opc; break; case 0x36: if (!(ctx->amask & AMASK_MVI)) goto invalid_opc; goto invalid_opc; break; case 0x37: if (!(ctx->amask & AMASK_MVI)) goto invalid_opc; goto invalid_opc; break; case 0x38: if (!(ctx->amask & AMASK_MVI)) goto invalid_opc; goto invalid_opc; break; case 0x39: if (!(ctx->amask & AMASK_MVI)) goto invalid_opc; goto invalid_opc; break; case 0x3A: if (!(ctx->amask & AMASK_MVI)) goto invalid_opc; goto invalid_opc; break; case 0x3B: if (!(ctx->amask & AMASK_MVI)) goto invalid_opc; goto invalid_opc; break; case 0x3C: if (!(ctx->amask & AMASK_MVI)) goto invalid_opc; goto invalid_opc; break; case 0x3D: if (!(ctx->amask & AMASK_MVI)) goto invalid_opc; goto invalid_opc; break; case 0x3E: if (!(ctx->amask & AMASK_MVI)) goto invalid_opc; goto invalid_opc; break; case 0x3F: if (!(ctx->amask & AMASK_MVI)) goto invalid_opc; goto invalid_opc; break; case 0x70: if (!(ctx->amask & AMASK_FIX)) goto invalid_opc; if (likely(rc != 31)) { if (ra != 31) tcg_gen_mov_i64(cpu_ir[rc], cpu_fir[ra]); else tcg_gen_movi_i64(cpu_ir[rc], 0); } break; case 0x78: if (!(ctx->amask & AMASK_FIX)) goto invalid_opc; if (rc != 31) { TCGv tmp1 = tcg_temp_new(TCG_TYPE_I32); if (ra != 31) tcg_gen_helper_1_1(helper_s_to_memory, tmp1, cpu_fir[ra]); else { TCGv tmp2 = tcg_const_i64(0); tcg_gen_helper_1_1(helper_s_to_memory, tmp1, tmp2); tcg_temp_free(tmp2); } tcg_gen_ext_i32_i64(cpu_ir[rc], tmp1); tcg_temp_free(tmp1); } break; default: goto invalid_opc; } break; case 0x1D: #if defined (CONFIG_USER_ONLY) goto invalid_opc; #else if (!ctx->pal_mode) goto invalid_opc; else { TCGv tmp1 = tcg_const_i32(insn & 0xFF); if (ra != 31) tcg_gen_helper(helper_mtpr, tmp1, cpu_ir[ra]); else { TCGv tmp2 = tcg_const_i64(0); tcg_gen_helper(helper_mtpr, tmp1, tmp2); tcg_temp_free(tmp2); } tcg_temp_free(tmp1); VAR_0 = 2; } break; #endif case 0x1E: #if defined (CONFIG_USER_ONLY) goto invalid_opc; #else if (!ctx->pal_mode) goto invalid_opc; if (rb == 31) { tcg_gen_helper_0_0(helper_hw_rei); } else { TCGv tmp; if (ra != 31) { tmp = tcg_temp_new(TCG_TYPE_I64); tcg_gen_addi_i64(tmp, cpu_ir[rb], (((int64_t)insn << 51) >> 51)); } else tmp = tcg_const_i64(((int64_t)insn << 51) >> 51); tcg_gen_helper_0_1(helper_hw_ret, tmp); tcg_temp_free(tmp); } VAR_0 = 2; break; #endif case 0x1F: #if defined (CONFIG_USER_ONLY) goto invalid_opc; #else if (!ctx->pal_mode) goto invalid_opc; else { TCGv addr, val; addr = tcg_temp_new(TCG_TYPE_I64); if (rb != 31) tcg_gen_addi_i64(addr, cpu_ir[rb], disp12); else tcg_gen_movi_i64(addr, disp12); if (ra != 31) val = cpu_ir[ra]; else { val = tcg_temp_new(TCG_TYPE_I64); tcg_gen_movi_i64(val, 0); } switch ((insn >> 12) & 0xF) { case 0x0: tcg_gen_helper_0_2(helper_stl_raw, val, addr); break; case 0x1: tcg_gen_helper_0_2(helper_stq_raw, val, addr); break; case 0x2: tcg_gen_helper_1_2(helper_stl_c_raw, val, val, addr); break; case 0x3: tcg_gen_helper_1_2(helper_stq_c_raw, val, val, addr); break; case 0x4: tcg_gen_helper_1_1(helper_st_virt_to_phys, addr, addr); tcg_gen_helper_0_2(helper_stl_raw, val, addr); break; case 0x5: tcg_gen_helper_1_1(helper_st_virt_to_phys, addr, addr); tcg_gen_helper_0_2(helper_stq_raw, val, addr); break; case 0x6: goto invalid_opc; case 0x7: goto invalid_opc; case 0x8: goto invalid_opc; case 0x9: goto invalid_opc; case 0xA: goto invalid_opc; case 0xB: goto invalid_opc; case 0xC: tcg_gen_helper_0_0(helper_set_alt_mode); tcg_gen_helper_1_1(helper_st_virt_to_phys, addr, addr); tcg_gen_helper_0_2(helper_stl_raw, val, addr); tcg_gen_helper_0_0(helper_restore_mode); break; case 0xD: tcg_gen_helper_0_0(helper_set_alt_mode); tcg_gen_helper_1_1(helper_st_virt_to_phys, addr, addr); tcg_gen_helper_0_2(helper_stl_raw, val, addr); tcg_gen_helper_0_0(helper_restore_mode); break; case 0xE: goto invalid_opc; case 0xF: goto invalid_opc; } if (ra != 31) tcg_temp_free(val); tcg_temp_free(addr); } VAR_0 = 2; break; #endif case 0x20: gen_load_mem(ctx, &gen_qemu_ldf, ra, rb, disp16, 1, 0); break; case 0x21: gen_load_mem(ctx, &gen_qemu_ldg, ra, rb, disp16, 1, 0); break; case 0x22: gen_load_mem(ctx, &gen_qemu_lds, ra, rb, disp16, 1, 0); break; case 0x23: gen_load_mem(ctx, &tcg_gen_qemu_ld64, ra, rb, disp16, 1, 0); break; case 0x24: gen_store_mem(ctx, &gen_qemu_stf, ra, rb, disp16, 1, 0); break; case 0x25: gen_store_mem(ctx, &gen_qemu_stg, ra, rb, disp16, 1, 0); break; case 0x26: gen_store_mem(ctx, &gen_qemu_sts, ra, rb, disp16, 1, 0); break; case 0x27: gen_store_mem(ctx, &tcg_gen_qemu_st64, ra, rb, disp16, 1, 0); break; case 0x28: gen_load_mem(ctx, &tcg_gen_qemu_ld32s, ra, rb, disp16, 0, 0); break; case 0x29: gen_load_mem(ctx, &tcg_gen_qemu_ld64, ra, rb, disp16, 0, 0); break; case 0x2A: gen_load_mem(ctx, &gen_qemu_ldl_l, ra, rb, disp16, 0, 0); break; case 0x2B: gen_load_mem(ctx, &gen_qemu_ldq_l, ra, rb, disp16, 0, 0); break; case 0x2C: gen_store_mem(ctx, &tcg_gen_qemu_st32, ra, rb, disp16, 0, 0); break; case 0x2D: gen_store_mem(ctx, &tcg_gen_qemu_st64, ra, rb, disp16, 0, 0); break; case 0x2E: gen_store_mem(ctx, &gen_qemu_stl_c, ra, rb, disp16, 0, 0); break; case 0x2F: gen_store_mem(ctx, &gen_qemu_stq_c, ra, rb, disp16, 0, 0); break; case 0x30: if (ra != 31) tcg_gen_movi_i64(cpu_ir[ra], ctx->pc); tcg_gen_movi_i64(cpu_pc, ctx->pc + (int64_t)(disp21 << 2)); VAR_0 = 1; break; case 0x31: gen_fbcond(ctx, &helper_cmpfeq, ra, disp16); VAR_0 = 1; break; case 0x32: gen_fbcond(ctx, &helper_cmpflt, ra, disp16); VAR_0 = 1; break; case 0x33: gen_fbcond(ctx, &helper_cmpfle, ra, disp16); VAR_0 = 1; break; case 0x34: if (ra != 31) tcg_gen_movi_i64(cpu_ir[ra], ctx->pc); tcg_gen_movi_i64(cpu_pc, ctx->pc + (int64_t)(disp21 << 2)); VAR_0 = 1; break; case 0x35: gen_fbcond(ctx, &helper_cmpfne, ra, disp16); VAR_0 = 1; break; case 0x36: gen_fbcond(ctx, &helper_cmpfge, ra, disp16); VAR_0 = 1; break; case 0x37: gen_fbcond(ctx, &helper_cmpfgt, ra, disp16); VAR_0 = 1; break; case 0x38: gen_bcond(ctx, TCG_COND_EQ, ra, disp16, 1); VAR_0 = 1; break; case 0x39: gen_bcond(ctx, TCG_COND_EQ, ra, disp16, 0); VAR_0 = 1; break; case 0x3A: gen_bcond(ctx, TCG_COND_LT, ra, disp16, 0); VAR_0 = 1; break; case 0x3B: gen_bcond(ctx, TCG_COND_LE, ra, disp16, 0); VAR_0 = 1; break; case 0x3C: gen_bcond(ctx, TCG_COND_NE, ra, disp16, 1); VAR_0 = 1; break; case 0x3D: gen_bcond(ctx, TCG_COND_NE, ra, disp16, 0); VAR_0 = 1; break; case 0x3E: gen_bcond(ctx, TCG_COND_GE, ra, disp16, 0); VAR_0 = 1; break; case 0x3F: gen_bcond(ctx, TCG_COND_GT, ra, disp16, 0); VAR_0 = 1; break; invalid_opc: gen_invalid(ctx); VAR_0 = 3; break; } return VAR_0; }
[ "static always_inline int FUNC_0 (DisasContext *ctx, uint32_t insn)\n{", "uint32_t palcode;", "int32_t disp21, disp16, disp12;", "uint16_t fn11, fn16;", "uint8_t opc, ra, rb, rc, sbz, fpfn, fn7, fn2, islit;", "uint8_t lit;", "int VAR_0;", "opc = insn >> 26;", "ra = (insn >> 21) & 0x1F;", "rb = (insn >> 16) & 0x1F;", "rc = insn & 0x1F;", "sbz = (insn >> 13) & 0x07;", "islit = (insn >> 12) & 1;", "if (rb == 31 && !islit) {", "islit = 1;", "lit = 0;", "} else", "lit = (insn >> 13) & 0xFF;", "palcode = insn & 0x03FFFFFF;", "disp21 = ((int32_t)((insn & 0x001FFFFF) << 11)) >> 11;", "disp16 = (int16_t)(insn & 0x0000FFFF);", "disp12 = (int32_t)((insn & 0x00000FFF) << 20) >> 20;", "fn16 = insn & 0x0000FFFF;", "fn11 = (insn >> 5) & 0x000007FF;", "fpfn = fn11 & 0x3F;", "fn7 = (insn >> 5) & 0x0000007F;", "fn2 = (insn >> 5) & 0x00000003;", "VAR_0 = 0;", "#if defined ALPHA_DEBUG_DISAS\nif (logfile != NULL) {", "fprintf(logfile, \"opc %02x ra %d rb %d rc %d disp16 %04x\\n\",\nopc, ra, rb, rc, disp16);", "}", "#endif\nswitch (opc) {", "case 0x00:\nif (palcode >= 0x80 && palcode < 0xC0) {", "gen_excp(ctx, EXCP_CALL_PAL + ((palcode & 0x1F) << 6), 0);", "#if !defined (CONFIG_USER_ONLY)\n} else if (palcode < 0x40) {", "if (ctx->mem_idx & 1)\ngoto invalid_opc;", "else\ngen_excp(ctx, EXCP_CALL_PALP + ((palcode & 0x1F) << 6), 0);", "#endif\n} else {", "goto invalid_opc;", "}", "VAR_0 = 3;", "break;", "case 0x01:\ngoto invalid_opc;", "case 0x02:\ngoto invalid_opc;", "case 0x03:\ngoto invalid_opc;", "case 0x04:\ngoto invalid_opc;", "case 0x05:\ngoto invalid_opc;", "case 0x06:\ngoto invalid_opc;", "case 0x07:\ngoto invalid_opc;", "case 0x08:\nif (likely(ra != 31)) {", "if (rb != 31)\ntcg_gen_addi_i64(cpu_ir[ra], cpu_ir[rb], disp16);", "else\ntcg_gen_movi_i64(cpu_ir[ra], disp16);", "}", "break;", "case 0x09:\nif (likely(ra != 31)) {", "if (rb != 31)\ntcg_gen_addi_i64(cpu_ir[ra], cpu_ir[rb], disp16 << 16);", "else\ntcg_gen_movi_i64(cpu_ir[ra], disp16 << 16);", "}", "break;", "case 0x0A:\nif (!(ctx->amask & AMASK_BWX))\ngoto invalid_opc;", "gen_load_mem(ctx, &tcg_gen_qemu_ld8u, ra, rb, disp16, 0, 0);", "break;", "case 0x0B:\ngen_load_mem(ctx, &tcg_gen_qemu_ld64, ra, rb, disp16, 0, 1);", "break;", "case 0x0C:\nif (!(ctx->amask & AMASK_BWX))\ngoto invalid_opc;", "gen_load_mem(ctx, &tcg_gen_qemu_ld16u, ra, rb, disp16, 0, 1);", "break;", "case 0x0D:\ngen_store_mem(ctx, &tcg_gen_qemu_st16, ra, rb, disp16, 0, 0);", "break;", "case 0x0E:\ngen_store_mem(ctx, &tcg_gen_qemu_st8, ra, rb, disp16, 0, 0);", "break;", "case 0x0F:\ngen_store_mem(ctx, &tcg_gen_qemu_st64, ra, rb, disp16, 0, 1);", "break;", "case 0x10:\nswitch (fn7) {", "case 0x00:\nif (likely(rc != 31)) {", "if (ra != 31) {", "if (islit) {", "tcg_gen_addi_i64(cpu_ir[rc], cpu_ir[ra], lit);", "tcg_gen_ext32s_i64(cpu_ir[rc], cpu_ir[rc]);", "} else {", "tcg_gen_add_i64(cpu_ir[rc], cpu_ir[ra], cpu_ir[rb]);", "tcg_gen_ext32s_i64(cpu_ir[rc], cpu_ir[rc]);", "}", "} else {", "if (islit)\ntcg_gen_movi_i64(cpu_ir[rc], lit);", "else\ntcg_gen_ext32s_i64(cpu_ir[rc], cpu_ir[rb]);", "}", "}", "break;", "case 0x02:\nif (likely(rc != 31)) {", "if (ra != 31) {", "TCGv tmp = tcg_temp_new(TCG_TYPE_I64);", "tcg_gen_shli_i64(tmp, cpu_ir[ra], 2);", "if (islit)\ntcg_gen_addi_i64(tmp, tmp, lit);", "else\ntcg_gen_add_i64(tmp, tmp, cpu_ir[rb]);", "tcg_gen_ext32s_i64(cpu_ir[rc], tmp);", "tcg_temp_free(tmp);", "} else {", "if (islit)\ntcg_gen_movi_i64(cpu_ir[rc], lit);", "else\ntcg_gen_ext32s_i64(cpu_ir[rc], cpu_ir[rb]);", "}", "}", "break;", "case 0x09:\nif (likely(rc != 31)) {", "if (ra != 31) {", "if (islit)\ntcg_gen_subi_i64(cpu_ir[rc], cpu_ir[ra], lit);", "else\ntcg_gen_sub_i64(cpu_ir[rc], cpu_ir[ra], cpu_ir[rb]);", "tcg_gen_ext32s_i64(cpu_ir[rc], cpu_ir[rc]);", "} else {", "if (islit)\ntcg_gen_movi_i64(cpu_ir[rc], -lit);", "else {", "tcg_gen_neg_i64(cpu_ir[rc], cpu_ir[rb]);", "tcg_gen_ext32s_i64(cpu_ir[rc], cpu_ir[rc]);", "}", "}", "break;", "case 0x0B:\nif (likely(rc != 31)) {", "if (ra != 31) {", "TCGv tmp = tcg_temp_new(TCG_TYPE_I64);", "tcg_gen_shli_i64(tmp, cpu_ir[ra], 2);", "if (islit)\ntcg_gen_subi_i64(tmp, tmp, lit);", "else\ntcg_gen_sub_i64(tmp, tmp, cpu_ir[rb]);", "tcg_gen_ext32s_i64(cpu_ir[rc], tmp);", "tcg_temp_free(tmp);", "} else {", "if (islit)\ntcg_gen_movi_i64(cpu_ir[rc], -lit);", "else {", "tcg_gen_neg_i64(cpu_ir[rc], cpu_ir[rb]);", "tcg_gen_ext32s_i64(cpu_ir[rc], cpu_ir[rc]);", "}", "}", "}", "break;", "case 0x0F:\ngen_arith3(helper_cmpbge, ra, rb, rc, islit, lit);", "break;", "case 0x12:\nif (likely(rc != 31)) {", "if (ra != 31) {", "TCGv tmp = tcg_temp_new(TCG_TYPE_I64);", "tcg_gen_shli_i64(tmp, cpu_ir[ra], 3);", "if (islit)\ntcg_gen_addi_i64(tmp, tmp, lit);", "else\ntcg_gen_add_i64(tmp, tmp, cpu_ir[rb]);", "tcg_gen_ext32s_i64(cpu_ir[rc], tmp);", "tcg_temp_free(tmp);", "} else {", "if (islit)\ntcg_gen_movi_i64(cpu_ir[rc], lit);", "else\ntcg_gen_ext32s_i64(cpu_ir[rc], cpu_ir[rb]);", "}", "}", "break;", "case 0x1B:\nif (likely(rc != 31)) {", "if (ra != 31) {", "TCGv tmp = tcg_temp_new(TCG_TYPE_I64);", "tcg_gen_shli_i64(tmp, cpu_ir[ra], 3);", "if (islit)\ntcg_gen_subi_i64(tmp, tmp, lit);", "else\ntcg_gen_sub_i64(tmp, tmp, cpu_ir[rb]);", "tcg_gen_ext32s_i64(cpu_ir[rc], tmp);", "tcg_temp_free(tmp);", "} else {", "if (islit)\ntcg_gen_movi_i64(cpu_ir[rc], -lit);", "else\ntcg_gen_neg_i64(cpu_ir[rc], cpu_ir[rb]);", "tcg_gen_ext32s_i64(cpu_ir[rc], cpu_ir[rc]);", "}", "}", "}", "break;", "case 0x1D:\ngen_cmp(TCG_COND_LTU, ra, rb, rc, islit, lit);", "break;", "case 0x20:\nif (likely(rc != 31)) {", "if (ra != 31) {", "if (islit)\ntcg_gen_addi_i64(cpu_ir[rc], cpu_ir[ra], lit);", "else\ntcg_gen_add_i64(cpu_ir[rc], cpu_ir[ra], cpu_ir[rb]);", "} else {", "if (islit)\ntcg_gen_movi_i64(cpu_ir[rc], lit);", "else\ntcg_gen_mov_i64(cpu_ir[rc], cpu_ir[rb]);", "}", "}", "break;", "case 0x22:\nif (likely(rc != 31)) {", "if (ra != 31) {", "TCGv tmp = tcg_temp_new(TCG_TYPE_I64);", "tcg_gen_shli_i64(tmp, cpu_ir[ra], 2);", "if (islit)\ntcg_gen_addi_i64(cpu_ir[rc], tmp, lit);", "else\ntcg_gen_add_i64(cpu_ir[rc], tmp, cpu_ir[rb]);", "tcg_temp_free(tmp);", "} else {", "if (islit)\ntcg_gen_movi_i64(cpu_ir[rc], lit);", "else\ntcg_gen_mov_i64(cpu_ir[rc], cpu_ir[rb]);", "}", "}", "break;", "case 0x29:\nif (likely(rc != 31)) {", "if (ra != 31) {", "if (islit)\ntcg_gen_subi_i64(cpu_ir[rc], cpu_ir[ra], lit);", "else\ntcg_gen_sub_i64(cpu_ir[rc], cpu_ir[ra], cpu_ir[rb]);", "} else {", "if (islit)\ntcg_gen_movi_i64(cpu_ir[rc], -lit);", "else\ntcg_gen_neg_i64(cpu_ir[rc], cpu_ir[rb]);", "}", "}", "break;", "case 0x2B:\nif (likely(rc != 31)) {", "if (ra != 31) {", "TCGv tmp = tcg_temp_new(TCG_TYPE_I64);", "tcg_gen_shli_i64(tmp, cpu_ir[ra], 2);", "if (islit)\ntcg_gen_subi_i64(cpu_ir[rc], tmp, lit);", "else\ntcg_gen_sub_i64(cpu_ir[rc], tmp, cpu_ir[rb]);", "tcg_temp_free(tmp);", "} else {", "if (islit)\ntcg_gen_movi_i64(cpu_ir[rc], -lit);", "else\ntcg_gen_neg_i64(cpu_ir[rc], cpu_ir[rb]);", "}", "}", "break;", "case 0x2D:\ngen_cmp(TCG_COND_EQ, ra, rb, rc, islit, lit);", "break;", "case 0x32:\nif (likely(rc != 31)) {", "if (ra != 31) {", "TCGv tmp = tcg_temp_new(TCG_TYPE_I64);", "tcg_gen_shli_i64(tmp, cpu_ir[ra], 3);", "if (islit)\ntcg_gen_addi_i64(cpu_ir[rc], tmp, lit);", "else\ntcg_gen_add_i64(cpu_ir[rc], tmp, cpu_ir[rb]);", "tcg_temp_free(tmp);", "} else {", "if (islit)\ntcg_gen_movi_i64(cpu_ir[rc], lit);", "else\ntcg_gen_mov_i64(cpu_ir[rc], cpu_ir[rb]);", "}", "}", "break;", "case 0x3B:\nif (likely(rc != 31)) {", "if (ra != 31) {", "TCGv tmp = tcg_temp_new(TCG_TYPE_I64);", "tcg_gen_shli_i64(tmp, cpu_ir[ra], 3);", "if (islit)\ntcg_gen_subi_i64(cpu_ir[rc], tmp, lit);", "else\ntcg_gen_sub_i64(cpu_ir[rc], tmp, cpu_ir[rb]);", "tcg_temp_free(tmp);", "} else {", "if (islit)\ntcg_gen_movi_i64(cpu_ir[rc], -lit);", "else\ntcg_gen_neg_i64(cpu_ir[rc], cpu_ir[rb]);", "}", "}", "break;", "case 0x3D:\ngen_cmp(TCG_COND_LEU, ra, rb, rc, islit, lit);", "break;", "case 0x40:\ngen_arith3(helper_addlv, ra, rb, rc, islit, lit);", "break;", "case 0x49:\ngen_arith3(helper_sublv, ra, rb, rc, islit, lit);", "break;", "case 0x4D:\ngen_cmp(TCG_COND_LT, ra, rb, rc, islit, lit);", "break;", "case 0x60:\ngen_arith3(helper_addqv, ra, rb, rc, islit, lit);", "break;", "case 0x69:\ngen_arith3(helper_subqv, ra, rb, rc, islit, lit);", "break;", "case 0x6D:\ngen_cmp(TCG_COND_LE, ra, rb, rc, islit, lit);", "break;", "default:\ngoto invalid_opc;", "}", "break;", "case 0x11:\nswitch (fn7) {", "case 0x00:\nif (likely(rc != 31)) {", "if (ra == 31)\ntcg_gen_movi_i64(cpu_ir[rc], 0);", "else if (islit)\ntcg_gen_andi_i64(cpu_ir[rc], cpu_ir[ra], lit);", "else\ntcg_gen_and_i64(cpu_ir[rc], cpu_ir[ra], cpu_ir[rb]);", "}", "break;", "case 0x08:\nif (likely(rc != 31)) {", "if (ra != 31) {", "if (islit)\ntcg_gen_andi_i64(cpu_ir[rc], cpu_ir[ra], ~lit);", "else\ntcg_gen_andc_i64(cpu_ir[rc], cpu_ir[ra], cpu_ir[rb]);", "} else", "tcg_gen_movi_i64(cpu_ir[rc], 0);", "}", "break;", "case 0x14:\ngen_cmov(TCG_COND_EQ, ra, rb, rc, islit, lit, 1);", "break;", "case 0x16:\ngen_cmov(TCG_COND_NE, ra, rb, rc, islit, lit, 1);", "break;", "case 0x20:\nif (likely(rc != 31)) {", "if (ra != 31) {", "if (islit)\ntcg_gen_ori_i64(cpu_ir[rc], cpu_ir[ra], lit);", "else\ntcg_gen_or_i64(cpu_ir[rc], cpu_ir[ra], cpu_ir[rb]);", "} else {", "if (islit)\ntcg_gen_movi_i64(cpu_ir[rc], lit);", "else\ntcg_gen_mov_i64(cpu_ir[rc], cpu_ir[rb]);", "}", "}", "break;", "case 0x24:\ngen_cmov(TCG_COND_NE, ra, rb, rc, islit, lit, 0);", "break;", "case 0x26:\ngen_cmov(TCG_COND_EQ, ra, rb, rc, islit, lit, 0);", "break;", "case 0x28:\nif (likely(rc != 31)) {", "if (ra != 31) {", "if (islit)\ntcg_gen_ori_i64(cpu_ir[rc], cpu_ir[ra], ~lit);", "else\ntcg_gen_orc_i64(cpu_ir[rc], cpu_ir[ra], cpu_ir[rb]);", "} else {", "if (islit)\ntcg_gen_movi_i64(cpu_ir[rc], ~lit);", "else\ntcg_gen_not_i64(cpu_ir[rc], cpu_ir[rb]);", "}", "}", "break;", "case 0x40:\nif (likely(rc != 31)) {", "if (ra != 31) {", "if (islit)\ntcg_gen_xori_i64(cpu_ir[rc], cpu_ir[ra], lit);", "else\ntcg_gen_xor_i64(cpu_ir[rc], cpu_ir[ra], cpu_ir[rb]);", "} else {", "if (islit)\ntcg_gen_movi_i64(cpu_ir[rc], lit);", "else\ntcg_gen_mov_i64(cpu_ir[rc], cpu_ir[rb]);", "}", "}", "break;", "case 0x44:\ngen_cmov(TCG_COND_GE, ra, rb, rc, islit, lit, 0);", "break;", "case 0x46:\ngen_cmov(TCG_COND_LT, ra, rb, rc, islit, lit, 0);", "break;", "case 0x48:\nif (likely(rc != 31)) {", "if (ra != 31) {", "if (islit)\ntcg_gen_xori_i64(cpu_ir[rc], cpu_ir[ra], ~lit);", "else\ntcg_gen_eqv_i64(cpu_ir[rc], cpu_ir[ra], cpu_ir[rb]);", "} else {", "if (islit)\ntcg_gen_movi_i64(cpu_ir[rc], ~lit);", "else\ntcg_gen_not_i64(cpu_ir[rc], cpu_ir[rb]);", "}", "}", "break;", "case 0x61:\nif (likely(rc != 31)) {", "if (islit)\ntcg_gen_movi_i64(cpu_ir[rc], helper_amask(lit));", "else\ntcg_gen_helper_1_1(helper_amask, cpu_ir[rc], cpu_ir[rb]);", "}", "break;", "case 0x64:\ngen_cmov(TCG_COND_GT, ra, rb, rc, islit, lit, 0);", "break;", "case 0x66:\ngen_cmov(TCG_COND_LE, ra, rb, rc, islit, lit, 0);", "break;", "case 0x6C:\nif (rc != 31)\ntcg_gen_helper_1_0(helper_load_implver, cpu_ir[rc]);", "break;", "default:\ngoto invalid_opc;", "}", "break;", "case 0x12:\nswitch (fn7) {", "case 0x02:\ngen_arith3(helper_mskbl, ra, rb, rc, islit, lit);", "break;", "case 0x06:\ngen_ext_l(&tcg_gen_ext8u_i64, ra, rb, rc, islit, lit);", "break;", "case 0x0B:\ngen_arith3(helper_insbl, ra, rb, rc, islit, lit);", "break;", "case 0x12:\ngen_arith3(helper_mskwl, ra, rb, rc, islit, lit);", "break;", "case 0x16:\ngen_ext_l(&tcg_gen_ext16u_i64, ra, rb, rc, islit, lit);", "break;", "case 0x1B:\ngen_arith3(helper_inswl, ra, rb, rc, islit, lit);", "break;", "case 0x22:\ngen_arith3(helper_mskll, ra, rb, rc, islit, lit);", "break;", "case 0x26:\ngen_ext_l(&tcg_gen_ext32u_i64, ra, rb, rc, islit, lit);", "break;", "case 0x2B:\ngen_arith3(helper_insll, ra, rb, rc, islit, lit);", "break;", "case 0x30:\ngen_arith3(helper_zap, ra, rb, rc, islit, lit);", "break;", "case 0x31:\ngen_arith3(helper_zapnot, ra, rb, rc, islit, lit);", "break;", "case 0x32:\ngen_arith3(helper_mskql, ra, rb, rc, islit, lit);", "break;", "case 0x34:\nif (likely(rc != 31)) {", "if (ra != 31) {", "if (islit)\ntcg_gen_shri_i64(cpu_ir[rc], cpu_ir[ra], lit & 0x3f);", "else {", "TCGv shift = tcg_temp_new(TCG_TYPE_I64);", "tcg_gen_andi_i64(shift, cpu_ir[rb], 0x3f);", "tcg_gen_shr_i64(cpu_ir[rc], cpu_ir[ra], shift);", "tcg_temp_free(shift);", "}", "} else", "tcg_gen_movi_i64(cpu_ir[rc], 0);", "}", "break;", "case 0x36:\ngen_ext_l(NULL, ra, rb, rc, islit, lit);", "break;", "case 0x39:\nif (likely(rc != 31)) {", "if (ra != 31) {", "if (islit)\ntcg_gen_shli_i64(cpu_ir[rc], cpu_ir[ra], lit & 0x3f);", "else {", "TCGv shift = tcg_temp_new(TCG_TYPE_I64);", "tcg_gen_andi_i64(shift, cpu_ir[rb], 0x3f);", "tcg_gen_shl_i64(cpu_ir[rc], cpu_ir[ra], shift);", "tcg_temp_free(shift);", "}", "} else", "tcg_gen_movi_i64(cpu_ir[rc], 0);", "}", "break;", "case 0x3B:\ngen_arith3(helper_insql, ra, rb, rc, islit, lit);", "break;", "case 0x3C:\nif (likely(rc != 31)) {", "if (ra != 31) {", "if (islit)\ntcg_gen_sari_i64(cpu_ir[rc], cpu_ir[ra], lit & 0x3f);", "else {", "TCGv shift = tcg_temp_new(TCG_TYPE_I64);", "tcg_gen_andi_i64(shift, cpu_ir[rb], 0x3f);", "tcg_gen_sar_i64(cpu_ir[rc], cpu_ir[ra], shift);", "tcg_temp_free(shift);", "}", "} else", "tcg_gen_movi_i64(cpu_ir[rc], 0);", "}", "break;", "case 0x52:\ngen_arith3(helper_mskwh, ra, rb, rc, islit, lit);", "break;", "case 0x57:\ngen_arith3(helper_inswh, ra, rb, rc, islit, lit);", "break;", "case 0x5A:\ngen_ext_h(&tcg_gen_ext16u_i64, ra, rb, rc, islit, lit);", "break;", "case 0x62:\ngen_arith3(helper_msklh, ra, rb, rc, islit, lit);", "break;", "case 0x67:\ngen_arith3(helper_inslh, ra, rb, rc, islit, lit);", "break;", "case 0x6A:\ngen_ext_h(&tcg_gen_ext16u_i64, ra, rb, rc, islit, lit);", "break;", "case 0x72:\ngen_arith3(helper_mskqh, ra, rb, rc, islit, lit);", "break;", "case 0x77:\ngen_arith3(helper_insqh, ra, rb, rc, islit, lit);", "break;", "case 0x7A:\ngen_ext_h(NULL, ra, rb, rc, islit, lit);", "break;", "default:\ngoto invalid_opc;", "}", "break;", "case 0x13:\nswitch (fn7) {", "case 0x00:\nif (likely(rc != 31)) {", "if (ra == 31)\ntcg_gen_movi_i64(cpu_ir[rc], 0);", "else {", "if (islit)\ntcg_gen_muli_i64(cpu_ir[rc], cpu_ir[ra], lit);", "else\ntcg_gen_mul_i64(cpu_ir[rc], cpu_ir[ra], cpu_ir[rb]);", "tcg_gen_ext32s_i64(cpu_ir[rc], cpu_ir[rc]);", "}", "}", "break;", "case 0x20:\nif (likely(rc != 31)) {", "if (ra == 31)\ntcg_gen_movi_i64(cpu_ir[rc], 0);", "else if (islit)\ntcg_gen_muli_i64(cpu_ir[rc], cpu_ir[ra], lit);", "else\ntcg_gen_mul_i64(cpu_ir[rc], cpu_ir[ra], cpu_ir[rb]);", "}", "break;", "case 0x30:\ngen_arith3(helper_umulh, ra, rb, rc, islit, lit);", "break;", "case 0x40:\ngen_arith3(helper_mullv, ra, rb, rc, islit, lit);", "break;", "case 0x60:\ngen_arith3(helper_mulqv, ra, rb, rc, islit, lit);", "break;", "default:\ngoto invalid_opc;", "}", "break;", "case 0x14:\nswitch (fpfn) {", "case 0x04:\nif (!(ctx->amask & AMASK_FIX))\ngoto invalid_opc;", "if (likely(rc != 31)) {", "if (ra != 31) {", "TCGv tmp = tcg_temp_new(TCG_TYPE_I32);", "tcg_gen_trunc_i64_i32(tmp, cpu_ir[ra]);", "tcg_gen_helper_1_1(helper_memory_to_s, cpu_fir[rc], tmp);", "tcg_temp_free(tmp);", "} else", "tcg_gen_movi_i64(cpu_fir[rc], 0);", "}", "break;", "case 0x0A:\nif (!(ctx->amask & AMASK_FIX))\ngoto invalid_opc;", "gen_farith2(&helper_sqrtf, rb, rc);", "break;", "case 0x0B:\nif (!(ctx->amask & AMASK_FIX))\ngoto invalid_opc;", "gen_farith2(&helper_sqrts, rb, rc);", "break;", "case 0x14:\nif (!(ctx->amask & AMASK_FIX))\ngoto invalid_opc;", "if (likely(rc != 31)) {", "if (ra != 31) {", "TCGv tmp = tcg_temp_new(TCG_TYPE_I32);", "tcg_gen_trunc_i64_i32(tmp, cpu_ir[ra]);", "tcg_gen_helper_1_1(helper_memory_to_f, cpu_fir[rc], tmp);", "tcg_temp_free(tmp);", "} else", "tcg_gen_movi_i64(cpu_fir[rc], 0);", "}", "break;", "case 0x24:\nif (!(ctx->amask & AMASK_FIX))\ngoto invalid_opc;", "if (likely(rc != 31)) {", "if (ra != 31)\ntcg_gen_mov_i64(cpu_fir[rc], cpu_ir[ra]);", "else\ntcg_gen_movi_i64(cpu_fir[rc], 0);", "}", "break;", "case 0x2A:\nif (!(ctx->amask & AMASK_FIX))\ngoto invalid_opc;", "gen_farith2(&helper_sqrtg, rb, rc);", "break;", "case 0x02B:\nif (!(ctx->amask & AMASK_FIX))\ngoto invalid_opc;", "gen_farith2(&helper_sqrtt, rb, rc);", "break;", "default:\ngoto invalid_opc;", "}", "break;", "case 0x15:\nswitch (fpfn) {", "case 0x00:\ngen_farith3(&helper_addf, ra, rb, rc);", "break;", "case 0x01:\ngen_farith3(&helper_subf, ra, rb, rc);", "break;", "case 0x02:\ngen_farith3(&helper_mulf, ra, rb, rc);", "break;", "case 0x03:\ngen_farith3(&helper_divf, ra, rb, rc);", "break;", "case 0x1E:\n#if 0\ngen_farith2(&helper_cvtdg, rb, rc);", "#else\ngoto invalid_opc;", "#endif\nbreak;", "case 0x20:\ngen_farith3(&helper_addg, ra, rb, rc);", "break;", "case 0x21:\ngen_farith3(&helper_subg, ra, rb, rc);", "break;", "case 0x22:\ngen_farith3(&helper_mulg, ra, rb, rc);", "break;", "case 0x23:\ngen_farith3(&helper_divg, ra, rb, rc);", "break;", "case 0x25:\ngen_farith3(&helper_cmpgeq, ra, rb, rc);", "break;", "case 0x26:\ngen_farith3(&helper_cmpglt, ra, rb, rc);", "break;", "case 0x27:\ngen_farith3(&helper_cmpgle, ra, rb, rc);", "break;", "case 0x2C:\ngen_farith2(&helper_cvtgf, rb, rc);", "break;", "case 0x2D:\n#if 0\ngen_farith2(ctx, &helper_cvtgd, rb, rc);", "#else\ngoto invalid_opc;", "#endif\nbreak;", "case 0x2F:\ngen_farith2(&helper_cvtgq, rb, rc);", "break;", "case 0x3C:\ngen_farith2(&helper_cvtqf, rb, rc);", "break;", "case 0x3E:\ngen_farith2(&helper_cvtqg, rb, rc);", "break;", "default:\ngoto invalid_opc;", "}", "break;", "case 0x16:\nswitch (fpfn) {", "case 0x00:\ngen_farith3(&helper_adds, ra, rb, rc);", "break;", "case 0x01:\ngen_farith3(&helper_subs, ra, rb, rc);", "break;", "case 0x02:\ngen_farith3(&helper_muls, ra, rb, rc);", "break;", "case 0x03:\ngen_farith3(&helper_divs, ra, rb, rc);", "break;", "case 0x20:\ngen_farith3(&helper_addt, ra, rb, rc);", "break;", "case 0x21:\ngen_farith3(&helper_subt, ra, rb, rc);", "break;", "case 0x22:\ngen_farith3(&helper_mult, ra, rb, rc);", "break;", "case 0x23:\ngen_farith3(&helper_divt, ra, rb, rc);", "break;", "case 0x24:\ngen_farith3(&helper_cmptun, ra, rb, rc);", "break;", "case 0x25:\ngen_farith3(&helper_cmpteq, ra, rb, rc);", "break;", "case 0x26:\ngen_farith3(&helper_cmptlt, ra, rb, rc);", "break;", "case 0x27:\ngen_farith3(&helper_cmptle, ra, rb, rc);", "break;", "case 0x2C:\nif (fn11 == 0x2AC) {", "gen_farith2(&helper_cvtst, rb, rc);", "} else {", "gen_farith2(&helper_cvtts, rb, rc);", "}", "break;", "case 0x2F:\ngen_farith2(&helper_cvttq, rb, rc);", "break;", "case 0x3C:\ngen_farith2(&helper_cvtqs, rb, rc);", "break;", "case 0x3E:\ngen_farith2(&helper_cvtqt, rb, rc);", "break;", "default:\ngoto invalid_opc;", "}", "break;", "case 0x17:\nswitch (fn11) {", "case 0x010:\ngen_farith2(&helper_cvtlq, rb, rc);", "break;", "case 0x020:\nif (likely(rc != 31)) {", "if (ra == rb)\ntcg_gen_mov_i64(cpu_fir[rc], cpu_fir[ra]);", "else\ngen_farith3(&helper_cpys, ra, rb, rc);", "}", "break;", "case 0x021:\ngen_farith3(&helper_cpysn, ra, rb, rc);", "break;", "case 0x022:\ngen_farith3(&helper_cpyse, ra, rb, rc);", "break;", "case 0x024:\nif (likely(ra != 31))\ntcg_gen_helper_0_1(helper_store_fpcr, cpu_fir[ra]);", "else {", "TCGv tmp = tcg_const_i64(0);", "tcg_gen_helper_0_1(helper_store_fpcr, tmp);", "tcg_temp_free(tmp);", "}", "break;", "case 0x025:\nif (likely(ra != 31))\ntcg_gen_helper_1_0(helper_load_fpcr, cpu_fir[ra]);", "break;", "case 0x02A:\ngen_fcmov(&helper_cmpfeq, ra, rb, rc);", "break;", "case 0x02B:\ngen_fcmov(&helper_cmpfne, ra, rb, rc);", "break;", "case 0x02C:\ngen_fcmov(&helper_cmpflt, ra, rb, rc);", "break;", "case 0x02D:\ngen_fcmov(&helper_cmpfge, ra, rb, rc);", "break;", "case 0x02E:\ngen_fcmov(&helper_cmpfle, ra, rb, rc);", "break;", "case 0x02F:\ngen_fcmov(&helper_cmpfgt, ra, rb, rc);", "break;", "case 0x030:\ngen_farith2(&helper_cvtql, rb, rc);", "break;", "case 0x130:\ngen_farith2(&helper_cvtqlv, rb, rc);", "break;", "case 0x530:\ngen_farith2(&helper_cvtqlsv, rb, rc);", "break;", "default:\ngoto invalid_opc;", "}", "break;", "case 0x18:\nswitch ((uint16_t)disp16) {", "case 0x0000:\nVAR_0 = 2;", "break;", "case 0x0400:\nVAR_0 = 2;", "break;", "case 0x4000:\nbreak;", "case 0x4400:\nbreak;", "case 0x8000:\nbreak;", "case 0xA000:\nbreak;", "case 0xC000:\nif (ra != 31)\ntcg_gen_helper_1_0(helper_load_pcc, cpu_ir[ra]);", "break;", "case 0xE000:\nif (ra != 31)\ntcg_gen_helper_1_0(helper_rc, cpu_ir[ra]);", "break;", "case 0xE800:\n#if 0\nVAR_0 = 2;", "#else\ngoto invalid_opc;", "#endif\nbreak;", "case 0xF000:\nif (ra != 31)\ntcg_gen_helper_1_0(helper_rs, cpu_ir[ra]);", "break;", "case 0xF800:\nbreak;", "default:\ngoto invalid_opc;", "}", "break;", "case 0x19:\n#if defined (CONFIG_USER_ONLY)\ngoto invalid_opc;", "#else\nif (!ctx->pal_mode)\ngoto invalid_opc;", "if (ra != 31) {", "TCGv tmp = tcg_const_i32(insn & 0xFF);", "tcg_gen_helper_1_2(helper_mfpr, cpu_ir[ra], tmp, cpu_ir[ra]);", "tcg_temp_free(tmp);", "}", "break;", "#endif\ncase 0x1A:\nif (ra != 31)\ntcg_gen_movi_i64(cpu_ir[ra], ctx->pc);", "if (rb != 31)\ntcg_gen_andi_i64(cpu_pc, cpu_ir[rb], ~3);", "else\ntcg_gen_movi_i64(cpu_pc, 0);", "switch (fn2) {", "case 0x0:\nbreak;", "case 0x1:\nbreak;", "case 0x2:\nbreak;", "case 0x3:\nbreak;", "}", "VAR_0 = 1;", "break;", "case 0x1B:\n#if defined (CONFIG_USER_ONLY)\ngoto invalid_opc;", "#else\nif (!ctx->pal_mode)\ngoto invalid_opc;", "if (ra != 31) {", "TCGv addr = tcg_temp_new(TCG_TYPE_I64);", "if (rb != 31)\ntcg_gen_addi_i64(addr, cpu_ir[rb], disp12);", "else\ntcg_gen_movi_i64(addr, disp12);", "switch ((insn >> 12) & 0xF) {", "case 0x0:\ntcg_gen_helper_0_2(helper_ldl_raw, cpu_ir[ra], addr);", "break;", "case 0x1:\ntcg_gen_helper_0_2(helper_ldq_raw, cpu_ir[ra], addr);", "break;", "case 0x2:\ntcg_gen_helper_0_2(helper_ldl_l_raw, cpu_ir[ra], addr);", "break;", "case 0x3:\ntcg_gen_helper_0_2(helper_ldq_l_raw, cpu_ir[ra], addr);", "break;", "case 0x4:\ntcg_gen_helper_0_2(helper_ldl_kernel, cpu_ir[ra], addr);", "break;", "case 0x5:\ntcg_gen_helper_0_2(helper_ldq_kernel, cpu_ir[ra], addr);", "break;", "case 0x6:\ngoto incpu_ir[ra]id_opc;", "case 0x7:\ngoto incpu_ir[ra]id_opc;", "case 0x8:\ntcg_gen_helper_1_1(helper_st_virt_to_phys, addr, addr);", "tcg_gen_helper_0_2(helper_ldl_raw, cpu_ir[ra], addr);", "break;", "case 0x9:\ntcg_gen_helper_1_1(helper_st_virt_to_phys, addr, addr);", "tcg_gen_helper_0_2(helper_ldq_raw, cpu_ir[ra], addr);", "break;", "case 0xA:\ntcg_gen_qemu_ld32s(cpu_ir[ra], addr, ctx->flags);", "break;", "case 0xB:\ntcg_gen_qemu_ld64(cpu_ir[ra], addr, ctx->flags);", "break;", "case 0xC:\ntcg_gen_helper_0_0(helper_set_alt_mode);", "tcg_gen_helper_1_1(helper_st_virt_to_phys, addr, addr);", "tcg_gen_helper_0_2(helper_ldl_raw, cpu_ir[ra], addr);", "tcg_gen_helper_0_0(helper_restore_mode);", "break;", "case 0xD:\ntcg_gen_helper_0_0(helper_set_alt_mode);", "tcg_gen_helper_1_1(helper_st_virt_to_phys, addr, addr);", "tcg_gen_helper_0_2(helper_ldq_raw, cpu_ir[ra], addr);", "tcg_gen_helper_0_0(helper_restore_mode);", "break;", "case 0xE:\ntcg_gen_helper_0_0(helper_set_alt_mode);", "tcg_gen_helper_0_2(helper_ldl_data, cpu_ir[ra], addr);", "tcg_gen_helper_0_0(helper_restore_mode);", "break;", "case 0xF:\ntcg_gen_helper_0_0(helper_set_alt_mode);", "tcg_gen_helper_0_2(helper_ldq_data, cpu_ir[ra], addr);", "tcg_gen_helper_0_0(helper_restore_mode);", "break;", "}", "tcg_temp_free(addr);", "}", "break;", "#endif\ncase 0x1C:\nswitch (fn7) {", "case 0x00:\nif (!(ctx->amask & AMASK_BWX))\ngoto invalid_opc;", "if (likely(rc != 31)) {", "if (islit)\ntcg_gen_movi_i64(cpu_ir[rc], (int64_t)((int8_t)lit));", "else\ntcg_gen_ext8s_i64(cpu_ir[rc], cpu_ir[rb]);", "}", "break;", "case 0x01:\nif (!(ctx->amask & AMASK_BWX))\ngoto invalid_opc;", "if (likely(rc != 31)) {", "if (islit)\ntcg_gen_movi_i64(cpu_ir[rc], (int64_t)((int16_t)lit));", "else\ntcg_gen_ext16s_i64(cpu_ir[rc], cpu_ir[rb]);", "}", "break;", "case 0x30:\nif (!(ctx->amask & AMASK_CIX))\ngoto invalid_opc;", "if (likely(rc != 31)) {", "if (islit)\ntcg_gen_movi_i64(cpu_ir[rc], ctpop64(lit));", "else\ntcg_gen_helper_1_1(helper_ctpop, cpu_ir[rc], cpu_ir[rb]);", "}", "break;", "case 0x31:\nif (!(ctx->amask & AMASK_MVI))\ngoto invalid_opc;", "goto invalid_opc;", "break;", "case 0x32:\nif (!(ctx->amask & AMASK_CIX))\ngoto invalid_opc;", "if (likely(rc != 31)) {", "if (islit)\ntcg_gen_movi_i64(cpu_ir[rc], clz64(lit));", "else\ntcg_gen_helper_1_1(helper_ctlz, cpu_ir[rc], cpu_ir[rb]);", "}", "break;", "case 0x33:\nif (!(ctx->amask & AMASK_CIX))\ngoto invalid_opc;", "if (likely(rc != 31)) {", "if (islit)\ntcg_gen_movi_i64(cpu_ir[rc], ctz64(lit));", "else\ntcg_gen_helper_1_1(helper_cttz, cpu_ir[rc], cpu_ir[rb]);", "}", "break;", "case 0x34:\nif (!(ctx->amask & AMASK_MVI))\ngoto invalid_opc;", "goto invalid_opc;", "break;", "case 0x35:\nif (!(ctx->amask & AMASK_MVI))\ngoto invalid_opc;", "goto invalid_opc;", "break;", "case 0x36:\nif (!(ctx->amask & AMASK_MVI))\ngoto invalid_opc;", "goto invalid_opc;", "break;", "case 0x37:\nif (!(ctx->amask & AMASK_MVI))\ngoto invalid_opc;", "goto invalid_opc;", "break;", "case 0x38:\nif (!(ctx->amask & AMASK_MVI))\ngoto invalid_opc;", "goto invalid_opc;", "break;", "case 0x39:\nif (!(ctx->amask & AMASK_MVI))\ngoto invalid_opc;", "goto invalid_opc;", "break;", "case 0x3A:\nif (!(ctx->amask & AMASK_MVI))\ngoto invalid_opc;", "goto invalid_opc;", "break;", "case 0x3B:\nif (!(ctx->amask & AMASK_MVI))\ngoto invalid_opc;", "goto invalid_opc;", "break;", "case 0x3C:\nif (!(ctx->amask & AMASK_MVI))\ngoto invalid_opc;", "goto invalid_opc;", "break;", "case 0x3D:\nif (!(ctx->amask & AMASK_MVI))\ngoto invalid_opc;", "goto invalid_opc;", "break;", "case 0x3E:\nif (!(ctx->amask & AMASK_MVI))\ngoto invalid_opc;", "goto invalid_opc;", "break;", "case 0x3F:\nif (!(ctx->amask & AMASK_MVI))\ngoto invalid_opc;", "goto invalid_opc;", "break;", "case 0x70:\nif (!(ctx->amask & AMASK_FIX))\ngoto invalid_opc;", "if (likely(rc != 31)) {", "if (ra != 31)\ntcg_gen_mov_i64(cpu_ir[rc], cpu_fir[ra]);", "else\ntcg_gen_movi_i64(cpu_ir[rc], 0);", "}", "break;", "case 0x78:\nif (!(ctx->amask & AMASK_FIX))\ngoto invalid_opc;", "if (rc != 31) {", "TCGv tmp1 = tcg_temp_new(TCG_TYPE_I32);", "if (ra != 31)\ntcg_gen_helper_1_1(helper_s_to_memory, tmp1, cpu_fir[ra]);", "else {", "TCGv tmp2 = tcg_const_i64(0);", "tcg_gen_helper_1_1(helper_s_to_memory, tmp1, tmp2);", "tcg_temp_free(tmp2);", "}", "tcg_gen_ext_i32_i64(cpu_ir[rc], tmp1);", "tcg_temp_free(tmp1);", "}", "break;", "default:\ngoto invalid_opc;", "}", "break;", "case 0x1D:\n#if defined (CONFIG_USER_ONLY)\ngoto invalid_opc;", "#else\nif (!ctx->pal_mode)\ngoto invalid_opc;", "else {", "TCGv tmp1 = tcg_const_i32(insn & 0xFF);", "if (ra != 31)\ntcg_gen_helper(helper_mtpr, tmp1, cpu_ir[ra]);", "else {", "TCGv tmp2 = tcg_const_i64(0);", "tcg_gen_helper(helper_mtpr, tmp1, tmp2);", "tcg_temp_free(tmp2);", "}", "tcg_temp_free(tmp1);", "VAR_0 = 2;", "}", "break;", "#endif\ncase 0x1E:\n#if defined (CONFIG_USER_ONLY)\ngoto invalid_opc;", "#else\nif (!ctx->pal_mode)\ngoto invalid_opc;", "if (rb == 31) {", "tcg_gen_helper_0_0(helper_hw_rei);", "} else {", "TCGv tmp;", "if (ra != 31) {", "tmp = tcg_temp_new(TCG_TYPE_I64);", "tcg_gen_addi_i64(tmp, cpu_ir[rb], (((int64_t)insn << 51) >> 51));", "} else", "tmp = tcg_const_i64(((int64_t)insn << 51) >> 51);", "tcg_gen_helper_0_1(helper_hw_ret, tmp);", "tcg_temp_free(tmp);", "}", "VAR_0 = 2;", "break;", "#endif\ncase 0x1F:\n#if defined (CONFIG_USER_ONLY)\ngoto invalid_opc;", "#else\nif (!ctx->pal_mode)\ngoto invalid_opc;", "else {", "TCGv addr, val;", "addr = tcg_temp_new(TCG_TYPE_I64);", "if (rb != 31)\ntcg_gen_addi_i64(addr, cpu_ir[rb], disp12);", "else\ntcg_gen_movi_i64(addr, disp12);", "if (ra != 31)\nval = cpu_ir[ra];", "else {", "val = tcg_temp_new(TCG_TYPE_I64);", "tcg_gen_movi_i64(val, 0);", "}", "switch ((insn >> 12) & 0xF) {", "case 0x0:\ntcg_gen_helper_0_2(helper_stl_raw, val, addr);", "break;", "case 0x1:\ntcg_gen_helper_0_2(helper_stq_raw, val, addr);", "break;", "case 0x2:\ntcg_gen_helper_1_2(helper_stl_c_raw, val, val, addr);", "break;", "case 0x3:\ntcg_gen_helper_1_2(helper_stq_c_raw, val, val, addr);", "break;", "case 0x4:\ntcg_gen_helper_1_1(helper_st_virt_to_phys, addr, addr);", "tcg_gen_helper_0_2(helper_stl_raw, val, addr);", "break;", "case 0x5:\ntcg_gen_helper_1_1(helper_st_virt_to_phys, addr, addr);", "tcg_gen_helper_0_2(helper_stq_raw, val, addr);", "break;", "case 0x6:\ngoto invalid_opc;", "case 0x7:\ngoto invalid_opc;", "case 0x8:\ngoto invalid_opc;", "case 0x9:\ngoto invalid_opc;", "case 0xA:\ngoto invalid_opc;", "case 0xB:\ngoto invalid_opc;", "case 0xC:\ntcg_gen_helper_0_0(helper_set_alt_mode);", "tcg_gen_helper_1_1(helper_st_virt_to_phys, addr, addr);", "tcg_gen_helper_0_2(helper_stl_raw, val, addr);", "tcg_gen_helper_0_0(helper_restore_mode);", "break;", "case 0xD:\ntcg_gen_helper_0_0(helper_set_alt_mode);", "tcg_gen_helper_1_1(helper_st_virt_to_phys, addr, addr);", "tcg_gen_helper_0_2(helper_stl_raw, val, addr);", "tcg_gen_helper_0_0(helper_restore_mode);", "break;", "case 0xE:\ngoto invalid_opc;", "case 0xF:\ngoto invalid_opc;", "}", "if (ra != 31)\ntcg_temp_free(val);", "tcg_temp_free(addr);", "}", "VAR_0 = 2;", "break;", "#endif\ncase 0x20:\ngen_load_mem(ctx, &gen_qemu_ldf, ra, rb, disp16, 1, 0);", "break;", "case 0x21:\ngen_load_mem(ctx, &gen_qemu_ldg, ra, rb, disp16, 1, 0);", "break;", "case 0x22:\ngen_load_mem(ctx, &gen_qemu_lds, ra, rb, disp16, 1, 0);", "break;", "case 0x23:\ngen_load_mem(ctx, &tcg_gen_qemu_ld64, ra, rb, disp16, 1, 0);", "break;", "case 0x24:\ngen_store_mem(ctx, &gen_qemu_stf, ra, rb, disp16, 1, 0);", "break;", "case 0x25:\ngen_store_mem(ctx, &gen_qemu_stg, ra, rb, disp16, 1, 0);", "break;", "case 0x26:\ngen_store_mem(ctx, &gen_qemu_sts, ra, rb, disp16, 1, 0);", "break;", "case 0x27:\ngen_store_mem(ctx, &tcg_gen_qemu_st64, ra, rb, disp16, 1, 0);", "break;", "case 0x28:\ngen_load_mem(ctx, &tcg_gen_qemu_ld32s, ra, rb, disp16, 0, 0);", "break;", "case 0x29:\ngen_load_mem(ctx, &tcg_gen_qemu_ld64, ra, rb, disp16, 0, 0);", "break;", "case 0x2A:\ngen_load_mem(ctx, &gen_qemu_ldl_l, ra, rb, disp16, 0, 0);", "break;", "case 0x2B:\ngen_load_mem(ctx, &gen_qemu_ldq_l, ra, rb, disp16, 0, 0);", "break;", "case 0x2C:\ngen_store_mem(ctx, &tcg_gen_qemu_st32, ra, rb, disp16, 0, 0);", "break;", "case 0x2D:\ngen_store_mem(ctx, &tcg_gen_qemu_st64, ra, rb, disp16, 0, 0);", "break;", "case 0x2E:\ngen_store_mem(ctx, &gen_qemu_stl_c, ra, rb, disp16, 0, 0);", "break;", "case 0x2F:\ngen_store_mem(ctx, &gen_qemu_stq_c, ra, rb, disp16, 0, 0);", "break;", "case 0x30:\nif (ra != 31)\ntcg_gen_movi_i64(cpu_ir[ra], ctx->pc);", "tcg_gen_movi_i64(cpu_pc, ctx->pc + (int64_t)(disp21 << 2));", "VAR_0 = 1;", "break;", "case 0x31:\ngen_fbcond(ctx, &helper_cmpfeq, ra, disp16);", "VAR_0 = 1;", "break;", "case 0x32:\ngen_fbcond(ctx, &helper_cmpflt, ra, disp16);", "VAR_0 = 1;", "break;", "case 0x33:\ngen_fbcond(ctx, &helper_cmpfle, ra, disp16);", "VAR_0 = 1;", "break;", "case 0x34:\nif (ra != 31)\ntcg_gen_movi_i64(cpu_ir[ra], ctx->pc);", "tcg_gen_movi_i64(cpu_pc, ctx->pc + (int64_t)(disp21 << 2));", "VAR_0 = 1;", "break;", "case 0x35:\ngen_fbcond(ctx, &helper_cmpfne, ra, disp16);", "VAR_0 = 1;", "break;", "case 0x36:\ngen_fbcond(ctx, &helper_cmpfge, ra, disp16);", "VAR_0 = 1;", "break;", "case 0x37:\ngen_fbcond(ctx, &helper_cmpfgt, ra, disp16);", "VAR_0 = 1;", "break;", "case 0x38:\ngen_bcond(ctx, TCG_COND_EQ, ra, disp16, 1);", "VAR_0 = 1;", "break;", "case 0x39:\ngen_bcond(ctx, TCG_COND_EQ, ra, disp16, 0);", "VAR_0 = 1;", "break;", "case 0x3A:\ngen_bcond(ctx, TCG_COND_LT, ra, disp16, 0);", "VAR_0 = 1;", "break;", "case 0x3B:\ngen_bcond(ctx, TCG_COND_LE, ra, disp16, 0);", "VAR_0 = 1;", "break;", "case 0x3C:\ngen_bcond(ctx, TCG_COND_NE, ra, disp16, 1);", "VAR_0 = 1;", "break;", "case 0x3D:\ngen_bcond(ctx, TCG_COND_NE, ra, disp16, 0);", "VAR_0 = 1;", "break;", "case 0x3E:\ngen_bcond(ctx, TCG_COND_GE, ra, disp16, 0);", "VAR_0 = 1;", "break;", "case 0x3F:\ngen_bcond(ctx, TCG_COND_GT, ra, disp16, 0);", "VAR_0 = 1;", "break;", "invalid_opc:\ngen_invalid(ctx);", "VAR_0 = 3;", "break;", "}", "return VAR_0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63, 65 ], [ 67, 69 ], [ 71 ], [ 73, 75 ], [ 77, 81 ], [ 85 ], [ 87, 89 ], [ 93, 95 ], [ 97, 99 ], [ 101, 103 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115, 119 ], [ 121, 125 ], [ 127, 131 ], [ 133, 137 ], [ 139, 143 ], [ 145, 149 ], [ 151, 155 ], [ 157, 161 ], [ 163, 165 ], [ 167, 169 ], [ 171 ], [ 173 ], [ 175, 179 ], [ 181, 183 ], [ 185, 187 ], [ 189 ], [ 191 ], [ 193, 197, 199 ], [ 201 ], [ 203 ], [ 205, 209 ], [ 211 ], [ 213, 217, 219 ], [ 221 ], [ 223 ], [ 225, 229 ], [ 231 ], [ 233, 237 ], [ 239 ], [ 241, 245 ], [ 247 ], [ 249, 251 ], [ 253, 257 ], [ 259 ], [ 261 ], [ 263 ], [ 265 ], [ 267 ], [ 269 ], [ 271 ], [ 273 ], [ 275 ], [ 277, 279 ], [ 281, 283 ], [ 285 ], [ 287 ], [ 289 ], [ 291, 295 ], [ 297 ], [ 299 ], [ 301 ], [ 303, 305 ], [ 307, 309 ], [ 311 ], [ 313 ], [ 315 ], [ 317, 319 ], [ 321, 323 ], [ 325 ], [ 327 ], [ 329 ], [ 331, 335 ], [ 337 ], [ 339, 341 ], [ 343, 345 ], [ 347 ], [ 349 ], [ 351, 353 ], [ 355 ], [ 357 ], [ 359 ], [ 361 ], [ 363 ], [ 365 ], [ 367, 371 ], [ 373 ], [ 375 ], [ 377 ], [ 379, 381 ], [ 383, 385 ], [ 387 ], [ 389 ], [ 391 ], [ 393, 395 ], [ 397 ], [ 399 ], [ 401 ], [ 403 ], [ 405 ], [ 407 ], [ 409 ], [ 411, 415 ], [ 417 ], [ 419, 423 ], [ 425 ], [ 427 ], [ 429 ], [ 431, 433 ], [ 435, 437 ], [ 439 ], [ 441 ], [ 443 ], [ 445, 447 ], [ 449, 451 ], [ 453 ], [ 455 ], [ 457 ], [ 459, 463 ], [ 465 ], [ 467 ], [ 469 ], [ 471, 473 ], [ 475, 477 ], [ 479 ], [ 481 ], [ 483 ], [ 485, 487 ], [ 489, 491 ], [ 493 ], [ 495 ], [ 497 ], [ 499 ], [ 501 ], [ 503, 507 ], [ 509 ], [ 511, 515 ], [ 517 ], [ 519, 521 ], [ 523, 525 ], [ 527 ], [ 529, 531 ], [ 533, 535 ], [ 537 ], [ 539 ], [ 541 ], [ 543, 547 ], [ 549 ], [ 551 ], [ 553 ], [ 555, 557 ], [ 559, 561 ], [ 563 ], [ 565 ], [ 567, 569 ], [ 571, 573 ], [ 575 ], [ 577 ], [ 579 ], [ 581, 585 ], [ 587 ], [ 589, 591 ], [ 593, 595 ], [ 597 ], [ 599, 601 ], [ 603, 605 ], [ 607 ], [ 609 ], [ 611 ], [ 613, 617 ], [ 619 ], [ 621 ], [ 623 ], [ 625, 627 ], [ 629, 631 ], [ 633 ], [ 635 ], [ 637, 639 ], [ 641, 643 ], [ 645 ], [ 647 ], [ 649 ], [ 651, 655 ], [ 657 ], [ 659, 663 ], [ 665 ], [ 667 ], [ 669 ], [ 671, 673 ], [ 675, 677 ], [ 679 ], [ 681 ], [ 683, 685 ], [ 687, 689 ], [ 691 ], [ 693 ], [ 695 ], [ 697, 701 ], [ 703 ], [ 705 ], [ 707 ], [ 709, 711 ], [ 713, 715 ], [ 717 ], [ 719 ], [ 721, 723 ], [ 725, 727 ], [ 729 ], [ 731 ], [ 733 ], [ 735, 739 ], [ 741 ], [ 743, 747 ], [ 749 ], [ 751, 755 ], [ 757 ], [ 759, 763 ], [ 765 ], [ 767, 771 ], [ 773 ], [ 775, 779 ], [ 781 ], [ 783, 787 ], [ 789 ], [ 791, 793 ], [ 795 ], [ 797 ], [ 799, 801 ], [ 803, 807 ], [ 809, 811 ], [ 813, 815 ], [ 817, 819 ], [ 821 ], [ 823 ], [ 825, 829 ], [ 831 ], [ 833, 835 ], [ 837, 839 ], [ 841 ], [ 843 ], [ 845 ], [ 847 ], [ 849, 853 ], [ 855 ], [ 857, 861 ], [ 863 ], [ 865, 869 ], [ 871 ], [ 873, 875 ], [ 877, 879 ], [ 881 ], [ 883, 885 ], [ 887, 889 ], [ 891 ], [ 893 ], [ 895 ], [ 897, 901 ], [ 903 ], [ 905, 909 ], [ 911 ], [ 913, 917 ], [ 919 ], [ 921, 923 ], [ 925, 927 ], [ 929 ], [ 931, 933 ], [ 935, 937 ], [ 939 ], [ 941 ], [ 943 ], [ 945, 949 ], [ 951 ], [ 953, 955 ], [ 957, 959 ], [ 961 ], [ 963, 965 ], [ 967, 969 ], [ 971 ], [ 973 ], [ 975 ], [ 977, 981 ], [ 983 ], [ 985, 989 ], [ 991 ], [ 993, 997 ], [ 999 ], [ 1001, 1003 ], [ 1005, 1007 ], [ 1009 ], [ 1011, 1013 ], [ 1015, 1017 ], [ 1019 ], [ 1021 ], [ 1023 ], [ 1025, 1029 ], [ 1031, 1033 ], [ 1035, 1037 ], [ 1039 ], [ 1041 ], [ 1043, 1047 ], [ 1049 ], [ 1051, 1055 ], [ 1057 ], [ 1059, 1063, 1065 ], [ 1067 ], [ 1069, 1071 ], [ 1073 ], [ 1075 ], [ 1077, 1079 ], [ 1081, 1085 ], [ 1087 ], [ 1089, 1093 ], [ 1095 ], [ 1097, 1101 ], [ 1103 ], [ 1105, 1109 ], [ 1111 ], [ 1113, 1117 ], [ 1119 ], [ 1121, 1125 ], [ 1127 ], [ 1129, 1133 ], [ 1135 ], [ 1137, 1141 ], [ 1143 ], [ 1145, 1149 ], [ 1151 ], [ 1153, 1157 ], [ 1159 ], [ 1161, 1165 ], [ 1167 ], [ 1169, 1173 ], [ 1175 ], [ 1177, 1181 ], [ 1183 ], [ 1185, 1187 ], [ 1189 ], [ 1191 ], [ 1193 ], [ 1195 ], [ 1197 ], [ 1199 ], [ 1201 ], [ 1203 ], [ 1205 ], [ 1207 ], [ 1209, 1213 ], [ 1215 ], [ 1217, 1221 ], [ 1223 ], [ 1225, 1227 ], [ 1229 ], [ 1231 ], [ 1233 ], [ 1235 ], [ 1237 ], [ 1239 ], [ 1241 ], [ 1243 ], [ 1245 ], [ 1247 ], [ 1249, 1253 ], [ 1255 ], [ 1257, 1261 ], [ 1263 ], [ 1265, 1267 ], [ 1269 ], [ 1271 ], [ 1273 ], [ 1275 ], [ 1277 ], [ 1279 ], [ 1281 ], [ 1283 ], [ 1285 ], [ 1287 ], [ 1289, 1293 ], [ 1295 ], [ 1297, 1301 ], [ 1303 ], [ 1305, 1309 ], [ 1311 ], [ 1313, 1317 ], [ 1319 ], [ 1321, 1325 ], [ 1327 ], [ 1329, 1333 ], [ 1335 ], [ 1337, 1341 ], [ 1343 ], [ 1345, 1349 ], [ 1351 ], [ 1353, 1357 ], [ 1359 ], [ 1361, 1363 ], [ 1365 ], [ 1367 ], [ 1369, 1371 ], [ 1373, 1377 ], [ 1379, 1381 ], [ 1383 ], [ 1385, 1387 ], [ 1389, 1391 ], [ 1393 ], [ 1395 ], [ 1397 ], [ 1399 ], [ 1401, 1405 ], [ 1407, 1409 ], [ 1411, 1413 ], [ 1415, 1417 ], [ 1419 ], [ 1421 ], [ 1423, 1427 ], [ 1429 ], [ 1431, 1435 ], [ 1437 ], [ 1439, 1443 ], [ 1445 ], [ 1447, 1449 ], [ 1451 ], [ 1453 ], [ 1455, 1457 ], [ 1459, 1463, 1465 ], [ 1467 ], [ 1469 ], [ 1471 ], [ 1473 ], [ 1475 ], [ 1477 ], [ 1479 ], [ 1481 ], [ 1483 ], [ 1485 ], [ 1487, 1491, 1493 ], [ 1495 ], [ 1497 ], [ 1499, 1503, 1505 ], [ 1507 ], [ 1509 ], [ 1511, 1515, 1517 ], [ 1519 ], [ 1521 ], [ 1523 ], [ 1525 ], [ 1527 ], [ 1529 ], [ 1531 ], [ 1533 ], [ 1535 ], [ 1537 ], [ 1539, 1543, 1545 ], [ 1547 ], [ 1549, 1551 ], [ 1553, 1555 ], [ 1557 ], [ 1559 ], [ 1561, 1565, 1567 ], [ 1569 ], [ 1571 ], [ 1573, 1577, 1579 ], [ 1581 ], [ 1583 ], [ 1585, 1587 ], [ 1589 ], [ 1591 ], [ 1593, 1599 ], [ 1601, 1605 ], [ 1607 ], [ 1609, 1613 ], [ 1615 ], [ 1617, 1621 ], [ 1623 ], [ 1625, 1629 ], [ 1631 ], [ 1633, 1637, 1639 ], [ 1641, 1643 ], [ 1645, 1647 ], [ 1649, 1653 ], [ 1655 ], [ 1657, 1661 ], [ 1663 ], [ 1665, 1669 ], [ 1671 ], [ 1673, 1677 ], [ 1679 ], [ 1681, 1685 ], [ 1687 ], [ 1689, 1693 ], [ 1695 ], [ 1697, 1701 ], [ 1703 ], [ 1705, 1709 ], [ 1711 ], [ 1713, 1717, 1719 ], [ 1721, 1723 ], [ 1725, 1727 ], [ 1729, 1733 ], [ 1735 ], [ 1737, 1741 ], [ 1743 ], [ 1745, 1749 ], [ 1751 ], [ 1753, 1755 ], [ 1757 ], [ 1759 ], [ 1761, 1767 ], [ 1769, 1773 ], [ 1775 ], [ 1777, 1781 ], [ 1783 ], [ 1785, 1789 ], [ 1791 ], [ 1793, 1797 ], [ 1799 ], [ 1801, 1805 ], [ 1807 ], [ 1809, 1813 ], [ 1815 ], [ 1817, 1821 ], [ 1823 ], [ 1825, 1829 ], [ 1831 ], [ 1833, 1837 ], [ 1839 ], [ 1841, 1845 ], [ 1847 ], [ 1849, 1853 ], [ 1855 ], [ 1857, 1861 ], [ 1863 ], [ 1865, 1869 ], [ 1873 ], [ 1875 ], [ 1879 ], [ 1881 ], [ 1883 ], [ 1885, 1889 ], [ 1891 ], [ 1893, 1897 ], [ 1899 ], [ 1901, 1905 ], [ 1907 ], [ 1909, 1911 ], [ 1913 ], [ 1915 ], [ 1917, 1919 ], [ 1921, 1925 ], [ 1927 ], [ 1929, 1931 ], [ 1933, 1937 ], [ 1939, 1943 ], [ 1945 ], [ 1947 ], [ 1949, 1953 ], [ 1955 ], [ 1957, 1961 ], [ 1963 ], [ 1965, 1969, 1971 ], [ 1973 ], [ 1975 ], [ 1977 ], [ 1979 ], [ 1981 ], [ 1983 ], [ 1985, 1989, 1991 ], [ 1993 ], [ 1995, 1999 ], [ 2001 ], [ 2003, 2007 ], [ 2009 ], [ 2011, 2015 ], [ 2017 ], [ 2019, 2023 ], [ 2025 ], [ 2027, 2031 ], [ 2033 ], [ 2035, 2039 ], [ 2041 ], [ 2043, 2047 ], [ 2049 ], [ 2051, 2055 ], [ 2057 ], [ 2059, 2063 ], [ 2065 ], [ 2067, 2069 ], [ 2071 ], [ 2073 ], [ 2075, 2077 ], [ 2079, 2085 ], [ 2087 ], [ 2089, 2095 ], [ 2097 ], [ 2099, 2105 ], [ 2107, 2113 ], [ 2115, 2121 ], [ 2123, 2129 ], [ 2131, 2135, 2137 ], [ 2139 ], [ 2141, 2145, 2147 ], [ 2149 ], [ 2151, 2157, 2159 ], [ 2161, 2163 ], [ 2165, 2167 ], [ 2169, 2173, 2175 ], [ 2177 ], [ 2179, 2185 ], [ 2187, 2189 ], [ 2191 ], [ 2193 ], [ 2195, 2199, 2201 ], [ 2203, 2205, 2207 ], [ 2209 ], [ 2211 ], [ 2213 ], [ 2215 ], [ 2217 ], [ 2219 ], [ 2221, 2223, 2225, 2227 ], [ 2229, 2231 ], [ 2233, 2235 ], [ 2239 ], [ 2241, 2245 ], [ 2247, 2251 ], [ 2253, 2257 ], [ 2259, 2263 ], [ 2265 ], [ 2267 ], [ 2269 ], [ 2271, 2275, 2277 ], [ 2279, 2281, 2283 ], [ 2285 ], [ 2287 ], [ 2289, 2291 ], [ 2293, 2295 ], [ 2297 ], [ 2299, 2303 ], [ 2305 ], [ 2307, 2311 ], [ 2313 ], [ 2315, 2319 ], [ 2321 ], [ 2323, 2327 ], [ 2329 ], [ 2331, 2335 ], [ 2337 ], [ 2339, 2343 ], [ 2345 ], [ 2347, 2351 ], [ 2353, 2357 ], [ 2359, 2363 ], [ 2365 ], [ 2367 ], [ 2369, 2373 ], [ 2375 ], [ 2377 ], [ 2379, 2383 ], [ 2385 ], [ 2387, 2391 ], [ 2393 ], [ 2395, 2399 ], [ 2401 ], [ 2403 ], [ 2405 ], [ 2407 ], [ 2409, 2413 ], [ 2415 ], [ 2417 ], [ 2419 ], [ 2421 ], [ 2423, 2431 ], [ 2433 ], [ 2435 ], [ 2437 ], [ 2439, 2447 ], [ 2449 ], [ 2451 ], [ 2453 ], [ 2455 ], [ 2457 ], [ 2459 ], [ 2461 ], [ 2463, 2465, 2467 ], [ 2469, 2473, 2475 ], [ 2477 ], [ 2479, 2481 ], [ 2483, 2485 ], [ 2487 ], [ 2489 ], [ 2491, 2495, 2497 ], [ 2499 ], [ 2501, 2503 ], [ 2505, 2507 ], [ 2509 ], [ 2511 ], [ 2513, 2517, 2519 ], [ 2521 ], [ 2523, 2525 ], [ 2527, 2529 ], [ 2531 ], [ 2533 ], [ 2535, 2539, 2541 ], [ 2545 ], [ 2547 ], [ 2549, 2553, 2555 ], [ 2557 ], [ 2559, 2561 ], [ 2563, 2565 ], [ 2567 ], [ 2569 ], [ 2571, 2575, 2577 ], [ 2579 ], [ 2581, 2583 ], [ 2585, 2587 ], [ 2589 ], [ 2591 ], [ 2593, 2597, 2599 ], [ 2603 ], [ 2605 ], [ 2607, 2611, 2613 ], [ 2617 ], [ 2619 ], [ 2621, 2625, 2627 ], [ 2631 ], [ 2633 ], [ 2635, 2639, 2641 ], [ 2645 ], [ 2647 ], [ 2649, 2653, 2655 ], [ 2659 ], [ 2661 ], [ 2663, 2667, 2669 ], [ 2673 ], [ 2675 ], [ 2677, 2681, 2683 ], [ 2687 ], [ 2689 ], [ 2691, 2695, 2697 ], [ 2701 ], [ 2703 ], [ 2705, 2709, 2711 ], [ 2715 ], [ 2717 ], [ 2719, 2723, 2725 ], [ 2729 ], [ 2731 ], [ 2733, 2737, 2739 ], [ 2743 ], [ 2745 ], [ 2747, 2751, 2753 ], [ 2757 ], [ 2759 ], [ 2761, 2765, 2767 ], [ 2769 ], [ 2771, 2773 ], [ 2775, 2777 ], [ 2779 ], [ 2781 ], [ 2783, 2787, 2789 ], [ 2791 ], [ 2793 ], [ 2795, 2797 ], [ 2799 ], [ 2801 ], [ 2803 ], [ 2805 ], [ 2807 ], [ 2809 ], [ 2811 ], [ 2813 ], [ 2815 ], [ 2817, 2819 ], [ 2821 ], [ 2823 ], [ 2825, 2829, 2831 ], [ 2833, 2835, 2837 ], [ 2839 ], [ 2841 ], [ 2843, 2845 ], [ 2847 ], [ 2849 ], [ 2851 ], [ 2853 ], [ 2855 ], [ 2857 ], [ 2859 ], [ 2861 ], [ 2863 ], [ 2865, 2867, 2871, 2873 ], [ 2875, 2877, 2879 ], [ 2881 ], [ 2885 ], [ 2887 ], [ 2889 ], [ 2893 ], [ 2895 ], [ 2897 ], [ 2899 ], [ 2901 ], [ 2903 ], [ 2905 ], [ 2907 ], [ 2909 ], [ 2911 ], [ 2913, 2915, 2919, 2921 ], [ 2923, 2925, 2927 ], [ 2929 ], [ 2931 ], [ 2933 ], [ 2935, 2937 ], [ 2939, 2941 ], [ 2943, 2945 ], [ 2947 ], [ 2949 ], [ 2951 ], [ 2953 ], [ 2955 ], [ 2957, 2961 ], [ 2963 ], [ 2965, 2969 ], [ 2971 ], [ 2973, 2977 ], [ 2979 ], [ 2981, 2985 ], [ 2987 ], [ 2989, 2993 ], [ 2995 ], [ 2997 ], [ 2999, 3003 ], [ 3005 ], [ 3007 ], [ 3009, 3013 ], [ 3015, 3019 ], [ 3021, 3025 ], [ 3027, 3031 ], [ 3033, 3037 ], [ 3039, 3043 ], [ 3045, 3049 ], [ 3051 ], [ 3053 ], [ 3055 ], [ 3057 ], [ 3059, 3063 ], [ 3065 ], [ 3067 ], [ 3069 ], [ 3071 ], [ 3073, 3077 ], [ 3079, 3083 ], [ 3085 ], [ 3087, 3089 ], [ 3091 ], [ 3093 ], [ 3095 ], [ 3097 ], [ 3099, 3101, 3105 ], [ 3107 ], [ 3109, 3113 ], [ 3115 ], [ 3117, 3121 ], [ 3123 ], [ 3125, 3129 ], [ 3131 ], [ 3133, 3137 ], [ 3139 ], [ 3141, 3145 ], [ 3147 ], [ 3149, 3153 ], [ 3155 ], [ 3157, 3161 ], [ 3163 ], [ 3165, 3169 ], [ 3171 ], [ 3173, 3177 ], [ 3179 ], [ 3181, 3185 ], [ 3187 ], [ 3189, 3193 ], [ 3195 ], [ 3197, 3201 ], [ 3203 ], [ 3205, 3209 ], [ 3211 ], [ 3213, 3217 ], [ 3219 ], [ 3221, 3225 ], [ 3227 ], [ 3229, 3233, 3235 ], [ 3237 ], [ 3239 ], [ 3241 ], [ 3243, 3247 ], [ 3249 ], [ 3251 ], [ 3253, 3257 ], [ 3259 ], [ 3261 ], [ 3263, 3267 ], [ 3269 ], [ 3271 ], [ 3273, 3277, 3279 ], [ 3281 ], [ 3283 ], [ 3285 ], [ 3287, 3291 ], [ 3293 ], [ 3295 ], [ 3297, 3301 ], [ 3303 ], [ 3305 ], [ 3307, 3311 ], [ 3313 ], [ 3315 ], [ 3317, 3321 ], [ 3323 ], [ 3325 ], [ 3327, 3331 ], [ 3333 ], [ 3335 ], [ 3337, 3341 ], [ 3343 ], [ 3345 ], [ 3347, 3351 ], [ 3353 ], [ 3355 ], [ 3357, 3361 ], [ 3363 ], [ 3365 ], [ 3367, 3371 ], [ 3373 ], [ 3375 ], [ 3377, 3381 ], [ 3383 ], [ 3385 ], [ 3387, 3391 ], [ 3393 ], [ 3395 ], [ 3397, 3399 ], [ 3401 ], [ 3403 ], [ 3405 ], [ 3409 ], [ 3411 ] ]
11,289
void ff_aac_search_for_is(AACEncContext *s, AVCodecContext *avctx, ChannelElement *cpe) { SingleChannelElement *sce0 = &cpe->ch[0]; SingleChannelElement *sce1 = &cpe->ch[1]; int start = 0, count = 0, w, w2, g, i; const float freq_mult = avctx->sample_rate/(1024.0f/sce0->ics.num_windows)/2.0f; if (!cpe->common_window) return; for (w = 0; w < sce0->ics.num_windows; w += sce0->ics.group_len[w]) { start = 0; for (g = 0; g < sce0->ics.num_swb; g++) { if (start*freq_mult > INT_STEREO_LOW_LIMIT*(s->lambda/170.0f) && cpe->ch[0].band_type[w*16+g] != NOISE_BT && !cpe->ch[0].zeroes[w*16+g] && cpe->ch[1].band_type[w*16+g] != NOISE_BT && !cpe->ch[1].zeroes[w*16+g]) { float ener0 = 0.0f, ener1 = 0.0f, ener01 = 0.0f; struct AACISError ph_err1, ph_err2, *erf; if (sce0->band_type[w*16+g] == NOISE_BT || sce1->band_type[w*16+g] == NOISE_BT) { start += sce0->ics.swb_sizes[g]; continue; } for (w2 = 0; w2 < sce0->ics.group_len[w]; w2++) { for (i = 0; i < sce0->ics.swb_sizes[g]; i++) { float coef0 = fabsf(sce0->pcoeffs[start+(w+w2)*128+i]); float coef1 = fabsf(sce1->pcoeffs[start+(w+w2)*128+i]); ener0 += coef0*coef0; ener1 += coef1*coef1; ener01 += (coef0 + coef1)*(coef0 + coef1); } } ph_err1 = ff_aac_is_encoding_err(s, cpe, start, w, g, ener0, ener1, ener01, 0, -1); ph_err2 = ff_aac_is_encoding_err(s, cpe, start, w, g, ener0, ener1, ener01, 0, +1); erf = ph_err1.error < ph_err2.error ? &ph_err1 : &ph_err2; if (erf->pass) { cpe->is_mask[w*16+g] = 1; cpe->ch[0].is_ener[w*16+g] = sqrt(ener0/ener01); cpe->ch[1].is_ener[w*16+g] = ener0/ener1; cpe->ch[1].band_type[w*16+g] = erf->phase ? INTENSITY_BT : INTENSITY_BT2; count++; } } start += sce0->ics.swb_sizes[g]; } } cpe->is_mode = !!count; }
true
FFmpeg
01ecb7172b684f1c4b3e748f95c5a9a494ca36ec
void ff_aac_search_for_is(AACEncContext *s, AVCodecContext *avctx, ChannelElement *cpe) { SingleChannelElement *sce0 = &cpe->ch[0]; SingleChannelElement *sce1 = &cpe->ch[1]; int start = 0, count = 0, w, w2, g, i; const float freq_mult = avctx->sample_rate/(1024.0f/sce0->ics.num_windows)/2.0f; if (!cpe->common_window) return; for (w = 0; w < sce0->ics.num_windows; w += sce0->ics.group_len[w]) { start = 0; for (g = 0; g < sce0->ics.num_swb; g++) { if (start*freq_mult > INT_STEREO_LOW_LIMIT*(s->lambda/170.0f) && cpe->ch[0].band_type[w*16+g] != NOISE_BT && !cpe->ch[0].zeroes[w*16+g] && cpe->ch[1].band_type[w*16+g] != NOISE_BT && !cpe->ch[1].zeroes[w*16+g]) { float ener0 = 0.0f, ener1 = 0.0f, ener01 = 0.0f; struct AACISError ph_err1, ph_err2, *erf; if (sce0->band_type[w*16+g] == NOISE_BT || sce1->band_type[w*16+g] == NOISE_BT) { start += sce0->ics.swb_sizes[g]; continue; } for (w2 = 0; w2 < sce0->ics.group_len[w]; w2++) { for (i = 0; i < sce0->ics.swb_sizes[g]; i++) { float coef0 = fabsf(sce0->pcoeffs[start+(w+w2)*128+i]); float coef1 = fabsf(sce1->pcoeffs[start+(w+w2)*128+i]); ener0 += coef0*coef0; ener1 += coef1*coef1; ener01 += (coef0 + coef1)*(coef0 + coef1); } } ph_err1 = ff_aac_is_encoding_err(s, cpe, start, w, g, ener0, ener1, ener01, 0, -1); ph_err2 = ff_aac_is_encoding_err(s, cpe, start, w, g, ener0, ener1, ener01, 0, +1); erf = ph_err1.error < ph_err2.error ? &ph_err1 : &ph_err2; if (erf->pass) { cpe->is_mask[w*16+g] = 1; cpe->ch[0].is_ener[w*16+g] = sqrt(ener0/ener01); cpe->ch[1].is_ener[w*16+g] = ener0/ener1; cpe->ch[1].band_type[w*16+g] = erf->phase ? INTENSITY_BT : INTENSITY_BT2; count++; } } start += sce0->ics.swb_sizes[g]; } } cpe->is_mode = !!count; }
{ "code": [ " float ener0 = 0.0f, ener1 = 0.0f, ener01 = 0.0f;", " float coef0 = fabsf(sce0->pcoeffs[start+(w+w2)*128+i]);", " float coef1 = fabsf(sce1->pcoeffs[start+(w+w2)*128+i]);", " ener0, ener1, ener01, 0, -1);", " erf = ph_err1.error < ph_err2.error ? &ph_err1 : &ph_err2;", " cpe->ch[0].is_ener[w*16+g] = sqrt(ener0/ener01);", " cpe->ch[1].band_type[w*16+g] = erf->phase ? INTENSITY_BT : INTENSITY_BT2;" ], "line_no": [ 33, 51, 53, 67, 73, 79, 83 ] }
void FUNC_0(AACEncContext *VAR_0, AVCodecContext *VAR_1, ChannelElement *VAR_2) { SingleChannelElement *sce0 = &VAR_2->ch[0]; SingleChannelElement *sce1 = &VAR_2->ch[1]; int VAR_3 = 0, VAR_4 = 0, VAR_5, VAR_6, VAR_7, VAR_8; const float VAR_9 = VAR_1->sample_rate/(1024.0f/sce0->ics.num_windows)/2.0f; if (!VAR_2->common_window) return; for (VAR_5 = 0; VAR_5 < sce0->ics.num_windows; VAR_5 += sce0->ics.group_len[VAR_5]) { VAR_3 = 0; for (VAR_7 = 0; VAR_7 < sce0->ics.num_swb; VAR_7++) { if (VAR_3*VAR_9 > INT_STEREO_LOW_LIMIT*(VAR_0->lambda/170.0f) && VAR_2->ch[0].band_type[VAR_5*16+VAR_7] != NOISE_BT && !VAR_2->ch[0].zeroes[VAR_5*16+VAR_7] && VAR_2->ch[1].band_type[VAR_5*16+VAR_7] != NOISE_BT && !VAR_2->ch[1].zeroes[VAR_5*16+VAR_7]) { float ener0 = 0.0f, ener1 = 0.0f, ener01 = 0.0f; struct AACISError ph_err1, ph_err2, *erf; if (sce0->band_type[VAR_5*16+VAR_7] == NOISE_BT || sce1->band_type[VAR_5*16+VAR_7] == NOISE_BT) { VAR_3 += sce0->ics.swb_sizes[VAR_7]; continue; } for (VAR_6 = 0; VAR_6 < sce0->ics.group_len[VAR_5]; VAR_6++) { for (VAR_8 = 0; VAR_8 < sce0->ics.swb_sizes[VAR_7]; VAR_8++) { float coef0 = fabsf(sce0->pcoeffs[VAR_3+(VAR_5+VAR_6)*128+VAR_8]); float coef1 = fabsf(sce1->pcoeffs[VAR_3+(VAR_5+VAR_6)*128+VAR_8]); ener0 += coef0*coef0; ener1 += coef1*coef1; ener01 += (coef0 + coef1)*(coef0 + coef1); } } ph_err1 = ff_aac_is_encoding_err(VAR_0, VAR_2, VAR_3, VAR_5, VAR_7, ener0, ener1, ener01, 0, -1); ph_err2 = ff_aac_is_encoding_err(VAR_0, VAR_2, VAR_3, VAR_5, VAR_7, ener0, ener1, ener01, 0, +1); erf = ph_err1.error < ph_err2.error ? &ph_err1 : &ph_err2; if (erf->pass) { VAR_2->is_mask[VAR_5*16+VAR_7] = 1; VAR_2->ch[0].is_ener[VAR_5*16+VAR_7] = sqrt(ener0/ener01); VAR_2->ch[1].is_ener[VAR_5*16+VAR_7] = ener0/ener1; VAR_2->ch[1].band_type[VAR_5*16+VAR_7] = erf->phase ? INTENSITY_BT : INTENSITY_BT2; VAR_4++; } } VAR_3 += sce0->ics.swb_sizes[VAR_7]; } } VAR_2->is_mode = !!VAR_4; }
[ "void FUNC_0(AACEncContext *VAR_0, AVCodecContext *VAR_1, ChannelElement *VAR_2)\n{", "SingleChannelElement *sce0 = &VAR_2->ch[0];", "SingleChannelElement *sce1 = &VAR_2->ch[1];", "int VAR_3 = 0, VAR_4 = 0, VAR_5, VAR_6, VAR_7, VAR_8;", "const float VAR_9 = VAR_1->sample_rate/(1024.0f/sce0->ics.num_windows)/2.0f;", "if (!VAR_2->common_window)\nreturn;", "for (VAR_5 = 0; VAR_5 < sce0->ics.num_windows; VAR_5 += sce0->ics.group_len[VAR_5]) {", "VAR_3 = 0;", "for (VAR_7 = 0; VAR_7 < sce0->ics.num_swb; VAR_7++) {", "if (VAR_3*VAR_9 > INT_STEREO_LOW_LIMIT*(VAR_0->lambda/170.0f) &&\nVAR_2->ch[0].band_type[VAR_5*16+VAR_7] != NOISE_BT && !VAR_2->ch[0].zeroes[VAR_5*16+VAR_7] &&\nVAR_2->ch[1].band_type[VAR_5*16+VAR_7] != NOISE_BT && !VAR_2->ch[1].zeroes[VAR_5*16+VAR_7]) {", "float ener0 = 0.0f, ener1 = 0.0f, ener01 = 0.0f;", "struct AACISError ph_err1, ph_err2, *erf;", "if (sce0->band_type[VAR_5*16+VAR_7] == NOISE_BT ||\nsce1->band_type[VAR_5*16+VAR_7] == NOISE_BT) {", "VAR_3 += sce0->ics.swb_sizes[VAR_7];", "continue;", "}", "for (VAR_6 = 0; VAR_6 < sce0->ics.group_len[VAR_5]; VAR_6++) {", "for (VAR_8 = 0; VAR_8 < sce0->ics.swb_sizes[VAR_7]; VAR_8++) {", "float coef0 = fabsf(sce0->pcoeffs[VAR_3+(VAR_5+VAR_6)*128+VAR_8]);", "float coef1 = fabsf(sce1->pcoeffs[VAR_3+(VAR_5+VAR_6)*128+VAR_8]);", "ener0 += coef0*coef0;", "ener1 += coef1*coef1;", "ener01 += (coef0 + coef1)*(coef0 + coef1);", "}", "}", "ph_err1 = ff_aac_is_encoding_err(VAR_0, VAR_2, VAR_3, VAR_5, VAR_7,\nener0, ener1, ener01, 0, -1);", "ph_err2 = ff_aac_is_encoding_err(VAR_0, VAR_2, VAR_3, VAR_5, VAR_7,\nener0, ener1, ener01, 0, +1);", "erf = ph_err1.error < ph_err2.error ? &ph_err1 : &ph_err2;", "if (erf->pass) {", "VAR_2->is_mask[VAR_5*16+VAR_7] = 1;", "VAR_2->ch[0].is_ener[VAR_5*16+VAR_7] = sqrt(ener0/ener01);", "VAR_2->ch[1].is_ener[VAR_5*16+VAR_7] = ener0/ener1;", "VAR_2->ch[1].band_type[VAR_5*16+VAR_7] = erf->phase ? INTENSITY_BT : INTENSITY_BT2;", "VAR_4++;", "}", "}", "VAR_3 += sce0->ics.swb_sizes[VAR_7];", "}", "}", "VAR_2->is_mode = !!VAR_4;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15, 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27, 29, 31 ], [ 33 ], [ 35 ], [ 37, 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65, 67 ], [ 69, 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ] ]
11,290
static int yuv4_write_header(AVFormatContext *s) { int* first_pkt = s->priv_data; if (s->nb_streams != 1) return AVERROR(EIO); if (s->streams[0]->codec->pix_fmt == PIX_FMT_YUV411P) { av_log(s, AV_LOG_ERROR, "Warning: generating rarely used 4:1:1 YUV stream, some mjpegtools might not work.\n"); else if ((s->streams[0]->codec->pix_fmt != PIX_FMT_YUV420P) && (s->streams[0]->codec->pix_fmt != PIX_FMT_YUV422P) && (s->streams[0]->codec->pix_fmt != PIX_FMT_GRAY8) && (s->streams[0]->codec->pix_fmt != PIX_FMT_YUV444P)) { av_log(s, AV_LOG_ERROR, "ERROR: yuv4mpeg only handles yuv444p, yuv422p, yuv420p, yuv411p and gray pixel formats. Use -pix_fmt to select one.\n"); return AVERROR(EIO); *first_pkt = 1; return 0;
true
FFmpeg
1f95fb58137951941d8d74bd47b1635b6d2399ec
static int yuv4_write_header(AVFormatContext *s) { int* first_pkt = s->priv_data; if (s->nb_streams != 1) return AVERROR(EIO); if (s->streams[0]->codec->pix_fmt == PIX_FMT_YUV411P) { av_log(s, AV_LOG_ERROR, "Warning: generating rarely used 4:1:1 YUV stream, some mjpegtools might not work.\n"); else if ((s->streams[0]->codec->pix_fmt != PIX_FMT_YUV420P) && (s->streams[0]->codec->pix_fmt != PIX_FMT_YUV422P) && (s->streams[0]->codec->pix_fmt != PIX_FMT_GRAY8) && (s->streams[0]->codec->pix_fmt != PIX_FMT_YUV444P)) { av_log(s, AV_LOG_ERROR, "ERROR: yuv4mpeg only handles yuv444p, yuv422p, yuv420p, yuv411p and gray pixel formats. Use -pix_fmt to select one.\n"); return AVERROR(EIO); *first_pkt = 1; return 0;
{ "code": [], "line_no": [] }
static int FUNC_0(AVFormatContext *VAR_0) { int* VAR_1 = VAR_0->priv_data; if (VAR_0->nb_streams != 1) return AVERROR(EIO); if (VAR_0->streams[0]->codec->pix_fmt == PIX_FMT_YUV411P) { av_log(VAR_0, AV_LOG_ERROR, "Warning: generating rarely used 4:1:1 YUV stream, some mjpegtools might not work.\n"); else if ((VAR_0->streams[0]->codec->pix_fmt != PIX_FMT_YUV420P) && (VAR_0->streams[0]->codec->pix_fmt != PIX_FMT_YUV422P) && (VAR_0->streams[0]->codec->pix_fmt != PIX_FMT_GRAY8) && (VAR_0->streams[0]->codec->pix_fmt != PIX_FMT_YUV444P)) { av_log(VAR_0, AV_LOG_ERROR, "ERROR: yuv4mpeg only handles yuv444p, yuv422p, yuv420p, yuv411p and gray pixel formats. Use -pix_fmt to select one.\n"); return AVERROR(EIO); *VAR_1 = 1; return 0;
[ "static int FUNC_0(AVFormatContext *VAR_0)\n{", "int* VAR_1 = VAR_0->priv_data;", "if (VAR_0->nb_streams != 1)\nreturn AVERROR(EIO);", "if (VAR_0->streams[0]->codec->pix_fmt == PIX_FMT_YUV411P) {", "av_log(VAR_0, AV_LOG_ERROR, \"Warning: generating rarely used 4:1:1 YUV stream, some mjpegtools might not work.\\n\");", "else if ((VAR_0->streams[0]->codec->pix_fmt != PIX_FMT_YUV420P) &&\n(VAR_0->streams[0]->codec->pix_fmt != PIX_FMT_YUV422P) &&\n(VAR_0->streams[0]->codec->pix_fmt != PIX_FMT_GRAY8) &&\n(VAR_0->streams[0]->codec->pix_fmt != PIX_FMT_YUV444P)) {", "av_log(VAR_0, AV_LOG_ERROR, \"ERROR: yuv4mpeg only handles yuv444p, yuv422p, yuv420p, yuv411p and gray pixel formats. Use -pix_fmt to select one.\\n\");", "return AVERROR(EIO);", "*VAR_1 = 1;", "return 0;" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 2 ], [ 3 ], [ 4, 5 ], [ 6 ], [ 7 ], [ 8, 9, 10, 11 ], [ 12 ], [ 13 ], [ 14 ], [ 15 ] ]
11,291
static void vmmouse_class_initfn(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); dc->realize = vmmouse_realizefn; dc->no_user = 1; dc->reset = vmmouse_reset; dc->vmsd = &vmstate_vmmouse; dc->props = vmmouse_properties; }
true
qemu
efec3dd631d94160288392721a5f9c39e50fb2bc
static void vmmouse_class_initfn(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); dc->realize = vmmouse_realizefn; dc->no_user = 1; dc->reset = vmmouse_reset; dc->vmsd = &vmstate_vmmouse; dc->props = vmmouse_properties; }
{ "code": [ " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;" ], "line_no": [ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11 ] }
static void FUNC_0(ObjectClass *VAR_0, void *VAR_1) { DeviceClass *dc = DEVICE_CLASS(VAR_0); dc->realize = vmmouse_realizefn; dc->no_user = 1; dc->reset = vmmouse_reset; dc->vmsd = &vmstate_vmmouse; dc->props = vmmouse_properties; }
[ "static void FUNC_0(ObjectClass *VAR_0, void *VAR_1)\n{", "DeviceClass *dc = DEVICE_CLASS(VAR_0);", "dc->realize = vmmouse_realizefn;", "dc->no_user = 1;", "dc->reset = vmmouse_reset;", "dc->vmsd = &vmstate_vmmouse;", "dc->props = vmmouse_properties;", "}" ]
[ 0, 0, 0, 1, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ] ]
11,292
static inline void array_free(array_t* array) { if(array->pointer) free(array->pointer); array->size=array->next=0; }
true
qemu
ce137829e7e58fcdc5ba63b5e256f972e80be438
static inline void array_free(array_t* array) { if(array->pointer) free(array->pointer); array->size=array->next=0; }
{ "code": [ " if(array->pointer)", " free(array->pointer);" ], "line_no": [ 5, 7 ] }
static inline void FUNC_0(array_t* VAR_0) { if(VAR_0->pointer) free(VAR_0->pointer); VAR_0->size=VAR_0->next=0; }
[ "static inline void FUNC_0(array_t* VAR_0)\n{", "if(VAR_0->pointer)\nfree(VAR_0->pointer);", "VAR_0->size=VAR_0->next=0;", "}" ]
[ 0, 1, 0, 0 ]
[ [ 1, 3 ], [ 5, 7 ], [ 9 ], [ 11 ] ]
11,294
int get_physical_address(CPUPPCState *env, mmu_ctx_t *ctx, target_ulong eaddr, int rw, int access_type) { int ret; #if 0 qemu_log("%s\n", __func__); #endif if ((access_type == ACCESS_CODE && msr_ir == 0) || (access_type != ACCESS_CODE && msr_dr == 0)) { if (env->mmu_model == POWERPC_MMU_BOOKE) { /* The BookE MMU always performs address translation. The IS and DS bits only affect the address space. */ ret = mmubooke_get_physical_address(env, ctx, eaddr, rw, access_type); } else if (env->mmu_model == POWERPC_MMU_BOOKE206) { ret = mmubooke206_get_physical_address(env, ctx, eaddr, rw, access_type); } else { /* No address translation. */ ret = check_physical(env, ctx, eaddr, rw); } } else { ret = -1; switch (env->mmu_model) { case POWERPC_MMU_32B: case POWERPC_MMU_601: case POWERPC_MMU_SOFT_6xx: case POWERPC_MMU_SOFT_74xx: /* Try to find a BAT */ if (env->nb_BATs != 0) { ret = get_bat(env, ctx, eaddr, rw, access_type); } #if defined(TARGET_PPC64) case POWERPC_MMU_620: case POWERPC_MMU_64B: case POWERPC_MMU_2_06: #endif if (ret < 0) { /* We didn't match any BAT entry or don't have BATs */ ret = get_segment(env, ctx, eaddr, rw, access_type); } break; case POWERPC_MMU_SOFT_4xx: case POWERPC_MMU_SOFT_4xx_Z: ret = mmu40x_get_physical_address(env, ctx, eaddr, rw, access_type); break; case POWERPC_MMU_BOOKE: ret = mmubooke_get_physical_address(env, ctx, eaddr, rw, access_type); break; case POWERPC_MMU_BOOKE206: ret = mmubooke206_get_physical_address(env, ctx, eaddr, rw, access_type); break; case POWERPC_MMU_MPC8xx: /* XXX: TODO */ cpu_abort(env, "MPC8xx MMU model is not implemented\n"); break; case POWERPC_MMU_REAL: cpu_abort(env, "PowerPC in real mode do not do any translation\n"); return -1; default: cpu_abort(env, "Unknown or invalid MMU model\n"); return -1; } } #if 0 qemu_log("%s address " TARGET_FMT_lx " => %d " TARGET_FMT_plx "\n", __func__, eaddr, ret, ctx->raddr); #endif return ret; }
true
qemu
4656e1f01289cc3aa20986deb6a407165826abe5
int get_physical_address(CPUPPCState *env, mmu_ctx_t *ctx, target_ulong eaddr, int rw, int access_type) { int ret; #if 0 qemu_log("%s\n", __func__); #endif if ((access_type == ACCESS_CODE && msr_ir == 0) || (access_type != ACCESS_CODE && msr_dr == 0)) { if (env->mmu_model == POWERPC_MMU_BOOKE) { ret = mmubooke_get_physical_address(env, ctx, eaddr, rw, access_type); } else if (env->mmu_model == POWERPC_MMU_BOOKE206) { ret = mmubooke206_get_physical_address(env, ctx, eaddr, rw, access_type); } else { ret = check_physical(env, ctx, eaddr, rw); } } else { ret = -1; switch (env->mmu_model) { case POWERPC_MMU_32B: case POWERPC_MMU_601: case POWERPC_MMU_SOFT_6xx: case POWERPC_MMU_SOFT_74xx: if (env->nb_BATs != 0) { ret = get_bat(env, ctx, eaddr, rw, access_type); } #if defined(TARGET_PPC64) case POWERPC_MMU_620: case POWERPC_MMU_64B: case POWERPC_MMU_2_06: #endif if (ret < 0) { ret = get_segment(env, ctx, eaddr, rw, access_type); } break; case POWERPC_MMU_SOFT_4xx: case POWERPC_MMU_SOFT_4xx_Z: ret = mmu40x_get_physical_address(env, ctx, eaddr, rw, access_type); break; case POWERPC_MMU_BOOKE: ret = mmubooke_get_physical_address(env, ctx, eaddr, rw, access_type); break; case POWERPC_MMU_BOOKE206: ret = mmubooke206_get_physical_address(env, ctx, eaddr, rw, access_type); break; case POWERPC_MMU_MPC8xx: cpu_abort(env, "MPC8xx MMU model is not implemented\n"); break; case POWERPC_MMU_REAL: cpu_abort(env, "PowerPC in real mode do not do any translation\n"); return -1; default: cpu_abort(env, "Unknown or invalid MMU model\n"); return -1; } } #if 0 qemu_log("%s address " TARGET_FMT_lx " => %d " TARGET_FMT_plx "\n", __func__, eaddr, ret, ctx->raddr); #endif return ret; }
{ "code": [], "line_no": [] }
int FUNC_0(CPUPPCState *VAR_0, mmu_ctx_t *VAR_1, target_ulong VAR_2, int VAR_3, int VAR_4) { int VAR_5; #if 0 qemu_log("%s\n", __func__); #endif if ((VAR_4 == ACCESS_CODE && msr_ir == 0) || (VAR_4 != ACCESS_CODE && msr_dr == 0)) { if (VAR_0->mmu_model == POWERPC_MMU_BOOKE) { VAR_5 = mmubooke_get_physical_address(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4); } else if (VAR_0->mmu_model == POWERPC_MMU_BOOKE206) { VAR_5 = mmubooke206_get_physical_address(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4); } else { VAR_5 = check_physical(VAR_0, VAR_1, VAR_2, VAR_3); } } else { VAR_5 = -1; switch (VAR_0->mmu_model) { case POWERPC_MMU_32B: case POWERPC_MMU_601: case POWERPC_MMU_SOFT_6xx: case POWERPC_MMU_SOFT_74xx: if (VAR_0->nb_BATs != 0) { VAR_5 = get_bat(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4); } #if defined(TARGET_PPC64) case POWERPC_MMU_620: case POWERPC_MMU_64B: case POWERPC_MMU_2_06: #endif if (VAR_5 < 0) { VAR_5 = get_segment(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4); } break; case POWERPC_MMU_SOFT_4xx: case POWERPC_MMU_SOFT_4xx_Z: VAR_5 = mmu40x_get_physical_address(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4); break; case POWERPC_MMU_BOOKE: VAR_5 = mmubooke_get_physical_address(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4); break; case POWERPC_MMU_BOOKE206: VAR_5 = mmubooke206_get_physical_address(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4); break; case POWERPC_MMU_MPC8xx: cpu_abort(VAR_0, "MPC8xx MMU model is not implemented\n"); break; case POWERPC_MMU_REAL: cpu_abort(VAR_0, "PowerPC in real mode do not do any translation\n"); return -1; default: cpu_abort(VAR_0, "Unknown or invalid MMU model\n"); return -1; } } #if 0 qemu_log("%s address " TARGET_FMT_lx " => %d " TARGET_FMT_plx "\n", __func__, VAR_2, VAR_5, VAR_1->raddr); #endif return VAR_5; }
[ "int FUNC_0(CPUPPCState *VAR_0, mmu_ctx_t *VAR_1, target_ulong VAR_2,\nint VAR_3, int VAR_4)\n{", "int VAR_5;", "#if 0\nqemu_log(\"%s\\n\", __func__);", "#endif\nif ((VAR_4 == ACCESS_CODE && msr_ir == 0) ||\n(VAR_4 != ACCESS_CODE && msr_dr == 0)) {", "if (VAR_0->mmu_model == POWERPC_MMU_BOOKE) {", "VAR_5 = mmubooke_get_physical_address(VAR_0, VAR_1, VAR_2,\nVAR_3, VAR_4);", "} else if (VAR_0->mmu_model == POWERPC_MMU_BOOKE206) {", "VAR_5 = mmubooke206_get_physical_address(VAR_0, VAR_1, VAR_2, VAR_3,\nVAR_4);", "} else {", "VAR_5 = check_physical(VAR_0, VAR_1, VAR_2, VAR_3);", "}", "} else {", "VAR_5 = -1;", "switch (VAR_0->mmu_model) {", "case POWERPC_MMU_32B:\ncase POWERPC_MMU_601:\ncase POWERPC_MMU_SOFT_6xx:\ncase POWERPC_MMU_SOFT_74xx:\nif (VAR_0->nb_BATs != 0) {", "VAR_5 = get_bat(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4);", "}", "#if defined(TARGET_PPC64)\ncase POWERPC_MMU_620:\ncase POWERPC_MMU_64B:\ncase POWERPC_MMU_2_06:\n#endif\nif (VAR_5 < 0) {", "VAR_5 = get_segment(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4);", "}", "break;", "case POWERPC_MMU_SOFT_4xx:\ncase POWERPC_MMU_SOFT_4xx_Z:\nVAR_5 = mmu40x_get_physical_address(VAR_0, VAR_1, VAR_2,\nVAR_3, VAR_4);", "break;", "case POWERPC_MMU_BOOKE:\nVAR_5 = mmubooke_get_physical_address(VAR_0, VAR_1, VAR_2,\nVAR_3, VAR_4);", "break;", "case POWERPC_MMU_BOOKE206:\nVAR_5 = mmubooke206_get_physical_address(VAR_0, VAR_1, VAR_2, VAR_3,\nVAR_4);", "break;", "case POWERPC_MMU_MPC8xx:\ncpu_abort(VAR_0, \"MPC8xx MMU model is not implemented\\n\");", "break;", "case POWERPC_MMU_REAL:\ncpu_abort(VAR_0, \"PowerPC in real mode do not do any translation\\n\");", "return -1;", "default:\ncpu_abort(VAR_0, \"Unknown or invalid MMU model\\n\");", "return -1;", "}", "}", "#if 0\nqemu_log(\"%s address \" TARGET_FMT_lx \" => %d \" TARGET_FMT_plx \"\\n\",\n__func__, VAR_2, VAR_5, VAR_1->raddr);", "#endif\nreturn VAR_5;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11, 13 ], [ 15, 17, 19 ], [ 21 ], [ 27, 29 ], [ 31 ], [ 33, 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51, 53, 55, 57, 61 ], [ 63 ], [ 65 ], [ 67, 69, 71, 73, 76, 78 ], [ 82 ], [ 84 ], [ 86 ], [ 88, 90, 92, 94 ], [ 96 ], [ 98, 100, 102 ], [ 104 ], [ 106, 108, 110 ], [ 112 ], [ 114, 118 ], [ 120 ], [ 122, 124 ], [ 126 ], [ 128, 130 ], [ 132 ], [ 134 ], [ 136 ], [ 138, 140, 142 ], [ 144, 148 ], [ 150 ] ]
11,296
static int vaapi_mpeg4_start_frame(AVCodecContext *avctx, av_unused const uint8_t *buffer, av_unused uint32_t size) { Mpeg4DecContext *ctx = avctx->priv_data; MpegEncContext * const s = &ctx->m; struct vaapi_context * const vactx = avctx->hwaccel_context; VAPictureParameterBufferMPEG4 *pic_param; VAIQMatrixBufferMPEG4 *iq_matrix; int i; av_dlog(avctx, "vaapi_mpeg4_start_frame()\n"); vactx->slice_param_size = sizeof(VASliceParameterBufferMPEG4); /* Fill in VAPictureParameterBufferMPEG4 */ pic_param = ff_vaapi_alloc_pic_param(vactx, sizeof(VAPictureParameterBufferMPEG4)); if (!pic_param) return -1; pic_param->vop_width = s->width; pic_param->vop_height = s->height; pic_param->forward_reference_picture = VA_INVALID_ID; pic_param->backward_reference_picture = VA_INVALID_ID; pic_param->vol_fields.value = 0; /* reset all bits */ pic_param->vol_fields.bits.short_video_header = avctx->codec->id == AV_CODEC_ID_H263; pic_param->vol_fields.bits.chroma_format = CHROMA_420; pic_param->vol_fields.bits.interlaced = !s->progressive_sequence; pic_param->vol_fields.bits.obmc_disable = 1; pic_param->vol_fields.bits.sprite_enable = ctx->vol_sprite_usage; pic_param->vol_fields.bits.sprite_warping_accuracy = s->sprite_warping_accuracy; pic_param->vol_fields.bits.quant_type = s->mpeg_quant; pic_param->vol_fields.bits.quarter_sample = s->quarter_sample; pic_param->vol_fields.bits.data_partitioned = s->data_partitioning; pic_param->vol_fields.bits.reversible_vlc = ctx->rvlc; pic_param->vol_fields.bits.resync_marker_disable = !ctx->resync_marker; pic_param->no_of_sprite_warping_points = ctx->num_sprite_warping_points; for (i = 0; i < ctx->num_sprite_warping_points && i < 3; i++) { pic_param->sprite_trajectory_du[i] = ctx->sprite_traj[i][0]; pic_param->sprite_trajectory_dv[i] = ctx->sprite_traj[i][1]; } pic_param->quant_precision = s->quant_precision; pic_param->vop_fields.value = 0; /* reset all bits */ pic_param->vop_fields.bits.vop_coding_type = s->pict_type - AV_PICTURE_TYPE_I; pic_param->vop_fields.bits.backward_reference_vop_coding_type = s->pict_type == AV_PICTURE_TYPE_B ? s->next_picture.f.pict_type - AV_PICTURE_TYPE_I : 0; pic_param->vop_fields.bits.vop_rounding_type = s->no_rounding; pic_param->vop_fields.bits.intra_dc_vlc_thr = mpeg4_get_intra_dc_vlc_thr(ctx); pic_param->vop_fields.bits.top_field_first = s->top_field_first; pic_param->vop_fields.bits.alternate_vertical_scan_flag = s->alternate_scan; pic_param->vop_fcode_forward = s->f_code; pic_param->vop_fcode_backward = s->b_code; pic_param->vop_time_increment_resolution = avctx->time_base.den; pic_param->num_macroblocks_in_gob = s->mb_width * ff_h263_get_gob_height(s); pic_param->num_gobs_in_vop = (s->mb_width * s->mb_height) / pic_param->num_macroblocks_in_gob; pic_param->TRB = s->pb_time; pic_param->TRD = s->pp_time; if (s->pict_type == AV_PICTURE_TYPE_B) pic_param->backward_reference_picture = ff_vaapi_get_surface_id(&s->next_picture.f); if (s->pict_type != AV_PICTURE_TYPE_I) pic_param->forward_reference_picture = ff_vaapi_get_surface_id(&s->last_picture.f); /* Fill in VAIQMatrixBufferMPEG4 */ /* Only the first inverse quantisation method uses the weighting matrices */ if (pic_param->vol_fields.bits.quant_type) { iq_matrix = ff_vaapi_alloc_iq_matrix(vactx, sizeof(VAIQMatrixBufferMPEG4)); if (!iq_matrix) return -1; iq_matrix->load_intra_quant_mat = 1; iq_matrix->load_non_intra_quant_mat = 1; for (i = 0; i < 64; i++) { int n = s->dsp.idct_permutation[ff_zigzag_direct[i]]; iq_matrix->intra_quant_mat[i] = s->intra_matrix[n]; iq_matrix->non_intra_quant_mat[i] = s->inter_matrix[n]; } } return 0; }
true
FFmpeg
f6774f905fb3cfdc319523ac640be30b14c1bc55
static int vaapi_mpeg4_start_frame(AVCodecContext *avctx, av_unused const uint8_t *buffer, av_unused uint32_t size) { Mpeg4DecContext *ctx = avctx->priv_data; MpegEncContext * const s = &ctx->m; struct vaapi_context * const vactx = avctx->hwaccel_context; VAPictureParameterBufferMPEG4 *pic_param; VAIQMatrixBufferMPEG4 *iq_matrix; int i; av_dlog(avctx, "vaapi_mpeg4_start_frame()\n"); vactx->slice_param_size = sizeof(VASliceParameterBufferMPEG4); pic_param = ff_vaapi_alloc_pic_param(vactx, sizeof(VAPictureParameterBufferMPEG4)); if (!pic_param) return -1; pic_param->vop_width = s->width; pic_param->vop_height = s->height; pic_param->forward_reference_picture = VA_INVALID_ID; pic_param->backward_reference_picture = VA_INVALID_ID; pic_param->vol_fields.value = 0; pic_param->vol_fields.bits.short_video_header = avctx->codec->id == AV_CODEC_ID_H263; pic_param->vol_fields.bits.chroma_format = CHROMA_420; pic_param->vol_fields.bits.interlaced = !s->progressive_sequence; pic_param->vol_fields.bits.obmc_disable = 1; pic_param->vol_fields.bits.sprite_enable = ctx->vol_sprite_usage; pic_param->vol_fields.bits.sprite_warping_accuracy = s->sprite_warping_accuracy; pic_param->vol_fields.bits.quant_type = s->mpeg_quant; pic_param->vol_fields.bits.quarter_sample = s->quarter_sample; pic_param->vol_fields.bits.data_partitioned = s->data_partitioning; pic_param->vol_fields.bits.reversible_vlc = ctx->rvlc; pic_param->vol_fields.bits.resync_marker_disable = !ctx->resync_marker; pic_param->no_of_sprite_warping_points = ctx->num_sprite_warping_points; for (i = 0; i < ctx->num_sprite_warping_points && i < 3; i++) { pic_param->sprite_trajectory_du[i] = ctx->sprite_traj[i][0]; pic_param->sprite_trajectory_dv[i] = ctx->sprite_traj[i][1]; } pic_param->quant_precision = s->quant_precision; pic_param->vop_fields.value = 0; pic_param->vop_fields.bits.vop_coding_type = s->pict_type - AV_PICTURE_TYPE_I; pic_param->vop_fields.bits.backward_reference_vop_coding_type = s->pict_type == AV_PICTURE_TYPE_B ? s->next_picture.f.pict_type - AV_PICTURE_TYPE_I : 0; pic_param->vop_fields.bits.vop_rounding_type = s->no_rounding; pic_param->vop_fields.bits.intra_dc_vlc_thr = mpeg4_get_intra_dc_vlc_thr(ctx); pic_param->vop_fields.bits.top_field_first = s->top_field_first; pic_param->vop_fields.bits.alternate_vertical_scan_flag = s->alternate_scan; pic_param->vop_fcode_forward = s->f_code; pic_param->vop_fcode_backward = s->b_code; pic_param->vop_time_increment_resolution = avctx->time_base.den; pic_param->num_macroblocks_in_gob = s->mb_width * ff_h263_get_gob_height(s); pic_param->num_gobs_in_vop = (s->mb_width * s->mb_height) / pic_param->num_macroblocks_in_gob; pic_param->TRB = s->pb_time; pic_param->TRD = s->pp_time; if (s->pict_type == AV_PICTURE_TYPE_B) pic_param->backward_reference_picture = ff_vaapi_get_surface_id(&s->next_picture.f); if (s->pict_type != AV_PICTURE_TYPE_I) pic_param->forward_reference_picture = ff_vaapi_get_surface_id(&s->last_picture.f); if (pic_param->vol_fields.bits.quant_type) { iq_matrix = ff_vaapi_alloc_iq_matrix(vactx, sizeof(VAIQMatrixBufferMPEG4)); if (!iq_matrix) return -1; iq_matrix->load_intra_quant_mat = 1; iq_matrix->load_non_intra_quant_mat = 1; for (i = 0; i < 64; i++) { int n = s->dsp.idct_permutation[ff_zigzag_direct[i]]; iq_matrix->intra_quant_mat[i] = s->intra_matrix[n]; iq_matrix->non_intra_quant_mat[i] = s->inter_matrix[n]; } } return 0; }
{ "code": [ " pic_param->backward_reference_picture = ff_vaapi_get_surface_id(&s->next_picture.f);", " pic_param->vop_fields.bits.backward_reference_vop_coding_type = s->pict_type == AV_PICTURE_TYPE_B ? s->next_picture.f.pict_type - AV_PICTURE_TYPE_I : 0;", " pic_param->backward_reference_picture = ff_vaapi_get_surface_id(&s->next_picture.f);", " pic_param->forward_reference_picture = ff_vaapi_get_surface_id(&s->last_picture.f);", " pic_param->backward_reference_picture = ff_vaapi_get_surface_id(&s->next_picture.f);" ], "line_no": [ 111, 83, 111, 115, 111 ] }
static int FUNC_0(AVCodecContext *VAR_0, av_unused const VAR_1 *buffer, av_unused uint32_t size) { Mpeg4DecContext *ctx = VAR_0->priv_data; MpegEncContext * const s = &ctx->m; struct vaapi_context * const VAR_2 = VAR_0->hwaccel_context; VAPictureParameterBufferMPEG4 *pic_param; VAIQMatrixBufferMPEG4 *iq_matrix; int VAR_3; av_dlog(VAR_0, "FUNC_0()\VAR_4"); VAR_2->slice_param_size = sizeof(VASliceParameterBufferMPEG4); pic_param = ff_vaapi_alloc_pic_param(VAR_2, sizeof(VAPictureParameterBufferMPEG4)); if (!pic_param) return -1; pic_param->vop_width = s->width; pic_param->vop_height = s->height; pic_param->forward_reference_picture = VA_INVALID_ID; pic_param->backward_reference_picture = VA_INVALID_ID; pic_param->vol_fields.value = 0; pic_param->vol_fields.bits.short_video_header = VAR_0->codec->id == AV_CODEC_ID_H263; pic_param->vol_fields.bits.chroma_format = CHROMA_420; pic_param->vol_fields.bits.interlaced = !s->progressive_sequence; pic_param->vol_fields.bits.obmc_disable = 1; pic_param->vol_fields.bits.sprite_enable = ctx->vol_sprite_usage; pic_param->vol_fields.bits.sprite_warping_accuracy = s->sprite_warping_accuracy; pic_param->vol_fields.bits.quant_type = s->mpeg_quant; pic_param->vol_fields.bits.quarter_sample = s->quarter_sample; pic_param->vol_fields.bits.data_partitioned = s->data_partitioning; pic_param->vol_fields.bits.reversible_vlc = ctx->rvlc; pic_param->vol_fields.bits.resync_marker_disable = !ctx->resync_marker; pic_param->no_of_sprite_warping_points = ctx->num_sprite_warping_points; for (VAR_3 = 0; VAR_3 < ctx->num_sprite_warping_points && VAR_3 < 3; VAR_3++) { pic_param->sprite_trajectory_du[VAR_3] = ctx->sprite_traj[VAR_3][0]; pic_param->sprite_trajectory_dv[VAR_3] = ctx->sprite_traj[VAR_3][1]; } pic_param->quant_precision = s->quant_precision; pic_param->vop_fields.value = 0; pic_param->vop_fields.bits.vop_coding_type = s->pict_type - AV_PICTURE_TYPE_I; pic_param->vop_fields.bits.backward_reference_vop_coding_type = s->pict_type == AV_PICTURE_TYPE_B ? s->next_picture.f.pict_type - AV_PICTURE_TYPE_I : 0; pic_param->vop_fields.bits.vop_rounding_type = s->no_rounding; pic_param->vop_fields.bits.intra_dc_vlc_thr = mpeg4_get_intra_dc_vlc_thr(ctx); pic_param->vop_fields.bits.top_field_first = s->top_field_first; pic_param->vop_fields.bits.alternate_vertical_scan_flag = s->alternate_scan; pic_param->vop_fcode_forward = s->f_code; pic_param->vop_fcode_backward = s->b_code; pic_param->vop_time_increment_resolution = VAR_0->time_base.den; pic_param->num_macroblocks_in_gob = s->mb_width * ff_h263_get_gob_height(s); pic_param->num_gobs_in_vop = (s->mb_width * s->mb_height) / pic_param->num_macroblocks_in_gob; pic_param->TRB = s->pb_time; pic_param->TRD = s->pp_time; if (s->pict_type == AV_PICTURE_TYPE_B) pic_param->backward_reference_picture = ff_vaapi_get_surface_id(&s->next_picture.f); if (s->pict_type != AV_PICTURE_TYPE_I) pic_param->forward_reference_picture = ff_vaapi_get_surface_id(&s->last_picture.f); if (pic_param->vol_fields.bits.quant_type) { iq_matrix = ff_vaapi_alloc_iq_matrix(VAR_2, sizeof(VAIQMatrixBufferMPEG4)); if (!iq_matrix) return -1; iq_matrix->load_intra_quant_mat = 1; iq_matrix->load_non_intra_quant_mat = 1; for (VAR_3 = 0; VAR_3 < 64; VAR_3++) { int VAR_4 = s->dsp.idct_permutation[ff_zigzag_direct[VAR_3]]; iq_matrix->intra_quant_mat[VAR_3] = s->intra_matrix[VAR_4]; iq_matrix->non_intra_quant_mat[VAR_3] = s->inter_matrix[VAR_4]; } } return 0; }
[ "static int FUNC_0(AVCodecContext *VAR_0, av_unused const VAR_1 *buffer, av_unused uint32_t size)\n{", "Mpeg4DecContext *ctx = VAR_0->priv_data;", "MpegEncContext * const s = &ctx->m;", "struct vaapi_context * const VAR_2 = VAR_0->hwaccel_context;", "VAPictureParameterBufferMPEG4 *pic_param;", "VAIQMatrixBufferMPEG4 *iq_matrix;", "int VAR_3;", "av_dlog(VAR_0, \"FUNC_0()\\VAR_4\");", "VAR_2->slice_param_size = sizeof(VASliceParameterBufferMPEG4);", "pic_param = ff_vaapi_alloc_pic_param(VAR_2, sizeof(VAPictureParameterBufferMPEG4));", "if (!pic_param)\nreturn -1;", "pic_param->vop_width = s->width;", "pic_param->vop_height = s->height;", "pic_param->forward_reference_picture = VA_INVALID_ID;", "pic_param->backward_reference_picture = VA_INVALID_ID;", "pic_param->vol_fields.value = 0;", "pic_param->vol_fields.bits.short_video_header = VAR_0->codec->id == AV_CODEC_ID_H263;", "pic_param->vol_fields.bits.chroma_format = CHROMA_420;", "pic_param->vol_fields.bits.interlaced = !s->progressive_sequence;", "pic_param->vol_fields.bits.obmc_disable = 1;", "pic_param->vol_fields.bits.sprite_enable = ctx->vol_sprite_usage;", "pic_param->vol_fields.bits.sprite_warping_accuracy = s->sprite_warping_accuracy;", "pic_param->vol_fields.bits.quant_type = s->mpeg_quant;", "pic_param->vol_fields.bits.quarter_sample = s->quarter_sample;", "pic_param->vol_fields.bits.data_partitioned = s->data_partitioning;", "pic_param->vol_fields.bits.reversible_vlc = ctx->rvlc;", "pic_param->vol_fields.bits.resync_marker_disable = !ctx->resync_marker;", "pic_param->no_of_sprite_warping_points = ctx->num_sprite_warping_points;", "for (VAR_3 = 0; VAR_3 < ctx->num_sprite_warping_points && VAR_3 < 3; VAR_3++) {", "pic_param->sprite_trajectory_du[VAR_3] = ctx->sprite_traj[VAR_3][0];", "pic_param->sprite_trajectory_dv[VAR_3] = ctx->sprite_traj[VAR_3][1];", "}", "pic_param->quant_precision = s->quant_precision;", "pic_param->vop_fields.value = 0;", "pic_param->vop_fields.bits.vop_coding_type = s->pict_type - AV_PICTURE_TYPE_I;", "pic_param->vop_fields.bits.backward_reference_vop_coding_type = s->pict_type == AV_PICTURE_TYPE_B ? s->next_picture.f.pict_type - AV_PICTURE_TYPE_I : 0;", "pic_param->vop_fields.bits.vop_rounding_type = s->no_rounding;", "pic_param->vop_fields.bits.intra_dc_vlc_thr = mpeg4_get_intra_dc_vlc_thr(ctx);", "pic_param->vop_fields.bits.top_field_first = s->top_field_first;", "pic_param->vop_fields.bits.alternate_vertical_scan_flag = s->alternate_scan;", "pic_param->vop_fcode_forward = s->f_code;", "pic_param->vop_fcode_backward = s->b_code;", "pic_param->vop_time_increment_resolution = VAR_0->time_base.den;", "pic_param->num_macroblocks_in_gob = s->mb_width * ff_h263_get_gob_height(s);", "pic_param->num_gobs_in_vop = (s->mb_width * s->mb_height) / pic_param->num_macroblocks_in_gob;", "pic_param->TRB = s->pb_time;", "pic_param->TRD = s->pp_time;", "if (s->pict_type == AV_PICTURE_TYPE_B)\npic_param->backward_reference_picture = ff_vaapi_get_surface_id(&s->next_picture.f);", "if (s->pict_type != AV_PICTURE_TYPE_I)\npic_param->forward_reference_picture = ff_vaapi_get_surface_id(&s->last_picture.f);", "if (pic_param->vol_fields.bits.quant_type) {", "iq_matrix = ff_vaapi_alloc_iq_matrix(VAR_2, sizeof(VAIQMatrixBufferMPEG4));", "if (!iq_matrix)\nreturn -1;", "iq_matrix->load_intra_quant_mat = 1;", "iq_matrix->load_non_intra_quant_mat = 1;", "for (VAR_3 = 0; VAR_3 < 64; VAR_3++) {", "int VAR_4 = s->dsp.idct_permutation[ff_zigzag_direct[VAR_3]];", "iq_matrix->intra_quant_mat[VAR_3] = s->intra_matrix[VAR_4];", "iq_matrix->non_intra_quant_mat[VAR_3] = s->inter_matrix[VAR_4];", "}", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 23 ], [ 29 ], [ 31, 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 109, 111 ], [ 113, 115 ], [ 123 ], [ 125 ], [ 127, 129 ], [ 131 ], [ 133 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ] ]
11,297
static inline int mpeg2_fast_decode_block_intra(MpegEncContext *s, int16_t *block, int n) { int level, dc, diff, j, run; int component; RLTable *rl; uint8_t * scantable = s->intra_scantable.permutated; const uint16_t *quant_matrix; const int qscale = s->qscale; /* DC coefficient */ if (n < 4) { quant_matrix = s->intra_matrix; component = 0; } else { quant_matrix = s->chroma_intra_matrix; component = (n & 1) + 1; } diff = decode_dc(&s->gb, component); if (diff >= 0xffff) return -1; dc = s->last_dc[component]; dc += diff; s->last_dc[component] = dc; block[0] = dc << (3 - s->intra_dc_precision); if (s->intra_vlc_format) rl = &ff_rl_mpeg2; else rl = &ff_rl_mpeg1; { OPEN_READER(re, &s->gb); /* now quantify & encode AC coefficients */ for (;;) { UPDATE_CACHE(re, &s->gb); GET_RL_VLC(level, run, re, &s->gb, rl->rl_vlc[0], TEX_VLC_BITS, 2, 0); if (level == 127) { break; } else if (level != 0) { scantable += run; j = *scantable; level = (level * qscale * quant_matrix[j]) >> 4; level = (level ^ SHOW_SBITS(re, &s->gb, 1)) - SHOW_SBITS(re, &s->gb, 1); LAST_SKIP_BITS(re, &s->gb, 1); } else { /* escape */ run = SHOW_UBITS(re, &s->gb, 6) + 1; LAST_SKIP_BITS(re, &s->gb, 6); UPDATE_CACHE(re, &s->gb); level = SHOW_SBITS(re, &s->gb, 12); SKIP_BITS(re, &s->gb, 12); scantable += run; j = *scantable; if (level < 0) { level = (-level * qscale * quant_matrix[j]) >> 4; level = -level; } else { level = (level * qscale * quant_matrix[j]) >> 4; } } block[j] = level; } CLOSE_READER(re, &s->gb); } s->block_last_index[n] = scantable - s->intra_scantable.permutated; return 0; }
false
FFmpeg
746350ea0f7bde1e9fd23270e104af8897197293
static inline int mpeg2_fast_decode_block_intra(MpegEncContext *s, int16_t *block, int n) { int level, dc, diff, j, run; int component; RLTable *rl; uint8_t * scantable = s->intra_scantable.permutated; const uint16_t *quant_matrix; const int qscale = s->qscale; if (n < 4) { quant_matrix = s->intra_matrix; component = 0; } else { quant_matrix = s->chroma_intra_matrix; component = (n & 1) + 1; } diff = decode_dc(&s->gb, component); if (diff >= 0xffff) return -1; dc = s->last_dc[component]; dc += diff; s->last_dc[component] = dc; block[0] = dc << (3 - s->intra_dc_precision); if (s->intra_vlc_format) rl = &ff_rl_mpeg2; else rl = &ff_rl_mpeg1; { OPEN_READER(re, &s->gb); for (;;) { UPDATE_CACHE(re, &s->gb); GET_RL_VLC(level, run, re, &s->gb, rl->rl_vlc[0], TEX_VLC_BITS, 2, 0); if (level == 127) { break; } else if (level != 0) { scantable += run; j = *scantable; level = (level * qscale * quant_matrix[j]) >> 4; level = (level ^ SHOW_SBITS(re, &s->gb, 1)) - SHOW_SBITS(re, &s->gb, 1); LAST_SKIP_BITS(re, &s->gb, 1); } else { run = SHOW_UBITS(re, &s->gb, 6) + 1; LAST_SKIP_BITS(re, &s->gb, 6); UPDATE_CACHE(re, &s->gb); level = SHOW_SBITS(re, &s->gb, 12); SKIP_BITS(re, &s->gb, 12); scantable += run; j = *scantable; if (level < 0) { level = (-level * qscale * quant_matrix[j]) >> 4; level = -level; } else { level = (level * qscale * quant_matrix[j]) >> 4; } } block[j] = level; } CLOSE_READER(re, &s->gb); } s->block_last_index[n] = scantable - s->intra_scantable.permutated; return 0; }
{ "code": [], "line_no": [] }
static inline int FUNC_0(MpegEncContext *VAR_0, int16_t *VAR_1, int VAR_2) { int VAR_3, VAR_4, VAR_5, VAR_6, VAR_7; int VAR_8; RLTable *rl; uint8_t * scantable = VAR_0->intra_scantable.permutated; const uint16_t *VAR_9; const int VAR_10 = VAR_0->VAR_10; if (VAR_2 < 4) { VAR_9 = VAR_0->intra_matrix; VAR_8 = 0; } else { VAR_9 = VAR_0->chroma_intra_matrix; VAR_8 = (VAR_2 & 1) + 1; } VAR_5 = decode_dc(&VAR_0->gb, VAR_8); if (VAR_5 >= 0xffff) return -1; VAR_4 = VAR_0->last_dc[VAR_8]; VAR_4 += VAR_5; VAR_0->last_dc[VAR_8] = VAR_4; VAR_1[0] = VAR_4 << (3 - VAR_0->intra_dc_precision); if (VAR_0->intra_vlc_format) rl = &ff_rl_mpeg2; else rl = &ff_rl_mpeg1; { OPEN_READER(re, &VAR_0->gb); for (;;) { UPDATE_CACHE(re, &VAR_0->gb); GET_RL_VLC(VAR_3, VAR_7, re, &VAR_0->gb, rl->rl_vlc[0], TEX_VLC_BITS, 2, 0); if (VAR_3 == 127) { break; } else if (VAR_3 != 0) { scantable += VAR_7; VAR_6 = *scantable; VAR_3 = (VAR_3 * VAR_10 * VAR_9[VAR_6]) >> 4; VAR_3 = (VAR_3 ^ SHOW_SBITS(re, &VAR_0->gb, 1)) - SHOW_SBITS(re, &VAR_0->gb, 1); LAST_SKIP_BITS(re, &VAR_0->gb, 1); } else { VAR_7 = SHOW_UBITS(re, &VAR_0->gb, 6) + 1; LAST_SKIP_BITS(re, &VAR_0->gb, 6); UPDATE_CACHE(re, &VAR_0->gb); VAR_3 = SHOW_SBITS(re, &VAR_0->gb, 12); SKIP_BITS(re, &VAR_0->gb, 12); scantable += VAR_7; VAR_6 = *scantable; if (VAR_3 < 0) { VAR_3 = (-VAR_3 * VAR_10 * VAR_9[VAR_6]) >> 4; VAR_3 = -VAR_3; } else { VAR_3 = (VAR_3 * VAR_10 * VAR_9[VAR_6]) >> 4; } } VAR_1[VAR_6] = VAR_3; } CLOSE_READER(re, &VAR_0->gb); } VAR_0->block_last_index[VAR_2] = scantable - VAR_0->intra_scantable.permutated; return 0; }
[ "static inline int FUNC_0(MpegEncContext *VAR_0, int16_t *VAR_1, int VAR_2)\n{", "int VAR_3, VAR_4, VAR_5, VAR_6, VAR_7;", "int VAR_8;", "RLTable *rl;", "uint8_t * scantable = VAR_0->intra_scantable.permutated;", "const uint16_t *VAR_9;", "const int VAR_10 = VAR_0->VAR_10;", "if (VAR_2 < 4) {", "VAR_9 = VAR_0->intra_matrix;", "VAR_8 = 0;", "} else {", "VAR_9 = VAR_0->chroma_intra_matrix;", "VAR_8 = (VAR_2 & 1) + 1;", "}", "VAR_5 = decode_dc(&VAR_0->gb, VAR_8);", "if (VAR_5 >= 0xffff)\nreturn -1;", "VAR_4 = VAR_0->last_dc[VAR_8];", "VAR_4 += VAR_5;", "VAR_0->last_dc[VAR_8] = VAR_4;", "VAR_1[0] = VAR_4 << (3 - VAR_0->intra_dc_precision);", "if (VAR_0->intra_vlc_format)\nrl = &ff_rl_mpeg2;", "else\nrl = &ff_rl_mpeg1;", "{", "OPEN_READER(re, &VAR_0->gb);", "for (;;) {", "UPDATE_CACHE(re, &VAR_0->gb);", "GET_RL_VLC(VAR_3, VAR_7, re, &VAR_0->gb, rl->rl_vlc[0], TEX_VLC_BITS, 2, 0);", "if (VAR_3 == 127) {", "break;", "} else if (VAR_3 != 0) {", "scantable += VAR_7;", "VAR_6 = *scantable;", "VAR_3 = (VAR_3 * VAR_10 * VAR_9[VAR_6]) >> 4;", "VAR_3 = (VAR_3 ^ SHOW_SBITS(re, &VAR_0->gb, 1)) - SHOW_SBITS(re, &VAR_0->gb, 1);", "LAST_SKIP_BITS(re, &VAR_0->gb, 1);", "} else {", "VAR_7 = SHOW_UBITS(re, &VAR_0->gb, 6) + 1; LAST_SKIP_BITS(re, &VAR_0->gb, 6);", "UPDATE_CACHE(re, &VAR_0->gb);", "VAR_3 = SHOW_SBITS(re, &VAR_0->gb, 12); SKIP_BITS(re, &VAR_0->gb, 12);", "scantable += VAR_7;", "VAR_6 = *scantable;", "if (VAR_3 < 0) {", "VAR_3 = (-VAR_3 * VAR_10 * VAR_9[VAR_6]) >> 4;", "VAR_3 = -VAR_3;", "} else {", "VAR_3 = (VAR_3 * VAR_10 * VAR_9[VAR_6]) >> 4;", "}", "}", "VAR_1[VAR_6] = VAR_3;", "}", "CLOSE_READER(re, &VAR_0->gb);", "}", "VAR_0->block_last_index[VAR_2] = scantable - VAR_0->intra_scantable.permutated;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37, 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49, 51 ], [ 53, 55 ], [ 59 ], [ 61 ], [ 65 ], [ 67 ], [ 69 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 129 ], [ 131 ], [ 133 ] ]
11,298
target_phys_addr_t cpu_get_phys_page_debug (CPUState *env, target_ulong addr) { mmu_ctx_t ctx; if (unlikely(get_physical_address(env, &ctx, addr, 0, ACCESS_INT, 1) != 0)) return -1; return ctx.raddr & TARGET_PAGE_MASK; }
true
qemu
faadf50e2962dd54175647a80bd6fc4319c91973
target_phys_addr_t cpu_get_phys_page_debug (CPUState *env, target_ulong addr) { mmu_ctx_t ctx; if (unlikely(get_physical_address(env, &ctx, addr, 0, ACCESS_INT, 1) != 0)) return -1; return ctx.raddr & TARGET_PAGE_MASK; }
{ "code": [ " if (unlikely(get_physical_address(env, &ctx, addr, 0, ACCESS_INT, 1) != 0))" ], "line_no": [ 9 ] }
target_phys_addr_t FUNC_0 (CPUState *env, target_ulong addr) { mmu_ctx_t ctx; if (unlikely(get_physical_address(env, &ctx, addr, 0, ACCESS_INT, 1) != 0)) return -1; return ctx.raddr & TARGET_PAGE_MASK; }
[ "target_phys_addr_t FUNC_0 (CPUState *env, target_ulong addr)\n{", "mmu_ctx_t ctx;", "if (unlikely(get_physical_address(env, &ctx, addr, 0, ACCESS_INT, 1) != 0))\nreturn -1;", "return ctx.raddr & TARGET_PAGE_MASK;", "}" ]
[ 0, 0, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9, 11 ], [ 15 ], [ 17 ] ]
11,299
static unsigned tget_long(const uint8_t **p, int le) { unsigned v = le ? AV_RL32(*p) : AV_RB32(*p); *p += 4; return v; }
true
FFmpeg
0a467a9b594dd67aa96bad687d05f8845b009f18
static unsigned tget_long(const uint8_t **p, int le) { unsigned v = le ? AV_RL32(*p) : AV_RB32(*p); *p += 4; return v; }
{ "code": [ " return v;", "static unsigned tget_long(const uint8_t **p, int le)", " unsigned v = le ? AV_RL32(*p) : AV_RB32(*p);", " *p += 4;", " return v;" ], "line_no": [ 9, 1, 5, 7, 9 ] }
static unsigned FUNC_0(const uint8_t **VAR_0, int VAR_1) { unsigned VAR_2 = VAR_1 ? AV_RL32(*VAR_0) : AV_RB32(*VAR_0); *VAR_0 += 4; return VAR_2; }
[ "static unsigned FUNC_0(const uint8_t **VAR_0, int VAR_1)\n{", "unsigned VAR_2 = VAR_1 ? AV_RL32(*VAR_0) : AV_RB32(*VAR_0);", "*VAR_0 += 4;", "return VAR_2;", "}" ]
[ 1, 1, 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ] ]
11,300
static unsigned int dec_move_r(DisasContext *dc) { int size = memsize_zz(dc); DIS(fprintf (logfile, "move.%c $r%u, $r%u\n", memsize_char(size), dc->op1, dc->op2)); cris_cc_mask(dc, CC_MASK_NZ); if (size == 4) { dec_prep_move_r(dc, dc->op1, dc->op2, size, 0, cpu_R[dc->op2]); cris_cc_mask(dc, CC_MASK_NZ); cris_update_cc_op(dc, CC_OP_MOVE, 4); cris_update_cc_x(dc); cris_update_result(dc, cpu_R[dc->op2]); } else { TCGv t0; t0 = tcg_temp_new(TCG_TYPE_TL); dec_prep_move_r(dc, dc->op1, dc->op2, size, 0, t0); cris_alu(dc, CC_OP_MOVE, cpu_R[dc->op2], cpu_R[dc->op2], t0, size); tcg_temp_free(t0); } return 2; }
false
qemu
a7812ae412311d7d47f8aa85656faadac9d64b56
static unsigned int dec_move_r(DisasContext *dc) { int size = memsize_zz(dc); DIS(fprintf (logfile, "move.%c $r%u, $r%u\n", memsize_char(size), dc->op1, dc->op2)); cris_cc_mask(dc, CC_MASK_NZ); if (size == 4) { dec_prep_move_r(dc, dc->op1, dc->op2, size, 0, cpu_R[dc->op2]); cris_cc_mask(dc, CC_MASK_NZ); cris_update_cc_op(dc, CC_OP_MOVE, 4); cris_update_cc_x(dc); cris_update_result(dc, cpu_R[dc->op2]); } else { TCGv t0; t0 = tcg_temp_new(TCG_TYPE_TL); dec_prep_move_r(dc, dc->op1, dc->op2, size, 0, t0); cris_alu(dc, CC_OP_MOVE, cpu_R[dc->op2], cpu_R[dc->op2], t0, size); tcg_temp_free(t0); } return 2; }
{ "code": [], "line_no": [] }
static unsigned int FUNC_0(DisasContext *VAR_0) { int VAR_1 = memsize_zz(VAR_0); DIS(fprintf (logfile, "move.%c $r%u, $r%u\n", memsize_char(VAR_1), VAR_0->op1, VAR_0->op2)); cris_cc_mask(VAR_0, CC_MASK_NZ); if (VAR_1 == 4) { dec_prep_move_r(VAR_0, VAR_0->op1, VAR_0->op2, VAR_1, 0, cpu_R[VAR_0->op2]); cris_cc_mask(VAR_0, CC_MASK_NZ); cris_update_cc_op(VAR_0, CC_OP_MOVE, 4); cris_update_cc_x(VAR_0); cris_update_result(VAR_0, cpu_R[VAR_0->op2]); } else { TCGv t0; t0 = tcg_temp_new(TCG_TYPE_TL); dec_prep_move_r(VAR_0, VAR_0->op1, VAR_0->op2, VAR_1, 0, t0); cris_alu(VAR_0, CC_OP_MOVE, cpu_R[VAR_0->op2], cpu_R[VAR_0->op2], t0, VAR_1); tcg_temp_free(t0); } return 2; }
[ "static unsigned int FUNC_0(DisasContext *VAR_0)\n{", "int VAR_1 = memsize_zz(VAR_0);", "DIS(fprintf (logfile, \"move.%c $r%u, $r%u\\n\",\nmemsize_char(VAR_1), VAR_0->op1, VAR_0->op2));", "cris_cc_mask(VAR_0, CC_MASK_NZ);", "if (VAR_1 == 4) {", "dec_prep_move_r(VAR_0, VAR_0->op1, VAR_0->op2, VAR_1, 0, cpu_R[VAR_0->op2]);", "cris_cc_mask(VAR_0, CC_MASK_NZ);", "cris_update_cc_op(VAR_0, CC_OP_MOVE, 4);", "cris_update_cc_x(VAR_0);", "cris_update_result(VAR_0, cpu_R[VAR_0->op2]);", "}", "else {", "TCGv t0;", "t0 = tcg_temp_new(TCG_TYPE_TL);", "dec_prep_move_r(VAR_0, VAR_0->op1, VAR_0->op2, VAR_1, 0, t0);", "cris_alu(VAR_0, CC_OP_MOVE,\ncpu_R[VAR_0->op2],\ncpu_R[VAR_0->op2], t0, VAR_1);", "tcg_temp_free(t0);", "}", "return 2;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9, 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41, 43, 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ] ]
11,301
static void gen_neon_zip_u16(TCGv t0, TCGv t1) { TCGv tmp, tmp2; tmp = new_tmp(); tmp2 = new_tmp(); tcg_gen_andi_i32(tmp, t0, 0xffff); tcg_gen_shli_i32(tmp2, t1, 16); tcg_gen_or_i32(tmp, tmp, tmp2); tcg_gen_andi_i32(t1, t1, 0xffff0000); tcg_gen_shri_i32(tmp2, t0, 16); tcg_gen_or_i32(t1, t1, tmp2); tcg_gen_mov_i32(t0, tmp); dead_tmp(tmp2); dead_tmp(tmp); }
false
qemu
d68a6f3a6deb2f5eee198b6fa46877a20227d86e
static void gen_neon_zip_u16(TCGv t0, TCGv t1) { TCGv tmp, tmp2; tmp = new_tmp(); tmp2 = new_tmp(); tcg_gen_andi_i32(tmp, t0, 0xffff); tcg_gen_shli_i32(tmp2, t1, 16); tcg_gen_or_i32(tmp, tmp, tmp2); tcg_gen_andi_i32(t1, t1, 0xffff0000); tcg_gen_shri_i32(tmp2, t0, 16); tcg_gen_or_i32(t1, t1, tmp2); tcg_gen_mov_i32(t0, tmp); dead_tmp(tmp2); dead_tmp(tmp); }
{ "code": [], "line_no": [] }
static void FUNC_0(TCGv VAR_0, TCGv VAR_1) { TCGv tmp, tmp2; tmp = new_tmp(); tmp2 = new_tmp(); tcg_gen_andi_i32(tmp, VAR_0, 0xffff); tcg_gen_shli_i32(tmp2, VAR_1, 16); tcg_gen_or_i32(tmp, tmp, tmp2); tcg_gen_andi_i32(VAR_1, VAR_1, 0xffff0000); tcg_gen_shri_i32(tmp2, VAR_0, 16); tcg_gen_or_i32(VAR_1, VAR_1, tmp2); tcg_gen_mov_i32(VAR_0, tmp); dead_tmp(tmp2); dead_tmp(tmp); }
[ "static void FUNC_0(TCGv VAR_0, TCGv VAR_1)\n{", "TCGv tmp, tmp2;", "tmp = new_tmp();", "tmp2 = new_tmp();", "tcg_gen_andi_i32(tmp, VAR_0, 0xffff);", "tcg_gen_shli_i32(tmp2, VAR_1, 16);", "tcg_gen_or_i32(tmp, tmp, tmp2);", "tcg_gen_andi_i32(VAR_1, VAR_1, 0xffff0000);", "tcg_gen_shri_i32(tmp2, VAR_0, 16);", "tcg_gen_or_i32(VAR_1, VAR_1, tmp2);", "tcg_gen_mov_i32(VAR_0, tmp);", "dead_tmp(tmp2);", "dead_tmp(tmp);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ] ]
11,302
static int spapr_create_pci_child_dt(sPAPRPHBState *phb, PCIDevice *dev, int drc_index, const char *drc_name, void *fdt, int node_offset) { int offset, ret; int slot = PCI_SLOT(dev->devfn); int func = PCI_FUNC(dev->devfn); char nodename[FDT_NAME_MAX]; if (func != 0) { snprintf(nodename, FDT_NAME_MAX, "pci@%x,%x", slot, func); } else { snprintf(nodename, FDT_NAME_MAX, "pci@%x", slot); } offset = fdt_add_subnode(fdt, node_offset, nodename); ret = spapr_populate_pci_child_dt(dev, fdt, offset, phb->index, drc_index, phb); g_assert(!ret); if (ret) { return 0; } return offset; }
false
qemu
e634b89c6ed2309814de7a89bd7c5ced96f59291
static int spapr_create_pci_child_dt(sPAPRPHBState *phb, PCIDevice *dev, int drc_index, const char *drc_name, void *fdt, int node_offset) { int offset, ret; int slot = PCI_SLOT(dev->devfn); int func = PCI_FUNC(dev->devfn); char nodename[FDT_NAME_MAX]; if (func != 0) { snprintf(nodename, FDT_NAME_MAX, "pci@%x,%x", slot, func); } else { snprintf(nodename, FDT_NAME_MAX, "pci@%x", slot); } offset = fdt_add_subnode(fdt, node_offset, nodename); ret = spapr_populate_pci_child_dt(dev, fdt, offset, phb->index, drc_index, phb); g_assert(!ret); if (ret) { return 0; } return offset; }
{ "code": [], "line_no": [] }
static int FUNC_0(sPAPRPHBState *VAR_0, PCIDevice *VAR_1, int VAR_2, const char *VAR_3, void *VAR_4, int VAR_5) { int VAR_6, VAR_7; int VAR_8 = PCI_SLOT(VAR_1->devfn); int VAR_9 = PCI_FUNC(VAR_1->devfn); char VAR_10[FDT_NAME_MAX]; if (VAR_9 != 0) { snprintf(VAR_10, FDT_NAME_MAX, "pci@%x,%x", VAR_8, VAR_9); } else { snprintf(VAR_10, FDT_NAME_MAX, "pci@%x", VAR_8); } VAR_6 = fdt_add_subnode(VAR_4, VAR_5, VAR_10); VAR_7 = spapr_populate_pci_child_dt(VAR_1, VAR_4, VAR_6, VAR_0->index, VAR_2, VAR_0); g_assert(!VAR_7); if (VAR_7) { return 0; } return VAR_6; }
[ "static int FUNC_0(sPAPRPHBState *VAR_0, PCIDevice *VAR_1,\nint VAR_2, const char *VAR_3,\nvoid *VAR_4, int VAR_5)\n{", "int VAR_6, VAR_7;", "int VAR_8 = PCI_SLOT(VAR_1->devfn);", "int VAR_9 = PCI_FUNC(VAR_1->devfn);", "char VAR_10[FDT_NAME_MAX];", "if (VAR_9 != 0) {", "snprintf(VAR_10, FDT_NAME_MAX, \"pci@%x,%x\", VAR_8, VAR_9);", "} else {", "snprintf(VAR_10, FDT_NAME_MAX, \"pci@%x\", VAR_8);", "}", "VAR_6 = fdt_add_subnode(VAR_4, VAR_5, VAR_10);", "VAR_7 = spapr_populate_pci_child_dt(VAR_1, VAR_4, VAR_6, VAR_0->index, VAR_2,\nVAR_0);", "g_assert(!VAR_7);", "if (VAR_7) {", "return 0;", "}", "return VAR_6;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31, 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ] ]
11,304
void shpc_cleanup(PCIDevice *d, MemoryRegion *bar) { SHPCDevice *shpc = d->shpc; d->cap_present &= ~QEMU_PCI_CAP_SHPC; memory_region_del_subregion(bar, &shpc->mmio); object_unparent(OBJECT(&shpc->mmio)); /* TODO: cleanup config space changes? */ g_free(shpc->config); g_free(shpc->cmask); g_free(shpc->wmask); g_free(shpc->w1cmask); g_free(shpc); }
false
qemu
5cd5e7015962d8d559afb5154888fd34a8526ddd
void shpc_cleanup(PCIDevice *d, MemoryRegion *bar) { SHPCDevice *shpc = d->shpc; d->cap_present &= ~QEMU_PCI_CAP_SHPC; memory_region_del_subregion(bar, &shpc->mmio); object_unparent(OBJECT(&shpc->mmio)); g_free(shpc->config); g_free(shpc->cmask); g_free(shpc->wmask); g_free(shpc->w1cmask); g_free(shpc); }
{ "code": [], "line_no": [] }
void FUNC_0(PCIDevice *VAR_0, MemoryRegion *VAR_1) { SHPCDevice *shpc = VAR_0->shpc; VAR_0->cap_present &= ~QEMU_PCI_CAP_SHPC; memory_region_del_subregion(VAR_1, &shpc->mmio); object_unparent(OBJECT(&shpc->mmio)); g_free(shpc->config); g_free(shpc->cmask); g_free(shpc->wmask); g_free(shpc->w1cmask); g_free(shpc); }
[ "void FUNC_0(PCIDevice *VAR_0, MemoryRegion *VAR_1)\n{", "SHPCDevice *shpc = VAR_0->shpc;", "VAR_0->cap_present &= ~QEMU_PCI_CAP_SHPC;", "memory_region_del_subregion(VAR_1, &shpc->mmio);", "object_unparent(OBJECT(&shpc->mmio));", "g_free(shpc->config);", "g_free(shpc->cmask);", "g_free(shpc->wmask);", "g_free(shpc->w1cmask);", "g_free(shpc);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ] ]
11,305
static CharDriverState *qmp_chardev_open_file(ChardevFile *file, Error **errp) { int flags, in = -1, out = -1; flags = O_WRONLY | O_TRUNC | O_CREAT | O_BINARY; out = qmp_chardev_open_file_source(file->out, flags, errp); if (error_is_set(errp)) { return NULL; } if (file->in) { flags = O_RDONLY; in = qmp_chardev_open_file_source(file->in, flags, errp); if (error_is_set(errp)) { qemu_close(out); return NULL; } } return qemu_chr_open_fd(in, out); }
false
qemu
e859eda58501cd20a2e6988fb4acc1756bc4d278
static CharDriverState *qmp_chardev_open_file(ChardevFile *file, Error **errp) { int flags, in = -1, out = -1; flags = O_WRONLY | O_TRUNC | O_CREAT | O_BINARY; out = qmp_chardev_open_file_source(file->out, flags, errp); if (error_is_set(errp)) { return NULL; } if (file->in) { flags = O_RDONLY; in = qmp_chardev_open_file_source(file->in, flags, errp); if (error_is_set(errp)) { qemu_close(out); return NULL; } } return qemu_chr_open_fd(in, out); }
{ "code": [], "line_no": [] }
static CharDriverState *FUNC_0(ChardevFile *file, Error **errp) { int VAR_0, VAR_1 = -1, VAR_2 = -1; VAR_0 = O_WRONLY | O_TRUNC | O_CREAT | O_BINARY; VAR_2 = qmp_chardev_open_file_source(file->VAR_2, VAR_0, errp); if (error_is_set(errp)) { return NULL; } if (file->VAR_1) { VAR_0 = O_RDONLY; VAR_1 = qmp_chardev_open_file_source(file->VAR_1, VAR_0, errp); if (error_is_set(errp)) { qemu_close(VAR_2); return NULL; } } return qemu_chr_open_fd(VAR_1, VAR_2); }
[ "static CharDriverState *FUNC_0(ChardevFile *file, Error **errp)\n{", "int VAR_0, VAR_1 = -1, VAR_2 = -1;", "VAR_0 = O_WRONLY | O_TRUNC | O_CREAT | O_BINARY;", "VAR_2 = qmp_chardev_open_file_source(file->VAR_2, VAR_0, errp);", "if (error_is_set(errp)) {", "return NULL;", "}", "if (file->VAR_1) {", "VAR_0 = O_RDONLY;", "VAR_1 = qmp_chardev_open_file_source(file->VAR_1, VAR_0, errp);", "if (error_is_set(errp)) {", "qemu_close(VAR_2);", "return NULL;", "}", "}", "return qemu_chr_open_fd(VAR_1, VAR_2);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ] ]
11,306
static unsigned int dec_bound_r(DisasContext *dc) { TCGv l0; int size = memsize_zz(dc); DIS(fprintf (logfile, "bound.%c $r%u, $r%u\n", memsize_char(size), dc->op1, dc->op2)); cris_cc_mask(dc, CC_MASK_NZ); l0 = tcg_temp_local_new(TCG_TYPE_TL); dec_prep_move_r(dc, dc->op1, dc->op2, size, 0, l0); cris_alu(dc, CC_OP_BOUND, cpu_R[dc->op2], cpu_R[dc->op2], l0, 4); tcg_temp_free(l0); return 2; }
false
qemu
a7812ae412311d7d47f8aa85656faadac9d64b56
static unsigned int dec_bound_r(DisasContext *dc) { TCGv l0; int size = memsize_zz(dc); DIS(fprintf (logfile, "bound.%c $r%u, $r%u\n", memsize_char(size), dc->op1, dc->op2)); cris_cc_mask(dc, CC_MASK_NZ); l0 = tcg_temp_local_new(TCG_TYPE_TL); dec_prep_move_r(dc, dc->op1, dc->op2, size, 0, l0); cris_alu(dc, CC_OP_BOUND, cpu_R[dc->op2], cpu_R[dc->op2], l0, 4); tcg_temp_free(l0); return 2; }
{ "code": [], "line_no": [] }
static unsigned int FUNC_0(DisasContext *VAR_0) { TCGv l0; int VAR_1 = memsize_zz(VAR_0); DIS(fprintf (logfile, "bound.%c $r%u, $r%u\n", memsize_char(VAR_1), VAR_0->op1, VAR_0->op2)); cris_cc_mask(VAR_0, CC_MASK_NZ); l0 = tcg_temp_local_new(TCG_TYPE_TL); dec_prep_move_r(VAR_0, VAR_0->op1, VAR_0->op2, VAR_1, 0, l0); cris_alu(VAR_0, CC_OP_BOUND, cpu_R[VAR_0->op2], cpu_R[VAR_0->op2], l0, 4); tcg_temp_free(l0); return 2; }
[ "static unsigned int FUNC_0(DisasContext *VAR_0)\n{", "TCGv l0;", "int VAR_1 = memsize_zz(VAR_0);", "DIS(fprintf (logfile, \"bound.%c $r%u, $r%u\\n\",\nmemsize_char(VAR_1), VAR_0->op1, VAR_0->op2));", "cris_cc_mask(VAR_0, CC_MASK_NZ);", "l0 = tcg_temp_local_new(TCG_TYPE_TL);", "dec_prep_move_r(VAR_0, VAR_0->op1, VAR_0->op2, VAR_1, 0, l0);", "cris_alu(VAR_0, CC_OP_BOUND, cpu_R[VAR_0->op2], cpu_R[VAR_0->op2], l0, 4);", "tcg_temp_free(l0);", "return 2;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9, 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ] ]
11,307
static int usb_wacom_handle_control(USBDevice *dev, int request, int value, int index, int length, uint8_t *data) { USBWacomState *s = (USBWacomState *) dev; int ret; ret = usb_desc_handle_control(dev, request, value, index, length, data); if (ret >= 0) { return ret; } ret = 0; switch (request) { case DeviceRequest | USB_REQ_GET_STATUS: data[0] = (1 << USB_DEVICE_SELF_POWERED) | (dev->remote_wakeup << USB_DEVICE_REMOTE_WAKEUP); data[1] = 0x00; ret = 2; break; case DeviceOutRequest | USB_REQ_CLEAR_FEATURE: if (value == USB_DEVICE_REMOTE_WAKEUP) { dev->remote_wakeup = 0; } else { goto fail; } ret = 0; break; case DeviceOutRequest | USB_REQ_SET_FEATURE: if (value == USB_DEVICE_REMOTE_WAKEUP) { dev->remote_wakeup = 1; } else { goto fail; } ret = 0; break; case DeviceRequest | USB_REQ_GET_CONFIGURATION: data[0] = 1; ret = 1; break; case DeviceOutRequest | USB_REQ_SET_CONFIGURATION: ret = 0; break; case DeviceRequest | USB_REQ_GET_INTERFACE: data[0] = 0; ret = 1; break; case DeviceOutRequest | USB_REQ_SET_INTERFACE: ret = 0; break; case WACOM_SET_REPORT: if (s->mouse_grabbed) { qemu_remove_mouse_event_handler(s->eh_entry); s->mouse_grabbed = 0; } s->mode = data[0]; ret = 0; break; case WACOM_GET_REPORT: data[0] = 0; data[1] = s->mode; ret = 2; break; /* USB HID requests */ case HID_GET_REPORT: if (s->mode == WACOM_MODE_HID) ret = usb_mouse_poll(s, data, length); else if (s->mode == WACOM_MODE_WACOM) ret = usb_wacom_poll(s, data, length); break; case HID_GET_IDLE: ret = 1; data[0] = s->idle; break; case HID_SET_IDLE: s->idle = (uint8_t) (value >> 8); ret = 0; break; default: fail: ret = USB_RET_STALL; break; } return ret; }
false
qemu
a980a065fb5e86d6dec337e6cb6ff432f1a143c9
static int usb_wacom_handle_control(USBDevice *dev, int request, int value, int index, int length, uint8_t *data) { USBWacomState *s = (USBWacomState *) dev; int ret; ret = usb_desc_handle_control(dev, request, value, index, length, data); if (ret >= 0) { return ret; } ret = 0; switch (request) { case DeviceRequest | USB_REQ_GET_STATUS: data[0] = (1 << USB_DEVICE_SELF_POWERED) | (dev->remote_wakeup << USB_DEVICE_REMOTE_WAKEUP); data[1] = 0x00; ret = 2; break; case DeviceOutRequest | USB_REQ_CLEAR_FEATURE: if (value == USB_DEVICE_REMOTE_WAKEUP) { dev->remote_wakeup = 0; } else { goto fail; } ret = 0; break; case DeviceOutRequest | USB_REQ_SET_FEATURE: if (value == USB_DEVICE_REMOTE_WAKEUP) { dev->remote_wakeup = 1; } else { goto fail; } ret = 0; break; case DeviceRequest | USB_REQ_GET_CONFIGURATION: data[0] = 1; ret = 1; break; case DeviceOutRequest | USB_REQ_SET_CONFIGURATION: ret = 0; break; case DeviceRequest | USB_REQ_GET_INTERFACE: data[0] = 0; ret = 1; break; case DeviceOutRequest | USB_REQ_SET_INTERFACE: ret = 0; break; case WACOM_SET_REPORT: if (s->mouse_grabbed) { qemu_remove_mouse_event_handler(s->eh_entry); s->mouse_grabbed = 0; } s->mode = data[0]; ret = 0; break; case WACOM_GET_REPORT: data[0] = 0; data[1] = s->mode; ret = 2; break; case HID_GET_REPORT: if (s->mode == WACOM_MODE_HID) ret = usb_mouse_poll(s, data, length); else if (s->mode == WACOM_MODE_WACOM) ret = usb_wacom_poll(s, data, length); break; case HID_GET_IDLE: ret = 1; data[0] = s->idle; break; case HID_SET_IDLE: s->idle = (uint8_t) (value >> 8); ret = 0; break; default: fail: ret = USB_RET_STALL; break; } return ret; }
{ "code": [], "line_no": [] }
static int FUNC_0(USBDevice *VAR_0, int VAR_1, int VAR_2, int VAR_3, int VAR_4, uint8_t *VAR_5) { USBWacomState *s = (USBWacomState *) VAR_0; int VAR_6; VAR_6 = usb_desc_handle_control(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4, VAR_5); if (VAR_6 >= 0) { return VAR_6; } VAR_6 = 0; switch (VAR_1) { case DeviceRequest | USB_REQ_GET_STATUS: VAR_5[0] = (1 << USB_DEVICE_SELF_POWERED) | (VAR_0->remote_wakeup << USB_DEVICE_REMOTE_WAKEUP); VAR_5[1] = 0x00; VAR_6 = 2; break; case DeviceOutRequest | USB_REQ_CLEAR_FEATURE: if (VAR_2 == USB_DEVICE_REMOTE_WAKEUP) { VAR_0->remote_wakeup = 0; } else { goto fail; } VAR_6 = 0; break; case DeviceOutRequest | USB_REQ_SET_FEATURE: if (VAR_2 == USB_DEVICE_REMOTE_WAKEUP) { VAR_0->remote_wakeup = 1; } else { goto fail; } VAR_6 = 0; break; case DeviceRequest | USB_REQ_GET_CONFIGURATION: VAR_5[0] = 1; VAR_6 = 1; break; case DeviceOutRequest | USB_REQ_SET_CONFIGURATION: VAR_6 = 0; break; case DeviceRequest | USB_REQ_GET_INTERFACE: VAR_5[0] = 0; VAR_6 = 1; break; case DeviceOutRequest | USB_REQ_SET_INTERFACE: VAR_6 = 0; break; case WACOM_SET_REPORT: if (s->mouse_grabbed) { qemu_remove_mouse_event_handler(s->eh_entry); s->mouse_grabbed = 0; } s->mode = VAR_5[0]; VAR_6 = 0; break; case WACOM_GET_REPORT: VAR_5[0] = 0; VAR_5[1] = s->mode; VAR_6 = 2; break; case HID_GET_REPORT: if (s->mode == WACOM_MODE_HID) VAR_6 = usb_mouse_poll(s, VAR_5, VAR_4); else if (s->mode == WACOM_MODE_WACOM) VAR_6 = usb_wacom_poll(s, VAR_5, VAR_4); break; case HID_GET_IDLE: VAR_6 = 1; VAR_5[0] = s->idle; break; case HID_SET_IDLE: s->idle = (uint8_t) (VAR_2 >> 8); VAR_6 = 0; break; default: fail: VAR_6 = USB_RET_STALL; break; } return VAR_6; }
[ "static int FUNC_0(USBDevice *VAR_0, int VAR_1, int VAR_2,\nint VAR_3, int VAR_4, uint8_t *VAR_5)\n{", "USBWacomState *s = (USBWacomState *) VAR_0;", "int VAR_6;", "VAR_6 = usb_desc_handle_control(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4, VAR_5);", "if (VAR_6 >= 0) {", "return VAR_6;", "}", "VAR_6 = 0;", "switch (VAR_1) {", "case DeviceRequest | USB_REQ_GET_STATUS:\nVAR_5[0] = (1 << USB_DEVICE_SELF_POWERED) |\n(VAR_0->remote_wakeup << USB_DEVICE_REMOTE_WAKEUP);", "VAR_5[1] = 0x00;", "VAR_6 = 2;", "break;", "case DeviceOutRequest | USB_REQ_CLEAR_FEATURE:\nif (VAR_2 == USB_DEVICE_REMOTE_WAKEUP) {", "VAR_0->remote_wakeup = 0;", "} else {", "goto fail;", "}", "VAR_6 = 0;", "break;", "case DeviceOutRequest | USB_REQ_SET_FEATURE:\nif (VAR_2 == USB_DEVICE_REMOTE_WAKEUP) {", "VAR_0->remote_wakeup = 1;", "} else {", "goto fail;", "}", "VAR_6 = 0;", "break;", "case DeviceRequest | USB_REQ_GET_CONFIGURATION:\nVAR_5[0] = 1;", "VAR_6 = 1;", "break;", "case DeviceOutRequest | USB_REQ_SET_CONFIGURATION:\nVAR_6 = 0;", "break;", "case DeviceRequest | USB_REQ_GET_INTERFACE:\nVAR_5[0] = 0;", "VAR_6 = 1;", "break;", "case DeviceOutRequest | USB_REQ_SET_INTERFACE:\nVAR_6 = 0;", "break;", "case WACOM_SET_REPORT:\nif (s->mouse_grabbed) {", "qemu_remove_mouse_event_handler(s->eh_entry);", "s->mouse_grabbed = 0;", "}", "s->mode = VAR_5[0];", "VAR_6 = 0;", "break;", "case WACOM_GET_REPORT:\nVAR_5[0] = 0;", "VAR_5[1] = s->mode;", "VAR_6 = 2;", "break;", "case HID_GET_REPORT:\nif (s->mode == WACOM_MODE_HID)\nVAR_6 = usb_mouse_poll(s, VAR_5, VAR_4);", "else if (s->mode == WACOM_MODE_WACOM)\nVAR_6 = usb_wacom_poll(s, VAR_5, VAR_4);", "break;", "case HID_GET_IDLE:\nVAR_6 = 1;", "VAR_5[0] = s->idle;", "break;", "case HID_SET_IDLE:\ns->idle = (uint8_t) (VAR_2 >> 8);", "VAR_6 = 0;", "break;", "default:\nfail:\nVAR_6 = USB_RET_STALL;", "break;", "}", "return VAR_6;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27, 29, 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39, 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55, 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71, 73 ], [ 75 ], [ 77 ], [ 79, 81 ], [ 83 ], [ 85, 87 ], [ 89 ], [ 91 ], [ 93, 95 ], [ 97 ], [ 99, 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115, 117 ], [ 119 ], [ 121 ], [ 123 ], [ 127, 129, 131 ], [ 133, 135 ], [ 137 ], [ 139, 141 ], [ 143 ], [ 145 ], [ 147, 149 ], [ 151 ], [ 153 ], [ 155, 157, 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ] ]
11,308
static void gen_store_fpr32h(TCGv_i32 t, int reg) { TCGv_i64 t64 = tcg_temp_new_i64(); tcg_gen_extu_i32_i64(t64, t); tcg_gen_deposit_i64(fpu_f64[reg], fpu_f64[reg], t64, 32, 32); tcg_temp_free_i64(t64); }
false
qemu
7f6613cedc59fa849105668ae971dc31004bca1c
static void gen_store_fpr32h(TCGv_i32 t, int reg) { TCGv_i64 t64 = tcg_temp_new_i64(); tcg_gen_extu_i32_i64(t64, t); tcg_gen_deposit_i64(fpu_f64[reg], fpu_f64[reg], t64, 32, 32); tcg_temp_free_i64(t64); }
{ "code": [], "line_no": [] }
static void FUNC_0(TCGv_i32 VAR_0, int VAR_1) { TCGv_i64 t64 = tcg_temp_new_i64(); tcg_gen_extu_i32_i64(t64, VAR_0); tcg_gen_deposit_i64(fpu_f64[VAR_1], fpu_f64[VAR_1], t64, 32, 32); tcg_temp_free_i64(t64); }
[ "static void FUNC_0(TCGv_i32 VAR_0, int VAR_1)\n{", "TCGv_i64 t64 = tcg_temp_new_i64();", "tcg_gen_extu_i32_i64(t64, VAR_0);", "tcg_gen_deposit_i64(fpu_f64[VAR_1], fpu_f64[VAR_1], t64, 32, 32);", "tcg_temp_free_i64(t64);", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ] ]
11,310
static int mov_read_smi(MOVContext *c, ByteIOContext *pb, MOVAtom atom) { AVStream *st = c->fc->streams[c->fc->nb_streams-1]; if((uint64_t)atom.size > (1<<30)) return -1; // currently SVQ3 decoder expect full STSD header - so let's fake it // this should be fixed and just SMI header should be passed av_free(st->codec->extradata); st->codec->extradata = av_mallocz(atom.size + 0x5a + FF_INPUT_BUFFER_PADDING_SIZE); if (!st->codec->extradata) return AVERROR(ENOMEM); st->codec->extradata_size = 0x5a + atom.size; memcpy(st->codec->extradata, "SVQ3", 4); // fake get_buffer(pb, st->codec->extradata + 0x5a, atom.size); dprintf(c->fc, "Reading SMI %"PRId64" %s\n", atom.size, st->codec->extradata + 0x5a); return 0; }
false
FFmpeg
6a63ff19b6a7fe3bc32c7fb4a62fca8f65786432
static int mov_read_smi(MOVContext *c, ByteIOContext *pb, MOVAtom atom) { AVStream *st = c->fc->streams[c->fc->nb_streams-1]; if((uint64_t)atom.size > (1<<30)) return -1; av_free(st->codec->extradata); st->codec->extradata = av_mallocz(atom.size + 0x5a + FF_INPUT_BUFFER_PADDING_SIZE); if (!st->codec->extradata) return AVERROR(ENOMEM); st->codec->extradata_size = 0x5a + atom.size; memcpy(st->codec->extradata, "SVQ3", 4); get_buffer(pb, st->codec->extradata + 0x5a, atom.size); dprintf(c->fc, "Reading SMI %"PRId64" %s\n", atom.size, st->codec->extradata + 0x5a); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(MOVContext *VAR_0, ByteIOContext *VAR_1, MOVAtom VAR_2) { AVStream *st = VAR_0->fc->streams[VAR_0->fc->nb_streams-1]; if((uint64_t)VAR_2.size > (1<<30)) return -1; av_free(st->codec->extradata); st->codec->extradata = av_mallocz(VAR_2.size + 0x5a + FF_INPUT_BUFFER_PADDING_SIZE); if (!st->codec->extradata) return AVERROR(ENOMEM); st->codec->extradata_size = 0x5a + VAR_2.size; memcpy(st->codec->extradata, "SVQ3", 4); get_buffer(VAR_1, st->codec->extradata + 0x5a, VAR_2.size); dprintf(VAR_0->fc, "Reading SMI %"PRId64" %s\n", VAR_2.size, st->codec->extradata + 0x5a); return 0; }
[ "static int FUNC_0(MOVContext *VAR_0, ByteIOContext *VAR_1, MOVAtom VAR_2)\n{", "AVStream *st = VAR_0->fc->streams[VAR_0->fc->nb_streams-1];", "if((uint64_t)VAR_2.size > (1<<30))\nreturn -1;", "av_free(st->codec->extradata);", "st->codec->extradata = av_mallocz(VAR_2.size + 0x5a + FF_INPUT_BUFFER_PADDING_SIZE);", "if (!st->codec->extradata)\nreturn AVERROR(ENOMEM);", "st->codec->extradata_size = 0x5a + VAR_2.size;", "memcpy(st->codec->extradata, \"SVQ3\", 4);", "get_buffer(VAR_1, st->codec->extradata + 0x5a, VAR_2.size);", "dprintf(VAR_0->fc, \"Reading SMI %\"PRId64\" %s\\n\", VAR_2.size, st->codec->extradata + 0x5a);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9, 11 ], [ 19 ], [ 21 ], [ 23, 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ] ]
11,311
static inline void ne2000_mem_writel(NE2000State *s, uint32_t addr, uint32_t val) { addr &= ~1; /* XXX: check exact behaviour if not even */ if (addr < 32 || (addr >= NE2000_PMEM_START && addr < NE2000_MEM_SIZE)) { stl_le_p(s->mem + addr, val); } }
false
qemu
aa7f9966dfdff500bbbf1956d9e115b1fa8987a6
static inline void ne2000_mem_writel(NE2000State *s, uint32_t addr, uint32_t val) { addr &= ~1; if (addr < 32 || (addr >= NE2000_PMEM_START && addr < NE2000_MEM_SIZE)) { stl_le_p(s->mem + addr, val); } }
{ "code": [], "line_no": [] }
static inline void FUNC_0(NE2000State *VAR_0, uint32_t VAR_1, uint32_t VAR_2) { VAR_1 &= ~1; if (VAR_1 < 32 || (VAR_1 >= NE2000_PMEM_START && VAR_1 < NE2000_MEM_SIZE)) { stl_le_p(VAR_0->mem + VAR_1, VAR_2); } }
[ "static inline void FUNC_0(NE2000State *VAR_0, uint32_t VAR_1,\nuint32_t VAR_2)\n{", "VAR_1 &= ~1;", "if (VAR_1 < 32 ||\n(VAR_1 >= NE2000_PMEM_START && VAR_1 < NE2000_MEM_SIZE)) {", "stl_le_p(VAR_0->mem + VAR_1, VAR_2);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9, 11 ], [ 13 ], [ 15 ], [ 17 ] ]
11,312
static void nvdimm_build_fit_buffer(NvdimmFitBuffer *fit_buf) { qemu_mutex_lock(&fit_buf->lock); g_array_free(fit_buf->fit, true); fit_buf->fit = nvdimm_build_device_structure(); fit_buf->dirty = true; qemu_mutex_unlock(&fit_buf->lock); }
false
qemu
12f86b5b3e1bdf75e0a467d771c16cc42f3a1f1a
static void nvdimm_build_fit_buffer(NvdimmFitBuffer *fit_buf) { qemu_mutex_lock(&fit_buf->lock); g_array_free(fit_buf->fit, true); fit_buf->fit = nvdimm_build_device_structure(); fit_buf->dirty = true; qemu_mutex_unlock(&fit_buf->lock); }
{ "code": [], "line_no": [] }
static void FUNC_0(NvdimmFitBuffer *VAR_0) { qemu_mutex_lock(&VAR_0->lock); g_array_free(VAR_0->fit, true); VAR_0->fit = nvdimm_build_device_structure(); VAR_0->dirty = true; qemu_mutex_unlock(&VAR_0->lock); }
[ "static void FUNC_0(NvdimmFitBuffer *VAR_0)\n{", "qemu_mutex_lock(&VAR_0->lock);", "g_array_free(VAR_0->fit, true);", "VAR_0->fit = nvdimm_build_device_structure();", "VAR_0->dirty = true;", "qemu_mutex_unlock(&VAR_0->lock);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ] ]
11,315
static void vnc_debug_gnutls_log(int level, const char* str) { VNC_DEBUG("%d %s", level, str); }
false
qemu
5fb6c7a8b26eab1a22207d24b4784bd2b39ab54b
static void vnc_debug_gnutls_log(int level, const char* str) { VNC_DEBUG("%d %s", level, str); }
{ "code": [], "line_no": [] }
static void FUNC_0(int VAR_0, const char* VAR_1) { VNC_DEBUG("%d %s", VAR_0, VAR_1); }
[ "static void FUNC_0(int VAR_0, const char* VAR_1) {", "VNC_DEBUG(\"%d %s\", VAR_0, VAR_1);", "}" ]
[ 0, 0, 0 ]
[ [ 1 ], [ 3 ], [ 5 ] ]
11,317
static uint64_t subpage_read(void *opaque, target_phys_addr_t addr, unsigned len) { subpage_t *mmio = opaque; unsigned int idx = SUBPAGE_IDX(addr); MemoryRegionSection *section; #if defined(DEBUG_SUBPAGE) printf("%s: subpage %p len %d addr " TARGET_FMT_plx " idx %d\n", __func__, mmio, len, addr, idx); #endif section = &phys_sections[mmio->sub_section[idx]]; addr += mmio->base; addr -= section->offset_within_address_space; addr += section->offset_within_region; return io_mem_read(section->mr, addr, len); }
false
qemu
a8170e5e97ad17ca169c64ba87ae2f53850dab4c
static uint64_t subpage_read(void *opaque, target_phys_addr_t addr, unsigned len) { subpage_t *mmio = opaque; unsigned int idx = SUBPAGE_IDX(addr); MemoryRegionSection *section; #if defined(DEBUG_SUBPAGE) printf("%s: subpage %p len %d addr " TARGET_FMT_plx " idx %d\n", __func__, mmio, len, addr, idx); #endif section = &phys_sections[mmio->sub_section[idx]]; addr += mmio->base; addr -= section->offset_within_address_space; addr += section->offset_within_region; return io_mem_read(section->mr, addr, len); }
{ "code": [], "line_no": [] }
static uint64_t FUNC_0(void *opaque, target_phys_addr_t addr, unsigned len) { subpage_t *mmio = opaque; unsigned int VAR_0 = SUBPAGE_IDX(addr); MemoryRegionSection *section; #if defined(DEBUG_SUBPAGE) printf("%s: subpage %p len %d addr " TARGET_FMT_plx " VAR_0 %d\n", __func__, mmio, len, addr, VAR_0); #endif section = &phys_sections[mmio->sub_section[VAR_0]]; addr += mmio->base; addr -= section->offset_within_address_space; addr += section->offset_within_region; return io_mem_read(section->mr, addr, len); }
[ "static uint64_t FUNC_0(void *opaque, target_phys_addr_t addr,\nunsigned len)\n{", "subpage_t *mmio = opaque;", "unsigned int VAR_0 = SUBPAGE_IDX(addr);", "MemoryRegionSection *section;", "#if defined(DEBUG_SUBPAGE)\nprintf(\"%s: subpage %p len %d addr \" TARGET_FMT_plx \" VAR_0 %d\\n\", __func__,\nmmio, len, addr, VAR_0);", "#endif\nsection = &phys_sections[mmio->sub_section[VAR_0]];", "addr += mmio->base;", "addr -= section->offset_within_address_space;", "addr += section->offset_within_region;", "return io_mem_read(section->mr, addr, len);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13, 15, 17 ], [ 19, 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ] ]
11,318
int qcrypto_pbkdf2(QCryptoHashAlgorithm hash, const uint8_t *key, size_t nkey, const uint8_t *salt, size_t nsalt, unsigned int iterations, uint8_t *out, size_t nout, Error **errp) { static const int hash_map[QCRYPTO_HASH_ALG__MAX] = { [QCRYPTO_HASH_ALG_MD5] = GCRY_MD_MD5, [QCRYPTO_HASH_ALG_SHA1] = GCRY_MD_SHA1, [QCRYPTO_HASH_ALG_SHA256] = GCRY_MD_SHA256, }; int ret; if (hash >= G_N_ELEMENTS(hash_map) || hash_map[hash] == GCRY_MD_NONE) { error_setg(errp, "Unexpected hash algorithm %d", hash); return -1; } ret = gcry_kdf_derive(key, nkey, GCRY_KDF_PBKDF2, hash_map[hash], salt, nsalt, iterations, nout, out); if (ret != 0) { error_setg(errp, "Cannot derive password: %s", gcry_strerror(ret)); return -1; } return 0; }
false
qemu
59b060be184aff59cfa101c937c8139e66f452f2
int qcrypto_pbkdf2(QCryptoHashAlgorithm hash, const uint8_t *key, size_t nkey, const uint8_t *salt, size_t nsalt, unsigned int iterations, uint8_t *out, size_t nout, Error **errp) { static const int hash_map[QCRYPTO_HASH_ALG__MAX] = { [QCRYPTO_HASH_ALG_MD5] = GCRY_MD_MD5, [QCRYPTO_HASH_ALG_SHA1] = GCRY_MD_SHA1, [QCRYPTO_HASH_ALG_SHA256] = GCRY_MD_SHA256, }; int ret; if (hash >= G_N_ELEMENTS(hash_map) || hash_map[hash] == GCRY_MD_NONE) { error_setg(errp, "Unexpected hash algorithm %d", hash); return -1; } ret = gcry_kdf_derive(key, nkey, GCRY_KDF_PBKDF2, hash_map[hash], salt, nsalt, iterations, nout, out); if (ret != 0) { error_setg(errp, "Cannot derive password: %s", gcry_strerror(ret)); return -1; } return 0; }
{ "code": [], "line_no": [] }
int FUNC_0(QCryptoHashAlgorithm VAR_0, const uint8_t *VAR_1, size_t VAR_2, const uint8_t *VAR_3, size_t VAR_4, unsigned int VAR_5, uint8_t *VAR_6, size_t VAR_7, Error **VAR_8) { static const int VAR_9[QCRYPTO_HASH_ALG__MAX] = { [QCRYPTO_HASH_ALG_MD5] = GCRY_MD_MD5, [QCRYPTO_HASH_ALG_SHA1] = GCRY_MD_SHA1, [QCRYPTO_HASH_ALG_SHA256] = GCRY_MD_SHA256, }; int VAR_10; if (VAR_0 >= G_N_ELEMENTS(VAR_9) || VAR_9[VAR_0] == GCRY_MD_NONE) { error_setg(VAR_8, "Unexpected VAR_0 algorithm %d", VAR_0); return -1; } VAR_10 = gcry_kdf_derive(VAR_1, VAR_2, GCRY_KDF_PBKDF2, VAR_9[VAR_0], VAR_3, VAR_4, VAR_5, VAR_7, VAR_6); if (VAR_10 != 0) { error_setg(VAR_8, "Cannot derive password: %s", gcry_strerror(VAR_10)); return -1; } return 0; }
[ "int FUNC_0(QCryptoHashAlgorithm VAR_0,\nconst uint8_t *VAR_1, size_t VAR_2,\nconst uint8_t *VAR_3, size_t VAR_4,\nunsigned int VAR_5,\nuint8_t *VAR_6, size_t VAR_7,\nError **VAR_8)\n{", "static const int VAR_9[QCRYPTO_HASH_ALG__MAX] = {", "[QCRYPTO_HASH_ALG_MD5] = GCRY_MD_MD5,\n[QCRYPTO_HASH_ALG_SHA1] = GCRY_MD_SHA1,\n[QCRYPTO_HASH_ALG_SHA256] = GCRY_MD_SHA256,\n};", "int VAR_10;", "if (VAR_0 >= G_N_ELEMENTS(VAR_9) ||\nVAR_9[VAR_0] == GCRY_MD_NONE) {", "error_setg(VAR_8, \"Unexpected VAR_0 algorithm %d\", VAR_0);", "return -1;", "}", "VAR_10 = gcry_kdf_derive(VAR_1, VAR_2, GCRY_KDF_PBKDF2,\nVAR_9[VAR_0],\nVAR_3, VAR_4, VAR_5,\nVAR_7, VAR_6);", "if (VAR_10 != 0) {", "error_setg(VAR_8, \"Cannot derive password: %s\",\ngcry_strerror(VAR_10));", "return -1;", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9, 11, 13 ], [ 15 ], [ 17, 19, 21, 23 ], [ 25 ], [ 29, 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41, 43, 45, 47 ], [ 49 ], [ 51, 53 ], [ 55 ], [ 57 ], [ 61 ], [ 63 ] ]
11,319
uint32_t helper_efdctui (uint64_t val) { CPU_DoubleU u; u.ll = val; /* NaN are not treated the same way IEEE 754 does */ if (unlikely(float64_is_nan(u.d))) return 0; return float64_to_uint32(u.d, &env->vec_status); }
false
qemu
185698715dfb18c82ad2a5dbc169908602d43e81
uint32_t helper_efdctui (uint64_t val) { CPU_DoubleU u; u.ll = val; if (unlikely(float64_is_nan(u.d))) return 0; return float64_to_uint32(u.d, &env->vec_status); }
{ "code": [], "line_no": [] }
uint32_t FUNC_0 (uint64_t val) { CPU_DoubleU u; u.ll = val; if (unlikely(float64_is_nan(u.d))) return 0; return float64_to_uint32(u.d, &env->vec_status); }
[ "uint32_t FUNC_0 (uint64_t val)\n{", "CPU_DoubleU u;", "u.ll = val;", "if (unlikely(float64_is_nan(u.d)))\nreturn 0;", "return float64_to_uint32(u.d, &env->vec_status);", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 13, 15 ], [ 19 ], [ 21 ] ]
11,320
Aml *init_aml_allocator(void) { Aml *var; assert(!alloc_list); alloc_list = g_ptr_array_new(); var = aml_alloc(); return var; }
false
qemu
9be385980d37e8f4fd33f605f5fb1c3d144170a8
Aml *init_aml_allocator(void) { Aml *var; assert(!alloc_list); alloc_list = g_ptr_array_new(); var = aml_alloc(); return var; }
{ "code": [], "line_no": [] }
Aml *FUNC_0(void) { Aml *var; assert(!alloc_list); alloc_list = g_ptr_array_new(); var = aml_alloc(); return var; }
[ "Aml *FUNC_0(void)\n{", "Aml *var;", "assert(!alloc_list);", "alloc_list = g_ptr_array_new();", "var = aml_alloc();", "return var;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ] ]
11,321
static void dca_downmix(float **samples, int srcfmt, int lfe_present, float coef[DCA_PRIM_CHANNELS_MAX + 1][2], const int8_t *channel_mapping) { int c, l, r, sl, sr, s; int i; float t, u, v; switch (srcfmt) { case DCA_MONO: case DCA_CHANNEL: case DCA_STEREO_TOTAL: case DCA_STEREO_SUMDIFF: case DCA_4F2R: av_log(NULL, 0, "Not implemented!\n"); break; case DCA_STEREO: break; case DCA_3F: c = channel_mapping[0]; l = channel_mapping[1]; r = channel_mapping[2]; DOWNMIX_TO_STEREO(MIX_FRONT3(samples, coef), ); break; case DCA_2F1R: s = channel_mapping[2]; DOWNMIX_TO_STEREO(MIX_REAR1(samples, s, 2, coef), ); break; case DCA_3F1R: c = channel_mapping[0]; l = channel_mapping[1]; r = channel_mapping[2]; s = channel_mapping[3]; DOWNMIX_TO_STEREO(MIX_FRONT3(samples, coef), MIX_REAR1(samples, s, 3, coef)); break; case DCA_2F2R: sl = channel_mapping[2]; sr = channel_mapping[3]; DOWNMIX_TO_STEREO(MIX_REAR2(samples, sl, sr, 2, coef), ); break; case DCA_3F2R: c = channel_mapping[0]; l = channel_mapping[1]; r = channel_mapping[2]; sl = channel_mapping[3]; sr = channel_mapping[4]; DOWNMIX_TO_STEREO(MIX_FRONT3(samples, coef), MIX_REAR2(samples, sl, sr, 3, coef)); break; } if (lfe_present) { int lf_buf = dca_lfe_index[srcfmt]; int lf_idx = dca_channels [srcfmt]; for (i = 0; i < 256; i++) { samples[0][i] += samples[lf_buf][i] * coef[lf_idx][0]; samples[1][i] += samples[lf_buf][i] * coef[lf_idx][1]; } } }
false
FFmpeg
220494ad0b2e9e980ef703b46b69308236f29be5
static void dca_downmix(float **samples, int srcfmt, int lfe_present, float coef[DCA_PRIM_CHANNELS_MAX + 1][2], const int8_t *channel_mapping) { int c, l, r, sl, sr, s; int i; float t, u, v; switch (srcfmt) { case DCA_MONO: case DCA_CHANNEL: case DCA_STEREO_TOTAL: case DCA_STEREO_SUMDIFF: case DCA_4F2R: av_log(NULL, 0, "Not implemented!\n"); break; case DCA_STEREO: break; case DCA_3F: c = channel_mapping[0]; l = channel_mapping[1]; r = channel_mapping[2]; DOWNMIX_TO_STEREO(MIX_FRONT3(samples, coef), ); break; case DCA_2F1R: s = channel_mapping[2]; DOWNMIX_TO_STEREO(MIX_REAR1(samples, s, 2, coef), ); break; case DCA_3F1R: c = channel_mapping[0]; l = channel_mapping[1]; r = channel_mapping[2]; s = channel_mapping[3]; DOWNMIX_TO_STEREO(MIX_FRONT3(samples, coef), MIX_REAR1(samples, s, 3, coef)); break; case DCA_2F2R: sl = channel_mapping[2]; sr = channel_mapping[3]; DOWNMIX_TO_STEREO(MIX_REAR2(samples, sl, sr, 2, coef), ); break; case DCA_3F2R: c = channel_mapping[0]; l = channel_mapping[1]; r = channel_mapping[2]; sl = channel_mapping[3]; sr = channel_mapping[4]; DOWNMIX_TO_STEREO(MIX_FRONT3(samples, coef), MIX_REAR2(samples, sl, sr, 3, coef)); break; } if (lfe_present) { int lf_buf = dca_lfe_index[srcfmt]; int lf_idx = dca_channels [srcfmt]; for (i = 0; i < 256; i++) { samples[0][i] += samples[lf_buf][i] * coef[lf_idx][0]; samples[1][i] += samples[lf_buf][i] * coef[lf_idx][1]; } } }
{ "code": [], "line_no": [] }
static void FUNC_0(float **VAR_0, int VAR_1, int VAR_2, float VAR_3[DCA_PRIM_CHANNELS_MAX + 1][2], const int8_t *VAR_4) { int VAR_5, VAR_6, VAR_7, VAR_8, VAR_9, VAR_10; int VAR_11; float VAR_12, VAR_13, VAR_14; switch (VAR_1) { case DCA_MONO: case DCA_CHANNEL: case DCA_STEREO_TOTAL: case DCA_STEREO_SUMDIFF: case DCA_4F2R: av_log(NULL, 0, "Not implemented!\n"); break; case DCA_STEREO: break; case DCA_3F: VAR_5 = VAR_4[0]; VAR_6 = VAR_4[1]; VAR_7 = VAR_4[2]; DOWNMIX_TO_STEREO(MIX_FRONT3(VAR_0, VAR_3), ); break; case DCA_2F1R: VAR_10 = VAR_4[2]; DOWNMIX_TO_STEREO(MIX_REAR1(VAR_0, VAR_10, 2, VAR_3), ); break; case DCA_3F1R: VAR_5 = VAR_4[0]; VAR_6 = VAR_4[1]; VAR_7 = VAR_4[2]; VAR_10 = VAR_4[3]; DOWNMIX_TO_STEREO(MIX_FRONT3(VAR_0, VAR_3), MIX_REAR1(VAR_0, VAR_10, 3, VAR_3)); break; case DCA_2F2R: VAR_8 = VAR_4[2]; VAR_9 = VAR_4[3]; DOWNMIX_TO_STEREO(MIX_REAR2(VAR_0, VAR_8, VAR_9, 2, VAR_3), ); break; case DCA_3F2R: VAR_5 = VAR_4[0]; VAR_6 = VAR_4[1]; VAR_7 = VAR_4[2]; VAR_8 = VAR_4[3]; VAR_9 = VAR_4[4]; DOWNMIX_TO_STEREO(MIX_FRONT3(VAR_0, VAR_3), MIX_REAR2(VAR_0, VAR_8, VAR_9, 3, VAR_3)); break; } if (VAR_2) { int VAR_15 = dca_lfe_index[VAR_1]; int VAR_16 = dca_channels [VAR_1]; for (VAR_11 = 0; VAR_11 < 256; VAR_11++) { VAR_0[0][VAR_11] += VAR_0[VAR_15][VAR_11] * VAR_3[VAR_16][0]; VAR_0[1][VAR_11] += VAR_0[VAR_15][VAR_11] * VAR_3[VAR_16][1]; } } }
[ "static void FUNC_0(float **VAR_0, int VAR_1, int VAR_2,\nfloat VAR_3[DCA_PRIM_CHANNELS_MAX + 1][2],\nconst int8_t *VAR_4)\n{", "int VAR_5, VAR_6, VAR_7, VAR_8, VAR_9, VAR_10;", "int VAR_11;", "float VAR_12, VAR_13, VAR_14;", "switch (VAR_1) {", "case DCA_MONO:\ncase DCA_CHANNEL:\ncase DCA_STEREO_TOTAL:\ncase DCA_STEREO_SUMDIFF:\ncase DCA_4F2R:\nav_log(NULL, 0, \"Not implemented!\\n\");", "break;", "case DCA_STEREO:\nbreak;", "case DCA_3F:\nVAR_5 = VAR_4[0];", "VAR_6 = VAR_4[1];", "VAR_7 = VAR_4[2];", "DOWNMIX_TO_STEREO(MIX_FRONT3(VAR_0, VAR_3), );", "break;", "case DCA_2F1R:\nVAR_10 = VAR_4[2];", "DOWNMIX_TO_STEREO(MIX_REAR1(VAR_0, VAR_10, 2, VAR_3), );", "break;", "case DCA_3F1R:\nVAR_5 = VAR_4[0];", "VAR_6 = VAR_4[1];", "VAR_7 = VAR_4[2];", "VAR_10 = VAR_4[3];", "DOWNMIX_TO_STEREO(MIX_FRONT3(VAR_0, VAR_3),\nMIX_REAR1(VAR_0, VAR_10, 3, VAR_3));", "break;", "case DCA_2F2R:\nVAR_8 = VAR_4[2];", "VAR_9 = VAR_4[3];", "DOWNMIX_TO_STEREO(MIX_REAR2(VAR_0, VAR_8, VAR_9, 2, VAR_3), );", "break;", "case DCA_3F2R:\nVAR_5 = VAR_4[0];", "VAR_6 = VAR_4[1];", "VAR_7 = VAR_4[2];", "VAR_8 = VAR_4[3];", "VAR_9 = VAR_4[4];", "DOWNMIX_TO_STEREO(MIX_FRONT3(VAR_0, VAR_3),\nMIX_REAR2(VAR_0, VAR_8, VAR_9, 3, VAR_3));", "break;", "}", "if (VAR_2) {", "int VAR_15 = dca_lfe_index[VAR_1];", "int VAR_16 = dca_channels [VAR_1];", "for (VAR_11 = 0; VAR_11 < 256; VAR_11++) {", "VAR_0[0][VAR_11] += VAR_0[VAR_15][VAR_11] * VAR_3[VAR_16][0];", "VAR_0[1][VAR_11] += VAR_0[VAR_15][VAR_11] * VAR_3[VAR_16][1];", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19, 21, 23, 25, 27, 29 ], [ 31 ], [ 33, 35 ], [ 37, 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49, 51 ], [ 53 ], [ 55 ], [ 57, 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67, 69 ], [ 71 ], [ 73, 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83, 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95, 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ] ]
11,322
void spapr_tce_free(sPAPRTCETable *tcet) { QLIST_REMOVE(tcet, list); if (!kvm_enabled() || (kvmppc_remove_spapr_tce(tcet->table, tcet->fd, tcet->window_size) != 0)) { g_free(tcet->table); } g_free(tcet); }
false
qemu
a83000f5e3fac30a7f213af1ba6a8f827622854d
void spapr_tce_free(sPAPRTCETable *tcet) { QLIST_REMOVE(tcet, list); if (!kvm_enabled() || (kvmppc_remove_spapr_tce(tcet->table, tcet->fd, tcet->window_size) != 0)) { g_free(tcet->table); } g_free(tcet); }
{ "code": [], "line_no": [] }
void FUNC_0(sPAPRTCETable *VAR_0) { QLIST_REMOVE(VAR_0, list); if (!kvm_enabled() || (kvmppc_remove_spapr_tce(VAR_0->table, VAR_0->fd, VAR_0->window_size) != 0)) { g_free(VAR_0->table); } g_free(VAR_0); }
[ "void FUNC_0(sPAPRTCETable *VAR_0)\n{", "QLIST_REMOVE(VAR_0, list);", "if (!kvm_enabled() ||\n(kvmppc_remove_spapr_tce(VAR_0->table, VAR_0->fd,\nVAR_0->window_size) != 0)) {", "g_free(VAR_0->table);", "}", "g_free(VAR_0);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9, 11, 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ] ]