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
15,438
void bdrv_flush_io_queue(BlockDriverState *bs) { BlockDriver *drv = bs->drv; if (drv && drv->bdrv_flush_io_queue) { drv->bdrv_flush_io_queue(bs); } else if (bs->file) { bdrv_flush_io_queue(bs->file); } }
false
qemu
61007b316cd71ee7333ff7a0a749a8949527575f
void bdrv_flush_io_queue(BlockDriverState *bs) { BlockDriver *drv = bs->drv; if (drv && drv->bdrv_flush_io_queue) { drv->bdrv_flush_io_queue(bs); } else if (bs->file) { bdrv_flush_io_queue(bs->file); } }
{ "code": [], "line_no": [] }
void FUNC_0(BlockDriverState *VAR_0) { BlockDriver *drv = VAR_0->drv; if (drv && drv->FUNC_0) { drv->FUNC_0(VAR_0); } else if (VAR_0->file) { FUNC_0(VAR_0->file); } }
[ "void FUNC_0(BlockDriverState *VAR_0)\n{", "BlockDriver *drv = VAR_0->drv;", "if (drv && drv->FUNC_0) {", "drv->FUNC_0(VAR_0);", "} else if (VAR_0->file) {", "FUNC_0(VAR_0->file);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ] ]
15,439
static void rtas_event_log_queue(int log_type, void *data, bool exception) { sPAPRMachineState *spapr = SPAPR_MACHINE(qdev_get_machine()); sPAPREventLogEntry *entry = g_new(sPAPREventLogEntry, 1); g_assert(data); entry->log_type = log_type; entry->exception = exception; entry->data = data; QTAILQ_INSERT_TAIL(&spapr->pending_events, entry, next); }
false
qemu
bff3063837a76b37a4bbbfe614324ca38e859f2b
static void rtas_event_log_queue(int log_type, void *data, bool exception) { sPAPRMachineState *spapr = SPAPR_MACHINE(qdev_get_machine()); sPAPREventLogEntry *entry = g_new(sPAPREventLogEntry, 1); g_assert(data); entry->log_type = log_type; entry->exception = exception; entry->data = data; QTAILQ_INSERT_TAIL(&spapr->pending_events, entry, next); }
{ "code": [], "line_no": [] }
static void FUNC_0(int VAR_0, void *VAR_1, bool VAR_2) { sPAPRMachineState *spapr = SPAPR_MACHINE(qdev_get_machine()); sPAPREventLogEntry *entry = g_new(sPAPREventLogEntry, 1); g_assert(VAR_1); entry->VAR_0 = VAR_0; entry->VAR_2 = VAR_2; entry->VAR_1 = VAR_1; QTAILQ_INSERT_TAIL(&spapr->pending_events, entry, next); }
[ "static void FUNC_0(int VAR_0, void *VAR_1, bool VAR_2)\n{", "sPAPRMachineState *spapr = SPAPR_MACHINE(qdev_get_machine());", "sPAPREventLogEntry *entry = g_new(sPAPREventLogEntry, 1);", "g_assert(VAR_1);", "entry->VAR_0 = VAR_0;", "entry->VAR_2 = VAR_2;", "entry->VAR_1 = VAR_1;", "QTAILQ_INSERT_TAIL(&spapr->pending_events, entry, next);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ] ]
15,440
static int pci_set_default_subsystem_id(PCIDevice *pci_dev) { uint16_t *id; id = (void*)(&pci_dev->config[PCI_SUBSYSTEM_VENDOR_ID]); id[0] = cpu_to_le16(pci_default_sub_vendor_id); id[1] = cpu_to_le16(pci_default_sub_device_id); return 0; }
false
qemu
5e434f4e60f8e5a9dadf324b3ee31c3ce0e80165
static int pci_set_default_subsystem_id(PCIDevice *pci_dev) { uint16_t *id; id = (void*)(&pci_dev->config[PCI_SUBSYSTEM_VENDOR_ID]); id[0] = cpu_to_le16(pci_default_sub_vendor_id); id[1] = cpu_to_le16(pci_default_sub_device_id); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(PCIDevice *VAR_0) { uint16_t *id; id = (void*)(&VAR_0->config[PCI_SUBSYSTEM_VENDOR_ID]); id[0] = cpu_to_le16(pci_default_sub_vendor_id); id[1] = cpu_to_le16(pci_default_sub_device_id); return 0; }
[ "static int FUNC_0(PCIDevice *VAR_0)\n{", "uint16_t *id;", "id = (void*)(&VAR_0->config[PCI_SUBSYSTEM_VENDOR_ID]);", "id[0] = cpu_to_le16(pci_default_sub_vendor_id);", "id[1] = cpu_to_le16(pci_default_sub_device_id);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ] ]
15,441
static inline uint8_t *get_seg_base(uint32_t e1, uint32_t e2) { return (uint8_t *)((e1 >> 16) | ((e2 & 0xff) << 16) | (e2 & 0xff000000)); }
false
qemu
7e84c2498f0ff3999937d18d1e9abaa030400000
static inline uint8_t *get_seg_base(uint32_t e1, uint32_t e2) { return (uint8_t *)((e1 >> 16) | ((e2 & 0xff) << 16) | (e2 & 0xff000000)); }
{ "code": [], "line_no": [] }
static inline uint8_t *FUNC_0(uint32_t e1, uint32_t e2) { return (uint8_t *)((e1 >> 16) | ((e2 & 0xff) << 16) | (e2 & 0xff000000)); }
[ "static inline uint8_t *FUNC_0(uint32_t e1, uint32_t e2)\n{", "return (uint8_t *)((e1 >> 16) | ((e2 & 0xff) << 16) | (e2 & 0xff000000));", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
15,442
int ff_h264_decode_seq_parameter_set(GetBitContext *gb, AVCodecContext *avctx, H264ParamSets *ps, int ignore_truncation) { AVBufferRef *sps_buf; int profile_idc, level_idc, constraint_set_flags = 0; unsigned int sps_id; int i, log2_max_frame_num_minus4; SPS *sps; sps_buf = av_buffer_allocz(sizeof(*sps)); if (!sps_buf) return AVERROR(ENOMEM); sps = (SPS*)sps_buf->data; sps->data_size = gb->buffer_end - gb->buffer; if (sps->data_size > sizeof(sps->data)) { av_log(avctx, AV_LOG_WARNING, "Truncating likely oversized SPS\n"); sps->data_size = sizeof(sps->data); } memcpy(sps->data, gb->buffer, sps->data_size); profile_idc = get_bits(gb, 8); constraint_set_flags |= get_bits1(gb) << 0; // constraint_set0_flag constraint_set_flags |= get_bits1(gb) << 1; // constraint_set1_flag constraint_set_flags |= get_bits1(gb) << 2; // constraint_set2_flag constraint_set_flags |= get_bits1(gb) << 3; // constraint_set3_flag constraint_set_flags |= get_bits1(gb) << 4; // constraint_set4_flag constraint_set_flags |= get_bits1(gb) << 5; // constraint_set5_flag skip_bits(gb, 2); // reserved_zero_2bits level_idc = get_bits(gb, 8); sps_id = get_ue_golomb_31(gb); if (sps_id >= MAX_SPS_COUNT) { av_log(avctx, AV_LOG_ERROR, "sps_id %u out of range\n", sps_id); goto fail; } sps->sps_id = sps_id; sps->time_offset_length = 24; sps->profile_idc = profile_idc; sps->constraint_set_flags = constraint_set_flags; sps->level_idc = level_idc; sps->full_range = -1; memset(sps->scaling_matrix4, 16, sizeof(sps->scaling_matrix4)); memset(sps->scaling_matrix8, 16, sizeof(sps->scaling_matrix8)); sps->scaling_matrix_present = 0; sps->colorspace = 2; //AVCOL_SPC_UNSPECIFIED if (sps->profile_idc == 100 || // High profile sps->profile_idc == 110 || // High10 profile sps->profile_idc == 122 || // High422 profile sps->profile_idc == 244 || // High444 Predictive profile sps->profile_idc == 44 || // Cavlc444 profile sps->profile_idc == 83 || // Scalable Constrained High profile (SVC) sps->profile_idc == 86 || // Scalable High Intra profile (SVC) sps->profile_idc == 118 || // Stereo High profile (MVC) sps->profile_idc == 128 || // Multiview High profile (MVC) sps->profile_idc == 138 || // Multiview Depth High profile (MVCD) sps->profile_idc == 144) { // old High444 profile sps->chroma_format_idc = get_ue_golomb_31(gb); if (sps->chroma_format_idc > 3U) { avpriv_request_sample(avctx, "chroma_format_idc %u", sps->chroma_format_idc); goto fail; } else if (sps->chroma_format_idc == 3) { sps->residual_color_transform_flag = get_bits1(gb); if (sps->residual_color_transform_flag) { av_log(avctx, AV_LOG_ERROR, "separate color planes are not supported\n"); goto fail; } } sps->bit_depth_luma = get_ue_golomb(gb) + 8; sps->bit_depth_chroma = get_ue_golomb(gb) + 8; if (sps->bit_depth_chroma != sps->bit_depth_luma) { avpriv_request_sample(avctx, "Different chroma and luma bit depth"); goto fail; } if (sps->bit_depth_luma < 8 || sps->bit_depth_luma > 14 || sps->bit_depth_chroma < 8 || sps->bit_depth_chroma > 14) { av_log(avctx, AV_LOG_ERROR, "illegal bit depth value (%d, %d)\n", sps->bit_depth_luma, sps->bit_depth_chroma); goto fail; } sps->transform_bypass = get_bits1(gb); sps->scaling_matrix_present |= decode_scaling_matrices(gb, sps, NULL, 1, sps->scaling_matrix4, sps->scaling_matrix8); } else { sps->chroma_format_idc = 1; sps->bit_depth_luma = 8; sps->bit_depth_chroma = 8; } log2_max_frame_num_minus4 = get_ue_golomb(gb); if (log2_max_frame_num_minus4 < MIN_LOG2_MAX_FRAME_NUM - 4 || log2_max_frame_num_minus4 > MAX_LOG2_MAX_FRAME_NUM - 4) { av_log(avctx, AV_LOG_ERROR, "log2_max_frame_num_minus4 out of range (0-12): %d\n", log2_max_frame_num_minus4); goto fail; } sps->log2_max_frame_num = log2_max_frame_num_minus4 + 4; sps->poc_type = get_ue_golomb_31(gb); if (sps->poc_type == 0) { // FIXME #define unsigned t = get_ue_golomb(gb); if (t>12) { av_log(avctx, AV_LOG_ERROR, "log2_max_poc_lsb (%d) is out of range\n", t); goto fail; } sps->log2_max_poc_lsb = t + 4; } else if (sps->poc_type == 1) { // FIXME #define sps->delta_pic_order_always_zero_flag = get_bits1(gb); sps->offset_for_non_ref_pic = get_se_golomb(gb); sps->offset_for_top_to_bottom_field = get_se_golomb(gb); sps->poc_cycle_length = get_ue_golomb(gb); if ((unsigned)sps->poc_cycle_length >= FF_ARRAY_ELEMS(sps->offset_for_ref_frame)) { av_log(avctx, AV_LOG_ERROR, "poc_cycle_length overflow %d\n", sps->poc_cycle_length); goto fail; } for (i = 0; i < sps->poc_cycle_length; i++) sps->offset_for_ref_frame[i] = get_se_golomb(gb); } else if (sps->poc_type != 2) { av_log(avctx, AV_LOG_ERROR, "illegal POC type %d\n", sps->poc_type); goto fail; } sps->ref_frame_count = get_ue_golomb_31(gb); if (avctx->codec_tag == MKTAG('S', 'M', 'V', '2')) sps->ref_frame_count = FFMAX(2, sps->ref_frame_count); if (sps->ref_frame_count > H264_MAX_PICTURE_COUNT - 2 || sps->ref_frame_count > 16U) { av_log(avctx, AV_LOG_ERROR, "too many reference frames %d\n", sps->ref_frame_count); goto fail; } sps->gaps_in_frame_num_allowed_flag = get_bits1(gb); sps->mb_width = get_ue_golomb(gb) + 1; sps->mb_height = get_ue_golomb(gb) + 1; if ((unsigned)sps->mb_width >= INT_MAX / 16 || (unsigned)sps->mb_height >= INT_MAX / 16 || av_image_check_size(16 * sps->mb_width, 16 * sps->mb_height, 0, avctx)) { av_log(avctx, AV_LOG_ERROR, "mb_width/height overflow\n"); goto fail; } sps->frame_mbs_only_flag = get_bits1(gb); if (!sps->frame_mbs_only_flag) sps->mb_aff = get_bits1(gb); else sps->mb_aff = 0; sps->direct_8x8_inference_flag = get_bits1(gb); #ifndef ALLOW_INTERLACE if (sps->mb_aff) av_log(avctx, AV_LOG_ERROR, "MBAFF support not included; enable it at compile-time.\n"); #endif sps->crop = get_bits1(gb); if (sps->crop) { unsigned int crop_left = get_ue_golomb(gb); unsigned int crop_right = get_ue_golomb(gb); unsigned int crop_top = get_ue_golomb(gb); unsigned int crop_bottom = get_ue_golomb(gb); int width = 16 * sps->mb_width; int height = 16 * sps->mb_height * (2 - sps->frame_mbs_only_flag); if (avctx->flags2 & AV_CODEC_FLAG2_IGNORE_CROP) { av_log(avctx, AV_LOG_DEBUG, "discarding sps cropping, original " "values are l:%d r:%d t:%d b:%d\n", crop_left, crop_right, crop_top, crop_bottom); sps->crop_left = sps->crop_right = sps->crop_top = sps->crop_bottom = 0; } else { int vsub = (sps->chroma_format_idc == 1) ? 1 : 0; int hsub = (sps->chroma_format_idc == 1 || sps->chroma_format_idc == 2) ? 1 : 0; int step_x = 1 << hsub; int step_y = (2 - sps->frame_mbs_only_flag) << vsub; if (crop_left & (0x1F >> (sps->bit_depth_luma > 8)) && !(avctx->flags & AV_CODEC_FLAG_UNALIGNED)) { crop_left &= ~(0x1F >> (sps->bit_depth_luma > 8)); av_log(avctx, AV_LOG_WARNING, "Reducing left cropping to %d " "chroma samples to preserve alignment.\n", crop_left); } if (crop_left > (unsigned)INT_MAX / 4 / step_x || crop_right > (unsigned)INT_MAX / 4 / step_x || crop_top > (unsigned)INT_MAX / 4 / step_y || crop_bottom> (unsigned)INT_MAX / 4 / step_y || (crop_left + crop_right ) * step_x >= width || (crop_top + crop_bottom) * step_y >= height ) { av_log(avctx, AV_LOG_ERROR, "crop values invalid %d %d %d %d / %d %d\n", crop_left, crop_right, crop_top, crop_bottom, width, height); goto fail; } sps->crop_left = crop_left * step_x; sps->crop_right = crop_right * step_x; sps->crop_top = crop_top * step_y; sps->crop_bottom = crop_bottom * step_y; } } else { sps->crop_left = sps->crop_right = sps->crop_top = sps->crop_bottom = sps->crop = 0; } sps->vui_parameters_present_flag = get_bits1(gb); if (sps->vui_parameters_present_flag) { int ret = decode_vui_parameters(gb, avctx, sps); if (ret < 0) goto fail; } if (get_bits_left(gb) < 0) { av_log(avctx, ignore_truncation ? AV_LOG_WARNING : AV_LOG_ERROR, "Overread %s by %d bits\n", sps->vui_parameters_present_flag ? "VUI" : "SPS", -get_bits_left(gb)); if (!ignore_truncation) goto fail; } /* if the maximum delay is not stored in the SPS, derive it based on the * level */ if (!sps->bitstream_restriction_flag) { sps->num_reorder_frames = MAX_DELAYED_PIC_COUNT - 1; for (i = 0; i < FF_ARRAY_ELEMS(level_max_dpb_mbs); i++) { if (level_max_dpb_mbs[i][0] == sps->level_idc) { sps->num_reorder_frames = FFMIN(level_max_dpb_mbs[i][1] / (sps->mb_width * sps->mb_height), sps->num_reorder_frames); break; } } } if (!sps->sar.den) sps->sar.den = 1; if (avctx->debug & FF_DEBUG_PICT_INFO) { static const char csp[4][5] = { "Gray", "420", "422", "444" }; av_log(avctx, AV_LOG_DEBUG, "sps:%u profile:%d/%d poc:%d ref:%d %dx%d %s %s crop:%u/%u/%u/%u %s %s %"PRId32"/%"PRId32" b%d reo:%d\n", sps_id, sps->profile_idc, sps->level_idc, sps->poc_type, sps->ref_frame_count, sps->mb_width, sps->mb_height, sps->frame_mbs_only_flag ? "FRM" : (sps->mb_aff ? "MB-AFF" : "PIC-AFF"), sps->direct_8x8_inference_flag ? "8B8" : "", sps->crop_left, sps->crop_right, sps->crop_top, sps->crop_bottom, sps->vui_parameters_present_flag ? "VUI" : "", csp[sps->chroma_format_idc], sps->timing_info_present_flag ? sps->num_units_in_tick : 0, sps->timing_info_present_flag ? sps->time_scale : 0, sps->bit_depth_luma, sps->bitstream_restriction_flag ? sps->num_reorder_frames : -1 ); } /* check if this is a repeat of an already parsed SPS, then keep the * original one. * otherwise drop all PPSes that depend on it */ if (ps->sps_list[sps_id] && !memcmp(ps->sps_list[sps_id]->data, sps_buf->data, sps_buf->size)) { av_buffer_unref(&sps_buf); } else { remove_sps(ps, sps_id); ps->sps_list[sps_id] = sps_buf; } return 0; fail: av_buffer_unref(&sps_buf); return AVERROR_INVALIDDATA; }
false
FFmpeg
4cc1ce4a91788a71670ea43fa0026b5a969e9e9e
int ff_h264_decode_seq_parameter_set(GetBitContext *gb, AVCodecContext *avctx, H264ParamSets *ps, int ignore_truncation) { AVBufferRef *sps_buf; int profile_idc, level_idc, constraint_set_flags = 0; unsigned int sps_id; int i, log2_max_frame_num_minus4; SPS *sps; sps_buf = av_buffer_allocz(sizeof(*sps)); if (!sps_buf) return AVERROR(ENOMEM); sps = (SPS*)sps_buf->data; sps->data_size = gb->buffer_end - gb->buffer; if (sps->data_size > sizeof(sps->data)) { av_log(avctx, AV_LOG_WARNING, "Truncating likely oversized SPS\n"); sps->data_size = sizeof(sps->data); } memcpy(sps->data, gb->buffer, sps->data_size); profile_idc = get_bits(gb, 8); constraint_set_flags |= get_bits1(gb) << 0; constraint_set_flags |= get_bits1(gb) << 1; constraint_set_flags |= get_bits1(gb) << 2; constraint_set_flags |= get_bits1(gb) << 3; constraint_set_flags |= get_bits1(gb) << 4; constraint_set_flags |= get_bits1(gb) << 5; skip_bits(gb, 2); level_idc = get_bits(gb, 8); sps_id = get_ue_golomb_31(gb); if (sps_id >= MAX_SPS_COUNT) { av_log(avctx, AV_LOG_ERROR, "sps_id %u out of range\n", sps_id); goto fail; } sps->sps_id = sps_id; sps->time_offset_length = 24; sps->profile_idc = profile_idc; sps->constraint_set_flags = constraint_set_flags; sps->level_idc = level_idc; sps->full_range = -1; memset(sps->scaling_matrix4, 16, sizeof(sps->scaling_matrix4)); memset(sps->scaling_matrix8, 16, sizeof(sps->scaling_matrix8)); sps->scaling_matrix_present = 0; sps->colorspace = 2; if (sps->profile_idc == 100 || sps->profile_idc == 110 || sps->profile_idc == 122 || sps->profile_idc == 244 || sps->profile_idc == 44 || sps->profile_idc == 83 || sps->profile_idc == 86 || sps->profile_idc == 118 || sps->profile_idc == 128 || sps->profile_idc == 138 || sps->profile_idc == 144) { sps->chroma_format_idc = get_ue_golomb_31(gb); if (sps->chroma_format_idc > 3U) { avpriv_request_sample(avctx, "chroma_format_idc %u", sps->chroma_format_idc); goto fail; } else if (sps->chroma_format_idc == 3) { sps->residual_color_transform_flag = get_bits1(gb); if (sps->residual_color_transform_flag) { av_log(avctx, AV_LOG_ERROR, "separate color planes are not supported\n"); goto fail; } } sps->bit_depth_luma = get_ue_golomb(gb) + 8; sps->bit_depth_chroma = get_ue_golomb(gb) + 8; if (sps->bit_depth_chroma != sps->bit_depth_luma) { avpriv_request_sample(avctx, "Different chroma and luma bit depth"); goto fail; } if (sps->bit_depth_luma < 8 || sps->bit_depth_luma > 14 || sps->bit_depth_chroma < 8 || sps->bit_depth_chroma > 14) { av_log(avctx, AV_LOG_ERROR, "illegal bit depth value (%d, %d)\n", sps->bit_depth_luma, sps->bit_depth_chroma); goto fail; } sps->transform_bypass = get_bits1(gb); sps->scaling_matrix_present |= decode_scaling_matrices(gb, sps, NULL, 1, sps->scaling_matrix4, sps->scaling_matrix8); } else { sps->chroma_format_idc = 1; sps->bit_depth_luma = 8; sps->bit_depth_chroma = 8; } log2_max_frame_num_minus4 = get_ue_golomb(gb); if (log2_max_frame_num_minus4 < MIN_LOG2_MAX_FRAME_NUM - 4 || log2_max_frame_num_minus4 > MAX_LOG2_MAX_FRAME_NUM - 4) { av_log(avctx, AV_LOG_ERROR, "log2_max_frame_num_minus4 out of range (0-12): %d\n", log2_max_frame_num_minus4); goto fail; } sps->log2_max_frame_num = log2_max_frame_num_minus4 + 4; sps->poc_type = get_ue_golomb_31(gb); if (sps->poc_type == 0) { unsigned t = get_ue_golomb(gb); if (t>12) { av_log(avctx, AV_LOG_ERROR, "log2_max_poc_lsb (%d) is out of range\n", t); goto fail; } sps->log2_max_poc_lsb = t + 4; } else if (sps->poc_type == 1) { sps->delta_pic_order_always_zero_flag = get_bits1(gb); sps->offset_for_non_ref_pic = get_se_golomb(gb); sps->offset_for_top_to_bottom_field = get_se_golomb(gb); sps->poc_cycle_length = get_ue_golomb(gb); if ((unsigned)sps->poc_cycle_length >= FF_ARRAY_ELEMS(sps->offset_for_ref_frame)) { av_log(avctx, AV_LOG_ERROR, "poc_cycle_length overflow %d\n", sps->poc_cycle_length); goto fail; } for (i = 0; i < sps->poc_cycle_length; i++) sps->offset_for_ref_frame[i] = get_se_golomb(gb); } else if (sps->poc_type != 2) { av_log(avctx, AV_LOG_ERROR, "illegal POC type %d\n", sps->poc_type); goto fail; } sps->ref_frame_count = get_ue_golomb_31(gb); if (avctx->codec_tag == MKTAG('S', 'M', 'V', '2')) sps->ref_frame_count = FFMAX(2, sps->ref_frame_count); if (sps->ref_frame_count > H264_MAX_PICTURE_COUNT - 2 || sps->ref_frame_count > 16U) { av_log(avctx, AV_LOG_ERROR, "too many reference frames %d\n", sps->ref_frame_count); goto fail; } sps->gaps_in_frame_num_allowed_flag = get_bits1(gb); sps->mb_width = get_ue_golomb(gb) + 1; sps->mb_height = get_ue_golomb(gb) + 1; if ((unsigned)sps->mb_width >= INT_MAX / 16 || (unsigned)sps->mb_height >= INT_MAX / 16 || av_image_check_size(16 * sps->mb_width, 16 * sps->mb_height, 0, avctx)) { av_log(avctx, AV_LOG_ERROR, "mb_width/height overflow\n"); goto fail; } sps->frame_mbs_only_flag = get_bits1(gb); if (!sps->frame_mbs_only_flag) sps->mb_aff = get_bits1(gb); else sps->mb_aff = 0; sps->direct_8x8_inference_flag = get_bits1(gb); #ifndef ALLOW_INTERLACE if (sps->mb_aff) av_log(avctx, AV_LOG_ERROR, "MBAFF support not included; enable it at compile-time.\n"); #endif sps->crop = get_bits1(gb); if (sps->crop) { unsigned int crop_left = get_ue_golomb(gb); unsigned int crop_right = get_ue_golomb(gb); unsigned int crop_top = get_ue_golomb(gb); unsigned int crop_bottom = get_ue_golomb(gb); int width = 16 * sps->mb_width; int height = 16 * sps->mb_height * (2 - sps->frame_mbs_only_flag); if (avctx->flags2 & AV_CODEC_FLAG2_IGNORE_CROP) { av_log(avctx, AV_LOG_DEBUG, "discarding sps cropping, original " "values are l:%d r:%d t:%d b:%d\n", crop_left, crop_right, crop_top, crop_bottom); sps->crop_left = sps->crop_right = sps->crop_top = sps->crop_bottom = 0; } else { int vsub = (sps->chroma_format_idc == 1) ? 1 : 0; int hsub = (sps->chroma_format_idc == 1 || sps->chroma_format_idc == 2) ? 1 : 0; int step_x = 1 << hsub; int step_y = (2 - sps->frame_mbs_only_flag) << vsub; if (crop_left & (0x1F >> (sps->bit_depth_luma > 8)) && !(avctx->flags & AV_CODEC_FLAG_UNALIGNED)) { crop_left &= ~(0x1F >> (sps->bit_depth_luma > 8)); av_log(avctx, AV_LOG_WARNING, "Reducing left cropping to %d " "chroma samples to preserve alignment.\n", crop_left); } if (crop_left > (unsigned)INT_MAX / 4 / step_x || crop_right > (unsigned)INT_MAX / 4 / step_x || crop_top > (unsigned)INT_MAX / 4 / step_y || crop_bottom> (unsigned)INT_MAX / 4 / step_y || (crop_left + crop_right ) * step_x >= width || (crop_top + crop_bottom) * step_y >= height ) { av_log(avctx, AV_LOG_ERROR, "crop values invalid %d %d %d %d / %d %d\n", crop_left, crop_right, crop_top, crop_bottom, width, height); goto fail; } sps->crop_left = crop_left * step_x; sps->crop_right = crop_right * step_x; sps->crop_top = crop_top * step_y; sps->crop_bottom = crop_bottom * step_y; } } else { sps->crop_left = sps->crop_right = sps->crop_top = sps->crop_bottom = sps->crop = 0; } sps->vui_parameters_present_flag = get_bits1(gb); if (sps->vui_parameters_present_flag) { int ret = decode_vui_parameters(gb, avctx, sps); if (ret < 0) goto fail; } if (get_bits_left(gb) < 0) { av_log(avctx, ignore_truncation ? AV_LOG_WARNING : AV_LOG_ERROR, "Overread %s by %d bits\n", sps->vui_parameters_present_flag ? "VUI" : "SPS", -get_bits_left(gb)); if (!ignore_truncation) goto fail; } if (!sps->bitstream_restriction_flag) { sps->num_reorder_frames = MAX_DELAYED_PIC_COUNT - 1; for (i = 0; i < FF_ARRAY_ELEMS(level_max_dpb_mbs); i++) { if (level_max_dpb_mbs[i][0] == sps->level_idc) { sps->num_reorder_frames = FFMIN(level_max_dpb_mbs[i][1] / (sps->mb_width * sps->mb_height), sps->num_reorder_frames); break; } } } if (!sps->sar.den) sps->sar.den = 1; if (avctx->debug & FF_DEBUG_PICT_INFO) { static const char csp[4][5] = { "Gray", "420", "422", "444" }; av_log(avctx, AV_LOG_DEBUG, "sps:%u profile:%d/%d poc:%d ref:%d %dx%d %s %s crop:%u/%u/%u/%u %s %s %"PRId32"/%"PRId32" b%d reo:%d\n", sps_id, sps->profile_idc, sps->level_idc, sps->poc_type, sps->ref_frame_count, sps->mb_width, sps->mb_height, sps->frame_mbs_only_flag ? "FRM" : (sps->mb_aff ? "MB-AFF" : "PIC-AFF"), sps->direct_8x8_inference_flag ? "8B8" : "", sps->crop_left, sps->crop_right, sps->crop_top, sps->crop_bottom, sps->vui_parameters_present_flag ? "VUI" : "", csp[sps->chroma_format_idc], sps->timing_info_present_flag ? sps->num_units_in_tick : 0, sps->timing_info_present_flag ? sps->time_scale : 0, sps->bit_depth_luma, sps->bitstream_restriction_flag ? sps->num_reorder_frames : -1 ); } if (ps->sps_list[sps_id] && !memcmp(ps->sps_list[sps_id]->data, sps_buf->data, sps_buf->size)) { av_buffer_unref(&sps_buf); } else { remove_sps(ps, sps_id); ps->sps_list[sps_id] = sps_buf; } return 0; fail: av_buffer_unref(&sps_buf); return AVERROR_INVALIDDATA; }
{ "code": [], "line_no": [] }
int FUNC_0(GetBitContext *VAR_0, AVCodecContext *VAR_1, H264ParamSets *VAR_2, int VAR_3) { AVBufferRef *sps_buf; int VAR_4, VAR_5, VAR_6 = 0; unsigned int VAR_7; int VAR_8, VAR_9; SPS *sps; sps_buf = av_buffer_allocz(sizeof(*sps)); if (!sps_buf) return AVERROR(ENOMEM); sps = (SPS*)sps_buf->data; sps->data_size = VAR_0->buffer_end - VAR_0->buffer; if (sps->data_size > sizeof(sps->data)) { av_log(VAR_1, AV_LOG_WARNING, "Truncating likely oversized SPS\n"); sps->data_size = sizeof(sps->data); } memcpy(sps->data, VAR_0->buffer, sps->data_size); VAR_4 = get_bits(VAR_0, 8); VAR_6 |= get_bits1(VAR_0) << 0; VAR_6 |= get_bits1(VAR_0) << 1; VAR_6 |= get_bits1(VAR_0) << 2; VAR_6 |= get_bits1(VAR_0) << 3; VAR_6 |= get_bits1(VAR_0) << 4; VAR_6 |= get_bits1(VAR_0) << 5; skip_bits(VAR_0, 2); VAR_5 = get_bits(VAR_0, 8); VAR_7 = get_ue_golomb_31(VAR_0); if (VAR_7 >= MAX_SPS_COUNT) { av_log(VAR_1, AV_LOG_ERROR, "VAR_7 %u out of range\n", VAR_7); goto fail; } sps->VAR_7 = VAR_7; sps->time_offset_length = 24; sps->VAR_4 = VAR_4; sps->VAR_6 = VAR_6; sps->VAR_5 = VAR_5; sps->full_range = -1; memset(sps->scaling_matrix4, 16, sizeof(sps->scaling_matrix4)); memset(sps->scaling_matrix8, 16, sizeof(sps->scaling_matrix8)); sps->scaling_matrix_present = 0; sps->colorspace = 2; if (sps->VAR_4 == 100 || sps->VAR_4 == 110 || sps->VAR_4 == 122 || sps->VAR_4 == 244 || sps->VAR_4 == 44 || sps->VAR_4 == 83 || sps->VAR_4 == 86 || sps->VAR_4 == 118 || sps->VAR_4 == 128 || sps->VAR_4 == 138 || sps->VAR_4 == 144) { sps->chroma_format_idc = get_ue_golomb_31(VAR_0); if (sps->chroma_format_idc > 3U) { avpriv_request_sample(VAR_1, "chroma_format_idc %u", sps->chroma_format_idc); goto fail; } else if (sps->chroma_format_idc == 3) { sps->residual_color_transform_flag = get_bits1(VAR_0); if (sps->residual_color_transform_flag) { av_log(VAR_1, AV_LOG_ERROR, "separate color planes are not supported\n"); goto fail; } } sps->bit_depth_luma = get_ue_golomb(VAR_0) + 8; sps->bit_depth_chroma = get_ue_golomb(VAR_0) + 8; if (sps->bit_depth_chroma != sps->bit_depth_luma) { avpriv_request_sample(VAR_1, "Different chroma and luma bit depth"); goto fail; } if (sps->bit_depth_luma < 8 || sps->bit_depth_luma > 14 || sps->bit_depth_chroma < 8 || sps->bit_depth_chroma > 14) { av_log(VAR_1, AV_LOG_ERROR, "illegal bit depth value (%d, %d)\n", sps->bit_depth_luma, sps->bit_depth_chroma); goto fail; } sps->transform_bypass = get_bits1(VAR_0); sps->scaling_matrix_present |= decode_scaling_matrices(VAR_0, sps, NULL, 1, sps->scaling_matrix4, sps->scaling_matrix8); } else { sps->chroma_format_idc = 1; sps->bit_depth_luma = 8; sps->bit_depth_chroma = 8; } VAR_9 = get_ue_golomb(VAR_0); if (VAR_9 < MIN_LOG2_MAX_FRAME_NUM - 4 || VAR_9 > MAX_LOG2_MAX_FRAME_NUM - 4) { av_log(VAR_1, AV_LOG_ERROR, "VAR_9 out of range (0-12): %d\n", VAR_9); goto fail; } sps->log2_max_frame_num = VAR_9 + 4; sps->poc_type = get_ue_golomb_31(VAR_0); if (sps->poc_type == 0) { unsigned VAR_10 = get_ue_golomb(VAR_0); if (VAR_10>12) { av_log(VAR_1, AV_LOG_ERROR, "log2_max_poc_lsb (%d) is out of range\n", VAR_10); goto fail; } sps->log2_max_poc_lsb = VAR_10 + 4; } else if (sps->poc_type == 1) { sps->delta_pic_order_always_zero_flag = get_bits1(VAR_0); sps->offset_for_non_ref_pic = get_se_golomb(VAR_0); sps->offset_for_top_to_bottom_field = get_se_golomb(VAR_0); sps->poc_cycle_length = get_ue_golomb(VAR_0); if ((unsigned)sps->poc_cycle_length >= FF_ARRAY_ELEMS(sps->offset_for_ref_frame)) { av_log(VAR_1, AV_LOG_ERROR, "poc_cycle_length overflow %d\n", sps->poc_cycle_length); goto fail; } for (VAR_8 = 0; VAR_8 < sps->poc_cycle_length; VAR_8++) sps->offset_for_ref_frame[VAR_8] = get_se_golomb(VAR_0); } else if (sps->poc_type != 2) { av_log(VAR_1, AV_LOG_ERROR, "illegal POC type %d\n", sps->poc_type); goto fail; } sps->ref_frame_count = get_ue_golomb_31(VAR_0); if (VAR_1->codec_tag == MKTAG('S', 'M', 'V', '2')) sps->ref_frame_count = FFMAX(2, sps->ref_frame_count); if (sps->ref_frame_count > H264_MAX_PICTURE_COUNT - 2 || sps->ref_frame_count > 16U) { av_log(VAR_1, AV_LOG_ERROR, "too many reference frames %d\n", sps->ref_frame_count); goto fail; } sps->gaps_in_frame_num_allowed_flag = get_bits1(VAR_0); sps->mb_width = get_ue_golomb(VAR_0) + 1; sps->mb_height = get_ue_golomb(VAR_0) + 1; if ((unsigned)sps->mb_width >= INT_MAX / 16 || (unsigned)sps->mb_height >= INT_MAX / 16 || av_image_check_size(16 * sps->mb_width, 16 * sps->mb_height, 0, VAR_1)) { av_log(VAR_1, AV_LOG_ERROR, "mb_width/VAR_16 overflow\n"); goto fail; } sps->frame_mbs_only_flag = get_bits1(VAR_0); if (!sps->frame_mbs_only_flag) sps->mb_aff = get_bits1(VAR_0); else sps->mb_aff = 0; sps->direct_8x8_inference_flag = get_bits1(VAR_0); #ifndef ALLOW_INTERLACE if (sps->mb_aff) av_log(VAR_1, AV_LOG_ERROR, "MBAFF support not included; enable it at compile-time.\n"); #endif sps->crop = get_bits1(VAR_0); if (sps->crop) { unsigned int VAR_11 = get_ue_golomb(VAR_0); unsigned int VAR_12 = get_ue_golomb(VAR_0); unsigned int VAR_13 = get_ue_golomb(VAR_0); unsigned int VAR_14 = get_ue_golomb(VAR_0); int VAR_15 = 16 * sps->mb_width; int VAR_16 = 16 * sps->mb_height * (2 - sps->frame_mbs_only_flag); if (VAR_1->flags2 & AV_CODEC_FLAG2_IGNORE_CROP) { av_log(VAR_1, AV_LOG_DEBUG, "discarding sps cropping, original " "values are l:%d r:%d VAR_10:%d b:%d\n", VAR_11, VAR_12, VAR_13, VAR_14); sps->VAR_11 = sps->VAR_12 = sps->VAR_13 = sps->VAR_14 = 0; } else { int VAR_17 = (sps->chroma_format_idc == 1) ? 1 : 0; int VAR_18 = (sps->chroma_format_idc == 1 || sps->chroma_format_idc == 2) ? 1 : 0; int VAR_19 = 1 << VAR_18; int VAR_20 = (2 - sps->frame_mbs_only_flag) << VAR_17; if (VAR_11 & (0x1F >> (sps->bit_depth_luma > 8)) && !(VAR_1->flags & AV_CODEC_FLAG_UNALIGNED)) { VAR_11 &= ~(0x1F >> (sps->bit_depth_luma > 8)); av_log(VAR_1, AV_LOG_WARNING, "Reducing left cropping to %d " "chroma samples to preserve alignment.\n", VAR_11); } if (VAR_11 > (unsigned)INT_MAX / 4 / VAR_19 || VAR_12 > (unsigned)INT_MAX / 4 / VAR_19 || VAR_13 > (unsigned)INT_MAX / 4 / VAR_20 || VAR_14> (unsigned)INT_MAX / 4 / VAR_20 || (VAR_11 + VAR_12 ) * VAR_19 >= VAR_15 || (VAR_13 + VAR_14) * VAR_20 >= VAR_16 ) { av_log(VAR_1, AV_LOG_ERROR, "crop values invalid %d %d %d %d / %d %d\n", VAR_11, VAR_12, VAR_13, VAR_14, VAR_15, VAR_16); goto fail; } sps->VAR_11 = VAR_11 * VAR_19; sps->VAR_12 = VAR_12 * VAR_19; sps->VAR_13 = VAR_13 * VAR_20; sps->VAR_14 = VAR_14 * VAR_20; } } else { sps->VAR_11 = sps->VAR_12 = sps->VAR_13 = sps->VAR_14 = sps->crop = 0; } sps->vui_parameters_present_flag = get_bits1(VAR_0); if (sps->vui_parameters_present_flag) { int VAR_21 = decode_vui_parameters(VAR_0, VAR_1, sps); if (VAR_21 < 0) goto fail; } if (get_bits_left(VAR_0) < 0) { av_log(VAR_1, VAR_3 ? AV_LOG_WARNING : AV_LOG_ERROR, "Overread %s by %d bits\n", sps->vui_parameters_present_flag ? "VUI" : "SPS", -get_bits_left(VAR_0)); if (!VAR_3) goto fail; } if (!sps->bitstream_restriction_flag) { sps->num_reorder_frames = MAX_DELAYED_PIC_COUNT - 1; for (VAR_8 = 0; VAR_8 < FF_ARRAY_ELEMS(level_max_dpb_mbs); VAR_8++) { if (level_max_dpb_mbs[VAR_8][0] == sps->VAR_5) { sps->num_reorder_frames = FFMIN(level_max_dpb_mbs[VAR_8][1] / (sps->mb_width * sps->mb_height), sps->num_reorder_frames); break; } } } if (!sps->sar.den) sps->sar.den = 1; if (VAR_1->debug & FF_DEBUG_PICT_INFO) { static const char VAR_22[4][5] = { "Gray", "420", "422", "444" }; av_log(VAR_1, AV_LOG_DEBUG, "sps:%u profile:%d/%d poc:%d ref:%d %dx%d %s %s crop:%u/%u/%u/%u %s %s %"PRId32"/%"PRId32" b%d reo:%d\n", VAR_7, sps->VAR_4, sps->VAR_5, sps->poc_type, sps->ref_frame_count, sps->mb_width, sps->mb_height, sps->frame_mbs_only_flag ? "FRM" : (sps->mb_aff ? "MB-AFF" : "PIC-AFF"), sps->direct_8x8_inference_flag ? "8B8" : "", sps->VAR_11, sps->VAR_12, sps->VAR_13, sps->VAR_14, sps->vui_parameters_present_flag ? "VUI" : "", VAR_22[sps->chroma_format_idc], sps->timing_info_present_flag ? sps->num_units_in_tick : 0, sps->timing_info_present_flag ? sps->time_scale : 0, sps->bit_depth_luma, sps->bitstream_restriction_flag ? sps->num_reorder_frames : -1 ); } if (VAR_2->sps_list[VAR_7] && !memcmp(VAR_2->sps_list[VAR_7]->data, sps_buf->data, sps_buf->size)) { av_buffer_unref(&sps_buf); } else { remove_sps(VAR_2, VAR_7); VAR_2->sps_list[VAR_7] = sps_buf; } return 0; fail: av_buffer_unref(&sps_buf); return AVERROR_INVALIDDATA; }
[ "int FUNC_0(GetBitContext *VAR_0, AVCodecContext *VAR_1,\nH264ParamSets *VAR_2, int VAR_3)\n{", "AVBufferRef *sps_buf;", "int VAR_4, VAR_5, VAR_6 = 0;", "unsigned int VAR_7;", "int VAR_8, VAR_9;", "SPS *sps;", "sps_buf = av_buffer_allocz(sizeof(*sps));", "if (!sps_buf)\nreturn AVERROR(ENOMEM);", "sps = (SPS*)sps_buf->data;", "sps->data_size = VAR_0->buffer_end - VAR_0->buffer;", "if (sps->data_size > sizeof(sps->data)) {", "av_log(VAR_1, AV_LOG_WARNING, \"Truncating likely oversized SPS\\n\");", "sps->data_size = sizeof(sps->data);", "}", "memcpy(sps->data, VAR_0->buffer, sps->data_size);", "VAR_4 = get_bits(VAR_0, 8);", "VAR_6 |= get_bits1(VAR_0) << 0;", "VAR_6 |= get_bits1(VAR_0) << 1;", "VAR_6 |= get_bits1(VAR_0) << 2;", "VAR_6 |= get_bits1(VAR_0) << 3;", "VAR_6 |= get_bits1(VAR_0) << 4;", "VAR_6 |= get_bits1(VAR_0) << 5;", "skip_bits(VAR_0, 2);", "VAR_5 = get_bits(VAR_0, 8);", "VAR_7 = get_ue_golomb_31(VAR_0);", "if (VAR_7 >= MAX_SPS_COUNT) {", "av_log(VAR_1, AV_LOG_ERROR, \"VAR_7 %u out of range\\n\", VAR_7);", "goto fail;", "}", "sps->VAR_7 = VAR_7;", "sps->time_offset_length = 24;", "sps->VAR_4 = VAR_4;", "sps->VAR_6 = VAR_6;", "sps->VAR_5 = VAR_5;", "sps->full_range = -1;", "memset(sps->scaling_matrix4, 16, sizeof(sps->scaling_matrix4));", "memset(sps->scaling_matrix8, 16, sizeof(sps->scaling_matrix8));", "sps->scaling_matrix_present = 0;", "sps->colorspace = 2;", "if (sps->VAR_4 == 100 ||\nsps->VAR_4 == 110 ||\nsps->VAR_4 == 122 ||\nsps->VAR_4 == 244 ||\nsps->VAR_4 == 44 ||\nsps->VAR_4 == 83 ||\nsps->VAR_4 == 86 ||\nsps->VAR_4 == 118 ||\nsps->VAR_4 == 128 ||\nsps->VAR_4 == 138 ||\nsps->VAR_4 == 144) {", "sps->chroma_format_idc = get_ue_golomb_31(VAR_0);", "if (sps->chroma_format_idc > 3U) {", "avpriv_request_sample(VAR_1, \"chroma_format_idc %u\",\nsps->chroma_format_idc);", "goto fail;", "} else if (sps->chroma_format_idc == 3) {", "sps->residual_color_transform_flag = get_bits1(VAR_0);", "if (sps->residual_color_transform_flag) {", "av_log(VAR_1, AV_LOG_ERROR, \"separate color planes are not supported\\n\");", "goto fail;", "}", "}", "sps->bit_depth_luma = get_ue_golomb(VAR_0) + 8;", "sps->bit_depth_chroma = get_ue_golomb(VAR_0) + 8;", "if (sps->bit_depth_chroma != sps->bit_depth_luma) {", "avpriv_request_sample(VAR_1,\n\"Different chroma and luma bit depth\");", "goto fail;", "}", "if (sps->bit_depth_luma < 8 || sps->bit_depth_luma > 14 ||\nsps->bit_depth_chroma < 8 || sps->bit_depth_chroma > 14) {", "av_log(VAR_1, AV_LOG_ERROR, \"illegal bit depth value (%d, %d)\\n\",\nsps->bit_depth_luma, sps->bit_depth_chroma);", "goto fail;", "}", "sps->transform_bypass = get_bits1(VAR_0);", "sps->scaling_matrix_present |= decode_scaling_matrices(VAR_0, sps, NULL, 1,\nsps->scaling_matrix4, sps->scaling_matrix8);", "} else {", "sps->chroma_format_idc = 1;", "sps->bit_depth_luma = 8;", "sps->bit_depth_chroma = 8;", "}", "VAR_9 = get_ue_golomb(VAR_0);", "if (VAR_9 < MIN_LOG2_MAX_FRAME_NUM - 4 ||\nVAR_9 > MAX_LOG2_MAX_FRAME_NUM - 4) {", "av_log(VAR_1, AV_LOG_ERROR,\n\"VAR_9 out of range (0-12): %d\\n\",\nVAR_9);", "goto fail;", "}", "sps->log2_max_frame_num = VAR_9 + 4;", "sps->poc_type = get_ue_golomb_31(VAR_0);", "if (sps->poc_type == 0) {", "unsigned VAR_10 = get_ue_golomb(VAR_0);", "if (VAR_10>12) {", "av_log(VAR_1, AV_LOG_ERROR, \"log2_max_poc_lsb (%d) is out of range\\n\", VAR_10);", "goto fail;", "}", "sps->log2_max_poc_lsb = VAR_10 + 4;", "} else if (sps->poc_type == 1) {", "sps->delta_pic_order_always_zero_flag = get_bits1(VAR_0);", "sps->offset_for_non_ref_pic = get_se_golomb(VAR_0);", "sps->offset_for_top_to_bottom_field = get_se_golomb(VAR_0);", "sps->poc_cycle_length = get_ue_golomb(VAR_0);", "if ((unsigned)sps->poc_cycle_length >=\nFF_ARRAY_ELEMS(sps->offset_for_ref_frame)) {", "av_log(VAR_1, AV_LOG_ERROR,\n\"poc_cycle_length overflow %d\\n\", sps->poc_cycle_length);", "goto fail;", "}", "for (VAR_8 = 0; VAR_8 < sps->poc_cycle_length; VAR_8++)", "sps->offset_for_ref_frame[VAR_8] = get_se_golomb(VAR_0);", "} else if (sps->poc_type != 2) {", "av_log(VAR_1, AV_LOG_ERROR, \"illegal POC type %d\\n\", sps->poc_type);", "goto fail;", "}", "sps->ref_frame_count = get_ue_golomb_31(VAR_0);", "if (VAR_1->codec_tag == MKTAG('S', 'M', 'V', '2'))\nsps->ref_frame_count = FFMAX(2, sps->ref_frame_count);", "if (sps->ref_frame_count > H264_MAX_PICTURE_COUNT - 2 ||\nsps->ref_frame_count > 16U) {", "av_log(VAR_1, AV_LOG_ERROR,\n\"too many reference frames %d\\n\", sps->ref_frame_count);", "goto fail;", "}", "sps->gaps_in_frame_num_allowed_flag = get_bits1(VAR_0);", "sps->mb_width = get_ue_golomb(VAR_0) + 1;", "sps->mb_height = get_ue_golomb(VAR_0) + 1;", "if ((unsigned)sps->mb_width >= INT_MAX / 16 ||\n(unsigned)sps->mb_height >= INT_MAX / 16 ||\nav_image_check_size(16 * sps->mb_width,\n16 * sps->mb_height, 0, VAR_1)) {", "av_log(VAR_1, AV_LOG_ERROR, \"mb_width/VAR_16 overflow\\n\");", "goto fail;", "}", "sps->frame_mbs_only_flag = get_bits1(VAR_0);", "if (!sps->frame_mbs_only_flag)\nsps->mb_aff = get_bits1(VAR_0);", "else\nsps->mb_aff = 0;", "sps->direct_8x8_inference_flag = get_bits1(VAR_0);", "#ifndef ALLOW_INTERLACE\nif (sps->mb_aff)\nav_log(VAR_1, AV_LOG_ERROR,\n\"MBAFF support not included; enable it at compile-time.\\n\");", "#endif\nsps->crop = get_bits1(VAR_0);", "if (sps->crop) {", "unsigned int VAR_11 = get_ue_golomb(VAR_0);", "unsigned int VAR_12 = get_ue_golomb(VAR_0);", "unsigned int VAR_13 = get_ue_golomb(VAR_0);", "unsigned int VAR_14 = get_ue_golomb(VAR_0);", "int VAR_15 = 16 * sps->mb_width;", "int VAR_16 = 16 * sps->mb_height * (2 - sps->frame_mbs_only_flag);", "if (VAR_1->flags2 & AV_CODEC_FLAG2_IGNORE_CROP) {", "av_log(VAR_1, AV_LOG_DEBUG, \"discarding sps cropping, original \"\n\"values are l:%d r:%d VAR_10:%d b:%d\\n\",\nVAR_11, VAR_12, VAR_13, VAR_14);", "sps->VAR_11 =\nsps->VAR_12 =\nsps->VAR_13 =\nsps->VAR_14 = 0;", "} else {", "int VAR_17 = (sps->chroma_format_idc == 1) ? 1 : 0;", "int VAR_18 = (sps->chroma_format_idc == 1 ||\nsps->chroma_format_idc == 2) ? 1 : 0;", "int VAR_19 = 1 << VAR_18;", "int VAR_20 = (2 - sps->frame_mbs_only_flag) << VAR_17;", "if (VAR_11 & (0x1F >> (sps->bit_depth_luma > 8)) &&\n!(VAR_1->flags & AV_CODEC_FLAG_UNALIGNED)) {", "VAR_11 &= ~(0x1F >> (sps->bit_depth_luma > 8));", "av_log(VAR_1, AV_LOG_WARNING,\n\"Reducing left cropping to %d \"\n\"chroma samples to preserve alignment.\\n\",\nVAR_11);", "}", "if (VAR_11 > (unsigned)INT_MAX / 4 / VAR_19 ||\nVAR_12 > (unsigned)INT_MAX / 4 / VAR_19 ||\nVAR_13 > (unsigned)INT_MAX / 4 / VAR_20 ||\nVAR_14> (unsigned)INT_MAX / 4 / VAR_20 ||\n(VAR_11 + VAR_12 ) * VAR_19 >= VAR_15 ||\n(VAR_13 + VAR_14) * VAR_20 >= VAR_16\n) {", "av_log(VAR_1, AV_LOG_ERROR, \"crop values invalid %d %d %d %d / %d %d\\n\", VAR_11, VAR_12, VAR_13, VAR_14, VAR_15, VAR_16);", "goto fail;", "}", "sps->VAR_11 = VAR_11 * VAR_19;", "sps->VAR_12 = VAR_12 * VAR_19;", "sps->VAR_13 = VAR_13 * VAR_20;", "sps->VAR_14 = VAR_14 * VAR_20;", "}", "} else {", "sps->VAR_11 =\nsps->VAR_12 =\nsps->VAR_13 =\nsps->VAR_14 =\nsps->crop = 0;", "}", "sps->vui_parameters_present_flag = get_bits1(VAR_0);", "if (sps->vui_parameters_present_flag) {", "int VAR_21 = decode_vui_parameters(VAR_0, VAR_1, sps);", "if (VAR_21 < 0)\ngoto fail;", "}", "if (get_bits_left(VAR_0) < 0) {", "av_log(VAR_1, VAR_3 ? AV_LOG_WARNING : AV_LOG_ERROR,\n\"Overread %s by %d bits\\n\", sps->vui_parameters_present_flag ? \"VUI\" : \"SPS\", -get_bits_left(VAR_0));", "if (!VAR_3)\ngoto fail;", "}", "if (!sps->bitstream_restriction_flag) {", "sps->num_reorder_frames = MAX_DELAYED_PIC_COUNT - 1;", "for (VAR_8 = 0; VAR_8 < FF_ARRAY_ELEMS(level_max_dpb_mbs); VAR_8++) {", "if (level_max_dpb_mbs[VAR_8][0] == sps->VAR_5) {", "sps->num_reorder_frames = FFMIN(level_max_dpb_mbs[VAR_8][1] / (sps->mb_width * sps->mb_height),\nsps->num_reorder_frames);", "break;", "}", "}", "}", "if (!sps->sar.den)\nsps->sar.den = 1;", "if (VAR_1->debug & FF_DEBUG_PICT_INFO) {", "static const char VAR_22[4][5] = { \"Gray\", \"420\", \"422\", \"444\" };", "av_log(VAR_1, AV_LOG_DEBUG,\n\"sps:%u profile:%d/%d poc:%d ref:%d %dx%d %s %s crop:%u/%u/%u/%u %s %s %\"PRId32\"/%\"PRId32\" b%d reo:%d\\n\",\nVAR_7, sps->VAR_4, sps->VAR_5,\nsps->poc_type,\nsps->ref_frame_count,\nsps->mb_width, sps->mb_height,\nsps->frame_mbs_only_flag ? \"FRM\" : (sps->mb_aff ? \"MB-AFF\" : \"PIC-AFF\"),\nsps->direct_8x8_inference_flag ? \"8B8\" : \"\",\nsps->VAR_11, sps->VAR_12,\nsps->VAR_13, sps->VAR_14,\nsps->vui_parameters_present_flag ? \"VUI\" : \"\",\nVAR_22[sps->chroma_format_idc],\nsps->timing_info_present_flag ? sps->num_units_in_tick : 0,\nsps->timing_info_present_flag ? sps->time_scale : 0,\nsps->bit_depth_luma,\nsps->bitstream_restriction_flag ? sps->num_reorder_frames : -1\n);", "}", "if (VAR_2->sps_list[VAR_7] &&\n!memcmp(VAR_2->sps_list[VAR_7]->data, sps_buf->data, sps_buf->size)) {", "av_buffer_unref(&sps_buf);", "} else {", "remove_sps(VAR_2, VAR_7);", "VAR_2->sps_list[VAR_7] = sps_buf;", "}", "return 0;", "fail:\nav_buffer_unref(&sps_buf);", "return AVERROR_INVALIDDATA;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 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 ], [ 189 ], [ 191, 193 ], [ 195, 197, 199 ], [ 201 ], [ 203 ], [ 205 ], [ 209 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ], [ 225 ], [ 227 ], [ 229 ], [ 231 ], [ 233 ], [ 235 ], [ 239, 241 ], [ 243, 245 ], [ 247 ], [ 249 ], [ 253 ], [ 255 ], [ 257 ], [ 259 ], [ 261 ], [ 263 ], [ 267 ], [ 269, 271 ], [ 273, 275 ], [ 277, 279 ], [ 281 ], [ 283 ], [ 285 ], [ 287 ], [ 289 ], [ 291, 293, 295, 297 ], [ 299 ], [ 301 ], [ 303 ], [ 307 ], [ 309, 311 ], [ 313, 315 ], [ 319 ], [ 323, 325, 327, 329 ], [ 331, 333 ], [ 335 ], [ 337 ], [ 339 ], [ 341 ], [ 343 ], [ 345 ], [ 347 ], [ 351 ], [ 353, 355, 357 ], [ 361, 363, 365, 367 ], [ 369 ], [ 371 ], [ 373, 375 ], [ 377 ], [ 379 ], [ 383, 385 ], [ 387 ], [ 389, 391, 393, 395 ], [ 397 ], [ 401, 403, 405, 407, 409, 411, 413 ], [ 415 ], [ 417 ], [ 419 ], [ 423 ], [ 425 ], [ 427 ], [ 429 ], [ 431 ], [ 433 ], [ 435, 437, 439, 441, 443 ], [ 445 ], [ 449 ], [ 451 ], [ 453 ], [ 455, 457 ], [ 459 ], [ 463 ], [ 465, 467 ], [ 469, 471 ], [ 473 ], [ 481 ], [ 483 ], [ 485 ], [ 487 ], [ 489, 491 ], [ 493 ], [ 495 ], [ 497 ], [ 499 ], [ 503, 505 ], [ 509 ], [ 511 ], [ 513, 515, 517, 519, 521, 523, 525, 527, 529, 531, 533, 535, 537, 539, 541, 543, 545 ], [ 547 ], [ 557, 559 ], [ 561 ], [ 563 ], [ 565 ], [ 567 ], [ 569 ], [ 573 ], [ 577, 579 ], [ 581 ], [ 583 ] ]
15,443
static void invalidate_and_set_dirty(MemoryRegion *mr, hwaddr addr, hwaddr length) { if (cpu_physical_memory_range_includes_clean(addr, length)) { uint8_t dirty_log_mask = memory_region_get_dirty_log_mask(mr); if (dirty_log_mask & (1 << DIRTY_MEMORY_CODE)) { tb_invalidate_phys_range(addr, addr + length); dirty_log_mask &= ~(1 << DIRTY_MEMORY_CODE); } cpu_physical_memory_set_dirty_range(addr, length, dirty_log_mask); } else { xen_modified_memory(addr, length); } }
false
qemu
e87f7778b64d4a6a78e16c288c7fdc6c15317d5f
static void invalidate_and_set_dirty(MemoryRegion *mr, hwaddr addr, hwaddr length) { if (cpu_physical_memory_range_includes_clean(addr, length)) { uint8_t dirty_log_mask = memory_region_get_dirty_log_mask(mr); if (dirty_log_mask & (1 << DIRTY_MEMORY_CODE)) { tb_invalidate_phys_range(addr, addr + length); dirty_log_mask &= ~(1 << DIRTY_MEMORY_CODE); } cpu_physical_memory_set_dirty_range(addr, length, dirty_log_mask); } else { xen_modified_memory(addr, length); } }
{ "code": [], "line_no": [] }
static void FUNC_0(MemoryRegion *VAR_0, hwaddr VAR_1, hwaddr VAR_2) { if (cpu_physical_memory_range_includes_clean(VAR_1, VAR_2)) { uint8_t dirty_log_mask = memory_region_get_dirty_log_mask(VAR_0); if (dirty_log_mask & (1 << DIRTY_MEMORY_CODE)) { tb_invalidate_phys_range(VAR_1, VAR_1 + VAR_2); dirty_log_mask &= ~(1 << DIRTY_MEMORY_CODE); } cpu_physical_memory_set_dirty_range(VAR_1, VAR_2, dirty_log_mask); } else { xen_modified_memory(VAR_1, VAR_2); } }
[ "static void FUNC_0(MemoryRegion *VAR_0, hwaddr VAR_1,\nhwaddr VAR_2)\n{", "if (cpu_physical_memory_range_includes_clean(VAR_1, VAR_2)) {", "uint8_t dirty_log_mask = memory_region_get_dirty_log_mask(VAR_0);", "if (dirty_log_mask & (1 << DIRTY_MEMORY_CODE)) {", "tb_invalidate_phys_range(VAR_1, VAR_1 + VAR_2);", "dirty_log_mask &= ~(1 << DIRTY_MEMORY_CODE);", "}", "cpu_physical_memory_set_dirty_range(VAR_1, VAR_2, dirty_log_mask);", "} else {", "xen_modified_memory(VAR_1, VAR_2);", "}", "}" ]
[ 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 ] ]
15,444
void ich9_lpc_pm_init(PCIDevice *lpc_pci) { ICH9LPCState *lpc = ICH9_LPC_DEVICE(lpc_pci); ich9_pm_init(lpc_pci, &lpc->pm, qemu_allocate_irq(ich9_set_sci, lpc, 0)); ich9_lpc_reset(&lpc->d.qdev); }
false
qemu
fba72476c6b7be60ac74c5bcdc06c61242d1fe4f
void ich9_lpc_pm_init(PCIDevice *lpc_pci) { ICH9LPCState *lpc = ICH9_LPC_DEVICE(lpc_pci); ich9_pm_init(lpc_pci, &lpc->pm, qemu_allocate_irq(ich9_set_sci, lpc, 0)); ich9_lpc_reset(&lpc->d.qdev); }
{ "code": [], "line_no": [] }
void FUNC_0(PCIDevice *VAR_0) { ICH9LPCState *lpc = ICH9_LPC_DEVICE(VAR_0); ich9_pm_init(VAR_0, &lpc->pm, qemu_allocate_irq(ich9_set_sci, lpc, 0)); ich9_lpc_reset(&lpc->d.qdev); }
[ "void FUNC_0(PCIDevice *VAR_0)\n{", "ICH9LPCState *lpc = ICH9_LPC_DEVICE(VAR_0);", "ich9_pm_init(VAR_0, &lpc->pm, qemu_allocate_irq(ich9_set_sci, lpc, 0));", "ich9_lpc_reset(&lpc->d.qdev);", "}" ]
[ 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ] ]
15,446
static void term_show_prompt(void) { term_show_prompt2(); term_cmd_buf_index = 0; term_cmd_buf_size = 0; }
false
qemu
7e2515e87c41e2e658aaed466e11cbdf1ea8bcb1
static void term_show_prompt(void) { term_show_prompt2(); term_cmd_buf_index = 0; term_cmd_buf_size = 0; }
{ "code": [], "line_no": [] }
static void FUNC_0(void) { term_show_prompt2(); term_cmd_buf_index = 0; term_cmd_buf_size = 0; }
[ "static void FUNC_0(void)\n{", "term_show_prompt2();", "term_cmd_buf_index = 0;", "term_cmd_buf_size = 0;", "}" ]
[ 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ] ]
15,447
static int vfio_add_capabilities(VFIOPCIDevice *vdev) { PCIDevice *pdev = &vdev->pdev; int ret; if (!(pdev->config[PCI_STATUS] & PCI_STATUS_CAP_LIST) || !pdev->config[PCI_CAPABILITY_LIST]) { return 0; /* Nothing to add */ } ret = vfio_add_std_cap(vdev, pdev->config[PCI_CAPABILITY_LIST]); if (ret) { return ret; } /* on PCI bus, it doesn't make sense to expose extended capabilities. */ if (!pci_is_express(pdev) || !pci_bus_is_express(pdev->bus) || !pci_get_long(pdev->config + PCI_CONFIG_SPACE_SIZE)) { return 0; } return vfio_add_ext_cap(vdev); }
false
qemu
e37dac06dc4e85a2f46c24261c0dfdf2a30b50e3
static int vfio_add_capabilities(VFIOPCIDevice *vdev) { PCIDevice *pdev = &vdev->pdev; int ret; if (!(pdev->config[PCI_STATUS] & PCI_STATUS_CAP_LIST) || !pdev->config[PCI_CAPABILITY_LIST]) { return 0; } ret = vfio_add_std_cap(vdev, pdev->config[PCI_CAPABILITY_LIST]); if (ret) { return ret; } if (!pci_is_express(pdev) || !pci_bus_is_express(pdev->bus) || !pci_get_long(pdev->config + PCI_CONFIG_SPACE_SIZE)) { return 0; } return vfio_add_ext_cap(vdev); }
{ "code": [], "line_no": [] }
static int FUNC_0(VFIOPCIDevice *VAR_0) { PCIDevice *pdev = &VAR_0->pdev; int VAR_1; if (!(pdev->config[PCI_STATUS] & PCI_STATUS_CAP_LIST) || !pdev->config[PCI_CAPABILITY_LIST]) { return 0; } VAR_1 = vfio_add_std_cap(VAR_0, pdev->config[PCI_CAPABILITY_LIST]); if (VAR_1) { return VAR_1; } if (!pci_is_express(pdev) || !pci_bus_is_express(pdev->bus) || !pci_get_long(pdev->config + PCI_CONFIG_SPACE_SIZE)) { return 0; } return vfio_add_ext_cap(VAR_0); }
[ "static int FUNC_0(VFIOPCIDevice *VAR_0)\n{", "PCIDevice *pdev = &VAR_0->pdev;", "int VAR_1;", "if (!(pdev->config[PCI_STATUS] & PCI_STATUS_CAP_LIST) ||\n!pdev->config[PCI_CAPABILITY_LIST]) {", "return 0;", "}", "VAR_1 = vfio_add_std_cap(VAR_0, pdev->config[PCI_CAPABILITY_LIST]);", "if (VAR_1) {", "return VAR_1;", "}", "if (!pci_is_express(pdev) ||\n!pci_bus_is_express(pdev->bus) ||\n!pci_get_long(pdev->config + PCI_CONFIG_SPACE_SIZE)) {", "return 0;", "}", "return vfio_add_ext_cap(VAR_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 ], [ 33, 35, 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ] ]
15,448
static void test_qemu_strtosz_units(void) { const char *none = "1"; const char *b = "1B"; const char *k = "1K"; const char *m = "1M"; const char *g = "1G"; const char *t = "1T"; const char *p = "1P"; const char *e = "1E"; char *endptr = NULL; int64_t res; /* default is M */ res = qemu_strtosz_MiB(none, &endptr); g_assert_cmpint(res, ==, M_BYTE); g_assert(endptr == none + 1); res = qemu_strtosz(b, &endptr); g_assert_cmpint(res, ==, 1); g_assert(endptr == b + 2); res = qemu_strtosz(k, &endptr); g_assert_cmpint(res, ==, K_BYTE); g_assert(endptr == k + 2); res = qemu_strtosz(m, &endptr); g_assert_cmpint(res, ==, M_BYTE); g_assert(endptr == m + 2); res = qemu_strtosz(g, &endptr); g_assert_cmpint(res, ==, G_BYTE); g_assert(endptr == g + 2); res = qemu_strtosz(t, &endptr); g_assert_cmpint(res, ==, T_BYTE); g_assert(endptr == t + 2); res = qemu_strtosz(p, &endptr); g_assert_cmpint(res, ==, P_BYTE); g_assert(endptr == p + 2); res = qemu_strtosz(e, &endptr); g_assert_cmpint(res, ==, E_BYTE); g_assert(endptr == e + 2); }
false
qemu
f17fd4fdf0df3d2f3444399d04c38d22b9a3e1b7
static void test_qemu_strtosz_units(void) { const char *none = "1"; const char *b = "1B"; const char *k = "1K"; const char *m = "1M"; const char *g = "1G"; const char *t = "1T"; const char *p = "1P"; const char *e = "1E"; char *endptr = NULL; int64_t res; res = qemu_strtosz_MiB(none, &endptr); g_assert_cmpint(res, ==, M_BYTE); g_assert(endptr == none + 1); res = qemu_strtosz(b, &endptr); g_assert_cmpint(res, ==, 1); g_assert(endptr == b + 2); res = qemu_strtosz(k, &endptr); g_assert_cmpint(res, ==, K_BYTE); g_assert(endptr == k + 2); res = qemu_strtosz(m, &endptr); g_assert_cmpint(res, ==, M_BYTE); g_assert(endptr == m + 2); res = qemu_strtosz(g, &endptr); g_assert_cmpint(res, ==, G_BYTE); g_assert(endptr == g + 2); res = qemu_strtosz(t, &endptr); g_assert_cmpint(res, ==, T_BYTE); g_assert(endptr == t + 2); res = qemu_strtosz(p, &endptr); g_assert_cmpint(res, ==, P_BYTE); g_assert(endptr == p + 2); res = qemu_strtosz(e, &endptr); g_assert_cmpint(res, ==, E_BYTE); g_assert(endptr == e + 2); }
{ "code": [], "line_no": [] }
static void FUNC_0(void) { const char *VAR_0 = "1"; const char *VAR_1 = "1B"; const char *VAR_2 = "1K"; const char *VAR_3 = "1M"; const char *VAR_4 = "1G"; const char *VAR_5 = "1T"; const char *VAR_6 = "1P"; const char *VAR_7 = "1E"; char *VAR_8 = NULL; int64_t res; res = qemu_strtosz_MiB(VAR_0, &VAR_8); g_assert_cmpint(res, ==, M_BYTE); g_assert(VAR_8 == VAR_0 + 1); res = qemu_strtosz(VAR_1, &VAR_8); g_assert_cmpint(res, ==, 1); g_assert(VAR_8 == VAR_1 + 2); res = qemu_strtosz(VAR_2, &VAR_8); g_assert_cmpint(res, ==, K_BYTE); g_assert(VAR_8 == VAR_2 + 2); res = qemu_strtosz(VAR_3, &VAR_8); g_assert_cmpint(res, ==, M_BYTE); g_assert(VAR_8 == VAR_3 + 2); res = qemu_strtosz(VAR_4, &VAR_8); g_assert_cmpint(res, ==, G_BYTE); g_assert(VAR_8 == VAR_4 + 2); res = qemu_strtosz(VAR_5, &VAR_8); g_assert_cmpint(res, ==, T_BYTE); g_assert(VAR_8 == VAR_5 + 2); res = qemu_strtosz(VAR_6, &VAR_8); g_assert_cmpint(res, ==, P_BYTE); g_assert(VAR_8 == VAR_6 + 2); res = qemu_strtosz(VAR_7, &VAR_8); g_assert_cmpint(res, ==, E_BYTE); g_assert(VAR_8 == VAR_7 + 2); }
[ "static void FUNC_0(void)\n{", "const char *VAR_0 = \"1\";", "const char *VAR_1 = \"1B\";", "const char *VAR_2 = \"1K\";", "const char *VAR_3 = \"1M\";", "const char *VAR_4 = \"1G\";", "const char *VAR_5 = \"1T\";", "const char *VAR_6 = \"1P\";", "const char *VAR_7 = \"1E\";", "char *VAR_8 = NULL;", "int64_t res;", "res = qemu_strtosz_MiB(VAR_0, &VAR_8);", "g_assert_cmpint(res, ==, M_BYTE);", "g_assert(VAR_8 == VAR_0 + 1);", "res = qemu_strtosz(VAR_1, &VAR_8);", "g_assert_cmpint(res, ==, 1);", "g_assert(VAR_8 == VAR_1 + 2);", "res = qemu_strtosz(VAR_2, &VAR_8);", "g_assert_cmpint(res, ==, K_BYTE);", "g_assert(VAR_8 == VAR_2 + 2);", "res = qemu_strtosz(VAR_3, &VAR_8);", "g_assert_cmpint(res, ==, M_BYTE);", "g_assert(VAR_8 == VAR_3 + 2);", "res = qemu_strtosz(VAR_4, &VAR_8);", "g_assert_cmpint(res, ==, G_BYTE);", "g_assert(VAR_8 == VAR_4 + 2);", "res = qemu_strtosz(VAR_5, &VAR_8);", "g_assert_cmpint(res, ==, T_BYTE);", "g_assert(VAR_8 == VAR_5 + 2);", "res = qemu_strtosz(VAR_6, &VAR_8);", "g_assert_cmpint(res, ==, P_BYTE);", "g_assert(VAR_8 == VAR_6 + 2);", "res = qemu_strtosz(VAR_7, &VAR_8);", "g_assert_cmpint(res, ==, E_BYTE);", "g_assert(VAR_8 == VAR_7 + 2);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 63 ], [ 65 ], [ 69 ], [ 71 ], [ 73 ], [ 77 ], [ 79 ], [ 81 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ] ]
15,450
static inline void gen_op_arith_divd(DisasContext *ctx, TCGv ret, TCGv arg1, TCGv arg2, int sign, int compute_ov) { int l1 = gen_new_label(); int l2 = gen_new_label(); tcg_gen_brcondi_i64(TCG_COND_EQ, arg2, 0, l1); if (sign) { int l3 = gen_new_label(); tcg_gen_brcondi_i64(TCG_COND_NE, arg2, -1, l3); tcg_gen_brcondi_i64(TCG_COND_EQ, arg1, INT64_MIN, l1); gen_set_label(l3); tcg_gen_div_i64(ret, arg1, arg2); } else { tcg_gen_divu_i64(ret, arg1, arg2); } if (compute_ov) { tcg_gen_movi_tl(cpu_ov, 0); } tcg_gen_br(l2); gen_set_label(l1); if (sign) { tcg_gen_sari_i64(ret, arg1, 63); } else { tcg_gen_movi_i64(ret, 0); } if (compute_ov) { tcg_gen_movi_tl(cpu_ov, 1); tcg_gen_movi_tl(cpu_so, 1); } gen_set_label(l2); if (unlikely(Rc(ctx->opcode) != 0)) gen_set_Rc0(ctx, ret); }
false
qemu
42a268c241183877192c376d03bd9b6d527407c7
static inline void gen_op_arith_divd(DisasContext *ctx, TCGv ret, TCGv arg1, TCGv arg2, int sign, int compute_ov) { int l1 = gen_new_label(); int l2 = gen_new_label(); tcg_gen_brcondi_i64(TCG_COND_EQ, arg2, 0, l1); if (sign) { int l3 = gen_new_label(); tcg_gen_brcondi_i64(TCG_COND_NE, arg2, -1, l3); tcg_gen_brcondi_i64(TCG_COND_EQ, arg1, INT64_MIN, l1); gen_set_label(l3); tcg_gen_div_i64(ret, arg1, arg2); } else { tcg_gen_divu_i64(ret, arg1, arg2); } if (compute_ov) { tcg_gen_movi_tl(cpu_ov, 0); } tcg_gen_br(l2); gen_set_label(l1); if (sign) { tcg_gen_sari_i64(ret, arg1, 63); } else { tcg_gen_movi_i64(ret, 0); } if (compute_ov) { tcg_gen_movi_tl(cpu_ov, 1); tcg_gen_movi_tl(cpu_so, 1); } gen_set_label(l2); if (unlikely(Rc(ctx->opcode) != 0)) gen_set_Rc0(ctx, ret); }
{ "code": [], "line_no": [] }
static inline void FUNC_0(DisasContext *VAR_0, TCGv VAR_1, TCGv VAR_2, TCGv VAR_3, int VAR_4, int VAR_5) { int VAR_6 = gen_new_label(); int VAR_7 = gen_new_label(); tcg_gen_brcondi_i64(TCG_COND_EQ, VAR_3, 0, VAR_6); if (VAR_4) { int VAR_8 = gen_new_label(); tcg_gen_brcondi_i64(TCG_COND_NE, VAR_3, -1, VAR_8); tcg_gen_brcondi_i64(TCG_COND_EQ, VAR_2, INT64_MIN, VAR_6); gen_set_label(VAR_8); tcg_gen_div_i64(VAR_1, VAR_2, VAR_3); } else { tcg_gen_divu_i64(VAR_1, VAR_2, VAR_3); } if (VAR_5) { tcg_gen_movi_tl(cpu_ov, 0); } tcg_gen_br(VAR_7); gen_set_label(VAR_6); if (VAR_4) { tcg_gen_sari_i64(VAR_1, VAR_2, 63); } else { tcg_gen_movi_i64(VAR_1, 0); } if (VAR_5) { tcg_gen_movi_tl(cpu_ov, 1); tcg_gen_movi_tl(cpu_so, 1); } gen_set_label(VAR_7); if (unlikely(Rc(VAR_0->opcode) != 0)) gen_set_Rc0(VAR_0, VAR_1); }
[ "static inline void FUNC_0(DisasContext *VAR_0, TCGv VAR_1, TCGv VAR_2,\nTCGv VAR_3, int VAR_4, int VAR_5)\n{", "int VAR_6 = gen_new_label();", "int VAR_7 = gen_new_label();", "tcg_gen_brcondi_i64(TCG_COND_EQ, VAR_3, 0, VAR_6);", "if (VAR_4) {", "int VAR_8 = gen_new_label();", "tcg_gen_brcondi_i64(TCG_COND_NE, VAR_3, -1, VAR_8);", "tcg_gen_brcondi_i64(TCG_COND_EQ, VAR_2, INT64_MIN, VAR_6);", "gen_set_label(VAR_8);", "tcg_gen_div_i64(VAR_1, VAR_2, VAR_3);", "} else {", "tcg_gen_divu_i64(VAR_1, VAR_2, VAR_3);", "}", "if (VAR_5) {", "tcg_gen_movi_tl(cpu_ov, 0);", "}", "tcg_gen_br(VAR_7);", "gen_set_label(VAR_6);", "if (VAR_4) {", "tcg_gen_sari_i64(VAR_1, VAR_2, 63);", "} else {", "tcg_gen_movi_i64(VAR_1, 0);", "}", "if (VAR_5) {", "tcg_gen_movi_tl(cpu_ov, 1);", "tcg_gen_movi_tl(cpu_so, 1);", "}", "gen_set_label(VAR_7);", "if (unlikely(Rc(VAR_0->opcode) != 0))\ngen_set_Rc0(VAR_0, VAR_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, 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 ] ]
15,451
static int os_host_main_loop_wait(int timeout) { int ret, i; PollingEntry *pe; WaitObjects *w = &wait_objects; static struct timeval tv0; /* XXX: need to suppress polling by better using win32 events */ ret = 0; for (pe = first_polling_entry; pe != NULL; pe = pe->next) { ret |= pe->func(pe->opaque); } if (ret != 0) { return ret; } if (nfds >= 0) { ret = select(nfds + 1, &rfds, &wfds, &xfds, &tv0); if (ret != 0) { timeout = 0; } } for (i = 0; i < w->num; i++) { poll_fds[i].fd = (DWORD) w->events[i]; poll_fds[i].events = G_IO_IN; } qemu_mutex_unlock_iothread(); ret = g_poll(poll_fds, w->num, timeout); qemu_mutex_lock_iothread(); if (ret > 0) { for (i = 0; i < w->num; i++) { w->revents[i] = poll_fds[i].revents; } for (i = 0; i < w->num; i++) { if (w->revents[i] && w->func[i]) { w->func[i](w->opaque[i]); } } } /* If an edge-triggered socket event occurred, select will return a * positive result on the next iteration. We do not need to do anything * here. */ return ret; }
false
qemu
ea26ce765cb661a13e4055f38744036a19465e87
static int os_host_main_loop_wait(int timeout) { int ret, i; PollingEntry *pe; WaitObjects *w = &wait_objects; static struct timeval tv0; ret = 0; for (pe = first_polling_entry; pe != NULL; pe = pe->next) { ret |= pe->func(pe->opaque); } if (ret != 0) { return ret; } if (nfds >= 0) { ret = select(nfds + 1, &rfds, &wfds, &xfds, &tv0); if (ret != 0) { timeout = 0; } } for (i = 0; i < w->num; i++) { poll_fds[i].fd = (DWORD) w->events[i]; poll_fds[i].events = G_IO_IN; } qemu_mutex_unlock_iothread(); ret = g_poll(poll_fds, w->num, timeout); qemu_mutex_lock_iothread(); if (ret > 0) { for (i = 0; i < w->num; i++) { w->revents[i] = poll_fds[i].revents; } for (i = 0; i < w->num; i++) { if (w->revents[i] && w->func[i]) { w->func[i](w->opaque[i]); } } } return ret; }
{ "code": [], "line_no": [] }
static int FUNC_0(int VAR_0) { int VAR_1, VAR_2; PollingEntry *pe; WaitObjects *w = &wait_objects; static struct timeval VAR_3; VAR_1 = 0; for (pe = first_polling_entry; pe != NULL; pe = pe->next) { VAR_1 |= pe->func(pe->opaque); } if (VAR_1 != 0) { return VAR_1; } if (nfds >= 0) { VAR_1 = select(nfds + 1, &rfds, &wfds, &xfds, &VAR_3); if (VAR_1 != 0) { VAR_0 = 0; } } for (VAR_2 = 0; VAR_2 < w->num; VAR_2++) { poll_fds[VAR_2].fd = (DWORD) w->events[VAR_2]; poll_fds[VAR_2].events = G_IO_IN; } qemu_mutex_unlock_iothread(); VAR_1 = g_poll(poll_fds, w->num, VAR_0); qemu_mutex_lock_iothread(); if (VAR_1 > 0) { for (VAR_2 = 0; VAR_2 < w->num; VAR_2++) { w->revents[VAR_2] = poll_fds[VAR_2].revents; } for (VAR_2 = 0; VAR_2 < w->num; VAR_2++) { if (w->revents[VAR_2] && w->func[VAR_2]) { w->func[VAR_2](w->opaque[VAR_2]); } } } return VAR_1; }
[ "static int FUNC_0(int VAR_0)\n{", "int VAR_1, VAR_2;", "PollingEntry *pe;", "WaitObjects *w = &wait_objects;", "static struct timeval VAR_3;", "VAR_1 = 0;", "for (pe = first_polling_entry; pe != NULL; pe = pe->next) {", "VAR_1 |= pe->func(pe->opaque);", "}", "if (VAR_1 != 0) {", "return VAR_1;", "}", "if (nfds >= 0) {", "VAR_1 = select(nfds + 1, &rfds, &wfds, &xfds, &VAR_3);", "if (VAR_1 != 0) {", "VAR_0 = 0;", "}", "}", "for (VAR_2 = 0; VAR_2 < w->num; VAR_2++) {", "poll_fds[VAR_2].fd = (DWORD) w->events[VAR_2];", "poll_fds[VAR_2].events = G_IO_IN;", "}", "qemu_mutex_unlock_iothread();", "VAR_1 = g_poll(poll_fds, w->num, VAR_0);", "qemu_mutex_lock_iothread();", "if (VAR_1 > 0) {", "for (VAR_2 = 0; VAR_2 < w->num; VAR_2++) {", "w->revents[VAR_2] = poll_fds[VAR_2].revents;", "}", "for (VAR_2 = 0; VAR_2 < w->num; VAR_2++) {", "if (w->revents[VAR_2] && w->func[VAR_2]) {", "w->func[VAR_2](w->opaque[VAR_2]);", "}", "}", "}", "return VAR_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 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 95 ], [ 97 ] ]
15,452
static int asf_write_header(AVFormatContext *s) { ASFContext *asf = s->priv_data; asf->packet_size = PACKET_SIZE; asf->nb_packets = 0; asf->last_indexed_pts = 0; asf->index_ptr = (ASFIndex*)av_malloc( sizeof(ASFIndex) * ASF_INDEX_BLOCK ); asf->nb_index_memory_alloc = ASF_INDEX_BLOCK; asf->nb_index_count = 0; asf->maximum_packet = 0; /* the data-chunk-size has to be 50, which is data_size - asf->data_offset * at the moment this function is done. It is needed to use asf as * streamable format. */ if (asf_write_header1(s, 0, 50) < 0) { //av_free(asf); return -1; } put_flush_packet(s->pb); asf->packet_nb_payloads = 0; asf->packet_timestamp_start = -1; asf->packet_timestamp_end = -1; init_put_byte(&asf->pb, asf->packet_buf, asf->packet_size, 1, NULL, NULL, NULL, NULL); return 0; }
false
FFmpeg
90901860c21468d6e9ae437c2bacb099c7bd3acf
static int asf_write_header(AVFormatContext *s) { ASFContext *asf = s->priv_data; asf->packet_size = PACKET_SIZE; asf->nb_packets = 0; asf->last_indexed_pts = 0; asf->index_ptr = (ASFIndex*)av_malloc( sizeof(ASFIndex) * ASF_INDEX_BLOCK ); asf->nb_index_memory_alloc = ASF_INDEX_BLOCK; asf->nb_index_count = 0; asf->maximum_packet = 0; if (asf_write_header1(s, 0, 50) < 0) { return -1; } put_flush_packet(s->pb); asf->packet_nb_payloads = 0; asf->packet_timestamp_start = -1; asf->packet_timestamp_end = -1; init_put_byte(&asf->pb, asf->packet_buf, asf->packet_size, 1, NULL, NULL, NULL, NULL); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVFormatContext *VAR_0) { ASFContext *asf = VAR_0->priv_data; asf->packet_size = PACKET_SIZE; asf->nb_packets = 0; asf->last_indexed_pts = 0; asf->index_ptr = (ASFIndex*)av_malloc( sizeof(ASFIndex) * ASF_INDEX_BLOCK ); asf->nb_index_memory_alloc = ASF_INDEX_BLOCK; asf->nb_index_count = 0; asf->maximum_packet = 0; if (asf_write_header1(VAR_0, 0, 50) < 0) { return -1; } put_flush_packet(VAR_0->pb); asf->packet_nb_payloads = 0; asf->packet_timestamp_start = -1; asf->packet_timestamp_end = -1; init_put_byte(&asf->pb, asf->packet_buf, asf->packet_size, 1, NULL, NULL, NULL, NULL); return 0; }
[ "static int FUNC_0(AVFormatContext *VAR_0)\n{", "ASFContext *asf = VAR_0->priv_data;", "asf->packet_size = PACKET_SIZE;", "asf->nb_packets = 0;", "asf->last_indexed_pts = 0;", "asf->index_ptr = (ASFIndex*)av_malloc( sizeof(ASFIndex) * ASF_INDEX_BLOCK );", "asf->nb_index_memory_alloc = ASF_INDEX_BLOCK;", "asf->nb_index_count = 0;", "asf->maximum_packet = 0;", "if (asf_write_header1(VAR_0, 0, 50) < 0) {", "return -1;", "}", "put_flush_packet(VAR_0->pb);", "asf->packet_nb_payloads = 0;", "asf->packet_timestamp_start = -1;", "asf->packet_timestamp_end = -1;", "init_put_byte(&asf->pb, asf->packet_buf, asf->packet_size, 1,\nNULL, NULL, NULL, NULL);", "return 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 ], [ 33 ], [ 37 ], [ 39 ], [ 43 ], [ 47 ], [ 49 ], [ 51 ], [ 53, 55 ], [ 59 ], [ 61 ] ]
15,453
static int do_syscall(CPUState *env, struct kqemu_cpu_state *kenv) { int selector; selector = (env->star >> 32) & 0xffff; #ifdef TARGET_X86_64 if (env->hflags & HF_LMA_MASK) { int code64; env->regs[R_ECX] = kenv->next_eip; env->regs[11] = env->eflags; code64 = env->hflags & HF_CS64_MASK; cpu_x86_set_cpl(env, 0); cpu_x86_load_seg_cache(env, R_CS, selector & 0xfffc, 0, 0xffffffff, DESC_G_MASK | DESC_P_MASK | DESC_S_MASK | DESC_CS_MASK | DESC_R_MASK | DESC_A_MASK | DESC_L_MASK); cpu_x86_load_seg_cache(env, R_SS, (selector + 8) & 0xfffc, 0, 0xffffffff, DESC_G_MASK | DESC_B_MASK | DESC_P_MASK | DESC_S_MASK | DESC_W_MASK | DESC_A_MASK); env->eflags &= ~env->fmask; if (code64) env->eip = env->lstar; else env->eip = env->cstar; } else #endif { env->regs[R_ECX] = (uint32_t)kenv->next_eip; cpu_x86_set_cpl(env, 0); cpu_x86_load_seg_cache(env, R_CS, selector & 0xfffc, 0, 0xffffffff, DESC_G_MASK | DESC_B_MASK | DESC_P_MASK | DESC_S_MASK | DESC_CS_MASK | DESC_R_MASK | DESC_A_MASK); cpu_x86_load_seg_cache(env, R_SS, (selector + 8) & 0xfffc, 0, 0xffffffff, DESC_G_MASK | DESC_B_MASK | DESC_P_MASK | DESC_S_MASK | DESC_W_MASK | DESC_A_MASK); env->eflags &= ~(IF_MASK | RF_MASK | VM_MASK); env->eip = (uint32_t)env->star; } return 2; }
false
qemu
4a1418e07bdcfaa3177739e04707ecaec75d89e1
static int do_syscall(CPUState *env, struct kqemu_cpu_state *kenv) { int selector; selector = (env->star >> 32) & 0xffff; #ifdef TARGET_X86_64 if (env->hflags & HF_LMA_MASK) { int code64; env->regs[R_ECX] = kenv->next_eip; env->regs[11] = env->eflags; code64 = env->hflags & HF_CS64_MASK; cpu_x86_set_cpl(env, 0); cpu_x86_load_seg_cache(env, R_CS, selector & 0xfffc, 0, 0xffffffff, DESC_G_MASK | DESC_P_MASK | DESC_S_MASK | DESC_CS_MASK | DESC_R_MASK | DESC_A_MASK | DESC_L_MASK); cpu_x86_load_seg_cache(env, R_SS, (selector + 8) & 0xfffc, 0, 0xffffffff, DESC_G_MASK | DESC_B_MASK | DESC_P_MASK | DESC_S_MASK | DESC_W_MASK | DESC_A_MASK); env->eflags &= ~env->fmask; if (code64) env->eip = env->lstar; else env->eip = env->cstar; } else #endif { env->regs[R_ECX] = (uint32_t)kenv->next_eip; cpu_x86_set_cpl(env, 0); cpu_x86_load_seg_cache(env, R_CS, selector & 0xfffc, 0, 0xffffffff, DESC_G_MASK | DESC_B_MASK | DESC_P_MASK | DESC_S_MASK | DESC_CS_MASK | DESC_R_MASK | DESC_A_MASK); cpu_x86_load_seg_cache(env, R_SS, (selector + 8) & 0xfffc, 0, 0xffffffff, DESC_G_MASK | DESC_B_MASK | DESC_P_MASK | DESC_S_MASK | DESC_W_MASK | DESC_A_MASK); env->eflags &= ~(IF_MASK | RF_MASK | VM_MASK); env->eip = (uint32_t)env->star; } return 2; }
{ "code": [], "line_no": [] }
static int FUNC_0(CPUState *VAR_0, struct kqemu_cpu_state *VAR_1) { int VAR_2; VAR_2 = (VAR_0->star >> 32) & 0xffff; #ifdef TARGET_X86_64 if (VAR_0->hflags & HF_LMA_MASK) { int code64; VAR_0->regs[R_ECX] = VAR_1->next_eip; VAR_0->regs[11] = VAR_0->eflags; code64 = VAR_0->hflags & HF_CS64_MASK; cpu_x86_set_cpl(VAR_0, 0); cpu_x86_load_seg_cache(VAR_0, R_CS, VAR_2 & 0xfffc, 0, 0xffffffff, DESC_G_MASK | DESC_P_MASK | DESC_S_MASK | DESC_CS_MASK | DESC_R_MASK | DESC_A_MASK | DESC_L_MASK); cpu_x86_load_seg_cache(VAR_0, R_SS, (VAR_2 + 8) & 0xfffc, 0, 0xffffffff, DESC_G_MASK | DESC_B_MASK | DESC_P_MASK | DESC_S_MASK | DESC_W_MASK | DESC_A_MASK); VAR_0->eflags &= ~VAR_0->fmask; if (code64) VAR_0->eip = VAR_0->lstar; else VAR_0->eip = VAR_0->cstar; } else #endif { VAR_0->regs[R_ECX] = (uint32_t)VAR_1->next_eip; cpu_x86_set_cpl(VAR_0, 0); cpu_x86_load_seg_cache(VAR_0, R_CS, VAR_2 & 0xfffc, 0, 0xffffffff, DESC_G_MASK | DESC_B_MASK | DESC_P_MASK | DESC_S_MASK | DESC_CS_MASK | DESC_R_MASK | DESC_A_MASK); cpu_x86_load_seg_cache(VAR_0, R_SS, (VAR_2 + 8) & 0xfffc, 0, 0xffffffff, DESC_G_MASK | DESC_B_MASK | DESC_P_MASK | DESC_S_MASK | DESC_W_MASK | DESC_A_MASK); VAR_0->eflags &= ~(IF_MASK | RF_MASK | VM_MASK); VAR_0->eip = (uint32_t)VAR_0->star; } return 2; }
[ "static int FUNC_0(CPUState *VAR_0,\nstruct kqemu_cpu_state *VAR_1)\n{", "int VAR_2;", "VAR_2 = (VAR_0->star >> 32) & 0xffff;", "#ifdef TARGET_X86_64\nif (VAR_0->hflags & HF_LMA_MASK) {", "int code64;", "VAR_0->regs[R_ECX] = VAR_1->next_eip;", "VAR_0->regs[11] = VAR_0->eflags;", "code64 = VAR_0->hflags & HF_CS64_MASK;", "cpu_x86_set_cpl(VAR_0, 0);", "cpu_x86_load_seg_cache(VAR_0, R_CS, VAR_2 & 0xfffc,\n0, 0xffffffff,\nDESC_G_MASK | DESC_P_MASK |\nDESC_S_MASK |\nDESC_CS_MASK | DESC_R_MASK | DESC_A_MASK | DESC_L_MASK);", "cpu_x86_load_seg_cache(VAR_0, R_SS, (VAR_2 + 8) & 0xfffc,\n0, 0xffffffff,\nDESC_G_MASK | DESC_B_MASK | DESC_P_MASK |\nDESC_S_MASK |\nDESC_W_MASK | DESC_A_MASK);", "VAR_0->eflags &= ~VAR_0->fmask;", "if (code64)\nVAR_0->eip = VAR_0->lstar;", "else\nVAR_0->eip = VAR_0->cstar;", "} else", "#endif\n{", "VAR_0->regs[R_ECX] = (uint32_t)VAR_1->next_eip;", "cpu_x86_set_cpl(VAR_0, 0);", "cpu_x86_load_seg_cache(VAR_0, R_CS, VAR_2 & 0xfffc,\n0, 0xffffffff,\nDESC_G_MASK | DESC_B_MASK | DESC_P_MASK |\nDESC_S_MASK |\nDESC_CS_MASK | DESC_R_MASK | DESC_A_MASK);", "cpu_x86_load_seg_cache(VAR_0, R_SS, (VAR_2 + 8) & 0xfffc,\n0, 0xffffffff,\nDESC_G_MASK | DESC_B_MASK | DESC_P_MASK |\nDESC_S_MASK |\nDESC_W_MASK | DESC_A_MASK);", "VAR_0->eflags &= ~(IF_MASK | RF_MASK | VM_MASK);", "VAR_0->eip = (uint32_t)VAR_0->star;", "}", "return 2;", "}" ]
[ 0, 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 ], [ 27 ], [ 31 ], [ 33, 35, 37, 39, 41 ], [ 43, 45, 47, 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 ] ]
15,454
gdb_handlesig(CPUState *cpu, int sig) { GDBState *s; char buf[256]; int n; s = gdbserver_state; if (gdbserver_fd < 0 || s->fd < 0) { return sig; } /* disable single step if it was enabled */ cpu_single_step(cpu, 0); tb_flush(cpu); if (sig != 0) { snprintf(buf, sizeof(buf), "S%02x", target_signal_to_gdb(sig)); put_packet(s, buf); } /* put_packet() might have detected that the peer terminated the connection. */ if (s->fd < 0) { return sig; } sig = 0; s->state = RS_IDLE; s->running_state = 0; while (s->running_state == 0) { n = read(s->fd, buf, 256); if (n > 0) { int i; for (i = 0; i < n; i++) { gdb_read_byte(s, buf[i]); } } else if (n == 0 || errno != EAGAIN) { /* XXX: Connection closed. Should probably wait for another connection before continuing. */ return sig; } } sig = s->signal; s->signal = 0; return sig; }
false
qemu
5819e3e072f41cbf81ad80d822a5c468a91f54e0
gdb_handlesig(CPUState *cpu, int sig) { GDBState *s; char buf[256]; int n; s = gdbserver_state; if (gdbserver_fd < 0 || s->fd < 0) { return sig; } cpu_single_step(cpu, 0); tb_flush(cpu); if (sig != 0) { snprintf(buf, sizeof(buf), "S%02x", target_signal_to_gdb(sig)); put_packet(s, buf); } if (s->fd < 0) { return sig; } sig = 0; s->state = RS_IDLE; s->running_state = 0; while (s->running_state == 0) { n = read(s->fd, buf, 256); if (n > 0) { int i; for (i = 0; i < n; i++) { gdb_read_byte(s, buf[i]); } } else if (n == 0 || errno != EAGAIN) { return sig; } } sig = s->signal; s->signal = 0; return sig; }
{ "code": [], "line_no": [] }
FUNC_0(CPUState *VAR_0, int VAR_1) { GDBState *s; char VAR_2[256]; int VAR_3; s = gdbserver_state; if (gdbserver_fd < 0 || s->fd < 0) { return VAR_1; } cpu_single_step(VAR_0, 0); tb_flush(VAR_0); if (VAR_1 != 0) { snprintf(VAR_2, sizeof(VAR_2), "S%02x", target_signal_to_gdb(VAR_1)); put_packet(s, VAR_2); } if (s->fd < 0) { return VAR_1; } VAR_1 = 0; s->state = RS_IDLE; s->running_state = 0; while (s->running_state == 0) { VAR_3 = read(s->fd, VAR_2, 256); if (VAR_3 > 0) { int VAR_4; for (VAR_4 = 0; VAR_4 < VAR_3; VAR_4++) { gdb_read_byte(s, VAR_2[VAR_4]); } } else if (VAR_3 == 0 || errno != EAGAIN) { return VAR_1; } } VAR_1 = s->signal; s->signal = 0; return VAR_1; }
[ "FUNC_0(CPUState *VAR_0, int VAR_1)\n{", "GDBState *s;", "char VAR_2[256];", "int VAR_3;", "s = gdbserver_state;", "if (gdbserver_fd < 0 || s->fd < 0) {", "return VAR_1;", "}", "cpu_single_step(VAR_0, 0);", "tb_flush(VAR_0);", "if (VAR_1 != 0) {", "snprintf(VAR_2, sizeof(VAR_2), \"S%02x\", target_signal_to_gdb(VAR_1));", "put_packet(s, VAR_2);", "}", "if (s->fd < 0) {", "return VAR_1;", "}", "VAR_1 = 0;", "s->state = RS_IDLE;", "s->running_state = 0;", "while (s->running_state == 0) {", "VAR_3 = read(s->fd, VAR_2, 256);", "if (VAR_3 > 0) {", "int VAR_4;", "for (VAR_4 = 0; VAR_4 < VAR_3; VAR_4++) {", "gdb_read_byte(s, VAR_2[VAR_4]);", "}", "} else if (VAR_3 == 0 || errno != EAGAIN) {", "return VAR_1;", "}", "}", "VAR_1 = s->signal;", "s->signal = 0;", "return VAR_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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ] ]
15,455
void xen_map_cache_init(void) { unsigned long size; struct rlimit rlimit_as; mapcache = g_malloc0(sizeof (MapCache)); QTAILQ_INIT(&mapcache->locked_entries); mapcache->last_address_index = -1; if (geteuid() == 0) { rlimit_as.rlim_cur = RLIM_INFINITY; rlimit_as.rlim_max = RLIM_INFINITY; mapcache->max_mcache_size = MCACHE_MAX_SIZE; } else { getrlimit(RLIMIT_AS, &rlimit_as); rlimit_as.rlim_cur = rlimit_as.rlim_max; if (rlimit_as.rlim_max != RLIM_INFINITY) { fprintf(stderr, "Warning: QEMU's maximum size of virtual" " memory is not infinity.\n"); } if (rlimit_as.rlim_max < MCACHE_MAX_SIZE + NON_MCACHE_MEMORY_SIZE) { mapcache->max_mcache_size = rlimit_as.rlim_max - NON_MCACHE_MEMORY_SIZE; } else { mapcache->max_mcache_size = MCACHE_MAX_SIZE; } } setrlimit(RLIMIT_AS, &rlimit_as); mapcache->nr_buckets = (((mapcache->max_mcache_size >> XC_PAGE_SHIFT) + (1UL << (MCACHE_BUCKET_SHIFT - XC_PAGE_SHIFT)) - 1) >> (MCACHE_BUCKET_SHIFT - XC_PAGE_SHIFT)); size = mapcache->nr_buckets * sizeof (MapCacheEntry); size = (size + XC_PAGE_SIZE - 1) & ~(XC_PAGE_SIZE - 1); DPRINTF("%s, nr_buckets = %lx size %lu\n", __func__, mapcache->nr_buckets, size); mapcache->entry = g_malloc0(size); }
false
qemu
cd1ba7de230b3a85fb4dba53bb681b7ea626b4eb
void xen_map_cache_init(void) { unsigned long size; struct rlimit rlimit_as; mapcache = g_malloc0(sizeof (MapCache)); QTAILQ_INIT(&mapcache->locked_entries); mapcache->last_address_index = -1; if (geteuid() == 0) { rlimit_as.rlim_cur = RLIM_INFINITY; rlimit_as.rlim_max = RLIM_INFINITY; mapcache->max_mcache_size = MCACHE_MAX_SIZE; } else { getrlimit(RLIMIT_AS, &rlimit_as); rlimit_as.rlim_cur = rlimit_as.rlim_max; if (rlimit_as.rlim_max != RLIM_INFINITY) { fprintf(stderr, "Warning: QEMU's maximum size of virtual" " memory is not infinity.\n"); } if (rlimit_as.rlim_max < MCACHE_MAX_SIZE + NON_MCACHE_MEMORY_SIZE) { mapcache->max_mcache_size = rlimit_as.rlim_max - NON_MCACHE_MEMORY_SIZE; } else { mapcache->max_mcache_size = MCACHE_MAX_SIZE; } } setrlimit(RLIMIT_AS, &rlimit_as); mapcache->nr_buckets = (((mapcache->max_mcache_size >> XC_PAGE_SHIFT) + (1UL << (MCACHE_BUCKET_SHIFT - XC_PAGE_SHIFT)) - 1) >> (MCACHE_BUCKET_SHIFT - XC_PAGE_SHIFT)); size = mapcache->nr_buckets * sizeof (MapCacheEntry); size = (size + XC_PAGE_SIZE - 1) & ~(XC_PAGE_SIZE - 1); DPRINTF("%s, nr_buckets = %lx size %lu\n", __func__, mapcache->nr_buckets, size); mapcache->entry = g_malloc0(size); }
{ "code": [], "line_no": [] }
void FUNC_0(void) { unsigned long VAR_0; struct rlimit VAR_1; mapcache = g_malloc0(sizeof (MapCache)); QTAILQ_INIT(&mapcache->locked_entries); mapcache->last_address_index = -1; if (geteuid() == 0) { VAR_1.rlim_cur = RLIM_INFINITY; VAR_1.rlim_max = RLIM_INFINITY; mapcache->max_mcache_size = MCACHE_MAX_SIZE; } else { getrlimit(RLIMIT_AS, &VAR_1); VAR_1.rlim_cur = VAR_1.rlim_max; if (VAR_1.rlim_max != RLIM_INFINITY) { fprintf(stderr, "Warning: QEMU's maximum VAR_0 of virtual" " memory is not infinity.\n"); } if (VAR_1.rlim_max < MCACHE_MAX_SIZE + NON_MCACHE_MEMORY_SIZE) { mapcache->max_mcache_size = VAR_1.rlim_max - NON_MCACHE_MEMORY_SIZE; } else { mapcache->max_mcache_size = MCACHE_MAX_SIZE; } } setrlimit(RLIMIT_AS, &VAR_1); mapcache->nr_buckets = (((mapcache->max_mcache_size >> XC_PAGE_SHIFT) + (1UL << (MCACHE_BUCKET_SHIFT - XC_PAGE_SHIFT)) - 1) >> (MCACHE_BUCKET_SHIFT - XC_PAGE_SHIFT)); VAR_0 = mapcache->nr_buckets * sizeof (MapCacheEntry); VAR_0 = (VAR_0 + XC_PAGE_SIZE - 1) & ~(XC_PAGE_SIZE - 1); DPRINTF("%s, nr_buckets = %lx VAR_0 %lu\n", __func__, mapcache->nr_buckets, VAR_0); mapcache->entry = g_malloc0(VAR_0); }
[ "void FUNC_0(void)\n{", "unsigned long VAR_0;", "struct rlimit VAR_1;", "mapcache = g_malloc0(sizeof (MapCache));", "QTAILQ_INIT(&mapcache->locked_entries);", "mapcache->last_address_index = -1;", "if (geteuid() == 0) {", "VAR_1.rlim_cur = RLIM_INFINITY;", "VAR_1.rlim_max = RLIM_INFINITY;", "mapcache->max_mcache_size = MCACHE_MAX_SIZE;", "} else {", "getrlimit(RLIMIT_AS, &VAR_1);", "VAR_1.rlim_cur = VAR_1.rlim_max;", "if (VAR_1.rlim_max != RLIM_INFINITY) {", "fprintf(stderr, \"Warning: QEMU's maximum VAR_0 of virtual\"\n\" memory is not infinity.\\n\");", "}", "if (VAR_1.rlim_max < MCACHE_MAX_SIZE + NON_MCACHE_MEMORY_SIZE) {", "mapcache->max_mcache_size = VAR_1.rlim_max -\nNON_MCACHE_MEMORY_SIZE;", "} else {", "mapcache->max_mcache_size = MCACHE_MAX_SIZE;", "}", "}", "setrlimit(RLIMIT_AS, &VAR_1);", "mapcache->nr_buckets =\n(((mapcache->max_mcache_size >> XC_PAGE_SHIFT) +\n(1UL << (MCACHE_BUCKET_SHIFT - XC_PAGE_SHIFT)) - 1) >>\n(MCACHE_BUCKET_SHIFT - XC_PAGE_SHIFT));", "VAR_0 = mapcache->nr_buckets * sizeof (MapCacheEntry);", "VAR_0 = (VAR_0 + XC_PAGE_SIZE - 1) & ~(XC_PAGE_SIZE - 1);", "DPRINTF(\"%s, nr_buckets = %lx VAR_0 %lu\\n\", __func__,\nmapcache->nr_buckets, VAR_0);", "mapcache->entry = g_malloc0(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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39, 41 ], [ 43 ], [ 45 ], [ 47, 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 65, 67, 69, 71 ], [ 75 ], [ 77 ], [ 79, 81 ], [ 83 ], [ 85 ] ]
15,456
static void nvdimm_build_nfit(AcpiNVDIMMState *state, GArray *table_offsets, GArray *table_data, BIOSLinker *linker) { NvdimmFitBuffer *fit_buf = &state->fit_buf; unsigned int header; /* NVDIMM device is not plugged? */ if (!fit_buf->fit->len) { return; } acpi_add_table(table_offsets, table_data); /* NFIT header. */ header = table_data->len; acpi_data_push(table_data, sizeof(NvdimmNfitHeader)); /* NVDIMM device structures. */ g_array_append_vals(table_data, fit_buf->fit->data, fit_buf->fit->len); build_header(linker, table_data, (void *)(table_data->data + header), "NFIT", sizeof(NvdimmNfitHeader) + fit_buf->fit->len, 1, NULL, NULL); }
false
qemu
264813cb9d0eea199d48c6ea917060683685d1e0
static void nvdimm_build_nfit(AcpiNVDIMMState *state, GArray *table_offsets, GArray *table_data, BIOSLinker *linker) { NvdimmFitBuffer *fit_buf = &state->fit_buf; unsigned int header; if (!fit_buf->fit->len) { return; } acpi_add_table(table_offsets, table_data); header = table_data->len; acpi_data_push(table_data, sizeof(NvdimmNfitHeader)); g_array_append_vals(table_data, fit_buf->fit->data, fit_buf->fit->len); build_header(linker, table_data, (void *)(table_data->data + header), "NFIT", sizeof(NvdimmNfitHeader) + fit_buf->fit->len, 1, NULL, NULL); }
{ "code": [], "line_no": [] }
static void FUNC_0(AcpiNVDIMMState *VAR_0, GArray *VAR_1, GArray *VAR_2, BIOSLinker *VAR_3) { NvdimmFitBuffer *fit_buf = &VAR_0->fit_buf; unsigned int VAR_4; if (!fit_buf->fit->len) { return; } acpi_add_table(VAR_1, VAR_2); VAR_4 = VAR_2->len; acpi_data_push(VAR_2, sizeof(NvdimmNfitHeader)); g_array_append_vals(VAR_2, fit_buf->fit->data, fit_buf->fit->len); build_header(VAR_3, VAR_2, (void *)(VAR_2->data + VAR_4), "NFIT", sizeof(NvdimmNfitHeader) + fit_buf->fit->len, 1, NULL, NULL); }
[ "static void FUNC_0(AcpiNVDIMMState *VAR_0, GArray *VAR_1,\nGArray *VAR_2, BIOSLinker *VAR_3)\n{", "NvdimmFitBuffer *fit_buf = &VAR_0->fit_buf;", "unsigned int VAR_4;", "if (!fit_buf->fit->len) {", "return;", "}", "acpi_add_table(VAR_1, VAR_2);", "VAR_4 = VAR_2->len;", "acpi_data_push(VAR_2, sizeof(NvdimmNfitHeader));", "g_array_append_vals(VAR_2, fit_buf->fit->data, fit_buf->fit->len);", "build_header(VAR_3, VAR_2,\n(void *)(VAR_2->data + VAR_4), \"NFIT\",\nsizeof(NvdimmNfitHeader) + fit_buf->fit->len, 1, NULL, NULL);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 31 ], [ 33 ], [ 37 ], [ 41, 43, 45 ], [ 47 ] ]
15,459
static inline uint32_t efsctui(uint32_t val) { CPU_FloatU u; u.l = val; /* NaN are not treated the same way IEEE 754 does */ if (unlikely(float32_is_nan(u.f))) return 0; return float32_to_uint32(u.f, &env->vec_status); }
false
qemu
185698715dfb18c82ad2a5dbc169908602d43e81
static inline uint32_t efsctui(uint32_t val) { CPU_FloatU u; u.l = val; if (unlikely(float32_is_nan(u.f))) return 0; return float32_to_uint32(u.f, &env->vec_status); }
{ "code": [], "line_no": [] }
static inline uint32_t FUNC_0(uint32_t val) { CPU_FloatU u; u.l = val; if (unlikely(float32_is_nan(u.f))) return 0; return float32_to_uint32(u.f, &env->vec_status); }
[ "static inline uint32_t FUNC_0(uint32_t val)\n{", "CPU_FloatU u;", "u.l = val;", "if (unlikely(float32_is_nan(u.f)))\nreturn 0;", "return float32_to_uint32(u.f, &env->vec_status);", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 13, 15 ], [ 19 ], [ 21 ] ]
15,460
BlockAIOCB *bdrv_aio_ioctl(BlockDriverState *bs, unsigned long int req, void *buf, BlockCompletionFunc *cb, void *opaque) { BlockDriver *drv = bs->drv; if (drv && drv->bdrv_aio_ioctl) return drv->bdrv_aio_ioctl(bs, req, buf, cb, opaque); return NULL; }
false
qemu
61007b316cd71ee7333ff7a0a749a8949527575f
BlockAIOCB *bdrv_aio_ioctl(BlockDriverState *bs, unsigned long int req, void *buf, BlockCompletionFunc *cb, void *opaque) { BlockDriver *drv = bs->drv; if (drv && drv->bdrv_aio_ioctl) return drv->bdrv_aio_ioctl(bs, req, buf, cb, opaque); return NULL; }
{ "code": [], "line_no": [] }
BlockAIOCB *FUNC_0(BlockDriverState *bs, unsigned long int req, void *buf, BlockCompletionFunc *cb, void *opaque) { BlockDriver *drv = bs->drv; if (drv && drv->FUNC_0) return drv->FUNC_0(bs, req, buf, cb, opaque); return NULL; }
[ "BlockAIOCB *FUNC_0(BlockDriverState *bs,\nunsigned long int req, void *buf,\nBlockCompletionFunc *cb, void *opaque)\n{", "BlockDriver *drv = bs->drv;", "if (drv && drv->FUNC_0)\nreturn drv->FUNC_0(bs, req, buf, cb, opaque);", "return NULL;", "}" ]
[ 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 13, 15 ], [ 17 ], [ 19 ] ]
15,461
static int lsi_scsi_init(PCIDevice *dev) { LSIState *s = DO_UPCAST(LSIState, dev, dev); uint8_t *pci_conf; pci_conf = s->dev.config; /* PCI Vendor ID (word) */ pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_LSI_LOGIC); /* PCI device ID (word) */ pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_LSI_53C895A); /* PCI base class code */ pci_config_set_class(pci_conf, PCI_CLASS_STORAGE_SCSI); /* PCI subsystem ID */ pci_conf[PCI_SUBSYSTEM_ID] = 0x00; pci_conf[PCI_SUBSYSTEM_ID + 1] = 0x10; /* PCI latency timer = 255 */ pci_conf[PCI_LATENCY_TIMER] = 0xff; /* TODO: RST# value should be 0 */ /* Interrupt pin 1 */ pci_conf[PCI_INTERRUPT_PIN] = 0x01; s->mmio_io_addr = cpu_register_io_memory(lsi_mmio_readfn, lsi_mmio_writefn, s, DEVICE_NATIVE_ENDIAN); s->ram_io_addr = cpu_register_io_memory(lsi_ram_readfn, lsi_ram_writefn, s, DEVICE_NATIVE_ENDIAN); pci_register_bar(&s->dev, 0, 256, PCI_BASE_ADDRESS_SPACE_IO, lsi_io_mapfunc); pci_register_bar_simple(&s->dev, 1, 0x400, 0, s->mmio_io_addr); pci_register_bar(&s->dev, 2, 0x2000, PCI_BASE_ADDRESS_SPACE_MEMORY, lsi_ram_mapfunc); QTAILQ_INIT(&s->queue); scsi_bus_new(&s->bus, &dev->qdev, 1, LSI_MAX_DEVS, lsi_command_complete); if (!dev->qdev.hotplugged) { return scsi_bus_legacy_handle_cmdline(&s->bus); } return 0; }
false
qemu
af5374aa044af8ebc5a7dd387ea0dec48b5d956b
static int lsi_scsi_init(PCIDevice *dev) { LSIState *s = DO_UPCAST(LSIState, dev, dev); uint8_t *pci_conf; pci_conf = s->dev.config; pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_LSI_LOGIC); pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_LSI_53C895A); pci_config_set_class(pci_conf, PCI_CLASS_STORAGE_SCSI); pci_conf[PCI_SUBSYSTEM_ID] = 0x00; pci_conf[PCI_SUBSYSTEM_ID + 1] = 0x10; pci_conf[PCI_LATENCY_TIMER] = 0xff; pci_conf[PCI_INTERRUPT_PIN] = 0x01; s->mmio_io_addr = cpu_register_io_memory(lsi_mmio_readfn, lsi_mmio_writefn, s, DEVICE_NATIVE_ENDIAN); s->ram_io_addr = cpu_register_io_memory(lsi_ram_readfn, lsi_ram_writefn, s, DEVICE_NATIVE_ENDIAN); pci_register_bar(&s->dev, 0, 256, PCI_BASE_ADDRESS_SPACE_IO, lsi_io_mapfunc); pci_register_bar_simple(&s->dev, 1, 0x400, 0, s->mmio_io_addr); pci_register_bar(&s->dev, 2, 0x2000, PCI_BASE_ADDRESS_SPACE_MEMORY, lsi_ram_mapfunc); QTAILQ_INIT(&s->queue); scsi_bus_new(&s->bus, &dev->qdev, 1, LSI_MAX_DEVS, lsi_command_complete); if (!dev->qdev.hotplugged) { return scsi_bus_legacy_handle_cmdline(&s->bus); } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(PCIDevice *VAR_0) { LSIState *s = DO_UPCAST(LSIState, VAR_0, VAR_0); uint8_t *pci_conf; pci_conf = s->VAR_0.config; pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_LSI_LOGIC); pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_LSI_53C895A); pci_config_set_class(pci_conf, PCI_CLASS_STORAGE_SCSI); pci_conf[PCI_SUBSYSTEM_ID] = 0x00; pci_conf[PCI_SUBSYSTEM_ID + 1] = 0x10; pci_conf[PCI_LATENCY_TIMER] = 0xff; pci_conf[PCI_INTERRUPT_PIN] = 0x01; s->mmio_io_addr = cpu_register_io_memory(lsi_mmio_readfn, lsi_mmio_writefn, s, DEVICE_NATIVE_ENDIAN); s->ram_io_addr = cpu_register_io_memory(lsi_ram_readfn, lsi_ram_writefn, s, DEVICE_NATIVE_ENDIAN); pci_register_bar(&s->VAR_0, 0, 256, PCI_BASE_ADDRESS_SPACE_IO, lsi_io_mapfunc); pci_register_bar_simple(&s->VAR_0, 1, 0x400, 0, s->mmio_io_addr); pci_register_bar(&s->VAR_0, 2, 0x2000, PCI_BASE_ADDRESS_SPACE_MEMORY, lsi_ram_mapfunc); QTAILQ_INIT(&s->queue); scsi_bus_new(&s->bus, &VAR_0->qdev, 1, LSI_MAX_DEVS, lsi_command_complete); if (!VAR_0->qdev.hotplugged) { return scsi_bus_legacy_handle_cmdline(&s->bus); } return 0; }
[ "static int FUNC_0(PCIDevice *VAR_0)\n{", "LSIState *s = DO_UPCAST(LSIState, VAR_0, VAR_0);", "uint8_t *pci_conf;", "pci_conf = s->VAR_0.config;", "pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_LSI_LOGIC);", "pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_LSI_53C895A);", "pci_config_set_class(pci_conf, PCI_CLASS_STORAGE_SCSI);", "pci_conf[PCI_SUBSYSTEM_ID] = 0x00;", "pci_conf[PCI_SUBSYSTEM_ID + 1] = 0x10;", "pci_conf[PCI_LATENCY_TIMER] = 0xff;", "pci_conf[PCI_INTERRUPT_PIN] = 0x01;", "s->mmio_io_addr = cpu_register_io_memory(lsi_mmio_readfn,\nlsi_mmio_writefn, s,\nDEVICE_NATIVE_ENDIAN);", "s->ram_io_addr = cpu_register_io_memory(lsi_ram_readfn,\nlsi_ram_writefn, s,\nDEVICE_NATIVE_ENDIAN);", "pci_register_bar(&s->VAR_0, 0, 256,\nPCI_BASE_ADDRESS_SPACE_IO, lsi_io_mapfunc);", "pci_register_bar_simple(&s->VAR_0, 1, 0x400, 0, s->mmio_io_addr);", "pci_register_bar(&s->VAR_0, 2, 0x2000,\nPCI_BASE_ADDRESS_SPACE_MEMORY, lsi_ram_mapfunc);", "QTAILQ_INIT(&s->queue);", "scsi_bus_new(&s->bus, &VAR_0->qdev, 1, LSI_MAX_DEVS, lsi_command_complete);", "if (!VAR_0->qdev.hotplugged) {", "return scsi_bus_legacy_handle_cmdline(&s->bus);", "}", "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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 17 ], [ 21 ], [ 25 ], [ 29 ], [ 31 ], [ 35 ], [ 41 ], [ 45, 47, 49 ], [ 51, 53, 55 ], [ 59, 61 ], [ 63 ], [ 65, 67 ], [ 69 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ] ]
15,462
void cpu_physical_memory_write_rom(hwaddr addr, const uint8_t *buf, int len) { hwaddr l; uint8_t *ptr; hwaddr addr1; MemoryRegion *mr; while (len > 0) { l = len; mr = address_space_translate(&address_space_memory, addr, &addr1, &l, true); if (!(memory_region_is_ram(mr) || memory_region_is_romd(mr))) { /* do nothing */ } else { addr1 += memory_region_get_ram_addr(mr); /* ROM/RAM case */ ptr = qemu_get_ram_ptr(addr1); memcpy(ptr, buf, l); invalidate_and_set_dirty(addr1, l); } len -= l; buf += l; addr += l; } }
false
qemu
582b55a96ac4f66cea64d82e47651bd5ef38a8ec
void cpu_physical_memory_write_rom(hwaddr addr, const uint8_t *buf, int len) { hwaddr l; uint8_t *ptr; hwaddr addr1; MemoryRegion *mr; while (len > 0) { l = len; mr = address_space_translate(&address_space_memory, addr, &addr1, &l, true); if (!(memory_region_is_ram(mr) || memory_region_is_romd(mr))) { } else { addr1 += memory_region_get_ram_addr(mr); ptr = qemu_get_ram_ptr(addr1); memcpy(ptr, buf, l); invalidate_and_set_dirty(addr1, l); } len -= l; buf += l; addr += l; } }
{ "code": [], "line_no": [] }
void FUNC_0(hwaddr VAR_0, const uint8_t *VAR_1, int VAR_2) { hwaddr l; uint8_t *ptr; hwaddr addr1; MemoryRegion *mr; while (VAR_2 > 0) { l = VAR_2; mr = address_space_translate(&address_space_memory, VAR_0, &addr1, &l, true); if (!(memory_region_is_ram(mr) || memory_region_is_romd(mr))) { } else { addr1 += memory_region_get_ram_addr(mr); ptr = qemu_get_ram_ptr(addr1); memcpy(ptr, VAR_1, l); invalidate_and_set_dirty(addr1, l); } VAR_2 -= l; VAR_1 += l; VAR_0 += l; } }
[ "void FUNC_0(hwaddr VAR_0,\nconst uint8_t *VAR_1, int VAR_2)\n{", "hwaddr l;", "uint8_t *ptr;", "hwaddr addr1;", "MemoryRegion *mr;", "while (VAR_2 > 0) {", "l = VAR_2;", "mr = address_space_translate(&address_space_memory,\nVAR_0, &addr1, &l, true);", "if (!(memory_region_is_ram(mr) ||\nmemory_region_is_romd(mr))) {", "} else {", "addr1 += memory_region_get_ram_addr(mr);", "ptr = qemu_get_ram_ptr(addr1);", "memcpy(ptr, VAR_1, l);", "invalidate_and_set_dirty(addr1, l);", "}", "VAR_2 -= l;", "VAR_1 += l;", "VAR_0 += l;", "}", "}" ]
[ 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 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ] ]
15,464
static int decode_cabac_mb_type( H264Context *h ) { MpegEncContext * const s = &h->s; if( h->slice_type == I_TYPE ) { return decode_cabac_intra_mb_type(h, 3, 1); } else if( h->slice_type == P_TYPE ) { if( get_cabac( &h->cabac, &h->cabac_state[14] ) == 0 ) { /* P-type */ if( get_cabac( &h->cabac, &h->cabac_state[15] ) == 0 ) { /* P_L0_D16x16, P_8x8 */ return 3 * get_cabac( &h->cabac, &h->cabac_state[16] ); } else { /* P_L0_D8x16, P_L0_D16x8 */ return 2 - get_cabac( &h->cabac, &h->cabac_state[17] ); } } else { return decode_cabac_intra_mb_type(h, 17, 0) + 5; } } else if( h->slice_type == B_TYPE ) { const int mba_xy = h->left_mb_xy[0]; const int mbb_xy = h->top_mb_xy; int ctx = 0; int bits; if( h->slice_table[mba_xy] == h->slice_num && !IS_DIRECT( s->current_picture.mb_type[mba_xy] ) ) ctx++; if( h->slice_table[mbb_xy] == h->slice_num && !IS_DIRECT( s->current_picture.mb_type[mbb_xy] ) ) ctx++; if( !get_cabac( &h->cabac, &h->cabac_state[27+ctx] ) ) return 0; /* B_Direct_16x16 */ if( !get_cabac( &h->cabac, &h->cabac_state[27+3] ) ) { return 1 + get_cabac( &h->cabac, &h->cabac_state[27+5] ); /* B_L[01]_16x16 */ } bits = get_cabac( &h->cabac, &h->cabac_state[27+4] ) << 3; bits|= get_cabac( &h->cabac, &h->cabac_state[27+5] ) << 2; bits|= get_cabac( &h->cabac, &h->cabac_state[27+5] ) << 1; bits|= get_cabac( &h->cabac, &h->cabac_state[27+5] ); if( bits < 8 ) return bits + 3; /* B_Bi_16x16 through B_L1_L0_16x8 */ else if( bits == 13 ) { return decode_cabac_intra_mb_type(h, 32, 0) + 23; } else if( bits == 14 ) return 11; /* B_L1_L0_8x16 */ else if( bits == 15 ) return 22; /* B_8x8 */ bits= ( bits<<1 ) | get_cabac( &h->cabac, &h->cabac_state[27+5] ); return bits - 4; /* B_L0_Bi_* through B_Bi_Bi_* */ } else { /* TODO SI/SP frames? */ return -1; } }
false
FFmpeg
851ded8918c977d8160c6617b69604f758cabf50
static int decode_cabac_mb_type( H264Context *h ) { MpegEncContext * const s = &h->s; if( h->slice_type == I_TYPE ) { return decode_cabac_intra_mb_type(h, 3, 1); } else if( h->slice_type == P_TYPE ) { if( get_cabac( &h->cabac, &h->cabac_state[14] ) == 0 ) { if( get_cabac( &h->cabac, &h->cabac_state[15] ) == 0 ) { return 3 * get_cabac( &h->cabac, &h->cabac_state[16] ); } else { return 2 - get_cabac( &h->cabac, &h->cabac_state[17] ); } } else { return decode_cabac_intra_mb_type(h, 17, 0) + 5; } } else if( h->slice_type == B_TYPE ) { const int mba_xy = h->left_mb_xy[0]; const int mbb_xy = h->top_mb_xy; int ctx = 0; int bits; if( h->slice_table[mba_xy] == h->slice_num && !IS_DIRECT( s->current_picture.mb_type[mba_xy] ) ) ctx++; if( h->slice_table[mbb_xy] == h->slice_num && !IS_DIRECT( s->current_picture.mb_type[mbb_xy] ) ) ctx++; if( !get_cabac( &h->cabac, &h->cabac_state[27+ctx] ) ) return 0; if( !get_cabac( &h->cabac, &h->cabac_state[27+3] ) ) { return 1 + get_cabac( &h->cabac, &h->cabac_state[27+5] ); } bits = get_cabac( &h->cabac, &h->cabac_state[27+4] ) << 3; bits|= get_cabac( &h->cabac, &h->cabac_state[27+5] ) << 2; bits|= get_cabac( &h->cabac, &h->cabac_state[27+5] ) << 1; bits|= get_cabac( &h->cabac, &h->cabac_state[27+5] ); if( bits < 8 ) return bits + 3; else if( bits == 13 ) { return decode_cabac_intra_mb_type(h, 32, 0) + 23; } else if( bits == 14 ) return 11; else if( bits == 15 ) return 22; bits= ( bits<<1 ) | get_cabac( &h->cabac, &h->cabac_state[27+5] ); return bits - 4; } else { return -1; } }
{ "code": [], "line_no": [] }
static int FUNC_0( H264Context *VAR_0 ) { MpegEncContext * const s = &VAR_0->s; if( VAR_0->slice_type == I_TYPE ) { return decode_cabac_intra_mb_type(VAR_0, 3, 1); } else if( VAR_0->slice_type == P_TYPE ) { if( get_cabac( &VAR_0->cabac, &VAR_0->cabac_state[14] ) == 0 ) { if( get_cabac( &VAR_0->cabac, &VAR_0->cabac_state[15] ) == 0 ) { return 3 * get_cabac( &VAR_0->cabac, &VAR_0->cabac_state[16] ); } else { return 2 - get_cabac( &VAR_0->cabac, &VAR_0->cabac_state[17] ); } } else { return decode_cabac_intra_mb_type(VAR_0, 17, 0) + 5; } } else if( VAR_0->slice_type == B_TYPE ) { const int VAR_1 = VAR_0->left_mb_xy[0]; const int VAR_2 = VAR_0->top_mb_xy; int VAR_3 = 0; int VAR_4; if( VAR_0->slice_table[VAR_1] == VAR_0->slice_num && !IS_DIRECT( s->current_picture.mb_type[VAR_1] ) ) VAR_3++; if( VAR_0->slice_table[VAR_2] == VAR_0->slice_num && !IS_DIRECT( s->current_picture.mb_type[VAR_2] ) ) VAR_3++; if( !get_cabac( &VAR_0->cabac, &VAR_0->cabac_state[27+VAR_3] ) ) return 0; if( !get_cabac( &VAR_0->cabac, &VAR_0->cabac_state[27+3] ) ) { return 1 + get_cabac( &VAR_0->cabac, &VAR_0->cabac_state[27+5] ); } VAR_4 = get_cabac( &VAR_0->cabac, &VAR_0->cabac_state[27+4] ) << 3; VAR_4|= get_cabac( &VAR_0->cabac, &VAR_0->cabac_state[27+5] ) << 2; VAR_4|= get_cabac( &VAR_0->cabac, &VAR_0->cabac_state[27+5] ) << 1; VAR_4|= get_cabac( &VAR_0->cabac, &VAR_0->cabac_state[27+5] ); if( VAR_4 < 8 ) return VAR_4 + 3; else if( VAR_4 == 13 ) { return decode_cabac_intra_mb_type(VAR_0, 32, 0) + 23; } else if( VAR_4 == 14 ) return 11; else if( VAR_4 == 15 ) return 22; VAR_4= ( VAR_4<<1 ) | get_cabac( &VAR_0->cabac, &VAR_0->cabac_state[27+5] ); return VAR_4 - 4; } else { return -1; } }
[ "static int FUNC_0( H264Context *VAR_0 ) {", "MpegEncContext * const s = &VAR_0->s;", "if( VAR_0->slice_type == I_TYPE ) {", "return decode_cabac_intra_mb_type(VAR_0, 3, 1);", "} else if( VAR_0->slice_type == P_TYPE ) {", "if( get_cabac( &VAR_0->cabac, &VAR_0->cabac_state[14] ) == 0 ) {", "if( get_cabac( &VAR_0->cabac, &VAR_0->cabac_state[15] ) == 0 ) {", "return 3 * get_cabac( &VAR_0->cabac, &VAR_0->cabac_state[16] );", "} else {", "return 2 - get_cabac( &VAR_0->cabac, &VAR_0->cabac_state[17] );", "}", "} else {", "return decode_cabac_intra_mb_type(VAR_0, 17, 0) + 5;", "}", "} else if( VAR_0->slice_type == B_TYPE ) {", "const int VAR_1 = VAR_0->left_mb_xy[0];", "const int VAR_2 = VAR_0->top_mb_xy;", "int VAR_3 = 0;", "int VAR_4;", "if( VAR_0->slice_table[VAR_1] == VAR_0->slice_num && !IS_DIRECT( s->current_picture.mb_type[VAR_1] ) )\nVAR_3++;", "if( VAR_0->slice_table[VAR_2] == VAR_0->slice_num && !IS_DIRECT( s->current_picture.mb_type[VAR_2] ) )\nVAR_3++;", "if( !get_cabac( &VAR_0->cabac, &VAR_0->cabac_state[27+VAR_3] ) )\nreturn 0;", "if( !get_cabac( &VAR_0->cabac, &VAR_0->cabac_state[27+3] ) ) {", "return 1 + get_cabac( &VAR_0->cabac, &VAR_0->cabac_state[27+5] );", "}", "VAR_4 = get_cabac( &VAR_0->cabac, &VAR_0->cabac_state[27+4] ) << 3;", "VAR_4|= get_cabac( &VAR_0->cabac, &VAR_0->cabac_state[27+5] ) << 2;", "VAR_4|= get_cabac( &VAR_0->cabac, &VAR_0->cabac_state[27+5] ) << 1;", "VAR_4|= get_cabac( &VAR_0->cabac, &VAR_0->cabac_state[27+5] );", "if( VAR_4 < 8 )\nreturn VAR_4 + 3;", "else if( VAR_4 == 13 ) {", "return decode_cabac_intra_mb_type(VAR_0, 32, 0) + 23;", "} else if( VAR_4 == 14 )", "return 11;", "else if( VAR_4 == 15 )\nreturn 22;", "VAR_4= ( VAR_4<<1 ) | get_cabac( &VAR_0->cabac, &VAR_0->cabac_state[27+5] );", "return VAR_4 - 4;", "} else {", "return -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 ]
[ [ 1 ], [ 3 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 49, 51 ], [ 53, 55 ], [ 59, 61 ], [ 65 ], [ 67 ], [ 69 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81, 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93, 95 ], [ 99 ], [ 101 ], [ 103 ], [ 107 ], [ 109 ], [ 111 ] ]
15,465
static int ehci_state_fetchentry(EHCIState *ehci, int async) { int again = 0; uint32_t entry = ehci_get_fetch_addr(ehci, async); if (entry < 0x1000) { DPRINTF("fetchentry: entry invalid (0x%08x)\n", entry); ehci_set_state(ehci, async, EST_ACTIVE); goto out; } /* section 4.8, only QH in async schedule */ if (async && (NLPTR_TYPE_GET(entry) != NLPTR_TYPE_QH)) { fprintf(stderr, "non queue head request in async schedule\n"); return -1; } switch (NLPTR_TYPE_GET(entry)) { case NLPTR_TYPE_QH: ehci_set_state(ehci, async, EST_FETCHQH); again = 1; break; case NLPTR_TYPE_ITD: ehci_set_state(ehci, async, EST_FETCHITD); again = 1; break; case NLPTR_TYPE_STITD: ehci_set_state(ehci, async, EST_FETCHSITD); again = 1; break; default: /* TODO: handle FSTN type */ fprintf(stderr, "FETCHENTRY: entry at %X is of type %d " "which is not supported yet\n", entry, NLPTR_TYPE_GET(entry)); return -1; } out: return again; }
false
qemu
2a5ff735dc1074171a0cbb1dc228d6d6e907f571
static int ehci_state_fetchentry(EHCIState *ehci, int async) { int again = 0; uint32_t entry = ehci_get_fetch_addr(ehci, async); if (entry < 0x1000) { DPRINTF("fetchentry: entry invalid (0x%08x)\n", entry); ehci_set_state(ehci, async, EST_ACTIVE); goto out; } if (async && (NLPTR_TYPE_GET(entry) != NLPTR_TYPE_QH)) { fprintf(stderr, "non queue head request in async schedule\n"); return -1; } switch (NLPTR_TYPE_GET(entry)) { case NLPTR_TYPE_QH: ehci_set_state(ehci, async, EST_FETCHQH); again = 1; break; case NLPTR_TYPE_ITD: ehci_set_state(ehci, async, EST_FETCHITD); again = 1; break; case NLPTR_TYPE_STITD: ehci_set_state(ehci, async, EST_FETCHSITD); again = 1; break; default: fprintf(stderr, "FETCHENTRY: entry at %X is of type %d " "which is not supported yet\n", entry, NLPTR_TYPE_GET(entry)); return -1; } out: return again; }
{ "code": [], "line_no": [] }
static int FUNC_0(EHCIState *VAR_0, int VAR_1) { int VAR_2 = 0; uint32_t entry = ehci_get_fetch_addr(VAR_0, VAR_1); if (entry < 0x1000) { DPRINTF("fetchentry: entry invalid (0x%08x)\n", entry); ehci_set_state(VAR_0, VAR_1, EST_ACTIVE); goto out; } if (VAR_1 && (NLPTR_TYPE_GET(entry) != NLPTR_TYPE_QH)) { fprintf(stderr, "non queue head request in VAR_1 schedule\n"); return -1; } switch (NLPTR_TYPE_GET(entry)) { case NLPTR_TYPE_QH: ehci_set_state(VAR_0, VAR_1, EST_FETCHQH); VAR_2 = 1; break; case NLPTR_TYPE_ITD: ehci_set_state(VAR_0, VAR_1, EST_FETCHITD); VAR_2 = 1; break; case NLPTR_TYPE_STITD: ehci_set_state(VAR_0, VAR_1, EST_FETCHSITD); VAR_2 = 1; break; default: fprintf(stderr, "FETCHENTRY: entry at %X is of type %d " "which is not supported yet\n", entry, NLPTR_TYPE_GET(entry)); return -1; } out: return VAR_2; }
[ "static int FUNC_0(EHCIState *VAR_0, int VAR_1)\n{", "int VAR_2 = 0;", "uint32_t entry = ehci_get_fetch_addr(VAR_0, VAR_1);", "if (entry < 0x1000) {", "DPRINTF(\"fetchentry: entry invalid (0x%08x)\\n\", entry);", "ehci_set_state(VAR_0, VAR_1, EST_ACTIVE);", "goto out;", "}", "if (VAR_1 && (NLPTR_TYPE_GET(entry) != NLPTR_TYPE_QH)) {", "fprintf(stderr, \"non queue head request in VAR_1 schedule\\n\");", "return -1;", "}", "switch (NLPTR_TYPE_GET(entry)) {", "case NLPTR_TYPE_QH:\nehci_set_state(VAR_0, VAR_1, EST_FETCHQH);", "VAR_2 = 1;", "break;", "case NLPTR_TYPE_ITD:\nehci_set_state(VAR_0, VAR_1, EST_FETCHITD);", "VAR_2 = 1;", "break;", "case NLPTR_TYPE_STITD:\nehci_set_state(VAR_0, VAR_1, EST_FETCHSITD);", "VAR_2 = 1;", "break;", "default:\nfprintf(stderr, \"FETCHENTRY: entry at %X is of type %d \"\n\"which is not supported yet\\n\", entry, NLPTR_TYPE_GET(entry));", "return -1;", "}", "out:\nreturn VAR_2;", "}" ]
[ 0, 0, 0, 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 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37, 39 ], [ 41 ], [ 43 ], [ 47, 49 ], [ 51 ], [ 53 ], [ 57, 59 ], [ 61 ], [ 63 ], [ 67, 71, 73 ], [ 75 ], [ 77 ], [ 81, 83 ], [ 85 ] ]
15,466
static int ssi_slave_init(DeviceState *dev, DeviceInfo *base_info) { SSISlaveInfo *info = container_of(base_info, SSISlaveInfo, qdev); SSISlave *s = SSI_SLAVE_FROM_QDEV(dev); SSIBus *bus; bus = FROM_QBUS(SSIBus, qdev_get_parent_bus(dev)); if (LIST_FIRST(&bus->qbus.children) != dev || LIST_NEXT(dev, sibling) != NULL) { hw_error("Too many devices on SSI bus"); } s->info = info; return info->init(s); }
false
qemu
72cf2d4f0e181d0d3a3122e04129c58a95da713e
static int ssi_slave_init(DeviceState *dev, DeviceInfo *base_info) { SSISlaveInfo *info = container_of(base_info, SSISlaveInfo, qdev); SSISlave *s = SSI_SLAVE_FROM_QDEV(dev); SSIBus *bus; bus = FROM_QBUS(SSIBus, qdev_get_parent_bus(dev)); if (LIST_FIRST(&bus->qbus.children) != dev || LIST_NEXT(dev, sibling) != NULL) { hw_error("Too many devices on SSI bus"); } s->info = info; return info->init(s); }
{ "code": [], "line_no": [] }
static int FUNC_0(DeviceState *VAR_0, DeviceInfo *VAR_1) { SSISlaveInfo *info = container_of(VAR_1, SSISlaveInfo, qdev); SSISlave *s = SSI_SLAVE_FROM_QDEV(VAR_0); SSIBus *bus; bus = FROM_QBUS(SSIBus, qdev_get_parent_bus(VAR_0)); if (LIST_FIRST(&bus->qbus.children) != VAR_0 || LIST_NEXT(VAR_0, sibling) != NULL) { hw_error("Too many devices on SSI bus"); } s->info = info; return info->init(s); }
[ "static int FUNC_0(DeviceState *VAR_0, DeviceInfo *VAR_1)\n{", "SSISlaveInfo *info = container_of(VAR_1, SSISlaveInfo, qdev);", "SSISlave *s = SSI_SLAVE_FROM_QDEV(VAR_0);", "SSIBus *bus;", "bus = FROM_QBUS(SSIBus, qdev_get_parent_bus(VAR_0));", "if (LIST_FIRST(&bus->qbus.children) != VAR_0\n|| LIST_NEXT(VAR_0, sibling) != NULL) {", "hw_error(\"Too many devices on SSI bus\");", "}", "s->info = info;", "return info->init(s);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15, 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ] ]
15,467
struct pxa2xx_state_s *pxa255_init(unsigned int sdram_size, DisplayState *ds) { struct pxa2xx_state_s *s; struct pxa2xx_ssp_s *ssp; int iomemtype, i; s = (struct pxa2xx_state_s *) qemu_mallocz(sizeof(struct pxa2xx_state_s)); s->env = cpu_init(); cpu_arm_set_model(s->env, "pxa255"); register_savevm("cpu", 0, 0, cpu_save, cpu_load, s->env); /* SDRAM & Internal Memory Storage */ cpu_register_physical_memory(PXA2XX_SDRAM_BASE, sdram_size, qemu_ram_alloc(sdram_size) | IO_MEM_RAM); cpu_register_physical_memory(PXA2XX_INTERNAL_BASE, PXA2XX_INTERNAL_SIZE, qemu_ram_alloc(PXA2XX_INTERNAL_SIZE) | IO_MEM_RAM); s->pic = pxa2xx_pic_init(0x40d00000, s->env); s->dma = pxa255_dma_init(0x40000000, s->pic[PXA2XX_PIC_DMA]); pxa25x_timer_init(0x40a00000, &s->pic[PXA2XX_PIC_OST_0]); s->gpio = pxa2xx_gpio_init(0x40e00000, s->env, s->pic, 85); s->mmc = pxa2xx_mmci_init(0x41100000, s->pic[PXA2XX_PIC_MMC], s->dma); for (i = 0; pxa255_serial[i].io_base; i ++) if (serial_hds[i]) serial_mm_init(pxa255_serial[i].io_base, 2, s->pic[pxa255_serial[i].irqn], serial_hds[i], 1); else break; if (serial_hds[i]) s->fir = pxa2xx_fir_init(0x40800000, s->pic[PXA2XX_PIC_ICP], s->dma, serial_hds[i]); if (ds) s->lcd = pxa2xx_lcdc_init(0x44000000, s->pic[PXA2XX_PIC_LCD], ds); s->cm_base = 0x41300000; s->cm_regs[CCCR >> 4] = 0x02000210; /* 416.0 MHz */ s->clkcfg = 0x00000009; /* Turbo mode active */ iomemtype = cpu_register_io_memory(0, pxa2xx_cm_readfn, pxa2xx_cm_writefn, s); cpu_register_physical_memory(s->cm_base, 0xfff, iomemtype); register_savevm("pxa2xx_cm", 0, 0, pxa2xx_cm_save, pxa2xx_cm_load, s); cpu_arm_set_cp_io(s->env, 14, pxa2xx_cp14_read, pxa2xx_cp14_write, s); s->mm_base = 0x48000000; s->mm_regs[MDMRS >> 2] = 0x00020002; s->mm_regs[MDREFR >> 2] = 0x03ca4000; s->mm_regs[MECR >> 2] = 0x00000001; /* Two PC Card sockets */ iomemtype = cpu_register_io_memory(0, pxa2xx_mm_readfn, pxa2xx_mm_writefn, s); cpu_register_physical_memory(s->mm_base, 0xfff, iomemtype); register_savevm("pxa2xx_mm", 0, 0, pxa2xx_mm_save, pxa2xx_mm_load, s); for (i = 0; pxa255_ssp[i].io_base; i ++); s->ssp = (struct pxa2xx_ssp_s **) qemu_mallocz(sizeof(struct pxa2xx_ssp_s *) * i); ssp = (struct pxa2xx_ssp_s *) qemu_mallocz(sizeof(struct pxa2xx_ssp_s) * i); for (i = 0; pxa255_ssp[i].io_base; i ++) { s->ssp[i] = &ssp[i]; ssp[i].base = pxa255_ssp[i].io_base; ssp[i].irq = s->pic[pxa255_ssp[i].irqn]; iomemtype = cpu_register_io_memory(0, pxa2xx_ssp_readfn, pxa2xx_ssp_writefn, &ssp[i]); cpu_register_physical_memory(ssp[i].base, 0xfff, iomemtype); register_savevm("pxa2xx_ssp", i, 0, pxa2xx_ssp_save, pxa2xx_ssp_load, s); } if (usb_enabled) { usb_ohci_init_pxa(0x4c000000, 3, -1, s->pic[PXA2XX_PIC_USBH1]); } s->pcmcia[0] = pxa2xx_pcmcia_init(0x20000000); s->pcmcia[1] = pxa2xx_pcmcia_init(0x30000000); s->rtc_base = 0x40900000; iomemtype = cpu_register_io_memory(0, pxa2xx_rtc_readfn, pxa2xx_rtc_writefn, s); cpu_register_physical_memory(s->rtc_base, 0xfff, iomemtype); pxa2xx_rtc_init(s); register_savevm("pxa2xx_rtc", 0, 0, pxa2xx_rtc_save, pxa2xx_rtc_load, s); /* Note that PM registers are in the same page with PWRI2C registers. * As a workaround we don't map PWRI2C into memory and we expect * PM handlers to call PWRI2C handlers when appropriate. */ s->i2c[0] = pxa2xx_i2c_init(0x40301600, s->pic[PXA2XX_PIC_I2C], 1); s->i2c[1] = pxa2xx_i2c_init(0x40f00100, s->pic[PXA2XX_PIC_PWRI2C], 0); s->pm_base = 0x40f00000; iomemtype = cpu_register_io_memory(0, pxa2xx_pm_readfn, pxa2xx_pm_writefn, s); cpu_register_physical_memory(s->pm_base, 0xfff, iomemtype); register_savevm("pxa2xx_pm", 0, 0, pxa2xx_pm_save, pxa2xx_pm_load, s); s->i2s = pxa2xx_i2s_init(0x40400000, s->pic[PXA2XX_PIC_I2S], s->dma); /* GPIO1 resets the processor */ /* The handler can be overriden by board-specific code */ pxa2xx_gpio_handler_set(s->gpio, 1, pxa2xx_reset, s); return s; }
false
qemu
2a1639291bf9f3c88c62d10459fedaa677536ff5
struct pxa2xx_state_s *pxa255_init(unsigned int sdram_size, DisplayState *ds) { struct pxa2xx_state_s *s; struct pxa2xx_ssp_s *ssp; int iomemtype, i; s = (struct pxa2xx_state_s *) qemu_mallocz(sizeof(struct pxa2xx_state_s)); s->env = cpu_init(); cpu_arm_set_model(s->env, "pxa255"); register_savevm("cpu", 0, 0, cpu_save, cpu_load, s->env); cpu_register_physical_memory(PXA2XX_SDRAM_BASE, sdram_size, qemu_ram_alloc(sdram_size) | IO_MEM_RAM); cpu_register_physical_memory(PXA2XX_INTERNAL_BASE, PXA2XX_INTERNAL_SIZE, qemu_ram_alloc(PXA2XX_INTERNAL_SIZE) | IO_MEM_RAM); s->pic = pxa2xx_pic_init(0x40d00000, s->env); s->dma = pxa255_dma_init(0x40000000, s->pic[PXA2XX_PIC_DMA]); pxa25x_timer_init(0x40a00000, &s->pic[PXA2XX_PIC_OST_0]); s->gpio = pxa2xx_gpio_init(0x40e00000, s->env, s->pic, 85); s->mmc = pxa2xx_mmci_init(0x41100000, s->pic[PXA2XX_PIC_MMC], s->dma); for (i = 0; pxa255_serial[i].io_base; i ++) if (serial_hds[i]) serial_mm_init(pxa255_serial[i].io_base, 2, s->pic[pxa255_serial[i].irqn], serial_hds[i], 1); else break; if (serial_hds[i]) s->fir = pxa2xx_fir_init(0x40800000, s->pic[PXA2XX_PIC_ICP], s->dma, serial_hds[i]); if (ds) s->lcd = pxa2xx_lcdc_init(0x44000000, s->pic[PXA2XX_PIC_LCD], ds); s->cm_base = 0x41300000; s->cm_regs[CCCR >> 4] = 0x02000210; s->clkcfg = 0x00000009; iomemtype = cpu_register_io_memory(0, pxa2xx_cm_readfn, pxa2xx_cm_writefn, s); cpu_register_physical_memory(s->cm_base, 0xfff, iomemtype); register_savevm("pxa2xx_cm", 0, 0, pxa2xx_cm_save, pxa2xx_cm_load, s); cpu_arm_set_cp_io(s->env, 14, pxa2xx_cp14_read, pxa2xx_cp14_write, s); s->mm_base = 0x48000000; s->mm_regs[MDMRS >> 2] = 0x00020002; s->mm_regs[MDREFR >> 2] = 0x03ca4000; s->mm_regs[MECR >> 2] = 0x00000001; iomemtype = cpu_register_io_memory(0, pxa2xx_mm_readfn, pxa2xx_mm_writefn, s); cpu_register_physical_memory(s->mm_base, 0xfff, iomemtype); register_savevm("pxa2xx_mm", 0, 0, pxa2xx_mm_save, pxa2xx_mm_load, s); for (i = 0; pxa255_ssp[i].io_base; i ++); s->ssp = (struct pxa2xx_ssp_s **) qemu_mallocz(sizeof(struct pxa2xx_ssp_s *) * i); ssp = (struct pxa2xx_ssp_s *) qemu_mallocz(sizeof(struct pxa2xx_ssp_s) * i); for (i = 0; pxa255_ssp[i].io_base; i ++) { s->ssp[i] = &ssp[i]; ssp[i].base = pxa255_ssp[i].io_base; ssp[i].irq = s->pic[pxa255_ssp[i].irqn]; iomemtype = cpu_register_io_memory(0, pxa2xx_ssp_readfn, pxa2xx_ssp_writefn, &ssp[i]); cpu_register_physical_memory(ssp[i].base, 0xfff, iomemtype); register_savevm("pxa2xx_ssp", i, 0, pxa2xx_ssp_save, pxa2xx_ssp_load, s); } if (usb_enabled) { usb_ohci_init_pxa(0x4c000000, 3, -1, s->pic[PXA2XX_PIC_USBH1]); } s->pcmcia[0] = pxa2xx_pcmcia_init(0x20000000); s->pcmcia[1] = pxa2xx_pcmcia_init(0x30000000); s->rtc_base = 0x40900000; iomemtype = cpu_register_io_memory(0, pxa2xx_rtc_readfn, pxa2xx_rtc_writefn, s); cpu_register_physical_memory(s->rtc_base, 0xfff, iomemtype); pxa2xx_rtc_init(s); register_savevm("pxa2xx_rtc", 0, 0, pxa2xx_rtc_save, pxa2xx_rtc_load, s); s->i2c[0] = pxa2xx_i2c_init(0x40301600, s->pic[PXA2XX_PIC_I2C], 1); s->i2c[1] = pxa2xx_i2c_init(0x40f00100, s->pic[PXA2XX_PIC_PWRI2C], 0); s->pm_base = 0x40f00000; iomemtype = cpu_register_io_memory(0, pxa2xx_pm_readfn, pxa2xx_pm_writefn, s); cpu_register_physical_memory(s->pm_base, 0xfff, iomemtype); register_savevm("pxa2xx_pm", 0, 0, pxa2xx_pm_save, pxa2xx_pm_load, s); s->i2s = pxa2xx_i2s_init(0x40400000, s->pic[PXA2XX_PIC_I2S], s->dma); pxa2xx_gpio_handler_set(s->gpio, 1, pxa2xx_reset, s); return s; }
{ "code": [], "line_no": [] }
struct pxa2xx_state_s *FUNC_0(unsigned int VAR_0, DisplayState *VAR_1) { struct pxa2xx_state_s *VAR_2; struct pxa2xx_ssp_s *VAR_3; int VAR_4, VAR_5; VAR_2 = (struct pxa2xx_state_s *) qemu_mallocz(sizeof(struct pxa2xx_state_s)); VAR_2->env = cpu_init(); cpu_arm_set_model(VAR_2->env, "pxa255"); register_savevm("cpu", 0, 0, cpu_save, cpu_load, VAR_2->env); cpu_register_physical_memory(PXA2XX_SDRAM_BASE, VAR_0, qemu_ram_alloc(VAR_0) | IO_MEM_RAM); cpu_register_physical_memory(PXA2XX_INTERNAL_BASE, PXA2XX_INTERNAL_SIZE, qemu_ram_alloc(PXA2XX_INTERNAL_SIZE) | IO_MEM_RAM); VAR_2->pic = pxa2xx_pic_init(0x40d00000, VAR_2->env); VAR_2->dma = pxa255_dma_init(0x40000000, VAR_2->pic[PXA2XX_PIC_DMA]); pxa25x_timer_init(0x40a00000, &VAR_2->pic[PXA2XX_PIC_OST_0]); VAR_2->gpio = pxa2xx_gpio_init(0x40e00000, VAR_2->env, VAR_2->pic, 85); VAR_2->mmc = pxa2xx_mmci_init(0x41100000, VAR_2->pic[PXA2XX_PIC_MMC], VAR_2->dma); for (VAR_5 = 0; pxa255_serial[VAR_5].io_base; VAR_5 ++) if (serial_hds[VAR_5]) serial_mm_init(pxa255_serial[VAR_5].io_base, 2, VAR_2->pic[pxa255_serial[VAR_5].irqn], serial_hds[VAR_5], 1); else break; if (serial_hds[VAR_5]) VAR_2->fir = pxa2xx_fir_init(0x40800000, VAR_2->pic[PXA2XX_PIC_ICP], VAR_2->dma, serial_hds[VAR_5]); if (VAR_1) VAR_2->lcd = pxa2xx_lcdc_init(0x44000000, VAR_2->pic[PXA2XX_PIC_LCD], VAR_1); VAR_2->cm_base = 0x41300000; VAR_2->cm_regs[CCCR >> 4] = 0x02000210; VAR_2->clkcfg = 0x00000009; VAR_4 = cpu_register_io_memory(0, pxa2xx_cm_readfn, pxa2xx_cm_writefn, VAR_2); cpu_register_physical_memory(VAR_2->cm_base, 0xfff, VAR_4); register_savevm("pxa2xx_cm", 0, 0, pxa2xx_cm_save, pxa2xx_cm_load, VAR_2); cpu_arm_set_cp_io(VAR_2->env, 14, pxa2xx_cp14_read, pxa2xx_cp14_write, VAR_2); VAR_2->mm_base = 0x48000000; VAR_2->mm_regs[MDMRS >> 2] = 0x00020002; VAR_2->mm_regs[MDREFR >> 2] = 0x03ca4000; VAR_2->mm_regs[MECR >> 2] = 0x00000001; VAR_4 = cpu_register_io_memory(0, pxa2xx_mm_readfn, pxa2xx_mm_writefn, VAR_2); cpu_register_physical_memory(VAR_2->mm_base, 0xfff, VAR_4); register_savevm("pxa2xx_mm", 0, 0, pxa2xx_mm_save, pxa2xx_mm_load, VAR_2); for (VAR_5 = 0; pxa255_ssp[VAR_5].io_base; VAR_5 ++); VAR_2->VAR_3 = (struct pxa2xx_ssp_s **) qemu_mallocz(sizeof(struct pxa2xx_ssp_s *) * VAR_5); VAR_3 = (struct pxa2xx_ssp_s *) qemu_mallocz(sizeof(struct pxa2xx_ssp_s) * VAR_5); for (VAR_5 = 0; pxa255_ssp[VAR_5].io_base; VAR_5 ++) { VAR_2->VAR_3[VAR_5] = &VAR_3[VAR_5]; VAR_3[VAR_5].base = pxa255_ssp[VAR_5].io_base; VAR_3[VAR_5].irq = VAR_2->pic[pxa255_ssp[VAR_5].irqn]; VAR_4 = cpu_register_io_memory(0, pxa2xx_ssp_readfn, pxa2xx_ssp_writefn, &VAR_3[VAR_5]); cpu_register_physical_memory(VAR_3[VAR_5].base, 0xfff, VAR_4); register_savevm("pxa2xx_ssp", VAR_5, 0, pxa2xx_ssp_save, pxa2xx_ssp_load, VAR_2); } if (usb_enabled) { usb_ohci_init_pxa(0x4c000000, 3, -1, VAR_2->pic[PXA2XX_PIC_USBH1]); } VAR_2->pcmcia[0] = pxa2xx_pcmcia_init(0x20000000); VAR_2->pcmcia[1] = pxa2xx_pcmcia_init(0x30000000); VAR_2->rtc_base = 0x40900000; VAR_4 = cpu_register_io_memory(0, pxa2xx_rtc_readfn, pxa2xx_rtc_writefn, VAR_2); cpu_register_physical_memory(VAR_2->rtc_base, 0xfff, VAR_4); pxa2xx_rtc_init(VAR_2); register_savevm("pxa2xx_rtc", 0, 0, pxa2xx_rtc_save, pxa2xx_rtc_load, VAR_2); VAR_2->i2c[0] = pxa2xx_i2c_init(0x40301600, VAR_2->pic[PXA2XX_PIC_I2C], 1); VAR_2->i2c[1] = pxa2xx_i2c_init(0x40f00100, VAR_2->pic[PXA2XX_PIC_PWRI2C], 0); VAR_2->pm_base = 0x40f00000; VAR_4 = cpu_register_io_memory(0, pxa2xx_pm_readfn, pxa2xx_pm_writefn, VAR_2); cpu_register_physical_memory(VAR_2->pm_base, 0xfff, VAR_4); register_savevm("pxa2xx_pm", 0, 0, pxa2xx_pm_save, pxa2xx_pm_load, VAR_2); VAR_2->i2s = pxa2xx_i2s_init(0x40400000, VAR_2->pic[PXA2XX_PIC_I2S], VAR_2->dma); pxa2xx_gpio_handler_set(VAR_2->gpio, 1, pxa2xx_reset, VAR_2); return VAR_2; }
[ "struct pxa2xx_state_s *FUNC_0(unsigned int VAR_0,\nDisplayState *VAR_1)\n{", "struct pxa2xx_state_s *VAR_2;", "struct pxa2xx_ssp_s *VAR_3;", "int VAR_4, VAR_5;", "VAR_2 = (struct pxa2xx_state_s *) qemu_mallocz(sizeof(struct pxa2xx_state_s));", "VAR_2->env = cpu_init();", "cpu_arm_set_model(VAR_2->env, \"pxa255\");", "register_savevm(\"cpu\", 0, 0, cpu_save, cpu_load, VAR_2->env);", "cpu_register_physical_memory(PXA2XX_SDRAM_BASE, VAR_0,\nqemu_ram_alloc(VAR_0) | IO_MEM_RAM);", "cpu_register_physical_memory(PXA2XX_INTERNAL_BASE, PXA2XX_INTERNAL_SIZE,\nqemu_ram_alloc(PXA2XX_INTERNAL_SIZE) | IO_MEM_RAM);", "VAR_2->pic = pxa2xx_pic_init(0x40d00000, VAR_2->env);", "VAR_2->dma = pxa255_dma_init(0x40000000, VAR_2->pic[PXA2XX_PIC_DMA]);", "pxa25x_timer_init(0x40a00000, &VAR_2->pic[PXA2XX_PIC_OST_0]);", "VAR_2->gpio = pxa2xx_gpio_init(0x40e00000, VAR_2->env, VAR_2->pic, 85);", "VAR_2->mmc = pxa2xx_mmci_init(0x41100000, VAR_2->pic[PXA2XX_PIC_MMC], VAR_2->dma);", "for (VAR_5 = 0; pxa255_serial[VAR_5].io_base; VAR_5 ++)", "if (serial_hds[VAR_5])\nserial_mm_init(pxa255_serial[VAR_5].io_base, 2,\nVAR_2->pic[pxa255_serial[VAR_5].irqn], serial_hds[VAR_5], 1);", "else\nbreak;", "if (serial_hds[VAR_5])\nVAR_2->fir = pxa2xx_fir_init(0x40800000, VAR_2->pic[PXA2XX_PIC_ICP],\nVAR_2->dma, serial_hds[VAR_5]);", "if (VAR_1)\nVAR_2->lcd = pxa2xx_lcdc_init(0x44000000, VAR_2->pic[PXA2XX_PIC_LCD], VAR_1);", "VAR_2->cm_base = 0x41300000;", "VAR_2->cm_regs[CCCR >> 4] = 0x02000210;", "VAR_2->clkcfg = 0x00000009;", "VAR_4 = cpu_register_io_memory(0, pxa2xx_cm_readfn,\npxa2xx_cm_writefn, VAR_2);", "cpu_register_physical_memory(VAR_2->cm_base, 0xfff, VAR_4);", "register_savevm(\"pxa2xx_cm\", 0, 0, pxa2xx_cm_save, pxa2xx_cm_load, VAR_2);", "cpu_arm_set_cp_io(VAR_2->env, 14, pxa2xx_cp14_read, pxa2xx_cp14_write, VAR_2);", "VAR_2->mm_base = 0x48000000;", "VAR_2->mm_regs[MDMRS >> 2] = 0x00020002;", "VAR_2->mm_regs[MDREFR >> 2] = 0x03ca4000;", "VAR_2->mm_regs[MECR >> 2] = 0x00000001;", "VAR_4 = cpu_register_io_memory(0, pxa2xx_mm_readfn,\npxa2xx_mm_writefn, VAR_2);", "cpu_register_physical_memory(VAR_2->mm_base, 0xfff, VAR_4);", "register_savevm(\"pxa2xx_mm\", 0, 0, pxa2xx_mm_save, pxa2xx_mm_load, VAR_2);", "for (VAR_5 = 0; pxa255_ssp[VAR_5].io_base; VAR_5 ++);", "VAR_2->VAR_3 = (struct pxa2xx_ssp_s **)\nqemu_mallocz(sizeof(struct pxa2xx_ssp_s *) * VAR_5);", "VAR_3 = (struct pxa2xx_ssp_s *)\nqemu_mallocz(sizeof(struct pxa2xx_ssp_s) * VAR_5);", "for (VAR_5 = 0; pxa255_ssp[VAR_5].io_base; VAR_5 ++) {", "VAR_2->VAR_3[VAR_5] = &VAR_3[VAR_5];", "VAR_3[VAR_5].base = pxa255_ssp[VAR_5].io_base;", "VAR_3[VAR_5].irq = VAR_2->pic[pxa255_ssp[VAR_5].irqn];", "VAR_4 = cpu_register_io_memory(0, pxa2xx_ssp_readfn,\npxa2xx_ssp_writefn, &VAR_3[VAR_5]);", "cpu_register_physical_memory(VAR_3[VAR_5].base, 0xfff, VAR_4);", "register_savevm(\"pxa2xx_ssp\", VAR_5, 0,\npxa2xx_ssp_save, pxa2xx_ssp_load, VAR_2);", "}", "if (usb_enabled) {", "usb_ohci_init_pxa(0x4c000000, 3, -1, VAR_2->pic[PXA2XX_PIC_USBH1]);", "}", "VAR_2->pcmcia[0] = pxa2xx_pcmcia_init(0x20000000);", "VAR_2->pcmcia[1] = pxa2xx_pcmcia_init(0x30000000);", "VAR_2->rtc_base = 0x40900000;", "VAR_4 = cpu_register_io_memory(0, pxa2xx_rtc_readfn,\npxa2xx_rtc_writefn, VAR_2);", "cpu_register_physical_memory(VAR_2->rtc_base, 0xfff, VAR_4);", "pxa2xx_rtc_init(VAR_2);", "register_savevm(\"pxa2xx_rtc\", 0, 0, pxa2xx_rtc_save, pxa2xx_rtc_load, VAR_2);", "VAR_2->i2c[0] = pxa2xx_i2c_init(0x40301600, VAR_2->pic[PXA2XX_PIC_I2C], 1);", "VAR_2->i2c[1] = pxa2xx_i2c_init(0x40f00100, VAR_2->pic[PXA2XX_PIC_PWRI2C], 0);", "VAR_2->pm_base = 0x40f00000;", "VAR_4 = cpu_register_io_memory(0, pxa2xx_pm_readfn,\npxa2xx_pm_writefn, VAR_2);", "cpu_register_physical_memory(VAR_2->pm_base, 0xfff, VAR_4);", "register_savevm(\"pxa2xx_pm\", 0, 0, pxa2xx_pm_save, pxa2xx_pm_load, VAR_2);", "VAR_2->i2s = pxa2xx_i2s_init(0x40400000, VAR_2->pic[PXA2XX_PIC_I2S], VAR_2->dma);", "pxa2xx_gpio_handler_set(VAR_2->gpio, 1, pxa2xx_reset, VAR_2);", "return VAR_2;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 27, 29 ], [ 31, 33 ], [ 37 ], [ 41 ], [ 45 ], [ 49 ], [ 53 ], [ 57 ], [ 59, 61, 63 ], [ 65, 67 ], [ 69, 71, 73 ], [ 77, 79 ], [ 83 ], [ 85 ], [ 87 ], [ 89, 91 ], [ 93 ], [ 95 ], [ 99 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111, 113 ], [ 115 ], [ 117 ], [ 121 ], [ 123, 125 ], [ 127, 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 141, 143 ], [ 145 ], [ 147, 149 ], [ 151 ], [ 155 ], [ 157 ], [ 159 ], [ 163 ], [ 165 ], [ 169 ], [ 171, 173 ], [ 175 ], [ 177 ], [ 179 ], [ 189 ], [ 191 ], [ 195 ], [ 197, 199 ], [ 201 ], [ 203 ], [ 207 ], [ 215 ], [ 217 ], [ 219 ] ]
15,468
void stq_le_phys(target_phys_addr_t addr, uint64_t val) { val = cpu_to_le64(val); cpu_physical_memory_write(addr, &val, 8); }
false
qemu
a8170e5e97ad17ca169c64ba87ae2f53850dab4c
void stq_le_phys(target_phys_addr_t addr, uint64_t val) { val = cpu_to_le64(val); cpu_physical_memory_write(addr, &val, 8); }
{ "code": [], "line_no": [] }
void FUNC_0(target_phys_addr_t VAR_0, uint64_t VAR_1) { VAR_1 = cpu_to_le64(VAR_1); cpu_physical_memory_write(VAR_0, &VAR_1, 8); }
[ "void FUNC_0(target_phys_addr_t VAR_0, uint64_t VAR_1)\n{", "VAR_1 = cpu_to_le64(VAR_1);", "cpu_physical_memory_write(VAR_0, &VAR_1, 8);", "}" ]
[ 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ] ]
15,469
static int arm946_prbs_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value) { if (ri->crm >= 8) { return EXCP_UDEF; } env->cp15.c6_region[ri->crm] = value; return 0; }
false
qemu
e508a92b621c7160122e99d3754e568f2b8e255e
static int arm946_prbs_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value) { if (ri->crm >= 8) { return EXCP_UDEF; } env->cp15.c6_region[ri->crm] = value; return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(CPUARMState *VAR_0, const ARMCPRegInfo *VAR_1, uint64_t VAR_2) { if (VAR_1->crm >= 8) { return EXCP_UDEF; } VAR_0->cp15.c6_region[VAR_1->crm] = VAR_2; return 0; }
[ "static int FUNC_0(CPUARMState *VAR_0, const ARMCPRegInfo *VAR_1,\nuint64_t VAR_2)\n{", "if (VAR_1->crm >= 8) {", "return EXCP_UDEF;", "}", "VAR_0->cp15.c6_region[VAR_1->crm] = VAR_2;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ] ]
15,470
static int64_t get_clock(void) { #if defined(__linux__) || (defined(__FreeBSD__) && __FreeBSD_version >= 500000) \ || defined(__DragonFly__) if (use_rt_clock) { struct timespec ts; clock_gettime(CLOCK_MONOTONIC, &ts); return ts.tv_sec * 1000000000LL + ts.tv_nsec; } else #endif { /* XXX: using gettimeofday leads to problems if the date changes, so it should be avoided. */ struct timeval tv; gettimeofday(&tv, NULL); return tv.tv_sec * 1000000000LL + (tv.tv_usec * 1000); } }
false
qemu
21d5d12bb0ad4de7cc92a7a2d018e7ec0f9fd148
static int64_t get_clock(void) { #if defined(__linux__) || (defined(__FreeBSD__) && __FreeBSD_version >= 500000) \ || defined(__DragonFly__) if (use_rt_clock) { struct timespec ts; clock_gettime(CLOCK_MONOTONIC, &ts); return ts.tv_sec * 1000000000LL + ts.tv_nsec; } else #endif { struct timeval tv; gettimeofday(&tv, NULL); return tv.tv_sec * 1000000000LL + (tv.tv_usec * 1000); } }
{ "code": [], "line_no": [] }
static int64_t FUNC_0(void) { #if defined(__linux__) || (defined(__FreeBSD__) && __FreeBSD_version >= 500000) \ || defined(__DragonFly__) if (use_rt_clock) { struct timespec ts; clock_gettime(CLOCK_MONOTONIC, &ts); return ts.tv_sec * 1000000000LL + ts.tv_nsec; } else #endif { struct timeval VAR_0; gettimeofday(&VAR_0, NULL); return VAR_0.tv_sec * 1000000000LL + (VAR_0.tv_usec * 1000); } }
[ "static int64_t FUNC_0(void)\n{", "#if defined(__linux__) || (defined(__FreeBSD__) && __FreeBSD_version >= 500000) \\\n|| defined(__DragonFly__)\nif (use_rt_clock) {", "struct timespec ts;", "clock_gettime(CLOCK_MONOTONIC, &ts);", "return ts.tv_sec * 1000000000LL + ts.tv_nsec;", "} else", "#endif\n{", "struct timeval VAR_0;", "gettimeofday(&VAR_0, NULL);", "return VAR_0.tv_sec * 1000000000LL + (VAR_0.tv_usec * 1000);", "}", "}" ]
[ 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 ] ]
15,471
static void setup_frame(int sig, struct emulated_sigaction * ka, target_sigset_t *set, CPUState *regs) { struct sigframe *frame; abi_ulong frame_addr; int i; frame_addr = get_sigframe(ka, regs, sizeof(*frame)); if (!lock_user_struct(VERIFY_WRITE, frame, frame_addr, 0)) goto give_sigsegv; install_sigtramp(frame->sf_code, TARGET_NR_sigreturn); if(setup_sigcontext(regs, &frame->sf_sc)) goto give_sigsegv; for(i = 0; i < TARGET_NSIG_WORDS; i++) { if(__put_user(set->sig[i], &frame->sf_mask.sig[i])) goto give_sigsegv; } /* * Arguments to signal handler: * * a0 = signal number * a1 = 0 (should be cause) * a2 = pointer to struct sigcontext * * $25 and PC point to the signal handler, $29 points to the * struct sigframe. */ regs->gpr[ 4][regs->current_tc] = sig; regs->gpr[ 5][regs->current_tc] = 0; regs->gpr[ 6][regs->current_tc] = h2g(&frame->sf_sc); regs->gpr[29][regs->current_tc] = h2g(frame); regs->gpr[31][regs->current_tc] = h2g(frame->sf_code); /* The original kernel code sets CP0_EPC to the handler * since it returns to userland using eret * we cannot do this here, and we must set PC directly */ regs->PC[regs->current_tc] = regs->gpr[25][regs->current_tc] = ka->sa._sa_handler; unlock_user_struct(frame, frame_addr, 1); return; give_sigsegv: unlock_user_struct(frame, frame_addr, 1); force_sig(TARGET_SIGSEGV/*, current*/); return; }
false
qemu
f8b0aa25599782eef91edc00ebf620bd14db720c
static void setup_frame(int sig, struct emulated_sigaction * ka, target_sigset_t *set, CPUState *regs) { struct sigframe *frame; abi_ulong frame_addr; int i; frame_addr = get_sigframe(ka, regs, sizeof(*frame)); if (!lock_user_struct(VERIFY_WRITE, frame, frame_addr, 0)) goto give_sigsegv; install_sigtramp(frame->sf_code, TARGET_NR_sigreturn); if(setup_sigcontext(regs, &frame->sf_sc)) goto give_sigsegv; for(i = 0; i < TARGET_NSIG_WORDS; i++) { if(__put_user(set->sig[i], &frame->sf_mask.sig[i])) goto give_sigsegv; } regs->gpr[ 4][regs->current_tc] = sig; regs->gpr[ 5][regs->current_tc] = 0; regs->gpr[ 6][regs->current_tc] = h2g(&frame->sf_sc); regs->gpr[29][regs->current_tc] = h2g(frame); regs->gpr[31][regs->current_tc] = h2g(frame->sf_code); regs->PC[regs->current_tc] = regs->gpr[25][regs->current_tc] = ka->sa._sa_handler; unlock_user_struct(frame, frame_addr, 1); return; give_sigsegv: unlock_user_struct(frame, frame_addr, 1); force_sig(TARGET_SIGSEGV); return; }
{ "code": [], "line_no": [] }
static void FUNC_0(int VAR_0, struct emulated_sigaction * VAR_1, target_sigset_t *VAR_2, CPUState *VAR_3) { struct sigframe *VAR_4; abi_ulong frame_addr; int VAR_5; frame_addr = get_sigframe(VAR_1, VAR_3, sizeof(*VAR_4)); if (!lock_user_struct(VERIFY_WRITE, VAR_4, frame_addr, 0)) goto give_sigsegv; install_sigtramp(VAR_4->sf_code, TARGET_NR_sigreturn); if(setup_sigcontext(VAR_3, &VAR_4->sf_sc)) goto give_sigsegv; for(VAR_5 = 0; VAR_5 < TARGET_NSIG_WORDS; VAR_5++) { if(__put_user(VAR_2->VAR_0[VAR_5], &VAR_4->sf_mask.VAR_0[VAR_5])) goto give_sigsegv; } VAR_3->gpr[ 4][VAR_3->current_tc] = VAR_0; VAR_3->gpr[ 5][VAR_3->current_tc] = 0; VAR_3->gpr[ 6][VAR_3->current_tc] = h2g(&VAR_4->sf_sc); VAR_3->gpr[29][VAR_3->current_tc] = h2g(VAR_4); VAR_3->gpr[31][VAR_3->current_tc] = h2g(VAR_4->sf_code); VAR_3->PC[VAR_3->current_tc] = VAR_3->gpr[25][VAR_3->current_tc] = VAR_1->sa._sa_handler; unlock_user_struct(VAR_4, frame_addr, 1); return; give_sigsegv: unlock_user_struct(VAR_4, frame_addr, 1); force_sig(TARGET_SIGSEGV); return; }
[ "static void FUNC_0(int VAR_0, struct emulated_sigaction * VAR_1,\ntarget_sigset_t *VAR_2, CPUState *VAR_3)\n{", "struct sigframe *VAR_4;", "abi_ulong frame_addr;", "int VAR_5;", "frame_addr = get_sigframe(VAR_1, VAR_3, sizeof(*VAR_4));", "if (!lock_user_struct(VERIFY_WRITE, VAR_4, frame_addr, 0))\ngoto give_sigsegv;", "install_sigtramp(VAR_4->sf_code, TARGET_NR_sigreturn);", "if(setup_sigcontext(VAR_3, &VAR_4->sf_sc))\ngoto give_sigsegv;", "for(VAR_5 = 0; VAR_5 < TARGET_NSIG_WORDS; VAR_5++) {", "if(__put_user(VAR_2->VAR_0[VAR_5], &VAR_4->sf_mask.VAR_0[VAR_5]))\ngoto give_sigsegv;", "}", "VAR_3->gpr[ 4][VAR_3->current_tc] = VAR_0;", "VAR_3->gpr[ 5][VAR_3->current_tc] = 0;", "VAR_3->gpr[ 6][VAR_3->current_tc] = h2g(&VAR_4->sf_sc);", "VAR_3->gpr[29][VAR_3->current_tc] = h2g(VAR_4);", "VAR_3->gpr[31][VAR_3->current_tc] = h2g(VAR_4->sf_code);", "VAR_3->PC[VAR_3->current_tc] = VAR_3->gpr[25][VAR_3->current_tc] = VAR_1->sa._sa_handler;", "unlock_user_struct(VAR_4, frame_addr, 1);", "return;", "give_sigsegv:\nunlock_user_struct(VAR_4, frame_addr, 1);", "force_sig(TARGET_SIGSEGV);", "return;", "}" ]
[ 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 ], [ 23 ], [ 27, 29 ], [ 33 ], [ 35, 37 ], [ 39 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 79 ], [ 81 ], [ 83 ], [ 87, 89 ], [ 91 ], [ 93 ], [ 95 ] ]
15,473
static void vmsvga_text_update(void *opaque, console_ch_t *chardata) { struct vmsvga_state_s *s = opaque; if (s->vga.text_update) s->vga.text_update(&s->vga, chardata); }
false
qemu
0d7937974cd0504f30ad483c3368b21da426ddf9
static void vmsvga_text_update(void *opaque, console_ch_t *chardata) { struct vmsvga_state_s *s = opaque; if (s->vga.text_update) s->vga.text_update(&s->vga, chardata); }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0, console_ch_t *VAR_1) { struct vmsvga_state_s *VAR_2 = VAR_0; if (VAR_2->vga.text_update) VAR_2->vga.text_update(&VAR_2->vga, VAR_1); }
[ "static void FUNC_0(void *VAR_0, console_ch_t *VAR_1)\n{", "struct vmsvga_state_s *VAR_2 = VAR_0;", "if (VAR_2->vga.text_update)\nVAR_2->vga.text_update(&VAR_2->vga, VAR_1);", "}" ]
[ 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9, 11 ], [ 13 ] ]
15,474
static int send_response(GAState *s, QObject *payload) { const char *buf; QString *payload_qstr; GIOStatus status; g_assert(payload && s->channel); payload_qstr = qobject_to_json(payload); if (!payload_qstr) { return -EINVAL; } qstring_append_chr(payload_qstr, '\n'); buf = qstring_get_str(payload_qstr); status = ga_channel_write_all(s->channel, buf, strlen(buf)); QDECREF(payload_qstr); if (status != G_IO_STATUS_NORMAL) { return -EIO; } return 0; }
false
qemu
3cf0bed8369267184e5dc5b58882811519d67437
static int send_response(GAState *s, QObject *payload) { const char *buf; QString *payload_qstr; GIOStatus status; g_assert(payload && s->channel); payload_qstr = qobject_to_json(payload); if (!payload_qstr) { return -EINVAL; } qstring_append_chr(payload_qstr, '\n'); buf = qstring_get_str(payload_qstr); status = ga_channel_write_all(s->channel, buf, strlen(buf)); QDECREF(payload_qstr); if (status != G_IO_STATUS_NORMAL) { return -EIO; } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(GAState *VAR_0, QObject *VAR_1) { const char *VAR_2; QString *payload_qstr; GIOStatus status; g_assert(VAR_1 && VAR_0->channel); payload_qstr = qobject_to_json(VAR_1); if (!payload_qstr) { return -EINVAL; } qstring_append_chr(payload_qstr, '\n'); VAR_2 = qstring_get_str(payload_qstr); status = ga_channel_write_all(VAR_0->channel, VAR_2, strlen(VAR_2)); QDECREF(payload_qstr); if (status != G_IO_STATUS_NORMAL) { return -EIO; } return 0; }
[ "static int FUNC_0(GAState *VAR_0, QObject *VAR_1)\n{", "const char *VAR_2;", "QString *payload_qstr;", "GIOStatus status;", "g_assert(VAR_1 && VAR_0->channel);", "payload_qstr = qobject_to_json(VAR_1);", "if (!payload_qstr) {", "return -EINVAL;", "}", "qstring_append_chr(payload_qstr, '\\n');", "VAR_2 = qstring_get_str(payload_qstr);", "status = ga_channel_write_all(VAR_0->channel, VAR_2, strlen(VAR_2));", "QDECREF(payload_qstr);", "if (status != G_IO_STATUS_NORMAL) {", "return -EIO;", "}", "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 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ] ]
15,475
float64 HELPER(ucf64_addd)(float64 a, float64 b, CPUUniCore32State *env) { return float64_add(a, b, &env->ucf64.fp_status); }
false
qemu
e8ede0a8bb5298a6979bcf7ed84ef64a64a4e3fe
float64 HELPER(ucf64_addd)(float64 a, float64 b, CPUUniCore32State *env) { return float64_add(a, b, &env->ucf64.fp_status); }
{ "code": [], "line_no": [] }
float64 FUNC_0(ucf64_addd)(float64 a, float64 b, CPUUniCore32State *env) { return float64_add(a, b, &env->ucf64.fp_status); }
[ "float64 FUNC_0(ucf64_addd)(float64 a, float64 b, CPUUniCore32State *env)\n{", "return float64_add(a, b, &env->ucf64.fp_status);", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
15,477
static void term_exit(void) { tcsetattr (0, TCSANOW, &oldtty); }
false
qemu
d57e4e482e3997b1382625c84149ad0b69155fc0
static void term_exit(void) { tcsetattr (0, TCSANOW, &oldtty); }
{ "code": [], "line_no": [] }
static void FUNC_0(void) { tcsetattr (0, TCSANOW, &oldtty); }
[ "static void FUNC_0(void)\n{", "tcsetattr (0, TCSANOW, &oldtty);", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
15,478
void timer_mod_ns(QEMUTimer *ts, int64_t expire_time) { QEMUTimerList *timer_list = ts->timer_list; bool rearm; qemu_mutex_lock(&timer_list->active_timers_lock); timer_del_locked(timer_list, ts); rearm = timer_mod_ns_locked(timer_list, ts, expire_time); qemu_mutex_unlock(&timer_list->active_timers_lock); if (rearm) { timerlist_rearm(timer_list); } }
false
qemu
c2b38b277a7882a592f4f2ec955084b2b756daaa
void timer_mod_ns(QEMUTimer *ts, int64_t expire_time) { QEMUTimerList *timer_list = ts->timer_list; bool rearm; qemu_mutex_lock(&timer_list->active_timers_lock); timer_del_locked(timer_list, ts); rearm = timer_mod_ns_locked(timer_list, ts, expire_time); qemu_mutex_unlock(&timer_list->active_timers_lock); if (rearm) { timerlist_rearm(timer_list); } }
{ "code": [], "line_no": [] }
void FUNC_0(QEMUTimer *VAR_0, int64_t VAR_1) { QEMUTimerList *timer_list = VAR_0->timer_list; bool rearm; qemu_mutex_lock(&timer_list->active_timers_lock); timer_del_locked(timer_list, VAR_0); rearm = timer_mod_ns_locked(timer_list, VAR_0, VAR_1); qemu_mutex_unlock(&timer_list->active_timers_lock); if (rearm) { timerlist_rearm(timer_list); } }
[ "void FUNC_0(QEMUTimer *VAR_0, int64_t VAR_1)\n{", "QEMUTimerList *timer_list = VAR_0->timer_list;", "bool rearm;", "qemu_mutex_lock(&timer_list->active_timers_lock);", "timer_del_locked(timer_list, VAR_0);", "rearm = timer_mod_ns_locked(timer_list, VAR_0, VAR_1);", "qemu_mutex_unlock(&timer_list->active_timers_lock);", "if (rearm) {", "timerlist_rearm(timer_list);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ] ]
15,479
static int convert_do_copy(ImgConvertState *s) { uint8_t *buf = NULL; int64_t sector_num, allocated_done; int ret; int n; /* Check whether we have zero initialisation or can get it efficiently */ s->has_zero_init = s->min_sparse && !s->target_has_backing ? bdrv_has_zero_init(blk_bs(s->target)) : false; if (!s->has_zero_init && !s->target_has_backing && bdrv_can_write_zeroes_with_unmap(blk_bs(s->target))) { ret = bdrv_make_zero(blk_bs(s->target), BDRV_REQ_MAY_UNMAP); if (ret == 0) { s->has_zero_init = true; } } /* Allocate buffer for copied data. For compressed images, only one cluster * can be copied at a time. */ if (s->compressed) { if (s->cluster_sectors <= 0 || s->cluster_sectors > s->buf_sectors) { error_report("invalid cluster size"); ret = -EINVAL; goto fail; } s->buf_sectors = s->cluster_sectors; } buf = blk_blockalign(s->target, s->buf_sectors * BDRV_SECTOR_SIZE); /* Calculate allocated sectors for progress */ s->allocated_sectors = 0; sector_num = 0; while (sector_num < s->total_sectors) { n = convert_iteration_sectors(s, sector_num); if (n < 0) { ret = n; goto fail; } if (s->status == BLK_DATA) { s->allocated_sectors += n; } sector_num += n; } /* Do the copy */ s->src_cur = 0; s->src_cur_offset = 0; s->sector_next_status = 0; sector_num = 0; allocated_done = 0; while (sector_num < s->total_sectors) { n = convert_iteration_sectors(s, sector_num); if (n < 0) { ret = n; goto fail; } if (s->status == BLK_DATA) { allocated_done += n; qemu_progress_print(100.0 * allocated_done / s->allocated_sectors, 0); } ret = convert_read(s, sector_num, n, buf); if (ret < 0) { error_report("error while reading sector %" PRId64 ": %s", sector_num, strerror(-ret)); goto fail; } ret = convert_write(s, sector_num, n, buf); if (ret < 0) { error_report("error while writing sector %" PRId64 ": %s", sector_num, strerror(-ret)); goto fail; } sector_num += n; } if (s->compressed) { /* signal EOF to align */ ret = blk_write_compressed(s->target, 0, NULL, 0); if (ret < 0) { goto fail; } } ret = 0; fail: qemu_vfree(buf); return ret; }
false
qemu
aad15de4275d2fc90acdf6101493dfee4e39b803
static int convert_do_copy(ImgConvertState *s) { uint8_t *buf = NULL; int64_t sector_num, allocated_done; int ret; int n; s->has_zero_init = s->min_sparse && !s->target_has_backing ? bdrv_has_zero_init(blk_bs(s->target)) : false; if (!s->has_zero_init && !s->target_has_backing && bdrv_can_write_zeroes_with_unmap(blk_bs(s->target))) { ret = bdrv_make_zero(blk_bs(s->target), BDRV_REQ_MAY_UNMAP); if (ret == 0) { s->has_zero_init = true; } } if (s->compressed) { if (s->cluster_sectors <= 0 || s->cluster_sectors > s->buf_sectors) { error_report("invalid cluster size"); ret = -EINVAL; goto fail; } s->buf_sectors = s->cluster_sectors; } buf = blk_blockalign(s->target, s->buf_sectors * BDRV_SECTOR_SIZE); s->allocated_sectors = 0; sector_num = 0; while (sector_num < s->total_sectors) { n = convert_iteration_sectors(s, sector_num); if (n < 0) { ret = n; goto fail; } if (s->status == BLK_DATA) { s->allocated_sectors += n; } sector_num += n; } s->src_cur = 0; s->src_cur_offset = 0; s->sector_next_status = 0; sector_num = 0; allocated_done = 0; while (sector_num < s->total_sectors) { n = convert_iteration_sectors(s, sector_num); if (n < 0) { ret = n; goto fail; } if (s->status == BLK_DATA) { allocated_done += n; qemu_progress_print(100.0 * allocated_done / s->allocated_sectors, 0); } ret = convert_read(s, sector_num, n, buf); if (ret < 0) { error_report("error while reading sector %" PRId64 ": %s", sector_num, strerror(-ret)); goto fail; } ret = convert_write(s, sector_num, n, buf); if (ret < 0) { error_report("error while writing sector %" PRId64 ": %s", sector_num, strerror(-ret)); goto fail; } sector_num += n; } if (s->compressed) { ret = blk_write_compressed(s->target, 0, NULL, 0); if (ret < 0) { goto fail; } } ret = 0; fail: qemu_vfree(buf); return ret; }
{ "code": [], "line_no": [] }
static int FUNC_0(ImgConvertState *VAR_0) { uint8_t *buf = NULL; int64_t sector_num, allocated_done; int VAR_1; int VAR_2; VAR_0->has_zero_init = VAR_0->min_sparse && !VAR_0->target_has_backing ? bdrv_has_zero_init(blk_bs(VAR_0->target)) : false; if (!VAR_0->has_zero_init && !VAR_0->target_has_backing && bdrv_can_write_zeroes_with_unmap(blk_bs(VAR_0->target))) { VAR_1 = bdrv_make_zero(blk_bs(VAR_0->target), BDRV_REQ_MAY_UNMAP); if (VAR_1 == 0) { VAR_0->has_zero_init = true; } } if (VAR_0->compressed) { if (VAR_0->cluster_sectors <= 0 || VAR_0->cluster_sectors > VAR_0->buf_sectors) { error_report("invalid cluster size"); VAR_1 = -EINVAL; goto fail; } VAR_0->buf_sectors = VAR_0->cluster_sectors; } buf = blk_blockalign(VAR_0->target, VAR_0->buf_sectors * BDRV_SECTOR_SIZE); VAR_0->allocated_sectors = 0; sector_num = 0; while (sector_num < VAR_0->total_sectors) { VAR_2 = convert_iteration_sectors(VAR_0, sector_num); if (VAR_2 < 0) { VAR_1 = VAR_2; goto fail; } if (VAR_0->status == BLK_DATA) { VAR_0->allocated_sectors += VAR_2; } sector_num += VAR_2; } VAR_0->src_cur = 0; VAR_0->src_cur_offset = 0; VAR_0->sector_next_status = 0; sector_num = 0; allocated_done = 0; while (sector_num < VAR_0->total_sectors) { VAR_2 = convert_iteration_sectors(VAR_0, sector_num); if (VAR_2 < 0) { VAR_1 = VAR_2; goto fail; } if (VAR_0->status == BLK_DATA) { allocated_done += VAR_2; qemu_progress_print(100.0 * allocated_done / VAR_0->allocated_sectors, 0); } VAR_1 = convert_read(VAR_0, sector_num, VAR_2, buf); if (VAR_1 < 0) { error_report("error while reading sector %" PRId64 ": %VAR_0", sector_num, strerror(-VAR_1)); goto fail; } VAR_1 = convert_write(VAR_0, sector_num, VAR_2, buf); if (VAR_1 < 0) { error_report("error while writing sector %" PRId64 ": %VAR_0", sector_num, strerror(-VAR_1)); goto fail; } sector_num += VAR_2; } if (VAR_0->compressed) { VAR_1 = blk_write_compressed(VAR_0->target, 0, NULL, 0); if (VAR_1 < 0) { goto fail; } } VAR_1 = 0; fail: qemu_vfree(buf); return VAR_1; }
[ "static int FUNC_0(ImgConvertState *VAR_0)\n{", "uint8_t *buf = NULL;", "int64_t sector_num, allocated_done;", "int VAR_1;", "int VAR_2;", "VAR_0->has_zero_init = VAR_0->min_sparse && !VAR_0->target_has_backing\n? bdrv_has_zero_init(blk_bs(VAR_0->target))\n: false;", "if (!VAR_0->has_zero_init && !VAR_0->target_has_backing &&\nbdrv_can_write_zeroes_with_unmap(blk_bs(VAR_0->target)))\n{", "VAR_1 = bdrv_make_zero(blk_bs(VAR_0->target), BDRV_REQ_MAY_UNMAP);", "if (VAR_1 == 0) {", "VAR_0->has_zero_init = true;", "}", "}", "if (VAR_0->compressed) {", "if (VAR_0->cluster_sectors <= 0 || VAR_0->cluster_sectors > VAR_0->buf_sectors) {", "error_report(\"invalid cluster size\");", "VAR_1 = -EINVAL;", "goto fail;", "}", "VAR_0->buf_sectors = VAR_0->cluster_sectors;", "}", "buf = blk_blockalign(VAR_0->target, VAR_0->buf_sectors * BDRV_SECTOR_SIZE);", "VAR_0->allocated_sectors = 0;", "sector_num = 0;", "while (sector_num < VAR_0->total_sectors) {", "VAR_2 = convert_iteration_sectors(VAR_0, sector_num);", "if (VAR_2 < 0) {", "VAR_1 = VAR_2;", "goto fail;", "}", "if (VAR_0->status == BLK_DATA) {", "VAR_0->allocated_sectors += VAR_2;", "}", "sector_num += VAR_2;", "}", "VAR_0->src_cur = 0;", "VAR_0->src_cur_offset = 0;", "VAR_0->sector_next_status = 0;", "sector_num = 0;", "allocated_done = 0;", "while (sector_num < VAR_0->total_sectors) {", "VAR_2 = convert_iteration_sectors(VAR_0, sector_num);", "if (VAR_2 < 0) {", "VAR_1 = VAR_2;", "goto fail;", "}", "if (VAR_0->status == BLK_DATA) {", "allocated_done += VAR_2;", "qemu_progress_print(100.0 * allocated_done / VAR_0->allocated_sectors,\n0);", "}", "VAR_1 = convert_read(VAR_0, sector_num, VAR_2, buf);", "if (VAR_1 < 0) {", "error_report(\"error while reading sector %\" PRId64\n\": %VAR_0\", sector_num, strerror(-VAR_1));", "goto fail;", "}", "VAR_1 = convert_write(VAR_0, sector_num, VAR_2, buf);", "if (VAR_1 < 0) {", "error_report(\"error while writing sector %\" PRId64\n\": %VAR_0\", sector_num, strerror(-VAR_1));", "goto fail;", "}", "sector_num += VAR_2;", "}", "if (VAR_0->compressed) {", "VAR_1 = blk_write_compressed(VAR_0->target, 0, NULL, 0);", "if (VAR_1 < 0) {", "goto fail;", "}", "}", "VAR_1 = 0;", "fail:\nqemu_vfree(buf);", "return VAR_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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 17, 19, 21 ], [ 25, 27, 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 99 ], [ 101 ], [ 103 ], [ 107 ], [ 109 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129, 131 ], [ 133 ], [ 137 ], [ 139 ], [ 141, 143 ], [ 145 ], [ 147 ], [ 151 ], [ 153 ], [ 155, 157 ], [ 159 ], [ 161 ], [ 165 ], [ 167 ], [ 171 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 187 ], [ 189, 191 ], [ 193 ], [ 195 ] ]
15,480
static void test_visitor_in_native_list_uint16(TestInputVisitorData *data, const void *unused) { test_native_list_integer_helper(data, unused, USER_DEF_NATIVE_LIST_UNION_KIND_U16); }
false
qemu
b3db211f3c80bb996a704d665fe275619f728bd4
static void test_visitor_in_native_list_uint16(TestInputVisitorData *data, const void *unused) { test_native_list_integer_helper(data, unused, USER_DEF_NATIVE_LIST_UNION_KIND_U16); }
{ "code": [], "line_no": [] }
static void FUNC_0(TestInputVisitorData *VAR_0, const void *VAR_1) { test_native_list_integer_helper(VAR_0, VAR_1, USER_DEF_NATIVE_LIST_UNION_KIND_U16); }
[ "static void FUNC_0(TestInputVisitorData *VAR_0,\nconst void *VAR_1)\n{", "test_native_list_integer_helper(VAR_0, VAR_1,\nUSER_DEF_NATIVE_LIST_UNION_KIND_U16);", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7, 9 ], [ 11 ] ]
15,481
static void validate_bootdevices(char *devices) { /* We just do some generic consistency checks */ const char *p; int bitmap = 0; for (p = devices; *p != '\0'; p++) { /* Allowed boot devices are: * a-b: floppy disk drives * c-f: IDE disk drives * g-m: machine implementation dependent drives * n-p: network devices * It's up to each machine implementation to check if the given boot * devices match the actual hardware implementation and firmware * features. */ if (*p < 'a' || *p > 'p') { fprintf(stderr, "Invalid boot device '%c'\n", *p); exit(1); } if (bitmap & (1 << (*p - 'a'))) { fprintf(stderr, "Boot device '%c' was given twice\n", *p); exit(1); } bitmap |= 1 << (*p - 'a'); } }
false
qemu
6ef4716cecdfa1b3794c1a33edba9840e1aa6b5f
static void validate_bootdevices(char *devices) { const char *p; int bitmap = 0; for (p = devices; *p != '\0'; p++) { if (*p < 'a' || *p > 'p') { fprintf(stderr, "Invalid boot device '%c'\n", *p); exit(1); } if (bitmap & (1 << (*p - 'a'))) { fprintf(stderr, "Boot device '%c' was given twice\n", *p); exit(1); } bitmap |= 1 << (*p - 'a'); } }
{ "code": [], "line_no": [] }
static void FUNC_0(char *VAR_0) { const char *VAR_1; int VAR_2 = 0; for (VAR_1 = VAR_0; *VAR_1 != '\0'; VAR_1++) { if (*VAR_1 < 'a' || *VAR_1 > 'VAR_1') { fprintf(stderr, "Invalid boot device '%c'\n", *VAR_1); exit(1); } if (VAR_2 & (1 << (*VAR_1 - 'a'))) { fprintf(stderr, "Boot device '%c' was given twice\n", *VAR_1); exit(1); } VAR_2 |= 1 << (*VAR_1 - 'a'); } }
[ "static void FUNC_0(char *VAR_0)\n{", "const char *VAR_1;", "int VAR_2 = 0;", "for (VAR_1 = VAR_0; *VAR_1 != '\\0'; VAR_1++) {", "if (*VAR_1 < 'a' || *VAR_1 > 'VAR_1') {", "fprintf(stderr, \"Invalid boot device '%c'\\n\", *VAR_1);", "exit(1);", "}", "if (VAR_2 & (1 << (*VAR_1 - 'a'))) {", "fprintf(stderr, \"Boot device '%c' was given twice\\n\", *VAR_1);", "exit(1);", "}", "VAR_2 |= 1 << (*VAR_1 - 'a');", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 7 ], [ 9 ], [ 13 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ] ]
15,483
void s390_add_running_cpu(S390CPU *cpu) { CPUState *cs = CPU(cpu); if (cs->halted) { s390_running_cpus++; cs->halted = 0; cs->exception_index = -1; } }
false
qemu
75973bfe415774babe7c1e18fa682c050fdce73b
void s390_add_running_cpu(S390CPU *cpu) { CPUState *cs = CPU(cpu); if (cs->halted) { s390_running_cpus++; cs->halted = 0; cs->exception_index = -1; } }
{ "code": [], "line_no": [] }
void FUNC_0(S390CPU *VAR_0) { CPUState *cs = CPU(VAR_0); if (cs->halted) { s390_running_cpus++; cs->halted = 0; cs->exception_index = -1; } }
[ "void FUNC_0(S390CPU *VAR_0)\n{", "CPUState *cs = CPU(VAR_0);", "if (cs->halted) {", "s390_running_cpus++;", "cs->halted = 0;", "cs->exception_index = -1;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ] ]
15,484
static int usb_audio_handle_data(USBDevice *dev, USBPacket *p) { USBAudioState *s = (USBAudioState *) dev; int ret = 0; switch (p->pid) { case USB_TOKEN_OUT: switch (p->devep) { case 1: ret = usb_audio_handle_dataout(s, p); break; default: goto fail; } break; default: fail: ret = USB_RET_STALL; break; } if (ret == USB_RET_STALL && s->debug) { fprintf(stderr, "usb-audio: failed data transaction: " "pid 0x%x ep 0x%x len 0x%zx\n", p->pid, p->devep, p->iov.size); } return ret; }
false
qemu
079d0b7f1eedcc634c371fe05b617fdc55c8b762
static int usb_audio_handle_data(USBDevice *dev, USBPacket *p) { USBAudioState *s = (USBAudioState *) dev; int ret = 0; switch (p->pid) { case USB_TOKEN_OUT: switch (p->devep) { case 1: ret = usb_audio_handle_dataout(s, p); break; default: goto fail; } break; default: fail: ret = USB_RET_STALL; break; } if (ret == USB_RET_STALL && s->debug) { fprintf(stderr, "usb-audio: failed data transaction: " "pid 0x%x ep 0x%x len 0x%zx\n", p->pid, p->devep, p->iov.size); } return ret; }
{ "code": [], "line_no": [] }
static int FUNC_0(USBDevice *VAR_0, USBPacket *VAR_1) { USBAudioState *s = (USBAudioState *) VAR_0; int VAR_2 = 0; switch (VAR_1->pid) { case USB_TOKEN_OUT: switch (VAR_1->devep) { case 1: VAR_2 = usb_audio_handle_dataout(s, VAR_1); break; default: goto fail; } break; default: fail: VAR_2 = USB_RET_STALL; break; } if (VAR_2 == USB_RET_STALL && s->debug) { fprintf(stderr, "usb-audio: failed data transaction: " "pid 0x%x ep 0x%x len 0x%zx\n", VAR_1->pid, VAR_1->devep, VAR_1->iov.size); } return VAR_2; }
[ "static int FUNC_0(USBDevice *VAR_0, USBPacket *VAR_1)\n{", "USBAudioState *s = (USBAudioState *) VAR_0;", "int VAR_2 = 0;", "switch (VAR_1->pid) {", "case USB_TOKEN_OUT:\nswitch (VAR_1->devep) {", "case 1:\nVAR_2 = usb_audio_handle_dataout(s, VAR_1);", "break;", "default:\ngoto fail;", "}", "break;", "default:\nfail:\nVAR_2 = USB_RET_STALL;", "break;", "}", "if (VAR_2 == USB_RET_STALL && s->debug) {", "fprintf(stderr, \"usb-audio: failed data transaction: \"\n\"pid 0x%x ep 0x%x len 0x%zx\\n\",\nVAR_1->pid, VAR_1->devep, VAR_1->iov.size);", "}", "return VAR_2;", "}" ]
[ 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 ], [ 23, 25 ], [ 27 ], [ 29 ], [ 33, 35, 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45, 47, 49 ], [ 51 ], [ 53 ], [ 55 ] ]
15,485
int arm_cpu_write_elf32_note(WriteCoreDumpFunction f, CPUState *cs, int cpuid, void *opaque) { struct arm_note note; CPUARMState *env = &ARM_CPU(cs)->env; DumpState *s = opaque; int ret, i; arm_note_init(&note, s, "CORE", 5, NT_PRSTATUS, sizeof(note.prstatus)); note.prstatus.pr_pid = cpu_to_dump32(s, cpuid); for (i = 0; i < 16; ++i) { note.prstatus.pr_reg.regs[i] = cpu_to_dump32(s, env->regs[i]); } note.prstatus.pr_reg.regs[16] = cpu_to_dump32(s, cpsr_read(env)); ret = f(&note, ARM_PRSTATUS_NOTE_SIZE, s); if (ret < 0) { return -1; } return 0; }
false
qemu
ade0d0c0d3a0444c626ec5f46ef75af7395236f6
int arm_cpu_write_elf32_note(WriteCoreDumpFunction f, CPUState *cs, int cpuid, void *opaque) { struct arm_note note; CPUARMState *env = &ARM_CPU(cs)->env; DumpState *s = opaque; int ret, i; arm_note_init(&note, s, "CORE", 5, NT_PRSTATUS, sizeof(note.prstatus)); note.prstatus.pr_pid = cpu_to_dump32(s, cpuid); for (i = 0; i < 16; ++i) { note.prstatus.pr_reg.regs[i] = cpu_to_dump32(s, env->regs[i]); } note.prstatus.pr_reg.regs[16] = cpu_to_dump32(s, cpsr_read(env)); ret = f(&note, ARM_PRSTATUS_NOTE_SIZE, s); if (ret < 0) { return -1; } return 0; }
{ "code": [], "line_no": [] }
int FUNC_0(WriteCoreDumpFunction VAR_0, CPUState *VAR_1, int VAR_2, void *VAR_3) { struct arm_note VAR_4; CPUARMState *env = &ARM_CPU(VAR_1)->env; DumpState *s = VAR_3; int VAR_5, VAR_6; arm_note_init(&VAR_4, s, "CORE", 5, NT_PRSTATUS, sizeof(VAR_4.prstatus)); VAR_4.prstatus.pr_pid = cpu_to_dump32(s, VAR_2); for (VAR_6 = 0; VAR_6 < 16; ++VAR_6) { VAR_4.prstatus.pr_reg.regs[VAR_6] = cpu_to_dump32(s, env->regs[VAR_6]); } VAR_4.prstatus.pr_reg.regs[16] = cpu_to_dump32(s, cpsr_read(env)); VAR_5 = VAR_0(&VAR_4, ARM_PRSTATUS_NOTE_SIZE, s); if (VAR_5 < 0) { return -1; } return 0; }
[ "int FUNC_0(WriteCoreDumpFunction VAR_0, CPUState *VAR_1,\nint VAR_2, void *VAR_3)\n{", "struct arm_note VAR_4;", "CPUARMState *env = &ARM_CPU(VAR_1)->env;", "DumpState *s = VAR_3;", "int VAR_5, VAR_6;", "arm_note_init(&VAR_4, s, \"CORE\", 5, NT_PRSTATUS, sizeof(VAR_4.prstatus));", "VAR_4.prstatus.pr_pid = cpu_to_dump32(s, VAR_2);", "for (VAR_6 = 0; VAR_6 < 16; ++VAR_6) {", "VAR_4.prstatus.pr_reg.regs[VAR_6] = cpu_to_dump32(s, env->regs[VAR_6]);", "}", "VAR_4.prstatus.pr_reg.regs[16] = cpu_to_dump32(s, cpsr_read(env));", "VAR_5 = VAR_0(&VAR_4, ARM_PRSTATUS_NOTE_SIZE, s);", "if (VAR_5 < 0) {", "return -1;", "}", "return 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 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ] ]
15,487
static int write_manifest(AVFormatContext *s, int final) { DASHContext *c = s->priv_data; AVIOContext *out; char temp_filename[1024]; int ret, i; const char *proto = avio_find_protocol_name(s->filename); int use_rename = proto && !strcmp(proto, "file"); static unsigned int warned_non_file = 0; AVDictionaryEntry *title = av_dict_get(s->metadata, "title", NULL, 0); if (!use_rename && !warned_non_file++) av_log(s, AV_LOG_ERROR, "Cannot use rename on non file protocol, this may lead to races and temporary partial files\n"); snprintf(temp_filename, sizeof(temp_filename), use_rename ? "%s.tmp" : "%s", s->filename); ret = s->io_open(s, &out, temp_filename, AVIO_FLAG_WRITE, NULL); if (ret < 0) { av_log(s, AV_LOG_ERROR, "Unable to open %s for writing\n", temp_filename); return ret; } avio_printf(out, "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"); avio_printf(out, "<MPD xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" "\txmlns=\"urn:mpeg:dash:schema:mpd:2011\"\n" "\txmlns:xlink=\"http://www.w3.org/1999/xlink\"\n" "\txsi:schemaLocation=\"urn:mpeg:DASH:schema:MPD:2011 http://standards.iso.org/ittf/PubliclyAvailableStandards/MPEG-DASH_schema_files/DASH-MPD.xsd\"\n" "\tprofiles=\"urn:mpeg:dash:profile:isoff-live:2011\"\n" "\ttype=\"%s\"\n", final ? "static" : "dynamic"); if (final) { avio_printf(out, "\tmediaPresentationDuration=\""); write_time(out, c->total_duration); avio_printf(out, "\"\n"); } else { int64_t update_period = c->last_duration / AV_TIME_BASE; char now_str[100]; if (c->use_template && !c->use_timeline) update_period = 500; avio_printf(out, "\tminimumUpdatePeriod=\"PT%"PRId64"S\"\n", update_period); avio_printf(out, "\tsuggestedPresentationDelay=\"PT%"PRId64"S\"\n", c->last_duration / AV_TIME_BASE); if (!c->availability_start_time[0] && s->nb_streams > 0 && c->streams[0].nb_segments > 0) { format_date_now(c->availability_start_time, sizeof(c->availability_start_time)); } if (c->availability_start_time[0]) avio_printf(out, "\tavailabilityStartTime=\"%s\"\n", c->availability_start_time); format_date_now(now_str, sizeof(now_str)); if (now_str[0]) avio_printf(out, "\tpublishTime=\"%s\"\n", now_str); if (c->window_size && c->use_template) { avio_printf(out, "\ttimeShiftBufferDepth=\""); write_time(out, c->last_duration * c->window_size); avio_printf(out, "\"\n"); } } avio_printf(out, "\tminBufferTime=\""); write_time(out, c->last_duration * 2); avio_printf(out, "\">\n"); avio_printf(out, "\t<ProgramInformation>\n"); if (title) { char *escaped = xmlescape(title->value); avio_printf(out, "\t\t<Title>%s</Title>\n", escaped); av_free(escaped); } avio_printf(out, "\t</ProgramInformation>\n"); if (c->window_size && s->nb_streams > 0 && c->streams[0].nb_segments > 0 && !c->use_template) { OutputStream *os = &c->streams[0]; int start_index = FFMAX(os->nb_segments - c->window_size, 0); int64_t start_time = av_rescale_q(os->segments[start_index]->time, s->streams[0]->time_base, AV_TIME_BASE_Q); avio_printf(out, "\t<Period id=\"0\" start=\""); write_time(out, start_time); avio_printf(out, "\">\n"); } else { avio_printf(out, "\t<Period id=\"0\" start=\"PT0.0S\">\n"); } for (i = 0; i < c->nb_as; i++) { if ((ret = write_adaptation_set(s, out, i)) < 0) return ret; } avio_printf(out, "\t</Period>\n"); if (c->utc_timing_url) avio_printf(out, "\t<UTCTiming schemeIdUri=\"urn:mpeg:dash:utc:http-xsdate:2014\" value=\"%s\"/>\n", c->utc_timing_url); avio_printf(out, "</MPD>\n"); avio_flush(out); ff_format_io_close(s, &out); if (use_rename) return avpriv_io_move(temp_filename, s->filename); return 0; }
false
FFmpeg
d24e08e978792e09d212018677d1c0b8208ecef8
static int write_manifest(AVFormatContext *s, int final) { DASHContext *c = s->priv_data; AVIOContext *out; char temp_filename[1024]; int ret, i; const char *proto = avio_find_protocol_name(s->filename); int use_rename = proto && !strcmp(proto, "file"); static unsigned int warned_non_file = 0; AVDictionaryEntry *title = av_dict_get(s->metadata, "title", NULL, 0); if (!use_rename && !warned_non_file++) av_log(s, AV_LOG_ERROR, "Cannot use rename on non file protocol, this may lead to races and temporary partial files\n"); snprintf(temp_filename, sizeof(temp_filename), use_rename ? "%s.tmp" : "%s", s->filename); ret = s->io_open(s, &out, temp_filename, AVIO_FLAG_WRITE, NULL); if (ret < 0) { av_log(s, AV_LOG_ERROR, "Unable to open %s for writing\n", temp_filename); return ret; } avio_printf(out, "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"); avio_printf(out, "<MPD xmlns:xsi=\"http: "\txmlns=\"urn:mpeg:dash:schema:mpd:2011\"\n" "\txmlns:xlink=\"http: "\txsi:schemaLocation=\"urn:mpeg:DASH:schema:MPD:2011 http: "\tprofiles=\"urn:mpeg:dash:profile:isoff-live:2011\"\n" "\ttype=\"%s\"\n", final ? "static" : "dynamic"); if (final) { avio_printf(out, "\tmediaPresentationDuration=\""); write_time(out, c->total_duration); avio_printf(out, "\"\n"); } else { int64_t update_period = c->last_duration / AV_TIME_BASE; char now_str[100]; if (c->use_template && !c->use_timeline) update_period = 500; avio_printf(out, "\tminimumUpdatePeriod=\"PT%"PRId64"S\"\n", update_period); avio_printf(out, "\tsuggestedPresentationDelay=\"PT%"PRId64"S\"\n", c->last_duration / AV_TIME_BASE); if (!c->availability_start_time[0] && s->nb_streams > 0 && c->streams[0].nb_segments > 0) { format_date_now(c->availability_start_time, sizeof(c->availability_start_time)); } if (c->availability_start_time[0]) avio_printf(out, "\tavailabilityStartTime=\"%s\"\n", c->availability_start_time); format_date_now(now_str, sizeof(now_str)); if (now_str[0]) avio_printf(out, "\tpublishTime=\"%s\"\n", now_str); if (c->window_size && c->use_template) { avio_printf(out, "\ttimeShiftBufferDepth=\""); write_time(out, c->last_duration * c->window_size); avio_printf(out, "\"\n"); } } avio_printf(out, "\tminBufferTime=\""); write_time(out, c->last_duration * 2); avio_printf(out, "\">\n"); avio_printf(out, "\t<ProgramInformation>\n"); if (title) { char *escaped = xmlescape(title->value); avio_printf(out, "\t\t<Title>%s</Title>\n", escaped); av_free(escaped); } avio_printf(out, "\t</ProgramInformation>\n"); if (c->window_size && s->nb_streams > 0 && c->streams[0].nb_segments > 0 && !c->use_template) { OutputStream *os = &c->streams[0]; int start_index = FFMAX(os->nb_segments - c->window_size, 0); int64_t start_time = av_rescale_q(os->segments[start_index]->time, s->streams[0]->time_base, AV_TIME_BASE_Q); avio_printf(out, "\t<Period id=\"0\" start=\""); write_time(out, start_time); avio_printf(out, "\">\n"); } else { avio_printf(out, "\t<Period id=\"0\" start=\"PT0.0S\">\n"); } for (i = 0; i < c->nb_as; i++) { if ((ret = write_adaptation_set(s, out, i)) < 0) return ret; } avio_printf(out, "\t</Period>\n"); if (c->utc_timing_url) avio_printf(out, "\t<UTCTiming schemeIdUri=\"urn:mpeg:dash:utc:http-xsdate:2014\" value=\"%s\"/>\n", c->utc_timing_url); avio_printf(out, "</MPD>\n"); avio_flush(out); ff_format_io_close(s, &out); if (use_rename) return avpriv_io_move(temp_filename, s->filename); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVFormatContext *VAR_0, int VAR_1) { DASHContext *c = VAR_0->priv_data; AVIOContext *out; char VAR_2[1024]; int VAR_3, VAR_4; const char *VAR_5 = avio_find_protocol_name(VAR_0->filename); int VAR_6 = VAR_5 && !strcmp(VAR_5, "file"); static unsigned int VAR_7 = 0; AVDictionaryEntry *title = av_dict_get(VAR_0->metadata, "title", NULL, 0); if (!VAR_6 && !VAR_7++) av_log(VAR_0, AV_LOG_ERROR, "Cannot use rename on non file protocol, this may lead to races and temporary partial files\n"); snprintf(VAR_2, sizeof(VAR_2), VAR_6 ? "%VAR_0.tmp" : "%VAR_0", VAR_0->filename); VAR_3 = VAR_0->io_open(VAR_0, &out, VAR_2, AVIO_FLAG_WRITE, NULL); if (VAR_3 < 0) { av_log(VAR_0, AV_LOG_ERROR, "Unable to open %VAR_0 for writing\n", VAR_2); return VAR_3; } avio_printf(out, "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"); avio_printf(out, "<MPD xmlns:xsi=\"http: "\txmlns=\"urn:mpeg:dash:schema:mpd:2011\"\n" "\txmlns:xlink=\"http: "\txsi:schemaLocation=\"urn:mpeg:DASH:schema:MPD:2011 http: "\tprofiles=\"urn:mpeg:dash:profile:isoff-live:2011\"\n" "\ttype=\"%VAR_0\"\n", VAR_1 ? "static" : "dynamic"); if (VAR_1) { avio_printf(out, "\tmediaPresentationDuration=\""); write_time(out, c->total_duration); avio_printf(out, "\"\n"); } else { int64_t update_period = c->last_duration / AV_TIME_BASE; char VAR_8[100]; if (c->use_template && !c->use_timeline) update_period = 500; avio_printf(out, "\tminimumUpdatePeriod=\"PT%"PRId64"S\"\n", update_period); avio_printf(out, "\tsuggestedPresentationDelay=\"PT%"PRId64"S\"\n", c->last_duration / AV_TIME_BASE); if (!c->availability_start_time[0] && VAR_0->nb_streams > 0 && c->streams[0].nb_segments > 0) { format_date_now(c->availability_start_time, sizeof(c->availability_start_time)); } if (c->availability_start_time[0]) avio_printf(out, "\tavailabilityStartTime=\"%VAR_0\"\n", c->availability_start_time); format_date_now(VAR_8, sizeof(VAR_8)); if (VAR_8[0]) avio_printf(out, "\tpublishTime=\"%VAR_0\"\n", VAR_8); if (c->window_size && c->use_template) { avio_printf(out, "\ttimeShiftBufferDepth=\""); write_time(out, c->last_duration * c->window_size); avio_printf(out, "\"\n"); } } avio_printf(out, "\tminBufferTime=\""); write_time(out, c->last_duration * 2); avio_printf(out, "\">\n"); avio_printf(out, "\t<ProgramInformation>\n"); if (title) { char *VAR_9 = xmlescape(title->value); avio_printf(out, "\t\t<Title>%VAR_0</Title>\n", VAR_9); av_free(VAR_9); } avio_printf(out, "\t</ProgramInformation>\n"); if (c->window_size && VAR_0->nb_streams > 0 && c->streams[0].nb_segments > 0 && !c->use_template) { OutputStream *os = &c->streams[0]; int VAR_10 = FFMAX(os->nb_segments - c->window_size, 0); int64_t start_time = av_rescale_q(os->segments[VAR_10]->time, VAR_0->streams[0]->time_base, AV_TIME_BASE_Q); avio_printf(out, "\t<Period id=\"0\" start=\""); write_time(out, start_time); avio_printf(out, "\">\n"); } else { avio_printf(out, "\t<Period id=\"0\" start=\"PT0.0S\">\n"); } for (VAR_4 = 0; VAR_4 < c->nb_as; VAR_4++) { if ((VAR_3 = write_adaptation_set(VAR_0, out, VAR_4)) < 0) return VAR_3; } avio_printf(out, "\t</Period>\n"); if (c->utc_timing_url) avio_printf(out, "\t<UTCTiming schemeIdUri=\"urn:mpeg:dash:utc:http-xsdate:2014\" value=\"%VAR_0\"/>\n", c->utc_timing_url); avio_printf(out, "</MPD>\n"); avio_flush(out); ff_format_io_close(VAR_0, &out); if (VAR_6) return avpriv_io_move(VAR_2, VAR_0->filename); return 0; }
[ "static int FUNC_0(AVFormatContext *VAR_0, int VAR_1)\n{", "DASHContext *c = VAR_0->priv_data;", "AVIOContext *out;", "char VAR_2[1024];", "int VAR_3, VAR_4;", "const char *VAR_5 = avio_find_protocol_name(VAR_0->filename);", "int VAR_6 = VAR_5 && !strcmp(VAR_5, \"file\");", "static unsigned int VAR_7 = 0;", "AVDictionaryEntry *title = av_dict_get(VAR_0->metadata, \"title\", NULL, 0);", "if (!VAR_6 && !VAR_7++)\nav_log(VAR_0, AV_LOG_ERROR, \"Cannot use rename on non file protocol, this may lead to races and temporary partial files\\n\");", "snprintf(VAR_2, sizeof(VAR_2), VAR_6 ? \"%VAR_0.tmp\" : \"%VAR_0\", VAR_0->filename);", "VAR_3 = VAR_0->io_open(VAR_0, &out, VAR_2, AVIO_FLAG_WRITE, NULL);", "if (VAR_3 < 0) {", "av_log(VAR_0, AV_LOG_ERROR, \"Unable to open %VAR_0 for writing\\n\", VAR_2);", "return VAR_3;", "}", "avio_printf(out, \"<?xml version=\\\"1.0\\\" encoding=\\\"utf-8\\\"?>\\n\");", "avio_printf(out, \"<MPD xmlns:xsi=\\\"http:\n\"\\txmlns=\\\"urn:mpeg:dash:schema:mpd:2011\\\"\\n\"\n\"\\txmlns:xlink=\\\"http:\n\"\\txsi:schemaLocation=\\\"urn:mpeg:DASH:schema:MPD:2011 http:\n\"\\tprofiles=\\\"urn:mpeg:dash:profile:isoff-live:2011\\\"\\n\"\n\"\\ttype=\\\"%VAR_0\\\"\\n\", VAR_1 ? \"static\" : \"dynamic\");", "if (VAR_1) {", "avio_printf(out, \"\\tmediaPresentationDuration=\\\"\");", "write_time(out, c->total_duration);", "avio_printf(out, \"\\\"\\n\");", "} else {", "int64_t update_period = c->last_duration / AV_TIME_BASE;", "char VAR_8[100];", "if (c->use_template && !c->use_timeline)\nupdate_period = 500;", "avio_printf(out, \"\\tminimumUpdatePeriod=\\\"PT%\"PRId64\"S\\\"\\n\", update_period);", "avio_printf(out, \"\\tsuggestedPresentationDelay=\\\"PT%\"PRId64\"S\\\"\\n\", c->last_duration / AV_TIME_BASE);", "if (!c->availability_start_time[0] && VAR_0->nb_streams > 0 && c->streams[0].nb_segments > 0) {", "format_date_now(c->availability_start_time, sizeof(c->availability_start_time));", "}", "if (c->availability_start_time[0])\navio_printf(out, \"\\tavailabilityStartTime=\\\"%VAR_0\\\"\\n\", c->availability_start_time);", "format_date_now(VAR_8, sizeof(VAR_8));", "if (VAR_8[0])\navio_printf(out, \"\\tpublishTime=\\\"%VAR_0\\\"\\n\", VAR_8);", "if (c->window_size && c->use_template) {", "avio_printf(out, \"\\ttimeShiftBufferDepth=\\\"\");", "write_time(out, c->last_duration * c->window_size);", "avio_printf(out, \"\\\"\\n\");", "}", "}", "avio_printf(out, \"\\tminBufferTime=\\\"\");", "write_time(out, c->last_duration * 2);", "avio_printf(out, \"\\\">\\n\");", "avio_printf(out, \"\\t<ProgramInformation>\\n\");", "if (title) {", "char *VAR_9 = xmlescape(title->value);", "avio_printf(out, \"\\t\\t<Title>%VAR_0</Title>\\n\", VAR_9);", "av_free(VAR_9);", "}", "avio_printf(out, \"\\t</ProgramInformation>\\n\");", "if (c->window_size && VAR_0->nb_streams > 0 && c->streams[0].nb_segments > 0 && !c->use_template) {", "OutputStream *os = &c->streams[0];", "int VAR_10 = FFMAX(os->nb_segments - c->window_size, 0);", "int64_t start_time = av_rescale_q(os->segments[VAR_10]->time, VAR_0->streams[0]->time_base, AV_TIME_BASE_Q);", "avio_printf(out, \"\\t<Period id=\\\"0\\\" start=\\\"\");", "write_time(out, start_time);", "avio_printf(out, \"\\\">\\n\");", "} else {", "avio_printf(out, \"\\t<Period id=\\\"0\\\" start=\\\"PT0.0S\\\">\\n\");", "}", "for (VAR_4 = 0; VAR_4 < c->nb_as; VAR_4++) {", "if ((VAR_3 = write_adaptation_set(VAR_0, out, VAR_4)) < 0)\nreturn VAR_3;", "}", "avio_printf(out, \"\\t</Period>\\n\");", "if (c->utc_timing_url)\navio_printf(out, \"\\t<UTCTiming schemeIdUri=\\\"urn:mpeg:dash:utc:http-xsdate:2014\\\" value=\\\"%VAR_0\\\"/>\\n\", c->utc_timing_url);", "avio_printf(out, \"</MPD>\\n\");", "avio_flush(out);", "ff_format_io_close(VAR_0, &out);", "if (VAR_6)\nreturn avpriv_io_move(VAR_2, VAR_0->filename);", "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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 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 ], [ 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 ], [ 149 ], [ 151, 153 ], [ 155 ], [ 157 ], [ 161, 163 ], [ 167 ], [ 169 ], [ 171 ], [ 175, 177 ], [ 181 ], [ 183 ] ]
15,488
static void curl_close(BlockDriverState *bs) { BDRVCURLState *s = bs->opaque; int i; DPRINTF("CURL: Close\n"); for (i=0; i<CURL_NUM_STATES; i++) { if (s->states[i].in_use) curl_clean_state(&s->states[i]); if (s->states[i].curl) { curl_easy_cleanup(s->states[i].curl); s->states[i].curl = NULL; } if (s->states[i].orig_buf) { g_free(s->states[i].orig_buf); s->states[i].orig_buf = NULL; } } if (s->multi) curl_multi_cleanup(s->multi); timer_del(&s->timer); g_free(s->url); }
false
qemu
63f0f45f2e89b60ff8245fec81328ddfde42a303
static void curl_close(BlockDriverState *bs) { BDRVCURLState *s = bs->opaque; int i; DPRINTF("CURL: Close\n"); for (i=0; i<CURL_NUM_STATES; i++) { if (s->states[i].in_use) curl_clean_state(&s->states[i]); if (s->states[i].curl) { curl_easy_cleanup(s->states[i].curl); s->states[i].curl = NULL; } if (s->states[i].orig_buf) { g_free(s->states[i].orig_buf); s->states[i].orig_buf = NULL; } } if (s->multi) curl_multi_cleanup(s->multi); timer_del(&s->timer); g_free(s->url); }
{ "code": [], "line_no": [] }
static void FUNC_0(BlockDriverState *VAR_0) { BDRVCURLState *s = VAR_0->opaque; int VAR_1; DPRINTF("CURL: Close\n"); for (VAR_1=0; VAR_1<CURL_NUM_STATES; VAR_1++) { if (s->states[VAR_1].in_use) curl_clean_state(&s->states[VAR_1]); if (s->states[VAR_1].curl) { curl_easy_cleanup(s->states[VAR_1].curl); s->states[VAR_1].curl = NULL; } if (s->states[VAR_1].orig_buf) { g_free(s->states[VAR_1].orig_buf); s->states[VAR_1].orig_buf = NULL; } } if (s->multi) curl_multi_cleanup(s->multi); timer_del(&s->timer); g_free(s->url); }
[ "static void FUNC_0(BlockDriverState *VAR_0)\n{", "BDRVCURLState *s = VAR_0->opaque;", "int VAR_1;", "DPRINTF(\"CURL: Close\\n\");", "for (VAR_1=0; VAR_1<CURL_NUM_STATES; VAR_1++) {", "if (s->states[VAR_1].in_use)\ncurl_clean_state(&s->states[VAR_1]);", "if (s->states[VAR_1].curl) {", "curl_easy_cleanup(s->states[VAR_1].curl);", "s->states[VAR_1].curl = NULL;", "}", "if (s->states[VAR_1].orig_buf) {", "g_free(s->states[VAR_1].orig_buf);", "s->states[VAR_1].orig_buf = NULL;", "}", "}", "if (s->multi)\ncurl_multi_cleanup(s->multi);", "timer_del(&s->timer);", "g_free(s->url);", "}" ]
[ 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 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37, 39 ], [ 43 ], [ 47 ], [ 49 ] ]
15,490
if_output(struct socket *so, struct mbuf *ifm) { struct mbuf *ifq; int on_fastq = 1; DEBUG_CALL("if_output"); DEBUG_ARG("so = %lx", (long)so); DEBUG_ARG("ifm = %lx", (long)ifm); /* * First remove the mbuf from m_usedlist, * since we're gonna use m_next and m_prev ourselves * XXX Shouldn't need this, gotta change dtom() etc. */ if (ifm->m_flags & M_USEDLIST) { remque(ifm); ifm->m_flags &= ~M_USEDLIST; } /* * See if there's already a batchq list for this session. * This can include an interactive session, which should go on fastq, * but gets too greedy... hence it'll be downgraded from fastq to batchq. * We mustn't put this packet back on the fastq (or we'll send it out of order) * XXX add cache here? */ for (ifq = if_batchq.ifq_prev; ifq != &if_batchq; ifq = ifq->ifq_prev) { if (so == ifq->ifq_so) { /* A match! */ ifm->ifq_so = so; ifs_insque(ifm, ifq->ifs_prev); goto diddit; } } /* No match, check which queue to put it on */ if (so && (so->so_iptos & IPTOS_LOWDELAY)) { ifq = if_fastq.ifq_prev; on_fastq = 1; /* * Check if this packet is a part of the last * packet's session */ if (ifq->ifq_so == so) { ifm->ifq_so = so; ifs_insque(ifm, ifq->ifs_prev); goto diddit; } } else ifq = if_batchq.ifq_prev; /* Create a new doubly linked list for this session */ ifm->ifq_so = so; ifs_init(ifm); insque(ifm, ifq); diddit: ++if_queued; if (so) { /* Update *_queued */ so->so_queued++; so->so_nqueued++; /* * Check if the interactive session should be downgraded to * the batchq. A session is downgraded if it has queued 6 * packets without pausing, and at least 3 of those packets * have been sent over the link * (XXX These are arbitrary numbers, probably not optimal..) */ if (on_fastq && ((so->so_nqueued >= 6) && (so->so_nqueued - so->so_queued) >= 3)) { /* Remove from current queue... */ remque(ifm->ifs_next); /* ...And insert in the new. That'll teach ya! */ insque(ifm->ifs_next, &if_batchq); } } #ifndef FULL_BOLT /* * This prevents us from malloc()ing too many mbufs */ if (link_up) { /* if_start will check towrite */ if_start(); } #endif }
false
qemu
b5302e1a9d8a47bd29a3e1876fba34be111728a2
if_output(struct socket *so, struct mbuf *ifm) { struct mbuf *ifq; int on_fastq = 1; DEBUG_CALL("if_output"); DEBUG_ARG("so = %lx", (long)so); DEBUG_ARG("ifm = %lx", (long)ifm); if (ifm->m_flags & M_USEDLIST) { remque(ifm); ifm->m_flags &= ~M_USEDLIST; } for (ifq = if_batchq.ifq_prev; ifq != &if_batchq; ifq = ifq->ifq_prev) { if (so == ifq->ifq_so) { ifm->ifq_so = so; ifs_insque(ifm, ifq->ifs_prev); goto diddit; } } if (so && (so->so_iptos & IPTOS_LOWDELAY)) { ifq = if_fastq.ifq_prev; on_fastq = 1; if (ifq->ifq_so == so) { ifm->ifq_so = so; ifs_insque(ifm, ifq->ifs_prev); goto diddit; } } else ifq = if_batchq.ifq_prev; ifm->ifq_so = so; ifs_init(ifm); insque(ifm, ifq); diddit: ++if_queued; if (so) { so->so_queued++; so->so_nqueued++; if (on_fastq && ((so->so_nqueued >= 6) && (so->so_nqueued - so->so_queued) >= 3)) { remque(ifm->ifs_next); insque(ifm->ifs_next, &if_batchq); } } #ifndef FULL_BOLT if (link_up) { if_start(); } #endif }
{ "code": [], "line_no": [] }
FUNC_0(struct socket *VAR_0, struct mbuf *VAR_1) { struct mbuf *VAR_2; int VAR_3 = 1; DEBUG_CALL("FUNC_0"); DEBUG_ARG("VAR_0 = %lx", (long)VAR_0); DEBUG_ARG("VAR_1 = %lx", (long)VAR_1); if (VAR_1->m_flags & M_USEDLIST) { remque(VAR_1); VAR_1->m_flags &= ~M_USEDLIST; } for (VAR_2 = if_batchq.ifq_prev; VAR_2 != &if_batchq; VAR_2 = VAR_2->ifq_prev) { if (VAR_0 == VAR_2->ifq_so) { VAR_1->ifq_so = VAR_0; ifs_insque(VAR_1, VAR_2->ifs_prev); goto diddit; } } if (VAR_0 && (VAR_0->so_iptos & IPTOS_LOWDELAY)) { VAR_2 = if_fastq.ifq_prev; VAR_3 = 1; if (VAR_2->ifq_so == VAR_0) { VAR_1->ifq_so = VAR_0; ifs_insque(VAR_1, VAR_2->ifs_prev); goto diddit; } } else VAR_2 = if_batchq.ifq_prev; VAR_1->ifq_so = VAR_0; ifs_init(VAR_1); insque(VAR_1, VAR_2); diddit: ++if_queued; if (VAR_0) { VAR_0->so_queued++; VAR_0->so_nqueued++; if (VAR_3 && ((VAR_0->so_nqueued >= 6) && (VAR_0->so_nqueued - VAR_0->so_queued) >= 3)) { remque(VAR_1->ifs_next); insque(VAR_1->ifs_next, &if_batchq); } } #ifndef FULL_BOLT if (link_up) { if_start(); } #endif }
[ "FUNC_0(struct socket *VAR_0, struct mbuf *VAR_1)\n{", "struct mbuf *VAR_2;", "int VAR_3 = 1;", "DEBUG_CALL(\"FUNC_0\");", "DEBUG_ARG(\"VAR_0 = %lx\", (long)VAR_0);", "DEBUG_ARG(\"VAR_1 = %lx\", (long)VAR_1);", "if (VAR_1->m_flags & M_USEDLIST) {", "remque(VAR_1);", "VAR_1->m_flags &= ~M_USEDLIST;", "}", "for (VAR_2 = if_batchq.ifq_prev; VAR_2 != &if_batchq; VAR_2 = VAR_2->ifq_prev) {", "if (VAR_0 == VAR_2->ifq_so) {", "VAR_1->ifq_so = VAR_0;", "ifs_insque(VAR_1, VAR_2->ifs_prev);", "goto diddit;", "}", "}", "if (VAR_0 && (VAR_0->so_iptos & IPTOS_LOWDELAY)) {", "VAR_2 = if_fastq.ifq_prev;", "VAR_3 = 1;", "if (VAR_2->ifq_so == VAR_0) {", "VAR_1->ifq_so = VAR_0;", "ifs_insque(VAR_1, VAR_2->ifs_prev);", "goto diddit;", "}", "} else", "VAR_2 = if_batchq.ifq_prev;", "VAR_1->ifq_so = VAR_0;", "ifs_init(VAR_1);", "insque(VAR_1, VAR_2);", "diddit:\n++if_queued;", "if (VAR_0) {", "VAR_0->so_queued++;", "VAR_0->so_nqueued++;", "if (VAR_3 && ((VAR_0->so_nqueued >= 6) &&\n(VAR_0->so_nqueued - VAR_0->so_queued) >= 3)) {", "remque(VAR_1->ifs_next);", "insque(VAR_1->ifs_next, &if_batchq);", "}", "}", "#ifndef FULL_BOLT\nif (link_up) {", "if_start();", "}", "#endif\n}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 53 ], [ 55 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 73 ], [ 75 ], [ 77 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 105 ], [ 107 ], [ 109 ], [ 113, 115 ], [ 119 ], [ 123 ], [ 125 ], [ 141, 143 ], [ 149 ], [ 155 ], [ 157 ], [ 159 ], [ 163, 171 ], [ 175 ], [ 177 ], [ 179, 181 ] ]
15,491
static int ne2000_can_receive(void *opaque) { NE2000State *s = opaque; if (s->cmd & E8390_STOP) return 1; return !ne2000_buffer_full(s); }
false
qemu
e3f5ec2b5e92706e3b807059f79b1fb5d936e567
static int ne2000_can_receive(void *opaque) { NE2000State *s = opaque; if (s->cmd & E8390_STOP) return 1; return !ne2000_buffer_full(s); }
{ "code": [], "line_no": [] }
static int FUNC_0(void *VAR_0) { NE2000State *s = VAR_0; if (s->cmd & E8390_STOP) return 1; return !ne2000_buffer_full(s); }
[ "static int FUNC_0(void *VAR_0)\n{", "NE2000State *s = VAR_0;", "if (s->cmd & E8390_STOP)\nreturn 1;", "return !ne2000_buffer_full(s);", "}" ]
[ 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9, 11 ], [ 13 ], [ 15 ] ]
15,493
static void *bochs_bios_init(void) { void *fw_cfg; uint8_t *smbios_table; size_t smbios_len; uint64_t *numa_fw_cfg; int i, j; register_ioport_write(0x400, 1, 2, bochs_bios_write, NULL); register_ioport_write(0x401, 1, 2, bochs_bios_write, NULL); register_ioport_write(0x402, 1, 1, bochs_bios_write, NULL); register_ioport_write(0x403, 1, 1, bochs_bios_write, NULL); register_ioport_write(0x8900, 1, 1, bochs_bios_write, NULL); register_ioport_write(0x501, 1, 1, bochs_bios_write, NULL); register_ioport_write(0x501, 1, 2, bochs_bios_write, NULL); register_ioport_write(0x502, 1, 2, bochs_bios_write, NULL); register_ioport_write(0x500, 1, 1, bochs_bios_write, NULL); register_ioport_write(0x503, 1, 1, bochs_bios_write, NULL); fw_cfg = fw_cfg_init(BIOS_CFG_IOPORT, BIOS_CFG_IOPORT + 1, 0, 0); fw_cfg_add_i32(fw_cfg, FW_CFG_ID, 1); fw_cfg_add_i64(fw_cfg, FW_CFG_RAM_SIZE, (uint64_t)ram_size); fw_cfg_add_bytes(fw_cfg, FW_CFG_ACPI_TABLES, (uint8_t *)acpi_tables, acpi_tables_len); fw_cfg_add_bytes(fw_cfg, FW_CFG_IRQ0_OVERRIDE, &irq0override, 1); smbios_table = smbios_get_table(&smbios_len); if (smbios_table) fw_cfg_add_bytes(fw_cfg, FW_CFG_SMBIOS_ENTRIES, smbios_table, smbios_len); fw_cfg_add_bytes(fw_cfg, FW_CFG_E820_TABLE, (uint8_t *)&e820_table, sizeof(struct e820_table)); fw_cfg_add_bytes(fw_cfg, FW_CFG_HPET, (uint8_t *)&hpet_cfg, sizeof(struct hpet_fw_config)); /* allocate memory for the NUMA channel: one (64bit) word for the number * of nodes, one word for each VCPU->node and one word for each node to * hold the amount of memory. */ numa_fw_cfg = g_malloc0((1 + max_cpus + nb_numa_nodes) * 8); numa_fw_cfg[0] = cpu_to_le64(nb_numa_nodes); for (i = 0; i < max_cpus; i++) { for (j = 0; j < nb_numa_nodes; j++) { if (node_cpumask[j] & (1 << i)) { numa_fw_cfg[i + 1] = cpu_to_le64(j); break; } } } for (i = 0; i < nb_numa_nodes; i++) { numa_fw_cfg[max_cpus + 1 + i] = cpu_to_le64(node_mem[i]); } fw_cfg_add_bytes(fw_cfg, FW_CFG_NUMA, (uint8_t *)numa_fw_cfg, (1 + max_cpus + nb_numa_nodes) * 8); return fw_cfg; }
false
qemu
9b5b76d44930dc9266bb6d30862704cb3c86d2ca
static void *bochs_bios_init(void) { void *fw_cfg; uint8_t *smbios_table; size_t smbios_len; uint64_t *numa_fw_cfg; int i, j; register_ioport_write(0x400, 1, 2, bochs_bios_write, NULL); register_ioport_write(0x401, 1, 2, bochs_bios_write, NULL); register_ioport_write(0x402, 1, 1, bochs_bios_write, NULL); register_ioport_write(0x403, 1, 1, bochs_bios_write, NULL); register_ioport_write(0x8900, 1, 1, bochs_bios_write, NULL); register_ioport_write(0x501, 1, 1, bochs_bios_write, NULL); register_ioport_write(0x501, 1, 2, bochs_bios_write, NULL); register_ioport_write(0x502, 1, 2, bochs_bios_write, NULL); register_ioport_write(0x500, 1, 1, bochs_bios_write, NULL); register_ioport_write(0x503, 1, 1, bochs_bios_write, NULL); fw_cfg = fw_cfg_init(BIOS_CFG_IOPORT, BIOS_CFG_IOPORT + 1, 0, 0); fw_cfg_add_i32(fw_cfg, FW_CFG_ID, 1); fw_cfg_add_i64(fw_cfg, FW_CFG_RAM_SIZE, (uint64_t)ram_size); fw_cfg_add_bytes(fw_cfg, FW_CFG_ACPI_TABLES, (uint8_t *)acpi_tables, acpi_tables_len); fw_cfg_add_bytes(fw_cfg, FW_CFG_IRQ0_OVERRIDE, &irq0override, 1); smbios_table = smbios_get_table(&smbios_len); if (smbios_table) fw_cfg_add_bytes(fw_cfg, FW_CFG_SMBIOS_ENTRIES, smbios_table, smbios_len); fw_cfg_add_bytes(fw_cfg, FW_CFG_E820_TABLE, (uint8_t *)&e820_table, sizeof(struct e820_table)); fw_cfg_add_bytes(fw_cfg, FW_CFG_HPET, (uint8_t *)&hpet_cfg, sizeof(struct hpet_fw_config)); numa_fw_cfg = g_malloc0((1 + max_cpus + nb_numa_nodes) * 8); numa_fw_cfg[0] = cpu_to_le64(nb_numa_nodes); for (i = 0; i < max_cpus; i++) { for (j = 0; j < nb_numa_nodes; j++) { if (node_cpumask[j] & (1 << i)) { numa_fw_cfg[i + 1] = cpu_to_le64(j); break; } } } for (i = 0; i < nb_numa_nodes; i++) { numa_fw_cfg[max_cpus + 1 + i] = cpu_to_le64(node_mem[i]); } fw_cfg_add_bytes(fw_cfg, FW_CFG_NUMA, (uint8_t *)numa_fw_cfg, (1 + max_cpus + nb_numa_nodes) * 8); return fw_cfg; }
{ "code": [], "line_no": [] }
static void *FUNC_0(void) { void *VAR_0; uint8_t *smbios_table; size_t smbios_len; uint64_t *numa_fw_cfg; int VAR_1, VAR_2; register_ioport_write(0x400, 1, 2, bochs_bios_write, NULL); register_ioport_write(0x401, 1, 2, bochs_bios_write, NULL); register_ioport_write(0x402, 1, 1, bochs_bios_write, NULL); register_ioport_write(0x403, 1, 1, bochs_bios_write, NULL); register_ioport_write(0x8900, 1, 1, bochs_bios_write, NULL); register_ioport_write(0x501, 1, 1, bochs_bios_write, NULL); register_ioport_write(0x501, 1, 2, bochs_bios_write, NULL); register_ioport_write(0x502, 1, 2, bochs_bios_write, NULL); register_ioport_write(0x500, 1, 1, bochs_bios_write, NULL); register_ioport_write(0x503, 1, 1, bochs_bios_write, NULL); VAR_0 = fw_cfg_init(BIOS_CFG_IOPORT, BIOS_CFG_IOPORT + 1, 0, 0); fw_cfg_add_i32(VAR_0, FW_CFG_ID, 1); fw_cfg_add_i64(VAR_0, FW_CFG_RAM_SIZE, (uint64_t)ram_size); fw_cfg_add_bytes(VAR_0, FW_CFG_ACPI_TABLES, (uint8_t *)acpi_tables, acpi_tables_len); fw_cfg_add_bytes(VAR_0, FW_CFG_IRQ0_OVERRIDE, &irq0override, 1); smbios_table = smbios_get_table(&smbios_len); if (smbios_table) fw_cfg_add_bytes(VAR_0, FW_CFG_SMBIOS_ENTRIES, smbios_table, smbios_len); fw_cfg_add_bytes(VAR_0, FW_CFG_E820_TABLE, (uint8_t *)&e820_table, sizeof(struct e820_table)); fw_cfg_add_bytes(VAR_0, FW_CFG_HPET, (uint8_t *)&hpet_cfg, sizeof(struct hpet_fw_config)); numa_fw_cfg = g_malloc0((1 + max_cpus + nb_numa_nodes) * 8); numa_fw_cfg[0] = cpu_to_le64(nb_numa_nodes); for (VAR_1 = 0; VAR_1 < max_cpus; VAR_1++) { for (VAR_2 = 0; VAR_2 < nb_numa_nodes; VAR_2++) { if (node_cpumask[VAR_2] & (1 << VAR_1)) { numa_fw_cfg[VAR_1 + 1] = cpu_to_le64(VAR_2); break; } } } for (VAR_1 = 0; VAR_1 < nb_numa_nodes; VAR_1++) { numa_fw_cfg[max_cpus + 1 + VAR_1] = cpu_to_le64(node_mem[VAR_1]); } fw_cfg_add_bytes(VAR_0, FW_CFG_NUMA, (uint8_t *)numa_fw_cfg, (1 + max_cpus + nb_numa_nodes) * 8); return VAR_0; }
[ "static void *FUNC_0(void)\n{", "void *VAR_0;", "uint8_t *smbios_table;", "size_t smbios_len;", "uint64_t *numa_fw_cfg;", "int VAR_1, VAR_2;", "register_ioport_write(0x400, 1, 2, bochs_bios_write, NULL);", "register_ioport_write(0x401, 1, 2, bochs_bios_write, NULL);", "register_ioport_write(0x402, 1, 1, bochs_bios_write, NULL);", "register_ioport_write(0x403, 1, 1, bochs_bios_write, NULL);", "register_ioport_write(0x8900, 1, 1, bochs_bios_write, NULL);", "register_ioport_write(0x501, 1, 1, bochs_bios_write, NULL);", "register_ioport_write(0x501, 1, 2, bochs_bios_write, NULL);", "register_ioport_write(0x502, 1, 2, bochs_bios_write, NULL);", "register_ioport_write(0x500, 1, 1, bochs_bios_write, NULL);", "register_ioport_write(0x503, 1, 1, bochs_bios_write, NULL);", "VAR_0 = fw_cfg_init(BIOS_CFG_IOPORT, BIOS_CFG_IOPORT + 1, 0, 0);", "fw_cfg_add_i32(VAR_0, FW_CFG_ID, 1);", "fw_cfg_add_i64(VAR_0, FW_CFG_RAM_SIZE, (uint64_t)ram_size);", "fw_cfg_add_bytes(VAR_0, FW_CFG_ACPI_TABLES, (uint8_t *)acpi_tables,\nacpi_tables_len);", "fw_cfg_add_bytes(VAR_0, FW_CFG_IRQ0_OVERRIDE, &irq0override, 1);", "smbios_table = smbios_get_table(&smbios_len);", "if (smbios_table)\nfw_cfg_add_bytes(VAR_0, FW_CFG_SMBIOS_ENTRIES,\nsmbios_table, smbios_len);", "fw_cfg_add_bytes(VAR_0, FW_CFG_E820_TABLE, (uint8_t *)&e820_table,\nsizeof(struct e820_table));", "fw_cfg_add_bytes(VAR_0, FW_CFG_HPET, (uint8_t *)&hpet_cfg,\nsizeof(struct hpet_fw_config));", "numa_fw_cfg = g_malloc0((1 + max_cpus + nb_numa_nodes) * 8);", "numa_fw_cfg[0] = cpu_to_le64(nb_numa_nodes);", "for (VAR_1 = 0; VAR_1 < max_cpus; VAR_1++) {", "for (VAR_2 = 0; VAR_2 < nb_numa_nodes; VAR_2++) {", "if (node_cpumask[VAR_2] & (1 << VAR_1)) {", "numa_fw_cfg[VAR_1 + 1] = cpu_to_le64(VAR_2);", "break;", "}", "}", "}", "for (VAR_1 = 0; VAR_1 < nb_numa_nodes; VAR_1++) {", "numa_fw_cfg[max_cpus + 1 + VAR_1] = cpu_to_le64(node_mem[VAR_1]);", "}", "fw_cfg_add_bytes(VAR_0, FW_CFG_NUMA, (uint8_t *)numa_fw_cfg,\n(1 + max_cpus + nb_numa_nodes) * 8);", "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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 45 ], [ 47 ], [ 49, 51 ], [ 53 ], [ 57 ], [ 59, 61, 63 ], [ 65, 67 ], [ 71, 73 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109, 111 ], [ 115 ], [ 117 ] ]
15,494
static int xen_pt_word_reg_read(XenPCIPassthroughState *s, XenPTReg *cfg_entry, uint16_t *value, uint16_t valid_mask) { XenPTRegInfo *reg = cfg_entry->reg; uint16_t valid_emu_mask = 0; /* emulate word register */ valid_emu_mask = reg->emu_mask & valid_mask; *value = XEN_PT_MERGE_VALUE(*value, cfg_entry->data, ~valid_emu_mask); return 0; }
false
qemu
e2779de053b64f023de382fd87b3596613d47d1e
static int xen_pt_word_reg_read(XenPCIPassthroughState *s, XenPTReg *cfg_entry, uint16_t *value, uint16_t valid_mask) { XenPTRegInfo *reg = cfg_entry->reg; uint16_t valid_emu_mask = 0; valid_emu_mask = reg->emu_mask & valid_mask; *value = XEN_PT_MERGE_VALUE(*value, cfg_entry->data, ~valid_emu_mask); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(XenPCIPassthroughState *VAR_0, XenPTReg *VAR_1, uint16_t *VAR_2, uint16_t VAR_3) { XenPTRegInfo *reg = VAR_1->reg; uint16_t valid_emu_mask = 0; valid_emu_mask = reg->emu_mask & VAR_3; *VAR_2 = XEN_PT_MERGE_VALUE(*VAR_2, VAR_1->data, ~valid_emu_mask); return 0; }
[ "static int FUNC_0(XenPCIPassthroughState *VAR_0, XenPTReg *VAR_1,\nuint16_t *VAR_2, uint16_t VAR_3)\n{", "XenPTRegInfo *reg = VAR_1->reg;", "uint16_t valid_emu_mask = 0;", "valid_emu_mask = reg->emu_mask & VAR_3;", "*VAR_2 = XEN_PT_MERGE_VALUE(*VAR_2, VAR_1->data, ~valid_emu_mask);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ] ]
15,496
static int img_rebase(int argc, char **argv) { BlockDriverState *bs, *bs_old_backing = NULL, *bs_new_backing = NULL; BlockDriver *old_backing_drv, *new_backing_drv; char *filename; const char *fmt, *cache, *out_basefmt, *out_baseimg; int c, flags, ret; int unsafe = 0; int progress = 0; /* Parse commandline parameters */ fmt = NULL; cache = BDRV_DEFAULT_CACHE; out_baseimg = NULL; out_basefmt = NULL; for(;;) { c = getopt(argc, argv, "uhf:F:b:pt:"); if (c == -1) { break; } switch(c) { case '?': case 'h': help(); return 0; case 'f': fmt = optarg; break; case 'F': out_basefmt = optarg; break; case 'b': out_baseimg = optarg; break; case 'u': unsafe = 1; break; case 'p': progress = 1; break; case 't': cache = optarg; break; } } if ((optind >= argc) || (!unsafe && !out_baseimg)) { help(); } filename = argv[optind++]; qemu_progress_init(progress, 2.0); qemu_progress_print(0, 100); flags = BDRV_O_RDWR | (unsafe ? BDRV_O_NO_BACKING : 0); ret = bdrv_parse_cache_flags(cache, &flags); if (ret < 0) { error_report("Invalid cache option: %s", cache); return -1; } /* * Open the images. * * Ignore the old backing file for unsafe rebase in case we want to correct * the reference to a renamed or moved backing file. */ bs = bdrv_new_open(filename, fmt, flags); if (!bs) { return 1; } /* Find the right drivers for the backing files */ old_backing_drv = NULL; new_backing_drv = NULL; if (!unsafe && bs->backing_format[0] != '\0') { old_backing_drv = bdrv_find_format(bs->backing_format); if (old_backing_drv == NULL) { error_report("Invalid format name: '%s'", bs->backing_format); ret = -1; goto out; } } if (out_basefmt != NULL) { new_backing_drv = bdrv_find_format(out_basefmt); if (new_backing_drv == NULL) { error_report("Invalid format name: '%s'", out_basefmt); ret = -1; goto out; } } /* For safe rebasing we need to compare old and new backing file */ if (unsafe) { /* Make the compiler happy */ bs_old_backing = NULL; bs_new_backing = NULL; } else { char backing_name[1024]; bs_old_backing = bdrv_new("old_backing"); bdrv_get_backing_filename(bs, backing_name, sizeof(backing_name)); ret = bdrv_open(bs_old_backing, backing_name, BDRV_O_FLAGS, old_backing_drv); if (ret) { error_report("Could not open old backing file '%s'", backing_name); goto out; } bs_new_backing = bdrv_new("new_backing"); ret = bdrv_open(bs_new_backing, out_baseimg, BDRV_O_FLAGS, new_backing_drv); if (ret) { error_report("Could not open new backing file '%s'", out_baseimg); goto out; } } /* * Check each unallocated cluster in the COW file. If it is unallocated, * accesses go to the backing file. We must therefore compare this cluster * in the old and new backing file, and if they differ we need to copy it * from the old backing file into the COW file. * * If qemu-img crashes during this step, no harm is done. The content of * the image is the same as the original one at any time. */ if (!unsafe) { uint64_t num_sectors; uint64_t old_backing_num_sectors; uint64_t new_backing_num_sectors; uint64_t sector; int n; uint8_t * buf_old; uint8_t * buf_new; float local_progress; buf_old = qemu_blockalign(bs, IO_BUF_SIZE); buf_new = qemu_blockalign(bs, IO_BUF_SIZE); bdrv_get_geometry(bs, &num_sectors); bdrv_get_geometry(bs_old_backing, &old_backing_num_sectors); bdrv_get_geometry(bs_new_backing, &new_backing_num_sectors); local_progress = (float)100 / (num_sectors / MIN(num_sectors, IO_BUF_SIZE / 512)); for (sector = 0; sector < num_sectors; sector += n) { /* How many sectors can we handle with the next read? */ if (sector + (IO_BUF_SIZE / 512) <= num_sectors) { n = (IO_BUF_SIZE / 512); } else { n = num_sectors - sector; } /* If the cluster is allocated, we don't need to take action */ ret = bdrv_is_allocated(bs, sector, n, &n); if (ret) { continue; } /* * Read old and new backing file and take into consideration that * backing files may be smaller than the COW image. */ if (sector >= old_backing_num_sectors) { memset(buf_old, 0, n * BDRV_SECTOR_SIZE); } else { if (sector + n > old_backing_num_sectors) { n = old_backing_num_sectors - sector; } ret = bdrv_read(bs_old_backing, sector, buf_old, n); if (ret < 0) { error_report("error while reading from old backing file"); goto out; } } if (sector >= new_backing_num_sectors) { memset(buf_new, 0, n * BDRV_SECTOR_SIZE); } else { if (sector + n > new_backing_num_sectors) { n = new_backing_num_sectors - sector; } ret = bdrv_read(bs_new_backing, sector, buf_new, n); if (ret < 0) { error_report("error while reading from new backing file"); goto out; } } /* If they differ, we need to write to the COW file */ uint64_t written = 0; while (written < n) { int pnum; if (compare_sectors(buf_old + written * 512, buf_new + written * 512, n - written, &pnum)) { ret = bdrv_write(bs, sector + written, buf_old + written * 512, pnum); if (ret < 0) { error_report("Error while writing to COW image: %s", strerror(-ret)); goto out; } } written += pnum; } qemu_progress_print(local_progress, 100); } qemu_vfree(buf_old); qemu_vfree(buf_new); } /* * Change the backing file. All clusters that are different from the old * backing file are overwritten in the COW file now, so the visible content * doesn't change when we switch the backing file. */ ret = bdrv_change_backing_file(bs, out_baseimg, out_basefmt); if (ret == -ENOSPC) { error_report("Could not change the backing file to '%s': No " "space left in the file header", out_baseimg); } else if (ret < 0) { error_report("Could not change the backing file to '%s': %s", out_baseimg, strerror(-ret)); } qemu_progress_print(100, 0); /* * TODO At this point it is possible to check if any clusters that are * allocated in the COW file are the same in the backing file. If so, they * could be dropped from the COW file. Don't do this before switching the * backing file, in case of a crash this would lead to corruption. */ out: qemu_progress_end(); /* Cleanup */ if (!unsafe) { if (bs_old_backing != NULL) { bdrv_delete(bs_old_backing); } if (bs_new_backing != NULL) { bdrv_delete(bs_new_backing); } } bdrv_delete(bs); if (ret) { return 1; } return 0; }
false
qemu
f0536bb848ad6eb2709a7dc675f261bd160c751b
static int img_rebase(int argc, char **argv) { BlockDriverState *bs, *bs_old_backing = NULL, *bs_new_backing = NULL; BlockDriver *old_backing_drv, *new_backing_drv; char *filename; const char *fmt, *cache, *out_basefmt, *out_baseimg; int c, flags, ret; int unsafe = 0; int progress = 0; fmt = NULL; cache = BDRV_DEFAULT_CACHE; out_baseimg = NULL; out_basefmt = NULL; for(;;) { c = getopt(argc, argv, "uhf:F:b:pt:"); if (c == -1) { break; } switch(c) { case '?': case 'h': help(); return 0; case 'f': fmt = optarg; break; case 'F': out_basefmt = optarg; break; case 'b': out_baseimg = optarg; break; case 'u': unsafe = 1; break; case 'p': progress = 1; break; case 't': cache = optarg; break; } } if ((optind >= argc) || (!unsafe && !out_baseimg)) { help(); } filename = argv[optind++]; qemu_progress_init(progress, 2.0); qemu_progress_print(0, 100); flags = BDRV_O_RDWR | (unsafe ? BDRV_O_NO_BACKING : 0); ret = bdrv_parse_cache_flags(cache, &flags); if (ret < 0) { error_report("Invalid cache option: %s", cache); return -1; } bs = bdrv_new_open(filename, fmt, flags); if (!bs) { return 1; } old_backing_drv = NULL; new_backing_drv = NULL; if (!unsafe && bs->backing_format[0] != '\0') { old_backing_drv = bdrv_find_format(bs->backing_format); if (old_backing_drv == NULL) { error_report("Invalid format name: '%s'", bs->backing_format); ret = -1; goto out; } } if (out_basefmt != NULL) { new_backing_drv = bdrv_find_format(out_basefmt); if (new_backing_drv == NULL) { error_report("Invalid format name: '%s'", out_basefmt); ret = -1; goto out; } } if (unsafe) { bs_old_backing = NULL; bs_new_backing = NULL; } else { char backing_name[1024]; bs_old_backing = bdrv_new("old_backing"); bdrv_get_backing_filename(bs, backing_name, sizeof(backing_name)); ret = bdrv_open(bs_old_backing, backing_name, BDRV_O_FLAGS, old_backing_drv); if (ret) { error_report("Could not open old backing file '%s'", backing_name); goto out; } bs_new_backing = bdrv_new("new_backing"); ret = bdrv_open(bs_new_backing, out_baseimg, BDRV_O_FLAGS, new_backing_drv); if (ret) { error_report("Could not open new backing file '%s'", out_baseimg); goto out; } } if (!unsafe) { uint64_t num_sectors; uint64_t old_backing_num_sectors; uint64_t new_backing_num_sectors; uint64_t sector; int n; uint8_t * buf_old; uint8_t * buf_new; float local_progress; buf_old = qemu_blockalign(bs, IO_BUF_SIZE); buf_new = qemu_blockalign(bs, IO_BUF_SIZE); bdrv_get_geometry(bs, &num_sectors); bdrv_get_geometry(bs_old_backing, &old_backing_num_sectors); bdrv_get_geometry(bs_new_backing, &new_backing_num_sectors); local_progress = (float)100 / (num_sectors / MIN(num_sectors, IO_BUF_SIZE / 512)); for (sector = 0; sector < num_sectors; sector += n) { if (sector + (IO_BUF_SIZE / 512) <= num_sectors) { n = (IO_BUF_SIZE / 512); } else { n = num_sectors - sector; } ret = bdrv_is_allocated(bs, sector, n, &n); if (ret) { continue; } if (sector >= old_backing_num_sectors) { memset(buf_old, 0, n * BDRV_SECTOR_SIZE); } else { if (sector + n > old_backing_num_sectors) { n = old_backing_num_sectors - sector; } ret = bdrv_read(bs_old_backing, sector, buf_old, n); if (ret < 0) { error_report("error while reading from old backing file"); goto out; } } if (sector >= new_backing_num_sectors) { memset(buf_new, 0, n * BDRV_SECTOR_SIZE); } else { if (sector + n > new_backing_num_sectors) { n = new_backing_num_sectors - sector; } ret = bdrv_read(bs_new_backing, sector, buf_new, n); if (ret < 0) { error_report("error while reading from new backing file"); goto out; } } uint64_t written = 0; while (written < n) { int pnum; if (compare_sectors(buf_old + written * 512, buf_new + written * 512, n - written, &pnum)) { ret = bdrv_write(bs, sector + written, buf_old + written * 512, pnum); if (ret < 0) { error_report("Error while writing to COW image: %s", strerror(-ret)); goto out; } } written += pnum; } qemu_progress_print(local_progress, 100); } qemu_vfree(buf_old); qemu_vfree(buf_new); } ret = bdrv_change_backing_file(bs, out_baseimg, out_basefmt); if (ret == -ENOSPC) { error_report("Could not change the backing file to '%s': No " "space left in the file header", out_baseimg); } else if (ret < 0) { error_report("Could not change the backing file to '%s': %s", out_baseimg, strerror(-ret)); } qemu_progress_print(100, 0); out: qemu_progress_end(); if (!unsafe) { if (bs_old_backing != NULL) { bdrv_delete(bs_old_backing); } if (bs_new_backing != NULL) { bdrv_delete(bs_new_backing); } } bdrv_delete(bs); if (ret) { return 1; } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(int VAR_0, char **VAR_1) { BlockDriverState *bs, *bs_old_backing = NULL, *bs_new_backing = NULL; BlockDriver *old_backing_drv, *new_backing_drv; char *VAR_2; const char *VAR_3, *VAR_4, *VAR_5, *VAR_6; int VAR_7, VAR_8, VAR_9; int VAR_10 = 0; int VAR_11 = 0; VAR_3 = NULL; VAR_4 = BDRV_DEFAULT_CACHE; VAR_6 = NULL; VAR_5 = NULL; for(;;) { VAR_7 = getopt(VAR_0, VAR_1, "uhf:F:b:pt:"); if (VAR_7 == -1) { break; } switch(VAR_7) { case '?': case 'h': help(); return 0; case 'f': VAR_3 = optarg; break; case 'F': VAR_5 = optarg; break; case 'b': VAR_6 = optarg; break; case 'u': VAR_10 = 1; break; case 'p': VAR_11 = 1; break; case 't': VAR_4 = optarg; break; } } if ((optind >= VAR_0) || (!VAR_10 && !VAR_6)) { help(); } VAR_2 = VAR_1[optind++]; qemu_progress_init(VAR_11, 2.0); qemu_progress_print(0, 100); VAR_8 = BDRV_O_RDWR | (VAR_10 ? BDRV_O_NO_BACKING : 0); VAR_9 = bdrv_parse_cache_flags(VAR_4, &VAR_8); if (VAR_9 < 0) { error_report("Invalid VAR_4 option: %s", VAR_4); return -1; } bs = bdrv_new_open(VAR_2, VAR_3, VAR_8); if (!bs) { return 1; } old_backing_drv = NULL; new_backing_drv = NULL; if (!VAR_10 && bs->backing_format[0] != '\0') { old_backing_drv = bdrv_find_format(bs->backing_format); if (old_backing_drv == NULL) { error_report("Invalid format name: '%s'", bs->backing_format); VAR_9 = -1; goto out; } } if (VAR_5 != NULL) { new_backing_drv = bdrv_find_format(VAR_5); if (new_backing_drv == NULL) { error_report("Invalid format name: '%s'", VAR_5); VAR_9 = -1; goto out; } } if (VAR_10) { bs_old_backing = NULL; bs_new_backing = NULL; } else { char VAR_12[1024]; bs_old_backing = bdrv_new("old_backing"); bdrv_get_backing_filename(bs, VAR_12, sizeof(VAR_12)); VAR_9 = bdrv_open(bs_old_backing, VAR_12, BDRV_O_FLAGS, old_backing_drv); if (VAR_9) { error_report("Could not open old backing file '%s'", VAR_12); goto out; } bs_new_backing = bdrv_new("new_backing"); VAR_9 = bdrv_open(bs_new_backing, VAR_6, BDRV_O_FLAGS, new_backing_drv); if (VAR_9) { error_report("Could not open new backing file '%s'", VAR_6); goto out; } } if (!VAR_10) { uint64_t num_sectors; uint64_t old_backing_num_sectors; uint64_t new_backing_num_sectors; uint64_t sector; int VAR_13; uint8_t * buf_old; uint8_t * buf_new; float VAR_14; buf_old = qemu_blockalign(bs, IO_BUF_SIZE); buf_new = qemu_blockalign(bs, IO_BUF_SIZE); bdrv_get_geometry(bs, &num_sectors); bdrv_get_geometry(bs_old_backing, &old_backing_num_sectors); bdrv_get_geometry(bs_new_backing, &new_backing_num_sectors); VAR_14 = (float)100 / (num_sectors / MIN(num_sectors, IO_BUF_SIZE / 512)); for (sector = 0; sector < num_sectors; sector += VAR_13) { if (sector + (IO_BUF_SIZE / 512) <= num_sectors) { VAR_13 = (IO_BUF_SIZE / 512); } else { VAR_13 = num_sectors - sector; } VAR_9 = bdrv_is_allocated(bs, sector, VAR_13, &VAR_13); if (VAR_9) { continue; } if (sector >= old_backing_num_sectors) { memset(buf_old, 0, VAR_13 * BDRV_SECTOR_SIZE); } else { if (sector + VAR_13 > old_backing_num_sectors) { VAR_13 = old_backing_num_sectors - sector; } VAR_9 = bdrv_read(bs_old_backing, sector, buf_old, VAR_13); if (VAR_9 < 0) { error_report("error while reading from old backing file"); goto out; } } if (sector >= new_backing_num_sectors) { memset(buf_new, 0, VAR_13 * BDRV_SECTOR_SIZE); } else { if (sector + VAR_13 > new_backing_num_sectors) { VAR_13 = new_backing_num_sectors - sector; } VAR_9 = bdrv_read(bs_new_backing, sector, buf_new, VAR_13); if (VAR_9 < 0) { error_report("error while reading from new backing file"); goto out; } } uint64_t written = 0; while (written < VAR_13) { int pnum; if (compare_sectors(buf_old + written * 512, buf_new + written * 512, VAR_13 - written, &pnum)) { VAR_9 = bdrv_write(bs, sector + written, buf_old + written * 512, pnum); if (VAR_9 < 0) { error_report("Error while writing to COW image: %s", strerror(-VAR_9)); goto out; } } written += pnum; } qemu_progress_print(VAR_14, 100); } qemu_vfree(buf_old); qemu_vfree(buf_new); } VAR_9 = bdrv_change_backing_file(bs, VAR_6, VAR_5); if (VAR_9 == -ENOSPC) { error_report("Could not change the backing file to '%s': No " "space left in the file header", VAR_6); } else if (VAR_9 < 0) { error_report("Could not change the backing file to '%s': %s", VAR_6, strerror(-VAR_9)); } qemu_progress_print(100, 0); out: qemu_progress_end(); if (!VAR_10) { if (bs_old_backing != NULL) { bdrv_delete(bs_old_backing); } if (bs_new_backing != NULL) { bdrv_delete(bs_new_backing); } } bdrv_delete(bs); if (VAR_9) { return 1; } return 0; }
[ "static int FUNC_0(int VAR_0, char **VAR_1)\n{", "BlockDriverState *bs, *bs_old_backing = NULL, *bs_new_backing = NULL;", "BlockDriver *old_backing_drv, *new_backing_drv;", "char *VAR_2;", "const char *VAR_3, *VAR_4, *VAR_5, *VAR_6;", "int VAR_7, VAR_8, VAR_9;", "int VAR_10 = 0;", "int VAR_11 = 0;", "VAR_3 = NULL;", "VAR_4 = BDRV_DEFAULT_CACHE;", "VAR_6 = NULL;", "VAR_5 = NULL;", "for(;;) {", "VAR_7 = getopt(VAR_0, VAR_1, \"uhf:F:b:pt:\");", "if (VAR_7 == -1) {", "break;", "}", "switch(VAR_7) {", "case '?':\ncase 'h':\nhelp();", "return 0;", "case 'f':\nVAR_3 = optarg;", "break;", "case 'F':\nVAR_5 = optarg;", "break;", "case 'b':\nVAR_6 = optarg;", "break;", "case 'u':\nVAR_10 = 1;", "break;", "case 'p':\nVAR_11 = 1;", "break;", "case 't':\nVAR_4 = optarg;", "break;", "}", "}", "if ((optind >= VAR_0) || (!VAR_10 && !VAR_6)) {", "help();", "}", "VAR_2 = VAR_1[optind++];", "qemu_progress_init(VAR_11, 2.0);", "qemu_progress_print(0, 100);", "VAR_8 = BDRV_O_RDWR | (VAR_10 ? BDRV_O_NO_BACKING : 0);", "VAR_9 = bdrv_parse_cache_flags(VAR_4, &VAR_8);", "if (VAR_9 < 0) {", "error_report(\"Invalid VAR_4 option: %s\", VAR_4);", "return -1;", "}", "bs = bdrv_new_open(VAR_2, VAR_3, VAR_8);", "if (!bs) {", "return 1;", "}", "old_backing_drv = NULL;", "new_backing_drv = NULL;", "if (!VAR_10 && bs->backing_format[0] != '\\0') {", "old_backing_drv = bdrv_find_format(bs->backing_format);", "if (old_backing_drv == NULL) {", "error_report(\"Invalid format name: '%s'\", bs->backing_format);", "VAR_9 = -1;", "goto out;", "}", "}", "if (VAR_5 != NULL) {", "new_backing_drv = bdrv_find_format(VAR_5);", "if (new_backing_drv == NULL) {", "error_report(\"Invalid format name: '%s'\", VAR_5);", "VAR_9 = -1;", "goto out;", "}", "}", "if (VAR_10) {", "bs_old_backing = NULL;", "bs_new_backing = NULL;", "} else {", "char VAR_12[1024];", "bs_old_backing = bdrv_new(\"old_backing\");", "bdrv_get_backing_filename(bs, VAR_12, sizeof(VAR_12));", "VAR_9 = bdrv_open(bs_old_backing, VAR_12, BDRV_O_FLAGS,\nold_backing_drv);", "if (VAR_9) {", "error_report(\"Could not open old backing file '%s'\", VAR_12);", "goto out;", "}", "bs_new_backing = bdrv_new(\"new_backing\");", "VAR_9 = bdrv_open(bs_new_backing, VAR_6, BDRV_O_FLAGS,\nnew_backing_drv);", "if (VAR_9) {", "error_report(\"Could not open new backing file '%s'\", VAR_6);", "goto out;", "}", "}", "if (!VAR_10) {", "uint64_t num_sectors;", "uint64_t old_backing_num_sectors;", "uint64_t new_backing_num_sectors;", "uint64_t sector;", "int VAR_13;", "uint8_t * buf_old;", "uint8_t * buf_new;", "float VAR_14;", "buf_old = qemu_blockalign(bs, IO_BUF_SIZE);", "buf_new = qemu_blockalign(bs, IO_BUF_SIZE);", "bdrv_get_geometry(bs, &num_sectors);", "bdrv_get_geometry(bs_old_backing, &old_backing_num_sectors);", "bdrv_get_geometry(bs_new_backing, &new_backing_num_sectors);", "VAR_14 = (float)100 /\n(num_sectors / MIN(num_sectors, IO_BUF_SIZE / 512));", "for (sector = 0; sector < num_sectors; sector += VAR_13) {", "if (sector + (IO_BUF_SIZE / 512) <= num_sectors) {", "VAR_13 = (IO_BUF_SIZE / 512);", "} else {", "VAR_13 = num_sectors - sector;", "}", "VAR_9 = bdrv_is_allocated(bs, sector, VAR_13, &VAR_13);", "if (VAR_9) {", "continue;", "}", "if (sector >= old_backing_num_sectors) {", "memset(buf_old, 0, VAR_13 * BDRV_SECTOR_SIZE);", "} else {", "if (sector + VAR_13 > old_backing_num_sectors) {", "VAR_13 = old_backing_num_sectors - sector;", "}", "VAR_9 = bdrv_read(bs_old_backing, sector, buf_old, VAR_13);", "if (VAR_9 < 0) {", "error_report(\"error while reading from old backing file\");", "goto out;", "}", "}", "if (sector >= new_backing_num_sectors) {", "memset(buf_new, 0, VAR_13 * BDRV_SECTOR_SIZE);", "} else {", "if (sector + VAR_13 > new_backing_num_sectors) {", "VAR_13 = new_backing_num_sectors - sector;", "}", "VAR_9 = bdrv_read(bs_new_backing, sector, buf_new, VAR_13);", "if (VAR_9 < 0) {", "error_report(\"error while reading from new backing file\");", "goto out;", "}", "}", "uint64_t written = 0;", "while (written < VAR_13) {", "int pnum;", "if (compare_sectors(buf_old + written * 512,\nbuf_new + written * 512, VAR_13 - written, &pnum))\n{", "VAR_9 = bdrv_write(bs, sector + written,\nbuf_old + written * 512, pnum);", "if (VAR_9 < 0) {", "error_report(\"Error while writing to COW image: %s\",\nstrerror(-VAR_9));", "goto out;", "}", "}", "written += pnum;", "}", "qemu_progress_print(VAR_14, 100);", "}", "qemu_vfree(buf_old);", "qemu_vfree(buf_new);", "}", "VAR_9 = bdrv_change_backing_file(bs, VAR_6, VAR_5);", "if (VAR_9 == -ENOSPC) {", "error_report(\"Could not change the backing file to '%s': No \"\n\"space left in the file header\", VAR_6);", "} else if (VAR_9 < 0) {", "error_report(\"Could not change the backing file to '%s': %s\",\nVAR_6, strerror(-VAR_9));", "}", "qemu_progress_print(100, 0);", "out:\nqemu_progress_end();", "if (!VAR_10) {", "if (bs_old_backing != NULL) {", "bdrv_delete(bs_old_backing);", "}", "if (bs_new_backing != NULL) {", "bdrv_delete(bs_new_backing);", "}", "}", "bdrv_delete(bs);", "if (VAR_9) {", "return 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 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 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 103 ], [ 105 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 147 ], [ 149 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 191 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 205 ], [ 207 ], [ 209, 211 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 223 ], [ 225, 227 ], [ 229 ], [ 231 ], [ 233 ], [ 235 ], [ 237 ], [ 259 ], [ 261 ], [ 263 ], [ 265 ], [ 267 ], [ 269 ], [ 271 ], [ 273 ], [ 275 ], [ 279 ], [ 281 ], [ 285 ], [ 287 ], [ 289 ], [ 293, 295 ], [ 297 ], [ 303 ], [ 305 ], [ 307 ], [ 309 ], [ 311 ], [ 317 ], [ 319 ], [ 321 ], [ 323 ], [ 335 ], [ 337 ], [ 339 ], [ 341 ], [ 343 ], [ 345 ], [ 349 ], [ 351 ], [ 353 ], [ 355 ], [ 357 ], [ 359 ], [ 363 ], [ 365 ], [ 367 ], [ 369 ], [ 371 ], [ 373 ], [ 377 ], [ 379 ], [ 381 ], [ 383 ], [ 385 ], [ 387 ], [ 393 ], [ 397 ], [ 399 ], [ 403, 405, 407 ], [ 409, 411 ], [ 413 ], [ 415, 417 ], [ 419 ], [ 421 ], [ 423 ], [ 427 ], [ 429 ], [ 431 ], [ 433 ], [ 437 ], [ 439 ], [ 441 ], [ 455 ], [ 457 ], [ 459, 461 ], [ 463 ], [ 465, 467 ], [ 469 ], [ 473 ], [ 487, 489 ], [ 493 ], [ 495 ], [ 497 ], [ 499 ], [ 501 ], [ 503 ], [ 505 ], [ 507 ], [ 511 ], [ 513 ], [ 515 ], [ 517 ], [ 519 ], [ 521 ] ]
15,497
int get_buffer(ByteIOContext *s, unsigned char *buf, int size) { int len, size1; size1 = size; while (size > 0) { len = s->buf_end - s->buf_ptr; if (len > size) len = size; if (len == 0) { fill_buffer(s); len = s->buf_end - s->buf_ptr; if (len == 0) break; } else { memcpy(buf, s->buf_ptr, len); buf += len; s->buf_ptr += len; size -= len; } } return size1 - size; }
false
FFmpeg
3e2b6358e0c9744aee2a024c2be8e51e8900b0b1
int get_buffer(ByteIOContext *s, unsigned char *buf, int size) { int len, size1; size1 = size; while (size > 0) { len = s->buf_end - s->buf_ptr; if (len > size) len = size; if (len == 0) { fill_buffer(s); len = s->buf_end - s->buf_ptr; if (len == 0) break; } else { memcpy(buf, s->buf_ptr, len); buf += len; s->buf_ptr += len; size -= len; } } return size1 - size; }
{ "code": [], "line_no": [] }
int FUNC_0(ByteIOContext *VAR_0, unsigned char *VAR_1, int VAR_2) { int VAR_3, VAR_4; VAR_4 = VAR_2; while (VAR_2 > 0) { VAR_3 = VAR_0->buf_end - VAR_0->buf_ptr; if (VAR_3 > VAR_2) VAR_3 = VAR_2; if (VAR_3 == 0) { fill_buffer(VAR_0); VAR_3 = VAR_0->buf_end - VAR_0->buf_ptr; if (VAR_3 == 0) break; } else { memcpy(VAR_1, VAR_0->buf_ptr, VAR_3); VAR_1 += VAR_3; VAR_0->buf_ptr += VAR_3; VAR_2 -= VAR_3; } } return VAR_4 - VAR_2; }
[ "int FUNC_0(ByteIOContext *VAR_0, unsigned char *VAR_1, int VAR_2)\n{", "int VAR_3, VAR_4;", "VAR_4 = VAR_2;", "while (VAR_2 > 0) {", "VAR_3 = VAR_0->buf_end - VAR_0->buf_ptr;", "if (VAR_3 > VAR_2)\nVAR_3 = VAR_2;", "if (VAR_3 == 0) {", "fill_buffer(VAR_0);", "VAR_3 = VAR_0->buf_end - VAR_0->buf_ptr;", "if (VAR_3 == 0)\nbreak;", "} else {", "memcpy(VAR_1, VAR_0->buf_ptr, VAR_3);", "VAR_1 += VAR_3;", "VAR_0->buf_ptr += VAR_3;", "VAR_2 -= VAR_3;", "}", "}", "return VAR_4 - VAR_2;", "}" ]
[ 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 ], [ 19 ], [ 21 ], [ 23 ], [ 25, 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ] ]
15,498
AVFilterFormats *ff_make_format_list(const int *fmts) { AVFilterFormats *formats; int count; for (count = 0; fmts[count] != -1; count++) ; formats = av_mallocz(sizeof(*formats)); if (count) formats->formats = av_malloc(sizeof(*formats->formats) * count); formats->nb_formats = count; memcpy(formats->formats, fmts, sizeof(*formats->formats) * count); return formats; }
false
FFmpeg
c3bd1d60af97e8d2568dac9fcce7bdabb4ff93c8
AVFilterFormats *ff_make_format_list(const int *fmts) { AVFilterFormats *formats; int count; for (count = 0; fmts[count] != -1; count++) ; formats = av_mallocz(sizeof(*formats)); if (count) formats->formats = av_malloc(sizeof(*formats->formats) * count); formats->nb_formats = count; memcpy(formats->formats, fmts, sizeof(*formats->formats) * count); return formats; }
{ "code": [], "line_no": [] }
AVFilterFormats *FUNC_0(const int *fmts) { AVFilterFormats *formats; int VAR_0; for (VAR_0 = 0; fmts[VAR_0] != -1; VAR_0++) ; formats = av_mallocz(sizeof(*formats)); if (VAR_0) formats->formats = av_malloc(sizeof(*formats->formats) * VAR_0); formats->nb_formats = VAR_0; memcpy(formats->formats, fmts, sizeof(*formats->formats) * VAR_0); return formats; }
[ "AVFilterFormats *FUNC_0(const int *fmts)\n{", "AVFilterFormats *formats;", "int VAR_0;", "for (VAR_0 = 0; fmts[VAR_0] != -1; VAR_0++)", ";", "formats = av_mallocz(sizeof(*formats));", "if (VAR_0)\nformats->formats = av_malloc(sizeof(*formats->formats) * VAR_0);", "formats->nb_formats = VAR_0;", "memcpy(formats->formats, fmts, sizeof(*formats->formats) * VAR_0);", "return formats;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 17 ], [ 19, 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ] ]
15,500
void qemu_cond_destroy(QemuCond *cond) { BOOL result; result = CloseHandle(cond->continue_event); if (!result) { error_exit(GetLastError(), __func__); } cond->continue_event = 0; result = CloseHandle(cond->sema); if (!result) { error_exit(GetLastError(), __func__); } cond->sema = 0; }
true
qemu
12f8def0e02232d7c6416ad9b66640f973c531d1
void qemu_cond_destroy(QemuCond *cond) { BOOL result; result = CloseHandle(cond->continue_event); if (!result) { error_exit(GetLastError(), __func__); } cond->continue_event = 0; result = CloseHandle(cond->sema); if (!result) { error_exit(GetLastError(), __func__); } cond->sema = 0; }
{ "code": [ " error_exit(GetLastError(), __func__);", " error_exit(GetLastError(), __func__);", " BOOL result;", " result = CloseHandle(cond->continue_event);", " if (!result) {", " error_exit(GetLastError(), __func__);", " cond->continue_event = 0;", " result = CloseHandle(cond->sema);", " if (!result) {", " error_exit(GetLastError(), __func__);", " cond->sema = 0;", " error_exit(GetLastError(), __func__);", " if (!result) {", " error_exit(GetLastError(), __func__);" ], "line_no": [ 11, 11, 5, 7, 9, 11, 15, 17, 9, 11, 25, 11, 9, 11 ] }
void FUNC_0(QemuCond *VAR_0) { BOOL result; result = CloseHandle(VAR_0->continue_event); if (!result) { error_exit(GetLastError(), __func__); } VAR_0->continue_event = 0; result = CloseHandle(VAR_0->sema); if (!result) { error_exit(GetLastError(), __func__); } VAR_0->sema = 0; }
[ "void FUNC_0(QemuCond *VAR_0)\n{", "BOOL result;", "result = CloseHandle(VAR_0->continue_event);", "if (!result) {", "error_exit(GetLastError(), __func__);", "}", "VAR_0->continue_event = 0;", "result = CloseHandle(VAR_0->sema);", "if (!result) {", "error_exit(GetLastError(), __func__);", "}", "VAR_0->sema = 0;", "}" ]
[ 0, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ] ]
15,502
static inline void gen_intermediate_code_internal(CPUARMState *env, TranslationBlock *tb, int search_pc) { DisasContext dc1, *dc = &dc1; CPUBreakpoint *bp; uint16_t *gen_opc_end; int j, lj; target_ulong pc_start; uint32_t next_page_start; int num_insns; int max_insns; /* generate intermediate code */ pc_start = tb->pc; dc->tb = tb; gen_opc_end = gen_opc_buf + OPC_MAX_SIZE; dc->is_jmp = DISAS_NEXT; dc->pc = pc_start; dc->singlestep_enabled = env->singlestep_enabled; dc->condjmp = 0; dc->thumb = ARM_TBFLAG_THUMB(tb->flags); dc->condexec_mask = (ARM_TBFLAG_CONDEXEC(tb->flags) & 0xf) << 1; dc->condexec_cond = ARM_TBFLAG_CONDEXEC(tb->flags) >> 4; #if !defined(CONFIG_USER_ONLY) dc->user = (ARM_TBFLAG_PRIV(tb->flags) == 0); #endif dc->vfp_enabled = ARM_TBFLAG_VFPEN(tb->flags); dc->vec_len = ARM_TBFLAG_VECLEN(tb->flags); dc->vec_stride = ARM_TBFLAG_VECSTRIDE(tb->flags); cpu_F0s = tcg_temp_new_i32(); cpu_F1s = tcg_temp_new_i32(); cpu_F0d = tcg_temp_new_i64(); cpu_F1d = tcg_temp_new_i64(); cpu_V0 = cpu_F0d; cpu_V1 = cpu_F1d; /* FIXME: cpu_M0 can probably be the same as cpu_V0. */ cpu_M0 = tcg_temp_new_i64(); next_page_start = (pc_start & TARGET_PAGE_MASK) + TARGET_PAGE_SIZE; lj = -1; num_insns = 0; max_insns = tb->cflags & CF_COUNT_MASK; if (max_insns == 0) max_insns = CF_COUNT_MASK; gen_icount_start(); tcg_clear_temp_count(); /* A note on handling of the condexec (IT) bits: * * We want to avoid the overhead of having to write the updated condexec * bits back to the CPUARMState for every instruction in an IT block. So: * (1) if the condexec bits are not already zero then we write * zero back into the CPUARMState now. This avoids complications trying * to do it at the end of the block. (For example if we don't do this * it's hard to identify whether we can safely skip writing condexec * at the end of the TB, which we definitely want to do for the case * where a TB doesn't do anything with the IT state at all.) * (2) if we are going to leave the TB then we call gen_set_condexec() * which will write the correct value into CPUARMState if zero is wrong. * This is done both for leaving the TB at the end, and for leaving * it because of an exception we know will happen, which is done in * gen_exception_insn(). The latter is necessary because we need to * leave the TB with the PC/IT state just prior to execution of the * instruction which caused the exception. * (3) if we leave the TB unexpectedly (eg a data abort on a load) * then the CPUARMState will be wrong and we need to reset it. * This is handled in the same way as restoration of the * PC in these situations: we will be called again with search_pc=1 * and generate a mapping of the condexec bits for each PC in * gen_opc_condexec_bits[]. restore_state_to_opc() then uses * this to restore the condexec bits. * * Note that there are no instructions which can read the condexec * bits, and none which can write non-static values to them, so * we don't need to care about whether CPUARMState is correct in the * middle of a TB. */ /* Reset the conditional execution bits immediately. This avoids complications trying to do it at the end of the block. */ if (dc->condexec_mask || dc->condexec_cond) { TCGv tmp = tcg_temp_new_i32(); tcg_gen_movi_i32(tmp, 0); store_cpu_field(tmp, condexec_bits); } do { #ifdef CONFIG_USER_ONLY /* Intercept jump to the magic kernel page. */ if (dc->pc >= 0xffff0000) { /* We always get here via a jump, so know we are not in a conditional execution block. */ gen_exception(EXCP_KERNEL_TRAP); dc->is_jmp = DISAS_UPDATE; break; } #else if (dc->pc >= 0xfffffff0 && IS_M(env)) { /* We always get here via a jump, so know we are not in a conditional execution block. */ gen_exception(EXCP_EXCEPTION_EXIT); dc->is_jmp = DISAS_UPDATE; break; } #endif if (unlikely(!QTAILQ_EMPTY(&env->breakpoints))) { QTAILQ_FOREACH(bp, &env->breakpoints, entry) { if (bp->pc == dc->pc) { gen_exception_insn(dc, 0, EXCP_DEBUG); /* Advance PC so that clearing the breakpoint will invalidate this TB. */ dc->pc += 2; goto done_generating; break; } } } if (search_pc) { j = gen_opc_ptr - gen_opc_buf; if (lj < j) { lj++; while (lj < j) gen_opc_instr_start[lj++] = 0; } gen_opc_pc[lj] = dc->pc; gen_opc_condexec_bits[lj] = (dc->condexec_cond << 4) | (dc->condexec_mask >> 1); gen_opc_instr_start[lj] = 1; gen_opc_icount[lj] = num_insns; } if (num_insns + 1 == max_insns && (tb->cflags & CF_LAST_IO)) gen_io_start(); if (unlikely(qemu_loglevel_mask(CPU_LOG_TB_OP))) { tcg_gen_debug_insn_start(dc->pc); } if (dc->thumb) { disas_thumb_insn(env, dc); if (dc->condexec_mask) { dc->condexec_cond = (dc->condexec_cond & 0xe) | ((dc->condexec_mask >> 4) & 1); dc->condexec_mask = (dc->condexec_mask << 1) & 0x1f; if (dc->condexec_mask == 0) { dc->condexec_cond = 0; } } } else { disas_arm_insn(env, dc); } if (dc->condjmp && !dc->is_jmp) { gen_set_label(dc->condlabel); dc->condjmp = 0; } if (tcg_check_temp_count()) { fprintf(stderr, "TCG temporary leak before %08x\n", dc->pc); } /* Translation stops when a conditional branch is encountered. * Otherwise the subsequent code could get translated several times. * Also stop translation when a page boundary is reached. This * ensures prefetch aborts occur at the right place. */ num_insns ++; } while (!dc->is_jmp && gen_opc_ptr < gen_opc_end && !env->singlestep_enabled && !singlestep && dc->pc < next_page_start && num_insns < max_insns); if (tb->cflags & CF_LAST_IO) { if (dc->condjmp) { /* FIXME: This can theoretically happen with self-modifying code. */ cpu_abort(env, "IO on conditional branch instruction"); } gen_io_end(); } /* At this stage dc->condjmp will only be set when the skipped instruction was a conditional branch or trap, and the PC has already been written. */ if (unlikely(env->singlestep_enabled)) { /* Make sure the pc is updated, and raise a debug exception. */ if (dc->condjmp) { gen_set_condexec(dc); if (dc->is_jmp == DISAS_SWI) { gen_exception(EXCP_SWI); } else { gen_exception(EXCP_DEBUG); } gen_set_label(dc->condlabel); } if (dc->condjmp || !dc->is_jmp) { gen_set_pc_im(dc->pc); dc->condjmp = 0; } gen_set_condexec(dc); if (dc->is_jmp == DISAS_SWI && !dc->condjmp) { gen_exception(EXCP_SWI); } else { /* FIXME: Single stepping a WFI insn will not halt the CPU. */ gen_exception(EXCP_DEBUG); } } else { /* While branches must always occur at the end of an IT block, there are a few other things that can cause us to terminate the TB in the middel of an IT block: - Exception generating instructions (bkpt, swi, undefined). - Page boundaries. - Hardware watchpoints. Hardware breakpoints have already been handled and skip this code. */ gen_set_condexec(dc); switch(dc->is_jmp) { case DISAS_NEXT: gen_goto_tb(dc, 1, dc->pc); break; default: case DISAS_JUMP: case DISAS_UPDATE: /* indicate that the hash table must be used to find the next TB */ tcg_gen_exit_tb(0); break; case DISAS_TB_JUMP: /* nothing more to generate */ break; case DISAS_WFI: gen_helper_wfi(); break; case DISAS_SWI: gen_exception(EXCP_SWI); break; } if (dc->condjmp) { gen_set_label(dc->condlabel); gen_set_condexec(dc); gen_goto_tb(dc, 1, dc->pc); dc->condjmp = 0; } } done_generating: gen_icount_end(tb, num_insns); *gen_opc_ptr = INDEX_op_end; #ifdef DEBUG_DISAS if (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM)) { qemu_log("----------------\n"); qemu_log("IN: %s\n", lookup_symbol(pc_start)); log_target_disas(pc_start, dc->pc - pc_start, dc->thumb); qemu_log("\n"); } #endif if (search_pc) { j = gen_opc_ptr - gen_opc_buf; lj++; while (lj <= j) gen_opc_instr_start[lj++] = 0; } else { tb->size = dc->pc - pc_start; tb->icount = num_insns; } }
true
qemu
d8fd2954996255ba6ad610917e7849832d0120b7
static inline void gen_intermediate_code_internal(CPUARMState *env, TranslationBlock *tb, int search_pc) { DisasContext dc1, *dc = &dc1; CPUBreakpoint *bp; uint16_t *gen_opc_end; int j, lj; target_ulong pc_start; uint32_t next_page_start; int num_insns; int max_insns; pc_start = tb->pc; dc->tb = tb; gen_opc_end = gen_opc_buf + OPC_MAX_SIZE; dc->is_jmp = DISAS_NEXT; dc->pc = pc_start; dc->singlestep_enabled = env->singlestep_enabled; dc->condjmp = 0; dc->thumb = ARM_TBFLAG_THUMB(tb->flags); dc->condexec_mask = (ARM_TBFLAG_CONDEXEC(tb->flags) & 0xf) << 1; dc->condexec_cond = ARM_TBFLAG_CONDEXEC(tb->flags) >> 4; #if !defined(CONFIG_USER_ONLY) dc->user = (ARM_TBFLAG_PRIV(tb->flags) == 0); #endif dc->vfp_enabled = ARM_TBFLAG_VFPEN(tb->flags); dc->vec_len = ARM_TBFLAG_VECLEN(tb->flags); dc->vec_stride = ARM_TBFLAG_VECSTRIDE(tb->flags); cpu_F0s = tcg_temp_new_i32(); cpu_F1s = tcg_temp_new_i32(); cpu_F0d = tcg_temp_new_i64(); cpu_F1d = tcg_temp_new_i64(); cpu_V0 = cpu_F0d; cpu_V1 = cpu_F1d; cpu_M0 = tcg_temp_new_i64(); next_page_start = (pc_start & TARGET_PAGE_MASK) + TARGET_PAGE_SIZE; lj = -1; num_insns = 0; max_insns = tb->cflags & CF_COUNT_MASK; if (max_insns == 0) max_insns = CF_COUNT_MASK; gen_icount_start(); tcg_clear_temp_count(); if (dc->condexec_mask || dc->condexec_cond) { TCGv tmp = tcg_temp_new_i32(); tcg_gen_movi_i32(tmp, 0); store_cpu_field(tmp, condexec_bits); } do { #ifdef CONFIG_USER_ONLY if (dc->pc >= 0xffff0000) { gen_exception(EXCP_KERNEL_TRAP); dc->is_jmp = DISAS_UPDATE; break; } #else if (dc->pc >= 0xfffffff0 && IS_M(env)) { gen_exception(EXCP_EXCEPTION_EXIT); dc->is_jmp = DISAS_UPDATE; break; } #endif if (unlikely(!QTAILQ_EMPTY(&env->breakpoints))) { QTAILQ_FOREACH(bp, &env->breakpoints, entry) { if (bp->pc == dc->pc) { gen_exception_insn(dc, 0, EXCP_DEBUG); dc->pc += 2; goto done_generating; break; } } } if (search_pc) { j = gen_opc_ptr - gen_opc_buf; if (lj < j) { lj++; while (lj < j) gen_opc_instr_start[lj++] = 0; } gen_opc_pc[lj] = dc->pc; gen_opc_condexec_bits[lj] = (dc->condexec_cond << 4) | (dc->condexec_mask >> 1); gen_opc_instr_start[lj] = 1; gen_opc_icount[lj] = num_insns; } if (num_insns + 1 == max_insns && (tb->cflags & CF_LAST_IO)) gen_io_start(); if (unlikely(qemu_loglevel_mask(CPU_LOG_TB_OP))) { tcg_gen_debug_insn_start(dc->pc); } if (dc->thumb) { disas_thumb_insn(env, dc); if (dc->condexec_mask) { dc->condexec_cond = (dc->condexec_cond & 0xe) | ((dc->condexec_mask >> 4) & 1); dc->condexec_mask = (dc->condexec_mask << 1) & 0x1f; if (dc->condexec_mask == 0) { dc->condexec_cond = 0; } } } else { disas_arm_insn(env, dc); } if (dc->condjmp && !dc->is_jmp) { gen_set_label(dc->condlabel); dc->condjmp = 0; } if (tcg_check_temp_count()) { fprintf(stderr, "TCG temporary leak before %08x\n", dc->pc); } num_insns ++; } while (!dc->is_jmp && gen_opc_ptr < gen_opc_end && !env->singlestep_enabled && !singlestep && dc->pc < next_page_start && num_insns < max_insns); if (tb->cflags & CF_LAST_IO) { if (dc->condjmp) { cpu_abort(env, "IO on conditional branch instruction"); } gen_io_end(); } if (unlikely(env->singlestep_enabled)) { if (dc->condjmp) { gen_set_condexec(dc); if (dc->is_jmp == DISAS_SWI) { gen_exception(EXCP_SWI); } else { gen_exception(EXCP_DEBUG); } gen_set_label(dc->condlabel); } if (dc->condjmp || !dc->is_jmp) { gen_set_pc_im(dc->pc); dc->condjmp = 0; } gen_set_condexec(dc); if (dc->is_jmp == DISAS_SWI && !dc->condjmp) { gen_exception(EXCP_SWI); } else { gen_exception(EXCP_DEBUG); } } else { gen_set_condexec(dc); switch(dc->is_jmp) { case DISAS_NEXT: gen_goto_tb(dc, 1, dc->pc); break; default: case DISAS_JUMP: case DISAS_UPDATE: tcg_gen_exit_tb(0); break; case DISAS_TB_JUMP: break; case DISAS_WFI: gen_helper_wfi(); break; case DISAS_SWI: gen_exception(EXCP_SWI); break; } if (dc->condjmp) { gen_set_label(dc->condlabel); gen_set_condexec(dc); gen_goto_tb(dc, 1, dc->pc); dc->condjmp = 0; } } done_generating: gen_icount_end(tb, num_insns); *gen_opc_ptr = INDEX_op_end; #ifdef DEBUG_DISAS if (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM)) { qemu_log("----------------\n"); qemu_log("IN: %s\n", lookup_symbol(pc_start)); log_target_disas(pc_start, dc->pc - pc_start, dc->thumb); qemu_log("\n"); } #endif if (search_pc) { j = gen_opc_ptr - gen_opc_buf; lj++; while (lj <= j) gen_opc_instr_start[lj++] = 0; } else { tb->size = dc->pc - pc_start; tb->icount = num_insns; } }
{ "code": [ " log_target_disas(pc_start, dc->pc - pc_start, dc->thumb);" ], "line_no": [ 517 ] }
static inline void FUNC_0(CPUARMState *VAR_0, TranslationBlock *VAR_1, int VAR_2) { DisasContext dc1, *dc = &dc1; CPUBreakpoint *bp; uint16_t *gen_opc_end; int VAR_3, VAR_4; target_ulong pc_start; uint32_t next_page_start; int VAR_5; int VAR_6; pc_start = VAR_1->pc; dc->VAR_1 = VAR_1; gen_opc_end = gen_opc_buf + OPC_MAX_SIZE; dc->is_jmp = DISAS_NEXT; dc->pc = pc_start; dc->singlestep_enabled = VAR_0->singlestep_enabled; dc->condjmp = 0; dc->thumb = ARM_TBFLAG_THUMB(VAR_1->flags); dc->condexec_mask = (ARM_TBFLAG_CONDEXEC(VAR_1->flags) & 0xf) << 1; dc->condexec_cond = ARM_TBFLAG_CONDEXEC(VAR_1->flags) >> 4; #if !defined(CONFIG_USER_ONLY) dc->user = (ARM_TBFLAG_PRIV(VAR_1->flags) == 0); #endif dc->vfp_enabled = ARM_TBFLAG_VFPEN(VAR_1->flags); dc->vec_len = ARM_TBFLAG_VECLEN(VAR_1->flags); dc->vec_stride = ARM_TBFLAG_VECSTRIDE(VAR_1->flags); cpu_F0s = tcg_temp_new_i32(); cpu_F1s = tcg_temp_new_i32(); cpu_F0d = tcg_temp_new_i64(); cpu_F1d = tcg_temp_new_i64(); cpu_V0 = cpu_F0d; cpu_V1 = cpu_F1d; cpu_M0 = tcg_temp_new_i64(); next_page_start = (pc_start & TARGET_PAGE_MASK) + TARGET_PAGE_SIZE; VAR_4 = -1; VAR_5 = 0; VAR_6 = VAR_1->cflags & CF_COUNT_MASK; if (VAR_6 == 0) VAR_6 = CF_COUNT_MASK; gen_icount_start(); tcg_clear_temp_count(); if (dc->condexec_mask || dc->condexec_cond) { TCGv tmp = tcg_temp_new_i32(); tcg_gen_movi_i32(tmp, 0); store_cpu_field(tmp, condexec_bits); } do { #ifdef CONFIG_USER_ONLY if (dc->pc >= 0xffff0000) { gen_exception(EXCP_KERNEL_TRAP); dc->is_jmp = DISAS_UPDATE; break; } #else if (dc->pc >= 0xfffffff0 && IS_M(VAR_0)) { gen_exception(EXCP_EXCEPTION_EXIT); dc->is_jmp = DISAS_UPDATE; break; } #endif if (unlikely(!QTAILQ_EMPTY(&VAR_0->breakpoints))) { QTAILQ_FOREACH(bp, &VAR_0->breakpoints, entry) { if (bp->pc == dc->pc) { gen_exception_insn(dc, 0, EXCP_DEBUG); dc->pc += 2; goto done_generating; break; } } } if (VAR_2) { VAR_3 = gen_opc_ptr - gen_opc_buf; if (VAR_4 < VAR_3) { VAR_4++; while (VAR_4 < VAR_3) gen_opc_instr_start[VAR_4++] = 0; } gen_opc_pc[VAR_4] = dc->pc; gen_opc_condexec_bits[VAR_4] = (dc->condexec_cond << 4) | (dc->condexec_mask >> 1); gen_opc_instr_start[VAR_4] = 1; gen_opc_icount[VAR_4] = VAR_5; } if (VAR_5 + 1 == VAR_6 && (VAR_1->cflags & CF_LAST_IO)) gen_io_start(); if (unlikely(qemu_loglevel_mask(CPU_LOG_TB_OP))) { tcg_gen_debug_insn_start(dc->pc); } if (dc->thumb) { disas_thumb_insn(VAR_0, dc); if (dc->condexec_mask) { dc->condexec_cond = (dc->condexec_cond & 0xe) | ((dc->condexec_mask >> 4) & 1); dc->condexec_mask = (dc->condexec_mask << 1) & 0x1f; if (dc->condexec_mask == 0) { dc->condexec_cond = 0; } } } else { disas_arm_insn(VAR_0, dc); } if (dc->condjmp && !dc->is_jmp) { gen_set_label(dc->condlabel); dc->condjmp = 0; } if (tcg_check_temp_count()) { fprintf(stderr, "TCG temporary leak before %08x\n", dc->pc); } VAR_5 ++; } while (!dc->is_jmp && gen_opc_ptr < gen_opc_end && !VAR_0->singlestep_enabled && !singlestep && dc->pc < next_page_start && VAR_5 < VAR_6); if (VAR_1->cflags & CF_LAST_IO) { if (dc->condjmp) { cpu_abort(VAR_0, "IO on conditional branch instruction"); } gen_io_end(); } if (unlikely(VAR_0->singlestep_enabled)) { if (dc->condjmp) { gen_set_condexec(dc); if (dc->is_jmp == DISAS_SWI) { gen_exception(EXCP_SWI); } else { gen_exception(EXCP_DEBUG); } gen_set_label(dc->condlabel); } if (dc->condjmp || !dc->is_jmp) { gen_set_pc_im(dc->pc); dc->condjmp = 0; } gen_set_condexec(dc); if (dc->is_jmp == DISAS_SWI && !dc->condjmp) { gen_exception(EXCP_SWI); } else { gen_exception(EXCP_DEBUG); } } else { gen_set_condexec(dc); switch(dc->is_jmp) { case DISAS_NEXT: gen_goto_tb(dc, 1, dc->pc); break; default: case DISAS_JUMP: case DISAS_UPDATE: tcg_gen_exit_tb(0); break; case DISAS_TB_JUMP: break; case DISAS_WFI: gen_helper_wfi(); break; case DISAS_SWI: gen_exception(EXCP_SWI); break; } if (dc->condjmp) { gen_set_label(dc->condlabel); gen_set_condexec(dc); gen_goto_tb(dc, 1, dc->pc); dc->condjmp = 0; } } done_generating: gen_icount_end(VAR_1, VAR_5); *gen_opc_ptr = INDEX_op_end; #ifdef DEBUG_DISAS if (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM)) { qemu_log("----------------\n"); qemu_log("IN: %s\n", lookup_symbol(pc_start)); log_target_disas(pc_start, dc->pc - pc_start, dc->thumb); qemu_log("\n"); } #endif if (VAR_2) { VAR_3 = gen_opc_ptr - gen_opc_buf; VAR_4++; while (VAR_4 <= VAR_3) gen_opc_instr_start[VAR_4++] = 0; } else { VAR_1->size = dc->pc - pc_start; VAR_1->icount = VAR_5; } }
[ "static inline void FUNC_0(CPUARMState *VAR_0,\nTranslationBlock *VAR_1,\nint VAR_2)\n{", "DisasContext dc1, *dc = &dc1;", "CPUBreakpoint *bp;", "uint16_t *gen_opc_end;", "int VAR_3, VAR_4;", "target_ulong pc_start;", "uint32_t next_page_start;", "int VAR_5;", "int VAR_6;", "pc_start = VAR_1->pc;", "dc->VAR_1 = VAR_1;", "gen_opc_end = gen_opc_buf + OPC_MAX_SIZE;", "dc->is_jmp = DISAS_NEXT;", "dc->pc = pc_start;", "dc->singlestep_enabled = VAR_0->singlestep_enabled;", "dc->condjmp = 0;", "dc->thumb = ARM_TBFLAG_THUMB(VAR_1->flags);", "dc->condexec_mask = (ARM_TBFLAG_CONDEXEC(VAR_1->flags) & 0xf) << 1;", "dc->condexec_cond = ARM_TBFLAG_CONDEXEC(VAR_1->flags) >> 4;", "#if !defined(CONFIG_USER_ONLY)\ndc->user = (ARM_TBFLAG_PRIV(VAR_1->flags) == 0);", "#endif\ndc->vfp_enabled = ARM_TBFLAG_VFPEN(VAR_1->flags);", "dc->vec_len = ARM_TBFLAG_VECLEN(VAR_1->flags);", "dc->vec_stride = ARM_TBFLAG_VECSTRIDE(VAR_1->flags);", "cpu_F0s = tcg_temp_new_i32();", "cpu_F1s = tcg_temp_new_i32();", "cpu_F0d = tcg_temp_new_i64();", "cpu_F1d = tcg_temp_new_i64();", "cpu_V0 = cpu_F0d;", "cpu_V1 = cpu_F1d;", "cpu_M0 = tcg_temp_new_i64();", "next_page_start = (pc_start & TARGET_PAGE_MASK) + TARGET_PAGE_SIZE;", "VAR_4 = -1;", "VAR_5 = 0;", "VAR_6 = VAR_1->cflags & CF_COUNT_MASK;", "if (VAR_6 == 0)\nVAR_6 = CF_COUNT_MASK;", "gen_icount_start();", "tcg_clear_temp_count();", "if (dc->condexec_mask || dc->condexec_cond)\n{", "TCGv tmp = tcg_temp_new_i32();", "tcg_gen_movi_i32(tmp, 0);", "store_cpu_field(tmp, condexec_bits);", "}", "do {", "#ifdef CONFIG_USER_ONLY\nif (dc->pc >= 0xffff0000) {", "gen_exception(EXCP_KERNEL_TRAP);", "dc->is_jmp = DISAS_UPDATE;", "break;", "}", "#else\nif (dc->pc >= 0xfffffff0 && IS_M(VAR_0)) {", "gen_exception(EXCP_EXCEPTION_EXIT);", "dc->is_jmp = DISAS_UPDATE;", "break;", "}", "#endif\nif (unlikely(!QTAILQ_EMPTY(&VAR_0->breakpoints))) {", "QTAILQ_FOREACH(bp, &VAR_0->breakpoints, entry) {", "if (bp->pc == dc->pc) {", "gen_exception_insn(dc, 0, EXCP_DEBUG);", "dc->pc += 2;", "goto done_generating;", "break;", "}", "}", "}", "if (VAR_2) {", "VAR_3 = gen_opc_ptr - gen_opc_buf;", "if (VAR_4 < VAR_3) {", "VAR_4++;", "while (VAR_4 < VAR_3)\ngen_opc_instr_start[VAR_4++] = 0;", "}", "gen_opc_pc[VAR_4] = dc->pc;", "gen_opc_condexec_bits[VAR_4] = (dc->condexec_cond << 4) | (dc->condexec_mask >> 1);", "gen_opc_instr_start[VAR_4] = 1;", "gen_opc_icount[VAR_4] = VAR_5;", "}", "if (VAR_5 + 1 == VAR_6 && (VAR_1->cflags & CF_LAST_IO))\ngen_io_start();", "if (unlikely(qemu_loglevel_mask(CPU_LOG_TB_OP))) {", "tcg_gen_debug_insn_start(dc->pc);", "}", "if (dc->thumb) {", "disas_thumb_insn(VAR_0, dc);", "if (dc->condexec_mask) {", "dc->condexec_cond = (dc->condexec_cond & 0xe)\n| ((dc->condexec_mask >> 4) & 1);", "dc->condexec_mask = (dc->condexec_mask << 1) & 0x1f;", "if (dc->condexec_mask == 0) {", "dc->condexec_cond = 0;", "}", "}", "} else {", "disas_arm_insn(VAR_0, dc);", "}", "if (dc->condjmp && !dc->is_jmp) {", "gen_set_label(dc->condlabel);", "dc->condjmp = 0;", "}", "if (tcg_check_temp_count()) {", "fprintf(stderr, \"TCG temporary leak before %08x\\n\", dc->pc);", "}", "VAR_5 ++;", "} while (!dc->is_jmp && gen_opc_ptr < gen_opc_end &&", "!VAR_0->singlestep_enabled &&\n!singlestep &&\ndc->pc < next_page_start &&\nVAR_5 < VAR_6);", "if (VAR_1->cflags & CF_LAST_IO) {", "if (dc->condjmp) {", "cpu_abort(VAR_0, \"IO on conditional branch instruction\");", "}", "gen_io_end();", "}", "if (unlikely(VAR_0->singlestep_enabled)) {", "if (dc->condjmp) {", "gen_set_condexec(dc);", "if (dc->is_jmp == DISAS_SWI) {", "gen_exception(EXCP_SWI);", "} else {", "gen_exception(EXCP_DEBUG);", "}", "gen_set_label(dc->condlabel);", "}", "if (dc->condjmp || !dc->is_jmp) {", "gen_set_pc_im(dc->pc);", "dc->condjmp = 0;", "}", "gen_set_condexec(dc);", "if (dc->is_jmp == DISAS_SWI && !dc->condjmp) {", "gen_exception(EXCP_SWI);", "} else {", "gen_exception(EXCP_DEBUG);", "}", "} else {", "gen_set_condexec(dc);", "switch(dc->is_jmp) {", "case DISAS_NEXT:\ngen_goto_tb(dc, 1, dc->pc);", "break;", "default:\ncase DISAS_JUMP:\ncase DISAS_UPDATE:\ntcg_gen_exit_tb(0);", "break;", "case DISAS_TB_JUMP:\nbreak;", "case DISAS_WFI:\ngen_helper_wfi();", "break;", "case DISAS_SWI:\ngen_exception(EXCP_SWI);", "break;", "}", "if (dc->condjmp) {", "gen_set_label(dc->condlabel);", "gen_set_condexec(dc);", "gen_goto_tb(dc, 1, dc->pc);", "dc->condjmp = 0;", "}", "}", "done_generating:\ngen_icount_end(VAR_1, VAR_5);", "*gen_opc_ptr = INDEX_op_end;", "#ifdef DEBUG_DISAS\nif (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM)) {", "qemu_log(\"----------------\\n\");", "qemu_log(\"IN: %s\\n\", lookup_symbol(pc_start));", "log_target_disas(pc_start, dc->pc - pc_start, dc->thumb);", "qemu_log(\"\\n\");", "}", "#endif\nif (VAR_2) {", "VAR_3 = gen_opc_ptr - gen_opc_buf;", "VAR_4++;", "while (VAR_4 <= VAR_3)\ngen_opc_instr_start[VAR_4++] = 0;", "} else {", "VAR_1->size = dc->pc - pc_start;", "VAR_1->icount = 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 29 ], [ 33 ], [ 37 ], [ 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 ], [ 97 ], [ 101 ], [ 171, 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185, 189 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203, 205 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 219, 223 ], [ 225 ], [ 227 ], [ 229 ], [ 235 ], [ 237 ], [ 239 ], [ 241 ], [ 243 ], [ 245 ], [ 247 ], [ 249 ], [ 251 ], [ 253 ], [ 255, 257 ], [ 259 ], [ 261 ], [ 263 ], [ 265 ], [ 267 ], [ 269 ], [ 273, 275 ], [ 279 ], [ 281 ], [ 283 ], [ 287 ], [ 289 ], [ 291 ], [ 293, 295 ], [ 297 ], [ 299 ], [ 301 ], [ 303 ], [ 305 ], [ 307 ], [ 309 ], [ 311 ], [ 315 ], [ 317 ], [ 319 ], [ 321 ], [ 325 ], [ 327 ], [ 329 ], [ 341 ], [ 343 ], [ 345, 347, 349, 351 ], [ 355 ], [ 357 ], [ 363 ], [ 365 ], [ 367 ], [ 369 ], [ 379 ], [ 383 ], [ 385 ], [ 387 ], [ 389 ], [ 391 ], [ 393 ], [ 395 ], [ 397 ], [ 399 ], [ 401 ], [ 403 ], [ 405 ], [ 407 ], [ 409 ], [ 411 ], [ 413 ], [ 415 ], [ 421 ], [ 423 ], [ 425 ], [ 443 ], [ 445 ], [ 447, 449 ], [ 451 ], [ 453, 455, 457, 461 ], [ 463 ], [ 465, 469 ], [ 471, 473 ], [ 475 ], [ 477, 479 ], [ 481 ], [ 483 ], [ 485 ], [ 487 ], [ 489 ], [ 491 ], [ 493 ], [ 495 ], [ 497 ], [ 501, 503 ], [ 505 ], [ 509, 511 ], [ 513 ], [ 515 ], [ 517 ], [ 519 ], [ 521 ], [ 523, 525 ], [ 527 ], [ 529 ], [ 531, 533 ], [ 535 ], [ 537 ], [ 539 ], [ 541 ], [ 543 ] ]
15,503
static int ram_save_page(RAMState *rs, PageSearchStatus *pss, bool last_stage) { int pages = -1; uint64_t bytes_xmit; ram_addr_t current_addr; uint8_t *p; int ret; bool send_async = true; RAMBlock *block = pss->block; ram_addr_t offset = pss->page << TARGET_PAGE_BITS; p = block->host + offset; trace_ram_save_page(block->idstr, (uint64_t)offset, p); /* In doubt sent page as normal */ bytes_xmit = 0; ret = ram_control_save_page(rs->f, block->offset, offset, TARGET_PAGE_SIZE, &bytes_xmit); if (bytes_xmit) { rs->bytes_transferred += bytes_xmit; pages = 1; } XBZRLE_cache_lock(); current_addr = block->offset + offset; if (ret != RAM_SAVE_CONTROL_NOT_SUPP) { if (ret != RAM_SAVE_CONTROL_DELAYED) { if (bytes_xmit > 0) { rs->norm_pages++; } else if (bytes_xmit == 0) { rs->zero_pages++; } } } else { pages = save_zero_page(rs, block, offset, p); if (pages > 0) { /* Must let xbzrle know, otherwise a previous (now 0'd) cached * page would be stale */ xbzrle_cache_zero_page(rs, current_addr); ram_release_pages(block->idstr, offset, pages); } else if (!rs->ram_bulk_stage && !migration_in_postcopy() && migrate_use_xbzrle()) { pages = save_xbzrle_page(rs, &p, current_addr, block, offset, last_stage); if (!last_stage) { /* Can't send this cached data async, since the cache page * might get updated before it gets to the wire */ send_async = false; } } } /* XBZRLE overflow or normal page */ if (pages == -1) { rs->bytes_transferred += save_page_header(rs, block, offset | RAM_SAVE_FLAG_PAGE); if (send_async) { qemu_put_buffer_async(rs->f, p, TARGET_PAGE_SIZE, migrate_release_ram() & migration_in_postcopy()); } else { qemu_put_buffer(rs->f, p, TARGET_PAGE_SIZE); } rs->bytes_transferred += TARGET_PAGE_SIZE; pages = 1; rs->norm_pages++; } XBZRLE_cache_unlock(); return pages; }
true
qemu
2bf3aa85f08186b8162b76e7e8efe5b5a44306a6
static int ram_save_page(RAMState *rs, PageSearchStatus *pss, bool last_stage) { int pages = -1; uint64_t bytes_xmit; ram_addr_t current_addr; uint8_t *p; int ret; bool send_async = true; RAMBlock *block = pss->block; ram_addr_t offset = pss->page << TARGET_PAGE_BITS; p = block->host + offset; trace_ram_save_page(block->idstr, (uint64_t)offset, p); bytes_xmit = 0; ret = ram_control_save_page(rs->f, block->offset, offset, TARGET_PAGE_SIZE, &bytes_xmit); if (bytes_xmit) { rs->bytes_transferred += bytes_xmit; pages = 1; } XBZRLE_cache_lock(); current_addr = block->offset + offset; if (ret != RAM_SAVE_CONTROL_NOT_SUPP) { if (ret != RAM_SAVE_CONTROL_DELAYED) { if (bytes_xmit > 0) { rs->norm_pages++; } else if (bytes_xmit == 0) { rs->zero_pages++; } } } else { pages = save_zero_page(rs, block, offset, p); if (pages > 0) { xbzrle_cache_zero_page(rs, current_addr); ram_release_pages(block->idstr, offset, pages); } else if (!rs->ram_bulk_stage && !migration_in_postcopy() && migrate_use_xbzrle()) { pages = save_xbzrle_page(rs, &p, current_addr, block, offset, last_stage); if (!last_stage) { send_async = false; } } } if (pages == -1) { rs->bytes_transferred += save_page_header(rs, block, offset | RAM_SAVE_FLAG_PAGE); if (send_async) { qemu_put_buffer_async(rs->f, p, TARGET_PAGE_SIZE, migrate_release_ram() & migration_in_postcopy()); } else { qemu_put_buffer(rs->f, p, TARGET_PAGE_SIZE); } rs->bytes_transferred += TARGET_PAGE_SIZE; pages = 1; rs->norm_pages++; } XBZRLE_cache_unlock(); return pages; }
{ "code": [ " rs->bytes_transferred += save_page_header(rs, block," ], "line_no": [ 117 ] }
static int FUNC_0(RAMState *VAR_0, PageSearchStatus *VAR_1, bool VAR_2) { int VAR_3 = -1; uint64_t bytes_xmit; ram_addr_t current_addr; uint8_t *p; int VAR_4; bool send_async = true; RAMBlock *block = VAR_1->block; ram_addr_t offset = VAR_1->page << TARGET_PAGE_BITS; p = block->host + offset; trace_ram_save_page(block->idstr, (uint64_t)offset, p); bytes_xmit = 0; VAR_4 = ram_control_save_page(VAR_0->f, block->offset, offset, TARGET_PAGE_SIZE, &bytes_xmit); if (bytes_xmit) { VAR_0->bytes_transferred += bytes_xmit; VAR_3 = 1; } XBZRLE_cache_lock(); current_addr = block->offset + offset; if (VAR_4 != RAM_SAVE_CONTROL_NOT_SUPP) { if (VAR_4 != RAM_SAVE_CONTROL_DELAYED) { if (bytes_xmit > 0) { VAR_0->norm_pages++; } else if (bytes_xmit == 0) { VAR_0->zero_pages++; } } } else { VAR_3 = save_zero_page(VAR_0, block, offset, p); if (VAR_3 > 0) { xbzrle_cache_zero_page(VAR_0, current_addr); ram_release_pages(block->idstr, offset, VAR_3); } else if (!VAR_0->ram_bulk_stage && !migration_in_postcopy() && migrate_use_xbzrle()) { VAR_3 = save_xbzrle_page(VAR_0, &p, current_addr, block, offset, VAR_2); if (!VAR_2) { send_async = false; } } } if (VAR_3 == -1) { VAR_0->bytes_transferred += save_page_header(VAR_0, block, offset | RAM_SAVE_FLAG_PAGE); if (send_async) { qemu_put_buffer_async(VAR_0->f, p, TARGET_PAGE_SIZE, migrate_release_ram() & migration_in_postcopy()); } else { qemu_put_buffer(VAR_0->f, p, TARGET_PAGE_SIZE); } VAR_0->bytes_transferred += TARGET_PAGE_SIZE; VAR_3 = 1; VAR_0->norm_pages++; } XBZRLE_cache_unlock(); return VAR_3; }
[ "static int FUNC_0(RAMState *VAR_0, PageSearchStatus *VAR_1, bool VAR_2)\n{", "int VAR_3 = -1;", "uint64_t bytes_xmit;", "ram_addr_t current_addr;", "uint8_t *p;", "int VAR_4;", "bool send_async = true;", "RAMBlock *block = VAR_1->block;", "ram_addr_t offset = VAR_1->page << TARGET_PAGE_BITS;", "p = block->host + offset;", "trace_ram_save_page(block->idstr, (uint64_t)offset, p);", "bytes_xmit = 0;", "VAR_4 = ram_control_save_page(VAR_0->f, block->offset,\noffset, TARGET_PAGE_SIZE, &bytes_xmit);", "if (bytes_xmit) {", "VAR_0->bytes_transferred += bytes_xmit;", "VAR_3 = 1;", "}", "XBZRLE_cache_lock();", "current_addr = block->offset + offset;", "if (VAR_4 != RAM_SAVE_CONTROL_NOT_SUPP) {", "if (VAR_4 != RAM_SAVE_CONTROL_DELAYED) {", "if (bytes_xmit > 0) {", "VAR_0->norm_pages++;", "} else if (bytes_xmit == 0) {", "VAR_0->zero_pages++;", "}", "}", "} else {", "VAR_3 = save_zero_page(VAR_0, block, offset, p);", "if (VAR_3 > 0) {", "xbzrle_cache_zero_page(VAR_0, current_addr);", "ram_release_pages(block->idstr, offset, VAR_3);", "} else if (!VAR_0->ram_bulk_stage &&", "!migration_in_postcopy() && migrate_use_xbzrle()) {", "VAR_3 = save_xbzrle_page(VAR_0, &p, current_addr, block,\noffset, VAR_2);", "if (!VAR_2) {", "send_async = false;", "}", "}", "}", "if (VAR_3 == -1) {", "VAR_0->bytes_transferred += save_page_header(VAR_0, block,\noffset | RAM_SAVE_FLAG_PAGE);", "if (send_async) {", "qemu_put_buffer_async(VAR_0->f, p, TARGET_PAGE_SIZE,\nmigrate_release_ram() &\nmigration_in_postcopy());", "} else {", "qemu_put_buffer(VAR_0->f, p, TARGET_PAGE_SIZE);", "}", "VAR_0->bytes_transferred += TARGET_PAGE_SIZE;", "VAR_3 = 1;", "VAR_0->norm_pages++;", "}", "XBZRLE_cache_unlock();", "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, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 31 ], [ 33, 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 51 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91, 93 ], [ 95 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 115 ], [ 117, 119 ], [ 121 ], [ 123, 125, 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 145 ], [ 149 ], [ 151 ] ]
15,504
static inline int vmsvga_fifo_empty(struct vmsvga_state_s *s) { if (!s->config || !s->enable) return 1; return (s->cmd->next_cmd == s->cmd->stop); }
true
qemu
4dedc07ffbbc66002e0fd2b97d5516fe6aca5eea
static inline int vmsvga_fifo_empty(struct vmsvga_state_s *s) { if (!s->config || !s->enable) return 1; return (s->cmd->next_cmd == s->cmd->stop); }
{ "code": [ "static inline int vmsvga_fifo_empty(struct vmsvga_state_s *s)", " return 1;", " return (s->cmd->next_cmd == s->cmd->stop);" ], "line_no": [ 1, 7, 9 ] }
static inline int FUNC_0(struct vmsvga_state_s *VAR_0) { if (!VAR_0->config || !VAR_0->enable) return 1; return (VAR_0->cmd->next_cmd == VAR_0->cmd->stop); }
[ "static inline int FUNC_0(struct vmsvga_state_s *VAR_0)\n{", "if (!VAR_0->config || !VAR_0->enable)\nreturn 1;", "return (VAR_0->cmd->next_cmd == VAR_0->cmd->stop);", "}" ]
[ 1, 1, 1, 0 ]
[ [ 1, 3 ], [ 5, 7 ], [ 9 ], [ 11 ] ]
15,505
static int dnxhd_decode_dct_block_10_444(const DNXHDContext *ctx, RowContext *row, int n) { return dnxhd_decode_dct_block(ctx, row, n, 6, 32, 6); }
false
FFmpeg
6f1ccca4ae3b93b6a2a820a7a0e72081ab35767c
static int dnxhd_decode_dct_block_10_444(const DNXHDContext *ctx, RowContext *row, int n) { return dnxhd_decode_dct_block(ctx, row, n, 6, 32, 6); }
{ "code": [], "line_no": [] }
static int FUNC_0(const DNXHDContext *VAR_0, RowContext *VAR_1, int VAR_2) { return dnxhd_decode_dct_block(VAR_0, VAR_1, VAR_2, 6, 32, 6); }
[ "static int FUNC_0(const DNXHDContext *VAR_0,\nRowContext *VAR_1, int VAR_2)\n{", "return dnxhd_decode_dct_block(VAR_0, VAR_1, VAR_2, 6, 32, 6);", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ] ]
15,506
av_cold int swri_rematrix_init(SwrContext *s){ int i, j; int nb_in = av_get_channel_layout_nb_channels(s->in_ch_layout); int nb_out = av_get_channel_layout_nb_channels(s->out_ch_layout); s->mix_any_f = NULL; if (!s->rematrix_custom) { int r = auto_matrix(s); if (r) return r; } if (s->midbuf.fmt == AV_SAMPLE_FMT_S16P){ s->native_matrix = av_calloc(nb_in * nb_out, sizeof(int)); s->native_one = av_mallocz(sizeof(int)); for (i = 0; i < nb_out; i++) for (j = 0; j < nb_in; j++) ((int*)s->native_matrix)[i * nb_in + j] = lrintf(s->matrix[i][j] * 32768); *((int*)s->native_one) = 32768; s->mix_1_1_f = (mix_1_1_func_type*)copy_s16; s->mix_2_1_f = (mix_2_1_func_type*)sum2_s16; s->mix_any_f = (mix_any_func_type*)get_mix_any_func_s16(s); }else if(s->midbuf.fmt == AV_SAMPLE_FMT_FLTP){ s->native_matrix = av_calloc(nb_in * nb_out, sizeof(float)); s->native_one = av_mallocz(sizeof(float)); for (i = 0; i < nb_out; i++) for (j = 0; j < nb_in; j++) ((float*)s->native_matrix)[i * nb_in + j] = s->matrix[i][j]; *((float*)s->native_one) = 1.0; s->mix_1_1_f = (mix_1_1_func_type*)copy_float; s->mix_2_1_f = (mix_2_1_func_type*)sum2_float; s->mix_any_f = (mix_any_func_type*)get_mix_any_func_float(s); }else if(s->midbuf.fmt == AV_SAMPLE_FMT_DBLP){ s->native_matrix = av_calloc(nb_in * nb_out, sizeof(double)); s->native_one = av_mallocz(sizeof(double)); for (i = 0; i < nb_out; i++) for (j = 0; j < nb_in; j++) ((double*)s->native_matrix)[i * nb_in + j] = s->matrix[i][j]; *((double*)s->native_one) = 1.0; s->mix_1_1_f = (mix_1_1_func_type*)copy_double; s->mix_2_1_f = (mix_2_1_func_type*)sum2_double; s->mix_any_f = (mix_any_func_type*)get_mix_any_func_double(s); }else if(s->midbuf.fmt == AV_SAMPLE_FMT_S32P){ // Only for dithering currently // s->native_matrix = av_calloc(nb_in * nb_out, sizeof(double)); s->native_one = av_mallocz(sizeof(int)); // for (i = 0; i < nb_out; i++) // for (j = 0; j < nb_in; j++) // ((double*)s->native_matrix)[i * nb_in + j] = s->matrix[i][j]; *((int*)s->native_one) = 32768; s->mix_1_1_f = (mix_1_1_func_type*)copy_s32; s->mix_2_1_f = (mix_2_1_func_type*)sum2_s32; s->mix_any_f = (mix_any_func_type*)get_mix_any_func_s32(s); }else av_assert0(0); //FIXME quantize for integeres for (i = 0; i < SWR_CH_MAX; i++) { int ch_in=0; for (j = 0; j < SWR_CH_MAX; j++) { s->matrix32[i][j]= lrintf(s->matrix[i][j] * 32768); if(s->matrix[i][j]) s->matrix_ch[i][++ch_in]= j; } s->matrix_ch[i][0]= ch_in; } if(HAVE_YASM && HAVE_MMX) swri_rematrix_init_x86(s); return 0; }
false
FFmpeg
b74ecb82fa51aba52a95992668546afe8ed2bd9f
av_cold int swri_rematrix_init(SwrContext *s){ int i, j; int nb_in = av_get_channel_layout_nb_channels(s->in_ch_layout); int nb_out = av_get_channel_layout_nb_channels(s->out_ch_layout); s->mix_any_f = NULL; if (!s->rematrix_custom) { int r = auto_matrix(s); if (r) return r; } if (s->midbuf.fmt == AV_SAMPLE_FMT_S16P){ s->native_matrix = av_calloc(nb_in * nb_out, sizeof(int)); s->native_one = av_mallocz(sizeof(int)); for (i = 0; i < nb_out; i++) for (j = 0; j < nb_in; j++) ((int*)s->native_matrix)[i * nb_in + j] = lrintf(s->matrix[i][j] * 32768); *((int*)s->native_one) = 32768; s->mix_1_1_f = (mix_1_1_func_type*)copy_s16; s->mix_2_1_f = (mix_2_1_func_type*)sum2_s16; s->mix_any_f = (mix_any_func_type*)get_mix_any_func_s16(s); }else if(s->midbuf.fmt == AV_SAMPLE_FMT_FLTP){ s->native_matrix = av_calloc(nb_in * nb_out, sizeof(float)); s->native_one = av_mallocz(sizeof(float)); for (i = 0; i < nb_out; i++) for (j = 0; j < nb_in; j++) ((float*)s->native_matrix)[i * nb_in + j] = s->matrix[i][j]; *((float*)s->native_one) = 1.0; s->mix_1_1_f = (mix_1_1_func_type*)copy_float; s->mix_2_1_f = (mix_2_1_func_type*)sum2_float; s->mix_any_f = (mix_any_func_type*)get_mix_any_func_float(s); }else if(s->midbuf.fmt == AV_SAMPLE_FMT_DBLP){ s->native_matrix = av_calloc(nb_in * nb_out, sizeof(double)); s->native_one = av_mallocz(sizeof(double)); for (i = 0; i < nb_out; i++) for (j = 0; j < nb_in; j++) ((double*)s->native_matrix)[i * nb_in + j] = s->matrix[i][j]; *((double*)s->native_one) = 1.0; s->mix_1_1_f = (mix_1_1_func_type*)copy_double; s->mix_2_1_f = (mix_2_1_func_type*)sum2_double; s->mix_any_f = (mix_any_func_type*)get_mix_any_func_double(s); }else if(s->midbuf.fmt == AV_SAMPLE_FMT_S32P){ s->native_one = av_mallocz(sizeof(int)); *((int*)s->native_one) = 32768; s->mix_1_1_f = (mix_1_1_func_type*)copy_s32; s->mix_2_1_f = (mix_2_1_func_type*)sum2_s32; s->mix_any_f = (mix_any_func_type*)get_mix_any_func_s32(s); }else av_assert0(0); for (i = 0; i < SWR_CH_MAX; i++) { int ch_in=0; for (j = 0; j < SWR_CH_MAX; j++) { s->matrix32[i][j]= lrintf(s->matrix[i][j] * 32768); if(s->matrix[i][j]) s->matrix_ch[i][++ch_in]= j; } s->matrix_ch[i][0]= ch_in; } if(HAVE_YASM && HAVE_MMX) swri_rematrix_init_x86(s); return 0; }
{ "code": [], "line_no": [] }
av_cold int FUNC_0(SwrContext *s){ int VAR_0, VAR_1; int VAR_2 = av_get_channel_layout_nb_channels(s->in_ch_layout); int VAR_3 = av_get_channel_layout_nb_channels(s->out_ch_layout); s->mix_any_f = NULL; if (!s->rematrix_custom) { int VAR_4 = auto_matrix(s); if (VAR_4) return VAR_4; } if (s->midbuf.fmt == AV_SAMPLE_FMT_S16P){ s->native_matrix = av_calloc(VAR_2 * VAR_3, sizeof(int)); s->native_one = av_mallocz(sizeof(int)); for (VAR_0 = 0; VAR_0 < VAR_3; VAR_0++) for (VAR_1 = 0; VAR_1 < VAR_2; VAR_1++) ((int*)s->native_matrix)[VAR_0 * VAR_2 + VAR_1] = lrintf(s->matrix[VAR_0][VAR_1] * 32768); *((int*)s->native_one) = 32768; s->mix_1_1_f = (mix_1_1_func_type*)copy_s16; s->mix_2_1_f = (mix_2_1_func_type*)sum2_s16; s->mix_any_f = (mix_any_func_type*)get_mix_any_func_s16(s); }else if(s->midbuf.fmt == AV_SAMPLE_FMT_FLTP){ s->native_matrix = av_calloc(VAR_2 * VAR_3, sizeof(float)); s->native_one = av_mallocz(sizeof(float)); for (VAR_0 = 0; VAR_0 < VAR_3; VAR_0++) for (VAR_1 = 0; VAR_1 < VAR_2; VAR_1++) ((float*)s->native_matrix)[VAR_0 * VAR_2 + VAR_1] = s->matrix[VAR_0][VAR_1]; *((float*)s->native_one) = 1.0; s->mix_1_1_f = (mix_1_1_func_type*)copy_float; s->mix_2_1_f = (mix_2_1_func_type*)sum2_float; s->mix_any_f = (mix_any_func_type*)get_mix_any_func_float(s); }else if(s->midbuf.fmt == AV_SAMPLE_FMT_DBLP){ s->native_matrix = av_calloc(VAR_2 * VAR_3, sizeof(double)); s->native_one = av_mallocz(sizeof(double)); for (VAR_0 = 0; VAR_0 < VAR_3; VAR_0++) for (VAR_1 = 0; VAR_1 < VAR_2; VAR_1++) ((double*)s->native_matrix)[VAR_0 * VAR_2 + VAR_1] = s->matrix[VAR_0][VAR_1]; *((double*)s->native_one) = 1.0; s->mix_1_1_f = (mix_1_1_func_type*)copy_double; s->mix_2_1_f = (mix_2_1_func_type*)sum2_double; s->mix_any_f = (mix_any_func_type*)get_mix_any_func_double(s); }else if(s->midbuf.fmt == AV_SAMPLE_FMT_S32P){ s->native_one = av_mallocz(sizeof(int)); *((int*)s->native_one) = 32768; s->mix_1_1_f = (mix_1_1_func_type*)copy_s32; s->mix_2_1_f = (mix_2_1_func_type*)sum2_s32; s->mix_any_f = (mix_any_func_type*)get_mix_any_func_s32(s); }else av_assert0(0); for (VAR_0 = 0; VAR_0 < SWR_CH_MAX; VAR_0++) { int ch_in=0; for (VAR_1 = 0; VAR_1 < SWR_CH_MAX; VAR_1++) { s->matrix32[VAR_0][VAR_1]= lrintf(s->matrix[VAR_0][VAR_1] * 32768); if(s->matrix[VAR_0][VAR_1]) s->matrix_ch[VAR_0][++ch_in]= VAR_1; } s->matrix_ch[VAR_0][0]= ch_in; } if(HAVE_YASM && HAVE_MMX) swri_rematrix_init_x86(s); return 0; }
[ "av_cold int FUNC_0(SwrContext *s){", "int VAR_0, VAR_1;", "int VAR_2 = av_get_channel_layout_nb_channels(s->in_ch_layout);", "int VAR_3 = av_get_channel_layout_nb_channels(s->out_ch_layout);", "s->mix_any_f = NULL;", "if (!s->rematrix_custom) {", "int VAR_4 = auto_matrix(s);", "if (VAR_4)\nreturn VAR_4;", "}", "if (s->midbuf.fmt == AV_SAMPLE_FMT_S16P){", "s->native_matrix = av_calloc(VAR_2 * VAR_3, sizeof(int));", "s->native_one = av_mallocz(sizeof(int));", "for (VAR_0 = 0; VAR_0 < VAR_3; VAR_0++)", "for (VAR_1 = 0; VAR_1 < VAR_2; VAR_1++)", "((int*)s->native_matrix)[VAR_0 * VAR_2 + VAR_1] = lrintf(s->matrix[VAR_0][VAR_1] * 32768);", "*((int*)s->native_one) = 32768;", "s->mix_1_1_f = (mix_1_1_func_type*)copy_s16;", "s->mix_2_1_f = (mix_2_1_func_type*)sum2_s16;", "s->mix_any_f = (mix_any_func_type*)get_mix_any_func_s16(s);", "}else if(s->midbuf.fmt == AV_SAMPLE_FMT_FLTP){", "s->native_matrix = av_calloc(VAR_2 * VAR_3, sizeof(float));", "s->native_one = av_mallocz(sizeof(float));", "for (VAR_0 = 0; VAR_0 < VAR_3; VAR_0++)", "for (VAR_1 = 0; VAR_1 < VAR_2; VAR_1++)", "((float*)s->native_matrix)[VAR_0 * VAR_2 + VAR_1] = s->matrix[VAR_0][VAR_1];", "*((float*)s->native_one) = 1.0;", "s->mix_1_1_f = (mix_1_1_func_type*)copy_float;", "s->mix_2_1_f = (mix_2_1_func_type*)sum2_float;", "s->mix_any_f = (mix_any_func_type*)get_mix_any_func_float(s);", "}else if(s->midbuf.fmt == AV_SAMPLE_FMT_DBLP){", "s->native_matrix = av_calloc(VAR_2 * VAR_3, sizeof(double));", "s->native_one = av_mallocz(sizeof(double));", "for (VAR_0 = 0; VAR_0 < VAR_3; VAR_0++)", "for (VAR_1 = 0; VAR_1 < VAR_2; VAR_1++)", "((double*)s->native_matrix)[VAR_0 * VAR_2 + VAR_1] = s->matrix[VAR_0][VAR_1];", "*((double*)s->native_one) = 1.0;", "s->mix_1_1_f = (mix_1_1_func_type*)copy_double;", "s->mix_2_1_f = (mix_2_1_func_type*)sum2_double;", "s->mix_any_f = (mix_any_func_type*)get_mix_any_func_double(s);", "}else if(s->midbuf.fmt == AV_SAMPLE_FMT_S32P){", "s->native_one = av_mallocz(sizeof(int));", "*((int*)s->native_one) = 32768;", "s->mix_1_1_f = (mix_1_1_func_type*)copy_s32;", "s->mix_2_1_f = (mix_2_1_func_type*)sum2_s32;", "s->mix_any_f = (mix_any_func_type*)get_mix_any_func_s32(s);", "}else", "av_assert0(0);", "for (VAR_0 = 0; VAR_0 < SWR_CH_MAX; VAR_0++) {", "int ch_in=0;", "for (VAR_1 = 0; VAR_1 < SWR_CH_MAX; VAR_1++) {", "s->matrix32[VAR_0][VAR_1]= lrintf(s->matrix[VAR_0][VAR_1] * 32768);", "if(s->matrix[VAR_0][VAR_1])\ns->matrix_ch[VAR_0][++ch_in]= VAR_1;", "}", "s->matrix_ch[VAR_0][0]= ch_in;", "}", "if(HAVE_YASM && HAVE_MMX) swri_rematrix_init_x86(s);", "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 ]
[ [ 1 ], [ 3 ], [ 5 ], [ 7 ], [ 11 ], [ 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 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 91 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121, 123 ], [ 125 ], [ 127 ], [ 129 ], [ 133 ], [ 137 ], [ 139 ] ]
15,507
static int unpack_modes(Vp3DecodeContext *s, GetBitContext *gb) { int i, j, k, sb_x, sb_y; int scheme; int current_macroblock; int current_fragment; int coding_mode; int custom_mode_alphabet[CODING_MODE_COUNT]; if (s->keyframe) { for (i = 0; i < s->fragment_count; i++) s->all_fragments[i].coding_method = MODE_INTRA; } else { /* fetch the mode coding scheme for this frame */ scheme = get_bits(gb, 3); /* is it a custom coding scheme? */ if (scheme == 0) { for (i = 0; i < 8; i++) custom_mode_alphabet[i] = MODE_INTER_NO_MV; for (i = 0; i < 8; i++) custom_mode_alphabet[get_bits(gb, 3)] = i; } /* iterate through all of the macroblocks that contain 1 or more * coded fragments */ for (sb_y = 0; sb_y < s->y_superblock_height; sb_y++) { for (sb_x = 0; sb_x < s->y_superblock_width; sb_x++) { for (j = 0; j < 4; j++) { int mb_x = 2*sb_x + (j>>1); int mb_y = 2*sb_y + (((j>>1)+j)&1); int frags_coded = 0; current_macroblock = mb_y * s->macroblock_width + mb_x; if (mb_x >= s->macroblock_width || mb_y >= s->macroblock_height) continue; #define BLOCK_X (2*mb_x + (k&1)) #define BLOCK_Y (2*mb_y + (k>>1)) /* coding modes are only stored if the macroblock has at least one * luma block coded, otherwise it must be INTER_NO_MV */ for (k = 0; k < 4; k++) { current_fragment = BLOCK_Y*s->fragment_width + BLOCK_X; if (s->all_fragments[current_fragment].coding_method != MODE_COPY) break; } if (k == 4) { s->macroblock_coding[current_macroblock] = MODE_INTER_NO_MV; continue; } /* mode 7 means get 3 bits for each coding mode */ if (scheme == 7) coding_mode = get_bits(gb, 3); else if(scheme == 0) coding_mode = custom_mode_alphabet [get_vlc2(gb, s->mode_code_vlc.table, 3, 3)]; else coding_mode = ModeAlphabet[scheme-1] [get_vlc2(gb, s->mode_code_vlc.table, 3, 3)]; s->macroblock_coding[current_macroblock] = coding_mode; for (k = 0; k < 4; k++) { current_fragment = BLOCK_Y*s->fragment_width + BLOCK_X; if (s->all_fragments[current_fragment].coding_method != MODE_COPY) s->all_fragments[current_fragment].coding_method = coding_mode; } for (k = 0; k < 2; k++) { current_fragment = s->fragment_start[k+1] + mb_y*(s->fragment_width>>1) + mb_x; if (s->all_fragments[current_fragment].coding_method != MODE_COPY) s->all_fragments[current_fragment].coding_method = coding_mode; } } } } } return 0; }
false
FFmpeg
7c2e31d1f0198fad23cddbd8f206a04173fe6d0d
static int unpack_modes(Vp3DecodeContext *s, GetBitContext *gb) { int i, j, k, sb_x, sb_y; int scheme; int current_macroblock; int current_fragment; int coding_mode; int custom_mode_alphabet[CODING_MODE_COUNT]; if (s->keyframe) { for (i = 0; i < s->fragment_count; i++) s->all_fragments[i].coding_method = MODE_INTRA; } else { scheme = get_bits(gb, 3); if (scheme == 0) { for (i = 0; i < 8; i++) custom_mode_alphabet[i] = MODE_INTER_NO_MV; for (i = 0; i < 8; i++) custom_mode_alphabet[get_bits(gb, 3)] = i; } for (sb_y = 0; sb_y < s->y_superblock_height; sb_y++) { for (sb_x = 0; sb_x < s->y_superblock_width; sb_x++) { for (j = 0; j < 4; j++) { int mb_x = 2*sb_x + (j>>1); int mb_y = 2*sb_y + (((j>>1)+j)&1); int frags_coded = 0; current_macroblock = mb_y * s->macroblock_width + mb_x; if (mb_x >= s->macroblock_width || mb_y >= s->macroblock_height) continue; #define BLOCK_X (2*mb_x + (k&1)) #define BLOCK_Y (2*mb_y + (k>>1)) for (k = 0; k < 4; k++) { current_fragment = BLOCK_Y*s->fragment_width + BLOCK_X; if (s->all_fragments[current_fragment].coding_method != MODE_COPY) break; } if (k == 4) { s->macroblock_coding[current_macroblock] = MODE_INTER_NO_MV; continue; } if (scheme == 7) coding_mode = get_bits(gb, 3); else if(scheme == 0) coding_mode = custom_mode_alphabet [get_vlc2(gb, s->mode_code_vlc.table, 3, 3)]; else coding_mode = ModeAlphabet[scheme-1] [get_vlc2(gb, s->mode_code_vlc.table, 3, 3)]; s->macroblock_coding[current_macroblock] = coding_mode; for (k = 0; k < 4; k++) { current_fragment = BLOCK_Y*s->fragment_width + BLOCK_X; if (s->all_fragments[current_fragment].coding_method != MODE_COPY) s->all_fragments[current_fragment].coding_method = coding_mode; } for (k = 0; k < 2; k++) { current_fragment = s->fragment_start[k+1] + mb_y*(s->fragment_width>>1) + mb_x; if (s->all_fragments[current_fragment].coding_method != MODE_COPY) s->all_fragments[current_fragment].coding_method = coding_mode; } } } } } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(Vp3DecodeContext *VAR_0, GetBitContext *VAR_1) { int VAR_2, VAR_3, VAR_4, VAR_5, VAR_6; int VAR_7; int VAR_8; int VAR_9; int VAR_10; int VAR_11[CODING_MODE_COUNT]; if (VAR_0->keyframe) { for (VAR_2 = 0; VAR_2 < VAR_0->fragment_count; VAR_2++) VAR_0->all_fragments[VAR_2].coding_method = MODE_INTRA; } else { VAR_7 = get_bits(VAR_1, 3); if (VAR_7 == 0) { for (VAR_2 = 0; VAR_2 < 8; VAR_2++) VAR_11[VAR_2] = MODE_INTER_NO_MV; for (VAR_2 = 0; VAR_2 < 8; VAR_2++) VAR_11[get_bits(VAR_1, 3)] = VAR_2; } for (VAR_6 = 0; VAR_6 < VAR_0->y_superblock_height; VAR_6++) { for (VAR_5 = 0; VAR_5 < VAR_0->y_superblock_width; VAR_5++) { for (VAR_3 = 0; VAR_3 < 4; VAR_3++) { int mb_x = 2*VAR_5 + (VAR_3>>1); int mb_y = 2*VAR_6 + (((VAR_3>>1)+VAR_3)&1); int frags_coded = 0; VAR_8 = mb_y * VAR_0->macroblock_width + mb_x; if (mb_x >= VAR_0->macroblock_width || mb_y >= VAR_0->macroblock_height) continue; #define BLOCK_X (2*mb_x + (VAR_4&1)) #define BLOCK_Y (2*mb_y + (VAR_4>>1)) for (VAR_4 = 0; VAR_4 < 4; VAR_4++) { VAR_9 = BLOCK_Y*VAR_0->fragment_width + BLOCK_X; if (VAR_0->all_fragments[VAR_9].coding_method != MODE_COPY) break; } if (VAR_4 == 4) { VAR_0->macroblock_coding[VAR_8] = MODE_INTER_NO_MV; continue; } if (VAR_7 == 7) VAR_10 = get_bits(VAR_1, 3); else if(VAR_7 == 0) VAR_10 = VAR_11 [get_vlc2(VAR_1, VAR_0->mode_code_vlc.table, 3, 3)]; else VAR_10 = ModeAlphabet[VAR_7-1] [get_vlc2(VAR_1, VAR_0->mode_code_vlc.table, 3, 3)]; VAR_0->macroblock_coding[VAR_8] = VAR_10; for (VAR_4 = 0; VAR_4 < 4; VAR_4++) { VAR_9 = BLOCK_Y*VAR_0->fragment_width + BLOCK_X; if (VAR_0->all_fragments[VAR_9].coding_method != MODE_COPY) VAR_0->all_fragments[VAR_9].coding_method = VAR_10; } for (VAR_4 = 0; VAR_4 < 2; VAR_4++) { VAR_9 = VAR_0->fragment_start[VAR_4+1] + mb_y*(VAR_0->fragment_width>>1) + mb_x; if (VAR_0->all_fragments[VAR_9].coding_method != MODE_COPY) VAR_0->all_fragments[VAR_9].coding_method = VAR_10; } } } } } return 0; }
[ "static int FUNC_0(Vp3DecodeContext *VAR_0, GetBitContext *VAR_1)\n{", "int VAR_2, VAR_3, VAR_4, VAR_5, VAR_6;", "int VAR_7;", "int VAR_8;", "int VAR_9;", "int VAR_10;", "int VAR_11[CODING_MODE_COUNT];", "if (VAR_0->keyframe) {", "for (VAR_2 = 0; VAR_2 < VAR_0->fragment_count; VAR_2++)", "VAR_0->all_fragments[VAR_2].coding_method = MODE_INTRA;", "} else {", "VAR_7 = get_bits(VAR_1, 3);", "if (VAR_7 == 0) {", "for (VAR_2 = 0; VAR_2 < 8; VAR_2++)", "VAR_11[VAR_2] = MODE_INTER_NO_MV;", "for (VAR_2 = 0; VAR_2 < 8; VAR_2++)", "VAR_11[get_bits(VAR_1, 3)] = VAR_2;", "}", "for (VAR_6 = 0; VAR_6 < VAR_0->y_superblock_height; VAR_6++) {", "for (VAR_5 = 0; VAR_5 < VAR_0->y_superblock_width; VAR_5++) {", "for (VAR_3 = 0; VAR_3 < 4; VAR_3++) {", "int mb_x = 2*VAR_5 + (VAR_3>>1);", "int mb_y = 2*VAR_6 + (((VAR_3>>1)+VAR_3)&1);", "int frags_coded = 0;", "VAR_8 = mb_y * VAR_0->macroblock_width + mb_x;", "if (mb_x >= VAR_0->macroblock_width || mb_y >= VAR_0->macroblock_height)\ncontinue;", "#define BLOCK_X (2*mb_x + (VAR_4&1))\n#define BLOCK_Y (2*mb_y + (VAR_4>>1))\nfor (VAR_4 = 0; VAR_4 < 4; VAR_4++) {", "VAR_9 = BLOCK_Y*VAR_0->fragment_width + BLOCK_X;", "if (VAR_0->all_fragments[VAR_9].coding_method != MODE_COPY)\nbreak;", "}", "if (VAR_4 == 4) {", "VAR_0->macroblock_coding[VAR_8] = MODE_INTER_NO_MV;", "continue;", "}", "if (VAR_7 == 7)\nVAR_10 = get_bits(VAR_1, 3);", "else if(VAR_7 == 0)\nVAR_10 = VAR_11\n[get_vlc2(VAR_1, VAR_0->mode_code_vlc.table, 3, 3)];", "else\nVAR_10 = ModeAlphabet[VAR_7-1]\n[get_vlc2(VAR_1, VAR_0->mode_code_vlc.table, 3, 3)];", "VAR_0->macroblock_coding[VAR_8] = VAR_10;", "for (VAR_4 = 0; VAR_4 < 4; VAR_4++) {", "VAR_9 =\nBLOCK_Y*VAR_0->fragment_width + BLOCK_X;", "if (VAR_0->all_fragments[VAR_9].coding_method !=\nMODE_COPY)\nVAR_0->all_fragments[VAR_9].coding_method =\nVAR_10;", "}", "for (VAR_4 = 0; VAR_4 < 2; VAR_4++) {", "VAR_9 = VAR_0->fragment_start[VAR_4+1] +\nmb_y*(VAR_0->fragment_width>>1) + mb_x;", "if (VAR_0->all_fragments[VAR_9].coding_method !=\nMODE_COPY)\nVAR_0->all_fragments[VAR_9].coding_method =\nVAR_10;", "}", "}", "}", "}", "}", "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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 33 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 75, 77 ], [ 81, 83, 89 ], [ 91 ], [ 93, 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 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 ] ]
15,508
static int h264_probe(AVProbeData *p) { uint32_t code = -1; int sps = 0, pps = 0, idr = 0, res = 0, sli = 0; int i; for (i = 0; i < p->buf_size; i++) { code = (code << 8) + p->buf[i]; if ((code & 0xffffff00) == 0x100) { int ref_idc = (code >> 5) & 3; int type = code & 0x1F; static const int8_t ref_zero[] = { 2, 0, 0, 0, 0, -1, 1, -1, -1, 1, 1, 1, 1, -1, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 }; if (code & 0x80) // forbidden_bit return 0; if (ref_zero[type] == 1 && ref_idc) return 0; if (ref_zero[type] == -1 && !ref_idc) return 0; if (ref_zero[type] == 2) { if (!(code == 0x100 && !p->buf[i + 1] && !p->buf[i + 2])) res++; } switch (type) { case 1: sli++; break; case 5: idr++; break; case 7: if (p->buf[i + 2] & 0x03) return 0; sps++; break; case 8: pps++; break; } } } ff_tlog(NULL, "sps:%d pps:%d idr:%d sli:%d res:%d\n", sps, pps, idr, sli, res); if (sps && pps && (idr || sli > 3) && res < (sps + pps + idr)) return AVPROBE_SCORE_EXTENSION + 1; // 1 more than .mpg return 0; }
false
FFmpeg
3646ef6f7c0c02dc6d2f393f9fd0f6ebcbf15b44
static int h264_probe(AVProbeData *p) { uint32_t code = -1; int sps = 0, pps = 0, idr = 0, res = 0, sli = 0; int i; for (i = 0; i < p->buf_size; i++) { code = (code << 8) + p->buf[i]; if ((code & 0xffffff00) == 0x100) { int ref_idc = (code >> 5) & 3; int type = code & 0x1F; static const int8_t ref_zero[] = { 2, 0, 0, 0, 0, -1, 1, -1, -1, 1, 1, 1, 1, -1, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 }; if (code & 0x80) return 0; if (ref_zero[type] == 1 && ref_idc) return 0; if (ref_zero[type] == -1 && !ref_idc) return 0; if (ref_zero[type] == 2) { if (!(code == 0x100 && !p->buf[i + 1] && !p->buf[i + 2])) res++; } switch (type) { case 1: sli++; break; case 5: idr++; break; case 7: if (p->buf[i + 2] & 0x03) return 0; sps++; break; case 8: pps++; break; } } } ff_tlog(NULL, "sps:%d pps:%d idr:%d sli:%d res:%d\n", sps, pps, idr, sli, res); if (sps && pps && (idr || sli > 3) && res < (sps + pps + idr)) return AVPROBE_SCORE_EXTENSION + 1; return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVProbeData *VAR_0) { uint32_t code = -1; int VAR_1 = 0, VAR_2 = 0, VAR_3 = 0, VAR_4 = 0, VAR_5 = 0; int VAR_6; for (VAR_6 = 0; VAR_6 < VAR_0->buf_size; VAR_6++) { code = (code << 8) + VAR_0->buf[VAR_6]; if ((code & 0xffffff00) == 0x100) { int ref_idc = (code >> 5) & 3; int type = code & 0x1F; static const int8_t ref_zero[] = { 2, 0, 0, 0, 0, -1, 1, -1, -1, 1, 1, 1, 1, -1, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 }; if (code & 0x80) return 0; if (ref_zero[type] == 1 && ref_idc) return 0; if (ref_zero[type] == -1 && !ref_idc) return 0; if (ref_zero[type] == 2) { if (!(code == 0x100 && !VAR_0->buf[VAR_6 + 1] && !VAR_0->buf[VAR_6 + 2])) VAR_4++; } switch (type) { case 1: VAR_5++; break; case 5: VAR_3++; break; case 7: if (VAR_0->buf[VAR_6 + 2] & 0x03) return 0; VAR_1++; break; case 8: VAR_2++; break; } } } ff_tlog(NULL, "VAR_1:%d VAR_2:%d VAR_3:%d VAR_5:%d VAR_4:%d\n", VAR_1, VAR_2, VAR_3, VAR_5, VAR_4); if (VAR_1 && VAR_2 && (VAR_3 || VAR_5 > 3) && VAR_4 < (VAR_1 + VAR_2 + VAR_3)) return AVPROBE_SCORE_EXTENSION + 1; return 0; }
[ "static int FUNC_0(AVProbeData *VAR_0)\n{", "uint32_t code = -1;", "int VAR_1 = 0, VAR_2 = 0, VAR_3 = 0, VAR_4 = 0, VAR_5 = 0;", "int VAR_6;", "for (VAR_6 = 0; VAR_6 < VAR_0->buf_size; VAR_6++) {", "code = (code << 8) + VAR_0->buf[VAR_6];", "if ((code & 0xffffff00) == 0x100) {", "int ref_idc = (code >> 5) & 3;", "int type = code & 0x1F;", "static const int8_t ref_zero[] = {", "2, 0, 0, 0, 0, -1, 1, -1,\n-1, 1, 1, 1, 1, -1, 2, 2,\n2, 2, 2, 0, 2, 2, 2, 2,\n2, 2, 2, 2, 2, 2, 2, 2\n};", "if (code & 0x80)\nreturn 0;", "if (ref_zero[type] == 1 && ref_idc)\nreturn 0;", "if (ref_zero[type] == -1 && !ref_idc)\nreturn 0;", "if (ref_zero[type] == 2) {", "if (!(code == 0x100 && !VAR_0->buf[VAR_6 + 1] && !VAR_0->buf[VAR_6 + 2]))\nVAR_4++;", "}", "switch (type) {", "case 1:\nVAR_5++;", "break;", "case 5:\nVAR_3++;", "break;", "case 7:\nif (VAR_0->buf[VAR_6 + 2] & 0x03)\nreturn 0;", "VAR_1++;", "break;", "case 8:\nVAR_2++;", "break;", "}", "}", "}", "ff_tlog(NULL, \"VAR_1:%d VAR_2:%d VAR_3:%d VAR_5:%d VAR_4:%d\\n\", VAR_1, VAR_2, VAR_3, VAR_5, VAR_4);", "if (VAR_1 && VAR_2 && (VAR_3 || VAR_5 > 3) && VAR_4 < (VAR_1 + VAR_2 + VAR_3))\nreturn AVPROBE_SCORE_EXTENSION + 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, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25, 27, 29, 31, 33 ], [ 37, 39 ], [ 43, 45 ], [ 47, 49 ], [ 51 ], [ 53, 55 ], [ 57 ], [ 61 ], [ 63, 65 ], [ 67 ], [ 69, 71 ], [ 73 ], [ 75, 77, 79 ], [ 81 ], [ 83 ], [ 85, 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 101, 103 ], [ 107 ], [ 109 ] ]
15,509
static int mov_write_tapt_tag(AVIOContext *pb, MOVTrack *track) { int32_t width = av_rescale(track->enc->sample_aspect_ratio.num, track->enc->width, track->enc->sample_aspect_ratio.den); int64_t pos = avio_tell(pb); avio_wb32(pb, 0); /* size */ ffio_wfourcc(pb, "tapt"); avio_wb32(pb, 20); ffio_wfourcc(pb, "clef"); avio_wb32(pb, 0); avio_wb32(pb, width << 16); avio_wb32(pb, track->enc->height << 16); avio_wb32(pb, 20); ffio_wfourcc(pb, "enof"); avio_wb32(pb, 0); avio_wb32(pb, track->enc->width << 16); avio_wb32(pb, track->enc->height << 16); return updateSize(pb, pos); };
false
FFmpeg
373211d828f351d86908d47828444f620bfd176d
static int mov_write_tapt_tag(AVIOContext *pb, MOVTrack *track) { int32_t width = av_rescale(track->enc->sample_aspect_ratio.num, track->enc->width, track->enc->sample_aspect_ratio.den); int64_t pos = avio_tell(pb); avio_wb32(pb, 0); ffio_wfourcc(pb, "tapt"); avio_wb32(pb, 20); ffio_wfourcc(pb, "clef"); avio_wb32(pb, 0); avio_wb32(pb, width << 16); avio_wb32(pb, track->enc->height << 16); avio_wb32(pb, 20); ffio_wfourcc(pb, "enof"); avio_wb32(pb, 0); avio_wb32(pb, track->enc->width << 16); avio_wb32(pb, track->enc->height << 16); return updateSize(pb, pos); };
{ "code": [], "line_no": [] }
static int FUNC_0(AVIOContext *VAR_0, MOVTrack *VAR_1) { int32_t width = av_rescale(VAR_1->enc->sample_aspect_ratio.num, VAR_1->enc->width, VAR_1->enc->sample_aspect_ratio.den); int64_t pos = avio_tell(VAR_0); avio_wb32(VAR_0, 0); ffio_wfourcc(VAR_0, "tapt"); avio_wb32(VAR_0, 20); ffio_wfourcc(VAR_0, "clef"); avio_wb32(VAR_0, 0); avio_wb32(VAR_0, width << 16); avio_wb32(VAR_0, VAR_1->enc->height << 16); avio_wb32(VAR_0, 20); ffio_wfourcc(VAR_0, "enof"); avio_wb32(VAR_0, 0); avio_wb32(VAR_0, VAR_1->enc->width << 16); avio_wb32(VAR_0, VAR_1->enc->height << 16); return updateSize(VAR_0, pos); };
[ "static int FUNC_0(AVIOContext *VAR_0, MOVTrack *VAR_1)\n{", "int32_t width = av_rescale(VAR_1->enc->sample_aspect_ratio.num, VAR_1->enc->width,\nVAR_1->enc->sample_aspect_ratio.den);", "int64_t pos = avio_tell(VAR_0);", "avio_wb32(VAR_0, 0);", "ffio_wfourcc(VAR_0, \"tapt\");", "avio_wb32(VAR_0, 20);", "ffio_wfourcc(VAR_0, \"clef\");", "avio_wb32(VAR_0, 0);", "avio_wb32(VAR_0, width << 16);", "avio_wb32(VAR_0, VAR_1->enc->height << 16);", "avio_wb32(VAR_0, 20);", "ffio_wfourcc(VAR_0, \"enof\");", "avio_wb32(VAR_0, 0);", "avio_wb32(VAR_0, VAR_1->enc->width << 16);", "avio_wb32(VAR_0, VAR_1->enc->height << 16);", "return updateSize(VAR_0, pos);", "};" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5, 7 ], [ 11 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ] ]
15,510
static inline void RENAME(rgb24ToUV_half)(uint8_t *dstU, uint8_t *dstV, const uint8_t *src1, const uint8_t *src2, long width, uint32_t *unused) { int i; assert(src1==src2); for (i=0; i<width; i++) { int r= src1[6*i + 0] + src1[6*i + 3]; int g= src1[6*i + 1] + src1[6*i + 4]; int b= src1[6*i + 2] + src1[6*i + 5]; dstU[i]= (RU*r + GU*g + BU*b + (257<<RGB2YUV_SHIFT))>>(RGB2YUV_SHIFT+1); dstV[i]= (RV*r + GV*g + BV*b + (257<<RGB2YUV_SHIFT))>>(RGB2YUV_SHIFT+1); } }
false
FFmpeg
d1adad3cca407f493c3637e20ecd4f7124e69212
static inline void RENAME(rgb24ToUV_half)(uint8_t *dstU, uint8_t *dstV, const uint8_t *src1, const uint8_t *src2, long width, uint32_t *unused) { int i; assert(src1==src2); for (i=0; i<width; i++) { int r= src1[6*i + 0] + src1[6*i + 3]; int g= src1[6*i + 1] + src1[6*i + 4]; int b= src1[6*i + 2] + src1[6*i + 5]; dstU[i]= (RU*r + GU*g + BU*b + (257<<RGB2YUV_SHIFT))>>(RGB2YUV_SHIFT+1); dstV[i]= (RV*r + GV*g + BV*b + (257<<RGB2YUV_SHIFT))>>(RGB2YUV_SHIFT+1); } }
{ "code": [], "line_no": [] }
static inline void FUNC_0(rgb24ToUV_half)(uint8_t *dstU, uint8_t *dstV, const uint8_t *src1, const uint8_t *src2, long width, uint32_t *unused) { int VAR_0; assert(src1==src2); for (VAR_0=0; VAR_0<width; VAR_0++) { int r= src1[6*VAR_0 + 0] + src1[6*VAR_0 + 3]; int g= src1[6*VAR_0 + 1] + src1[6*VAR_0 + 4]; int b= src1[6*VAR_0 + 2] + src1[6*VAR_0 + 5]; dstU[VAR_0]= (RU*r + GU*g + BU*b + (257<<RGB2YUV_SHIFT))>>(RGB2YUV_SHIFT+1); dstV[VAR_0]= (RV*r + GV*g + BV*b + (257<<RGB2YUV_SHIFT))>>(RGB2YUV_SHIFT+1); } }
[ "static inline void FUNC_0(rgb24ToUV_half)(uint8_t *dstU, uint8_t *dstV, const uint8_t *src1, const uint8_t *src2, long width, uint32_t *unused)\n{", "int VAR_0;", "assert(src1==src2);", "for (VAR_0=0; VAR_0<width; VAR_0++) {", "int r= src1[6*VAR_0 + 0] + src1[6*VAR_0 + 3];", "int g= src1[6*VAR_0 + 1] + src1[6*VAR_0 + 4];", "int b= src1[6*VAR_0 + 2] + src1[6*VAR_0 + 5];", "dstU[VAR_0]= (RU*r + GU*g + BU*b + (257<<RGB2YUV_SHIFT))>>(RGB2YUV_SHIFT+1);", "dstV[VAR_0]= (RV*r + GV*g + BV*b + (257<<RGB2YUV_SHIFT))>>(RGB2YUV_SHIFT+1);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ] ]
15,511
static inline int parse_nal_units(AVCodecParserContext *s, AVCodecContext *avctx, const uint8_t * const buf, int buf_size) { H264ParseContext *p = s->priv_data; H2645NAL nal = { NULL }; int buf_index, next_avc; unsigned int pps_id; unsigned int slice_type; int state = -1, got_reset = 0; int q264 = buf_size >=4 && !memcmp("Q264", buf, 4); int field_poc[2]; int ret; /* set some sane default values */ s->pict_type = AV_PICTURE_TYPE_I; s->key_frame = 0; s->picture_structure = AV_PICTURE_STRUCTURE_UNKNOWN; ff_h264_sei_uninit(&p->sei); p->sei.frame_packing.frame_packing_arrangement_cancel_flag = -1; if (!buf_size) return 0; buf_index = 0; next_avc = p->is_avc ? 0 : buf_size; for (;;) { const SPS *sps; int src_length, consumed, nalsize = 0; if (buf_index >= next_avc) { nalsize = get_nalsize(p->nal_length_size, buf, buf_size, &buf_index, avctx); if (nalsize < 0) break; next_avc = buf_index + nalsize; } else { buf_index = find_start_code(buf, buf_size, buf_index, next_avc); if (buf_index >= buf_size) break; if (buf_index >= next_avc) continue; } src_length = next_avc - buf_index; state = buf[buf_index]; switch (state & 0x1f) { case H264_NAL_SLICE: case H264_NAL_IDR_SLICE: // Do not walk the whole buffer just to decode slice header if ((state & 0x1f) == H264_NAL_IDR_SLICE || ((state >> 5) & 0x3) == 0) { /* IDR or disposable slice * No need to decode many bytes because MMCOs shall not be present. */ if (src_length > 60) src_length = 60; } else { /* To decode up to MMCOs */ if (src_length > 1000) src_length = 1000; } break; } consumed = ff_h2645_extract_rbsp(buf + buf_index, src_length, &nal, 1); if (consumed < 0) break; buf_index += consumed; ret = init_get_bits8(&nal.gb, nal.data, nal.size); if (ret < 0) goto fail; get_bits1(&nal.gb); nal.ref_idc = get_bits(&nal.gb, 2); nal.type = get_bits(&nal.gb, 5); switch (nal.type) { case H264_NAL_SPS: ff_h264_decode_seq_parameter_set(&nal.gb, avctx, &p->ps, 0); break; case H264_NAL_PPS: ff_h264_decode_picture_parameter_set(&nal.gb, avctx, &p->ps, nal.size_bits); break; case H264_NAL_SEI: ff_h264_sei_decode(&p->sei, &nal.gb, &p->ps, avctx); break; case H264_NAL_IDR_SLICE: s->key_frame = 1; p->poc.prev_frame_num = 0; p->poc.prev_frame_num_offset = 0; p->poc.prev_poc_msb = p->poc.prev_poc_lsb = 0; /* fall through */ case H264_NAL_SLICE: get_ue_golomb_long(&nal.gb); // skip first_mb_in_slice slice_type = get_ue_golomb_31(&nal.gb); s->pict_type = ff_h264_golomb_to_pict_type[slice_type % 5]; if (p->sei.recovery_point.recovery_frame_cnt >= 0) { /* key frame, since recovery_frame_cnt is set */ s->key_frame = 1; } pps_id = get_ue_golomb(&nal.gb); if (pps_id >= MAX_PPS_COUNT) { av_log(avctx, AV_LOG_ERROR, "pps_id %u out of range\n", pps_id); goto fail; } if (!p->ps.pps_list[pps_id]) { av_log(avctx, AV_LOG_ERROR, "non-existing PPS %u referenced\n", pps_id); goto fail; } av_buffer_unref(&p->ps.pps_ref); av_buffer_unref(&p->ps.sps_ref); p->ps.pps = NULL; p->ps.sps = NULL; p->ps.pps_ref = av_buffer_ref(p->ps.pps_list[pps_id]); if (!p->ps.pps_ref) goto fail; p->ps.pps = (const PPS*)p->ps.pps_ref->data; if (!p->ps.sps_list[p->ps.pps->sps_id]) { av_log(avctx, AV_LOG_ERROR, "non-existing SPS %u referenced\n", p->ps.pps->sps_id); goto fail; } p->ps.sps_ref = av_buffer_ref(p->ps.sps_list[p->ps.pps->sps_id]); if (!p->ps.sps_ref) goto fail; p->ps.sps = (const SPS*)p->ps.sps_ref->data; sps = p->ps.sps; // heuristic to detect non marked keyframes if (p->ps.sps->ref_frame_count <= 1 && p->ps.pps->ref_count[0] <= 1 && s->pict_type == AV_PICTURE_TYPE_I) s->key_frame = 1; p->poc.frame_num = get_bits(&nal.gb, sps->log2_max_frame_num); s->coded_width = 16 * sps->mb_width; s->coded_height = 16 * sps->mb_height; s->width = s->coded_width - (sps->crop_right + sps->crop_left); s->height = s->coded_height - (sps->crop_top + sps->crop_bottom); if (s->width <= 0 || s->height <= 0) { s->width = s->coded_width; s->height = s->coded_height; } switch (sps->bit_depth_luma) { case 9: if (sps->chroma_format_idc == 3) s->format = AV_PIX_FMT_YUV444P9; else if (sps->chroma_format_idc == 2) s->format = AV_PIX_FMT_YUV422P9; else s->format = AV_PIX_FMT_YUV420P9; break; case 10: if (sps->chroma_format_idc == 3) s->format = AV_PIX_FMT_YUV444P10; else if (sps->chroma_format_idc == 2) s->format = AV_PIX_FMT_YUV422P10; else s->format = AV_PIX_FMT_YUV420P10; break; case 8: if (sps->chroma_format_idc == 3) s->format = AV_PIX_FMT_YUV444P; else if (sps->chroma_format_idc == 2) s->format = AV_PIX_FMT_YUV422P; else s->format = AV_PIX_FMT_YUV420P; break; default: s->format = AV_PIX_FMT_NONE; } avctx->profile = ff_h264_get_profile(sps); avctx->level = sps->level_idc; if (sps->frame_mbs_only_flag) { p->picture_structure = PICT_FRAME; } else { if (get_bits1(&nal.gb)) { // field_pic_flag p->picture_structure = PICT_TOP_FIELD + get_bits1(&nal.gb); // bottom_field_flag } else { p->picture_structure = PICT_FRAME; } } if (nal.type == H264_NAL_IDR_SLICE) get_ue_golomb_long(&nal.gb); /* idr_pic_id */ if (sps->poc_type == 0) { p->poc.poc_lsb = get_bits(&nal.gb, sps->log2_max_poc_lsb); if (p->ps.pps->pic_order_present == 1 && p->picture_structure == PICT_FRAME) p->poc.delta_poc_bottom = get_se_golomb(&nal.gb); } if (sps->poc_type == 1 && !sps->delta_pic_order_always_zero_flag) { p->poc.delta_poc[0] = get_se_golomb(&nal.gb); if (p->ps.pps->pic_order_present == 1 && p->picture_structure == PICT_FRAME) p->poc.delta_poc[1] = get_se_golomb(&nal.gb); } /* Decode POC of this picture. * The prev_ values needed for decoding POC of the next picture are not set here. */ field_poc[0] = field_poc[1] = INT_MAX; ff_h264_init_poc(field_poc, &s->output_picture_number, sps, &p->poc, p->picture_structure, nal.ref_idc); /* Continue parsing to check if MMCO_RESET is present. * FIXME: MMCO_RESET could appear in non-first slice. * Maybe, we should parse all undisposable non-IDR slice of this * picture until encountering MMCO_RESET in a slice of it. */ if (nal.ref_idc && nal.type != H264_NAL_IDR_SLICE) { got_reset = scan_mmco_reset(s, &nal.gb, avctx); if (got_reset < 0) goto fail; } /* Set up the prev_ values for decoding POC of the next picture. */ p->poc.prev_frame_num = got_reset ? 0 : p->poc.frame_num; p->poc.prev_frame_num_offset = got_reset ? 0 : p->poc.frame_num_offset; if (nal.ref_idc != 0) { if (!got_reset) { p->poc.prev_poc_msb = p->poc.poc_msb; p->poc.prev_poc_lsb = p->poc.poc_lsb; } else { p->poc.prev_poc_msb = 0; p->poc.prev_poc_lsb = p->picture_structure == PICT_BOTTOM_FIELD ? 0 : field_poc[0]; } } if (sps->pic_struct_present_flag) { switch (p->sei.picture_timing.pic_struct) { case SEI_PIC_STRUCT_TOP_FIELD: case SEI_PIC_STRUCT_BOTTOM_FIELD: s->repeat_pict = 0; break; case SEI_PIC_STRUCT_FRAME: case SEI_PIC_STRUCT_TOP_BOTTOM: case SEI_PIC_STRUCT_BOTTOM_TOP: s->repeat_pict = 1; break; case SEI_PIC_STRUCT_TOP_BOTTOM_TOP: case SEI_PIC_STRUCT_BOTTOM_TOP_BOTTOM: s->repeat_pict = 2; break; case SEI_PIC_STRUCT_FRAME_DOUBLING: s->repeat_pict = 3; break; case SEI_PIC_STRUCT_FRAME_TRIPLING: s->repeat_pict = 5; break; default: s->repeat_pict = p->picture_structure == PICT_FRAME ? 1 : 0; break; } } else { s->repeat_pict = p->picture_structure == PICT_FRAME ? 1 : 0; } if (p->picture_structure == PICT_FRAME) { s->picture_structure = AV_PICTURE_STRUCTURE_FRAME; if (sps->pic_struct_present_flag) { switch (p->sei.picture_timing.pic_struct) { case SEI_PIC_STRUCT_TOP_BOTTOM: case SEI_PIC_STRUCT_TOP_BOTTOM_TOP: s->field_order = AV_FIELD_TT; break; case SEI_PIC_STRUCT_BOTTOM_TOP: case SEI_PIC_STRUCT_BOTTOM_TOP_BOTTOM: s->field_order = AV_FIELD_BB; break; default: s->field_order = AV_FIELD_PROGRESSIVE; break; } } else { if (field_poc[0] < field_poc[1]) s->field_order = AV_FIELD_TT; else if (field_poc[0] > field_poc[1]) s->field_order = AV_FIELD_BB; else s->field_order = AV_FIELD_PROGRESSIVE; } } else { if (p->picture_structure == PICT_TOP_FIELD) s->picture_structure = AV_PICTURE_STRUCTURE_TOP_FIELD; else s->picture_structure = AV_PICTURE_STRUCTURE_BOTTOM_FIELD; if (p->poc.frame_num == p->last_frame_num && p->last_picture_structure != AV_PICTURE_STRUCTURE_UNKNOWN && p->last_picture_structure != AV_PICTURE_STRUCTURE_FRAME && p->last_picture_structure != s->picture_structure) { if (p->last_picture_structure == AV_PICTURE_STRUCTURE_TOP_FIELD) s->field_order = AV_FIELD_TT; else s->field_order = AV_FIELD_BB; } else { s->field_order = AV_FIELD_UNKNOWN; } p->last_picture_structure = s->picture_structure; p->last_frame_num = p->poc.frame_num; } av_freep(&nal.rbsp_buffer); return 0; /* no need to evaluate the rest */ } } if (q264) { av_freep(&nal.rbsp_buffer); return 0; } /* didn't find a picture! */ av_log(avctx, AV_LOG_ERROR, "missing picture in access unit with size %d\n", buf_size); fail: av_freep(&nal.rbsp_buffer); return -1; }
false
FFmpeg
6a37abc59af4d87d4c55f7d812ac62d4d6a7464b
static inline int parse_nal_units(AVCodecParserContext *s, AVCodecContext *avctx, const uint8_t * const buf, int buf_size) { H264ParseContext *p = s->priv_data; H2645NAL nal = { NULL }; int buf_index, next_avc; unsigned int pps_id; unsigned int slice_type; int state = -1, got_reset = 0; int q264 = buf_size >=4 && !memcmp("Q264", buf, 4); int field_poc[2]; int ret; s->pict_type = AV_PICTURE_TYPE_I; s->key_frame = 0; s->picture_structure = AV_PICTURE_STRUCTURE_UNKNOWN; ff_h264_sei_uninit(&p->sei); p->sei.frame_packing.frame_packing_arrangement_cancel_flag = -1; if (!buf_size) return 0; buf_index = 0; next_avc = p->is_avc ? 0 : buf_size; for (;;) { const SPS *sps; int src_length, consumed, nalsize = 0; if (buf_index >= next_avc) { nalsize = get_nalsize(p->nal_length_size, buf, buf_size, &buf_index, avctx); if (nalsize < 0) break; next_avc = buf_index + nalsize; } else { buf_index = find_start_code(buf, buf_size, buf_index, next_avc); if (buf_index >= buf_size) break; if (buf_index >= next_avc) continue; } src_length = next_avc - buf_index; state = buf[buf_index]; switch (state & 0x1f) { case H264_NAL_SLICE: case H264_NAL_IDR_SLICE: if ((state & 0x1f) == H264_NAL_IDR_SLICE || ((state >> 5) & 0x3) == 0) { if (src_length > 60) src_length = 60; } else { if (src_length > 1000) src_length = 1000; } break; } consumed = ff_h2645_extract_rbsp(buf + buf_index, src_length, &nal, 1); if (consumed < 0) break; buf_index += consumed; ret = init_get_bits8(&nal.gb, nal.data, nal.size); if (ret < 0) goto fail; get_bits1(&nal.gb); nal.ref_idc = get_bits(&nal.gb, 2); nal.type = get_bits(&nal.gb, 5); switch (nal.type) { case H264_NAL_SPS: ff_h264_decode_seq_parameter_set(&nal.gb, avctx, &p->ps, 0); break; case H264_NAL_PPS: ff_h264_decode_picture_parameter_set(&nal.gb, avctx, &p->ps, nal.size_bits); break; case H264_NAL_SEI: ff_h264_sei_decode(&p->sei, &nal.gb, &p->ps, avctx); break; case H264_NAL_IDR_SLICE: s->key_frame = 1; p->poc.prev_frame_num = 0; p->poc.prev_frame_num_offset = 0; p->poc.prev_poc_msb = p->poc.prev_poc_lsb = 0; case H264_NAL_SLICE: get_ue_golomb_long(&nal.gb); slice_type = get_ue_golomb_31(&nal.gb); s->pict_type = ff_h264_golomb_to_pict_type[slice_type % 5]; if (p->sei.recovery_point.recovery_frame_cnt >= 0) { s->key_frame = 1; } pps_id = get_ue_golomb(&nal.gb); if (pps_id >= MAX_PPS_COUNT) { av_log(avctx, AV_LOG_ERROR, "pps_id %u out of range\n", pps_id); goto fail; } if (!p->ps.pps_list[pps_id]) { av_log(avctx, AV_LOG_ERROR, "non-existing PPS %u referenced\n", pps_id); goto fail; } av_buffer_unref(&p->ps.pps_ref); av_buffer_unref(&p->ps.sps_ref); p->ps.pps = NULL; p->ps.sps = NULL; p->ps.pps_ref = av_buffer_ref(p->ps.pps_list[pps_id]); if (!p->ps.pps_ref) goto fail; p->ps.pps = (const PPS*)p->ps.pps_ref->data; if (!p->ps.sps_list[p->ps.pps->sps_id]) { av_log(avctx, AV_LOG_ERROR, "non-existing SPS %u referenced\n", p->ps.pps->sps_id); goto fail; } p->ps.sps_ref = av_buffer_ref(p->ps.sps_list[p->ps.pps->sps_id]); if (!p->ps.sps_ref) goto fail; p->ps.sps = (const SPS*)p->ps.sps_ref->data; sps = p->ps.sps; if (p->ps.sps->ref_frame_count <= 1 && p->ps.pps->ref_count[0] <= 1 && s->pict_type == AV_PICTURE_TYPE_I) s->key_frame = 1; p->poc.frame_num = get_bits(&nal.gb, sps->log2_max_frame_num); s->coded_width = 16 * sps->mb_width; s->coded_height = 16 * sps->mb_height; s->width = s->coded_width - (sps->crop_right + sps->crop_left); s->height = s->coded_height - (sps->crop_top + sps->crop_bottom); if (s->width <= 0 || s->height <= 0) { s->width = s->coded_width; s->height = s->coded_height; } switch (sps->bit_depth_luma) { case 9: if (sps->chroma_format_idc == 3) s->format = AV_PIX_FMT_YUV444P9; else if (sps->chroma_format_idc == 2) s->format = AV_PIX_FMT_YUV422P9; else s->format = AV_PIX_FMT_YUV420P9; break; case 10: if (sps->chroma_format_idc == 3) s->format = AV_PIX_FMT_YUV444P10; else if (sps->chroma_format_idc == 2) s->format = AV_PIX_FMT_YUV422P10; else s->format = AV_PIX_FMT_YUV420P10; break; case 8: if (sps->chroma_format_idc == 3) s->format = AV_PIX_FMT_YUV444P; else if (sps->chroma_format_idc == 2) s->format = AV_PIX_FMT_YUV422P; else s->format = AV_PIX_FMT_YUV420P; break; default: s->format = AV_PIX_FMT_NONE; } avctx->profile = ff_h264_get_profile(sps); avctx->level = sps->level_idc; if (sps->frame_mbs_only_flag) { p->picture_structure = PICT_FRAME; } else { if (get_bits1(&nal.gb)) { p->picture_structure = PICT_TOP_FIELD + get_bits1(&nal.gb); } else { p->picture_structure = PICT_FRAME; } } if (nal.type == H264_NAL_IDR_SLICE) get_ue_golomb_long(&nal.gb); if (sps->poc_type == 0) { p->poc.poc_lsb = get_bits(&nal.gb, sps->log2_max_poc_lsb); if (p->ps.pps->pic_order_present == 1 && p->picture_structure == PICT_FRAME) p->poc.delta_poc_bottom = get_se_golomb(&nal.gb); } if (sps->poc_type == 1 && !sps->delta_pic_order_always_zero_flag) { p->poc.delta_poc[0] = get_se_golomb(&nal.gb); if (p->ps.pps->pic_order_present == 1 && p->picture_structure == PICT_FRAME) p->poc.delta_poc[1] = get_se_golomb(&nal.gb); } field_poc[0] = field_poc[1] = INT_MAX; ff_h264_init_poc(field_poc, &s->output_picture_number, sps, &p->poc, p->picture_structure, nal.ref_idc); if (nal.ref_idc && nal.type != H264_NAL_IDR_SLICE) { got_reset = scan_mmco_reset(s, &nal.gb, avctx); if (got_reset < 0) goto fail; } p->poc.prev_frame_num = got_reset ? 0 : p->poc.frame_num; p->poc.prev_frame_num_offset = got_reset ? 0 : p->poc.frame_num_offset; if (nal.ref_idc != 0) { if (!got_reset) { p->poc.prev_poc_msb = p->poc.poc_msb; p->poc.prev_poc_lsb = p->poc.poc_lsb; } else { p->poc.prev_poc_msb = 0; p->poc.prev_poc_lsb = p->picture_structure == PICT_BOTTOM_FIELD ? 0 : field_poc[0]; } } if (sps->pic_struct_present_flag) { switch (p->sei.picture_timing.pic_struct) { case SEI_PIC_STRUCT_TOP_FIELD: case SEI_PIC_STRUCT_BOTTOM_FIELD: s->repeat_pict = 0; break; case SEI_PIC_STRUCT_FRAME: case SEI_PIC_STRUCT_TOP_BOTTOM: case SEI_PIC_STRUCT_BOTTOM_TOP: s->repeat_pict = 1; break; case SEI_PIC_STRUCT_TOP_BOTTOM_TOP: case SEI_PIC_STRUCT_BOTTOM_TOP_BOTTOM: s->repeat_pict = 2; break; case SEI_PIC_STRUCT_FRAME_DOUBLING: s->repeat_pict = 3; break; case SEI_PIC_STRUCT_FRAME_TRIPLING: s->repeat_pict = 5; break; default: s->repeat_pict = p->picture_structure == PICT_FRAME ? 1 : 0; break; } } else { s->repeat_pict = p->picture_structure == PICT_FRAME ? 1 : 0; } if (p->picture_structure == PICT_FRAME) { s->picture_structure = AV_PICTURE_STRUCTURE_FRAME; if (sps->pic_struct_present_flag) { switch (p->sei.picture_timing.pic_struct) { case SEI_PIC_STRUCT_TOP_BOTTOM: case SEI_PIC_STRUCT_TOP_BOTTOM_TOP: s->field_order = AV_FIELD_TT; break; case SEI_PIC_STRUCT_BOTTOM_TOP: case SEI_PIC_STRUCT_BOTTOM_TOP_BOTTOM: s->field_order = AV_FIELD_BB; break; default: s->field_order = AV_FIELD_PROGRESSIVE; break; } } else { if (field_poc[0] < field_poc[1]) s->field_order = AV_FIELD_TT; else if (field_poc[0] > field_poc[1]) s->field_order = AV_FIELD_BB; else s->field_order = AV_FIELD_PROGRESSIVE; } } else { if (p->picture_structure == PICT_TOP_FIELD) s->picture_structure = AV_PICTURE_STRUCTURE_TOP_FIELD; else s->picture_structure = AV_PICTURE_STRUCTURE_BOTTOM_FIELD; if (p->poc.frame_num == p->last_frame_num && p->last_picture_structure != AV_PICTURE_STRUCTURE_UNKNOWN && p->last_picture_structure != AV_PICTURE_STRUCTURE_FRAME && p->last_picture_structure != s->picture_structure) { if (p->last_picture_structure == AV_PICTURE_STRUCTURE_TOP_FIELD) s->field_order = AV_FIELD_TT; else s->field_order = AV_FIELD_BB; } else { s->field_order = AV_FIELD_UNKNOWN; } p->last_picture_structure = s->picture_structure; p->last_frame_num = p->poc.frame_num; } av_freep(&nal.rbsp_buffer); return 0; } } if (q264) { av_freep(&nal.rbsp_buffer); return 0; } av_log(avctx, AV_LOG_ERROR, "missing picture in access unit with size %d\n", buf_size); fail: av_freep(&nal.rbsp_buffer); return -1; }
{ "code": [], "line_no": [] }
static inline int FUNC_0(AVCodecParserContext *VAR_0, AVCodecContext *VAR_1, const uint8_t * const VAR_2, int VAR_3) { H264ParseContext *p = VAR_0->priv_data; H2645NAL nal = { NULL }; int VAR_4, VAR_5; unsigned int VAR_6; unsigned int VAR_7; int VAR_8 = -1, VAR_9 = 0; int VAR_10 = VAR_3 >=4 && !memcmp("Q264", VAR_2, 4); int VAR_11[2]; int VAR_12; VAR_0->pict_type = AV_PICTURE_TYPE_I; VAR_0->key_frame = 0; VAR_0->picture_structure = AV_PICTURE_STRUCTURE_UNKNOWN; ff_h264_sei_uninit(&p->sei); p->sei.frame_packing.frame_packing_arrangement_cancel_flag = -1; if (!VAR_3) return 0; VAR_4 = 0; VAR_5 = p->is_avc ? 0 : VAR_3; for (;;) { const SPS *VAR_13; int VAR_14, VAR_15, VAR_16 = 0; if (VAR_4 >= VAR_5) { VAR_16 = get_nalsize(p->nal_length_size, VAR_2, VAR_3, &VAR_4, VAR_1); if (VAR_16 < 0) break; VAR_5 = VAR_4 + VAR_16; } else { VAR_4 = find_start_code(VAR_2, VAR_3, VAR_4, VAR_5); if (VAR_4 >= VAR_3) break; if (VAR_4 >= VAR_5) continue; } VAR_14 = VAR_5 - VAR_4; VAR_8 = VAR_2[VAR_4]; switch (VAR_8 & 0x1f) { case H264_NAL_SLICE: case H264_NAL_IDR_SLICE: if ((VAR_8 & 0x1f) == H264_NAL_IDR_SLICE || ((VAR_8 >> 5) & 0x3) == 0) { if (VAR_14 > 60) VAR_14 = 60; } else { if (VAR_14 > 1000) VAR_14 = 1000; } break; } VAR_15 = ff_h2645_extract_rbsp(VAR_2 + VAR_4, VAR_14, &nal, 1); if (VAR_15 < 0) break; VAR_4 += VAR_15; VAR_12 = init_get_bits8(&nal.gb, nal.data, nal.size); if (VAR_12 < 0) goto fail; get_bits1(&nal.gb); nal.ref_idc = get_bits(&nal.gb, 2); nal.type = get_bits(&nal.gb, 5); switch (nal.type) { case H264_NAL_SPS: ff_h264_decode_seq_parameter_set(&nal.gb, VAR_1, &p->ps, 0); break; case H264_NAL_PPS: ff_h264_decode_picture_parameter_set(&nal.gb, VAR_1, &p->ps, nal.size_bits); break; case H264_NAL_SEI: ff_h264_sei_decode(&p->sei, &nal.gb, &p->ps, VAR_1); break; case H264_NAL_IDR_SLICE: VAR_0->key_frame = 1; p->poc.prev_frame_num = 0; p->poc.prev_frame_num_offset = 0; p->poc.prev_poc_msb = p->poc.prev_poc_lsb = 0; case H264_NAL_SLICE: get_ue_golomb_long(&nal.gb); VAR_7 = get_ue_golomb_31(&nal.gb); VAR_0->pict_type = ff_h264_golomb_to_pict_type[VAR_7 % 5]; if (p->sei.recovery_point.recovery_frame_cnt >= 0) { VAR_0->key_frame = 1; } VAR_6 = get_ue_golomb(&nal.gb); if (VAR_6 >= MAX_PPS_COUNT) { av_log(VAR_1, AV_LOG_ERROR, "VAR_6 %u out of range\n", VAR_6); goto fail; } if (!p->ps.pps_list[VAR_6]) { av_log(VAR_1, AV_LOG_ERROR, "non-existing PPS %u referenced\n", VAR_6); goto fail; } av_buffer_unref(&p->ps.pps_ref); av_buffer_unref(&p->ps.sps_ref); p->ps.pps = NULL; p->ps.VAR_13 = NULL; p->ps.pps_ref = av_buffer_ref(p->ps.pps_list[VAR_6]); if (!p->ps.pps_ref) goto fail; p->ps.pps = (const PPS*)p->ps.pps_ref->data; if (!p->ps.sps_list[p->ps.pps->sps_id]) { av_log(VAR_1, AV_LOG_ERROR, "non-existing SPS %u referenced\n", p->ps.pps->sps_id); goto fail; } p->ps.sps_ref = av_buffer_ref(p->ps.sps_list[p->ps.pps->sps_id]); if (!p->ps.sps_ref) goto fail; p->ps.VAR_13 = (const SPS*)p->ps.sps_ref->data; VAR_13 = p->ps.VAR_13; if (p->ps.VAR_13->ref_frame_count <= 1 && p->ps.pps->ref_count[0] <= 1 && VAR_0->pict_type == AV_PICTURE_TYPE_I) VAR_0->key_frame = 1; p->poc.frame_num = get_bits(&nal.gb, VAR_13->log2_max_frame_num); VAR_0->coded_width = 16 * VAR_13->mb_width; VAR_0->coded_height = 16 * VAR_13->mb_height; VAR_0->width = VAR_0->coded_width - (VAR_13->crop_right + VAR_13->crop_left); VAR_0->height = VAR_0->coded_height - (VAR_13->crop_top + VAR_13->crop_bottom); if (VAR_0->width <= 0 || VAR_0->height <= 0) { VAR_0->width = VAR_0->coded_width; VAR_0->height = VAR_0->coded_height; } switch (VAR_13->bit_depth_luma) { case 9: if (VAR_13->chroma_format_idc == 3) VAR_0->format = AV_PIX_FMT_YUV444P9; else if (VAR_13->chroma_format_idc == 2) VAR_0->format = AV_PIX_FMT_YUV422P9; else VAR_0->format = AV_PIX_FMT_YUV420P9; break; case 10: if (VAR_13->chroma_format_idc == 3) VAR_0->format = AV_PIX_FMT_YUV444P10; else if (VAR_13->chroma_format_idc == 2) VAR_0->format = AV_PIX_FMT_YUV422P10; else VAR_0->format = AV_PIX_FMT_YUV420P10; break; case 8: if (VAR_13->chroma_format_idc == 3) VAR_0->format = AV_PIX_FMT_YUV444P; else if (VAR_13->chroma_format_idc == 2) VAR_0->format = AV_PIX_FMT_YUV422P; else VAR_0->format = AV_PIX_FMT_YUV420P; break; default: VAR_0->format = AV_PIX_FMT_NONE; } VAR_1->profile = ff_h264_get_profile(VAR_13); VAR_1->level = VAR_13->level_idc; if (VAR_13->frame_mbs_only_flag) { p->picture_structure = PICT_FRAME; } else { if (get_bits1(&nal.gb)) { p->picture_structure = PICT_TOP_FIELD + get_bits1(&nal.gb); } else { p->picture_structure = PICT_FRAME; } } if (nal.type == H264_NAL_IDR_SLICE) get_ue_golomb_long(&nal.gb); if (VAR_13->poc_type == 0) { p->poc.poc_lsb = get_bits(&nal.gb, VAR_13->log2_max_poc_lsb); if (p->ps.pps->pic_order_present == 1 && p->picture_structure == PICT_FRAME) p->poc.delta_poc_bottom = get_se_golomb(&nal.gb); } if (VAR_13->poc_type == 1 && !VAR_13->delta_pic_order_always_zero_flag) { p->poc.delta_poc[0] = get_se_golomb(&nal.gb); if (p->ps.pps->pic_order_present == 1 && p->picture_structure == PICT_FRAME) p->poc.delta_poc[1] = get_se_golomb(&nal.gb); } VAR_11[0] = VAR_11[1] = INT_MAX; ff_h264_init_poc(VAR_11, &VAR_0->output_picture_number, VAR_13, &p->poc, p->picture_structure, nal.ref_idc); if (nal.ref_idc && nal.type != H264_NAL_IDR_SLICE) { VAR_9 = scan_mmco_reset(VAR_0, &nal.gb, VAR_1); if (VAR_9 < 0) goto fail; } p->poc.prev_frame_num = VAR_9 ? 0 : p->poc.frame_num; p->poc.prev_frame_num_offset = VAR_9 ? 0 : p->poc.frame_num_offset; if (nal.ref_idc != 0) { if (!VAR_9) { p->poc.prev_poc_msb = p->poc.poc_msb; p->poc.prev_poc_lsb = p->poc.poc_lsb; } else { p->poc.prev_poc_msb = 0; p->poc.prev_poc_lsb = p->picture_structure == PICT_BOTTOM_FIELD ? 0 : VAR_11[0]; } } if (VAR_13->pic_struct_present_flag) { switch (p->sei.picture_timing.pic_struct) { case SEI_PIC_STRUCT_TOP_FIELD: case SEI_PIC_STRUCT_BOTTOM_FIELD: VAR_0->repeat_pict = 0; break; case SEI_PIC_STRUCT_FRAME: case SEI_PIC_STRUCT_TOP_BOTTOM: case SEI_PIC_STRUCT_BOTTOM_TOP: VAR_0->repeat_pict = 1; break; case SEI_PIC_STRUCT_TOP_BOTTOM_TOP: case SEI_PIC_STRUCT_BOTTOM_TOP_BOTTOM: VAR_0->repeat_pict = 2; break; case SEI_PIC_STRUCT_FRAME_DOUBLING: VAR_0->repeat_pict = 3; break; case SEI_PIC_STRUCT_FRAME_TRIPLING: VAR_0->repeat_pict = 5; break; default: VAR_0->repeat_pict = p->picture_structure == PICT_FRAME ? 1 : 0; break; } } else { VAR_0->repeat_pict = p->picture_structure == PICT_FRAME ? 1 : 0; } if (p->picture_structure == PICT_FRAME) { VAR_0->picture_structure = AV_PICTURE_STRUCTURE_FRAME; if (VAR_13->pic_struct_present_flag) { switch (p->sei.picture_timing.pic_struct) { case SEI_PIC_STRUCT_TOP_BOTTOM: case SEI_PIC_STRUCT_TOP_BOTTOM_TOP: VAR_0->field_order = AV_FIELD_TT; break; case SEI_PIC_STRUCT_BOTTOM_TOP: case SEI_PIC_STRUCT_BOTTOM_TOP_BOTTOM: VAR_0->field_order = AV_FIELD_BB; break; default: VAR_0->field_order = AV_FIELD_PROGRESSIVE; break; } } else { if (VAR_11[0] < VAR_11[1]) VAR_0->field_order = AV_FIELD_TT; else if (VAR_11[0] > VAR_11[1]) VAR_0->field_order = AV_FIELD_BB; else VAR_0->field_order = AV_FIELD_PROGRESSIVE; } } else { if (p->picture_structure == PICT_TOP_FIELD) VAR_0->picture_structure = AV_PICTURE_STRUCTURE_TOP_FIELD; else VAR_0->picture_structure = AV_PICTURE_STRUCTURE_BOTTOM_FIELD; if (p->poc.frame_num == p->last_frame_num && p->last_picture_structure != AV_PICTURE_STRUCTURE_UNKNOWN && p->last_picture_structure != AV_PICTURE_STRUCTURE_FRAME && p->last_picture_structure != VAR_0->picture_structure) { if (p->last_picture_structure == AV_PICTURE_STRUCTURE_TOP_FIELD) VAR_0->field_order = AV_FIELD_TT; else VAR_0->field_order = AV_FIELD_BB; } else { VAR_0->field_order = AV_FIELD_UNKNOWN; } p->last_picture_structure = VAR_0->picture_structure; p->last_frame_num = p->poc.frame_num; } av_freep(&nal.rbsp_buffer); return 0; } } if (VAR_10) { av_freep(&nal.rbsp_buffer); return 0; } av_log(VAR_1, AV_LOG_ERROR, "missing picture in access unit with size %d\n", VAR_3); fail: av_freep(&nal.rbsp_buffer); return -1; }
[ "static inline int FUNC_0(AVCodecParserContext *VAR_0,\nAVCodecContext *VAR_1,\nconst uint8_t * const VAR_2, int VAR_3)\n{", "H264ParseContext *p = VAR_0->priv_data;", "H2645NAL nal = { NULL };", "int VAR_4, VAR_5;", "unsigned int VAR_6;", "unsigned int VAR_7;", "int VAR_8 = -1, VAR_9 = 0;", "int VAR_10 = VAR_3 >=4 && !memcmp(\"Q264\", VAR_2, 4);", "int VAR_11[2];", "int VAR_12;", "VAR_0->pict_type = AV_PICTURE_TYPE_I;", "VAR_0->key_frame = 0;", "VAR_0->picture_structure = AV_PICTURE_STRUCTURE_UNKNOWN;", "ff_h264_sei_uninit(&p->sei);", "p->sei.frame_packing.frame_packing_arrangement_cancel_flag = -1;", "if (!VAR_3)\nreturn 0;", "VAR_4 = 0;", "VAR_5 = p->is_avc ? 0 : VAR_3;", "for (;;) {", "const SPS *VAR_13;", "int VAR_14, VAR_15, VAR_16 = 0;", "if (VAR_4 >= VAR_5) {", "VAR_16 = get_nalsize(p->nal_length_size, VAR_2, VAR_3, &VAR_4, VAR_1);", "if (VAR_16 < 0)\nbreak;", "VAR_5 = VAR_4 + VAR_16;", "} else {", "VAR_4 = find_start_code(VAR_2, VAR_3, VAR_4, VAR_5);", "if (VAR_4 >= VAR_3)\nbreak;", "if (VAR_4 >= VAR_5)\ncontinue;", "}", "VAR_14 = VAR_5 - VAR_4;", "VAR_8 = VAR_2[VAR_4];", "switch (VAR_8 & 0x1f) {", "case H264_NAL_SLICE:\ncase H264_NAL_IDR_SLICE:\nif ((VAR_8 & 0x1f) == H264_NAL_IDR_SLICE || ((VAR_8 >> 5) & 0x3) == 0) {", "if (VAR_14 > 60)\nVAR_14 = 60;", "} else {", "if (VAR_14 > 1000)\nVAR_14 = 1000;", "}", "break;", "}", "VAR_15 = ff_h2645_extract_rbsp(VAR_2 + VAR_4, VAR_14, &nal, 1);", "if (VAR_15 < 0)\nbreak;", "VAR_4 += VAR_15;", "VAR_12 = init_get_bits8(&nal.gb, nal.data, nal.size);", "if (VAR_12 < 0)\ngoto fail;", "get_bits1(&nal.gb);", "nal.ref_idc = get_bits(&nal.gb, 2);", "nal.type = get_bits(&nal.gb, 5);", "switch (nal.type) {", "case H264_NAL_SPS:\nff_h264_decode_seq_parameter_set(&nal.gb, VAR_1, &p->ps, 0);", "break;", "case H264_NAL_PPS:\nff_h264_decode_picture_parameter_set(&nal.gb, VAR_1, &p->ps,\nnal.size_bits);", "break;", "case H264_NAL_SEI:\nff_h264_sei_decode(&p->sei, &nal.gb, &p->ps, VAR_1);", "break;", "case H264_NAL_IDR_SLICE:\nVAR_0->key_frame = 1;", "p->poc.prev_frame_num = 0;", "p->poc.prev_frame_num_offset = 0;", "p->poc.prev_poc_msb =\np->poc.prev_poc_lsb = 0;", "case H264_NAL_SLICE:\nget_ue_golomb_long(&nal.gb);", "VAR_7 = get_ue_golomb_31(&nal.gb);", "VAR_0->pict_type = ff_h264_golomb_to_pict_type[VAR_7 % 5];", "if (p->sei.recovery_point.recovery_frame_cnt >= 0) {", "VAR_0->key_frame = 1;", "}", "VAR_6 = get_ue_golomb(&nal.gb);", "if (VAR_6 >= MAX_PPS_COUNT) {", "av_log(VAR_1, AV_LOG_ERROR,\n\"VAR_6 %u out of range\\n\", VAR_6);", "goto fail;", "}", "if (!p->ps.pps_list[VAR_6]) {", "av_log(VAR_1, AV_LOG_ERROR,\n\"non-existing PPS %u referenced\\n\", VAR_6);", "goto fail;", "}", "av_buffer_unref(&p->ps.pps_ref);", "av_buffer_unref(&p->ps.sps_ref);", "p->ps.pps = NULL;", "p->ps.VAR_13 = NULL;", "p->ps.pps_ref = av_buffer_ref(p->ps.pps_list[VAR_6]);", "if (!p->ps.pps_ref)\ngoto fail;", "p->ps.pps = (const PPS*)p->ps.pps_ref->data;", "if (!p->ps.sps_list[p->ps.pps->sps_id]) {", "av_log(VAR_1, AV_LOG_ERROR,\n\"non-existing SPS %u referenced\\n\", p->ps.pps->sps_id);", "goto fail;", "}", "p->ps.sps_ref = av_buffer_ref(p->ps.sps_list[p->ps.pps->sps_id]);", "if (!p->ps.sps_ref)\ngoto fail;", "p->ps.VAR_13 = (const SPS*)p->ps.sps_ref->data;", "VAR_13 = p->ps.VAR_13;", "if (p->ps.VAR_13->ref_frame_count <= 1 && p->ps.pps->ref_count[0] <= 1 && VAR_0->pict_type == AV_PICTURE_TYPE_I)\nVAR_0->key_frame = 1;", "p->poc.frame_num = get_bits(&nal.gb, VAR_13->log2_max_frame_num);", "VAR_0->coded_width = 16 * VAR_13->mb_width;", "VAR_0->coded_height = 16 * VAR_13->mb_height;", "VAR_0->width = VAR_0->coded_width - (VAR_13->crop_right + VAR_13->crop_left);", "VAR_0->height = VAR_0->coded_height - (VAR_13->crop_top + VAR_13->crop_bottom);", "if (VAR_0->width <= 0 || VAR_0->height <= 0) {", "VAR_0->width = VAR_0->coded_width;", "VAR_0->height = VAR_0->coded_height;", "}", "switch (VAR_13->bit_depth_luma) {", "case 9:\nif (VAR_13->chroma_format_idc == 3) VAR_0->format = AV_PIX_FMT_YUV444P9;", "else if (VAR_13->chroma_format_idc == 2) VAR_0->format = AV_PIX_FMT_YUV422P9;", "else VAR_0->format = AV_PIX_FMT_YUV420P9;", "break;", "case 10:\nif (VAR_13->chroma_format_idc == 3) VAR_0->format = AV_PIX_FMT_YUV444P10;", "else if (VAR_13->chroma_format_idc == 2) VAR_0->format = AV_PIX_FMT_YUV422P10;", "else VAR_0->format = AV_PIX_FMT_YUV420P10;", "break;", "case 8:\nif (VAR_13->chroma_format_idc == 3) VAR_0->format = AV_PIX_FMT_YUV444P;", "else if (VAR_13->chroma_format_idc == 2) VAR_0->format = AV_PIX_FMT_YUV422P;", "else VAR_0->format = AV_PIX_FMT_YUV420P;", "break;", "default:\nVAR_0->format = AV_PIX_FMT_NONE;", "}", "VAR_1->profile = ff_h264_get_profile(VAR_13);", "VAR_1->level = VAR_13->level_idc;", "if (VAR_13->frame_mbs_only_flag) {", "p->picture_structure = PICT_FRAME;", "} else {", "if (get_bits1(&nal.gb)) {", "p->picture_structure = PICT_TOP_FIELD + get_bits1(&nal.gb);", "} else {", "p->picture_structure = PICT_FRAME;", "}", "}", "if (nal.type == H264_NAL_IDR_SLICE)\nget_ue_golomb_long(&nal.gb);", "if (VAR_13->poc_type == 0) {", "p->poc.poc_lsb = get_bits(&nal.gb, VAR_13->log2_max_poc_lsb);", "if (p->ps.pps->pic_order_present == 1 &&\np->picture_structure == PICT_FRAME)\np->poc.delta_poc_bottom = get_se_golomb(&nal.gb);", "}", "if (VAR_13->poc_type == 1 &&\n!VAR_13->delta_pic_order_always_zero_flag) {", "p->poc.delta_poc[0] = get_se_golomb(&nal.gb);", "if (p->ps.pps->pic_order_present == 1 &&\np->picture_structure == PICT_FRAME)\np->poc.delta_poc[1] = get_se_golomb(&nal.gb);", "}", "VAR_11[0] = VAR_11[1] = INT_MAX;", "ff_h264_init_poc(VAR_11, &VAR_0->output_picture_number, VAR_13,\n&p->poc, p->picture_structure, nal.ref_idc);", "if (nal.ref_idc && nal.type != H264_NAL_IDR_SLICE) {", "VAR_9 = scan_mmco_reset(VAR_0, &nal.gb, VAR_1);", "if (VAR_9 < 0)\ngoto fail;", "}", "p->poc.prev_frame_num = VAR_9 ? 0 : p->poc.frame_num;", "p->poc.prev_frame_num_offset = VAR_9 ? 0 : p->poc.frame_num_offset;", "if (nal.ref_idc != 0) {", "if (!VAR_9) {", "p->poc.prev_poc_msb = p->poc.poc_msb;", "p->poc.prev_poc_lsb = p->poc.poc_lsb;", "} else {", "p->poc.prev_poc_msb = 0;", "p->poc.prev_poc_lsb =\np->picture_structure == PICT_BOTTOM_FIELD ? 0 : VAR_11[0];", "}", "}", "if (VAR_13->pic_struct_present_flag) {", "switch (p->sei.picture_timing.pic_struct) {", "case SEI_PIC_STRUCT_TOP_FIELD:\ncase SEI_PIC_STRUCT_BOTTOM_FIELD:\nVAR_0->repeat_pict = 0;", "break;", "case SEI_PIC_STRUCT_FRAME:\ncase SEI_PIC_STRUCT_TOP_BOTTOM:\ncase SEI_PIC_STRUCT_BOTTOM_TOP:\nVAR_0->repeat_pict = 1;", "break;", "case SEI_PIC_STRUCT_TOP_BOTTOM_TOP:\ncase SEI_PIC_STRUCT_BOTTOM_TOP_BOTTOM:\nVAR_0->repeat_pict = 2;", "break;", "case SEI_PIC_STRUCT_FRAME_DOUBLING:\nVAR_0->repeat_pict = 3;", "break;", "case SEI_PIC_STRUCT_FRAME_TRIPLING:\nVAR_0->repeat_pict = 5;", "break;", "default:\nVAR_0->repeat_pict = p->picture_structure == PICT_FRAME ? 1 : 0;", "break;", "}", "} else {", "VAR_0->repeat_pict = p->picture_structure == PICT_FRAME ? 1 : 0;", "}", "if (p->picture_structure == PICT_FRAME) {", "VAR_0->picture_structure = AV_PICTURE_STRUCTURE_FRAME;", "if (VAR_13->pic_struct_present_flag) {", "switch (p->sei.picture_timing.pic_struct) {", "case SEI_PIC_STRUCT_TOP_BOTTOM:\ncase SEI_PIC_STRUCT_TOP_BOTTOM_TOP:\nVAR_0->field_order = AV_FIELD_TT;", "break;", "case SEI_PIC_STRUCT_BOTTOM_TOP:\ncase SEI_PIC_STRUCT_BOTTOM_TOP_BOTTOM:\nVAR_0->field_order = AV_FIELD_BB;", "break;", "default:\nVAR_0->field_order = AV_FIELD_PROGRESSIVE;", "break;", "}", "} else {", "if (VAR_11[0] < VAR_11[1])\nVAR_0->field_order = AV_FIELD_TT;", "else if (VAR_11[0] > VAR_11[1])\nVAR_0->field_order = AV_FIELD_BB;", "else\nVAR_0->field_order = AV_FIELD_PROGRESSIVE;", "}", "} else {", "if (p->picture_structure == PICT_TOP_FIELD)\nVAR_0->picture_structure = AV_PICTURE_STRUCTURE_TOP_FIELD;", "else\nVAR_0->picture_structure = AV_PICTURE_STRUCTURE_BOTTOM_FIELD;", "if (p->poc.frame_num == p->last_frame_num &&\np->last_picture_structure != AV_PICTURE_STRUCTURE_UNKNOWN &&\np->last_picture_structure != AV_PICTURE_STRUCTURE_FRAME &&\np->last_picture_structure != VAR_0->picture_structure) {", "if (p->last_picture_structure == AV_PICTURE_STRUCTURE_TOP_FIELD)\nVAR_0->field_order = AV_FIELD_TT;", "else\nVAR_0->field_order = AV_FIELD_BB;", "} else {", "VAR_0->field_order = AV_FIELD_UNKNOWN;", "}", "p->last_picture_structure = VAR_0->picture_structure;", "p->last_frame_num = p->poc.frame_num;", "}", "av_freep(&nal.rbsp_buffer);", "return 0;", "}", "}", "if (VAR_10) {", "av_freep(&nal.rbsp_buffer);", "return 0;", "}", "av_log(VAR_1, AV_LOG_ERROR, \"missing picture in access unit with size %d\\n\", VAR_3);", "fail:\nav_freep(&nal.rbsp_buffer);", "return -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 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 45, 47 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ], [ 67, 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77, 79 ], [ 81, 83 ], [ 85 ], [ 87 ], [ 91 ], [ 93 ], [ 95, 97, 101 ], [ 107, 109 ], [ 111 ], [ 115, 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127, 129 ], [ 133 ], [ 137 ], [ 139, 141 ], [ 143 ], [ 145 ], [ 147 ], [ 151 ], [ 153, 155 ], [ 157 ], [ 159, 161, 163 ], [ 165 ], [ 167, 169 ], [ 171 ], [ 173, 175 ], [ 179 ], [ 181 ], [ 183, 185 ], [ 189, 191 ], [ 193 ], [ 195 ], [ 197 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 209, 211 ], [ 213 ], [ 215 ], [ 217 ], [ 219, 221 ], [ 223 ], [ 225 ], [ 229 ], [ 231 ], [ 233 ], [ 235 ], [ 237 ], [ 239, 241 ], [ 243 ], [ 247 ], [ 249, 251 ], [ 253 ], [ 255 ], [ 259 ], [ 261, 263 ], [ 265 ], [ 269 ], [ 275, 277 ], [ 281 ], [ 285 ], [ 287 ], [ 289 ], [ 291 ], [ 293 ], [ 295 ], [ 297 ], [ 299 ], [ 303 ], [ 305, 307 ], [ 309 ], [ 311 ], [ 313 ], [ 315, 317 ], [ 319 ], [ 321 ], [ 323 ], [ 325, 327 ], [ 329 ], [ 331 ], [ 333 ], [ 335, 337 ], [ 339 ], [ 343 ], [ 345 ], [ 349 ], [ 351 ], [ 353 ], [ 355 ], [ 357 ], [ 359 ], [ 361 ], [ 363 ], [ 365 ], [ 369, 371 ], [ 373 ], [ 375 ], [ 379, 381, 383 ], [ 385 ], [ 389, 391 ], [ 393 ], [ 397, 399, 401 ], [ 403 ], [ 411 ], [ 413, 415 ], [ 427 ], [ 429 ], [ 431, 433 ], [ 435 ], [ 441 ], [ 443 ], [ 445 ], [ 447 ], [ 449 ], [ 451 ], [ 453 ], [ 455 ], [ 457, 459 ], [ 461 ], [ 463 ], [ 467 ], [ 469 ], [ 471, 473, 475 ], [ 477 ], [ 479, 481, 483, 485 ], [ 487 ], [ 489, 491, 493 ], [ 495 ], [ 497, 499 ], [ 501 ], [ 503, 505 ], [ 507 ], [ 509, 511 ], [ 513 ], [ 515 ], [ 517 ], [ 519 ], [ 521 ], [ 525 ], [ 527 ], [ 529 ], [ 531 ], [ 533, 535, 537 ], [ 539 ], [ 541, 543, 545 ], [ 547 ], [ 549, 551 ], [ 553 ], [ 555 ], [ 557 ], [ 559, 561 ], [ 563, 565 ], [ 567, 569 ], [ 571 ], [ 573 ], [ 575, 577 ], [ 579, 581 ], [ 583, 585, 587, 589 ], [ 591, 593 ], [ 595, 597 ], [ 599 ], [ 601 ], [ 603 ], [ 605 ], [ 607 ], [ 609 ], [ 613 ], [ 615 ], [ 617 ], [ 619 ], [ 621 ], [ 623 ], [ 625 ], [ 627 ], [ 631 ], [ 633, 635 ], [ 637 ], [ 639 ] ]
15,512
static void balloon_stats_change_timer(VirtIOBalloon *s, int secs) { timer_mod(s->stats_timer, qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL) + secs * 1000); }
true
qemu
1f9296b51a26650916a2c4191268bb64057bdc5f
static void balloon_stats_change_timer(VirtIOBalloon *s, int secs) { timer_mod(s->stats_timer, qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL) + secs * 1000); }
{ "code": [ "static void balloon_stats_change_timer(VirtIOBalloon *s, int secs)" ], "line_no": [ 1 ] }
static void FUNC_0(VirtIOBalloon *VAR_0, int VAR_1) { timer_mod(VAR_0->stats_timer, qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL) + VAR_1 * 1000); }
[ "static void FUNC_0(VirtIOBalloon *VAR_0, int VAR_1)\n{", "timer_mod(VAR_0->stats_timer, qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL) + VAR_1 * 1000);", "}" ]
[ 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
15,513
static int tta_decode_init(AVCodecContext * avctx) { TTAContext *s = avctx->priv_data; int i; s->avctx = avctx; // 30bytes includes a seektable with one frame if (avctx->extradata_size < 30) init_get_bits(&s->gb, avctx->extradata, avctx->extradata_size); if (show_bits_long(&s->gb, 32) == bswap_32(ff_get_fourcc("TTA1"))) { /* signature */ skip_bits(&s->gb, 32); // if (get_bits_long(&s->gb, 32) != bswap_32(ff_get_fourcc("TTA1"))) { // av_log(s->avctx, AV_LOG_ERROR, "Missing magic\n"); // return -1; // } s->flags = get_le16(&s->gb); if (s->flags != 1 && s->flags != 3) { av_log(s->avctx, AV_LOG_ERROR, "Invalid flags\n"); s->is_float = (s->flags == FORMAT_FLOAT); avctx->channels = s->channels = get_le16(&s->gb); avctx->bits_per_sample = get_le16(&s->gb); s->bps = (avctx->bits_per_sample + 7) / 8; avctx->sample_rate = get_le32(&s->gb); if(avctx->sample_rate > 1000000){ //prevent FRAME_TIME * avctx->sample_rate from overflowing and sanity check av_log(avctx, AV_LOG_ERROR, "sample_rate too large\n"); s->data_length = get_le32(&s->gb); skip_bits(&s->gb, 32); // CRC32 of header if (s->is_float) { avctx->sample_fmt = SAMPLE_FMT_FLT; av_log(s->avctx, AV_LOG_ERROR, "Unsupported sample format. Please contact the developers.\n"); else switch(s->bps) { // case 1: avctx->sample_fmt = SAMPLE_FMT_U8; break; case 2: avctx->sample_fmt = SAMPLE_FMT_S16; break; // case 3: avctx->sample_fmt = SAMPLE_FMT_S24; break; case 4: avctx->sample_fmt = SAMPLE_FMT_S32; break; default: av_log(s->avctx, AV_LOG_ERROR, "Invalid/unsupported sample format. Please contact the developers.\n"); // FIXME: horribly broken, but directly from reference source #define FRAME_TIME 1.04489795918367346939 s->frame_length = (int)(FRAME_TIME * avctx->sample_rate); s->last_frame_length = s->data_length % s->frame_length; s->total_frames = s->data_length / s->frame_length + (s->last_frame_length ? 1 : 0); av_log(s->avctx, AV_LOG_DEBUG, "flags: %x chans: %d bps: %d rate: %d block: %d\n", s->flags, avctx->channels, avctx->bits_per_sample, avctx->sample_rate, avctx->block_align); av_log(s->avctx, AV_LOG_DEBUG, "data_length: %d frame_length: %d last: %d total: %d\n", s->data_length, s->frame_length, s->last_frame_length, s->total_frames); // FIXME: seek table for (i = 0; i < s->total_frames; i++) skip_bits(&s->gb, 32); skip_bits(&s->gb, 32); // CRC32 of seektable s->decode_buffer = av_mallocz(sizeof(int32_t)*s->frame_length*s->channels); } else { av_log(avctx, AV_LOG_ERROR, "Wrong extradata present\n"); return 0;
true
FFmpeg
3a1a7e32ace7af47de74e8ae779cb4e04c89aa97
static int tta_decode_init(AVCodecContext * avctx) { TTAContext *s = avctx->priv_data; int i; s->avctx = avctx; if (avctx->extradata_size < 30) init_get_bits(&s->gb, avctx->extradata, avctx->extradata_size); if (show_bits_long(&s->gb, 32) == bswap_32(ff_get_fourcc("TTA1"))) { skip_bits(&s->gb, 32); s->flags = get_le16(&s->gb); if (s->flags != 1 && s->flags != 3) { av_log(s->avctx, AV_LOG_ERROR, "Invalid flags\n"); s->is_float = (s->flags == FORMAT_FLOAT); avctx->channels = s->channels = get_le16(&s->gb); avctx->bits_per_sample = get_le16(&s->gb); s->bps = (avctx->bits_per_sample + 7) / 8; avctx->sample_rate = get_le32(&s->gb); if(avctx->sample_rate > 1000000){ av_log(avctx, AV_LOG_ERROR, "sample_rate too large\n"); s->data_length = get_le32(&s->gb); skip_bits(&s->gb, 32); if (s->is_float) { avctx->sample_fmt = SAMPLE_FMT_FLT; av_log(s->avctx, AV_LOG_ERROR, "Unsupported sample format. Please contact the developers.\n"); else switch(s->bps) { case 2: avctx->sample_fmt = SAMPLE_FMT_S16; break; case 4: avctx->sample_fmt = SAMPLE_FMT_S32; break; default: av_log(s->avctx, AV_LOG_ERROR, "Invalid/unsupported sample format. Please contact the developers.\n"); #define FRAME_TIME 1.04489795918367346939 s->frame_length = (int)(FRAME_TIME * avctx->sample_rate); s->last_frame_length = s->data_length % s->frame_length; s->total_frames = s->data_length / s->frame_length + (s->last_frame_length ? 1 : 0); av_log(s->avctx, AV_LOG_DEBUG, "flags: %x chans: %d bps: %d rate: %d block: %d\n", s->flags, avctx->channels, avctx->bits_per_sample, avctx->sample_rate, avctx->block_align); av_log(s->avctx, AV_LOG_DEBUG, "data_length: %d frame_length: %d last: %d total: %d\n", s->data_length, s->frame_length, s->last_frame_length, s->total_frames); for (i = 0; i < s->total_frames; i++) skip_bits(&s->gb, 32); skip_bits(&s->gb, 32); s->decode_buffer = av_mallocz(sizeof(int32_t)*s->frame_length*s->channels); } else { av_log(avctx, AV_LOG_ERROR, "Wrong extradata present\n"); return 0;
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecContext * VAR_0) { TTAContext *s = VAR_0->priv_data; int VAR_1; s->VAR_0 = VAR_0; if (VAR_0->extradata_size < 30) init_get_bits(&s->gb, VAR_0->extradata, VAR_0->extradata_size); if (show_bits_long(&s->gb, 32) == bswap_32(ff_get_fourcc("TTA1"))) { skip_bits(&s->gb, 32); s->flags = get_le16(&s->gb); if (s->flags != 1 && s->flags != 3) { av_log(s->VAR_0, AV_LOG_ERROR, "Invalid flags\n"); s->is_float = (s->flags == FORMAT_FLOAT); VAR_0->channels = s->channels = get_le16(&s->gb); VAR_0->bits_per_sample = get_le16(&s->gb); s->bps = (VAR_0->bits_per_sample + 7) / 8; VAR_0->sample_rate = get_le32(&s->gb); if(VAR_0->sample_rate > 1000000){ av_log(VAR_0, AV_LOG_ERROR, "sample_rate too large\n"); s->data_length = get_le32(&s->gb); skip_bits(&s->gb, 32); if (s->is_float) { VAR_0->sample_fmt = SAMPLE_FMT_FLT; av_log(s->VAR_0, AV_LOG_ERROR, "Unsupported sample format. Please contact the developers.\n"); else switch(s->bps) { case 2: VAR_0->sample_fmt = SAMPLE_FMT_S16; break; case 4: VAR_0->sample_fmt = SAMPLE_FMT_S32; break; default: av_log(s->VAR_0, AV_LOG_ERROR, "Invalid/unsupported sample format. Please contact the developers.\n"); #define FRAME_TIME 1.04489795918367346939 s->frame_length = (int)(FRAME_TIME * VAR_0->sample_rate); s->last_frame_length = s->data_length % s->frame_length; s->total_frames = s->data_length / s->frame_length + (s->last_frame_length ? 1 : 0); av_log(s->VAR_0, AV_LOG_DEBUG, "flags: %x chans: %d bps: %d rate: %d block: %d\n", s->flags, VAR_0->channels, VAR_0->bits_per_sample, VAR_0->sample_rate, VAR_0->block_align); av_log(s->VAR_0, AV_LOG_DEBUG, "data_length: %d frame_length: %d last: %d total: %d\n", s->data_length, s->frame_length, s->last_frame_length, s->total_frames); for (VAR_1 = 0; VAR_1 < s->total_frames; VAR_1++) skip_bits(&s->gb, 32); skip_bits(&s->gb, 32); s->decode_buffer = av_mallocz(sizeof(int32_t)*s->frame_length*s->channels); } else { av_log(VAR_0, AV_LOG_ERROR, "Wrong extradata present\n"); return 0;
[ "static int FUNC_0(AVCodecContext * VAR_0)\n{", "TTAContext *s = VAR_0->priv_data;", "int VAR_1;", "s->VAR_0 = VAR_0;", "if (VAR_0->extradata_size < 30)\ninit_get_bits(&s->gb, VAR_0->extradata, VAR_0->extradata_size);", "if (show_bits_long(&s->gb, 32) == bswap_32(ff_get_fourcc(\"TTA1\")))\n{", "skip_bits(&s->gb, 32);", "s->flags = get_le16(&s->gb);", "if (s->flags != 1 && s->flags != 3)\n{", "av_log(s->VAR_0, AV_LOG_ERROR, \"Invalid flags\\n\");", "s->is_float = (s->flags == FORMAT_FLOAT);", "VAR_0->channels = s->channels = get_le16(&s->gb);", "VAR_0->bits_per_sample = get_le16(&s->gb);", "s->bps = (VAR_0->bits_per_sample + 7) / 8;", "VAR_0->sample_rate = get_le32(&s->gb);", "if(VAR_0->sample_rate > 1000000){", "av_log(VAR_0, AV_LOG_ERROR, \"sample_rate too large\\n\");", "s->data_length = get_le32(&s->gb);", "skip_bits(&s->gb, 32);", "if (s->is_float)\n{", "VAR_0->sample_fmt = SAMPLE_FMT_FLT;", "av_log(s->VAR_0, AV_LOG_ERROR, \"Unsupported sample format. Please contact the developers.\\n\");", "else switch(s->bps) {", "case 2: VAR_0->sample_fmt = SAMPLE_FMT_S16; break;", "case 4: VAR_0->sample_fmt = SAMPLE_FMT_S32; break;", "default:\nav_log(s->VAR_0, AV_LOG_ERROR, \"Invalid/unsupported sample format. Please contact the developers.\\n\");", "#define FRAME_TIME 1.04489795918367346939\ns->frame_length = (int)(FRAME_TIME * VAR_0->sample_rate);", "s->last_frame_length = s->data_length % s->frame_length;", "s->total_frames = s->data_length / s->frame_length +\n(s->last_frame_length ? 1 : 0);", "av_log(s->VAR_0, AV_LOG_DEBUG, \"flags: %x chans: %d bps: %d rate: %d block: %d\\n\",\ns->flags, VAR_0->channels, VAR_0->bits_per_sample, VAR_0->sample_rate,\nVAR_0->block_align);", "av_log(s->VAR_0, AV_LOG_DEBUG, \"data_length: %d frame_length: %d last: %d total: %d\\n\",\ns->data_length, s->frame_length, s->last_frame_length, s->total_frames);", "for (VAR_1 = 0; VAR_1 < s->total_frames; VAR_1++)", "skip_bits(&s->gb, 32);", "skip_bits(&s->gb, 32);", "s->decode_buffer = av_mallocz(sizeof(int32_t)*s->frame_length*s->channels);", "} else {", "av_log(VAR_0, AV_LOG_ERROR, \"Wrong extradata present\\n\");", "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 ]
[ [ 1, 2 ], [ 3 ], [ 4 ], [ 5 ], [ 7, 8 ], [ 9, 10 ], [ 12 ], [ 17 ], [ 18, 19 ], [ 20 ], [ 21 ], [ 22 ], [ 23 ], [ 24 ], [ 25 ], [ 26 ], [ 27 ], [ 28 ], [ 29 ], [ 30, 31 ], [ 32 ], [ 33 ], [ 34 ], [ 36 ], [ 38 ], [ 39, 40 ], [ 42, 43 ], [ 44 ], [ 45, 46 ], [ 47, 48, 49 ], [ 50, 51 ], [ 53 ], [ 54 ], [ 55 ], [ 56 ], [ 57 ], [ 58 ], [ 59 ] ]
15,516
void show_licence(void) { printf( "ffmpeg version " FFMPEG_VERSION "\n" "Copyright (c) 2000, 2001, 2002 Gerard Lantau\n" "This program is free software; you can redistribute it and/or modify\n" "it under the terms of the GNU General Public License as published by\n" "the Free Software Foundation; either version 2 of the License, or\n" "(at your option) any later version.\n" "\n" "This program is distributed in the hope that it will be useful,\n" "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" "GNU General Public License for more details.\n" "\n" "You should have received a copy of the GNU General Public License\n" "along with this program; if not, write to the Free Software\n" "Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\n" ); exit(1); }
true
FFmpeg
bf5af5687569e34d6e3a4d31fc6bb5dc44efdb29
void show_licence(void) { printf( "ffmpeg version " FFMPEG_VERSION "\n" "Copyright (c) 2000, 2001, 2002 Gerard Lantau\n" "This program is free software; you can redistribute it and/or modify\n" "it under the terms of the GNU General Public License as published by\n" "the Free Software Foundation; either version 2 of the License, or\n" "(at your option) any later version.\n" "\n" "This program is distributed in the hope that it will be useful,\n" "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" "GNU General Public License for more details.\n" "\n" "You should have received a copy of the GNU General Public License\n" "along with this program; if not, write to the Free Software\n" "Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\n" ); exit(1); }
{ "code": [ " \"Copyright (c) 2000, 2001, 2002 Gerard Lantau\\n\"", " \"This program is free software; you can redistribute it and/or modify\\n\"", " \"it under the terms of the GNU General Public License as published by\\n\"", " \"the Free Software Foundation; either version 2 of the License, or\\n\"", " \"(at your option) any later version.\\n\"", " \"This program is distributed in the hope that it will be useful,\\n\"", " \"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n\"", " \"GNU General Public License for more details.\\n\"", " \"You should have received a copy of the GNU General Public License\\n\"", " \"along with this program; if not, write to the Free Software\\n\"", " \"Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\\n\"", " exit(1);" ], "line_no": [ 9, 11, 13, 15, 17, 21, 25, 27, 31, 33, 35, 39 ] }
void FUNC_0(void) { printf( "ffmpeg version " FFMPEG_VERSION "\n" "Copyright (c) 2000, 2001, 2002 Gerard Lantau\n" "This program is free software; you can redistribute it and/or modify\n" "it under the terms of the GNU General Public License as published by\n" "the Free Software Foundation; either version 2 of the License, or\n" "(at your option) any later version.\n" "\n" "This program is distributed in the hope that it will be useful,\n" "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" "GNU General Public License for more details.\n" "\n" "You should have received a copy of the GNU General Public License\n" "along with this program; if not, write to the Free Software\n" "Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\n" ); exit(1); }
[ "void FUNC_0(void)\n{", "printf(\n\"ffmpeg version \" FFMPEG_VERSION \"\\n\"\n\"Copyright (c) 2000, 2001, 2002 Gerard Lantau\\n\"\n\"This program is free software; you can redistribute it and/or modify\\n\"", "\"it under the terms of the GNU General Public License as published by\\n\"\n\"the Free Software Foundation; either version 2 of the License, or\\n\"", "\"(at your option) any later version.\\n\"\n\"\\n\"\n\"This program is distributed in the hope that it will be useful,\\n\"\n\"but WITHOUT ANY WARRANTY; without even the implied warranty of\\n\"", "\"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n\"\n\"GNU General Public License for more details.\\n\"\n\"\\n\"\n\"You should have received a copy of the GNU General Public License\\n\"\n\"along with this program; if not, write to the Free Software\\n\"", "\"Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\\n\"\n);", "exit(1);", "}" ]
[ 0, 1, 1, 1, 1, 1, 1, 0 ]
[ [ 1, 3 ], [ 5, 7, 9, 11 ], [ 13, 15 ], [ 17, 19, 21, 23 ], [ 25, 27, 29, 31, 33 ], [ 35, 37 ], [ 39 ], [ 41 ] ]
15,518
static int parse_hex64(DeviceState *dev, Property *prop, const char *str) { uint64_t *ptr = qdev_get_prop_ptr(dev, prop); if (sscanf(str, "%" PRIx64, ptr) != 1) return -EINVAL; return 0; }
true
qemu
449041d4db1f82f281fe097e832f07cd9ee1e864
static int parse_hex64(DeviceState *dev, Property *prop, const char *str) { uint64_t *ptr = qdev_get_prop_ptr(dev, prop); if (sscanf(str, "%" PRIx64, ptr) != 1) return -EINVAL; return 0; }
{ "code": [ " if (sscanf(str, \"%\" PRIx64, ptr) != 1)" ], "line_no": [ 9 ] }
static int FUNC_0(DeviceState *VAR_0, Property *VAR_1, const char *VAR_2) { uint64_t *ptr = qdev_get_prop_ptr(VAR_0, VAR_1); if (sscanf(VAR_2, "%" PRIx64, ptr) != 1) return -EINVAL; return 0; }
[ "static int FUNC_0(DeviceState *VAR_0, Property *VAR_1, const char *VAR_2)\n{", "uint64_t *ptr = qdev_get_prop_ptr(VAR_0, VAR_1);", "if (sscanf(VAR_2, \"%\" PRIx64, ptr) != 1)\nreturn -EINVAL;", "return 0;", "}" ]
[ 0, 0, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9, 11 ], [ 13 ], [ 15 ] ]
15,519
const TPMDriverOps *tpm_get_backend_driver(const char *type) { int i; for (i = 0; i < TPM_MAX_DRIVERS && be_drivers[i] != NULL; i++) { if (!strcmp(TpmType_lookup[be_drivers[i]->type], type)) { return be_drivers[i]; } } return NULL; }
true
qemu
a9a72aeefbd3ef8bcbbeeccaf174ee10db2978ac
const TPMDriverOps *tpm_get_backend_driver(const char *type) { int i; for (i = 0; i < TPM_MAX_DRIVERS && be_drivers[i] != NULL; i++) { if (!strcmp(TpmType_lookup[be_drivers[i]->type], type)) { return be_drivers[i]; } } return NULL; }
{ "code": [ " int i;", " for (i = 0; i < TPM_MAX_DRIVERS && be_drivers[i] != NULL; i++) {", " if (!strcmp(TpmType_lookup[be_drivers[i]->type], type)) {", " return be_drivers[i];", " return NULL;", " int i;", " for (i = 0; i < TPM_MAX_DRIVERS && be_drivers[i] != NULL; i++) {", " int i;", " for (i = 0; i < TPM_MAX_DRIVERS && be_drivers[i] != NULL; i++) {", " return be_drivers[i];", " return NULL;" ], "line_no": [ 5, 9, 11, 13, 21, 5, 9, 5, 9, 13, 21 ] }
const TPMDriverOps *FUNC_0(const char *type) { int VAR_0; for (VAR_0 = 0; VAR_0 < TPM_MAX_DRIVERS && be_drivers[VAR_0] != NULL; VAR_0++) { if (!strcmp(TpmType_lookup[be_drivers[VAR_0]->type], type)) { return be_drivers[VAR_0]; } } return NULL; }
[ "const TPMDriverOps *FUNC_0(const char *type)\n{", "int VAR_0;", "for (VAR_0 = 0; VAR_0 < TPM_MAX_DRIVERS && be_drivers[VAR_0] != NULL; VAR_0++) {", "if (!strcmp(TpmType_lookup[be_drivers[VAR_0]->type], type)) {", "return be_drivers[VAR_0];", "}", "}", "return NULL;", "}" ]
[ 0, 1, 1, 1, 1, 0, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ] ]
15,522
static void glib_pollfds_fill(int64_t *cur_timeout) { GMainContext *context = g_main_context_default(); int timeout = 0; int64_t timeout_ns; int n; g_main_context_prepare(context, &max_priority); glib_pollfds_idx = gpollfds->len; n = glib_n_poll_fds; do { GPollFD *pfds; glib_n_poll_fds = n; g_array_set_size(gpollfds, glib_pollfds_idx + glib_n_poll_fds); pfds = &g_array_index(gpollfds, GPollFD, glib_pollfds_idx); n = g_main_context_query(context, max_priority, &timeout, pfds, glib_n_poll_fds); } while (n != glib_n_poll_fds); if (timeout < 0) { timeout_ns = -1; } else { timeout_ns = (int64_t)timeout * (int64_t)SCALE_MS; } *cur_timeout = qemu_soonest_timeout(timeout_ns, *cur_timeout); }
false
qemu
c2b38b277a7882a592f4f2ec955084b2b756daaa
static void glib_pollfds_fill(int64_t *cur_timeout) { GMainContext *context = g_main_context_default(); int timeout = 0; int64_t timeout_ns; int n; g_main_context_prepare(context, &max_priority); glib_pollfds_idx = gpollfds->len; n = glib_n_poll_fds; do { GPollFD *pfds; glib_n_poll_fds = n; g_array_set_size(gpollfds, glib_pollfds_idx + glib_n_poll_fds); pfds = &g_array_index(gpollfds, GPollFD, glib_pollfds_idx); n = g_main_context_query(context, max_priority, &timeout, pfds, glib_n_poll_fds); } while (n != glib_n_poll_fds); if (timeout < 0) { timeout_ns = -1; } else { timeout_ns = (int64_t)timeout * (int64_t)SCALE_MS; } *cur_timeout = qemu_soonest_timeout(timeout_ns, *cur_timeout); }
{ "code": [], "line_no": [] }
static void FUNC_0(int64_t *VAR_0) { GMainContext *context = g_main_context_default(); int VAR_1 = 0; int64_t timeout_ns; int VAR_2; g_main_context_prepare(context, &max_priority); glib_pollfds_idx = gpollfds->len; VAR_2 = glib_n_poll_fds; do { GPollFD *pfds; glib_n_poll_fds = VAR_2; g_array_set_size(gpollfds, glib_pollfds_idx + glib_n_poll_fds); pfds = &g_array_index(gpollfds, GPollFD, glib_pollfds_idx); VAR_2 = g_main_context_query(context, max_priority, &VAR_1, pfds, glib_n_poll_fds); } while (VAR_2 != glib_n_poll_fds); if (VAR_1 < 0) { timeout_ns = -1; } else { timeout_ns = (int64_t)VAR_1 * (int64_t)SCALE_MS; } *VAR_0 = qemu_soonest_timeout(timeout_ns, *VAR_0); }
[ "static void FUNC_0(int64_t *VAR_0)\n{", "GMainContext *context = g_main_context_default();", "int VAR_1 = 0;", "int64_t timeout_ns;", "int VAR_2;", "g_main_context_prepare(context, &max_priority);", "glib_pollfds_idx = gpollfds->len;", "VAR_2 = glib_n_poll_fds;", "do {", "GPollFD *pfds;", "glib_n_poll_fds = VAR_2;", "g_array_set_size(gpollfds, glib_pollfds_idx + glib_n_poll_fds);", "pfds = &g_array_index(gpollfds, GPollFD, glib_pollfds_idx);", "VAR_2 = g_main_context_query(context, max_priority, &VAR_1, pfds,\nglib_n_poll_fds);", "} while (VAR_2 != glib_n_poll_fds);", "if (VAR_1 < 0) {", "timeout_ns = -1;", "} else {", "timeout_ns = (int64_t)VAR_1 * (int64_t)SCALE_MS;", "}", "*VAR_0 = qemu_soonest_timeout(timeout_ns, *VAR_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 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33, 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ] ]
15,525
static uint64_t musicpal_misc_read(void *opaque, target_phys_addr_t offset, unsigned size) { switch (offset) { case MP_MISC_BOARD_REVISION: return MP_BOARD_REVISION; default: return 0; } }
false
qemu
a8170e5e97ad17ca169c64ba87ae2f53850dab4c
static uint64_t musicpal_misc_read(void *opaque, target_phys_addr_t offset, unsigned size) { switch (offset) { case MP_MISC_BOARD_REVISION: return MP_BOARD_REVISION; default: return 0; } }
{ "code": [], "line_no": [] }
static uint64_t FUNC_0(void *opaque, target_phys_addr_t offset, unsigned size) { switch (offset) { case MP_MISC_BOARD_REVISION: return MP_BOARD_REVISION; default: return 0; } }
[ "static uint64_t FUNC_0(void *opaque, target_phys_addr_t offset,\nunsigned size)\n{", "switch (offset) {", "case MP_MISC_BOARD_REVISION:\nreturn MP_BOARD_REVISION;", "default:\nreturn 0;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9, 11 ], [ 15, 17 ], [ 19 ], [ 21 ] ]
15,527
static void dmg_refresh_limits(BlockDriverState *bs, Error **errp) { bs->request_alignment = BDRV_SECTOR_SIZE; /* No sub-sector I/O supported */ }
false
qemu
a5b8dd2ce83208cd7d6eb4562339ecf5aae13574
static void dmg_refresh_limits(BlockDriverState *bs, Error **errp) { bs->request_alignment = BDRV_SECTOR_SIZE; }
{ "code": [], "line_no": [] }
static void FUNC_0(BlockDriverState *VAR_0, Error **VAR_1) { VAR_0->request_alignment = BDRV_SECTOR_SIZE; }
[ "static void FUNC_0(BlockDriverState *VAR_0, Error **VAR_1)\n{", "VAR_0->request_alignment = BDRV_SECTOR_SIZE;", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
15,528
static void sigp_store_adtl_status(void *arg) { SigpInfo *si = arg; if (!kvm_check_extension(kvm_state, KVM_CAP_S390_VECTOR_REGISTERS)) { set_sigp_status(si, SIGP_STAT_INVALID_ORDER); return; } /* cpu has to be stopped */ if (s390_cpu_get_state(si->cpu) != CPU_STATE_STOPPED) { set_sigp_status(si, SIGP_STAT_INCORRECT_STATE); return; } /* parameter must be aligned to 1024-byte boundary */ if (si->param & 0x3ff) { set_sigp_status(si, SIGP_STAT_INVALID_PARAMETER); return; } cpu_synchronize_state(CPU(si->cpu)); if (kvm_s390_store_adtl_status(si->cpu, si->param)) { set_sigp_status(si, SIGP_STAT_INVALID_PARAMETER); return; } si->cc = SIGP_CC_ORDER_CODE_ACCEPTED; }
false
qemu
7c72ac49ae9f38fa0125296e05988655157decb5
static void sigp_store_adtl_status(void *arg) { SigpInfo *si = arg; if (!kvm_check_extension(kvm_state, KVM_CAP_S390_VECTOR_REGISTERS)) { set_sigp_status(si, SIGP_STAT_INVALID_ORDER); return; } if (s390_cpu_get_state(si->cpu) != CPU_STATE_STOPPED) { set_sigp_status(si, SIGP_STAT_INCORRECT_STATE); return; } if (si->param & 0x3ff) { set_sigp_status(si, SIGP_STAT_INVALID_PARAMETER); return; } cpu_synchronize_state(CPU(si->cpu)); if (kvm_s390_store_adtl_status(si->cpu, si->param)) { set_sigp_status(si, SIGP_STAT_INVALID_PARAMETER); return; } si->cc = SIGP_CC_ORDER_CODE_ACCEPTED; }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0) { SigpInfo *si = VAR_0; if (!kvm_check_extension(kvm_state, KVM_CAP_S390_VECTOR_REGISTERS)) { set_sigp_status(si, SIGP_STAT_INVALID_ORDER); return; } if (s390_cpu_get_state(si->cpu) != CPU_STATE_STOPPED) { set_sigp_status(si, SIGP_STAT_INCORRECT_STATE); return; } if (si->param & 0x3ff) { set_sigp_status(si, SIGP_STAT_INVALID_PARAMETER); return; } cpu_synchronize_state(CPU(si->cpu)); if (kvm_s390_store_adtl_status(si->cpu, si->param)) { set_sigp_status(si, SIGP_STAT_INVALID_PARAMETER); return; } si->cc = SIGP_CC_ORDER_CODE_ACCEPTED; }
[ "static void FUNC_0(void *VAR_0)\n{", "SigpInfo *si = VAR_0;", "if (!kvm_check_extension(kvm_state, KVM_CAP_S390_VECTOR_REGISTERS)) {", "set_sigp_status(si, SIGP_STAT_INVALID_ORDER);", "return;", "}", "if (s390_cpu_get_state(si->cpu) != CPU_STATE_STOPPED) {", "set_sigp_status(si, SIGP_STAT_INCORRECT_STATE);", "return;", "}", "if (si->param & 0x3ff) {", "set_sigp_status(si, SIGP_STAT_INVALID_PARAMETER);", "return;", "}", "cpu_synchronize_state(CPU(si->cpu));", "if (kvm_s390_store_adtl_status(si->cpu, si->param)) {", "set_sigp_status(si, SIGP_STAT_INVALID_PARAMETER);", "return;", "}", "si->cc = SIGP_CC_ORDER_CODE_ACCEPTED;", "}" ]
[ 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 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ] ]
15,529
static void rom_reset(void *unused) { Rom *rom; QTAILQ_FOREACH(rom, &roms, next) { if (rom->fw_file) { continue; } if (rom->data == NULL) continue; cpu_physical_memory_write_rom(rom->addr, rom->data, rom->romsize); if (rom->isrom) { /* rom needs to be written only once */ qemu_free(rom->data); rom->data = NULL; } } }
false
qemu
bdb5ee3064d5ae786b0bcb6cf6ff4e3554a72990
static void rom_reset(void *unused) { Rom *rom; QTAILQ_FOREACH(rom, &roms, next) { if (rom->fw_file) { continue; } if (rom->data == NULL) continue; cpu_physical_memory_write_rom(rom->addr, rom->data, rom->romsize); if (rom->isrom) { qemu_free(rom->data); rom->data = NULL; } } }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0) { Rom *rom; QTAILQ_FOREACH(rom, &roms, next) { if (rom->fw_file) { continue; } if (rom->data == NULL) continue; cpu_physical_memory_write_rom(rom->addr, rom->data, rom->romsize); if (rom->isrom) { qemu_free(rom->data); rom->data = NULL; } } }
[ "static void FUNC_0(void *VAR_0)\n{", "Rom *rom;", "QTAILQ_FOREACH(rom, &roms, next) {", "if (rom->fw_file) {", "continue;", "}", "if (rom->data == NULL)\ncontinue;", "cpu_physical_memory_write_rom(rom->addr, rom->data, rom->romsize);", "if (rom->isrom) {", "qemu_free(rom->data);", "rom->data = NULL;", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17, 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ] ]
15,531
static void mp3_parse_info_tag(AVFormatContext *s, AVStream *st, MPADecodeHeader *c, uint32_t spf) { #define LAST_BITS(k, n) ((k) & ((1 << (n)) - 1)) #define MIDDLE_BITS(k, m, n) LAST_BITS((k) >> (m), ((n) - (m))) uint16_t crc; uint32_t v; char version[10]; uint32_t peak = 0; int32_t r_gain = INT32_MIN, a_gain = INT32_MIN; MP3DecContext *mp3 = s->priv_data; static const int64_t xing_offtbl[2][2] = {{32, 17}, {17,9}}; uint64_t fsize = avio_size(s->pb); /* Check for Xing / Info tag */ avio_skip(s->pb, xing_offtbl[c->lsf == 1][c->nb_channels == 1]); v = avio_rb32(s->pb); mp3->is_cbr = v == MKBETAG('I', 'n', 'f', 'o'); if (v != MKBETAG('X', 'i', 'n', 'g') && !mp3->is_cbr) return; v = avio_rb32(s->pb); if (v & XING_FLAG_FRAMES) mp3->frames = avio_rb32(s->pb); if (v & XING_FLAG_SIZE) mp3->header_filesize = avio_rb32(s->pb); if (fsize && mp3->header_filesize) { uint64_t min, delta; min = FFMIN(fsize, mp3->header_filesize); delta = FFMAX(fsize, mp3->header_filesize) - min; if (fsize > mp3->header_filesize && delta > min >> 4) { mp3->frames = 0; } else if (delta > min >> 4) { av_log(s, AV_LOG_WARNING, "filesize and duration do not match (growing file?)\n"); } } if (v & XING_FLAG_TOC) read_xing_toc(s, mp3->header_filesize, av_rescale_q(mp3->frames, (AVRational){spf, c->sample_rate}, st->time_base)); /* VBR quality */ if(v & 8) avio_skip(s->pb, 4); /* Encoder short version string */ memset(version, 0, sizeof(version)); avio_read(s->pb, version, 9); /* Info Tag revision + VBR method */ avio_r8(s->pb); /* Lowpass filter value */ avio_r8(s->pb); /* ReplayGain peak */ v = avio_rb32(s->pb); peak = av_rescale(v, 100000, 1 << 23); /* Radio ReplayGain */ v = avio_rb16(s->pb); if (MIDDLE_BITS(v, 13, 15) == 1) { r_gain = MIDDLE_BITS(v, 0, 8) * 10000; if (v & (1 << 9)) r_gain *= -1; } /* Audiophile ReplayGain */ v = avio_rb16(s->pb); if (MIDDLE_BITS(v, 13, 15) == 2) { a_gain = MIDDLE_BITS(v, 0, 8) * 10000; if (v & (1 << 9)) a_gain *= -1; } /* Encoding flags + ATH Type */ avio_r8(s->pb); /* if ABR {specified bitrate} else {minimal bitrate} */ avio_r8(s->pb); /* Encoder delays */ v= avio_rb24(s->pb); if(AV_RB32(version) == MKBETAG('L', 'A', 'M', 'E') || AV_RB32(version) == MKBETAG('L', 'a', 'v', 'f')) { mp3->start_pad = v>>12; mp3-> end_pad = v&4095; st->skip_samples = mp3->start_pad + 528 + 1; if (mp3->frames) st->end_discard_sample = -mp3->end_pad + 528 + 1 + mp3->frames * (int64_t)spf; if (!st->start_time) st->start_time = av_rescale_q(st->skip_samples, (AVRational){1, c->sample_rate}, st->time_base); av_log(s, AV_LOG_DEBUG, "pad %d %d\n", mp3->start_pad, mp3-> end_pad); } /* Misc */ avio_r8(s->pb); /* MP3 gain */ avio_r8(s->pb); /* Preset and surround info */ avio_rb16(s->pb); /* Music length */ avio_rb32(s->pb); /* Music CRC */ avio_rb16(s->pb); /* Info Tag CRC */ crc = ffio_get_checksum(s->pb); v = avio_rb16(s->pb); if (v == crc) { ff_replaygain_export_raw(st, r_gain, peak, a_gain, 0); av_dict_set(&st->metadata, "encoder", version, 0); } }
false
FFmpeg
6c7f1155bb648eced8e5aa08b1fd490df2f8b325
static void mp3_parse_info_tag(AVFormatContext *s, AVStream *st, MPADecodeHeader *c, uint32_t spf) { #define LAST_BITS(k, n) ((k) & ((1 << (n)) - 1)) #define MIDDLE_BITS(k, m, n) LAST_BITS((k) >> (m), ((n) - (m))) uint16_t crc; uint32_t v; char version[10]; uint32_t peak = 0; int32_t r_gain = INT32_MIN, a_gain = INT32_MIN; MP3DecContext *mp3 = s->priv_data; static const int64_t xing_offtbl[2][2] = {{32, 17}, {17,9}}; uint64_t fsize = avio_size(s->pb); avio_skip(s->pb, xing_offtbl[c->lsf == 1][c->nb_channels == 1]); v = avio_rb32(s->pb); mp3->is_cbr = v == MKBETAG('I', 'n', 'f', 'o'); if (v != MKBETAG('X', 'i', 'n', 'g') && !mp3->is_cbr) return; v = avio_rb32(s->pb); if (v & XING_FLAG_FRAMES) mp3->frames = avio_rb32(s->pb); if (v & XING_FLAG_SIZE) mp3->header_filesize = avio_rb32(s->pb); if (fsize && mp3->header_filesize) { uint64_t min, delta; min = FFMIN(fsize, mp3->header_filesize); delta = FFMAX(fsize, mp3->header_filesize) - min; if (fsize > mp3->header_filesize && delta > min >> 4) { mp3->frames = 0; } else if (delta > min >> 4) { av_log(s, AV_LOG_WARNING, "filesize and duration do not match (growing file?)\n"); } } if (v & XING_FLAG_TOC) read_xing_toc(s, mp3->header_filesize, av_rescale_q(mp3->frames, (AVRational){spf, c->sample_rate}, st->time_base)); if(v & 8) avio_skip(s->pb, 4); memset(version, 0, sizeof(version)); avio_read(s->pb, version, 9); avio_r8(s->pb); avio_r8(s->pb); v = avio_rb32(s->pb); peak = av_rescale(v, 100000, 1 << 23); v = avio_rb16(s->pb); if (MIDDLE_BITS(v, 13, 15) == 1) { r_gain = MIDDLE_BITS(v, 0, 8) * 10000; if (v & (1 << 9)) r_gain *= -1; } v = avio_rb16(s->pb); if (MIDDLE_BITS(v, 13, 15) == 2) { a_gain = MIDDLE_BITS(v, 0, 8) * 10000; if (v & (1 << 9)) a_gain *= -1; } avio_r8(s->pb); avio_r8(s->pb); v= avio_rb24(s->pb); if(AV_RB32(version) == MKBETAG('L', 'A', 'M', 'E') || AV_RB32(version) == MKBETAG('L', 'a', 'v', 'f')) { mp3->start_pad = v>>12; mp3-> end_pad = v&4095; st->skip_samples = mp3->start_pad + 528 + 1; if (mp3->frames) st->end_discard_sample = -mp3->end_pad + 528 + 1 + mp3->frames * (int64_t)spf; if (!st->start_time) st->start_time = av_rescale_q(st->skip_samples, (AVRational){1, c->sample_rate}, st->time_base); av_log(s, AV_LOG_DEBUG, "pad %d %d\n", mp3->start_pad, mp3-> end_pad); } avio_r8(s->pb); avio_r8(s->pb); avio_rb16(s->pb); avio_rb32(s->pb); avio_rb16(s->pb); crc = ffio_get_checksum(s->pb); v = avio_rb16(s->pb); if (v == crc) { ff_replaygain_export_raw(st, r_gain, peak, a_gain, 0); av_dict_set(&st->metadata, "encoder", version, 0); } }
{ "code": [], "line_no": [] }
static void FUNC_0(AVFormatContext *VAR_0, AVStream *VAR_1, MPADecodeHeader *VAR_2, uint32_t VAR_3) { #define LAST_BITS(k, n) ((k) & ((1 << (n)) - 1)) #define MIDDLE_BITS(k, m, n) LAST_BITS((k) >> (m), ((n) - (m))) uint16_t crc; uint32_t v; char VAR_4[10]; uint32_t peak = 0; int32_t r_gain = INT32_MIN, a_gain = INT32_MIN; MP3DecContext *mp3 = VAR_0->priv_data; static const int64_t VAR_5[2][2] = {{32, 17}, {17,9}}; uint64_t fsize = avio_size(VAR_0->pb); avio_skip(VAR_0->pb, VAR_5[VAR_2->lsf == 1][VAR_2->nb_channels == 1]); v = avio_rb32(VAR_0->pb); mp3->is_cbr = v == MKBETAG('I', 'n', 'f', 'o'); if (v != MKBETAG('X', 'i', 'n', 'g') && !mp3->is_cbr) return; v = avio_rb32(VAR_0->pb); if (v & XING_FLAG_FRAMES) mp3->frames = avio_rb32(VAR_0->pb); if (v & XING_FLAG_SIZE) mp3->header_filesize = avio_rb32(VAR_0->pb); if (fsize && mp3->header_filesize) { uint64_t min, delta; min = FFMIN(fsize, mp3->header_filesize); delta = FFMAX(fsize, mp3->header_filesize) - min; if (fsize > mp3->header_filesize && delta > min >> 4) { mp3->frames = 0; } else if (delta > min >> 4) { av_log(VAR_0, AV_LOG_WARNING, "filesize and duration do not match (growing file?)\n"); } } if (v & XING_FLAG_TOC) read_xing_toc(VAR_0, mp3->header_filesize, av_rescale_q(mp3->frames, (AVRational){VAR_3, VAR_2->sample_rate}, VAR_1->time_base)); if(v & 8) avio_skip(VAR_0->pb, 4); memset(VAR_4, 0, sizeof(VAR_4)); avio_read(VAR_0->pb, VAR_4, 9); avio_r8(VAR_0->pb); avio_r8(VAR_0->pb); v = avio_rb32(VAR_0->pb); peak = av_rescale(v, 100000, 1 << 23); v = avio_rb16(VAR_0->pb); if (MIDDLE_BITS(v, 13, 15) == 1) { r_gain = MIDDLE_BITS(v, 0, 8) * 10000; if (v & (1 << 9)) r_gain *= -1; } v = avio_rb16(VAR_0->pb); if (MIDDLE_BITS(v, 13, 15) == 2) { a_gain = MIDDLE_BITS(v, 0, 8) * 10000; if (v & (1 << 9)) a_gain *= -1; } avio_r8(VAR_0->pb); avio_r8(VAR_0->pb); v= avio_rb24(VAR_0->pb); if(AV_RB32(VAR_4) == MKBETAG('L', 'A', 'M', 'E') || AV_RB32(VAR_4) == MKBETAG('L', 'a', 'v', 'f')) { mp3->start_pad = v>>12; mp3-> end_pad = v&4095; VAR_1->skip_samples = mp3->start_pad + 528 + 1; if (mp3->frames) VAR_1->end_discard_sample = -mp3->end_pad + 528 + 1 + mp3->frames * (int64_t)VAR_3; if (!VAR_1->start_time) VAR_1->start_time = av_rescale_q(VAR_1->skip_samples, (AVRational){1, VAR_2->sample_rate}, VAR_1->time_base); av_log(VAR_0, AV_LOG_DEBUG, "pad %d %d\n", mp3->start_pad, mp3-> end_pad); } avio_r8(VAR_0->pb); avio_r8(VAR_0->pb); avio_rb16(VAR_0->pb); avio_rb32(VAR_0->pb); avio_rb16(VAR_0->pb); crc = ffio_get_checksum(VAR_0->pb); v = avio_rb16(VAR_0->pb); if (v == crc) { ff_replaygain_export_raw(VAR_1, r_gain, peak, a_gain, 0); av_dict_set(&VAR_1->metadata, "encoder", VAR_4, 0); } }
[ "static void FUNC_0(AVFormatContext *VAR_0, AVStream *VAR_1,\nMPADecodeHeader *VAR_2, uint32_t VAR_3)\n{", "#define LAST_BITS(k, n) ((k) & ((1 << (n)) - 1))\n#define MIDDLE_BITS(k, m, n) LAST_BITS((k) >> (m), ((n) - (m)))\nuint16_t crc;", "uint32_t v;", "char VAR_4[10];", "uint32_t peak = 0;", "int32_t r_gain = INT32_MIN, a_gain = INT32_MIN;", "MP3DecContext *mp3 = VAR_0->priv_data;", "static const int64_t VAR_5[2][2] = {{32, 17}, {17,9}};", "uint64_t fsize = avio_size(VAR_0->pb);", "avio_skip(VAR_0->pb, VAR_5[VAR_2->lsf == 1][VAR_2->nb_channels == 1]);", "v = avio_rb32(VAR_0->pb);", "mp3->is_cbr = v == MKBETAG('I', 'n', 'f', 'o');", "if (v != MKBETAG('X', 'i', 'n', 'g') && !mp3->is_cbr)\nreturn;", "v = avio_rb32(VAR_0->pb);", "if (v & XING_FLAG_FRAMES)\nmp3->frames = avio_rb32(VAR_0->pb);", "if (v & XING_FLAG_SIZE)\nmp3->header_filesize = avio_rb32(VAR_0->pb);", "if (fsize && mp3->header_filesize) {", "uint64_t min, delta;", "min = FFMIN(fsize, mp3->header_filesize);", "delta = FFMAX(fsize, mp3->header_filesize) - min;", "if (fsize > mp3->header_filesize && delta > min >> 4) {", "mp3->frames = 0;", "} else if (delta > min >> 4) {", "av_log(VAR_0, AV_LOG_WARNING,\n\"filesize and duration do not match (growing file?)\\n\");", "}", "}", "if (v & XING_FLAG_TOC)\nread_xing_toc(VAR_0, mp3->header_filesize, av_rescale_q(mp3->frames,\n(AVRational){VAR_3, VAR_2->sample_rate},", "VAR_1->time_base));", "if(v & 8)\navio_skip(VAR_0->pb, 4);", "memset(VAR_4, 0, sizeof(VAR_4));", "avio_read(VAR_0->pb, VAR_4, 9);", "avio_r8(VAR_0->pb);", "avio_r8(VAR_0->pb);", "v = avio_rb32(VAR_0->pb);", "peak = av_rescale(v, 100000, 1 << 23);", "v = avio_rb16(VAR_0->pb);", "if (MIDDLE_BITS(v, 13, 15) == 1) {", "r_gain = MIDDLE_BITS(v, 0, 8) * 10000;", "if (v & (1 << 9))\nr_gain *= -1;", "}", "v = avio_rb16(VAR_0->pb);", "if (MIDDLE_BITS(v, 13, 15) == 2) {", "a_gain = MIDDLE_BITS(v, 0, 8) * 10000;", "if (v & (1 << 9))\na_gain *= -1;", "}", "avio_r8(VAR_0->pb);", "avio_r8(VAR_0->pb);", "v= avio_rb24(VAR_0->pb);", "if(AV_RB32(VAR_4) == MKBETAG('L', 'A', 'M', 'E')\n|| AV_RB32(VAR_4) == MKBETAG('L', 'a', 'v', 'f')) {", "mp3->start_pad = v>>12;", "mp3-> end_pad = v&4095;", "VAR_1->skip_samples = mp3->start_pad + 528 + 1;", "if (mp3->frames)\nVAR_1->end_discard_sample = -mp3->end_pad + 528 + 1 + mp3->frames * (int64_t)VAR_3;", "if (!VAR_1->start_time)\nVAR_1->start_time = av_rescale_q(VAR_1->skip_samples,\n(AVRational){1, VAR_2->sample_rate},", "VAR_1->time_base);", "av_log(VAR_0, AV_LOG_DEBUG, \"pad %d %d\\n\", mp3->start_pad, mp3-> end_pad);", "}", "avio_r8(VAR_0->pb);", "avio_r8(VAR_0->pb);", "avio_rb16(VAR_0->pb);", "avio_rb32(VAR_0->pb);", "avio_rb16(VAR_0->pb);", "crc = ffio_get_checksum(VAR_0->pb);", "v = avio_rb16(VAR_0->pb);", "if (v == crc) {", "ff_replaygain_export_raw(VAR_1, r_gain, peak, a_gain, 0);", "av_dict_set(&VAR_1->metadata, \"encoder\", VAR_4, 0);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 19 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 39 ], [ 41 ], [ 43 ], [ 45, 47 ], [ 51 ], [ 53, 55 ], [ 57, 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75, 77 ], [ 79 ], [ 81 ], [ 83, 85, 87 ], [ 89 ], [ 93, 95 ], [ 101 ], [ 103 ], [ 109 ], [ 115 ], [ 121 ], [ 123 ], [ 129 ], [ 133 ], [ 135 ], [ 139, 141 ], [ 143 ], [ 149 ], [ 153 ], [ 155 ], [ 159, 161 ], [ 163 ], [ 169 ], [ 175 ], [ 181 ], [ 183, 185 ], [ 189 ], [ 191 ], [ 193 ], [ 195, 197 ], [ 199, 201, 203 ], [ 205 ], [ 207 ], [ 209 ], [ 215 ], [ 221 ], [ 227 ], [ 233 ], [ 239 ], [ 245 ], [ 247 ], [ 251 ], [ 253 ], [ 255 ], [ 257 ], [ 259 ] ]
15,532
int av_samples_alloc(uint8_t **audio_data, int *linesize, int nb_channels, int nb_samples, enum AVSampleFormat sample_fmt, int align) { uint8_t *buf; int size = av_samples_get_buffer_size(NULL, nb_channels, nb_samples, sample_fmt, align); if (size < 0) return size; buf = av_mallocz(size); if (!buf) return AVERROR(ENOMEM); size = av_samples_fill_arrays(audio_data, linesize, buf, nb_channels, nb_samples, sample_fmt, align); if (size < 0) { av_free(buf); return size; } return 0; }
false
FFmpeg
cd15b7c03d8df29d4c69b0620cf27d4a8c9dfb65
int av_samples_alloc(uint8_t **audio_data, int *linesize, int nb_channels, int nb_samples, enum AVSampleFormat sample_fmt, int align) { uint8_t *buf; int size = av_samples_get_buffer_size(NULL, nb_channels, nb_samples, sample_fmt, align); if (size < 0) return size; buf = av_mallocz(size); if (!buf) return AVERROR(ENOMEM); size = av_samples_fill_arrays(audio_data, linesize, buf, nb_channels, nb_samples, sample_fmt, align); if (size < 0) { av_free(buf); return size; } return 0; }
{ "code": [], "line_no": [] }
int FUNC_0(uint8_t **VAR_0, int *VAR_1, int VAR_2, int VAR_3, enum AVSampleFormat VAR_4, int VAR_5) { uint8_t *buf; int VAR_6 = av_samples_get_buffer_size(NULL, VAR_2, VAR_3, VAR_4, VAR_5); if (VAR_6 < 0) return VAR_6; buf = av_mallocz(VAR_6); if (!buf) return AVERROR(ENOMEM); VAR_6 = av_samples_fill_arrays(VAR_0, VAR_1, buf, VAR_2, VAR_3, VAR_4, VAR_5); if (VAR_6 < 0) { av_free(buf); return VAR_6; } return 0; }
[ "int FUNC_0(uint8_t **VAR_0, int *VAR_1, int VAR_2,\nint VAR_3, enum AVSampleFormat VAR_4, int VAR_5)\n{", "uint8_t *buf;", "int VAR_6 = av_samples_get_buffer_size(NULL, VAR_2, VAR_3,\nVAR_4, VAR_5);", "if (VAR_6 < 0)\nreturn VAR_6;", "buf = av_mallocz(VAR_6);", "if (!buf)\nreturn AVERROR(ENOMEM);", "VAR_6 = av_samples_fill_arrays(VAR_0, VAR_1, buf, VAR_2,\nVAR_3, VAR_4, VAR_5);", "if (VAR_6 < 0) {", "av_free(buf);", "return VAR_6;", "}", "return 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 ], [ 27, 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ] ]
15,533
static void do_interrupt_protected(int intno, int is_int, int error_code, unsigned int next_eip, int is_hw) { SegmentCache *dt; uint8_t *ptr, *ssp; int type, dpl, selector, ss_dpl, cpl, sp_mask; int has_error_code, new_stack, shift; uint32_t e1, e2, offset, ss, esp, ss_e1, ss_e2; uint32_t old_eip; has_error_code = 0; if (!is_int && !is_hw) { switch(intno) { case 8: case 10: case 11: case 12: case 13: case 14: case 17: has_error_code = 1; break; } } dt = &env->idt; if (intno * 8 + 7 > dt->limit) raise_exception_err(EXCP0D_GPF, intno * 8 + 2); ptr = dt->base + intno * 8; e1 = ldl_kernel(ptr); e2 = ldl_kernel(ptr + 4); /* check gate type */ type = (e2 >> DESC_TYPE_SHIFT) & 0x1f; switch(type) { case 5: /* task gate */ /* must do that check here to return the correct error code */ if (!(e2 & DESC_P_MASK)) raise_exception_err(EXCP0B_NOSEG, intno * 8 + 2); switch_tss(intno * 8, e1, e2, SWITCH_TSS_CALL); if (has_error_code) { int mask; /* push the error code */ shift = (env->segs[R_CS].flags >> DESC_B_SHIFT) & 1; if (env->segs[R_SS].flags & DESC_B_MASK) mask = 0xffffffff; else mask = 0xffff; esp = (env->regs[R_ESP] - (2 << shift)) & mask; ssp = env->segs[R_SS].base + esp; if (shift) stl_kernel(ssp, error_code); else stw_kernel(ssp, error_code); env->regs[R_ESP] = (esp & mask) | (env->regs[R_ESP] & ~mask); } return; case 6: /* 286 interrupt gate */ case 7: /* 286 trap gate */ case 14: /* 386 interrupt gate */ case 15: /* 386 trap gate */ break; default: raise_exception_err(EXCP0D_GPF, intno * 8 + 2); break; } dpl = (e2 >> DESC_DPL_SHIFT) & 3; cpl = env->hflags & HF_CPL_MASK; /* check privledge if software int */ if (is_int && dpl < cpl) raise_exception_err(EXCP0D_GPF, intno * 8 + 2); /* check valid bit */ if (!(e2 & DESC_P_MASK)) raise_exception_err(EXCP0B_NOSEG, intno * 8 + 2); selector = e1 >> 16; offset = (e2 & 0xffff0000) | (e1 & 0x0000ffff); if ((selector & 0xfffc) == 0) raise_exception_err(EXCP0D_GPF, 0); if (load_segment(&e1, &e2, selector) != 0) raise_exception_err(EXCP0D_GPF, selector & 0xfffc); if (!(e2 & DESC_S_MASK) || !(e2 & (DESC_CS_MASK))) raise_exception_err(EXCP0D_GPF, selector & 0xfffc); dpl = (e2 >> DESC_DPL_SHIFT) & 3; if (dpl > cpl) raise_exception_err(EXCP0D_GPF, selector & 0xfffc); if (!(e2 & DESC_P_MASK)) raise_exception_err(EXCP0B_NOSEG, selector & 0xfffc); if (!(e2 & DESC_C_MASK) && dpl < cpl) { /* to inner priviledge */ get_ss_esp_from_tss(&ss, &esp, dpl); if ((ss & 0xfffc) == 0) raise_exception_err(EXCP0A_TSS, ss & 0xfffc); if ((ss & 3) != dpl) raise_exception_err(EXCP0A_TSS, ss & 0xfffc); if (load_segment(&ss_e1, &ss_e2, ss) != 0) raise_exception_err(EXCP0A_TSS, ss & 0xfffc); ss_dpl = (ss_e2 >> DESC_DPL_SHIFT) & 3; if (ss_dpl != dpl) raise_exception_err(EXCP0A_TSS, ss & 0xfffc); if (!(ss_e2 & DESC_S_MASK) || (ss_e2 & DESC_CS_MASK) || !(ss_e2 & DESC_W_MASK)) raise_exception_err(EXCP0A_TSS, ss & 0xfffc); if (!(ss_e2 & DESC_P_MASK)) raise_exception_err(EXCP0A_TSS, ss & 0xfffc); new_stack = 1; sp_mask = get_sp_mask(ss_e2); ssp = get_seg_base(ss_e1, ss_e2); } else if ((e2 & DESC_C_MASK) || dpl == cpl) { /* to same priviledge */ new_stack = 0; sp_mask = get_sp_mask(env->segs[R_SS].flags); ssp = env->segs[R_SS].base; esp = ESP; } else { raise_exception_err(EXCP0D_GPF, selector & 0xfffc); new_stack = 0; /* avoid warning */ sp_mask = 0; /* avoid warning */ ssp = NULL; /* avoid warning */ esp = 0; /* avoid warning */ } shift = type >> 3; #if 0 /* XXX: check that enough room is available */ push_size = 6 + (new_stack << 2) + (has_error_code << 1); if (env->eflags & VM_MASK) push_size += 8; push_size <<= shift; #endif if (is_int) old_eip = next_eip; else old_eip = env->eip; if (shift == 1) { if (env->eflags & VM_MASK) { PUSHL(ssp, esp, sp_mask, env->segs[R_GS].selector); PUSHL(ssp, esp, sp_mask, env->segs[R_FS].selector); PUSHL(ssp, esp, sp_mask, env->segs[R_DS].selector); PUSHL(ssp, esp, sp_mask, env->segs[R_ES].selector); } if (new_stack) { PUSHL(ssp, esp, sp_mask, env->segs[R_SS].selector); PUSHL(ssp, esp, sp_mask, ESP); } PUSHL(ssp, esp, sp_mask, compute_eflags()); PUSHL(ssp, esp, sp_mask, env->segs[R_CS].selector); PUSHL(ssp, esp, sp_mask, old_eip); if (has_error_code) { PUSHL(ssp, esp, sp_mask, error_code); } } else { if (new_stack) { PUSHW(ssp, esp, sp_mask, env->segs[R_SS].selector); PUSHW(ssp, esp, sp_mask, ESP); } PUSHW(ssp, esp, sp_mask, compute_eflags()); PUSHW(ssp, esp, sp_mask, env->segs[R_CS].selector); PUSHW(ssp, esp, sp_mask, old_eip); if (has_error_code) { PUSHW(ssp, esp, sp_mask, error_code); } } if (new_stack) { ss = (ss & ~3) | dpl; cpu_x86_load_seg_cache(env, R_SS, ss, ssp, get_seg_limit(ss_e1, ss_e2), ss_e2); } ESP = (ESP & ~sp_mask) | (esp & sp_mask); selector = (selector & ~3) | dpl; cpu_x86_load_seg_cache(env, R_CS, selector, get_seg_base(e1, e2), get_seg_limit(e1, e2), e2); cpu_x86_set_cpl(env, dpl); env->eip = offset; /* interrupt gate clear IF mask */ if ((type & 1) == 0) { env->eflags &= ~IF_MASK; } env->eflags &= ~(TF_MASK | VM_MASK | RF_MASK | NT_MASK); }
false
qemu
8e682019e37c8f8939244fcf44a592fa6347d127
static void do_interrupt_protected(int intno, int is_int, int error_code, unsigned int next_eip, int is_hw) { SegmentCache *dt; uint8_t *ptr, *ssp; int type, dpl, selector, ss_dpl, cpl, sp_mask; int has_error_code, new_stack, shift; uint32_t e1, e2, offset, ss, esp, ss_e1, ss_e2; uint32_t old_eip; has_error_code = 0; if (!is_int && !is_hw) { switch(intno) { case 8: case 10: case 11: case 12: case 13: case 14: case 17: has_error_code = 1; break; } } dt = &env->idt; if (intno * 8 + 7 > dt->limit) raise_exception_err(EXCP0D_GPF, intno * 8 + 2); ptr = dt->base + intno * 8; e1 = ldl_kernel(ptr); e2 = ldl_kernel(ptr + 4); type = (e2 >> DESC_TYPE_SHIFT) & 0x1f; switch(type) { case 5: if (!(e2 & DESC_P_MASK)) raise_exception_err(EXCP0B_NOSEG, intno * 8 + 2); switch_tss(intno * 8, e1, e2, SWITCH_TSS_CALL); if (has_error_code) { int mask; shift = (env->segs[R_CS].flags >> DESC_B_SHIFT) & 1; if (env->segs[R_SS].flags & DESC_B_MASK) mask = 0xffffffff; else mask = 0xffff; esp = (env->regs[R_ESP] - (2 << shift)) & mask; ssp = env->segs[R_SS].base + esp; if (shift) stl_kernel(ssp, error_code); else stw_kernel(ssp, error_code); env->regs[R_ESP] = (esp & mask) | (env->regs[R_ESP] & ~mask); } return; case 6: case 7: case 14: case 15: break; default: raise_exception_err(EXCP0D_GPF, intno * 8 + 2); break; } dpl = (e2 >> DESC_DPL_SHIFT) & 3; cpl = env->hflags & HF_CPL_MASK; if (is_int && dpl < cpl) raise_exception_err(EXCP0D_GPF, intno * 8 + 2); if (!(e2 & DESC_P_MASK)) raise_exception_err(EXCP0B_NOSEG, intno * 8 + 2); selector = e1 >> 16; offset = (e2 & 0xffff0000) | (e1 & 0x0000ffff); if ((selector & 0xfffc) == 0) raise_exception_err(EXCP0D_GPF, 0); if (load_segment(&e1, &e2, selector) != 0) raise_exception_err(EXCP0D_GPF, selector & 0xfffc); if (!(e2 & DESC_S_MASK) || !(e2 & (DESC_CS_MASK))) raise_exception_err(EXCP0D_GPF, selector & 0xfffc); dpl = (e2 >> DESC_DPL_SHIFT) & 3; if (dpl > cpl) raise_exception_err(EXCP0D_GPF, selector & 0xfffc); if (!(e2 & DESC_P_MASK)) raise_exception_err(EXCP0B_NOSEG, selector & 0xfffc); if (!(e2 & DESC_C_MASK) && dpl < cpl) { get_ss_esp_from_tss(&ss, &esp, dpl); if ((ss & 0xfffc) == 0) raise_exception_err(EXCP0A_TSS, ss & 0xfffc); if ((ss & 3) != dpl) raise_exception_err(EXCP0A_TSS, ss & 0xfffc); if (load_segment(&ss_e1, &ss_e2, ss) != 0) raise_exception_err(EXCP0A_TSS, ss & 0xfffc); ss_dpl = (ss_e2 >> DESC_DPL_SHIFT) & 3; if (ss_dpl != dpl) raise_exception_err(EXCP0A_TSS, ss & 0xfffc); if (!(ss_e2 & DESC_S_MASK) || (ss_e2 & DESC_CS_MASK) || !(ss_e2 & DESC_W_MASK)) raise_exception_err(EXCP0A_TSS, ss & 0xfffc); if (!(ss_e2 & DESC_P_MASK)) raise_exception_err(EXCP0A_TSS, ss & 0xfffc); new_stack = 1; sp_mask = get_sp_mask(ss_e2); ssp = get_seg_base(ss_e1, ss_e2); } else if ((e2 & DESC_C_MASK) || dpl == cpl) { new_stack = 0; sp_mask = get_sp_mask(env->segs[R_SS].flags); ssp = env->segs[R_SS].base; esp = ESP; } else { raise_exception_err(EXCP0D_GPF, selector & 0xfffc); new_stack = 0; sp_mask = 0; ssp = NULL; esp = 0; } shift = type >> 3; #if 0 push_size = 6 + (new_stack << 2) + (has_error_code << 1); if (env->eflags & VM_MASK) push_size += 8; push_size <<= shift; #endif if (is_int) old_eip = next_eip; else old_eip = env->eip; if (shift == 1) { if (env->eflags & VM_MASK) { PUSHL(ssp, esp, sp_mask, env->segs[R_GS].selector); PUSHL(ssp, esp, sp_mask, env->segs[R_FS].selector); PUSHL(ssp, esp, sp_mask, env->segs[R_DS].selector); PUSHL(ssp, esp, sp_mask, env->segs[R_ES].selector); } if (new_stack) { PUSHL(ssp, esp, sp_mask, env->segs[R_SS].selector); PUSHL(ssp, esp, sp_mask, ESP); } PUSHL(ssp, esp, sp_mask, compute_eflags()); PUSHL(ssp, esp, sp_mask, env->segs[R_CS].selector); PUSHL(ssp, esp, sp_mask, old_eip); if (has_error_code) { PUSHL(ssp, esp, sp_mask, error_code); } } else { if (new_stack) { PUSHW(ssp, esp, sp_mask, env->segs[R_SS].selector); PUSHW(ssp, esp, sp_mask, ESP); } PUSHW(ssp, esp, sp_mask, compute_eflags()); PUSHW(ssp, esp, sp_mask, env->segs[R_CS].selector); PUSHW(ssp, esp, sp_mask, old_eip); if (has_error_code) { PUSHW(ssp, esp, sp_mask, error_code); } } if (new_stack) { ss = (ss & ~3) | dpl; cpu_x86_load_seg_cache(env, R_SS, ss, ssp, get_seg_limit(ss_e1, ss_e2), ss_e2); } ESP = (ESP & ~sp_mask) | (esp & sp_mask); selector = (selector & ~3) | dpl; cpu_x86_load_seg_cache(env, R_CS, selector, get_seg_base(e1, e2), get_seg_limit(e1, e2), e2); cpu_x86_set_cpl(env, dpl); env->eip = offset; if ((type & 1) == 0) { env->eflags &= ~IF_MASK; } env->eflags &= ~(TF_MASK | VM_MASK | RF_MASK | NT_MASK); }
{ "code": [], "line_no": [] }
static void FUNC_0(int VAR_0, int VAR_1, int VAR_2, unsigned int VAR_3, int VAR_4) { SegmentCache *dt; uint8_t *ptr, *ssp; int VAR_5, VAR_6, VAR_7, VAR_8, VAR_9, VAR_10; int VAR_11, VAR_12, VAR_13; uint32_t e1, e2, offset, ss, esp, ss_e1, ss_e2; uint32_t old_eip; VAR_11 = 0; if (!VAR_1 && !VAR_4) { switch(VAR_0) { case 8: case 10: case 11: case 12: case 13: case 14: case 17: VAR_11 = 1; break; } } dt = &env->idt; if (VAR_0 * 8 + 7 > dt->limit) raise_exception_err(EXCP0D_GPF, VAR_0 * 8 + 2); ptr = dt->base + VAR_0 * 8; e1 = ldl_kernel(ptr); e2 = ldl_kernel(ptr + 4); VAR_5 = (e2 >> DESC_TYPE_SHIFT) & 0x1f; switch(VAR_5) { case 5: if (!(e2 & DESC_P_MASK)) raise_exception_err(EXCP0B_NOSEG, VAR_0 * 8 + 2); switch_tss(VAR_0 * 8, e1, e2, SWITCH_TSS_CALL); if (VAR_11) { int VAR_14; VAR_13 = (env->segs[R_CS].flags >> DESC_B_SHIFT) & 1; if (env->segs[R_SS].flags & DESC_B_MASK) VAR_14 = 0xffffffff; else VAR_14 = 0xffff; esp = (env->regs[R_ESP] - (2 << VAR_13)) & VAR_14; ssp = env->segs[R_SS].base + esp; if (VAR_13) stl_kernel(ssp, VAR_2); else stw_kernel(ssp, VAR_2); env->regs[R_ESP] = (esp & VAR_14) | (env->regs[R_ESP] & ~VAR_14); } return; case 6: case 7: case 14: case 15: break; default: raise_exception_err(EXCP0D_GPF, VAR_0 * 8 + 2); break; } VAR_6 = (e2 >> DESC_DPL_SHIFT) & 3; VAR_9 = env->hflags & HF_CPL_MASK; if (VAR_1 && VAR_6 < VAR_9) raise_exception_err(EXCP0D_GPF, VAR_0 * 8 + 2); if (!(e2 & DESC_P_MASK)) raise_exception_err(EXCP0B_NOSEG, VAR_0 * 8 + 2); VAR_7 = e1 >> 16; offset = (e2 & 0xffff0000) | (e1 & 0x0000ffff); if ((VAR_7 & 0xfffc) == 0) raise_exception_err(EXCP0D_GPF, 0); if (load_segment(&e1, &e2, VAR_7) != 0) raise_exception_err(EXCP0D_GPF, VAR_7 & 0xfffc); if (!(e2 & DESC_S_MASK) || !(e2 & (DESC_CS_MASK))) raise_exception_err(EXCP0D_GPF, VAR_7 & 0xfffc); VAR_6 = (e2 >> DESC_DPL_SHIFT) & 3; if (VAR_6 > VAR_9) raise_exception_err(EXCP0D_GPF, VAR_7 & 0xfffc); if (!(e2 & DESC_P_MASK)) raise_exception_err(EXCP0B_NOSEG, VAR_7 & 0xfffc); if (!(e2 & DESC_C_MASK) && VAR_6 < VAR_9) { get_ss_esp_from_tss(&ss, &esp, VAR_6); if ((ss & 0xfffc) == 0) raise_exception_err(EXCP0A_TSS, ss & 0xfffc); if ((ss & 3) != VAR_6) raise_exception_err(EXCP0A_TSS, ss & 0xfffc); if (load_segment(&ss_e1, &ss_e2, ss) != 0) raise_exception_err(EXCP0A_TSS, ss & 0xfffc); VAR_8 = (ss_e2 >> DESC_DPL_SHIFT) & 3; if (VAR_8 != VAR_6) raise_exception_err(EXCP0A_TSS, ss & 0xfffc); if (!(ss_e2 & DESC_S_MASK) || (ss_e2 & DESC_CS_MASK) || !(ss_e2 & DESC_W_MASK)) raise_exception_err(EXCP0A_TSS, ss & 0xfffc); if (!(ss_e2 & DESC_P_MASK)) raise_exception_err(EXCP0A_TSS, ss & 0xfffc); VAR_12 = 1; VAR_10 = get_sp_mask(ss_e2); ssp = get_seg_base(ss_e1, ss_e2); } else if ((e2 & DESC_C_MASK) || VAR_6 == VAR_9) { VAR_12 = 0; VAR_10 = get_sp_mask(env->segs[R_SS].flags); ssp = env->segs[R_SS].base; esp = ESP; } else { raise_exception_err(EXCP0D_GPF, VAR_7 & 0xfffc); VAR_12 = 0; VAR_10 = 0; ssp = NULL; esp = 0; } VAR_13 = VAR_5 >> 3; #if 0 push_size = 6 + (VAR_12 << 2) + (VAR_11 << 1); if (env->eflags & VM_MASK) push_size += 8; push_size <<= VAR_13; #endif if (VAR_1) old_eip = VAR_3; else old_eip = env->eip; if (VAR_13 == 1) { if (env->eflags & VM_MASK) { PUSHL(ssp, esp, VAR_10, env->segs[R_GS].VAR_7); PUSHL(ssp, esp, VAR_10, env->segs[R_FS].VAR_7); PUSHL(ssp, esp, VAR_10, env->segs[R_DS].VAR_7); PUSHL(ssp, esp, VAR_10, env->segs[R_ES].VAR_7); } if (VAR_12) { PUSHL(ssp, esp, VAR_10, env->segs[R_SS].VAR_7); PUSHL(ssp, esp, VAR_10, ESP); } PUSHL(ssp, esp, VAR_10, compute_eflags()); PUSHL(ssp, esp, VAR_10, env->segs[R_CS].VAR_7); PUSHL(ssp, esp, VAR_10, old_eip); if (VAR_11) { PUSHL(ssp, esp, VAR_10, VAR_2); } } else { if (VAR_12) { PUSHW(ssp, esp, VAR_10, env->segs[R_SS].VAR_7); PUSHW(ssp, esp, VAR_10, ESP); } PUSHW(ssp, esp, VAR_10, compute_eflags()); PUSHW(ssp, esp, VAR_10, env->segs[R_CS].VAR_7); PUSHW(ssp, esp, VAR_10, old_eip); if (VAR_11) { PUSHW(ssp, esp, VAR_10, VAR_2); } } if (VAR_12) { ss = (ss & ~3) | VAR_6; cpu_x86_load_seg_cache(env, R_SS, ss, ssp, get_seg_limit(ss_e1, ss_e2), ss_e2); } ESP = (ESP & ~VAR_10) | (esp & VAR_10); VAR_7 = (VAR_7 & ~3) | VAR_6; cpu_x86_load_seg_cache(env, R_CS, VAR_7, get_seg_base(e1, e2), get_seg_limit(e1, e2), e2); cpu_x86_set_cpl(env, VAR_6); env->eip = offset; if ((VAR_5 & 1) == 0) { env->eflags &= ~IF_MASK; } env->eflags &= ~(TF_MASK | VM_MASK | RF_MASK | NT_MASK); }
[ "static void FUNC_0(int VAR_0, int VAR_1, int VAR_2,\nunsigned int VAR_3, int VAR_4)\n{", "SegmentCache *dt;", "uint8_t *ptr, *ssp;", "int VAR_5, VAR_6, VAR_7, VAR_8, VAR_9, VAR_10;", "int VAR_11, VAR_12, VAR_13;", "uint32_t e1, e2, offset, ss, esp, ss_e1, ss_e2;", "uint32_t old_eip;", "VAR_11 = 0;", "if (!VAR_1 && !VAR_4) {", "switch(VAR_0) {", "case 8:\ncase 10:\ncase 11:\ncase 12:\ncase 13:\ncase 14:\ncase 17:\nVAR_11 = 1;", "break;", "}", "}", "dt = &env->idt;", "if (VAR_0 * 8 + 7 > dt->limit)\nraise_exception_err(EXCP0D_GPF, VAR_0 * 8 + 2);", "ptr = dt->base + VAR_0 * 8;", "e1 = ldl_kernel(ptr);", "e2 = ldl_kernel(ptr + 4);", "VAR_5 = (e2 >> DESC_TYPE_SHIFT) & 0x1f;", "switch(VAR_5) {", "case 5:\nif (!(e2 & DESC_P_MASK))\nraise_exception_err(EXCP0B_NOSEG, VAR_0 * 8 + 2);", "switch_tss(VAR_0 * 8, e1, e2, SWITCH_TSS_CALL);", "if (VAR_11) {", "int VAR_14;", "VAR_13 = (env->segs[R_CS].flags >> DESC_B_SHIFT) & 1;", "if (env->segs[R_SS].flags & DESC_B_MASK)\nVAR_14 = 0xffffffff;", "else\nVAR_14 = 0xffff;", "esp = (env->regs[R_ESP] - (2 << VAR_13)) & VAR_14;", "ssp = env->segs[R_SS].base + esp;", "if (VAR_13)\nstl_kernel(ssp, VAR_2);", "else\nstw_kernel(ssp, VAR_2);", "env->regs[R_ESP] = (esp & VAR_14) | (env->regs[R_ESP] & ~VAR_14);", "}", "return;", "case 6:\ncase 7:\ncase 14:\ncase 15:\nbreak;", "default:\nraise_exception_err(EXCP0D_GPF, VAR_0 * 8 + 2);", "break;", "}", "VAR_6 = (e2 >> DESC_DPL_SHIFT) & 3;", "VAR_9 = env->hflags & HF_CPL_MASK;", "if (VAR_1 && VAR_6 < VAR_9)\nraise_exception_err(EXCP0D_GPF, VAR_0 * 8 + 2);", "if (!(e2 & DESC_P_MASK))\nraise_exception_err(EXCP0B_NOSEG, VAR_0 * 8 + 2);", "VAR_7 = e1 >> 16;", "offset = (e2 & 0xffff0000) | (e1 & 0x0000ffff);", "if ((VAR_7 & 0xfffc) == 0)\nraise_exception_err(EXCP0D_GPF, 0);", "if (load_segment(&e1, &e2, VAR_7) != 0)\nraise_exception_err(EXCP0D_GPF, VAR_7 & 0xfffc);", "if (!(e2 & DESC_S_MASK) || !(e2 & (DESC_CS_MASK)))\nraise_exception_err(EXCP0D_GPF, VAR_7 & 0xfffc);", "VAR_6 = (e2 >> DESC_DPL_SHIFT) & 3;", "if (VAR_6 > VAR_9)\nraise_exception_err(EXCP0D_GPF, VAR_7 & 0xfffc);", "if (!(e2 & DESC_P_MASK))\nraise_exception_err(EXCP0B_NOSEG, VAR_7 & 0xfffc);", "if (!(e2 & DESC_C_MASK) && VAR_6 < VAR_9) {", "get_ss_esp_from_tss(&ss, &esp, VAR_6);", "if ((ss & 0xfffc) == 0)\nraise_exception_err(EXCP0A_TSS, ss & 0xfffc);", "if ((ss & 3) != VAR_6)\nraise_exception_err(EXCP0A_TSS, ss & 0xfffc);", "if (load_segment(&ss_e1, &ss_e2, ss) != 0)\nraise_exception_err(EXCP0A_TSS, ss & 0xfffc);", "VAR_8 = (ss_e2 >> DESC_DPL_SHIFT) & 3;", "if (VAR_8 != VAR_6)\nraise_exception_err(EXCP0A_TSS, ss & 0xfffc);", "if (!(ss_e2 & DESC_S_MASK) ||\n(ss_e2 & DESC_CS_MASK) ||\n!(ss_e2 & DESC_W_MASK))\nraise_exception_err(EXCP0A_TSS, ss & 0xfffc);", "if (!(ss_e2 & DESC_P_MASK))\nraise_exception_err(EXCP0A_TSS, ss & 0xfffc);", "VAR_12 = 1;", "VAR_10 = get_sp_mask(ss_e2);", "ssp = get_seg_base(ss_e1, ss_e2);", "} else if ((e2 & DESC_C_MASK) || VAR_6 == VAR_9) {", "VAR_12 = 0;", "VAR_10 = get_sp_mask(env->segs[R_SS].flags);", "ssp = env->segs[R_SS].base;", "esp = ESP;", "} else {", "raise_exception_err(EXCP0D_GPF, VAR_7 & 0xfffc);", "VAR_12 = 0;", "VAR_10 = 0;", "ssp = NULL;", "esp = 0;", "}", "VAR_13 = VAR_5 >> 3;", "#if 0\npush_size = 6 + (VAR_12 << 2) + (VAR_11 << 1);", "if (env->eflags & VM_MASK)\npush_size += 8;", "push_size <<= VAR_13;", "#endif\nif (VAR_1)\nold_eip = VAR_3;", "else\nold_eip = env->eip;", "if (VAR_13 == 1) {", "if (env->eflags & VM_MASK) {", "PUSHL(ssp, esp, VAR_10, env->segs[R_GS].VAR_7);", "PUSHL(ssp, esp, VAR_10, env->segs[R_FS].VAR_7);", "PUSHL(ssp, esp, VAR_10, env->segs[R_DS].VAR_7);", "PUSHL(ssp, esp, VAR_10, env->segs[R_ES].VAR_7);", "}", "if (VAR_12) {", "PUSHL(ssp, esp, VAR_10, env->segs[R_SS].VAR_7);", "PUSHL(ssp, esp, VAR_10, ESP);", "}", "PUSHL(ssp, esp, VAR_10, compute_eflags());", "PUSHL(ssp, esp, VAR_10, env->segs[R_CS].VAR_7);", "PUSHL(ssp, esp, VAR_10, old_eip);", "if (VAR_11) {", "PUSHL(ssp, esp, VAR_10, VAR_2);", "}", "} else {", "if (VAR_12) {", "PUSHW(ssp, esp, VAR_10, env->segs[R_SS].VAR_7);", "PUSHW(ssp, esp, VAR_10, ESP);", "}", "PUSHW(ssp, esp, VAR_10, compute_eflags());", "PUSHW(ssp, esp, VAR_10, env->segs[R_CS].VAR_7);", "PUSHW(ssp, esp, VAR_10, old_eip);", "if (VAR_11) {", "PUSHW(ssp, esp, VAR_10, VAR_2);", "}", "}", "if (VAR_12) {", "ss = (ss & ~3) | VAR_6;", "cpu_x86_load_seg_cache(env, R_SS, ss,\nssp, get_seg_limit(ss_e1, ss_e2), ss_e2);", "}", "ESP = (ESP & ~VAR_10) | (esp & VAR_10);", "VAR_7 = (VAR_7 & ~3) | VAR_6;", "cpu_x86_load_seg_cache(env, R_CS, VAR_7,\nget_seg_base(e1, e2),\nget_seg_limit(e1, e2),\ne2);", "cpu_x86_set_cpl(env, VAR_6);", "env->eip = offset;", "if ((VAR_5 & 1) == 0) {", "env->eflags &= ~IF_MASK;", "}", "env->eflags &= ~(TF_MASK | VM_MASK | RF_MASK | NT_MASK);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 35, 37, 39, 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53, 55 ], [ 57 ], [ 59 ], [ 61 ], [ 65 ], [ 67 ], [ 69, 73, 75 ], [ 77 ], [ 79 ], [ 81 ], [ 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 ], [ 137, 139 ], [ 143, 145 ], [ 147 ], [ 149 ], [ 151, 153 ], [ 157, 159 ], [ 161, 163 ], [ 165 ], [ 167, 169 ], [ 171, 173 ], [ 175 ], [ 179 ], [ 181, 183 ], [ 185, 187 ], [ 189, 191 ], [ 193 ], [ 195, 197 ], [ 199, 201, 203, 205 ], [ 207, 209 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 221 ], [ 223 ], [ 225 ], [ 227 ], [ 229 ], [ 231 ], [ 233 ], [ 235 ], [ 237 ], [ 239 ], [ 241 ], [ 245 ], [ 249, 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 ], [ 331 ], [ 333 ], [ 335, 337 ], [ 339 ], [ 341 ], [ 345 ], [ 347, 349, 351, 353 ], [ 355 ], [ 357 ], [ 363 ], [ 365 ], [ 367 ], [ 369 ], [ 371 ] ]
15,536
static int v9fs_synth_remove(FsContext *ctx, const char *path) { errno = EPERM; return -1; }
false
qemu
364031f17932814484657e5551ba12957d993d7e
static int v9fs_synth_remove(FsContext *ctx, const char *path) { errno = EPERM; return -1; }
{ "code": [], "line_no": [] }
static int FUNC_0(FsContext *VAR_0, const char *VAR_1) { errno = EPERM; return -1; }
[ "static int FUNC_0(FsContext *VAR_0, const char *VAR_1)\n{", "errno = EPERM;", "return -1;", "}" ]
[ 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ] ]
15,538
static void dec_b(DisasContext *dc) { if (dc->r0 == R_RA) { LOG_DIS("ret\n"); } else if (dc->r0 == R_EA) { LOG_DIS("eret\n"); } else if (dc->r0 == R_BA) { LOG_DIS("bret\n"); } else { LOG_DIS("b r%d\n", dc->r0); } /* restore IE.IE in case of an eret */ if (dc->r0 == R_EA) { TCGv t0 = tcg_temp_new(); int l1 = gen_new_label(); tcg_gen_andi_tl(t0, cpu_ie, IE_EIE); tcg_gen_ori_tl(cpu_ie, cpu_ie, IE_IE); tcg_gen_brcondi_tl(TCG_COND_EQ, t0, IE_EIE, l1); tcg_gen_andi_tl(cpu_ie, cpu_ie, ~IE_IE); gen_set_label(l1); tcg_temp_free(t0); } else if (dc->r0 == R_BA) { TCGv t0 = tcg_temp_new(); int l1 = gen_new_label(); tcg_gen_andi_tl(t0, cpu_ie, IE_BIE); tcg_gen_ori_tl(cpu_ie, cpu_ie, IE_IE); tcg_gen_brcondi_tl(TCG_COND_EQ, t0, IE_BIE, l1); tcg_gen_andi_tl(cpu_ie, cpu_ie, ~IE_IE); gen_set_label(l1); tcg_temp_free(t0); } tcg_gen_mov_tl(cpu_pc, cpu_R[dc->r0]); dc->is_jmp = DISAS_JUMP; }
false
qemu
42a268c241183877192c376d03bd9b6d527407c7
static void dec_b(DisasContext *dc) { if (dc->r0 == R_RA) { LOG_DIS("ret\n"); } else if (dc->r0 == R_EA) { LOG_DIS("eret\n"); } else if (dc->r0 == R_BA) { LOG_DIS("bret\n"); } else { LOG_DIS("b r%d\n", dc->r0); } if (dc->r0 == R_EA) { TCGv t0 = tcg_temp_new(); int l1 = gen_new_label(); tcg_gen_andi_tl(t0, cpu_ie, IE_EIE); tcg_gen_ori_tl(cpu_ie, cpu_ie, IE_IE); tcg_gen_brcondi_tl(TCG_COND_EQ, t0, IE_EIE, l1); tcg_gen_andi_tl(cpu_ie, cpu_ie, ~IE_IE); gen_set_label(l1); tcg_temp_free(t0); } else if (dc->r0 == R_BA) { TCGv t0 = tcg_temp_new(); int l1 = gen_new_label(); tcg_gen_andi_tl(t0, cpu_ie, IE_BIE); tcg_gen_ori_tl(cpu_ie, cpu_ie, IE_IE); tcg_gen_brcondi_tl(TCG_COND_EQ, t0, IE_BIE, l1); tcg_gen_andi_tl(cpu_ie, cpu_ie, ~IE_IE); gen_set_label(l1); tcg_temp_free(t0); } tcg_gen_mov_tl(cpu_pc, cpu_R[dc->r0]); dc->is_jmp = DISAS_JUMP; }
{ "code": [], "line_no": [] }
static void FUNC_0(DisasContext *VAR_0) { if (VAR_0->r0 == R_RA) { LOG_DIS("ret\n"); } else if (VAR_0->r0 == R_EA) { LOG_DIS("eret\n"); } else if (VAR_0->r0 == R_BA) { LOG_DIS("bret\n"); } else { LOG_DIS("b r%d\n", VAR_0->r0); } if (VAR_0->r0 == R_EA) { TCGv t0 = tcg_temp_new(); int VAR_2 = gen_new_label(); tcg_gen_andi_tl(t0, cpu_ie, IE_EIE); tcg_gen_ori_tl(cpu_ie, cpu_ie, IE_IE); tcg_gen_brcondi_tl(TCG_COND_EQ, t0, IE_EIE, VAR_2); tcg_gen_andi_tl(cpu_ie, cpu_ie, ~IE_IE); gen_set_label(VAR_2); tcg_temp_free(t0); } else if (VAR_0->r0 == R_BA) { TCGv t0 = tcg_temp_new(); int VAR_2 = gen_new_label(); tcg_gen_andi_tl(t0, cpu_ie, IE_BIE); tcg_gen_ori_tl(cpu_ie, cpu_ie, IE_IE); tcg_gen_brcondi_tl(TCG_COND_EQ, t0, IE_BIE, VAR_2); tcg_gen_andi_tl(cpu_ie, cpu_ie, ~IE_IE); gen_set_label(VAR_2); tcg_temp_free(t0); } tcg_gen_mov_tl(cpu_pc, cpu_R[VAR_0->r0]); VAR_0->is_jmp = DISAS_JUMP; }
[ "static void FUNC_0(DisasContext *VAR_0)\n{", "if (VAR_0->r0 == R_RA) {", "LOG_DIS(\"ret\\n\");", "} else if (VAR_0->r0 == R_EA) {", "LOG_DIS(\"eret\\n\");", "} else if (VAR_0->r0 == R_BA) {", "LOG_DIS(\"bret\\n\");", "} else {", "LOG_DIS(\"b r%d\\n\", VAR_0->r0);", "}", "if (VAR_0->r0 == R_EA) {", "TCGv t0 = tcg_temp_new();", "int VAR_2 = gen_new_label();", "tcg_gen_andi_tl(t0, cpu_ie, IE_EIE);", "tcg_gen_ori_tl(cpu_ie, cpu_ie, IE_IE);", "tcg_gen_brcondi_tl(TCG_COND_EQ, t0, IE_EIE, VAR_2);", "tcg_gen_andi_tl(cpu_ie, cpu_ie, ~IE_IE);", "gen_set_label(VAR_2);", "tcg_temp_free(t0);", "} else if (VAR_0->r0 == R_BA) {", "TCGv t0 = tcg_temp_new();", "int VAR_2 = gen_new_label();", "tcg_gen_andi_tl(t0, cpu_ie, IE_BIE);", "tcg_gen_ori_tl(cpu_ie, cpu_ie, IE_IE);", "tcg_gen_brcondi_tl(TCG_COND_EQ, t0, IE_BIE, VAR_2);", "tcg_gen_andi_tl(cpu_ie, cpu_ie, ~IE_IE);", "gen_set_label(VAR_2);", "tcg_temp_free(t0);", "}", "tcg_gen_mov_tl(cpu_pc, cpu_R[VAR_0->r0]);", "VAR_0->is_jmp = DISAS_JUMP;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 69 ], [ 71 ] ]
15,539
static void query_facilities(void) { unsigned long hwcap = qemu_getauxval(AT_HWCAP); /* Is STORE FACILITY LIST EXTENDED available? Honestly, I believe this is present on all 64-bit systems, but let's check for it anyway. */ if (hwcap & HWCAP_S390_STFLE) { register int r0 __asm__("0"); register void *r1 __asm__("1"); /* stfle 0(%r1) */ r1 = &facilities; asm volatile(".word 0xb2b0,0x1000" : "=r"(r0) : "0"(0), "r"(r1) : "memory", "cc"); } }
false
qemu
b2c98d9d392c87c9b9e975d30f79924719d9cbbe
static void query_facilities(void) { unsigned long hwcap = qemu_getauxval(AT_HWCAP); if (hwcap & HWCAP_S390_STFLE) { register int r0 __asm__("0"); register void *r1 __asm__("1"); r1 = &facilities; asm volatile(".word 0xb2b0,0x1000" : "=r"(r0) : "0"(0), "r"(r1) : "memory", "cc"); } }
{ "code": [], "line_no": [] }
static void FUNC_0(void) { unsigned long VAR_0 = qemu_getauxval(AT_HWCAP); if (VAR_0 & HWCAP_S390_STFLE) { register int VAR_1 __asm__("0"); register void *VAR_2 __asm__("1"); VAR_2 = &facilities; asm volatile(".word 0xb2b0,0x1000" : "=r"(VAR_1) : "0"(0), "r"(VAR_2) : "memory", "cc"); } }
[ "static void FUNC_0(void)\n{", "unsigned long VAR_0 = qemu_getauxval(AT_HWCAP);", "if (VAR_0 & HWCAP_S390_STFLE) {", "register int VAR_1 __asm__(\"0\");", "register void *VAR_2 __asm__(\"1\");", "VAR_2 = &facilities;", "asm volatile(\".word 0xb2b0,0x1000\"\n: \"=r\"(VAR_1) : \"0\"(0), \"r\"(VAR_2) : \"memory\", \"cc\");", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 13 ], [ 15 ], [ 17 ], [ 23 ], [ 25, 27 ], [ 29 ], [ 31 ] ]
15,540
static void setup_rt_frame(int sig, struct target_sigaction *ka, target_siginfo_t *info, target_sigset_t *set, CPUOpenRISCState *env) { int err = 0; abi_ulong frame_addr; unsigned long return_ip; struct target_rt_sigframe *frame; abi_ulong info_addr, uc_addr; frame_addr = get_sigframe(ka, env, sizeof(*frame)); if (!lock_user_struct(VERIFY_WRITE, frame, frame_addr, 0)) { goto give_sigsegv; } info_addr = frame_addr + offsetof(struct target_rt_sigframe, info); __put_user(info_addr, &frame->pinfo); uc_addr = frame_addr + offsetof(struct target_rt_sigframe, uc); __put_user(uc_addr, &frame->puc); if (ka->sa_flags & SA_SIGINFO) { copy_siginfo_to_user(&frame->info, info); } /*err |= __clear_user(&frame->uc, offsetof(struct ucontext, uc_mcontext));*/ __put_user(0, &frame->uc.tuc_flags); __put_user(0, &frame->uc.tuc_link); __put_user(target_sigaltstack_used.ss_sp, &frame->uc.tuc_stack.ss_sp); __put_user(sas_ss_flags(env->gpr[1]), &frame->uc.tuc_stack.ss_flags); __put_user(target_sigaltstack_used.ss_size, &frame->uc.tuc_stack.ss_size); err |= setup_sigcontext(&frame->sc, env, set->sig[0]); /*err |= copy_to_user(frame->uc.tuc_sigmask, set, sizeof(*set));*/ if (err) { goto give_sigsegv; } /* trampoline - the desired return ip is the retcode itself */ return_ip = (unsigned long)&frame->retcode; /* This is l.ori r11,r0,__NR_sigreturn, l.sys 1 */ __put_user(0xa960, (short *)(frame->retcode + 0)); __put_user(TARGET_NR_rt_sigreturn, (short *)(frame->retcode + 2)); __put_user(0x20000001, (unsigned long *)(frame->retcode + 4)); __put_user(0x15000000, (unsigned long *)(frame->retcode + 8)); if (err) { goto give_sigsegv; } /* TODO what is the current->exec_domain stuff and invmap ? */ /* Set up registers for signal handler */ env->pc = (unsigned long)ka->_sa_handler; /* what we enter NOW */ env->gpr[9] = (unsigned long)return_ip; /* what we enter LATER */ env->gpr[3] = (unsigned long)sig; /* arg 1: signo */ env->gpr[4] = (unsigned long)&frame->info; /* arg 2: (siginfo_t*) */ env->gpr[5] = (unsigned long)&frame->uc; /* arg 3: ucontext */ /* actually move the usp to reflect the stacked frame */ env->gpr[1] = (unsigned long)frame; return; give_sigsegv: unlock_user_struct(frame, frame_addr, 1); if (sig == TARGET_SIGSEGV) { ka->_sa_handler = TARGET_SIG_DFL; } force_sig(TARGET_SIGSEGV); }
false
qemu
41ecc72ba5932381208e151bf2d2149a0342beff
static void setup_rt_frame(int sig, struct target_sigaction *ka, target_siginfo_t *info, target_sigset_t *set, CPUOpenRISCState *env) { int err = 0; abi_ulong frame_addr; unsigned long return_ip; struct target_rt_sigframe *frame; abi_ulong info_addr, uc_addr; frame_addr = get_sigframe(ka, env, sizeof(*frame)); if (!lock_user_struct(VERIFY_WRITE, frame, frame_addr, 0)) { goto give_sigsegv; } info_addr = frame_addr + offsetof(struct target_rt_sigframe, info); __put_user(info_addr, &frame->pinfo); uc_addr = frame_addr + offsetof(struct target_rt_sigframe, uc); __put_user(uc_addr, &frame->puc); if (ka->sa_flags & SA_SIGINFO) { copy_siginfo_to_user(&frame->info, info); } __put_user(0, &frame->uc.tuc_flags); __put_user(0, &frame->uc.tuc_link); __put_user(target_sigaltstack_used.ss_sp, &frame->uc.tuc_stack.ss_sp); __put_user(sas_ss_flags(env->gpr[1]), &frame->uc.tuc_stack.ss_flags); __put_user(target_sigaltstack_used.ss_size, &frame->uc.tuc_stack.ss_size); err |= setup_sigcontext(&frame->sc, env, set->sig[0]); if (err) { goto give_sigsegv; } return_ip = (unsigned long)&frame->retcode; __put_user(0xa960, (short *)(frame->retcode + 0)); __put_user(TARGET_NR_rt_sigreturn, (short *)(frame->retcode + 2)); __put_user(0x20000001, (unsigned long *)(frame->retcode + 4)); __put_user(0x15000000, (unsigned long *)(frame->retcode + 8)); if (err) { goto give_sigsegv; } env->pc = (unsigned long)ka->_sa_handler; env->gpr[9] = (unsigned long)return_ip; env->gpr[3] = (unsigned long)sig; env->gpr[4] = (unsigned long)&frame->info; env->gpr[5] = (unsigned long)&frame->uc; env->gpr[1] = (unsigned long)frame; return; give_sigsegv: unlock_user_struct(frame, frame_addr, 1); if (sig == TARGET_SIGSEGV) { ka->_sa_handler = TARGET_SIG_DFL; } force_sig(TARGET_SIGSEGV); }
{ "code": [], "line_no": [] }
static void FUNC_0(int VAR_0, struct target_sigaction *VAR_1, target_siginfo_t *VAR_2, target_sigset_t *VAR_3, CPUOpenRISCState *VAR_4) { int VAR_5 = 0; abi_ulong frame_addr; unsigned long VAR_6; struct target_rt_sigframe *VAR_7; abi_ulong info_addr, uc_addr; frame_addr = get_sigframe(VAR_1, VAR_4, sizeof(*VAR_7)); if (!lock_user_struct(VERIFY_WRITE, VAR_7, frame_addr, 0)) { goto give_sigsegv; } info_addr = frame_addr + offsetof(struct target_rt_sigframe, VAR_2); __put_user(info_addr, &VAR_7->pinfo); uc_addr = frame_addr + offsetof(struct target_rt_sigframe, uc); __put_user(uc_addr, &VAR_7->puc); if (VAR_1->sa_flags & SA_SIGINFO) { copy_siginfo_to_user(&VAR_7->VAR_2, VAR_2); } __put_user(0, &VAR_7->uc.tuc_flags); __put_user(0, &VAR_7->uc.tuc_link); __put_user(target_sigaltstack_used.ss_sp, &VAR_7->uc.tuc_stack.ss_sp); __put_user(sas_ss_flags(VAR_4->gpr[1]), &VAR_7->uc.tuc_stack.ss_flags); __put_user(target_sigaltstack_used.ss_size, &VAR_7->uc.tuc_stack.ss_size); VAR_5 |= setup_sigcontext(&VAR_7->sc, VAR_4, VAR_3->VAR_0[0]); if (VAR_5) { goto give_sigsegv; } VAR_6 = (unsigned long)&VAR_7->retcode; __put_user(0xa960, (short *)(VAR_7->retcode + 0)); __put_user(TARGET_NR_rt_sigreturn, (short *)(VAR_7->retcode + 2)); __put_user(0x20000001, (unsigned long *)(VAR_7->retcode + 4)); __put_user(0x15000000, (unsigned long *)(VAR_7->retcode + 8)); if (VAR_5) { goto give_sigsegv; } VAR_4->pc = (unsigned long)VAR_1->_sa_handler; VAR_4->gpr[9] = (unsigned long)VAR_6; VAR_4->gpr[3] = (unsigned long)VAR_0; VAR_4->gpr[4] = (unsigned long)&VAR_7->VAR_2; VAR_4->gpr[5] = (unsigned long)&VAR_7->uc; VAR_4->gpr[1] = (unsigned long)VAR_7; return; give_sigsegv: unlock_user_struct(VAR_7, frame_addr, 1); if (VAR_0 == TARGET_SIGSEGV) { VAR_1->_sa_handler = TARGET_SIG_DFL; } force_sig(TARGET_SIGSEGV); }
[ "static void FUNC_0(int VAR_0, struct target_sigaction *VAR_1,\ntarget_siginfo_t *VAR_2,\ntarget_sigset_t *VAR_3, CPUOpenRISCState *VAR_4)\n{", "int VAR_5 = 0;", "abi_ulong frame_addr;", "unsigned long VAR_6;", "struct target_rt_sigframe *VAR_7;", "abi_ulong info_addr, uc_addr;", "frame_addr = get_sigframe(VAR_1, VAR_4, sizeof(*VAR_7));", "if (!lock_user_struct(VERIFY_WRITE, VAR_7, frame_addr, 0)) {", "goto give_sigsegv;", "}", "info_addr = frame_addr + offsetof(struct target_rt_sigframe, VAR_2);", "__put_user(info_addr, &VAR_7->pinfo);", "uc_addr = frame_addr + offsetof(struct target_rt_sigframe, uc);", "__put_user(uc_addr, &VAR_7->puc);", "if (VAR_1->sa_flags & SA_SIGINFO) {", "copy_siginfo_to_user(&VAR_7->VAR_2, VAR_2);", "}", "__put_user(0, &VAR_7->uc.tuc_flags);", "__put_user(0, &VAR_7->uc.tuc_link);", "__put_user(target_sigaltstack_used.ss_sp,\n&VAR_7->uc.tuc_stack.ss_sp);", "__put_user(sas_ss_flags(VAR_4->gpr[1]), &VAR_7->uc.tuc_stack.ss_flags);", "__put_user(target_sigaltstack_used.ss_size,\n&VAR_7->uc.tuc_stack.ss_size);", "VAR_5 |= setup_sigcontext(&VAR_7->sc, VAR_4, VAR_3->VAR_0[0]);", "if (VAR_5) {", "goto give_sigsegv;", "}", "VAR_6 = (unsigned long)&VAR_7->retcode;", "__put_user(0xa960, (short *)(VAR_7->retcode + 0));", "__put_user(TARGET_NR_rt_sigreturn, (short *)(VAR_7->retcode + 2));", "__put_user(0x20000001, (unsigned long *)(VAR_7->retcode + 4));", "__put_user(0x15000000, (unsigned long *)(VAR_7->retcode + 8));", "if (VAR_5) {", "goto give_sigsegv;", "}", "VAR_4->pc = (unsigned long)VAR_1->_sa_handler;", "VAR_4->gpr[9] = (unsigned long)VAR_6;", "VAR_4->gpr[3] = (unsigned long)VAR_0;", "VAR_4->gpr[4] = (unsigned long)&VAR_7->VAR_2;", "VAR_4->gpr[5] = (unsigned long)&VAR_7->uc;", "VAR_4->gpr[1] = (unsigned long)VAR_7;", "return;", "give_sigsegv:\nunlock_user_struct(VAR_7, frame_addr, 1);", "if (VAR_0 == TARGET_SIGSEGV) {", "VAR_1->_sa_handler = TARGET_SIG_DFL;", "}", "force_sig(TARGET_SIGSEGV);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 51 ], [ 53 ], [ 55, 57 ], [ 59 ], [ 61, 63 ], [ 65 ], [ 73 ], [ 75 ], [ 77 ], [ 83 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 97 ], [ 99 ], [ 101 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 125 ], [ 129 ], [ 133, 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ] ]
15,541
static void imx_enet_do_tx(IMXFECState *s) { int frame_size = 0; uint8_t frame[ENET_MAX_FRAME_SIZE]; uint8_t *ptr = frame; uint32_t addr = s->tx_descriptor; while (1) { IMXENETBufDesc bd; int len; imx_enet_read_bd(&bd, addr); FEC_PRINTF("tx_bd %x flags %04x len %d data %08x option %04x " "status %04x\n", addr, bd.flags, bd.length, bd.data, bd.option, bd.status); if ((bd.flags & ENET_BD_R) == 0) { /* Run out of descriptors to transmit. */ break; } len = bd.length; if (frame_size + len > ENET_MAX_FRAME_SIZE) { len = ENET_MAX_FRAME_SIZE - frame_size; s->regs[ENET_EIR] |= ENET_INT_BABT; } dma_memory_read(&address_space_memory, bd.data, ptr, len); ptr += len; frame_size += len; if (bd.flags & ENET_BD_L) { if (bd.option & ENET_BD_PINS) { struct ip_header *ip_hd = PKT_GET_IP_HDR(frame); if (IP_HEADER_VERSION(ip_hd) == 4) { net_checksum_calculate(frame, frame_size); } } if (bd.option & ENET_BD_IINS) { struct ip_header *ip_hd = PKT_GET_IP_HDR(frame); /* We compute checksum only for IPv4 frames */ if (IP_HEADER_VERSION(ip_hd) == 4) { uint16_t csum; ip_hd->ip_sum = 0; csum = net_raw_checksum((uint8_t *)ip_hd, sizeof(*ip_hd)); ip_hd->ip_sum = cpu_to_be16(csum); } } /* Last buffer in frame. */ qemu_send_packet(qemu_get_queue(s->nic), frame, len); ptr = frame; frame_size = 0; if (bd.option & ENET_BD_TX_INT) { s->regs[ENET_EIR] |= ENET_INT_TXF; } } if (bd.option & ENET_BD_TX_INT) { s->regs[ENET_EIR] |= ENET_INT_TXB; } bd.flags &= ~ENET_BD_R; /* Write back the modified descriptor. */ imx_enet_write_bd(&bd, addr); /* Advance to the next descriptor. */ if ((bd.flags & ENET_BD_W) != 0) { addr = s->regs[ENET_TDSR]; } else { addr += sizeof(bd); } } s->tx_descriptor = addr; imx_eth_update(s); }
false
qemu
81f17e0d435c3db3a3e67e0d32ebf9c98973211f
static void imx_enet_do_tx(IMXFECState *s) { int frame_size = 0; uint8_t frame[ENET_MAX_FRAME_SIZE]; uint8_t *ptr = frame; uint32_t addr = s->tx_descriptor; while (1) { IMXENETBufDesc bd; int len; imx_enet_read_bd(&bd, addr); FEC_PRINTF("tx_bd %x flags %04x len %d data %08x option %04x " "status %04x\n", addr, bd.flags, bd.length, bd.data, bd.option, bd.status); if ((bd.flags & ENET_BD_R) == 0) { break; } len = bd.length; if (frame_size + len > ENET_MAX_FRAME_SIZE) { len = ENET_MAX_FRAME_SIZE - frame_size; s->regs[ENET_EIR] |= ENET_INT_BABT; } dma_memory_read(&address_space_memory, bd.data, ptr, len); ptr += len; frame_size += len; if (bd.flags & ENET_BD_L) { if (bd.option & ENET_BD_PINS) { struct ip_header *ip_hd = PKT_GET_IP_HDR(frame); if (IP_HEADER_VERSION(ip_hd) == 4) { net_checksum_calculate(frame, frame_size); } } if (bd.option & ENET_BD_IINS) { struct ip_header *ip_hd = PKT_GET_IP_HDR(frame); if (IP_HEADER_VERSION(ip_hd) == 4) { uint16_t csum; ip_hd->ip_sum = 0; csum = net_raw_checksum((uint8_t *)ip_hd, sizeof(*ip_hd)); ip_hd->ip_sum = cpu_to_be16(csum); } } qemu_send_packet(qemu_get_queue(s->nic), frame, len); ptr = frame; frame_size = 0; if (bd.option & ENET_BD_TX_INT) { s->regs[ENET_EIR] |= ENET_INT_TXF; } } if (bd.option & ENET_BD_TX_INT) { s->regs[ENET_EIR] |= ENET_INT_TXB; } bd.flags &= ~ENET_BD_R; imx_enet_write_bd(&bd, addr); if ((bd.flags & ENET_BD_W) != 0) { addr = s->regs[ENET_TDSR]; } else { addr += sizeof(bd); } } s->tx_descriptor = addr; imx_eth_update(s); }
{ "code": [], "line_no": [] }
static void FUNC_0(IMXFECState *VAR_0) { int VAR_1 = 0; uint8_t frame[ENET_MAX_FRAME_SIZE]; uint8_t *ptr = frame; uint32_t addr = VAR_0->tx_descriptor; while (1) { IMXENETBufDesc bd; int VAR_2; imx_enet_read_bd(&bd, addr); FEC_PRINTF("tx_bd %x flags %04x VAR_2 %d data %08x option %04x " "status %04x\n", addr, bd.flags, bd.length, bd.data, bd.option, bd.status); if ((bd.flags & ENET_BD_R) == 0) { break; } VAR_2 = bd.length; if (VAR_1 + VAR_2 > ENET_MAX_FRAME_SIZE) { VAR_2 = ENET_MAX_FRAME_SIZE - VAR_1; VAR_0->regs[ENET_EIR] |= ENET_INT_BABT; } dma_memory_read(&address_space_memory, bd.data, ptr, VAR_2); ptr += VAR_2; VAR_1 += VAR_2; if (bd.flags & ENET_BD_L) { if (bd.option & ENET_BD_PINS) { struct ip_header *VAR_4 = PKT_GET_IP_HDR(frame); if (IP_HEADER_VERSION(VAR_4) == 4) { net_checksum_calculate(frame, VAR_1); } } if (bd.option & ENET_BD_IINS) { struct ip_header *VAR_4 = PKT_GET_IP_HDR(frame); if (IP_HEADER_VERSION(VAR_4) == 4) { uint16_t csum; VAR_4->ip_sum = 0; csum = net_raw_checksum((uint8_t *)VAR_4, sizeof(*VAR_4)); VAR_4->ip_sum = cpu_to_be16(csum); } } qemu_send_packet(qemu_get_queue(VAR_0->nic), frame, VAR_2); ptr = frame; VAR_1 = 0; if (bd.option & ENET_BD_TX_INT) { VAR_0->regs[ENET_EIR] |= ENET_INT_TXF; } } if (bd.option & ENET_BD_TX_INT) { VAR_0->regs[ENET_EIR] |= ENET_INT_TXB; } bd.flags &= ~ENET_BD_R; imx_enet_write_bd(&bd, addr); if ((bd.flags & ENET_BD_W) != 0) { addr = VAR_0->regs[ENET_TDSR]; } else { addr += sizeof(bd); } } VAR_0->tx_descriptor = addr; imx_eth_update(VAR_0); }
[ "static void FUNC_0(IMXFECState *VAR_0)\n{", "int VAR_1 = 0;", "uint8_t frame[ENET_MAX_FRAME_SIZE];", "uint8_t *ptr = frame;", "uint32_t addr = VAR_0->tx_descriptor;", "while (1) {", "IMXENETBufDesc bd;", "int VAR_2;", "imx_enet_read_bd(&bd, addr);", "FEC_PRINTF(\"tx_bd %x flags %04x VAR_2 %d data %08x option %04x \"\n\"status %04x\\n\", addr, bd.flags, bd.length, bd.data,\nbd.option, bd.status);", "if ((bd.flags & ENET_BD_R) == 0) {", "break;", "}", "VAR_2 = bd.length;", "if (VAR_1 + VAR_2 > ENET_MAX_FRAME_SIZE) {", "VAR_2 = ENET_MAX_FRAME_SIZE - VAR_1;", "VAR_0->regs[ENET_EIR] |= ENET_INT_BABT;", "}", "dma_memory_read(&address_space_memory, bd.data, ptr, VAR_2);", "ptr += VAR_2;", "VAR_1 += VAR_2;", "if (bd.flags & ENET_BD_L) {", "if (bd.option & ENET_BD_PINS) {", "struct ip_header *VAR_4 = PKT_GET_IP_HDR(frame);", "if (IP_HEADER_VERSION(VAR_4) == 4) {", "net_checksum_calculate(frame, VAR_1);", "}", "}", "if (bd.option & ENET_BD_IINS) {", "struct ip_header *VAR_4 = PKT_GET_IP_HDR(frame);", "if (IP_HEADER_VERSION(VAR_4) == 4) {", "uint16_t csum;", "VAR_4->ip_sum = 0;", "csum = net_raw_checksum((uint8_t *)VAR_4, sizeof(*VAR_4));", "VAR_4->ip_sum = cpu_to_be16(csum);", "}", "}", "qemu_send_packet(qemu_get_queue(VAR_0->nic), frame, VAR_2);", "ptr = frame;", "VAR_1 = 0;", "if (bd.option & ENET_BD_TX_INT) {", "VAR_0->regs[ENET_EIR] |= ENET_INT_TXF;", "}", "}", "if (bd.option & ENET_BD_TX_INT) {", "VAR_0->regs[ENET_EIR] |= ENET_INT_TXB;", "}", "bd.flags &= ~ENET_BD_R;", "imx_enet_write_bd(&bd, addr);", "if ((bd.flags & ENET_BD_W) != 0) {", "addr = VAR_0->regs[ENET_TDSR];", "} else {", "addr += sizeof(bd);", "}", "}", "VAR_0->tx_descriptor = addr;", "imx_eth_update(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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25, 27, 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 115 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 133 ], [ 137 ], [ 139 ] ]
15,542
static uint64_t ne2000_read(void *opaque, target_phys_addr_t addr, unsigned size) { NE2000State *s = opaque; if (addr < 0x10 && size == 1) { return ne2000_ioport_read(s, addr); } else if (addr == 0x10) { if (size <= 2) { return ne2000_asic_ioport_read(s, addr); } else { return ne2000_asic_ioport_readl(s, addr); } } else if (addr == 0x1f && size == 1) { return ne2000_reset_ioport_read(s, addr); } return ((uint64_t)1 << (size * 8)) - 1; }
false
qemu
a8170e5e97ad17ca169c64ba87ae2f53850dab4c
static uint64_t ne2000_read(void *opaque, target_phys_addr_t addr, unsigned size) { NE2000State *s = opaque; if (addr < 0x10 && size == 1) { return ne2000_ioport_read(s, addr); } else if (addr == 0x10) { if (size <= 2) { return ne2000_asic_ioport_read(s, addr); } else { return ne2000_asic_ioport_readl(s, addr); } } else if (addr == 0x1f && size == 1) { return ne2000_reset_ioport_read(s, addr); } return ((uint64_t)1 << (size * 8)) - 1; }
{ "code": [], "line_no": [] }
static uint64_t FUNC_0(void *opaque, target_phys_addr_t addr, unsigned size) { NE2000State *s = opaque; if (addr < 0x10 && size == 1) { return ne2000_ioport_read(s, addr); } else if (addr == 0x10) { if (size <= 2) { return ne2000_asic_ioport_read(s, addr); } else { return ne2000_asic_ioport_readl(s, addr); } } else if (addr == 0x1f && size == 1) { return ne2000_reset_ioport_read(s, addr); } return ((uint64_t)1 << (size * 8)) - 1; }
[ "static uint64_t FUNC_0(void *opaque, target_phys_addr_t addr,\nunsigned size)\n{", "NE2000State *s = opaque;", "if (addr < 0x10 && size == 1) {", "return ne2000_ioport_read(s, addr);", "} else if (addr == 0x10) {", "if (size <= 2) {", "return ne2000_asic_ioport_read(s, addr);", "} else {", "return ne2000_asic_ioport_readl(s, addr);", "}", "} else if (addr == 0x1f && size == 1) {", "return ne2000_reset_ioport_read(s, addr);", "}", "return ((uint64_t)1 << (size * 8)) - 1;", "}" ]
[ 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 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ] ]
15,543
static const OptionDef *find_option(const OptionDef *po, const char *name) { const char *p = strchr(name, ':'); int len = p ? p - name : strlen(name); while (po->name != NULL) { if (!strncmp(name, po->name, len) && strlen(po->name) == len) break; po++; } return po; }
false
FFmpeg
4b1f5e5090abed6c618c8ba380cd7d28d140f867
static const OptionDef *find_option(const OptionDef *po, const char *name) { const char *p = strchr(name, ':'); int len = p ? p - name : strlen(name); while (po->name != NULL) { if (!strncmp(name, po->name, len) && strlen(po->name) == len) break; po++; } return po; }
{ "code": [], "line_no": [] }
static const OptionDef *FUNC_0(const OptionDef *po, const char *name) { const char *VAR_0 = strchr(name, ':'); int VAR_1 = VAR_0 ? VAR_0 - name : strlen(name); while (po->name != NULL) { if (!strncmp(name, po->name, VAR_1) && strlen(po->name) == VAR_1) break; po++; } return po; }
[ "static const OptionDef *FUNC_0(const OptionDef *po, const char *name)\n{", "const char *VAR_0 = strchr(name, ':');", "int VAR_1 = VAR_0 ? VAR_0 - name : strlen(name);", "while (po->name != NULL) {", "if (!strncmp(name, po->name, VAR_1) && strlen(po->name) == VAR_1)\nbreak;", "po++;", "}", "return po;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13, 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ] ]
15,544
uint32 float64_to_uint32( float64 a STATUS_PARAM ) { int64_t v; uint32 res; v = float64_to_int64(a STATUS_VAR); if (v < 0) { res = 0; float_raise( float_flag_invalid STATUS_VAR); } else if (v > 0xffffffff) { res = 0xffffffff; float_raise( float_flag_invalid STATUS_VAR); } else { res = v; } return res; }
false
qemu
8d551c988e96ac4cfe462e6b34d513bba2da572f
uint32 float64_to_uint32( float64 a STATUS_PARAM ) { int64_t v; uint32 res; v = float64_to_int64(a STATUS_VAR); if (v < 0) { res = 0; float_raise( float_flag_invalid STATUS_VAR); } else if (v > 0xffffffff) { res = 0xffffffff; float_raise( float_flag_invalid STATUS_VAR); } else { res = v; } return res; }
{ "code": [], "line_no": [] }
uint32 FUNC_0( float64 a STATUS_PARAM ) { int64_t v; uint32 res; v = float64_to_int64(a STATUS_VAR); if (v < 0) { res = 0; float_raise( float_flag_invalid STATUS_VAR); } else if (v > 0xffffffff) { res = 0xffffffff; float_raise( float_flag_invalid STATUS_VAR); } else { res = v; } return res; }
[ "uint32 FUNC_0( float64 a STATUS_PARAM )\n{", "int64_t v;", "uint32 res;", "v = float64_to_int64(a STATUS_VAR);", "if (v < 0) {", "res = 0;", "float_raise( float_flag_invalid STATUS_VAR);", "} else if (v > 0xffffffff) {", "res = 0xffffffff;", "float_raise( float_flag_invalid STATUS_VAR);", "} else {", "res = v;", "}", "return res;", "}" ]
[ 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 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ] ]
15,545
static void virtio_gpu_handle_cursor(VirtIODevice *vdev, VirtQueue *vq) { VirtIOGPU *g = VIRTIO_GPU(vdev); VirtQueueElement elem; size_t s; struct virtio_gpu_update_cursor cursor_info; if (!virtio_queue_ready(vq)) { return; } while (virtqueue_pop(vq, &elem)) { s = iov_to_buf(elem.out_sg, elem.out_num, 0, &cursor_info, sizeof(cursor_info)); if (s != sizeof(cursor_info)) { qemu_log_mask(LOG_GUEST_ERROR, "%s: cursor size incorrect %zu vs %zu\n", __func__, s, sizeof(cursor_info)); } else { update_cursor(g, &cursor_info); } virtqueue_push(vq, &elem, 0); virtio_notify(vdev, vq); } }
false
qemu
51b19ebe4320f3dcd93cea71235c1219318ddfd2
static void virtio_gpu_handle_cursor(VirtIODevice *vdev, VirtQueue *vq) { VirtIOGPU *g = VIRTIO_GPU(vdev); VirtQueueElement elem; size_t s; struct virtio_gpu_update_cursor cursor_info; if (!virtio_queue_ready(vq)) { return; } while (virtqueue_pop(vq, &elem)) { s = iov_to_buf(elem.out_sg, elem.out_num, 0, &cursor_info, sizeof(cursor_info)); if (s != sizeof(cursor_info)) { qemu_log_mask(LOG_GUEST_ERROR, "%s: cursor size incorrect %zu vs %zu\n", __func__, s, sizeof(cursor_info)); } else { update_cursor(g, &cursor_info); } virtqueue_push(vq, &elem, 0); virtio_notify(vdev, vq); } }
{ "code": [], "line_no": [] }
static void FUNC_0(VirtIODevice *VAR_0, VirtQueue *VAR_1) { VirtIOGPU *g = VIRTIO_GPU(VAR_0); VirtQueueElement elem; size_t s; struct virtio_gpu_update_cursor VAR_2; if (!virtio_queue_ready(VAR_1)) { return; } while (virtqueue_pop(VAR_1, &elem)) { s = iov_to_buf(elem.out_sg, elem.out_num, 0, &VAR_2, sizeof(VAR_2)); if (s != sizeof(VAR_2)) { qemu_log_mask(LOG_GUEST_ERROR, "%s: cursor size incorrect %zu vs %zu\n", __func__, s, sizeof(VAR_2)); } else { update_cursor(g, &VAR_2); } virtqueue_push(VAR_1, &elem, 0); virtio_notify(VAR_0, VAR_1); } }
[ "static void FUNC_0(VirtIODevice *VAR_0, VirtQueue *VAR_1)\n{", "VirtIOGPU *g = VIRTIO_GPU(VAR_0);", "VirtQueueElement elem;", "size_t s;", "struct virtio_gpu_update_cursor VAR_2;", "if (!virtio_queue_ready(VAR_1)) {", "return;", "}", "while (virtqueue_pop(VAR_1, &elem)) {", "s = iov_to_buf(elem.out_sg, elem.out_num, 0,\n&VAR_2, sizeof(VAR_2));", "if (s != sizeof(VAR_2)) {", "qemu_log_mask(LOG_GUEST_ERROR,\n\"%s: cursor size incorrect %zu vs %zu\\n\",\n__func__, s, sizeof(VAR_2));", "} else {", "update_cursor(g, &VAR_2);", "}", "virtqueue_push(VAR_1, &elem, 0);", "virtio_notify(VAR_0, VAR_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 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23, 25 ], [ 27 ], [ 29, 31, 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ] ]
15,546
static int iscsi_truncate(BlockDriverState *bs, int64_t offset) { IscsiLun *iscsilun = bs->opaque; Error *local_err = NULL; if (iscsilun->type != TYPE_DISK) { return -ENOTSUP; } iscsi_readcapacity_sync(iscsilun, &local_err); if (local_err != NULL) { error_free(local_err); return -EIO; } if (offset > iscsi_getlength(bs)) { return -EINVAL; } if (iscsilun->allocationmap != NULL) { g_free(iscsilun->allocationmap); iscsilun->allocationmap = iscsi_allocationmap_init(iscsilun); } return 0; }
false
qemu
e1123a3b40a1a9a625a29c8ed4debb7e206ea690
static int iscsi_truncate(BlockDriverState *bs, int64_t offset) { IscsiLun *iscsilun = bs->opaque; Error *local_err = NULL; if (iscsilun->type != TYPE_DISK) { return -ENOTSUP; } iscsi_readcapacity_sync(iscsilun, &local_err); if (local_err != NULL) { error_free(local_err); return -EIO; } if (offset > iscsi_getlength(bs)) { return -EINVAL; } if (iscsilun->allocationmap != NULL) { g_free(iscsilun->allocationmap); iscsilun->allocationmap = iscsi_allocationmap_init(iscsilun); } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(BlockDriverState *VAR_0, int64_t VAR_1) { IscsiLun *iscsilun = VAR_0->opaque; Error *local_err = NULL; if (iscsilun->type != TYPE_DISK) { return -ENOTSUP; } iscsi_readcapacity_sync(iscsilun, &local_err); if (local_err != NULL) { error_free(local_err); return -EIO; } if (VAR_1 > iscsi_getlength(VAR_0)) { return -EINVAL; } if (iscsilun->allocationmap != NULL) { g_free(iscsilun->allocationmap); iscsilun->allocationmap = iscsi_allocationmap_init(iscsilun); } return 0; }
[ "static int FUNC_0(BlockDriverState *VAR_0, int64_t VAR_1)\n{", "IscsiLun *iscsilun = VAR_0->opaque;", "Error *local_err = NULL;", "if (iscsilun->type != TYPE_DISK) {", "return -ENOTSUP;", "}", "iscsi_readcapacity_sync(iscsilun, &local_err);", "if (local_err != NULL) {", "error_free(local_err);", "return -EIO;", "}", "if (VAR_1 > iscsi_getlength(VAR_0)) {", "return -EINVAL;", "}", "if (iscsilun->allocationmap != NULL) {", "g_free(iscsilun->allocationmap);", "iscsilun->allocationmap = iscsi_allocationmap_init(iscsilun);", "}", "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 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 49 ], [ 51 ] ]
15,547
static void save_native_fp_fxsave(CPUState *env) { struct fpxstate *fp = &fpx1; int fptag, i, j; uint16_t fpuc; asm volatile ("fxsave %0" : : "m" (*fp)); env->fpuc = fp->fpuc; env->fpstt = (fp->fpus >> 11) & 7; env->fpus = fp->fpus & ~0x3800; fptag = fp->fptag ^ 0xff; for(i = 0;i < 8; i++) { env->fptags[i] = (fptag >> i) & 1; } j = env->fpstt; for(i = 0;i < 8; i++) { memcpy(&env->fpregs[j].d, &fp->fpregs1[i * 16], 10); j = (j + 1) & 7; } if (env->cpuid_features & CPUID_SSE) { env->mxcsr = fp->mxcsr; memcpy(env->xmm_regs, fp->xmm_regs, CPU_NB_REGS * 16); } /* we must restore the default rounding state */ asm volatile ("fninit"); fpuc = 0x037f | (env->fpuc & (3 << 10)); asm volatile("fldcw %0" : : "m" (fpuc)); }
false
qemu
4a1418e07bdcfaa3177739e04707ecaec75d89e1
static void save_native_fp_fxsave(CPUState *env) { struct fpxstate *fp = &fpx1; int fptag, i, j; uint16_t fpuc; asm volatile ("fxsave %0" : : "m" (*fp)); env->fpuc = fp->fpuc; env->fpstt = (fp->fpus >> 11) & 7; env->fpus = fp->fpus & ~0x3800; fptag = fp->fptag ^ 0xff; for(i = 0;i < 8; i++) { env->fptags[i] = (fptag >> i) & 1; } j = env->fpstt; for(i = 0;i < 8; i++) { memcpy(&env->fpregs[j].d, &fp->fpregs1[i * 16], 10); j = (j + 1) & 7; } if (env->cpuid_features & CPUID_SSE) { env->mxcsr = fp->mxcsr; memcpy(env->xmm_regs, fp->xmm_regs, CPU_NB_REGS * 16); } asm volatile ("fninit"); fpuc = 0x037f | (env->fpuc & (3 << 10)); asm volatile("fldcw %0" : : "m" (fpuc)); }
{ "code": [], "line_no": [] }
static void FUNC_0(CPUState *VAR_0) { struct fpxstate *VAR_1 = &fpx1; int VAR_2, VAR_3, VAR_4; uint16_t fpuc; asm volatile ("fxsave %0" : : "m" (*VAR_1)); VAR_0->fpuc = VAR_1->fpuc; VAR_0->fpstt = (VAR_1->fpus >> 11) & 7; VAR_0->fpus = VAR_1->fpus & ~0x3800; VAR_2 = VAR_1->VAR_2 ^ 0xff; for(VAR_3 = 0;VAR_3 < 8; VAR_3++) { VAR_0->fptags[VAR_3] = (VAR_2 >> VAR_3) & 1; } VAR_4 = VAR_0->fpstt; for(VAR_3 = 0;VAR_3 < 8; VAR_3++) { memcpy(&VAR_0->fpregs[VAR_4].d, &VAR_1->fpregs1[VAR_3 * 16], 10); VAR_4 = (VAR_4 + 1) & 7; } if (VAR_0->cpuid_features & CPUID_SSE) { VAR_0->mxcsr = VAR_1->mxcsr; memcpy(VAR_0->xmm_regs, VAR_1->xmm_regs, CPU_NB_REGS * 16); } asm volatile ("fninit"); fpuc = 0x037f | (VAR_0->fpuc & (3 << 10)); asm volatile("fldcw %0" : : "m" (fpuc)); }
[ "static void FUNC_0(CPUState *VAR_0)\n{", "struct fpxstate *VAR_1 = &fpx1;", "int VAR_2, VAR_3, VAR_4;", "uint16_t fpuc;", "asm volatile (\"fxsave %0\" : : \"m\" (*VAR_1));", "VAR_0->fpuc = VAR_1->fpuc;", "VAR_0->fpstt = (VAR_1->fpus >> 11) & 7;", "VAR_0->fpus = VAR_1->fpus & ~0x3800;", "VAR_2 = VAR_1->VAR_2 ^ 0xff;", "for(VAR_3 = 0;VAR_3 < 8; VAR_3++) {", "VAR_0->fptags[VAR_3] = (VAR_2 >> VAR_3) & 1;", "}", "VAR_4 = VAR_0->fpstt;", "for(VAR_3 = 0;VAR_3 < 8; VAR_3++) {", "memcpy(&VAR_0->fpregs[VAR_4].d, &VAR_1->fpregs1[VAR_3 * 16], 10);", "VAR_4 = (VAR_4 + 1) & 7;", "}", "if (VAR_0->cpuid_features & CPUID_SSE) {", "VAR_0->mxcsr = VAR_1->mxcsr;", "memcpy(VAR_0->xmm_regs, VAR_1->xmm_regs, CPU_NB_REGS * 16);", "}", "asm volatile (\"fninit\");", "fpuc = 0x037f | (VAR_0->fpuc & (3 << 10));", "asm volatile(\"fldcw %0\" : : \"m\" (fpuc));", "}" ]
[ 0, 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 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ] ]
15,548
static int vmdk_create(const char *filename, QemuOpts *opts, Error **errp) { int idx = 0; BlockDriverState *new_bs = NULL; Error *local_err = NULL; char *desc = NULL; int64_t total_size = 0, filesize; char *adapter_type = NULL; char *backing_file = NULL; char *fmt = NULL; int flags = 0; int ret = 0; bool flat, split, compress; GString *ext_desc_lines; char path[PATH_MAX], prefix[PATH_MAX], postfix[PATH_MAX]; const int64_t split_size = 0x80000000; /* VMDK has constant split size */ const char *desc_extent_line; char parent_desc_line[BUF_SIZE] = ""; uint32_t parent_cid = 0xffffffff; uint32_t number_heads = 16; bool zeroed_grain = false; uint32_t desc_offset = 0, desc_len; const char desc_template[] = "# Disk DescriptorFile\n" "version=1\n" "CID=%" PRIx32 "\n" "parentCID=%" PRIx32 "\n" "createType=\"%s\"\n" "%s" "\n" "# Extent description\n" "%s" "\n" "# The Disk Data Base\n" "#DDB\n" "\n" "ddb.virtualHWVersion = \"%d\"\n" "ddb.geometry.cylinders = \"%" PRId64 "\"\n" "ddb.geometry.heads = \"%" PRIu32 "\"\n" "ddb.geometry.sectors = \"63\"\n" "ddb.adapterType = \"%s\"\n"; ext_desc_lines = g_string_new(NULL); if (filename_decompose(filename, path, prefix, postfix, PATH_MAX, errp)) { ret = -EINVAL; goto exit; } /* Read out options */ total_size = ROUND_UP(qemu_opt_get_size_del(opts, BLOCK_OPT_SIZE, 0), BDRV_SECTOR_SIZE); adapter_type = qemu_opt_get_del(opts, BLOCK_OPT_ADAPTER_TYPE); backing_file = qemu_opt_get_del(opts, BLOCK_OPT_BACKING_FILE); if (qemu_opt_get_bool_del(opts, BLOCK_OPT_COMPAT6, false)) { flags |= BLOCK_FLAG_COMPAT6; } fmt = qemu_opt_get_del(opts, BLOCK_OPT_SUBFMT); if (qemu_opt_get_bool_del(opts, BLOCK_OPT_ZEROED_GRAIN, false)) { zeroed_grain = true; } if (!adapter_type) { adapter_type = g_strdup("ide"); } else if (strcmp(adapter_type, "ide") && strcmp(adapter_type, "buslogic") && strcmp(adapter_type, "lsilogic") && strcmp(adapter_type, "legacyESX")) { error_setg(errp, "Unknown adapter type: '%s'", adapter_type); ret = -EINVAL; goto exit; } if (strcmp(adapter_type, "ide") != 0) { /* that's the number of heads with which vmware operates when creating, exporting, etc. vmdk files with a non-ide adapter type */ number_heads = 255; } if (!fmt) { /* Default format to monolithicSparse */ fmt = g_strdup("monolithicSparse"); } else if (strcmp(fmt, "monolithicFlat") && strcmp(fmt, "monolithicSparse") && strcmp(fmt, "twoGbMaxExtentSparse") && strcmp(fmt, "twoGbMaxExtentFlat") && strcmp(fmt, "streamOptimized")) { error_setg(errp, "Unknown subformat: '%s'", fmt); ret = -EINVAL; goto exit; } split = !(strcmp(fmt, "twoGbMaxExtentFlat") && strcmp(fmt, "twoGbMaxExtentSparse")); flat = !(strcmp(fmt, "monolithicFlat") && strcmp(fmt, "twoGbMaxExtentFlat")); compress = !strcmp(fmt, "streamOptimized"); if (flat) { desc_extent_line = "RW %" PRId64 " FLAT \"%s\" 0\n"; } else { desc_extent_line = "RW %" PRId64 " SPARSE \"%s\"\n"; } if (flat && backing_file) { error_setg(errp, "Flat image can't have backing file"); ret = -ENOTSUP; goto exit; } if (flat && zeroed_grain) { error_setg(errp, "Flat image can't enable zeroed grain"); ret = -ENOTSUP; goto exit; } if (backing_file) { BlockDriverState *bs = NULL; ret = bdrv_open(&bs, backing_file, NULL, NULL, BDRV_O_NO_BACKING, NULL, errp); if (ret != 0) { goto exit; } if (strcmp(bs->drv->format_name, "vmdk")) { bdrv_unref(bs); ret = -EINVAL; goto exit; } parent_cid = vmdk_read_cid(bs, 0); bdrv_unref(bs); snprintf(parent_desc_line, sizeof(parent_desc_line), "parentFileNameHint=\"%s\"", backing_file); } /* Create extents */ filesize = total_size; while (filesize > 0) { char desc_line[BUF_SIZE]; char ext_filename[PATH_MAX]; char desc_filename[PATH_MAX]; int64_t size = filesize; if (split && size > split_size) { size = split_size; } if (split) { snprintf(desc_filename, sizeof(desc_filename), "%s-%c%03d%s", prefix, flat ? 'f' : 's', ++idx, postfix); } else if (flat) { snprintf(desc_filename, sizeof(desc_filename), "%s-flat%s", prefix, postfix); } else { snprintf(desc_filename, sizeof(desc_filename), "%s%s", prefix, postfix); } snprintf(ext_filename, sizeof(ext_filename), "%s%s", path, desc_filename); if (vmdk_create_extent(ext_filename, size, flat, compress, zeroed_grain, opts, errp)) { ret = -EINVAL; goto exit; } filesize -= size; /* Format description line */ snprintf(desc_line, sizeof(desc_line), desc_extent_line, size / BDRV_SECTOR_SIZE, desc_filename); g_string_append(ext_desc_lines, desc_line); } /* generate descriptor file */ desc = g_strdup_printf(desc_template, g_random_int(), parent_cid, fmt, parent_desc_line, ext_desc_lines->str, (flags & BLOCK_FLAG_COMPAT6 ? 6 : 4), total_size / (int64_t)(63 * number_heads * BDRV_SECTOR_SIZE), number_heads, adapter_type); desc_len = strlen(desc); /* the descriptor offset = 0x200 */ if (!split && !flat) { desc_offset = 0x200; } else { ret = bdrv_create_file(filename, opts, &local_err); if (ret < 0) { error_propagate(errp, local_err); goto exit; } } assert(new_bs == NULL); ret = bdrv_open(&new_bs, filename, NULL, NULL, BDRV_O_RDWR | BDRV_O_PROTOCOL, NULL, &local_err); if (ret < 0) { error_propagate(errp, local_err); goto exit; } ret = bdrv_pwrite(new_bs, desc_offset, desc, desc_len); if (ret < 0) { error_setg_errno(errp, -ret, "Could not write description"); goto exit; } /* bdrv_pwrite write padding zeros to align to sector, we don't need that * for description file */ if (desc_offset == 0) { ret = bdrv_truncate(new_bs, desc_len); if (ret < 0) { error_setg_errno(errp, -ret, "Could not truncate file"); } } exit: if (new_bs) { bdrv_unref(new_bs); } g_free(adapter_type); g_free(backing_file); g_free(fmt); g_free(desc); g_string_free(ext_desc_lines, true); return ret; }
false
qemu
1085daf9411e355ce3bd6d7034e23a8405599889
static int vmdk_create(const char *filename, QemuOpts *opts, Error **errp) { int idx = 0; BlockDriverState *new_bs = NULL; Error *local_err = NULL; char *desc = NULL; int64_t total_size = 0, filesize; char *adapter_type = NULL; char *backing_file = NULL; char *fmt = NULL; int flags = 0; int ret = 0; bool flat, split, compress; GString *ext_desc_lines; char path[PATH_MAX], prefix[PATH_MAX], postfix[PATH_MAX]; const int64_t split_size = 0x80000000; const char *desc_extent_line; char parent_desc_line[BUF_SIZE] = ""; uint32_t parent_cid = 0xffffffff; uint32_t number_heads = 16; bool zeroed_grain = false; uint32_t desc_offset = 0, desc_len; const char desc_template[] = "# Disk DescriptorFile\n" "version=1\n" "CID=%" PRIx32 "\n" "parentCID=%" PRIx32 "\n" "createType=\"%s\"\n" "%s" "\n" "# Extent description\n" "%s" "\n" "# The Disk Data Base\n" "#DDB\n" "\n" "ddb.virtualHWVersion = \"%d\"\n" "ddb.geometry.cylinders = \"%" PRId64 "\"\n" "ddb.geometry.heads = \"%" PRIu32 "\"\n" "ddb.geometry.sectors = \"63\"\n" "ddb.adapterType = \"%s\"\n"; ext_desc_lines = g_string_new(NULL); if (filename_decompose(filename, path, prefix, postfix, PATH_MAX, errp)) { ret = -EINVAL; goto exit; } total_size = ROUND_UP(qemu_opt_get_size_del(opts, BLOCK_OPT_SIZE, 0), BDRV_SECTOR_SIZE); adapter_type = qemu_opt_get_del(opts, BLOCK_OPT_ADAPTER_TYPE); backing_file = qemu_opt_get_del(opts, BLOCK_OPT_BACKING_FILE); if (qemu_opt_get_bool_del(opts, BLOCK_OPT_COMPAT6, false)) { flags |= BLOCK_FLAG_COMPAT6; } fmt = qemu_opt_get_del(opts, BLOCK_OPT_SUBFMT); if (qemu_opt_get_bool_del(opts, BLOCK_OPT_ZEROED_GRAIN, false)) { zeroed_grain = true; } if (!adapter_type) { adapter_type = g_strdup("ide"); } else if (strcmp(adapter_type, "ide") && strcmp(adapter_type, "buslogic") && strcmp(adapter_type, "lsilogic") && strcmp(adapter_type, "legacyESX")) { error_setg(errp, "Unknown adapter type: '%s'", adapter_type); ret = -EINVAL; goto exit; } if (strcmp(adapter_type, "ide") != 0) { number_heads = 255; } if (!fmt) { fmt = g_strdup("monolithicSparse"); } else if (strcmp(fmt, "monolithicFlat") && strcmp(fmt, "monolithicSparse") && strcmp(fmt, "twoGbMaxExtentSparse") && strcmp(fmt, "twoGbMaxExtentFlat") && strcmp(fmt, "streamOptimized")) { error_setg(errp, "Unknown subformat: '%s'", fmt); ret = -EINVAL; goto exit; } split = !(strcmp(fmt, "twoGbMaxExtentFlat") && strcmp(fmt, "twoGbMaxExtentSparse")); flat = !(strcmp(fmt, "monolithicFlat") && strcmp(fmt, "twoGbMaxExtentFlat")); compress = !strcmp(fmt, "streamOptimized"); if (flat) { desc_extent_line = "RW %" PRId64 " FLAT \"%s\" 0\n"; } else { desc_extent_line = "RW %" PRId64 " SPARSE \"%s\"\n"; } if (flat && backing_file) { error_setg(errp, "Flat image can't have backing file"); ret = -ENOTSUP; goto exit; } if (flat && zeroed_grain) { error_setg(errp, "Flat image can't enable zeroed grain"); ret = -ENOTSUP; goto exit; } if (backing_file) { BlockDriverState *bs = NULL; ret = bdrv_open(&bs, backing_file, NULL, NULL, BDRV_O_NO_BACKING, NULL, errp); if (ret != 0) { goto exit; } if (strcmp(bs->drv->format_name, "vmdk")) { bdrv_unref(bs); ret = -EINVAL; goto exit; } parent_cid = vmdk_read_cid(bs, 0); bdrv_unref(bs); snprintf(parent_desc_line, sizeof(parent_desc_line), "parentFileNameHint=\"%s\"", backing_file); } filesize = total_size; while (filesize > 0) { char desc_line[BUF_SIZE]; char ext_filename[PATH_MAX]; char desc_filename[PATH_MAX]; int64_t size = filesize; if (split && size > split_size) { size = split_size; } if (split) { snprintf(desc_filename, sizeof(desc_filename), "%s-%c%03d%s", prefix, flat ? 'f' : 's', ++idx, postfix); } else if (flat) { snprintf(desc_filename, sizeof(desc_filename), "%s-flat%s", prefix, postfix); } else { snprintf(desc_filename, sizeof(desc_filename), "%s%s", prefix, postfix); } snprintf(ext_filename, sizeof(ext_filename), "%s%s", path, desc_filename); if (vmdk_create_extent(ext_filename, size, flat, compress, zeroed_grain, opts, errp)) { ret = -EINVAL; goto exit; } filesize -= size; snprintf(desc_line, sizeof(desc_line), desc_extent_line, size / BDRV_SECTOR_SIZE, desc_filename); g_string_append(ext_desc_lines, desc_line); } desc = g_strdup_printf(desc_template, g_random_int(), parent_cid, fmt, parent_desc_line, ext_desc_lines->str, (flags & BLOCK_FLAG_COMPAT6 ? 6 : 4), total_size / (int64_t)(63 * number_heads * BDRV_SECTOR_SIZE), number_heads, adapter_type); desc_len = strlen(desc); if (!split && !flat) { desc_offset = 0x200; } else { ret = bdrv_create_file(filename, opts, &local_err); if (ret < 0) { error_propagate(errp, local_err); goto exit; } } assert(new_bs == NULL); ret = bdrv_open(&new_bs, filename, NULL, NULL, BDRV_O_RDWR | BDRV_O_PROTOCOL, NULL, &local_err); if (ret < 0) { error_propagate(errp, local_err); goto exit; } ret = bdrv_pwrite(new_bs, desc_offset, desc, desc_len); if (ret < 0) { error_setg_errno(errp, -ret, "Could not write description"); goto exit; } if (desc_offset == 0) { ret = bdrv_truncate(new_bs, desc_len); if (ret < 0) { error_setg_errno(errp, -ret, "Could not truncate file"); } } exit: if (new_bs) { bdrv_unref(new_bs); } g_free(adapter_type); g_free(backing_file); g_free(fmt); g_free(desc); g_string_free(ext_desc_lines, true); return ret; }
{ "code": [], "line_no": [] }
static int FUNC_0(const char *VAR_0, QemuOpts *VAR_1, Error **VAR_2) { int VAR_3 = 0; BlockDriverState *new_bs = NULL; Error *local_err = NULL; char *VAR_4 = NULL; int64_t total_size = 0, filesize; char *VAR_5 = NULL; char *VAR_6 = NULL; char *VAR_7 = NULL; int VAR_8 = 0; int VAR_9 = 0; bool flat, split, compress; GString *ext_desc_lines; char VAR_10[PATH_MAX], prefix[PATH_MAX], postfix[PATH_MAX]; const int64_t VAR_11 = 0x80000000; const char *VAR_12; char VAR_13[BUF_SIZE] = ""; uint32_t parent_cid = 0xffffffff; uint32_t number_heads = 16; bool zeroed_grain = false; uint32_t desc_offset = 0, desc_len; const char VAR_14[] = "# Disk DescriptorFile\n" "version=1\n" "CID=%" PRIx32 "\n" "parentCID=%" PRIx32 "\n" "createType=\"%s\"\n" "%s" "\n" "# Extent description\n" "%s" "\n" "# The Disk Data Base\n" "#DDB\n" "\n" "ddb.virtualHWVersion = \"%d\"\n" "ddb.geometry.cylinders = \"%" PRId64 "\"\n" "ddb.geometry.heads = \"%" PRIu32 "\"\n" "ddb.geometry.sectors = \"63\"\n" "ddb.adapterType = \"%s\"\n"; ext_desc_lines = g_string_new(NULL); if (filename_decompose(VAR_0, VAR_10, prefix, postfix, PATH_MAX, VAR_2)) { VAR_9 = -EINVAL; goto exit; } total_size = ROUND_UP(qemu_opt_get_size_del(VAR_1, BLOCK_OPT_SIZE, 0), BDRV_SECTOR_SIZE); VAR_5 = qemu_opt_get_del(VAR_1, BLOCK_OPT_ADAPTER_TYPE); VAR_6 = qemu_opt_get_del(VAR_1, BLOCK_OPT_BACKING_FILE); if (qemu_opt_get_bool_del(VAR_1, BLOCK_OPT_COMPAT6, false)) { VAR_8 |= BLOCK_FLAG_COMPAT6; } VAR_7 = qemu_opt_get_del(VAR_1, BLOCK_OPT_SUBFMT); if (qemu_opt_get_bool_del(VAR_1, BLOCK_OPT_ZEROED_GRAIN, false)) { zeroed_grain = true; } if (!VAR_5) { VAR_5 = g_strdup("ide"); } else if (strcmp(VAR_5, "ide") && strcmp(VAR_5, "buslogic") && strcmp(VAR_5, "lsilogic") && strcmp(VAR_5, "legacyESX")) { error_setg(VAR_2, "Unknown adapter type: '%s'", VAR_5); VAR_9 = -EINVAL; goto exit; } if (strcmp(VAR_5, "ide") != 0) { number_heads = 255; } if (!VAR_7) { VAR_7 = g_strdup("monolithicSparse"); } else if (strcmp(VAR_7, "monolithicFlat") && strcmp(VAR_7, "monolithicSparse") && strcmp(VAR_7, "twoGbMaxExtentSparse") && strcmp(VAR_7, "twoGbMaxExtentFlat") && strcmp(VAR_7, "streamOptimized")) { error_setg(VAR_2, "Unknown subformat: '%s'", VAR_7); VAR_9 = -EINVAL; goto exit; } split = !(strcmp(VAR_7, "twoGbMaxExtentFlat") && strcmp(VAR_7, "twoGbMaxExtentSparse")); flat = !(strcmp(VAR_7, "monolithicFlat") && strcmp(VAR_7, "twoGbMaxExtentFlat")); compress = !strcmp(VAR_7, "streamOptimized"); if (flat) { VAR_12 = "RW %" PRId64 " FLAT \"%s\" 0\n"; } else { VAR_12 = "RW %" PRId64 " SPARSE \"%s\"\n"; } if (flat && VAR_6) { error_setg(VAR_2, "Flat image can't have backing file"); VAR_9 = -ENOTSUP; goto exit; } if (flat && zeroed_grain) { error_setg(VAR_2, "Flat image can't enable zeroed grain"); VAR_9 = -ENOTSUP; goto exit; } if (VAR_6) { BlockDriverState *bs = NULL; VAR_9 = bdrv_open(&bs, VAR_6, NULL, NULL, BDRV_O_NO_BACKING, NULL, VAR_2); if (VAR_9 != 0) { goto exit; } if (strcmp(bs->drv->format_name, "vmdk")) { bdrv_unref(bs); VAR_9 = -EINVAL; goto exit; } parent_cid = vmdk_read_cid(bs, 0); bdrv_unref(bs); snprintf(VAR_13, sizeof(VAR_13), "parentFileNameHint=\"%s\"", VAR_6); } filesize = total_size; while (filesize > 0) { char VAR_15[BUF_SIZE]; char VAR_16[PATH_MAX]; char VAR_17[PATH_MAX]; int64_t size = filesize; if (split && size > VAR_11) { size = VAR_11; } if (split) { snprintf(VAR_17, sizeof(VAR_17), "%s-%c%03d%s", prefix, flat ? 'f' : 's', ++VAR_3, postfix); } else if (flat) { snprintf(VAR_17, sizeof(VAR_17), "%s-flat%s", prefix, postfix); } else { snprintf(VAR_17, sizeof(VAR_17), "%s%s", prefix, postfix); } snprintf(VAR_16, sizeof(VAR_16), "%s%s", VAR_10, VAR_17); if (vmdk_create_extent(VAR_16, size, flat, compress, zeroed_grain, VAR_1, VAR_2)) { VAR_9 = -EINVAL; goto exit; } filesize -= size; snprintf(VAR_15, sizeof(VAR_15), VAR_12, size / BDRV_SECTOR_SIZE, VAR_17); g_string_append(ext_desc_lines, VAR_15); } VAR_4 = g_strdup_printf(VAR_14, g_random_int(), parent_cid, VAR_7, VAR_13, ext_desc_lines->str, (VAR_8 & BLOCK_FLAG_COMPAT6 ? 6 : 4), total_size / (int64_t)(63 * number_heads * BDRV_SECTOR_SIZE), number_heads, VAR_5); desc_len = strlen(VAR_4); if (!split && !flat) { desc_offset = 0x200; } else { VAR_9 = bdrv_create_file(VAR_0, VAR_1, &local_err); if (VAR_9 < 0) { error_propagate(VAR_2, local_err); goto exit; } } assert(new_bs == NULL); VAR_9 = bdrv_open(&new_bs, VAR_0, NULL, NULL, BDRV_O_RDWR | BDRV_O_PROTOCOL, NULL, &local_err); if (VAR_9 < 0) { error_propagate(VAR_2, local_err); goto exit; } VAR_9 = bdrv_pwrite(new_bs, desc_offset, VAR_4, desc_len); if (VAR_9 < 0) { error_setg_errno(VAR_2, -VAR_9, "Could not write description"); goto exit; } if (desc_offset == 0) { VAR_9 = bdrv_truncate(new_bs, desc_len); if (VAR_9 < 0) { error_setg_errno(VAR_2, -VAR_9, "Could not truncate file"); } } exit: if (new_bs) { bdrv_unref(new_bs); } g_free(VAR_5); g_free(VAR_6); g_free(VAR_7); g_free(VAR_4); g_string_free(ext_desc_lines, true); return VAR_9; }
[ "static int FUNC_0(const char *VAR_0, QemuOpts *VAR_1, Error **VAR_2)\n{", "int VAR_3 = 0;", "BlockDriverState *new_bs = NULL;", "Error *local_err = NULL;", "char *VAR_4 = NULL;", "int64_t total_size = 0, filesize;", "char *VAR_5 = NULL;", "char *VAR_6 = NULL;", "char *VAR_7 = NULL;", "int VAR_8 = 0;", "int VAR_9 = 0;", "bool flat, split, compress;", "GString *ext_desc_lines;", "char VAR_10[PATH_MAX], prefix[PATH_MAX], postfix[PATH_MAX];", "const int64_t VAR_11 = 0x80000000;", "const char *VAR_12;", "char VAR_13[BUF_SIZE] = \"\";", "uint32_t parent_cid = 0xffffffff;", "uint32_t number_heads = 16;", "bool zeroed_grain = false;", "uint32_t desc_offset = 0, desc_len;", "const char VAR_14[] =\n\"# Disk DescriptorFile\\n\"\n\"version=1\\n\"\n\"CID=%\" PRIx32 \"\\n\"\n\"parentCID=%\" PRIx32 \"\\n\"\n\"createType=\\\"%s\\\"\\n\"\n\"%s\"\n\"\\n\"\n\"# Extent description\\n\"\n\"%s\"\n\"\\n\"\n\"# The Disk Data Base\\n\"\n\"#DDB\\n\"\n\"\\n\"\n\"ddb.virtualHWVersion = \\\"%d\\\"\\n\"\n\"ddb.geometry.cylinders = \\\"%\" PRId64 \"\\\"\\n\"\n\"ddb.geometry.heads = \\\"%\" PRIu32 \"\\\"\\n\"\n\"ddb.geometry.sectors = \\\"63\\\"\\n\"\n\"ddb.adapterType = \\\"%s\\\"\\n\";", "ext_desc_lines = g_string_new(NULL);", "if (filename_decompose(VAR_0, VAR_10, prefix, postfix, PATH_MAX, VAR_2)) {", "VAR_9 = -EINVAL;", "goto exit;", "}", "total_size = ROUND_UP(qemu_opt_get_size_del(VAR_1, BLOCK_OPT_SIZE, 0),\nBDRV_SECTOR_SIZE);", "VAR_5 = qemu_opt_get_del(VAR_1, BLOCK_OPT_ADAPTER_TYPE);", "VAR_6 = qemu_opt_get_del(VAR_1, BLOCK_OPT_BACKING_FILE);", "if (qemu_opt_get_bool_del(VAR_1, BLOCK_OPT_COMPAT6, false)) {", "VAR_8 |= BLOCK_FLAG_COMPAT6;", "}", "VAR_7 = qemu_opt_get_del(VAR_1, BLOCK_OPT_SUBFMT);", "if (qemu_opt_get_bool_del(VAR_1, BLOCK_OPT_ZEROED_GRAIN, false)) {", "zeroed_grain = true;", "}", "if (!VAR_5) {", "VAR_5 = g_strdup(\"ide\");", "} else if (strcmp(VAR_5, \"ide\") &&", "strcmp(VAR_5, \"buslogic\") &&\nstrcmp(VAR_5, \"lsilogic\") &&\nstrcmp(VAR_5, \"legacyESX\")) {", "error_setg(VAR_2, \"Unknown adapter type: '%s'\", VAR_5);", "VAR_9 = -EINVAL;", "goto exit;", "}", "if (strcmp(VAR_5, \"ide\") != 0) {", "number_heads = 255;", "}", "if (!VAR_7) {", "VAR_7 = g_strdup(\"monolithicSparse\");", "} else if (strcmp(VAR_7, \"monolithicFlat\") &&", "strcmp(VAR_7, \"monolithicSparse\") &&\nstrcmp(VAR_7, \"twoGbMaxExtentSparse\") &&\nstrcmp(VAR_7, \"twoGbMaxExtentFlat\") &&\nstrcmp(VAR_7, \"streamOptimized\")) {", "error_setg(VAR_2, \"Unknown subformat: '%s'\", VAR_7);", "VAR_9 = -EINVAL;", "goto exit;", "}", "split = !(strcmp(VAR_7, \"twoGbMaxExtentFlat\") &&\nstrcmp(VAR_7, \"twoGbMaxExtentSparse\"));", "flat = !(strcmp(VAR_7, \"monolithicFlat\") &&\nstrcmp(VAR_7, \"twoGbMaxExtentFlat\"));", "compress = !strcmp(VAR_7, \"streamOptimized\");", "if (flat) {", "VAR_12 = \"RW %\" PRId64 \" FLAT \\\"%s\\\" 0\\n\";", "} else {", "VAR_12 = \"RW %\" PRId64 \" SPARSE \\\"%s\\\"\\n\";", "}", "if (flat && VAR_6) {", "error_setg(VAR_2, \"Flat image can't have backing file\");", "VAR_9 = -ENOTSUP;", "goto exit;", "}", "if (flat && zeroed_grain) {", "error_setg(VAR_2, \"Flat image can't enable zeroed grain\");", "VAR_9 = -ENOTSUP;", "goto exit;", "}", "if (VAR_6) {", "BlockDriverState *bs = NULL;", "VAR_9 = bdrv_open(&bs, VAR_6, NULL, NULL, BDRV_O_NO_BACKING, NULL,\nVAR_2);", "if (VAR_9 != 0) {", "goto exit;", "}", "if (strcmp(bs->drv->format_name, \"vmdk\")) {", "bdrv_unref(bs);", "VAR_9 = -EINVAL;", "goto exit;", "}", "parent_cid = vmdk_read_cid(bs, 0);", "bdrv_unref(bs);", "snprintf(VAR_13, sizeof(VAR_13),\n\"parentFileNameHint=\\\"%s\\\"\", VAR_6);", "}", "filesize = total_size;", "while (filesize > 0) {", "char VAR_15[BUF_SIZE];", "char VAR_16[PATH_MAX];", "char VAR_17[PATH_MAX];", "int64_t size = filesize;", "if (split && size > VAR_11) {", "size = VAR_11;", "}", "if (split) {", "snprintf(VAR_17, sizeof(VAR_17), \"%s-%c%03d%s\",\nprefix, flat ? 'f' : 's', ++VAR_3, postfix);", "} else if (flat) {", "snprintf(VAR_17, sizeof(VAR_17), \"%s-flat%s\",\nprefix, postfix);", "} else {", "snprintf(VAR_17, sizeof(VAR_17), \"%s%s\",\nprefix, postfix);", "}", "snprintf(VAR_16, sizeof(VAR_16), \"%s%s\",\nVAR_10, VAR_17);", "if (vmdk_create_extent(VAR_16, size,\nflat, compress, zeroed_grain, VAR_1, VAR_2)) {", "VAR_9 = -EINVAL;", "goto exit;", "}", "filesize -= size;", "snprintf(VAR_15, sizeof(VAR_15),\nVAR_12, size / BDRV_SECTOR_SIZE, VAR_17);", "g_string_append(ext_desc_lines, VAR_15);", "}", "VAR_4 = g_strdup_printf(VAR_14,\ng_random_int(),\nparent_cid,\nVAR_7,\nVAR_13,\next_desc_lines->str,\n(VAR_8 & BLOCK_FLAG_COMPAT6 ? 6 : 4),\ntotal_size /\n(int64_t)(63 * number_heads * BDRV_SECTOR_SIZE),\nnumber_heads,\nVAR_5);", "desc_len = strlen(VAR_4);", "if (!split && !flat) {", "desc_offset = 0x200;", "} else {", "VAR_9 = bdrv_create_file(VAR_0, VAR_1, &local_err);", "if (VAR_9 < 0) {", "error_propagate(VAR_2, local_err);", "goto exit;", "}", "}", "assert(new_bs == NULL);", "VAR_9 = bdrv_open(&new_bs, VAR_0, NULL, NULL,\nBDRV_O_RDWR | BDRV_O_PROTOCOL, NULL, &local_err);", "if (VAR_9 < 0) {", "error_propagate(VAR_2, local_err);", "goto exit;", "}", "VAR_9 = bdrv_pwrite(new_bs, desc_offset, VAR_4, desc_len);", "if (VAR_9 < 0) {", "error_setg_errno(VAR_2, -VAR_9, \"Could not write description\");", "goto exit;", "}", "if (desc_offset == 0) {", "VAR_9 = bdrv_truncate(new_bs, desc_len);", "if (VAR_9 < 0) {", "error_setg_errno(VAR_2, -VAR_9, \"Could not truncate file\");", "}", "}", "exit:\nif (new_bs) {", "bdrv_unref(new_bs);", "}", "g_free(VAR_5);", "g_free(VAR_6);", "g_free(VAR_7);", "g_free(VAR_4);", "g_string_free(ext_desc_lines, true);", "return VAR_9;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 47, 49, 51, 53, 55, 57, 59, 61, 63, 65, 67, 69, 71, 73, 75, 77, 79, 81 ], [ 85 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 99, 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 123 ], [ 125 ], [ 127 ], [ 129, 131, 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 149 ], [ 151 ], [ 153 ], [ 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 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 221, 223 ], [ 225 ], [ 227 ], [ 229 ], [ 231 ], [ 233 ], [ 235 ], [ 237 ], [ 239 ], [ 241 ], [ 243 ], [ 245, 247 ], [ 249 ], [ 255 ], [ 257 ], [ 259 ], [ 261 ], [ 263 ], [ 265 ], [ 269 ], [ 271 ], [ 273 ], [ 275 ], [ 277, 279 ], [ 281 ], [ 283, 285 ], [ 287 ], [ 289, 291 ], [ 293 ], [ 295, 297 ], [ 301, 303 ], [ 305 ], [ 307 ], [ 309 ], [ 311 ], [ 317, 319 ], [ 321 ], [ 323 ], [ 327, 329, 331, 333, 335, 337, 339, 341, 343, 345, 347 ], [ 349 ], [ 353 ], [ 355 ], [ 357 ], [ 359 ], [ 361 ], [ 363 ], [ 365 ], [ 367 ], [ 369 ], [ 371 ], [ 373, 375 ], [ 377 ], [ 379 ], [ 381 ], [ 383 ], [ 385 ], [ 387 ], [ 389 ], [ 391 ], [ 393 ], [ 399 ], [ 401 ], [ 403 ], [ 405 ], [ 407 ], [ 409 ], [ 411, 413 ], [ 415 ], [ 417 ], [ 419 ], [ 421 ], [ 423 ], [ 425 ], [ 427 ], [ 429 ], [ 431 ] ]
15,551
void bdrv_reset_dirty_bitmap(BdrvDirtyBitmap *bitmap, int64_t cur_sector, int64_t nr_sectors) { assert(bdrv_dirty_bitmap_enabled(bitmap)); hbitmap_reset(bitmap->bitmap, cur_sector, nr_sectors); }
false
qemu
b64bd51efa9bbf30df1b2f91477d2805678d0b93
void bdrv_reset_dirty_bitmap(BdrvDirtyBitmap *bitmap, int64_t cur_sector, int64_t nr_sectors) { assert(bdrv_dirty_bitmap_enabled(bitmap)); hbitmap_reset(bitmap->bitmap, cur_sector, nr_sectors); }
{ "code": [], "line_no": [] }
void FUNC_0(BdrvDirtyBitmap *VAR_0, int64_t VAR_1, int64_t VAR_2) { assert(bdrv_dirty_bitmap_enabled(VAR_0)); hbitmap_reset(VAR_0->VAR_0, VAR_1, VAR_2); }
[ "void FUNC_0(BdrvDirtyBitmap *VAR_0,\nint64_t VAR_1, int64_t VAR_2)\n{", "assert(bdrv_dirty_bitmap_enabled(VAR_0));", "hbitmap_reset(VAR_0->VAR_0, VAR_1, VAR_2);", "}" ]
[ 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ] ]
15,553
static int set_string(void *obj, const AVOption *o, const char *val, uint8_t **dst) { av_freep(dst); *dst = av_strdup(val); return 0; }
false
FFmpeg
b1306823d0b3ae998c8e10ad832004eb13bdd93e
static int set_string(void *obj, const AVOption *o, const char *val, uint8_t **dst) { av_freep(dst); *dst = av_strdup(val); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(void *VAR_0, const AVOption *VAR_1, const char *VAR_2, uint8_t **VAR_3) { av_freep(VAR_3); *VAR_3 = av_strdup(VAR_2); return 0; }
[ "static int FUNC_0(void *VAR_0, const AVOption *VAR_1, const char *VAR_2, uint8_t **VAR_3)\n{", "av_freep(VAR_3);", "*VAR_3 = av_strdup(VAR_2);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ] ]
15,554
static int mkv_write_native_codecprivate(AVFormatContext *s, AVCodecParameters *par, AVIOContext *dyn_cp) { switch (par->codec_id) { case AV_CODEC_ID_VORBIS: case AV_CODEC_ID_THEORA: return put_xiph_codecpriv(s, dyn_cp, par); case AV_CODEC_ID_FLAC: return put_flac_codecpriv(s, dyn_cp, par); case AV_CODEC_ID_WAVPACK: return put_wv_codecpriv(dyn_cp, par); case AV_CODEC_ID_H264: return ff_isom_write_avcc(dyn_cp, par->extradata, par->extradata_size); case AV_CODEC_ID_HEVC: ff_isom_write_hvcc(dyn_cp, par->extradata, par->extradata_size, 0); return 0; case AV_CODEC_ID_ALAC: if (par->extradata_size < 36) { av_log(s, AV_LOG_ERROR, "Invalid extradata found, ALAC expects a 36-byte " "QuickTime atom."); return AVERROR_INVALIDDATA; } else avio_write(dyn_cp, par->extradata + 12, par->extradata_size - 12); break; default: if (par->codec_id == AV_CODEC_ID_PRORES && ff_codec_get_id(ff_codec_movvideo_tags, par->codec_tag) == AV_CODEC_ID_PRORES) { avio_wl32(dyn_cp, par->codec_tag); } else if (par->extradata_size && par->codec_id != AV_CODEC_ID_TTA) avio_write(dyn_cp, par->extradata, par->extradata_size); } return 0; }
false
FFmpeg
7631f14bb35e8467d4ffaaa2b34e60614eb37c71
static int mkv_write_native_codecprivate(AVFormatContext *s, AVCodecParameters *par, AVIOContext *dyn_cp) { switch (par->codec_id) { case AV_CODEC_ID_VORBIS: case AV_CODEC_ID_THEORA: return put_xiph_codecpriv(s, dyn_cp, par); case AV_CODEC_ID_FLAC: return put_flac_codecpriv(s, dyn_cp, par); case AV_CODEC_ID_WAVPACK: return put_wv_codecpriv(dyn_cp, par); case AV_CODEC_ID_H264: return ff_isom_write_avcc(dyn_cp, par->extradata, par->extradata_size); case AV_CODEC_ID_HEVC: ff_isom_write_hvcc(dyn_cp, par->extradata, par->extradata_size, 0); return 0; case AV_CODEC_ID_ALAC: if (par->extradata_size < 36) { av_log(s, AV_LOG_ERROR, "Invalid extradata found, ALAC expects a 36-byte " "QuickTime atom."); return AVERROR_INVALIDDATA; } else avio_write(dyn_cp, par->extradata + 12, par->extradata_size - 12); break; default: if (par->codec_id == AV_CODEC_ID_PRORES && ff_codec_get_id(ff_codec_movvideo_tags, par->codec_tag) == AV_CODEC_ID_PRORES) { avio_wl32(dyn_cp, par->codec_tag); } else if (par->extradata_size && par->codec_id != AV_CODEC_ID_TTA) avio_write(dyn_cp, par->extradata, par->extradata_size); } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVFormatContext *VAR_0, AVCodecParameters *VAR_1, AVIOContext *VAR_2) { switch (VAR_1->codec_id) { case AV_CODEC_ID_VORBIS: case AV_CODEC_ID_THEORA: return put_xiph_codecpriv(VAR_0, VAR_2, VAR_1); case AV_CODEC_ID_FLAC: return put_flac_codecpriv(VAR_0, VAR_2, VAR_1); case AV_CODEC_ID_WAVPACK: return put_wv_codecpriv(VAR_2, VAR_1); case AV_CODEC_ID_H264: return ff_isom_write_avcc(VAR_2, VAR_1->extradata, VAR_1->extradata_size); case AV_CODEC_ID_HEVC: ff_isom_write_hvcc(VAR_2, VAR_1->extradata, VAR_1->extradata_size, 0); return 0; case AV_CODEC_ID_ALAC: if (VAR_1->extradata_size < 36) { av_log(VAR_0, AV_LOG_ERROR, "Invalid extradata found, ALAC expects a 36-byte " "QuickTime atom."); return AVERROR_INVALIDDATA; } else avio_write(VAR_2, VAR_1->extradata + 12, VAR_1->extradata_size - 12); break; default: if (VAR_1->codec_id == AV_CODEC_ID_PRORES && ff_codec_get_id(ff_codec_movvideo_tags, VAR_1->codec_tag) == AV_CODEC_ID_PRORES) { avio_wl32(VAR_2, VAR_1->codec_tag); } else if (VAR_1->extradata_size && VAR_1->codec_id != AV_CODEC_ID_TTA) avio_write(VAR_2, VAR_1->extradata, VAR_1->extradata_size); } return 0; }
[ "static int FUNC_0(AVFormatContext *VAR_0,\nAVCodecParameters *VAR_1,\nAVIOContext *VAR_2)\n{", "switch (VAR_1->codec_id) {", "case AV_CODEC_ID_VORBIS:\ncase AV_CODEC_ID_THEORA:\nreturn put_xiph_codecpriv(VAR_0, VAR_2, VAR_1);", "case AV_CODEC_ID_FLAC:\nreturn put_flac_codecpriv(VAR_0, VAR_2, VAR_1);", "case AV_CODEC_ID_WAVPACK:\nreturn put_wv_codecpriv(VAR_2, VAR_1);", "case AV_CODEC_ID_H264:\nreturn ff_isom_write_avcc(VAR_2, VAR_1->extradata,\nVAR_1->extradata_size);", "case AV_CODEC_ID_HEVC:\nff_isom_write_hvcc(VAR_2, VAR_1->extradata,\nVAR_1->extradata_size, 0);", "return 0;", "case AV_CODEC_ID_ALAC:\nif (VAR_1->extradata_size < 36) {", "av_log(VAR_0, AV_LOG_ERROR,\n\"Invalid extradata found, ALAC expects a 36-byte \"\n\"QuickTime atom.\");", "return AVERROR_INVALIDDATA;", "} else", "avio_write(VAR_2, VAR_1->extradata + 12,\nVAR_1->extradata_size - 12);", "break;", "default:\nif (VAR_1->codec_id == AV_CODEC_ID_PRORES &&\nff_codec_get_id(ff_codec_movvideo_tags, VAR_1->codec_tag) == AV_CODEC_ID_PRORES) {", "avio_wl32(VAR_2, VAR_1->codec_tag);", "} else if (VAR_1->extradata_size && VAR_1->codec_id != AV_CODEC_ID_TTA)", "avio_write(VAR_2, VAR_1->extradata, VAR_1->extradata_size);", "}", "return 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, 47 ], [ 49 ], [ 51 ], [ 53, 55 ], [ 57 ], [ 59, 61, 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 75 ], [ 77 ] ]
15,556
static void set_cfg_value(bool is_max, int index, int value) { if (is_max) { cfg.buckets[index].max = value; } else { cfg.buckets[index].avg = value; } }
true
qemu
6f9b6d57ae3cd8a5f82e06f79d22e7a591116b5b
static void set_cfg_value(bool is_max, int index, int value) { if (is_max) { cfg.buckets[index].max = value; } else { cfg.buckets[index].avg = value; } }
{ "code": [], "line_no": [] }
static void FUNC_0(bool VAR_0, int VAR_1, int VAR_2) { if (VAR_0) { cfg.buckets[VAR_1].max = VAR_2; } else { cfg.buckets[VAR_1].avg = VAR_2; } }
[ "static void FUNC_0(bool VAR_0, int VAR_1, int VAR_2)\n{", "if (VAR_0) {", "cfg.buckets[VAR_1].max = VAR_2;", "} else {", "cfg.buckets[VAR_1].avg = VAR_2;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ] ]
15,557
static int coroutine_fn mirror_iteration(MirrorBlockJob *s) { BlockDriverState *source = s->common.bs; BlockDriverState *target = s->target; QEMUIOVector qiov; int ret, nb_sectors; int64_t end; struct iovec iov; end = s->common.len >> BDRV_SECTOR_BITS; s->sector_num = bdrv_get_next_dirty(source, s->sector_num); nb_sectors = MIN(BDRV_SECTORS_PER_DIRTY_CHUNK, end - s->sector_num); bdrv_reset_dirty(source, s->sector_num, nb_sectors); /* Copy the dirty cluster. */ iov.iov_base = s->buf; iov.iov_len = nb_sectors * 512; qemu_iovec_init_external(&qiov, &iov, 1); trace_mirror_one_iteration(s, s->sector_num, nb_sectors); ret = bdrv_co_readv(source, s->sector_num, nb_sectors, &qiov); if (ret < 0) { return ret; } return bdrv_co_writev(target, s->sector_num, nb_sectors, &qiov); }
true
qemu
b952b5589a36114e06201c0d2e82c293dbad2b1f
static int coroutine_fn mirror_iteration(MirrorBlockJob *s) { BlockDriverState *source = s->common.bs; BlockDriverState *target = s->target; QEMUIOVector qiov; int ret, nb_sectors; int64_t end; struct iovec iov; end = s->common.len >> BDRV_SECTOR_BITS; s->sector_num = bdrv_get_next_dirty(source, s->sector_num); nb_sectors = MIN(BDRV_SECTORS_PER_DIRTY_CHUNK, end - s->sector_num); bdrv_reset_dirty(source, s->sector_num, nb_sectors); iov.iov_base = s->buf; iov.iov_len = nb_sectors * 512; qemu_iovec_init_external(&qiov, &iov, 1); trace_mirror_one_iteration(s, s->sector_num, nb_sectors); ret = bdrv_co_readv(source, s->sector_num, nb_sectors, &qiov); if (ret < 0) { return ret; } return bdrv_co_writev(target, s->sector_num, nb_sectors, &qiov); }
{ "code": [ "static int coroutine_fn mirror_iteration(MirrorBlockJob *s)", " return ret;", " return bdrv_co_writev(target, s->sector_num, nb_sectors, &qiov);" ], "line_no": [ 1, 45, 49 ] }
static int VAR_0 mirror_iteration(MirrorBlockJob *s) { BlockDriverState *source = s->common.bs; BlockDriverState *target = s->target; QEMUIOVector qiov; int ret, nb_sectors; int64_t end; struct iovec iov; end = s->common.len >> BDRV_SECTOR_BITS; s->sector_num = bdrv_get_next_dirty(source, s->sector_num); nb_sectors = MIN(BDRV_SECTORS_PER_DIRTY_CHUNK, end - s->sector_num); bdrv_reset_dirty(source, s->sector_num, nb_sectors); iov.iov_base = s->buf; iov.iov_len = nb_sectors * 512; qemu_iovec_init_external(&qiov, &iov, 1); trace_mirror_one_iteration(s, s->sector_num, nb_sectors); ret = bdrv_co_readv(source, s->sector_num, nb_sectors, &qiov); if (ret < 0) { return ret; } return bdrv_co_writev(target, s->sector_num, nb_sectors, &qiov); }
[ "static int VAR_0 mirror_iteration(MirrorBlockJob *s)\n{", "BlockDriverState *source = s->common.bs;", "BlockDriverState *target = s->target;", "QEMUIOVector qiov;", "int ret, nb_sectors;", "int64_t end;", "struct iovec iov;", "end = s->common.len >> BDRV_SECTOR_BITS;", "s->sector_num = bdrv_get_next_dirty(source, s->sector_num);", "nb_sectors = MIN(BDRV_SECTORS_PER_DIRTY_CHUNK, end - s->sector_num);", "bdrv_reset_dirty(source, s->sector_num, nb_sectors);", "iov.iov_base = s->buf;", "iov.iov_len = nb_sectors * 512;", "qemu_iovec_init_external(&qiov, &iov, 1);", "trace_mirror_one_iteration(s, s->sector_num, nb_sectors);", "ret = bdrv_co_readv(source, s->sector_num, nb_sectors, &qiov);", "if (ret < 0) {", "return ret;", "}", "return bdrv_co_writev(target, s->sector_num, nb_sectors, &qiov);", "}" ]
[ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ] ]
15,558
static void decode_rr_divide(CPUTriCoreState *env, DisasContext *ctx) { uint32_t op2; int r1, r2, r3; TCGv temp, temp2; op2 = MASK_OP_RR_OP2(ctx->opcode); r3 = MASK_OP_RR_D(ctx->opcode); r2 = MASK_OP_RR_S2(ctx->opcode); r1 = MASK_OP_RR_S1(ctx->opcode); switch (op2) { case OPC2_32_RR_BMERGE: gen_helper_bmerge(cpu_gpr_d[r3], cpu_gpr_d[r1], cpu_gpr_d[r2]); break; case OPC2_32_RR_BSPLIT: gen_bsplit(cpu_gpr_d[r3], cpu_gpr_d[r3+1], cpu_gpr_d[r1]); break; case OPC2_32_RR_DVINIT_B: gen_dvinit_b(env, cpu_gpr_d[r3], cpu_gpr_d[r3+1], cpu_gpr_d[r1], cpu_gpr_d[r2]); break; case OPC2_32_RR_DVINIT_BU: temp = tcg_temp_new(); temp2 = tcg_temp_new(); /* reset av */ tcg_gen_movi_tl(cpu_PSW_AV, 0); if (!tricore_feature(env, TRICORE_FEATURE_131)) { /* overflow = (abs(D[r3+1]) >= abs(D[r2])) */ tcg_gen_neg_tl(temp, cpu_gpr_d[r3+1]); /* use cpu_PSW_AV to compare against 0 */ tcg_gen_movcond_tl(TCG_COND_LT, temp, cpu_gpr_d[r3+1], cpu_PSW_AV, temp, cpu_gpr_d[r3+1]); tcg_gen_neg_tl(temp2, cpu_gpr_d[r2]); tcg_gen_movcond_tl(TCG_COND_LT, temp2, cpu_gpr_d[r2], cpu_PSW_AV, temp2, cpu_gpr_d[r2]); tcg_gen_setcond_tl(TCG_COND_GE, cpu_PSW_V, temp, temp2); } else { /* overflow = (D[b] == 0) */ tcg_gen_setcondi_tl(TCG_COND_EQ, cpu_PSW_V, cpu_gpr_d[r2], 0); } tcg_gen_shli_tl(cpu_PSW_V, cpu_PSW_V, 31); /* sv */ tcg_gen_or_tl(cpu_PSW_SV, cpu_PSW_SV, cpu_PSW_V); /* write result */ tcg_gen_shri_tl(temp, cpu_gpr_d[r1], 8); tcg_gen_shli_tl(cpu_gpr_d[r3], cpu_gpr_d[r1], 24); tcg_gen_mov_tl(cpu_gpr_d[r3+1], temp); tcg_temp_free(temp); tcg_temp_free(temp2); break; case OPC2_32_RR_DVINIT_H: gen_dvinit_h(env, cpu_gpr_d[r3], cpu_gpr_d[r3+1], cpu_gpr_d[r1], cpu_gpr_d[r2]); break; case OPC2_32_RR_DVINIT_HU: temp = tcg_temp_new(); temp2 = tcg_temp_new(); /* reset av */ tcg_gen_movi_tl(cpu_PSW_AV, 0); if (!tricore_feature(env, TRICORE_FEATURE_131)) { /* overflow = (abs(D[r3+1]) >= abs(D[r2])) */ tcg_gen_neg_tl(temp, cpu_gpr_d[r3+1]); /* use cpu_PSW_AV to compare against 0 */ tcg_gen_movcond_tl(TCG_COND_LT, temp, cpu_gpr_d[r3+1], cpu_PSW_AV, temp, cpu_gpr_d[r3+1]); tcg_gen_neg_tl(temp2, cpu_gpr_d[r2]); tcg_gen_movcond_tl(TCG_COND_LT, temp2, cpu_gpr_d[r2], cpu_PSW_AV, temp2, cpu_gpr_d[r2]); tcg_gen_setcond_tl(TCG_COND_GE, cpu_PSW_V, temp, temp2); } else { /* overflow = (D[b] == 0) */ tcg_gen_setcondi_tl(TCG_COND_EQ, cpu_PSW_V, cpu_gpr_d[r2], 0); } tcg_gen_shli_tl(cpu_PSW_V, cpu_PSW_V, 31); /* sv */ tcg_gen_or_tl(cpu_PSW_SV, cpu_PSW_SV, cpu_PSW_V); /* write result */ tcg_gen_mov_tl(temp, cpu_gpr_d[r1]); tcg_gen_shri_tl(cpu_gpr_d[r3+1], temp, 16); tcg_gen_shli_tl(cpu_gpr_d[r3], temp, 16); tcg_temp_free(temp); tcg_temp_free(temp2); break; case OPC2_32_RR_DVINIT: temp = tcg_temp_new(); temp2 = tcg_temp_new(); /* overflow = ((D[b] == 0) || ((D[b] == 0xFFFFFFFF) && (D[a] == 0x80000000))) */ tcg_gen_setcondi_tl(TCG_COND_EQ, temp, cpu_gpr_d[r2], 0xffffffff); tcg_gen_setcondi_tl(TCG_COND_EQ, temp2, cpu_gpr_d[r1], 0x80000000); tcg_gen_and_tl(temp, temp, temp2); tcg_gen_setcondi_tl(TCG_COND_EQ, temp2, cpu_gpr_d[r2], 0); tcg_gen_or_tl(cpu_PSW_V, temp, temp2); tcg_gen_shli_tl(cpu_PSW_V, cpu_PSW_V, 31); /* sv */ tcg_gen_or_tl(cpu_PSW_SV, cpu_PSW_SV, cpu_PSW_V); /* reset av */ tcg_gen_movi_tl(cpu_PSW_AV, 0); /* write result */ tcg_gen_mov_tl(cpu_gpr_d[r3], cpu_gpr_d[r1]); /* sign extend to high reg */ tcg_gen_sari_tl(cpu_gpr_d[r3+1], cpu_gpr_d[r1], 31); tcg_temp_free(temp); tcg_temp_free(temp2); break; case OPC2_32_RR_DVINIT_U: /* overflow = (D[b] == 0) */ tcg_gen_setcondi_tl(TCG_COND_EQ, cpu_PSW_V, cpu_gpr_d[r2], 0); tcg_gen_shli_tl(cpu_PSW_V, cpu_PSW_V, 31); /* sv */ tcg_gen_or_tl(cpu_PSW_SV, cpu_PSW_SV, cpu_PSW_V); /* reset av */ tcg_gen_movi_tl(cpu_PSW_AV, 0); /* write result */ tcg_gen_mov_tl(cpu_gpr_d[r3], cpu_gpr_d[r1]); /* zero extend to high reg*/ tcg_gen_movi_tl(cpu_gpr_d[r3+1], 0); break; case OPC2_32_RR_PARITY: gen_helper_parity(cpu_gpr_d[r3], cpu_gpr_d[r1]); break; case OPC2_32_RR_UNPACK: gen_unpack(cpu_gpr_d[r3], cpu_gpr_d[r3+1], cpu_gpr_d[r1]); break; } }
true
qemu
2b9d09bb3c44de934de03864d56ddd8a38ed863a
static void decode_rr_divide(CPUTriCoreState *env, DisasContext *ctx) { uint32_t op2; int r1, r2, r3; TCGv temp, temp2; op2 = MASK_OP_RR_OP2(ctx->opcode); r3 = MASK_OP_RR_D(ctx->opcode); r2 = MASK_OP_RR_S2(ctx->opcode); r1 = MASK_OP_RR_S1(ctx->opcode); switch (op2) { case OPC2_32_RR_BMERGE: gen_helper_bmerge(cpu_gpr_d[r3], cpu_gpr_d[r1], cpu_gpr_d[r2]); break; case OPC2_32_RR_BSPLIT: gen_bsplit(cpu_gpr_d[r3], cpu_gpr_d[r3+1], cpu_gpr_d[r1]); break; case OPC2_32_RR_DVINIT_B: gen_dvinit_b(env, cpu_gpr_d[r3], cpu_gpr_d[r3+1], cpu_gpr_d[r1], cpu_gpr_d[r2]); break; case OPC2_32_RR_DVINIT_BU: temp = tcg_temp_new(); temp2 = tcg_temp_new(); tcg_gen_movi_tl(cpu_PSW_AV, 0); if (!tricore_feature(env, TRICORE_FEATURE_131)) { tcg_gen_neg_tl(temp, cpu_gpr_d[r3+1]); tcg_gen_movcond_tl(TCG_COND_LT, temp, cpu_gpr_d[r3+1], cpu_PSW_AV, temp, cpu_gpr_d[r3+1]); tcg_gen_neg_tl(temp2, cpu_gpr_d[r2]); tcg_gen_movcond_tl(TCG_COND_LT, temp2, cpu_gpr_d[r2], cpu_PSW_AV, temp2, cpu_gpr_d[r2]); tcg_gen_setcond_tl(TCG_COND_GE, cpu_PSW_V, temp, temp2); } else { tcg_gen_setcondi_tl(TCG_COND_EQ, cpu_PSW_V, cpu_gpr_d[r2], 0); } tcg_gen_shli_tl(cpu_PSW_V, cpu_PSW_V, 31); tcg_gen_or_tl(cpu_PSW_SV, cpu_PSW_SV, cpu_PSW_V); tcg_gen_shri_tl(temp, cpu_gpr_d[r1], 8); tcg_gen_shli_tl(cpu_gpr_d[r3], cpu_gpr_d[r1], 24); tcg_gen_mov_tl(cpu_gpr_d[r3+1], temp); tcg_temp_free(temp); tcg_temp_free(temp2); break; case OPC2_32_RR_DVINIT_H: gen_dvinit_h(env, cpu_gpr_d[r3], cpu_gpr_d[r3+1], cpu_gpr_d[r1], cpu_gpr_d[r2]); break; case OPC2_32_RR_DVINIT_HU: temp = tcg_temp_new(); temp2 = tcg_temp_new(); tcg_gen_movi_tl(cpu_PSW_AV, 0); if (!tricore_feature(env, TRICORE_FEATURE_131)) { tcg_gen_neg_tl(temp, cpu_gpr_d[r3+1]); tcg_gen_movcond_tl(TCG_COND_LT, temp, cpu_gpr_d[r3+1], cpu_PSW_AV, temp, cpu_gpr_d[r3+1]); tcg_gen_neg_tl(temp2, cpu_gpr_d[r2]); tcg_gen_movcond_tl(TCG_COND_LT, temp2, cpu_gpr_d[r2], cpu_PSW_AV, temp2, cpu_gpr_d[r2]); tcg_gen_setcond_tl(TCG_COND_GE, cpu_PSW_V, temp, temp2); } else { tcg_gen_setcondi_tl(TCG_COND_EQ, cpu_PSW_V, cpu_gpr_d[r2], 0); } tcg_gen_shli_tl(cpu_PSW_V, cpu_PSW_V, 31); tcg_gen_or_tl(cpu_PSW_SV, cpu_PSW_SV, cpu_PSW_V); tcg_gen_mov_tl(temp, cpu_gpr_d[r1]); tcg_gen_shri_tl(cpu_gpr_d[r3+1], temp, 16); tcg_gen_shli_tl(cpu_gpr_d[r3], temp, 16); tcg_temp_free(temp); tcg_temp_free(temp2); break; case OPC2_32_RR_DVINIT: temp = tcg_temp_new(); temp2 = tcg_temp_new(); tcg_gen_setcondi_tl(TCG_COND_EQ, temp, cpu_gpr_d[r2], 0xffffffff); tcg_gen_setcondi_tl(TCG_COND_EQ, temp2, cpu_gpr_d[r1], 0x80000000); tcg_gen_and_tl(temp, temp, temp2); tcg_gen_setcondi_tl(TCG_COND_EQ, temp2, cpu_gpr_d[r2], 0); tcg_gen_or_tl(cpu_PSW_V, temp, temp2); tcg_gen_shli_tl(cpu_PSW_V, cpu_PSW_V, 31); tcg_gen_or_tl(cpu_PSW_SV, cpu_PSW_SV, cpu_PSW_V); tcg_gen_movi_tl(cpu_PSW_AV, 0); tcg_gen_mov_tl(cpu_gpr_d[r3], cpu_gpr_d[r1]); tcg_gen_sari_tl(cpu_gpr_d[r3+1], cpu_gpr_d[r1], 31); tcg_temp_free(temp); tcg_temp_free(temp2); break; case OPC2_32_RR_DVINIT_U: tcg_gen_setcondi_tl(TCG_COND_EQ, cpu_PSW_V, cpu_gpr_d[r2], 0); tcg_gen_shli_tl(cpu_PSW_V, cpu_PSW_V, 31); tcg_gen_or_tl(cpu_PSW_SV, cpu_PSW_SV, cpu_PSW_V); tcg_gen_movi_tl(cpu_PSW_AV, 0); tcg_gen_mov_tl(cpu_gpr_d[r3], cpu_gpr_d[r1]); tcg_gen_movi_tl(cpu_gpr_d[r3+1], 0); break; case OPC2_32_RR_PARITY: gen_helper_parity(cpu_gpr_d[r3], cpu_gpr_d[r1]); break; case OPC2_32_RR_UNPACK: gen_unpack(cpu_gpr_d[r3], cpu_gpr_d[r3+1], cpu_gpr_d[r1]); break; } }
{ "code": [ " TCGv temp, temp2;", " tcg_gen_neg_tl(temp, cpu_gpr_d[r3+1]);", " tcg_gen_movcond_tl(TCG_COND_LT, temp, cpu_gpr_d[r3+1], cpu_PSW_AV,", " temp, cpu_gpr_d[r3+1]);", " tcg_gen_shri_tl(temp, cpu_gpr_d[r1], 8);", " tcg_gen_mov_tl(cpu_gpr_d[r3+1], temp);", " tcg_gen_neg_tl(temp, cpu_gpr_d[r3+1]);", " tcg_gen_movcond_tl(TCG_COND_LT, temp, cpu_gpr_d[r3+1], cpu_PSW_AV,", " temp, cpu_gpr_d[r3+1]);", " tcg_gen_mov_tl(temp, cpu_gpr_d[r1]);", " tcg_gen_shri_tl(cpu_gpr_d[r3+1], temp, 16);", " tcg_gen_shli_tl(cpu_gpr_d[r3], temp, 16);" ], "line_no": [ 11, 61, 65, 67, 93, 97, 61, 65, 67, 161, 163, 165 ] }
static void FUNC_0(CPUTriCoreState *VAR_0, DisasContext *VAR_1) { uint32_t op2; int VAR_2, VAR_3, VAR_4; TCGv temp, temp2; op2 = MASK_OP_RR_OP2(VAR_1->opcode); VAR_4 = MASK_OP_RR_D(VAR_1->opcode); VAR_3 = MASK_OP_RR_S2(VAR_1->opcode); VAR_2 = MASK_OP_RR_S1(VAR_1->opcode); switch (op2) { case OPC2_32_RR_BMERGE: gen_helper_bmerge(cpu_gpr_d[VAR_4], cpu_gpr_d[VAR_2], cpu_gpr_d[VAR_3]); break; case OPC2_32_RR_BSPLIT: gen_bsplit(cpu_gpr_d[VAR_4], cpu_gpr_d[VAR_4+1], cpu_gpr_d[VAR_2]); break; case OPC2_32_RR_DVINIT_B: gen_dvinit_b(VAR_0, cpu_gpr_d[VAR_4], cpu_gpr_d[VAR_4+1], cpu_gpr_d[VAR_2], cpu_gpr_d[VAR_3]); break; case OPC2_32_RR_DVINIT_BU: temp = tcg_temp_new(); temp2 = tcg_temp_new(); tcg_gen_movi_tl(cpu_PSW_AV, 0); if (!tricore_feature(VAR_0, TRICORE_FEATURE_131)) { tcg_gen_neg_tl(temp, cpu_gpr_d[VAR_4+1]); tcg_gen_movcond_tl(TCG_COND_LT, temp, cpu_gpr_d[VAR_4+1], cpu_PSW_AV, temp, cpu_gpr_d[VAR_4+1]); tcg_gen_neg_tl(temp2, cpu_gpr_d[VAR_3]); tcg_gen_movcond_tl(TCG_COND_LT, temp2, cpu_gpr_d[VAR_3], cpu_PSW_AV, temp2, cpu_gpr_d[VAR_3]); tcg_gen_setcond_tl(TCG_COND_GE, cpu_PSW_V, temp, temp2); } else { tcg_gen_setcondi_tl(TCG_COND_EQ, cpu_PSW_V, cpu_gpr_d[VAR_3], 0); } tcg_gen_shli_tl(cpu_PSW_V, cpu_PSW_V, 31); tcg_gen_or_tl(cpu_PSW_SV, cpu_PSW_SV, cpu_PSW_V); tcg_gen_shri_tl(temp, cpu_gpr_d[VAR_2], 8); tcg_gen_shli_tl(cpu_gpr_d[VAR_4], cpu_gpr_d[VAR_2], 24); tcg_gen_mov_tl(cpu_gpr_d[VAR_4+1], temp); tcg_temp_free(temp); tcg_temp_free(temp2); break; case OPC2_32_RR_DVINIT_H: gen_dvinit_h(VAR_0, cpu_gpr_d[VAR_4], cpu_gpr_d[VAR_4+1], cpu_gpr_d[VAR_2], cpu_gpr_d[VAR_3]); break; case OPC2_32_RR_DVINIT_HU: temp = tcg_temp_new(); temp2 = tcg_temp_new(); tcg_gen_movi_tl(cpu_PSW_AV, 0); if (!tricore_feature(VAR_0, TRICORE_FEATURE_131)) { tcg_gen_neg_tl(temp, cpu_gpr_d[VAR_4+1]); tcg_gen_movcond_tl(TCG_COND_LT, temp, cpu_gpr_d[VAR_4+1], cpu_PSW_AV, temp, cpu_gpr_d[VAR_4+1]); tcg_gen_neg_tl(temp2, cpu_gpr_d[VAR_3]); tcg_gen_movcond_tl(TCG_COND_LT, temp2, cpu_gpr_d[VAR_3], cpu_PSW_AV, temp2, cpu_gpr_d[VAR_3]); tcg_gen_setcond_tl(TCG_COND_GE, cpu_PSW_V, temp, temp2); } else { tcg_gen_setcondi_tl(TCG_COND_EQ, cpu_PSW_V, cpu_gpr_d[VAR_3], 0); } tcg_gen_shli_tl(cpu_PSW_V, cpu_PSW_V, 31); tcg_gen_or_tl(cpu_PSW_SV, cpu_PSW_SV, cpu_PSW_V); tcg_gen_mov_tl(temp, cpu_gpr_d[VAR_2]); tcg_gen_shri_tl(cpu_gpr_d[VAR_4+1], temp, 16); tcg_gen_shli_tl(cpu_gpr_d[VAR_4], temp, 16); tcg_temp_free(temp); tcg_temp_free(temp2); break; case OPC2_32_RR_DVINIT: temp = tcg_temp_new(); temp2 = tcg_temp_new(); tcg_gen_setcondi_tl(TCG_COND_EQ, temp, cpu_gpr_d[VAR_3], 0xffffffff); tcg_gen_setcondi_tl(TCG_COND_EQ, temp2, cpu_gpr_d[VAR_2], 0x80000000); tcg_gen_and_tl(temp, temp, temp2); tcg_gen_setcondi_tl(TCG_COND_EQ, temp2, cpu_gpr_d[VAR_3], 0); tcg_gen_or_tl(cpu_PSW_V, temp, temp2); tcg_gen_shli_tl(cpu_PSW_V, cpu_PSW_V, 31); tcg_gen_or_tl(cpu_PSW_SV, cpu_PSW_SV, cpu_PSW_V); tcg_gen_movi_tl(cpu_PSW_AV, 0); tcg_gen_mov_tl(cpu_gpr_d[VAR_4], cpu_gpr_d[VAR_2]); tcg_gen_sari_tl(cpu_gpr_d[VAR_4+1], cpu_gpr_d[VAR_2], 31); tcg_temp_free(temp); tcg_temp_free(temp2); break; case OPC2_32_RR_DVINIT_U: tcg_gen_setcondi_tl(TCG_COND_EQ, cpu_PSW_V, cpu_gpr_d[VAR_3], 0); tcg_gen_shli_tl(cpu_PSW_V, cpu_PSW_V, 31); tcg_gen_or_tl(cpu_PSW_SV, cpu_PSW_SV, cpu_PSW_V); tcg_gen_movi_tl(cpu_PSW_AV, 0); tcg_gen_mov_tl(cpu_gpr_d[VAR_4], cpu_gpr_d[VAR_2]); tcg_gen_movi_tl(cpu_gpr_d[VAR_4+1], 0); break; case OPC2_32_RR_PARITY: gen_helper_parity(cpu_gpr_d[VAR_4], cpu_gpr_d[VAR_2]); break; case OPC2_32_RR_UNPACK: gen_unpack(cpu_gpr_d[VAR_4], cpu_gpr_d[VAR_4+1], cpu_gpr_d[VAR_2]); break; } }
[ "static void FUNC_0(CPUTriCoreState *VAR_0, DisasContext *VAR_1)\n{", "uint32_t op2;", "int VAR_2, VAR_3, VAR_4;", "TCGv temp, temp2;", "op2 = MASK_OP_RR_OP2(VAR_1->opcode);", "VAR_4 = MASK_OP_RR_D(VAR_1->opcode);", "VAR_3 = MASK_OP_RR_S2(VAR_1->opcode);", "VAR_2 = MASK_OP_RR_S1(VAR_1->opcode);", "switch (op2) {", "case OPC2_32_RR_BMERGE:\ngen_helper_bmerge(cpu_gpr_d[VAR_4], cpu_gpr_d[VAR_2], cpu_gpr_d[VAR_3]);", "break;", "case OPC2_32_RR_BSPLIT:\ngen_bsplit(cpu_gpr_d[VAR_4], cpu_gpr_d[VAR_4+1], cpu_gpr_d[VAR_2]);", "break;", "case OPC2_32_RR_DVINIT_B:\ngen_dvinit_b(VAR_0, cpu_gpr_d[VAR_4], cpu_gpr_d[VAR_4+1], cpu_gpr_d[VAR_2],\ncpu_gpr_d[VAR_3]);", "break;", "case OPC2_32_RR_DVINIT_BU:\ntemp = tcg_temp_new();", "temp2 = tcg_temp_new();", "tcg_gen_movi_tl(cpu_PSW_AV, 0);", "if (!tricore_feature(VAR_0, TRICORE_FEATURE_131)) {", "tcg_gen_neg_tl(temp, cpu_gpr_d[VAR_4+1]);", "tcg_gen_movcond_tl(TCG_COND_LT, temp, cpu_gpr_d[VAR_4+1], cpu_PSW_AV,\ntemp, cpu_gpr_d[VAR_4+1]);", "tcg_gen_neg_tl(temp2, cpu_gpr_d[VAR_3]);", "tcg_gen_movcond_tl(TCG_COND_LT, temp2, cpu_gpr_d[VAR_3], cpu_PSW_AV,\ntemp2, cpu_gpr_d[VAR_3]);", "tcg_gen_setcond_tl(TCG_COND_GE, cpu_PSW_V, temp, temp2);", "} else {", "tcg_gen_setcondi_tl(TCG_COND_EQ, cpu_PSW_V, cpu_gpr_d[VAR_3], 0);", "}", "tcg_gen_shli_tl(cpu_PSW_V, cpu_PSW_V, 31);", "tcg_gen_or_tl(cpu_PSW_SV, cpu_PSW_SV, cpu_PSW_V);", "tcg_gen_shri_tl(temp, cpu_gpr_d[VAR_2], 8);", "tcg_gen_shli_tl(cpu_gpr_d[VAR_4], cpu_gpr_d[VAR_2], 24);", "tcg_gen_mov_tl(cpu_gpr_d[VAR_4+1], temp);", "tcg_temp_free(temp);", "tcg_temp_free(temp2);", "break;", "case OPC2_32_RR_DVINIT_H:\ngen_dvinit_h(VAR_0, cpu_gpr_d[VAR_4], cpu_gpr_d[VAR_4+1], cpu_gpr_d[VAR_2],\ncpu_gpr_d[VAR_3]);", "break;", "case OPC2_32_RR_DVINIT_HU:\ntemp = tcg_temp_new();", "temp2 = tcg_temp_new();", "tcg_gen_movi_tl(cpu_PSW_AV, 0);", "if (!tricore_feature(VAR_0, TRICORE_FEATURE_131)) {", "tcg_gen_neg_tl(temp, cpu_gpr_d[VAR_4+1]);", "tcg_gen_movcond_tl(TCG_COND_LT, temp, cpu_gpr_d[VAR_4+1], cpu_PSW_AV,\ntemp, cpu_gpr_d[VAR_4+1]);", "tcg_gen_neg_tl(temp2, cpu_gpr_d[VAR_3]);", "tcg_gen_movcond_tl(TCG_COND_LT, temp2, cpu_gpr_d[VAR_3], cpu_PSW_AV,\ntemp2, cpu_gpr_d[VAR_3]);", "tcg_gen_setcond_tl(TCG_COND_GE, cpu_PSW_V, temp, temp2);", "} else {", "tcg_gen_setcondi_tl(TCG_COND_EQ, cpu_PSW_V, cpu_gpr_d[VAR_3], 0);", "}", "tcg_gen_shli_tl(cpu_PSW_V, cpu_PSW_V, 31);", "tcg_gen_or_tl(cpu_PSW_SV, cpu_PSW_SV, cpu_PSW_V);", "tcg_gen_mov_tl(temp, cpu_gpr_d[VAR_2]);", "tcg_gen_shri_tl(cpu_gpr_d[VAR_4+1], temp, 16);", "tcg_gen_shli_tl(cpu_gpr_d[VAR_4], temp, 16);", "tcg_temp_free(temp);", "tcg_temp_free(temp2);", "break;", "case OPC2_32_RR_DVINIT:\ntemp = tcg_temp_new();", "temp2 = tcg_temp_new();", "tcg_gen_setcondi_tl(TCG_COND_EQ, temp, cpu_gpr_d[VAR_3], 0xffffffff);", "tcg_gen_setcondi_tl(TCG_COND_EQ, temp2, cpu_gpr_d[VAR_2], 0x80000000);", "tcg_gen_and_tl(temp, temp, temp2);", "tcg_gen_setcondi_tl(TCG_COND_EQ, temp2, cpu_gpr_d[VAR_3], 0);", "tcg_gen_or_tl(cpu_PSW_V, temp, temp2);", "tcg_gen_shli_tl(cpu_PSW_V, cpu_PSW_V, 31);", "tcg_gen_or_tl(cpu_PSW_SV, cpu_PSW_SV, cpu_PSW_V);", "tcg_gen_movi_tl(cpu_PSW_AV, 0);", "tcg_gen_mov_tl(cpu_gpr_d[VAR_4], cpu_gpr_d[VAR_2]);", "tcg_gen_sari_tl(cpu_gpr_d[VAR_4+1], cpu_gpr_d[VAR_2], 31);", "tcg_temp_free(temp);", "tcg_temp_free(temp2);", "break;", "case OPC2_32_RR_DVINIT_U:\ntcg_gen_setcondi_tl(TCG_COND_EQ, cpu_PSW_V, cpu_gpr_d[VAR_3], 0);", "tcg_gen_shli_tl(cpu_PSW_V, cpu_PSW_V, 31);", "tcg_gen_or_tl(cpu_PSW_SV, cpu_PSW_SV, cpu_PSW_V);", "tcg_gen_movi_tl(cpu_PSW_AV, 0);", "tcg_gen_mov_tl(cpu_gpr_d[VAR_4], cpu_gpr_d[VAR_2]);", "tcg_gen_movi_tl(cpu_gpr_d[VAR_4+1], 0);", "break;", "case OPC2_32_RR_PARITY:\ngen_helper_parity(cpu_gpr_d[VAR_4], cpu_gpr_d[VAR_2]);", "break;", "case OPC2_32_RR_UNPACK:\ngen_unpack(cpu_gpr_d[VAR_4], cpu_gpr_d[VAR_4+1], cpu_gpr_d[VAR_2]);", "break;", "}", "}" ]
[ 0, 0, 0, 1, 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, 1, 0, 1, 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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27, 29 ], [ 31 ], [ 33, 35 ], [ 37 ], [ 39, 41, 43 ], [ 45 ], [ 47, 49 ], [ 51 ], [ 55 ], [ 57 ], [ 61 ], [ 65, 67 ], [ 69 ], [ 71, 73 ], [ 75 ], [ 77 ], [ 81 ], [ 83 ], [ 85 ], [ 89 ], [ 93 ], [ 95 ], [ 97 ], [ 101 ], [ 103 ], [ 105 ], [ 107, 109, 111 ], [ 113 ], [ 115, 117 ], [ 119 ], [ 123 ], [ 125 ], [ 129 ], [ 133, 135 ], [ 137 ], [ 139, 141 ], [ 143 ], [ 145 ], [ 149 ], [ 151 ], [ 153 ], [ 157 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173, 175 ], [ 177 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 197 ], [ 201 ], [ 205 ], [ 209 ], [ 211 ], [ 213 ], [ 215 ], [ 217, 221 ], [ 223 ], [ 227 ], [ 231 ], [ 235 ], [ 239 ], [ 241 ], [ 243, 245 ], [ 247 ], [ 249, 251 ], [ 253 ], [ 255 ], [ 257 ] ]
15,559
static int local_unlinkat(FsContext *ctx, V9fsPath *dir, const char *name, int flags) { int ret; V9fsString fullname; char *buffer; v9fs_string_init(&fullname); v9fs_string_sprintf(&fullname, "%s/%s", dir->data, name); if (ctx->export_flags & V9FS_SM_MAPPED_FILE) { if (flags == AT_REMOVEDIR) { /* * If directory remove .virtfs_metadata contained in the * directory */ buffer = g_strdup_printf("%s/%s/%s", ctx->fs_root, fullname.data, VIRTFS_META_DIR); ret = remove(buffer); g_free(buffer); if (ret < 0 && errno != ENOENT) { /* * We didn't had the .virtfs_metadata file. May be file created * in non-mapped mode ?. Ignore ENOENT. */ goto err_out; } } /* * Now remove the name from parent directory * .virtfs_metadata directory. */ buffer = local_mapped_attr_path(ctx, fullname.data); ret = remove(buffer); g_free(buffer); if (ret < 0 && errno != ENOENT) { /* * We didn't had the .virtfs_metadata file. May be file created * in non-mapped mode ?. Ignore ENOENT. */ goto err_out; } } /* Remove the name finally */ buffer = rpath(ctx, fullname.data); ret = remove(buffer); g_free(buffer); err_out: v9fs_string_free(&fullname); return ret; }
true
qemu
df4938a6651b1f980018f9eaf86af43e6b9d7fed
static int local_unlinkat(FsContext *ctx, V9fsPath *dir, const char *name, int flags) { int ret; V9fsString fullname; char *buffer; v9fs_string_init(&fullname); v9fs_string_sprintf(&fullname, "%s/%s", dir->data, name); if (ctx->export_flags & V9FS_SM_MAPPED_FILE) { if (flags == AT_REMOVEDIR) { buffer = g_strdup_printf("%s/%s/%s", ctx->fs_root, fullname.data, VIRTFS_META_DIR); ret = remove(buffer); g_free(buffer); if (ret < 0 && errno != ENOENT) { goto err_out; } } buffer = local_mapped_attr_path(ctx, fullname.data); ret = remove(buffer); g_free(buffer); if (ret < 0 && errno != ENOENT) { goto err_out; } } buffer = rpath(ctx, fullname.data); ret = remove(buffer); g_free(buffer); err_out: v9fs_string_free(&fullname); return ret; }
{ "code": [ " V9fsString fullname;", " char *buffer;", " v9fs_string_init(&fullname);", " v9fs_string_sprintf(&fullname, \"%s/%s\", dir->data, name);", " if (ctx->export_flags & V9FS_SM_MAPPED_FILE) {", " if (flags == AT_REMOVEDIR) {", " buffer = g_strdup_printf(\"%s/%s/%s\", ctx->fs_root,", " fullname.data, VIRTFS_META_DIR);", " ret = remove(buffer);", " g_free(buffer);", " if (ret < 0 && errno != ENOENT) {", " goto err_out;", " buffer = local_mapped_attr_path(ctx, fullname.data);", " ret = remove(buffer);", " g_free(buffer);", " if (ret < 0 && errno != ENOENT) {", " goto err_out;", " buffer = rpath(ctx, fullname.data);", " ret = remove(buffer);", " g_free(buffer);", "err_out:", " v9fs_string_free(&fullname);" ], "line_no": [ 9, 11, 15, 19, 21, 23, 33, 35, 37, 39, 41, 51, 65, 67, 69, 71, 81, 89, 91, 93, 97, 99 ] }
static int FUNC_0(FsContext *VAR_0, V9fsPath *VAR_1, const char *VAR_2, int VAR_3) { int VAR_4; V9fsString fullname; char *VAR_5; v9fs_string_init(&fullname); v9fs_string_sprintf(&fullname, "%s/%s", VAR_1->data, VAR_2); if (VAR_0->export_flags & V9FS_SM_MAPPED_FILE) { if (VAR_3 == AT_REMOVEDIR) { VAR_5 = g_strdup_printf("%s/%s/%s", VAR_0->fs_root, fullname.data, VIRTFS_META_DIR); VAR_4 = remove(VAR_5); g_free(VAR_5); if (VAR_4 < 0 && errno != ENOENT) { goto err_out; } } VAR_5 = local_mapped_attr_path(VAR_0, fullname.data); VAR_4 = remove(VAR_5); g_free(VAR_5); if (VAR_4 < 0 && errno != ENOENT) { goto err_out; } } VAR_5 = rpath(VAR_0, fullname.data); VAR_4 = remove(VAR_5); g_free(VAR_5); err_out: v9fs_string_free(&fullname); return VAR_4; }
[ "static int FUNC_0(FsContext *VAR_0, V9fsPath *VAR_1,\nconst char *VAR_2, int VAR_3)\n{", "int VAR_4;", "V9fsString fullname;", "char *VAR_5;", "v9fs_string_init(&fullname);", "v9fs_string_sprintf(&fullname, \"%s/%s\", VAR_1->data, VAR_2);", "if (VAR_0->export_flags & V9FS_SM_MAPPED_FILE) {", "if (VAR_3 == AT_REMOVEDIR) {", "VAR_5 = g_strdup_printf(\"%s/%s/%s\", VAR_0->fs_root,\nfullname.data, VIRTFS_META_DIR);", "VAR_4 = remove(VAR_5);", "g_free(VAR_5);", "if (VAR_4 < 0 && errno != ENOENT) {", "goto err_out;", "}", "}", "VAR_5 = local_mapped_attr_path(VAR_0, fullname.data);", "VAR_4 = remove(VAR_5);", "g_free(VAR_5);", "if (VAR_4 < 0 && errno != ENOENT) {", "goto err_out;", "}", "}", "VAR_5 = rpath(VAR_0, fullname.data);", "VAR_4 = remove(VAR_5);", "g_free(VAR_5);", "err_out:\nv9fs_string_free(&fullname);", "return VAR_4;", "}" ]
[ 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 33, 35 ], [ 37 ], [ 39 ], [ 41 ], [ 51 ], [ 53 ], [ 55 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 81 ], [ 83 ], [ 85 ], [ 89 ], [ 91 ], [ 93 ], [ 97, 99 ], [ 101 ], [ 103 ] ]
15,560
static uint64_t pl011_read(void *opaque, hwaddr offset, unsigned size) { PL011State *s = (PL011State *)opaque; uint32_t c; if (offset >= 0xfe0 && offset < 0x1000) { return s->id[(offset - 0xfe0) >> 2]; } switch (offset >> 2) { case 0: /* UARTDR */ s->flags &= ~PL011_FLAG_RXFF; c = s->read_fifo[s->read_pos]; if (s->read_count > 0) { s->read_count--; if (++s->read_pos == 16) s->read_pos = 0; } if (s->read_count == 0) { s->flags |= PL011_FLAG_RXFE; } if (s->read_count == s->read_trigger - 1) s->int_level &= ~ PL011_INT_RX; pl011_update(s); if (s->chr) { qemu_chr_accept_input(s->chr); } return c; case 1: /* UARTCR */ return 0; case 6: /* UARTFR */ return s->flags; case 8: /* UARTILPR */ return s->ilpr; case 9: /* UARTIBRD */ return s->ibrd; case 10: /* UARTFBRD */ return s->fbrd; case 11: /* UARTLCR_H */ return s->lcr; case 12: /* UARTCR */ return s->cr; case 13: /* UARTIFLS */ return s->ifl; case 14: /* UARTIMSC */ return s->int_enabled; case 15: /* UARTRIS */ return s->int_level; case 16: /* UARTMIS */ return s->int_level & s->int_enabled; case 18: /* UARTDMACR */ return s->dmacr; default: qemu_log_mask(LOG_GUEST_ERROR, "pl011_read: Bad offset %x\n", (int)offset); return 0; } }
true
qemu
ce8f0905a59232982c8a220169e11c14c73e7dea
static uint64_t pl011_read(void *opaque, hwaddr offset, unsigned size) { PL011State *s = (PL011State *)opaque; uint32_t c; if (offset >= 0xfe0 && offset < 0x1000) { return s->id[(offset - 0xfe0) >> 2]; } switch (offset >> 2) { case 0: s->flags &= ~PL011_FLAG_RXFF; c = s->read_fifo[s->read_pos]; if (s->read_count > 0) { s->read_count--; if (++s->read_pos == 16) s->read_pos = 0; } if (s->read_count == 0) { s->flags |= PL011_FLAG_RXFE; } if (s->read_count == s->read_trigger - 1) s->int_level &= ~ PL011_INT_RX; pl011_update(s); if (s->chr) { qemu_chr_accept_input(s->chr); } return c; case 1: return 0; case 6: return s->flags; case 8: return s->ilpr; case 9: return s->ibrd; case 10: return s->fbrd; case 11: return s->lcr; case 12: return s->cr; case 13: return s->ifl; case 14: return s->int_enabled; case 15: return s->int_level; case 16: return s->int_level & s->int_enabled; case 18: return s->dmacr; default: qemu_log_mask(LOG_GUEST_ERROR, "pl011_read: Bad offset %x\n", (int)offset); return 0; } }
{ "code": [ " return 0;" ], "line_no": [ 59 ] }
static uint64_t FUNC_0(void *opaque, hwaddr offset, unsigned size) { PL011State *s = (PL011State *)opaque; uint32_t c; if (offset >= 0xfe0 && offset < 0x1000) { return s->id[(offset - 0xfe0) >> 2]; } switch (offset >> 2) { case 0: s->flags &= ~PL011_FLAG_RXFF; c = s->read_fifo[s->read_pos]; if (s->read_count > 0) { s->read_count--; if (++s->read_pos == 16) s->read_pos = 0; } if (s->read_count == 0) { s->flags |= PL011_FLAG_RXFE; } if (s->read_count == s->read_trigger - 1) s->int_level &= ~ PL011_INT_RX; pl011_update(s); if (s->chr) { qemu_chr_accept_input(s->chr); } return c; case 1: return 0; case 6: return s->flags; case 8: return s->ilpr; case 9: return s->ibrd; case 10: return s->fbrd; case 11: return s->lcr; case 12: return s->cr; case 13: return s->ifl; case 14: return s->int_enabled; case 15: return s->int_level; case 16: return s->int_level & s->int_enabled; case 18: return s->dmacr; default: qemu_log_mask(LOG_GUEST_ERROR, "FUNC_0: Bad offset %x\n", (int)offset); return 0; } }
[ "static uint64_t FUNC_0(void *opaque, hwaddr offset,\nunsigned size)\n{", "PL011State *s = (PL011State *)opaque;", "uint32_t c;", "if (offset >= 0xfe0 && offset < 0x1000) {", "return s->id[(offset - 0xfe0) >> 2];", "}", "switch (offset >> 2) {", "case 0:\ns->flags &= ~PL011_FLAG_RXFF;", "c = s->read_fifo[s->read_pos];", "if (s->read_count > 0) {", "s->read_count--;", "if (++s->read_pos == 16)\ns->read_pos = 0;", "}", "if (s->read_count == 0) {", "s->flags |= PL011_FLAG_RXFE;", "}", "if (s->read_count == s->read_trigger - 1)\ns->int_level &= ~ PL011_INT_RX;", "pl011_update(s);", "if (s->chr) {", "qemu_chr_accept_input(s->chr);", "}", "return c;", "case 1:\nreturn 0;", "case 6:\nreturn s->flags;", "case 8:\nreturn s->ilpr;", "case 9:\nreturn s->ibrd;", "case 10:\nreturn s->fbrd;", "case 11:\nreturn s->lcr;", "case 12:\nreturn s->cr;", "case 13:\nreturn s->ifl;", "case 14:\nreturn s->int_enabled;", "case 15:\nreturn s->int_level;", "case 16:\nreturn s->int_level & s->int_enabled;", "case 18:\nreturn s->dmacr;", "default:\nqemu_log_mask(LOG_GUEST_ERROR,\n\"FUNC_0: Bad offset %x\\n\", (int)offset);", "return 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 ]
[ [ 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, 75 ], [ 77, 79 ], [ 81, 83 ], [ 85, 87 ], [ 89, 91 ], [ 93, 95 ], [ 97, 99 ], [ 101, 103 ], [ 105, 107, 109 ], [ 111 ], [ 113 ], [ 115 ] ]
15,561
static BlockAIOCB *inject_error(BlockDriverState *bs, BlockCompletionFunc *cb, void *opaque, BlkdebugRule *rule) { BDRVBlkdebugState *s = bs->opaque; int error = rule->options.inject.error; struct BlkdebugAIOCB *acb; QEMUBH *bh; if (rule->options.inject.once) { QSIMPLEQ_INIT(&s->active_rules); } if (rule->options.inject.immediately) { return NULL; } acb = qemu_aio_get(&blkdebug_aiocb_info, bs, cb, opaque); acb->ret = -error; bh = aio_bh_new(bdrv_get_aio_context(bs), error_callback_bh, acb); acb->bh = bh; qemu_bh_schedule(bh); return &acb->common; }
true
qemu
a069e2f1372a0a823ab506fc019852a2a652aa54
static BlockAIOCB *inject_error(BlockDriverState *bs, BlockCompletionFunc *cb, void *opaque, BlkdebugRule *rule) { BDRVBlkdebugState *s = bs->opaque; int error = rule->options.inject.error; struct BlkdebugAIOCB *acb; QEMUBH *bh; if (rule->options.inject.once) { QSIMPLEQ_INIT(&s->active_rules); } if (rule->options.inject.immediately) { return NULL; } acb = qemu_aio_get(&blkdebug_aiocb_info, bs, cb, opaque); acb->ret = -error; bh = aio_bh_new(bdrv_get_aio_context(bs), error_callback_bh, acb); acb->bh = bh; qemu_bh_schedule(bh); return &acb->common; }
{ "code": [ " QSIMPLEQ_INIT(&s->active_rules);", " if (rule->options.inject.immediately) {" ], "line_no": [ 19, 25 ] }
static BlockAIOCB *FUNC_0(BlockDriverState *bs, BlockCompletionFunc *cb, void *opaque, BlkdebugRule *rule) { BDRVBlkdebugState *s = bs->opaque; int VAR_0 = rule->options.inject.VAR_0; struct BlkdebugAIOCB *VAR_1; QEMUBH *bh; if (rule->options.inject.once) { QSIMPLEQ_INIT(&s->active_rules); } if (rule->options.inject.immediately) { return NULL; } VAR_1 = qemu_aio_get(&blkdebug_aiocb_info, bs, cb, opaque); VAR_1->ret = -VAR_0; bh = aio_bh_new(bdrv_get_aio_context(bs), error_callback_bh, VAR_1); VAR_1->bh = bh; qemu_bh_schedule(bh); return &VAR_1->common; }
[ "static BlockAIOCB *FUNC_0(BlockDriverState *bs,\nBlockCompletionFunc *cb, void *opaque, BlkdebugRule *rule)\n{", "BDRVBlkdebugState *s = bs->opaque;", "int VAR_0 = rule->options.inject.VAR_0;", "struct BlkdebugAIOCB *VAR_1;", "QEMUBH *bh;", "if (rule->options.inject.once) {", "QSIMPLEQ_INIT(&s->active_rules);", "}", "if (rule->options.inject.immediately) {", "return NULL;", "}", "VAR_1 = qemu_aio_get(&blkdebug_aiocb_info, bs, cb, opaque);", "VAR_1->ret = -VAR_0;", "bh = aio_bh_new(bdrv_get_aio_context(bs), error_callback_bh, VAR_1);", "VAR_1->bh = bh;", "qemu_bh_schedule(bh);", "return &VAR_1->common;", "}" ]
[ 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ] ]
15,562
static void colo_old_packet_check_one_conn(void *opaque, void *user_data) { Connection *conn = opaque; GList *result = NULL; int64_t check_time = REGULAR_PACKET_CHECK_MS; result = g_queue_find_custom(&conn->primary_list, &check_time, (GCompareFunc)colo_old_packet_check_one); if (result) { /* do checkpoint will flush old packet */ /* TODO: colo_notify_checkpoint();*/ } }
true
qemu
d25a7dabf242163ce95b60f6f75cf017b1715d55
static void colo_old_packet_check_one_conn(void *opaque, void *user_data) { Connection *conn = opaque; GList *result = NULL; int64_t check_time = REGULAR_PACKET_CHECK_MS; result = g_queue_find_custom(&conn->primary_list, &check_time, (GCompareFunc)colo_old_packet_check_one); if (result) { } }
{ "code": [ "static void colo_old_packet_check_one_conn(void *opaque,", " void *user_data)", " Connection *conn = opaque;" ], "line_no": [ 1, 3, 7 ] }
static void FUNC_0(void *VAR_0, void *VAR_1) { Connection *conn = VAR_0; GList *result = NULL; int64_t check_time = REGULAR_PACKET_CHECK_MS; result = g_queue_find_custom(&conn->primary_list, &check_time, (GCompareFunc)colo_old_packet_check_one); if (result) { } }
[ "static void FUNC_0(void *VAR_0,\nvoid *VAR_1)\n{", "Connection *conn = VAR_0;", "GList *result = NULL;", "int64_t check_time = REGULAR_PACKET_CHECK_MS;", "result = g_queue_find_custom(&conn->primary_list,\n&check_time,\n(GCompareFunc)colo_old_packet_check_one);", "if (result) {", "}", "}" ]
[ 1, 1, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15, 17, 19 ], [ 23 ], [ 29 ], [ 31 ] ]
15,563
int bdrv_open(BlockDriverState *bs, const char *filename, int snapshot) { int fd; int64_t size; struct cow_header_v2 cow_header; #ifndef _WIN32 char template[] = "/tmp/vl.XXXXXX"; int cow_fd; struct stat st; #endif bs->read_only = 0; bs->fd = -1; bs->cow_fd = -1; bs->cow_bitmap = NULL; strcpy(bs->filename, filename); /* open standard HD image */ #ifdef _WIN32 fd = open(filename, O_RDWR | O_BINARY); #else fd = open(filename, O_RDWR | O_LARGEFILE); #endif if (fd < 0) { /* read only image on disk */ #ifdef _WIN32 fd = open(filename, O_RDONLY | O_BINARY); #else fd = open(filename, O_RDONLY | O_LARGEFILE); #endif if (fd < 0) { perror(filename); goto fail; } if (!snapshot) bs->read_only = 1; } bs->fd = fd; /* see if it is a cow image */ if (read(fd, &cow_header, sizeof(cow_header)) != sizeof(cow_header)) { fprintf(stderr, "%s: could not read header\n", filename); goto fail; } #ifndef _WIN32 if (be32_to_cpu(cow_header.magic) == COW_MAGIC && be32_to_cpu(cow_header.version) == COW_VERSION) { /* cow image found */ size = cow_header.size; #ifndef WORDS_BIGENDIAN size = bswap64(size); #endif bs->total_sectors = size / 512; bs->cow_fd = fd; bs->fd = -1; if (cow_header.backing_file[0] != '\0') { if (stat(cow_header.backing_file, &st) != 0) { fprintf(stderr, "%s: could not find original disk image '%s'\n", filename, cow_header.backing_file); goto fail; } if (st.st_mtime != be32_to_cpu(cow_header.mtime)) { fprintf(stderr, "%s: original raw disk image '%s' does not match saved timestamp\n", filename, cow_header.backing_file); goto fail; } fd = open(cow_header.backing_file, O_RDONLY | O_LARGEFILE); if (fd < 0) goto fail; bs->fd = fd; } /* mmap the bitmap */ bs->cow_bitmap_size = ((bs->total_sectors + 7) >> 3) + sizeof(cow_header); bs->cow_bitmap_addr = mmap(get_mmap_addr(bs->cow_bitmap_size), bs->cow_bitmap_size, PROT_READ | PROT_WRITE, MAP_SHARED, bs->cow_fd, 0); if (bs->cow_bitmap_addr == MAP_FAILED) goto fail; bs->cow_bitmap = bs->cow_bitmap_addr + sizeof(cow_header); bs->cow_sectors_offset = (bs->cow_bitmap_size + 511) & ~511; snapshot = 0; } else #endif { /* standard raw image */ size = lseek64(fd, 0, SEEK_END); bs->total_sectors = size / 512; bs->fd = fd; } #ifndef _WIN32 if (snapshot) { /* create a temporary COW file */ cow_fd = mkstemp64(template); if (cow_fd < 0) goto fail; bs->cow_fd = cow_fd; unlink(template); /* just need to allocate bitmap */ bs->cow_bitmap_size = (bs->total_sectors + 7) >> 3; bs->cow_bitmap_addr = mmap(get_mmap_addr(bs->cow_bitmap_size), bs->cow_bitmap_size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); if (bs->cow_bitmap_addr == MAP_FAILED) goto fail; bs->cow_bitmap = bs->cow_bitmap_addr; bs->cow_sectors_offset = 0; } #endif bs->inserted = 1; /* call the change callback */ if (bs->change_cb) bs->change_cb(bs->change_opaque); return 0; fail: bdrv_close(bs); return -1; }
true
qemu
eba2af633fb8fa3b20ad578184d79e1f0eabcefe
int bdrv_open(BlockDriverState *bs, const char *filename, int snapshot) { int fd; int64_t size; struct cow_header_v2 cow_header; #ifndef _WIN32 char template[] = "/tmp/vl.XXXXXX"; int cow_fd; struct stat st; #endif bs->read_only = 0; bs->fd = -1; bs->cow_fd = -1; bs->cow_bitmap = NULL; strcpy(bs->filename, filename); #ifdef _WIN32 fd = open(filename, O_RDWR | O_BINARY); #else fd = open(filename, O_RDWR | O_LARGEFILE); #endif if (fd < 0) { #ifdef _WIN32 fd = open(filename, O_RDONLY | O_BINARY); #else fd = open(filename, O_RDONLY | O_LARGEFILE); #endif if (fd < 0) { perror(filename); goto fail; } if (!snapshot) bs->read_only = 1; } bs->fd = fd; if (read(fd, &cow_header, sizeof(cow_header)) != sizeof(cow_header)) { fprintf(stderr, "%s: could not read header\n", filename); goto fail; } #ifndef _WIN32 if (be32_to_cpu(cow_header.magic) == COW_MAGIC && be32_to_cpu(cow_header.version) == COW_VERSION) { size = cow_header.size; #ifndef WORDS_BIGENDIAN size = bswap64(size); #endif bs->total_sectors = size / 512; bs->cow_fd = fd; bs->fd = -1; if (cow_header.backing_file[0] != '\0') { if (stat(cow_header.backing_file, &st) != 0) { fprintf(stderr, "%s: could not find original disk image '%s'\n", filename, cow_header.backing_file); goto fail; } if (st.st_mtime != be32_to_cpu(cow_header.mtime)) { fprintf(stderr, "%s: original raw disk image '%s' does not match saved timestamp\n", filename, cow_header.backing_file); goto fail; } fd = open(cow_header.backing_file, O_RDONLY | O_LARGEFILE); if (fd < 0) goto fail; bs->fd = fd; } bs->cow_bitmap_size = ((bs->total_sectors + 7) >> 3) + sizeof(cow_header); bs->cow_bitmap_addr = mmap(get_mmap_addr(bs->cow_bitmap_size), bs->cow_bitmap_size, PROT_READ | PROT_WRITE, MAP_SHARED, bs->cow_fd, 0); if (bs->cow_bitmap_addr == MAP_FAILED) goto fail; bs->cow_bitmap = bs->cow_bitmap_addr + sizeof(cow_header); bs->cow_sectors_offset = (bs->cow_bitmap_size + 511) & ~511; snapshot = 0; } else #endif { size = lseek64(fd, 0, SEEK_END); bs->total_sectors = size / 512; bs->fd = fd; } #ifndef _WIN32 if (snapshot) { cow_fd = mkstemp64(template); if (cow_fd < 0) goto fail; bs->cow_fd = cow_fd; unlink(template); bs->cow_bitmap_size = (bs->total_sectors + 7) >> 3; bs->cow_bitmap_addr = mmap(get_mmap_addr(bs->cow_bitmap_size), bs->cow_bitmap_size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); if (bs->cow_bitmap_addr == MAP_FAILED) goto fail; bs->cow_bitmap = bs->cow_bitmap_addr; bs->cow_sectors_offset = 0; } #endif bs->inserted = 1; if (bs->change_cb) bs->change_cb(bs->change_opaque); return 0; fail: bdrv_close(bs); return -1; }
{ "code": [ " strcpy(bs->filename, filename);" ], "line_no": [ 31 ] }
int FUNC_0(BlockDriverState *VAR_0, const char *VAR_1, int VAR_2) { int VAR_3; int64_t size; struct cow_header_v2 VAR_4; #ifndef _WIN32 char VAR_5[] = "/tmp/vl.XXXXXX"; int VAR_6; struct stat VAR_7; #endif VAR_0->read_only = 0; VAR_0->VAR_3 = -1; VAR_0->VAR_6 = -1; VAR_0->cow_bitmap = NULL; strcpy(VAR_0->VAR_1, VAR_1); #ifdef _WIN32 VAR_3 = open(VAR_1, O_RDWR | O_BINARY); #else VAR_3 = open(VAR_1, O_RDWR | O_LARGEFILE); #endif if (VAR_3 < 0) { #ifdef _WIN32 VAR_3 = open(VAR_1, O_RDONLY | O_BINARY); #else VAR_3 = open(VAR_1, O_RDONLY | O_LARGEFILE); #endif if (VAR_3 < 0) { perror(VAR_1); goto fail; } if (!VAR_2) VAR_0->read_only = 1; } VAR_0->VAR_3 = VAR_3; if (read(VAR_3, &VAR_4, sizeof(VAR_4)) != sizeof(VAR_4)) { fprintf(stderr, "%s: could not read header\n", VAR_1); goto fail; } #ifndef _WIN32 if (be32_to_cpu(VAR_4.magic) == COW_MAGIC && be32_to_cpu(VAR_4.version) == COW_VERSION) { size = VAR_4.size; #ifndef WORDS_BIGENDIAN size = bswap64(size); #endif VAR_0->total_sectors = size / 512; VAR_0->VAR_6 = VAR_3; VAR_0->VAR_3 = -1; if (VAR_4.backing_file[0] != '\0') { if (stat(VAR_4.backing_file, &VAR_7) != 0) { fprintf(stderr, "%s: could not find original disk image '%s'\n", VAR_1, VAR_4.backing_file); goto fail; } if (VAR_7.st_mtime != be32_to_cpu(VAR_4.mtime)) { fprintf(stderr, "%s: original raw disk image '%s' does not match saved timestamp\n", VAR_1, VAR_4.backing_file); goto fail; } VAR_3 = open(VAR_4.backing_file, O_RDONLY | O_LARGEFILE); if (VAR_3 < 0) goto fail; VAR_0->VAR_3 = VAR_3; } VAR_0->cow_bitmap_size = ((VAR_0->total_sectors + 7) >> 3) + sizeof(VAR_4); VAR_0->cow_bitmap_addr = mmap(get_mmap_addr(VAR_0->cow_bitmap_size), VAR_0->cow_bitmap_size, PROT_READ | PROT_WRITE, MAP_SHARED, VAR_0->VAR_6, 0); if (VAR_0->cow_bitmap_addr == MAP_FAILED) goto fail; VAR_0->cow_bitmap = VAR_0->cow_bitmap_addr + sizeof(VAR_4); VAR_0->cow_sectors_offset = (VAR_0->cow_bitmap_size + 511) & ~511; VAR_2 = 0; } else #endif { size = lseek64(VAR_3, 0, SEEK_END); VAR_0->total_sectors = size / 512; VAR_0->VAR_3 = VAR_3; } #ifndef _WIN32 if (VAR_2) { VAR_6 = mkstemp64(VAR_5); if (VAR_6 < 0) goto fail; VAR_0->VAR_6 = VAR_6; unlink(VAR_5); VAR_0->cow_bitmap_size = (VAR_0->total_sectors + 7) >> 3; VAR_0->cow_bitmap_addr = mmap(get_mmap_addr(VAR_0->cow_bitmap_size), VAR_0->cow_bitmap_size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); if (VAR_0->cow_bitmap_addr == MAP_FAILED) goto fail; VAR_0->cow_bitmap = VAR_0->cow_bitmap_addr; VAR_0->cow_sectors_offset = 0; } #endif VAR_0->inserted = 1; if (VAR_0->change_cb) VAR_0->change_cb(VAR_0->change_opaque); return 0; fail: bdrv_close(VAR_0); return -1; }
[ "int FUNC_0(BlockDriverState *VAR_0, const char *VAR_1, int VAR_2)\n{", "int VAR_3;", "int64_t size;", "struct cow_header_v2 VAR_4;", "#ifndef _WIN32\nchar VAR_5[] = \"/tmp/vl.XXXXXX\";", "int VAR_6;", "struct stat VAR_7;", "#endif\nVAR_0->read_only = 0;", "VAR_0->VAR_3 = -1;", "VAR_0->VAR_6 = -1;", "VAR_0->cow_bitmap = NULL;", "strcpy(VAR_0->VAR_1, VAR_1);", "#ifdef _WIN32\nVAR_3 = open(VAR_1, O_RDWR | O_BINARY);", "#else\nVAR_3 = open(VAR_1, O_RDWR | O_LARGEFILE);", "#endif\nif (VAR_3 < 0) {", "#ifdef _WIN32\nVAR_3 = open(VAR_1, O_RDONLY | O_BINARY);", "#else\nVAR_3 = open(VAR_1, O_RDONLY | O_LARGEFILE);", "#endif\nif (VAR_3 < 0) {", "perror(VAR_1);", "goto fail;", "}", "if (!VAR_2)\nVAR_0->read_only = 1;", "}", "VAR_0->VAR_3 = VAR_3;", "if (read(VAR_3, &VAR_4, sizeof(VAR_4)) != sizeof(VAR_4)) {", "fprintf(stderr, \"%s: could not read header\\n\", VAR_1);", "goto fail;", "}", "#ifndef _WIN32\nif (be32_to_cpu(VAR_4.magic) == COW_MAGIC &&\nbe32_to_cpu(VAR_4.version) == COW_VERSION) {", "size = VAR_4.size;", "#ifndef WORDS_BIGENDIAN\nsize = bswap64(size);", "#endif\nVAR_0->total_sectors = size / 512;", "VAR_0->VAR_6 = VAR_3;", "VAR_0->VAR_3 = -1;", "if (VAR_4.backing_file[0] != '\\0') {", "if (stat(VAR_4.backing_file, &VAR_7) != 0) {", "fprintf(stderr, \"%s: could not find original disk image '%s'\\n\", VAR_1, VAR_4.backing_file);", "goto fail;", "}", "if (VAR_7.st_mtime != be32_to_cpu(VAR_4.mtime)) {", "fprintf(stderr, \"%s: original raw disk image '%s' does not match saved timestamp\\n\", VAR_1, VAR_4.backing_file);", "goto fail;", "}", "VAR_3 = open(VAR_4.backing_file, O_RDONLY | O_LARGEFILE);", "if (VAR_3 < 0)\ngoto fail;", "VAR_0->VAR_3 = VAR_3;", "}", "VAR_0->cow_bitmap_size = ((VAR_0->total_sectors + 7) >> 3) + sizeof(VAR_4);", "VAR_0->cow_bitmap_addr = mmap(get_mmap_addr(VAR_0->cow_bitmap_size),\nVAR_0->cow_bitmap_size,\nPROT_READ | PROT_WRITE,\nMAP_SHARED, VAR_0->VAR_6, 0);", "if (VAR_0->cow_bitmap_addr == MAP_FAILED)\ngoto fail;", "VAR_0->cow_bitmap = VAR_0->cow_bitmap_addr + sizeof(VAR_4);", "VAR_0->cow_sectors_offset = (VAR_0->cow_bitmap_size + 511) & ~511;", "VAR_2 = 0;", "} else", "#endif\n{", "size = lseek64(VAR_3, 0, SEEK_END);", "VAR_0->total_sectors = size / 512;", "VAR_0->VAR_3 = VAR_3;", "}", "#ifndef _WIN32\nif (VAR_2) {", "VAR_6 = mkstemp64(VAR_5);", "if (VAR_6 < 0)\ngoto fail;", "VAR_0->VAR_6 = VAR_6;", "unlink(VAR_5);", "VAR_0->cow_bitmap_size = (VAR_0->total_sectors + 7) >> 3;", "VAR_0->cow_bitmap_addr = mmap(get_mmap_addr(VAR_0->cow_bitmap_size),\nVAR_0->cow_bitmap_size,\nPROT_READ | PROT_WRITE,\nMAP_PRIVATE | MAP_ANONYMOUS, -1, 0);", "if (VAR_0->cow_bitmap_addr == MAP_FAILED)\ngoto fail;", "VAR_0->cow_bitmap = VAR_0->cow_bitmap_addr;", "VAR_0->cow_sectors_offset = 0;", "}", "#endif\nVAR_0->inserted = 1;", "if (VAR_0->change_cb)\nVAR_0->change_cb(VAR_0->change_opaque);", "return 0;", "fail:\nbdrv_close(VAR_0);", "return -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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 37, 39 ], [ 41, 43 ], [ 45, 47 ], [ 51, 53 ], [ 55, 57 ], [ 59, 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69, 71 ], [ 73 ], [ 75 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89, 91, 93 ], [ 97 ], [ 99, 101 ], [ 103, 105 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133, 135 ], [ 137 ], [ 139 ], [ 143 ], [ 145, 147, 149, 151 ], [ 153, 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165, 167 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 181, 183 ], [ 187 ], [ 189, 191 ], [ 193 ], [ 195 ], [ 201 ], [ 203, 205, 207, 209 ], [ 211, 213 ], [ 215 ], [ 217 ], [ 219 ], [ 221, 225 ], [ 231, 233 ], [ 237 ], [ 239, 241 ], [ 243 ], [ 245 ] ]
15,564
static void ehci_detach(USBPort *port) { EHCIState *s = port->opaque; uint32_t *portsc = &s->portsc[port->index]; const char *owner = (*portsc & PORTSC_POWNER) ? "comp" : "ehci"; trace_usb_ehci_port_detach(port->index, owner); if (*portsc & PORTSC_POWNER) { USBPort *companion = s->companion_ports[port->index]; companion->ops->detach(companion); companion->dev = NULL; /* * EHCI spec 4.2.2: "When a disconnect occurs... On the event, * the port ownership is returned immediately to the EHCI controller." */ *portsc &= ~PORTSC_POWNER; return; } ehci_queues_rip_device(s, port->dev, 0); ehci_queues_rip_device(s, port->dev, 1); *portsc &= ~(PORTSC_CONNECT|PORTSC_PED); *portsc |= PORTSC_CSC; ehci_raise_irq(s, USBSTS_PCD); }
true
qemu
cbf82fa01e6fd4ecb234b235b10ffce548154a95
static void ehci_detach(USBPort *port) { EHCIState *s = port->opaque; uint32_t *portsc = &s->portsc[port->index]; const char *owner = (*portsc & PORTSC_POWNER) ? "comp" : "ehci"; trace_usb_ehci_port_detach(port->index, owner); if (*portsc & PORTSC_POWNER) { USBPort *companion = s->companion_ports[port->index]; companion->ops->detach(companion); companion->dev = NULL; *portsc &= ~PORTSC_POWNER; return; } ehci_queues_rip_device(s, port->dev, 0); ehci_queues_rip_device(s, port->dev, 1); *portsc &= ~(PORTSC_CONNECT|PORTSC_PED); *portsc |= PORTSC_CSC; ehci_raise_irq(s, USBSTS_PCD); }
{ "code": [ " *portsc &= ~(PORTSC_CONNECT|PORTSC_PED);" ], "line_no": [ 47 ] }
static void FUNC_0(USBPort *VAR_0) { EHCIState *s = VAR_0->opaque; uint32_t *portsc = &s->portsc[VAR_0->index]; const char *VAR_1 = (*portsc & PORTSC_POWNER) ? "comp" : "ehci"; trace_usb_ehci_port_detach(VAR_0->index, VAR_1); if (*portsc & PORTSC_POWNER) { USBPort *companion = s->companion_ports[VAR_0->index]; companion->ops->detach(companion); companion->dev = NULL; *portsc &= ~PORTSC_POWNER; return; } ehci_queues_rip_device(s, VAR_0->dev, 0); ehci_queues_rip_device(s, VAR_0->dev, 1); *portsc &= ~(PORTSC_CONNECT|PORTSC_PED); *portsc |= PORTSC_CSC; ehci_raise_irq(s, USBSTS_PCD); }
[ "static void FUNC_0(USBPort *VAR_0)\n{", "EHCIState *s = VAR_0->opaque;", "uint32_t *portsc = &s->portsc[VAR_0->index];", "const char *VAR_1 = (*portsc & PORTSC_POWNER) ? \"comp\" : \"ehci\";", "trace_usb_ehci_port_detach(VAR_0->index, VAR_1);", "if (*portsc & PORTSC_POWNER) {", "USBPort *companion = s->companion_ports[VAR_0->index];", "companion->ops->detach(companion);", "companion->dev = NULL;", "*portsc &= ~PORTSC_POWNER;", "return;", "}", "ehci_queues_rip_device(s, VAR_0->dev, 0);", "ehci_queues_rip_device(s, VAR_0->dev, 1);", "*portsc &= ~(PORTSC_CONNECT|PORTSC_PED);", "*portsc |= PORTSC_CSC;", "ehci_raise_irq(s, USBSTS_PCD);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ] ]
15,565
static inline void RENAME(rgb32to15)(const uint8_t *src, uint8_t *dst, long src_size) { const uint8_t *s = src; const uint8_t *end; #ifdef HAVE_MMX const uint8_t *mm_end; #endif uint16_t *d = (uint16_t *)dst; end = s + src_size; #ifdef HAVE_MMX mm_end = end - 15; #if 1 //is faster only if multiplies are reasonable fast (FIXME figure out on which cpus this is faster, on Athlon its slightly faster) asm volatile( "movq %3, %%mm5 \n\t" "movq %4, %%mm6 \n\t" "movq %5, %%mm7 \n\t" "jmp 2f \n\t" ASMALIGN(4) "1: \n\t" PREFETCH" 32(%1) \n\t" "movd (%1), %%mm0 \n\t" "movd 4(%1), %%mm3 \n\t" "punpckldq 8(%1), %%mm0 \n\t" "punpckldq 12(%1), %%mm3 \n\t" "movq %%mm0, %%mm1 \n\t" "movq %%mm3, %%mm4 \n\t" "pand %%mm6, %%mm0 \n\t" "pand %%mm6, %%mm3 \n\t" "pmaddwd %%mm7, %%mm0 \n\t" "pmaddwd %%mm7, %%mm3 \n\t" "pand %%mm5, %%mm1 \n\t" "pand %%mm5, %%mm4 \n\t" "por %%mm1, %%mm0 \n\t" "por %%mm4, %%mm3 \n\t" "psrld $6, %%mm0 \n\t" "pslld $10, %%mm3 \n\t" "por %%mm3, %%mm0 \n\t" MOVNTQ" %%mm0, (%0) \n\t" "add $16, %1 \n\t" "add $8, %0 \n\t" "2: \n\t" "cmp %2, %1 \n\t" " jb 1b \n\t" : "+r" (d), "+r"(s) : "r" (mm_end), "m" (mask3215g), "m" (mask3216br), "m" (mul3215) ); #else __asm __volatile(PREFETCH" %0"::"m"(*src):"memory"); __asm __volatile( "movq %0, %%mm7\n\t" "movq %1, %%mm6\n\t" ::"m"(red_15mask),"m"(green_15mask)); while(s < mm_end) { __asm __volatile( PREFETCH" 32%1\n\t" "movd %1, %%mm0\n\t" "movd 4%1, %%mm3\n\t" "punpckldq 8%1, %%mm0\n\t" "punpckldq 12%1, %%mm3\n\t" "movq %%mm0, %%mm1\n\t" "movq %%mm0, %%mm2\n\t" "movq %%mm3, %%mm4\n\t" "movq %%mm3, %%mm5\n\t" "psrlq $3, %%mm0\n\t" "psrlq $3, %%mm3\n\t" "pand %2, %%mm0\n\t" "pand %2, %%mm3\n\t" "psrlq $6, %%mm1\n\t" "psrlq $6, %%mm4\n\t" "pand %%mm6, %%mm1\n\t" "pand %%mm6, %%mm4\n\t" "psrlq $9, %%mm2\n\t" "psrlq $9, %%mm5\n\t" "pand %%mm7, %%mm2\n\t" "pand %%mm7, %%mm5\n\t" "por %%mm1, %%mm0\n\t" "por %%mm4, %%mm3\n\t" "por %%mm2, %%mm0\n\t" "por %%mm5, %%mm3\n\t" "psllq $16, %%mm3\n\t" "por %%mm3, %%mm0\n\t" MOVNTQ" %%mm0, %0\n\t" :"=m"(*d):"m"(*s),"m"(blue_15mask):"memory"); d += 4; s += 16; } #endif __asm __volatile(SFENCE:::"memory"); __asm __volatile(EMMS:::"memory"); #endif while(s < end) { register int rgb = *(uint32_t*)s; s += 4; *d++ = ((rgb&0xFF)>>3) + ((rgb&0xF800)>>6) + ((rgb&0xF80000)>>9); } }
true
FFmpeg
6e42e6c4b410dbef8b593c2d796a5dad95f89ee4
static inline void RENAME(rgb32to15)(const uint8_t *src, uint8_t *dst, long src_size) { const uint8_t *s = src; const uint8_t *end; #ifdef HAVE_MMX const uint8_t *mm_end; #endif uint16_t *d = (uint16_t *)dst; end = s + src_size; #ifdef HAVE_MMX mm_end = end - 15; #if 1 asm volatile( "movq %3, %%mm5 \n\t" "movq %4, %%mm6 \n\t" "movq %5, %%mm7 \n\t" "jmp 2f \n\t" ASMALIGN(4) "1: \n\t" PREFETCH" 32(%1) \n\t" "movd (%1), %%mm0 \n\t" "movd 4(%1), %%mm3 \n\t" "punpckldq 8(%1), %%mm0 \n\t" "punpckldq 12(%1), %%mm3 \n\t" "movq %%mm0, %%mm1 \n\t" "movq %%mm3, %%mm4 \n\t" "pand %%mm6, %%mm0 \n\t" "pand %%mm6, %%mm3 \n\t" "pmaddwd %%mm7, %%mm0 \n\t" "pmaddwd %%mm7, %%mm3 \n\t" "pand %%mm5, %%mm1 \n\t" "pand %%mm5, %%mm4 \n\t" "por %%mm1, %%mm0 \n\t" "por %%mm4, %%mm3 \n\t" "psrld $6, %%mm0 \n\t" "pslld $10, %%mm3 \n\t" "por %%mm3, %%mm0 \n\t" MOVNTQ" %%mm0, (%0) \n\t" "add $16, %1 \n\t" "add $8, %0 \n\t" "2: \n\t" "cmp %2, %1 \n\t" " jb 1b \n\t" : "+r" (d), "+r"(s) : "r" (mm_end), "m" (mask3215g), "m" (mask3216br), "m" (mul3215) ); #else __asm __volatile(PREFETCH" %0"::"m"(*src):"memory"); __asm __volatile( "movq %0, %%mm7\n\t" "movq %1, %%mm6\n\t" ::"m"(red_15mask),"m"(green_15mask)); while(s < mm_end) { __asm __volatile( PREFETCH" 32%1\n\t" "movd %1, %%mm0\n\t" "movd 4%1, %%mm3\n\t" "punpckldq 8%1, %%mm0\n\t" "punpckldq 12%1, %%mm3\n\t" "movq %%mm0, %%mm1\n\t" "movq %%mm0, %%mm2\n\t" "movq %%mm3, %%mm4\n\t" "movq %%mm3, %%mm5\n\t" "psrlq $3, %%mm0\n\t" "psrlq $3, %%mm3\n\t" "pand %2, %%mm0\n\t" "pand %2, %%mm3\n\t" "psrlq $6, %%mm1\n\t" "psrlq $6, %%mm4\n\t" "pand %%mm6, %%mm1\n\t" "pand %%mm6, %%mm4\n\t" "psrlq $9, %%mm2\n\t" "psrlq $9, %%mm5\n\t" "pand %%mm7, %%mm2\n\t" "pand %%mm7, %%mm5\n\t" "por %%mm1, %%mm0\n\t" "por %%mm4, %%mm3\n\t" "por %%mm2, %%mm0\n\t" "por %%mm5, %%mm3\n\t" "psllq $16, %%mm3\n\t" "por %%mm3, %%mm0\n\t" MOVNTQ" %%mm0, %0\n\t" :"=m"(*d):"m"(*s),"m"(blue_15mask):"memory"); d += 4; s += 16; } #endif __asm __volatile(SFENCE:::"memory"); __asm __volatile(EMMS:::"memory"); #endif while(s < end) { register int rgb = *(uint32_t*)s; s += 4; *d++ = ((rgb&0xFF)>>3) + ((rgb&0xF800)>>6) + ((rgb&0xF80000)>>9); } }
{ "code": [ "\twhile(s < end)", "\twhile(s < end)", "\twhile(s < end)", "\twhile(s < end)", "#ifdef HAVE_MMX", "#endif", "#ifdef HAVE_MMX", "#endif", "#else", "#endif", "#endif", "\t__asm __volatile(", "\t\t\"movq\t%%mm0, %%mm1\\n\\t\"", "\t\tMOVNTQ\"\t%%mm0, %0\\n\\t\"", "\t__asm __volatile(", "\t\t\"movq\t%%mm0, %%mm1\\n\\t\"", "\t\t\"pand\t%%mm7, %%mm2\\n\\t\"", "\t\t\"pand\t%%mm6, %%mm1\\n\\t\"", "\t\t\"por\t%%mm1, %%mm0\\n\\t\"", "\t\tMOVNTQ\"\t%%mm0, %0\\n\\t\"", "\tconst uint8_t *s = src;", "\tconst uint8_t *end;", "\tconst uint8_t *mm_end;", "\tuint16_t *d = (uint16_t *)dst;", "\tend = s + src_size;", "\tmm_end = end - 15;", "\tasm volatile(", "\t\t\"movq %3, %%mm5\t\t\t\\n\\t\"", "\t\t\"movq %4, %%mm6\t\t\t\\n\\t\"", "\t\t\"movq %5, %%mm7\t\t\t\\n\\t\"", "\t\t\"jmp 2f\t\t\t\t\\n\\t\"", "\t\tASMALIGN(4)", "\t\t\"1:\t\t\t\t\\n\\t\"", "\t\tPREFETCH\" 32(%1)\t\t\\n\\t\"", "\t\t\"movd\t(%1), %%mm0\t\t\\n\\t\"", "\t\t\"movd\t4(%1), %%mm3\t\t\\n\\t\"", "\t\t\"punpckldq 8(%1), %%mm0\t\t\\n\\t\"", "\t\t\"punpckldq 12(%1), %%mm3\t\\n\\t\"", "\t\t\"movq %%mm0, %%mm1\t\t\\n\\t\"", "\t\t\"movq %%mm3, %%mm4\t\t\\n\\t\"", "\t\t\"pand %%mm6, %%mm0\t\t\\n\\t\"", "\t\t\"pand %%mm6, %%mm3\t\t\\n\\t\"", "\t\t\"pmaddwd %%mm7, %%mm0\t\t\\n\\t\"", "\t\t\"pmaddwd %%mm7, %%mm3\t\t\\n\\t\"", "\t\t\"pand %%mm5, %%mm1\t\t\\n\\t\"", "\t\t\"pand %%mm5, %%mm4\t\t\\n\\t\"", "\t\t\"por %%mm1, %%mm0\t\t\\n\\t\"", "\t\t\"por %%mm4, %%mm3\t\t\\n\\t\"", "\t\t\"por %%mm3, %%mm0\t\t\\n\\t\"", "\t\tMOVNTQ\"\t%%mm0, (%0)\t\t\\n\\t\"", "\t\t\"add $16, %1\t\t\t\\n\\t\"", "\t\t\"add $8, %0\t\t\t\\n\\t\"", "\t\t\"2:\t\t\t\t\\n\\t\"", "\t\t\"cmp %2, %1\t\t\t\\n\\t\"", "\t\t\" jb 1b\t\t\t\t\\n\\t\"", "\t\t: \"+r\" (d), \"+r\"(s)", "\t);", "\t__asm __volatile(PREFETCH\"\t%0\"::\"m\"(*src):\"memory\");", "\t__asm __volatile(", "\t \"movq\t%0, %%mm7\\n\\t\"", "\t \"movq\t%1, %%mm6\\n\\t\"", "\twhile(s < mm_end)", "\t __asm __volatile(", "\t\tPREFETCH\" 32%1\\n\\t\"", "\t\t\"movd\t%1, %%mm0\\n\\t\"", "\t\t\"movd\t4%1, %%mm3\\n\\t\"", "\t\t\"punpckldq 8%1, %%mm0\\n\\t\"", "\t\t\"punpckldq 12%1, %%mm3\\n\\t\"", "\t\t\"movq\t%%mm0, %%mm1\\n\\t\"", "\t\t\"movq\t%%mm0, %%mm2\\n\\t\"", "\t\t\"movq\t%%mm3, %%mm4\\n\\t\"", "\t\t\"movq\t%%mm3, %%mm5\\n\\t\"", "\t\t\"psrlq\t$3, %%mm0\\n\\t\"", "\t\t\"psrlq\t$3, %%mm3\\n\\t\"", "\t\t\"pand\t%2, %%mm0\\n\\t\"", "\t\t\"pand\t%2, %%mm3\\n\\t\"", "\t\t\"pand\t%%mm6, %%mm1\\n\\t\"", "\t\t\"pand\t%%mm6, %%mm4\\n\\t\"", "\t\t\"pand\t%%mm7, %%mm2\\n\\t\"", "\t\t\"pand\t%%mm7, %%mm5\\n\\t\"", "\t\t\"por\t%%mm1, %%mm0\\n\\t\"", "\t\t\"por\t%%mm4, %%mm3\\n\\t\"", "\t\t\"por\t%%mm2, %%mm0\\n\\t\"", "\t\t\"por\t%%mm5, %%mm3\\n\\t\"", "\t\t\"psllq\t$16, %%mm3\\n\\t\"", "\t\t\"por\t%%mm3, %%mm0\\n\\t\"", "\t\tMOVNTQ\"\t%%mm0, %0\\n\\t\"", "\t\td += 4;", "\t\ts += 16;", "#endif", "\t__asm __volatile(SFENCE:::\"memory\");", "\t__asm __volatile(EMMS:::\"memory\");", "#endif", "\twhile(s < end)", "\t\tregister int rgb = *(uint32_t*)s; s += 4;", "\tconst uint8_t *s = src;", "\tconst uint8_t *end;", "\tconst uint8_t *mm_end;", "\tuint16_t *d = (uint16_t *)dst;", "\tend = s + src_size;", "\t__asm __volatile(PREFETCH\"\t%0\"::\"m\"(*src):\"memory\");", "\t__asm __volatile(", "\t \"movq\t%0, %%mm7\\n\\t\"", "\t \"movq\t%1, %%mm6\\n\\t\"", "\tmm_end = end - 15;", "\twhile(s < mm_end)", "\t __asm __volatile(", "\t\tPREFETCH\" 32%1\\n\\t\"", "\t\t\"movd\t%1, %%mm0\\n\\t\"", "\t\t\"movd\t4%1, %%mm3\\n\\t\"", "\t\t\"punpckldq 8%1, %%mm0\\n\\t\"", "\t\t\"punpckldq 12%1, %%mm3\\n\\t\"", "\t\t\"movq\t%%mm0, %%mm1\\n\\t\"", "\t\t\"movq\t%%mm0, %%mm2\\n\\t\"", "\t\t\"movq\t%%mm3, %%mm4\\n\\t\"", "\t\t\"movq\t%%mm3, %%mm5\\n\\t\"", "\t\t\"pand\t%%mm6, %%mm1\\n\\t\"", "\t\t\"pand\t%%mm6, %%mm4\\n\\t\"", "\t\t\"por\t%%mm1, %%mm0\\n\\t\"", "\t\t\"por\t%%mm4, %%mm3\\n\\t\"", "\t\t\"por\t%%mm2, %%mm0\\n\\t\"", "\t\t\"por\t%%mm5, %%mm3\\n\\t\"", "\t\t\"psllq\t$16, %%mm3\\n\\t\"", "\t\t\"por\t%%mm3, %%mm0\\n\\t\"", "\t\tMOVNTQ\"\t%%mm0, %0\\n\\t\"", "\t\td += 4;", "\t\ts += 16;", "\t__asm __volatile(SFENCE:::\"memory\");", "\t__asm __volatile(EMMS:::\"memory\");", "#endif", "\twhile(s < end)", "\t\tregister int rgb = *(uint32_t*)s; s += 4;", "\tconst uint8_t *s = src;", "\tconst uint8_t *end;", "\tconst uint8_t *mm_end;", "\tuint16_t *d = (uint16_t *)dst;", "\tend = s + src_size;", "\tmm_end = end - 15;", "\tasm volatile(", "\t\t\"movq %3, %%mm5\t\t\t\\n\\t\"", "\t\t\"movq %4, %%mm6\t\t\t\\n\\t\"", "\t\t\"movq %5, %%mm7\t\t\t\\n\\t\"", "\t\t\"jmp 2f\t\t\t\t\\n\\t\"", "\t\tASMALIGN(4)", "\t\t\"1:\t\t\t\t\\n\\t\"", "\t\tPREFETCH\" 32(%1)\t\t\\n\\t\"", "\t\t\"movd\t(%1), %%mm0\t\t\\n\\t\"", "\t\t\"movd\t4(%1), %%mm3\t\t\\n\\t\"", "\t\t\"punpckldq 8(%1), %%mm0\t\t\\n\\t\"", "\t\t\"punpckldq 12(%1), %%mm3\t\\n\\t\"", "\t\t\"movq %%mm0, %%mm1\t\t\\n\\t\"", "\t\t\"movq %%mm3, %%mm4\t\t\\n\\t\"", "\t\t\"pand %%mm6, %%mm0\t\t\\n\\t\"", "\t\t\"pand %%mm6, %%mm3\t\t\\n\\t\"", "\t\t\"pmaddwd %%mm7, %%mm0\t\t\\n\\t\"", "\t\t\"pmaddwd %%mm7, %%mm3\t\t\\n\\t\"", "\t\t\"pand %%mm5, %%mm1\t\t\\n\\t\"", "\t\t\"pand %%mm5, %%mm4\t\t\\n\\t\"", "\t\t\"por %%mm1, %%mm0\t\t\\n\\t\"", "\t\t\"por %%mm4, %%mm3\t\t\\n\\t\"", "\t\t\"psrld $6, %%mm0\t\t\\n\\t\"", "\t\t\"pslld $10, %%mm3\t\t\\n\\t\"", "\t\t\"por %%mm3, %%mm0\t\t\\n\\t\"", "\t\tMOVNTQ\"\t%%mm0, (%0)\t\t\\n\\t\"", "\t\t\"add $16, %1\t\t\t\\n\\t\"", "\t\t\"add $8, %0\t\t\t\\n\\t\"", "\t\t\"2:\t\t\t\t\\n\\t\"", "\t\t\"cmp %2, %1\t\t\t\\n\\t\"", "\t\t\" jb 1b\t\t\t\t\\n\\t\"", "\t\t: \"+r\" (d), \"+r\"(s)", "\t\t: \"r\" (mm_end), \"m\" (mask3215g), \"m\" (mask3216br), \"m\" (mul3215)", "\t);", "\t__asm __volatile(PREFETCH\"\t%0\"::\"m\"(*src):\"memory\");", "\t__asm __volatile(", "\t \"movq\t%0, %%mm7\\n\\t\"", "\t \"movq\t%1, %%mm6\\n\\t\"", "\t ::\"m\"(red_15mask),\"m\"(green_15mask));", "\twhile(s < mm_end)", "\t __asm __volatile(", "\t\tPREFETCH\" 32%1\\n\\t\"", "\t\t\"movd\t%1, %%mm0\\n\\t\"", "\t\t\"movd\t4%1, %%mm3\\n\\t\"", "\t\t\"punpckldq 8%1, %%mm0\\n\\t\"", "\t\t\"punpckldq 12%1, %%mm3\\n\\t\"", "\t\t\"movq\t%%mm0, %%mm1\\n\\t\"", "\t\t\"movq\t%%mm0, %%mm2\\n\\t\"", "\t\t\"movq\t%%mm3, %%mm4\\n\\t\"", "\t\t\"movq\t%%mm3, %%mm5\\n\\t\"", "\t\t\"psrlq\t$3, %%mm0\\n\\t\"", "\t\t\"psrlq\t$3, %%mm3\\n\\t\"", "\t\t\"pand\t%2, %%mm0\\n\\t\"", "\t\t\"pand\t%2, %%mm3\\n\\t\"", "\t\t\"psrlq\t$6, %%mm1\\n\\t\"", "\t\t\"psrlq\t$6, %%mm4\\n\\t\"", "\t\t\"pand\t%%mm6, %%mm1\\n\\t\"", "\t\t\"pand\t%%mm6, %%mm4\\n\\t\"", "\t\t\"psrlq\t$9, %%mm2\\n\\t\"", "\t\t\"psrlq\t$9, %%mm5\\n\\t\"", "\t\t\"pand\t%%mm7, %%mm2\\n\\t\"", "\t\t\"pand\t%%mm7, %%mm5\\n\\t\"", "\t\t\"por\t%%mm1, %%mm0\\n\\t\"", "\t\t\"por\t%%mm4, %%mm3\\n\\t\"", "\t\t\"por\t%%mm2, %%mm0\\n\\t\"", "\t\t\"por\t%%mm5, %%mm3\\n\\t\"", "\t\t\"psllq\t$16, %%mm3\\n\\t\"", "\t\t\"por\t%%mm3, %%mm0\\n\\t\"", "\t\tMOVNTQ\"\t%%mm0, %0\\n\\t\"", "\t\t:\"=m\"(*d):\"m\"(*s),\"m\"(blue_15mask):\"memory\");", "\t\td += 4;", "\t\ts += 16;", "#endif", "\t__asm __volatile(SFENCE:::\"memory\");", "\t__asm __volatile(EMMS:::\"memory\");", "#endif", "\twhile(s < end)", "\t\tregister int rgb = *(uint32_t*)s; s += 4;", "\t\t*d++ = ((rgb&0xFF)>>3) + ((rgb&0xF800)>>6) + ((rgb&0xF80000)>>9);", "\tconst uint8_t *s = src;", "\tconst uint8_t *end;", "\tconst uint8_t *mm_end;", "\tuint16_t *d = (uint16_t *)dst;", "\tend = s + src_size;", "\t__asm __volatile(PREFETCH\"\t%0\"::\"m\"(*src):\"memory\");", "\t__asm __volatile(", "\t \"movq\t%0, %%mm7\\n\\t\"", "\t \"movq\t%1, %%mm6\\n\\t\"", "\t ::\"m\"(red_15mask),\"m\"(green_15mask));", "\tmm_end = end - 15;", "\twhile(s < mm_end)", "\t __asm __volatile(", "\t\tPREFETCH\" 32%1\\n\\t\"", "\t\t\"movd\t%1, %%mm0\\n\\t\"", "\t\t\"movd\t4%1, %%mm3\\n\\t\"", "\t\t\"punpckldq 8%1, %%mm0\\n\\t\"", "\t\t\"punpckldq 12%1, %%mm3\\n\\t\"", "\t\t\"movq\t%%mm0, %%mm1\\n\\t\"", "\t\t\"movq\t%%mm0, %%mm2\\n\\t\"", "\t\t\"movq\t%%mm3, %%mm4\\n\\t\"", "\t\t\"movq\t%%mm3, %%mm5\\n\\t\"", "\t\t\"psrlq\t$6, %%mm1\\n\\t\"", "\t\t\"psrlq\t$6, %%mm4\\n\\t\"", "\t\t\"pand\t%%mm6, %%mm1\\n\\t\"", "\t\t\"pand\t%%mm6, %%mm4\\n\\t\"", "\t\t\"por\t%%mm1, %%mm0\\n\\t\"", "\t\t\"por\t%%mm4, %%mm3\\n\\t\"", "\t\t\"por\t%%mm2, %%mm0\\n\\t\"", "\t\t\"por\t%%mm5, %%mm3\\n\\t\"", "\t\t\"psllq\t$16, %%mm3\\n\\t\"", "\t\t\"por\t%%mm3, %%mm0\\n\\t\"", "\t\tMOVNTQ\"\t%%mm0, %0\\n\\t\"", "\t\t:\"=m\"(*d):\"m\"(*s),\"m\"(blue_15mask):\"memory\");", "\t\td += 4;", "\t\ts += 16;", "\t__asm __volatile(SFENCE:::\"memory\");", "\t__asm __volatile(EMMS:::\"memory\");", "#endif", "\twhile(s < end)", "\t\tregister int rgb = *(uint32_t*)s; s += 4;", "\tconst uint8_t *s = src;", "\tconst uint8_t *end;", "\tconst uint8_t *mm_end;", "\tuint16_t *d = (uint16_t *)dst;", "\tend = s + src_size;", "\t__asm __volatile(PREFETCH\"\t%0\"::\"m\"(*src):\"memory\");", "\t__asm __volatile(", "\t \"movq\t%0, %%mm7\\n\\t\"", "\t \"movq\t%1, %%mm6\\n\\t\"", "\twhile(s < mm_end)", "\t __asm __volatile(", "\t\tPREFETCH\" 32%1\\n\\t\"", "\t\t\"movd\t%1, %%mm0\\n\\t\"", "\t\t\"movq\t%%mm0, %%mm1\\n\\t\"", "\t\t\"movq\t%%mm0, %%mm2\\n\\t\"", "\t\t\"movq\t%%mm3, %%mm4\\n\\t\"", "\t\t\"movq\t%%mm3, %%mm5\\n\\t\"", "\t\t\"psrlq\t$3, %%mm0\\n\\t\"", "\t\t\"psrlq\t$3, %%mm3\\n\\t\"", "\t\t\"pand\t%2, %%mm0\\n\\t\"", "\t\t\"pand\t%2, %%mm3\\n\\t\"", "\t\t\"pand\t%%mm6, %%mm1\\n\\t\"", "\t\t\"pand\t%%mm6, %%mm4\\n\\t\"", "\t\t\"pand\t%%mm7, %%mm2\\n\\t\"", "\t\t\"pand\t%%mm7, %%mm5\\n\\t\"", "\t\t\"por\t%%mm1, %%mm0\\n\\t\"", "\t\t\"por\t%%mm4, %%mm3\\n\\t\"", "\t\t\"por\t%%mm2, %%mm0\\n\\t\"", "\t\t\"por\t%%mm5, %%mm3\\n\\t\"", "\t\t\"psllq\t$16, %%mm3\\n\\t\"", "\t\t\"por\t%%mm3, %%mm0\\n\\t\"", "\t\tMOVNTQ\"\t%%mm0, %0\\n\\t\"", "\t\td += 4;", "\t__asm __volatile(SFENCE:::\"memory\");", "\t__asm __volatile(EMMS:::\"memory\");", "#endif", "\twhile(s < end)", "\tconst uint8_t *s = src;", "\tconst uint8_t *end;", "\tconst uint8_t *mm_end;", "\tuint16_t *d = (uint16_t *)dst;", "\tend = s + src_size;", "\t__asm __volatile(PREFETCH\"\t%0\"::\"m\"(*src):\"memory\");", "\t__asm __volatile(", "\t \"movq\t%0, %%mm7\\n\\t\"", "\t \"movq\t%1, %%mm6\\n\\t\"", "\tmm_end = end - 15;", "\twhile(s < mm_end)", "\t __asm __volatile(", "\t\tPREFETCH\" 32%1\\n\\t\"", "\t\t\"movd\t%1, %%mm0\\n\\t\"", "\t\t\"movq\t%%mm0, %%mm1\\n\\t\"", "\t\t\"movq\t%%mm0, %%mm2\\n\\t\"", "\t\t\"movq\t%%mm3, %%mm4\\n\\t\"", "\t\t\"movq\t%%mm3, %%mm5\\n\\t\"", "\t\t\"pand\t%%mm6, %%mm1\\n\\t\"", "\t\t\"pand\t%%mm6, %%mm4\\n\\t\"", "\t\t\"por\t%%mm1, %%mm0\\n\\t\"", "\t\t\"por\t%%mm4, %%mm3\\n\\t\"", "\t\t\"por\t%%mm2, %%mm0\\n\\t\"", "\t\t\"por\t%%mm5, %%mm3\\n\\t\"", "\t\t\"psllq\t$16, %%mm3\\n\\t\"", "\t\t\"por\t%%mm3, %%mm0\\n\\t\"", "\t\tMOVNTQ\"\t%%mm0, %0\\n\\t\"", "\t\td += 4;", "\t__asm __volatile(SFENCE:::\"memory\");", "\t__asm __volatile(EMMS:::\"memory\");", "#endif", "\twhile(s < end)", "\tconst uint8_t *s = src;", "\tconst uint8_t *end;", "\tconst uint8_t *mm_end;", "\tuint16_t *d = (uint16_t *)dst;", "\tend = s + src_size;", "\t__asm __volatile(PREFETCH\"\t%0\"::\"m\"(*src):\"memory\");", "\t__asm __volatile(", "\t \"movq\t%0, %%mm7\\n\\t\"", "\t \"movq\t%1, %%mm6\\n\\t\"", "\t ::\"m\"(red_15mask),\"m\"(green_15mask));", "\twhile(s < mm_end)", "\t __asm __volatile(", "\t\tPREFETCH\" 32%1\\n\\t\"", "\t\t\"movd\t%1, %%mm0\\n\\t\"", "\t\t\"movq\t%%mm0, %%mm1\\n\\t\"", "\t\t\"movq\t%%mm0, %%mm2\\n\\t\"", "\t\t\"movq\t%%mm3, %%mm4\\n\\t\"", "\t\t\"movq\t%%mm3, %%mm5\\n\\t\"", "\t\t\"psrlq\t$3, %%mm0\\n\\t\"", "\t\t\"psrlq\t$3, %%mm3\\n\\t\"", "\t\t\"pand\t%2, %%mm0\\n\\t\"", "\t\t\"pand\t%2, %%mm3\\n\\t\"", "\t\t\"psrlq\t$6, %%mm1\\n\\t\"", "\t\t\"psrlq\t$6, %%mm4\\n\\t\"", "\t\t\"pand\t%%mm6, %%mm1\\n\\t\"", "\t\t\"pand\t%%mm6, %%mm4\\n\\t\"", "\t\t\"psrlq\t$9, %%mm2\\n\\t\"", "\t\t\"psrlq\t$9, %%mm5\\n\\t\"", "\t\t\"pand\t%%mm7, %%mm2\\n\\t\"", "\t\t\"pand\t%%mm7, %%mm5\\n\\t\"", "\t\t\"por\t%%mm1, %%mm0\\n\\t\"", "\t\t\"por\t%%mm4, %%mm3\\n\\t\"", "\t\t\"por\t%%mm2, %%mm0\\n\\t\"", "\t\t\"por\t%%mm5, %%mm3\\n\\t\"", "\t\t\"psllq\t$16, %%mm3\\n\\t\"", "\t\t\"por\t%%mm3, %%mm0\\n\\t\"", "\t\tMOVNTQ\"\t%%mm0, %0\\n\\t\"", "\t\t:\"=m\"(*d):\"m\"(*s),\"m\"(blue_15mask):\"memory\");", "\t\td += 4;", "\t__asm __volatile(SFENCE:::\"memory\");", "\t__asm __volatile(EMMS:::\"memory\");", "#endif", "\twhile(s < end)", "\tconst uint8_t *s = src;", "\tconst uint8_t *end;", "\tconst uint8_t *mm_end;", "\tuint16_t *d = (uint16_t *)dst;", "\tend = s + src_size;", "\t__asm __volatile(PREFETCH\"\t%0\"::\"m\"(*src):\"memory\");", "\t__asm __volatile(", "\t \"movq\t%0, %%mm7\\n\\t\"", "\t \"movq\t%1, %%mm6\\n\\t\"", "\t ::\"m\"(red_15mask),\"m\"(green_15mask));", "\tmm_end = end - 15;", "\twhile(s < mm_end)", "\t __asm __volatile(", "\t\tPREFETCH\" 32%1\\n\\t\"", "\t\t\"movd\t%1, %%mm0\\n\\t\"", "\t\t\"movq\t%%mm0, %%mm1\\n\\t\"", "\t\t\"movq\t%%mm0, %%mm2\\n\\t\"", "\t\t\"movq\t%%mm3, %%mm4\\n\\t\"", "\t\t\"movq\t%%mm3, %%mm5\\n\\t\"", "\t\t\"psrlq\t$6, %%mm1\\n\\t\"", "\t\t\"psrlq\t$6, %%mm4\\n\\t\"", "\t\t\"pand\t%%mm6, %%mm1\\n\\t\"", "\t\t\"pand\t%%mm6, %%mm4\\n\\t\"", "\t\t\"por\t%%mm1, %%mm0\\n\\t\"", "\t\t\"por\t%%mm4, %%mm3\\n\\t\"", "\t\t\"por\t%%mm2, %%mm0\\n\\t\"", "\t\t\"por\t%%mm5, %%mm3\\n\\t\"", "\t\t\"psllq\t$16, %%mm3\\n\\t\"", "\t\t\"por\t%%mm3, %%mm0\\n\\t\"", "\t\tMOVNTQ\"\t%%mm0, %0\\n\\t\"", "\t\t:\"=m\"(*d):\"m\"(*s),\"m\"(blue_15mask):\"memory\");", "\t\td += 4;", "\t__asm __volatile(SFENCE:::\"memory\");", "\t__asm __volatile(EMMS:::\"memory\");", "#endif", "\twhile(s < end)", "\twhile(s < mm_end)", "\t __asm __volatile(", "\t\tPREFETCH\" 32%1\\n\\t\"", "\t\t\"pand\t%2, %%mm0\\n\\t\"", "\t\t\"por\t%%mm1, %%mm0\\n\\t\"", "\t\t\"por\t%%mm2, %%mm0\\n\\t\"", "\t\t\"por\t%%mm4, %%mm3\\n\\t\"", "\t\t\"por\t%%mm5, %%mm3\\n\\t\"", "\t\t\"pand\t%2, %%mm0\\n\\t\"", "\t\t\"por\t%%mm1, %%mm0\\n\\t\"", "\t\t\"por\t%%mm2, %%mm0\\n\\t\"", "\t\t\"por\t%%mm4, %%mm3\\n\\t\"", "\t\t\"por\t%%mm5, %%mm3\\n\\t\"", "\t __asm __volatile(", "\t\t\"movq\t%%mm3, %%mm5\\n\\t\"", "\t\t\"movq\t%%mm0, %%mm2\\n\\t\"", "\t\t\"pand\t%2, %%mm0\\n\\t\"", "\t\t\"por\t%%mm2, %%mm0\\n\\t\"", "\t\t\"por\t%%mm2, %%mm0\\n\\t\"", "\t\tMOVNTQ\"\t%%mm0, %0\\n\\t\"", "\t__asm __volatile(SFENCE:::\"memory\");", "\t__asm __volatile(EMMS:::\"memory\");", "#endif", "\twhile(s < end)", "\twhile(s < mm_end)", "\t __asm __volatile(", "\t\tPREFETCH\" 32%1\\n\\t\"", "\t\t\"pand\t%2, %%mm0\\n\\t\"", "\t\t\"por\t%%mm1, %%mm0\\n\\t\"", "\t\t\"por\t%%mm2, %%mm0\\n\\t\"", "\t\t\"por\t%%mm4, %%mm3\\n\\t\"", "\t\t\"por\t%%mm5, %%mm3\\n\\t\"", "\t\t\"pand\t%2, %%mm0\\n\\t\"", "\t\t\"por\t%%mm1, %%mm0\\n\\t\"", "\t\t\"por\t%%mm2, %%mm0\\n\\t\"", "\t\t\"por\t%%mm4, %%mm3\\n\\t\"", "\t\t\"por\t%%mm5, %%mm3\\n\\t\"", "\t __asm __volatile(", "\t\t\"movq\t%%mm3, %%mm5\\n\\t\"", "\t\t\"movq\t%%mm0, %%mm2\\n\\t\"", "\t\t\"pand\t%2, %%mm0\\n\\t\"", "\t\t\"por\t%%mm2, %%mm0\\n\\t\"", "\t\t\"por\t%%mm2, %%mm0\\n\\t\"", "\t\tMOVNTQ\"\t%%mm0, %0\\n\\t\"", "\t__asm __volatile(SFENCE:::\"memory\");", "\t__asm __volatile(EMMS:::\"memory\");", "#endif", "\twhile(s < end)", "\twhile(s < mm_end)", "\t __asm __volatile(", "\t\tPREFETCH\" 32%1\\n\\t\"", "\t\t\"pand\t%2, %%mm0\\n\\t\"", "\t\t\"por\t%%mm1, %%mm0\\n\\t\"", "\t\t\"por\t%%mm2, %%mm0\\n\\t\"", "\t\t\"por\t%%mm4, %%mm3\\n\\t\"", "\t\t\"por\t%%mm5, %%mm3\\n\\t\"", "\t\tMOVNTQ\"\t%%mm0, %0\\n\\t\"", "\t__asm __volatile(SFENCE:::\"memory\");", "\t__asm __volatile(EMMS:::\"memory\");", "#endif", "\twhile(s < end)", "\twhile(s < mm_end)", "\t __asm __volatile(", "\t\tPREFETCH\" 32%1\\n\\t\"", "\t\t\"pand\t%2, %%mm0\\n\\t\"", "\t\t\"por\t%%mm1, %%mm0\\n\\t\"", "\t\t\"por\t%%mm2, %%mm0\\n\\t\"", "\t\t\"por\t%%mm4, %%mm3\\n\\t\"", "\t\t\"por\t%%mm5, %%mm3\\n\\t\"", "\t\tMOVNTQ\"\t%%mm0, %0\\n\\t\"", "\t__asm __volatile(SFENCE:::\"memory\");", "\t__asm __volatile(EMMS:::\"memory\");", "#endif", "\twhile(s < end)", "\t__asm __volatile(", "\t\tASMALIGN(4)", "\t\t\"1:\t\t\t\t\\n\\t\"", "\t\t\"pand %%mm6, %%mm3\t\t\\n\\t\"", "\t\t\"por %%mm3, %%mm0\t\t\\n\\t\"", "\t\t\"por %%mm3, %%mm0\t\t\\n\\t\"", "\t\t\"2:\t\t\t\t\\n\\t\"", "#endif", "\t\tASMALIGN(4)", "\t\t\"1:\t\t\t\t\\n\\t\"", "\t\t\"pand %%mm5, %%mm1\t\t\\n\\t\"", "\t\t\"pand %%mm6, %%mm0\t\t\\n\\t\"", "\t\t\"2:\t\t\t\t\\n\\t\"", "\t);", "\t__asm __volatile(SFENCE:::\"memory\");", "\t__asm __volatile(EMMS:::\"memory\");", "#endif", "#endif", "#endif", "#endif", "#endif", "#endif", "#endif", "#endif", "#endif", "#endif", "#endif", "#endif", "#endif", "#endif", "#endif", "#endif", "#endif", "#endif", "#endif", "#endif", "\t\tPREFETCH\" 32%1\\n\\t\"", "\t\tMOVNTQ\"\t%%mm0, %0\\n\\t\"", "#endif", "\t\tPREFETCH\" 32%1\\n\\t\"", "\t\tMOVNTQ\"\t%%mm0, %0\\n\\t\"", "#endif", "#endif" ], "line_no": [ 183, 183, 183, 183, 9, 13, 9, 13, 93, 13, 13, 97, 121, 165, 97, 121, 149, 141, 153, 165, 5, 7, 11, 15, 17, 21, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59, 61, 63, 65, 67, 73, 75, 77, 79, 81, 83, 85, 87, 91, 95, 97, 99, 101, 105, 109, 111, 113, 115, 117, 119, 121, 123, 125, 127, 129, 131, 133, 135, 141, 143, 149, 151, 153, 155, 157, 159, 161, 163, 165, 169, 171, 13, 177, 179, 13, 183, 187, 5, 7, 11, 15, 17, 95, 97, 99, 101, 21, 105, 109, 111, 113, 115, 117, 119, 121, 123, 125, 127, 141, 143, 153, 155, 157, 159, 161, 163, 165, 169, 171, 177, 179, 13, 183, 187, 5, 7, 11, 15, 17, 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, 77, 79, 81, 83, 85, 87, 89, 91, 95, 97, 99, 101, 103, 105, 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, 13, 177, 179, 13, 183, 187, 189, 5, 7, 11, 15, 17, 95, 97, 99, 101, 103, 21, 105, 109, 111, 113, 115, 117, 119, 121, 123, 125, 127, 137, 139, 141, 143, 153, 155, 157, 159, 161, 163, 165, 167, 169, 171, 177, 179, 13, 183, 187, 5, 7, 11, 15, 17, 95, 97, 99, 101, 105, 109, 111, 113, 121, 123, 125, 127, 129, 131, 133, 135, 141, 143, 149, 151, 153, 155, 157, 159, 161, 163, 165, 169, 177, 179, 13, 183, 5, 7, 11, 15, 17, 95, 97, 99, 101, 21, 105, 109, 111, 113, 121, 123, 125, 127, 141, 143, 153, 155, 157, 159, 161, 163, 165, 169, 177, 179, 13, 183, 5, 7, 11, 15, 17, 95, 97, 99, 101, 103, 105, 109, 111, 113, 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, 177, 179, 13, 183, 5, 7, 11, 15, 17, 95, 97, 99, 101, 103, 21, 105, 109, 111, 113, 121, 123, 125, 127, 137, 139, 141, 143, 153, 155, 157, 159, 161, 163, 165, 167, 169, 177, 179, 13, 183, 105, 109, 111, 133, 153, 157, 155, 159, 133, 153, 157, 155, 159, 109, 127, 123, 133, 157, 157, 165, 177, 179, 13, 183, 105, 109, 111, 133, 153, 157, 155, 159, 133, 153, 157, 155, 159, 109, 127, 123, 133, 157, 157, 165, 177, 179, 13, 183, 105, 109, 111, 133, 153, 157, 155, 159, 165, 177, 179, 13, 183, 105, 109, 111, 133, 153, 157, 155, 159, 165, 177, 179, 13, 183, 97, 35, 37, 55, 73, 73, 81, 13, 35, 37, 61, 53, 81, 91, 177, 179, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 111, 165, 13, 111, 165, 13, 13 ] }
static inline void FUNC_0(rgb32to15)(const uint8_t *src, uint8_t *dst, long src_size) { const uint8_t *VAR_0 = src; const uint8_t *VAR_1; #ifdef HAVE_MMX const uint8_t *mm_end; #endif uint16_t *d = (uint16_t *)dst; VAR_1 = VAR_0 + src_size; #ifdef HAVE_MMX mm_end = VAR_1 - 15; #if 1 asm volatile( "movq %3, %%mm5 \n\t" "movq %4, %%mm6 \n\t" "movq %5, %%mm7 \n\t" "jmp 2f \n\t" ASMALIGN(4) "1: \n\t" PREFETCH" 32(%1) \n\t" "movd (%1), %%mm0 \n\t" "movd 4(%1), %%mm3 \n\t" "punpckldq 8(%1), %%mm0 \n\t" "punpckldq 12(%1), %%mm3 \n\t" "movq %%mm0, %%mm1 \n\t" "movq %%mm3, %%mm4 \n\t" "pand %%mm6, %%mm0 \n\t" "pand %%mm6, %%mm3 \n\t" "pmaddwd %%mm7, %%mm0 \n\t" "pmaddwd %%mm7, %%mm3 \n\t" "pand %%mm5, %%mm1 \n\t" "pand %%mm5, %%mm4 \n\t" "por %%mm1, %%mm0 \n\t" "por %%mm4, %%mm3 \n\t" "psrld $6, %%mm0 \n\t" "pslld $10, %%mm3 \n\t" "por %%mm3, %%mm0 \n\t" MOVNTQ" %%mm0, (%0) \n\t" "add $16, %1 \n\t" "add $8, %0 \n\t" "2: \n\t" "cmp %2, %1 \n\t" " jb 1b \n\t" : "+r" (d), "+r"(VAR_0) : "r" (mm_end), "m" (mask3215g), "m" (mask3216br), "m" (mul3215) ); #else __asm __volatile(PREFETCH" %0"::"m"(*src):"memory"); __asm __volatile( "movq %0, %%mm7\n\t" "movq %1, %%mm6\n\t" ::"m"(red_15mask),"m"(green_15mask)); while(VAR_0 < mm_end) { __asm __volatile( PREFETCH" 32%1\n\t" "movd %1, %%mm0\n\t" "movd 4%1, %%mm3\n\t" "punpckldq 8%1, %%mm0\n\t" "punpckldq 12%1, %%mm3\n\t" "movq %%mm0, %%mm1\n\t" "movq %%mm0, %%mm2\n\t" "movq %%mm3, %%mm4\n\t" "movq %%mm3, %%mm5\n\t" "psrlq $3, %%mm0\n\t" "psrlq $3, %%mm3\n\t" "pand %2, %%mm0\n\t" "pand %2, %%mm3\n\t" "psrlq $6, %%mm1\n\t" "psrlq $6, %%mm4\n\t" "pand %%mm6, %%mm1\n\t" "pand %%mm6, %%mm4\n\t" "psrlq $9, %%mm2\n\t" "psrlq $9, %%mm5\n\t" "pand %%mm7, %%mm2\n\t" "pand %%mm7, %%mm5\n\t" "por %%mm1, %%mm0\n\t" "por %%mm4, %%mm3\n\t" "por %%mm2, %%mm0\n\t" "por %%mm5, %%mm3\n\t" "psllq $16, %%mm3\n\t" "por %%mm3, %%mm0\n\t" MOVNTQ" %%mm0, %0\n\t" :"=m"(*d):"m"(*VAR_0),"m"(blue_15mask):"memory"); d += 4; VAR_0 += 16; } #endif __asm __volatile(SFENCE:::"memory"); __asm __volatile(EMMS:::"memory"); #endif while(VAR_0 < VAR_1) { register int VAR_2 = *(uint32_t*)VAR_0; VAR_0 += 4; *d++ = ((VAR_2&0xFF)>>3) + ((VAR_2&0xF800)>>6) + ((VAR_2&0xF80000)>>9); } }
[ "static inline void FUNC_0(rgb32to15)(const uint8_t *src, uint8_t *dst, long src_size)\n{", "const uint8_t *VAR_0 = src;", "const uint8_t *VAR_1;", "#ifdef HAVE_MMX\nconst uint8_t *mm_end;", "#endif\nuint16_t *d = (uint16_t *)dst;", "VAR_1 = VAR_0 + src_size;", "#ifdef HAVE_MMX\nmm_end = VAR_1 - 15;", "#if 1\nasm volatile(\n\"movq %3, %%mm5\t\t\t\\n\\t\"\n\"movq %4, %%mm6\t\t\t\\n\\t\"\n\"movq %5, %%mm7\t\t\t\\n\\t\"\n\"jmp 2f\t\t\t\t\\n\\t\"\nASMALIGN(4)\n\"1:\t\t\t\t\\n\\t\"\nPREFETCH\" 32(%1)\t\t\\n\\t\"\n\"movd\t(%1), %%mm0\t\t\\n\\t\"\n\"movd\t4(%1), %%mm3\t\t\\n\\t\"\n\"punpckldq 8(%1), %%mm0\t\t\\n\\t\"\n\"punpckldq 12(%1), %%mm3\t\\n\\t\"\n\"movq %%mm0, %%mm1\t\t\\n\\t\"\n\"movq %%mm3, %%mm4\t\t\\n\\t\"\n\"pand %%mm6, %%mm0\t\t\\n\\t\"\n\"pand %%mm6, %%mm3\t\t\\n\\t\"\n\"pmaddwd %%mm7, %%mm0\t\t\\n\\t\"\n\"pmaddwd %%mm7, %%mm3\t\t\\n\\t\"\n\"pand %%mm5, %%mm1\t\t\\n\\t\"\n\"pand %%mm5, %%mm4\t\t\\n\\t\"\n\"por %%mm1, %%mm0\t\t\\n\\t\"\n\"por %%mm4, %%mm3\t\t\\n\\t\"\n\"psrld $6, %%mm0\t\t\\n\\t\"\n\"pslld $10, %%mm3\t\t\\n\\t\"\n\"por %%mm3, %%mm0\t\t\\n\\t\"\nMOVNTQ\"\t%%mm0, (%0)\t\t\\n\\t\"\n\"add $16, %1\t\t\t\\n\\t\"\n\"add $8, %0\t\t\t\\n\\t\"\n\"2:\t\t\t\t\\n\\t\"\n\"cmp %2, %1\t\t\t\\n\\t\"\n\" jb 1b\t\t\t\t\\n\\t\"\n: \"+r\" (d), \"+r\"(VAR_0)\n: \"r\" (mm_end), \"m\" (mask3215g), \"m\" (mask3216br), \"m\" (mul3215)\n);", "#else\n__asm __volatile(PREFETCH\"\t%0\"::\"m\"(*src):\"memory\");", "__asm __volatile(\n\"movq\t%0, %%mm7\\n\\t\"\n\"movq\t%1, %%mm6\\n\\t\"\n::\"m\"(red_15mask),\"m\"(green_15mask));", "while(VAR_0 < mm_end)\n{", "__asm __volatile(\nPREFETCH\" 32%1\\n\\t\"\n\"movd\t%1, %%mm0\\n\\t\"\n\"movd\t4%1, %%mm3\\n\\t\"\n\"punpckldq 8%1, %%mm0\\n\\t\"\n\"punpckldq 12%1, %%mm3\\n\\t\"\n\"movq\t%%mm0, %%mm1\\n\\t\"\n\"movq\t%%mm0, %%mm2\\n\\t\"\n\"movq\t%%mm3, %%mm4\\n\\t\"\n\"movq\t%%mm3, %%mm5\\n\\t\"\n\"psrlq\t$3, %%mm0\\n\\t\"\n\"psrlq\t$3, %%mm3\\n\\t\"\n\"pand\t%2, %%mm0\\n\\t\"\n\"pand\t%2, %%mm3\\n\\t\"\n\"psrlq\t$6, %%mm1\\n\\t\"\n\"psrlq\t$6, %%mm4\\n\\t\"\n\"pand\t%%mm6, %%mm1\\n\\t\"\n\"pand\t%%mm6, %%mm4\\n\\t\"\n\"psrlq\t$9, %%mm2\\n\\t\"\n\"psrlq\t$9, %%mm5\\n\\t\"\n\"pand\t%%mm7, %%mm2\\n\\t\"\n\"pand\t%%mm7, %%mm5\\n\\t\"\n\"por\t%%mm1, %%mm0\\n\\t\"\n\"por\t%%mm4, %%mm3\\n\\t\"\n\"por\t%%mm2, %%mm0\\n\\t\"\n\"por\t%%mm5, %%mm3\\n\\t\"\n\"psllq\t$16, %%mm3\\n\\t\"\n\"por\t%%mm3, %%mm0\\n\\t\"\nMOVNTQ\"\t%%mm0, %0\\n\\t\"\n:\"=m\"(*d):\"m\"(*VAR_0),\"m\"(blue_15mask):\"memory\");", "d += 4;", "VAR_0 += 16;", "}", "#endif\n__asm __volatile(SFENCE:::\"memory\");", "__asm __volatile(EMMS:::\"memory\");", "#endif\nwhile(VAR_0 < VAR_1)\n{", "register int VAR_2 = *(uint32_t*)VAR_0; VAR_0 += 4;", "*d++ = ((VAR_2&0xFF)>>3) + ((VAR_2&0xF800)>>6) + ((VAR_2&0xF80000)>>9);", "}", "}" ]
[ 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 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, 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, 147, 149, 151, 153, 155, 157, 159, 161, 163, 165, 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175, 177 ], [ 179 ], [ 181, 183, 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ] ]
15,566
PPC_OP(tlbie) { do_tlbie(); RETURN(); }
true
qemu
d9bce9d99f4656ae0b0127f7472db9067b8f84ab
PPC_OP(tlbie) { do_tlbie(); RETURN(); }
{ "code": [ " RETURN();", "PPC_OP(tlbie)", " RETURN();" ], "line_no": [ 7, 1, 7 ] }
FUNC_0(VAR_0) { do_tlbie(); RETURN(); }
[ "FUNC_0(VAR_0)\n{", "do_tlbie();", "RETURN();", "}" ]
[ 1, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ] ]
15,568
static int avs_probe(AVProbeData * p) { const uint8_t *d; if (p->buf_size < 2) return 0; d = p->buf; if (d[0] == 'w' && d[1] == 'W' && d[2] == 0x10 && d[3] == 0) return 50; return 0; }
false
FFmpeg
87e8788680e16c51f6048af26f3f7830c35207a5
static int avs_probe(AVProbeData * p) { const uint8_t *d; if (p->buf_size < 2) return 0; d = p->buf; if (d[0] == 'w' && d[1] == 'W' && d[2] == 0x10 && d[3] == 0) return 50; return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVProbeData * VAR_0) { const uint8_t *VAR_1; if (VAR_0->buf_size < 2) return 0; VAR_1 = VAR_0->buf; if (VAR_1[0] == 'w' && VAR_1[1] == 'W' && VAR_1[2] == 0x10 && VAR_1[3] == 0) return 50; return 0; }
[ "static int FUNC_0(AVProbeData * VAR_0)\n{", "const uint8_t *VAR_1;", "if (VAR_0->buf_size < 2)\nreturn 0;", "VAR_1 = VAR_0->buf;", "if (VAR_1[0] == 'w' && VAR_1[1] == 'W' && VAR_1[2] == 0x10 && VAR_1[3] == 0)\nreturn 50;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9, 11 ], [ 13 ], [ 15, 17 ], [ 21 ], [ 23 ] ]