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
7,463
QEMUClock *qemu_clock_ptr(QEMUClockType type) { return &qemu_clocks[type]; }
false
qemu
b4049b74b97f30fe944c63b5f158ec9e87bd2593
QEMUClock *qemu_clock_ptr(QEMUClockType type) { return &qemu_clocks[type]; }
{ "code": [], "line_no": [] }
QEMUClock *FUNC_0(QEMUClockType type) { return &qemu_clocks[type]; }
[ "QEMUClock *FUNC_0(QEMUClockType type)\n{", "return &qemu_clocks[type];", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
7,464
int do_subchannel_work_passthrough(SubchDev *sch) { int ret; SCSW *s = &sch->curr_status.scsw; if (s->ctrl & SCSW_FCTL_CLEAR_FUNC) { /* TODO: Clear handling */ sch_handle_clear_func(sch); ret = 0; } else if (s->ctrl & SCSW_FCTL_HALT_FUNC) { /* TODO: Halt handling */ sch_handle_halt_func(sch); ret = 0; } else if (s->ctrl & SCSW_FCTL_START_FUNC) { ret = sch_handle_start_func_passthrough(sch); } else { /* Cannot happen. */ return -ENODEV; } return ret; }
false
qemu
9ea63c05d90ba85d819f9b2472ce6dfba7a403b4
int do_subchannel_work_passthrough(SubchDev *sch) { int ret; SCSW *s = &sch->curr_status.scsw; if (s->ctrl & SCSW_FCTL_CLEAR_FUNC) { sch_handle_clear_func(sch); ret = 0; } else if (s->ctrl & SCSW_FCTL_HALT_FUNC) { sch_handle_halt_func(sch); ret = 0; } else if (s->ctrl & SCSW_FCTL_START_FUNC) { ret = sch_handle_start_func_passthrough(sch); } else { return -ENODEV; } return ret; }
{ "code": [], "line_no": [] }
int FUNC_0(SubchDev *VAR_0) { int VAR_1; SCSW *s = &VAR_0->curr_status.scsw; if (s->ctrl & SCSW_FCTL_CLEAR_FUNC) { sch_handle_clear_func(VAR_0); VAR_1 = 0; } else if (s->ctrl & SCSW_FCTL_HALT_FUNC) { sch_handle_halt_func(VAR_0); VAR_1 = 0; } else if (s->ctrl & SCSW_FCTL_START_FUNC) { VAR_1 = sch_handle_start_func_passthrough(VAR_0); } else { return -ENODEV; } return VAR_1; }
[ "int FUNC_0(SubchDev *VAR_0)\n{", "int VAR_1;", "SCSW *s = &VAR_0->curr_status.scsw;", "if (s->ctrl & SCSW_FCTL_CLEAR_FUNC) {", "sch_handle_clear_func(VAR_0);", "VAR_1 = 0;", "} else if (s->ctrl & SCSW_FCTL_HALT_FUNC) {", "sch_handle_halt_func(VAR_0);", "VAR_1 = 0;", "} else if (s->ctrl & SCSW_FCTL_START_FUNC) {", "VAR_1 = sch_handle_start_func_passthrough(VAR_0);", "} else {", "return -ENODEV;", "}", "return VAR_1;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ] ]
7,465
void ff_h264_v_lpf_luma_inter_msa(uint8_t *data, int img_width, int alpha, int beta, int8_t *tc) { uint8_t bs0 = 1; uint8_t bs1 = 1; uint8_t bs2 = 1; uint8_t bs3 = 1; if (tc[0] < 0) bs0 = 0; if (tc[1] < 0) bs1 = 0; if (tc[2] < 0) bs2 = 0; if (tc[3] < 0) bs3 = 0; avc_loopfilter_luma_inter_edge_hor_msa(data, bs0, bs1, bs2, bs3, tc[0], tc[1], tc[2], tc[3], alpha, beta, img_width); }
false
FFmpeg
bcd7bf7eeb09a395cc01698842d1b8be9af483fc
void ff_h264_v_lpf_luma_inter_msa(uint8_t *data, int img_width, int alpha, int beta, int8_t *tc) { uint8_t bs0 = 1; uint8_t bs1 = 1; uint8_t bs2 = 1; uint8_t bs3 = 1; if (tc[0] < 0) bs0 = 0; if (tc[1] < 0) bs1 = 0; if (tc[2] < 0) bs2 = 0; if (tc[3] < 0) bs3 = 0; avc_loopfilter_luma_inter_edge_hor_msa(data, bs0, bs1, bs2, bs3, tc[0], tc[1], tc[2], tc[3], alpha, beta, img_width); }
{ "code": [], "line_no": [] }
void FUNC_0(uint8_t *VAR_0, int VAR_1, int VAR_2, int VAR_3, int8_t *VAR_4) { uint8_t bs0 = 1; uint8_t bs1 = 1; uint8_t bs2 = 1; uint8_t bs3 = 1; if (VAR_4[0] < 0) bs0 = 0; if (VAR_4[1] < 0) bs1 = 0; if (VAR_4[2] < 0) bs2 = 0; if (VAR_4[3] < 0) bs3 = 0; avc_loopfilter_luma_inter_edge_hor_msa(VAR_0, bs0, bs1, bs2, bs3, VAR_4[0], VAR_4[1], VAR_4[2], VAR_4[3], VAR_2, VAR_3, VAR_1); }
[ "void FUNC_0(uint8_t *VAR_0, int VAR_1,\nint VAR_2, int VAR_3, int8_t *VAR_4)\n{", "uint8_t bs0 = 1;", "uint8_t bs1 = 1;", "uint8_t bs2 = 1;", "uint8_t bs3 = 1;", "if (VAR_4[0] < 0)\nbs0 = 0;", "if (VAR_4[1] < 0)\nbs1 = 0;", "if (VAR_4[2] < 0)\nbs2 = 0;", "if (VAR_4[3] < 0)\nbs3 = 0;", "avc_loopfilter_luma_inter_edge_hor_msa(VAR_0,\nbs0, bs1, bs2, bs3,\nVAR_4[0], VAR_4[1], VAR_4[2], VAR_4[3],\nVAR_2, VAR_3, VAR_1);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19, 21 ], [ 23, 25 ], [ 27, 29 ], [ 31, 33 ], [ 37, 39, 41, 43 ], [ 45 ] ]
7,466
static av_always_inline void FUNC(row_fdct)(int16_t *data) { int tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7; int tmp10, tmp11, tmp12, tmp13; int z1, z2, z3, z4, z5; int16_t *dataptr; int ctr; /* Pass 1: process rows. */ /* Note results are scaled up by sqrt(8) compared to a true DCT; */ /* furthermore, we scale the results by 2**PASS1_BITS. */ dataptr = data; for (ctr = DCTSIZE-1; ctr >= 0; ctr--) { tmp0 = dataptr[0] + dataptr[7]; tmp7 = dataptr[0] - dataptr[7]; tmp1 = dataptr[1] + dataptr[6]; tmp6 = dataptr[1] - dataptr[6]; tmp2 = dataptr[2] + dataptr[5]; tmp5 = dataptr[2] - dataptr[5]; tmp3 = dataptr[3] + dataptr[4]; tmp4 = dataptr[3] - dataptr[4]; /* Even part per LL&M figure 1 --- note that published figure is faulty; * rotator "sqrt(2)*c1" should be "sqrt(2)*c6". */ tmp10 = tmp0 + tmp3; tmp13 = tmp0 - tmp3; tmp11 = tmp1 + tmp2; tmp12 = tmp1 - tmp2; dataptr[0] = (int16_t) ((tmp10 + tmp11) << PASS1_BITS); dataptr[4] = (int16_t) ((tmp10 - tmp11) << PASS1_BITS); z1 = MULTIPLY(tmp12 + tmp13, FIX_0_541196100); dataptr[2] = (int16_t) DESCALE(z1 + MULTIPLY(tmp13, FIX_0_765366865), CONST_BITS-PASS1_BITS); dataptr[6] = (int16_t) DESCALE(z1 + MULTIPLY(tmp12, - FIX_1_847759065), CONST_BITS-PASS1_BITS); /* Odd part per figure 8 --- note paper omits factor of sqrt(2). * cK represents cos(K*pi/16). * i0..i3 in the paper are tmp4..tmp7 here. */ z1 = tmp4 + tmp7; z2 = tmp5 + tmp6; z3 = tmp4 + tmp6; z4 = tmp5 + tmp7; z5 = MULTIPLY(z3 + z4, FIX_1_175875602); /* sqrt(2) * c3 */ tmp4 = MULTIPLY(tmp4, FIX_0_298631336); /* sqrt(2) * (-c1+c3+c5-c7) */ tmp5 = MULTIPLY(tmp5, FIX_2_053119869); /* sqrt(2) * ( c1+c3-c5+c7) */ tmp6 = MULTIPLY(tmp6, FIX_3_072711026); /* sqrt(2) * ( c1+c3+c5-c7) */ tmp7 = MULTIPLY(tmp7, FIX_1_501321110); /* sqrt(2) * ( c1+c3-c5-c7) */ z1 = MULTIPLY(z1, - FIX_0_899976223); /* sqrt(2) * (c7-c3) */ z2 = MULTIPLY(z2, - FIX_2_562915447); /* sqrt(2) * (-c1-c3) */ z3 = MULTIPLY(z3, - FIX_1_961570560); /* sqrt(2) * (-c3-c5) */ z4 = MULTIPLY(z4, - FIX_0_390180644); /* sqrt(2) * (c5-c3) */ z3 += z5; z4 += z5; dataptr[7] = (int16_t) DESCALE(tmp4 + z1 + z3, CONST_BITS-PASS1_BITS); dataptr[5] = (int16_t) DESCALE(tmp5 + z2 + z4, CONST_BITS-PASS1_BITS); dataptr[3] = (int16_t) DESCALE(tmp6 + z2 + z3, CONST_BITS-PASS1_BITS); dataptr[1] = (int16_t) DESCALE(tmp7 + z1 + z4, CONST_BITS-PASS1_BITS); dataptr += DCTSIZE; /* advance pointer to next row */ } }
false
FFmpeg
1389b4c18d1042c196603ba66c25113bcee1738b
static av_always_inline void FUNC(row_fdct)(int16_t *data) { int tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7; int tmp10, tmp11, tmp12, tmp13; int z1, z2, z3, z4, z5; int16_t *dataptr; int ctr; dataptr = data; for (ctr = DCTSIZE-1; ctr >= 0; ctr--) { tmp0 = dataptr[0] + dataptr[7]; tmp7 = dataptr[0] - dataptr[7]; tmp1 = dataptr[1] + dataptr[6]; tmp6 = dataptr[1] - dataptr[6]; tmp2 = dataptr[2] + dataptr[5]; tmp5 = dataptr[2] - dataptr[5]; tmp3 = dataptr[3] + dataptr[4]; tmp4 = dataptr[3] - dataptr[4]; tmp10 = tmp0 + tmp3; tmp13 = tmp0 - tmp3; tmp11 = tmp1 + tmp2; tmp12 = tmp1 - tmp2; dataptr[0] = (int16_t) ((tmp10 + tmp11) << PASS1_BITS); dataptr[4] = (int16_t) ((tmp10 - tmp11) << PASS1_BITS); z1 = MULTIPLY(tmp12 + tmp13, FIX_0_541196100); dataptr[2] = (int16_t) DESCALE(z1 + MULTIPLY(tmp13, FIX_0_765366865), CONST_BITS-PASS1_BITS); dataptr[6] = (int16_t) DESCALE(z1 + MULTIPLY(tmp12, - FIX_1_847759065), CONST_BITS-PASS1_BITS); z1 = tmp4 + tmp7; z2 = tmp5 + tmp6; z3 = tmp4 + tmp6; z4 = tmp5 + tmp7; z5 = MULTIPLY(z3 + z4, FIX_1_175875602); tmp4 = MULTIPLY(tmp4, FIX_0_298631336); tmp5 = MULTIPLY(tmp5, FIX_2_053119869); tmp6 = MULTIPLY(tmp6, FIX_3_072711026); tmp7 = MULTIPLY(tmp7, FIX_1_501321110); z1 = MULTIPLY(z1, - FIX_0_899976223); z2 = MULTIPLY(z2, - FIX_2_562915447); z3 = MULTIPLY(z3, - FIX_1_961570560); z4 = MULTIPLY(z4, - FIX_0_390180644); z3 += z5; z4 += z5; dataptr[7] = (int16_t) DESCALE(tmp4 + z1 + z3, CONST_BITS-PASS1_BITS); dataptr[5] = (int16_t) DESCALE(tmp5 + z2 + z4, CONST_BITS-PASS1_BITS); dataptr[3] = (int16_t) DESCALE(tmp6 + z2 + z3, CONST_BITS-PASS1_BITS); dataptr[1] = (int16_t) DESCALE(tmp7 + z1 + z4, CONST_BITS-PASS1_BITS); dataptr += DCTSIZE; } }
{ "code": [], "line_no": [] }
static av_always_inline void FUNC_0(row_fdct)(int16_t *data) { int VAR_0, VAR_1, VAR_2, VAR_3, VAR_4, VAR_5, VAR_6, VAR_7; int VAR_8, VAR_9, VAR_10, VAR_11; int VAR_12, VAR_13, VAR_14, VAR_15, VAR_16; int16_t *dataptr; int VAR_17; dataptr = data; for (VAR_17 = DCTSIZE-1; VAR_17 >= 0; VAR_17--) { VAR_0 = dataptr[0] + dataptr[7]; VAR_7 = dataptr[0] - dataptr[7]; VAR_1 = dataptr[1] + dataptr[6]; VAR_6 = dataptr[1] - dataptr[6]; VAR_2 = dataptr[2] + dataptr[5]; VAR_5 = dataptr[2] - dataptr[5]; VAR_3 = dataptr[3] + dataptr[4]; VAR_4 = dataptr[3] - dataptr[4]; VAR_8 = VAR_0 + VAR_3; VAR_11 = VAR_0 - VAR_3; VAR_9 = VAR_1 + VAR_2; VAR_10 = VAR_1 - VAR_2; dataptr[0] = (int16_t) ((VAR_8 + VAR_9) << PASS1_BITS); dataptr[4] = (int16_t) ((VAR_8 - VAR_9) << PASS1_BITS); VAR_12 = MULTIPLY(VAR_10 + VAR_11, FIX_0_541196100); dataptr[2] = (int16_t) DESCALE(VAR_12 + MULTIPLY(VAR_11, FIX_0_765366865), CONST_BITS-PASS1_BITS); dataptr[6] = (int16_t) DESCALE(VAR_12 + MULTIPLY(VAR_10, - FIX_1_847759065), CONST_BITS-PASS1_BITS); VAR_12 = VAR_4 + VAR_7; VAR_13 = VAR_5 + VAR_6; VAR_14 = VAR_4 + VAR_6; VAR_15 = VAR_5 + VAR_7; VAR_16 = MULTIPLY(VAR_14 + VAR_15, FIX_1_175875602); VAR_4 = MULTIPLY(VAR_4, FIX_0_298631336); VAR_5 = MULTIPLY(VAR_5, FIX_2_053119869); VAR_6 = MULTIPLY(VAR_6, FIX_3_072711026); VAR_7 = MULTIPLY(VAR_7, FIX_1_501321110); VAR_12 = MULTIPLY(VAR_12, - FIX_0_899976223); VAR_13 = MULTIPLY(VAR_13, - FIX_2_562915447); VAR_14 = MULTIPLY(VAR_14, - FIX_1_961570560); VAR_15 = MULTIPLY(VAR_15, - FIX_0_390180644); VAR_14 += VAR_16; VAR_15 += VAR_16; dataptr[7] = (int16_t) DESCALE(VAR_4 + VAR_12 + VAR_14, CONST_BITS-PASS1_BITS); dataptr[5] = (int16_t) DESCALE(VAR_5 + VAR_13 + VAR_15, CONST_BITS-PASS1_BITS); dataptr[3] = (int16_t) DESCALE(VAR_6 + VAR_13 + VAR_14, CONST_BITS-PASS1_BITS); dataptr[1] = (int16_t) DESCALE(VAR_7 + VAR_12 + VAR_15, CONST_BITS-PASS1_BITS); dataptr += DCTSIZE; } }
[ "static av_always_inline void FUNC_0(row_fdct)(int16_t *data)\n{", "int VAR_0, VAR_1, VAR_2, VAR_3, VAR_4, VAR_5, VAR_6, VAR_7;", "int VAR_8, VAR_9, VAR_10, VAR_11;", "int VAR_12, VAR_13, VAR_14, VAR_15, VAR_16;", "int16_t *dataptr;", "int VAR_17;", "dataptr = data;", "for (VAR_17 = DCTSIZE-1; VAR_17 >= 0; VAR_17--) {", "VAR_0 = dataptr[0] + dataptr[7];", "VAR_7 = dataptr[0] - dataptr[7];", "VAR_1 = dataptr[1] + dataptr[6];", "VAR_6 = dataptr[1] - dataptr[6];", "VAR_2 = dataptr[2] + dataptr[5];", "VAR_5 = dataptr[2] - dataptr[5];", "VAR_3 = dataptr[3] + dataptr[4];", "VAR_4 = dataptr[3] - dataptr[4];", "VAR_8 = VAR_0 + VAR_3;", "VAR_11 = VAR_0 - VAR_3;", "VAR_9 = VAR_1 + VAR_2;", "VAR_10 = VAR_1 - VAR_2;", "dataptr[0] = (int16_t) ((VAR_8 + VAR_9) << PASS1_BITS);", "dataptr[4] = (int16_t) ((VAR_8 - VAR_9) << PASS1_BITS);", "VAR_12 = MULTIPLY(VAR_10 + VAR_11, FIX_0_541196100);", "dataptr[2] = (int16_t) DESCALE(VAR_12 + MULTIPLY(VAR_11, FIX_0_765366865),\nCONST_BITS-PASS1_BITS);", "dataptr[6] = (int16_t) DESCALE(VAR_12 + MULTIPLY(VAR_10, - FIX_1_847759065),\nCONST_BITS-PASS1_BITS);", "VAR_12 = VAR_4 + VAR_7;", "VAR_13 = VAR_5 + VAR_6;", "VAR_14 = VAR_4 + VAR_6;", "VAR_15 = VAR_5 + VAR_7;", "VAR_16 = MULTIPLY(VAR_14 + VAR_15, FIX_1_175875602);", "VAR_4 = MULTIPLY(VAR_4, FIX_0_298631336);", "VAR_5 = MULTIPLY(VAR_5, FIX_2_053119869);", "VAR_6 = MULTIPLY(VAR_6, FIX_3_072711026);", "VAR_7 = MULTIPLY(VAR_7, FIX_1_501321110);", "VAR_12 = MULTIPLY(VAR_12, - FIX_0_899976223);", "VAR_13 = MULTIPLY(VAR_13, - FIX_2_562915447);", "VAR_14 = MULTIPLY(VAR_14, - FIX_1_961570560);", "VAR_15 = MULTIPLY(VAR_15, - FIX_0_390180644);", "VAR_14 += VAR_16;", "VAR_15 += VAR_16;", "dataptr[7] = (int16_t) DESCALE(VAR_4 + VAR_12 + VAR_14, CONST_BITS-PASS1_BITS);", "dataptr[5] = (int16_t) DESCALE(VAR_5 + VAR_13 + VAR_15, CONST_BITS-PASS1_BITS);", "dataptr[3] = (int16_t) DESCALE(VAR_6 + VAR_13 + VAR_14, CONST_BITS-PASS1_BITS);", "dataptr[1] = (int16_t) DESCALE(VAR_7 + VAR_12 + VAR_15, CONST_BITS-PASS1_BITS);", "dataptr += DCTSIZE;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 65 ], [ 67 ], [ 71 ], [ 73, 75 ], [ 77, 79 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 123 ], [ 125 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 139 ], [ 141 ], [ 143 ] ]
7,467
static int decode_type2(GetByteContext *gb, PutByteContext *pb) { unsigned repeat = 0, first = 1, opcode; int i, len, pos; while (bytestream2_get_bytes_left(gb) > 0) { GetByteContext gbc; while (bytestream2_get_bytes_left(gb) > 0) { if (first) { first = 0; if (bytestream2_peek_byte(gb) > 17) { len = bytestream2_get_byte(gb) - 17; if (len < 4) { do { bytestream2_put_byte(pb, bytestream2_get_byte(gb)); --len; } while (len); opcode = bytestream2_peek_byte(gb); continue; } else { do { bytestream2_put_byte(pb, bytestream2_get_byte(gb)); --len; } while (len); opcode = bytestream2_peek_byte(gb); if (opcode < 0x10) { bytestream2_skip(gb, 1); pos = - (opcode >> 2) - 4 * bytestream2_get_byte(gb) - 2049; bytestream2_init(&gbc, pb->buffer_start, pb->buffer_end - pb->buffer_start); bytestream2_seek(&gbc, bytestream2_tell_p(pb) + pos, SEEK_SET); bytestream2_put_byte(pb, bytestream2_get_byte(&gbc)); bytestream2_put_byte(pb, bytestream2_get_byte(&gbc)); bytestream2_put_byte(pb, bytestream2_get_byte(&gbc)); len = opcode & 3; if (!len) { repeat = 1; } else { do { bytestream2_put_byte(pb, bytestream2_get_byte(gb)); --len; } while (len); opcode = bytestream2_peek_byte(gb); } continue; } } repeat = 0; } repeat = 1; } if (repeat) { repeat = 0; opcode = bytestream2_peek_byte(gb); if (opcode < 0x10) { bytestream2_skip(gb, 1); if (!opcode) { if (!bytestream2_peek_byte(gb)) { do { bytestream2_skip(gb, 1); opcode += 255; } while (!bytestream2_peek_byte(gb) && bytestream2_get_bytes_left(gb) > 0); } opcode += bytestream2_get_byte(gb) + 15; } bytestream2_put_le32(pb, bytestream2_get_le32(gb)); for (i = opcode - 1; i > 0; --i) bytestream2_put_byte(pb, bytestream2_get_byte(gb)); opcode = bytestream2_peek_byte(gb); if (opcode < 0x10) { bytestream2_skip(gb, 1); pos = - (opcode >> 2) - 4 * bytestream2_get_byte(gb) - 2049; bytestream2_init(&gbc, pb->buffer_start, pb->buffer_end - pb->buffer_start); bytestream2_seek(&gbc, bytestream2_tell_p(pb) + pos, SEEK_SET); bytestream2_put_byte(pb, bytestream2_get_byte(&gbc)); bytestream2_put_byte(pb, bytestream2_get_byte(&gbc)); bytestream2_put_byte(pb, bytestream2_get_byte(&gbc)); len = opcode & 3; if (!len) { repeat = 1; } else { do { bytestream2_put_byte(pb, bytestream2_get_byte(gb)); --len; } while (len); opcode = bytestream2_peek_byte(gb); } continue; } } } if (opcode >= 0x40) { bytestream2_skip(gb, 1); pos = - ((opcode >> 2) & 7) - 1 - 8 * bytestream2_get_byte(gb); len = (opcode >> 5) - 1; bytestream2_init(&gbc, pb->buffer_start, pb->buffer_end - pb->buffer_start); bytestream2_seek(&gbc, bytestream2_tell_p(pb) + pos, SEEK_SET); bytestream2_put_byte(pb, bytestream2_get_byte(&gbc)); bytestream2_put_byte(pb, bytestream2_get_byte(&gbc)); do { bytestream2_put_byte(pb, bytestream2_get_byte(&gbc)); --len; } while (len); len = opcode & 3; if (!len) { repeat = 1; } else { do { bytestream2_put_byte(pb, bytestream2_get_byte(gb)); --len; } while (len); opcode = bytestream2_peek_byte(gb); } continue; } else if (opcode < 0x20) { break; } len = opcode & 0x1F; bytestream2_skip(gb, 1); if (!len) { if (!bytestream2_peek_byte(gb)) { do { bytestream2_skip(gb, 1); len += 255; } while (!bytestream2_peek_byte(gb) && bytestream2_get_bytes_left(gb) > 0); } len += bytestream2_get_byte(gb) + 31; } i = bytestream2_get_le16(gb); pos = - (i >> 2) - 1; bytestream2_init(&gbc, pb->buffer_start, pb->buffer_end - pb->buffer_start); bytestream2_seek(&gbc, bytestream2_tell_p(pb) + pos, SEEK_SET); if (len < 6 || bytestream2_tell_p(pb) - bytestream2_tell(&gbc) < 4) { bytestream2_put_byte(pb, bytestream2_get_byte(&gbc)); bytestream2_put_byte(pb, bytestream2_get_byte(&gbc)); do { bytestream2_put_byte(pb, bytestream2_get_byte(&gbc)); --len; } while (len); } else { bytestream2_put_le32(pb, bytestream2_get_le32(&gbc)); for (len = len - 2; len; --len) bytestream2_put_byte(pb, bytestream2_get_byte(&gbc)); } len = i & 3; if (!len) { repeat = 1; } else { do { bytestream2_put_byte(pb, bytestream2_get_byte(gb)); --len; } while (len); opcode = bytestream2_peek_byte(gb); } } bytestream2_skip(gb, 1); if (opcode < 0x10) { pos = -(opcode >> 2) - 1 - 4 * bytestream2_get_byte(gb); bytestream2_init(&gbc, pb->buffer_start, pb->buffer_end - pb->buffer_start); bytestream2_seek(&gbc, bytestream2_tell_p(pb) + pos, SEEK_SET); bytestream2_put_byte(pb, bytestream2_get_byte(&gbc)); bytestream2_put_byte(pb, bytestream2_get_byte(&gbc)); len = opcode & 3; if (!len) { repeat = 1; } else { do { bytestream2_put_byte(pb, bytestream2_get_byte(gb)); --len; } while (len); opcode = bytestream2_peek_byte(gb); } continue; } len = opcode & 7; if (!len) { if (!bytestream2_peek_byte(gb)) { do { bytestream2_skip(gb, 1); len += 255; } while (!bytestream2_peek_byte(gb) && bytestream2_get_bytes_left(gb) > 0); } len += bytestream2_get_byte(gb) + 7; } i = bytestream2_get_le16(gb); pos = bytestream2_tell_p(pb) - 2048 * (opcode & 8); pos = pos - (i >> 2); if (pos == bytestream2_tell_p(pb)) break; pos = pos - 0x4000; bytestream2_init(&gbc, pb->buffer_start, pb->buffer_end - pb->buffer_start); bytestream2_seek(&gbc, pos, SEEK_SET); if (len < 6 || bytestream2_tell_p(pb) - bytestream2_tell(&gbc) < 4) { bytestream2_put_byte(pb, bytestream2_get_byte(&gbc)); bytestream2_put_byte(pb, bytestream2_get_byte(&gbc)); do { bytestream2_put_byte(pb, bytestream2_get_byte(&gbc)); --len; } while (len); } else { bytestream2_put_le32(pb, bytestream2_get_le32(&gbc)); for (len = len - 2; len; --len) bytestream2_put_byte(pb, bytestream2_get_byte(&gbc)); } len = i & 3; if (!len) { repeat = 1; } else { do { bytestream2_put_byte(pb, bytestream2_get_byte(gb)); --len; } while (len); opcode = bytestream2_peek_byte(gb); } } return 0; }
false
FFmpeg
c583e701bd527eb9635bd8f1d22b06696b3e2b3d
static int decode_type2(GetByteContext *gb, PutByteContext *pb) { unsigned repeat = 0, first = 1, opcode; int i, len, pos; while (bytestream2_get_bytes_left(gb) > 0) { GetByteContext gbc; while (bytestream2_get_bytes_left(gb) > 0) { if (first) { first = 0; if (bytestream2_peek_byte(gb) > 17) { len = bytestream2_get_byte(gb) - 17; if (len < 4) { do { bytestream2_put_byte(pb, bytestream2_get_byte(gb)); --len; } while (len); opcode = bytestream2_peek_byte(gb); continue; } else { do { bytestream2_put_byte(pb, bytestream2_get_byte(gb)); --len; } while (len); opcode = bytestream2_peek_byte(gb); if (opcode < 0x10) { bytestream2_skip(gb, 1); pos = - (opcode >> 2) - 4 * bytestream2_get_byte(gb) - 2049; bytestream2_init(&gbc, pb->buffer_start, pb->buffer_end - pb->buffer_start); bytestream2_seek(&gbc, bytestream2_tell_p(pb) + pos, SEEK_SET); bytestream2_put_byte(pb, bytestream2_get_byte(&gbc)); bytestream2_put_byte(pb, bytestream2_get_byte(&gbc)); bytestream2_put_byte(pb, bytestream2_get_byte(&gbc)); len = opcode & 3; if (!len) { repeat = 1; } else { do { bytestream2_put_byte(pb, bytestream2_get_byte(gb)); --len; } while (len); opcode = bytestream2_peek_byte(gb); } continue; } } repeat = 0; } repeat = 1; } if (repeat) { repeat = 0; opcode = bytestream2_peek_byte(gb); if (opcode < 0x10) { bytestream2_skip(gb, 1); if (!opcode) { if (!bytestream2_peek_byte(gb)) { do { bytestream2_skip(gb, 1); opcode += 255; } while (!bytestream2_peek_byte(gb) && bytestream2_get_bytes_left(gb) > 0); } opcode += bytestream2_get_byte(gb) + 15; } bytestream2_put_le32(pb, bytestream2_get_le32(gb)); for (i = opcode - 1; i > 0; --i) bytestream2_put_byte(pb, bytestream2_get_byte(gb)); opcode = bytestream2_peek_byte(gb); if (opcode < 0x10) { bytestream2_skip(gb, 1); pos = - (opcode >> 2) - 4 * bytestream2_get_byte(gb) - 2049; bytestream2_init(&gbc, pb->buffer_start, pb->buffer_end - pb->buffer_start); bytestream2_seek(&gbc, bytestream2_tell_p(pb) + pos, SEEK_SET); bytestream2_put_byte(pb, bytestream2_get_byte(&gbc)); bytestream2_put_byte(pb, bytestream2_get_byte(&gbc)); bytestream2_put_byte(pb, bytestream2_get_byte(&gbc)); len = opcode & 3; if (!len) { repeat = 1; } else { do { bytestream2_put_byte(pb, bytestream2_get_byte(gb)); --len; } while (len); opcode = bytestream2_peek_byte(gb); } continue; } } } if (opcode >= 0x40) { bytestream2_skip(gb, 1); pos = - ((opcode >> 2) & 7) - 1 - 8 * bytestream2_get_byte(gb); len = (opcode >> 5) - 1; bytestream2_init(&gbc, pb->buffer_start, pb->buffer_end - pb->buffer_start); bytestream2_seek(&gbc, bytestream2_tell_p(pb) + pos, SEEK_SET); bytestream2_put_byte(pb, bytestream2_get_byte(&gbc)); bytestream2_put_byte(pb, bytestream2_get_byte(&gbc)); do { bytestream2_put_byte(pb, bytestream2_get_byte(&gbc)); --len; } while (len); len = opcode & 3; if (!len) { repeat = 1; } else { do { bytestream2_put_byte(pb, bytestream2_get_byte(gb)); --len; } while (len); opcode = bytestream2_peek_byte(gb); } continue; } else if (opcode < 0x20) { break; } len = opcode & 0x1F; bytestream2_skip(gb, 1); if (!len) { if (!bytestream2_peek_byte(gb)) { do { bytestream2_skip(gb, 1); len += 255; } while (!bytestream2_peek_byte(gb) && bytestream2_get_bytes_left(gb) > 0); } len += bytestream2_get_byte(gb) + 31; } i = bytestream2_get_le16(gb); pos = - (i >> 2) - 1; bytestream2_init(&gbc, pb->buffer_start, pb->buffer_end - pb->buffer_start); bytestream2_seek(&gbc, bytestream2_tell_p(pb) + pos, SEEK_SET); if (len < 6 || bytestream2_tell_p(pb) - bytestream2_tell(&gbc) < 4) { bytestream2_put_byte(pb, bytestream2_get_byte(&gbc)); bytestream2_put_byte(pb, bytestream2_get_byte(&gbc)); do { bytestream2_put_byte(pb, bytestream2_get_byte(&gbc)); --len; } while (len); } else { bytestream2_put_le32(pb, bytestream2_get_le32(&gbc)); for (len = len - 2; len; --len) bytestream2_put_byte(pb, bytestream2_get_byte(&gbc)); } len = i & 3; if (!len) { repeat = 1; } else { do { bytestream2_put_byte(pb, bytestream2_get_byte(gb)); --len; } while (len); opcode = bytestream2_peek_byte(gb); } } bytestream2_skip(gb, 1); if (opcode < 0x10) { pos = -(opcode >> 2) - 1 - 4 * bytestream2_get_byte(gb); bytestream2_init(&gbc, pb->buffer_start, pb->buffer_end - pb->buffer_start); bytestream2_seek(&gbc, bytestream2_tell_p(pb) + pos, SEEK_SET); bytestream2_put_byte(pb, bytestream2_get_byte(&gbc)); bytestream2_put_byte(pb, bytestream2_get_byte(&gbc)); len = opcode & 3; if (!len) { repeat = 1; } else { do { bytestream2_put_byte(pb, bytestream2_get_byte(gb)); --len; } while (len); opcode = bytestream2_peek_byte(gb); } continue; } len = opcode & 7; if (!len) { if (!bytestream2_peek_byte(gb)) { do { bytestream2_skip(gb, 1); len += 255; } while (!bytestream2_peek_byte(gb) && bytestream2_get_bytes_left(gb) > 0); } len += bytestream2_get_byte(gb) + 7; } i = bytestream2_get_le16(gb); pos = bytestream2_tell_p(pb) - 2048 * (opcode & 8); pos = pos - (i >> 2); if (pos == bytestream2_tell_p(pb)) break; pos = pos - 0x4000; bytestream2_init(&gbc, pb->buffer_start, pb->buffer_end - pb->buffer_start); bytestream2_seek(&gbc, pos, SEEK_SET); if (len < 6 || bytestream2_tell_p(pb) - bytestream2_tell(&gbc) < 4) { bytestream2_put_byte(pb, bytestream2_get_byte(&gbc)); bytestream2_put_byte(pb, bytestream2_get_byte(&gbc)); do { bytestream2_put_byte(pb, bytestream2_get_byte(&gbc)); --len; } while (len); } else { bytestream2_put_le32(pb, bytestream2_get_le32(&gbc)); for (len = len - 2; len; --len) bytestream2_put_byte(pb, bytestream2_get_byte(&gbc)); } len = i & 3; if (!len) { repeat = 1; } else { do { bytestream2_put_byte(pb, bytestream2_get_byte(gb)); --len; } while (len); opcode = bytestream2_peek_byte(gb); } } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(GetByteContext *VAR_0, PutByteContext *VAR_1) { unsigned VAR_2 = 0, VAR_3 = 1, VAR_4; int VAR_5, VAR_6, VAR_7; while (bytestream2_get_bytes_left(VAR_0) > 0) { GetByteContext gbc; while (bytestream2_get_bytes_left(VAR_0) > 0) { if (VAR_3) { VAR_3 = 0; if (bytestream2_peek_byte(VAR_0) > 17) { VAR_6 = bytestream2_get_byte(VAR_0) - 17; if (VAR_6 < 4) { do { bytestream2_put_byte(VAR_1, bytestream2_get_byte(VAR_0)); --VAR_6; } while (VAR_6); VAR_4 = bytestream2_peek_byte(VAR_0); continue; } else { do { bytestream2_put_byte(VAR_1, bytestream2_get_byte(VAR_0)); --VAR_6; } while (VAR_6); VAR_4 = bytestream2_peek_byte(VAR_0); if (VAR_4 < 0x10) { bytestream2_skip(VAR_0, 1); VAR_7 = - (VAR_4 >> 2) - 4 * bytestream2_get_byte(VAR_0) - 2049; bytestream2_init(&gbc, VAR_1->buffer_start, VAR_1->buffer_end - VAR_1->buffer_start); bytestream2_seek(&gbc, bytestream2_tell_p(VAR_1) + VAR_7, SEEK_SET); bytestream2_put_byte(VAR_1, bytestream2_get_byte(&gbc)); bytestream2_put_byte(VAR_1, bytestream2_get_byte(&gbc)); bytestream2_put_byte(VAR_1, bytestream2_get_byte(&gbc)); VAR_6 = VAR_4 & 3; if (!VAR_6) { VAR_2 = 1; } else { do { bytestream2_put_byte(VAR_1, bytestream2_get_byte(VAR_0)); --VAR_6; } while (VAR_6); VAR_4 = bytestream2_peek_byte(VAR_0); } continue; } } VAR_2 = 0; } VAR_2 = 1; } if (VAR_2) { VAR_2 = 0; VAR_4 = bytestream2_peek_byte(VAR_0); if (VAR_4 < 0x10) { bytestream2_skip(VAR_0, 1); if (!VAR_4) { if (!bytestream2_peek_byte(VAR_0)) { do { bytestream2_skip(VAR_0, 1); VAR_4 += 255; } while (!bytestream2_peek_byte(VAR_0) && bytestream2_get_bytes_left(VAR_0) > 0); } VAR_4 += bytestream2_get_byte(VAR_0) + 15; } bytestream2_put_le32(VAR_1, bytestream2_get_le32(VAR_0)); for (VAR_5 = VAR_4 - 1; VAR_5 > 0; --VAR_5) bytestream2_put_byte(VAR_1, bytestream2_get_byte(VAR_0)); VAR_4 = bytestream2_peek_byte(VAR_0); if (VAR_4 < 0x10) { bytestream2_skip(VAR_0, 1); VAR_7 = - (VAR_4 >> 2) - 4 * bytestream2_get_byte(VAR_0) - 2049; bytestream2_init(&gbc, VAR_1->buffer_start, VAR_1->buffer_end - VAR_1->buffer_start); bytestream2_seek(&gbc, bytestream2_tell_p(VAR_1) + VAR_7, SEEK_SET); bytestream2_put_byte(VAR_1, bytestream2_get_byte(&gbc)); bytestream2_put_byte(VAR_1, bytestream2_get_byte(&gbc)); bytestream2_put_byte(VAR_1, bytestream2_get_byte(&gbc)); VAR_6 = VAR_4 & 3; if (!VAR_6) { VAR_2 = 1; } else { do { bytestream2_put_byte(VAR_1, bytestream2_get_byte(VAR_0)); --VAR_6; } while (VAR_6); VAR_4 = bytestream2_peek_byte(VAR_0); } continue; } } } if (VAR_4 >= 0x40) { bytestream2_skip(VAR_0, 1); VAR_7 = - ((VAR_4 >> 2) & 7) - 1 - 8 * bytestream2_get_byte(VAR_0); VAR_6 = (VAR_4 >> 5) - 1; bytestream2_init(&gbc, VAR_1->buffer_start, VAR_1->buffer_end - VAR_1->buffer_start); bytestream2_seek(&gbc, bytestream2_tell_p(VAR_1) + VAR_7, SEEK_SET); bytestream2_put_byte(VAR_1, bytestream2_get_byte(&gbc)); bytestream2_put_byte(VAR_1, bytestream2_get_byte(&gbc)); do { bytestream2_put_byte(VAR_1, bytestream2_get_byte(&gbc)); --VAR_6; } while (VAR_6); VAR_6 = VAR_4 & 3; if (!VAR_6) { VAR_2 = 1; } else { do { bytestream2_put_byte(VAR_1, bytestream2_get_byte(VAR_0)); --VAR_6; } while (VAR_6); VAR_4 = bytestream2_peek_byte(VAR_0); } continue; } else if (VAR_4 < 0x20) { break; } VAR_6 = VAR_4 & 0x1F; bytestream2_skip(VAR_0, 1); if (!VAR_6) { if (!bytestream2_peek_byte(VAR_0)) { do { bytestream2_skip(VAR_0, 1); VAR_6 += 255; } while (!bytestream2_peek_byte(VAR_0) && bytestream2_get_bytes_left(VAR_0) > 0); } VAR_6 += bytestream2_get_byte(VAR_0) + 31; } VAR_5 = bytestream2_get_le16(VAR_0); VAR_7 = - (VAR_5 >> 2) - 1; bytestream2_init(&gbc, VAR_1->buffer_start, VAR_1->buffer_end - VAR_1->buffer_start); bytestream2_seek(&gbc, bytestream2_tell_p(VAR_1) + VAR_7, SEEK_SET); if (VAR_6 < 6 || bytestream2_tell_p(VAR_1) - bytestream2_tell(&gbc) < 4) { bytestream2_put_byte(VAR_1, bytestream2_get_byte(&gbc)); bytestream2_put_byte(VAR_1, bytestream2_get_byte(&gbc)); do { bytestream2_put_byte(VAR_1, bytestream2_get_byte(&gbc)); --VAR_6; } while (VAR_6); } else { bytestream2_put_le32(VAR_1, bytestream2_get_le32(&gbc)); for (VAR_6 = VAR_6 - 2; VAR_6; --VAR_6) bytestream2_put_byte(VAR_1, bytestream2_get_byte(&gbc)); } VAR_6 = VAR_5 & 3; if (!VAR_6) { VAR_2 = 1; } else { do { bytestream2_put_byte(VAR_1, bytestream2_get_byte(VAR_0)); --VAR_6; } while (VAR_6); VAR_4 = bytestream2_peek_byte(VAR_0); } } bytestream2_skip(VAR_0, 1); if (VAR_4 < 0x10) { VAR_7 = -(VAR_4 >> 2) - 1 - 4 * bytestream2_get_byte(VAR_0); bytestream2_init(&gbc, VAR_1->buffer_start, VAR_1->buffer_end - VAR_1->buffer_start); bytestream2_seek(&gbc, bytestream2_tell_p(VAR_1) + VAR_7, SEEK_SET); bytestream2_put_byte(VAR_1, bytestream2_get_byte(&gbc)); bytestream2_put_byte(VAR_1, bytestream2_get_byte(&gbc)); VAR_6 = VAR_4 & 3; if (!VAR_6) { VAR_2 = 1; } else { do { bytestream2_put_byte(VAR_1, bytestream2_get_byte(VAR_0)); --VAR_6; } while (VAR_6); VAR_4 = bytestream2_peek_byte(VAR_0); } continue; } VAR_6 = VAR_4 & 7; if (!VAR_6) { if (!bytestream2_peek_byte(VAR_0)) { do { bytestream2_skip(VAR_0, 1); VAR_6 += 255; } while (!bytestream2_peek_byte(VAR_0) && bytestream2_get_bytes_left(VAR_0) > 0); } VAR_6 += bytestream2_get_byte(VAR_0) + 7; } VAR_5 = bytestream2_get_le16(VAR_0); VAR_7 = bytestream2_tell_p(VAR_1) - 2048 * (VAR_4 & 8); VAR_7 = VAR_7 - (VAR_5 >> 2); if (VAR_7 == bytestream2_tell_p(VAR_1)) break; VAR_7 = VAR_7 - 0x4000; bytestream2_init(&gbc, VAR_1->buffer_start, VAR_1->buffer_end - VAR_1->buffer_start); bytestream2_seek(&gbc, VAR_7, SEEK_SET); if (VAR_6 < 6 || bytestream2_tell_p(VAR_1) - bytestream2_tell(&gbc) < 4) { bytestream2_put_byte(VAR_1, bytestream2_get_byte(&gbc)); bytestream2_put_byte(VAR_1, bytestream2_get_byte(&gbc)); do { bytestream2_put_byte(VAR_1, bytestream2_get_byte(&gbc)); --VAR_6; } while (VAR_6); } else { bytestream2_put_le32(VAR_1, bytestream2_get_le32(&gbc)); for (VAR_6 = VAR_6 - 2; VAR_6; --VAR_6) bytestream2_put_byte(VAR_1, bytestream2_get_byte(&gbc)); } VAR_6 = VAR_5 & 3; if (!VAR_6) { VAR_2 = 1; } else { do { bytestream2_put_byte(VAR_1, bytestream2_get_byte(VAR_0)); --VAR_6; } while (VAR_6); VAR_4 = bytestream2_peek_byte(VAR_0); } } return 0; }
[ "static int FUNC_0(GetByteContext *VAR_0, PutByteContext *VAR_1)\n{", "unsigned VAR_2 = 0, VAR_3 = 1, VAR_4;", "int VAR_5, VAR_6, VAR_7;", "while (bytestream2_get_bytes_left(VAR_0) > 0) {", "GetByteContext gbc;", "while (bytestream2_get_bytes_left(VAR_0) > 0) {", "if (VAR_3) {", "VAR_3 = 0;", "if (bytestream2_peek_byte(VAR_0) > 17) {", "VAR_6 = bytestream2_get_byte(VAR_0) - 17;", "if (VAR_6 < 4) {", "do {", "bytestream2_put_byte(VAR_1, bytestream2_get_byte(VAR_0));", "--VAR_6;", "} while (VAR_6);", "VAR_4 = bytestream2_peek_byte(VAR_0);", "continue;", "} else {", "do {", "bytestream2_put_byte(VAR_1, bytestream2_get_byte(VAR_0));", "--VAR_6;", "} while (VAR_6);", "VAR_4 = bytestream2_peek_byte(VAR_0);", "if (VAR_4 < 0x10) {", "bytestream2_skip(VAR_0, 1);", "VAR_7 = - (VAR_4 >> 2) - 4 * bytestream2_get_byte(VAR_0) - 2049;", "bytestream2_init(&gbc, VAR_1->buffer_start, VAR_1->buffer_end - VAR_1->buffer_start);", "bytestream2_seek(&gbc, bytestream2_tell_p(VAR_1) + VAR_7, SEEK_SET);", "bytestream2_put_byte(VAR_1, bytestream2_get_byte(&gbc));", "bytestream2_put_byte(VAR_1, bytestream2_get_byte(&gbc));", "bytestream2_put_byte(VAR_1, bytestream2_get_byte(&gbc));", "VAR_6 = VAR_4 & 3;", "if (!VAR_6) {", "VAR_2 = 1;", "} else {", "do {", "bytestream2_put_byte(VAR_1, bytestream2_get_byte(VAR_0));", "--VAR_6;", "} while (VAR_6);", "VAR_4 = bytestream2_peek_byte(VAR_0);", "}", "continue;", "}", "}", "VAR_2 = 0;", "}", "VAR_2 = 1;", "}", "if (VAR_2) {", "VAR_2 = 0;", "VAR_4 = bytestream2_peek_byte(VAR_0);", "if (VAR_4 < 0x10) {", "bytestream2_skip(VAR_0, 1);", "if (!VAR_4) {", "if (!bytestream2_peek_byte(VAR_0)) {", "do {", "bytestream2_skip(VAR_0, 1);", "VAR_4 += 255;", "} while (!bytestream2_peek_byte(VAR_0) && bytestream2_get_bytes_left(VAR_0) > 0);", "}", "VAR_4 += bytestream2_get_byte(VAR_0) + 15;", "}", "bytestream2_put_le32(VAR_1, bytestream2_get_le32(VAR_0));", "for (VAR_5 = VAR_4 - 1; VAR_5 > 0; --VAR_5)", "bytestream2_put_byte(VAR_1, bytestream2_get_byte(VAR_0));", "VAR_4 = bytestream2_peek_byte(VAR_0);", "if (VAR_4 < 0x10) {", "bytestream2_skip(VAR_0, 1);", "VAR_7 = - (VAR_4 >> 2) - 4 * bytestream2_get_byte(VAR_0) - 2049;", "bytestream2_init(&gbc, VAR_1->buffer_start, VAR_1->buffer_end - VAR_1->buffer_start);", "bytestream2_seek(&gbc, bytestream2_tell_p(VAR_1) + VAR_7, SEEK_SET);", "bytestream2_put_byte(VAR_1, bytestream2_get_byte(&gbc));", "bytestream2_put_byte(VAR_1, bytestream2_get_byte(&gbc));", "bytestream2_put_byte(VAR_1, bytestream2_get_byte(&gbc));", "VAR_6 = VAR_4 & 3;", "if (!VAR_6) {", "VAR_2 = 1;", "} else {", "do {", "bytestream2_put_byte(VAR_1, bytestream2_get_byte(VAR_0));", "--VAR_6;", "} while (VAR_6);", "VAR_4 = bytestream2_peek_byte(VAR_0);", "}", "continue;", "}", "}", "}", "if (VAR_4 >= 0x40) {", "bytestream2_skip(VAR_0, 1);", "VAR_7 = - ((VAR_4 >> 2) & 7) - 1 - 8 * bytestream2_get_byte(VAR_0);", "VAR_6 = (VAR_4 >> 5) - 1;", "bytestream2_init(&gbc, VAR_1->buffer_start, VAR_1->buffer_end - VAR_1->buffer_start);", "bytestream2_seek(&gbc, bytestream2_tell_p(VAR_1) + VAR_7, SEEK_SET);", "bytestream2_put_byte(VAR_1, bytestream2_get_byte(&gbc));", "bytestream2_put_byte(VAR_1, bytestream2_get_byte(&gbc));", "do {", "bytestream2_put_byte(VAR_1, bytestream2_get_byte(&gbc));", "--VAR_6;", "} while (VAR_6);", "VAR_6 = VAR_4 & 3;", "if (!VAR_6) {", "VAR_2 = 1;", "} else {", "do {", "bytestream2_put_byte(VAR_1, bytestream2_get_byte(VAR_0));", "--VAR_6;", "} while (VAR_6);", "VAR_4 = bytestream2_peek_byte(VAR_0);", "}", "continue;", "} else if (VAR_4 < 0x20) {", "break;", "}", "VAR_6 = VAR_4 & 0x1F;", "bytestream2_skip(VAR_0, 1);", "if (!VAR_6) {", "if (!bytestream2_peek_byte(VAR_0)) {", "do {", "bytestream2_skip(VAR_0, 1);", "VAR_6 += 255;", "} while (!bytestream2_peek_byte(VAR_0) && bytestream2_get_bytes_left(VAR_0) > 0);", "}", "VAR_6 += bytestream2_get_byte(VAR_0) + 31;", "}", "VAR_5 = bytestream2_get_le16(VAR_0);", "VAR_7 = - (VAR_5 >> 2) - 1;", "bytestream2_init(&gbc, VAR_1->buffer_start, VAR_1->buffer_end - VAR_1->buffer_start);", "bytestream2_seek(&gbc, bytestream2_tell_p(VAR_1) + VAR_7, SEEK_SET);", "if (VAR_6 < 6 || bytestream2_tell_p(VAR_1) - bytestream2_tell(&gbc) < 4) {", "bytestream2_put_byte(VAR_1, bytestream2_get_byte(&gbc));", "bytestream2_put_byte(VAR_1, bytestream2_get_byte(&gbc));", "do {", "bytestream2_put_byte(VAR_1, bytestream2_get_byte(&gbc));", "--VAR_6;", "} while (VAR_6);", "} else {", "bytestream2_put_le32(VAR_1, bytestream2_get_le32(&gbc));", "for (VAR_6 = VAR_6 - 2; VAR_6; --VAR_6)", "bytestream2_put_byte(VAR_1, bytestream2_get_byte(&gbc));", "}", "VAR_6 = VAR_5 & 3;", "if (!VAR_6) {", "VAR_2 = 1;", "} else {", "do {", "bytestream2_put_byte(VAR_1, bytestream2_get_byte(VAR_0));", "--VAR_6;", "} while (VAR_6);", "VAR_4 = bytestream2_peek_byte(VAR_0);", "}", "}", "bytestream2_skip(VAR_0, 1);", "if (VAR_4 < 0x10) {", "VAR_7 = -(VAR_4 >> 2) - 1 - 4 * bytestream2_get_byte(VAR_0);", "bytestream2_init(&gbc, VAR_1->buffer_start, VAR_1->buffer_end - VAR_1->buffer_start);", "bytestream2_seek(&gbc, bytestream2_tell_p(VAR_1) + VAR_7, SEEK_SET);", "bytestream2_put_byte(VAR_1, bytestream2_get_byte(&gbc));", "bytestream2_put_byte(VAR_1, bytestream2_get_byte(&gbc));", "VAR_6 = VAR_4 & 3;", "if (!VAR_6) {", "VAR_2 = 1;", "} else {", "do {", "bytestream2_put_byte(VAR_1, bytestream2_get_byte(VAR_0));", "--VAR_6;", "} while (VAR_6);", "VAR_4 = bytestream2_peek_byte(VAR_0);", "}", "continue;", "}", "VAR_6 = VAR_4 & 7;", "if (!VAR_6) {", "if (!bytestream2_peek_byte(VAR_0)) {", "do {", "bytestream2_skip(VAR_0, 1);", "VAR_6 += 255;", "} while (!bytestream2_peek_byte(VAR_0) && bytestream2_get_bytes_left(VAR_0) > 0);", "}", "VAR_6 += bytestream2_get_byte(VAR_0) + 7;", "}", "VAR_5 = bytestream2_get_le16(VAR_0);", "VAR_7 = bytestream2_tell_p(VAR_1) - 2048 * (VAR_4 & 8);", "VAR_7 = VAR_7 - (VAR_5 >> 2);", "if (VAR_7 == bytestream2_tell_p(VAR_1))\nbreak;", "VAR_7 = VAR_7 - 0x4000;", "bytestream2_init(&gbc, VAR_1->buffer_start, VAR_1->buffer_end - VAR_1->buffer_start);", "bytestream2_seek(&gbc, VAR_7, SEEK_SET);", "if (VAR_6 < 6 || bytestream2_tell_p(VAR_1) - bytestream2_tell(&gbc) < 4) {", "bytestream2_put_byte(VAR_1, bytestream2_get_byte(&gbc));", "bytestream2_put_byte(VAR_1, bytestream2_get_byte(&gbc));", "do {", "bytestream2_put_byte(VAR_1, bytestream2_get_byte(&gbc));", "--VAR_6;", "} while (VAR_6);", "} else {", "bytestream2_put_le32(VAR_1, bytestream2_get_le32(&gbc));", "for (VAR_6 = VAR_6 - 2; VAR_6; --VAR_6)", "bytestream2_put_byte(VAR_1, bytestream2_get_byte(&gbc));", "}", "VAR_6 = VAR_5 & 3;", "if (!VAR_6) {", "VAR_2 = 1;", "} else {", "do {", "bytestream2_put_byte(VAR_1, bytestream2_get_byte(VAR_0));", "--VAR_6;", "} while (VAR_6);", "VAR_4 = bytestream2_peek_byte(VAR_0);", "}", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 63 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 151 ], [ 153 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 203 ], [ 205 ], [ 209 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 223 ], [ 227 ], [ 229 ], [ 231 ], [ 233 ], [ 235 ], [ 237 ], [ 239 ], [ 241 ], [ 243 ], [ 245 ], [ 247 ], [ 249 ], [ 251 ], [ 253 ], [ 255 ], [ 257 ], [ 259 ], [ 261 ], [ 263 ], [ 265 ], [ 267 ], [ 269 ], [ 271 ], [ 273 ], [ 275 ], [ 277 ], [ 281 ], [ 283 ], [ 287 ], [ 289 ], [ 291 ], [ 293 ], [ 295 ], [ 297 ], [ 299 ], [ 301 ], [ 303 ], [ 305 ], [ 307 ], [ 309 ], [ 311 ], [ 313 ], [ 315 ], [ 317 ], [ 319 ], [ 321 ], [ 323 ], [ 325 ], [ 327 ], [ 329 ], [ 331 ], [ 333 ], [ 335 ], [ 337 ], [ 341 ], [ 343 ], [ 347 ], [ 349 ], [ 351 ], [ 353 ], [ 355 ], [ 357 ], [ 359 ], [ 361 ], [ 363 ], [ 365 ], [ 367 ], [ 369 ], [ 371 ], [ 373 ], [ 375 ], [ 377 ], [ 379 ], [ 381 ], [ 383 ], [ 385 ], [ 387 ], [ 389 ], [ 391 ], [ 393 ], [ 395 ], [ 397 ], [ 399 ], [ 401, 403 ], [ 407 ], [ 409 ], [ 411 ], [ 415 ], [ 417 ], [ 419 ], [ 421 ], [ 423 ], [ 425 ], [ 427 ], [ 429 ], [ 431 ], [ 433 ], [ 435 ], [ 437 ], [ 441 ], [ 443 ], [ 445 ], [ 447 ], [ 449 ], [ 451 ], [ 453 ], [ 455 ], [ 457 ], [ 459 ], [ 461 ], [ 465 ], [ 467 ] ]
7,468
static int device_open(AVFormatContext *ctx, uint32_t *capabilities) { struct v4l2_capability cap; int fd; int res, err; int flags = O_RDWR; if (ctx->flags & AVFMT_FLAG_NONBLOCK) { flags |= O_NONBLOCK; } fd = open(ctx->filename, flags, 0); if (fd < 0) { av_log(ctx, AV_LOG_ERROR, "Cannot open video device %s : %s\n", ctx->filename, strerror(errno)); return AVERROR(errno); } res = ioctl(fd, VIDIOC_QUERYCAP, &cap); // ENOIOCTLCMD definition only availble on __KERNEL__ if (res < 0 && ((err = errno) == 515)) { av_log(ctx, AV_LOG_ERROR, "QUERYCAP not implemented, probably V4L device but " "not supporting V4L2\n"); close(fd); return AVERROR(515); } if (res < 0) { av_log(ctx, AV_LOG_ERROR, "ioctl(VIDIOC_QUERYCAP): %s\n", strerror(errno)); close(fd); return AVERROR(err); } if ((cap.capabilities & V4L2_CAP_VIDEO_CAPTURE) == 0) { av_log(ctx, AV_LOG_ERROR, "Not a video capture device\n"); close(fd); return AVERROR(ENODEV); } *capabilities = cap.capabilities; return fd; }
false
FFmpeg
eb89b4fc0994d682cd3f24b882164439c8c3af28
static int device_open(AVFormatContext *ctx, uint32_t *capabilities) { struct v4l2_capability cap; int fd; int res, err; int flags = O_RDWR; if (ctx->flags & AVFMT_FLAG_NONBLOCK) { flags |= O_NONBLOCK; } fd = open(ctx->filename, flags, 0); if (fd < 0) { av_log(ctx, AV_LOG_ERROR, "Cannot open video device %s : %s\n", ctx->filename, strerror(errno)); return AVERROR(errno); } res = ioctl(fd, VIDIOC_QUERYCAP, &cap); if (res < 0 && ((err = errno) == 515)) { av_log(ctx, AV_LOG_ERROR, "QUERYCAP not implemented, probably V4L device but " "not supporting V4L2\n"); close(fd); return AVERROR(515); } if (res < 0) { av_log(ctx, AV_LOG_ERROR, "ioctl(VIDIOC_QUERYCAP): %s\n", strerror(errno)); close(fd); return AVERROR(err); } if ((cap.capabilities & V4L2_CAP_VIDEO_CAPTURE) == 0) { av_log(ctx, AV_LOG_ERROR, "Not a video capture device\n"); close(fd); return AVERROR(ENODEV); } *capabilities = cap.capabilities; return fd; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVFormatContext *VAR_0, uint32_t *VAR_1) { struct v4l2_capability VAR_2; int VAR_3; int VAR_4, VAR_5; int VAR_6 = O_RDWR; if (VAR_0->VAR_6 & AVFMT_FLAG_NONBLOCK) { VAR_6 |= O_NONBLOCK; } VAR_3 = open(VAR_0->filename, VAR_6, 0); if (VAR_3 < 0) { av_log(VAR_0, AV_LOG_ERROR, "Cannot open video device %s : %s\n", VAR_0->filename, strerror(errno)); return AVERROR(errno); } VAR_4 = ioctl(VAR_3, VIDIOC_QUERYCAP, &VAR_2); if (VAR_4 < 0 && ((VAR_5 = errno) == 515)) { av_log(VAR_0, AV_LOG_ERROR, "QUERYCAP not implemented, probably V4L device but " "not supporting V4L2\n"); close(VAR_3); return AVERROR(515); } if (VAR_4 < 0) { av_log(VAR_0, AV_LOG_ERROR, "ioctl(VIDIOC_QUERYCAP): %s\n", strerror(errno)); close(VAR_3); return AVERROR(VAR_5); } if ((VAR_2.VAR_1 & V4L2_CAP_VIDEO_CAPTURE) == 0) { av_log(VAR_0, AV_LOG_ERROR, "Not a video capture device\n"); close(VAR_3); return AVERROR(ENODEV); } *VAR_1 = VAR_2.VAR_1; return VAR_3; }
[ "static int FUNC_0(AVFormatContext *VAR_0, uint32_t *VAR_1)\n{", "struct v4l2_capability VAR_2;", "int VAR_3;", "int VAR_4, VAR_5;", "int VAR_6 = O_RDWR;", "if (VAR_0->VAR_6 & AVFMT_FLAG_NONBLOCK) {", "VAR_6 |= O_NONBLOCK;", "}", "VAR_3 = open(VAR_0->filename, VAR_6, 0);", "if (VAR_3 < 0) {", "av_log(VAR_0, AV_LOG_ERROR, \"Cannot open video device %s : %s\\n\",\nVAR_0->filename, strerror(errno));", "return AVERROR(errno);", "}", "VAR_4 = ioctl(VAR_3, VIDIOC_QUERYCAP, &VAR_2);", "if (VAR_4 < 0 && ((VAR_5 = errno) == 515)) {", "av_log(VAR_0, AV_LOG_ERROR,\n\"QUERYCAP not implemented, probably V4L device but \"\n\"not supporting V4L2\\n\");", "close(VAR_3);", "return AVERROR(515);", "}", "if (VAR_4 < 0) {", "av_log(VAR_0, AV_LOG_ERROR, \"ioctl(VIDIOC_QUERYCAP): %s\\n\",\nstrerror(errno));", "close(VAR_3);", "return AVERROR(VAR_5);", "}", "if ((VAR_2.VAR_1 & V4L2_CAP_VIDEO_CAPTURE) == 0) {", "av_log(VAR_0, AV_LOG_ERROR, \"Not a video capture device\\n\");", "close(VAR_3);", "return AVERROR(ENODEV);", "}", "*VAR_1 = VAR_2.VAR_1;", "return VAR_3;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27, 29 ], [ 33 ], [ 35 ], [ 39 ], [ 43 ], [ 45, 47, 49 ], [ 51 ], [ 55 ], [ 57 ], [ 61 ], [ 63, 65 ], [ 67 ], [ 71 ], [ 73 ], [ 77 ], [ 79 ], [ 81 ], [ 85 ], [ 87 ], [ 91 ], [ 95 ], [ 97 ] ]
7,470
static void get_default_channel_layouts(OutputStream *ost, InputStream *ist) { char layout_name[256]; AVCodecContext *enc = ost->st->codec; AVCodecContext *dec = ist->st->codec; if (!dec->channel_layout) { if (enc->channel_layout && dec->channels == enc->channels) { dec->channel_layout = enc->channel_layout; } else { dec->channel_layout = av_get_default_channel_layout(dec->channels); if (!dec->channel_layout) { av_log(NULL, AV_LOG_FATAL, "Unable to find default channel " "layout for Input Stream #%d.%d\n", ist->file_index, ist->st->index); exit_program(1); } } av_get_channel_layout_string(layout_name, sizeof(layout_name), dec->channels, dec->channel_layout); av_log(NULL, AV_LOG_WARNING, "Guessed Channel Layout for Input Stream " "#%d.%d : %s\n", ist->file_index, ist->st->index, layout_name); } if (!enc->channel_layout) { if (dec->channels == enc->channels) { enc->channel_layout = dec->channel_layout; return; } else { enc->channel_layout = av_get_default_channel_layout(enc->channels); } if (!enc->channel_layout) { av_log(NULL, AV_LOG_FATAL, "Unable to find default channel layout " "for Output Stream #%d.%d\n", ost->file_index, ost->st->index); exit_program(1); } av_get_channel_layout_string(layout_name, sizeof(layout_name), enc->channels, enc->channel_layout); av_log(NULL, AV_LOG_WARNING, "Guessed Channel Layout for Output Stream " "#%d.%d : %s\n", ost->file_index, ost->st->index, layout_name); } }
false
FFmpeg
d8b06521a94550c8352b0e2fe5e55873718fc0c0
static void get_default_channel_layouts(OutputStream *ost, InputStream *ist) { char layout_name[256]; AVCodecContext *enc = ost->st->codec; AVCodecContext *dec = ist->st->codec; if (!dec->channel_layout) { if (enc->channel_layout && dec->channels == enc->channels) { dec->channel_layout = enc->channel_layout; } else { dec->channel_layout = av_get_default_channel_layout(dec->channels); if (!dec->channel_layout) { av_log(NULL, AV_LOG_FATAL, "Unable to find default channel " "layout for Input Stream #%d.%d\n", ist->file_index, ist->st->index); exit_program(1); } } av_get_channel_layout_string(layout_name, sizeof(layout_name), dec->channels, dec->channel_layout); av_log(NULL, AV_LOG_WARNING, "Guessed Channel Layout for Input Stream " "#%d.%d : %s\n", ist->file_index, ist->st->index, layout_name); } if (!enc->channel_layout) { if (dec->channels == enc->channels) { enc->channel_layout = dec->channel_layout; return; } else { enc->channel_layout = av_get_default_channel_layout(enc->channels); } if (!enc->channel_layout) { av_log(NULL, AV_LOG_FATAL, "Unable to find default channel layout " "for Output Stream #%d.%d\n", ost->file_index, ost->st->index); exit_program(1); } av_get_channel_layout_string(layout_name, sizeof(layout_name), enc->channels, enc->channel_layout); av_log(NULL, AV_LOG_WARNING, "Guessed Channel Layout for Output Stream " "#%d.%d : %s\n", ost->file_index, ost->st->index, layout_name); } }
{ "code": [], "line_no": [] }
static void FUNC_0(OutputStream *VAR_0, InputStream *VAR_1) { char VAR_2[256]; AVCodecContext *enc = VAR_0->st->codec; AVCodecContext *dec = VAR_1->st->codec; if (!dec->channel_layout) { if (enc->channel_layout && dec->channels == enc->channels) { dec->channel_layout = enc->channel_layout; } else { dec->channel_layout = av_get_default_channel_layout(dec->channels); if (!dec->channel_layout) { av_log(NULL, AV_LOG_FATAL, "Unable to find default channel " "layout for Input Stream #%d.%d\n", VAR_1->file_index, VAR_1->st->index); exit_program(1); } } av_get_channel_layout_string(VAR_2, sizeof(VAR_2), dec->channels, dec->channel_layout); av_log(NULL, AV_LOG_WARNING, "Guessed Channel Layout for Input Stream " "#%d.%d : %s\n", VAR_1->file_index, VAR_1->st->index, VAR_2); } if (!enc->channel_layout) { if (dec->channels == enc->channels) { enc->channel_layout = dec->channel_layout; return; } else { enc->channel_layout = av_get_default_channel_layout(enc->channels); } if (!enc->channel_layout) { av_log(NULL, AV_LOG_FATAL, "Unable to find default channel layout " "for Output Stream #%d.%d\n", VAR_0->file_index, VAR_0->st->index); exit_program(1); } av_get_channel_layout_string(VAR_2, sizeof(VAR_2), enc->channels, enc->channel_layout); av_log(NULL, AV_LOG_WARNING, "Guessed Channel Layout for Output Stream " "#%d.%d : %s\n", VAR_0->file_index, VAR_0->st->index, VAR_2); } }
[ "static void FUNC_0(OutputStream *VAR_0, InputStream *VAR_1)\n{", "char VAR_2[256];", "AVCodecContext *enc = VAR_0->st->codec;", "AVCodecContext *dec = VAR_1->st->codec;", "if (!dec->channel_layout) {", "if (enc->channel_layout && dec->channels == enc->channels) {", "dec->channel_layout = enc->channel_layout;", "} else {", "dec->channel_layout = av_get_default_channel_layout(dec->channels);", "if (!dec->channel_layout) {", "av_log(NULL, AV_LOG_FATAL, \"Unable to find default channel \"\n\"layout for Input Stream #%d.%d\\n\", VAR_1->file_index,\nVAR_1->st->index);", "exit_program(1);", "}", "}", "av_get_channel_layout_string(VAR_2, sizeof(VAR_2),\ndec->channels, dec->channel_layout);", "av_log(NULL, AV_LOG_WARNING, \"Guessed Channel Layout for Input Stream \"\n\"#%d.%d : %s\\n\", VAR_1->file_index, VAR_1->st->index, VAR_2);", "}", "if (!enc->channel_layout) {", "if (dec->channels == enc->channels) {", "enc->channel_layout = dec->channel_layout;", "return;", "} else {", "enc->channel_layout = av_get_default_channel_layout(enc->channels);", "}", "if (!enc->channel_layout) {", "av_log(NULL, AV_LOG_FATAL, \"Unable to find default channel layout \"\n\"for Output Stream #%d.%d\\n\", VAR_0->file_index,\nVAR_0->st->index);", "exit_program(1);", "}", "av_get_channel_layout_string(VAR_2, sizeof(VAR_2),\nenc->channels, enc->channel_layout);", "av_log(NULL, AV_LOG_WARNING, \"Guessed Channel Layout for Output Stream \"\n\"#%d.%d : %s\\n\", VAR_0->file_index, VAR_0->st->index, 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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27, 29, 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39, 41 ], [ 43, 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65, 67, 69 ], [ 71 ], [ 73 ], [ 75, 77 ], [ 79, 81 ], [ 83 ], [ 85 ] ]
7,474
static int roq_dpcm_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr) { int i, stereo, data_size, ret; const int16_t *in = frame ? (const int16_t *)frame->data[0] : NULL; uint8_t *out; ROQDPCMContext *context = avctx->priv_data; stereo = (avctx->channels == 2); if (!in && context->input_frames >= 8) return 0; if (in && context->input_frames < 8) { memcpy(&context->frame_buffer[context->buffered_samples * avctx->channels], in, avctx->frame_size * avctx->channels * sizeof(*in)); context->buffered_samples += avctx->frame_size; if (context->input_frames == 0) context->first_pts = frame->pts; if (context->input_frames < 7) { context->input_frames++; return 0; } } if (context->input_frames < 8) { in = context->frame_buffer; } if (stereo) { context->lastSample[0] &= 0xFF00; context->lastSample[1] &= 0xFF00; } if (context->input_frames == 7) data_size = avctx->channels * context->buffered_samples; else data_size = avctx->channels * avctx->frame_size; if ((ret = ff_alloc_packet2(avctx, avpkt, ROQ_HEADER_SIZE + data_size))) return ret; out = avpkt->data; bytestream_put_byte(&out, stereo ? 0x21 : 0x20); bytestream_put_byte(&out, 0x10); bytestream_put_le32(&out, data_size); if (stereo) { bytestream_put_byte(&out, (context->lastSample[1])>>8); bytestream_put_byte(&out, (context->lastSample[0])>>8); } else bytestream_put_le16(&out, context->lastSample[0]); /* Write the actual samples */ for (i = 0; i < data_size; i++) *out++ = dpcm_predict(&context->lastSample[i & 1], *in++); avpkt->pts = context->input_frames <= 7 ? context->first_pts : frame->pts; avpkt->duration = data_size / avctx->channels; context->input_frames++; if (!in) context->input_frames = FFMAX(context->input_frames, 8); *got_packet_ptr = 1; return 0; }
false
FFmpeg
bcaf64b605442e1622d16da89d4ec0e7730b8a8c
static int roq_dpcm_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr) { int i, stereo, data_size, ret; const int16_t *in = frame ? (const int16_t *)frame->data[0] : NULL; uint8_t *out; ROQDPCMContext *context = avctx->priv_data; stereo = (avctx->channels == 2); if (!in && context->input_frames >= 8) return 0; if (in && context->input_frames < 8) { memcpy(&context->frame_buffer[context->buffered_samples * avctx->channels], in, avctx->frame_size * avctx->channels * sizeof(*in)); context->buffered_samples += avctx->frame_size; if (context->input_frames == 0) context->first_pts = frame->pts; if (context->input_frames < 7) { context->input_frames++; return 0; } } if (context->input_frames < 8) { in = context->frame_buffer; } if (stereo) { context->lastSample[0] &= 0xFF00; context->lastSample[1] &= 0xFF00; } if (context->input_frames == 7) data_size = avctx->channels * context->buffered_samples; else data_size = avctx->channels * avctx->frame_size; if ((ret = ff_alloc_packet2(avctx, avpkt, ROQ_HEADER_SIZE + data_size))) return ret; out = avpkt->data; bytestream_put_byte(&out, stereo ? 0x21 : 0x20); bytestream_put_byte(&out, 0x10); bytestream_put_le32(&out, data_size); if (stereo) { bytestream_put_byte(&out, (context->lastSample[1])>>8); bytestream_put_byte(&out, (context->lastSample[0])>>8); } else bytestream_put_le16(&out, context->lastSample[0]); for (i = 0; i < data_size; i++) *out++ = dpcm_predict(&context->lastSample[i & 1], *in++); avpkt->pts = context->input_frames <= 7 ? context->first_pts : frame->pts; avpkt->duration = data_size / avctx->channels; context->input_frames++; if (!in) context->input_frames = FFMAX(context->input_frames, 8); *got_packet_ptr = 1; return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecContext *VAR_0, AVPacket *VAR_1, const AVFrame *VAR_2, int *VAR_3) { int VAR_4, VAR_5, VAR_6, VAR_7; const int16_t *VAR_8 = VAR_2 ? (const int16_t *)VAR_2->data[0] : NULL; uint8_t *out; ROQDPCMContext *context = VAR_0->priv_data; VAR_5 = (VAR_0->channels == 2); if (!VAR_8 && context->input_frames >= 8) return 0; if (VAR_8 && context->input_frames < 8) { memcpy(&context->frame_buffer[context->buffered_samples * VAR_0->channels], VAR_8, VAR_0->frame_size * VAR_0->channels * sizeof(*VAR_8)); context->buffered_samples += VAR_0->frame_size; if (context->input_frames == 0) context->first_pts = VAR_2->pts; if (context->input_frames < 7) { context->input_frames++; return 0; } } if (context->input_frames < 8) { VAR_8 = context->frame_buffer; } if (VAR_5) { context->lastSample[0] &= 0xFF00; context->lastSample[1] &= 0xFF00; } if (context->input_frames == 7) VAR_6 = VAR_0->channels * context->buffered_samples; else VAR_6 = VAR_0->channels * VAR_0->frame_size; if ((VAR_7 = ff_alloc_packet2(VAR_0, VAR_1, ROQ_HEADER_SIZE + VAR_6))) return VAR_7; out = VAR_1->data; bytestream_put_byte(&out, VAR_5 ? 0x21 : 0x20); bytestream_put_byte(&out, 0x10); bytestream_put_le32(&out, VAR_6); if (VAR_5) { bytestream_put_byte(&out, (context->lastSample[1])>>8); bytestream_put_byte(&out, (context->lastSample[0])>>8); } else bytestream_put_le16(&out, context->lastSample[0]); for (VAR_4 = 0; VAR_4 < VAR_6; VAR_4++) *out++ = dpcm_predict(&context->lastSample[VAR_4 & 1], *VAR_8++); VAR_1->pts = context->input_frames <= 7 ? context->first_pts : VAR_2->pts; VAR_1->duration = VAR_6 / VAR_0->channels; context->input_frames++; if (!VAR_8) context->input_frames = FFMAX(context->input_frames, 8); *VAR_3 = 1; return 0; }
[ "static int FUNC_0(AVCodecContext *VAR_0, AVPacket *VAR_1,\nconst AVFrame *VAR_2, int *VAR_3)\n{", "int VAR_4, VAR_5, VAR_6, VAR_7;", "const int16_t *VAR_8 = VAR_2 ? (const int16_t *)VAR_2->data[0] : NULL;", "uint8_t *out;", "ROQDPCMContext *context = VAR_0->priv_data;", "VAR_5 = (VAR_0->channels == 2);", "if (!VAR_8 && context->input_frames >= 8)\nreturn 0;", "if (VAR_8 && context->input_frames < 8) {", "memcpy(&context->frame_buffer[context->buffered_samples * VAR_0->channels],\nVAR_8, VAR_0->frame_size * VAR_0->channels * sizeof(*VAR_8));", "context->buffered_samples += VAR_0->frame_size;", "if (context->input_frames == 0)\ncontext->first_pts = VAR_2->pts;", "if (context->input_frames < 7) {", "context->input_frames++;", "return 0;", "}", "}", "if (context->input_frames < 8) {", "VAR_8 = context->frame_buffer;", "}", "if (VAR_5) {", "context->lastSample[0] &= 0xFF00;", "context->lastSample[1] &= 0xFF00;", "}", "if (context->input_frames == 7)\nVAR_6 = VAR_0->channels * context->buffered_samples;", "else\nVAR_6 = VAR_0->channels * VAR_0->frame_size;", "if ((VAR_7 = ff_alloc_packet2(VAR_0, VAR_1, ROQ_HEADER_SIZE + VAR_6)))\nreturn VAR_7;", "out = VAR_1->data;", "bytestream_put_byte(&out, VAR_5 ? 0x21 : 0x20);", "bytestream_put_byte(&out, 0x10);", "bytestream_put_le32(&out, VAR_6);", "if (VAR_5) {", "bytestream_put_byte(&out, (context->lastSample[1])>>8);", "bytestream_put_byte(&out, (context->lastSample[0])>>8);", "} else", "bytestream_put_le16(&out, context->lastSample[0]);", "for (VAR_4 = 0; VAR_4 < VAR_6; VAR_4++)", "*out++ = dpcm_predict(&context->lastSample[VAR_4 & 1], *VAR_8++);", "VAR_1->pts = context->input_frames <= 7 ? context->first_pts : VAR_2->pts;", "VAR_1->duration = VAR_6 / VAR_0->channels;", "context->input_frames++;", "if (!VAR_8)\ncontext->input_frames = FFMAX(context->input_frames, 8);", "*VAR_3 = 1;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 21, 23 ], [ 27 ], [ 29, 31 ], [ 33 ], [ 35, 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 67, 69 ], [ 71, 73 ], [ 77, 79 ], [ 81 ], [ 85 ], [ 87 ], [ 89 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 107 ], [ 109 ], [ 113 ], [ 115 ], [ 119 ], [ 121, 123 ], [ 127 ], [ 129 ], [ 131 ] ]
7,475
static int twin_decode_frame(AVCodecContext * avctx, void *data, int *data_size, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; TwinContext *tctx = avctx->priv_data; GetBitContext gb; const ModeTab *mtab = tctx->mtab; float *out = data; enum FrameType ftype; int window_type; static const enum FrameType wtype_to_ftype_table[] = { FT_LONG, FT_LONG, FT_SHORT, FT_LONG, FT_MEDIUM, FT_LONG, FT_LONG, FT_MEDIUM, FT_MEDIUM }; if (buf_size*8 < avctx->bit_rate*mtab->size/avctx->sample_rate + 8) { av_log(avctx, AV_LOG_ERROR, "Frame too small (%d bytes). Truncated file?\n", buf_size); return AVERROR(EINVAL); } init_get_bits(&gb, buf, buf_size * 8); skip_bits(&gb, get_bits(&gb, 8)); window_type = get_bits(&gb, WINDOW_TYPE_BITS); if (window_type > 8) { av_log(avctx, AV_LOG_ERROR, "Invalid window type, broken sample?\n"); return -1; } ftype = wtype_to_ftype_table[window_type]; read_and_decode_spectrum(tctx, &gb, tctx->spectrum, ftype); imdct_output(tctx, ftype, window_type, out); FFSWAP(float*, tctx->curr_frame, tctx->prev_frame); if (tctx->avctx->frame_number < 2) { *data_size=0; return buf_size; } *data_size = mtab->size*avctx->channels*4; return buf_size; }
false
FFmpeg
e53eecd0e7211973a1a9757f559bdd93a1848901
static int twin_decode_frame(AVCodecContext * avctx, void *data, int *data_size, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; TwinContext *tctx = avctx->priv_data; GetBitContext gb; const ModeTab *mtab = tctx->mtab; float *out = data; enum FrameType ftype; int window_type; static const enum FrameType wtype_to_ftype_table[] = { FT_LONG, FT_LONG, FT_SHORT, FT_LONG, FT_MEDIUM, FT_LONG, FT_LONG, FT_MEDIUM, FT_MEDIUM }; if (buf_size*8 < avctx->bit_rate*mtab->size/avctx->sample_rate + 8) { av_log(avctx, AV_LOG_ERROR, "Frame too small (%d bytes). Truncated file?\n", buf_size); return AVERROR(EINVAL); } init_get_bits(&gb, buf, buf_size * 8); skip_bits(&gb, get_bits(&gb, 8)); window_type = get_bits(&gb, WINDOW_TYPE_BITS); if (window_type > 8) { av_log(avctx, AV_LOG_ERROR, "Invalid window type, broken sample?\n"); return -1; } ftype = wtype_to_ftype_table[window_type]; read_and_decode_spectrum(tctx, &gb, tctx->spectrum, ftype); imdct_output(tctx, ftype, window_type, out); FFSWAP(float*, tctx->curr_frame, tctx->prev_frame); if (tctx->avctx->frame_number < 2) { *data_size=0; return buf_size; } *data_size = mtab->size*avctx->channels*4; return buf_size; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecContext * VAR_0, void *VAR_1, int *VAR_2, AVPacket *VAR_3) { const uint8_t *VAR_4 = VAR_3->VAR_1; int VAR_5 = VAR_3->size; TwinContext *tctx = VAR_0->priv_data; GetBitContext gb; const ModeTab *VAR_6 = tctx->VAR_6; float *VAR_7 = VAR_1; enum FrameType VAR_8; int VAR_9; static const enum FrameType VAR_10[] = { FT_LONG, FT_LONG, FT_SHORT, FT_LONG, FT_MEDIUM, FT_LONG, FT_LONG, FT_MEDIUM, FT_MEDIUM }; if (VAR_5*8 < VAR_0->bit_rate*VAR_6->size/VAR_0->sample_rate + 8) { av_log(VAR_0, AV_LOG_ERROR, "Frame too small (%d bytes). Truncated file?\n", VAR_5); return AVERROR(EINVAL); } init_get_bits(&gb, VAR_4, VAR_5 * 8); skip_bits(&gb, get_bits(&gb, 8)); VAR_9 = get_bits(&gb, WINDOW_TYPE_BITS); if (VAR_9 > 8) { av_log(VAR_0, AV_LOG_ERROR, "Invalid window type, broken sample?\n"); return -1; } VAR_8 = VAR_10[VAR_9]; read_and_decode_spectrum(tctx, &gb, tctx->spectrum, VAR_8); imdct_output(tctx, VAR_8, VAR_9, VAR_7); FFSWAP(float*, tctx->curr_frame, tctx->prev_frame); if (tctx->VAR_0->frame_number < 2) { *VAR_2=0; return VAR_5; } *VAR_2 = VAR_6->size*VAR_0->channels*4; return VAR_5; }
[ "static int FUNC_0(AVCodecContext * VAR_0, void *VAR_1,\nint *VAR_2, AVPacket *VAR_3)\n{", "const uint8_t *VAR_4 = VAR_3->VAR_1;", "int VAR_5 = VAR_3->size;", "TwinContext *tctx = VAR_0->priv_data;", "GetBitContext gb;", "const ModeTab *VAR_6 = tctx->VAR_6;", "float *VAR_7 = VAR_1;", "enum FrameType VAR_8;", "int VAR_9;", "static const enum FrameType VAR_10[] = {", "FT_LONG, FT_LONG, FT_SHORT, FT_LONG,\nFT_MEDIUM, FT_LONG, FT_LONG, FT_MEDIUM, FT_MEDIUM\n};", "if (VAR_5*8 < VAR_0->bit_rate*VAR_6->size/VAR_0->sample_rate + 8) {", "av_log(VAR_0, AV_LOG_ERROR,\n\"Frame too small (%d bytes). Truncated file?\\n\", VAR_5);", "return AVERROR(EINVAL);", "}", "init_get_bits(&gb, VAR_4, VAR_5 * 8);", "skip_bits(&gb, get_bits(&gb, 8));", "VAR_9 = get_bits(&gb, WINDOW_TYPE_BITS);", "if (VAR_9 > 8) {", "av_log(VAR_0, AV_LOG_ERROR, \"Invalid window type, broken sample?\\n\");", "return -1;", "}", "VAR_8 = VAR_10[VAR_9];", "read_and_decode_spectrum(tctx, &gb, tctx->spectrum, VAR_8);", "imdct_output(tctx, VAR_8, VAR_9, VAR_7);", "FFSWAP(float*, tctx->curr_frame, tctx->prev_frame);", "if (tctx->VAR_0->frame_number < 2) {", "*VAR_2=0;", "return VAR_5;", "}", "*VAR_2 = VAR_6->size*VAR_0->channels*4;", "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 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25, 27, 29 ], [ 33 ], [ 35, 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 63 ], [ 67 ], [ 71 ], [ 75 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 89 ], [ 93 ], [ 95 ] ]
7,476
matroska_parse_block(MatroskaDemuxContext *matroska, uint8_t *data, int size, int64_t pos, uint64_t cluster_time, int is_keyframe, int is_bframe, int *ptrack, AVPacket **ppkt) { int res = 0; int track; AVPacket *pkt; uint8_t *origdata = data; int16_t block_time; uint32_t *lace_size = NULL; int n, flags, laces = 0; uint64_t num; /* first byte(s): tracknum */ if ((n = matroska_ebmlnum_uint(data, size, &num)) < 0) { av_log(matroska->ctx, AV_LOG_ERROR, "EBML block data error\n"); av_free(origdata); return res; } data += n; size -= n; /* fetch track from num */ track = matroska_find_track_by_num(matroska, num); if (ptrack) *ptrack = track; if (size <= 3 || track < 0 || track >= matroska->num_tracks) { av_log(matroska->ctx, AV_LOG_INFO, "Invalid stream %d or size %u\n", track, size); av_free(origdata); return res; } if(matroska->ctx->streams[ matroska->tracks[track]->stream_index ]->discard >= AVDISCARD_ALL){ av_free(origdata); return res; } /* block_time (relative to cluster time) */ block_time = (data[0] << 8) | data[1]; data += 2; size -= 2; flags = *data; data += 1; size -= 1; if (is_keyframe == -1) is_keyframe = flags & 1 ? PKT_FLAG_KEY : 0; switch ((flags & 0x06) >> 1) { case 0x0: /* no lacing */ laces = 1; lace_size = av_mallocz(sizeof(int)); lace_size[0] = size; break; case 0x1: /* xiph lacing */ case 0x2: /* fixed-size lacing */ case 0x3: /* EBML lacing */ if (size == 0) { res = -1; break; } laces = (*data) + 1; data += 1; size -= 1; lace_size = av_mallocz(laces * sizeof(int)); switch ((flags & 0x06) >> 1) { case 0x1: /* xiph lacing */ { uint8_t temp; uint32_t total = 0; for (n = 0; res == 0 && n < laces - 1; n++) { while (1) { if (size == 0) { res = -1; break; } temp = *data; lace_size[n] += temp; data += 1; size -= 1; if (temp != 0xff) break; } total += lace_size[n]; } lace_size[n] = size - total; break; } case 0x2: /* fixed-size lacing */ for (n = 0; n < laces; n++) lace_size[n] = size / laces; break; case 0x3: /* EBML lacing */ { uint32_t total; n = matroska_ebmlnum_uint(data, size, &num); if (n < 0) { av_log(matroska->ctx, AV_LOG_INFO, "EBML block data error\n"); break; } data += n; size -= n; total = lace_size[0] = num; for (n = 1; res == 0 && n < laces - 1; n++) { int64_t snum; int r; r = matroska_ebmlnum_sint (data, size, &snum); if (r < 0) { av_log(matroska->ctx, AV_LOG_INFO, "EBML block data error\n"); break; } data += r; size -= r; lace_size[n] = lace_size[n - 1] + snum; total += lace_size[n]; } lace_size[n] = size - total; break; } } break; } if (res == 0) { int real_v = matroska->tracks[track]->flags & MATROSKA_TRACK_REAL_V; for (n = 0; n < laces; n++) { uint64_t timecode = AV_NOPTS_VALUE; int slice, slices = 1; if (real_v) { slices = *data++ + 1; lace_size[n]--; } if (cluster_time != (uint64_t)-1 && n == 0) { if (cluster_time + block_time >= 0) timecode = cluster_time + block_time; } /* FIXME: duration */ for (slice=0; slice<slices; slice++) { int slice_size, slice_offset = 0; if (real_v) slice_offset = rv_offset(data, slice, slices); if (slice+1 == slices) slice_size = lace_size[n] - slice_offset; else slice_size = rv_offset(data, slice+1, slices) - slice_offset; pkt = av_mallocz(sizeof(AVPacket)); if (ppkt) *ppkt = pkt; /* XXX: prevent data copy... */ if (av_new_packet(pkt, slice_size) < 0) { res = AVERROR_NOMEM; n = laces-1; break; } memcpy (pkt->data, data+slice_offset, slice_size); if (n == 0) pkt->flags = is_keyframe; pkt->stream_index = matroska->tracks[track]->stream_index; pkt->pts = timecode; pkt->pos = pos; if (matroska->tracks[track]->flags & MATROSKA_TRACK_REORDER) matroska_queue_packet_reordered(matroska, pkt, is_bframe); else matroska_queue_packet(matroska, pkt); } data += lace_size[n]; } } av_free(lace_size); av_free(origdata); return res; }
false
FFmpeg
916bf03a699e7ca681df994c2bc8330a087c8b0c
matroska_parse_block(MatroskaDemuxContext *matroska, uint8_t *data, int size, int64_t pos, uint64_t cluster_time, int is_keyframe, int is_bframe, int *ptrack, AVPacket **ppkt) { int res = 0; int track; AVPacket *pkt; uint8_t *origdata = data; int16_t block_time; uint32_t *lace_size = NULL; int n, flags, laces = 0; uint64_t num; if ((n = matroska_ebmlnum_uint(data, size, &num)) < 0) { av_log(matroska->ctx, AV_LOG_ERROR, "EBML block data error\n"); av_free(origdata); return res; } data += n; size -= n; track = matroska_find_track_by_num(matroska, num); if (ptrack) *ptrack = track; if (size <= 3 || track < 0 || track >= matroska->num_tracks) { av_log(matroska->ctx, AV_LOG_INFO, "Invalid stream %d or size %u\n", track, size); av_free(origdata); return res; } if(matroska->ctx->streams[ matroska->tracks[track]->stream_index ]->discard >= AVDISCARD_ALL){ av_free(origdata); return res; } block_time = (data[0] << 8) | data[1]; data += 2; size -= 2; flags = *data; data += 1; size -= 1; if (is_keyframe == -1) is_keyframe = flags & 1 ? PKT_FLAG_KEY : 0; switch ((flags & 0x06) >> 1) { case 0x0: laces = 1; lace_size = av_mallocz(sizeof(int)); lace_size[0] = size; break; case 0x1: case 0x2: case 0x3: if (size == 0) { res = -1; break; } laces = (*data) + 1; data += 1; size -= 1; lace_size = av_mallocz(laces * sizeof(int)); switch ((flags & 0x06) >> 1) { case 0x1: { uint8_t temp; uint32_t total = 0; for (n = 0; res == 0 && n < laces - 1; n++) { while (1) { if (size == 0) { res = -1; break; } temp = *data; lace_size[n] += temp; data += 1; size -= 1; if (temp != 0xff) break; } total += lace_size[n]; } lace_size[n] = size - total; break; } case 0x2: for (n = 0; n < laces; n++) lace_size[n] = size / laces; break; case 0x3: { uint32_t total; n = matroska_ebmlnum_uint(data, size, &num); if (n < 0) { av_log(matroska->ctx, AV_LOG_INFO, "EBML block data error\n"); break; } data += n; size -= n; total = lace_size[0] = num; for (n = 1; res == 0 && n < laces - 1; n++) { int64_t snum; int r; r = matroska_ebmlnum_sint (data, size, &snum); if (r < 0) { av_log(matroska->ctx, AV_LOG_INFO, "EBML block data error\n"); break; } data += r; size -= r; lace_size[n] = lace_size[n - 1] + snum; total += lace_size[n]; } lace_size[n] = size - total; break; } } break; } if (res == 0) { int real_v = matroska->tracks[track]->flags & MATROSKA_TRACK_REAL_V; for (n = 0; n < laces; n++) { uint64_t timecode = AV_NOPTS_VALUE; int slice, slices = 1; if (real_v) { slices = *data++ + 1; lace_size[n]--; } if (cluster_time != (uint64_t)-1 && n == 0) { if (cluster_time + block_time >= 0) timecode = cluster_time + block_time; } for (slice=0; slice<slices; slice++) { int slice_size, slice_offset = 0; if (real_v) slice_offset = rv_offset(data, slice, slices); if (slice+1 == slices) slice_size = lace_size[n] - slice_offset; else slice_size = rv_offset(data, slice+1, slices) - slice_offset; pkt = av_mallocz(sizeof(AVPacket)); if (ppkt) *ppkt = pkt; if (av_new_packet(pkt, slice_size) < 0) { res = AVERROR_NOMEM; n = laces-1; break; } memcpy (pkt->data, data+slice_offset, slice_size); if (n == 0) pkt->flags = is_keyframe; pkt->stream_index = matroska->tracks[track]->stream_index; pkt->pts = timecode; pkt->pos = pos; if (matroska->tracks[track]->flags & MATROSKA_TRACK_REORDER) matroska_queue_packet_reordered(matroska, pkt, is_bframe); else matroska_queue_packet(matroska, pkt); } data += lace_size[n]; } } av_free(lace_size); av_free(origdata); return res; }
{ "code": [], "line_no": [] }
FUNC_0(MatroskaDemuxContext *VAR_0, uint8_t *VAR_1, int VAR_2, int64_t VAR_3, uint64_t VAR_4, int VAR_5, int VAR_6, int *VAR_7, AVPacket **VAR_8) { int VAR_9 = 0; int VAR_10; AVPacket *pkt; uint8_t *origdata = VAR_1; int16_t block_time; uint32_t *lace_size = NULL; int VAR_11, VAR_12, VAR_13 = 0; uint64_t num; if ((VAR_11 = matroska_ebmlnum_uint(VAR_1, VAR_2, &num)) < 0) { av_log(VAR_0->ctx, AV_LOG_ERROR, "EBML block VAR_1 error\VAR_11"); av_free(origdata); return VAR_9; } VAR_1 += VAR_11; VAR_2 -= VAR_11; VAR_10 = matroska_find_track_by_num(VAR_0, num); if (VAR_7) *VAR_7 = VAR_10; if (VAR_2 <= 3 || VAR_10 < 0 || VAR_10 >= VAR_0->num_tracks) { av_log(VAR_0->ctx, AV_LOG_INFO, "Invalid stream %d or VAR_2 %u\VAR_11", VAR_10, VAR_2); av_free(origdata); return VAR_9; } if(VAR_0->ctx->streams[ VAR_0->tracks[VAR_10]->stream_index ]->discard >= AVDISCARD_ALL){ av_free(origdata); return VAR_9; } block_time = (VAR_1[0] << 8) | VAR_1[1]; VAR_1 += 2; VAR_2 -= 2; VAR_12 = *VAR_1; VAR_1 += 1; VAR_2 -= 1; if (VAR_5 == -1) VAR_5 = VAR_12 & 1 ? PKT_FLAG_KEY : 0; switch ((VAR_12 & 0x06) >> 1) { case 0x0: VAR_13 = 1; lace_size = av_mallocz(sizeof(int)); lace_size[0] = VAR_2; break; case 0x1: case 0x2: case 0x3: if (VAR_2 == 0) { VAR_9 = -1; break; } VAR_13 = (*VAR_1) + 1; VAR_1 += 1; VAR_2 -= 1; lace_size = av_mallocz(VAR_13 * sizeof(int)); switch ((VAR_12 & 0x06) >> 1) { case 0x1: { uint8_t temp; uint32_t total = 0; for (VAR_11 = 0; VAR_9 == 0 && VAR_11 < VAR_13 - 1; VAR_11++) { while (1) { if (VAR_2 == 0) { VAR_9 = -1; break; } temp = *VAR_1; lace_size[VAR_11] += temp; VAR_1 += 1; VAR_2 -= 1; if (temp != 0xff) break; } total += lace_size[VAR_11]; } lace_size[VAR_11] = VAR_2 - total; break; } case 0x2: for (VAR_11 = 0; VAR_11 < VAR_13; VAR_11++) lace_size[VAR_11] = VAR_2 / VAR_13; break; case 0x3: { uint32_t total; VAR_11 = matroska_ebmlnum_uint(VAR_1, VAR_2, &num); if (VAR_11 < 0) { av_log(VAR_0->ctx, AV_LOG_INFO, "EBML block VAR_1 error\VAR_11"); break; } VAR_1 += VAR_11; VAR_2 -= VAR_11; total = lace_size[0] = num; for (VAR_11 = 1; VAR_9 == 0 && VAR_11 < VAR_13 - 1; VAR_11++) { int64_t snum; int VAR_14; VAR_14 = matroska_ebmlnum_sint (VAR_1, VAR_2, &snum); if (VAR_14 < 0) { av_log(VAR_0->ctx, AV_LOG_INFO, "EBML block VAR_1 error\VAR_11"); break; } VAR_1 += VAR_14; VAR_2 -= VAR_14; lace_size[VAR_11] = lace_size[VAR_11 - 1] + snum; total += lace_size[VAR_11]; } lace_size[VAR_11] = VAR_2 - total; break; } } break; } if (VAR_9 == 0) { int VAR_15 = VAR_0->tracks[VAR_10]->VAR_12 & MATROSKA_TRACK_REAL_V; for (VAR_11 = 0; VAR_11 < VAR_13; VAR_11++) { uint64_t timecode = AV_NOPTS_VALUE; int VAR_16, VAR_17 = 1; if (VAR_15) { VAR_17 = *VAR_1++ + 1; lace_size[VAR_11]--; } if (VAR_4 != (uint64_t)-1 && VAR_11 == 0) { if (VAR_4 + block_time >= 0) timecode = VAR_4 + block_time; } for (VAR_16=0; VAR_16<VAR_17; VAR_16++) { int VAR_18, VAR_19 = 0; if (VAR_15) VAR_19 = rv_offset(VAR_1, VAR_16, VAR_17); if (VAR_16+1 == VAR_17) VAR_18 = lace_size[VAR_11] - VAR_19; else VAR_18 = rv_offset(VAR_1, VAR_16+1, VAR_17) - VAR_19; pkt = av_mallocz(sizeof(AVPacket)); if (VAR_8) *VAR_8 = pkt; if (av_new_packet(pkt, VAR_18) < 0) { VAR_9 = AVERROR_NOMEM; VAR_11 = VAR_13-1; break; } memcpy (pkt->VAR_1, VAR_1+VAR_19, VAR_18); if (VAR_11 == 0) pkt->VAR_12 = VAR_5; pkt->stream_index = VAR_0->tracks[VAR_10]->stream_index; pkt->pts = timecode; pkt->VAR_3 = VAR_3; if (VAR_0->tracks[VAR_10]->VAR_12 & MATROSKA_TRACK_REORDER) matroska_queue_packet_reordered(VAR_0, pkt, VAR_6); else matroska_queue_packet(VAR_0, pkt); } VAR_1 += lace_size[VAR_11]; } } av_free(lace_size); av_free(origdata); return VAR_9; }
[ "FUNC_0(MatroskaDemuxContext *VAR_0, uint8_t *VAR_1, int VAR_2,\nint64_t VAR_3, uint64_t VAR_4,\nint VAR_5, int VAR_6,\nint *VAR_7, AVPacket **VAR_8)\n{", "int VAR_9 = 0;", "int VAR_10;", "AVPacket *pkt;", "uint8_t *origdata = VAR_1;", "int16_t block_time;", "uint32_t *lace_size = NULL;", "int VAR_11, VAR_12, VAR_13 = 0;", "uint64_t num;", "if ((VAR_11 = matroska_ebmlnum_uint(VAR_1, VAR_2, &num)) < 0) {", "av_log(VAR_0->ctx, AV_LOG_ERROR, \"EBML block VAR_1 error\\VAR_11\");", "av_free(origdata);", "return VAR_9;", "}", "VAR_1 += VAR_11;", "VAR_2 -= VAR_11;", "VAR_10 = matroska_find_track_by_num(VAR_0, num);", "if (VAR_7) *VAR_7 = VAR_10;", "if (VAR_2 <= 3 || VAR_10 < 0 || VAR_10 >= VAR_0->num_tracks) {", "av_log(VAR_0->ctx, AV_LOG_INFO,\n\"Invalid stream %d or VAR_2 %u\\VAR_11\", VAR_10, VAR_2);", "av_free(origdata);", "return VAR_9;", "}", "if(VAR_0->ctx->streams[ VAR_0->tracks[VAR_10]->stream_index ]->discard >= AVDISCARD_ALL){", "av_free(origdata);", "return VAR_9;", "}", "block_time = (VAR_1[0] << 8) | VAR_1[1];", "VAR_1 += 2;", "VAR_2 -= 2;", "VAR_12 = *VAR_1;", "VAR_1 += 1;", "VAR_2 -= 1;", "if (VAR_5 == -1)\nVAR_5 = VAR_12 & 1 ? PKT_FLAG_KEY : 0;", "switch ((VAR_12 & 0x06) >> 1) {", "case 0x0:\nVAR_13 = 1;", "lace_size = av_mallocz(sizeof(int));", "lace_size[0] = VAR_2;", "break;", "case 0x1:\ncase 0x2:\ncase 0x3:\nif (VAR_2 == 0) {", "VAR_9 = -1;", "break;", "}", "VAR_13 = (*VAR_1) + 1;", "VAR_1 += 1;", "VAR_2 -= 1;", "lace_size = av_mallocz(VAR_13 * sizeof(int));", "switch ((VAR_12 & 0x06) >> 1) {", "case 0x1: {", "uint8_t temp;", "uint32_t total = 0;", "for (VAR_11 = 0; VAR_9 == 0 && VAR_11 < VAR_13 - 1; VAR_11++) {", "while (1) {", "if (VAR_2 == 0) {", "VAR_9 = -1;", "break;", "}", "temp = *VAR_1;", "lace_size[VAR_11] += temp;", "VAR_1 += 1;", "VAR_2 -= 1;", "if (temp != 0xff)\nbreak;", "}", "total += lace_size[VAR_11];", "}", "lace_size[VAR_11] = VAR_2 - total;", "break;", "}", "case 0x2:\nfor (VAR_11 = 0; VAR_11 < VAR_13; VAR_11++)", "lace_size[VAR_11] = VAR_2 / VAR_13;", "break;", "case 0x3: {", "uint32_t total;", "VAR_11 = matroska_ebmlnum_uint(VAR_1, VAR_2, &num);", "if (VAR_11 < 0) {", "av_log(VAR_0->ctx, AV_LOG_INFO,\n\"EBML block VAR_1 error\\VAR_11\");", "break;", "}", "VAR_1 += VAR_11;", "VAR_2 -= VAR_11;", "total = lace_size[0] = num;", "for (VAR_11 = 1; VAR_9 == 0 && VAR_11 < VAR_13 - 1; VAR_11++) {", "int64_t snum;", "int VAR_14;", "VAR_14 = matroska_ebmlnum_sint (VAR_1, VAR_2, &snum);", "if (VAR_14 < 0) {", "av_log(VAR_0->ctx, AV_LOG_INFO,\n\"EBML block VAR_1 error\\VAR_11\");", "break;", "}", "VAR_1 += VAR_14;", "VAR_2 -= VAR_14;", "lace_size[VAR_11] = lace_size[VAR_11 - 1] + snum;", "total += lace_size[VAR_11];", "}", "lace_size[VAR_11] = VAR_2 - total;", "break;", "}", "}", "break;", "}", "if (VAR_9 == 0) {", "int VAR_15 = VAR_0->tracks[VAR_10]->VAR_12 & MATROSKA_TRACK_REAL_V;", "for (VAR_11 = 0; VAR_11 < VAR_13; VAR_11++) {", "uint64_t timecode = AV_NOPTS_VALUE;", "int VAR_16, VAR_17 = 1;", "if (VAR_15) {", "VAR_17 = *VAR_1++ + 1;", "lace_size[VAR_11]--;", "}", "if (VAR_4 != (uint64_t)-1 && VAR_11 == 0) {", "if (VAR_4 + block_time >= 0)\ntimecode = VAR_4 + block_time;", "}", "for (VAR_16=0; VAR_16<VAR_17; VAR_16++) {", "int VAR_18, VAR_19 = 0;", "if (VAR_15)\nVAR_19 = rv_offset(VAR_1, VAR_16, VAR_17);", "if (VAR_16+1 == VAR_17)\nVAR_18 = lace_size[VAR_11] - VAR_19;", "else\nVAR_18 = rv_offset(VAR_1, VAR_16+1, VAR_17) - VAR_19;", "pkt = av_mallocz(sizeof(AVPacket));", "if (VAR_8) *VAR_8 = pkt;", "if (av_new_packet(pkt, VAR_18) < 0) {", "VAR_9 = AVERROR_NOMEM;", "VAR_11 = VAR_13-1;", "break;", "}", "memcpy (pkt->VAR_1, VAR_1+VAR_19, VAR_18);", "if (VAR_11 == 0)\npkt->VAR_12 = VAR_5;", "pkt->stream_index = VAR_0->tracks[VAR_10]->stream_index;", "pkt->pts = timecode;", "pkt->VAR_3 = VAR_3;", "if (VAR_0->tracks[VAR_10]->VAR_12 & MATROSKA_TRACK_REORDER)\nmatroska_queue_packet_reordered(VAR_0, pkt, VAR_6);", "else\nmatroska_queue_packet(VAR_0, pkt);", "}", "VAR_1 += lace_size[VAR_11];", "}", "}", "av_free(lace_size);", "av_free(origdata);", "return VAR_9;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 49 ], [ 51 ], [ 53 ], [ 55, 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89, 91 ], [ 93 ], [ 95, 97 ], [ 99 ], [ 101 ], [ 103 ], [ 107, 109, 111, 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159, 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 177, 179 ], [ 181 ], [ 183 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195, 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 219, 221 ], [ 223 ], [ 225 ], [ 227 ], [ 229 ], [ 231 ], [ 233 ], [ 235 ], [ 237 ], [ 239 ], [ 241 ], [ 243 ], [ 245 ], [ 247 ], [ 251 ], [ 253 ], [ 255 ], [ 257 ], [ 259 ], [ 263 ], [ 265 ], [ 267 ], [ 269 ], [ 271 ], [ 273, 275 ], [ 277 ], [ 283 ], [ 285 ], [ 287, 289 ], [ 291, 293 ], [ 295, 297 ], [ 299 ], [ 301 ], [ 305 ], [ 307 ], [ 309 ], [ 311 ], [ 313 ], [ 315 ], [ 319, 321 ], [ 323 ], [ 327 ], [ 329 ], [ 333, 335 ], [ 337, 339 ], [ 341 ], [ 343 ], [ 345 ], [ 347 ], [ 351 ], [ 353 ], [ 355 ], [ 357 ] ]
7,477
static void clipper_init(MachineState *machine) { ram_addr_t ram_size = machine->ram_size; const char *cpu_model = machine->cpu_model; const char *kernel_filename = machine->kernel_filename; const char *kernel_cmdline = machine->kernel_cmdline; const char *initrd_filename = machine->initrd_filename; AlphaCPU *cpus[4]; PCIBus *pci_bus; ISABus *isa_bus; qemu_irq rtc_irq; long size, i; char *palcode_filename; uint64_t palcode_entry, palcode_low, palcode_high; uint64_t kernel_entry, kernel_low, kernel_high; /* Create up to 4 cpus. */ memset(cpus, 0, sizeof(cpus)); for (i = 0; i < smp_cpus; ++i) { cpus[i] = cpu_alpha_init(cpu_model ? cpu_model : "ev67"); } cpus[0]->env.trap_arg0 = ram_size; cpus[0]->env.trap_arg1 = 0; cpus[0]->env.trap_arg2 = smp_cpus; /* Init the chipset. */ pci_bus = typhoon_init(ram_size, &isa_bus, &rtc_irq, cpus, clipper_pci_map_irq); /* Since we have an SRM-compatible PALcode, use the SRM epoch. */ rtc_init(isa_bus, 1900, rtc_irq); pit_init(isa_bus, 0x40, 0, NULL); isa_create_simple(isa_bus, "i8042"); /* VGA setup. Don't bother loading the bios. */ pci_vga_init(pci_bus); /* Serial code setup. */ serial_hds_isa_init(isa_bus, 0, MAX_SERIAL_PORTS); /* Network setup. e1000 is good enough, failing Tulip support. */ for (i = 0; i < nb_nics; i++) { pci_nic_init_nofail(&nd_table[i], pci_bus, "e1000", NULL); } /* IDE disk setup. */ { DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; ide_drive_get(hd, ARRAY_SIZE(hd)); pci_cmd646_ide_init(pci_bus, hd, 0); } /* Load PALcode. Given that this is not "real" cpu palcode, but one explicitly written for the emulation, we might as well load it directly from and ELF image. */ palcode_filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name ? bios_name : "palcode-clipper"); if (palcode_filename == NULL) { error_report("no palcode provided"); exit(1); } size = load_elf(palcode_filename, cpu_alpha_superpage_to_phys, NULL, &palcode_entry, &palcode_low, &palcode_high, 0, EM_ALPHA, 0, 0); if (size < 0) { error_report("could not load palcode '%s'", palcode_filename); exit(1); } g_free(palcode_filename); /* Start all cpus at the PALcode RESET entry point. */ for (i = 0; i < smp_cpus; ++i) { cpus[i]->env.pc = palcode_entry; cpus[i]->env.palbr = palcode_entry; } /* Load a kernel. */ if (kernel_filename) { uint64_t param_offset; size = load_elf(kernel_filename, cpu_alpha_superpage_to_phys, NULL, &kernel_entry, &kernel_low, &kernel_high, 0, EM_ALPHA, 0, 0); if (size < 0) { error_report("could not load kernel '%s'", kernel_filename); exit(1); } cpus[0]->env.trap_arg1 = kernel_entry; param_offset = kernel_low - 0x6000; if (kernel_cmdline) { pstrcpy_targphys("cmdline", param_offset, 0x100, kernel_cmdline); } if (initrd_filename) { long initrd_base, initrd_size; initrd_size = get_image_size(initrd_filename); if (initrd_size < 0) { error_report("could not load initial ram disk '%s'", initrd_filename); exit(1); } /* Put the initrd image as high in memory as possible. */ initrd_base = (ram_size - initrd_size) & TARGET_PAGE_MASK; load_image_targphys(initrd_filename, initrd_base, ram_size - initrd_base); address_space_stq(&address_space_memory, param_offset + 0x100, initrd_base + 0xfffffc0000000000ULL, MEMTXATTRS_UNSPECIFIED, NULL); address_space_stq(&address_space_memory, param_offset + 0x108, initrd_size, MEMTXATTRS_UNSPECIFIED, NULL); } } }
false
qemu
82a3d1f81f8e401c6c34cba541970197aba2bb9a
static void clipper_init(MachineState *machine) { ram_addr_t ram_size = machine->ram_size; const char *cpu_model = machine->cpu_model; const char *kernel_filename = machine->kernel_filename; const char *kernel_cmdline = machine->kernel_cmdline; const char *initrd_filename = machine->initrd_filename; AlphaCPU *cpus[4]; PCIBus *pci_bus; ISABus *isa_bus; qemu_irq rtc_irq; long size, i; char *palcode_filename; uint64_t palcode_entry, palcode_low, palcode_high; uint64_t kernel_entry, kernel_low, kernel_high; memset(cpus, 0, sizeof(cpus)); for (i = 0; i < smp_cpus; ++i) { cpus[i] = cpu_alpha_init(cpu_model ? cpu_model : "ev67"); } cpus[0]->env.trap_arg0 = ram_size; cpus[0]->env.trap_arg1 = 0; cpus[0]->env.trap_arg2 = smp_cpus; pci_bus = typhoon_init(ram_size, &isa_bus, &rtc_irq, cpus, clipper_pci_map_irq); rtc_init(isa_bus, 1900, rtc_irq); pit_init(isa_bus, 0x40, 0, NULL); isa_create_simple(isa_bus, "i8042"); pci_vga_init(pci_bus); serial_hds_isa_init(isa_bus, 0, MAX_SERIAL_PORTS); for (i = 0; i < nb_nics; i++) { pci_nic_init_nofail(&nd_table[i], pci_bus, "e1000", NULL); } { DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; ide_drive_get(hd, ARRAY_SIZE(hd)); pci_cmd646_ide_init(pci_bus, hd, 0); } palcode_filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name ? bios_name : "palcode-clipper"); if (palcode_filename == NULL) { error_report("no palcode provided"); exit(1); } size = load_elf(palcode_filename, cpu_alpha_superpage_to_phys, NULL, &palcode_entry, &palcode_low, &palcode_high, 0, EM_ALPHA, 0, 0); if (size < 0) { error_report("could not load palcode '%s'", palcode_filename); exit(1); } g_free(palcode_filename); for (i = 0; i < smp_cpus; ++i) { cpus[i]->env.pc = palcode_entry; cpus[i]->env.palbr = palcode_entry; } if (kernel_filename) { uint64_t param_offset; size = load_elf(kernel_filename, cpu_alpha_superpage_to_phys, NULL, &kernel_entry, &kernel_low, &kernel_high, 0, EM_ALPHA, 0, 0); if (size < 0) { error_report("could not load kernel '%s'", kernel_filename); exit(1); } cpus[0]->env.trap_arg1 = kernel_entry; param_offset = kernel_low - 0x6000; if (kernel_cmdline) { pstrcpy_targphys("cmdline", param_offset, 0x100, kernel_cmdline); } if (initrd_filename) { long initrd_base, initrd_size; initrd_size = get_image_size(initrd_filename); if (initrd_size < 0) { error_report("could not load initial ram disk '%s'", initrd_filename); exit(1); } initrd_base = (ram_size - initrd_size) & TARGET_PAGE_MASK; load_image_targphys(initrd_filename, initrd_base, ram_size - initrd_base); address_space_stq(&address_space_memory, param_offset + 0x100, initrd_base + 0xfffffc0000000000ULL, MEMTXATTRS_UNSPECIFIED, NULL); address_space_stq(&address_space_memory, param_offset + 0x108, initrd_size, MEMTXATTRS_UNSPECIFIED, NULL); } } }
{ "code": [], "line_no": [] }
static void FUNC_0(MachineState *VAR_0) { ram_addr_t ram_size = VAR_0->ram_size; const char *VAR_1 = VAR_0->VAR_1; const char *VAR_2 = VAR_0->VAR_2; const char *VAR_3 = VAR_0->VAR_3; const char *VAR_4 = VAR_0->VAR_4; AlphaCPU *cpus[4]; PCIBus *pci_bus; ISABus *isa_bus; qemu_irq rtc_irq; long VAR_5, VAR_6; char *VAR_7; uint64_t palcode_entry, palcode_low, palcode_high; uint64_t kernel_entry, kernel_low, kernel_high; memset(cpus, 0, sizeof(cpus)); for (VAR_6 = 0; VAR_6 < smp_cpus; ++VAR_6) { cpus[VAR_6] = cpu_alpha_init(VAR_1 ? VAR_1 : "ev67"); } cpus[0]->env.trap_arg0 = ram_size; cpus[0]->env.trap_arg1 = 0; cpus[0]->env.trap_arg2 = smp_cpus; pci_bus = typhoon_init(ram_size, &isa_bus, &rtc_irq, cpus, clipper_pci_map_irq); rtc_init(isa_bus, 1900, rtc_irq); pit_init(isa_bus, 0x40, 0, NULL); isa_create_simple(isa_bus, "i8042"); pci_vga_init(pci_bus); serial_hds_isa_init(isa_bus, 0, MAX_SERIAL_PORTS); for (VAR_6 = 0; VAR_6 < nb_nics; VAR_6++) { pci_nic_init_nofail(&nd_table[VAR_6], pci_bus, "e1000", NULL); } { DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; ide_drive_get(hd, ARRAY_SIZE(hd)); pci_cmd646_ide_init(pci_bus, hd, 0); } VAR_7 = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name ? bios_name : "palcode-clipper"); if (VAR_7 == NULL) { error_report("no palcode provided"); exit(1); } VAR_5 = load_elf(VAR_7, cpu_alpha_superpage_to_phys, NULL, &palcode_entry, &palcode_low, &palcode_high, 0, EM_ALPHA, 0, 0); if (VAR_5 < 0) { error_report("could not load palcode '%s'", VAR_7); exit(1); } g_free(VAR_7); for (VAR_6 = 0; VAR_6 < smp_cpus; ++VAR_6) { cpus[VAR_6]->env.pc = palcode_entry; cpus[VAR_6]->env.palbr = palcode_entry; } if (VAR_2) { uint64_t param_offset; VAR_5 = load_elf(VAR_2, cpu_alpha_superpage_to_phys, NULL, &kernel_entry, &kernel_low, &kernel_high, 0, EM_ALPHA, 0, 0); if (VAR_5 < 0) { error_report("could not load kernel '%s'", VAR_2); exit(1); } cpus[0]->env.trap_arg1 = kernel_entry; param_offset = kernel_low - 0x6000; if (VAR_3) { pstrcpy_targphys("cmdline", param_offset, 0x100, VAR_3); } if (VAR_4) { long VAR_8, VAR_9; VAR_9 = get_image_size(VAR_4); if (VAR_9 < 0) { error_report("could not load initial ram disk '%s'", VAR_4); exit(1); } VAR_8 = (ram_size - VAR_9) & TARGET_PAGE_MASK; load_image_targphys(VAR_4, VAR_8, ram_size - VAR_8); address_space_stq(&address_space_memory, param_offset + 0x100, VAR_8 + 0xfffffc0000000000ULL, MEMTXATTRS_UNSPECIFIED, NULL); address_space_stq(&address_space_memory, param_offset + 0x108, VAR_9, MEMTXATTRS_UNSPECIFIED, NULL); } } }
[ "static void FUNC_0(MachineState *VAR_0)\n{", "ram_addr_t ram_size = VAR_0->ram_size;", "const char *VAR_1 = VAR_0->VAR_1;", "const char *VAR_2 = VAR_0->VAR_2;", "const char *VAR_3 = VAR_0->VAR_3;", "const char *VAR_4 = VAR_0->VAR_4;", "AlphaCPU *cpus[4];", "PCIBus *pci_bus;", "ISABus *isa_bus;", "qemu_irq rtc_irq;", "long VAR_5, VAR_6;", "char *VAR_7;", "uint64_t palcode_entry, palcode_low, palcode_high;", "uint64_t kernel_entry, kernel_low, kernel_high;", "memset(cpus, 0, sizeof(cpus));", "for (VAR_6 = 0; VAR_6 < smp_cpus; ++VAR_6) {", "cpus[VAR_6] = cpu_alpha_init(VAR_1 ? VAR_1 : \"ev67\");", "}", "cpus[0]->env.trap_arg0 = ram_size;", "cpus[0]->env.trap_arg1 = 0;", "cpus[0]->env.trap_arg2 = smp_cpus;", "pci_bus = typhoon_init(ram_size, &isa_bus, &rtc_irq, cpus,\nclipper_pci_map_irq);", "rtc_init(isa_bus, 1900, rtc_irq);", "pit_init(isa_bus, 0x40, 0, NULL);", "isa_create_simple(isa_bus, \"i8042\");", "pci_vga_init(pci_bus);", "serial_hds_isa_init(isa_bus, 0, MAX_SERIAL_PORTS);", "for (VAR_6 = 0; VAR_6 < nb_nics; VAR_6++) {", "pci_nic_init_nofail(&nd_table[VAR_6], pci_bus, \"e1000\", NULL);", "}", "{", "DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS];", "ide_drive_get(hd, ARRAY_SIZE(hd));", "pci_cmd646_ide_init(pci_bus, hd, 0);", "}", "VAR_7 = qemu_find_file(QEMU_FILE_TYPE_BIOS,\nbios_name ? bios_name : \"palcode-clipper\");", "if (VAR_7 == NULL) {", "error_report(\"no palcode provided\");", "exit(1);", "}", "VAR_5 = load_elf(VAR_7, cpu_alpha_superpage_to_phys,\nNULL, &palcode_entry, &palcode_low, &palcode_high,\n0, EM_ALPHA, 0, 0);", "if (VAR_5 < 0) {", "error_report(\"could not load palcode '%s'\", VAR_7);", "exit(1);", "}", "g_free(VAR_7);", "for (VAR_6 = 0; VAR_6 < smp_cpus; ++VAR_6) {", "cpus[VAR_6]->env.pc = palcode_entry;", "cpus[VAR_6]->env.palbr = palcode_entry;", "}", "if (VAR_2) {", "uint64_t param_offset;", "VAR_5 = load_elf(VAR_2, cpu_alpha_superpage_to_phys,\nNULL, &kernel_entry, &kernel_low, &kernel_high,\n0, EM_ALPHA, 0, 0);", "if (VAR_5 < 0) {", "error_report(\"could not load kernel '%s'\", VAR_2);", "exit(1);", "}", "cpus[0]->env.trap_arg1 = kernel_entry;", "param_offset = kernel_low - 0x6000;", "if (VAR_3) {", "pstrcpy_targphys(\"cmdline\", param_offset, 0x100, VAR_3);", "}", "if (VAR_4) {", "long VAR_8, VAR_9;", "VAR_9 = get_image_size(VAR_4);", "if (VAR_9 < 0) {", "error_report(\"could not load initial ram disk '%s'\",\nVAR_4);", "exit(1);", "}", "VAR_8 = (ram_size - VAR_9) & TARGET_PAGE_MASK;", "load_image_targphys(VAR_4, VAR_8,\nram_size - VAR_8);", "address_space_stq(&address_space_memory, param_offset + 0x100,\nVAR_8 + 0xfffffc0000000000ULL,\nMEMTXATTRS_UNSPECIFIED,\nNULL);", "address_space_stq(&address_space_memory, param_offset + 0x108,\nVAR_9, MEMTXATTRS_UNSPECIFIED, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 55, 57 ], [ 63 ], [ 67 ], [ 69 ], [ 75 ], [ 81 ], [ 87 ], [ 89 ], [ 91 ], [ 97 ], [ 99 ], [ 101 ], [ 105 ], [ 107 ], [ 117, 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129, 131, 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 161 ], [ 163 ], [ 167, 169, 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 183 ], [ 187 ], [ 191 ], [ 193 ], [ 195 ], [ 199 ], [ 201 ], [ 205 ], [ 207 ], [ 209, 211 ], [ 213 ], [ 215 ], [ 221 ], [ 223, 225 ], [ 229, 231, 233, 235 ], [ 237, 239 ], [ 241 ], [ 243 ], [ 245 ] ]
7,478
void ff_thread_flush(AVCodecContext *avctx) { FrameThreadContext *fctx = avctx->thread_opaque; if (!avctx->thread_opaque) return; park_frame_worker_threads(fctx, avctx->thread_count); if (fctx->prev_thread) { if (fctx->prev_thread != &fctx->threads[0]) update_context_from_thread(fctx->threads[0].avctx, fctx->prev_thread->avctx, 0); if (avctx->codec->flush) avctx->codec->flush(fctx->threads[0].avctx); } fctx->next_decoding = fctx->next_finished = 0; fctx->delaying = 1; fctx->prev_thread = NULL; // Make sure decode flush calls with size=0 won't return old frames for (int i = 0; i < avctx->thread_count; i++) fctx->threads[i].got_frame = 0; }
false
FFmpeg
147ee4cf065a20bbba10292b496a037e6573cd6e
void ff_thread_flush(AVCodecContext *avctx) { FrameThreadContext *fctx = avctx->thread_opaque; if (!avctx->thread_opaque) return; park_frame_worker_threads(fctx, avctx->thread_count); if (fctx->prev_thread) { if (fctx->prev_thread != &fctx->threads[0]) update_context_from_thread(fctx->threads[0].avctx, fctx->prev_thread->avctx, 0); if (avctx->codec->flush) avctx->codec->flush(fctx->threads[0].avctx); } fctx->next_decoding = fctx->next_finished = 0; fctx->delaying = 1; fctx->prev_thread = NULL; for (int i = 0; i < avctx->thread_count; i++) fctx->threads[i].got_frame = 0; }
{ "code": [], "line_no": [] }
void FUNC_0(AVCodecContext *VAR_0) { FrameThreadContext *fctx = VAR_0->thread_opaque; if (!VAR_0->thread_opaque) return; park_frame_worker_threads(fctx, VAR_0->thread_count); if (fctx->prev_thread) { if (fctx->prev_thread != &fctx->threads[0]) update_context_from_thread(fctx->threads[0].VAR_0, fctx->prev_thread->VAR_0, 0); if (VAR_0->codec->flush) VAR_0->codec->flush(fctx->threads[0].VAR_0); } fctx->next_decoding = fctx->next_finished = 0; fctx->delaying = 1; fctx->prev_thread = NULL; for (int i = 0; i < VAR_0->thread_count; i++) fctx->threads[i].got_frame = 0; }
[ "void FUNC_0(AVCodecContext *VAR_0)\n{", "FrameThreadContext *fctx = VAR_0->thread_opaque;", "if (!VAR_0->thread_opaque) return;", "park_frame_worker_threads(fctx, VAR_0->thread_count);", "if (fctx->prev_thread) {", "if (fctx->prev_thread != &fctx->threads[0])\nupdate_context_from_thread(fctx->threads[0].VAR_0, fctx->prev_thread->VAR_0, 0);", "if (VAR_0->codec->flush)\nVAR_0->codec->flush(fctx->threads[0].VAR_0);", "}", "fctx->next_decoding = fctx->next_finished = 0;", "fctx->delaying = 1;", "fctx->prev_thread = NULL;", "for (int i = 0; i < VAR_0->thread_count; i++)", "fctx->threads[i].got_frame = 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 13 ], [ 15 ], [ 17, 19 ], [ 21, 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ] ]
7,479
static int expand_zero_clusters_in_l1(BlockDriverState *bs, uint64_t *l1_table, int l1_size, int64_t *visited_l1_entries, int64_t l1_entries, BlockDriverAmendStatusCB *status_cb, void *cb_opaque) { BDRVQcow2State *s = bs->opaque; bool is_active_l1 = (l1_table == s->l1_table); uint64_t *l2_table = NULL; int ret; int i, j; if (!is_active_l1) { /* inactive L2 tables require a buffer to be stored in when loading * them from disk */ l2_table = qemu_try_blockalign(bs->file->bs, s->cluster_size); if (l2_table == NULL) { return -ENOMEM; } } for (i = 0; i < l1_size; i++) { uint64_t l2_offset = l1_table[i] & L1E_OFFSET_MASK; bool l2_dirty = false; uint64_t l2_refcount; if (!l2_offset) { /* unallocated */ (*visited_l1_entries)++; if (status_cb) { status_cb(bs, *visited_l1_entries, l1_entries, cb_opaque); } continue; } if (offset_into_cluster(s, l2_offset)) { qcow2_signal_corruption(bs, true, -1, -1, "L2 table offset %#" PRIx64 " unaligned (L1 index: %#x)", l2_offset, i); ret = -EIO; goto fail; } if (is_active_l1) { /* get active L2 tables from cache */ ret = qcow2_cache_get(bs, s->l2_table_cache, l2_offset, (void **)&l2_table); } else { /* load inactive L2 tables from disk */ ret = bdrv_read(bs->file, l2_offset / BDRV_SECTOR_SIZE, (void *)l2_table, s->cluster_sectors); } if (ret < 0) { goto fail; } ret = qcow2_get_refcount(bs, l2_offset >> s->cluster_bits, &l2_refcount); if (ret < 0) { goto fail; } for (j = 0; j < s->l2_size; j++) { uint64_t l2_entry = be64_to_cpu(l2_table[j]); int64_t offset = l2_entry & L2E_OFFSET_MASK; QCow2ClusterType cluster_type = qcow2_get_cluster_type(l2_entry); bool preallocated = offset != 0; if (cluster_type != QCOW2_CLUSTER_ZERO) { continue; } if (!preallocated) { if (!bs->backing) { /* not backed; therefore we can simply deallocate the * cluster */ l2_table[j] = 0; l2_dirty = true; continue; } offset = qcow2_alloc_clusters(bs, s->cluster_size); if (offset < 0) { ret = offset; goto fail; } if (l2_refcount > 1) { /* For shared L2 tables, set the refcount accordingly (it is * already 1 and needs to be l2_refcount) */ ret = qcow2_update_cluster_refcount(bs, offset >> s->cluster_bits, refcount_diff(1, l2_refcount), false, QCOW2_DISCARD_OTHER); if (ret < 0) { qcow2_free_clusters(bs, offset, s->cluster_size, QCOW2_DISCARD_OTHER); goto fail; } } } if (offset_into_cluster(s, offset)) { qcow2_signal_corruption(bs, true, -1, -1, "Data cluster offset " "%#" PRIx64 " unaligned (L2 offset: %#" PRIx64 ", L2 index: %#x)", offset, l2_offset, j); if (!preallocated) { qcow2_free_clusters(bs, offset, s->cluster_size, QCOW2_DISCARD_ALWAYS); } ret = -EIO; goto fail; } ret = qcow2_pre_write_overlap_check(bs, 0, offset, s->cluster_size); if (ret < 0) { if (!preallocated) { qcow2_free_clusters(bs, offset, s->cluster_size, QCOW2_DISCARD_ALWAYS); } goto fail; } ret = bdrv_pwrite_zeroes(bs->file, offset, s->cluster_size, 0); if (ret < 0) { if (!preallocated) { qcow2_free_clusters(bs, offset, s->cluster_size, QCOW2_DISCARD_ALWAYS); } goto fail; } if (l2_refcount == 1) { l2_table[j] = cpu_to_be64(offset | QCOW_OFLAG_COPIED); } else { l2_table[j] = cpu_to_be64(offset); } l2_dirty = true; } if (is_active_l1) { if (l2_dirty) { qcow2_cache_entry_mark_dirty(bs, s->l2_table_cache, l2_table); qcow2_cache_depends_on_flush(s->l2_table_cache); } qcow2_cache_put(bs, s->l2_table_cache, (void **) &l2_table); } else { if (l2_dirty) { ret = qcow2_pre_write_overlap_check(bs, QCOW2_OL_INACTIVE_L2 | QCOW2_OL_ACTIVE_L2, l2_offset, s->cluster_size); if (ret < 0) { goto fail; } ret = bdrv_write(bs->file, l2_offset / BDRV_SECTOR_SIZE, (void *)l2_table, s->cluster_sectors); if (ret < 0) { goto fail; } } } (*visited_l1_entries)++; if (status_cb) { status_cb(bs, *visited_l1_entries, l1_entries, cb_opaque); } } ret = 0; fail: if (l2_table) { if (!is_active_l1) { qemu_vfree(l2_table); } else { qcow2_cache_put(bs, s->l2_table_cache, (void **) &l2_table); } } return ret; }
false
qemu
fdfab37dfeffefbd4533b4158055c9b82d7c3e69
static int expand_zero_clusters_in_l1(BlockDriverState *bs, uint64_t *l1_table, int l1_size, int64_t *visited_l1_entries, int64_t l1_entries, BlockDriverAmendStatusCB *status_cb, void *cb_opaque) { BDRVQcow2State *s = bs->opaque; bool is_active_l1 = (l1_table == s->l1_table); uint64_t *l2_table = NULL; int ret; int i, j; if (!is_active_l1) { l2_table = qemu_try_blockalign(bs->file->bs, s->cluster_size); if (l2_table == NULL) { return -ENOMEM; } } for (i = 0; i < l1_size; i++) { uint64_t l2_offset = l1_table[i] & L1E_OFFSET_MASK; bool l2_dirty = false; uint64_t l2_refcount; if (!l2_offset) { (*visited_l1_entries)++; if (status_cb) { status_cb(bs, *visited_l1_entries, l1_entries, cb_opaque); } continue; } if (offset_into_cluster(s, l2_offset)) { qcow2_signal_corruption(bs, true, -1, -1, "L2 table offset %#" PRIx64 " unaligned (L1 index: %#x)", l2_offset, i); ret = -EIO; goto fail; } if (is_active_l1) { ret = qcow2_cache_get(bs, s->l2_table_cache, l2_offset, (void **)&l2_table); } else { ret = bdrv_read(bs->file, l2_offset / BDRV_SECTOR_SIZE, (void *)l2_table, s->cluster_sectors); } if (ret < 0) { goto fail; } ret = qcow2_get_refcount(bs, l2_offset >> s->cluster_bits, &l2_refcount); if (ret < 0) { goto fail; } for (j = 0; j < s->l2_size; j++) { uint64_t l2_entry = be64_to_cpu(l2_table[j]); int64_t offset = l2_entry & L2E_OFFSET_MASK; QCow2ClusterType cluster_type = qcow2_get_cluster_type(l2_entry); bool preallocated = offset != 0; if (cluster_type != QCOW2_CLUSTER_ZERO) { continue; } if (!preallocated) { if (!bs->backing) { l2_table[j] = 0; l2_dirty = true; continue; } offset = qcow2_alloc_clusters(bs, s->cluster_size); if (offset < 0) { ret = offset; goto fail; } if (l2_refcount > 1) { ret = qcow2_update_cluster_refcount(bs, offset >> s->cluster_bits, refcount_diff(1, l2_refcount), false, QCOW2_DISCARD_OTHER); if (ret < 0) { qcow2_free_clusters(bs, offset, s->cluster_size, QCOW2_DISCARD_OTHER); goto fail; } } } if (offset_into_cluster(s, offset)) { qcow2_signal_corruption(bs, true, -1, -1, "Data cluster offset " "%#" PRIx64 " unaligned (L2 offset: %#" PRIx64 ", L2 index: %#x)", offset, l2_offset, j); if (!preallocated) { qcow2_free_clusters(bs, offset, s->cluster_size, QCOW2_DISCARD_ALWAYS); } ret = -EIO; goto fail; } ret = qcow2_pre_write_overlap_check(bs, 0, offset, s->cluster_size); if (ret < 0) { if (!preallocated) { qcow2_free_clusters(bs, offset, s->cluster_size, QCOW2_DISCARD_ALWAYS); } goto fail; } ret = bdrv_pwrite_zeroes(bs->file, offset, s->cluster_size, 0); if (ret < 0) { if (!preallocated) { qcow2_free_clusters(bs, offset, s->cluster_size, QCOW2_DISCARD_ALWAYS); } goto fail; } if (l2_refcount == 1) { l2_table[j] = cpu_to_be64(offset | QCOW_OFLAG_COPIED); } else { l2_table[j] = cpu_to_be64(offset); } l2_dirty = true; } if (is_active_l1) { if (l2_dirty) { qcow2_cache_entry_mark_dirty(bs, s->l2_table_cache, l2_table); qcow2_cache_depends_on_flush(s->l2_table_cache); } qcow2_cache_put(bs, s->l2_table_cache, (void **) &l2_table); } else { if (l2_dirty) { ret = qcow2_pre_write_overlap_check(bs, QCOW2_OL_INACTIVE_L2 | QCOW2_OL_ACTIVE_L2, l2_offset, s->cluster_size); if (ret < 0) { goto fail; } ret = bdrv_write(bs->file, l2_offset / BDRV_SECTOR_SIZE, (void *)l2_table, s->cluster_sectors); if (ret < 0) { goto fail; } } } (*visited_l1_entries)++; if (status_cb) { status_cb(bs, *visited_l1_entries, l1_entries, cb_opaque); } } ret = 0; fail: if (l2_table) { if (!is_active_l1) { qemu_vfree(l2_table); } else { qcow2_cache_put(bs, s->l2_table_cache, (void **) &l2_table); } } return ret; }
{ "code": [], "line_no": [] }
static int FUNC_0(BlockDriverState *VAR_0, uint64_t *VAR_1, int VAR_2, int64_t *VAR_3, int64_t VAR_4, BlockDriverAmendStatusCB *VAR_5, void *VAR_6) { BDRVQcow2State *s = VAR_0->opaque; bool is_active_l1 = (VAR_1 == s->VAR_1); uint64_t *l2_table = NULL; int VAR_7; int VAR_8, VAR_9; if (!is_active_l1) { l2_table = qemu_try_blockalign(VAR_0->file->VAR_0, s->cluster_size); if (l2_table == NULL) { return -ENOMEM; } } for (VAR_8 = 0; VAR_8 < VAR_2; VAR_8++) { uint64_t l2_offset = VAR_1[VAR_8] & L1E_OFFSET_MASK; bool l2_dirty = false; uint64_t l2_refcount; if (!l2_offset) { (*VAR_3)++; if (VAR_5) { VAR_5(VAR_0, *VAR_3, VAR_4, VAR_6); } continue; } if (offset_into_cluster(s, l2_offset)) { qcow2_signal_corruption(VAR_0, true, -1, -1, "L2 table offset %#" PRIx64 " unaligned (L1 index: %#x)", l2_offset, VAR_8); VAR_7 = -EIO; goto fail; } if (is_active_l1) { VAR_7 = qcow2_cache_get(VAR_0, s->l2_table_cache, l2_offset, (void **)&l2_table); } else { VAR_7 = bdrv_read(VAR_0->file, l2_offset / BDRV_SECTOR_SIZE, (void *)l2_table, s->cluster_sectors); } if (VAR_7 < 0) { goto fail; } VAR_7 = qcow2_get_refcount(VAR_0, l2_offset >> s->cluster_bits, &l2_refcount); if (VAR_7 < 0) { goto fail; } for (VAR_9 = 0; VAR_9 < s->l2_size; VAR_9++) { uint64_t l2_entry = be64_to_cpu(l2_table[VAR_9]); int64_t offset = l2_entry & L2E_OFFSET_MASK; QCow2ClusterType cluster_type = qcow2_get_cluster_type(l2_entry); bool preallocated = offset != 0; if (cluster_type != QCOW2_CLUSTER_ZERO) { continue; } if (!preallocated) { if (!VAR_0->backing) { l2_table[VAR_9] = 0; l2_dirty = true; continue; } offset = qcow2_alloc_clusters(VAR_0, s->cluster_size); if (offset < 0) { VAR_7 = offset; goto fail; } if (l2_refcount > 1) { VAR_7 = qcow2_update_cluster_refcount(VAR_0, offset >> s->cluster_bits, refcount_diff(1, l2_refcount), false, QCOW2_DISCARD_OTHER); if (VAR_7 < 0) { qcow2_free_clusters(VAR_0, offset, s->cluster_size, QCOW2_DISCARD_OTHER); goto fail; } } } if (offset_into_cluster(s, offset)) { qcow2_signal_corruption(VAR_0, true, -1, -1, "Data cluster offset " "%#" PRIx64 " unaligned (L2 offset: %#" PRIx64 ", L2 index: %#x)", offset, l2_offset, VAR_9); if (!preallocated) { qcow2_free_clusters(VAR_0, offset, s->cluster_size, QCOW2_DISCARD_ALWAYS); } VAR_7 = -EIO; goto fail; } VAR_7 = qcow2_pre_write_overlap_check(VAR_0, 0, offset, s->cluster_size); if (VAR_7 < 0) { if (!preallocated) { qcow2_free_clusters(VAR_0, offset, s->cluster_size, QCOW2_DISCARD_ALWAYS); } goto fail; } VAR_7 = bdrv_pwrite_zeroes(VAR_0->file, offset, s->cluster_size, 0); if (VAR_7 < 0) { if (!preallocated) { qcow2_free_clusters(VAR_0, offset, s->cluster_size, QCOW2_DISCARD_ALWAYS); } goto fail; } if (l2_refcount == 1) { l2_table[VAR_9] = cpu_to_be64(offset | QCOW_OFLAG_COPIED); } else { l2_table[VAR_9] = cpu_to_be64(offset); } l2_dirty = true; } if (is_active_l1) { if (l2_dirty) { qcow2_cache_entry_mark_dirty(VAR_0, s->l2_table_cache, l2_table); qcow2_cache_depends_on_flush(s->l2_table_cache); } qcow2_cache_put(VAR_0, s->l2_table_cache, (void **) &l2_table); } else { if (l2_dirty) { VAR_7 = qcow2_pre_write_overlap_check(VAR_0, QCOW2_OL_INACTIVE_L2 | QCOW2_OL_ACTIVE_L2, l2_offset, s->cluster_size); if (VAR_7 < 0) { goto fail; } VAR_7 = bdrv_write(VAR_0->file, l2_offset / BDRV_SECTOR_SIZE, (void *)l2_table, s->cluster_sectors); if (VAR_7 < 0) { goto fail; } } } (*VAR_3)++; if (VAR_5) { VAR_5(VAR_0, *VAR_3, VAR_4, VAR_6); } } VAR_7 = 0; fail: if (l2_table) { if (!is_active_l1) { qemu_vfree(l2_table); } else { qcow2_cache_put(VAR_0, s->l2_table_cache, (void **) &l2_table); } } return VAR_7; }
[ "static int FUNC_0(BlockDriverState *VAR_0, uint64_t *VAR_1,\nint VAR_2, int64_t *VAR_3,\nint64_t VAR_4,\nBlockDriverAmendStatusCB *VAR_5,\nvoid *VAR_6)\n{", "BDRVQcow2State *s = VAR_0->opaque;", "bool is_active_l1 = (VAR_1 == s->VAR_1);", "uint64_t *l2_table = NULL;", "int VAR_7;", "int VAR_8, VAR_9;", "if (!is_active_l1) {", "l2_table = qemu_try_blockalign(VAR_0->file->VAR_0, s->cluster_size);", "if (l2_table == NULL) {", "return -ENOMEM;", "}", "}", "for (VAR_8 = 0; VAR_8 < VAR_2; VAR_8++) {", "uint64_t l2_offset = VAR_1[VAR_8] & L1E_OFFSET_MASK;", "bool l2_dirty = false;", "uint64_t l2_refcount;", "if (!l2_offset) {", "(*VAR_3)++;", "if (VAR_5) {", "VAR_5(VAR_0, *VAR_3, VAR_4, VAR_6);", "}", "continue;", "}", "if (offset_into_cluster(s, l2_offset)) {", "qcow2_signal_corruption(VAR_0, true, -1, -1, \"L2 table offset %#\"\nPRIx64 \" unaligned (L1 index: %#x)\",\nl2_offset, VAR_8);", "VAR_7 = -EIO;", "goto fail;", "}", "if (is_active_l1) {", "VAR_7 = qcow2_cache_get(VAR_0, s->l2_table_cache, l2_offset,\n(void **)&l2_table);", "} else {", "VAR_7 = bdrv_read(VAR_0->file, l2_offset / BDRV_SECTOR_SIZE,\n(void *)l2_table, s->cluster_sectors);", "}", "if (VAR_7 < 0) {", "goto fail;", "}", "VAR_7 = qcow2_get_refcount(VAR_0, l2_offset >> s->cluster_bits,\n&l2_refcount);", "if (VAR_7 < 0) {", "goto fail;", "}", "for (VAR_9 = 0; VAR_9 < s->l2_size; VAR_9++) {", "uint64_t l2_entry = be64_to_cpu(l2_table[VAR_9]);", "int64_t offset = l2_entry & L2E_OFFSET_MASK;", "QCow2ClusterType cluster_type = qcow2_get_cluster_type(l2_entry);", "bool preallocated = offset != 0;", "if (cluster_type != QCOW2_CLUSTER_ZERO) {", "continue;", "}", "if (!preallocated) {", "if (!VAR_0->backing) {", "l2_table[VAR_9] = 0;", "l2_dirty = true;", "continue;", "}", "offset = qcow2_alloc_clusters(VAR_0, s->cluster_size);", "if (offset < 0) {", "VAR_7 = offset;", "goto fail;", "}", "if (l2_refcount > 1) {", "VAR_7 = qcow2_update_cluster_refcount(VAR_0,\noffset >> s->cluster_bits,\nrefcount_diff(1, l2_refcount), false,\nQCOW2_DISCARD_OTHER);", "if (VAR_7 < 0) {", "qcow2_free_clusters(VAR_0, offset, s->cluster_size,\nQCOW2_DISCARD_OTHER);", "goto fail;", "}", "}", "}", "if (offset_into_cluster(s, offset)) {", "qcow2_signal_corruption(VAR_0, true, -1, -1, \"Data cluster offset \"\n\"%#\" PRIx64 \" unaligned (L2 offset: %#\"\nPRIx64 \", L2 index: %#x)\", offset,\nl2_offset, VAR_9);", "if (!preallocated) {", "qcow2_free_clusters(VAR_0, offset, s->cluster_size,\nQCOW2_DISCARD_ALWAYS);", "}", "VAR_7 = -EIO;", "goto fail;", "}", "VAR_7 = qcow2_pre_write_overlap_check(VAR_0, 0, offset, s->cluster_size);", "if (VAR_7 < 0) {", "if (!preallocated) {", "qcow2_free_clusters(VAR_0, offset, s->cluster_size,\nQCOW2_DISCARD_ALWAYS);", "}", "goto fail;", "}", "VAR_7 = bdrv_pwrite_zeroes(VAR_0->file, offset, s->cluster_size, 0);", "if (VAR_7 < 0) {", "if (!preallocated) {", "qcow2_free_clusters(VAR_0, offset, s->cluster_size,\nQCOW2_DISCARD_ALWAYS);", "}", "goto fail;", "}", "if (l2_refcount == 1) {", "l2_table[VAR_9] = cpu_to_be64(offset | QCOW_OFLAG_COPIED);", "} else {", "l2_table[VAR_9] = cpu_to_be64(offset);", "}", "l2_dirty = true;", "}", "if (is_active_l1) {", "if (l2_dirty) {", "qcow2_cache_entry_mark_dirty(VAR_0, s->l2_table_cache, l2_table);", "qcow2_cache_depends_on_flush(s->l2_table_cache);", "}", "qcow2_cache_put(VAR_0, s->l2_table_cache, (void **) &l2_table);", "} else {", "if (l2_dirty) {", "VAR_7 = qcow2_pre_write_overlap_check(VAR_0,\nQCOW2_OL_INACTIVE_L2 | QCOW2_OL_ACTIVE_L2, l2_offset,\ns->cluster_size);", "if (VAR_7 < 0) {", "goto fail;", "}", "VAR_7 = bdrv_write(VAR_0->file, l2_offset / BDRV_SECTOR_SIZE,\n(void *)l2_table, s->cluster_sectors);", "if (VAR_7 < 0) {", "goto fail;", "}", "}", "}", "(*VAR_3)++;", "if (VAR_5) {", "VAR_5(VAR_0, *VAR_3, VAR_4, VAR_6);", "}", "}", "VAR_7 = 0;", "fail:\nif (l2_table) {", "if (!is_active_l1) {", "qemu_vfree(l2_table);", "} else {", "qcow2_cache_put(VAR_0, s->l2_table_cache, (void **) &l2_table);", "}", "}", "return VAR_7;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9, 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 71 ], [ 73, 75, 77 ], [ 79 ], [ 81 ], [ 83 ], [ 87 ], [ 91, 93 ], [ 95 ], [ 99, 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 113, 115 ], [ 117 ], [ 119 ], [ 121 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 137 ], [ 139 ], [ 141 ], [ 145 ], [ 147 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 175 ], [ 181, 183, 185, 187 ], [ 189 ], [ 191, 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 205 ], [ 207, 209, 211, 213 ], [ 215 ], [ 217, 219 ], [ 221 ], [ 223 ], [ 225 ], [ 227 ], [ 231 ], [ 233 ], [ 235 ], [ 237, 239 ], [ 241 ], [ 243 ], [ 245 ], [ 249 ], [ 251 ], [ 253 ], [ 255, 257 ], [ 259 ], [ 261 ], [ 263 ], [ 267 ], [ 269 ], [ 271 ], [ 273 ], [ 275 ], [ 277 ], [ 279 ], [ 283 ], [ 285 ], [ 287 ], [ 289 ], [ 291 ], [ 293 ], [ 295 ], [ 297 ], [ 299, 301, 303 ], [ 305 ], [ 307 ], [ 309 ], [ 313, 315 ], [ 317 ], [ 319 ], [ 321 ], [ 323 ], [ 325 ], [ 329 ], [ 331 ], [ 333 ], [ 335 ], [ 337 ], [ 341 ], [ 345, 347 ], [ 349 ], [ 351 ], [ 353 ], [ 355 ], [ 357 ], [ 359 ], [ 361 ], [ 363 ] ]
7,482
static void wait_for_aio(void) { while (aio_poll(ctx, true)) { /* Do nothing */ } }
false
qemu
acfb23ad3dd8d0ab385a10e483776ba7dcf927ad
static void wait_for_aio(void) { while (aio_poll(ctx, true)) { } }
{ "code": [], "line_no": [] }
static void FUNC_0(void) { while (aio_poll(ctx, true)) { } }
[ "static void FUNC_0(void)\n{", "while (aio_poll(ctx, true)) {", "}", "}" ]
[ 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ] ]
7,483
static VTDIOTLBEntry *vtd_lookup_iotlb(IntelIOMMUState *s, uint16_t source_id, hwaddr addr) { uint64_t key; key = (addr >> VTD_PAGE_SHIFT_4K) | ((uint64_t)(source_id) << VTD_IOTLB_SID_SHIFT); return g_hash_table_lookup(s->iotlb, &key); }
false
qemu
d66b969b0d9c8eefdcbff4b48535b0fe1501d139
static VTDIOTLBEntry *vtd_lookup_iotlb(IntelIOMMUState *s, uint16_t source_id, hwaddr addr) { uint64_t key; key = (addr >> VTD_PAGE_SHIFT_4K) | ((uint64_t)(source_id) << VTD_IOTLB_SID_SHIFT); return g_hash_table_lookup(s->iotlb, &key); }
{ "code": [], "line_no": [] }
static VTDIOTLBEntry *FUNC_0(IntelIOMMUState *s, uint16_t source_id, hwaddr addr) { uint64_t key; key = (addr >> VTD_PAGE_SHIFT_4K) | ((uint64_t)(source_id) << VTD_IOTLB_SID_SHIFT); return g_hash_table_lookup(s->iotlb, &key); }
[ "static VTDIOTLBEntry *FUNC_0(IntelIOMMUState *s, uint16_t source_id,\nhwaddr addr)\n{", "uint64_t key;", "key = (addr >> VTD_PAGE_SHIFT_4K) |\n((uint64_t)(source_id) << VTD_IOTLB_SID_SHIFT);", "return g_hash_table_lookup(s->iotlb, &key);", "}" ]
[ 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11, 13 ], [ 15 ], [ 19 ] ]
7,485
BlockErrorAction bdrv_get_error_action(BlockDriverState *bs, bool is_read, int error) { BlockdevOnError on_err = is_read ? bs->on_read_error : bs->on_write_error; switch (on_err) { case BLOCKDEV_ON_ERROR_ENOSPC: return (error == ENOSPC) ? BLOCK_ERROR_ACTION_STOP : BLOCK_ERROR_ACTION_REPORT; case BLOCKDEV_ON_ERROR_STOP: return BLOCK_ERROR_ACTION_STOP; case BLOCKDEV_ON_ERROR_REPORT: return BLOCK_ERROR_ACTION_REPORT; case BLOCKDEV_ON_ERROR_IGNORE: return BLOCK_ERROR_ACTION_IGNORE; default: abort(); } }
false
qemu
61007b316cd71ee7333ff7a0a749a8949527575f
BlockErrorAction bdrv_get_error_action(BlockDriverState *bs, bool is_read, int error) { BlockdevOnError on_err = is_read ? bs->on_read_error : bs->on_write_error; switch (on_err) { case BLOCKDEV_ON_ERROR_ENOSPC: return (error == ENOSPC) ? BLOCK_ERROR_ACTION_STOP : BLOCK_ERROR_ACTION_REPORT; case BLOCKDEV_ON_ERROR_STOP: return BLOCK_ERROR_ACTION_STOP; case BLOCKDEV_ON_ERROR_REPORT: return BLOCK_ERROR_ACTION_REPORT; case BLOCKDEV_ON_ERROR_IGNORE: return BLOCK_ERROR_ACTION_IGNORE; default: abort(); } }
{ "code": [], "line_no": [] }
BlockErrorAction FUNC_0(BlockDriverState *bs, bool is_read, int error) { BlockdevOnError on_err = is_read ? bs->on_read_error : bs->on_write_error; switch (on_err) { case BLOCKDEV_ON_ERROR_ENOSPC: return (error == ENOSPC) ? BLOCK_ERROR_ACTION_STOP : BLOCK_ERROR_ACTION_REPORT; case BLOCKDEV_ON_ERROR_STOP: return BLOCK_ERROR_ACTION_STOP; case BLOCKDEV_ON_ERROR_REPORT: return BLOCK_ERROR_ACTION_REPORT; case BLOCKDEV_ON_ERROR_IGNORE: return BLOCK_ERROR_ACTION_IGNORE; default: abort(); } }
[ "BlockErrorAction FUNC_0(BlockDriverState *bs, bool is_read, int error)\n{", "BlockdevOnError on_err = is_read ? bs->on_read_error : bs->on_write_error;", "switch (on_err) {", "case BLOCKDEV_ON_ERROR_ENOSPC:\nreturn (error == ENOSPC) ?\nBLOCK_ERROR_ACTION_STOP : BLOCK_ERROR_ACTION_REPORT;", "case BLOCKDEV_ON_ERROR_STOP:\nreturn BLOCK_ERROR_ACTION_STOP;", "case BLOCKDEV_ON_ERROR_REPORT:\nreturn BLOCK_ERROR_ACTION_REPORT;", "case BLOCKDEV_ON_ERROR_IGNORE:\nreturn BLOCK_ERROR_ACTION_IGNORE;", "default:\nabort();", "}", "}" ]
[ 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 ] ]
7,486
gboolean qcrypto_hash_supports(QCryptoHashAlgorithm alg G_GNUC_UNUSED) { return false; }
false
qemu
0c16c056a4f9dec18fdd56feec82a5db9ff3c15e
gboolean qcrypto_hash_supports(QCryptoHashAlgorithm alg G_GNUC_UNUSED) { return false; }
{ "code": [], "line_no": [] }
gboolean FUNC_0(QCryptoHashAlgorithm alg G_GNUC_UNUSED) { return false; }
[ "gboolean FUNC_0(QCryptoHashAlgorithm alg G_GNUC_UNUSED)\n{", "return false;", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
7,488
static void xen_io_add(MemoryListener *listener, MemoryRegionSection *section) { XenIOState *state = container_of(listener, XenIOState, io_listener); memory_region_ref(section->mr); xen_map_io_section(xen_xc, xen_domid, state->ioservid, section); }
false
qemu
a8ff4316795c7051b38727ec4a81c65dfcf63dc6
static void xen_io_add(MemoryListener *listener, MemoryRegionSection *section) { XenIOState *state = container_of(listener, XenIOState, io_listener); memory_region_ref(section->mr); xen_map_io_section(xen_xc, xen_domid, state->ioservid, section); }
{ "code": [], "line_no": [] }
static void FUNC_0(MemoryListener *VAR_0, MemoryRegionSection *VAR_1) { XenIOState *state = container_of(VAR_0, XenIOState, io_listener); memory_region_ref(VAR_1->mr); xen_map_io_section(xen_xc, xen_domid, state->ioservid, VAR_1); }
[ "static void FUNC_0(MemoryListener *VAR_0,\nMemoryRegionSection *VAR_1)\n{", "XenIOState *state = container_of(VAR_0, XenIOState, io_listener);", "memory_region_ref(VAR_1->mr);", "xen_map_io_section(xen_xc, xen_domid, state->ioservid, VAR_1);", "}" ]
[ 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 15 ], [ 17 ] ]
7,489
static void opt_mb_qmin(const char *arg) { video_mb_qmin = atoi(arg); if (video_mb_qmin < 0 || video_mb_qmin > 31) { fprintf(stderr, "qmin must be >= 1 and <= 31\n"); exit(1); } }
false
FFmpeg
6e0d8c06c7af61859e8d7bc2351a607d8abeab75
static void opt_mb_qmin(const char *arg) { video_mb_qmin = atoi(arg); if (video_mb_qmin < 0 || video_mb_qmin > 31) { fprintf(stderr, "qmin must be >= 1 and <= 31\n"); exit(1); } }
{ "code": [], "line_no": [] }
static void FUNC_0(const char *VAR_0) { video_mb_qmin = atoi(VAR_0); if (video_mb_qmin < 0 || video_mb_qmin > 31) { fprintf(stderr, "qmin must be >= 1 and <= 31\n"); exit(1); } }
[ "static void FUNC_0(const char *VAR_0)\n{", "video_mb_qmin = atoi(VAR_0);", "if (video_mb_qmin < 0 ||\nvideo_mb_qmin > 31) {", "fprintf(stderr, \"qmin must be >= 1 and <= 31\\n\");", "exit(1);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7, 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ] ]
7,492
static void handle_windowevent(SDL_Event *ev) { struct sdl2_console *scon = get_scon_from_window(ev->window.windowID); if (!scon) { return; } switch (ev->window.event) { case SDL_WINDOWEVENT_RESIZED: { QemuUIInfo info; memset(&info, 0, sizeof(info)); info.width = ev->window.data1; info.height = ev->window.data2; dpy_set_ui_info(scon->dcl.con, &info); } sdl2_redraw(scon); break; case SDL_WINDOWEVENT_EXPOSED: sdl2_redraw(scon); break; case SDL_WINDOWEVENT_FOCUS_GAINED: case SDL_WINDOWEVENT_ENTER: if (!gui_grab && (qemu_input_is_absolute() || absolute_enabled)) { absolute_mouse_grab(scon); } break; case SDL_WINDOWEVENT_FOCUS_LOST: if (gui_grab && !gui_fullscreen) { sdl_grab_end(scon); } break; case SDL_WINDOWEVENT_RESTORED: update_displaychangelistener(&scon->dcl, GUI_REFRESH_INTERVAL_DEFAULT); break; case SDL_WINDOWEVENT_MINIMIZED: update_displaychangelistener(&scon->dcl, 500); break; case SDL_WINDOWEVENT_CLOSE: if (qemu_console_is_graphic(scon->dcl.con)) { if (!no_quit) { no_shutdown = 0; qemu_system_shutdown_request(SHUTDOWN_CAUSE_HOST_UI); } } else { SDL_HideWindow(scon->real_window); scon->hidden = true; } break; case SDL_WINDOWEVENT_SHOWN: if (scon->hidden) { SDL_HideWindow(scon->real_window); } break; case SDL_WINDOWEVENT_HIDDEN: if (!scon->hidden) { SDL_ShowWindow(scon->real_window); } break; } }
false
qemu
bcf43cdc178ffbd06d0533b6c54e92640817c9c7
static void handle_windowevent(SDL_Event *ev) { struct sdl2_console *scon = get_scon_from_window(ev->window.windowID); if (!scon) { return; } switch (ev->window.event) { case SDL_WINDOWEVENT_RESIZED: { QemuUIInfo info; memset(&info, 0, sizeof(info)); info.width = ev->window.data1; info.height = ev->window.data2; dpy_set_ui_info(scon->dcl.con, &info); } sdl2_redraw(scon); break; case SDL_WINDOWEVENT_EXPOSED: sdl2_redraw(scon); break; case SDL_WINDOWEVENT_FOCUS_GAINED: case SDL_WINDOWEVENT_ENTER: if (!gui_grab && (qemu_input_is_absolute() || absolute_enabled)) { absolute_mouse_grab(scon); } break; case SDL_WINDOWEVENT_FOCUS_LOST: if (gui_grab && !gui_fullscreen) { sdl_grab_end(scon); } break; case SDL_WINDOWEVENT_RESTORED: update_displaychangelistener(&scon->dcl, GUI_REFRESH_INTERVAL_DEFAULT); break; case SDL_WINDOWEVENT_MINIMIZED: update_displaychangelistener(&scon->dcl, 500); break; case SDL_WINDOWEVENT_CLOSE: if (qemu_console_is_graphic(scon->dcl.con)) { if (!no_quit) { no_shutdown = 0; qemu_system_shutdown_request(SHUTDOWN_CAUSE_HOST_UI); } } else { SDL_HideWindow(scon->real_window); scon->hidden = true; } break; case SDL_WINDOWEVENT_SHOWN: if (scon->hidden) { SDL_HideWindow(scon->real_window); } break; case SDL_WINDOWEVENT_HIDDEN: if (!scon->hidden) { SDL_ShowWindow(scon->real_window); } break; } }
{ "code": [], "line_no": [] }
static void FUNC_0(SDL_Event *VAR_0) { struct sdl2_console *VAR_1 = get_scon_from_window(VAR_0->window.windowID); if (!VAR_1) { return; } switch (VAR_0->window.event) { case SDL_WINDOWEVENT_RESIZED: { QemuUIInfo info; memset(&info, 0, sizeof(info)); info.width = VAR_0->window.data1; info.height = VAR_0->window.data2; dpy_set_ui_info(VAR_1->dcl.con, &info); } sdl2_redraw(VAR_1); break; case SDL_WINDOWEVENT_EXPOSED: sdl2_redraw(VAR_1); break; case SDL_WINDOWEVENT_FOCUS_GAINED: case SDL_WINDOWEVENT_ENTER: if (!gui_grab && (qemu_input_is_absolute() || absolute_enabled)) { absolute_mouse_grab(VAR_1); } break; case SDL_WINDOWEVENT_FOCUS_LOST: if (gui_grab && !gui_fullscreen) { sdl_grab_end(VAR_1); } break; case SDL_WINDOWEVENT_RESTORED: update_displaychangelistener(&VAR_1->dcl, GUI_REFRESH_INTERVAL_DEFAULT); break; case SDL_WINDOWEVENT_MINIMIZED: update_displaychangelistener(&VAR_1->dcl, 500); break; case SDL_WINDOWEVENT_CLOSE: if (qemu_console_is_graphic(VAR_1->dcl.con)) { if (!no_quit) { no_shutdown = 0; qemu_system_shutdown_request(SHUTDOWN_CAUSE_HOST_UI); } } else { SDL_HideWindow(VAR_1->real_window); VAR_1->hidden = true; } break; case SDL_WINDOWEVENT_SHOWN: if (VAR_1->hidden) { SDL_HideWindow(VAR_1->real_window); } break; case SDL_WINDOWEVENT_HIDDEN: if (!VAR_1->hidden) { SDL_ShowWindow(VAR_1->real_window); } break; } }
[ "static void FUNC_0(SDL_Event *VAR_0)\n{", "struct sdl2_console *VAR_1 = get_scon_from_window(VAR_0->window.windowID);", "if (!VAR_1) {", "return;", "}", "switch (VAR_0->window.event) {", "case SDL_WINDOWEVENT_RESIZED:\n{", "QemuUIInfo info;", "memset(&info, 0, sizeof(info));", "info.width = VAR_0->window.data1;", "info.height = VAR_0->window.data2;", "dpy_set_ui_info(VAR_1->dcl.con, &info);", "}", "sdl2_redraw(VAR_1);", "break;", "case SDL_WINDOWEVENT_EXPOSED:\nsdl2_redraw(VAR_1);", "break;", "case SDL_WINDOWEVENT_FOCUS_GAINED:\ncase SDL_WINDOWEVENT_ENTER:\nif (!gui_grab && (qemu_input_is_absolute() || absolute_enabled)) {", "absolute_mouse_grab(VAR_1);", "}", "break;", "case SDL_WINDOWEVENT_FOCUS_LOST:\nif (gui_grab && !gui_fullscreen) {", "sdl_grab_end(VAR_1);", "}", "break;", "case SDL_WINDOWEVENT_RESTORED:\nupdate_displaychangelistener(&VAR_1->dcl, GUI_REFRESH_INTERVAL_DEFAULT);", "break;", "case SDL_WINDOWEVENT_MINIMIZED:\nupdate_displaychangelistener(&VAR_1->dcl, 500);", "break;", "case SDL_WINDOWEVENT_CLOSE:\nif (qemu_console_is_graphic(VAR_1->dcl.con)) {", "if (!no_quit) {", "no_shutdown = 0;", "qemu_system_shutdown_request(SHUTDOWN_CAUSE_HOST_UI);", "}", "} else {", "SDL_HideWindow(VAR_1->real_window);", "VAR_1->hidden = true;", "}", "break;", "case SDL_WINDOWEVENT_SHOWN:\nif (VAR_1->hidden) {", "SDL_HideWindow(VAR_1->real_window);", "}", "break;", "case SDL_WINDOWEVENT_HIDDEN:\nif (!VAR_1->hidden) {", "SDL_ShowWindow(VAR_1->real_window);", "}", "break;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 17 ], [ 19, 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39, 41 ], [ 43 ], [ 45, 47, 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57, 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67, 69 ], [ 71 ], [ 73, 75 ], [ 77 ], [ 79, 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101, 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111, 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ] ]
7,493
static void kvm_supported_msrs(CPUState *env) { static int kvm_supported_msrs; int ret; /* first time */ if (kvm_supported_msrs == 0) { struct kvm_msr_list msr_list, *kvm_msr_list; kvm_supported_msrs = -1; /* Obtain MSR list from KVM. These are the MSRs that we must * save/restore */ msr_list.nmsrs = 0; ret = kvm_ioctl(env->kvm_state, KVM_GET_MSR_INDEX_LIST, &msr_list); if (ret < 0 && ret != -E2BIG) { return; } /* Old kernel modules had a bug and could write beyond the provided memory. Allocate at least a safe amount of 1K. */ kvm_msr_list = qemu_mallocz(MAX(1024, sizeof(msr_list) + msr_list.nmsrs * sizeof(msr_list.indices[0]))); kvm_msr_list->nmsrs = msr_list.nmsrs; ret = kvm_ioctl(env->kvm_state, KVM_GET_MSR_INDEX_LIST, kvm_msr_list); if (ret >= 0) { int i; for (i = 0; i < kvm_msr_list->nmsrs; i++) { if (kvm_msr_list->indices[i] == MSR_STAR) { has_msr_star = 1; continue; } if (kvm_msr_list->indices[i] == MSR_VM_HSAVE_PA) { has_msr_hsave_pa = 1; continue; } } } free(kvm_msr_list); } return; }
false
qemu
c3a3a7d356c4df2fe145037172ae52cba5f545a5
static void kvm_supported_msrs(CPUState *env) { static int kvm_supported_msrs; int ret; if (kvm_supported_msrs == 0) { struct kvm_msr_list msr_list, *kvm_msr_list; kvm_supported_msrs = -1; msr_list.nmsrs = 0; ret = kvm_ioctl(env->kvm_state, KVM_GET_MSR_INDEX_LIST, &msr_list); if (ret < 0 && ret != -E2BIG) { return; } kvm_msr_list = qemu_mallocz(MAX(1024, sizeof(msr_list) + msr_list.nmsrs * sizeof(msr_list.indices[0]))); kvm_msr_list->nmsrs = msr_list.nmsrs; ret = kvm_ioctl(env->kvm_state, KVM_GET_MSR_INDEX_LIST, kvm_msr_list); if (ret >= 0) { int i; for (i = 0; i < kvm_msr_list->nmsrs; i++) { if (kvm_msr_list->indices[i] == MSR_STAR) { has_msr_star = 1; continue; } if (kvm_msr_list->indices[i] == MSR_VM_HSAVE_PA) { has_msr_hsave_pa = 1; continue; } } } free(kvm_msr_list); } return; }
{ "code": [], "line_no": [] }
static void VAR_1(CPUState *VAR_0) { static int VAR_1; int VAR_2; if (VAR_1 == 0) { struct VAR_4 VAR_3, *VAR_4; VAR_1 = -1; VAR_3.nmsrs = 0; VAR_2 = kvm_ioctl(VAR_0->kvm_state, KVM_GET_MSR_INDEX_LIST, &VAR_3); if (VAR_2 < 0 && VAR_2 != -E2BIG) { return; } VAR_4 = qemu_mallocz(MAX(1024, sizeof(VAR_3) + VAR_3.nmsrs * sizeof(VAR_3.indices[0]))); VAR_4->nmsrs = VAR_3.nmsrs; VAR_2 = kvm_ioctl(VAR_0->kvm_state, KVM_GET_MSR_INDEX_LIST, VAR_4); if (VAR_2 >= 0) { int VAR_5; for (VAR_5 = 0; VAR_5 < VAR_4->nmsrs; VAR_5++) { if (VAR_4->indices[VAR_5] == MSR_STAR) { has_msr_star = 1; continue; } if (VAR_4->indices[VAR_5] == MSR_VM_HSAVE_PA) { has_msr_hsave_pa = 1; continue; } } } free(VAR_4); } return; }
[ "static void VAR_1(CPUState *VAR_0)\n{", "static int VAR_1;", "int VAR_2;", "if (VAR_1 == 0) {", "struct VAR_4 VAR_3, *VAR_4;", "VAR_1 = -1;", "VAR_3.nmsrs = 0;", "VAR_2 = kvm_ioctl(VAR_0->kvm_state, KVM_GET_MSR_INDEX_LIST, &VAR_3);", "if (VAR_2 < 0 && VAR_2 != -E2BIG) {", "return;", "}", "VAR_4 = qemu_mallocz(MAX(1024, sizeof(VAR_3) +\nVAR_3.nmsrs *\nsizeof(VAR_3.indices[0])));", "VAR_4->nmsrs = VAR_3.nmsrs;", "VAR_2 = kvm_ioctl(VAR_0->kvm_state, KVM_GET_MSR_INDEX_LIST, VAR_4);", "if (VAR_2 >= 0) {", "int VAR_5;", "for (VAR_5 = 0; VAR_5 < VAR_4->nmsrs; VAR_5++) {", "if (VAR_4->indices[VAR_5] == MSR_STAR) {", "has_msr_star = 1;", "continue;", "}", "if (VAR_4->indices[VAR_5] == MSR_VM_HSAVE_PA) {", "has_msr_hsave_pa = 1;", "continue;", "}", "}", "}", "free(VAR_4);", "}", "return;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 13 ], [ 15 ], [ 19 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 41, 43, 45 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 83 ], [ 85 ], [ 89 ], [ 91 ] ]
7,494
static void spapr_lmb_release(DeviceState *dev, void *opaque) { HotplugHandler *hotplug_ctrl = qdev_get_hotplug_handler(dev); sPAPRMachineState *spapr = SPAPR_MACHINE(hotplug_ctrl); sPAPRDIMMState *ds = spapr_pending_dimm_unplugs_find(spapr, PC_DIMM(dev)); if (--ds->nr_lmbs) { return; } spapr_pending_dimm_unplugs_remove(spapr, ds); /* * Now that all the LMBs have been removed by the guest, call the * pc-dimm unplug handler to cleanup up the pc-dimm device. */ hotplug_handler_unplug(hotplug_ctrl, dev, &error_abort); }
false
qemu
318347234d7069b62d38391dd27e269a3107d668
static void spapr_lmb_release(DeviceState *dev, void *opaque) { HotplugHandler *hotplug_ctrl = qdev_get_hotplug_handler(dev); sPAPRMachineState *spapr = SPAPR_MACHINE(hotplug_ctrl); sPAPRDIMMState *ds = spapr_pending_dimm_unplugs_find(spapr, PC_DIMM(dev)); if (--ds->nr_lmbs) { return; } spapr_pending_dimm_unplugs_remove(spapr, ds); hotplug_handler_unplug(hotplug_ctrl, dev, &error_abort); }
{ "code": [], "line_no": [] }
static void FUNC_0(DeviceState *VAR_0, void *VAR_1) { HotplugHandler *hotplug_ctrl = qdev_get_hotplug_handler(VAR_0); sPAPRMachineState *spapr = SPAPR_MACHINE(hotplug_ctrl); sPAPRDIMMState *ds = spapr_pending_dimm_unplugs_find(spapr, PC_DIMM(VAR_0)); if (--ds->nr_lmbs) { return; } spapr_pending_dimm_unplugs_remove(spapr, ds); hotplug_handler_unplug(hotplug_ctrl, VAR_0, &error_abort); }
[ "static void FUNC_0(DeviceState *VAR_0, void *VAR_1)\n{", "HotplugHandler *hotplug_ctrl = qdev_get_hotplug_handler(VAR_0);", "sPAPRMachineState *spapr = SPAPR_MACHINE(hotplug_ctrl);", "sPAPRDIMMState *ds = spapr_pending_dimm_unplugs_find(spapr, PC_DIMM(VAR_0));", "if (--ds->nr_lmbs) {", "return;", "}", "spapr_pending_dimm_unplugs_remove(spapr, ds);", "hotplug_handler_unplug(hotplug_ctrl, VAR_0, &error_abort);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 33 ], [ 35 ] ]
7,495
static void monitor_readline_printf(void *opaque, const char *fmt, ...) { va_list ap; va_start(ap, fmt); monitor_vprintf(opaque, fmt, ap); va_end(ap); }
false
qemu
d5d1507b347b7cd6c3b82459b96f1889b29939ef
static void monitor_readline_printf(void *opaque, const char *fmt, ...) { va_list ap; va_start(ap, fmt); monitor_vprintf(opaque, fmt, ap); va_end(ap); }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0, const char *VAR_1, ...) { va_list ap; va_start(ap, VAR_1); monitor_vprintf(VAR_0, VAR_1, ap); va_end(ap); }
[ "static void FUNC_0(void *VAR_0, const char *VAR_1, ...)\n{", "va_list ap;", "va_start(ap, VAR_1);", "monitor_vprintf(VAR_0, VAR_1, ap);", "va_end(ap);", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ] ]
7,497
static int op_to_mov(int op) { switch (op_bits(op)) { case 32: return INDEX_op_mov_i32; #if TCG_TARGET_REG_BITS == 64 case 64: return INDEX_op_mov_i64; #endif default: fprintf(stderr, "op_to_mov: unexpected return value of " "function op_bits.\n"); tcg_abort(); } }
false
qemu
25c4d9cc845fb58f624dae8c0f690e20c70e7a1d
static int op_to_mov(int op) { switch (op_bits(op)) { case 32: return INDEX_op_mov_i32; #if TCG_TARGET_REG_BITS == 64 case 64: return INDEX_op_mov_i64; #endif default: fprintf(stderr, "op_to_mov: unexpected return value of " "function op_bits.\n"); tcg_abort(); } }
{ "code": [], "line_no": [] }
static int FUNC_0(int VAR_0) { switch (op_bits(VAR_0)) { case 32: return INDEX_op_mov_i32; #if TCG_TARGET_REG_BITS == 64 case 64: return INDEX_op_mov_i64; #endif default: fprintf(stderr, "FUNC_0: unexpected return value of " "function op_bits.\n"); tcg_abort(); } }
[ "static int FUNC_0(int VAR_0)\n{", "switch (op_bits(VAR_0)) {", "case 32:\nreturn INDEX_op_mov_i32;", "#if TCG_TARGET_REG_BITS == 64\ncase 64:\nreturn INDEX_op_mov_i64;", "#endif\ndefault:\nfprintf(stderr, \"FUNC_0: unexpected return value of \"\n\"function op_bits.\\n\");", "tcg_abort();", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7, 9 ], [ 11, 13, 15 ], [ 17, 19, 21, 23 ], [ 25 ], [ 27 ], [ 29 ] ]
7,499
void object_property_get_uint16List(Object *obj, const char *name, uint16List **list, Error **errp) { Error *err = NULL; StringOutputVisitor *ov; Visitor *v; char *str; ov = string_output_visitor_new(false); object_property_get(obj, string_output_get_visitor(ov), name, &err); if (err) { error_propagate(errp, err); goto out; } str = string_output_get_string(ov); v = string_input_visitor_new(str); visit_type_uint16List(v, NULL, list, errp); g_free(str); visit_free(v); out: string_output_visitor_cleanup(ov); }
false
qemu
e7ca56562990991bc614a43b9351ee0737f3045d
void object_property_get_uint16List(Object *obj, const char *name, uint16List **list, Error **errp) { Error *err = NULL; StringOutputVisitor *ov; Visitor *v; char *str; ov = string_output_visitor_new(false); object_property_get(obj, string_output_get_visitor(ov), name, &err); if (err) { error_propagate(errp, err); goto out; } str = string_output_get_string(ov); v = string_input_visitor_new(str); visit_type_uint16List(v, NULL, list, errp); g_free(str); visit_free(v); out: string_output_visitor_cleanup(ov); }
{ "code": [], "line_no": [] }
void FUNC_0(Object *VAR_0, const char *VAR_1, uint16List **VAR_2, Error **VAR_3) { Error *err = NULL; StringOutputVisitor *ov; Visitor *v; char *VAR_4; ov = string_output_visitor_new(false); object_property_get(VAR_0, string_output_get_visitor(ov), VAR_1, &err); if (err) { error_propagate(VAR_3, err); goto out; } VAR_4 = string_output_get_string(ov); v = string_input_visitor_new(VAR_4); visit_type_uint16List(v, NULL, VAR_2, VAR_3); g_free(VAR_4); visit_free(v); out: string_output_visitor_cleanup(ov); }
[ "void FUNC_0(Object *VAR_0, const char *VAR_1,\nuint16List **VAR_2, Error **VAR_3)\n{", "Error *err = NULL;", "StringOutputVisitor *ov;", "Visitor *v;", "char *VAR_4;", "ov = string_output_visitor_new(false);", "object_property_get(VAR_0, string_output_get_visitor(ov),\nVAR_1, &err);", "if (err) {", "error_propagate(VAR_3, err);", "goto out;", "}", "VAR_4 = string_output_get_string(ov);", "v = string_input_visitor_new(VAR_4);", "visit_type_uint16List(v, NULL, VAR_2, VAR_3);", "g_free(VAR_4);", "visit_free(v);", "out:\nstring_output_visitor_cleanup(ov);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19, 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 43, 45 ], [ 47 ] ]
7,500
static void chroma_4mv_motion(MpegEncContext *s, uint8_t *dest_cb, uint8_t *dest_cr, uint8_t **ref_picture, op_pixels_func *pix_op, int mx, int my) { uint8_t *ptr; int src_x, src_y, dxy, emu = 0; ptrdiff_t offset; /* In case of 8X8, we construct a single chroma motion vector * with a special rounding */ mx = ff_h263_round_chroma(mx); my = ff_h263_round_chroma(my); dxy = ((my & 1) << 1) | (mx & 1); mx >>= 1; my >>= 1; src_x = s->mb_x * 8 + mx; src_y = s->mb_y * 8 + my; src_x = av_clip(src_x, -8, (s->width >> 1)); if (src_x == (s->width >> 1)) dxy &= ~1; src_y = av_clip(src_y, -8, (s->height >> 1)); if (src_y == (s->height >> 1)) dxy &= ~2; offset = src_y * s->uvlinesize + src_x; ptr = ref_picture[1] + offset; if ((unsigned)src_x > FFMAX((s->h_edge_pos >> 1) - (dxy & 1) - 8, 0) || (unsigned)src_y > FFMAX((s->v_edge_pos >> 1) - (dxy >> 1) - 8, 0)) { s->vdsp.emulated_edge_mc(s->edge_emu_buffer, ptr, s->uvlinesize, s->uvlinesize, 9, 9, src_x, src_y, s->h_edge_pos >> 1, s->v_edge_pos >> 1); ptr = s->edge_emu_buffer; emu = 1; } pix_op[dxy](dest_cb, ptr, s->uvlinesize, 8); ptr = ref_picture[2] + offset; if (emu) { s->vdsp.emulated_edge_mc(s->edge_emu_buffer, ptr, s->uvlinesize, s->uvlinesize, 9, 9, src_x, src_y, s->h_edge_pos >> 1, s->v_edge_pos >> 1); ptr = s->edge_emu_buffer; } pix_op[dxy](dest_cr, ptr, s->uvlinesize, 8); }
false
FFmpeg
8849c4ceac0f35e88b2dc406bf5ffc4173a38ffe
static void chroma_4mv_motion(MpegEncContext *s, uint8_t *dest_cb, uint8_t *dest_cr, uint8_t **ref_picture, op_pixels_func *pix_op, int mx, int my) { uint8_t *ptr; int src_x, src_y, dxy, emu = 0; ptrdiff_t offset; mx = ff_h263_round_chroma(mx); my = ff_h263_round_chroma(my); dxy = ((my & 1) << 1) | (mx & 1); mx >>= 1; my >>= 1; src_x = s->mb_x * 8 + mx; src_y = s->mb_y * 8 + my; src_x = av_clip(src_x, -8, (s->width >> 1)); if (src_x == (s->width >> 1)) dxy &= ~1; src_y = av_clip(src_y, -8, (s->height >> 1)); if (src_y == (s->height >> 1)) dxy &= ~2; offset = src_y * s->uvlinesize + src_x; ptr = ref_picture[1] + offset; if ((unsigned)src_x > FFMAX((s->h_edge_pos >> 1) - (dxy & 1) - 8, 0) || (unsigned)src_y > FFMAX((s->v_edge_pos >> 1) - (dxy >> 1) - 8, 0)) { s->vdsp.emulated_edge_mc(s->edge_emu_buffer, ptr, s->uvlinesize, s->uvlinesize, 9, 9, src_x, src_y, s->h_edge_pos >> 1, s->v_edge_pos >> 1); ptr = s->edge_emu_buffer; emu = 1; } pix_op[dxy](dest_cb, ptr, s->uvlinesize, 8); ptr = ref_picture[2] + offset; if (emu) { s->vdsp.emulated_edge_mc(s->edge_emu_buffer, ptr, s->uvlinesize, s->uvlinesize, 9, 9, src_x, src_y, s->h_edge_pos >> 1, s->v_edge_pos >> 1); ptr = s->edge_emu_buffer; } pix_op[dxy](dest_cr, ptr, s->uvlinesize, 8); }
{ "code": [], "line_no": [] }
static void FUNC_0(MpegEncContext *VAR_0, uint8_t *VAR_1, uint8_t *VAR_2, uint8_t **VAR_3, op_pixels_func *VAR_4, int VAR_5, int VAR_6) { uint8_t *ptr; int VAR_7, VAR_8, VAR_9, VAR_10 = 0; ptrdiff_t offset; VAR_5 = ff_h263_round_chroma(VAR_5); VAR_6 = ff_h263_round_chroma(VAR_6); VAR_9 = ((VAR_6 & 1) << 1) | (VAR_5 & 1); VAR_5 >>= 1; VAR_6 >>= 1; VAR_7 = VAR_0->mb_x * 8 + VAR_5; VAR_8 = VAR_0->mb_y * 8 + VAR_6; VAR_7 = av_clip(VAR_7, -8, (VAR_0->width >> 1)); if (VAR_7 == (VAR_0->width >> 1)) VAR_9 &= ~1; VAR_8 = av_clip(VAR_8, -8, (VAR_0->height >> 1)); if (VAR_8 == (VAR_0->height >> 1)) VAR_9 &= ~2; offset = VAR_8 * VAR_0->uvlinesize + VAR_7; ptr = VAR_3[1] + offset; if ((unsigned)VAR_7 > FFMAX((VAR_0->h_edge_pos >> 1) - (VAR_9 & 1) - 8, 0) || (unsigned)VAR_8 > FFMAX((VAR_0->v_edge_pos >> 1) - (VAR_9 >> 1) - 8, 0)) { VAR_0->vdsp.emulated_edge_mc(VAR_0->edge_emu_buffer, ptr, VAR_0->uvlinesize, VAR_0->uvlinesize, 9, 9, VAR_7, VAR_8, VAR_0->h_edge_pos >> 1, VAR_0->v_edge_pos >> 1); ptr = VAR_0->edge_emu_buffer; VAR_10 = 1; } VAR_4[VAR_9](VAR_1, ptr, VAR_0->uvlinesize, 8); ptr = VAR_3[2] + offset; if (VAR_10) { VAR_0->vdsp.emulated_edge_mc(VAR_0->edge_emu_buffer, ptr, VAR_0->uvlinesize, VAR_0->uvlinesize, 9, 9, VAR_7, VAR_8, VAR_0->h_edge_pos >> 1, VAR_0->v_edge_pos >> 1); ptr = VAR_0->edge_emu_buffer; } VAR_4[VAR_9](VAR_2, ptr, VAR_0->uvlinesize, 8); }
[ "static void FUNC_0(MpegEncContext *VAR_0,\nuint8_t *VAR_1, uint8_t *VAR_2,\nuint8_t **VAR_3,\nop_pixels_func *VAR_4,\nint VAR_5, int VAR_6)\n{", "uint8_t *ptr;", "int VAR_7, VAR_8, VAR_9, VAR_10 = 0;", "ptrdiff_t offset;", "VAR_5 = ff_h263_round_chroma(VAR_5);", "VAR_6 = ff_h263_round_chroma(VAR_6);", "VAR_9 = ((VAR_6 & 1) << 1) | (VAR_5 & 1);", "VAR_5 >>= 1;", "VAR_6 >>= 1;", "VAR_7 = VAR_0->mb_x * 8 + VAR_5;", "VAR_8 = VAR_0->mb_y * 8 + VAR_6;", "VAR_7 = av_clip(VAR_7, -8, (VAR_0->width >> 1));", "if (VAR_7 == (VAR_0->width >> 1))\nVAR_9 &= ~1;", "VAR_8 = av_clip(VAR_8, -8, (VAR_0->height >> 1));", "if (VAR_8 == (VAR_0->height >> 1))\nVAR_9 &= ~2;", "offset = VAR_8 * VAR_0->uvlinesize + VAR_7;", "ptr = VAR_3[1] + offset;", "if ((unsigned)VAR_7 > FFMAX((VAR_0->h_edge_pos >> 1) - (VAR_9 & 1) - 8, 0) ||\n(unsigned)VAR_8 > FFMAX((VAR_0->v_edge_pos >> 1) - (VAR_9 >> 1) - 8, 0)) {", "VAR_0->vdsp.emulated_edge_mc(VAR_0->edge_emu_buffer, ptr,\nVAR_0->uvlinesize, VAR_0->uvlinesize,\n9, 9, VAR_7, VAR_8,\nVAR_0->h_edge_pos >> 1, VAR_0->v_edge_pos >> 1);", "ptr = VAR_0->edge_emu_buffer;", "VAR_10 = 1;", "}", "VAR_4[VAR_9](VAR_1, ptr, VAR_0->uvlinesize, 8);", "ptr = VAR_3[2] + offset;", "if (VAR_10) {", "VAR_0->vdsp.emulated_edge_mc(VAR_0->edge_emu_buffer, ptr,\nVAR_0->uvlinesize, VAR_0->uvlinesize,\n9, 9, VAR_7, VAR_8,\nVAR_0->h_edge_pos >> 1, VAR_0->v_edge_pos >> 1);", "ptr = VAR_0->edge_emu_buffer;", "}", "VAR_4[VAR_9](VAR_2, ptr, VAR_0->uvlinesize, 8);", "}" ]
[ 0, 0, 0, 0, 0, 0, 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 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 45, 47 ], [ 49 ], [ 51, 53 ], [ 57 ], [ 59 ], [ 61, 63 ], [ 65, 67, 69, 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 83 ], [ 85 ], [ 87, 89, 91, 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ] ]
7,501
static inline void tcg_out_op(TCGContext *s, TCGOpcode opc, const TCGArg *args, const int *const_args) { int c; switch (opc) { case INDEX_op_exit_tb: { uint8_t *ld_ptr = s->code_ptr; if (args[0] >> 8) tcg_out_ld32_12(s, COND_AL, TCG_REG_R0, TCG_REG_PC, 0); else tcg_out_dat_imm(s, COND_AL, ARITH_MOV, TCG_REG_R0, 0, args[0]); tcg_out_goto(s, COND_AL, (tcg_target_ulong) tb_ret_addr); if (args[0] >> 8) { *ld_ptr = (uint8_t) (s->code_ptr - ld_ptr) - 8; tcg_out32(s, args[0]); } } break; case INDEX_op_goto_tb: if (s->tb_jmp_offset) { /* Direct jump method */ #if defined(USE_DIRECT_JUMP) s->tb_jmp_offset[args[0]] = s->code_ptr - s->code_buf; tcg_out_b_noaddr(s, COND_AL); #else tcg_out_ld32_12(s, COND_AL, TCG_REG_PC, TCG_REG_PC, -4); s->tb_jmp_offset[args[0]] = s->code_ptr - s->code_buf; tcg_out32(s, 0); #endif } else { /* Indirect jump method */ #if 1 c = (int) (s->tb_next + args[0]) - ((int) s->code_ptr + 8); if (c > 0xfff || c < -0xfff) { tcg_out_movi32(s, COND_AL, TCG_REG_R0, (tcg_target_long) (s->tb_next + args[0])); tcg_out_ld32_12(s, COND_AL, TCG_REG_PC, TCG_REG_R0, 0); } else tcg_out_ld32_12(s, COND_AL, TCG_REG_PC, TCG_REG_PC, c); #else tcg_out_ld32_12(s, COND_AL, TCG_REG_R0, TCG_REG_PC, 0); tcg_out_ld32_12(s, COND_AL, TCG_REG_PC, TCG_REG_R0, 0); tcg_out32(s, (tcg_target_long) (s->tb_next + args[0])); #endif } s->tb_next_offset[args[0]] = s->code_ptr - s->code_buf; break; case INDEX_op_call: if (const_args[0]) tcg_out_call(s, args[0]); else tcg_out_callr(s, COND_AL, args[0]); break; case INDEX_op_br: tcg_out_goto_label(s, COND_AL, args[0]); break; case INDEX_op_ld8u_i32: tcg_out_ld8u(s, COND_AL, args[0], args[1], args[2]); break; case INDEX_op_ld8s_i32: tcg_out_ld8s(s, COND_AL, args[0], args[1], args[2]); break; case INDEX_op_ld16u_i32: tcg_out_ld16u(s, COND_AL, args[0], args[1], args[2]); break; case INDEX_op_ld16s_i32: tcg_out_ld16s(s, COND_AL, args[0], args[1], args[2]); break; case INDEX_op_ld_i32: tcg_out_ld32u(s, COND_AL, args[0], args[1], args[2]); break; case INDEX_op_st8_i32: tcg_out_st8(s, COND_AL, args[0], args[1], args[2]); break; case INDEX_op_st16_i32: tcg_out_st16(s, COND_AL, args[0], args[1], args[2]); break; case INDEX_op_st_i32: tcg_out_st32(s, COND_AL, args[0], args[1], args[2]); break; case INDEX_op_mov_i32: tcg_out_dat_reg(s, COND_AL, ARITH_MOV, args[0], 0, args[1], SHIFT_IMM_LSL(0)); break; case INDEX_op_movi_i32: tcg_out_movi32(s, COND_AL, args[0], args[1]); break; case INDEX_op_movcond_i32: /* Constraints mean that v2 is always in the same register as dest, * so we only need to do "if condition passed, move v1 to dest". */ tcg_out_dat_rI(s, COND_AL, ARITH_CMP, 0, args[1], args[2], const_args[2]); tcg_out_dat_rI(s, tcg_cond_to_arm_cond[args[5]], ARITH_MOV, args[0], 0, args[3], const_args[3]); break; case INDEX_op_add_i32: c = ARITH_ADD; goto gen_arith; case INDEX_op_sub_i32: c = ARITH_SUB; goto gen_arith; case INDEX_op_and_i32: tcg_out_dat_rIK(s, COND_AL, ARITH_AND, ARITH_BIC, args[0], args[1], args[2], const_args[2]); break; case INDEX_op_andc_i32: tcg_out_dat_rIK(s, COND_AL, ARITH_BIC, ARITH_AND, args[0], args[1], args[2], const_args[2]); break; case INDEX_op_or_i32: c = ARITH_ORR; goto gen_arith; case INDEX_op_xor_i32: c = ARITH_EOR; /* Fall through. */ gen_arith: tcg_out_dat_rI(s, COND_AL, c, args[0], args[1], args[2], const_args[2]); break; case INDEX_op_add2_i32: tcg_out_dat_reg2(s, COND_AL, ARITH_ADD, ARITH_ADC, args[0], args[1], args[2], args[3], args[4], args[5], SHIFT_IMM_LSL(0)); break; case INDEX_op_sub2_i32: tcg_out_dat_reg2(s, COND_AL, ARITH_SUB, ARITH_SBC, args[0], args[1], args[2], args[3], args[4], args[5], SHIFT_IMM_LSL(0)); break; case INDEX_op_neg_i32: tcg_out_dat_imm(s, COND_AL, ARITH_RSB, args[0], args[1], 0); break; case INDEX_op_not_i32: tcg_out_dat_reg(s, COND_AL, ARITH_MVN, args[0], 0, args[1], SHIFT_IMM_LSL(0)); break; case INDEX_op_mul_i32: tcg_out_mul32(s, COND_AL, args[0], args[1], args[2]); break; case INDEX_op_mulu2_i32: tcg_out_umull32(s, COND_AL, args[0], args[1], args[2], args[3]); break; case INDEX_op_muls2_i32: tcg_out_smull32(s, COND_AL, args[0], args[1], args[2], args[3]); break; /* XXX: Perhaps args[2] & 0x1f is wrong */ case INDEX_op_shl_i32: c = const_args[2] ? SHIFT_IMM_LSL(args[2] & 0x1f) : SHIFT_REG_LSL(args[2]); goto gen_shift32; case INDEX_op_shr_i32: c = const_args[2] ? (args[2] & 0x1f) ? SHIFT_IMM_LSR(args[2] & 0x1f) : SHIFT_IMM_LSL(0) : SHIFT_REG_LSR(args[2]); goto gen_shift32; case INDEX_op_sar_i32: c = const_args[2] ? (args[2] & 0x1f) ? SHIFT_IMM_ASR(args[2] & 0x1f) : SHIFT_IMM_LSL(0) : SHIFT_REG_ASR(args[2]); goto gen_shift32; case INDEX_op_rotr_i32: c = const_args[2] ? (args[2] & 0x1f) ? SHIFT_IMM_ROR(args[2] & 0x1f) : SHIFT_IMM_LSL(0) : SHIFT_REG_ROR(args[2]); /* Fall through. */ gen_shift32: tcg_out_dat_reg(s, COND_AL, ARITH_MOV, args[0], 0, args[1], c); break; case INDEX_op_rotl_i32: if (const_args[2]) { tcg_out_dat_reg(s, COND_AL, ARITH_MOV, args[0], 0, args[1], ((0x20 - args[2]) & 0x1f) ? SHIFT_IMM_ROR((0x20 - args[2]) & 0x1f) : SHIFT_IMM_LSL(0)); } else { tcg_out_dat_imm(s, COND_AL, ARITH_RSB, TCG_REG_R8, args[1], 0x20); tcg_out_dat_reg(s, COND_AL, ARITH_MOV, args[0], 0, args[1], SHIFT_REG_ROR(TCG_REG_R8)); } break; case INDEX_op_brcond_i32: tcg_out_dat_rI(s, COND_AL, ARITH_CMP, 0, args[0], args[1], const_args[1]); tcg_out_goto_label(s, tcg_cond_to_arm_cond[args[2]], args[3]); break; case INDEX_op_brcond2_i32: /* The resulting conditions are: * TCG_COND_EQ --> a0 == a2 && a1 == a3, * TCG_COND_NE --> (a0 != a2 && a1 == a3) || a1 != a3, * TCG_COND_LT(U) --> (a0 < a2 && a1 == a3) || a1 < a3, * TCG_COND_GE(U) --> (a0 >= a2 && a1 == a3) || (a1 >= a3 && a1 != a3), * TCG_COND_LE(U) --> (a0 <= a2 && a1 == a3) || (a1 <= a3 && a1 != a3), * TCG_COND_GT(U) --> (a0 > a2 && a1 == a3) || a1 > a3, */ tcg_out_dat_reg(s, COND_AL, ARITH_CMP, 0, args[1], args[3], SHIFT_IMM_LSL(0)); tcg_out_dat_reg(s, COND_EQ, ARITH_CMP, 0, args[0], args[2], SHIFT_IMM_LSL(0)); tcg_out_goto_label(s, tcg_cond_to_arm_cond[args[4]], args[5]); break; case INDEX_op_setcond_i32: tcg_out_dat_rI(s, COND_AL, ARITH_CMP, 0, args[1], args[2], const_args[2]); tcg_out_dat_imm(s, tcg_cond_to_arm_cond[args[3]], ARITH_MOV, args[0], 0, 1); tcg_out_dat_imm(s, tcg_cond_to_arm_cond[tcg_invert_cond(args[3])], ARITH_MOV, args[0], 0, 0); break; case INDEX_op_setcond2_i32: /* See brcond2_i32 comment */ tcg_out_dat_reg(s, COND_AL, ARITH_CMP, 0, args[2], args[4], SHIFT_IMM_LSL(0)); tcg_out_dat_reg(s, COND_EQ, ARITH_CMP, 0, args[1], args[3], SHIFT_IMM_LSL(0)); tcg_out_dat_imm(s, tcg_cond_to_arm_cond[args[5]], ARITH_MOV, args[0], 0, 1); tcg_out_dat_imm(s, tcg_cond_to_arm_cond[tcg_invert_cond(args[5])], ARITH_MOV, args[0], 0, 0); break; case INDEX_op_qemu_ld8u: tcg_out_qemu_ld(s, args, 0); break; case INDEX_op_qemu_ld8s: tcg_out_qemu_ld(s, args, 0 | 4); break; case INDEX_op_qemu_ld16u: tcg_out_qemu_ld(s, args, 1); break; case INDEX_op_qemu_ld16s: tcg_out_qemu_ld(s, args, 1 | 4); break; case INDEX_op_qemu_ld32: tcg_out_qemu_ld(s, args, 2); break; case INDEX_op_qemu_ld64: tcg_out_qemu_ld(s, args, 3); break; case INDEX_op_qemu_st8: tcg_out_qemu_st(s, args, 0); break; case INDEX_op_qemu_st16: tcg_out_qemu_st(s, args, 1); break; case INDEX_op_qemu_st32: tcg_out_qemu_st(s, args, 2); break; case INDEX_op_qemu_st64: tcg_out_qemu_st(s, args, 3); break; case INDEX_op_bswap16_i32: tcg_out_bswap16(s, COND_AL, args[0], args[1]); break; case INDEX_op_bswap32_i32: tcg_out_bswap32(s, COND_AL, args[0], args[1]); break; case INDEX_op_ext8s_i32: tcg_out_ext8s(s, COND_AL, args[0], args[1]); break; case INDEX_op_ext16s_i32: tcg_out_ext16s(s, COND_AL, args[0], args[1]); break; case INDEX_op_ext16u_i32: tcg_out_ext16u(s, COND_AL, args[0], args[1]); break; default: tcg_abort(); } }
false
qemu
a9a86ae95d24c587285856405dffc9cacdf2b683
static inline void tcg_out_op(TCGContext *s, TCGOpcode opc, const TCGArg *args, const int *const_args) { int c; switch (opc) { case INDEX_op_exit_tb: { uint8_t *ld_ptr = s->code_ptr; if (args[0] >> 8) tcg_out_ld32_12(s, COND_AL, TCG_REG_R0, TCG_REG_PC, 0); else tcg_out_dat_imm(s, COND_AL, ARITH_MOV, TCG_REG_R0, 0, args[0]); tcg_out_goto(s, COND_AL, (tcg_target_ulong) tb_ret_addr); if (args[0] >> 8) { *ld_ptr = (uint8_t) (s->code_ptr - ld_ptr) - 8; tcg_out32(s, args[0]); } } break; case INDEX_op_goto_tb: if (s->tb_jmp_offset) { #if defined(USE_DIRECT_JUMP) s->tb_jmp_offset[args[0]] = s->code_ptr - s->code_buf; tcg_out_b_noaddr(s, COND_AL); #else tcg_out_ld32_12(s, COND_AL, TCG_REG_PC, TCG_REG_PC, -4); s->tb_jmp_offset[args[0]] = s->code_ptr - s->code_buf; tcg_out32(s, 0); #endif } else { #if 1 c = (int) (s->tb_next + args[0]) - ((int) s->code_ptr + 8); if (c > 0xfff || c < -0xfff) { tcg_out_movi32(s, COND_AL, TCG_REG_R0, (tcg_target_long) (s->tb_next + args[0])); tcg_out_ld32_12(s, COND_AL, TCG_REG_PC, TCG_REG_R0, 0); } else tcg_out_ld32_12(s, COND_AL, TCG_REG_PC, TCG_REG_PC, c); #else tcg_out_ld32_12(s, COND_AL, TCG_REG_R0, TCG_REG_PC, 0); tcg_out_ld32_12(s, COND_AL, TCG_REG_PC, TCG_REG_R0, 0); tcg_out32(s, (tcg_target_long) (s->tb_next + args[0])); #endif } s->tb_next_offset[args[0]] = s->code_ptr - s->code_buf; break; case INDEX_op_call: if (const_args[0]) tcg_out_call(s, args[0]); else tcg_out_callr(s, COND_AL, args[0]); break; case INDEX_op_br: tcg_out_goto_label(s, COND_AL, args[0]); break; case INDEX_op_ld8u_i32: tcg_out_ld8u(s, COND_AL, args[0], args[1], args[2]); break; case INDEX_op_ld8s_i32: tcg_out_ld8s(s, COND_AL, args[0], args[1], args[2]); break; case INDEX_op_ld16u_i32: tcg_out_ld16u(s, COND_AL, args[0], args[1], args[2]); break; case INDEX_op_ld16s_i32: tcg_out_ld16s(s, COND_AL, args[0], args[1], args[2]); break; case INDEX_op_ld_i32: tcg_out_ld32u(s, COND_AL, args[0], args[1], args[2]); break; case INDEX_op_st8_i32: tcg_out_st8(s, COND_AL, args[0], args[1], args[2]); break; case INDEX_op_st16_i32: tcg_out_st16(s, COND_AL, args[0], args[1], args[2]); break; case INDEX_op_st_i32: tcg_out_st32(s, COND_AL, args[0], args[1], args[2]); break; case INDEX_op_mov_i32: tcg_out_dat_reg(s, COND_AL, ARITH_MOV, args[0], 0, args[1], SHIFT_IMM_LSL(0)); break; case INDEX_op_movi_i32: tcg_out_movi32(s, COND_AL, args[0], args[1]); break; case INDEX_op_movcond_i32: tcg_out_dat_rI(s, COND_AL, ARITH_CMP, 0, args[1], args[2], const_args[2]); tcg_out_dat_rI(s, tcg_cond_to_arm_cond[args[5]], ARITH_MOV, args[0], 0, args[3], const_args[3]); break; case INDEX_op_add_i32: c = ARITH_ADD; goto gen_arith; case INDEX_op_sub_i32: c = ARITH_SUB; goto gen_arith; case INDEX_op_and_i32: tcg_out_dat_rIK(s, COND_AL, ARITH_AND, ARITH_BIC, args[0], args[1], args[2], const_args[2]); break; case INDEX_op_andc_i32: tcg_out_dat_rIK(s, COND_AL, ARITH_BIC, ARITH_AND, args[0], args[1], args[2], const_args[2]); break; case INDEX_op_or_i32: c = ARITH_ORR; goto gen_arith; case INDEX_op_xor_i32: c = ARITH_EOR; gen_arith: tcg_out_dat_rI(s, COND_AL, c, args[0], args[1], args[2], const_args[2]); break; case INDEX_op_add2_i32: tcg_out_dat_reg2(s, COND_AL, ARITH_ADD, ARITH_ADC, args[0], args[1], args[2], args[3], args[4], args[5], SHIFT_IMM_LSL(0)); break; case INDEX_op_sub2_i32: tcg_out_dat_reg2(s, COND_AL, ARITH_SUB, ARITH_SBC, args[0], args[1], args[2], args[3], args[4], args[5], SHIFT_IMM_LSL(0)); break; case INDEX_op_neg_i32: tcg_out_dat_imm(s, COND_AL, ARITH_RSB, args[0], args[1], 0); break; case INDEX_op_not_i32: tcg_out_dat_reg(s, COND_AL, ARITH_MVN, args[0], 0, args[1], SHIFT_IMM_LSL(0)); break; case INDEX_op_mul_i32: tcg_out_mul32(s, COND_AL, args[0], args[1], args[2]); break; case INDEX_op_mulu2_i32: tcg_out_umull32(s, COND_AL, args[0], args[1], args[2], args[3]); break; case INDEX_op_muls2_i32: tcg_out_smull32(s, COND_AL, args[0], args[1], args[2], args[3]); break; case INDEX_op_shl_i32: c = const_args[2] ? SHIFT_IMM_LSL(args[2] & 0x1f) : SHIFT_REG_LSL(args[2]); goto gen_shift32; case INDEX_op_shr_i32: c = const_args[2] ? (args[2] & 0x1f) ? SHIFT_IMM_LSR(args[2] & 0x1f) : SHIFT_IMM_LSL(0) : SHIFT_REG_LSR(args[2]); goto gen_shift32; case INDEX_op_sar_i32: c = const_args[2] ? (args[2] & 0x1f) ? SHIFT_IMM_ASR(args[2] & 0x1f) : SHIFT_IMM_LSL(0) : SHIFT_REG_ASR(args[2]); goto gen_shift32; case INDEX_op_rotr_i32: c = const_args[2] ? (args[2] & 0x1f) ? SHIFT_IMM_ROR(args[2] & 0x1f) : SHIFT_IMM_LSL(0) : SHIFT_REG_ROR(args[2]); gen_shift32: tcg_out_dat_reg(s, COND_AL, ARITH_MOV, args[0], 0, args[1], c); break; case INDEX_op_rotl_i32: if (const_args[2]) { tcg_out_dat_reg(s, COND_AL, ARITH_MOV, args[0], 0, args[1], ((0x20 - args[2]) & 0x1f) ? SHIFT_IMM_ROR((0x20 - args[2]) & 0x1f) : SHIFT_IMM_LSL(0)); } else { tcg_out_dat_imm(s, COND_AL, ARITH_RSB, TCG_REG_R8, args[1], 0x20); tcg_out_dat_reg(s, COND_AL, ARITH_MOV, args[0], 0, args[1], SHIFT_REG_ROR(TCG_REG_R8)); } break; case INDEX_op_brcond_i32: tcg_out_dat_rI(s, COND_AL, ARITH_CMP, 0, args[0], args[1], const_args[1]); tcg_out_goto_label(s, tcg_cond_to_arm_cond[args[2]], args[3]); break; case INDEX_op_brcond2_i32: tcg_out_dat_reg(s, COND_AL, ARITH_CMP, 0, args[1], args[3], SHIFT_IMM_LSL(0)); tcg_out_dat_reg(s, COND_EQ, ARITH_CMP, 0, args[0], args[2], SHIFT_IMM_LSL(0)); tcg_out_goto_label(s, tcg_cond_to_arm_cond[args[4]], args[5]); break; case INDEX_op_setcond_i32: tcg_out_dat_rI(s, COND_AL, ARITH_CMP, 0, args[1], args[2], const_args[2]); tcg_out_dat_imm(s, tcg_cond_to_arm_cond[args[3]], ARITH_MOV, args[0], 0, 1); tcg_out_dat_imm(s, tcg_cond_to_arm_cond[tcg_invert_cond(args[3])], ARITH_MOV, args[0], 0, 0); break; case INDEX_op_setcond2_i32: tcg_out_dat_reg(s, COND_AL, ARITH_CMP, 0, args[2], args[4], SHIFT_IMM_LSL(0)); tcg_out_dat_reg(s, COND_EQ, ARITH_CMP, 0, args[1], args[3], SHIFT_IMM_LSL(0)); tcg_out_dat_imm(s, tcg_cond_to_arm_cond[args[5]], ARITH_MOV, args[0], 0, 1); tcg_out_dat_imm(s, tcg_cond_to_arm_cond[tcg_invert_cond(args[5])], ARITH_MOV, args[0], 0, 0); break; case INDEX_op_qemu_ld8u: tcg_out_qemu_ld(s, args, 0); break; case INDEX_op_qemu_ld8s: tcg_out_qemu_ld(s, args, 0 | 4); break; case INDEX_op_qemu_ld16u: tcg_out_qemu_ld(s, args, 1); break; case INDEX_op_qemu_ld16s: tcg_out_qemu_ld(s, args, 1 | 4); break; case INDEX_op_qemu_ld32: tcg_out_qemu_ld(s, args, 2); break; case INDEX_op_qemu_ld64: tcg_out_qemu_ld(s, args, 3); break; case INDEX_op_qemu_st8: tcg_out_qemu_st(s, args, 0); break; case INDEX_op_qemu_st16: tcg_out_qemu_st(s, args, 1); break; case INDEX_op_qemu_st32: tcg_out_qemu_st(s, args, 2); break; case INDEX_op_qemu_st64: tcg_out_qemu_st(s, args, 3); break; case INDEX_op_bswap16_i32: tcg_out_bswap16(s, COND_AL, args[0], args[1]); break; case INDEX_op_bswap32_i32: tcg_out_bswap32(s, COND_AL, args[0], args[1]); break; case INDEX_op_ext8s_i32: tcg_out_ext8s(s, COND_AL, args[0], args[1]); break; case INDEX_op_ext16s_i32: tcg_out_ext16s(s, COND_AL, args[0], args[1]); break; case INDEX_op_ext16u_i32: tcg_out_ext16u(s, COND_AL, args[0], args[1]); break; default: tcg_abort(); } }
{ "code": [], "line_no": [] }
static inline void FUNC_0(TCGContext *VAR_0, TCGOpcode VAR_1, const TCGArg *VAR_2, const int *VAR_3) { int VAR_4; switch (VAR_1) { case INDEX_op_exit_tb: { uint8_t *ld_ptr = VAR_0->code_ptr; if (VAR_2[0] >> 8) tcg_out_ld32_12(VAR_0, COND_AL, TCG_REG_R0, TCG_REG_PC, 0); else tcg_out_dat_imm(VAR_0, COND_AL, ARITH_MOV, TCG_REG_R0, 0, VAR_2[0]); tcg_out_goto(VAR_0, COND_AL, (tcg_target_ulong) tb_ret_addr); if (VAR_2[0] >> 8) { *ld_ptr = (uint8_t) (VAR_0->code_ptr - ld_ptr) - 8; tcg_out32(VAR_0, VAR_2[0]); } } break; case INDEX_op_goto_tb: if (VAR_0->tb_jmp_offset) { #if defined(USE_DIRECT_JUMP) VAR_0->tb_jmp_offset[VAR_2[0]] = VAR_0->code_ptr - VAR_0->code_buf; tcg_out_b_noaddr(VAR_0, COND_AL); #else tcg_out_ld32_12(VAR_0, COND_AL, TCG_REG_PC, TCG_REG_PC, -4); VAR_0->tb_jmp_offset[VAR_2[0]] = VAR_0->code_ptr - VAR_0->code_buf; tcg_out32(VAR_0, 0); #endif } else { #if 1 VAR_4 = (int) (VAR_0->tb_next + VAR_2[0]) - ((int) VAR_0->code_ptr + 8); if (VAR_4 > 0xfff || VAR_4 < -0xfff) { tcg_out_movi32(VAR_0, COND_AL, TCG_REG_R0, (tcg_target_long) (VAR_0->tb_next + VAR_2[0])); tcg_out_ld32_12(VAR_0, COND_AL, TCG_REG_PC, TCG_REG_R0, 0); } else tcg_out_ld32_12(VAR_0, COND_AL, TCG_REG_PC, TCG_REG_PC, VAR_4); #else tcg_out_ld32_12(VAR_0, COND_AL, TCG_REG_R0, TCG_REG_PC, 0); tcg_out_ld32_12(VAR_0, COND_AL, TCG_REG_PC, TCG_REG_R0, 0); tcg_out32(VAR_0, (tcg_target_long) (VAR_0->tb_next + VAR_2[0])); #endif } VAR_0->tb_next_offset[VAR_2[0]] = VAR_0->code_ptr - VAR_0->code_buf; break; case INDEX_op_call: if (VAR_3[0]) tcg_out_call(VAR_0, VAR_2[0]); else tcg_out_callr(VAR_0, COND_AL, VAR_2[0]); break; case INDEX_op_br: tcg_out_goto_label(VAR_0, COND_AL, VAR_2[0]); break; case INDEX_op_ld8u_i32: tcg_out_ld8u(VAR_0, COND_AL, VAR_2[0], VAR_2[1], VAR_2[2]); break; case INDEX_op_ld8s_i32: tcg_out_ld8s(VAR_0, COND_AL, VAR_2[0], VAR_2[1], VAR_2[2]); break; case INDEX_op_ld16u_i32: tcg_out_ld16u(VAR_0, COND_AL, VAR_2[0], VAR_2[1], VAR_2[2]); break; case INDEX_op_ld16s_i32: tcg_out_ld16s(VAR_0, COND_AL, VAR_2[0], VAR_2[1], VAR_2[2]); break; case INDEX_op_ld_i32: tcg_out_ld32u(VAR_0, COND_AL, VAR_2[0], VAR_2[1], VAR_2[2]); break; case INDEX_op_st8_i32: tcg_out_st8(VAR_0, COND_AL, VAR_2[0], VAR_2[1], VAR_2[2]); break; case INDEX_op_st16_i32: tcg_out_st16(VAR_0, COND_AL, VAR_2[0], VAR_2[1], VAR_2[2]); break; case INDEX_op_st_i32: tcg_out_st32(VAR_0, COND_AL, VAR_2[0], VAR_2[1], VAR_2[2]); break; case INDEX_op_mov_i32: tcg_out_dat_reg(VAR_0, COND_AL, ARITH_MOV, VAR_2[0], 0, VAR_2[1], SHIFT_IMM_LSL(0)); break; case INDEX_op_movi_i32: tcg_out_movi32(VAR_0, COND_AL, VAR_2[0], VAR_2[1]); break; case INDEX_op_movcond_i32: tcg_out_dat_rI(VAR_0, COND_AL, ARITH_CMP, 0, VAR_2[1], VAR_2[2], VAR_3[2]); tcg_out_dat_rI(VAR_0, tcg_cond_to_arm_cond[VAR_2[5]], ARITH_MOV, VAR_2[0], 0, VAR_2[3], VAR_3[3]); break; case INDEX_op_add_i32: VAR_4 = ARITH_ADD; goto gen_arith; case INDEX_op_sub_i32: VAR_4 = ARITH_SUB; goto gen_arith; case INDEX_op_and_i32: tcg_out_dat_rIK(VAR_0, COND_AL, ARITH_AND, ARITH_BIC, VAR_2[0], VAR_2[1], VAR_2[2], VAR_3[2]); break; case INDEX_op_andc_i32: tcg_out_dat_rIK(VAR_0, COND_AL, ARITH_BIC, ARITH_AND, VAR_2[0], VAR_2[1], VAR_2[2], VAR_3[2]); break; case INDEX_op_or_i32: VAR_4 = ARITH_ORR; goto gen_arith; case INDEX_op_xor_i32: VAR_4 = ARITH_EOR; gen_arith: tcg_out_dat_rI(VAR_0, COND_AL, VAR_4, VAR_2[0], VAR_2[1], VAR_2[2], VAR_3[2]); break; case INDEX_op_add2_i32: tcg_out_dat_reg2(VAR_0, COND_AL, ARITH_ADD, ARITH_ADC, VAR_2[0], VAR_2[1], VAR_2[2], VAR_2[3], VAR_2[4], VAR_2[5], SHIFT_IMM_LSL(0)); break; case INDEX_op_sub2_i32: tcg_out_dat_reg2(VAR_0, COND_AL, ARITH_SUB, ARITH_SBC, VAR_2[0], VAR_2[1], VAR_2[2], VAR_2[3], VAR_2[4], VAR_2[5], SHIFT_IMM_LSL(0)); break; case INDEX_op_neg_i32: tcg_out_dat_imm(VAR_0, COND_AL, ARITH_RSB, VAR_2[0], VAR_2[1], 0); break; case INDEX_op_not_i32: tcg_out_dat_reg(VAR_0, COND_AL, ARITH_MVN, VAR_2[0], 0, VAR_2[1], SHIFT_IMM_LSL(0)); break; case INDEX_op_mul_i32: tcg_out_mul32(VAR_0, COND_AL, VAR_2[0], VAR_2[1], VAR_2[2]); break; case INDEX_op_mulu2_i32: tcg_out_umull32(VAR_0, COND_AL, VAR_2[0], VAR_2[1], VAR_2[2], VAR_2[3]); break; case INDEX_op_muls2_i32: tcg_out_smull32(VAR_0, COND_AL, VAR_2[0], VAR_2[1], VAR_2[2], VAR_2[3]); break; case INDEX_op_shl_i32: VAR_4 = VAR_3[2] ? SHIFT_IMM_LSL(VAR_2[2] & 0x1f) : SHIFT_REG_LSL(VAR_2[2]); goto gen_shift32; case INDEX_op_shr_i32: VAR_4 = VAR_3[2] ? (VAR_2[2] & 0x1f) ? SHIFT_IMM_LSR(VAR_2[2] & 0x1f) : SHIFT_IMM_LSL(0) : SHIFT_REG_LSR(VAR_2[2]); goto gen_shift32; case INDEX_op_sar_i32: VAR_4 = VAR_3[2] ? (VAR_2[2] & 0x1f) ? SHIFT_IMM_ASR(VAR_2[2] & 0x1f) : SHIFT_IMM_LSL(0) : SHIFT_REG_ASR(VAR_2[2]); goto gen_shift32; case INDEX_op_rotr_i32: VAR_4 = VAR_3[2] ? (VAR_2[2] & 0x1f) ? SHIFT_IMM_ROR(VAR_2[2] & 0x1f) : SHIFT_IMM_LSL(0) : SHIFT_REG_ROR(VAR_2[2]); gen_shift32: tcg_out_dat_reg(VAR_0, COND_AL, ARITH_MOV, VAR_2[0], 0, VAR_2[1], VAR_4); break; case INDEX_op_rotl_i32: if (VAR_3[2]) { tcg_out_dat_reg(VAR_0, COND_AL, ARITH_MOV, VAR_2[0], 0, VAR_2[1], ((0x20 - VAR_2[2]) & 0x1f) ? SHIFT_IMM_ROR((0x20 - VAR_2[2]) & 0x1f) : SHIFT_IMM_LSL(0)); } else { tcg_out_dat_imm(VAR_0, COND_AL, ARITH_RSB, TCG_REG_R8, VAR_2[1], 0x20); tcg_out_dat_reg(VAR_0, COND_AL, ARITH_MOV, VAR_2[0], 0, VAR_2[1], SHIFT_REG_ROR(TCG_REG_R8)); } break; case INDEX_op_brcond_i32: tcg_out_dat_rI(VAR_0, COND_AL, ARITH_CMP, 0, VAR_2[0], VAR_2[1], VAR_3[1]); tcg_out_goto_label(VAR_0, tcg_cond_to_arm_cond[VAR_2[2]], VAR_2[3]); break; case INDEX_op_brcond2_i32: tcg_out_dat_reg(VAR_0, COND_AL, ARITH_CMP, 0, VAR_2[1], VAR_2[3], SHIFT_IMM_LSL(0)); tcg_out_dat_reg(VAR_0, COND_EQ, ARITH_CMP, 0, VAR_2[0], VAR_2[2], SHIFT_IMM_LSL(0)); tcg_out_goto_label(VAR_0, tcg_cond_to_arm_cond[VAR_2[4]], VAR_2[5]); break; case INDEX_op_setcond_i32: tcg_out_dat_rI(VAR_0, COND_AL, ARITH_CMP, 0, VAR_2[1], VAR_2[2], VAR_3[2]); tcg_out_dat_imm(VAR_0, tcg_cond_to_arm_cond[VAR_2[3]], ARITH_MOV, VAR_2[0], 0, 1); tcg_out_dat_imm(VAR_0, tcg_cond_to_arm_cond[tcg_invert_cond(VAR_2[3])], ARITH_MOV, VAR_2[0], 0, 0); break; case INDEX_op_setcond2_i32: tcg_out_dat_reg(VAR_0, COND_AL, ARITH_CMP, 0, VAR_2[2], VAR_2[4], SHIFT_IMM_LSL(0)); tcg_out_dat_reg(VAR_0, COND_EQ, ARITH_CMP, 0, VAR_2[1], VAR_2[3], SHIFT_IMM_LSL(0)); tcg_out_dat_imm(VAR_0, tcg_cond_to_arm_cond[VAR_2[5]], ARITH_MOV, VAR_2[0], 0, 1); tcg_out_dat_imm(VAR_0, tcg_cond_to_arm_cond[tcg_invert_cond(VAR_2[5])], ARITH_MOV, VAR_2[0], 0, 0); break; case INDEX_op_qemu_ld8u: tcg_out_qemu_ld(VAR_0, VAR_2, 0); break; case INDEX_op_qemu_ld8s: tcg_out_qemu_ld(VAR_0, VAR_2, 0 | 4); break; case INDEX_op_qemu_ld16u: tcg_out_qemu_ld(VAR_0, VAR_2, 1); break; case INDEX_op_qemu_ld16s: tcg_out_qemu_ld(VAR_0, VAR_2, 1 | 4); break; case INDEX_op_qemu_ld32: tcg_out_qemu_ld(VAR_0, VAR_2, 2); break; case INDEX_op_qemu_ld64: tcg_out_qemu_ld(VAR_0, VAR_2, 3); break; case INDEX_op_qemu_st8: tcg_out_qemu_st(VAR_0, VAR_2, 0); break; case INDEX_op_qemu_st16: tcg_out_qemu_st(VAR_0, VAR_2, 1); break; case INDEX_op_qemu_st32: tcg_out_qemu_st(VAR_0, VAR_2, 2); break; case INDEX_op_qemu_st64: tcg_out_qemu_st(VAR_0, VAR_2, 3); break; case INDEX_op_bswap16_i32: tcg_out_bswap16(VAR_0, COND_AL, VAR_2[0], VAR_2[1]); break; case INDEX_op_bswap32_i32: tcg_out_bswap32(VAR_0, COND_AL, VAR_2[0], VAR_2[1]); break; case INDEX_op_ext8s_i32: tcg_out_ext8s(VAR_0, COND_AL, VAR_2[0], VAR_2[1]); break; case INDEX_op_ext16s_i32: tcg_out_ext16s(VAR_0, COND_AL, VAR_2[0], VAR_2[1]); break; case INDEX_op_ext16u_i32: tcg_out_ext16u(VAR_0, COND_AL, VAR_2[0], VAR_2[1]); break; default: tcg_abort(); } }
[ "static inline void FUNC_0(TCGContext *VAR_0, TCGOpcode VAR_1,\nconst TCGArg *VAR_2, const int *VAR_3)\n{", "int VAR_4;", "switch (VAR_1) {", "case INDEX_op_exit_tb:\n{", "uint8_t *ld_ptr = VAR_0->code_ptr;", "if (VAR_2[0] >> 8)\ntcg_out_ld32_12(VAR_0, COND_AL, TCG_REG_R0, TCG_REG_PC, 0);", "else\ntcg_out_dat_imm(VAR_0, COND_AL, ARITH_MOV, TCG_REG_R0, 0, VAR_2[0]);", "tcg_out_goto(VAR_0, COND_AL, (tcg_target_ulong) tb_ret_addr);", "if (VAR_2[0] >> 8) {", "*ld_ptr = (uint8_t) (VAR_0->code_ptr - ld_ptr) - 8;", "tcg_out32(VAR_0, VAR_2[0]);", "}", "}", "break;", "case INDEX_op_goto_tb:\nif (VAR_0->tb_jmp_offset) {", "#if defined(USE_DIRECT_JUMP)\nVAR_0->tb_jmp_offset[VAR_2[0]] = VAR_0->code_ptr - VAR_0->code_buf;", "tcg_out_b_noaddr(VAR_0, COND_AL);", "#else\ntcg_out_ld32_12(VAR_0, COND_AL, TCG_REG_PC, TCG_REG_PC, -4);", "VAR_0->tb_jmp_offset[VAR_2[0]] = VAR_0->code_ptr - VAR_0->code_buf;", "tcg_out32(VAR_0, 0);", "#endif\n} else {", "#if 1\nVAR_4 = (int) (VAR_0->tb_next + VAR_2[0]) - ((int) VAR_0->code_ptr + 8);", "if (VAR_4 > 0xfff || VAR_4 < -0xfff) {", "tcg_out_movi32(VAR_0, COND_AL, TCG_REG_R0,\n(tcg_target_long) (VAR_0->tb_next + VAR_2[0]));", "tcg_out_ld32_12(VAR_0, COND_AL, TCG_REG_PC, TCG_REG_R0, 0);", "} else", "tcg_out_ld32_12(VAR_0, COND_AL, TCG_REG_PC, TCG_REG_PC, VAR_4);", "#else\ntcg_out_ld32_12(VAR_0, COND_AL, TCG_REG_R0, TCG_REG_PC, 0);", "tcg_out_ld32_12(VAR_0, COND_AL, TCG_REG_PC, TCG_REG_R0, 0);", "tcg_out32(VAR_0, (tcg_target_long) (VAR_0->tb_next + VAR_2[0]));", "#endif\n}", "VAR_0->tb_next_offset[VAR_2[0]] = VAR_0->code_ptr - VAR_0->code_buf;", "break;", "case INDEX_op_call:\nif (VAR_3[0])\ntcg_out_call(VAR_0, VAR_2[0]);", "else\ntcg_out_callr(VAR_0, COND_AL, VAR_2[0]);", "break;", "case INDEX_op_br:\ntcg_out_goto_label(VAR_0, COND_AL, VAR_2[0]);", "break;", "case INDEX_op_ld8u_i32:\ntcg_out_ld8u(VAR_0, COND_AL, VAR_2[0], VAR_2[1], VAR_2[2]);", "break;", "case INDEX_op_ld8s_i32:\ntcg_out_ld8s(VAR_0, COND_AL, VAR_2[0], VAR_2[1], VAR_2[2]);", "break;", "case INDEX_op_ld16u_i32:\ntcg_out_ld16u(VAR_0, COND_AL, VAR_2[0], VAR_2[1], VAR_2[2]);", "break;", "case INDEX_op_ld16s_i32:\ntcg_out_ld16s(VAR_0, COND_AL, VAR_2[0], VAR_2[1], VAR_2[2]);", "break;", "case INDEX_op_ld_i32:\ntcg_out_ld32u(VAR_0, COND_AL, VAR_2[0], VAR_2[1], VAR_2[2]);", "break;", "case INDEX_op_st8_i32:\ntcg_out_st8(VAR_0, COND_AL, VAR_2[0], VAR_2[1], VAR_2[2]);", "break;", "case INDEX_op_st16_i32:\ntcg_out_st16(VAR_0, COND_AL, VAR_2[0], VAR_2[1], VAR_2[2]);", "break;", "case INDEX_op_st_i32:\ntcg_out_st32(VAR_0, COND_AL, VAR_2[0], VAR_2[1], VAR_2[2]);", "break;", "case INDEX_op_mov_i32:\ntcg_out_dat_reg(VAR_0, COND_AL, ARITH_MOV,\nVAR_2[0], 0, VAR_2[1], SHIFT_IMM_LSL(0));", "break;", "case INDEX_op_movi_i32:\ntcg_out_movi32(VAR_0, COND_AL, VAR_2[0], VAR_2[1]);", "break;", "case INDEX_op_movcond_i32:\ntcg_out_dat_rI(VAR_0, COND_AL, ARITH_CMP, 0,\nVAR_2[1], VAR_2[2], VAR_3[2]);", "tcg_out_dat_rI(VAR_0, tcg_cond_to_arm_cond[VAR_2[5]],\nARITH_MOV, VAR_2[0], 0, VAR_2[3], VAR_3[3]);", "break;", "case INDEX_op_add_i32:\nVAR_4 = ARITH_ADD;", "goto gen_arith;", "case INDEX_op_sub_i32:\nVAR_4 = ARITH_SUB;", "goto gen_arith;", "case INDEX_op_and_i32:\ntcg_out_dat_rIK(VAR_0, COND_AL, ARITH_AND, ARITH_BIC,\nVAR_2[0], VAR_2[1], VAR_2[2], VAR_3[2]);", "break;", "case INDEX_op_andc_i32:\ntcg_out_dat_rIK(VAR_0, COND_AL, ARITH_BIC, ARITH_AND,\nVAR_2[0], VAR_2[1], VAR_2[2], VAR_3[2]);", "break;", "case INDEX_op_or_i32:\nVAR_4 = ARITH_ORR;", "goto gen_arith;", "case INDEX_op_xor_i32:\nVAR_4 = ARITH_EOR;", "gen_arith:\ntcg_out_dat_rI(VAR_0, COND_AL, VAR_4, VAR_2[0], VAR_2[1], VAR_2[2], VAR_3[2]);", "break;", "case INDEX_op_add2_i32:\ntcg_out_dat_reg2(VAR_0, COND_AL, ARITH_ADD, ARITH_ADC,\nVAR_2[0], VAR_2[1], VAR_2[2], VAR_2[3],\nVAR_2[4], VAR_2[5], SHIFT_IMM_LSL(0));", "break;", "case INDEX_op_sub2_i32:\ntcg_out_dat_reg2(VAR_0, COND_AL, ARITH_SUB, ARITH_SBC,\nVAR_2[0], VAR_2[1], VAR_2[2], VAR_2[3],\nVAR_2[4], VAR_2[5], SHIFT_IMM_LSL(0));", "break;", "case INDEX_op_neg_i32:\ntcg_out_dat_imm(VAR_0, COND_AL, ARITH_RSB, VAR_2[0], VAR_2[1], 0);", "break;", "case INDEX_op_not_i32:\ntcg_out_dat_reg(VAR_0, COND_AL,\nARITH_MVN, VAR_2[0], 0, VAR_2[1], SHIFT_IMM_LSL(0));", "break;", "case INDEX_op_mul_i32:\ntcg_out_mul32(VAR_0, COND_AL, VAR_2[0], VAR_2[1], VAR_2[2]);", "break;", "case INDEX_op_mulu2_i32:\ntcg_out_umull32(VAR_0, COND_AL, VAR_2[0], VAR_2[1], VAR_2[2], VAR_2[3]);", "break;", "case INDEX_op_muls2_i32:\ntcg_out_smull32(VAR_0, COND_AL, VAR_2[0], VAR_2[1], VAR_2[2], VAR_2[3]);", "break;", "case INDEX_op_shl_i32:\nVAR_4 = VAR_3[2] ?\nSHIFT_IMM_LSL(VAR_2[2] & 0x1f) : SHIFT_REG_LSL(VAR_2[2]);", "goto gen_shift32;", "case INDEX_op_shr_i32:\nVAR_4 = VAR_3[2] ? (VAR_2[2] & 0x1f) ? SHIFT_IMM_LSR(VAR_2[2] & 0x1f) :\nSHIFT_IMM_LSL(0) : SHIFT_REG_LSR(VAR_2[2]);", "goto gen_shift32;", "case INDEX_op_sar_i32:\nVAR_4 = VAR_3[2] ? (VAR_2[2] & 0x1f) ? SHIFT_IMM_ASR(VAR_2[2] & 0x1f) :\nSHIFT_IMM_LSL(0) : SHIFT_REG_ASR(VAR_2[2]);", "goto gen_shift32;", "case INDEX_op_rotr_i32:\nVAR_4 = VAR_3[2] ? (VAR_2[2] & 0x1f) ? SHIFT_IMM_ROR(VAR_2[2] & 0x1f) :\nSHIFT_IMM_LSL(0) : SHIFT_REG_ROR(VAR_2[2]);", "gen_shift32:\ntcg_out_dat_reg(VAR_0, COND_AL, ARITH_MOV, VAR_2[0], 0, VAR_2[1], VAR_4);", "break;", "case INDEX_op_rotl_i32:\nif (VAR_3[2]) {", "tcg_out_dat_reg(VAR_0, COND_AL, ARITH_MOV, VAR_2[0], 0, VAR_2[1],\n((0x20 - VAR_2[2]) & 0x1f) ?\nSHIFT_IMM_ROR((0x20 - VAR_2[2]) & 0x1f) :\nSHIFT_IMM_LSL(0));", "} else {", "tcg_out_dat_imm(VAR_0, COND_AL, ARITH_RSB, TCG_REG_R8, VAR_2[1], 0x20);", "tcg_out_dat_reg(VAR_0, COND_AL, ARITH_MOV, VAR_2[0], 0, VAR_2[1],\nSHIFT_REG_ROR(TCG_REG_R8));", "}", "break;", "case INDEX_op_brcond_i32:\ntcg_out_dat_rI(VAR_0, COND_AL, ARITH_CMP, 0,\nVAR_2[0], VAR_2[1], VAR_3[1]);", "tcg_out_goto_label(VAR_0, tcg_cond_to_arm_cond[VAR_2[2]], VAR_2[3]);", "break;", "case INDEX_op_brcond2_i32:\ntcg_out_dat_reg(VAR_0, COND_AL, ARITH_CMP, 0,\nVAR_2[1], VAR_2[3], SHIFT_IMM_LSL(0));", "tcg_out_dat_reg(VAR_0, COND_EQ, ARITH_CMP, 0,\nVAR_2[0], VAR_2[2], SHIFT_IMM_LSL(0));", "tcg_out_goto_label(VAR_0, tcg_cond_to_arm_cond[VAR_2[4]], VAR_2[5]);", "break;", "case INDEX_op_setcond_i32:\ntcg_out_dat_rI(VAR_0, COND_AL, ARITH_CMP, 0,\nVAR_2[1], VAR_2[2], VAR_3[2]);", "tcg_out_dat_imm(VAR_0, tcg_cond_to_arm_cond[VAR_2[3]],\nARITH_MOV, VAR_2[0], 0, 1);", "tcg_out_dat_imm(VAR_0, tcg_cond_to_arm_cond[tcg_invert_cond(VAR_2[3])],\nARITH_MOV, VAR_2[0], 0, 0);", "break;", "case INDEX_op_setcond2_i32:\ntcg_out_dat_reg(VAR_0, COND_AL, ARITH_CMP, 0,\nVAR_2[2], VAR_2[4], SHIFT_IMM_LSL(0));", "tcg_out_dat_reg(VAR_0, COND_EQ, ARITH_CMP, 0,\nVAR_2[1], VAR_2[3], SHIFT_IMM_LSL(0));", "tcg_out_dat_imm(VAR_0, tcg_cond_to_arm_cond[VAR_2[5]],\nARITH_MOV, VAR_2[0], 0, 1);", "tcg_out_dat_imm(VAR_0, tcg_cond_to_arm_cond[tcg_invert_cond(VAR_2[5])],\nARITH_MOV, VAR_2[0], 0, 0);", "break;", "case INDEX_op_qemu_ld8u:\ntcg_out_qemu_ld(VAR_0, VAR_2, 0);", "break;", "case INDEX_op_qemu_ld8s:\ntcg_out_qemu_ld(VAR_0, VAR_2, 0 | 4);", "break;", "case INDEX_op_qemu_ld16u:\ntcg_out_qemu_ld(VAR_0, VAR_2, 1);", "break;", "case INDEX_op_qemu_ld16s:\ntcg_out_qemu_ld(VAR_0, VAR_2, 1 | 4);", "break;", "case INDEX_op_qemu_ld32:\ntcg_out_qemu_ld(VAR_0, VAR_2, 2);", "break;", "case INDEX_op_qemu_ld64:\ntcg_out_qemu_ld(VAR_0, VAR_2, 3);", "break;", "case INDEX_op_qemu_st8:\ntcg_out_qemu_st(VAR_0, VAR_2, 0);", "break;", "case INDEX_op_qemu_st16:\ntcg_out_qemu_st(VAR_0, VAR_2, 1);", "break;", "case INDEX_op_qemu_st32:\ntcg_out_qemu_st(VAR_0, VAR_2, 2);", "break;", "case INDEX_op_qemu_st64:\ntcg_out_qemu_st(VAR_0, VAR_2, 3);", "break;", "case INDEX_op_bswap16_i32:\ntcg_out_bswap16(VAR_0, COND_AL, VAR_2[0], VAR_2[1]);", "break;", "case INDEX_op_bswap32_i32:\ntcg_out_bswap32(VAR_0, COND_AL, VAR_2[0], VAR_2[1]);", "break;", "case INDEX_op_ext8s_i32:\ntcg_out_ext8s(VAR_0, COND_AL, VAR_2[0], VAR_2[1]);", "break;", "case INDEX_op_ext16s_i32:\ntcg_out_ext16s(VAR_0, COND_AL, VAR_2[0], VAR_2[1]);", "break;", "case INDEX_op_ext16u_i32:\ntcg_out_ext16u(VAR_0, COND_AL, VAR_2[0], VAR_2[1]);", "break;", "default:\ntcg_abort();", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 47, 49 ], [ 51 ], [ 53, 55 ], [ 57 ], [ 59 ], [ 61, 63 ], [ 67, 69 ], [ 71 ], [ 73, 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83, 85 ], [ 87 ], [ 89 ], [ 91, 93 ], [ 95 ], [ 97 ], [ 99, 101, 103 ], [ 105, 107 ], [ 109 ], [ 111, 113 ], [ 115 ], [ 119, 121 ], [ 123 ], [ 125, 127 ], [ 129 ], [ 131, 133 ], [ 135 ], [ 137, 139 ], [ 141 ], [ 143, 145 ], [ 147 ], [ 149, 151 ], [ 153 ], [ 155, 157 ], [ 159 ], [ 161, 163 ], [ 165 ], [ 169, 171, 173 ], [ 175 ], [ 177, 179 ], [ 181 ], [ 183, 191, 193 ], [ 195, 197 ], [ 199 ], [ 201, 203 ], [ 205 ], [ 207, 209 ], [ 211 ], [ 213, 215, 217 ], [ 219 ], [ 221, 223, 225 ], [ 227 ], [ 229, 231 ], [ 233 ], [ 235, 237 ], [ 241, 243 ], [ 245 ], [ 247, 249, 251, 253 ], [ 255 ], [ 257, 259, 261, 263 ], [ 265 ], [ 267, 269 ], [ 271 ], [ 273, 275, 277 ], [ 279 ], [ 281, 283 ], [ 285 ], [ 287, 289 ], [ 291 ], [ 293, 295 ], [ 297 ], [ 301, 303, 305 ], [ 307 ], [ 309, 311, 313 ], [ 315 ], [ 317, 319, 321 ], [ 323 ], [ 325, 327, 329 ], [ 333, 335 ], [ 337 ], [ 341, 343 ], [ 345, 347, 349, 351 ], [ 353 ], [ 355 ], [ 357, 359 ], [ 361 ], [ 363 ], [ 367, 369, 371 ], [ 373 ], [ 375 ], [ 377, 395, 397 ], [ 399, 401 ], [ 403 ], [ 405 ], [ 407, 409, 411 ], [ 413, 415 ], [ 417, 419 ], [ 421 ], [ 423, 427, 429 ], [ 431, 433 ], [ 435, 437 ], [ 439, 441 ], [ 443 ], [ 447, 449 ], [ 451 ], [ 453, 455 ], [ 457 ], [ 459, 461 ], [ 463 ], [ 465, 467 ], [ 469 ], [ 471, 473 ], [ 475 ], [ 477, 479 ], [ 481 ], [ 485, 487 ], [ 489 ], [ 491, 493 ], [ 495 ], [ 497, 499 ], [ 501 ], [ 503, 505 ], [ 507 ], [ 511, 513 ], [ 515 ], [ 517, 519 ], [ 521 ], [ 525, 527 ], [ 529 ], [ 531, 533 ], [ 535 ], [ 537, 539 ], [ 541 ], [ 545, 547 ], [ 549 ], [ 551 ] ]
7,503
void hmp_info_vnc(Monitor *mon, const QDict *qdict) { VncInfo *info; Error *err = NULL; VncClientInfoList *client; info = qmp_query_vnc(&err); if (err) { monitor_printf(mon, "%s\n", error_get_pretty(err)); error_free(err); return; } if (!info->enabled) { monitor_printf(mon, "Server: disabled\n"); goto out; } monitor_printf(mon, "Server:\n"); if (info->has_host && info->has_service) { monitor_printf(mon, " address: %s:%s\n", info->host, info->service); } if (info->has_auth) { monitor_printf(mon, " auth: %s\n", info->auth); } if (!info->has_clients || info->clients == NULL) { monitor_printf(mon, "Client: none\n"); } else { for (client = info->clients; client; client = client->next) { monitor_printf(mon, "Client:\n"); monitor_printf(mon, " address: %s:%s\n", client->value->base->host, client->value->base->service); monitor_printf(mon, " x509_dname: %s\n", client->value->x509_dname ? client->value->x509_dname : "none"); monitor_printf(mon, " username: %s\n", client->value->has_sasl_username ? client->value->sasl_username : "none"); } } out: qapi_free_VncInfo(info); }
false
qemu
ddf21908961073199f3d186204da4810f2ea150b
void hmp_info_vnc(Monitor *mon, const QDict *qdict) { VncInfo *info; Error *err = NULL; VncClientInfoList *client; info = qmp_query_vnc(&err); if (err) { monitor_printf(mon, "%s\n", error_get_pretty(err)); error_free(err); return; } if (!info->enabled) { monitor_printf(mon, "Server: disabled\n"); goto out; } monitor_printf(mon, "Server:\n"); if (info->has_host && info->has_service) { monitor_printf(mon, " address: %s:%s\n", info->host, info->service); } if (info->has_auth) { monitor_printf(mon, " auth: %s\n", info->auth); } if (!info->has_clients || info->clients == NULL) { monitor_printf(mon, "Client: none\n"); } else { for (client = info->clients; client; client = client->next) { monitor_printf(mon, "Client:\n"); monitor_printf(mon, " address: %s:%s\n", client->value->base->host, client->value->base->service); monitor_printf(mon, " x509_dname: %s\n", client->value->x509_dname ? client->value->x509_dname : "none"); monitor_printf(mon, " username: %s\n", client->value->has_sasl_username ? client->value->sasl_username : "none"); } } out: qapi_free_VncInfo(info); }
{ "code": [], "line_no": [] }
void FUNC_0(Monitor *VAR_0, const QDict *VAR_1) { VncInfo *info; Error *err = NULL; VncClientInfoList *client; info = qmp_query_vnc(&err); if (err) { monitor_printf(VAR_0, "%s\n", error_get_pretty(err)); error_free(err); return; } if (!info->enabled) { monitor_printf(VAR_0, "Server: disabled\n"); goto out; } monitor_printf(VAR_0, "Server:\n"); if (info->has_host && info->has_service) { monitor_printf(VAR_0, " address: %s:%s\n", info->host, info->service); } if (info->has_auth) { monitor_printf(VAR_0, " auth: %s\n", info->auth); } if (!info->has_clients || info->clients == NULL) { monitor_printf(VAR_0, "Client: none\n"); } else { for (client = info->clients; client; client = client->next) { monitor_printf(VAR_0, "Client:\n"); monitor_printf(VAR_0, " address: %s:%s\n", client->value->base->host, client->value->base->service); monitor_printf(VAR_0, " x509_dname: %s\n", client->value->x509_dname ? client->value->x509_dname : "none"); monitor_printf(VAR_0, " username: %s\n", client->value->has_sasl_username ? client->value->sasl_username : "none"); } } out: qapi_free_VncInfo(info); }
[ "void FUNC_0(Monitor *VAR_0, const QDict *VAR_1)\n{", "VncInfo *info;", "Error *err = NULL;", "VncClientInfoList *client;", "info = qmp_query_vnc(&err);", "if (err) {", "monitor_printf(VAR_0, \"%s\\n\", error_get_pretty(err));", "error_free(err);", "return;", "}", "if (!info->enabled) {", "monitor_printf(VAR_0, \"Server: disabled\\n\");", "goto out;", "}", "monitor_printf(VAR_0, \"Server:\\n\");", "if (info->has_host && info->has_service) {", "monitor_printf(VAR_0, \" address: %s:%s\\n\", info->host, info->service);", "}", "if (info->has_auth) {", "monitor_printf(VAR_0, \" auth: %s\\n\", info->auth);", "}", "if (!info->has_clients || info->clients == NULL) {", "monitor_printf(VAR_0, \"Client: none\\n\");", "} else {", "for (client = info->clients; client; client = client->next) {", "monitor_printf(VAR_0, \"Client:\\n\");", "monitor_printf(VAR_0, \" address: %s:%s\\n\",\nclient->value->base->host,\nclient->value->base->service);", "monitor_printf(VAR_0, \" x509_dname: %s\\n\",\nclient->value->x509_dname ?\nclient->value->x509_dname : \"none\");", "monitor_printf(VAR_0, \" username: %s\\n\",\nclient->value->has_sasl_username ?\nclient->value->sasl_username : \"none\");", "}", "}", "out:\nqapi_free_VncInfo(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, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63, 65, 67 ], [ 69, 71, 73 ], [ 75, 77, 79 ], [ 81 ], [ 83 ], [ 87, 89 ], [ 91 ] ]
7,504
static void cmos_init(int ram_size, const char *boot_device, BlockDriverState **hd_table) { RTCState *s = rtc_state; int val; int fd0, fd1, nb; int i; /* various important CMOS locations needed by PC/Bochs bios */ /* memory size */ val = 640; /* base memory in K */ rtc_set_memory(s, 0x15, val); rtc_set_memory(s, 0x16, val >> 8); val = (ram_size / 1024) - 1024; if (val > 65535) val = 65535; rtc_set_memory(s, 0x17, val); rtc_set_memory(s, 0x18, val >> 8); rtc_set_memory(s, 0x30, val); rtc_set_memory(s, 0x31, val >> 8); if (ram_size > (16 * 1024 * 1024)) val = (ram_size / 65536) - ((16 * 1024 * 1024) / 65536); else val = 0; if (val > 65535) val = 65535; rtc_set_memory(s, 0x34, val); rtc_set_memory(s, 0x35, val >> 8); /* set boot devices, and disable floppy signature check if requested */ rtc_set_memory(s, 0x3d, boot_device2nibble(boot_device[1]) << 4 | boot_device2nibble(boot_device[0]) ); rtc_set_memory(s, 0x38, boot_device2nibble(boot_device[2]) << 4 | (fd_bootchk ? 0x0 : 0x1)); /* floppy type */ fd0 = fdctrl_get_drive_type(floppy_controller, 0); fd1 = fdctrl_get_drive_type(floppy_controller, 1); val = (cmos_get_fd_drive_type(fd0) << 4) | cmos_get_fd_drive_type(fd1); rtc_set_memory(s, 0x10, val); val = 0; nb = 0; if (fd0 < 3) nb++; if (fd1 < 3) nb++; switch (nb) { case 0: break; case 1: val |= 0x01; /* 1 drive, ready for boot */ break; case 2: val |= 0x41; /* 2 drives, ready for boot */ break; } val |= 0x02; /* FPU is there */ val |= 0x04; /* PS/2 mouse installed */ rtc_set_memory(s, REG_EQUIPMENT_BYTE, val); /* hard drives */ rtc_set_memory(s, 0x12, (hd_table[0] ? 0xf0 : 0) | (hd_table[1] ? 0x0f : 0)); if (hd_table[0]) cmos_init_hd(0x19, 0x1b, hd_table[0]); if (hd_table[1]) cmos_init_hd(0x1a, 0x24, hd_table[1]); val = 0; for (i = 0; i < 4; i++) { if (hd_table[i]) { int cylinders, heads, sectors, translation; /* NOTE: bdrv_get_geometry_hint() returns the physical geometry. It is always such that: 1 <= sects <= 63, 1 <= heads <= 16, 1 <= cylinders <= 16383. The BIOS geometry can be different if a translation is done. */ translation = bdrv_get_translation_hint(hd_table[i]); if (translation == BIOS_ATA_TRANSLATION_AUTO) { bdrv_get_geometry_hint(hd_table[i], &cylinders, &heads, &sectors); if (cylinders <= 1024 && heads <= 16 && sectors <= 63) { /* No translation. */ translation = 0; } else { /* LBA translation. */ translation = 1; } } else { translation--; } val |= translation << (i * 2); } } rtc_set_memory(s, 0x39, val); }
false
qemu
28c5af54c661e73e5596918fa67a22b5e87c2022
static void cmos_init(int ram_size, const char *boot_device, BlockDriverState **hd_table) { RTCState *s = rtc_state; int val; int fd0, fd1, nb; int i; val = 640; rtc_set_memory(s, 0x15, val); rtc_set_memory(s, 0x16, val >> 8); val = (ram_size / 1024) - 1024; if (val > 65535) val = 65535; rtc_set_memory(s, 0x17, val); rtc_set_memory(s, 0x18, val >> 8); rtc_set_memory(s, 0x30, val); rtc_set_memory(s, 0x31, val >> 8); if (ram_size > (16 * 1024 * 1024)) val = (ram_size / 65536) - ((16 * 1024 * 1024) / 65536); else val = 0; if (val > 65535) val = 65535; rtc_set_memory(s, 0x34, val); rtc_set_memory(s, 0x35, val >> 8); rtc_set_memory(s, 0x3d, boot_device2nibble(boot_device[1]) << 4 | boot_device2nibble(boot_device[0]) ); rtc_set_memory(s, 0x38, boot_device2nibble(boot_device[2]) << 4 | (fd_bootchk ? 0x0 : 0x1)); fd0 = fdctrl_get_drive_type(floppy_controller, 0); fd1 = fdctrl_get_drive_type(floppy_controller, 1); val = (cmos_get_fd_drive_type(fd0) << 4) | cmos_get_fd_drive_type(fd1); rtc_set_memory(s, 0x10, val); val = 0; nb = 0; if (fd0 < 3) nb++; if (fd1 < 3) nb++; switch (nb) { case 0: break; case 1: val |= 0x01; break; case 2: val |= 0x41; break; } val |= 0x02; val |= 0x04; rtc_set_memory(s, REG_EQUIPMENT_BYTE, val); rtc_set_memory(s, 0x12, (hd_table[0] ? 0xf0 : 0) | (hd_table[1] ? 0x0f : 0)); if (hd_table[0]) cmos_init_hd(0x19, 0x1b, hd_table[0]); if (hd_table[1]) cmos_init_hd(0x1a, 0x24, hd_table[1]); val = 0; for (i = 0; i < 4; i++) { if (hd_table[i]) { int cylinders, heads, sectors, translation; translation = bdrv_get_translation_hint(hd_table[i]); if (translation == BIOS_ATA_TRANSLATION_AUTO) { bdrv_get_geometry_hint(hd_table[i], &cylinders, &heads, &sectors); if (cylinders <= 1024 && heads <= 16 && sectors <= 63) { translation = 0; } else { translation = 1; } } else { translation--; } val |= translation << (i * 2); } } rtc_set_memory(s, 0x39, val); }
{ "code": [], "line_no": [] }
static void FUNC_0(int VAR_0, const char *VAR_1, BlockDriverState **VAR_2) { RTCState *s = rtc_state; int VAR_3; int VAR_4, VAR_5, VAR_6; int VAR_7; VAR_3 = 640; rtc_set_memory(s, 0x15, VAR_3); rtc_set_memory(s, 0x16, VAR_3 >> 8); VAR_3 = (VAR_0 / 1024) - 1024; if (VAR_3 > 65535) VAR_3 = 65535; rtc_set_memory(s, 0x17, VAR_3); rtc_set_memory(s, 0x18, VAR_3 >> 8); rtc_set_memory(s, 0x30, VAR_3); rtc_set_memory(s, 0x31, VAR_3 >> 8); if (VAR_0 > (16 * 1024 * 1024)) VAR_3 = (VAR_0 / 65536) - ((16 * 1024 * 1024) / 65536); else VAR_3 = 0; if (VAR_3 > 65535) VAR_3 = 65535; rtc_set_memory(s, 0x34, VAR_3); rtc_set_memory(s, 0x35, VAR_3 >> 8); rtc_set_memory(s, 0x3d, boot_device2nibble(VAR_1[1]) << 4 | boot_device2nibble(VAR_1[0]) ); rtc_set_memory(s, 0x38, boot_device2nibble(VAR_1[2]) << 4 | (fd_bootchk ? 0x0 : 0x1)); VAR_4 = fdctrl_get_drive_type(floppy_controller, 0); VAR_5 = fdctrl_get_drive_type(floppy_controller, 1); VAR_3 = (cmos_get_fd_drive_type(VAR_4) << 4) | cmos_get_fd_drive_type(VAR_5); rtc_set_memory(s, 0x10, VAR_3); VAR_3 = 0; VAR_6 = 0; if (VAR_4 < 3) VAR_6++; if (VAR_5 < 3) VAR_6++; switch (VAR_6) { case 0: break; case 1: VAR_3 |= 0x01; break; case 2: VAR_3 |= 0x41; break; } VAR_3 |= 0x02; VAR_3 |= 0x04; rtc_set_memory(s, REG_EQUIPMENT_BYTE, VAR_3); rtc_set_memory(s, 0x12, (VAR_2[0] ? 0xf0 : 0) | (VAR_2[1] ? 0x0f : 0)); if (VAR_2[0]) cmos_init_hd(0x19, 0x1b, VAR_2[0]); if (VAR_2[1]) cmos_init_hd(0x1a, 0x24, VAR_2[1]); VAR_3 = 0; for (VAR_7 = 0; VAR_7 < 4; VAR_7++) { if (VAR_2[VAR_7]) { int VAR_8, VAR_9, VAR_10, VAR_11; VAR_11 = bdrv_get_translation_hint(VAR_2[VAR_7]); if (VAR_11 == BIOS_ATA_TRANSLATION_AUTO) { bdrv_get_geometry_hint(VAR_2[VAR_7], &VAR_8, &VAR_9, &VAR_10); if (VAR_8 <= 1024 && VAR_9 <= 16 && VAR_10 <= 63) { VAR_11 = 0; } else { VAR_11 = 1; } } else { VAR_11--; } VAR_3 |= VAR_11 << (VAR_7 * 2); } } rtc_set_memory(s, 0x39, VAR_3); }
[ "static void FUNC_0(int VAR_0, const char *VAR_1, BlockDriverState **VAR_2)\n{", "RTCState *s = rtc_state;", "int VAR_3;", "int VAR_4, VAR_5, VAR_6;", "int VAR_7;", "VAR_3 = 640;", "rtc_set_memory(s, 0x15, VAR_3);", "rtc_set_memory(s, 0x16, VAR_3 >> 8);", "VAR_3 = (VAR_0 / 1024) - 1024;", "if (VAR_3 > 65535)\nVAR_3 = 65535;", "rtc_set_memory(s, 0x17, VAR_3);", "rtc_set_memory(s, 0x18, VAR_3 >> 8);", "rtc_set_memory(s, 0x30, VAR_3);", "rtc_set_memory(s, 0x31, VAR_3 >> 8);", "if (VAR_0 > (16 * 1024 * 1024))\nVAR_3 = (VAR_0 / 65536) - ((16 * 1024 * 1024) / 65536);", "else\nVAR_3 = 0;", "if (VAR_3 > 65535)\nVAR_3 = 65535;", "rtc_set_memory(s, 0x34, VAR_3);", "rtc_set_memory(s, 0x35, VAR_3 >> 8);", "rtc_set_memory(s, 0x3d,\nboot_device2nibble(VAR_1[1]) << 4 |\nboot_device2nibble(VAR_1[0]) );", "rtc_set_memory(s, 0x38,\nboot_device2nibble(VAR_1[2]) << 4 | (fd_bootchk ? 0x0 : 0x1));", "VAR_4 = fdctrl_get_drive_type(floppy_controller, 0);", "VAR_5 = fdctrl_get_drive_type(floppy_controller, 1);", "VAR_3 = (cmos_get_fd_drive_type(VAR_4) << 4) | cmos_get_fd_drive_type(VAR_5);", "rtc_set_memory(s, 0x10, VAR_3);", "VAR_3 = 0;", "VAR_6 = 0;", "if (VAR_4 < 3)\nVAR_6++;", "if (VAR_5 < 3)\nVAR_6++;", "switch (VAR_6) {", "case 0:\nbreak;", "case 1:\nVAR_3 |= 0x01;", "break;", "case 2:\nVAR_3 |= 0x41;", "break;", "}", "VAR_3 |= 0x02;", "VAR_3 |= 0x04;", "rtc_set_memory(s, REG_EQUIPMENT_BYTE, VAR_3);", "rtc_set_memory(s, 0x12, (VAR_2[0] ? 0xf0 : 0) | (VAR_2[1] ? 0x0f : 0));", "if (VAR_2[0])\ncmos_init_hd(0x19, 0x1b, VAR_2[0]);", "if (VAR_2[1])\ncmos_init_hd(0x1a, 0x24, VAR_2[1]);", "VAR_3 = 0;", "for (VAR_7 = 0; VAR_7 < 4; VAR_7++) {", "if (VAR_2[VAR_7]) {", "int VAR_8, VAR_9, VAR_10, VAR_11;", "VAR_11 = bdrv_get_translation_hint(VAR_2[VAR_7]);", "if (VAR_11 == BIOS_ATA_TRANSLATION_AUTO) {", "bdrv_get_geometry_hint(VAR_2[VAR_7], &VAR_8, &VAR_9, &VAR_10);", "if (VAR_8 <= 1024 && VAR_9 <= 16 && VAR_10 <= 63) {", "VAR_11 = 0;", "} else {", "VAR_11 = 1;", "}", "} else {", "VAR_11--;", "}", "VAR_3 |= VAR_11 << (VAR_7 * 2);", "}", "}", "rtc_set_memory(s, 0x39, VAR_3);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31, 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 45, 47 ], [ 49, 51 ], [ 53, 55 ], [ 57 ], [ 59 ], [ 65, 67, 69 ], [ 71, 73 ], [ 81 ], [ 83 ], [ 87 ], [ 89 ], [ 93 ], [ 95 ], [ 97, 99 ], [ 101, 103 ], [ 105 ], [ 107, 109 ], [ 111, 113 ], [ 115 ], [ 117, 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 137 ], [ 139, 141 ], [ 143, 145 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 175 ], [ 177 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ] ]
7,505
static int nbd_parse_uri(const char *filename, QDict *options) { URI *uri; const char *p; QueryParams *qp = NULL; int ret = 0; bool is_unix; uri = uri_parse(filename); if (!uri) { return -EINVAL; } /* transport */ if (!strcmp(uri->scheme, "nbd")) { is_unix = false; } else if (!strcmp(uri->scheme, "nbd+tcp")) { is_unix = false; } else if (!strcmp(uri->scheme, "nbd+unix")) { is_unix = true; } else { ret = -EINVAL; goto out; } p = uri->path ? uri->path : "/"; p += strspn(p, "/"); if (p[0]) { qdict_put(options, "export", qstring_from_str(p)); } qp = query_params_parse(uri->query); if (qp->n > 1 || (is_unix && !qp->n) || (!is_unix && qp->n)) { ret = -EINVAL; goto out; } if (is_unix) { /* nbd+unix:///export?socket=path */ if (uri->server || uri->port || strcmp(qp->p[0].name, "socket")) { ret = -EINVAL; goto out; } qdict_put(options, "server.type", qstring_from_str("unix")); qdict_put(options, "server.data.path", qstring_from_str(qp->p[0].value)); } else { QString *host; char *port_str; /* nbd[+tcp]://host[:port]/export */ if (!uri->server) { ret = -EINVAL; goto out; } /* strip braces from literal IPv6 address */ if (uri->server[0] == '[') { host = qstring_from_substr(uri->server, 1, strlen(uri->server) - 2); } else { host = qstring_from_str(uri->server); } qdict_put(options, "server.type", qstring_from_str("inet")); qdict_put(options, "server.data.host", host); port_str = g_strdup_printf("%d", uri->port ?: NBD_DEFAULT_PORT); qdict_put(options, "server.data.port", qstring_from_str(port_str)); g_free(port_str); } out: if (qp) { query_params_free(qp); } uri_free(uri); return ret; }
false
qemu
9445673ea67c272616b9f718396e267caa6446b7
static int nbd_parse_uri(const char *filename, QDict *options) { URI *uri; const char *p; QueryParams *qp = NULL; int ret = 0; bool is_unix; uri = uri_parse(filename); if (!uri) { return -EINVAL; } if (!strcmp(uri->scheme, "nbd")) { is_unix = false; } else if (!strcmp(uri->scheme, "nbd+tcp")) { is_unix = false; } else if (!strcmp(uri->scheme, "nbd+unix")) { is_unix = true; } else { ret = -EINVAL; goto out; } p = uri->path ? uri->path : "/"; p += strspn(p, "/"); if (p[0]) { qdict_put(options, "export", qstring_from_str(p)); } qp = query_params_parse(uri->query); if (qp->n > 1 || (is_unix && !qp->n) || (!is_unix && qp->n)) { ret = -EINVAL; goto out; } if (is_unix) { if (uri->server || uri->port || strcmp(qp->p[0].name, "socket")) { ret = -EINVAL; goto out; } qdict_put(options, "server.type", qstring_from_str("unix")); qdict_put(options, "server.data.path", qstring_from_str(qp->p[0].value)); } else { QString *host; char *port_str; if (!uri->server) { ret = -EINVAL; goto out; } if (uri->server[0] == '[') { host = qstring_from_substr(uri->server, 1, strlen(uri->server) - 2); } else { host = qstring_from_str(uri->server); } qdict_put(options, "server.type", qstring_from_str("inet")); qdict_put(options, "server.data.host", host); port_str = g_strdup_printf("%d", uri->port ?: NBD_DEFAULT_PORT); qdict_put(options, "server.data.port", qstring_from_str(port_str)); g_free(port_str); } out: if (qp) { query_params_free(qp); } uri_free(uri); return ret; }
{ "code": [], "line_no": [] }
static int FUNC_0(const char *VAR_0, QDict *VAR_1) { URI *uri; const char *VAR_2; QueryParams *qp = NULL; int VAR_3 = 0; bool is_unix; uri = uri_parse(VAR_0); if (!uri) { return -EINVAL; } if (!strcmp(uri->scheme, "nbd")) { is_unix = false; } else if (!strcmp(uri->scheme, "nbd+tcp")) { is_unix = false; } else if (!strcmp(uri->scheme, "nbd+unix")) { is_unix = true; } else { VAR_3 = -EINVAL; goto out; } VAR_2 = uri->path ? uri->path : "/"; VAR_2 += strspn(VAR_2, "/"); if (VAR_2[0]) { qdict_put(VAR_1, "export", qstring_from_str(VAR_2)); } qp = query_params_parse(uri->query); if (qp->n > 1 || (is_unix && !qp->n) || (!is_unix && qp->n)) { VAR_3 = -EINVAL; goto out; } if (is_unix) { if (uri->server || uri->port || strcmp(qp->VAR_2[0].name, "socket")) { VAR_3 = -EINVAL; goto out; } qdict_put(VAR_1, "server.type", qstring_from_str("unix")); qdict_put(VAR_1, "server.data.path", qstring_from_str(qp->VAR_2[0].value)); } else { QString *host; char *VAR_4; if (!uri->server) { VAR_3 = -EINVAL; goto out; } if (uri->server[0] == '[') { host = qstring_from_substr(uri->server, 1, strlen(uri->server) - 2); } else { host = qstring_from_str(uri->server); } qdict_put(VAR_1, "server.type", qstring_from_str("inet")); qdict_put(VAR_1, "server.data.host", host); VAR_4 = g_strdup_printf("%d", uri->port ?: NBD_DEFAULT_PORT); qdict_put(VAR_1, "server.data.port", qstring_from_str(VAR_4)); g_free(VAR_4); } out: if (qp) { query_params_free(qp); } uri_free(uri); return VAR_3; }
[ "static int FUNC_0(const char *VAR_0, QDict *VAR_1)\n{", "URI *uri;", "const char *VAR_2;", "QueryParams *qp = NULL;", "int VAR_3 = 0;", "bool is_unix;", "uri = uri_parse(VAR_0);", "if (!uri) {", "return -EINVAL;", "}", "if (!strcmp(uri->scheme, \"nbd\")) {", "is_unix = false;", "} else if (!strcmp(uri->scheme, \"nbd+tcp\")) {", "is_unix = false;", "} else if (!strcmp(uri->scheme, \"nbd+unix\")) {", "is_unix = true;", "} else {", "VAR_3 = -EINVAL;", "goto out;", "}", "VAR_2 = uri->path ? uri->path : \"/\";", "VAR_2 += strspn(VAR_2, \"/\");", "if (VAR_2[0]) {", "qdict_put(VAR_1, \"export\", qstring_from_str(VAR_2));", "}", "qp = query_params_parse(uri->query);", "if (qp->n > 1 || (is_unix && !qp->n) || (!is_unix && qp->n)) {", "VAR_3 = -EINVAL;", "goto out;", "}", "if (is_unix) {", "if (uri->server || uri->port || strcmp(qp->VAR_2[0].name, \"socket\")) {", "VAR_3 = -EINVAL;", "goto out;", "}", "qdict_put(VAR_1, \"server.type\", qstring_from_str(\"unix\"));", "qdict_put(VAR_1, \"server.data.path\",\nqstring_from_str(qp->VAR_2[0].value));", "} else {", "QString *host;", "char *VAR_4;", "if (!uri->server) {", "VAR_3 = -EINVAL;", "goto out;", "}", "if (uri->server[0] == '[') {", "host = qstring_from_substr(uri->server, 1,\nstrlen(uri->server) - 2);", "} else {", "host = qstring_from_str(uri->server);", "}", "qdict_put(VAR_1, \"server.type\", qstring_from_str(\"inet\"));", "qdict_put(VAR_1, \"server.data.host\", host);", "VAR_4 = g_strdup_printf(\"%d\", uri->port ?: NBD_DEFAULT_PORT);", "qdict_put(VAR_1, \"server.data.port\", qstring_from_str(VAR_4));", "g_free(VAR_4);", "}", "out:\nif (qp) {", "query_params_free(qp);", "}", "uri_free(uri);", "return VAR_3;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 75 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89, 91 ], [ 93 ], [ 95 ], [ 97 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 115 ], [ 117, 119 ], [ 121 ], [ 123 ], [ 125 ], [ 129 ], [ 131 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 145, 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ] ]
7,506
static void disas_ldst_excl(DisasContext *s, uint32_t insn) { int rt = extract32(insn, 0, 5); int rn = extract32(insn, 5, 5); int rt2 = extract32(insn, 10, 5); int is_lasr = extract32(insn, 15, 1); int rs = extract32(insn, 16, 5); int is_pair = extract32(insn, 21, 1); int is_store = !extract32(insn, 22, 1); int is_excl = !extract32(insn, 23, 1); int size = extract32(insn, 30, 2); TCGv_i64 tcg_addr; if ((!is_excl && !is_lasr) || (is_pair && size < 2)) { unallocated_encoding(s); return; } if (rn == 31) { gen_check_sp_alignment(s); } tcg_addr = read_cpu_reg_sp(s, rn, 1); /* Note that since TCG is single threaded load-acquire/store-release * semantics require no extra if (is_lasr) { ... } handling. */ if (is_excl) { if (!is_store) { s->is_ldex = true; gen_load_exclusive(s, rt, rt2, tcg_addr, size, is_pair); } else { gen_store_exclusive(s, rs, rt, rt2, tcg_addr, size, is_pair); } } else { TCGv_i64 tcg_rt = cpu_reg(s, rt); if (is_store) { do_gpr_st(s, tcg_rt, tcg_addr, size); } else { do_gpr_ld(s, tcg_rt, tcg_addr, size, false, false); } if (is_pair) { TCGv_i64 tcg_rt2 = cpu_reg(s, rt); tcg_gen_addi_i64(tcg_addr, tcg_addr, 1 << size); if (is_store) { do_gpr_st(s, tcg_rt2, tcg_addr, size); } else { do_gpr_ld(s, tcg_rt2, tcg_addr, size, false, false); } } } }
false
qemu
e14f0eb12f920fd96b9f79d15cedd437648e8667
static void disas_ldst_excl(DisasContext *s, uint32_t insn) { int rt = extract32(insn, 0, 5); int rn = extract32(insn, 5, 5); int rt2 = extract32(insn, 10, 5); int is_lasr = extract32(insn, 15, 1); int rs = extract32(insn, 16, 5); int is_pair = extract32(insn, 21, 1); int is_store = !extract32(insn, 22, 1); int is_excl = !extract32(insn, 23, 1); int size = extract32(insn, 30, 2); TCGv_i64 tcg_addr; if ((!is_excl && !is_lasr) || (is_pair && size < 2)) { unallocated_encoding(s); return; } if (rn == 31) { gen_check_sp_alignment(s); } tcg_addr = read_cpu_reg_sp(s, rn, 1); if (is_excl) { if (!is_store) { s->is_ldex = true; gen_load_exclusive(s, rt, rt2, tcg_addr, size, is_pair); } else { gen_store_exclusive(s, rs, rt, rt2, tcg_addr, size, is_pair); } } else { TCGv_i64 tcg_rt = cpu_reg(s, rt); if (is_store) { do_gpr_st(s, tcg_rt, tcg_addr, size); } else { do_gpr_ld(s, tcg_rt, tcg_addr, size, false, false); } if (is_pair) { TCGv_i64 tcg_rt2 = cpu_reg(s, rt); tcg_gen_addi_i64(tcg_addr, tcg_addr, 1 << size); if (is_store) { do_gpr_st(s, tcg_rt2, tcg_addr, size); } else { do_gpr_ld(s, tcg_rt2, tcg_addr, size, false, false); } } } }
{ "code": [], "line_no": [] }
static void FUNC_0(DisasContext *VAR_0, uint32_t VAR_1) { int VAR_2 = extract32(VAR_1, 0, 5); int VAR_3 = extract32(VAR_1, 5, 5); int VAR_4 = extract32(VAR_1, 10, 5); int VAR_5 = extract32(VAR_1, 15, 1); int VAR_6 = extract32(VAR_1, 16, 5); int VAR_7 = extract32(VAR_1, 21, 1); int VAR_8 = !extract32(VAR_1, 22, 1); int VAR_9 = !extract32(VAR_1, 23, 1); int VAR_10 = extract32(VAR_1, 30, 2); TCGv_i64 tcg_addr; if ((!VAR_9 && !VAR_5) || (VAR_7 && VAR_10 < 2)) { unallocated_encoding(VAR_0); return; } if (VAR_3 == 31) { gen_check_sp_alignment(VAR_0); } tcg_addr = read_cpu_reg_sp(VAR_0, VAR_3, 1); if (VAR_9) { if (!VAR_8) { VAR_0->is_ldex = true; gen_load_exclusive(VAR_0, VAR_2, VAR_4, tcg_addr, VAR_10, VAR_7); } else { gen_store_exclusive(VAR_0, VAR_6, VAR_2, VAR_4, tcg_addr, VAR_10, VAR_7); } } else { TCGv_i64 tcg_rt = cpu_reg(VAR_0, VAR_2); if (VAR_8) { do_gpr_st(VAR_0, tcg_rt, tcg_addr, VAR_10); } else { do_gpr_ld(VAR_0, tcg_rt, tcg_addr, VAR_10, false, false); } if (VAR_7) { TCGv_i64 tcg_rt2 = cpu_reg(VAR_0, VAR_2); tcg_gen_addi_i64(tcg_addr, tcg_addr, 1 << VAR_10); if (VAR_8) { do_gpr_st(VAR_0, tcg_rt2, tcg_addr, VAR_10); } else { do_gpr_ld(VAR_0, tcg_rt2, tcg_addr, VAR_10, false, false); } } } }
[ "static void FUNC_0(DisasContext *VAR_0, uint32_t VAR_1)\n{", "int VAR_2 = extract32(VAR_1, 0, 5);", "int VAR_3 = extract32(VAR_1, 5, 5);", "int VAR_4 = extract32(VAR_1, 10, 5);", "int VAR_5 = extract32(VAR_1, 15, 1);", "int VAR_6 = extract32(VAR_1, 16, 5);", "int VAR_7 = extract32(VAR_1, 21, 1);", "int VAR_8 = !extract32(VAR_1, 22, 1);", "int VAR_9 = !extract32(VAR_1, 23, 1);", "int VAR_10 = extract32(VAR_1, 30, 2);", "TCGv_i64 tcg_addr;", "if ((!VAR_9 && !VAR_5) ||\n(VAR_7 && VAR_10 < 2)) {", "unallocated_encoding(VAR_0);", "return;", "}", "if (VAR_3 == 31) {", "gen_check_sp_alignment(VAR_0);", "}", "tcg_addr = read_cpu_reg_sp(VAR_0, VAR_3, 1);", "if (VAR_9) {", "if (!VAR_8) {", "VAR_0->is_ldex = true;", "gen_load_exclusive(VAR_0, VAR_2, VAR_4, tcg_addr, VAR_10, VAR_7);", "} else {", "gen_store_exclusive(VAR_0, VAR_6, VAR_2, VAR_4, tcg_addr, VAR_10, VAR_7);", "}", "} else {", "TCGv_i64 tcg_rt = cpu_reg(VAR_0, VAR_2);", "if (VAR_8) {", "do_gpr_st(VAR_0, tcg_rt, tcg_addr, VAR_10);", "} else {", "do_gpr_ld(VAR_0, tcg_rt, tcg_addr, VAR_10, false, false);", "}", "if (VAR_7) {", "TCGv_i64 tcg_rt2 = cpu_reg(VAR_0, VAR_2);", "tcg_gen_addi_i64(tcg_addr, tcg_addr, 1 << VAR_10);", "if (VAR_8) {", "do_gpr_st(VAR_0, tcg_rt2, tcg_addr, VAR_10);", "} else {", "do_gpr_ld(VAR_0, tcg_rt2, tcg_addr, VAR_10, false, false);", "}", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ] ]
7,507
static void do_info_uuid(Monitor *mon) { monitor_printf(mon, UUID_FMT "\n", qemu_uuid[0], qemu_uuid[1], qemu_uuid[2], qemu_uuid[3], qemu_uuid[4], qemu_uuid[5], qemu_uuid[6], qemu_uuid[7], qemu_uuid[8], qemu_uuid[9], qemu_uuid[10], qemu_uuid[11], qemu_uuid[12], qemu_uuid[13], qemu_uuid[14], qemu_uuid[15]); }
false
qemu
9603ceba2edd1dc7e3823da76d84706d3d1c3d78
static void do_info_uuid(Monitor *mon) { monitor_printf(mon, UUID_FMT "\n", qemu_uuid[0], qemu_uuid[1], qemu_uuid[2], qemu_uuid[3], qemu_uuid[4], qemu_uuid[5], qemu_uuid[6], qemu_uuid[7], qemu_uuid[8], qemu_uuid[9], qemu_uuid[10], qemu_uuid[11], qemu_uuid[12], qemu_uuid[13], qemu_uuid[14], qemu_uuid[15]); }
{ "code": [], "line_no": [] }
static void FUNC_0(Monitor *VAR_0) { monitor_printf(VAR_0, UUID_FMT "\n", qemu_uuid[0], qemu_uuid[1], qemu_uuid[2], qemu_uuid[3], qemu_uuid[4], qemu_uuid[5], qemu_uuid[6], qemu_uuid[7], qemu_uuid[8], qemu_uuid[9], qemu_uuid[10], qemu_uuid[11], qemu_uuid[12], qemu_uuid[13], qemu_uuid[14], qemu_uuid[15]); }
[ "static void FUNC_0(Monitor *VAR_0)\n{", "monitor_printf(VAR_0, UUID_FMT \"\\n\", qemu_uuid[0], qemu_uuid[1],\nqemu_uuid[2], qemu_uuid[3], qemu_uuid[4], qemu_uuid[5],\nqemu_uuid[6], qemu_uuid[7], qemu_uuid[8], qemu_uuid[9],\nqemu_uuid[10], qemu_uuid[11], qemu_uuid[12], qemu_uuid[13],\nqemu_uuid[14], qemu_uuid[15]);", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3 ], [ 5, 7, 9, 11, 13 ], [ 15 ] ]
7,508
void kvm_setup_guest_memory(void *start, size_t size) { #ifdef CONFIG_VALGRIND_H VALGRIND_MAKE_MEM_DEFINED(start, size); #endif if (!kvm_has_sync_mmu()) { int ret = qemu_madvise(start, size, QEMU_MADV_DONTFORK); if (ret) { perror("qemu_madvise"); fprintf(stderr, "Need MADV_DONTFORK in absence of synchronous KVM MMU\n"); exit(1); } } }
false
qemu
541be9274e8ef227fb1b50ce124fd2cc2dce81a5
void kvm_setup_guest_memory(void *start, size_t size) { #ifdef CONFIG_VALGRIND_H VALGRIND_MAKE_MEM_DEFINED(start, size); #endif if (!kvm_has_sync_mmu()) { int ret = qemu_madvise(start, size, QEMU_MADV_DONTFORK); if (ret) { perror("qemu_madvise"); fprintf(stderr, "Need MADV_DONTFORK in absence of synchronous KVM MMU\n"); exit(1); } } }
{ "code": [], "line_no": [] }
void FUNC_0(void *VAR_0, size_t VAR_1) { #ifdef CONFIG_VALGRIND_H VALGRIND_MAKE_MEM_DEFINED(VAR_0, VAR_1); #endif if (!kvm_has_sync_mmu()) { int VAR_2 = qemu_madvise(VAR_0, VAR_1, QEMU_MADV_DONTFORK); if (VAR_2) { perror("qemu_madvise"); fprintf(stderr, "Need MADV_DONTFORK in absence of synchronous KVM MMU\n"); exit(1); } } }
[ "void FUNC_0(void *VAR_0, size_t VAR_1)\n{", "#ifdef CONFIG_VALGRIND_H\nVALGRIND_MAKE_MEM_DEFINED(VAR_0, VAR_1);", "#endif\nif (!kvm_has_sync_mmu()) {", "int VAR_2 = qemu_madvise(VAR_0, VAR_1, QEMU_MADV_DONTFORK);", "if (VAR_2) {", "perror(\"qemu_madvise\");", "fprintf(stderr,\n\"Need MADV_DONTFORK in absence of synchronous KVM MMU\\n\");", "exit(1);", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5, 7 ], [ 9, 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21, 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ] ]
7,509
build_facs(GArray *table_data, GArray *linker) { AcpiFacsDescriptorRev1 *facs = acpi_data_push(table_data, sizeof *facs); memcpy(&facs->signature, "FACS", 4); facs->length = cpu_to_le32(sizeof(*facs)); }
false
qemu
0e9b9edae7bebfd31fdbead4ccbbce03876a7edd
build_facs(GArray *table_data, GArray *linker) { AcpiFacsDescriptorRev1 *facs = acpi_data_push(table_data, sizeof *facs); memcpy(&facs->signature, "FACS", 4); facs->length = cpu_to_le32(sizeof(*facs)); }
{ "code": [], "line_no": [] }
FUNC_0(GArray *VAR_0, GArray *VAR_1) { AcpiFacsDescriptorRev1 *facs = acpi_data_push(VAR_0, sizeof *facs); memcpy(&facs->signature, "FACS", 4); facs->length = cpu_to_le32(sizeof(*facs)); }
[ "FUNC_0(GArray *VAR_0, GArray *VAR_1)\n{", "AcpiFacsDescriptorRev1 *facs = acpi_data_push(VAR_0, sizeof *facs);", "memcpy(&facs->signature, \"FACS\", 4);", "facs->length = cpu_to_le32(sizeof(*facs));", "}" ]
[ 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ] ]
7,510
bool bdrv_debug_is_suspended(BlockDriverState *bs, const char *tag) { while (bs && bs->drv && !bs->drv->bdrv_debug_is_suspended) { bs = bs->file; } if (bs && bs->drv && bs->drv->bdrv_debug_is_suspended) { return bs->drv->bdrv_debug_is_suspended(bs, tag); } return false; }
false
qemu
61007b316cd71ee7333ff7a0a749a8949527575f
bool bdrv_debug_is_suspended(BlockDriverState *bs, const char *tag) { while (bs && bs->drv && !bs->drv->bdrv_debug_is_suspended) { bs = bs->file; } if (bs && bs->drv && bs->drv->bdrv_debug_is_suspended) { return bs->drv->bdrv_debug_is_suspended(bs, tag); } return false; }
{ "code": [], "line_no": [] }
bool FUNC_0(BlockDriverState *bs, const char *tag) { while (bs && bs->drv && !bs->drv->FUNC_0) { bs = bs->file; } if (bs && bs->drv && bs->drv->FUNC_0) { return bs->drv->FUNC_0(bs, tag); } return false; }
[ "bool FUNC_0(BlockDriverState *bs, const char *tag)\n{", "while (bs && bs->drv && !bs->drv->FUNC_0) {", "bs = bs->file;", "}", "if (bs && bs->drv && bs->drv->FUNC_0) {", "return bs->drv->FUNC_0(bs, tag);", "}", "return false;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ] ]
7,512
AioContext *aio_context_new(void) { AioContext *ctx; ctx = (AioContext *) g_source_new(&aio_source_funcs, sizeof(AioContext)); ctx->pollfds = g_array_new(FALSE, FALSE, sizeof(GPollFD)); ctx->thread_pool = NULL; qemu_mutex_init(&ctx->bh_lock); rfifolock_init(&ctx->lock, aio_rfifolock_cb, ctx); event_notifier_init(&ctx->notifier, false); aio_set_event_notifier(ctx, &ctx->notifier, (EventNotifierHandler *) event_notifier_test_and_clear); timerlistgroup_init(&ctx->tlg, aio_timerlist_notify, ctx); return ctx; }
true
qemu
2f78e491d7b46542158ce0b8132ee4e05bc0ade4
AioContext *aio_context_new(void) { AioContext *ctx; ctx = (AioContext *) g_source_new(&aio_source_funcs, sizeof(AioContext)); ctx->pollfds = g_array_new(FALSE, FALSE, sizeof(GPollFD)); ctx->thread_pool = NULL; qemu_mutex_init(&ctx->bh_lock); rfifolock_init(&ctx->lock, aio_rfifolock_cb, ctx); event_notifier_init(&ctx->notifier, false); aio_set_event_notifier(ctx, &ctx->notifier, (EventNotifierHandler *) event_notifier_test_and_clear); timerlistgroup_init(&ctx->tlg, aio_timerlist_notify, ctx); return ctx; }
{ "code": [ "AioContext *aio_context_new(void)", " event_notifier_init(&ctx->notifier, false);", " aio_set_event_notifier(ctx, &ctx->notifier, ", " (EventNotifierHandler *)", " event_notifier_test_and_clear);" ], "line_no": [ 1, 17, 19, 21, 23 ] }
AioContext *FUNC_0(void) { AioContext *ctx; ctx = (AioContext *) g_source_new(&aio_source_funcs, sizeof(AioContext)); ctx->pollfds = g_array_new(FALSE, FALSE, sizeof(GPollFD)); ctx->thread_pool = NULL; qemu_mutex_init(&ctx->bh_lock); rfifolock_init(&ctx->lock, aio_rfifolock_cb, ctx); event_notifier_init(&ctx->notifier, false); aio_set_event_notifier(ctx, &ctx->notifier, (EventNotifierHandler *) event_notifier_test_and_clear); timerlistgroup_init(&ctx->tlg, aio_timerlist_notify, ctx); return ctx; }
[ "AioContext *FUNC_0(void)\n{", "AioContext *ctx;", "ctx = (AioContext *) g_source_new(&aio_source_funcs, sizeof(AioContext));", "ctx->pollfds = g_array_new(FALSE, FALSE, sizeof(GPollFD));", "ctx->thread_pool = NULL;", "qemu_mutex_init(&ctx->bh_lock);", "rfifolock_init(&ctx->lock, aio_rfifolock_cb, ctx);", "event_notifier_init(&ctx->notifier, false);", "aio_set_event_notifier(ctx, &ctx->notifier,\n(EventNotifierHandler *)\nevent_notifier_test_and_clear);", "timerlistgroup_init(&ctx->tlg, aio_timerlist_notify, ctx);", "return ctx;", "}" ]
[ 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19, 21, 23 ], [ 25 ], [ 29 ], [ 31 ] ]
7,513
void bdrv_query_info(BlockDriverState *bs, BlockInfo **p_info, Error **errp) { BlockInfo *info = g_malloc0(sizeof(*info)); BlockDriverState *bs0; ImageInfo **p_image_info; Error *local_err = NULL; info->device = g_strdup(bs->device_name); info->type = g_strdup("unknown"); info->locked = bdrv_dev_is_medium_locked(bs); info->removable = bdrv_dev_has_removable_media(bs); if (bdrv_dev_has_removable_media(bs)) { info->has_tray_open = true; info->tray_open = bdrv_dev_is_tray_open(bs); } if (bdrv_iostatus_is_enabled(bs)) { info->has_io_status = true; info->io_status = bs->iostatus; } if (bs->dirty_bitmap) { info->has_dirty = true; info->dirty = g_malloc0(sizeof(*info->dirty)); info->dirty->count = bdrv_get_dirty_count(bs) * BDRV_SECTOR_SIZE; info->dirty->granularity = ((int64_t) BDRV_SECTOR_SIZE << hbitmap_granularity(bs->dirty_bitmap)); } if (bs->drv) { info->has_inserted = true; info->inserted = g_malloc0(sizeof(*info->inserted)); info->inserted->file = g_strdup(bs->filename); info->inserted->ro = bs->read_only; info->inserted->drv = g_strdup(bs->drv->format_name); info->inserted->encrypted = bs->encrypted; info->inserted->encryption_key_missing = bdrv_key_required(bs); if (bs->backing_file[0]) { info->inserted->has_backing_file = true; info->inserted->backing_file = g_strdup(bs->backing_file); } info->inserted->backing_file_depth = bdrv_get_backing_file_depth(bs); if (bs->io_limits_enabled) { ThrottleConfig cfg; throttle_get_config(&bs->throttle_state, &cfg); info->inserted->bps = cfg.buckets[THROTTLE_BPS_TOTAL].avg; info->inserted->bps_rd = cfg.buckets[THROTTLE_BPS_READ].avg; info->inserted->bps_wr = cfg.buckets[THROTTLE_BPS_WRITE].avg; info->inserted->iops = cfg.buckets[THROTTLE_OPS_TOTAL].avg; info->inserted->iops_rd = cfg.buckets[THROTTLE_OPS_READ].avg; info->inserted->iops_wr = cfg.buckets[THROTTLE_OPS_WRITE].avg; } bs0 = bs; p_image_info = &info->inserted->image; while (1) { bdrv_query_image_info(bs0, p_image_info, &local_err); if (error_is_set(&local_err)) { error_propagate(errp, local_err); goto err; } if (bs0->drv && bs0->backing_hd) { bs0 = bs0->backing_hd; (*p_image_info)->has_backing_image = true; p_image_info = &((*p_image_info)->backing_image); } else { break; } } } *p_info = info; return; err: qapi_free_BlockInfo(info); }
true
qemu
3e9fab690d59ac15956c3733fe0794ce1ae4c4af
void bdrv_query_info(BlockDriverState *bs, BlockInfo **p_info, Error **errp) { BlockInfo *info = g_malloc0(sizeof(*info)); BlockDriverState *bs0; ImageInfo **p_image_info; Error *local_err = NULL; info->device = g_strdup(bs->device_name); info->type = g_strdup("unknown"); info->locked = bdrv_dev_is_medium_locked(bs); info->removable = bdrv_dev_has_removable_media(bs); if (bdrv_dev_has_removable_media(bs)) { info->has_tray_open = true; info->tray_open = bdrv_dev_is_tray_open(bs); } if (bdrv_iostatus_is_enabled(bs)) { info->has_io_status = true; info->io_status = bs->iostatus; } if (bs->dirty_bitmap) { info->has_dirty = true; info->dirty = g_malloc0(sizeof(*info->dirty)); info->dirty->count = bdrv_get_dirty_count(bs) * BDRV_SECTOR_SIZE; info->dirty->granularity = ((int64_t) BDRV_SECTOR_SIZE << hbitmap_granularity(bs->dirty_bitmap)); } if (bs->drv) { info->has_inserted = true; info->inserted = g_malloc0(sizeof(*info->inserted)); info->inserted->file = g_strdup(bs->filename); info->inserted->ro = bs->read_only; info->inserted->drv = g_strdup(bs->drv->format_name); info->inserted->encrypted = bs->encrypted; info->inserted->encryption_key_missing = bdrv_key_required(bs); if (bs->backing_file[0]) { info->inserted->has_backing_file = true; info->inserted->backing_file = g_strdup(bs->backing_file); } info->inserted->backing_file_depth = bdrv_get_backing_file_depth(bs); if (bs->io_limits_enabled) { ThrottleConfig cfg; throttle_get_config(&bs->throttle_state, &cfg); info->inserted->bps = cfg.buckets[THROTTLE_BPS_TOTAL].avg; info->inserted->bps_rd = cfg.buckets[THROTTLE_BPS_READ].avg; info->inserted->bps_wr = cfg.buckets[THROTTLE_BPS_WRITE].avg; info->inserted->iops = cfg.buckets[THROTTLE_OPS_TOTAL].avg; info->inserted->iops_rd = cfg.buckets[THROTTLE_OPS_READ].avg; info->inserted->iops_wr = cfg.buckets[THROTTLE_OPS_WRITE].avg; } bs0 = bs; p_image_info = &info->inserted->image; while (1) { bdrv_query_image_info(bs0, p_image_info, &local_err); if (error_is_set(&local_err)) { error_propagate(errp, local_err); goto err; } if (bs0->drv && bs0->backing_hd) { bs0 = bs0->backing_hd; (*p_image_info)->has_backing_image = true; p_image_info = &((*p_image_info)->backing_image); } else { break; } } } *p_info = info; return; err: qapi_free_BlockInfo(info); }
{ "code": [], "line_no": [] }
void FUNC_0(BlockDriverState *VAR_0, BlockInfo **VAR_1, Error **VAR_2) { BlockInfo *info = g_malloc0(sizeof(*info)); BlockDriverState *bs0; ImageInfo **p_image_info; Error *local_err = NULL; info->device = g_strdup(VAR_0->device_name); info->type = g_strdup("unknown"); info->locked = bdrv_dev_is_medium_locked(VAR_0); info->removable = bdrv_dev_has_removable_media(VAR_0); if (bdrv_dev_has_removable_media(VAR_0)) { info->has_tray_open = true; info->tray_open = bdrv_dev_is_tray_open(VAR_0); } if (bdrv_iostatus_is_enabled(VAR_0)) { info->has_io_status = true; info->io_status = VAR_0->iostatus; } if (VAR_0->dirty_bitmap) { info->has_dirty = true; info->dirty = g_malloc0(sizeof(*info->dirty)); info->dirty->count = bdrv_get_dirty_count(VAR_0) * BDRV_SECTOR_SIZE; info->dirty->granularity = ((int64_t) BDRV_SECTOR_SIZE << hbitmap_granularity(VAR_0->dirty_bitmap)); } if (VAR_0->drv) { info->has_inserted = true; info->inserted = g_malloc0(sizeof(*info->inserted)); info->inserted->file = g_strdup(VAR_0->filename); info->inserted->ro = VAR_0->read_only; info->inserted->drv = g_strdup(VAR_0->drv->format_name); info->inserted->encrypted = VAR_0->encrypted; info->inserted->encryption_key_missing = bdrv_key_required(VAR_0); if (VAR_0->backing_file[0]) { info->inserted->has_backing_file = true; info->inserted->backing_file = g_strdup(VAR_0->backing_file); } info->inserted->backing_file_depth = bdrv_get_backing_file_depth(VAR_0); if (VAR_0->io_limits_enabled) { ThrottleConfig cfg; throttle_get_config(&VAR_0->throttle_state, &cfg); info->inserted->bps = cfg.buckets[THROTTLE_BPS_TOTAL].avg; info->inserted->bps_rd = cfg.buckets[THROTTLE_BPS_READ].avg; info->inserted->bps_wr = cfg.buckets[THROTTLE_BPS_WRITE].avg; info->inserted->iops = cfg.buckets[THROTTLE_OPS_TOTAL].avg; info->inserted->iops_rd = cfg.buckets[THROTTLE_OPS_READ].avg; info->inserted->iops_wr = cfg.buckets[THROTTLE_OPS_WRITE].avg; } bs0 = VAR_0; p_image_info = &info->inserted->image; while (1) { bdrv_query_image_info(bs0, p_image_info, &local_err); if (error_is_set(&local_err)) { error_propagate(VAR_2, local_err); goto err; } if (bs0->drv && bs0->backing_hd) { bs0 = bs0->backing_hd; (*p_image_info)->has_backing_image = true; p_image_info = &((*p_image_info)->backing_image); } else { break; } } } *VAR_1 = info; return; err: qapi_free_BlockInfo(info); }
[ "void FUNC_0(BlockDriverState *VAR_0,\nBlockInfo **VAR_1,\nError **VAR_2)\n{", "BlockInfo *info = g_malloc0(sizeof(*info));", "BlockDriverState *bs0;", "ImageInfo **p_image_info;", "Error *local_err = NULL;", "info->device = g_strdup(VAR_0->device_name);", "info->type = g_strdup(\"unknown\");", "info->locked = bdrv_dev_is_medium_locked(VAR_0);", "info->removable = bdrv_dev_has_removable_media(VAR_0);", "if (bdrv_dev_has_removable_media(VAR_0)) {", "info->has_tray_open = true;", "info->tray_open = bdrv_dev_is_tray_open(VAR_0);", "}", "if (bdrv_iostatus_is_enabled(VAR_0)) {", "info->has_io_status = true;", "info->io_status = VAR_0->iostatus;", "}", "if (VAR_0->dirty_bitmap) {", "info->has_dirty = true;", "info->dirty = g_malloc0(sizeof(*info->dirty));", "info->dirty->count = bdrv_get_dirty_count(VAR_0) * BDRV_SECTOR_SIZE;", "info->dirty->granularity =\n((int64_t) BDRV_SECTOR_SIZE << hbitmap_granularity(VAR_0->dirty_bitmap));", "}", "if (VAR_0->drv) {", "info->has_inserted = true;", "info->inserted = g_malloc0(sizeof(*info->inserted));", "info->inserted->file = g_strdup(VAR_0->filename);", "info->inserted->ro = VAR_0->read_only;", "info->inserted->drv = g_strdup(VAR_0->drv->format_name);", "info->inserted->encrypted = VAR_0->encrypted;", "info->inserted->encryption_key_missing = bdrv_key_required(VAR_0);", "if (VAR_0->backing_file[0]) {", "info->inserted->has_backing_file = true;", "info->inserted->backing_file = g_strdup(VAR_0->backing_file);", "}", "info->inserted->backing_file_depth = bdrv_get_backing_file_depth(VAR_0);", "if (VAR_0->io_limits_enabled) {", "ThrottleConfig cfg;", "throttle_get_config(&VAR_0->throttle_state, &cfg);", "info->inserted->bps = cfg.buckets[THROTTLE_BPS_TOTAL].avg;", "info->inserted->bps_rd = cfg.buckets[THROTTLE_BPS_READ].avg;", "info->inserted->bps_wr = cfg.buckets[THROTTLE_BPS_WRITE].avg;", "info->inserted->iops = cfg.buckets[THROTTLE_OPS_TOTAL].avg;", "info->inserted->iops_rd = cfg.buckets[THROTTLE_OPS_READ].avg;", "info->inserted->iops_wr = cfg.buckets[THROTTLE_OPS_WRITE].avg;", "}", "bs0 = VAR_0;", "p_image_info = &info->inserted->image;", "while (1) {", "bdrv_query_image_info(bs0, p_image_info, &local_err);", "if (error_is_set(&local_err)) {", "error_propagate(VAR_2, local_err);", "goto err;", "}", "if (bs0->drv && bs0->backing_hd) {", "bs0 = bs0->backing_hd;", "(*p_image_info)->has_backing_image = true;", "p_image_info = &((*p_image_info)->backing_image);", "} else {", "break;", "}", "}", "}", "*VAR_1 = info;", "return;", "err:\nqapi_free_BlockInfo(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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 2, 3, 4 ], [ 5 ], [ 6 ], [ 7 ], [ 8 ], [ 9 ], [ 10 ], [ 11 ], [ 12 ], [ 13 ], [ 14 ], [ 15 ], [ 16 ], [ 17 ], [ 18 ], [ 19 ], [ 20 ], [ 21 ], [ 22 ], [ 23 ], [ 24 ], [ 25, 26 ], [ 27 ], [ 28 ], [ 29 ], [ 30 ], [ 31 ], [ 32 ], [ 33 ], [ 34 ], [ 35 ], [ 36 ], [ 37 ], [ 38 ], [ 39 ], [ 40 ], [ 41 ], [ 42 ], [ 43 ], [ 44 ], [ 45 ], [ 46 ], [ 47 ], [ 48 ], [ 49 ], [ 50 ], [ 51 ], [ 52 ], [ 53 ], [ 54 ], [ 55 ], [ 56 ], [ 57 ], [ 58 ], [ 59 ], [ 60 ], [ 61 ], [ 62 ], [ 63 ], [ 64 ], [ 65 ], [ 66 ], [ 67 ], [ 68 ], [ 69 ], [ 70, 71 ], [ 72 ] ]
7,514
static void s390_init(ram_addr_t my_ram_size, const char *boot_device, const char *kernel_filename, const char *kernel_cmdline, const char *initrd_filename, const char *cpu_model) { CPUState *env = NULL; MemoryRegion *sysmem = get_system_memory(); MemoryRegion *ram = g_new(MemoryRegion, 1); ram_addr_t kernel_size = 0; ram_addr_t initrd_offset; ram_addr_t initrd_size = 0; int shift = 0; uint8_t *storage_keys; void *virtio_region; target_phys_addr_t virtio_region_len; target_phys_addr_t virtio_region_start; int i; /* s390x ram size detection needs a 16bit multiplier + an increment. So guests > 64GB can be specified in 2MB steps etc. */ while ((my_ram_size >> (20 + shift)) > 65535) { shift++; } my_ram_size = my_ram_size >> (20 + shift) << (20 + shift); /* lets propagate the changed ram size into the global variable. */ ram_size = my_ram_size; /* get a BUS */ s390_bus = s390_virtio_bus_init(&my_ram_size); /* allocate RAM */ memory_region_init_ram(ram, "s390.ram", my_ram_size); vmstate_register_ram_global(ram); memory_region_add_subregion(sysmem, 0, ram); /* clear virtio region */ virtio_region_len = my_ram_size - ram_size; virtio_region_start = ram_size; virtio_region = cpu_physical_memory_map(virtio_region_start, &virtio_region_len, true); memset(virtio_region, 0, virtio_region_len); cpu_physical_memory_unmap(virtio_region, virtio_region_len, 1, virtio_region_len); /* allocate storage keys */ storage_keys = g_malloc0(my_ram_size / TARGET_PAGE_SIZE); /* init CPUs */ if (cpu_model == NULL) { cpu_model = "host"; } ipi_states = g_malloc(sizeof(CPUState *) * smp_cpus); for (i = 0; i < smp_cpus; i++) { CPUState *tmp_env; tmp_env = cpu_init(cpu_model); if (!env) { env = tmp_env; } ipi_states[i] = tmp_env; tmp_env->halted = 1; tmp_env->exception_index = EXCP_HLT; tmp_env->storage_keys = storage_keys; } /* One CPU has to run */ s390_add_running_cpu(env); if (kernel_filename) { kernel_size = load_image(kernel_filename, qemu_get_ram_ptr(0)); if (lduw_be_phys(KERN_IMAGE_START) != 0x0dd0) { fprintf(stderr, "Specified image is not an s390 boot image\n"); exit(1); } env->psw.addr = KERN_IMAGE_START; env->psw.mask = 0x0000000180000000ULL; } else { ram_addr_t bios_size = 0; char *bios_filename; /* Load zipl bootloader */ if (bios_name == NULL) { bios_name = ZIPL_FILENAME; } bios_filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); bios_size = load_image(bios_filename, qemu_get_ram_ptr(ZIPL_LOAD_ADDR)); g_free(bios_filename); if ((long)bios_size < 0) { hw_error("could not load bootloader '%s'\n", bios_name); } if (bios_size > 4096) { hw_error("stage1 bootloader is > 4k\n"); } env->psw.addr = ZIPL_START; env->psw.mask = 0x0000000180000000ULL; } if (initrd_filename) { initrd_offset = INITRD_START; while (kernel_size + 0x100000 > initrd_offset) { initrd_offset += 0x100000; } initrd_size = load_image(initrd_filename, qemu_get_ram_ptr(initrd_offset)); stq_be_phys(INITRD_PARM_START, initrd_offset); stq_be_phys(INITRD_PARM_SIZE, initrd_size); } if (kernel_cmdline) { cpu_physical_memory_write(KERN_PARM_AREA, kernel_cmdline, strlen(kernel_cmdline) + 1); } /* Create VirtIO network adapters */ for(i = 0; i < nb_nics; i++) { NICInfo *nd = &nd_table[i]; DeviceState *dev; if (!nd->model) { nd->model = g_strdup("virtio"); } if (strcmp(nd->model, "virtio")) { fprintf(stderr, "S390 only supports VirtIO nics\n"); exit(1); } dev = qdev_create((BusState *)s390_bus, "virtio-net-s390"); qdev_set_nic_properties(dev, nd); qdev_init_nofail(dev); } /* Create VirtIO disk drives */ for(i = 0; i < MAX_BLK_DEVS; i++) { DriveInfo *dinfo; DeviceState *dev; dinfo = drive_get(IF_IDE, 0, i); if (!dinfo) { continue; } dev = qdev_create((BusState *)s390_bus, "virtio-blk-s390"); qdev_prop_set_drive_nofail(dev, "drive", dinfo->bdrv); qdev_init_nofail(dev); } }
true
qemu
1edb493490c5cb1eb5ddd55ba498dfb5f008050c
static void s390_init(ram_addr_t my_ram_size, const char *boot_device, const char *kernel_filename, const char *kernel_cmdline, const char *initrd_filename, const char *cpu_model) { CPUState *env = NULL; MemoryRegion *sysmem = get_system_memory(); MemoryRegion *ram = g_new(MemoryRegion, 1); ram_addr_t kernel_size = 0; ram_addr_t initrd_offset; ram_addr_t initrd_size = 0; int shift = 0; uint8_t *storage_keys; void *virtio_region; target_phys_addr_t virtio_region_len; target_phys_addr_t virtio_region_start; int i; while ((my_ram_size >> (20 + shift)) > 65535) { shift++; } my_ram_size = my_ram_size >> (20 + shift) << (20 + shift); ram_size = my_ram_size; s390_bus = s390_virtio_bus_init(&my_ram_size); memory_region_init_ram(ram, "s390.ram", my_ram_size); vmstate_register_ram_global(ram); memory_region_add_subregion(sysmem, 0, ram); virtio_region_len = my_ram_size - ram_size; virtio_region_start = ram_size; virtio_region = cpu_physical_memory_map(virtio_region_start, &virtio_region_len, true); memset(virtio_region, 0, virtio_region_len); cpu_physical_memory_unmap(virtio_region, virtio_region_len, 1, virtio_region_len); storage_keys = g_malloc0(my_ram_size / TARGET_PAGE_SIZE); if (cpu_model == NULL) { cpu_model = "host"; } ipi_states = g_malloc(sizeof(CPUState *) * smp_cpus); for (i = 0; i < smp_cpus; i++) { CPUState *tmp_env; tmp_env = cpu_init(cpu_model); if (!env) { env = tmp_env; } ipi_states[i] = tmp_env; tmp_env->halted = 1; tmp_env->exception_index = EXCP_HLT; tmp_env->storage_keys = storage_keys; } s390_add_running_cpu(env); if (kernel_filename) { kernel_size = load_image(kernel_filename, qemu_get_ram_ptr(0)); if (lduw_be_phys(KERN_IMAGE_START) != 0x0dd0) { fprintf(stderr, "Specified image is not an s390 boot image\n"); exit(1); } env->psw.addr = KERN_IMAGE_START; env->psw.mask = 0x0000000180000000ULL; } else { ram_addr_t bios_size = 0; char *bios_filename; if (bios_name == NULL) { bios_name = ZIPL_FILENAME; } bios_filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); bios_size = load_image(bios_filename, qemu_get_ram_ptr(ZIPL_LOAD_ADDR)); g_free(bios_filename); if ((long)bios_size < 0) { hw_error("could not load bootloader '%s'\n", bios_name); } if (bios_size > 4096) { hw_error("stage1 bootloader is > 4k\n"); } env->psw.addr = ZIPL_START; env->psw.mask = 0x0000000180000000ULL; } if (initrd_filename) { initrd_offset = INITRD_START; while (kernel_size + 0x100000 > initrd_offset) { initrd_offset += 0x100000; } initrd_size = load_image(initrd_filename, qemu_get_ram_ptr(initrd_offset)); stq_be_phys(INITRD_PARM_START, initrd_offset); stq_be_phys(INITRD_PARM_SIZE, initrd_size); } if (kernel_cmdline) { cpu_physical_memory_write(KERN_PARM_AREA, kernel_cmdline, strlen(kernel_cmdline) + 1); } for(i = 0; i < nb_nics; i++) { NICInfo *nd = &nd_table[i]; DeviceState *dev; if (!nd->model) { nd->model = g_strdup("virtio"); } if (strcmp(nd->model, "virtio")) { fprintf(stderr, "S390 only supports VirtIO nics\n"); exit(1); } dev = qdev_create((BusState *)s390_bus, "virtio-net-s390"); qdev_set_nic_properties(dev, nd); qdev_init_nofail(dev); } for(i = 0; i < MAX_BLK_DEVS; i++) { DriveInfo *dinfo; DeviceState *dev; dinfo = drive_get(IF_IDE, 0, i); if (!dinfo) { continue; } dev = qdev_create((BusState *)s390_bus, "virtio-blk-s390"); qdev_prop_set_drive_nofail(dev, "drive", dinfo->bdrv); qdev_init_nofail(dev); } }
{ "code": [ " kernel_size = load_image(kernel_filename, qemu_get_ram_ptr(0));", " if (lduw_be_phys(KERN_IMAGE_START) != 0x0dd0) {", " fprintf(stderr, \"Specified image is not an s390 boot image\\n\");", " exit(1);", " bios_size = load_image(bios_filename, qemu_get_ram_ptr(ZIPL_LOAD_ADDR));", " initrd_size = load_image(initrd_filename, qemu_get_ram_ptr(initrd_offset));", " stq_be_phys(INITRD_PARM_START, initrd_offset);", " stq_be_phys(INITRD_PARM_SIZE, initrd_size);", " cpu_physical_memory_write(KERN_PARM_AREA, kernel_cmdline,", " strlen(kernel_cmdline) + 1);" ], "line_no": [ 149, 153, 155, 157, 187, 227, 231, 233, 241, 243 ] }
static void FUNC_0(ram_addr_t VAR_0, const char *VAR_1, const char *VAR_2, const char *VAR_3, const char *VAR_4, const char *VAR_5) { CPUState *env = NULL; MemoryRegion *sysmem = get_system_memory(); MemoryRegion *ram = g_new(MemoryRegion, 1); ram_addr_t kernel_size = 0; ram_addr_t initrd_offset; ram_addr_t initrd_size = 0; int VAR_6 = 0; uint8_t *storage_keys; void *VAR_7; target_phys_addr_t virtio_region_len; target_phys_addr_t virtio_region_start; int VAR_8; while ((VAR_0 >> (20 + VAR_6)) > 65535) { VAR_6++; } VAR_0 = VAR_0 >> (20 + VAR_6) << (20 + VAR_6); ram_size = VAR_0; s390_bus = s390_virtio_bus_init(&VAR_0); memory_region_init_ram(ram, "s390.ram", VAR_0); vmstate_register_ram_global(ram); memory_region_add_subregion(sysmem, 0, ram); virtio_region_len = VAR_0 - ram_size; virtio_region_start = ram_size; VAR_7 = cpu_physical_memory_map(virtio_region_start, &virtio_region_len, true); memset(VAR_7, 0, virtio_region_len); cpu_physical_memory_unmap(VAR_7, virtio_region_len, 1, virtio_region_len); storage_keys = g_malloc0(VAR_0 / TARGET_PAGE_SIZE); if (VAR_5 == NULL) { VAR_5 = "host"; } ipi_states = g_malloc(sizeof(CPUState *) * smp_cpus); for (VAR_8 = 0; VAR_8 < smp_cpus; VAR_8++) { CPUState *tmp_env; tmp_env = cpu_init(VAR_5); if (!env) { env = tmp_env; } ipi_states[VAR_8] = tmp_env; tmp_env->halted = 1; tmp_env->exception_index = EXCP_HLT; tmp_env->storage_keys = storage_keys; } s390_add_running_cpu(env); if (VAR_2) { kernel_size = load_image(VAR_2, qemu_get_ram_ptr(0)); if (lduw_be_phys(KERN_IMAGE_START) != 0x0dd0) { fprintf(stderr, "Specified image is not an s390 boot image\n"); exit(1); } env->psw.addr = KERN_IMAGE_START; env->psw.mask = 0x0000000180000000ULL; } else { ram_addr_t bios_size = 0; char *VAR_9; if (bios_name == NULL) { bios_name = ZIPL_FILENAME; } VAR_9 = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); bios_size = load_image(VAR_9, qemu_get_ram_ptr(ZIPL_LOAD_ADDR)); g_free(VAR_9); if ((long)bios_size < 0) { hw_error("could not load bootloader '%s'\n", bios_name); } if (bios_size > 4096) { hw_error("stage1 bootloader is > 4k\n"); } env->psw.addr = ZIPL_START; env->psw.mask = 0x0000000180000000ULL; } if (VAR_4) { initrd_offset = INITRD_START; while (kernel_size + 0x100000 > initrd_offset) { initrd_offset += 0x100000; } initrd_size = load_image(VAR_4, qemu_get_ram_ptr(initrd_offset)); stq_be_phys(INITRD_PARM_START, initrd_offset); stq_be_phys(INITRD_PARM_SIZE, initrd_size); } if (VAR_3) { cpu_physical_memory_write(KERN_PARM_AREA, VAR_3, strlen(VAR_3) + 1); } for(VAR_8 = 0; VAR_8 < nb_nics; VAR_8++) { NICInfo *nd = &nd_table[VAR_8]; DeviceState *dev; if (!nd->model) { nd->model = g_strdup("virtio"); } if (strcmp(nd->model, "virtio")) { fprintf(stderr, "S390 only supports VirtIO nics\n"); exit(1); } dev = qdev_create((BusState *)s390_bus, "virtio-net-s390"); qdev_set_nic_properties(dev, nd); qdev_init_nofail(dev); } for(VAR_8 = 0; VAR_8 < MAX_BLK_DEVS; VAR_8++) { DriveInfo *dinfo; DeviceState *dev; dinfo = drive_get(IF_IDE, 0, VAR_8); if (!dinfo) { continue; } dev = qdev_create((BusState *)s390_bus, "virtio-blk-s390"); qdev_prop_set_drive_nofail(dev, "drive", dinfo->bdrv); qdev_init_nofail(dev); } }
[ "static void FUNC_0(ram_addr_t VAR_0,\nconst char *VAR_1,\nconst char *VAR_2,\nconst char *VAR_3,\nconst char *VAR_4,\nconst char *VAR_5)\n{", "CPUState *env = NULL;", "MemoryRegion *sysmem = get_system_memory();", "MemoryRegion *ram = g_new(MemoryRegion, 1);", "ram_addr_t kernel_size = 0;", "ram_addr_t initrd_offset;", "ram_addr_t initrd_size = 0;", "int VAR_6 = 0;", "uint8_t *storage_keys;", "void *VAR_7;", "target_phys_addr_t virtio_region_len;", "target_phys_addr_t virtio_region_start;", "int VAR_8;", "while ((VAR_0 >> (20 + VAR_6)) > 65535) {", "VAR_6++;", "}", "VAR_0 = VAR_0 >> (20 + VAR_6) << (20 + VAR_6);", "ram_size = VAR_0;", "s390_bus = s390_virtio_bus_init(&VAR_0);", "memory_region_init_ram(ram, \"s390.ram\", VAR_0);", "vmstate_register_ram_global(ram);", "memory_region_add_subregion(sysmem, 0, ram);", "virtio_region_len = VAR_0 - ram_size;", "virtio_region_start = ram_size;", "VAR_7 = cpu_physical_memory_map(virtio_region_start,\n&virtio_region_len, true);", "memset(VAR_7, 0, virtio_region_len);", "cpu_physical_memory_unmap(VAR_7, virtio_region_len, 1,\nvirtio_region_len);", "storage_keys = g_malloc0(VAR_0 / TARGET_PAGE_SIZE);", "if (VAR_5 == NULL) {", "VAR_5 = \"host\";", "}", "ipi_states = g_malloc(sizeof(CPUState *) * smp_cpus);", "for (VAR_8 = 0; VAR_8 < smp_cpus; VAR_8++) {", "CPUState *tmp_env;", "tmp_env = cpu_init(VAR_5);", "if (!env) {", "env = tmp_env;", "}", "ipi_states[VAR_8] = tmp_env;", "tmp_env->halted = 1;", "tmp_env->exception_index = EXCP_HLT;", "tmp_env->storage_keys = storage_keys;", "}", "s390_add_running_cpu(env);", "if (VAR_2) {", "kernel_size = load_image(VAR_2, qemu_get_ram_ptr(0));", "if (lduw_be_phys(KERN_IMAGE_START) != 0x0dd0) {", "fprintf(stderr, \"Specified image is not an s390 boot image\\n\");", "exit(1);", "}", "env->psw.addr = KERN_IMAGE_START;", "env->psw.mask = 0x0000000180000000ULL;", "} else {", "ram_addr_t bios_size = 0;", "char *VAR_9;", "if (bios_name == NULL) {", "bios_name = ZIPL_FILENAME;", "}", "VAR_9 = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);", "bios_size = load_image(VAR_9, qemu_get_ram_ptr(ZIPL_LOAD_ADDR));", "g_free(VAR_9);", "if ((long)bios_size < 0) {", "hw_error(\"could not load bootloader '%s'\\n\", bios_name);", "}", "if (bios_size > 4096) {", "hw_error(\"stage1 bootloader is > 4k\\n\");", "}", "env->psw.addr = ZIPL_START;", "env->psw.mask = 0x0000000180000000ULL;", "}", "if (VAR_4) {", "initrd_offset = INITRD_START;", "while (kernel_size + 0x100000 > initrd_offset) {", "initrd_offset += 0x100000;", "}", "initrd_size = load_image(VAR_4, qemu_get_ram_ptr(initrd_offset));", "stq_be_phys(INITRD_PARM_START, initrd_offset);", "stq_be_phys(INITRD_PARM_SIZE, initrd_size);", "}", "if (VAR_3) {", "cpu_physical_memory_write(KERN_PARM_AREA, VAR_3,\nstrlen(VAR_3) + 1);", "}", "for(VAR_8 = 0; VAR_8 < nb_nics; VAR_8++) {", "NICInfo *nd = &nd_table[VAR_8];", "DeviceState *dev;", "if (!nd->model) {", "nd->model = g_strdup(\"virtio\");", "}", "if (strcmp(nd->model, \"virtio\")) {", "fprintf(stderr, \"S390 only supports VirtIO nics\\n\");", "exit(1);", "}", "dev = qdev_create((BusState *)s390_bus, \"virtio-net-s390\");", "qdev_set_nic_properties(dev, nd);", "qdev_init_nofail(dev);", "}", "for(VAR_8 = 0; VAR_8 < MAX_BLK_DEVS; VAR_8++) {", "DriveInfo *dinfo;", "DeviceState *dev;", "dinfo = drive_get(IF_IDE, 0, VAR_8);", "if (!dinfo) {", "continue;", "}", "dev = qdev_create((BusState *)s390_bus, \"virtio-blk-s390\");", "qdev_prop_set_drive_nofail(dev, \"drive\", dinfo->bdrv);", "qdev_init_nofail(dev);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 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, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9, 11, 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 57 ], [ 63 ], [ 69 ], [ 71 ], [ 73 ], [ 79 ], [ 81 ], [ 83, 85 ], [ 87 ], [ 89, 91 ], [ 97 ], [ 103 ], [ 105 ], [ 107 ], [ 111 ], [ 115 ], [ 117 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 143 ], [ 147 ], [ 149 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 177 ], [ 179 ], [ 181 ], [ 185 ], [ 187 ], [ 189 ], [ 193 ], [ 195 ], [ 197 ], [ 201 ], [ 203 ], [ 205 ], [ 209 ], [ 211 ], [ 213 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ], [ 225 ], [ 227 ], [ 231 ], [ 233 ], [ 235 ], [ 239 ], [ 241, 243 ], [ 245 ], [ 251 ], [ 253 ], [ 255 ], [ 259 ], [ 261 ], [ 263 ], [ 267 ], [ 269 ], [ 271 ], [ 273 ], [ 277 ], [ 279 ], [ 281 ], [ 283 ], [ 289 ], [ 291 ], [ 293 ], [ 297 ], [ 299 ], [ 301 ], [ 303 ], [ 307 ], [ 309 ], [ 311 ], [ 313 ], [ 315 ] ]
7,515
static int do_break(CPUMIPSState *env, target_siginfo_t *info, unsigned int code) { int ret = -1; switch (code) { case BRK_OVERFLOW: case BRK_DIVZERO: info->si_signo = TARGET_SIGFPE; info->si_code = (code == BRK_OVERFLOW) ? FPE_INTOVF : FPE_INTDIV; break; default: break; } return ret; }
true
qemu
b51910baf227f0fd64abfa7ad6d8e00150a18194
static int do_break(CPUMIPSState *env, target_siginfo_t *info, unsigned int code) { int ret = -1; switch (code) { case BRK_OVERFLOW: case BRK_DIVZERO: info->si_signo = TARGET_SIGFPE; info->si_code = (code == BRK_OVERFLOW) ? FPE_INTOVF : FPE_INTDIV; break; default: break; } return ret; }
{ "code": [], "line_no": [] }
static int FUNC_0(CPUMIPSState *VAR_0, target_siginfo_t *VAR_1, unsigned int VAR_2) { int VAR_3 = -1; switch (VAR_2) { case BRK_OVERFLOW: case BRK_DIVZERO: VAR_1->si_signo = TARGET_SIGFPE; VAR_1->si_code = (VAR_2 == BRK_OVERFLOW) ? FPE_INTOVF : FPE_INTDIV; break; default: break; } return VAR_3; }
[ "static int FUNC_0(CPUMIPSState *VAR_0, target_siginfo_t *VAR_1,\nunsigned int VAR_2)\n{", "int VAR_3 = -1;", "switch (VAR_2) {", "case BRK_OVERFLOW:\ncase BRK_DIVZERO:\nVAR_1->si_signo = TARGET_SIGFPE;", "VAR_1->si_code = (VAR_2 == BRK_OVERFLOW) ? FPE_INTOVF : FPE_INTDIV;", "break;", "default:\nbreak;", "}", "return VAR_3;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 13, 15, 17 ], [ 20 ], [ 24 ], [ 26, 32 ], [ 34 ], [ 38 ], [ 40 ] ]
7,516
static uint16_t qpci_pc_config_readw(QPCIBus *bus, int devfn, uint8_t offset) { outl(0xcf8, (1 << 31) | (devfn << 8) | offset); return inw(0xcfc); }
true
qemu
a879125b47c3ae554c01824f996a64a45a86556e
static uint16_t qpci_pc_config_readw(QPCIBus *bus, int devfn, uint8_t offset) { outl(0xcf8, (1 << 31) | (devfn << 8) | offset); return inw(0xcfc); }
{ "code": [ " outl(0xcf8, (1 << 31) | (devfn << 8) | offset);", " outl(0xcf8, (1 << 31) | (devfn << 8) | offset);", " outl(0xcf8, (1 << 31) | (devfn << 8) | offset);", " outl(0xcf8, (1 << 31) | (devfn << 8) | offset);", " outl(0xcf8, (1 << 31) | (devfn << 8) | offset);", " outl(0xcf8, (1 << 31) | (devfn << 8) | offset);" ], "line_no": [ 5, 5, 5, 5, 5, 5 ] }
static uint16_t FUNC_0(QPCIBus *bus, int devfn, uint8_t offset) { outl(0xcf8, (1 << 31) | (devfn << 8) | offset); return inw(0xcfc); }
[ "static uint16_t FUNC_0(QPCIBus *bus, int devfn, uint8_t offset)\n{", "outl(0xcf8, (1 << 31) | (devfn << 8) | offset);", "return inw(0xcfc);", "}" ]
[ 0, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ] ]
7,517
int kvm_arch_put_registers(CPUState *env, int level) { int ret; assert(cpu_is_stopped(env) || qemu_cpu_is_self(env)); ret = kvm_getput_regs(env, 1); ret = kvm_put_xsave(env); ret = kvm_put_xcrs(env); ret = kvm_put_sregs(env); ret = kvm_put_msrs(env, level); if (level >= KVM_PUT_RESET_STATE) { ret = kvm_put_mp_state(env); ret = kvm_put_vcpu_events(env, level); ret = kvm_put_debugregs(env); /* must be last */ ret = kvm_guest_debug_workarounds(env); return 0;
true
qemu
ab443475c9235822e329e1bfde89be6c71e2c21e
int kvm_arch_put_registers(CPUState *env, int level) { int ret; assert(cpu_is_stopped(env) || qemu_cpu_is_self(env)); ret = kvm_getput_regs(env, 1); ret = kvm_put_xsave(env); ret = kvm_put_xcrs(env); ret = kvm_put_sregs(env); ret = kvm_put_msrs(env, level); if (level >= KVM_PUT_RESET_STATE) { ret = kvm_put_mp_state(env); ret = kvm_put_vcpu_events(env, level); ret = kvm_put_debugregs(env); ret = kvm_guest_debug_workarounds(env); return 0;
{ "code": [], "line_no": [] }
int FUNC_0(CPUState *VAR_0, int VAR_1) { int VAR_2; assert(cpu_is_stopped(VAR_0) || qemu_cpu_is_self(VAR_0)); VAR_2 = kvm_getput_regs(VAR_0, 1); VAR_2 = kvm_put_xsave(VAR_0); VAR_2 = kvm_put_xcrs(VAR_0); VAR_2 = kvm_put_sregs(VAR_0); VAR_2 = kvm_put_msrs(VAR_0, VAR_1); if (VAR_1 >= KVM_PUT_RESET_STATE) { VAR_2 = kvm_put_mp_state(VAR_0); VAR_2 = kvm_put_vcpu_events(VAR_0, VAR_1); VAR_2 = kvm_put_debugregs(VAR_0); VAR_2 = kvm_guest_debug_workarounds(VAR_0); return 0;
[ "int FUNC_0(CPUState *VAR_0, int VAR_1)\n{", "int VAR_2;", "assert(cpu_is_stopped(VAR_0) || qemu_cpu_is_self(VAR_0));", "VAR_2 = kvm_getput_regs(VAR_0, 1);", "VAR_2 = kvm_put_xsave(VAR_0);", "VAR_2 = kvm_put_xcrs(VAR_0);", "VAR_2 = kvm_put_sregs(VAR_0);", "VAR_2 = kvm_put_msrs(VAR_0, VAR_1);", "if (VAR_1 >= KVM_PUT_RESET_STATE) {", "VAR_2 = kvm_put_mp_state(VAR_0);", "VAR_2 = kvm_put_vcpu_events(VAR_0, VAR_1);", "VAR_2 = kvm_put_debugregs(VAR_0);", "VAR_2 = kvm_guest_debug_workarounds(VAR_0);", "return 0;" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 13 ], [ 18 ], [ 23 ], [ 28 ], [ 38 ], [ 43 ], [ 45 ], [ 51 ], [ 56 ], [ 63 ], [ 68 ] ]
7,518
static QObject *get_stats_qobject(VirtIOBalloon *dev) { QDict *dict = qdict_new(); uint32_t actual = ram_size - (dev->actual << VIRTIO_BALLOON_PFN_SHIFT); stat_put(dict, "actual", actual); stat_put(dict, "mem_swapped_in", dev->stats[VIRTIO_BALLOON_S_SWAP_IN]); stat_put(dict, "mem_swapped_out", dev->stats[VIRTIO_BALLOON_S_SWAP_OUT]); stat_put(dict, "major_page_faults", dev->stats[VIRTIO_BALLOON_S_MAJFLT]); stat_put(dict, "minor_page_faults", dev->stats[VIRTIO_BALLOON_S_MINFLT]); stat_put(dict, "free_mem", dev->stats[VIRTIO_BALLOON_S_MEMFREE]); stat_put(dict, "total_mem", dev->stats[VIRTIO_BALLOON_S_MEMTOT]); return QOBJECT(dict); }
true
qemu
bd12ff9df78b0d04059a35c4a9d0a9337eb4999e
static QObject *get_stats_qobject(VirtIOBalloon *dev) { QDict *dict = qdict_new(); uint32_t actual = ram_size - (dev->actual << VIRTIO_BALLOON_PFN_SHIFT); stat_put(dict, "actual", actual); stat_put(dict, "mem_swapped_in", dev->stats[VIRTIO_BALLOON_S_SWAP_IN]); stat_put(dict, "mem_swapped_out", dev->stats[VIRTIO_BALLOON_S_SWAP_OUT]); stat_put(dict, "major_page_faults", dev->stats[VIRTIO_BALLOON_S_MAJFLT]); stat_put(dict, "minor_page_faults", dev->stats[VIRTIO_BALLOON_S_MINFLT]); stat_put(dict, "free_mem", dev->stats[VIRTIO_BALLOON_S_MEMFREE]); stat_put(dict, "total_mem", dev->stats[VIRTIO_BALLOON_S_MEMTOT]); return QOBJECT(dict); }
{ "code": [ " uint32_t actual = ram_size - (dev->actual << VIRTIO_BALLOON_PFN_SHIFT);" ], "line_no": [ 7 ] }
static QObject *FUNC_0(VirtIOBalloon *dev) { QDict *dict = qdict_new(); uint32_t actual = ram_size - (dev->actual << VIRTIO_BALLOON_PFN_SHIFT); stat_put(dict, "actual", actual); stat_put(dict, "mem_swapped_in", dev->stats[VIRTIO_BALLOON_S_SWAP_IN]); stat_put(dict, "mem_swapped_out", dev->stats[VIRTIO_BALLOON_S_SWAP_OUT]); stat_put(dict, "major_page_faults", dev->stats[VIRTIO_BALLOON_S_MAJFLT]); stat_put(dict, "minor_page_faults", dev->stats[VIRTIO_BALLOON_S_MINFLT]); stat_put(dict, "free_mem", dev->stats[VIRTIO_BALLOON_S_MEMFREE]); stat_put(dict, "total_mem", dev->stats[VIRTIO_BALLOON_S_MEMTOT]); return QOBJECT(dict); }
[ "static QObject *FUNC_0(VirtIOBalloon *dev)\n{", "QDict *dict = qdict_new();", "uint32_t actual = ram_size - (dev->actual << VIRTIO_BALLOON_PFN_SHIFT);", "stat_put(dict, \"actual\", actual);", "stat_put(dict, \"mem_swapped_in\", dev->stats[VIRTIO_BALLOON_S_SWAP_IN]);", "stat_put(dict, \"mem_swapped_out\", dev->stats[VIRTIO_BALLOON_S_SWAP_OUT]);", "stat_put(dict, \"major_page_faults\", dev->stats[VIRTIO_BALLOON_S_MAJFLT]);", "stat_put(dict, \"minor_page_faults\", dev->stats[VIRTIO_BALLOON_S_MINFLT]);", "stat_put(dict, \"free_mem\", dev->stats[VIRTIO_BALLOON_S_MEMFREE]);", "stat_put(dict, \"total_mem\", dev->stats[VIRTIO_BALLOON_S_MEMTOT]);", "return QOBJECT(dict);", "}" ]
[ 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ] ]
7,519
static int twolame_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr) { TWOLAMEContext *s = avctx->priv_data; int ret; if ((ret = ff_alloc_packet(avpkt, MPA_MAX_CODED_FRAME_SIZE)) < 0) return ret; if (frame) { switch (avctx->sample_fmt) { case AV_SAMPLE_FMT_FLT: ret = twolame_encode_buffer_float32_interleaved(s->glopts, (const float *)frame->data[0], frame->nb_samples, avpkt->data, avpkt->size); break; case AV_SAMPLE_FMT_FLTP: ret = twolame_encode_buffer_float32(s->glopts, (const float *)frame->data[0], (const float *)frame->data[1], frame->nb_samples, avpkt->data, avpkt->size); break; case AV_SAMPLE_FMT_S16: ret = twolame_encode_buffer_interleaved(s->glopts, (const short int *)frame->data[0], frame->nb_samples, avpkt->data, avpkt->size); break; case AV_SAMPLE_FMT_S16P: ret = twolame_encode_buffer(s->glopts, (const short int *)frame->data[0], (const short int *)frame->data[1], frame->nb_samples, avpkt->data, avpkt->size); break; default: av_log(avctx, AV_LOG_ERROR, "Unsupported sample format %d.\n", avctx->sample_fmt); return AVERROR_BUG; } } else { ret = twolame_encode_flush(s->glopts, avpkt->data, avpkt->size); } if (!ret) // no bytes written return 0; if (ret < 0) // twolame error return AVERROR_UNKNOWN; avpkt->duration = ff_samples_to_time_base(avctx, frame->nb_samples); if (frame) { if (frame->pts != AV_NOPTS_VALUE) avpkt->pts = frame->pts - ff_samples_to_time_base(avctx, avctx->initial_padding); } else { avpkt->pts = s->next_pts; } // this is for setting pts for flushed packet(s). if (avpkt->pts != AV_NOPTS_VALUE) s->next_pts = avpkt->pts + avpkt->duration; av_shrink_packet(avpkt, ret); *got_packet_ptr = 1; return 0; }
true
FFmpeg
a42d5c861fea8d18d997c6ba3f4a1d8aa95a288b
static int twolame_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr) { TWOLAMEContext *s = avctx->priv_data; int ret; if ((ret = ff_alloc_packet(avpkt, MPA_MAX_CODED_FRAME_SIZE)) < 0) return ret; if (frame) { switch (avctx->sample_fmt) { case AV_SAMPLE_FMT_FLT: ret = twolame_encode_buffer_float32_interleaved(s->glopts, (const float *)frame->data[0], frame->nb_samples, avpkt->data, avpkt->size); break; case AV_SAMPLE_FMT_FLTP: ret = twolame_encode_buffer_float32(s->glopts, (const float *)frame->data[0], (const float *)frame->data[1], frame->nb_samples, avpkt->data, avpkt->size); break; case AV_SAMPLE_FMT_S16: ret = twolame_encode_buffer_interleaved(s->glopts, (const short int *)frame->data[0], frame->nb_samples, avpkt->data, avpkt->size); break; case AV_SAMPLE_FMT_S16P: ret = twolame_encode_buffer(s->glopts, (const short int *)frame->data[0], (const short int *)frame->data[1], frame->nb_samples, avpkt->data, avpkt->size); break; default: av_log(avctx, AV_LOG_ERROR, "Unsupported sample format %d.\n", avctx->sample_fmt); return AVERROR_BUG; } } else { ret = twolame_encode_flush(s->glopts, avpkt->data, avpkt->size); } if (!ret) return 0; if (ret < 0) return AVERROR_UNKNOWN; avpkt->duration = ff_samples_to_time_base(avctx, frame->nb_samples); if (frame) { if (frame->pts != AV_NOPTS_VALUE) avpkt->pts = frame->pts - ff_samples_to_time_base(avctx, avctx->initial_padding); } else { avpkt->pts = s->next_pts; } if (avpkt->pts != AV_NOPTS_VALUE) s->next_pts = avpkt->pts + avpkt->duration; av_shrink_packet(avpkt, ret); *got_packet_ptr = 1; return 0; }
{ "code": [ " avpkt->duration = ff_samples_to_time_base(avctx, frame->nb_samples);" ], "line_no": [ 105 ] }
static int FUNC_0(AVCodecContext *VAR_0, AVPacket *VAR_1, const AVFrame *VAR_2, int *VAR_3) { TWOLAMEContext *s = VAR_0->priv_data; int VAR_4; if ((VAR_4 = ff_alloc_packet(VAR_1, MPA_MAX_CODED_FRAME_SIZE)) < 0) return VAR_4; if (VAR_2) { switch (VAR_0->sample_fmt) { case AV_SAMPLE_FMT_FLT: VAR_4 = twolame_encode_buffer_float32_interleaved(s->glopts, (const float *)VAR_2->data[0], VAR_2->nb_samples, VAR_1->data, VAR_1->size); break; case AV_SAMPLE_FMT_FLTP: VAR_4 = twolame_encode_buffer_float32(s->glopts, (const float *)VAR_2->data[0], (const float *)VAR_2->data[1], VAR_2->nb_samples, VAR_1->data, VAR_1->size); break; case AV_SAMPLE_FMT_S16: VAR_4 = twolame_encode_buffer_interleaved(s->glopts, (const short int *)VAR_2->data[0], VAR_2->nb_samples, VAR_1->data, VAR_1->size); break; case AV_SAMPLE_FMT_S16P: VAR_4 = twolame_encode_buffer(s->glopts, (const short int *)VAR_2->data[0], (const short int *)VAR_2->data[1], VAR_2->nb_samples, VAR_1->data, VAR_1->size); break; default: av_log(VAR_0, AV_LOG_ERROR, "Unsupported sample format %d.\n", VAR_0->sample_fmt); return AVERROR_BUG; } } else { VAR_4 = twolame_encode_flush(s->glopts, VAR_1->data, VAR_1->size); } if (!VAR_4) return 0; if (VAR_4 < 0) return AVERROR_UNKNOWN; VAR_1->duration = ff_samples_to_time_base(VAR_0, VAR_2->nb_samples); if (VAR_2) { if (VAR_2->pts != AV_NOPTS_VALUE) VAR_1->pts = VAR_2->pts - ff_samples_to_time_base(VAR_0, VAR_0->initial_padding); } else { VAR_1->pts = s->next_pts; } if (VAR_1->pts != AV_NOPTS_VALUE) s->next_pts = VAR_1->pts + VAR_1->duration; av_shrink_packet(VAR_1, VAR_4); *VAR_3 = 1; return 0; }
[ "static int FUNC_0(AVCodecContext *VAR_0, AVPacket *VAR_1,\nconst AVFrame *VAR_2, int *VAR_3)\n{", "TWOLAMEContext *s = VAR_0->priv_data;", "int VAR_4;", "if ((VAR_4 = ff_alloc_packet(VAR_1, MPA_MAX_CODED_FRAME_SIZE)) < 0)\nreturn VAR_4;", "if (VAR_2) {", "switch (VAR_0->sample_fmt) {", "case AV_SAMPLE_FMT_FLT:\nVAR_4 = twolame_encode_buffer_float32_interleaved(s->glopts,\n(const float *)VAR_2->data[0],\nVAR_2->nb_samples,\nVAR_1->data,\nVAR_1->size);", "break;", "case AV_SAMPLE_FMT_FLTP:\nVAR_4 = twolame_encode_buffer_float32(s->glopts,\n(const float *)VAR_2->data[0],\n(const float *)VAR_2->data[1],\nVAR_2->nb_samples,\nVAR_1->data, VAR_1->size);", "break;", "case AV_SAMPLE_FMT_S16:\nVAR_4 = twolame_encode_buffer_interleaved(s->glopts,\n(const short int *)VAR_2->data[0],\nVAR_2->nb_samples,\nVAR_1->data, VAR_1->size);", "break;", "case AV_SAMPLE_FMT_S16P:\nVAR_4 = twolame_encode_buffer(s->glopts,\n(const short int *)VAR_2->data[0],\n(const short int *)VAR_2->data[1],\nVAR_2->nb_samples,\nVAR_1->data, VAR_1->size);", "break;", "default:\nav_log(VAR_0, AV_LOG_ERROR,\n\"Unsupported sample format %d.\\n\", VAR_0->sample_fmt);", "return AVERROR_BUG;", "}", "} else {", "VAR_4 = twolame_encode_flush(s->glopts, VAR_1->data, VAR_1->size);", "}", "if (!VAR_4)\nreturn 0;", "if (VAR_4 < 0)\nreturn AVERROR_UNKNOWN;", "VAR_1->duration = ff_samples_to_time_base(VAR_0, VAR_2->nb_samples);", "if (VAR_2) {", "if (VAR_2->pts != AV_NOPTS_VALUE)\nVAR_1->pts = VAR_2->pts - ff_samples_to_time_base(VAR_0, VAR_0->initial_padding);", "} else {", "VAR_1->pts = s->next_pts;", "}", "if (VAR_1->pts != AV_NOPTS_VALUE)\ns->next_pts = VAR_1->pts + VAR_1->duration;", "av_shrink_packet(VAR_1, VAR_4);", "*VAR_3 = 1;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13, 15 ], [ 19 ], [ 21 ], [ 23, 25, 27, 29, 31, 33 ], [ 35 ], [ 37, 39, 41, 43, 45, 47 ], [ 49 ], [ 51, 53, 55, 57, 59 ], [ 61 ], [ 63, 65, 67, 69, 71, 73 ], [ 75 ], [ 77, 79, 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 95, 97 ], [ 99, 101 ], [ 105 ], [ 107 ], [ 109, 111 ], [ 113 ], [ 115 ], [ 117 ], [ 121, 123 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ] ]
7,520
yuv2rgb_full_X_c_template(SwsContext *c, const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize, const int16_t *chrFilter, const int16_t **chrUSrc, const int16_t **chrVSrc, int chrFilterSize, const int16_t **alpSrc, uint8_t *dest, int dstW, int y, enum AVPixelFormat target, int hasAlpha) { int i; int step = (target == AV_PIX_FMT_RGB24 || target == AV_PIX_FMT_BGR24) ? 3 : 4; int err[4] = {0}; if( target == AV_PIX_FMT_BGR4_BYTE || target == AV_PIX_FMT_RGB4_BYTE || target == AV_PIX_FMT_BGR8 || target == AV_PIX_FMT_RGB8) step = 1; for (i = 0; i < dstW; i++) { int j; int Y = 1<<9; int U = (1<<9)-(128 << 19); int V = (1<<9)-(128 << 19); int A; for (j = 0; j < lumFilterSize; j++) { Y += lumSrc[j][i] * lumFilter[j]; } for (j = 0; j < chrFilterSize; j++) { U += chrUSrc[j][i] * chrFilter[j]; V += chrVSrc[j][i] * chrFilter[j]; } Y >>= 10; U >>= 10; V >>= 10; if (hasAlpha) { A = 1 << 18; for (j = 0; j < lumFilterSize; j++) { A += alpSrc[j][i] * lumFilter[j]; } A >>= 19; if (A & 0x100) A = av_clip_uint8(A); } yuv2rgb_write_full(c, dest, i, Y, A, U, V, y, target, hasAlpha, err); dest += step; } c->dither_error[0][i] = err[0]; c->dither_error[1][i] = err[1]; c->dither_error[2][i] = err[2]; }
true
FFmpeg
8ef453ff830b40f635b94099d1debad3d809847f
yuv2rgb_full_X_c_template(SwsContext *c, const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize, const int16_t *chrFilter, const int16_t **chrUSrc, const int16_t **chrVSrc, int chrFilterSize, const int16_t **alpSrc, uint8_t *dest, int dstW, int y, enum AVPixelFormat target, int hasAlpha) { int i; int step = (target == AV_PIX_FMT_RGB24 || target == AV_PIX_FMT_BGR24) ? 3 : 4; int err[4] = {0}; if( target == AV_PIX_FMT_BGR4_BYTE || target == AV_PIX_FMT_RGB4_BYTE || target == AV_PIX_FMT_BGR8 || target == AV_PIX_FMT_RGB8) step = 1; for (i = 0; i < dstW; i++) { int j; int Y = 1<<9; int U = (1<<9)-(128 << 19); int V = (1<<9)-(128 << 19); int A; for (j = 0; j < lumFilterSize; j++) { Y += lumSrc[j][i] * lumFilter[j]; } for (j = 0; j < chrFilterSize; j++) { U += chrUSrc[j][i] * chrFilter[j]; V += chrVSrc[j][i] * chrFilter[j]; } Y >>= 10; U >>= 10; V >>= 10; if (hasAlpha) { A = 1 << 18; for (j = 0; j < lumFilterSize; j++) { A += alpSrc[j][i] * lumFilter[j]; } A >>= 19; if (A & 0x100) A = av_clip_uint8(A); } yuv2rgb_write_full(c, dest, i, Y, A, U, V, y, target, hasAlpha, err); dest += step; } c->dither_error[0][i] = err[0]; c->dither_error[1][i] = err[1]; c->dither_error[2][i] = err[2]; }
{ "code": [ " int A;", " int A;" ], "line_no": [ 41, 41 ] }
FUNC_0(SwsContext *VAR_0, const int16_t *VAR_1, const int16_t **VAR_2, int VAR_3, const int16_t *VAR_4, const int16_t **VAR_5, const int16_t **VAR_6, int VAR_7, const int16_t **VAR_8, uint8_t *VAR_9, int VAR_10, int VAR_11, enum AVPixelFormat VAR_12, int VAR_13) { int VAR_14; int VAR_15 = (VAR_12 == AV_PIX_FMT_RGB24 || VAR_12 == AV_PIX_FMT_BGR24) ? 3 : 4; int VAR_16[4] = {0}; if( VAR_12 == AV_PIX_FMT_BGR4_BYTE || VAR_12 == AV_PIX_FMT_RGB4_BYTE || VAR_12 == AV_PIX_FMT_BGR8 || VAR_12 == AV_PIX_FMT_RGB8) VAR_15 = 1; for (VAR_14 = 0; VAR_14 < VAR_10; VAR_14++) { int VAR_17; int VAR_18 = 1<<9; int VAR_19 = (1<<9)-(128 << 19); int VAR_20 = (1<<9)-(128 << 19); int VAR_21; for (VAR_17 = 0; VAR_17 < VAR_3; VAR_17++) { VAR_18 += VAR_2[VAR_17][VAR_14] * VAR_1[VAR_17]; } for (VAR_17 = 0; VAR_17 < VAR_7; VAR_17++) { VAR_19 += VAR_5[VAR_17][VAR_14] * VAR_4[VAR_17]; VAR_20 += VAR_6[VAR_17][VAR_14] * VAR_4[VAR_17]; } VAR_18 >>= 10; VAR_19 >>= 10; VAR_20 >>= 10; if (VAR_13) { VAR_21 = 1 << 18; for (VAR_17 = 0; VAR_17 < VAR_3; VAR_17++) { VAR_21 += VAR_8[VAR_17][VAR_14] * VAR_1[VAR_17]; } VAR_21 >>= 19; if (VAR_21 & 0x100) VAR_21 = av_clip_uint8(VAR_21); } yuv2rgb_write_full(VAR_0, VAR_9, VAR_14, VAR_18, VAR_21, VAR_19, VAR_20, VAR_11, VAR_12, VAR_13, VAR_16); VAR_9 += VAR_15; } VAR_0->dither_error[0][VAR_14] = VAR_16[0]; VAR_0->dither_error[1][VAR_14] = VAR_16[1]; VAR_0->dither_error[2][VAR_14] = VAR_16[2]; }
[ "FUNC_0(SwsContext *VAR_0, const int16_t *VAR_1,\nconst int16_t **VAR_2, int VAR_3,\nconst int16_t *VAR_4, const int16_t **VAR_5,\nconst int16_t **VAR_6, int VAR_7,\nconst int16_t **VAR_8, uint8_t *VAR_9,\nint VAR_10, int VAR_11, enum AVPixelFormat VAR_12, int VAR_13)\n{", "int VAR_14;", "int VAR_15 = (VAR_12 == AV_PIX_FMT_RGB24 || VAR_12 == AV_PIX_FMT_BGR24) ? 3 : 4;", "int VAR_16[4] = {0};", "if( VAR_12 == AV_PIX_FMT_BGR4_BYTE || VAR_12 == AV_PIX_FMT_RGB4_BYTE\n|| VAR_12 == AV_PIX_FMT_BGR8 || VAR_12 == AV_PIX_FMT_RGB8)\nVAR_15 = 1;", "for (VAR_14 = 0; VAR_14 < VAR_10; VAR_14++) {", "int VAR_17;", "int VAR_18 = 1<<9;", "int VAR_19 = (1<<9)-(128 << 19);", "int VAR_20 = (1<<9)-(128 << 19);", "int VAR_21;", "for (VAR_17 = 0; VAR_17 < VAR_3; VAR_17++) {", "VAR_18 += VAR_2[VAR_17][VAR_14] * VAR_1[VAR_17];", "}", "for (VAR_17 = 0; VAR_17 < VAR_7; VAR_17++) {", "VAR_19 += VAR_5[VAR_17][VAR_14] * VAR_4[VAR_17];", "VAR_20 += VAR_6[VAR_17][VAR_14] * VAR_4[VAR_17];", "}", "VAR_18 >>= 10;", "VAR_19 >>= 10;", "VAR_20 >>= 10;", "if (VAR_13) {", "VAR_21 = 1 << 18;", "for (VAR_17 = 0; VAR_17 < VAR_3; VAR_17++) {", "VAR_21 += VAR_8[VAR_17][VAR_14] * VAR_1[VAR_17];", "}", "VAR_21 >>= 19;", "if (VAR_21 & 0x100)\nVAR_21 = av_clip_uint8(VAR_21);", "}", "yuv2rgb_write_full(VAR_0, VAR_9, VAR_14, VAR_18, VAR_21, VAR_19, VAR_20, VAR_11, VAR_12, VAR_13, VAR_16);", "VAR_9 += VAR_15;", "}", "VAR_0->dither_error[0][VAR_14] = VAR_16[0];", "VAR_0->dither_error[1][VAR_14] = VAR_16[1];", "VAR_0->dither_error[2][VAR_14] = VAR_16[2];", "}" ]
[ 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 ]
[ [ 1, 3, 5, 7, 9, 11, 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23, 25, 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77, 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ] ]
7,523
int ff_h263_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; MpegEncContext *s = avctx->priv_data; int ret; AVFrame *pict = data; s->flags = avctx->flags; s->flags2 = avctx->flags2; /* no supplementary picture */ if (buf_size == 0) { /* special case for last picture */ if (s->low_delay == 0 && s->next_picture_ptr) { if ((ret = av_frame_ref(pict, &s->next_picture_ptr->f)) < 0) return ret; s->next_picture_ptr = NULL; *got_frame = 1; } return 0; } if (s->flags & CODEC_FLAG_TRUNCATED) { int next; if (CONFIG_MPEG4_DECODER && s->codec_id == AV_CODEC_ID_MPEG4) { next = ff_mpeg4_find_frame_end(&s->parse_context, buf, buf_size); } else if (CONFIG_H263_DECODER && s->codec_id == AV_CODEC_ID_H263) { next = ff_h263_find_frame_end(&s->parse_context, buf, buf_size); } else { av_log(s->avctx, AV_LOG_ERROR, "this codec does not support truncated bitstreams\n"); return AVERROR(ENOSYS); } if (ff_combine_frame(&s->parse_context, next, (const uint8_t **)&buf, &buf_size) < 0) return buf_size; } if (s->bitstream_buffer_size && (s->divx_packed || buf_size < 20)) // divx 5.01+/xvid frame reorder ret = init_get_bits8(&s->gb, s->bitstream_buffer, s->bitstream_buffer_size); else ret = init_get_bits8(&s->gb, buf, buf_size); s->bitstream_buffer_size = 0; if (ret < 0) return ret; if (!s->context_initialized) // we need the idct permutaton for reading a custom matrix if ((ret = ff_MPV_common_init(s)) < 0) return ret; /* We need to set current_picture_ptr before reading the header, * otherwise we cannot store anyting in there */ if (s->current_picture_ptr == NULL || s->current_picture_ptr->f.data[0]) { int i = ff_find_unused_picture(s, 0); if (i < 0) return i; s->current_picture_ptr = &s->picture[i]; } /* let's go :-) */ if (CONFIG_WMV2_DECODER && s->msmpeg4_version == 5) { ret = ff_wmv2_decode_picture_header(s); } else if (CONFIG_MSMPEG4_DECODER && s->msmpeg4_version) { ret = ff_msmpeg4_decode_picture_header(s); } else if (CONFIG_MPEG4_DECODER && avctx->codec_id == AV_CODEC_ID_MPEG4) { if (s->avctx->extradata_size && s->picture_number == 0) { GetBitContext gb; ret = init_get_bits8(&gb, s->avctx->extradata, s->avctx->extradata_size); if (ret < 0) return ret; ff_mpeg4_decode_picture_header(avctx->priv_data, &gb); } ret = ff_mpeg4_decode_picture_header(avctx->priv_data, &s->gb); } else if (CONFIG_H263I_DECODER && s->codec_id == AV_CODEC_ID_H263I) { ret = ff_intel_h263_decode_picture_header(s); } else if (CONFIG_FLV_DECODER && s->h263_flv) { ret = ff_flv_decode_picture_header(s); } else { ret = ff_h263_decode_picture_header(s); } if (ret == FRAME_SKIPPED) return get_consumed_bytes(s, buf_size); /* skip if the header was thrashed */ if (ret < 0) { av_log(s->avctx, AV_LOG_ERROR, "header damaged\n"); return ret; } avctx->has_b_frames = !s->low_delay; #define SET_QPEL_FUNC(postfix1, postfix2) \ s->dsp.put_ ## postfix1 = ff_put_ ## postfix2; \ s->dsp.put_no_rnd_ ## postfix1 = ff_put_no_rnd_ ## postfix2; \ s->dsp.avg_ ## postfix1 = ff_avg_ ## postfix2; if (s->workaround_bugs & FF_BUG_STD_QPEL) { SET_QPEL_FUNC(qpel_pixels_tab[0][5], qpel16_mc11_old_c) SET_QPEL_FUNC(qpel_pixels_tab[0][7], qpel16_mc31_old_c) SET_QPEL_FUNC(qpel_pixels_tab[0][9], qpel16_mc12_old_c) SET_QPEL_FUNC(qpel_pixels_tab[0][11], qpel16_mc32_old_c) SET_QPEL_FUNC(qpel_pixels_tab[0][13], qpel16_mc13_old_c) SET_QPEL_FUNC(qpel_pixels_tab[0][15], qpel16_mc33_old_c) SET_QPEL_FUNC(qpel_pixels_tab[1][5], qpel8_mc11_old_c) SET_QPEL_FUNC(qpel_pixels_tab[1][7], qpel8_mc31_old_c) SET_QPEL_FUNC(qpel_pixels_tab[1][9], qpel8_mc12_old_c) SET_QPEL_FUNC(qpel_pixels_tab[1][11], qpel8_mc32_old_c) SET_QPEL_FUNC(qpel_pixels_tab[1][13], qpel8_mc13_old_c) SET_QPEL_FUNC(qpel_pixels_tab[1][15], qpel8_mc33_old_c) } /* After H263 & mpeg4 header decode we have the height, width, * and other parameters. So then we could init the picture. * FIXME: By the way H263 decoder is evolving it should have * an H263EncContext */ if (s->width != avctx->coded_width || s->height != avctx->coded_height || s->context_reinit) { /* H.263 could change picture size any time */ s->context_reinit = 0; ret = ff_set_dimensions(avctx, s->width, s->height); if (ret < 0) return ret; if ((ret = ff_MPV_common_frame_size_change(s))) return ret; } if (s->codec_id == AV_CODEC_ID_H263 || s->codec_id == AV_CODEC_ID_H263P || s->codec_id == AV_CODEC_ID_H263I) s->gob_index = ff_h263_get_gob_height(s); // for skipping the frame s->current_picture.f.pict_type = s->pict_type; s->current_picture.f.key_frame = s->pict_type == AV_PICTURE_TYPE_I; /* skip B-frames if we don't have reference frames */ if (s->last_picture_ptr == NULL && (s->pict_type == AV_PICTURE_TYPE_B || s->droppable)) return get_consumed_bytes(s, buf_size); if ((avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type == AV_PICTURE_TYPE_B) || (avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type != AV_PICTURE_TYPE_I) || avctx->skip_frame >= AVDISCARD_ALL) return get_consumed_bytes(s, buf_size); if (s->next_p_frame_damaged) { if (s->pict_type == AV_PICTURE_TYPE_B) return get_consumed_bytes(s, buf_size); else s->next_p_frame_damaged = 0; } if ((!s->no_rounding) || s->pict_type == AV_PICTURE_TYPE_B) { s->me.qpel_put = s->dsp.put_qpel_pixels_tab; s->me.qpel_avg = s->dsp.avg_qpel_pixels_tab; } else { s->me.qpel_put = s->dsp.put_no_rnd_qpel_pixels_tab; s->me.qpel_avg = s->dsp.avg_qpel_pixels_tab; } if ((ret = ff_MPV_frame_start(s, avctx)) < 0) return ret; if (!s->divx_packed && !avctx->hwaccel) ff_thread_finish_setup(avctx); if (avctx->hwaccel) { ret = avctx->hwaccel->start_frame(avctx, s->gb.buffer, s->gb.buffer_end - s->gb.buffer); if (ret < 0 ) return ret; } ff_mpeg_er_frame_start(s); /* the second part of the wmv2 header contains the MB skip bits which * are stored in current_picture->mb_type which is not available before * ff_MPV_frame_start() */ if (CONFIG_WMV2_DECODER && s->msmpeg4_version == 5) { ret = ff_wmv2_decode_secondary_picture_header(s); if (ret < 0) return ret; if (ret == 1) goto intrax8_decoded; } /* decode each macroblock */ s->mb_x = 0; s->mb_y = 0; ret = decode_slice(s); while (s->mb_y < s->mb_height) { if (s->msmpeg4_version) { if (s->slice_height == 0 || s->mb_x != 0 || (s->mb_y % s->slice_height) != 0 || get_bits_left(&s->gb) < 0) break; } else { int prev_x = s->mb_x, prev_y = s->mb_y; if (ff_h263_resync(s) < 0) break; if (prev_y * s->mb_width + prev_x < s->mb_y * s->mb_width + s->mb_x) s->er.error_occurred = 1; } if (s->msmpeg4_version < 4 && s->h263_pred) ff_mpeg4_clean_buffers(s); if (decode_slice(s) < 0) ret = AVERROR_INVALIDDATA; } if (s->msmpeg4_version && s->msmpeg4_version < 4 && s->pict_type == AV_PICTURE_TYPE_I) if (!CONFIG_MSMPEG4_DECODER || ff_msmpeg4_decode_ext_header(s, buf_size) < 0) s->er.error_status_table[s->mb_num - 1] = ER_MB_ERROR; assert(s->bitstream_buffer_size == 0); if (CONFIG_MPEG4_DECODER && avctx->codec_id == AV_CODEC_ID_MPEG4) ff_mpeg4_frame_end(avctx, buf, buf_size); intrax8_decoded: ff_er_frame_end(&s->er); if (avctx->hwaccel) { ret = avctx->hwaccel->end_frame(avctx); if (ret < 0) return ret; } ff_MPV_frame_end(s); if (!s->divx_packed && avctx->hwaccel) ff_thread_finish_setup(avctx); assert(s->current_picture.f.pict_type == s->current_picture_ptr->f.pict_type); assert(s->current_picture.f.pict_type == s->pict_type); if (s->pict_type == AV_PICTURE_TYPE_B || s->low_delay) { if ((ret = av_frame_ref(pict, &s->current_picture_ptr->f)) < 0) return ret; ff_print_debug_info(s, s->current_picture_ptr); } else if (s->last_picture_ptr != NULL) { if ((ret = av_frame_ref(pict, &s->last_picture_ptr->f)) < 0) return ret; ff_print_debug_info(s, s->last_picture_ptr); } if (s->last_picture_ptr || s->low_delay) *got_frame = 1; if (ret && (avctx->err_recognition & AV_EF_EXPLODE)) return ret; else return get_consumed_bytes(s, buf_size); }
true
FFmpeg
f6774f905fb3cfdc319523ac640be30b14c1bc55
int ff_h263_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; MpegEncContext *s = avctx->priv_data; int ret; AVFrame *pict = data; s->flags = avctx->flags; s->flags2 = avctx->flags2; if (buf_size == 0) { if (s->low_delay == 0 && s->next_picture_ptr) { if ((ret = av_frame_ref(pict, &s->next_picture_ptr->f)) < 0) return ret; s->next_picture_ptr = NULL; *got_frame = 1; } return 0; } if (s->flags & CODEC_FLAG_TRUNCATED) { int next; if (CONFIG_MPEG4_DECODER && s->codec_id == AV_CODEC_ID_MPEG4) { next = ff_mpeg4_find_frame_end(&s->parse_context, buf, buf_size); } else if (CONFIG_H263_DECODER && s->codec_id == AV_CODEC_ID_H263) { next = ff_h263_find_frame_end(&s->parse_context, buf, buf_size); } else { av_log(s->avctx, AV_LOG_ERROR, "this codec does not support truncated bitstreams\n"); return AVERROR(ENOSYS); } if (ff_combine_frame(&s->parse_context, next, (const uint8_t **)&buf, &buf_size) < 0) return buf_size; } if (s->bitstream_buffer_size && (s->divx_packed || buf_size < 20)) ret = init_get_bits8(&s->gb, s->bitstream_buffer, s->bitstream_buffer_size); else ret = init_get_bits8(&s->gb, buf, buf_size); s->bitstream_buffer_size = 0; if (ret < 0) return ret; if (!s->context_initialized) if ((ret = ff_MPV_common_init(s)) < 0) return ret; if (s->current_picture_ptr == NULL || s->current_picture_ptr->f.data[0]) { int i = ff_find_unused_picture(s, 0); if (i < 0) return i; s->current_picture_ptr = &s->picture[i]; } if (CONFIG_WMV2_DECODER && s->msmpeg4_version == 5) { ret = ff_wmv2_decode_picture_header(s); } else if (CONFIG_MSMPEG4_DECODER && s->msmpeg4_version) { ret = ff_msmpeg4_decode_picture_header(s); } else if (CONFIG_MPEG4_DECODER && avctx->codec_id == AV_CODEC_ID_MPEG4) { if (s->avctx->extradata_size && s->picture_number == 0) { GetBitContext gb; ret = init_get_bits8(&gb, s->avctx->extradata, s->avctx->extradata_size); if (ret < 0) return ret; ff_mpeg4_decode_picture_header(avctx->priv_data, &gb); } ret = ff_mpeg4_decode_picture_header(avctx->priv_data, &s->gb); } else if (CONFIG_H263I_DECODER && s->codec_id == AV_CODEC_ID_H263I) { ret = ff_intel_h263_decode_picture_header(s); } else if (CONFIG_FLV_DECODER && s->h263_flv) { ret = ff_flv_decode_picture_header(s); } else { ret = ff_h263_decode_picture_header(s); } if (ret == FRAME_SKIPPED) return get_consumed_bytes(s, buf_size); if (ret < 0) { av_log(s->avctx, AV_LOG_ERROR, "header damaged\n"); return ret; } avctx->has_b_frames = !s->low_delay; #define SET_QPEL_FUNC(postfix1, postfix2) \ s->dsp.put_ ## postfix1 = ff_put_ ## postfix2; \ s->dsp.put_no_rnd_ ## postfix1 = ff_put_no_rnd_ ## postfix2; \ s->dsp.avg_ ## postfix1 = ff_avg_ ## postfix2; if (s->workaround_bugs & FF_BUG_STD_QPEL) { SET_QPEL_FUNC(qpel_pixels_tab[0][5], qpel16_mc11_old_c) SET_QPEL_FUNC(qpel_pixels_tab[0][7], qpel16_mc31_old_c) SET_QPEL_FUNC(qpel_pixels_tab[0][9], qpel16_mc12_old_c) SET_QPEL_FUNC(qpel_pixels_tab[0][11], qpel16_mc32_old_c) SET_QPEL_FUNC(qpel_pixels_tab[0][13], qpel16_mc13_old_c) SET_QPEL_FUNC(qpel_pixels_tab[0][15], qpel16_mc33_old_c) SET_QPEL_FUNC(qpel_pixels_tab[1][5], qpel8_mc11_old_c) SET_QPEL_FUNC(qpel_pixels_tab[1][7], qpel8_mc31_old_c) SET_QPEL_FUNC(qpel_pixels_tab[1][9], qpel8_mc12_old_c) SET_QPEL_FUNC(qpel_pixels_tab[1][11], qpel8_mc32_old_c) SET_QPEL_FUNC(qpel_pixels_tab[1][13], qpel8_mc13_old_c) SET_QPEL_FUNC(qpel_pixels_tab[1][15], qpel8_mc33_old_c) } if (s->width != avctx->coded_width || s->height != avctx->coded_height || s->context_reinit) { s->context_reinit = 0; ret = ff_set_dimensions(avctx, s->width, s->height); if (ret < 0) return ret; if ((ret = ff_MPV_common_frame_size_change(s))) return ret; } if (s->codec_id == AV_CODEC_ID_H263 || s->codec_id == AV_CODEC_ID_H263P || s->codec_id == AV_CODEC_ID_H263I) s->gob_index = ff_h263_get_gob_height(s); s->current_picture.f.pict_type = s->pict_type; s->current_picture.f.key_frame = s->pict_type == AV_PICTURE_TYPE_I; if (s->last_picture_ptr == NULL && (s->pict_type == AV_PICTURE_TYPE_B || s->droppable)) return get_consumed_bytes(s, buf_size); if ((avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type == AV_PICTURE_TYPE_B) || (avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type != AV_PICTURE_TYPE_I) || avctx->skip_frame >= AVDISCARD_ALL) return get_consumed_bytes(s, buf_size); if (s->next_p_frame_damaged) { if (s->pict_type == AV_PICTURE_TYPE_B) return get_consumed_bytes(s, buf_size); else s->next_p_frame_damaged = 0; } if ((!s->no_rounding) || s->pict_type == AV_PICTURE_TYPE_B) { s->me.qpel_put = s->dsp.put_qpel_pixels_tab; s->me.qpel_avg = s->dsp.avg_qpel_pixels_tab; } else { s->me.qpel_put = s->dsp.put_no_rnd_qpel_pixels_tab; s->me.qpel_avg = s->dsp.avg_qpel_pixels_tab; } if ((ret = ff_MPV_frame_start(s, avctx)) < 0) return ret; if (!s->divx_packed && !avctx->hwaccel) ff_thread_finish_setup(avctx); if (avctx->hwaccel) { ret = avctx->hwaccel->start_frame(avctx, s->gb.buffer, s->gb.buffer_end - s->gb.buffer); if (ret < 0 ) return ret; } ff_mpeg_er_frame_start(s); if (CONFIG_WMV2_DECODER && s->msmpeg4_version == 5) { ret = ff_wmv2_decode_secondary_picture_header(s); if (ret < 0) return ret; if (ret == 1) goto intrax8_decoded; } s->mb_x = 0; s->mb_y = 0; ret = decode_slice(s); while (s->mb_y < s->mb_height) { if (s->msmpeg4_version) { if (s->slice_height == 0 || s->mb_x != 0 || (s->mb_y % s->slice_height) != 0 || get_bits_left(&s->gb) < 0) break; } else { int prev_x = s->mb_x, prev_y = s->mb_y; if (ff_h263_resync(s) < 0) break; if (prev_y * s->mb_width + prev_x < s->mb_y * s->mb_width + s->mb_x) s->er.error_occurred = 1; } if (s->msmpeg4_version < 4 && s->h263_pred) ff_mpeg4_clean_buffers(s); if (decode_slice(s) < 0) ret = AVERROR_INVALIDDATA; } if (s->msmpeg4_version && s->msmpeg4_version < 4 && s->pict_type == AV_PICTURE_TYPE_I) if (!CONFIG_MSMPEG4_DECODER || ff_msmpeg4_decode_ext_header(s, buf_size) < 0) s->er.error_status_table[s->mb_num - 1] = ER_MB_ERROR; assert(s->bitstream_buffer_size == 0); if (CONFIG_MPEG4_DECODER && avctx->codec_id == AV_CODEC_ID_MPEG4) ff_mpeg4_frame_end(avctx, buf, buf_size); intrax8_decoded: ff_er_frame_end(&s->er); if (avctx->hwaccel) { ret = avctx->hwaccel->end_frame(avctx); if (ret < 0) return ret; } ff_MPV_frame_end(s); if (!s->divx_packed && avctx->hwaccel) ff_thread_finish_setup(avctx); assert(s->current_picture.f.pict_type == s->current_picture_ptr->f.pict_type); assert(s->current_picture.f.pict_type == s->pict_type); if (s->pict_type == AV_PICTURE_TYPE_B || s->low_delay) { if ((ret = av_frame_ref(pict, &s->current_picture_ptr->f)) < 0) return ret; ff_print_debug_info(s, s->current_picture_ptr); } else if (s->last_picture_ptr != NULL) { if ((ret = av_frame_ref(pict, &s->last_picture_ptr->f)) < 0) return ret; ff_print_debug_info(s, s->last_picture_ptr); } if (s->last_picture_ptr || s->low_delay) *got_frame = 1; if (ret && (avctx->err_recognition & AV_EF_EXPLODE)) return ret; else return get_consumed_bytes(s, buf_size); }
{ "code": [ " s->current_picture.f.pict_type = s->pict_type;", " s->current_picture.f.key_frame = s->pict_type == AV_PICTURE_TYPE_I;", " assert(s->current_picture.f.pict_type == s->pict_type);", " if ((ret = av_frame_ref(pict, &s->next_picture_ptr->f)) < 0)", " if (s->current_picture_ptr == NULL || s->current_picture_ptr->f.data[0]) {", " s->current_picture.f.pict_type = s->pict_type;", " s->current_picture.f.key_frame = s->pict_type == AV_PICTURE_TYPE_I;", " assert(s->current_picture.f.pict_type ==", " s->current_picture_ptr->f.pict_type);", " assert(s->current_picture.f.pict_type == s->pict_type);", " if ((ret = av_frame_ref(pict, &s->current_picture_ptr->f)) < 0)", " if ((ret = av_frame_ref(pict, &s->last_picture_ptr->f)) < 0)", " s->current_picture.f.pict_type = s->pict_type;", " s->current_picture.f.key_frame = s->pict_type == AV_PICTURE_TYPE_I;", " s->current_picture.f.pict_type = s->pict_type;", " if ((ret = av_frame_ref(pict, &s->current_picture_ptr->f)) < 0)", " if ((ret = av_frame_ref(pict, &s->last_picture_ptr->f)) < 0)", " if ((ret = av_frame_ref(pict, &s->next_picture_ptr->f)) < 0)", " if ((ret = av_frame_ref(pict, &s->next_picture_ptr->f)) < 0)", " s->current_picture.f.pict_type = s->pict_type;", " s->current_picture.f.key_frame = s->pict_type == AV_PICTURE_TYPE_I;" ], "line_no": [ 297, 299, 511, 33, 123, 297, 299, 507, 509, 511, 515, 523, 297, 299, 297, 515, 523, 33, 33, 297, 299 ] }
int FUNC_0(AVCodecContext *VAR_0, void *VAR_1, int *VAR_2, AVPacket *VAR_3) { const uint8_t *VAR_4 = VAR_3->VAR_1; int VAR_5 = VAR_3->size; MpegEncContext *s = VAR_0->priv_data; int VAR_6; AVFrame *pict = VAR_1; s->flags = VAR_0->flags; s->flags2 = VAR_0->flags2; if (VAR_5 == 0) { if (s->low_delay == 0 && s->next_picture_ptr) { if ((VAR_6 = av_frame_ref(pict, &s->next_picture_ptr->f)) < 0) return VAR_6; s->next_picture_ptr = NULL; *VAR_2 = 1; } return 0; } if (s->flags & CODEC_FLAG_TRUNCATED) { int VAR_7; if (CONFIG_MPEG4_DECODER && s->codec_id == AV_CODEC_ID_MPEG4) { VAR_7 = ff_mpeg4_find_frame_end(&s->parse_context, VAR_4, VAR_5); } else if (CONFIG_H263_DECODER && s->codec_id == AV_CODEC_ID_H263) { VAR_7 = ff_h263_find_frame_end(&s->parse_context, VAR_4, VAR_5); } else { av_log(s->VAR_0, AV_LOG_ERROR, "this codec does not support truncated bitstreams\n"); return AVERROR(ENOSYS); } if (ff_combine_frame(&s->parse_context, VAR_7, (const uint8_t **)&VAR_4, &VAR_5) < 0) return VAR_5; } if (s->bitstream_buffer_size && (s->divx_packed || VAR_5 < 20)) VAR_6 = init_get_bits8(&s->gb, s->bitstream_buffer, s->bitstream_buffer_size); else VAR_6 = init_get_bits8(&s->gb, VAR_4, VAR_5); s->bitstream_buffer_size = 0; if (VAR_6 < 0) return VAR_6; if (!s->context_initialized) if ((VAR_6 = ff_MPV_common_init(s)) < 0) return VAR_6; if (s->current_picture_ptr == NULL || s->current_picture_ptr->f.VAR_1[0]) { int VAR_8 = ff_find_unused_picture(s, 0); if (VAR_8 < 0) return VAR_8; s->current_picture_ptr = &s->picture[VAR_8]; } if (CONFIG_WMV2_DECODER && s->msmpeg4_version == 5) { VAR_6 = ff_wmv2_decode_picture_header(s); } else if (CONFIG_MSMPEG4_DECODER && s->msmpeg4_version) { VAR_6 = ff_msmpeg4_decode_picture_header(s); } else if (CONFIG_MPEG4_DECODER && VAR_0->codec_id == AV_CODEC_ID_MPEG4) { if (s->VAR_0->extradata_size && s->picture_number == 0) { GetBitContext gb; VAR_6 = init_get_bits8(&gb, s->VAR_0->extradata, s->VAR_0->extradata_size); if (VAR_6 < 0) return VAR_6; ff_mpeg4_decode_picture_header(VAR_0->priv_data, &gb); } VAR_6 = ff_mpeg4_decode_picture_header(VAR_0->priv_data, &s->gb); } else if (CONFIG_H263I_DECODER && s->codec_id == AV_CODEC_ID_H263I) { VAR_6 = ff_intel_h263_decode_picture_header(s); } else if (CONFIG_FLV_DECODER && s->h263_flv) { VAR_6 = ff_flv_decode_picture_header(s); } else { VAR_6 = ff_h263_decode_picture_header(s); } if (VAR_6 == FRAME_SKIPPED) return get_consumed_bytes(s, VAR_5); if (VAR_6 < 0) { av_log(s->VAR_0, AV_LOG_ERROR, "header damaged\n"); return VAR_6; } VAR_0->has_b_frames = !s->low_delay; #define SET_QPEL_FUNC(postfix1, postfix2) \ s->dsp.put_ ## postfix1 = ff_put_ ## postfix2; \ s->dsp.put_no_rnd_ ## postfix1 = ff_put_no_rnd_ ## postfix2; \ s->dsp.avg_ ## postfix1 = ff_avg_ ## postfix2; if (s->workaround_bugs & FF_BUG_STD_QPEL) { SET_QPEL_FUNC(qpel_pixels_tab[0][5], qpel16_mc11_old_c) SET_QPEL_FUNC(qpel_pixels_tab[0][7], qpel16_mc31_old_c) SET_QPEL_FUNC(qpel_pixels_tab[0][9], qpel16_mc12_old_c) SET_QPEL_FUNC(qpel_pixels_tab[0][11], qpel16_mc32_old_c) SET_QPEL_FUNC(qpel_pixels_tab[0][13], qpel16_mc13_old_c) SET_QPEL_FUNC(qpel_pixels_tab[0][15], qpel16_mc33_old_c) SET_QPEL_FUNC(qpel_pixels_tab[1][5], qpel8_mc11_old_c) SET_QPEL_FUNC(qpel_pixels_tab[1][7], qpel8_mc31_old_c) SET_QPEL_FUNC(qpel_pixels_tab[1][9], qpel8_mc12_old_c) SET_QPEL_FUNC(qpel_pixels_tab[1][11], qpel8_mc32_old_c) SET_QPEL_FUNC(qpel_pixels_tab[1][13], qpel8_mc13_old_c) SET_QPEL_FUNC(qpel_pixels_tab[1][15], qpel8_mc33_old_c) } if (s->width != VAR_0->coded_width || s->height != VAR_0->coded_height || s->context_reinit) { s->context_reinit = 0; VAR_6 = ff_set_dimensions(VAR_0, s->width, s->height); if (VAR_6 < 0) return VAR_6; if ((VAR_6 = ff_MPV_common_frame_size_change(s))) return VAR_6; } if (s->codec_id == AV_CODEC_ID_H263 || s->codec_id == AV_CODEC_ID_H263P || s->codec_id == AV_CODEC_ID_H263I) s->gob_index = ff_h263_get_gob_height(s); s->current_picture.f.pict_type = s->pict_type; s->current_picture.f.key_frame = s->pict_type == AV_PICTURE_TYPE_I; if (s->last_picture_ptr == NULL && (s->pict_type == AV_PICTURE_TYPE_B || s->droppable)) return get_consumed_bytes(s, VAR_5); if ((VAR_0->skip_frame >= AVDISCARD_NONREF && s->pict_type == AV_PICTURE_TYPE_B) || (VAR_0->skip_frame >= AVDISCARD_NONKEY && s->pict_type != AV_PICTURE_TYPE_I) || VAR_0->skip_frame >= AVDISCARD_ALL) return get_consumed_bytes(s, VAR_5); if (s->next_p_frame_damaged) { if (s->pict_type == AV_PICTURE_TYPE_B) return get_consumed_bytes(s, VAR_5); else s->next_p_frame_damaged = 0; } if ((!s->no_rounding) || s->pict_type == AV_PICTURE_TYPE_B) { s->me.qpel_put = s->dsp.put_qpel_pixels_tab; s->me.qpel_avg = s->dsp.avg_qpel_pixels_tab; } else { s->me.qpel_put = s->dsp.put_no_rnd_qpel_pixels_tab; s->me.qpel_avg = s->dsp.avg_qpel_pixels_tab; } if ((VAR_6 = ff_MPV_frame_start(s, VAR_0)) < 0) return VAR_6; if (!s->divx_packed && !VAR_0->hwaccel) ff_thread_finish_setup(VAR_0); if (VAR_0->hwaccel) { VAR_6 = VAR_0->hwaccel->start_frame(VAR_0, s->gb.buffer, s->gb.buffer_end - s->gb.buffer); if (VAR_6 < 0 ) return VAR_6; } ff_mpeg_er_frame_start(s); if (CONFIG_WMV2_DECODER && s->msmpeg4_version == 5) { VAR_6 = ff_wmv2_decode_secondary_picture_header(s); if (VAR_6 < 0) return VAR_6; if (VAR_6 == 1) goto intrax8_decoded; } s->mb_x = 0; s->mb_y = 0; VAR_6 = decode_slice(s); while (s->mb_y < s->mb_height) { if (s->msmpeg4_version) { if (s->slice_height == 0 || s->mb_x != 0 || (s->mb_y % s->slice_height) != 0 || get_bits_left(&s->gb) < 0) break; } else { int VAR_9 = s->mb_x, VAR_10 = s->mb_y; if (ff_h263_resync(s) < 0) break; if (VAR_10 * s->mb_width + VAR_9 < s->mb_y * s->mb_width + s->mb_x) s->er.error_occurred = 1; } if (s->msmpeg4_version < 4 && s->h263_pred) ff_mpeg4_clean_buffers(s); if (decode_slice(s) < 0) VAR_6 = AVERROR_INVALIDDATA; } if (s->msmpeg4_version && s->msmpeg4_version < 4 && s->pict_type == AV_PICTURE_TYPE_I) if (!CONFIG_MSMPEG4_DECODER || ff_msmpeg4_decode_ext_header(s, VAR_5) < 0) s->er.error_status_table[s->mb_num - 1] = ER_MB_ERROR; assert(s->bitstream_buffer_size == 0); if (CONFIG_MPEG4_DECODER && VAR_0->codec_id == AV_CODEC_ID_MPEG4) ff_mpeg4_frame_end(VAR_0, VAR_4, VAR_5); intrax8_decoded: ff_er_frame_end(&s->er); if (VAR_0->hwaccel) { VAR_6 = VAR_0->hwaccel->end_frame(VAR_0); if (VAR_6 < 0) return VAR_6; } ff_MPV_frame_end(s); if (!s->divx_packed && VAR_0->hwaccel) ff_thread_finish_setup(VAR_0); assert(s->current_picture.f.pict_type == s->current_picture_ptr->f.pict_type); assert(s->current_picture.f.pict_type == s->pict_type); if (s->pict_type == AV_PICTURE_TYPE_B || s->low_delay) { if ((VAR_6 = av_frame_ref(pict, &s->current_picture_ptr->f)) < 0) return VAR_6; ff_print_debug_info(s, s->current_picture_ptr); } else if (s->last_picture_ptr != NULL) { if ((VAR_6 = av_frame_ref(pict, &s->last_picture_ptr->f)) < 0) return VAR_6; ff_print_debug_info(s, s->last_picture_ptr); } if (s->last_picture_ptr || s->low_delay) *VAR_2 = 1; if (VAR_6 && (VAR_0->err_recognition & AV_EF_EXPLODE)) return VAR_6; else return get_consumed_bytes(s, VAR_5); }
[ "int FUNC_0(AVCodecContext *VAR_0, void *VAR_1, int *VAR_2,\nAVPacket *VAR_3)\n{", "const uint8_t *VAR_4 = VAR_3->VAR_1;", "int VAR_5 = VAR_3->size;", "MpegEncContext *s = VAR_0->priv_data;", "int VAR_6;", "AVFrame *pict = VAR_1;", "s->flags = VAR_0->flags;", "s->flags2 = VAR_0->flags2;", "if (VAR_5 == 0) {", "if (s->low_delay == 0 && s->next_picture_ptr) {", "if ((VAR_6 = av_frame_ref(pict, &s->next_picture_ptr->f)) < 0)\nreturn VAR_6;", "s->next_picture_ptr = NULL;", "*VAR_2 = 1;", "}", "return 0;", "}", "if (s->flags & CODEC_FLAG_TRUNCATED) {", "int VAR_7;", "if (CONFIG_MPEG4_DECODER && s->codec_id == AV_CODEC_ID_MPEG4) {", "VAR_7 = ff_mpeg4_find_frame_end(&s->parse_context, VAR_4, VAR_5);", "} else if (CONFIG_H263_DECODER && s->codec_id == AV_CODEC_ID_H263) {", "VAR_7 = ff_h263_find_frame_end(&s->parse_context, VAR_4, VAR_5);", "} else {", "av_log(s->VAR_0, AV_LOG_ERROR,\n\"this codec does not support truncated bitstreams\\n\");", "return AVERROR(ENOSYS);", "}", "if (ff_combine_frame(&s->parse_context, VAR_7, (const uint8_t **)&VAR_4,\n&VAR_5) < 0)\nreturn VAR_5;", "}", "if (s->bitstream_buffer_size && (s->divx_packed || VAR_5 < 20))\nVAR_6 = init_get_bits8(&s->gb, s->bitstream_buffer,\ns->bitstream_buffer_size);", "else\nVAR_6 = init_get_bits8(&s->gb, VAR_4, VAR_5);", "s->bitstream_buffer_size = 0;", "if (VAR_6 < 0)\nreturn VAR_6;", "if (!s->context_initialized)\nif ((VAR_6 = ff_MPV_common_init(s)) < 0)\nreturn VAR_6;", "if (s->current_picture_ptr == NULL || s->current_picture_ptr->f.VAR_1[0]) {", "int VAR_8 = ff_find_unused_picture(s, 0);", "if (VAR_8 < 0)\nreturn VAR_8;", "s->current_picture_ptr = &s->picture[VAR_8];", "}", "if (CONFIG_WMV2_DECODER && s->msmpeg4_version == 5) {", "VAR_6 = ff_wmv2_decode_picture_header(s);", "} else if (CONFIG_MSMPEG4_DECODER && s->msmpeg4_version) {", "VAR_6 = ff_msmpeg4_decode_picture_header(s);", "} else if (CONFIG_MPEG4_DECODER && VAR_0->codec_id == AV_CODEC_ID_MPEG4) {", "if (s->VAR_0->extradata_size && s->picture_number == 0) {", "GetBitContext gb;", "VAR_6 = init_get_bits8(&gb, s->VAR_0->extradata,\ns->VAR_0->extradata_size);", "if (VAR_6 < 0)\nreturn VAR_6;", "ff_mpeg4_decode_picture_header(VAR_0->priv_data, &gb);", "}", "VAR_6 = ff_mpeg4_decode_picture_header(VAR_0->priv_data, &s->gb);", "} else if (CONFIG_H263I_DECODER && s->codec_id == AV_CODEC_ID_H263I) {", "VAR_6 = ff_intel_h263_decode_picture_header(s);", "} else if (CONFIG_FLV_DECODER && s->h263_flv) {", "VAR_6 = ff_flv_decode_picture_header(s);", "} else {", "VAR_6 = ff_h263_decode_picture_header(s);", "}", "if (VAR_6 == FRAME_SKIPPED)\nreturn get_consumed_bytes(s, VAR_5);", "if (VAR_6 < 0) {", "av_log(s->VAR_0, AV_LOG_ERROR, \"header damaged\\n\");", "return VAR_6;", "}", "VAR_0->has_b_frames = !s->low_delay;", "#define SET_QPEL_FUNC(postfix1, postfix2) \\\ns->dsp.put_ ## postfix1 = ff_put_ ## postfix2; \\", "s->dsp.put_no_rnd_ ## postfix1 = ff_put_no_rnd_ ## postfix2; \\", "s->dsp.avg_ ## postfix1 = ff_avg_ ## postfix2;", "if (s->workaround_bugs & FF_BUG_STD_QPEL) {", "SET_QPEL_FUNC(qpel_pixels_tab[0][5], qpel16_mc11_old_c)\nSET_QPEL_FUNC(qpel_pixels_tab[0][7], qpel16_mc31_old_c)\nSET_QPEL_FUNC(qpel_pixels_tab[0][9], qpel16_mc12_old_c)\nSET_QPEL_FUNC(qpel_pixels_tab[0][11], qpel16_mc32_old_c)\nSET_QPEL_FUNC(qpel_pixels_tab[0][13], qpel16_mc13_old_c)\nSET_QPEL_FUNC(qpel_pixels_tab[0][15], qpel16_mc33_old_c)\nSET_QPEL_FUNC(qpel_pixels_tab[1][5], qpel8_mc11_old_c)\nSET_QPEL_FUNC(qpel_pixels_tab[1][7], qpel8_mc31_old_c)\nSET_QPEL_FUNC(qpel_pixels_tab[1][9], qpel8_mc12_old_c)\nSET_QPEL_FUNC(qpel_pixels_tab[1][11], qpel8_mc32_old_c)\nSET_QPEL_FUNC(qpel_pixels_tab[1][13], qpel8_mc13_old_c)\nSET_QPEL_FUNC(qpel_pixels_tab[1][15], qpel8_mc33_old_c)\n}", "if (s->width != VAR_0->coded_width ||\ns->height != VAR_0->coded_height ||\ns->context_reinit) {", "s->context_reinit = 0;", "VAR_6 = ff_set_dimensions(VAR_0, s->width, s->height);", "if (VAR_6 < 0)\nreturn VAR_6;", "if ((VAR_6 = ff_MPV_common_frame_size_change(s)))\nreturn VAR_6;", "}", "if (s->codec_id == AV_CODEC_ID_H263 ||\ns->codec_id == AV_CODEC_ID_H263P ||\ns->codec_id == AV_CODEC_ID_H263I)\ns->gob_index = ff_h263_get_gob_height(s);", "s->current_picture.f.pict_type = s->pict_type;", "s->current_picture.f.key_frame = s->pict_type == AV_PICTURE_TYPE_I;", "if (s->last_picture_ptr == NULL &&\n(s->pict_type == AV_PICTURE_TYPE_B || s->droppable))\nreturn get_consumed_bytes(s, VAR_5);", "if ((VAR_0->skip_frame >= AVDISCARD_NONREF &&\ns->pict_type == AV_PICTURE_TYPE_B) ||\n(VAR_0->skip_frame >= AVDISCARD_NONKEY &&\ns->pict_type != AV_PICTURE_TYPE_I) ||\nVAR_0->skip_frame >= AVDISCARD_ALL)\nreturn get_consumed_bytes(s, VAR_5);", "if (s->next_p_frame_damaged) {", "if (s->pict_type == AV_PICTURE_TYPE_B)\nreturn get_consumed_bytes(s, VAR_5);", "else\ns->next_p_frame_damaged = 0;", "}", "if ((!s->no_rounding) || s->pict_type == AV_PICTURE_TYPE_B) {", "s->me.qpel_put = s->dsp.put_qpel_pixels_tab;", "s->me.qpel_avg = s->dsp.avg_qpel_pixels_tab;", "} else {", "s->me.qpel_put = s->dsp.put_no_rnd_qpel_pixels_tab;", "s->me.qpel_avg = s->dsp.avg_qpel_pixels_tab;", "}", "if ((VAR_6 = ff_MPV_frame_start(s, VAR_0)) < 0)\nreturn VAR_6;", "if (!s->divx_packed && !VAR_0->hwaccel)\nff_thread_finish_setup(VAR_0);", "if (VAR_0->hwaccel) {", "VAR_6 = VAR_0->hwaccel->start_frame(VAR_0, s->gb.buffer,\ns->gb.buffer_end - s->gb.buffer);", "if (VAR_6 < 0 )\nreturn VAR_6;", "}", "ff_mpeg_er_frame_start(s);", "if (CONFIG_WMV2_DECODER && s->msmpeg4_version == 5) {", "VAR_6 = ff_wmv2_decode_secondary_picture_header(s);", "if (VAR_6 < 0)\nreturn VAR_6;", "if (VAR_6 == 1)\ngoto intrax8_decoded;", "}", "s->mb_x = 0;", "s->mb_y = 0;", "VAR_6 = decode_slice(s);", "while (s->mb_y < s->mb_height) {", "if (s->msmpeg4_version) {", "if (s->slice_height == 0 || s->mb_x != 0 ||\n(s->mb_y % s->slice_height) != 0 || get_bits_left(&s->gb) < 0)\nbreak;", "} else {", "int VAR_9 = s->mb_x, VAR_10 = s->mb_y;", "if (ff_h263_resync(s) < 0)\nbreak;", "if (VAR_10 * s->mb_width + VAR_9 < s->mb_y * s->mb_width + s->mb_x)\ns->er.error_occurred = 1;", "}", "if (s->msmpeg4_version < 4 && s->h263_pred)\nff_mpeg4_clean_buffers(s);", "if (decode_slice(s) < 0)\nVAR_6 = AVERROR_INVALIDDATA;", "}", "if (s->msmpeg4_version && s->msmpeg4_version < 4 &&\ns->pict_type == AV_PICTURE_TYPE_I)\nif (!CONFIG_MSMPEG4_DECODER ||\nff_msmpeg4_decode_ext_header(s, VAR_5) < 0)\ns->er.error_status_table[s->mb_num - 1] = ER_MB_ERROR;", "assert(s->bitstream_buffer_size == 0);", "if (CONFIG_MPEG4_DECODER && VAR_0->codec_id == AV_CODEC_ID_MPEG4)\nff_mpeg4_frame_end(VAR_0, VAR_4, VAR_5);", "intrax8_decoded:\nff_er_frame_end(&s->er);", "if (VAR_0->hwaccel) {", "VAR_6 = VAR_0->hwaccel->end_frame(VAR_0);", "if (VAR_6 < 0)\nreturn VAR_6;", "}", "ff_MPV_frame_end(s);", "if (!s->divx_packed && VAR_0->hwaccel)\nff_thread_finish_setup(VAR_0);", "assert(s->current_picture.f.pict_type ==\ns->current_picture_ptr->f.pict_type);", "assert(s->current_picture.f.pict_type == s->pict_type);", "if (s->pict_type == AV_PICTURE_TYPE_B || s->low_delay) {", "if ((VAR_6 = av_frame_ref(pict, &s->current_picture_ptr->f)) < 0)\nreturn VAR_6;", "ff_print_debug_info(s, s->current_picture_ptr);", "} else if (s->last_picture_ptr != NULL) {", "if ((VAR_6 = av_frame_ref(pict, &s->last_picture_ptr->f)) < 0)\nreturn VAR_6;", "ff_print_debug_info(s, s->last_picture_ptr);", "}", "if (s->last_picture_ptr || s->low_delay)\n*VAR_2 = 1;", "if (VAR_6 && (VAR_0->err_recognition & AV_EF_EXPLODE))\nreturn VAR_6;", "else\nreturn get_consumed_bytes(s, VAR_5);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 27 ], [ 31 ], [ 33, 35 ], [ 37 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69, 71 ], [ 73 ], [ 75 ], [ 79, 81, 83 ], [ 85 ], [ 89, 91, 93 ], [ 95, 97 ], [ 99 ], [ 103, 105 ], [ 109, 113, 115 ], [ 123 ], [ 125 ], [ 127, 129 ], [ 131 ], [ 133 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 155, 157 ], [ 159, 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 185, 187 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 203 ], [ 207, 209 ], [ 211 ], [ 213 ], [ 217 ], [ 219, 221, 223, 225, 227, 229, 233, 235, 237, 239, 241, 243, 245 ], [ 257, 259, 261 ], [ 265 ], [ 269 ], [ 271, 273 ], [ 277, 279 ], [ 281 ], [ 285, 287, 289, 291 ], [ 297 ], [ 299 ], [ 305, 307, 309 ], [ 311, 313, 315, 317, 319, 321 ], [ 325 ], [ 327, 329 ], [ 331, 333 ], [ 335 ], [ 339 ], [ 341 ], [ 343 ], [ 345 ], [ 347 ], [ 349 ], [ 351 ], [ 355, 357 ], [ 361, 363 ], [ 367 ], [ 369, 371 ], [ 373, 375 ], [ 377 ], [ 381 ], [ 391 ], [ 393 ], [ 395, 397 ], [ 399, 401 ], [ 403 ], [ 409 ], [ 411 ], [ 415 ], [ 417 ], [ 419 ], [ 421, 423, 425 ], [ 427 ], [ 429 ], [ 431, 433 ], [ 435, 437 ], [ 439 ], [ 443, 445 ], [ 449, 451 ], [ 453 ], [ 457, 459, 461, 463, 465 ], [ 469 ], [ 473, 475 ], [ 479, 481 ], [ 485 ], [ 487 ], [ 489, 491 ], [ 493 ], [ 497 ], [ 501, 503 ], [ 507, 509 ], [ 511 ], [ 513 ], [ 515, 517 ], [ 519 ], [ 521 ], [ 523, 525 ], [ 527 ], [ 529 ], [ 533, 535 ], [ 539, 541 ], [ 543, 545 ], [ 547 ] ]
7,524
void sm501_init(MemoryRegion *address_space_mem, uint32_t base, uint32_t local_mem_bytes, qemu_irq irq, CharDriverState *chr) { SM501State * s; DeviceState *dev; MemoryRegion *sm501_system_config = g_new(MemoryRegion, 1); MemoryRegion *sm501_disp_ctrl = g_new(MemoryRegion, 1); MemoryRegion *sm501_2d_engine = g_new(MemoryRegion, 1); /* allocate management data region */ s = (SM501State *)g_malloc0(sizeof(SM501State)); s->base = base; s->local_mem_size_index = get_local_mem_size_index(local_mem_bytes); SM501_DPRINTF("local mem size=%x. index=%d\n", get_local_mem_size(s), s->local_mem_size_index); s->system_control = 0x00100000; s->misc_control = 0x00001000; /* assumes SH, active=low */ s->dc_panel_control = 0x00010000; s->dc_crt_control = 0x00010000; /* allocate local memory */ memory_region_init_ram(&s->local_mem_region, NULL, "sm501.local", local_mem_bytes, &error_abort); vmstate_register_ram_global(&s->local_mem_region); memory_region_set_log(&s->local_mem_region, true, DIRTY_MEMORY_VGA); s->local_mem = memory_region_get_ram_ptr(&s->local_mem_region); memory_region_add_subregion(address_space_mem, base, &s->local_mem_region); /* map mmio */ memory_region_init_io(sm501_system_config, NULL, &sm501_system_config_ops, s, "sm501-system-config", 0x6c); memory_region_add_subregion(address_space_mem, base + MMIO_BASE_OFFSET, sm501_system_config); memory_region_init_io(sm501_disp_ctrl, NULL, &sm501_disp_ctrl_ops, s, "sm501-disp-ctrl", 0x1000); memory_region_add_subregion(address_space_mem, base + MMIO_BASE_OFFSET + SM501_DC, sm501_disp_ctrl); memory_region_init_io(sm501_2d_engine, NULL, &sm501_2d_engine_ops, s, "sm501-2d-engine", 0x54); memory_region_add_subregion(address_space_mem, base + MMIO_BASE_OFFSET + SM501_2D_ENGINE, sm501_2d_engine); /* bridge to usb host emulation module */ dev = qdev_create(NULL, "sysbus-ohci"); qdev_prop_set_uint32(dev, "num-ports", 2); qdev_prop_set_uint64(dev, "dma-offset", base); qdev_init_nofail(dev); sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, base + MMIO_BASE_OFFSET + SM501_USB_HOST); sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, irq); /* bridge to serial emulation module */ if (chr) { serial_mm_init(address_space_mem, base + MMIO_BASE_OFFSET + SM501_UART0, 2, NULL, /* TODO : chain irq to IRL */ 115200, chr, DEVICE_NATIVE_ENDIAN); } /* create qemu graphic console */ s->con = graphic_console_init(DEVICE(dev), 0, &sm501_ops, s); }
true
qemu
f8ed85ac992c48814d916d5df4d44f9a971c5de4
void sm501_init(MemoryRegion *address_space_mem, uint32_t base, uint32_t local_mem_bytes, qemu_irq irq, CharDriverState *chr) { SM501State * s; DeviceState *dev; MemoryRegion *sm501_system_config = g_new(MemoryRegion, 1); MemoryRegion *sm501_disp_ctrl = g_new(MemoryRegion, 1); MemoryRegion *sm501_2d_engine = g_new(MemoryRegion, 1); s = (SM501State *)g_malloc0(sizeof(SM501State)); s->base = base; s->local_mem_size_index = get_local_mem_size_index(local_mem_bytes); SM501_DPRINTF("local mem size=%x. index=%d\n", get_local_mem_size(s), s->local_mem_size_index); s->system_control = 0x00100000; s->misc_control = 0x00001000; s->dc_panel_control = 0x00010000; s->dc_crt_control = 0x00010000; memory_region_init_ram(&s->local_mem_region, NULL, "sm501.local", local_mem_bytes, &error_abort); vmstate_register_ram_global(&s->local_mem_region); memory_region_set_log(&s->local_mem_region, true, DIRTY_MEMORY_VGA); s->local_mem = memory_region_get_ram_ptr(&s->local_mem_region); memory_region_add_subregion(address_space_mem, base, &s->local_mem_region); memory_region_init_io(sm501_system_config, NULL, &sm501_system_config_ops, s, "sm501-system-config", 0x6c); memory_region_add_subregion(address_space_mem, base + MMIO_BASE_OFFSET, sm501_system_config); memory_region_init_io(sm501_disp_ctrl, NULL, &sm501_disp_ctrl_ops, s, "sm501-disp-ctrl", 0x1000); memory_region_add_subregion(address_space_mem, base + MMIO_BASE_OFFSET + SM501_DC, sm501_disp_ctrl); memory_region_init_io(sm501_2d_engine, NULL, &sm501_2d_engine_ops, s, "sm501-2d-engine", 0x54); memory_region_add_subregion(address_space_mem, base + MMIO_BASE_OFFSET + SM501_2D_ENGINE, sm501_2d_engine); dev = qdev_create(NULL, "sysbus-ohci"); qdev_prop_set_uint32(dev, "num-ports", 2); qdev_prop_set_uint64(dev, "dma-offset", base); qdev_init_nofail(dev); sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, base + MMIO_BASE_OFFSET + SM501_USB_HOST); sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, irq); if (chr) { serial_mm_init(address_space_mem, base + MMIO_BASE_OFFSET + SM501_UART0, 2, NULL, 115200, chr, DEVICE_NATIVE_ENDIAN); } s->con = graphic_console_init(DEVICE(dev), 0, &sm501_ops, s); }
{ "code": [ " local_mem_bytes, &error_abort);" ], "line_no": [ 47 ] }
void FUNC_0(MemoryRegion *VAR_0, uint32_t VAR_1, uint32_t VAR_2, qemu_irq VAR_3, CharDriverState *VAR_4) { SM501State * s; DeviceState *dev; MemoryRegion *sm501_system_config = g_new(MemoryRegion, 1); MemoryRegion *sm501_disp_ctrl = g_new(MemoryRegion, 1); MemoryRegion *sm501_2d_engine = g_new(MemoryRegion, 1); s = (SM501State *)g_malloc0(sizeof(SM501State)); s->VAR_1 = VAR_1; s->local_mem_size_index = get_local_mem_size_index(VAR_2); SM501_DPRINTF("local mem size=%x. index=%d\n", get_local_mem_size(s), s->local_mem_size_index); s->system_control = 0x00100000; s->misc_control = 0x00001000; s->dc_panel_control = 0x00010000; s->dc_crt_control = 0x00010000; memory_region_init_ram(&s->local_mem_region, NULL, "sm501.local", VAR_2, &error_abort); vmstate_register_ram_global(&s->local_mem_region); memory_region_set_log(&s->local_mem_region, true, DIRTY_MEMORY_VGA); s->local_mem = memory_region_get_ram_ptr(&s->local_mem_region); memory_region_add_subregion(VAR_0, VAR_1, &s->local_mem_region); memory_region_init_io(sm501_system_config, NULL, &sm501_system_config_ops, s, "sm501-system-config", 0x6c); memory_region_add_subregion(VAR_0, VAR_1 + MMIO_BASE_OFFSET, sm501_system_config); memory_region_init_io(sm501_disp_ctrl, NULL, &sm501_disp_ctrl_ops, s, "sm501-disp-ctrl", 0x1000); memory_region_add_subregion(VAR_0, VAR_1 + MMIO_BASE_OFFSET + SM501_DC, sm501_disp_ctrl); memory_region_init_io(sm501_2d_engine, NULL, &sm501_2d_engine_ops, s, "sm501-2d-engine", 0x54); memory_region_add_subregion(VAR_0, VAR_1 + MMIO_BASE_OFFSET + SM501_2D_ENGINE, sm501_2d_engine); dev = qdev_create(NULL, "sysbus-ohci"); qdev_prop_set_uint32(dev, "num-ports", 2); qdev_prop_set_uint64(dev, "dma-offset", VAR_1); qdev_init_nofail(dev); sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, VAR_1 + MMIO_BASE_OFFSET + SM501_USB_HOST); sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, VAR_3); if (VAR_4) { serial_mm_init(VAR_0, VAR_1 + MMIO_BASE_OFFSET + SM501_UART0, 2, NULL, 115200, VAR_4, DEVICE_NATIVE_ENDIAN); } s->con = graphic_console_init(DEVICE(dev), 0, &sm501_ops, s); }
[ "void FUNC_0(MemoryRegion *VAR_0, uint32_t VAR_1,\nuint32_t VAR_2, qemu_irq VAR_3, CharDriverState *VAR_4)\n{", "SM501State * s;", "DeviceState *dev;", "MemoryRegion *sm501_system_config = g_new(MemoryRegion, 1);", "MemoryRegion *sm501_disp_ctrl = g_new(MemoryRegion, 1);", "MemoryRegion *sm501_2d_engine = g_new(MemoryRegion, 1);", "s = (SM501State *)g_malloc0(sizeof(SM501State));", "s->VAR_1 = VAR_1;", "s->local_mem_size_index\n= get_local_mem_size_index(VAR_2);", "SM501_DPRINTF(\"local mem size=%x. index=%d\\n\", get_local_mem_size(s),\ns->local_mem_size_index);", "s->system_control = 0x00100000;", "s->misc_control = 0x00001000;", "s->dc_panel_control = 0x00010000;", "s->dc_crt_control = 0x00010000;", "memory_region_init_ram(&s->local_mem_region, NULL, \"sm501.local\",\nVAR_2, &error_abort);", "vmstate_register_ram_global(&s->local_mem_region);", "memory_region_set_log(&s->local_mem_region, true, DIRTY_MEMORY_VGA);", "s->local_mem = memory_region_get_ram_ptr(&s->local_mem_region);", "memory_region_add_subregion(VAR_0, VAR_1, &s->local_mem_region);", "memory_region_init_io(sm501_system_config, NULL, &sm501_system_config_ops, s,\n\"sm501-system-config\", 0x6c);", "memory_region_add_subregion(VAR_0, VAR_1 + MMIO_BASE_OFFSET,\nsm501_system_config);", "memory_region_init_io(sm501_disp_ctrl, NULL, &sm501_disp_ctrl_ops, s,\n\"sm501-disp-ctrl\", 0x1000);", "memory_region_add_subregion(VAR_0,\nVAR_1 + MMIO_BASE_OFFSET + SM501_DC,\nsm501_disp_ctrl);", "memory_region_init_io(sm501_2d_engine, NULL, &sm501_2d_engine_ops, s,\n\"sm501-2d-engine\", 0x54);", "memory_region_add_subregion(VAR_0,\nVAR_1 + MMIO_BASE_OFFSET + SM501_2D_ENGINE,\nsm501_2d_engine);", "dev = qdev_create(NULL, \"sysbus-ohci\");", "qdev_prop_set_uint32(dev, \"num-ports\", 2);", "qdev_prop_set_uint64(dev, \"dma-offset\", VAR_1);", "qdev_init_nofail(dev);", "sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0,\nVAR_1 + MMIO_BASE_OFFSET + SM501_USB_HOST);", "sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, VAR_3);", "if (VAR_4) {", "serial_mm_init(VAR_0,\nVAR_1 + MMIO_BASE_OFFSET + SM501_UART0, 2,\nNULL,\n115200, VAR_4, DEVICE_NATIVE_ENDIAN);", "}", "s->con = graphic_console_init(DEVICE(dev), 0, &sm501_ops, s);", "}" ]
[ 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 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 21 ], [ 23 ], [ 25, 27 ], [ 29, 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 45, 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 61, 63 ], [ 65, 67 ], [ 69, 71 ], [ 73, 75, 77 ], [ 79, 81 ], [ 83, 85, 87 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101, 103 ], [ 105 ], [ 111 ], [ 113, 115, 117, 119 ], [ 121 ], [ 127 ], [ 129 ] ]
7,525
static void nbd_parse_filename(const char *filename, QDict *options, Error **errp) { char *file; char *export_name; const char *host_spec; const char *unixpath; if (qdict_haskey(options, "host") || qdict_haskey(options, "port") || qdict_haskey(options, "path")) { error_setg(errp, "host/port/path and a file name may not be specified " "at the same time"); return; } if (strstr(filename, "://")) { int ret = nbd_parse_uri(filename, options); if (ret < 0) { error_setg(errp, "No valid URL specified"); } return; } file = g_strdup(filename); export_name = strstr(file, EN_OPTSTR); if (export_name) { if (export_name[strlen(EN_OPTSTR)] == 0) { goto out; } export_name[0] = 0; /* truncate 'file' */ export_name += strlen(EN_OPTSTR); qdict_put(options, "export", qstring_from_str(export_name)); } /* extract the host_spec - fail if it's not nbd:... */ if (!strstart(file, "nbd:", &host_spec)) { error_setg(errp, "File name string for NBD must start with 'nbd:'"); goto out; } if (!*host_spec) { goto out; } /* are we a UNIX or TCP socket? */ if (strstart(host_spec, "unix:", &unixpath)) { qdict_put(options, "path", qstring_from_str(unixpath)); } else { InetSocketAddress *addr = NULL; addr = inet_parse(host_spec, errp); if (error_is_set(errp)) { goto out; } qdict_put(options, "host", qstring_from_str(addr->host)); qdict_put(options, "port", qstring_from_str(addr->port)); qapi_free_InetSocketAddress(addr); } out: g_free(file); }
true
qemu
92de9012904cd6ada47565f48db545d53069d933
static void nbd_parse_filename(const char *filename, QDict *options, Error **errp) { char *file; char *export_name; const char *host_spec; const char *unixpath; if (qdict_haskey(options, "host") || qdict_haskey(options, "port") || qdict_haskey(options, "path")) { error_setg(errp, "host/port/path and a file name may not be specified " "at the same time"); return; } if (strstr(filename, ": int ret = nbd_parse_uri(filename, options); if (ret < 0) { error_setg(errp, "No valid URL specified"); } return; } file = g_strdup(filename); export_name = strstr(file, EN_OPTSTR); if (export_name) { if (export_name[strlen(EN_OPTSTR)] == 0) { goto out; } export_name[0] = 0; export_name += strlen(EN_OPTSTR); qdict_put(options, "export", qstring_from_str(export_name)); } if (!strstart(file, "nbd:", &host_spec)) { error_setg(errp, "File name string for NBD must start with 'nbd:'"); goto out; } if (!*host_spec) { goto out; } if (strstart(host_spec, "unix:", &unixpath)) { qdict_put(options, "path", qstring_from_str(unixpath)); } else { InetSocketAddress *addr = NULL; addr = inet_parse(host_spec, errp); if (error_is_set(errp)) { goto out; } qdict_put(options, "host", qstring_from_str(addr->host)); qdict_put(options, "port", qstring_from_str(addr->port)); qapi_free_InetSocketAddress(addr); } out: g_free(file); }
{ "code": [ " if (error_is_set(errp)) {" ], "line_no": [ 111 ] }
static void FUNC_0(const char *VAR_0, QDict *VAR_1, Error **VAR_2) { char *VAR_3; char *VAR_4; const char *VAR_5; const char *VAR_6; if (qdict_haskey(VAR_1, "host") || qdict_haskey(VAR_1, "port") || qdict_haskey(VAR_1, "path")) { error_setg(VAR_2, "host/port/path and a VAR_3 name may not be specified " "at the same time"); return; } if (strstr(VAR_0, ": int ret = nbd_parse_uri(VAR_0, VAR_1); if (ret < 0) { error_setg(VAR_2, "No valid URL specified"); } return; } VAR_3 = g_strdup(VAR_0); VAR_4 = strstr(VAR_3, EN_OPTSTR); if (VAR_4) { if (VAR_4[strlen(EN_OPTSTR)] == 0) { goto out; } VAR_4[0] = 0; VAR_4 += strlen(EN_OPTSTR); qdict_put(VAR_1, "export", qstring_from_str(VAR_4)); } if (!strstart(VAR_3, "nbd:", &VAR_5)) { error_setg(VAR_2, "File name string for NBD must start with 'nbd:'"); goto out; } if (!*VAR_5) { goto out; } if (strstart(VAR_5, "unix:", &VAR_6)) { qdict_put(VAR_1, "path", qstring_from_str(VAR_6)); } else { InetSocketAddress *addr = NULL; addr = inet_parse(VAR_5, VAR_2); if (error_is_set(VAR_2)) { goto out; } qdict_put(VAR_1, "host", qstring_from_str(addr->host)); qdict_put(VAR_1, "port", qstring_from_str(addr->port)); qapi_free_InetSocketAddress(addr); } out: g_free(VAR_3); }
[ "static void FUNC_0(const char *VAR_0, QDict *VAR_1,\nError **VAR_2)\n{", "char *VAR_3;", "char *VAR_4;", "const char *VAR_5;", "const char *VAR_6;", "if (qdict_haskey(VAR_1, \"host\")\n|| qdict_haskey(VAR_1, \"port\")\n|| qdict_haskey(VAR_1, \"path\"))\n{", "error_setg(VAR_2, \"host/port/path and a VAR_3 name may not be specified \"\n\"at the same time\");", "return;", "}", "if (strstr(VAR_0, \":\nint ret = nbd_parse_uri(VAR_0, VAR_1);", "if (ret < 0) {", "error_setg(VAR_2, \"No valid URL specified\");", "}", "return;", "}", "VAR_3 = g_strdup(VAR_0);", "VAR_4 = strstr(VAR_3, EN_OPTSTR);", "if (VAR_4) {", "if (VAR_4[strlen(EN_OPTSTR)] == 0) {", "goto out;", "}", "VAR_4[0] = 0;", "VAR_4 += strlen(EN_OPTSTR);", "qdict_put(VAR_1, \"export\", qstring_from_str(VAR_4));", "}", "if (!strstart(VAR_3, \"nbd:\", &VAR_5)) {", "error_setg(VAR_2, \"File name string for NBD must start with 'nbd:'\");", "goto out;", "}", "if (!*VAR_5) {", "goto out;", "}", "if (strstart(VAR_5, \"unix:\", &VAR_6)) {", "qdict_put(VAR_1, \"path\", qstring_from_str(VAR_6));", "} else {", "InetSocketAddress *addr = NULL;", "addr = inet_parse(VAR_5, VAR_2);", "if (error_is_set(VAR_2)) {", "goto out;", "}", "qdict_put(VAR_1, \"host\", qstring_from_str(addr->host));", "qdict_put(VAR_1, \"port\", qstring_from_str(addr->port));", "qapi_free_InetSocketAddress(addr);", "}", "out:\ng_free(VAR_3);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17, 19, 21, 23 ], [ 25, 27 ], [ 29 ], [ 31 ], [ 35, 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 71 ], [ 73 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 89 ], [ 91 ], [ 93 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 129, 131 ], [ 133 ] ]
7,526
static int64_t get_pts(const char **buf, int *duration, int32_t *x1, int32_t *y1, int32_t *x2, int32_t *y2) { int i; for (i=0; i<2; i++) { int hh1, mm1, ss1, ms1; int hh2, mm2, ss2, ms2; if (sscanf(*buf, "%d:%2d:%2d%*1[,.]%3d --> %d:%2d:%2d%*1[,.]%3d" "%*[ ]X1:%u X2:%u Y1:%u Y2:%u", &hh1, &mm1, &ss1, &ms1, &hh2, &mm2, &ss2, &ms2, x1, x2, y1, y2) >= 8) { int64_t start = (hh1*3600LL + mm1*60LL + ss1) * 1000LL + ms1; int64_t end = (hh2*3600LL + mm2*60LL + ss2) * 1000LL + ms2; *duration = end - start; *buf += strcspn(*buf, "\n") + 1; return start; } *buf += strcspn(*buf, "\n") + 1; } return AV_NOPTS_VALUE; }
true
FFmpeg
dc6f1a8dda00c3bc206486396e4a11941fc1cbe3
static int64_t get_pts(const char **buf, int *duration, int32_t *x1, int32_t *y1, int32_t *x2, int32_t *y2) { int i; for (i=0; i<2; i++) { int hh1, mm1, ss1, ms1; int hh2, mm2, ss2, ms2; if (sscanf(*buf, "%d:%2d:%2d%*1[,.]%3d --> %d:%2d:%2d%*1[,.]%3d" "%*[ ]X1:%u X2:%u Y1:%u Y2:%u", &hh1, &mm1, &ss1, &ms1, &hh2, &mm2, &ss2, &ms2, x1, x2, y1, y2) >= 8) { int64_t start = (hh1*3600LL + mm1*60LL + ss1) * 1000LL + ms1; int64_t end = (hh2*3600LL + mm2*60LL + ss2) * 1000LL + ms2; *duration = end - start; *buf += strcspn(*buf, "\n") + 1; return start; } *buf += strcspn(*buf, "\n") + 1; } return AV_NOPTS_VALUE; }
{ "code": [ " *buf += strcspn(*buf, \"\\n\") + 1;", " *buf += strcspn(*buf, \"\\n\") + 1;" ], "line_no": [ 33, 39 ] }
static int64_t FUNC_0(const char **buf, int *duration, int32_t *x1, int32_t *y1, int32_t *x2, int32_t *y2) { int VAR_0; for (VAR_0=0; VAR_0<2; VAR_0++) { int VAR_1, VAR_2, VAR_3, VAR_4; int VAR_5, VAR_6, VAR_7, VAR_8; if (sscanf(*buf, "%d:%2d:%2d%*1[,.]%3d --> %d:%2d:%2d%*1[,.]%3d" "%*[ ]X1:%u X2:%u Y1:%u Y2:%u", &VAR_1, &VAR_2, &VAR_3, &VAR_4, &VAR_5, &VAR_6, &VAR_7, &VAR_8, x1, x2, y1, y2) >= 8) { int64_t start = (VAR_1*3600LL + VAR_2*60LL + VAR_3) * 1000LL + VAR_4; int64_t end = (VAR_5*3600LL + VAR_6*60LL + VAR_7) * 1000LL + VAR_8; *duration = end - start; *buf += strcspn(*buf, "\n") + 1; return start; } *buf += strcspn(*buf, "\n") + 1; } return AV_NOPTS_VALUE; }
[ "static int64_t FUNC_0(const char **buf, int *duration,\nint32_t *x1, int32_t *y1, int32_t *x2, int32_t *y2)\n{", "int VAR_0;", "for (VAR_0=0; VAR_0<2; VAR_0++) {", "int VAR_1, VAR_2, VAR_3, VAR_4;", "int VAR_5, VAR_6, VAR_7, VAR_8;", "if (sscanf(*buf, \"%d:%2d:%2d%*1[,.]%3d --> %d:%2d:%2d%*1[,.]%3d\"\n\"%*[ ]X1:%u X2:%u Y1:%u Y2:%u\",\n&VAR_1, &VAR_2, &VAR_3, &VAR_4,\n&VAR_5, &VAR_6, &VAR_7, &VAR_8,\nx1, x2, y1, y2) >= 8) {", "int64_t start = (VAR_1*3600LL + VAR_2*60LL + VAR_3) * 1000LL + VAR_4;", "int64_t end = (VAR_5*3600LL + VAR_6*60LL + VAR_7) * 1000LL + VAR_8;", "*duration = end - start;", "*buf += strcspn(*buf, \"\\n\") + 1;", "return start;", "}", "*buf += strcspn(*buf, \"\\n\") + 1;", "}", "return AV_NOPTS_VALUE;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 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 ] ]
7,527
static int handle_hypercall(CPUState *env, struct kvm_run *run) { int r; cpu_synchronize_state(env); r = s390_virtio_hypercall(env); kvm_arch_put_registers(env); return r; }
true
qemu
ea375f9ab8c76686dca0af8cb4f87a4eb569cad3
static int handle_hypercall(CPUState *env, struct kvm_run *run) { int r; cpu_synchronize_state(env); r = s390_virtio_hypercall(env); kvm_arch_put_registers(env); return r; }
{ "code": [ " cpu_synchronize_state(env);", " cpu_synchronize_state(env);", " cpu_synchronize_state(env);", " cpu_synchronize_state(env);", " cpu_synchronize_state(env);", " cpu_synchronize_state(env);", " cpu_synchronize_state(env);", " cpu_synchronize_state(env);", " kvm_arch_put_registers(env);" ], "line_no": [ 9, 9, 9, 9, 9, 9, 9, 9, 13 ] }
static int FUNC_0(CPUState *VAR_0, struct kvm_run *VAR_1) { int VAR_2; cpu_synchronize_state(VAR_0); VAR_2 = s390_virtio_hypercall(VAR_0); kvm_arch_put_registers(VAR_0); return VAR_2; }
[ "static int FUNC_0(CPUState *VAR_0, struct kvm_run *VAR_1)\n{", "int VAR_2;", "cpu_synchronize_state(VAR_0);", "VAR_2 = s390_virtio_hypercall(VAR_0);", "kvm_arch_put_registers(VAR_0);", "return VAR_2;", "}" ]
[ 0, 0, 1, 0, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ] ]
7,529
static void disas_ldst_reg_imm9(DisasContext *s, uint32_t insn, int opc, int size, int rt, bool is_vector) { int rn = extract32(insn, 5, 5); int imm9 = sextract32(insn, 12, 9); int idx = extract32(insn, 10, 2); bool is_signed = false; bool is_store = false; bool is_extended = false; bool is_unpriv = (idx == 2); bool iss_valid = !is_vector; bool post_index; bool writeback; TCGv_i64 tcg_addr; if (is_vector) { size |= (opc & 2) << 1; if (size > 4 || is_unpriv) { unallocated_encoding(s); return; } is_store = ((opc & 1) == 0); if (!fp_access_check(s)) { return; } } else { if (size == 3 && opc == 2) { /* PRFM - prefetch */ if (is_unpriv) { unallocated_encoding(s); return; } return; } if (opc == 3 && size > 1) { unallocated_encoding(s); return; } is_store = (opc == 0); is_signed = extract32(opc, 1, 1); is_extended = (size < 3) && extract32(opc, 0, 1); } switch (idx) { case 0: case 2: post_index = false; writeback = false; break; case 1: post_index = true; writeback = true; break; case 3: post_index = false; writeback = true; break; } if (rn == 31) { gen_check_sp_alignment(s); } tcg_addr = read_cpu_reg_sp(s, rn, 1); if (!post_index) { tcg_gen_addi_i64(tcg_addr, tcg_addr, imm9); } if (is_vector) { if (is_store) { do_fp_st(s, rt, tcg_addr, size); } else { do_fp_ld(s, rt, tcg_addr, size); } } else { TCGv_i64 tcg_rt = cpu_reg(s, rt); int memidx = is_unpriv ? get_a64_user_mem_index(s) : get_mem_index(s); bool iss_sf = disas_ldst_compute_iss_sf(size, is_signed, opc); if (is_store) { do_gpr_st_memidx(s, tcg_rt, tcg_addr, size, memidx, iss_valid, rt, iss_sf, false); } else { do_gpr_ld_memidx(s, tcg_rt, tcg_addr, size, is_signed, is_extended, memidx, iss_valid, rt, iss_sf, false); } } if (writeback) { TCGv_i64 tcg_rn = cpu_reg_sp(s, rn); if (post_index) { tcg_gen_addi_i64(tcg_addr, tcg_addr, imm9); } tcg_gen_mov_i64(tcg_rn, tcg_addr); } }
true
qemu
5ca66278c859bb1ded243755aeead2be6992ce73
static void disas_ldst_reg_imm9(DisasContext *s, uint32_t insn, int opc, int size, int rt, bool is_vector) { int rn = extract32(insn, 5, 5); int imm9 = sextract32(insn, 12, 9); int idx = extract32(insn, 10, 2); bool is_signed = false; bool is_store = false; bool is_extended = false; bool is_unpriv = (idx == 2); bool iss_valid = !is_vector; bool post_index; bool writeback; TCGv_i64 tcg_addr; if (is_vector) { size |= (opc & 2) << 1; if (size > 4 || is_unpriv) { unallocated_encoding(s); return; } is_store = ((opc & 1) == 0); if (!fp_access_check(s)) { return; } } else { if (size == 3 && opc == 2) { if (is_unpriv) { unallocated_encoding(s); return; } return; } if (opc == 3 && size > 1) { unallocated_encoding(s); return; } is_store = (opc == 0); is_signed = extract32(opc, 1, 1); is_extended = (size < 3) && extract32(opc, 0, 1); } switch (idx) { case 0: case 2: post_index = false; writeback = false; break; case 1: post_index = true; writeback = true; break; case 3: post_index = false; writeback = true; break; } if (rn == 31) { gen_check_sp_alignment(s); } tcg_addr = read_cpu_reg_sp(s, rn, 1); if (!post_index) { tcg_gen_addi_i64(tcg_addr, tcg_addr, imm9); } if (is_vector) { if (is_store) { do_fp_st(s, rt, tcg_addr, size); } else { do_fp_ld(s, rt, tcg_addr, size); } } else { TCGv_i64 tcg_rt = cpu_reg(s, rt); int memidx = is_unpriv ? get_a64_user_mem_index(s) : get_mem_index(s); bool iss_sf = disas_ldst_compute_iss_sf(size, is_signed, opc); if (is_store) { do_gpr_st_memidx(s, tcg_rt, tcg_addr, size, memidx, iss_valid, rt, iss_sf, false); } else { do_gpr_ld_memidx(s, tcg_rt, tcg_addr, size, is_signed, is_extended, memidx, iss_valid, rt, iss_sf, false); } } if (writeback) { TCGv_i64 tcg_rn = cpu_reg_sp(s, rn); if (post_index) { tcg_gen_addi_i64(tcg_addr, tcg_addr, imm9); } tcg_gen_mov_i64(tcg_rn, tcg_addr); } }
{ "code": [], "line_no": [] }
static void FUNC_0(DisasContext *VAR_0, uint32_t VAR_1, int VAR_2, int VAR_3, int VAR_4, bool VAR_5) { int VAR_6 = extract32(VAR_1, 5, 5); int VAR_7 = sextract32(VAR_1, 12, 9); int VAR_8 = extract32(VAR_1, 10, 2); bool is_signed = false; bool is_store = false; bool is_extended = false; bool is_unpriv = (VAR_8 == 2); bool iss_valid = !VAR_5; bool post_index; bool writeback; TCGv_i64 tcg_addr; if (VAR_5) { VAR_3 |= (VAR_2 & 2) << 1; if (VAR_3 > 4 || is_unpriv) { unallocated_encoding(VAR_0); return; } is_store = ((VAR_2 & 1) == 0); if (!fp_access_check(VAR_0)) { return; } } else { if (VAR_3 == 3 && VAR_2 == 2) { if (is_unpriv) { unallocated_encoding(VAR_0); return; } return; } if (VAR_2 == 3 && VAR_3 > 1) { unallocated_encoding(VAR_0); return; } is_store = (VAR_2 == 0); is_signed = extract32(VAR_2, 1, 1); is_extended = (VAR_3 < 3) && extract32(VAR_2, 0, 1); } switch (VAR_8) { case 0: case 2: post_index = false; writeback = false; break; case 1: post_index = true; writeback = true; break; case 3: post_index = false; writeback = true; break; } if (VAR_6 == 31) { gen_check_sp_alignment(VAR_0); } tcg_addr = read_cpu_reg_sp(VAR_0, VAR_6, 1); if (!post_index) { tcg_gen_addi_i64(tcg_addr, tcg_addr, VAR_7); } if (VAR_5) { if (is_store) { do_fp_st(VAR_0, VAR_4, tcg_addr, VAR_3); } else { do_fp_ld(VAR_0, VAR_4, tcg_addr, VAR_3); } } else { TCGv_i64 tcg_rt = cpu_reg(VAR_0, VAR_4); int VAR_9 = is_unpriv ? get_a64_user_mem_index(VAR_0) : get_mem_index(VAR_0); bool iss_sf = disas_ldst_compute_iss_sf(VAR_3, is_signed, VAR_2); if (is_store) { do_gpr_st_memidx(VAR_0, tcg_rt, tcg_addr, VAR_3, VAR_9, iss_valid, VAR_4, iss_sf, false); } else { do_gpr_ld_memidx(VAR_0, tcg_rt, tcg_addr, VAR_3, is_signed, is_extended, VAR_9, iss_valid, VAR_4, iss_sf, false); } } if (writeback) { TCGv_i64 tcg_rn = cpu_reg_sp(VAR_0, VAR_6); if (post_index) { tcg_gen_addi_i64(tcg_addr, tcg_addr, VAR_7); } tcg_gen_mov_i64(tcg_rn, tcg_addr); } }
[ "static void FUNC_0(DisasContext *VAR_0, uint32_t VAR_1,\nint VAR_2,\nint VAR_3,\nint VAR_4,\nbool VAR_5)\n{", "int VAR_6 = extract32(VAR_1, 5, 5);", "int VAR_7 = sextract32(VAR_1, 12, 9);", "int VAR_8 = extract32(VAR_1, 10, 2);", "bool is_signed = false;", "bool is_store = false;", "bool is_extended = false;", "bool is_unpriv = (VAR_8 == 2);", "bool iss_valid = !VAR_5;", "bool post_index;", "bool writeback;", "TCGv_i64 tcg_addr;", "if (VAR_5) {", "VAR_3 |= (VAR_2 & 2) << 1;", "if (VAR_3 > 4 || is_unpriv) {", "unallocated_encoding(VAR_0);", "return;", "}", "is_store = ((VAR_2 & 1) == 0);", "if (!fp_access_check(VAR_0)) {", "return;", "}", "} else {", "if (VAR_3 == 3 && VAR_2 == 2) {", "if (is_unpriv) {", "unallocated_encoding(VAR_0);", "return;", "}", "return;", "}", "if (VAR_2 == 3 && VAR_3 > 1) {", "unallocated_encoding(VAR_0);", "return;", "}", "is_store = (VAR_2 == 0);", "is_signed = extract32(VAR_2, 1, 1);", "is_extended = (VAR_3 < 3) && extract32(VAR_2, 0, 1);", "}", "switch (VAR_8) {", "case 0:\ncase 2:\npost_index = false;", "writeback = false;", "break;", "case 1:\npost_index = true;", "writeback = true;", "break;", "case 3:\npost_index = false;", "writeback = true;", "break;", "}", "if (VAR_6 == 31) {", "gen_check_sp_alignment(VAR_0);", "}", "tcg_addr = read_cpu_reg_sp(VAR_0, VAR_6, 1);", "if (!post_index) {", "tcg_gen_addi_i64(tcg_addr, tcg_addr, VAR_7);", "}", "if (VAR_5) {", "if (is_store) {", "do_fp_st(VAR_0, VAR_4, tcg_addr, VAR_3);", "} else {", "do_fp_ld(VAR_0, VAR_4, tcg_addr, VAR_3);", "}", "} else {", "TCGv_i64 tcg_rt = cpu_reg(VAR_0, VAR_4);", "int VAR_9 = is_unpriv ? get_a64_user_mem_index(VAR_0) : get_mem_index(VAR_0);", "bool iss_sf = disas_ldst_compute_iss_sf(VAR_3, is_signed, VAR_2);", "if (is_store) {", "do_gpr_st_memidx(VAR_0, tcg_rt, tcg_addr, VAR_3, VAR_9,\niss_valid, VAR_4, iss_sf, false);", "} else {", "do_gpr_ld_memidx(VAR_0, tcg_rt, tcg_addr, VAR_3,\nis_signed, is_extended, VAR_9,\niss_valid, VAR_4, iss_sf, false);", "}", "}", "if (writeback) {", "TCGv_i64 tcg_rn = cpu_reg_sp(VAR_0, VAR_6);", "if (post_index) {", "tcg_gen_addi_i64(tcg_addr, tcg_addr, VAR_7);", "}", "tcg_gen_mov_i64(tcg_rn, tcg_addr);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 95 ], [ 97, 99, 101 ], [ 103 ], [ 105 ], [ 107, 109 ], [ 111 ], [ 113 ], [ 115, 117 ], [ 119 ], [ 121 ], [ 125 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 139 ], [ 141 ], [ 143 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 169 ], [ 171, 173 ], [ 175 ], [ 177, 179, 181 ], [ 183 ], [ 185 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ] ]
7,532
static int hevc_find_frame_end(AVCodecParserContext *s, const uint8_t *buf, int buf_size) { HEVCParserContext *ctx = s->priv_data; ParseContext *pc = &ctx->pc; int i; for (i = 0; i < buf_size; i++) { int nut; pc->state64 = (pc->state64 << 8) | buf[i]; if (((pc->state64 >> 3 * 8) & 0xFFFFFF) != START_CODE) continue; nut = (pc->state64 >> 2 * 8 + 1) & 0x3F; // Beginning of access unit if ((nut >= HEVC_NAL_VPS && nut <= HEVC_NAL_AUD) || nut == HEVC_NAL_SEI_PREFIX || (nut >= 41 && nut <= 44) || (nut >= 48 && nut <= 55)) { if (pc->frame_start_found) { pc->frame_start_found = 0; return i - 5; } } else if (nut <= HEVC_NAL_RASL_R || (nut >= HEVC_NAL_BLA_W_LP && nut <= HEVC_NAL_CRA_NUT)) { int first_slice_segment_in_pic_flag = buf[i] >> 7; if (first_slice_segment_in_pic_flag) { if (!pc->frame_start_found) { pc->frame_start_found = 1; } else { // First slice of next frame found pc->frame_start_found = 0; return i - 5; } } } } return END_NOT_FOUND; }
true
FFmpeg
ca2209d67af0a73fe0edb2fce1cea2445dbfd8db
static int hevc_find_frame_end(AVCodecParserContext *s, const uint8_t *buf, int buf_size) { HEVCParserContext *ctx = s->priv_data; ParseContext *pc = &ctx->pc; int i; for (i = 0; i < buf_size; i++) { int nut; pc->state64 = (pc->state64 << 8) | buf[i]; if (((pc->state64 >> 3 * 8) & 0xFFFFFF) != START_CODE) continue; nut = (pc->state64 >> 2 * 8 + 1) & 0x3F; if ((nut >= HEVC_NAL_VPS && nut <= HEVC_NAL_AUD) || nut == HEVC_NAL_SEI_PREFIX || (nut >= 41 && nut <= 44) || (nut >= 48 && nut <= 55)) { if (pc->frame_start_found) { pc->frame_start_found = 0; return i - 5; } } else if (nut <= HEVC_NAL_RASL_R || (nut >= HEVC_NAL_BLA_W_LP && nut <= HEVC_NAL_CRA_NUT)) { int first_slice_segment_in_pic_flag = buf[i] >> 7; if (first_slice_segment_in_pic_flag) { if (!pc->frame_start_found) { pc->frame_start_found = 1; } else { pc->frame_start_found = 0; return i - 5; } } } } return END_NOT_FOUND; }
{ "code": [ " if ((nut >= HEVC_NAL_VPS && nut <= HEVC_NAL_AUD) || nut == HEVC_NAL_SEI_PREFIX ||" ], "line_no": [ 35 ] }
static int FUNC_0(AVCodecParserContext *VAR_0, const uint8_t *VAR_1, int VAR_2) { HEVCParserContext *ctx = VAR_0->priv_data; ParseContext *pc = &ctx->pc; int VAR_3; for (VAR_3 = 0; VAR_3 < VAR_2; VAR_3++) { int VAR_4; pc->state64 = (pc->state64 << 8) | VAR_1[VAR_3]; if (((pc->state64 >> 3 * 8) & 0xFFFFFF) != START_CODE) continue; VAR_4 = (pc->state64 >> 2 * 8 + 1) & 0x3F; if ((VAR_4 >= HEVC_NAL_VPS && VAR_4 <= HEVC_NAL_AUD) || VAR_4 == HEVC_NAL_SEI_PREFIX || (VAR_4 >= 41 && VAR_4 <= 44) || (VAR_4 >= 48 && VAR_4 <= 55)) { if (pc->frame_start_found) { pc->frame_start_found = 0; return VAR_3 - 5; } } else if (VAR_4 <= HEVC_NAL_RASL_R || (VAR_4 >= HEVC_NAL_BLA_W_LP && VAR_4 <= HEVC_NAL_CRA_NUT)) { int VAR_5 = VAR_1[VAR_3] >> 7; if (VAR_5) { if (!pc->frame_start_found) { pc->frame_start_found = 1; } else { pc->frame_start_found = 0; return VAR_3 - 5; } } } } return END_NOT_FOUND; }
[ "static int FUNC_0(AVCodecParserContext *VAR_0, const uint8_t *VAR_1,\nint VAR_2)\n{", "HEVCParserContext *ctx = VAR_0->priv_data;", "ParseContext *pc = &ctx->pc;", "int VAR_3;", "for (VAR_3 = 0; VAR_3 < VAR_2; VAR_3++) {", "int VAR_4;", "pc->state64 = (pc->state64 << 8) | VAR_1[VAR_3];", "if (((pc->state64 >> 3 * 8) & 0xFFFFFF) != START_CODE)\ncontinue;", "VAR_4 = (pc->state64 >> 2 * 8 + 1) & 0x3F;", "if ((VAR_4 >= HEVC_NAL_VPS && VAR_4 <= HEVC_NAL_AUD) || VAR_4 == HEVC_NAL_SEI_PREFIX ||\n(VAR_4 >= 41 && VAR_4 <= 44) || (VAR_4 >= 48 && VAR_4 <= 55)) {", "if (pc->frame_start_found) {", "pc->frame_start_found = 0;", "return VAR_3 - 5;", "}", "} else if (VAR_4 <= HEVC_NAL_RASL_R ||", "(VAR_4 >= HEVC_NAL_BLA_W_LP && VAR_4 <= HEVC_NAL_CRA_NUT)) {", "int VAR_5 = VAR_1[VAR_3] >> 7;", "if (VAR_5) {", "if (!pc->frame_start_found) {", "pc->frame_start_found = 1;", "} else {", "pc->frame_start_found = 0;", "return VAR_3 - 5;", "}", "}", "}", "}", "return END_NOT_FOUND;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 21 ], [ 25, 27 ], [ 31 ], [ 35, 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 75 ], [ 77 ] ]
7,533
static void vnc_debug_gnutls_log(int level, const char* str) { VNC_DEBUG("%d %s", level, str); }
true
qemu
3e305e4a4752f70c0b5c3cf5b43ec957881714f7
static void vnc_debug_gnutls_log(int level, const char* str) { VNC_DEBUG("%d %s", level, str); }
{ "code": [ "static void vnc_debug_gnutls_log(int level, const char* str) {", " VNC_DEBUG(\"%d %s\", level, str);" ], "line_no": [ 1, 3 ] }
static void FUNC_0(int VAR_0, const char* VAR_1) { VNC_DEBUG("%d %s", VAR_0, VAR_1); }
[ "static void FUNC_0(int VAR_0, const char* VAR_1) {", "VNC_DEBUG(\"%d %s\", VAR_0, VAR_1);", "}" ]
[ 1, 1, 0 ]
[ [ 1 ], [ 3 ], [ 5 ] ]
7,534
static int mov_write_audio_tag(ByteIOContext *pb, MOVTrack* track) { int pos = url_ftell(pb); put_be32(pb, 0); /* size */ if(track->enc->codec_id == CODEC_ID_PCM_MULAW) put_tag(pb, "ulaw"); else if(track->enc->codec_id == CODEC_ID_PCM_ALAW) put_tag(pb, "alaw"); else if(track->enc->codec_id == CODEC_ID_ADPCM_IMA_QT) put_tag(pb, "ima4"); else if(track->enc->codec_id == CODEC_ID_MACE3) put_tag(pb, "MAC3"); else if(track->enc->codec_id == CODEC_ID_MACE6) put_tag(pb, "MAC6"); else if(track->enc->codec_id == CODEC_ID_AAC) put_tag(pb, "mp4a"); else if(track->enc->codec_id == CODEC_ID_AMR_NB) put_tag(pb, "samr"); else put_tag(pb, " "); put_be32(pb, 0); /* Reserved */ put_be16(pb, 0); /* Reserved */ put_be16(pb, 1); /* Data-reference index, XXX == 1 */ /* SoundDescription */ put_be16(pb, 0); /* Version */ put_be16(pb, 0); /* Revision level */ put_be32(pb, 0); /* Reserved */ put_be16(pb, track->enc->channels); /* Number of channels */ /* TODO: Currently hard-coded to 16-bit, there doesn't seem to be a good way to get number of bits of audio */ put_be16(pb, 0x10); /* Reserved */ put_be16(pb, 0); /* compression ID (= 0) */ put_be16(pb, 0); /* packet size (= 0) */ put_be16(pb, track->timescale); /* Time scale */ put_be16(pb, 0); /* Reserved */ if(track->enc->codec_id == CODEC_ID_AAC) mov_write_esds_tag(pb, track); if(track->enc->codec_id == CODEC_ID_AMR_NB) mov_write_damr_tag(pb); return updateSize (pb, pos); }
false
FFmpeg
69dde1ad36b7d95b8b9268f414aa6c076212ed41
static int mov_write_audio_tag(ByteIOContext *pb, MOVTrack* track) { int pos = url_ftell(pb); put_be32(pb, 0); if(track->enc->codec_id == CODEC_ID_PCM_MULAW) put_tag(pb, "ulaw"); else if(track->enc->codec_id == CODEC_ID_PCM_ALAW) put_tag(pb, "alaw"); else if(track->enc->codec_id == CODEC_ID_ADPCM_IMA_QT) put_tag(pb, "ima4"); else if(track->enc->codec_id == CODEC_ID_MACE3) put_tag(pb, "MAC3"); else if(track->enc->codec_id == CODEC_ID_MACE6) put_tag(pb, "MAC6"); else if(track->enc->codec_id == CODEC_ID_AAC) put_tag(pb, "mp4a"); else if(track->enc->codec_id == CODEC_ID_AMR_NB) put_tag(pb, "samr"); else put_tag(pb, " "); put_be32(pb, 0); put_be16(pb, 0); put_be16(pb, 1); put_be16(pb, 0); put_be16(pb, 0); put_be32(pb, 0); put_be16(pb, track->enc->channels); put_be16(pb, 0x10); put_be16(pb, 0); put_be16(pb, 0); put_be16(pb, track->timescale); put_be16(pb, 0); if(track->enc->codec_id == CODEC_ID_AAC) mov_write_esds_tag(pb, track); if(track->enc->codec_id == CODEC_ID_AMR_NB) mov_write_damr_tag(pb); return updateSize (pb, pos); }
{ "code": [], "line_no": [] }
static int FUNC_0(ByteIOContext *VAR_0, MOVTrack* VAR_1) { int VAR_2 = url_ftell(VAR_0); put_be32(VAR_0, 0); if(VAR_1->enc->codec_id == CODEC_ID_PCM_MULAW) put_tag(VAR_0, "ulaw"); else if(VAR_1->enc->codec_id == CODEC_ID_PCM_ALAW) put_tag(VAR_0, "alaw"); else if(VAR_1->enc->codec_id == CODEC_ID_ADPCM_IMA_QT) put_tag(VAR_0, "ima4"); else if(VAR_1->enc->codec_id == CODEC_ID_MACE3) put_tag(VAR_0, "MAC3"); else if(VAR_1->enc->codec_id == CODEC_ID_MACE6) put_tag(VAR_0, "MAC6"); else if(VAR_1->enc->codec_id == CODEC_ID_AAC) put_tag(VAR_0, "mp4a"); else if(VAR_1->enc->codec_id == CODEC_ID_AMR_NB) put_tag(VAR_0, "samr"); else put_tag(VAR_0, " "); put_be32(VAR_0, 0); put_be16(VAR_0, 0); put_be16(VAR_0, 1); put_be16(VAR_0, 0); put_be16(VAR_0, 0); put_be32(VAR_0, 0); put_be16(VAR_0, VAR_1->enc->channels); put_be16(VAR_0, 0x10); put_be16(VAR_0, 0); put_be16(VAR_0, 0); put_be16(VAR_0, VAR_1->timescale); put_be16(VAR_0, 0); if(VAR_1->enc->codec_id == CODEC_ID_AAC) mov_write_esds_tag(VAR_0, VAR_1); if(VAR_1->enc->codec_id == CODEC_ID_AMR_NB) mov_write_damr_tag(VAR_0); return updateSize (VAR_0, VAR_2); }
[ "static int FUNC_0(ByteIOContext *VAR_0, MOVTrack* VAR_1)\n{", "int VAR_2 = url_ftell(VAR_0);", "put_be32(VAR_0, 0);", "if(VAR_1->enc->codec_id == CODEC_ID_PCM_MULAW)\nput_tag(VAR_0, \"ulaw\");", "else if(VAR_1->enc->codec_id == CODEC_ID_PCM_ALAW)\nput_tag(VAR_0, \"alaw\");", "else if(VAR_1->enc->codec_id == CODEC_ID_ADPCM_IMA_QT)\nput_tag(VAR_0, \"ima4\");", "else if(VAR_1->enc->codec_id == CODEC_ID_MACE3)\nput_tag(VAR_0, \"MAC3\");", "else if(VAR_1->enc->codec_id == CODEC_ID_MACE6)\nput_tag(VAR_0, \"MAC6\");", "else if(VAR_1->enc->codec_id == CODEC_ID_AAC)\nput_tag(VAR_0, \"mp4a\");", "else if(VAR_1->enc->codec_id == CODEC_ID_AMR_NB)\nput_tag(VAR_0, \"samr\");", "else\nput_tag(VAR_0, \" \");", "put_be32(VAR_0, 0);", "put_be16(VAR_0, 0);", "put_be16(VAR_0, 1);", "put_be16(VAR_0, 0);", "put_be16(VAR_0, 0);", "put_be32(VAR_0, 0);", "put_be16(VAR_0, VAR_1->enc->channels);", "put_be16(VAR_0, 0x10);", "put_be16(VAR_0, 0);", "put_be16(VAR_0, 0);", "put_be16(VAR_0, VAR_1->timescale);", "put_be16(VAR_0, 0);", "if(VAR_1->enc->codec_id == CODEC_ID_AAC)\nmov_write_esds_tag(VAR_0, VAR_1);", "if(VAR_1->enc->codec_id == CODEC_ID_AMR_NB)\nmov_write_damr_tag(VAR_0);", "return updateSize (VAR_0, VAR_2);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11, 13 ], [ 15, 17 ], [ 19, 21 ], [ 23, 25 ], [ 27, 29 ], [ 31, 33 ], [ 35, 37 ], [ 39, 41 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 79, 81 ], [ 83, 85 ], [ 87 ], [ 89 ] ]
7,535
static void usbredir_alt_setting_status(void *priv, uint32_t id, struct usb_redir_alt_setting_status_header *alt_setting_status) { USBRedirDevice *dev = priv; AsyncURB *aurb; int len = 0; DPRINTF("alt status %d intf %d alt %d id: %u\n", alt_setting_status->status, alt_setting_status->interface, alt_setting_status->alt, id); aurb = async_find(dev, id); if (!aurb) { return; } if (aurb->packet) { if (aurb->get) { dev->dev.data_buf[0] = alt_setting_status->alt; len = 1; } aurb->packet->len = usbredir_handle_status(dev, alt_setting_status->status, len); usb_generic_async_ctrl_complete(&dev->dev, aurb->packet); } async_free(dev, aurb); }
true
qemu
4f4321c11ff6e98583846bfd6f0e81954924b003
static void usbredir_alt_setting_status(void *priv, uint32_t id, struct usb_redir_alt_setting_status_header *alt_setting_status) { USBRedirDevice *dev = priv; AsyncURB *aurb; int len = 0; DPRINTF("alt status %d intf %d alt %d id: %u\n", alt_setting_status->status, alt_setting_status->interface, alt_setting_status->alt, id); aurb = async_find(dev, id); if (!aurb) { return; } if (aurb->packet) { if (aurb->get) { dev->dev.data_buf[0] = alt_setting_status->alt; len = 1; } aurb->packet->len = usbredir_handle_status(dev, alt_setting_status->status, len); usb_generic_async_ctrl_complete(&dev->dev, aurb->packet); } async_free(dev, aurb); }
{ "code": [ " aurb->packet->len =", " aurb->packet->len =" ], "line_no": [ 43, 43 ] }
static void FUNC_0(void *VAR_0, uint32_t VAR_1, struct usb_redir_alt_setting_status_header *VAR_2) { USBRedirDevice *dev = VAR_0; AsyncURB *aurb; int VAR_3 = 0; DPRINTF("alt status %d intf %d alt %d VAR_1: %u\n", VAR_2->status, VAR_2->interface, VAR_2->alt, VAR_1); aurb = async_find(dev, VAR_1); if (!aurb) { return; } if (aurb->packet) { if (aurb->get) { dev->dev.data_buf[0] = VAR_2->alt; VAR_3 = 1; } aurb->packet->VAR_3 = usbredir_handle_status(dev, VAR_2->status, VAR_3); usb_generic_async_ctrl_complete(&dev->dev, aurb->packet); } async_free(dev, aurb); }
[ "static void FUNC_0(void *VAR_0, uint32_t VAR_1,\nstruct usb_redir_alt_setting_status_header *VAR_2)\n{", "USBRedirDevice *dev = VAR_0;", "AsyncURB *aurb;", "int VAR_3 = 0;", "DPRINTF(\"alt status %d intf %d alt %d VAR_1: %u\\n\",\nVAR_2->status,\nVAR_2->interface,\nVAR_2->alt, VAR_1);", "aurb = async_find(dev, VAR_1);", "if (!aurb) {", "return;", "}", "if (aurb->packet) {", "if (aurb->get) {", "dev->dev.data_buf[0] = VAR_2->alt;", "VAR_3 = 1;", "}", "aurb->packet->VAR_3 =\nusbredir_handle_status(dev, VAR_2->status, VAR_3);", "usb_generic_async_ctrl_complete(&dev->dev, aurb->packet);", "}", "async_free(dev, aurb);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15, 17, 19, 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43, 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ] ]
7,536
PPC_OP(setcrfbit) { T1 = (T1 & PARAM(1)) | (T0 << PARAM(2)); RETURN(); }
true
qemu
d9bce9d99f4656ae0b0127f7472db9067b8f84ab
PPC_OP(setcrfbit) { T1 = (T1 & PARAM(1)) | (T0 << PARAM(2)); RETURN(); }
{ "code": [ " T1 = (T1 & PARAM(1)) | (T0 << PARAM(2)); ", " RETURN();", " RETURN();" ], "line_no": [ 5, 7, 7 ] }
FUNC_0(VAR_0) { T1 = (T1 & PARAM(1)) | (T0 << PARAM(2)); RETURN(); }
[ "FUNC_0(VAR_0)\n{", "T1 = (T1 & PARAM(1)) | (T0 << PARAM(2));", "RETURN();", "}" ]
[ 0, 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ] ]
7,537
PPC_OP(test_ctr_false) { T0 = (regs->ctr != 0 && (T0 & PARAM(1)) == 0); RETURN(); }
true
qemu
d9bce9d99f4656ae0b0127f7472db9067b8f84ab
PPC_OP(test_ctr_false) { T0 = (regs->ctr != 0 && (T0 & PARAM(1)) == 0); RETURN(); }
{ "code": [ "PPC_OP(test_ctr_false)", " T0 = (regs->ctr != 0 && (T0 & PARAM(1)) == 0);", " RETURN();", " RETURN();" ], "line_no": [ 1, 5, 7, 7 ] }
FUNC_0(VAR_0) { T0 = (regs->ctr != 0 && (T0 & PARAM(1)) == 0); RETURN(); }
[ "FUNC_0(VAR_0)\n{", "T0 = (regs->ctr != 0 && (T0 & PARAM(1)) == 0);", "RETURN();", "}" ]
[ 1, 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ] ]
7,539
void blk_io_limits_disable(BlockBackend *blk) { assert(blk->public.throttle_group_member.throttle_state); bdrv_drained_begin(blk_bs(blk)); throttle_group_unregister_tgm(&blk->public.throttle_group_member); bdrv_drained_end(blk_bs(blk)); }
true
qemu
48bf7ea81aa848027bad24f7e7791b503dff727d
void blk_io_limits_disable(BlockBackend *blk) { assert(blk->public.throttle_group_member.throttle_state); bdrv_drained_begin(blk_bs(blk)); throttle_group_unregister_tgm(&blk->public.throttle_group_member); bdrv_drained_end(blk_bs(blk)); }
{ "code": [ " assert(blk->public.throttle_group_member.throttle_state);", " bdrv_drained_begin(blk_bs(blk));", " throttle_group_unregister_tgm(&blk->public.throttle_group_member);", " bdrv_drained_end(blk_bs(blk));" ], "line_no": [ 5, 7, 9, 11 ] }
void FUNC_0(BlockBackend *VAR_0) { assert(VAR_0->public.throttle_group_member.throttle_state); bdrv_drained_begin(blk_bs(VAR_0)); throttle_group_unregister_tgm(&VAR_0->public.throttle_group_member); bdrv_drained_end(blk_bs(VAR_0)); }
[ "void FUNC_0(BlockBackend *VAR_0)\n{", "assert(VAR_0->public.throttle_group_member.throttle_state);", "bdrv_drained_begin(blk_bs(VAR_0));", "throttle_group_unregister_tgm(&VAR_0->public.throttle_group_member);", "bdrv_drained_end(blk_bs(VAR_0));", "}" ]
[ 0, 1, 1, 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ] ]
7,541
void ff_framequeue_skip_samples(FFFrameQueue *fq, size_t samples, AVRational time_base) { FFFrameBucket *b; size_t bytes; int planar, planes, i; check_consistency(fq); av_assert1(fq->queued); b = bucket(fq, 0); av_assert1(samples < b->frame->nb_samples); planar = av_sample_fmt_is_planar(b->frame->format); planes = planar ? b->frame->channels : 1; bytes = samples * av_get_bytes_per_sample(b->frame->format); if (!planar) bytes *= b->frame->channels; if (b->frame->pts != AV_NOPTS_VALUE) b->frame->pts += av_rescale_q(samples, av_make_q(1, b->frame->sample_rate), time_base); b->frame->nb_samples -= samples; b->frame->linesize[0] -= bytes; for (i = 0; i < planes; i++) b->frame->extended_data[i] += bytes; for (i = 0; i < planes && i < AV_NUM_DATA_POINTERS; i++) b->frame->data[i] = b->frame->extended_data[i]; fq->total_samples_tail += samples; ff_framequeue_update_peeked(fq, 0); }
true
FFmpeg
fc3a03fcf9cd7eafe7342e2508e6128888efa0bb
void ff_framequeue_skip_samples(FFFrameQueue *fq, size_t samples, AVRational time_base) { FFFrameBucket *b; size_t bytes; int planar, planes, i; check_consistency(fq); av_assert1(fq->queued); b = bucket(fq, 0); av_assert1(samples < b->frame->nb_samples); planar = av_sample_fmt_is_planar(b->frame->format); planes = planar ? b->frame->channels : 1; bytes = samples * av_get_bytes_per_sample(b->frame->format); if (!planar) bytes *= b->frame->channels; if (b->frame->pts != AV_NOPTS_VALUE) b->frame->pts += av_rescale_q(samples, av_make_q(1, b->frame->sample_rate), time_base); b->frame->nb_samples -= samples; b->frame->linesize[0] -= bytes; for (i = 0; i < planes; i++) b->frame->extended_data[i] += bytes; for (i = 0; i < planes && i < AV_NUM_DATA_POINTERS; i++) b->frame->data[i] = b->frame->extended_data[i]; fq->total_samples_tail += samples; ff_framequeue_update_peeked(fq, 0); }
{ "code": [], "line_no": [] }
void FUNC_0(FFFrameQueue *VAR_0, size_t VAR_1, AVRational VAR_2) { FFFrameBucket *b; size_t bytes; int VAR_3, VAR_4, VAR_5; check_consistency(VAR_0); av_assert1(VAR_0->queued); b = bucket(VAR_0, 0); av_assert1(VAR_1 < b->frame->nb_samples); VAR_3 = av_sample_fmt_is_planar(b->frame->format); VAR_4 = VAR_3 ? b->frame->channels : 1; bytes = VAR_1 * av_get_bytes_per_sample(b->frame->format); if (!VAR_3) bytes *= b->frame->channels; if (b->frame->pts != AV_NOPTS_VALUE) b->frame->pts += av_rescale_q(VAR_1, av_make_q(1, b->frame->sample_rate), VAR_2); b->frame->nb_samples -= VAR_1; b->frame->linesize[0] -= bytes; for (VAR_5 = 0; VAR_5 < VAR_4; VAR_5++) b->frame->extended_data[VAR_5] += bytes; for (VAR_5 = 0; VAR_5 < VAR_4 && VAR_5 < AV_NUM_DATA_POINTERS; VAR_5++) b->frame->data[VAR_5] = b->frame->extended_data[VAR_5]; VAR_0->total_samples_tail += VAR_1; ff_framequeue_update_peeked(VAR_0, 0); }
[ "void FUNC_0(FFFrameQueue *VAR_0, size_t VAR_1, AVRational VAR_2)\n{", "FFFrameBucket *b;", "size_t bytes;", "int VAR_3, VAR_4, VAR_5;", "check_consistency(VAR_0);", "av_assert1(VAR_0->queued);", "b = bucket(VAR_0, 0);", "av_assert1(VAR_1 < b->frame->nb_samples);", "VAR_3 = av_sample_fmt_is_planar(b->frame->format);", "VAR_4 = VAR_3 ? b->frame->channels : 1;", "bytes = VAR_1 * av_get_bytes_per_sample(b->frame->format);", "if (!VAR_3)\nbytes *= b->frame->channels;", "if (b->frame->pts != AV_NOPTS_VALUE)\nb->frame->pts += av_rescale_q(VAR_1, av_make_q(1, b->frame->sample_rate), VAR_2);", "b->frame->nb_samples -= VAR_1;", "b->frame->linesize[0] -= bytes;", "for (VAR_5 = 0; VAR_5 < VAR_4; VAR_5++)", "b->frame->extended_data[VAR_5] += bytes;", "for (VAR_5 = 0; VAR_5 < VAR_4 && VAR_5 < AV_NUM_DATA_POINTERS; VAR_5++)", "b->frame->data[VAR_5] = b->frame->extended_data[VAR_5];", "VAR_0->total_samples_tail += VAR_1;", "ff_framequeue_update_peeked(VAR_0, 0);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27, 29 ], [ 31, 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 50 ], [ 52 ] ]
7,542
static void tcg_out_qemu_st(TCGContext *s, const TCGArg *args, int opc) { int addr_reg, data_reg, arg0, arg1, arg2, mem_index, s_bits; #if defined(CONFIG_SOFTMMU) uint32_t *label1_ptr, *label2_ptr; data_reg = *args++; addr_reg = *args++; mem_index = *args; s_bits = opc; arg0 = TCG_REG_O0; arg1 = TCG_REG_O1; arg2 = TCG_REG_O2; #if defined(CONFIG_SOFTMMU) /* srl addr_reg, x, arg1 */ tcg_out_arithi(s, arg1, addr_reg, TARGET_PAGE_BITS - CPU_TLB_ENTRY_BITS, SHIFT_SRL); tcg_out_arithi(s, arg0, addr_reg, TARGET_PAGE_MASK | ((1 << s_bits) - 1), ARITH_AND); /* and arg1, x, arg1 */ tcg_out_andi(s, arg1, (CPU_TLB_SIZE - 1) << CPU_TLB_ENTRY_BITS); /* add arg1, x, arg1 */ tcg_out_addi(s, arg1, offsetof(CPUState, tlb_table[mem_index][0].addr_write)); /* add env, arg1, arg1 */ tcg_out_arith(s, arg1, TCG_AREG0, arg1, ARITH_ADD); /* ld [arg1], arg2 */ tcg_out32(s, TARGET_LD_OP | INSN_RD(arg2) | INSN_RS1(arg1) | INSN_RS2(TCG_REG_G0)); /* subcc arg0, arg2, %g0 */ tcg_out_arith(s, TCG_REG_G0, arg0, arg2, ARITH_SUBCC); /* will become: be label1 */ label1_ptr = (uint32_t *)s->code_ptr; tcg_out32(s, 0); /* mov (delay slot) */ tcg_out_mov(s, arg0, addr_reg); /* mov */ tcg_out_mov(s, arg1, data_reg); /* mov */ tcg_out_movi(s, TCG_TYPE_I32, arg2, mem_index); /* XXX: move that code at the end of the TB */ /* qemu_st_helper[s_bits](arg0, arg1, arg2) */ tcg_out32(s, CALL | ((((tcg_target_ulong)qemu_st_helpers[s_bits] - (tcg_target_ulong)s->code_ptr) >> 2) & 0x3fffffff)); /* Store AREG0 in stack to avoid ugly glibc bugs that mangle global registers */ // delay slot tcg_out_ldst(s, TCG_AREG0, TCG_REG_CALL_STACK, TCG_TARGET_CALL_STACK_OFFSET - sizeof(long), HOST_ST_OP); tcg_out_ldst(s, TCG_AREG0, TCG_REG_CALL_STACK, TCG_TARGET_CALL_STACK_OFFSET - sizeof(long), HOST_LD_OP); /* will become: ba label2 */ label2_ptr = (uint32_t *)s->code_ptr; tcg_out32(s, 0); /* nop (delay slot) */ tcg_out_nop(s); /* label1: */ *label1_ptr = (INSN_OP(0) | INSN_COND(COND_E, 0) | INSN_OP2(0x2) | INSN_OFF22((unsigned long)s->code_ptr - (unsigned long)label1_ptr)); /* ld [arg1 + x], arg1 */ tcg_out_ldst(s, arg1, arg1, offsetof(CPUTLBEntry, addend) - offsetof(CPUTLBEntry, addr_write), HOST_LD_OP); /* add addr_reg, arg1, arg0 */ tcg_out_arith(s, arg0, addr_reg, arg1, ARITH_ADD); arg0 = addr_reg; switch(opc) { case 0: /* stb data_reg, [arg0] */ tcg_out_ldst(s, data_reg, arg0, 0, STB); break; case 1: #ifdef TARGET_WORDS_BIGENDIAN /* sth data_reg, [arg0] */ tcg_out_ldst(s, data_reg, arg0, 0, STH); /* stha data_reg, [arg0] ASI_PRIMARY_LITTLE */ tcg_out_ldst_asi(s, data_reg, arg0, 0, STHA, ASI_PRIMARY_LITTLE); break; case 2: #ifdef TARGET_WORDS_BIGENDIAN /* stw data_reg, [arg0] */ tcg_out_ldst(s, data_reg, arg0, 0, STW); /* stwa data_reg, [arg0] ASI_PRIMARY_LITTLE */ tcg_out_ldst_asi(s, data_reg, arg0, 0, STWA, ASI_PRIMARY_LITTLE); break; case 3: #ifdef TARGET_WORDS_BIGENDIAN /* stx data_reg, [arg0] */ tcg_out_ldst(s, data_reg, arg0, 0, STX); /* stxa data_reg, [arg0] ASI_PRIMARY_LITTLE */ tcg_out_ldst_asi(s, data_reg, arg0, 0, STXA, ASI_PRIMARY_LITTLE); break; default: tcg_abort(); } #if defined(CONFIG_SOFTMMU) /* label2: */ *label2_ptr = (INSN_OP(0) | INSN_COND(COND_A, 0) | INSN_OP2(0x2) | INSN_OFF22((unsigned long)s->code_ptr - (unsigned long)label2_ptr)); }
true
qemu
90cbed4656108fec86d157ced39192e0774a6615
static void tcg_out_qemu_st(TCGContext *s, const TCGArg *args, int opc) { int addr_reg, data_reg, arg0, arg1, arg2, mem_index, s_bits; #if defined(CONFIG_SOFTMMU) uint32_t *label1_ptr, *label2_ptr; data_reg = *args++; addr_reg = *args++; mem_index = *args; s_bits = opc; arg0 = TCG_REG_O0; arg1 = TCG_REG_O1; arg2 = TCG_REG_O2; #if defined(CONFIG_SOFTMMU) tcg_out_arithi(s, arg1, addr_reg, TARGET_PAGE_BITS - CPU_TLB_ENTRY_BITS, SHIFT_SRL); tcg_out_arithi(s, arg0, addr_reg, TARGET_PAGE_MASK | ((1 << s_bits) - 1), ARITH_AND); tcg_out_andi(s, arg1, (CPU_TLB_SIZE - 1) << CPU_TLB_ENTRY_BITS); tcg_out_addi(s, arg1, offsetof(CPUState, tlb_table[mem_index][0].addr_write)); tcg_out_arith(s, arg1, TCG_AREG0, arg1, ARITH_ADD); tcg_out32(s, TARGET_LD_OP | INSN_RD(arg2) | INSN_RS1(arg1) | INSN_RS2(TCG_REG_G0)); tcg_out_arith(s, TCG_REG_G0, arg0, arg2, ARITH_SUBCC); label1_ptr = (uint32_t *)s->code_ptr; tcg_out32(s, 0); tcg_out_mov(s, arg0, addr_reg); tcg_out_mov(s, arg1, data_reg); tcg_out_movi(s, TCG_TYPE_I32, arg2, mem_index); tcg_out32(s, CALL | ((((tcg_target_ulong)qemu_st_helpers[s_bits] - (tcg_target_ulong)s->code_ptr) >> 2) & 0x3fffffff)); tcg_out_ldst(s, TCG_AREG0, TCG_REG_CALL_STACK, TCG_TARGET_CALL_STACK_OFFSET - sizeof(long), HOST_ST_OP); tcg_out_ldst(s, TCG_AREG0, TCG_REG_CALL_STACK, TCG_TARGET_CALL_STACK_OFFSET - sizeof(long), HOST_LD_OP); label2_ptr = (uint32_t *)s->code_ptr; tcg_out32(s, 0); tcg_out_nop(s); *label1_ptr = (INSN_OP(0) | INSN_COND(COND_E, 0) | INSN_OP2(0x2) | INSN_OFF22((unsigned long)s->code_ptr - (unsigned long)label1_ptr)); tcg_out_ldst(s, arg1, arg1, offsetof(CPUTLBEntry, addend) - offsetof(CPUTLBEntry, addr_write), HOST_LD_OP); tcg_out_arith(s, arg0, addr_reg, arg1, ARITH_ADD); arg0 = addr_reg; switch(opc) { case 0: tcg_out_ldst(s, data_reg, arg0, 0, STB); break; case 1: #ifdef TARGET_WORDS_BIGENDIAN tcg_out_ldst(s, data_reg, arg0, 0, STH); tcg_out_ldst_asi(s, data_reg, arg0, 0, STHA, ASI_PRIMARY_LITTLE); break; case 2: #ifdef TARGET_WORDS_BIGENDIAN tcg_out_ldst(s, data_reg, arg0, 0, STW); tcg_out_ldst_asi(s, data_reg, arg0, 0, STWA, ASI_PRIMARY_LITTLE); break; case 3: #ifdef TARGET_WORDS_BIGENDIAN tcg_out_ldst(s, data_reg, arg0, 0, STX); tcg_out_ldst_asi(s, data_reg, arg0, 0, STXA, ASI_PRIMARY_LITTLE); break; default: tcg_abort(); } #if defined(CONFIG_SOFTMMU) *label2_ptr = (INSN_OP(0) | INSN_COND(COND_A, 0) | INSN_OP2(0x2) | INSN_OFF22((unsigned long)s->code_ptr - (unsigned long)label2_ptr)); }
{ "code": [], "line_no": [] }
static void FUNC_0(TCGContext *VAR_0, const TCGArg *VAR_1, int VAR_2) { int VAR_3, VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9; #if defined(CONFIG_SOFTMMU) uint32_t *label1_ptr, *label2_ptr; VAR_4 = *VAR_1++; VAR_3 = *VAR_1++; VAR_8 = *VAR_1; VAR_9 = VAR_2; VAR_5 = TCG_REG_O0; VAR_6 = TCG_REG_O1; VAR_7 = TCG_REG_O2; #if defined(CONFIG_SOFTMMU) tcg_out_arithi(VAR_0, VAR_6, VAR_3, TARGET_PAGE_BITS - CPU_TLB_ENTRY_BITS, SHIFT_SRL); tcg_out_arithi(VAR_0, VAR_5, VAR_3, TARGET_PAGE_MASK | ((1 << VAR_9) - 1), ARITH_AND); tcg_out_andi(VAR_0, VAR_6, (CPU_TLB_SIZE - 1) << CPU_TLB_ENTRY_BITS); tcg_out_addi(VAR_0, VAR_6, offsetof(CPUState, tlb_table[VAR_8][0].addr_write)); tcg_out_arith(VAR_0, VAR_6, TCG_AREG0, VAR_6, ARITH_ADD); tcg_out32(VAR_0, TARGET_LD_OP | INSN_RD(VAR_7) | INSN_RS1(VAR_6) | INSN_RS2(TCG_REG_G0)); tcg_out_arith(VAR_0, TCG_REG_G0, VAR_5, VAR_7, ARITH_SUBCC); label1_ptr = (uint32_t *)VAR_0->code_ptr; tcg_out32(VAR_0, 0); tcg_out_mov(VAR_0, VAR_5, VAR_3); tcg_out_mov(VAR_0, VAR_6, VAR_4); tcg_out_movi(VAR_0, TCG_TYPE_I32, VAR_7, VAR_8); tcg_out32(VAR_0, CALL | ((((tcg_target_ulong)qemu_st_helpers[VAR_9] - (tcg_target_ulong)VAR_0->code_ptr) >> 2) & 0x3fffffff)); tcg_out_ldst(VAR_0, TCG_AREG0, TCG_REG_CALL_STACK, TCG_TARGET_CALL_STACK_OFFSET - sizeof(long), HOST_ST_OP); tcg_out_ldst(VAR_0, TCG_AREG0, TCG_REG_CALL_STACK, TCG_TARGET_CALL_STACK_OFFSET - sizeof(long), HOST_LD_OP); label2_ptr = (uint32_t *)VAR_0->code_ptr; tcg_out32(VAR_0, 0); tcg_out_nop(VAR_0); *label1_ptr = (INSN_OP(0) | INSN_COND(COND_E, 0) | INSN_OP2(0x2) | INSN_OFF22((unsigned long)VAR_0->code_ptr - (unsigned long)label1_ptr)); tcg_out_ldst(VAR_0, VAR_6, VAR_6, offsetof(CPUTLBEntry, addend) - offsetof(CPUTLBEntry, addr_write), HOST_LD_OP); tcg_out_arith(VAR_0, VAR_5, VAR_3, VAR_6, ARITH_ADD); VAR_5 = VAR_3; switch(VAR_2) { case 0: tcg_out_ldst(VAR_0, VAR_4, VAR_5, 0, STB); break; case 1: #ifdef TARGET_WORDS_BIGENDIAN tcg_out_ldst(VAR_0, VAR_4, VAR_5, 0, STH); tcg_out_ldst_asi(VAR_0, VAR_4, VAR_5, 0, STHA, ASI_PRIMARY_LITTLE); break; case 2: #ifdef TARGET_WORDS_BIGENDIAN tcg_out_ldst(VAR_0, VAR_4, VAR_5, 0, STW); tcg_out_ldst_asi(VAR_0, VAR_4, VAR_5, 0, STWA, ASI_PRIMARY_LITTLE); break; case 3: #ifdef TARGET_WORDS_BIGENDIAN tcg_out_ldst(VAR_0, VAR_4, VAR_5, 0, STX); tcg_out_ldst_asi(VAR_0, VAR_4, VAR_5, 0, STXA, ASI_PRIMARY_LITTLE); break; default: tcg_abort(); } #if defined(CONFIG_SOFTMMU) *label2_ptr = (INSN_OP(0) | INSN_COND(COND_A, 0) | INSN_OP2(0x2) | INSN_OFF22((unsigned long)VAR_0->code_ptr - (unsigned long)label2_ptr)); }
[ "static void FUNC_0(TCGContext *VAR_0, const TCGArg *VAR_1,\nint VAR_2)\n{", "int VAR_3, VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9;", "#if defined(CONFIG_SOFTMMU)\nuint32_t *label1_ptr, *label2_ptr;", "VAR_4 = *VAR_1++;", "VAR_3 = *VAR_1++;", "VAR_8 = *VAR_1;", "VAR_9 = VAR_2;", "VAR_5 = TCG_REG_O0;", "VAR_6 = TCG_REG_O1;", "VAR_7 = TCG_REG_O2;", "#if defined(CONFIG_SOFTMMU)\ntcg_out_arithi(VAR_0, VAR_6, VAR_3, TARGET_PAGE_BITS - CPU_TLB_ENTRY_BITS,\nSHIFT_SRL);", "tcg_out_arithi(VAR_0, VAR_5, VAR_3, TARGET_PAGE_MASK | ((1 << VAR_9) - 1),\nARITH_AND);", "tcg_out_andi(VAR_0, VAR_6, (CPU_TLB_SIZE - 1) << CPU_TLB_ENTRY_BITS);", "tcg_out_addi(VAR_0, VAR_6, offsetof(CPUState,\ntlb_table[VAR_8][0].addr_write));", "tcg_out_arith(VAR_0, VAR_6, TCG_AREG0, VAR_6, ARITH_ADD);", "tcg_out32(VAR_0, TARGET_LD_OP | INSN_RD(VAR_7) | INSN_RS1(VAR_6) |\nINSN_RS2(TCG_REG_G0));", "tcg_out_arith(VAR_0, TCG_REG_G0, VAR_5, VAR_7, ARITH_SUBCC);", "label1_ptr = (uint32_t *)VAR_0->code_ptr;", "tcg_out32(VAR_0, 0);", "tcg_out_mov(VAR_0, VAR_5, VAR_3);", "tcg_out_mov(VAR_0, VAR_6, VAR_4);", "tcg_out_movi(VAR_0, TCG_TYPE_I32, VAR_7, VAR_8);", "tcg_out32(VAR_0, CALL | ((((tcg_target_ulong)qemu_st_helpers[VAR_9]\n- (tcg_target_ulong)VAR_0->code_ptr) >> 2)\n& 0x3fffffff));", "tcg_out_ldst(VAR_0, TCG_AREG0, TCG_REG_CALL_STACK,\nTCG_TARGET_CALL_STACK_OFFSET - sizeof(long), HOST_ST_OP);", "tcg_out_ldst(VAR_0, TCG_AREG0, TCG_REG_CALL_STACK,\nTCG_TARGET_CALL_STACK_OFFSET - sizeof(long), HOST_LD_OP);", "label2_ptr = (uint32_t *)VAR_0->code_ptr;", "tcg_out32(VAR_0, 0);", "tcg_out_nop(VAR_0);", "*label1_ptr = (INSN_OP(0) | INSN_COND(COND_E, 0) | INSN_OP2(0x2) |\nINSN_OFF22((unsigned long)VAR_0->code_ptr -\n(unsigned long)label1_ptr));", "tcg_out_ldst(VAR_0, VAR_6, VAR_6, offsetof(CPUTLBEntry, addend) -\noffsetof(CPUTLBEntry, addr_write), HOST_LD_OP);", "tcg_out_arith(VAR_0, VAR_5, VAR_3, VAR_6, ARITH_ADD);", "VAR_5 = VAR_3;", "switch(VAR_2) {", "case 0:\ntcg_out_ldst(VAR_0, VAR_4, VAR_5, 0, STB);", "break;", "case 1:\n#ifdef TARGET_WORDS_BIGENDIAN\ntcg_out_ldst(VAR_0, VAR_4, VAR_5, 0, STH);", "tcg_out_ldst_asi(VAR_0, VAR_4, VAR_5, 0, STHA, ASI_PRIMARY_LITTLE);", "break;", "case 2:\n#ifdef TARGET_WORDS_BIGENDIAN\ntcg_out_ldst(VAR_0, VAR_4, VAR_5, 0, STW);", "tcg_out_ldst_asi(VAR_0, VAR_4, VAR_5, 0, STWA, ASI_PRIMARY_LITTLE);", "break;", "case 3:\n#ifdef TARGET_WORDS_BIGENDIAN\ntcg_out_ldst(VAR_0, VAR_4, VAR_5, 0, STX);", "tcg_out_ldst_asi(VAR_0, VAR_4, VAR_5, 0, STXA, ASI_PRIMARY_LITTLE);", "break;", "default:\ntcg_abort();", "}", "#if defined(CONFIG_SOFTMMU)\n*label2_ptr = (INSN_OP(0) | INSN_COND(COND_A, 0) | INSN_OP2(0x2) |\nINSN_OFF22((unsigned long)VAR_0->code_ptr -\n(unsigned long)label2_ptr));", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 16, 17 ], [ 18, 19 ], [ 21 ], [ 23, 24 ], [ 26 ], [ 28, 29 ], [ 31 ], [ 34 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 44, 45, 46 ], [ 50, 51 ], [ 52, 53 ], [ 56 ], [ 57 ], [ 59 ], [ 61, 62, 63 ], [ 65, 66 ], [ 68 ], [ 69 ], [ 70 ], [ 71, 73 ], [ 74 ], [ 75, 76, 78 ], [ 80 ], [ 81 ], [ 82, 83, 85 ], [ 87 ], [ 88 ], [ 89, 90, 92 ], [ 94 ], [ 95 ], [ 96, 97 ], [ 98 ], [ 99, 101, 102, 103 ], [ 104 ] ]
7,544
void vnc_jobs_consume_buffer(VncState *vs) { bool flush; vnc_lock_output(vs); if (vs->jobs_buffer.offset) { if (vs->ioc != NULL && buffer_empty(&vs->output)) { if (vs->ioc_tag) { g_source_remove(vs->ioc_tag); vs->ioc_tag = qio_channel_add_watch( vs->ioc, G_IO_IN | G_IO_OUT, vnc_client_io, vs, NULL); buffer_move(&vs->output, &vs->jobs_buffer); flush = vs->ioc != NULL && vs->abort != true; vnc_unlock_output(vs); if (flush) { vnc_flush(vs);
true
qemu
ada8d2e4369ea49677d8672ac81bce73eefd5b54
void vnc_jobs_consume_buffer(VncState *vs) { bool flush; vnc_lock_output(vs); if (vs->jobs_buffer.offset) { if (vs->ioc != NULL && buffer_empty(&vs->output)) { if (vs->ioc_tag) { g_source_remove(vs->ioc_tag); vs->ioc_tag = qio_channel_add_watch( vs->ioc, G_IO_IN | G_IO_OUT, vnc_client_io, vs, NULL); buffer_move(&vs->output, &vs->jobs_buffer); flush = vs->ioc != NULL && vs->abort != true; vnc_unlock_output(vs); if (flush) { vnc_flush(vs);
{ "code": [], "line_no": [] }
void FUNC_0(VncState *VAR_0) { bool flush; vnc_lock_output(VAR_0); if (VAR_0->jobs_buffer.offset) { if (VAR_0->ioc != NULL && buffer_empty(&VAR_0->output)) { if (VAR_0->ioc_tag) { g_source_remove(VAR_0->ioc_tag); VAR_0->ioc_tag = qio_channel_add_watch( VAR_0->ioc, G_IO_IN | G_IO_OUT, vnc_client_io, VAR_0, NULL); buffer_move(&VAR_0->output, &VAR_0->jobs_buffer); flush = VAR_0->ioc != NULL && VAR_0->abort != true; vnc_unlock_output(VAR_0); if (flush) { vnc_flush(VAR_0);
[ "void FUNC_0(VncState *VAR_0)\n{", "bool flush;", "vnc_lock_output(VAR_0);", "if (VAR_0->jobs_buffer.offset) {", "if (VAR_0->ioc != NULL && buffer_empty(&VAR_0->output)) {", "if (VAR_0->ioc_tag) {", "g_source_remove(VAR_0->ioc_tag);", "VAR_0->ioc_tag = qio_channel_add_watch(\nVAR_0->ioc, G_IO_IN | G_IO_OUT, vnc_client_io, VAR_0, NULL);", "buffer_move(&VAR_0->output, &VAR_0->jobs_buffer);", "flush = VAR_0->ioc != NULL && VAR_0->abort != true;", "vnc_unlock_output(VAR_0);", "if (flush) {", "vnc_flush(VAR_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 ] ]
7,545
ssize_t qsb_write_at(QEMUSizedBuffer *qsb, const uint8_t *source, off_t pos, size_t count) { ssize_t rc = qsb_grow(qsb, pos + count); size_t to_copy; size_t all_copy = count; const struct iovec *iov; ssize_t index; char *dest; off_t d_off, s_off = 0; if (rc < 0) { return rc; } if (pos + count > qsb->used) { qsb->used = pos + count; } index = qsb_get_iovec(qsb, pos, &d_off); if (index < 0) { return -EINVAL; } while (all_copy > 0) { iov = &qsb->iov[index]; dest = iov->iov_base; to_copy = iov->iov_len - d_off; if (to_copy > all_copy) { to_copy = all_copy; } memcpy(&dest[d_off], &source[s_off], to_copy); s_off += to_copy; all_copy -= to_copy; d_off = 0; index++; } return count; }
true
qemu
60fe637bf0e4d7989e21e50f52526444765c63b4
ssize_t qsb_write_at(QEMUSizedBuffer *qsb, const uint8_t *source, off_t pos, size_t count) { ssize_t rc = qsb_grow(qsb, pos + count); size_t to_copy; size_t all_copy = count; const struct iovec *iov; ssize_t index; char *dest; off_t d_off, s_off = 0; if (rc < 0) { return rc; } if (pos + count > qsb->used) { qsb->used = pos + count; } index = qsb_get_iovec(qsb, pos, &d_off); if (index < 0) { return -EINVAL; } while (all_copy > 0) { iov = &qsb->iov[index]; dest = iov->iov_base; to_copy = iov->iov_len - d_off; if (to_copy > all_copy) { to_copy = all_copy; } memcpy(&dest[d_off], &source[s_off], to_copy); s_off += to_copy; all_copy -= to_copy; d_off = 0; index++; } return count; }
{ "code": [], "line_no": [] }
ssize_t FUNC_0(QEMUSizedBuffer *qsb, const uint8_t *source, off_t pos, size_t count) { ssize_t rc = qsb_grow(qsb, pos + count); size_t to_copy; size_t all_copy = count; const struct iovec *VAR_0; ssize_t index; char *VAR_1; off_t d_off, s_off = 0; if (rc < 0) { return rc; } if (pos + count > qsb->used) { qsb->used = pos + count; } index = qsb_get_iovec(qsb, pos, &d_off); if (index < 0) { return -EINVAL; } while (all_copy > 0) { VAR_0 = &qsb->VAR_0[index]; VAR_1 = VAR_0->iov_base; to_copy = VAR_0->iov_len - d_off; if (to_copy > all_copy) { to_copy = all_copy; } memcpy(&VAR_1[d_off], &source[s_off], to_copy); s_off += to_copy; all_copy -= to_copy; d_off = 0; index++; } return count; }
[ "ssize_t FUNC_0(QEMUSizedBuffer *qsb, const uint8_t *source,\noff_t pos, size_t count)\n{", "ssize_t rc = qsb_grow(qsb, pos + count);", "size_t to_copy;", "size_t all_copy = count;", "const struct iovec *VAR_0;", "ssize_t index;", "char *VAR_1;", "off_t d_off, s_off = 0;", "if (rc < 0) {", "return rc;", "}", "if (pos + count > qsb->used) {", "qsb->used = pos + count;", "}", "index = qsb_get_iovec(qsb, pos, &d_off);", "if (index < 0) {", "return -EINVAL;", "}", "while (all_copy > 0) {", "VAR_0 = &qsb->VAR_0[index];", "VAR_1 = VAR_0->iov_base;", "to_copy = VAR_0->iov_len - d_off;", "if (to_copy > all_copy) {", "to_copy = all_copy;", "}", "memcpy(&VAR_1[d_off], &source[s_off], to_copy);", "s_off += to_copy;", "all_copy -= to_copy;", "d_off = 0;", "index++;", "}", "return count;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 49 ], [ 51 ], [ 55 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 69 ], [ 73 ], [ 75 ], [ 79 ], [ 81 ], [ 83 ], [ 87 ], [ 89 ] ]
7,546
av_cold int ff_psy_init(FFPsyContext *ctx, AVCodecContext *avctx, int num_lens, const uint8_t **bands, const int* num_bands, int num_groups, const uint8_t *group_map) { int i, j, k = 0; ctx->avctx = avctx; ctx->ch = av_mallocz_array(sizeof(ctx->ch[0]), avctx->channels * 2); ctx->group = av_mallocz_array(sizeof(ctx->group[0]), num_groups); ctx->bands = av_malloc_array (sizeof(ctx->bands[0]), num_lens); ctx->num_bands = av_malloc_array (sizeof(ctx->num_bands[0]), num_lens); if (!ctx->ch || !ctx->group || !ctx->bands || !ctx->num_bands) { ff_psy_end(ctx); return AVERROR(ENOMEM); } memcpy(ctx->bands, bands, sizeof(ctx->bands[0]) * num_lens); memcpy(ctx->num_bands, num_bands, sizeof(ctx->num_bands[0]) * num_lens); /* assign channels to groups (with virtual channels for coupling) */ for (i = 0; i < num_groups; i++) { /* NOTE: Add 1 to handle the AAC chan_config without modification. * This has the side effect of allowing an array of 0s to map * to one channel per group. */ ctx->group[i].num_ch = group_map[i] + 1; for (j = 0; j < ctx->group[i].num_ch * 2; j++) ctx->group[i].ch[j] = &ctx->ch[k++]; } switch (ctx->avctx->codec_id) { case AV_CODEC_ID_AAC: ctx->model = &ff_aac_psy_model; break; } if (ctx->model->init) return ctx->model->init(ctx); return 0; }
true
FFmpeg
ca203e9985cd2dcf42a0c0853940850d3a8edf3a
av_cold int ff_psy_init(FFPsyContext *ctx, AVCodecContext *avctx, int num_lens, const uint8_t **bands, const int* num_bands, int num_groups, const uint8_t *group_map) { int i, j, k = 0; ctx->avctx = avctx; ctx->ch = av_mallocz_array(sizeof(ctx->ch[0]), avctx->channels * 2); ctx->group = av_mallocz_array(sizeof(ctx->group[0]), num_groups); ctx->bands = av_malloc_array (sizeof(ctx->bands[0]), num_lens); ctx->num_bands = av_malloc_array (sizeof(ctx->num_bands[0]), num_lens); if (!ctx->ch || !ctx->group || !ctx->bands || !ctx->num_bands) { ff_psy_end(ctx); return AVERROR(ENOMEM); } memcpy(ctx->bands, bands, sizeof(ctx->bands[0]) * num_lens); memcpy(ctx->num_bands, num_bands, sizeof(ctx->num_bands[0]) * num_lens); for (i = 0; i < num_groups; i++) { ctx->group[i].num_ch = group_map[i] + 1; for (j = 0; j < ctx->group[i].num_ch * 2; j++) ctx->group[i].ch[j] = &ctx->ch[k++]; } switch (ctx->avctx->codec_id) { case AV_CODEC_ID_AAC: ctx->model = &ff_aac_psy_model; break; } if (ctx->model->init) return ctx->model->init(ctx); return 0; }
{ "code": [], "line_no": [] }
av_cold int FUNC_0(FFPsyContext *ctx, AVCodecContext *avctx, int num_lens, const uint8_t **bands, const int* num_bands, int num_groups, const uint8_t *group_map) { int VAR_0, VAR_1, VAR_2 = 0; ctx->avctx = avctx; ctx->ch = av_mallocz_array(sizeof(ctx->ch[0]), avctx->channels * 2); ctx->group = av_mallocz_array(sizeof(ctx->group[0]), num_groups); ctx->bands = av_malloc_array (sizeof(ctx->bands[0]), num_lens); ctx->num_bands = av_malloc_array (sizeof(ctx->num_bands[0]), num_lens); if (!ctx->ch || !ctx->group || !ctx->bands || !ctx->num_bands) { ff_psy_end(ctx); return AVERROR(ENOMEM); } memcpy(ctx->bands, bands, sizeof(ctx->bands[0]) * num_lens); memcpy(ctx->num_bands, num_bands, sizeof(ctx->num_bands[0]) * num_lens); for (VAR_0 = 0; VAR_0 < num_groups; VAR_0++) { ctx->group[VAR_0].num_ch = group_map[VAR_0] + 1; for (VAR_1 = 0; VAR_1 < ctx->group[VAR_0].num_ch * 2; VAR_1++) ctx->group[VAR_0].ch[VAR_1] = &ctx->ch[VAR_2++]; } switch (ctx->avctx->codec_id) { case AV_CODEC_ID_AAC: ctx->model = &ff_aac_psy_model; break; } if (ctx->model->init) return ctx->model->init(ctx); return 0; }
[ "av_cold int FUNC_0(FFPsyContext *ctx, AVCodecContext *avctx, int num_lens,\nconst uint8_t **bands, const int* num_bands,\nint num_groups, const uint8_t *group_map)\n{", "int VAR_0, VAR_1, VAR_2 = 0;", "ctx->avctx = avctx;", "ctx->ch = av_mallocz_array(sizeof(ctx->ch[0]), avctx->channels * 2);", "ctx->group = av_mallocz_array(sizeof(ctx->group[0]), num_groups);", "ctx->bands = av_malloc_array (sizeof(ctx->bands[0]), num_lens);", "ctx->num_bands = av_malloc_array (sizeof(ctx->num_bands[0]), num_lens);", "if (!ctx->ch || !ctx->group || !ctx->bands || !ctx->num_bands) {", "ff_psy_end(ctx);", "return AVERROR(ENOMEM);", "}", "memcpy(ctx->bands, bands, sizeof(ctx->bands[0]) * num_lens);", "memcpy(ctx->num_bands, num_bands, sizeof(ctx->num_bands[0]) * num_lens);", "for (VAR_0 = 0; VAR_0 < num_groups; VAR_0++) {", "ctx->group[VAR_0].num_ch = group_map[VAR_0] + 1;", "for (VAR_1 = 0; VAR_1 < ctx->group[VAR_0].num_ch * 2; VAR_1++)", "ctx->group[VAR_0].ch[VAR_1] = &ctx->ch[VAR_2++];", "}", "switch (ctx->avctx->codec_id) {", "case AV_CODEC_ID_AAC:\nctx->model = &ff_aac_psy_model;", "break;", "}", "if (ctx->model->init)\nreturn ctx->model->init(ctx);", "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 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 26 ], [ 28 ], [ 30 ], [ 32 ], [ 36 ], [ 38 ], [ 44 ], [ 54 ], [ 56 ], [ 58 ], [ 60 ], [ 64 ], [ 66, 68 ], [ 70 ], [ 72 ], [ 74, 76 ], [ 78 ], [ 80 ] ]
7,547
static int vpc_open(BlockDriverState *bs, int flags) { BDRVVPCState *s = bs->opaque; int i; struct vhd_footer* footer; struct vhd_dyndisk_header* dyndisk_header; uint8_t buf[HEADER_SIZE]; uint32_t checksum; int err = -1; int disk_type = VHD_DYNAMIC; if (bdrv_pread(bs->file, 0, s->footer_buf, HEADER_SIZE) != HEADER_SIZE) goto fail; footer = (struct vhd_footer*) s->footer_buf; if (strncmp(footer->creator, "conectix", 8)) { int64_t offset = bdrv_getlength(bs->file); if (offset < HEADER_SIZE) { goto fail; } /* If a fixed disk, the footer is found only at the end of the file */ if (bdrv_pread(bs->file, offset-HEADER_SIZE, s->footer_buf, HEADER_SIZE) != HEADER_SIZE) { goto fail; } if (strncmp(footer->creator, "conectix", 8)) { goto fail; } disk_type = VHD_FIXED; } checksum = be32_to_cpu(footer->checksum); footer->checksum = 0; if (vpc_checksum(s->footer_buf, HEADER_SIZE) != checksum) fprintf(stderr, "block-vpc: The header checksum of '%s' is " "incorrect.\n", bs->filename); /* Write 'checksum' back to footer, or else will leave it with zero. */ footer->checksum = be32_to_cpu(checksum); // The visible size of a image in Virtual PC depends on the geometry // rather than on the size stored in the footer (the size in the footer // is too large usually) bs->total_sectors = (int64_t) be16_to_cpu(footer->cyls) * footer->heads * footer->secs_per_cyl; /* Allow a maximum disk size of approximately 2 TB */ if (bs->total_sectors >= 65535LL * 255 * 255) { err = -EFBIG; goto fail; } if (disk_type == VHD_DYNAMIC) { if (bdrv_pread(bs->file, be64_to_cpu(footer->data_offset), buf, HEADER_SIZE) != HEADER_SIZE) { goto fail; } dyndisk_header = (struct vhd_dyndisk_header *) buf; if (strncmp(dyndisk_header->magic, "cxsparse", 8)) { goto fail; } s->block_size = be32_to_cpu(dyndisk_header->block_size); s->bitmap_size = ((s->block_size / (8 * 512)) + 511) & ~511; s->max_table_entries = be32_to_cpu(dyndisk_header->max_table_entries); s->pagetable = g_malloc(s->max_table_entries * 4); s->bat_offset = be64_to_cpu(dyndisk_header->table_offset); if (bdrv_pread(bs->file, s->bat_offset, s->pagetable, s->max_table_entries * 4) != s->max_table_entries * 4) { goto fail; } s->free_data_block_offset = (s->bat_offset + (s->max_table_entries * 4) + 511) & ~511; for (i = 0; i < s->max_table_entries; i++) { be32_to_cpus(&s->pagetable[i]); if (s->pagetable[i] != 0xFFFFFFFF) { int64_t next = (512 * (int64_t) s->pagetable[i]) + s->bitmap_size + s->block_size; if (next > s->free_data_block_offset) { s->free_data_block_offset = next; } } } s->last_bitmap_offset = (int64_t) -1; #ifdef CACHE s->pageentry_u8 = g_malloc(512); s->pageentry_u32 = s->pageentry_u8; s->pageentry_u16 = s->pageentry_u8; s->last_pagetable = -1; #endif } qemu_co_mutex_init(&s->lock); /* Disable migration when VHD images are used */ error_set(&s->migration_blocker, QERR_BLOCK_FORMAT_FEATURE_NOT_SUPPORTED, "vpc", bs->device_name, "live migration"); migrate_add_blocker(s->migration_blocker); return 0; fail: return err; }
true
qemu
59294e465953ffb07d42dc61c827bb98cc0ca423
static int vpc_open(BlockDriverState *bs, int flags) { BDRVVPCState *s = bs->opaque; int i; struct vhd_footer* footer; struct vhd_dyndisk_header* dyndisk_header; uint8_t buf[HEADER_SIZE]; uint32_t checksum; int err = -1; int disk_type = VHD_DYNAMIC; if (bdrv_pread(bs->file, 0, s->footer_buf, HEADER_SIZE) != HEADER_SIZE) goto fail; footer = (struct vhd_footer*) s->footer_buf; if (strncmp(footer->creator, "conectix", 8)) { int64_t offset = bdrv_getlength(bs->file); if (offset < HEADER_SIZE) { goto fail; } if (bdrv_pread(bs->file, offset-HEADER_SIZE, s->footer_buf, HEADER_SIZE) != HEADER_SIZE) { goto fail; } if (strncmp(footer->creator, "conectix", 8)) { goto fail; } disk_type = VHD_FIXED; } checksum = be32_to_cpu(footer->checksum); footer->checksum = 0; if (vpc_checksum(s->footer_buf, HEADER_SIZE) != checksum) fprintf(stderr, "block-vpc: The header checksum of '%s' is " "incorrect.\n", bs->filename); footer->checksum = be32_to_cpu(checksum); bs->total_sectors = (int64_t) be16_to_cpu(footer->cyls) * footer->heads * footer->secs_per_cyl; if (bs->total_sectors >= 65535LL * 255 * 255) { err = -EFBIG; goto fail; } if (disk_type == VHD_DYNAMIC) { if (bdrv_pread(bs->file, be64_to_cpu(footer->data_offset), buf, HEADER_SIZE) != HEADER_SIZE) { goto fail; } dyndisk_header = (struct vhd_dyndisk_header *) buf; if (strncmp(dyndisk_header->magic, "cxsparse", 8)) { goto fail; } s->block_size = be32_to_cpu(dyndisk_header->block_size); s->bitmap_size = ((s->block_size / (8 * 512)) + 511) & ~511; s->max_table_entries = be32_to_cpu(dyndisk_header->max_table_entries); s->pagetable = g_malloc(s->max_table_entries * 4); s->bat_offset = be64_to_cpu(dyndisk_header->table_offset); if (bdrv_pread(bs->file, s->bat_offset, s->pagetable, s->max_table_entries * 4) != s->max_table_entries * 4) { goto fail; } s->free_data_block_offset = (s->bat_offset + (s->max_table_entries * 4) + 511) & ~511; for (i = 0; i < s->max_table_entries; i++) { be32_to_cpus(&s->pagetable[i]); if (s->pagetable[i] != 0xFFFFFFFF) { int64_t next = (512 * (int64_t) s->pagetable[i]) + s->bitmap_size + s->block_size; if (next > s->free_data_block_offset) { s->free_data_block_offset = next; } } } s->last_bitmap_offset = (int64_t) -1; #ifdef CACHE s->pageentry_u8 = g_malloc(512); s->pageentry_u32 = s->pageentry_u8; s->pageentry_u16 = s->pageentry_u8; s->last_pagetable = -1; #endif } qemu_co_mutex_init(&s->lock); error_set(&s->migration_blocker, QERR_BLOCK_FORMAT_FEATURE_NOT_SUPPORTED, "vpc", bs->device_name, "live migration"); migrate_add_blocker(s->migration_blocker); return 0; fail: return err; }
{ "code": [ " int err = -1;", " if (bdrv_pread(bs->file, 0, s->footer_buf, HEADER_SIZE) != HEADER_SIZE)", " if (offset < HEADER_SIZE) {", " if (bdrv_pread(bs->file, offset-HEADER_SIZE, s->footer_buf, HEADER_SIZE)", " != HEADER_SIZE) {", " err = -EFBIG;", " if (bdrv_pread(bs->file, be64_to_cpu(footer->data_offset), buf,", " HEADER_SIZE) != HEADER_SIZE) {", " if (bdrv_pread(bs->file, s->bat_offset, s->pagetable,", " s->max_table_entries * 4) != s->max_table_entries * 4) {", " fail:", " return err;" ], "line_no": [ 17, 23, 35, 43, 45, 97, 107, 109, 143, 145, 221, 223 ] }
static int FUNC_0(BlockDriverState *VAR_0, int VAR_1) { BDRVVPCState *s = VAR_0->opaque; int VAR_2; struct vhd_footer* VAR_3; struct vhd_dyndisk_header* VAR_4; uint8_t buf[HEADER_SIZE]; uint32_t checksum; int VAR_5 = -1; int VAR_6 = VHD_DYNAMIC; if (bdrv_pread(VAR_0->file, 0, s->footer_buf, HEADER_SIZE) != HEADER_SIZE) goto fail; VAR_3 = (struct vhd_footer*) s->footer_buf; if (strncmp(VAR_3->creator, "conectix", 8)) { int64_t offset = bdrv_getlength(VAR_0->file); if (offset < HEADER_SIZE) { goto fail; } if (bdrv_pread(VAR_0->file, offset-HEADER_SIZE, s->footer_buf, HEADER_SIZE) != HEADER_SIZE) { goto fail; } if (strncmp(VAR_3->creator, "conectix", 8)) { goto fail; } VAR_6 = VHD_FIXED; } checksum = be32_to_cpu(VAR_3->checksum); VAR_3->checksum = 0; if (vpc_checksum(s->footer_buf, HEADER_SIZE) != checksum) fprintf(stderr, "block-vpc: The header checksum of '%s' is " "incorrect.\n", VAR_0->filename); VAR_3->checksum = be32_to_cpu(checksum); VAR_0->total_sectors = (int64_t) be16_to_cpu(VAR_3->cyls) * VAR_3->heads * VAR_3->secs_per_cyl; if (VAR_0->total_sectors >= 65535LL * 255 * 255) { VAR_5 = -EFBIG; goto fail; } if (VAR_6 == VHD_DYNAMIC) { if (bdrv_pread(VAR_0->file, be64_to_cpu(VAR_3->data_offset), buf, HEADER_SIZE) != HEADER_SIZE) { goto fail; } VAR_4 = (struct vhd_dyndisk_header *) buf; if (strncmp(VAR_4->magic, "cxsparse", 8)) { goto fail; } s->block_size = be32_to_cpu(VAR_4->block_size); s->bitmap_size = ((s->block_size / (8 * 512)) + 511) & ~511; s->max_table_entries = be32_to_cpu(VAR_4->max_table_entries); s->pagetable = g_malloc(s->max_table_entries * 4); s->bat_offset = be64_to_cpu(VAR_4->table_offset); if (bdrv_pread(VAR_0->file, s->bat_offset, s->pagetable, s->max_table_entries * 4) != s->max_table_entries * 4) { goto fail; } s->free_data_block_offset = (s->bat_offset + (s->max_table_entries * 4) + 511) & ~511; for (VAR_2 = 0; VAR_2 < s->max_table_entries; VAR_2++) { be32_to_cpus(&s->pagetable[VAR_2]); if (s->pagetable[VAR_2] != 0xFFFFFFFF) { int64_t next = (512 * (int64_t) s->pagetable[VAR_2]) + s->bitmap_size + s->block_size; if (next > s->free_data_block_offset) { s->free_data_block_offset = next; } } } s->last_bitmap_offset = (int64_t) -1; #ifdef CACHE s->pageentry_u8 = g_malloc(512); s->pageentry_u32 = s->pageentry_u8; s->pageentry_u16 = s->pageentry_u8; s->last_pagetable = -1; #endif } qemu_co_mutex_init(&s->lock); error_set(&s->migration_blocker, QERR_BLOCK_FORMAT_FEATURE_NOT_SUPPORTED, "vpc", VAR_0->device_name, "live migration"); migrate_add_blocker(s->migration_blocker); return 0; fail: return VAR_5; }
[ "static int FUNC_0(BlockDriverState *VAR_0, int VAR_1)\n{", "BDRVVPCState *s = VAR_0->opaque;", "int VAR_2;", "struct vhd_footer* VAR_3;", "struct vhd_dyndisk_header* VAR_4;", "uint8_t buf[HEADER_SIZE];", "uint32_t checksum;", "int VAR_5 = -1;", "int VAR_6 = VHD_DYNAMIC;", "if (bdrv_pread(VAR_0->file, 0, s->footer_buf, HEADER_SIZE) != HEADER_SIZE)\ngoto fail;", "VAR_3 = (struct vhd_footer*) s->footer_buf;", "if (strncmp(VAR_3->creator, \"conectix\", 8)) {", "int64_t offset = bdrv_getlength(VAR_0->file);", "if (offset < HEADER_SIZE) {", "goto fail;", "}", "if (bdrv_pread(VAR_0->file, offset-HEADER_SIZE, s->footer_buf, HEADER_SIZE)\n!= HEADER_SIZE) {", "goto fail;", "}", "if (strncmp(VAR_3->creator, \"conectix\", 8)) {", "goto fail;", "}", "VAR_6 = VHD_FIXED;", "}", "checksum = be32_to_cpu(VAR_3->checksum);", "VAR_3->checksum = 0;", "if (vpc_checksum(s->footer_buf, HEADER_SIZE) != checksum)\nfprintf(stderr, \"block-vpc: The header checksum of '%s' is \"\n\"incorrect.\\n\", VAR_0->filename);", "VAR_3->checksum = be32_to_cpu(checksum);", "VAR_0->total_sectors = (int64_t)\nbe16_to_cpu(VAR_3->cyls) * VAR_3->heads * VAR_3->secs_per_cyl;", "if (VAR_0->total_sectors >= 65535LL * 255 * 255) {", "VAR_5 = -EFBIG;", "goto fail;", "}", "if (VAR_6 == VHD_DYNAMIC) {", "if (bdrv_pread(VAR_0->file, be64_to_cpu(VAR_3->data_offset), buf,\nHEADER_SIZE) != HEADER_SIZE) {", "goto fail;", "}", "VAR_4 = (struct vhd_dyndisk_header *) buf;", "if (strncmp(VAR_4->magic, \"cxsparse\", 8)) {", "goto fail;", "}", "s->block_size = be32_to_cpu(VAR_4->block_size);", "s->bitmap_size = ((s->block_size / (8 * 512)) + 511) & ~511;", "s->max_table_entries = be32_to_cpu(VAR_4->max_table_entries);", "s->pagetable = g_malloc(s->max_table_entries * 4);", "s->bat_offset = be64_to_cpu(VAR_4->table_offset);", "if (bdrv_pread(VAR_0->file, s->bat_offset, s->pagetable,\ns->max_table_entries * 4) != s->max_table_entries * 4) {", "goto fail;", "}", "s->free_data_block_offset =\n(s->bat_offset + (s->max_table_entries * 4) + 511) & ~511;", "for (VAR_2 = 0; VAR_2 < s->max_table_entries; VAR_2++) {", "be32_to_cpus(&s->pagetable[VAR_2]);", "if (s->pagetable[VAR_2] != 0xFFFFFFFF) {", "int64_t next = (512 * (int64_t) s->pagetable[VAR_2]) +\ns->bitmap_size + s->block_size;", "if (next > s->free_data_block_offset) {", "s->free_data_block_offset = next;", "}", "}", "}", "s->last_bitmap_offset = (int64_t) -1;", "#ifdef CACHE\ns->pageentry_u8 = g_malloc(512);", "s->pageentry_u32 = s->pageentry_u8;", "s->pageentry_u16 = s->pageentry_u8;", "s->last_pagetable = -1;", "#endif\n}", "qemu_co_mutex_init(&s->lock);", "error_set(&s->migration_blocker,\nQERR_BLOCK_FORMAT_FEATURE_NOT_SUPPORTED,\n\"vpc\", VAR_0->device_name, \"live migration\");", "migrate_add_blocker(s->migration_blocker);", "return 0;", "fail:\nreturn VAR_5;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 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, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23, 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43, 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ], [ 67, 69, 71 ], [ 77 ], [ 87, 89 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 105 ], [ 107, 109 ], [ 111 ], [ 113 ], [ 117 ], [ 121 ], [ 123 ], [ 125 ], [ 129 ], [ 131 ], [ 135 ], [ 137 ], [ 141 ], [ 143, 145 ], [ 147 ], [ 149 ], [ 153, 155 ], [ 159 ], [ 161 ], [ 163 ], [ 165, 167 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 183 ], [ 187, 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197, 199 ], [ 203 ], [ 209, 211, 213 ], [ 215 ], [ 219 ], [ 221, 223 ], [ 225 ] ]
7,548
static int read_sbr_grid(AACContext *ac, SpectralBandReplication *sbr, GetBitContext *gb, SBRData *ch_data) { int i; ch_data->bs_freq_res[0] = ch_data->bs_freq_res[ch_data->bs_num_env[1]]; ch_data->bs_num_env[0] = ch_data->bs_num_env[1]; ch_data->bs_amp_res = sbr->bs_amp_res_header; switch (ch_data->bs_frame_class = get_bits(gb, 2)) { case FIXFIX: ch_data->bs_num_env[1] = 1 << get_bits(gb, 2); if (ch_data->bs_num_env[1] == 1) ch_data->bs_amp_res = 0; ch_data->bs_pointer = 0; ch_data->bs_freq_res[1] = get_bits1(gb); for (i = 1; i < ch_data->bs_num_env[1]; i++) ch_data->bs_freq_res[i + 1] = ch_data->bs_freq_res[1]; break; case FIXVAR: ch_data->bs_var_bord[1] = get_bits(gb, 2); ch_data->bs_num_rel[1] = get_bits(gb, 2); ch_data->bs_num_env[1] = ch_data->bs_num_rel[1] + 1; for (i = 0; i < ch_data->bs_num_rel[1]; i++) ch_data->bs_rel_bord[1][i] = 2 * get_bits(gb, 2) + 2; ch_data->bs_pointer = get_bits(gb, ceil_log2[ch_data->bs_num_env[1]]); for (i = 0; i < ch_data->bs_num_env[1]; i++) ch_data->bs_freq_res[ch_data->bs_num_env[1] - i] = get_bits1(gb); break; case VARFIX: ch_data->bs_var_bord[0] = get_bits(gb, 2); ch_data->bs_num_rel[0] = get_bits(gb, 2); ch_data->bs_num_env[1] = ch_data->bs_num_rel[0] + 1; for (i = 0; i < ch_data->bs_num_rel[0]; i++) ch_data->bs_rel_bord[0][i] = 2 * get_bits(gb, 2) + 2; ch_data->bs_pointer = get_bits(gb, ceil_log2[ch_data->bs_num_env[1]]); get_bits1_vector(gb, ch_data->bs_freq_res + 1, ch_data->bs_num_env[1]); break; case VARVAR: ch_data->bs_var_bord[0] = get_bits(gb, 2); ch_data->bs_var_bord[1] = get_bits(gb, 2); ch_data->bs_num_rel[0] = get_bits(gb, 2); ch_data->bs_num_rel[1] = get_bits(gb, 2); ch_data->bs_num_env[1] = ch_data->bs_num_rel[0] + ch_data->bs_num_rel[1] + 1; for (i = 0; i < ch_data->bs_num_rel[0]; i++) ch_data->bs_rel_bord[0][i] = 2 * get_bits(gb, 2) + 2; for (i = 0; i < ch_data->bs_num_rel[1]; i++) ch_data->bs_rel_bord[1][i] = 2 * get_bits(gb, 2) + 2; ch_data->bs_pointer = get_bits(gb, ceil_log2[ch_data->bs_num_env[1]]); get_bits1_vector(gb, ch_data->bs_freq_res + 1, ch_data->bs_num_env[1]); break; } if (ch_data->bs_pointer > ch_data->bs_num_env[1] + 1) { av_log(ac->avccontext, AV_LOG_ERROR, "Invalid bitstream, bs_pointer points to a middle noise border outside the time borders table: %d\n", ch_data->bs_pointer); return -1; } if (ch_data->bs_frame_class == FIXFIX && ch_data->bs_num_env[1] > 4) { av_log(ac->avccontext, AV_LOG_ERROR, "Invalid bitstream, too many SBR envelopes in FIXFIX type SBR frame: %d\n", ch_data->bs_num_env[1]); return -1; } if (ch_data->bs_frame_class == VARVAR && ch_data->bs_num_env[1] > 5) { av_log(ac->avccontext, AV_LOG_ERROR, "Invalid bitstream, too many SBR envelopes in VARVAR type SBR frame: %d\n", ch_data->bs_num_env[1]); return -1; } ch_data->bs_num_noise = (ch_data->bs_num_env[1] > 1) + 1; return 0; }
true
FFmpeg
ed1d112931776f40c5fc759204b79c78dfee5f9a
static int read_sbr_grid(AACContext *ac, SpectralBandReplication *sbr, GetBitContext *gb, SBRData *ch_data) { int i; ch_data->bs_freq_res[0] = ch_data->bs_freq_res[ch_data->bs_num_env[1]]; ch_data->bs_num_env[0] = ch_data->bs_num_env[1]; ch_data->bs_amp_res = sbr->bs_amp_res_header; switch (ch_data->bs_frame_class = get_bits(gb, 2)) { case FIXFIX: ch_data->bs_num_env[1] = 1 << get_bits(gb, 2); if (ch_data->bs_num_env[1] == 1) ch_data->bs_amp_res = 0; ch_data->bs_pointer = 0; ch_data->bs_freq_res[1] = get_bits1(gb); for (i = 1; i < ch_data->bs_num_env[1]; i++) ch_data->bs_freq_res[i + 1] = ch_data->bs_freq_res[1]; break; case FIXVAR: ch_data->bs_var_bord[1] = get_bits(gb, 2); ch_data->bs_num_rel[1] = get_bits(gb, 2); ch_data->bs_num_env[1] = ch_data->bs_num_rel[1] + 1; for (i = 0; i < ch_data->bs_num_rel[1]; i++) ch_data->bs_rel_bord[1][i] = 2 * get_bits(gb, 2) + 2; ch_data->bs_pointer = get_bits(gb, ceil_log2[ch_data->bs_num_env[1]]); for (i = 0; i < ch_data->bs_num_env[1]; i++) ch_data->bs_freq_res[ch_data->bs_num_env[1] - i] = get_bits1(gb); break; case VARFIX: ch_data->bs_var_bord[0] = get_bits(gb, 2); ch_data->bs_num_rel[0] = get_bits(gb, 2); ch_data->bs_num_env[1] = ch_data->bs_num_rel[0] + 1; for (i = 0; i < ch_data->bs_num_rel[0]; i++) ch_data->bs_rel_bord[0][i] = 2 * get_bits(gb, 2) + 2; ch_data->bs_pointer = get_bits(gb, ceil_log2[ch_data->bs_num_env[1]]); get_bits1_vector(gb, ch_data->bs_freq_res + 1, ch_data->bs_num_env[1]); break; case VARVAR: ch_data->bs_var_bord[0] = get_bits(gb, 2); ch_data->bs_var_bord[1] = get_bits(gb, 2); ch_data->bs_num_rel[0] = get_bits(gb, 2); ch_data->bs_num_rel[1] = get_bits(gb, 2); ch_data->bs_num_env[1] = ch_data->bs_num_rel[0] + ch_data->bs_num_rel[1] + 1; for (i = 0; i < ch_data->bs_num_rel[0]; i++) ch_data->bs_rel_bord[0][i] = 2 * get_bits(gb, 2) + 2; for (i = 0; i < ch_data->bs_num_rel[1]; i++) ch_data->bs_rel_bord[1][i] = 2 * get_bits(gb, 2) + 2; ch_data->bs_pointer = get_bits(gb, ceil_log2[ch_data->bs_num_env[1]]); get_bits1_vector(gb, ch_data->bs_freq_res + 1, ch_data->bs_num_env[1]); break; } if (ch_data->bs_pointer > ch_data->bs_num_env[1] + 1) { av_log(ac->avccontext, AV_LOG_ERROR, "Invalid bitstream, bs_pointer points to a middle noise border outside the time borders table: %d\n", ch_data->bs_pointer); return -1; } if (ch_data->bs_frame_class == FIXFIX && ch_data->bs_num_env[1] > 4) { av_log(ac->avccontext, AV_LOG_ERROR, "Invalid bitstream, too many SBR envelopes in FIXFIX type SBR frame: %d\n", ch_data->bs_num_env[1]); return -1; } if (ch_data->bs_frame_class == VARVAR && ch_data->bs_num_env[1] > 5) { av_log(ac->avccontext, AV_LOG_ERROR, "Invalid bitstream, too many SBR envelopes in VARVAR type SBR frame: %d\n", ch_data->bs_num_env[1]); return -1; } ch_data->bs_num_noise = (ch_data->bs_num_env[1] > 1) + 1; return 0; }
{ "code": [ " if (ch_data->bs_frame_class == FIXFIX && ch_data->bs_num_env[1] > 4) {", " av_log(ac->avccontext, AV_LOG_ERROR,", " \"Invalid bitstream, too many SBR envelopes in FIXFIX type SBR frame: %d\\n\",", " ch_data->bs_num_env[1]);", " return -1;", " if (ch_data->bs_frame_class == VARVAR && ch_data->bs_num_env[1] > 5) {", " av_log(ac->avccontext, AV_LOG_ERROR,", " \"Invalid bitstream, too many SBR envelopes in VARVAR type SBR frame: %d\\n\",", " ch_data->bs_num_env[1]);", " return -1;" ], "line_no": [ 141, 131, 145, 147, 137, 153, 131, 157, 147, 137 ] }
static int FUNC_0(AACContext *VAR_0, SpectralBandReplication *VAR_1, GetBitContext *VAR_2, SBRData *VAR_3) { int VAR_4; VAR_3->bs_freq_res[0] = VAR_3->bs_freq_res[VAR_3->bs_num_env[1]]; VAR_3->bs_num_env[0] = VAR_3->bs_num_env[1]; VAR_3->bs_amp_res = VAR_1->bs_amp_res_header; switch (VAR_3->bs_frame_class = get_bits(VAR_2, 2)) { case FIXFIX: VAR_3->bs_num_env[1] = 1 << get_bits(VAR_2, 2); if (VAR_3->bs_num_env[1] == 1) VAR_3->bs_amp_res = 0; VAR_3->bs_pointer = 0; VAR_3->bs_freq_res[1] = get_bits1(VAR_2); for (VAR_4 = 1; VAR_4 < VAR_3->bs_num_env[1]; VAR_4++) VAR_3->bs_freq_res[VAR_4 + 1] = VAR_3->bs_freq_res[1]; break; case FIXVAR: VAR_3->bs_var_bord[1] = get_bits(VAR_2, 2); VAR_3->bs_num_rel[1] = get_bits(VAR_2, 2); VAR_3->bs_num_env[1] = VAR_3->bs_num_rel[1] + 1; for (VAR_4 = 0; VAR_4 < VAR_3->bs_num_rel[1]; VAR_4++) VAR_3->bs_rel_bord[1][VAR_4] = 2 * get_bits(VAR_2, 2) + 2; VAR_3->bs_pointer = get_bits(VAR_2, ceil_log2[VAR_3->bs_num_env[1]]); for (VAR_4 = 0; VAR_4 < VAR_3->bs_num_env[1]; VAR_4++) VAR_3->bs_freq_res[VAR_3->bs_num_env[1] - VAR_4] = get_bits1(VAR_2); break; case VARFIX: VAR_3->bs_var_bord[0] = get_bits(VAR_2, 2); VAR_3->bs_num_rel[0] = get_bits(VAR_2, 2); VAR_3->bs_num_env[1] = VAR_3->bs_num_rel[0] + 1; for (VAR_4 = 0; VAR_4 < VAR_3->bs_num_rel[0]; VAR_4++) VAR_3->bs_rel_bord[0][VAR_4] = 2 * get_bits(VAR_2, 2) + 2; VAR_3->bs_pointer = get_bits(VAR_2, ceil_log2[VAR_3->bs_num_env[1]]); get_bits1_vector(VAR_2, VAR_3->bs_freq_res + 1, VAR_3->bs_num_env[1]); break; case VARVAR: VAR_3->bs_var_bord[0] = get_bits(VAR_2, 2); VAR_3->bs_var_bord[1] = get_bits(VAR_2, 2); VAR_3->bs_num_rel[0] = get_bits(VAR_2, 2); VAR_3->bs_num_rel[1] = get_bits(VAR_2, 2); VAR_3->bs_num_env[1] = VAR_3->bs_num_rel[0] + VAR_3->bs_num_rel[1] + 1; for (VAR_4 = 0; VAR_4 < VAR_3->bs_num_rel[0]; VAR_4++) VAR_3->bs_rel_bord[0][VAR_4] = 2 * get_bits(VAR_2, 2) + 2; for (VAR_4 = 0; VAR_4 < VAR_3->bs_num_rel[1]; VAR_4++) VAR_3->bs_rel_bord[1][VAR_4] = 2 * get_bits(VAR_2, 2) + 2; VAR_3->bs_pointer = get_bits(VAR_2, ceil_log2[VAR_3->bs_num_env[1]]); get_bits1_vector(VAR_2, VAR_3->bs_freq_res + 1, VAR_3->bs_num_env[1]); break; } if (VAR_3->bs_pointer > VAR_3->bs_num_env[1] + 1) { av_log(VAR_0->avccontext, AV_LOG_ERROR, "Invalid bitstream, bs_pointer points to a middle noise border outside the time borders table: %d\n", VAR_3->bs_pointer); return -1; } if (VAR_3->bs_frame_class == FIXFIX && VAR_3->bs_num_env[1] > 4) { av_log(VAR_0->avccontext, AV_LOG_ERROR, "Invalid bitstream, too many SBR envelopes in FIXFIX type SBR frame: %d\n", VAR_3->bs_num_env[1]); return -1; } if (VAR_3->bs_frame_class == VARVAR && VAR_3->bs_num_env[1] > 5) { av_log(VAR_0->avccontext, AV_LOG_ERROR, "Invalid bitstream, too many SBR envelopes in VARVAR type SBR frame: %d\n", VAR_3->bs_num_env[1]); return -1; } VAR_3->bs_num_noise = (VAR_3->bs_num_env[1] > 1) + 1; return 0; }
[ "static int FUNC_0(AACContext *VAR_0, SpectralBandReplication *VAR_1,\nGetBitContext *VAR_2, SBRData *VAR_3)\n{", "int VAR_4;", "VAR_3->bs_freq_res[0] = VAR_3->bs_freq_res[VAR_3->bs_num_env[1]];", "VAR_3->bs_num_env[0] = VAR_3->bs_num_env[1];", "VAR_3->bs_amp_res = VAR_1->bs_amp_res_header;", "switch (VAR_3->bs_frame_class = get_bits(VAR_2, 2)) {", "case FIXFIX:\nVAR_3->bs_num_env[1] = 1 << get_bits(VAR_2, 2);", "if (VAR_3->bs_num_env[1] == 1)\nVAR_3->bs_amp_res = 0;", "VAR_3->bs_pointer = 0;", "VAR_3->bs_freq_res[1] = get_bits1(VAR_2);", "for (VAR_4 = 1; VAR_4 < VAR_3->bs_num_env[1]; VAR_4++)", "VAR_3->bs_freq_res[VAR_4 + 1] = VAR_3->bs_freq_res[1];", "break;", "case FIXVAR:\nVAR_3->bs_var_bord[1] = get_bits(VAR_2, 2);", "VAR_3->bs_num_rel[1] = get_bits(VAR_2, 2);", "VAR_3->bs_num_env[1] = VAR_3->bs_num_rel[1] + 1;", "for (VAR_4 = 0; VAR_4 < VAR_3->bs_num_rel[1]; VAR_4++)", "VAR_3->bs_rel_bord[1][VAR_4] = 2 * get_bits(VAR_2, 2) + 2;", "VAR_3->bs_pointer = get_bits(VAR_2, ceil_log2[VAR_3->bs_num_env[1]]);", "for (VAR_4 = 0; VAR_4 < VAR_3->bs_num_env[1]; VAR_4++)", "VAR_3->bs_freq_res[VAR_3->bs_num_env[1] - VAR_4] = get_bits1(VAR_2);", "break;", "case VARFIX:\nVAR_3->bs_var_bord[0] = get_bits(VAR_2, 2);", "VAR_3->bs_num_rel[0] = get_bits(VAR_2, 2);", "VAR_3->bs_num_env[1] = VAR_3->bs_num_rel[0] + 1;", "for (VAR_4 = 0; VAR_4 < VAR_3->bs_num_rel[0]; VAR_4++)", "VAR_3->bs_rel_bord[0][VAR_4] = 2 * get_bits(VAR_2, 2) + 2;", "VAR_3->bs_pointer = get_bits(VAR_2, ceil_log2[VAR_3->bs_num_env[1]]);", "get_bits1_vector(VAR_2, VAR_3->bs_freq_res + 1, VAR_3->bs_num_env[1]);", "break;", "case VARVAR:\nVAR_3->bs_var_bord[0] = get_bits(VAR_2, 2);", "VAR_3->bs_var_bord[1] = get_bits(VAR_2, 2);", "VAR_3->bs_num_rel[0] = get_bits(VAR_2, 2);", "VAR_3->bs_num_rel[1] = get_bits(VAR_2, 2);", "VAR_3->bs_num_env[1] = VAR_3->bs_num_rel[0] + VAR_3->bs_num_rel[1] + 1;", "for (VAR_4 = 0; VAR_4 < VAR_3->bs_num_rel[0]; VAR_4++)", "VAR_3->bs_rel_bord[0][VAR_4] = 2 * get_bits(VAR_2, 2) + 2;", "for (VAR_4 = 0; VAR_4 < VAR_3->bs_num_rel[1]; VAR_4++)", "VAR_3->bs_rel_bord[1][VAR_4] = 2 * get_bits(VAR_2, 2) + 2;", "VAR_3->bs_pointer = get_bits(VAR_2, ceil_log2[VAR_3->bs_num_env[1]]);", "get_bits1_vector(VAR_2, VAR_3->bs_freq_res + 1, VAR_3->bs_num_env[1]);", "break;", "}", "if (VAR_3->bs_pointer > VAR_3->bs_num_env[1] + 1) {", "av_log(VAR_0->avccontext, AV_LOG_ERROR,\n\"Invalid bitstream, bs_pointer points to a middle noise border outside the time borders table: %d\\n\",\nVAR_3->bs_pointer);", "return -1;", "}", "if (VAR_3->bs_frame_class == FIXFIX && VAR_3->bs_num_env[1] > 4) {", "av_log(VAR_0->avccontext, AV_LOG_ERROR,\n\"Invalid bitstream, too many SBR envelopes in FIXFIX type SBR frame: %d\\n\",\nVAR_3->bs_num_env[1]);", "return -1;", "}", "if (VAR_3->bs_frame_class == VARVAR && VAR_3->bs_num_env[1] > 5) {", "av_log(VAR_0->avccontext, AV_LOG_ERROR,\n\"Invalid bitstream, too many SBR envelopes in VARVAR type SBR frame: %d\\n\",\nVAR_3->bs_num_env[1]);", "return -1;", "}", "VAR_3->bs_num_noise = (VAR_3->bs_num_env[1] > 1) + 1;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21, 23 ], [ 25, 27 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43, 45 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ], [ 59 ], [ 63 ], [ 65 ], [ 67 ], [ 69, 71 ], [ 73 ], [ 75 ], [ 79 ], [ 81 ], [ 85 ], [ 89 ], [ 91 ], [ 93, 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 117 ], [ 121 ], [ 123 ], [ 125 ], [ 129 ], [ 131, 133, 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143, 145, 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155, 157, 159 ], [ 161 ], [ 163 ], [ 167 ], [ 171 ], [ 173 ] ]
7,549
static void extract_exponents(AC3EncodeContext *s) { int blk, ch, i; for (ch = 0; ch < s->channels; ch++) { for (blk = 0; blk < AC3_MAX_BLOCKS; blk++) { AC3Block *block = &s->blocks[blk]; uint8_t *exp = block->exp[ch]; int32_t *coef = block->fixed_coef[ch]; int exp_shift = block->exp_shift[ch]; for (i = 0; i < AC3_MAX_COEFS; i++) { int e; int v = abs(coef[i]); if (v == 0) e = 24; else { e = 23 - av_log2(v) + exp_shift; if (e >= 24) { e = 24; coef[i] = 0; } av_assert2(e >= 0); } exp[i] = e; } } } }
true
FFmpeg
323e6fead07c75f418e4b60704a4f437bb3483b2
static void extract_exponents(AC3EncodeContext *s) { int blk, ch, i; for (ch = 0; ch < s->channels; ch++) { for (blk = 0; blk < AC3_MAX_BLOCKS; blk++) { AC3Block *block = &s->blocks[blk]; uint8_t *exp = block->exp[ch]; int32_t *coef = block->fixed_coef[ch]; int exp_shift = block->exp_shift[ch]; for (i = 0; i < AC3_MAX_COEFS; i++) { int e; int v = abs(coef[i]); if (v == 0) e = 24; else { e = 23 - av_log2(v) + exp_shift; if (e >= 24) { e = 24; coef[i] = 0; } av_assert2(e >= 0); } exp[i] = e; } } } }
{ "code": [ " int exp_shift = block->exp_shift[ch];", " e = 23 - av_log2(v) + exp_shift;" ], "line_no": [ 19, 33 ] }
static void FUNC_0(AC3EncodeContext *VAR_0) { int VAR_1, VAR_2, VAR_3; for (VAR_2 = 0; VAR_2 < VAR_0->channels; VAR_2++) { for (VAR_1 = 0; VAR_1 < AC3_MAX_BLOCKS; VAR_1++) { AC3Block *block = &VAR_0->blocks[VAR_1]; uint8_t *exp = block->exp[VAR_2]; int32_t *coef = block->fixed_coef[VAR_2]; int exp_shift = block->exp_shift[VAR_2]; for (VAR_3 = 0; VAR_3 < AC3_MAX_COEFS; VAR_3++) { int e; int v = abs(coef[VAR_3]); if (v == 0) e = 24; else { e = 23 - av_log2(v) + exp_shift; if (e >= 24) { e = 24; coef[VAR_3] = 0; } av_assert2(e >= 0); } exp[VAR_3] = e; } } } }
[ "static void FUNC_0(AC3EncodeContext *VAR_0)\n{", "int VAR_1, VAR_2, VAR_3;", "for (VAR_2 = 0; VAR_2 < VAR_0->channels; VAR_2++) {", "for (VAR_1 = 0; VAR_1 < AC3_MAX_BLOCKS; VAR_1++) {", "AC3Block *block = &VAR_0->blocks[VAR_1];", "uint8_t *exp = block->exp[VAR_2];", "int32_t *coef = block->fixed_coef[VAR_2];", "int exp_shift = block->exp_shift[VAR_2];", "for (VAR_3 = 0; VAR_3 < AC3_MAX_COEFS; VAR_3++) {", "int e;", "int v = abs(coef[VAR_3]);", "if (v == 0)\ne = 24;", "else {", "e = 23 - av_log2(v) + exp_shift;", "if (e >= 24) {", "e = 24;", "coef[VAR_3] = 0;", "}", "av_assert2(e >= 0);", "}", "exp[VAR_3] = e;", "}", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 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 ], [ 55 ] ]
7,550
static float32 roundAndPackFloat32( flag zSign, int16 zExp, uint32_t zSig STATUS_PARAM) { int8 roundingMode; flag roundNearestEven; int8 roundIncrement, roundBits; flag isTiny; roundingMode = STATUS(float_rounding_mode); roundNearestEven = ( roundingMode == float_round_nearest_even ); roundIncrement = 0x40; if ( ! roundNearestEven ) { if ( roundingMode == float_round_to_zero ) { roundIncrement = 0; } else { roundIncrement = 0x7F; if ( zSign ) { if ( roundingMode == float_round_up ) roundIncrement = 0; } else { if ( roundingMode == float_round_down ) roundIncrement = 0; } } } roundBits = zSig & 0x7F; if ( 0xFD <= (uint16_t) zExp ) { if ( ( 0xFD < zExp ) || ( ( zExp == 0xFD ) && ( (int32_t) ( zSig + roundIncrement ) < 0 ) ) ) { float_raise( float_flag_overflow | float_flag_inexact STATUS_VAR); return packFloat32( zSign, 0xFF, - ( roundIncrement == 0 )); } if ( zExp < 0 ) { if ( STATUS(flush_to_zero) ) return packFloat32( zSign, 0, 0 ); isTiny = ( STATUS(float_detect_tininess) == float_tininess_before_rounding ) || ( zExp < -1 ) || ( zSig + roundIncrement < 0x80000000 ); shift32RightJamming( zSig, - zExp, &zSig ); zExp = 0; roundBits = zSig & 0x7F; if ( isTiny && roundBits ) float_raise( float_flag_underflow STATUS_VAR); } } if ( roundBits ) STATUS(float_exception_flags) |= float_flag_inexact; zSig = ( zSig + roundIncrement )>>7; zSig &= ~ ( ( ( roundBits ^ 0x40 ) == 0 ) & roundNearestEven ); if ( zSig == 0 ) zExp = 0; return packFloat32( zSign, zExp, zSig ); }
true
qemu
e6afc87f804abee7d0479be5e8e31c56d885fafb
static float32 roundAndPackFloat32( flag zSign, int16 zExp, uint32_t zSig STATUS_PARAM) { int8 roundingMode; flag roundNearestEven; int8 roundIncrement, roundBits; flag isTiny; roundingMode = STATUS(float_rounding_mode); roundNearestEven = ( roundingMode == float_round_nearest_even ); roundIncrement = 0x40; if ( ! roundNearestEven ) { if ( roundingMode == float_round_to_zero ) { roundIncrement = 0; } else { roundIncrement = 0x7F; if ( zSign ) { if ( roundingMode == float_round_up ) roundIncrement = 0; } else { if ( roundingMode == float_round_down ) roundIncrement = 0; } } } roundBits = zSig & 0x7F; if ( 0xFD <= (uint16_t) zExp ) { if ( ( 0xFD < zExp ) || ( ( zExp == 0xFD ) && ( (int32_t) ( zSig + roundIncrement ) < 0 ) ) ) { float_raise( float_flag_overflow | float_flag_inexact STATUS_VAR); return packFloat32( zSign, 0xFF, - ( roundIncrement == 0 )); } if ( zExp < 0 ) { if ( STATUS(flush_to_zero) ) return packFloat32( zSign, 0, 0 ); isTiny = ( STATUS(float_detect_tininess) == float_tininess_before_rounding ) || ( zExp < -1 ) || ( zSig + roundIncrement < 0x80000000 ); shift32RightJamming( zSig, - zExp, &zSig ); zExp = 0; roundBits = zSig & 0x7F; if ( isTiny && roundBits ) float_raise( float_flag_underflow STATUS_VAR); } } if ( roundBits ) STATUS(float_exception_flags) |= float_flag_inexact; zSig = ( zSig + roundIncrement )>>7; zSig &= ~ ( ( ( roundBits ^ 0x40 ) == 0 ) & roundNearestEven ); if ( zSig == 0 ) zExp = 0; return packFloat32( zSign, zExp, zSig ); }
{ "code": [ " if ( STATUS(flush_to_zero) ) return packFloat32( zSign, 0, 0 );", " if ( STATUS(flush_to_zero) ) return packFloat32( zSign, 0, 0 );" ], "line_no": [ 69, 69 ] }
static float32 FUNC_0( flag zSign, int16 zExp, uint32_t zSig STATUS_PARAM) { int8 roundingMode; flag roundNearestEven; int8 roundIncrement, roundBits; flag isTiny; roundingMode = STATUS(float_rounding_mode); roundNearestEven = ( roundingMode == float_round_nearest_even ); roundIncrement = 0x40; if ( ! roundNearestEven ) { if ( roundingMode == float_round_to_zero ) { roundIncrement = 0; } else { roundIncrement = 0x7F; if ( zSign ) { if ( roundingMode == float_round_up ) roundIncrement = 0; } else { if ( roundingMode == float_round_down ) roundIncrement = 0; } } } roundBits = zSig & 0x7F; if ( 0xFD <= (uint16_t) zExp ) { if ( ( 0xFD < zExp ) || ( ( zExp == 0xFD ) && ( (int32_t) ( zSig + roundIncrement ) < 0 ) ) ) { float_raise( float_flag_overflow | float_flag_inexact STATUS_VAR); return packFloat32( zSign, 0xFF, - ( roundIncrement == 0 )); } if ( zExp < 0 ) { if ( STATUS(flush_to_zero) ) return packFloat32( zSign, 0, 0 ); isTiny = ( STATUS(float_detect_tininess) == float_tininess_before_rounding ) || ( zExp < -1 ) || ( zSig + roundIncrement < 0x80000000 ); shift32RightJamming( zSig, - zExp, &zSig ); zExp = 0; roundBits = zSig & 0x7F; if ( isTiny && roundBits ) float_raise( float_flag_underflow STATUS_VAR); } } if ( roundBits ) STATUS(float_exception_flags) |= float_flag_inexact; zSig = ( zSig + roundIncrement )>>7; zSig &= ~ ( ( ( roundBits ^ 0x40 ) == 0 ) & roundNearestEven ); if ( zSig == 0 ) zExp = 0; return packFloat32( zSign, zExp, zSig ); }
[ "static float32 FUNC_0( flag zSign, int16 zExp, uint32_t zSig STATUS_PARAM)\n{", "int8 roundingMode;", "flag roundNearestEven;", "int8 roundIncrement, roundBits;", "flag isTiny;", "roundingMode = STATUS(float_rounding_mode);", "roundNearestEven = ( roundingMode == float_round_nearest_even );", "roundIncrement = 0x40;", "if ( ! roundNearestEven ) {", "if ( roundingMode == float_round_to_zero ) {", "roundIncrement = 0;", "}", "else {", "roundIncrement = 0x7F;", "if ( zSign ) {", "if ( roundingMode == float_round_up ) roundIncrement = 0;", "}", "else {", "if ( roundingMode == float_round_down ) roundIncrement = 0;", "}", "}", "}", "roundBits = zSig & 0x7F;", "if ( 0xFD <= (uint16_t) zExp ) {", "if ( ( 0xFD < zExp )\n|| ( ( zExp == 0xFD )\n&& ( (int32_t) ( zSig + roundIncrement ) < 0 ) )\n) {", "float_raise( float_flag_overflow | float_flag_inexact STATUS_VAR);", "return packFloat32( zSign, 0xFF, - ( roundIncrement == 0 ));", "}", "if ( zExp < 0 ) {", "if ( STATUS(flush_to_zero) ) return packFloat32( zSign, 0, 0 );", "isTiny =\n( STATUS(float_detect_tininess) == float_tininess_before_rounding )\n|| ( zExp < -1 )\n|| ( zSig + roundIncrement < 0x80000000 );", "shift32RightJamming( zSig, - zExp, &zSig );", "zExp = 0;", "roundBits = zSig & 0x7F;", "if ( isTiny && roundBits ) float_raise( float_flag_underflow STATUS_VAR);", "}", "}", "if ( roundBits ) STATUS(float_exception_flags) |= float_flag_inexact;", "zSig = ( zSig + roundIncrement )>>7;", "zSig &= ~ ( ( ( roundBits ^ 0x40 ) == 0 ) & roundNearestEven );", "if ( zSig == 0 ) zExp = 0;", "return packFloat32( zSign, zExp, zSig );", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53, 55, 57, 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71, 73, 75, 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 103 ] ]
7,551
static av_cold int oggvorbis_encode_close(AVCodecContext *avctx) { OggVorbisContext *s = avctx->priv_data; /* notify vorbisenc this is EOF */ vorbis_analysis_wrote(&s->vd, 0); vorbis_block_clear(&s->vb); vorbis_dsp_clear(&s->vd); vorbis_info_clear(&s->vi); av_freep(&avctx->coded_frame); av_freep(&avctx->extradata); return 0; }
true
FFmpeg
f15c4281dcabeddb61cb6430e0cc1047173292f8
static av_cold int oggvorbis_encode_close(AVCodecContext *avctx) { OggVorbisContext *s = avctx->priv_data; vorbis_analysis_wrote(&s->vd, 0); vorbis_block_clear(&s->vb); vorbis_dsp_clear(&s->vd); vorbis_info_clear(&s->vi); av_freep(&avctx->coded_frame); av_freep(&avctx->extradata); return 0; }
{ "code": [ " vorbis_analysis_wrote(&s->vd, 0);" ], "line_no": [ 11 ] }
static av_cold int FUNC_0(AVCodecContext *avctx) { OggVorbisContext *s = avctx->priv_data; vorbis_analysis_wrote(&s->vd, 0); vorbis_block_clear(&s->vb); vorbis_dsp_clear(&s->vd); vorbis_info_clear(&s->vi); av_freep(&avctx->coded_frame); av_freep(&avctx->extradata); return 0; }
[ "static av_cold int FUNC_0(AVCodecContext *avctx)\n{", "OggVorbisContext *s = avctx->priv_data;", "vorbis_analysis_wrote(&s->vd, 0);", "vorbis_block_clear(&s->vb);", "vorbis_dsp_clear(&s->vd);", "vorbis_info_clear(&s->vi);", "av_freep(&avctx->coded_frame);", "av_freep(&avctx->extradata);", "return 0;", "}" ]
[ 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ] ]
7,552
int av_parse_time(int64_t *timeval, const char *timestr, int duration) { const char *p; int64_t t; struct tm dt = { 0 }; int i; static const char * const date_fmt[] = { "%Y-%m-%d", "%Y%m%d", }; static const char * const time_fmt[] = { "%H:%M:%S", "%H%M%S", }; const char *q; int is_utc, len; char lastch; int negative = 0; #undef time time_t now = time(0); len = strlen(timestr); if (len > 0) lastch = timestr[len - 1]; else lastch = '\0'; is_utc = (lastch == 'z' || lastch == 'Z'); p = timestr; q = NULL; if (!duration) { if (!av_strncasecmp(timestr, "now", len)) { *timeval = (int64_t) now * 1000000; return 0; } /* parse the year-month-day part */ for (i = 0; i < FF_ARRAY_ELEMS(date_fmt); i++) { q = small_strptime(p, date_fmt[i], &dt); if (q) { break; } } /* if the year-month-day part is missing, then take the * current year-month-day time */ if (!q) { if (is_utc) { dt = *gmtime(&now); } else { dt = *localtime(&now); } dt.tm_hour = dt.tm_min = dt.tm_sec = 0; } else { p = q; } if (*p == 'T' || *p == 't' || *p == ' ') p++; /* parse the hour-minute-second part */ for (i = 0; i < FF_ARRAY_ELEMS(time_fmt); i++) { q = small_strptime(p, time_fmt[i], &dt); if (q) { break; } } } else { /* parse timestr as a duration */ if (p[0] == '-') { negative = 1; ++p; } /* parse timestr as HH:MM:SS */ q = small_strptime(p, time_fmt[0], &dt); if (!q) { /* parse timestr as S+ */ dt.tm_sec = strtol(p, (void *)&q, 10); if (q == p) { /* the parsing didn't succeed */ *timeval = INT64_MIN; return AVERROR(EINVAL); } dt.tm_min = 0; dt.tm_hour = 0; } } /* Now we have all the fields that we can get */ if (!q) { *timeval = INT64_MIN; return AVERROR(EINVAL); } if (duration) { t = dt.tm_hour * 3600 + dt.tm_min * 60 + dt.tm_sec; } else { dt.tm_isdst = -1; /* unknown */ if (is_utc) { t = av_timegm(&dt); } else { t = mktime(&dt); } } t *= 1000000; /* parse the .m... part */ if (*q == '.') { int val, n; q++; for (val = 0, n = 100000; n >= 1; n /= 10, q++) { if (!isdigit(*q)) break; val += n * (*q - '0'); } t += val; } *timeval = negative ? -t : t; return 0; }
true
FFmpeg
43b70680706f1c275f0c4a67e1483e409e73538a
int av_parse_time(int64_t *timeval, const char *timestr, int duration) { const char *p; int64_t t; struct tm dt = { 0 }; int i; static const char * const date_fmt[] = { "%Y-%m-%d", "%Y%m%d", }; static const char * const time_fmt[] = { "%H:%M:%S", "%H%M%S", }; const char *q; int is_utc, len; char lastch; int negative = 0; #undef time time_t now = time(0); len = strlen(timestr); if (len > 0) lastch = timestr[len - 1]; else lastch = '\0'; is_utc = (lastch == 'z' || lastch == 'Z'); p = timestr; q = NULL; if (!duration) { if (!av_strncasecmp(timestr, "now", len)) { *timeval = (int64_t) now * 1000000; return 0; } for (i = 0; i < FF_ARRAY_ELEMS(date_fmt); i++) { q = small_strptime(p, date_fmt[i], &dt); if (q) { break; } } if (!q) { if (is_utc) { dt = *gmtime(&now); } else { dt = *localtime(&now); } dt.tm_hour = dt.tm_min = dt.tm_sec = 0; } else { p = q; } if (*p == 'T' || *p == 't' || *p == ' ') p++; for (i = 0; i < FF_ARRAY_ELEMS(time_fmt); i++) { q = small_strptime(p, time_fmt[i], &dt); if (q) { break; } } } else { if (p[0] == '-') { negative = 1; ++p; } q = small_strptime(p, time_fmt[0], &dt); if (!q) { dt.tm_sec = strtol(p, (void *)&q, 10); if (q == p) { *timeval = INT64_MIN; return AVERROR(EINVAL); } dt.tm_min = 0; dt.tm_hour = 0; } } if (!q) { *timeval = INT64_MIN; return AVERROR(EINVAL); } if (duration) { t = dt.tm_hour * 3600 + dt.tm_min * 60 + dt.tm_sec; } else { dt.tm_isdst = -1; if (is_utc) { t = av_timegm(&dt); } else { t = mktime(&dt); } } t *= 1000000; if (*q == '.') { int val, n; q++; for (val = 0, n = 100000; n >= 1; n /= 10, q++) { if (!isdigit(*q)) break; val += n * (*q - '0'); } t += val; } *timeval = negative ? -t : t; return 0; }
{ "code": [ " const char *p;", " const char *q;", " int is_utc, len;", " char lastch;", " int negative = 0;", "#undef time", " time_t now = time(0);", " len = strlen(timestr);", " if (len > 0)", " lastch = timestr[len - 1];", " lastch = '\\0';", " is_utc = (lastch == 'z' || lastch == 'Z');", " if (!av_strncasecmp(timestr, \"now\", len)) {", " if (q) {", " if (is_utc) {", " dt = *gmtime(&now);", " } else {", " dt = *localtime(&now);", " dt.tm_hour = dt.tm_min = dt.tm_sec = 0;", " } else {", " p = q;", " if (q) {", " if (q == p) {", " *timeval = INT64_MIN;", " if (!q) {", " *timeval = INT64_MIN;", " if (is_utc) {", " t = av_timegm(&dt);", " } else {", " t = mktime(&dt);", " t *= 1000000;", " if (*q == '.') {", " int val, n;", " q++;", " for (val = 0, n = 100000; n >= 1; n /= 10, q++) {", " if (!isdigit(*q))", " break;", " val += n * (*q - '0');", " t += val;" ], "line_no": [ 5, 29, 31, 33, 35, 39, 41, 45, 47, 49, 53, 55, 65, 81, 97, 99, 101, 103, 107, 109, 111, 81, 159, 163, 181, 183, 199, 201, 109, 205, 213, 219, 221, 223, 225, 227, 83, 231, 235 ] }
int FUNC_0(int64_t *VAR_0, const char *VAR_1, int VAR_2) { const char *VAR_3; int64_t t; struct tm VAR_4 = { 0 }; int VAR_5; static const char * const VAR_6[] = { "%Y-%m-%d", "%Y%m%d", }; static const char * const VAR_7[] = { "%H:%M:%S", "%H%M%S", }; const char *VAR_8; int VAR_9, VAR_10; char VAR_11; int VAR_12 = 0; #undef time time_t now = time(0); VAR_10 = strlen(VAR_1); if (VAR_10 > 0) VAR_11 = VAR_1[VAR_10 - 1]; else VAR_11 = '\0'; VAR_9 = (VAR_11 == 'z' || VAR_11 == 'Z'); VAR_3 = VAR_1; VAR_8 = NULL; if (!VAR_2) { if (!av_strncasecmp(VAR_1, "now", VAR_10)) { *VAR_0 = (int64_t) now * 1000000; return 0; } for (VAR_5 = 0; VAR_5 < FF_ARRAY_ELEMS(VAR_6); VAR_5++) { VAR_8 = small_strptime(VAR_3, VAR_6[VAR_5], &VAR_4); if (VAR_8) { break; } } if (!VAR_8) { if (VAR_9) { VAR_4 = *gmtime(&now); } else { VAR_4 = *localtime(&now); } VAR_4.tm_hour = VAR_4.tm_min = VAR_4.tm_sec = 0; } else { VAR_3 = VAR_8; } if (*VAR_3 == 'T' || *VAR_3 == 't' || *VAR_3 == ' ') VAR_3++; for (VAR_5 = 0; VAR_5 < FF_ARRAY_ELEMS(VAR_7); VAR_5++) { VAR_8 = small_strptime(VAR_3, VAR_7[VAR_5], &VAR_4); if (VAR_8) { break; } } } else { if (VAR_3[0] == '-') { VAR_12 = 1; ++VAR_3; } VAR_8 = small_strptime(VAR_3, VAR_7[0], &VAR_4); if (!VAR_8) { VAR_4.tm_sec = strtol(VAR_3, (void *)&VAR_8, 10); if (VAR_8 == VAR_3) { *VAR_0 = INT64_MIN; return AVERROR(EINVAL); } VAR_4.tm_min = 0; VAR_4.tm_hour = 0; } } if (!VAR_8) { *VAR_0 = INT64_MIN; return AVERROR(EINVAL); } if (VAR_2) { t = VAR_4.tm_hour * 3600 + VAR_4.tm_min * 60 + VAR_4.tm_sec; } else { VAR_4.tm_isdst = -1; if (VAR_9) { t = av_timegm(&VAR_4); } else { t = mktime(&VAR_4); } } t *= 1000000; if (*VAR_8 == '.') { int VAR_13, VAR_14; VAR_8++; for (VAR_13 = 0, VAR_14 = 100000; VAR_14 >= 1; VAR_14 /= 10, VAR_8++) { if (!isdigit(*VAR_8)) break; VAR_13 += VAR_14 * (*VAR_8 - '0'); } t += VAR_13; } *VAR_0 = VAR_12 ? -t : t; return 0; }
[ "int FUNC_0(int64_t *VAR_0, const char *VAR_1, int VAR_2)\n{", "const char *VAR_3;", "int64_t t;", "struct tm VAR_4 = { 0 };", "int VAR_5;", "static const char * const VAR_6[] = {", "\"%Y-%m-%d\",\n\"%Y%m%d\",\n};", "static const char * const VAR_7[] = {", "\"%H:%M:%S\",\n\"%H%M%S\",\n};", "const char *VAR_8;", "int VAR_9, VAR_10;", "char VAR_11;", "int VAR_12 = 0;", "#undef time\ntime_t now = time(0);", "VAR_10 = strlen(VAR_1);", "if (VAR_10 > 0)\nVAR_11 = VAR_1[VAR_10 - 1];", "else\nVAR_11 = '\\0';", "VAR_9 = (VAR_11 == 'z' || VAR_11 == 'Z');", "VAR_3 = VAR_1;", "VAR_8 = NULL;", "if (!VAR_2) {", "if (!av_strncasecmp(VAR_1, \"now\", VAR_10)) {", "*VAR_0 = (int64_t) now * 1000000;", "return 0;", "}", "for (VAR_5 = 0; VAR_5 < FF_ARRAY_ELEMS(VAR_6); VAR_5++) {", "VAR_8 = small_strptime(VAR_3, VAR_6[VAR_5], &VAR_4);", "if (VAR_8) {", "break;", "}", "}", "if (!VAR_8) {", "if (VAR_9) {", "VAR_4 = *gmtime(&now);", "} else {", "VAR_4 = *localtime(&now);", "}", "VAR_4.tm_hour = VAR_4.tm_min = VAR_4.tm_sec = 0;", "} else {", "VAR_3 = VAR_8;", "}", "if (*VAR_3 == 'T' || *VAR_3 == 't' || *VAR_3 == ' ')\nVAR_3++;", "for (VAR_5 = 0; VAR_5 < FF_ARRAY_ELEMS(VAR_7); VAR_5++) {", "VAR_8 = small_strptime(VAR_3, VAR_7[VAR_5], &VAR_4);", "if (VAR_8) {", "break;", "}", "}", "} else {", "if (VAR_3[0] == '-') {", "VAR_12 = 1;", "++VAR_3;", "}", "VAR_8 = small_strptime(VAR_3, VAR_7[0], &VAR_4);", "if (!VAR_8) {", "VAR_4.tm_sec = strtol(VAR_3, (void *)&VAR_8, 10);", "if (VAR_8 == VAR_3) {", "*VAR_0 = INT64_MIN;", "return AVERROR(EINVAL);", "}", "VAR_4.tm_min = 0;", "VAR_4.tm_hour = 0;", "}", "}", "if (!VAR_8) {", "*VAR_0 = INT64_MIN;", "return AVERROR(EINVAL);", "}", "if (VAR_2) {", "t = VAR_4.tm_hour * 3600 + VAR_4.tm_min * 60 + VAR_4.tm_sec;", "} else {", "VAR_4.tm_isdst = -1;", "if (VAR_9) {", "t = av_timegm(&VAR_4);", "} else {", "t = mktime(&VAR_4);", "}", "}", "t *= 1000000;", "if (*VAR_8 == '.') {", "int VAR_13, VAR_14;", "VAR_8++;", "for (VAR_13 = 0, VAR_14 = 100000; VAR_14 >= 1; VAR_14 /= 10, VAR_8++) {", "if (!isdigit(*VAR_8))\nbreak;", "VAR_13 += VAR_14 * (*VAR_8 - '0');", "}", "t += VAR_13;", "}", "*VAR_0 = VAR_12 ? -t : t;", "return 0;", "}" ]
[ 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15, 17, 19 ], [ 21 ], [ 23, 25, 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39, 41 ], [ 45 ], [ 47, 49 ], [ 51, 53 ], [ 55 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 117, 119 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 151 ], [ 153 ], [ 157 ], [ 159 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ], [ 213 ], [ 219 ], [ 221 ], [ 223 ], [ 225 ], [ 227, 229 ], [ 231 ], [ 233 ], [ 235 ], [ 237 ], [ 239 ], [ 241 ], [ 243 ] ]
7,553
void *qemu_get_virtqueue_element(QEMUFile *f, size_t sz) { VirtQueueElement *elem; VirtQueueElementOld data; int i; qemu_get_buffer(f, (uint8_t *)&data, sizeof(VirtQueueElementOld)); elem = virtqueue_alloc_element(sz, data.out_num, data.in_num); elem->index = data.index; for (i = 0; i < elem->in_num; i++) { elem->in_addr[i] = data.in_addr[i]; } for (i = 0; i < elem->out_num; i++) { elem->out_addr[i] = data.out_addr[i]; } for (i = 0; i < elem->in_num; i++) { /* Base is overwritten by virtqueue_map. */ elem->in_sg[i].iov_base = 0; elem->in_sg[i].iov_len = data.in_sg[i].iov_len; } for (i = 0; i < elem->out_num; i++) { /* Base is overwritten by virtqueue_map. */ elem->out_sg[i].iov_base = 0; elem->out_sg[i].iov_len = data.out_sg[i].iov_len; } virtqueue_map(elem); return elem; }
false
qemu
8607f5c3072caeebbe0217df28651fffd3a79fd9
void *qemu_get_virtqueue_element(QEMUFile *f, size_t sz) { VirtQueueElement *elem; VirtQueueElementOld data; int i; qemu_get_buffer(f, (uint8_t *)&data, sizeof(VirtQueueElementOld)); elem = virtqueue_alloc_element(sz, data.out_num, data.in_num); elem->index = data.index; for (i = 0; i < elem->in_num; i++) { elem->in_addr[i] = data.in_addr[i]; } for (i = 0; i < elem->out_num; i++) { elem->out_addr[i] = data.out_addr[i]; } for (i = 0; i < elem->in_num; i++) { elem->in_sg[i].iov_base = 0; elem->in_sg[i].iov_len = data.in_sg[i].iov_len; } for (i = 0; i < elem->out_num; i++) { elem->out_sg[i].iov_base = 0; elem->out_sg[i].iov_len = data.out_sg[i].iov_len; } virtqueue_map(elem); return elem; }
{ "code": [], "line_no": [] }
void *FUNC_0(QEMUFile *VAR_0, size_t VAR_1) { VirtQueueElement *elem; VirtQueueElementOld data; int VAR_2; qemu_get_buffer(VAR_0, (uint8_t *)&data, sizeof(VirtQueueElementOld)); elem = virtqueue_alloc_element(VAR_1, data.out_num, data.in_num); elem->index = data.index; for (VAR_2 = 0; VAR_2 < elem->in_num; VAR_2++) { elem->in_addr[VAR_2] = data.in_addr[VAR_2]; } for (VAR_2 = 0; VAR_2 < elem->out_num; VAR_2++) { elem->out_addr[VAR_2] = data.out_addr[VAR_2]; } for (VAR_2 = 0; VAR_2 < elem->in_num; VAR_2++) { elem->in_sg[VAR_2].iov_base = 0; elem->in_sg[VAR_2].iov_len = data.in_sg[VAR_2].iov_len; } for (VAR_2 = 0; VAR_2 < elem->out_num; VAR_2++) { elem->out_sg[VAR_2].iov_base = 0; elem->out_sg[VAR_2].iov_len = data.out_sg[VAR_2].iov_len; } virtqueue_map(elem); return elem; }
[ "void *FUNC_0(QEMUFile *VAR_0, size_t VAR_1)\n{", "VirtQueueElement *elem;", "VirtQueueElementOld data;", "int VAR_2;", "qemu_get_buffer(VAR_0, (uint8_t *)&data, sizeof(VirtQueueElementOld));", "elem = virtqueue_alloc_element(VAR_1, data.out_num, data.in_num);", "elem->index = data.index;", "for (VAR_2 = 0; VAR_2 < elem->in_num; VAR_2++) {", "elem->in_addr[VAR_2] = data.in_addr[VAR_2];", "}", "for (VAR_2 = 0; VAR_2 < elem->out_num; VAR_2++) {", "elem->out_addr[VAR_2] = data.out_addr[VAR_2];", "}", "for (VAR_2 = 0; VAR_2 < elem->in_num; VAR_2++) {", "elem->in_sg[VAR_2].iov_base = 0;", "elem->in_sg[VAR_2].iov_len = data.in_sg[VAR_2].iov_len;", "}", "for (VAR_2 = 0; VAR_2 < elem->out_num; VAR_2++) {", "elem->out_sg[VAR_2].iov_base = 0;", "elem->out_sg[VAR_2].iov_len = data.out_sg[VAR_2].iov_len;", "}", "virtqueue_map(elem);", "return elem;", "}" ]
[ 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 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 55 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ], [ 67 ] ]
7,554
void qdev_property_add_child(DeviceState *dev, const char *name, DeviceState *child, Error **errp) { gchar *type; type = g_strdup_printf("child<%s>", child->info->name); qdev_property_add(dev, name, type, qdev_get_child_property, NULL, NULL, child, errp); qdev_ref(child); g_assert(child->parent == NULL); child->parent = dev; g_free(type); }
false
qemu
024a6fbdb9d8cbc4d7f833b23db51c9d1004bc47
void qdev_property_add_child(DeviceState *dev, const char *name, DeviceState *child, Error **errp) { gchar *type; type = g_strdup_printf("child<%s>", child->info->name); qdev_property_add(dev, name, type, qdev_get_child_property, NULL, NULL, child, errp); qdev_ref(child); g_assert(child->parent == NULL); child->parent = dev; g_free(type); }
{ "code": [], "line_no": [] }
void FUNC_0(DeviceState *VAR_0, const char *VAR_1, DeviceState *VAR_2, Error **VAR_3) { gchar *type; type = g_strdup_printf("VAR_2<%s>", VAR_2->info->VAR_1); qdev_property_add(VAR_0, VAR_1, type, qdev_get_child_property, NULL, NULL, VAR_2, VAR_3); qdev_ref(VAR_2); g_assert(VAR_2->parent == NULL); VAR_2->parent = VAR_0; g_free(type); }
[ "void FUNC_0(DeviceState *VAR_0, const char *VAR_1,\nDeviceState *VAR_2, Error **VAR_3)\n{", "gchar *type;", "type = g_strdup_printf(\"VAR_2<%s>\", VAR_2->info->VAR_1);", "qdev_property_add(VAR_0, VAR_1, type, qdev_get_child_property,\nNULL, NULL, VAR_2, VAR_3);", "qdev_ref(VAR_2);", "g_assert(VAR_2->parent == NULL);", "VAR_2->parent = VAR_0;", "g_free(type);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 15, 17 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ] ]
7,555
static int copy_sectors(BlockDriverState *bs, uint64_t start_sect, uint64_t cluster_offset, int n_start, int n_end) { BDRVQcowState *s = bs->opaque; int n, ret; n = n_end - n_start; if (n <= 0) return 0; ret = qcow_read(bs, start_sect + n_start, s->cluster_data, n); if (ret < 0) return ret; if (s->crypt_method) { qcow2_encrypt_sectors(s, start_sect + n_start, s->cluster_data, s->cluster_data, n, 1, &s->aes_encrypt_key); } ret = bdrv_write(s->hd, (cluster_offset >> 9) + n_start, s->cluster_data, n); if (ret < 0) return ret; return 0; }
false
qemu
ef845c3bf421290153154635dc18eaa677cecb43
static int copy_sectors(BlockDriverState *bs, uint64_t start_sect, uint64_t cluster_offset, int n_start, int n_end) { BDRVQcowState *s = bs->opaque; int n, ret; n = n_end - n_start; if (n <= 0) return 0; ret = qcow_read(bs, start_sect + n_start, s->cluster_data, n); if (ret < 0) return ret; if (s->crypt_method) { qcow2_encrypt_sectors(s, start_sect + n_start, s->cluster_data, s->cluster_data, n, 1, &s->aes_encrypt_key); } ret = bdrv_write(s->hd, (cluster_offset >> 9) + n_start, s->cluster_data, n); if (ret < 0) return ret; return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(BlockDriverState *VAR_0, uint64_t VAR_1, uint64_t VAR_2, int VAR_3, int VAR_4) { BDRVQcowState *s = VAR_0->opaque; int VAR_5, VAR_6; VAR_5 = VAR_4 - VAR_3; if (VAR_5 <= 0) return 0; VAR_6 = qcow_read(VAR_0, VAR_1 + VAR_3, s->cluster_data, VAR_5); if (VAR_6 < 0) return VAR_6; if (s->crypt_method) { qcow2_encrypt_sectors(s, VAR_1 + VAR_3, s->cluster_data, s->cluster_data, VAR_5, 1, &s->aes_encrypt_key); } VAR_6 = bdrv_write(s->hd, (VAR_2 >> 9) + VAR_3, s->cluster_data, VAR_5); if (VAR_6 < 0) return VAR_6; return 0; }
[ "static int FUNC_0(BlockDriverState *VAR_0, uint64_t VAR_1,\nuint64_t VAR_2, int VAR_3, int VAR_4)\n{", "BDRVQcowState *s = VAR_0->opaque;", "int VAR_5, VAR_6;", "VAR_5 = VAR_4 - VAR_3;", "if (VAR_5 <= 0)\nreturn 0;", "VAR_6 = qcow_read(VAR_0, VAR_1 + VAR_3, s->cluster_data, VAR_5);", "if (VAR_6 < 0)\nreturn VAR_6;", "if (s->crypt_method) {", "qcow2_encrypt_sectors(s, VAR_1 + VAR_3,\ns->cluster_data,\ns->cluster_data, VAR_5, 1,\n&s->aes_encrypt_key);", "}", "VAR_6 = bdrv_write(s->hd, (VAR_2 >> 9) + VAR_3,\ns->cluster_data, VAR_5);", "if (VAR_6 < 0)\nreturn VAR_6;", "return 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 ] ]
7,557
static uint8_t send_read_command(void) { uint8_t drive = 0; uint8_t head = 0; uint8_t cyl = 0; uint8_t sect_addr = 1; uint8_t sect_size = 2; uint8_t eot = 1; uint8_t gap = 0x1b; uint8_t gpl = 0xff; uint8_t msr = 0; uint8_t st0; uint8_t ret = 0; floppy_send(CMD_READ); floppy_send(head << 2 | drive); g_assert(!get_irq(FLOPPY_IRQ)); floppy_send(cyl); floppy_send(head); floppy_send(sect_addr); floppy_send(sect_size); floppy_send(eot); floppy_send(gap); floppy_send(gpl); uint8_t i = 0; uint8_t n = 2; for (; i < n; i++) { msr = inb(FLOPPY_BASE + reg_msr); if (msr == 0xd0) { break; } sleep(1); } if (i >= n) { return 1; } st0 = floppy_recv(); if (st0 != 0x40) { ret = 1; } floppy_recv(); floppy_recv(); floppy_recv(); floppy_recv(); floppy_recv(); floppy_recv(); return ret; }
false
qemu
b3ce604eeaa77970fa53838e7df2bc85344f2554
static uint8_t send_read_command(void) { uint8_t drive = 0; uint8_t head = 0; uint8_t cyl = 0; uint8_t sect_addr = 1; uint8_t sect_size = 2; uint8_t eot = 1; uint8_t gap = 0x1b; uint8_t gpl = 0xff; uint8_t msr = 0; uint8_t st0; uint8_t ret = 0; floppy_send(CMD_READ); floppy_send(head << 2 | drive); g_assert(!get_irq(FLOPPY_IRQ)); floppy_send(cyl); floppy_send(head); floppy_send(sect_addr); floppy_send(sect_size); floppy_send(eot); floppy_send(gap); floppy_send(gpl); uint8_t i = 0; uint8_t n = 2; for (; i < n; i++) { msr = inb(FLOPPY_BASE + reg_msr); if (msr == 0xd0) { break; } sleep(1); } if (i >= n) { return 1; } st0 = floppy_recv(); if (st0 != 0x40) { ret = 1; } floppy_recv(); floppy_recv(); floppy_recv(); floppy_recv(); floppy_recv(); floppy_recv(); return ret; }
{ "code": [], "line_no": [] }
static uint8_t FUNC_0(void) { uint8_t drive = 0; uint8_t head = 0; uint8_t cyl = 0; uint8_t sect_addr = 1; uint8_t sect_size = 2; uint8_t eot = 1; uint8_t gap = 0x1b; uint8_t gpl = 0xff; uint8_t msr = 0; uint8_t st0; uint8_t ret = 0; floppy_send(CMD_READ); floppy_send(head << 2 | drive); g_assert(!get_irq(FLOPPY_IRQ)); floppy_send(cyl); floppy_send(head); floppy_send(sect_addr); floppy_send(sect_size); floppy_send(eot); floppy_send(gap); floppy_send(gpl); uint8_t i = 0; uint8_t n = 2; for (; i < n; i++) { msr = inb(FLOPPY_BASE + reg_msr); if (msr == 0xd0) { break; } sleep(1); } if (i >= n) { return 1; } st0 = floppy_recv(); if (st0 != 0x40) { ret = 1; } floppy_recv(); floppy_recv(); floppy_recv(); floppy_recv(); floppy_recv(); floppy_recv(); return ret; }
[ "static uint8_t FUNC_0(void)\n{", "uint8_t drive = 0;", "uint8_t head = 0;", "uint8_t cyl = 0;", "uint8_t sect_addr = 1;", "uint8_t sect_size = 2;", "uint8_t eot = 1;", "uint8_t gap = 0x1b;", "uint8_t gpl = 0xff;", "uint8_t msr = 0;", "uint8_t st0;", "uint8_t ret = 0;", "floppy_send(CMD_READ);", "floppy_send(head << 2 | drive);", "g_assert(!get_irq(FLOPPY_IRQ));", "floppy_send(cyl);", "floppy_send(head);", "floppy_send(sect_addr);", "floppy_send(sect_size);", "floppy_send(eot);", "floppy_send(gap);", "floppy_send(gpl);", "uint8_t i = 0;", "uint8_t n = 2;", "for (; i < n; i++) {", "msr = inb(FLOPPY_BASE + reg_msr);", "if (msr == 0xd0) {", "break;", "}", "sleep(1);", "}", "if (i >= n) {", "return 1;", "}", "st0 = floppy_recv();", "if (st0 != 0x40) {", "ret = 1;", "}", "floppy_recv();", "floppy_recv();", "floppy_recv();", "floppy_recv();", "floppy_recv();", "floppy_recv();", "return ret;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 75 ], [ 77 ], [ 79 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 107 ], [ 109 ] ]
7,559
static void unassigned_mem_write(void *opaque, target_phys_addr_t addr, uint64_t val, unsigned size) { #ifdef DEBUG_UNASSIGNED printf("Unassigned mem write " TARGET_FMT_plx " = 0x%"PRIx64"\n", addr, val); #endif #if defined(TARGET_ALPHA) || defined(TARGET_SPARC) || defined(TARGET_MICROBLAZE) cpu_unassigned_access(cpu_single_env, addr, 1, 0, 0, size); #endif }
false
qemu
a8170e5e97ad17ca169c64ba87ae2f53850dab4c
static void unassigned_mem_write(void *opaque, target_phys_addr_t addr, uint64_t val, unsigned size) { #ifdef DEBUG_UNASSIGNED printf("Unassigned mem write " TARGET_FMT_plx " = 0x%"PRIx64"\n", addr, val); #endif #if defined(TARGET_ALPHA) || defined(TARGET_SPARC) || defined(TARGET_MICROBLAZE) cpu_unassigned_access(cpu_single_env, addr, 1, 0, 0, size); #endif }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0, target_phys_addr_t VAR_1, uint64_t VAR_2, unsigned VAR_3) { #ifdef DEBUG_UNASSIGNED printf("Unassigned mem write " TARGET_FMT_plx " = 0x%"PRIx64"\n", VAR_1, VAR_2); #endif #if defined(TARGET_ALPHA) || defined(TARGET_SPARC) || defined(TARGET_MICROBLAZE) cpu_unassigned_access(cpu_single_env, VAR_1, 1, 0, 0, VAR_3); #endif }
[ "static void FUNC_0(void *VAR_0, target_phys_addr_t VAR_1,\nuint64_t VAR_2, unsigned VAR_3)\n{", "#ifdef DEBUG_UNASSIGNED\nprintf(\"Unassigned mem write \" TARGET_FMT_plx \" = 0x%\"PRIx64\"\\n\", VAR_1, VAR_2);", "#endif\n#if defined(TARGET_ALPHA) || defined(TARGET_SPARC) || defined(TARGET_MICROBLAZE)\ncpu_unassigned_access(cpu_single_env, VAR_1, 1, 0, 0, VAR_3);", "#endif\n}" ]
[ 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7, 9 ], [ 11, 13, 15 ], [ 17, 19 ] ]
7,560
static void tcg_out_insn_3405(TCGContext *s, AArch64Insn insn, TCGType ext, TCGReg rd, uint16_t half, unsigned shift) { assert((shift & ~0x30) == 0); tcg_out32(s, insn | ext << 31 | shift << (21 - 4) | half << 5 | rd); }
false
qemu
eabb7b91b36b202b4dac2df2d59d698e3aff197a
static void tcg_out_insn_3405(TCGContext *s, AArch64Insn insn, TCGType ext, TCGReg rd, uint16_t half, unsigned shift) { assert((shift & ~0x30) == 0); tcg_out32(s, insn | ext << 31 | shift << (21 - 4) | half << 5 | rd); }
{ "code": [], "line_no": [] }
static void FUNC_0(TCGContext *VAR_0, AArch64Insn VAR_1, TCGType VAR_2, TCGReg VAR_3, uint16_t VAR_4, unsigned VAR_5) { assert((VAR_5 & ~0x30) == 0); tcg_out32(VAR_0, VAR_1 | VAR_2 << 31 | VAR_5 << (21 - 4) | VAR_4 << 5 | VAR_3); }
[ "static void FUNC_0(TCGContext *VAR_0, AArch64Insn VAR_1, TCGType VAR_2,\nTCGReg VAR_3, uint16_t VAR_4, unsigned VAR_5)\n{", "assert((VAR_5 & ~0x30) == 0);", "tcg_out32(VAR_0, VAR_1 | VAR_2 << 31 | VAR_5 << (21 - 4) | VAR_4 << 5 | VAR_3);", "}" ]
[ 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ] ]
7,561
static inline int handle_cpu_signal(unsigned long pc, unsigned long address, int is_write, sigset_t *old_set, void *puc) { TranslationBlock *tb; int ret; if (cpu_single_env) env = cpu_single_env; /* XXX: find a correct solution for multithread */ #if defined(DEBUG_SIGNAL) qemu_printf("qemu: SIGSEGV pc=0x%08lx address=%08lx w=%d oldset=0x%08lx\n", pc, address, is_write, *(unsigned long *)old_set); #endif /* XXX: locking issue */ if (is_write && page_unprotect(address, pc, puc)) { return 1; } /* see if it is an MMU fault */ ret = cpu_x86_handle_mmu_fault(env, address, is_write, ((env->hflags & HF_CPL_MASK) == 3), 0); if (ret < 0) return 0; /* not an MMU fault */ if (ret == 0) return 1; /* the MMU fault was handled without causing real CPU fault */ /* now we have a real cpu fault */ tb = tb_find_pc(pc); if (tb) { /* the PC is inside the translated code. It means that we have a virtual CPU fault */ cpu_restore_state(tb, env, pc, puc); } if (ret == 1) { #if 0 printf("PF exception: EIP=0x%08x CR2=0x%08x error=0x%x\n", env->eip, env->cr[2], env->error_code); #endif /* we restore the process signal mask as the sigreturn should do it (XXX: use sigsetjmp) */ sigprocmask(SIG_SETMASK, old_set, NULL); raise_exception_err(EXCP0E_PAGE, env->error_code); } else { /* activate soft MMU for this block */ env->hflags |= HF_SOFTMMU_MASK; cpu_resume_from_signal(env, puc); } /* never comes here */ return 1; }
false
qemu
54ca9095f046dfa03c3d093cc55f6d76b61864e1
static inline int handle_cpu_signal(unsigned long pc, unsigned long address, int is_write, sigset_t *old_set, void *puc) { TranslationBlock *tb; int ret; if (cpu_single_env) env = cpu_single_env; #if defined(DEBUG_SIGNAL) qemu_printf("qemu: SIGSEGV pc=0x%08lx address=%08lx w=%d oldset=0x%08lx\n", pc, address, is_write, *(unsigned long *)old_set); #endif if (is_write && page_unprotect(address, pc, puc)) { return 1; } ret = cpu_x86_handle_mmu_fault(env, address, is_write, ((env->hflags & HF_CPL_MASK) == 3), 0); if (ret < 0) return 0; if (ret == 0) return 1; tb = tb_find_pc(pc); if (tb) { cpu_restore_state(tb, env, pc, puc); } if (ret == 1) { #if 0 printf("PF exception: EIP=0x%08x CR2=0x%08x error=0x%x\n", env->eip, env->cr[2], env->error_code); #endif sigprocmask(SIG_SETMASK, old_set, NULL); raise_exception_err(EXCP0E_PAGE, env->error_code); } else { env->hflags |= HF_SOFTMMU_MASK; cpu_resume_from_signal(env, puc); } return 1; }
{ "code": [], "line_no": [] }
static inline int FUNC_0(unsigned long VAR_0, unsigned long VAR_1, int VAR_2, sigset_t *VAR_3, void *VAR_4) { TranslationBlock *tb; int VAR_5; if (cpu_single_env) env = cpu_single_env; #if defined(DEBUG_SIGNAL) qemu_printf("qemu: SIGSEGV VAR_0=0x%08lx VAR_1=%08lx w=%d oldset=0x%08lx\n", VAR_0, VAR_1, VAR_2, *(unsigned long *)VAR_3); #endif if (VAR_2 && page_unprotect(VAR_1, VAR_0, VAR_4)) { return 1; } VAR_5 = cpu_x86_handle_mmu_fault(env, VAR_1, VAR_2, ((env->hflags & HF_CPL_MASK) == 3), 0); if (VAR_5 < 0) return 0; if (VAR_5 == 0) return 1; tb = tb_find_pc(VAR_0); if (tb) { cpu_restore_state(tb, env, VAR_0, VAR_4); } if (VAR_5 == 1) { #if 0 printf("PF exception: EIP=0x%08x CR2=0x%08x error=0x%x\n", env->eip, env->cr[2], env->error_code); #endif sigprocmask(SIG_SETMASK, VAR_3, NULL); raise_exception_err(EXCP0E_PAGE, env->error_code); } else { env->hflags |= HF_SOFTMMU_MASK; cpu_resume_from_signal(env, VAR_4); } return 1; }
[ "static inline int FUNC_0(unsigned long VAR_0, unsigned long VAR_1,\nint VAR_2, sigset_t *VAR_3,\nvoid *VAR_4)\n{", "TranslationBlock *tb;", "int VAR_5;", "if (cpu_single_env)\nenv = cpu_single_env;", "#if defined(DEBUG_SIGNAL)\nqemu_printf(\"qemu: SIGSEGV VAR_0=0x%08lx VAR_1=%08lx w=%d oldset=0x%08lx\\n\",\nVAR_0, VAR_1, VAR_2, *(unsigned long *)VAR_3);", "#endif\nif (VAR_2 && page_unprotect(VAR_1, VAR_0, VAR_4)) {", "return 1;", "}", "VAR_5 = cpu_x86_handle_mmu_fault(env, VAR_1, VAR_2,\n((env->hflags & HF_CPL_MASK) == 3), 0);", "if (VAR_5 < 0)\nreturn 0;", "if (VAR_5 == 0)\nreturn 1;", "tb = tb_find_pc(VAR_0);", "if (tb) {", "cpu_restore_state(tb, env, VAR_0, VAR_4);", "}", "if (VAR_5 == 1) {", "#if 0\nprintf(\"PF exception: EIP=0x%08x CR2=0x%08x error=0x%x\\n\",\nenv->eip, env->cr[2], env->error_code);", "#endif\nsigprocmask(SIG_SETMASK, VAR_3, NULL);", "raise_exception_err(EXCP0E_PAGE, env->error_code);", "} else {", "env->hflags |= HF_SOFTMMU_MASK;", "cpu_resume_from_signal(env, VAR_4);", "}", "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 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 15, 17 ], [ 19, 21, 23 ], [ 25, 29 ], [ 31 ], [ 33 ], [ 39, 41 ], [ 43, 45 ], [ 47, 49 ], [ 53 ], [ 55 ], [ 61 ], [ 63 ], [ 65 ], [ 67, 69, 71 ], [ 73, 79 ], [ 81 ], [ 83 ], [ 87 ], [ 89 ], [ 91 ], [ 95 ], [ 97 ] ]
7,562
static void coroutine_fn v9fs_xattrcreate(void *opaque) { int flags; int32_t fid; int64_t size; ssize_t err = 0; V9fsString name; size_t offset = 7; V9fsFidState *file_fidp; V9fsFidState *xattr_fidp; V9fsPDU *pdu = opaque; v9fs_string_init(&name); err = pdu_unmarshal(pdu, offset, "dsqd", &fid, &name, &size, &flags); if (err < 0) { goto out_nofid; } trace_v9fs_xattrcreate(pdu->tag, pdu->id, fid, name.data, size, flags); file_fidp = get_fid(pdu, fid); if (file_fidp == NULL) { err = -EINVAL; goto out_nofid; } /* Make the file fid point to xattr */ xattr_fidp = file_fidp; xattr_fidp->fid_type = P9_FID_XATTR; xattr_fidp->fs.xattr.copied_len = 0; xattr_fidp->fs.xattr.xattrwalk_fid = false; xattr_fidp->fs.xattr.len = size; xattr_fidp->fs.xattr.flags = flags; v9fs_string_init(&xattr_fidp->fs.xattr.name); v9fs_string_copy(&xattr_fidp->fs.xattr.name, &name); g_free(xattr_fidp->fs.xattr.value); xattr_fidp->fs.xattr.value = g_malloc0(size); err = offset; put_fid(pdu, file_fidp); out_nofid: pdu_complete(pdu, err); v9fs_string_free(&name); }
false
qemu
3b79ef2cf48805dc693a8b0c82e05e0abeaa64f8
static void coroutine_fn v9fs_xattrcreate(void *opaque) { int flags; int32_t fid; int64_t size; ssize_t err = 0; V9fsString name; size_t offset = 7; V9fsFidState *file_fidp; V9fsFidState *xattr_fidp; V9fsPDU *pdu = opaque; v9fs_string_init(&name); err = pdu_unmarshal(pdu, offset, "dsqd", &fid, &name, &size, &flags); if (err < 0) { goto out_nofid; } trace_v9fs_xattrcreate(pdu->tag, pdu->id, fid, name.data, size, flags); file_fidp = get_fid(pdu, fid); if (file_fidp == NULL) { err = -EINVAL; goto out_nofid; } xattr_fidp = file_fidp; xattr_fidp->fid_type = P9_FID_XATTR; xattr_fidp->fs.xattr.copied_len = 0; xattr_fidp->fs.xattr.xattrwalk_fid = false; xattr_fidp->fs.xattr.len = size; xattr_fidp->fs.xattr.flags = flags; v9fs_string_init(&xattr_fidp->fs.xattr.name); v9fs_string_copy(&xattr_fidp->fs.xattr.name, &name); g_free(xattr_fidp->fs.xattr.value); xattr_fidp->fs.xattr.value = g_malloc0(size); err = offset; put_fid(pdu, file_fidp); out_nofid: pdu_complete(pdu, err); v9fs_string_free(&name); }
{ "code": [], "line_no": [] }
static void VAR_0 v9fs_xattrcreate(void *opaque) { int flags; int32_t fid; int64_t size; ssize_t err = 0; V9fsString name; size_t offset = 7; V9fsFidState *file_fidp; V9fsFidState *xattr_fidp; V9fsPDU *pdu = opaque; v9fs_string_init(&name); err = pdu_unmarshal(pdu, offset, "dsqd", &fid, &name, &size, &flags); if (err < 0) { goto out_nofid; } trace_v9fs_xattrcreate(pdu->tag, pdu->id, fid, name.data, size, flags); file_fidp = get_fid(pdu, fid); if (file_fidp == NULL) { err = -EINVAL; goto out_nofid; } xattr_fidp = file_fidp; xattr_fidp->fid_type = P9_FID_XATTR; xattr_fidp->fs.xattr.copied_len = 0; xattr_fidp->fs.xattr.xattrwalk_fid = false; xattr_fidp->fs.xattr.len = size; xattr_fidp->fs.xattr.flags = flags; v9fs_string_init(&xattr_fidp->fs.xattr.name); v9fs_string_copy(&xattr_fidp->fs.xattr.name, &name); g_free(xattr_fidp->fs.xattr.value); xattr_fidp->fs.xattr.value = g_malloc0(size); err = offset; put_fid(pdu, file_fidp); out_nofid: pdu_complete(pdu, err); v9fs_string_free(&name); }
[ "static void VAR_0 v9fs_xattrcreate(void *opaque)\n{", "int flags;", "int32_t fid;", "int64_t size;", "ssize_t err = 0;", "V9fsString name;", "size_t offset = 7;", "V9fsFidState *file_fidp;", "V9fsFidState *xattr_fidp;", "V9fsPDU *pdu = opaque;", "v9fs_string_init(&name);", "err = pdu_unmarshal(pdu, offset, \"dsqd\", &fid, &name, &size, &flags);", "if (err < 0) {", "goto out_nofid;", "}", "trace_v9fs_xattrcreate(pdu->tag, pdu->id, fid, name.data, size, flags);", "file_fidp = get_fid(pdu, fid);", "if (file_fidp == NULL) {", "err = -EINVAL;", "goto out_nofid;", "}", "xattr_fidp = file_fidp;", "xattr_fidp->fid_type = P9_FID_XATTR;", "xattr_fidp->fs.xattr.copied_len = 0;", "xattr_fidp->fs.xattr.xattrwalk_fid = false;", "xattr_fidp->fs.xattr.len = size;", "xattr_fidp->fs.xattr.flags = flags;", "v9fs_string_init(&xattr_fidp->fs.xattr.name);", "v9fs_string_copy(&xattr_fidp->fs.xattr.name, &name);", "g_free(xattr_fidp->fs.xattr.value);", "xattr_fidp->fs.xattr.value = g_malloc0(size);", "err = offset;", "put_fid(pdu, file_fidp);", "out_nofid:\npdu_complete(pdu, err);", "v9fs_string_free(&name);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75, 77 ], [ 79 ], [ 81 ] ]
7,563
static void omap_sysctl_write(void *opaque, target_phys_addr_t addr, uint32_t value) { struct omap_sysctl_s *s = (struct omap_sysctl_s *) opaque; switch (addr) { case 0x000: /* CONTROL_REVISION */ case 0x2a4: /* CONTROL_MSUSPENDMUX_5 */ case 0x2c0: /* CONTROL_PSA_VALUE */ case 0x2f8: /* CONTROL_STATUS */ case 0x2fc: /* CONTROL_GENERAL_PURPOSE_STATUS */ case 0x300: /* CONTROL_RPUB_KEY_H_0 */ case 0x304: /* CONTROL_RPUB_KEY_H_1 */ case 0x308: /* CONTROL_RPUB_KEY_H_2 */ case 0x30c: /* CONTROL_RPUB_KEY_H_3 */ case 0x310: /* CONTROL_RAND_KEY_0 */ case 0x314: /* CONTROL_RAND_KEY_1 */ case 0x318: /* CONTROL_RAND_KEY_2 */ case 0x31c: /* CONTROL_RAND_KEY_3 */ case 0x320: /* CONTROL_CUST_KEY_0 */ case 0x324: /* CONTROL_CUST_KEY_1 */ case 0x330: /* CONTROL_TEST_KEY_0 */ case 0x334: /* CONTROL_TEST_KEY_1 */ case 0x338: /* CONTROL_TEST_KEY_2 */ case 0x33c: /* CONTROL_TEST_KEY_3 */ case 0x340: /* CONTROL_TEST_KEY_4 */ case 0x344: /* CONTROL_TEST_KEY_5 */ case 0x348: /* CONTROL_TEST_KEY_6 */ case 0x34c: /* CONTROL_TEST_KEY_7 */ case 0x350: /* CONTROL_TEST_KEY_8 */ case 0x354: /* CONTROL_TEST_KEY_9 */ OMAP_RO_REG(addr); return; case 0x010: /* CONTROL_SYSCONFIG */ s->sysconfig = value & 0x1e; break; case 0x030 ... 0x140: /* CONTROL_PADCONF - only used in the POP */ /* XXX: should check constant bits */ s->padconf[(addr - 0x30) >> 2] = value & 0x1f1f1f1f; break; case 0x270: /* CONTROL_DEBOBS */ s->obs = value & 0xff; break; case 0x274: /* CONTROL_DEVCONF */ s->devconfig = value & 0xffffc7ff; break; case 0x28c: /* CONTROL_EMU_SUPPORT */ break; case 0x290: /* CONTROL_MSUSPENDMUX_0 */ s->msuspendmux[0] = value & 0x3fffffff; break; case 0x294: /* CONTROL_MSUSPENDMUX_1 */ s->msuspendmux[1] = value & 0x3fffffff; break; case 0x298: /* CONTROL_MSUSPENDMUX_2 */ s->msuspendmux[2] = value & 0x3fffffff; break; case 0x29c: /* CONTROL_MSUSPENDMUX_3 */ s->msuspendmux[3] = value & 0x3fffffff; break; case 0x2a0: /* CONTROL_MSUSPENDMUX_4 */ s->msuspendmux[4] = value & 0x3fffffff; break; case 0x2b8: /* CONTROL_PSA_CTRL */ s->psaconfig = value & 0x1c; s->psaconfig |= (value & 0x20) ? 2 : 1; break; case 0x2bc: /* CONTROL_PSA_CMD */ break; case 0x2b0: /* CONTROL_SEC_CTRL */ case 0x2b4: /* CONTROL_SEC_TEST */ case 0x2d0: /* CONTROL_SEC_EMU */ case 0x2d4: /* CONTROL_SEC_TAP */ case 0x2d8: /* CONTROL_OCM_RAM_PERM */ case 0x2dc: /* CONTROL_OCM_PUB_RAM_ADD */ case 0x2e0: /* CONTROL_EXT_SEC_RAM_START_ADD */ case 0x2e4: /* CONTROL_EXT_SEC_RAM_STOP_ADD */ case 0x2f0: /* CONTROL_SEC_STATUS */ case 0x2f4: /* CONTROL_SEC_ERR_STATUS */ break; default: OMAP_BAD_REG(addr); return; } }
false
qemu
a8170e5e97ad17ca169c64ba87ae2f53850dab4c
static void omap_sysctl_write(void *opaque, target_phys_addr_t addr, uint32_t value) { struct omap_sysctl_s *s = (struct omap_sysctl_s *) opaque; switch (addr) { case 0x000: case 0x2a4: case 0x2c0: case 0x2f8: case 0x2fc: case 0x300: case 0x304: case 0x308: case 0x30c: case 0x310: case 0x314: case 0x318: case 0x31c: case 0x320: case 0x324: case 0x330: case 0x334: case 0x338: case 0x33c: case 0x340: case 0x344: case 0x348: case 0x34c: case 0x350: case 0x354: OMAP_RO_REG(addr); return; case 0x010: s->sysconfig = value & 0x1e; break; case 0x030 ... 0x140: s->padconf[(addr - 0x30) >> 2] = value & 0x1f1f1f1f; break; case 0x270: s->obs = value & 0xff; break; case 0x274: s->devconfig = value & 0xffffc7ff; break; case 0x28c: break; case 0x290: s->msuspendmux[0] = value & 0x3fffffff; break; case 0x294: s->msuspendmux[1] = value & 0x3fffffff; break; case 0x298: s->msuspendmux[2] = value & 0x3fffffff; break; case 0x29c: s->msuspendmux[3] = value & 0x3fffffff; break; case 0x2a0: s->msuspendmux[4] = value & 0x3fffffff; break; case 0x2b8: s->psaconfig = value & 0x1c; s->psaconfig |= (value & 0x20) ? 2 : 1; break; case 0x2bc: break; case 0x2b0: case 0x2b4: case 0x2d0: case 0x2d4: case 0x2d8: case 0x2dc: case 0x2e0: case 0x2e4: case 0x2f0: case 0x2f4: break; default: OMAP_BAD_REG(addr); return; } }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0, target_phys_addr_t VAR_1, uint32_t VAR_2) { struct omap_sysctl_s *VAR_3 = (struct omap_sysctl_s *) VAR_0; switch (VAR_1) { case 0x000: case 0x2a4: case 0x2c0: case 0x2f8: case 0x2fc: case 0x300: case 0x304: case 0x308: case 0x30c: case 0x310: case 0x314: case 0x318: case 0x31c: case 0x320: case 0x324: case 0x330: case 0x334: case 0x338: case 0x33c: case 0x340: case 0x344: case 0x348: case 0x34c: case 0x350: case 0x354: OMAP_RO_REG(VAR_1); return; case 0x010: VAR_3->sysconfig = VAR_2 & 0x1e; break; case 0x030 ... 0x140: VAR_3->padconf[(VAR_1 - 0x30) >> 2] = VAR_2 & 0x1f1f1f1f; break; case 0x270: VAR_3->obs = VAR_2 & 0xff; break; case 0x274: VAR_3->devconfig = VAR_2 & 0xffffc7ff; break; case 0x28c: break; case 0x290: VAR_3->msuspendmux[0] = VAR_2 & 0x3fffffff; break; case 0x294: VAR_3->msuspendmux[1] = VAR_2 & 0x3fffffff; break; case 0x298: VAR_3->msuspendmux[2] = VAR_2 & 0x3fffffff; break; case 0x29c: VAR_3->msuspendmux[3] = VAR_2 & 0x3fffffff; break; case 0x2a0: VAR_3->msuspendmux[4] = VAR_2 & 0x3fffffff; break; case 0x2b8: VAR_3->psaconfig = VAR_2 & 0x1c; VAR_3->psaconfig |= (VAR_2 & 0x20) ? 2 : 1; break; case 0x2bc: break; case 0x2b0: case 0x2b4: case 0x2d0: case 0x2d4: case 0x2d8: case 0x2dc: case 0x2e0: case 0x2e4: case 0x2f0: case 0x2f4: break; default: OMAP_BAD_REG(VAR_1); return; } }
[ "static void FUNC_0(void *VAR_0, target_phys_addr_t VAR_1,\nuint32_t VAR_2)\n{", "struct omap_sysctl_s *VAR_3 = (struct omap_sysctl_s *) VAR_0;", "switch (VAR_1) {", "case 0x000:\ncase 0x2a4:\ncase 0x2c0:\ncase 0x2f8:\ncase 0x2fc:\ncase 0x300:\ncase 0x304:\ncase 0x308:\ncase 0x30c:\ncase 0x310:\ncase 0x314:\ncase 0x318:\ncase 0x31c:\ncase 0x320:\ncase 0x324:\ncase 0x330:\ncase 0x334:\ncase 0x338:\ncase 0x33c:\ncase 0x340:\ncase 0x344:\ncase 0x348:\ncase 0x34c:\ncase 0x350:\ncase 0x354:\nOMAP_RO_REG(VAR_1);", "return;", "case 0x010:\nVAR_3->sysconfig = VAR_2 & 0x1e;", "break;", "case 0x030 ... 0x140:\nVAR_3->padconf[(VAR_1 - 0x30) >> 2] = VAR_2 & 0x1f1f1f1f;", "break;", "case 0x270:\nVAR_3->obs = VAR_2 & 0xff;", "break;", "case 0x274:\nVAR_3->devconfig = VAR_2 & 0xffffc7ff;", "break;", "case 0x28c:\nbreak;", "case 0x290:\nVAR_3->msuspendmux[0] = VAR_2 & 0x3fffffff;", "break;", "case 0x294:\nVAR_3->msuspendmux[1] = VAR_2 & 0x3fffffff;", "break;", "case 0x298:\nVAR_3->msuspendmux[2] = VAR_2 & 0x3fffffff;", "break;", "case 0x29c:\nVAR_3->msuspendmux[3] = VAR_2 & 0x3fffffff;", "break;", "case 0x2a0:\nVAR_3->msuspendmux[4] = VAR_2 & 0x3fffffff;", "break;", "case 0x2b8:\nVAR_3->psaconfig = VAR_2 & 0x1c;", "VAR_3->psaconfig |= (VAR_2 & 0x20) ? 2 : 1;", "break;", "case 0x2bc:\nbreak;", "case 0x2b0:\ncase 0x2b4:\ncase 0x2d0:\ncase 0x2d4:\ncase 0x2d8:\ncase 0x2dc:\ncase 0x2e0:\ncase 0x2e4:\ncase 0x2f0:\ncase 0x2f4:\nbreak;", "default:\nOMAP_BAD_REG(VAR_1);", "return;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59, 61, 63 ], [ 65 ], [ 69, 71 ], [ 73 ], [ 77, 81 ], [ 83 ], [ 87, 89 ], [ 91 ], [ 95, 97 ], [ 99 ], [ 103, 105 ], [ 109, 111 ], [ 113 ], [ 115, 117 ], [ 119 ], [ 121, 123 ], [ 125 ], [ 127, 129 ], [ 131 ], [ 133, 135 ], [ 137 ], [ 141, 143 ], [ 145 ], [ 147 ], [ 149, 151 ], [ 155, 157, 159, 161, 163, 165, 167, 169, 171, 173, 175 ], [ 179, 181 ], [ 183 ], [ 185 ], [ 187 ] ]
7,564
ssize_t qemu_paio_return(struct qemu_paiocb *aiocb) { ssize_t ret; pthread_mutex_lock(&lock); ret = aiocb->ret; pthread_mutex_unlock(&lock); return ret; }
false
qemu
8653c0158c23ec592f0041ab48b83d6cc6d152fe
ssize_t qemu_paio_return(struct qemu_paiocb *aiocb) { ssize_t ret; pthread_mutex_lock(&lock); ret = aiocb->ret; pthread_mutex_unlock(&lock); return ret; }
{ "code": [], "line_no": [] }
ssize_t FUNC_0(struct qemu_paiocb *aiocb) { ssize_t ret; pthread_mutex_lock(&lock); ret = aiocb->ret; pthread_mutex_unlock(&lock); return ret; }
[ "ssize_t FUNC_0(struct qemu_paiocb *aiocb)\n{", "ssize_t ret;", "pthread_mutex_lock(&lock);", "ret = aiocb->ret;", "pthread_mutex_unlock(&lock);", "return ret;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ] ]
7,565
block_crypto_create_opts_init(QCryptoBlockFormat format, QemuOpts *opts, Error **errp) { Visitor *v; QCryptoBlockCreateOptions *ret = NULL; Error *local_err = NULL; ret = g_new0(QCryptoBlockCreateOptions, 1); ret->format = format; v = opts_visitor_new(opts); visit_start_struct(v, NULL, NULL, 0, &local_err); if (local_err) { goto out; } switch (format) { case Q_CRYPTO_BLOCK_FORMAT_LUKS: visit_type_QCryptoBlockCreateOptionsLUKS_members( v, &ret->u.luks, &local_err); break; default: error_setg(&local_err, "Unsupported block format %d", format); break; } if (!local_err) { visit_check_struct(v, &local_err); } visit_end_struct(v, NULL); out: if (local_err) { error_propagate(errp, local_err); qapi_free_QCryptoBlockCreateOptions(ret); ret = NULL; } visit_free(v); return ret; }
false
qemu
306a06e5f766acaf26b71397a5692c65b65a61c7
block_crypto_create_opts_init(QCryptoBlockFormat format, QemuOpts *opts, Error **errp) { Visitor *v; QCryptoBlockCreateOptions *ret = NULL; Error *local_err = NULL; ret = g_new0(QCryptoBlockCreateOptions, 1); ret->format = format; v = opts_visitor_new(opts); visit_start_struct(v, NULL, NULL, 0, &local_err); if (local_err) { goto out; } switch (format) { case Q_CRYPTO_BLOCK_FORMAT_LUKS: visit_type_QCryptoBlockCreateOptionsLUKS_members( v, &ret->u.luks, &local_err); break; default: error_setg(&local_err, "Unsupported block format %d", format); break; } if (!local_err) { visit_check_struct(v, &local_err); } visit_end_struct(v, NULL); out: if (local_err) { error_propagate(errp, local_err); qapi_free_QCryptoBlockCreateOptions(ret); ret = NULL; } visit_free(v); return ret; }
{ "code": [], "line_no": [] }
FUNC_0(QCryptoBlockFormat VAR_0, QemuOpts *VAR_1, Error **VAR_2) { Visitor *v; QCryptoBlockCreateOptions *ret = NULL; Error *local_err = NULL; ret = g_new0(QCryptoBlockCreateOptions, 1); ret->VAR_0 = VAR_0; v = opts_visitor_new(VAR_1); visit_start_struct(v, NULL, NULL, 0, &local_err); if (local_err) { goto out; } switch (VAR_0) { case Q_CRYPTO_BLOCK_FORMAT_LUKS: visit_type_QCryptoBlockCreateOptionsLUKS_members( v, &ret->u.luks, &local_err); break; default: error_setg(&local_err, "Unsupported block VAR_0 %d", VAR_0); break; } if (!local_err) { visit_check_struct(v, &local_err); } visit_end_struct(v, NULL); out: if (local_err) { error_propagate(VAR_2, local_err); qapi_free_QCryptoBlockCreateOptions(ret); ret = NULL; } visit_free(v); return ret; }
[ "FUNC_0(QCryptoBlockFormat VAR_0,\nQemuOpts *VAR_1,\nError **VAR_2)\n{", "Visitor *v;", "QCryptoBlockCreateOptions *ret = NULL;", "Error *local_err = NULL;", "ret = g_new0(QCryptoBlockCreateOptions, 1);", "ret->VAR_0 = VAR_0;", "v = opts_visitor_new(VAR_1);", "visit_start_struct(v, NULL, NULL, 0, &local_err);", "if (local_err) {", "goto out;", "}", "switch (VAR_0) {", "case Q_CRYPTO_BLOCK_FORMAT_LUKS:\nvisit_type_QCryptoBlockCreateOptionsLUKS_members(\nv, &ret->u.luks, &local_err);", "break;", "default:\nerror_setg(&local_err, \"Unsupported block VAR_0 %d\", VAR_0);", "break;", "}", "if (!local_err) {", "visit_check_struct(v, &local_err);", "}", "visit_end_struct(v, NULL);", "out:\nif (local_err) {", "error_propagate(VAR_2, local_err);", "qapi_free_QCryptoBlockCreateOptions(ret);", "ret = NULL;", "}", "visit_free(v);", "return ret;", "}" ]
[ 0, 0, 0, 0, 0, 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 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39, 41, 43 ], [ 45 ], [ 49, 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 65 ], [ 69, 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ] ]
7,566
static void cris_evaluate_flags(DisasContext *dc) { if (!dc->flags_uptodate) { cris_flush_cc_state(dc); switch (dc->cc_op) { case CC_OP_MCP: gen_helper_evaluate_flags_mcp(); break; case CC_OP_MULS: gen_helper_evaluate_flags_muls(); break; case CC_OP_MULU: gen_helper_evaluate_flags_mulu(); break; case CC_OP_MOVE: case CC_OP_AND: case CC_OP_OR: case CC_OP_XOR: case CC_OP_ASR: case CC_OP_LSR: case CC_OP_LSL: switch (dc->cc_size) { case 4: gen_helper_evaluate_flags_move_4(); break; case 2: gen_helper_evaluate_flags_move_2(); break; default: gen_helper_evaluate_flags(); break; } break; case CC_OP_FLAGS: /* live. */ break; default: { switch (dc->cc_size) { case 4: gen_helper_evaluate_flags_alu_4(); break; default: gen_helper_evaluate_flags(); break; } } break; } if (dc->flagx_known) { if (dc->flags_x) tcg_gen_ori_tl(cpu_PR[PR_CCS], cpu_PR[PR_CCS], X_FLAG); else tcg_gen_andi_tl(cpu_PR[PR_CCS], cpu_PR[PR_CCS], ~X_FLAG); } dc->flags_uptodate = 1; } }
false
qemu
a8cf66bb393ff420d40ae172a4c817bf2752918a
static void cris_evaluate_flags(DisasContext *dc) { if (!dc->flags_uptodate) { cris_flush_cc_state(dc); switch (dc->cc_op) { case CC_OP_MCP: gen_helper_evaluate_flags_mcp(); break; case CC_OP_MULS: gen_helper_evaluate_flags_muls(); break; case CC_OP_MULU: gen_helper_evaluate_flags_mulu(); break; case CC_OP_MOVE: case CC_OP_AND: case CC_OP_OR: case CC_OP_XOR: case CC_OP_ASR: case CC_OP_LSR: case CC_OP_LSL: switch (dc->cc_size) { case 4: gen_helper_evaluate_flags_move_4(); break; case 2: gen_helper_evaluate_flags_move_2(); break; default: gen_helper_evaluate_flags(); break; } break; case CC_OP_FLAGS: break; default: { switch (dc->cc_size) { case 4: gen_helper_evaluate_flags_alu_4(); break; default: gen_helper_evaluate_flags(); break; } } break; } if (dc->flagx_known) { if (dc->flags_x) tcg_gen_ori_tl(cpu_PR[PR_CCS], cpu_PR[PR_CCS], X_FLAG); else tcg_gen_andi_tl(cpu_PR[PR_CCS], cpu_PR[PR_CCS], ~X_FLAG); } dc->flags_uptodate = 1; } }
{ "code": [], "line_no": [] }
static void FUNC_0(DisasContext *VAR_0) { if (!VAR_0->flags_uptodate) { cris_flush_cc_state(VAR_0); switch (VAR_0->cc_op) { case CC_OP_MCP: gen_helper_evaluate_flags_mcp(); break; case CC_OP_MULS: gen_helper_evaluate_flags_muls(); break; case CC_OP_MULU: gen_helper_evaluate_flags_mulu(); break; case CC_OP_MOVE: case CC_OP_AND: case CC_OP_OR: case CC_OP_XOR: case CC_OP_ASR: case CC_OP_LSR: case CC_OP_LSL: switch (VAR_0->cc_size) { case 4: gen_helper_evaluate_flags_move_4(); break; case 2: gen_helper_evaluate_flags_move_2(); break; default: gen_helper_evaluate_flags(); break; } break; case CC_OP_FLAGS: break; default: { switch (VAR_0->cc_size) { case 4: gen_helper_evaluate_flags_alu_4(); break; default: gen_helper_evaluate_flags(); break; } } break; } if (VAR_0->flagx_known) { if (VAR_0->flags_x) tcg_gen_ori_tl(cpu_PR[PR_CCS], cpu_PR[PR_CCS], X_FLAG); else tcg_gen_andi_tl(cpu_PR[PR_CCS], cpu_PR[PR_CCS], ~X_FLAG); } VAR_0->flags_uptodate = 1; } }
[ "static void FUNC_0(DisasContext *VAR_0)\n{", "if (!VAR_0->flags_uptodate) {", "cris_flush_cc_state(VAR_0);", "switch (VAR_0->cc_op)\n{", "case CC_OP_MCP:\ngen_helper_evaluate_flags_mcp();", "break;", "case CC_OP_MULS:\ngen_helper_evaluate_flags_muls();", "break;", "case CC_OP_MULU:\ngen_helper_evaluate_flags_mulu();", "break;", "case CC_OP_MOVE:\ncase CC_OP_AND:\ncase CC_OP_OR:\ncase CC_OP_XOR:\ncase CC_OP_ASR:\ncase CC_OP_LSR:\ncase CC_OP_LSL:\nswitch (VAR_0->cc_size)\n{", "case 4:\ngen_helper_evaluate_flags_move_4();", "break;", "case 2:\ngen_helper_evaluate_flags_move_2();", "break;", "default:\ngen_helper_evaluate_flags();", "break;", "}", "break;", "case CC_OP_FLAGS:\nbreak;", "default:\n{", "switch (VAR_0->cc_size)\n{", "case 4:\ngen_helper_evaluate_flags_alu_4();", "break;", "default:\ngen_helper_evaluate_flags();", "break;", "}", "}", "break;", "}", "if (VAR_0->flagx_known) {", "if (VAR_0->flags_x)\ntcg_gen_ori_tl(cpu_PR[PR_CCS],\ncpu_PR[PR_CCS], X_FLAG);", "else\ntcg_gen_andi_tl(cpu_PR[PR_CCS],\ncpu_PR[PR_CCS], ~X_FLAG);", "}", "VAR_0->flags_uptodate = 1;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11, 13 ], [ 15, 17 ], [ 19 ], [ 21, 23 ], [ 25 ], [ 27, 29 ], [ 31 ], [ 33, 35, 37, 39, 41, 43, 45, 47, 49 ], [ 51, 53 ], [ 55 ], [ 57, 59 ], [ 61 ], [ 63, 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73, 77 ], [ 79, 81 ], [ 83, 85 ], [ 87, 89 ], [ 91 ], [ 93, 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109, 111, 113 ], [ 115, 117, 119 ], [ 121 ], [ 125 ], [ 127 ], [ 129 ] ]
7,567
int nbd_disconnect(int fd) { errno = ENOTSUP; return -1; }
false
qemu
185b43386ad999c80bdc58e41b87f05e5b3e8463
int nbd_disconnect(int fd) { errno = ENOTSUP; return -1; }
{ "code": [], "line_no": [] }
int FUNC_0(int VAR_0) { errno = ENOTSUP; return -1; }
[ "int FUNC_0(int VAR_0)\n{", "errno = ENOTSUP;", "return -1;", "}" ]
[ 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ] ]
7,568
static void pl061_write(void *opaque, target_phys_addr_t offset, uint32_t value) { pl061_state *s = (pl061_state *)opaque; uint8_t mask; if (offset < 0x400) { mask = (offset >> 2) & s->dir; s->data = (s->data & ~mask) | (value & mask); pl061_update(s); return; } switch (offset) { case 0x400: /* Direction */ s->dir = value; break; case 0x404: /* Interrupt sense */ s->isense = value; break; case 0x408: /* Interrupt both edges */ s->ibe = value; break; case 0x40c: /* Interrupt event */ s->iev = value; break; case 0x410: /* Interrupt mask */ s->im = value; break; case 0x41c: /* Interrupt clear */ s->istate &= ~value; break; case 0x420: /* Alternate function select */ mask = s->cr; s->afsel = (s->afsel & ~mask) | (value & mask); break; case 0x500: /* 2mA drive */ s->dr2r = value; break; case 0x504: /* 4mA drive */ s->dr4r = value; break; case 0x508: /* 8mA drive */ s->dr8r = value; break; case 0x50c: /* Open drain */ s->odr = value; break; case 0x510: /* Pull-up */ s->pur = value; break; case 0x514: /* Pull-down */ s->pdr = value; break; case 0x518: /* Slew rate control */ s->slr = value; break; case 0x51c: /* Digital enable */ s->den = value; break; case 0x520: /* Lock */ s->locked = (value != 0xacce551); break; case 0x524: /* Commit */ if (!s->locked) s->cr = value; break; default: hw_error("pl061_write: Bad offset %x\n", (int)offset); } pl061_update(s); }
false
qemu
a35faa94c8e8d851a1d07e17c98f4ab2202b8a38
static void pl061_write(void *opaque, target_phys_addr_t offset, uint32_t value) { pl061_state *s = (pl061_state *)opaque; uint8_t mask; if (offset < 0x400) { mask = (offset >> 2) & s->dir; s->data = (s->data & ~mask) | (value & mask); pl061_update(s); return; } switch (offset) { case 0x400: s->dir = value; break; case 0x404: s->isense = value; break; case 0x408: s->ibe = value; break; case 0x40c: s->iev = value; break; case 0x410: s->im = value; break; case 0x41c: s->istate &= ~value; break; case 0x420: mask = s->cr; s->afsel = (s->afsel & ~mask) | (value & mask); break; case 0x500: s->dr2r = value; break; case 0x504: s->dr4r = value; break; case 0x508: s->dr8r = value; break; case 0x50c: s->odr = value; break; case 0x510: s->pur = value; break; case 0x514: s->pdr = value; break; case 0x518: s->slr = value; break; case 0x51c: s->den = value; break; case 0x520: s->locked = (value != 0xacce551); break; case 0x524: if (!s->locked) s->cr = value; break; default: hw_error("pl061_write: Bad offset %x\n", (int)offset); } pl061_update(s); }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0, target_phys_addr_t VAR_1, uint32_t VAR_2) { pl061_state *s = (pl061_state *)VAR_0; uint8_t mask; if (VAR_1 < 0x400) { mask = (VAR_1 >> 2) & s->dir; s->data = (s->data & ~mask) | (VAR_2 & mask); pl061_update(s); return; } switch (VAR_1) { case 0x400: s->dir = VAR_2; break; case 0x404: s->isense = VAR_2; break; case 0x408: s->ibe = VAR_2; break; case 0x40c: s->iev = VAR_2; break; case 0x410: s->im = VAR_2; break; case 0x41c: s->istate &= ~VAR_2; break; case 0x420: mask = s->cr; s->afsel = (s->afsel & ~mask) | (VAR_2 & mask); break; case 0x500: s->dr2r = VAR_2; break; case 0x504: s->dr4r = VAR_2; break; case 0x508: s->dr8r = VAR_2; break; case 0x50c: s->odr = VAR_2; break; case 0x510: s->pur = VAR_2; break; case 0x514: s->pdr = VAR_2; break; case 0x518: s->slr = VAR_2; break; case 0x51c: s->den = VAR_2; break; case 0x520: s->locked = (VAR_2 != 0xacce551); break; case 0x524: if (!s->locked) s->cr = VAR_2; break; default: hw_error("FUNC_0: Bad VAR_1 %x\n", (int)VAR_1); } pl061_update(s); }
[ "static void FUNC_0(void *VAR_0, target_phys_addr_t VAR_1,\nuint32_t VAR_2)\n{", "pl061_state *s = (pl061_state *)VAR_0;", "uint8_t mask;", "if (VAR_1 < 0x400) {", "mask = (VAR_1 >> 2) & s->dir;", "s->data = (s->data & ~mask) | (VAR_2 & mask);", "pl061_update(s);", "return;", "}", "switch (VAR_1) {", "case 0x400:\ns->dir = VAR_2;", "break;", "case 0x404:\ns->isense = VAR_2;", "break;", "case 0x408:\ns->ibe = VAR_2;", "break;", "case 0x40c:\ns->iev = VAR_2;", "break;", "case 0x410:\ns->im = VAR_2;", "break;", "case 0x41c:\ns->istate &= ~VAR_2;", "break;", "case 0x420:\nmask = s->cr;", "s->afsel = (s->afsel & ~mask) | (VAR_2 & mask);", "break;", "case 0x500:\ns->dr2r = VAR_2;", "break;", "case 0x504:\ns->dr4r = VAR_2;", "break;", "case 0x508:\ns->dr8r = VAR_2;", "break;", "case 0x50c:\ns->odr = VAR_2;", "break;", "case 0x510:\ns->pur = VAR_2;", "break;", "case 0x514:\ns->pdr = VAR_2;", "break;", "case 0x518:\ns->slr = VAR_2;", "break;", "case 0x51c:\ns->den = VAR_2;", "break;", "case 0x520:\ns->locked = (VAR_2 != 0xacce551);", "break;", "case 0x524:\nif (!s->locked)\ns->cr = VAR_2;", "break;", "default:\nhw_error(\"FUNC_0: Bad VAR_1 %x\\n\", (int)VAR_1);", "}", "pl061_update(s);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27, 29 ], [ 31 ], [ 33, 35 ], [ 37 ], [ 39, 41 ], [ 43 ], [ 45, 47 ], [ 49 ], [ 51, 53 ], [ 55 ], [ 57, 59 ], [ 61 ], [ 63, 65 ], [ 67 ], [ 69 ], [ 71, 73 ], [ 75 ], [ 77, 79 ], [ 81 ], [ 83, 85 ], [ 87 ], [ 89, 91 ], [ 93 ], [ 95, 97 ], [ 99 ], [ 101, 103 ], [ 105 ], [ 107, 109 ], [ 111 ], [ 113, 115 ], [ 117 ], [ 119, 121 ], [ 123 ], [ 125, 127, 129 ], [ 131 ], [ 133, 135 ], [ 137 ], [ 139 ], [ 141 ] ]
7,569
static int nvdec_vp8_start_frame(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size) { VP8Context *h = avctx->priv_data; NVDECContext *ctx = avctx->internal->hwaccel_priv_data; CUVIDPICPARAMS *pp = &ctx->pic_params; FrameDecodeData *fdd; NVDECFrame *cf; AVFrame *cur_frame = h->framep[VP56_FRAME_CURRENT]->tf.f; int ret; ret = ff_nvdec_start_frame(avctx, cur_frame); if (ret < 0) return ret; fdd = (FrameDecodeData*)cur_frame->private_ref->data; cf = (NVDECFrame*)fdd->hwaccel_priv; *pp = (CUVIDPICPARAMS) { .PicWidthInMbs = (cur_frame->width + 15) / 16, .FrameHeightInMbs = (cur_frame->height + 15) / 16, .CurrPicIdx = cf->idx, .CodecSpecific.vp8 = { .width = cur_frame->width, .height = cur_frame->height, .first_partition_size = h->header_partition_size, .LastRefIdx = safe_get_ref_idx(h->framep[VP56_FRAME_PREVIOUS]), .GoldenRefIdx = safe_get_ref_idx(h->framep[VP56_FRAME_GOLDEN]), .AltRefIdx = safe_get_ref_idx(h->framep[VP56_FRAME_GOLDEN2]), /* * Explicit braces for anonymous inners to work around limitations * in ancient versions of gcc. */ { { .frame_type = !h->keyframe, .version = h->profile, .show_frame = !h->invisible, .update_mb_segmentation_data = h->segmentation.enabled ? h->segmentation.update_feature_data : 0, } } } }; return 0; }
false
FFmpeg
0e93694e64cdc72f7ccb8a986171593e672b8dba
static int nvdec_vp8_start_frame(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size) { VP8Context *h = avctx->priv_data; NVDECContext *ctx = avctx->internal->hwaccel_priv_data; CUVIDPICPARAMS *pp = &ctx->pic_params; FrameDecodeData *fdd; NVDECFrame *cf; AVFrame *cur_frame = h->framep[VP56_FRAME_CURRENT]->tf.f; int ret; ret = ff_nvdec_start_frame(avctx, cur_frame); if (ret < 0) return ret; fdd = (FrameDecodeData*)cur_frame->private_ref->data; cf = (NVDECFrame*)fdd->hwaccel_priv; *pp = (CUVIDPICPARAMS) { .PicWidthInMbs = (cur_frame->width + 15) / 16, .FrameHeightInMbs = (cur_frame->height + 15) / 16, .CurrPicIdx = cf->idx, .CodecSpecific.vp8 = { .width = cur_frame->width, .height = cur_frame->height, .first_partition_size = h->header_partition_size, .LastRefIdx = safe_get_ref_idx(h->framep[VP56_FRAME_PREVIOUS]), .GoldenRefIdx = safe_get_ref_idx(h->framep[VP56_FRAME_GOLDEN]), .AltRefIdx = safe_get_ref_idx(h->framep[VP56_FRAME_GOLDEN2]), { { .frame_type = !h->keyframe, .version = h->profile, .show_frame = !h->invisible, .update_mb_segmentation_data = h->segmentation.enabled ? h->segmentation.update_feature_data : 0, } } } }; return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecContext *VAR_0, const uint8_t *VAR_1, uint32_t VAR_2) { VP8Context *h = VAR_0->priv_data; NVDECContext *ctx = VAR_0->internal->hwaccel_priv_data; CUVIDPICPARAMS *pp = &ctx->pic_params; FrameDecodeData *fdd; NVDECFrame *cf; AVFrame *cur_frame = h->framep[VP56_FRAME_CURRENT]->tf.f; int VAR_3; VAR_3 = ff_nvdec_start_frame(VAR_0, cur_frame); if (VAR_3 < 0) return VAR_3; fdd = (FrameDecodeData*)cur_frame->private_ref->data; cf = (NVDECFrame*)fdd->hwaccel_priv; *pp = (CUVIDPICPARAMS) { .PicWidthInMbs = (cur_frame->width + 15) / 16, .FrameHeightInMbs = (cur_frame->height + 15) / 16, .CurrPicIdx = cf->idx, .CodecSpecific.vp8 = { .width = cur_frame->width, .height = cur_frame->height, .first_partition_size = h->header_partition_size, .LastRefIdx = safe_get_ref_idx(h->framep[VP56_FRAME_PREVIOUS]), .GoldenRefIdx = safe_get_ref_idx(h->framep[VP56_FRAME_GOLDEN]), .AltRefIdx = safe_get_ref_idx(h->framep[VP56_FRAME_GOLDEN2]), { { .frame_type = !h->keyframe, .version = h->profile, .show_frame = !h->invisible, .update_mb_segmentation_data = h->segmentation.enabled ? h->segmentation.update_feature_data : 0, } } } }; return 0; }
[ "static int FUNC_0(AVCodecContext *VAR_0, const uint8_t *VAR_1, uint32_t VAR_2)\n{", "VP8Context *h = VAR_0->priv_data;", "NVDECContext *ctx = VAR_0->internal->hwaccel_priv_data;", "CUVIDPICPARAMS *pp = &ctx->pic_params;", "FrameDecodeData *fdd;", "NVDECFrame *cf;", "AVFrame *cur_frame = h->framep[VP56_FRAME_CURRENT]->tf.f;", "int VAR_3;", "VAR_3 = ff_nvdec_start_frame(VAR_0, cur_frame);", "if (VAR_3 < 0)\nreturn VAR_3;", "fdd = (FrameDecodeData*)cur_frame->private_ref->data;", "cf = (NVDECFrame*)fdd->hwaccel_priv;", "*pp = (CUVIDPICPARAMS) {", ".PicWidthInMbs = (cur_frame->width + 15) / 16,\n.FrameHeightInMbs = (cur_frame->height + 15) / 16,\n.CurrPicIdx = cf->idx,\n.CodecSpecific.vp8 = {", ".width = cur_frame->width,\n.height = cur_frame->height,\n.first_partition_size = h->header_partition_size,\n.LastRefIdx = safe_get_ref_idx(h->framep[VP56_FRAME_PREVIOUS]),\n.GoldenRefIdx = safe_get_ref_idx(h->framep[VP56_FRAME_GOLDEN]),\n.AltRefIdx = safe_get_ref_idx(h->framep[VP56_FRAME_GOLDEN2]),\n{", "{", ".frame_type = !h->keyframe,\n.version = h->profile,\n.show_frame = !h->invisible,\n.update_mb_segmentation_data = h->segmentation.enabled ?\nh->segmentation.update_feature_data :\n0,\n}", "}", "}", "};", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 25 ], [ 27, 29 ], [ 33 ], [ 35 ], [ 39 ], [ 41, 43, 45, 49 ], [ 51, 53, 57, 61, 63, 65, 75 ], [ 77 ], [ 79, 81, 83, 85, 87, 89, 91 ], [ 93 ], [ 95 ], [ 97 ], [ 101 ], [ 103 ] ]
7,570
AVFilterBufferRef *avfilter_default_get_video_buffer(AVFilterLink *link, int perms, int w, int h) { AVFilterBuffer *pic = av_mallocz(sizeof(AVFilterBuffer)); AVFilterBufferRef *ref = av_mallocz(sizeof(AVFilterBufferRef)); int i, tempsize; char *buf; ref->buf = pic; ref->video = av_mallocz(sizeof(AVFilterBufferRefVideoProps)); ref->video->w = w; ref->video->h = h; /* make sure the buffer gets read permission or it's useless for output */ ref->perms = perms | AV_PERM_READ; pic->refcount = 1; ref->format = link->format; pic->free = avfilter_default_free_buffer; av_fill_image_linesizes(pic->linesize, ref->format, ref->video->w); for (i=0; i<4;i++) pic->linesize[i] = FFALIGN(pic->linesize[i], 16); tempsize = av_fill_image_pointers(pic->data, ref->format, ref->video->h, NULL, pic->linesize); buf = av_malloc(tempsize + 16); // +2 is needed for swscaler, +16 to be // SIMD-friendly av_fill_image_pointers(pic->data, ref->format, ref->video->h, buf, pic->linesize); memcpy(ref->data, pic->data, sizeof(ref->data)); memcpy(ref->linesize, pic->linesize, sizeof(ref->linesize)); return ref; }
false
FFmpeg
65d4cab5627f9c8add3eff73f0d1148a8a95e91c
AVFilterBufferRef *avfilter_default_get_video_buffer(AVFilterLink *link, int perms, int w, int h) { AVFilterBuffer *pic = av_mallocz(sizeof(AVFilterBuffer)); AVFilterBufferRef *ref = av_mallocz(sizeof(AVFilterBufferRef)); int i, tempsize; char *buf; ref->buf = pic; ref->video = av_mallocz(sizeof(AVFilterBufferRefVideoProps)); ref->video->w = w; ref->video->h = h; ref->perms = perms | AV_PERM_READ; pic->refcount = 1; ref->format = link->format; pic->free = avfilter_default_free_buffer; av_fill_image_linesizes(pic->linesize, ref->format, ref->video->w); for (i=0; i<4;i++) pic->linesize[i] = FFALIGN(pic->linesize[i], 16); tempsize = av_fill_image_pointers(pic->data, ref->format, ref->video->h, NULL, pic->linesize); buf = av_malloc(tempsize + 16); av_fill_image_pointers(pic->data, ref->format, ref->video->h, buf, pic->linesize); memcpy(ref->data, pic->data, sizeof(ref->data)); memcpy(ref->linesize, pic->linesize, sizeof(ref->linesize)); return ref; }
{ "code": [], "line_no": [] }
AVFilterBufferRef *FUNC_0(AVFilterLink *link, int perms, int w, int h) { AVFilterBuffer *pic = av_mallocz(sizeof(AVFilterBuffer)); AVFilterBufferRef *ref = av_mallocz(sizeof(AVFilterBufferRef)); int VAR_0, VAR_1; char *VAR_2; ref->VAR_2 = pic; ref->video = av_mallocz(sizeof(AVFilterBufferRefVideoProps)); ref->video->w = w; ref->video->h = h; ref->perms = perms | AV_PERM_READ; pic->refcount = 1; ref->format = link->format; pic->free = avfilter_default_free_buffer; av_fill_image_linesizes(pic->linesize, ref->format, ref->video->w); for (VAR_0=0; VAR_0<4;VAR_0++) pic->linesize[VAR_0] = FFALIGN(pic->linesize[VAR_0], 16); VAR_1 = av_fill_image_pointers(pic->data, ref->format, ref->video->h, NULL, pic->linesize); VAR_2 = av_malloc(VAR_1 + 16); av_fill_image_pointers(pic->data, ref->format, ref->video->h, VAR_2, pic->linesize); memcpy(ref->data, pic->data, sizeof(ref->data)); memcpy(ref->linesize, pic->linesize, sizeof(ref->linesize)); return ref; }
[ "AVFilterBufferRef *FUNC_0(AVFilterLink *link, int perms, int w, int h)\n{", "AVFilterBuffer *pic = av_mallocz(sizeof(AVFilterBuffer));", "AVFilterBufferRef *ref = av_mallocz(sizeof(AVFilterBufferRef));", "int VAR_0, VAR_1;", "char *VAR_2;", "ref->VAR_2 = pic;", "ref->video = av_mallocz(sizeof(AVFilterBufferRefVideoProps));", "ref->video->w = w;", "ref->video->h = h;", "ref->perms = perms | AV_PERM_READ;", "pic->refcount = 1;", "ref->format = link->format;", "pic->free = avfilter_default_free_buffer;", "av_fill_image_linesizes(pic->linesize, ref->format, ref->video->w);", "for (VAR_0=0; VAR_0<4;VAR_0++)", "pic->linesize[VAR_0] = FFALIGN(pic->linesize[VAR_0], 16);", "VAR_1 = av_fill_image_pointers(pic->data, ref->format, ref->video->h, NULL, pic->linesize);", "VAR_2 = av_malloc(VAR_1 + 16);", "av_fill_image_pointers(pic->data, ref->format, ref->video->h, VAR_2, pic->linesize);", "memcpy(ref->data, pic->data, sizeof(ref->data));", "memcpy(ref->linesize, pic->linesize, sizeof(ref->linesize));", "return ref;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ], [ 53 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ] ]
7,571
static void blk_disconnect(struct XenDevice *xendev) { struct XenBlkDev *blkdev = container_of(xendev, struct XenBlkDev, xendev); if (blkdev->bs) { bdrv_detach_dev(blkdev->bs, blkdev); if (!blkdev->dinfo) { blk_unref(blk_by_name(blkdev->dev)); } blkdev->bs = NULL; } xen_be_unbind_evtchn(&blkdev->xendev); if (blkdev->sring) { xc_gnttab_munmap(blkdev->xendev.gnttabdev, blkdev->sring, 1); blkdev->cnt_map--; blkdev->sring = NULL; } }
false
qemu
4be746345f13e99e468c60acbd3a355e8183e3ce
static void blk_disconnect(struct XenDevice *xendev) { struct XenBlkDev *blkdev = container_of(xendev, struct XenBlkDev, xendev); if (blkdev->bs) { bdrv_detach_dev(blkdev->bs, blkdev); if (!blkdev->dinfo) { blk_unref(blk_by_name(blkdev->dev)); } blkdev->bs = NULL; } xen_be_unbind_evtchn(&blkdev->xendev); if (blkdev->sring) { xc_gnttab_munmap(blkdev->xendev.gnttabdev, blkdev->sring, 1); blkdev->cnt_map--; blkdev->sring = NULL; } }
{ "code": [], "line_no": [] }
static void FUNC_0(struct XenDevice *VAR_0) { struct XenBlkDev *VAR_1 = container_of(VAR_0, struct XenBlkDev, VAR_0); if (VAR_1->bs) { bdrv_detach_dev(VAR_1->bs, VAR_1); if (!VAR_1->dinfo) { blk_unref(blk_by_name(VAR_1->dev)); } VAR_1->bs = NULL; } xen_be_unbind_evtchn(&VAR_1->VAR_0); if (VAR_1->sring) { xc_gnttab_munmap(VAR_1->VAR_0.gnttabdev, VAR_1->sring, 1); VAR_1->cnt_map--; VAR_1->sring = NULL; } }
[ "static void FUNC_0(struct XenDevice *VAR_0)\n{", "struct XenBlkDev *VAR_1 = container_of(VAR_0, struct XenBlkDev, VAR_0);", "if (VAR_1->bs) {", "bdrv_detach_dev(VAR_1->bs, VAR_1);", "if (!VAR_1->dinfo) {", "blk_unref(blk_by_name(VAR_1->dev));", "}", "VAR_1->bs = NULL;", "}", "xen_be_unbind_evtchn(&VAR_1->VAR_0);", "if (VAR_1->sring) {", "xc_gnttab_munmap(VAR_1->VAR_0.gnttabdev, VAR_1->sring, 1);", "VAR_1->cnt_map--;", "VAR_1->sring = NULL;", "}", "}" ]
[ 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 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ] ]
7,572
static void raw_aio_remove(RawAIOCB *acb) { RawAIOCB **pacb; /* remove the callback from the queue */ pacb = &posix_aio_state->first_aio; for(;;) { if (*pacb == NULL) { fprintf(stderr, "raw_aio_remove: aio request not found!\n"); break; } else if (*pacb == acb) { *pacb = acb->next; qemu_aio_release(acb); break; } pacb = &(*pacb)->next; } }
false
qemu
9ef91a677110ec200d7b2904fc4bcae5a77329ad
static void raw_aio_remove(RawAIOCB *acb) { RawAIOCB **pacb; pacb = &posix_aio_state->first_aio; for(;;) { if (*pacb == NULL) { fprintf(stderr, "raw_aio_remove: aio request not found!\n"); break; } else if (*pacb == acb) { *pacb = acb->next; qemu_aio_release(acb); break; } pacb = &(*pacb)->next; } }
{ "code": [], "line_no": [] }
static void FUNC_0(RawAIOCB *VAR_0) { RawAIOCB **pacb; pacb = &posix_aio_state->first_aio; for(;;) { if (*pacb == NULL) { fprintf(stderr, "FUNC_0: aio request not found!\n"); break; } else if (*pacb == VAR_0) { *pacb = VAR_0->next; qemu_aio_release(VAR_0); break; } pacb = &(*pacb)->next; } }
[ "static void FUNC_0(RawAIOCB *VAR_0)\n{", "RawAIOCB **pacb;", "pacb = &posix_aio_state->first_aio;", "for(;;) {", "if (*pacb == NULL) {", "fprintf(stderr, \"FUNC_0: aio request not found!\\n\");", "break;", "} else if (*pacb == VAR_0) {", "*pacb = VAR_0->next;", "qemu_aio_release(VAR_0);", "break;", "}", "pacb = &(*pacb)->next;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ] ]
7,573
static void nvic_writel(NVICState *s, uint32_t offset, uint32_t value) { ARMCPU *cpu = s->cpu; switch (offset) { case 0xd04: /* Interrupt Control State. */ if (value & (1 << 31)) { armv7m_nvic_set_pending(s, ARMV7M_EXCP_NMI); } if (value & (1 << 28)) { armv7m_nvic_set_pending(s, ARMV7M_EXCP_PENDSV); } else if (value & (1 << 27)) { armv7m_nvic_clear_pending(s, ARMV7M_EXCP_PENDSV); } if (value & (1 << 26)) { armv7m_nvic_set_pending(s, ARMV7M_EXCP_SYSTICK); } else if (value & (1 << 25)) { armv7m_nvic_clear_pending(s, ARMV7M_EXCP_SYSTICK); } break; case 0xd08: /* Vector Table Offset. */ cpu->env.v7m.vecbase = value & 0xffffff80; break; case 0xd0c: /* Application Interrupt/Reset Control. */ if ((value >> 16) == 0x05fa) { if (value & 4) { qemu_irq_pulse(s->sysresetreq); } if (value & 2) { qemu_log_mask(LOG_GUEST_ERROR, "Setting VECTCLRACTIVE when not in DEBUG mode " "is UNPREDICTABLE\n"); } if (value & 1) { qemu_log_mask(LOG_GUEST_ERROR, "Setting VECTRESET when not in DEBUG mode " "is UNPREDICTABLE\n"); } s->prigroup = extract32(value, 8, 3); nvic_irq_update(s); } break; case 0xd10: /* System Control. */ /* TODO: Implement control registers. */ qemu_log_mask(LOG_UNIMP, "NVIC: SCR unimplemented\n"); break; case 0xd14: /* Configuration Control. */ /* Enforce RAZ/WI on reserved and must-RAZ/WI bits */ value &= (R_V7M_CCR_STKALIGN_MASK | R_V7M_CCR_BFHFNMIGN_MASK | R_V7M_CCR_DIV_0_TRP_MASK | R_V7M_CCR_UNALIGN_TRP_MASK | R_V7M_CCR_USERSETMPEND_MASK | R_V7M_CCR_NONBASETHRDENA_MASK); cpu->env.v7m.ccr = value; break; case 0xd24: /* System Handler Control. */ s->vectors[ARMV7M_EXCP_MEM].active = (value & (1 << 0)) != 0; s->vectors[ARMV7M_EXCP_BUS].active = (value & (1 << 1)) != 0; s->vectors[ARMV7M_EXCP_USAGE].active = (value & (1 << 3)) != 0; s->vectors[ARMV7M_EXCP_SVC].active = (value & (1 << 7)) != 0; s->vectors[ARMV7M_EXCP_DEBUG].active = (value & (1 << 8)) != 0; s->vectors[ARMV7M_EXCP_PENDSV].active = (value & (1 << 10)) != 0; s->vectors[ARMV7M_EXCP_SYSTICK].active = (value & (1 << 11)) != 0; s->vectors[ARMV7M_EXCP_USAGE].pending = (value & (1 << 12)) != 0; s->vectors[ARMV7M_EXCP_MEM].pending = (value & (1 << 13)) != 0; s->vectors[ARMV7M_EXCP_BUS].pending = (value & (1 << 14)) != 0; s->vectors[ARMV7M_EXCP_SVC].pending = (value & (1 << 15)) != 0; s->vectors[ARMV7M_EXCP_MEM].enabled = (value & (1 << 16)) != 0; s->vectors[ARMV7M_EXCP_BUS].enabled = (value & (1 << 17)) != 0; s->vectors[ARMV7M_EXCP_USAGE].enabled = (value & (1 << 18)) != 0; nvic_irq_update(s); break; case 0xd28: /* Configurable Fault Status. */ cpu->env.v7m.cfsr &= ~value; /* W1C */ break; case 0xd2c: /* Hard Fault Status. */ cpu->env.v7m.hfsr &= ~value; /* W1C */ break; case 0xd30: /* Debug Fault Status. */ cpu->env.v7m.dfsr &= ~value; /* W1C */ break; case 0xd34: /* Mem Manage Address. */ cpu->env.v7m.mmfar = value; return; case 0xd38: /* Bus Fault Address. */ cpu->env.v7m.bfar = value; return; case 0xd3c: /* Aux Fault Status. */ qemu_log_mask(LOG_UNIMP, "NVIC: Aux fault status registers unimplemented\n"); break; case 0xd90: /* MPU_TYPE */ return; /* RO */ case 0xd94: /* MPU_CTRL */ if ((value & (R_V7M_MPU_CTRL_HFNMIENA_MASK | R_V7M_MPU_CTRL_ENABLE_MASK)) == R_V7M_MPU_CTRL_HFNMIENA_MASK) { qemu_log_mask(LOG_GUEST_ERROR, "MPU_CTRL: HFNMIENA and !ENABLE is " "UNPREDICTABLE\n"); } cpu->env.v7m.mpu_ctrl = value & (R_V7M_MPU_CTRL_ENABLE_MASK | R_V7M_MPU_CTRL_HFNMIENA_MASK | R_V7M_MPU_CTRL_PRIVDEFENA_MASK); tlb_flush(CPU(cpu)); break; case 0xd98: /* MPU_RNR */ if (value >= cpu->pmsav7_dregion) { qemu_log_mask(LOG_GUEST_ERROR, "MPU region out of range %" PRIu32 "/%" PRIu32 "\n", value, cpu->pmsav7_dregion); } else { cpu->env.pmsav7.rnr = value; } break; case 0xd9c: /* MPU_RBAR */ case 0xda4: /* MPU_RBAR_A1 */ case 0xdac: /* MPU_RBAR_A2 */ case 0xdb4: /* MPU_RBAR_A3 */ { int region; if (arm_feature(&cpu->env, ARM_FEATURE_V8)) { /* PMSAv8M handling of the aliases is different from v7M: * aliases A1, A2, A3 override the low two bits of the region * number in MPU_RNR, and there is no 'region' field in the * RBAR register. */ int aliasno = (offset - 0xd9c) / 8; /* 0..3 */ region = cpu->env.pmsav7.rnr; if (aliasno) { region = deposit32(region, 0, 2, aliasno); } if (region >= cpu->pmsav7_dregion) { return; } cpu->env.pmsav8.rbar[region] = value; tlb_flush(CPU(cpu)); return; } if (value & (1 << 4)) { /* VALID bit means use the region number specified in this * value and also update MPU_RNR.REGION with that value. */ region = extract32(value, 0, 4); if (region >= cpu->pmsav7_dregion) { qemu_log_mask(LOG_GUEST_ERROR, "MPU region out of range %u/%" PRIu32 "\n", region, cpu->pmsav7_dregion); return; } cpu->env.pmsav7.rnr = region; } else { region = cpu->env.pmsav7.rnr; } if (region >= cpu->pmsav7_dregion) { return; } cpu->env.pmsav7.drbar[region] = value & ~0x1f; tlb_flush(CPU(cpu)); break; } case 0xda0: /* MPU_RASR (v7M), MPU_RLAR (v8M) */ case 0xda8: /* MPU_RASR_A1 (v7M), MPU_RLAR_A1 (v8M) */ case 0xdb0: /* MPU_RASR_A2 (v7M), MPU_RLAR_A2 (v8M) */ case 0xdb8: /* MPU_RASR_A3 (v7M), MPU_RLAR_A3 (v8M) */ { int region = cpu->env.pmsav7.rnr; if (arm_feature(&cpu->env, ARM_FEATURE_V8)) { /* PMSAv8M handling of the aliases is different from v7M: * aliases A1, A2, A3 override the low two bits of the region * number in MPU_RNR. */ int aliasno = (offset - 0xd9c) / 8; /* 0..3 */ region = cpu->env.pmsav7.rnr; if (aliasno) { region = deposit32(region, 0, 2, aliasno); } if (region >= cpu->pmsav7_dregion) { return; } cpu->env.pmsav8.rlar[region] = value; tlb_flush(CPU(cpu)); return; } if (region >= cpu->pmsav7_dregion) { return; } cpu->env.pmsav7.drsr[region] = value & 0xff3f; cpu->env.pmsav7.dracr[region] = (value >> 16) & 0x173f; tlb_flush(CPU(cpu)); break; } case 0xdc0: /* MPU_MAIR0 */ if (!arm_feature(&cpu->env, ARM_FEATURE_V8)) { goto bad_offset; } if (cpu->pmsav7_dregion) { /* Register is RES0 if no MPU regions are implemented */ cpu->env.pmsav8.mair0 = value; } /* We don't need to do anything else because memory attributes * only affect cacheability, and we don't implement caching. */ break; case 0xdc4: /* MPU_MAIR1 */ if (!arm_feature(&cpu->env, ARM_FEATURE_V8)) { goto bad_offset; } if (cpu->pmsav7_dregion) { /* Register is RES0 if no MPU regions are implemented */ cpu->env.pmsav8.mair1 = value; } /* We don't need to do anything else because memory attributes * only affect cacheability, and we don't implement caching. */ break; case 0xf00: /* Software Triggered Interrupt Register */ { int excnum = (value & 0x1ff) + NVIC_FIRST_IRQ; if (excnum < s->num_irq) { armv7m_nvic_set_pending(s, excnum); } break; } default: bad_offset: qemu_log_mask(LOG_GUEST_ERROR, "NVIC: Bad write offset 0x%x\n", offset); } }
false
qemu
45db7ba681ede57113a67499840e69ee586bcdf2
static void nvic_writel(NVICState *s, uint32_t offset, uint32_t value) { ARMCPU *cpu = s->cpu; switch (offset) { case 0xd04: if (value & (1 << 31)) { armv7m_nvic_set_pending(s, ARMV7M_EXCP_NMI); } if (value & (1 << 28)) { armv7m_nvic_set_pending(s, ARMV7M_EXCP_PENDSV); } else if (value & (1 << 27)) { armv7m_nvic_clear_pending(s, ARMV7M_EXCP_PENDSV); } if (value & (1 << 26)) { armv7m_nvic_set_pending(s, ARMV7M_EXCP_SYSTICK); } else if (value & (1 << 25)) { armv7m_nvic_clear_pending(s, ARMV7M_EXCP_SYSTICK); } break; case 0xd08: cpu->env.v7m.vecbase = value & 0xffffff80; break; case 0xd0c: if ((value >> 16) == 0x05fa) { if (value & 4) { qemu_irq_pulse(s->sysresetreq); } if (value & 2) { qemu_log_mask(LOG_GUEST_ERROR, "Setting VECTCLRACTIVE when not in DEBUG mode " "is UNPREDICTABLE\n"); } if (value & 1) { qemu_log_mask(LOG_GUEST_ERROR, "Setting VECTRESET when not in DEBUG mode " "is UNPREDICTABLE\n"); } s->prigroup = extract32(value, 8, 3); nvic_irq_update(s); } break; case 0xd10: qemu_log_mask(LOG_UNIMP, "NVIC: SCR unimplemented\n"); break; case 0xd14: value &= (R_V7M_CCR_STKALIGN_MASK | R_V7M_CCR_BFHFNMIGN_MASK | R_V7M_CCR_DIV_0_TRP_MASK | R_V7M_CCR_UNALIGN_TRP_MASK | R_V7M_CCR_USERSETMPEND_MASK | R_V7M_CCR_NONBASETHRDENA_MASK); cpu->env.v7m.ccr = value; break; case 0xd24: s->vectors[ARMV7M_EXCP_MEM].active = (value & (1 << 0)) != 0; s->vectors[ARMV7M_EXCP_BUS].active = (value & (1 << 1)) != 0; s->vectors[ARMV7M_EXCP_USAGE].active = (value & (1 << 3)) != 0; s->vectors[ARMV7M_EXCP_SVC].active = (value & (1 << 7)) != 0; s->vectors[ARMV7M_EXCP_DEBUG].active = (value & (1 << 8)) != 0; s->vectors[ARMV7M_EXCP_PENDSV].active = (value & (1 << 10)) != 0; s->vectors[ARMV7M_EXCP_SYSTICK].active = (value & (1 << 11)) != 0; s->vectors[ARMV7M_EXCP_USAGE].pending = (value & (1 << 12)) != 0; s->vectors[ARMV7M_EXCP_MEM].pending = (value & (1 << 13)) != 0; s->vectors[ARMV7M_EXCP_BUS].pending = (value & (1 << 14)) != 0; s->vectors[ARMV7M_EXCP_SVC].pending = (value & (1 << 15)) != 0; s->vectors[ARMV7M_EXCP_MEM].enabled = (value & (1 << 16)) != 0; s->vectors[ARMV7M_EXCP_BUS].enabled = (value & (1 << 17)) != 0; s->vectors[ARMV7M_EXCP_USAGE].enabled = (value & (1 << 18)) != 0; nvic_irq_update(s); break; case 0xd28: cpu->env.v7m.cfsr &= ~value; break; case 0xd2c: cpu->env.v7m.hfsr &= ~value; break; case 0xd30: cpu->env.v7m.dfsr &= ~value; break; case 0xd34: cpu->env.v7m.mmfar = value; return; case 0xd38: cpu->env.v7m.bfar = value; return; case 0xd3c: qemu_log_mask(LOG_UNIMP, "NVIC: Aux fault status registers unimplemented\n"); break; case 0xd90: return; case 0xd94: if ((value & (R_V7M_MPU_CTRL_HFNMIENA_MASK | R_V7M_MPU_CTRL_ENABLE_MASK)) == R_V7M_MPU_CTRL_HFNMIENA_MASK) { qemu_log_mask(LOG_GUEST_ERROR, "MPU_CTRL: HFNMIENA and !ENABLE is " "UNPREDICTABLE\n"); } cpu->env.v7m.mpu_ctrl = value & (R_V7M_MPU_CTRL_ENABLE_MASK | R_V7M_MPU_CTRL_HFNMIENA_MASK | R_V7M_MPU_CTRL_PRIVDEFENA_MASK); tlb_flush(CPU(cpu)); break; case 0xd98: if (value >= cpu->pmsav7_dregion) { qemu_log_mask(LOG_GUEST_ERROR, "MPU region out of range %" PRIu32 "/%" PRIu32 "\n", value, cpu->pmsav7_dregion); } else { cpu->env.pmsav7.rnr = value; } break; case 0xd9c: case 0xda4: case 0xdac: case 0xdb4: { int region; if (arm_feature(&cpu->env, ARM_FEATURE_V8)) { int aliasno = (offset - 0xd9c) / 8; region = cpu->env.pmsav7.rnr; if (aliasno) { region = deposit32(region, 0, 2, aliasno); } if (region >= cpu->pmsav7_dregion) { return; } cpu->env.pmsav8.rbar[region] = value; tlb_flush(CPU(cpu)); return; } if (value & (1 << 4)) { region = extract32(value, 0, 4); if (region >= cpu->pmsav7_dregion) { qemu_log_mask(LOG_GUEST_ERROR, "MPU region out of range %u/%" PRIu32 "\n", region, cpu->pmsav7_dregion); return; } cpu->env.pmsav7.rnr = region; } else { region = cpu->env.pmsav7.rnr; } if (region >= cpu->pmsav7_dregion) { return; } cpu->env.pmsav7.drbar[region] = value & ~0x1f; tlb_flush(CPU(cpu)); break; } case 0xda0: case 0xda8: case 0xdb0: case 0xdb8: { int region = cpu->env.pmsav7.rnr; if (arm_feature(&cpu->env, ARM_FEATURE_V8)) { int aliasno = (offset - 0xd9c) / 8; region = cpu->env.pmsav7.rnr; if (aliasno) { region = deposit32(region, 0, 2, aliasno); } if (region >= cpu->pmsav7_dregion) { return; } cpu->env.pmsav8.rlar[region] = value; tlb_flush(CPU(cpu)); return; } if (region >= cpu->pmsav7_dregion) { return; } cpu->env.pmsav7.drsr[region] = value & 0xff3f; cpu->env.pmsav7.dracr[region] = (value >> 16) & 0x173f; tlb_flush(CPU(cpu)); break; } case 0xdc0: if (!arm_feature(&cpu->env, ARM_FEATURE_V8)) { goto bad_offset; } if (cpu->pmsav7_dregion) { cpu->env.pmsav8.mair0 = value; } break; case 0xdc4: if (!arm_feature(&cpu->env, ARM_FEATURE_V8)) { goto bad_offset; } if (cpu->pmsav7_dregion) { cpu->env.pmsav8.mair1 = value; } break; case 0xf00: { int excnum = (value & 0x1ff) + NVIC_FIRST_IRQ; if (excnum < s->num_irq) { armv7m_nvic_set_pending(s, excnum); } break; } default: bad_offset: qemu_log_mask(LOG_GUEST_ERROR, "NVIC: Bad write offset 0x%x\n", offset); } }
{ "code": [], "line_no": [] }
static void FUNC_0(NVICState *VAR_0, uint32_t VAR_1, uint32_t VAR_2) { ARMCPU *cpu = VAR_0->cpu; switch (VAR_1) { case 0xd04: if (VAR_2 & (1 << 31)) { armv7m_nvic_set_pending(VAR_0, ARMV7M_EXCP_NMI); } if (VAR_2 & (1 << 28)) { armv7m_nvic_set_pending(VAR_0, ARMV7M_EXCP_PENDSV); } else if (VAR_2 & (1 << 27)) { armv7m_nvic_clear_pending(VAR_0, ARMV7M_EXCP_PENDSV); } if (VAR_2 & (1 << 26)) { armv7m_nvic_set_pending(VAR_0, ARMV7M_EXCP_SYSTICK); } else if (VAR_2 & (1 << 25)) { armv7m_nvic_clear_pending(VAR_0, ARMV7M_EXCP_SYSTICK); } break; case 0xd08: cpu->env.v7m.vecbase = VAR_2 & 0xffffff80; break; case 0xd0c: if ((VAR_2 >> 16) == 0x05fa) { if (VAR_2 & 4) { qemu_irq_pulse(VAR_0->sysresetreq); } if (VAR_2 & 2) { qemu_log_mask(LOG_GUEST_ERROR, "Setting VECTCLRACTIVE when not in DEBUG mode " "is UNPREDICTABLE\n"); } if (VAR_2 & 1) { qemu_log_mask(LOG_GUEST_ERROR, "Setting VECTRESET when not in DEBUG mode " "is UNPREDICTABLE\n"); } VAR_0->prigroup = extract32(VAR_2, 8, 3); nvic_irq_update(VAR_0); } break; case 0xd10: qemu_log_mask(LOG_UNIMP, "NVIC: SCR unimplemented\n"); break; case 0xd14: VAR_2 &= (R_V7M_CCR_STKALIGN_MASK | R_V7M_CCR_BFHFNMIGN_MASK | R_V7M_CCR_DIV_0_TRP_MASK | R_V7M_CCR_UNALIGN_TRP_MASK | R_V7M_CCR_USERSETMPEND_MASK | R_V7M_CCR_NONBASETHRDENA_MASK); cpu->env.v7m.ccr = VAR_2; break; case 0xd24: VAR_0->vectors[ARMV7M_EXCP_MEM].active = (VAR_2 & (1 << 0)) != 0; VAR_0->vectors[ARMV7M_EXCP_BUS].active = (VAR_2 & (1 << 1)) != 0; VAR_0->vectors[ARMV7M_EXCP_USAGE].active = (VAR_2 & (1 << 3)) != 0; VAR_0->vectors[ARMV7M_EXCP_SVC].active = (VAR_2 & (1 << 7)) != 0; VAR_0->vectors[ARMV7M_EXCP_DEBUG].active = (VAR_2 & (1 << 8)) != 0; VAR_0->vectors[ARMV7M_EXCP_PENDSV].active = (VAR_2 & (1 << 10)) != 0; VAR_0->vectors[ARMV7M_EXCP_SYSTICK].active = (VAR_2 & (1 << 11)) != 0; VAR_0->vectors[ARMV7M_EXCP_USAGE].pending = (VAR_2 & (1 << 12)) != 0; VAR_0->vectors[ARMV7M_EXCP_MEM].pending = (VAR_2 & (1 << 13)) != 0; VAR_0->vectors[ARMV7M_EXCP_BUS].pending = (VAR_2 & (1 << 14)) != 0; VAR_0->vectors[ARMV7M_EXCP_SVC].pending = (VAR_2 & (1 << 15)) != 0; VAR_0->vectors[ARMV7M_EXCP_MEM].enabled = (VAR_2 & (1 << 16)) != 0; VAR_0->vectors[ARMV7M_EXCP_BUS].enabled = (VAR_2 & (1 << 17)) != 0; VAR_0->vectors[ARMV7M_EXCP_USAGE].enabled = (VAR_2 & (1 << 18)) != 0; nvic_irq_update(VAR_0); break; case 0xd28: cpu->env.v7m.cfsr &= ~VAR_2; break; case 0xd2c: cpu->env.v7m.hfsr &= ~VAR_2; break; case 0xd30: cpu->env.v7m.dfsr &= ~VAR_2; break; case 0xd34: cpu->env.v7m.mmfar = VAR_2; return; case 0xd38: cpu->env.v7m.bfar = VAR_2; return; case 0xd3c: qemu_log_mask(LOG_UNIMP, "NVIC: Aux fault status registers unimplemented\n"); break; case 0xd90: return; case 0xd94: if ((VAR_2 & (R_V7M_MPU_CTRL_HFNMIENA_MASK | R_V7M_MPU_CTRL_ENABLE_MASK)) == R_V7M_MPU_CTRL_HFNMIENA_MASK) { qemu_log_mask(LOG_GUEST_ERROR, "MPU_CTRL: HFNMIENA and !ENABLE is " "UNPREDICTABLE\n"); } cpu->env.v7m.mpu_ctrl = VAR_2 & (R_V7M_MPU_CTRL_ENABLE_MASK | R_V7M_MPU_CTRL_HFNMIENA_MASK | R_V7M_MPU_CTRL_PRIVDEFENA_MASK); tlb_flush(CPU(cpu)); break; case 0xd98: if (VAR_2 >= cpu->pmsav7_dregion) { qemu_log_mask(LOG_GUEST_ERROR, "MPU VAR_5 out of range %" PRIu32 "/%" PRIu32 "\n", VAR_2, cpu->pmsav7_dregion); } else { cpu->env.pmsav7.rnr = VAR_2; } break; case 0xd9c: case 0xda4: case 0xdac: case 0xdb4: { int VAR_5; if (arm_feature(&cpu->env, ARM_FEATURE_V8)) { int VAR_5 = (VAR_1 - 0xd9c) / 8; VAR_5 = cpu->env.pmsav7.rnr; if (VAR_5) { VAR_5 = deposit32(VAR_5, 0, 2, VAR_5); } if (VAR_5 >= cpu->pmsav7_dregion) { return; } cpu->env.pmsav8.rbar[VAR_5] = VAR_2; tlb_flush(CPU(cpu)); return; } if (VAR_2 & (1 << 4)) { VAR_5 = extract32(VAR_2, 0, 4); if (VAR_5 >= cpu->pmsav7_dregion) { qemu_log_mask(LOG_GUEST_ERROR, "MPU VAR_5 out of range %u/%" PRIu32 "\n", VAR_5, cpu->pmsav7_dregion); return; } cpu->env.pmsav7.rnr = VAR_5; } else { VAR_5 = cpu->env.pmsav7.rnr; } if (VAR_5 >= cpu->pmsav7_dregion) { return; } cpu->env.pmsav7.drbar[VAR_5] = VAR_2 & ~0x1f; tlb_flush(CPU(cpu)); break; } case 0xda0: case 0xda8: case 0xdb0: case 0xdb8: { int VAR_5 = cpu->env.pmsav7.rnr; if (arm_feature(&cpu->env, ARM_FEATURE_V8)) { int VAR_5 = (VAR_1 - 0xd9c) / 8; VAR_5 = cpu->env.pmsav7.rnr; if (VAR_5) { VAR_5 = deposit32(VAR_5, 0, 2, VAR_5); } if (VAR_5 >= cpu->pmsav7_dregion) { return; } cpu->env.pmsav8.rlar[VAR_5] = VAR_2; tlb_flush(CPU(cpu)); return; } if (VAR_5 >= cpu->pmsav7_dregion) { return; } cpu->env.pmsav7.drsr[VAR_5] = VAR_2 & 0xff3f; cpu->env.pmsav7.dracr[VAR_5] = (VAR_2 >> 16) & 0x173f; tlb_flush(CPU(cpu)); break; } case 0xdc0: if (!arm_feature(&cpu->env, ARM_FEATURE_V8)) { goto bad_offset; } if (cpu->pmsav7_dregion) { cpu->env.pmsav8.mair0 = VAR_2; } break; case 0xdc4: if (!arm_feature(&cpu->env, ARM_FEATURE_V8)) { goto bad_offset; } if (cpu->pmsav7_dregion) { cpu->env.pmsav8.mair1 = VAR_2; } break; case 0xf00: { int VAR_5 = (VAR_2 & 0x1ff) + NVIC_FIRST_IRQ; if (VAR_5 < VAR_0->num_irq) { armv7m_nvic_set_pending(VAR_0, VAR_5); } break; } default: bad_offset: qemu_log_mask(LOG_GUEST_ERROR, "NVIC: Bad write VAR_1 0x%x\n", VAR_1); } }
[ "static void FUNC_0(NVICState *VAR_0, uint32_t VAR_1, uint32_t VAR_2)\n{", "ARMCPU *cpu = VAR_0->cpu;", "switch (VAR_1) {", "case 0xd04:\nif (VAR_2 & (1 << 31)) {", "armv7m_nvic_set_pending(VAR_0, ARMV7M_EXCP_NMI);", "}", "if (VAR_2 & (1 << 28)) {", "armv7m_nvic_set_pending(VAR_0, ARMV7M_EXCP_PENDSV);", "} else if (VAR_2 & (1 << 27)) {", "armv7m_nvic_clear_pending(VAR_0, ARMV7M_EXCP_PENDSV);", "}", "if (VAR_2 & (1 << 26)) {", "armv7m_nvic_set_pending(VAR_0, ARMV7M_EXCP_SYSTICK);", "} else if (VAR_2 & (1 << 25)) {", "armv7m_nvic_clear_pending(VAR_0, ARMV7M_EXCP_SYSTICK);", "}", "break;", "case 0xd08:\ncpu->env.v7m.vecbase = VAR_2 & 0xffffff80;", "break;", "case 0xd0c:\nif ((VAR_2 >> 16) == 0x05fa) {", "if (VAR_2 & 4) {", "qemu_irq_pulse(VAR_0->sysresetreq);", "}", "if (VAR_2 & 2) {", "qemu_log_mask(LOG_GUEST_ERROR,\n\"Setting VECTCLRACTIVE when not in DEBUG mode \"\n\"is UNPREDICTABLE\\n\");", "}", "if (VAR_2 & 1) {", "qemu_log_mask(LOG_GUEST_ERROR,\n\"Setting VECTRESET when not in DEBUG mode \"\n\"is UNPREDICTABLE\\n\");", "}", "VAR_0->prigroup = extract32(VAR_2, 8, 3);", "nvic_irq_update(VAR_0);", "}", "break;", "case 0xd10:\nqemu_log_mask(LOG_UNIMP, \"NVIC: SCR unimplemented\\n\");", "break;", "case 0xd14:\nVAR_2 &= (R_V7M_CCR_STKALIGN_MASK |\nR_V7M_CCR_BFHFNMIGN_MASK |\nR_V7M_CCR_DIV_0_TRP_MASK |\nR_V7M_CCR_UNALIGN_TRP_MASK |\nR_V7M_CCR_USERSETMPEND_MASK |\nR_V7M_CCR_NONBASETHRDENA_MASK);", "cpu->env.v7m.ccr = VAR_2;", "break;", "case 0xd24:\nVAR_0->vectors[ARMV7M_EXCP_MEM].active = (VAR_2 & (1 << 0)) != 0;", "VAR_0->vectors[ARMV7M_EXCP_BUS].active = (VAR_2 & (1 << 1)) != 0;", "VAR_0->vectors[ARMV7M_EXCP_USAGE].active = (VAR_2 & (1 << 3)) != 0;", "VAR_0->vectors[ARMV7M_EXCP_SVC].active = (VAR_2 & (1 << 7)) != 0;", "VAR_0->vectors[ARMV7M_EXCP_DEBUG].active = (VAR_2 & (1 << 8)) != 0;", "VAR_0->vectors[ARMV7M_EXCP_PENDSV].active = (VAR_2 & (1 << 10)) != 0;", "VAR_0->vectors[ARMV7M_EXCP_SYSTICK].active = (VAR_2 & (1 << 11)) != 0;", "VAR_0->vectors[ARMV7M_EXCP_USAGE].pending = (VAR_2 & (1 << 12)) != 0;", "VAR_0->vectors[ARMV7M_EXCP_MEM].pending = (VAR_2 & (1 << 13)) != 0;", "VAR_0->vectors[ARMV7M_EXCP_BUS].pending = (VAR_2 & (1 << 14)) != 0;", "VAR_0->vectors[ARMV7M_EXCP_SVC].pending = (VAR_2 & (1 << 15)) != 0;", "VAR_0->vectors[ARMV7M_EXCP_MEM].enabled = (VAR_2 & (1 << 16)) != 0;", "VAR_0->vectors[ARMV7M_EXCP_BUS].enabled = (VAR_2 & (1 << 17)) != 0;", "VAR_0->vectors[ARMV7M_EXCP_USAGE].enabled = (VAR_2 & (1 << 18)) != 0;", "nvic_irq_update(VAR_0);", "break;", "case 0xd28:\ncpu->env.v7m.cfsr &= ~VAR_2;", "break;", "case 0xd2c:\ncpu->env.v7m.hfsr &= ~VAR_2;", "break;", "case 0xd30:\ncpu->env.v7m.dfsr &= ~VAR_2;", "break;", "case 0xd34:\ncpu->env.v7m.mmfar = VAR_2;", "return;", "case 0xd38:\ncpu->env.v7m.bfar = VAR_2;", "return;", "case 0xd3c:\nqemu_log_mask(LOG_UNIMP,\n\"NVIC: Aux fault status registers unimplemented\\n\");", "break;", "case 0xd90:\nreturn;", "case 0xd94:\nif ((VAR_2 &\n(R_V7M_MPU_CTRL_HFNMIENA_MASK | R_V7M_MPU_CTRL_ENABLE_MASK))\n== R_V7M_MPU_CTRL_HFNMIENA_MASK) {", "qemu_log_mask(LOG_GUEST_ERROR, \"MPU_CTRL: HFNMIENA and !ENABLE is \"\n\"UNPREDICTABLE\\n\");", "}", "cpu->env.v7m.mpu_ctrl = VAR_2 & (R_V7M_MPU_CTRL_ENABLE_MASK |\nR_V7M_MPU_CTRL_HFNMIENA_MASK |\nR_V7M_MPU_CTRL_PRIVDEFENA_MASK);", "tlb_flush(CPU(cpu));", "break;", "case 0xd98:\nif (VAR_2 >= cpu->pmsav7_dregion) {", "qemu_log_mask(LOG_GUEST_ERROR, \"MPU VAR_5 out of range %\"\nPRIu32 \"/%\" PRIu32 \"\\n\",\nVAR_2, cpu->pmsav7_dregion);", "} else {", "cpu->env.pmsav7.rnr = VAR_2;", "}", "break;", "case 0xd9c:\ncase 0xda4:\ncase 0xdac:\ncase 0xdb4:\n{", "int VAR_5;", "if (arm_feature(&cpu->env, ARM_FEATURE_V8)) {", "int VAR_5 = (VAR_1 - 0xd9c) / 8;", "VAR_5 = cpu->env.pmsav7.rnr;", "if (VAR_5) {", "VAR_5 = deposit32(VAR_5, 0, 2, VAR_5);", "}", "if (VAR_5 >= cpu->pmsav7_dregion) {", "return;", "}", "cpu->env.pmsav8.rbar[VAR_5] = VAR_2;", "tlb_flush(CPU(cpu));", "return;", "}", "if (VAR_2 & (1 << 4)) {", "VAR_5 = extract32(VAR_2, 0, 4);", "if (VAR_5 >= cpu->pmsav7_dregion) {", "qemu_log_mask(LOG_GUEST_ERROR,\n\"MPU VAR_5 out of range %u/%\" PRIu32 \"\\n\",\nVAR_5, cpu->pmsav7_dregion);", "return;", "}", "cpu->env.pmsav7.rnr = VAR_5;", "} else {", "VAR_5 = cpu->env.pmsav7.rnr;", "}", "if (VAR_5 >= cpu->pmsav7_dregion) {", "return;", "}", "cpu->env.pmsav7.drbar[VAR_5] = VAR_2 & ~0x1f;", "tlb_flush(CPU(cpu));", "break;", "}", "case 0xda0:\ncase 0xda8:\ncase 0xdb0:\ncase 0xdb8:\n{", "int VAR_5 = cpu->env.pmsav7.rnr;", "if (arm_feature(&cpu->env, ARM_FEATURE_V8)) {", "int VAR_5 = (VAR_1 - 0xd9c) / 8;", "VAR_5 = cpu->env.pmsav7.rnr;", "if (VAR_5) {", "VAR_5 = deposit32(VAR_5, 0, 2, VAR_5);", "}", "if (VAR_5 >= cpu->pmsav7_dregion) {", "return;", "}", "cpu->env.pmsav8.rlar[VAR_5] = VAR_2;", "tlb_flush(CPU(cpu));", "return;", "}", "if (VAR_5 >= cpu->pmsav7_dregion) {", "return;", "}", "cpu->env.pmsav7.drsr[VAR_5] = VAR_2 & 0xff3f;", "cpu->env.pmsav7.dracr[VAR_5] = (VAR_2 >> 16) & 0x173f;", "tlb_flush(CPU(cpu));", "break;", "}", "case 0xdc0:\nif (!arm_feature(&cpu->env, ARM_FEATURE_V8)) {", "goto bad_offset;", "}", "if (cpu->pmsav7_dregion) {", "cpu->env.pmsav8.mair0 = VAR_2;", "}", "break;", "case 0xdc4:\nif (!arm_feature(&cpu->env, ARM_FEATURE_V8)) {", "goto bad_offset;", "}", "if (cpu->pmsav7_dregion) {", "cpu->env.pmsav8.mair1 = VAR_2;", "}", "break;", "case 0xf00:\n{", "int VAR_5 = (VAR_2 & 0x1ff) + NVIC_FIRST_IRQ;", "if (VAR_5 < VAR_0->num_irq) {", "armv7m_nvic_set_pending(VAR_0, VAR_5);", "}", "break;", "}", "default:\nbad_offset:\nqemu_log_mask(LOG_GUEST_ERROR,\n\"NVIC: Bad write VAR_1 0x%x\\n\", VAR_1);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 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, 89 ], [ 91 ], [ 93, 97, 99, 101, 103, 105, 107 ], [ 111 ], [ 113 ], [ 115, 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149, 151 ], [ 153 ], [ 155, 157 ], [ 159 ], [ 161, 163 ], [ 165 ], [ 167, 169 ], [ 171 ], [ 173, 175 ], [ 177 ], [ 179, 181, 183 ], [ 185 ], [ 187, 189 ], [ 191, 193, 195, 197 ], [ 199, 201 ], [ 203 ], [ 205, 207, 209 ], [ 211 ], [ 213 ], [ 215, 217 ], [ 219, 221, 223 ], [ 225 ], [ 227 ], [ 229 ], [ 231 ], [ 233, 235, 237, 239, 241 ], [ 243 ], [ 247 ], [ 259 ], [ 263 ], [ 265 ], [ 267 ], [ 269 ], [ 271 ], [ 273 ], [ 275 ], [ 277 ], [ 279 ], [ 281 ], [ 283 ], [ 287 ], [ 295 ], [ 297 ], [ 299, 301, 303 ], [ 305 ], [ 307 ], [ 309 ], [ 311 ], [ 313 ], [ 315 ], [ 319 ], [ 321 ], [ 323 ], [ 327 ], [ 329 ], [ 331 ], [ 333 ], [ 335, 337, 339, 341, 343 ], [ 345 ], [ 349 ], [ 359 ], [ 363 ], [ 365 ], [ 367 ], [ 369 ], [ 371 ], [ 373 ], [ 375 ], [ 377 ], [ 379 ], [ 381 ], [ 383 ], [ 387 ], [ 389 ], [ 391 ], [ 395 ], [ 397 ], [ 399 ], [ 401 ], [ 403 ], [ 405, 407 ], [ 409 ], [ 411 ], [ 413 ], [ 417 ], [ 419 ], [ 427 ], [ 429, 431 ], [ 433 ], [ 435 ], [ 437 ], [ 441 ], [ 443 ], [ 451 ], [ 453, 455 ], [ 457 ], [ 459 ], [ 461 ], [ 463 ], [ 465 ], [ 467 ], [ 469, 471, 473, 475 ], [ 477 ], [ 479 ] ]
7,574
static void virtio_blk_handle_write(BlockRequest *blkreq, int *num_writes, VirtIOBlockReq *req) { if (req->out->sector & req->dev->sector_mask) { virtio_blk_rw_complete(req, -EIO); return; } if (*num_writes == 32) { do_multiwrite(req->dev->bs, blkreq, *num_writes); *num_writes = 0; } blkreq[*num_writes].sector = req->out->sector; blkreq[*num_writes].nb_sectors = req->qiov.size / BDRV_SECTOR_SIZE; blkreq[*num_writes].qiov = &req->qiov; blkreq[*num_writes].cb = virtio_blk_rw_complete; blkreq[*num_writes].opaque = req; blkreq[*num_writes].error = 0; (*num_writes)++; }
false
qemu
c20fd872257fb9abd2ce99741937c0f65aa162b7
static void virtio_blk_handle_write(BlockRequest *blkreq, int *num_writes, VirtIOBlockReq *req) { if (req->out->sector & req->dev->sector_mask) { virtio_blk_rw_complete(req, -EIO); return; } if (*num_writes == 32) { do_multiwrite(req->dev->bs, blkreq, *num_writes); *num_writes = 0; } blkreq[*num_writes].sector = req->out->sector; blkreq[*num_writes].nb_sectors = req->qiov.size / BDRV_SECTOR_SIZE; blkreq[*num_writes].qiov = &req->qiov; blkreq[*num_writes].cb = virtio_blk_rw_complete; blkreq[*num_writes].opaque = req; blkreq[*num_writes].error = 0; (*num_writes)++; }
{ "code": [], "line_no": [] }
static void FUNC_0(BlockRequest *VAR_0, int *VAR_1, VirtIOBlockReq *VAR_2) { if (VAR_2->out->sector & VAR_2->dev->sector_mask) { virtio_blk_rw_complete(VAR_2, -EIO); return; } if (*VAR_1 == 32) { do_multiwrite(VAR_2->dev->bs, VAR_0, *VAR_1); *VAR_1 = 0; } VAR_0[*VAR_1].sector = VAR_2->out->sector; VAR_0[*VAR_1].nb_sectors = VAR_2->qiov.size / BDRV_SECTOR_SIZE; VAR_0[*VAR_1].qiov = &VAR_2->qiov; VAR_0[*VAR_1].cb = virtio_blk_rw_complete; VAR_0[*VAR_1].opaque = VAR_2; VAR_0[*VAR_1].error = 0; (*VAR_1)++; }
[ "static void FUNC_0(BlockRequest *VAR_0, int *VAR_1,\nVirtIOBlockReq *VAR_2)\n{", "if (VAR_2->out->sector & VAR_2->dev->sector_mask) {", "virtio_blk_rw_complete(VAR_2, -EIO);", "return;", "}", "if (*VAR_1 == 32) {", "do_multiwrite(VAR_2->dev->bs, VAR_0, *VAR_1);", "*VAR_1 = 0;", "}", "VAR_0[*VAR_1].sector = VAR_2->out->sector;", "VAR_0[*VAR_1].nb_sectors = VAR_2->qiov.size / BDRV_SECTOR_SIZE;", "VAR_0[*VAR_1].qiov = &VAR_2->qiov;", "VAR_0[*VAR_1].cb = virtio_blk_rw_complete;", "VAR_0[*VAR_1].opaque = VAR_2;", "VAR_0[*VAR_1].error = 0;", "(*VAR_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 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ] ]
7,575
static void nbd_restart_write(void *opaque) { NbdClientSession *s = opaque; qemu_coroutine_enter(s->send_coroutine, NULL); }
false
qemu
f53a829bb9ef14be800556cbc02d8b20fc1050a7
static void nbd_restart_write(void *opaque) { NbdClientSession *s = opaque; qemu_coroutine_enter(s->send_coroutine, NULL); }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0) { NbdClientSession *s = VAR_0; qemu_coroutine_enter(s->send_coroutine, NULL); }
[ "static void FUNC_0(void *VAR_0)\n{", "NbdClientSession *s = VAR_0;", "qemu_coroutine_enter(s->send_coroutine, NULL);", "}" ]
[ 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ] ]
7,576
static void xen_domain_poll(void *opaque) { struct xc_dominfo info; int rc; rc = xc_domain_getinfo(xen_xc, xen_domid, 1, &info); if ((rc != 1) || (info.domid != xen_domid)) { qemu_log("xen: domain %d is gone\n", xen_domid); goto quit; } if (info.dying) { qemu_log("xen: domain %d is dying (%s%s)\n", xen_domid, info.crashed ? "crashed" : "", info.shutdown ? "shutdown" : ""); goto quit; } qemu_mod_timer(xen_poll, qemu_get_clock(rt_clock) + 1000); return; quit: qemu_system_shutdown_request(); return; }
false
qemu
7bd427d801e1e3293a634d3c83beadaa90ffb911
static void xen_domain_poll(void *opaque) { struct xc_dominfo info; int rc; rc = xc_domain_getinfo(xen_xc, xen_domid, 1, &info); if ((rc != 1) || (info.domid != xen_domid)) { qemu_log("xen: domain %d is gone\n", xen_domid); goto quit; } if (info.dying) { qemu_log("xen: domain %d is dying (%s%s)\n", xen_domid, info.crashed ? "crashed" : "", info.shutdown ? "shutdown" : ""); goto quit; } qemu_mod_timer(xen_poll, qemu_get_clock(rt_clock) + 1000); return; quit: qemu_system_shutdown_request(); return; }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0) { struct xc_dominfo VAR_1; int VAR_2; VAR_2 = xc_domain_getinfo(xen_xc, xen_domid, 1, &VAR_1); if ((VAR_2 != 1) || (VAR_1.domid != xen_domid)) { qemu_log("xen: domain %d is gone\n", xen_domid); goto quit; } if (VAR_1.dying) { qemu_log("xen: domain %d is dying (%s%s)\n", xen_domid, VAR_1.crashed ? "crashed" : "", VAR_1.shutdown ? "shutdown" : ""); goto quit; } qemu_mod_timer(xen_poll, qemu_get_clock(rt_clock) + 1000); return; quit: qemu_system_shutdown_request(); return; }
[ "static void FUNC_0(void *VAR_0)\n{", "struct xc_dominfo VAR_1;", "int VAR_2;", "VAR_2 = xc_domain_getinfo(xen_xc, xen_domid, 1, &VAR_1);", "if ((VAR_2 != 1) || (VAR_1.domid != xen_domid)) {", "qemu_log(\"xen: domain %d is gone\\n\", xen_domid);", "goto quit;", "}", "if (VAR_1.dying) {", "qemu_log(\"xen: domain %d is dying (%s%s)\\n\", xen_domid,\nVAR_1.crashed ? \"crashed\" : \"\",\nVAR_1.shutdown ? \"shutdown\" : \"\");", "goto quit;", "}", "qemu_mod_timer(xen_poll, qemu_get_clock(rt_clock) + 1000);", "return;", "quit:\nqemu_system_shutdown_request();", "return;", "}" ]
[ 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 ], [ 35 ], [ 37 ], [ 41, 43 ], [ 45 ], [ 47 ] ]
7,577
static void v9fs_unlinkat(void *opaque) { int err = 0; V9fsString name; int32_t dfid, flags; size_t offset = 7; V9fsPath path; V9fsFidState *dfidp; V9fsPDU *pdu = opaque; pdu_unmarshal(pdu, offset, "dsd", &dfid, &name, &flags); dfidp = get_fid(pdu, dfid); if (dfidp == NULL) { err = -EINVAL; goto out_nofid; } /* * IF the file is unlinked, we cannot reopen * the file later. So don't reclaim fd */ v9fs_path_init(&path); err = v9fs_co_name_to_path(pdu, &dfidp->path, name.data, &path); if (err < 0) { goto out_err; } err = v9fs_mark_fids_unreclaim(pdu, &path); if (err < 0) { goto out_err; } err = v9fs_co_unlinkat(pdu, &dfidp->path, &name, flags); if (!err) { err = offset; } out_err: put_fid(pdu, dfidp); v9fs_path_free(&path); out_nofid: complete_pdu(pdu->s, pdu, err); v9fs_string_free(&name); }
false
qemu
ddca7f86ac022289840e0200fd4050b2b58e9176
static void v9fs_unlinkat(void *opaque) { int err = 0; V9fsString name; int32_t dfid, flags; size_t offset = 7; V9fsPath path; V9fsFidState *dfidp; V9fsPDU *pdu = opaque; pdu_unmarshal(pdu, offset, "dsd", &dfid, &name, &flags); dfidp = get_fid(pdu, dfid); if (dfidp == NULL) { err = -EINVAL; goto out_nofid; } v9fs_path_init(&path); err = v9fs_co_name_to_path(pdu, &dfidp->path, name.data, &path); if (err < 0) { goto out_err; } err = v9fs_mark_fids_unreclaim(pdu, &path); if (err < 0) { goto out_err; } err = v9fs_co_unlinkat(pdu, &dfidp->path, &name, flags); if (!err) { err = offset; } out_err: put_fid(pdu, dfidp); v9fs_path_free(&path); out_nofid: complete_pdu(pdu->s, pdu, err); v9fs_string_free(&name); }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0) { int VAR_1 = 0; V9fsString name; int32_t dfid, flags; size_t offset = 7; V9fsPath path; V9fsFidState *dfidp; V9fsPDU *pdu = VAR_0; pdu_unmarshal(pdu, offset, "dsd", &dfid, &name, &flags); dfidp = get_fid(pdu, dfid); if (dfidp == NULL) { VAR_1 = -EINVAL; goto out_nofid; } v9fs_path_init(&path); VAR_1 = v9fs_co_name_to_path(pdu, &dfidp->path, name.data, &path); if (VAR_1 < 0) { goto out_err; } VAR_1 = v9fs_mark_fids_unreclaim(pdu, &path); if (VAR_1 < 0) { goto out_err; } VAR_1 = v9fs_co_unlinkat(pdu, &dfidp->path, &name, flags); if (!VAR_1) { VAR_1 = offset; } out_err: put_fid(pdu, dfidp); v9fs_path_free(&path); out_nofid: complete_pdu(pdu->s, pdu, VAR_1); v9fs_string_free(&name); }
[ "static void FUNC_0(void *VAR_0)\n{", "int VAR_1 = 0;", "V9fsString name;", "int32_t dfid, flags;", "size_t offset = 7;", "V9fsPath path;", "V9fsFidState *dfidp;", "V9fsPDU *pdu = VAR_0;", "pdu_unmarshal(pdu, offset, \"dsd\", &dfid, &name, &flags);", "dfidp = get_fid(pdu, dfid);", "if (dfidp == NULL) {", "VAR_1 = -EINVAL;", "goto out_nofid;", "}", "v9fs_path_init(&path);", "VAR_1 = v9fs_co_name_to_path(pdu, &dfidp->path, name.data, &path);", "if (VAR_1 < 0) {", "goto out_err;", "}", "VAR_1 = v9fs_mark_fids_unreclaim(pdu, &path);", "if (VAR_1 < 0) {", "goto out_err;", "}", "VAR_1 = v9fs_co_unlinkat(pdu, &dfidp->path, &name, flags);", "if (!VAR_1) {", "VAR_1 = offset;", "}", "out_err:\nput_fid(pdu, dfidp);", "v9fs_path_free(&path);", "out_nofid:\ncomplete_pdu(pdu->s, pdu, VAR_1);", "v9fs_string_free(&name);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69, 71 ], [ 73 ], [ 75, 77 ], [ 79 ], [ 81 ] ]
7,578
void load_seg(int seg_reg, int selector, unsigned int cur_eip) { uint32_t e1, e2; int cpl, dpl, rpl; SegmentCache *dt; int index; uint8_t *ptr; if ((selector & 0xfffc) == 0) { /* null selector case */ if (seg_reg == R_SS) { EIP = cur_eip; raise_exception_err(EXCP0D_GPF, 0); } else { cpu_x86_load_seg_cache(env, seg_reg, selector, NULL, 0, 0); } } else { if (selector & 0x4) dt = &env->ldt; else dt = &env->gdt; index = selector & ~7; if ((index + 7) > dt->limit) { EIP = cur_eip; raise_exception_err(EXCP0D_GPF, selector & 0xfffc); } ptr = dt->base + index; e1 = ldl_kernel(ptr); e2 = ldl_kernel(ptr + 4); if (!(e2 & DESC_S_MASK)) { EIP = cur_eip; raise_exception_err(EXCP0D_GPF, selector & 0xfffc); } rpl = selector & 3; dpl = (e2 >> DESC_DPL_SHIFT) & 3; cpl = env->hflags & HF_CPL_MASK; if (seg_reg == R_SS) { /* must be writable segment */ if ((e2 & DESC_CS_MASK) || !(e2 & DESC_W_MASK)) { EIP = cur_eip; raise_exception_err(EXCP0D_GPF, selector & 0xfffc); } if (rpl != cpl || dpl != cpl) { EIP = cur_eip; raise_exception_err(EXCP0D_GPF, selector & 0xfffc); } } else { /* must be readable segment */ if ((e2 & (DESC_CS_MASK | DESC_R_MASK)) == DESC_CS_MASK) { EIP = cur_eip; raise_exception_err(EXCP0D_GPF, selector & 0xfffc); } if (!(e2 & DESC_CS_MASK) || !(e2 & DESC_C_MASK)) { /* if not conforming code, test rights */ if (dpl < cpl || dpl < rpl) { EIP = cur_eip; raise_exception_err(EXCP0D_GPF, selector & 0xfffc); } } } if (!(e2 & DESC_P_MASK)) { EIP = cur_eip; if (seg_reg == R_SS) raise_exception_err(EXCP0C_STACK, selector & 0xfffc); else raise_exception_err(EXCP0B_NOSEG, selector & 0xfffc); } /* set the access bit if not already set */ if (!(e2 & DESC_A_MASK)) { e2 |= DESC_A_MASK; stl_kernel(ptr + 4, e2); } cpu_x86_load_seg_cache(env, seg_reg, selector, get_seg_base(e1, e2), get_seg_limit(e1, e2), e2); #if 0 fprintf(logfile, "load_seg: sel=0x%04x base=0x%08lx limit=0x%08lx flags=%08x\n", selector, (unsigned long)sc->base, sc->limit, sc->flags); #endif } }
false
qemu
8e682019e37c8f8939244fcf44a592fa6347d127
void load_seg(int seg_reg, int selector, unsigned int cur_eip) { uint32_t e1, e2; int cpl, dpl, rpl; SegmentCache *dt; int index; uint8_t *ptr; if ((selector & 0xfffc) == 0) { if (seg_reg == R_SS) { EIP = cur_eip; raise_exception_err(EXCP0D_GPF, 0); } else { cpu_x86_load_seg_cache(env, seg_reg, selector, NULL, 0, 0); } } else { if (selector & 0x4) dt = &env->ldt; else dt = &env->gdt; index = selector & ~7; if ((index + 7) > dt->limit) { EIP = cur_eip; raise_exception_err(EXCP0D_GPF, selector & 0xfffc); } ptr = dt->base + index; e1 = ldl_kernel(ptr); e2 = ldl_kernel(ptr + 4); if (!(e2 & DESC_S_MASK)) { EIP = cur_eip; raise_exception_err(EXCP0D_GPF, selector & 0xfffc); } rpl = selector & 3; dpl = (e2 >> DESC_DPL_SHIFT) & 3; cpl = env->hflags & HF_CPL_MASK; if (seg_reg == R_SS) { if ((e2 & DESC_CS_MASK) || !(e2 & DESC_W_MASK)) { EIP = cur_eip; raise_exception_err(EXCP0D_GPF, selector & 0xfffc); } if (rpl != cpl || dpl != cpl) { EIP = cur_eip; raise_exception_err(EXCP0D_GPF, selector & 0xfffc); } } else { if ((e2 & (DESC_CS_MASK | DESC_R_MASK)) == DESC_CS_MASK) { EIP = cur_eip; raise_exception_err(EXCP0D_GPF, selector & 0xfffc); } if (!(e2 & DESC_CS_MASK) || !(e2 & DESC_C_MASK)) { if (dpl < cpl || dpl < rpl) { EIP = cur_eip; raise_exception_err(EXCP0D_GPF, selector & 0xfffc); } } } if (!(e2 & DESC_P_MASK)) { EIP = cur_eip; if (seg_reg == R_SS) raise_exception_err(EXCP0C_STACK, selector & 0xfffc); else raise_exception_err(EXCP0B_NOSEG, selector & 0xfffc); } if (!(e2 & DESC_A_MASK)) { e2 |= DESC_A_MASK; stl_kernel(ptr + 4, e2); } cpu_x86_load_seg_cache(env, seg_reg, selector, get_seg_base(e1, e2), get_seg_limit(e1, e2), e2); #if 0 fprintf(logfile, "load_seg: sel=0x%04x base=0x%08lx limit=0x%08lx flags=%08x\n", selector, (unsigned long)sc->base, sc->limit, sc->flags); #endif } }
{ "code": [], "line_no": [] }
void FUNC_0(int VAR_0, int VAR_1, unsigned int VAR_2) { uint32_t e1, e2; int VAR_3, VAR_4, VAR_5; SegmentCache *dt; int VAR_6; uint8_t *ptr; if ((VAR_1 & 0xfffc) == 0) { if (VAR_0 == R_SS) { EIP = VAR_2; raise_exception_err(EXCP0D_GPF, 0); } else { cpu_x86_load_seg_cache(env, VAR_0, VAR_1, NULL, 0, 0); } } else { if (VAR_1 & 0x4) dt = &env->ldt; else dt = &env->gdt; VAR_6 = VAR_1 & ~7; if ((VAR_6 + 7) > dt->limit) { EIP = VAR_2; raise_exception_err(EXCP0D_GPF, VAR_1 & 0xfffc); } ptr = dt->base + VAR_6; e1 = ldl_kernel(ptr); e2 = ldl_kernel(ptr + 4); if (!(e2 & DESC_S_MASK)) { EIP = VAR_2; raise_exception_err(EXCP0D_GPF, VAR_1 & 0xfffc); } VAR_5 = VAR_1 & 3; VAR_4 = (e2 >> DESC_DPL_SHIFT) & 3; VAR_3 = env->hflags & HF_CPL_MASK; if (VAR_0 == R_SS) { if ((e2 & DESC_CS_MASK) || !(e2 & DESC_W_MASK)) { EIP = VAR_2; raise_exception_err(EXCP0D_GPF, VAR_1 & 0xfffc); } if (VAR_5 != VAR_3 || VAR_4 != VAR_3) { EIP = VAR_2; raise_exception_err(EXCP0D_GPF, VAR_1 & 0xfffc); } } else { if ((e2 & (DESC_CS_MASK | DESC_R_MASK)) == DESC_CS_MASK) { EIP = VAR_2; raise_exception_err(EXCP0D_GPF, VAR_1 & 0xfffc); } if (!(e2 & DESC_CS_MASK) || !(e2 & DESC_C_MASK)) { if (VAR_4 < VAR_3 || VAR_4 < VAR_5) { EIP = VAR_2; raise_exception_err(EXCP0D_GPF, VAR_1 & 0xfffc); } } } if (!(e2 & DESC_P_MASK)) { EIP = VAR_2; if (VAR_0 == R_SS) raise_exception_err(EXCP0C_STACK, VAR_1 & 0xfffc); else raise_exception_err(EXCP0B_NOSEG, VAR_1 & 0xfffc); } if (!(e2 & DESC_A_MASK)) { e2 |= DESC_A_MASK; stl_kernel(ptr + 4, e2); } cpu_x86_load_seg_cache(env, VAR_0, VAR_1, get_seg_base(e1, e2), get_seg_limit(e1, e2), e2); #if 0 fprintf(logfile, "FUNC_0: sel=0x%04x base=0x%08lx limit=0x%08lx flags=%08x\n", VAR_1, (unsigned long)sc->base, sc->limit, sc->flags); #endif } }
[ "void FUNC_0(int VAR_0, int VAR_1, unsigned int VAR_2)\n{", "uint32_t e1, e2;", "int VAR_3, VAR_4, VAR_5;", "SegmentCache *dt;", "int VAR_6;", "uint8_t *ptr;", "if ((VAR_1 & 0xfffc) == 0) {", "if (VAR_0 == R_SS) {", "EIP = VAR_2;", "raise_exception_err(EXCP0D_GPF, 0);", "} else {", "cpu_x86_load_seg_cache(env, VAR_0, VAR_1, NULL, 0, 0);", "}", "} else {", "if (VAR_1 & 0x4)\ndt = &env->ldt;", "else\ndt = &env->gdt;", "VAR_6 = VAR_1 & ~7;", "if ((VAR_6 + 7) > dt->limit) {", "EIP = VAR_2;", "raise_exception_err(EXCP0D_GPF, VAR_1 & 0xfffc);", "}", "ptr = dt->base + VAR_6;", "e1 = ldl_kernel(ptr);", "e2 = ldl_kernel(ptr + 4);", "if (!(e2 & DESC_S_MASK)) {", "EIP = VAR_2;", "raise_exception_err(EXCP0D_GPF, VAR_1 & 0xfffc);", "}", "VAR_5 = VAR_1 & 3;", "VAR_4 = (e2 >> DESC_DPL_SHIFT) & 3;", "VAR_3 = env->hflags & HF_CPL_MASK;", "if (VAR_0 == R_SS) {", "if ((e2 & DESC_CS_MASK) || !(e2 & DESC_W_MASK)) {", "EIP = VAR_2;", "raise_exception_err(EXCP0D_GPF, VAR_1 & 0xfffc);", "}", "if (VAR_5 != VAR_3 || VAR_4 != VAR_3) {", "EIP = VAR_2;", "raise_exception_err(EXCP0D_GPF, VAR_1 & 0xfffc);", "}", "} else {", "if ((e2 & (DESC_CS_MASK | DESC_R_MASK)) == DESC_CS_MASK) {", "EIP = VAR_2;", "raise_exception_err(EXCP0D_GPF, VAR_1 & 0xfffc);", "}", "if (!(e2 & DESC_CS_MASK) || !(e2 & DESC_C_MASK)) {", "if (VAR_4 < VAR_3 || VAR_4 < VAR_5) {", "EIP = VAR_2;", "raise_exception_err(EXCP0D_GPF, VAR_1 & 0xfffc);", "}", "}", "}", "if (!(e2 & DESC_P_MASK)) {", "EIP = VAR_2;", "if (VAR_0 == R_SS)\nraise_exception_err(EXCP0C_STACK, VAR_1 & 0xfffc);", "else\nraise_exception_err(EXCP0B_NOSEG, VAR_1 & 0xfffc);", "}", "if (!(e2 & DESC_A_MASK)) {", "e2 |= DESC_A_MASK;", "stl_kernel(ptr + 4, e2);", "}", "cpu_x86_load_seg_cache(env, VAR_0, VAR_1,\nget_seg_base(e1, e2),\nget_seg_limit(e1, e2),\ne2);", "#if 0\nfprintf(logfile, \"FUNC_0: sel=0x%04x base=0x%08lx limit=0x%08lx flags=%08x\\n\",\nVAR_1, (unsigned long)sc->base, sc->limit, sc->flags);", "#endif\n}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 29 ], [ 31 ], [ 33 ], [ 37, 39 ], [ 41, 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 111 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 129 ], [ 131 ], [ 133, 135 ], [ 137, 139 ], [ 141 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 157, 159, 161, 163 ], [ 165, 167, 169 ], [ 171, 173 ], [ 175 ] ]
7,581
static int decode_exponents(GetBitContext *gbc, int exp_strategy, int ngrps, uint8_t absexp, int8_t *dexps) { int i, j, grp, group_size; int dexp[256]; int expacc, prevexp; /* unpack groups */ group_size = exp_strategy + (exp_strategy == EXP_D45); for(grp=0,i=0; grp<ngrps; grp++) { expacc = get_bits(gbc, 7); dexp[i++] = ungroup_3_in_7_bits_tab[expacc][0]; dexp[i++] = ungroup_3_in_7_bits_tab[expacc][1]; dexp[i++] = ungroup_3_in_7_bits_tab[expacc][2]; } /* convert to absolute exps and expand groups */ prevexp = absexp; for(i=0,j=0; i<ngrps*3; i++) { prevexp += dexp[i] - 2; if (prevexp < 0 || prevexp > 24) return -1; switch (group_size) { case 4: dexps[j++] = prevexp; dexps[j++] = prevexp; case 2: dexps[j++] = prevexp; case 1: dexps[j++] = prevexp; } } return 0; }
false
FFmpeg
2ceccf045c295b9a507d6e3be7710c63f51c0529
static int decode_exponents(GetBitContext *gbc, int exp_strategy, int ngrps, uint8_t absexp, int8_t *dexps) { int i, j, grp, group_size; int dexp[256]; int expacc, prevexp; group_size = exp_strategy + (exp_strategy == EXP_D45); for(grp=0,i=0; grp<ngrps; grp++) { expacc = get_bits(gbc, 7); dexp[i++] = ungroup_3_in_7_bits_tab[expacc][0]; dexp[i++] = ungroup_3_in_7_bits_tab[expacc][1]; dexp[i++] = ungroup_3_in_7_bits_tab[expacc][2]; } prevexp = absexp; for(i=0,j=0; i<ngrps*3; i++) { prevexp += dexp[i] - 2; if (prevexp < 0 || prevexp > 24) return -1; switch (group_size) { case 4: dexps[j++] = prevexp; dexps[j++] = prevexp; case 2: dexps[j++] = prevexp; case 1: dexps[j++] = prevexp; } } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(GetBitContext *VAR_0, int VAR_1, int VAR_2, uint8_t VAR_3, int8_t *VAR_4) { int VAR_5, VAR_6, VAR_7, VAR_8; int VAR_9[256]; int VAR_10, VAR_11; VAR_8 = VAR_1 + (VAR_1 == EXP_D45); for(VAR_7=0,VAR_5=0; VAR_7<VAR_2; VAR_7++) { VAR_10 = get_bits(VAR_0, 7); VAR_9[VAR_5++] = ungroup_3_in_7_bits_tab[VAR_10][0]; VAR_9[VAR_5++] = ungroup_3_in_7_bits_tab[VAR_10][1]; VAR_9[VAR_5++] = ungroup_3_in_7_bits_tab[VAR_10][2]; } VAR_11 = VAR_3; for(VAR_5=0,VAR_6=0; VAR_5<VAR_2*3; VAR_5++) { VAR_11 += VAR_9[VAR_5] - 2; if (VAR_11 < 0 || VAR_11 > 24) return -1; switch (VAR_8) { case 4: VAR_4[VAR_6++] = VAR_11; VAR_4[VAR_6++] = VAR_11; case 2: VAR_4[VAR_6++] = VAR_11; case 1: VAR_4[VAR_6++] = VAR_11; } } return 0; }
[ "static int FUNC_0(GetBitContext *VAR_0, int VAR_1, int VAR_2,\nuint8_t VAR_3, int8_t *VAR_4)\n{", "int VAR_5, VAR_6, VAR_7, VAR_8;", "int VAR_9[256];", "int VAR_10, VAR_11;", "VAR_8 = VAR_1 + (VAR_1 == EXP_D45);", "for(VAR_7=0,VAR_5=0; VAR_7<VAR_2; VAR_7++) {", "VAR_10 = get_bits(VAR_0, 7);", "VAR_9[VAR_5++] = ungroup_3_in_7_bits_tab[VAR_10][0];", "VAR_9[VAR_5++] = ungroup_3_in_7_bits_tab[VAR_10][1];", "VAR_9[VAR_5++] = ungroup_3_in_7_bits_tab[VAR_10][2];", "}", "VAR_11 = VAR_3;", "for(VAR_5=0,VAR_6=0; VAR_5<VAR_2*3; VAR_5++) {", "VAR_11 += VAR_9[VAR_5] - 2;", "if (VAR_11 < 0 || VAR_11 > 24)\nreturn -1;", "switch (VAR_8) {", "case 4: VAR_4[VAR_6++] = VAR_11;", "VAR_4[VAR_6++] = VAR_11;", "case 2: VAR_4[VAR_6++] = VAR_11;", "case 1: VAR_4[VAR_6++] = VAR_11;", "}", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 35 ], [ 37 ], [ 39 ], [ 41, 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ] ]
7,582
static void unix_accept_incoming_migration(void *opaque) { struct sockaddr_un addr; socklen_t addrlen = sizeof(addr); int s = (unsigned long)opaque; QEMUFile *f; int c, ret; do { c = qemu_accept(s, (struct sockaddr *)&addr, &addrlen); } while (c == -1 && socket_error() == EINTR); DPRINTF("accepted migration\n"); if (c == -1) { fprintf(stderr, "could not accept migration connection\n"); return; } f = qemu_fopen_socket(c); if (f == NULL) { fprintf(stderr, "could not qemu_fopen socket\n"); goto out; } ret = qemu_loadvm_state(f); if (ret < 0) { fprintf(stderr, "load of migration failed\n"); goto out_fopen; } qemu_announce_self(); DPRINTF("successfully loaded vm state\n"); /* we've successfully migrated, close the server socket */ qemu_set_fd_handler2(s, NULL, NULL, NULL, NULL); close(s); out_fopen: qemu_fclose(f); out: close(c); }
false
qemu
cfaf6d36ae761da1033159d85d670706ffb24fb9
static void unix_accept_incoming_migration(void *opaque) { struct sockaddr_un addr; socklen_t addrlen = sizeof(addr); int s = (unsigned long)opaque; QEMUFile *f; int c, ret; do { c = qemu_accept(s, (struct sockaddr *)&addr, &addrlen); } while (c == -1 && socket_error() == EINTR); DPRINTF("accepted migration\n"); if (c == -1) { fprintf(stderr, "could not accept migration connection\n"); return; } f = qemu_fopen_socket(c); if (f == NULL) { fprintf(stderr, "could not qemu_fopen socket\n"); goto out; } ret = qemu_loadvm_state(f); if (ret < 0) { fprintf(stderr, "load of migration failed\n"); goto out_fopen; } qemu_announce_self(); DPRINTF("successfully loaded vm state\n"); qemu_set_fd_handler2(s, NULL, NULL, NULL, NULL); close(s); out_fopen: qemu_fclose(f); out: close(c); }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0) { struct sockaddr_un VAR_1; socklen_t addrlen = sizeof(VAR_1); int VAR_2 = (unsigned long)VAR_0; QEMUFile *f; int VAR_3, VAR_4; do { VAR_3 = qemu_accept(VAR_2, (struct sockaddr *)&VAR_1, &addrlen); } while (VAR_3 == -1 && socket_error() == EINTR); DPRINTF("accepted migration\n"); if (VAR_3 == -1) { fprintf(stderr, "could not accept migration connection\n"); return; } f = qemu_fopen_socket(VAR_3); if (f == NULL) { fprintf(stderr, "could not qemu_fopen socket\n"); goto out; } VAR_4 = qemu_loadvm_state(f); if (VAR_4 < 0) { fprintf(stderr, "load of migration failed\n"); goto out_fopen; } qemu_announce_self(); DPRINTF("successfully loaded vm state\n"); qemu_set_fd_handler2(VAR_2, NULL, NULL, NULL, NULL); close(VAR_2); out_fopen: qemu_fclose(f); out: close(VAR_3); }
[ "static void FUNC_0(void *VAR_0)\n{", "struct sockaddr_un VAR_1;", "socklen_t addrlen = sizeof(VAR_1);", "int VAR_2 = (unsigned long)VAR_0;", "QEMUFile *f;", "int VAR_3, VAR_4;", "do {", "VAR_3 = qemu_accept(VAR_2, (struct sockaddr *)&VAR_1, &addrlen);", "} while (VAR_3 == -1 && socket_error() == EINTR);", "DPRINTF(\"accepted migration\\n\");", "if (VAR_3 == -1) {", "fprintf(stderr, \"could not accept migration connection\\n\");", "return;", "}", "f = qemu_fopen_socket(VAR_3);", "if (f == NULL) {", "fprintf(stderr, \"could not qemu_fopen socket\\n\");", "goto out;", "}", "VAR_4 = qemu_loadvm_state(f);", "if (VAR_4 < 0) {", "fprintf(stderr, \"load of migration failed\\n\");", "goto out_fopen;", "}", "qemu_announce_self();", "DPRINTF(\"successfully loaded vm state\\n\");", "qemu_set_fd_handler2(VAR_2, NULL, NULL, NULL, NULL);", "close(VAR_2);", "out_fopen:\nqemu_fclose(f);", "out:\nclose(VAR_3);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 69 ], [ 71 ], [ 75, 77 ], [ 79, 81 ], [ 83 ] ]
7,583
static int protocol_version(VncState *vs, uint8_t *version, size_t len) { char local[13]; memcpy(local, version, 12); local[12] = 0; if (sscanf(local, "RFB %03d.%03d\n", &vs->major, &vs->minor) != 2) { VNC_DEBUG("Malformed protocol version %s\n", local); vnc_client_error(vs); return 0; } VNC_DEBUG("Client request protocol version %d.%d\n", vs->major, vs->minor); if (vs->major != 3 || (vs->minor != 3 && vs->minor != 4 && vs->minor != 5 && vs->minor != 7 && vs->minor != 8)) { VNC_DEBUG("Unsupported client version\n"); vnc_write_u32(vs, VNC_AUTH_INVALID); vnc_flush(vs); vnc_client_error(vs); return 0; } /* Some broken clients report v3.4 or v3.5, which spec requires to be treated * as equivalent to v3.3 by servers */ if (vs->minor == 4 || vs->minor == 5) vs->minor = 3; if (vs->minor == 3) { if (vs->vd->auth == VNC_AUTH_NONE) { VNC_DEBUG("Tell client auth none\n"); vnc_write_u32(vs, vs->vd->auth); vnc_flush(vs); vnc_read_when(vs, protocol_client_init, 1); } else if (vs->vd->auth == VNC_AUTH_VNC) { VNC_DEBUG("Tell client VNC auth\n"); vnc_write_u32(vs, vs->vd->auth); vnc_flush(vs); start_auth_vnc(vs); } else { VNC_DEBUG("Unsupported auth %d for protocol 3.3\n", vs->vd->auth); vnc_write_u32(vs, VNC_AUTH_INVALID); vnc_flush(vs); vnc_client_error(vs); } } else { VNC_DEBUG("Telling client we support auth %d\n", vs->vd->auth); vnc_write_u8(vs, 1); /* num auth */ vnc_write_u8(vs, vs->vd->auth); vnc_read_when(vs, protocol_client_auth, 1); vnc_flush(vs); } return 0; }
false
qemu
5fb6c7a8b26eab1a22207d24b4784bd2b39ab54b
static int protocol_version(VncState *vs, uint8_t *version, size_t len) { char local[13]; memcpy(local, version, 12); local[12] = 0; if (sscanf(local, "RFB %03d.%03d\n", &vs->major, &vs->minor) != 2) { VNC_DEBUG("Malformed protocol version %s\n", local); vnc_client_error(vs); return 0; } VNC_DEBUG("Client request protocol version %d.%d\n", vs->major, vs->minor); if (vs->major != 3 || (vs->minor != 3 && vs->minor != 4 && vs->minor != 5 && vs->minor != 7 && vs->minor != 8)) { VNC_DEBUG("Unsupported client version\n"); vnc_write_u32(vs, VNC_AUTH_INVALID); vnc_flush(vs); vnc_client_error(vs); return 0; } if (vs->minor == 4 || vs->minor == 5) vs->minor = 3; if (vs->minor == 3) { if (vs->vd->auth == VNC_AUTH_NONE) { VNC_DEBUG("Tell client auth none\n"); vnc_write_u32(vs, vs->vd->auth); vnc_flush(vs); vnc_read_when(vs, protocol_client_init, 1); } else if (vs->vd->auth == VNC_AUTH_VNC) { VNC_DEBUG("Tell client VNC auth\n"); vnc_write_u32(vs, vs->vd->auth); vnc_flush(vs); start_auth_vnc(vs); } else { VNC_DEBUG("Unsupported auth %d for protocol 3.3\n", vs->vd->auth); vnc_write_u32(vs, VNC_AUTH_INVALID); vnc_flush(vs); vnc_client_error(vs); } } else { VNC_DEBUG("Telling client we support auth %d\n", vs->vd->auth); vnc_write_u8(vs, 1); vnc_write_u8(vs, vs->vd->auth); vnc_read_when(vs, protocol_client_auth, 1); vnc_flush(vs); } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(VncState *VAR_0, uint8_t *VAR_1, size_t VAR_2) { char VAR_3[13]; memcpy(VAR_3, VAR_1, 12); VAR_3[12] = 0; if (sscanf(VAR_3, "RFB %03d.%03d\n", &VAR_0->major, &VAR_0->minor) != 2) { VNC_DEBUG("Malformed protocol VAR_1 %s\n", VAR_3); vnc_client_error(VAR_0); return 0; } VNC_DEBUG("Client request protocol VAR_1 %d.%d\n", VAR_0->major, VAR_0->minor); if (VAR_0->major != 3 || (VAR_0->minor != 3 && VAR_0->minor != 4 && VAR_0->minor != 5 && VAR_0->minor != 7 && VAR_0->minor != 8)) { VNC_DEBUG("Unsupported client VAR_1\n"); vnc_write_u32(VAR_0, VNC_AUTH_INVALID); vnc_flush(VAR_0); vnc_client_error(VAR_0); return 0; } if (VAR_0->minor == 4 || VAR_0->minor == 5) VAR_0->minor = 3; if (VAR_0->minor == 3) { if (VAR_0->vd->auth == VNC_AUTH_NONE) { VNC_DEBUG("Tell client auth none\n"); vnc_write_u32(VAR_0, VAR_0->vd->auth); vnc_flush(VAR_0); vnc_read_when(VAR_0, protocol_client_init, 1); } else if (VAR_0->vd->auth == VNC_AUTH_VNC) { VNC_DEBUG("Tell client VNC auth\n"); vnc_write_u32(VAR_0, VAR_0->vd->auth); vnc_flush(VAR_0); start_auth_vnc(VAR_0); } else { VNC_DEBUG("Unsupported auth %d for protocol 3.3\n", VAR_0->vd->auth); vnc_write_u32(VAR_0, VNC_AUTH_INVALID); vnc_flush(VAR_0); vnc_client_error(VAR_0); } } else { VNC_DEBUG("Telling client we support auth %d\n", VAR_0->vd->auth); vnc_write_u8(VAR_0, 1); vnc_write_u8(VAR_0, VAR_0->vd->auth); vnc_read_when(VAR_0, protocol_client_auth, 1); vnc_flush(VAR_0); } return 0; }
[ "static int FUNC_0(VncState *VAR_0, uint8_t *VAR_1, size_t VAR_2)\n{", "char VAR_3[13];", "memcpy(VAR_3, VAR_1, 12);", "VAR_3[12] = 0;", "if (sscanf(VAR_3, \"RFB %03d.%03d\\n\", &VAR_0->major, &VAR_0->minor) != 2) {", "VNC_DEBUG(\"Malformed protocol VAR_1 %s\\n\", VAR_3);", "vnc_client_error(VAR_0);", "return 0;", "}", "VNC_DEBUG(\"Client request protocol VAR_1 %d.%d\\n\", VAR_0->major, VAR_0->minor);", "if (VAR_0->major != 3 ||\n(VAR_0->minor != 3 &&\nVAR_0->minor != 4 &&\nVAR_0->minor != 5 &&\nVAR_0->minor != 7 &&\nVAR_0->minor != 8)) {", "VNC_DEBUG(\"Unsupported client VAR_1\\n\");", "vnc_write_u32(VAR_0, VNC_AUTH_INVALID);", "vnc_flush(VAR_0);", "vnc_client_error(VAR_0);", "return 0;", "}", "if (VAR_0->minor == 4 || VAR_0->minor == 5)\nVAR_0->minor = 3;", "if (VAR_0->minor == 3) {", "if (VAR_0->vd->auth == VNC_AUTH_NONE) {", "VNC_DEBUG(\"Tell client auth none\\n\");", "vnc_write_u32(VAR_0, VAR_0->vd->auth);", "vnc_flush(VAR_0);", "vnc_read_when(VAR_0, protocol_client_init, 1);", "} else if (VAR_0->vd->auth == VNC_AUTH_VNC) {", "VNC_DEBUG(\"Tell client VNC auth\\n\");", "vnc_write_u32(VAR_0, VAR_0->vd->auth);", "vnc_flush(VAR_0);", "start_auth_vnc(VAR_0);", "} else {", "VNC_DEBUG(\"Unsupported auth %d for protocol 3.3\\n\", VAR_0->vd->auth);", "vnc_write_u32(VAR_0, VNC_AUTH_INVALID);", "vnc_flush(VAR_0);", "vnc_client_error(VAR_0);", "}", "} else {", "VNC_DEBUG(\"Telling client we support auth %d\\n\", VAR_0->vd->auth);", "vnc_write_u8(VAR_0, 1);", "vnc_write_u8(VAR_0, VAR_0->vd->auth);", "vnc_read_when(VAR_0, protocol_client_auth, 1);", "vnc_flush(VAR_0);", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27, 29, 31, 33, 35, 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 57, 59 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 113 ], [ 115 ] ]
7,584
static void data_plane_set_up_op_blockers(VirtIOBlockDataPlane *s) { assert(!s->blocker); error_setg(&s->blocker, "block device is in use by data plane"); blk_op_block_all(s->conf->conf.blk, s->blocker); blk_op_unblock(s->conf->conf.blk, BLOCK_OP_TYPE_RESIZE, s->blocker); blk_op_unblock(s->conf->conf.blk, BLOCK_OP_TYPE_DRIVE_DEL, s->blocker); blk_op_unblock(s->conf->conf.blk, BLOCK_OP_TYPE_BACKUP_SOURCE, s->blocker); blk_op_unblock(s->conf->conf.blk, BLOCK_OP_TYPE_CHANGE, s->blocker); blk_op_unblock(s->conf->conf.blk, BLOCK_OP_TYPE_COMMIT_SOURCE, s->blocker); blk_op_unblock(s->conf->conf.blk, BLOCK_OP_TYPE_COMMIT_TARGET, s->blocker); blk_op_unblock(s->conf->conf.blk, BLOCK_OP_TYPE_EJECT, s->blocker); blk_op_unblock(s->conf->conf.blk, BLOCK_OP_TYPE_EXTERNAL_SNAPSHOT, s->blocker); blk_op_unblock(s->conf->conf.blk, BLOCK_OP_TYPE_INTERNAL_SNAPSHOT, s->blocker); blk_op_unblock(s->conf->conf.blk, BLOCK_OP_TYPE_INTERNAL_SNAPSHOT_DELETE, s->blocker); blk_op_unblock(s->conf->conf.blk, BLOCK_OP_TYPE_MIRROR_SOURCE, s->blocker); blk_op_unblock(s->conf->conf.blk, BLOCK_OP_TYPE_STREAM, s->blocker); blk_op_unblock(s->conf->conf.blk, BLOCK_OP_TYPE_REPLACE, s->blocker); }
false
qemu
348295838384941d1e5420d10e57366c4e303d45
static void data_plane_set_up_op_blockers(VirtIOBlockDataPlane *s) { assert(!s->blocker); error_setg(&s->blocker, "block device is in use by data plane"); blk_op_block_all(s->conf->conf.blk, s->blocker); blk_op_unblock(s->conf->conf.blk, BLOCK_OP_TYPE_RESIZE, s->blocker); blk_op_unblock(s->conf->conf.blk, BLOCK_OP_TYPE_DRIVE_DEL, s->blocker); blk_op_unblock(s->conf->conf.blk, BLOCK_OP_TYPE_BACKUP_SOURCE, s->blocker); blk_op_unblock(s->conf->conf.blk, BLOCK_OP_TYPE_CHANGE, s->blocker); blk_op_unblock(s->conf->conf.blk, BLOCK_OP_TYPE_COMMIT_SOURCE, s->blocker); blk_op_unblock(s->conf->conf.blk, BLOCK_OP_TYPE_COMMIT_TARGET, s->blocker); blk_op_unblock(s->conf->conf.blk, BLOCK_OP_TYPE_EJECT, s->blocker); blk_op_unblock(s->conf->conf.blk, BLOCK_OP_TYPE_EXTERNAL_SNAPSHOT, s->blocker); blk_op_unblock(s->conf->conf.blk, BLOCK_OP_TYPE_INTERNAL_SNAPSHOT, s->blocker); blk_op_unblock(s->conf->conf.blk, BLOCK_OP_TYPE_INTERNAL_SNAPSHOT_DELETE, s->blocker); blk_op_unblock(s->conf->conf.blk, BLOCK_OP_TYPE_MIRROR_SOURCE, s->blocker); blk_op_unblock(s->conf->conf.blk, BLOCK_OP_TYPE_STREAM, s->blocker); blk_op_unblock(s->conf->conf.blk, BLOCK_OP_TYPE_REPLACE, s->blocker); }
{ "code": [], "line_no": [] }
static void FUNC_0(VirtIOBlockDataPlane *VAR_0) { assert(!VAR_0->blocker); error_setg(&VAR_0->blocker, "block device is in use by data plane"); blk_op_block_all(VAR_0->conf->conf.blk, VAR_0->blocker); blk_op_unblock(VAR_0->conf->conf.blk, BLOCK_OP_TYPE_RESIZE, VAR_0->blocker); blk_op_unblock(VAR_0->conf->conf.blk, BLOCK_OP_TYPE_DRIVE_DEL, VAR_0->blocker); blk_op_unblock(VAR_0->conf->conf.blk, BLOCK_OP_TYPE_BACKUP_SOURCE, VAR_0->blocker); blk_op_unblock(VAR_0->conf->conf.blk, BLOCK_OP_TYPE_CHANGE, VAR_0->blocker); blk_op_unblock(VAR_0->conf->conf.blk, BLOCK_OP_TYPE_COMMIT_SOURCE, VAR_0->blocker); blk_op_unblock(VAR_0->conf->conf.blk, BLOCK_OP_TYPE_COMMIT_TARGET, VAR_0->blocker); blk_op_unblock(VAR_0->conf->conf.blk, BLOCK_OP_TYPE_EJECT, VAR_0->blocker); blk_op_unblock(VAR_0->conf->conf.blk, BLOCK_OP_TYPE_EXTERNAL_SNAPSHOT, VAR_0->blocker); blk_op_unblock(VAR_0->conf->conf.blk, BLOCK_OP_TYPE_INTERNAL_SNAPSHOT, VAR_0->blocker); blk_op_unblock(VAR_0->conf->conf.blk, BLOCK_OP_TYPE_INTERNAL_SNAPSHOT_DELETE, VAR_0->blocker); blk_op_unblock(VAR_0->conf->conf.blk, BLOCK_OP_TYPE_MIRROR_SOURCE, VAR_0->blocker); blk_op_unblock(VAR_0->conf->conf.blk, BLOCK_OP_TYPE_STREAM, VAR_0->blocker); blk_op_unblock(VAR_0->conf->conf.blk, BLOCK_OP_TYPE_REPLACE, VAR_0->blocker); }
[ "static void FUNC_0(VirtIOBlockDataPlane *VAR_0)\n{", "assert(!VAR_0->blocker);", "error_setg(&VAR_0->blocker, \"block device is in use by data plane\");", "blk_op_block_all(VAR_0->conf->conf.blk, VAR_0->blocker);", "blk_op_unblock(VAR_0->conf->conf.blk, BLOCK_OP_TYPE_RESIZE, VAR_0->blocker);", "blk_op_unblock(VAR_0->conf->conf.blk, BLOCK_OP_TYPE_DRIVE_DEL, VAR_0->blocker);", "blk_op_unblock(VAR_0->conf->conf.blk, BLOCK_OP_TYPE_BACKUP_SOURCE, VAR_0->blocker);", "blk_op_unblock(VAR_0->conf->conf.blk, BLOCK_OP_TYPE_CHANGE, VAR_0->blocker);", "blk_op_unblock(VAR_0->conf->conf.blk, BLOCK_OP_TYPE_COMMIT_SOURCE, VAR_0->blocker);", "blk_op_unblock(VAR_0->conf->conf.blk, BLOCK_OP_TYPE_COMMIT_TARGET, VAR_0->blocker);", "blk_op_unblock(VAR_0->conf->conf.blk, BLOCK_OP_TYPE_EJECT, VAR_0->blocker);", "blk_op_unblock(VAR_0->conf->conf.blk, BLOCK_OP_TYPE_EXTERNAL_SNAPSHOT,\nVAR_0->blocker);", "blk_op_unblock(VAR_0->conf->conf.blk, BLOCK_OP_TYPE_INTERNAL_SNAPSHOT,\nVAR_0->blocker);", "blk_op_unblock(VAR_0->conf->conf.blk, BLOCK_OP_TYPE_INTERNAL_SNAPSHOT_DELETE,\nVAR_0->blocker);", "blk_op_unblock(VAR_0->conf->conf.blk, BLOCK_OP_TYPE_MIRROR_SOURCE, VAR_0->blocker);", "blk_op_unblock(VAR_0->conf->conf.blk, BLOCK_OP_TYPE_STREAM, VAR_0->blocker);", "blk_op_unblock(VAR_0->conf->conf.blk, BLOCK_OP_TYPE_REPLACE, VAR_0->blocker);", "}" ]
[ 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 ] ]
7,585
static inline void scoop_gpio_handler_update(ScoopInfo *s) { uint32_t level, diff; int bit; level = s->gpio_level & s->gpio_dir; for (diff = s->prev_level ^ level; diff; diff ^= 1 << bit) { bit = ffs(diff) - 1; qemu_set_irq(s->handler[bit], (level >> bit) & 1); } s->prev_level = level; }
false
qemu
786a4ea82ec9c87e3a895cf41081029b285a5fe5
static inline void scoop_gpio_handler_update(ScoopInfo *s) { uint32_t level, diff; int bit; level = s->gpio_level & s->gpio_dir; for (diff = s->prev_level ^ level; diff; diff ^= 1 << bit) { bit = ffs(diff) - 1; qemu_set_irq(s->handler[bit], (level >> bit) & 1); } s->prev_level = level; }
{ "code": [], "line_no": [] }
static inline void FUNC_0(ScoopInfo *VAR_0) { uint32_t level, diff; int VAR_1; level = VAR_0->gpio_level & VAR_0->gpio_dir; for (diff = VAR_0->prev_level ^ level; diff; diff ^= 1 << VAR_1) { VAR_1 = ffs(diff) - 1; qemu_set_irq(VAR_0->handler[VAR_1], (level >> VAR_1) & 1); } VAR_0->prev_level = level; }
[ "static inline void FUNC_0(ScoopInfo *VAR_0) {", "uint32_t level, diff;", "int VAR_1;", "level = VAR_0->gpio_level & VAR_0->gpio_dir;", "for (diff = VAR_0->prev_level ^ level; diff; diff ^= 1 << VAR_1) {", "VAR_1 = ffs(diff) - 1;", "qemu_set_irq(VAR_0->handler[VAR_1], (level >> VAR_1) & 1);", "}", "VAR_0->prev_level = level;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1 ], [ 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ] ]
7,586
static void disas_simd_zip_trn(DisasContext *s, uint32_t insn) { unsupported_encoding(s, insn); }
false
qemu
5fa5469c08f6e51eed26d6d54e0be8682723d3df
static void disas_simd_zip_trn(DisasContext *s, uint32_t insn) { unsupported_encoding(s, insn); }
{ "code": [], "line_no": [] }
static void FUNC_0(DisasContext *VAR_0, uint32_t VAR_1) { unsupported_encoding(VAR_0, VAR_1); }
[ "static void FUNC_0(DisasContext *VAR_0, uint32_t VAR_1)\n{", "unsupported_encoding(VAR_0, VAR_1);", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
7,587
static int run_ccw(struct subchannel_id schid, int cmd, void *ptr, int len) { struct ccw1 ccw = {}; struct cmd_orb orb = {}; struct schib schib; int r; /* start command processing */ stsch_err(schid, &schib); schib.scsw.ctrl = SCSW_FCTL_START_FUNC; msch(schid, &schib); /* start subchannel command */ orb.fmt = 1; orb.cpa = (u32)(long)&ccw; orb.lpm = 0x80; ccw.cmd_code = cmd; ccw.cda = (long)ptr; ccw.count = len; r = ssch(schid, &orb); /* * XXX Wait until device is done processing the CCW. For now we can * assume that a simple tsch will have finished the CCW processing, * but the architecture allows for asynchronous operation */ drain_irqs(schid); return r; }
false
qemu
0f3f1f302fd2021a5ce6cb170321d0a0d35bdec5
static int run_ccw(struct subchannel_id schid, int cmd, void *ptr, int len) { struct ccw1 ccw = {}; struct cmd_orb orb = {}; struct schib schib; int r; stsch_err(schid, &schib); schib.scsw.ctrl = SCSW_FCTL_START_FUNC; msch(schid, &schib); orb.fmt = 1; orb.cpa = (u32)(long)&ccw; orb.lpm = 0x80; ccw.cmd_code = cmd; ccw.cda = (long)ptr; ccw.count = len; r = ssch(schid, &orb); drain_irqs(schid); return r; }
{ "code": [], "line_no": [] }
static int FUNC_0(struct subchannel_id VAR_0, int VAR_1, void *VAR_2, int VAR_3) { struct ccw1 VAR_4 = {}; struct cmd_orb VAR_5 = {}; struct VAR_6 VAR_6; int VAR_7; stsch_err(VAR_0, &VAR_6); VAR_6.scsw.ctrl = SCSW_FCTL_START_FUNC; msch(VAR_0, &VAR_6); VAR_5.fmt = 1; VAR_5.cpa = (u32)(long)&VAR_4; VAR_5.lpm = 0x80; VAR_4.cmd_code = VAR_1; VAR_4.cda = (long)VAR_2; VAR_4.count = VAR_3; VAR_7 = ssch(VAR_0, &VAR_5); drain_irqs(VAR_0); return VAR_7; }
[ "static int FUNC_0(struct subchannel_id VAR_0, int VAR_1, void *VAR_2, int VAR_3)\n{", "struct ccw1 VAR_4 = {};", "struct cmd_orb VAR_5 = {};", "struct VAR_6 VAR_6;", "int VAR_7;", "stsch_err(VAR_0, &VAR_6);", "VAR_6.scsw.ctrl = SCSW_FCTL_START_FUNC;", "msch(VAR_0, &VAR_6);", "VAR_5.fmt = 1;", "VAR_5.cpa = (u32)(long)&VAR_4;", "VAR_5.lpm = 0x80;", "VAR_4.cmd_code = VAR_1;", "VAR_4.cda = (long)VAR_2;", "VAR_4.count = VAR_3;", "VAR_7 = ssch(VAR_0, &VAR_5);", "drain_irqs(VAR_0);", "return VAR_7;", "}" ]
[ 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 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 55 ], [ 57 ], [ 59 ] ]
7,588
static struct omap_lpg_s *omap_lpg_init(target_phys_addr_t base, omap_clk clk) { int iomemtype; struct omap_lpg_s *s = (struct omap_lpg_s *) qemu_mallocz(sizeof(struct omap_lpg_s)); s->tm = qemu_new_timer(rt_clock, omap_lpg_tick, s); omap_lpg_reset(s); iomemtype = cpu_register_io_memory(omap_lpg_readfn, omap_lpg_writefn, s, DEVICE_NATIVE_ENDIAN); cpu_register_physical_memory(base, 0x800, iomemtype); omap_clk_adduser(clk, qemu_allocate_irqs(omap_lpg_clk_update, s, 1)[0]); return s; }
false
qemu
7bd427d801e1e3293a634d3c83beadaa90ffb911
static struct omap_lpg_s *omap_lpg_init(target_phys_addr_t base, omap_clk clk) { int iomemtype; struct omap_lpg_s *s = (struct omap_lpg_s *) qemu_mallocz(sizeof(struct omap_lpg_s)); s->tm = qemu_new_timer(rt_clock, omap_lpg_tick, s); omap_lpg_reset(s); iomemtype = cpu_register_io_memory(omap_lpg_readfn, omap_lpg_writefn, s, DEVICE_NATIVE_ENDIAN); cpu_register_physical_memory(base, 0x800, iomemtype); omap_clk_adduser(clk, qemu_allocate_irqs(omap_lpg_clk_update, s, 1)[0]); return s; }
{ "code": [], "line_no": [] }
static struct omap_lpg_s *FUNC_0(target_phys_addr_t VAR_0, omap_clk VAR_1) { int VAR_2; struct omap_lpg_s *VAR_3 = (struct omap_lpg_s *) qemu_mallocz(sizeof(struct omap_lpg_s)); VAR_3->tm = qemu_new_timer(rt_clock, omap_lpg_tick, VAR_3); omap_lpg_reset(VAR_3); VAR_2 = cpu_register_io_memory(omap_lpg_readfn, omap_lpg_writefn, VAR_3, DEVICE_NATIVE_ENDIAN); cpu_register_physical_memory(VAR_0, 0x800, VAR_2); omap_clk_adduser(VAR_1, qemu_allocate_irqs(omap_lpg_clk_update, VAR_3, 1)[0]); return VAR_3; }
[ "static struct omap_lpg_s *FUNC_0(target_phys_addr_t VAR_0, omap_clk VAR_1)\n{", "int VAR_2;", "struct omap_lpg_s *VAR_3 = (struct omap_lpg_s *)\nqemu_mallocz(sizeof(struct omap_lpg_s));", "VAR_3->tm = qemu_new_timer(rt_clock, omap_lpg_tick, VAR_3);", "omap_lpg_reset(VAR_3);", "VAR_2 = cpu_register_io_memory(omap_lpg_readfn,\nomap_lpg_writefn, VAR_3, DEVICE_NATIVE_ENDIAN);", "cpu_register_physical_memory(VAR_0, 0x800, VAR_2);", "omap_clk_adduser(VAR_1, qemu_allocate_irqs(omap_lpg_clk_update, VAR_3, 1)[0]);", "return VAR_3;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7, 9 ], [ 13 ], [ 17 ], [ 21, 23 ], [ 25 ], [ 29 ], [ 33 ], [ 35 ] ]