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
14,687
yuv2mono_2_c_template(SwsContext *c, const int16_t *buf[2], const int16_t *ubuf[2], const int16_t *vbuf[2], const int16_t *abuf[2], uint8_t *dest, int dstW, int yalpha, int uvalpha, int y, enum PixelFormat target) { const int16_t *buf0 = buf[0], *buf1 = buf[1]; const uint8_t * const d128 = dither_8x8_220[y & 7]; int yalpha1 = 4095 - yalpha; int i; for (i = 0; i < dstW; i += 8) { int Y, acc = 0; Y = (buf0[i + 0] * yalpha1 + buf1[i + 0] * yalpha) >> 19; accumulate_bit(acc, Y + d128[0]); Y = (buf0[i + 1] * yalpha1 + buf1[i + 1] * yalpha) >> 19; accumulate_bit(acc, Y + d128[1]); Y = (buf0[i + 2] * yalpha1 + buf1[i + 2] * yalpha) >> 19; accumulate_bit(acc, Y + d128[2]); Y = (buf0[i + 3] * yalpha1 + buf1[i + 3] * yalpha) >> 19; accumulate_bit(acc, Y + d128[3]); Y = (buf0[i + 4] * yalpha1 + buf1[i + 4] * yalpha) >> 19; accumulate_bit(acc, Y + d128[4]); Y = (buf0[i + 5] * yalpha1 + buf1[i + 5] * yalpha) >> 19; accumulate_bit(acc, Y + d128[5]); Y = (buf0[i + 6] * yalpha1 + buf1[i + 6] * yalpha) >> 19; accumulate_bit(acc, Y + d128[6]); Y = (buf0[i + 7] * yalpha1 + buf1[i + 7] * yalpha) >> 19; accumulate_bit(acc, Y + d128[7]); output_pixel(*dest++, acc); } }
true
FFmpeg
4860625236475da20d0da954017e8c7fe412dea2
yuv2mono_2_c_template(SwsContext *c, const int16_t *buf[2], const int16_t *ubuf[2], const int16_t *vbuf[2], const int16_t *abuf[2], uint8_t *dest, int dstW, int yalpha, int uvalpha, int y, enum PixelFormat target) { const int16_t *buf0 = buf[0], *buf1 = buf[1]; const uint8_t * const d128 = dither_8x8_220[y & 7]; int yalpha1 = 4095 - yalpha; int i; for (i = 0; i < dstW; i += 8) { int Y, acc = 0; Y = (buf0[i + 0] * yalpha1 + buf1[i + 0] * yalpha) >> 19; accumulate_bit(acc, Y + d128[0]); Y = (buf0[i + 1] * yalpha1 + buf1[i + 1] * yalpha) >> 19; accumulate_bit(acc, Y + d128[1]); Y = (buf0[i + 2] * yalpha1 + buf1[i + 2] * yalpha) >> 19; accumulate_bit(acc, Y + d128[2]); Y = (buf0[i + 3] * yalpha1 + buf1[i + 3] * yalpha) >> 19; accumulate_bit(acc, Y + d128[3]); Y = (buf0[i + 4] * yalpha1 + buf1[i + 4] * yalpha) >> 19; accumulate_bit(acc, Y + d128[4]); Y = (buf0[i + 5] * yalpha1 + buf1[i + 5] * yalpha) >> 19; accumulate_bit(acc, Y + d128[5]); Y = (buf0[i + 6] * yalpha1 + buf1[i + 6] * yalpha) >> 19; accumulate_bit(acc, Y + d128[6]); Y = (buf0[i + 7] * yalpha1 + buf1[i + 7] * yalpha) >> 19; accumulate_bit(acc, Y + d128[7]); output_pixel(*dest++, acc); } }
{ "code": [ " int yalpha1 = 4095 - yalpha;", " int yalpha1 = 4095 - yalpha;", " int yalpha1 = 4095 - yalpha;", " int yalpha1 = 4095 - yalpha;" ], "line_no": [ 17, 17, 17, 17 ] }
FUNC_0(SwsContext *VAR_0, const int16_t *VAR_1[2], const int16_t *VAR_2[2], const int16_t *VAR_3[2], const int16_t *VAR_4[2], uint8_t *VAR_5, int VAR_6, int VAR_7, int VAR_8, int VAR_9, enum PixelFormat VAR_10) { const int16_t *VAR_11 = VAR_1[0], *buf1 = VAR_1[1]; const uint8_t * const VAR_12 = dither_8x8_220[VAR_9 & 7]; int VAR_13 = 4095 - VAR_7; int VAR_14; for (VAR_14 = 0; VAR_14 < VAR_6; VAR_14 += 8) { int VAR_15, VAR_16 = 0; VAR_15 = (VAR_11[VAR_14 + 0] * VAR_13 + buf1[VAR_14 + 0] * VAR_7) >> 19; accumulate_bit(VAR_16, VAR_15 + VAR_12[0]); VAR_15 = (VAR_11[VAR_14 + 1] * VAR_13 + buf1[VAR_14 + 1] * VAR_7) >> 19; accumulate_bit(VAR_16, VAR_15 + VAR_12[1]); VAR_15 = (VAR_11[VAR_14 + 2] * VAR_13 + buf1[VAR_14 + 2] * VAR_7) >> 19; accumulate_bit(VAR_16, VAR_15 + VAR_12[2]); VAR_15 = (VAR_11[VAR_14 + 3] * VAR_13 + buf1[VAR_14 + 3] * VAR_7) >> 19; accumulate_bit(VAR_16, VAR_15 + VAR_12[3]); VAR_15 = (VAR_11[VAR_14 + 4] * VAR_13 + buf1[VAR_14 + 4] * VAR_7) >> 19; accumulate_bit(VAR_16, VAR_15 + VAR_12[4]); VAR_15 = (VAR_11[VAR_14 + 5] * VAR_13 + buf1[VAR_14 + 5] * VAR_7) >> 19; accumulate_bit(VAR_16, VAR_15 + VAR_12[5]); VAR_15 = (VAR_11[VAR_14 + 6] * VAR_13 + buf1[VAR_14 + 6] * VAR_7) >> 19; accumulate_bit(VAR_16, VAR_15 + VAR_12[6]); VAR_15 = (VAR_11[VAR_14 + 7] * VAR_13 + buf1[VAR_14 + 7] * VAR_7) >> 19; accumulate_bit(VAR_16, VAR_15 + VAR_12[7]); output_pixel(*VAR_5++, VAR_16); } }
[ "FUNC_0(SwsContext *VAR_0, const int16_t *VAR_1[2],\nconst int16_t *VAR_2[2], const int16_t *VAR_3[2],\nconst int16_t *VAR_4[2], uint8_t *VAR_5, int VAR_6,\nint VAR_7, int VAR_8, int VAR_9,\nenum PixelFormat VAR_10)\n{", "const int16_t *VAR_11 = VAR_1[0], *buf1 = VAR_1[1];", "const uint8_t * const VAR_12 = dither_8x8_220[VAR_9 & 7];", "int VAR_13 = 4095 - VAR_7;", "int VAR_14;", "for (VAR_14 = 0; VAR_14 < VAR_6; VAR_14 += 8) {", "int VAR_15, VAR_16 = 0;", "VAR_15 = (VAR_11[VAR_14 + 0] * VAR_13 + buf1[VAR_14 + 0] * VAR_7) >> 19;", "accumulate_bit(VAR_16, VAR_15 + VAR_12[0]);", "VAR_15 = (VAR_11[VAR_14 + 1] * VAR_13 + buf1[VAR_14 + 1] * VAR_7) >> 19;", "accumulate_bit(VAR_16, VAR_15 + VAR_12[1]);", "VAR_15 = (VAR_11[VAR_14 + 2] * VAR_13 + buf1[VAR_14 + 2] * VAR_7) >> 19;", "accumulate_bit(VAR_16, VAR_15 + VAR_12[2]);", "VAR_15 = (VAR_11[VAR_14 + 3] * VAR_13 + buf1[VAR_14 + 3] * VAR_7) >> 19;", "accumulate_bit(VAR_16, VAR_15 + VAR_12[3]);", "VAR_15 = (VAR_11[VAR_14 + 4] * VAR_13 + buf1[VAR_14 + 4] * VAR_7) >> 19;", "accumulate_bit(VAR_16, VAR_15 + VAR_12[4]);", "VAR_15 = (VAR_11[VAR_14 + 5] * VAR_13 + buf1[VAR_14 + 5] * VAR_7) >> 19;", "accumulate_bit(VAR_16, VAR_15 + VAR_12[5]);", "VAR_15 = (VAR_11[VAR_14 + 6] * VAR_13 + buf1[VAR_14 + 6] * VAR_7) >> 19;", "accumulate_bit(VAR_16, VAR_15 + VAR_12[6]);", "VAR_15 = (VAR_11[VAR_14 + 7] * VAR_13 + buf1[VAR_14 + 7] * VAR_7) >> 19;", "accumulate_bit(VAR_16, VAR_15 + VAR_12[7]);", "output_pixel(*VAR_5++, VAR_16);", "}", "}" ]
[ 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9, 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ], [ 67 ] ]
14,689
static int xwma_read_header(AVFormatContext *s, AVFormatParameters *ap) { int64_t size, av_uninit(data_size); uint32_t dpds_table_size = 0; uint32_t *dpds_table = 0; unsigned int tag; AVIOContext *pb = s->pb; AVStream *st; XWMAContext *xwma = s->priv_data; int i; /* The following code is mostly copied from wav.c, with some * minor alterations. */ /* check RIFF header */ tag = avio_rl32(pb); if (tag != MKTAG('R', 'I', 'F', 'F')) return -1; avio_rl32(pb); /* file size */ tag = avio_rl32(pb); if (tag != MKTAG('X', 'W', 'M', 'A')) return -1; /* parse fmt header */ tag = avio_rl32(pb); if (tag != MKTAG('f', 'm', 't', ' ')) return -1; size = avio_rl32(pb); st = av_new_stream(s, 0); if (!st) return AVERROR(ENOMEM); ff_get_wav_header(pb, st->codec, size); st->need_parsing = AVSTREAM_PARSE_NONE; /* All xWMA files I have seen contained WMAv2 data. If there are files * using WMA Pro or some other codec, then we need to figure out the right * extradata for that. Thus, ask the user for feedback, but try to go on * anyway. */ if (st->codec->codec_id != CODEC_ID_WMAV2) { av_log(s, AV_LOG_WARNING, "unexpected codec (tag 0x04%x; id %d)\n", st->codec->codec_tag, st->codec->codec_id); av_log_ask_for_sample(s, NULL); } else { /* In all xWMA files I have seen, there is no extradata. But the WMA * codecs require extradata, so we provide our own fake extradata. * * First, check that there really was no extradata in the header. If * there was, then try to use, after asking the the user to provide a * sample of this unusual file. */ if (st->codec->extradata_size != 0) { /* Surprise, surprise: We *did* get some extradata. No idea * if it will work, but just go on and try it, after asking * the user for a sample. */ av_log(s, AV_LOG_WARNING, "unexpected extradata (%d bytes)\n", st->codec->extradata_size); av_log_ask_for_sample(s, NULL); } else { st->codec->extradata_size = 6; st->codec->extradata = av_mallocz(6 + FF_INPUT_BUFFER_PADDING_SIZE); if (!st->codec->extradata) return AVERROR(ENOMEM); /* setup extradata with our experimentally obtained value */ st->codec->extradata[4] = 31; } } /* set the sample rate */ av_set_pts_info(st, 64, 1, st->codec->sample_rate); /* parse the remaining RIFF chunks */ for (;;) { if (pb->eof_reached) return -1; /* read next chunk tag */ tag = avio_rl32(pb); size = avio_rl32(pb); if (tag == MKTAG('d', 'a', 't', 'a')) { /* We assume that the data chunk comes last. */ break; } else if (tag == MKTAG('d','p','d','s')) { /* Quoting the MSDN xWMA docs on the dpds chunk: "Contains the * decoded packet cumulative data size array, each element is the * number of bytes accumulated after the corresponding xWMA packet * is decoded in order" * * Each packet has size equal to st->codec->block_align, which in * all cases I saw so far was always 2230. Thus, we can use the * dpds data to compute a seeking index. */ /* Error out if there is more than one dpds chunk. */ if (dpds_table) { av_log(s, AV_LOG_ERROR, "two dpds chunks present\n"); return -1; } /* Compute the number of entries in the dpds chunk. */ if (size & 3) { /* Size should be divisible by four */ av_log(s, AV_LOG_WARNING, "dpds chunk size "PRId64" not divisible by 4\n", size); } dpds_table_size = size / 4; if (dpds_table_size == 0 || dpds_table_size >= INT_MAX / 4) { av_log(s, AV_LOG_ERROR, "dpds chunk size "PRId64" invalid\n", size); return -1; } /* Allocate some temporary storage to keep the dpds data around. * for processing later on. */ dpds_table = av_malloc(dpds_table_size * sizeof(uint32_t)); if (!dpds_table) { return AVERROR(ENOMEM); } for (i = 0; i < dpds_table_size; ++i) { dpds_table[i] = avio_rl32(pb); size -= 4; } } avio_skip(pb, size); } /* Determine overall data length */ if (size < 0) return -1; if (!size) { xwma->data_end = INT64_MAX; } else xwma->data_end = avio_tell(pb) + size; if (dpds_table && dpds_table_size) { int64_t cur_pos; const uint32_t bytes_per_sample = (st->codec->channels * st->codec->bits_per_coded_sample) >> 3; /* Estimate the duration from the total number of output bytes. */ const uint64_t total_decoded_bytes = dpds_table[dpds_table_size - 1]; st->duration = total_decoded_bytes / bytes_per_sample; /* Use the dpds data to build a seek table. We can only do this after * we know the offset to the data chunk, as we need that to determine * the actual offset to each input block. * Note: If we allowed ourselves to assume that the data chunk always * follows immediately after the dpds block, we could of course guess * the data block's start offset already while reading the dpds chunk. * I decided against that, just in case other chunks ever are * discovered. */ cur_pos = avio_tell(pb); for (i = 0; i < dpds_table_size; ++i) { /* From the number of output bytes that would accumulate in the * output buffer after decoding the first (i+1) packets, we compute * an offset / timestamp pair. */ av_add_index_entry(st, cur_pos + (i+1) * st->codec->block_align, /* pos */ dpds_table[i] / bytes_per_sample, /* timestamp */ st->codec->block_align, /* size */ 0, /* duration */ AVINDEX_KEYFRAME); } } else if (st->codec->bit_rate) { /* No dpds chunk was present (or only an empty one), so estimate * the total duration using the average bits per sample and the * total data length. */ st->duration = (size<<3) * st->codec->sample_rate / st->codec->bit_rate; } av_free(dpds_table); return 0; }
true
FFmpeg
ca402f32e392590a81a1381dab41c4f9c2c2f98a
static int xwma_read_header(AVFormatContext *s, AVFormatParameters *ap) { int64_t size, av_uninit(data_size); uint32_t dpds_table_size = 0; uint32_t *dpds_table = 0; unsigned int tag; AVIOContext *pb = s->pb; AVStream *st; XWMAContext *xwma = s->priv_data; int i; tag = avio_rl32(pb); if (tag != MKTAG('R', 'I', 'F', 'F')) return -1; avio_rl32(pb); tag = avio_rl32(pb); if (tag != MKTAG('X', 'W', 'M', 'A')) return -1; tag = avio_rl32(pb); if (tag != MKTAG('f', 'm', 't', ' ')) return -1; size = avio_rl32(pb); st = av_new_stream(s, 0); if (!st) return AVERROR(ENOMEM); ff_get_wav_header(pb, st->codec, size); st->need_parsing = AVSTREAM_PARSE_NONE; if (st->codec->codec_id != CODEC_ID_WMAV2) { av_log(s, AV_LOG_WARNING, "unexpected codec (tag 0x04%x; id %d)\n", st->codec->codec_tag, st->codec->codec_id); av_log_ask_for_sample(s, NULL); } else { if (st->codec->extradata_size != 0) { av_log(s, AV_LOG_WARNING, "unexpected extradata (%d bytes)\n", st->codec->extradata_size); av_log_ask_for_sample(s, NULL); } else { st->codec->extradata_size = 6; st->codec->extradata = av_mallocz(6 + FF_INPUT_BUFFER_PADDING_SIZE); if (!st->codec->extradata) return AVERROR(ENOMEM); st->codec->extradata[4] = 31; } } av_set_pts_info(st, 64, 1, st->codec->sample_rate); for (;;) { if (pb->eof_reached) return -1; tag = avio_rl32(pb); size = avio_rl32(pb); if (tag == MKTAG('d', 'a', 't', 'a')) { break; } else if (tag == MKTAG('d','p','d','s')) { if (dpds_table) { av_log(s, AV_LOG_ERROR, "two dpds chunks present\n"); return -1; } if (size & 3) { av_log(s, AV_LOG_WARNING, "dpds chunk size "PRId64" not divisible by 4\n", size); } dpds_table_size = size / 4; if (dpds_table_size == 0 || dpds_table_size >= INT_MAX / 4) { av_log(s, AV_LOG_ERROR, "dpds chunk size "PRId64" invalid\n", size); return -1; } dpds_table = av_malloc(dpds_table_size * sizeof(uint32_t)); if (!dpds_table) { return AVERROR(ENOMEM); } for (i = 0; i < dpds_table_size; ++i) { dpds_table[i] = avio_rl32(pb); size -= 4; } } avio_skip(pb, size); } if (size < 0) return -1; if (!size) { xwma->data_end = INT64_MAX; } else xwma->data_end = avio_tell(pb) + size; if (dpds_table && dpds_table_size) { int64_t cur_pos; const uint32_t bytes_per_sample = (st->codec->channels * st->codec->bits_per_coded_sample) >> 3; const uint64_t total_decoded_bytes = dpds_table[dpds_table_size - 1]; st->duration = total_decoded_bytes / bytes_per_sample; cur_pos = avio_tell(pb); for (i = 0; i < dpds_table_size; ++i) { av_add_index_entry(st, cur_pos + (i+1) * st->codec->block_align, dpds_table[i] / bytes_per_sample, st->codec->block_align, 0, AVINDEX_KEYFRAME); } } else if (st->codec->bit_rate) { st->duration = (size<<3) * st->codec->sample_rate / st->codec->bit_rate; } av_free(dpds_table); return 0; }
{ "code": [ " ff_get_wav_header(pb, st->codec, size);", " ff_get_wav_header(pb, st->codec, size);" ], "line_no": [ 67, 67 ] }
static int FUNC_0(AVFormatContext *VAR_0, AVFormatParameters *VAR_1) { int64_t size, av_uninit(data_size); uint32_t dpds_table_size = 0; uint32_t *dpds_table = 0; unsigned int VAR_2; AVIOContext *pb = VAR_0->pb; AVStream *st; XWMAContext *xwma = VAR_0->priv_data; int VAR_3; VAR_2 = avio_rl32(pb); if (VAR_2 != MKTAG('R', 'I', 'F', 'F')) return -1; avio_rl32(pb); VAR_2 = avio_rl32(pb); if (VAR_2 != MKTAG('X', 'W', 'M', 'A')) return -1; VAR_2 = avio_rl32(pb); if (VAR_2 != MKTAG('f', 'm', 't', ' ')) return -1; size = avio_rl32(pb); st = av_new_stream(VAR_0, 0); if (!st) return AVERROR(ENOMEM); ff_get_wav_header(pb, st->codec, size); st->need_parsing = AVSTREAM_PARSE_NONE; if (st->codec->codec_id != CODEC_ID_WMAV2) { av_log(VAR_0, AV_LOG_WARNING, "unexpected codec (VAR_2 0x04%x; id %d)\n", st->codec->codec_tag, st->codec->codec_id); av_log_ask_for_sample(VAR_0, NULL); } else { if (st->codec->extradata_size != 0) { av_log(VAR_0, AV_LOG_WARNING, "unexpected extradata (%d bytes)\n", st->codec->extradata_size); av_log_ask_for_sample(VAR_0, NULL); } else { st->codec->extradata_size = 6; st->codec->extradata = av_mallocz(6 + FF_INPUT_BUFFER_PADDING_SIZE); if (!st->codec->extradata) return AVERROR(ENOMEM); st->codec->extradata[4] = 31; } } av_set_pts_info(st, 64, 1, st->codec->sample_rate); for (;;) { if (pb->eof_reached) return -1; VAR_2 = avio_rl32(pb); size = avio_rl32(pb); if (VAR_2 == MKTAG('d', 'a', 't', 'a')) { break; } else if (VAR_2 == MKTAG('d','p','d','VAR_0')) { if (dpds_table) { av_log(VAR_0, AV_LOG_ERROR, "two dpds chunks present\n"); return -1; } if (size & 3) { av_log(VAR_0, AV_LOG_WARNING, "dpds chunk size "PRId64" not divisible by 4\n", size); } dpds_table_size = size / 4; if (dpds_table_size == 0 || dpds_table_size >= INT_MAX / 4) { av_log(VAR_0, AV_LOG_ERROR, "dpds chunk size "PRId64" invalid\n", size); return -1; } dpds_table = av_malloc(dpds_table_size * sizeof(uint32_t)); if (!dpds_table) { return AVERROR(ENOMEM); } for (VAR_3 = 0; VAR_3 < dpds_table_size; ++VAR_3) { dpds_table[VAR_3] = avio_rl32(pb); size -= 4; } } avio_skip(pb, size); } if (size < 0) return -1; if (!size) { xwma->data_end = INT64_MAX; } else xwma->data_end = avio_tell(pb) + size; if (dpds_table && dpds_table_size) { int64_t cur_pos; const uint32_t VAR_4 = (st->codec->channels * st->codec->bits_per_coded_sample) >> 3; const uint64_t VAR_5 = dpds_table[dpds_table_size - 1]; st->duration = VAR_5 / VAR_4; cur_pos = avio_tell(pb); for (VAR_3 = 0; VAR_3 < dpds_table_size; ++VAR_3) { av_add_index_entry(st, cur_pos + (VAR_3+1) * st->codec->block_align, dpds_table[VAR_3] / VAR_4, st->codec->block_align, 0, AVINDEX_KEYFRAME); } } else if (st->codec->bit_rate) { st->duration = (size<<3) * st->codec->sample_rate / st->codec->bit_rate; } av_free(dpds_table); return 0; }
[ "static int FUNC_0(AVFormatContext *VAR_0, AVFormatParameters *VAR_1)\n{", "int64_t size, av_uninit(data_size);", "uint32_t dpds_table_size = 0;", "uint32_t *dpds_table = 0;", "unsigned int VAR_2;", "AVIOContext *pb = VAR_0->pb;", "AVStream *st;", "XWMAContext *xwma = VAR_0->priv_data;", "int VAR_3;", "VAR_2 = avio_rl32(pb);", "if (VAR_2 != MKTAG('R', 'I', 'F', 'F'))\nreturn -1;", "avio_rl32(pb);", "VAR_2 = avio_rl32(pb);", "if (VAR_2 != MKTAG('X', 'W', 'M', 'A'))\nreturn -1;", "VAR_2 = avio_rl32(pb);", "if (VAR_2 != MKTAG('f', 'm', 't', ' '))\nreturn -1;", "size = avio_rl32(pb);", "st = av_new_stream(VAR_0, 0);", "if (!st)\nreturn AVERROR(ENOMEM);", "ff_get_wav_header(pb, st->codec, size);", "st->need_parsing = AVSTREAM_PARSE_NONE;", "if (st->codec->codec_id != CODEC_ID_WMAV2) {", "av_log(VAR_0, AV_LOG_WARNING, \"unexpected codec (VAR_2 0x04%x; id %d)\\n\",", "st->codec->codec_tag, st->codec->codec_id);", "av_log_ask_for_sample(VAR_0, NULL);", "} else {", "if (st->codec->extradata_size != 0) {", "av_log(VAR_0, AV_LOG_WARNING, \"unexpected extradata (%d bytes)\\n\",\nst->codec->extradata_size);", "av_log_ask_for_sample(VAR_0, NULL);", "} else {", "st->codec->extradata_size = 6;", "st->codec->extradata = av_mallocz(6 + FF_INPUT_BUFFER_PADDING_SIZE);", "if (!st->codec->extradata)\nreturn AVERROR(ENOMEM);", "st->codec->extradata[4] = 31;", "}", "}", "av_set_pts_info(st, 64, 1, st->codec->sample_rate);", "for (;;) {", "if (pb->eof_reached)\nreturn -1;", "VAR_2 = avio_rl32(pb);", "size = avio_rl32(pb);", "if (VAR_2 == MKTAG('d', 'a', 't', 'a')) {", "break;", "} else if (VAR_2 == MKTAG('d','p','d','VAR_0')) {", "if (dpds_table) {", "av_log(VAR_0, AV_LOG_ERROR, \"two dpds chunks present\\n\");", "return -1;", "}", "if (size & 3) {", "av_log(VAR_0, AV_LOG_WARNING, \"dpds chunk size \"PRId64\" not divisible by 4\\n\", size);", "}", "dpds_table_size = size / 4;", "if (dpds_table_size == 0 || dpds_table_size >= INT_MAX / 4) {", "av_log(VAR_0, AV_LOG_ERROR, \"dpds chunk size \"PRId64\" invalid\\n\", size);", "return -1;", "}", "dpds_table = av_malloc(dpds_table_size * sizeof(uint32_t));", "if (!dpds_table) {", "return AVERROR(ENOMEM);", "}", "for (VAR_3 = 0; VAR_3 < dpds_table_size; ++VAR_3) {", "dpds_table[VAR_3] = avio_rl32(pb);", "size -= 4;", "}", "}", "avio_skip(pb, size);", "}", "if (size < 0)\nreturn -1;", "if (!size) {", "xwma->data_end = INT64_MAX;", "} else", "xwma->data_end = avio_tell(pb) + size;", "if (dpds_table && dpds_table_size) {", "int64_t cur_pos;", "const uint32_t VAR_4\n= (st->codec->channels * st->codec->bits_per_coded_sample) >> 3;", "const uint64_t VAR_5 = dpds_table[dpds_table_size - 1];", "st->duration = VAR_5 / VAR_4;", "cur_pos = avio_tell(pb);", "for (VAR_3 = 0; VAR_3 < dpds_table_size; ++VAR_3) {", "av_add_index_entry(st,\ncur_pos + (VAR_3+1) * st->codec->block_align,\ndpds_table[VAR_3] / VAR_4,\nst->codec->block_align,\n0,\nAVINDEX_KEYFRAME);", "}", "} else if (st->codec->bit_rate) {", "st->duration = (size<<3) * st->codec->sample_rate / st->codec->bit_rate;", "}", "av_free(dpds_table);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 33 ], [ 35, 37 ], [ 39 ], [ 41 ], [ 43, 45 ], [ 51 ], [ 53, 55 ], [ 57 ], [ 59 ], [ 61, 63 ], [ 67 ], [ 69 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 107 ], [ 117, 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129, 131 ], [ 137 ], [ 139 ], [ 141 ], [ 147 ], [ 153 ], [ 155, 157 ], [ 161 ], [ 163 ], [ 165 ], [ 169 ], [ 171 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 231 ], [ 233 ], [ 235 ], [ 237 ], [ 241 ], [ 243 ], [ 245 ], [ 247 ], [ 249 ], [ 251 ], [ 253 ], [ 259, 261 ], [ 263 ], [ 265 ], [ 267 ], [ 269 ], [ 275 ], [ 277 ], [ 279, 281 ], [ 287 ], [ 289 ], [ 311 ], [ 313 ], [ 323, 325, 327, 329, 331, 333 ], [ 335 ], [ 337 ], [ 347 ], [ 349 ], [ 353 ], [ 357 ], [ 359 ] ]
14,690
void qmp_migrate_set_parameters(bool has_compress_level, int64_t compress_level, bool has_compress_threads, int64_t compress_threads, bool has_decompress_threads, int64_t decompress_threads, bool has_cpu_throttle_initial, int64_t cpu_throttle_initial, bool has_cpu_throttle_increment, int64_t cpu_throttle_increment, Error **errp) { MigrationState *s = migrate_get_current(); if (has_compress_level && (compress_level < 0 || compress_level > 9)) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "compress_level", "is invalid, it should be in the range of 0 to 9"); return; } if (has_compress_threads && (compress_threads < 1 || compress_threads > 255)) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "compress_threads", "is invalid, it should be in the range of 1 to 255"); return; } if (has_decompress_threads && (decompress_threads < 1 || decompress_threads > 255)) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "decompress_threads", "is invalid, it should be in the range of 1 to 255"); return; } if (has_cpu_throttle_initial && (cpu_throttle_initial < 1 || cpu_throttle_initial > 99)) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "cpu_throttle_initial", "an integer in the range of 1 to 99"); } if (has_cpu_throttle_increment && (cpu_throttle_increment < 1 || cpu_throttle_increment > 99)) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "cpu_throttle_increment", "an integer in the range of 1 to 99"); } if (has_compress_level) { s->parameters.compress_level = compress_level; } if (has_compress_threads) { s->parameters.compress_threads = compress_threads; } if (has_decompress_threads) { s->parameters.decompress_threads = decompress_threads; } if (has_cpu_throttle_initial) { s->parameters.cpu_throttle_initial = cpu_throttle_initial; } if (has_cpu_throttle_increment) { s->parameters.cpu_throttle_increment = cpu_throttle_increment; } if (has_tls_creds) { g_free(s->parameters.tls_creds); s->parameters.tls_creds = g_strdup(tls_creds); } if (has_tls_hostname) { g_free(s->parameters.tls_hostname); s->parameters.tls_hostname = g_strdup(tls_hostname); } }
true
qemu
69ef1f36b0f882fc5ba9491fb272fa5f83ac1d3d
void qmp_migrate_set_parameters(bool has_compress_level, int64_t compress_level, bool has_compress_threads, int64_t compress_threads, bool has_decompress_threads, int64_t decompress_threads, bool has_cpu_throttle_initial, int64_t cpu_throttle_initial, bool has_cpu_throttle_increment, int64_t cpu_throttle_increment, Error **errp) { MigrationState *s = migrate_get_current(); if (has_compress_level && (compress_level < 0 || compress_level > 9)) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "compress_level", "is invalid, it should be in the range of 0 to 9"); return; } if (has_compress_threads && (compress_threads < 1 || compress_threads > 255)) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "compress_threads", "is invalid, it should be in the range of 1 to 255"); return; } if (has_decompress_threads && (decompress_threads < 1 || decompress_threads > 255)) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "decompress_threads", "is invalid, it should be in the range of 1 to 255"); return; } if (has_cpu_throttle_initial && (cpu_throttle_initial < 1 || cpu_throttle_initial > 99)) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "cpu_throttle_initial", "an integer in the range of 1 to 99"); } if (has_cpu_throttle_increment && (cpu_throttle_increment < 1 || cpu_throttle_increment > 99)) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "cpu_throttle_increment", "an integer in the range of 1 to 99"); } if (has_compress_level) { s->parameters.compress_level = compress_level; } if (has_compress_threads) { s->parameters.compress_threads = compress_threads; } if (has_decompress_threads) { s->parameters.decompress_threads = decompress_threads; } if (has_cpu_throttle_initial) { s->parameters.cpu_throttle_initial = cpu_throttle_initial; } if (has_cpu_throttle_increment) { s->parameters.cpu_throttle_increment = cpu_throttle_increment; } if (has_tls_creds) { g_free(s->parameters.tls_creds); s->parameters.tls_creds = g_strdup(tls_creds); } if (has_tls_hostname) { g_free(s->parameters.tls_hostname); s->parameters.tls_hostname = g_strdup(tls_hostname); } }
{ "code": [], "line_no": [] }
void FUNC_0(bool VAR_0, int64_t VAR_1, bool VAR_2, int64_t VAR_3, bool VAR_4, int64_t VAR_5, bool VAR_6, int64_t VAR_7, bool VAR_8, int64_t VAR_9, Error **VAR_10) { MigrationState *s = migrate_get_current(); if (VAR_0 && (VAR_1 < 0 || VAR_1 > 9)) { error_setg(VAR_10, QERR_INVALID_PARAMETER_VALUE, "VAR_1", "is invalid, it should be in the range of 0 to 9"); return; } if (VAR_2 && (VAR_3 < 1 || VAR_3 > 255)) { error_setg(VAR_10, QERR_INVALID_PARAMETER_VALUE, "VAR_3", "is invalid, it should be in the range of 1 to 255"); return; } if (VAR_4 && (VAR_5 < 1 || VAR_5 > 255)) { error_setg(VAR_10, QERR_INVALID_PARAMETER_VALUE, "VAR_5", "is invalid, it should be in the range of 1 to 255"); return; } if (VAR_6 && (VAR_7 < 1 || VAR_7 > 99)) { error_setg(VAR_10, QERR_INVALID_PARAMETER_VALUE, "VAR_7", "an integer in the range of 1 to 99"); } if (VAR_8 && (VAR_9 < 1 || VAR_9 > 99)) { error_setg(VAR_10, QERR_INVALID_PARAMETER_VALUE, "VAR_9", "an integer in the range of 1 to 99"); } if (VAR_0) { s->parameters.VAR_1 = VAR_1; } if (VAR_2) { s->parameters.VAR_3 = VAR_3; } if (VAR_4) { s->parameters.VAR_5 = VAR_5; } if (VAR_6) { s->parameters.VAR_7 = VAR_7; } if (VAR_8) { s->parameters.VAR_9 = VAR_9; } if (has_tls_creds) { g_free(s->parameters.tls_creds); s->parameters.tls_creds = g_strdup(tls_creds); } if (has_tls_hostname) { g_free(s->parameters.tls_hostname); s->parameters.tls_hostname = g_strdup(tls_hostname); } }
[ "void FUNC_0(bool VAR_0,\nint64_t VAR_1,\nbool VAR_2,\nint64_t VAR_3,\nbool VAR_4,\nint64_t VAR_5,\nbool VAR_6,\nint64_t VAR_7,\nbool VAR_8,\nint64_t VAR_9,\nError **VAR_10)\n{", "MigrationState *s = migrate_get_current();", "if (VAR_0 && (VAR_1 < 0 || VAR_1 > 9)) {", "error_setg(VAR_10, QERR_INVALID_PARAMETER_VALUE, \"VAR_1\",\n\"is invalid, it should be in the range of 0 to 9\");", "return;", "}", "if (VAR_2 &&\n(VAR_3 < 1 || VAR_3 > 255)) {", "error_setg(VAR_10, QERR_INVALID_PARAMETER_VALUE,\n\"VAR_3\",\n\"is invalid, it should be in the range of 1 to 255\");", "return;", "}", "if (VAR_4 &&\n(VAR_5 < 1 || VAR_5 > 255)) {", "error_setg(VAR_10, QERR_INVALID_PARAMETER_VALUE,\n\"VAR_5\",\n\"is invalid, it should be in the range of 1 to 255\");", "return;", "}", "if (VAR_6 &&\n(VAR_7 < 1 || VAR_7 > 99)) {", "error_setg(VAR_10, QERR_INVALID_PARAMETER_VALUE,\n\"VAR_7\",\n\"an integer in the range of 1 to 99\");", "}", "if (VAR_8 &&\n(VAR_9 < 1 || VAR_9 > 99)) {", "error_setg(VAR_10, QERR_INVALID_PARAMETER_VALUE,\n\"VAR_9\",\n\"an integer in the range of 1 to 99\");", "}", "if (VAR_0) {", "s->parameters.VAR_1 = VAR_1;", "}", "if (VAR_2) {", "s->parameters.VAR_3 = VAR_3;", "}", "if (VAR_4) {", "s->parameters.VAR_5 = VAR_5;", "}", "if (VAR_6) {", "s->parameters.VAR_7 = VAR_7;", "}", "if (VAR_8) {", "s->parameters.VAR_9 = VAR_9;", "}", "if (has_tls_creds) {", "g_free(s->parameters.tls_creds);", "s->parameters.tls_creds = g_strdup(tls_creds);", "}", "if (has_tls_hostname) {", "g_free(s->parameters.tls_hostname);", "s->parameters.tls_hostname = g_strdup(tls_hostname);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 25, 27 ], [ 29 ], [ 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 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ] ]
14,691
static int swf_write_packet(AVFormatContext *s, int stream_index, const uint8_t *buf, int size, int64_t pts) { AVCodecContext *codec = &s->streams[stream_index]->codec; if (codec->codec_type == CODEC_TYPE_AUDIO) return swf_write_audio(s, buf, size); else return swf_write_video(s, codec, buf, size); }
true
FFmpeg
747a0554ea8ad09404c1f5b80239ebd8d71b291e
static int swf_write_packet(AVFormatContext *s, int stream_index, const uint8_t *buf, int size, int64_t pts) { AVCodecContext *codec = &s->streams[stream_index]->codec; if (codec->codec_type == CODEC_TYPE_AUDIO) return swf_write_audio(s, buf, size); else return swf_write_video(s, codec, buf, size); }
{ "code": [ " return swf_write_audio(s, buf, size);" ], "line_no": [ 11 ] }
static int FUNC_0(AVFormatContext *VAR_0, int VAR_1, const uint8_t *VAR_2, int VAR_3, int64_t VAR_4) { AVCodecContext *codec = &VAR_0->streams[VAR_1]->codec; if (codec->codec_type == CODEC_TYPE_AUDIO) return swf_write_audio(VAR_0, VAR_2, VAR_3); else return swf_write_video(VAR_0, codec, VAR_2, VAR_3); }
[ "static int FUNC_0(AVFormatContext *VAR_0, int VAR_1,\nconst uint8_t *VAR_2, int VAR_3, int64_t VAR_4)\n{", "AVCodecContext *codec = &VAR_0->streams[VAR_1]->codec;", "if (codec->codec_type == CODEC_TYPE_AUDIO)\nreturn swf_write_audio(VAR_0, VAR_2, VAR_3);", "else\nreturn swf_write_video(VAR_0, codec, VAR_2, VAR_3);", "}" ]
[ 0, 0, 1, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9, 11 ], [ 13, 15 ], [ 17 ] ]
14,692
static void hScale16To15_c(SwsContext *c, int16_t *dst, int dstW, const uint8_t *_src, const int16_t *filter, const int16_t *filterPos, int filterSize) { int i; const uint16_t *src = (const uint16_t *) _src; int sh = av_pix_fmt_descriptors[c->srcFormat].comp[0].depth_minus1; for (i = 0; i < dstW; i++) { int j; int srcPos = filterPos[i]; int val = 0; for (j = 0; j < filterSize; j++) { val += src[srcPos + j] * filter[filterSize * i + j]; } // filter=14 bit, input=16 bit, output=30 bit, >> 15 makes 15 bit dst[i] = FFMIN(val >> sh, (1 << 15) - 1); } }
true
FFmpeg
2254b559cbcfc0418135f09add37c0a5866b1981
static void hScale16To15_c(SwsContext *c, int16_t *dst, int dstW, const uint8_t *_src, const int16_t *filter, const int16_t *filterPos, int filterSize) { int i; const uint16_t *src = (const uint16_t *) _src; int sh = av_pix_fmt_descriptors[c->srcFormat].comp[0].depth_minus1; for (i = 0; i < dstW; i++) { int j; int srcPos = filterPos[i]; int val = 0; for (j = 0; j < filterSize; j++) { val += src[srcPos + j] * filter[filterSize * i + j]; } dst[i] = FFMIN(val >> sh, (1 << 15) - 1); } }
{ "code": [ " const int16_t *filterPos, int filterSize)", " const int16_t *filterPos, int filterSize)" ], "line_no": [ 5, 5 ] }
static void FUNC_0(SwsContext *VAR_0, int16_t *VAR_1, int VAR_2, const uint8_t *VAR_3, const int16_t *VAR_4, const int16_t *VAR_5, int VAR_6) { int VAR_7; const uint16_t *VAR_8 = (const uint16_t *) VAR_3; int VAR_9 = av_pix_fmt_descriptors[VAR_0->srcFormat].comp[0].depth_minus1; for (VAR_7 = 0; VAR_7 < VAR_2; VAR_7++) { int VAR_10; int VAR_11 = VAR_5[VAR_7]; int VAR_12 = 0; for (VAR_10 = 0; VAR_10 < VAR_6; VAR_10++) { VAR_12 += VAR_8[VAR_11 + VAR_10] * VAR_4[VAR_6 * VAR_7 + VAR_10]; } VAR_1[VAR_7] = FFMIN(VAR_12 >> VAR_9, (1 << 15) - 1); } }
[ "static void FUNC_0(SwsContext *VAR_0, int16_t *VAR_1, int VAR_2, const uint8_t *VAR_3,\nconst int16_t *VAR_4,\nconst int16_t *VAR_5, int VAR_6)\n{", "int VAR_7;", "const uint16_t *VAR_8 = (const uint16_t *) VAR_3;", "int VAR_9 = av_pix_fmt_descriptors[VAR_0->srcFormat].comp[0].depth_minus1;", "for (VAR_7 = 0; VAR_7 < VAR_2; VAR_7++) {", "int VAR_10;", "int VAR_11 = VAR_5[VAR_7];", "int VAR_12 = 0;", "for (VAR_10 = 0; VAR_10 < VAR_6; VAR_10++) {", "VAR_12 += VAR_8[VAR_11 + VAR_10] * VAR_4[VAR_6 * VAR_7 + VAR_10];", "}", "VAR_1[VAR_7] = FFMIN(VAR_12 >> VAR_9, (1 << 15) - 1);", "}", "}" ]
[ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ] ]
14,693
static int __qemu_rdma_delete_block(RDMAContext *rdma, ram_addr_t block_offset) { RDMALocalBlocks *local = &rdma->local_ram_blocks; RDMALocalBlock *block = g_hash_table_lookup(rdma->blockmap, (void *) block_offset); RDMALocalBlock *old = local->block; int x; assert(block); if (block->pmr) { int j; for (j = 0; j < block->nb_chunks; j++) { if (!block->pmr[j]) { continue; } ibv_dereg_mr(block->pmr[j]); rdma->total_registrations--; } g_free(block->pmr); block->pmr = NULL; } if (block->mr) { ibv_dereg_mr(block->mr); rdma->total_registrations--; block->mr = NULL; } g_free(block->transit_bitmap); block->transit_bitmap = NULL; g_free(block->unregister_bitmap); block->unregister_bitmap = NULL; g_free(block->remote_keys); block->remote_keys = NULL; for (x = 0; x < local->nb_blocks; x++) { g_hash_table_remove(rdma->blockmap, (void *)old[x].offset); } if (local->nb_blocks > 1) { local->block = g_malloc0(sizeof(RDMALocalBlock) * (local->nb_blocks - 1)); if (block->index) { memcpy(local->block, old, sizeof(RDMALocalBlock) * block->index); } if (block->index < (local->nb_blocks - 1)) { memcpy(local->block + block->index, old + (block->index + 1), sizeof(RDMALocalBlock) * (local->nb_blocks - (block->index + 1))); } } else { assert(block == local->block); local->block = NULL; } DDPRINTF("Deleted Block: %d, addr: %" PRIu64 ", offset: %" PRIu64 " length: %" PRIu64 " end: %" PRIu64 " bits %" PRIu64 " chunks %d\n", local->nb_blocks, (uint64_t) block->local_host_addr, block->offset, block->length, (uint64_t) (block->local_host_addr + block->length), BITS_TO_LONGS(block->nb_chunks) * sizeof(unsigned long) * 8, block->nb_chunks); g_free(old); local->nb_blocks--; if (local->nb_blocks) { for (x = 0; x < local->nb_blocks; x++) { g_hash_table_insert(rdma->blockmap, (void *)local->block[x].offset, &local->block[x]); } } return 0; }
true
qemu
60fe637bf0e4d7989e21e50f52526444765c63b4
static int __qemu_rdma_delete_block(RDMAContext *rdma, ram_addr_t block_offset) { RDMALocalBlocks *local = &rdma->local_ram_blocks; RDMALocalBlock *block = g_hash_table_lookup(rdma->blockmap, (void *) block_offset); RDMALocalBlock *old = local->block; int x; assert(block); if (block->pmr) { int j; for (j = 0; j < block->nb_chunks; j++) { if (!block->pmr[j]) { continue; } ibv_dereg_mr(block->pmr[j]); rdma->total_registrations--; } g_free(block->pmr); block->pmr = NULL; } if (block->mr) { ibv_dereg_mr(block->mr); rdma->total_registrations--; block->mr = NULL; } g_free(block->transit_bitmap); block->transit_bitmap = NULL; g_free(block->unregister_bitmap); block->unregister_bitmap = NULL; g_free(block->remote_keys); block->remote_keys = NULL; for (x = 0; x < local->nb_blocks; x++) { g_hash_table_remove(rdma->blockmap, (void *)old[x].offset); } if (local->nb_blocks > 1) { local->block = g_malloc0(sizeof(RDMALocalBlock) * (local->nb_blocks - 1)); if (block->index) { memcpy(local->block, old, sizeof(RDMALocalBlock) * block->index); } if (block->index < (local->nb_blocks - 1)) { memcpy(local->block + block->index, old + (block->index + 1), sizeof(RDMALocalBlock) * (local->nb_blocks - (block->index + 1))); } } else { assert(block == local->block); local->block = NULL; } DDPRINTF("Deleted Block: %d, addr: %" PRIu64 ", offset: %" PRIu64 " length: %" PRIu64 " end: %" PRIu64 " bits %" PRIu64 " chunks %d\n", local->nb_blocks, (uint64_t) block->local_host_addr, block->offset, block->length, (uint64_t) (block->local_host_addr + block->length), BITS_TO_LONGS(block->nb_chunks) * sizeof(unsigned long) * 8, block->nb_chunks); g_free(old); local->nb_blocks--; if (local->nb_blocks) { for (x = 0; x < local->nb_blocks; x++) { g_hash_table_insert(rdma->blockmap, (void *)local->block[x].offset, &local->block[x]); } } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(RDMAContext *VAR_0, ram_addr_t VAR_1) { RDMALocalBlocks *local = &VAR_0->local_ram_blocks; RDMALocalBlock *block = g_hash_table_lookup(VAR_0->blockmap, (void *) VAR_1); RDMALocalBlock *old = local->block; int VAR_2; assert(block); if (block->pmr) { int VAR_3; for (VAR_3 = 0; VAR_3 < block->nb_chunks; VAR_3++) { if (!block->pmr[VAR_3]) { continue; } ibv_dereg_mr(block->pmr[VAR_3]); VAR_0->total_registrations--; } g_free(block->pmr); block->pmr = NULL; } if (block->mr) { ibv_dereg_mr(block->mr); VAR_0->total_registrations--; block->mr = NULL; } g_free(block->transit_bitmap); block->transit_bitmap = NULL; g_free(block->unregister_bitmap); block->unregister_bitmap = NULL; g_free(block->remote_keys); block->remote_keys = NULL; for (VAR_2 = 0; VAR_2 < local->nb_blocks; VAR_2++) { g_hash_table_remove(VAR_0->blockmap, (void *)old[VAR_2].offset); } if (local->nb_blocks > 1) { local->block = g_malloc0(sizeof(RDMALocalBlock) * (local->nb_blocks - 1)); if (block->index) { memcpy(local->block, old, sizeof(RDMALocalBlock) * block->index); } if (block->index < (local->nb_blocks - 1)) { memcpy(local->block + block->index, old + (block->index + 1), sizeof(RDMALocalBlock) * (local->nb_blocks - (block->index + 1))); } } else { assert(block == local->block); local->block = NULL; } DDPRINTF("Deleted Block: %d, addr: %" PRIu64 ", offset: %" PRIu64 " length: %" PRIu64 " end: %" PRIu64 " bits %" PRIu64 " chunks %d\n", local->nb_blocks, (uint64_t) block->local_host_addr, block->offset, block->length, (uint64_t) (block->local_host_addr + block->length), BITS_TO_LONGS(block->nb_chunks) * sizeof(unsigned long) * 8, block->nb_chunks); g_free(old); local->nb_blocks--; if (local->nb_blocks) { for (VAR_2 = 0; VAR_2 < local->nb_blocks; VAR_2++) { g_hash_table_insert(VAR_0->blockmap, (void *)local->block[VAR_2].offset, &local->block[VAR_2]); } } return 0; }
[ "static int FUNC_0(RDMAContext *VAR_0, ram_addr_t VAR_1)\n{", "RDMALocalBlocks *local = &VAR_0->local_ram_blocks;", "RDMALocalBlock *block = g_hash_table_lookup(VAR_0->blockmap,\n(void *) VAR_1);", "RDMALocalBlock *old = local->block;", "int VAR_2;", "assert(block);", "if (block->pmr) {", "int VAR_3;", "for (VAR_3 = 0; VAR_3 < block->nb_chunks; VAR_3++) {", "if (!block->pmr[VAR_3]) {", "continue;", "}", "ibv_dereg_mr(block->pmr[VAR_3]);", "VAR_0->total_registrations--;", "}", "g_free(block->pmr);", "block->pmr = NULL;", "}", "if (block->mr) {", "ibv_dereg_mr(block->mr);", "VAR_0->total_registrations--;", "block->mr = NULL;", "}", "g_free(block->transit_bitmap);", "block->transit_bitmap = NULL;", "g_free(block->unregister_bitmap);", "block->unregister_bitmap = NULL;", "g_free(block->remote_keys);", "block->remote_keys = NULL;", "for (VAR_2 = 0; VAR_2 < local->nb_blocks; VAR_2++) {", "g_hash_table_remove(VAR_0->blockmap, (void *)old[VAR_2].offset);", "}", "if (local->nb_blocks > 1) {", "local->block = g_malloc0(sizeof(RDMALocalBlock) *\n(local->nb_blocks - 1));", "if (block->index) {", "memcpy(local->block, old, sizeof(RDMALocalBlock) * block->index);", "}", "if (block->index < (local->nb_blocks - 1)) {", "memcpy(local->block + block->index, old + (block->index + 1),\nsizeof(RDMALocalBlock) *\n(local->nb_blocks - (block->index + 1)));", "}", "} else {", "assert(block == local->block);", "local->block = NULL;", "}", "DDPRINTF(\"Deleted Block: %d, addr: %\" PRIu64 \", offset: %\" PRIu64\n\" length: %\" PRIu64 \" end: %\" PRIu64 \" bits %\" PRIu64 \" chunks %d\\n\",\nlocal->nb_blocks, (uint64_t) block->local_host_addr, block->offset,\nblock->length, (uint64_t) (block->local_host_addr + block->length),\nBITS_TO_LONGS(block->nb_chunks) *\nsizeof(unsigned long) * 8, block->nb_chunks);", "g_free(old);", "local->nb_blocks--;", "if (local->nb_blocks) {", "for (VAR_2 = 0; VAR_2 < local->nb_blocks; VAR_2++) {", "g_hash_table_insert(VAR_0->blockmap, (void *)local->block[VAR_2].offset,\n&local->block[VAR_2]);", "}", "}", "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 ]
[ [ 1, 3 ], [ 5 ], [ 7, 9 ], [ 11 ], [ 13 ], [ 17 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 63 ], [ 67 ], [ 69 ], [ 73 ], [ 75 ], [ 79 ], [ 81 ], [ 83 ], [ 87 ], [ 91, 93 ], [ 97 ], [ 99 ], [ 101 ], [ 105 ], [ 107, 109, 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 125, 127, 129, 131, 133, 135 ], [ 139 ], [ 143 ], [ 147 ], [ 149 ], [ 151, 153 ], [ 155 ], [ 157 ], [ 161 ], [ 163 ] ]
14,695
static int decode_extradata(ADTSContext *adts, uint8_t *buf, int size) { GetBitContext gb; init_get_bits(&gb, buf, size * 8); adts->objecttype = get_bits(&gb, 5) - 1; adts->sample_rate_index = get_bits(&gb, 4); adts->channel_conf = get_bits(&gb, 4); adts->write_adts = 1; return 0; }
true
FFmpeg
dd44d9e316c17f473eff9f4a5a94ad0d7adb157e
static int decode_extradata(ADTSContext *adts, uint8_t *buf, int size) { GetBitContext gb; init_get_bits(&gb, buf, size * 8); adts->objecttype = get_bits(&gb, 5) - 1; adts->sample_rate_index = get_bits(&gb, 4); adts->channel_conf = get_bits(&gb, 4); adts->write_adts = 1; return 0; }
{ "code": [ "static int decode_extradata(ADTSContext *adts, uint8_t *buf, int size)" ], "line_no": [ 1 ] }
static int FUNC_0(ADTSContext *VAR_0, uint8_t *VAR_1, int VAR_2) { GetBitContext gb; init_get_bits(&gb, VAR_1, VAR_2 * 8); VAR_0->objecttype = get_bits(&gb, 5) - 1; VAR_0->sample_rate_index = get_bits(&gb, 4); VAR_0->channel_conf = get_bits(&gb, 4); VAR_0->write_adts = 1; return 0; }
[ "static int FUNC_0(ADTSContext *VAR_0, uint8_t *VAR_1, int VAR_2)\n{", "GetBitContext gb;", "init_get_bits(&gb, VAR_1, VAR_2 * 8);", "VAR_0->objecttype = get_bits(&gb, 5) - 1;", "VAR_0->sample_rate_index = get_bits(&gb, 4);", "VAR_0->channel_conf = get_bits(&gb, 4);", "VAR_0->write_adts = 1;", "return 0;", "}" ]
[ 1, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 23 ], [ 25 ] ]
14,696
static void tcg_out_st (TCGContext *s, TCGType type, int arg, int arg1, tcg_target_long arg2) { if (type == TCG_TYPE_I32) tcg_out_ldst (s, arg, arg1, arg2, STW, STWX); else tcg_out_ldst (s, arg, arg1, arg2, STD, STDX); }
true
qemu
828808f5ece20fd606218e000139799921c89d93
static void tcg_out_st (TCGContext *s, TCGType type, int arg, int arg1, tcg_target_long arg2) { if (type == TCG_TYPE_I32) tcg_out_ldst (s, arg, arg1, arg2, STW, STWX); else tcg_out_ldst (s, arg, arg1, arg2, STD, STDX); }
{ "code": [ " tcg_out_ldst (s, arg, arg1, arg2, STD, STDX);" ], "line_no": [ 13 ] }
static void FUNC_0 (TCGContext *VAR_0, TCGType VAR_1, int VAR_2, int VAR_3, tcg_target_long VAR_4) { if (VAR_1 == TCG_TYPE_I32) tcg_out_ldst (VAR_0, VAR_2, VAR_3, VAR_4, STW, STWX); else tcg_out_ldst (VAR_0, VAR_2, VAR_3, VAR_4, STD, STDX); }
[ "static void FUNC_0 (TCGContext *VAR_0, TCGType VAR_1, int VAR_2, int VAR_3,\ntcg_target_long VAR_4)\n{", "if (VAR_1 == TCG_TYPE_I32)\ntcg_out_ldst (VAR_0, VAR_2, VAR_3, VAR_4, STW, STWX);", "else\ntcg_out_ldst (VAR_0, VAR_2, VAR_3, VAR_4, STD, STDX);", "}" ]
[ 0, 0, 1, 0 ]
[ [ 1, 3, 5 ], [ 7, 9 ], [ 11, 13 ], [ 15 ] ]
14,697
static void raw_probe_alignment(BlockDriverState *bs, int fd, Error **errp) { BDRVRawState *s = bs->opaque; char *buf; /* For /dev/sg devices the alignment is not really used. With buffered I/O, we don't have any restrictions. */ if (bs->sg || !s->needs_alignment) { bs->request_alignment = 1; s->buf_align = 1; return; } bs->request_alignment = 0; s->buf_align = 0; /* Let's try to use the logical blocksize for the alignment. */ if (probe_logical_blocksize(fd, &bs->request_alignment) < 0) { bs->request_alignment = 0; } #ifdef CONFIG_XFS if (s->is_xfs) { struct dioattr da; if (xfsctl(NULL, fd, XFS_IOC_DIOINFO, &da) >= 0) { bs->request_alignment = da.d_miniosz; /* The kernel returns wrong information for d_mem */ /* s->buf_align = da.d_mem; */ } } #endif /* If we could not get the sizes so far, we can only guess them */ if (!s->buf_align) { size_t align; buf = qemu_memalign(MAX_BLOCKSIZE, 2 * MAX_BLOCKSIZE); for (align = 512; align <= MAX_BLOCKSIZE; align <<= 1) { if (pread(fd, buf + align, MAX_BLOCKSIZE, 0) >= 0) { s->buf_align = align; break; } } qemu_vfree(buf); } if (!bs->request_alignment) { size_t align; buf = qemu_memalign(s->buf_align, MAX_BLOCKSIZE); for (align = 512; align <= MAX_BLOCKSIZE; align <<= 1) { if (pread(fd, buf, align, 0) >= 0) { bs->request_alignment = align; break; } } qemu_vfree(buf); } if (!s->buf_align || !bs->request_alignment) { error_setg(errp, "Could not find working O_DIRECT alignment. " "Try cache.direct=off."); } }
true
qemu
22d182e82b4ba2fb78b2cc22bcec4e6a440b0ad6
static void raw_probe_alignment(BlockDriverState *bs, int fd, Error **errp) { BDRVRawState *s = bs->opaque; char *buf; if (bs->sg || !s->needs_alignment) { bs->request_alignment = 1; s->buf_align = 1; return; } bs->request_alignment = 0; s->buf_align = 0; if (probe_logical_blocksize(fd, &bs->request_alignment) < 0) { bs->request_alignment = 0; } #ifdef CONFIG_XFS if (s->is_xfs) { struct dioattr da; if (xfsctl(NULL, fd, XFS_IOC_DIOINFO, &da) >= 0) { bs->request_alignment = da.d_miniosz; } } #endif if (!s->buf_align) { size_t align; buf = qemu_memalign(MAX_BLOCKSIZE, 2 * MAX_BLOCKSIZE); for (align = 512; align <= MAX_BLOCKSIZE; align <<= 1) { if (pread(fd, buf + align, MAX_BLOCKSIZE, 0) >= 0) { s->buf_align = align; break; } } qemu_vfree(buf); } if (!bs->request_alignment) { size_t align; buf = qemu_memalign(s->buf_align, MAX_BLOCKSIZE); for (align = 512; align <= MAX_BLOCKSIZE; align <<= 1) { if (pread(fd, buf, align, 0) >= 0) { bs->request_alignment = align; break; } } qemu_vfree(buf); } if (!s->buf_align || !bs->request_alignment) { error_setg(errp, "Could not find working O_DIRECT alignment. " "Try cache.direct=off."); } }
{ "code": [ " if (pread(fd, buf + align, MAX_BLOCKSIZE, 0) >= 0) {", " if (pread(fd, buf, align, 0) >= 0) {" ], "line_no": [ 71, 95 ] }
static void FUNC_0(BlockDriverState *VAR_0, int VAR_1, Error **VAR_2) { BDRVRawState *s = VAR_0->opaque; char *VAR_3; if (VAR_0->sg || !s->needs_alignment) { VAR_0->request_alignment = 1; s->buf_align = 1; return; } VAR_0->request_alignment = 0; s->buf_align = 0; if (probe_logical_blocksize(VAR_1, &VAR_0->request_alignment) < 0) { VAR_0->request_alignment = 0; } #ifdef CONFIG_XFS if (s->is_xfs) { struct dioattr da; if (xfsctl(NULL, VAR_1, XFS_IOC_DIOINFO, &da) >= 0) { VAR_0->request_alignment = da.d_miniosz; } } #endif if (!s->buf_align) { size_t align; VAR_3 = qemu_memalign(MAX_BLOCKSIZE, 2 * MAX_BLOCKSIZE); for (align = 512; align <= MAX_BLOCKSIZE; align <<= 1) { if (pread(VAR_1, VAR_3 + align, MAX_BLOCKSIZE, 0) >= 0) { s->buf_align = align; break; } } qemu_vfree(VAR_3); } if (!VAR_0->request_alignment) { size_t align; VAR_3 = qemu_memalign(s->buf_align, MAX_BLOCKSIZE); for (align = 512; align <= MAX_BLOCKSIZE; align <<= 1) { if (pread(VAR_1, VAR_3, align, 0) >= 0) { VAR_0->request_alignment = align; break; } } qemu_vfree(VAR_3); } if (!s->buf_align || !VAR_0->request_alignment) { error_setg(VAR_2, "Could not find working O_DIRECT alignment. " "Try cache.direct=off."); } }
[ "static void FUNC_0(BlockDriverState *VAR_0, int VAR_1, Error **VAR_2)\n{", "BDRVRawState *s = VAR_0->opaque;", "char *VAR_3;", "if (VAR_0->sg || !s->needs_alignment) {", "VAR_0->request_alignment = 1;", "s->buf_align = 1;", "return;", "}", "VAR_0->request_alignment = 0;", "s->buf_align = 0;", "if (probe_logical_blocksize(VAR_1, &VAR_0->request_alignment) < 0) {", "VAR_0->request_alignment = 0;", "}", "#ifdef CONFIG_XFS\nif (s->is_xfs) {", "struct dioattr da;", "if (xfsctl(NULL, VAR_1, XFS_IOC_DIOINFO, &da) >= 0) {", "VAR_0->request_alignment = da.d_miniosz;", "}", "}", "#endif\nif (!s->buf_align) {", "size_t align;", "VAR_3 = qemu_memalign(MAX_BLOCKSIZE, 2 * MAX_BLOCKSIZE);", "for (align = 512; align <= MAX_BLOCKSIZE; align <<= 1) {", "if (pread(VAR_1, VAR_3 + align, MAX_BLOCKSIZE, 0) >= 0) {", "s->buf_align = align;", "break;", "}", "}", "qemu_vfree(VAR_3);", "}", "if (!VAR_0->request_alignment) {", "size_t align;", "VAR_3 = qemu_memalign(s->buf_align, MAX_BLOCKSIZE);", "for (align = 512; align <= MAX_BLOCKSIZE; align <<= 1) {", "if (pread(VAR_1, VAR_3, align, 0) >= 0) {", "VAR_0->request_alignment = align;", "break;", "}", "}", "qemu_vfree(VAR_3);", "}", "if (!s->buf_align || !VAR_0->request_alignment) {", "error_setg(VAR_2, \"Could not find working O_DIRECT alignment. \"\n\"Try cache.direct=off.\");", "}", "}" ]
[ 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, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39, 41 ], [ 43 ], [ 45 ], [ 47 ], [ 53 ], [ 55 ], [ 57, 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 111 ], [ 113, 115 ], [ 117 ], [ 119 ] ]
14,698
static void alpha_cpu_realizefn(DeviceState *dev, Error **errp) { AlphaCPUClass *acc = ALPHA_CPU_GET_CLASS(dev); acc->parent_realize(dev, errp); }
true
qemu
14a10fc39923b3af07c8c46d22cb20843bee3a72
static void alpha_cpu_realizefn(DeviceState *dev, Error **errp) { AlphaCPUClass *acc = ALPHA_CPU_GET_CLASS(dev); acc->parent_realize(dev, errp); }
{ "code": [], "line_no": [] }
static void FUNC_0(DeviceState *VAR_0, Error **VAR_1) { AlphaCPUClass *acc = ALPHA_CPU_GET_CLASS(VAR_0); acc->parent_realize(VAR_0, VAR_1); }
[ "static void FUNC_0(DeviceState *VAR_0, Error **VAR_1)\n{", "AlphaCPUClass *acc = ALPHA_CPU_GET_CLASS(VAR_0);", "acc->parent_realize(VAR_0, VAR_1);", "}" ]
[ 0, 0, 0, 0 ]
[ [ 1, 2 ], [ 3 ], [ 4 ], [ 5 ] ]
14,699
static void add_pixels_clamped_mmx(const DCTELEM *block, UINT8 *pixels, int line_size) { const DCTELEM *p; UINT8 *pix; int i; /* read the pixels */ p = block; pix = pixels; MOVQ_ZERO(mm7); i = 4; while (i) { __asm __volatile( "movq %2, %%mm0\n\t" "movq 8%2, %%mm1\n\t" "movq 16%2, %%mm2\n\t" "movq 24%2, %%mm3\n\t" "movq %0, %%mm4\n\t" "movq %1, %%mm6\n\t" "movq %%mm4, %%mm5\n\t" "punpcklbw %%mm7, %%mm4\n\t" "punpckhbw %%mm7, %%mm5\n\t" "paddsw %%mm4, %%mm0\n\t" "paddsw %%mm5, %%mm1\n\t" "movq %%mm6, %%mm5\n\t" "punpcklbw %%mm7, %%mm6\n\t" "punpckhbw %%mm7, %%mm5\n\t" "paddsw %%mm6, %%mm2\n\t" "paddsw %%mm5, %%mm3\n\t" "packuswb %%mm1, %%mm0\n\t" "packuswb %%mm3, %%mm2\n\t" "movq %%mm0, %0\n\t" "movq %%mm2, %1\n\t" :"+m"(*pix), "+m"(*(pix+line_size)) :"m"(*p) :"memory"); pix += line_size*2; p += 16; i--; }; }
true
FFmpeg
cd8e5f9637b42f0caafbb0ab470e3f133cb5f200
static void add_pixels_clamped_mmx(const DCTELEM *block, UINT8 *pixels, int line_size) { const DCTELEM *p; UINT8 *pix; int i; p = block; pix = pixels; MOVQ_ZERO(mm7); i = 4; while (i) { __asm __volatile( "movq %2, %%mm0\n\t" "movq 8%2, %%mm1\n\t" "movq 16%2, %%mm2\n\t" "movq 24%2, %%mm3\n\t" "movq %0, %%mm4\n\t" "movq %1, %%mm6\n\t" "movq %%mm4, %%mm5\n\t" "punpcklbw %%mm7, %%mm4\n\t" "punpckhbw %%mm7, %%mm5\n\t" "paddsw %%mm4, %%mm0\n\t" "paddsw %%mm5, %%mm1\n\t" "movq %%mm6, %%mm5\n\t" "punpcklbw %%mm7, %%mm6\n\t" "punpckhbw %%mm7, %%mm5\n\t" "paddsw %%mm6, %%mm2\n\t" "paddsw %%mm5, %%mm3\n\t" "packuswb %%mm1, %%mm0\n\t" "packuswb %%mm3, %%mm2\n\t" "movq %%mm0, %0\n\t" "movq %%mm2, %1\n\t" :"+m"(*pix), "+m"(*(pix+line_size)) :"m"(*p) :"memory"); pix += line_size*2; p += 16; i--; }; }
{ "code": [ " while (i) {", "\t\t\"movq\t%2, %%mm0\\n\\t\"", "\t\t\"movq\t8%2, %%mm1\\n\\t\"", "\t\t\"movq\t16%2, %%mm2\\n\\t\"", "\t\t\"movq\t24%2, %%mm3\\n\\t\"", "\t\t:\"m\"(*p)", " i--;", " };" ], "line_no": [ 23, 27, 29, 31, 33, 69, 77, 79 ] }
static void FUNC_0(const DCTELEM *VAR_0, UINT8 *VAR_1, int VAR_2) { const DCTELEM *VAR_3; UINT8 *pix; int VAR_4; VAR_3 = VAR_0; pix = VAR_1; MOVQ_ZERO(mm7); VAR_4 = 4; while (VAR_4) { __asm __volatile( "movq %2, %%mm0\n\t" "movq 8%2, %%mm1\n\t" "movq 16%2, %%mm2\n\t" "movq 24%2, %%mm3\n\t" "movq %0, %%mm4\n\t" "movq %1, %%mm6\n\t" "movq %%mm4, %%mm5\n\t" "punpcklbw %%mm7, %%mm4\n\t" "punpckhbw %%mm7, %%mm5\n\t" "paddsw %%mm4, %%mm0\n\t" "paddsw %%mm5, %%mm1\n\t" "movq %%mm6, %%mm5\n\t" "punpcklbw %%mm7, %%mm6\n\t" "punpckhbw %%mm7, %%mm5\n\t" "paddsw %%mm6, %%mm2\n\t" "paddsw %%mm5, %%mm3\n\t" "packuswb %%mm1, %%mm0\n\t" "packuswb %%mm3, %%mm2\n\t" "movq %%mm0, %0\n\t" "movq %%mm2, %1\n\t" :"+m"(*pix), "+m"(*(pix+VAR_2)) :"m"(*VAR_3) :"memory"); pix += VAR_2*2; VAR_3 += 16; VAR_4--; }; }
[ "static void FUNC_0(const DCTELEM *VAR_0, UINT8 *VAR_1, int VAR_2)\n{", "const DCTELEM *VAR_3;", "UINT8 *pix;", "int VAR_4;", "VAR_3 = VAR_0;", "pix = VAR_1;", "MOVQ_ZERO(mm7);", "VAR_4 = 4;", "while (VAR_4) {", "__asm __volatile(\n\"movq\t%2, %%mm0\\n\\t\"\n\"movq\t8%2, %%mm1\\n\\t\"\n\"movq\t16%2, %%mm2\\n\\t\"\n\"movq\t24%2, %%mm3\\n\\t\"\n\"movq\t%0, %%mm4\\n\\t\"\n\"movq\t%1, %%mm6\\n\\t\"\n\"movq\t%%mm4, %%mm5\\n\\t\"\n\"punpcklbw %%mm7, %%mm4\\n\\t\"\n\"punpckhbw %%mm7, %%mm5\\n\\t\"\n\"paddsw\t%%mm4, %%mm0\\n\\t\"\n\"paddsw\t%%mm5, %%mm1\\n\\t\"\n\"movq\t%%mm6, %%mm5\\n\\t\"\n\"punpcklbw %%mm7, %%mm6\\n\\t\"\n\"punpckhbw %%mm7, %%mm5\\n\\t\"\n\"paddsw\t%%mm6, %%mm2\\n\\t\"\n\"paddsw\t%%mm5, %%mm3\\n\\t\"\n\"packuswb %%mm1, %%mm0\\n\\t\"\n\"packuswb %%mm3, %%mm2\\n\\t\"\n\"movq\t%%mm0, %0\\n\\t\"\n\"movq\t%%mm2, %1\\n\\t\"\n:\"+m\"(*pix), \"+m\"(*(pix+VAR_2))\n:\"m\"(*VAR_3)\n:\"memory\");", "pix += VAR_2*2;", "VAR_3 += 16;", "VAR_4--;", "};", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 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 ] ]
14,700
struct omap_mpu_state_s *omap310_mpu_init(MemoryRegion *system_memory, unsigned long sdram_size, const char *core) { int i; struct omap_mpu_state_s *s = (struct omap_mpu_state_s *) g_malloc0(sizeof(struct omap_mpu_state_s)); qemu_irq dma_irqs[6]; DriveInfo *dinfo; SysBusDevice *busdev; if (!core) core = "ti925t"; /* Core */ s->mpu_model = omap310; s->cpu = cpu_arm_init(core); if (s->cpu == NULL) { fprintf(stderr, "Unable to find CPU definition\n"); exit(1); } s->sdram_size = sdram_size; s->sram_size = OMAP15XX_SRAM_SIZE; s->wakeup = qemu_allocate_irq(omap_mpu_wakeup, s, 0); /* Clocks */ omap_clk_init(s); /* Memory-mapped stuff */ memory_region_allocate_system_memory(&s->emiff_ram, NULL, "omap1.dram", s->sdram_size); memory_region_add_subregion(system_memory, OMAP_EMIFF_BASE, &s->emiff_ram); memory_region_init_ram(&s->imif_ram, NULL, "omap1.sram", s->sram_size, &error_abort); vmstate_register_ram_global(&s->imif_ram); memory_region_add_subregion(system_memory, OMAP_IMIF_BASE, &s->imif_ram); omap_clkm_init(system_memory, 0xfffece00, 0xe1008000, s); s->ih[0] = qdev_create(NULL, "omap-intc"); qdev_prop_set_uint32(s->ih[0], "size", 0x100); qdev_prop_set_ptr(s->ih[0], "clk", omap_findclk(s, "arminth_ck")); qdev_init_nofail(s->ih[0]); busdev = SYS_BUS_DEVICE(s->ih[0]); sysbus_connect_irq(busdev, 0, qdev_get_gpio_in(DEVICE(s->cpu), ARM_CPU_IRQ)); sysbus_connect_irq(busdev, 1, qdev_get_gpio_in(DEVICE(s->cpu), ARM_CPU_FIQ)); sysbus_mmio_map(busdev, 0, 0xfffecb00); s->ih[1] = qdev_create(NULL, "omap-intc"); qdev_prop_set_uint32(s->ih[1], "size", 0x800); qdev_prop_set_ptr(s->ih[1], "clk", omap_findclk(s, "arminth_ck")); qdev_init_nofail(s->ih[1]); busdev = SYS_BUS_DEVICE(s->ih[1]); sysbus_connect_irq(busdev, 0, qdev_get_gpio_in(s->ih[0], OMAP_INT_15XX_IH2_IRQ)); /* The second interrupt controller's FIQ output is not wired up */ sysbus_mmio_map(busdev, 0, 0xfffe0000); for (i = 0; i < 6; i++) { dma_irqs[i] = qdev_get_gpio_in(s->ih[omap1_dma_irq_map[i].ih], omap1_dma_irq_map[i].intr); } s->dma = omap_dma_init(0xfffed800, dma_irqs, system_memory, qdev_get_gpio_in(s->ih[0], OMAP_INT_DMA_LCD), s, omap_findclk(s, "dma_ck"), omap_dma_3_1); s->port[emiff ].addr_valid = omap_validate_emiff_addr; s->port[emifs ].addr_valid = omap_validate_emifs_addr; s->port[imif ].addr_valid = omap_validate_imif_addr; s->port[tipb ].addr_valid = omap_validate_tipb_addr; s->port[local ].addr_valid = omap_validate_local_addr; s->port[tipb_mpui].addr_valid = omap_validate_tipb_mpui_addr; /* Register SDRAM and SRAM DMA ports for fast transfers. */ soc_dma_port_add_mem(s->dma, memory_region_get_ram_ptr(&s->emiff_ram), OMAP_EMIFF_BASE, s->sdram_size); soc_dma_port_add_mem(s->dma, memory_region_get_ram_ptr(&s->imif_ram), OMAP_IMIF_BASE, s->sram_size); s->timer[0] = omap_mpu_timer_init(system_memory, 0xfffec500, qdev_get_gpio_in(s->ih[0], OMAP_INT_TIMER1), omap_findclk(s, "mputim_ck")); s->timer[1] = omap_mpu_timer_init(system_memory, 0xfffec600, qdev_get_gpio_in(s->ih[0], OMAP_INT_TIMER2), omap_findclk(s, "mputim_ck")); s->timer[2] = omap_mpu_timer_init(system_memory, 0xfffec700, qdev_get_gpio_in(s->ih[0], OMAP_INT_TIMER3), omap_findclk(s, "mputim_ck")); s->wdt = omap_wd_timer_init(system_memory, 0xfffec800, qdev_get_gpio_in(s->ih[0], OMAP_INT_WD_TIMER), omap_findclk(s, "armwdt_ck")); s->os_timer = omap_os_timer_init(system_memory, 0xfffb9000, qdev_get_gpio_in(s->ih[1], OMAP_INT_OS_TIMER), omap_findclk(s, "clk32-kHz")); s->lcd = omap_lcdc_init(system_memory, 0xfffec000, qdev_get_gpio_in(s->ih[0], OMAP_INT_LCD_CTRL), omap_dma_get_lcdch(s->dma), omap_findclk(s, "lcd_ck")); omap_ulpd_pm_init(system_memory, 0xfffe0800, s); omap_pin_cfg_init(system_memory, 0xfffe1000, s); omap_id_init(system_memory, s); omap_mpui_init(system_memory, 0xfffec900, s); s->private_tipb = omap_tipb_bridge_init(system_memory, 0xfffeca00, qdev_get_gpio_in(s->ih[0], OMAP_INT_BRIDGE_PRIV), omap_findclk(s, "tipb_ck")); s->public_tipb = omap_tipb_bridge_init(system_memory, 0xfffed300, qdev_get_gpio_in(s->ih[0], OMAP_INT_BRIDGE_PUB), omap_findclk(s, "tipb_ck")); omap_tcmi_init(system_memory, 0xfffecc00, s); s->uart[0] = omap_uart_init(0xfffb0000, qdev_get_gpio_in(s->ih[1], OMAP_INT_UART1), omap_findclk(s, "uart1_ck"), omap_findclk(s, "uart1_ck"), s->drq[OMAP_DMA_UART1_TX], s->drq[OMAP_DMA_UART1_RX], "uart1", serial_hds[0]); s->uart[1] = omap_uart_init(0xfffb0800, qdev_get_gpio_in(s->ih[1], OMAP_INT_UART2), omap_findclk(s, "uart2_ck"), omap_findclk(s, "uart2_ck"), s->drq[OMAP_DMA_UART2_TX], s->drq[OMAP_DMA_UART2_RX], "uart2", serial_hds[0] ? serial_hds[1] : NULL); s->uart[2] = omap_uart_init(0xfffb9800, qdev_get_gpio_in(s->ih[0], OMAP_INT_UART3), omap_findclk(s, "uart3_ck"), omap_findclk(s, "uart3_ck"), s->drq[OMAP_DMA_UART3_TX], s->drq[OMAP_DMA_UART3_RX], "uart3", serial_hds[0] && serial_hds[1] ? serial_hds[2] : NULL); s->dpll[0] = omap_dpll_init(system_memory, 0xfffecf00, omap_findclk(s, "dpll1")); s->dpll[1] = omap_dpll_init(system_memory, 0xfffed000, omap_findclk(s, "dpll2")); s->dpll[2] = omap_dpll_init(system_memory, 0xfffed100, omap_findclk(s, "dpll3")); dinfo = drive_get(IF_SD, 0, 0); if (!dinfo) { fprintf(stderr, "qemu: missing SecureDigital device\n"); exit(1); } s->mmc = omap_mmc_init(0xfffb7800, system_memory, blk_by_legacy_dinfo(dinfo), qdev_get_gpio_in(s->ih[1], OMAP_INT_OQN), &s->drq[OMAP_DMA_MMC_TX], omap_findclk(s, "mmc_ck")); s->mpuio = omap_mpuio_init(system_memory, 0xfffb5000, qdev_get_gpio_in(s->ih[1], OMAP_INT_KEYBOARD), qdev_get_gpio_in(s->ih[1], OMAP_INT_MPUIO), s->wakeup, omap_findclk(s, "clk32-kHz")); s->gpio = qdev_create(NULL, "omap-gpio"); qdev_prop_set_int32(s->gpio, "mpu_model", s->mpu_model); qdev_prop_set_ptr(s->gpio, "clk", omap_findclk(s, "arm_gpio_ck")); qdev_init_nofail(s->gpio); sysbus_connect_irq(SYS_BUS_DEVICE(s->gpio), 0, qdev_get_gpio_in(s->ih[0], OMAP_INT_GPIO_BANK1)); sysbus_mmio_map(SYS_BUS_DEVICE(s->gpio), 0, 0xfffce000); s->microwire = omap_uwire_init(system_memory, 0xfffb3000, qdev_get_gpio_in(s->ih[1], OMAP_INT_uWireTX), qdev_get_gpio_in(s->ih[1], OMAP_INT_uWireRX), s->drq[OMAP_DMA_UWIRE_TX], omap_findclk(s, "mpuper_ck")); s->pwl = omap_pwl_init(system_memory, 0xfffb5800, omap_findclk(s, "armxor_ck")); s->pwt = omap_pwt_init(system_memory, 0xfffb6000, omap_findclk(s, "armxor_ck")); s->i2c[0] = qdev_create(NULL, "omap_i2c"); qdev_prop_set_uint8(s->i2c[0], "revision", 0x11); qdev_prop_set_ptr(s->i2c[0], "fclk", omap_findclk(s, "mpuper_ck")); qdev_init_nofail(s->i2c[0]); busdev = SYS_BUS_DEVICE(s->i2c[0]); sysbus_connect_irq(busdev, 0, qdev_get_gpio_in(s->ih[1], OMAP_INT_I2C)); sysbus_connect_irq(busdev, 1, s->drq[OMAP_DMA_I2C_TX]); sysbus_connect_irq(busdev, 2, s->drq[OMAP_DMA_I2C_RX]); sysbus_mmio_map(busdev, 0, 0xfffb3800); s->rtc = omap_rtc_init(system_memory, 0xfffb4800, qdev_get_gpio_in(s->ih[1], OMAP_INT_RTC_TIMER), qdev_get_gpio_in(s->ih[1], OMAP_INT_RTC_ALARM), omap_findclk(s, "clk32-kHz")); s->mcbsp1 = omap_mcbsp_init(system_memory, 0xfffb1800, qdev_get_gpio_in(s->ih[1], OMAP_INT_McBSP1TX), qdev_get_gpio_in(s->ih[1], OMAP_INT_McBSP1RX), &s->drq[OMAP_DMA_MCBSP1_TX], omap_findclk(s, "dspxor_ck")); s->mcbsp2 = omap_mcbsp_init(system_memory, 0xfffb1000, qdev_get_gpio_in(s->ih[0], OMAP_INT_310_McBSP2_TX), qdev_get_gpio_in(s->ih[0], OMAP_INT_310_McBSP2_RX), &s->drq[OMAP_DMA_MCBSP2_TX], omap_findclk(s, "mpuper_ck")); s->mcbsp3 = omap_mcbsp_init(system_memory, 0xfffb7000, qdev_get_gpio_in(s->ih[1], OMAP_INT_McBSP3TX), qdev_get_gpio_in(s->ih[1], OMAP_INT_McBSP3RX), &s->drq[OMAP_DMA_MCBSP3_TX], omap_findclk(s, "dspxor_ck")); s->led[0] = omap_lpg_init(system_memory, 0xfffbd000, omap_findclk(s, "clk32-kHz")); s->led[1] = omap_lpg_init(system_memory, 0xfffbd800, omap_findclk(s, "clk32-kHz")); /* Register mappings not currenlty implemented: * MCSI2 Comm fffb2000 - fffb27ff (not mapped on OMAP310) * MCSI1 Bluetooth fffb2800 - fffb2fff (not mapped on OMAP310) * USB W2FC fffb4000 - fffb47ff * Camera Interface fffb6800 - fffb6fff * USB Host fffba000 - fffba7ff * FAC fffba800 - fffbafff * HDQ/1-Wire fffbc000 - fffbc7ff * TIPB switches fffbc800 - fffbcfff * Mailbox fffcf000 - fffcf7ff * Local bus IF fffec100 - fffec1ff * Local bus MMU fffec200 - fffec2ff * DSP MMU fffed200 - fffed2ff */ omap_setup_dsp_mapping(system_memory, omap15xx_dsp_mm); omap_setup_mpui_io(system_memory, s); qemu_register_reset(omap1_mpu_reset, s); return s; }
true
qemu
b45c03f585ea9bb1af76c73e82195418c294919d
struct omap_mpu_state_s *omap310_mpu_init(MemoryRegion *system_memory, unsigned long sdram_size, const char *core) { int i; struct omap_mpu_state_s *s = (struct omap_mpu_state_s *) g_malloc0(sizeof(struct omap_mpu_state_s)); qemu_irq dma_irqs[6]; DriveInfo *dinfo; SysBusDevice *busdev; if (!core) core = "ti925t"; s->mpu_model = omap310; s->cpu = cpu_arm_init(core); if (s->cpu == NULL) { fprintf(stderr, "Unable to find CPU definition\n"); exit(1); } s->sdram_size = sdram_size; s->sram_size = OMAP15XX_SRAM_SIZE; s->wakeup = qemu_allocate_irq(omap_mpu_wakeup, s, 0); omap_clk_init(s); memory_region_allocate_system_memory(&s->emiff_ram, NULL, "omap1.dram", s->sdram_size); memory_region_add_subregion(system_memory, OMAP_EMIFF_BASE, &s->emiff_ram); memory_region_init_ram(&s->imif_ram, NULL, "omap1.sram", s->sram_size, &error_abort); vmstate_register_ram_global(&s->imif_ram); memory_region_add_subregion(system_memory, OMAP_IMIF_BASE, &s->imif_ram); omap_clkm_init(system_memory, 0xfffece00, 0xe1008000, s); s->ih[0] = qdev_create(NULL, "omap-intc"); qdev_prop_set_uint32(s->ih[0], "size", 0x100); qdev_prop_set_ptr(s->ih[0], "clk", omap_findclk(s, "arminth_ck")); qdev_init_nofail(s->ih[0]); busdev = SYS_BUS_DEVICE(s->ih[0]); sysbus_connect_irq(busdev, 0, qdev_get_gpio_in(DEVICE(s->cpu), ARM_CPU_IRQ)); sysbus_connect_irq(busdev, 1, qdev_get_gpio_in(DEVICE(s->cpu), ARM_CPU_FIQ)); sysbus_mmio_map(busdev, 0, 0xfffecb00); s->ih[1] = qdev_create(NULL, "omap-intc"); qdev_prop_set_uint32(s->ih[1], "size", 0x800); qdev_prop_set_ptr(s->ih[1], "clk", omap_findclk(s, "arminth_ck")); qdev_init_nofail(s->ih[1]); busdev = SYS_BUS_DEVICE(s->ih[1]); sysbus_connect_irq(busdev, 0, qdev_get_gpio_in(s->ih[0], OMAP_INT_15XX_IH2_IRQ)); sysbus_mmio_map(busdev, 0, 0xfffe0000); for (i = 0; i < 6; i++) { dma_irqs[i] = qdev_get_gpio_in(s->ih[omap1_dma_irq_map[i].ih], omap1_dma_irq_map[i].intr); } s->dma = omap_dma_init(0xfffed800, dma_irqs, system_memory, qdev_get_gpio_in(s->ih[0], OMAP_INT_DMA_LCD), s, omap_findclk(s, "dma_ck"), omap_dma_3_1); s->port[emiff ].addr_valid = omap_validate_emiff_addr; s->port[emifs ].addr_valid = omap_validate_emifs_addr; s->port[imif ].addr_valid = omap_validate_imif_addr; s->port[tipb ].addr_valid = omap_validate_tipb_addr; s->port[local ].addr_valid = omap_validate_local_addr; s->port[tipb_mpui].addr_valid = omap_validate_tipb_mpui_addr; soc_dma_port_add_mem(s->dma, memory_region_get_ram_ptr(&s->emiff_ram), OMAP_EMIFF_BASE, s->sdram_size); soc_dma_port_add_mem(s->dma, memory_region_get_ram_ptr(&s->imif_ram), OMAP_IMIF_BASE, s->sram_size); s->timer[0] = omap_mpu_timer_init(system_memory, 0xfffec500, qdev_get_gpio_in(s->ih[0], OMAP_INT_TIMER1), omap_findclk(s, "mputim_ck")); s->timer[1] = omap_mpu_timer_init(system_memory, 0xfffec600, qdev_get_gpio_in(s->ih[0], OMAP_INT_TIMER2), omap_findclk(s, "mputim_ck")); s->timer[2] = omap_mpu_timer_init(system_memory, 0xfffec700, qdev_get_gpio_in(s->ih[0], OMAP_INT_TIMER3), omap_findclk(s, "mputim_ck")); s->wdt = omap_wd_timer_init(system_memory, 0xfffec800, qdev_get_gpio_in(s->ih[0], OMAP_INT_WD_TIMER), omap_findclk(s, "armwdt_ck")); s->os_timer = omap_os_timer_init(system_memory, 0xfffb9000, qdev_get_gpio_in(s->ih[1], OMAP_INT_OS_TIMER), omap_findclk(s, "clk32-kHz")); s->lcd = omap_lcdc_init(system_memory, 0xfffec000, qdev_get_gpio_in(s->ih[0], OMAP_INT_LCD_CTRL), omap_dma_get_lcdch(s->dma), omap_findclk(s, "lcd_ck")); omap_ulpd_pm_init(system_memory, 0xfffe0800, s); omap_pin_cfg_init(system_memory, 0xfffe1000, s); omap_id_init(system_memory, s); omap_mpui_init(system_memory, 0xfffec900, s); s->private_tipb = omap_tipb_bridge_init(system_memory, 0xfffeca00, qdev_get_gpio_in(s->ih[0], OMAP_INT_BRIDGE_PRIV), omap_findclk(s, "tipb_ck")); s->public_tipb = omap_tipb_bridge_init(system_memory, 0xfffed300, qdev_get_gpio_in(s->ih[0], OMAP_INT_BRIDGE_PUB), omap_findclk(s, "tipb_ck")); omap_tcmi_init(system_memory, 0xfffecc00, s); s->uart[0] = omap_uart_init(0xfffb0000, qdev_get_gpio_in(s->ih[1], OMAP_INT_UART1), omap_findclk(s, "uart1_ck"), omap_findclk(s, "uart1_ck"), s->drq[OMAP_DMA_UART1_TX], s->drq[OMAP_DMA_UART1_RX], "uart1", serial_hds[0]); s->uart[1] = omap_uart_init(0xfffb0800, qdev_get_gpio_in(s->ih[1], OMAP_INT_UART2), omap_findclk(s, "uart2_ck"), omap_findclk(s, "uart2_ck"), s->drq[OMAP_DMA_UART2_TX], s->drq[OMAP_DMA_UART2_RX], "uart2", serial_hds[0] ? serial_hds[1] : NULL); s->uart[2] = omap_uart_init(0xfffb9800, qdev_get_gpio_in(s->ih[0], OMAP_INT_UART3), omap_findclk(s, "uart3_ck"), omap_findclk(s, "uart3_ck"), s->drq[OMAP_DMA_UART3_TX], s->drq[OMAP_DMA_UART3_RX], "uart3", serial_hds[0] && serial_hds[1] ? serial_hds[2] : NULL); s->dpll[0] = omap_dpll_init(system_memory, 0xfffecf00, omap_findclk(s, "dpll1")); s->dpll[1] = omap_dpll_init(system_memory, 0xfffed000, omap_findclk(s, "dpll2")); s->dpll[2] = omap_dpll_init(system_memory, 0xfffed100, omap_findclk(s, "dpll3")); dinfo = drive_get(IF_SD, 0, 0); if (!dinfo) { fprintf(stderr, "qemu: missing SecureDigital device\n"); exit(1); } s->mmc = omap_mmc_init(0xfffb7800, system_memory, blk_by_legacy_dinfo(dinfo), qdev_get_gpio_in(s->ih[1], OMAP_INT_OQN), &s->drq[OMAP_DMA_MMC_TX], omap_findclk(s, "mmc_ck")); s->mpuio = omap_mpuio_init(system_memory, 0xfffb5000, qdev_get_gpio_in(s->ih[1], OMAP_INT_KEYBOARD), qdev_get_gpio_in(s->ih[1], OMAP_INT_MPUIO), s->wakeup, omap_findclk(s, "clk32-kHz")); s->gpio = qdev_create(NULL, "omap-gpio"); qdev_prop_set_int32(s->gpio, "mpu_model", s->mpu_model); qdev_prop_set_ptr(s->gpio, "clk", omap_findclk(s, "arm_gpio_ck")); qdev_init_nofail(s->gpio); sysbus_connect_irq(SYS_BUS_DEVICE(s->gpio), 0, qdev_get_gpio_in(s->ih[0], OMAP_INT_GPIO_BANK1)); sysbus_mmio_map(SYS_BUS_DEVICE(s->gpio), 0, 0xfffce000); s->microwire = omap_uwire_init(system_memory, 0xfffb3000, qdev_get_gpio_in(s->ih[1], OMAP_INT_uWireTX), qdev_get_gpio_in(s->ih[1], OMAP_INT_uWireRX), s->drq[OMAP_DMA_UWIRE_TX], omap_findclk(s, "mpuper_ck")); s->pwl = omap_pwl_init(system_memory, 0xfffb5800, omap_findclk(s, "armxor_ck")); s->pwt = omap_pwt_init(system_memory, 0xfffb6000, omap_findclk(s, "armxor_ck")); s->i2c[0] = qdev_create(NULL, "omap_i2c"); qdev_prop_set_uint8(s->i2c[0], "revision", 0x11); qdev_prop_set_ptr(s->i2c[0], "fclk", omap_findclk(s, "mpuper_ck")); qdev_init_nofail(s->i2c[0]); busdev = SYS_BUS_DEVICE(s->i2c[0]); sysbus_connect_irq(busdev, 0, qdev_get_gpio_in(s->ih[1], OMAP_INT_I2C)); sysbus_connect_irq(busdev, 1, s->drq[OMAP_DMA_I2C_TX]); sysbus_connect_irq(busdev, 2, s->drq[OMAP_DMA_I2C_RX]); sysbus_mmio_map(busdev, 0, 0xfffb3800); s->rtc = omap_rtc_init(system_memory, 0xfffb4800, qdev_get_gpio_in(s->ih[1], OMAP_INT_RTC_TIMER), qdev_get_gpio_in(s->ih[1], OMAP_INT_RTC_ALARM), omap_findclk(s, "clk32-kHz")); s->mcbsp1 = omap_mcbsp_init(system_memory, 0xfffb1800, qdev_get_gpio_in(s->ih[1], OMAP_INT_McBSP1TX), qdev_get_gpio_in(s->ih[1], OMAP_INT_McBSP1RX), &s->drq[OMAP_DMA_MCBSP1_TX], omap_findclk(s, "dspxor_ck")); s->mcbsp2 = omap_mcbsp_init(system_memory, 0xfffb1000, qdev_get_gpio_in(s->ih[0], OMAP_INT_310_McBSP2_TX), qdev_get_gpio_in(s->ih[0], OMAP_INT_310_McBSP2_RX), &s->drq[OMAP_DMA_MCBSP2_TX], omap_findclk(s, "mpuper_ck")); s->mcbsp3 = omap_mcbsp_init(system_memory, 0xfffb7000, qdev_get_gpio_in(s->ih[1], OMAP_INT_McBSP3TX), qdev_get_gpio_in(s->ih[1], OMAP_INT_McBSP3RX), &s->drq[OMAP_DMA_MCBSP3_TX], omap_findclk(s, "dspxor_ck")); s->led[0] = omap_lpg_init(system_memory, 0xfffbd000, omap_findclk(s, "clk32-kHz")); s->led[1] = omap_lpg_init(system_memory, 0xfffbd800, omap_findclk(s, "clk32-kHz")); omap_setup_dsp_mapping(system_memory, omap15xx_dsp_mm); omap_setup_mpui_io(system_memory, s); qemu_register_reset(omap1_mpu_reset, s); return s; }
{ "code": [ " struct omap_mpu_state_s *s = (struct omap_mpu_state_s *)", " g_malloc0(sizeof(struct omap_mpu_state_s));", " struct omap_mpu_state_s *s = (struct omap_mpu_state_s *)", " g_malloc0(sizeof(struct omap_mpu_state_s));" ], "line_no": [ 11, 13, 11, 13 ] }
struct omap_mpu_state_s *FUNC_0(MemoryRegion *VAR_0, unsigned long VAR_1, const char *VAR_2) { int VAR_3; struct omap_mpu_state_s *VAR_4 = (struct omap_mpu_state_s *) g_malloc0(sizeof(struct omap_mpu_state_s)); qemu_irq dma_irqs[6]; DriveInfo *dinfo; SysBusDevice *busdev; if (!VAR_2) VAR_2 = "ti925t"; VAR_4->mpu_model = omap310; VAR_4->cpu = cpu_arm_init(VAR_2); if (VAR_4->cpu == NULL) { fprintf(stderr, "Unable to find CPU definition\n"); exit(1); } VAR_4->VAR_1 = VAR_1; VAR_4->sram_size = OMAP15XX_SRAM_SIZE; VAR_4->wakeup = qemu_allocate_irq(omap_mpu_wakeup, VAR_4, 0); omap_clk_init(VAR_4); memory_region_allocate_system_memory(&VAR_4->emiff_ram, NULL, "omap1.dram", VAR_4->VAR_1); memory_region_add_subregion(VAR_0, OMAP_EMIFF_BASE, &VAR_4->emiff_ram); memory_region_init_ram(&VAR_4->imif_ram, NULL, "omap1.sram", VAR_4->sram_size, &error_abort); vmstate_register_ram_global(&VAR_4->imif_ram); memory_region_add_subregion(VAR_0, OMAP_IMIF_BASE, &VAR_4->imif_ram); omap_clkm_init(VAR_0, 0xfffece00, 0xe1008000, VAR_4); VAR_4->ih[0] = qdev_create(NULL, "omap-intc"); qdev_prop_set_uint32(VAR_4->ih[0], "size", 0x100); qdev_prop_set_ptr(VAR_4->ih[0], "clk", omap_findclk(VAR_4, "arminth_ck")); qdev_init_nofail(VAR_4->ih[0]); busdev = SYS_BUS_DEVICE(VAR_4->ih[0]); sysbus_connect_irq(busdev, 0, qdev_get_gpio_in(DEVICE(VAR_4->cpu), ARM_CPU_IRQ)); sysbus_connect_irq(busdev, 1, qdev_get_gpio_in(DEVICE(VAR_4->cpu), ARM_CPU_FIQ)); sysbus_mmio_map(busdev, 0, 0xfffecb00); VAR_4->ih[1] = qdev_create(NULL, "omap-intc"); qdev_prop_set_uint32(VAR_4->ih[1], "size", 0x800); qdev_prop_set_ptr(VAR_4->ih[1], "clk", omap_findclk(VAR_4, "arminth_ck")); qdev_init_nofail(VAR_4->ih[1]); busdev = SYS_BUS_DEVICE(VAR_4->ih[1]); sysbus_connect_irq(busdev, 0, qdev_get_gpio_in(VAR_4->ih[0], OMAP_INT_15XX_IH2_IRQ)); sysbus_mmio_map(busdev, 0, 0xfffe0000); for (VAR_3 = 0; VAR_3 < 6; VAR_3++) { dma_irqs[VAR_3] = qdev_get_gpio_in(VAR_4->ih[omap1_dma_irq_map[VAR_3].ih], omap1_dma_irq_map[VAR_3].intr); } VAR_4->dma = omap_dma_init(0xfffed800, dma_irqs, VAR_0, qdev_get_gpio_in(VAR_4->ih[0], OMAP_INT_DMA_LCD), VAR_4, omap_findclk(VAR_4, "dma_ck"), omap_dma_3_1); VAR_4->port[emiff ].addr_valid = omap_validate_emiff_addr; VAR_4->port[emifs ].addr_valid = omap_validate_emifs_addr; VAR_4->port[imif ].addr_valid = omap_validate_imif_addr; VAR_4->port[tipb ].addr_valid = omap_validate_tipb_addr; VAR_4->port[local ].addr_valid = omap_validate_local_addr; VAR_4->port[tipb_mpui].addr_valid = omap_validate_tipb_mpui_addr; soc_dma_port_add_mem(VAR_4->dma, memory_region_get_ram_ptr(&VAR_4->emiff_ram), OMAP_EMIFF_BASE, VAR_4->VAR_1); soc_dma_port_add_mem(VAR_4->dma, memory_region_get_ram_ptr(&VAR_4->imif_ram), OMAP_IMIF_BASE, VAR_4->sram_size); VAR_4->timer[0] = omap_mpu_timer_init(VAR_0, 0xfffec500, qdev_get_gpio_in(VAR_4->ih[0], OMAP_INT_TIMER1), omap_findclk(VAR_4, "mputim_ck")); VAR_4->timer[1] = omap_mpu_timer_init(VAR_0, 0xfffec600, qdev_get_gpio_in(VAR_4->ih[0], OMAP_INT_TIMER2), omap_findclk(VAR_4, "mputim_ck")); VAR_4->timer[2] = omap_mpu_timer_init(VAR_0, 0xfffec700, qdev_get_gpio_in(VAR_4->ih[0], OMAP_INT_TIMER3), omap_findclk(VAR_4, "mputim_ck")); VAR_4->wdt = omap_wd_timer_init(VAR_0, 0xfffec800, qdev_get_gpio_in(VAR_4->ih[0], OMAP_INT_WD_TIMER), omap_findclk(VAR_4, "armwdt_ck")); VAR_4->os_timer = omap_os_timer_init(VAR_0, 0xfffb9000, qdev_get_gpio_in(VAR_4->ih[1], OMAP_INT_OS_TIMER), omap_findclk(VAR_4, "clk32-kHz")); VAR_4->lcd = omap_lcdc_init(VAR_0, 0xfffec000, qdev_get_gpio_in(VAR_4->ih[0], OMAP_INT_LCD_CTRL), omap_dma_get_lcdch(VAR_4->dma), omap_findclk(VAR_4, "lcd_ck")); omap_ulpd_pm_init(VAR_0, 0xfffe0800, VAR_4); omap_pin_cfg_init(VAR_0, 0xfffe1000, VAR_4); omap_id_init(VAR_0, VAR_4); omap_mpui_init(VAR_0, 0xfffec900, VAR_4); VAR_4->private_tipb = omap_tipb_bridge_init(VAR_0, 0xfffeca00, qdev_get_gpio_in(VAR_4->ih[0], OMAP_INT_BRIDGE_PRIV), omap_findclk(VAR_4, "tipb_ck")); VAR_4->public_tipb = omap_tipb_bridge_init(VAR_0, 0xfffed300, qdev_get_gpio_in(VAR_4->ih[0], OMAP_INT_BRIDGE_PUB), omap_findclk(VAR_4, "tipb_ck")); omap_tcmi_init(VAR_0, 0xfffecc00, VAR_4); VAR_4->uart[0] = omap_uart_init(0xfffb0000, qdev_get_gpio_in(VAR_4->ih[1], OMAP_INT_UART1), omap_findclk(VAR_4, "uart1_ck"), omap_findclk(VAR_4, "uart1_ck"), VAR_4->drq[OMAP_DMA_UART1_TX], VAR_4->drq[OMAP_DMA_UART1_RX], "uart1", serial_hds[0]); VAR_4->uart[1] = omap_uart_init(0xfffb0800, qdev_get_gpio_in(VAR_4->ih[1], OMAP_INT_UART2), omap_findclk(VAR_4, "uart2_ck"), omap_findclk(VAR_4, "uart2_ck"), VAR_4->drq[OMAP_DMA_UART2_TX], VAR_4->drq[OMAP_DMA_UART2_RX], "uart2", serial_hds[0] ? serial_hds[1] : NULL); VAR_4->uart[2] = omap_uart_init(0xfffb9800, qdev_get_gpio_in(VAR_4->ih[0], OMAP_INT_UART3), omap_findclk(VAR_4, "uart3_ck"), omap_findclk(VAR_4, "uart3_ck"), VAR_4->drq[OMAP_DMA_UART3_TX], VAR_4->drq[OMAP_DMA_UART3_RX], "uart3", serial_hds[0] && serial_hds[1] ? serial_hds[2] : NULL); VAR_4->dpll[0] = omap_dpll_init(VAR_0, 0xfffecf00, omap_findclk(VAR_4, "dpll1")); VAR_4->dpll[1] = omap_dpll_init(VAR_0, 0xfffed000, omap_findclk(VAR_4, "dpll2")); VAR_4->dpll[2] = omap_dpll_init(VAR_0, 0xfffed100, omap_findclk(VAR_4, "dpll3")); dinfo = drive_get(IF_SD, 0, 0); if (!dinfo) { fprintf(stderr, "qemu: missing SecureDigital device\n"); exit(1); } VAR_4->mmc = omap_mmc_init(0xfffb7800, VAR_0, blk_by_legacy_dinfo(dinfo), qdev_get_gpio_in(VAR_4->ih[1], OMAP_INT_OQN), &VAR_4->drq[OMAP_DMA_MMC_TX], omap_findclk(VAR_4, "mmc_ck")); VAR_4->mpuio = omap_mpuio_init(VAR_0, 0xfffb5000, qdev_get_gpio_in(VAR_4->ih[1], OMAP_INT_KEYBOARD), qdev_get_gpio_in(VAR_4->ih[1], OMAP_INT_MPUIO), VAR_4->wakeup, omap_findclk(VAR_4, "clk32-kHz")); VAR_4->gpio = qdev_create(NULL, "omap-gpio"); qdev_prop_set_int32(VAR_4->gpio, "mpu_model", VAR_4->mpu_model); qdev_prop_set_ptr(VAR_4->gpio, "clk", omap_findclk(VAR_4, "arm_gpio_ck")); qdev_init_nofail(VAR_4->gpio); sysbus_connect_irq(SYS_BUS_DEVICE(VAR_4->gpio), 0, qdev_get_gpio_in(VAR_4->ih[0], OMAP_INT_GPIO_BANK1)); sysbus_mmio_map(SYS_BUS_DEVICE(VAR_4->gpio), 0, 0xfffce000); VAR_4->microwire = omap_uwire_init(VAR_0, 0xfffb3000, qdev_get_gpio_in(VAR_4->ih[1], OMAP_INT_uWireTX), qdev_get_gpio_in(VAR_4->ih[1], OMAP_INT_uWireRX), VAR_4->drq[OMAP_DMA_UWIRE_TX], omap_findclk(VAR_4, "mpuper_ck")); VAR_4->pwl = omap_pwl_init(VAR_0, 0xfffb5800, omap_findclk(VAR_4, "armxor_ck")); VAR_4->pwt = omap_pwt_init(VAR_0, 0xfffb6000, omap_findclk(VAR_4, "armxor_ck")); VAR_4->i2c[0] = qdev_create(NULL, "omap_i2c"); qdev_prop_set_uint8(VAR_4->i2c[0], "revision", 0x11); qdev_prop_set_ptr(VAR_4->i2c[0], "fclk", omap_findclk(VAR_4, "mpuper_ck")); qdev_init_nofail(VAR_4->i2c[0]); busdev = SYS_BUS_DEVICE(VAR_4->i2c[0]); sysbus_connect_irq(busdev, 0, qdev_get_gpio_in(VAR_4->ih[1], OMAP_INT_I2C)); sysbus_connect_irq(busdev, 1, VAR_4->drq[OMAP_DMA_I2C_TX]); sysbus_connect_irq(busdev, 2, VAR_4->drq[OMAP_DMA_I2C_RX]); sysbus_mmio_map(busdev, 0, 0xfffb3800); VAR_4->rtc = omap_rtc_init(VAR_0, 0xfffb4800, qdev_get_gpio_in(VAR_4->ih[1], OMAP_INT_RTC_TIMER), qdev_get_gpio_in(VAR_4->ih[1], OMAP_INT_RTC_ALARM), omap_findclk(VAR_4, "clk32-kHz")); VAR_4->mcbsp1 = omap_mcbsp_init(VAR_0, 0xfffb1800, qdev_get_gpio_in(VAR_4->ih[1], OMAP_INT_McBSP1TX), qdev_get_gpio_in(VAR_4->ih[1], OMAP_INT_McBSP1RX), &VAR_4->drq[OMAP_DMA_MCBSP1_TX], omap_findclk(VAR_4, "dspxor_ck")); VAR_4->mcbsp2 = omap_mcbsp_init(VAR_0, 0xfffb1000, qdev_get_gpio_in(VAR_4->ih[0], OMAP_INT_310_McBSP2_TX), qdev_get_gpio_in(VAR_4->ih[0], OMAP_INT_310_McBSP2_RX), &VAR_4->drq[OMAP_DMA_MCBSP2_TX], omap_findclk(VAR_4, "mpuper_ck")); VAR_4->mcbsp3 = omap_mcbsp_init(VAR_0, 0xfffb7000, qdev_get_gpio_in(VAR_4->ih[1], OMAP_INT_McBSP3TX), qdev_get_gpio_in(VAR_4->ih[1], OMAP_INT_McBSP3RX), &VAR_4->drq[OMAP_DMA_MCBSP3_TX], omap_findclk(VAR_4, "dspxor_ck")); VAR_4->led[0] = omap_lpg_init(VAR_0, 0xfffbd000, omap_findclk(VAR_4, "clk32-kHz")); VAR_4->led[1] = omap_lpg_init(VAR_0, 0xfffbd800, omap_findclk(VAR_4, "clk32-kHz")); omap_setup_dsp_mapping(VAR_0, omap15xx_dsp_mm); omap_setup_mpui_io(VAR_0, VAR_4); qemu_register_reset(omap1_mpu_reset, VAR_4); return VAR_4; }
[ "struct omap_mpu_state_s *FUNC_0(MemoryRegion *VAR_0,\nunsigned long VAR_1,\nconst char *VAR_2)\n{", "int VAR_3;", "struct omap_mpu_state_s *VAR_4 = (struct omap_mpu_state_s *)\ng_malloc0(sizeof(struct omap_mpu_state_s));", "qemu_irq dma_irqs[6];", "DriveInfo *dinfo;", "SysBusDevice *busdev;", "if (!VAR_2)\nVAR_2 = \"ti925t\";", "VAR_4->mpu_model = omap310;", "VAR_4->cpu = cpu_arm_init(VAR_2);", "if (VAR_4->cpu == NULL) {", "fprintf(stderr, \"Unable to find CPU definition\\n\");", "exit(1);", "}", "VAR_4->VAR_1 = VAR_1;", "VAR_4->sram_size = OMAP15XX_SRAM_SIZE;", "VAR_4->wakeup = qemu_allocate_irq(omap_mpu_wakeup, VAR_4, 0);", "omap_clk_init(VAR_4);", "memory_region_allocate_system_memory(&VAR_4->emiff_ram, NULL, \"omap1.dram\",\nVAR_4->VAR_1);", "memory_region_add_subregion(VAR_0, OMAP_EMIFF_BASE, &VAR_4->emiff_ram);", "memory_region_init_ram(&VAR_4->imif_ram, NULL, \"omap1.sram\", VAR_4->sram_size,\n&error_abort);", "vmstate_register_ram_global(&VAR_4->imif_ram);", "memory_region_add_subregion(VAR_0, OMAP_IMIF_BASE, &VAR_4->imif_ram);", "omap_clkm_init(VAR_0, 0xfffece00, 0xe1008000, VAR_4);", "VAR_4->ih[0] = qdev_create(NULL, \"omap-intc\");", "qdev_prop_set_uint32(VAR_4->ih[0], \"size\", 0x100);", "qdev_prop_set_ptr(VAR_4->ih[0], \"clk\", omap_findclk(VAR_4, \"arminth_ck\"));", "qdev_init_nofail(VAR_4->ih[0]);", "busdev = SYS_BUS_DEVICE(VAR_4->ih[0]);", "sysbus_connect_irq(busdev, 0,\nqdev_get_gpio_in(DEVICE(VAR_4->cpu), ARM_CPU_IRQ));", "sysbus_connect_irq(busdev, 1,\nqdev_get_gpio_in(DEVICE(VAR_4->cpu), ARM_CPU_FIQ));", "sysbus_mmio_map(busdev, 0, 0xfffecb00);", "VAR_4->ih[1] = qdev_create(NULL, \"omap-intc\");", "qdev_prop_set_uint32(VAR_4->ih[1], \"size\", 0x800);", "qdev_prop_set_ptr(VAR_4->ih[1], \"clk\", omap_findclk(VAR_4, \"arminth_ck\"));", "qdev_init_nofail(VAR_4->ih[1]);", "busdev = SYS_BUS_DEVICE(VAR_4->ih[1]);", "sysbus_connect_irq(busdev, 0,\nqdev_get_gpio_in(VAR_4->ih[0], OMAP_INT_15XX_IH2_IRQ));", "sysbus_mmio_map(busdev, 0, 0xfffe0000);", "for (VAR_3 = 0; VAR_3 < 6; VAR_3++) {", "dma_irqs[VAR_3] = qdev_get_gpio_in(VAR_4->ih[omap1_dma_irq_map[VAR_3].ih],\nomap1_dma_irq_map[VAR_3].intr);", "}", "VAR_4->dma = omap_dma_init(0xfffed800, dma_irqs, VAR_0,\nqdev_get_gpio_in(VAR_4->ih[0], OMAP_INT_DMA_LCD),\nVAR_4, omap_findclk(VAR_4, \"dma_ck\"), omap_dma_3_1);", "VAR_4->port[emiff ].addr_valid = omap_validate_emiff_addr;", "VAR_4->port[emifs ].addr_valid = omap_validate_emifs_addr;", "VAR_4->port[imif ].addr_valid = omap_validate_imif_addr;", "VAR_4->port[tipb ].addr_valid = omap_validate_tipb_addr;", "VAR_4->port[local ].addr_valid = omap_validate_local_addr;", "VAR_4->port[tipb_mpui].addr_valid = omap_validate_tipb_mpui_addr;", "soc_dma_port_add_mem(VAR_4->dma, memory_region_get_ram_ptr(&VAR_4->emiff_ram),\nOMAP_EMIFF_BASE, VAR_4->VAR_1);", "soc_dma_port_add_mem(VAR_4->dma, memory_region_get_ram_ptr(&VAR_4->imif_ram),\nOMAP_IMIF_BASE, VAR_4->sram_size);", "VAR_4->timer[0] = omap_mpu_timer_init(VAR_0, 0xfffec500,\nqdev_get_gpio_in(VAR_4->ih[0], OMAP_INT_TIMER1),\nomap_findclk(VAR_4, \"mputim_ck\"));", "VAR_4->timer[1] = omap_mpu_timer_init(VAR_0, 0xfffec600,\nqdev_get_gpio_in(VAR_4->ih[0], OMAP_INT_TIMER2),\nomap_findclk(VAR_4, \"mputim_ck\"));", "VAR_4->timer[2] = omap_mpu_timer_init(VAR_0, 0xfffec700,\nqdev_get_gpio_in(VAR_4->ih[0], OMAP_INT_TIMER3),\nomap_findclk(VAR_4, \"mputim_ck\"));", "VAR_4->wdt = omap_wd_timer_init(VAR_0, 0xfffec800,\nqdev_get_gpio_in(VAR_4->ih[0], OMAP_INT_WD_TIMER),\nomap_findclk(VAR_4, \"armwdt_ck\"));", "VAR_4->os_timer = omap_os_timer_init(VAR_0, 0xfffb9000,\nqdev_get_gpio_in(VAR_4->ih[1], OMAP_INT_OS_TIMER),\nomap_findclk(VAR_4, \"clk32-kHz\"));", "VAR_4->lcd = omap_lcdc_init(VAR_0, 0xfffec000,\nqdev_get_gpio_in(VAR_4->ih[0], OMAP_INT_LCD_CTRL),\nomap_dma_get_lcdch(VAR_4->dma),\nomap_findclk(VAR_4, \"lcd_ck\"));", "omap_ulpd_pm_init(VAR_0, 0xfffe0800, VAR_4);", "omap_pin_cfg_init(VAR_0, 0xfffe1000, VAR_4);", "omap_id_init(VAR_0, VAR_4);", "omap_mpui_init(VAR_0, 0xfffec900, VAR_4);", "VAR_4->private_tipb = omap_tipb_bridge_init(VAR_0, 0xfffeca00,\nqdev_get_gpio_in(VAR_4->ih[0], OMAP_INT_BRIDGE_PRIV),\nomap_findclk(VAR_4, \"tipb_ck\"));", "VAR_4->public_tipb = omap_tipb_bridge_init(VAR_0, 0xfffed300,\nqdev_get_gpio_in(VAR_4->ih[0], OMAP_INT_BRIDGE_PUB),\nomap_findclk(VAR_4, \"tipb_ck\"));", "omap_tcmi_init(VAR_0, 0xfffecc00, VAR_4);", "VAR_4->uart[0] = omap_uart_init(0xfffb0000,\nqdev_get_gpio_in(VAR_4->ih[1], OMAP_INT_UART1),\nomap_findclk(VAR_4, \"uart1_ck\"),\nomap_findclk(VAR_4, \"uart1_ck\"),\nVAR_4->drq[OMAP_DMA_UART1_TX], VAR_4->drq[OMAP_DMA_UART1_RX],\n\"uart1\",\nserial_hds[0]);", "VAR_4->uart[1] = omap_uart_init(0xfffb0800,\nqdev_get_gpio_in(VAR_4->ih[1], OMAP_INT_UART2),\nomap_findclk(VAR_4, \"uart2_ck\"),\nomap_findclk(VAR_4, \"uart2_ck\"),\nVAR_4->drq[OMAP_DMA_UART2_TX], VAR_4->drq[OMAP_DMA_UART2_RX],\n\"uart2\",\nserial_hds[0] ? serial_hds[1] : NULL);", "VAR_4->uart[2] = omap_uart_init(0xfffb9800,\nqdev_get_gpio_in(VAR_4->ih[0], OMAP_INT_UART3),\nomap_findclk(VAR_4, \"uart3_ck\"),\nomap_findclk(VAR_4, \"uart3_ck\"),\nVAR_4->drq[OMAP_DMA_UART3_TX], VAR_4->drq[OMAP_DMA_UART3_RX],\n\"uart3\",\nserial_hds[0] && serial_hds[1] ? serial_hds[2] : NULL);", "VAR_4->dpll[0] = omap_dpll_init(VAR_0, 0xfffecf00,\nomap_findclk(VAR_4, \"dpll1\"));", "VAR_4->dpll[1] = omap_dpll_init(VAR_0, 0xfffed000,\nomap_findclk(VAR_4, \"dpll2\"));", "VAR_4->dpll[2] = omap_dpll_init(VAR_0, 0xfffed100,\nomap_findclk(VAR_4, \"dpll3\"));", "dinfo = drive_get(IF_SD, 0, 0);", "if (!dinfo) {", "fprintf(stderr, \"qemu: missing SecureDigital device\\n\");", "exit(1);", "}", "VAR_4->mmc = omap_mmc_init(0xfffb7800, VAR_0,\nblk_by_legacy_dinfo(dinfo),\nqdev_get_gpio_in(VAR_4->ih[1], OMAP_INT_OQN),\n&VAR_4->drq[OMAP_DMA_MMC_TX],\nomap_findclk(VAR_4, \"mmc_ck\"));", "VAR_4->mpuio = omap_mpuio_init(VAR_0, 0xfffb5000,\nqdev_get_gpio_in(VAR_4->ih[1], OMAP_INT_KEYBOARD),\nqdev_get_gpio_in(VAR_4->ih[1], OMAP_INT_MPUIO),\nVAR_4->wakeup, omap_findclk(VAR_4, \"clk32-kHz\"));", "VAR_4->gpio = qdev_create(NULL, \"omap-gpio\");", "qdev_prop_set_int32(VAR_4->gpio, \"mpu_model\", VAR_4->mpu_model);", "qdev_prop_set_ptr(VAR_4->gpio, \"clk\", omap_findclk(VAR_4, \"arm_gpio_ck\"));", "qdev_init_nofail(VAR_4->gpio);", "sysbus_connect_irq(SYS_BUS_DEVICE(VAR_4->gpio), 0,\nqdev_get_gpio_in(VAR_4->ih[0], OMAP_INT_GPIO_BANK1));", "sysbus_mmio_map(SYS_BUS_DEVICE(VAR_4->gpio), 0, 0xfffce000);", "VAR_4->microwire = omap_uwire_init(VAR_0, 0xfffb3000,\nqdev_get_gpio_in(VAR_4->ih[1], OMAP_INT_uWireTX),\nqdev_get_gpio_in(VAR_4->ih[1], OMAP_INT_uWireRX),\nVAR_4->drq[OMAP_DMA_UWIRE_TX], omap_findclk(VAR_4, \"mpuper_ck\"));", "VAR_4->pwl = omap_pwl_init(VAR_0, 0xfffb5800,\nomap_findclk(VAR_4, \"armxor_ck\"));", "VAR_4->pwt = omap_pwt_init(VAR_0, 0xfffb6000,\nomap_findclk(VAR_4, \"armxor_ck\"));", "VAR_4->i2c[0] = qdev_create(NULL, \"omap_i2c\");", "qdev_prop_set_uint8(VAR_4->i2c[0], \"revision\", 0x11);", "qdev_prop_set_ptr(VAR_4->i2c[0], \"fclk\", omap_findclk(VAR_4, \"mpuper_ck\"));", "qdev_init_nofail(VAR_4->i2c[0]);", "busdev = SYS_BUS_DEVICE(VAR_4->i2c[0]);", "sysbus_connect_irq(busdev, 0, qdev_get_gpio_in(VAR_4->ih[1], OMAP_INT_I2C));", "sysbus_connect_irq(busdev, 1, VAR_4->drq[OMAP_DMA_I2C_TX]);", "sysbus_connect_irq(busdev, 2, VAR_4->drq[OMAP_DMA_I2C_RX]);", "sysbus_mmio_map(busdev, 0, 0xfffb3800);", "VAR_4->rtc = omap_rtc_init(VAR_0, 0xfffb4800,\nqdev_get_gpio_in(VAR_4->ih[1], OMAP_INT_RTC_TIMER),\nqdev_get_gpio_in(VAR_4->ih[1], OMAP_INT_RTC_ALARM),\nomap_findclk(VAR_4, \"clk32-kHz\"));", "VAR_4->mcbsp1 = omap_mcbsp_init(VAR_0, 0xfffb1800,\nqdev_get_gpio_in(VAR_4->ih[1], OMAP_INT_McBSP1TX),\nqdev_get_gpio_in(VAR_4->ih[1], OMAP_INT_McBSP1RX),\n&VAR_4->drq[OMAP_DMA_MCBSP1_TX], omap_findclk(VAR_4, \"dspxor_ck\"));", "VAR_4->mcbsp2 = omap_mcbsp_init(VAR_0, 0xfffb1000,\nqdev_get_gpio_in(VAR_4->ih[0],\nOMAP_INT_310_McBSP2_TX),\nqdev_get_gpio_in(VAR_4->ih[0],\nOMAP_INT_310_McBSP2_RX),\n&VAR_4->drq[OMAP_DMA_MCBSP2_TX], omap_findclk(VAR_4, \"mpuper_ck\"));", "VAR_4->mcbsp3 = omap_mcbsp_init(VAR_0, 0xfffb7000,\nqdev_get_gpio_in(VAR_4->ih[1], OMAP_INT_McBSP3TX),\nqdev_get_gpio_in(VAR_4->ih[1], OMAP_INT_McBSP3RX),\n&VAR_4->drq[OMAP_DMA_MCBSP3_TX], omap_findclk(VAR_4, \"dspxor_ck\"));", "VAR_4->led[0] = omap_lpg_init(VAR_0,\n0xfffbd000, omap_findclk(VAR_4, \"clk32-kHz\"));", "VAR_4->led[1] = omap_lpg_init(VAR_0,\n0xfffbd800, omap_findclk(VAR_4, \"clk32-kHz\"));", "omap_setup_dsp_mapping(VAR_0, omap15xx_dsp_mm);", "omap_setup_mpui_io(VAR_0, VAR_4);", "qemu_register_reset(omap1_mpu_reset, VAR_4);", "return VAR_4;", "}" ]
[ 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11, 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23, 25 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 49 ], [ 55 ], [ 61, 63 ], [ 65 ], [ 67, 69 ], [ 71 ], [ 73 ], [ 77 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91, 93 ], [ 95, 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111, 113 ], [ 117 ], [ 121 ], [ 123, 125 ], [ 127 ], [ 129, 131, 133 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 153, 155 ], [ 157, 159 ], [ 163, 165, 167 ], [ 169, 171, 173 ], [ 175, 177, 179 ], [ 183, 185, 187 ], [ 191, 193, 195 ], [ 199, 201, 203, 205 ], [ 209 ], [ 211 ], [ 213 ], [ 217 ], [ 221, 223, 225 ], [ 227, 229, 231 ], [ 235 ], [ 239, 241, 243, 245, 247, 249, 251 ], [ 253, 255, 257, 259, 261, 263, 265 ], [ 267, 269, 271, 273, 275, 277, 279 ], [ 283, 285 ], [ 287, 289 ], [ 291, 293 ], [ 297 ], [ 299 ], [ 301 ], [ 303 ], [ 305 ], [ 307, 309, 311, 313, 315 ], [ 319, 321, 323, 325 ], [ 329 ], [ 331 ], [ 333 ], [ 335 ], [ 337, 339 ], [ 341 ], [ 345, 347, 349, 351 ], [ 355, 357 ], [ 359, 361 ], [ 365 ], [ 367 ], [ 369 ], [ 371 ], [ 373 ], [ 375 ], [ 377 ], [ 379 ], [ 381 ], [ 385, 387, 389, 391 ], [ 395, 397, 399, 401 ], [ 403, 405, 407, 409, 411, 413 ], [ 415, 417, 419, 421 ], [ 425, 427 ], [ 429, 431 ], [ 465 ], [ 467 ], [ 471 ], [ 475 ], [ 477 ] ]
14,701
static void decode_scaling_list(GetBitContext *gb, uint8_t *factors, int size, const uint8_t *jvt_list, const uint8_t *fallback_list) { int i, last = 8, next = 8; const uint8_t *scan = size == 16 ? ff_zigzag_scan : ff_zigzag_direct; if (!get_bits1(gb)) /* matrix not written, we use the predicted one */ memcpy(factors, fallback_list, size * sizeof(uint8_t)); else for (i = 0; i < size; i++) { if (next) next = (last + get_se_golomb(gb)) & 0xff; if (!i && !next) { /* matrix not written, we use the preset one */ memcpy(factors, jvt_list, size * sizeof(uint8_t)); break; } last = factors[scan[i]] = next ? next : last; } }
true
FFmpeg
cbd622be997e8307a409efc3b4bbe8765147def2
static void decode_scaling_list(GetBitContext *gb, uint8_t *factors, int size, const uint8_t *jvt_list, const uint8_t *fallback_list) { int i, last = 8, next = 8; const uint8_t *scan = size == 16 ? ff_zigzag_scan : ff_zigzag_direct; if (!get_bits1(gb)) memcpy(factors, fallback_list, size * sizeof(uint8_t)); else for (i = 0; i < size; i++) { if (next) next = (last + get_se_golomb(gb)) & 0xff; if (!i && !next) { memcpy(factors, jvt_list, size * sizeof(uint8_t)); break; } last = factors[scan[i]] = next ? next : last; } }
{ "code": [ " if (next)", " next = (last + get_se_golomb(gb)) & 0xff;" ], "line_no": [ 21, 23 ] }
static void FUNC_0(GetBitContext *VAR_0, uint8_t *VAR_1, int VAR_2, const uint8_t *VAR_3, const uint8_t *VAR_4) { int VAR_5, VAR_6 = 8, VAR_7 = 8; const uint8_t *VAR_8 = VAR_2 == 16 ? ff_zigzag_scan : ff_zigzag_direct; if (!get_bits1(VAR_0)) memcpy(VAR_1, VAR_4, VAR_2 * sizeof(uint8_t)); else for (VAR_5 = 0; VAR_5 < VAR_2; VAR_5++) { if (VAR_7) VAR_7 = (VAR_6 + get_se_golomb(VAR_0)) & 0xff; if (!VAR_5 && !VAR_7) { memcpy(VAR_1, VAR_3, VAR_2 * sizeof(uint8_t)); break; } VAR_6 = VAR_1[VAR_8[VAR_5]] = VAR_7 ? VAR_7 : VAR_6; } }
[ "static void FUNC_0(GetBitContext *VAR_0, uint8_t *VAR_1, int VAR_2,\nconst uint8_t *VAR_3,\nconst uint8_t *VAR_4)\n{", "int VAR_5, VAR_6 = 8, VAR_7 = 8;", "const uint8_t *VAR_8 = VAR_2 == 16 ? ff_zigzag_scan : ff_zigzag_direct;", "if (!get_bits1(VAR_0))\nmemcpy(VAR_1, VAR_4, VAR_2 * sizeof(uint8_t));", "else\nfor (VAR_5 = 0; VAR_5 < VAR_2; VAR_5++) {", "if (VAR_7)\nVAR_7 = (VAR_6 + get_se_golomb(VAR_0)) & 0xff;", "if (!VAR_5 && !VAR_7) {", "memcpy(VAR_1, VAR_3, VAR_2 * sizeof(uint8_t));", "break;", "}", "VAR_6 = VAR_1[VAR_8[VAR_5]] = VAR_7 ? VAR_7 : VAR_6;", "}", "}" ]
[ 0, 0, 0, 0, 0, 1, 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 ] ]
14,702
PCIDevice *virtio_net_init(PCIBus *bus, NICInfo *nd, int devfn) { VirtIONet *n; static int virtio_net_id; n = (VirtIONet *)virtio_init_pci(bus, "virtio-net", 6900, 0x1000, 0, VIRTIO_ID_NET, 0x02, 0x00, 0x00, 6, sizeof(VirtIONet)); if (!n) return NULL; n->vdev.get_config = virtio_net_update_config; n->vdev.get_features = virtio_net_get_features; n->vdev.set_features = virtio_net_set_features; n->rx_vq = virtio_add_queue(&n->vdev, 256, virtio_net_handle_rx); n->tx_vq = virtio_add_queue(&n->vdev, 256, virtio_net_handle_tx); memcpy(n->mac, nd->macaddr, 6); n->vc = qemu_new_vlan_client(nd->vlan, nd->model, nd->name, virtio_net_receive, virtio_net_can_receive, n); qemu_format_nic_info_str(n->vc, n->mac); n->tx_timer = qemu_new_timer(vm_clock, virtio_net_tx_timer, n); n->tx_timer_active = 0; n->mergeable_rx_bufs = 0; register_savevm("virtio-net", virtio_net_id++, 2, virtio_net_save, virtio_net_load, n); return (PCIDevice *)n; }
false
qemu
554c97dd43e021b626c78ed5bd72bca33d5cb99c
PCIDevice *virtio_net_init(PCIBus *bus, NICInfo *nd, int devfn) { VirtIONet *n; static int virtio_net_id; n = (VirtIONet *)virtio_init_pci(bus, "virtio-net", 6900, 0x1000, 0, VIRTIO_ID_NET, 0x02, 0x00, 0x00, 6, sizeof(VirtIONet)); if (!n) return NULL; n->vdev.get_config = virtio_net_update_config; n->vdev.get_features = virtio_net_get_features; n->vdev.set_features = virtio_net_set_features; n->rx_vq = virtio_add_queue(&n->vdev, 256, virtio_net_handle_rx); n->tx_vq = virtio_add_queue(&n->vdev, 256, virtio_net_handle_tx); memcpy(n->mac, nd->macaddr, 6); n->vc = qemu_new_vlan_client(nd->vlan, nd->model, nd->name, virtio_net_receive, virtio_net_can_receive, n); qemu_format_nic_info_str(n->vc, n->mac); n->tx_timer = qemu_new_timer(vm_clock, virtio_net_tx_timer, n); n->tx_timer_active = 0; n->mergeable_rx_bufs = 0; register_savevm("virtio-net", virtio_net_id++, 2, virtio_net_save, virtio_net_load, n); return (PCIDevice *)n; }
{ "code": [], "line_no": [] }
PCIDevice *FUNC_0(PCIBus *bus, NICInfo *nd, int devfn) { VirtIONet *n; static int VAR_0; n = (VirtIONet *)virtio_init_pci(bus, "virtio-net", 6900, 0x1000, 0, VIRTIO_ID_NET, 0x02, 0x00, 0x00, 6, sizeof(VirtIONet)); if (!n) return NULL; n->vdev.get_config = virtio_net_update_config; n->vdev.get_features = virtio_net_get_features; n->vdev.set_features = virtio_net_set_features; n->rx_vq = virtio_add_queue(&n->vdev, 256, virtio_net_handle_rx); n->tx_vq = virtio_add_queue(&n->vdev, 256, virtio_net_handle_tx); memcpy(n->mac, nd->macaddr, 6); n->vc = qemu_new_vlan_client(nd->vlan, nd->model, nd->name, virtio_net_receive, virtio_net_can_receive, n); qemu_format_nic_info_str(n->vc, n->mac); n->tx_timer = qemu_new_timer(vm_clock, virtio_net_tx_timer, n); n->tx_timer_active = 0; n->mergeable_rx_bufs = 0; register_savevm("virtio-net", VAR_0++, 2, virtio_net_save, virtio_net_load, n); return (PCIDevice *)n; }
[ "PCIDevice *FUNC_0(PCIBus *bus, NICInfo *nd, int devfn)\n{", "VirtIONet *n;", "static int VAR_0;", "n = (VirtIONet *)virtio_init_pci(bus, \"virtio-net\", 6900, 0x1000,\n0, VIRTIO_ID_NET,\n0x02, 0x00, 0x00,\n6, sizeof(VirtIONet));", "if (!n)\nreturn NULL;", "n->vdev.get_config = virtio_net_update_config;", "n->vdev.get_features = virtio_net_get_features;", "n->vdev.set_features = virtio_net_set_features;", "n->rx_vq = virtio_add_queue(&n->vdev, 256, virtio_net_handle_rx);", "n->tx_vq = virtio_add_queue(&n->vdev, 256, virtio_net_handle_tx);", "memcpy(n->mac, nd->macaddr, 6);", "n->vc = qemu_new_vlan_client(nd->vlan, nd->model, nd->name,\nvirtio_net_receive, virtio_net_can_receive, n);", "qemu_format_nic_info_str(n->vc, n->mac);", "n->tx_timer = qemu_new_timer(vm_clock, virtio_net_tx_timer, n);", "n->tx_timer_active = 0;", "n->mergeable_rx_bufs = 0;", "register_savevm(\"virtio-net\", VAR_0++, 2,\nvirtio_net_save, virtio_net_load, n);", "return (PCIDevice *)n;", "}" ]
[ 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 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37, 39 ], [ 43 ], [ 47 ], [ 49 ], [ 51 ], [ 55, 57 ], [ 61 ], [ 63 ] ]
14,703
CharDriverState *chr_baum_init(void) { BaumDriverState *baum; CharDriverState *chr; brlapi_handle_t *handle; #ifdef CONFIG_SDL SDL_SysWMinfo info; #endif int tty; baum = g_malloc0(sizeof(BaumDriverState)); baum->chr = chr = g_malloc0(sizeof(CharDriverState)); chr->opaque = baum; chr->chr_write = baum_write; chr->chr_accept_input = baum_accept_input; chr->chr_close = baum_close; handle = g_malloc0(brlapi_getHandleSize()); baum->brlapi = handle; baum->brlapi_fd = brlapi__openConnection(handle, NULL, NULL); if (baum->brlapi_fd == -1) { brlapi_perror("baum_init: brlapi_openConnection"); goto fail_handle; } baum->cellCount_timer = qemu_new_timer_ns(vm_clock, baum_cellCount_timer_cb, baum); if (brlapi__getDisplaySize(handle, &baum->x, &baum->y) == -1) { brlapi_perror("baum_init: brlapi_getDisplaySize"); goto fail; } #ifdef CONFIG_SDL memset(&info, 0, sizeof(info)); SDL_VERSION(&info.version); if (SDL_GetWMInfo(&info)) tty = info.info.x11.wmwindow; else #endif tty = BRLAPI_TTY_DEFAULT; if (brlapi__enterTtyMode(handle, tty, NULL) == -1) { brlapi_perror("baum_init: brlapi_enterTtyMode"); goto fail; } qemu_set_fd_handler(baum->brlapi_fd, baum_chr_read, NULL, baum); qemu_chr_be_generic_open(chr); return chr; fail: qemu_free_timer(baum->cellCount_timer); brlapi__closeConnection(handle); fail_handle: g_free(handle); g_free(chr); g_free(baum); return NULL; }
false
qemu
bd5c51ee6c4f1c79cae5ad2516d711a27b4ea8ec
CharDriverState *chr_baum_init(void) { BaumDriverState *baum; CharDriverState *chr; brlapi_handle_t *handle; #ifdef CONFIG_SDL SDL_SysWMinfo info; #endif int tty; baum = g_malloc0(sizeof(BaumDriverState)); baum->chr = chr = g_malloc0(sizeof(CharDriverState)); chr->opaque = baum; chr->chr_write = baum_write; chr->chr_accept_input = baum_accept_input; chr->chr_close = baum_close; handle = g_malloc0(brlapi_getHandleSize()); baum->brlapi = handle; baum->brlapi_fd = brlapi__openConnection(handle, NULL, NULL); if (baum->brlapi_fd == -1) { brlapi_perror("baum_init: brlapi_openConnection"); goto fail_handle; } baum->cellCount_timer = qemu_new_timer_ns(vm_clock, baum_cellCount_timer_cb, baum); if (brlapi__getDisplaySize(handle, &baum->x, &baum->y) == -1) { brlapi_perror("baum_init: brlapi_getDisplaySize"); goto fail; } #ifdef CONFIG_SDL memset(&info, 0, sizeof(info)); SDL_VERSION(&info.version); if (SDL_GetWMInfo(&info)) tty = info.info.x11.wmwindow; else #endif tty = BRLAPI_TTY_DEFAULT; if (brlapi__enterTtyMode(handle, tty, NULL) == -1) { brlapi_perror("baum_init: brlapi_enterTtyMode"); goto fail; } qemu_set_fd_handler(baum->brlapi_fd, baum_chr_read, NULL, baum); qemu_chr_be_generic_open(chr); return chr; fail: qemu_free_timer(baum->cellCount_timer); brlapi__closeConnection(handle); fail_handle: g_free(handle); g_free(chr); g_free(baum); return NULL; }
{ "code": [], "line_no": [] }
CharDriverState *FUNC_0(void) { BaumDriverState *baum; CharDriverState *chr; brlapi_handle_t *handle; #ifdef CONFIG_SDL SDL_SysWMinfo info; #endif int VAR_0; baum = g_malloc0(sizeof(BaumDriverState)); baum->chr = chr = g_malloc0(sizeof(CharDriverState)); chr->opaque = baum; chr->chr_write = baum_write; chr->chr_accept_input = baum_accept_input; chr->chr_close = baum_close; handle = g_malloc0(brlapi_getHandleSize()); baum->brlapi = handle; baum->brlapi_fd = brlapi__openConnection(handle, NULL, NULL); if (baum->brlapi_fd == -1) { brlapi_perror("baum_init: brlapi_openConnection"); goto fail_handle; } baum->cellCount_timer = qemu_new_timer_ns(vm_clock, baum_cellCount_timer_cb, baum); if (brlapi__getDisplaySize(handle, &baum->x, &baum->y) == -1) { brlapi_perror("baum_init: brlapi_getDisplaySize"); goto fail; } #ifdef CONFIG_SDL memset(&info, 0, sizeof(info)); SDL_VERSION(&info.version); if (SDL_GetWMInfo(&info)) VAR_0 = info.info.x11.wmwindow; else #endif VAR_0 = BRLAPI_TTY_DEFAULT; if (brlapi__enterTtyMode(handle, VAR_0, NULL) == -1) { brlapi_perror("baum_init: brlapi_enterTtyMode"); goto fail; } qemu_set_fd_handler(baum->brlapi_fd, baum_chr_read, NULL, baum); qemu_chr_be_generic_open(chr); return chr; fail: qemu_free_timer(baum->cellCount_timer); brlapi__closeConnection(handle); fail_handle: g_free(handle); g_free(chr); g_free(baum); return NULL; }
[ "CharDriverState *FUNC_0(void)\n{", "BaumDriverState *baum;", "CharDriverState *chr;", "brlapi_handle_t *handle;", "#ifdef CONFIG_SDL\nSDL_SysWMinfo info;", "#endif\nint VAR_0;", "baum = g_malloc0(sizeof(BaumDriverState));", "baum->chr = chr = g_malloc0(sizeof(CharDriverState));", "chr->opaque = baum;", "chr->chr_write = baum_write;", "chr->chr_accept_input = baum_accept_input;", "chr->chr_close = baum_close;", "handle = g_malloc0(brlapi_getHandleSize());", "baum->brlapi = handle;", "baum->brlapi_fd = brlapi__openConnection(handle, NULL, NULL);", "if (baum->brlapi_fd == -1) {", "brlapi_perror(\"baum_init: brlapi_openConnection\");", "goto fail_handle;", "}", "baum->cellCount_timer = qemu_new_timer_ns(vm_clock, baum_cellCount_timer_cb, baum);", "if (brlapi__getDisplaySize(handle, &baum->x, &baum->y) == -1) {", "brlapi_perror(\"baum_init: brlapi_getDisplaySize\");", "goto fail;", "}", "#ifdef CONFIG_SDL\nmemset(&info, 0, sizeof(info));", "SDL_VERSION(&info.version);", "if (SDL_GetWMInfo(&info))\nVAR_0 = info.info.x11.wmwindow;", "else\n#endif\nVAR_0 = BRLAPI_TTY_DEFAULT;", "if (brlapi__enterTtyMode(handle, VAR_0, NULL) == -1) {", "brlapi_perror(\"baum_init: brlapi_enterTtyMode\");", "goto fail;", "}", "qemu_set_fd_handler(baum->brlapi_fd, baum_chr_read, NULL, baum);", "qemu_chr_be_generic_open(chr);", "return chr;", "fail:\nqemu_free_timer(baum->cellCount_timer);", "brlapi__closeConnection(handle);", "fail_handle:\ng_free(handle);", "g_free(chr);", "g_free(baum);", "return NULL;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 55 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 69, 71 ], [ 73 ], [ 75, 77 ], [ 79, 81, 83 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 97 ], [ 101 ], [ 105 ], [ 109, 111 ], [ 113 ], [ 115, 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ] ]
14,704
static int all_vcpus_paused(void) { CPUState *penv = first_cpu; while (penv) { if (!penv->stopped) return 0; penv = (CPUState *)penv->next_cpu; } return 1; }
false
qemu
0ab07c623c629acfbc792e5a174129c19faefbb7
static int all_vcpus_paused(void) { CPUState *penv = first_cpu; while (penv) { if (!penv->stopped) return 0; penv = (CPUState *)penv->next_cpu; } return 1; }
{ "code": [], "line_no": [] }
static int FUNC_0(void) { CPUState *penv = first_cpu; while (penv) { if (!penv->stopped) return 0; penv = (CPUState *)penv->next_cpu; } return 1; }
[ "static int FUNC_0(void)\n{", "CPUState *penv = first_cpu;", "while (penv) {", "if (!penv->stopped)\nreturn 0;", "penv = (CPUState *)penv->next_cpu;", "}", "return 1;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11, 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ] ]
14,705
uint32_t lm4549_read(lm4549_state *s, target_phys_addr_t offset) { uint16_t *regfile = s->regfile; uint32_t value = 0; /* Read the stored value */ assert(offset < 128); value = regfile[offset]; DPRINTF("read [0x%02x] = 0x%04x\n", offset, value); return value; }
false
qemu
a8170e5e97ad17ca169c64ba87ae2f53850dab4c
uint32_t lm4549_read(lm4549_state *s, target_phys_addr_t offset) { uint16_t *regfile = s->regfile; uint32_t value = 0; assert(offset < 128); value = regfile[offset]; DPRINTF("read [0x%02x] = 0x%04x\n", offset, value); return value; }
{ "code": [], "line_no": [] }
uint32_t FUNC_0(lm4549_state *s, target_phys_addr_t offset) { uint16_t *regfile = s->regfile; uint32_t value = 0; assert(offset < 128); value = regfile[offset]; DPRINTF("read [0x%02x] = 0x%04x\n", offset, value); return value; }
[ "uint32_t FUNC_0(lm4549_state *s, target_phys_addr_t offset)\n{", "uint16_t *regfile = s->regfile;", "uint32_t value = 0;", "assert(offset < 128);", "value = regfile[offset];", "DPRINTF(\"read [0x%02x] = 0x%04x\\n\", offset, value);", "return value;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 13 ], [ 15 ], [ 19 ], [ 23 ], [ 25 ] ]
14,707
static void kvm_log_stop(MemoryListener *listener, MemoryRegionSection *section) { int r; r = kvm_dirty_pages_log_change(section->offset_within_address_space, int128_get64(section->size), false); if (r < 0) { abort(); } }
false
qemu
b2dfd71c4843a762f2befe702adb249cf55baf66
static void kvm_log_stop(MemoryListener *listener, MemoryRegionSection *section) { int r; r = kvm_dirty_pages_log_change(section->offset_within_address_space, int128_get64(section->size), false); if (r < 0) { abort(); } }
{ "code": [], "line_no": [] }
static void FUNC_0(MemoryListener *VAR_0, MemoryRegionSection *VAR_1) { int VAR_2; VAR_2 = kvm_dirty_pages_log_change(VAR_1->offset_within_address_space, int128_get64(VAR_1->size), false); if (VAR_2 < 0) { abort(); } }
[ "static void FUNC_0(MemoryListener *VAR_0,\nMemoryRegionSection *VAR_1)\n{", "int VAR_2;", "VAR_2 = kvm_dirty_pages_log_change(VAR_1->offset_within_address_space,\nint128_get64(VAR_1->size), false);", "if (VAR_2 < 0) {", "abort();", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11, 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ] ]
14,708
int kvm_arch_init_vcpu(CPUState *cs) { int i, ret, arraylen; uint64_t v; struct kvm_one_reg r; struct kvm_reg_list rl; struct kvm_reg_list *rlp; ARMCPU *cpu = ARM_CPU(cs); if (cpu->kvm_target == QEMU_KVM_ARM_TARGET_NONE) { fprintf(stderr, "KVM is not supported for this guest CPU type\n"); return -EINVAL; } /* Determine init features for this CPU */ memset(cpu->kvm_init_features, 0, sizeof(cpu->kvm_init_features)); if (cpu->start_powered_off) { cpu->kvm_init_features[0] |= 1 << KVM_ARM_VCPU_POWER_OFF; } if (kvm_check_extension(cs->kvm_state, KVM_CAP_ARM_PSCI_0_2)) { cpu->psci_version = 2; cpu->kvm_init_features[0] |= 1 << KVM_ARM_VCPU_PSCI_0_2; } /* Do KVM_ARM_VCPU_INIT ioctl */ ret = kvm_arm_vcpu_init(cs); if (ret) { return ret; } /* Query the kernel to make sure it supports 32 VFP * registers: QEMU's "cortex-a15" CPU is always a * VFP-D32 core. The simplest way to do this is just * to attempt to read register d31. */ r.id = KVM_REG_ARM | KVM_REG_SIZE_U64 | KVM_REG_ARM_VFP | 31; r.addr = (uintptr_t)(&v); ret = kvm_vcpu_ioctl(cs, KVM_GET_ONE_REG, &r); if (ret == -ENOENT) { return -EINVAL; } /* Populate the cpreg list based on the kernel's idea * of what registers exist (and throw away the TCG-created list). */ rl.n = 0; ret = kvm_vcpu_ioctl(cs, KVM_GET_REG_LIST, &rl); if (ret != -E2BIG) { return ret; } rlp = g_malloc(sizeof(struct kvm_reg_list) + rl.n * sizeof(uint64_t)); rlp->n = rl.n; ret = kvm_vcpu_ioctl(cs, KVM_GET_REG_LIST, rlp); if (ret) { goto out; } /* Sort the list we get back from the kernel, since cpreg_tuples * must be in strictly ascending order. */ qsort(&rlp->reg, rlp->n, sizeof(rlp->reg[0]), compare_u64); for (i = 0, arraylen = 0; i < rlp->n; i++) { if (!reg_syncs_via_tuple_list(rlp->reg[i])) { continue; } switch (rlp->reg[i] & KVM_REG_SIZE_MASK) { case KVM_REG_SIZE_U32: case KVM_REG_SIZE_U64: break; default: fprintf(stderr, "Can't handle size of register in kernel list\n"); ret = -EINVAL; goto out; } arraylen++; } cpu->cpreg_indexes = g_renew(uint64_t, cpu->cpreg_indexes, arraylen); cpu->cpreg_values = g_renew(uint64_t, cpu->cpreg_values, arraylen); cpu->cpreg_vmstate_indexes = g_renew(uint64_t, cpu->cpreg_vmstate_indexes, arraylen); cpu->cpreg_vmstate_values = g_renew(uint64_t, cpu->cpreg_vmstate_values, arraylen); cpu->cpreg_array_len = arraylen; cpu->cpreg_vmstate_array_len = arraylen; for (i = 0, arraylen = 0; i < rlp->n; i++) { uint64_t regidx = rlp->reg[i]; if (!reg_syncs_via_tuple_list(regidx)) { continue; } cpu->cpreg_indexes[arraylen] = regidx; arraylen++; } assert(cpu->cpreg_array_len == arraylen); if (!write_kvmstate_to_list(cpu)) { /* Shouldn't happen unless kernel is inconsistent about * what registers exist. */ fprintf(stderr, "Initial read of kernel register state failed\n"); ret = -EINVAL; goto out; } /* Save a copy of the initial register values so that we can * feed it back to the kernel on VCPU reset. */ cpu->cpreg_reset_values = g_memdup(cpu->cpreg_values, cpu->cpreg_array_len * sizeof(cpu->cpreg_values[0])); out: g_free(rlp); return ret; }
false
qemu
75c9a1a0473cc5ca9756d11b236c715c7bc0ba67
int kvm_arch_init_vcpu(CPUState *cs) { int i, ret, arraylen; uint64_t v; struct kvm_one_reg r; struct kvm_reg_list rl; struct kvm_reg_list *rlp; ARMCPU *cpu = ARM_CPU(cs); if (cpu->kvm_target == QEMU_KVM_ARM_TARGET_NONE) { fprintf(stderr, "KVM is not supported for this guest CPU type\n"); return -EINVAL; } memset(cpu->kvm_init_features, 0, sizeof(cpu->kvm_init_features)); if (cpu->start_powered_off) { cpu->kvm_init_features[0] |= 1 << KVM_ARM_VCPU_POWER_OFF; } if (kvm_check_extension(cs->kvm_state, KVM_CAP_ARM_PSCI_0_2)) { cpu->psci_version = 2; cpu->kvm_init_features[0] |= 1 << KVM_ARM_VCPU_PSCI_0_2; } ret = kvm_arm_vcpu_init(cs); if (ret) { return ret; } r.id = KVM_REG_ARM | KVM_REG_SIZE_U64 | KVM_REG_ARM_VFP | 31; r.addr = (uintptr_t)(&v); ret = kvm_vcpu_ioctl(cs, KVM_GET_ONE_REG, &r); if (ret == -ENOENT) { return -EINVAL; } rl.n = 0; ret = kvm_vcpu_ioctl(cs, KVM_GET_REG_LIST, &rl); if (ret != -E2BIG) { return ret; } rlp = g_malloc(sizeof(struct kvm_reg_list) + rl.n * sizeof(uint64_t)); rlp->n = rl.n; ret = kvm_vcpu_ioctl(cs, KVM_GET_REG_LIST, rlp); if (ret) { goto out; } qsort(&rlp->reg, rlp->n, sizeof(rlp->reg[0]), compare_u64); for (i = 0, arraylen = 0; i < rlp->n; i++) { if (!reg_syncs_via_tuple_list(rlp->reg[i])) { continue; } switch (rlp->reg[i] & KVM_REG_SIZE_MASK) { case KVM_REG_SIZE_U32: case KVM_REG_SIZE_U64: break; default: fprintf(stderr, "Can't handle size of register in kernel list\n"); ret = -EINVAL; goto out; } arraylen++; } cpu->cpreg_indexes = g_renew(uint64_t, cpu->cpreg_indexes, arraylen); cpu->cpreg_values = g_renew(uint64_t, cpu->cpreg_values, arraylen); cpu->cpreg_vmstate_indexes = g_renew(uint64_t, cpu->cpreg_vmstate_indexes, arraylen); cpu->cpreg_vmstate_values = g_renew(uint64_t, cpu->cpreg_vmstate_values, arraylen); cpu->cpreg_array_len = arraylen; cpu->cpreg_vmstate_array_len = arraylen; for (i = 0, arraylen = 0; i < rlp->n; i++) { uint64_t regidx = rlp->reg[i]; if (!reg_syncs_via_tuple_list(regidx)) { continue; } cpu->cpreg_indexes[arraylen] = regidx; arraylen++; } assert(cpu->cpreg_array_len == arraylen); if (!write_kvmstate_to_list(cpu)) { fprintf(stderr, "Initial read of kernel register state failed\n"); ret = -EINVAL; goto out; } cpu->cpreg_reset_values = g_memdup(cpu->cpreg_values, cpu->cpreg_array_len * sizeof(cpu->cpreg_values[0])); out: g_free(rlp); return ret; }
{ "code": [], "line_no": [] }
int FUNC_0(CPUState *VAR_0) { int VAR_1, VAR_2, VAR_3; uint64_t v; struct kvm_one_reg VAR_4; struct kvm_reg_list VAR_5; struct kvm_reg_list *VAR_6; ARMCPU *cpu = ARM_CPU(VAR_0); if (cpu->kvm_target == QEMU_KVM_ARM_TARGET_NONE) { fprintf(stderr, "KVM is not supported for this guest CPU type\n"); return -EINVAL; } memset(cpu->kvm_init_features, 0, sizeof(cpu->kvm_init_features)); if (cpu->start_powered_off) { cpu->kvm_init_features[0] |= 1 << KVM_ARM_VCPU_POWER_OFF; } if (kvm_check_extension(VAR_0->kvm_state, KVM_CAP_ARM_PSCI_0_2)) { cpu->psci_version = 2; cpu->kvm_init_features[0] |= 1 << KVM_ARM_VCPU_PSCI_0_2; } VAR_2 = kvm_arm_vcpu_init(VAR_0); if (VAR_2) { return VAR_2; } VAR_4.id = KVM_REG_ARM | KVM_REG_SIZE_U64 | KVM_REG_ARM_VFP | 31; VAR_4.addr = (uintptr_t)(&v); VAR_2 = kvm_vcpu_ioctl(VAR_0, KVM_GET_ONE_REG, &VAR_4); if (VAR_2 == -ENOENT) { return -EINVAL; } VAR_5.n = 0; VAR_2 = kvm_vcpu_ioctl(VAR_0, KVM_GET_REG_LIST, &VAR_5); if (VAR_2 != -E2BIG) { return VAR_2; } VAR_6 = g_malloc(sizeof(struct kvm_reg_list) + VAR_5.n * sizeof(uint64_t)); VAR_6->n = VAR_5.n; VAR_2 = kvm_vcpu_ioctl(VAR_0, KVM_GET_REG_LIST, VAR_6); if (VAR_2) { goto out; } qsort(&VAR_6->reg, VAR_6->n, sizeof(VAR_6->reg[0]), compare_u64); for (VAR_1 = 0, VAR_3 = 0; VAR_1 < VAR_6->n; VAR_1++) { if (!reg_syncs_via_tuple_list(VAR_6->reg[VAR_1])) { continue; } switch (VAR_6->reg[VAR_1] & KVM_REG_SIZE_MASK) { case KVM_REG_SIZE_U32: case KVM_REG_SIZE_U64: break; default: fprintf(stderr, "Can't handle size of register in kernel list\n"); VAR_2 = -EINVAL; goto out; } VAR_3++; } cpu->cpreg_indexes = g_renew(uint64_t, cpu->cpreg_indexes, VAR_3); cpu->cpreg_values = g_renew(uint64_t, cpu->cpreg_values, VAR_3); cpu->cpreg_vmstate_indexes = g_renew(uint64_t, cpu->cpreg_vmstate_indexes, VAR_3); cpu->cpreg_vmstate_values = g_renew(uint64_t, cpu->cpreg_vmstate_values, VAR_3); cpu->cpreg_array_len = VAR_3; cpu->cpreg_vmstate_array_len = VAR_3; for (VAR_1 = 0, VAR_3 = 0; VAR_1 < VAR_6->n; VAR_1++) { uint64_t regidx = VAR_6->reg[VAR_1]; if (!reg_syncs_via_tuple_list(regidx)) { continue; } cpu->cpreg_indexes[VAR_3] = regidx; VAR_3++; } assert(cpu->cpreg_array_len == VAR_3); if (!write_kvmstate_to_list(cpu)) { fprintf(stderr, "Initial read of kernel register state failed\n"); VAR_2 = -EINVAL; goto out; } cpu->cpreg_reset_values = g_memdup(cpu->cpreg_values, cpu->cpreg_array_len * sizeof(cpu->cpreg_values[0])); out: g_free(VAR_6); return VAR_2; }
[ "int FUNC_0(CPUState *VAR_0)\n{", "int VAR_1, VAR_2, VAR_3;", "uint64_t v;", "struct kvm_one_reg VAR_4;", "struct kvm_reg_list VAR_5;", "struct kvm_reg_list *VAR_6;", "ARMCPU *cpu = ARM_CPU(VAR_0);", "if (cpu->kvm_target == QEMU_KVM_ARM_TARGET_NONE) {", "fprintf(stderr, \"KVM is not supported for this guest CPU type\\n\");", "return -EINVAL;", "}", "memset(cpu->kvm_init_features, 0, sizeof(cpu->kvm_init_features));", "if (cpu->start_powered_off) {", "cpu->kvm_init_features[0] |= 1 << KVM_ARM_VCPU_POWER_OFF;", "}", "if (kvm_check_extension(VAR_0->kvm_state, KVM_CAP_ARM_PSCI_0_2)) {", "cpu->psci_version = 2;", "cpu->kvm_init_features[0] |= 1 << KVM_ARM_VCPU_PSCI_0_2;", "}", "VAR_2 = kvm_arm_vcpu_init(VAR_0);", "if (VAR_2) {", "return VAR_2;", "}", "VAR_4.id = KVM_REG_ARM | KVM_REG_SIZE_U64 | KVM_REG_ARM_VFP | 31;", "VAR_4.addr = (uintptr_t)(&v);", "VAR_2 = kvm_vcpu_ioctl(VAR_0, KVM_GET_ONE_REG, &VAR_4);", "if (VAR_2 == -ENOENT) {", "return -EINVAL;", "}", "VAR_5.n = 0;", "VAR_2 = kvm_vcpu_ioctl(VAR_0, KVM_GET_REG_LIST, &VAR_5);", "if (VAR_2 != -E2BIG) {", "return VAR_2;", "}", "VAR_6 = g_malloc(sizeof(struct kvm_reg_list) + VAR_5.n * sizeof(uint64_t));", "VAR_6->n = VAR_5.n;", "VAR_2 = kvm_vcpu_ioctl(VAR_0, KVM_GET_REG_LIST, VAR_6);", "if (VAR_2) {", "goto out;", "}", "qsort(&VAR_6->reg, VAR_6->n, sizeof(VAR_6->reg[0]), compare_u64);", "for (VAR_1 = 0, VAR_3 = 0; VAR_1 < VAR_6->n; VAR_1++) {", "if (!reg_syncs_via_tuple_list(VAR_6->reg[VAR_1])) {", "continue;", "}", "switch (VAR_6->reg[VAR_1] & KVM_REG_SIZE_MASK) {", "case KVM_REG_SIZE_U32:\ncase KVM_REG_SIZE_U64:\nbreak;", "default:\nfprintf(stderr, \"Can't handle size of register in kernel list\\n\");", "VAR_2 = -EINVAL;", "goto out;", "}", "VAR_3++;", "}", "cpu->cpreg_indexes = g_renew(uint64_t, cpu->cpreg_indexes, VAR_3);", "cpu->cpreg_values = g_renew(uint64_t, cpu->cpreg_values, VAR_3);", "cpu->cpreg_vmstate_indexes = g_renew(uint64_t, cpu->cpreg_vmstate_indexes,\nVAR_3);", "cpu->cpreg_vmstate_values = g_renew(uint64_t, cpu->cpreg_vmstate_values,\nVAR_3);", "cpu->cpreg_array_len = VAR_3;", "cpu->cpreg_vmstate_array_len = VAR_3;", "for (VAR_1 = 0, VAR_3 = 0; VAR_1 < VAR_6->n; VAR_1++) {", "uint64_t regidx = VAR_6->reg[VAR_1];", "if (!reg_syncs_via_tuple_list(regidx)) {", "continue;", "}", "cpu->cpreg_indexes[VAR_3] = regidx;", "VAR_3++;", "}", "assert(cpu->cpreg_array_len == VAR_3);", "if (!write_kvmstate_to_list(cpu)) {", "fprintf(stderr, \"Initial read of kernel register state failed\\n\");", "VAR_2 = -EINVAL;", "goto out;", "}", "cpu->cpreg_reset_values = g_memdup(cpu->cpreg_values,\ncpu->cpreg_array_len *\nsizeof(cpu->cpreg_values[0]));", "out:\ng_free(VAR_6);", "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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 119 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133, 135, 137 ], [ 139, 141 ], [ 143 ], [ 145 ], [ 147 ], [ 151 ], [ 153 ], [ 157 ], [ 159 ], [ 161, 163 ], [ 165, 167 ], [ 169 ], [ 171 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 195 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ], [ 219, 221, 223 ], [ 227, 229 ], [ 231 ], [ 233 ] ]
14,709
static int cpu_ppc_handle_mmu_fault(CPUPPCState *env, target_ulong address, int rw, int mmu_idx) { CPUState *cs = CPU(ppc_env_get_cpu(env)); PowerPCCPU *cpu = POWERPC_CPU(cs); mmu_ctx_t ctx; int access_type; int ret = 0; if (rw == 2) { /* code access */ rw = 0; access_type = ACCESS_CODE; } else { /* data access */ access_type = env->access_type; } ret = get_physical_address(env, &ctx, address, rw, access_type); if (ret == 0) { tlb_set_page(cs, address & TARGET_PAGE_MASK, ctx.raddr & TARGET_PAGE_MASK, ctx.prot, mmu_idx, TARGET_PAGE_SIZE); ret = 0; } else if (ret < 0) { LOG_MMU_STATE(cs); if (access_type == ACCESS_CODE) { switch (ret) { case -1: /* No matches in page tables or TLB */ switch (env->mmu_model) { case POWERPC_MMU_SOFT_6xx: cs->exception_index = POWERPC_EXCP_IFTLB; env->error_code = 1 << 18; env->spr[SPR_IMISS] = address; env->spr[SPR_ICMP] = 0x80000000 | ctx.ptem; goto tlb_miss; case POWERPC_MMU_SOFT_74xx: cs->exception_index = POWERPC_EXCP_IFTLB; goto tlb_miss_74xx; case POWERPC_MMU_SOFT_4xx: case POWERPC_MMU_SOFT_4xx_Z: cs->exception_index = POWERPC_EXCP_ITLB; env->error_code = 0; env->spr[SPR_40x_DEAR] = address; env->spr[SPR_40x_ESR] = 0x00000000; break; case POWERPC_MMU_BOOKE206: booke206_update_mas_tlb_miss(env, address, rw); /* fall through */ case POWERPC_MMU_BOOKE: cs->exception_index = POWERPC_EXCP_ITLB; env->error_code = 0; env->spr[SPR_BOOKE_DEAR] = address; return -1; case POWERPC_MMU_MPC8xx: /* XXX: TODO */ cpu_abort(cs, "MPC8xx MMU model is not implemented\n"); break; case POWERPC_MMU_REAL: cpu_abort(cs, "PowerPC in real mode should never raise " "any MMU exceptions\n"); return -1; default: cpu_abort(cs, "Unknown or invalid MMU model\n"); return -1; } break; case -2: /* Access rights violation */ cs->exception_index = POWERPC_EXCP_ISI; env->error_code = 0x08000000; break; case -3: /* No execute protection violation */ if ((env->mmu_model == POWERPC_MMU_BOOKE) || (env->mmu_model == POWERPC_MMU_BOOKE206)) { env->spr[SPR_BOOKE_ESR] = 0x00000000; } cs->exception_index = POWERPC_EXCP_ISI; env->error_code = 0x10000000; break; case -4: /* Direct store exception */ /* No code fetch is allowed in direct-store areas */ cs->exception_index = POWERPC_EXCP_ISI; env->error_code = 0x10000000; break; } } else { switch (ret) { case -1: /* No matches in page tables or TLB */ switch (env->mmu_model) { case POWERPC_MMU_SOFT_6xx: if (rw == 1) { cs->exception_index = POWERPC_EXCP_DSTLB; env->error_code = 1 << 16; } else { cs->exception_index = POWERPC_EXCP_DLTLB; env->error_code = 0; } env->spr[SPR_DMISS] = address; env->spr[SPR_DCMP] = 0x80000000 | ctx.ptem; tlb_miss: env->error_code |= ctx.key << 19; env->spr[SPR_HASH1] = env->htab_base + get_pteg_offset32(cpu, ctx.hash[0]); env->spr[SPR_HASH2] = env->htab_base + get_pteg_offset32(cpu, ctx.hash[1]); break; case POWERPC_MMU_SOFT_74xx: if (rw == 1) { cs->exception_index = POWERPC_EXCP_DSTLB; } else { cs->exception_index = POWERPC_EXCP_DLTLB; } tlb_miss_74xx: /* Implement LRU algorithm */ env->error_code = ctx.key << 19; env->spr[SPR_TLBMISS] = (address & ~((target_ulong)0x3)) | ((env->last_way + 1) & (env->nb_ways - 1)); env->spr[SPR_PTEHI] = 0x80000000 | ctx.ptem; break; case POWERPC_MMU_SOFT_4xx: case POWERPC_MMU_SOFT_4xx_Z: cs->exception_index = POWERPC_EXCP_DTLB; env->error_code = 0; env->spr[SPR_40x_DEAR] = address; if (rw) { env->spr[SPR_40x_ESR] = 0x00800000; } else { env->spr[SPR_40x_ESR] = 0x00000000; } break; case POWERPC_MMU_MPC8xx: /* XXX: TODO */ cpu_abort(cs, "MPC8xx MMU model is not implemented\n"); break; case POWERPC_MMU_BOOKE206: booke206_update_mas_tlb_miss(env, address, rw); /* fall through */ case POWERPC_MMU_BOOKE: cs->exception_index = POWERPC_EXCP_DTLB; env->error_code = 0; env->spr[SPR_BOOKE_DEAR] = address; env->spr[SPR_BOOKE_ESR] = rw ? ESR_ST : 0; return -1; case POWERPC_MMU_REAL: cpu_abort(cs, "PowerPC in real mode should never raise " "any MMU exceptions\n"); return -1; default: cpu_abort(cs, "Unknown or invalid MMU model\n"); return -1; } break; case -2: /* Access rights violation */ cs->exception_index = POWERPC_EXCP_DSI; env->error_code = 0; if (env->mmu_model == POWERPC_MMU_SOFT_4xx || env->mmu_model == POWERPC_MMU_SOFT_4xx_Z) { env->spr[SPR_40x_DEAR] = address; if (rw) { env->spr[SPR_40x_ESR] |= 0x00800000; } } else if ((env->mmu_model == POWERPC_MMU_BOOKE) || (env->mmu_model == POWERPC_MMU_BOOKE206)) { env->spr[SPR_BOOKE_DEAR] = address; env->spr[SPR_BOOKE_ESR] = rw ? ESR_ST : 0; } else { env->spr[SPR_DAR] = address; if (rw == 1) { env->spr[SPR_DSISR] = 0x0A000000; } else { env->spr[SPR_DSISR] = 0x08000000; } } break; case -4: /* Direct store exception */ switch (access_type) { case ACCESS_FLOAT: /* Floating point load/store */ cs->exception_index = POWERPC_EXCP_ALIGN; env->error_code = POWERPC_EXCP_ALIGN_FP; env->spr[SPR_DAR] = address; break; case ACCESS_RES: /* lwarx, ldarx or stwcx. */ cs->exception_index = POWERPC_EXCP_DSI; env->error_code = 0; env->spr[SPR_DAR] = address; if (rw == 1) { env->spr[SPR_DSISR] = 0x06000000; } else { env->spr[SPR_DSISR] = 0x04000000; } break; case ACCESS_EXT: /* eciwx or ecowx */ cs->exception_index = POWERPC_EXCP_DSI; env->error_code = 0; env->spr[SPR_DAR] = address; if (rw == 1) { env->spr[SPR_DSISR] = 0x06100000; } else { env->spr[SPR_DSISR] = 0x04100000; } break; default: printf("DSI: invalid exception (%d)\n", ret); cs->exception_index = POWERPC_EXCP_PROGRAM; env->error_code = POWERPC_EXCP_INVAL | POWERPC_EXCP_INVAL_INVAL; env->spr[SPR_DAR] = address; break; } break; } } #if 0 printf("%s: set exception to %d %02x\n", __func__, cs->exception, env->error_code); #endif ret = 1; } return ret; }
false
qemu
36778660d7fd0748a6129916e47ecedd67bdb758
static int cpu_ppc_handle_mmu_fault(CPUPPCState *env, target_ulong address, int rw, int mmu_idx) { CPUState *cs = CPU(ppc_env_get_cpu(env)); PowerPCCPU *cpu = POWERPC_CPU(cs); mmu_ctx_t ctx; int access_type; int ret = 0; if (rw == 2) { rw = 0; access_type = ACCESS_CODE; } else { access_type = env->access_type; } ret = get_physical_address(env, &ctx, address, rw, access_type); if (ret == 0) { tlb_set_page(cs, address & TARGET_PAGE_MASK, ctx.raddr & TARGET_PAGE_MASK, ctx.prot, mmu_idx, TARGET_PAGE_SIZE); ret = 0; } else if (ret < 0) { LOG_MMU_STATE(cs); if (access_type == ACCESS_CODE) { switch (ret) { case -1: switch (env->mmu_model) { case POWERPC_MMU_SOFT_6xx: cs->exception_index = POWERPC_EXCP_IFTLB; env->error_code = 1 << 18; env->spr[SPR_IMISS] = address; env->spr[SPR_ICMP] = 0x80000000 | ctx.ptem; goto tlb_miss; case POWERPC_MMU_SOFT_74xx: cs->exception_index = POWERPC_EXCP_IFTLB; goto tlb_miss_74xx; case POWERPC_MMU_SOFT_4xx: case POWERPC_MMU_SOFT_4xx_Z: cs->exception_index = POWERPC_EXCP_ITLB; env->error_code = 0; env->spr[SPR_40x_DEAR] = address; env->spr[SPR_40x_ESR] = 0x00000000; break; case POWERPC_MMU_BOOKE206: booke206_update_mas_tlb_miss(env, address, rw); case POWERPC_MMU_BOOKE: cs->exception_index = POWERPC_EXCP_ITLB; env->error_code = 0; env->spr[SPR_BOOKE_DEAR] = address; return -1; case POWERPC_MMU_MPC8xx: cpu_abort(cs, "MPC8xx MMU model is not implemented\n"); break; case POWERPC_MMU_REAL: cpu_abort(cs, "PowerPC in real mode should never raise " "any MMU exceptions\n"); return -1; default: cpu_abort(cs, "Unknown or invalid MMU model\n"); return -1; } break; case -2: cs->exception_index = POWERPC_EXCP_ISI; env->error_code = 0x08000000; break; case -3: if ((env->mmu_model == POWERPC_MMU_BOOKE) || (env->mmu_model == POWERPC_MMU_BOOKE206)) { env->spr[SPR_BOOKE_ESR] = 0x00000000; } cs->exception_index = POWERPC_EXCP_ISI; env->error_code = 0x10000000; break; case -4: cs->exception_index = POWERPC_EXCP_ISI; env->error_code = 0x10000000; break; } } else { switch (ret) { case -1: switch (env->mmu_model) { case POWERPC_MMU_SOFT_6xx: if (rw == 1) { cs->exception_index = POWERPC_EXCP_DSTLB; env->error_code = 1 << 16; } else { cs->exception_index = POWERPC_EXCP_DLTLB; env->error_code = 0; } env->spr[SPR_DMISS] = address; env->spr[SPR_DCMP] = 0x80000000 | ctx.ptem; tlb_miss: env->error_code |= ctx.key << 19; env->spr[SPR_HASH1] = env->htab_base + get_pteg_offset32(cpu, ctx.hash[0]); env->spr[SPR_HASH2] = env->htab_base + get_pteg_offset32(cpu, ctx.hash[1]); break; case POWERPC_MMU_SOFT_74xx: if (rw == 1) { cs->exception_index = POWERPC_EXCP_DSTLB; } else { cs->exception_index = POWERPC_EXCP_DLTLB; } tlb_miss_74xx: env->error_code = ctx.key << 19; env->spr[SPR_TLBMISS] = (address & ~((target_ulong)0x3)) | ((env->last_way + 1) & (env->nb_ways - 1)); env->spr[SPR_PTEHI] = 0x80000000 | ctx.ptem; break; case POWERPC_MMU_SOFT_4xx: case POWERPC_MMU_SOFT_4xx_Z: cs->exception_index = POWERPC_EXCP_DTLB; env->error_code = 0; env->spr[SPR_40x_DEAR] = address; if (rw) { env->spr[SPR_40x_ESR] = 0x00800000; } else { env->spr[SPR_40x_ESR] = 0x00000000; } break; case POWERPC_MMU_MPC8xx: cpu_abort(cs, "MPC8xx MMU model is not implemented\n"); break; case POWERPC_MMU_BOOKE206: booke206_update_mas_tlb_miss(env, address, rw); case POWERPC_MMU_BOOKE: cs->exception_index = POWERPC_EXCP_DTLB; env->error_code = 0; env->spr[SPR_BOOKE_DEAR] = address; env->spr[SPR_BOOKE_ESR] = rw ? ESR_ST : 0; return -1; case POWERPC_MMU_REAL: cpu_abort(cs, "PowerPC in real mode should never raise " "any MMU exceptions\n"); return -1; default: cpu_abort(cs, "Unknown or invalid MMU model\n"); return -1; } break; case -2: cs->exception_index = POWERPC_EXCP_DSI; env->error_code = 0; if (env->mmu_model == POWERPC_MMU_SOFT_4xx || env->mmu_model == POWERPC_MMU_SOFT_4xx_Z) { env->spr[SPR_40x_DEAR] = address; if (rw) { env->spr[SPR_40x_ESR] |= 0x00800000; } } else if ((env->mmu_model == POWERPC_MMU_BOOKE) || (env->mmu_model == POWERPC_MMU_BOOKE206)) { env->spr[SPR_BOOKE_DEAR] = address; env->spr[SPR_BOOKE_ESR] = rw ? ESR_ST : 0; } else { env->spr[SPR_DAR] = address; if (rw == 1) { env->spr[SPR_DSISR] = 0x0A000000; } else { env->spr[SPR_DSISR] = 0x08000000; } } break; case -4: switch (access_type) { case ACCESS_FLOAT: cs->exception_index = POWERPC_EXCP_ALIGN; env->error_code = POWERPC_EXCP_ALIGN_FP; env->spr[SPR_DAR] = address; break; case ACCESS_RES: cs->exception_index = POWERPC_EXCP_DSI; env->error_code = 0; env->spr[SPR_DAR] = address; if (rw == 1) { env->spr[SPR_DSISR] = 0x06000000; } else { env->spr[SPR_DSISR] = 0x04000000; } break; case ACCESS_EXT: cs->exception_index = POWERPC_EXCP_DSI; env->error_code = 0; env->spr[SPR_DAR] = address; if (rw == 1) { env->spr[SPR_DSISR] = 0x06100000; } else { env->spr[SPR_DSISR] = 0x04100000; } break; default: printf("DSI: invalid exception (%d)\n", ret); cs->exception_index = POWERPC_EXCP_PROGRAM; env->error_code = POWERPC_EXCP_INVAL | POWERPC_EXCP_INVAL_INVAL; env->spr[SPR_DAR] = address; break; } break; } } #if 0 printf("%s: set exception to %d %02x\n", __func__, cs->exception, env->error_code); #endif ret = 1; } return ret; }
{ "code": [], "line_no": [] }
static int FUNC_0(CPUPPCState *VAR_0, target_ulong VAR_1, int VAR_2, int VAR_3) { CPUState *cs = CPU(ppc_env_get_cpu(VAR_0)); PowerPCCPU *cpu = POWERPC_CPU(cs); mmu_ctx_t ctx; int VAR_4; int VAR_5 = 0; if (VAR_2 == 2) { VAR_2 = 0; VAR_4 = ACCESS_CODE; } else { VAR_4 = VAR_0->VAR_4; } VAR_5 = get_physical_address(VAR_0, &ctx, VAR_1, VAR_2, VAR_4); if (VAR_5 == 0) { tlb_set_page(cs, VAR_1 & TARGET_PAGE_MASK, ctx.raddr & TARGET_PAGE_MASK, ctx.prot, VAR_3, TARGET_PAGE_SIZE); VAR_5 = 0; } else if (VAR_5 < 0) { LOG_MMU_STATE(cs); if (VAR_4 == ACCESS_CODE) { switch (VAR_5) { case -1: switch (VAR_0->mmu_model) { case POWERPC_MMU_SOFT_6xx: cs->exception_index = POWERPC_EXCP_IFTLB; VAR_0->error_code = 1 << 18; VAR_0->spr[SPR_IMISS] = VAR_1; VAR_0->spr[SPR_ICMP] = 0x80000000 | ctx.ptem; goto tlb_miss; case POWERPC_MMU_SOFT_74xx: cs->exception_index = POWERPC_EXCP_IFTLB; goto tlb_miss_74xx; case POWERPC_MMU_SOFT_4xx: case POWERPC_MMU_SOFT_4xx_Z: cs->exception_index = POWERPC_EXCP_ITLB; VAR_0->error_code = 0; VAR_0->spr[SPR_40x_DEAR] = VAR_1; VAR_0->spr[SPR_40x_ESR] = 0x00000000; break; case POWERPC_MMU_BOOKE206: booke206_update_mas_tlb_miss(VAR_0, VAR_1, VAR_2); case POWERPC_MMU_BOOKE: cs->exception_index = POWERPC_EXCP_ITLB; VAR_0->error_code = 0; VAR_0->spr[SPR_BOOKE_DEAR] = VAR_1; return -1; case POWERPC_MMU_MPC8xx: cpu_abort(cs, "MPC8xx MMU model is not implemented\n"); break; case POWERPC_MMU_REAL: cpu_abort(cs, "PowerPC in real mode should never raise " "any MMU exceptions\n"); return -1; default: cpu_abort(cs, "Unknown or invalid MMU model\n"); return -1; } break; case -2: cs->exception_index = POWERPC_EXCP_ISI; VAR_0->error_code = 0x08000000; break; case -3: if ((VAR_0->mmu_model == POWERPC_MMU_BOOKE) || (VAR_0->mmu_model == POWERPC_MMU_BOOKE206)) { VAR_0->spr[SPR_BOOKE_ESR] = 0x00000000; } cs->exception_index = POWERPC_EXCP_ISI; VAR_0->error_code = 0x10000000; break; case -4: cs->exception_index = POWERPC_EXCP_ISI; VAR_0->error_code = 0x10000000; break; } } else { switch (VAR_5) { case -1: switch (VAR_0->mmu_model) { case POWERPC_MMU_SOFT_6xx: if (VAR_2 == 1) { cs->exception_index = POWERPC_EXCP_DSTLB; VAR_0->error_code = 1 << 16; } else { cs->exception_index = POWERPC_EXCP_DLTLB; VAR_0->error_code = 0; } VAR_0->spr[SPR_DMISS] = VAR_1; VAR_0->spr[SPR_DCMP] = 0x80000000 | ctx.ptem; tlb_miss: VAR_0->error_code |= ctx.key << 19; VAR_0->spr[SPR_HASH1] = VAR_0->htab_base + get_pteg_offset32(cpu, ctx.hash[0]); VAR_0->spr[SPR_HASH2] = VAR_0->htab_base + get_pteg_offset32(cpu, ctx.hash[1]); break; case POWERPC_MMU_SOFT_74xx: if (VAR_2 == 1) { cs->exception_index = POWERPC_EXCP_DSTLB; } else { cs->exception_index = POWERPC_EXCP_DLTLB; } tlb_miss_74xx: VAR_0->error_code = ctx.key << 19; VAR_0->spr[SPR_TLBMISS] = (VAR_1 & ~((target_ulong)0x3)) | ((VAR_0->last_way + 1) & (VAR_0->nb_ways - 1)); VAR_0->spr[SPR_PTEHI] = 0x80000000 | ctx.ptem; break; case POWERPC_MMU_SOFT_4xx: case POWERPC_MMU_SOFT_4xx_Z: cs->exception_index = POWERPC_EXCP_DTLB; VAR_0->error_code = 0; VAR_0->spr[SPR_40x_DEAR] = VAR_1; if (VAR_2) { VAR_0->spr[SPR_40x_ESR] = 0x00800000; } else { VAR_0->spr[SPR_40x_ESR] = 0x00000000; } break; case POWERPC_MMU_MPC8xx: cpu_abort(cs, "MPC8xx MMU model is not implemented\n"); break; case POWERPC_MMU_BOOKE206: booke206_update_mas_tlb_miss(VAR_0, VAR_1, VAR_2); case POWERPC_MMU_BOOKE: cs->exception_index = POWERPC_EXCP_DTLB; VAR_0->error_code = 0; VAR_0->spr[SPR_BOOKE_DEAR] = VAR_1; VAR_0->spr[SPR_BOOKE_ESR] = VAR_2 ? ESR_ST : 0; return -1; case POWERPC_MMU_REAL: cpu_abort(cs, "PowerPC in real mode should never raise " "any MMU exceptions\n"); return -1; default: cpu_abort(cs, "Unknown or invalid MMU model\n"); return -1; } break; case -2: cs->exception_index = POWERPC_EXCP_DSI; VAR_0->error_code = 0; if (VAR_0->mmu_model == POWERPC_MMU_SOFT_4xx || VAR_0->mmu_model == POWERPC_MMU_SOFT_4xx_Z) { VAR_0->spr[SPR_40x_DEAR] = VAR_1; if (VAR_2) { VAR_0->spr[SPR_40x_ESR] |= 0x00800000; } } else if ((VAR_0->mmu_model == POWERPC_MMU_BOOKE) || (VAR_0->mmu_model == POWERPC_MMU_BOOKE206)) { VAR_0->spr[SPR_BOOKE_DEAR] = VAR_1; VAR_0->spr[SPR_BOOKE_ESR] = VAR_2 ? ESR_ST : 0; } else { VAR_0->spr[SPR_DAR] = VAR_1; if (VAR_2 == 1) { VAR_0->spr[SPR_DSISR] = 0x0A000000; } else { VAR_0->spr[SPR_DSISR] = 0x08000000; } } break; case -4: switch (VAR_4) { case ACCESS_FLOAT: cs->exception_index = POWERPC_EXCP_ALIGN; VAR_0->error_code = POWERPC_EXCP_ALIGN_FP; VAR_0->spr[SPR_DAR] = VAR_1; break; case ACCESS_RES: cs->exception_index = POWERPC_EXCP_DSI; VAR_0->error_code = 0; VAR_0->spr[SPR_DAR] = VAR_1; if (VAR_2 == 1) { VAR_0->spr[SPR_DSISR] = 0x06000000; } else { VAR_0->spr[SPR_DSISR] = 0x04000000; } break; case ACCESS_EXT: cs->exception_index = POWERPC_EXCP_DSI; VAR_0->error_code = 0; VAR_0->spr[SPR_DAR] = VAR_1; if (VAR_2 == 1) { VAR_0->spr[SPR_DSISR] = 0x06100000; } else { VAR_0->spr[SPR_DSISR] = 0x04100000; } break; default: printf("DSI: invalid exception (%d)\n", VAR_5); cs->exception_index = POWERPC_EXCP_PROGRAM; VAR_0->error_code = POWERPC_EXCP_INVAL | POWERPC_EXCP_INVAL_INVAL; VAR_0->spr[SPR_DAR] = VAR_1; break; } break; } } #if 0 printf("%s: set exception to %d %02x\n", __func__, cs->exception, VAR_0->error_code); #endif VAR_5 = 1; } return VAR_5; }
[ "static int FUNC_0(CPUPPCState *VAR_0, target_ulong VAR_1,\nint VAR_2, int VAR_3)\n{", "CPUState *cs = CPU(ppc_env_get_cpu(VAR_0));", "PowerPCCPU *cpu = POWERPC_CPU(cs);", "mmu_ctx_t ctx;", "int VAR_4;", "int VAR_5 = 0;", "if (VAR_2 == 2) {", "VAR_2 = 0;", "VAR_4 = ACCESS_CODE;", "} else {", "VAR_4 = VAR_0->VAR_4;", "}", "VAR_5 = get_physical_address(VAR_0, &ctx, VAR_1, VAR_2, VAR_4);", "if (VAR_5 == 0) {", "tlb_set_page(cs, VAR_1 & TARGET_PAGE_MASK,\nctx.raddr & TARGET_PAGE_MASK, ctx.prot,\nVAR_3, TARGET_PAGE_SIZE);", "VAR_5 = 0;", "} else if (VAR_5 < 0) {", "LOG_MMU_STATE(cs);", "if (VAR_4 == ACCESS_CODE) {", "switch (VAR_5) {", "case -1:\nswitch (VAR_0->mmu_model) {", "case POWERPC_MMU_SOFT_6xx:\ncs->exception_index = POWERPC_EXCP_IFTLB;", "VAR_0->error_code = 1 << 18;", "VAR_0->spr[SPR_IMISS] = VAR_1;", "VAR_0->spr[SPR_ICMP] = 0x80000000 | ctx.ptem;", "goto tlb_miss;", "case POWERPC_MMU_SOFT_74xx:\ncs->exception_index = POWERPC_EXCP_IFTLB;", "goto tlb_miss_74xx;", "case POWERPC_MMU_SOFT_4xx:\ncase POWERPC_MMU_SOFT_4xx_Z:\ncs->exception_index = POWERPC_EXCP_ITLB;", "VAR_0->error_code = 0;", "VAR_0->spr[SPR_40x_DEAR] = VAR_1;", "VAR_0->spr[SPR_40x_ESR] = 0x00000000;", "break;", "case POWERPC_MMU_BOOKE206:\nbooke206_update_mas_tlb_miss(VAR_0, VAR_1, VAR_2);", "case POWERPC_MMU_BOOKE:\ncs->exception_index = POWERPC_EXCP_ITLB;", "VAR_0->error_code = 0;", "VAR_0->spr[SPR_BOOKE_DEAR] = VAR_1;", "return -1;", "case POWERPC_MMU_MPC8xx:\ncpu_abort(cs, \"MPC8xx MMU model is not implemented\\n\");", "break;", "case POWERPC_MMU_REAL:\ncpu_abort(cs, \"PowerPC in real mode should never raise \"\n\"any MMU exceptions\\n\");", "return -1;", "default:\ncpu_abort(cs, \"Unknown or invalid MMU model\\n\");", "return -1;", "}", "break;", "case -2:\ncs->exception_index = POWERPC_EXCP_ISI;", "VAR_0->error_code = 0x08000000;", "break;", "case -3:\nif ((VAR_0->mmu_model == POWERPC_MMU_BOOKE) ||\n(VAR_0->mmu_model == POWERPC_MMU_BOOKE206)) {", "VAR_0->spr[SPR_BOOKE_ESR] = 0x00000000;", "}", "cs->exception_index = POWERPC_EXCP_ISI;", "VAR_0->error_code = 0x10000000;", "break;", "case -4:\ncs->exception_index = POWERPC_EXCP_ISI;", "VAR_0->error_code = 0x10000000;", "break;", "}", "} else {", "switch (VAR_5) {", "case -1:\nswitch (VAR_0->mmu_model) {", "case POWERPC_MMU_SOFT_6xx:\nif (VAR_2 == 1) {", "cs->exception_index = POWERPC_EXCP_DSTLB;", "VAR_0->error_code = 1 << 16;", "} else {", "cs->exception_index = POWERPC_EXCP_DLTLB;", "VAR_0->error_code = 0;", "}", "VAR_0->spr[SPR_DMISS] = VAR_1;", "VAR_0->spr[SPR_DCMP] = 0x80000000 | ctx.ptem;", "tlb_miss:\nVAR_0->error_code |= ctx.key << 19;", "VAR_0->spr[SPR_HASH1] = VAR_0->htab_base +\nget_pteg_offset32(cpu, ctx.hash[0]);", "VAR_0->spr[SPR_HASH2] = VAR_0->htab_base +\nget_pteg_offset32(cpu, ctx.hash[1]);", "break;", "case POWERPC_MMU_SOFT_74xx:\nif (VAR_2 == 1) {", "cs->exception_index = POWERPC_EXCP_DSTLB;", "} else {", "cs->exception_index = POWERPC_EXCP_DLTLB;", "}", "tlb_miss_74xx:\nVAR_0->error_code = ctx.key << 19;", "VAR_0->spr[SPR_TLBMISS] = (VAR_1 & ~((target_ulong)0x3)) |\n((VAR_0->last_way + 1) & (VAR_0->nb_ways - 1));", "VAR_0->spr[SPR_PTEHI] = 0x80000000 | ctx.ptem;", "break;", "case POWERPC_MMU_SOFT_4xx:\ncase POWERPC_MMU_SOFT_4xx_Z:\ncs->exception_index = POWERPC_EXCP_DTLB;", "VAR_0->error_code = 0;", "VAR_0->spr[SPR_40x_DEAR] = VAR_1;", "if (VAR_2) {", "VAR_0->spr[SPR_40x_ESR] = 0x00800000;", "} else {", "VAR_0->spr[SPR_40x_ESR] = 0x00000000;", "}", "break;", "case POWERPC_MMU_MPC8xx:\ncpu_abort(cs, \"MPC8xx MMU model is not implemented\\n\");", "break;", "case POWERPC_MMU_BOOKE206:\nbooke206_update_mas_tlb_miss(VAR_0, VAR_1, VAR_2);", "case POWERPC_MMU_BOOKE:\ncs->exception_index = POWERPC_EXCP_DTLB;", "VAR_0->error_code = 0;", "VAR_0->spr[SPR_BOOKE_DEAR] = VAR_1;", "VAR_0->spr[SPR_BOOKE_ESR] = VAR_2 ? ESR_ST : 0;", "return -1;", "case POWERPC_MMU_REAL:\ncpu_abort(cs, \"PowerPC in real mode should never raise \"\n\"any MMU exceptions\\n\");", "return -1;", "default:\ncpu_abort(cs, \"Unknown or invalid MMU model\\n\");", "return -1;", "}", "break;", "case -2:\ncs->exception_index = POWERPC_EXCP_DSI;", "VAR_0->error_code = 0;", "if (VAR_0->mmu_model == POWERPC_MMU_SOFT_4xx\n|| VAR_0->mmu_model == POWERPC_MMU_SOFT_4xx_Z) {", "VAR_0->spr[SPR_40x_DEAR] = VAR_1;", "if (VAR_2) {", "VAR_0->spr[SPR_40x_ESR] |= 0x00800000;", "}", "} else if ((VAR_0->mmu_model == POWERPC_MMU_BOOKE) ||", "(VAR_0->mmu_model == POWERPC_MMU_BOOKE206)) {", "VAR_0->spr[SPR_BOOKE_DEAR] = VAR_1;", "VAR_0->spr[SPR_BOOKE_ESR] = VAR_2 ? ESR_ST : 0;", "} else {", "VAR_0->spr[SPR_DAR] = VAR_1;", "if (VAR_2 == 1) {", "VAR_0->spr[SPR_DSISR] = 0x0A000000;", "} else {", "VAR_0->spr[SPR_DSISR] = 0x08000000;", "}", "}", "break;", "case -4:\nswitch (VAR_4) {", "case ACCESS_FLOAT:\ncs->exception_index = POWERPC_EXCP_ALIGN;", "VAR_0->error_code = POWERPC_EXCP_ALIGN_FP;", "VAR_0->spr[SPR_DAR] = VAR_1;", "break;", "case ACCESS_RES:\ncs->exception_index = POWERPC_EXCP_DSI;", "VAR_0->error_code = 0;", "VAR_0->spr[SPR_DAR] = VAR_1;", "if (VAR_2 == 1) {", "VAR_0->spr[SPR_DSISR] = 0x06000000;", "} else {", "VAR_0->spr[SPR_DSISR] = 0x04000000;", "}", "break;", "case ACCESS_EXT:\ncs->exception_index = POWERPC_EXCP_DSI;", "VAR_0->error_code = 0;", "VAR_0->spr[SPR_DAR] = VAR_1;", "if (VAR_2 == 1) {", "VAR_0->spr[SPR_DSISR] = 0x06100000;", "} else {", "VAR_0->spr[SPR_DSISR] = 0x04100000;", "}", "break;", "default:\nprintf(\"DSI: invalid exception (%d)\\n\", VAR_5);", "cs->exception_index = POWERPC_EXCP_PROGRAM;", "VAR_0->error_code =\nPOWERPC_EXCP_INVAL | POWERPC_EXCP_INVAL_INVAL;", "VAR_0->spr[SPR_DAR] = VAR_1;", "break;", "}", "break;", "}", "}", "#if 0\nprintf(\"%s: set exception to %d %02x\\n\", __func__,\ncs->exception, VAR_0->error_code);", "#endif\nVAR_5 = 1;", "}", "return VAR_5;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39, 41, 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55, 59 ], [ 61, 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73, 75 ], [ 77 ], [ 79, 81, 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93, 95 ], [ 99, 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109, 113 ], [ 115 ], [ 117, 119, 121 ], [ 123 ], [ 125, 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135, 139 ], [ 141 ], [ 143 ], [ 145, 149, 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163, 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181, 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, 237 ], [ 239, 241 ], [ 243 ], [ 245 ], [ 247, 249, 251 ], [ 253 ], [ 255 ], [ 257 ], [ 259 ], [ 261 ], [ 263 ], [ 265 ], [ 267 ], [ 269, 273 ], [ 275 ], [ 277, 279 ], [ 283, 285 ], [ 287 ], [ 289 ], [ 291 ], [ 293 ], [ 295, 297, 299 ], [ 301 ], [ 303, 305 ], [ 307 ], [ 309 ], [ 311 ], [ 313, 317 ], [ 319 ], [ 321, 323 ], [ 325 ], [ 327 ], [ 329 ], [ 331 ], [ 333 ], [ 335 ], [ 337 ], [ 339 ], [ 341 ], [ 343 ], [ 345 ], [ 347 ], [ 349 ], [ 351 ], [ 353 ], [ 355 ], [ 357 ], [ 359, 363 ], [ 365, 369 ], [ 371 ], [ 373 ], [ 375 ], [ 377, 381 ], [ 383 ], [ 385 ], [ 387 ], [ 389 ], [ 391 ], [ 393 ], [ 395 ], [ 397 ], [ 399, 403 ], [ 405 ], [ 407 ], [ 409 ], [ 411 ], [ 413 ], [ 415 ], [ 417 ], [ 419 ], [ 421, 423 ], [ 425 ], [ 427, 429 ], [ 431 ], [ 433 ], [ 435 ], [ 437 ], [ 439 ], [ 441 ], [ 443, 445, 447 ], [ 449, 451 ], [ 453 ], [ 457 ], [ 459 ] ]
14,710
START_TEST(qdict_get_try_str_test) { const char *p; const char *key = "key"; const char *str = "string"; qdict_put(tests_dict, key, qstring_from_str(str)); p = qdict_get_try_str(tests_dict, key); fail_unless(p != NULL); fail_unless(strcmp(p, str) == 0); }
false
qemu
ac531cb6e542b1e61d668604adf9dc5306a948c0
START_TEST(qdict_get_try_str_test) { const char *p; const char *key = "key"; const char *str = "string"; qdict_put(tests_dict, key, qstring_from_str(str)); p = qdict_get_try_str(tests_dict, key); fail_unless(p != NULL); fail_unless(strcmp(p, str) == 0); }
{ "code": [], "line_no": [] }
FUNC_0(VAR_0) { const char *VAR_1; const char *VAR_2 = "VAR_2"; const char *VAR_3 = "string"; qdict_put(tests_dict, VAR_2, qstring_from_str(VAR_3)); VAR_1 = qdict_get_try_str(tests_dict, VAR_2); fail_unless(VAR_1 != NULL); fail_unless(strcmp(VAR_1, VAR_3) == 0); }
[ "FUNC_0(VAR_0)\n{", "const char *VAR_1;", "const char *VAR_2 = \"VAR_2\";", "const char *VAR_3 = \"string\";", "qdict_put(tests_dict, VAR_2, qstring_from_str(VAR_3));", "VAR_1 = qdict_get_try_str(tests_dict, VAR_2);", "fail_unless(VAR_1 != NULL);", "fail_unless(strcmp(VAR_1, VAR_3) == 0);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ] ]
14,711
int swri_realloc_audio(AudioData *a, int count){ int i, countb; AudioData old; if(count < 0 || count > INT_MAX/2/a->bps/a->ch_count) return AVERROR(EINVAL); if(a->count >= count) return 0; count*=2; countb= FFALIGN(count*a->bps, ALIGN); old= *a; av_assert0(a->bps); av_assert0(a->ch_count); a->data= av_mallocz_array(countb, a->ch_count); if(!a->data) return AVERROR(ENOMEM); for(i=0; i<a->ch_count; i++){ a->ch[i]= a->data + i*(a->planar ? countb : a->bps); if(a->planar) memcpy(a->ch[i], old.ch[i], a->count*a->bps); } if(!a->planar) memcpy(a->ch[0], old.ch[0], a->count*a->ch_count*a->bps); av_freep(&old.data); a->count= count; return 1; }
false
FFmpeg
b3928a1cc65462a72fea538fcf082cbc8f373e37
int swri_realloc_audio(AudioData *a, int count){ int i, countb; AudioData old; if(count < 0 || count > INT_MAX/2/a->bps/a->ch_count) return AVERROR(EINVAL); if(a->count >= count) return 0; count*=2; countb= FFALIGN(count*a->bps, ALIGN); old= *a; av_assert0(a->bps); av_assert0(a->ch_count); a->data= av_mallocz_array(countb, a->ch_count); if(!a->data) return AVERROR(ENOMEM); for(i=0; i<a->ch_count; i++){ a->ch[i]= a->data + i*(a->planar ? countb : a->bps); if(a->planar) memcpy(a->ch[i], old.ch[i], a->count*a->bps); } if(!a->planar) memcpy(a->ch[0], old.ch[0], a->count*a->ch_count*a->bps); av_freep(&old.data); a->count= count; return 1; }
{ "code": [], "line_no": [] }
int FUNC_0(AudioData *VAR_0, int VAR_1){ int VAR_2, VAR_3; AudioData old; if(VAR_1 < 0 || VAR_1 > INT_MAX/2/VAR_0->bps/VAR_0->ch_count) return AVERROR(EINVAL); if(VAR_0->VAR_1 >= VAR_1) return 0; VAR_1*=2; VAR_3= FFALIGN(VAR_1*VAR_0->bps, ALIGN); old= *VAR_0; av_assert0(VAR_0->bps); av_assert0(VAR_0->ch_count); VAR_0->data= av_mallocz_array(VAR_3, VAR_0->ch_count); if(!VAR_0->data) return AVERROR(ENOMEM); for(VAR_2=0; VAR_2<VAR_0->ch_count; VAR_2++){ VAR_0->ch[VAR_2]= VAR_0->data + VAR_2*(VAR_0->planar ? VAR_3 : VAR_0->bps); if(VAR_0->planar) memcpy(VAR_0->ch[VAR_2], old.ch[VAR_2], VAR_0->VAR_1*VAR_0->bps); } if(!VAR_0->planar) memcpy(VAR_0->ch[0], old.ch[0], VAR_0->VAR_1*VAR_0->ch_count*VAR_0->bps); av_freep(&old.data); VAR_0->VAR_1= VAR_1; return 1; }
[ "int FUNC_0(AudioData *VAR_0, int VAR_1){", "int VAR_2, VAR_3;", "AudioData old;", "if(VAR_1 < 0 || VAR_1 > INT_MAX/2/VAR_0->bps/VAR_0->ch_count)\nreturn AVERROR(EINVAL);", "if(VAR_0->VAR_1 >= VAR_1)\nreturn 0;", "VAR_1*=2;", "VAR_3= FFALIGN(VAR_1*VAR_0->bps, ALIGN);", "old= *VAR_0;", "av_assert0(VAR_0->bps);", "av_assert0(VAR_0->ch_count);", "VAR_0->data= av_mallocz_array(VAR_3, VAR_0->ch_count);", "if(!VAR_0->data)\nreturn AVERROR(ENOMEM);", "for(VAR_2=0; VAR_2<VAR_0->ch_count; VAR_2++){", "VAR_0->ch[VAR_2]= VAR_0->data + VAR_2*(VAR_0->planar ? VAR_3 : VAR_0->bps);", "if(VAR_0->planar) memcpy(VAR_0->ch[VAR_2], old.ch[VAR_2], VAR_0->VAR_1*VAR_0->bps);", "}", "if(!VAR_0->planar) memcpy(VAR_0->ch[0], old.ch[0], VAR_0->VAR_1*VAR_0->ch_count*VAR_0->bps);", "av_freep(&old.data);", "VAR_0->VAR_1= VAR_1;", "return 1;", "}" ]
[ 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 ], [ 15, 17 ], [ 21 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 37 ], [ 39, 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 59 ], [ 61 ] ]
14,712
static void virtio_scsi_command_complete(SCSIRequest *r, uint32_t status, size_t resid) { VirtIOSCSIReq *req = r->hba_private; uint8_t sense[SCSI_SENSE_BUF_SIZE]; uint32_t sense_len; if (r->io_canceled) { return; } req->resp.cmd->response = VIRTIO_SCSI_S_OK; req->resp.cmd->status = status; if (req->resp.cmd->status == GOOD) { req->resp.cmd->resid = tswap32(resid); } else { req->resp.cmd->resid = 0; sense_len = scsi_req_get_sense(r, sense, sizeof(sense)); sense_len = MIN(sense_len, req->resp_size - sizeof(req->resp.cmd)); memcpy(req->resp.cmd->sense, sense, sense_len); req->resp.cmd->sense_len = tswap32(sense_len); } virtio_scsi_complete_cmd_req(req); }
false
qemu
3eff1f46f08a360a4ae9f834ce9fef4c45bf6f0f
static void virtio_scsi_command_complete(SCSIRequest *r, uint32_t status, size_t resid) { VirtIOSCSIReq *req = r->hba_private; uint8_t sense[SCSI_SENSE_BUF_SIZE]; uint32_t sense_len; if (r->io_canceled) { return; } req->resp.cmd->response = VIRTIO_SCSI_S_OK; req->resp.cmd->status = status; if (req->resp.cmd->status == GOOD) { req->resp.cmd->resid = tswap32(resid); } else { req->resp.cmd->resid = 0; sense_len = scsi_req_get_sense(r, sense, sizeof(sense)); sense_len = MIN(sense_len, req->resp_size - sizeof(req->resp.cmd)); memcpy(req->resp.cmd->sense, sense, sense_len); req->resp.cmd->sense_len = tswap32(sense_len); } virtio_scsi_complete_cmd_req(req); }
{ "code": [], "line_no": [] }
static void FUNC_0(SCSIRequest *VAR_0, uint32_t VAR_1, size_t VAR_2) { VirtIOSCSIReq *req = VAR_0->hba_private; uint8_t sense[SCSI_SENSE_BUF_SIZE]; uint32_t sense_len; if (VAR_0->io_canceled) { return; } req->resp.cmd->response = VIRTIO_SCSI_S_OK; req->resp.cmd->VAR_1 = VAR_1; if (req->resp.cmd->VAR_1 == GOOD) { req->resp.cmd->VAR_2 = tswap32(VAR_2); } else { req->resp.cmd->VAR_2 = 0; sense_len = scsi_req_get_sense(VAR_0, sense, sizeof(sense)); sense_len = MIN(sense_len, req->resp_size - sizeof(req->resp.cmd)); memcpy(req->resp.cmd->sense, sense, sense_len); req->resp.cmd->sense_len = tswap32(sense_len); } virtio_scsi_complete_cmd_req(req); }
[ "static void FUNC_0(SCSIRequest *VAR_0, uint32_t VAR_1,\nsize_t VAR_2)\n{", "VirtIOSCSIReq *req = VAR_0->hba_private;", "uint8_t sense[SCSI_SENSE_BUF_SIZE];", "uint32_t sense_len;", "if (VAR_0->io_canceled) {", "return;", "}", "req->resp.cmd->response = VIRTIO_SCSI_S_OK;", "req->resp.cmd->VAR_1 = VAR_1;", "if (req->resp.cmd->VAR_1 == GOOD) {", "req->resp.cmd->VAR_2 = tswap32(VAR_2);", "} else {", "req->resp.cmd->VAR_2 = 0;", "sense_len = scsi_req_get_sense(VAR_0, sense, sizeof(sense));", "sense_len = MIN(sense_len, req->resp_size - sizeof(req->resp.cmd));", "memcpy(req->resp.cmd->sense, sense, sense_len);", "req->resp.cmd->sense_len = tswap32(sense_len);", "}", "virtio_scsi_complete_cmd_req(req);", "}" ]
[ 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 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ] ]
14,714
static void bitband_writeb(void *opaque, target_phys_addr_t offset, uint32_t value) { uint32_t addr; uint8_t mask; uint8_t v; addr = bitband_addr(opaque, offset); mask = (1 << ((offset >> 2) & 7)); cpu_physical_memory_read(addr, &v, 1); if (value & 1) v |= mask; else v &= ~mask; cpu_physical_memory_write(addr, &v, 1); }
false
qemu
a8170e5e97ad17ca169c64ba87ae2f53850dab4c
static void bitband_writeb(void *opaque, target_phys_addr_t offset, uint32_t value) { uint32_t addr; uint8_t mask; uint8_t v; addr = bitband_addr(opaque, offset); mask = (1 << ((offset >> 2) & 7)); cpu_physical_memory_read(addr, &v, 1); if (value & 1) v |= mask; else v &= ~mask; cpu_physical_memory_write(addr, &v, 1); }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0, target_phys_addr_t VAR_1, uint32_t VAR_2) { uint32_t addr; uint8_t mask; uint8_t v; addr = bitband_addr(VAR_0, VAR_1); mask = (1 << ((VAR_1 >> 2) & 7)); cpu_physical_memory_read(addr, &v, 1); if (VAR_2 & 1) v |= mask; else v &= ~mask; cpu_physical_memory_write(addr, &v, 1); }
[ "static void FUNC_0(void *VAR_0, target_phys_addr_t VAR_1,\nuint32_t VAR_2)\n{", "uint32_t addr;", "uint8_t mask;", "uint8_t v;", "addr = bitband_addr(VAR_0, VAR_1);", "mask = (1 << ((VAR_1 >> 2) & 7));", "cpu_physical_memory_read(addr, &v, 1);", "if (VAR_2 & 1)\nv |= mask;", "else\nv &= ~mask;", "cpu_physical_memory_write(addr, &v, 1);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19, 21 ], [ 23, 25 ], [ 27 ], [ 29 ] ]
14,715
void bdrv_enable_copy_on_read(BlockDriverState *bs) { bs->copy_on_read++; }
false
qemu
61007b316cd71ee7333ff7a0a749a8949527575f
void bdrv_enable_copy_on_read(BlockDriverState *bs) { bs->copy_on_read++; }
{ "code": [], "line_no": [] }
void FUNC_0(BlockDriverState *VAR_0) { VAR_0->copy_on_read++; }
[ "void FUNC_0(BlockDriverState *VAR_0)\n{", "VAR_0->copy_on_read++;", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
14,717
static void s390_cpu_initfn(Object *obj) { CPUState *cs = CPU(obj); S390CPU *cpu = S390_CPU(obj); CPUS390XState *env = &cpu->env; static bool inited; static int cpu_num = 0; #if !defined(CONFIG_USER_ONLY) struct tm tm; #endif cs->env_ptr = env; cpu_exec_init(env); #if !defined(CONFIG_USER_ONLY) qemu_register_reset(s390_cpu_machine_reset_cb, cpu); qemu_get_timedate(&tm, 0); env->tod_offset = TOD_UNIX_EPOCH + (time2tod(mktimegm(&tm)) * 1000000000ULL); env->tod_basetime = 0; env->tod_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, s390x_tod_timer, cpu); env->cpu_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, s390x_cpu_timer, cpu); s390_cpu_set_state(CPU_STATE_STOPPED, cpu); #endif env->cpu_num = cpu_num++; env->ext_index = -1; if (tcg_enabled() && !inited) { inited = true; s390x_translate_init(); } }
false
qemu
7107e5a756317151666d47d1bc1e170293babaff
static void s390_cpu_initfn(Object *obj) { CPUState *cs = CPU(obj); S390CPU *cpu = S390_CPU(obj); CPUS390XState *env = &cpu->env; static bool inited; static int cpu_num = 0; #if !defined(CONFIG_USER_ONLY) struct tm tm; #endif cs->env_ptr = env; cpu_exec_init(env); #if !defined(CONFIG_USER_ONLY) qemu_register_reset(s390_cpu_machine_reset_cb, cpu); qemu_get_timedate(&tm, 0); env->tod_offset = TOD_UNIX_EPOCH + (time2tod(mktimegm(&tm)) * 1000000000ULL); env->tod_basetime = 0; env->tod_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, s390x_tod_timer, cpu); env->cpu_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, s390x_cpu_timer, cpu); s390_cpu_set_state(CPU_STATE_STOPPED, cpu); #endif env->cpu_num = cpu_num++; env->ext_index = -1; if (tcg_enabled() && !inited) { inited = true; s390x_translate_init(); } }
{ "code": [], "line_no": [] }
static void FUNC_0(Object *VAR_0) { CPUState *cs = CPU(VAR_0); S390CPU *cpu = S390_CPU(VAR_0); CPUS390XState *env = &cpu->env; static bool VAR_1; static int VAR_2 = 0; #if !defined(CONFIG_USER_ONLY) struct VAR_3 VAR_3; #endif cs->env_ptr = env; cpu_exec_init(env); #if !defined(CONFIG_USER_ONLY) qemu_register_reset(s390_cpu_machine_reset_cb, cpu); qemu_get_timedate(&VAR_3, 0); env->tod_offset = TOD_UNIX_EPOCH + (time2tod(mktimegm(&VAR_3)) * 1000000000ULL); env->tod_basetime = 0; env->tod_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, s390x_tod_timer, cpu); env->cpu_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, s390x_cpu_timer, cpu); s390_cpu_set_state(CPU_STATE_STOPPED, cpu); #endif env->VAR_2 = VAR_2++; env->ext_index = -1; if (tcg_enabled() && !VAR_1) { VAR_1 = true; s390x_translate_init(); } }
[ "static void FUNC_0(Object *VAR_0)\n{", "CPUState *cs = CPU(VAR_0);", "S390CPU *cpu = S390_CPU(VAR_0);", "CPUS390XState *env = &cpu->env;", "static bool VAR_1;", "static int VAR_2 = 0;", "#if !defined(CONFIG_USER_ONLY)\nstruct VAR_3 VAR_3;", "#endif\ncs->env_ptr = env;", "cpu_exec_init(env);", "#if !defined(CONFIG_USER_ONLY)\nqemu_register_reset(s390_cpu_machine_reset_cb, cpu);", "qemu_get_timedate(&VAR_3, 0);", "env->tod_offset = TOD_UNIX_EPOCH +\n(time2tod(mktimegm(&VAR_3)) * 1000000000ULL);", "env->tod_basetime = 0;", "env->tod_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, s390x_tod_timer, cpu);", "env->cpu_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, s390x_cpu_timer, cpu);", "s390_cpu_set_state(CPU_STATE_STOPPED, cpu);", "#endif\nenv->VAR_2 = VAR_2++;", "env->ext_index = -1;", "if (tcg_enabled() && !VAR_1) {", "VAR_1 = true;", "s390x_translate_init();", "}", "}" ]
[ 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 ], [ 33, 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45, 47 ], [ 49 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ] ]
14,718
static void t_gen_lsr(TCGv d, TCGv a, TCGv b) { TCGv t0, t_31; t0 = tcg_temp_new(TCG_TYPE_TL); t_31 = tcg_temp_new(TCG_TYPE_TL); tcg_gen_shr_tl(d, a, b); tcg_gen_movi_tl(t_31, 31); tcg_gen_sub_tl(t0, t_31, b); tcg_gen_sar_tl(t0, t0, t_31); tcg_gen_and_tl(t0, t0, d); tcg_gen_xor_tl(d, d, t0); tcg_temp_free(t0); tcg_temp_free(t_31); }
false
qemu
a7812ae412311d7d47f8aa85656faadac9d64b56
static void t_gen_lsr(TCGv d, TCGv a, TCGv b) { TCGv t0, t_31; t0 = tcg_temp_new(TCG_TYPE_TL); t_31 = tcg_temp_new(TCG_TYPE_TL); tcg_gen_shr_tl(d, a, b); tcg_gen_movi_tl(t_31, 31); tcg_gen_sub_tl(t0, t_31, b); tcg_gen_sar_tl(t0, t0, t_31); tcg_gen_and_tl(t0, t0, d); tcg_gen_xor_tl(d, d, t0); tcg_temp_free(t0); tcg_temp_free(t_31); }
{ "code": [], "line_no": [] }
static void FUNC_0(TCGv VAR_0, TCGv VAR_1, TCGv VAR_2) { TCGv t0, t_31; t0 = tcg_temp_new(TCG_TYPE_TL); t_31 = tcg_temp_new(TCG_TYPE_TL); tcg_gen_shr_tl(VAR_0, VAR_1, VAR_2); tcg_gen_movi_tl(t_31, 31); tcg_gen_sub_tl(t0, t_31, VAR_2); tcg_gen_sar_tl(t0, t0, t_31); tcg_gen_and_tl(t0, t0, VAR_0); tcg_gen_xor_tl(VAR_0, VAR_0, t0); tcg_temp_free(t0); tcg_temp_free(t_31); }
[ "static void FUNC_0(TCGv VAR_0, TCGv VAR_1, TCGv VAR_2)\n{", "TCGv t0, t_31;", "t0 = tcg_temp_new(TCG_TYPE_TL);", "t_31 = tcg_temp_new(TCG_TYPE_TL);", "tcg_gen_shr_tl(VAR_0, VAR_1, VAR_2);", "tcg_gen_movi_tl(t_31, 31);", "tcg_gen_sub_tl(t0, t_31, VAR_2);", "tcg_gen_sar_tl(t0, t0, t_31);", "tcg_gen_and_tl(t0, t0, VAR_0);", "tcg_gen_xor_tl(VAR_0, VAR_0, t0);", "tcg_temp_free(t0);", "tcg_temp_free(t_31);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ] ]
14,719
void nbd_client_new(NBDExport *exp, int csock, void (*close_fn)(NBDClient *)) { NBDClient *client; client = g_malloc0(sizeof(NBDClient)); client->refcount = 1; client->exp = exp; client->sock = csock; client->can_read = true; if (nbd_send_negotiate(client)) { shutdown(client->sock, 2); close_fn(client); return; } client->close = close_fn; qemu_co_mutex_init(&client->send_lock); nbd_set_handlers(client); if (exp) { QTAILQ_INSERT_TAIL(&exp->clients, client, next); nbd_export_get(exp); } }
false
qemu
1a6245a5b0b4e8d822c739b403fc67c8a7bc8d12
void nbd_client_new(NBDExport *exp, int csock, void (*close_fn)(NBDClient *)) { NBDClient *client; client = g_malloc0(sizeof(NBDClient)); client->refcount = 1; client->exp = exp; client->sock = csock; client->can_read = true; if (nbd_send_negotiate(client)) { shutdown(client->sock, 2); close_fn(client); return; } client->close = close_fn; qemu_co_mutex_init(&client->send_lock); nbd_set_handlers(client); if (exp) { QTAILQ_INSERT_TAIL(&exp->clients, client, next); nbd_export_get(exp); } }
{ "code": [], "line_no": [] }
VAR_3voidVAR_3 VAR_3nbd_client_newVAR_3(VAR_3NBDExportVAR_3 *VAR_3VAR_0VAR_3, VAR_3intVAR_3 VAR_3VAR_1VAR_3, VAR_3voidVAR_3 (*VAR_3VAR_2VAR_3)(VAR_3NBDClientVAR_3 *)) { VAR_3NBDClientVAR_3 *VAR_3clientVAR_3; VAR_3clientVAR_3 = VAR_3g_malloc0VAR_3(VAR_3sizeofVAR_3(VAR_3NBDClientVAR_3)); VAR_3clientVAR_3->VAR_3refcountVAR_3 = VAR_31VAR_3; VAR_3clientVAR_3->VAR_3VAR_0VAR_3 = VAR_3VAR_0VAR_3; VAR_3clientVAR_3->VAR_3sockVAR_3 = VAR_3VAR_1VAR_3; VAR_3clientVAR_3->VAR_3can_readVAR_3 = VAR_3trueVAR_3; VAR_3ifVAR_3 (VAR_3nbd_send_negotiateVAR_3(VAR_3clientVAR_3)) { VAR_3shutdownVAR_3(VAR_3clientVAR_3->VAR_3sockVAR_3, VAR_32VAR_3); VAR_3VAR_2VAR_3(VAR_3clientVAR_3); VAR_3returnVAR_3; } VAR_3clientVAR_3->VAR_3closeVAR_3 = VAR_3VAR_2VAR_3; VAR_3qemu_co_mutex_initVAR_3(&VAR_3clientVAR_3->VAR_3send_lockVAR_3); VAR_3nbd_set_handlersVAR_3(VAR_3clientVAR_3); VAR_3ifVAR_3 (VAR_3VAR_0VAR_3) { VAR_3QTAILQ_INSERT_TAILVAR_3(&VAR_3VAR_0VAR_3->VAR_3clientsVAR_3, VAR_3clientVAR_3, VAR_3nextVAR_3); VAR_3nbd_export_getVAR_3(VAR_3VAR_0VAR_3); } }
[ "VAR_3voidVAR_3 VAR_3nbd_client_newVAR_3(VAR_3NBDExportVAR_3 *VAR_3VAR_0VAR_3, VAR_3intVAR_3 VAR_3VAR_1VAR_3, VAR_3voidVAR_3 (*VAR_3VAR_2VAR_3)(VAR_3NBDClientVAR_3 *))\n{", "VAR_3NBDClientVAR_3 *VAR_3clientVAR_3;", "VAR_3clientVAR_3 = VAR_3g_malloc0VAR_3(VAR_3sizeofVAR_3(VAR_3NBDClientVAR_3));", "VAR_3clientVAR_3->VAR_3refcountVAR_3 = VAR_31VAR_3;", "VAR_3clientVAR_3->VAR_3VAR_0VAR_3 = VAR_3VAR_0VAR_3;", "VAR_3clientVAR_3->VAR_3sockVAR_3 = VAR_3VAR_1VAR_3;", "VAR_3clientVAR_3->VAR_3can_readVAR_3 = VAR_3trueVAR_3;", "VAR_3ifVAR_3 (VAR_3nbd_send_negotiateVAR_3(VAR_3clientVAR_3)) {", "VAR_3shutdownVAR_3(VAR_3clientVAR_3->VAR_3sockVAR_3, VAR_32VAR_3);", "VAR_3VAR_2VAR_3(VAR_3clientVAR_3);", "VAR_3returnVAR_3;", "}", "VAR_3clientVAR_3->VAR_3closeVAR_3 = VAR_3VAR_2VAR_3;", "VAR_3qemu_co_mutex_initVAR_3(&VAR_3clientVAR_3->VAR_3send_lockVAR_3);", "VAR_3nbd_set_handlersVAR_3(VAR_3clientVAR_3);", "VAR_3ifVAR_3 (VAR_3VAR_0VAR_3) {", "VAR_3QTAILQ_INSERT_TAILVAR_3(&VAR_3VAR_0VAR_3->VAR_3clientsVAR_3, VAR_3clientVAR_3, VAR_3nextVAR_3);", "VAR_3nbd_export_getVAR_3(VAR_3VAR_0VAR_3);", "}", "}" ]
[ 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 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ] ]
14,720
static void do_info_status(Monitor *mon, QObject **ret_data) { *ret_data = qobject_from_jsonf("{ 'running': %i, 'singlestep': %i }", runstate_is_running(), singlestep); }
false
qemu
9e37b9dc5bf037453e062ee515014875cd05068d
static void do_info_status(Monitor *mon, QObject **ret_data) { *ret_data = qobject_from_jsonf("{ 'running': %i, 'singlestep': %i }", runstate_is_running(), singlestep); }
{ "code": [], "line_no": [] }
static void FUNC_0(Monitor *VAR_0, QObject **VAR_1) { *VAR_1 = qobject_from_jsonf("{ 'running': %i, 'singlestep': %i }", runstate_is_running(), singlestep); }
[ "static void FUNC_0(Monitor *VAR_0, QObject **VAR_1)\n{", "*VAR_1 = qobject_from_jsonf(\"{ 'running': %i, 'singlestep': %i }\",", "runstate_is_running(), singlestep);", "}" ]
[ 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ] ]
14,721
int event_notifier_test_and_clear(EventNotifier *e) { uint64_t value; int r = read(e->fd, &value, sizeof(value)); return r == sizeof(value); }
false
qemu
d0cc2fbfa607678866475383c508be84818ceb64
int event_notifier_test_and_clear(EventNotifier *e) { uint64_t value; int r = read(e->fd, &value, sizeof(value)); return r == sizeof(value); }
{ "code": [], "line_no": [] }
int FUNC_0(EventNotifier *VAR_0) { uint64_t value; int VAR_1 = read(VAR_0->fd, &value, sizeof(value)); return VAR_1 == sizeof(value); }
[ "int FUNC_0(EventNotifier *VAR_0)\n{", "uint64_t value;", "int VAR_1 = read(VAR_0->fd, &value, sizeof(value));", "return VAR_1 == sizeof(value);", "}" ]
[ 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ] ]
14,722
static int x8_decode_intra_mb(IntraX8Context *const w, const int chroma) { MpegEncContext *const s = w->s; uint8_t *scantable; int final, run, level; int ac_mode, dc_mode, est_run, dc_level; int pos, n; int zeros_only; int use_quant_matrix; int sign; assert(w->orient < 12); s->bdsp.clear_block(s->block[0]); if (chroma) dc_mode = 2; else dc_mode = !!w->est_run; // 0, 1 if (x8_get_dc_rlf(w, dc_mode, &dc_level, &final)) return -1; n = 0; zeros_only = 0; if (!final) { // decode ac use_quant_matrix = w->use_quant_matrix; if (chroma) { ac_mode = 1; est_run = 64; // not used } else { if (w->raw_orient < 3) use_quant_matrix = 0; if (w->raw_orient > 4) { ac_mode = 0; est_run = 64; } else { if (w->est_run > 1) { ac_mode = 2; est_run = w->est_run; } else { ac_mode = 3; est_run = 64; } } } x8_select_ac_table(w, ac_mode); /* scantable_selector[12] = { 0, 2, 0, 1, 1, 1, 0, 2, 2, 0, 1, 2 }; <- * -> 10'01' 00'10' 10'00' 01'01' 01'00' 10'00 => 0x928548 */ scantable = w->scantable[(0x928548 >> (2 * w->orient)) & 3].permutated; pos = 0; do { n++; if (n >= est_run) { ac_mode = 3; x8_select_ac_table(w, 3); } x8_get_ac_rlf(w, ac_mode, &run, &level, &final); pos += run + 1; if (pos > 63) { // this also handles vlc error in x8_get_ac_rlf return -1; } level = (level + 1) * w->dquant; level += w->qsum; sign = -get_bits1(&s->gb); level = (level ^ sign) - sign; if (use_quant_matrix) level = (level * quant_table[pos]) >> 8; s->block[0][scantable[pos]] = level; } while (!final); s->block_last_index[0] = pos; } else { // DC only s->block_last_index[0] = 0; if (w->flat_dc && ((unsigned) (dc_level + 1)) < 3) { // [-1; 1] int32_t divide_quant = !chroma ? w->divide_quant_dc_luma : w->divide_quant_dc_chroma; int32_t dc_quant = !chroma ? w->quant : w->quant_dc_chroma; // original intent dc_level += predicted_dc/quant; // but it got lost somewhere in the rounding dc_level += (w->predicted_dc * divide_quant + (1 << 12)) >> 13; dsp_x8_put_solidcolor(av_clip_uint8((dc_level * dc_quant + 4) >> 3), w->dest[chroma], s->current_picture.f->linesize[!!chroma]); goto block_placed; } zeros_only = (dc_level == 0); } if (!chroma) s->block[0][0] = dc_level * w->quant; else s->block[0][0] = dc_level * w->quant_dc_chroma; // there is !zero_only check in the original, but dc_level check is enough if ((unsigned int) (dc_level + 1) >= 3 && (w->edges & 3) != 3) { int direction; /* ac_comp_direction[orient] = { 0, 3, 3, 1, 1, 0, 0, 0, 2, 2, 2, 1 }; <- * -> 01'10' 10'10' 00'00' 00'01' 01'11' 11'00 => 0x6A017C */ direction = (0x6A017C >> (w->orient * 2)) & 3; if (direction != 3) { // modify block_last[] x8_ac_compensation(w, direction, s->block[0][0]); } } if (w->flat_dc) { dsp_x8_put_solidcolor(w->predicted_dc, w->dest[chroma], s->current_picture.f->linesize[!!chroma]); } else { w->dsp.spatial_compensation[w->orient](s->sc.edge_emu_buffer, w->dest[chroma], s->current_picture.f->linesize[!!chroma]); } if (!zeros_only) w->idsp.idct_add(w->dest[chroma], s->current_picture.f->linesize[!!chroma], s->block[0]); block_placed: if (!chroma) x8_update_predictions(w, w->orient, n); if (s->loop_filter) { uint8_t *ptr = w->dest[chroma]; int linesize = s->current_picture.f->linesize[!!chroma]; if (!((w->edges & 2) || (zeros_only && (w->orient | 4) == 4))) w->dsp.h_loop_filter(ptr, linesize, w->quant); if (!((w->edges & 1) || (zeros_only && (w->orient | 8) == 8))) w->dsp.v_loop_filter(ptr, linesize, w->quant); } return 0; }
false
FFmpeg
577393321c389ad2973bec6168a8045c94a9e099
static int x8_decode_intra_mb(IntraX8Context *const w, const int chroma) { MpegEncContext *const s = w->s; uint8_t *scantable; int final, run, level; int ac_mode, dc_mode, est_run, dc_level; int pos, n; int zeros_only; int use_quant_matrix; int sign; assert(w->orient < 12); s->bdsp.clear_block(s->block[0]); if (chroma) dc_mode = 2; else dc_mode = !!w->est_run; if (x8_get_dc_rlf(w, dc_mode, &dc_level, &final)) return -1; n = 0; zeros_only = 0; if (!final) { use_quant_matrix = w->use_quant_matrix; if (chroma) { ac_mode = 1; est_run = 64; } else { if (w->raw_orient < 3) use_quant_matrix = 0; if (w->raw_orient > 4) { ac_mode = 0; est_run = 64; } else { if (w->est_run > 1) { ac_mode = 2; est_run = w->est_run; } else { ac_mode = 3; est_run = 64; } } } x8_select_ac_table(w, ac_mode); scantable = w->scantable[(0x928548 >> (2 * w->orient)) & 3].permutated; pos = 0; do { n++; if (n >= est_run) { ac_mode = 3; x8_select_ac_table(w, 3); } x8_get_ac_rlf(w, ac_mode, &run, &level, &final); pos += run + 1; if (pos > 63) { return -1; } level = (level + 1) * w->dquant; level += w->qsum; sign = -get_bits1(&s->gb); level = (level ^ sign) - sign; if (use_quant_matrix) level = (level * quant_table[pos]) >> 8; s->block[0][scantable[pos]] = level; } while (!final); s->block_last_index[0] = pos; } else { s->block_last_index[0] = 0; if (w->flat_dc && ((unsigned) (dc_level + 1)) < 3) { int32_t divide_quant = !chroma ? w->divide_quant_dc_luma : w->divide_quant_dc_chroma; int32_t dc_quant = !chroma ? w->quant : w->quant_dc_chroma; dc_level += (w->predicted_dc * divide_quant + (1 << 12)) >> 13; dsp_x8_put_solidcolor(av_clip_uint8((dc_level * dc_quant + 4) >> 3), w->dest[chroma], s->current_picture.f->linesize[!!chroma]); goto block_placed; } zeros_only = (dc_level == 0); } if (!chroma) s->block[0][0] = dc_level * w->quant; else s->block[0][0] = dc_level * w->quant_dc_chroma; if ((unsigned int) (dc_level + 1) >= 3 && (w->edges & 3) != 3) { int direction; direction = (0x6A017C >> (w->orient * 2)) & 3; if (direction != 3) { x8_ac_compensation(w, direction, s->block[0][0]); } } if (w->flat_dc) { dsp_x8_put_solidcolor(w->predicted_dc, w->dest[chroma], s->current_picture.f->linesize[!!chroma]); } else { w->dsp.spatial_compensation[w->orient](s->sc.edge_emu_buffer, w->dest[chroma], s->current_picture.f->linesize[!!chroma]); } if (!zeros_only) w->idsp.idct_add(w->dest[chroma], s->current_picture.f->linesize[!!chroma], s->block[0]); block_placed: if (!chroma) x8_update_predictions(w, w->orient, n); if (s->loop_filter) { uint8_t *ptr = w->dest[chroma]; int linesize = s->current_picture.f->linesize[!!chroma]; if (!((w->edges & 2) || (zeros_only && (w->orient | 4) == 4))) w->dsp.h_loop_filter(ptr, linesize, w->quant); if (!((w->edges & 1) || (zeros_only && (w->orient | 8) == 8))) w->dsp.v_loop_filter(ptr, linesize, w->quant); } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(IntraX8Context *const VAR_0, const int VAR_1) { MpegEncContext *const s = VAR_0->s; uint8_t *scantable; int VAR_2, VAR_3, VAR_4; int VAR_5, VAR_6, VAR_7, VAR_8; int VAR_9, VAR_10; int VAR_11; int VAR_12; int VAR_13; assert(VAR_0->orient < 12); s->bdsp.clear_block(s->block[0]); if (VAR_1) VAR_6 = 2; else VAR_6 = !!VAR_0->VAR_7; if (x8_get_dc_rlf(VAR_0, VAR_6, &VAR_8, &VAR_2)) return -1; VAR_10 = 0; VAR_11 = 0; if (!VAR_2) { VAR_12 = VAR_0->VAR_12; if (VAR_1) { VAR_5 = 1; VAR_7 = 64; } else { if (VAR_0->raw_orient < 3) VAR_12 = 0; if (VAR_0->raw_orient > 4) { VAR_5 = 0; VAR_7 = 64; } else { if (VAR_0->VAR_7 > 1) { VAR_5 = 2; VAR_7 = VAR_0->VAR_7; } else { VAR_5 = 3; VAR_7 = 64; } } } x8_select_ac_table(VAR_0, VAR_5); scantable = VAR_0->scantable[(0x928548 >> (2 * VAR_0->orient)) & 3].permutated; VAR_9 = 0; do { VAR_10++; if (VAR_10 >= VAR_7) { VAR_5 = 3; x8_select_ac_table(VAR_0, 3); } x8_get_ac_rlf(VAR_0, VAR_5, &VAR_3, &VAR_4, &VAR_2); VAR_9 += VAR_3 + 1; if (VAR_9 > 63) { return -1; } VAR_4 = (VAR_4 + 1) * VAR_0->dquant; VAR_4 += VAR_0->qsum; VAR_13 = -get_bits1(&s->gb); VAR_4 = (VAR_4 ^ VAR_13) - VAR_13; if (VAR_12) VAR_4 = (VAR_4 * quant_table[VAR_9]) >> 8; s->block[0][scantable[VAR_9]] = VAR_4; } while (!VAR_2); s->block_last_index[0] = VAR_9; } else { s->block_last_index[0] = 0; if (VAR_0->flat_dc && ((unsigned) (VAR_8 + 1)) < 3) { int32_t divide_quant = !VAR_1 ? VAR_0->divide_quant_dc_luma : VAR_0->divide_quant_dc_chroma; int32_t dc_quant = !VAR_1 ? VAR_0->quant : VAR_0->quant_dc_chroma; VAR_8 += (VAR_0->predicted_dc * divide_quant + (1 << 12)) >> 13; dsp_x8_put_solidcolor(av_clip_uint8((VAR_8 * dc_quant + 4) >> 3), VAR_0->dest[VAR_1], s->current_picture.f->VAR_15[!!VAR_1]); goto block_placed; } VAR_11 = (VAR_8 == 0); } if (!VAR_1) s->block[0][0] = VAR_8 * VAR_0->quant; else s->block[0][0] = VAR_8 * VAR_0->quant_dc_chroma; if ((unsigned int) (VAR_8 + 1) >= 3 && (VAR_0->edges & 3) != 3) { int VAR_14; VAR_14 = (0x6A017C >> (VAR_0->orient * 2)) & 3; if (VAR_14 != 3) { x8_ac_compensation(VAR_0, VAR_14, s->block[0][0]); } } if (VAR_0->flat_dc) { dsp_x8_put_solidcolor(VAR_0->predicted_dc, VAR_0->dest[VAR_1], s->current_picture.f->VAR_15[!!VAR_1]); } else { VAR_0->dsp.spatial_compensation[VAR_0->orient](s->sc.edge_emu_buffer, VAR_0->dest[VAR_1], s->current_picture.f->VAR_15[!!VAR_1]); } if (!VAR_11) VAR_0->idsp.idct_add(VAR_0->dest[VAR_1], s->current_picture.f->VAR_15[!!VAR_1], s->block[0]); block_placed: if (!VAR_1) x8_update_predictions(VAR_0, VAR_0->orient, VAR_10); if (s->loop_filter) { uint8_t *ptr = VAR_0->dest[VAR_1]; int VAR_15 = s->current_picture.f->VAR_15[!!VAR_1]; if (!((VAR_0->edges & 2) || (VAR_11 && (VAR_0->orient | 4) == 4))) VAR_0->dsp.h_loop_filter(ptr, VAR_15, VAR_0->quant); if (!((VAR_0->edges & 1) || (VAR_11 && (VAR_0->orient | 8) == 8))) VAR_0->dsp.v_loop_filter(ptr, VAR_15, VAR_0->quant); } return 0; }
[ "static int FUNC_0(IntraX8Context *const VAR_0, const int VAR_1)\n{", "MpegEncContext *const s = VAR_0->s;", "uint8_t *scantable;", "int VAR_2, VAR_3, VAR_4;", "int VAR_5, VAR_6, VAR_7, VAR_8;", "int VAR_9, VAR_10;", "int VAR_11;", "int VAR_12;", "int VAR_13;", "assert(VAR_0->orient < 12);", "s->bdsp.clear_block(s->block[0]);", "if (VAR_1)\nVAR_6 = 2;", "else\nVAR_6 = !!VAR_0->VAR_7;", "if (x8_get_dc_rlf(VAR_0, VAR_6, &VAR_8, &VAR_2))\nreturn -1;", "VAR_10 = 0;", "VAR_11 = 0;", "if (!VAR_2) {", "VAR_12 = VAR_0->VAR_12;", "if (VAR_1) {", "VAR_5 = 1;", "VAR_7 = 64;", "} else {", "if (VAR_0->raw_orient < 3)\nVAR_12 = 0;", "if (VAR_0->raw_orient > 4) {", "VAR_5 = 0;", "VAR_7 = 64;", "} else {", "if (VAR_0->VAR_7 > 1) {", "VAR_5 = 2;", "VAR_7 = VAR_0->VAR_7;", "} else {", "VAR_5 = 3;", "VAR_7 = 64;", "}", "}", "}", "x8_select_ac_table(VAR_0, VAR_5);", "scantable = VAR_0->scantable[(0x928548 >> (2 * VAR_0->orient)) & 3].permutated;", "VAR_9 = 0;", "do {", "VAR_10++;", "if (VAR_10 >= VAR_7) {", "VAR_5 = 3;", "x8_select_ac_table(VAR_0, 3);", "}", "x8_get_ac_rlf(VAR_0, VAR_5, &VAR_3, &VAR_4, &VAR_2);", "VAR_9 += VAR_3 + 1;", "if (VAR_9 > 63) {", "return -1;", "}", "VAR_4 = (VAR_4 + 1) * VAR_0->dquant;", "VAR_4 += VAR_0->qsum;", "VAR_13 = -get_bits1(&s->gb);", "VAR_4 = (VAR_4 ^ VAR_13) - VAR_13;", "if (VAR_12)\nVAR_4 = (VAR_4 * quant_table[VAR_9]) >> 8;", "s->block[0][scantable[VAR_9]] = VAR_4;", "} while (!VAR_2);", "s->block_last_index[0] = VAR_9;", "} else {", "s->block_last_index[0] = 0;", "if (VAR_0->flat_dc && ((unsigned) (VAR_8 + 1)) < 3) {", "int32_t divide_quant = !VAR_1 ? VAR_0->divide_quant_dc_luma\n: VAR_0->divide_quant_dc_chroma;", "int32_t dc_quant = !VAR_1 ? VAR_0->quant\n: VAR_0->quant_dc_chroma;", "VAR_8 += (VAR_0->predicted_dc * divide_quant + (1 << 12)) >> 13;", "dsp_x8_put_solidcolor(av_clip_uint8((VAR_8 * dc_quant + 4) >> 3),\nVAR_0->dest[VAR_1],\ns->current_picture.f->VAR_15[!!VAR_1]);", "goto block_placed;", "}", "VAR_11 = (VAR_8 == 0);", "}", "if (!VAR_1)\ns->block[0][0] = VAR_8 * VAR_0->quant;", "else\ns->block[0][0] = VAR_8 * VAR_0->quant_dc_chroma;", "if ((unsigned int) (VAR_8 + 1) >= 3 && (VAR_0->edges & 3) != 3) {", "int VAR_14;", "VAR_14 = (0x6A017C >> (VAR_0->orient * 2)) & 3;", "if (VAR_14 != 3) {", "x8_ac_compensation(VAR_0, VAR_14, s->block[0][0]);", "}", "}", "if (VAR_0->flat_dc) {", "dsp_x8_put_solidcolor(VAR_0->predicted_dc, VAR_0->dest[VAR_1],\ns->current_picture.f->VAR_15[!!VAR_1]);", "} else {", "VAR_0->dsp.spatial_compensation[VAR_0->orient](s->sc.edge_emu_buffer,\nVAR_0->dest[VAR_1],\ns->current_picture.f->VAR_15[!!VAR_1]);", "}", "if (!VAR_11)\nVAR_0->idsp.idct_add(VAR_0->dest[VAR_1],\ns->current_picture.f->VAR_15[!!VAR_1],\ns->block[0]);", "block_placed:\nif (!VAR_1)\nx8_update_predictions(VAR_0, VAR_0->orient, VAR_10);", "if (s->loop_filter) {", "uint8_t *ptr = VAR_0->dest[VAR_1];", "int VAR_15 = s->current_picture.f->VAR_15[!!VAR_1];", "if (!((VAR_0->edges & 2) || (VAR_11 && (VAR_0->orient | 4) == 4)))\nVAR_0->dsp.h_loop_filter(ptr, VAR_15, VAR_0->quant);", "if (!((VAR_0->edges & 1) || (VAR_11 && (VAR_0->orient | 8) == 8)))\nVAR_0->dsp.v_loop_filter(ptr, VAR_15, VAR_0->quant);", "}", "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 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 31, 33 ], [ 35, 37 ], [ 41, 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61, 63 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 117 ], [ 121 ], [ 123 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 137 ], [ 139 ], [ 143, 145 ], [ 149 ], [ 151 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163, 165 ], [ 167, 169 ], [ 177 ], [ 181, 183, 185 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197, 199 ], [ 201, 203 ], [ 209 ], [ 211 ], [ 217 ], [ 219 ], [ 223 ], [ 225 ], [ 227 ], [ 231 ], [ 233, 235 ], [ 237 ], [ 239, 241, 243 ], [ 245 ], [ 247, 249, 251, 253 ], [ 257, 259, 261 ], [ 265 ], [ 267 ], [ 269 ], [ 273, 275 ], [ 279, 281 ], [ 283 ], [ 285 ], [ 287 ] ]
14,724
static void bdrv_move_feature_fields(BlockDriverState *bs_dest, BlockDriverState *bs_src) { /* move some fields that need to stay attached to the device */ bs_dest->open_flags = bs_src->open_flags; /* dev info */ bs_dest->dev_ops = bs_src->dev_ops; bs_dest->dev_opaque = bs_src->dev_opaque; bs_dest->dev = bs_src->dev; bs_dest->buffer_alignment = bs_src->buffer_alignment; bs_dest->copy_on_read = bs_src->copy_on_read; bs_dest->enable_write_cache = bs_src->enable_write_cache; /* i/o timing parameters */ bs_dest->slice_time = bs_src->slice_time; bs_dest->slice_start = bs_src->slice_start; bs_dest->slice_end = bs_src->slice_end; bs_dest->io_limits = bs_src->io_limits; bs_dest->io_base = bs_src->io_base; bs_dest->throttled_reqs = bs_src->throttled_reqs; bs_dest->block_timer = bs_src->block_timer; bs_dest->io_limits_enabled = bs_src->io_limits_enabled; /* geometry */ bs_dest->cyls = bs_src->cyls; bs_dest->heads = bs_src->heads; bs_dest->secs = bs_src->secs; bs_dest->translation = bs_src->translation; /* r/w error */ bs_dest->on_read_error = bs_src->on_read_error; bs_dest->on_write_error = bs_src->on_write_error; /* i/o status */ bs_dest->iostatus_enabled = bs_src->iostatus_enabled; bs_dest->iostatus = bs_src->iostatus; /* dirty bitmap */ bs_dest->dirty_count = bs_src->dirty_count; bs_dest->dirty_bitmap = bs_src->dirty_bitmap; /* job */ bs_dest->in_use = bs_src->in_use; bs_dest->job = bs_src->job; /* keep the same entry in bdrv_states */ pstrcpy(bs_dest->device_name, sizeof(bs_dest->device_name), bs_src->device_name); bs_dest->list = bs_src->list; }
false
qemu
2b584959ed300ddff4acba0d7554becad5f274fd
static void bdrv_move_feature_fields(BlockDriverState *bs_dest, BlockDriverState *bs_src) { bs_dest->open_flags = bs_src->open_flags; bs_dest->dev_ops = bs_src->dev_ops; bs_dest->dev_opaque = bs_src->dev_opaque; bs_dest->dev = bs_src->dev; bs_dest->buffer_alignment = bs_src->buffer_alignment; bs_dest->copy_on_read = bs_src->copy_on_read; bs_dest->enable_write_cache = bs_src->enable_write_cache; bs_dest->slice_time = bs_src->slice_time; bs_dest->slice_start = bs_src->slice_start; bs_dest->slice_end = bs_src->slice_end; bs_dest->io_limits = bs_src->io_limits; bs_dest->io_base = bs_src->io_base; bs_dest->throttled_reqs = bs_src->throttled_reqs; bs_dest->block_timer = bs_src->block_timer; bs_dest->io_limits_enabled = bs_src->io_limits_enabled; bs_dest->cyls = bs_src->cyls; bs_dest->heads = bs_src->heads; bs_dest->secs = bs_src->secs; bs_dest->translation = bs_src->translation; bs_dest->on_read_error = bs_src->on_read_error; bs_dest->on_write_error = bs_src->on_write_error; bs_dest->iostatus_enabled = bs_src->iostatus_enabled; bs_dest->iostatus = bs_src->iostatus; bs_dest->dirty_count = bs_src->dirty_count; bs_dest->dirty_bitmap = bs_src->dirty_bitmap; bs_dest->in_use = bs_src->in_use; bs_dest->job = bs_src->job; pstrcpy(bs_dest->device_name, sizeof(bs_dest->device_name), bs_src->device_name); bs_dest->list = bs_src->list; }
{ "code": [], "line_no": [] }
static void FUNC_0(BlockDriverState *VAR_0, BlockDriverState *VAR_1) { VAR_0->open_flags = VAR_1->open_flags; VAR_0->dev_ops = VAR_1->dev_ops; VAR_0->dev_opaque = VAR_1->dev_opaque; VAR_0->dev = VAR_1->dev; VAR_0->buffer_alignment = VAR_1->buffer_alignment; VAR_0->copy_on_read = VAR_1->copy_on_read; VAR_0->enable_write_cache = VAR_1->enable_write_cache; VAR_0->slice_time = VAR_1->slice_time; VAR_0->slice_start = VAR_1->slice_start; VAR_0->slice_end = VAR_1->slice_end; VAR_0->io_limits = VAR_1->io_limits; VAR_0->io_base = VAR_1->io_base; VAR_0->throttled_reqs = VAR_1->throttled_reqs; VAR_0->block_timer = VAR_1->block_timer; VAR_0->io_limits_enabled = VAR_1->io_limits_enabled; VAR_0->cyls = VAR_1->cyls; VAR_0->heads = VAR_1->heads; VAR_0->secs = VAR_1->secs; VAR_0->translation = VAR_1->translation; VAR_0->on_read_error = VAR_1->on_read_error; VAR_0->on_write_error = VAR_1->on_write_error; VAR_0->iostatus_enabled = VAR_1->iostatus_enabled; VAR_0->iostatus = VAR_1->iostatus; VAR_0->dirty_count = VAR_1->dirty_count; VAR_0->dirty_bitmap = VAR_1->dirty_bitmap; VAR_0->in_use = VAR_1->in_use; VAR_0->job = VAR_1->job; pstrcpy(VAR_0->device_name, sizeof(VAR_0->device_name), VAR_1->device_name); VAR_0->list = VAR_1->list; }
[ "static void FUNC_0(BlockDriverState *VAR_0,\nBlockDriverState *VAR_1)\n{", "VAR_0->open_flags = VAR_1->open_flags;", "VAR_0->dev_ops = VAR_1->dev_ops;", "VAR_0->dev_opaque = VAR_1->dev_opaque;", "VAR_0->dev = VAR_1->dev;", "VAR_0->buffer_alignment = VAR_1->buffer_alignment;", "VAR_0->copy_on_read = VAR_1->copy_on_read;", "VAR_0->enable_write_cache = VAR_1->enable_write_cache;", "VAR_0->slice_time = VAR_1->slice_time;", "VAR_0->slice_start = VAR_1->slice_start;", "VAR_0->slice_end = VAR_1->slice_end;", "VAR_0->io_limits = VAR_1->io_limits;", "VAR_0->io_base = VAR_1->io_base;", "VAR_0->throttled_reqs = VAR_1->throttled_reqs;", "VAR_0->block_timer = VAR_1->block_timer;", "VAR_0->io_limits_enabled = VAR_1->io_limits_enabled;", "VAR_0->cyls = VAR_1->cyls;", "VAR_0->heads = VAR_1->heads;", "VAR_0->secs = VAR_1->secs;", "VAR_0->translation = VAR_1->translation;", "VAR_0->on_read_error = VAR_1->on_read_error;", "VAR_0->on_write_error = VAR_1->on_write_error;", "VAR_0->iostatus_enabled = VAR_1->iostatus_enabled;", "VAR_0->iostatus = VAR_1->iostatus;", "VAR_0->dirty_count = VAR_1->dirty_count;", "VAR_0->dirty_bitmap = VAR_1->dirty_bitmap;", "VAR_0->in_use = VAR_1->in_use;", "VAR_0->job = VAR_1->job;", "pstrcpy(VAR_0->device_name, sizeof(VAR_0->device_name),\nVAR_1->device_name);", "VAR_0->list = VAR_1->list;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 9 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 65 ], [ 67 ], [ 73 ], [ 75 ], [ 81 ], [ 83 ], [ 89 ], [ 91 ], [ 97, 99 ], [ 101 ], [ 103 ] ]
14,725
static void mmubooke_create_initial_mapping(CPUPPCState *env) { struct boot_info *bi = env->load_info; ppcmas_tlb_t *tlb = booke206_get_tlbm(env, 1, 0, 0); hwaddr size, dt_end; int ps; /* Our initial TLB entry needs to cover everything from 0 to the device tree top */ dt_end = bi->dt_base + bi->dt_size; ps = booke206_page_size_to_tlb(dt_end) + 1; if (ps & 1) { /* e500v2 can only do even TLB size bits */ ps++; } size = (ps << MAS1_TSIZE_SHIFT); tlb->mas1 = MAS1_VALID | size; tlb->mas2 = 0; tlb->mas7_3 = 0; tlb->mas7_3 |= MAS3_UR | MAS3_UW | MAS3_UX | MAS3_SR | MAS3_SW | MAS3_SX; env->tlb_dirty = true; }
false
qemu
cefd3cdbdd9fc9a7d5ab324291904074d2aa69a0
static void mmubooke_create_initial_mapping(CPUPPCState *env) { struct boot_info *bi = env->load_info; ppcmas_tlb_t *tlb = booke206_get_tlbm(env, 1, 0, 0); hwaddr size, dt_end; int ps; dt_end = bi->dt_base + bi->dt_size; ps = booke206_page_size_to_tlb(dt_end) + 1; if (ps & 1) { ps++; } size = (ps << MAS1_TSIZE_SHIFT); tlb->mas1 = MAS1_VALID | size; tlb->mas2 = 0; tlb->mas7_3 = 0; tlb->mas7_3 |= MAS3_UR | MAS3_UW | MAS3_UX | MAS3_SR | MAS3_SW | MAS3_SX; env->tlb_dirty = true; }
{ "code": [], "line_no": [] }
static void FUNC_0(CPUPPCState *VAR_0) { struct boot_info *VAR_1 = VAR_0->load_info; ppcmas_tlb_t *tlb = booke206_get_tlbm(VAR_0, 1, 0, 0); hwaddr size, dt_end; int VAR_2; dt_end = VAR_1->dt_base + VAR_1->dt_size; VAR_2 = booke206_page_size_to_tlb(dt_end) + 1; if (VAR_2 & 1) { VAR_2++; } size = (VAR_2 << MAS1_TSIZE_SHIFT); tlb->mas1 = MAS1_VALID | size; tlb->mas2 = 0; tlb->mas7_3 = 0; tlb->mas7_3 |= MAS3_UR | MAS3_UW | MAS3_UX | MAS3_SR | MAS3_SW | MAS3_SX; VAR_0->tlb_dirty = true; }
[ "static void FUNC_0(CPUPPCState *VAR_0)\n{", "struct boot_info *VAR_1 = VAR_0->load_info;", "ppcmas_tlb_t *tlb = booke206_get_tlbm(VAR_0, 1, 0, 0);", "hwaddr size, dt_end;", "int VAR_2;", "dt_end = VAR_1->dt_base + VAR_1->dt_size;", "VAR_2 = booke206_page_size_to_tlb(dt_end) + 1;", "if (VAR_2 & 1) {", "VAR_2++;", "}", "size = (VAR_2 << MAS1_TSIZE_SHIFT);", "tlb->mas1 = MAS1_VALID | size;", "tlb->mas2 = 0;", "tlb->mas7_3 = 0;", "tlb->mas7_3 |= MAS3_UR | MAS3_UW | MAS3_UX | MAS3_SR | MAS3_SW | MAS3_SX;", "VAR_0->tlb_dirty = true;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ] ]
14,726
static unsigned int dec_bound_m(DisasContext *dc) { TCGv l[2]; int memsize = memsize_zz(dc); int insn_len; DIS(fprintf (logfile, "bound.%d [$r%u%s, $r%u\n", memsize_char(memsize), dc->op1, dc->postinc ? "+]" : "]", dc->op2)); l[0] = tcg_temp_local_new(TCG_TYPE_TL); l[1] = tcg_temp_local_new(TCG_TYPE_TL); insn_len = dec_prep_alu_m(dc, 0, memsize, l[0], l[1]); cris_cc_mask(dc, CC_MASK_NZ); cris_alu(dc, CC_OP_BOUND, cpu_R[dc->op2], l[0], l[1], 4); do_postinc(dc, memsize); tcg_temp_free(l[0]); tcg_temp_free(l[1]); return insn_len; }
false
qemu
a7812ae412311d7d47f8aa85656faadac9d64b56
static unsigned int dec_bound_m(DisasContext *dc) { TCGv l[2]; int memsize = memsize_zz(dc); int insn_len; DIS(fprintf (logfile, "bound.%d [$r%u%s, $r%u\n", memsize_char(memsize), dc->op1, dc->postinc ? "+]" : "]", dc->op2)); l[0] = tcg_temp_local_new(TCG_TYPE_TL); l[1] = tcg_temp_local_new(TCG_TYPE_TL); insn_len = dec_prep_alu_m(dc, 0, memsize, l[0], l[1]); cris_cc_mask(dc, CC_MASK_NZ); cris_alu(dc, CC_OP_BOUND, cpu_R[dc->op2], l[0], l[1], 4); do_postinc(dc, memsize); tcg_temp_free(l[0]); tcg_temp_free(l[1]); return insn_len; }
{ "code": [], "line_no": [] }
static unsigned int FUNC_0(DisasContext *VAR_0) { TCGv l[2]; int VAR_1 = memsize_zz(VAR_0); int VAR_2; DIS(fprintf (logfile, "bound.%d [$r%u%s, $r%u\n", memsize_char(VAR_1), VAR_0->op1, VAR_0->postinc ? "+]" : "]", VAR_0->op2)); l[0] = tcg_temp_local_new(TCG_TYPE_TL); l[1] = tcg_temp_local_new(TCG_TYPE_TL); VAR_2 = dec_prep_alu_m(VAR_0, 0, VAR_1, l[0], l[1]); cris_cc_mask(VAR_0, CC_MASK_NZ); cris_alu(VAR_0, CC_OP_BOUND, cpu_R[VAR_0->op2], l[0], l[1], 4); do_postinc(VAR_0, VAR_1); tcg_temp_free(l[0]); tcg_temp_free(l[1]); return VAR_2; }
[ "static unsigned int FUNC_0(DisasContext *VAR_0)\n{", "TCGv l[2];", "int VAR_1 = memsize_zz(VAR_0);", "int VAR_2;", "DIS(fprintf (logfile, \"bound.%d [$r%u%s, $r%u\\n\",\nmemsize_char(VAR_1),\nVAR_0->op1, VAR_0->postinc ? \"+]\" : \"]\",\nVAR_0->op2));", "l[0] = tcg_temp_local_new(TCG_TYPE_TL);", "l[1] = tcg_temp_local_new(TCG_TYPE_TL);", "VAR_2 = dec_prep_alu_m(VAR_0, 0, VAR_1, l[0], l[1]);", "cris_cc_mask(VAR_0, CC_MASK_NZ);", "cris_alu(VAR_0, CC_OP_BOUND, cpu_R[VAR_0->op2], l[0], l[1], 4);", "do_postinc(VAR_0, VAR_1);", "tcg_temp_free(l[0]);", "tcg_temp_free(l[1]);", "return VAR_2;", "}" ]
[ 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 ] ]
14,727
void omap_badwidth_write16(void *opaque, target_phys_addr_t addr, uint32_t value) { uint16_t val16 = value; OMAP_16B_REG(addr); cpu_physical_memory_write(addr, (void *) &val16, 2); }
false
qemu
a8170e5e97ad17ca169c64ba87ae2f53850dab4c
void omap_badwidth_write16(void *opaque, target_phys_addr_t addr, uint32_t value) { uint16_t val16 = value; OMAP_16B_REG(addr); cpu_physical_memory_write(addr, (void *) &val16, 2); }
{ "code": [], "line_no": [] }
void FUNC_0(void *VAR_0, target_phys_addr_t VAR_1, uint32_t VAR_2) { uint16_t val16 = VAR_2; OMAP_16B_REG(VAR_1); cpu_physical_memory_write(VAR_1, (void *) &val16, 2); }
[ "void FUNC_0(void *VAR_0, target_phys_addr_t VAR_1,\nuint32_t VAR_2)\n{", "uint16_t val16 = VAR_2;", "OMAP_16B_REG(VAR_1);", "cpu_physical_memory_write(VAR_1, (void *) &val16, 2);", "}" ]
[ 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ] ]
14,728
static inline void gen_op_fcmped(int fccno, TCGv_i64 r_rs1, TCGv_i64 r_rs2) { gen_helper_fcmped(cpu_env, r_rs1, r_rs2); }
false
qemu
7385aed20db5d83979f683b9d0048674411e963c
static inline void gen_op_fcmped(int fccno, TCGv_i64 r_rs1, TCGv_i64 r_rs2) { gen_helper_fcmped(cpu_env, r_rs1, r_rs2); }
{ "code": [], "line_no": [] }
static inline void FUNC_0(int VAR_0, TCGv_i64 VAR_1, TCGv_i64 VAR_2) { gen_helper_fcmped(cpu_env, VAR_1, VAR_2); }
[ "static inline void FUNC_0(int VAR_0, TCGv_i64 VAR_1, TCGv_i64 VAR_2)\n{", "gen_helper_fcmped(cpu_env, VAR_1, VAR_2);", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
14,729
static void hid_pointer_event(DeviceState *dev, QemuConsole *src, InputEvent *evt) { static const int bmap[INPUT_BUTTON__MAX] = { [INPUT_BUTTON_LEFT] = 0x01, [INPUT_BUTTON_RIGHT] = 0x02, [INPUT_BUTTON_MIDDLE] = 0x04, }; HIDState *hs = (HIDState *)dev; HIDPointerEvent *e; InputMoveEvent *move; InputBtnEvent *btn; assert(hs->n < QUEUE_LENGTH); e = &hs->ptr.queue[(hs->head + hs->n) & QUEUE_MASK]; switch (evt->type) { case INPUT_EVENT_KIND_REL: move = evt->u.rel; if (move->axis == INPUT_AXIS_X) { e->xdx += move->value; } else if (move->axis == INPUT_AXIS_Y) { e->ydy += move->value; } break; case INPUT_EVENT_KIND_ABS: move = evt->u.abs; if (move->axis == INPUT_AXIS_X) { e->xdx = move->value; } else if (move->axis == INPUT_AXIS_Y) { e->ydy = move->value; } break; case INPUT_EVENT_KIND_BTN: btn = evt->u.btn; if (btn->down) { e->buttons_state |= bmap[btn->button]; if (btn->button == INPUT_BUTTON_WHEEL_UP) { e->dz--; } else if (btn->button == INPUT_BUTTON_WHEEL_DOWN) { e->dz++; } } else { e->buttons_state &= ~bmap[btn->button]; } break; default: /* keep gcc happy */ break; } }
false
qemu
32bafa8fdd098d52fbf1102d5a5e48d29398c0aa
static void hid_pointer_event(DeviceState *dev, QemuConsole *src, InputEvent *evt) { static const int bmap[INPUT_BUTTON__MAX] = { [INPUT_BUTTON_LEFT] = 0x01, [INPUT_BUTTON_RIGHT] = 0x02, [INPUT_BUTTON_MIDDLE] = 0x04, }; HIDState *hs = (HIDState *)dev; HIDPointerEvent *e; InputMoveEvent *move; InputBtnEvent *btn; assert(hs->n < QUEUE_LENGTH); e = &hs->ptr.queue[(hs->head + hs->n) & QUEUE_MASK]; switch (evt->type) { case INPUT_EVENT_KIND_REL: move = evt->u.rel; if (move->axis == INPUT_AXIS_X) { e->xdx += move->value; } else if (move->axis == INPUT_AXIS_Y) { e->ydy += move->value; } break; case INPUT_EVENT_KIND_ABS: move = evt->u.abs; if (move->axis == INPUT_AXIS_X) { e->xdx = move->value; } else if (move->axis == INPUT_AXIS_Y) { e->ydy = move->value; } break; case INPUT_EVENT_KIND_BTN: btn = evt->u.btn; if (btn->down) { e->buttons_state |= bmap[btn->button]; if (btn->button == INPUT_BUTTON_WHEEL_UP) { e->dz--; } else if (btn->button == INPUT_BUTTON_WHEEL_DOWN) { e->dz++; } } else { e->buttons_state &= ~bmap[btn->button]; } break; default: break; } }
{ "code": [], "line_no": [] }
static void FUNC_0(DeviceState *VAR_0, QemuConsole *VAR_1, InputEvent *VAR_2) { static const int VAR_3[INPUT_BUTTON__MAX] = { [INPUT_BUTTON_LEFT] = 0x01, [INPUT_BUTTON_RIGHT] = 0x02, [INPUT_BUTTON_MIDDLE] = 0x04, }; HIDState *hs = (HIDState *)VAR_0; HIDPointerEvent *e; InputMoveEvent *move; InputBtnEvent *btn; assert(hs->n < QUEUE_LENGTH); e = &hs->ptr.queue[(hs->head + hs->n) & QUEUE_MASK]; switch (VAR_2->type) { case INPUT_EVENT_KIND_REL: move = VAR_2->u.rel; if (move->axis == INPUT_AXIS_X) { e->xdx += move->value; } else if (move->axis == INPUT_AXIS_Y) { e->ydy += move->value; } break; case INPUT_EVENT_KIND_ABS: move = VAR_2->u.abs; if (move->axis == INPUT_AXIS_X) { e->xdx = move->value; } else if (move->axis == INPUT_AXIS_Y) { e->ydy = move->value; } break; case INPUT_EVENT_KIND_BTN: btn = VAR_2->u.btn; if (btn->down) { e->buttons_state |= VAR_3[btn->button]; if (btn->button == INPUT_BUTTON_WHEEL_UP) { e->dz--; } else if (btn->button == INPUT_BUTTON_WHEEL_DOWN) { e->dz++; } } else { e->buttons_state &= ~VAR_3[btn->button]; } break; default: break; } }
[ "static void FUNC_0(DeviceState *VAR_0, QemuConsole *VAR_1,\nInputEvent *VAR_2)\n{", "static const int VAR_3[INPUT_BUTTON__MAX] = {", "[INPUT_BUTTON_LEFT] = 0x01,\n[INPUT_BUTTON_RIGHT] = 0x02,\n[INPUT_BUTTON_MIDDLE] = 0x04,\n};", "HIDState *hs = (HIDState *)VAR_0;", "HIDPointerEvent *e;", "InputMoveEvent *move;", "InputBtnEvent *btn;", "assert(hs->n < QUEUE_LENGTH);", "e = &hs->ptr.queue[(hs->head + hs->n) & QUEUE_MASK];", "switch (VAR_2->type) {", "case INPUT_EVENT_KIND_REL:\nmove = VAR_2->u.rel;", "if (move->axis == INPUT_AXIS_X) {", "e->xdx += move->value;", "} else if (move->axis == INPUT_AXIS_Y) {", "e->ydy += move->value;", "}", "break;", "case INPUT_EVENT_KIND_ABS:\nmove = VAR_2->u.abs;", "if (move->axis == INPUT_AXIS_X) {", "e->xdx = move->value;", "} else if (move->axis == INPUT_AXIS_Y) {", "e->ydy = move->value;", "}", "break;", "case INPUT_EVENT_KIND_BTN:\nbtn = VAR_2->u.btn;", "if (btn->down) {", "e->buttons_state |= VAR_3[btn->button];", "if (btn->button == INPUT_BUTTON_WHEEL_UP) {", "e->dz--;", "} else if (btn->button == INPUT_BUTTON_WHEEL_DOWN) {", "e->dz++;", "}", "} else {", "e->buttons_state &= ~VAR_3[btn->button];", "}", "break;", "default:\nbreak;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9, 11, 13, 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 33 ], [ 35, 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 53, 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 71, 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 99, 103 ], [ 105 ], [ 109 ] ]
14,730
static int aio_read_f(BlockBackend *blk, int argc, char **argv) { int nr_iov, c; struct aio_ctx *ctx = g_new0(struct aio_ctx, 1); ctx->blk = blk; while ((c = getopt(argc, argv, "CP:qv")) != EOF) { switch (c) { case 'C': ctx->Cflag = 1; break; case 'P': ctx->Pflag = 1; ctx->pattern = parse_pattern(optarg); if (ctx->pattern < 0) { g_free(ctx); return 0; } break; case 'q': ctx->qflag = 1; break; case 'v': ctx->vflag = 1; break; default: g_free(ctx); return qemuio_command_usage(&aio_read_cmd); } } if (optind > argc - 2) { g_free(ctx); return qemuio_command_usage(&aio_read_cmd); } ctx->offset = cvtnum(argv[optind]); if (ctx->offset < 0) { printf("non-numeric length argument -- %s\n", argv[optind]); g_free(ctx); return 0; } optind++; if (ctx->offset & 0x1ff) { printf("offset %" PRId64 " is not sector aligned\n", ctx->offset); g_free(ctx); return 0; } nr_iov = argc - optind; ctx->buf = create_iovec(blk, &ctx->qiov, &argv[optind], nr_iov, 0xab); if (ctx->buf == NULL) { g_free(ctx); return 0; } gettimeofday(&ctx->t1, NULL); block_acct_start(blk_get_stats(blk), &ctx->acct, ctx->qiov.size, BLOCK_ACCT_READ); blk_aio_readv(blk, ctx->offset >> 9, &ctx->qiov, ctx->qiov.size >> 9, aio_read_done, ctx); return 0; }
false
qemu
b062ad86dcd33ab39be5060b0655d8e13834b167
static int aio_read_f(BlockBackend *blk, int argc, char **argv) { int nr_iov, c; struct aio_ctx *ctx = g_new0(struct aio_ctx, 1); ctx->blk = blk; while ((c = getopt(argc, argv, "CP:qv")) != EOF) { switch (c) { case 'C': ctx->Cflag = 1; break; case 'P': ctx->Pflag = 1; ctx->pattern = parse_pattern(optarg); if (ctx->pattern < 0) { g_free(ctx); return 0; } break; case 'q': ctx->qflag = 1; break; case 'v': ctx->vflag = 1; break; default: g_free(ctx); return qemuio_command_usage(&aio_read_cmd); } } if (optind > argc - 2) { g_free(ctx); return qemuio_command_usage(&aio_read_cmd); } ctx->offset = cvtnum(argv[optind]); if (ctx->offset < 0) { printf("non-numeric length argument -- %s\n", argv[optind]); g_free(ctx); return 0; } optind++; if (ctx->offset & 0x1ff) { printf("offset %" PRId64 " is not sector aligned\n", ctx->offset); g_free(ctx); return 0; } nr_iov = argc - optind; ctx->buf = create_iovec(blk, &ctx->qiov, &argv[optind], nr_iov, 0xab); if (ctx->buf == NULL) { g_free(ctx); return 0; } gettimeofday(&ctx->t1, NULL); block_acct_start(blk_get_stats(blk), &ctx->acct, ctx->qiov.size, BLOCK_ACCT_READ); blk_aio_readv(blk, ctx->offset >> 9, &ctx->qiov, ctx->qiov.size >> 9, aio_read_done, ctx); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(BlockBackend *VAR_0, int VAR_1, char **VAR_2) { int VAR_3, VAR_4; struct aio_ctx *VAR_5 = g_new0(struct aio_ctx, 1); VAR_5->VAR_0 = VAR_0; while ((VAR_4 = getopt(VAR_1, VAR_2, "CP:qv")) != EOF) { switch (VAR_4) { case 'C': VAR_5->Cflag = 1; break; case 'P': VAR_5->Pflag = 1; VAR_5->pattern = parse_pattern(optarg); if (VAR_5->pattern < 0) { g_free(VAR_5); return 0; } break; case 'q': VAR_5->qflag = 1; break; case 'v': VAR_5->vflag = 1; break; default: g_free(VAR_5); return qemuio_command_usage(&aio_read_cmd); } } if (optind > VAR_1 - 2) { g_free(VAR_5); return qemuio_command_usage(&aio_read_cmd); } VAR_5->offset = cvtnum(VAR_2[optind]); if (VAR_5->offset < 0) { printf("non-numeric length argument -- %s\n", VAR_2[optind]); g_free(VAR_5); return 0; } optind++; if (VAR_5->offset & 0x1ff) { printf("offset %" PRId64 " is not sector aligned\n", VAR_5->offset); g_free(VAR_5); return 0; } VAR_3 = VAR_1 - optind; VAR_5->buf = create_iovec(VAR_0, &VAR_5->qiov, &VAR_2[optind], VAR_3, 0xab); if (VAR_5->buf == NULL) { g_free(VAR_5); return 0; } gettimeofday(&VAR_5->t1, NULL); block_acct_start(blk_get_stats(VAR_0), &VAR_5->acct, VAR_5->qiov.size, BLOCK_ACCT_READ); blk_aio_readv(VAR_0, VAR_5->offset >> 9, &VAR_5->qiov, VAR_5->qiov.size >> 9, aio_read_done, VAR_5); return 0; }
[ "static int FUNC_0(BlockBackend *VAR_0, int VAR_1, char **VAR_2)\n{", "int VAR_3, VAR_4;", "struct aio_ctx *VAR_5 = g_new0(struct aio_ctx, 1);", "VAR_5->VAR_0 = VAR_0;", "while ((VAR_4 = getopt(VAR_1, VAR_2, \"CP:qv\")) != EOF) {", "switch (VAR_4) {", "case 'C':\nVAR_5->Cflag = 1;", "break;", "case 'P':\nVAR_5->Pflag = 1;", "VAR_5->pattern = parse_pattern(optarg);", "if (VAR_5->pattern < 0) {", "g_free(VAR_5);", "return 0;", "}", "break;", "case 'q':\nVAR_5->qflag = 1;", "break;", "case 'v':\nVAR_5->vflag = 1;", "break;", "default:\ng_free(VAR_5);", "return qemuio_command_usage(&aio_read_cmd);", "}", "}", "if (optind > VAR_1 - 2) {", "g_free(VAR_5);", "return qemuio_command_usage(&aio_read_cmd);", "}", "VAR_5->offset = cvtnum(VAR_2[optind]);", "if (VAR_5->offset < 0) {", "printf(\"non-numeric length argument -- %s\\n\", VAR_2[optind]);", "g_free(VAR_5);", "return 0;", "}", "optind++;", "if (VAR_5->offset & 0x1ff) {", "printf(\"offset %\" PRId64 \" is not sector aligned\\n\",\nVAR_5->offset);", "g_free(VAR_5);", "return 0;", "}", "VAR_3 = VAR_1 - optind;", "VAR_5->buf = create_iovec(VAR_0, &VAR_5->qiov, &VAR_2[optind], VAR_3, 0xab);", "if (VAR_5->buf == NULL) {", "g_free(VAR_5);", "return 0;", "}", "gettimeofday(&VAR_5->t1, NULL);", "block_acct_start(blk_get_stats(VAR_0), &VAR_5->acct, VAR_5->qiov.size,\nBLOCK_ACCT_READ);", "blk_aio_readv(VAR_0, VAR_5->offset >> 9, &VAR_5->qiov,\nVAR_5->qiov.size >> 9, aio_read_done, VAR_5);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 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 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 89 ], [ 91, 93 ], [ 95 ], [ 97 ], [ 99 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 117 ], [ 119, 121 ], [ 123, 125 ], [ 127 ], [ 129 ] ]
14,731
static inline void _cpu_ppc_store_decr(PowerPCCPU *cpu, uint32_t decr, uint32_t value, int is_excp) { ppc_tb_t *tb_env = cpu->env.tb_env; __cpu_ppc_store_decr(cpu, &tb_env->decr_next, tb_env->decr_timer, &cpu_ppc_decr_excp, decr, value, is_excp); }
false
qemu
e81a982aa5398269a2cc344091ffa4930bdd242f
static inline void _cpu_ppc_store_decr(PowerPCCPU *cpu, uint32_t decr, uint32_t value, int is_excp) { ppc_tb_t *tb_env = cpu->env.tb_env; __cpu_ppc_store_decr(cpu, &tb_env->decr_next, tb_env->decr_timer, &cpu_ppc_decr_excp, decr, value, is_excp); }
{ "code": [], "line_no": [] }
static inline void FUNC_0(PowerPCCPU *VAR_0, uint32_t VAR_1, uint32_t VAR_2, int VAR_3) { ppc_tb_t *tb_env = VAR_0->env.tb_env; __cpu_ppc_store_decr(VAR_0, &tb_env->decr_next, tb_env->decr_timer, &cpu_ppc_decr_excp, VAR_1, VAR_2, VAR_3); }
[ "static inline void FUNC_0(PowerPCCPU *VAR_0, uint32_t VAR_1,\nuint32_t VAR_2, int VAR_3)\n{", "ppc_tb_t *tb_env = VAR_0->env.tb_env;", "__cpu_ppc_store_decr(VAR_0, &tb_env->decr_next, tb_env->decr_timer,\n&cpu_ppc_decr_excp, VAR_1, VAR_2, VAR_3);", "}" ]
[ 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11, 13 ], [ 15 ] ]
14,732
static GSList *gd_vc_init(GtkDisplayState *s, VirtualConsole *vc, int index, GSList *group, GtkWidget *view_menu) { const char *label; char buffer[32]; char path[32]; #if VTE_CHECK_VERSION(0, 26, 0) VtePty *pty; #endif GIOChannel *chan; GtkWidget *scrolled_window; GtkAdjustment *vadjustment; int master_fd, slave_fd; snprintf(buffer, sizeof(buffer), "vc%d", index); snprintf(path, sizeof(path), "<QEMU>/View/VC%d", index); vc->chr = vcs[index]; if (vc->chr->label) { label = vc->chr->label; } else { label = buffer; } vc->menu_item = gtk_radio_menu_item_new_with_mnemonic(group, label); group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(vc->menu_item)); gtk_menu_item_set_accel_path(GTK_MENU_ITEM(vc->menu_item), path); gtk_accel_map_add_entry(path, GDK_KEY_2 + index, GDK_CONTROL_MASK | GDK_MOD1_MASK); vc->terminal = vte_terminal_new(); master_fd = qemu_openpty_raw(&slave_fd, NULL); g_assert(master_fd != -1); #if VTE_CHECK_VERSION(0, 26, 0) pty = vte_pty_new_foreign(master_fd, NULL); vte_terminal_set_pty_object(VTE_TERMINAL(vc->terminal), pty); #else vte_terminal_set_pty(VTE_TERMINAL(vc->terminal), master_fd); #endif vte_terminal_set_scrollback_lines(VTE_TERMINAL(vc->terminal), -1); vadjustment = vte_terminal_get_adjustment(VTE_TERMINAL(vc->terminal)); scrolled_window = gtk_scrolled_window_new(NULL, vadjustment); gtk_container_add(GTK_CONTAINER(scrolled_window), vc->terminal); vte_terminal_set_size(VTE_TERMINAL(vc->terminal), 80, 25); vc->fd = slave_fd; vc->chr->opaque = vc; vc->scrolled_window = scrolled_window; gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(vc->scrolled_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_notebook_append_page(GTK_NOTEBOOK(s->notebook), scrolled_window, gtk_label_new(label)); g_signal_connect(vc->menu_item, "activate", G_CALLBACK(gd_menu_switch_vc), s); gtk_menu_shell_append(GTK_MENU_SHELL(view_menu), vc->menu_item); qemu_chr_be_generic_open(vc->chr); if (vc->chr->init) { vc->chr->init(vc->chr); } chan = g_io_channel_unix_new(vc->fd); g_io_add_watch(chan, G_IO_IN, gd_vc_in, vc); return group; }
false
qemu
b1e749c02172583ca85bb3a964a9b39221f9ac39
static GSList *gd_vc_init(GtkDisplayState *s, VirtualConsole *vc, int index, GSList *group, GtkWidget *view_menu) { const char *label; char buffer[32]; char path[32]; #if VTE_CHECK_VERSION(0, 26, 0) VtePty *pty; #endif GIOChannel *chan; GtkWidget *scrolled_window; GtkAdjustment *vadjustment; int master_fd, slave_fd; snprintf(buffer, sizeof(buffer), "vc%d", index); snprintf(path, sizeof(path), "<QEMU>/View/VC%d", index); vc->chr = vcs[index]; if (vc->chr->label) { label = vc->chr->label; } else { label = buffer; } vc->menu_item = gtk_radio_menu_item_new_with_mnemonic(group, label); group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(vc->menu_item)); gtk_menu_item_set_accel_path(GTK_MENU_ITEM(vc->menu_item), path); gtk_accel_map_add_entry(path, GDK_KEY_2 + index, GDK_CONTROL_MASK | GDK_MOD1_MASK); vc->terminal = vte_terminal_new(); master_fd = qemu_openpty_raw(&slave_fd, NULL); g_assert(master_fd != -1); #if VTE_CHECK_VERSION(0, 26, 0) pty = vte_pty_new_foreign(master_fd, NULL); vte_terminal_set_pty_object(VTE_TERMINAL(vc->terminal), pty); #else vte_terminal_set_pty(VTE_TERMINAL(vc->terminal), master_fd); #endif vte_terminal_set_scrollback_lines(VTE_TERMINAL(vc->terminal), -1); vadjustment = vte_terminal_get_adjustment(VTE_TERMINAL(vc->terminal)); scrolled_window = gtk_scrolled_window_new(NULL, vadjustment); gtk_container_add(GTK_CONTAINER(scrolled_window), vc->terminal); vte_terminal_set_size(VTE_TERMINAL(vc->terminal), 80, 25); vc->fd = slave_fd; vc->chr->opaque = vc; vc->scrolled_window = scrolled_window; gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(vc->scrolled_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_notebook_append_page(GTK_NOTEBOOK(s->notebook), scrolled_window, gtk_label_new(label)); g_signal_connect(vc->menu_item, "activate", G_CALLBACK(gd_menu_switch_vc), s); gtk_menu_shell_append(GTK_MENU_SHELL(view_menu), vc->menu_item); qemu_chr_be_generic_open(vc->chr); if (vc->chr->init) { vc->chr->init(vc->chr); } chan = g_io_channel_unix_new(vc->fd); g_io_add_watch(chan, G_IO_IN, gd_vc_in, vc); return group; }
{ "code": [], "line_no": [] }
static GSList *FUNC_0(GtkDisplayState *s, VirtualConsole *vc, int index, GSList *group, GtkWidget *view_menu) { const char *VAR_0; char VAR_1[32]; char VAR_2[32]; #if VTE_CHECK_VERSION(0, 26, 0) VtePty *pty; #endif GIOChannel *chan; GtkWidget *scrolled_window; GtkAdjustment *vadjustment; int VAR_3, VAR_4; snprintf(VAR_1, sizeof(VAR_1), "vc%d", index); snprintf(VAR_2, sizeof(VAR_2), "<QEMU>/View/VC%d", index); vc->chr = vcs[index]; if (vc->chr->VAR_0) { VAR_0 = vc->chr->VAR_0; } else { VAR_0 = VAR_1; } vc->menu_item = gtk_radio_menu_item_new_with_mnemonic(group, VAR_0); group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(vc->menu_item)); gtk_menu_item_set_accel_path(GTK_MENU_ITEM(vc->menu_item), VAR_2); gtk_accel_map_add_entry(VAR_2, GDK_KEY_2 + index, GDK_CONTROL_MASK | GDK_MOD1_MASK); vc->terminal = vte_terminal_new(); VAR_3 = qemu_openpty_raw(&VAR_4, NULL); g_assert(VAR_3 != -1); #if VTE_CHECK_VERSION(0, 26, 0) pty = vte_pty_new_foreign(VAR_3, NULL); vte_terminal_set_pty_object(VTE_TERMINAL(vc->terminal), pty); #else vte_terminal_set_pty(VTE_TERMINAL(vc->terminal), VAR_3); #endif vte_terminal_set_scrollback_lines(VTE_TERMINAL(vc->terminal), -1); vadjustment = vte_terminal_get_adjustment(VTE_TERMINAL(vc->terminal)); scrolled_window = gtk_scrolled_window_new(NULL, vadjustment); gtk_container_add(GTK_CONTAINER(scrolled_window), vc->terminal); vte_terminal_set_size(VTE_TERMINAL(vc->terminal), 80, 25); vc->fd = VAR_4; vc->chr->opaque = vc; vc->scrolled_window = scrolled_window; gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(vc->scrolled_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_notebook_append_page(GTK_NOTEBOOK(s->notebook), scrolled_window, gtk_label_new(VAR_0)); g_signal_connect(vc->menu_item, "activate", G_CALLBACK(gd_menu_switch_vc), s); gtk_menu_shell_append(GTK_MENU_SHELL(view_menu), vc->menu_item); qemu_chr_be_generic_open(vc->chr); if (vc->chr->init) { vc->chr->init(vc->chr); } chan = g_io_channel_unix_new(vc->fd); g_io_add_watch(chan, G_IO_IN, gd_vc_in, vc); return group; }
[ "static GSList *FUNC_0(GtkDisplayState *s, VirtualConsole *vc, int index, GSList *group,\nGtkWidget *view_menu)\n{", "const char *VAR_0;", "char VAR_1[32];", "char VAR_2[32];", "#if VTE_CHECK_VERSION(0, 26, 0)\nVtePty *pty;", "#endif\nGIOChannel *chan;", "GtkWidget *scrolled_window;", "GtkAdjustment *vadjustment;", "int VAR_3, VAR_4;", "snprintf(VAR_1, sizeof(VAR_1), \"vc%d\", index);", "snprintf(VAR_2, sizeof(VAR_2), \"<QEMU>/View/VC%d\", index);", "vc->chr = vcs[index];", "if (vc->chr->VAR_0) {", "VAR_0 = vc->chr->VAR_0;", "} else {", "VAR_0 = VAR_1;", "}", "vc->menu_item = gtk_radio_menu_item_new_with_mnemonic(group, VAR_0);", "group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(vc->menu_item));", "gtk_menu_item_set_accel_path(GTK_MENU_ITEM(vc->menu_item), VAR_2);", "gtk_accel_map_add_entry(VAR_2, GDK_KEY_2 + index, GDK_CONTROL_MASK | GDK_MOD1_MASK);", "vc->terminal = vte_terminal_new();", "VAR_3 = qemu_openpty_raw(&VAR_4, NULL);", "g_assert(VAR_3 != -1);", "#if VTE_CHECK_VERSION(0, 26, 0)\npty = vte_pty_new_foreign(VAR_3, NULL);", "vte_terminal_set_pty_object(VTE_TERMINAL(vc->terminal), pty);", "#else\nvte_terminal_set_pty(VTE_TERMINAL(vc->terminal), VAR_3);", "#endif\nvte_terminal_set_scrollback_lines(VTE_TERMINAL(vc->terminal), -1);", "vadjustment = vte_terminal_get_adjustment(VTE_TERMINAL(vc->terminal));", "scrolled_window = gtk_scrolled_window_new(NULL, vadjustment);", "gtk_container_add(GTK_CONTAINER(scrolled_window), vc->terminal);", "vte_terminal_set_size(VTE_TERMINAL(vc->terminal), 80, 25);", "vc->fd = VAR_4;", "vc->chr->opaque = vc;", "vc->scrolled_window = scrolled_window;", "gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(vc->scrolled_window),\nGTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);", "gtk_notebook_append_page(GTK_NOTEBOOK(s->notebook), scrolled_window, gtk_label_new(VAR_0));", "g_signal_connect(vc->menu_item, \"activate\",\nG_CALLBACK(gd_menu_switch_vc), s);", "gtk_menu_shell_append(GTK_MENU_SHELL(view_menu), vc->menu_item);", "qemu_chr_be_generic_open(vc->chr);", "if (vc->chr->init) {", "vc->chr->init(vc->chr);", "}", "chan = g_io_channel_unix_new(vc->fd);", "g_io_add_watch(chan, G_IO_IN, gd_vc_in, vc);", "return group;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 29 ], [ 31 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 65 ], [ 67 ], [ 71, 73 ], [ 75 ], [ 77, 79 ], [ 81, 85 ], [ 89 ], [ 93 ], [ 95 ], [ 99 ], [ 103 ], [ 105 ], [ 107 ], [ 111, 113 ], [ 117 ], [ 119, 121 ], [ 125 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 139 ], [ 141 ], [ 145 ], [ 147 ] ]
14,733
static void patch_reloc(uint8_t *code_ptr, int type, tcg_target_long value, tcg_target_long addend) { value += addend; switch (type) { case R_SPARC_32: if (value != (uint32_t)value) tcg_abort(); *(uint32_t *)code_ptr = value; break; case R_SPARC_WDISP22: value -= (long)code_ptr; value >>= 2; if (!check_fit(value, 22)) tcg_abort(); *(uint32_t *)code_ptr = ((*(uint32_t *)code_ptr) & ~0x3fffff) | value; break; default: tcg_abort(); } }
false
qemu
57e49b40745ceb6c198cc58274b705afb5f20493
static void patch_reloc(uint8_t *code_ptr, int type, tcg_target_long value, tcg_target_long addend) { value += addend; switch (type) { case R_SPARC_32: if (value != (uint32_t)value) tcg_abort(); *(uint32_t *)code_ptr = value; break; case R_SPARC_WDISP22: value -= (long)code_ptr; value >>= 2; if (!check_fit(value, 22)) tcg_abort(); *(uint32_t *)code_ptr = ((*(uint32_t *)code_ptr) & ~0x3fffff) | value; break; default: tcg_abort(); } }
{ "code": [], "line_no": [] }
static void FUNC_0(uint8_t *VAR_0, int VAR_1, tcg_target_long VAR_2, tcg_target_long VAR_3) { VAR_2 += VAR_3; switch (VAR_1) { case R_SPARC_32: if (VAR_2 != (uint32_t)VAR_2) tcg_abort(); *(uint32_t *)VAR_0 = VAR_2; break; case R_SPARC_WDISP22: VAR_2 -= (long)VAR_0; VAR_2 >>= 2; if (!check_fit(VAR_2, 22)) tcg_abort(); *(uint32_t *)VAR_0 = ((*(uint32_t *)VAR_0) & ~0x3fffff) | VAR_2; break; default: tcg_abort(); } }
[ "static void FUNC_0(uint8_t *VAR_0, int VAR_1,\ntcg_target_long VAR_2, tcg_target_long VAR_3)\n{", "VAR_2 += VAR_3;", "switch (VAR_1) {", "case R_SPARC_32:\nif (VAR_2 != (uint32_t)VAR_2)\ntcg_abort();", "*(uint32_t *)VAR_0 = VAR_2;", "break;", "case R_SPARC_WDISP22:\nVAR_2 -= (long)VAR_0;", "VAR_2 >>= 2;", "if (!check_fit(VAR_2, 22))\ntcg_abort();", "*(uint32_t *)VAR_0 = ((*(uint32_t *)VAR_0) & ~0x3fffff) | VAR_2;", "break;", "default:\ntcg_abort();", "}", "}" ]
[ 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 ] ]
14,734
static void frame_end(MpegEncContext *s) { int i; if (s->unrestricted_mv && s->current_picture.reference && !s->intra_only) { const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->avctx->pix_fmt); int hshift = desc->log2_chroma_w; int vshift = desc->log2_chroma_h; s->mpvencdsp.draw_edges(s->current_picture.f->data[0], s->linesize, s->h_edge_pos, s->v_edge_pos, EDGE_WIDTH, EDGE_WIDTH, EDGE_TOP | EDGE_BOTTOM); s->mpvencdsp.draw_edges(s->current_picture.f->data[1], s->uvlinesize, s->h_edge_pos >> hshift, s->v_edge_pos >> vshift, EDGE_WIDTH >> hshift, EDGE_WIDTH >> vshift, EDGE_TOP | EDGE_BOTTOM); s->mpvencdsp.draw_edges(s->current_picture.f->data[2], s->uvlinesize, s->h_edge_pos >> hshift, s->v_edge_pos >> vshift, EDGE_WIDTH >> hshift, EDGE_WIDTH >> vshift, EDGE_TOP | EDGE_BOTTOM); } emms_c(); s->last_pict_type = s->pict_type; s->last_lambda_for [s->pict_type] = s->current_picture_ptr->f->quality; if (s->pict_type!= AV_PICTURE_TYPE_B) s->last_non_b_pict_type = s->pict_type; if (s->encoding) { /* release non-reference frames */ for (i = 0; i < MAX_PICTURE_COUNT; i++) { if (!s->picture[i].reference) ff_mpeg_unref_picture(s->avctx, &s->picture[i]); } } s->avctx->coded_frame = s->current_picture_ptr->f; }
false
FFmpeg
d6604b29ef544793479d7fb4e05ef6622bb3e534
static void frame_end(MpegEncContext *s) { int i; if (s->unrestricted_mv && s->current_picture.reference && !s->intra_only) { const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->avctx->pix_fmt); int hshift = desc->log2_chroma_w; int vshift = desc->log2_chroma_h; s->mpvencdsp.draw_edges(s->current_picture.f->data[0], s->linesize, s->h_edge_pos, s->v_edge_pos, EDGE_WIDTH, EDGE_WIDTH, EDGE_TOP | EDGE_BOTTOM); s->mpvencdsp.draw_edges(s->current_picture.f->data[1], s->uvlinesize, s->h_edge_pos >> hshift, s->v_edge_pos >> vshift, EDGE_WIDTH >> hshift, EDGE_WIDTH >> vshift, EDGE_TOP | EDGE_BOTTOM); s->mpvencdsp.draw_edges(s->current_picture.f->data[2], s->uvlinesize, s->h_edge_pos >> hshift, s->v_edge_pos >> vshift, EDGE_WIDTH >> hshift, EDGE_WIDTH >> vshift, EDGE_TOP | EDGE_BOTTOM); } emms_c(); s->last_pict_type = s->pict_type; s->last_lambda_for [s->pict_type] = s->current_picture_ptr->f->quality; if (s->pict_type!= AV_PICTURE_TYPE_B) s->last_non_b_pict_type = s->pict_type; if (s->encoding) { for (i = 0; i < MAX_PICTURE_COUNT; i++) { if (!s->picture[i].reference) ff_mpeg_unref_picture(s->avctx, &s->picture[i]); } } s->avctx->coded_frame = s->current_picture_ptr->f; }
{ "code": [], "line_no": [] }
static void FUNC_0(MpegEncContext *VAR_0) { int VAR_1; if (VAR_0->unrestricted_mv && VAR_0->current_picture.reference && !VAR_0->intra_only) { const AVPixFmtDescriptor *VAR_2 = av_pix_fmt_desc_get(VAR_0->avctx->pix_fmt); int VAR_3 = VAR_2->log2_chroma_w; int VAR_4 = VAR_2->log2_chroma_h; VAR_0->mpvencdsp.draw_edges(VAR_0->current_picture.f->data[0], VAR_0->linesize, VAR_0->h_edge_pos, VAR_0->v_edge_pos, EDGE_WIDTH, EDGE_WIDTH, EDGE_TOP | EDGE_BOTTOM); VAR_0->mpvencdsp.draw_edges(VAR_0->current_picture.f->data[1], VAR_0->uvlinesize, VAR_0->h_edge_pos >> VAR_3, VAR_0->v_edge_pos >> VAR_4, EDGE_WIDTH >> VAR_3, EDGE_WIDTH >> VAR_4, EDGE_TOP | EDGE_BOTTOM); VAR_0->mpvencdsp.draw_edges(VAR_0->current_picture.f->data[2], VAR_0->uvlinesize, VAR_0->h_edge_pos >> VAR_3, VAR_0->v_edge_pos >> VAR_4, EDGE_WIDTH >> VAR_3, EDGE_WIDTH >> VAR_4, EDGE_TOP | EDGE_BOTTOM); } emms_c(); VAR_0->last_pict_type = VAR_0->pict_type; VAR_0->last_lambda_for [VAR_0->pict_type] = VAR_0->current_picture_ptr->f->quality; if (VAR_0->pict_type!= AV_PICTURE_TYPE_B) VAR_0->last_non_b_pict_type = VAR_0->pict_type; if (VAR_0->encoding) { for (VAR_1 = 0; VAR_1 < MAX_PICTURE_COUNT; VAR_1++) { if (!VAR_0->picture[VAR_1].reference) ff_mpeg_unref_picture(VAR_0->avctx, &VAR_0->picture[VAR_1]); } } VAR_0->avctx->coded_frame = VAR_0->current_picture_ptr->f; }
[ "static void FUNC_0(MpegEncContext *VAR_0)\n{", "int VAR_1;", "if (VAR_0->unrestricted_mv &&\nVAR_0->current_picture.reference &&\n!VAR_0->intra_only) {", "const AVPixFmtDescriptor *VAR_2 = av_pix_fmt_desc_get(VAR_0->avctx->pix_fmt);", "int VAR_3 = VAR_2->log2_chroma_w;", "int VAR_4 = VAR_2->log2_chroma_h;", "VAR_0->mpvencdsp.draw_edges(VAR_0->current_picture.f->data[0], VAR_0->linesize,\nVAR_0->h_edge_pos, VAR_0->v_edge_pos,\nEDGE_WIDTH, EDGE_WIDTH,\nEDGE_TOP | EDGE_BOTTOM);", "VAR_0->mpvencdsp.draw_edges(VAR_0->current_picture.f->data[1], VAR_0->uvlinesize,\nVAR_0->h_edge_pos >> VAR_3,\nVAR_0->v_edge_pos >> VAR_4,\nEDGE_WIDTH >> VAR_3,\nEDGE_WIDTH >> VAR_4,\nEDGE_TOP | EDGE_BOTTOM);", "VAR_0->mpvencdsp.draw_edges(VAR_0->current_picture.f->data[2], VAR_0->uvlinesize,\nVAR_0->h_edge_pos >> VAR_3,\nVAR_0->v_edge_pos >> VAR_4,\nEDGE_WIDTH >> VAR_3,\nEDGE_WIDTH >> VAR_4,\nEDGE_TOP | EDGE_BOTTOM);", "}", "emms_c();", "VAR_0->last_pict_type = VAR_0->pict_type;", "VAR_0->last_lambda_for [VAR_0->pict_type] = VAR_0->current_picture_ptr->f->quality;", "if (VAR_0->pict_type!= AV_PICTURE_TYPE_B)\nVAR_0->last_non_b_pict_type = VAR_0->pict_type;", "if (VAR_0->encoding) {", "for (VAR_1 = 0; VAR_1 < MAX_PICTURE_COUNT; VAR_1++) {", "if (!VAR_0->picture[VAR_1].reference)\nff_mpeg_unref_picture(VAR_0->avctx, &VAR_0->picture[VAR_1]);", "}", "}", "VAR_0->avctx->coded_frame = VAR_0->current_picture_ptr->f;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9, 11, 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21, 23, 25, 27 ], [ 29, 31, 33, 35, 37, 39 ], [ 41, 43, 45, 47, 49, 51 ], [ 53 ], [ 57 ], [ 61 ], [ 63 ], [ 65, 67 ], [ 71 ], [ 75 ], [ 77, 79 ], [ 81 ], [ 83 ], [ 87 ], [ 91 ] ]
14,735
static uint64_t sectors_covered_by_bitmap_cluster(const BDRVQcow2State *s, const BdrvDirtyBitmap *bitmap) { uint32_t sector_granularity = bdrv_dirty_bitmap_granularity(bitmap) >> BDRV_SECTOR_BITS; return (uint64_t)sector_granularity * (s->cluster_size << 3); }
false
qemu
113754f3a83dac7989ca94c4408a494560df1d73
static uint64_t sectors_covered_by_bitmap_cluster(const BDRVQcow2State *s, const BdrvDirtyBitmap *bitmap) { uint32_t sector_granularity = bdrv_dirty_bitmap_granularity(bitmap) >> BDRV_SECTOR_BITS; return (uint64_t)sector_granularity * (s->cluster_size << 3); }
{ "code": [], "line_no": [] }
static uint64_t FUNC_0(const BDRVQcow2State *s, const BdrvDirtyBitmap *bitmap) { uint32_t sector_granularity = bdrv_dirty_bitmap_granularity(bitmap) >> BDRV_SECTOR_BITS; return (uint64_t)sector_granularity * (s->cluster_size << 3); }
[ "static uint64_t FUNC_0(const BDRVQcow2State *s,\nconst BdrvDirtyBitmap *bitmap)\n{", "uint32_t sector_granularity =\nbdrv_dirty_bitmap_granularity(bitmap) >> BDRV_SECTOR_BITS;", "return (uint64_t)sector_granularity * (s->cluster_size << 3);", "}" ]
[ 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7, 9 ], [ 13 ], [ 15 ] ]
14,736
static int vmdk_open_sparse(BlockDriverState *bs, BlockDriverState *file, int flags, char *buf, Error **errp) { uint32_t magic; magic = ldl_be_p(buf); switch (magic) { case VMDK3_MAGIC: return vmdk_open_vmfs_sparse(bs, file, flags, errp); break; case VMDK4_MAGIC: return vmdk_open_vmdk4(bs, file, flags, errp); break; default: return -EMEDIUMTYPE; break; } }
false
qemu
76abe4071d111a9ca6dcc9b9689a831c39ffa718
static int vmdk_open_sparse(BlockDriverState *bs, BlockDriverState *file, int flags, char *buf, Error **errp) { uint32_t magic; magic = ldl_be_p(buf); switch (magic) { case VMDK3_MAGIC: return vmdk_open_vmfs_sparse(bs, file, flags, errp); break; case VMDK4_MAGIC: return vmdk_open_vmdk4(bs, file, flags, errp); break; default: return -EMEDIUMTYPE; break; } }
{ "code": [], "line_no": [] }
static int FUNC_0(BlockDriverState *VAR_0, BlockDriverState *VAR_1, int VAR_2, char *VAR_3, Error **VAR_4) { uint32_t magic; magic = ldl_be_p(VAR_3); switch (magic) { case VMDK3_MAGIC: return vmdk_open_vmfs_sparse(VAR_0, VAR_1, VAR_2, VAR_4); break; case VMDK4_MAGIC: return vmdk_open_vmdk4(VAR_0, VAR_1, VAR_2, VAR_4); break; default: return -EMEDIUMTYPE; break; } }
[ "static int FUNC_0(BlockDriverState *VAR_0,\nBlockDriverState *VAR_1, int VAR_2,\nchar *VAR_3, Error **VAR_4)\n{", "uint32_t magic;", "magic = ldl_be_p(VAR_3);", "switch (magic) {", "case VMDK3_MAGIC:\nreturn vmdk_open_vmfs_sparse(VAR_0, VAR_1, VAR_2, VAR_4);", "break;", "case VMDK4_MAGIC:\nreturn vmdk_open_vmdk4(VAR_0, VAR_1, VAR_2, VAR_4);", "break;", "default:\nreturn -EMEDIUMTYPE;", "break;", "}", "}" ]
[ 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 ] ]
14,737
static void tcg_reg_alloc_op(TCGContext *s, const TCGOpDef *def, TCGOpcode opc, const TCGArg *args, uint16_t dead_args, uint8_t sync_args) { TCGRegSet allocated_regs; int i, k, nb_iargs, nb_oargs, reg; TCGArg arg; const TCGArgConstraint *arg_ct; TCGTemp *ts; TCGArg new_args[TCG_MAX_OP_ARGS]; int const_args[TCG_MAX_OP_ARGS]; nb_oargs = def->nb_oargs; nb_iargs = def->nb_iargs; /* copy constants */ memcpy(new_args + nb_oargs + nb_iargs, args + nb_oargs + nb_iargs, sizeof(TCGArg) * def->nb_cargs); /* satisfy input constraints */ tcg_regset_set(allocated_regs, s->reserved_regs); for(k = 0; k < nb_iargs; k++) { i = def->sorted_args[nb_oargs + k]; arg = args[i]; arg_ct = &def->args_ct[i]; ts = &s->temps[arg]; if (ts->val_type == TEMP_VAL_MEM) { reg = tcg_reg_alloc(s, arg_ct->u.regs, allocated_regs); tcg_out_ld(s, ts->type, reg, ts->mem_reg, ts->mem_offset); ts->val_type = TEMP_VAL_REG; ts->reg = reg; ts->mem_coherent = 1; s->reg_to_temp[reg] = arg; } else if (ts->val_type == TEMP_VAL_CONST) { if (tcg_target_const_match(ts->val, ts->type, arg_ct)) { /* constant is OK for instruction */ const_args[i] = 1; new_args[i] = ts->val; goto iarg_end; } else { /* need to move to a register */ reg = tcg_reg_alloc(s, arg_ct->u.regs, allocated_regs); tcg_out_movi(s, ts->type, reg, ts->val); ts->val_type = TEMP_VAL_REG; ts->reg = reg; ts->mem_coherent = 0; s->reg_to_temp[reg] = arg; } } assert(ts->val_type == TEMP_VAL_REG); if (arg_ct->ct & TCG_CT_IALIAS) { if (ts->fixed_reg) { /* if fixed register, we must allocate a new register if the alias is not the same register */ if (arg != args[arg_ct->alias_index]) goto allocate_in_reg; } else { /* if the input is aliased to an output and if it is not dead after the instruction, we must allocate a new register and move it */ if (!IS_DEAD_ARG(i)) { goto allocate_in_reg; } /* check if the current register has already been allocated for another input aliased to an output */ int k2, i2; for (k2 = 0 ; k2 < k ; k2++) { i2 = def->sorted_args[nb_oargs + k2]; if ((def->args_ct[i2].ct & TCG_CT_IALIAS) && (new_args[i2] == ts->reg)) { goto allocate_in_reg; } } } } reg = ts->reg; if (tcg_regset_test_reg(arg_ct->u.regs, reg)) { /* nothing to do : the constraint is satisfied */ } else { allocate_in_reg: /* allocate a new register matching the constraint and move the temporary register into it */ reg = tcg_reg_alloc(s, arg_ct->u.regs, allocated_regs); tcg_out_mov(s, ts->type, reg, ts->reg); } new_args[i] = reg; const_args[i] = 0; tcg_regset_set_reg(allocated_regs, reg); iarg_end: ; } /* mark dead temporaries and free the associated registers */ for (i = nb_oargs; i < nb_oargs + nb_iargs; i++) { if (IS_DEAD_ARG(i)) { temp_dead(s, args[i]); } } if (def->flags & TCG_OPF_BB_END) { tcg_reg_alloc_bb_end(s, allocated_regs); } else { if (def->flags & TCG_OPF_CALL_CLOBBER) { /* XXX: permit generic clobber register list ? */ for(reg = 0; reg < TCG_TARGET_NB_REGS; reg++) { if (tcg_regset_test_reg(tcg_target_call_clobber_regs, reg)) { tcg_reg_free(s, reg); } } } if (def->flags & TCG_OPF_SIDE_EFFECTS) { /* sync globals if the op has side effects and might trigger an exception. */ sync_globals(s, allocated_regs); } /* satisfy the output constraints */ tcg_regset_set(allocated_regs, s->reserved_regs); for(k = 0; k < nb_oargs; k++) { i = def->sorted_args[k]; arg = args[i]; arg_ct = &def->args_ct[i]; ts = &s->temps[arg]; if (arg_ct->ct & TCG_CT_ALIAS) { reg = new_args[arg_ct->alias_index]; } else { /* if fixed register, we try to use it */ reg = ts->reg; if (ts->fixed_reg && tcg_regset_test_reg(arg_ct->u.regs, reg)) { goto oarg_end; } reg = tcg_reg_alloc(s, arg_ct->u.regs, allocated_regs); } tcg_regset_set_reg(allocated_regs, reg); /* if a fixed register is used, then a move will be done afterwards */ if (!ts->fixed_reg) { if (ts->val_type == TEMP_VAL_REG) { s->reg_to_temp[ts->reg] = -1; } ts->val_type = TEMP_VAL_REG; ts->reg = reg; /* temp value is modified, so the value kept in memory is potentially not the same */ ts->mem_coherent = 0; s->reg_to_temp[reg] = arg; } oarg_end: new_args[i] = reg; } } /* emit instruction */ tcg_out_op(s, opc, new_args, const_args); /* move the outputs in the correct register if needed */ for(i = 0; i < nb_oargs; i++) { ts = &s->temps[args[i]]; reg = new_args[i]; if (ts->fixed_reg && ts->reg != reg) { tcg_out_mov(s, ts->type, ts->reg, reg); } if (NEED_SYNC_ARG(i)) { tcg_reg_sync(s, reg); } if (IS_DEAD_ARG(i)) { temp_dead(s, args[i]); } } }
false
qemu
b3a62939561e07bc34493444fa926b6137cba4e8
static void tcg_reg_alloc_op(TCGContext *s, const TCGOpDef *def, TCGOpcode opc, const TCGArg *args, uint16_t dead_args, uint8_t sync_args) { TCGRegSet allocated_regs; int i, k, nb_iargs, nb_oargs, reg; TCGArg arg; const TCGArgConstraint *arg_ct; TCGTemp *ts; TCGArg new_args[TCG_MAX_OP_ARGS]; int const_args[TCG_MAX_OP_ARGS]; nb_oargs = def->nb_oargs; nb_iargs = def->nb_iargs; memcpy(new_args + nb_oargs + nb_iargs, args + nb_oargs + nb_iargs, sizeof(TCGArg) * def->nb_cargs); tcg_regset_set(allocated_regs, s->reserved_regs); for(k = 0; k < nb_iargs; k++) { i = def->sorted_args[nb_oargs + k]; arg = args[i]; arg_ct = &def->args_ct[i]; ts = &s->temps[arg]; if (ts->val_type == TEMP_VAL_MEM) { reg = tcg_reg_alloc(s, arg_ct->u.regs, allocated_regs); tcg_out_ld(s, ts->type, reg, ts->mem_reg, ts->mem_offset); ts->val_type = TEMP_VAL_REG; ts->reg = reg; ts->mem_coherent = 1; s->reg_to_temp[reg] = arg; } else if (ts->val_type == TEMP_VAL_CONST) { if (tcg_target_const_match(ts->val, ts->type, arg_ct)) { const_args[i] = 1; new_args[i] = ts->val; goto iarg_end; } else { reg = tcg_reg_alloc(s, arg_ct->u.regs, allocated_regs); tcg_out_movi(s, ts->type, reg, ts->val); ts->val_type = TEMP_VAL_REG; ts->reg = reg; ts->mem_coherent = 0; s->reg_to_temp[reg] = arg; } } assert(ts->val_type == TEMP_VAL_REG); if (arg_ct->ct & TCG_CT_IALIAS) { if (ts->fixed_reg) { if (arg != args[arg_ct->alias_index]) goto allocate_in_reg; } else { if (!IS_DEAD_ARG(i)) { goto allocate_in_reg; } int k2, i2; for (k2 = 0 ; k2 < k ; k2++) { i2 = def->sorted_args[nb_oargs + k2]; if ((def->args_ct[i2].ct & TCG_CT_IALIAS) && (new_args[i2] == ts->reg)) { goto allocate_in_reg; } } } } reg = ts->reg; if (tcg_regset_test_reg(arg_ct->u.regs, reg)) { } else { allocate_in_reg: reg = tcg_reg_alloc(s, arg_ct->u.regs, allocated_regs); tcg_out_mov(s, ts->type, reg, ts->reg); } new_args[i] = reg; const_args[i] = 0; tcg_regset_set_reg(allocated_regs, reg); iarg_end: ; } for (i = nb_oargs; i < nb_oargs + nb_iargs; i++) { if (IS_DEAD_ARG(i)) { temp_dead(s, args[i]); } } if (def->flags & TCG_OPF_BB_END) { tcg_reg_alloc_bb_end(s, allocated_regs); } else { if (def->flags & TCG_OPF_CALL_CLOBBER) { for(reg = 0; reg < TCG_TARGET_NB_REGS; reg++) { if (tcg_regset_test_reg(tcg_target_call_clobber_regs, reg)) { tcg_reg_free(s, reg); } } } if (def->flags & TCG_OPF_SIDE_EFFECTS) { sync_globals(s, allocated_regs); } tcg_regset_set(allocated_regs, s->reserved_regs); for(k = 0; k < nb_oargs; k++) { i = def->sorted_args[k]; arg = args[i]; arg_ct = &def->args_ct[i]; ts = &s->temps[arg]; if (arg_ct->ct & TCG_CT_ALIAS) { reg = new_args[arg_ct->alias_index]; } else { reg = ts->reg; if (ts->fixed_reg && tcg_regset_test_reg(arg_ct->u.regs, reg)) { goto oarg_end; } reg = tcg_reg_alloc(s, arg_ct->u.regs, allocated_regs); } tcg_regset_set_reg(allocated_regs, reg); if (!ts->fixed_reg) { if (ts->val_type == TEMP_VAL_REG) { s->reg_to_temp[ts->reg] = -1; } ts->val_type = TEMP_VAL_REG; ts->reg = reg; ts->mem_coherent = 0; s->reg_to_temp[reg] = arg; } oarg_end: new_args[i] = reg; } } tcg_out_op(s, opc, new_args, const_args); for(i = 0; i < nb_oargs; i++) { ts = &s->temps[args[i]]; reg = new_args[i]; if (ts->fixed_reg && ts->reg != reg) { tcg_out_mov(s, ts->type, ts->reg, reg); } if (NEED_SYNC_ARG(i)) { tcg_reg_sync(s, reg); } if (IS_DEAD_ARG(i)) { temp_dead(s, args[i]); } } }
{ "code": [], "line_no": [] }
static void FUNC_0(TCGContext *VAR_0, const TCGOpDef *VAR_1, TCGOpcode VAR_2, const TCGArg *VAR_3, uint16_t VAR_4, uint8_t VAR_5) { TCGRegSet allocated_regs; int VAR_6, VAR_7, VAR_8, VAR_9, VAR_10; TCGArg arg; const TCGArgConstraint *VAR_11; TCGTemp *ts; TCGArg new_args[TCG_MAX_OP_ARGS]; int VAR_12[TCG_MAX_OP_ARGS]; VAR_9 = VAR_1->VAR_9; VAR_8 = VAR_1->VAR_8; memcpy(new_args + VAR_9 + VAR_8, VAR_3 + VAR_9 + VAR_8, sizeof(TCGArg) * VAR_1->nb_cargs); tcg_regset_set(allocated_regs, VAR_0->reserved_regs); for(VAR_7 = 0; VAR_7 < VAR_8; VAR_7++) { VAR_6 = VAR_1->sorted_args[VAR_9 + VAR_7]; arg = VAR_3[VAR_6]; VAR_11 = &VAR_1->args_ct[VAR_6]; ts = &VAR_0->temps[arg]; if (ts->val_type == TEMP_VAL_MEM) { VAR_10 = tcg_reg_alloc(VAR_0, VAR_11->u.regs, allocated_regs); tcg_out_ld(VAR_0, ts->type, VAR_10, ts->mem_reg, ts->mem_offset); ts->val_type = TEMP_VAL_REG; ts->VAR_10 = VAR_10; ts->mem_coherent = 1; VAR_0->reg_to_temp[VAR_10] = arg; } else if (ts->val_type == TEMP_VAL_CONST) { if (tcg_target_const_match(ts->val, ts->type, VAR_11)) { VAR_12[VAR_6] = 1; new_args[VAR_6] = ts->val; goto iarg_end; } else { VAR_10 = tcg_reg_alloc(VAR_0, VAR_11->u.regs, allocated_regs); tcg_out_movi(VAR_0, ts->type, VAR_10, ts->val); ts->val_type = TEMP_VAL_REG; ts->VAR_10 = VAR_10; ts->mem_coherent = 0; VAR_0->reg_to_temp[VAR_10] = arg; } } assert(ts->val_type == TEMP_VAL_REG); if (VAR_11->ct & TCG_CT_IALIAS) { if (ts->fixed_reg) { if (arg != VAR_3[VAR_11->alias_index]) goto allocate_in_reg; } else { if (!IS_DEAD_ARG(VAR_6)) { goto allocate_in_reg; } int VAR_13, VAR_14; for (VAR_13 = 0 ; VAR_13 < VAR_7 ; VAR_13++) { VAR_14 = VAR_1->sorted_args[VAR_9 + VAR_13]; if ((VAR_1->args_ct[VAR_14].ct & TCG_CT_IALIAS) && (new_args[VAR_14] == ts->VAR_10)) { goto allocate_in_reg; } } } } VAR_10 = ts->VAR_10; if (tcg_regset_test_reg(VAR_11->u.regs, VAR_10)) { } else { allocate_in_reg: VAR_10 = tcg_reg_alloc(VAR_0, VAR_11->u.regs, allocated_regs); tcg_out_mov(VAR_0, ts->type, VAR_10, ts->VAR_10); } new_args[VAR_6] = VAR_10; VAR_12[VAR_6] = 0; tcg_regset_set_reg(allocated_regs, VAR_10); iarg_end: ; } for (VAR_6 = VAR_9; VAR_6 < VAR_9 + VAR_8; VAR_6++) { if (IS_DEAD_ARG(VAR_6)) { temp_dead(VAR_0, VAR_3[VAR_6]); } } if (VAR_1->flags & TCG_OPF_BB_END) { tcg_reg_alloc_bb_end(VAR_0, allocated_regs); } else { if (VAR_1->flags & TCG_OPF_CALL_CLOBBER) { for(VAR_10 = 0; VAR_10 < TCG_TARGET_NB_REGS; VAR_10++) { if (tcg_regset_test_reg(tcg_target_call_clobber_regs, VAR_10)) { tcg_reg_free(VAR_0, VAR_10); } } } if (VAR_1->flags & TCG_OPF_SIDE_EFFECTS) { sync_globals(VAR_0, allocated_regs); } tcg_regset_set(allocated_regs, VAR_0->reserved_regs); for(VAR_7 = 0; VAR_7 < VAR_9; VAR_7++) { VAR_6 = VAR_1->sorted_args[VAR_7]; arg = VAR_3[VAR_6]; VAR_11 = &VAR_1->args_ct[VAR_6]; ts = &VAR_0->temps[arg]; if (VAR_11->ct & TCG_CT_ALIAS) { VAR_10 = new_args[VAR_11->alias_index]; } else { VAR_10 = ts->VAR_10; if (ts->fixed_reg && tcg_regset_test_reg(VAR_11->u.regs, VAR_10)) { goto oarg_end; } VAR_10 = tcg_reg_alloc(VAR_0, VAR_11->u.regs, allocated_regs); } tcg_regset_set_reg(allocated_regs, VAR_10); if (!ts->fixed_reg) { if (ts->val_type == TEMP_VAL_REG) { VAR_0->reg_to_temp[ts->VAR_10] = -1; } ts->val_type = TEMP_VAL_REG; ts->VAR_10 = VAR_10; ts->mem_coherent = 0; VAR_0->reg_to_temp[VAR_10] = arg; } oarg_end: new_args[VAR_6] = VAR_10; } } tcg_out_op(VAR_0, VAR_2, new_args, VAR_12); for(VAR_6 = 0; VAR_6 < VAR_9; VAR_6++) { ts = &VAR_0->temps[VAR_3[VAR_6]]; VAR_10 = new_args[VAR_6]; if (ts->fixed_reg && ts->VAR_10 != VAR_10) { tcg_out_mov(VAR_0, ts->type, ts->VAR_10, VAR_10); } if (NEED_SYNC_ARG(VAR_6)) { tcg_reg_sync(VAR_0, VAR_10); } if (IS_DEAD_ARG(VAR_6)) { temp_dead(VAR_0, VAR_3[VAR_6]); } } }
[ "static void FUNC_0(TCGContext *VAR_0,\nconst TCGOpDef *VAR_1, TCGOpcode VAR_2,\nconst TCGArg *VAR_3, uint16_t VAR_4,\nuint8_t VAR_5)\n{", "TCGRegSet allocated_regs;", "int VAR_6, VAR_7, VAR_8, VAR_9, VAR_10;", "TCGArg arg;", "const TCGArgConstraint *VAR_11;", "TCGTemp *ts;", "TCGArg new_args[TCG_MAX_OP_ARGS];", "int VAR_12[TCG_MAX_OP_ARGS];", "VAR_9 = VAR_1->VAR_9;", "VAR_8 = VAR_1->VAR_8;", "memcpy(new_args + VAR_9 + VAR_8,\nVAR_3 + VAR_9 + VAR_8,\nsizeof(TCGArg) * VAR_1->nb_cargs);", "tcg_regset_set(allocated_regs, VAR_0->reserved_regs);", "for(VAR_7 = 0; VAR_7 < VAR_8; VAR_7++) {", "VAR_6 = VAR_1->sorted_args[VAR_9 + VAR_7];", "arg = VAR_3[VAR_6];", "VAR_11 = &VAR_1->args_ct[VAR_6];", "ts = &VAR_0->temps[arg];", "if (ts->val_type == TEMP_VAL_MEM) {", "VAR_10 = tcg_reg_alloc(VAR_0, VAR_11->u.regs, allocated_regs);", "tcg_out_ld(VAR_0, ts->type, VAR_10, ts->mem_reg, ts->mem_offset);", "ts->val_type = TEMP_VAL_REG;", "ts->VAR_10 = VAR_10;", "ts->mem_coherent = 1;", "VAR_0->reg_to_temp[VAR_10] = arg;", "} else if (ts->val_type == TEMP_VAL_CONST) {", "if (tcg_target_const_match(ts->val, ts->type, VAR_11)) {", "VAR_12[VAR_6] = 1;", "new_args[VAR_6] = ts->val;", "goto iarg_end;", "} else {", "VAR_10 = tcg_reg_alloc(VAR_0, VAR_11->u.regs, allocated_regs);", "tcg_out_movi(VAR_0, ts->type, VAR_10, ts->val);", "ts->val_type = TEMP_VAL_REG;", "ts->VAR_10 = VAR_10;", "ts->mem_coherent = 0;", "VAR_0->reg_to_temp[VAR_10] = arg;", "}", "}", "assert(ts->val_type == TEMP_VAL_REG);", "if (VAR_11->ct & TCG_CT_IALIAS) {", "if (ts->fixed_reg) {", "if (arg != VAR_3[VAR_11->alias_index])\ngoto allocate_in_reg;", "} else {", "if (!IS_DEAD_ARG(VAR_6)) {", "goto allocate_in_reg;", "}", "int VAR_13, VAR_14;", "for (VAR_13 = 0 ; VAR_13 < VAR_7 ; VAR_13++) {", "VAR_14 = VAR_1->sorted_args[VAR_9 + VAR_13];", "if ((VAR_1->args_ct[VAR_14].ct & TCG_CT_IALIAS) &&\n(new_args[VAR_14] == ts->VAR_10)) {", "goto allocate_in_reg;", "}", "}", "}", "}", "VAR_10 = ts->VAR_10;", "if (tcg_regset_test_reg(VAR_11->u.regs, VAR_10)) {", "} else {", "allocate_in_reg:\nVAR_10 = tcg_reg_alloc(VAR_0, VAR_11->u.regs, allocated_regs);", "tcg_out_mov(VAR_0, ts->type, VAR_10, ts->VAR_10);", "}", "new_args[VAR_6] = VAR_10;", "VAR_12[VAR_6] = 0;", "tcg_regset_set_reg(allocated_regs, VAR_10);", "iarg_end: ;", "}", "for (VAR_6 = VAR_9; VAR_6 < VAR_9 + VAR_8; VAR_6++) {", "if (IS_DEAD_ARG(VAR_6)) {", "temp_dead(VAR_0, VAR_3[VAR_6]);", "}", "}", "if (VAR_1->flags & TCG_OPF_BB_END) {", "tcg_reg_alloc_bb_end(VAR_0, allocated_regs);", "} else {", "if (VAR_1->flags & TCG_OPF_CALL_CLOBBER) {", "for(VAR_10 = 0; VAR_10 < TCG_TARGET_NB_REGS; VAR_10++) {", "if (tcg_regset_test_reg(tcg_target_call_clobber_regs, VAR_10)) {", "tcg_reg_free(VAR_0, VAR_10);", "}", "}", "}", "if (VAR_1->flags & TCG_OPF_SIDE_EFFECTS) {", "sync_globals(VAR_0, allocated_regs);", "}", "tcg_regset_set(allocated_regs, VAR_0->reserved_regs);", "for(VAR_7 = 0; VAR_7 < VAR_9; VAR_7++) {", "VAR_6 = VAR_1->sorted_args[VAR_7];", "arg = VAR_3[VAR_6];", "VAR_11 = &VAR_1->args_ct[VAR_6];", "ts = &VAR_0->temps[arg];", "if (VAR_11->ct & TCG_CT_ALIAS) {", "VAR_10 = new_args[VAR_11->alias_index];", "} else {", "VAR_10 = ts->VAR_10;", "if (ts->fixed_reg &&\ntcg_regset_test_reg(VAR_11->u.regs, VAR_10)) {", "goto oarg_end;", "}", "VAR_10 = tcg_reg_alloc(VAR_0, VAR_11->u.regs, allocated_regs);", "}", "tcg_regset_set_reg(allocated_regs, VAR_10);", "if (!ts->fixed_reg) {", "if (ts->val_type == TEMP_VAL_REG) {", "VAR_0->reg_to_temp[ts->VAR_10] = -1;", "}", "ts->val_type = TEMP_VAL_REG;", "ts->VAR_10 = VAR_10;", "ts->mem_coherent = 0;", "VAR_0->reg_to_temp[VAR_10] = arg;", "}", "oarg_end:\nnew_args[VAR_6] = VAR_10;", "}", "}", "tcg_out_op(VAR_0, VAR_2, new_args, VAR_12);", "for(VAR_6 = 0; VAR_6 < VAR_9; VAR_6++) {", "ts = &VAR_0->temps[VAR_3[VAR_6]];", "VAR_10 = new_args[VAR_6];", "if (ts->fixed_reg && ts->VAR_10 != VAR_10) {", "tcg_out_mov(VAR_0, ts->type, ts->VAR_10, VAR_10);", "}", "if (NEED_SYNC_ARG(VAR_6)) {", "tcg_reg_sync(VAR_0, VAR_10);", "}", "if (IS_DEAD_ARG(VAR_6)) {", "temp_dead(VAR_0, VAR_3[VAR_6]);", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 35, 37, 39 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 113, 115 ], [ 117 ], [ 125 ], [ 127 ], [ 129 ], [ 135 ], [ 137 ], [ 139 ], [ 141, 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 161 ], [ 163, 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ], [ 229 ], [ 231 ], [ 237 ], [ 239 ], [ 241 ], [ 243 ], [ 245 ], [ 247 ], [ 249 ], [ 251 ], [ 253 ], [ 257 ], [ 259, 261 ], [ 263 ], [ 265 ], [ 267 ], [ 269 ], [ 271 ], [ 275 ], [ 277 ], [ 279 ], [ 281 ], [ 283 ], [ 285 ], [ 291 ], [ 293 ], [ 295 ], [ 297, 299 ], [ 301 ], [ 303 ], [ 309 ], [ 315 ], [ 317 ], [ 319 ], [ 321 ], [ 323 ], [ 325 ], [ 327 ], [ 329 ], [ 331 ], [ 333 ], [ 335 ], [ 337 ], [ 339 ], [ 341 ] ]
14,738
static void arm_cpu_class_init(ObjectClass *oc, void *data) { ARMCPUClass *acc = ARM_CPU_CLASS(oc); CPUClass *cc = CPU_CLASS(acc); DeviceClass *dc = DEVICE_CLASS(oc); acc->parent_realize = dc->realize; dc->realize = arm_cpu_realizefn; dc->props = arm_cpu_properties; acc->parent_reset = cc->reset; cc->reset = arm_cpu_reset; cc->class_by_name = arm_cpu_class_by_name; cc->has_work = arm_cpu_has_work; cc->cpu_exec_interrupt = arm_cpu_exec_interrupt; cc->dump_state = arm_cpu_dump_state; cc->set_pc = arm_cpu_set_pc; cc->gdb_read_register = arm_cpu_gdb_read_register; cc->gdb_write_register = arm_cpu_gdb_write_register; #ifdef CONFIG_USER_ONLY cc->handle_mmu_fault = arm_cpu_handle_mmu_fault; #else cc->do_interrupt = arm_cpu_do_interrupt; cc->get_phys_page_debug = arm_cpu_get_phys_page_debug; cc->vmsd = &vmstate_arm_cpu; cc->virtio_is_big_endian = arm_cpu_is_big_endian; #endif cc->gdb_num_core_regs = 26; cc->gdb_core_xml_file = "arm-core.xml"; cc->gdb_stop_before_watchpoint = true; cc->debug_excp_handler = arm_debug_excp_handler; cc->disas_set_info = arm_disas_set_info; }
true
qemu
4c315c27661502a0813b129e41c0bf640c34a8d6
static void arm_cpu_class_init(ObjectClass *oc, void *data) { ARMCPUClass *acc = ARM_CPU_CLASS(oc); CPUClass *cc = CPU_CLASS(acc); DeviceClass *dc = DEVICE_CLASS(oc); acc->parent_realize = dc->realize; dc->realize = arm_cpu_realizefn; dc->props = arm_cpu_properties; acc->parent_reset = cc->reset; cc->reset = arm_cpu_reset; cc->class_by_name = arm_cpu_class_by_name; cc->has_work = arm_cpu_has_work; cc->cpu_exec_interrupt = arm_cpu_exec_interrupt; cc->dump_state = arm_cpu_dump_state; cc->set_pc = arm_cpu_set_pc; cc->gdb_read_register = arm_cpu_gdb_read_register; cc->gdb_write_register = arm_cpu_gdb_write_register; #ifdef CONFIG_USER_ONLY cc->handle_mmu_fault = arm_cpu_handle_mmu_fault; #else cc->do_interrupt = arm_cpu_do_interrupt; cc->get_phys_page_debug = arm_cpu_get_phys_page_debug; cc->vmsd = &vmstate_arm_cpu; cc->virtio_is_big_endian = arm_cpu_is_big_endian; #endif cc->gdb_num_core_regs = 26; cc->gdb_core_xml_file = "arm-core.xml"; cc->gdb_stop_before_watchpoint = true; cc->debug_excp_handler = arm_debug_excp_handler; cc->disas_set_info = arm_disas_set_info; }
{ "code": [], "line_no": [] }
static void FUNC_0(ObjectClass *VAR_0, void *VAR_1) { ARMCPUClass *acc = ARM_CPU_CLASS(VAR_0); CPUClass *cc = CPU_CLASS(acc); DeviceClass *dc = DEVICE_CLASS(VAR_0); acc->parent_realize = dc->realize; dc->realize = arm_cpu_realizefn; dc->props = arm_cpu_properties; acc->parent_reset = cc->reset; cc->reset = arm_cpu_reset; cc->class_by_name = arm_cpu_class_by_name; cc->has_work = arm_cpu_has_work; cc->cpu_exec_interrupt = arm_cpu_exec_interrupt; cc->dump_state = arm_cpu_dump_state; cc->set_pc = arm_cpu_set_pc; cc->gdb_read_register = arm_cpu_gdb_read_register; cc->gdb_write_register = arm_cpu_gdb_write_register; #ifdef CONFIG_USER_ONLY cc->handle_mmu_fault = arm_cpu_handle_mmu_fault; #else cc->do_interrupt = arm_cpu_do_interrupt; cc->get_phys_page_debug = arm_cpu_get_phys_page_debug; cc->vmsd = &vmstate_arm_cpu; cc->virtio_is_big_endian = arm_cpu_is_big_endian; #endif cc->gdb_num_core_regs = 26; cc->gdb_core_xml_file = "arm-core.xml"; cc->gdb_stop_before_watchpoint = true; cc->debug_excp_handler = arm_debug_excp_handler; cc->disas_set_info = arm_disas_set_info; }
[ "static void FUNC_0(ObjectClass *VAR_0, void *VAR_1)\n{", "ARMCPUClass *acc = ARM_CPU_CLASS(VAR_0);", "CPUClass *cc = CPU_CLASS(acc);", "DeviceClass *dc = DEVICE_CLASS(VAR_0);", "acc->parent_realize = dc->realize;", "dc->realize = arm_cpu_realizefn;", "dc->props = arm_cpu_properties;", "acc->parent_reset = cc->reset;", "cc->reset = arm_cpu_reset;", "cc->class_by_name = arm_cpu_class_by_name;", "cc->has_work = arm_cpu_has_work;", "cc->cpu_exec_interrupt = arm_cpu_exec_interrupt;", "cc->dump_state = arm_cpu_dump_state;", "cc->set_pc = arm_cpu_set_pc;", "cc->gdb_read_register = arm_cpu_gdb_read_register;", "cc->gdb_write_register = arm_cpu_gdb_write_register;", "#ifdef CONFIG_USER_ONLY\ncc->handle_mmu_fault = arm_cpu_handle_mmu_fault;", "#else\ncc->do_interrupt = arm_cpu_do_interrupt;", "cc->get_phys_page_debug = arm_cpu_get_phys_page_debug;", "cc->vmsd = &vmstate_arm_cpu;", "cc->virtio_is_big_endian = arm_cpu_is_big_endian;", "#endif\ncc->gdb_num_core_regs = 26;", "cc->gdb_core_xml_file = \"arm-core.xml\";", "cc->gdb_stop_before_watchpoint = true;", "cc->debug_excp_handler = arm_debug_excp_handler;", "cc->disas_set_info = arm_disas_set_info;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 2 ], [ 3 ], [ 4 ], [ 5 ], [ 6 ], [ 7 ], [ 8 ], [ 9 ], [ 10 ], [ 11 ], [ 12 ], [ 13 ], [ 14 ], [ 15 ], [ 16 ], [ 17 ], [ 18, 19 ], [ 20, 21 ], [ 22 ], [ 23 ], [ 24 ], [ 25, 26 ], [ 27 ], [ 28 ], [ 29 ], [ 30 ], [ 31 ] ]
14,739
static int mp3info(void *data, int *byteSize, int *samplesPerFrame, int *sampleRate, int *isMono ) { uint8_t *dataTmp = (uint8_t *)data; uint32_t header = ( (uint32_t)dataTmp[0] << 24 ) | ( (uint32_t)dataTmp[1] << 16 ) | ( (uint32_t)dataTmp[2] << 8 ) | (uint32_t)dataTmp[3]; int layerID = 3 - ((header >> 17) & 0x03); int bitRateID = ((header >> 12) & 0x0f); int sampleRateID = ((header >> 10) & 0x03); int bitRate = 0; int bitsPerSlot = sBitsPerSlot[layerID]; int isPadded = ((header >> 9) & 0x01); if ( (( header >> 21 ) & 0x7ff) != 0x7ff ) { return 0; } if ( !isPadded ) { printf("Fatal error: mp3 data is not padded!\n"); exit(0); } *isMono = ((header >> 6) & 0x03) == 0x03; if ( (header >> 19 ) & 0x01 ) { *sampleRate = sSampleRates[0][sampleRateID]; bitRate = sBitRates[0][layerID][bitRateID] * 1000; *samplesPerFrame = sSamplesPerFrame[0][layerID]; } else { if ( (header >> 20) & 0x01 ) { *sampleRate = sSampleRates[1][sampleRateID]; bitRate = sBitRates[1][layerID][bitRateID] * 1000; *samplesPerFrame = sSamplesPerFrame[1][layerID]; } else { *sampleRate = sSampleRates[2][sampleRateID]; bitRate = sBitRates[1][layerID][bitRateID] * 1000; *samplesPerFrame = sSamplesPerFrame[2][layerID]; } } *byteSize = ( ( ( ( *samplesPerFrame * (bitRate / bitsPerSlot) ) / *sampleRate ) + isPadded ) * bitsPerSlot); return 1; }
true
FFmpeg
747a0554ea8ad09404c1f5b80239ebd8d71b291e
static int mp3info(void *data, int *byteSize, int *samplesPerFrame, int *sampleRate, int *isMono ) { uint8_t *dataTmp = (uint8_t *)data; uint32_t header = ( (uint32_t)dataTmp[0] << 24 ) | ( (uint32_t)dataTmp[1] << 16 ) | ( (uint32_t)dataTmp[2] << 8 ) | (uint32_t)dataTmp[3]; int layerID = 3 - ((header >> 17) & 0x03); int bitRateID = ((header >> 12) & 0x0f); int sampleRateID = ((header >> 10) & 0x03); int bitRate = 0; int bitsPerSlot = sBitsPerSlot[layerID]; int isPadded = ((header >> 9) & 0x01); if ( (( header >> 21 ) & 0x7ff) != 0x7ff ) { return 0; } if ( !isPadded ) { printf("Fatal error: mp3 data is not padded!\n"); exit(0); } *isMono = ((header >> 6) & 0x03) == 0x03; if ( (header >> 19 ) & 0x01 ) { *sampleRate = sSampleRates[0][sampleRateID]; bitRate = sBitRates[0][layerID][bitRateID] * 1000; *samplesPerFrame = sSamplesPerFrame[0][layerID]; } else { if ( (header >> 20) & 0x01 ) { *sampleRate = sSampleRates[1][sampleRateID]; bitRate = sBitRates[1][layerID][bitRateID] * 1000; *samplesPerFrame = sSamplesPerFrame[1][layerID]; } else { *sampleRate = sSampleRates[2][sampleRateID]; bitRate = sBitRates[1][layerID][bitRateID] * 1000; *samplesPerFrame = sSamplesPerFrame[2][layerID]; } } *byteSize = ( ( ( ( *samplesPerFrame * (bitRate / bitsPerSlot) ) / *sampleRate ) + isPadded ) * bitsPerSlot); return 1; }
{ "code": [ " *byteSize = ( ( ( ( *samplesPerFrame * (bitRate / bitsPerSlot) ) / *sampleRate ) + isPadded ) * bitsPerSlot);" ], "line_no": [ 79 ] }
static int FUNC_0(void *VAR_0, int *VAR_1, int *VAR_2, int *VAR_3, int *VAR_4 ) { uint8_t *dataTmp = (uint8_t *)VAR_0; uint32_t header = ( (uint32_t)dataTmp[0] << 24 ) | ( (uint32_t)dataTmp[1] << 16 ) | ( (uint32_t)dataTmp[2] << 8 ) | (uint32_t)dataTmp[3]; int VAR_5 = 3 - ((header >> 17) & 0x03); int VAR_6 = ((header >> 12) & 0x0f); int VAR_7 = ((header >> 10) & 0x03); int VAR_8 = 0; int VAR_9 = sBitsPerSlot[VAR_5]; int VAR_10 = ((header >> 9) & 0x01); if ( (( header >> 21 ) & 0x7ff) != 0x7ff ) { return 0; } if ( !VAR_10 ) { printf("Fatal error: mp3 VAR_0 is not padded!\n"); exit(0); } *VAR_4 = ((header >> 6) & 0x03) == 0x03; if ( (header >> 19 ) & 0x01 ) { *VAR_3 = sSampleRates[0][VAR_7]; VAR_8 = sBitRates[0][VAR_5][VAR_6] * 1000; *VAR_2 = sSamplesPerFrame[0][VAR_5]; } else { if ( (header >> 20) & 0x01 ) { *VAR_3 = sSampleRates[1][VAR_7]; VAR_8 = sBitRates[1][VAR_5][VAR_6] * 1000; *VAR_2 = sSamplesPerFrame[1][VAR_5]; } else { *VAR_3 = sSampleRates[2][VAR_7]; VAR_8 = sBitRates[1][VAR_5][VAR_6] * 1000; *VAR_2 = sSamplesPerFrame[2][VAR_5]; } } *VAR_1 = ( ( ( ( *VAR_2 * (VAR_8 / VAR_9) ) / *VAR_3 ) + VAR_10 ) * VAR_9); return 1; }
[ "static int FUNC_0(void *VAR_0, int *VAR_1, int *VAR_2, int *VAR_3, int *VAR_4 )\n{", "uint8_t *dataTmp = (uint8_t *)VAR_0;", "uint32_t header = ( (uint32_t)dataTmp[0] << 24 ) | ( (uint32_t)dataTmp[1] << 16 ) | ( (uint32_t)dataTmp[2] << 8 ) | (uint32_t)dataTmp[3];", "int VAR_5 = 3 - ((header >> 17) & 0x03);", "int VAR_6 = ((header >> 12) & 0x0f);", "int VAR_7 = ((header >> 10) & 0x03);", "int VAR_8 = 0;", "int VAR_9 = sBitsPerSlot[VAR_5];", "int VAR_10 = ((header >> 9) & 0x01);", "if ( (( header >> 21 ) & 0x7ff) != 0x7ff ) {", "return 0;", "}", "if ( !VAR_10 ) {", "printf(\"Fatal error: mp3 VAR_0 is not padded!\\n\");", "exit(0);", "}", "*VAR_4 = ((header >> 6) & 0x03) == 0x03;", "if ( (header >> 19 ) & 0x01 ) {", "*VAR_3 = sSampleRates[0][VAR_7];", "VAR_8 = sBitRates[0][VAR_5][VAR_6] * 1000;", "*VAR_2 = sSamplesPerFrame[0][VAR_5];", "} else {", "if ( (header >> 20) & 0x01 ) {", "*VAR_3 = sSampleRates[1][VAR_7];", "VAR_8 = sBitRates[1][VAR_5][VAR_6] * 1000;", "*VAR_2 = sSamplesPerFrame[1][VAR_5];", "} else {", "*VAR_3 = sSampleRates[2][VAR_7];", "VAR_8 = sBitRates[1][VAR_5][VAR_6] * 1000;", "*VAR_2 = sSamplesPerFrame[2][VAR_5];", "}", "}", "*VAR_1 = ( ( ( ( *VAR_2 * (VAR_8 / VAR_9) ) / *VAR_3 ) + VAR_10 ) * VAR_9);", "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, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 79 ], [ 83 ], [ 85 ] ]
14,742
void slirp_input(const uint8_t *pkt, int pkt_len) { struct mbuf *m; int proto; if (pkt_len < ETH_HLEN) return; proto = ntohs(*(uint16_t *)(pkt + 12)); switch(proto) { case ETH_P_ARP: arp_input(pkt, pkt_len); break; case ETH_P_IP: m = m_get(); if (!m) return; /* Note: we add to align the IP header */ m->m_len = pkt_len + 2; memcpy(m->m_data + 2, pkt, pkt_len); m->m_data += 2 + ETH_HLEN; m->m_len -= 2 + ETH_HLEN; ip_input(m); break; default: break;
true
qemu
e8e880a72e63d0587f03aa670be3de683b881ca8
void slirp_input(const uint8_t *pkt, int pkt_len) { struct mbuf *m; int proto; if (pkt_len < ETH_HLEN) return; proto = ntohs(*(uint16_t *)(pkt + 12)); switch(proto) { case ETH_P_ARP: arp_input(pkt, pkt_len); break; case ETH_P_IP: m = m_get(); if (!m) return; m->m_len = pkt_len + 2; memcpy(m->m_data + 2, pkt, pkt_len); m->m_data += 2 + ETH_HLEN; m->m_len -= 2 + ETH_HLEN; ip_input(m); break; default: break;
{ "code": [], "line_no": [] }
void FUNC_0(const uint8_t *VAR_0, int VAR_1) { struct mbuf *VAR_2; int VAR_3; if (VAR_1 < ETH_HLEN) return; VAR_3 = ntohs(*(uint16_t *)(VAR_0 + 12)); switch(VAR_3) { case ETH_P_ARP: arp_input(VAR_0, VAR_1); break; case ETH_P_IP: VAR_2 = m_get(); if (!VAR_2) return; VAR_2->m_len = VAR_1 + 2; memcpy(VAR_2->m_data + 2, VAR_0, VAR_1); VAR_2->m_data += 2 + ETH_HLEN; VAR_2->m_len -= 2 + ETH_HLEN; ip_input(VAR_2); break; default: break;
[ "void FUNC_0(const uint8_t *VAR_0, int VAR_1)\n{", "struct mbuf *VAR_2;", "int VAR_3;", "if (VAR_1 < ETH_HLEN)\nreturn;", "VAR_3 = ntohs(*(uint16_t *)(VAR_0 + 12));", "switch(VAR_3) {", "case ETH_P_ARP:\narp_input(VAR_0, VAR_1);", "break;", "case ETH_P_IP:\nVAR_2 = m_get();", "if (!VAR_2)\nreturn;", "VAR_2->m_len = VAR_1 + 2;", "memcpy(VAR_2->m_data + 2, VAR_0, VAR_1);", "VAR_2->m_data += 2 + ETH_HLEN;", "VAR_2->m_len -= 2 + ETH_HLEN;", "ip_input(VAR_2);", "break;", "default:\nbreak;" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11, 13 ], [ 17 ], [ 19 ], [ 21, 23 ], [ 25 ], [ 27, 29 ], [ 31, 33 ], [ 40 ], [ 42 ], [ 46 ], [ 48 ], [ 52 ], [ 54 ], [ 56, 58 ] ]
14,743
void OPPROTO op_srl_T0_T1 (void) { T0 = T0 >> T1; RETURN(); }
true
qemu
d9bce9d99f4656ae0b0127f7472db9067b8f84ab
void OPPROTO op_srl_T0_T1 (void) { T0 = T0 >> T1; RETURN(); }
{ "code": [ " RETURN();", " T0 = T0 >> T1;", " RETURN();" ], "line_no": [ 7, 5, 7 ] }
void VAR_0 op_srl_T0_T1 (void) { T0 = T0 >> T1; RETURN(); }
[ "void VAR_0 op_srl_T0_T1 (void)\n{", "T0 = T0 >> T1;", "RETURN();", "}" ]
[ 0, 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ] ]
14,744
void ff_decode_dxt3(const uint8_t *s, uint8_t *dst, const unsigned int w, const unsigned int h, const unsigned int stride) { unsigned int bx, by, qstride = stride/4; uint32_t *d = (uint32_t *) dst; for (by=0; by < h/4; by++, d += stride-w) for (bx=0; bx < w/4; bx++, s+=16, d+=4) dxt1_decode_pixels(s+8, d, qstride, 1, AV_RL64(s)); }
true
FFmpeg
919f3554387e043bdfe10c6369356d1104882183
void ff_decode_dxt3(const uint8_t *s, uint8_t *dst, const unsigned int w, const unsigned int h, const unsigned int stride) { unsigned int bx, by, qstride = stride/4; uint32_t *d = (uint32_t *) dst; for (by=0; by < h/4; by++, d += stride-w) for (bx=0; bx < w/4; bx++, s+=16, d+=4) dxt1_decode_pixels(s+8, d, qstride, 1, AV_RL64(s)); }
{ "code": [ "void ff_decode_dxt3(const uint8_t *s, uint8_t *dst,", " for (bx=0; bx < w/4; bx++, s+=16, d+=4)", " dxt1_decode_pixels(s+8, d, qstride, 1, AV_RL64(s));" ], "line_no": [ 1, 15, 17 ] }
void FUNC_0(const uint8_t *VAR_0, uint8_t *VAR_1, const unsigned int VAR_2, const unsigned int VAR_3, const unsigned int VAR_4) { unsigned int VAR_5, VAR_6, VAR_7 = VAR_4/4; uint32_t *d = (uint32_t *) VAR_1; for (VAR_6=0; VAR_6 < VAR_3/4; VAR_6++, d += VAR_4-VAR_2) for (VAR_5=0; VAR_5 < VAR_2/4; VAR_5++, VAR_0+=16, d+=4) dxt1_decode_pixels(VAR_0+8, d, VAR_7, 1, AV_RL64(VAR_0)); }
[ "void FUNC_0(const uint8_t *VAR_0, uint8_t *VAR_1,\nconst unsigned int VAR_2, const unsigned int VAR_3,\nconst unsigned int VAR_4) {", "unsigned int VAR_5, VAR_6, VAR_7 = VAR_4/4;", "uint32_t *d = (uint32_t *) VAR_1;", "for (VAR_6=0; VAR_6 < VAR_3/4; VAR_6++, d += VAR_4-VAR_2)", "for (VAR_5=0; VAR_5 < VAR_2/4; VAR_5++, VAR_0+=16, d+=4)", "dxt1_decode_pixels(VAR_0+8, d, VAR_7, 1, AV_RL64(VAR_0));", "}" ]
[ 1, 0, 0, 0, 1, 1, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ] ]
14,746
static void gen_mtdcr(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG); #else TCGv dcrn; if (unlikely(ctx->pr)) { gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG); return; } /* NIP cannot be restored if the memory exception comes from an helper */ gen_update_nip(ctx, ctx->nip - 4); dcrn = tcg_const_tl(SPR(ctx->opcode)); gen_helper_store_dcr(cpu_env, dcrn, cpu_gpr[rS(ctx->opcode)]); tcg_temp_free(dcrn); #endif }
true
qemu
9b2fadda3e0196ffd485adde4fe9cdd6fae35300
static void gen_mtdcr(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG); #else TCGv dcrn; if (unlikely(ctx->pr)) { gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG); return; } gen_update_nip(ctx, ctx->nip - 4); dcrn = tcg_const_tl(SPR(ctx->opcode)); gen_helper_store_dcr(cpu_env, dcrn, cpu_gpr[rS(ctx->opcode)]); tcg_temp_free(dcrn); #endif }
{ "code": [ " if (unlikely(ctx->pr)) {", " if (unlikely(ctx->pr)) {", "#if defined(CONFIG_USER_ONLY)", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", "#else", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", "#endif", "#if defined(CONFIG_USER_ONLY)", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", "#else", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", "#endif", "#endif", "#if defined(CONFIG_USER_ONLY)", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", "#else", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", " if (unlikely(ctx->pr)) {", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", "#endif", "#endif", " if (unlikely(ctx->pr)) {", "#endif", "#endif", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", "#endif", "#if defined(CONFIG_USER_ONLY)", "#else", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", "#if defined(CONFIG_USER_ONLY)", "#else", " if (unlikely(ctx->pr)) {", "#endif", "#if defined(CONFIG_USER_ONLY)", "#else", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", "#if defined(CONFIG_USER_ONLY)", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif" ], "line_no": [ 13, 13, 5, 7, 9, 13, 15, 31, 5, 7, 9, 13, 15, 31, 31, 5, 7, 9, 13, 15, 13, 31, 7, 13, 15, 31, 7, 13, 15, 31, 7, 13, 15, 31, 7, 13, 15, 31, 7, 13, 15, 31, 7, 13, 15, 31, 7, 13, 15, 31, 7, 13, 15, 31, 7, 13, 15, 31, 7, 13, 15, 31, 7, 13, 15, 31, 31, 13, 31, 31, 31, 13, 31, 13, 31, 31, 13, 31, 13, 31, 13, 31, 13, 31, 13, 31, 13, 31, 13, 31, 13, 31, 13, 31, 13, 31, 7, 13, 15, 31, 7, 13, 15, 31, 7, 13, 15, 31, 7, 13, 15, 31, 5, 9, 13, 31, 13, 31, 5, 9, 13, 31, 5, 9, 13, 31, 13, 31, 13, 31, 13, 31, 13, 31, 13, 31, 13, 31, 13, 31, 13, 31, 13, 31, 13, 31, 5, 13, 31, 13, 31, 13, 31, 13, 31, 13, 31, 13, 31, 13, 31, 13, 31, 13, 31 ] }
static void FUNC_0(DisasContext *VAR_0) { #if defined(CONFIG_USER_ONLY) gen_inval_exception(VAR_0, POWERPC_EXCP_PRIV_REG); #else TCGv dcrn; if (unlikely(VAR_0->pr)) { gen_inval_exception(VAR_0, POWERPC_EXCP_PRIV_REG); return; } gen_update_nip(VAR_0, VAR_0->nip - 4); dcrn = tcg_const_tl(SPR(VAR_0->opcode)); gen_helper_store_dcr(cpu_env, dcrn, cpu_gpr[rS(VAR_0->opcode)]); tcg_temp_free(dcrn); #endif }
[ "static void FUNC_0(DisasContext *VAR_0)\n{", "#if defined(CONFIG_USER_ONLY)\ngen_inval_exception(VAR_0, POWERPC_EXCP_PRIV_REG);", "#else\nTCGv dcrn;", "if (unlikely(VAR_0->pr)) {", "gen_inval_exception(VAR_0, POWERPC_EXCP_PRIV_REG);", "return;", "}", "gen_update_nip(VAR_0, VAR_0->nip - 4);", "dcrn = tcg_const_tl(SPR(VAR_0->opcode));", "gen_helper_store_dcr(cpu_env, dcrn, cpu_gpr[rS(VAR_0->opcode)]);", "tcg_temp_free(dcrn);", "#endif\n}" ]
[ 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1 ]
[ [ 1, 3 ], [ 5, 7 ], [ 9, 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31, 33 ] ]
14,747
static void avc_luma_mid_and_aver_dst_8w_msa(const uint8_t *src, int32_t src_stride, uint8_t *dst, int32_t dst_stride, int32_t height) { uint32_t loop_cnt; v16i8 src0, src1, src2, src3, src4; v16i8 mask0, mask1, mask2; v8i16 hz_out0, hz_out1, hz_out2, hz_out3; v8i16 hz_out4, hz_out5, hz_out6, hz_out7, hz_out8; v16u8 dst0, dst1, dst2, dst3; v8i16 res0, res1, res2, res3; LD_SB3(&luma_mask_arr[0], 16, mask0, mask1, mask2); LD_SB5(src, src_stride, src0, src1, src2, src3, src4); XORI_B5_128_SB(src0, src1, src2, src3, src4); src += (5 * src_stride); hz_out0 = AVC_HORZ_FILTER_SH(src0, src0, mask0, mask1, mask2); hz_out1 = AVC_HORZ_FILTER_SH(src1, src1, mask0, mask1, mask2); hz_out2 = AVC_HORZ_FILTER_SH(src2, src2, mask0, mask1, mask2); hz_out3 = AVC_HORZ_FILTER_SH(src3, src3, mask0, mask1, mask2); hz_out4 = AVC_HORZ_FILTER_SH(src4, src4, mask0, mask1, mask2); for (loop_cnt = (height >> 2); loop_cnt--;) { LD_SB4(src, src_stride, src0, src1, src2, src3); XORI_B4_128_SB(src0, src1, src2, src3); src += (4 * src_stride); hz_out5 = AVC_HORZ_FILTER_SH(src0, src0, mask0, mask1, mask2); hz_out6 = AVC_HORZ_FILTER_SH(src1, src1, mask0, mask1, mask2); hz_out7 = AVC_HORZ_FILTER_SH(src2, src2, mask0, mask1, mask2); hz_out8 = AVC_HORZ_FILTER_SH(src3, src3, mask0, mask1, mask2); res0 = AVC_CALC_DPADD_H_6PIX_2COEFF_SH(hz_out0, hz_out1, hz_out2, hz_out3, hz_out4, hz_out5); res1 = AVC_CALC_DPADD_H_6PIX_2COEFF_SH(hz_out1, hz_out2, hz_out3, hz_out4, hz_out5, hz_out6); res2 = AVC_CALC_DPADD_H_6PIX_2COEFF_SH(hz_out2, hz_out3, hz_out4, hz_out5, hz_out6, hz_out7); res3 = AVC_CALC_DPADD_H_6PIX_2COEFF_SH(hz_out3, hz_out4, hz_out5, hz_out6, hz_out7, hz_out8); LD_UB4(dst, dst_stride, dst0, dst1, dst2, dst3); ILVR_D2_UB(dst1, dst0, dst3, dst2, dst0, dst1); CONVERT_UB_AVG_ST8x4_UB(res0, res1, res2, res3, dst0, dst1, dst, dst_stride); dst += (4 * dst_stride); hz_out3 = hz_out7; hz_out1 = hz_out5; hz_out5 = hz_out4; hz_out4 = hz_out8; hz_out2 = hz_out6; hz_out0 = hz_out5; } }
false
FFmpeg
1181d93231e9b807965724587d363c1cfd5a1d0d
static void avc_luma_mid_and_aver_dst_8w_msa(const uint8_t *src, int32_t src_stride, uint8_t *dst, int32_t dst_stride, int32_t height) { uint32_t loop_cnt; v16i8 src0, src1, src2, src3, src4; v16i8 mask0, mask1, mask2; v8i16 hz_out0, hz_out1, hz_out2, hz_out3; v8i16 hz_out4, hz_out5, hz_out6, hz_out7, hz_out8; v16u8 dst0, dst1, dst2, dst3; v8i16 res0, res1, res2, res3; LD_SB3(&luma_mask_arr[0], 16, mask0, mask1, mask2); LD_SB5(src, src_stride, src0, src1, src2, src3, src4); XORI_B5_128_SB(src0, src1, src2, src3, src4); src += (5 * src_stride); hz_out0 = AVC_HORZ_FILTER_SH(src0, src0, mask0, mask1, mask2); hz_out1 = AVC_HORZ_FILTER_SH(src1, src1, mask0, mask1, mask2); hz_out2 = AVC_HORZ_FILTER_SH(src2, src2, mask0, mask1, mask2); hz_out3 = AVC_HORZ_FILTER_SH(src3, src3, mask0, mask1, mask2); hz_out4 = AVC_HORZ_FILTER_SH(src4, src4, mask0, mask1, mask2); for (loop_cnt = (height >> 2); loop_cnt--;) { LD_SB4(src, src_stride, src0, src1, src2, src3); XORI_B4_128_SB(src0, src1, src2, src3); src += (4 * src_stride); hz_out5 = AVC_HORZ_FILTER_SH(src0, src0, mask0, mask1, mask2); hz_out6 = AVC_HORZ_FILTER_SH(src1, src1, mask0, mask1, mask2); hz_out7 = AVC_HORZ_FILTER_SH(src2, src2, mask0, mask1, mask2); hz_out8 = AVC_HORZ_FILTER_SH(src3, src3, mask0, mask1, mask2); res0 = AVC_CALC_DPADD_H_6PIX_2COEFF_SH(hz_out0, hz_out1, hz_out2, hz_out3, hz_out4, hz_out5); res1 = AVC_CALC_DPADD_H_6PIX_2COEFF_SH(hz_out1, hz_out2, hz_out3, hz_out4, hz_out5, hz_out6); res2 = AVC_CALC_DPADD_H_6PIX_2COEFF_SH(hz_out2, hz_out3, hz_out4, hz_out5, hz_out6, hz_out7); res3 = AVC_CALC_DPADD_H_6PIX_2COEFF_SH(hz_out3, hz_out4, hz_out5, hz_out6, hz_out7, hz_out8); LD_UB4(dst, dst_stride, dst0, dst1, dst2, dst3); ILVR_D2_UB(dst1, dst0, dst3, dst2, dst0, dst1); CONVERT_UB_AVG_ST8x4_UB(res0, res1, res2, res3, dst0, dst1, dst, dst_stride); dst += (4 * dst_stride); hz_out3 = hz_out7; hz_out1 = hz_out5; hz_out5 = hz_out4; hz_out4 = hz_out8; hz_out2 = hz_out6; hz_out0 = hz_out5; } }
{ "code": [], "line_no": [] }
static void FUNC_0(const uint8_t *VAR_0, int32_t VAR_1, uint8_t *VAR_2, int32_t VAR_3, int32_t VAR_4) { uint32_t loop_cnt; v16i8 src0, src1, src2, src3, src4; v16i8 mask0, mask1, mask2; v8i16 hz_out0, hz_out1, hz_out2, hz_out3; v8i16 hz_out4, hz_out5, hz_out6, hz_out7, hz_out8; v16u8 dst0, dst1, dst2, dst3; v8i16 res0, res1, res2, res3; LD_SB3(&luma_mask_arr[0], 16, mask0, mask1, mask2); LD_SB5(VAR_0, VAR_1, src0, src1, src2, src3, src4); XORI_B5_128_SB(src0, src1, src2, src3, src4); VAR_0 += (5 * VAR_1); hz_out0 = AVC_HORZ_FILTER_SH(src0, src0, mask0, mask1, mask2); hz_out1 = AVC_HORZ_FILTER_SH(src1, src1, mask0, mask1, mask2); hz_out2 = AVC_HORZ_FILTER_SH(src2, src2, mask0, mask1, mask2); hz_out3 = AVC_HORZ_FILTER_SH(src3, src3, mask0, mask1, mask2); hz_out4 = AVC_HORZ_FILTER_SH(src4, src4, mask0, mask1, mask2); for (loop_cnt = (VAR_4 >> 2); loop_cnt--;) { LD_SB4(VAR_0, VAR_1, src0, src1, src2, src3); XORI_B4_128_SB(src0, src1, src2, src3); VAR_0 += (4 * VAR_1); hz_out5 = AVC_HORZ_FILTER_SH(src0, src0, mask0, mask1, mask2); hz_out6 = AVC_HORZ_FILTER_SH(src1, src1, mask0, mask1, mask2); hz_out7 = AVC_HORZ_FILTER_SH(src2, src2, mask0, mask1, mask2); hz_out8 = AVC_HORZ_FILTER_SH(src3, src3, mask0, mask1, mask2); res0 = AVC_CALC_DPADD_H_6PIX_2COEFF_SH(hz_out0, hz_out1, hz_out2, hz_out3, hz_out4, hz_out5); res1 = AVC_CALC_DPADD_H_6PIX_2COEFF_SH(hz_out1, hz_out2, hz_out3, hz_out4, hz_out5, hz_out6); res2 = AVC_CALC_DPADD_H_6PIX_2COEFF_SH(hz_out2, hz_out3, hz_out4, hz_out5, hz_out6, hz_out7); res3 = AVC_CALC_DPADD_H_6PIX_2COEFF_SH(hz_out3, hz_out4, hz_out5, hz_out6, hz_out7, hz_out8); LD_UB4(VAR_2, VAR_3, dst0, dst1, dst2, dst3); ILVR_D2_UB(dst1, dst0, dst3, dst2, dst0, dst1); CONVERT_UB_AVG_ST8x4_UB(res0, res1, res2, res3, dst0, dst1, VAR_2, VAR_3); VAR_2 += (4 * VAR_3); hz_out3 = hz_out7; hz_out1 = hz_out5; hz_out5 = hz_out4; hz_out4 = hz_out8; hz_out2 = hz_out6; hz_out0 = hz_out5; } }
[ "static void FUNC_0(const uint8_t *VAR_0,\nint32_t VAR_1,\nuint8_t *VAR_2, int32_t VAR_3,\nint32_t VAR_4)\n{", "uint32_t loop_cnt;", "v16i8 src0, src1, src2, src3, src4;", "v16i8 mask0, mask1, mask2;", "v8i16 hz_out0, hz_out1, hz_out2, hz_out3;", "v8i16 hz_out4, hz_out5, hz_out6, hz_out7, hz_out8;", "v16u8 dst0, dst1, dst2, dst3;", "v8i16 res0, res1, res2, res3;", "LD_SB3(&luma_mask_arr[0], 16, mask0, mask1, mask2);", "LD_SB5(VAR_0, VAR_1, src0, src1, src2, src3, src4);", "XORI_B5_128_SB(src0, src1, src2, src3, src4);", "VAR_0 += (5 * VAR_1);", "hz_out0 = AVC_HORZ_FILTER_SH(src0, src0, mask0, mask1, mask2);", "hz_out1 = AVC_HORZ_FILTER_SH(src1, src1, mask0, mask1, mask2);", "hz_out2 = AVC_HORZ_FILTER_SH(src2, src2, mask0, mask1, mask2);", "hz_out3 = AVC_HORZ_FILTER_SH(src3, src3, mask0, mask1, mask2);", "hz_out4 = AVC_HORZ_FILTER_SH(src4, src4, mask0, mask1, mask2);", "for (loop_cnt = (VAR_4 >> 2); loop_cnt--;) {", "LD_SB4(VAR_0, VAR_1, src0, src1, src2, src3);", "XORI_B4_128_SB(src0, src1, src2, src3);", "VAR_0 += (4 * VAR_1);", "hz_out5 = AVC_HORZ_FILTER_SH(src0, src0, mask0, mask1, mask2);", "hz_out6 = AVC_HORZ_FILTER_SH(src1, src1, mask0, mask1, mask2);", "hz_out7 = AVC_HORZ_FILTER_SH(src2, src2, mask0, mask1, mask2);", "hz_out8 = AVC_HORZ_FILTER_SH(src3, src3, mask0, mask1, mask2);", "res0 = AVC_CALC_DPADD_H_6PIX_2COEFF_SH(hz_out0, hz_out1, hz_out2,\nhz_out3, hz_out4, hz_out5);", "res1 = AVC_CALC_DPADD_H_6PIX_2COEFF_SH(hz_out1, hz_out2, hz_out3,\nhz_out4, hz_out5, hz_out6);", "res2 = AVC_CALC_DPADD_H_6PIX_2COEFF_SH(hz_out2, hz_out3, hz_out4,\nhz_out5, hz_out6, hz_out7);", "res3 = AVC_CALC_DPADD_H_6PIX_2COEFF_SH(hz_out3, hz_out4, hz_out5,\nhz_out6, hz_out7, hz_out8);", "LD_UB4(VAR_2, VAR_3, dst0, dst1, dst2, dst3);", "ILVR_D2_UB(dst1, dst0, dst3, dst2, dst0, dst1);", "CONVERT_UB_AVG_ST8x4_UB(res0, res1, res2, res3, dst0, dst1,\nVAR_2, VAR_3);", "VAR_2 += (4 * VAR_3);", "hz_out3 = hz_out7;", "hz_out1 = hz_out5;", "hz_out5 = hz_out4;", "hz_out4 = hz_out8;", "hz_out2 = hz_out6;", "hz_out0 = hz_out5;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 71, 73 ], [ 75, 77 ], [ 79, 81 ], [ 83, 85 ], [ 87 ], [ 89 ], [ 91, 93 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ] ]
14,748
static void check_mc(void) { LOCAL_ALIGNED_32(uint8_t, buf, [72 * 72 * 2]); LOCAL_ALIGNED_32(uint8_t, dst0, [64 * 64 * 2]); LOCAL_ALIGNED_32(uint8_t, dst1, [64 * 64 * 2]); VP9DSPContext dsp; int op, hsize, bit_depth, filter, dx, dy; declare_func(void, uint8_t *dst, ptrdiff_t dst_stride, const uint8_t *ref, ptrdiff_t ref_stride, int h, int mx, int my); static const char *const filter_names[4] = { "8tap_smooth", "8tap_regular", "8tap_sharp", "bilin" }; static const char *const subpel_names[2][2] = { { "", "h" }, { "v", "hv" } }; static const char *const op_names[2] = { "put", "avg" }; char str[256]; for (op = 0; op < 2; op++) { for (bit_depth = 8; bit_depth <= 12; bit_depth += 2) { ff_vp9dsp_init(&dsp, bit_depth, 0); for (hsize = 0; hsize < 5; hsize++) { int size = 64 >> hsize; for (filter = 0; filter < 4; filter++) { for (dx = 0; dx < 2; dx++) { for (dy = 0; dy < 2; dy++) { if (dx || dy) { sprintf(str, "%s_%s_%d%s", op_names[op], filter_names[filter], size, subpel_names[dy][dx]); } else { sprintf(str, "%s%d", op_names[op], size); } if (check_func(dsp.mc[hsize][filter][op][dx][dy], "vp9_%s_%dbpp", str, bit_depth)) { int mx = dx ? 1 + (rnd() % 14) : 0; int my = dy ? 1 + (rnd() % 14) : 0; randomize_buffers(); call_ref(dst0, size * SIZEOF_PIXEL, src, SRC_BUF_STRIDE * SIZEOF_PIXEL, size, mx, my); call_new(dst1, size * SIZEOF_PIXEL, src, SRC_BUF_STRIDE * SIZEOF_PIXEL, size, mx, my); if (memcmp(dst0, dst1, DST_BUF_SIZE)) fail(); // simd implementations for each filter of subpel // functions are identical if (filter >= 1 && filter <= 2) continue; // 10/12 bpp for bilin are identical if (bit_depth == 12 && filter == 3) continue; bench_new(dst1, size * SIZEOF_PIXEL, src, SRC_BUF_STRIDE * SIZEOF_PIXEL, size, mx, my); } } } } } } } report("mc"); }
false
FFmpeg
a860adb49c4cd9c1271778cb7c2930c25efb2a97
static void check_mc(void) { LOCAL_ALIGNED_32(uint8_t, buf, [72 * 72 * 2]); LOCAL_ALIGNED_32(uint8_t, dst0, [64 * 64 * 2]); LOCAL_ALIGNED_32(uint8_t, dst1, [64 * 64 * 2]); VP9DSPContext dsp; int op, hsize, bit_depth, filter, dx, dy; declare_func(void, uint8_t *dst, ptrdiff_t dst_stride, const uint8_t *ref, ptrdiff_t ref_stride, int h, int mx, int my); static const char *const filter_names[4] = { "8tap_smooth", "8tap_regular", "8tap_sharp", "bilin" }; static const char *const subpel_names[2][2] = { { "", "h" }, { "v", "hv" } }; static const char *const op_names[2] = { "put", "avg" }; char str[256]; for (op = 0; op < 2; op++) { for (bit_depth = 8; bit_depth <= 12; bit_depth += 2) { ff_vp9dsp_init(&dsp, bit_depth, 0); for (hsize = 0; hsize < 5; hsize++) { int size = 64 >> hsize; for (filter = 0; filter < 4; filter++) { for (dx = 0; dx < 2; dx++) { for (dy = 0; dy < 2; dy++) { if (dx || dy) { sprintf(str, "%s_%s_%d%s", op_names[op], filter_names[filter], size, subpel_names[dy][dx]); } else { sprintf(str, "%s%d", op_names[op], size); } if (check_func(dsp.mc[hsize][filter][op][dx][dy], "vp9_%s_%dbpp", str, bit_depth)) { int mx = dx ? 1 + (rnd() % 14) : 0; int my = dy ? 1 + (rnd() % 14) : 0; randomize_buffers(); call_ref(dst0, size * SIZEOF_PIXEL, src, SRC_BUF_STRIDE * SIZEOF_PIXEL, size, mx, my); call_new(dst1, size * SIZEOF_PIXEL, src, SRC_BUF_STRIDE * SIZEOF_PIXEL, size, mx, my); if (memcmp(dst0, dst1, DST_BUF_SIZE)) fail(); if (filter >= 1 && filter <= 2) continue; if (bit_depth == 12 && filter == 3) continue; bench_new(dst1, size * SIZEOF_PIXEL, src, SRC_BUF_STRIDE * SIZEOF_PIXEL, size, mx, my); } } } } } } } report("mc"); }
{ "code": [], "line_no": [] }
static void FUNC_0(void) { LOCAL_ALIGNED_32(uint8_t, buf, [72 * 72 * 2]); LOCAL_ALIGNED_32(uint8_t, dst0, [64 * 64 * 2]); LOCAL_ALIGNED_32(uint8_t, dst1, [64 * 64 * 2]); VP9DSPContext dsp; int VAR_0, VAR_1, VAR_2, VAR_3, VAR_4, VAR_5; declare_func(void, uint8_t *dst, ptrdiff_t dst_stride, const uint8_t *ref, ptrdiff_t ref_stride, int h, int VAR_11, int VAR_12); static const char *const VAR_6[4] = { "8tap_smooth", "8tap_regular", "8tap_sharp", "bilin" }; static const char *const VAR_7[2][2] = { { "", "h" }, { "v", "hv" } }; static const char *const VAR_8[2] = { "put", "avg" }; char VAR_9[256]; for (VAR_0 = 0; VAR_0 < 2; VAR_0++) { for (VAR_2 = 8; VAR_2 <= 12; VAR_2 += 2) { ff_vp9dsp_init(&dsp, VAR_2, 0); for (VAR_1 = 0; VAR_1 < 5; VAR_1++) { int VAR_10 = 64 >> VAR_1; for (VAR_3 = 0; VAR_3 < 4; VAR_3++) { for (VAR_4 = 0; VAR_4 < 2; VAR_4++) { for (VAR_5 = 0; VAR_5 < 2; VAR_5++) { if (VAR_4 || VAR_5) { sprintf(VAR_9, "%s_%s_%d%s", VAR_8[VAR_0], VAR_6[VAR_3], VAR_10, VAR_7[VAR_5][VAR_4]); } else { sprintf(VAR_9, "%s%d", VAR_8[VAR_0], VAR_10); } if (check_func(dsp.mc[VAR_1][VAR_3][VAR_0][VAR_4][VAR_5], "vp9_%s_%dbpp", VAR_9, VAR_2)) { int VAR_11 = VAR_4 ? 1 + (rnd() % 14) : 0; int VAR_12 = VAR_5 ? 1 + (rnd() % 14) : 0; randomize_buffers(); call_ref(dst0, VAR_10 * SIZEOF_PIXEL, src, SRC_BUF_STRIDE * SIZEOF_PIXEL, VAR_10, VAR_11, VAR_12); call_new(dst1, VAR_10 * SIZEOF_PIXEL, src, SRC_BUF_STRIDE * SIZEOF_PIXEL, VAR_10, VAR_11, VAR_12); if (memcmp(dst0, dst1, DST_BUF_SIZE)) fail(); if (VAR_3 >= 1 && VAR_3 <= 2) continue; if (VAR_2 == 12 && VAR_3 == 3) continue; bench_new(dst1, VAR_10 * SIZEOF_PIXEL, src, SRC_BUF_STRIDE * SIZEOF_PIXEL, VAR_10, VAR_11, VAR_12); } } } } } } } report("mc"); }
[ "static void FUNC_0(void)\n{", "LOCAL_ALIGNED_32(uint8_t, buf, [72 * 72 * 2]);", "LOCAL_ALIGNED_32(uint8_t, dst0, [64 * 64 * 2]);", "LOCAL_ALIGNED_32(uint8_t, dst1, [64 * 64 * 2]);", "VP9DSPContext dsp;", "int VAR_0, VAR_1, VAR_2, VAR_3, VAR_4, VAR_5;", "declare_func(void, uint8_t *dst, ptrdiff_t dst_stride,\nconst uint8_t *ref, ptrdiff_t ref_stride,\nint h, int VAR_11, int VAR_12);", "static const char *const VAR_6[4] = {", "\"8tap_smooth\", \"8tap_regular\", \"8tap_sharp\", \"bilin\"\n};", "static const char *const VAR_7[2][2] = { { \"\", \"h\" }, { \"v\", \"hv\" } };", "static const char *const VAR_8[2] = { \"put\", \"avg\" };", "char VAR_9[256];", "for (VAR_0 = 0; VAR_0 < 2; VAR_0++) {", "for (VAR_2 = 8; VAR_2 <= 12; VAR_2 += 2) {", "ff_vp9dsp_init(&dsp, VAR_2, 0);", "for (VAR_1 = 0; VAR_1 < 5; VAR_1++) {", "int VAR_10 = 64 >> VAR_1;", "for (VAR_3 = 0; VAR_3 < 4; VAR_3++) {", "for (VAR_4 = 0; VAR_4 < 2; VAR_4++) {", "for (VAR_5 = 0; VAR_5 < 2; VAR_5++) {", "if (VAR_4 || VAR_5) {", "sprintf(VAR_9, \"%s_%s_%d%s\", VAR_8[VAR_0],\nVAR_6[VAR_3], VAR_10,\nVAR_7[VAR_5][VAR_4]);", "} else {", "sprintf(VAR_9, \"%s%d\", VAR_8[VAR_0], VAR_10);", "}", "if (check_func(dsp.mc[VAR_1][VAR_3][VAR_0][VAR_4][VAR_5],\n\"vp9_%s_%dbpp\", VAR_9, VAR_2)) {", "int VAR_11 = VAR_4 ? 1 + (rnd() % 14) : 0;", "int VAR_12 = VAR_5 ? 1 + (rnd() % 14) : 0;", "randomize_buffers();", "call_ref(dst0, VAR_10 * SIZEOF_PIXEL,\nsrc, SRC_BUF_STRIDE * SIZEOF_PIXEL,\nVAR_10, VAR_11, VAR_12);", "call_new(dst1, VAR_10 * SIZEOF_PIXEL,\nsrc, SRC_BUF_STRIDE * SIZEOF_PIXEL,\nVAR_10, VAR_11, VAR_12);", "if (memcmp(dst0, dst1, DST_BUF_SIZE))\nfail();", "if (VAR_3 >= 1 && VAR_3 <= 2) continue;", "if (VAR_2 == 12 && VAR_3 == 3) continue;", "bench_new(dst1, VAR_10 * SIZEOF_PIXEL,\nsrc, SRC_BUF_STRIDE * SIZEOF_PIXEL,\nVAR_10, VAR_11, VAR_12);", "}", "}", "}", "}", "}", "}", "}", "report(\"mc\");", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55, 57, 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67, 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77, 79, 81 ], [ 83, 85, 87 ], [ 89, 91 ], [ 99 ], [ 103 ], [ 107, 109, 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ] ]
14,749
static enum AVPixelFormat get_format(AVCodecContext *s, const enum AVPixelFormat *pix_fmts) { InputStream *ist = s->opaque; const enum AVPixelFormat *p; int ret; for (p = pix_fmts; *p != -1; p++) { const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(*p); const HWAccel *hwaccel; if (!(desc->flags & AV_PIX_FMT_FLAG_HWACCEL)) break; hwaccel = get_hwaccel(*p, ist->hwaccel_id); if (!hwaccel || (ist->active_hwaccel_id && ist->active_hwaccel_id != hwaccel->id) || (ist->hwaccel_id != HWACCEL_AUTO && ist->hwaccel_id != hwaccel->id)) continue; ret = hwaccel->init(s); if (ret < 0) { if (ist->hwaccel_id == hwaccel->id) { av_log(NULL, AV_LOG_FATAL, "%s hwaccel requested for input stream #%d:%d, " "but cannot be initialized.\n", hwaccel->name, ist->file_index, ist->st->index); return AV_PIX_FMT_NONE; } continue; } if (ist->hw_frames_ctx) { s->hw_frames_ctx = av_buffer_ref(ist->hw_frames_ctx); if (!s->hw_frames_ctx) return AV_PIX_FMT_NONE; } ist->active_hwaccel_id = hwaccel->id; ist->hwaccel_pix_fmt = *p; break; } return *p; }
false
FFmpeg
b0cd14fb1dab4b044f7fe6b53ac635409849de77
static enum AVPixelFormat get_format(AVCodecContext *s, const enum AVPixelFormat *pix_fmts) { InputStream *ist = s->opaque; const enum AVPixelFormat *p; int ret; for (p = pix_fmts; *p != -1; p++) { const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(*p); const HWAccel *hwaccel; if (!(desc->flags & AV_PIX_FMT_FLAG_HWACCEL)) break; hwaccel = get_hwaccel(*p, ist->hwaccel_id); if (!hwaccel || (ist->active_hwaccel_id && ist->active_hwaccel_id != hwaccel->id) || (ist->hwaccel_id != HWACCEL_AUTO && ist->hwaccel_id != hwaccel->id)) continue; ret = hwaccel->init(s); if (ret < 0) { if (ist->hwaccel_id == hwaccel->id) { av_log(NULL, AV_LOG_FATAL, "%s hwaccel requested for input stream #%d:%d, " "but cannot be initialized.\n", hwaccel->name, ist->file_index, ist->st->index); return AV_PIX_FMT_NONE; } continue; } if (ist->hw_frames_ctx) { s->hw_frames_ctx = av_buffer_ref(ist->hw_frames_ctx); if (!s->hw_frames_ctx) return AV_PIX_FMT_NONE; } ist->active_hwaccel_id = hwaccel->id; ist->hwaccel_pix_fmt = *p; break; } return *p; }
{ "code": [], "line_no": [] }
static enum AVPixelFormat FUNC_0(AVCodecContext *VAR_0, const enum AVPixelFormat *VAR_1) { InputStream *ist = VAR_0->opaque; const enum AVPixelFormat *VAR_2; int VAR_3; for (VAR_2 = VAR_1; *VAR_2 != -1; VAR_2++) { const AVPixFmtDescriptor *VAR_4 = av_pix_fmt_desc_get(*VAR_2); const HWAccel *VAR_5; if (!(VAR_4->flags & AV_PIX_FMT_FLAG_HWACCEL)) break; VAR_5 = get_hwaccel(*VAR_2, ist->hwaccel_id); if (!VAR_5 || (ist->active_hwaccel_id && ist->active_hwaccel_id != VAR_5->id) || (ist->hwaccel_id != HWACCEL_AUTO && ist->hwaccel_id != VAR_5->id)) continue; VAR_3 = VAR_5->init(VAR_0); if (VAR_3 < 0) { if (ist->hwaccel_id == VAR_5->id) { av_log(NULL, AV_LOG_FATAL, "%VAR_0 VAR_5 requested for input stream #%d:%d, " "but cannot be initialized.\n", VAR_5->name, ist->file_index, ist->st->index); return AV_PIX_FMT_NONE; } continue; } if (ist->hw_frames_ctx) { VAR_0->hw_frames_ctx = av_buffer_ref(ist->hw_frames_ctx); if (!VAR_0->hw_frames_ctx) return AV_PIX_FMT_NONE; } ist->active_hwaccel_id = VAR_5->id; ist->hwaccel_pix_fmt = *VAR_2; break; } return *VAR_2; }
[ "static enum AVPixelFormat FUNC_0(AVCodecContext *VAR_0, const enum AVPixelFormat *VAR_1)\n{", "InputStream *ist = VAR_0->opaque;", "const enum AVPixelFormat *VAR_2;", "int VAR_3;", "for (VAR_2 = VAR_1; *VAR_2 != -1; VAR_2++) {", "const AVPixFmtDescriptor *VAR_4 = av_pix_fmt_desc_get(*VAR_2);", "const HWAccel *VAR_5;", "if (!(VAR_4->flags & AV_PIX_FMT_FLAG_HWACCEL))\nbreak;", "VAR_5 = get_hwaccel(*VAR_2, ist->hwaccel_id);", "if (!VAR_5 ||\n(ist->active_hwaccel_id && ist->active_hwaccel_id != VAR_5->id) ||\n(ist->hwaccel_id != HWACCEL_AUTO && ist->hwaccel_id != VAR_5->id))\ncontinue;", "VAR_3 = VAR_5->init(VAR_0);", "if (VAR_3 < 0) {", "if (ist->hwaccel_id == VAR_5->id) {", "av_log(NULL, AV_LOG_FATAL,\n\"%VAR_0 VAR_5 requested for input stream #%d:%d, \"\n\"but cannot be initialized.\\n\", VAR_5->name,\nist->file_index, ist->st->index);", "return AV_PIX_FMT_NONE;", "}", "continue;", "}", "if (ist->hw_frames_ctx) {", "VAR_0->hw_frames_ctx = av_buffer_ref(ist->hw_frames_ctx);", "if (!VAR_0->hw_frames_ctx)\nreturn AV_PIX_FMT_NONE;", "}", "ist->active_hwaccel_id = VAR_5->id;", "ist->hwaccel_pix_fmt = *VAR_2;", "break;", "}", "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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 21, 23 ], [ 27 ], [ 29, 31, 33, 35 ], [ 39 ], [ 41 ], [ 43 ], [ 45, 47, 49, 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ], [ 67, 69 ], [ 71 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 85 ], [ 87 ] ]
14,751
void qdev_prop_allow_set_link_before_realize(Object *obj, const char *name, Object *val, Error **errp) { DeviceState *dev = DEVICE(obj); if (dev->realized) { error_setg(errp, "Attempt to set link property '%s' on device '%s' " "(type '%s') after it was realized", name, dev->id, object_get_typename(obj)); } }
true
qemu
8f5d58ef2c92d7b82d9a6eeefd7c8854a183ba4a
void qdev_prop_allow_set_link_before_realize(Object *obj, const char *name, Object *val, Error **errp) { DeviceState *dev = DEVICE(obj); if (dev->realized) { error_setg(errp, "Attempt to set link property '%s' on device '%s' " "(type '%s') after it was realized", name, dev->id, object_get_typename(obj)); } }
{ "code": [ "void qdev_prop_allow_set_link_before_realize(Object *obj, const char *name,", "void qdev_prop_allow_set_link_before_realize(Object *obj, const char *name," ], "line_no": [ 1, 1 ] }
void FUNC_0(Object *VAR_0, const char *VAR_1, Object *VAR_2, Error **VAR_3) { DeviceState *dev = DEVICE(VAR_0); if (dev->realized) { error_setg(VAR_3, "Attempt to set link property '%s' on device '%s' " "(type '%s') after it was realized", VAR_1, dev->id, object_get_typename(VAR_0)); } }
[ "void FUNC_0(Object *VAR_0, const char *VAR_1,\nObject *VAR_2, Error **VAR_3)\n{", "DeviceState *dev = DEVICE(VAR_0);", "if (dev->realized) {", "error_setg(VAR_3, \"Attempt to set link property '%s' on device '%s' \"\n\"(type '%s') after it was realized\",\nVAR_1, dev->id, object_get_typename(VAR_0));", "}", "}" ]
[ 1, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 13, 15, 17 ], [ 19 ], [ 21 ] ]
14,752
static void uninit(struct vf_instance *vf) { free(vf->priv); }
true
FFmpeg
2f11aa141a01f97c5d2a015bd9dbdb27314b79c4
static void uninit(struct vf_instance *vf) { free(vf->priv); }
{ "code": [ "static void uninit(struct vf_instance *vf)", " free(vf->priv);" ], "line_no": [ 1, 5 ] }
static void FUNC_0(struct vf_instance *VAR_0) { free(VAR_0->priv); }
[ "static void FUNC_0(struct vf_instance *VAR_0)\n{", "free(VAR_0->priv);", "}" ]
[ 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
14,753
static av_cold int encode_init(AVCodecContext *avctx) { NellyMoserEncodeContext *s = avctx->priv_data; int i, ret; if (avctx->channels != 1) { av_log(avctx, AV_LOG_ERROR, "Nellymoser supports only 1 channel\n"); return AVERROR(EINVAL); } if (avctx->sample_rate != 8000 && avctx->sample_rate != 16000 && avctx->sample_rate != 11025 && avctx->sample_rate != 22050 && avctx->sample_rate != 44100 && avctx->strict_std_compliance >= FF_COMPLIANCE_NORMAL) { av_log(avctx, AV_LOG_ERROR, "Nellymoser works only with 8000, 16000, 11025, 22050 and 44100 sample rate\n"); return AVERROR(EINVAL); } avctx->frame_size = NELLY_SAMPLES; avctx->delay = NELLY_BUF_LEN; ff_af_queue_init(avctx, &s->afq); s->avctx = avctx; if ((ret = ff_mdct_init(&s->mdct_ctx, 8, 0, 32768.0)) < 0) goto error; ff_dsputil_init(&s->dsp, avctx); /* Generate overlap window */ ff_sine_window_init(ff_sine_128, 128); for (i = 0; i < POW_TABLE_SIZE; i++) pow_table[i] = -pow(2, -i / 2048.0 - 3.0 + POW_TABLE_OFFSET); if (s->avctx->trellis) { s->opt = av_malloc(NELLY_BANDS * OPT_SIZE * sizeof(float )); s->path = av_malloc(NELLY_BANDS * OPT_SIZE * sizeof(uint8_t)); if (!s->opt || !s->path) { ret = AVERROR(ENOMEM); goto error; } } #if FF_API_OLD_ENCODE_AUDIO avctx->coded_frame = avcodec_alloc_frame(); if (!avctx->coded_frame) { ret = AVERROR(ENOMEM); goto error; } #endif return 0; error: encode_end(avctx); return ret; }
true
FFmpeg
03ef5047d15904ed34976c6ba11c9176529ee9e7
static av_cold int encode_init(AVCodecContext *avctx) { NellyMoserEncodeContext *s = avctx->priv_data; int i, ret; if (avctx->channels != 1) { av_log(avctx, AV_LOG_ERROR, "Nellymoser supports only 1 channel\n"); return AVERROR(EINVAL); } if (avctx->sample_rate != 8000 && avctx->sample_rate != 16000 && avctx->sample_rate != 11025 && avctx->sample_rate != 22050 && avctx->sample_rate != 44100 && avctx->strict_std_compliance >= FF_COMPLIANCE_NORMAL) { av_log(avctx, AV_LOG_ERROR, "Nellymoser works only with 8000, 16000, 11025, 22050 and 44100 sample rate\n"); return AVERROR(EINVAL); } avctx->frame_size = NELLY_SAMPLES; avctx->delay = NELLY_BUF_LEN; ff_af_queue_init(avctx, &s->afq); s->avctx = avctx; if ((ret = ff_mdct_init(&s->mdct_ctx, 8, 0, 32768.0)) < 0) goto error; ff_dsputil_init(&s->dsp, avctx); ff_sine_window_init(ff_sine_128, 128); for (i = 0; i < POW_TABLE_SIZE; i++) pow_table[i] = -pow(2, -i / 2048.0 - 3.0 + POW_TABLE_OFFSET); if (s->avctx->trellis) { s->opt = av_malloc(NELLY_BANDS * OPT_SIZE * sizeof(float )); s->path = av_malloc(NELLY_BANDS * OPT_SIZE * sizeof(uint8_t)); if (!s->opt || !s->path) { ret = AVERROR(ENOMEM); goto error; } } #if FF_API_OLD_ENCODE_AUDIO avctx->coded_frame = avcodec_alloc_frame(); if (!avctx->coded_frame) { ret = AVERROR(ENOMEM); goto error; } #endif return 0; error: encode_end(avctx); return ret; }
{ "code": [ " ff_sine_window_init(ff_sine_128, 128);" ], "line_no": [ 55 ] }
static av_cold int FUNC_0(AVCodecContext *avctx) { NellyMoserEncodeContext *s = avctx->priv_data; int VAR_0, VAR_1; if (avctx->channels != 1) { av_log(avctx, AV_LOG_ERROR, "Nellymoser supports only 1 channel\n"); return AVERROR(EINVAL); } if (avctx->sample_rate != 8000 && avctx->sample_rate != 16000 && avctx->sample_rate != 11025 && avctx->sample_rate != 22050 && avctx->sample_rate != 44100 && avctx->strict_std_compliance >= FF_COMPLIANCE_NORMAL) { av_log(avctx, AV_LOG_ERROR, "Nellymoser works only with 8000, 16000, 11025, 22050 and 44100 sample rate\n"); return AVERROR(EINVAL); } avctx->frame_size = NELLY_SAMPLES; avctx->delay = NELLY_BUF_LEN; ff_af_queue_init(avctx, &s->afq); s->avctx = avctx; if ((VAR_1 = ff_mdct_init(&s->mdct_ctx, 8, 0, 32768.0)) < 0) goto error; ff_dsputil_init(&s->dsp, avctx); ff_sine_window_init(ff_sine_128, 128); for (VAR_0 = 0; VAR_0 < POW_TABLE_SIZE; VAR_0++) pow_table[VAR_0] = -pow(2, -VAR_0 / 2048.0 - 3.0 + POW_TABLE_OFFSET); if (s->avctx->trellis) { s->opt = av_malloc(NELLY_BANDS * OPT_SIZE * sizeof(float )); s->path = av_malloc(NELLY_BANDS * OPT_SIZE * sizeof(uint8_t)); if (!s->opt || !s->path) { VAR_1 = AVERROR(ENOMEM); goto error; } } #if FF_API_OLD_ENCODE_AUDIO avctx->coded_frame = avcodec_alloc_frame(); if (!avctx->coded_frame) { VAR_1 = AVERROR(ENOMEM); goto error; } #endif return 0; error: encode_end(avctx); return VAR_1; }
[ "static av_cold int FUNC_0(AVCodecContext *avctx)\n{", "NellyMoserEncodeContext *s = avctx->priv_data;", "int VAR_0, VAR_1;", "if (avctx->channels != 1) {", "av_log(avctx, AV_LOG_ERROR, \"Nellymoser supports only 1 channel\\n\");", "return AVERROR(EINVAL);", "}", "if (avctx->sample_rate != 8000 && avctx->sample_rate != 16000 &&\navctx->sample_rate != 11025 &&\navctx->sample_rate != 22050 && avctx->sample_rate != 44100 &&\navctx->strict_std_compliance >= FF_COMPLIANCE_NORMAL) {", "av_log(avctx, AV_LOG_ERROR, \"Nellymoser works only with 8000, 16000, 11025, 22050 and 44100 sample rate\\n\");", "return AVERROR(EINVAL);", "}", "avctx->frame_size = NELLY_SAMPLES;", "avctx->delay = NELLY_BUF_LEN;", "ff_af_queue_init(avctx, &s->afq);", "s->avctx = avctx;", "if ((VAR_1 = ff_mdct_init(&s->mdct_ctx, 8, 0, 32768.0)) < 0)\ngoto error;", "ff_dsputil_init(&s->dsp, avctx);", "ff_sine_window_init(ff_sine_128, 128);", "for (VAR_0 = 0; VAR_0 < POW_TABLE_SIZE; VAR_0++)", "pow_table[VAR_0] = -pow(2, -VAR_0 / 2048.0 - 3.0 + POW_TABLE_OFFSET);", "if (s->avctx->trellis) {", "s->opt = av_malloc(NELLY_BANDS * OPT_SIZE * sizeof(float ));", "s->path = av_malloc(NELLY_BANDS * OPT_SIZE * sizeof(uint8_t));", "if (!s->opt || !s->path) {", "VAR_1 = AVERROR(ENOMEM);", "goto error;", "}", "}", "#if FF_API_OLD_ENCODE_AUDIO\navctx->coded_frame = avcodec_alloc_frame();", "if (!avctx->coded_frame) {", "VAR_1 = AVERROR(ENOMEM);", "goto error;", "}", "#endif\nreturn 0;", "error:\nencode_end(avctx);", "return VAR_1;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21, 23, 25, 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45, 47 ], [ 49 ], [ 55 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 81, 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93, 97 ], [ 99, 101 ], [ 103 ], [ 105 ] ]
14,754
static int ass_encode_frame(AVCodecContext *avctx, unsigned char *buf, int bufsize, const AVSubtitle *sub) { ASSEncodeContext *s = avctx->priv_data; int i, len, total_len = 0; for (i=0; i<sub->num_rects; i++) { char ass_line[2048]; const char *ass = sub->rects[i]->ass; if (sub->rects[i]->type != SUBTITLE_ASS) { av_log(avctx, AV_LOG_ERROR, "Only SUBTITLE_ASS type supported.\n"); return -1; } if (strncmp(ass, "Dialogue: ", 10)) { av_log(avctx, AV_LOG_ERROR, "AVSubtitle rectangle ass \"%s\"" " does not look like a SSA markup\n", ass); return AVERROR_INVALIDDATA; } if (avctx->codec->id == AV_CODEC_ID_ASS) { long int layer; char *p; if (i > 0) { av_log(avctx, AV_LOG_ERROR, "ASS encoder supports only one " "ASS rectangle field.\n"); return AVERROR_INVALIDDATA; } ass += 10; // skip "Dialogue: " /* parse Layer field. If it's a Marked field, the content * will be "Marked=N" instead of the layer num, so we will * have layer=0, which is fine. */ layer = strtol(ass, &p, 10); if (*p) p += strcspn(p, ",") + 1; // skip layer or marked if (*p) p += strcspn(p, ",") + 1; // skip start timestamp if (*p) p += strcspn(p, ",") + 1; // skip end timestamp snprintf(ass_line, sizeof(ass_line), "%d,%ld,%s", ++s->id, layer, p); ass_line[strcspn(ass_line, "\r\n")] = 0; ass = ass_line; } len = av_strlcpy(buf+total_len, ass, bufsize-total_len); if (len > bufsize-total_len-1) { av_log(avctx, AV_LOG_ERROR, "Buffer too small for ASS event.\n"); return -1; } total_len += len; } return total_len; }
true
FFmpeg
860a0810583f54ccbde912aebda8711f18eab8eb
static int ass_encode_frame(AVCodecContext *avctx, unsigned char *buf, int bufsize, const AVSubtitle *sub) { ASSEncodeContext *s = avctx->priv_data; int i, len, total_len = 0; for (i=0; i<sub->num_rects; i++) { char ass_line[2048]; const char *ass = sub->rects[i]->ass; if (sub->rects[i]->type != SUBTITLE_ASS) { av_log(avctx, AV_LOG_ERROR, "Only SUBTITLE_ASS type supported.\n"); return -1; } if (strncmp(ass, "Dialogue: ", 10)) { av_log(avctx, AV_LOG_ERROR, "AVSubtitle rectangle ass \"%s\"" " does not look like a SSA markup\n", ass); return AVERROR_INVALIDDATA; } if (avctx->codec->id == AV_CODEC_ID_ASS) { long int layer; char *p; if (i > 0) { av_log(avctx, AV_LOG_ERROR, "ASS encoder supports only one " "ASS rectangle field.\n"); return AVERROR_INVALIDDATA; } ass += 10; layer = strtol(ass, &p, 10); if (*p) p += strcspn(p, ",") + 1; if (*p) p += strcspn(p, ",") + 1; if (*p) p += strcspn(p, ",") + 1; snprintf(ass_line, sizeof(ass_line), "%d,%ld,%s", ++s->id, layer, p); ass_line[strcspn(ass_line, "\r\n")] = 0; ass = ass_line; } len = av_strlcpy(buf+total_len, ass, bufsize-total_len); if (len > bufsize-total_len-1) { av_log(avctx, AV_LOG_ERROR, "Buffer too small for ASS event.\n"); return -1; } total_len += len; } return total_len; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecContext *VAR_0, unsigned char *VAR_1, int VAR_2, const AVSubtitle *VAR_3) { ASSEncodeContext *s = VAR_0->priv_data; int VAR_4, VAR_5, VAR_6 = 0; for (VAR_4=0; VAR_4<VAR_3->num_rects; VAR_4++) { char ass_line[2048]; const char *ass = VAR_3->rects[VAR_4]->ass; if (VAR_3->rects[VAR_4]->type != SUBTITLE_ASS) { av_log(VAR_0, AV_LOG_ERROR, "Only SUBTITLE_ASS type supported.\n"); return -1; } if (strncmp(ass, "Dialogue: ", 10)) { av_log(VAR_0, AV_LOG_ERROR, "AVSubtitle rectangle ass \"%s\"" " does not look like a SSA markup\n", ass); return AVERROR_INVALIDDATA; } if (VAR_0->codec->id == AV_CODEC_ID_ASS) { long int layer; char *p; if (VAR_4 > 0) { av_log(VAR_0, AV_LOG_ERROR, "ASS encoder supports only one " "ASS rectangle field.\n"); return AVERROR_INVALIDDATA; } ass += 10; layer = strtol(ass, &p, 10); if (*p) p += strcspn(p, ",") + 1; if (*p) p += strcspn(p, ",") + 1; if (*p) p += strcspn(p, ",") + 1; snprintf(ass_line, sizeof(ass_line), "%d,%ld,%s", ++s->id, layer, p); ass_line[strcspn(ass_line, "\r\n")] = 0; ass = ass_line; } VAR_5 = av_strlcpy(VAR_1+VAR_6, ass, VAR_2-VAR_6); if (VAR_5 > VAR_2-VAR_6-1) { av_log(VAR_0, AV_LOG_ERROR, "Buffer too small for ASS event.\n"); return -1; } VAR_6 += VAR_5; } return VAR_6; }
[ "static int FUNC_0(AVCodecContext *VAR_0,\nunsigned char *VAR_1, int VAR_2,\nconst AVSubtitle *VAR_3)\n{", "ASSEncodeContext *s = VAR_0->priv_data;", "int VAR_4, VAR_5, VAR_6 = 0;", "for (VAR_4=0; VAR_4<VAR_3->num_rects; VAR_4++) {", "char ass_line[2048];", "const char *ass = VAR_3->rects[VAR_4]->ass;", "if (VAR_3->rects[VAR_4]->type != SUBTITLE_ASS) {", "av_log(VAR_0, AV_LOG_ERROR, \"Only SUBTITLE_ASS type supported.\\n\");", "return -1;", "}", "if (strncmp(ass, \"Dialogue: \", 10)) {", "av_log(VAR_0, AV_LOG_ERROR, \"AVSubtitle rectangle ass \\\"%s\\\"\"\n\" does not look like a SSA markup\\n\", ass);", "return AVERROR_INVALIDDATA;", "}", "if (VAR_0->codec->id == AV_CODEC_ID_ASS) {", "long int layer;", "char *p;", "if (VAR_4 > 0) {", "av_log(VAR_0, AV_LOG_ERROR, \"ASS encoder supports only one \"\n\"ASS rectangle field.\\n\");", "return AVERROR_INVALIDDATA;", "}", "ass += 10;", "layer = strtol(ass, &p, 10);", "if (*p) p += strcspn(p, \",\") + 1;", "if (*p) p += strcspn(p, \",\") + 1;", "if (*p) p += strcspn(p, \",\") + 1;", "snprintf(ass_line, sizeof(ass_line), \"%d,%ld,%s\", ++s->id, layer, p);", "ass_line[strcspn(ass_line, \"\\r\\n\")] = 0;", "ass = ass_line;", "}", "VAR_5 = av_strlcpy(VAR_1+VAR_6, ass, VAR_2-VAR_6);", "if (VAR_5 > VAR_2-VAR_6-1) {", "av_log(VAR_0, AV_LOG_ERROR, \"Buffer too small for ASS event.\\n\");", "return -1;", "}", "VAR_6 += VAR_5;", "}", "return VAR_6;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35, 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [ 55, 57 ], [ 59 ], [ 61 ], [ 65 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 103 ], [ 105 ], [ 109 ], [ 111 ] ]
14,755
static void lsp2lpc(int16_t *lpc) { int f1[LPC_ORDER / 2 + 1]; int f2[LPC_ORDER / 2 + 1]; int i, j; /* Calculate negative cosine */ for (j = 0; j < LPC_ORDER; j++) { int index = (lpc[j] >> 7) & 0x1FF; int offset = lpc[j] & 0x7f; int temp1 = cos_tab[index] << 16; int temp2 = (cos_tab[index + 1] - cos_tab[index]) * ((offset << 8) + 0x80) << 1; lpc[j] = -(av_sat_dadd32(1 << 15, temp1 + temp2) >> 16); } /* * Compute sum and difference polynomial coefficients * (bitexact alternative to lsp2poly() in lsp.c) */ /* Initialize with values in Q28 */ f1[0] = 1 << 28; f1[1] = (lpc[0] << 14) + (lpc[2] << 14); f1[2] = lpc[0] * lpc[2] + (2 << 28); f2[0] = 1 << 28; f2[1] = (lpc[1] << 14) + (lpc[3] << 14); f2[2] = lpc[1] * lpc[3] + (2 << 28); /* * Calculate and scale the coefficients by 1/2 in * each iteration for a final scaling factor of Q25 */ for (i = 2; i < LPC_ORDER / 2; i++) { f1[i + 1] = f1[i - 1] + MULL2(f1[i], lpc[2 * i]); f2[i + 1] = f2[i - 1] + MULL2(f2[i], lpc[2 * i + 1]); for (j = i; j >= 2; j--) { f1[j] = MULL2(f1[j - 1], lpc[2 * i]) + (f1[j] >> 1) + (f1[j - 2] >> 1); f2[j] = MULL2(f2[j - 1], lpc[2 * i + 1]) + (f2[j] >> 1) + (f2[j - 2] >> 1); } f1[0] >>= 1; f2[0] >>= 1; f1[1] = ((lpc[2 * i] << 16 >> i) + f1[1]) >> 1; f2[1] = ((lpc[2 * i + 1] << 16 >> i) + f2[1]) >> 1; } /* Convert polynomial coefficients to LPC coefficients */ for (i = 0; i < LPC_ORDER / 2; i++) { int64_t ff1 = f1[i + 1] + f1[i]; int64_t ff2 = f2[i + 1] - f2[i]; lpc[i] = av_clipl_int32(((ff1 + ff2) << 3) + (1 << 15)) >> 16; lpc[LPC_ORDER - i - 1] = av_clipl_int32(((ff1 - ff2) << 3) + (1 << 15)) >> 16; } }
true
FFmpeg
4ace2d22192f3995911ec926940125dcb29d606a
static void lsp2lpc(int16_t *lpc) { int f1[LPC_ORDER / 2 + 1]; int f2[LPC_ORDER / 2 + 1]; int i, j; for (j = 0; j < LPC_ORDER; j++) { int index = (lpc[j] >> 7) & 0x1FF; int offset = lpc[j] & 0x7f; int temp1 = cos_tab[index] << 16; int temp2 = (cos_tab[index + 1] - cos_tab[index]) * ((offset << 8) + 0x80) << 1; lpc[j] = -(av_sat_dadd32(1 << 15, temp1 + temp2) >> 16); } f1[0] = 1 << 28; f1[1] = (lpc[0] << 14) + (lpc[2] << 14); f1[2] = lpc[0] * lpc[2] + (2 << 28); f2[0] = 1 << 28; f2[1] = (lpc[1] << 14) + (lpc[3] << 14); f2[2] = lpc[1] * lpc[3] + (2 << 28); for (i = 2; i < LPC_ORDER / 2; i++) { f1[i + 1] = f1[i - 1] + MULL2(f1[i], lpc[2 * i]); f2[i + 1] = f2[i - 1] + MULL2(f2[i], lpc[2 * i + 1]); for (j = i; j >= 2; j--) { f1[j] = MULL2(f1[j - 1], lpc[2 * i]) + (f1[j] >> 1) + (f1[j - 2] >> 1); f2[j] = MULL2(f2[j - 1], lpc[2 * i + 1]) + (f2[j] >> 1) + (f2[j - 2] >> 1); } f1[0] >>= 1; f2[0] >>= 1; f1[1] = ((lpc[2 * i] << 16 >> i) + f1[1]) >> 1; f2[1] = ((lpc[2 * i + 1] << 16 >> i) + f2[1]) >> 1; } for (i = 0; i < LPC_ORDER / 2; i++) { int64_t ff1 = f1[i + 1] + f1[i]; int64_t ff2 = f2[i + 1] - f2[i]; lpc[i] = av_clipl_int32(((ff1 + ff2) << 3) + (1 << 15)) >> 16; lpc[LPC_ORDER - i - 1] = av_clipl_int32(((ff1 - ff2) << 3) + (1 << 15)) >> 16; } }
{ "code": [ " int temp1 = cos_tab[index] << 16;", " ((offset << 8) + 0x80) << 1;", " f1[1] = (lpc[0] << 14) + (lpc[2] << 14);", " f2[1] = (lpc[1] << 14) + (lpc[3] << 14);", " f1[1] = ((lpc[2 * i] << 16 >> i) + f1[1]) >> 1;", " f2[1] = ((lpc[2 * i + 1] << 16 >> i) + f2[1]) >> 1;", " lpc[i] = av_clipl_int32(((ff1 + ff2) << 3) + (1 << 15)) >> 16;", " lpc[LPC_ORDER - i - 1] = av_clipl_int32(((ff1 - ff2) << 3) +" ], "line_no": [ 21, 25, 47, 55, 95, 97, 113, 115 ] }
static void FUNC_0(int16_t *VAR_0) { int VAR_1[LPC_ORDER / 2 + 1]; int VAR_2[LPC_ORDER / 2 + 1]; int VAR_3, VAR_4; for (VAR_4 = 0; VAR_4 < LPC_ORDER; VAR_4++) { int index = (VAR_0[VAR_4] >> 7) & 0x1FF; int offset = VAR_0[VAR_4] & 0x7f; int temp1 = cos_tab[index] << 16; int temp2 = (cos_tab[index + 1] - cos_tab[index]) * ((offset << 8) + 0x80) << 1; VAR_0[VAR_4] = -(av_sat_dadd32(1 << 15, temp1 + temp2) >> 16); } VAR_1[0] = 1 << 28; VAR_1[1] = (VAR_0[0] << 14) + (VAR_0[2] << 14); VAR_1[2] = VAR_0[0] * VAR_0[2] + (2 << 28); VAR_2[0] = 1 << 28; VAR_2[1] = (VAR_0[1] << 14) + (VAR_0[3] << 14); VAR_2[2] = VAR_0[1] * VAR_0[3] + (2 << 28); for (VAR_3 = 2; VAR_3 < LPC_ORDER / 2; VAR_3++) { VAR_1[VAR_3 + 1] = VAR_1[VAR_3 - 1] + MULL2(VAR_1[VAR_3], VAR_0[2 * VAR_3]); VAR_2[VAR_3 + 1] = VAR_2[VAR_3 - 1] + MULL2(VAR_2[VAR_3], VAR_0[2 * VAR_3 + 1]); for (VAR_4 = VAR_3; VAR_4 >= 2; VAR_4--) { VAR_1[VAR_4] = MULL2(VAR_1[VAR_4 - 1], VAR_0[2 * VAR_3]) + (VAR_1[VAR_4] >> 1) + (VAR_1[VAR_4 - 2] >> 1); VAR_2[VAR_4] = MULL2(VAR_2[VAR_4 - 1], VAR_0[2 * VAR_3 + 1]) + (VAR_2[VAR_4] >> 1) + (VAR_2[VAR_4 - 2] >> 1); } VAR_1[0] >>= 1; VAR_2[0] >>= 1; VAR_1[1] = ((VAR_0[2 * VAR_3] << 16 >> VAR_3) + VAR_1[1]) >> 1; VAR_2[1] = ((VAR_0[2 * VAR_3 + 1] << 16 >> VAR_3) + VAR_2[1]) >> 1; } for (VAR_3 = 0; VAR_3 < LPC_ORDER / 2; VAR_3++) { int64_t ff1 = VAR_1[VAR_3 + 1] + VAR_1[VAR_3]; int64_t ff2 = VAR_2[VAR_3 + 1] - VAR_2[VAR_3]; VAR_0[VAR_3] = av_clipl_int32(((ff1 + ff2) << 3) + (1 << 15)) >> 16; VAR_0[LPC_ORDER - VAR_3 - 1] = av_clipl_int32(((ff1 - ff2) << 3) + (1 << 15)) >> 16; } }
[ "static void FUNC_0(int16_t *VAR_0)\n{", "int VAR_1[LPC_ORDER / 2 + 1];", "int VAR_2[LPC_ORDER / 2 + 1];", "int VAR_3, VAR_4;", "for (VAR_4 = 0; VAR_4 < LPC_ORDER; VAR_4++) {", "int index = (VAR_0[VAR_4] >> 7) & 0x1FF;", "int offset = VAR_0[VAR_4] & 0x7f;", "int temp1 = cos_tab[index] << 16;", "int temp2 = (cos_tab[index + 1] - cos_tab[index]) *\n((offset << 8) + 0x80) << 1;", "VAR_0[VAR_4] = -(av_sat_dadd32(1 << 15, temp1 + temp2) >> 16);", "}", "VAR_1[0] = 1 << 28;", "VAR_1[1] = (VAR_0[0] << 14) + (VAR_0[2] << 14);", "VAR_1[2] = VAR_0[0] * VAR_0[2] + (2 << 28);", "VAR_2[0] = 1 << 28;", "VAR_2[1] = (VAR_0[1] << 14) + (VAR_0[3] << 14);", "VAR_2[2] = VAR_0[1] * VAR_0[3] + (2 << 28);", "for (VAR_3 = 2; VAR_3 < LPC_ORDER / 2; VAR_3++) {", "VAR_1[VAR_3 + 1] = VAR_1[VAR_3 - 1] + MULL2(VAR_1[VAR_3], VAR_0[2 * VAR_3]);", "VAR_2[VAR_3 + 1] = VAR_2[VAR_3 - 1] + MULL2(VAR_2[VAR_3], VAR_0[2 * VAR_3 + 1]);", "for (VAR_4 = VAR_3; VAR_4 >= 2; VAR_4--) {", "VAR_1[VAR_4] = MULL2(VAR_1[VAR_4 - 1], VAR_0[2 * VAR_3]) +\n(VAR_1[VAR_4] >> 1) + (VAR_1[VAR_4 - 2] >> 1);", "VAR_2[VAR_4] = MULL2(VAR_2[VAR_4 - 1], VAR_0[2 * VAR_3 + 1]) +\n(VAR_2[VAR_4] >> 1) + (VAR_2[VAR_4 - 2] >> 1);", "}", "VAR_1[0] >>= 1;", "VAR_2[0] >>= 1;", "VAR_1[1] = ((VAR_0[2 * VAR_3] << 16 >> VAR_3) + VAR_1[1]) >> 1;", "VAR_2[1] = ((VAR_0[2 * VAR_3 + 1] << 16 >> VAR_3) + VAR_2[1]) >> 1;", "}", "for (VAR_3 = 0; VAR_3 < LPC_ORDER / 2; VAR_3++) {", "int64_t ff1 = VAR_1[VAR_3 + 1] + VAR_1[VAR_3];", "int64_t ff2 = VAR_2[VAR_3 + 1] - VAR_2[VAR_3];", "VAR_0[VAR_3] = av_clipl_int32(((ff1 + ff2) << 3) + (1 << 15)) >> 16;", "VAR_0[LPC_ORDER - VAR_3 - 1] = av_clipl_int32(((ff1 - ff2) << 3) +\n(1 << 15)) >> 16;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23, 25 ], [ 29 ], [ 31 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ], [ 57 ], [ 69 ], [ 71 ], [ 73 ], [ 77 ], [ 79, 81 ], [ 83, 85 ], [ 87 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 105 ], [ 107 ], [ 109 ], [ 113 ], [ 115, 117 ], [ 119 ], [ 121 ] ]
14,756
static void blockdev_backup_abort(BlkActionState *common) { BlockdevBackupState *state = DO_UPCAST(BlockdevBackupState, common, common); BlockDriverState *bs = state->bs; /* Only cancel if it's the job we started */ if (bs && bs->job && bs->job == state->job) { block_job_cancel_sync(bs->job); } }
true
qemu
111049a4ecefc9cf1ac75c773f4c5c165f27fe63
static void blockdev_backup_abort(BlkActionState *common) { BlockdevBackupState *state = DO_UPCAST(BlockdevBackupState, common, common); BlockDriverState *bs = state->bs; if (bs && bs->job && bs->job == state->job) { block_job_cancel_sync(bs->job); } }
{ "code": [ " BlockDriverState *bs = state->bs;", " if (bs && bs->job && bs->job == state->job) {", " block_job_cancel_sync(bs->job);", " BlockDriverState *bs = state->bs;", " if (bs && bs->job && bs->job == state->job) {", " block_job_cancel_sync(bs->job);" ], "line_no": [ 7, 13, 15, 7, 13, 15 ] }
static void FUNC_0(BlkActionState *VAR_0) { BlockdevBackupState *state = DO_UPCAST(BlockdevBackupState, VAR_0, VAR_0); BlockDriverState *bs = state->bs; if (bs && bs->job && bs->job == state->job) { block_job_cancel_sync(bs->job); } }
[ "static void FUNC_0(BlkActionState *VAR_0)\n{", "BlockdevBackupState *state = DO_UPCAST(BlockdevBackupState, VAR_0, VAR_0);", "BlockDriverState *bs = state->bs;", "if (bs && bs->job && bs->job == state->job) {", "block_job_cancel_sync(bs->job);", "}", "}" ]
[ 0, 0, 1, 1, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ] ]
14,757
static void pc_init_pci_1_2(QEMUMachineInitArgs *args) { disable_kvm_pv_eoi(); enable_compat_apic_id_mode(); pc_sysfw_flash_vs_rom_bug_compatible = true; has_pvpanic = false; pc_init_pci(args); }
true
qemu
9e1c2ec8fd8d9a9ee299ea86c5f6c986fe25e838
static void pc_init_pci_1_2(QEMUMachineInitArgs *args) { disable_kvm_pv_eoi(); enable_compat_apic_id_mode(); pc_sysfw_flash_vs_rom_bug_compatible = true; has_pvpanic = false; pc_init_pci(args); }
{ "code": [ " pc_sysfw_flash_vs_rom_bug_compatible = true;", " pc_sysfw_flash_vs_rom_bug_compatible = true;", " pc_sysfw_flash_vs_rom_bug_compatible = true;", " pc_sysfw_flash_vs_rom_bug_compatible = true;" ], "line_no": [ 9, 9, 9, 9 ] }
static void FUNC_0(QEMUMachineInitArgs *VAR_0) { disable_kvm_pv_eoi(); enable_compat_apic_id_mode(); pc_sysfw_flash_vs_rom_bug_compatible = true; has_pvpanic = false; pc_init_pci(VAR_0); }
[ "static void FUNC_0(QEMUMachineInitArgs *VAR_0)\n{", "disable_kvm_pv_eoi();", "enable_compat_apic_id_mode();", "pc_sysfw_flash_vs_rom_bug_compatible = true;", "has_pvpanic = false;", "pc_init_pci(VAR_0);", "}" ]
[ 0, 0, 0, 1, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ] ]
14,759
static int decode_nal_sei_message(GetBitContext *gb, void *logctx, HEVCSEI *s, const HEVCParamSets *ps, int nal_unit_type) { int payload_type = 0; int payload_size = 0; int byte = 0xFF; av_log(logctx, AV_LOG_DEBUG, "Decoding SEI\n"); while (byte == 0xFF) { byte = get_bits(gb, 8); payload_type += byte; } byte = 0xFF; while (byte == 0xFF) { byte = get_bits(gb, 8); payload_size += byte; } if (nal_unit_type == HEVC_NAL_SEI_PREFIX) { return decode_nal_sei_prefix(gb, logctx, s, ps, payload_type, payload_size); } else { /* nal_unit_type == NAL_SEI_SUFFIX */ return decode_nal_sei_suffix(gb, logctx, s, payload_type, payload_size); } }
true
FFmpeg
991ef6e5b9a6a9d95e274ff6bff52db1c82b3808
static int decode_nal_sei_message(GetBitContext *gb, void *logctx, HEVCSEI *s, const HEVCParamSets *ps, int nal_unit_type) { int payload_type = 0; int payload_size = 0; int byte = 0xFF; av_log(logctx, AV_LOG_DEBUG, "Decoding SEI\n"); while (byte == 0xFF) { byte = get_bits(gb, 8); payload_type += byte; } byte = 0xFF; while (byte == 0xFF) { byte = get_bits(gb, 8); payload_size += byte; } if (nal_unit_type == HEVC_NAL_SEI_PREFIX) { return decode_nal_sei_prefix(gb, logctx, s, ps, payload_type, payload_size); } else { return decode_nal_sei_suffix(gb, logctx, s, payload_type, payload_size); } }
{ "code": [], "line_no": [] }
static int FUNC_0(GetBitContext *VAR_0, void *VAR_1, HEVCSEI *VAR_2, const HEVCParamSets *VAR_3, int VAR_4) { int VAR_5 = 0; int VAR_6 = 0; int VAR_7 = 0xFF; av_log(VAR_1, AV_LOG_DEBUG, "Decoding SEI\n"); while (VAR_7 == 0xFF) { VAR_7 = get_bits(VAR_0, 8); VAR_5 += VAR_7; } VAR_7 = 0xFF; while (VAR_7 == 0xFF) { VAR_7 = get_bits(VAR_0, 8); VAR_6 += VAR_7; } if (VAR_4 == HEVC_NAL_SEI_PREFIX) { return decode_nal_sei_prefix(VAR_0, VAR_1, VAR_2, VAR_3, VAR_5, VAR_6); } else { return decode_nal_sei_suffix(VAR_0, VAR_1, VAR_2, VAR_5, VAR_6); } }
[ "static int FUNC_0(GetBitContext *VAR_0, void *VAR_1, HEVCSEI *VAR_2,\nconst HEVCParamSets *VAR_3, int VAR_4)\n{", "int VAR_5 = 0;", "int VAR_6 = 0;", "int VAR_7 = 0xFF;", "av_log(VAR_1, AV_LOG_DEBUG, \"Decoding SEI\\n\");", "while (VAR_7 == 0xFF) {", "VAR_7 = get_bits(VAR_0, 8);", "VAR_5 += VAR_7;", "}", "VAR_7 = 0xFF;", "while (VAR_7 == 0xFF) {", "VAR_7 = get_bits(VAR_0, 8);", "VAR_6 += VAR_7;", "}", "if (VAR_4 == HEVC_NAL_SEI_PREFIX) {", "return decode_nal_sei_prefix(VAR_0, VAR_1, VAR_2, VAR_3, VAR_5, VAR_6);", "} else {", "return decode_nal_sei_suffix(VAR_0, VAR_1, VAR_2, VAR_5, VAR_6);", "}", "}" ]
[ 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 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ] ]
14,760
static void parse_type_number(Visitor *v, const char *name, double *obj, Error **errp) { StringInputVisitor *siv = to_siv(v); char *endp = (char *) siv->string; double val; errno = 0; if (siv->string) { val = strtod(siv->string, &endp); } if (!siv->string || errno || endp == siv->string || *endp) { error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null", "number"); return; } *obj = val; }
true
qemu
f332e830e38b3ff3953ef02ac04e409ae53769c5
static void parse_type_number(Visitor *v, const char *name, double *obj, Error **errp) { StringInputVisitor *siv = to_siv(v); char *endp = (char *) siv->string; double val; errno = 0; if (siv->string) { val = strtod(siv->string, &endp); } if (!siv->string || errno || endp == siv->string || *endp) { error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null", "number"); return; } *obj = val; }
{ "code": [ " error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : \"null\",", " if (siv->string) {", " error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : \"null\",", " if (siv->string) {", " if (siv->string) {", " error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : \"null\",", " if (siv->string) {", " val = strtod(siv->string, &endp);", " if (!siv->string || errno || endp == siv->string || *endp) {" ], "line_no": [ 25, 17, 25, 17, 17, 25, 17, 19, 23 ] }
static void FUNC_0(Visitor *VAR_0, const char *VAR_1, double *VAR_2, Error **VAR_3) { StringInputVisitor *siv = to_siv(VAR_0); char *VAR_4 = (char *) siv->string; double VAR_5; errno = 0; if (siv->string) { VAR_5 = strtod(siv->string, &VAR_4); } if (!siv->string || errno || VAR_4 == siv->string || *VAR_4) { error_setg(VAR_3, QERR_INVALID_PARAMETER_TYPE, VAR_1 ? VAR_1 : "null", "number"); return; } *VAR_2 = VAR_5; }
[ "static void FUNC_0(Visitor *VAR_0, const char *VAR_1, double *VAR_2,\nError **VAR_3)\n{", "StringInputVisitor *siv = to_siv(VAR_0);", "char *VAR_4 = (char *) siv->string;", "double VAR_5;", "errno = 0;", "if (siv->string) {", "VAR_5 = strtod(siv->string, &VAR_4);", "}", "if (!siv->string || errno || VAR_4 == siv->string || *VAR_4) {", "error_setg(VAR_3, QERR_INVALID_PARAMETER_TYPE, VAR_1 ? VAR_1 : \"null\",\n\"number\");", "return;", "}", "*VAR_2 = VAR_5;", "}" ]
[ 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25, 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ] ]
14,761
int arm_set_cpu_off(uint64_t cpuid) { CPUState *target_cpu_state; ARMCPU *target_cpu; DPRINTF("cpu %" PRId64 "\n", cpuid); /* change to the cpu we are powering up */ target_cpu_state = arm_get_cpu_by_id(cpuid); if (!target_cpu_state) { return QEMU_ARM_POWERCTL_INVALID_PARAM; } target_cpu = ARM_CPU(target_cpu_state); if (target_cpu->powered_off) { qemu_log_mask(LOG_GUEST_ERROR, "[ARM]%s: CPU %" PRId64 " is already off\n", __func__, cpuid); return QEMU_ARM_POWERCTL_IS_OFF; } target_cpu->powered_off = true; target_cpu_state->halted = 1; target_cpu_state->exception_index = EXCP_HLT; cpu_loop_exit(target_cpu_state); /* notreached */ return QEMU_ARM_POWERCTL_RET_SUCCESS; }
true
qemu
062ba099e01ff1474be98c0a4f3da351efab5d9d
int arm_set_cpu_off(uint64_t cpuid) { CPUState *target_cpu_state; ARMCPU *target_cpu; DPRINTF("cpu %" PRId64 "\n", cpuid); target_cpu_state = arm_get_cpu_by_id(cpuid); if (!target_cpu_state) { return QEMU_ARM_POWERCTL_INVALID_PARAM; } target_cpu = ARM_CPU(target_cpu_state); if (target_cpu->powered_off) { qemu_log_mask(LOG_GUEST_ERROR, "[ARM]%s: CPU %" PRId64 " is already off\n", __func__, cpuid); return QEMU_ARM_POWERCTL_IS_OFF; } target_cpu->powered_off = true; target_cpu_state->halted = 1; target_cpu_state->exception_index = EXCP_HLT; cpu_loop_exit(target_cpu_state); return QEMU_ARM_POWERCTL_RET_SUCCESS; }
{ "code": [ " if (target_cpu->powered_off) {", " target_cpu->powered_off = true;", " target_cpu_state->halted = 1;", " target_cpu_state->exception_index = EXCP_HLT;", " cpu_loop_exit(target_cpu_state);", " if (target_cpu->powered_off) {" ], "line_no": [ 27, 41, 43, 45, 47, 27 ] }
int FUNC_0(uint64_t VAR_0) { CPUState *target_cpu_state; ARMCPU *target_cpu; DPRINTF("cpu %" PRId64 "\n", VAR_0); target_cpu_state = arm_get_cpu_by_id(VAR_0); if (!target_cpu_state) { return QEMU_ARM_POWERCTL_INVALID_PARAM; } target_cpu = ARM_CPU(target_cpu_state); if (target_cpu->powered_off) { qemu_log_mask(LOG_GUEST_ERROR, "[ARM]%s: CPU %" PRId64 " is already off\n", __func__, VAR_0); return QEMU_ARM_POWERCTL_IS_OFF; } target_cpu->powered_off = true; target_cpu_state->halted = 1; target_cpu_state->exception_index = EXCP_HLT; cpu_loop_exit(target_cpu_state); return QEMU_ARM_POWERCTL_RET_SUCCESS; }
[ "int FUNC_0(uint64_t VAR_0)\n{", "CPUState *target_cpu_state;", "ARMCPU *target_cpu;", "DPRINTF(\"cpu %\" PRId64 \"\\n\", VAR_0);", "target_cpu_state = arm_get_cpu_by_id(VAR_0);", "if (!target_cpu_state) {", "return QEMU_ARM_POWERCTL_INVALID_PARAM;", "}", "target_cpu = ARM_CPU(target_cpu_state);", "if (target_cpu->powered_off) {", "qemu_log_mask(LOG_GUEST_ERROR,\n\"[ARM]%s: CPU %\" PRId64 \" is already off\\n\",\n__func__, VAR_0);", "return QEMU_ARM_POWERCTL_IS_OFF;", "}", "target_cpu->powered_off = true;", "target_cpu_state->halted = 1;", "target_cpu_state->exception_index = EXCP_HLT;", "cpu_loop_exit(target_cpu_state);", "return QEMU_ARM_POWERCTL_RET_SUCCESS;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29, 31, 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 53 ], [ 55 ] ]
14,762
static int read_packet(AVFormatContext *s, AVPacket *pkt) { FilmstripDemuxContext *film = s->priv_data; AVStream *st = s->streams[0]; if (s->pb->eof_reached) return AVERROR(EIO); pkt->dts = avio_tell(s->pb) / (st->codec->width * (st->codec->height + film->leading) * 4); pkt->size = av_get_packet(s->pb, pkt, st->codec->width * st->codec->height * 4); avio_skip(s->pb, st->codec->width * film->leading * 4); if (pkt->size < 0) return pkt->size; pkt->flags |= AV_PKT_FLAG_KEY; return 0; }
true
FFmpeg
b46b233baffc2076a1a17a264ba9553ae0d4878f
static int read_packet(AVFormatContext *s, AVPacket *pkt) { FilmstripDemuxContext *film = s->priv_data; AVStream *st = s->streams[0]; if (s->pb->eof_reached) return AVERROR(EIO); pkt->dts = avio_tell(s->pb) / (st->codec->width * (st->codec->height + film->leading) * 4); pkt->size = av_get_packet(s->pb, pkt, st->codec->width * st->codec->height * 4); avio_skip(s->pb, st->codec->width * film->leading * 4); if (pkt->size < 0) return pkt->size; pkt->flags |= AV_PKT_FLAG_KEY; return 0; }
{ "code": [ " avio_skip(s->pb, st->codec->width * film->leading * 4);" ], "line_no": [ 21 ] }
static int FUNC_0(AVFormatContext *VAR_0, AVPacket *VAR_1) { FilmstripDemuxContext *film = VAR_0->priv_data; AVStream *st = VAR_0->streams[0]; if (VAR_0->pb->eof_reached) return AVERROR(EIO); VAR_1->dts = avio_tell(VAR_0->pb) / (st->codec->width * (st->codec->height + film->leading) * 4); VAR_1->size = av_get_packet(VAR_0->pb, VAR_1, st->codec->width * st->codec->height * 4); avio_skip(VAR_0->pb, st->codec->width * film->leading * 4); if (VAR_1->size < 0) return VAR_1->size; VAR_1->flags |= AV_PKT_FLAG_KEY; return 0; }
[ "static int FUNC_0(AVFormatContext *VAR_0,\nAVPacket *VAR_1)\n{", "FilmstripDemuxContext *film = VAR_0->priv_data;", "AVStream *st = VAR_0->streams[0];", "if (VAR_0->pb->eof_reached)\nreturn AVERROR(EIO);", "VAR_1->dts = avio_tell(VAR_0->pb) / (st->codec->width * (st->codec->height + film->leading) * 4);", "VAR_1->size = av_get_packet(VAR_0->pb, VAR_1, st->codec->width * st->codec->height * 4);", "avio_skip(VAR_0->pb, st->codec->width * film->leading * 4);", "if (VAR_1->size < 0)\nreturn VAR_1->size;", "VAR_1->flags |= AV_PKT_FLAG_KEY;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13, 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23, 25 ], [ 27 ], [ 29 ], [ 31 ] ]
14,763
static int get_physical_address_code(CPUState *env, target_phys_addr_t *physical, int *prot, target_ulong address, int is_user) { unsigned int i; uint64_t context; int is_nucleus; if ((env->lsu & IMMU_E) == 0 || (env->pstate & PS_RED) != 0) { /* IMMU disabled */ *physical = ultrasparc_truncate_physical(address); *prot = PAGE_EXEC; return 0; } context = env->dmmu.mmu_primary_context & 0x1fff; is_nucleus = env->tl > 0; for (i = 0; i < 64; i++) { // ctx match, vaddr match, valid? if (ultrasparc_tag_match(&env->itlb[i], address, context, physical, is_nucleus)) { // access ok? if ((env->itlb[i].tte & 0x4) && is_user) { if (env->immu.sfsr) /* Fault status register */ env->immu.sfsr = 2; /* overflow (not read before another fault) */ env->immu.sfsr |= (is_user << 3) | 1; env->exception_index = TT_TFAULT; #ifdef DEBUG_MMU printf("TFAULT at 0x%" PRIx64 "\n", address); #endif return 1; } *prot = PAGE_EXEC; TTE_SET_USED(env->itlb[i].tte); return 0; } } #ifdef DEBUG_MMU printf("TMISS at 0x%" PRIx64 "\n", address); #endif /* Context is stored in DMMU (dmmuregs[1]) also for IMMU */ env->immu.tag_access = (address & ~0x1fffULL) | context; env->exception_index = TT_TMISS; return 1; }
true
qemu
299b520cd4092be3c53f8380b81315c33927d9d3
static int get_physical_address_code(CPUState *env, target_phys_addr_t *physical, int *prot, target_ulong address, int is_user) { unsigned int i; uint64_t context; int is_nucleus; if ((env->lsu & IMMU_E) == 0 || (env->pstate & PS_RED) != 0) { *physical = ultrasparc_truncate_physical(address); *prot = PAGE_EXEC; return 0; } context = env->dmmu.mmu_primary_context & 0x1fff; is_nucleus = env->tl > 0; for (i = 0; i < 64; i++) { if (ultrasparc_tag_match(&env->itlb[i], address, context, physical, is_nucleus)) { if ((env->itlb[i].tte & 0x4) && is_user) { if (env->immu.sfsr) env->immu.sfsr = 2; env->immu.sfsr |= (is_user << 3) | 1; env->exception_index = TT_TFAULT; #ifdef DEBUG_MMU printf("TFAULT at 0x%" PRIx64 "\n", address); #endif return 1; } *prot = PAGE_EXEC; TTE_SET_USED(env->itlb[i].tte); return 0; } } #ifdef DEBUG_MMU printf("TMISS at 0x%" PRIx64 "\n", address); #endif env->immu.tag_access = (address & ~0x1fffULL) | context; env->exception_index = TT_TMISS; return 1; }
{ "code": [ " int is_nucleus;", " context = env->dmmu.mmu_primary_context & 0x1fff;", " is_nucleus = env->tl > 0;", " address, context, physical,", " is_nucleus)) {", " int is_nucleus;", " context = env->dmmu.mmu_primary_context & 0x1fff;", " is_nucleus = env->tl > 0;", " address, context, physical,", " is_nucleus)) {" ], "line_no": [ 13, 31, 33, 43, 45, 13, 31, 33, 43, 45 ] }
static int FUNC_0(CPUState *VAR_0, target_phys_addr_t *VAR_1, int *VAR_2, target_ulong VAR_3, int VAR_4) { unsigned int VAR_5; uint64_t context; int VAR_6; if ((VAR_0->lsu & IMMU_E) == 0 || (VAR_0->pstate & PS_RED) != 0) { *VAR_1 = ultrasparc_truncate_physical(VAR_3); *VAR_2 = PAGE_EXEC; return 0; } context = VAR_0->dmmu.mmu_primary_context & 0x1fff; VAR_6 = VAR_0->tl > 0; for (VAR_5 = 0; VAR_5 < 64; VAR_5++) { if (ultrasparc_tag_match(&VAR_0->itlb[VAR_5], VAR_3, context, VAR_1, VAR_6)) { if ((VAR_0->itlb[VAR_5].tte & 0x4) && VAR_4) { if (VAR_0->immu.sfsr) VAR_0->immu.sfsr = 2; VAR_0->immu.sfsr |= (VAR_4 << 3) | 1; VAR_0->exception_index = TT_TFAULT; #ifdef DEBUG_MMU printf("TFAULT at 0x%" PRIx64 "\n", VAR_3); #endif return 1; } *VAR_2 = PAGE_EXEC; TTE_SET_USED(VAR_0->itlb[VAR_5].tte); return 0; } } #ifdef DEBUG_MMU printf("TMISS at 0x%" PRIx64 "\n", VAR_3); #endif VAR_0->immu.tag_access = (VAR_3 & ~0x1fffULL) | context; VAR_0->exception_index = TT_TMISS; return 1; }
[ "static int FUNC_0(CPUState *VAR_0,\ntarget_phys_addr_t *VAR_1, int *VAR_2,\ntarget_ulong VAR_3, int VAR_4)\n{", "unsigned int VAR_5;", "uint64_t context;", "int VAR_6;", "if ((VAR_0->lsu & IMMU_E) == 0 || (VAR_0->pstate & PS_RED) != 0) {", "*VAR_1 = ultrasparc_truncate_physical(VAR_3);", "*VAR_2 = PAGE_EXEC;", "return 0;", "}", "context = VAR_0->dmmu.mmu_primary_context & 0x1fff;", "VAR_6 = VAR_0->tl > 0;", "for (VAR_5 = 0; VAR_5 < 64; VAR_5++) {", "if (ultrasparc_tag_match(&VAR_0->itlb[VAR_5],\nVAR_3, context, VAR_1,\nVAR_6)) {", "if ((VAR_0->itlb[VAR_5].tte & 0x4) && VAR_4) {", "if (VAR_0->immu.sfsr)\nVAR_0->immu.sfsr = 2;", "VAR_0->immu.sfsr |= (VAR_4 << 3) | 1;", "VAR_0->exception_index = TT_TFAULT;", "#ifdef DEBUG_MMU\nprintf(\"TFAULT at 0x%\" PRIx64 \"\\n\", VAR_3);", "#endif\nreturn 1;", "}", "*VAR_2 = PAGE_EXEC;", "TTE_SET_USED(VAR_0->itlb[VAR_5].tte);", "return 0;", "}", "}", "#ifdef DEBUG_MMU\nprintf(\"TMISS at 0x%\" PRIx64 \"\\n\", VAR_3);", "#endif\nVAR_0->immu.tag_access = (VAR_3 & ~0x1fffULL) | context;", "VAR_0->exception_index = TT_TMISS;", "return 1;", "}" ]
[ 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 1, 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 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 37 ], [ 41, 43, 45 ], [ 49 ], [ 51, 53 ], [ 57 ], [ 59 ], [ 61, 63 ], [ 65, 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81, 83 ], [ 85, 89 ], [ 91 ], [ 93 ], [ 95 ] ]
14,764
int ff_mjpeg_decode_sof(MJpegDecodeContext *s) { int len, nb_components, i, width, height, bits, pix_fmt_id, ret; int h_count[MAX_COMPONENTS]; int v_count[MAX_COMPONENTS]; s->cur_scan = 0; s->upscale_h = s->upscale_v = 0; /* XXX: verify len field validity */ len = get_bits(&s->gb, 16); s->avctx->bits_per_raw_sample = bits = get_bits(&s->gb, 8); if (s->pegasus_rct) bits = 9; if (bits == 9 && !s->pegasus_rct) s->rct = 1; // FIXME ugly if(s->lossless && s->avctx->lowres){ av_log(s->avctx, AV_LOG_ERROR, "lowres is not possible with lossless jpeg\n"); return -1; height = get_bits(&s->gb, 16); width = get_bits(&s->gb, 16); if (s->avctx->codec_id == AV_CODEC_ID_AMV && (height&15)) avpriv_request_sample(s->avctx, "non mod 16 height AMV\n"); // HACK for odd_height.mov if (s->interlaced && s->width == width && s->height == height + 1) height= s->height; av_log(s->avctx, AV_LOG_DEBUG, "sof0: picture: %dx%d\n", width, height); if (av_image_check_size(width, height, 0, s->avctx)) nb_components = get_bits(&s->gb, 8); if (nb_components <= 0 || nb_components > MAX_COMPONENTS) return -1; if (s->interlaced && (s->bottom_field == !s->interlace_polarity)) { if (nb_components != s->nb_components) { av_log(s->avctx, AV_LOG_ERROR, "nb_components changing in interlaced picture\n"); if (s->ls && !(bits <= 8 || nb_components == 1)) { avpriv_report_missing_feature(s->avctx, "JPEG-LS that is not <= 8 " "bits/component or 16-bit gray"); return AVERROR_PATCHWELCOME; s->nb_components = nb_components; s->h_max = 1; s->v_max = 1; memset(h_count, 0, sizeof(h_count)); memset(v_count, 0, sizeof(v_count)); for (i = 0; i < nb_components; i++) { /* component id */ s->component_id[i] = get_bits(&s->gb, 8) - 1; h_count[i] = get_bits(&s->gb, 4); v_count[i] = get_bits(&s->gb, 4); /* compute hmax and vmax (only used in interleaved case) */ if (h_count[i] > s->h_max) s->h_max = h_count[i]; if (v_count[i] > s->v_max) s->v_max = v_count[i]; s->quant_index[i] = get_bits(&s->gb, 8); if (s->quant_index[i] >= 4) { av_log(s->avctx, AV_LOG_ERROR, "quant_index is invalid\n"); if (!h_count[i] || !v_count[i]) { av_log(s->avctx, AV_LOG_ERROR, "Invalid sampling factor in component %d %d:%d\n", i, h_count[i], v_count[i]); av_log(s->avctx, AV_LOG_DEBUG, "component %d %d:%d id: %d quant:%d\n", i, h_count[i], v_count[i], s->component_id[i], s->quant_index[i]); if (s->ls && (s->h_max > 1 || s->v_max > 1)) { avpriv_report_missing_feature(s->avctx, "Subsampling in JPEG-LS"); return AVERROR_PATCHWELCOME; /* if different size, realloc/alloc picture */ if ( width != s->width || height != s->height || bits != s->bits || memcmp(s->h_count, h_count, sizeof(h_count)) || memcmp(s->v_count, v_count, sizeof(v_count))) { s->width = width; s->height = height; s->bits = bits; memcpy(s->h_count, h_count, sizeof(h_count)); memcpy(s->v_count, v_count, sizeof(v_count)); s->interlaced = 0; s->got_picture = 0; /* test interlaced mode */ if (s->first_picture && s->org_height != 0 && s->height < ((s->org_height * 3) / 4)) { s->interlaced = 1; s->bottom_field = s->interlace_polarity; s->picture_ptr->interlaced_frame = 1; s->picture_ptr->top_field_first = !s->interlace_polarity; height *= 2; ret = ff_set_dimensions(s->avctx, width, height); if (ret < 0) return ret; s->first_picture = 0; if (s->got_picture && s->interlaced && (s->bottom_field == !s->interlace_polarity)) { if (s->progressive) { avpriv_request_sample(s->avctx, "progressively coded interlaced picture"); } else{ if (s->v_max == 1 && s->h_max == 1 && s->lossless==1 && (nb_components==3 || nb_components==4)) s->rgb = 1; else if (!s->lossless) s->rgb = 0; /* XXX: not complete test ! */ pix_fmt_id = (s->h_count[0] << 28) | (s->v_count[0] << 24) | (s->h_count[1] << 20) | (s->v_count[1] << 16) | (s->h_count[2] << 12) | (s->v_count[2] << 8) | (s->h_count[3] << 4) | s->v_count[3]; av_log(s->avctx, AV_LOG_DEBUG, "pix fmt id %x\n", pix_fmt_id); /* NOTE we do not allocate pictures large enough for the possible * padding of h/v_count being 4 */ if (!(pix_fmt_id & 0xD0D0D0D0)) pix_fmt_id -= (pix_fmt_id & 0xF0F0F0F0) >> 1; if (!(pix_fmt_id & 0x0D0D0D0D)) pix_fmt_id -= (pix_fmt_id & 0x0F0F0F0F) >> 1; for (i = 0; i < 8; i++) { int j = 6 + (i&1) - (i&6); int is = (pix_fmt_id >> (4*i)) & 0xF; int js = (pix_fmt_id >> (4*j)) & 0xF; if (is == 1 && js != 2 && (i < 2 || i > 5)) js = (pix_fmt_id >> ( 8 + 4*(i&1))) & 0xF; if (is == 1 && js != 2 && (i < 2 || i > 5)) js = (pix_fmt_id >> (16 + 4*(i&1))) & 0xF; if (is == 1 && js == 2) { if (i & 1) s->upscale_h |= 1 << (j/2); else s->upscale_v |= 1 << (j/2); switch (pix_fmt_id) { case 0x11111100: if (s->rgb) s->avctx->pix_fmt = s->bits <= 9 ? AV_PIX_FMT_BGR24 : AV_PIX_FMT_BGR48; else { if (s->component_id[0] == 'Q' && s->component_id[1] == 'F' && s->component_id[2] == 'A') { s->avctx->pix_fmt = s->bits <= 8 ? AV_PIX_FMT_GBRP : AV_PIX_FMT_GBRP16; } else { if (s->bits <= 8) s->avctx->pix_fmt = s->cs_itu601 ? AV_PIX_FMT_YUV444P : AV_PIX_FMT_YUVJ444P; else s->avctx->pix_fmt = AV_PIX_FMT_YUV444P16; s->avctx->color_range = s->cs_itu601 ? AVCOL_RANGE_MPEG : AVCOL_RANGE_JPEG; av_assert0(s->nb_components == 3); break; case 0x11111111: if (s->rgb) s->avctx->pix_fmt = s->bits <= 9 ? AV_PIX_FMT_ABGR : AV_PIX_FMT_RGBA64; else { if (s->adobe_transform == 0 && s->bits <= 8) { s->avctx->pix_fmt = AV_PIX_FMT_GBRAP; } else { s->avctx->pix_fmt = s->bits <= 8 ? AV_PIX_FMT_YUVA444P : AV_PIX_FMT_YUVA444P16; s->avctx->color_range = s->cs_itu601 ? AVCOL_RANGE_MPEG : AVCOL_RANGE_JPEG; av_assert0(s->nb_components == 4); break; case 0x22111122: if (s->adobe_transform == 0 && s->bits <= 8) { s->avctx->pix_fmt = AV_PIX_FMT_GBRAP; s->upscale_v = 6; s->upscale_h = 6; s->chroma_height = s->height; } else if (s->adobe_transform == 2 && s->bits <= 8) { s->avctx->pix_fmt = AV_PIX_FMT_YUVA444P; s->upscale_v = 6; s->upscale_h = 6; s->chroma_height = s->height; s->avctx->color_range = s->cs_itu601 ? AVCOL_RANGE_MPEG : AVCOL_RANGE_JPEG; } else { if (s->bits <= 8) s->avctx->pix_fmt = AV_PIX_FMT_YUVA420P; else s->avctx->pix_fmt = AV_PIX_FMT_YUVA420P16; s->avctx->color_range = s->cs_itu601 ? AVCOL_RANGE_MPEG : AVCOL_RANGE_JPEG; av_assert0(s->nb_components == 4); break; case 0x12121100: case 0x22122100: case 0x21211100: case 0x22211200: if (s->bits <= 8) s->avctx->pix_fmt = s->cs_itu601 ? AV_PIX_FMT_YUV444P : AV_PIX_FMT_YUVJ444P; else goto unk_pixfmt; s->avctx->color_range = s->cs_itu601 ? AVCOL_RANGE_MPEG : AVCOL_RANGE_JPEG; s->chroma_height = s->height; break; case 0x22221100: case 0x22112200: case 0x11222200: if (s->bits <= 8) s->avctx->pix_fmt = s->cs_itu601 ? AV_PIX_FMT_YUV444P : AV_PIX_FMT_YUVJ444P; else goto unk_pixfmt; s->avctx->color_range = s->cs_itu601 ? AVCOL_RANGE_MPEG : AVCOL_RANGE_JPEG; s->chroma_height = (s->height + 1) / 2; break; case 0x11000000: case 0x13000000: case 0x14000000: case 0x31000000: case 0x33000000: case 0x34000000: case 0x41000000: case 0x43000000: case 0x44000000: if(s->bits <= 8) s->avctx->pix_fmt = AV_PIX_FMT_GRAY8; else s->avctx->pix_fmt = AV_PIX_FMT_GRAY16; break; case 0x12111100: case 0x14121200: case 0x22211100: case 0x22112100: if (s->bits <= 8) s->avctx->pix_fmt = s->cs_itu601 ? AV_PIX_FMT_YUV440P : AV_PIX_FMT_YUVJ440P; else goto unk_pixfmt; s->avctx->color_range = s->cs_itu601 ? AVCOL_RANGE_MPEG : AVCOL_RANGE_JPEG; s->chroma_height = (s->height + 1) / 2; break; case 0x21111100: if (s->bits <= 8) s->avctx->pix_fmt = s->cs_itu601 ? AV_PIX_FMT_YUV422P : AV_PIX_FMT_YUVJ422P; else s->avctx->pix_fmt = AV_PIX_FMT_YUV422P16; s->avctx->color_range = s->cs_itu601 ? AVCOL_RANGE_MPEG : AVCOL_RANGE_JPEG; break; case 0x22121100: case 0x22111200: if (s->bits <= 8) s->avctx->pix_fmt = s->cs_itu601 ? AV_PIX_FMT_YUV422P : AV_PIX_FMT_YUVJ422P; else goto unk_pixfmt; s->avctx->color_range = s->cs_itu601 ? AVCOL_RANGE_MPEG : AVCOL_RANGE_JPEG; break; case 0x22111100: case 0x42111100: if (s->bits <= 8) s->avctx->pix_fmt = s->cs_itu601 ? AV_PIX_FMT_YUV420P : AV_PIX_FMT_YUVJ420P; else s->avctx->pix_fmt = AV_PIX_FMT_YUV420P16; s->avctx->color_range = s->cs_itu601 ? AVCOL_RANGE_MPEG : AVCOL_RANGE_JPEG; if (pix_fmt_id == 0x42111100) { s->upscale_h = 6; s->chroma_height = (s->height + 1) / 2; break; case 0x41111100: if (s->bits <= 8) s->avctx->pix_fmt = s->cs_itu601 ? AV_PIX_FMT_YUV411P : AV_PIX_FMT_YUVJ411P; else goto unk_pixfmt; s->avctx->color_range = s->cs_itu601 ? AVCOL_RANGE_MPEG : AVCOL_RANGE_JPEG; break; default: unk_pixfmt: av_log(s->avctx, AV_LOG_ERROR, "Unhandled pixel format 0x%x\n", pix_fmt_id); s->upscale_h = s->upscale_v = 0; return AVERROR_PATCHWELCOME; if ((s->upscale_h || s->upscale_v) && s->avctx->lowres) { av_log(s->avctx, AV_LOG_ERROR, "lowres not supported for weird subsampling\n"); return AVERROR_PATCHWELCOME; if (s->ls) { s->upscale_h = s->upscale_v = 0; if (s->nb_components > 1) s->avctx->pix_fmt = AV_PIX_FMT_RGB24; else if (s->palette_index && s->bits <= 8) s->avctx->pix_fmt = AV_PIX_FMT_PAL8; else if (s->bits <= 8) s->avctx->pix_fmt = AV_PIX_FMT_GRAY8; else s->avctx->pix_fmt = AV_PIX_FMT_GRAY16; s->pix_desc = av_pix_fmt_desc_get(s->avctx->pix_fmt); if (!s->pix_desc) { av_log(s->avctx, AV_LOG_ERROR, "Could not get a pixel format descriptor.\n"); return AVERROR_BUG; av_frame_unref(s->picture_ptr); if (ff_get_buffer(s->avctx, s->picture_ptr, AV_GET_BUFFER_FLAG_REF) < 0) return -1; s->picture_ptr->pict_type = AV_PICTURE_TYPE_I; s->picture_ptr->key_frame = 1; s->got_picture = 1; for (i = 0; i < 4; i++) s->linesize[i] = s->picture_ptr->linesize[i] << s->interlaced; av_dlog(s->avctx, "%d %d %d %d %d %d\n", s->width, s->height, s->linesize[0], s->linesize[1], s->interlaced, s->avctx->height); if (len != (8 + (3 * nb_components))) av_log(s->avctx, AV_LOG_DEBUG, "decode_sof0: error, len(%d) mismatch\n", len); if (s->rgb && !s->lossless && !s->ls) { av_log(s->avctx, AV_LOG_ERROR, "Unsupported coding and pixel format combination\n"); return AVERROR_PATCHWELCOME; /* totally blank picture as progressive JPEG will only add details to it */ if (s->progressive) { int bw = (width + s->h_max * 8 - 1) / (s->h_max * 8); int bh = (height + s->v_max * 8 - 1) / (s->v_max * 8); for (i = 0; i < s->nb_components; i++) { int size = bw * bh * s->h_count[i] * s->v_count[i]; av_freep(&s->blocks[i]); av_freep(&s->last_nnz[i]); s->blocks[i] = av_mallocz_array(size, sizeof(**s->blocks)); s->last_nnz[i] = av_mallocz_array(size, sizeof(**s->last_nnz)); if (!s->blocks[i] || !s->last_nnz[i]) return AVERROR(ENOMEM); s->block_stride[i] = bw * s->h_count[i]; memset(s->coefs_finished, 0, sizeof(s->coefs_finished)); return 0;
true
FFmpeg
0db1f2c2c78db18999fccd46a156408e5e87c8a1
int ff_mjpeg_decode_sof(MJpegDecodeContext *s) { int len, nb_components, i, width, height, bits, pix_fmt_id, ret; int h_count[MAX_COMPONENTS]; int v_count[MAX_COMPONENTS]; s->cur_scan = 0; s->upscale_h = s->upscale_v = 0; len = get_bits(&s->gb, 16); s->avctx->bits_per_raw_sample = bits = get_bits(&s->gb, 8); if (s->pegasus_rct) bits = 9; if (bits == 9 && !s->pegasus_rct) s->rct = 1; if(s->lossless && s->avctx->lowres){ av_log(s->avctx, AV_LOG_ERROR, "lowres is not possible with lossless jpeg\n"); return -1; height = get_bits(&s->gb, 16); width = get_bits(&s->gb, 16); if (s->avctx->codec_id == AV_CODEC_ID_AMV && (height&15)) avpriv_request_sample(s->avctx, "non mod 16 height AMV\n"); if (s->interlaced && s->width == width && s->height == height + 1) height= s->height; av_log(s->avctx, AV_LOG_DEBUG, "sof0: picture: %dx%d\n", width, height); if (av_image_check_size(width, height, 0, s->avctx)) nb_components = get_bits(&s->gb, 8); if (nb_components <= 0 || nb_components > MAX_COMPONENTS) return -1; if (s->interlaced && (s->bottom_field == !s->interlace_polarity)) { if (nb_components != s->nb_components) { av_log(s->avctx, AV_LOG_ERROR, "nb_components changing in interlaced picture\n"); if (s->ls && !(bits <= 8 || nb_components == 1)) { avpriv_report_missing_feature(s->avctx, "JPEG-LS that is not <= 8 " "bits/component or 16-bit gray"); return AVERROR_PATCHWELCOME; s->nb_components = nb_components; s->h_max = 1; s->v_max = 1; memset(h_count, 0, sizeof(h_count)); memset(v_count, 0, sizeof(v_count)); for (i = 0; i < nb_components; i++) { s->component_id[i] = get_bits(&s->gb, 8) - 1; h_count[i] = get_bits(&s->gb, 4); v_count[i] = get_bits(&s->gb, 4); if (h_count[i] > s->h_max) s->h_max = h_count[i]; if (v_count[i] > s->v_max) s->v_max = v_count[i]; s->quant_index[i] = get_bits(&s->gb, 8); if (s->quant_index[i] >= 4) { av_log(s->avctx, AV_LOG_ERROR, "quant_index is invalid\n"); if (!h_count[i] || !v_count[i]) { av_log(s->avctx, AV_LOG_ERROR, "Invalid sampling factor in component %d %d:%d\n", i, h_count[i], v_count[i]); av_log(s->avctx, AV_LOG_DEBUG, "component %d %d:%d id: %d quant:%d\n", i, h_count[i], v_count[i], s->component_id[i], s->quant_index[i]); if (s->ls && (s->h_max > 1 || s->v_max > 1)) { avpriv_report_missing_feature(s->avctx, "Subsampling in JPEG-LS"); return AVERROR_PATCHWELCOME; if ( width != s->width || height != s->height || bits != s->bits || memcmp(s->h_count, h_count, sizeof(h_count)) || memcmp(s->v_count, v_count, sizeof(v_count))) { s->width = width; s->height = height; s->bits = bits; memcpy(s->h_count, h_count, sizeof(h_count)); memcpy(s->v_count, v_count, sizeof(v_count)); s->interlaced = 0; s->got_picture = 0; if (s->first_picture && s->org_height != 0 && s->height < ((s->org_height * 3) / 4)) { s->interlaced = 1; s->bottom_field = s->interlace_polarity; s->picture_ptr->interlaced_frame = 1; s->picture_ptr->top_field_first = !s->interlace_polarity; height *= 2; ret = ff_set_dimensions(s->avctx, width, height); if (ret < 0) return ret; s->first_picture = 0; if (s->got_picture && s->interlaced && (s->bottom_field == !s->interlace_polarity)) { if (s->progressive) { avpriv_request_sample(s->avctx, "progressively coded interlaced picture"); } else{ if (s->v_max == 1 && s->h_max == 1 && s->lossless==1 && (nb_components==3 || nb_components==4)) s->rgb = 1; else if (!s->lossless) s->rgb = 0; pix_fmt_id = (s->h_count[0] << 28) | (s->v_count[0] << 24) | (s->h_count[1] << 20) | (s->v_count[1] << 16) | (s->h_count[2] << 12) | (s->v_count[2] << 8) | (s->h_count[3] << 4) | s->v_count[3]; av_log(s->avctx, AV_LOG_DEBUG, "pix fmt id %x\n", pix_fmt_id); if (!(pix_fmt_id & 0xD0D0D0D0)) pix_fmt_id -= (pix_fmt_id & 0xF0F0F0F0) >> 1; if (!(pix_fmt_id & 0x0D0D0D0D)) pix_fmt_id -= (pix_fmt_id & 0x0F0F0F0F) >> 1; for (i = 0; i < 8; i++) { int j = 6 + (i&1) - (i&6); int is = (pix_fmt_id >> (4*i)) & 0xF; int js = (pix_fmt_id >> (4*j)) & 0xF; if (is == 1 && js != 2 && (i < 2 || i > 5)) js = (pix_fmt_id >> ( 8 + 4*(i&1))) & 0xF; if (is == 1 && js != 2 && (i < 2 || i > 5)) js = (pix_fmt_id >> (16 + 4*(i&1))) & 0xF; if (is == 1 && js == 2) { if (i & 1) s->upscale_h |= 1 << (j/2); else s->upscale_v |= 1 << (j/2); switch (pix_fmt_id) { case 0x11111100: if (s->rgb) s->avctx->pix_fmt = s->bits <= 9 ? AV_PIX_FMT_BGR24 : AV_PIX_FMT_BGR48; else { if (s->component_id[0] == 'Q' && s->component_id[1] == 'F' && s->component_id[2] == 'A') { s->avctx->pix_fmt = s->bits <= 8 ? AV_PIX_FMT_GBRP : AV_PIX_FMT_GBRP16; } else { if (s->bits <= 8) s->avctx->pix_fmt = s->cs_itu601 ? AV_PIX_FMT_YUV444P : AV_PIX_FMT_YUVJ444P; else s->avctx->pix_fmt = AV_PIX_FMT_YUV444P16; s->avctx->color_range = s->cs_itu601 ? AVCOL_RANGE_MPEG : AVCOL_RANGE_JPEG; av_assert0(s->nb_components == 3); break; case 0x11111111: if (s->rgb) s->avctx->pix_fmt = s->bits <= 9 ? AV_PIX_FMT_ABGR : AV_PIX_FMT_RGBA64; else { if (s->adobe_transform == 0 && s->bits <= 8) { s->avctx->pix_fmt = AV_PIX_FMT_GBRAP; } else { s->avctx->pix_fmt = s->bits <= 8 ? AV_PIX_FMT_YUVA444P : AV_PIX_FMT_YUVA444P16; s->avctx->color_range = s->cs_itu601 ? AVCOL_RANGE_MPEG : AVCOL_RANGE_JPEG; av_assert0(s->nb_components == 4); break; case 0x22111122: if (s->adobe_transform == 0 && s->bits <= 8) { s->avctx->pix_fmt = AV_PIX_FMT_GBRAP; s->upscale_v = 6; s->upscale_h = 6; s->chroma_height = s->height; } else if (s->adobe_transform == 2 && s->bits <= 8) { s->avctx->pix_fmt = AV_PIX_FMT_YUVA444P; s->upscale_v = 6; s->upscale_h = 6; s->chroma_height = s->height; s->avctx->color_range = s->cs_itu601 ? AVCOL_RANGE_MPEG : AVCOL_RANGE_JPEG; } else { if (s->bits <= 8) s->avctx->pix_fmt = AV_PIX_FMT_YUVA420P; else s->avctx->pix_fmt = AV_PIX_FMT_YUVA420P16; s->avctx->color_range = s->cs_itu601 ? AVCOL_RANGE_MPEG : AVCOL_RANGE_JPEG; av_assert0(s->nb_components == 4); break; case 0x12121100: case 0x22122100: case 0x21211100: case 0x22211200: if (s->bits <= 8) s->avctx->pix_fmt = s->cs_itu601 ? AV_PIX_FMT_YUV444P : AV_PIX_FMT_YUVJ444P; else goto unk_pixfmt; s->avctx->color_range = s->cs_itu601 ? AVCOL_RANGE_MPEG : AVCOL_RANGE_JPEG; s->chroma_height = s->height; break; case 0x22221100: case 0x22112200: case 0x11222200: if (s->bits <= 8) s->avctx->pix_fmt = s->cs_itu601 ? AV_PIX_FMT_YUV444P : AV_PIX_FMT_YUVJ444P; else goto unk_pixfmt; s->avctx->color_range = s->cs_itu601 ? AVCOL_RANGE_MPEG : AVCOL_RANGE_JPEG; s->chroma_height = (s->height + 1) / 2; break; case 0x11000000: case 0x13000000: case 0x14000000: case 0x31000000: case 0x33000000: case 0x34000000: case 0x41000000: case 0x43000000: case 0x44000000: if(s->bits <= 8) s->avctx->pix_fmt = AV_PIX_FMT_GRAY8; else s->avctx->pix_fmt = AV_PIX_FMT_GRAY16; break; case 0x12111100: case 0x14121200: case 0x22211100: case 0x22112100: if (s->bits <= 8) s->avctx->pix_fmt = s->cs_itu601 ? AV_PIX_FMT_YUV440P : AV_PIX_FMT_YUVJ440P; else goto unk_pixfmt; s->avctx->color_range = s->cs_itu601 ? AVCOL_RANGE_MPEG : AVCOL_RANGE_JPEG; s->chroma_height = (s->height + 1) / 2; break; case 0x21111100: if (s->bits <= 8) s->avctx->pix_fmt = s->cs_itu601 ? AV_PIX_FMT_YUV422P : AV_PIX_FMT_YUVJ422P; else s->avctx->pix_fmt = AV_PIX_FMT_YUV422P16; s->avctx->color_range = s->cs_itu601 ? AVCOL_RANGE_MPEG : AVCOL_RANGE_JPEG; break; case 0x22121100: case 0x22111200: if (s->bits <= 8) s->avctx->pix_fmt = s->cs_itu601 ? AV_PIX_FMT_YUV422P : AV_PIX_FMT_YUVJ422P; else goto unk_pixfmt; s->avctx->color_range = s->cs_itu601 ? AVCOL_RANGE_MPEG : AVCOL_RANGE_JPEG; break; case 0x22111100: case 0x42111100: if (s->bits <= 8) s->avctx->pix_fmt = s->cs_itu601 ? AV_PIX_FMT_YUV420P : AV_PIX_FMT_YUVJ420P; else s->avctx->pix_fmt = AV_PIX_FMT_YUV420P16; s->avctx->color_range = s->cs_itu601 ? AVCOL_RANGE_MPEG : AVCOL_RANGE_JPEG; if (pix_fmt_id == 0x42111100) { s->upscale_h = 6; s->chroma_height = (s->height + 1) / 2; break; case 0x41111100: if (s->bits <= 8) s->avctx->pix_fmt = s->cs_itu601 ? AV_PIX_FMT_YUV411P : AV_PIX_FMT_YUVJ411P; else goto unk_pixfmt; s->avctx->color_range = s->cs_itu601 ? AVCOL_RANGE_MPEG : AVCOL_RANGE_JPEG; break; default: unk_pixfmt: av_log(s->avctx, AV_LOG_ERROR, "Unhandled pixel format 0x%x\n", pix_fmt_id); s->upscale_h = s->upscale_v = 0; return AVERROR_PATCHWELCOME; if ((s->upscale_h || s->upscale_v) && s->avctx->lowres) { av_log(s->avctx, AV_LOG_ERROR, "lowres not supported for weird subsampling\n"); return AVERROR_PATCHWELCOME; if (s->ls) { s->upscale_h = s->upscale_v = 0; if (s->nb_components > 1) s->avctx->pix_fmt = AV_PIX_FMT_RGB24; else if (s->palette_index && s->bits <= 8) s->avctx->pix_fmt = AV_PIX_FMT_PAL8; else if (s->bits <= 8) s->avctx->pix_fmt = AV_PIX_FMT_GRAY8; else s->avctx->pix_fmt = AV_PIX_FMT_GRAY16; s->pix_desc = av_pix_fmt_desc_get(s->avctx->pix_fmt); if (!s->pix_desc) { av_log(s->avctx, AV_LOG_ERROR, "Could not get a pixel format descriptor.\n"); return AVERROR_BUG; av_frame_unref(s->picture_ptr); if (ff_get_buffer(s->avctx, s->picture_ptr, AV_GET_BUFFER_FLAG_REF) < 0) return -1; s->picture_ptr->pict_type = AV_PICTURE_TYPE_I; s->picture_ptr->key_frame = 1; s->got_picture = 1; for (i = 0; i < 4; i++) s->linesize[i] = s->picture_ptr->linesize[i] << s->interlaced; av_dlog(s->avctx, "%d %d %d %d %d %d\n", s->width, s->height, s->linesize[0], s->linesize[1], s->interlaced, s->avctx->height); if (len != (8 + (3 * nb_components))) av_log(s->avctx, AV_LOG_DEBUG, "decode_sof0: error, len(%d) mismatch\n", len); if (s->rgb && !s->lossless && !s->ls) { av_log(s->avctx, AV_LOG_ERROR, "Unsupported coding and pixel format combination\n"); return AVERROR_PATCHWELCOME; if (s->progressive) { int bw = (width + s->h_max * 8 - 1) / (s->h_max * 8); int bh = (height + s->v_max * 8 - 1) / (s->v_max * 8); for (i = 0; i < s->nb_components; i++) { int size = bw * bh * s->h_count[i] * s->v_count[i]; av_freep(&s->blocks[i]); av_freep(&s->last_nnz[i]); s->blocks[i] = av_mallocz_array(size, sizeof(**s->blocks)); s->last_nnz[i] = av_mallocz_array(size, sizeof(**s->last_nnz)); if (!s->blocks[i] || !s->last_nnz[i]) return AVERROR(ENOMEM); s->block_stride[i] = bw * s->h_count[i]; memset(s->coefs_finished, 0, sizeof(s->coefs_finished)); return 0;
{ "code": [], "line_no": [] }
int FUNC_0(MJpegDecodeContext *VAR_0) { int VAR_1, VAR_2, VAR_3, VAR_4, VAR_5, VAR_6, VAR_7, VAR_8; int VAR_9[MAX_COMPONENTS]; int VAR_10[MAX_COMPONENTS]; VAR_0->cur_scan = 0; VAR_0->upscale_h = VAR_0->upscale_v = 0; VAR_1 = get_bits(&VAR_0->gb, 16); VAR_0->avctx->bits_per_raw_sample = VAR_6 = get_bits(&VAR_0->gb, 8); if (VAR_0->pegasus_rct) VAR_6 = 9; if (VAR_6 == 9 && !VAR_0->pegasus_rct) VAR_0->rct = 1; if(VAR_0->lossless && VAR_0->avctx->lowres){ av_log(VAR_0->avctx, AV_LOG_ERROR, "lowres VAR_12 not possible with lossless jpeg\n"); return -1; VAR_5 = get_bits(&VAR_0->gb, 16); VAR_4 = get_bits(&VAR_0->gb, 16); if (VAR_0->avctx->codec_id == AV_CODEC_ID_AMV && (VAR_5&15)) avpriv_request_sample(VAR_0->avctx, "non mod 16 VAR_5 AMV\n"); if (VAR_0->interlaced && VAR_0->VAR_4 == VAR_4 && VAR_0->VAR_5 == VAR_5 + 1) VAR_5= VAR_0->VAR_5; av_log(VAR_0->avctx, AV_LOG_DEBUG, "sof0: picture: %dx%d\n", VAR_4, VAR_5); if (av_image_check_size(VAR_4, VAR_5, 0, VAR_0->avctx)) VAR_2 = get_bits(&VAR_0->gb, 8); if (VAR_2 <= 0 || VAR_2 > MAX_COMPONENTS) return -1; if (VAR_0->interlaced && (VAR_0->bottom_field == !VAR_0->interlace_polarity)) { if (VAR_2 != VAR_0->VAR_2) { av_log(VAR_0->avctx, AV_LOG_ERROR, "VAR_2 changing in interlaced picture\n"); if (VAR_0->ls && !(VAR_6 <= 8 || VAR_2 == 1)) { avpriv_report_missing_feature(VAR_0->avctx, "JPEG-LS that VAR_12 not <= 8 " "VAR_6/component or 16-bit gray"); return AVERROR_PATCHWELCOME; VAR_0->VAR_2 = VAR_2; VAR_0->h_max = 1; VAR_0->v_max = 1; memset(VAR_9, 0, sizeof(VAR_9)); memset(VAR_10, 0, sizeof(VAR_10)); for (VAR_3 = 0; VAR_3 < VAR_2; VAR_3++) { VAR_0->component_id[VAR_3] = get_bits(&VAR_0->gb, 8) - 1; VAR_9[VAR_3] = get_bits(&VAR_0->gb, 4); VAR_10[VAR_3] = get_bits(&VAR_0->gb, 4); if (VAR_9[VAR_3] > VAR_0->h_max) VAR_0->h_max = VAR_9[VAR_3]; if (VAR_10[VAR_3] > VAR_0->v_max) VAR_0->v_max = VAR_10[VAR_3]; VAR_0->quant_index[VAR_3] = get_bits(&VAR_0->gb, 8); if (VAR_0->quant_index[VAR_3] >= 4) { av_log(VAR_0->avctx, AV_LOG_ERROR, "quant_index VAR_12 invalid\n"); if (!VAR_9[VAR_3] || !VAR_10[VAR_3]) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Invalid sampling factor in component %d %d:%d\n", VAR_3, VAR_9[VAR_3], VAR_10[VAR_3]); av_log(VAR_0->avctx, AV_LOG_DEBUG, "component %d %d:%d id: %d quant:%d\n", VAR_3, VAR_9[VAR_3], VAR_10[VAR_3], VAR_0->component_id[VAR_3], VAR_0->quant_index[VAR_3]); if (VAR_0->ls && (VAR_0->h_max > 1 || VAR_0->v_max > 1)) { avpriv_report_missing_feature(VAR_0->avctx, "Subsampling in JPEG-LS"); return AVERROR_PATCHWELCOME; if ( VAR_4 != VAR_0->VAR_4 || VAR_5 != VAR_0->VAR_5 || VAR_6 != VAR_0->VAR_6 || memcmp(VAR_0->VAR_9, VAR_9, sizeof(VAR_9)) || memcmp(VAR_0->VAR_10, VAR_10, sizeof(VAR_10))) { VAR_0->VAR_4 = VAR_4; VAR_0->VAR_5 = VAR_5; VAR_0->VAR_6 = VAR_6; memcpy(VAR_0->VAR_9, VAR_9, sizeof(VAR_9)); memcpy(VAR_0->VAR_10, VAR_10, sizeof(VAR_10)); VAR_0->interlaced = 0; VAR_0->got_picture = 0; if (VAR_0->first_picture && VAR_0->org_height != 0 && VAR_0->VAR_5 < ((VAR_0->org_height * 3) / 4)) { VAR_0->interlaced = 1; VAR_0->bottom_field = VAR_0->interlace_polarity; VAR_0->picture_ptr->interlaced_frame = 1; VAR_0->picture_ptr->top_field_first = !VAR_0->interlace_polarity; VAR_5 *= 2; VAR_8 = ff_set_dimensions(VAR_0->avctx, VAR_4, VAR_5); if (VAR_8 < 0) return VAR_8; VAR_0->first_picture = 0; if (VAR_0->got_picture && VAR_0->interlaced && (VAR_0->bottom_field == !VAR_0->interlace_polarity)) { if (VAR_0->progressive) { avpriv_request_sample(VAR_0->avctx, "progressively coded interlaced picture"); } else{ if (VAR_0->v_max == 1 && VAR_0->h_max == 1 && VAR_0->lossless==1 && (VAR_2==3 || VAR_2==4)) VAR_0->rgb = 1; else if (!VAR_0->lossless) VAR_0->rgb = 0; VAR_7 = (VAR_0->VAR_9[0] << 28) | (VAR_0->VAR_10[0] << 24) | (VAR_0->VAR_9[1] << 20) | (VAR_0->VAR_10[1] << 16) | (VAR_0->VAR_9[2] << 12) | (VAR_0->VAR_10[2] << 8) | (VAR_0->VAR_9[3] << 4) | VAR_0->VAR_10[3]; av_log(VAR_0->avctx, AV_LOG_DEBUG, "pix fmt id %x\n", VAR_7); if (!(VAR_7 & 0xD0D0D0D0)) VAR_7 -= (VAR_7 & 0xF0F0F0F0) >> 1; if (!(VAR_7 & 0x0D0D0D0D)) VAR_7 -= (VAR_7 & 0x0F0F0F0F) >> 1; for (VAR_3 = 0; VAR_3 < 8; VAR_3++) { int VAR_11 = 6 + (VAR_3&1) - (VAR_3&6); int VAR_12 = (VAR_7 >> (4*VAR_3)) & 0xF; int VAR_13 = (VAR_7 >> (4*VAR_11)) & 0xF; if (VAR_12 == 1 && VAR_13 != 2 && (VAR_3 < 2 || VAR_3 > 5)) VAR_13 = (VAR_7 >> ( 8 + 4*(VAR_3&1))) & 0xF; if (VAR_12 == 1 && VAR_13 != 2 && (VAR_3 < 2 || VAR_3 > 5)) VAR_13 = (VAR_7 >> (16 + 4*(VAR_3&1))) & 0xF; if (VAR_12 == 1 && VAR_13 == 2) { if (VAR_3 & 1) VAR_0->upscale_h |= 1 << (VAR_11/2); else VAR_0->upscale_v |= 1 << (VAR_11/2); switch (VAR_7) { case 0x11111100: if (VAR_0->rgb) VAR_0->avctx->pix_fmt = VAR_0->VAR_6 <= 9 ? AV_PIX_FMT_BGR24 : AV_PIX_FMT_BGR48; else { if (VAR_0->component_id[0] == 'Q' && VAR_0->component_id[1] == 'F' && VAR_0->component_id[2] == 'A') { VAR_0->avctx->pix_fmt = VAR_0->VAR_6 <= 8 ? AV_PIX_FMT_GBRP : AV_PIX_FMT_GBRP16; } else { if (VAR_0->VAR_6 <= 8) VAR_0->avctx->pix_fmt = VAR_0->cs_itu601 ? AV_PIX_FMT_YUV444P : AV_PIX_FMT_YUVJ444P; else VAR_0->avctx->pix_fmt = AV_PIX_FMT_YUV444P16; VAR_0->avctx->color_range = VAR_0->cs_itu601 ? AVCOL_RANGE_MPEG : AVCOL_RANGE_JPEG; av_assert0(VAR_0->VAR_2 == 3); break; case 0x11111111: if (VAR_0->rgb) VAR_0->avctx->pix_fmt = VAR_0->VAR_6 <= 9 ? AV_PIX_FMT_ABGR : AV_PIX_FMT_RGBA64; else { if (VAR_0->adobe_transform == 0 && VAR_0->VAR_6 <= 8) { VAR_0->avctx->pix_fmt = AV_PIX_FMT_GBRAP; } else { VAR_0->avctx->pix_fmt = VAR_0->VAR_6 <= 8 ? AV_PIX_FMT_YUVA444P : AV_PIX_FMT_YUVA444P16; VAR_0->avctx->color_range = VAR_0->cs_itu601 ? AVCOL_RANGE_MPEG : AVCOL_RANGE_JPEG; av_assert0(VAR_0->VAR_2 == 4); break; case 0x22111122: if (VAR_0->adobe_transform == 0 && VAR_0->VAR_6 <= 8) { VAR_0->avctx->pix_fmt = AV_PIX_FMT_GBRAP; VAR_0->upscale_v = 6; VAR_0->upscale_h = 6; VAR_0->chroma_height = VAR_0->VAR_5; } else if (VAR_0->adobe_transform == 2 && VAR_0->VAR_6 <= 8) { VAR_0->avctx->pix_fmt = AV_PIX_FMT_YUVA444P; VAR_0->upscale_v = 6; VAR_0->upscale_h = 6; VAR_0->chroma_height = VAR_0->VAR_5; VAR_0->avctx->color_range = VAR_0->cs_itu601 ? AVCOL_RANGE_MPEG : AVCOL_RANGE_JPEG; } else { if (VAR_0->VAR_6 <= 8) VAR_0->avctx->pix_fmt = AV_PIX_FMT_YUVA420P; else VAR_0->avctx->pix_fmt = AV_PIX_FMT_YUVA420P16; VAR_0->avctx->color_range = VAR_0->cs_itu601 ? AVCOL_RANGE_MPEG : AVCOL_RANGE_JPEG; av_assert0(VAR_0->VAR_2 == 4); break; case 0x12121100: case 0x22122100: case 0x21211100: case 0x22211200: if (VAR_0->VAR_6 <= 8) VAR_0->avctx->pix_fmt = VAR_0->cs_itu601 ? AV_PIX_FMT_YUV444P : AV_PIX_FMT_YUVJ444P; else goto unk_pixfmt; VAR_0->avctx->color_range = VAR_0->cs_itu601 ? AVCOL_RANGE_MPEG : AVCOL_RANGE_JPEG; VAR_0->chroma_height = VAR_0->VAR_5; break; case 0x22221100: case 0x22112200: case 0x11222200: if (VAR_0->VAR_6 <= 8) VAR_0->avctx->pix_fmt = VAR_0->cs_itu601 ? AV_PIX_FMT_YUV444P : AV_PIX_FMT_YUVJ444P; else goto unk_pixfmt; VAR_0->avctx->color_range = VAR_0->cs_itu601 ? AVCOL_RANGE_MPEG : AVCOL_RANGE_JPEG; VAR_0->chroma_height = (VAR_0->VAR_5 + 1) / 2; break; case 0x11000000: case 0x13000000: case 0x14000000: case 0x31000000: case 0x33000000: case 0x34000000: case 0x41000000: case 0x43000000: case 0x44000000: if(VAR_0->VAR_6 <= 8) VAR_0->avctx->pix_fmt = AV_PIX_FMT_GRAY8; else VAR_0->avctx->pix_fmt = AV_PIX_FMT_GRAY16; break; case 0x12111100: case 0x14121200: case 0x22211100: case 0x22112100: if (VAR_0->VAR_6 <= 8) VAR_0->avctx->pix_fmt = VAR_0->cs_itu601 ? AV_PIX_FMT_YUV440P : AV_PIX_FMT_YUVJ440P; else goto unk_pixfmt; VAR_0->avctx->color_range = VAR_0->cs_itu601 ? AVCOL_RANGE_MPEG : AVCOL_RANGE_JPEG; VAR_0->chroma_height = (VAR_0->VAR_5 + 1) / 2; break; case 0x21111100: if (VAR_0->VAR_6 <= 8) VAR_0->avctx->pix_fmt = VAR_0->cs_itu601 ? AV_PIX_FMT_YUV422P : AV_PIX_FMT_YUVJ422P; else VAR_0->avctx->pix_fmt = AV_PIX_FMT_YUV422P16; VAR_0->avctx->color_range = VAR_0->cs_itu601 ? AVCOL_RANGE_MPEG : AVCOL_RANGE_JPEG; break; case 0x22121100: case 0x22111200: if (VAR_0->VAR_6 <= 8) VAR_0->avctx->pix_fmt = VAR_0->cs_itu601 ? AV_PIX_FMT_YUV422P : AV_PIX_FMT_YUVJ422P; else goto unk_pixfmt; VAR_0->avctx->color_range = VAR_0->cs_itu601 ? AVCOL_RANGE_MPEG : AVCOL_RANGE_JPEG; break; case 0x22111100: case 0x42111100: if (VAR_0->VAR_6 <= 8) VAR_0->avctx->pix_fmt = VAR_0->cs_itu601 ? AV_PIX_FMT_YUV420P : AV_PIX_FMT_YUVJ420P; else VAR_0->avctx->pix_fmt = AV_PIX_FMT_YUV420P16; VAR_0->avctx->color_range = VAR_0->cs_itu601 ? AVCOL_RANGE_MPEG : AVCOL_RANGE_JPEG; if (VAR_7 == 0x42111100) { VAR_0->upscale_h = 6; VAR_0->chroma_height = (VAR_0->VAR_5 + 1) / 2; break; case 0x41111100: if (VAR_0->VAR_6 <= 8) VAR_0->avctx->pix_fmt = VAR_0->cs_itu601 ? AV_PIX_FMT_YUV411P : AV_PIX_FMT_YUVJ411P; else goto unk_pixfmt; VAR_0->avctx->color_range = VAR_0->cs_itu601 ? AVCOL_RANGE_MPEG : AVCOL_RANGE_JPEG; break; default: unk_pixfmt: av_log(VAR_0->avctx, AV_LOG_ERROR, "Unhandled pixel format 0x%x\n", VAR_7); VAR_0->upscale_h = VAR_0->upscale_v = 0; return AVERROR_PATCHWELCOME; if ((VAR_0->upscale_h || VAR_0->upscale_v) && VAR_0->avctx->lowres) { av_log(VAR_0->avctx, AV_LOG_ERROR, "lowres not supported for weird subsampling\n"); return AVERROR_PATCHWELCOME; if (VAR_0->ls) { VAR_0->upscale_h = VAR_0->upscale_v = 0; if (VAR_0->VAR_2 > 1) VAR_0->avctx->pix_fmt = AV_PIX_FMT_RGB24; else if (VAR_0->palette_index && VAR_0->VAR_6 <= 8) VAR_0->avctx->pix_fmt = AV_PIX_FMT_PAL8; else if (VAR_0->VAR_6 <= 8) VAR_0->avctx->pix_fmt = AV_PIX_FMT_GRAY8; else VAR_0->avctx->pix_fmt = AV_PIX_FMT_GRAY16; VAR_0->pix_desc = av_pix_fmt_desc_get(VAR_0->avctx->pix_fmt); if (!VAR_0->pix_desc) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Could not get a pixel format descriptor.\n"); return AVERROR_BUG; av_frame_unref(VAR_0->picture_ptr); if (ff_get_buffer(VAR_0->avctx, VAR_0->picture_ptr, AV_GET_BUFFER_FLAG_REF) < 0) return -1; VAR_0->picture_ptr->pict_type = AV_PICTURE_TYPE_I; VAR_0->picture_ptr->key_frame = 1; VAR_0->got_picture = 1; for (VAR_3 = 0; VAR_3 < 4; VAR_3++) VAR_0->linesize[VAR_3] = VAR_0->picture_ptr->linesize[VAR_3] << VAR_0->interlaced; av_dlog(VAR_0->avctx, "%d %d %d %d %d %d\n", VAR_0->VAR_4, VAR_0->VAR_5, VAR_0->linesize[0], VAR_0->linesize[1], VAR_0->interlaced, VAR_0->avctx->VAR_5); if (VAR_1 != (8 + (3 * VAR_2))) av_log(VAR_0->avctx, AV_LOG_DEBUG, "decode_sof0: error, VAR_1(%d) mismatch\n", VAR_1); if (VAR_0->rgb && !VAR_0->lossless && !VAR_0->ls) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Unsupported coding and pixel format combination\n"); return AVERROR_PATCHWELCOME; if (VAR_0->progressive) { int VAR_14 = (VAR_4 + VAR_0->h_max * 8 - 1) / (VAR_0->h_max * 8); int VAR_15 = (VAR_5 + VAR_0->v_max * 8 - 1) / (VAR_0->v_max * 8); for (VAR_3 = 0; VAR_3 < VAR_0->VAR_2; VAR_3++) { int size = VAR_14 * VAR_15 * VAR_0->VAR_9[VAR_3] * VAR_0->VAR_10[VAR_3]; av_freep(&VAR_0->blocks[VAR_3]); av_freep(&VAR_0->last_nnz[VAR_3]); VAR_0->blocks[VAR_3] = av_mallocz_array(size, sizeof(**VAR_0->blocks)); VAR_0->last_nnz[VAR_3] = av_mallocz_array(size, sizeof(**VAR_0->last_nnz)); if (!VAR_0->blocks[VAR_3] || !VAR_0->last_nnz[VAR_3]) return AVERROR(ENOMEM); VAR_0->block_stride[VAR_3] = VAR_14 * VAR_0->VAR_9[VAR_3]; memset(VAR_0->coefs_finished, 0, sizeof(VAR_0->coefs_finished)); return 0;
[ "int FUNC_0(MJpegDecodeContext *VAR_0)\n{", "int VAR_1, VAR_2, VAR_3, VAR_4, VAR_5, VAR_6, VAR_7, VAR_8;", "int VAR_9[MAX_COMPONENTS];", "int VAR_10[MAX_COMPONENTS];", "VAR_0->cur_scan = 0;", "VAR_0->upscale_h = VAR_0->upscale_v = 0;", "VAR_1 = get_bits(&VAR_0->gb, 16);", "VAR_0->avctx->bits_per_raw_sample =\nVAR_6 = get_bits(&VAR_0->gb, 8);", "if (VAR_0->pegasus_rct)\nVAR_6 = 9;", "if (VAR_6 == 9 && !VAR_0->pegasus_rct)\nVAR_0->rct = 1;", "if(VAR_0->lossless && VAR_0->avctx->lowres){", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"lowres VAR_12 not possible with lossless jpeg\\n\");", "return -1;", "VAR_5 = get_bits(&VAR_0->gb, 16);", "VAR_4 = get_bits(&VAR_0->gb, 16);", "if (VAR_0->avctx->codec_id == AV_CODEC_ID_AMV && (VAR_5&15))\navpriv_request_sample(VAR_0->avctx, \"non mod 16 VAR_5 AMV\\n\");", "if (VAR_0->interlaced && VAR_0->VAR_4 == VAR_4 && VAR_0->VAR_5 == VAR_5 + 1)\nVAR_5= VAR_0->VAR_5;", "av_log(VAR_0->avctx, AV_LOG_DEBUG, \"sof0: picture: %dx%d\\n\", VAR_4, VAR_5);", "if (av_image_check_size(VAR_4, VAR_5, 0, VAR_0->avctx))\nVAR_2 = get_bits(&VAR_0->gb, 8);", "if (VAR_2 <= 0 ||\nVAR_2 > MAX_COMPONENTS)\nreturn -1;", "if (VAR_0->interlaced && (VAR_0->bottom_field == !VAR_0->interlace_polarity)) {", "if (VAR_2 != VAR_0->VAR_2) {", "av_log(VAR_0->avctx, AV_LOG_ERROR,\n\"VAR_2 changing in interlaced picture\\n\");", "if (VAR_0->ls && !(VAR_6 <= 8 || VAR_2 == 1)) {", "avpriv_report_missing_feature(VAR_0->avctx,\n\"JPEG-LS that VAR_12 not <= 8 \"\n\"VAR_6/component or 16-bit gray\");", "return AVERROR_PATCHWELCOME;", "VAR_0->VAR_2 = VAR_2;", "VAR_0->h_max = 1;", "VAR_0->v_max = 1;", "memset(VAR_9, 0, sizeof(VAR_9));", "memset(VAR_10, 0, sizeof(VAR_10));", "for (VAR_3 = 0; VAR_3 < VAR_2; VAR_3++) {", "VAR_0->component_id[VAR_3] = get_bits(&VAR_0->gb, 8) - 1;", "VAR_9[VAR_3] = get_bits(&VAR_0->gb, 4);", "VAR_10[VAR_3] = get_bits(&VAR_0->gb, 4);", "if (VAR_9[VAR_3] > VAR_0->h_max)\nVAR_0->h_max = VAR_9[VAR_3];", "if (VAR_10[VAR_3] > VAR_0->v_max)\nVAR_0->v_max = VAR_10[VAR_3];", "VAR_0->quant_index[VAR_3] = get_bits(&VAR_0->gb, 8);", "if (VAR_0->quant_index[VAR_3] >= 4) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"quant_index VAR_12 invalid\\n\");", "if (!VAR_9[VAR_3] || !VAR_10[VAR_3]) {", "av_log(VAR_0->avctx, AV_LOG_ERROR,\n\"Invalid sampling factor in component %d %d:%d\\n\",\nVAR_3, VAR_9[VAR_3], VAR_10[VAR_3]);", "av_log(VAR_0->avctx, AV_LOG_DEBUG, \"component %d %d:%d id: %d quant:%d\\n\",\nVAR_3, VAR_9[VAR_3], VAR_10[VAR_3],\nVAR_0->component_id[VAR_3], VAR_0->quant_index[VAR_3]);", "if (VAR_0->ls && (VAR_0->h_max > 1 || VAR_0->v_max > 1)) {", "avpriv_report_missing_feature(VAR_0->avctx, \"Subsampling in JPEG-LS\");", "return AVERROR_PATCHWELCOME;", "if ( VAR_4 != VAR_0->VAR_4 || VAR_5 != VAR_0->VAR_5\n|| VAR_6 != VAR_0->VAR_6\n|| memcmp(VAR_0->VAR_9, VAR_9, sizeof(VAR_9))\n|| memcmp(VAR_0->VAR_10, VAR_10, sizeof(VAR_10))) {", "VAR_0->VAR_4 = VAR_4;", "VAR_0->VAR_5 = VAR_5;", "VAR_0->VAR_6 = VAR_6;", "memcpy(VAR_0->VAR_9, VAR_9, sizeof(VAR_9));", "memcpy(VAR_0->VAR_10, VAR_10, sizeof(VAR_10));", "VAR_0->interlaced = 0;", "VAR_0->got_picture = 0;", "if (VAR_0->first_picture &&\nVAR_0->org_height != 0 &&\nVAR_0->VAR_5 < ((VAR_0->org_height * 3) / 4)) {", "VAR_0->interlaced = 1;", "VAR_0->bottom_field = VAR_0->interlace_polarity;", "VAR_0->picture_ptr->interlaced_frame = 1;", "VAR_0->picture_ptr->top_field_first = !VAR_0->interlace_polarity;", "VAR_5 *= 2;", "VAR_8 = ff_set_dimensions(VAR_0->avctx, VAR_4, VAR_5);", "if (VAR_8 < 0)\nreturn VAR_8;", "VAR_0->first_picture = 0;", "if (VAR_0->got_picture && VAR_0->interlaced && (VAR_0->bottom_field == !VAR_0->interlace_polarity)) {", "if (VAR_0->progressive) {", "avpriv_request_sample(VAR_0->avctx, \"progressively coded interlaced picture\");", "} else{", "if (VAR_0->v_max == 1 && VAR_0->h_max == 1 && VAR_0->lossless==1 && (VAR_2==3 || VAR_2==4))\nVAR_0->rgb = 1;", "else if (!VAR_0->lossless)\nVAR_0->rgb = 0;", "VAR_7 = (VAR_0->VAR_9[0] << 28) | (VAR_0->VAR_10[0] << 24) |\n(VAR_0->VAR_9[1] << 20) | (VAR_0->VAR_10[1] << 16) |\n(VAR_0->VAR_9[2] << 12) | (VAR_0->VAR_10[2] << 8) |\n(VAR_0->VAR_9[3] << 4) | VAR_0->VAR_10[3];", "av_log(VAR_0->avctx, AV_LOG_DEBUG, \"pix fmt id %x\\n\", VAR_7);", "if (!(VAR_7 & 0xD0D0D0D0))\nVAR_7 -= (VAR_7 & 0xF0F0F0F0) >> 1;", "if (!(VAR_7 & 0x0D0D0D0D))\nVAR_7 -= (VAR_7 & 0x0F0F0F0F) >> 1;", "for (VAR_3 = 0; VAR_3 < 8; VAR_3++) {", "int VAR_11 = 6 + (VAR_3&1) - (VAR_3&6);", "int VAR_12 = (VAR_7 >> (4*VAR_3)) & 0xF;", "int VAR_13 = (VAR_7 >> (4*VAR_11)) & 0xF;", "if (VAR_12 == 1 && VAR_13 != 2 && (VAR_3 < 2 || VAR_3 > 5))\nVAR_13 = (VAR_7 >> ( 8 + 4*(VAR_3&1))) & 0xF;", "if (VAR_12 == 1 && VAR_13 != 2 && (VAR_3 < 2 || VAR_3 > 5))\nVAR_13 = (VAR_7 >> (16 + 4*(VAR_3&1))) & 0xF;", "if (VAR_12 == 1 && VAR_13 == 2) {", "if (VAR_3 & 1) VAR_0->upscale_h |= 1 << (VAR_11/2);", "else VAR_0->upscale_v |= 1 << (VAR_11/2);", "switch (VAR_7) {", "case 0x11111100:\nif (VAR_0->rgb)\nVAR_0->avctx->pix_fmt = VAR_0->VAR_6 <= 9 ? AV_PIX_FMT_BGR24 : AV_PIX_FMT_BGR48;", "else {", "if (VAR_0->component_id[0] == 'Q' && VAR_0->component_id[1] == 'F' && VAR_0->component_id[2] == 'A') {", "VAR_0->avctx->pix_fmt = VAR_0->VAR_6 <= 8 ? AV_PIX_FMT_GBRP : AV_PIX_FMT_GBRP16;", "} else {", "if (VAR_0->VAR_6 <= 8) VAR_0->avctx->pix_fmt = VAR_0->cs_itu601 ? AV_PIX_FMT_YUV444P : AV_PIX_FMT_YUVJ444P;", "else VAR_0->avctx->pix_fmt = AV_PIX_FMT_YUV444P16;", "VAR_0->avctx->color_range = VAR_0->cs_itu601 ? AVCOL_RANGE_MPEG : AVCOL_RANGE_JPEG;", "av_assert0(VAR_0->VAR_2 == 3);", "break;", "case 0x11111111:\nif (VAR_0->rgb)\nVAR_0->avctx->pix_fmt = VAR_0->VAR_6 <= 9 ? AV_PIX_FMT_ABGR : AV_PIX_FMT_RGBA64;", "else {", "if (VAR_0->adobe_transform == 0 && VAR_0->VAR_6 <= 8) {", "VAR_0->avctx->pix_fmt = AV_PIX_FMT_GBRAP;", "} else {", "VAR_0->avctx->pix_fmt = VAR_0->VAR_6 <= 8 ? AV_PIX_FMT_YUVA444P : AV_PIX_FMT_YUVA444P16;", "VAR_0->avctx->color_range = VAR_0->cs_itu601 ? AVCOL_RANGE_MPEG : AVCOL_RANGE_JPEG;", "av_assert0(VAR_0->VAR_2 == 4);", "break;", "case 0x22111122:\nif (VAR_0->adobe_transform == 0 && VAR_0->VAR_6 <= 8) {", "VAR_0->avctx->pix_fmt = AV_PIX_FMT_GBRAP;", "VAR_0->upscale_v = 6;", "VAR_0->upscale_h = 6;", "VAR_0->chroma_height = VAR_0->VAR_5;", "} else if (VAR_0->adobe_transform == 2 && VAR_0->VAR_6 <= 8) {", "VAR_0->avctx->pix_fmt = AV_PIX_FMT_YUVA444P;", "VAR_0->upscale_v = 6;", "VAR_0->upscale_h = 6;", "VAR_0->chroma_height = VAR_0->VAR_5;", "VAR_0->avctx->color_range = VAR_0->cs_itu601 ? AVCOL_RANGE_MPEG : AVCOL_RANGE_JPEG;", "} else {", "if (VAR_0->VAR_6 <= 8) VAR_0->avctx->pix_fmt = AV_PIX_FMT_YUVA420P;", "else VAR_0->avctx->pix_fmt = AV_PIX_FMT_YUVA420P16;", "VAR_0->avctx->color_range = VAR_0->cs_itu601 ? AVCOL_RANGE_MPEG : AVCOL_RANGE_JPEG;", "av_assert0(VAR_0->VAR_2 == 4);", "break;", "case 0x12121100:\ncase 0x22122100:\ncase 0x21211100:\ncase 0x22211200:\nif (VAR_0->VAR_6 <= 8) VAR_0->avctx->pix_fmt = VAR_0->cs_itu601 ? AV_PIX_FMT_YUV444P : AV_PIX_FMT_YUVJ444P;", "else\ngoto unk_pixfmt;", "VAR_0->avctx->color_range = VAR_0->cs_itu601 ? AVCOL_RANGE_MPEG : AVCOL_RANGE_JPEG;", "VAR_0->chroma_height = VAR_0->VAR_5;", "break;", "case 0x22221100:\ncase 0x22112200:\ncase 0x11222200:\nif (VAR_0->VAR_6 <= 8) VAR_0->avctx->pix_fmt = VAR_0->cs_itu601 ? AV_PIX_FMT_YUV444P : AV_PIX_FMT_YUVJ444P;", "else\ngoto unk_pixfmt;", "VAR_0->avctx->color_range = VAR_0->cs_itu601 ? AVCOL_RANGE_MPEG : AVCOL_RANGE_JPEG;", "VAR_0->chroma_height = (VAR_0->VAR_5 + 1) / 2;", "break;", "case 0x11000000:\ncase 0x13000000:\ncase 0x14000000:\ncase 0x31000000:\ncase 0x33000000:\ncase 0x34000000:\ncase 0x41000000:\ncase 0x43000000:\ncase 0x44000000:\nif(VAR_0->VAR_6 <= 8)\nVAR_0->avctx->pix_fmt = AV_PIX_FMT_GRAY8;", "else\nVAR_0->avctx->pix_fmt = AV_PIX_FMT_GRAY16;", "break;", "case 0x12111100:\ncase 0x14121200:\ncase 0x22211100:\ncase 0x22112100:\nif (VAR_0->VAR_6 <= 8) VAR_0->avctx->pix_fmt = VAR_0->cs_itu601 ? AV_PIX_FMT_YUV440P : AV_PIX_FMT_YUVJ440P;", "else\ngoto unk_pixfmt;", "VAR_0->avctx->color_range = VAR_0->cs_itu601 ? AVCOL_RANGE_MPEG : AVCOL_RANGE_JPEG;", "VAR_0->chroma_height = (VAR_0->VAR_5 + 1) / 2;", "break;", "case 0x21111100:\nif (VAR_0->VAR_6 <= 8) VAR_0->avctx->pix_fmt = VAR_0->cs_itu601 ? AV_PIX_FMT_YUV422P : AV_PIX_FMT_YUVJ422P;", "else VAR_0->avctx->pix_fmt = AV_PIX_FMT_YUV422P16;", "VAR_0->avctx->color_range = VAR_0->cs_itu601 ? AVCOL_RANGE_MPEG : AVCOL_RANGE_JPEG;", "break;", "case 0x22121100:\ncase 0x22111200:\nif (VAR_0->VAR_6 <= 8) VAR_0->avctx->pix_fmt = VAR_0->cs_itu601 ? AV_PIX_FMT_YUV422P : AV_PIX_FMT_YUVJ422P;", "else\ngoto unk_pixfmt;", "VAR_0->avctx->color_range = VAR_0->cs_itu601 ? AVCOL_RANGE_MPEG : AVCOL_RANGE_JPEG;", "break;", "case 0x22111100:\ncase 0x42111100:\nif (VAR_0->VAR_6 <= 8) VAR_0->avctx->pix_fmt = VAR_0->cs_itu601 ? AV_PIX_FMT_YUV420P : AV_PIX_FMT_YUVJ420P;", "else VAR_0->avctx->pix_fmt = AV_PIX_FMT_YUV420P16;", "VAR_0->avctx->color_range = VAR_0->cs_itu601 ? AVCOL_RANGE_MPEG : AVCOL_RANGE_JPEG;", "if (VAR_7 == 0x42111100) {", "VAR_0->upscale_h = 6;", "VAR_0->chroma_height = (VAR_0->VAR_5 + 1) / 2;", "break;", "case 0x41111100:\nif (VAR_0->VAR_6 <= 8) VAR_0->avctx->pix_fmt = VAR_0->cs_itu601 ? AV_PIX_FMT_YUV411P : AV_PIX_FMT_YUVJ411P;", "else\ngoto unk_pixfmt;", "VAR_0->avctx->color_range = VAR_0->cs_itu601 ? AVCOL_RANGE_MPEG : AVCOL_RANGE_JPEG;", "break;", "default:\nunk_pixfmt:\nav_log(VAR_0->avctx, AV_LOG_ERROR, \"Unhandled pixel format 0x%x\\n\", VAR_7);", "VAR_0->upscale_h = VAR_0->upscale_v = 0;", "return AVERROR_PATCHWELCOME;", "if ((VAR_0->upscale_h || VAR_0->upscale_v) && VAR_0->avctx->lowres) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"lowres not supported for weird subsampling\\n\");", "return AVERROR_PATCHWELCOME;", "if (VAR_0->ls) {", "VAR_0->upscale_h = VAR_0->upscale_v = 0;", "if (VAR_0->VAR_2 > 1)\nVAR_0->avctx->pix_fmt = AV_PIX_FMT_RGB24;", "else if (VAR_0->palette_index && VAR_0->VAR_6 <= 8)\nVAR_0->avctx->pix_fmt = AV_PIX_FMT_PAL8;", "else if (VAR_0->VAR_6 <= 8)\nVAR_0->avctx->pix_fmt = AV_PIX_FMT_GRAY8;", "else\nVAR_0->avctx->pix_fmt = AV_PIX_FMT_GRAY16;", "VAR_0->pix_desc = av_pix_fmt_desc_get(VAR_0->avctx->pix_fmt);", "if (!VAR_0->pix_desc) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"Could not get a pixel format descriptor.\\n\");", "return AVERROR_BUG;", "av_frame_unref(VAR_0->picture_ptr);", "if (ff_get_buffer(VAR_0->avctx, VAR_0->picture_ptr, AV_GET_BUFFER_FLAG_REF) < 0)\nreturn -1;", "VAR_0->picture_ptr->pict_type = AV_PICTURE_TYPE_I;", "VAR_0->picture_ptr->key_frame = 1;", "VAR_0->got_picture = 1;", "for (VAR_3 = 0; VAR_3 < 4; VAR_3++)", "VAR_0->linesize[VAR_3] = VAR_0->picture_ptr->linesize[VAR_3] << VAR_0->interlaced;", "av_dlog(VAR_0->avctx, \"%d %d %d %d %d %d\\n\",\nVAR_0->VAR_4, VAR_0->VAR_5, VAR_0->linesize[0], VAR_0->linesize[1],\nVAR_0->interlaced, VAR_0->avctx->VAR_5);", "if (VAR_1 != (8 + (3 * VAR_2)))\nav_log(VAR_0->avctx, AV_LOG_DEBUG, \"decode_sof0: error, VAR_1(%d) mismatch\\n\", VAR_1);", "if (VAR_0->rgb && !VAR_0->lossless && !VAR_0->ls) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"Unsupported coding and pixel format combination\\n\");", "return AVERROR_PATCHWELCOME;", "if (VAR_0->progressive) {", "int VAR_14 = (VAR_4 + VAR_0->h_max * 8 - 1) / (VAR_0->h_max * 8);", "int VAR_15 = (VAR_5 + VAR_0->v_max * 8 - 1) / (VAR_0->v_max * 8);", "for (VAR_3 = 0; VAR_3 < VAR_0->VAR_2; VAR_3++) {", "int size = VAR_14 * VAR_15 * VAR_0->VAR_9[VAR_3] * VAR_0->VAR_10[VAR_3];", "av_freep(&VAR_0->blocks[VAR_3]);", "av_freep(&VAR_0->last_nnz[VAR_3]);", "VAR_0->blocks[VAR_3] = av_mallocz_array(size, sizeof(**VAR_0->blocks));", "VAR_0->last_nnz[VAR_3] = av_mallocz_array(size, sizeof(**VAR_0->last_nnz));", "if (!VAR_0->blocks[VAR_3] || !VAR_0->last_nnz[VAR_3])\nreturn AVERROR(ENOMEM);", "VAR_0->block_stride[VAR_3] = VAR_14 * VAR_0->VAR_9[VAR_3];", "memset(VAR_0->coefs_finished, 0, sizeof(VAR_0->coefs_finished));", "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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 2 ], [ 3 ], [ 4 ], [ 5 ], [ 6 ], [ 7 ], [ 9 ], [ 10, 11 ], [ 12, 13 ], [ 14, 15 ], [ 16 ], [ 17 ], [ 18 ], [ 19 ], [ 20 ], [ 21, 22 ], [ 24, 25 ], [ 26 ], [ 27, 28 ], [ 29, 30, 31 ], [ 32 ], [ 33 ], [ 34, 35 ], [ 36 ], [ 37, 38, 39 ], [ 40 ], [ 41 ], [ 42 ], [ 43 ], [ 44 ], [ 45 ], [ 46 ], [ 48 ], [ 49 ], [ 50 ], [ 52, 53 ], [ 54, 55 ], [ 56 ], [ 57 ], [ 58 ], [ 59 ], [ 60, 61, 62 ], [ 63, 64, 65 ], [ 66 ], [ 67 ], [ 68 ], [ 70, 71, 72, 73 ], [ 74 ], [ 75 ], [ 76 ], [ 77 ], [ 78 ], [ 79 ], [ 80 ], [ 82, 83, 84 ], [ 85 ], [ 86 ], [ 87 ], [ 88 ], [ 89 ], [ 90 ], [ 91, 92 ], [ 93 ], [ 94 ], [ 95 ], [ 96 ], [ 97 ], [ 98, 99 ], [ 100, 101 ], [ 103, 104, 105, 106 ], [ 107 ], [ 110, 111 ], [ 112, 113 ], [ 114 ], [ 115 ], [ 116 ], [ 117 ], [ 118, 119 ], [ 120, 121 ], [ 122 ], [ 123 ], [ 124 ], [ 125 ], [ 126, 127, 128 ], [ 129 ], [ 130 ], [ 131 ], [ 132 ], [ 133 ], [ 134 ], [ 135 ], [ 136 ], [ 137 ], [ 138, 139, 140 ], [ 141 ], [ 142 ], [ 143 ], [ 144 ], [ 145 ], [ 146 ], [ 147 ], [ 148 ], [ 149, 150 ], [ 151 ], [ 152 ], [ 153 ], [ 154 ], [ 155 ], [ 156 ], [ 157 ], [ 158 ], [ 159 ], [ 160 ], [ 161 ], [ 162 ], [ 163 ], [ 164 ], [ 165 ], [ 166 ], [ 167, 168, 169, 170, 171 ], [ 172, 173 ], [ 174 ], [ 175 ], [ 176 ], [ 177, 178, 179, 180 ], [ 181, 182 ], [ 183 ], [ 184 ], [ 185 ], [ 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196 ], [ 197, 198 ], [ 199 ], [ 200, 201, 202, 203, 204 ], [ 205, 206 ], [ 207 ], [ 208 ], [ 209 ], [ 210, 211 ], [ 212 ], [ 213 ], [ 214 ], [ 215, 216, 217 ], [ 218, 219 ], [ 220 ], [ 221 ], [ 222, 223, 224 ], [ 225 ], [ 226 ], [ 227 ], [ 228 ], [ 229 ], [ 230 ], [ 231, 232 ], [ 233, 234 ], [ 235 ], [ 236 ], [ 237, 238, 239 ], [ 240 ], [ 241 ], [ 242 ], [ 243 ], [ 244 ], [ 245 ], [ 246 ], [ 247, 248 ], [ 249, 250 ], [ 251, 252 ], [ 253, 254 ], [ 255 ], [ 256 ], [ 257 ], [ 258 ], [ 259 ], [ 260, 261 ], [ 262 ], [ 263 ], [ 264 ], [ 265 ], [ 266 ], [ 267, 268, 269 ], [ 270, 271 ], [ 272 ], [ 273 ], [ 274 ], [ 276 ], [ 277 ], [ 278 ], [ 279 ], [ 280 ], [ 281 ], [ 282 ], [ 283 ], [ 284 ], [ 285, 286 ], [ 287 ], [ 288 ], [ 289 ] ]
14,765
static void ahci_shutdown(AHCIQState *ahci) { QOSState *qs = ahci->parent; free_ahci_device(ahci->dev); g_free(ahci); qtest_shutdown(qs); }
true
qemu
259342d34dbdfb304374f569feec26317edd97c9
static void ahci_shutdown(AHCIQState *ahci) { QOSState *qs = ahci->parent; free_ahci_device(ahci->dev); g_free(ahci); qtest_shutdown(qs); }
{ "code": [], "line_no": [] }
static void FUNC_0(AHCIQState *VAR_0) { QOSState *qs = VAR_0->parent; free_ahci_device(VAR_0->dev); g_free(VAR_0); qtest_shutdown(qs); }
[ "static void FUNC_0(AHCIQState *VAR_0)\n{", "QOSState *qs = VAR_0->parent;", "free_ahci_device(VAR_0->dev);", "g_free(VAR_0);", "qtest_shutdown(qs);", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 2 ], [ 3 ], [ 4 ], [ 5 ], [ 6 ], [ 7 ] ]
14,766
static int gif_parse_next_image(GifState *s) { ByteIOContext *f = s->f; int ret, code; for (;;) { code = url_fgetc(f); #ifdef DEBUG printf("gif: code=%02x '%c'\n", code, code); #endif switch (code) { case ',': if (gif_read_image(s) < 0) return AVERROR(EIO); ret = 0; goto the_end; case ';': /* end of image */ ret = AVERROR(EIO); goto the_end; case '!': if (gif_read_extension(s) < 0) return AVERROR(EIO); break; case EOF: default: /* error or errneous EOF */ ret = AVERROR(EIO); goto the_end; } } the_end: return ret; }
true
FFmpeg
0b54f3c0878a3acaa9142e4f24942e762d97e350
static int gif_parse_next_image(GifState *s) { ByteIOContext *f = s->f; int ret, code; for (;;) { code = url_fgetc(f); #ifdef DEBUG printf("gif: code=%02x '%c'\n", code, code); #endif switch (code) { case ',': if (gif_read_image(s) < 0) return AVERROR(EIO); ret = 0; goto the_end; case ';': ret = AVERROR(EIO); goto the_end; case '!': if (gif_read_extension(s) < 0) return AVERROR(EIO); break; case EOF: default: ret = AVERROR(EIO); goto the_end; } } the_end: return ret; }
{ "code": [ " break;", " goto the_end;", " for (;;) {", " break;", " the_end:", " ByteIOContext *f = s->f;", "#ifdef DEBUG", "#endif", " ByteIOContext *f = s->f;", "#ifdef DEBUG", "#endif", "#ifdef DEBUG", "#endif", "#ifdef DEBUG", "#endif", " ByteIOContext *f = s->f;", "#ifdef DEBUG", "#endif", "static int gif_parse_next_image(GifState *s)", " ByteIOContext *f = s->f;", " int ret, code;", " for (;;) {", " code = url_fgetc(f);", "#ifdef DEBUG", " printf(\"gif: code=%02x '%c'\\n\", code, code);", "#endif", " switch (code) {", " case ',':", " if (gif_read_image(s) < 0)", " return AVERROR(EIO);", " ret = 0;", " goto the_end;", " case ';':", " ret = AVERROR(EIO);", " goto the_end;", " case '!':", " if (gif_read_extension(s) < 0)", " return AVERROR(EIO);", " break;", " case EOF:", " default:", " ret = AVERROR(EIO);", " goto the_end;", " the_end:", " return ret;" ], "line_no": [ 47, 31, 11, 47, 63, 5, 15, 19, 5, 15, 19, 15, 19, 15, 19, 5, 15, 19, 1, 5, 7, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 37, 31, 41, 43, 27, 47, 49, 51, 37, 31, 63, 65 ] }
static int FUNC_0(GifState *VAR_0) { ByteIOContext *f = VAR_0->f; int VAR_1, VAR_2; for (;;) { VAR_2 = url_fgetc(f); #ifdef DEBUG printf("gif: VAR_2=%02x '%c'\n", VAR_2, VAR_2); #endif switch (VAR_2) { case ',': if (gif_read_image(VAR_0) < 0) return AVERROR(EIO); VAR_1 = 0; goto the_end; case ';': VAR_1 = AVERROR(EIO); goto the_end; case '!': if (gif_read_extension(VAR_0) < 0) return AVERROR(EIO); break; case EOF: default: VAR_1 = AVERROR(EIO); goto the_end; } } the_end: return VAR_1; }
[ "static int FUNC_0(GifState *VAR_0)\n{", "ByteIOContext *f = VAR_0->f;", "int VAR_1, VAR_2;", "for (;;) {", "VAR_2 = url_fgetc(f);", "#ifdef DEBUG\nprintf(\"gif: VAR_2=%02x '%c'\\n\", VAR_2, VAR_2);", "#endif\nswitch (VAR_2) {", "case ',':\nif (gif_read_image(VAR_0) < 0)\nreturn AVERROR(EIO);", "VAR_1 = 0;", "goto the_end;", "case ';':", "VAR_1 = AVERROR(EIO);", "goto the_end;", "case '!':\nif (gif_read_extension(VAR_0) < 0)\nreturn AVERROR(EIO);", "break;", "case EOF:\ndefault:\nVAR_1 = AVERROR(EIO);", "goto the_end;", "}", "}", "the_end:\nreturn VAR_1;", "}" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15, 17 ], [ 19, 21 ], [ 23, 25, 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41, 43, 45 ], [ 47 ], [ 49, 51, 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63, 65 ], [ 67 ] ]
14,767
void net_client_uninit(NICInfo *nd) { nd->vlan->nb_guest_devs--; nb_nics--; nd->used = 0; free((void *)nd->model); }
true
qemu
a9796703447fc5c5691b749915f0f627f47f05a9
void net_client_uninit(NICInfo *nd) { nd->vlan->nb_guest_devs--; nb_nics--; nd->used = 0; free((void *)nd->model); }
{ "code": [ " nd->used = 0;", " free((void *)nd->model);" ], "line_no": [ 9, 11 ] }
void FUNC_0(NICInfo *VAR_0) { VAR_0->vlan->nb_guest_devs--; nb_nics--; VAR_0->used = 0; free((void *)VAR_0->model); }
[ "void FUNC_0(NICInfo *VAR_0)\n{", "VAR_0->vlan->nb_guest_devs--;", "nb_nics--;", "VAR_0->used = 0;", "free((void *)VAR_0->model);", "}" ]
[ 0, 0, 0, 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ] ]
14,768
static int virtio_net_device_exit(DeviceState *qdev) { VirtIONet *n = VIRTIO_NET(qdev); VirtIODevice *vdev = VIRTIO_DEVICE(qdev); int i; /* This will stop vhost backend if appropriate. */ virtio_net_set_status(vdev, 0); unregister_savevm(qdev, "virtio-net", n); if (n->netclient_name) { g_free(n->netclient_name); n->netclient_name = NULL; } if (n->netclient_type) { g_free(n->netclient_type); n->netclient_type = NULL; } g_free(n->mac_table.macs); g_free(n->vlans); for (i = 0; i < n->max_queues; i++) { VirtIONetQueue *q = &n->vqs[i]; NetClientState *nc = qemu_get_subqueue(n->nic, i); qemu_purge_queued_packets(nc); if (q->tx_timer) { timer_del(q->tx_timer); timer_free(q->tx_timer); } else if (q->tx_bh) { qemu_bh_delete(q->tx_bh); } } g_free(n->vqs); qemu_del_nic(n->nic); virtio_cleanup(vdev); return 0; }
true
qemu
3786cff5eb384d058395a2729af627fa3253d056
static int virtio_net_device_exit(DeviceState *qdev) { VirtIONet *n = VIRTIO_NET(qdev); VirtIODevice *vdev = VIRTIO_DEVICE(qdev); int i; virtio_net_set_status(vdev, 0); unregister_savevm(qdev, "virtio-net", n); if (n->netclient_name) { g_free(n->netclient_name); n->netclient_name = NULL; } if (n->netclient_type) { g_free(n->netclient_type); n->netclient_type = NULL; } g_free(n->mac_table.macs); g_free(n->vlans); for (i = 0; i < n->max_queues; i++) { VirtIONetQueue *q = &n->vqs[i]; NetClientState *nc = qemu_get_subqueue(n->nic, i); qemu_purge_queued_packets(nc); if (q->tx_timer) { timer_del(q->tx_timer); timer_free(q->tx_timer); } else if (q->tx_bh) { qemu_bh_delete(q->tx_bh); } } g_free(n->vqs); qemu_del_nic(n->nic); virtio_cleanup(vdev); return 0; }
{ "code": [ "static int virtio_net_device_exit(DeviceState *qdev)", " VirtIONet *n = VIRTIO_NET(qdev);", " VirtIODevice *vdev = VIRTIO_DEVICE(qdev);", " unregister_savevm(qdev, \"virtio-net\", n);", " return 0;" ], "line_no": [ 1, 5, 7, 19, 83 ] }
static int FUNC_0(DeviceState *VAR_0) { VirtIONet *n = VIRTIO_NET(VAR_0); VirtIODevice *vdev = VIRTIO_DEVICE(VAR_0); int VAR_1; virtio_net_set_status(vdev, 0); unregister_savevm(VAR_0, "virtio-net", n); if (n->netclient_name) { g_free(n->netclient_name); n->netclient_name = NULL; } if (n->netclient_type) { g_free(n->netclient_type); n->netclient_type = NULL; } g_free(n->mac_table.macs); g_free(n->vlans); for (VAR_1 = 0; VAR_1 < n->max_queues; VAR_1++) { VirtIONetQueue *q = &n->vqs[VAR_1]; NetClientState *nc = qemu_get_subqueue(n->nic, VAR_1); qemu_purge_queued_packets(nc); if (q->tx_timer) { timer_del(q->tx_timer); timer_free(q->tx_timer); } else if (q->tx_bh) { qemu_bh_delete(q->tx_bh); } } g_free(n->vqs); qemu_del_nic(n->nic); virtio_cleanup(vdev); return 0; }
[ "static int FUNC_0(DeviceState *VAR_0)\n{", "VirtIONet *n = VIRTIO_NET(VAR_0);", "VirtIODevice *vdev = VIRTIO_DEVICE(VAR_0);", "int VAR_1;", "virtio_net_set_status(vdev, 0);", "unregister_savevm(VAR_0, \"virtio-net\", n);", "if (n->netclient_name) {", "g_free(n->netclient_name);", "n->netclient_name = NULL;", "}", "if (n->netclient_type) {", "g_free(n->netclient_type);", "n->netclient_type = NULL;", "}", "g_free(n->mac_table.macs);", "g_free(n->vlans);", "for (VAR_1 = 0; VAR_1 < n->max_queues; VAR_1++) {", "VirtIONetQueue *q = &n->vqs[VAR_1];", "NetClientState *nc = qemu_get_subqueue(n->nic, VAR_1);", "qemu_purge_queued_packets(nc);", "if (q->tx_timer) {", "timer_del(q->tx_timer);", "timer_free(q->tx_timer);", "} else if (q->tx_bh) {", "qemu_bh_delete(q->tx_bh);", "}", "}", "g_free(n->vqs);", "qemu_del_nic(n->nic);", "virtio_cleanup(vdev);", "return 0;", "}" ]
[ 1, 1, 1, 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, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 15 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ], [ 51 ], [ 55 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 75 ], [ 77 ], [ 79 ], [ 83 ], [ 85 ] ]
14,769
static void residue_encode(vorbis_enc_context *venc, vorbis_enc_residue *rc, PutBitContext *pb, float *coeffs, int samples, int real_ch) { int pass, i, j, p, k; int psize = rc->partition_size; int partitions = (rc->end - rc->begin) / psize; int channels = (rc->type == 2) ? 1 : real_ch; int classes[MAX_CHANNELS][NUM_RESIDUE_PARTITIONS]; int classwords = venc->codebooks[rc->classbook].ndimentions; assert(rc->type == 2); assert(real_ch == 2); for (p = 0; p < partitions; p++) { float max1 = 0., max2 = 0.; int s = rc->begin + p * psize; for (k = s; k < s + psize; k += 2) { max1 = FFMAX(max1, fabs(coeffs[ k / real_ch])); max2 = FFMAX(max2, fabs(coeffs[samples + k / real_ch])); } for (i = 0; i < rc->classifications - 1; i++) if (max1 < rc->maxes[i][0] && max2 < rc->maxes[i][1]) break; classes[0][p] = i; } for (pass = 0; pass < 8; pass++) { p = 0; while (p < partitions) { if (pass == 0) for (j = 0; j < channels; j++) { vorbis_enc_codebook * book = &venc->codebooks[rc->classbook]; int entry = 0; for (i = 0; i < classwords; i++) { entry *= rc->classifications; entry += classes[j][p + i]; } put_codeword(pb, book, entry); } for (i = 0; i < classwords && p < partitions; i++, p++) { for (j = 0; j < channels; j++) { int nbook = rc->books[classes[j][p]][pass]; vorbis_enc_codebook * book = &venc->codebooks[nbook]; float *buf = coeffs + samples*j + rc->begin + p*psize; if (nbook == -1) continue; assert(rc->type == 0 || rc->type == 2); assert(!(psize % book->ndimentions)); if (rc->type == 0) { for (k = 0; k < psize; k += book->ndimentions) { float *a = put_vector(book, pb, &buf[k]); int l; for (l = 0; l < book->ndimentions; l++) buf[k + l] -= a[l]; } } else { int s = rc->begin + p * psize, a1, b1; a1 = (s % real_ch) * samples; b1 = s / real_ch; s = real_ch * samples; for (k = 0; k < psize; k += book->ndimentions) { int dim, a2 = a1, b2 = b1; float vec[MAX_CODEBOOK_DIM], *pv = vec; for (dim = book->ndimentions; dim--; ) { *pv++ = coeffs[a2 + b2]; if ((a2 += samples) == s) { a2 = 0; b2++; } } pv = put_vector(book, pb, vec); for (dim = book->ndimentions; dim--; ) { coeffs[a1 + b1] -= *pv++; if ((a1 += samples) == s) { a1 = 0; b1++; } } } } } } } } }
true
FFmpeg
1ba08c94f5bb4d1c3c2d3651b5e01edb4ce172e2
static void residue_encode(vorbis_enc_context *venc, vorbis_enc_residue *rc, PutBitContext *pb, float *coeffs, int samples, int real_ch) { int pass, i, j, p, k; int psize = rc->partition_size; int partitions = (rc->end - rc->begin) / psize; int channels = (rc->type == 2) ? 1 : real_ch; int classes[MAX_CHANNELS][NUM_RESIDUE_PARTITIONS]; int classwords = venc->codebooks[rc->classbook].ndimentions; assert(rc->type == 2); assert(real_ch == 2); for (p = 0; p < partitions; p++) { float max1 = 0., max2 = 0.; int s = rc->begin + p * psize; for (k = s; k < s + psize; k += 2) { max1 = FFMAX(max1, fabs(coeffs[ k / real_ch])); max2 = FFMAX(max2, fabs(coeffs[samples + k / real_ch])); } for (i = 0; i < rc->classifications - 1; i++) if (max1 < rc->maxes[i][0] && max2 < rc->maxes[i][1]) break; classes[0][p] = i; } for (pass = 0; pass < 8; pass++) { p = 0; while (p < partitions) { if (pass == 0) for (j = 0; j < channels; j++) { vorbis_enc_codebook * book = &venc->codebooks[rc->classbook]; int entry = 0; for (i = 0; i < classwords; i++) { entry *= rc->classifications; entry += classes[j][p + i]; } put_codeword(pb, book, entry); } for (i = 0; i < classwords && p < partitions; i++, p++) { for (j = 0; j < channels; j++) { int nbook = rc->books[classes[j][p]][pass]; vorbis_enc_codebook * book = &venc->codebooks[nbook]; float *buf = coeffs + samples*j + rc->begin + p*psize; if (nbook == -1) continue; assert(rc->type == 0 || rc->type == 2); assert(!(psize % book->ndimentions)); if (rc->type == 0) { for (k = 0; k < psize; k += book->ndimentions) { float *a = put_vector(book, pb, &buf[k]); int l; for (l = 0; l < book->ndimentions; l++) buf[k + l] -= a[l]; } } else { int s = rc->begin + p * psize, a1, b1; a1 = (s % real_ch) * samples; b1 = s / real_ch; s = real_ch * samples; for (k = 0; k < psize; k += book->ndimentions) { int dim, a2 = a1, b2 = b1; float vec[MAX_CODEBOOK_DIM], *pv = vec; for (dim = book->ndimentions; dim--; ) { *pv++ = coeffs[a2 + b2]; if ((a2 += samples) == s) { a2 = 0; b2++; } } pv = put_vector(book, pb, vec); for (dim = book->ndimentions; dim--; ) { coeffs[a1 + b1] -= *pv++; if ((a1 += samples) == s) { a1 = 0; b1++; } } } } } } } } }
{ "code": [ "static void residue_encode(vorbis_enc_context *venc, vorbis_enc_residue *rc,", " PutBitContext *pb, float *coeffs, int samples,", " int real_ch)", " put_codeword(pb, book, entry);", " float *a = put_vector(book, pb, &buf[k]);" ], "line_no": [ 1, 3, 5, 77, 107 ] }
static void FUNC_0(vorbis_enc_context *VAR_0, vorbis_enc_residue *VAR_1, PutBitContext *VAR_2, float *VAR_3, int VAR_4, int VAR_5) { int VAR_6, VAR_7, VAR_8, VAR_9, VAR_10; int VAR_11 = VAR_1->partition_size; int VAR_12 = (VAR_1->end - VAR_1->begin) / VAR_11; int VAR_13 = (VAR_1->type == 2) ? 1 : VAR_5; int VAR_14[MAX_CHANNELS][NUM_RESIDUE_PARTITIONS]; int VAR_15 = VAR_0->codebooks[VAR_1->classbook].ndimentions; assert(VAR_1->type == 2); assert(VAR_5 == 2); for (VAR_9 = 0; VAR_9 < VAR_12; VAR_9++) { float VAR_16 = 0., VAR_17 = 0.; int VAR_24 = VAR_1->begin + VAR_9 * VAR_11; for (VAR_10 = VAR_24; VAR_10 < VAR_24 + VAR_11; VAR_10 += 2) { VAR_16 = FFMAX(VAR_16, fabs(VAR_3[ VAR_10 / VAR_5])); VAR_17 = FFMAX(VAR_17, fabs(VAR_3[VAR_4 + VAR_10 / VAR_5])); } for (VAR_7 = 0; VAR_7 < VAR_1->classifications - 1; VAR_7++) if (VAR_16 < VAR_1->maxes[VAR_7][0] && VAR_17 < VAR_1->maxes[VAR_7][1]) break; VAR_14[0][VAR_9] = VAR_7; } for (VAR_6 = 0; VAR_6 < 8; VAR_6++) { VAR_9 = 0; while (VAR_9 < VAR_12) { if (VAR_6 == 0) for (VAR_8 = 0; VAR_8 < VAR_13; VAR_8++) { vorbis_enc_codebook * book = &VAR_0->codebooks[VAR_1->classbook]; int VAR_19 = 0; for (VAR_7 = 0; VAR_7 < VAR_15; VAR_7++) { VAR_19 *= VAR_1->classifications; VAR_19 += VAR_14[VAR_8][VAR_9 + VAR_7]; } put_codeword(VAR_2, book, VAR_19); } for (VAR_7 = 0; VAR_7 < VAR_15 && VAR_9 < VAR_12; VAR_7++, VAR_9++) { for (VAR_8 = 0; VAR_8 < VAR_13; VAR_8++) { int VAR_20 = VAR_1->books[VAR_14[VAR_8][VAR_9]][VAR_6]; vorbis_enc_codebook * book = &VAR_0->codebooks[VAR_20]; float *VAR_21 = VAR_3 + VAR_4*VAR_8 + VAR_1->begin + VAR_9*VAR_11; if (VAR_20 == -1) continue; assert(VAR_1->type == 0 || VAR_1->type == 2); assert(!(VAR_11 % book->ndimentions)); if (VAR_1->type == 0) { for (VAR_10 = 0; VAR_10 < VAR_11; VAR_10 += book->ndimentions) { float *VAR_22 = put_vector(book, VAR_2, &VAR_21[VAR_10]); int VAR_23; for (VAR_23 = 0; VAR_23 < book->ndimentions; VAR_23++) VAR_21[VAR_10 + VAR_23] -= VAR_22[VAR_23]; } } else { int VAR_24 = VAR_1->begin + VAR_9 * VAR_11, VAR_24, VAR_25; VAR_24 = (VAR_24 % VAR_5) * VAR_4; VAR_25 = VAR_24 / VAR_5; VAR_24 = VAR_5 * VAR_4; for (VAR_10 = 0; VAR_10 < VAR_11; VAR_10 += book->ndimentions) { int VAR_26, VAR_27 = VAR_24, VAR_28 = VAR_25; float VAR_29[MAX_CODEBOOK_DIM], *pv = VAR_29; for (VAR_26 = book->ndimentions; VAR_26--; ) { *pv++ = VAR_3[VAR_27 + VAR_28]; if ((VAR_27 += VAR_4) == VAR_24) { VAR_27 = 0; VAR_28++; } } pv = put_vector(book, VAR_2, VAR_29); for (VAR_26 = book->ndimentions; VAR_26--; ) { VAR_3[VAR_24 + VAR_25] -= *pv++; if ((VAR_24 += VAR_4) == VAR_24) { VAR_24 = 0; VAR_25++; } } } } } } } } }
[ "static void FUNC_0(vorbis_enc_context *VAR_0, vorbis_enc_residue *VAR_1,\nPutBitContext *VAR_2, float *VAR_3, int VAR_4,\nint VAR_5)\n{", "int VAR_6, VAR_7, VAR_8, VAR_9, VAR_10;", "int VAR_11 = VAR_1->partition_size;", "int VAR_12 = (VAR_1->end - VAR_1->begin) / VAR_11;", "int VAR_13 = (VAR_1->type == 2) ? 1 : VAR_5;", "int VAR_14[MAX_CHANNELS][NUM_RESIDUE_PARTITIONS];", "int VAR_15 = VAR_0->codebooks[VAR_1->classbook].ndimentions;", "assert(VAR_1->type == 2);", "assert(VAR_5 == 2);", "for (VAR_9 = 0; VAR_9 < VAR_12; VAR_9++) {", "float VAR_16 = 0., VAR_17 = 0.;", "int VAR_24 = VAR_1->begin + VAR_9 * VAR_11;", "for (VAR_10 = VAR_24; VAR_10 < VAR_24 + VAR_11; VAR_10 += 2) {", "VAR_16 = FFMAX(VAR_16, fabs(VAR_3[ VAR_10 / VAR_5]));", "VAR_17 = FFMAX(VAR_17, fabs(VAR_3[VAR_4 + VAR_10 / VAR_5]));", "}", "for (VAR_7 = 0; VAR_7 < VAR_1->classifications - 1; VAR_7++)", "if (VAR_16 < VAR_1->maxes[VAR_7][0] && VAR_17 < VAR_1->maxes[VAR_7][1])\nbreak;", "VAR_14[0][VAR_9] = VAR_7;", "}", "for (VAR_6 = 0; VAR_6 < 8; VAR_6++) {", "VAR_9 = 0;", "while (VAR_9 < VAR_12) {", "if (VAR_6 == 0)\nfor (VAR_8 = 0; VAR_8 < VAR_13; VAR_8++) {", "vorbis_enc_codebook * book = &VAR_0->codebooks[VAR_1->classbook];", "int VAR_19 = 0;", "for (VAR_7 = 0; VAR_7 < VAR_15; VAR_7++) {", "VAR_19 *= VAR_1->classifications;", "VAR_19 += VAR_14[VAR_8][VAR_9 + VAR_7];", "}", "put_codeword(VAR_2, book, VAR_19);", "}", "for (VAR_7 = 0; VAR_7 < VAR_15 && VAR_9 < VAR_12; VAR_7++, VAR_9++) {", "for (VAR_8 = 0; VAR_8 < VAR_13; VAR_8++) {", "int VAR_20 = VAR_1->books[VAR_14[VAR_8][VAR_9]][VAR_6];", "vorbis_enc_codebook * book = &VAR_0->codebooks[VAR_20];", "float *VAR_21 = VAR_3 + VAR_4*VAR_8 + VAR_1->begin + VAR_9*VAR_11;", "if (VAR_20 == -1)\ncontinue;", "assert(VAR_1->type == 0 || VAR_1->type == 2);", "assert(!(VAR_11 % book->ndimentions));", "if (VAR_1->type == 0) {", "for (VAR_10 = 0; VAR_10 < VAR_11; VAR_10 += book->ndimentions) {", "float *VAR_22 = put_vector(book, VAR_2, &VAR_21[VAR_10]);", "int VAR_23;", "for (VAR_23 = 0; VAR_23 < book->ndimentions; VAR_23++)", "VAR_21[VAR_10 + VAR_23] -= VAR_22[VAR_23];", "}", "} else {", "int VAR_24 = VAR_1->begin + VAR_9 * VAR_11, VAR_24, VAR_25;", "VAR_24 = (VAR_24 % VAR_5) * VAR_4;", "VAR_25 = VAR_24 / VAR_5;", "VAR_24 = VAR_5 * VAR_4;", "for (VAR_10 = 0; VAR_10 < VAR_11; VAR_10 += book->ndimentions) {", "int VAR_26, VAR_27 = VAR_24, VAR_28 = VAR_25;", "float VAR_29[MAX_CODEBOOK_DIM], *pv = VAR_29;", "for (VAR_26 = book->ndimentions; VAR_26--; ) {", "*pv++ = VAR_3[VAR_27 + VAR_28];", "if ((VAR_27 += VAR_4) == VAR_24) {", "VAR_27 = 0;", "VAR_28++;", "}", "}", "pv = put_vector(book, VAR_2, VAR_29);", "for (VAR_26 = book->ndimentions; VAR_26--; ) {", "VAR_3[VAR_24 + VAR_25] -= *pv++;", "if ((VAR_24 += VAR_4) == VAR_24) {", "VAR_24 = 0;", "VAR_25++;", "}", "}", "}", "}", "}", "}", "}", "}", "}" ]
[ 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, 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 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45, 47 ], [ 49 ], [ 51 ], [ 55 ], [ 57 ], [ 59 ], [ 61, 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91, 93 ], [ 97 ], [ 99 ], [ 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 ] ]
14,771
static void rtc_class_initfn(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); dc->realize = rtc_realizefn; dc->no_user = 1; dc->vmsd = &vmstate_rtc; dc->props = mc146818rtc_properties; }
true
qemu
efec3dd631d94160288392721a5f9c39e50fb2bc
static void rtc_class_initfn(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); dc->realize = rtc_realizefn; dc->no_user = 1; dc->vmsd = &vmstate_rtc; dc->props = mc146818rtc_properties; }
{ "code": [ " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;" ], "line_no": [ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11 ] }
static void FUNC_0(ObjectClass *VAR_0, void *VAR_1) { DeviceClass *dc = DEVICE_CLASS(VAR_0); dc->realize = rtc_realizefn; dc->no_user = 1; dc->vmsd = &vmstate_rtc; dc->props = mc146818rtc_properties; }
[ "static void FUNC_0(ObjectClass *VAR_0, void *VAR_1)\n{", "DeviceClass *dc = DEVICE_CLASS(VAR_0);", "dc->realize = rtc_realizefn;", "dc->no_user = 1;", "dc->vmsd = &vmstate_rtc;", "dc->props = mc146818rtc_properties;", "}" ]
[ 0, 0, 0, 1, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ] ]
14,773
static int megasas_handle_dcmd(MegasasState *s, MegasasCmd *cmd) { int opcode, len; int retval = 0; const struct dcmd_cmd_tbl_t *cmdptr = dcmd_cmd_tbl; opcode = le32_to_cpu(cmd->frame->dcmd.opcode); trace_megasas_handle_dcmd(cmd->index, opcode); len = megasas_map_dcmd(s, cmd); if (len < 0) { return MFI_STAT_MEMORY_NOT_AVAILABLE; } while (cmdptr->opcode != -1 && cmdptr->opcode != opcode) { cmdptr++; } if (cmdptr->opcode == -1) { trace_megasas_dcmd_unhandled(cmd->index, opcode, len); retval = megasas_dcmd_dummy(s, cmd); } else { trace_megasas_dcmd_enter(cmd->index, cmdptr->desc, len); retval = cmdptr->func(s, cmd); } if (retval != MFI_STAT_INVALID_STATUS) { megasas_finish_dcmd(cmd, len); } return retval; }
true
qemu
765a707000e838c30b18d712fe6cb3dd8e0435f3
static int megasas_handle_dcmd(MegasasState *s, MegasasCmd *cmd) { int opcode, len; int retval = 0; const struct dcmd_cmd_tbl_t *cmdptr = dcmd_cmd_tbl; opcode = le32_to_cpu(cmd->frame->dcmd.opcode); trace_megasas_handle_dcmd(cmd->index, opcode); len = megasas_map_dcmd(s, cmd); if (len < 0) { return MFI_STAT_MEMORY_NOT_AVAILABLE; } while (cmdptr->opcode != -1 && cmdptr->opcode != opcode) { cmdptr++; } if (cmdptr->opcode == -1) { trace_megasas_dcmd_unhandled(cmd->index, opcode, len); retval = megasas_dcmd_dummy(s, cmd); } else { trace_megasas_dcmd_enter(cmd->index, cmdptr->desc, len); retval = cmdptr->func(s, cmd); } if (retval != MFI_STAT_INVALID_STATUS) { megasas_finish_dcmd(cmd, len); } return retval; }
{ "code": [ " int opcode, len;", " len = megasas_map_dcmd(s, cmd);", " if (len < 0) {" ], "line_no": [ 5, 17, 19 ] }
static int FUNC_0(MegasasState *VAR_0, MegasasCmd *VAR_1) { int VAR_2, VAR_3; int VAR_4 = 0; const struct dcmd_cmd_tbl_t *VAR_5 = dcmd_cmd_tbl; VAR_2 = le32_to_cpu(VAR_1->frame->dcmd.VAR_2); trace_megasas_handle_dcmd(VAR_1->index, VAR_2); VAR_3 = megasas_map_dcmd(VAR_0, VAR_1); if (VAR_3 < 0) { return MFI_STAT_MEMORY_NOT_AVAILABLE; } while (VAR_5->VAR_2 != -1 && VAR_5->VAR_2 != VAR_2) { VAR_5++; } if (VAR_5->VAR_2 == -1) { trace_megasas_dcmd_unhandled(VAR_1->index, VAR_2, VAR_3); VAR_4 = megasas_dcmd_dummy(VAR_0, VAR_1); } else { trace_megasas_dcmd_enter(VAR_1->index, VAR_5->desc, VAR_3); VAR_4 = VAR_5->func(VAR_0, VAR_1); } if (VAR_4 != MFI_STAT_INVALID_STATUS) { megasas_finish_dcmd(VAR_1, VAR_3); } return VAR_4; }
[ "static int FUNC_0(MegasasState *VAR_0, MegasasCmd *VAR_1)\n{", "int VAR_2, VAR_3;", "int VAR_4 = 0;", "const struct dcmd_cmd_tbl_t *VAR_5 = dcmd_cmd_tbl;", "VAR_2 = le32_to_cpu(VAR_1->frame->dcmd.VAR_2);", "trace_megasas_handle_dcmd(VAR_1->index, VAR_2);", "VAR_3 = megasas_map_dcmd(VAR_0, VAR_1);", "if (VAR_3 < 0) {", "return MFI_STAT_MEMORY_NOT_AVAILABLE;", "}", "while (VAR_5->VAR_2 != -1 && VAR_5->VAR_2 != VAR_2) {", "VAR_5++;", "}", "if (VAR_5->VAR_2 == -1) {", "trace_megasas_dcmd_unhandled(VAR_1->index, VAR_2, VAR_3);", "VAR_4 = megasas_dcmd_dummy(VAR_0, VAR_1);", "} else {", "trace_megasas_dcmd_enter(VAR_1->index, VAR_5->desc, VAR_3);", "VAR_4 = VAR_5->func(VAR_0, VAR_1);", "}", "if (VAR_4 != MFI_STAT_INVALID_STATUS) {", "megasas_finish_dcmd(VAR_1, VAR_3);", "}", "return VAR_4;", "}" ]
[ 0, 1, 0, 0, 0, 0, 1, 1, 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 ] ]
14,778
static int64_t alloc_clusters_imrt(BlockDriverState *bs, int cluster_count, uint16_t **refcount_table, int64_t *imrt_nb_clusters, int64_t *first_free_cluster) { BDRVQcowState *s = bs->opaque; int64_t cluster = *first_free_cluster, i; bool first_gap = true; int contiguous_free_clusters; int ret; /* Starting at *first_free_cluster, find a range of at least cluster_count * continuously free clusters */ for (contiguous_free_clusters = 0; cluster < *imrt_nb_clusters && contiguous_free_clusters < cluster_count; cluster++) { if (!(*refcount_table)[cluster]) { contiguous_free_clusters++; if (first_gap) { /* If this is the first free cluster found, update * *first_free_cluster accordingly */ *first_free_cluster = cluster; first_gap = false; } } else if (contiguous_free_clusters) { contiguous_free_clusters = 0; } } /* If contiguous_free_clusters is greater than zero, it contains the number * of continuously free clusters until the current cluster; the first free * cluster in the current "gap" is therefore * cluster - contiguous_free_clusters */ /* If no such range could be found, grow the in-memory refcount table * accordingly to append free clusters at the end of the image */ if (contiguous_free_clusters < cluster_count) { /* contiguous_free_clusters clusters are already empty at the image end; * we need cluster_count clusters; therefore, we have to allocate * cluster_count - contiguous_free_clusters new clusters at the end of * the image (which is the current value of cluster; note that cluster * may exceed old_imrt_nb_clusters if *first_free_cluster pointed beyond * the image end) */ ret = realloc_refcount_array(s, refcount_table, imrt_nb_clusters, cluster + cluster_count - contiguous_free_clusters); if (ret < 0) { return ret; } } /* Go back to the first free cluster */ cluster -= contiguous_free_clusters; for (i = 0; i < cluster_count; i++) { (*refcount_table)[cluster + i] = 1; } return cluster << s->cluster_bits; }
true
qemu
7453c96b78c2b09aa72924f933bb9616e5474194
static int64_t alloc_clusters_imrt(BlockDriverState *bs, int cluster_count, uint16_t **refcount_table, int64_t *imrt_nb_clusters, int64_t *first_free_cluster) { BDRVQcowState *s = bs->opaque; int64_t cluster = *first_free_cluster, i; bool first_gap = true; int contiguous_free_clusters; int ret; for (contiguous_free_clusters = 0; cluster < *imrt_nb_clusters && contiguous_free_clusters < cluster_count; cluster++) { if (!(*refcount_table)[cluster]) { contiguous_free_clusters++; if (first_gap) { *first_free_cluster = cluster; first_gap = false; } } else if (contiguous_free_clusters) { contiguous_free_clusters = 0; } } if (contiguous_free_clusters < cluster_count) { ret = realloc_refcount_array(s, refcount_table, imrt_nb_clusters, cluster + cluster_count - contiguous_free_clusters); if (ret < 0) { return ret; } } cluster -= contiguous_free_clusters; for (i = 0; i < cluster_count; i++) { (*refcount_table)[cluster + i] = 1; } return cluster << s->cluster_bits; }
{ "code": [ " uint16_t **refcount_table,", " if (!(*refcount_table)[cluster]) {", " (*refcount_table)[cluster + i] = 1;", " if (!(*refcount_table)[cluster]) {" ], "line_no": [ 5, 39, 115, 39 ] }
static int64_t FUNC_0(BlockDriverState *bs, int cluster_count, uint16_t **refcount_table, int64_t *imrt_nb_clusters, int64_t *first_free_cluster) { BDRVQcowState *s = bs->opaque; int64_t cluster = *first_free_cluster, i; bool first_gap = true; int VAR_0; int VAR_1; for (VAR_0 = 0; cluster < *imrt_nb_clusters && VAR_0 < cluster_count; cluster++) { if (!(*refcount_table)[cluster]) { VAR_0++; if (first_gap) { *first_free_cluster = cluster; first_gap = false; } } else if (VAR_0) { VAR_0 = 0; } } if (VAR_0 < cluster_count) { VAR_1 = realloc_refcount_array(s, refcount_table, imrt_nb_clusters, cluster + cluster_count - VAR_0); if (VAR_1 < 0) { return VAR_1; } } cluster -= VAR_0; for (i = 0; i < cluster_count; i++) { (*refcount_table)[cluster + i] = 1; } return cluster << s->cluster_bits; }
[ "static int64_t FUNC_0(BlockDriverState *bs,\nint cluster_count,\nuint16_t **refcount_table,\nint64_t *imrt_nb_clusters,\nint64_t *first_free_cluster)\n{", "BDRVQcowState *s = bs->opaque;", "int64_t cluster = *first_free_cluster, i;", "bool first_gap = true;", "int VAR_0;", "int VAR_1;", "for (VAR_0 = 0;", "cluster < *imrt_nb_clusters &&\nVAR_0 < cluster_count;", "cluster++)\n{", "if (!(*refcount_table)[cluster]) {", "VAR_0++;", "if (first_gap) {", "*first_free_cluster = cluster;", "first_gap = false;", "}", "} else if (VAR_0) {", "VAR_0 = 0;", "}", "}", "if (VAR_0 < cluster_count) {", "VAR_1 = realloc_refcount_array(s, refcount_table, imrt_nb_clusters,\ncluster + cluster_count\n- VAR_0);", "if (VAR_1 < 0) {", "return VAR_1;", "}", "}", "cluster -= VAR_0;", "for (i = 0; i < cluster_count; i++) {", "(*refcount_table)[cluster + i] = 1;", "}", "return cluster << s->cluster_bits;", "}" ]
[ 1, 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, 1, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9, 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 29 ], [ 31, 33 ], [ 35, 37 ], [ 39 ], [ 41 ], [ 43 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 79 ], [ 93, 95, 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 121 ], [ 123 ] ]
14,779
static uint64_t grlib_apbuart_read(void *opaque, target_phys_addr_t addr, unsigned size) { UART *uart = opaque; addr &= 0xff; /* Unit registers */ switch (addr) { case DATA_OFFSET: case DATA_OFFSET + 3: /* when only one byte read */ return uart_pop(uart); case STATUS_OFFSET: /* Read Only */ return uart->status; case CONTROL_OFFSET: return uart->control; case SCALER_OFFSET: /* Not supported */ return 0; default: trace_grlib_apbuart_readl_unknown(addr); return 0; } }
false
qemu
a8170e5e97ad17ca169c64ba87ae2f53850dab4c
static uint64_t grlib_apbuart_read(void *opaque, target_phys_addr_t addr, unsigned size) { UART *uart = opaque; addr &= 0xff; switch (addr) { case DATA_OFFSET: case DATA_OFFSET + 3: return uart_pop(uart); case STATUS_OFFSET: return uart->status; case CONTROL_OFFSET: return uart->control; case SCALER_OFFSET: return 0; default: trace_grlib_apbuart_readl_unknown(addr); return 0; } }
{ "code": [], "line_no": [] }
static uint64_t FUNC_0(void *opaque, target_phys_addr_t addr, unsigned size) { UART *uart = opaque; addr &= 0xff; switch (addr) { case DATA_OFFSET: case DATA_OFFSET + 3: return uart_pop(uart); case STATUS_OFFSET: return uart->status; case CONTROL_OFFSET: return uart->control; case SCALER_OFFSET: return 0; default: trace_grlib_apbuart_readl_unknown(addr); return 0; } }
[ "static uint64_t FUNC_0(void *opaque, target_phys_addr_t addr,\nunsigned size)\n{", "UART *uart = opaque;", "addr &= 0xff;", "switch (addr) {", "case DATA_OFFSET:\ncase DATA_OFFSET + 3:\nreturn uart_pop(uart);", "case STATUS_OFFSET:\nreturn uart->status;", "case CONTROL_OFFSET:\nreturn uart->control;", "case SCALER_OFFSET:\nreturn 0;", "default:\ntrace_grlib_apbuart_readl_unknown(addr);", "return 0;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 17 ], [ 19, 21, 23 ], [ 27, 31 ], [ 35, 37 ], [ 41, 45 ], [ 49, 51 ], [ 53 ], [ 55 ], [ 57 ] ]
14,780
av_cold void ff_rv34dsp_init(RV34DSPContext *c, DSPContext* dsp) { c->rv34_inv_transform = rv34_inv_transform_noround_c; c->rv34_inv_transform_dc = rv34_inv_transform_dc_noround_c; c->rv34_idct_add = rv34_idct_add_c; c->rv34_idct_dc_add = rv34_idct_dc_add_c; if (HAVE_NEON) ff_rv34dsp_init_neon(c, dsp); if (ARCH_X86) ff_rv34dsp_init_x86(c, dsp); }
false
FFmpeg
507dce2536fea4b78a9f4973f77e1fa20cfe1b81
av_cold void ff_rv34dsp_init(RV34DSPContext *c, DSPContext* dsp) { c->rv34_inv_transform = rv34_inv_transform_noround_c; c->rv34_inv_transform_dc = rv34_inv_transform_dc_noround_c; c->rv34_idct_add = rv34_idct_add_c; c->rv34_idct_dc_add = rv34_idct_dc_add_c; if (HAVE_NEON) ff_rv34dsp_init_neon(c, dsp); if (ARCH_X86) ff_rv34dsp_init_x86(c, dsp); }
{ "code": [], "line_no": [] }
av_cold void FUNC_0(RV34DSPContext *c, DSPContext* dsp) { c->rv34_inv_transform = rv34_inv_transform_noround_c; c->rv34_inv_transform_dc = rv34_inv_transform_dc_noround_c; c->rv34_idct_add = rv34_idct_add_c; c->rv34_idct_dc_add = rv34_idct_dc_add_c; if (HAVE_NEON) ff_rv34dsp_init_neon(c, dsp); if (ARCH_X86) ff_rv34dsp_init_x86(c, dsp); }
[ "av_cold void FUNC_0(RV34DSPContext *c, DSPContext* dsp) {", "c->rv34_inv_transform = rv34_inv_transform_noround_c;", "c->rv34_inv_transform_dc = rv34_inv_transform_dc_noround_c;", "c->rv34_idct_add = rv34_idct_add_c;", "c->rv34_idct_dc_add = rv34_idct_dc_add_c;", "if (HAVE_NEON)\nff_rv34dsp_init_neon(c, dsp);", "if (ARCH_X86)\nff_rv34dsp_init_x86(c, dsp);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1 ], [ 3 ], [ 5 ], [ 9 ], [ 11 ], [ 15, 17 ], [ 19, 21 ], [ 23 ] ]
14,782
static void memory_region_add_subregion_common(MemoryRegion *mr, hwaddr offset, MemoryRegion *subregion) { MemoryRegion *other; memory_region_transaction_begin(); assert(!subregion->parent); memory_region_ref(subregion); subregion->parent = mr; subregion->addr = offset; QTAILQ_FOREACH(other, &mr->subregions, subregions_link) { if (subregion->may_overlap || other->may_overlap) { continue; } if (int128_ge(int128_make64(offset), int128_add(int128_make64(other->addr), other->size)) || int128_le(int128_add(int128_make64(offset), subregion->size), int128_make64(other->addr))) { continue; } #if 0 printf("warning: subregion collision %llx/%llx (%s) " "vs %llx/%llx (%s)\n", (unsigned long long)offset, (unsigned long long)int128_get64(subregion->size), subregion->name, (unsigned long long)other->addr, (unsigned long long)int128_get64(other->size), other->name); #endif } QTAILQ_FOREACH(other, &mr->subregions, subregions_link) { if (subregion->priority >= other->priority) { QTAILQ_INSERT_BEFORE(other, subregion, subregions_link); goto done; } } QTAILQ_INSERT_TAIL(&mr->subregions, subregion, subregions_link); done: memory_region_update_pending |= mr->enabled && subregion->enabled; memory_region_transaction_commit(); }
false
qemu
0598701a4947ddbc19391e008cf753f8f22f3c25
static void memory_region_add_subregion_common(MemoryRegion *mr, hwaddr offset, MemoryRegion *subregion) { MemoryRegion *other; memory_region_transaction_begin(); assert(!subregion->parent); memory_region_ref(subregion); subregion->parent = mr; subregion->addr = offset; QTAILQ_FOREACH(other, &mr->subregions, subregions_link) { if (subregion->may_overlap || other->may_overlap) { continue; } if (int128_ge(int128_make64(offset), int128_add(int128_make64(other->addr), other->size)) || int128_le(int128_add(int128_make64(offset), subregion->size), int128_make64(other->addr))) { continue; } #if 0 printf("warning: subregion collision %llx/%llx (%s) " "vs %llx/%llx (%s)\n", (unsigned long long)offset, (unsigned long long)int128_get64(subregion->size), subregion->name, (unsigned long long)other->addr, (unsigned long long)int128_get64(other->size), other->name); #endif } QTAILQ_FOREACH(other, &mr->subregions, subregions_link) { if (subregion->priority >= other->priority) { QTAILQ_INSERT_BEFORE(other, subregion, subregions_link); goto done; } } QTAILQ_INSERT_TAIL(&mr->subregions, subregion, subregions_link); done: memory_region_update_pending |= mr->enabled && subregion->enabled; memory_region_transaction_commit(); }
{ "code": [], "line_no": [] }
static void FUNC_0(MemoryRegion *VAR_0, hwaddr VAR_1, MemoryRegion *VAR_2) { MemoryRegion *other; memory_region_transaction_begin(); assert(!VAR_2->parent); memory_region_ref(VAR_2); VAR_2->parent = VAR_0; VAR_2->addr = VAR_1; QTAILQ_FOREACH(other, &VAR_0->subregions, subregions_link) { if (VAR_2->may_overlap || other->may_overlap) { continue; } if (int128_ge(int128_make64(VAR_1), int128_add(int128_make64(other->addr), other->size)) || int128_le(int128_add(int128_make64(VAR_1), VAR_2->size), int128_make64(other->addr))) { continue; } #if 0 printf("warning: VAR_2 collision %llx/%llx (%s) " "vs %llx/%llx (%s)\n", (unsigned long long)VAR_1, (unsigned long long)int128_get64(VAR_2->size), VAR_2->name, (unsigned long long)other->addr, (unsigned long long)int128_get64(other->size), other->name); #endif } QTAILQ_FOREACH(other, &VAR_0->subregions, subregions_link) { if (VAR_2->priority >= other->priority) { QTAILQ_INSERT_BEFORE(other, VAR_2, subregions_link); goto done; } } QTAILQ_INSERT_TAIL(&VAR_0->subregions, VAR_2, subregions_link); done: memory_region_update_pending |= VAR_0->enabled && VAR_2->enabled; memory_region_transaction_commit(); }
[ "static void FUNC_0(MemoryRegion *VAR_0,\nhwaddr VAR_1,\nMemoryRegion *VAR_2)\n{", "MemoryRegion *other;", "memory_region_transaction_begin();", "assert(!VAR_2->parent);", "memory_region_ref(VAR_2);", "VAR_2->parent = VAR_0;", "VAR_2->addr = VAR_1;", "QTAILQ_FOREACH(other, &VAR_0->subregions, subregions_link) {", "if (VAR_2->may_overlap || other->may_overlap) {", "continue;", "}", "if (int128_ge(int128_make64(VAR_1),\nint128_add(int128_make64(other->addr), other->size))\n|| int128_le(int128_add(int128_make64(VAR_1), VAR_2->size),\nint128_make64(other->addr))) {", "continue;", "}", "#if 0\nprintf(\"warning: VAR_2 collision %llx/%llx (%s) \"\n\"vs %llx/%llx (%s)\\n\",\n(unsigned long long)VAR_1,\n(unsigned long long)int128_get64(VAR_2->size),\nVAR_2->name,\n(unsigned long long)other->addr,\n(unsigned long long)int128_get64(other->size),\nother->name);", "#endif\n}", "QTAILQ_FOREACH(other, &VAR_0->subregions, subregions_link) {", "if (VAR_2->priority >= other->priority) {", "QTAILQ_INSERT_BEFORE(other, VAR_2, subregions_link);", "goto done;", "}", "}", "QTAILQ_INSERT_TAIL(&VAR_0->subregions, VAR_2, subregions_link);", "done:\nmemory_region_update_pending |= VAR_0->enabled && VAR_2->enabled;", "memory_region_transaction_commit();", "}" ]
[ 0, 0, 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 ], [ 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 ] ]
14,783
qcrypto_block_luks_open(QCryptoBlock *block, QCryptoBlockOpenOptions *options, QCryptoBlockReadFunc readfunc, void *opaque, unsigned int flags, Error **errp) { QCryptoBlockLUKS *luks; Error *local_err = NULL; int ret = 0; size_t i; ssize_t rv; uint8_t *masterkey = NULL; size_t masterkeylen; char *ivgen_name, *ivhash_name; QCryptoCipherMode ciphermode; QCryptoCipherAlgorithm cipheralg; QCryptoIVGenAlgorithm ivalg; QCryptoCipherAlgorithm ivcipheralg; QCryptoHashAlgorithm hash; QCryptoHashAlgorithm ivhash; char *password = NULL; if (!(flags & QCRYPTO_BLOCK_OPEN_NO_IO)) { if (!options->u.luks.key_secret) { error_setg(errp, "Parameter 'key-secret' is required for cipher"); return -1; } password = qcrypto_secret_lookup_as_utf8( options->u.luks.key_secret, errp); if (!password) { return -1; } } luks = g_new0(QCryptoBlockLUKS, 1); block->opaque = luks; /* Read the entire LUKS header, minus the key material from * the underlying device */ rv = readfunc(block, opaque, 0, (uint8_t *)&luks->header, sizeof(luks->header), errp); if (rv < 0) { ret = rv; goto fail; } /* The header is always stored in big-endian format, so * convert everything to native */ be16_to_cpus(&luks->header.version); be32_to_cpus(&luks->header.payload_offset); be32_to_cpus(&luks->header.key_bytes); be32_to_cpus(&luks->header.master_key_iterations); for (i = 0; i < QCRYPTO_BLOCK_LUKS_NUM_KEY_SLOTS; i++) { be32_to_cpus(&luks->header.key_slots[i].active); be32_to_cpus(&luks->header.key_slots[i].iterations); be32_to_cpus(&luks->header.key_slots[i].key_offset); be32_to_cpus(&luks->header.key_slots[i].stripes); } if (memcmp(luks->header.magic, qcrypto_block_luks_magic, QCRYPTO_BLOCK_LUKS_MAGIC_LEN) != 0) { error_setg(errp, "Volume is not in LUKS format"); ret = -EINVAL; goto fail; } if (luks->header.version != QCRYPTO_BLOCK_LUKS_VERSION) { error_setg(errp, "LUKS version %" PRIu32 " is not supported", luks->header.version); ret = -ENOTSUP; goto fail; } /* * The cipher_mode header contains a string that we have * to further parse, of the format * * <cipher-mode>-<iv-generator>[:<iv-hash>] * * eg cbc-essiv:sha256, cbc-plain64 */ ivgen_name = strchr(luks->header.cipher_mode, '-'); if (!ivgen_name) { ret = -EINVAL; error_setg(errp, "Unexpected cipher mode string format %s", luks->header.cipher_mode); goto fail; } *ivgen_name = '\0'; ivgen_name++; ivhash_name = strchr(ivgen_name, ':'); if (!ivhash_name) { ivhash = 0; } else { *ivhash_name = '\0'; ivhash_name++; ivhash = qcrypto_block_luks_hash_name_lookup(ivhash_name, &local_err); if (local_err) { ret = -ENOTSUP; error_propagate(errp, local_err); goto fail; } } ciphermode = qcrypto_block_luks_cipher_mode_lookup(luks->header.cipher_mode, &local_err); if (local_err) { ret = -ENOTSUP; error_propagate(errp, local_err); goto fail; } cipheralg = qcrypto_block_luks_cipher_name_lookup(luks->header.cipher_name, ciphermode, luks->header.key_bytes, &local_err); if (local_err) { ret = -ENOTSUP; error_propagate(errp, local_err); goto fail; } hash = qcrypto_block_luks_hash_name_lookup(luks->header.hash_spec, &local_err); if (local_err) { ret = -ENOTSUP; error_propagate(errp, local_err); goto fail; } ivalg = qcrypto_block_luks_ivgen_name_lookup(ivgen_name, &local_err); if (local_err) { ret = -ENOTSUP; error_propagate(errp, local_err); goto fail; } if (ivalg == QCRYPTO_IVGEN_ALG_ESSIV) { if (!ivhash_name) { ret = -EINVAL; error_setg(errp, "Missing IV generator hash specification"); goto fail; } ivcipheralg = qcrypto_block_luks_essiv_cipher(cipheralg, ivhash, &local_err); if (local_err) { ret = -ENOTSUP; error_propagate(errp, local_err); goto fail; } } else { /* Note we parsed the ivhash_name earlier in the cipher_mode * spec string even with plain/plain64 ivgens, but we * will ignore it, since it is irrelevant for these ivgens. * This is for compat with dm-crypt which will silently * ignore hash names with these ivgens rather than report * an error about the invalid usage */ ivcipheralg = cipheralg; } if (!(flags & QCRYPTO_BLOCK_OPEN_NO_IO)) { /* Try to find which key slot our password is valid for * and unlock the master key from that slot. */ if (qcrypto_block_luks_find_key(block, password, cipheralg, ciphermode, hash, ivalg, ivcipheralg, ivhash, &masterkey, &masterkeylen, readfunc, opaque, errp) < 0) { ret = -EACCES; goto fail; } /* We have a valid master key now, so can setup the * block device payload decryption objects */ block->kdfhash = hash; block->niv = qcrypto_cipher_get_iv_len(cipheralg, ciphermode); block->ivgen = qcrypto_ivgen_new(ivalg, ivcipheralg, ivhash, masterkey, masterkeylen, errp); if (!block->ivgen) { ret = -ENOTSUP; goto fail; } block->cipher = qcrypto_cipher_new(cipheralg, ciphermode, masterkey, masterkeylen, errp); if (!block->cipher) { ret = -ENOTSUP; goto fail; } } block->payload_offset = luks->header.payload_offset * QCRYPTO_BLOCK_LUKS_SECTOR_SIZE; luks->cipher_alg = cipheralg; luks->cipher_mode = ciphermode; luks->ivgen_alg = ivalg; luks->ivgen_hash_alg = ivhash; luks->hash_alg = hash; g_free(masterkey); g_free(password); return 0; fail: g_free(masterkey); qcrypto_cipher_free(block->cipher); qcrypto_ivgen_free(block->ivgen); g_free(luks); g_free(password); return ret; }
false
qemu
e4a3507e86a1ef1453d603031bca27d5ac4cff3c
qcrypto_block_luks_open(QCryptoBlock *block, QCryptoBlockOpenOptions *options, QCryptoBlockReadFunc readfunc, void *opaque, unsigned int flags, Error **errp) { QCryptoBlockLUKS *luks; Error *local_err = NULL; int ret = 0; size_t i; ssize_t rv; uint8_t *masterkey = NULL; size_t masterkeylen; char *ivgen_name, *ivhash_name; QCryptoCipherMode ciphermode; QCryptoCipherAlgorithm cipheralg; QCryptoIVGenAlgorithm ivalg; QCryptoCipherAlgorithm ivcipheralg; QCryptoHashAlgorithm hash; QCryptoHashAlgorithm ivhash; char *password = NULL; if (!(flags & QCRYPTO_BLOCK_OPEN_NO_IO)) { if (!options->u.luks.key_secret) { error_setg(errp, "Parameter 'key-secret' is required for cipher"); return -1; } password = qcrypto_secret_lookup_as_utf8( options->u.luks.key_secret, errp); if (!password) { return -1; } } luks = g_new0(QCryptoBlockLUKS, 1); block->opaque = luks; rv = readfunc(block, opaque, 0, (uint8_t *)&luks->header, sizeof(luks->header), errp); if (rv < 0) { ret = rv; goto fail; } be16_to_cpus(&luks->header.version); be32_to_cpus(&luks->header.payload_offset); be32_to_cpus(&luks->header.key_bytes); be32_to_cpus(&luks->header.master_key_iterations); for (i = 0; i < QCRYPTO_BLOCK_LUKS_NUM_KEY_SLOTS; i++) { be32_to_cpus(&luks->header.key_slots[i].active); be32_to_cpus(&luks->header.key_slots[i].iterations); be32_to_cpus(&luks->header.key_slots[i].key_offset); be32_to_cpus(&luks->header.key_slots[i].stripes); } if (memcmp(luks->header.magic, qcrypto_block_luks_magic, QCRYPTO_BLOCK_LUKS_MAGIC_LEN) != 0) { error_setg(errp, "Volume is not in LUKS format"); ret = -EINVAL; goto fail; } if (luks->header.version != QCRYPTO_BLOCK_LUKS_VERSION) { error_setg(errp, "LUKS version %" PRIu32 " is not supported", luks->header.version); ret = -ENOTSUP; goto fail; } ivgen_name = strchr(luks->header.cipher_mode, '-'); if (!ivgen_name) { ret = -EINVAL; error_setg(errp, "Unexpected cipher mode string format %s", luks->header.cipher_mode); goto fail; } *ivgen_name = '\0'; ivgen_name++; ivhash_name = strchr(ivgen_name, ':'); if (!ivhash_name) { ivhash = 0; } else { *ivhash_name = '\0'; ivhash_name++; ivhash = qcrypto_block_luks_hash_name_lookup(ivhash_name, &local_err); if (local_err) { ret = -ENOTSUP; error_propagate(errp, local_err); goto fail; } } ciphermode = qcrypto_block_luks_cipher_mode_lookup(luks->header.cipher_mode, &local_err); if (local_err) { ret = -ENOTSUP; error_propagate(errp, local_err); goto fail; } cipheralg = qcrypto_block_luks_cipher_name_lookup(luks->header.cipher_name, ciphermode, luks->header.key_bytes, &local_err); if (local_err) { ret = -ENOTSUP; error_propagate(errp, local_err); goto fail; } hash = qcrypto_block_luks_hash_name_lookup(luks->header.hash_spec, &local_err); if (local_err) { ret = -ENOTSUP; error_propagate(errp, local_err); goto fail; } ivalg = qcrypto_block_luks_ivgen_name_lookup(ivgen_name, &local_err); if (local_err) { ret = -ENOTSUP; error_propagate(errp, local_err); goto fail; } if (ivalg == QCRYPTO_IVGEN_ALG_ESSIV) { if (!ivhash_name) { ret = -EINVAL; error_setg(errp, "Missing IV generator hash specification"); goto fail; } ivcipheralg = qcrypto_block_luks_essiv_cipher(cipheralg, ivhash, &local_err); if (local_err) { ret = -ENOTSUP; error_propagate(errp, local_err); goto fail; } } else { ivcipheralg = cipheralg; } if (!(flags & QCRYPTO_BLOCK_OPEN_NO_IO)) { if (qcrypto_block_luks_find_key(block, password, cipheralg, ciphermode, hash, ivalg, ivcipheralg, ivhash, &masterkey, &masterkeylen, readfunc, opaque, errp) < 0) { ret = -EACCES; goto fail; } block->kdfhash = hash; block->niv = qcrypto_cipher_get_iv_len(cipheralg, ciphermode); block->ivgen = qcrypto_ivgen_new(ivalg, ivcipheralg, ivhash, masterkey, masterkeylen, errp); if (!block->ivgen) { ret = -ENOTSUP; goto fail; } block->cipher = qcrypto_cipher_new(cipheralg, ciphermode, masterkey, masterkeylen, errp); if (!block->cipher) { ret = -ENOTSUP; goto fail; } } block->payload_offset = luks->header.payload_offset * QCRYPTO_BLOCK_LUKS_SECTOR_SIZE; luks->cipher_alg = cipheralg; luks->cipher_mode = ciphermode; luks->ivgen_alg = ivalg; luks->ivgen_hash_alg = ivhash; luks->hash_alg = hash; g_free(masterkey); g_free(password); return 0; fail: g_free(masterkey); qcrypto_cipher_free(block->cipher); qcrypto_ivgen_free(block->ivgen); g_free(luks); g_free(password); return ret; }
{ "code": [], "line_no": [] }
FUNC_0(QCryptoBlock *VAR_0, QCryptoBlockOpenOptions *VAR_1, QCryptoBlockReadFunc VAR_2, void *VAR_3, unsigned int VAR_4, Error **VAR_5) { QCryptoBlockLUKS *luks; Error *local_err = NULL; int VAR_6 = 0; size_t i; ssize_t rv; uint8_t *masterkey = NULL; size_t masterkeylen; char *VAR_7, *VAR_8; QCryptoCipherMode ciphermode; QCryptoCipherAlgorithm cipheralg; QCryptoIVGenAlgorithm ivalg; QCryptoCipherAlgorithm ivcipheralg; QCryptoHashAlgorithm hash; QCryptoHashAlgorithm ivhash; char *VAR_9 = NULL; if (!(VAR_4 & QCRYPTO_BLOCK_OPEN_NO_IO)) { if (!VAR_1->u.luks.key_secret) { error_setg(VAR_5, "Parameter 'key-secret' is required for cipher"); return -1; } VAR_9 = qcrypto_secret_lookup_as_utf8( VAR_1->u.luks.key_secret, VAR_5); if (!VAR_9) { return -1; } } luks = g_new0(QCryptoBlockLUKS, 1); VAR_0->VAR_3 = luks; rv = VAR_2(VAR_0, VAR_3, 0, (uint8_t *)&luks->header, sizeof(luks->header), VAR_5); if (rv < 0) { VAR_6 = rv; goto fail; } be16_to_cpus(&luks->header.version); be32_to_cpus(&luks->header.payload_offset); be32_to_cpus(&luks->header.key_bytes); be32_to_cpus(&luks->header.master_key_iterations); for (i = 0; i < QCRYPTO_BLOCK_LUKS_NUM_KEY_SLOTS; i++) { be32_to_cpus(&luks->header.key_slots[i].active); be32_to_cpus(&luks->header.key_slots[i].iterations); be32_to_cpus(&luks->header.key_slots[i].key_offset); be32_to_cpus(&luks->header.key_slots[i].stripes); } if (memcmp(luks->header.magic, qcrypto_block_luks_magic, QCRYPTO_BLOCK_LUKS_MAGIC_LEN) != 0) { error_setg(VAR_5, "Volume is not in LUKS format"); VAR_6 = -EINVAL; goto fail; } if (luks->header.version != QCRYPTO_BLOCK_LUKS_VERSION) { error_setg(VAR_5, "LUKS version %" PRIu32 " is not supported", luks->header.version); VAR_6 = -ENOTSUP; goto fail; } VAR_7 = strchr(luks->header.cipher_mode, '-'); if (!VAR_7) { VAR_6 = -EINVAL; error_setg(VAR_5, "Unexpected cipher mode string format %s", luks->header.cipher_mode); goto fail; } *VAR_7 = '\0'; VAR_7++; VAR_8 = strchr(VAR_7, ':'); if (!VAR_8) { ivhash = 0; } else { *VAR_8 = '\0'; VAR_8++; ivhash = qcrypto_block_luks_hash_name_lookup(VAR_8, &local_err); if (local_err) { VAR_6 = -ENOTSUP; error_propagate(VAR_5, local_err); goto fail; } } ciphermode = qcrypto_block_luks_cipher_mode_lookup(luks->header.cipher_mode, &local_err); if (local_err) { VAR_6 = -ENOTSUP; error_propagate(VAR_5, local_err); goto fail; } cipheralg = qcrypto_block_luks_cipher_name_lookup(luks->header.cipher_name, ciphermode, luks->header.key_bytes, &local_err); if (local_err) { VAR_6 = -ENOTSUP; error_propagate(VAR_5, local_err); goto fail; } hash = qcrypto_block_luks_hash_name_lookup(luks->header.hash_spec, &local_err); if (local_err) { VAR_6 = -ENOTSUP; error_propagate(VAR_5, local_err); goto fail; } ivalg = qcrypto_block_luks_ivgen_name_lookup(VAR_7, &local_err); if (local_err) { VAR_6 = -ENOTSUP; error_propagate(VAR_5, local_err); goto fail; } if (ivalg == QCRYPTO_IVGEN_ALG_ESSIV) { if (!VAR_8) { VAR_6 = -EINVAL; error_setg(VAR_5, "Missing IV generator hash specification"); goto fail; } ivcipheralg = qcrypto_block_luks_essiv_cipher(cipheralg, ivhash, &local_err); if (local_err) { VAR_6 = -ENOTSUP; error_propagate(VAR_5, local_err); goto fail; } } else { ivcipheralg = cipheralg; } if (!(VAR_4 & QCRYPTO_BLOCK_OPEN_NO_IO)) { if (qcrypto_block_luks_find_key(VAR_0, VAR_9, cipheralg, ciphermode, hash, ivalg, ivcipheralg, ivhash, &masterkey, &masterkeylen, VAR_2, VAR_3, VAR_5) < 0) { VAR_6 = -EACCES; goto fail; } VAR_0->kdfhash = hash; VAR_0->niv = qcrypto_cipher_get_iv_len(cipheralg, ciphermode); VAR_0->ivgen = qcrypto_ivgen_new(ivalg, ivcipheralg, ivhash, masterkey, masterkeylen, VAR_5); if (!VAR_0->ivgen) { VAR_6 = -ENOTSUP; goto fail; } VAR_0->cipher = qcrypto_cipher_new(cipheralg, ciphermode, masterkey, masterkeylen, VAR_5); if (!VAR_0->cipher) { VAR_6 = -ENOTSUP; goto fail; } } VAR_0->payload_offset = luks->header.payload_offset * QCRYPTO_BLOCK_LUKS_SECTOR_SIZE; luks->cipher_alg = cipheralg; luks->cipher_mode = ciphermode; luks->ivgen_alg = ivalg; luks->ivgen_hash_alg = ivhash; luks->hash_alg = hash; g_free(masterkey); g_free(VAR_9); return 0; fail: g_free(masterkey); qcrypto_cipher_free(VAR_0->cipher); qcrypto_ivgen_free(VAR_0->ivgen); g_free(luks); g_free(VAR_9); return VAR_6; }
[ "FUNC_0(QCryptoBlock *VAR_0,\nQCryptoBlockOpenOptions *VAR_1,\nQCryptoBlockReadFunc VAR_2,\nvoid *VAR_3,\nunsigned int VAR_4,\nError **VAR_5)\n{", "QCryptoBlockLUKS *luks;", "Error *local_err = NULL;", "int VAR_6 = 0;", "size_t i;", "ssize_t rv;", "uint8_t *masterkey = NULL;", "size_t masterkeylen;", "char *VAR_7, *VAR_8;", "QCryptoCipherMode ciphermode;", "QCryptoCipherAlgorithm cipheralg;", "QCryptoIVGenAlgorithm ivalg;", "QCryptoCipherAlgorithm ivcipheralg;", "QCryptoHashAlgorithm hash;", "QCryptoHashAlgorithm ivhash;", "char *VAR_9 = NULL;", "if (!(VAR_4 & QCRYPTO_BLOCK_OPEN_NO_IO)) {", "if (!VAR_1->u.luks.key_secret) {", "error_setg(VAR_5, \"Parameter 'key-secret' is required for cipher\");", "return -1;", "}", "VAR_9 = qcrypto_secret_lookup_as_utf8(\nVAR_1->u.luks.key_secret, VAR_5);", "if (!VAR_9) {", "return -1;", "}", "}", "luks = g_new0(QCryptoBlockLUKS, 1);", "VAR_0->VAR_3 = luks;", "rv = VAR_2(VAR_0, VAR_3, 0,\n(uint8_t *)&luks->header,\nsizeof(luks->header),\nVAR_5);", "if (rv < 0) {", "VAR_6 = rv;", "goto fail;", "}", "be16_to_cpus(&luks->header.version);", "be32_to_cpus(&luks->header.payload_offset);", "be32_to_cpus(&luks->header.key_bytes);", "be32_to_cpus(&luks->header.master_key_iterations);", "for (i = 0; i < QCRYPTO_BLOCK_LUKS_NUM_KEY_SLOTS; i++) {", "be32_to_cpus(&luks->header.key_slots[i].active);", "be32_to_cpus(&luks->header.key_slots[i].iterations);", "be32_to_cpus(&luks->header.key_slots[i].key_offset);", "be32_to_cpus(&luks->header.key_slots[i].stripes);", "}", "if (memcmp(luks->header.magic, qcrypto_block_luks_magic,\nQCRYPTO_BLOCK_LUKS_MAGIC_LEN) != 0) {", "error_setg(VAR_5, \"Volume is not in LUKS format\");", "VAR_6 = -EINVAL;", "goto fail;", "}", "if (luks->header.version != QCRYPTO_BLOCK_LUKS_VERSION) {", "error_setg(VAR_5, \"LUKS version %\" PRIu32 \" is not supported\",\nluks->header.version);", "VAR_6 = -ENOTSUP;", "goto fail;", "}", "VAR_7 = strchr(luks->header.cipher_mode, '-');", "if (!VAR_7) {", "VAR_6 = -EINVAL;", "error_setg(VAR_5, \"Unexpected cipher mode string format %s\",\nluks->header.cipher_mode);", "goto fail;", "}", "*VAR_7 = '\\0';", "VAR_7++;", "VAR_8 = strchr(VAR_7, ':');", "if (!VAR_8) {", "ivhash = 0;", "} else {", "*VAR_8 = '\\0';", "VAR_8++;", "ivhash = qcrypto_block_luks_hash_name_lookup(VAR_8,\n&local_err);", "if (local_err) {", "VAR_6 = -ENOTSUP;", "error_propagate(VAR_5, local_err);", "goto fail;", "}", "}", "ciphermode = qcrypto_block_luks_cipher_mode_lookup(luks->header.cipher_mode,\n&local_err);", "if (local_err) {", "VAR_6 = -ENOTSUP;", "error_propagate(VAR_5, local_err);", "goto fail;", "}", "cipheralg = qcrypto_block_luks_cipher_name_lookup(luks->header.cipher_name,\nciphermode,\nluks->header.key_bytes,\n&local_err);", "if (local_err) {", "VAR_6 = -ENOTSUP;", "error_propagate(VAR_5, local_err);", "goto fail;", "}", "hash = qcrypto_block_luks_hash_name_lookup(luks->header.hash_spec,\n&local_err);", "if (local_err) {", "VAR_6 = -ENOTSUP;", "error_propagate(VAR_5, local_err);", "goto fail;", "}", "ivalg = qcrypto_block_luks_ivgen_name_lookup(VAR_7,\n&local_err);", "if (local_err) {", "VAR_6 = -ENOTSUP;", "error_propagate(VAR_5, local_err);", "goto fail;", "}", "if (ivalg == QCRYPTO_IVGEN_ALG_ESSIV) {", "if (!VAR_8) {", "VAR_6 = -EINVAL;", "error_setg(VAR_5, \"Missing IV generator hash specification\");", "goto fail;", "}", "ivcipheralg = qcrypto_block_luks_essiv_cipher(cipheralg,\nivhash,\n&local_err);", "if (local_err) {", "VAR_6 = -ENOTSUP;", "error_propagate(VAR_5, local_err);", "goto fail;", "}", "} else {", "ivcipheralg = cipheralg;", "}", "if (!(VAR_4 & QCRYPTO_BLOCK_OPEN_NO_IO)) {", "if (qcrypto_block_luks_find_key(VAR_0,\nVAR_9,\ncipheralg, ciphermode,\nhash,\nivalg,\nivcipheralg,\nivhash,\n&masterkey, &masterkeylen,\nVAR_2, VAR_3,\nVAR_5) < 0) {", "VAR_6 = -EACCES;", "goto fail;", "}", "VAR_0->kdfhash = hash;", "VAR_0->niv = qcrypto_cipher_get_iv_len(cipheralg,\nciphermode);", "VAR_0->ivgen = qcrypto_ivgen_new(ivalg,\nivcipheralg,\nivhash,\nmasterkey, masterkeylen,\nVAR_5);", "if (!VAR_0->ivgen) {", "VAR_6 = -ENOTSUP;", "goto fail;", "}", "VAR_0->cipher = qcrypto_cipher_new(cipheralg,\nciphermode,\nmasterkey, masterkeylen,\nVAR_5);", "if (!VAR_0->cipher) {", "VAR_6 = -ENOTSUP;", "goto fail;", "}", "}", "VAR_0->payload_offset = luks->header.payload_offset *\nQCRYPTO_BLOCK_LUKS_SECTOR_SIZE;", "luks->cipher_alg = cipheralg;", "luks->cipher_mode = ciphermode;", "luks->ivgen_alg = ivalg;", "luks->ivgen_hash_alg = ivhash;", "luks->hash_alg = hash;", "g_free(masterkey);", "g_free(VAR_9);", "return 0;", "fail:\ng_free(masterkey);", "qcrypto_cipher_free(VAR_0->cipher);", "qcrypto_ivgen_free(VAR_0->ivgen);", "g_free(luks);", "g_free(VAR_9);", "return VAR_6;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9, 11, 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57, 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 71 ], [ 73 ], [ 81, 83, 85, 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 127, 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141, 143 ], [ 145 ], [ 147 ], [ 149 ], [ 169 ], [ 171 ], [ 173 ], [ 175, 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 203, 205 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 221, 223 ], [ 225 ], [ 227 ], [ 229 ], [ 231 ], [ 233 ], [ 237, 239, 241, 243 ], [ 245 ], [ 247 ], [ 249 ], [ 251 ], [ 253 ], [ 257, 259 ], [ 261 ], [ 263 ], [ 265 ], [ 267 ], [ 269 ], [ 273, 275 ], [ 277 ], [ 279 ], [ 281 ], [ 283 ], [ 285 ], [ 289 ], [ 291 ], [ 293 ], [ 295 ], [ 297 ], [ 299 ], [ 301, 303, 305 ], [ 307 ], [ 309 ], [ 311 ], [ 313 ], [ 315 ], [ 317 ], [ 333 ], [ 335 ], [ 339 ], [ 347, 349, 351, 353, 355, 357, 359, 361, 363, 365 ], [ 367 ], [ 369 ], [ 371 ], [ 381 ], [ 383, 385 ], [ 387, 389, 391, 393, 395 ], [ 397 ], [ 399 ], [ 401 ], [ 403 ], [ 407, 409, 411, 413 ], [ 415 ], [ 417 ], [ 419 ], [ 421 ], [ 423 ], [ 427, 429 ], [ 433 ], [ 435 ], [ 437 ], [ 439 ], [ 441 ], [ 445 ], [ 447 ], [ 451 ], [ 455, 457 ], [ 459 ], [ 461 ], [ 463 ], [ 465 ], [ 467 ], [ 469 ] ]
14,784
static void rng_egd_free_requests(RngEgd *s) { GSList *i; for (i = s->parent.requests; i; i = i->next) { rng_egd_free_request(i->data); } g_slist_free(s->parent.requests); s->parent.requests = NULL; }
false
qemu
9f14b0add1dcdbfa2ee61051d068211fb0a1fcc9
static void rng_egd_free_requests(RngEgd *s) { GSList *i; for (i = s->parent.requests; i; i = i->next) { rng_egd_free_request(i->data); } g_slist_free(s->parent.requests); s->parent.requests = NULL; }
{ "code": [], "line_no": [] }
static void FUNC_0(RngEgd *VAR_0) { GSList *i; for (i = VAR_0->parent.requests; i; i = i->next) { rng_egd_free_request(i->data); } g_slist_free(VAR_0->parent.requests); VAR_0->parent.requests = NULL; }
[ "static void FUNC_0(RngEgd *VAR_0)\n{", "GSList *i;", "for (i = VAR_0->parent.requests; i; i = i->next) {", "rng_egd_free_request(i->data);", "}", "g_slist_free(VAR_0->parent.requests);", "VAR_0->parent.requests = NULL;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ] ]
14,785
static void test_qemu_strtoull_octal(void) { const char *str = "0123"; char f = 'X'; const char *endptr = &f; uint64_t res = 999; int err; err = qemu_strtoull(str, &endptr, 8, &res); g_assert_cmpint(err, ==, 0); g_assert_cmpint(res, ==, 0123); g_assert(endptr == str + strlen(str)); endptr = &f; res = 999; err = qemu_strtoull(str, &endptr, 0, &res); g_assert_cmpint(err, ==, 0); g_assert_cmpint(res, ==, 0123); g_assert(endptr == str + strlen(str)); }
false
qemu
bc7c08a2c375acb7ae4d433054415588b176d34c
static void test_qemu_strtoull_octal(void) { const char *str = "0123"; char f = 'X'; const char *endptr = &f; uint64_t res = 999; int err; err = qemu_strtoull(str, &endptr, 8, &res); g_assert_cmpint(err, ==, 0); g_assert_cmpint(res, ==, 0123); g_assert(endptr == str + strlen(str)); endptr = &f; res = 999; err = qemu_strtoull(str, &endptr, 0, &res); g_assert_cmpint(err, ==, 0); g_assert_cmpint(res, ==, 0123); g_assert(endptr == str + strlen(str)); }
{ "code": [], "line_no": [] }
static void FUNC_0(void) { const char *VAR_0 = "0123"; char VAR_1 = 'X'; const char *VAR_2 = &VAR_1; uint64_t res = 999; int VAR_3; VAR_3 = qemu_strtoull(VAR_0, &VAR_2, 8, &res); g_assert_cmpint(VAR_3, ==, 0); g_assert_cmpint(res, ==, 0123); g_assert(VAR_2 == VAR_0 + strlen(VAR_0)); VAR_2 = &VAR_1; res = 999; VAR_3 = qemu_strtoull(VAR_0, &VAR_2, 0, &res); g_assert_cmpint(VAR_3, ==, 0); g_assert_cmpint(res, ==, 0123); g_assert(VAR_2 == VAR_0 + strlen(VAR_0)); }
[ "static void FUNC_0(void)\n{", "const char *VAR_0 = \"0123\";", "char VAR_1 = 'X';", "const char *VAR_2 = &VAR_1;", "uint64_t res = 999;", "int VAR_3;", "VAR_3 = qemu_strtoull(VAR_0, &VAR_2, 8, &res);", "g_assert_cmpint(VAR_3, ==, 0);", "g_assert_cmpint(res, ==, 0123);", "g_assert(VAR_2 == VAR_0 + strlen(VAR_0));", "VAR_2 = &VAR_1;", "res = 999;", "VAR_3 = qemu_strtoull(VAR_0, &VAR_2, 0, &res);", "g_assert_cmpint(VAR_3, ==, 0);", "g_assert_cmpint(res, ==, 0123);", "g_assert(VAR_2 == VAR_0 + strlen(VAR_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 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ] ]
14,786
static inline void gen_ins(DisasContext *s, int ot) { gen_string_movl_A0_EDI(s); gen_op_movl_T0_0(); gen_op_st_T0_A0(ot + s->mem_index); gen_op_mov_TN_reg(OT_WORD, 1, R_EDX); tcg_gen_trunc_tl_i32(cpu_tmp2_i32, cpu_T[1]); tcg_gen_andi_i32(cpu_tmp2_i32, cpu_tmp2_i32, 0xffff); tcg_gen_helper_1_1(helper_in_func[ot], cpu_T[0], cpu_tmp2_i32); gen_op_st_T0_A0(ot + s->mem_index); gen_op_movl_T0_Dshift[ot](); #ifdef TARGET_X86_64 if (s->aflag == 2) { gen_op_addq_EDI_T0(); } else #endif if (s->aflag) { gen_op_addl_EDI_T0(); } else { gen_op_addw_EDI_T0(); } }
false
qemu
6e0d8677cb443e7408c0b7a25a93c6596d7fa380
static inline void gen_ins(DisasContext *s, int ot) { gen_string_movl_A0_EDI(s); gen_op_movl_T0_0(); gen_op_st_T0_A0(ot + s->mem_index); gen_op_mov_TN_reg(OT_WORD, 1, R_EDX); tcg_gen_trunc_tl_i32(cpu_tmp2_i32, cpu_T[1]); tcg_gen_andi_i32(cpu_tmp2_i32, cpu_tmp2_i32, 0xffff); tcg_gen_helper_1_1(helper_in_func[ot], cpu_T[0], cpu_tmp2_i32); gen_op_st_T0_A0(ot + s->mem_index); gen_op_movl_T0_Dshift[ot](); #ifdef TARGET_X86_64 if (s->aflag == 2) { gen_op_addq_EDI_T0(); } else #endif if (s->aflag) { gen_op_addl_EDI_T0(); } else { gen_op_addw_EDI_T0(); } }
{ "code": [], "line_no": [] }
static inline void FUNC_0(DisasContext *VAR_0, int VAR_1) { gen_string_movl_A0_EDI(VAR_0); gen_op_movl_T0_0(); gen_op_st_T0_A0(VAR_1 + VAR_0->mem_index); gen_op_mov_TN_reg(OT_WORD, 1, R_EDX); tcg_gen_trunc_tl_i32(cpu_tmp2_i32, cpu_T[1]); tcg_gen_andi_i32(cpu_tmp2_i32, cpu_tmp2_i32, 0xffff); tcg_gen_helper_1_1(helper_in_func[VAR_1], cpu_T[0], cpu_tmp2_i32); gen_op_st_T0_A0(VAR_1 + VAR_0->mem_index); gen_op_movl_T0_Dshift[VAR_1](); #ifdef TARGET_X86_64 if (VAR_0->aflag == 2) { gen_op_addq_EDI_T0(); } else #endif if (VAR_0->aflag) { gen_op_addl_EDI_T0(); } else { gen_op_addw_EDI_T0(); } }
[ "static inline void FUNC_0(DisasContext *VAR_0, int VAR_1)\n{", "gen_string_movl_A0_EDI(VAR_0);", "gen_op_movl_T0_0();", "gen_op_st_T0_A0(VAR_1 + VAR_0->mem_index);", "gen_op_mov_TN_reg(OT_WORD, 1, R_EDX);", "tcg_gen_trunc_tl_i32(cpu_tmp2_i32, cpu_T[1]);", "tcg_gen_andi_i32(cpu_tmp2_i32, cpu_tmp2_i32, 0xffff);", "tcg_gen_helper_1_1(helper_in_func[VAR_1], cpu_T[0], cpu_tmp2_i32);", "gen_op_st_T0_A0(VAR_1 + VAR_0->mem_index);", "gen_op_movl_T0_Dshift[VAR_1]();", "#ifdef TARGET_X86_64\nif (VAR_0->aflag == 2) {", "gen_op_addq_EDI_T0();", "} else", "#endif\nif (VAR_0->aflag) {", "gen_op_addl_EDI_T0();", "} else {", "gen_op_addw_EDI_T0();", "}", "}" ]
[ 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 ] ]
14,787
static void vapic_map_rom_writable(VAPICROMState *s) { target_phys_addr_t rom_paddr = s->rom_state_paddr & ROM_BLOCK_MASK; MemoryRegionSection section; MemoryRegion *as; size_t rom_size; uint8_t *ram; as = sysbus_address_space(&s->busdev); if (s->rom_mapped_writable) { memory_region_del_subregion(as, &s->rom); memory_region_destroy(&s->rom); } /* grab RAM memory region (region @rom_paddr may still be pc.rom) */ section = memory_region_find(as, 0, 1); /* read ROM size from RAM region */ ram = memory_region_get_ram_ptr(section.mr); rom_size = ram[rom_paddr + 2] * ROM_BLOCK_SIZE; s->rom_size = rom_size; /* We need to round to avoid creating subpages * from which we cannot run code. */ rom_size += rom_paddr & ~TARGET_PAGE_MASK; rom_paddr &= TARGET_PAGE_MASK; rom_size = TARGET_PAGE_ALIGN(rom_size); memory_region_init_alias(&s->rom, "kvmvapic-rom", section.mr, rom_paddr, rom_size); memory_region_add_subregion_overlap(as, rom_paddr, &s->rom, 1000); s->rom_mapped_writable = true; }
false
qemu
a8170e5e97ad17ca169c64ba87ae2f53850dab4c
static void vapic_map_rom_writable(VAPICROMState *s) { target_phys_addr_t rom_paddr = s->rom_state_paddr & ROM_BLOCK_MASK; MemoryRegionSection section; MemoryRegion *as; size_t rom_size; uint8_t *ram; as = sysbus_address_space(&s->busdev); if (s->rom_mapped_writable) { memory_region_del_subregion(as, &s->rom); memory_region_destroy(&s->rom); } section = memory_region_find(as, 0, 1); ram = memory_region_get_ram_ptr(section.mr); rom_size = ram[rom_paddr + 2] * ROM_BLOCK_SIZE; s->rom_size = rom_size; rom_size += rom_paddr & ~TARGET_PAGE_MASK; rom_paddr &= TARGET_PAGE_MASK; rom_size = TARGET_PAGE_ALIGN(rom_size); memory_region_init_alias(&s->rom, "kvmvapic-rom", section.mr, rom_paddr, rom_size); memory_region_add_subregion_overlap(as, rom_paddr, &s->rom, 1000); s->rom_mapped_writable = true; }
{ "code": [], "line_no": [] }
static void FUNC_0(VAPICROMState *VAR_0) { target_phys_addr_t rom_paddr = VAR_0->rom_state_paddr & ROM_BLOCK_MASK; MemoryRegionSection section; MemoryRegion *as; size_t rom_size; uint8_t *ram; as = sysbus_address_space(&VAR_0->busdev); if (VAR_0->rom_mapped_writable) { memory_region_del_subregion(as, &VAR_0->rom); memory_region_destroy(&VAR_0->rom); } section = memory_region_find(as, 0, 1); ram = memory_region_get_ram_ptr(section.mr); rom_size = ram[rom_paddr + 2] * ROM_BLOCK_SIZE; VAR_0->rom_size = rom_size; rom_size += rom_paddr & ~TARGET_PAGE_MASK; rom_paddr &= TARGET_PAGE_MASK; rom_size = TARGET_PAGE_ALIGN(rom_size); memory_region_init_alias(&VAR_0->rom, "kvmvapic-rom", section.mr, rom_paddr, rom_size); memory_region_add_subregion_overlap(as, rom_paddr, &VAR_0->rom, 1000); VAR_0->rom_mapped_writable = true; }
[ "static void FUNC_0(VAPICROMState *VAR_0)\n{", "target_phys_addr_t rom_paddr = VAR_0->rom_state_paddr & ROM_BLOCK_MASK;", "MemoryRegionSection section;", "MemoryRegion *as;", "size_t rom_size;", "uint8_t *ram;", "as = sysbus_address_space(&VAR_0->busdev);", "if (VAR_0->rom_mapped_writable) {", "memory_region_del_subregion(as, &VAR_0->rom);", "memory_region_destroy(&VAR_0->rom);", "}", "section = memory_region_find(as, 0, 1);", "ram = memory_region_get_ram_ptr(section.mr);", "rom_size = ram[rom_paddr + 2] * ROM_BLOCK_SIZE;", "VAR_0->rom_size = rom_size;", "rom_size += rom_paddr & ~TARGET_PAGE_MASK;", "rom_paddr &= TARGET_PAGE_MASK;", "rom_size = TARGET_PAGE_ALIGN(rom_size);", "memory_region_init_alias(&VAR_0->rom, \"kvmvapic-rom\", section.mr, rom_paddr,\nrom_size);", "memory_region_add_subregion_overlap(as, rom_paddr, &VAR_0->rom, 1000);", "VAR_0->rom_mapped_writable = true;", "}" ]
[ 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 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 33 ], [ 39 ], [ 41 ], [ 43 ], [ 51 ], [ 53 ], [ 55 ], [ 59, 61 ], [ 63 ], [ 65 ], [ 67 ] ]
14,790
void block_job_resume(BlockJob *job) { job->paused = false; block_job_iostatus_reset(job); if (job->co && !job->busy) { qemu_coroutine_enter(job->co, NULL); } }
false
qemu
751ebd76e654bd1e65da08ecf694325282b4cfcc
void block_job_resume(BlockJob *job) { job->paused = false; block_job_iostatus_reset(job); if (job->co && !job->busy) { qemu_coroutine_enter(job->co, NULL); } }
{ "code": [], "line_no": [] }
void FUNC_0(BlockJob *VAR_0) { VAR_0->paused = false; block_job_iostatus_reset(VAR_0); if (VAR_0->co && !VAR_0->busy) { qemu_coroutine_enter(VAR_0->co, NULL); } }
[ "void FUNC_0(BlockJob *VAR_0)\n{", "VAR_0->paused = false;", "block_job_iostatus_reset(VAR_0);", "if (VAR_0->co && !VAR_0->busy) {", "qemu_coroutine_enter(VAR_0->co, NULL);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ] ]
14,792
static inline void vring_used_write(VirtQueue *vq, VRingUsedElem *uelem, int i) { hwaddr pa; virtio_tswap32s(vq->vdev, &uelem->id); virtio_tswap32s(vq->vdev, &uelem->len); pa = vq->vring.used + offsetof(VRingUsed, ring[i]); address_space_write(&address_space_memory, pa, MEMTXATTRS_UNSPECIFIED, (void *)uelem, sizeof(VRingUsedElem)); }
false
qemu
8607f5c3072caeebbe0217df28651fffd3a79fd9
static inline void vring_used_write(VirtQueue *vq, VRingUsedElem *uelem, int i) { hwaddr pa; virtio_tswap32s(vq->vdev, &uelem->id); virtio_tswap32s(vq->vdev, &uelem->len); pa = vq->vring.used + offsetof(VRingUsed, ring[i]); address_space_write(&address_space_memory, pa, MEMTXATTRS_UNSPECIFIED, (void *)uelem, sizeof(VRingUsedElem)); }
{ "code": [], "line_no": [] }
static inline void FUNC_0(VirtQueue *VAR_0, VRingUsedElem *VAR_1, int VAR_2) { hwaddr pa; virtio_tswap32s(VAR_0->vdev, &VAR_1->id); virtio_tswap32s(VAR_0->vdev, &VAR_1->len); pa = VAR_0->vring.used + offsetof(VRingUsed, ring[VAR_2]); address_space_write(&address_space_memory, pa, MEMTXATTRS_UNSPECIFIED, (void *)VAR_1, sizeof(VRingUsedElem)); }
[ "static inline void FUNC_0(VirtQueue *VAR_0, VRingUsedElem *VAR_1,\nint VAR_2)\n{", "hwaddr pa;", "virtio_tswap32s(VAR_0->vdev, &VAR_1->id);", "virtio_tswap32s(VAR_0->vdev, &VAR_1->len);", "pa = VAR_0->vring.used + offsetof(VRingUsed, ring[VAR_2]);", "address_space_write(&address_space_memory, pa, MEMTXATTRS_UNSPECIFIED,\n(void *)VAR_1, sizeof(VRingUsedElem));", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15, 17 ], [ 19 ] ]
14,793
static int writev_f(BlockBackend *blk, int argc, char **argv) { struct timeval t1, t2; int Cflag = 0, qflag = 0; int c, cnt; char *buf; int64_t offset; /* Some compilers get confused and warn if this is not initialized. */ int total = 0; int nr_iov; int pattern = 0xcd; QEMUIOVector qiov; while ((c = getopt(argc, argv, "CqP:")) != EOF) { switch (c) { case 'C': Cflag = 1; break; case 'q': qflag = 1; break; case 'P': pattern = parse_pattern(optarg); if (pattern < 0) { return 0; } break; default: return qemuio_command_usage(&writev_cmd); } } if (optind > argc - 2) { return qemuio_command_usage(&writev_cmd); } offset = cvtnum(argv[optind]); if (offset < 0) { printf("non-numeric length argument -- %s\n", argv[optind]); return 0; } optind++; if (offset & 0x1ff) { printf("offset %" PRId64 " is not sector aligned\n", offset); return 0; } nr_iov = argc - optind; buf = create_iovec(blk, &qiov, &argv[optind], nr_iov, pattern); if (buf == NULL) { return 0; } gettimeofday(&t1, NULL); cnt = do_aio_writev(blk, &qiov, offset, &total); gettimeofday(&t2, NULL); if (cnt < 0) { printf("writev failed: %s\n", strerror(-cnt)); goto out; } if (qflag) { goto out; } /* Finally, report back -- -C gives a parsable format */ t2 = tsub(t2, t1); print_report("wrote", &t2, offset, qiov.size, total, cnt, Cflag); out: qemu_iovec_destroy(&qiov); qemu_io_free(buf); return 0; }
false
qemu
b062ad86dcd33ab39be5060b0655d8e13834b167
static int writev_f(BlockBackend *blk, int argc, char **argv) { struct timeval t1, t2; int Cflag = 0, qflag = 0; int c, cnt; char *buf; int64_t offset; int total = 0; int nr_iov; int pattern = 0xcd; QEMUIOVector qiov; while ((c = getopt(argc, argv, "CqP:")) != EOF) { switch (c) { case 'C': Cflag = 1; break; case 'q': qflag = 1; break; case 'P': pattern = parse_pattern(optarg); if (pattern < 0) { return 0; } break; default: return qemuio_command_usage(&writev_cmd); } } if (optind > argc - 2) { return qemuio_command_usage(&writev_cmd); } offset = cvtnum(argv[optind]); if (offset < 0) { printf("non-numeric length argument -- %s\n", argv[optind]); return 0; } optind++; if (offset & 0x1ff) { printf("offset %" PRId64 " is not sector aligned\n", offset); return 0; } nr_iov = argc - optind; buf = create_iovec(blk, &qiov, &argv[optind], nr_iov, pattern); if (buf == NULL) { return 0; } gettimeofday(&t1, NULL); cnt = do_aio_writev(blk, &qiov, offset, &total); gettimeofday(&t2, NULL); if (cnt < 0) { printf("writev failed: %s\n", strerror(-cnt)); goto out; } if (qflag) { goto out; } t2 = tsub(t2, t1); print_report("wrote", &t2, offset, qiov.size, total, cnt, Cflag); out: qemu_iovec_destroy(&qiov); qemu_io_free(buf); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(BlockBackend *VAR_0, int VAR_1, char **VAR_2) { struct timeval VAR_3, VAR_4; int VAR_5 = 0, VAR_6 = 0; int VAR_7, VAR_8; char *VAR_9; int64_t offset; int VAR_10 = 0; int VAR_11; int VAR_12 = 0xcd; QEMUIOVector qiov; while ((VAR_7 = getopt(VAR_1, VAR_2, "CqP:")) != EOF) { switch (VAR_7) { case 'C': VAR_5 = 1; break; case 'q': VAR_6 = 1; break; case 'P': VAR_12 = parse_pattern(optarg); if (VAR_12 < 0) { return 0; } break; default: return qemuio_command_usage(&writev_cmd); } } if (optind > VAR_1 - 2) { return qemuio_command_usage(&writev_cmd); } offset = cvtnum(VAR_2[optind]); if (offset < 0) { printf("non-numeric length argument -- %s\n", VAR_2[optind]); return 0; } optind++; if (offset & 0x1ff) { printf("offset %" PRId64 " is not sector aligned\n", offset); return 0; } VAR_11 = VAR_1 - optind; VAR_9 = create_iovec(VAR_0, &qiov, &VAR_2[optind], VAR_11, VAR_12); if (VAR_9 == NULL) { return 0; } gettimeofday(&VAR_3, NULL); VAR_8 = do_aio_writev(VAR_0, &qiov, offset, &VAR_10); gettimeofday(&VAR_4, NULL); if (VAR_8 < 0) { printf("writev failed: %s\n", strerror(-VAR_8)); goto out; } if (VAR_6) { goto out; } VAR_4 = tsub(VAR_4, VAR_3); print_report("wrote", &VAR_4, offset, qiov.size, VAR_10, VAR_8, VAR_5); out: qemu_iovec_destroy(&qiov); qemu_io_free(VAR_9); return 0; }
[ "static int FUNC_0(BlockBackend *VAR_0, int VAR_1, char **VAR_2)\n{", "struct timeval VAR_3, VAR_4;", "int VAR_5 = 0, VAR_6 = 0;", "int VAR_7, VAR_8;", "char *VAR_9;", "int64_t offset;", "int VAR_10 = 0;", "int VAR_11;", "int VAR_12 = 0xcd;", "QEMUIOVector qiov;", "while ((VAR_7 = getopt(VAR_1, VAR_2, \"CqP:\")) != EOF) {", "switch (VAR_7) {", "case 'C':\nVAR_5 = 1;", "break;", "case 'q':\nVAR_6 = 1;", "break;", "case 'P':\nVAR_12 = parse_pattern(optarg);", "if (VAR_12 < 0) {", "return 0;", "}", "break;", "default:\nreturn qemuio_command_usage(&writev_cmd);", "}", "}", "if (optind > VAR_1 - 2) {", "return qemuio_command_usage(&writev_cmd);", "}", "offset = cvtnum(VAR_2[optind]);", "if (offset < 0) {", "printf(\"non-numeric length argument -- %s\\n\", VAR_2[optind]);", "return 0;", "}", "optind++;", "if (offset & 0x1ff) {", "printf(\"offset %\" PRId64 \" is not sector aligned\\n\",\noffset);", "return 0;", "}", "VAR_11 = VAR_1 - optind;", "VAR_9 = create_iovec(VAR_0, &qiov, &VAR_2[optind], VAR_11, VAR_12);", "if (VAR_9 == NULL) {", "return 0;", "}", "gettimeofday(&VAR_3, NULL);", "VAR_8 = do_aio_writev(VAR_0, &qiov, offset, &VAR_10);", "gettimeofday(&VAR_4, NULL);", "if (VAR_8 < 0) {", "printf(\"writev failed: %s\\n\", strerror(-VAR_8));", "goto out;", "}", "if (VAR_6) {", "goto out;", "}", "VAR_4 = tsub(VAR_4, VAR_3);", "print_report(\"wrote\", &VAR_4, offset, qiov.size, VAR_10, VAR_8, VAR_5);", "out:\nqemu_iovec_destroy(&qiov);", "qemu_io_free(VAR_9);", "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 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31, 33 ], [ 35 ], [ 37, 39 ], [ 41 ], [ 43, 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55, 57 ], [ 59 ], [ 61 ], [ 65 ], [ 67 ], [ 69 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 87 ], [ 89, 91 ], [ 93 ], [ 95 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 111 ], [ 113 ], [ 115 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 129 ], [ 131 ], [ 133 ], [ 139 ], [ 141 ], [ 143, 145 ], [ 147 ], [ 149 ], [ 151 ] ]
14,794
static int cow_open(BlockDriverState *bs, QDict *options, int flags, Error **errp) { BDRVCowState *s = bs->opaque; struct cow_header_v2 cow_header; int bitmap_size; int64_t size; int ret; /* see if it is a cow image */ ret = bdrv_pread(bs->file, 0, &cow_header, sizeof(cow_header)); if (ret < 0) { goto fail; } if (be32_to_cpu(cow_header.magic) != COW_MAGIC) { error_setg(errp, "Image not in COW format"); ret = -EINVAL; goto fail; } if (be32_to_cpu(cow_header.version) != COW_VERSION) { char version[64]; snprintf(version, sizeof(version), "COW version %" PRIu32, cow_header.version); error_set(errp, QERR_UNKNOWN_BLOCK_FORMAT_FEATURE, bs->device_name, "cow", version); ret = -ENOTSUP; goto fail; } /* cow image found */ size = be64_to_cpu(cow_header.size); bs->total_sectors = size / 512; pstrcpy(bs->backing_file, sizeof(bs->backing_file), cow_header.backing_file); bitmap_size = ((bs->total_sectors + 7) >> 3) + sizeof(cow_header); s->cow_sectors_offset = (bitmap_size + 511) & ~511; qemu_co_mutex_init(&s->lock); return 0; fail: return ret; }
false
qemu
550830f9351291c585c963204ad9127998b1c1ce
static int cow_open(BlockDriverState *bs, QDict *options, int flags, Error **errp) { BDRVCowState *s = bs->opaque; struct cow_header_v2 cow_header; int bitmap_size; int64_t size; int ret; ret = bdrv_pread(bs->file, 0, &cow_header, sizeof(cow_header)); if (ret < 0) { goto fail; } if (be32_to_cpu(cow_header.magic) != COW_MAGIC) { error_setg(errp, "Image not in COW format"); ret = -EINVAL; goto fail; } if (be32_to_cpu(cow_header.version) != COW_VERSION) { char version[64]; snprintf(version, sizeof(version), "COW version %" PRIu32, cow_header.version); error_set(errp, QERR_UNKNOWN_BLOCK_FORMAT_FEATURE, bs->device_name, "cow", version); ret = -ENOTSUP; goto fail; } size = be64_to_cpu(cow_header.size); bs->total_sectors = size / 512; pstrcpy(bs->backing_file, sizeof(bs->backing_file), cow_header.backing_file); bitmap_size = ((bs->total_sectors + 7) >> 3) + sizeof(cow_header); s->cow_sectors_offset = (bitmap_size + 511) & ~511; qemu_co_mutex_init(&s->lock); return 0; fail: return ret; }
{ "code": [], "line_no": [] }
static int FUNC_0(BlockDriverState *VAR_0, QDict *VAR_1, int VAR_2, Error **VAR_3) { BDRVCowState *s = VAR_0->opaque; struct cow_header_v2 VAR_4; int VAR_5; int64_t size; int VAR_6; VAR_6 = bdrv_pread(VAR_0->file, 0, &VAR_4, sizeof(VAR_4)); if (VAR_6 < 0) { goto fail; } if (be32_to_cpu(VAR_4.magic) != COW_MAGIC) { error_setg(VAR_3, "Image not in COW format"); VAR_6 = -EINVAL; goto fail; } if (be32_to_cpu(VAR_4.VAR_7) != COW_VERSION) { char VAR_7[64]; snprintf(VAR_7, sizeof(VAR_7), "COW VAR_7 %" PRIu32, VAR_4.VAR_7); error_set(VAR_3, QERR_UNKNOWN_BLOCK_FORMAT_FEATURE, VAR_0->device_name, "cow", VAR_7); VAR_6 = -ENOTSUP; goto fail; } size = be64_to_cpu(VAR_4.size); VAR_0->total_sectors = size / 512; pstrcpy(VAR_0->backing_file, sizeof(VAR_0->backing_file), VAR_4.backing_file); VAR_5 = ((VAR_0->total_sectors + 7) >> 3) + sizeof(VAR_4); s->cow_sectors_offset = (VAR_5 + 511) & ~511; qemu_co_mutex_init(&s->lock); return 0; fail: return VAR_6; }
[ "static int FUNC_0(BlockDriverState *VAR_0, QDict *VAR_1, int VAR_2,\nError **VAR_3)\n{", "BDRVCowState *s = VAR_0->opaque;", "struct cow_header_v2 VAR_4;", "int VAR_5;", "int64_t size;", "int VAR_6;", "VAR_6 = bdrv_pread(VAR_0->file, 0, &VAR_4, sizeof(VAR_4));", "if (VAR_6 < 0) {", "goto fail;", "}", "if (be32_to_cpu(VAR_4.magic) != COW_MAGIC) {", "error_setg(VAR_3, \"Image not in COW format\");", "VAR_6 = -EINVAL;", "goto fail;", "}", "if (be32_to_cpu(VAR_4.VAR_7) != COW_VERSION) {", "char VAR_7[64];", "snprintf(VAR_7, sizeof(VAR_7),\n\"COW VAR_7 %\" PRIu32, VAR_4.VAR_7);", "error_set(VAR_3, QERR_UNKNOWN_BLOCK_FORMAT_FEATURE,\nVAR_0->device_name, \"cow\", VAR_7);", "VAR_6 = -ENOTSUP;", "goto fail;", "}", "size = be64_to_cpu(VAR_4.size);", "VAR_0->total_sectors = size / 512;", "pstrcpy(VAR_0->backing_file, sizeof(VAR_0->backing_file),\nVAR_4.backing_file);", "VAR_5 = ((VAR_0->total_sectors + 7) >> 3) + sizeof(VAR_4);", "s->cow_sectors_offset = (VAR_5 + 511) & ~511;", "qemu_co_mutex_init(&s->lock);", "return 0;", "fail:\nreturn VAR_6;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ], [ 47, 49 ], [ 51, 53 ], [ 55 ], [ 57 ], [ 59 ], [ 65 ], [ 67 ], [ 71, 73 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85, 87 ], [ 89 ] ]
14,795
static void pc_compat_2_2(MachineState *machine) { pc_compat_2_3(machine); rsdp_in_ram = false; machine->suppress_vmdesc = true; }
false
qemu
7102fa7073b2cefb33ab4012a11f15fbf297a74b
static void pc_compat_2_2(MachineState *machine) { pc_compat_2_3(machine); rsdp_in_ram = false; machine->suppress_vmdesc = true; }
{ "code": [], "line_no": [] }
static void FUNC_0(MachineState *VAR_0) { pc_compat_2_3(VAR_0); rsdp_in_ram = false; VAR_0->suppress_vmdesc = true; }
[ "static void FUNC_0(MachineState *VAR_0)\n{", "pc_compat_2_3(VAR_0);", "rsdp_in_ram = false;", "VAR_0->suppress_vmdesc = true;", "}" ]
[ 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ] ]
14,796
void spapr_core_pre_plug(HotplugHandler *hotplug_dev, DeviceState *dev, Error **errp) { MachineState *machine = MACHINE(OBJECT(hotplug_dev)); sPAPRMachineClass *smc = SPAPR_MACHINE_GET_CLASS(OBJECT(hotplug_dev)); sPAPRMachineState *spapr = SPAPR_MACHINE(OBJECT(hotplug_dev)); int spapr_max_cores = max_cpus / smp_threads; int index; Error *local_err = NULL; CPUCore *cc = CPU_CORE(dev); char *base_core_type = spapr_get_cpu_core_type(machine->cpu_model); const char *type = object_get_typename(OBJECT(dev)); if (!smc->dr_cpu_enabled) { error_setg(&local_err, "CPU hotplug not supported for this machine"); goto out; } if (strcmp(base_core_type, type)) { error_setg(&local_err, "CPU core type should be %s", base_core_type); goto out; } if (cc->nr_threads != smp_threads) { error_setg(&local_err, "threads must be %d", smp_threads); goto out; } if (cc->core_id % smp_threads) { error_setg(&local_err, "invalid core id %d\n", cc->core_id); goto out; } index = cc->core_id / smp_threads; if (index < 0 || index >= spapr_max_cores) { error_setg(&local_err, "core id %d out of range", cc->core_id); goto out; } if (spapr->cores[index]) { error_setg(&local_err, "core %d already populated", cc->core_id); goto out; } out: g_free(base_core_type); error_propagate(errp, local_err); }
false
qemu
df3c286c53ac51e7267f2761c7a0c62e11b6e815
void spapr_core_pre_plug(HotplugHandler *hotplug_dev, DeviceState *dev, Error **errp) { MachineState *machine = MACHINE(OBJECT(hotplug_dev)); sPAPRMachineClass *smc = SPAPR_MACHINE_GET_CLASS(OBJECT(hotplug_dev)); sPAPRMachineState *spapr = SPAPR_MACHINE(OBJECT(hotplug_dev)); int spapr_max_cores = max_cpus / smp_threads; int index; Error *local_err = NULL; CPUCore *cc = CPU_CORE(dev); char *base_core_type = spapr_get_cpu_core_type(machine->cpu_model); const char *type = object_get_typename(OBJECT(dev)); if (!smc->dr_cpu_enabled) { error_setg(&local_err, "CPU hotplug not supported for this machine"); goto out; } if (strcmp(base_core_type, type)) { error_setg(&local_err, "CPU core type should be %s", base_core_type); goto out; } if (cc->nr_threads != smp_threads) { error_setg(&local_err, "threads must be %d", smp_threads); goto out; } if (cc->core_id % smp_threads) { error_setg(&local_err, "invalid core id %d\n", cc->core_id); goto out; } index = cc->core_id / smp_threads; if (index < 0 || index >= spapr_max_cores) { error_setg(&local_err, "core id %d out of range", cc->core_id); goto out; } if (spapr->cores[index]) { error_setg(&local_err, "core %d already populated", cc->core_id); goto out; } out: g_free(base_core_type); error_propagate(errp, local_err); }
{ "code": [], "line_no": [] }
void FUNC_0(HotplugHandler *VAR_0, DeviceState *VAR_1, Error **VAR_2) { MachineState *machine = MACHINE(OBJECT(VAR_0)); sPAPRMachineClass *smc = SPAPR_MACHINE_GET_CLASS(OBJECT(VAR_0)); sPAPRMachineState *spapr = SPAPR_MACHINE(OBJECT(VAR_0)); int VAR_3 = max_cpus / smp_threads; int VAR_4; Error *local_err = NULL; CPUCore *cc = CPU_CORE(VAR_1); char *VAR_5 = spapr_get_cpu_core_type(machine->cpu_model); const char *VAR_6 = object_get_typename(OBJECT(VAR_1)); if (!smc->dr_cpu_enabled) { error_setg(&local_err, "CPU hotplug not supported for this machine"); goto out; } if (strcmp(VAR_5, VAR_6)) { error_setg(&local_err, "CPU core VAR_6 should be %s", VAR_5); goto out; } if (cc->nr_threads != smp_threads) { error_setg(&local_err, "threads must be %d", smp_threads); goto out; } if (cc->core_id % smp_threads) { error_setg(&local_err, "invalid core id %d\n", cc->core_id); goto out; } VAR_4 = cc->core_id / smp_threads; if (VAR_4 < 0 || VAR_4 >= VAR_3) { error_setg(&local_err, "core id %d out of range", cc->core_id); goto out; } if (spapr->cores[VAR_4]) { error_setg(&local_err, "core %d already populated", cc->core_id); goto out; } out: g_free(VAR_5); error_propagate(VAR_2, local_err); }
[ "void FUNC_0(HotplugHandler *VAR_0, DeviceState *VAR_1,\nError **VAR_2)\n{", "MachineState *machine = MACHINE(OBJECT(VAR_0));", "sPAPRMachineClass *smc = SPAPR_MACHINE_GET_CLASS(OBJECT(VAR_0));", "sPAPRMachineState *spapr = SPAPR_MACHINE(OBJECT(VAR_0));", "int VAR_3 = max_cpus / smp_threads;", "int VAR_4;", "Error *local_err = NULL;", "CPUCore *cc = CPU_CORE(VAR_1);", "char *VAR_5 = spapr_get_cpu_core_type(machine->cpu_model);", "const char *VAR_6 = object_get_typename(OBJECT(VAR_1));", "if (!smc->dr_cpu_enabled) {", "error_setg(&local_err, \"CPU hotplug not supported for this machine\");", "goto out;", "}", "if (strcmp(VAR_5, VAR_6)) {", "error_setg(&local_err, \"CPU core VAR_6 should be %s\", VAR_5);", "goto out;", "}", "if (cc->nr_threads != smp_threads) {", "error_setg(&local_err, \"threads must be %d\", smp_threads);", "goto out;", "}", "if (cc->core_id % smp_threads) {", "error_setg(&local_err, \"invalid core id %d\\n\", cc->core_id);", "goto out;", "}", "VAR_4 = cc->core_id / smp_threads;", "if (VAR_4 < 0 || VAR_4 >= VAR_3) {", "error_setg(&local_err, \"core id %d out of range\", cc->core_id);", "goto out;", "}", "if (spapr->cores[VAR_4]) {", "error_setg(&local_err, \"core %d already populated\", cc->core_id);", "goto out;", "}", "out:\ng_free(VAR_5);", "error_propagate(VAR_2, local_err);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 89, 91 ], [ 93 ], [ 95 ] ]
14,797
static void scsi_disk_emulate_unmap(SCSIDiskReq *r, uint8_t *inbuf) { SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, r->req.dev); uint8_t *p = inbuf; int len = r->req.cmd.xfer; UnmapCBData *data; /* Reject ANCHOR=1. */ if (r->req.cmd.buf[1] & 0x1) { goto invalid_field; } if (len < 8) { goto invalid_param_len; } if (len < lduw_be_p(&p[0]) + 2) { goto invalid_param_len; } if (len < lduw_be_p(&p[2]) + 8) { goto invalid_param_len; } if (lduw_be_p(&p[2]) & 15) { goto invalid_param_len; } if (bdrv_is_read_only(s->qdev.conf.bs)) { scsi_check_condition(r, SENSE_CODE(WRITE_PROTECTED)); return; } data = g_new0(UnmapCBData, 1); data->r = r; data->inbuf = &p[8]; data->count = lduw_be_p(&p[2]) >> 4; /* The matching unref is in scsi_unmap_complete, before data is freed. */ scsi_req_ref(&r->req); scsi_unmap_complete(data, 0); return; invalid_param_len: scsi_check_condition(r, SENSE_CODE(INVALID_PARAM_LEN)); return; invalid_field: scsi_check_condition(r, SENSE_CODE(INVALID_FIELD)); }
false
qemu
4be746345f13e99e468c60acbd3a355e8183e3ce
static void scsi_disk_emulate_unmap(SCSIDiskReq *r, uint8_t *inbuf) { SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, r->req.dev); uint8_t *p = inbuf; int len = r->req.cmd.xfer; UnmapCBData *data; if (r->req.cmd.buf[1] & 0x1) { goto invalid_field; } if (len < 8) { goto invalid_param_len; } if (len < lduw_be_p(&p[0]) + 2) { goto invalid_param_len; } if (len < lduw_be_p(&p[2]) + 8) { goto invalid_param_len; } if (lduw_be_p(&p[2]) & 15) { goto invalid_param_len; } if (bdrv_is_read_only(s->qdev.conf.bs)) { scsi_check_condition(r, SENSE_CODE(WRITE_PROTECTED)); return; } data = g_new0(UnmapCBData, 1); data->r = r; data->inbuf = &p[8]; data->count = lduw_be_p(&p[2]) >> 4; scsi_req_ref(&r->req); scsi_unmap_complete(data, 0); return; invalid_param_len: scsi_check_condition(r, SENSE_CODE(INVALID_PARAM_LEN)); return; invalid_field: scsi_check_condition(r, SENSE_CODE(INVALID_FIELD)); }
{ "code": [], "line_no": [] }
static void FUNC_0(SCSIDiskReq *VAR_0, uint8_t *VAR_1) { SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, VAR_0->req.dev); uint8_t *p = VAR_1; int VAR_2 = VAR_0->req.cmd.xfer; UnmapCBData *data; if (VAR_0->req.cmd.buf[1] & 0x1) { goto invalid_field; } if (VAR_2 < 8) { goto invalid_param_len; } if (VAR_2 < lduw_be_p(&p[0]) + 2) { goto invalid_param_len; } if (VAR_2 < lduw_be_p(&p[2]) + 8) { goto invalid_param_len; } if (lduw_be_p(&p[2]) & 15) { goto invalid_param_len; } if (bdrv_is_read_only(s->qdev.conf.bs)) { scsi_check_condition(VAR_0, SENSE_CODE(WRITE_PROTECTED)); return; } data = g_new0(UnmapCBData, 1); data->VAR_0 = VAR_0; data->VAR_1 = &p[8]; data->count = lduw_be_p(&p[2]) >> 4; scsi_req_ref(&VAR_0->req); scsi_unmap_complete(data, 0); return; invalid_param_len: scsi_check_condition(VAR_0, SENSE_CODE(INVALID_PARAM_LEN)); return; invalid_field: scsi_check_condition(VAR_0, SENSE_CODE(INVALID_FIELD)); }
[ "static void FUNC_0(SCSIDiskReq *VAR_0, uint8_t *VAR_1)\n{", "SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, VAR_0->req.dev);", "uint8_t *p = VAR_1;", "int VAR_2 = VAR_0->req.cmd.xfer;", "UnmapCBData *data;", "if (VAR_0->req.cmd.buf[1] & 0x1) {", "goto invalid_field;", "}", "if (VAR_2 < 8) {", "goto invalid_param_len;", "}", "if (VAR_2 < lduw_be_p(&p[0]) + 2) {", "goto invalid_param_len;", "}", "if (VAR_2 < lduw_be_p(&p[2]) + 8) {", "goto invalid_param_len;", "}", "if (lduw_be_p(&p[2]) & 15) {", "goto invalid_param_len;", "}", "if (bdrv_is_read_only(s->qdev.conf.bs)) {", "scsi_check_condition(VAR_0, SENSE_CODE(WRITE_PROTECTED));", "return;", "}", "data = g_new0(UnmapCBData, 1);", "data->VAR_0 = VAR_0;", "data->VAR_1 = &p[8];", "data->count = lduw_be_p(&p[2]) >> 4;", "scsi_req_ref(&VAR_0->req);", "scsi_unmap_complete(data, 0);", "return;", "invalid_param_len:\nscsi_check_condition(VAR_0, SENSE_CODE(INVALID_PARAM_LEN));", "return;", "invalid_field:\nscsi_check_condition(VAR_0, SENSE_CODE(INVALID_FIELD));", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 73 ], [ 75 ], [ 77 ], [ 81, 83 ], [ 85 ], [ 89, 91 ], [ 93 ] ]
14,798
int bdrv_is_encrypted(BlockDriverState *bs) { if (bs->backing_hd && bs->backing_hd->encrypted) return 1; return bs->encrypted; }
false
qemu
61007b316cd71ee7333ff7a0a749a8949527575f
int bdrv_is_encrypted(BlockDriverState *bs) { if (bs->backing_hd && bs->backing_hd->encrypted) return 1; return bs->encrypted; }
{ "code": [], "line_no": [] }
int FUNC_0(BlockDriverState *VAR_0) { if (VAR_0->backing_hd && VAR_0->backing_hd->encrypted) return 1; return VAR_0->encrypted; }
[ "int FUNC_0(BlockDriverState *VAR_0)\n{", "if (VAR_0->backing_hd && VAR_0->backing_hd->encrypted)\nreturn 1;", "return VAR_0->encrypted;", "}" ]
[ 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5, 7 ], [ 9 ], [ 11 ] ]
14,799
void eth_get_protocols(const struct iovec *iov, int iovcnt, bool *isip4, bool *isip6, bool *isudp, bool *istcp, size_t *l3hdr_off, size_t *l4hdr_off, size_t *l5hdr_off, eth_ip6_hdr_info *ip6hdr_info, eth_ip4_hdr_info *ip4hdr_info, eth_l4_hdr_info *l4hdr_info) { int proto; bool fragment = false; size_t l2hdr_len = eth_get_l2_hdr_length_iov(iov, iovcnt); size_t input_size = iov_size(iov, iovcnt); size_t copied; *isip4 = *isip6 = *isudp = *istcp = false; proto = eth_get_l3_proto(iov, iovcnt, l2hdr_len); *l3hdr_off = l2hdr_len; if (proto == ETH_P_IP) { struct ip_header *iphdr = &ip4hdr_info->ip4_hdr; if (input_size < l2hdr_len) { return; } copied = iov_to_buf(iov, iovcnt, l2hdr_len, iphdr, sizeof(*iphdr)); *isip4 = true; if (copied < sizeof(*iphdr)) { return; } if (IP_HEADER_VERSION(iphdr) == IP_HEADER_VERSION_4) { if (iphdr->ip_p == IP_PROTO_TCP) { *istcp = true; } else if (iphdr->ip_p == IP_PROTO_UDP) { *isudp = true; } } ip4hdr_info->fragment = IP4_IS_FRAGMENT(iphdr); *l4hdr_off = l2hdr_len + IP_HDR_GET_LEN(iphdr); fragment = ip4hdr_info->fragment; } else if (proto == ETH_P_IPV6) { *isip6 = true; if (eth_parse_ipv6_hdr(iov, iovcnt, l2hdr_len, ip6hdr_info)) { if (ip6hdr_info->l4proto == IP_PROTO_TCP) { *istcp = true; } else if (ip6hdr_info->l4proto == IP_PROTO_UDP) { *isudp = true; } } else { return; } *l4hdr_off = l2hdr_len + ip6hdr_info->full_hdr_len; fragment = ip6hdr_info->fragment; } if (!fragment) { if (*istcp) { *istcp = _eth_copy_chunk(input_size, iov, iovcnt, *l4hdr_off, sizeof(l4hdr_info->hdr.tcp), &l4hdr_info->hdr.tcp); if (istcp) { *l5hdr_off = *l4hdr_off + TCP_HEADER_DATA_OFFSET(&l4hdr_info->hdr.tcp); l4hdr_info->has_tcp_data = _eth_tcp_has_data(proto == ETH_P_IP, &ip4hdr_info->ip4_hdr, &ip6hdr_info->ip6_hdr, *l4hdr_off - *l3hdr_off, &l4hdr_info->hdr.tcp); } } else if (*isudp) { *isudp = _eth_copy_chunk(input_size, iov, iovcnt, *l4hdr_off, sizeof(l4hdr_info->hdr.udp), &l4hdr_info->hdr.udp); *l5hdr_off = *l4hdr_off + sizeof(l4hdr_info->hdr.udp); } } }
false
qemu
2c5e564f4d8309ee0f47029ab461c4c4459f43c4
void eth_get_protocols(const struct iovec *iov, int iovcnt, bool *isip4, bool *isip6, bool *isudp, bool *istcp, size_t *l3hdr_off, size_t *l4hdr_off, size_t *l5hdr_off, eth_ip6_hdr_info *ip6hdr_info, eth_ip4_hdr_info *ip4hdr_info, eth_l4_hdr_info *l4hdr_info) { int proto; bool fragment = false; size_t l2hdr_len = eth_get_l2_hdr_length_iov(iov, iovcnt); size_t input_size = iov_size(iov, iovcnt); size_t copied; *isip4 = *isip6 = *isudp = *istcp = false; proto = eth_get_l3_proto(iov, iovcnt, l2hdr_len); *l3hdr_off = l2hdr_len; if (proto == ETH_P_IP) { struct ip_header *iphdr = &ip4hdr_info->ip4_hdr; if (input_size < l2hdr_len) { return; } copied = iov_to_buf(iov, iovcnt, l2hdr_len, iphdr, sizeof(*iphdr)); *isip4 = true; if (copied < sizeof(*iphdr)) { return; } if (IP_HEADER_VERSION(iphdr) == IP_HEADER_VERSION_4) { if (iphdr->ip_p == IP_PROTO_TCP) { *istcp = true; } else if (iphdr->ip_p == IP_PROTO_UDP) { *isudp = true; } } ip4hdr_info->fragment = IP4_IS_FRAGMENT(iphdr); *l4hdr_off = l2hdr_len + IP_HDR_GET_LEN(iphdr); fragment = ip4hdr_info->fragment; } else if (proto == ETH_P_IPV6) { *isip6 = true; if (eth_parse_ipv6_hdr(iov, iovcnt, l2hdr_len, ip6hdr_info)) { if (ip6hdr_info->l4proto == IP_PROTO_TCP) { *istcp = true; } else if (ip6hdr_info->l4proto == IP_PROTO_UDP) { *isudp = true; } } else { return; } *l4hdr_off = l2hdr_len + ip6hdr_info->full_hdr_len; fragment = ip6hdr_info->fragment; } if (!fragment) { if (*istcp) { *istcp = _eth_copy_chunk(input_size, iov, iovcnt, *l4hdr_off, sizeof(l4hdr_info->hdr.tcp), &l4hdr_info->hdr.tcp); if (istcp) { *l5hdr_off = *l4hdr_off + TCP_HEADER_DATA_OFFSET(&l4hdr_info->hdr.tcp); l4hdr_info->has_tcp_data = _eth_tcp_has_data(proto == ETH_P_IP, &ip4hdr_info->ip4_hdr, &ip6hdr_info->ip6_hdr, *l4hdr_off - *l3hdr_off, &l4hdr_info->hdr.tcp); } } else if (*isudp) { *isudp = _eth_copy_chunk(input_size, iov, iovcnt, *l4hdr_off, sizeof(l4hdr_info->hdr.udp), &l4hdr_info->hdr.udp); *l5hdr_off = *l4hdr_off + sizeof(l4hdr_info->hdr.udp); } } }
{ "code": [], "line_no": [] }
void FUNC_0(const struct iovec *VAR_0, int VAR_1, bool *VAR_2, bool *VAR_3, bool *VAR_4, bool *VAR_5, size_t *VAR_6, size_t *VAR_7, size_t *VAR_8, eth_ip6_hdr_info *VAR_9, eth_ip4_hdr_info *VAR_10, eth_l4_hdr_info *VAR_11) { int VAR_12; bool fragment = false; size_t l2hdr_len = eth_get_l2_hdr_length_iov(VAR_0, VAR_1); size_t input_size = iov_size(VAR_0, VAR_1); size_t copied; *VAR_2 = *VAR_3 = *VAR_4 = *VAR_5 = false; VAR_12 = eth_get_l3_proto(VAR_0, VAR_1, l2hdr_len); *VAR_6 = l2hdr_len; if (VAR_12 == ETH_P_IP) { struct ip_header *VAR_13 = &VAR_10->ip4_hdr; if (input_size < l2hdr_len) { return; } copied = iov_to_buf(VAR_0, VAR_1, l2hdr_len, VAR_13, sizeof(*VAR_13)); *VAR_2 = true; if (copied < sizeof(*VAR_13)) { return; } if (IP_HEADER_VERSION(VAR_13) == IP_HEADER_VERSION_4) { if (VAR_13->ip_p == IP_PROTO_TCP) { *VAR_5 = true; } else if (VAR_13->ip_p == IP_PROTO_UDP) { *VAR_4 = true; } } VAR_10->fragment = IP4_IS_FRAGMENT(VAR_13); *VAR_7 = l2hdr_len + IP_HDR_GET_LEN(VAR_13); fragment = VAR_10->fragment; } else if (VAR_12 == ETH_P_IPV6) { *VAR_3 = true; if (eth_parse_ipv6_hdr(VAR_0, VAR_1, l2hdr_len, VAR_9)) { if (VAR_9->l4proto == IP_PROTO_TCP) { *VAR_5 = true; } else if (VAR_9->l4proto == IP_PROTO_UDP) { *VAR_4 = true; } } else { return; } *VAR_7 = l2hdr_len + VAR_9->full_hdr_len; fragment = VAR_9->fragment; } if (!fragment) { if (*VAR_5) { *VAR_5 = _eth_copy_chunk(input_size, VAR_0, VAR_1, *VAR_7, sizeof(VAR_11->hdr.tcp), &VAR_11->hdr.tcp); if (VAR_5) { *VAR_8 = *VAR_7 + TCP_HEADER_DATA_OFFSET(&VAR_11->hdr.tcp); VAR_11->has_tcp_data = _eth_tcp_has_data(VAR_12 == ETH_P_IP, &VAR_10->ip4_hdr, &VAR_9->ip6_hdr, *VAR_7 - *VAR_6, &VAR_11->hdr.tcp); } } else if (*VAR_4) { *VAR_4 = _eth_copy_chunk(input_size, VAR_0, VAR_1, *VAR_7, sizeof(VAR_11->hdr.udp), &VAR_11->hdr.udp); *VAR_8 = *VAR_7 + sizeof(VAR_11->hdr.udp); } } }
[ "void FUNC_0(const struct iovec *VAR_0, int VAR_1,\nbool *VAR_2, bool *VAR_3,\nbool *VAR_4, bool *VAR_5,\nsize_t *VAR_6,\nsize_t *VAR_7,\nsize_t *VAR_8,\neth_ip6_hdr_info *VAR_9,\neth_ip4_hdr_info *VAR_10,\neth_l4_hdr_info *VAR_11)\n{", "int VAR_12;", "bool fragment = false;", "size_t l2hdr_len = eth_get_l2_hdr_length_iov(VAR_0, VAR_1);", "size_t input_size = iov_size(VAR_0, VAR_1);", "size_t copied;", "*VAR_2 = *VAR_3 = *VAR_4 = *VAR_5 = false;", "VAR_12 = eth_get_l3_proto(VAR_0, VAR_1, l2hdr_len);", "*VAR_6 = l2hdr_len;", "if (VAR_12 == ETH_P_IP) {", "struct ip_header *VAR_13 = &VAR_10->ip4_hdr;", "if (input_size < l2hdr_len) {", "return;", "}", "copied = iov_to_buf(VAR_0, VAR_1, l2hdr_len, VAR_13, sizeof(*VAR_13));", "*VAR_2 = true;", "if (copied < sizeof(*VAR_13)) {", "return;", "}", "if (IP_HEADER_VERSION(VAR_13) == IP_HEADER_VERSION_4) {", "if (VAR_13->ip_p == IP_PROTO_TCP) {", "*VAR_5 = true;", "} else if (VAR_13->ip_p == IP_PROTO_UDP) {", "*VAR_4 = true;", "}", "}", "VAR_10->fragment = IP4_IS_FRAGMENT(VAR_13);", "*VAR_7 = l2hdr_len + IP_HDR_GET_LEN(VAR_13);", "fragment = VAR_10->fragment;", "} else if (VAR_12 == ETH_P_IPV6) {", "*VAR_3 = true;", "if (eth_parse_ipv6_hdr(VAR_0, VAR_1, l2hdr_len,\nVAR_9)) {", "if (VAR_9->l4proto == IP_PROTO_TCP) {", "*VAR_5 = true;", "} else if (VAR_9->l4proto == IP_PROTO_UDP) {", "*VAR_4 = true;", "}", "} else {", "return;", "}", "*VAR_7 = l2hdr_len + VAR_9->full_hdr_len;", "fragment = VAR_9->fragment;", "}", "if (!fragment) {", "if (*VAR_5) {", "*VAR_5 = _eth_copy_chunk(input_size,\nVAR_0, VAR_1,\n*VAR_7, sizeof(VAR_11->hdr.tcp),\n&VAR_11->hdr.tcp);", "if (VAR_5) {", "*VAR_8 = *VAR_7 +\nTCP_HEADER_DATA_OFFSET(&VAR_11->hdr.tcp);", "VAR_11->has_tcp_data =\n_eth_tcp_has_data(VAR_12 == ETH_P_IP,\n&VAR_10->ip4_hdr,\n&VAR_9->ip6_hdr,\n*VAR_7 - *VAR_6,\n&VAR_11->hdr.tcp);", "}", "} else if (*VAR_4) {", "*VAR_4 = _eth_copy_chunk(input_size,\nVAR_0, VAR_1,\n*VAR_7, sizeof(VAR_11->hdr.udp),\n&VAR_11->hdr.udp);", "*VAR_8 = *VAR_7 + sizeof(VAR_11->hdr.udp);", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 33 ], [ 37 ], [ 41 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ], [ 55 ], [ 59 ], [ 63 ], [ 67 ], [ 69 ], [ 71 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 91 ], [ 93 ], [ 97 ], [ 99 ], [ 103 ], [ 105, 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 127 ], [ 129 ], [ 131 ], [ 135 ], [ 137 ], [ 139, 141, 143, 145 ], [ 149 ], [ 151, 153 ], [ 157, 159, 161, 163, 165, 167 ], [ 169 ], [ 171 ], [ 173, 175, 177, 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ] ]
14,800
static void apic_bus_deliver(const uint32_t *deliver_bitmask, uint8_t delivery_mode, uint8_t vector_num, uint8_t polarity, uint8_t trigger_mode) { APICState *apic_iter; switch (delivery_mode) { case APIC_DM_LOWPRI: /* XXX: search for focus processor, arbitration */ { int i, d; d = -1; for(i = 0; i < MAX_APIC_WORDS; i++) { if (deliver_bitmask[i]) { d = i * 32 + ffs_bit(deliver_bitmask[i]); break; } } if (d >= 0) { apic_iter = local_apics[d]; if (apic_iter) { apic_set_irq(apic_iter, vector_num, trigger_mode); } } } return; case APIC_DM_FIXED: break; case APIC_DM_SMI: foreach_apic(apic_iter, deliver_bitmask, cpu_interrupt(apic_iter->cpu_env, CPU_INTERRUPT_SMI) ); return; case APIC_DM_NMI: foreach_apic(apic_iter, deliver_bitmask, cpu_interrupt(apic_iter->cpu_env, CPU_INTERRUPT_NMI) ); return; case APIC_DM_INIT: /* normal INIT IPI sent to processors */ foreach_apic(apic_iter, deliver_bitmask, apic_init_ipi(apic_iter) ); return; case APIC_DM_EXTINT: /* handled in I/O APIC code */ break; default: return; } foreach_apic(apic_iter, deliver_bitmask, apic_set_irq(apic_iter, vector_num, trigger_mode) ); }
false
qemu
b09ea7d55cfab5a75912bb56ed1fcd757604a759
static void apic_bus_deliver(const uint32_t *deliver_bitmask, uint8_t delivery_mode, uint8_t vector_num, uint8_t polarity, uint8_t trigger_mode) { APICState *apic_iter; switch (delivery_mode) { case APIC_DM_LOWPRI: { int i, d; d = -1; for(i = 0; i < MAX_APIC_WORDS; i++) { if (deliver_bitmask[i]) { d = i * 32 + ffs_bit(deliver_bitmask[i]); break; } } if (d >= 0) { apic_iter = local_apics[d]; if (apic_iter) { apic_set_irq(apic_iter, vector_num, trigger_mode); } } } return; case APIC_DM_FIXED: break; case APIC_DM_SMI: foreach_apic(apic_iter, deliver_bitmask, cpu_interrupt(apic_iter->cpu_env, CPU_INTERRUPT_SMI) ); return; case APIC_DM_NMI: foreach_apic(apic_iter, deliver_bitmask, cpu_interrupt(apic_iter->cpu_env, CPU_INTERRUPT_NMI) ); return; case APIC_DM_INIT: foreach_apic(apic_iter, deliver_bitmask, apic_init_ipi(apic_iter) ); return; case APIC_DM_EXTINT: break; default: return; } foreach_apic(apic_iter, deliver_bitmask, apic_set_irq(apic_iter, vector_num, trigger_mode) ); }
{ "code": [], "line_no": [] }
static void FUNC_0(const uint32_t *VAR_0, uint8_t VAR_1, uint8_t VAR_2, uint8_t VAR_3, uint8_t VAR_4) { APICState *apic_iter; switch (VAR_1) { case APIC_DM_LOWPRI: { int VAR_5, VAR_6; VAR_6 = -1; for(VAR_5 = 0; VAR_5 < MAX_APIC_WORDS; VAR_5++) { if (VAR_0[VAR_5]) { VAR_6 = VAR_5 * 32 + ffs_bit(VAR_0[VAR_5]); break; } } if (VAR_6 >= 0) { apic_iter = local_apics[VAR_6]; if (apic_iter) { apic_set_irq(apic_iter, VAR_2, VAR_4); } } } return; case APIC_DM_FIXED: break; case APIC_DM_SMI: foreach_apic(apic_iter, VAR_0, cpu_interrupt(apic_iter->cpu_env, CPU_INTERRUPT_SMI) ); return; case APIC_DM_NMI: foreach_apic(apic_iter, VAR_0, cpu_interrupt(apic_iter->cpu_env, CPU_INTERRUPT_NMI) ); return; case APIC_DM_INIT: foreach_apic(apic_iter, VAR_0, apic_init_ipi(apic_iter) ); return; case APIC_DM_EXTINT: break; default: return; } foreach_apic(apic_iter, VAR_0, apic_set_irq(apic_iter, VAR_2, VAR_4) ); }
[ "static void FUNC_0(const uint32_t *VAR_0,\nuint8_t VAR_1,\nuint8_t VAR_2, uint8_t VAR_3,\nuint8_t VAR_4)\n{", "APICState *apic_iter;", "switch (VAR_1) {", "case APIC_DM_LOWPRI:\n{", "int VAR_5, VAR_6;", "VAR_6 = -1;", "for(VAR_5 = 0; VAR_5 < MAX_APIC_WORDS; VAR_5++) {", "if (VAR_0[VAR_5]) {", "VAR_6 = VAR_5 * 32 + ffs_bit(VAR_0[VAR_5]);", "break;", "}", "}", "if (VAR_6 >= 0) {", "apic_iter = local_apics[VAR_6];", "if (apic_iter) {", "apic_set_irq(apic_iter, VAR_2, VAR_4);", "}", "}", "}", "return;", "case APIC_DM_FIXED:\nbreak;", "case APIC_DM_SMI:\nforeach_apic(apic_iter, VAR_0,\ncpu_interrupt(apic_iter->cpu_env, CPU_INTERRUPT_SMI) );", "return;", "case APIC_DM_NMI:\nforeach_apic(apic_iter, VAR_0,\ncpu_interrupt(apic_iter->cpu_env, CPU_INTERRUPT_NMI) );", "return;", "case APIC_DM_INIT:\nforeach_apic(apic_iter, VAR_0,\napic_init_ipi(apic_iter) );", "return;", "case APIC_DM_EXTINT:\nbreak;", "default:\nreturn;", "}", "foreach_apic(apic_iter, VAR_0,\napic_set_irq(apic_iter, VAR_2, 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 ]
[ [ 1, 3, 5, 7, 9 ], [ 11 ], [ 15 ], [ 17, 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 57, 59 ], [ 63, 65, 67 ], [ 69 ], [ 73, 75, 77 ], [ 79 ], [ 83, 87, 89 ], [ 91 ], [ 95, 99 ], [ 103, 105 ], [ 107 ], [ 111, 113 ], [ 115 ] ]
14,802
static void print_sdp(void) { char sdp[16384]; int i; AVFormatContext **avc = av_malloc(sizeof(*avc) * nb_output_files); if (!avc) exit_program(1); for (i = 0; i < nb_output_files; i++) avc[i] = output_files[i]->ctx; av_sdp_create(avc, nb_output_files, sdp, sizeof(sdp)); printf("SDP:\n%s\n", sdp); fflush(stdout); av_freep(&avc); }
false
FFmpeg
1c169782cae6c5c430ff62e7d7272dc9d0e8d527
static void print_sdp(void) { char sdp[16384]; int i; AVFormatContext **avc = av_malloc(sizeof(*avc) * nb_output_files); if (!avc) exit_program(1); for (i = 0; i < nb_output_files; i++) avc[i] = output_files[i]->ctx; av_sdp_create(avc, nb_output_files, sdp, sizeof(sdp)); printf("SDP:\n%s\n", sdp); fflush(stdout); av_freep(&avc); }
{ "code": [], "line_no": [] }
static void FUNC_0(void) { char VAR_0[16384]; int VAR_1; AVFormatContext **avc = av_malloc(sizeof(*avc) * nb_output_files); if (!avc) exit_program(1); for (VAR_1 = 0; VAR_1 < nb_output_files; VAR_1++) avc[VAR_1] = output_files[VAR_1]->ctx; av_sdp_create(avc, nb_output_files, VAR_0, sizeof(VAR_0)); printf("SDP:\n%s\n", VAR_0); fflush(stdout); av_freep(&avc); }
[ "static void FUNC_0(void)\n{", "char VAR_0[16384];", "int VAR_1;", "AVFormatContext **avc = av_malloc(sizeof(*avc) * nb_output_files);", "if (!avc)\nexit_program(1);", "for (VAR_1 = 0; VAR_1 < nb_output_files; VAR_1++)", "avc[VAR_1] = output_files[VAR_1]->ctx;", "av_sdp_create(avc, nb_output_files, VAR_0, sizeof(VAR_0));", "printf(\"SDP:\\n%s\\n\", VAR_0);", "fflush(stdout);", "av_freep(&avc);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13, 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ] ]
14,803
void memory_region_iommu_replay(MemoryRegion *mr, Notifier *n, bool is_write) { hwaddr addr, granularity; IOMMUTLBEntry iotlb; granularity = memory_region_iommu_get_min_page_size(mr); for (addr = 0; addr < memory_region_size(mr); addr += granularity) { iotlb = mr->iommu_ops->translate(mr, addr, is_write); if (iotlb.perm != IOMMU_NONE) { n->notify(n, &iotlb); } /* if (2^64 - MR size) < granularity, it's possible to get an * infinite loop here. This should catch such a wraparound */ if ((addr + granularity) < addr) { break; } } }
false
qemu
cdb3081269347fd9271fd1b7a9df312e2953bdd9
void memory_region_iommu_replay(MemoryRegion *mr, Notifier *n, bool is_write) { hwaddr addr, granularity; IOMMUTLBEntry iotlb; granularity = memory_region_iommu_get_min_page_size(mr); for (addr = 0; addr < memory_region_size(mr); addr += granularity) { iotlb = mr->iommu_ops->translate(mr, addr, is_write); if (iotlb.perm != IOMMU_NONE) { n->notify(n, &iotlb); } if ((addr + granularity) < addr) { break; } } }
{ "code": [], "line_no": [] }
void FUNC_0(MemoryRegion *VAR_0, Notifier *VAR_1, bool VAR_2) { hwaddr addr, granularity; IOMMUTLBEntry iotlb; granularity = memory_region_iommu_get_min_page_size(VAR_0); for (addr = 0; addr < memory_region_size(VAR_0); addr += granularity) { iotlb = VAR_0->iommu_ops->translate(VAR_0, addr, VAR_2); if (iotlb.perm != IOMMU_NONE) { VAR_1->notify(VAR_1, &iotlb); } if ((addr + granularity) < addr) { break; } } }
[ "void FUNC_0(MemoryRegion *VAR_0, Notifier *VAR_1, bool VAR_2)\n{", "hwaddr addr, granularity;", "IOMMUTLBEntry iotlb;", "granularity = memory_region_iommu_get_min_page_size(VAR_0);", "for (addr = 0; addr < memory_region_size(VAR_0); addr += granularity) {", "iotlb = VAR_0->iommu_ops->translate(VAR_0, addr, VAR_2);", "if (iotlb.perm != IOMMU_NONE) {", "VAR_1->notify(VAR_1, &iotlb);", "}", "if ((addr + granularity) < addr) {", "break;", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ] ]
14,804
static void pic_write(void *opaque, target_phys_addr_t addr, uint64_t value, unsigned int size) { struct etrax_pic *fs = opaque; D(printf("%s addr=%x val=%x\n", __func__, addr, value)); if (addr == R_RW_MASK) { fs->regs[R_RW_MASK] = value; pic_update(fs); } }
false
qemu
a8170e5e97ad17ca169c64ba87ae2f53850dab4c
static void pic_write(void *opaque, target_phys_addr_t addr, uint64_t value, unsigned int size) { struct etrax_pic *fs = opaque; D(printf("%s addr=%x val=%x\n", __func__, addr, value)); if (addr == R_RW_MASK) { fs->regs[R_RW_MASK] = value; pic_update(fs); } }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0, target_phys_addr_t VAR_1, uint64_t VAR_2, unsigned int VAR_3) { struct etrax_pic *VAR_4 = VAR_0; D(printf("%s VAR_1=%x val=%x\n", __func__, VAR_1, VAR_2)); if (VAR_1 == R_RW_MASK) { VAR_4->regs[R_RW_MASK] = VAR_2; pic_update(VAR_4); } }
[ "static void FUNC_0(void *VAR_0, target_phys_addr_t VAR_1,\nuint64_t VAR_2, unsigned int VAR_3)\n{", "struct etrax_pic *VAR_4 = VAR_0;", "D(printf(\"%s VAR_1=%x val=%x\\n\", __func__, VAR_1, VAR_2));", "if (VAR_1 == R_RW_MASK) {", "VAR_4->regs[R_RW_MASK] = VAR_2;", "pic_update(VAR_4);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ] ]
14,805
static int pci_cmd646_ide_initfn(PCIDevice *dev) { PCIIDEState *d = DO_UPCAST(PCIIDEState, dev, dev); uint8_t *pci_conf = d->dev.config; qemu_irq *irq; int i; pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_CMD); pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_CMD_646); pci_conf[PCI_REVISION_ID] = 0x07; // IDE controller revision pci_conf[PCI_CLASS_PROG] = 0x8f; pci_config_set_class(pci_conf, PCI_CLASS_STORAGE_IDE); pci_conf[0x51] = 0x04; // enable IDE0 if (d->secondary) { /* XXX: if not enabled, really disable the seconday IDE controller */ pci_conf[0x51] |= 0x08; /* enable IDE1 */ } pci_register_bar(dev, 0, 0x8, PCI_BASE_ADDRESS_SPACE_IO, ide_map); pci_register_bar(dev, 1, 0x4, PCI_BASE_ADDRESS_SPACE_IO, ide_map); pci_register_bar(dev, 2, 0x8, PCI_BASE_ADDRESS_SPACE_IO, ide_map); pci_register_bar(dev, 3, 0x4, PCI_BASE_ADDRESS_SPACE_IO, ide_map); pci_register_bar(dev, 4, 0x10, PCI_BASE_ADDRESS_SPACE_IO, bmdma_map); /* TODO: RST# value should be 0 */ pci_conf[PCI_INTERRUPT_PIN] = 0x01; // interrupt on pin 1 irq = qemu_allocate_irqs(cmd646_set_irq, d, 2); for (i = 0; i < 2; i++) { ide_bus_new(&d->bus[i], &d->dev.qdev, i); ide_init2(&d->bus[i], irq[i]); bmdma_init(&d->bus[i], &d->bmdma[i]); d->bmdma[i].bus = &d->bus[i]; qemu_add_vm_change_state_handler(d->bus[i].dma->ops->restart_cb, &d->bmdma[i].dma); } vmstate_register(&dev->qdev, 0, &vmstate_ide_pci, d); qemu_register_reset(cmd646_reset, d); return 0; }
false
qemu
c04ca0756da8087e15579915d55fdca816c9ef4e
static int pci_cmd646_ide_initfn(PCIDevice *dev) { PCIIDEState *d = DO_UPCAST(PCIIDEState, dev, dev); uint8_t *pci_conf = d->dev.config; qemu_irq *irq; int i; pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_CMD); pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_CMD_646); pci_conf[PCI_REVISION_ID] = 0x07; pci_conf[PCI_CLASS_PROG] = 0x8f; pci_config_set_class(pci_conf, PCI_CLASS_STORAGE_IDE); pci_conf[0x51] = 0x04; if (d->secondary) { pci_conf[0x51] |= 0x08; } pci_register_bar(dev, 0, 0x8, PCI_BASE_ADDRESS_SPACE_IO, ide_map); pci_register_bar(dev, 1, 0x4, PCI_BASE_ADDRESS_SPACE_IO, ide_map); pci_register_bar(dev, 2, 0x8, PCI_BASE_ADDRESS_SPACE_IO, ide_map); pci_register_bar(dev, 3, 0x4, PCI_BASE_ADDRESS_SPACE_IO, ide_map); pci_register_bar(dev, 4, 0x10, PCI_BASE_ADDRESS_SPACE_IO, bmdma_map); pci_conf[PCI_INTERRUPT_PIN] = 0x01; irq = qemu_allocate_irqs(cmd646_set_irq, d, 2); for (i = 0; i < 2; i++) { ide_bus_new(&d->bus[i], &d->dev.qdev, i); ide_init2(&d->bus[i], irq[i]); bmdma_init(&d->bus[i], &d->bmdma[i]); d->bmdma[i].bus = &d->bus[i]; qemu_add_vm_change_state_handler(d->bus[i].dma->ops->restart_cb, &d->bmdma[i].dma); } vmstate_register(&dev->qdev, 0, &vmstate_ide_pci, d); qemu_register_reset(cmd646_reset, d); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(PCIDevice *VAR_0) { PCIIDEState *d = DO_UPCAST(PCIIDEState, VAR_0, VAR_0); uint8_t *pci_conf = d->VAR_0.config; qemu_irq *irq; int VAR_1; pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_CMD); pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_CMD_646); pci_conf[PCI_REVISION_ID] = 0x07; pci_conf[PCI_CLASS_PROG] = 0x8f; pci_config_set_class(pci_conf, PCI_CLASS_STORAGE_IDE); pci_conf[0x51] = 0x04; if (d->secondary) { pci_conf[0x51] |= 0x08; } pci_register_bar(VAR_0, 0, 0x8, PCI_BASE_ADDRESS_SPACE_IO, ide_map); pci_register_bar(VAR_0, 1, 0x4, PCI_BASE_ADDRESS_SPACE_IO, ide_map); pci_register_bar(VAR_0, 2, 0x8, PCI_BASE_ADDRESS_SPACE_IO, ide_map); pci_register_bar(VAR_0, 3, 0x4, PCI_BASE_ADDRESS_SPACE_IO, ide_map); pci_register_bar(VAR_0, 4, 0x10, PCI_BASE_ADDRESS_SPACE_IO, bmdma_map); pci_conf[PCI_INTERRUPT_PIN] = 0x01; irq = qemu_allocate_irqs(cmd646_set_irq, d, 2); for (VAR_1 = 0; VAR_1 < 2; VAR_1++) { ide_bus_new(&d->bus[VAR_1], &d->VAR_0.qdev, VAR_1); ide_init2(&d->bus[VAR_1], irq[VAR_1]); bmdma_init(&d->bus[VAR_1], &d->bmdma[VAR_1]); d->bmdma[VAR_1].bus = &d->bus[VAR_1]; qemu_add_vm_change_state_handler(d->bus[VAR_1].dma->ops->restart_cb, &d->bmdma[VAR_1].dma); } vmstate_register(&VAR_0->qdev, 0, &vmstate_ide_pci, d); qemu_register_reset(cmd646_reset, d); return 0; }
[ "static int FUNC_0(PCIDevice *VAR_0)\n{", "PCIIDEState *d = DO_UPCAST(PCIIDEState, VAR_0, VAR_0);", "uint8_t *pci_conf = d->VAR_0.config;", "qemu_irq *irq;", "int VAR_1;", "pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_CMD);", "pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_CMD_646);", "pci_conf[PCI_REVISION_ID] = 0x07;", "pci_conf[PCI_CLASS_PROG] = 0x8f;", "pci_config_set_class(pci_conf, PCI_CLASS_STORAGE_IDE);", "pci_conf[0x51] = 0x04;", "if (d->secondary) {", "pci_conf[0x51] |= 0x08;", "}", "pci_register_bar(VAR_0, 0, 0x8, PCI_BASE_ADDRESS_SPACE_IO, ide_map);", "pci_register_bar(VAR_0, 1, 0x4, PCI_BASE_ADDRESS_SPACE_IO, ide_map);", "pci_register_bar(VAR_0, 2, 0x8, PCI_BASE_ADDRESS_SPACE_IO, ide_map);", "pci_register_bar(VAR_0, 3, 0x4, PCI_BASE_ADDRESS_SPACE_IO, ide_map);", "pci_register_bar(VAR_0, 4, 0x10, PCI_BASE_ADDRESS_SPACE_IO, bmdma_map);", "pci_conf[PCI_INTERRUPT_PIN] = 0x01;", "irq = qemu_allocate_irqs(cmd646_set_irq, d, 2);", "for (VAR_1 = 0; VAR_1 < 2; VAR_1++) {", "ide_bus_new(&d->bus[VAR_1], &d->VAR_0.qdev, VAR_1);", "ide_init2(&d->bus[VAR_1], irq[VAR_1]);", "bmdma_init(&d->bus[VAR_1], &d->bmdma[VAR_1]);", "d->bmdma[VAR_1].bus = &d->bus[VAR_1];", "qemu_add_vm_change_state_handler(d->bus[VAR_1].dma->ops->restart_cb,\n&d->bmdma[VAR_1].dma);", "}", "vmstate_register(&VAR_0->qdev, 0, &vmstate_ide_pci, d);", "qemu_register_reset(cmd646_reset, d);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 27 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 57 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 71 ], [ 73 ], [ 75, 77 ], [ 79 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ] ]
14,806
uint8_t *smbios_get_table(size_t *length) { smbios_validate_table(); *length = smbios_entries_len; return smbios_entries; }
false
qemu
fc3b32958a80bca13309e2695de07b43dd788421
uint8_t *smbios_get_table(size_t *length) { smbios_validate_table(); *length = smbios_entries_len; return smbios_entries; }
{ "code": [], "line_no": [] }
uint8_t *FUNC_0(size_t *length) { smbios_validate_table(); *length = smbios_entries_len; return smbios_entries; }
[ "uint8_t *FUNC_0(size_t *length)\n{", "smbios_validate_table();", "*length = smbios_entries_len;", "return smbios_entries;", "}" ]
[ 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ] ]
14,807
int qemu_fsdev_add(QemuOpts *opts) { struct FsTypeListEntry *fsle; int i; if (qemu_opts_id(opts) == NULL) { fprintf(stderr, "fsdev: No id specified\n"); return -1; } for (i = 0; i < ARRAY_SIZE(FsTypes); i++) { if (strcmp(FsTypes[i].name, qemu_opt_get(opts, "fstype")) == 0) { break; } } if (i == ARRAY_SIZE(FsTypes)) { fprintf(stderr, "fsdev: fstype %s not found\n", qemu_opt_get(opts, "fstype")); return -1; } fsle = qemu_malloc(sizeof(*fsle)); fsle->fse.fsdev_id = qemu_strdup(qemu_opts_id(opts)); fsle->fse.path = qemu_strdup(qemu_opt_get(opts, "path")); fsle->fse.ops = FsTypes[i].ops; QTAILQ_INSERT_TAIL(&fstype_entries, fsle, next); return 0; }
false
qemu
9ce56db6f0de81fd81972029073ff8008830bc02
int qemu_fsdev_add(QemuOpts *opts) { struct FsTypeListEntry *fsle; int i; if (qemu_opts_id(opts) == NULL) { fprintf(stderr, "fsdev: No id specified\n"); return -1; } for (i = 0; i < ARRAY_SIZE(FsTypes); i++) { if (strcmp(FsTypes[i].name, qemu_opt_get(opts, "fstype")) == 0) { break; } } if (i == ARRAY_SIZE(FsTypes)) { fprintf(stderr, "fsdev: fstype %s not found\n", qemu_opt_get(opts, "fstype")); return -1; } fsle = qemu_malloc(sizeof(*fsle)); fsle->fse.fsdev_id = qemu_strdup(qemu_opts_id(opts)); fsle->fse.path = qemu_strdup(qemu_opt_get(opts, "path")); fsle->fse.ops = FsTypes[i].ops; QTAILQ_INSERT_TAIL(&fstype_entries, fsle, next); return 0; }
{ "code": [], "line_no": [] }
int FUNC_0(QemuOpts *VAR_0) { struct FsTypeListEntry *VAR_1; int VAR_2; if (qemu_opts_id(VAR_0) == NULL) { fprintf(stderr, "fsdev: No id specified\n"); return -1; } for (VAR_2 = 0; VAR_2 < ARRAY_SIZE(FsTypes); VAR_2++) { if (strcmp(FsTypes[VAR_2].name, qemu_opt_get(VAR_0, "fstype")) == 0) { break; } } if (VAR_2 == ARRAY_SIZE(FsTypes)) { fprintf(stderr, "fsdev: fstype %s not found\n", qemu_opt_get(VAR_0, "fstype")); return -1; } VAR_1 = qemu_malloc(sizeof(*VAR_1)); VAR_1->fse.fsdev_id = qemu_strdup(qemu_opts_id(VAR_0)); VAR_1->fse.path = qemu_strdup(qemu_opt_get(VAR_0, "path")); VAR_1->fse.ops = FsTypes[VAR_2].ops; QTAILQ_INSERT_TAIL(&fstype_entries, VAR_1, next); return 0; }
[ "int FUNC_0(QemuOpts *VAR_0)\n{", "struct FsTypeListEntry *VAR_1;", "int VAR_2;", "if (qemu_opts_id(VAR_0) == NULL) {", "fprintf(stderr, \"fsdev: No id specified\\n\");", "return -1;", "}", "for (VAR_2 = 0; VAR_2 < ARRAY_SIZE(FsTypes); VAR_2++) {", "if (strcmp(FsTypes[VAR_2].name, qemu_opt_get(VAR_0, \"fstype\")) == 0) {", "break;", "}", "}", "if (VAR_2 == ARRAY_SIZE(FsTypes)) {", "fprintf(stderr, \"fsdev: fstype %s not found\\n\",\nqemu_opt_get(VAR_0, \"fstype\"));", "return -1;", "}", "VAR_1 = qemu_malloc(sizeof(*VAR_1));", "VAR_1->fse.fsdev_id = qemu_strdup(qemu_opts_id(VAR_0));", "VAR_1->fse.path = qemu_strdup(qemu_opt_get(VAR_0, \"path\"));", "VAR_1->fse.ops = FsTypes[VAR_2].ops;", "QTAILQ_INSERT_TAIL(&fstype_entries, VAR_1, next);", "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 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35, 37 ], [ 39 ], [ 41 ], [ 45 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ], [ 63 ] ]
14,809
build_madt(GArray *table_data, GArray *linker, VirtGuestInfo *guest_info, VirtAcpiCpuInfo *cpuinfo) { int madt_start = table_data->len; const MemMapEntry *memmap = guest_info->memmap; const int *irqmap = guest_info->irqmap; AcpiMultipleApicTable *madt; AcpiMadtGenericDistributor *gicd; AcpiMadtGenericMsiFrame *gic_msi; int i; madt = acpi_data_push(table_data, sizeof *madt); for (i = 0; i < guest_info->smp_cpus; i++) { AcpiMadtGenericInterrupt *gicc = acpi_data_push(table_data, sizeof *gicc); gicc->type = ACPI_APIC_GENERIC_INTERRUPT; gicc->length = sizeof(*gicc); gicc->base_address = memmap[VIRT_GIC_CPU].base; gicc->cpu_interface_number = i; gicc->arm_mpidr = i; gicc->uid = i; if (test_bit(i, cpuinfo->found_cpus)) { gicc->flags = cpu_to_le32(ACPI_GICC_ENABLED); } } gicd = acpi_data_push(table_data, sizeof *gicd); gicd->type = ACPI_APIC_GENERIC_DISTRIBUTOR; gicd->length = sizeof(*gicd); gicd->base_address = memmap[VIRT_GIC_DIST].base; gic_msi = acpi_data_push(table_data, sizeof *gic_msi); gic_msi->type = ACPI_APIC_GENERIC_MSI_FRAME; gic_msi->length = sizeof(*gic_msi); gic_msi->gic_msi_frame_id = 0; gic_msi->base_address = cpu_to_le64(memmap[VIRT_GIC_V2M].base); gic_msi->flags = cpu_to_le32(1); gic_msi->spi_count = cpu_to_le16(NUM_GICV2M_SPIS); gic_msi->spi_base = cpu_to_le16(irqmap[VIRT_GIC_V2M] + ARM_SPI_BASE); build_header(linker, table_data, (void *)(table_data->data + madt_start), "APIC", table_data->len - madt_start, 3); }
false
qemu
b92ad3949bc9cacd1652b4e07e7f6003b9e512af
build_madt(GArray *table_data, GArray *linker, VirtGuestInfo *guest_info, VirtAcpiCpuInfo *cpuinfo) { int madt_start = table_data->len; const MemMapEntry *memmap = guest_info->memmap; const int *irqmap = guest_info->irqmap; AcpiMultipleApicTable *madt; AcpiMadtGenericDistributor *gicd; AcpiMadtGenericMsiFrame *gic_msi; int i; madt = acpi_data_push(table_data, sizeof *madt); for (i = 0; i < guest_info->smp_cpus; i++) { AcpiMadtGenericInterrupt *gicc = acpi_data_push(table_data, sizeof *gicc); gicc->type = ACPI_APIC_GENERIC_INTERRUPT; gicc->length = sizeof(*gicc); gicc->base_address = memmap[VIRT_GIC_CPU].base; gicc->cpu_interface_number = i; gicc->arm_mpidr = i; gicc->uid = i; if (test_bit(i, cpuinfo->found_cpus)) { gicc->flags = cpu_to_le32(ACPI_GICC_ENABLED); } } gicd = acpi_data_push(table_data, sizeof *gicd); gicd->type = ACPI_APIC_GENERIC_DISTRIBUTOR; gicd->length = sizeof(*gicd); gicd->base_address = memmap[VIRT_GIC_DIST].base; gic_msi = acpi_data_push(table_data, sizeof *gic_msi); gic_msi->type = ACPI_APIC_GENERIC_MSI_FRAME; gic_msi->length = sizeof(*gic_msi); gic_msi->gic_msi_frame_id = 0; gic_msi->base_address = cpu_to_le64(memmap[VIRT_GIC_V2M].base); gic_msi->flags = cpu_to_le32(1); gic_msi->spi_count = cpu_to_le16(NUM_GICV2M_SPIS); gic_msi->spi_base = cpu_to_le16(irqmap[VIRT_GIC_V2M] + ARM_SPI_BASE); build_header(linker, table_data, (void *)(table_data->data + madt_start), "APIC", table_data->len - madt_start, 3); }
{ "code": [], "line_no": [] }
FUNC_0(GArray *VAR_0, GArray *VAR_1, VirtGuestInfo *VAR_2, VirtAcpiCpuInfo *VAR_3) { int VAR_4 = VAR_0->len; const MemMapEntry *VAR_5 = VAR_2->VAR_5; const int *VAR_6 = VAR_2->VAR_6; AcpiMultipleApicTable *madt; AcpiMadtGenericDistributor *gicd; AcpiMadtGenericMsiFrame *gic_msi; int VAR_7; madt = acpi_data_push(VAR_0, sizeof *madt); for (VAR_7 = 0; VAR_7 < VAR_2->smp_cpus; VAR_7++) { AcpiMadtGenericInterrupt *gicc = acpi_data_push(VAR_0, sizeof *gicc); gicc->type = ACPI_APIC_GENERIC_INTERRUPT; gicc->length = sizeof(*gicc); gicc->base_address = VAR_5[VIRT_GIC_CPU].base; gicc->cpu_interface_number = VAR_7; gicc->arm_mpidr = VAR_7; gicc->uid = VAR_7; if (test_bit(VAR_7, VAR_3->found_cpus)) { gicc->flags = cpu_to_le32(ACPI_GICC_ENABLED); } } gicd = acpi_data_push(VAR_0, sizeof *gicd); gicd->type = ACPI_APIC_GENERIC_DISTRIBUTOR; gicd->length = sizeof(*gicd); gicd->base_address = VAR_5[VIRT_GIC_DIST].base; gic_msi = acpi_data_push(VAR_0, sizeof *gic_msi); gic_msi->type = ACPI_APIC_GENERIC_MSI_FRAME; gic_msi->length = sizeof(*gic_msi); gic_msi->gic_msi_frame_id = 0; gic_msi->base_address = cpu_to_le64(VAR_5[VIRT_GIC_V2M].base); gic_msi->flags = cpu_to_le32(1); gic_msi->spi_count = cpu_to_le16(NUM_GICV2M_SPIS); gic_msi->spi_base = cpu_to_le16(VAR_6[VIRT_GIC_V2M] + ARM_SPI_BASE); build_header(VAR_1, VAR_0, (void *)(VAR_0->data + VAR_4), "APIC", VAR_0->len - VAR_4, 3); }
[ "FUNC_0(GArray *VAR_0, GArray *VAR_1, VirtGuestInfo *VAR_2,\nVirtAcpiCpuInfo *VAR_3)\n{", "int VAR_4 = VAR_0->len;", "const MemMapEntry *VAR_5 = VAR_2->VAR_5;", "const int *VAR_6 = VAR_2->VAR_6;", "AcpiMultipleApicTable *madt;", "AcpiMadtGenericDistributor *gicd;", "AcpiMadtGenericMsiFrame *gic_msi;", "int VAR_7;", "madt = acpi_data_push(VAR_0, sizeof *madt);", "for (VAR_7 = 0; VAR_7 < VAR_2->smp_cpus; VAR_7++) {", "AcpiMadtGenericInterrupt *gicc = acpi_data_push(VAR_0,\nsizeof *gicc);", "gicc->type = ACPI_APIC_GENERIC_INTERRUPT;", "gicc->length = sizeof(*gicc);", "gicc->base_address = VAR_5[VIRT_GIC_CPU].base;", "gicc->cpu_interface_number = VAR_7;", "gicc->arm_mpidr = VAR_7;", "gicc->uid = VAR_7;", "if (test_bit(VAR_7, VAR_3->found_cpus)) {", "gicc->flags = cpu_to_le32(ACPI_GICC_ENABLED);", "}", "}", "gicd = acpi_data_push(VAR_0, sizeof *gicd);", "gicd->type = ACPI_APIC_GENERIC_DISTRIBUTOR;", "gicd->length = sizeof(*gicd);", "gicd->base_address = VAR_5[VIRT_GIC_DIST].base;", "gic_msi = acpi_data_push(VAR_0, sizeof *gic_msi);", "gic_msi->type = ACPI_APIC_GENERIC_MSI_FRAME;", "gic_msi->length = sizeof(*gic_msi);", "gic_msi->gic_msi_frame_id = 0;", "gic_msi->base_address = cpu_to_le64(VAR_5[VIRT_GIC_V2M].base);", "gic_msi->flags = cpu_to_le32(1);", "gic_msi->spi_count = cpu_to_le16(NUM_GICV2M_SPIS);", "gic_msi->spi_base = cpu_to_le16(VAR_6[VIRT_GIC_V2M] + ARM_SPI_BASE);", "build_header(VAR_1, VAR_0,\n(void *)(VAR_0->data + VAR_4), \"APIC\",\nVAR_0->len - VAR_4, 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 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 27 ], [ 29, 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 83, 85, 87 ], [ 89 ] ]